@xexr/blog-platform 1.1.5 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/README.md +21 -0
- package/dist/app/api/blog/publish/route.test.ts +55 -0
- package/dist/app/api/blog/publish/route.ts +7 -2
- package/dist/app/blog/[slug]/page.tsx +41 -28
- package/dist/components/ArchiveStructuredData.tsx +61 -0
- package/dist/components/ArticleVideo.tsx +136 -0
- package/dist/components/SeriesArchivePages.tsx +10 -0
- package/dist/components/TopicArchivePages.test.ts +52 -4
- package/dist/components/TopicArchivePages.tsx +14 -4
- package/dist/{index-CKWrb9a4.d.mts → index-CmjKzrH-.d.mts} +30 -1
- package/dist/{index-CKWrb9a4.d.ts → index-CmjKzrH-.d.ts} +30 -1
- package/dist/index.d.mts +52 -5
- package/dist/index.d.ts +52 -5
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -14
- package/dist/index.mjs.map +1 -1
- package/dist/lib/related-articles.d.mts +3 -2
- package/dist/lib/related-articles.d.ts +3 -2
- package/dist/lib/sitemap.ts +2 -42
- package/dist/lib/storage/drizzle.ts +9 -0
- package/dist/lib/structured-data.ts +62 -11
- package/dist/lib/video.ts +163 -0
- package/dist/{sitemap-BDT3d496.d.ts → sitemap-CEjqxRaQ.d.ts} +5 -4
- package/dist/{sitemap-D3rS0iAF.d.mts → sitemap-D1eInRA1.d.mts} +5 -4
- package/dist/sitemap.d.mts +2 -2
- package/dist/sitemap.d.ts +2 -2
- package/dist/sitemap.js +4 -4
- package/dist/sitemap.js.map +1 -1
- package/dist/sitemap.mjs +4 -4
- package/dist/sitemap.mjs.map +1 -1
- package/dist/types/contracts.ts +38 -0
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.ts +1 -0
- package/package.json +17 -13
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use strict';var te=require('next/link.js'),At=require('next/image.js'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),reactSlot=require('@radix-ui/react-slot'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),dateFns=require('date-fns'),Ye=require('react'),rsc=require('next-mdx-remote-client/rsc'),fa6=require('react-icons/fa6'),Nt=require('@radix-ui/react-separator'),Zn=require('rehype-raw'),ei=require('rehype-sanitize'),ti=require('remark-gfm'),ri=require('remark-toc'),ni=require('rehype-slug'),crypto=require('crypto'),ratelimit=require('@upstash/ratelimit'),redis=require('@upstash/redis'),drizzleOrm=require('drizzle-orm'),sqliteCore=require('drizzle-orm/sqlite-core'),server_js=require('next/server.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var te__default=/*#__PURE__*/_interopDefault(te);var At__default=/*#__PURE__*/_interopDefault(At);var Ye__namespace=/*#__PURE__*/_interopNamespace(Ye);var Nt__namespace=/*#__PURE__*/_interopNamespace(Nt);var Zn__default=/*#__PURE__*/_interopDefault(Zn);var ei__default=/*#__PURE__*/_interopDefault(ei);var ti__default=/*#__PURE__*/_interopDefault(ti);var ri__default=/*#__PURE__*/_interopDefault(ri);var ni__default=/*#__PURE__*/_interopDefault(ni);function f(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var Ve=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Zr({className:e,variant:t,size:r,asChild:n=false,...o}){return jsxRuntime.jsx(n?reactSlot.Slot:"button",{"data-slot":"button",className:f(Ve({variant:t,size:r,className:e})),...o})}function ut({className:e,...t}){return jsxRuntime.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:f("mx-auto flex w-full justify-center",e),...t})}function dt({className:e,...t}){return jsxRuntime.jsx("ul",{"data-slot":"pagination-content",className:f("flex flex-row items-center gap-1",e),...t})}function ne({...e}){return jsxRuntime.jsx("li",{"data-slot":"pagination-item",...e})}function me({className:e,isActive:t,size:r="icon",...n}){return jsxRuntime.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:f(Ve({variant:t?"outline":"ghost",size:r}),e),...n})}function mt({className:e,...t}){return jsxRuntime.jsxs(me,{"aria-label":"Go to previous page",size:"default",className:f("gap-1 px-2.5 sm:pl-2.5",e),...t,children:[jsxRuntime.jsx(lucideReact.ChevronLeftIcon,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function gt({className:e,...t}){return jsxRuntime.jsxs(me,{"aria-label":"Go to next page",size:"default",className:f("gap-1 px-2.5 sm:pr-2.5",e),...t,children:[jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Next"}),jsxRuntime.jsx(lucideReact.ChevronRightIcon,{})]})}function qe({className:e,...t}){return jsxRuntime.jsxs("span",{"aria-hidden":true,"data-slot":"pagination-ellipsis",className:f("flex size-9 items-center justify-center",e),...t,children:[jsxRuntime.jsx(lucideReact.MoreHorizontalIcon,{className:"size-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"More pages"})]})}function ve({currentPage:e,totalPages:t,baseUrl:r,className:n,maxVisiblePages:o=5,showPrevNext:i=true,showFirstLast:s=true}){if(t<=1)return null;let l=()=>{let p=Math.floor(o/2),b=Math.max(1,e-p),A=Math.min(t,b+o-1);return A-b+1<o&&(b=Math.max(1,A-o+1)),{start:b,end:A}},{start:a,end:u}=l(),m=Array.from({length:u-a+1},(p,b)=>a+b),c=p=>p===1?r:`${r}?page=${p}`,g=e>1,h=e<t;return jsxRuntime.jsxs(ut,{className:n,children:[jsxRuntime.jsxs(dt,{children:[s&&e>2&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ne,{children:jsxRuntime.jsx(me,{href:c(1),"aria-label":"Go to first page",children:jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:"h-4 w-4"})})}),a>2&&jsxRuntime.jsx(ne,{children:jsxRuntime.jsx(qe,{})})]}),i&&jsxRuntime.jsx(ne,{children:g?jsxRuntime.jsx(mt,{href:c(e-1)}):jsxRuntime.jsx("span",{className:"flex h-9 items-center justify-center gap-1 px-2.5 text-muted-foreground sm:pl-2.5",children:jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Previous"})})}),m.map(p=>jsxRuntime.jsx(ne,{children:jsxRuntime.jsx(me,{href:c(p),isActive:p===e,children:p})},p)),i&&jsxRuntime.jsx(ne,{children:h?jsxRuntime.jsx(gt,{href:c(e+1)}):jsxRuntime.jsx("span",{className:"flex h-9 items-center justify-center gap-1 px-2.5 text-muted-foreground sm:pr-2.5",children:jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Next"})})}),s&&e<t-1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u<t-1&&jsxRuntime.jsx(ne,{children:jsxRuntime.jsx(qe,{})}),jsxRuntime.jsx(ne,{children:jsxRuntime.jsx(me,{href:c(t),"aria-label":"Go to last page",children:jsxRuntime.jsx(lucideReact.ChevronsRight,{className:"h-4 w-4"})})})]})]}),jsxRuntime.jsxs("div",{className:"sr-only","aria-live":"polite",children:["Page ",e," of ",t]})]})}function an(e,t=10){let r=e.page,n=Array.isArray(r)?r[0]:r,o=Math.max(1,parseInt(n??"1",10)),i=(o-1)*t;return {currentPage:o,itemsPerPage:t,offset:i,calculateTotalPages:l=>Math.ceil(l/t)}}function ln(e,t,r,n){let o=n?`${n}${e===1?r:`${r}?page=${e}`}`:void 0,i=e>1&&n?`${n}${e===2?r:`${r}?page=${e-1}`}`:void 0,s=e<t&&n?`${n}${r}?page=${e+1}`:void 0;return {alternates:{...o&&{canonical:o}},other:{...i&&{prev:i},...s&&{next:s}}}}function _(e="/blog"){let t=e.trim();return !t||t==="/"?"":t.replace(/^(?!\/)/,"/").replace(/\/+$/,"")}function P(e,t){let r=_(e),n=t?.replace(/^\/+/,"").replace(/\/+$/,"");return n?`${r}/${n}`.replace(/\/+/g,"/"):r||"/"}function E(e,t){return P(e,`authors/${t}`)}function se(e,t){return P(e,`series/${t}`)}function cn(e){let t=new URL(e);return _(t.pathname)}function Xe(e,t={}){let{customDomain:r,pathPrefix:n="/blog",language:o,isAccessibleForFree:i=true,includeOptionalProperties:s=true}=t,l=r??e.site.domain,a=r?`https://${l}${n}/${e.slug}`:e.meta.canonicalUrl??`https://${l}${n}/${e.slug}`,u=e.author?We(e.author,{customDomain:r,pathPrefix:n}):void 0,m=ft(e.site,{customDomain:r,pathPrefix:n}),g=`PT${Math.max(1,Math.ceil(e.readingSeconds/60))}M`,h={"@context":"https://schema.org","@type":"BlogPosting","@id":`${a}#article`,headline:e.title,description:e.excerpt,datePublished:e.publishedAt,dateModified:e.updatedAt,author:u,publisher:m,mainEntityOfPage:{"@type":"WebPage","@id":a},wordCount:e.wordCount,timeRequired:g,isAccessibleForFree:i};return s&&(e.featuredImage&&(h.image=e.featuredImage),e.meta.keywords.length>0&&(h.keywords=[...e.meta.keywords]),(o??e.site.locale)&&(h.inLanguage=o??e.site.locale),e.site.toneAdjectives.length>0&&(h.about=e.site.toneAdjectives.map(p=>({"@type":"Thing",name:p}))),e.site.toneAdjectives.length>0&&(h.genre=[...e.site.toneAdjectives])),h}function We(e,t={}){let{customDomain:r,pathPrefix:n="/blog"}=t,o={"@context":"https://schema.org","@type":"Person","@id":`#author-${e.id}`,name:e.name,identifier:e.id};e.bio&&(o.description=e.bio),e.avatarUrl&&(o.image=e.avatarUrl);let i=[e.socialLinks?.website,e.socialLinks?.x,e.socialLinks?.linkedin,e.socialLinks?.github].filter(s=>!!s);if(i.length>0&&(o.sameAs=i),e.slug?.trim()){let s=r?`https://${r}${E(n,e.slug)}`:E(n,e.slug);o.url=s;}return e.isGuest&&(o.additionalType="GuestAuthor"),e.toneAdjectives&&e.toneAdjectives.length>0&&(o.knowsAbout=[...e.toneAdjectives]),o}function ft(e,t={}){let{customDomain:r,pathPrefix:n="/blog"}=t,i=`https://${r??e.domain}${n}`,s={"@context":"https://schema.org","@type":"Organization","@id":`${i}#organization`,name:e.name,url:i};return e.description?.trim()&&(s.description=e.description),e.tagline?.trim()&&(s.description=s.description?`${s.description}. ${e.tagline}`:e.tagline),s}function ht(e,t={}){let{customDomain:r,pathPrefix:n="/blog",language:o,includeSearchAction:i=true}=t,l=`https://${r??e.domain}${n}`,a=ft(e,t),u={"@context":"https://schema.org","@type":"WebSite","@id":`${l}#website`,name:e.name,url:l,publisher:a};return e.description?.trim()&&(u.description=e.description),(o??e.locale)&&(u.inLanguage=o??e.locale),i&&(u.potentialAction={"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${l}?search={search_term_string}`},"query-input":"required name=search_term_string"}),u}function Jt(e,t={}){let{customDomain:r}=t;return {"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((n,o)=>({"@type":"ListItem",position:o+1,name:n.name,item:r&&!n.url.startsWith("http")?`https://${r}${n.url}`:n.url}))}}function bt(e,t={}){let r=[];r.push(Xe(e,t)),r.push(ht(e.site,t));let n=t.pathPrefix??"/blog",o=[{name:"Home",url:"/"},{name:e.site.name,url:n},{name:e.title,url:`${n}/${e.slug}`}];return r.push(Jt(o,t)),r}function xt(e,t=[],r={}){let n=[];if(n.push(ht(e,r)),t.length>0){let o=t.slice(0,5).map(i=>Xe(i,r));n.push(...o);}return n}function Yt(e){let t=[];if(e["@context"]?e["@context"]!=="https://schema.org"&&t.push("@context must be 'https://schema.org'"):t.push("Missing required @context property"),e["@type"]||t.push("Missing required @type property"),e["@type"]==="BlogPosting"){let r=e;r.headline||t.push("BlogPosting: Missing required headline"),r.datePublished||t.push("BlogPosting: Missing required datePublished"),r.author||t.push("BlogPosting: Missing required author"),r.publisher||t.push("BlogPosting: Missing required publisher");}return e["@type"]==="Person"&&(e.name||t.push("Person: Missing required name")),e["@type"]==="Organization"&&(e.name||t.push("Organization: Missing required name")),{isValid:t.length===0,errors:t}}function Qt(e){return JSON.stringify(e,null,0).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ge(e){return {type:"application/ld+json",dangerouslySetInnerHTML:{__html:Qt(e)}}}function un(e){let t=new Set;return e.meta.keywords.forEach(r=>t.add(r)),e.site.toneAdjectives.forEach(r=>t.add(r)),e.author&&e.author.toneAdjectives.forEach(r=>t.add(r)),Array.from(t)}var Ie=class extends Error{constructor(r,n,o){super(r);this.code=n;this.details=o;this.name="StructuredDataError";}code;details};function dn(e,t={}){try{let r=Xe(e,t),n=Yt(r);return n.isValid?{schema:r}:{error:new Ie("Generated schema validation failed","VALIDATION_FAILED",n.errors)}}catch(r){return {error:new Ie("Failed to generate structured data","GENERATION_FAILED",r)}}}var F="bg-linear-to-br from-[var(--blog-accent-hover)] via-[var(--blog-text-accent)] to-fuchsia-200 bg-clip-text text-transparent",Pe={accentColor:"hsl(var(--primary))",accentHoverColor:"hsl(var(--primary))",textAccentColor:"hsl(var(--primary))",textAccentHoverColor:"hsl(var(--primary))",accentBackgroundColor:"hsl(var(--primary) / 0.08)",accentBorderColor:"hsl(var(--primary) / 0.25)"};function H(e={}){return {"--blog-accent":e.accentColor??Pe.accentColor,"--blog-accent-hover":e.accentHoverColor??Pe.accentHoverColor,"--blog-text-accent":e.textAccentColor??e.accentColor??Pe.textAccentColor,"--blog-text-accent-hover":e.textAccentHoverColor??e.accentHoverColor??Pe.textAccentHoverColor,"--blog-accent-bg":e.accentBackgroundColor??Pe.accentBackgroundColor,"--blog-accent-border":e.accentBorderColor??Pe.accentBorderColor}}function yt(e,t){let r=new Date(e),n=new Date(t);return {publishedDateLabel:dateFns.format(r,"d MMMM yyyy"),publishedRelativeLabel:dateFns.formatDistanceToNow(r,{addSuffix:true}),updatedDateLabel:dateFns.format(n,"d MMMM yyyy"),isUpdated:n.getTime()!==r.getTime()}}function vt(e){let t=[],r=false;for(let n of e.split(`
|
|
2
|
-
`)){if(/^\s*```/.test(n)){r=!r;continue}if(r)continue;let o=/^(#{2,3})\s+(.+?)\s*#*\s*$/.exec(n);if(!o?.[1]||!o[2])continue;let i=gn(o[2]);i&&t.push({id:pn(i),text:i,level:o[1].length});}return t}function er(e){return `${e} ${e===1?"section":"sections"}`}function tr(e,t){let r=e===t;return {isActive:r,ariaCurrent:r?"location":void 0}}function gn(e){return e.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`~]/g,"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim()}function pn(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-")}var Je="Thanks, you're on the list. We'll confirm before sending updates.";function Ee({siteId:e,settings:t,sourceSurface:r,sourceArticleSlug:n,sourceUrl:o,previewMode:i=false,className:s}){let[l,a]=Ye.useState(null),[u,m]=Ye.useState(null),[c,g]=Ye.useState(false),[h,p]=Ye.useState(false),b=vn(e),A=Ye.useSyncExternalStore(Sn,()=>Pn(b),()=>false),I=c||!i&&A;async function T(S){S.preventDefault(),m(null),a(null);let U=new FormData(S.currentTarget),N=Pt(U,"company");if(i){a(Je),g(true),S.currentTarget.reset();return}p(true);try{let O=await fetch(`${t.captureBaseUrl.replace(/\/$/,"")}/api/newsletter/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteId:Number(e),publicSubscribeToken:t.publicSubscribeToken,email:Pt(U,"email"),name:yn(U,"name"),sourceSurface:r,sourceUrl:xn(o),sourceArticleSlug:n??null,honeypot:N})});if(!O.ok)throw new Error("Newsletter signup failed.");let de=await O.json().catch(()=>null),_e=wn(de)??Je;An(b),a(_e),g(!0),S.currentTarget.reset();}catch{a(null),m("Newsletter signup failed. Please try again.");}finally{p(false);}}return jsxRuntime.jsx("section",{className:f("border-y border-[var(--blog-accent-border)] py-5 sm:py-6",s),"aria-labelledby":`newsletter-${r}-title`,children:jsxRuntime.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.4fr)] lg:items-end",children:[jsxRuntime.jsxs("div",{className:"max-w-xl space-y-1",children:[jsxRuntime.jsx("h2",{id:`newsletter-${r}-title`,className:"text-base leading-6 font-semibold",children:t.title}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm leading-6",children:t.description})]}),I?jsxRuntime.jsxs("div",{className:"flex items-start gap-3 text-sm leading-6 text-emerald-500",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-emerald-500/15",children:jsxRuntime.jsx(lucideReact.Check,{className:"size-3.5","aria-hidden":"true"})}),jsxRuntime.jsx("p",{children:l??Je})]}):jsxRuntime.jsxs("form",{onSubmit:T,className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,0.8fr)_minmax(0,1fr)_auto]",children:[jsxRuntime.jsx("label",{className:"sr-only",htmlFor:`newsletter-name-${r}`,children:"Name"}),jsxRuntime.jsx("input",{id:`newsletter-name-${r}`,name:"name",type:"text",autoComplete:"name",placeholder:"Name",className:"border-input bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring min-h-10 rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"}),jsxRuntime.jsx("label",{className:"sr-only",htmlFor:`newsletter-email-${r}`,children:"Email"}),jsxRuntime.jsx("input",{id:`newsletter-email-${r}`,name:"email",type:"email",autoComplete:"email",placeholder:"Email address",required:true,className:"border-input bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring min-h-10 rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"}),jsxRuntime.jsx("input",{type:"text",name:"company",tabIndex:-1,autoComplete:"off","aria-hidden":"true",className:"hidden"}),jsxRuntime.jsxs("button",{type:"submit",disabled:h,className:"inline-flex min-h-10 w-full shrink-0 items-center justify-center gap-2 rounded-full bg-[var(--blog-accent)] px-5 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60 sm:w-auto",children:[h?"Submitting...":t.buttonLabel,jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"size-4","aria-hidden":"true"})]})]}),u&&jsxRuntime.jsx("p",{className:"text-sm text-red-600",children:u})]})]})})}function xn(e){return e?.startsWith("http://")||e?.startsWith("https://")?e:typeof window<"u"?window.location.href:null}function Pt(e,t){let r=e.get(t);return typeof r=="string"?r:""}function yn(e,t){let r=Pt(e,t).trim();return r.length===0?null:r}function vn(e){return `bloggy_newsletter_subscribed_${e}`}function Pn(e){if(typeof window>"u")return false;try{if(window.localStorage.getItem(e)==="true")return !0}catch{}return typeof document>"u"?false:document.cookie.split(";").some(t=>t.trim().startsWith(`${e}=true`))}function An(e){if(typeof window<"u")try{window.localStorage.setItem(e,"true");}catch{}typeof document<"u"&&(document.cookie=`${e}=true; Max-Age=31536000; Path=/; SameSite=Lax`);}function Sn(e){return typeof window>"u"?()=>{}:(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e))}function wn(e){return e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"?e.message:null}function or({articles:e,siteName:t,siteTagline:r,className:n,site:o,includeStructuredData:i=false,basePath:s="/blog",pagination:l,theme:a,newsletter:u,newsletterPreviewMode:m=false}){let c=_(s)||"/",g=u??o?.newsletter,h=o?.id??e[0]?.site.id;return jsxRuntime.jsxs("div",{style:H(a),className:f("blog-home-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",n),children:[t&&jsxRuntime.jsxs("header",{className:"blog-header mb-8 text-center sm:mb-12 lg:mb-16",children:[jsxRuntime.jsx("h1",{className:f("blog-title mb-2 text-3xl font-light tracking-tight text-balance sm:text-4xl lg:text-5xl",F),children:t}),r&&jsxRuntime.jsx("p",{className:"blog-tagline text-muted-foreground text-base sm:text-lg",children:r}),jsxRuntime.jsxs("nav",{"aria-label":"Browse blog",className:"mt-5 flex flex-wrap items-center justify-center gap-2 text-sm",children:[jsxRuntime.jsx(te__default.default,{href:c,"aria-current":"page",className:"rounded-full border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] px-3 py-1.5 font-medium text-[var(--blog-text-accent)] transition-colors hover:border-[var(--blog-text-accent)] hover:text-[var(--blog-text-accent-hover)] hover:no-underline",children:"All articles"}),jsxRuntime.jsx(te__default.default,{href:P(c,"topics"),className:"text-muted-foreground rounded-full border border-transparent px-3 py-1.5 font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:text-[var(--blog-accent)] hover:no-underline",children:"Topics"}),jsxRuntime.jsx(te__default.default,{href:P(c,"series"),className:"text-muted-foreground rounded-full border border-transparent px-3 py-1.5 font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:text-[var(--blog-accent)] hover:no-underline",children:"Series"}),jsxRuntime.jsx(te__default.default,{href:P(c,"authors"),className:"text-muted-foreground rounded-full border border-transparent px-3 py-1.5 font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:text-[var(--blog-accent)] hover:no-underline",children:"Authors"})]})]}),jsxRuntime.jsxs("main",{className:"articles-list",children:[e.length===0?jsxRuntime.jsxs("div",{className:"no-articles text-muted-foreground py-16 text-center sm:py-24 lg:py-32",children:[jsxRuntime.jsx("h2",{className:"mb-3 text-xl font-light sm:mb-4 sm:text-2xl lg:text-3xl",children:"No articles yet"}),jsxRuntime.jsx("p",{className:"text-muted-foreground/70 mx-auto max-w-md text-base sm:text-lg",children:"This blog doesn't have any published articles yet."})]}):jsxRuntime.jsx("div",{className:"space-y-0",children:e.map(p=>jsxRuntime.jsx(Rn,{article:p,basePath:c},p.id))}),l&&l.totalPages>1&&jsxRuntime.jsx("div",{className:"pagination-wrapper mt-12",children:jsxRuntime.jsx(ve,{currentPage:l.currentPage,totalPages:l.totalPages,baseUrl:l.baseUrl??c,className:"justify-center"})})]}),g?.enabled&&h&&jsxRuntime.jsx(Ee,{siteId:h,settings:g,sourceSurface:"blog_home",previewMode:m,className:"mt-10 sm:mt-12"}),i&&o&&(()=>{let p=ge(xt(o,e.slice(0,5),{pathPrefix:c}));return jsxRuntime.jsx("script",{type:p.type,dangerouslySetInnerHTML:p.dangerouslySetInnerHTML})})()]})}function Tn(e){return `${Math.ceil(e/60)} min read`}function Rn({article:e,basePath:t}){let r=P(t,e.slug),n=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true}),o=Tn(e.readingSeconds),i=e.featuredImage;return jsxRuntime.jsxs("article",{className:"group border-border mb-6 block border-b pb-6 last:mb-0 last:border-b-0 last:pb-0 sm:mb-8 sm:pb-8",children:[jsxRuntime.jsxs("div",{className:"space-y-4 lg:hidden",children:[i&&jsxRuntime.jsx(te__default.default,{href:r,className:"focus-visible:ring-ring relative block aspect-[16/10] w-full overflow-hidden rounded-2xl bg-[var(--blog-accent-bg)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","aria-label":`Read article: ${e.title}`,children:jsxRuntime.jsx(At__default.default,{src:i,alt:e.featuredImageAlt??`Featured image for ${e.title}`,width:400,height:250,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(te__default.default,{href:r,className:"focus-visible:ring-ring block rounded-md hover:no-underline focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",children:jsxRuntime.jsx("h2",{className:"text-lg leading-tight font-bold text-balance transition-colors group-hover:text-[var(--blog-accent)] sm:text-xl md:text-2xl",children:e.title})}),jsxRuntime.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",children:[e.author&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nr,{author:e.author,basePath:t}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"})]}),jsxRuntime.jsx("time",{dateTime:e.publishedAt,className:"font-medium","aria-label":`Published ${n}`,children:n}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:o})]}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed sm:text-base",children:e.excerpt}),(e.topics??[]).length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:(e.topics??[]).map(s=>jsxRuntime.jsx(rr,{topic:s,basePath:t},s.id))})]})]}),jsxRuntime.jsxs("div",{className:"hidden items-start gap-6 lg:flex xl:gap-8",children:[i&&jsxRuntime.jsx(te__default.default,{href:r,className:"focus-visible:ring-ring relative block aspect-[16/10] w-64 shrink-0 overflow-hidden rounded-2xl bg-[var(--blog-accent-bg)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none xl:w-72","aria-label":`Read article: ${e.title}`,children:jsxRuntime.jsx(At__default.default,{src:i,alt:e.featuredImageAlt??`Featured image for ${e.title}`,width:288,height:180,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"flex min-h-[180px] flex-1 flex-col justify-between space-y-4 xl:min-h-[200px]",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(te__default.default,{href:r,className:"focus-visible:ring-ring block rounded-md hover:no-underline focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",children:jsxRuntime.jsx("h2",{className:"text-2xl leading-tight font-bold text-balance transition-colors group-hover:text-[var(--blog-accent)] xl:text-3xl",children:e.title})}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-base leading-relaxed xl:text-lg",children:e.excerpt}),(e.topics??[]).length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:(e.topics??[]).map(s=>jsxRuntime.jsx(rr,{topic:s,basePath:t},s.id))})]}),jsxRuntime.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",children:[e.author&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(nr,{author:e.author,basePath:t}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"})]}),jsxRuntime.jsx("time",{dateTime:e.publishedAt,className:"font-medium","aria-label":`Published ${n}`,children:n}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:o})]})]})]})]})}function rr({topic:e,basePath:t}){let r="rounded-full border border-[var(--blog-accent-border)] px-2.5 py-1 text-xs font-medium text-[var(--blog-text-accent)] transition-colors hover:border-[var(--blog-text-accent)] hover:text-[var(--blog-text-accent-hover)]",n=e.slug.trim();return n?jsxRuntime.jsx(te__default.default,{href:P(t,`topics/${n}`),className:r,children:e.name}):jsxRuntime.jsx("span",{className:r,children:e.name})}function nr({author:e,basePath:t}){return jsxRuntime.jsxs(te__default.default,{href:E(t,e.slug),className:"inline-flex items-center gap-2 font-medium transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx(Cn,{author:e,size:"sm"}),e.name]})}function Cn({author:e,size:t}){let r=t==="md"?"h-9 w-9 text-sm":"h-6 w-6 text-xs",n=Ln(e.name);return e.avatarUrl?jsxRuntime.jsx(At__default.default,{src:e.avatarUrl,alt:e.name,width:t==="md"?36:24,height:t==="md"?36:24,className:f("shrink-0 rounded-full object-cover",r),loading:"lazy"}):jsxRuntime.jsx("span",{className:f("bg-muted inline-flex shrink-0 items-center justify-center rounded-full font-medium",r),"aria-hidden":"true",children:n})}function Ln(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function kn(e,t,r,n,o="/blog"){let i=e?`${e} - Blog`:"Blog",s=n&&n.currentPage>1?`${i} - Page ${n.currentPage}`:i,l=t??"Read our latest articles and insights.",a=_(o)||"/",u=r?`${r}${n&&n.currentPage>1?`${a}?page=${n.currentPage}`:a}`:void 0,m=n&&n.currentPage>1&&r?`${r}${n.currentPage===2?a:`${a}?page=${n.currentPage-1}`}`:void 0,c=n&&n.currentPage<n.totalPages&&r?`${r}${a}?page=${n.currentPage+1}`:void 0;return {title:s,description:l,openGraph:{title:s,description:l,type:"website",...r&&{url:u}},twitter:{card:"summary_large_image",title:s,description:l},alternates:{...u&&{canonical:u}},other:{...m&&{prev:m},...c&&{next:c}}}}var Bn=classVarianceAuthority.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Oe({className:e,variant:t,...r}){return jsxRuntime.jsx("div",{className:f(Bn({variant:t}),e),...r})}function Me({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card",className:f("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function En({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-header",className:f("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function On({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-title",className:f("leading-none font-semibold",e),...t})}function Mn({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-description",className:f("text-muted-foreground text-sm",e),...t})}function $e({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-content",className:f("px-6",e),...t})}function $n({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-footer",className:f("flex items-center px-6 [.border-t]:pt-6",e),...t})}function Fn(e,t){try{return new URL(e).href}catch{if(!t)return e}try{return new URL(e,t).href}catch{return e}}async function sr(e,t=globalThis.navigator?.clipboard,r=typeof document>"u"?void 0:document){if(t)try{await t.writeText(e);return}catch{}if(!r)throw new Error("Clipboard API is unavailable");let n=r.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style.position="fixed",n.style.left="-9999px",r.body.appendChild(n),n.select();try{if(!r.execCommand("copy"))throw new Error("Copy command failed")}finally{n.remove();}}async function jn(e,t=globalThis.navigator){return t?.share?(await t.share({title:e.title,url:e.url}),"shared"):(await sr(e.url,t?.clipboard),"copied")}function Qe({title:e,url:t,className:r,size:n="md"}){let[o,i]=Ye__namespace.default.useState(false),[s,l]=Ye__namespace.default.useState(false),a=Ye__namespace.default.useMemo(()=>Fn(t,typeof window>"u"?void 0:window.location.href),[t]);Ye__namespace.default.useEffect(()=>{if(!o)return;let h=window.setTimeout(()=>i(false),2e3);return ()=>window.clearTimeout(h)},[o]);async function u(){await sr(a),i(true);}async function m(){l(true);try{await jn({title:e,url:a})==="copied"&&i(!0);}finally{l(false);}}let c=n==="sm"?"h-8 gap-1.5 px-2.5 text-xs":"h-9 gap-2 px-3 text-sm",g=n==="sm"?"size-3.5":"size-4";return jsxRuntime.jsxs("div",{className:f("article-top-actions flex flex-wrap items-center justify-center gap-2",r),children:[jsxRuntime.jsxs("button",{type:"button","aria-label":"Copy article link",onClick:u,className:f("text-muted-foreground hover:text-foreground border-border inline-flex items-center justify-center rounded-full border font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",c),children:[o?jsxRuntime.jsx(lucideReact.Check,{className:g,"aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Copy,{className:g,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:o?"Copied":"Copy link"})]}),jsxRuntime.jsxs("button",{type:"button","aria-label":"Share article",onClick:m,disabled:s,className:f("text-muted-foreground hover:text-foreground border-border inline-flex items-center justify-center rounded-full border font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)] disabled:cursor-wait disabled:opacity-60",c),children:[jsxRuntime.jsx(lucideReact.Share2,{className:g,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:"Share"})]})]})}function lr({alt:e="",className:t,src:r,...n}){if(typeof r!="string"||r.length===0)return jsxRuntime.jsx("img",{alt:e,className:t,...n});let o=`blog-image-preview-${zn(r)}`,i=Gn(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("a",{href:`#${o}`,className:"group mx-auto block cursor-zoom-in rounded-2xl focus-visible:ring-2 focus-visible:ring-[var(--blog-text-accent)] focus-visible:ring-offset-2 focus-visible:outline-none","aria-label":e?`Expand image: ${e}`:"Expand article image",children:jsxRuntime.jsx("img",{src:r,alt:e,className:f("mx-auto rounded-2xl border border-[var(--blog-accent-border)] shadow-[0_18px_60px_rgb(168_85_247_/_0.12)] transition-opacity group-hover:opacity-95",t),...n})}),jsxRuntime.jsxs("div",{id:o,className:"invisible fixed inset-0 z-50 flex opacity-0 transition-opacity target:visible target:opacity-100",role:"dialog","aria-modal":"true","aria-label":e?`Image preview: ${e}`:"Image preview",children:[jsxRuntime.jsx("a",{href:"#article-content",className:"absolute inset-0 bg-black/85 backdrop-blur-sm","aria-label":"Close image preview"}),jsxRuntime.jsx("div",{className:"pointer-events-none relative z-10 flex min-h-screen w-full items-center justify-center p-4 sm:p-6",children:jsxRuntime.jsx("img",{src:i,alt:e,className:"pointer-events-auto h-[88vh] w-[94vw] rounded-3xl object-contain shadow-2xl"})}),jsxRuntime.jsx("a",{href:"#article-content",className:"absolute top-4 right-4 z-20 inline-flex size-10 items-center justify-center rounded-full border border-white/20 bg-black/50 text-xl leading-none text-white no-underline transition-colors hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-white focus-visible:outline-none","aria-label":"Close image preview",children:"\xD7"})]})]})}function Gn(e){if(!e.includes("/cdn-cgi/image/"))return e;try{let t=new URL(e),r=t.pathname.split("/"),n=r.findIndex(o=>o==="image");return n===-1||r[n-1]!=="cdn-cgi"||!r[n+1]?e:(r[n+1]="width=1600,quality=90,format=webp",t.pathname=r.join("/"),t.toString())}catch{return e}}function zn(e){let t=0;for(let r=0;r<e.length;r+=1)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t).toString(36)}function wt({items:e,contentId:t,variant:r,showProgress:n=true}){let o=e[0]?.id??null,i=Ye.useMemo(()=>e.map(s=>s.id),[e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Wn,{contentId:t,itemIds:i}),n&&jsxRuntime.jsx("div",{"data-blog-reading-progress":t,className:"fixed inset-x-0 top-0 z-50 h-1 origin-left bg-[var(--blog-accent)] motion-safe:transition-transform",style:{transform:"scaleX(0)"},role:"progressbar","aria-label":"Reading progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0,suppressHydrationWarning:true}),jsxRuntime.jsx(Jn,{items:e,activeItemId:o,variant:r})]})}function Wn({contentId:e,itemIds:t}){return Ye.useEffect(()=>{let r=0,n=decodeURIComponent(window.location.hash.replace(/^#/,"")),o=a=>{let u=Array.from(document.querySelectorAll("[data-blog-toc-link]"));for(let m of u){let c=m.getAttribute("data-blog-toc-link")===a;m.setAttribute("data-active",c?"true":"false"),c?m.setAttribute("aria-current","location"):m.removeAttribute("aria-current");}},i=()=>{let a=document.getElementById(e);if(!a)return;let u=Array.from(document.querySelectorAll(`[data-blog-reading-progress="${e}"]`)),m=a.getBoundingClientRect(),c=window.scrollY,g=m.top+c,h=a.offsetHeight-window.innerHeight,p=h<=0?c>=g?100:0:(c-g)/h*100,b=Kn(p);for(let S of u)S.style.transform=`scaleX(${b/100})`,S.setAttribute("aria-valuenow",String(Math.round(b)));let A=t.map(S=>document.getElementById(S)).filter(S=>!!S);if(n&&t.includes(n)){o(n),n="";return}let I=Math.max(160,Math.round(window.innerHeight*.33)),T=A.filter(S=>S.getBoundingClientRect().top<=I).at(-1)??A[0]??null;o(T?T.id:null);},s=()=>{window.cancelAnimationFrame(r),r=window.requestAnimationFrame(i);},l=()=>{n=decodeURIComponent(window.location.hash.replace(/^#/,"")),s();};return s(),window.addEventListener("scroll",s,{passive:true}),window.addEventListener("resize",s),window.addEventListener("hashchange",l),()=>{window.cancelAnimationFrame(r),window.removeEventListener("scroll",s),window.removeEventListener("resize",s),window.removeEventListener("hashchange",l);}},[e,t]),null}function Kn(e){return Number.isFinite(e)?Math.min(100,Math.max(0,e)):0}function Jn({items:e,activeItemId:t,variant:r}){if(e.length===0)return null;let n=jsxRuntime.jsx("ul",{className:"space-y-2 text-sm",children:e.map(o=>{let i=tr(o.id,t);return jsxRuntime.jsx("li",{className:o.level===3?"pl-4":void 0,children:jsxRuntime.jsx("a",{href:`#${o.id}`,"aria-current":i.ariaCurrent,"data-blog-toc-link":o.id,"data-active":i.isActive?"true":"false",suppressHydrationWarning:true,className:"text-muted-foreground hover:text-[var(--blog-text-accent)] data-[active=true]:border-[var(--blog-accent)] data-[active=true]:text-[var(--blog-text-accent)] block border-l-2 border-transparent pl-3 leading-snug transition-colors",children:o.text})},o.id)})});return r==="mobile"?jsxRuntime.jsxs("details",{className:"group mb-6 rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] lg:hidden",children:[jsxRuntime.jsxs("summary",{className:"text-foreground flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold [&::-webkit-details-marker]:hidden",children:[jsxRuntime.jsx("span",{children:"On this page"}),jsxRuntime.jsxs("span",{className:"text-muted-foreground flex items-center gap-2 text-xs font-medium",children:[er(e.length),jsxRuntime.jsx("span",{className:"text-[var(--blog-text-accent)] transition-transform group-open:rotate-180","aria-hidden":"true",children:"\u2193"})]})]}),jsxRuntime.jsx("nav",{"aria-label":"Table of contents",className:"border-t border-[var(--blog-accent-border)] px-4 py-4",children:n})]}):jsxRuntime.jsx("aside",{className:"hidden lg:block",children:jsxRuntime.jsxs("nav",{"aria-label":"Table of contents",className:"sticky top-24 max-h-[calc(100vh-8rem)] overflow-y-auto border-l border-border pl-5",children:[jsxRuntime.jsx("p",{className:"text-muted-foreground mb-3 text-xs font-semibold tracking-wider uppercase",children:"On this page"}),n]})})}var fe=Ye__namespace.forwardRef(({className:e,orientation:t="horizontal",decorative:r=true,...n},o)=>jsxRuntime.jsx(Nt__namespace.Root,{ref:o,decorative:r,orientation:t,className:f("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));fe.displayName=Nt__namespace.Root.displayName;var ii=ei.defaultSchema.attributes?.["*"]??[],oi=ei.defaultSchema.attributes?.a??[],si=ei.defaultSchema.attributes?.img??[],ai={...ei.defaultSchema,tagNames:[...ei.defaultSchema.tagNames??[],"figure","figcaption"],attributes:{...ei.defaultSchema.attributes,"*":[...ii,"className"],a:[...oi,"className","href","target","rel","title"],img:[...si,"className","src","alt","title","width","height","loading"],figure:["className"],figcaption:["className"],span:["className"]},protocols:{...ei.defaultSchema.protocols,href:["http","https","mailto","tel"],src:["http","https"]}},ur={mdxOptions:{format:"md",remarkPlugins:[ri__default.default,ti__default.default],rehypePlugins:[Zn__default.default,[ei__default.default,ai],li,ni__default.default]}};function li(){return e=>{dr(e);}}function dr(e){e.children&&(e.children=e.children.flatMap(t=>(dr(t),ci(t)?t.children?.filter(Tt)??[t]:[t])));}function ci(e){if(e.type!=="element"||e.tagName!=="p"||!e.children)return false;let t=e.children.filter(Tt);return t.length===1&&ui(t[0])}function ui(e){if(e?.type!=="element")return false;if(e.tagName==="img")return true;if(e.tagName!=="a"||!e.children)return false;let t=e.children.filter(Tt);return t.length===1&&t[0]?.tagName==="img"}function Tt(e){return e.type!=="text"||!!e.value?.trim()}function Rt({article:e,basePath:t="/blog",className:r}){let n=e.series;return n?jsxRuntime.jsxs("section",{"aria-labelledby":"article-series-title",className:f("rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] p-5 sm:p-6",r),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-5 md:flex-row md:items-start md:justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("p",{className:"text-muted-foreground text-sm font-medium",children:["Part ",n.position," of ",n.total]}),jsxRuntime.jsx("h2",{id:"article-series-title",className:"text-xl font-semibold",children:jsxRuntime.jsx(te__default.default,{href:se(t,n.slug),className:"transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:n.title})}),n.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground max-w-2xl leading-relaxed",children:n.description})]}),(n.previous??n.next)&&jsxRuntime.jsxs("div",{className:"grid shrink-0 gap-2 sm:grid-cols-2 md:min-w-64 md:grid-cols-1",children:[n.previous&&jsxRuntime.jsxs(te__default.default,{href:P(t,n.previous.slug),className:"rounded-xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] px-3 py-2 text-sm transition-colors hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground block text-xs",children:"Previous"}),jsxRuntime.jsx("span",{className:"line-clamp-2 font-medium",children:n.previous.title})]}),n.next&&jsxRuntime.jsxs(te__default.default,{href:P(t,n.next.slug),className:"rounded-xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] px-3 py-2 text-sm transition-colors hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground block text-xs",children:"Next"}),jsxRuntime.jsx("span",{className:"line-clamp-2 font-medium",children:n.next.title})]})]})]}),n.articles.length>0&&jsxRuntime.jsx("ol",{className:"mt-5 grid gap-2",children:n.articles.map(o=>jsxRuntime.jsx("li",{children:jsxRuntime.jsxs(te__default.default,{href:P(t,o.slug),"aria-current":o.isCurrent?"page":void 0,className:f("hover:bg-background/60 flex gap-3 rounded-xl px-3 py-2 text-sm transition-colors hover:no-underline",o.isCurrent&&"bg-background/70"),children:[jsxRuntime.jsx("span",{className:"text-muted-foreground shrink-0 tabular-nums",children:o.position}),jsxRuntime.jsx("span",{className:f("line-clamp-2",o.isCurrent?"font-semibold text-[var(--blog-text-accent)]":"font-medium"),children:o.title})]})},o.id))})]}):null}function Ct(e,t,r={}){let n=r.limit??3;if(n<=0)return [];let o=mr(e),i=di(e,t),s=(m,c)=>gr(c)-gr(m)||pr(m).localeCompare(pr(c)),l=o?i.filter(m=>mr(m)===o).sort(s):[],a=new Set(l.map(m=>m.id)),u=i.filter(m=>!a.has(m.id)).sort(s);return [...l,...u].slice(0,n)}function di(e,t){let r=new Set,n=new Set,o=[];for(let i of t)i.id===e.id||i.slug===e.slug||r.has(i.id)||n.has(i.slug)||(r.add(i.id),n.add(i.slug),o.push(i));return o}function mr(e){let t=e.topics??[];return t.find(r=>r.isPrimary)?.slug??t[0]?.slug??null}function gr(e){let t=Date.parse(e.publishedAt??e.updatedAt??"");return Number.isFinite(t)?t:0}function pr(e){return e.title??e.slug}function hi(e){return `${Math.ceil(e/60)} min read`}function bi(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function xi({creditText:e,creditUrl:t}){if(!e&&!t)return null;let r=e??bi(t??"");return jsxRuntime.jsxs("span",{children:["Credit:"," ",t?jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 transition-colors hover:text-[var(--blog-text-accent)]",children:r}):r]})}function vr({article:e,className:t,navigation:r,basePath:n="/blog",theme:o,postArticleCta:i,newsletter:s,newsletterPreviewMode:l=false,articles:a=[],relatedArticles:u=[],showShareLinks:m=true}){let c=_(n)||"/",g=yt(e.publishedAt,e.updatedAt),h=hi(e.readingSeconds),p=vt(e.content),b=e.meta.canonicalUrl??P(c,e.slug),A=s??e.site.newsletter,I=i??e.cta,T=e.featuredImage,S=!!(e.featuredImageCaption??e.featuredImageCreditText??e.featuredImageCreditUrl),U=u.length>0?u.slice(0,3):Ct(e,a);return jsxRuntime.jsxs("article",{style:H(o),className:f("article-page mx-auto max-w-6xl px-4 py-6 pb-12 sm:px-6 sm:py-8 sm:pb-16 lg:px-8 lg:py-12 lg:pb-24",t),children:[r?.backToHome&&jsxRuntime.jsx("header",{className:"mx-auto mb-8 max-w-4xl sm:mb-12 lg:mb-16",children:jsxRuntime.jsxs(te__default.default,{href:r.backToHome.url,className:"text-muted-foreground group focus-visible:ring-ring inline-flex touch-manipulation items-center space-x-2 rounded-md px-2 py-1 transition-colors hover:text-[var(--blog-accent)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none sm:space-x-3","aria-label":r.backToHome.label??"Return to blog",children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"h-4 w-4 transition-transform group-hover:-translate-x-1 sm:h-5 sm:w-5","aria-hidden":"true"}),jsxRuntime.jsxs("span",{className:"text-sm font-medium sm:text-base",children:[jsxRuntime.jsx("span",{className:"hidden sm:inline",children:r.backToHome.label??"Back to all articles"}),jsxRuntime.jsx("span",{className:"sm:hidden",children:"Back"})]})]})}),jsxRuntime.jsx("style",{children:`
|
|
1
|
+
'use strict';var re=require('next/link.js'),Et=require('next/image.js'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),lucideReact=require('lucide-react'),reactSlot=require('@radix-ui/react-slot'),classVarianceAuthority=require('class-variance-authority'),jsxRuntime=require('react/jsx-runtime'),dateFns=require('date-fns'),tt=require('react'),rsc=require('next-mdx-remote-client/rsc'),fa6=require('react-icons/fa6'),$t=require('@radix-ui/react-separator'),No=require('rehype-raw'),To=require('rehype-sanitize'),Ro=require('remark-gfm'),Co=require('remark-toc'),Lo=require('rehype-slug'),crypto=require('crypto'),ratelimit=require('@upstash/ratelimit'),redis=require('@upstash/redis'),drizzleOrm=require('drizzle-orm'),sqliteCore=require('drizzle-orm/sqlite-core'),server_js=require('next/server.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var re__default=/*#__PURE__*/_interopDefault(re);var Et__default=/*#__PURE__*/_interopDefault(Et);var tt__namespace=/*#__PURE__*/_interopNamespace(tt);var $t__namespace=/*#__PURE__*/_interopNamespace($t);var No__default=/*#__PURE__*/_interopDefault(No);var To__default=/*#__PURE__*/_interopDefault(To);var Ro__default=/*#__PURE__*/_interopDefault(Ro);var Co__default=/*#__PURE__*/_interopDefault(Co);var Lo__default=/*#__PURE__*/_interopDefault(Lo);function p(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var qe=classVarianceAuthority.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function gi({className:e,variant:t,size:r,asChild:i=false,...n}){return jsxRuntime.jsx(i?reactSlot.Slot:"button",{"data-slot":"button",className:p(qe({variant:t,size:r,className:e})),...n})}function ft({className:e,...t}){return jsxRuntime.jsx("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:p("mx-auto flex w-full justify-center",e),...t})}function ht({className:e,...t}){return jsxRuntime.jsx("ul",{"data-slot":"pagination-content",className:p("flex flex-row items-center gap-1",e),...t})}function oe({...e}){return jsxRuntime.jsx("li",{"data-slot":"pagination-item",...e})}function pe({className:e,isActive:t,size:r="icon",...i}){return jsxRuntime.jsx("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:p(qe({variant:t?"outline":"ghost",size:r}),e),...i})}function bt({className:e,...t}){return jsxRuntime.jsxs(pe,{"aria-label":"Go to previous page",size:"default",className:p("gap-1 px-2.5 sm:pl-2.5",e),...t,children:[jsxRuntime.jsx(lucideReact.ChevronLeftIcon,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Previous"})]})}function xt({className:e,...t}){return jsxRuntime.jsxs(pe,{"aria-label":"Go to next page",size:"default",className:p("gap-1 px-2.5 sm:pr-2.5",e),...t,children:[jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Next"}),jsxRuntime.jsx(lucideReact.ChevronRightIcon,{})]})}function Xe({className:e,...t}){return jsxRuntime.jsxs("span",{"aria-hidden":true,"data-slot":"pagination-ellipsis",className:p("flex size-9 items-center justify-center",e),...t,children:[jsxRuntime.jsx(lucideReact.MoreHorizontalIcon,{className:"size-4"}),jsxRuntime.jsx("span",{className:"sr-only",children:"More pages"})]})}function Pe({currentPage:e,totalPages:t,baseUrl:r,className:i,maxVisiblePages:n=5,showPrevNext:o=true,showFirstLast:s=true}){if(t<=1)return null;let l=()=>{let f=Math.floor(n/2),g=Math.max(1,e-f),b=Math.min(t,g+n-1);return b-g+1<n&&(g=Math.max(1,b-n+1)),{start:g,end:b}},{start:a,end:u}=l(),c=Array.from({length:u-a+1},(f,g)=>a+g),d=f=>f===1?r:`${r}?page=${f}`,h=e>1,y=e<t;return jsxRuntime.jsxs(ft,{className:i,children:[jsxRuntime.jsxs(ht,{children:[s&&e>2&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(oe,{children:jsxRuntime.jsx(pe,{href:d(1),"aria-label":"Go to first page",children:jsxRuntime.jsx(lucideReact.ChevronsLeft,{className:"h-4 w-4"})})}),a>2&&jsxRuntime.jsx(oe,{children:jsxRuntime.jsx(Xe,{})})]}),o&&jsxRuntime.jsx(oe,{children:h?jsxRuntime.jsx(bt,{href:d(e-1)}):jsxRuntime.jsx("span",{className:"flex h-9 items-center justify-center gap-1 px-2.5 text-muted-foreground sm:pl-2.5",children:jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Previous"})})}),c.map(f=>jsxRuntime.jsx(oe,{children:jsxRuntime.jsx(pe,{href:d(f),isActive:f===e,children:f})},f)),o&&jsxRuntime.jsx(oe,{children:y?jsxRuntime.jsx(xt,{href:d(e+1)}):jsxRuntime.jsx("span",{className:"flex h-9 items-center justify-center gap-1 px-2.5 text-muted-foreground sm:pr-2.5",children:jsxRuntime.jsx("span",{className:"hidden sm:block",children:"Next"})})}),s&&e<t-1&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[u<t-1&&jsxRuntime.jsx(oe,{children:jsxRuntime.jsx(Xe,{})}),jsxRuntime.jsx(oe,{children:jsxRuntime.jsx(pe,{href:d(t),"aria-label":"Go to last page",children:jsxRuntime.jsx(lucideReact.ChevronsRight,{className:"h-4 w-4"})})})]})]}),jsxRuntime.jsxs("div",{className:"sr-only","aria-live":"polite",children:["Page ",e," of ",t]})]})}function Pi(e,t=10){let r=e.page,i=Array.isArray(r)?r[0]:r,n=Math.max(1,parseInt(i??"1",10)),o=(n-1)*t;return {currentPage:n,itemsPerPage:t,offset:o,calculateTotalPages:l=>Math.ceil(l/t)}}function Ai(e,t,r,i){let n=i?`${i}${e===1?r:`${r}?page=${e}`}`:void 0,o=e>1&&i?`${i}${e===2?r:`${r}?page=${e-1}`}`:void 0,s=e<t&&i?`${i}${r}?page=${e+1}`:void 0;return {alternates:{...n&&{canonical:n}},other:{...o&&{prev:o},...s&&{next:s}}}}function k(e="/blog"){let t=e.trim();return !t||t==="/"?"":t.replace(/^(?!\/)/,"/").replace(/\/+$/,"")}function v(e,t){let r=k(e),i=t?.replace(/^\/+/,"").replace(/\/+$/,"");return i?`${r}/${i}`.replace(/\/+/g,"/"):r||"/"}function B(e,t){return v(e,`authors/${t}`)}function le(e,t){return v(e,`series/${t}`)}function wi(e){let t=new URL(e);return k(t.pathname)}var lr=/^[A-Za-z0-9_-]{11}$/,Si=/^PT(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+(?:\.\d+)?S)?$/,Ni=/^\d{4}-\d{2}-\d{2}(?:$|T)/,Ti=new Set(["youtube.com","www.youtube.com","m.youtube.com","music.youtube.com","youtube-nocookie.com","www.youtube-nocookie.com","youtu.be"]),Ri=["embed","shorts","live","v"],vt=200,Pt=5e3;function W(e){return typeof e=="string"&&lr.test(e)}function cr(e){return typeof e=="string"&&e!=="PT"&&Si.test(e)}function Ci(e){if(typeof e!="string"||!Ni.test(e))return false;let t=e.slice(0,10),r=new Date(`${t}T00:00:00Z`);return !Number.isNaN(r.getTime())&&r.toISOString().slice(0,10)===t&&!Number.isNaN(Date.parse(e))}function Li(e){let t=e.trim();if(lr.test(t))return t;if(!t)return null;let r;try{r=new URL(/^https?:\/\//i.test(t)?t:`https://${t}`);}catch{return null}let i=r.hostname.toLowerCase();if(!Ti.has(i))return null;let n=r.pathname.split("/").filter(Boolean),o;return i==="youtu.be"?o=n[0]:n[0]==="watch"?o=r.searchParams.get("v"):n[0]&&Ri.includes(n[0])&&(o=n[1]),W(o)?o:null}function At(e){if(!e||typeof e!="object"||Array.isArray(e))return ["Article video must be an object"];let t=e,r=[];return t.provider!=="youtube"&&r.push('Article video provider must be "youtube"'),W(t.id)||r.push("Article video id must be an 11-character YouTube id"),typeof t.title!="string"||!t.title.trim()?r.push("Article video title is required"):t.title.length>vt&&r.push(`Article video title must be ${vt} characters or fewer`),Ci(t.uploadDate)||r.push("Article video uploadDate must be an ISO 8601 date"),t.duration!==void 0&&!cr(t.duration)&&r.push("Article video duration must be an ISO 8601 duration such as PT4M13S"),t.verticalId!==void 0&&!W(t.verticalId)&&r.push("Article video verticalId must be an 11-character YouTube id"),t.description!==void 0&&(typeof t.description!="string"?r.push("Article video description must be a string"):t.description.length>Pt&&r.push(`Article video description must be ${Pt} characters or fewer`)),r}function We(e){if(!W(e))throw new Error("Invalid YouTube video id")}function wt(e){return We(e),`https://www.youtube-nocookie.com/embed/${e}?rel=0&autoplay=1`}function St(e){return We(e),`https://www.youtube.com/embed/${e}`}function Nt(e){return We(e),`https://www.youtube.com/watch?v=${e}`}function Tt(e){return We(e),`https://i.ytimg.com/vi/${e}/hqdefault.jpg`}function Ke(e,t={}){let{customDomain:r,pathPrefix:i="/blog",language:n,isAccessibleForFree:o=true,includeOptionalProperties:s=true}=t,l=r??e.site.domain,a=r?`https://${l}${i}/${e.slug}`:e.meta.canonicalUrl??`https://${l}${i}/${e.slug}`,u=e.author?Je(e.author,{customDomain:r,pathPrefix:i}):void 0,c=Rt(e.site,{customDomain:r,pathPrefix:i}),h=`PT${Math.max(1,Math.ceil(e.readingSeconds/60))}M`,y={"@context":"https://schema.org","@type":"BlogPosting","@id":`${a}#article`,headline:e.title,description:e.excerpt,datePublished:e.publishedAt,dateModified:e.updatedAt,author:u,publisher:c,mainEntityOfPage:{"@type":"WebPage","@id":a},wordCount:e.wordCount,timeRequired:h,isAccessibleForFree:o},f=ur(e);if(f&&(y.video=f),s){e.featuredImage&&(y.image=e.featuredImage),e.meta.keywords.length>0&&(y.keywords=[...e.meta.keywords]),(n??e.site.locale)&&(y.inLanguage=n??e.site.locale);let g=[...(e.topics??[]).map(b=>b.name),...e.series?[e.series.title]:[]];g.length&&(y.about=[...new Set(g)].map(b=>({"@type":"Thing",name:b})));}return y}function ur(e){let t=e.video;if(!t||!W(t.id))return;let r=t.description?.trim()??"";return {"@type":"VideoObject",name:t.title,description:r.length>0?r:e.excerpt,thumbnailUrl:[Tt(t.id),...e.featuredImage?[e.featuredImage]:[]],uploadDate:t.uploadDate,...t.duration&&{duration:t.duration},embedUrl:St(t.id)}}function Je(e,t={}){let{customDomain:r,pathPrefix:i="/blog"}=t,n={"@context":"https://schema.org","@type":"Person","@id":`#author-${e.id}`,name:e.name,identifier:e.id};e.bio&&(n.description=e.bio),e.avatarUrl&&(n.image=e.avatarUrl);let o=[e.socialLinks?.website,e.socialLinks?.x,e.socialLinks?.linkedin,e.socialLinks?.github].filter(s=>!!s);if(o.length>0&&(n.sameAs=o),e.slug?.trim()){let s=r?`https://${r}${B(i,e.slug)}`:B(i,e.slug);n.url=s;}return e.isGuest&&(n.additionalType="GuestAuthor"),e.expertise?.length&&(n.knowsAbout=[...e.expertise]),n}function Rt(e,t={}){let{customDomain:r,pathPrefix:i="/blog"}=t,o=`https://${r??e.domain}${i}`,s={"@context":"https://schema.org","@type":"Organization","@id":`${o}#organization`,name:e.name,url:o};return e.description?.trim()&&(s.description=e.description),e.tagline?.trim()&&(s.description=s.description?`${s.description}. ${e.tagline}`:e.tagline),s}function Ct(e,t={}){let{customDomain:r,pathPrefix:i="/blog",language:n,includeSearchAction:o=true}=t,l=`https://${r??e.domain}${i}`,a=Rt(e,t),u={"@context":"https://schema.org","@type":"WebSite","@id":`${l}#website`,name:e.name,url:l,publisher:a};return e.description?.trim()&&(u.description=e.description),(n??e.locale)&&(u.inLanguage=n??e.locale),o&&(u.potentialAction={"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:`${l}?search={search_term_string}`},"query-input":"required name=search_term_string"}),u}function Ye(e,t={}){let{customDomain:r}=t;return {"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((i,n)=>({"@type":"ListItem",position:n+1,name:i.name,item:r&&!i.url.startsWith("http")?`https://${r}${i.url}`:i.url}))}}function Lt(e,t={}){let r=[];r.push(Ke(e,t)),r.push(Ct(e.site,t));let i=t.pathPrefix??"/blog",n=[{name:"Home",url:"/"},{name:e.site.name,url:i},{name:e.title,url:`${i}/${e.slug}`}];return r.push(Ye(n,t)),r}function _t(e,t=[],r={}){let i=[];if(i.push(Ct(e,r)),t.length>0){let n=t.slice(0,5).map(o=>Ke(o,r));i.push(...n);}return i}function dr(e){let t=[];if(e["@context"]?e["@context"]!=="https://schema.org"&&t.push("@context must be 'https://schema.org'"):t.push("Missing required @context property"),e["@type"]||t.push("Missing required @type property"),e["@type"]==="BlogPosting"){let r=e;r.headline||t.push("BlogPosting: Missing required headline"),r.datePublished||t.push("BlogPosting: Missing required datePublished"),r.author||t.push("BlogPosting: Missing required author"),r.publisher||t.push("BlogPosting: Missing required publisher");}return e["@type"]==="Person"&&(e.name||t.push("Person: Missing required name")),e["@type"]==="Organization"&&(e.name||t.push("Organization: Missing required name")),{isValid:t.length===0,errors:t}}function Qe(e){return JSON.stringify(e,null,0).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ge(e){return {type:"application/ld+json",dangerouslySetInnerHTML:{__html:Qe(e)}}}function _i(e){let t=new Set;return e.meta.keywords.forEach(r=>t.add(r)),e.site.toneAdjectives.forEach(r=>t.add(r)),e.author&&e.author.toneAdjectives.forEach(r=>t.add(r)),Array.from(t)}var Be=class extends Error{constructor(r,i,n){super(r);this.code=i;this.details=n;this.name="StructuredDataError";}code;details};function ki(e,t={}){try{let r=Ke(e,t),i=dr(r);return i.isValid?{schema:r}:{error:new Be("Generated schema validation failed","VALIDATION_FAILED",i.errors)}}catch(r){return {error:new Be("Failed to generate structured data","GENERATION_FAILED",r)}}}var D="bg-linear-to-br from-[var(--blog-accent-hover)] via-[var(--blog-text-accent)] to-fuchsia-200 bg-clip-text text-transparent",Ae={accentColor:"hsl(var(--primary))",accentHoverColor:"hsl(var(--primary))",textAccentColor:"hsl(var(--primary))",textAccentHoverColor:"hsl(var(--primary))",accentBackgroundColor:"hsl(var(--primary) / 0.08)",accentBorderColor:"hsl(var(--primary) / 0.25)"};function $(e={}){return {"--blog-accent":e.accentColor??Ae.accentColor,"--blog-accent-hover":e.accentHoverColor??Ae.accentHoverColor,"--blog-text-accent":e.textAccentColor??e.accentColor??Ae.textAccentColor,"--blog-text-accent-hover":e.textAccentHoverColor??e.accentHoverColor??Ae.textAccentHoverColor,"--blog-accent-bg":e.accentBackgroundColor??Ae.accentBackgroundColor,"--blog-accent-border":e.accentBorderColor??Ae.accentBorderColor}}function kt(e,t){let r=new Date(e),i=new Date(t);return {publishedDateLabel:dateFns.format(r,"d MMMM yyyy"),publishedRelativeLabel:dateFns.formatDistanceToNow(r,{addSuffix:true}),updatedDateLabel:dateFns.format(i,"d MMMM yyyy"),isUpdated:i.getTime()!==r.getTime()}}function It(e){let t=[],r=false;for(let i of e.split(`
|
|
2
|
+
`)){if(/^\s*```/.test(i)){r=!r;continue}if(r)continue;let n=/^(#{2,3})\s+(.+?)\s*#*\s*$/.exec(i);if(!n?.[1]||!n[2])continue;let o=Bi(n[2]);o&&t.push({id:Ei(o),text:o,level:n[1].length});}return t}function pr(e){return `${e} ${e===1?"section":"sections"}`}function gr(e,t){let r=e===t;return {isActive:r,ariaCurrent:r?"location":void 0}}function Bi(e){return e.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`~]/g,"").replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim()}function Ei(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-")}var et="Thanks, you're on the list. We'll confirm before sending updates.";function Ee({siteId:e,settings:t,sourceSurface:r,sourceArticleSlug:i,sourceUrl:n,previewMode:o=false,className:s}){let[l,a]=tt.useState(null),[u,c]=tt.useState(null),[d,h]=tt.useState(false),[y,f]=tt.useState(false),g=Hi(e),b=tt.useSyncExternalStore(Fi,()=>Vi(g),()=>false),T=d||!o&&b;async function I(S){S.preventDefault(),c(null),a(null);let E=new FormData(S.currentTarget),X=Bt(E,"company");if(o){a(et),h(true),S.currentTarget.reset();return}f(true);try{let j=await fetch(`${t.captureBaseUrl.replace(/\/$/,"")}/api/newsletter/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteId:Number(e),publicSubscribeToken:t.publicSubscribeToken,email:Bt(E,"email"),name:Ui(E,"name"),sourceSurface:r,sourceUrl:Di(n),sourceArticleSlug:i??null,honeypot:X})});if(!j.ok)throw new Error("Newsletter signup failed.");let gt=await j.json().catch(()=>null),ci=Gi(gt)??et;ji(g),a(ci),h(!0),S.currentTarget.reset();}catch{a(null),c("Newsletter signup failed. Please try again.");}finally{f(false);}}return jsxRuntime.jsx("section",{className:p("border-y border-[var(--blog-accent-border)] py-5 sm:py-6",s),"aria-labelledby":`newsletter-${r}-title`,children:jsxRuntime.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,0.9fr)_minmax(0,1.4fr)] lg:items-end",children:[jsxRuntime.jsxs("div",{className:"max-w-xl space-y-1",children:[jsxRuntime.jsx("h2",{id:`newsletter-${r}-title`,className:"text-base leading-6 font-semibold",children:t.title}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm leading-6",children:t.description})]}),T?jsxRuntime.jsxs("div",{className:"flex items-start gap-3 text-sm leading-6 text-emerald-500",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"mt-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-emerald-500/15",children:jsxRuntime.jsx(lucideReact.Check,{className:"size-3.5","aria-hidden":"true"})}),jsxRuntime.jsx("p",{children:l??et})]}):jsxRuntime.jsxs("form",{onSubmit:I,className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"grid gap-2 sm:grid-cols-[minmax(0,0.8fr)_minmax(0,1fr)_auto]",children:[jsxRuntime.jsx("label",{className:"sr-only",htmlFor:`newsletter-name-${r}`,children:"Name"}),jsxRuntime.jsx("input",{id:`newsletter-name-${r}`,name:"name",type:"text",autoComplete:"name",placeholder:"Name",className:"border-input bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring min-h-10 rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"}),jsxRuntime.jsx("label",{className:"sr-only",htmlFor:`newsletter-email-${r}`,children:"Email"}),jsxRuntime.jsx("input",{id:`newsletter-email-${r}`,name:"email",type:"email",autoComplete:"email",placeholder:"Email address",required:true,className:"border-input bg-background text-foreground placeholder:text-muted-foreground focus-visible:ring-ring min-h-10 rounded-md border px-3 py-2 text-sm focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"}),jsxRuntime.jsx("input",{type:"text",name:"company",tabIndex:-1,autoComplete:"off","aria-hidden":"true",className:"hidden"}),jsxRuntime.jsxs("button",{type:"submit",disabled:y,className:"inline-flex min-h-10 w-full shrink-0 items-center justify-center gap-2 rounded-full bg-[var(--blog-accent)] px-5 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60 sm:w-auto",children:[y?"Submitting...":t.buttonLabel,jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"size-4","aria-hidden":"true"})]})]}),u&&jsxRuntime.jsx("p",{className:"text-sm text-red-600",children:u})]})]})})}function Di(e){return e?.startsWith("http://")||e?.startsWith("https://")?e:typeof window<"u"?window.location.href:null}function Bt(e,t){let r=e.get(t);return typeof r=="string"?r:""}function Ui(e,t){let r=Bt(e,t).trim();return r.length===0?null:r}function Hi(e){return `bloggy_newsletter_subscribed_${e}`}function Vi(e){if(typeof window>"u")return false;try{if(window.localStorage.getItem(e)==="true")return !0}catch{}return typeof document>"u"?false:document.cookie.split(";").some(t=>t.trim().startsWith(`${e}=true`))}function ji(e){if(typeof window<"u")try{window.localStorage.setItem(e,"true");}catch{}typeof document<"u"&&(document.cookie=`${e}=true; Max-Age=31536000; Path=/; SameSite=Lax`);}function Fi(e){return typeof window>"u"?()=>{}:(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e))}function Gi(e){return e&&typeof e=="object"&&"message"in e&&typeof e.message=="string"?e.message:null}function xr({articles:e,siteName:t,siteTagline:r,className:i,site:n,includeStructuredData:o=false,basePath:s="/blog",pagination:l,theme:a,newsletter:u,newsletterPreviewMode:c=false}){let d=k(s)||"/",h=u??n?.newsletter,y=n?.id??e[0]?.site.id;return jsxRuntime.jsxs("div",{style:$(a),className:p("blog-home-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",i),children:[t&&jsxRuntime.jsxs("header",{className:"blog-header mb-8 text-center sm:mb-12 lg:mb-16",children:[jsxRuntime.jsx("h1",{className:p("blog-title mb-2 text-3xl font-light tracking-tight text-balance sm:text-4xl lg:text-5xl",D),children:t}),r&&jsxRuntime.jsx("p",{className:"blog-tagline text-muted-foreground text-base sm:text-lg",children:r}),jsxRuntime.jsxs("nav",{"aria-label":"Browse blog",className:"mt-5 flex flex-wrap items-center justify-center gap-2 text-sm",children:[jsxRuntime.jsx(re__default.default,{href:d,"aria-current":"page",className:"rounded-full border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] px-3 py-1.5 font-medium text-[var(--blog-text-accent)] transition-colors hover:border-[var(--blog-text-accent)] hover:text-[var(--blog-text-accent-hover)] hover:no-underline",children:"All articles"}),jsxRuntime.jsx(re__default.default,{href:v(d,"topics"),className:"text-muted-foreground rounded-full border border-transparent px-3 py-1.5 font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:text-[var(--blog-accent)] hover:no-underline",children:"Topics"}),jsxRuntime.jsx(re__default.default,{href:v(d,"series"),className:"text-muted-foreground rounded-full border border-transparent px-3 py-1.5 font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:text-[var(--blog-accent)] hover:no-underline",children:"Series"}),jsxRuntime.jsx(re__default.default,{href:v(d,"authors"),className:"text-muted-foreground rounded-full border border-transparent px-3 py-1.5 font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:text-[var(--blog-accent)] hover:no-underline",children:"Authors"})]})]}),jsxRuntime.jsxs("main",{className:"articles-list",children:[e.length===0?jsxRuntime.jsxs("div",{className:"no-articles text-muted-foreground py-16 text-center sm:py-24 lg:py-32",children:[jsxRuntime.jsx("h2",{className:"mb-3 text-xl font-light sm:mb-4 sm:text-2xl lg:text-3xl",children:"No articles yet"}),jsxRuntime.jsx("p",{className:"text-muted-foreground/70 mx-auto max-w-md text-base sm:text-lg",children:"This blog doesn't have any published articles yet."})]}):jsxRuntime.jsx("div",{className:"space-y-0",children:e.map(f=>jsxRuntime.jsx(Xi,{article:f,basePath:d},f.id))}),l&&l.totalPages>1&&jsxRuntime.jsx("div",{className:"pagination-wrapper mt-12",children:jsxRuntime.jsx(Pe,{currentPage:l.currentPage,totalPages:l.totalPages,baseUrl:l.baseUrl??d,className:"justify-center"})})]}),h?.enabled&&y&&jsxRuntime.jsx(Ee,{siteId:y,settings:h,sourceSurface:"blog_home",previewMode:c,className:"mt-10 sm:mt-12"}),o&&n&&(()=>{let f=ge(_t(n,e.slice(0,5),{pathPrefix:d}));return jsxRuntime.jsx("script",{type:f.type,dangerouslySetInnerHTML:f.dangerouslySetInnerHTML})})()]})}function qi(e){return `${Math.ceil(e/60)} min read`}function Xi({article:e,basePath:t}){let r=v(t,e.slug),i=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true}),n=qi(e.readingSeconds),o=e.featuredImage;return jsxRuntime.jsxs("article",{className:"group border-border mb-6 block border-b pb-6 last:mb-0 last:border-b-0 last:pb-0 sm:mb-8 sm:pb-8",children:[jsxRuntime.jsxs("div",{className:"space-y-4 lg:hidden",children:[o&&jsxRuntime.jsx(re__default.default,{href:r,className:"focus-visible:ring-ring relative block aspect-[16/10] w-full overflow-hidden rounded-2xl bg-[var(--blog-accent-bg)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","aria-label":`Read article: ${e.title}`,children:jsxRuntime.jsx(Et__default.default,{src:o,alt:e.featuredImageAlt??`Featured image for ${e.title}`,width:400,height:250,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsx(re__default.default,{href:r,className:"focus-visible:ring-ring block rounded-md hover:no-underline focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",children:jsxRuntime.jsx("h2",{className:"text-lg leading-tight font-bold text-balance transition-colors group-hover:text-[var(--blog-accent)] sm:text-xl md:text-2xl",children:e.title})}),jsxRuntime.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",children:[e.author&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hr,{author:e.author,basePath:t}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"})]}),jsxRuntime.jsx("time",{dateTime:e.publishedAt,className:"font-medium","aria-label":`Published ${i}`,children:i}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:n})]}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed sm:text-base",children:e.excerpt}),(e.topics??[]).length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:(e.topics??[]).map(s=>jsxRuntime.jsx(fr,{topic:s,basePath:t},s.id))})]})]}),jsxRuntime.jsxs("div",{className:"hidden items-start gap-6 lg:flex xl:gap-8",children:[o&&jsxRuntime.jsx(re__default.default,{href:r,className:"focus-visible:ring-ring relative block aspect-[16/10] w-64 shrink-0 overflow-hidden rounded-2xl bg-[var(--blog-accent-bg)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none xl:w-72","aria-label":`Read article: ${e.title}`,children:jsxRuntime.jsx(Et__default.default,{src:o,alt:e.featuredImageAlt??`Featured image for ${e.title}`,width:288,height:180,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"flex min-h-[180px] flex-1 flex-col justify-between space-y-4 xl:min-h-[200px]",children:[jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsx(re__default.default,{href:r,className:"focus-visible:ring-ring block rounded-md hover:no-underline focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",children:jsxRuntime.jsx("h2",{className:"text-2xl leading-tight font-bold text-balance transition-colors group-hover:text-[var(--blog-accent)] xl:text-3xl",children:e.title})}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-base leading-relaxed xl:text-lg",children:e.excerpt}),(e.topics??[]).length>0&&jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:(e.topics??[]).map(s=>jsxRuntime.jsx(fr,{topic:s,basePath:t},s.id))})]}),jsxRuntime.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",children:[e.author&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(hr,{author:e.author,basePath:t}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"})]}),jsxRuntime.jsx("time",{dateTime:e.publishedAt,className:"font-medium","aria-label":`Published ${i}`,children:i}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:n})]})]})]})]})}function fr({topic:e,basePath:t}){let r="rounded-full border border-[var(--blog-accent-border)] px-2.5 py-1 text-xs font-medium text-[var(--blog-text-accent)] transition-colors hover:border-[var(--blog-text-accent)] hover:text-[var(--blog-text-accent-hover)]",i=e.slug.trim();return i?jsxRuntime.jsx(re__default.default,{href:v(t,`topics/${i}`),className:r,children:e.name}):jsxRuntime.jsx("span",{className:r,children:e.name})}function hr({author:e,basePath:t}){return jsxRuntime.jsxs(re__default.default,{href:B(t,e.slug),className:"inline-flex items-center gap-2 font-medium transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx(Wi,{author:e,size:"sm"}),e.name]})}function Wi({author:e,size:t}){let r=t==="md"?"h-9 w-9 text-sm":"h-6 w-6 text-xs",i=Ki(e.name);return e.avatarUrl?jsxRuntime.jsx(Et__default.default,{src:e.avatarUrl,alt:e.name,width:t==="md"?36:24,height:t==="md"?36:24,className:p("shrink-0 rounded-full object-cover",r),loading:"lazy"}):jsxRuntime.jsx("span",{className:p("bg-muted inline-flex shrink-0 items-center justify-center rounded-full font-medium",r),"aria-hidden":"true",children:i})}function Ki(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function Ji(e,t,r,i,n="/blog"){let o=e?`${e} - Blog`:"Blog",s=i&&i.currentPage>1?`${o} - Page ${i.currentPage}`:o,l=t??"Read our latest articles and insights.",a=k(n)||"/",u=r?`${r}${i&&i.currentPage>1?`${a}?page=${i.currentPage}`:a}`:void 0,c=i&&i.currentPage>1&&r?`${r}${i.currentPage===2?a:`${a}?page=${i.currentPage-1}`}`:void 0,d=i&&i.currentPage<i.totalPages&&r?`${r}${a}?page=${i.currentPage+1}`:void 0;return {title:s,description:l,openGraph:{title:s,description:l,type:"website",...r&&{url:u}},twitter:{card:"summary_large_image",title:s,description:l},alternates:{...u&&{canonical:u}},other:{...c&&{prev:c},...d&&{next:d}}}}var Qi=classVarianceAuthority.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Oe({className:e,variant:t,...r}){return jsxRuntime.jsx("div",{className:p(Qi({variant:t}),e),...r})}function Me({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card",className:p("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function eo({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-header",className:p("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function to({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-title",className:p("leading-none font-semibold",e),...t})}function ro({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-description",className:p("text-muted-foreground text-sm",e),...t})}function $e({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-content",className:p("px-6",e),...t})}function io({className:e,...t}){return jsxRuntime.jsx("div",{"data-slot":"card-footer",className:p("flex items-center px-6 [.border-t]:pt-6",e),...t})}function ao(e,t){try{return new URL(e).href}catch{if(!t)return e}try{return new URL(e,t).href}catch{return e}}async function yr(e,t=globalThis.navigator?.clipboard,r=typeof document>"u"?void 0:document){if(t)try{await t.writeText(e);return}catch{}if(!r)throw new Error("Clipboard API is unavailable");let i=r.createElement("textarea");i.value=e,i.setAttribute("readonly",""),i.style.position="fixed",i.style.left="-9999px",r.body.appendChild(i),i.select();try{if(!r.execCommand("copy"))throw new Error("Copy command failed")}finally{i.remove();}}async function lo(e,t=globalThis.navigator){return t?.share?(await t.share({title:e.title,url:e.url}),"shared"):(await yr(e.url,t?.clipboard),"copied")}function rt({title:e,url:t,className:r,size:i="md"}){let[n,o]=tt__namespace.default.useState(false),[s,l]=tt__namespace.default.useState(false),a=tt__namespace.default.useMemo(()=>ao(t,typeof window>"u"?void 0:window.location.href),[t]);tt__namespace.default.useEffect(()=>{if(!n)return;let y=window.setTimeout(()=>o(false),2e3);return ()=>window.clearTimeout(y)},[n]);async function u(){await yr(a),o(true);}async function c(){l(true);try{await lo({title:e,url:a})==="copied"&&o(!0);}finally{l(false);}}let d=i==="sm"?"h-8 gap-1.5 px-2.5 text-xs":"h-9 gap-2 px-3 text-sm",h=i==="sm"?"size-3.5":"size-4";return jsxRuntime.jsxs("div",{className:p("article-top-actions flex flex-wrap items-center justify-center gap-2",r),children:[jsxRuntime.jsxs("button",{type:"button","aria-label":"Copy article link",onClick:u,className:p("text-muted-foreground hover:text-foreground border-border inline-flex items-center justify-center rounded-full border font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",d),children:[n?jsxRuntime.jsx(lucideReact.Check,{className:h,"aria-hidden":"true"}):jsxRuntime.jsx(lucideReact.Copy,{className:h,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:n?"Copied":"Copy link"})]}),jsxRuntime.jsxs("button",{type:"button","aria-label":"Share article",onClick:c,disabled:s,className:p("text-muted-foreground hover:text-foreground border-border inline-flex items-center justify-center rounded-full border font-medium transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)] disabled:cursor-wait disabled:opacity-60",d),children:[jsxRuntime.jsx(lucideReact.Share2,{className:h,"aria-hidden":"true"}),jsxRuntime.jsx("span",{children:"Share"})]})]})}function Pr({alt:e="",className:t,src:r,...i}){if(typeof r!="string"||r.length===0)return jsxRuntime.jsx("img",{alt:e,className:t,...i});let n=`blog-image-preview-${uo(r)}`,o=co(r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("a",{href:`#${n}`,className:"group mx-auto block cursor-zoom-in rounded-2xl focus-visible:ring-2 focus-visible:ring-[var(--blog-text-accent)] focus-visible:ring-offset-2 focus-visible:outline-none","aria-label":e?`Expand image: ${e}`:"Expand article image",children:jsxRuntime.jsx("img",{src:r,alt:e,className:p("mx-auto rounded-2xl border border-[var(--blog-accent-border)] shadow-[0_18px_60px_rgb(168_85_247_/_0.12)] transition-opacity group-hover:opacity-95",t),...i})}),jsxRuntime.jsxs("div",{id:n,className:"invisible fixed inset-0 z-50 flex opacity-0 transition-opacity target:visible target:opacity-100",role:"dialog","aria-modal":"true","aria-label":e?`Image preview: ${e}`:"Image preview",children:[jsxRuntime.jsx("a",{href:"#article-content",className:"absolute inset-0 bg-black/85 backdrop-blur-sm","aria-label":"Close image preview"}),jsxRuntime.jsx("div",{className:"pointer-events-none relative z-10 flex min-h-screen w-full items-center justify-center p-4 sm:p-6",children:jsxRuntime.jsx("img",{src:o,alt:e,className:"pointer-events-auto h-[88vh] w-[94vw] rounded-3xl object-contain shadow-2xl"})}),jsxRuntime.jsx("a",{href:"#article-content",className:"absolute top-4 right-4 z-20 inline-flex size-10 items-center justify-center rounded-full border border-white/20 bg-black/50 text-xl leading-none text-white no-underline transition-colors hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-white focus-visible:outline-none","aria-label":"Close image preview",children:"\xD7"})]})]})}function co(e){if(!e.includes("/cdn-cgi/image/"))return e;try{let t=new URL(e),r=t.pathname.split("/"),i=r.findIndex(n=>n==="image");return i===-1||r[i-1]!=="cdn-cgi"||!r[i+1]?e:(r[i+1]="width=1600,quality=90,format=webp",t.pathname=r.join("/"),t.toString())}catch{return e}}function uo(e){let t=0;for(let r=0;r<e.length;r+=1)t=(t<<5)-t+e.charCodeAt(r),t|=0;return Math.abs(t).toString(36)}function Mt({items:e,contentId:t,variant:r,showProgress:i=true}){let n=e[0]?.id??null,o=tt.useMemo(()=>e.map(s=>s.id),[e]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(fo,{contentId:t,itemIds:o}),i&&jsxRuntime.jsx("div",{"data-blog-reading-progress":t,className:"fixed inset-x-0 top-0 z-50 h-1 origin-left bg-[var(--blog-accent)] motion-safe:transition-transform",style:{transform:"scaleX(0)"},role:"progressbar","aria-label":"Reading progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0,suppressHydrationWarning:true}),jsxRuntime.jsx(bo,{items:e,activeItemId:n,variant:r})]})}function fo({contentId:e,itemIds:t}){return tt.useEffect(()=>{let r=0,i=decodeURIComponent(window.location.hash.replace(/^#/,"")),n=a=>{let u=Array.from(document.querySelectorAll("[data-blog-toc-link]"));for(let c of u){let d=c.getAttribute("data-blog-toc-link")===a;c.setAttribute("data-active",d?"true":"false"),d?c.setAttribute("aria-current","location"):c.removeAttribute("aria-current");}},o=()=>{let a=document.getElementById(e);if(!a)return;let u=Array.from(document.querySelectorAll(`[data-blog-reading-progress="${e}"]`)),c=a.getBoundingClientRect(),d=window.scrollY,h=c.top+d,y=a.offsetHeight-window.innerHeight,f=y<=0?d>=h?100:0:(d-h)/y*100,g=ho(f);for(let S of u)S.style.transform=`scaleX(${g/100})`,S.setAttribute("aria-valuenow",String(Math.round(g)));let b=t.map(S=>document.getElementById(S)).filter(S=>!!S);if(i&&t.includes(i)){n(i),i="";return}let T=Math.max(160,Math.round(window.innerHeight*.33)),I=b.filter(S=>S.getBoundingClientRect().top<=T).at(-1)??b[0]??null;n(I?I.id:null);},s=()=>{window.cancelAnimationFrame(r),r=window.requestAnimationFrame(o);},l=()=>{i=decodeURIComponent(window.location.hash.replace(/^#/,"")),s();};return s(),window.addEventListener("scroll",s,{passive:true}),window.addEventListener("resize",s),window.addEventListener("hashchange",l),()=>{window.cancelAnimationFrame(r),window.removeEventListener("scroll",s),window.removeEventListener("resize",s),window.removeEventListener("hashchange",l);}},[e,t]),null}function ho(e){return Number.isFinite(e)?Math.min(100,Math.max(0,e)):0}function bo({items:e,activeItemId:t,variant:r}){if(e.length===0)return null;let i=jsxRuntime.jsx("ul",{className:"space-y-2 text-sm",children:e.map(n=>{let o=gr(n.id,t);return jsxRuntime.jsx("li",{className:n.level===3?"pl-4":void 0,children:jsxRuntime.jsx("a",{href:`#${n.id}`,"aria-current":o.ariaCurrent,"data-blog-toc-link":n.id,"data-active":o.isActive?"true":"false",suppressHydrationWarning:true,className:"text-muted-foreground hover:text-[var(--blog-text-accent)] data-[active=true]:border-[var(--blog-accent)] data-[active=true]:text-[var(--blog-text-accent)] block border-l-2 border-transparent pl-3 leading-snug transition-colors",children:n.text})},n.id)})});return r==="mobile"?jsxRuntime.jsxs("details",{className:"group mb-6 rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] lg:hidden",children:[jsxRuntime.jsxs("summary",{className:"text-foreground flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold [&::-webkit-details-marker]:hidden",children:[jsxRuntime.jsx("span",{children:"On this page"}),jsxRuntime.jsxs("span",{className:"text-muted-foreground flex items-center gap-2 text-xs font-medium",children:[pr(e.length),jsxRuntime.jsx("span",{className:"text-[var(--blog-text-accent)] transition-transform group-open:rotate-180","aria-hidden":"true",children:"\u2193"})]})]}),jsxRuntime.jsx("nav",{"aria-label":"Table of contents",className:"border-t border-[var(--blog-accent-border)] px-4 py-4",children:i})]}):jsxRuntime.jsx("aside",{className:"hidden lg:block",children:jsxRuntime.jsxs("nav",{"aria-label":"Table of contents",className:"sticky top-24 max-h-[calc(100vh-8rem)] overflow-y-auto border-l border-border pl-5",children:[jsxRuntime.jsx("p",{className:"text-muted-foreground mb-3 text-xs font-semibold tracking-wider uppercase",children:"On this page"}),i]})})}var Ao="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share";function wo({video:e,posterSrc:t,posterAlt:r,posterLoader:i,className:n,playing:o,onPlay:s}){if(!W(e.id))return null;let l="relative aspect-video w-full overflow-hidden rounded-3xl border border-[var(--blog-accent-border)] bg-black shadow-[0_24px_80px_rgb(168_85_247_/_0.14)]";return jsxRuntime.jsxs("div",{className:p("article-video",n),children:[o?jsxRuntime.jsx("div",{className:l,children:jsxRuntime.jsx("iframe",{src:wt(e.id),title:e.title,allow:Ao,allowFullScreen:true,referrerPolicy:"strict-origin-when-cross-origin",className:"absolute inset-0 h-full w-full border-0"})}):jsxRuntime.jsxs("a",{href:Nt(e.id),"aria-label":`Play video: ${e.title}`,onClick:a=>{a.button!==0||a.metaKey||a.ctrlKey||a.shiftKey||a.altKey||(a.preventDefault(),s());},className:p(l,"group block focus-visible:ring-2 focus-visible:ring-[var(--blog-text-accent)] focus-visible:ring-offset-2 focus-visible:outline-none"),children:[t?jsxRuntime.jsx(Et__default.default,{src:t,alt:r??"",...i&&{loader:i},fill:true,sizes:"(min-width: 896px) 896px, 100vw",className:"object-cover transition-opacity group-hover:opacity-90",priority:true}):jsxRuntime.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 bg-gradient-to-br from-[var(--blog-accent-bg)] to-black"}),jsxRuntime.jsx("span",{"aria-hidden":"true",className:"absolute inset-0 flex items-center justify-center bg-black/10 transition-colors group-hover:bg-black/25",children:jsxRuntime.jsx("span",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-white/95 text-black shadow-xl transition-transform group-hover:scale-105 sm:h-20 sm:w-20",children:jsxRuntime.jsx(lucideReact.Play,{className:"ml-1 h-7 w-7 fill-current sm:h-9 sm:w-9"})})})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground mt-2 text-center text-xs",children:"Plays from YouTube"})]})}function wr(e){let[t,r]=tt__namespace.default.useState(false);return jsxRuntime.jsx(wo,{...e,playing:t,onPlay:()=>r(true)})}var he=tt__namespace.forwardRef(({className:e,orientation:t="horizontal",decorative:r=true,...i},n)=>jsxRuntime.jsx($t__namespace.Root,{ref:n,decorative:r,orientation:t,className:p("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...i}));he.displayName=$t__namespace.Root.displayName;var _o=To.defaultSchema.attributes?.["*"]??[],ko=To.defaultSchema.attributes?.a??[],Io=To.defaultSchema.attributes?.img??[],Bo={...To.defaultSchema,tagNames:[...To.defaultSchema.tagNames??[],"figure","figcaption"],attributes:{...To.defaultSchema.attributes,"*":[..._o,"className"],a:[...ko,"className","href","target","rel","title"],img:[...Io,"className","src","alt","title","width","height","loading"],figure:["className"],figcaption:["className"],span:["className"]},protocols:{...To.defaultSchema.protocols,href:["http","https","mailto","tel"],src:["http","https"]}},Nr={mdxOptions:{format:"md",remarkPlugins:[Co__default.default,Ro__default.default],rehypePlugins:[No__default.default,[To__default.default,Bo],Eo,Lo__default.default]}};function Eo(){return e=>{Tr(e);}}function Tr(e){e.children&&(e.children=e.children.flatMap(t=>(Tr(t),Oo(t)?t.children?.filter(Dt)??[t]:[t])));}function Oo(e){if(e.type!=="element"||e.tagName!=="p"||!e.children)return false;let t=e.children.filter(Dt);return t.length===1&&Mo(t[0])}function Mo(e){if(e?.type!=="element")return false;if(e.tagName==="img")return true;if(e.tagName!=="a"||!e.children)return false;let t=e.children.filter(Dt);return t.length===1&&t[0]?.tagName==="img"}function Dt(e){return e.type!=="text"||!!e.value?.trim()}function Ut({article:e,basePath:t="/blog",className:r}){let i=e.series;return i?jsxRuntime.jsxs("section",{"aria-labelledby":"article-series-title",className:p("rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] p-5 sm:p-6",r),children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-5 md:flex-row md:items-start md:justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("p",{className:"text-muted-foreground text-sm font-medium",children:["Part ",i.position," of ",i.total]}),jsxRuntime.jsx("h2",{id:"article-series-title",className:"text-xl font-semibold",children:jsxRuntime.jsx(re__default.default,{href:le(t,i.slug),className:"transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:i.title})}),i.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground max-w-2xl leading-relaxed",children:i.description})]}),(i.previous??i.next)&&jsxRuntime.jsxs("div",{className:"grid shrink-0 gap-2 sm:grid-cols-2 md:min-w-64 md:grid-cols-1",children:[i.previous&&jsxRuntime.jsxs(re__default.default,{href:v(t,i.previous.slug),className:"rounded-xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] px-3 py-2 text-sm transition-colors hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground block text-xs",children:"Previous"}),jsxRuntime.jsx("span",{className:"line-clamp-2 font-medium",children:i.previous.title})]}),i.next&&jsxRuntime.jsxs(re__default.default,{href:v(t,i.next.slug),className:"rounded-xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] px-3 py-2 text-sm transition-colors hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground block text-xs",children:"Next"}),jsxRuntime.jsx("span",{className:"line-clamp-2 font-medium",children:i.next.title})]})]})]}),i.articles.length>0&&jsxRuntime.jsx("ol",{className:"mt-5 grid gap-2",children:i.articles.map(n=>jsxRuntime.jsx("li",{children:jsxRuntime.jsxs(re__default.default,{href:v(t,n.slug),"aria-current":n.isCurrent?"page":void 0,className:p("hover:bg-background/60 flex gap-3 rounded-xl px-3 py-2 text-sm transition-colors hover:no-underline",n.isCurrent&&"bg-background/70"),children:[jsxRuntime.jsx("span",{className:"text-muted-foreground shrink-0 tabular-nums",children:n.position}),jsxRuntime.jsx("span",{className:p("line-clamp-2",n.isCurrent?"font-semibold text-[var(--blog-text-accent)]":"font-medium"),children:n.title})]})},n.id))})]}):null}function Ht(e,t,r={}){let i=r.limit??3;if(i<=0)return [];let n=Rr(e),o=$o(e,t),s=(c,d)=>Cr(d)-Cr(c)||Lr(c).localeCompare(Lr(d)),l=n?o.filter(c=>Rr(c)===n).sort(s):[],a=new Set(l.map(c=>c.id)),u=o.filter(c=>!a.has(c.id)).sort(s);return [...l,...u].slice(0,i)}function $o(e,t){let r=new Set,i=new Set,n=[];for(let o of t)o.id===e.id||o.slug===e.slug||r.has(o.id)||i.has(o.slug)||(r.add(o.id),i.add(o.slug),n.push(o));return n}function Rr(e){let t=e.topics??[];return t.find(r=>r.isPrimary)?.slug??t[0]?.slug??null}function Cr(e){let t=Date.parse(e.publishedAt??e.updatedAt??"");return Number.isFinite(t)?t:0}function Lr(e){return e.title??e.slug}function jo(e){return `${Math.ceil(e/60)} min read`}function Fo(e){try{return new URL(e).hostname.replace(/^www\./,"")}catch{return e}}function Go({creditText:e,creditUrl:t}){if(!e&&!t)return null;let r=e??Fo(t??"");return jsxRuntime.jsxs("span",{children:["Credit:"," ",t?jsxRuntime.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2 transition-colors hover:text-[var(--blog-text-accent)]",children:r}):r]})}function Or({article:e,className:t,navigation:r,basePath:i="/blog",theme:n,postArticleCta:o,newsletter:s,newsletterPreviewMode:l=false,articles:a=[],relatedArticles:u=[],showShareLinks:c=true}){let d=k(i)||"/",h=kt(e.publishedAt,e.updatedAt),y=jo(e.readingSeconds),f=It(e.content),g=e.meta.canonicalUrl??v(d,e.slug),b=s??e.site.newsletter,T=o??e.cta,I=e.featuredImage,E=!!(e.featuredImageCaption??e.featuredImageCreditText??e.featuredImageCreditUrl)?jsxRuntime.jsxs("figcaption",{className:"text-muted-foreground mt-3 space-y-1 px-2 text-center text-sm leading-relaxed sm:px-0",children:[e.featuredImageCaption&&jsxRuntime.jsx("p",{children:e.featuredImageCaption}),(e.featuredImageCreditText??e.featuredImageCreditUrl)&&jsxRuntime.jsx("p",{className:"text-xs",children:jsxRuntime.jsx(Go,{creditText:e.featuredImageCreditText,creditUrl:e.featuredImageCreditUrl})})]}):null,X=u.length>0?u.slice(0,3):Ht(e,a);return jsxRuntime.jsxs("article",{style:$(n),className:p("article-page mx-auto max-w-6xl px-4 py-6 pb-12 sm:px-6 sm:py-8 sm:pb-16 lg:px-8 lg:py-12 lg:pb-24",t),children:[r?.backToHome&&jsxRuntime.jsx("header",{className:"mx-auto mb-8 max-w-4xl sm:mb-12 lg:mb-16",children:jsxRuntime.jsxs(re__default.default,{href:r.backToHome.url,className:"text-muted-foreground group focus-visible:ring-ring inline-flex touch-manipulation items-center space-x-2 rounded-md px-2 py-1 transition-colors hover:text-[var(--blog-accent)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none sm:space-x-3","aria-label":r.backToHome.label??"Return to blog",children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"h-4 w-4 transition-transform group-hover:-translate-x-1 sm:h-5 sm:w-5","aria-hidden":"true"}),jsxRuntime.jsxs("span",{className:"text-sm font-medium sm:text-base",children:[jsxRuntime.jsx("span",{className:"hidden sm:inline",children:r.backToHome.label??"Back to all articles"}),jsxRuntime.jsx("span",{className:"sm:hidden",children:"Back"})]})]})}),jsxRuntime.jsx("style",{children:`
|
|
3
3
|
.article-content figure > p {
|
|
4
4
|
margin-top: 0 !important;
|
|
5
5
|
margin-bottom: 0 !important;
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
text-decoration-line: underline;
|
|
37
37
|
text-underline-offset: 0.18em;
|
|
38
38
|
}
|
|
39
|
-
`}),jsxRuntime.jsxs("header",{className:"article-header mx-auto mb-6 max-w-4xl space-y-4 text-center sm:mb-8 sm:space-y-6 lg:mb-12 lg:space-y-8",children:[jsxRuntime.jsx("h1",{className:f("article-title px-4 text-2xl leading-tight font-light tracking-tight text-balance sm:px-0 sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl",F),children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"article-excerpt text-muted-foreground mx-auto mt-6 max-w-[42rem] px-4 text-lg leading-relaxed text-balance sm:mt-8 sm:max-w-[46rem] sm:px-0 sm:text-xl md:max-w-[52rem] md:text-2xl lg:max-w-4xl lg:text-2xl",children:e.excerpt}),jsxRuntime.jsxs("div",{className:"article-meta text-muted-foreground flex flex-col items-center gap-2 text-sm sm:gap-3 sm:text-base",children:[e.author&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Author"}),jsxRuntime.jsxs(te__default.default,{href:E(c,e.author.slug),className:"inline-flex items-center gap-2 font-medium transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx(hr,{author:e.author,size:"md"}),e.author.name]}),e.author.isGuest&&jsxRuntime.jsx(Oe,{variant:"outline",className:"text-xs",children:"Guest Author"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-3 gap-y-1",children:[jsxRuntime.jsxs("time",{dateTime:e.publishedAt,className:"font-medium","aria-label":`Published ${g.publishedDateLabel}`,children:["Published ",g.publishedDateLabel]}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:g.publishedRelativeLabel}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:h})]}),g.isUpdated&&jsxRuntime.jsxs("time",{dateTime:e.updatedAt,className:"text-xs",children:["Updated ",g.updatedDateLabel]}),m&&jsxRuntime.jsx(Qe,{title:e.title,url:b,size:"sm"}),jsxRuntime.jsx("div",{className:"bg-border h-px w-6 sm:w-8","aria-hidden":"true"}),(e.topics??[]).length>0?jsxRuntime.jsx("nav",{"aria-label":"Article topics",className:"flex flex-wrap justify-center gap-2",children:(e.topics??[]).map(N=>jsxRuntime.jsx(te__default.default,{href:P((r?.backToHome?.url??"/blog").replace(/\/$/,""),`topics/${N.slug}`),className:"rounded-full border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] px-3 py-1 text-xs font-medium text-[var(--blog-text-accent)] transition-colors hover:border-[var(--blog-text-accent)] hover:text-[var(--blog-text-accent-hover)]",children:N.name},N.id))}):jsxRuntime.jsxs("span",{className:"text-xs tracking-wider uppercase sm:text-sm",role:"text",children:["From ",e.site.name]})]})]}),T&&jsxRuntime.jsxs("figure",{className:"article-featured-image mx-auto my-8 w-full max-w-4xl sm:my-12 lg:my-16",children:[jsxRuntime.jsx(At__default.default,{src:T,alt:e.featuredImageAlt??`Featured image for ${e.title}`,className:"h-auto w-full rounded-3xl border border-[var(--blog-accent-border)] shadow-[0_24px_80px_rgb(168_85_247_/_0.14)]",width:1200,height:800,priority:true}),S&&jsxRuntime.jsxs("figcaption",{className:"text-muted-foreground mt-3 space-y-1 px-2 text-center text-sm leading-relaxed sm:px-0",children:[e.featuredImageCaption&&jsxRuntime.jsx("p",{children:e.featuredImageCaption}),(e.featuredImageCreditText??e.featuredImageCreditUrl)&&jsxRuntime.jsx("p",{className:"text-xs",children:jsxRuntime.jsx(xi,{creditText:e.featuredImageCreditText,creditUrl:e.featuredImageCreditUrl})})]})]}),jsxRuntime.jsxs("div",{id:"article-content",className:"article-content mx-auto grid max-w-6xl grid-cols-1 gap-8 lg:grid-cols-[minmax(0,1fr)_14rem] lg:gap-12",children:[jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx(wt,{items:p,contentId:"article-body",variant:"mobile"}),jsxRuntime.jsx("div",{id:"article-body",className:"prose prose-sm sm:prose-base lg:prose-lg xl:prose-xl prose-gray dark:prose-invert prose-headings:scroll-mt-20 prose-headings:font-light prose-headings:text-balance prose-headings:text-[var(--blog-text-accent)] prose-h1:text-2xl sm:prose-h1:text-3xl lg:prose-h1:text-4xl prose-h2:text-xl sm:prose-h2:text-2xl lg:prose-h2:text-3xl prose-h3:text-lg sm:prose-h3:text-xl lg:prose-h3:text-2xl prose-p:leading-relaxed prose-p:text-pretty prose-a:text-[var(--blog-text-accent)] prose-a:transition-colors hover:prose-a:text-[var(--blog-text-accent-hover)] [&_figcaption]:text-muted-foreground [&_figcaption_.blog-image-credit]:text-muted-foreground/80 [&_figcaption>span:not(.blog-image-credit)]:text-muted-foreground/80 max-w-none [&_figcaption]:!mt-2 [&_figcaption]:text-center [&_figcaption]:!text-sm [&_figcaption]:!leading-snug [&_figcaption_.blog-image-credit]:mt-1 [&_figcaption_.blog-image-credit]:block [&_figcaption_.blog-image-credit]:text-xs [&_figcaption_.blog-image-credit]:tracking-wide [&_figcaption>span:not(.blog-image-credit)]:ml-2 [&_figcaption>span:not(.blog-image-credit)]:border-l [&_figcaption>span:not(.blog-image-credit)]:border-[var(--blog-accent-border)] [&_figcaption>span:not(.blog-image-credit)]:pl-2 [&_figcaption>span:not(.blog-image-credit)]:text-xs [&_figcaption>span:not(.blog-image-credit)]:tracking-wide [&_figure>p]:!my-0",children:jsxRuntime.jsx(rsc.MDXRemote,{source:e.content,options:ur,components:{img:lr}})})]}),jsxRuntime.jsx(wt,{items:p,contentId:"article-body",variant:"desktop",showProgress:false})]}),jsxRuntime.jsx(Rt,{article:e,basePath:c,className:"mx-auto mt-12 max-w-4xl"}),e.author?.bio&&jsxRuntime.jsxs("div",{id:"about-author",className:"author-bio mx-auto mt-12 max-w-4xl",children:[jsxRuntime.jsx(fe,{className:"mb-8"}),jsxRuntime.jsx(Me,{className:"border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsxs($e,{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-start sm:p-6",children:[jsxRuntime.jsx("div",{className:"shrink-0",children:jsxRuntime.jsx(hr,{author:e.author,size:"lg"})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm font-medium",children:"Written by"}),jsxRuntime.jsxs("h2",{className:"text-foreground flex flex-wrap items-center gap-2 text-xl font-semibold",children:[jsxRuntime.jsx(te__default.default,{href:E(c,e.author.slug),className:"transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:e.author.name}),e.author.isGuest&&jsxRuntime.jsx(Oe,{variant:"outline",className:"text-xs",children:"Guest Author"})]})]}),jsxRuntime.jsx(yi,{author:e.author})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.author.bio})]})]})})]}),((I??false)||(A?.enabled??false)||m||U.length>0)&&jsxRuntime.jsxs("div",{className:"mx-auto mt-12 max-w-4xl space-y-8",children:[jsxRuntime.jsx(fe,{}),I&&jsxRuntime.jsx(Ai,{cta:I}),A?.enabled&&jsxRuntime.jsx(Ee,{siteId:e.site.id,settings:A,sourceSurface:"article",sourceArticleSlug:e.slug,sourceUrl:b,previewMode:l}),m&&jsxRuntime.jsx(Si,{title:e.title,url:b}),U.length>0&&jsxRuntime.jsx(wi,{articles:U,basePath:c})]}),(!!r?.previousArticle||!!r?.nextArticle)&&jsxRuntime.jsxs("nav",{className:"article-nav mx-auto mt-12 max-w-4xl",children:[jsxRuntime.jsx(fe,{className:"mb-8"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[r?.previousArticle&&jsxRuntime.jsx(Me,{className:"group cursor-pointer transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsxs(te__default.default,{href:r.previousArticle.url,className:"block",children:[r.previousArticle.featuredImage&&jsxRuntime.jsx(Lt,{src:r.previousArticle.featuredImage,alt:r.previousArticle.featuredImageAlt??`Featured image for ${r.previousArticle.title}`}),jsxRuntime.jsxs($e,{className:"p-4",children:[jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"\u2190 Previous Article"}),jsxRuntime.jsx("div",{className:"text-foreground transition-colors group-hover:text-[var(--blog-text-accent)]",children:r.previousArticle.title})]})]})}),r?.nextArticle&&jsxRuntime.jsx(Me,{className:f("group cursor-pointer transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",!r?.previousArticle&&"md:col-start-2"),children:jsxRuntime.jsxs(te__default.default,{href:r.nextArticle.url,className:"block",children:[r.nextArticle.featuredImage&&jsxRuntime.jsx(Lt,{src:r.nextArticle.featuredImage,alt:r.nextArticle.featuredImageAlt??`Featured image for ${r.nextArticle.title}`}),jsxRuntime.jsxs($e,{className:"p-4 md:text-right",children:[jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Next Article \u2192"}),jsxRuntime.jsx("div",{className:"text-foreground transition-colors group-hover:text-[var(--blog-text-accent)]",children:r.nextArticle.title})]})]})})]})]}),(()=>{let N=ge(bt(e,{customDomain:e.site.domain,pathPrefix:c}));return jsxRuntime.jsx("script",{type:N.type,dangerouslySetInnerHTML:N.dangerouslySetInnerHTML})})()]})}function hr({author:e,size:t}){let r=t==="lg"?"h-12 w-12 text-base":"h-9 w-9 text-sm",n=Pi(e.name);return e.avatarUrl?jsxRuntime.jsx(At__default.default,{src:e.avatarUrl,alt:e.name,width:t==="lg"?48:36,height:t==="lg"?48:36,className:f("shrink-0 rounded-full object-cover",r),loading:"lazy"}):jsxRuntime.jsx("span",{className:f("bg-muted text-muted-foreground inline-flex shrink-0 items-center justify-center rounded-full font-medium",r),"aria-hidden":"true",children:n})}function yi({author:e}){let t=vi(e);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:t.map(r=>jsxRuntime.jsx("a",{href:r.href,target:r.external?"_blank":void 0,rel:r.external?"noopener noreferrer":void 0,"aria-label":`${e.name} ${r.label}`,className:"text-muted-foreground hover:bg-background/60 hover:text-foreground inline-flex size-7 items-center justify-center rounded-full transition-colors",children:r.icon},r.key))})}function vi(e){let t=e.socialLinks;return t?[t.website?{key:"website",href:t.website,label:"website",external:true,icon:jsxRuntime.jsx(lucideReact.Globe,{className:"size-4","aria-hidden":"true"})}:void 0,t.x?{key:"x",href:t.x,label:"on X",external:true,icon:jsxRuntime.jsx(fa6.FaXTwitter,{className:"size-4","aria-hidden":"true"})}:void 0,t.linkedin?{key:"linkedin",href:t.linkedin,label:"on LinkedIn",external:true,icon:jsxRuntime.jsx(fa6.FaLinkedinIn,{className:"size-4","aria-hidden":"true"})}:void 0,t.github?{key:"github",href:t.github,label:"on GitHub",external:true,icon:jsxRuntime.jsx(fa6.FaGithub,{className:"size-4","aria-hidden":"true"})}:void 0,t.email?{key:"email",href:`mailto:${t.email}`,label:"email",external:false,icon:jsxRuntime.jsx(lucideReact.Mail,{className:"size-4","aria-hidden":"true"})}:void 0].filter(n=>!!n):[]}function Pi(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function Ai({cta:e}){return jsxRuntime.jsx("div",{className:"rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] p-5 sm:p-6",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("h2",{className:"text-foreground text-xl font-semibold",children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.description})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 flex-col gap-2 sm:flex-row",children:[e.primary&&jsxRuntime.jsxs(te__default.default,{href:e.primary.href,className:"inline-flex items-center justify-center gap-2 rounded-full bg-[var(--blog-accent)] px-4 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90",children:[e.primary.label,jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"size-4","aria-hidden":"true"})]}),e.secondary&&jsxRuntime.jsxs(te__default.default,{href:e.secondary.href,className:"border-border bg-background text-foreground hover:bg-muted inline-flex items-center justify-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition-colors",children:[e.secondary.label,jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"size-4","aria-hidden":"true"})]})]})]})})}function Si({title:e,url:t}){let r=encodeURIComponent(e),n=encodeURIComponent(t);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-3",children:[jsxRuntime.jsx(Qe,{title:e,url:t,size:"sm"}),jsxRuntime.jsx("a",{href:`https://x.com/intent/tweet?text=${r}&url=${n}`,target:"_blank",rel:"noopener noreferrer","aria-label":"Share on X",className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(fa6.FaXTwitter,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsx("a",{href:`https://www.linkedin.com/sharing/share-offsite/?url=${n}`,target:"_blank",rel:"noopener noreferrer","aria-label":"Share on LinkedIn",className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(fa6.FaLinkedinIn,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsx("a",{href:`mailto:?subject=${r}&body=${n}`,"aria-label":"Share by email",className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(lucideReact.Mail,{className:"size-4","aria-hidden":"true"})})]})}function wi({articles:e,basePath:t}){return jsxRuntime.jsxs("section",{className:"space-y-4","aria-labelledby":"related-articles-title",children:[jsxRuntime.jsx("h2",{id:"related-articles-title",className:"text-xl font-semibold",children:"You might also like"}),jsxRuntime.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:e.map(r=>jsxRuntime.jsxs(te__default.default,{href:P(t,r.slug),className:"group border-border overflow-hidden rounded-2xl border transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)] hover:no-underline",children:[r.featuredImage&&jsxRuntime.jsx(Lt,{src:r.featuredImage,alt:r.featuredImageAlt??`Featured image for ${r.title}`}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("h3",{className:"text-foreground line-clamp-3 font-semibold transition-colors group-hover:text-[var(--blog-text-accent)]",children:r.title}),r.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground mt-2 line-clamp-3 text-sm leading-relaxed",children:r.excerpt})]})]},r.id))})]})}function Lt({src:e,alt:t}){return jsxRuntime.jsx("div",{className:"border-border aspect-[16/9] overflow-hidden border-b bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(At__default.default,{src:e,alt:t,width:480,height:270,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})})}function Ni(e,t="/blog"){let r=e.meta.title??e.title,n=e.meta.description??e.excerpt,o=e.meta.canonicalUrl??`${e.site.domain}${P(t,e.slug)}`,i=e.meta.ogImage??e.featuredImage;return {title:r,description:n,keywords:e.meta.keywords.join(", "),authors:e.author?[{name:e.author.name}]:void 0,openGraph:{title:r,description:n,type:"article",url:o,images:i?[{url:i,alt:e.featuredImageAlt??r}]:void 0,publishedTime:e.publishedAt,modifiedTime:e.updatedAt,authors:e.author?[e.author.name]:void 0,siteName:e.site.name},twitter:{card:"summary_large_image",title:r,description:n,images:i?[i]:void 0},alternates:{canonical:o}}}function we(e){let t=new Map;for(let r of e)r.series&&(!t.has(r.series.slug)||r.series.articles.length>(t.get(r.series.slug)?.articles.length??0))&&t.set(r.series.slug,r.series);return Array.from(t.values()).sort((r,n)=>r.title.localeCompare(n.title))}function _t(e,t){let r=e.filter(o=>o.series?.slug===t).sort((o,i)=>(o.series?.position??0)-(i.series?.position??0));if(r.length===0)return null;let n=r[0]?.series;return n?{series:n,articles:r}:null}function Ti(e){return e.series??null}function Bt({articles:e,basePath:t="/blog",title:r="Series",description:n="Browse related article series.",className:o,theme:i}){let s=_(t)||"/",l=we(e);return jsxRuntime.jsxs("main",{style:H(i),className:f("blog-series-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",o),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(te__default.default,{href:s,className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all articles"}),jsxRuntime.jsx("h1",{className:f("text-4xl font-light tracking-tight text-balance sm:text-5xl",F),children:r}),jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:n})]}),l.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No series have published articles yet."}):jsxRuntime.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:l.map(a=>jsxRuntime.jsxs(te__default.default,{href:se(s,a.slug),className:"group rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] p-5 transition hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsxs("p",{className:"text-muted-foreground mb-2 text-sm font-medium",children:[a.total," ",a.total===1?"article":"articles"]}),jsxRuntime.jsx("h2",{className:"text-xl font-semibold transition-colors group-hover:text-[var(--blog-accent)]",children:a.title}),a.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mt-2 line-clamp-3 text-sm leading-relaxed",children:a.description})]},a.slug))})]})}function It({articles:e,seriesSlug:t,basePath:r="/blog",className:n,theme:o}){let i=_(r)||"/",s=_t(e,t);return jsxRuntime.jsxs("main",{style:H(o),className:f("blog-series-archive-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",n),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(te__default.default,{href:P(i,"series"),className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all series"}),jsxRuntime.jsx("h1",{className:f("text-4xl font-light tracking-tight text-balance sm:text-5xl",F),children:s?.series.title??"Series not found"}),s?.series.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:s.series.description})]}),s?jsxRuntime.jsx("div",{className:"grid gap-5 md:grid-cols-2",children:s.articles.map(l=>jsxRuntime.jsx(Li,{article:l,basePath:i},l.id))}):jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No published articles were found for this series."})]})}function Li({article:e,basePath:t}){let r=P(t,e.slug),n=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true});return jsxRuntime.jsxs(te__default.default,{href:r,className:"group overflow-hidden rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] transition hover:border-[var(--blog-accent)] hover:no-underline",children:[e.featuredImage&&jsxRuntime.jsx("div",{className:"relative aspect-[16/9] overflow-hidden",children:jsxRuntime.jsx(At__default.default,{src:e.featuredImage,alt:e.featuredImageAlt??e.title,width:640,height:360,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"space-y-3 p-5",children:[e.series&&jsxRuntime.jsxs("span",{className:"inline-flex rounded-full border border-[var(--blog-accent-border)] px-2.5 py-1 text-xs font-medium text-[var(--blog-text-accent)]",children:["Part ",e.series.position]}),jsxRuntime.jsx("h2",{className:"text-xl font-semibold text-balance transition-colors group-hover:text-[var(--blog-accent)]",children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed",children:e.excerpt}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm",children:n})]})]})}function Pr(e){return jsxRuntime.jsx(Bt,{...e})}function ki(e="/blog"){return {title:"Series",description:"Browse related article series.",alternates:{canonical:`${e.replace(/\/$/,"")}/series`}}}function Ar(e){return jsxRuntime.jsx(It,{...e})}function Bi({title:e,description:t,slug:r,basePath:n="/blog"}){return {title:e,description:t??`Read the ${e} article series.`,alternates:{canonical:`${n.replace(/\/$/,"")}/series/${r}`}}}function Nr({author:e,articles:t,site:r,className:n,basePath:o="/blog",theme:i,pagination:s,navigation:l}){let a=_(o)||"/",u=l?.backToHome?.url??a,m=E(a,e.slug),c=s?.totalItems??t.length,g=ge(We(e,{pathPrefix:a}));return jsxRuntime.jsxs("main",{style:H(i),className:f("author-page mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",n),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-8 sm:mb-14",children:[jsxRuntime.jsxs(te__default.default,{href:u,className:"text-muted-foreground group focus-visible:ring-ring inline-flex items-center gap-2 rounded-md px-2 py-1 text-sm font-medium transition-colors hover:text-[var(--blog-accent)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"size-4 transition-transform group-hover:-translate-x-1","aria-hidden":"true"}),l?.backToHome?.label??"Back to all articles"]}),jsxRuntime.jsxs("div",{className:"grid gap-6 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-center",children:[jsxRuntime.jsx(Fi,{author:e}),jsxRuntime.jsxs("div",{className:"min-w-0 space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.isGuest&&jsxRuntime.jsx(Oe,{variant:"outline",className:"text-xs",children:"Guest Author"})}),jsxRuntime.jsx("h1",{className:f("text-4xl leading-tight font-light text-balance sm:text-5xl",F),children:e.name})]}),e.bio&&jsxRuntime.jsx("p",{className:"text-muted-foreground max-w-3xl text-lg leading-relaxed text-pretty",children:e.bio}),jsxRuntime.jsx(Di,{author:e})]})]})]}),jsxRuntime.jsx(fe,{className:"mb-8"}),jsxRuntime.jsxs("section",{"aria-labelledby":"author-articles-title",className:"space-y-6",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap items-end justify-between gap-3",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{id:"author-articles-title",className:"text-foreground text-2xl font-semibold",children:["Articles by ",e.name]}),jsxRuntime.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[c," ",c===1?"article":"articles"," on ",r.name]})]})}),t.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground border-border rounded-2xl border p-6",children:"This author does not have any published articles yet."}):jsxRuntime.jsx("div",{className:"divide-border divide-y",children:t.map(h=>jsxRuntime.jsx(Hi,{article:h,basePath:a},h.id))}),s&&s.totalPages>1&&jsxRuntime.jsx("div",{className:"pt-4",children:jsxRuntime.jsx(ve,{currentPage:s.currentPage,totalPages:s.totalPages,baseUrl:s.baseUrl??m,className:"justify-center"})})]}),jsxRuntime.jsx("script",{type:g.type,dangerouslySetInnerHTML:g.dangerouslySetInnerHTML})]})}function Di({author:e}){let t=Ui(e);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-wrap items-center gap-2","aria-label":"Author links",children:t.map(r=>jsxRuntime.jsx("a",{href:r.href,target:r.external?"_blank":void 0,rel:r.external?"noopener noreferrer":void 0,"aria-label":r.ariaLabel,className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:r.icon},r.label))})}function Ui(e){let t=e.socialLinks;return t?[t.website?{href:t.website,label:"website",ariaLabel:`${e.name}'s website`,external:true,icon:jsxRuntime.jsx(lucideReact.Globe,{className:"size-4","aria-hidden":"true"})}:null,t.x??t.twitter?{href:t.x??t.twitter??"",label:"x",ariaLabel:`${e.name} on X`,external:true,icon:jsxRuntime.jsx("span",{className:"text-sm font-semibold","aria-hidden":"true",children:"X"})}:null,t.linkedin?{href:t.linkedin,label:"linkedin",ariaLabel:`${e.name} on LinkedIn`,external:true,icon:jsxRuntime.jsx("span",{className:"text-sm font-bold","aria-hidden":"true",children:"in"})}:null,t.github?{href:t.github,label:"github",ariaLabel:`${e.name} on GitHub`,external:true,icon:jsxRuntime.jsx("span",{className:"text-xs font-bold","aria-hidden":"true",children:"GH"})}:null,t.email?{href:`mailto:${t.email}`,label:"email",ariaLabel:`Email ${e.name}`,external:false,icon:jsxRuntime.jsx(lucideReact.Mail,{className:"size-4","aria-hidden":"true"})}:null].filter(r=>r!==null):[]}function Hi({article:e,basePath:t}){let r=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true});return jsxRuntime.jsx("article",{className:"py-6 first:pt-0 last:pb-0",children:jsxRuntime.jsxs(te__default.default,{href:P(t,e.slug),className:"group grid gap-4 hover:no-underline sm:grid-cols-[minmax(0,1fr)_12rem] sm:items-start",children:[jsxRuntime.jsxs("div",{className:"min-w-0 space-y-3",children:[jsxRuntime.jsx("h3",{className:"text-xl leading-tight font-semibold text-balance transition-colors group-hover:text-[var(--blog-text-accent)]",children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 leading-relaxed",children:e.excerpt}),jsxRuntime.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",children:[jsxRuntime.jsx("time",{dateTime:e.publishedAt,children:r}),jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u2022"}),jsxRuntime.jsxs("span",{children:[Math.ceil(e.readingSeconds/60)," min read"]})]})]}),e.featuredImage&&jsxRuntime.jsx("div",{className:"border-border relative aspect-[16/10] overflow-hidden rounded-xl border bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(At__default.default,{src:e.featuredImage,alt:e.featuredImageAlt??`Featured image for ${e.title}`,width:320,height:200,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})})]})})}function Fi({author:e}){return e.avatarUrl?jsxRuntime.jsx(At__default.default,{src:e.avatarUrl,alt:e.name,width:128,height:128,className:"size-28 rounded-full border border-[var(--blog-accent-border)] object-cover sm:size-32",priority:true}):jsxRuntime.jsx("span",{className:"bg-muted text-muted-foreground inline-flex size-28 items-center justify-center rounded-full text-3xl font-semibold sm:size-32",children:ji(e.name)})}function ji(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function Gi(e,t,r="/blog"){let n=`https://${t.domain.replace(/^https?:\/\//,"").replace(/\/+$/,"")}${E(r,e.slug)}`,o=`${e.name} - ${t.name}`,i=e.bio??`Read articles by ${e.name} on ${t.name}.`;return {title:o,description:i,authors:[{name:e.name}],openGraph:{title:o,description:i,type:"profile",url:n,images:e.avatarUrl?[{url:e.avatarUrl,alt:e.name}]:void 0,siteName:t.name},twitter:{card:e.avatarUrl?"summary_large_image":"summary",title:o,description:i,images:e.avatarUrl?[e.avatarUrl]:void 0},alternates:{canonical:n}}}var tt=class{articles=new Map;operations=new Map;metadata=new Map;async saveArticle(t,r){let n=await this.checkIdempotency(r);if(n)if(n.success){if(Array.from(this.articles.values()).some(s=>s.id===t.id))return n}else return n;if(this.articles.has(t.slug)){let i={success:false,error:{code:"PUB003",message:"This URL is already in use. Please choose another."},idempotencyKey:r};return await this.storeOperationResult(r,i),i}this.articles.set(t.slug,t);let o={success:true,url:`/${t.slug}`,platformPostId:t.id,publishedAt:t.publishedAt,idempotencyKey:r};return await this.storeOperationResult(r,o),o}async getArticle(t){return this.articles.get(t)??null}async listArticles(t={}){let{limit:r=10,offset:n=0,sortBy:o="publishedAt",order:i="desc"}=t,s=Array.from(this.articles.values());return s.sort((a,u)=>{let m=new Date(a[o]).getTime(),c=new Date(u[o]).getTime();return i==="desc"?c-m:m-c}),{articles:s.slice(n,n+r),total:s.length}}async removeArticle(t,r){let n=await this.checkIdempotency(r);if(n)if(n.success){if(!this.articles.has(t))return n}else return n;if(!this.articles.has(t)){let i={success:false,error:{code:"PUB007",message:"Article not found"},idempotencyKey:r};return await this.storeOperationResult(r,i),i}this.articles.delete(t);let o={success:true,idempotencyKey:r};return await this.storeOperationResult(r,o),o}async checkIdempotency(t){return this.operations.get(t)??null}async storeOperationResult(t,r){this.operations.set(t,r);}async setMetadata(t,r){this.metadata.set(t,r);}async getMetadata(t){return this.metadata.has(t)?this.metadata.get(t):null}};function zi(){let e=globalThis;if(e.__BLOG_PLATFORM_STORAGE_WARNED__)return;e.__BLOG_PLATFORM_STORAGE_WARNED__=true;let t="Blog platform: No storage provider configured. Falling back to in-memory storage (data is not persisted).";process.env.NODE_ENV==="production"?console.error(`${t} Call initBlogPlatform({ storage: /* your persistent adapter */ }) to avoid data loss.`):console.warn(t);}function Vi(){let e=globalThis;e.__BLOG_PLATFORM_STORAGE__||(zi(),e.__BLOG_PLATFORM_STORAGE__=new tt);let t=e.__BLOG_PLATFORM_STORAGE__;if(!t)throw new Error("Blog platform storage not initialized");return t}function G(){return Vi()}function Et(e){let t=globalThis;t.__BLOG_PLATFORM_STORAGE__=e;}function Ne(e){let t=new Map;for(let r of e)r.author?.slug&&t.set(r.author.slug,Rr(t.get(r.author.slug),r.author));return Array.from(t.values()).sort((r,n)=>r.name.localeCompare(n.name))}function Tr(e,t){let r=t.filter(o=>o.author?.slug===e).sort((o,i)=>new Date(i.publishedAt).getTime()-new Date(o.publishedAt).getTime()),n=r.reduce((o,i)=>i.author?Rr(o,i.author):o,null);return n?{author:n,articles:r}:null}async function qi(e,t={},r=G()){let{articles:n}=await r.listArticles({limit:t.limit??1e3,offset:t.offset??0,sortBy:"publishedAt",order:"desc"});return Tr(e,n)}function Rr(e,t){return e?{...e,bio:e.bio??t.bio,avatarUrl:e.avatarUrl??t.avatarUrl,pronouns:e.pronouns??t.pronouns,socialLinks:e.socialLinks??t.socialLinks,toneAdjectives:e.toneAdjectives.length>0?e.toneAdjectives:t.toneAdjectives}:t}function Xi(e){let t=e.topics??[];return t.find(r=>r.isPrimary)??t[0]??null}function Te(e){let t=new Map;for(let r of e)for(let n of r.topics??[])t.has(n.slug)||t.set(n.slug,n);return Array.from(t.values()).sort((r,n)=>r.name.localeCompare(n.name))}function Ot(e,t){let r=e.filter(o=>(o.topics??[]).some(i=>i.slug===t));if(r.length===0)return null;let n=r.flatMap(o=>o.topics??[]).find(o=>o.slug===t)??null;return n?{topic:n,articles:r}:null}function Ji({articles:e,basePath:t="/blog",title:r="Topics",description:n="Browse articles by topic.",className:o,theme:i}){let s=_(t)||"/",l=Te(e);return jsxRuntime.jsxs("main",{style:H(i),className:f("blog-topics-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",o),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(te__default.default,{href:s,className:"text-muted-foreground hover:text-[var(--blog-accent)] text-sm font-medium transition-colors",children:"Back to all articles"}),jsxRuntime.jsx("h1",{className:f("text-4xl font-light tracking-tight text-balance sm:text-5xl",F),children:r}),jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:n})]}),l.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No topics have published articles yet."}):jsxRuntime.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:l.map(a=>{let u=e.filter(m=>(m.topics??[]).some(c=>c.slug===a.slug)).length;return jsxRuntime.jsxs(te__default.default,{href:P(s,`topics/${a.slug}`),className:"group rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] p-5 transition hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx("h2",{className:"group-hover:text-[var(--blog-accent)] text-xl font-semibold transition-colors",children:a.name}),a.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mt-2 line-clamp-3 text-sm leading-relaxed",children:a.description}),jsxRuntime.jsxs("p",{className:"text-muted-foreground mt-4 text-sm",children:[u," ",u===1?"article":"articles"]})]},a.slug)})})]})}function Yi({articles:e,topicSlug:t,basePath:r="/blog",className:n,theme:o}){let i=_(r)||"/",s=Ot(e,t);return jsxRuntime.jsxs("main",{style:H(o),className:f("blog-topic-archive-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",n),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(te__default.default,{href:P(i,"topics"),className:"text-muted-foreground hover:text-[var(--blog-accent)] text-sm font-medium transition-colors",children:"Back to all topics"}),jsxRuntime.jsx("h1",{className:f("text-4xl font-light tracking-tight text-balance sm:text-5xl",F),children:s?.topic.name??"Topic not found"}),s?.topic.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:s.topic.description})]}),s?jsxRuntime.jsx("div",{className:"grid gap-5 md:grid-cols-2",children:s.articles.map(l=>jsxRuntime.jsx(Qi,{article:l,topic:s.topic,basePath:i},l.id))}):jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No published articles were found for this topic."})]})}function Qi({article:e,topic:t,basePath:r}){let n=P(r,e.slug),o=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true});return jsxRuntime.jsxs(te__default.default,{href:n,className:"group overflow-hidden rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] transition hover:border-[var(--blog-accent)] hover:no-underline",children:[e.featuredImage&&jsxRuntime.jsx("div",{className:"relative aspect-[16/9] overflow-hidden",children:jsxRuntime.jsx(At__default.default,{src:e.featuredImage,alt:e.featuredImageAlt??e.title,width:640,height:360,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"space-y-3 p-5",children:[jsxRuntime.jsx("span",{className:"inline-flex rounded-full border border-[var(--blog-accent-border)] px-2.5 py-1 text-xs font-medium text-[var(--blog-text-accent)]",children:t.name}),jsxRuntime.jsx("h2",{className:"group-hover:text-[var(--blog-accent)] text-xl font-semibold text-balance transition-colors",children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed",children:e.excerpt}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm",children:o})]})]})}function eo({articles:e,basePath:t="/blog",title:r="Authors",description:n="Browse articles by author.",className:o,theme:i}){let s=_(t)||"/",l=Ne(e);return jsxRuntime.jsxs("main",{style:H(i),className:f("blog-authors-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",o),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(te__default.default,{href:s,className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all articles"}),jsxRuntime.jsx("h1",{className:f("text-4xl font-light tracking-tight text-balance sm:text-5xl",F),children:r}),jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:n})]}),l.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No authors have published articles yet."}):jsxRuntime.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:l.map(a=>{let u=e.filter(m=>m.author?.slug===a.slug).length;return jsxRuntime.jsx(te__default.default,{href:E(s,a.slug),className:"group rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] p-5 transition hover:border-[var(--blog-accent)] hover:no-underline",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-4",children:[jsxRuntime.jsx(to,{author:a}),jsxRuntime.jsxs("div",{className:"min-w-0 space-y-2",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold transition-colors group-hover:text-[var(--blog-accent)]",children:a.name}),a.bio&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed",children:a.bio}),jsxRuntime.jsxs("p",{className:"text-muted-foreground text-sm",children:[u," ",u===1?"article":"articles"]})]})]})},a.slug)})})]})}function to({author:e}){let t=ro(e.name);return e.avatarUrl?jsxRuntime.jsx(At__default.default,{src:e.avatarUrl,alt:e.name,width:56,height:56,className:"size-14 shrink-0 rounded-full border border-[var(--blog-accent-border)] object-cover"}):jsxRuntime.jsx("span",{className:"bg-muted text-muted-foreground inline-flex size-14 shrink-0 items-center justify-center rounded-full text-base font-semibold",children:t})}function ro(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function q(e){return `sha256:${crypto.createHash("sha256").update(e).digest("hex")}`}function Mt(e){let t=e.headers.get("Authorization");if(!t)return null;let n=/^Bearer\s+(.+)$/i.exec(t);if(n?.[1])return n[1];let i=/^Token\s+(.+)$/i.exec(t);return i?.[1]?i[1]:null}var nt=class{validApiKeys;constructor(t){this.validApiKeys=new Set(t);}async validateToken(t){return t?.trim()?this.validApiKeys.has(t)?{valid:true,context:{tokenHash:this.hashToken(t)}}:{valid:false,errorCode:"invalid"}:{valid:false,errorCode:"missing"}}extractToken=t=>Mt(t);hashToken(t){return q(t)}},Re=class extends nt{constructor(t="BLOG_PLATFORM_API_KEYS"){let r=process.env[t];!r&&t==="BLOG_PLATFORM_API_KEYS"&&(r=process.env.BLOG_AUTH_TOKEN);let n=r?r.split(",").map(o=>o.trim()).filter(Boolean):[];n.length===0&&console.warn(`\u26A0\uFE0F No API keys found in environment variable ${t}${t==="BLOG_PLATFORM_API_KEYS"?" (set BLOG_PLATFORM_API_KEYS or BLOG_AUTH_TOKEN)":""}. Authentication will fail for all requests.`),super(n);}},Fe=class{async validateToken(){return {valid:true,context:{development:true}}}extractToken(){return "development-mode"}},it=class{hasWarned=false;async validateToken(t){return this.hasWarned||(console.error("\u274C SECURITY WARNING: Blog platform authentication not initialized! All requests will be rejected. Call initBlogPlatform() to configure authentication."),this.hasWarned=true),{valid:false,errorCode:"invalid"}}};function io(){return globalThis.__BLOG_PLATFORM_AUTH_CONFIG__??=new it,globalThis.__BLOG_PLATFORM_AUTH_CONFIG__}function ot(e){globalThis.__BLOG_PLATFORM_AUTH_CONFIG__=e;}function $t(){return globalThis.__BLOG_PLATFORM_AUTH_CONFIG__??io()}function oo(e){ot(new Re(e));}async function Y(e){let t=$t(),r=t.extractToken?t.extractToken(e):Mt(e);if(!r)return {authenticated:false,result:{valid:false,errorCode:"missing"},token:null};let n=await t.validateToken(r);return {authenticated:n.valid,result:n,token:r}}function so(e,t=""){let n=$t().errorMessages??{},o,i;switch(e.errorCode){case "missing":o=n.missing??"Authentication token is required",i="PUB005";break;case "expired":o=n.expired??"Authentication token has expired",i="PUB005";break;default:o=n.invalid??"Invalid authentication credentials",i="PUB005";break}return {success:false,error:{code:i,message:o,details:{authError:e.errorCode??"invalid"}},idempotencyKey:t}}async function re(e){let t=await Y(e);return t.authenticated?{authenticated:true,context:t.result.context}:{authenticated:false,error:so(t.result)}}function ao(){let e=process.env.SKIP_BLOG_PLATFORM_AUTH;return e==="true"||e==="1"||process.env.NODE_ENV==="test"}function co(){return globalThis.__BLOG_PLATFORM_RATE_LIMITER__??null}function uo(e){let t=globalThis;t.__BLOG_PLATFORM_RATE_LIMITER__=e;}function st(e){let{redisUrl:t,redisToken:r,requestsPerMinute:n=5,keyPrefix:o="blog-platform-ratelimit",analytics:i=true}=e,s=new redis.Redis({url:t,token:r}),l=new ratelimit.Ratelimit({redis:s,analytics:i,prefix:o,limiter:ratelimit.Ratelimit.slidingWindow(n,"1m")});uo(l);}function Dt(){let e=process.env.UPSTASH_REDIS_REST_URL,t=process.env.UPSTASH_REDIS_REST_TOKEN;if(!e||!t){console.warn("Blog platform: No Upstash Redis configuration found. Rate limiting disabled.");return}st({redisUrl:e,redisToken:t}),console.log("Blog platform: Rate limiting configured (5 requests per minute per token)");}async function kr(e){let t=co();if(!t)return console.warn("Blog platform: Rate limiter not configured. All requests allowed."),{success:true,remaining:999,reset:Date.now()+6e4,limit:5,count:0};try{let r=await t.limit(e);return {success:r.success,remaining:r.remaining,reset:r.reset,limit:r.limit,count:r.limit-r.remaining}}catch(r){return console.error("Blog platform: Rate limit check failed:",r),{success:true,remaining:0,reset:Date.now()+6e4,limit:5,count:0}}}function _r(e,t=""){let r=Math.ceil((e.reset-Date.now())/6e4);return {success:false,error:{code:"PUB011",message:`Rate limit exceeded. You can make ${e.limit} requests per minute. Try again in ${r} minute(s).`,details:{rateLimit:e}},idempotencyKey:t}}async function Q(e,t=""){let r=await kr(e);return r.success?{allowed:true,rateLimitResult:r}:{allowed:false,errorResponse:_r(r,t)}}function $(e){return {"X-RateLimit-Limit":e.limit.toString(),"X-RateLimit-Remaining":e.remaining.toString(),"X-RateLimit-Reset":e.reset.toString(),"Retry-After":Math.ceil((e.reset-Date.now())/1e3).toString()}}function at(e){let{auth:t,storage:r,rateLimit:n,autoRateLimit:o=true}=e;if(!t)throw new Error(`Blog platform initialization failed: 'auth' is required.
|
|
39
|
+
`}),jsxRuntime.jsxs("header",{className:"article-header mx-auto mb-6 max-w-4xl space-y-4 text-center sm:mb-8 sm:space-y-6 lg:mb-12 lg:space-y-8",children:[jsxRuntime.jsx("h1",{className:p("article-title px-4 text-2xl leading-tight font-light tracking-tight text-balance sm:px-0 sm:text-3xl md:text-4xl lg:text-5xl xl:text-6xl",D),children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"article-excerpt text-muted-foreground mx-auto mt-6 max-w-[42rem] px-4 text-lg leading-relaxed text-balance sm:mt-8 sm:max-w-[46rem] sm:px-0 sm:text-xl md:max-w-[52rem] md:text-2xl lg:max-w-4xl lg:text-2xl",children:e.excerpt}),jsxRuntime.jsxs("div",{className:"article-meta text-muted-foreground flex flex-col items-center gap-2 text-sm sm:gap-3 sm:text-base",children:[e.author&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:"sr-only",children:"Author"}),jsxRuntime.jsxs(re__default.default,{href:B(d,e.author.slug),className:"inline-flex items-center gap-2 font-medium transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx(kr,{author:e.author,size:"md"}),e.author.name]}),e.author.isGuest&&jsxRuntime.jsx(Oe,{variant:"outline",className:"text-xs",children:"Guest Author"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-3 gap-y-1",children:[jsxRuntime.jsxs("time",{dateTime:e.publishedAt,className:"font-medium","aria-label":`Published ${h.publishedDateLabel}`,children:["Published ",h.publishedDateLabel]}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:h.publishedRelativeLabel}),jsxRuntime.jsx("span",{className:"text-border",children:"\u2022"}),jsxRuntime.jsx("span",{className:"font-medium",children:y})]}),h.isUpdated&&jsxRuntime.jsxs("time",{dateTime:e.updatedAt,className:"text-xs",children:["Updated ",h.updatedDateLabel]}),c&&jsxRuntime.jsx(rt,{title:e.title,url:g,size:"sm"}),jsxRuntime.jsx("div",{className:"bg-border h-px w-6 sm:w-8","aria-hidden":"true"}),(e.topics??[]).length>0?jsxRuntime.jsx("nav",{"aria-label":"Article topics",className:"flex flex-wrap justify-center gap-2",children:(e.topics??[]).map(j=>jsxRuntime.jsx(re__default.default,{href:v((r?.backToHome?.url??"/blog").replace(/\/$/,""),`topics/${j.slug}`),className:"rounded-full border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] px-3 py-1 text-xs font-medium text-[var(--blog-text-accent)] transition-colors hover:border-[var(--blog-text-accent)] hover:text-[var(--blog-text-accent-hover)]",children:j.name},j.id))}):jsxRuntime.jsxs("span",{className:"text-xs tracking-wider uppercase sm:text-sm",role:"text",children:["From ",e.site.name]})]})]}),e.video&&W(e.video.id)?jsxRuntime.jsxs("figure",{className:"article-featured-video mx-auto my-8 w-full max-w-4xl sm:my-12 lg:my-16",children:[jsxRuntime.jsx(wr,{video:e.video,posterSrc:I,posterAlt:e.featuredImageAlt??`Video poster for ${e.title}`}),I&&E]}):I&&jsxRuntime.jsxs("figure",{className:"article-featured-image mx-auto my-8 w-full max-w-4xl sm:my-12 lg:my-16",children:[jsxRuntime.jsx(Et__default.default,{src:I,alt:e.featuredImageAlt??`Featured image for ${e.title}`,className:"h-auto w-full rounded-3xl border border-[var(--blog-accent-border)] shadow-[0_24px_80px_rgb(168_85_247_/_0.14)]",width:1200,height:800,priority:true}),E]}),jsxRuntime.jsxs("div",{id:"article-content",className:"article-content mx-auto grid max-w-6xl grid-cols-1 gap-8 lg:grid-cols-[minmax(0,1fr)_14rem] lg:gap-12",children:[jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx(Mt,{items:f,contentId:"article-body",variant:"mobile"}),jsxRuntime.jsx("div",{id:"article-body",className:"prose prose-sm sm:prose-base lg:prose-lg xl:prose-xl prose-gray dark:prose-invert prose-headings:scroll-mt-20 prose-headings:font-light prose-headings:text-balance prose-headings:text-[var(--blog-text-accent)] prose-h1:text-2xl sm:prose-h1:text-3xl lg:prose-h1:text-4xl prose-h2:text-xl sm:prose-h2:text-2xl lg:prose-h2:text-3xl prose-h3:text-lg sm:prose-h3:text-xl lg:prose-h3:text-2xl prose-p:leading-relaxed prose-p:text-pretty prose-a:text-[var(--blog-text-accent)] prose-a:transition-colors hover:prose-a:text-[var(--blog-text-accent-hover)] [&_figcaption]:text-muted-foreground [&_figcaption_.blog-image-credit]:text-muted-foreground/80 [&_figcaption>span:not(.blog-image-credit)]:text-muted-foreground/80 max-w-none [&_figcaption]:!mt-2 [&_figcaption]:text-center [&_figcaption]:!text-sm [&_figcaption]:!leading-snug [&_figcaption_.blog-image-credit]:mt-1 [&_figcaption_.blog-image-credit]:block [&_figcaption_.blog-image-credit]:text-xs [&_figcaption_.blog-image-credit]:tracking-wide [&_figcaption>span:not(.blog-image-credit)]:ml-2 [&_figcaption>span:not(.blog-image-credit)]:border-l [&_figcaption>span:not(.blog-image-credit)]:border-[var(--blog-accent-border)] [&_figcaption>span:not(.blog-image-credit)]:pl-2 [&_figcaption>span:not(.blog-image-credit)]:text-xs [&_figcaption>span:not(.blog-image-credit)]:tracking-wide [&_figure>p]:!my-0",children:jsxRuntime.jsx(rsc.MDXRemote,{source:e.content,options:Nr,components:{img:Pr}})})]}),jsxRuntime.jsx(Mt,{items:f,contentId:"article-body",variant:"desktop",showProgress:false})]}),jsxRuntime.jsx(Ut,{article:e,basePath:d,className:"mx-auto mt-12 max-w-4xl"}),e.author?.bio&&jsxRuntime.jsxs("div",{id:"about-author",className:"author-bio mx-auto mt-12 max-w-4xl",children:[jsxRuntime.jsx(he,{className:"mb-8"}),jsxRuntime.jsx(Me,{className:"border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsxs($e,{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-start sm:p-6",children:[jsxRuntime.jsx("div",{className:"shrink-0",children:jsxRuntime.jsx(kr,{author:e.author,size:"lg"})}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[jsxRuntime.jsxs("div",{className:"min-w-0",children:[jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm font-medium",children:"Written by"}),jsxRuntime.jsxs("h2",{className:"text-foreground flex flex-wrap items-center gap-2 text-xl font-semibold",children:[jsxRuntime.jsx(re__default.default,{href:B(d,e.author.slug),className:"transition-colors hover:text-[var(--blog-accent)] hover:no-underline",children:e.author.name}),e.author.isGuest&&jsxRuntime.jsx(Oe,{variant:"outline",className:"text-xs",children:"Guest Author"})]})]}),jsxRuntime.jsx(zo,{author:e.author})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.author.bio})]})]})})]}),((T??false)||(b?.enabled??false)||c||X.length>0)&&jsxRuntime.jsxs("div",{className:"mx-auto mt-12 max-w-4xl space-y-8",children:[jsxRuntime.jsx(he,{}),T&&jsxRuntime.jsx(Wo,{cta:T}),b?.enabled&&jsxRuntime.jsx(Ee,{siteId:e.site.id,settings:b,sourceSurface:"article",sourceArticleSlug:e.slug,sourceUrl:g,previewMode:l}),c&&jsxRuntime.jsx(Ko,{title:e.title,url:g}),X.length>0&&jsxRuntime.jsx(Jo,{articles:X,basePath:d})]}),(!!r?.previousArticle||!!r?.nextArticle)&&jsxRuntime.jsxs("nav",{className:"article-nav mx-auto mt-12 max-w-4xl",children:[jsxRuntime.jsx(he,{className:"mb-8"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[r?.previousArticle&&jsxRuntime.jsx(Me,{className:"group cursor-pointer transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsxs(re__default.default,{href:r.previousArticle.url,className:"block",children:[r.previousArticle.featuredImage&&jsxRuntime.jsx(Vt,{src:r.previousArticle.featuredImage,alt:r.previousArticle.featuredImageAlt??`Featured image for ${r.previousArticle.title}`}),jsxRuntime.jsxs($e,{className:"p-4",children:[jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"\u2190 Previous Article"}),jsxRuntime.jsx("div",{className:"text-foreground transition-colors group-hover:text-[var(--blog-text-accent)]",children:r.previousArticle.title})]})]})}),r?.nextArticle&&jsxRuntime.jsx(Me,{className:p("group cursor-pointer transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",!r?.previousArticle&&"md:col-start-2"),children:jsxRuntime.jsxs(re__default.default,{href:r.nextArticle.url,className:"block",children:[r.nextArticle.featuredImage&&jsxRuntime.jsx(Vt,{src:r.nextArticle.featuredImage,alt:r.nextArticle.featuredImageAlt??`Featured image for ${r.nextArticle.title}`}),jsxRuntime.jsxs($e,{className:"p-4 md:text-right",children:[jsxRuntime.jsx("div",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Next Article \u2192"}),jsxRuntime.jsx("div",{className:"text-foreground transition-colors group-hover:text-[var(--blog-text-accent)]",children:r.nextArticle.title})]})]})})]})]}),(()=>{let j=ge(Lt(e,{customDomain:e.site.domain,pathPrefix:d}));return jsxRuntime.jsx("script",{type:j.type,dangerouslySetInnerHTML:j.dangerouslySetInnerHTML})})()]})}function kr({author:e,size:t}){let r=t==="lg"?"h-12 w-12 text-base":"h-9 w-9 text-sm",i=Xo(e.name);return e.avatarUrl?jsxRuntime.jsx(Et__default.default,{src:e.avatarUrl,alt:e.name,width:t==="lg"?48:36,height:t==="lg"?48:36,className:p("shrink-0 rounded-full object-cover",r),loading:"lazy"}):jsxRuntime.jsx("span",{className:p("bg-muted text-muted-foreground inline-flex shrink-0 items-center justify-center rounded-full font-medium",r),"aria-hidden":"true",children:i})}function zo({author:e}){let t=qo(e);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-wrap items-center gap-1 sm:justify-end",children:t.map(r=>jsxRuntime.jsx("a",{href:r.href,target:r.external?"_blank":void 0,rel:r.external?"noopener noreferrer":void 0,"aria-label":`${e.name} ${r.label}`,className:"text-muted-foreground hover:bg-background/60 hover:text-foreground inline-flex size-7 items-center justify-center rounded-full transition-colors",children:r.icon},r.key))})}function qo(e){let t=e.socialLinks;return t?[t.website?{key:"website",href:t.website,label:"website",external:true,icon:jsxRuntime.jsx(lucideReact.Globe,{className:"size-4","aria-hidden":"true"})}:void 0,t.x?{key:"x",href:t.x,label:"on X",external:true,icon:jsxRuntime.jsx(fa6.FaXTwitter,{className:"size-4","aria-hidden":"true"})}:void 0,t.linkedin?{key:"linkedin",href:t.linkedin,label:"on LinkedIn",external:true,icon:jsxRuntime.jsx(fa6.FaLinkedinIn,{className:"size-4","aria-hidden":"true"})}:void 0,t.github?{key:"github",href:t.github,label:"on GitHub",external:true,icon:jsxRuntime.jsx(fa6.FaGithub,{className:"size-4","aria-hidden":"true"})}:void 0,t.email?{key:"email",href:`mailto:${t.email}`,label:"email",external:false,icon:jsxRuntime.jsx(lucideReact.Mail,{className:"size-4","aria-hidden":"true"})}:void 0].filter(i=>!!i):[]}function Xo(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function Wo({cta:e}){return jsxRuntime.jsx("div",{className:"rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-accent-bg)] p-5 sm:p-6",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsx("h2",{className:"text-foreground text-xl font-semibold",children:e.title}),e.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground leading-relaxed",children:e.description})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 flex-col gap-2 sm:flex-row",children:[e.primary&&jsxRuntime.jsxs(re__default.default,{href:e.primary.href,className:"inline-flex items-center justify-center gap-2 rounded-full bg-[var(--blog-accent)] px-4 py-2 text-sm font-semibold text-white transition-opacity hover:opacity-90",children:[e.primary.label,jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"size-4","aria-hidden":"true"})]}),e.secondary&&jsxRuntime.jsxs(re__default.default,{href:e.secondary.href,className:"border-border bg-background text-foreground hover:bg-muted inline-flex items-center justify-center gap-2 rounded-full border px-4 py-2 text-sm font-semibold transition-colors",children:[e.secondary.label,jsxRuntime.jsx(lucideReact.ArrowUpRight,{className:"size-4","aria-hidden":"true"})]})]})]})})}function Ko({title:e,url:t}){let r=encodeURIComponent(e),i=encodeURIComponent(t);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-3",children:[jsxRuntime.jsx(rt,{title:e,url:t,size:"sm"}),jsxRuntime.jsx("a",{href:`https://x.com/intent/tweet?text=${r}&url=${i}`,target:"_blank",rel:"noopener noreferrer","aria-label":"Share on X",className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(fa6.FaXTwitter,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsx("a",{href:`https://www.linkedin.com/sharing/share-offsite/?url=${i}`,target:"_blank",rel:"noopener noreferrer","aria-label":"Share on LinkedIn",className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(fa6.FaLinkedinIn,{className:"size-4","aria-hidden":"true"})}),jsxRuntime.jsx("a",{href:`mailto:?subject=${r}&body=${i}`,"aria-label":"Share by email",className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(lucideReact.Mail,{className:"size-4","aria-hidden":"true"})})]})}function Jo({articles:e,basePath:t}){return jsxRuntime.jsxs("section",{className:"space-y-4","aria-labelledby":"related-articles-title",children:[jsxRuntime.jsx("h2",{id:"related-articles-title",className:"text-xl font-semibold",children:"You might also like"}),jsxRuntime.jsx("div",{className:"grid gap-4 md:grid-cols-3",children:e.map(r=>jsxRuntime.jsxs(re__default.default,{href:v(t,r.slug),className:"group border-border overflow-hidden rounded-2xl border transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)] hover:no-underline",children:[r.featuredImage&&jsxRuntime.jsx(Vt,{src:r.featuredImage,alt:r.featuredImageAlt??`Featured image for ${r.title}`}),jsxRuntime.jsxs("div",{className:"p-4",children:[jsxRuntime.jsx("h3",{className:"text-foreground line-clamp-3 font-semibold transition-colors group-hover:text-[var(--blog-text-accent)]",children:r.title}),r.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground mt-2 line-clamp-3 text-sm leading-relaxed",children:r.excerpt})]})]},r.id))})]})}function Vt({src:e,alt:t}){return jsxRuntime.jsx("div",{className:"border-border aspect-[16/9] overflow-hidden border-b bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(Et__default.default,{src:e,alt:t,width:480,height:270,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})})}function Yo(e,t="/blog"){let r=e.meta.title??e.title,i=e.meta.description??e.excerpt,n=e.meta.canonicalUrl??`${e.site.domain}${v(t,e.slug)}`,o=e.meta.ogImage??e.featuredImage;return {title:r,description:i,keywords:e.meta.keywords.join(", "),authors:e.author?[{name:e.author.name}]:void 0,openGraph:{title:r,description:i,type:"article",url:n,images:o?[{url:o,alt:e.featuredImageAlt??r}]:void 0,publishedTime:e.publishedAt,modifiedTime:e.updatedAt,authors:e.author?[e.author.name]:void 0,siteName:e.site.name},twitter:{card:"summary_large_image",title:r,description:i,images:o?[o]:void 0},alternates:{canonical:n}}}function ot({articles:e,title:t,kind:r,slug:i,basePath:n}){let o=e[0]?.site;if(!o)return null;let s=o.domain,l=v(n,`${r}/${i}`),a={"@context":"https://schema.org","@type":"CollectionPage",name:t,url:`https://${s}${l}`,mainEntity:{"@type":"ItemList",itemListElement:e.map((c,d)=>({"@type":"ListItem",position:d+1,name:c.title,url:`https://${s}${v(n,c.slug)}`}))}},u=Ye([{name:"Home",url:"/"},{name:o.name,url:n},{name:r==="topics"?"Topics":"Series",url:v(n,r)},{name:t,url:l}],{customDomain:s});return jsxRuntime.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:Qe([a,u])}})}function Ne(e){let t=new Map;for(let r of e)r.series&&(!t.has(r.series.slug)||r.series.articles.length>(t.get(r.series.slug)?.articles.length??0))&&t.set(r.series.slug,r.series);return Array.from(t.values()).sort((r,i)=>r.title.localeCompare(i.title))}function Ft(e,t){let r=e.filter(n=>n.series?.slug===t).sort((n,o)=>(n.series?.position??0)-(o.series?.position??0));if(r.length===0)return null;let i=r[0]?.series;return i?{series:i,articles:r}:null}function Zo(e){return e.series??null}function Gt({articles:e,basePath:t="/blog",title:r="Series",description:i="Browse related article series.",className:n,theme:o}){let s=k(t)||"/",l=Ne(e);return jsxRuntime.jsxs("main",{style:$(o),className:p("blog-series-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",n),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(re__default.default,{href:s,className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all articles"}),jsxRuntime.jsx("h1",{className:p("text-4xl font-light tracking-tight text-balance sm:text-5xl",D),children:r}),jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:i})]}),l.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No series have published articles yet."}):jsxRuntime.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:l.map(a=>jsxRuntime.jsxs(re__default.default,{href:le(s,a.slug),className:"group rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] p-5 transition hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsxs("p",{className:"text-muted-foreground mb-2 text-sm font-medium",children:[a.total," ",a.total===1?"article":"articles"]}),jsxRuntime.jsx("h2",{className:"text-xl font-semibold transition-colors group-hover:text-[var(--blog-accent)]",children:a.title}),a.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mt-2 line-clamp-3 text-sm leading-relaxed",children:a.description})]},a.slug))})]})}function zt({articles:e,seriesSlug:t,basePath:r="/blog",className:i,theme:n}){let o=k(r)||"/",s=Ft(e,t);return jsxRuntime.jsxs("main",{style:$(n),className:p("blog-series-archive-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",i),children:[s&&jsxRuntime.jsx(ot,{articles:s.articles,title:s.series.title,kind:"series",slug:t,basePath:o}),jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(re__default.default,{href:v(o,"series"),className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all series"}),jsxRuntime.jsx("h1",{className:p("text-4xl font-light tracking-tight text-balance sm:text-5xl",D),children:s?.series.title??"Series not found"}),s?.series.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:s.series.description})]}),s?jsxRuntime.jsx("div",{className:"grid gap-5 md:grid-cols-2",children:s.articles.map(l=>jsxRuntime.jsx(rn,{article:l,basePath:o},l.id))}):jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No published articles were found for this series."})]})}function rn({article:e,basePath:t}){let r=v(t,e.slug),i=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true});return jsxRuntime.jsxs(re__default.default,{href:r,className:"group overflow-hidden rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] transition hover:border-[var(--blog-accent)] hover:no-underline",children:[e.featuredImage&&jsxRuntime.jsx("div",{className:"relative aspect-[16/9] overflow-hidden",children:jsxRuntime.jsx(Et__default.default,{src:e.featuredImage,alt:e.featuredImageAlt??e.title,width:640,height:360,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"space-y-3 p-5",children:[e.series&&jsxRuntime.jsxs("span",{className:"inline-flex rounded-full border border-[var(--blog-accent-border)] px-2.5 py-1 text-xs font-medium text-[var(--blog-text-accent)]",children:["Part ",e.series.position]}),jsxRuntime.jsx("h2",{className:"text-xl font-semibold text-balance transition-colors group-hover:text-[var(--blog-accent)]",children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed",children:e.excerpt}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm",children:i})]})]})}function Mr(e){return jsxRuntime.jsx(Gt,{...e})}function on(e="/blog"){return {title:"Series",description:"Browse related article series.",alternates:{canonical:`${e.replace(/\/$/,"")}/series`}}}function $r(e){return jsxRuntime.jsx(zt,{...e})}function sn({title:e,description:t,slug:r,basePath:i="/blog"}){return {title:e,description:t??`Read the ${e} article series.`,alternates:{canonical:`${i.replace(/\/$/,"")}/series/${r}`}}}function Hr({author:e,articles:t,site:r,className:i,basePath:n="/blog",theme:o,pagination:s,navigation:l}){let a=k(n)||"/",u=l?.backToHome?.url??a,c=B(a,e.slug),d=s?.totalItems??t.length,h=ge(Je(e,{pathPrefix:a}));return jsxRuntime.jsxs("main",{style:$(o),className:p("author-page mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",i),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-8 sm:mb-14",children:[jsxRuntime.jsxs(re__default.default,{href:u,className:"text-muted-foreground group focus-visible:ring-ring inline-flex items-center gap-2 rounded-md px-2 py-1 text-sm font-medium transition-colors hover:text-[var(--blog-accent)] focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",children:[jsxRuntime.jsx(lucideReact.ArrowLeft,{className:"size-4 transition-transform group-hover:-translate-x-1","aria-hidden":"true"}),l?.backToHome?.label??"Back to all articles"]}),jsxRuntime.jsxs("div",{className:"grid gap-6 sm:grid-cols-[auto_minmax(0,1fr)] sm:items-center",children:[jsxRuntime.jsx(fn,{author:e}),jsxRuntime.jsxs("div",{className:"min-w-0 space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.isGuest&&jsxRuntime.jsx(Oe,{variant:"outline",className:"text-xs",children:"Guest Author"})}),jsxRuntime.jsx("h1",{className:p("text-4xl leading-tight font-light text-balance sm:text-5xl",D),children:e.name})]}),e.bio&&jsxRuntime.jsx("p",{className:"text-muted-foreground max-w-3xl text-lg leading-relaxed text-pretty",children:e.bio}),jsxRuntime.jsx(mn,{author:e})]})]})]}),jsxRuntime.jsx(he,{className:"mb-8"}),jsxRuntime.jsxs("section",{"aria-labelledby":"author-articles-title",className:"space-y-6",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap items-end justify-between gap-3",children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{id:"author-articles-title",className:"text-foreground text-2xl font-semibold",children:["Articles by ",e.name]}),jsxRuntime.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:[d," ",d===1?"article":"articles"," on ",r.name]})]})}),t.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground border-border rounded-2xl border p-6",children:"This author does not have any published articles yet."}):jsxRuntime.jsx("div",{className:"divide-border divide-y",children:t.map(y=>jsxRuntime.jsx(gn,{article:y,basePath:a},y.id))}),s&&s.totalPages>1&&jsxRuntime.jsx("div",{className:"pt-4",children:jsxRuntime.jsx(Pe,{currentPage:s.currentPage,totalPages:s.totalPages,baseUrl:s.baseUrl??c,className:"justify-center"})})]}),jsxRuntime.jsx("script",{type:h.type,dangerouslySetInnerHTML:h.dangerouslySetInnerHTML})]})}function mn({author:e}){let t=pn(e);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-wrap items-center gap-2","aria-label":"Author links",children:t.map(r=>jsxRuntime.jsx("a",{href:r.href,target:r.external?"_blank":void 0,rel:r.external?"noopener noreferrer":void 0,"aria-label":r.ariaLabel,className:"text-muted-foreground hover:text-foreground border-border inline-flex size-9 items-center justify-center rounded-full border grayscale transition-colors hover:border-[var(--blog-accent-border)] hover:bg-[var(--blog-accent-bg)]",children:r.icon},r.label))})}function pn(e){let t=e.socialLinks;return t?[t.website?{href:t.website,label:"website",ariaLabel:`${e.name}'s website`,external:true,icon:jsxRuntime.jsx(lucideReact.Globe,{className:"size-4","aria-hidden":"true"})}:null,t.x??t.twitter?{href:t.x??t.twitter??"",label:"x",ariaLabel:`${e.name} on X`,external:true,icon:jsxRuntime.jsx("span",{className:"text-sm font-semibold","aria-hidden":"true",children:"X"})}:null,t.linkedin?{href:t.linkedin,label:"linkedin",ariaLabel:`${e.name} on LinkedIn`,external:true,icon:jsxRuntime.jsx("span",{className:"text-sm font-bold","aria-hidden":"true",children:"in"})}:null,t.github?{href:t.github,label:"github",ariaLabel:`${e.name} on GitHub`,external:true,icon:jsxRuntime.jsx("span",{className:"text-xs font-bold","aria-hidden":"true",children:"GH"})}:null,t.email?{href:`mailto:${t.email}`,label:"email",ariaLabel:`Email ${e.name}`,external:false,icon:jsxRuntime.jsx(lucideReact.Mail,{className:"size-4","aria-hidden":"true"})}:null].filter(r=>r!==null):[]}function gn({article:e,basePath:t}){let r=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true});return jsxRuntime.jsx("article",{className:"py-6 first:pt-0 last:pb-0",children:jsxRuntime.jsxs(re__default.default,{href:v(t,e.slug),className:"group grid gap-4 hover:no-underline sm:grid-cols-[minmax(0,1fr)_12rem] sm:items-start",children:[jsxRuntime.jsxs("div",{className:"min-w-0 space-y-3",children:[jsxRuntime.jsx("h3",{className:"text-xl leading-tight font-semibold text-balance transition-colors group-hover:text-[var(--blog-text-accent)]",children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 leading-relaxed",children:e.excerpt}),jsxRuntime.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1 text-sm",children:[jsxRuntime.jsx("time",{dateTime:e.publishedAt,children:r}),jsxRuntime.jsx("span",{"aria-hidden":"true",children:"\u2022"}),jsxRuntime.jsxs("span",{children:[Math.ceil(e.readingSeconds/60)," min read"]})]})]}),e.featuredImage&&jsxRuntime.jsx("div",{className:"border-border relative aspect-[16/10] overflow-hidden rounded-xl border bg-[var(--blog-accent-bg)]",children:jsxRuntime.jsx(Et__default.default,{src:e.featuredImage,alt:e.featuredImageAlt??`Featured image for ${e.title}`,width:320,height:200,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})})]})})}function fn({author:e}){return e.avatarUrl?jsxRuntime.jsx(Et__default.default,{src:e.avatarUrl,alt:e.name,width:128,height:128,className:"size-28 rounded-full border border-[var(--blog-accent-border)] object-cover sm:size-32",priority:true}):jsxRuntime.jsx("span",{className:"bg-muted text-muted-foreground inline-flex size-28 items-center justify-center rounded-full text-3xl font-semibold sm:size-32",children:hn(e.name)})}function hn(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function bn(e,t,r="/blog"){let i=`https://${t.domain.replace(/^https?:\/\//,"").replace(/\/+$/,"")}${B(r,e.slug)}`,n=`${e.name} - ${t.name}`,o=e.bio??`Read articles by ${e.name} on ${t.name}.`;return {title:n,description:o,authors:[{name:e.name}],openGraph:{title:n,description:o,type:"profile",url:i,images:e.avatarUrl?[{url:e.avatarUrl,alt:e.name}]:void 0,siteName:t.name},twitter:{card:e.avatarUrl?"summary_large_image":"summary",title:n,description:o,images:e.avatarUrl?[e.avatarUrl]:void 0},alternates:{canonical:i}}}var st=class{articles=new Map;operations=new Map;metadata=new Map;async saveArticle(t,r){let i=await this.checkIdempotency(r);if(i)if(i.success){if(Array.from(this.articles.values()).some(s=>s.id===t.id))return i}else return i;if(this.articles.has(t.slug)){let o={success:false,error:{code:"PUB003",message:"This URL is already in use. Please choose another."},idempotencyKey:r};return await this.storeOperationResult(r,o),o}this.articles.set(t.slug,t);let n={success:true,url:`/${t.slug}`,platformPostId:t.id,publishedAt:t.publishedAt,idempotencyKey:r};return await this.storeOperationResult(r,n),n}async getArticle(t){return this.articles.get(t)??null}async listArticles(t={}){let{limit:r=10,offset:i=0,sortBy:n="publishedAt",order:o="desc"}=t,s=Array.from(this.articles.values());return s.sort((a,u)=>{let c=new Date(a[n]).getTime(),d=new Date(u[n]).getTime();return o==="desc"?d-c:c-d}),{articles:s.slice(i,i+r),total:s.length}}async removeArticle(t,r){let i=await this.checkIdempotency(r);if(i)if(i.success){if(!this.articles.has(t))return i}else return i;if(!this.articles.has(t)){let o={success:false,error:{code:"PUB007",message:"Article not found"},idempotencyKey:r};return await this.storeOperationResult(r,o),o}this.articles.delete(t);let n={success:true,idempotencyKey:r};return await this.storeOperationResult(r,n),n}async checkIdempotency(t){return this.operations.get(t)??null}async storeOperationResult(t,r){this.operations.set(t,r);}async setMetadata(t,r){this.metadata.set(t,r);}async getMetadata(t){return this.metadata.has(t)?this.metadata.get(t):null}};function xn(){let e=globalThis;if(e.__BLOG_PLATFORM_STORAGE_WARNED__)return;e.__BLOG_PLATFORM_STORAGE_WARNED__=true;let t="Blog platform: No storage provider configured. Falling back to in-memory storage (data is not persisted).";process.env.NODE_ENV==="production"?console.error(`${t} Call initBlogPlatform({ storage: /* your persistent adapter */ }) to avoid data loss.`):console.warn(t);}function yn(){let e=globalThis;e.__BLOG_PLATFORM_STORAGE__||(xn(),e.__BLOG_PLATFORM_STORAGE__=new st);let t=e.__BLOG_PLATFORM_STORAGE__;if(!t)throw new Error("Blog platform storage not initialized");return t}function H(){return yn()}function qt(e){let t=globalThis;t.__BLOG_PLATFORM_STORAGE__=e;}function Te(e){let t=new Map;for(let r of e)r.author?.slug&&t.set(r.author.slug,jr(t.get(r.author.slug),r.author));return Array.from(t.values()).sort((r,i)=>r.name.localeCompare(i.name))}function Vr(e,t){let r=t.filter(n=>n.author?.slug===e).sort((n,o)=>new Date(o.publishedAt).getTime()-new Date(n.publishedAt).getTime()),i=r.reduce((n,o)=>o.author?jr(n,o.author):n,null);return i?{author:i,articles:r}:null}async function vn(e,t={},r=H()){let{articles:i}=await r.listArticles({limit:t.limit??1e3,offset:t.offset??0,sortBy:"publishedAt",order:"desc"});return Vr(e,i)}function jr(e,t){return e?{...e,bio:e.bio??t.bio,avatarUrl:e.avatarUrl??t.avatarUrl,pronouns:e.pronouns??t.pronouns,socialLinks:e.socialLinks??t.socialLinks,toneAdjectives:e.toneAdjectives.length>0?e.toneAdjectives:t.toneAdjectives}:t}function Pn(e){let t=e.topics??[];return t.find(r=>r.isPrimary)??t[0]??null}function Re(e){let t=new Map;for(let r of e)for(let i of r.topics??[])t.has(i.slug)||t.set(i.slug,i);return Array.from(t.values()).sort((r,i)=>r.name.localeCompare(i.name))}function Xt(e,t){let r=e.filter(n=>(n.topics??[]).some(o=>o.slug===t));if(r.length===0)return null;let i=r.flatMap(n=>n.topics??[]).find(n=>n.slug===t)??null;return i?{topic:i,articles:r}:null}function Sn({articles:e,basePath:t="/blog",title:r="Topics",description:i="Browse articles by topic.",className:n,theme:o}){let s=k(t)||"/",l=Re(e);return jsxRuntime.jsxs("main",{style:$(o),className:p("blog-topics-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",n),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(re__default.default,{href:s,className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all articles"}),jsxRuntime.jsx("h1",{className:p("text-4xl font-light tracking-tight text-balance sm:text-5xl",D),children:r}),jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:i})]}),l.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No topics have published articles yet."}):jsxRuntime.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:l.map(a=>{let u=e.filter(c=>(c.topics??[]).some(d=>d.slug===a.slug)).length;return jsxRuntime.jsxs(re__default.default,{href:v(s,`topics/${a.slug}`),className:"group rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] p-5 transition hover:border-[var(--blog-accent)] hover:no-underline",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold transition-colors group-hover:text-[var(--blog-accent)]",children:a.name}),a.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mt-2 line-clamp-3 text-sm leading-relaxed",children:a.description}),jsxRuntime.jsxs("p",{className:"text-muted-foreground mt-4 text-sm",children:[u," ",u===1?"article":"articles"]})]},a.slug)})})]})}function Nn({articles:e,topicSlug:t,basePath:r="/blog",className:i,theme:n}){let o=k(r)||"/",s=Xt(e,t);return jsxRuntime.jsxs("main",{style:$(n),className:p("blog-topic-archive-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",i),children:[s&&jsxRuntime.jsx(ot,{articles:s.articles,title:s.topic.name,kind:"topics",slug:t,basePath:o}),jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(re__default.default,{href:v(o,"topics"),className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all topics"}),jsxRuntime.jsx("h1",{className:p("text-4xl font-light tracking-tight text-balance sm:text-5xl",D),children:s?.topic.name??"Topic not found"}),s?.topic.description&&jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:s.topic.description})]}),s?jsxRuntime.jsx("div",{className:"grid gap-5 md:grid-cols-2",children:s.articles.map(l=>jsxRuntime.jsx(Tn,{article:l,topic:s.topic,basePath:o},l.id))}):jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No published articles were found for this topic."})]})}function Tn({article:e,topic:t,basePath:r}){let i=v(r,e.slug),n=dateFns.formatDistanceToNow(new Date(e.publishedAt),{addSuffix:true});return jsxRuntime.jsxs(re__default.default,{href:i,className:"group overflow-hidden rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] transition hover:border-[var(--blog-accent)] hover:no-underline",children:[e.featuredImage&&jsxRuntime.jsx("div",{className:"relative aspect-[16/9] overflow-hidden",children:jsxRuntime.jsx(Et__default.default,{src:e.featuredImage,alt:e.featuredImageAlt??e.title,width:640,height:360,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"})}),jsxRuntime.jsxs("div",{className:"space-y-3 p-5",children:[jsxRuntime.jsx("span",{className:"inline-flex rounded-full border border-[var(--blog-accent-border)] px-2.5 py-1 text-xs font-medium text-[var(--blog-text-accent)]",children:t.name}),jsxRuntime.jsx("h2",{className:"text-xl font-semibold text-balance transition-colors group-hover:text-[var(--blog-accent)]",children:e.title}),e.excerpt&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed",children:e.excerpt}),jsxRuntime.jsx("p",{className:"text-muted-foreground text-sm",children:n})]})]})}function Cn({articles:e,basePath:t="/blog",title:r="Authors",description:i="Browse articles by author.",className:n,theme:o}){let s=k(t)||"/",l=Te(e);return jsxRuntime.jsxs("main",{style:$(o),className:p("blog-authors-page container mx-auto max-w-5xl px-4 py-8 sm:px-6 sm:py-12 lg:px-8 lg:py-16",n),children:[jsxRuntime.jsxs("header",{className:"mb-10 space-y-3 text-center",children:[jsxRuntime.jsx(re__default.default,{href:s,className:"text-muted-foreground text-sm font-medium transition-colors hover:text-[var(--blog-accent)]",children:"Back to all articles"}),jsxRuntime.jsx("h1",{className:p("text-4xl font-light tracking-tight text-balance sm:text-5xl",D),children:r}),jsxRuntime.jsx("p",{className:"text-muted-foreground mx-auto max-w-2xl text-lg text-pretty",children:i})]}),l.length===0?jsxRuntime.jsx("p",{className:"text-muted-foreground rounded-2xl border p-8 text-center",children:"No authors have published articles yet."}):jsxRuntime.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:l.map(a=>{let u=e.filter(c=>c.author?.slug===a.slug).length;return jsxRuntime.jsx(re__default.default,{href:B(s,a.slug),className:"group rounded-2xl border border-[var(--blog-accent-border)] bg-[var(--blog-card-bg)] p-5 transition hover:border-[var(--blog-accent)] hover:no-underline",children:jsxRuntime.jsxs("div",{className:"flex items-start gap-4",children:[jsxRuntime.jsx(Ln,{author:a}),jsxRuntime.jsxs("div",{className:"min-w-0 space-y-2",children:[jsxRuntime.jsx("h2",{className:"text-xl font-semibold transition-colors group-hover:text-[var(--blog-accent)]",children:a.name}),a.bio&&jsxRuntime.jsx("p",{className:"text-muted-foreground line-clamp-3 text-sm leading-relaxed",children:a.bio}),jsxRuntime.jsxs("p",{className:"text-muted-foreground text-sm",children:[u," ",u===1?"article":"articles"]})]})]})},a.slug)})})]})}function Ln({author:e}){let t=_n(e.name);return e.avatarUrl?jsxRuntime.jsx(Et__default.default,{src:e.avatarUrl,alt:e.name,width:56,height:56,className:"size-14 shrink-0 rounded-full border border-[var(--blog-accent-border)] object-cover"}):jsxRuntime.jsx("span",{className:"bg-muted text-muted-foreground inline-flex size-14 shrink-0 items-center justify-center rounded-full text-base font-semibold",children:t})}function _n(e){return e.trim().split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0]?.toUpperCase()).join("")||"?"}function z(e){return `sha256:${crypto.createHash("sha256").update(e).digest("hex")}`}function Wt(e){let t=e.headers.get("Authorization");if(!t)return null;let i=/^Bearer\s+(.+)$/i.exec(t);if(i?.[1])return i[1];let o=/^Token\s+(.+)$/i.exec(t);return o?.[1]?o[1]:null}var lt=class{validApiKeys;constructor(t){this.validApiKeys=new Set(t);}async validateToken(t){return t?.trim()?this.validApiKeys.has(t)?{valid:true,context:{tokenHash:this.hashToken(t)}}:{valid:false,errorCode:"invalid"}:{valid:false,errorCode:"missing"}}extractToken=t=>Wt(t);hashToken(t){return z(t)}},Ce=class extends lt{constructor(t="BLOG_PLATFORM_API_KEYS"){let r=process.env[t];!r&&t==="BLOG_PLATFORM_API_KEYS"&&(r=process.env.BLOG_AUTH_TOKEN);let i=r?r.split(",").map(n=>n.trim()).filter(Boolean):[];i.length===0&&console.warn(`\u26A0\uFE0F No API keys found in environment variable ${t}${t==="BLOG_PLATFORM_API_KEYS"?" (set BLOG_PLATFORM_API_KEYS or BLOG_AUTH_TOKEN)":""}. Authentication will fail for all requests.`),super(i);}},Ve=class{async validateToken(){return {valid:true,context:{development:true}}}extractToken(){return "development-mode"}},ct=class{hasWarned=false;async validateToken(t){return this.hasWarned||(console.error("\u274C SECURITY WARNING: Blog platform authentication not initialized! All requests will be rejected. Call initBlogPlatform() to configure authentication."),this.hasWarned=true),{valid:false,errorCode:"invalid"}}};function In(){return globalThis.__BLOG_PLATFORM_AUTH_CONFIG__??=new ct,globalThis.__BLOG_PLATFORM_AUTH_CONFIG__}function ut(e){globalThis.__BLOG_PLATFORM_AUTH_CONFIG__=e;}function Kt(){return globalThis.__BLOG_PLATFORM_AUTH_CONFIG__??In()}function Bn(e){ut(new Ce(e));}async function Q(e){let t=Kt(),r=t.extractToken?t.extractToken(e):Wt(e);if(!r)return {authenticated:false,result:{valid:false,errorCode:"missing"},token:null};let i=await t.validateToken(r);return {authenticated:i.valid,result:i,token:r}}function En(e,t=""){let i=Kt().errorMessages??{},n,o;switch(e.errorCode){case "missing":n=i.missing??"Authentication token is required",o="PUB005";break;case "expired":n=i.expired??"Authentication token has expired",o="PUB005";break;default:n=i.invalid??"Invalid authentication credentials",o="PUB005";break}return {success:false,error:{code:o,message:n,details:{authError:e.errorCode??"invalid"}},idempotencyKey:t}}async function ie(e){let t=await Q(e);return t.authenticated?{authenticated:true,context:t.result.context}:{authenticated:false,error:En(t.result)}}function On(){let e=process.env.SKIP_BLOG_PLATFORM_AUTH;return e==="true"||e==="1"||process.env.NODE_ENV==="test"}function $n(){return globalThis.__BLOG_PLATFORM_RATE_LIMITER__??null}function Dn(e){let t=globalThis;t.__BLOG_PLATFORM_RATE_LIMITER__=e;}function dt(e){let{redisUrl:t,redisToken:r,requestsPerMinute:i=5,keyPrefix:n="blog-platform-ratelimit",analytics:o=true}=e,s=new redis.Redis({url:t,token:r}),l=new ratelimit.Ratelimit({redis:s,analytics:o,prefix:n,limiter:ratelimit.Ratelimit.slidingWindow(i,"1m")});Dn(l);}function Jt(){let e=process.env.UPSTASH_REDIS_REST_URL,t=process.env.UPSTASH_REDIS_REST_TOKEN;if(!e||!t){console.warn("Blog platform: No Upstash Redis configuration found. Rate limiting disabled.");return}dt({redisUrl:e,redisToken:t}),console.log("Blog platform: Rate limiting configured (5 requests per minute per token)");}async function zr(e){let t=$n();if(!t)return console.warn("Blog platform: Rate limiter not configured. All requests allowed."),{success:true,remaining:999,reset:Date.now()+6e4,limit:5,count:0};try{let r=await t.limit(e);return {success:r.success,remaining:r.remaining,reset:r.reset,limit:r.limit,count:r.limit-r.remaining}}catch(r){return console.error("Blog platform: Rate limit check failed:",r),{success:true,remaining:0,reset:Date.now()+6e4,limit:5,count:0}}}function qr(e,t=""){let r=Math.ceil((e.reset-Date.now())/6e4);return {success:false,error:{code:"PUB011",message:`Rate limit exceeded. You can make ${e.limit} requests per minute. Try again in ${r} minute(s).`,details:{rateLimit:e}},idempotencyKey:t}}async function Z(e,t=""){let r=await zr(e);return r.success?{allowed:true,rateLimitResult:r}:{allowed:false,errorResponse:qr(r,t)}}function M(e){return {"X-RateLimit-Limit":e.limit.toString(),"X-RateLimit-Remaining":e.remaining.toString(),"X-RateLimit-Reset":e.reset.toString(),"Retry-After":Math.ceil((e.reset-Date.now())/1e3).toString()}}function mt(e){let{auth:t,storage:r,rateLimit:i,autoRateLimit:n=true}=e;if(!t)throw new Error(`Blog platform initialization failed: 'auth' is required.
|
|
40
40
|
Example: initBlogPlatform({ auth: new EnvAuth() })
|
|
41
|
-
See https://github.com/xexr/blog-platform#authentication for more details.`);console.log("Blog platform: Setting up authentication"),
|
|
41
|
+
See https://github.com/xexr/blog-platform#authentication for more details.`);console.log("Blog platform: Setting up authentication"),ut(t),i?(console.log("Blog platform: Using custom rate limiting configuration"),dt(i)):n?(console.log("Blog platform: Auto-configuring rate limiting from environment"),Jt()):console.log("Blog platform: Rate limiting disabled"),r?(console.log("Blog platform: Using custom storage provider"),qt(r)):console.log("Blog platform: Using default in-memory storage (not suitable for production)"),console.log("Blog platform initialized successfully"),globalThis.__BLOG_PLATFORM_INITIALISED__=true;}function Un(e){if(globalThis.__BLOG_PLATFORM_INITIALISED__){console.log("Blog platform: Already initialized, skipping");return}console.log("Blog platform: Initializing blog platform once"),mt(e);}function Hn(){mt({auth:new Ve,autoRateLimit:false}),console.log("Blog platform: Development mode enabled (no auth, in-memory storage, no rate limiting)");}function Vn(e){let t=e??"BLOG_PLATFORM_API_KEYS";if(!process.env[t])throw new Error(`Missing required environment variable: ${t}. Set this to a comma-separated list of API keys for blog platform authentication.`);mt({auth:new Ce(t),autoRateLimit:true}),console.log("Blog platform: Production mode enabled (environment-based auth, rate limiting)");}var N=sqliteCore.sqliteTable("bp_articles",{id:sqliteCore.text("id").primaryKey(),slug:sqliteCore.text("slug").notNull(),title:sqliteCore.text("title").notNull(),excerpt:sqliteCore.text("excerpt").notNull(),content:sqliteCore.text("content").notNull(),readingSeconds:sqliteCore.integer("reading_seconds").notNull(),wordCount:sqliteCore.integer("word_count").notNull(),publishedAt:sqliteCore.text("published_at").notNull(),updatedAt:sqliteCore.text("updated_at").notNull(),featuredImage:sqliteCore.text("featured_image"),featuredImageAlt:sqliteCore.text("featured_image_alt"),featuredImageCaption:sqliteCore.text("featured_image_caption"),featuredImageCreditText:sqliteCore.text("featured_image_credit_text"),featuredImageCreditUrl:sqliteCore.text("featured_image_credit_url"),authorJson:sqliteCore.text("author_json"),siteJson:sqliteCore.text("site_json").notNull(),metaJson:sqliteCore.text("meta_json").notNull(),version:sqliteCore.integer("version").notNull()},e=>({slugUniqueIdx:sqliteCore.uniqueIndex("bp_articles_slug_unique").on(e.slug)})),xe=sqliteCore.sqliteTable("bp_operations",{key:sqliteCore.text("key").primaryKey(),resultJson:sqliteCore.text("result_json").notNull(),createdAt:sqliteCore.integer("created_at",{mode:"timestamp_ms"}).notNull(),expiresAt:sqliteCore.integer("expires_at",{mode:"timestamp_ms"})}),de=sqliteCore.sqliteTable("bp_metadata",{key:sqliteCore.text("key").primaryKey(),valueJson:sqliteCore.text("value_json").notNull(),updatedAt:sqliteCore.integer("updated_at",{mode:"timestamp_ms"}).notNull()}),rr=2,je=["bp_articles","bp_operations","bp_metadata"],zn={bpArticles:N,bpOperations:xe,bpMetadata:de};function qn(e){return {id:e.id,slug:e.slug,title:e.title,excerpt:e.excerpt,content:e.content,readingSeconds:e.readingSeconds,wordCount:e.wordCount,publishedAt:e.publishedAt,updatedAt:e.updatedAt,featuredImage:e.featuredImage??null,featuredImageAlt:e.featuredImageAlt??null,featuredImageCaption:e.featuredImageCaption??null,featuredImageCreditText:e.featuredImageCreditText??null,featuredImageCreditUrl:e.featuredImageCreditUrl??null,authorJson:e.author?JSON.stringify(e.author):null,siteJson:JSON.stringify(e.site),metaJson:JSON.stringify({...e.meta,__bloggyTopics:e.topics??[],__bloggySeries:e.series??null,__bloggyCta:e.cta??null,...e.video&&{__bloggyVideo:e.video}}),version:e.version}}function Xr(e){return {id:e.id,slug:e.slug,title:e.title,excerpt:e.excerpt,content:e.content,readingSeconds:e.readingSeconds,wordCount:e.wordCount,publishedAt:e.publishedAt,updatedAt:e.updatedAt,featuredImage:e.featuredImage??void 0,featuredImageAlt:e.featuredImageAlt??void 0,featuredImageCaption:e.featuredImageCaption??void 0,featuredImageCreditText:e.featuredImageCreditText??void 0,featuredImageCreditUrl:e.featuredImageCreditUrl??void 0,author:e.authorJson?JSON.parse(e.authorJson):null,site:JSON.parse(e.siteJson),cta:Wn(e.metaJson),topics:Xn(e.metaJson),series:Kn(e.metaJson),...Jn(e.metaJson),meta:Yn(e.metaJson),version:e.version}}function Ge(e){return JSON.parse(e)}function Xn(e){return Ge(e).__bloggyTopics??[]}function Wn(e){return Ge(e).__bloggyCta??void 0}function Kn(e){return Ge(e).__bloggySeries??void 0}function Jn(e){let t=Ge(e).__bloggyVideo;return t?{video:t}:{}}function Yn(e){let t=Ge(e);return delete t.__bloggyVideo,delete t.__bloggyTopics,delete t.__bloggySeries,delete t.__bloggyCta,t}var Fe=class extends Error{code="BLOG_PLATFORM_SCHEMA_MISSING";missingTables;setupSql;constructor(t,r={}){super(`Blog platform database schema is missing required table(s): ${t.join(", ")}. Run the @xexr/blog-platform schema migration/setup for the current package version.`),this.name="BlogPlatformSchemaError",this.missingTables=t,this.setupSql=t.map(Yr),r.cause!==void 0&&(this.cause=r.cause);}},Yt=class{db;options;constructor(t,r={}){this.db=t,this.options=r;}async saveArticle(t,r){let i=await this.checkIdempotency(r);if(i)if(i.success){if((await this.db.select({id:N.id}).from(N).where(drizzleOrm.eq(N.id,t.id)).limit(1)).length!==0)return i}else return i;let n=await this.db.select().from(N).where(drizzleOrm.eq(N.slug,t.slug)).limit(1),o=n[0];if(o&&o.id!==t.id){let a={success:false,error:{code:"PUB003",message:"This URL is already in use. Please choose another."},idempotencyKey:r};return await this.storeOperationResult(r,a),a}let s=qn(t);n.length===0?await this.db.insert(N).values(s).run():await this.db.update(N).set({title:s.title,excerpt:s.excerpt,content:s.content,readingSeconds:s.readingSeconds,wordCount:s.wordCount,updatedAt:s.updatedAt,featuredImage:s.featuredImage,featuredImageAlt:s.featuredImageAlt,featuredImageCaption:s.featuredImageCaption,featuredImageCreditText:s.featuredImageCreditText,featuredImageCreditUrl:s.featuredImageCreditUrl,authorJson:s.authorJson,siteJson:s.siteJson,metaJson:s.metaJson,version:s.version}).where(drizzleOrm.and(drizzleOrm.eq(N.id,s.id),drizzleOrm.eq(N.slug,s.slug))).run();let l={success:true,url:`/${t.slug}`,platformPostId:t.id,publishedAt:t.publishedAt,idempotencyKey:r};return await this.storeOperationResult(r,l),l}async getArticle(t){let r=await this.db.select().from(N).where(drizzleOrm.eq(N.slug,t)).limit(1);return r[0]?Xr(r[0]):null}async listArticles(t={}){let{limit:r=10,offset:i=0,sortBy:n="publishedAt",order:o="desc"}=t,s=n==="publishedAt"?N.publishedAt:N.updatedAt,l=o==="desc"?drizzleOrm.desc(s):s,a=await this.db.select().from(N).orderBy(l).limit(r).offset(i),u=await this.db.select({c:drizzleOrm.sql`count(*)`}).from(N),c=Number(u?.[0]?.c??0);return {articles:a.map(Xr),total:c}}async removeArticle(t,r){let i=await this.checkIdempotency(r);if(i)if(i.success){if(!((await this.db.select({id:N.id}).from(N).where(drizzleOrm.eq(N.slug,t)).limit(1)).length>0))return i}else return i;if(!(await this.db.select().from(N).where(drizzleOrm.eq(N.slug,t)).limit(1))[0]){let s={success:false,error:{code:"PUB007",message:"Article not found"},idempotencyKey:r};return await this.storeOperationResult(r,s),s}await this.db.delete(N).where(drizzleOrm.eq(N.slug,t)).run();let o={success:true,idempotencyKey:r};return await this.storeOperationResult(r,o),o}async checkIdempotency(t){let r=await this.db.select().from(xe).where(drizzleOrm.eq(xe.key,t)).limit(1);if(!r[0])return null;try{return JSON.parse(r[0].resultJson)}catch{return null}}async storeOperationResult(t,r){let i=Date.now(),n=this.options.operationTtlMs?i+this.options.operationTtlMs:null;await this.db.delete(xe).where(drizzleOrm.eq(xe.key,t)).run(),await this.db.insert(xe).values({key:t,resultJson:JSON.stringify(r),createdAt:new Date(i),expiresAt:n?new Date(n):null}).run();}async setMetadata(t,r){let i=new Date;try{await this.db.delete(de).where(drizzleOrm.eq(de.key,t)).run(),await this.db.insert(de).values({key:t,valueJson:JSON.stringify(r),updatedAt:i}).run();}catch(n){Wr(n,"bp_metadata");}}async getMetadata(t){let r;try{r=await this.db.select({valueJson:de.valueJson}).from(de).where(drizzleOrm.eq(de.key,t)).limit(1);}catch(n){Wr(n,"bp_metadata");}let i=r[0];if(!i)return null;try{return JSON.parse(i.valueJson)}catch{return null}}};async function Jr(e){let t=await e.all(drizzleOrm.sql`
|
|
42
42
|
SELECT name
|
|
43
43
|
FROM sqlite_master
|
|
44
44
|
WHERE type = 'table'
|
|
45
|
-
`),r=new Set(t.map(
|
|
45
|
+
`),r=new Set(t.map(o=>o.name)),i=je.filter(o=>r.has(o)),n=je.filter(o=>!r.has(o));return {ok:n.length===0,schemaVersion:rr,requiredTables:je,presentTables:i,missingTables:n,setupSql:n.map(Yr)}}async function Qn(e){let t=await Jr(e);if(!t.ok)throw new Fe(t.missingTables)}var Qt=`CREATE TABLE IF NOT EXISTS bp_articles (
|
|
46
46
|
id TEXT PRIMARY KEY,
|
|
47
47
|
slug TEXT NOT NULL UNIQUE,
|
|
48
48
|
title TEXT NOT NULL,
|
|
@@ -61,20 +61,20 @@ See https://github.com/xexr/blog-platform#authentication for more details.`);con
|
|
|
61
61
|
site_json TEXT NOT NULL,
|
|
62
62
|
meta_json TEXT NOT NULL,
|
|
63
63
|
version INTEGER NOT NULL
|
|
64
|
-
);`,
|
|
64
|
+
);`,Zt=`CREATE TABLE IF NOT EXISTS bp_operations (
|
|
65
65
|
key TEXT PRIMARY KEY,
|
|
66
66
|
result_json TEXT NOT NULL,
|
|
67
67
|
created_at INTEGER NOT NULL,
|
|
68
68
|
expires_at INTEGER
|
|
69
|
-
);`,
|
|
69
|
+
);`,er=`CREATE TABLE IF NOT EXISTS bp_metadata (
|
|
70
70
|
key TEXT PRIMARY KEY,
|
|
71
71
|
value_json TEXT NOT NULL,
|
|
72
72
|
updated_at INTEGER NOT NULL
|
|
73
|
-
);`;function
|
|
74
|
-
`)}function
|
|
75
|
-
`)});return [t,r,...
|
|
76
|
-
`)}function
|
|
77
|
-
`)});return [r,
|
|
78
|
-
`)}function $o(e){let t=[],r=[];e.entries.length===0?t.push("Sitemap must contain at least one URL"):e.entries.length>5e4&&t.push("Sitemap contains more than 50,000 URLs (Google limit)"),e.truncated&&r.push("Sitemap was truncated due to size limits"),e.entries.forEach((o,i)=>{try{new URL(o.loc);}catch{t.push(`Invalid URL at entry ${i+1}: ${o.loc}`);}o.priority!==void 0&&(o.priority<0||o.priority>1)&&t.push(`Invalid priority at entry ${i+1}: must be between 0.0 and 1.0`),o.lastmod&&!Ho(o.lastmod)&&t.push(`Invalid lastmod date at entry ${i+1}: ${o.lastmod}`),o.loc.length>2048&&r.push(`URL at entry ${i+1} exceeds 2048 character limit`);});let n=new Map;return e.entries.forEach(o=>{let i=n.get(o.loc)??0;n.set(o.loc,i+1);}),n.forEach((o,i)=>{o>1&&t.push(`Duplicate URL found: ${i} (appears ${o} times)`);}),{valid:t.length===0,errors:t,warnings:r}}function D(e){return e.length===0?new Date().toISOString():e.reduce((r,n)=>{let o=new Date(n.updatedAt);return o>r?o:r},new Date(e[0].updatedAt)).toISOString()}function Do(e,t,r=[],n={}){return async function(){let s=(await Vt(e,t,r,n)).map(u=>({loc:u.url,lastmod:typeof u.lastModified=="string"?u.lastModified:u.lastModified?.toISOString(),changefreq:u.changeFrequency,priority:u.priority})),l={entries:s,totalEntries:s.length,generatedAt:new Date().toISOString(),baseUrl:Le(n.canonical?.domain??e.domain,n.canonical?.forceHttps??true)},a=Ur(l);return new Response(a,{headers:{"Content-Type":"application/xml","Cache-Control":"public, max-age=3600, s-maxage=3600"}})}}function Uo(e){return async function(){let r=[...e.staticRoutes??[],...e.getStaticRoutes?await e.getStaticRoutes():[]],n=await e.getSite(),o=await e.getArticles(),i=e.getAuthors?await e.getAuthors():[];return [...r,...await Vt(n,o,i,e.options)]}}function ze(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,r=>t[r]??r)}function Ho(e){try{let t=new Date(e),r=t.toISOString(),n=e.endsWith("Z")&&!e.includes(".")?e.replace("Z",".000Z"):e;return r===n&&!isNaN(t.getTime())}catch{return false}}var ke={name:"@xexr/blog-platform",version:"1.1.5"};function Hr(e){let r=e.replace(/^v/,"").split(".");if(r.length<3)throw new Error(`Invalid version format: ${e}`);let n=parseInt(r[0]??"0",10),o=parseInt(r[1]??"0",10),i=parseInt(r[2]?.split("-")[0]??"0",10);if(isNaN(n)||isNaN(o)||isNaN(i))throw new Error(`Invalid version format: ${e}`);return {major:n,minor:o,patch:i}}function Z(){let e=Hr(ke.version);return {name:ke.name,version:ke.version,...e}}function ue(e){try{let t=e.split(" "),r={};for(let n of t){let[o,i]=n.split("/");if(!o||!i)continue;let s=Hr(i),l={name:o,version:i,...s};o==="bloggy"?r.bloggyVersion=l:o==="platform"&&(r.platformVersion=l);}return r}catch{return null}}function Fr(e,t){try{return e.major!==t.major?{compatible:!1,errorCode:"PUB009",errorMessage:`Major version incompatibility: ${e.name} ${e.version} is not compatible with ${t.name} ${t.version}. Please upgrade.`}:e.minor!==t.minor?{compatible:!0,errorCode:"PUB010",warning:`Minor version difference: ${e.name} ${e.version} with ${t.name} ${t.version}. Some features may not be available.`}:{compatible:!0}}catch(r){return {compatible:false,errorMessage:`Failed to check version compatibility: ${r instanceof Error?r.message:"Unknown error"}`}}}var jr={enableCSP:true,cspDirectives:{"default-src":"'self'","script-src":"'self' 'unsafe-inline'","style-src":"'self' 'unsafe-inline'","img-src":"'self' data: https:","font-src":"'self' https:","connect-src":"'self'","media-src":"'self'","object-src":"'none'","base-uri":"'self'","form-action":"'self'","frame-ancestors":"'none'","upgrade-insecure-requests":""},enableFrameOptions:true,frameOptions:"DENY",enableContentTypeOptions:true,enableXSSProtection:true,enableReferrerPolicy:true,referrerPolicy:"strict-origin-when-cross-origin",enableHSTS:true,hstsMaxAge:31536e3,hstsIncludeSubdomains:true,enablePermissionsPolicy:true,permissionsPolicyDirectives:{camera:"()",microphone:"()",geolocation:"()",payment:"()",usb:"()",accelerometer:"()",gyroscope:"()",magnetometer:"()"}};function jo(){let e=process.env.BLOG_PLATFORM_DISABLE_CSP==="true",t=process.env.BLOG_PLATFORM_FRAME_OPTIONS,r=process.env.BLOG_PLATFORM_DISABLE_HSTS==="true";return {...jr,enableCSP:!e,frameOptions:t??jr.frameOptions,enableHSTS:!r}}function Go(e){return Object.entries(e).map(([t,r])=>r?`${t} ${r}`:t).join("; ")}function zo(e){return Object.entries(e).map(([t,r])=>`${t}=${r}`).join(", ")}function Vo(e,t={}){let r={...jo(),...t},n={};if(r.enableCSP){let o={...r.cspDirectives,...t.cspDirectives??{}};n["Content-Security-Policy"]=Go(o);}if(r.enableFrameOptions&&(n["X-Frame-Options"]=r.frameOptions),r.enableContentTypeOptions&&(n["X-Content-Type-Options"]="nosniff"),r.enableXSSProtection&&(n["X-XSS-Protection"]="1; mode=block"),r.enableReferrerPolicy&&(n["Referrer-Policy"]=r.referrerPolicy),r.enableHSTS&&qo(e)){let o=[`max-age=${r.hstsMaxAge}`,r.hstsIncludeSubdomains?"includeSubDomains":""].filter(Boolean).join("; ");n["Strict-Transport-Security"]=o;}if(r.enablePermissionsPolicy){let o={...r.permissionsPolicyDirectives,...t.permissionsPolicyDirectives??{}};n["Permissions-Policy"]=zo(o);}return n}function qo(e){return !!(e.url.startsWith("https://")||e.headers.get("x-forwarded-proto")==="https"||e.headers.get("cf-visitor")?.includes('"scheme":"https"'))}function ct(e,t={}){return Vo(e,{...t,cspDirectives:{...{"default-src":"'none'","frame-ancestors":"'none'","base-uri":"'none'"},...t.cspDirectives??{}}})}var Gr={allowedOrigins:["http://localhost:3000","https://localhost:3000","http://127.0.0.1:3000","https://127.0.0.1:3000"],allowWildcard:false,allowCredentials:false,maxAge:86400,securityConfig:{}};function zr(){let e=process.env.BLOG_PLATFORM_ALLOWED_ORIGINS,t=process.env.BLOG_PLATFORM_ALLOW_WILDCARD==="true",r=process.env.BLOG_PLATFORM_ALLOW_CREDENTIALS==="true";return {...Gr,allowedOrigins:e?e.split(",").map(n=>n.trim()):Gr.allowedOrigins,allowWildcard:t,allowCredentials:r}}function Vr(e,t){return e?t.allowWildcard?true:t.allowedOrigins.includes(e):false}function qr(e,t){let r=e.headers.get("origin"),n={};return t.allowWildcard?n["Access-Control-Allow-Origin"]="*":r&&Vr(r,t)&&(n["Access-Control-Allow-Origin"]=r),t.allowCredentials&&!t.allowWildcard&&(n["Access-Control-Allow-Credentials"]="true"),t.allowWildcard||(n.Vary="Origin"),n}function Xo(e,t,r,n){return {...qr(e,t),"Access-Control-Allow-Methods":r.join(", "),"Access-Control-Allow-Headers":n.join(", "),"Access-Control-Max-Age":t.maxAge.toString()}}var Wo=["Content-Type","X-Bloggy-Version","X-Idempotency-Key","Authorization","X-Requested-With"];function y(e,t,r={}){let{status:n=200,headers:o={},corsConfig:i={}}=r,s={...zr(),...i},l=qr(e,s),a=ct(e,s.securityConfig),u={"Content-Type":"application/json",...l,...a,...o};return server_js.NextResponse.json(t,{status:n,headers:u})}function ye(e,t,r={}){let{allowedHeaders:n=Wo,corsConfig:o={}}=r,i={...zr(),...o},s=e.headers.get("origin");if(s&&!i.allowWildcard&&!Vr(s,i)){let u=ct(e,i.securityConfig);return new server_js.NextResponse(null,{status:403,headers:{"Content-Type":"text/plain",...u}})}let l=Xo(e,i,[...t,"OPTIONS"],n),a=ct(e,i.securityConfig);return new server_js.NextResponse(null,{status:200,headers:{...l,...a}})}async function Ko(e){try{let t=await Y(e);if(!t.authenticated){let b=await re(e);return y(e,b.error,{status:401})}let r=q(t.token??"anonymous"),n=await Q(r);if(!n.allowed){let b=n.errorResponse.error?.details?.rateLimit,A=b&&typeof b=="object"&&"limit"in b&&"remaining"in b&&"reset"in b&&"count"in b&&"success"in b?b:{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},I=$(A);return y(e,n.errorResponse,{status:429,headers:I})}if(!e.headers.get("content-type")?.includes("application/json"))return y(e,{success:!1,error:{code:"PUB001",message:"Content-Type must be application/json"},idempotencyKey:""},{status:400});let i;try{i=await e.json();}catch{return y(e,{success:!1,error:{code:"PUB001",message:"Invalid JSON in request body"},idempotencyKey:""},{status:400})}let s=Jo(i);if(s.length>0)return y(e,{success:!1,error:{code:"PUB001",message:"Missing required fields",details:{errors:s}},idempotencyKey:i.idempotencyKey??""},{status:400});let l=e.headers.get("X-Bloggy-Version");if(l){let b=ue(l);if(b?.platformVersion){let A=Z();if(b.platformVersion.major!==A.major)return y(e,{success:!1,error:{code:"PUB009",message:"Major version incompatibility. Please upgrade your blog platform package.",details:{clientVersion:b.platformVersion.version,serverVersion:A.version}},idempotencyKey:i.idempotencyKey},{status:409})}}if(i.dryRun){let b=[];return i.article.wordCount<50&&b.push("Article has fewer than 50 words, which may affect SEO"),(!i.article.excerpt||i.article.excerpt.length<120)&&b.push("Article excerpt is shorter than recommended 120 characters"),i.article.meta.keywords.length||b.push("No SEO keywords provided"),y(e,{success:!0,warnings:b,idempotencyKey:i.idempotencyKey},{status:200})}let a={...i.article,slug:i.slug??i.article.slug,meta:{...i.article.meta,description:i.metaDescription??i.article.meta.description}};if(!Xt(a.slug))return y(e,{success:!1,error:{code:"PUB002",message:"Slug can only contain lowercase letters, numbers, and hyphens"},idempotencyKey:i.idempotencyKey},{status:400});let m=await G().saveArticle(a,i.idempotencyKey),c=Z(),g=$(n.rateLimitResult),h={"X-Bloggy-Version":`platform/${c.version}`,"X-Idempotency-Key":i.idempotencyKey,...g};m.success&&(h.Location=m.url??`/${a.slug}`);let p=m.success?201:m.error?.code==="PUB003"?409:400;return y(e,m,{status:p,headers:h})}catch(t){return console.error("Publish endpoint error:",t),y(e,{success:false,error:{code:"PUB007",message:"Internal server error during publishing"},idempotencyKey:""},{status:500})}}function Jo(e){let t=[];if(!e||typeof e!="object")return t.push("Request body must be a valid object"),t;let r=e;if((!r.article||typeof r.article!="object")&&t.push("Missing required field: article"),(!r.idempotencyKey||typeof r.idempotencyKey!="string")&&t.push("Missing required field: idempotencyKey"),r.article&&typeof r.article=="object"){let n=r.article,o=["id","slug","title","content","publishedAt","site"];for(let i of o)n[i]||t.push(`Missing required article field: ${i}`);if(n.site&&typeof n.site=="object"){let i=n.site,s=["id","name","domain"];for(let l of s)i[l]||t.push(`Missing required site field: ${l}`);}if(n.meta&&typeof n.meta=="object"){let i=n.meta;Array.isArray(i.keywords)||t.push("Article meta.keywords must be an array");}}return t}function Xt(e){return !e||typeof e!="string"?false:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)&&e.length>=1&&e.length<=100}async function Qo(e){try{let t=await Y(e);if(!t.authenticated){let p=await re(e);return server_js.NextResponse.json(p.error,{status:401})}let r=q(t.token??"anonymous"),n=await Q(r);if(!n.allowed){let p=n.errorResponse.error?.details?.rateLimit,b=p&&typeof p=="object"&&"limit"in p&&"remaining"in p&&"reset"in p&&"count"in p&&"success"in p?p:{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},A=$(b);return y(e,n.errorResponse,{status:429,headers:A})}if(!e.headers.get("content-type")?.includes("application/json"))return y(e,{success:!1,error:{code:"PUB001",message:"Content-Type must be application/json"},idempotencyKey:""},{status:400});let i;try{i=await e.json();}catch{return y(e,{success:!1,error:{code:"PUB001",message:"Invalid JSON in request body"},idempotencyKey:""},{status:400})}let s=Zo(i);if(s.length>0)return y(e,{success:!1,error:{code:"PUB001",message:"Missing required fields",details:{errors:s}},idempotencyKey:i.idempotencyKey??""},{status:400});let l=e.headers.get("X-Bloggy-Version");if(l){let p=ue(l);if(p?.platformVersion){let b=Z();if(p.platformVersion.major!==b.major)return y(e,{success:!1,error:{code:"PUB009",message:"Major version incompatibility. Please upgrade your blog platform package.",details:{clientVersion:p.platformVersion.version,serverVersion:b.version}},idempotencyKey:i.idempotencyKey},{status:409})}}if(!es(i.slug))return y(e,{success:!1,error:{code:"PUB002",message:"Slug can only contain lowercase letters, numbers, and hyphens"},idempotencyKey:i.idempotencyKey},{status:400});if(i.dryRun){let b=await G().getArticle(i.slug),A=[];return b||A.push("Article with this slug does not exist"),y(e,{success:!0,warnings:A,idempotencyKey:i.idempotencyKey},{status:200})}let u=await G().removeArticle(i.slug,i.idempotencyKey),m=Z(),c=$(n.rateLimitResult),g={"X-Bloggy-Version":`platform/${m.version}`,"X-Idempotency-Key":i.idempotencyKey,...c},h=u.success?200:u.error?.code==="PUB007"?404:400;return y(e,u,{status:h,headers:g})}catch(t){return console.error("Unpublish endpoint error:",t),y(e,{success:false,error:{code:"PUB007",message:"Internal server error during unpublishing"},idempotencyKey:""},{status:500})}}function Zo(e){let t=[];if(!e||typeof e!="object")return t.push("Request body must be a valid object"),t;let r=e;return (!r.slug||typeof r.slug!="string")&&t.push("Missing required field: slug"),(!r.idempotencyKey||typeof r.idempotencyKey!="string")&&t.push("Missing required field: idempotencyKey"),r.slug&&typeof r.slug=="string"&&!r.slug.trim()&&t.push("Slug cannot be empty"),t}function es(e){return !e||typeof e!="string"?false:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)&&e.length>=1&&e.length<=100}async function ts(e){try{let t=await Y(e);if(!t.authenticated){let c=await re(e),g={success:!1,versions:{bloggy:{name:"unknown",version:"unknown",major:0,minor:0,patch:0},platform:{name:"unknown",version:"unknown",major:0,minor:0,patch:0}},compatibility:{compatible:!1,errorMessage:c.error?.error?.message??"Authentication required"}};return y(e,g,{status:401})}let r=q(t.token??"anonymous"),n=await Q(r);if(!n.allowed){let c=n.errorResponse.error?.details?.rateLimit,g=c&&typeof c=="object"&&"limit"in c&&"remaining"in c&&"reset"in c&&"count"in c&&"success"in c?c:{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},h=$(g),p={success:!1,versions:{bloggy:{name:"unknown",version:"unknown",major:0,minor:0,patch:0},platform:{name:"unknown",version:"unknown",major:0,minor:0,patch:0}},compatibility:{compatible:!1,errorMessage:n.errorResponse.error?.message??"Rate limit exceeded"}};return y(e,p,{status:429,headers:h})}let o=Z(),i=e.headers.get("X-Bloggy-Version"),s={name:"unknown",version:"unknown",major:0,minor:0,patch:0};if(i)try{if(/^\d+\.\d+\.\d+/.test(i)){let c=i.split("."),g=parseInt(c[0]??"0",10),h=parseInt(c[1]??"0",10),p=parseInt(c[2]?.split("-")[0]??"0",10);s={name:"bloggy",version:i,major:g,minor:h,patch:p};}else {let c=ue(i);c?.bloggyVersion&&(s=c.bloggyVersion);}}catch(c){console.warn("Failed to parse X-Bloggy-Version header:",c);}let l={compatible:!0};s.version!=="unknown"&&(l=Fr(s,o));let a={success:!0,versions:{bloggy:s,platform:o},compatibility:l},u=$(n.rateLimitResult),m={"X-Bloggy-Version":`platform/${o.version}`,"Cache-Control":"public, max-age=300, stale-while-revalidate=60",...u};return y(e,a,{status:200,headers:m})}catch(t){console.error("Version endpoint error:",t);let r={success:false,versions:{bloggy:{name:"unknown",version:"unknown",major:0,minor:0,patch:0},platform:{name:"unknown",version:"unknown",major:0,minor:0,patch:0}},compatibility:{compatible:false,errorMessage:"Internal server error while checking version compatibility"},error:t instanceof Error?t.message:"Unknown error"};return y(e,r,{status:500})}}var rs=/^[A-Za-z0-9-]{8,128}$/;async function ns(e){let t=await Y(e);if(!t.authenticated){let a=await re(e);return y(e,{success:false,error:{code:a.error?.error?.code??"PUB005",message:a.error?.error?.message??"Authentication required"}},{status:401})}let r=q(t.token??"anonymous"),n=await Q(r);if(!n.allowed){let a=$({remaining:0,reset:Date.now()+6e4,limit:5});return y(e,{success:false,error:n.errorResponse.error??{code:"PUB011",message:"Rate limit exceeded"}},{status:429,headers:a})}if(!e.headers.get("content-type")?.includes("application/json"))return y(e,Wt("Expected JSON body"),{status:400});let i;try{i=await e.json();}catch{return y(e,Wt("Invalid JSON body"),{status:400})}let s=os(i);if(!s.success)return y(e,Wt(s.message),{status:400});let l=[];return s.config.searchSubmission&&(await G().setMetadata("searchSubmission",s.config.searchSubmission),l.push("searchSubmission")),y(e,{success:true,updated:l},{status:200,headers:$(n.rateLimitResult)})}async function is(e){return ye(e,["POST"],{allowedHeaders:["Content-Type","X-Bloggy-Version","Authorization","X-Requested-With"]})}function Wt(e){return {success:false,error:{code:"PUB001",message:e}}}function os(e){if(!e||typeof e!="object"||Array.isArray(e))return {success:false,message:"Request body must be an object"};let t=e,r=new Set(["version","searchSubmission"]),n=Object.keys(t).filter(i=>!r.has(i));if(n.length>0)return {success:false,message:`Unsupported config section: ${n.join(", ")}`};if(t.version!==1)return {success:false,message:"Config version must be 1"};let o={version:1};if(t.searchSubmission!==void 0){let i=ss(t.searchSubmission);return i.success?{success:true,config:{...o,searchSubmission:i.config}}:i}return {success:false,message:"At least one supported config section is required"}}function ss(e){if(!e||typeof e!="object"||Array.isArray(e))return {success:false,message:"searchSubmission must be an object"};let t=e,r=new Set(["indexNow"]),n=Object.keys(t).filter(s=>!r.has(s));if(n.length>0)return {success:false,message:`Unsupported searchSubmission section: ${n.join(", ")}`};if(t.indexNow===void 0)return {success:false,message:"searchSubmission.indexNow is required"};let o=t.indexNow;if(!o||typeof o!="object"||Array.isArray(o))return {success:false,message:"searchSubmission.indexNow must be an object"};let i=o;if(typeof i.enabled!="boolean")return {success:false,message:"indexNow.enabled must be a boolean"};if(typeof i.key!="string"||!rs.test(i.key))return {success:false,message:"indexNow.key must be 8 to 128 characters using letters, numbers, or dashes"};if(typeof i.keyLocation!="string")return {success:false,message:"indexNow.keyLocation must be a URL"};try{let s=new URL(i.keyLocation);if(s.protocol!=="https:"&&s.protocol!=="http:")return {success:!1,message:"indexNow.keyLocation must use HTTP or HTTPS"}}catch{return {success:false,message:"indexNow.keyLocation must be a URL"}}return {success:true,config:{indexNow:{enabled:i.enabled,key:i.key,keyLocation:i.keyLocation}}}}async function as(e){let r=(await G().getMetadata("searchSubmission"))?.indexNow;return !r?.enabled||!r.key?new server_js.NextResponse("Not found",{status:404}):new server_js.NextResponse(r.key,{status:200,headers:{"Content-Type":"text/plain; charset=utf-8","Cache-Control":"public, max-age=300, stale-while-revalidate=60"}})}async function cs(e,{params:t}){try{let{slug:r}=await t,n=await Y(e);if(!n.authenticated){let b=await re(e);return server_js.NextResponse.json(b.error,{status:401})}let o=q(n.token??"anonymous"),i=await Q(o);if(!i.allowed){let b=i.errorResponse.error?.details?.rateLimit||{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},A=$(b);return y(e,i.errorResponse,{status:429,headers:A})}if(!r||!Xt(r))return y(e,{exists:!1,error:{code:"PUB002",message:"Invalid slug format. Must be lowercase letters, numbers, and hyphens only."}},{status:400});let s=e.headers.get("X-Bloggy-Version");if(s){let b=ue(s);if(b?.platformVersion){let A=Z();if(b.platformVersion.major!==A.major)return y(e,{exists:!1,error:{code:"PUB009",message:"Major version incompatibility. Please upgrade your blog platform package.",details:{clientVersion:b.platformVersion.version,serverVersion:A.version}}},{status:409})}}let u=await G().getArticle(r)!==null,m={exists:u,...u&&{message:"Slug is already in use. Please choose another (e.g., append '-v2')."}},c=Z(),g=$(i.rateLimitResult),h={"X-Bloggy-Version":`platform/${c.version}`,...g},p=e.headers.get("X-Idempotency-Key");return p&&(h["X-Idempotency-Key"]=p,console.log(`Slug check for idempotency: ${p}, exists: ${u}`)),y(e,m,{status:200,headers:h})}catch(r){return console.error("Slug existence check error:",r instanceof Error?r.message:String(r)),y(e,{exists:false,error:{code:"PUB007",message:"Internal server error during slug check"}},{status:500})}}async function us(e){return ye(e,["GET"])}var tu=ke.version;
|
|
79
|
-
exports.ApiKeyAuth=
|
|
73
|
+
);`;function Yr(e){switch(e){case "bp_articles":return Qt;case "bp_operations":return Zt;case "bp_metadata":return er}}function Wr(e,t){throw Zn(e,t)?new Fe([t],{cause:e}):e}function Zn(e,t){return Qr(e).some(r=>r.includes(`no such table: ${t}`)||r.includes(`no such table: main.${t}`))}function Qr(e){if(!e||typeof e!="object")return [String(e)];let t=[];e instanceof Error&&t.push(e.message);let r=e.cause;return r!==void 0&&t.push(...Qr(r)),t}function es(){return {schemaVersion:rr,requiredTableNames:je,createAll:[Qt,Zt,er],createArticles:Qt,createOperations:Zt,createMetadata:er}}function _e(e,t=true){let r=e.trim();return r=r.replace(/\/+$/,""),/^https?:\/\//.exec(r)||(r=`${t?"https":"http"}://${r}`),t&&r.startsWith("http://")&&(r=r.replace("http://","https://")),r}function Zr(e){let t=e.trim();if(!t)throw new Error("Slug cannot be empty");if(!/^[a-z0-9-]+$/.test(t))throw new Error("Slug can only contain lowercase letters, numbers, and hyphens");let i=t.replace(/-+/g,"-").replace(/^-+|-+$/g,"");if(!i)throw new Error("Slug cannot consist only of hyphens");return i}function ye(e,t={}){let{forceHttps:r=true,removeTrailingSlash:i=true,domain:n=e.site.domain,pathPrefix:o="/blog"}=t;if(!n)throw new Error("Domain is required for canonical URL generation");if(!e.slug)throw new Error("Article slug is required for canonical URL generation");let s=_e(n,r),l=Zr(e.slug),a=o.replace(/^(?!\/)/,"/").replace(/\/+$/,""),u=`${s}${a}/${l}`;return i&&(u=u.replace(/\/+$/,"")),u}function ts(e,t,r={}){return ye({slug:t,site:e},r)}function rs(e){try{let t=new URL(e);return !(!["http:","https:"].includes(t.protocol)||!t.hostname||t.hostname.length===0||/^https?:\/\/\//.exec(e)&&!/^https?:\/\/[^\/]/.exec(e)||e.includes(" "))}catch{return false}}function is(e){try{let t=new URL(e);return `${t.protocol}//${t.host}`}catch{throw new Error("Invalid canonical URL provided")}}function os(e,t={}){let r=ye(e,t);return {...e,meta:{...e.meta,canonicalUrl:r}}}function ns(e,t={},r){let i=r?.path??"/blog",o=`https://${t.canonical?.domain??e.domain}${i}`,s=r?.title?`${r.title} | ${e.name}`:e.name,l=r?.description??e.description,a=t.openGraph?.siteName??e.name,u=[{name:"description",content:l},{name:"author",content:a}];r?.pageNumber&&r.pageNumber>1&&u.push({name:"page",content:r.pageNumber.toString()}),t.meta?.robots&&u.push({name:"robots",content:t.meta.robots}),t.meta?.viewport&&u.push({name:"viewport",content:t.meta.viewport}),t.meta?.themeColor&&u.push({name:"theme-color",content:t.meta.themeColor}),t.meta?.applicationName&&u.push({name:"application-name",content:t.meta.applicationName});let c=[{property:"og:title",content:s},{property:"og:description",content:l},{property:"og:url",content:o},{property:"og:site_name",content:a},{property:"og:locale",content:t.openGraph?.locale??e.locale},{property:"og:type",content:t.openGraph?.type??"website"}];t.openGraph?.defaultImage&&c.push({property:"og:image",content:t.openGraph.defaultImage},{property:"og:image:alt",content:`${a} - ${e.tagline}`});let d=ss(null,{site:t.twitter?.site,creator:t.twitter?.creator,cardType:t.twitter?.cardType??"summary"},{title:s,description:l,image:t.openGraph?.defaultImage});return {meta:u,openGraph:c,twitter:d,links:[{rel:"canonical",href:o}],title:s,description:l,canonicalUrl:o}}function ss(e,t,r){let i=r?.title??e?.meta.title??e?.title??"",n=r?.description??e?.meta.description??e?.excerpt??"",o=r?.image??e?.meta.ogImage??e?.featuredImage,s=[{name:"twitter:card",content:t.cardType},{name:"twitter:title",content:i},{name:"twitter:description",content:n}];return t.site&&s.push({name:"twitter:site",content:t.site}),t.creator&&s.push({name:"twitter:creator",content:t.creator}),o&&(s.push({name:"twitter:image",content:o}),e?.featuredImageAlt),s}function as(e){let t=[];return t.push(`<title>${G(e.title)}</title>`),e.meta.forEach(r=>{let i=[];r.name&&i.push(`name="${G(r.name)}"`),r.property&&i.push(`property="${G(r.property)}"`),r.httpEquiv&&i.push(`http-equiv="${G(r.httpEquiv)}"`),i.push(`content="${G(r.content)}"`),t.push(`<meta ${i.join(" ")} />`);}),e.openGraph.forEach(r=>{t.push(`<meta property="${G(r.property)}" content="${G(r.content)}" />`);}),e.twitter.forEach(r=>{t.push(`<meta name="${G(r.name)}" content="${G(r.content)}" />`);}),e.links.forEach(r=>{let i=[];i.push(`rel="${G(r.rel)}"`),i.push(`href="${G(r.href)}"`),r.type&&i.push(`type="${G(r.type)}"`),r.title&&i.push(`title="${G(r.title)}"`),t.push(`<link ${i.join(" ")} />`);}),t.join(`
|
|
74
|
+
`)}function G(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,r=>t[r]??r)}function ls(e){let t=[],r=[];return e.title?e.title.length>60?r.push("Title longer than 60 characters may be truncated in search results"):e.title.length<30&&r.push("Title shorter than 30 characters may not be descriptive enough"):t.push("Title is required"),e.description?e.description.length>160?r.push("Meta description longer than 160 characters may be truncated"):e.description.length<120&&r.push("Meta description shorter than 120 characters may not be descriptive enough"):t.push("Meta description is required"),e.canonicalUrl?e.canonicalUrl.startsWith("https://")||r.push("Canonical URL should use HTTPS for better SEO"):t.push("Canonical URL is required"),e.openGraph.find(o=>o.property==="og:image")||r.push("OpenGraph image missing - social media sharing will not show image preview"),e.twitter.find(o=>o.name==="twitter:card")||r.push("Twitter Card type missing - Twitter sharing may not display properly"),{valid:t.length===0,errors:t,warnings:r}}async function ir(e,t,r=[],i={}){let{includeAuthorPages:n=true,includeTopicPages:o=true,includeSeriesPages:s=true,maxEntries:l=5e4,changeFrequency:a={},priority:u={}}=i,c=[],d=_e(i.canonical?.domain??e.domain,i.canonical?.forceHttps??true),h=i.canonical?.pathPrefix??"/blog",y=r.length>0?r:Te(t),f=Re([...t]),g=Ne([...t]);return c.push({url:`${d}${h}`,lastModified:V(t),changeFrequency:a.homePage??"daily",priority:u.homePage??1}),t.forEach(b=>{if(c.length>=l)return;let T=ye(b,i.canonical);c.push({url:T,lastModified:b.updatedAt,changeFrequency:a.articles??"monthly",priority:u.articles??.8});}),o&&f.length>0&&(c.length<l&&c.push({url:`${d}${v(h,"topics")}`,lastModified:V(t),changeFrequency:a.topicPages??"weekly",priority:u.topicPages??.6}),f.forEach(b=>{if(c.length>=l)return;let T=t.filter(I=>(I.topics??[]).some(S=>S.slug===b.slug));c.push({url:`${d}${v(h,`topics/${b.slug}`)}`,lastModified:V(T),changeFrequency:a.topicPages??"weekly",priority:u.topicPages??.6});})),s&&g.length>0&&(c.length<l&&c.push({url:`${d}${v(h,"series")}`,lastModified:V(t),changeFrequency:a.seriesPages??"weekly",priority:u.seriesPages??.6}),g.forEach(b=>{if(c.length>=l)return;let T=t.filter(I=>I.series?.slug===b.slug);c.push({url:`${d}${le(h,b.slug)}`,lastModified:V(T),changeFrequency:a.seriesPages??"weekly",priority:u.seriesPages??.6});})),n&&y.length>0&&(c.length<l&&c.push({url:`${d}${v(h,"authors")}`,lastModified:V(t),changeFrequency:a.authorPages??"weekly",priority:u.authorPages??.6}),y.forEach(b=>{if(c.length>=l)return;let T=`${d}${B(h,b.slug)}`,I=t.filter(E=>E.author?.id===b.id),S=V(I);c.push({url:T,lastModified:S,changeFrequency:a.authorPages??"weekly",priority:u.authorPages??.6});})),c}function cs(e,t,r=[],i={}){let{includeAuthorPages:n=true,includeTopicPages:o=true,includeSeriesPages:s=true,maxEntries:l=5e4,changeFrequency:a={},priority:u={}}=i,c=[],d=_e(i.canonical?.domain??e.domain,i.canonical?.forceHttps??true),h=i.canonical?.pathPrefix??"/blog",y=new Date().toISOString(),f=r.length>0?r:Te(t),g=Re([...t]),b=Ne([...t]),T=1;T+=t.length,o&&g.length>0&&(T+=g.length+1),s&&b.length>0&&(T+=b.length+1),n&&(T+=f.length>0?f.length+1:0);let I=T>l;return c.push({loc:`${d}${h}`,lastmod:V(t),changefreq:a.homePage??"daily",priority:u.homePage??1}),t.forEach(S=>{if(c.length>=l)return;let E=ye(S,i.canonical);c.push({loc:E,lastmod:S.updatedAt,changefreq:a.articles??"monthly",priority:u.articles??.8});}),o&&g.length>0&&(c.length<l&&c.push({loc:`${d}${v(h,"topics")}`,lastmod:V(t),changefreq:a.topicPages??"weekly",priority:u.topicPages??.6}),g.forEach(S=>{if(c.length>=l)return;let E=t.filter(X=>(X.topics??[]).some(j=>j.slug===S.slug));c.push({loc:`${d}${v(h,`topics/${S.slug}`)}`,lastmod:V(E),changefreq:a.topicPages??"weekly",priority:u.topicPages??.6});})),s&&b.length>0&&(c.length<l&&c.push({loc:`${d}${v(h,"series")}`,lastmod:V(t),changefreq:a.seriesPages??"weekly",priority:u.seriesPages??.6}),b.forEach(S=>{if(c.length>=l)return;let E=t.filter(X=>X.series?.slug===S.slug);c.push({loc:`${d}${le(h,S.slug)}`,lastmod:V(E),changefreq:a.seriesPages??"weekly",priority:u.seriesPages??.6});})),n&&f.length>0&&(c.length<l&&c.push({loc:`${d}${v(h,"authors")}`,lastmod:V(t),changefreq:a.authorPages??"weekly",priority:u.authorPages??.6}),f.forEach(S=>{if(c.length>=l)return;let E=`${d}${B(h,S.slug)}`,X=t.filter(gt=>gt.author?.id===S.id),j=V(X);c.push({loc:E,lastmod:j,changefreq:a.authorPages??"weekly",priority:u.authorPages??.6});})),{entries:c,totalEntries:c.length,truncated:I,generatedAt:y,baseUrl:d}}function ei(e){let t='<?xml version="1.0" encoding="UTF-8"?>',r='<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">',i="</urlset>",n=e.entries.map(o=>{let s=[];return s.push(" <url>"),s.push(` <loc>${ze(o.loc)}</loc>`),o.lastmod&&s.push(` <lastmod>${ze(o.lastmod)}</lastmod>`),o.changefreq&&s.push(` <changefreq>${ze(o.changefreq)}</changefreq>`),o.priority!==void 0&&s.push(` <priority>${o.priority.toFixed(1)}</priority>`),s.push(" </url>"),s.join(`
|
|
75
|
+
`)});return [t,r,...n,i].join(`
|
|
76
|
+
`)}function us(e,t){let r='<?xml version="1.0" encoding="UTF-8"?>',i='<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">',n="</sitemapindex>",o=e.map(s=>{let l=[];return l.push(" <sitemap>"),l.push(` <loc>${ze(s.url)}</loc>`),s.lastmod&&l.push(` <lastmod>${ze(s.lastmod)}</lastmod>`),l.push(" </sitemap>"),l.join(`
|
|
77
|
+
`)});return [r,i,...o,n].join(`
|
|
78
|
+
`)}function ds(e){let t=[],r=[];e.entries.length===0?t.push("Sitemap must contain at least one URL"):e.entries.length>5e4&&t.push("Sitemap contains more than 50,000 URLs (Google limit)"),e.truncated&&r.push("Sitemap was truncated due to size limits"),e.entries.forEach((n,o)=>{try{new URL(n.loc);}catch{t.push(`Invalid URL at entry ${o+1}: ${n.loc}`);}n.priority!==void 0&&(n.priority<0||n.priority>1)&&t.push(`Invalid priority at entry ${o+1}: must be between 0.0 and 1.0`),n.lastmod&&!gs(n.lastmod)&&t.push(`Invalid lastmod date at entry ${o+1}: ${n.lastmod}`),n.loc.length>2048&&r.push(`URL at entry ${o+1} exceeds 2048 character limit`);});let i=new Map;return e.entries.forEach(n=>{let o=i.get(n.loc)??0;i.set(n.loc,o+1);}),i.forEach((n,o)=>{n>1&&t.push(`Duplicate URL found: ${o} (appears ${n} times)`);}),{valid:t.length===0,errors:t,warnings:r}}function V(e){return e.length===0?new Date().toISOString():e.reduce((r,i)=>{let n=new Date(i.updatedAt);return n>r?n:r},new Date(e[0].updatedAt)).toISOString()}function ms(e,t,r=[],i={}){return async function(){let s=(await ir(e,t,r,i)).map(u=>({loc:u.url,lastmod:typeof u.lastModified=="string"?u.lastModified:u.lastModified?.toISOString(),changefreq:u.changeFrequency,priority:u.priority})),l={entries:s,totalEntries:s.length,generatedAt:new Date().toISOString(),baseUrl:_e(i.canonical?.domain??e.domain,i.canonical?.forceHttps??true)},a=ei(l);return new Response(a,{headers:{"Content-Type":"application/xml","Cache-Control":"public, max-age=3600, s-maxage=3600"}})}}function ps(e){return async function(){let r=[...e.staticRoutes??[],...e.getStaticRoutes?await e.getStaticRoutes():[]],i=await e.getSite(),n=await e.getArticles(),o=e.getAuthors?await e.getAuthors():[];return [...r,...await ir(i,n,o,e.options)]}}function ze(e){let t={"&":"&","<":"<",">":">",'"':""","'":"'"};return e.replace(/[&<>"']/g,r=>t[r]??r)}function gs(e){try{let t=new Date(e),r=t.toISOString(),i=e.endsWith("Z")&&!e.includes(".")?e.replace("Z",".000Z"):e;return r===i&&!isNaN(t.getTime())}catch{return false}}var ke={name:"@xexr/blog-platform",version:"1.2.0"};function ti(e){let r=e.replace(/^v/,"").split(".");if(r.length<3)throw new Error(`Invalid version format: ${e}`);let i=parseInt(r[0]??"0",10),n=parseInt(r[1]??"0",10),o=parseInt(r[2]?.split("-")[0]??"0",10);if(isNaN(i)||isNaN(n)||isNaN(o))throw new Error(`Invalid version format: ${e}`);return {major:i,minor:n,patch:o}}function ee(){let e=ti(ke.version);return {name:ke.name,version:ke.version,...e}}function me(e){try{let t=e.split(" "),r={};for(let i of t){let[n,o]=i.split("/");if(!n||!o)continue;let s=ti(o),l={name:n,version:o,...s};n==="bloggy"?r.bloggyVersion=l:n==="platform"&&(r.platformVersion=l);}return r}catch{return null}}function ri(e,t){try{return e.major!==t.major?{compatible:!1,errorCode:"PUB009",errorMessage:`Major version incompatibility: ${e.name} ${e.version} is not compatible with ${t.name} ${t.version}. Please upgrade.`}:e.minor!==t.minor?{compatible:!0,errorCode:"PUB010",warning:`Minor version difference: ${e.name} ${e.version} with ${t.name} ${t.version}. Some features may not be available.`}:{compatible:!0}}catch(r){return {compatible:false,errorMessage:`Failed to check version compatibility: ${r instanceof Error?r.message:"Unknown error"}`}}}var ii={enableCSP:true,cspDirectives:{"default-src":"'self'","script-src":"'self' 'unsafe-inline'","style-src":"'self' 'unsafe-inline'","img-src":"'self' data: https:","font-src":"'self' https:","connect-src":"'self'","media-src":"'self'","object-src":"'none'","base-uri":"'self'","form-action":"'self'","frame-ancestors":"'none'","upgrade-insecure-requests":""},enableFrameOptions:true,frameOptions:"DENY",enableContentTypeOptions:true,enableXSSProtection:true,enableReferrerPolicy:true,referrerPolicy:"strict-origin-when-cross-origin",enableHSTS:true,hstsMaxAge:31536e3,hstsIncludeSubdomains:true,enablePermissionsPolicy:true,permissionsPolicyDirectives:{camera:"()",microphone:"()",geolocation:"()",payment:"()",usb:"()",accelerometer:"()",gyroscope:"()",magnetometer:"()"}};function hs(){let e=process.env.BLOG_PLATFORM_DISABLE_CSP==="true",t=process.env.BLOG_PLATFORM_FRAME_OPTIONS,r=process.env.BLOG_PLATFORM_DISABLE_HSTS==="true";return {...ii,enableCSP:!e,frameOptions:t??ii.frameOptions,enableHSTS:!r}}function bs(e){return Object.entries(e).map(([t,r])=>r?`${t} ${r}`:t).join("; ")}function xs(e){return Object.entries(e).map(([t,r])=>`${t}=${r}`).join(", ")}function ys(e,t={}){let r={...hs(),...t},i={};if(r.enableCSP){let n={...r.cspDirectives,...t.cspDirectives??{}};i["Content-Security-Policy"]=bs(n);}if(r.enableFrameOptions&&(i["X-Frame-Options"]=r.frameOptions),r.enableContentTypeOptions&&(i["X-Content-Type-Options"]="nosniff"),r.enableXSSProtection&&(i["X-XSS-Protection"]="1; mode=block"),r.enableReferrerPolicy&&(i["Referrer-Policy"]=r.referrerPolicy),r.enableHSTS&&vs(e)){let n=[`max-age=${r.hstsMaxAge}`,r.hstsIncludeSubdomains?"includeSubDomains":""].filter(Boolean).join("; ");i["Strict-Transport-Security"]=n;}if(r.enablePermissionsPolicy){let n={...r.permissionsPolicyDirectives,...t.permissionsPolicyDirectives??{}};i["Permissions-Policy"]=xs(n);}return i}function vs(e){return !!(e.url.startsWith("https://")||e.headers.get("x-forwarded-proto")==="https"||e.headers.get("cf-visitor")?.includes('"scheme":"https"'))}function pt(e,t={}){return ys(e,{...t,cspDirectives:{...{"default-src":"'none'","frame-ancestors":"'none'","base-uri":"'none'"},...t.cspDirectives??{}}})}var oi={allowedOrigins:["http://localhost:3000","https://localhost:3000","http://127.0.0.1:3000","https://127.0.0.1:3000"],allowWildcard:false,allowCredentials:false,maxAge:86400,securityConfig:{}};function ni(){let e=process.env.BLOG_PLATFORM_ALLOWED_ORIGINS,t=process.env.BLOG_PLATFORM_ALLOW_WILDCARD==="true",r=process.env.BLOG_PLATFORM_ALLOW_CREDENTIALS==="true";return {...oi,allowedOrigins:e?e.split(",").map(i=>i.trim()):oi.allowedOrigins,allowWildcard:t,allowCredentials:r}}function si(e,t){return e?t.allowWildcard?true:t.allowedOrigins.includes(e):false}function ai(e,t){let r=e.headers.get("origin"),i={};return t.allowWildcard?i["Access-Control-Allow-Origin"]="*":r&&si(r,t)&&(i["Access-Control-Allow-Origin"]=r),t.allowCredentials&&!t.allowWildcard&&(i["Access-Control-Allow-Credentials"]="true"),t.allowWildcard||(i.Vary="Origin"),i}function Ps(e,t,r,i){return {...ai(e,t),"Access-Control-Allow-Methods":r.join(", "),"Access-Control-Allow-Headers":i.join(", "),"Access-Control-Max-Age":t.maxAge.toString()}}var As=["Content-Type","X-Bloggy-Version","X-Idempotency-Key","Authorization","X-Requested-With"];function A(e,t,r={}){let{status:i=200,headers:n={},corsConfig:o={}}=r,s={...ni(),...o},l=ai(e,s),a=pt(e,s.securityConfig),u={"Content-Type":"application/json",...l,...a,...n};return server_js.NextResponse.json(t,{status:i,headers:u})}function ve(e,t,r={}){let{allowedHeaders:i=As,corsConfig:n={}}=r,o={...ni(),...n},s=e.headers.get("origin");if(s&&!o.allowWildcard&&!si(s,o)){let u=pt(e,o.securityConfig);return new server_js.NextResponse(null,{status:403,headers:{"Content-Type":"text/plain",...u}})}let l=Ps(e,o,[...t,"OPTIONS"],i),a=pt(e,o.securityConfig);return new server_js.NextResponse(null,{status:200,headers:{...l,...a}})}async function ws(e){try{let t=await Q(e);if(!t.authenticated){let g=await ie(e);return A(e,g.error,{status:401})}let r=z(t.token??"anonymous"),i=await Z(r);if(!i.allowed){let g=i.errorResponse.error?.details?.rateLimit,b=g&&typeof g=="object"&&"limit"in g&&"remaining"in g&&"reset"in g&&"count"in g&&"success"in g?g:{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},T=M(b);return A(e,i.errorResponse,{status:429,headers:T})}if(!e.headers.get("content-type")?.includes("application/json"))return A(e,{success:!1,error:{code:"PUB001",message:"Content-Type must be application/json"},idempotencyKey:""},{status:400});let o;try{o=await e.json();}catch{return A(e,{success:!1,error:{code:"PUB001",message:"Invalid JSON in request body"},idempotencyKey:""},{status:400})}let s=Ss(o);if(s.length>0)return A(e,{success:!1,error:{code:"PUB001",message:"Invalid or missing fields",details:{errors:s}},idempotencyKey:o.idempotencyKey??""},{status:400});let l=e.headers.get("X-Bloggy-Version");if(l){let g=me(l);if(g?.platformVersion){let b=ee();if(g.platformVersion.major!==b.major)return A(e,{success:!1,error:{code:"PUB009",message:"Major version incompatibility. Please upgrade your blog platform package.",details:{clientVersion:g.platformVersion.version,serverVersion:b.version}},idempotencyKey:o.idempotencyKey},{status:409})}}if(o.dryRun){let g=[];return o.article.wordCount<50&&g.push("Article has fewer than 50 words, which may affect SEO"),(!o.article.excerpt||o.article.excerpt.length<120)&&g.push("Article excerpt is shorter than recommended 120 characters"),o.article.meta.keywords.length||g.push("No SEO keywords provided"),A(e,{success:!0,warnings:g,idempotencyKey:o.idempotencyKey},{status:200})}let a={...o.article,slug:o.slug??o.article.slug,meta:{...o.article.meta,description:o.metaDescription??o.article.meta.description}};if(!nr(a.slug))return A(e,{success:!1,error:{code:"PUB002",message:"Slug can only contain lowercase letters, numbers, and hyphens"},idempotencyKey:o.idempotencyKey},{status:400});let c=await H().saveArticle(a,o.idempotencyKey),d=ee(),h=M(i.rateLimitResult),y={"X-Bloggy-Version":`platform/${d.version}`,"X-Idempotency-Key":o.idempotencyKey,...h};c.success&&(y.Location=c.url??`/${a.slug}`);let f=c.success?201:c.error?.code==="PUB003"?409:400;return A(e,c,{status:f,headers:y})}catch(t){return console.error("Publish endpoint error:",t),A(e,{success:false,error:{code:"PUB007",message:"Internal server error during publishing"},idempotencyKey:""},{status:500})}}function Ss(e){let t=[];if(!e||typeof e!="object")return t.push("Request body must be a valid object"),t;let r=e;if((!r.article||typeof r.article!="object")&&t.push("Missing required field: article"),(!r.idempotencyKey||typeof r.idempotencyKey!="string")&&t.push("Missing required field: idempotencyKey"),r.article&&typeof r.article=="object"){let i=r.article,n=["id","slug","title","content","publishedAt","site"];for(let o of n)i[o]||t.push(`Missing required article field: ${o}`);if(i.site&&typeof i.site=="object"){let o=i.site,s=["id","name","domain"];for(let l of s)o[l]||t.push(`Missing required site field: ${l}`);}if(i.meta&&typeof i.meta=="object"){let o=i.meta;Array.isArray(o.keywords)||t.push("Article meta.keywords must be an array");}i.video!==void 0&&i.video!==null&&t.push(...At(i.video));}return t}function nr(e){return !e||typeof e!="string"?false:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)&&e.length>=1&&e.length<=100}async function Ts(e){try{let t=await Q(e);if(!t.authenticated){let f=await ie(e);return server_js.NextResponse.json(f.error,{status:401})}let r=z(t.token??"anonymous"),i=await Z(r);if(!i.allowed){let f=i.errorResponse.error?.details?.rateLimit,g=f&&typeof f=="object"&&"limit"in f&&"remaining"in f&&"reset"in f&&"count"in f&&"success"in f?f:{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},b=M(g);return A(e,i.errorResponse,{status:429,headers:b})}if(!e.headers.get("content-type")?.includes("application/json"))return A(e,{success:!1,error:{code:"PUB001",message:"Content-Type must be application/json"},idempotencyKey:""},{status:400});let o;try{o=await e.json();}catch{return A(e,{success:!1,error:{code:"PUB001",message:"Invalid JSON in request body"},idempotencyKey:""},{status:400})}let s=Rs(o);if(s.length>0)return A(e,{success:!1,error:{code:"PUB001",message:"Missing required fields",details:{errors:s}},idempotencyKey:o.idempotencyKey??""},{status:400});let l=e.headers.get("X-Bloggy-Version");if(l){let f=me(l);if(f?.platformVersion){let g=ee();if(f.platformVersion.major!==g.major)return A(e,{success:!1,error:{code:"PUB009",message:"Major version incompatibility. Please upgrade your blog platform package.",details:{clientVersion:f.platformVersion.version,serverVersion:g.version}},idempotencyKey:o.idempotencyKey},{status:409})}}if(!Cs(o.slug))return A(e,{success:!1,error:{code:"PUB002",message:"Slug can only contain lowercase letters, numbers, and hyphens"},idempotencyKey:o.idempotencyKey},{status:400});if(o.dryRun){let g=await H().getArticle(o.slug),b=[];return g||b.push("Article with this slug does not exist"),A(e,{success:!0,warnings:b,idempotencyKey:o.idempotencyKey},{status:200})}let u=await H().removeArticle(o.slug,o.idempotencyKey),c=ee(),d=M(i.rateLimitResult),h={"X-Bloggy-Version":`platform/${c.version}`,"X-Idempotency-Key":o.idempotencyKey,...d},y=u.success?200:u.error?.code==="PUB007"?404:400;return A(e,u,{status:y,headers:h})}catch(t){return console.error("Unpublish endpoint error:",t),A(e,{success:false,error:{code:"PUB007",message:"Internal server error during unpublishing"},idempotencyKey:""},{status:500})}}function Rs(e){let t=[];if(!e||typeof e!="object")return t.push("Request body must be a valid object"),t;let r=e;return (!r.slug||typeof r.slug!="string")&&t.push("Missing required field: slug"),(!r.idempotencyKey||typeof r.idempotencyKey!="string")&&t.push("Missing required field: idempotencyKey"),r.slug&&typeof r.slug=="string"&&!r.slug.trim()&&t.push("Slug cannot be empty"),t}function Cs(e){return !e||typeof e!="string"?false:/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e)&&e.length>=1&&e.length<=100}async function Ls(e){try{let t=await Q(e);if(!t.authenticated){let d=await ie(e),h={success:!1,versions:{bloggy:{name:"unknown",version:"unknown",major:0,minor:0,patch:0},platform:{name:"unknown",version:"unknown",major:0,minor:0,patch:0}},compatibility:{compatible:!1,errorMessage:d.error?.error?.message??"Authentication required"}};return A(e,h,{status:401})}let r=z(t.token??"anonymous"),i=await Z(r);if(!i.allowed){let d=i.errorResponse.error?.details?.rateLimit,h=d&&typeof d=="object"&&"limit"in d&&"remaining"in d&&"reset"in d&&"count"in d&&"success"in d?d:{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},y=M(h),f={success:!1,versions:{bloggy:{name:"unknown",version:"unknown",major:0,minor:0,patch:0},platform:{name:"unknown",version:"unknown",major:0,minor:0,patch:0}},compatibility:{compatible:!1,errorMessage:i.errorResponse.error?.message??"Rate limit exceeded"}};return A(e,f,{status:429,headers:y})}let n=ee(),o=e.headers.get("X-Bloggy-Version"),s={name:"unknown",version:"unknown",major:0,minor:0,patch:0};if(o)try{if(/^\d+\.\d+\.\d+/.test(o)){let d=o.split("."),h=parseInt(d[0]??"0",10),y=parseInt(d[1]??"0",10),f=parseInt(d[2]?.split("-")[0]??"0",10);s={name:"bloggy",version:o,major:h,minor:y,patch:f};}else {let d=me(o);d?.bloggyVersion&&(s=d.bloggyVersion);}}catch(d){console.warn("Failed to parse X-Bloggy-Version header:",d);}let l={compatible:!0};s.version!=="unknown"&&(l=ri(s,n));let a={success:!0,versions:{bloggy:s,platform:n},compatibility:l},u=M(i.rateLimitResult),c={"X-Bloggy-Version":`platform/${n.version}`,"Cache-Control":"public, max-age=300, stale-while-revalidate=60",...u};return A(e,a,{status:200,headers:c})}catch(t){console.error("Version endpoint error:",t);let r={success:false,versions:{bloggy:{name:"unknown",version:"unknown",major:0,minor:0,patch:0},platform:{name:"unknown",version:"unknown",major:0,minor:0,patch:0}},compatibility:{compatible:false,errorMessage:"Internal server error while checking version compatibility"},error:t instanceof Error?t.message:"Unknown error"};return A(e,r,{status:500})}}var _s=/^[A-Za-z0-9-]{8,128}$/;async function ks(e){let t=await Q(e);if(!t.authenticated){let a=await ie(e);return A(e,{success:false,error:{code:a.error?.error?.code??"PUB005",message:a.error?.error?.message??"Authentication required"}},{status:401})}let r=z(t.token??"anonymous"),i=await Z(r);if(!i.allowed){let a=M({remaining:0,reset:Date.now()+6e4,limit:5});return A(e,{success:false,error:i.errorResponse.error??{code:"PUB011",message:"Rate limit exceeded"}},{status:429,headers:a})}if(!e.headers.get("content-type")?.includes("application/json"))return A(e,sr("Expected JSON body"),{status:400});let o;try{o=await e.json();}catch{return A(e,sr("Invalid JSON body"),{status:400})}let s=Bs(o);if(!s.success)return A(e,sr(s.message),{status:400});let l=[];return s.config.searchSubmission&&(await H().setMetadata("searchSubmission",s.config.searchSubmission),l.push("searchSubmission")),A(e,{success:true,updated:l},{status:200,headers:M(i.rateLimitResult)})}async function Is(e){return ve(e,["POST"],{allowedHeaders:["Content-Type","X-Bloggy-Version","Authorization","X-Requested-With"]})}function sr(e){return {success:false,error:{code:"PUB001",message:e}}}function Bs(e){if(!e||typeof e!="object"||Array.isArray(e))return {success:false,message:"Request body must be an object"};let t=e,r=new Set(["version","searchSubmission"]),i=Object.keys(t).filter(o=>!r.has(o));if(i.length>0)return {success:false,message:`Unsupported config section: ${i.join(", ")}`};if(t.version!==1)return {success:false,message:"Config version must be 1"};let n={version:1};if(t.searchSubmission!==void 0){let o=Es(t.searchSubmission);return o.success?{success:true,config:{...n,searchSubmission:o.config}}:o}return {success:false,message:"At least one supported config section is required"}}function Es(e){if(!e||typeof e!="object"||Array.isArray(e))return {success:false,message:"searchSubmission must be an object"};let t=e,r=new Set(["indexNow"]),i=Object.keys(t).filter(s=>!r.has(s));if(i.length>0)return {success:false,message:`Unsupported searchSubmission section: ${i.join(", ")}`};if(t.indexNow===void 0)return {success:false,message:"searchSubmission.indexNow is required"};let n=t.indexNow;if(!n||typeof n!="object"||Array.isArray(n))return {success:false,message:"searchSubmission.indexNow must be an object"};let o=n;if(typeof o.enabled!="boolean")return {success:false,message:"indexNow.enabled must be a boolean"};if(typeof o.key!="string"||!_s.test(o.key))return {success:false,message:"indexNow.key must be 8 to 128 characters using letters, numbers, or dashes"};if(typeof o.keyLocation!="string")return {success:false,message:"indexNow.keyLocation must be a URL"};try{let s=new URL(o.keyLocation);if(s.protocol!=="https:"&&s.protocol!=="http:")return {success:!1,message:"indexNow.keyLocation must use HTTP or HTTPS"}}catch{return {success:false,message:"indexNow.keyLocation must be a URL"}}return {success:true,config:{indexNow:{enabled:o.enabled,key:o.key,keyLocation:o.keyLocation}}}}async function Os(e){let r=(await H().getMetadata("searchSubmission"))?.indexNow;return !r?.enabled||!r.key?new server_js.NextResponse("Not found",{status:404}):new server_js.NextResponse(r.key,{status:200,headers:{"Content-Type":"text/plain; charset=utf-8","Cache-Control":"public, max-age=300, stale-while-revalidate=60"}})}async function $s(e,{params:t}){try{let{slug:r}=await t,i=await Q(e);if(!i.authenticated){let g=await ie(e);return server_js.NextResponse.json(g.error,{status:401})}let n=z(i.token??"anonymous"),o=await Z(n);if(!o.allowed){let g=o.errorResponse.error?.details?.rateLimit||{limit:10,remaining:0,reset:Date.now()+6e4,count:10,success:!1},b=M(g);return A(e,o.errorResponse,{status:429,headers:b})}if(!r||!nr(r))return A(e,{exists:!1,error:{code:"PUB002",message:"Invalid slug format. Must be lowercase letters, numbers, and hyphens only."}},{status:400});let s=e.headers.get("X-Bloggy-Version");if(s){let g=me(s);if(g?.platformVersion){let b=ee();if(g.platformVersion.major!==b.major)return A(e,{exists:!1,error:{code:"PUB009",message:"Major version incompatibility. Please upgrade your blog platform package.",details:{clientVersion:g.platformVersion.version,serverVersion:b.version}}},{status:409})}}let u=await H().getArticle(r)!==null,c={exists:u,...u&&{message:"Slug is already in use. Please choose another (e.g., append '-v2')."}},d=ee(),h=M(o.rateLimitResult),y={"X-Bloggy-Version":`platform/${d.version}`,...h},f=e.headers.get("X-Idempotency-Key");return f&&(y["X-Idempotency-Key"]=f,console.log(`Slug check for idempotency: ${f}, exists: ${u}`)),A(e,c,{status:200,headers:y})}catch(r){return console.error("Slug existence check error:",r instanceof Error?r.message:String(r)),A(e,{exists:false,error:{code:"PUB007",message:"Internal server error during slug check"}},{status:500})}}async function Ds(e){return ve(e,["GET"])}var Xu=ke.version;
|
|
79
|
+
exports.ARTICLE_VIDEO_DESCRIPTION_MAX_LENGTH=Pt;exports.ARTICLE_VIDEO_TITLE_MAX_LENGTH=vt;exports.ApiKeyAuth=lt;exports.BLOG_PLATFORM_SCHEMA_VERSION=rr;exports.BLOG_PLATFORM_TABLE_NAMES=je;exports.BlogArticlePage=Or;exports.BlogAuthorPage=Hr;exports.BlogAuthorsIndexPage=Cn;exports.BlogHomePage=xr;exports.BlogPlatformSchemaError=Fe;exports.BlogSeriesArchivePage=zt;exports.BlogSeriesArchiveRoutePage=$r;exports.BlogSeriesIndexPage=Gt;exports.BlogSeriesPage=Mr;exports.BlogTopicArchivePage=Nn;exports.BlogTopicsIndexPage=Sn;exports.Button=gi;exports.Card=Me;exports.CardContent=$e;exports.CardDescription=ro;exports.CardFooter=io;exports.CardHeader=eo;exports.CardTitle=to;exports.DrizzleStorage=Yt;exports.EnvAuth=Ce;exports.InMemoryStorage=st;exports.NEWSLETTER_SUCCESS_MESSAGE=et;exports.NewsletterSignup=Ee;exports.NoAuth=Ve;exports.PACKAGE_VERSION=Xu;exports.Pagination=Pe;exports.PaginationContent=ht;exports.PaginationEllipsis=Xe;exports.PaginationItem=oe;exports.PaginationLink=pe;exports.PaginationNext=xt;exports.PaginationPrevious=bt;exports.SeriesNavigation=Ut;exports.ShadcnPagination=ft;exports.StructuredDataError=Be;exports.UninitializedAuth=ct;exports.autoConfigureRateLimit=Jt;exports.blogPlatformDrizzleSchema=zn;exports.bpArticles=N;exports.bpMetadata=de;exports.bpOperations=xe;exports.buildAuthorPath=B;exports.buildBlogPath=v;exports.buildSeriesPath=le;exports.buildYouTubeEmbedUrl=wt;exports.buildYouTubeStructuredDataEmbedUrl=St;exports.buildYouTubeThumbnailUrl=Tt;exports.buildYouTubeWatchUrl=Nt;exports.buttonVariants=qe;exports.checkDrizzleAdapterSchema=Jr;exports.checkRateLimit=zr;exports.cn=p;exports.configHandler=ks;exports.configOptionsHandler=Is;exports.configureRateLimit=dt;exports.createBlogSitemapRoute=ms;exports.createDynamicBlogSitemap=ps;exports.createRateLimitErrorResponse=qr;exports.createStructuredDataScript=ge;exports.createTokenFingerprint=z;exports.enforceRateLimit=Z;exports.ensureDrizzleAdapterSchema=Qn;exports.extractKeywordsFromArticle=_i;exports.extractTableOfContents=It;exports.extractTokenFromHeader=Wt;exports.formatArticleDateMeta=kt;exports.generateArticleMetadata=Yo;exports.generateArticleStructuredData=Ke;exports.generateAuthorPageMetadata=bn;exports.generateAuthorStructuredData=Je;exports.generateBlogHomeMetadata=Ji;exports.generateBlogHomeStructuredData=_t;exports.generateBlogSitemapEntries=ir;exports.generateBreadcrumbStructuredData=Ye;exports.generateCanonicalUrl=ye;exports.generateCanonicalUrlFromSlug=ts;exports.generateCompleteArticleStructuredData=Lt;exports.generateOrganizationStructuredData=Rt;exports.generatePaginationMetadata=Ai;exports.generateSeriesArchiveMetadata=sn;exports.generateSeriesIndexMetadata=on;exports.generateSiteMetadata=ns;exports.generateSitemap=cs;exports.generateSitemapIndex=us;exports.generateVideoStructuredData=ur;exports.generateWebSiteStructuredData=Ct;exports.getAllSeries=Ne;exports.getAllTopics=Re;exports.getArticlePrimaryTopic=Pn;exports.getArticleSeriesNavigation=Zo;exports.getAuthConfig=Kt;exports.getAuthorArchive=Vr;exports.getAuthorsFromArticles=Te;exports.getBaseUrl=is;exports.getBlogThemeStyle=$;exports.getDrizzleAdapterSql=es;exports.getPathPrefixFromBlogUrl=wi;exports.getRateLimitHeaders=M;exports.getRelatedFeaturedArticles=Ht;exports.getSeriesArchive=Ft;exports.getStorage=H;exports.getTopicArchive=Xt;exports.indexNowKeyRoute=Os;exports.initBlogPlatform=mt;exports.initBlogPlatformDev=Hn;exports.initBlogPlatformOnce=Un;exports.initBlogPlatformProd=Vn;exports.initEnvAuth=Bn;exports.isIsoDuration=cr;exports.isValidCanonicalUrl=rs;exports.isYouTubeVideoId=W;exports.loadAuthorArchive=vn;exports.metadataToHtml=as;exports.normalizeBlogBasePath=k;exports.normalizeDomain=_e;exports.normalizeSlug=Zr;exports.parseYouTubeVideoId=Li;exports.publishHandler=ws;exports.safeGenerateArticleStructuredData=ki;exports.setAuthConfig=ut;exports.setStorage=qt;exports.shouldSkipAuth=On;exports.sitemapToXml=ei;exports.slugExistsHandler=$s;exports.slugExistsOptionsHandler=Ds;exports.structuredDataToJsonLd=Qe;exports.unpublishHandler=Ts;exports.updateArticleCanonicalUrl=os;exports.usePagination=Pi;exports.validateMetadata=ls;exports.validatePublishedArticleVideo=At;exports.validateSitemap=ds;exports.validateStructuredData=dr;exports.versionHandler=Ls;//# sourceMappingURL=index.js.map
|
|
80
80
|
//# sourceMappingURL=index.js.map
|