(()=>{var e={};e.id=78,e.ids=[78],e.modules={28303:e=>{function r(e){var r=Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r}r.keys=()=>[],r.resolve=r,r.id=28303,e.exports=r},10846:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},44870:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},3295:e=>{"use strict";e.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},29294:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-async-storage.external.js")},63033:e=>{"use strict";e.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},79428:e=>{"use strict";e.exports=require("buffer")},55511:e=>{"use strict";e.exports=require("crypto")},94735:e=>{"use strict";e.exports=require("events")},91645:e=>{"use strict";e.exports=require("net")},19771:e=>{"use strict";e.exports=require("process")},27910:e=>{"use strict";e.exports=require("stream")},41204:e=>{"use strict";e.exports=require("string_decoder")},66136:e=>{"use strict";e.exports=require("timers")},34631:e=>{"use strict";e.exports=require("tls")},79551:e=>{"use strict";e.exports=require("url")},28354:e=>{"use strict";e.exports=require("util")},74075:e=>{"use strict";e.exports=require("zlib")},4573:e=>{"use strict";e.exports=require("node:buffer")},48874:(e,r,s)=>{"use strict";s.r(r),s.d(r,{patchFetch:()=>A,routeModule:()=>d,serverHooks:()=>x,workAsyncStorage:()=>p,workUnitAsyncStorage:()=>l});var t={};s.r(t),s.d(t,{GET:()=>c});var i=s(42706),n=s(28203),o=s(45994),u=s(39187),a=s(27914);async function c(e){try{let{searchParams:r}=new URL(e.url),s=r.get("filter")||"all",t=`
          SELECT
            c.id, c.title, c.description, c.thumbnailUrl, c.publishedAt,
            s.viewCount, s.subscriberCount, s.videoCount,
            s_2d.viewCount AS viewCount2dAgo,
            s_2d.subscriberCount AS subscriberCount2dAgo,
            s_7d.viewCount AS viewCount7dAgo,
            s_7d.subscriberCount AS subscriberCount7dAgo
          FROM channels c
          JOIN channel_stats s ON c.id = s.channel_id
            AND s.date = (SELECT MAX(date) FROM channel_stats WHERE channel_id = c.id)
          LEFT JOIN channel_stats s_2d ON c.id = s_2d.channel_id
            AND s_2d.date = DATE_SUB(CURDATE(), INTERVAL 2 DAY)
          LEFT JOIN channel_stats s_7d ON c.id = s_7d.channel_id
            AND s_7d.date = DATE_SUB(CURDATE(), INTERVAL 7 DAY)
        `;"viral48h"===s?t+=" WHERE s_2d.subscriberCount IS NOT NULL":"viral7d"===s&&(t+=" WHERE s_7d.subscriberCount IS NOT NULL"),t+=" ORDER BY s.subscriberCount DESC LIMIT 50";let[i]=await a.A.query(t);return u.NextResponse.json({channels:i})}catch(e){return console.error("Database API error:",e.message),u.NextResponse.json({error:"Internal server error"},{status:500})}}let d=new i.AppRouteRouteModule({definition:{kind:n.RouteKind.APP_ROUTE,page:"/api/channels/route",pathname:"/api/channels",filename:"route",bundlePath:"app/api/channels/route"},resolvedPagePath:"C:\\Users\\HP\\Desktop\\youtubenichefinder\\src\\app\\api\\channels\\route.ts",nextConfigOutput:"",userland:t}),{workAsyncStorage:p,workUnitAsyncStorage:l,serverHooks:x}=d;function A(){return(0,o.patchFetch)({workAsyncStorage:p,workUnitAsyncStorage:l})}},96487:()=>{},78335:()=>{},27914:(e,r,s)=>{"use strict";s.d(r,{A:()=>t});let t=s(60820).createPool({host:process.env.DB_HOST||"localhost",user:process.env.DB_USER||"root",password:process.env.DB_PASSWORD||"",database:process.env.DB_NAME||"youtube",waitForConnections:!0,connectionLimit:10,maxIdle:10,idleTimeout:6e4,queueLimit:0,enableKeepAlive:!0,keepAliveInitialDelay:0})}};var r=require("../../../webpack-runtime.js");r.C(e);var s=e=>r(r.s=e),t=r.X(0,[638,452,820],()=>s(48874));module.exports=t})();