module.exports=[22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},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"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},74533,(e,t,r)=>{t.exports=e.x("node:child_process",()=>require("node:child_process"))},83935,(e,t,r)=>{t.exports=e.x("sql.js-59d66b30daa0a8d2/dist/sql-asm.js",()=>require("sql.js-59d66b30daa0a8d2/dist/sql-asm.js"))},84501,14966,e=>{"use strict";e.s(["ensureDb",()=>N,"getDb",()=>R],84501);var t=e.i(22734),r=e.i(14747),a=e.i(46786);let i=r.default.join(a.default.homedir(),".idea-manager","data");function s(){return r.default.join((t.default.existsSync(i)||t.default.mkdirSync(i,{recursive:!0}),i),"im.db")}let n=r.default.join(a.default.homedir(),".idea-manager","sync");function o(){return t.default.existsSync(n)||t.default.mkdirSync(n,{recursive:!0}),n}e.s(["getDbPath",()=>s,"getSyncDir",()=>o],14966);var d=e.i(74533);let c=!1,p="";async function E(){let e=new Date,t=e.getHours(),r=`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;if(9===t&&p!==r)try{let e,t;await N();let a=R(),i=a.prepare("SELECT t.title, t.status, p.name as project_name FROM tasks t JOIN projects p ON t.project_id = p.id WHERE t.is_today = 1 AND t.status != 'done'").all(),s=a.prepare("SELECT COUNT(*) as count FROM tasks WHERE status IN ('submitted', 'testing')").get(),n=a.prepare("SELECT COUNT(*) as count FROM tasks WHERE status = 'problem'").get(),o=[];if(i.length>0){for(let e of(o.push(`Today: ${i.length}개`),i.slice(0,5)))o.push(`  - ${e.title}`);i.length>5&&o.push(`  ... +${i.length-5}개`)}else o.push("Today 태스크가 없습니다.");s.count>0&&o.push(`진행 중: ${s.count}개`),n.count>0&&o.push(`문제: ${n.count}개`),e=o.join("\n").replace(/"/g,'\\"').replace(/\n/g,"\\n"),t=`display notification "${e}" with title "IM - 오늘의 할 일"`,(0,d.exec)(`osascript -e '${t}'`,e=>{e&&console.error("[Scheduler] notification error:",e.message)}),p=r}catch(e){console.error("[Scheduler] error:",e)}}class u{db;dbPath;dirty=!1;constructor(e,t){this.db=e,this.dbPath=t}save(){if(!this.dirty)return;let e=this.db.export();t.default.writeFileSync(this.dbPath,Buffer.from(e)),this.dirty=!1}immediatelySave(){this.dirty=!0,this.save()}rowsToObjects(e,t){return t.map(t=>{let r={};return e.forEach((e,a)=>{r[e]=t[a]}),r})}prepare(e){let t=this,r=/^\s*(INSERT|UPDATE|DELETE|CREATE|ALTER|DROP)/i.test(e);return{all(...r){let a=t.db.prepare(e);r.length>0&&a.bind(r);let i=a.getColumnNames(),s=[];for(;a.step();)s.push(a.get());return a.free(),t.rowsToObjects(i,s)},get(...r){let a,i=t.db.prepare(e);if(r.length>0&&i.bind(r),i.step()){let e=i.getColumnNames(),t=i.get(),r={};e.forEach((e,a)=>{r[e]=t[a]}),a=r}return i.free(),a},run:(...a)=>(t.db.run(e,a),r&&t.immediatelySave(),{changes:t.db.getRowsModified()})}}exec(e){this.db.exec(e),/^\s*(INSERT|UPDATE|DELETE|CREATE|ALTER|DROP)/im.test(e)&&this.immediatelySave()}pragma(e){if(e.startsWith("table_info(")){let t=e.match(/table_info\((\w+)\)/)?.[1];if(!t)return[];let r=this.db.exec(`PRAGMA table_info(${t})`);return r.length?this.rowsToObjects(r[0].columns,r[0].values):[]}if(e.includes("journal_mode")||e.includes("wal_checkpoint"))return this.immediatelySave(),"memory";if(e.includes("foreign_keys")){try{this.db.run(`PRAGMA ${e}`)}catch{}return}try{let t=this.db.exec(`PRAGMA ${e}`);if(t.length>0&&t[0].values.length>0)return t[0].values[0][0]}catch{}}transaction(e){let t=this;return()=>{t.db.run("BEGIN");try{let r=e();return t.db.run("COMMIT"),t.immediatelySave(),r}catch(e){throw t.db.run("ROLLBACK"),e}}}close(){this.immediatelySave(),this.db.close()}}let l=null,T=null;async function _(){var r;let a,i,n;if(l)return l;let o=e.r(83935),d=await o(),p=s();if(t.default.existsSync(p)){let e=t.default.readFileSync(p);a=new d.Database(e)}else a=new d.Database;return(r=l=new u(a,p)).exec(`
    CREATE TABLE IF NOT EXISTS projects (
      id TEXT PRIMARY KEY,
      name TEXT NOT NULL,
      description TEXT NOT NULL DEFAULT '',
      project_path TEXT,
      created_at TEXT NOT NULL DEFAULT (datetime('now')),
      updated_at TEXT NOT NULL DEFAULT (datetime('now'))
    );

    CREATE TABLE IF NOT EXISTS brainstorms (
      id TEXT PRIMARY KEY,
      project_id TEXT NOT NULL,
      content TEXT NOT NULL DEFAULT '',
      version INTEGER NOT NULL DEFAULT 1,
      created_at TEXT NOT NULL DEFAULT (datetime('now')),
      updated_at TEXT NOT NULL DEFAULT (datetime('now')),
      FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    );

  `),(i=r.prepare("PRAGMA table_info(projects)").all()).some(e=>"project_path"===e.name)||r.exec("ALTER TABLE projects ADD COLUMN project_path TEXT"),i.some(e=>"ai_context"===e.name)||r.exec("ALTER TABLE projects ADD COLUMN ai_context TEXT NOT NULL DEFAULT ''"),i.some(e=>"watch_enabled"===e.name)||r.exec("ALTER TABLE projects ADD COLUMN watch_enabled INTEGER NOT NULL DEFAULT 0"),i.some(e=>"agent_type"===e.name)||r.exec("ALTER TABLE projects ADD COLUMN agent_type TEXT NOT NULL DEFAULT 'claude'"),r.exec(`
    CREATE TABLE IF NOT EXISTS sub_projects (
      id TEXT PRIMARY KEY,
      project_id TEXT NOT NULL,
      name TEXT NOT NULL,
      description TEXT NOT NULL DEFAULT '',
      folder_path TEXT,
      sort_order INTEGER NOT NULL DEFAULT 0,
      created_at TEXT NOT NULL DEFAULT (datetime('now')),
      updated_at TEXT NOT NULL DEFAULT (datetime('now')),
      FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE
    );

    CREATE TABLE IF NOT EXISTS tasks (
      id TEXT PRIMARY KEY,
      project_id TEXT NOT NULL,
      sub_project_id TEXT NOT NULL,
      title TEXT NOT NULL,
      description TEXT NOT NULL DEFAULT '',
      status TEXT NOT NULL DEFAULT 'idea'
        CHECK(status IN ('idea','writing','submitted','testing','done','problem')),
      priority TEXT NOT NULL DEFAULT 'medium'
        CHECK(priority IN ('high','medium','low')),
      is_today INTEGER NOT NULL DEFAULT 0,
      sort_order INTEGER NOT NULL DEFAULT 0,
      created_at TEXT NOT NULL DEFAULT (datetime('now')),
      updated_at TEXT NOT NULL DEFAULT (datetime('now')),
      FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE,
      FOREIGN KEY (sub_project_id) REFERENCES sub_projects(id) ON DELETE CASCADE
    );

    CREATE TABLE IF NOT EXISTS task_prompts (
      id TEXT PRIMARY KEY,
      task_id TEXT NOT NULL UNIQUE,
      content TEXT NOT NULL DEFAULT '',
      prompt_type TEXT NOT NULL DEFAULT 'manual'
        CHECK(prompt_type IN ('manual','ai_assisted')),
      created_at TEXT NOT NULL DEFAULT (datetime('now')),
      updated_at TEXT NOT NULL DEFAULT (datetime('now')),
      FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE
    );

    CREATE TABLE IF NOT EXISTS global_memos (
      id TEXT PRIMARY KEY,
      content TEXT NOT NULL DEFAULT '',
      updated_at TEXT NOT NULL DEFAULT (datetime('now'))
    );

    CREATE TABLE IF NOT EXISTS task_conversations (
      id TEXT PRIMARY KEY,
      task_id TEXT NOT NULL,
      role TEXT NOT NULL CHECK(role IN ('assistant','user')),
      content TEXT NOT NULL,
      created_at TEXT NOT NULL DEFAULT (datetime('now')),
      FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE
    );
  `),(n=r.prepare("PRAGMA table_info(tasks)").all()).some(e=>"is_archived"===e.name)||r.exec("ALTER TABLE tasks ADD COLUMN is_archived INTEGER NOT NULL DEFAULT 0"),n.some(e=>"tags"===e.name)||r.exec("ALTER TABLE tasks ADD COLUMN tags TEXT NOT NULL DEFAULT '[]'"),process.on("exit",()=>l?.close()),c||(c=!0,setInterval(E,6e4),E(),console.log("[Scheduler] Morning notification scheduler started")),l}async function N(){return l||(T||(T=_()),T)}function R(){if(!l)throw Error("Database not initialized. Call await ensureDb() first.");return l}},66680,(e,t,r)=>{t.exports=e.x("node:crypto",()=>require("node:crypto"))},31308,e=>{"use strict";let t,r;var a=e.i(66680);function i(){return function(e=21){var i;i=e|=0,!t||t.length<i?(t=Buffer.allocUnsafe(128*i),a.webcrypto.getRandomValues(t),r=0):r+i>t.length&&(a.webcrypto.getRandomValues(t),r=0),r+=i;let s="";for(let a=r-e;a<r;a++)s+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&t[a]];return s}(16)}e.s(["generateId",()=>i],31308)},88095,e=>{"use strict";var t=e.i(84501),r=e.i(31308);function a(e){return{...e,watch_enabled:1===e.watch_enabled,agent_type:e.agent_type||"claude"}}function i(){return(0,t.getDb)().prepare("SELECT * FROM projects ORDER BY updated_at DESC").all().map(a)}function s(e){let r=(0,t.getDb)().prepare("SELECT * FROM projects WHERE id = ?").get(e);return r?a(r):void 0}function n(e,a="",i){let o=(0,t.getDb)(),d=(0,r.generateId)(),c=new Date().toISOString();o.prepare("INSERT INTO projects (id, name, description, project_path, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)").run(d,e,a,i??null,c,c);let p=(0,r.generateId)();return o.prepare("INSERT INTO brainstorms (id, project_id, content, version, created_at, updated_at) VALUES (?, ?, ?, 1, ?, ?)").run(p,d,"",c,c),s(d)}function o(e,r){let a=(0,t.getDb)(),i=s(e);if(!i)return;let n=new Date().toISOString();return a.prepare("UPDATE projects SET name = ?, description = ?, project_path = ?, ai_context = ?, watch_enabled = ?, agent_type = ?, updated_at = ? WHERE id = ?").run(r.name??i.name,r.description??i.description,void 0!==r.project_path?r.project_path:i.project_path,void 0!==r.ai_context?r.ai_context:i.ai_context??"",void 0!==r.watch_enabled?+!!r.watch_enabled:+!!i.watch_enabled,r.agent_type??i.agent_type??"claude",n,e),s(e)}function d(e){return(0,t.getDb)().prepare("DELETE FROM projects WHERE id = ?").run(e).changes>0}e.s(["createProject",()=>n,"deleteProject",()=>d,"getProject",()=>s,"listProjects",()=>i,"updateProject",()=>o])},2004,e=>{"use strict";var t=e.i(84501),r=e.i(31308);function a(e){let t=[];try{t=JSON.parse(e.tags||"[]")}catch{}return{...e,is_today:1===e.is_today,is_archived:(e.is_archived??0)===1,tags:t}}function i(e){return(0,t.getDb)().prepare("SELECT * FROM tasks WHERE sub_project_id = ? AND is_archived = 0 ORDER BY sort_order ASC").all(e).map(a)}function s(e){let r=(0,t.getDb)().prepare("SELECT * FROM tasks WHERE id = ?").get(e);return r?a(r):void 0}function n(e){let r=(0,t.getDb)();return(e?r.prepare("SELECT * FROM tasks WHERE project_id = ? AND is_archived = 1 ORDER BY updated_at DESC").all(e):r.prepare("SELECT * FROM tasks WHERE is_archived = 1 ORDER BY updated_at DESC").all()).map(a)}function o(e){let r=(0,t.getDb)(),a=new Date().toISOString();return r.prepare("UPDATE tasks SET is_archived = 1, is_today = 0, updated_at = ? WHERE id = ?").run(a,e),s(e)}function d(e){let r=(0,t.getDb)(),a=new Date().toISOString();return r.prepare("UPDATE tasks SET is_archived = 0, updated_at = ? WHERE id = ?").run(a,e),s(e)}function c(e){let a=(0,t.getDb)(),i=(0,r.generateId)(),n=new Date().toISOString(),o=a.prepare("SELECT MAX(sort_order) as max_order FROM tasks WHERE sub_project_id = ?").get(e.sub_project_id),d=(o?.max_order??-1)+1;return a.prepare(`INSERT INTO tasks (id, project_id, sub_project_id, title, description, status, priority, is_today, sort_order, created_at, updated_at)
     VALUES (?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?)`).run(i,e.project_id,e.sub_project_id,e.title,e.description??"",e.status??"idea",e.priority??"medium",d,n,n),s(i)}function p(e,r){let a=(0,t.getDb)(),i=a.prepare("SELECT * FROM tasks WHERE id = ?").get(e);if(!i)return;let n=new Date().toISOString();return a.prepare(`
    UPDATE tasks SET
      title = ?, description = ?, status = ?, priority = ?,
      is_today = ?, sort_order = ?, sub_project_id = ?, tags = ?, updated_at = ?
    WHERE id = ?
  `).run(r.title??i.title,r.description??i.description,r.status??i.status,r.priority??i.priority,void 0!==r.is_today?+!!r.is_today:i.is_today,r.sort_order??i.sort_order,r.sub_project_id??i.sub_project_id,r.tags?JSON.stringify(r.tags):i.tags,n,e),s(e)}function E(e){return(0,t.getDb)().prepare("DELETE FROM tasks WHERE id = ?").run(e).changes>0}e.s(["archiveTask",()=>o,"createTask",()=>c,"deleteTask",()=>E,"getArchivedTasks",()=>n,"getTask",()=>s,"getTasks",()=>i,"restoreTask",()=>d,"updateTask",()=>p])},60636,e=>{"use strict";var t=e.i(84501),r=e.i(31308);function a(e){return(0,t.getDb)().prepare("SELECT * FROM sub_projects WHERE id = ?").get(e)}function i(e){let r=(0,t.getDb)();return r.prepare("SELECT * FROM sub_projects WHERE project_id = ? ORDER BY sort_order ASC").all(e).map(e=>{let t=r.prepare(`
      SELECT
        COUNT(*) as task_count,
        SUM(CASE WHEN status IN ('submitted','testing') THEN 1 ELSE 0 END) as active_count,
        SUM(CASE WHEN status IN ('idea','writing') THEN 1 ELSE 0 END) as pending_count,
        SUM(CASE WHEN status = 'done' THEN 1 ELSE 0 END) as done_count,
        SUM(CASE WHEN status = 'problem' THEN 1 ELSE 0 END) as problem_count,
        MAX(updated_at) as last_activity
      FROM tasks WHERE sub_project_id = ? AND is_archived = 0
    `).get(e.id),a=r.prepare(`SELECT title, status FROM tasks WHERE sub_project_id = ? AND is_archived = 0
       ORDER BY CASE status
         WHEN 'submitted' THEN 0 WHEN 'testing' THEN 1 WHEN 'writing' THEN 2
         WHEN 'idea' THEN 3 WHEN 'problem' THEN 4 WHEN 'done' THEN 5
       END, sort_order ASC LIMIT 5`).all(e.id);return{...e,task_count:t.task_count??0,active_count:t.active_count??0,pending_count:t.pending_count??0,done_count:t.done_count??0,problem_count:t.problem_count??0,last_activity:t.last_activity,preview_tasks:a}})}function s(e){let i=(0,t.getDb)(),s=(0,r.generateId)(),n=new Date().toISOString(),o=i.prepare("SELECT MAX(sort_order) as max_order FROM sub_projects WHERE project_id = ?").get(e.project_id),d=(o?.max_order??-1)+1;return i.prepare(`INSERT INTO sub_projects (id, project_id, name, description, folder_path, sort_order, created_at, updated_at)
     VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(s,e.project_id,e.name,e.description??"",e.folder_path??null,d,n,n),a(s)}function n(e,r){let i=(0,t.getDb)(),s=a(e);if(!s)return;let n=new Date().toISOString();return i.prepare("UPDATE sub_projects SET name = ?, description = ?, folder_path = ?, updated_at = ? WHERE id = ?").run(r.name??s.name,r.description??s.description,void 0!==r.folder_path?r.folder_path:s.folder_path,n,e),a(e)}function o(e){return(0,t.getDb)().prepare("DELETE FROM sub_projects WHERE id = ?").run(e).changes>0}function d(e,r){let a=(0,t.getDb)(),i=a.prepare("UPDATE sub_projects SET sort_order = ? WHERE id = ? AND project_id = ?");a.transaction(()=>{r.forEach((t,r)=>i.run(r,t,e))})()}e.s(["createSubProject",()=>s,"deleteSubProject",()=>o,"getSubProject",()=>a,"getSubProjectsWithStats",()=>i,"reorderSubProjects",()=>d,"updateSubProject",()=>n])},19681,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),i=e.i(59756),s=e.i(61916),n=e.i(74677),o=e.i(69741),d=e.i(16795),c=e.i(87718),p=e.i(95169),E=e.i(47587),u=e.i(66012),l=e.i(70101),T=e.i(74838),_=e.i(10372),N=e.i(93695);e.i(52474);var R=e.i(220),L=e.i(89171),h=e.i(60636),g=e.i(2004),m=e.i(88095),A=e.i(84501);async function b(e,{params:t}){await (0,A.ensureDb)();let{id:r}=await t;if(!(0,m.getProject)(r))return L.NextResponse.json({error:"Project not found"},{status:404});let a=(await e.json()).distributions;if(!Array.isArray(a))return L.NextResponse.json({error:"distributions array required"},{status:400});let i=[];for(let e of a){let t;if(!e.tasks||0===e.tasks.length)continue;t=e.is_new||!e.existing_sub_id?(0,h.createSubProject)({project_id:r,name:e.sub_project_name}).id:e.existing_sub_id;let a=0;for(let i of e.tasks)i.title?.trim()&&((0,g.createTask)({project_id:r,sub_project_id:t,title:i.title.trim(),description:i.description||"",priority:i.priority||"medium"}),a++);i.push({sub_project_id:t,sub_project_name:e.sub_project_name,tasks_created:a})}return L.NextResponse.json({results:i})}e.s(["POST",()=>b],53282);var f=e.i(53282);let S=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/projects/[id]/apply-distribute/route",pathname:"/api/projects/[id]/apply-distribute",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/projects/[id]/apply-distribute/route.ts",nextConfigOutput:"",userland:f}),{workAsyncStorage:D,workUnitAsyncStorage:O,serverHooks:j}=S;function U(){return(0,a.patchFetch)({workAsyncStorage:D,workUnitAsyncStorage:O})}async function C(e,t,a){S.isDev&&(0,i.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let L="/api/projects/[id]/apply-distribute/route";L=L.replace(/\/index$/,"")||"/";let h=await S.prepare(e,t,{srcPage:L,multiZoneDraftMode:!1});if(!h)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:g,params:m,nextConfig:A,parsedUrl:b,isDraftMode:f,prerenderManifest:D,routerServerContext:O,isOnDemandRevalidate:j,revalidateOnlyGenerated:U,resolvedPathname:C,clientReferenceManifest:x,serverActionsManifest:y}=h,v=(0,o.normalizeAppPath)(L),w=!!(D.dynamicRoutes[v]||D.routes[C]),I=async()=>((null==O?void 0:O.render404)?await O.render404(e,t,b,!1):t.end("This page could not be found"),null);if(w&&!f){let e=!!D.routes[C],t=D.dynamicRoutes[v];if(t&&!1===t.fallback&&!e){if(A.experimental.adapterPath)return await I();throw new N.NoFallbackError}}let F=null;!w||S.isDev||f||(F="/index"===(F=C)?"/":F);let k=!0===S.isDev||!w,H=w&&!k;y&&x&&(0,n.setManifestsSingleton)({page:L,clientReferenceManifest:x,serverActionsManifest:y});let P=e.method||"GET",M=(0,s.getTracer)(),X=M.getActiveScopeSpan(),W={params:m,prerenderManifest:D,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts},cacheComponents:!!A.cacheComponents,supportsDynamicResponse:k,incrementalCache:(0,i.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:A.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,i)=>S.onRequestError(e,t,a,i,O)},sharedContext:{buildId:g}},q=new d.NodeNextRequest(e),B=new d.NodeNextResponse(t),Y=c.NextRequestAdapter.fromNodeNextRequest(q,(0,c.signalFromNodeResponse)(t));try{let n=async e=>S.handle(Y,W).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=M.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.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=`${P} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${P} ${L}`)}),o=!!(0,i.getRequestMeta)(e,"minimalMode"),d=async i=>{var s,d;let c=async({previousCacheEntry:r})=>{try{if(!o&&j&&U&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await n(i);e.fetchMetrics=W.renderOpts.fetchMetrics;let d=W.renderOpts.pendingWaitUntil;d&&a.waitUntil&&(a.waitUntil(d),d=void 0);let c=W.renderOpts.collectedTags;if(!w)return await (0,u.sendResponse)(q,B,s,W.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,l.toNodeOutgoingHttpHeaders)(s.headers);c&&(t[_.NEXT_CACHE_TAGS_HEADER]=c),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=_.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=_.INFINITE_CACHE?void 0:W.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:s.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await S.onRequestError(e,t,{routerKind:"App Router",routePath:L,routeType:"route",revalidateReason:(0,E.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:j})},!1,O),t}},p=await S.handleResponse({req:e,nextConfig:A,cacheKey:F,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:D,isRoutePPREnabled:!1,isOnDemandRevalidate:j,revalidateOnlyGenerated:U,responseGenerator:c,waitUntil:a.waitUntil,isMinimalMode:o});if(!w)return null;if((null==p||null==(s=p.value)?void 0:s.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==p||null==(d=p.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",j?"REVALIDATED":p.isMiss?"MISS":p.isStale?"STALE":"HIT"),f&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let N=(0,l.fromNodeOutgoingHttpHeaders)(p.value.headers);return o&&w||N.delete(_.NEXT_CACHE_TAGS_HEADER),!p.cacheControl||t.getHeader("Cache-Control")||N.get("Cache-Control")||N.set("Cache-Control",(0,T.getCacheControlHeader)(p.cacheControl)),await (0,u.sendResponse)(q,B,new Response(p.value.body,{headers:N,status:p.value.status||200})),null};X?await d(X):await M.withPropagatedContext(e.headers,()=>M.trace(p.BaseServerSpan.handleRequest,{spanName:`${P} ${L}`,kind:s.SpanKind.SERVER,attributes:{"http.method":P,"http.target":e.url}},d))}catch(t){if(t instanceof N.NoFallbackError||await S.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,E.getRevalidateReason)({isStaticGeneration:H,isOnDemandRevalidate:j})},!1,O),w)throw t;return await (0,u.sendResponse)(q,B,new Response(null,{status:500})),null}}e.s(["handler",()=>C,"patchFetch",()=>U,"routeModule",()=>S,"serverHooks",()=>j,"workAsyncStorage",()=>D,"workUnitAsyncStorage",()=>O],19681)}];

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