import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./cache-DUthuMSu.mjs";import{t as n}from"./parse-date-BdYTmLpo.mjs";import{Fragment as r,jsx as i,jsxs as a}from"hono/jsx/jsx-runtime";import{load as o}from"cheerio";import{renderToString as s}from"hono/jsx/dom/server";import{raw as c}from"hono/html";const l=({intro:e,description:t})=>s(a(r,{children:[e?i(`blockquote`,{children:e}):null,t?i(r,{children:c(t)}):null]})),u=async r=>{let i=Number.parseInt(r.req.query(`limit`)??`30`,10),a=`https://rockthejvm.com`,s=new URL(`articles/1`,a).href,c=o(await e(s)),u=c(`html`).attr(`lang`)??`en`;c(`footer`).remove();let d=c(`h2`).slice(0,i).toArray().map(e=>{let t=c(e).parent().parent(),r=t.find(`h2 a`),i=r.text(),o=l({intro:t.find(`p.text-content`).first().text()}),s=t.find(`time`).attr(`datetime`),d=r.attr(`href`),f=t.find(`a.bg-tag`).toArray(),p=[...new Set(f.map(e=>c(e).text()).filter(Boolean))],m=t.find(`picture`).toArray().map(e=>{let t=c(e).parent();return{name:t.find(`p.text-content`).text(),url:t.find(`p.text-content a`).attr(`href`)?new URL(t.find(`p.text-content a`).attr(`href`),a).href:void 0,avatar:t.find(`img`).attr(`src`)?new URL(t.find(`img`).attr(`src`),a).href:void 0}}),h=s;return{title:i,description:o,pubDate:s?n(s):void 0,link:d?new URL(d,a).href:void 0,category:p,author:m,content:{html:o,text:o},updated:h?n(h):void 0,language:u}});return d=await Promise.all(d.map(r=>r.link?t.tryGet(r.link,async()=>{let t=o(await e(r.link)),i=t(`meta[property="og:title"]`).attr(`content`)??r.title,a=r.description+l({description:t(`div.prose`).html()??void 0}),s=t(`meta[property="article:published_time"]`).attr(`content`),c=t(`meta[property="article:tag"]`).toArray(),d=[...new Set(c.map(e=>t(e).attr(`content`)).filter(Boolean))],f=t(`meta[property="article:author"]`).toArray().map(e=>({name:t(e).attr(`content`),url:void 0,avatar:void 0})),p=t(`meta[property="og:image"]`).attr(`content`),m=s,h={title:i,description:a,pubDate:s?n(s):r.pubDate,category:d,author:f,content:{html:a,text:a},image:p,banner:p,updated:m?n(m):r.updated,language:u};return{...r,...h}}):r)),{title:c(`title`).text(),description:c(`meta[property="og:description"]`).attr(`content`),link:s,item:d,allowEmpty:!0,image:c(`meta[property="og:image"]`).attr(`content`),author:c(`meta[property="og:site_name"]`).attr(`content`),language:u,id:c(`meta[property="og:url"]`).attr(`content`)}},d={path:`/articles`,name:`Article`,url:`rockthejvm.com`,maintainers:[`nczitzk`],handler:u,example:`/rockthejvm/articles`,parameters:void 0,description:void 0,categories:[`programming`],features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportRadar:!0,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`rockthejvm.com/articles`],target:`/articles`}],view:0};export{u as handler,d as route};