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",()=>L,"getDb",()=>m],84501);var t=e.i(22734),r=e.i(14747),a=e.i(46786);let n=r.default.join(a.default.homedir(),".idea-manager","data");function s(){return r.default.join((t.default.existsSync(n)||t.default.mkdirSync(n,{recursive:!0}),n),"im.db")}let i=r.default.join(a.default.homedir(),".idea-manager","sync");function o(){return t.default.existsSync(i)||t.default.mkdirSync(i,{recursive:!0}),i}e.s(["getDbPath",()=>s,"getSyncDir",()=>o],14966);var l=e.i(74533);let d=!1,E="";async function T(){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&&E!==r)try{let e,t;await L();let a=m(),n=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(),i=a.prepare("SELECT COUNT(*) as count FROM tasks WHERE status = 'problem'").get(),o=[];if(n.length>0){for(let e of(o.push(`Today: ${n.length}개`),n.slice(0,5)))o.push(`  - ${e.title}`);n.length>5&&o.push(`  ... +${n.length-5}개`)}else o.push("Today 태스크가 없습니다.");s.count>0&&o.push(`진행 중: ${s.count}개`),i.count>0&&o.push(`문제: ${i.count}개`),e=o.join("\n").replace(/"/g,'\\"').replace(/\n/g,"\\n"),t=`display notification "${e}" with title "IM - 오늘의 할 일"`,(0,l.exec)(`osascript -e '${t}'`,e=>{e&&console.error("[Scheduler] notification error:",e.message)}),E=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 n=a.getColumnNames(),s=[];for(;a.step();)s.push(a.get());return a.free(),t.rowsToObjects(n,s)},get(...r){let a,n=t.db.prepare(e);if(r.length>0&&n.bind(r),n.step()){let e=n.getColumnNames(),t=n.get(),r={};e.forEach((e,a)=>{r[e]=t[a]}),a=r}return n.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 c=null,p=null;async function N(){var r;let a,n,i;if(c)return c;let o=e.r(83935),l=await o(),E=s();if(t.default.existsSync(E)){let e=t.default.readFileSync(E);a=new l.Database(e)}else a=new l.Database;return(r=c=new u(a,E)).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
    );

  `),(n=r.prepare("PRAGMA table_info(projects)").all()).some(e=>"project_path"===e.name)||r.exec("ALTER TABLE projects ADD COLUMN project_path TEXT"),n.some(e=>"ai_context"===e.name)||r.exec("ALTER TABLE projects ADD COLUMN ai_context TEXT NOT NULL DEFAULT ''"),n.some(e=>"watch_enabled"===e.name)||r.exec("ALTER TABLE projects ADD COLUMN watch_enabled INTEGER NOT NULL DEFAULT 0"),n.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
    );
  `),(i=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"),i.some(e=>"tags"===e.name)||r.exec("ALTER TABLE tasks ADD COLUMN tags TEXT NOT NULL DEFAULT '[]'"),process.on("exit",()=>c?.close()),d||(d=!0,setInterval(T,6e4),T(),console.log("[Scheduler] Morning notification scheduler started")),c}async function L(){return c||(p||(p=N()),p)}function m(){if(!c)throw Error("Database not initialized. Call await ensureDb() first.");return c}},32766,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),E=e.i(95169),T=e.i(47587),u=e.i(66012),c=e.i(70101),p=e.i(74838),N=e.i(10372),L=e.i(93695);e.i(52474);var m=e.i(220),h=e.i(89171),R=e.i(84501);let A="global-memo";async function g(){let e;await (0,R.ensureDb)();let t=(e=(0,R.getDb)().prepare("SELECT content FROM global_memos WHERE id = ?").get(A),e?.content??"");return h.NextResponse.json({content:t})}async function O(e){let t,r;await (0,R.ensureDb)();let a=await e.json(),n="string"==typeof a.content?a.content:"";return t=(0,R.getDb)(),r=new Date().toISOString(),t.prepare("SELECT id FROM global_memos WHERE id = ?").get(A)?t.prepare("UPDATE global_memos SET content = ?, updated_at = ? WHERE id = ?").run(n,r,A):t.prepare("INSERT INTO global_memos (id, content, updated_at) VALUES (?, ?, ?)").run(A,n,r),h.NextResponse.json({content:n})}e.s(["GET",()=>g,"PUT",()=>O],9515);var U=e.i(9515);let f=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/global-memo/route",pathname:"/api/global-memo",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/src/app/api/global-memo/route.ts",nextConfigOutput:"",userland:U}),{workAsyncStorage:x,workUnitAsyncStorage:b,serverHooks:D}=f;function C(){return(0,a.patchFetch)({workAsyncStorage:x,workUnitAsyncStorage:b})}async function _(e,t,a){f.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let h="/api/global-memo/route";h=h.replace(/\/index$/,"")||"/";let R=await f.prepare(e,t,{srcPage:h,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:A,params:g,nextConfig:O,parsedUrl:U,isDraftMode:x,prerenderManifest:b,routerServerContext:D,isOnDemandRevalidate:C,revalidateOnlyGenerated:_,resolvedPathname:S,clientReferenceManifest:w,serverActionsManifest:y}=R,v=(0,o.normalizeAppPath)(h),F=!!(b.dynamicRoutes[v]||b.routes[S]),I=async()=>((null==D?void 0:D.render404)?await D.render404(e,t,U,!1):t.end("This page could not be found"),null);if(F&&!x){let e=!!b.routes[S],t=b.dynamicRoutes[v];if(t&&!1===t.fallback&&!e){if(O.experimental.adapterPath)return await I();throw new L.NoFallbackError}}let j=null;!F||f.isDev||x||(j="/index"===(j=S)?"/":j);let X=!0===f.isDev||!F,P=F&&!X;y&&w&&(0,i.setManifestsSingleton)({page:h,clientReferenceManifest:w,serverActionsManifest:y});let M=e.method||"GET",k=(0,s.getTracer)(),q=k.getActiveScopeSpan(),H={params:g,prerenderManifest:b,renderOpts:{experimental:{authInterrupts:!!O.experimental.authInterrupts},cacheComponents:!!O.cacheComponents,supportsDynamicResponse:X,incrementalCache:(0,n.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:O.cacheLife,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>f.onRequestError(e,t,a,n,D)},sharedContext:{buildId:A}},K=new l.NodeNextRequest(e),G=new l.NodeNextResponse(t),$=d.NextRequestAdapter.fromNodeNextRequest(K,(0,d.signalFromNodeResponse)(t));try{let i=async e=>f.handle($,H).finally(()=>{if(!e)return;e.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=k.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==E.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=`${M} ${a}`;e.setAttributes({"next.route":a,"http.route":a,"next.span_name":t}),e.updateName(t)}else e.updateName(`${M} ${h}`)}),o=!!(0,n.getRequestMeta)(e,"minimalMode"),l=async n=>{var s,l;let d=async({previousCacheEntry:r})=>{try{if(!o&&C&&_&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let s=await i(n);e.fetchMetrics=H.renderOpts.fetchMetrics;let l=H.renderOpts.pendingWaitUntil;l&&a.waitUntil&&(a.waitUntil(l),l=void 0);let d=H.renderOpts.collectedTags;if(!F)return await (0,u.sendResponse)(K,G,s,H.renderOpts.pendingWaitUntil),null;{let e=await s.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(s.headers);d&&(t[N.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==H.renderOpts.collectedRevalidate&&!(H.renderOpts.collectedRevalidate>=N.INFINITE_CACHE)&&H.renderOpts.collectedRevalidate,a=void 0===H.renderOpts.collectedExpire||H.renderOpts.collectedExpire>=N.INFINITE_CACHE?void 0:H.renderOpts.collectedExpire;return{value:{kind:m.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 f.onRequestError(e,t,{routerKind:"App Router",routePath:h,routeType:"route",revalidateReason:(0,T.getRevalidateReason)({isStaticGeneration:P,isOnDemandRevalidate:C})},!1,D),t}},E=await f.handleResponse({req:e,nextConfig:O,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:b,isRoutePPREnabled:!1,isOnDemandRevalidate:C,revalidateOnlyGenerated:_,responseGenerator:d,waitUntil:a.waitUntil,isMinimalMode:o});if(!F)return null;if((null==E||null==(s=E.value)?void 0:s.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==E||null==(l=E.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});o||t.setHeader("x-nextjs-cache",C?"REVALIDATED":E.isMiss?"MISS":E.isStale?"STALE":"HIT"),x&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let L=(0,c.fromNodeOutgoingHttpHeaders)(E.value.headers);return o&&F||L.delete(N.NEXT_CACHE_TAGS_HEADER),!E.cacheControl||t.getHeader("Cache-Control")||L.get("Cache-Control")||L.set("Cache-Control",(0,p.getCacheControlHeader)(E.cacheControl)),await (0,u.sendResponse)(K,G,new Response(E.value.body,{headers:L,status:E.value.status||200})),null};q?await l(q):await k.withPropagatedContext(e.headers,()=>k.trace(E.BaseServerSpan.handleRequest,{spanName:`${M} ${h}`,kind:s.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},l))}catch(t){if(t instanceof L.NoFallbackError||await f.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,T.getRevalidateReason)({isStaticGeneration:P,isOnDemandRevalidate:C})},!1,D),F)throw t;return await (0,u.sendResponse)(K,G,new Response(null,{status:500})),null}}e.s(["handler",()=>_,"patchFetch",()=>C,"routeModule",()=>f,"serverHooks",()=>D,"workAsyncStorage",()=>x,"workUnitAsyncStorage",()=>b],32766)}];

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