import{t as e}from"./logger-B0fjfmRH.mjs";import{t}from"./cache-DUthuMSu.mjs";import{t as n}from"./parse-date-BdYTmLpo.mjs";import{t as r}from"./playwright-1-2p8zlN.mjs";import{load as i}from"cheerio";const a=async a=>{let o=Number.parseInt(a.req.query(`limit`)??`20`,10),s=`https://www.perplexity.ai`,c=`${s}/changelog`;e.http(`Fetching Perplexity changelog from ${c}`);let{page:l,destroy:u,browser:d}=await r(c,{onBeforeLoad:async e=>{await e.setRequestInterception(!0),e.on(`request`,e=>{e.resourceType()===`document`?e.continue():e.abort()})}}),f=i(await l.evaluate(()=>document.documentElement.innerHTML)),p=f(`html`).attr(`lang`)??`en`,m=new Set,h=f(`a[href^="./changelog/"]`).toArray().map(e=>{let t=f(e),r=t.attr(`href`);if(!r||!r.startsWith(`./changelog/`))return null;let i=r.startsWith(`http`)?r:`${s}${r.replace(`./`,`/`)}`;if(m.has(i))return null;let a=t.find(`[data-framer-name="Title"]`).first(),o=a.text().trim()||r.replace(`./changelog/`,``).replaceAll(`-`,` `),c=t.find(`[data-framer-name="Category"] p`).first(),l=c.text().trim(),u=t.find(`[data-framer-name="Description"] p, [data-framer-name="Summary"] p`).first();u.length||(u=t.find(`p.framer-text`).not(a).not(c).first());let d=u.text().trim();m.add(i);let p;if(l){let e=l.match(/(\d{2})\.(\d{2})\.(\d{2,4})/);if(e){let[,t,r,i]=e;p=n(`${i.length===2?`20${i}`:i}-${t}-${r}`)}else p=n(l)}else{let e=o.match(/(January|February|March|April|May|June|July|August|September|October|November|December)\s+\d{1,2}(?:st|nd|rd|th)?,\s*\d{4}/);e&&(p=n(e[0]))}return{title:o,description:d,link:i,pubDate:p,guid:`perplexity-changelog-${i}`,id:`perplexity-changelog-${i}`}}).filter(e=>e!==null),g=await Promise.all(h.slice(0,o).map(async n=>n.link?await t.tryGet(n.link,async()=>{e.http(`Fetching full content for ${n.link}`);let t=await d.newPage();await t.setRequestInterception(!0),t.on(`request`,e=>{e.resourceType()===`document`?e.continue():e.abort()}),await t.goto(n.link,{waitUntil:`domcontentloaded`});let r=await t.evaluate(()=>document.documentElement.innerHTML);await t.close();let a=i(r)(`div#main > div > div > div[data-framer-component-type="RichTextContainer"]`).first().html()?.trim()||``;return{...n,description:a||n.description}}):n));return await u(),{title:f(`title`).text()||`Perplexity Changelog`,description:f(`meta[name="description"], meta[property="og:description"]`).first().attr(`content`)||`Latest updates and changes from Perplexity`,link:c,item:g,allowEmpty:!0,image:f(`meta[property="og:image"]`).attr(`content`),language:p}},o={path:`/changelog`,name:`Changelog`,url:`www.perplexity.ai`,maintainers:[`xbot`],handler:a,example:`/perplexity/changelog`,description:`Subscribe to Perplexity changelog for latest updates and releases.`,categories:[`program-update`],features:{requireConfig:!1,requirePuppeteer:!0,antiCrawler:!1,supportRadar:!0,supportBT:!1,supportPodcast:!1,supportScihub:!1},radar:[{source:[`www.perplexity.ai/changelog`],target:`/changelog`}],view:0};export{a as handler,o as route};