PageSourceSearch

https://kpm.sh/assets/posts._slug-Ch7cxTzv.js

js kpm.sh collected 2026-10-09 17:37:14 UTC 5,446 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-Dr14IPfJ.js","assets/preload-helper-Czpn1I53.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-D7hbyKwE.js","assets/rolldown-runtime-CbXtAM7H.js","assets/chunk-DU6HZSFF-C2xXyMXM.js","assets/chunk-75Z2AOVW-TbF2V_WI.js","assets/monotone-Cq9iNUa7.js","assets/dist-LslQRRXq.js","assets/chunk-PWAF6VOD-DkAq2_G6.js","assets/chunk-GMAD6QVW-CS_IUEtY.js","assets/chunk-P2QGCYS3-Dsaezo83.js","assets/chunk-4HAMMTFA-Sn1zMucA.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-GVQU2GXP-18ImxNZ3.js","assets/chunk-OSK3NFVY-B8UGoVso.js","assets/graphlib-DS17s2tU.js","assets/chunk-L3NEJ4N5-DMnEn-1_.js"])))=>i.map(i=>d[i]);
2import{n as e}from"./rolldown-runtime-CbXtAM7H.js";import{$ as t,i as n}from"./createServerFn-CSX4MdBr.js";import{t as r}from"./jsx-runtime-CznXPbDH.js";import{t as i}from"./preload-helper-Czpn1I53.js";/* empty css              */import{i as a}from"./index-C18u1PuP.js";import{t as o}from"./dates-5cWC5xIv.js";var s=e(t(),1),c=r(),l=(0,s.createContext)({activeId:null}),u=({item:e,itemIndex:t})=>{let{activeId:r}=(0,s.useContext)(l),i=r===e.id||!r&&t===0;return(0,c.jsxs)(`li`,{children:[(0,c.jsx)(n,{as:`a`,size:`0`,href:`#${e.id}`,onClick:t=>{t.preventDefault();let n=document.getElementById(e.id);if(!n)return;let r=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;n.scrollIntoView({behavior:r?`instant`:`smooth`})},color:i?`1`:`2`,children:(0,c.jsx)(`span`,{children:e.text})}),e.children.length>0&&(0,c.jsx)(`ul`,{children:e.children.map(e=>(0,c.jsx)(u,{item:e},e.id))})]})},d=e=>e.flatMap(e=>[e,...d(e.children)]),f=({items:e})=>{let[t,n]=(0,s.useState)(null),r=(0,s.useMemo)(()=>d(e),[e]),i=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let e=r.map(({id:e})=>document.getElementById(e)).filter(e=>e!==null);if(e.length===0)return;let t=0,i=()=>{t=0;let r=e[0];for(let t of e){if(t.getBoundingClientRect().top>22)break;r=t}n(e=>e===r?.id?e:r?.id??null)},a=()=>{t===0&&(t=window.requestAnimationFrame(i))};return a(),document.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{document.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a),window.cancelAnimationFrame(t)}},[r]),(0,s.useEffect)(()=>{let e=i.current;if(!e)return;let t=e.closest(`.page-container`)??e.closest(`.post-layout`),n=e.closest(`.post-container`);if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let r=e.getBoundingClientRect().top+-1,a=0,o=()=>{a=0;let i=e.getBoundingClientRect().height,o=t.getBoundingClientRect(),s=n.getBoundingClientRect(),c=o.bottom;if(!(r+i>c)){e.style.position=`fixed`,e.style.top=`${r}px`;return}let l=window.scrollY+o.bottom,u=window.scrollY+s.top,d=Math.max(0,l-i-u);e.style.position=`absolute`,e.style.top=`${d}px`},s=()=>{a===0&&(a=window.requestAnimationFrame(o))};o(),window.addEventListener(`scroll`,s,{passive:!0}),window.addEventListener(`resize`,s),e.addEventListener(`mouseenter`,s),e.addEventListener(`mouseleave`,s);let c=new ResizeObserver(s);return c.observe(e),()=>{window.removeEventListener(`scroll`,s),window.removeEventListener(`resize`,s),e.removeEventListener(`mouseenter`,s),e.removeEventListener(`mouseleave`,s),c.disconnect(),window.cancelAnimationFrame(a)}},[]),(0,c.jsx)(`div`,{ref:i,className:`table-of-contents-container`,children:(0,c.jsx)(l.Provider,{value:{activeId:t},children:(0,c.jsx)(`div`,{className:`table-of-contents`,children:(0,c.jsx)(`ul`,{children:e.map((e,t)=>(0,c.jsx)(u,{item:e,itemIndex:t},e.id))})})})})},p=()=>{let{frontmatter:e,content:t,tableOfContents:r,readingTime:l,hasMermaid:u}=a.useLoaderData();return(0,s.useEffect)(()=>{if(!u)return;let e=!1;return(async()=>{try{let{default:t}=await i(async()=>{let{default:e}=await import(`./mermaid.core-Dr14IPfJ.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]));if(e)return;t.initialize({startOnLoad:!0}),await t.run()}catch(t){if(!e){let e=t instanceof Error?t.message:String(t);console.error(`Mermaid rendering failed:`,e)}}})(),()=>{e=!0}},[u]),(0,c.jsx)(`div`,{className:`post-layout`,children:(0,c.jsxs)(`div`,{className:`post-container`,children:[(0,c.jsxs)(`div`,{className:`post-header`,children:[(0,c.jsx)(n,{as:`h1`,size:`6`,weight:`500`,className:`post-title`,children:e.title}),(0,c.jsxs)(`div`,{className:`post-author`,children:[(0,c.jsx)(`img`,{src:`/images/avatar.png`,alt:`Kyle McDonald`,className:`post-author-avatar`}),(0,c.jsx)(n,{as:`span`,size:`1`,color:`2`,children:`Kyle McDonald`})]}),e?.[`substack-link`]&&(0,c.jsxs)(`div`,{className:`post-substack`,children:[(0,c.jsx)(n,{as:`a`,size:`0`,href:e[`substack-link`],target:`_blank`,children:`Read on Substack`}),(0,c.jsx)(`i`,{className:`hn hn-external-link-solid`,"data-text-size":`0`})]})]}),(0,c.jsxs)(`div`,{className:`post-details`,children:[(0,c.jsx)(n,{as:`span`,size:`1`,color:`2`,children:o(e.date)}),(0,c.jsxs)(`div`,{className:`post-details-right`,children:[(0,c.jsxs)(n,{as:`span`,size:`1`,color:`2`,children:[l,` min read`]}),(0,c.jsxs)(`a`,{href:`/rss.xml`,className:`post-rss-link`,"aria-label":`Subscribe to the RSS feed`,type:`application/rss+xml`,children:[(0,c.jsx)(`i`,{className:`hn hn-rss`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`sr-only`,children:`Subscribe to the RSS feed`})]})]})]}),(0,c.jsx)(f,{items:r}
2),(0,c.jsx)(`div`,{className:`post-content`,"data-post":!0,dangerouslySetInnerHTML:{__html:t}})]})})};export{p as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.