import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./config-BYRrjYC5.mjs";import{t as n}from"./parse-date-BdYTmLpo.mjs";import r from"markdown-it";const i=r({html:!0,linkify:!0}),a={path:`/pull/:user/:repo/:state?/:labels?`,categories:[`programming`],example:`/github/pull/DIYgod/RSSHub`,parameters:{user:`User name`,repo:`Repo name`,state:"the state of pull requests. Can be either `open`, `closed`, or `all`. Default: `open`.",labels:`a list of comma separated label names`},features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`github.com/:user/:repo/pulls`,`github.com/:user/:repo/pulls/:id`,`github.com/:user/:repo`],target:`/pull/:user/:repo`}],name:`Repo Pull Requests`,maintainers:[`hashman`,`TonyRL`],handler:o};async function o(r){let a=r.req.param(`user`),o=r.req.param(`repo`),s=r.req.param(`state`)??`open`,c=r.req.param(`labels`),l=`https://github.com/${a}/${o}/pulls`,u=`https://api.github.com/repos/${a}/${o}/issues`,d={Accept:`application/vnd.github.v3+json`};t.github&&t.github.access_token&&(d.Authorization=`token ${t.github.access_token}`);let f=(await e(u,{query:{state:s,labels:c,sort:`created`,direction:`desc`,per_page:r.req.query(`limit`)?Math.min(Number.parseInt(r.req.query(`limit`)),100):100},headers:d})).filter(e=>e.pull_request);return{allowEmpty:!0,title:`${a}/${o} Pull requests`,link:l,item:f.map(e=>({title:e.title,author:e.user.login,description:e.body?i.render(e.body):`No description`,pubDate:n(e.created_at),link:e.html_url}))}}export{a as route};