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{load as r}from"cheerio";const i={name:`投稿`,categories:[`reading`],path:`/works/:id`,example:`/kakuyomu/works/1177354054894027232`,parameters:{id:`投稿 ID`},maintainers:[`KarasuShin`],handler:a,features:{supportRadar:!0},radar:[{source:[`kakuyomu.jp/works/:id`],target:`/works/:id`}]};async function a(i){let a=i.req.param(`id`),o=`https://kakuyomu.jp/works/${a}`,s=Number.parseInt(i.req.query(`limit`)||`10`),c=r(await e(o)),{props:{pageProps:{__APOLLO_STATE__:l}}}=JSON.parse(c(`#__NEXT_DATA__`).text()),{[`Work:${a}`]:{title:u,catchphrase:d}}=l,f=Object.values(l).filter(e=>e.__typename===`Episode`);return{title:u,link:o,description:d,item:await Promise.all(f.toSorted((e,t)=>t.publishedAt.localeCompare(e.publishedAt)).slice(0,s).map(i=>{let o=`https://kakuyomu.jp/works/${a}/episodes/${i.id}`;return t.tryGet(o,async()=>{let t=r(await e(o))(`.widget-episodeBody`).html();return{title:i.title,link:o,description:t,pubDate:n(i.publishedAt),guid:i.id}})}))}}export{i as route};