@timqi/pier 0.2.0 → 0.3.1

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.
Files changed (77) hide show
  1. package/dist/agent/listing.js +14 -10
  2. package/dist/agent/pi.js +2 -2
  3. package/dist/agent/roles.js +5 -4
  4. package/dist/channels/conversations.js +4 -4
  5. package/dist/channels/lark-outbound.js +5 -0
  6. package/dist/channels/lark.js +25 -5
  7. package/dist/channels/runtime.js +47 -2
  8. package/dist/channels/slack-outbound.js +7 -0
  9. package/dist/channels/slack-thread.js +65 -0
  10. package/dist/channels/slack.js +27 -72
  11. package/dist/cli.js +7 -2
  12. package/dist/core/chain.js +27 -5
  13. package/dist/core/identity.js +2 -2
  14. package/dist/core/inbound-file.js +9 -3
  15. package/dist/core/reply.js +17 -3
  16. package/dist/core/search.js +65 -0
  17. package/dist/core/types.js +2 -0
  18. package/dist/db.js +8 -0
  19. package/dist/drain.js +1 -1
  20. package/dist/main.js +21 -5
  21. package/dist/settings.js +1 -1
  22. package/dist/socket.js +1 -0
  23. package/dist/tasks/agent.js +1 -1
  24. package/dist/tasks/callbacks.js +1 -1
  25. package/dist/tasks/execution.js +9 -3
  26. package/dist/tasks/open-items.js +53 -35
  27. package/dist/tasks/service.js +22 -1
  28. package/dist/tasks/store.js +5 -2
  29. package/dist/tasks/types.js +0 -2
  30. package/dist/tools.js +10 -3
  31. package/dist/web/public/assets/{code-BZwvPani.js → code-CWT27KH1.js} +1 -1
  32. package/dist/web/public/assets/code-CWT27KH1.js.br +0 -0
  33. package/dist/web/public/assets/code-CWT27KH1.js.gz +0 -0
  34. package/dist/web/public/assets/{explorer-DDoVzMLQ.js → explorer-BoU77faI.js} +4 -4
  35. package/dist/web/public/assets/explorer-BoU77faI.js.br +0 -0
  36. package/dist/web/public/assets/explorer-BoU77faI.js.gz +0 -0
  37. package/dist/web/public/assets/highlight-CDSk2hRJ.js +72 -0
  38. package/dist/web/public/assets/highlight-CDSk2hRJ.js.br +0 -0
  39. package/dist/web/public/assets/highlight-CDSk2hRJ.js.gz +0 -0
  40. package/dist/web/public/assets/index-DqLJpDE0.js +14 -0
  41. package/dist/web/public/assets/index-DqLJpDE0.js.br +0 -0
  42. package/dist/web/public/assets/index-DqLJpDE0.js.gz +0 -0
  43. package/dist/web/public/assets/index-JN0Ic8K5.css +2 -0
  44. package/dist/web/public/assets/index-JN0Ic8K5.css.br +0 -0
  45. package/dist/web/public/assets/index-JN0Ic8K5.css.gz +0 -0
  46. package/dist/web/public/assets/settings-BprIId_R.js +9 -0
  47. package/dist/web/public/assets/settings-BprIId_R.js.br +0 -0
  48. package/dist/web/public/assets/settings-BprIId_R.js.gz +0 -0
  49. package/dist/web/public/index.html +3 -4
  50. package/dist/web/public/index.html.br +0 -0
  51. package/dist/web/public/index.html.gz +0 -0
  52. package/dist/web/push.js +2 -2
  53. package/dist/web/server.js +2 -4
  54. package/dist/web/session-state.js +1 -2
  55. package/package.json +1 -1
  56. package/skills/pier-help/SKILL.md +6 -1
  57. package/skills/pier-search/SKILL.md +27 -0
  58. package/skills/pier-tasks/SKILL.md +17 -3
  59. package/dist/web/public/assets/code-BZwvPani.js.br +0 -0
  60. package/dist/web/public/assets/code-BZwvPani.js.gz +0 -0
  61. package/dist/web/public/assets/explorer-DDoVzMLQ.js.br +0 -0
  62. package/dist/web/public/assets/explorer-DDoVzMLQ.js.gz +0 -0
  63. package/dist/web/public/assets/highlight-5Bl8zZ8q.js +0 -72
  64. package/dist/web/public/assets/highlight-5Bl8zZ8q.js.br +0 -0
  65. package/dist/web/public/assets/highlight-5Bl8zZ8q.js.gz +0 -0
  66. package/dist/web/public/assets/index-BpFzCwlo.js +0 -7
  67. package/dist/web/public/assets/index-BpFzCwlo.js.br +0 -0
  68. package/dist/web/public/assets/index-BpFzCwlo.js.gz +0 -0
  69. package/dist/web/public/assets/index-wAGxFFPj.css +0 -2
  70. package/dist/web/public/assets/index-wAGxFFPj.css.br +0 -0
  71. package/dist/web/public/assets/index-wAGxFFPj.css.gz +0 -0
  72. package/dist/web/public/assets/report-zjE8Bt8S.js +0 -8
  73. package/dist/web/public/assets/report-zjE8Bt8S.js.br +0 -0
  74. package/dist/web/public/assets/report-zjE8Bt8S.js.gz +0 -0
  75. package/dist/web/public/assets/settings-Cv7rbeqf.js +0 -9
  76. package/dist/web/public/assets/settings-Cv7rbeqf.js.br +0 -0
  77. package/dist/web/public/assets/settings-Cv7rbeqf.js.gz +0 -0
@@ -1,5 +1,5 @@
1
- import{B as e,Et as t,J as n,M as r,T as i,Tt as a,U as o,V as s,X as c,Z as l,bt as u,c as d,f,g as p,h as m,k as h,n as ee,p as te,q as ne,rt as g,s as re,t as ie,vt as _,x as ae}from"./highlight-5Bl8zZ8q.js";import{a as oe}from"./index-BpFzCwlo.js";import{n as se,t as ce}from"./code-BZwvPani.js";var le=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]],ue=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3-3-3 3`}],[`path`,{d:`m15 5-3 3-3-3`}]],de=[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`}]],fe=[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}]],v=[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}],[`path`,{d:`M3 3v5h5`}]],y=e=>{let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`},b=e=>[e.subject,e.body,[[e.author,e.email?`<${e.email}>`:``].filter(Boolean).join(` `),e.at?y(e.at):``].filter(Boolean).join(` · `)].filter(Boolean).join(`
1
+ import{B as e,Et as t,J as n,M as r,Mt as i,T as a,U as o,V as s,X as c,Z as l,c as u,f as d,g as f,h as p,jt as m,k as h,n as ee,p as te,q as ne,rt as g,s as re,t as ie,wt as _,x as ae}from"./highlight-CDSk2hRJ.js";import{a as oe}from"./index-DqLJpDE0.js";import{n as se,t as ce}from"./code-CWT27KH1.js";var le=[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]],ue=[[`path`,{d:`M12 22v-6`}],[`path`,{d:`M12 8V2`}],[`path`,{d:`M4 12H2`}],[`path`,{d:`M10 12H8`}],[`path`,{d:`M16 12h-2`}],[`path`,{d:`M22 12h-2`}],[`path`,{d:`m15 19-3-3-3 3`}],[`path`,{d:`m15 5-3 3-3-3`}]],de=[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`}]],fe=[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}]],v=[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`}],[`path`,{d:`M3 3v5h5`}]],y=e=>{let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`},b=e=>[e.subject,e.body,[[e.author,e.email?`<${e.email}>`:``].filter(Boolean).join(` `),e.at?y(e.at):``].filter(Boolean).join(` · `)].filter(Boolean).join(`
2
2
 
3
- `),x=null;function S(){x&&(x.remove(),x=null,document.removeEventListener(`pointerdown`,S,!0),window.removeEventListener(`scroll`,S,!0))}function pe(e,t){e.onmouseenter=()=>{S();let r=t();if(!r)return;x=n(`div`,`pointer-events-none fixed z-50 max-w-96 whitespace-pre-wrap rounded-lg bg-neutral-800/95 px-3 py-2 font-sans text-[11.5px] leading-snug text-neutral-100 shadow-lg`),x.textContent=r,(e.closest(`dialog[open]`)??document.body).append(x),document.addEventListener(`pointerdown`,S,!0),window.addEventListener(`scroll`,S,!0);let i=e.getBoundingClientRect();x.style.left=`${Math.max(8,Math.min(i.left,window.innerWidth-x.offsetWidth-8))}px`,x.style.top=i.bottom+6+x.offsetHeight>window.innerHeight?`${i.top-x.offsetHeight-6}px`:`${i.bottom+6}px`},e.onmouseleave=S}function C(e,t,r){let i=n(`button`,`flex w-full cursor-pointer items-center gap-1.5 px-2 py-1 text-left hover:bg-neutral-100`,_(a,`h-3 w-3 text-indigo-600 ${e.value===t?``:`invisible`}`),n(`span`,`inline-flex flex-none items-center gap-1.5 font-mono text-[11.5px] text-neutral-800`,e.label??e.value));return e.subject&&i.append(n(`span`,`min-w-0 truncate text-[11px] text-neutral-400`,e.subject)),e.author&&i.append(n(`span`,`ml-auto flex-none pl-1.5 text-[10.5px] text-neutral-400`,`${e.author} · ${e.at?l(e.at):``}`)),pe(i,()=>b(e)),i.onclick=()=>r(e.value),i}function me(e,t,r,i,a){let{base:o,head:s}=r,c=()=>s&&o===`${s}~1`?s:``,l=c()?`commit`:`compare`,u=t.commits[0],p=e=>[...e?[{value:``,label:`Working tree`,subject:`the files on disk, uncommitted changes included`}]:[],{...u,value:`HEAD`},...t.refs.map(e=>({value:e.name,subject:e.subject})),...t.commits.map(e=>({...e,value:e.hash}))],m=n(`div`,`flex w-[38rem] max-w-full flex-col`);function h(){let e=(e,t)=>{let r=n(`button`,`cursor-pointer rounded-full px-2.5 py-0.5 text-[11.5px] ${l===t?`bg-indigo-50 font-medium text-indigo-700`:`text-neutral-500 hover:bg-neutral-100`}`,e);return r.onclick=()=>{l=t,h()},r},r=(e,t,r,i)=>n(`div`,`flex min-w-0 flex-1 flex-col`,n(`div`,`flex-none px-2 pb-0.5 text-[10.5px] font-semibold uppercase tracking-wide text-neutral-400`,e),n(`div`,`min-h-0 flex-1 overflow-y-auto`,...t.map(e=>C(e,r,i)))),u=l===`compare`?n(`div`,`flex h-72 min-h-0 divide-x divide-neutral-200 pb-1`,r(`base`,p(!1),o,e=>{o=e,h(),i(o,s)}),r(`to`,p(!0),s,e=>{s=e,h(),i(o,s)})):n(`div`,`flex h-72 min-h-0 flex-col overflow-y-auto pb-1`,...t.commits.map(e=>C({value:e.hash,...e},c(),e=>{o=`${e}~1`,s=e,d(),i(o,s)}))),f=n(`div`,`flex-none border-t border-neutral-200`,C({value:a,label:`${a} ↔ Working tree`,subject:`back to the default: the main line's tip vs the files on disk`},o===a&&s===``?a:``,()=>{o=a,s=``,h(),i(o,s)}));f.querySelector(`button > span`).prepend(_(v)),m.replaceChildren(n(`div`,`flex flex-none items-center gap-1 border-b border-neutral-200 px-2 py-1.5`,e(`Compare two points`,`compare`),e(`One commit`,`commit`)),u,...l===`compare`?[f]:[])}h(),f(e,m)}var he=e=>e.slice(0,Math.max(0,e.lastIndexOf(`/`))),ge=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i,_e=/\.(md|markdown)$/i,ve={A:`text-emerald-600`,M:`text-amber-600`,D:`text-red-600`},ye=30,w=`pier.filesPrefs`,T=50,E=()=>{try{let e=JSON.parse(localStorage.getItem(w)??`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}},be=e=>{let t=e?E()[e]:void 0;return typeof t?.cwd==`string`&&typeof t.base==`string`&&typeof t.head==`string`?{cwd:t.cwd,base:t.base,head:t.head}:null},xe=(e,t)=>{let n=E();delete n[e],n[e]=t;let r=Object.keys(n);for(let e of r.slice(0,Math.max(0,r.length-T)))delete n[e];try{localStorage.setItem(w,JSON.stringify(n))}catch(e){console.warn(`Files: could not remember this folder`,e)}},Se=`flex min-w-0 flex-none items-center gap-1.5 rounded-full px-2.5 py-1 font-mono text-[11.5px]`,Ce=(e,t=`indigo`)=>ae(e,`${Se} cursor-pointer truncate text-left ${t===`indigo`?`bg-indigo-50 font-medium text-indigo-700 hover:bg-indigo-100`:`bg-neutral-100 text-neutral-600 hover:bg-neutral-200`}`),D,O=()=>D??=N(e(`#files-dialog`)),k=(e,t,n,r)=>O()(e,t,n,r);function A(t){let n=e(`#files-dialog`);n.open?n.close():k(t)}function j(e,t){if(e&&t===e)return{root:e};let n=e&&t.startsWith(`${e}/`)?e:t.slice(0,t.lastIndexOf(`/`))||`/`,r=t.slice(n===`/`?1:n.length+1);return r?{root:n,select:r}:{root:n}}function we(e,t,n){if(!n||n.startsWith(`#`)||n.startsWith(`//`)||/^[a-z][a-z\d+.-]*:/i.test(n))return null;let r=n.replace(/[?#].*$/s,``);try{r=decodeURIComponent(r)}catch{}let i=(r.startsWith(`/`)?r===e||r.startsWith(`${e}/`)?``:e:t).split(`/`).filter(Boolean);for(let e of r.split(`/`))e===`..`?i.pop():e&&e!==`.`&&i.push(e);return`/${i.join(`/`)}`}var Te=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,``).replace(/\s/g,`-`);function M(e,t,n){let{root:r,select:i}=j(e?.cwd??``,t);k(e,r,i,n)}function N(e){let a=``,l=``,d={branch:null,refs:[],commits:[],worktrees:[]},f=`HEAD`,v=``,y=new Map,x=!0,S=!1,C=!1,w=[],T=new Set,E=null,D=null,O=null,k,A=n(`header`,`pagehead flex-nowrap`),M=n(`div`,`${te} flex-col items-stretch gap-1.5 px-3 py-2.5`),N=n(`div`,`min-h-0 flex-1 overflow-y-auto px-1.5 py-1.5`),Ee=n(`aside`,`${p} w-64 flex-none text-[12.5px] leading-5 max-md:h-1/2 max-md:w-full`,M,N),P=n(`div`,`${te} flex-wrap gap-2 px-4 py-2.5 font-mono text-[11.5px] text-neutral-500`),F=n(`div`,`h-full min-w-0 overflow-auto`),I=n(`div`,`pointer-events-none absolute inset-y-1 right-0.5 z-20 hidden w-2`),De=n(`div`,`relative min-h-0 flex-1`,F,I),Oe=n(`section`,`${p} min-h-0 min-w-0 flex-1`,P,De);e.append(A,n(`div`,`flex min-h-0 flex-1 gap-3 px-4 pb-4 pt-1 max-md:flex-col`,Ee,Oe));let L=(e,t)=>`/api/explorer/${e}?${new URLSearchParams({root:a,...t})}`,R=(e,t)=>`/api/fs/${e}?${new URLSearchParams({root:a,...t})}`,z=(e,t=`text-neutral-400`)=>n(`p`,`px-3 py-2 text-[12.5px] ${t}`,e),B=e=>n(`div`,`flex h-full items-center justify-center p-6`,i(e)),ke=()=>x&&d.branch!==null,Ae=e=>{let t=0;for(let n of y.keys())n.startsWith(`${e}/`)&&t++;return t};function je(e,t){let n=new Set(t.map(e=>e.name)),r=e?`${e}/`:``;for(let[e,i]of y){if(i.status!==`D`||!e.startsWith(r))continue;let a=e.slice(r.length).split(`/`)[0];n.has(a)||(n.add(a),t.push({name:a,dir:e.slice(r.length).includes(`/`)}))}let i=t;return ke()&&(i=t.filter(e=>e.dir?Ae(`${r}${e.name}`)>0:y.has(`${r}${e.name}`))),i.sort((e,t)=>Number(t.dir)-Number(e.dir)||e.name.localeCompare(t.name)),O&&he(O)===e&&!n.has(o(O))&&(F.replaceChildren(B(`No such file: ${O}`)),O=null),i.map(e=>e.dir?Ne(`${r}${e.name}`,e.name):Pe(`${r}${e.name}`,e.name))}async function Me(e,t){try{let{entries:n}=await g(R(`ls`,{path:t}),`could not list this folder`);e.replaceChildren(...je(t,n)),e.childElementCount||e.append(z(ke()?`No changes.`:`Empty.`))}catch(n){let r=je(t,[]);r.length?e.replaceChildren(...r):e.replaceChildren(z(String(n),`text-red-600`))}}function Ne(e,t){let r=Ae(e),i=[n(`span`,`truncate`,t)];r&&i.push(n(`span`,`ml-auto flex-none rounded-full bg-amber-100/80 px-1.5 font-mono text-[10px] font-semibold text-amber-700`,String(r)));let{el:a,summary:o}=ne(``,i);o.className+=` rounded-lg px-2 py-1 transition-colors hover:bg-neutral-100`;let s=n(`div`,`pl-3`);a.append(s);let c=!1,l=()=>{c||(c=!0,s.append(z(`…`)),Me(s,e))};a.ontoggle=()=>{T[a.open?`add`:`delete`](e),a.open&&l()};let u=d.branch?x:!e.includes(`/`);return e===O&&(O=null),(u&&!C||T.has(e))&&(a.open=!0,l()),a}function V(e){D?.classList.remove(`bg-indigo-50`,`font-medium`,`text-indigo-700`),D=e,e.classList.add(`bg-indigo-50`,`font-medium`,`text-indigo-700`)}function Pe(e,t){let r=y.get(e)?.status,i=n(`button`,`flex w-full cursor-pointer items-center gap-1.5 rounded-lg py-1 pl-6 pr-2 text-left transition-colors hover:bg-neutral-100`,n(`span`,`truncate`,t));return r&&i.append(n(`span`,`ml-auto flex-none font-mono text-[10.5px] font-semibold ${ve[r]??`text-neutral-500`}`,r)),i.title=e,e===E&&V(i),e===O&&(O=null,E=e,V(i),q(e)),i.onclick=()=>{V(i),E=e,q(e)},i}let H=()=>void Me(N,``),Fe=(e,t)=>[...e?[n(`span`,`flex-none font-mono text-[10.5px] font-semibold text-emerald-600`,`+${e}`)]:[],...t?[n(`span`,`flex-none font-mono text-[10.5px] font-semibold text-red-600`,`−${t}`)]:[]];function U(e,t=!1,...r){if(P.classList.toggle(`hidden`,!e),P.classList.toggle(`flex`,!!e),!e)return P.replaceChildren();let i=y.get(e),a=[n(`span`,`min-w-0 truncate`,e)];i&&(a.push(n(`span`,`flex-none font-semibold ${ve[i.status]??``}`,i.status)),a.push(...Fe(i.add,i.del)));let s=n(`div`,`ml-auto flex flex-none items-center gap-2`);if(s.append(...r),t){let t=document.createElement(`a`);t.className=`btn flex-none text-[12px]`,t.href=R(`file`,{path:e}),t.download=o(e),t.textContent=`Download`,s.append(t)}P.replaceChildren(...a,s)}function Ie(e){let t=0;for(;t<e.length;){if(e[t].tone!==`del`){t++;continue}let n=t;for(;t<e.length&&e[t].tone===`del`;)t++;let r=t;for(;t<e.length&&e[t].tone===`add`;)t++;let i=Math.min(r-n,t-r);for(let t=0;t<i;t++){let i=e[n+t],a=e[r+t],o=Math.min(i.text.length,a.text.length),s=0;for(;s<o&&i.text[s]===a.text[s];)s++;let c=0;for(;c<o-s&&i.text[i.text.length-1-c]===a.text[a.text.length-1-c];)c++;s+c!==0&&(i.mark=[s,i.text.length-c],a.mark=[s,a.text.length-c])}}}let W=Je();function G(){I.classList.add(`hidden`),I.replaceChildren(),W.set([],[])}function Le(e,t){let n=e===E?k:void 0;if(n===void 0)return t;k=void 0;let r=t.querySelector(`[data-line="${String(n)}"]`);return r?.classList.add(`bg-indigo-100`),requestAnimationFrame(()=>r?.scrollIntoView({block:`center`})),t}let Re=0,K=e=>e===Re,ze=e=>_e.test(e)&&!S&&(e!==E||k===void 0);function Be(e,t){if(!_e.test(e))return[];let n=r([[`Rendered`,`rendered`],[`Source`,`source`]],t?`rendered`:`source`,n=>{n===`rendered`!==t&&(S=n===`source`,q(e))});return n.classList.add(`font-sans`),[n]}function Ve(e,t){let n=c(e);n.className=`md mx-auto max-w-3xl px-6 py-5 text-[14px] leading-relaxed`,ie(n),s(n);let r=`${a}/${he(t)}`,i=e=>{let t=j(a,e);return`/api/fs/file?${new URLSearchParams({root:t.root,path:t.select??``})}`};for(let e of n.querySelectorAll(`img`)){let t=we(a,r,e.getAttribute(`src`)??``);t&&e.setAttribute(`src`,i(t))}for(let e of n.querySelectorAll(`a`)){let t=e.getAttribute(`href`)??``;if(t.startsWith(`#`)){e.onclick=e=>{e.preventDefault();let r=t.slice(1);try{r=decodeURIComponent(r)}catch{}r=r.toLowerCase(),[...n.querySelectorAll(`h1, h2, h3, h4, h5, h6`)].find(e=>Te(e.textContent??``)===r)?.scrollIntoView({block:`start`})};continue}let o=we(a,r,t);o&&(e.setAttribute(`href`,i(o)),e.onclick=e=>{if(e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0)return;e.preventDefault();let t=j(a,o);$(Q,t.root,t.select)})}return n}function q(e){let t=++Re;return y.has(e)?Ye(e,t):He(e,t)}async function He(e,t){if(!K(t))return;G();let r=R(`file`,{path:e}),i=n(`div`,`min-w-0`);F.classList.remove(`flex`,`flex-col`);let a=ze(e);if(U(e,!0,...Be(e,a)),F.replaceChildren(i),ge.test(e)){let e=n(`img`,`max-w-full p-4`);e.src=r,e.onerror=()=>i.replaceChildren(z(`Could not load image.`,`text-red-600`)),i.append(e);return}if(e.toLowerCase().endsWith(`.pdf`)){let e=document.createElement(`iframe`);e.className=`h-full w-full`,e.src=r,F.replaceChildren(e),F.classList.add(`flex`,`flex-col`);return}i.append(z(`…`));let o=await fetch(r);if(!K(t))return;if(!o.ok){let{error:e}=await o.json().catch(()=>({}));i.replaceChildren(z(e??`HTTP ${o.status}`,`text-red-600`));return}if(!(o.headers.get(`content-type`)??``).startsWith(`text/plain`)){i.replaceChildren(z(`Binary file — use Download.`));return}let s=await o.text();if(!K(t))return;if(a)return void i.replaceChildren(Ve(s,e));let c=se(s),l=await ee(e);K(t)&&i.replaceChildren(Le(e,ce(c,l)))}function Ue(e){let t=[],n=0,r=0,i=!1,a=e.split(`
4
- `);a.at(-1)===``&&a.pop();for(let e of a){let a=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);if(a){i&&t.push({nums:[``,``],text:`⋯`,tone:``}),[n,r]=[Number(a[1]),Number(a[2])],i=!0;continue}!i||e.startsWith(`\\`)||(e.startsWith(`+`)?t.push({nums:[``,r++],text:e.slice(1),tone:`add`}):e.startsWith(`-`)?t.push({nums:[n++,``],text:e.slice(1),tone:`del`}):t.push({nums:[n++,r++],text:e.slice(1),tone:``}))}return t}function We(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n].tone;if(!r)continue;let i=t.at(-1);i&&i.end===n-1?(i.end=n,(r===`add`&&i.tone===`del`||r===`del`&&i.tone===`add`)&&(i.tone=`mixed`)):t.push({start:n,end:n,tone:r})}return t}let Ge={add:`bg-emerald-400`,del:`bg-red-400`,mixed:`bg-amber-400`};function Ke(e,t,r){I.replaceChildren(...e.map(e=>{let i=n(`button`,`map-mark pointer-events-auto absolute left-1/2 w-1 -translate-x-1/2 cursor-pointer rounded-full ${Ge[e.tone]}`);return i.style.top=`${e.start/t*100}%`,i.style.height=`${Math.max(.4,(e.end-e.start+1)/t*100)}%`,i.title=`line ${qe(r,e.start)}`,i.onclick=()=>r[e.start].scrollIntoView({block:`center`}),i})),I.classList.remove(`hidden`)}let qe=(e,t)=>e[t]?.querySelector(`span`)?.textContent?.trim()||String(t+1);function Je(){let r=[],i=[],a=-1,o=n(`span`,`flex-none text-[10.5px] text-neutral-400`),s=e=>{r.length&&(a=(a+e+r.length)%r.length,i[r[a].start].scrollIntoView({block:`center`}),o.textContent=`${a+1}/${r.length}`)},c=()=>r.length>0&&e.open,l=(e,t,r,i)=>{let a=n(`button`,`icon-btn flex-none`,_(e));return a.onclick=()=>s(t),oe(a,i,r,()=>s(t),c),a};return{el:n(`div`,`flex flex-none items-center gap-1`,o,l(t,-1,`Previous change`,[`p`,`k`]),l(le,1,`Next change`,[`n`,`j`])),set(e,t){r=e,i=t,a=-1,o.textContent=`${e.length} change${e.length===1?``:`s`}`}}}async function Ye(e,t){G(),F.classList.remove(`flex`,`flex-col`);let n=y.get(e)?.status===`D`,r=!n,i=ze(e),a=Be(e,i);U(e,r,...a),F.replaceChildren(z(`…`));try{let{diff:o}=await g(L(`diff`,{base:f,head:v,file:e,context:`99999`}),`could not read this diff`);if(!K(t))return;if(!o||/^Binary files /m.test(o))return He(e,t);let s=Ue(o);if(i){let t=n?`add`:`del`,r=s.filter(e=>e.tone!==t&&e.nums.some(e=>e!==``)).map(e=>e.text).join(`
5
- `);F.replaceChildren(Ve(r,e));return}Ie(s);let c=await ee(e);if(!K(t))return;let l=Le(e,ce(s,c)),u=[...l.children],d=We(s);W.set(d,u),U(e,r,...a,W.el),F.replaceChildren(l),Ke(d,s.length,u)}catch(n){if(!K(t))return;U(e),F.replaceChildren(z(String(n),`text-red-600`))}}let J=()=>v&&f===`${v}~1`?v:``,Xe=()=>d.commits.find(e=>e.hash===J())?.subject??``,Ze=()=>J()?`${J()} — ${Xe()||`commit`}`:`${f} ↔ ${v||`working tree`}`,Qe=(e,t,r,i)=>{let a=n(`button`,`icon-btn ${r?`bg-indigo-50 text-indigo-700 hover:bg-indigo-100 hover:text-indigo-700`:``}`);return a.append(_(e)),a.title=t,a.setAttribute(`aria-label`,t),a.setAttribute(`aria-pressed`,String(r)),a.onclick=i,a};function Y(){let e=Qe(de,`Show only files that differ`,x,()=>{x=!x,Y(),H()}),t=Qe(ue,C?`Restore folders`:`Collapse all folders`,C,()=>{if(C=!C,C)w=[...T],T.clear();else for(let e of w)T.add(e);Y(),H()});if(M.classList.toggle(`hidden`,!d.branch),M.classList.toggle(`flex`,!!d.branch),!d.branch)return void M.replaceChildren();let r=ae(Ze(),`${m} font-mono`);if(J()){let e=d.commits.find(e=>e.hash===J());pe(r,()=>e?b(e):``)}else r.title=`Choose what to diff`;r.onclick=async()=>{await nt(),me(r,d,{base:f,head:v},(e,t)=>{f=e,v=t,X()},rt())};let[i,a]=[0,0];for(let e of y.values())i+=e.add,a+=e.del;M.replaceChildren(r,n(`div`,`flex items-center gap-1.5 pl-0.5`,n(`span`,`text-[11px] text-neutral-400`,`${y.size} changed file${y.size===1?``:`s`}`),...Fe(i,a),n(`span`,`ml-auto`),e,t))}let $e=()=>{l&&a&&xe(l,{cwd:a,base:f,head:v})},et=e=>{let t=e.replace(/~\d+$/,``);return!t||t===`HEAD`||d.refs.some(e=>e.name===t)||d.commits.some(e=>e.hash===t)};async function tt(){if(y=new Map,!d.branch)return;let{files:e}=await g(L(`diff`,{base:f,head:v}),`could not read what changed`);for(let t of e)y.set(t.path,{status:t.status,add:t.add,del:t.del});if(y.size<=ye)for(let e of y.keys()){let t=e.split(`/`);for(let e=1;e<t.length;e++)T.add(t.slice(0,e).join(`/`))}}async function X(){$e();try{await tt()}catch(e){Y(),N.replaceChildren(z(String(e),`text-red-600`));return}Y(),H(),E&&q(E)}function Z(){let t=Ce(``,`neutral`);t.className+=` max-w-72`,t.append(n(`span`,`truncate max-md:hidden`,a||`Choose a folder…`),n(`span`,`truncate md:hidden`,a?o(a):`Choose a folder…`)),t.title=a?`${a} — switch folder`:`Choose a folder`,t.onclick=()=>re(t,d.worktrees.map(e=>({path:e.path,...e.branch?{hint:e.branch}:{}})),a||void 0,e=>$(Q,e));let r=n(`button`,`icon-btn ml-auto`,_(u));r.type=`button`,r.title=`Close Files`,r.setAttribute(`aria-label`,`Close Files`),r.onclick=()=>e.close();let i=d.branch?[n(`span`,`${Se} bg-neutral-100 text-neutral-600`,_(fe),n(`span`,`truncate`,d.branch))]:[];A.replaceChildren(h(`Files`),t,...i,r)}async function nt(){if(a)try{d=await g(L(`git`,{}),`could not read this repository`),Z()}catch(e){F.replaceChildren(B(String(e)))}}let rt=()=>d.refs.some(e=>e.name===`main`)?`main`:d.refs.some(e=>e.name===`master`)?`master`:`HEAD`;async function it(e){if(Z(),E=null,D=null,T.clear(),O=e||null,e){x=!1;let t=e.split(`/`);for(let e=1;e<=t.length;e++)T.add(t.slice(0,e).join(`/`))}if(G(),F.classList.remove(`flex`,`flex-col`),U(),F.replaceChildren(B(`Select a file.`)),!a){d={branch:null,refs:[],commits:[],worktrees:[]},Y(),N.replaceChildren(),F.replaceChildren(B(`No folder yet — pick one from the chip above.`));return}try{d=await g(L(`git`,{}),`could not read this repository`)}catch(e){d={branch:null,refs:[],commits:[],worktrees:[]},F.replaceChildren(B(String(e)))}let t=be(l),n=t&&t.cwd===a&&et(t.base)&&et(t.head)?t:null;f=n?.base??rt(),v=n?.head??``,Z(),await X()}e.addEventListener(`close`,()=>{G(),F.classList.remove(`flex`,`flex-col`),U(),F.replaceChildren(B(`Select a file.`)),D?.classList.remove(`bg-indigo-50`,`font-medium`,`text-indigo-700`),E=null,D=null});let Q;function $(t,n,r,i){Q=t;let o=t?.id??``;e.open||e.showModal();let s=n?.startsWith(`/`)?n:(o===l?a:``)||be(o)?.cwd||t?.cwd||``;if(s===a&&o===l&&N.childElementCount&&!r){Z(),nt().then(X);return}l=o,a=s,k=i,it(r)}return $}export{k as openFiles,M as openPath,A as toggleFiles};
3
+ `),x=null;function S(){x&&(x.remove(),x=null,document.removeEventListener(`pointerdown`,S,!0),window.removeEventListener(`scroll`,S,!0))}function pe(e,t){e.onmouseenter=()=>{S();let r=t();if(!r)return;x=n(`div`,`pointer-events-none fixed z-50 max-w-96 whitespace-pre-wrap rounded-lg bg-neutral-800/95 px-3 py-2 font-sans text-[11.5px] leading-snug text-neutral-100 shadow-lg`),x.textContent=r,(e.closest(`dialog[open]`)??document.body).append(x),document.addEventListener(`pointerdown`,S,!0),window.addEventListener(`scroll`,S,!0);let i=e.getBoundingClientRect();x.style.left=`${Math.max(8,Math.min(i.left,window.innerWidth-x.offsetWidth-8))}px`,x.style.top=i.bottom+6+x.offsetHeight>window.innerHeight?`${i.top-x.offsetHeight-6}px`:`${i.bottom+6}px`},e.onmouseleave=S}function C(e,t,r){let i=n(`button`,`flex w-full cursor-pointer items-center gap-1.5 px-2 py-1 text-left hover:bg-neutral-100`,_(m,`h-3 w-3 text-indigo-600 ${e.value===t?``:`invisible`}`),n(`span`,`inline-flex flex-none items-center gap-1.5 font-mono text-[11.5px] text-neutral-800`,e.label??e.value));return e.subject&&i.append(n(`span`,`min-w-0 truncate text-[11px] text-neutral-400`,e.subject)),e.author&&i.append(n(`span`,`ml-auto flex-none pl-1.5 text-[10.5px] text-neutral-400`,`${e.author} · ${e.at?l(e.at):``}`)),pe(i,()=>b(e)),i.onclick=()=>r(e.value),i}function me(e,t,r,i,a){let{base:o,head:s}=r,c=()=>s&&o===`${s}~1`?s:``,l=c()?`commit`:`compare`,f=t.commits[0],p=e=>[...e?[{value:``,label:`Working tree`,subject:`the files on disk, uncommitted changes included`}]:[],{...f,value:`HEAD`},...t.refs.map(e=>({value:e.name,subject:e.subject})),...t.commits.map(e=>({...e,value:e.hash}))],m=n(`div`,`flex w-[38rem] max-w-full flex-col`);function h(){let e=(e,t)=>{let r=n(`button`,`cursor-pointer rounded-full px-2.5 py-0.5 text-[11.5px] ${l===t?`bg-indigo-50 font-medium text-indigo-700`:`text-neutral-500 hover:bg-neutral-100`}`,e);return r.onclick=()=>{l=t,h()},r},r=(e,t,r,i)=>n(`div`,`flex min-w-0 flex-1 flex-col`,n(`div`,`flex-none px-2 pb-0.5 text-[10.5px] font-semibold uppercase tracking-wide text-neutral-400`,e),n(`div`,`min-h-0 flex-1 overflow-y-auto`,...t.map(e=>C(e,r,i)))),d=l===`compare`?n(`div`,`flex h-72 min-h-0 divide-x divide-neutral-200 pb-1`,r(`base`,p(!1),o,e=>{o=e,h(),i(o,s)}),r(`to`,p(!0),s,e=>{s=e,h(),i(o,s)})):n(`div`,`flex h-72 min-h-0 flex-col overflow-y-auto pb-1`,...t.commits.map(e=>C({value:e.hash,...e},c(),e=>{o=`${e}~1`,s=e,u(),i(o,s)}))),f=n(`div`,`flex-none border-t border-neutral-200`,C({value:a,label:`${a} ↔ Working tree`,subject:`back to the default: the main line's tip vs the files on disk`},o===a&&s===``?a:``,()=>{o=a,s=``,h(),i(o,s)}));f.querySelector(`button > span`).prepend(_(v)),m.replaceChildren(n(`div`,`flex flex-none items-center gap-1 border-b border-neutral-200 px-2 py-1.5`,e(`Compare two points`,`compare`),e(`One commit`,`commit`)),d,...l===`compare`?[f]:[])}h(),d(e,m)}var he=e=>e.slice(0,Math.max(0,e.lastIndexOf(`/`))),ge=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i,_e=/\.(md|markdown)$/i,ve={A:`text-emerald-600`,M:`text-amber-600`,D:`text-red-600`},ye=30,w=`pier.filesPrefs`,T=50,E=()=>{try{let e=JSON.parse(localStorage.getItem(w)??`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}},be=e=>{let t=e?E()[e]:void 0;return typeof t?.cwd==`string`&&typeof t.base==`string`&&typeof t.head==`string`?{cwd:t.cwd,base:t.base,head:t.head}:null},xe=(e,t)=>{let n=E();delete n[e],n[e]=t;let r=Object.keys(n);for(let e of r.slice(0,Math.max(0,r.length-T)))delete n[e];try{localStorage.setItem(w,JSON.stringify(n))}catch(e){console.warn(`Files: could not remember this folder`,e)}},Se=`flex min-w-0 flex-none items-center gap-1.5 rounded-full px-2.5 py-1 font-mono text-[11.5px]`,Ce=(e,t=`indigo`)=>ae(e,`${Se} cursor-pointer truncate text-left ${t===`indigo`?`bg-indigo-50 font-medium text-indigo-700 hover:bg-indigo-100`:`bg-neutral-100 text-neutral-600 hover:bg-neutral-200`}`),D,O=()=>D??=N(e(`#files-dialog`)),k=(e,t,n,r)=>O()(e,t,n,r);function A(t){let n=e(`#files-dialog`);n.open?n.close():k(t)}function j(e,t){if(e&&t===e)return{root:e};let n=e&&t.startsWith(`${e}/`)?e:t.slice(0,t.lastIndexOf(`/`))||`/`,r=t.slice(n===`/`?1:n.length+1);return r?{root:n,select:r}:{root:n}}function we(e,t,n){if(!n||n.startsWith(`#`)||n.startsWith(`//`)||/^[a-z][a-z\d+.-]*:/i.test(n))return null;let r=n.replace(/[?#].*$/s,``);try{r=decodeURIComponent(r)}catch{}let i=(r.startsWith(`/`)?r===e||r.startsWith(`${e}/`)?``:e:t).split(`/`).filter(Boolean);for(let e of r.split(`/`))e===`..`?i.pop():e&&e!==`.`&&i.push(e);return`/${i.join(`/`)}`}var Te=e=>e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu,``).replace(/\s/g,`-`);function M(e,t,n){let{root:r,select:i}=j(e?.cwd??``,t);k(e,r,i,n)}function N(e){let l=``,u=``,d={branch:null,refs:[],commits:[],worktrees:[]},m=`HEAD`,v=``,y=new Map,x=!0,S=!1,C=!1,w=[],T=new Set,E=null,D=null,O=null,k,A=n(`header`,`pagehead flex-nowrap`),M=n(`div`,`${te} flex-col items-stretch gap-1.5 px-3 py-2.5`),N=n(`div`,`min-h-0 flex-1 overflow-y-auto px-1.5 py-1.5`),Ee=n(`aside`,`${f} w-64 flex-none text-[12.5px] leading-5 max-md:h-1/2 max-md:w-full`,M,N),P=n(`div`,`${te} flex-wrap gap-2 px-4 py-2.5 font-mono text-[11.5px] text-neutral-500`),F=n(`div`,`h-full min-w-0 overflow-auto`),I=n(`div`,`pointer-events-none absolute inset-y-1 right-0.5 z-20 hidden w-2`),De=n(`div`,`relative min-h-0 flex-1`,F,I),Oe=n(`section`,`${f} min-h-0 min-w-0 flex-1`,P,De);e.append(A,n(`div`,`flex min-h-0 flex-1 gap-3 px-4 pb-4 pt-1 max-md:flex-col`,Ee,Oe));let L=(e,t)=>`/api/explorer/${e}?${new URLSearchParams({root:l,...t})}`,R=(e,t)=>`/api/fs/${e}?${new URLSearchParams({root:l,...t})}`,z=(e,t=`text-neutral-400`)=>n(`p`,`px-3 py-2 text-[12.5px] ${t}`,e),B=e=>n(`div`,`flex h-full items-center justify-center p-6`,a(e)),ke=()=>x&&d.branch!==null,Ae=e=>{let t=0;for(let n of y.keys())n.startsWith(`${e}/`)&&t++;return t};function je(e,t){let n=new Set(t.map(e=>e.name)),r=e?`${e}/`:``;for(let[e,i]of y){if(i.status!==`D`||!e.startsWith(r))continue;let a=e.slice(r.length).split(`/`)[0];n.has(a)||(n.add(a),t.push({name:a,dir:e.slice(r.length).includes(`/`)}))}let i=t;return ke()&&(i=t.filter(e=>e.dir?Ae(`${r}${e.name}`)>0:y.has(`${r}${e.name}`))),i.sort((e,t)=>Number(t.dir)-Number(e.dir)||e.name.localeCompare(t.name)),O&&he(O)===e&&!n.has(o(O))&&(F.replaceChildren(B(`No such file: ${O}`)),O=null),i.map(e=>e.dir?Ne(`${r}${e.name}`,e.name):Pe(`${r}${e.name}`,e.name))}async function Me(e,t){try{let{entries:n}=await g(R(`ls`,{path:t}),`could not list this folder`);e.replaceChildren(...je(t,n)),e.childElementCount||e.append(z(ke()?`No changes.`:`Empty.`))}catch(n){let r=je(t,[]);r.length?e.replaceChildren(...r):e.replaceChildren(z(String(n),`text-red-600`))}}function Ne(e,t){let r=Ae(e),i=[n(`span`,`truncate`,t)];r&&i.push(n(`span`,`ml-auto flex-none rounded-full bg-amber-100/80 px-1.5 font-mono text-[10px] font-semibold text-amber-700`,String(r)));let{el:a,summary:o}=ne(``,i);o.className+=` rounded-lg px-2 py-1 transition-colors hover:bg-neutral-100`;let s=n(`div`,`pl-3`);a.append(s);let c=!1,l=()=>{c||(c=!0,s.append(z(`…`)),Me(s,e))};a.ontoggle=()=>{T[a.open?`add`:`delete`](e),a.open&&l()};let u=d.branch?x:!e.includes(`/`);return e===O&&(O=null),(u&&!C||T.has(e))&&(a.open=!0,l()),a}function V(e){D?.classList.remove(`bg-indigo-50`,`font-medium`,`text-indigo-700`),D=e,e.classList.add(`bg-indigo-50`,`font-medium`,`text-indigo-700`)}function Pe(e,t){let r=y.get(e)?.status,i=n(`button`,`flex w-full cursor-pointer items-center gap-1.5 rounded-lg py-1 pl-6 pr-2 text-left transition-colors hover:bg-neutral-100`,n(`span`,`truncate`,t));return r&&i.append(n(`span`,`ml-auto flex-none font-mono text-[10.5px] font-semibold ${ve[r]??`text-neutral-500`}`,r)),i.title=e,e===E&&V(i),e===O&&(O=null,E=e,V(i),q(e)),i.onclick=()=>{V(i),E=e,q(e)},i}let H=()=>void Me(N,``),Fe=(e,t)=>[...e?[n(`span`,`flex-none font-mono text-[10.5px] font-semibold text-emerald-600`,`+${e}`)]:[],...t?[n(`span`,`flex-none font-mono text-[10.5px] font-semibold text-red-600`,`−${t}`)]:[]];function U(e,t=!1,...r){if(P.classList.toggle(`hidden`,!e),P.classList.toggle(`flex`,!!e),!e)return P.replaceChildren();let i=y.get(e),a=[n(`span`,`min-w-0 truncate`,e)];i&&(a.push(n(`span`,`flex-none font-semibold ${ve[i.status]??``}`,i.status)),a.push(...Fe(i.add,i.del)));let s=n(`div`,`ml-auto flex flex-none items-center gap-2`);if(s.append(...r),t){let t=document.createElement(`a`);t.className=`btn flex-none text-[12px]`,t.href=R(`file`,{path:e}),t.download=o(e),t.textContent=`Download`,s.append(t)}P.replaceChildren(...a,s)}function Ie(e){let t=0;for(;t<e.length;){if(e[t].tone!==`del`){t++;continue}let n=t;for(;t<e.length&&e[t].tone===`del`;)t++;let r=t;for(;t<e.length&&e[t].tone===`add`;)t++;let i=Math.min(r-n,t-r);for(let t=0;t<i;t++){let i=e[n+t],a=e[r+t],o=Math.min(i.text.length,a.text.length),s=0;for(;s<o&&i.text[s]===a.text[s];)s++;let c=0;for(;c<o-s&&i.text[i.text.length-1-c]===a.text[a.text.length-1-c];)c++;s+c!==0&&(i.mark=[s,i.text.length-c],a.mark=[s,a.text.length-c])}}}let W=Je();function G(){I.classList.add(`hidden`),I.replaceChildren(),W.set([],[])}function Le(e,t){let n=e===E?k:void 0;if(n===void 0)return t;k=void 0;let r=t.querySelector(`[data-line="${String(n)}"]`);return r?.classList.add(`bg-indigo-100`),requestAnimationFrame(()=>r?.scrollIntoView({block:`center`})),t}let Re=0,K=e=>e===Re,ze=e=>_e.test(e)&&!S&&(e!==E||k===void 0);function Be(e,t){if(!_e.test(e))return[];let n=r([[`Rendered`,`rendered`],[`Source`,`source`]],t?`rendered`:`source`,n=>{n===`rendered`!==t&&(S=n===`source`,q(e))});return n.classList.add(`font-sans`),[n]}function Ve(e,t){let n=c(e);n.className=`md mx-auto max-w-3xl px-6 py-5 text-[14px] leading-relaxed`,ie(n),s(n);let r=`${l}/${he(t)}`,i=e=>{let t=j(l,e);return`/api/fs/file?${new URLSearchParams({root:t.root,path:t.select??``})}`};for(let e of n.querySelectorAll(`img`)){let t=we(l,r,e.getAttribute(`src`)??``);t&&e.setAttribute(`src`,i(t))}for(let e of n.querySelectorAll(`a`)){let t=e.getAttribute(`href`)??``;if(t.startsWith(`#`)){e.onclick=e=>{e.preventDefault();let r=t.slice(1);try{r=decodeURIComponent(r)}catch{}r=r.toLowerCase(),[...n.querySelectorAll(`h1, h2, h3, h4, h5, h6`)].find(e=>Te(e.textContent??``)===r)?.scrollIntoView({block:`start`})};continue}let a=we(l,r,t);a&&(e.setAttribute(`href`,i(a)),e.onclick=e=>{if(e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0)return;e.preventDefault();let t=j(l,a);$(Q,t.root,t.select)})}return n}function q(e){let t=++Re;return y.has(e)?Ye(e,t):He(e,t)}async function He(e,t){if(!K(t))return;G();let r=R(`file`,{path:e}),i=n(`div`,`min-w-0`);F.classList.remove(`flex`,`flex-col`);let a=ze(e);if(U(e,!0,...Be(e,a)),F.replaceChildren(i),ge.test(e)){let e=n(`img`,`max-w-full p-4`);e.src=r,e.onerror=()=>i.replaceChildren(z(`Could not load image.`,`text-red-600`)),i.append(e);return}if(e.toLowerCase().endsWith(`.pdf`)){let e=document.createElement(`iframe`);e.className=`h-full w-full`,e.src=r,F.replaceChildren(e),F.classList.add(`flex`,`flex-col`);return}i.append(z(`…`));let o=await fetch(r);if(!K(t))return;if(!o.ok){let{error:e}=await o.json().catch(()=>({}));i.replaceChildren(z(e??`HTTP ${o.status}`,`text-red-600`));return}if(!(o.headers.get(`content-type`)??``).startsWith(`text/plain`)){i.replaceChildren(z(`Binary file — use Download.`));return}let s=await o.text();if(!K(t))return;if(a)return void i.replaceChildren(Ve(s,e));let c=se(s),l=await ee(e);K(t)&&i.replaceChildren(Le(e,ce(c,l)))}function Ue(e){let t=[],n=0,r=0,i=!1,a=e.split(`
4
+ `);a.at(-1)===``&&a.pop();for(let e of a){let a=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(e);if(a){i&&t.push({nums:[``,``],text:`⋯`,tone:``}),[n,r]=[Number(a[1]),Number(a[2])],i=!0;continue}!i||e.startsWith(`\\`)||(e.startsWith(`+`)?t.push({nums:[``,r++],text:e.slice(1),tone:`add`}):e.startsWith(`-`)?t.push({nums:[n++,``],text:e.slice(1),tone:`del`}):t.push({nums:[n++,r++],text:e.slice(1),tone:``}))}return t}function We(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n].tone;if(!r)continue;let i=t.at(-1);i&&i.end===n-1?(i.end=n,(r===`add`&&i.tone===`del`||r===`del`&&i.tone===`add`)&&(i.tone=`mixed`)):t.push({start:n,end:n,tone:r})}return t}let Ge={add:`bg-emerald-400`,del:`bg-red-400`,mixed:`bg-amber-400`};function Ke(e,t,r){I.replaceChildren(...e.map(e=>{let i=n(`button`,`map-mark pointer-events-auto absolute left-1/2 w-1 -translate-x-1/2 cursor-pointer rounded-full ${Ge[e.tone]}`);return i.style.top=`${e.start/t*100}%`,i.style.height=`${Math.max(.4,(e.end-e.start+1)/t*100)}%`,i.title=`line ${qe(r,e.start)}`,i.onclick=()=>r[e.start].scrollIntoView({block:`center`}),i})),I.classList.remove(`hidden`)}let qe=(e,t)=>e[t]?.querySelector(`span`)?.textContent?.trim()||String(t+1);function Je(){let t=[],r=[],a=-1,o=n(`span`,`flex-none text-[10.5px] text-neutral-400`),s=e=>{t.length&&(a=(a+e+t.length)%t.length,r[t[a].start].scrollIntoView({block:`center`}),o.textContent=`${a+1}/${t.length}`)},c=()=>t.length>0&&e.open,l=(e,t,r,i)=>{let a=n(`button`,`icon-btn flex-none`,_(e));return a.onclick=()=>s(t),oe(a,i,r,()=>s(t),c),a};return{el:n(`div`,`flex flex-none items-center gap-1`,o,l(i,-1,`Previous change`,[`p`,`k`]),l(le,1,`Next change`,[`n`,`j`])),set(e,n){t=e,r=n,a=-1,o.textContent=`${e.length} change${e.length===1?``:`s`}`}}}async function Ye(e,t){G(),F.classList.remove(`flex`,`flex-col`);let n=y.get(e)?.status===`D`,r=!n,i=ze(e),a=Be(e,i);U(e,r,...a),F.replaceChildren(z(`…`));try{let{diff:o}=await g(L(`diff`,{base:m,head:v,file:e,context:`99999`}),`could not read this diff`);if(!K(t))return;if(!o||/^Binary files /m.test(o))return He(e,t);let s=Ue(o);if(i){let t=n?`add`:`del`,r=s.filter(e=>e.tone!==t&&e.nums.some(e=>e!==``)).map(e=>e.text).join(`
5
+ `);F.replaceChildren(Ve(r,e));return}Ie(s);let c=await ee(e);if(!K(t))return;let l=Le(e,ce(s,c)),u=[...l.children],d=We(s);W.set(d,u),U(e,r,...a,W.el),F.replaceChildren(l),Ke(d,s.length,u)}catch(n){if(!K(t))return;U(e),F.replaceChildren(z(String(n),`text-red-600`))}}let J=()=>v&&m===`${v}~1`?v:``,Xe=()=>d.commits.find(e=>e.hash===J())?.subject??``,Ze=()=>J()?`${J()} — ${Xe()||`commit`}`:`${m} ↔ ${v||`working tree`}`,Qe=(e,t,r,i)=>{let a=n(`button`,`icon-btn ${r?`bg-indigo-50 text-indigo-700 hover:bg-indigo-100 hover:text-indigo-700`:``}`);return a.append(_(e)),a.title=t,a.setAttribute(`aria-label`,t),a.setAttribute(`aria-pressed`,String(r)),a.onclick=i,a};function Y(){let e=Qe(de,`Show only files that differ`,x,()=>{x=!x,Y(),H()}),t=Qe(ue,C?`Restore folders`:`Collapse all folders`,C,()=>{if(C=!C,C)w=[...T],T.clear();else for(let e of w)T.add(e);Y(),H()});if(M.classList.toggle(`hidden`,!d.branch),M.classList.toggle(`flex`,!!d.branch),!d.branch)return void M.replaceChildren();let r=ae(Ze(),`${p} font-mono`);if(J()){let e=d.commits.find(e=>e.hash===J());pe(r,()=>e?b(e):``)}else r.title=`Choose what to diff`;r.onclick=async()=>{await nt(),me(r,d,{base:m,head:v},(e,t)=>{m=e,v=t,X()},rt())};let[i,a]=[0,0];for(let e of y.values())i+=e.add,a+=e.del;M.replaceChildren(r,n(`div`,`flex items-center gap-1.5 pl-0.5`,n(`span`,`text-[11px] text-neutral-400`,`${y.size} changed file${y.size===1?``:`s`}`),...Fe(i,a),n(`span`,`ml-auto`),e,t))}let $e=()=>{u&&l&&xe(u,{cwd:l,base:m,head:v})},et=e=>{let t=e.replace(/~\d+$/,``);return!t||t===`HEAD`||d.refs.some(e=>e.name===t)||d.commits.some(e=>e.hash===t)};async function tt(){if(y=new Map,!d.branch)return;let{files:e}=await g(L(`diff`,{base:m,head:v}),`could not read what changed`);for(let t of e)y.set(t.path,{status:t.status,add:t.add,del:t.del});if(y.size<=ye)for(let e of y.keys()){let t=e.split(`/`);for(let e=1;e<t.length;e++)T.add(t.slice(0,e).join(`/`))}}async function X(){$e();try{await tt()}catch(e){Y(),N.replaceChildren(z(String(e),`text-red-600`));return}Y(),H(),E&&q(E)}function Z(){let r=Ce(``,`neutral`);r.className+=` max-w-72`,r.append(n(`span`,`truncate max-md:hidden`,l||`Choose a folder…`),n(`span`,`truncate md:hidden`,l?o(l):`Choose a folder…`)),r.title=l?`${l} — switch folder`:`Choose a folder`,r.onclick=()=>re(r,d.worktrees.map(e=>({path:e.path,...e.branch?{hint:e.branch}:{}})),l||void 0,e=>$(Q,e));let i=n(`button`,`icon-btn ml-auto`,_(t));i.type=`button`,i.title=`Close Files`,i.setAttribute(`aria-label`,`Close Files`),i.onclick=()=>e.close();let a=d.branch?[n(`span`,`${Se} bg-neutral-100 text-neutral-600`,_(fe),n(`span`,`truncate`,d.branch))]:[];A.replaceChildren(h(`Files`),r,...a,i)}async function nt(){if(l)try{d=await g(L(`git`,{}),`could not read this repository`),Z()}catch(e){F.replaceChildren(B(String(e)))}}let rt=()=>d.refs.some(e=>e.name===`main`)?`main`:d.refs.some(e=>e.name===`master`)?`master`:`HEAD`;async function it(e){if(Z(),E=null,D=null,T.clear(),O=e||null,e){x=!1;let t=e.split(`/`);for(let e=1;e<=t.length;e++)T.add(t.slice(0,e).join(`/`))}if(G(),F.classList.remove(`flex`,`flex-col`),U(),F.replaceChildren(B(`Select a file.`)),!l){d={branch:null,refs:[],commits:[],worktrees:[]},Y(),N.replaceChildren(),F.replaceChildren(B(`No folder yet — pick one from the chip above.`));return}try{d=await g(L(`git`,{}),`could not read this repository`)}catch(e){d={branch:null,refs:[],commits:[],worktrees:[]},F.replaceChildren(B(String(e)))}let t=be(u),n=t&&t.cwd===l&&et(t.base)&&et(t.head)?t:null;m=n?.base??rt(),v=n?.head??``,Z(),await X()}e.addEventListener(`close`,()=>{G(),F.classList.remove(`flex`,`flex-col`),U(),F.replaceChildren(B(`Select a file.`)),D?.classList.remove(`bg-indigo-50`,`font-medium`,`text-indigo-700`),E=null,D=null});let Q;function $(t,n,r,i){Q=t;let a=t?.id??``;e.open||e.showModal();let o=n?.startsWith(`/`)?n:(a===u?l:``)||be(a)?.cwd||t?.cwd||``;if(o===l&&a===u&&N.childElementCount&&!r){Z(),nt().then(X);return}u=a,l=o,k=i,it(r)}return $}export{k as openFiles,M as openPath,A as toggleFiles};
@@ -0,0 +1,72 @@
1
+ var e={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},t=([e,n,r])=>{let i=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(n).forEach(e=>{i.setAttribute(e,String(n[e]))}),r?.length&&r.forEach(e=>{let n=t(e);i.appendChild(n)}),i},n=(n,r={})=>t([`svg`,{...e,...r},n]),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]],i=[[`path`,{d:`M20 6 9 17l-5-5`}]],a=[[`path`,{d:`m6 9 6 6 6-6`}]],o=[[`path`,{d:`m15 18-6-6 6-6`}]],s=[[`path`,{d:`m9 18 6-6-6-6`}]],c=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`}],[`path`,{d:`M12 17h.01`}]],l=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 6v6l4 2`}]],u=[[`circle`,{cx:`12`,cy:`12`,r:`1`}],[`circle`,{cx:`19`,cy:`12`,r:`1`}],[`circle`,{cx:`5`,cy:`12`,r:`1`}]],d=[[`path`,{d:`M5 12h14`}],[`path`,{d:`M12 5v14`}]],ee=[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}]],te=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]],ne=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]],re=[[`path`,{d:`M9 14 4 9l5-5`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`}]],f=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]],p=(e,t=`h-3.5 w-3.5`)=>n(e,{class:`flex-none ${t}`,"aria-hidden":`true`,focusable:`false`});function ie(){let e={ArrowUp:r,ChevronLeft:o,ChevronRight:s,Clock:l,Ellipsis:u,Plus:d,RotateCw:ee,Search:te,Square:ne,Undo2:re,X:f};for(let t of document.querySelectorAll(`[data-icon]`)){let n=e[t.dataset.icon];if(!n)throw Error(`Unknown shell icon: ${t.dataset.icon}`);t.replaceChildren(p(n,`h-full w-full`))}let t=p(a);t.setAttribute(`stroke`,`#737373`),document.documentElement.style.setProperty(`--select-chevron`,`url("data:image/svg+xml,${encodeURIComponent(t.outerHTML)}")`)}var ae=33554432,oe=e=>`[${e.split(`/`).pop()??`file`}](file://${encodeURI(e).replace(/\(/g,`%28`).replace(/\)/g,`%29`)})`,se=/^ {0,3}(`{3,}|~{3,})/;function ce(e){let t=[],n,r=0;for(let i of e.split(`
2
+ `)){let e=se.exec(i)?.[1];if(n!==void 0)t.push([r,r+i.length]),e&&e[0]===n[0]&&e.length>=n.length&&(n=void 0);else if(e)n=e,t.push([r,r+i.length]);else{let e=[...i.matchAll(/`+/g)];for(let n=0;n<e.length;n++){let i=e[n],a=n+1;for(;a<e.length&&e[a][0].length!==i[0].length;)a++;if(a===e.length)break;t.push([r+i.index,r+e[a].index+e[a][0].length]),n=a}}r+=i.length+1}return t}function le(e,t,n){let r=ce(e),i=``,a=0,o=new RegExp(t.source,t.flags.includes(`g`)?t.flags:`${t.flags}g`);for(let t=o.exec(e);t;t=o.exec(e)){let s=t.index;if(r.some(([e,t])=>s>=e&&s<t)){o.lastIndex=s+1;continue}i+=e.slice(a,s)+n(t),a=s+t[0].length,t[0]||o.lastIndex++}return i+e.slice(a)}var m=/^\[[^\]\n]*\]\(\s*<?file:\/\/(\/[^)>\s]*)>?\s*\)$/;function h(e){let t=e.split(`
3
+ `),n=t.length;for(;n>0&&m.test(t[n-1].trim());)n--;let r=t.slice(n).map(e=>{let t=m.exec(e.trim())[1];try{return decodeURIComponent(t)}catch{return t}});return{text:t.slice(0,n).join(`
4
+ `).trimEnd(),paths:r}}var ue={status:`what is open — in flight, or waiting on you`,new:`start a new session now`,stop:`stop the reply in progress`,skills:`the skills this session can run, by name`},de=[`queued`,`running`,`succeeded`,`failed`,`cancelled`,`interrupted`,`skipped`],fe=`not in the ledger`,pe=8e3,me=e=>`${e.provider}/${e.id}`,he=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],ge=[`hardest`,`balanced`,`cheap`],_e=/[\u201c\u201d"\u2018\u2019'()\uff08\uff09\u300c\u300d\u300e\u300f\u3010\u3011\u300a\u300b\u3008\u3009[\]]/;function ve(e){return le(e,/\*\*(\S|\S[\s\S]*?\S)\*\*/g,([e,t=``])=>{let n=``,r=``,i=t;for(;i.length>1&&_e.test(i[0]);)n+=i[0],i=i.slice(1);for(;i.length>1&&_e.test(i.at(-1));)r=i.at(-1)+r,i=i.slice(0,-1);return n||r?`${n}**${i}**${r}`:e})}var ye=e=>!e.text.trim()&&e.suggestions.length===0,be=e=>e===`xhigh`?`Extra high`:e[0].toUpperCase()+e.slice(1);function xe(e,t){let n=Math.round((t-e)/6e4);return n<1?`now`:n<60?`${String(n)}m`:n<1440?`${String(Math.round(n/60))}h`:`${String(Math.round(n/1440))}d`}var Se=(e,t)=>{let n=xe(e,t);return n===`now`?`just now`:`${n} ago`},g=(e,t)=>e.finishedAt===null?`${e.state} ${xe(e.queuedAt,t)}`:`${e.state} ${Se(e.finishedAt,t)}`,Ce=e=>de.filter(t=>e[t]>0).map(t=>`${String(e[t])} ${t}`).join(`, `)||`none`,we=(e,t)=>e.state===`not in the ledger`?`run ${e.runId} — ${fe}`:`run ${e.runId.length>8?`${e.runId.slice(0,8)}…`:e.runId} ${g(e,t)}${e.workers?` · workers: ${Ce(e.workers)}`:``}`,Te=e=>{if(e<1e3)return String(e);let t=e/1e3;return t>=9.95?`${Math.round(t)}K`:`${t.toFixed(1)}K`},Ee=/(?:^|\n)[ \t]*-{3,}[ \t]*\r?\n((?:[ \t]*\[[^\]\r\n]+\][ \t]*(?:[||][ \t]*)?)+)\s*$/,De=/\[([^\]\r\n]+)\]/g,Oe=5,ke=String.raw`[\u200B-\u200D\u2060\uFEFF]*`,_=e=>e.split(``).join(ke),Ae=RegExp(`${_(`<silent>`)}([\\s\\S]*?)${_(`</silent>`)}`,`gi`),v=RegExp(`<(\\/?)(${[`silent`,`open`,`done`].map(_).join(`|`)})${ke}>`,`gi`),je=new RegExp(ke.slice(0,-1),`g`),y=RegExp(`${_(`<open>`)}([\\s\\S]*?)${_(`</open>`)}[ \\t]*\\n?|${_(`<done>`)}([\\s\\S]*?)${_(`</done>`)}[ \\t]*\\n?`,`gi`);function Me(e){let t=[...e.matchAll(Ae)].map(e=>(e[1]??``).trim()).filter(Boolean);return t.length?t.join(` · `):void 0}function b(e,t){let n=Ne(e),r=Me(e),i=Ee.exec(n);if(!i?.[1])return{text:n,suggestions:[],meta:t,silence:r};let a=[...i[1].matchAll(De)].map(e=>(e[1]??``).trim()).filter(Boolean).slice(0,Oe);return a.length?{text:n.slice(0,i.index).trimEnd(),suggestions:a,meta:t,silence:r}:{text:n,suggestions:[],meta:t,silence:r}}var Ne=e=>ve(Pe(e)),Pe=e=>le(e.replace(Ae,``),y,()=>``).trim(),x=/^(?:\s|[-*+>]|\d+[.)])/;function Fe(e,t=0){let n=e.lastIndexOf(`
5
+ `)+1,r=``,i=``,a=t,o=-1,s=``;for(let c=t;c<n;){let t=e.indexOf(`
6
+ `,c),n=e.slice(c,t);c=t+1;let l=/^\s*(`{3,}|~{3,})(.*)$/.exec(n);if(!r&&!i&&!n.trim()){o<0&&s&&(o=c);continue}!r&&!i&&o>=0&&!(x.test(s)&&x.test(n))&&(a=o);let u=l?.[1]??``;if(!r&&u&&!i?r=u:r&&u[0]===r[0]&&u.length>=r.length&&!l?.[2]?.trim()&&(r=``),!r&&(!u||i))for(let e of n.matchAll(v)){let t=e[2].replace(je,``).toLowerCase();!e[1]&&!i?i=t:e[1]&&t===i&&(i=``)}o=-1,s=n}return a}function Ie(e){let t,n=!1;return()=>(n=!0,t??=(async()=>{for(;n;)n=!1,await e()})().finally(()=>{t=void 0}))}var Le=(e,t)=>({method:t,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),Re=(e,t,n=`POST`)=>fetch(e,Le(t,n)),S=(e,t,n,r=`POST`)=>w(e,n,Le(t,r));async function C(e,t){return(await e.json().catch(()=>({}))).error??`${t} (${e.status})`}async function w(e,t,n){let r;try{r=await fetch(e,n)}catch(e){return{ok:!1,error:`${t}: ${String(e)}`}}if(!r.ok)return{ok:!1,error:await C(r,t)};try{return{ok:!0,value:await r.json()}}catch(e){return{ok:!1,error:`${t}: ${String(e)}`}}}async function ze(e,t,n){let r=await w(e,t,n);if(!r.ok)throw Error(r.error);return r.value}async function Be(e,t,n){try{let r=await fetch(e,{method:t});return r.ok?void 0:await C(r,n)}catch(e){return`${n}: ${String(e)}`}}function Ve(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function He(e){if(Array.isArray(e))return e}function Ue(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function We(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
7
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ge(e,t){return He(e)||Ue(e,t)||Ke(e,t)||We()}function Ke(e,t){if(e){if(typeof e==`string`)return Ve(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ve(e,t):void 0}}var qe=Object.entries,Je=Object.setPrototypeOf,Ye=Object.isFrozen,Xe=Object.getPrototypeOf,Ze=Object.getOwnPropertyDescriptor,T=Object.freeze,E=Object.seal,Qe=Object.create,$e=typeof Reflect<`u`&&Reflect,et=$e.apply,tt=$e.construct;T||=function(e){return e},E||=function(e){return e},et||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},tt||=function(e){return new e(...[...arguments].slice(1))};var nt=A(Array.prototype.forEach),rt=A(Array.prototype.lastIndexOf),it=A(Array.prototype.pop),at=A(Array.prototype.push),ot=A(Array.prototype.splice),st=Array.isArray,ct=A(String.prototype.toLowerCase),lt=A(String.prototype.toString),ut=A(String.prototype.match),dt=A(String.prototype.replace),ft=A(String.prototype.indexOf),pt=A(String.prototype.trim),mt=A(Number.prototype.toString),ht=A(Boolean.prototype.toString),gt=typeof BigInt>`u`?null:A(BigInt.prototype.toString),_t=typeof Symbol>`u`?null:A(Symbol.prototype.toString),D=A(Object.prototype.hasOwnProperty),O=A(Object.prototype.toString),k=A(RegExp.prototype.test),vt=j(TypeError);function A(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return et(e,t,n)}}function j(e){return function(){return tt(e,[...arguments])}}function M(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ct;if(Je&&Je(e,null),!st(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Ye(t)||(t[r]=e),i=e)}e[i]=!0}return e}function yt(e){for(let t=0;t<e.length;t++)D(e,t)||(e[t]=null);return e}function N(e){let t=Qe(null);for(let r of qe(e)){var n=Ge(r,2);let i=n[0],a=n[1];D(e,i)&&(t[i]=st(a)?yt(a):a&&typeof a==`object`&&a.constructor===Object?N(a):a)}return t}function bt(e){switch(typeof e){case`string`:return e;case`number`:return mt(e);case`boolean`:return ht(e);case`bigint`:return gt?gt(e):`0`;case`symbol`:return _t?_t(e):`Symbol()`;case`undefined`:return O(e);case`function`:case`object`:{if(e===null)return O(e);let t=e,n=P(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:O(e)}return O(e)}default:return O(e)}}function P(e,t){for(;e!==null;){let n=Ze(e,t);if(n){if(n.get)return A(n.get);if(typeof n.value==`function`)return A(n.value)}e=Xe(e)}function n(){return null}return n}function xt(e){try{return k(e,``),!0}catch{return!1}}var St=T(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Ct=T(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),wt=T([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Tt=T([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Et=T(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Dt=T([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ot=T([`#text`]),kt=T(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),At=T(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),jt=T(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Mt=T([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Nt=E(/{{[\w\W]*|^[\w\W]*}}/g),Pt=E(/<%[\w\W]*|^[\w\W]*%>/g),Ft=E(/\${[\w\W]*/g),It=E(/^data-[\-\w.\u00B7-\uFFFF]+$/),Lt=E(/^aria-[\-\w]+$/),Rt=E(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zt=E(/^(?:\w+script|data):/i),Bt=E(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Vt=E(/^html$/i),Ht=E(/^[a-z][.\w]*(-[.\w]+)+$/i),Ut=E(/<[/\w!]/g),Wt=E(/<[/\w]/g),Gt=E(/<\/no(script|embed|frames)/i),Kt=E(/\/>/i),F={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},qt=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Jt=T(M({},qt)),Yt=function(){let e={};return nt(qt,t=>{e[t]=E(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),T(e)}(),Xt=function(){return typeof window>`u`?null:window},Zt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Qt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},$t=function(e,t,n,r){return D(e,t)&&st(e[t])?M(r.base?N(r.base):{},e[t],r.transform):n},en=function(e,t,n){let r=D(e,t)?e[t]:void 0;return r&&typeof r==`object`?N(r):n()};function tn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Xt(),t=e=>tn(e);if(t.version=`3.4.14`,t.removed=[],!e||!e.document||e.document.nodeType!==F.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,ee=P(d,`cloneNode`),te=P(d,`remove`),ne=P(d,`nextSibling`),re=P(d,`childNodes`),f=P(d,`parentNode`),p=P(d,`shadowRoot`),ie=P(d,`attributes`),ae=o&&o.prototype?P(o.prototype,`nodeType`):null,oe=o&&o.prototype?P(o.prototype,`nodeName`):null,se=o&&o.prototype?P(o.prototype,`ownerDocument`):null,ce=function(e){return ae?ae(e):e.nodeType},le=function(e){return oe?oe(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let m,h=``,ue,de=!1,fe=0,pe=function(){if(fe>0)throw vt(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},me=function(e){pe(),fe++;try{return m.createHTML(e)}finally{fe--}},he=function(e){pe(),fe++;try{return m.createScriptURL(e)}finally{fe--}},ge=function(){return de||=(ue=Zt(u,i),!0),ue},_e=n,ve=_e.implementation,ye=_e.createNodeIterator,be=_e.createDocumentFragment,xe=_e.getElementsByTagName,Se=r.importNode,g=Qt();t.isSupported=typeof qe==`function`&&typeof f==`function`&&ve&&ve.createHTMLDocument!==void 0;let Ce=Nt,we=Pt,Te=Ft,Ee=It,De=Lt,Oe=zt,ke=Bt,_=Ht,Ae=Rt,v=null,je=M({},[...St,...Ct,...wt,...Et,...Ot]),y=null,Me=M({},[...kt,...At,...jt,...Mt]),b=Object.seal(Qe(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ne=null,Pe=null,x=Object.seal(Qe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Fe=!0,Ie=!0,Le=!1,Re=!0,S=!1,C=!0,w=!1,ze=!1,Be=null,Ve=null,He=!1,Ue=!1,We=!1,Ge=!1,Ke=!0,Je=!1,Ye=`user-content-`,Xe=!0,Ze=!1,$e={},et=null,tt=M({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),mt=null,ht=M({},[`audio`,`video`,`img`,`source`,`image`,`track`]),gt=null,_t=M({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),O=`http://www.w3.org/1998/Math/MathML`,A=`http://www.w3.org/2000/svg`,j=`http://www.w3.org/1999/xhtml`,yt=j,qt=!1,nn=null,rn=M({},[O,A,j],lt),I=T([`mi`,`mo`,`mn`,`ms`,`mtext`]),an=M({},I),L=T([`annotation-xml`]),R=M({},L),z=M({},[`title`,`style`,`font`,`a`,`script`]),on=null,B=[`application/xhtml+xml`,`text/html`],V=null,sn=null,cn=n.createElement(`form`),ln=function(e){return e instanceof RegExp||e instanceof Function},un=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(sn&&sn===e)return;(!e||typeof e!=`object`)&&(e={}),e=N(e),on=B.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,V=on===`application/xhtml+xml`?lt:ct,v=$t(e,`ALLOWED_TAGS`,je,{transform:V}),y=$t(e,`ALLOWED_ATTR`,Me,{transform:V}),nn=$t(e,`ALLOWED_NAMESPACES`,rn,{transform:lt}),gt=$t(e,`ADD_URI_SAFE_ATTR`,_t,{transform:V,base:_t}),mt=$t(e,`ADD_DATA_URI_TAGS`,ht,{transform:V,base:ht}),et=$t(e,`FORBID_CONTENTS`,tt,{transform:V}),Ne=$t(e,`FORBID_TAGS`,N({}),{transform:V}),Pe=$t(e,`FORBID_ATTR`,N({}),{transform:V}),$e=D(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?N(e.USE_PROFILES):e.USE_PROFILES:!1,Fe=e.ALLOW_ARIA_ATTR!==!1,Ie=e.ALLOW_DATA_ATTR!==!1,Le=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Re=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,S=e.SAFE_FOR_TEMPLATES||!1,C=e.SAFE_FOR_XML!==!1,w=e.WHOLE_DOCUMENT||!1,Ue=e.RETURN_DOM||!1,We=e.RETURN_DOM_FRAGMENT||!1,Ge=e.RETURN_TRUSTED_TYPE||!1,He=e.FORCE_BODY||!1,Ke=e.SANITIZE_DOM!==!1,Je=e.SANITIZE_NAMED_PROPS||!1,Xe=e.KEEP_CONTENT!==!1,Ze=e.IN_PLACE||!1,Ae=xt(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Rt,yt=typeof e.NAMESPACE==`string`?e.NAMESPACE:j,an=en(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>M({},I)),R=en(e,`HTML_INTEGRATION_POINTS`,()=>M({},L));let t=en(e,`CUSTOM_ELEMENT_HANDLING`,()=>Qe(null));if(b=Qe(null),D(t,`tagNameCheck`)&&ln(t.tagNameCheck)&&(b.tagNameCheck=t.tagNameCheck),D(t,`attributeNameCheck`)&&ln(t.attributeNameCheck)&&(b.attributeNameCheck=t.attributeNameCheck),D(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(b.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),E(b),S&&(Ie=!1),We&&(Ue=!0),$e&&(v=M({},Ot),y=Qe(null),$e.html===!0&&(M(v,St),M(y,kt)),$e.svg===!0&&(M(v,Ct),M(y,At),M(y,Mt)),$e.svgFilters===!0&&(M(v,wt),M(y,At),M(y,Mt)),$e.mathMl===!0&&(M(v,Et),M(y,jt),M(y,Mt))),x.tagCheck=null,x.attributeCheck=null,D(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?x.tagCheck=e.ADD_TAGS:st(e.ADD_TAGS)&&(v===je&&(v=N(v)),M(v,e.ADD_TAGS,V))),D(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?x.attributeCheck=e.ADD_ATTR:st(e.ADD_ATTR)&&(y===Me&&(y=N(y)),M(y,e.ADD_ATTR,V))),D(e,`ADD_FORBID_CONTENTS`)&&st(e.ADD_FORBID_CONTENTS)&&(et===tt&&(et=N(et)),M(et,e.ADD_FORBID_CONTENTS,V)),Xe&&(v[`#text`]=!0),w&&M(v,[`html`,`head`,`body`]),v.table&&(M(v,[`tbody`]),delete Ne.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw vt(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw vt(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=m;m=e.TRUSTED_TYPES_POLICY;try{h=me(``)}catch(e){throw m=t,e}}else e.TRUSTED_TYPES_POLICY===null?(m=void 0,h=``):(m===void 0&&(m=ge()),m&&typeof h==`string`&&(h=me(``)));T&&T(e),sn=e},dn=M({},[...Ct,...wt,...Tt]),fn=M({},[...Et,...Dt]),pn=function(e,t,n){return t.namespaceURI===j?e===`svg`:t.namespaceURI===O?e===`svg`&&(n===`annotation-xml`||an[n]):!!dn[e]},mn=function(e,t,n){return t.namespaceURI===j?e===`math`:t.namespaceURI===A?e===`math`&&R[n]:!!fn[e]},hn=function(e,t,n){return t.namespaceURI===A&&!R[n]||t.namespaceURI===O&&!an[n]?!1:!fn[e]&&(z[e]||!dn[e])},gn=function(e){let t=f(e);(!t||!t.tagName)&&(t={namespaceURI:yt,tagName:`template`});let n=ct(e.tagName),r=ct(t.tagName);return nn[e.namespaceURI]?e.namespaceURI===A?pn(n,t,r):e.namespaceURI===O?mn(n,t,r):e.namespaceURI===j?hn(n,t,r):!!(on===`application/xhtml+xml`&&nn[e.namespaceURI]):!1},H=function(e){at(t.removed,{element:e});try{f(e).removeChild(e)}catch{if(te(e),!f(e))throw vt(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},_n=function(e,t,n){try{e.removeAttributeNode(t)}catch{try{e.removeAttribute(n)}catch{}}},vn=function(e){bn(e);let t=re(e);if(t){let e=[];nt(t,t=>{at(e,t)}),nt(e,e=>{try{te(e)}catch{}})}let n=ie(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&_n(e,r,i)}},U=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}at(t.removed,{attribute:r||null,from:n});try{r?n.removeAttributeNode(r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Ue||We)try{H(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},yn=function(e){let t=ie(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||y[V(i)]||_n(e,r,i)}},bn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();ce(e)===F.element&&yn(e);let n=re(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},xn=function(e,t){return C?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Sn=function(e){if(!C)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=ce(e);if(n===F.processingInstruction||n===F.comment&&k(Wt,e.data)){try{te(e)}catch{}continue}if(n===F.element){let t=e,n=V(le(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&xn(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=re(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Cn=function(e){let t=null,r=null;if(He)e=`<remove></remove>`+e;else{let t=ut(e,/^[\r\n\t ]+/);r=t&&t[0]}on===`application/xhtml+xml`&&yt===j&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=m?me(e):e;if(yt===j)try{t=new l().parseFromString(i,on)}catch{}if(!t||!t.documentElement){t=ve.createDocument(yt,`template`,null);try{t.documentElement.innerHTML=qt?h:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),yt===j?xe.call(t,w?`html`:`body`)[0]:w?t.documentElement:a},wn=function(e){let t=se?se(e):e.ownerDocument;return ye.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Tn=function(e){return e=dt(e,Ce,` `),e=dt(e,we,` `),e=dt(e,Te,` `),e},En=function(e){e.normalize();let t=se?se(e):e.ownerDocument,n=ye.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Tn(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&nt(i,e=>{On(e.content)&&En(e.content)})},Dn=function(e){let t=oe?oe(e):null;return typeof t!=`string`||V(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==ie(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==ae(e)||e.childNodes!==re(e)},On=function(e){if(!ae||typeof e!=`object`||!e)return!1;try{return ae(e)===F.documentFragment}catch{return!1}},kn=function(e){if(!ae||typeof e!=`object`||!e)return!1;try{return typeof ae(e)==`number`}catch{return!1}};function W(e,n,r){e.length!==0&&nt(e,e=>{e.call(t,n,r,sn)})}let An=function(e,t){return!!(C&&e.hasChildNodes()&&!kn(e.firstElementChild)&&k(Ut,e.textContent)&&k(Ut,e.innerHTML)||C&&e.namespaceURI===j&&Jt[t]&&(kn(e.firstElementChild)||typeof e.textContent==`string`&&k(Yt[t],e.textContent))||e.nodeType===F.processingInstruction||C&&e.nodeType===F.comment&&k(Wt,e.data))},G=function(e,t){return e instanceof RegExp?k(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},jn=function(e,t,n){if(!Ne[t]&&Ln(t)&&G(b.tagNameCheck,t))return!1;if(Xe&&!et[t]){let t=f(e),r=re(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?ee(r[a],!0):r[a];t.insertBefore(i,ne(e))}}}return H(e),!0},Mn=function(e,t,n,r){return e.length===0?t:t===n||t===r?N(t):t},Nn=function(e,t){return e===t||f(e)!==null?!1:(Ze&&bn(e),!0)},Pn=function(e,n){if(W(g.beforeSanitizeElements,e,null),Nn(e,n))return!0;if(Dn(e))return H(e),!0;let r=V(le(e));if(v=Mn(g.uponSanitizeElement,v,je,Be),W(g.uponSanitizeElement,e,{tagName:r,allowedTags:v}),Nn(e,n))return!0;if(An(e,r))return H(e),!0;if(Ne[r]||!(x.tagCheck instanceof Function&&x.tagCheck(r))&&!v[r]){let t=jn(e,r,n);return t===!1&&W(g.afterSanitizeElements,e,null),t}if(ce(e)===F.element&&!gn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&k(Gt,e.innerHTML))return H(e),!0;if(S&&e.nodeType===F.text){let n=Tn(e.textContent);e.textContent!==n&&(at(t.removed,{element:e.cloneNode()}),e.textContent=n)}return W(g.afterSanitizeElements,e,null),!1},Fn=function(e,t,r){if(Pe[t]||xn(t,e)||Ke&&(t===`id`||t===`name`)&&(r in n||r in cn))return!1;let i=y[t]||x.attributeCheck instanceof Function&&x.attributeCheck(t,e);return Ie&&k(Ee,t)||Fe&&k(De,t)?!0:i?gt[t]||k(Ae,dt(r,ke,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ft(r,`data:`)===0&&mt[e]||Le&&!k(Oe,dt(r,ke,``))?!0:!r:Ln(e)&&G(b.tagNameCheck,e)&&G(b.attributeNameCheck,t,e)||t===`is`&&b.allowCustomizedBuiltInElements&&G(b.tagNameCheck,r)},In=M({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ln=function(e){return!In[ct(e)]&&k(_,e)},Rn=function(e,t,n,r){if(m&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return me(r);case`TrustedScriptURL`:return he(r)}return r},zn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),Dn(e)?H(e):it(t.removed)}catch{U(n,e)}},Bn=function(e){W(g.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||Dn(e))return;y=Mn(g.uponSanitizeAttribute,y,Me,Ve);let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:y,forceKeepAttr:void 0},r=t.length,i=V(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=V(o),u=c,d=o===`value`?u:pt(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,W(g.uponSanitizeAttribute,e,n),d=n.attrValue,Je&&(l===`id`||l===`name`)&&ft(d,Ye)!==0&&(U(o,e,a),d=Ye+d),C&&k(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){U(o,e,a);continue}if(l===`attributename`&&ut(d,`href`)){U(o,e,a);continue}if(!n.forceKeepAttr){if(!n.keepAttr){U(o,e,a);continue}if(!Re&&k(Kt,d)){U(o,e,a);continue}if(S&&(d=Tn(d)),!Fn(i,l,d)){U(o,e,a);continue}d=Rn(i,l,s,d),d!==u&&zn(e,o,s,d)}}W(g.afterSanitizeAttributes,e,null)},Vn=function(e){let t=null,n=wn(e);for(W(g.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(W(g.uponSanitizeShadowNode,t,null),Pn(t,e),Bn(t),On(t.content)&&Vn(t.content),ce(t)===F.element){let e=p(t);On(e)&&(Hn(e),Vn(e))}W(g.afterSanitizeShadowDOM,e,null)},Hn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Vn(e.shadow);continue}let n=e.node,r=ce(n)===F.element,i=re(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=oe?oe(n):null;if(typeof e==`string`&&V(e)===`template`){let e=n.content;On(e)&&t.push({node:e,shadow:null})}}if(r){let e=p(n);On(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(qt=!e,qt&&(e=`<!-->`),typeof e!=`string`&&!kn(e)&&(e=bt(e),typeof e!=`string`))throw vt(`dirty is not a string, aborting`);if(!t.isSupported)return e;ze?(v=Be,y=Ve):un(n),(g.uponSanitizeElement.length>0||g.uponSanitizeAttribute.length>0)&&(v=N(v)),g.uponSanitizeAttribute.length>0&&(y=N(y)),t.removed=[];let c=Ze&&typeof e!=`string`&&kn(e);if(c){Sn(e);let t=le(e);if(typeof t==`string`){let n=V(t);if(!v[n]||Ne[n])throw vn(e),vt(`root node is forbidden and cannot be sanitized in-place`)}if(Dn(e))throw vn(e),vt(`root node is clobbered and cannot be sanitized in-place`);try{Hn(e)}catch(t){throw vn(e),t}}else if(kn(e))i=Cn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===F.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Hn(a);else{if(!Ue&&!S&&!w&&e.indexOf(`<`)===-1)return m&&Ge?me(e):e;if(i=Cn(e),!i)return Ue?null:Ge?h:``}i&&He&&H(i.firstChild);let l=c?e:i;try{let e=wn(l);for(;o=e.nextNode();)Pn(o,l),Bn(o),On(o.content)&&Vn(o.content)}catch(n){throw c&&(vn(e),nt(t.removed,e=>{e.element&&bn(e.element)})),n}if(c)return nt(t.removed,e=>{e.element&&bn(e.element)}),S&&En(e),e;if(Ue){if(S&&En(i),We)for(s=be.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(y.shadowroot||y.shadowrootmode)&&(s=Se.call(r,s,!0)),s}let u=w?i.outerHTML:i.innerHTML;return w&&v[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&k(Vt,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
8
+ `+u),S&&(u=Tn(u)),m&&Ge?me(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};un(e),ze=!0,Be=v,Ve=y},t.clearConfig=function(){sn=null,ze=!1,Be=null,Ve=null,m=ue,h=``},t.isValidAttribute=function(e,t,n){sn||un({});let r=V(e),i=V(t);return Fn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&D(g,e)&&at(g[e],t)},t.removeHook=function(e,t){if(D(g,e)){if(t!==void 0){let n=rt(g[e],t);return n===-1?void 0:ot(g[e],n,1)[0]}return it(g[e])}},t.removeHooks=function(e){D(g,e)&&(g[e]=[])},t.removeAllHooks=function(){g=Qt()},t}var nn=tn();function rn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var I=rn();function an(e){I=e}var L={exec:()=>null};function R(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function z(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(B.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var on=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),B={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:R(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:R(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:R(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:R(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:R(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:R(e=>RegExp(`^ {0,${e}}>`))},V=/^(?:[ \t]*(?:\n|$))+/,sn=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,cn=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ln=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,un=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,dn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,fn=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,pn=z(fn).replace(/bull/g,dn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),mn=z(fn).replace(/bull/g,dn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),hn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,gn=/^[^\n]+/,H=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,_n=z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,H).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),vn=z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,dn).getRegex(),U=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,yn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bn=z(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,yn).replace(`tag`,U).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xn=e=>z(hn).replace(`hr`,ln).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,U).getRegex(),Sn=xn(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Cn=xn(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),wn={blockquote:z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Cn).getRegex(),code:sn,def:_n,fences:cn,heading:un,hr:ln,html:bn,lheading:pn,list:vn,newline:V,paragraph:Sn,table:L,text:gn},Tn=z(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,ln).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,U).getRegex(),En={...wn,lheading:mn,table:Tn,paragraph:z(hn).replace(`hr`,ln).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Tn).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,U).getRegex()},Dn={...wn,html:z(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,yn).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:L,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:z(hn).replace(`hr`,ln).replace(`heading`,` *#{1,6} *[^
9
+ ]`).replace(`lheading`,pn).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},On=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,W=/^( {2,}|\\)\n(?!\s*$)/,An=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,G=/[\p{P}\p{S}]/u,jn=/[\s\p{P}\p{S}]/u,Mn=/[^\s\p{P}\p{S}]/u,Nn=z(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,jn).getRegex(),Pn=/[\p{Pi}\p{Ps}"']/u,Fn=/(?!~)[\p{P}\p{S}]/u,In=/(?!~)[\s\p{P}\p{S}]/u,Ln=/(?:[^\s\p{P}\p{S}]|~)/u,Rn=z(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,on?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),zn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Bn=z(zn,`u`).replace(/punct/g,G).getRegex(),Vn=z(zn,`u`).replace(/punct/g,Fn).getRegex(),Hn=z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Pn).replace(/punct/g,G).getRegex(),Un=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Wn=z(Un,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,G).getRegex(),Gn=z(Un,`gu`).replace(/notPunctSpace/g,Ln).replace(/punctSpace/g,In).replace(/punct/g,Fn).getRegex(),Kn=z(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,G).getRegex(),qn=z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,G).getRegex(),Jn=z(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,G).getRegex(),Yn=z(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,G).getRegex(),Xn=z(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,jn).replace(/punct/g,G).getRegex(),Zn=z(/\\(punct)/,`gu`).replace(/punct/g,G).getRegex(),Qn=z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),$n=z(yn).replace(`(?:-->|$)`,`-->`).getRegex(),er=z(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,$n).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),tr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,nr=z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,tr).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),rr=z(/^!?\[(label)\]\[(ref)\]/).replace(`label`,tr).replace(`ref`,H).getRegex(),ir=z(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,H).getRegex(),ar=z(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,rr).replace(`nolink`,ir).getRegex(),or=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,sr={_backpedal:L,anyPunctuation:Zn,autolink:Qn,blockSkip:Rn,br:W,code:kn,del:L,delLDelim:L,delRDelim:L,emStrongLDelim:Bn,emStrongRDelimAst:Wn,emStrongRDelimUnd:qn,escape:On,link:nr,nolink:ir,punctuation:Nn,reflink:rr,reflinkSearch:ar,tag:er,text:An,url:L},cr={...sr,emStrongLDelim:Hn,emStrongRDelimAst:Kn,emStrongRDelimUnd:Jn,link:z(/^!?\[(label)\]\((.*?)\)/).replace(`label`,tr).getRegex(),reflink:z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,tr).getRegex()},lr={...sr,emStrongRDelimAst:Gn,emStrongLDelim:Vn,delLDelim:Yn,delRDelim:Xn,url:z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,or).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:z(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,or).getRegex()},ur={...lr,br:z(W).replace(`{2,}`,`*`).getRegex(),text:z(lr.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},dr={normal:wn,gfm:En,pedantic:Dn},fr={normal:sr,gfm:lr,breaks:ur,pedantic:cr},pr={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},mr=e=>pr[e];function K(e,t){if(t){if(B.escapeTest.test(e))return e.replace(B.escapeReplace,mr)}else if(B.escapeTestNoEncode.test(e))return e.replace(B.escapeReplaceNoEncode,mr);return e}function hr(e){try{e=encodeURI(e).replace(B.percentDecode,`%`)}catch{return null}return e}function gr(e,t){let n=e.replace(B.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(B.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(B.slashPipe,`|`);return n}function _r(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function vr(e){let t=e.split(`
10
+ `),n=t.length-1;for(;n>=0&&B.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
11
+ `)}function yr(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function br(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function xr(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Sr(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
12
+ `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
13
+ `)}var Cr=class{options;rules;lexer;constructor(e){this.options=e||I}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:vr(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Sr(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=_r(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:_r(t[0],`
14
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:_r(t[0],`
15
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=_r(t[0],`
16
+ `).split(`
17
+ `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
18
+ `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
19
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
20
+ ${s}`:s,r=r?`${r}
21
+ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
22
+ `),o=t.raw+`
23
+ `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s,n=`${n}
24
+ ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
25
+ `+e.join(`
26
+ `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
27
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=br(t[2].split(`
28
+ `,1)[0],t[1].length),l=e.split(`
29
+ `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
30
+ `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),ee=this.rules.other.blockquoteBeginRegex(d);for(;e;){let te=e.split(`
31
+ `,1)[0],ne;if(l=te,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),ne=l):ne=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||ee.test(l)||t.test(l)||n.test(l))break;if(ne.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
32
+ `+ne.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
33
+ `+l}u=!l.trim(),r+=te+`
34
+ `,e=e.substring(te.length+1),c=ne.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=vr(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:_r(t[0],`
35
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=gr(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
36
+ `):[],a={type:`table`,raw:_r(t[0],`
37
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(gr(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:_r(t[0],`
38
+ `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
39
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=_r(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=yr(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),xr(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return xr(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},q=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||I,this.options.tokenizer=this.options.tokenizer||new Cr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:B,block:dr.normal,inline:fr.normal};this.options.pedantic?(t.block=dr.pedantic,t.inline=fr.pedantic):this.options.gfm&&(t.block=dr.gfm,t.inline=this.options.breaks?fr.breaks:fr.gfm),this.tokenizer.rules=t}static get rules(){return{block:dr,inline:fr}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(B.carriageReturn,`
40
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(B.tabCharGlobal,` `).replace(B.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
41
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
42
+ `)?``:`
43
+ `)+i.raw,n.text+=`
44
+ `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
45
+ `)?``:`
46
+ `)+i.raw,n.text+=`
47
+ `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
48
+ `)?``:`
49
+ `)+i.raw,r.text+=`
50
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
51
+ `)?``:`
52
+ `)+i.raw,n.text+=`
53
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},wr=class{options;parser;constructor(e){this.options=e||I}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(B.notSpaceStart)?.[0],i=e.replace(B.endingNewline,``)+`
54
+ `;return r?`<pre><code class="language-`+K(r)+`">`+(n?i:K(i,!0))+`</code></pre>
55
+ `:`<pre><code>`+(n?i:K(i,!0))+`</code></pre>
56
+ `}blockquote({tokens:e}){return`<blockquote>
57
+ ${this.parser.parse(e)}</blockquote>
58
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
59
+ `}hr(e){return`<hr>
60
+ `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
61
+ `+r+`</`+i+`>
62
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
63
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
64
+ `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
65
+ <thead>
66
+ `+t+`</thead>
67
+ `+r+`</table>
68
+ `}tablerow({text:e}){return`<tr>
69
+ ${e}</tr>
70
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
71
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${K(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=hr(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+K(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=hr(e);if(i===null)return K(n);e=i;let a=`<img src="${e}" alt="${K(n)}"`;return t&&(a+=` title="${K(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:K(e.text)}},Tr=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},J=class e{options;renderer;textRenderer;constructor(e){this.options=e||I,this.options.renderer=this.options.renderer||new wr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Tr}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Er=class{options;block;constructor(e){this.options=e||I}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?q.lex:q.lexInline}provideParser(e=this.block){return e?J.parse:J.parseInline}},Dr=new class{defaults=rn();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=J;Renderer=wr;TextRenderer=Tr;Lexer=q;Tokenizer=Cr;Hooks=Er;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new wr(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Cr(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Er;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Er.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Er.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return q.lex(e,t??this.defaults)}parser(e,t){return J.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?q.lex:q.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?J.parse:J.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?q.lex:q.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?J.parse:J.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
72
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+K(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Y(e,t){return Dr.parse(e,t)}Y.options=Y.setOptions=function(e){return Dr.setOptions(e),Y.defaults=Dr.defaults,an(Y.defaults),Y},Y.getDefaults=rn,Y.defaults=I;function Or(...e){return Dr.use(...e),Y.defaults=Dr.defaults,an(Y.defaults),Y}Y.use=Or,Y.walkTokens=function(e,t){return Dr.walkTokens(e,t)},Y.parseInline=Dr.parseInline,Y.Parser=J,Y.parser=J.parse,Y.Renderer=wr,Y.TextRenderer=Tr,Y.Lexer=q,Y.lexer=q.lex,Y.Tokenizer=Cr,Y.Hooks=Er,Y.parse=Y,Y.options,Y.setOptions,Y.walkTokens,Y.parseInline,J.parse,q.lex;var kr=e=>{let t=document.querySelector(e);if(!t)throw Error(`missing element: ${e}`);return t},Ar=e=>xe(e,Date.now()),jr=e=>Se(e,Date.now());function X(e,t,...n){let r=document.createElement(e);return t&&(r.className=t),r.append(...n),r}var Mr=e=>e.split(`/`).filter(Boolean).pop()??e,Nr=e=>`New session in ${Mr(e)}`;function Pr(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`} ${n(t.getHours())}:${n(t.getMinutes())}:${n(t.getSeconds())}`}function Fr(e,t,n){return{visible:!1,show(n,r){this.visible=!0,e.classList.remove(`hidden`),e.classList.add(`flex`),t(n,r)},hide(){n?.(),this.visible=!1,e.classList.add(`hidden`),e.classList.remove(`flex`)}}}function Ir(e){let t=X(`span`,`help`);return t.innerHTML=nn.sanitize(Y.parseInline(e,{async:!1})),Rr(t),t}function Lr(e){let t=X(`div`,``);return t.innerHTML=nn.sanitize(Y.parse(e,{async:!1})),Rr(t),t}function Rr(e){for(let t of e.querySelectorAll(`a`))(t.getAttribute(`href`)??``).startsWith(`#`)||(t.target=`_blank`,t.rel=`noreferrer`)}async function zr(e){if(navigator.clipboard)return navigator.clipboard.writeText(e);let t=document.createElement(`textarea`);t.value=e,t.className=`fixed opacity-0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);if(t.remove(),!n)throw Error(`clipboard unavailable`)}function Br(e,t){let n=X(`button`,e,`Copy`);n.title=`Copy to clipboard`;let r;return n.onclick=async e=>{e.stopPropagation(),n.textContent=await zr(t()).then(()=>`Copied`,()=>`Failed`),clearTimeout(r),r=setTimeout(()=>n.textContent=`Copy`,1200)},n}function Vr(e){for(let t of e.querySelectorAll(`pre`)){let e=t.querySelector(`code`);if(!e)continue;let n=X(`div`,`group/code relative`);t.replaceWith(n),n.append(t,Br(`absolute right-1.5 top-1.5 cursor-pointer rounded border border-black/[0.08] bg-white/85 px-1.5 py-0.5 text-[11px] text-neutral-500 opacity-0 transition-opacity hover:bg-white hover:text-neutral-800 focus:opacity-100 group-hover/code:opacity-100 pointer-coarse:opacity-100 dark:border-neutral-200`,()=>e.textContent??``))}}var Hr=450,Ur=8,Wr=700;function Gr(e,t){let n,r,i={x:0,y:0},a=!1,o=()=>clearTimeout(n),s=t=>{e.classList.remove(`bg-emerald-100`,`bg-red-100`),e.classList.add(t),clearTimeout(r),r=setTimeout(()=>e.classList.remove(t),Wr)};e.addEventListener(`pointerdown`,e=>{a=!1,i={x:e.clientX,y:e.clientY},o(),n=setTimeout(()=>{a=!0,zr(t()).then(()=>s(`bg-emerald-100`),()=>s(`bg-red-100`))},Hr)}),e.addEventListener(`pointermove`,e=>{Math.hypot(e.clientX-i.x,e.clientY-i.y)>Ur&&o()});for(let t of[`pointerup`,`pointercancel`,`pointerleave`])e.addEventListener(t,o);e.addEventListener(`click`,e=>{a&&(e.preventDefault(),e.stopImmediatePropagation())})}var Kr=()=>p(s,`chev h-3 w-3`);function qr(e,t){let n=document.createElement(`details`);n.className=e;let r=X(`summary`,`flex cursor-pointer select-none items-center gap-1.5`);return r.append(Kr(),...t),n.append(r),{el:n,summary:r}}var Jr=(e,t=!1)=>Z(e,`${t?`btn btn-primary`:`btn`} text-[12.5px]`),Z=(e,t=``)=>{let n=X(`button`,t,e);return n.type=`button`,n},Yr=e=>X(`span`,`mr-1 flex-none font-medium`,e);function Xr(e,t,n){let r=X(`div`,`inline-flex flex-none items-center gap-0.5 rounded-full bg-neutral-100 p-1`);for(let[i,a,o]of e){let e=a===t,s=Z(o?``:i,`cursor-pointer whitespace-nowrap rounded-full text-[12px] transition-colors ${o?`flex h-7 w-7 items-center justify-center`:`px-3 py-1`} ${e?`bg-white font-medium text-neutral-800 shadow-xs`:`text-neutral-500 hover:text-neutral-700`}`);o&&(s.append(p(o,`h-4 w-4`)),s.setAttribute(`aria-label`,i),s.title=i),s.setAttribute(`aria-pressed`,String(e)),s.onclick=()=>n(a),r.append(s)}return r}function Zr(e,t,n){let r=X(`div`,`flex flex-wrap items-center gap-2`);r.setAttribute(`role`,`radiogroup`);let a=e.map(([e])=>e),o=e.map(([e,t])=>{let n=Z(``,`flex h-10 w-10 cursor-pointer items-center justify-center rounded-full ring-neutral-800 ring-offset-2 ring-offset-white transition-shadow hover:ring-2`);return n.style.background=t,n.setAttribute(`role`,`radio`),n.setAttribute(`aria-label`,e),n.title=e,n}),s=e=>{o.forEach((t,n)=>{let r=a[n]===e;t.classList.toggle(`ring-2`,r),t.setAttribute(`aria-checked`,String(r)),t.tabIndex=r?0:-1,t.replaceChildren(...r?[p(i,`h-4 w-4 text-white dark:text-neutral-950`)]:[])})},c=e=>{s(e),n(e)};return o.forEach((e,t)=>{e.onclick=()=>c(a[t]),e.onkeydown=e=>{let n=e.key===`ArrowRight`||e.key===`ArrowDown`?1:e.key===`ArrowLeft`||e.key===`ArrowUp`?-1:0;if(!n)return;e.preventDefault();let r=(t+n+a.length)%a.length;o[r].focus(),c(a[r])}}),s(t),r.append(...o),r}function Qr(e,t,n){let r=Z(e,`flex cursor-pointer items-center gap-1.5 rounded-full px-3.5 py-2 text-[13px] transition-colors ${t?`bg-indigo-50 font-medium text-indigo-700 ring-1 ring-indigo-200/70`:`text-neutral-600 hover:bg-neutral-100`}`);return r.onclick=n,r}var $r=`rounded-3xl border border-neutral-200 bg-white shadow-sm`,ei=`border-b border-neutral-200/70 bg-neutral-50/50`,ti=`${$r} flex flex-col overflow-hidden`,ni=`${ei} flex flex-none items-center`;function ri(e,t,...n){let r=X(`section`,$r),i=X(`div`,`rounded-t-3xl ${ei} px-5 py-4`);return i.append(X(`h2`,`text-[14px] font-semibold text-neutral-800`,e)),t&&i.append(X(`p`,`mt-1 text-[12px] leading-normal text-neutral-500`,t)),r.append(i,X(`div`,`flex flex-col gap-4 px-5 py-5`,...n)),r}function ii(e,t,n={}){let r=X(`div`,`flex flex-col gap-1.5`),i=X(`div`,`flex items-center gap-1.5`,X(`span`,`field-label`,e));return n.help&&i.append(n.help),r.append(i,t),n.hint&&r.append(X(`span`,`text-[11.5px] leading-snug text-neutral-400`,n.hint)),r}var ai=`w-full rounded-xl border border-neutral-200 bg-neutral-50/60 px-3 py-2.5 text-[12.5px] transition-colors placeholder:text-neutral-400 hover:border-neutral-300 focus:border-indigo-400 focus:ring-2 focus:ring-indigo-100 focus:outline-none`,oi=`${ai} cursor-pointer truncate text-left hover:bg-neutral-50`,si=(e,t,n,r=!1)=>{let i=document.createElement(`input`);return i.className=r?`${ai} font-mono`:ai,i.value=e,i.placeholder=t,i.oninput=()=>n(i.value),i},ci=(e=``,t=`text`)=>{let n=document.createElement(`input`);return n.type=t,n.className=ai,n.value=e,n},li=(e,t)=>{let n=document.createElement(`select`);return n.className=`${ai} select`,n.append(...e.map(([e,t])=>new Option(e,t))),n.value=t,n},ui=(e=``,t=4)=>{let n=document.createElement(`textarea`);return n.className=`${ai} resize-y font-mono`,n.value=e,n.rows=t,n.spellcheck=!1,n};function di(e,t,n,r,i){let a=document.createElement(`input`);a.type=`checkbox`,a.className=`peer sr-only`,a.checked=n,a.onchange=()=>r(a.checked);let o=X(`span`,`relative h-4 w-7 flex-none rounded-full bg-neutral-300 transition-colors after:absolute after:left-0.5 after:top-0.5 after:h-3 after:w-3 after:rounded-full after:bg-white dark:after:bg-neutral-950 after:shadow-sm after:transition-transform peer-checked:bg-indigo-600 peer-checked:after:translate-x-3 peer-focus-visible:ring-2 peer-focus-visible:ring-indigo-200 peer-disabled:cursor-not-allowed peer-disabled:opacity-45`),s=X(`label`,`flex cursor-pointer gap-2.5 ${e?`items-start`:`items-center`}`);if(s.append(a,o),e){let n=X(`span`,`flex items-center gap-1.5`,X(`span`,`text-[13px] text-neutral-700`,e));i&&n.append(i);let r=X(`span`,`flex min-w-0 flex-col`,n);t&&r.append(X(`span`,`text-[11.5px] leading-snug text-neutral-400`,t)),s.append(r)}return s}var fi={idle:`text-neutral-400`,saving:`text-neutral-400`,saved:`text-green-700`,failed:`text-red-600`};function pi(e,t,n){e.className=`text-[11.5px] ${fi[t]}`,e.textContent=n}var mi=(e,t,n)=>X(`span`,`inline-flex flex-none items-center gap-1 rounded-full px-1.5 py-px text-[10px] font-medium uppercase tracking-wide ring-1 ${t}`,...n?[X(`span`,`inline-block h-1.5 w-1.5 flex-none rounded-full ${n}`)]:[],e),hi=(e=`hover:text-red-600`)=>`flex-none cursor-pointer text-[11.5px] text-neutral-400 opacity-0 transition-opacity ${e} group-hover:opacity-100 pointer-coarse:opacity-100`;function gi(e,t,n,r={}){let i=X(`div`,`flex min-w-0 flex-col`,X(`span`,`flex min-w-0 items-center gap-2`,X(`span`,`truncate text-[12.5px] text-neutral-700`,e),...r.tag?[r.tag]:[]),X(`span`,`truncate text-[11.5px] text-neutral-400`,t));return r.title&&(i.title=r.title),X(`div`,`flex items-center justify-between gap-3 rounded-lg border border-neutral-200 px-3 py-2`,i,n)}var _i=e=>X(`p`,`rounded-lg border border-dashed border-neutral-200 px-3 py-4 text-center text-[12.5px] text-neutral-400`,e);function vi(e,t){let n=X(`span`,`group relative inline-flex`),r=Z(``,`flex h-4 w-4 cursor-help items-center justify-center text-neutral-400 transition-colors group-hover:text-indigo-500`);r.append(p(c,`h-full w-full`)),r.setAttribute(`aria-label`,e);let i=X(`span`,`absolute left-0 top-full z-20 hidden w-[min(27rem,calc(100vw-3rem))] pt-1.5 group-hover:block`),a=X(`span`,`flex flex-col gap-2 rounded-xl border border-neutral-200 bg-white p-3.5 text-[12px] font-normal normal-case leading-[1.55] tracking-normal text-neutral-600 shadow-xl`);a.append(X(`span`,`text-[12.5px] font-semibold text-neutral-800`,e));let o=X(`ol`,`flex list-decimal flex-col gap-1.5 pl-4`);for(let e of t){let t=X(`li`,`marker:text-neutral-400`);t.append(typeof e==`string`?Ir(e):e),o.append(t)}return a.append(o),i.append(a),r.onclick=()=>{let e=i.classList.contains(`hidden`);i.classList.toggle(`hidden`,!e),i.classList.toggle(`block`,e),r.classList.toggle(`text-indigo-500`,e)},n.append(r,i),n}var yi=(e,t)=>X(`span`,`flex flex-col gap-1`,Ir(e),t),Q=null,bi=null,xi=null;function Si(e){Q&&!Q.contains(e.target)&&e.target!==xi&&$()}var Ci={ArrowDown:1,ArrowUp:-1},wi={n:1,j:1,p:-1,k:-1},Ti=()=>Q!==null;function Ei(e){if(!(e.altKey||e.metaKey||e.shiftKey||!e.key))return e.ctrlKey?wi[e.key.toLowerCase()]:Ci[e.key]}function Di(e,t){let n=[...e.querySelectorAll(`button:not(:disabled)`)];if(!n.length)return!1;let r=n.indexOf(document.activeElement);return n[t===`first`?0:t===`last`?n.length-1:r<0?t>0?0:n.length-1:(r+t+n.length)%n.length]?.focus(),!0}function Oi(e){if(e.dataset.menu===`true`)return{rows:e,ends:!0};let t=e.querySelector(`[data-list]`);return t?{rows:t,ends:!1}:null}function ki(e){let t=Q?Oi(Q):null;if(t){let n=(t.ends?e.key===`Home`?`first`:e.key===`End`?`last`:void 0:void 0)??Ei(e);if(n!==void 0&&Di(t.rows,n)){e.preventDefault();return}}e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),$())}function Ai(e){bi&&e.target.contains(bi)&&$()}function $(){if(!Q)return;document.removeEventListener(`pointerdown`,Si,!0),document.removeEventListener(`focusin`,Si,!0),document.removeEventListener(`wheel`,Si,!0),document.removeEventListener(`keydown`,ki,!0),window.removeEventListener(`scroll`,Ai,!0),window.removeEventListener(`resize`,$);let e=Q;Q=null,xi?.remove(),xi=null,e.contains(document.activeElement)&&bi?.focus({preventScroll:!0}),bi?.removeAttribute(`aria-expanded`),bi=null,e.inert=!0,e.dataset.closing=``,Promise.allSettled(e.getAnimations().map(e=>e.finished)).then(()=>e.remove())}var ji=null;function Mi(e){let t=e.getBoundingClientRect(),n={top:t.bottom+4,left:t.left};return t.width||t.height?n:ji?.anchor===e?{top:ji.top,left:ji.left}:n}var Ni=()=>window.innerWidth<640;function Pi(e,t){$(),document.querySelectorAll(`.glass-menu[data-closing]`).forEach(e=>e.remove());let n=Ni();Q=X(`div`,`glass-menu fixed z-50 border border-neutral-200 p-2 font-sans leading-6 ${n?`rounded-3xl inset-x-2 bottom-2 max-h-[70dvh] overflow-y-auto pb-[calc(0.25rem+env(safe-area-inset-bottom))] text-[16px]`:`rounded-2xl min-w-60 max-w-[min(42rem,calc(100vw-1rem))] max-h-[calc(100dvh-1rem)] overflow-y-auto text-[15px]`}`),Q.dataset.presentation=n?`sheet`:`popover`,Q.append(t);let r=e.closest(`dialog[open]`)??document.body;if(n&&(xi=X(`div`,`fixed inset-0 z-50 bg-black/15`),xi.onclick=e=>{e.stopPropagation(),$()},r.append(xi)),r.append(Q),!n){let t=Mi(e);ji={anchor:e,...t},Q.style.top=`${Math.max(8,Math.min(t.top,window.innerHeight-Q.offsetHeight-8))}px`,Q.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-Q.offsetWidth-8))}px`}return bi=e,bi.setAttribute(`aria-expanded`,`true`),Q.tabIndex=-1,(Q.querySelector(`button, input, select, [tabindex='0']`)??Q).focus({preventScroll:!0}),document.addEventListener(`pointerdown`,Si,!0),document.addEventListener(`focusin`,Si,!0),document.addEventListener(`wheel`,Si,{capture:!0,passive:!0}),document.addEventListener(`keydown`,ki,!0),window.addEventListener(`scroll`,Ai,!0),window.addEventListener(`resize`,$),Q}function Fi(e){let t=X(`button`,`flex w-full cursor-pointer items-center gap-2 rounded-xl px-3 text-left transition-colors hover:bg-indigo-50 hover:text-indigo-700 active:bg-indigo-100 ${Ni()?`min-h-12 py-3`:`min-h-10 py-2`}`,...e.checked===void 0?[]:[p(i,`h-3 w-3 text-indigo-600 ${e.checked?``:`invisible`}`)],X(`span`,`min-w-0 truncate`,e.label));if(e.hint){let n=X(`span`,`ml-auto max-w-28 shrink-[999] truncate text-[13px] text-neutral-500`,e.hint);n.title=e.hint,t.append(n)}return e.disabled&&(t.disabled=!0,t.classList.add(`cursor-default`,`text-neutral-400`,`hover:bg-transparent`,`hover:text-neutral-400`)),t.onclick=()=>e.onSelect(),t}function Ii(e,t,n){let r=X(`div`,``);if(n&&Ni()){let e=X(`button`,`icon-btn h-11 w-11`,p(f));e.setAttribute(`aria-label`,`Close session actions`),e.onclick=$,r.append(X(`div`,`flex items-center gap-3 border-b border-neutral-200 px-3 pb-1 mb-1`,X(`span`,`min-w-0 flex-1 truncate text-sm font-medium text-neutral-500`,n),e))}for(let e of t)e.separatorBefore&&r.append(X(`hr`,`my-2 border-neutral-200`)),r.append(Fi(e));Pi(e,r),Q&&(Q.dataset.menu=`true`,Q.setAttribute(`aria-label`,n?`Actions for ${n}`:`Actions`),Q.setAttribute(`role`,`group`))}var Li=async e=>{let t=await w(`/api/fs/ls${e?.startsWith(`/`)?`?path=${encodeURIComponent(e)}`:``}`,`Could not list directories`);return t.ok?t.value:null},Ri=e=>e.entries.filter(e=>e.dir&&!e.name.startsWith(`.`)).map(e=>e.name),zi=`flex w-full min-h-10 cursor-pointer items-center gap-2 rounded-xl px-3 py-2 text-left transition-colors hover:bg-indigo-50 hover:text-indigo-700 active:bg-indigo-100`,Bi=`font-mono text-[0.875rem]`,Vi=(e,t,n)=>{let r=Z(e,`${zi} ${t}`);return r.onclick=n,r};function Hi(e,t){let n=X(`div`,`mt-2 flex-none border-t border-neutral-200 pt-2`),r=Vi(`New folder`,`text-neutral-500`,()=>{let r=document.createElement(`input`);r.className=`w-full rounded-xl border-0 bg-neutral-100 px-3 py-2 ${Bi} focus:outline-none`,r.placeholder=`folder-name`;let i=X(`p`,`hidden px-3 pt-1 text-[0.8125rem] text-red-600`);r.onkeydown=async n=>{if(n.key!==`Enter`)return;n.preventDefault();let a=await Re(`/api/fs/mkdir`,{path:e,name:r.value});if(!a.ok){i.textContent=(await a.json()).error??`could not create`,i.classList.remove(`hidden`);return}t((await a.json()).path)},n.replaceChildren(r,i),r.focus()});return r.prepend(p(d)),n.append(r),n}function Ui(e,t,n){let r=e=>{n(e),$()};async function i(t){let n=await Li(t);if(!n)return;let a=X(`div`,`flex max-h-[60dvh] w-full flex-col sm:w-88`),o=Z(`Use`,`btn btn-primary ml-auto flex-none px-3 py-1 text-[0.8125rem]`);o.onclick=()=>r(n.path);let s=document.createElement(`input`);s.className=`min-w-0 flex-1 border-0 bg-transparent ${Bi} text-neutral-600 focus:outline-none`,s.value=n.path,s.spellcheck=!1,s.title=`Type or paste a path, then Enter`,s.onfocus=()=>s.select();let c=X(`p`,`hidden flex-none px-3 pb-1 text-[0.8125rem] text-red-600`);s.onkeydown=async e=>{if(e.key!==`Enter`)return;e.preventDefault(),e.stopPropagation();let t=s.value.trim();if(!t)return;let n=await Li(t);if(!n){c.textContent=`${t} is not a folder this can read`,c.classList.remove(`hidden`);return}r(n.path)};let l=X(`div`,`mb-2 flex flex-none items-center gap-2 border-b border-neutral-200 px-3 pb-2 pt-1`,s,o),u=X(`div`,`min-h-0 flex-1 overflow-y-auto`);u.dataset.list=``,n.parent&&u.append(Vi(`../`,`${Bi} text-neutral-500`,()=>void i(n.parent)));let d=Ri(n);for(let e of d)u.append(Vi(e,`truncate`,()=>void i(`${n.path}/${e}`.replace(`//`,`/`))));d.length||u.append(X(`p`,`px-3 py-2 text-[0.8125rem] text-neutral-400`,`No sub-folders.`)),a.append(l,c,u,Hi(n.path,e=>void i(e))),Pi(e,a)}i(t)}function Wi(e,t,n,r){Ii(e,[...t.map(e=>({label:e.path,...e.hint?{hint:e.hint}:{},checked:e.path===n,onSelect:()=>{$(),r(e.path)}})),{label:`Browse…`,onSelect:()=>Ui(e,n||void 0,r)}])}var Gi=(e,t)=>n=>{e.value=n,e.dispatchEvent(new Event(`input`,{bubbles:!0})),t?.(n)};function Ki(e,t){let n=Z(`Browse…`,`btn flex-none self-stretch rounded-xl px-3 text-[12.5px] text-neutral-600`);return n.onclick=()=>Ui(n,e.value.trim()||void 0,Gi(e,t)),n}function qi(e,t,n){let r=document.createElement(`input`);return r.className=`${ai} min-w-0 flex-1 font-mono`,r.value=e,r.placeholder=t,r.oninput=()=>n(r.value),{el:X(`div`,`flex items-center gap-1.5`,r,Ki(r,n)),input:r}}var Ji=`modulepreload`,Yi=function(e){return`/app/`+e},Xi={},Zi=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Yi(t,n),t=s(t),t in Xi)return;Xi[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Ji,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Qi,$i;function ea(){return $i??=Zi(()=>import(`./hljs-BRz6a8Dq.js`).then(e=>Qi=e.default,e=>{console.warn(`highlighting unavailable — code stays plain text`,e)}),[]),$i}async function ta(e){let t=await ea();if(t)for(let n of e.querySelectorAll(`pre code[class]`)){let e=/(?:language|lang)-(\S+)/.exec(n.className)?.[1]?.toLowerCase();!e||!t.getLanguage(e)||(n.innerHTML=t.highlight(n.textContent??``,{language:e}).value)}}var na={ts:`typescript`,tsx:`typescript`,mts:`typescript`,cts:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,py:`python`,rs:`rust`,sh:`bash`,zsh:`bash`,md:`markdown`,yml:`yaml`,html:`xml`,htm:`xml`,svg:`xml`,patch:`diff`};async function ra(e){let t=await ea(),n=e.split(`.`).pop()?.toLowerCase()??``,r=na[n]??n;return t?.getLanguage(r)?r:null}function ia(e,t){let n=document.createElement(`span`);return Qi&&t&&e.length<=500?n.innerHTML=Qi.highlight(e,{language:t}).value:n.textContent=e,n}export{Nr as $,Qr as A,a as At,kr as B,ri as C,h as Ct,vi as D,d as Dt,ii as E,f as Et,Zr as F,Fr as G,jr as H,si as I,X as J,Br as K,ui as L,Xr as M,r as Mt,li as N,ci as O,s as Ot,pi as P,Pr as Q,di as R,Jr as S,le as St,_i as T,ie as Tt,Mr as U,Vr as V,Kr as W,Lr as X,Gr as Y,Ar as Z,$r as _,ge as _t,qi as a,Be as at,mi as b,ae as bt,$ as c,ye as ct,Ii as d,b as dt,Ie as et,Pi as f,Fe as ft,ti as g,pe as gt,oi as h,ue as ht,Zi as i,S as it,hi as j,i as jt,Yr as k,o as kt,Ei as l,we as lt,ai as m,be as mt,ra as n,w as nt,Li as o,Re as ot,ni as p,Ne as pt,qr as q,ia as r,ze as rt,Wi as s,Te as st,ta as t,C as tt,Ti as u,Me as ut,ei as v,he as vt,gi as w,p as wt,Z as x,oe as xt,fi as y,me as yt,yi as z};