module.exports=[93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},53782,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),i=e.i(61916),s=e.i(14444),o=e.i(37092),l=e.i(69741),d=e.i(16795),c=e.i(87718),u=e.i(95169),p=e.i(47587),h=e.i(66012),m=e.i(70101),x=e.i(26937),f=e.i(10372),v=e.i(93695);e.i(52474);var R=e.i(5232),g=e.i(89171),w=e.i(89660);async function y(e){try{let{searchParams:t}=new URL(e.url),r=t.get("characterId"),a=t.get("feedType"),n="true"===t.get("storiesOnly"),i=await (0,w.createClient)(),{data:{user:s}}=await i.auth.getUser(),o=w.supabaseAdmin.from("feeds").select(`
                *,
                character:characters (
                    id,
                    name,
                    image_url,
                    user_id,
                    profiles (
                        name
                    )
                )
            `);if(n&&(o=o.neq("type","update")),r){let e=["public","unlisted"];s&&e.push("private"),o=o.in("visibility",e).eq("character_id",r)}else o=o.eq("visibility","public");o="hot"===a?o.order("likes_count",{ascending:!1}):o.order("created_at",{ascending:!1});let{data:l,error:d}=await o.limit(30);if(d)return console.error("Error fetching feeds:",d),g.NextResponse.json({success:!1,error:"Failed to fetch feeds"},{status:500});return g.NextResponse.json({success:!0,feeds:l.filter(e=>"private"!==e.visibility||e.character?.user_id===s?.id||e.user_id===s?.id).map(e=>({id:e.id,characterId:e.character_id,characterName:e.character?.name||"Unknown",characterAvatar:e.character?.image_url||"",type:e.type,content:e.content,mediaUrl:e.media_url,likes:e.likes_count,comments:e.comments_count,date:new Date(e.created_at).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),time:new Date(e.created_at).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}),metadata:{...e.metadata,creatorName:e.character?.profiles?.name||"Creator"},characterUserId:e.character?.user_id}))})}catch(e){return console.error("Critical Feeds API Failure:",e),g.NextResponse.json({success:!1,error:"Internal server error"},{status:500})}}e.s(["GET",()=>y],4637);var E=e.i(4637);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/feeds/route",pathname:"/api/feeds",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/feeds/route.ts",nextConfigOutput:"standalone",userland:E}),{workAsyncStorage:_,workUnitAsyncStorage:b,serverHooks:A}=C;function N(){return(0,a.patchFetch)({workAsyncStorage:_,workUnitAsyncStorage:b})}async function T(e,t,a){C.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let g="/api/feeds/route";g=g.replace(/\/index$/,"")||"/";let w=await C.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:y,params:E,nextConfig:_,parsedUrl:b,isDraftMode:A,prerenderManifest:N,routerServerContext:T,isOnDemandRevalidate:k,revalidateOnlyGenerated:P,resolvedPathname:q,clientReferenceManifest:S,serverActionsManifest:O}=w,U=(0,l.normalizeAppPath)(g),j=!!(N.dynamicRoutes[U]||N.routes[q]),I=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,b,!1):t.end("This page could not be found"),null);if(j&&!A){let e=!!N.routes[q],t=N.dynamicRoutes[U];if(t&&!1===t.fallback&&!e){if(_.experimental.adapterPath)return await I();throw new v.NoFallbackError}}let H=null;!j||C.isDev||A||(H="/index"===(H=q)?"/":H);let D=!0===C.isDev||!j,M=j&&!D;O&&S&&(0,s.setReferenceManifestsSingleton)({page:g,clientReferenceManifest:S,serverActionsManifest:O,serverModuleMap:(0,o.createServerModuleMap)({serverActionsManifest:O})});let F=e.method||"GET",$=(0,i.getTracer)(),K=$.getActiveScopeSpan(),L={params:E,prerenderManifest:N,renderOpts:{experimental:{authInterrupts:!!_.experimental.authInterrupts},cacheComponents:!!_.cacheComponents,supportsDynamicResponse:D,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:_.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a)=>C.onRequestError(e,t,a,T)},sharedContext:{buildId:y}},B=new d.NodeNextRequest(e),G=new d.NodeNextResponse(t),V=c.NextRequestAdapter.fromNodeNextRequest(B,(0,c.signalFromNodeResponse)(t));try{let s=async e=>C.handle(V,L).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route");if(a){let t=`${F} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${F} ${g}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var i,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&k&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let i=await s(n);e.fetchMetrics=L.renderOpts.fetchMetrics;let l=L.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=L.renderOpts.collectedTags;if(!j)return await (0,h.sendResponse)(B,G,i,L.renderOpts.pendingWaitUntil),null;{let e=await i.blob(),t=(0,m.toNodeOutgoingHttpHeaders)(i.headers);d&&(t[f.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==L.renderOpts.collectedRevalidate&&!(L.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&L.renderOpts.collectedRevalidate,a=void 0===L.renderOpts.collectedExpire||L.renderOpts.collectedExpire>=f.INFINITE_CACHE?void 0:L.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:i.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:k})},T),t}},c=await C.handleResponse({req:e,nextConfig:_,cacheKey:H,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:k,revalidateOnlyGenerated:P,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!j)return null;if((null==c||null==(i=c.value)?void 0:i.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==c||null==(l=c.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",k?"REVALIDATED":c.isMiss?"MISS":c.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let u=(0,m.fromNodeOutgoingHttpHeaders)(c.value.headers);return o&&j||u.delete(f.NEXT_CACHE_TAGS_HEADER),!c.cacheControl||t.getHeader("Cache-Control")||u.get("Cache-Control")||u.set("Cache-Control",(0,x.getCacheControlHeader)(c.cacheControl)),await (0,h.sendResponse)(B,G,new Response(c.value.body,{headers:u,status:c.value.status||200})),null};K?await l(K):await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${F} ${g}`,kind:i.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},l))}catch(t){if(t instanceof v.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:U,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:M,isOnDemandRevalidate:k})}),j)throw t;return await (0,h.sendResponse)(B,G,new Response(null,{status:500})),null}}e.s(["handler",()=>T,"patchFetch",()=>N,"routeModule",()=>C,"serverHooks",()=>A,"workAsyncStorage",()=>_,"workUnitAsyncStorage",()=>b],53782)}];

//# sourceMappingURL=%5Broot-of-the-server%5D__044046d8._.js.map