import{t as e}from"./ofetch-Dl6dVB_5.mjs";import{t}from"./parse-date-BdYTmLpo.mjs";import{t as n}from"./invalid-parameter-DLv2wPKB.mjs";import{load as r}from"cheerio";const i={today:{label:`Today's News`,scene:12,view:14},"intrusion-daily-cyber-threat-alert":{label:`Cyberattacks`,scene:13,view:15},"ransomware-minute":{label:`Ransomware`,scene:16,view:18},cryptocrime:{label:`Cryptocrime`,scene:18,view:20},"hack-blotter":{label:`Hack Blotter`,scene:19,view:21},"cybersecurity-venture-capital-vc-deals":{label:`VC Deal Flow`,scene:3,view:3},"mergers-and-acquisitions-report":{label:`M&A Tracker`,scene:11,view:13}},a={name:`News`,categories:[`programming`],path:`/news/:category?`,example:`/cybersecurityventures/news`,radar:Object.keys(i).map(e=>({source:[`cybersecurityventures.com/${e}`],target:`/news/${e}`,title:i[e].label})),parameters:{category:{description:`news category`,default:`today`,options:Object.keys(i).map(e=>({value:e,label:i[e].label}))}},handler:o,maintainers:[`KarasuShin`],features:{supportRadar:!0},view:0};async function o(a){let o=a.req.param(`category`)??`today`,s=a.req.query(`limit`)??20;if(!(o in i))throw new n(`Invalid category`);let{scene:c,view:l,label:u}=i[o],d=await e(`https://us-east-1-renderer-read.knack.com/v1/scenes/scene_${c}/views/view_${l}/records?format=raw&page=1&rows_per_page=${s}&sort_field=field_2&sort_order=desc`,{headers:{"X-Knack-Application-Id":`6013171b60be8f001cb27363`,"X-Knack-Rest-Api-Key":`renderer`}});return{title:`${u} - Cybercrime Magazine`,link:`https://cybersecurityventures.com//${o}`,item:d.records.map(e=>{let n=r(e.field_3,null,!1),i=n(`a`).attr(`href`),a=`<p>${e.field_4}</p><br>${n.html()}`;return{title:e.field_5,description:a,pubDate:t(e.field_2.iso_timestamp),link:i,guid:`cybersecurityventures:${e.id}`}})}}export{a as route};