import{t as e}from"./invalid-parameter-DLv2wPKB.mjs";import{t}from"./description-Bb3QXrbH.mjs";import{NarouNovelFetch as n,R18Site as r,SearchBuilderR18 as i}from"narou";let a=function(e){return e.NOCTURNE=`noc`,e.MOONLIGHT=`mnlt`,e.MIDNIGHT=`mid`,e.MOONLIGHT_BL=`mnlt-bl`,e}({}),o=function(e){return e.DAILY=`daily`,e.WEEKLY=`weekly`,e.MONTHLY=`monthly`,e.QUARTER=`quarter`,e.YEARLY=`yearly`,e}({}),s=function(e){return e.TOTAL=`total`,e.SHORT=`t`,e.ONGOING=`r`,e.COMPLETE=`er`,e}({});const c={noc:r.Nocturne,mnlt:r.MoonLight,"mnlt-bl":r.MoonLightBL,mid:r.Midnight},l={noc:`ノクターン`,mnlt:`ムーンライト`,"mnlt-bl":`ムーンライト BL`,mid:`ミッドナイト`},u={daily:`dailypoint`,weekly:`weeklypoint`,monthly:`monthlypoint`,quarter:`quarterpoint`,yearly:`yearlypoint`},d={daily:`日間`,weekly:`週間`,monthly:`月間`,quarter:`四半期`,yearly:`年間`},f={total:`総合`,t:`短編`,r:`連載中`,er:`完結済`},p={path:`/rankingr18/:sub/:type`,categories:[`reading`],example:`/syosetu/rankingr18/noc/daily_total?limit=50`,parameters:(()=>{let e=Object.entries(a).map(([,e])=>({value:e,label:l[e]})),t=Object.entries(o).map(([e,t])=>({value:t,label:`${d[t]} (${e})`})),n=Object.entries(s).map(([e,t])=>({value:t,label:`${f[t]} (${e})`}));return{sub:{description:`Target site for R18 rankings`,options:e},type:{description:`Detailed ranking type (format: period_noveltype)`,options:t.flatMap(e=>n.map(t=>({value:`${e.value}_${t.value}`,label:`${e.label} ${t.label}`})))}}})(),features:{requireConfig:!1,requirePuppeteer:!1,antiCrawler:!1,supportBT:!1,supportPodcast:!1,supportScihub:!1},name:`R18 Rankings`,url:`syosetu.com/site/group`,maintainers:[`SnowAgar25`],handler:g,description:`
| Period | Description | 説明 |
| --- | --- | --- |
| daily | Daily Ranking | 日間ランキング |
| weekly | Weekly Ranking | 週間ランキング |
| monthly | Monthly Ranking | 月間ランキング |
| quarter | Quarterly Ranking | 四半期ランキング |
| yearly | Yearly Ranking | 年間ランキング |

| Novel Type | Description | 説明 |
| --- | --- | --- |
| total | All Works | 総合 |
| t | Short Stories | 短編 |
| r | Ongoing Series | 連載中 |
| er | Completed Series | 完結済 |

::: tip
Combine Period and Novel Type with \`_\`.
For example: \`daily_total\`, \`weekly_r\`, \`monthly_er\`
:::`,radar:[{source:[`noc.syosetu.com/rank/list/type/:type`],target:`/rankingr18/noc/:type`},{source:[`mid.syosetu.com/rank/list/type/:type`],target:`/rankingr18/mid/:type`},{source:[`mnlt.syosetu.com/rank/list/type/:type`],target:`/rankingr18/mnlt/:type`},{source:[`mnlt.syosetu.com/rank/bllist/type/:type`],target:`/rankingr18/mnlt-bl/:type`},...Object.entries(a).flatMap(([,e])=>Object.values(o).map(t=>({title:`${l[e]} ${d[t]}ランキング BEST5`,source:[`${e===`mnlt-bl`?`mnlt`:e}.syosetu.com/rank/${e===`mnlt-bl`?`bltop`:`top`}`],target:`/rankingr18/${e}/${t}_total?limit=5`})))]};function m(t){let[n,r]=t.split(`_`),i=n,a=r;if(![Object.values(o).includes(i),Object.values(s).includes(a)].every(Boolean))throw new e(`Invalid ranking type: ${t}`);return{period:n,novelType:r}}function h(e,t){let{period:n,novelType:r}=m(e);return`${d[n]}${f[r]}ランキング BEST${t}`}async function g(r){let{sub:a,type:o}=r.req.param(),s=`${`https://${a===`mnlt-bl`?`mnlt`:a}.syosetu.com`}/rank/list/type/${o}`,l=new n,d=Math.min(Number(r.req.query(`limit`)??300),300),{period:f,novelType:p}=m(o),g={gzip:5,lim:d,order:u[f]};if(p!==`total`&&(g.type=p),!(a in c))throw new e(`Invalid subsite: ${a}`);let _=c[a],v=(await new i(g,l).r18Site(_).execute()).values.map((e,n)=>({title:`#${n+1} ${e.title}`,link:`https://novel18.syosetu.com/${String(e.ncode).toLowerCase()}`,description:t({novel:e}),author:e.writer,category:e.keyword.split(/[\s/\uFF0F]/).filter(Boolean)}));return{title:`小説家になろう (${a}) - ${h(o,d)}`,link:s,item:v,language:`ja`}}export{p as route};