import{t as e}from"./cache-DUthuMSu.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{i as n}from"./common-utils-B6fqqa3X.mjs";import{t as r}from"./got-BBDj7u1e.mjs";import{t as i}from"./timezone-keeL11Io.mjs";import{t as a}from"./description-DZgXxHlr.mjs";import{load as o}from"cheerio";const s={path:`/cmse/*`,name:`Unknown`,maintainers:[],handler:c};async function c(s){let c=n(s).replaceAll(/(^\/cmse|\/$)/g,``),l=`http://www.cmse.gov.cn${c===``?`/xwzx/zhxw/`:`${c}/`}`,u=o((await r({method:`get`,url:l})).data),d=u(`#list li a`).slice(0,s.req.query(`limit`)?Number.parseInt(s.req.query(`limit`)):15).toArray().map(e=>{e=u(e);let n=e.next().text(),r=new URL(e.attr(`href`),l).href;return{title:e.text(),pubDate:t(n),link:r.endsWith(`.html`)?r:`${r}#${n}`}});return d=await Promise.all(d.map(n=>e.tryGet(n.link,async()=>{let e=await r({method:`get`,url:n.link}),s=o(e.data);s(`.share`).remove();let c=e.data.match(/__\$pubtime='(.*?)';var/);return n.pubDate=c?i(t(c[1]),8):n.pubDate,n.description=a({video:s(`#con_video`).html(),description:s(`.TRS_Editor, #content`).html()}),n}))),{title:u(`title`).text(),link:l,item:d}}export{s as route};