idea-manager 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/build-manifest.json +2 -2
- package/.next/routes-manifest.json +8 -0
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +2 -2
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +2 -2
- package/.next/server/app/_not-found.rsc +2 -2
- package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/archive/route.js +12 -3
- package/.next/server/app/api/archive/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/filesystem/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/filesystem/tree/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/global-memo/route.js +9 -0
- package/.next/server/app/api/global-memo/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/health/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/advisor/route.js +34 -0
- package/.next/server/app/api/projects/[id]/advisor/route_client-reference-manifest.js +1 -0
- package/.next/server/app/api/projects/[id]/apply-distribute/route.js +5 -5
- package/.next/server/app/api/projects/[id]/apply-distribute/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/auto-distribute/route.js +3 -3
- package/.next/server/app/api/projects/[id]/auto-distribute/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/brainstorm/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/git-sync/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/route.js +12 -3
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route.js +3 -3
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route.js +9 -0
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route.js +3 -3
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route.js +12 -3
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/route.js +12 -3
- package/.next/server/app/api/projects/[id]/sub-projects/[subId]/tasks/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/[id]/sub-projects/route.js +12 -3
- package/.next/server/app/api/projects/[id]/sub-projects/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/search/route.js +9 -0
- package/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sync/route.js +9 -0
- package/.next/server/app/api/sync/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/version/route_client-reference-manifest.js +1 -1
- package/.next/server/app/index.html +2 -2
- package/.next/server/app/index.rsc +3 -3
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/page.js +6 -6
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/projects/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +13 -12
- package/.next/server/chunks/117.js +9 -0
- package/.next/server/pages/404.html +2 -2
- package/.next/server/pages/500.html +2 -2
- package/.next/static/chunks/374-769431701aab500f.js +1 -0
- package/.next/static/chunks/app/_global-error/page-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/archive/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/filesystem/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/filesystem/tree/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/global-memo/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/health/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/advisor/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/apply-distribute/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/auto-distribute/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/brainstorm/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/git-sync/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/projects/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/search/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/sync/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/update/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/api/version/route-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/app/{page-9a1dc101e82c397c.js → page-e935ee928da68ca2.js} +7 -7
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-3ff8f59aaa75b8f8.js +1 -0
- package/.next/static/css/e4c7cd5a570312d9.css +3 -0
- package/README.ja.md +2 -0
- package/README.ko.md +3 -1
- package/README.md +3 -1
- package/README.zh.md +2 -0
- package/package.json +1 -1
- package/src/app/api/projects/[id]/advisor/route.ts +71 -0
- package/src/components/workspace/ProjectAdvisor.tsx +194 -0
- package/src/components/workspace/WorkspacePanel.tsx +23 -0
- package/src/lib/ai/project-context.ts +111 -0
- package/src/lib/db/queries/project-conversations.ts +29 -0
- package/src/lib/db/schema.ts +11 -0
- package/src/types/index.ts +8 -0
- package/.next/static/chunks/374-23189d7e246ad164.js +0 -1
- package/.next/static/chunks/app/_global-error/page-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/archive/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/filesystem/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/filesystem/tree/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/global-memo/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/health/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/apply-distribute/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/auto-distribute/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/brainstorm/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/git-sync/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/chat/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/prompt/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/refine/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/[taskId]/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/[subId]/tasks/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/[id]/sub-projects/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/projects/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/search/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/sync/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/update/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/app/api/version/route-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/app-error-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/forbidden-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/not-found-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/chunks/next/dist/client/components/builtin/unauthorized-e6a77f238d2cdbb9.js +0 -1
- package/.next/static/css/eab748b03f49c43a.css +0 -3
- /package/.next/static/{Fy-Z5gkec2a0fese1C5rW → pxqzEiwniZAUDOUTb5SnX}/_buildManifest.js +0 -0
- /package/.next/static/{Fy-Z5gkec2a0fese1C5rW → pxqzEiwniZAUDOUTb5SnX}/_ssgManifest.js +0 -0
package/.next/server/app/page.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
(()=>{var a={};a.id=974,a.ids=[974],a.modules={84:a=>{a.exports={style:{fontFamily:"'Geist Mono', 'Geist Mono Fallback'",fontStyle:"normal"},className:"__className_9a8899",variable:"__variable_9a8899"}},210:a=>{a.exports={style:{fontFamily:"'Geist', 'Geist Fallback'",fontStyle:"normal"},className:"__className_188709",variable:"__variable_188709"}},261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},1025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},1135:()=>{},1742:()=>{},2160:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,5547,23)),Promise.resolve().then(c.t.bind(c,5098,23)),Promise.resolve().then(c.t.bind(c,7644,23)),Promise.resolve().then(c.t.bind(c,3859,23)),Promise.resolve().then(c.t.bind(c,8099,23)),Promise.resolve().then(c.t.bind(c,6237,23)),Promise.resolve().then(c.t.bind(c,8562,23)),Promise.resolve().then(c.t.bind(c,6675,23))},2506:function(a,b,c){"use strict";var d=(this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}})(c(2954)),e=c(3174);function f(a,b){var c={};return a&&"string"==typeof a&&(0,d.default)(a,function(a,d){a&&d&&(c[(0,e.camelCase)(a,b)]=d)}),c}f.default=f,a.exports=f},2954:function(a,b,c){"use strict";var d=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(b,"__esModule",{value:!0}),b.default=function(a,b){let c=null;if(!a||"string"!=typeof a)return c;let d=(0,e.default)(a),f="function"==typeof b;return d.forEach(a=>{if("declaration"!==a.type)return;let{property:d,value:e}=a;f?b(d,e,a):e&&((c=c||{})[d]=e)}),c};let e=d(c(6510))},3033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},3174:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.camelCase=void 0;var c=/^--[a-zA-Z0-9_-]+$/,d=/-([a-z])/g,e=/^[^-]+$/,f=/^-(webkit|moz|ms|o|khtml)-/,g=/^-(ms)-/,h=function(a,b){return b.toUpperCase()},i=function(a,b){return"".concat(b,"-")};b.camelCase=function(a,b){var j;return(void 0===b&&(b={}),!(j=a)||e.test(j)||c.test(j))?a:(a=a.toLowerCase(),(a=b.reactCompat?a.replace(g,i):a.replace(f,i)).replace(d,h))}},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},3494:()=>{},3873:a=>{"use strict";a.exports=require("path")},3954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},4188:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,5547,23))},4268:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,1921,23))},4451:a=>{a.exports=function(a,b){if(null==a)return{};var c={};for(var d in a)if(({}).hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c},a.exports.__esModule=!0,a.exports.default=a.exports},4494:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(7943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/young/Toy/idea-manager/src/app/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/young/Toy/idea-manager/src/app/page.tsx","default")},5091:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return f}});let d=c(5735),e=c(2675);function f(){return(0,d.jsx)(e.HTTPAccessErrorFallback,{status:404,message:"This page could not be found."})}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},5565:(a,b,c)=>{Promise.resolve().then(c.bind(c,8138))},5712:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,1921,23)),Promise.resolve().then(c.t.bind(c,440,23)),Promise.resolve().then(c.t.bind(c,4342,23)),Promise.resolve().then(c.t.bind(c,2265,23)),Promise.resolve().then(c.t.bind(c,5421,23)),Promise.resolve().then(c.t.bind(c,1335,23)),Promise.resolve().then(c.t.bind(c,664,23)),Promise.resolve().then(c.bind(c,4661))},5827:a=>{"use strict";var b=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=function(a){return"function"==typeof Array.isArray?Array.isArray(a):"[object Array]"===c.call(a)},g=function(a){if(!a||"[object Object]"!==c.call(a))return!1;var d,e=b.call(a,"constructor"),f=a.constructor&&a.constructor.prototype&&b.call(a.constructor.prototype,"isPrototypeOf");if(a.constructor&&!e&&!f)return!1;for(d in a);return void 0===d||b.call(a,d)},h=function(a,b){d&&"__proto__"===b.name?d(a,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):a[b.name]=b.newValue},i=function(a,c){if("__proto__"===c){if(!b.call(a,c))return;else if(e)return e(a,c).value}return a[c]};a.exports=function a(){var b,c,d,e,j,k,l=arguments[0],m=1,n=arguments.length,o=!1;for("boolean"==typeof l&&(o=l,l=arguments[1]||{},m=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});m<n;++m)if(b=arguments[m],null!=b)for(c in b)d=i(l,c),l!==(e=i(b,c))&&(o&&e&&(g(e)||(j=f(e)))?(j?(j=!1,k=d&&f(d)?d:[]):k=d&&g(d)?d:{},h(l,{name:c,newValue:a(o,k,e)})):void 0!==e&&h(l,{name:c,newValue:e}));return l}},6439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},6487:()=>{},6510:a=>{"use strict";var b=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,c=/\n/g,d=/^\s*/,e=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,f=/^:\s*/,g=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,h=/^[;\s]*/,i=/^\s+|\s+$/g;function j(a){return a?a.replace(i,""):""}a.exports=function(a,i){if("string"!=typeof a)throw TypeError("First argument must be a string");if(!a)return[];i=i||{};var k=1,l=1;function m(a){var b=a.match(c);b&&(k+=b.length);var d=a.lastIndexOf("\n");l=~d?a.length-d:l+a.length}function n(){var a={line:k,column:l};return function(b){return b.position=new o(a),q(d),b}}function o(a){this.start=a,this.end={line:k,column:l},this.source=i.source}function p(b){var c=Error(i.source+":"+k+":"+l+": "+b);if(c.reason=b,c.filename=i.source,c.line=k,c.column=l,c.source=a,i.silent);else throw c}function q(b){var c=b.exec(a);if(c){var d=c[0];return m(d),a=a.slice(d.length),c}}function r(a){var b;for(a=a||[];b=s();)!1!==b&&a.push(b);return a}function s(){var b=n();if("/"==a.charAt(0)&&"*"==a.charAt(1)){for(var c=2;""!=a.charAt(c)&&("*"!=a.charAt(c)||"/"!=a.charAt(c+1));)++c;if(c+=2,""===a.charAt(c-1))return p("End of comment missing");var d=a.slice(2,c-2);return l+=2,m(d),a=a.slice(c),l+=2,b({type:"comment",comment:d})}}o.prototype.content=a,q(d);var t,u=[];for(r(u);t=function(){var a=n(),c=q(e);if(c){if(s(),!q(f))return p("property missing ':'");var d=q(g),i=a({type:"declaration",property:j(c[0].replace(b,"")),value:d?j(d[0].replace(b,"")):""});return q(h),i}}();)!1!==t&&(u.push(t),r(u));return u}},6537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>j,metadata:()=>i});var d=c(5735),e=c(210),f=c.n(e),g=c(84),h=c.n(g);c(1135);let i={title:"IM - 아이디어 매니저",description:"아이디어에서 실행 가능한 프롬프트까지, 멀티 워크스페이스 워크플로우 매니저",icons:{icon:"/favicon.svg",apple:"/icon-192.png"},manifest:"/manifest.json",themeColor:"#6366f1",appleWebApp:{capable:!0,statusBarStyle:"black-translucent",title:"IM"}};function j({children:a}){return(0,d.jsxs)("html",{lang:"ko",children:[(0,d.jsx)("head",{children:(0,d.jsx)("link",{rel:"stylesheet",as:"style",crossOrigin:"anonymous",href:"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css"})}),(0,d.jsxs)("body",{className:`${f().variable} ${h().variable} antialiased`,children:[a,(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:`
|
|
2
|
-
if ('serviceWorker' in navigator) {
|
|
3
|
-
navigator.serviceWorker.register('/sw.js');
|
|
4
|
-
}
|
|
5
|
-
`}})]})]})}},6713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},7068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},8138:(a,b,c)=>{"use strict";let d,e,f;c.r(b),c.d(b,{default:()=>xg});var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={};c.r(J),c.d(J,{boolean:()=>ct,booleanish:()=>cu,commaOrSpaceSeparated:()=>cz,commaSeparated:()=>cy,number:()=>cw,overloadedBoolean:()=>cv,spaceSeparated:()=>cx});var K={};c.r(K),c.d(K,{attentionMarkers:()=>ex,contentInitial:()=>er,disable:()=>ey,document:()=>eq,flow:()=>et,flowInitial:()=>es,insideSpan:()=>ew,string:()=>eu,text:()=>ev});var L=c(8249),M=c(7484),N=c.n(M);let O={id:"dashboard",type:"dashboard"};function P(a){return a.some(a=>"dashboard"===a.id)?a:[O,...a]}function Q(a,b){switch(b.type){case"OPEN_PROJECT":{let c=a.tabs.find(a=>a.projectId===b.projectId);if(c)return{tabs:a.tabs.map(a=>a.id===c.id?{...a,initialSubId:b.initialSubId,initialTaskId:b.initialTaskId}:a),activeTabId:c.id};let d={id:b.projectId,type:"project",projectId:b.projectId,projectName:b.projectName,initialSubId:b.initialSubId,initialTaskId:b.initialTaskId};return{tabs:[...a.tabs,d],activeTabId:d.id}}case"CLOSE_TAB":{if("dashboard"===b.tabId)return a;let c=a.tabs.findIndex(a=>a.id===b.tabId),d=a.tabs.filter(a=>a.id!==b.tabId),e=a.activeTabId;return a.activeTabId===b.tabId&&(e=d[Math.max(0,c-1)]?.id||"dashboard"),{tabs:P(d),activeTabId:e}}case"SET_ACTIVE":return{...a,activeTabId:b.tabId};case"UPDATE_TAB_NAME":return{...a,tabs:a.tabs.map(a=>a.id===b.tabId?{...a,projectName:b.name}:a)};case"CONSUME_INITIAL":return{...a,tabs:a.tabs.map(a=>a.id===b.tabId?{...a,initialSubId:void 0,initialTaskId:void 0}:a)};case"HYDRATE":return{tabs:P(b.state.tabs),activeTabId:b.state.activeTabId};default:return a}}let R={tabs:[O],activeTabId:"dashboard"};function S(){return R}let T=(0,M.createContext)(null);function U(){let a=(0,M.useContext)(T);if(!a)throw Error("useTabContext must be used within TabProvider");return a}function V({children:a}){let[b,c]=(0,M.useReducer)(Q,void 0,S),d=(0,M.useCallback)((a,b,d,e)=>{c({type:"OPEN_PROJECT",projectId:a,projectName:b,initialSubId:d,initialTaskId:e})},[]),e=(0,M.useCallback)(a=>{c({type:"CLOSE_TAB",tabId:a})},[]),f=(0,M.useCallback)(a=>{c({type:"SET_ACTIVE",tabId:a})},[]),g=(0,M.useCallback)((a,b)=>{c({type:"UPDATE_TAB_NAME",tabId:a,name:b})},[]),h=(0,M.useCallback)(a=>{c({type:"CONSUME_INITIAL",tabId:a})},[]),i=(0,M.useCallback)(()=>{let a=b.tabs.findIndex(a=>a.id===b.activeTabId),d=b.tabs[(a+1)%b.tabs.length];d&&c({type:"SET_ACTIVE",tabId:d.id})},[b.tabs,b.activeTabId]),j=(0,M.useCallback)(()=>{let a=b.tabs.findIndex(a=>a.id===b.activeTabId),d=b.tabs[(a-1+b.tabs.length)%b.tabs.length];d&&c({type:"SET_ACTIVE",tabId:d.id})},[b.tabs,b.activeTabId]);return(0,L.jsx)(T.Provider,{value:{state:b,openProject:d,closeTab:e,setActiveTab:f,updateTabName:g,consumeInitial:h,nextTab:i,prevTab:j},children:a})}let W=[{id:"dark",name:"Dark",emoji:"\uD83C\uDF11",colors:{"--background":"224 20% 10%","--foreground":"210 40% 98%","--card":"224 20% 13%","--card-hover":"220 15% 18%","--border":"220 15% 28%","--input":"220 15% 24%","--primary":"210 85% 60%","--primary-hover":"210 85% 50%","--accent":"265 70% 60%","--success":"142 71% 45%","--warning":"38 92% 50%","--destructive":"0 70% 55%","--muted":"220 15% 20%","--muted-foreground":"215 15% 60%"}},{id:"light",name:"Light",emoji:"☀️",colors:{"--background":"0 0% 97%","--foreground":"224 20% 14%","--card":"0 0% 100%","--card-hover":"220 15% 96%","--border":"220 15% 85%","--input":"220 15% 92%","--primary":"210 85% 50%","--primary-hover":"210 85% 42%","--accent":"265 70% 55%","--success":"142 71% 40%","--warning":"38 92% 45%","--destructive":"0 70% 50%","--muted":"220 15% 92%","--muted-foreground":"215 15% 45%"}},{id:"nord",name:"Nord",emoji:"❄️",colors:{"--background":"220 16% 16%","--foreground":"219 28% 88%","--card":"220 16% 20%","--card-hover":"220 16% 24%","--border":"220 16% 30%","--input":"220 16% 26%","--primary":"193 43% 60%","--primary-hover":"193 43% 50%","--accent":"311 20% 63%","--success":"92 28% 55%","--warning":"40 71% 73%","--destructive":"354 42% 56%","--muted":"220 16% 24%","--muted-foreground":"219 20% 55%"}},{id:"ocean",name:"Ocean",emoji:"\uD83C\uDF0A",colors:{"--background":"210 50% 8%","--foreground":"200 40% 95%","--card":"210 45% 12%","--card-hover":"210 40% 17%","--border":"210 35% 25%","--input":"210 40% 20%","--primary":"190 80% 55%","--primary-hover":"190 80% 45%","--accent":"170 60% 50%","--success":"160 60% 45%","--warning":"38 90% 50%","--destructive":"0 65% 55%","--muted":"210 40% 18%","--muted-foreground":"200 25% 55%"}},{id:"forest",name:"Forest",emoji:"\uD83C\uDF32",colors:{"--background":"150 20% 9%","--foreground":"140 20% 92%","--card":"150 18% 13%","--card-hover":"150 15% 18%","--border":"150 12% 26%","--input":"150 15% 22%","--primary":"142 50% 55%","--primary-hover":"142 50% 45%","--accent":"80 45% 55%","--success":"142 60% 45%","--warning":"45 85% 50%","--destructive":"0 60% 52%","--muted":"150 15% 18%","--muted-foreground":"140 12% 52%"}},{id:"sunset",name:"Sunset",emoji:"\uD83C\uDF05",colors:{"--background":"15 20% 10%","--foreground":"30 30% 93%","--card":"15 18% 14%","--card-hover":"15 15% 19%","--border":"15 12% 27%","--input":"15 15% 22%","--primary":"25 90% 58%","--primary-hover":"25 90% 48%","--accent":"340 65% 58%","--success":"142 55% 45%","--warning":"45 90% 52%","--destructive":"0 70% 55%","--muted":"15 15% 19%","--muted-foreground":"20 12% 52%"}},{id:"lavender",name:"Lavender",emoji:"\uD83D\uDC9C",colors:{"--background":"270 20% 10%","--foreground":"260 30% 93%","--card":"270 18% 14%","--card-hover":"270 15% 19%","--border":"270 12% 28%","--input":"270 15% 23%","--primary":"265 70% 62%","--primary-hover":"265 70% 52%","--accent":"320 55% 58%","--success":"142 55% 45%","--warning":"38 85% 52%","--destructive":"0 65% 55%","--muted":"270 15% 19%","--muted-foreground":"260 12% 52%"}},{id:"rose",name:"Ros\xe9",emoji:"\uD83C\uDF37",colors:{"--background":"0 0% 96%","--foreground":"340 20% 18%","--card":"0 0% 100%","--card-hover":"340 20% 95%","--border":"340 15% 85%","--input":"340 15% 91%","--primary":"340 75% 55%","--primary-hover":"340 75% 45%","--accent":"300 50% 55%","--success":"142 55% 42%","--warning":"38 85% 48%","--destructive":"0 70% 50%","--muted":"340 15% 91%","--muted-foreground":"340 12% 48%"}}];function X(a){return W.find(b=>b.id===a)??W[0]}let Y=(0,M.createContext)(null);function Z({children:a}){let[b,c]=(0,M.useState)(X("dark")),[d,e]=(0,M.useState)(!1),f=(0,M.useCallback)(a=>{c(X(a)),localStorage.setItem("im-theme",a)},[]);return(0,L.jsx)(Y.Provider,{value:{theme:b,setTheme:f,themes:W},children:a})}var $=c(4429);function _(){let{theme:a,setTheme:b,themes:c}=function(){let a=(0,M.useContext)(Y);if(!a)throw Error("useTheme must be used within ThemeProvider");return a}(),[d,e]=(0,M.useState)(!1),f=(0,M.useRef)(null),g=(0,M.useRef)(null),[h,i]=(0,M.useState)({top:0,right:0});return(0,M.useCallback)(()=>{if(!f.current)return;let a=f.current.getBoundingClientRect();i({top:a.bottom+6,right:window.innerWidth-a.right})},[]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("button",{ref:f,className:"theme-picker-btn",onClick:()=>e(!d),title:"테마 변경",children:[(0,L.jsx)("span",{className:"theme-picker-preview",style:{background:`hsl(${a.colors["--primary"]})`}}),(0,L.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,L.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,L.jsx)("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]})]}),d&&(0,$.createPortal)((0,L.jsxs)("div",{ref:g,className:"theme-picker-dropdown",style:{position:"fixed",top:h.top,right:h.right},children:[(0,L.jsx)("div",{className:"theme-picker-title",children:"테마"}),(0,L.jsx)("div",{className:"theme-picker-grid",children:c.map(c=>(0,L.jsxs)("button",{className:`theme-picker-item ${c.id===a.id?"theme-picker-item-active":""}`,onClick:()=>{b(c.id),e(!1)},children:[(0,L.jsxs)("div",{className:"theme-picker-swatch",children:[(0,L.jsx)("div",{style:{background:`hsl(${c.colors["--background"]})`,flex:1}}),(0,L.jsx)("div",{style:{background:`hsl(${c.colors["--primary"]})`,flex:1}}),(0,L.jsx)("div",{style:{background:`hsl(${c.colors["--accent"]})`,flex:1}})]}),(0,L.jsxs)("span",{className:"theme-picker-name",children:[c.emoji," ",c.name]})]},c.id))})]}),document.body)]})}function aa(){let[a,b]=(0,M.useState)(null),[c,d]=(0,M.useState)(!1),[e,f]=(0,M.useState)(!1),[g,h]=(0,M.useState)(!1),[i,j]=(0,M.useState)(null),k=(0,M.useRef)(null),l=(0,M.useCallback)(async()=>{try{let a=await fetch("/api/version");if(!a.ok)return;let c=await a.json();b(c)}catch{}},[]),m=a?.latest!==null&&a?.latest===k.current,n=!!a?.updateAvailable&&!m,o=(0,M.useCallback)(async()=>{f(!0),j(null);try{let a=await fetch("/api/update",{method:"POST"}),b=await a.json();j(b),b.ok&&(h(!0),await l())}catch(a){j({ok:!1,error:a instanceof Error?a.message:"Network error"})}finally{f(!1)}},[l]),p=(0,M.useCallback)(()=>{if(a?.latest){try{localStorage.setItem("im-update-dismissed",a.latest)}catch{}k.current=a.latest}b(a=>a?{...a,updateAvailable:!1}:a)},[a?.latest]);return(0,L.jsxs)(L.Fragment,{children:[n?(0,L.jsxs)("button",{onClick:()=>d(!0),title:`IM v${a?.latest} 업데이트 가능 (현재 ${a?.current})`,className:"text-xs px-2 py-1 rounded-md border border-success/40 bg-success/15 text-success hover:bg-success/25 transition-colors flex items-center gap-1.5 mr-2",children:[(0,L.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),"v",a?.latest," 업데이트"]}):a?(0,L.jsxs)("button",{onClick:()=>d(!0),title:`현재 IM v${a.current} \xb7 업데이트 확인`,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground/60 hover:text-muted-foreground transition-colors mr-2",children:["v",a.current]}):null,c&&(0,L.jsx)("div",{onClick:()=>!e&&d(!1),className:"fixed inset-0 z-[60] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(3px)"},children:(0,L.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-md animate-dialog-in p-5 flex flex-col gap-3",children:[(0,L.jsxs)("div",{className:"flex items-start justify-between",children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"text-sm font-semibold text-foreground",children:"IM 업데이트"}),(0,L.jsxs)("div",{className:"text-xs text-muted-foreground mt-0.5",children:["현재 ",(0,L.jsxs)("span",{className:"text-foreground font-mono",children:["v",a?.current]}),a?.latest&&(0,L.jsxs)(L.Fragment,{children:[" → ",(0,L.jsxs)("span",{className:`font-mono ${a.updateAvailable?"text-success":"text-foreground"}`,children:["v",a.latest]})]})]})]}),!e&&(0,L.jsx)("button",{onClick:()=>d(!1),className:"text-muted-foreground hover:text-foreground text-lg leading-none",children:"\xd7"})]}),g?(0,L.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,L.jsxs)("div",{className:"text-sm text-success flex items-center gap-2",children:[(0,L.jsx)("span",{children:"✓"}),(0,L.jsx)("span",{children:"설치 완료"}),i?.durationMs&&(0,L.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",Math.round(i.durationMs/1e3),"s)"]})]}),(0,L.jsxs)("div",{className:"text-xs text-muted-foreground leading-relaxed",children:["새 버전을 반영하려면 ",(0,L.jsx)("span",{className:"font-mono text-foreground",children:"im start"})," 프로세스를 재시작하세요. PM2로 실행 중이면 ",(0,L.jsx)("span",{className:"font-mono text-foreground",children:"pm2 restart idea-manager"}),"로 즉시 반영됩니다."]})]}):e?(0,L.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,L.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-warning animate-pulse"}),(0,L.jsx)("span",{children:"설치 중… (최대 3분)"})]}):a?.updateAvailable?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"text-xs text-muted-foreground leading-relaxed",children:[(0,L.jsx)("span",{className:"font-mono",children:"npm install -g idea-manager@latest"}),"를 실행해 최신 버전을 설치합니다. 설치가 끝나면 재시작 안내가 표시됩니다."]}),(0,L.jsxs)("div",{className:"flex justify-end gap-2 mt-1",children:[(0,L.jsx)("button",{onClick:p,className:"text-xs text-muted-foreground px-2 py-1 hover:text-foreground transition-colors",children:"이 버전 건너뜀"}),(0,L.jsx)("button",{onClick:o,className:"text-xs px-3 py-1.5 bg-primary text-primary-foreground rounded hover:opacity-90 transition-opacity",children:"지금 설치"})]})]}):(0,L.jsx)("div",{className:"text-xs text-muted-foreground",children:"최신 버전을 사용 중입니다."}),i&&!i.ok&&(0,L.jsxs)("div",{className:"mt-2 flex flex-col gap-1.5",children:[(0,L.jsxs)("div",{className:"text-xs text-destructive",children:["⚠ 설치 실패",void 0!==i.code&&null!==i.code?` (exit ${i.code})`:""]}),(i.stderr||i.error)&&(0,L.jsx)("pre",{className:"text-[10px] bg-muted/50 border border-border rounded p-2 max-h-40 overflow-auto whitespace-pre-wrap break-words text-muted-foreground",children:i.stderr||i.error})]})]})})]})}function ab(){let{state:a,setActiveTab:b,closeTab:c}=U();return(0,L.jsxs)("div",{className:"tab-bar",children:[a.tabs.map(d=>{let e=a.activeTabId===d.id,f="dashboard"===d.type;return(0,L.jsxs)("div",{onClick:()=>b(d.id),onMouseDown:a=>{1!==a.button||f||(a.preventDefault(),c(d.id))},className:`tab-item ${e?"tab-item-active":""}`,children:[(0,L.jsx)("span",{className:"truncate",children:f?"Dashboard":d.projectName||"Workspace"}),!f&&(0,L.jsx)("button",{onClick:a=>{a.stopPropagation(),c(d.id)},className:"tab-close",children:"\xd7"})]},d.id)}),(0,L.jsx)("div",{className:"tab-bar-spacer"}),(0,L.jsx)(aa,{}),(0,L.jsx)(_,{})]})}function ac({onSelect:a,onCancel:b,initialPath:c}){let[d,e]=(0,M.useState)(null),[f,g]=(0,M.useState)(!0),[h,i]=(0,M.useState)(null),[j,k]=(0,M.useState)(!1),l=(0,M.useCallback)(async a=>{g(!0),i(null),k(!1);try{let b=a?`?path=${encodeURIComponent(a)}`:"",c=await fetch(`/api/filesystem${b}`);if(c.ok)e(await c.json());else{let a=await c.json();i(a.error||"불러오기 실패"),a.permissionError&&k(!0)}}catch{i("불러오기 실패")}finally{g(!1)}},[]);return(0,L.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:b,children:(0,L.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-[520px] max-h-[70vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold",children:"프로젝트 폴더 선택"}),(0,L.jsx)("button",{onClick:b,className:"text-muted-foreground hover:text-foreground text-lg leading-none",children:"\xd7"})]}),(0,L.jsx)("div",{className:"px-4 py-2 border-b border-border bg-muted",children:(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:"경로:"}),(0,L.jsx)("span",{className:"text-xs font-mono truncate flex-1",title:d?.current,children:d?.current||"..."}),d?.isProject&&(0,L.jsx)("span",{className:"text-xs text-success shrink-0 font-medium",children:"프로젝트 감지"})]})}),(0,L.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:f?(0,L.jsx)("div",{className:"p-8 text-center text-muted-foreground text-sm",children:"불러오는 중..."}):h?(0,L.jsxs)("div",{className:"p-6 text-center",children:[(0,L.jsx)("div",{className:"text-destructive text-sm mb-2",children:h}),j&&(0,L.jsxs)("div",{className:"text-xs text-muted-foreground leading-relaxed mt-3 text-left bg-muted rounded-md p-3",children:[(0,L.jsx)("p",{className:"font-semibold mb-1",children:"macOS 권한 설정이 필요합니다"}),(0,L.jsx)("p",{children:"시스템 설정 → 개인정보 보호 및 보안 → 전체 디스크 접근 권한에서 터미널 앱을 추가해주세요."}),(0,L.jsx)("p",{className:"mt-1 text-muted-foreground",children:"Documents, Desktop 등 보호된 폴더는 별도 권한이 필요합니다."})]})]}):(0,L.jsxs)("div",{className:"py-1",children:[d?.parent&&(0,L.jsxs)("button",{onClick:()=>l(d.parent),className:"w-full text-left px-4 py-2 text-sm hover:bg-muted transition-colors flex items-center gap-2 text-muted-foreground",children:[(0,L.jsx)("span",{children:"↑"}),(0,L.jsx)("span",{children:".."})]}),d?.dirs.length===0&&(0,L.jsx)("div",{className:"px-4 py-6 text-center text-muted-foreground text-xs",children:"하위 폴더가 없습니다"}),d?.dirs.map(a=>(0,L.jsxs)("button",{onClick:()=>l(a.path),className:"w-full text-left px-4 py-2 text-sm hover:bg-muted transition-colors flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-muted-foreground",children:"\uD83D\uDCC1"}),(0,L.jsx)("span",{children:a.name})]},a.path))]})}),(0,L.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,L.jsx)("button",{onClick:b,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"취소"}),(0,L.jsx)("button",{onClick:()=>d&&a(d.current),disabled:!d,className:"px-4 py-1.5 text-xs bg-primary hover:bg-primary-hover text-white rounded-md transition-colors disabled:opacity-50",children:"이 폴더 선택"})]})]})})}function ad({open:a,title:b,description:c,confirmLabel:d="Confirm",cancelLabel:e="Cancel",variant:f="default",onConfirm:g,onCancel:h}){let i=(0,M.useRef)(null),j=(0,M.useRef)(null);return((0,M.useCallback)(b=>{a&&("Escape"===b.key&&h(),"Enter"===b.key&&g())},[a,h,g]),a)?(0,L.jsx)("div",{ref:j,onClick:a=>{a.target===j.current&&h()},className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)"},children:(0,L.jsxs)("div",{className:"bg-card border border-border rounded-xl shadow-2xl shadow-black/40 w-full max-w-sm mx-4 animate-dialog-in",children:[(0,L.jsxs)("div",{className:"p-5",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:b}),c&&(0,L.jsx)("p",{className:"text-xs text-muted-foreground mt-1.5 leading-relaxed",children:c})]}),(0,L.jsxs)("div",{className:"flex justify-end gap-2 px-5 pb-4",children:[(0,L.jsx)("button",{onClick:h,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground bg-muted hover:bg-card-hover border border-border rounded-md transition-colors",children:e}),(0,L.jsx)("button",{ref:i,onClick:g,className:`px-3 py-1.5 text-xs text-white rounded-md transition-colors ${"danger"===f?"bg-destructive hover:bg-destructive/80":"bg-primary hover:bg-primary-hover"}`,children:d})]})]})}):null}let ae=[{key:"active",label:"Active"},{key:"all",label:"All"},{key:"today",label:"Today"},{key:"archive",label:"Archive"}];function af({value:a,onChange:b}){let[c,d]=(0,M.useState)(!1);return c?(0,L.jsx)("div",{className:"flex gap-1 bg-muted rounded-lg p-1",children:ae.map(c=>(0,L.jsx)("button",{onClick:()=>b(c.key),className:`px-4 py-1.5 text-sm rounded-md transition-all ${a===c.key?"bg-card text-foreground shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:c.label},c.key))}):null}let ag={idea:"\uD83D\uDCA1",doing:"\uD83D\uDD25",writing:"✏️",submitted:"\uD83D\uDE80",testing:"\uD83E\uDDEA",done:"✅",problem:"\uD83D\uDD34"};function ah({subProject:a,projectName:b,onClick:c}){let{active_count:d,pending_count:e,done_count:f,problem_count:g,task_count:h,preview_tasks:i,last_activity:j}=a;return(0,L.jsxs)("div",{onClick:c,className:"p-4 bg-card hover:bg-card-hover border border-border rounded-xl cursor-pointer transition-all group hover:border-muted-foreground/30 hover:shadow-md hover:shadow-black/20",children:[(0,L.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold group-hover:text-primary transition-colors truncate flex-1",children:a.name}),(0,L.jsx)("span",{className:"text-xs text-muted-foreground ml-2 flex-shrink-0",children:b})]}),i.length>0&&(0,L.jsx)("div",{className:"space-y-1 mb-3",children:i.map((a,b)=>(0,L.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,L.jsx)("span",{className:"flex-shrink-0",children:ag[a.status]}),(0,L.jsx)("span",{className:`truncate ${"done"===a.status?"text-muted-foreground line-through":"text-foreground"}`,children:a.title})]},b))}),(0,L.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[d>0&&(0,L.jsxs)("span",{className:"text-primary",children:["active ",d]}),e>0&&(0,L.jsxs)("span",{children:["pending ",e]}),f>0&&(0,L.jsxs)("span",{className:"text-success",children:["done ",f]}),g>0&&(0,L.jsxs)("span",{className:"text-destructive",children:["problem ",g]}),0===h&&(0,L.jsx)("span",{children:"no tasks"})]}),j&&(0,L.jsx)("span",{children:function(a){if(!a)return"";let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return`${d}d ago`}(j)})]})]})}function ai(){let a,{state:b,openProject:c,closeTab:d}=U();b.activeTabId;let[e,f]=(0,M.useState)([]),[g,h]=(0,M.useState)([]),[i,j]=(0,M.useState)([]),[k,l]=(0,M.useState)(null),[m,n]=(0,M.useState)(!1),[o,p]=(0,M.useState)(""),[q,r]=(0,M.useState)(""),[s,t]=(0,M.useState)(""),[u,v]=(0,M.useState)(!0),[w,x]=(0,M.useState)(!1),[y,z]=(0,M.useState)(null),[A,B]=(0,M.useState)(null),[C,D]=(0,M.useState)(""),[E,F]=(0,M.useState)(""),[G,H]=(0,M.useState)(""),[I,J]=(0,M.useState)(!1),[K,N]=(0,M.useState)([]),[O,P]=(0,M.useState)(""),[Q,R]=(0,M.useState)(!1),[S,T]=(0,M.useState)(null),[V,W]=(0,M.useState)(!1),[X,Y]=(0,M.useState)(""),[Z,$]=(0,M.useState)(""),[_,aa]=(0,M.useState)(!1),ab=(0,M.useRef)(null),[ae,ag]=(0,M.useState)("active"),ai=(0,M.useCallback)(async()=>{let a=await fetch("/api/projects"),b=await a.json(),c=await Promise.all(b.map(async a=>{let b=await fetch(`/api/projects/${a.id}/sub-projects`),c=await b.json();return{...a,subProjects:c}}));f(c);let d=[];for(let a of c)for(let b of a.subProjects)if(b.task_count>0){let c=await fetch(`/api/projects/${a.id}/sub-projects/${b.id}/tasks`);for(let e of(await c.json()))d.push({...e,projectName:a.name,subProjectName:b.name})}j(d),h(d.filter(a=>a.is_today)),v(!1)},[]),aj=(0,M.useCallback)(async()=>{let a=await fetch("/api/archive");N((await a.json()).map(a=>{let b=e.find(b=>b.id===a.project_id),c=b?.subProjects.find(b=>b.id===a.sub_project_id);return{...a,projectName:b?.name,subProjectName:c?.name}}))},[e]),ak=async()=>{R(!0),Y("");let a=await fetch("/api/sync");T(await a.json())},al=async a=>{W(!0),Y("");try{let b=await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a,repoUrl:Z})}),c=await b.json();if(b.ok){if(Y(c.message||"Success"),"init"===a){let a=await fetch("/api/sync").then(a=>a.json());T(a)}"pull"===a&&ai()}else Y(`Error: ${c.error}`)}catch{Y("Error: request failed")}W(!1)},am=async a=>{if(a.preventDefault(),!o.trim())return;let b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o.trim(),description:q.trim(),project_path:s.trim()||void 0})});if(b.ok){let a=await b.json();p(""),r(""),t(""),n(!1),c(a.id,a.name)}},an=async()=>{y&&(await fetch(`/api/projects/${y}`,{method:"DELETE"}),d(y),z(null),ai())},ao=async()=>{A&&C.trim()&&(await fetch(`/api/projects/${A.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:C.trim(),description:E.trim(),project_path:G.trim()||null})})).ok&&(B(null),ai())},ap={idea:"\uD83D\uDCA1",writing:"✏️",submitted:"\uD83D\uDE80",testing:"\uD83E\uDDEA",done:"✅",problem:"\uD83D\uDD34"},aq=(()=>{let a=0,b=0,c=0,d=0,f=0;for(let g of e)for(let e of g.subProjects)a+=e.task_count,b+=e.active_count,c+=e.pending_count,d+=e.done_count,f+=e.problem_count;return{total:a,active:b,pending:c,done:d,problem:f,today:g.length}})(),ar=[{label:"Total",value:aq.total,color:"text-foreground",bg:"bg-foreground/5",filter:"total"},{label:"Active",value:aq.active,color:"text-cyan-400",bg:"bg-cyan-400/10",filter:"active"},{label:"Pending",value:aq.pending,color:"text-indigo-400",bg:"bg-indigo-400/10",filter:"pending"},{label:"Done",value:aq.done,color:"text-emerald-400",bg:"bg-emerald-400/10",filter:"done"},{label:"Problem",value:aq.problem,color:"text-red-400",bg:"bg-red-400/10",filter:"problem"},{label:"Today",value:aq.today,color:"text-amber-400",bg:"bg-amber-400/10",filter:"today"}],as=k?i.filter({total:()=>!0,active:a=>"doing"===a.status||"submitted"===a.status||"testing"===a.status,pending:a=>"idea"===a.status||"writing"===a.status,done:a=>"done"===a.status,problem:a=>"problem"===a.status,today:a=>a.is_today}[k]||(()=>!0)):[];return(0,L.jsxs)("div",{className:"h-full overflow-y-auto p-8 w-full max-w-5xl mx-auto",children:[(0,L.jsxs)("header",{className:"flex items-center justify-between mb-6",children:[(0,L.jsx)("div",{children:(0,L.jsxs)("h1",{className:"text-2xl font-bold tracking-tight",children:["IM ",(0,L.jsx)("span",{className:"text-muted-foreground font-normal text-sm ml-2",children:"Idea Manager v2"})]})}),(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[(0,L.jsx)(af,{value:ae,onChange:a=>{ag(a),localStorage.setItem("im-dashboard-tab",a),"archive"===a&&aj()}}),(0,L.jsx)("button",{onClick:ak,className:"px-3 py-2 text-sm border rounded-lg transition-colors bg-muted hover:bg-card-hover text-muted-foreground border-border",title:"DB Sync via Git",children:"Sync"}),(0,L.jsx)("button",{onClick:()=>{let a=!_;aa(a),localStorage.setItem("im-memo-open",String(a))},className:`px-3 py-2 text-sm border rounded-lg transition-colors ${_?"bg-accent/15 text-accent border-accent/30 hover:bg-accent/25":"bg-muted hover:bg-card-hover text-muted-foreground border-border"}`,title:"Quick memo",children:"Memo"}),(0,L.jsx)("button",{onClick:()=>n(!m),className:"px-4 py-2 bg-primary hover:bg-primary-hover text-white rounded-lg transition-colors font-medium text-sm",children:"+ Workspace"})]})]}),!u&&aq.total>0&&(0,L.jsxs)("div",{className:"mb-6",children:[(0,L.jsx)("div",{className:"grid grid-cols-6 gap-2",children:ar.map(({label:a,value:b,color:c,bg:d,filter:e})=>(0,L.jsxs)("button",{onClick:()=>l(k===e?null:e),className:`${d} rounded-lg p-3 text-center transition-all hover:scale-[1.02] hover:brightness-110 cursor-pointer
|
|
1
|
+
(()=>{var a={};a.id=974,a.ids=[974],a.modules={84:a=>{a.exports={style:{fontFamily:"'Geist Mono', 'Geist Mono Fallback'",fontStyle:"normal"},className:"__className_9a8899",variable:"__variable_9a8899"}},210:a=>{a.exports={style:{fontFamily:"'Geist', 'Geist Fallback'",fontStyle:"normal"},className:"__className_188709",variable:"__variable_188709"}},261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},722:a=>{"use strict";a.exports=require("next/dist/shared/lib/invariant-error")},846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},1025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},1135:()=>{},1742:()=>{},2160:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,5547,23)),Promise.resolve().then(c.t.bind(c,5098,23)),Promise.resolve().then(c.t.bind(c,7644,23)),Promise.resolve().then(c.t.bind(c,3859,23)),Promise.resolve().then(c.t.bind(c,8099,23)),Promise.resolve().then(c.t.bind(c,6237,23)),Promise.resolve().then(c.t.bind(c,8562,23)),Promise.resolve().then(c.t.bind(c,6675,23))},2506:function(a,b,c){"use strict";var d=(this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}})(c(2954)),e=c(3174);function f(a,b){var c={};return a&&"string"==typeof a&&(0,d.default)(a,function(a,d){a&&d&&(c[(0,e.camelCase)(a,b)]=d)}),c}f.default=f,a.exports=f},2954:function(a,b,c){"use strict";var d=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(b,"__esModule",{value:!0}),b.default=function(a,b){let c=null;if(!a||"string"!=typeof a)return c;let d=(0,e.default)(a),f="function"==typeof b;return d.forEach(a=>{if("declaration"!==a.type)return;let{property:d,value:e}=a;f?b(d,e,a):e&&((c=c||{})[d]=e)}),c};let e=d(c(6510))},3033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},3174:(a,b)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.camelCase=void 0;var c=/^--[a-zA-Z0-9_-]+$/,d=/-([a-z])/g,e=/^[^-]+$/,f=/^-(webkit|moz|ms|o|khtml)-/,g=/^-(ms)-/,h=function(a,b){return b.toUpperCase()},i=function(a,b){return"".concat(b,"-")};b.camelCase=function(a,b){var j;return(void 0===b&&(b={}),!(j=a)||e.test(j)||c.test(j))?a:(a=a.toLowerCase(),(a=b.reactCompat?a.replace(g,i):a.replace(f,i)).replace(d,h))}},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},3494:()=>{},3543:(a,b,c)=>{"use strict";let d,e,f;c.r(b),c.d(b,{default:()=>xh});var g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J={};c.r(J),c.d(J,{boolean:()=>ct,booleanish:()=>cu,commaOrSpaceSeparated:()=>cz,commaSeparated:()=>cy,number:()=>cw,overloadedBoolean:()=>cv,spaceSeparated:()=>cx});var K={};c.r(K),c.d(K,{attentionMarkers:()=>ex,contentInitial:()=>er,disable:()=>ey,document:()=>eq,flow:()=>et,flowInitial:()=>es,insideSpan:()=>ew,string:()=>eu,text:()=>ev});var L=c(8249),M=c(7484),N=c.n(M);let O={id:"dashboard",type:"dashboard"};function P(a){return a.some(a=>"dashboard"===a.id)?a:[O,...a]}function Q(a,b){switch(b.type){case"OPEN_PROJECT":{let c=a.tabs.find(a=>a.projectId===b.projectId);if(c)return{tabs:a.tabs.map(a=>a.id===c.id?{...a,initialSubId:b.initialSubId,initialTaskId:b.initialTaskId}:a),activeTabId:c.id};let d={id:b.projectId,type:"project",projectId:b.projectId,projectName:b.projectName,initialSubId:b.initialSubId,initialTaskId:b.initialTaskId};return{tabs:[...a.tabs,d],activeTabId:d.id}}case"CLOSE_TAB":{if("dashboard"===b.tabId)return a;let c=a.tabs.findIndex(a=>a.id===b.tabId),d=a.tabs.filter(a=>a.id!==b.tabId),e=a.activeTabId;return a.activeTabId===b.tabId&&(e=d[Math.max(0,c-1)]?.id||"dashboard"),{tabs:P(d),activeTabId:e}}case"SET_ACTIVE":return{...a,activeTabId:b.tabId};case"UPDATE_TAB_NAME":return{...a,tabs:a.tabs.map(a=>a.id===b.tabId?{...a,projectName:b.name}:a)};case"CONSUME_INITIAL":return{...a,tabs:a.tabs.map(a=>a.id===b.tabId?{...a,initialSubId:void 0,initialTaskId:void 0}:a)};case"HYDRATE":return{tabs:P(b.state.tabs),activeTabId:b.state.activeTabId};default:return a}}let R={tabs:[O],activeTabId:"dashboard"};function S(){return R}let T=(0,M.createContext)(null);function U(){let a=(0,M.useContext)(T);if(!a)throw Error("useTabContext must be used within TabProvider");return a}function V({children:a}){let[b,c]=(0,M.useReducer)(Q,void 0,S),d=(0,M.useCallback)((a,b,d,e)=>{c({type:"OPEN_PROJECT",projectId:a,projectName:b,initialSubId:d,initialTaskId:e})},[]),e=(0,M.useCallback)(a=>{c({type:"CLOSE_TAB",tabId:a})},[]),f=(0,M.useCallback)(a=>{c({type:"SET_ACTIVE",tabId:a})},[]),g=(0,M.useCallback)((a,b)=>{c({type:"UPDATE_TAB_NAME",tabId:a,name:b})},[]),h=(0,M.useCallback)(a=>{c({type:"CONSUME_INITIAL",tabId:a})},[]),i=(0,M.useCallback)(()=>{let a=b.tabs.findIndex(a=>a.id===b.activeTabId),d=b.tabs[(a+1)%b.tabs.length];d&&c({type:"SET_ACTIVE",tabId:d.id})},[b.tabs,b.activeTabId]),j=(0,M.useCallback)(()=>{let a=b.tabs.findIndex(a=>a.id===b.activeTabId),d=b.tabs[(a-1+b.tabs.length)%b.tabs.length];d&&c({type:"SET_ACTIVE",tabId:d.id})},[b.tabs,b.activeTabId]);return(0,L.jsx)(T.Provider,{value:{state:b,openProject:d,closeTab:e,setActiveTab:f,updateTabName:g,consumeInitial:h,nextTab:i,prevTab:j},children:a})}let W=[{id:"dark",name:"Dark",emoji:"\uD83C\uDF11",colors:{"--background":"224 20% 10%","--foreground":"210 40% 98%","--card":"224 20% 13%","--card-hover":"220 15% 18%","--border":"220 15% 28%","--input":"220 15% 24%","--primary":"210 85% 60%","--primary-hover":"210 85% 50%","--accent":"265 70% 60%","--success":"142 71% 45%","--warning":"38 92% 50%","--destructive":"0 70% 55%","--muted":"220 15% 20%","--muted-foreground":"215 15% 60%"}},{id:"light",name:"Light",emoji:"☀️",colors:{"--background":"0 0% 97%","--foreground":"224 20% 14%","--card":"0 0% 100%","--card-hover":"220 15% 96%","--border":"220 15% 85%","--input":"220 15% 92%","--primary":"210 85% 50%","--primary-hover":"210 85% 42%","--accent":"265 70% 55%","--success":"142 71% 40%","--warning":"38 92% 45%","--destructive":"0 70% 50%","--muted":"220 15% 92%","--muted-foreground":"215 15% 45%"}},{id:"nord",name:"Nord",emoji:"❄️",colors:{"--background":"220 16% 16%","--foreground":"219 28% 88%","--card":"220 16% 20%","--card-hover":"220 16% 24%","--border":"220 16% 30%","--input":"220 16% 26%","--primary":"193 43% 60%","--primary-hover":"193 43% 50%","--accent":"311 20% 63%","--success":"92 28% 55%","--warning":"40 71% 73%","--destructive":"354 42% 56%","--muted":"220 16% 24%","--muted-foreground":"219 20% 55%"}},{id:"ocean",name:"Ocean",emoji:"\uD83C\uDF0A",colors:{"--background":"210 50% 8%","--foreground":"200 40% 95%","--card":"210 45% 12%","--card-hover":"210 40% 17%","--border":"210 35% 25%","--input":"210 40% 20%","--primary":"190 80% 55%","--primary-hover":"190 80% 45%","--accent":"170 60% 50%","--success":"160 60% 45%","--warning":"38 90% 50%","--destructive":"0 65% 55%","--muted":"210 40% 18%","--muted-foreground":"200 25% 55%"}},{id:"forest",name:"Forest",emoji:"\uD83C\uDF32",colors:{"--background":"150 20% 9%","--foreground":"140 20% 92%","--card":"150 18% 13%","--card-hover":"150 15% 18%","--border":"150 12% 26%","--input":"150 15% 22%","--primary":"142 50% 55%","--primary-hover":"142 50% 45%","--accent":"80 45% 55%","--success":"142 60% 45%","--warning":"45 85% 50%","--destructive":"0 60% 52%","--muted":"150 15% 18%","--muted-foreground":"140 12% 52%"}},{id:"sunset",name:"Sunset",emoji:"\uD83C\uDF05",colors:{"--background":"15 20% 10%","--foreground":"30 30% 93%","--card":"15 18% 14%","--card-hover":"15 15% 19%","--border":"15 12% 27%","--input":"15 15% 22%","--primary":"25 90% 58%","--primary-hover":"25 90% 48%","--accent":"340 65% 58%","--success":"142 55% 45%","--warning":"45 90% 52%","--destructive":"0 70% 55%","--muted":"15 15% 19%","--muted-foreground":"20 12% 52%"}},{id:"lavender",name:"Lavender",emoji:"\uD83D\uDC9C",colors:{"--background":"270 20% 10%","--foreground":"260 30% 93%","--card":"270 18% 14%","--card-hover":"270 15% 19%","--border":"270 12% 28%","--input":"270 15% 23%","--primary":"265 70% 62%","--primary-hover":"265 70% 52%","--accent":"320 55% 58%","--success":"142 55% 45%","--warning":"38 85% 52%","--destructive":"0 65% 55%","--muted":"270 15% 19%","--muted-foreground":"260 12% 52%"}},{id:"rose",name:"Ros\xe9",emoji:"\uD83C\uDF37",colors:{"--background":"0 0% 96%","--foreground":"340 20% 18%","--card":"0 0% 100%","--card-hover":"340 20% 95%","--border":"340 15% 85%","--input":"340 15% 91%","--primary":"340 75% 55%","--primary-hover":"340 75% 45%","--accent":"300 50% 55%","--success":"142 55% 42%","--warning":"38 85% 48%","--destructive":"0 70% 50%","--muted":"340 15% 91%","--muted-foreground":"340 12% 48%"}}];function X(a){return W.find(b=>b.id===a)??W[0]}let Y=(0,M.createContext)(null);function Z({children:a}){let[b,c]=(0,M.useState)(X("dark")),[d,e]=(0,M.useState)(!1),f=(0,M.useCallback)(a=>{c(X(a)),localStorage.setItem("im-theme",a)},[]);return(0,L.jsx)(Y.Provider,{value:{theme:b,setTheme:f,themes:W},children:a})}var $=c(4429);function _(){let{theme:a,setTheme:b,themes:c}=function(){let a=(0,M.useContext)(Y);if(!a)throw Error("useTheme must be used within ThemeProvider");return a}(),[d,e]=(0,M.useState)(!1),f=(0,M.useRef)(null),g=(0,M.useRef)(null),[h,i]=(0,M.useState)({top:0,right:0});return(0,M.useCallback)(()=>{if(!f.current)return;let a=f.current.getBoundingClientRect();i({top:a.bottom+6,right:window.innerWidth-a.right})},[]),(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("button",{ref:f,className:"theme-picker-btn",onClick:()=>e(!d),title:"테마 변경",children:[(0,L.jsx)("span",{className:"theme-picker-preview",style:{background:`hsl(${a.colors["--primary"]})`}}),(0,L.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,L.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,L.jsx)("path",{d:"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"})]})]}),d&&(0,$.createPortal)((0,L.jsxs)("div",{ref:g,className:"theme-picker-dropdown",style:{position:"fixed",top:h.top,right:h.right},children:[(0,L.jsx)("div",{className:"theme-picker-title",children:"테마"}),(0,L.jsx)("div",{className:"theme-picker-grid",children:c.map(c=>(0,L.jsxs)("button",{className:`theme-picker-item ${c.id===a.id?"theme-picker-item-active":""}`,onClick:()=>{b(c.id),e(!1)},children:[(0,L.jsxs)("div",{className:"theme-picker-swatch",children:[(0,L.jsx)("div",{style:{background:`hsl(${c.colors["--background"]})`,flex:1}}),(0,L.jsx)("div",{style:{background:`hsl(${c.colors["--primary"]})`,flex:1}}),(0,L.jsx)("div",{style:{background:`hsl(${c.colors["--accent"]})`,flex:1}})]}),(0,L.jsxs)("span",{className:"theme-picker-name",children:[c.emoji," ",c.name]})]},c.id))})]}),document.body)]})}function aa(){let[a,b]=(0,M.useState)(null),[c,d]=(0,M.useState)(!1),[e,f]=(0,M.useState)(!1),[g,h]=(0,M.useState)(!1),[i,j]=(0,M.useState)(null),k=(0,M.useRef)(null),l=(0,M.useCallback)(async()=>{try{let a=await fetch("/api/version");if(!a.ok)return;let c=await a.json();b(c)}catch{}},[]),m=a?.latest!==null&&a?.latest===k.current,n=!!a?.updateAvailable&&!m,o=(0,M.useCallback)(async()=>{f(!0),j(null);try{let a=await fetch("/api/update",{method:"POST"}),b=await a.json();j(b),b.ok&&(h(!0),await l())}catch(a){j({ok:!1,error:a instanceof Error?a.message:"Network error"})}finally{f(!1)}},[l]),p=(0,M.useCallback)(()=>{if(a?.latest){try{localStorage.setItem("im-update-dismissed",a.latest)}catch{}k.current=a.latest}b(a=>a?{...a,updateAvailable:!1}:a)},[a?.latest]);return(0,L.jsxs)(L.Fragment,{children:[n?(0,L.jsxs)("button",{onClick:()=>d(!0),title:`IM v${a?.latest} 업데이트 가능 (현재 ${a?.current})`,className:"text-xs px-2 py-1 rounded-md border border-success/40 bg-success/15 text-success hover:bg-success/25 transition-colors flex items-center gap-1.5 mr-2",children:[(0,L.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),"v",a?.latest," 업데이트"]}):a?(0,L.jsxs)("button",{onClick:()=>d(!0),title:`현재 IM v${a.current} \xb7 업데이트 확인`,className:"text-[10px] px-1.5 py-0.5 rounded text-muted-foreground/60 hover:text-muted-foreground transition-colors mr-2",children:["v",a.current]}):null,c&&(0,L.jsx)("div",{onClick:()=>!e&&d(!1),className:"fixed inset-0 z-[60] flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(3px)"},children:(0,L.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-md animate-dialog-in p-5 flex flex-col gap-3",children:[(0,L.jsxs)("div",{className:"flex items-start justify-between",children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:"text-sm font-semibold text-foreground",children:"IM 업데이트"}),(0,L.jsxs)("div",{className:"text-xs text-muted-foreground mt-0.5",children:["현재 ",(0,L.jsxs)("span",{className:"text-foreground font-mono",children:["v",a?.current]}),a?.latest&&(0,L.jsxs)(L.Fragment,{children:[" → ",(0,L.jsxs)("span",{className:`font-mono ${a.updateAvailable?"text-success":"text-foreground"}`,children:["v",a.latest]})]})]})]}),!e&&(0,L.jsx)("button",{onClick:()=>d(!1),className:"text-muted-foreground hover:text-foreground text-lg leading-none",children:"\xd7"})]}),g?(0,L.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,L.jsxs)("div",{className:"text-sm text-success flex items-center gap-2",children:[(0,L.jsx)("span",{children:"✓"}),(0,L.jsx)("span",{children:"설치 완료"}),i?.durationMs&&(0,L.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",Math.round(i.durationMs/1e3),"s)"]})]}),(0,L.jsxs)("div",{className:"text-xs text-muted-foreground leading-relaxed",children:["새 버전을 반영하려면 ",(0,L.jsx)("span",{className:"font-mono text-foreground",children:"im start"})," 프로세스를 재시작하세요. PM2로 실행 중이면 ",(0,L.jsx)("span",{className:"font-mono text-foreground",children:"pm2 restart idea-manager"}),"로 즉시 반영됩니다."]})]}):e?(0,L.jsxs)("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[(0,L.jsx)("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-warning animate-pulse"}),(0,L.jsx)("span",{children:"설치 중… (최대 3분)"})]}):a?.updateAvailable?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)("div",{className:"text-xs text-muted-foreground leading-relaxed",children:[(0,L.jsx)("span",{className:"font-mono",children:"npm install -g idea-manager@latest"}),"를 실행해 최신 버전을 설치합니다. 설치가 끝나면 재시작 안내가 표시됩니다."]}),(0,L.jsxs)("div",{className:"flex justify-end gap-2 mt-1",children:[(0,L.jsx)("button",{onClick:p,className:"text-xs text-muted-foreground px-2 py-1 hover:text-foreground transition-colors",children:"이 버전 건너뜀"}),(0,L.jsx)("button",{onClick:o,className:"text-xs px-3 py-1.5 bg-primary text-primary-foreground rounded hover:opacity-90 transition-opacity",children:"지금 설치"})]})]}):(0,L.jsx)("div",{className:"text-xs text-muted-foreground",children:"최신 버전을 사용 중입니다."}),i&&!i.ok&&(0,L.jsxs)("div",{className:"mt-2 flex flex-col gap-1.5",children:[(0,L.jsxs)("div",{className:"text-xs text-destructive",children:["⚠ 설치 실패",void 0!==i.code&&null!==i.code?` (exit ${i.code})`:""]}),(i.stderr||i.error)&&(0,L.jsx)("pre",{className:"text-[10px] bg-muted/50 border border-border rounded p-2 max-h-40 overflow-auto whitespace-pre-wrap break-words text-muted-foreground",children:i.stderr||i.error})]})]})})]})}function ab(){let{state:a,setActiveTab:b,closeTab:c}=U();return(0,L.jsxs)("div",{className:"tab-bar",children:[a.tabs.map(d=>{let e=a.activeTabId===d.id,f="dashboard"===d.type;return(0,L.jsxs)("div",{onClick:()=>b(d.id),onMouseDown:a=>{1!==a.button||f||(a.preventDefault(),c(d.id))},className:`tab-item ${e?"tab-item-active":""}`,children:[(0,L.jsx)("span",{className:"truncate",children:f?"Dashboard":d.projectName||"Workspace"}),!f&&(0,L.jsx)("button",{onClick:a=>{a.stopPropagation(),c(d.id)},className:"tab-close",children:"\xd7"})]},d.id)}),(0,L.jsx)("div",{className:"tab-bar-spacer"}),(0,L.jsx)(aa,{}),(0,L.jsx)(_,{})]})}function ac({onSelect:a,onCancel:b,initialPath:c}){let[d,e]=(0,M.useState)(null),[f,g]=(0,M.useState)(!0),[h,i]=(0,M.useState)(null),[j,k]=(0,M.useState)(!1),l=(0,M.useCallback)(async a=>{g(!0),i(null),k(!1);try{let b=a?`?path=${encodeURIComponent(a)}`:"",c=await fetch(`/api/filesystem${b}`);if(c.ok)e(await c.json());else{let a=await c.json();i(a.error||"불러오기 실패"),a.permissionError&&k(!0)}}catch{i("불러오기 실패")}finally{g(!1)}},[]);return(0,L.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:b,children:(0,L.jsxs)("div",{className:"bg-card border border-border rounded-lg shadow-xl w-[520px] max-h-[70vh] flex flex-col",onClick:a=>a.stopPropagation(),children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold",children:"프로젝트 폴더 선택"}),(0,L.jsx)("button",{onClick:b,className:"text-muted-foreground hover:text-foreground text-lg leading-none",children:"\xd7"})]}),(0,L.jsx)("div",{className:"px-4 py-2 border-b border-border bg-muted",children:(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:"경로:"}),(0,L.jsx)("span",{className:"text-xs font-mono truncate flex-1",title:d?.current,children:d?.current||"..."}),d?.isProject&&(0,L.jsx)("span",{className:"text-xs text-success shrink-0 font-medium",children:"프로젝트 감지"})]})}),(0,L.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0",children:f?(0,L.jsx)("div",{className:"p-8 text-center text-muted-foreground text-sm",children:"불러오는 중..."}):h?(0,L.jsxs)("div",{className:"p-6 text-center",children:[(0,L.jsx)("div",{className:"text-destructive text-sm mb-2",children:h}),j&&(0,L.jsxs)("div",{className:"text-xs text-muted-foreground leading-relaxed mt-3 text-left bg-muted rounded-md p-3",children:[(0,L.jsx)("p",{className:"font-semibold mb-1",children:"macOS 권한 설정이 필요합니다"}),(0,L.jsx)("p",{children:"시스템 설정 → 개인정보 보호 및 보안 → 전체 디스크 접근 권한에서 터미널 앱을 추가해주세요."}),(0,L.jsx)("p",{className:"mt-1 text-muted-foreground",children:"Documents, Desktop 등 보호된 폴더는 별도 권한이 필요합니다."})]})]}):(0,L.jsxs)("div",{className:"py-1",children:[d?.parent&&(0,L.jsxs)("button",{onClick:()=>l(d.parent),className:"w-full text-left px-4 py-2 text-sm hover:bg-muted transition-colors flex items-center gap-2 text-muted-foreground",children:[(0,L.jsx)("span",{children:"↑"}),(0,L.jsx)("span",{children:".."})]}),d?.dirs.length===0&&(0,L.jsx)("div",{className:"px-4 py-6 text-center text-muted-foreground text-xs",children:"하위 폴더가 없습니다"}),d?.dirs.map(a=>(0,L.jsxs)("button",{onClick:()=>l(a.path),className:"w-full text-left px-4 py-2 text-sm hover:bg-muted transition-colors flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-muted-foreground",children:"\uD83D\uDCC1"}),(0,L.jsx)("span",{children:a.name})]},a.path))]})}),(0,L.jsxs)("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[(0,L.jsx)("button",{onClick:b,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:"취소"}),(0,L.jsx)("button",{onClick:()=>d&&a(d.current),disabled:!d,className:"px-4 py-1.5 text-xs bg-primary hover:bg-primary-hover text-white rounded-md transition-colors disabled:opacity-50",children:"이 폴더 선택"})]})]})})}function ad({open:a,title:b,description:c,confirmLabel:d="Confirm",cancelLabel:e="Cancel",variant:f="default",onConfirm:g,onCancel:h}){let i=(0,M.useRef)(null),j=(0,M.useRef)(null);return((0,M.useCallback)(b=>{a&&("Escape"===b.key&&h(),"Enter"===b.key&&g())},[a,h,g]),a)?(0,L.jsx)("div",{ref:j,onClick:a=>{a.target===j.current&&h()},className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)"},children:(0,L.jsxs)("div",{className:"bg-card border border-border rounded-xl shadow-2xl shadow-black/40 w-full max-w-sm mx-4 animate-dialog-in",children:[(0,L.jsxs)("div",{className:"p-5",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:b}),c&&(0,L.jsx)("p",{className:"text-xs text-muted-foreground mt-1.5 leading-relaxed",children:c})]}),(0,L.jsxs)("div",{className:"flex justify-end gap-2 px-5 pb-4",children:[(0,L.jsx)("button",{onClick:h,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground bg-muted hover:bg-card-hover border border-border rounded-md transition-colors",children:e}),(0,L.jsx)("button",{ref:i,onClick:g,className:`px-3 py-1.5 text-xs text-white rounded-md transition-colors ${"danger"===f?"bg-destructive hover:bg-destructive/80":"bg-primary hover:bg-primary-hover"}`,children:d})]})]})}):null}let ae=[{key:"active",label:"Active"},{key:"all",label:"All"},{key:"today",label:"Today"},{key:"archive",label:"Archive"}];function af({value:a,onChange:b}){let[c,d]=(0,M.useState)(!1);return c?(0,L.jsx)("div",{className:"flex gap-1 bg-muted rounded-lg p-1",children:ae.map(c=>(0,L.jsx)("button",{onClick:()=>b(c.key),className:`px-4 py-1.5 text-sm rounded-md transition-all ${a===c.key?"bg-card text-foreground shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:c.label},c.key))}):null}let ag={idea:"\uD83D\uDCA1",doing:"\uD83D\uDD25",writing:"✏️",submitted:"\uD83D\uDE80",testing:"\uD83E\uDDEA",done:"✅",problem:"\uD83D\uDD34"};function ah({subProject:a,projectName:b,onClick:c}){let{active_count:d,pending_count:e,done_count:f,problem_count:g,task_count:h,preview_tasks:i,last_activity:j}=a;return(0,L.jsxs)("div",{onClick:c,className:"p-4 bg-card hover:bg-card-hover border border-border rounded-xl cursor-pointer transition-all group hover:border-muted-foreground/30 hover:shadow-md hover:shadow-black/20",children:[(0,L.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold group-hover:text-primary transition-colors truncate flex-1",children:a.name}),(0,L.jsx)("span",{className:"text-xs text-muted-foreground ml-2 flex-shrink-0",children:b})]}),i.length>0&&(0,L.jsx)("div",{className:"space-y-1 mb-3",children:i.map((a,b)=>(0,L.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,L.jsx)("span",{className:"flex-shrink-0",children:ag[a.status]}),(0,L.jsx)("span",{className:`truncate ${"done"===a.status?"text-muted-foreground line-through":"text-foreground"}`,children:a.title})]},b))}),(0,L.jsxs)("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[d>0&&(0,L.jsxs)("span",{className:"text-primary",children:["active ",d]}),e>0&&(0,L.jsxs)("span",{children:["pending ",e]}),f>0&&(0,L.jsxs)("span",{className:"text-success",children:["done ",f]}),g>0&&(0,L.jsxs)("span",{className:"text-destructive",children:["problem ",g]}),0===h&&(0,L.jsx)("span",{children:"no tasks"})]}),j&&(0,L.jsx)("span",{children:function(a){if(!a)return"";let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"just now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return`${d}d ago`}(j)})]})]})}function ai(){let a,{state:b,openProject:c,closeTab:d}=U();b.activeTabId;let[e,f]=(0,M.useState)([]),[g,h]=(0,M.useState)([]),[i,j]=(0,M.useState)([]),[k,l]=(0,M.useState)(null),[m,n]=(0,M.useState)(!1),[o,p]=(0,M.useState)(""),[q,r]=(0,M.useState)(""),[s,t]=(0,M.useState)(""),[u,v]=(0,M.useState)(!0),[w,x]=(0,M.useState)(!1),[y,z]=(0,M.useState)(null),[A,B]=(0,M.useState)(null),[C,D]=(0,M.useState)(""),[E,F]=(0,M.useState)(""),[G,H]=(0,M.useState)(""),[I,J]=(0,M.useState)(!1),[K,N]=(0,M.useState)([]),[O,P]=(0,M.useState)(""),[Q,R]=(0,M.useState)(!1),[S,T]=(0,M.useState)(null),[V,W]=(0,M.useState)(!1),[X,Y]=(0,M.useState)(""),[Z,$]=(0,M.useState)(""),[_,aa]=(0,M.useState)(!1),ab=(0,M.useRef)(null),[ae,ag]=(0,M.useState)("active"),ai=(0,M.useCallback)(async()=>{let a=await fetch("/api/projects"),b=await a.json(),c=await Promise.all(b.map(async a=>{let b=await fetch(`/api/projects/${a.id}/sub-projects`),c=await b.json();return{...a,subProjects:c}}));f(c);let d=[];for(let a of c)for(let b of a.subProjects)if(b.task_count>0){let c=await fetch(`/api/projects/${a.id}/sub-projects/${b.id}/tasks`);for(let e of(await c.json()))d.push({...e,projectName:a.name,subProjectName:b.name})}j(d),h(d.filter(a=>a.is_today)),v(!1)},[]),aj=(0,M.useCallback)(async()=>{let a=await fetch("/api/archive");N((await a.json()).map(a=>{let b=e.find(b=>b.id===a.project_id),c=b?.subProjects.find(b=>b.id===a.sub_project_id);return{...a,projectName:b?.name,subProjectName:c?.name}}))},[e]),ak=async()=>{R(!0),Y("");let a=await fetch("/api/sync");T(await a.json())},al=async a=>{W(!0),Y("");try{let b=await fetch("/api/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a,repoUrl:Z})}),c=await b.json();if(b.ok){if(Y(c.message||"Success"),"init"===a){let a=await fetch("/api/sync").then(a=>a.json());T(a)}"pull"===a&&ai()}else Y(`Error: ${c.error}`)}catch{Y("Error: request failed")}W(!1)},am=async a=>{if(a.preventDefault(),!o.trim())return;let b=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o.trim(),description:q.trim(),project_path:s.trim()||void 0})});if(b.ok){let a=await b.json();p(""),r(""),t(""),n(!1),c(a.id,a.name)}},an=async()=>{y&&(await fetch(`/api/projects/${y}`,{method:"DELETE"}),d(y),z(null),ai())},ao=async()=>{A&&C.trim()&&(await fetch(`/api/projects/${A.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:C.trim(),description:E.trim(),project_path:G.trim()||null})})).ok&&(B(null),ai())},ap={idea:"\uD83D\uDCA1",writing:"✏️",submitted:"\uD83D\uDE80",testing:"\uD83E\uDDEA",done:"✅",problem:"\uD83D\uDD34"},aq=(()=>{let a=0,b=0,c=0,d=0,f=0;for(let g of e)for(let e of g.subProjects)a+=e.task_count,b+=e.active_count,c+=e.pending_count,d+=e.done_count,f+=e.problem_count;return{total:a,active:b,pending:c,done:d,problem:f,today:g.length}})(),ar=[{label:"Total",value:aq.total,color:"text-foreground",bg:"bg-foreground/5",filter:"total"},{label:"Active",value:aq.active,color:"text-cyan-400",bg:"bg-cyan-400/10",filter:"active"},{label:"Pending",value:aq.pending,color:"text-indigo-400",bg:"bg-indigo-400/10",filter:"pending"},{label:"Done",value:aq.done,color:"text-emerald-400",bg:"bg-emerald-400/10",filter:"done"},{label:"Problem",value:aq.problem,color:"text-red-400",bg:"bg-red-400/10",filter:"problem"},{label:"Today",value:aq.today,color:"text-amber-400",bg:"bg-amber-400/10",filter:"today"}],as=k?i.filter({total:()=>!0,active:a=>"doing"===a.status||"submitted"===a.status||"testing"===a.status,pending:a=>"idea"===a.status||"writing"===a.status,done:a=>"done"===a.status,problem:a=>"problem"===a.status,today:a=>a.is_today}[k]||(()=>!0)):[];return(0,L.jsxs)("div",{className:"h-full overflow-y-auto p-8 w-full max-w-5xl mx-auto",children:[(0,L.jsxs)("header",{className:"flex items-center justify-between mb-6",children:[(0,L.jsx)("div",{children:(0,L.jsxs)("h1",{className:"text-2xl font-bold tracking-tight",children:["IM ",(0,L.jsx)("span",{className:"text-muted-foreground font-normal text-sm ml-2",children:"Idea Manager v2"})]})}),(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[(0,L.jsx)(af,{value:ae,onChange:a=>{ag(a),localStorage.setItem("im-dashboard-tab",a),"archive"===a&&aj()}}),(0,L.jsx)("button",{onClick:ak,className:"px-3 py-2 text-sm border rounded-lg transition-colors bg-muted hover:bg-card-hover text-muted-foreground border-border",title:"DB Sync via Git",children:"Sync"}),(0,L.jsx)("button",{onClick:()=>{let a=!_;aa(a),localStorage.setItem("im-memo-open",String(a))},className:`px-3 py-2 text-sm border rounded-lg transition-colors ${_?"bg-accent/15 text-accent border-accent/30 hover:bg-accent/25":"bg-muted hover:bg-card-hover text-muted-foreground border-border"}`,title:"Quick memo",children:"Memo"}),(0,L.jsx)("button",{onClick:()=>n(!m),className:"px-4 py-2 bg-primary hover:bg-primary-hover text-white rounded-lg transition-colors font-medium text-sm",children:"+ Workspace"})]})]}),!u&&aq.total>0&&(0,L.jsxs)("div",{className:"mb-6",children:[(0,L.jsx)("div",{className:"grid grid-cols-6 gap-2",children:ar.map(({label:a,value:b,color:c,bg:d,filter:e})=>(0,L.jsxs)("button",{onClick:()=>l(k===e?null:e),className:`${d} rounded-lg p-3 text-center transition-all hover:scale-[1.02] hover:brightness-110 cursor-pointer
|
|
6
2
|
${k===e?"ring-2 ring-offset-1 ring-offset-transparent ring-current scale-[1.02]":""}`,children:[(0,L.jsx)("div",{className:`text-xl font-bold ${c}`,children:b}),(0,L.jsx)("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mt-0.5",children:a})]},a))}),aq.total>0&&(0,L.jsxs)("div",{className:"mt-2 h-1.5 rounded-full bg-muted overflow-hidden flex",children:[aq.done>0&&(0,L.jsx)("div",{className:"bg-emerald-400 transition-all",style:{width:`${aq.done/aq.total*100}%`}}),aq.active>0&&(0,L.jsx)("div",{className:"bg-cyan-400 transition-all",style:{width:`${aq.active/aq.total*100}%`}}),aq.pending>0&&(0,L.jsx)("div",{className:"bg-indigo-400 transition-all",style:{width:`${aq.pending/aq.total*100}%`}}),aq.problem>0&&(0,L.jsx)("div",{className:"bg-red-400 transition-all",style:{width:`${aq.problem/aq.total*100}%`}})]}),k&&(0,L.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsxs)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:[ar.find(a=>a.filter===k)?.label," — ",as.length," tasks"]}),(0,L.jsx)("button",{onClick:()=>l(null),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Clear"})]}),(0,L.jsx)("div",{className:"max-h-[280px] overflow-y-auto space-y-1",children:as.map(a=>(0,L.jsxs)("div",{onClick:()=>c(a.project_id,a.projectName,a.sub_project_id,a.id),className:"flex items-center gap-3 px-3 py-2 bg-card hover:bg-card-hover border border-border rounded-lg cursor-pointer transition-colors",children:[(0,L.jsx)("span",{className:"text-sm",children:ap[a.status]}),(0,L.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,L.jsx)("span",{className:"text-sm font-medium",children:a.title}),(0,L.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[a.projectName," / ",a.subProjectName]})]})]},a.id))})]})]}),_&&(0,L.jsxs)("div",{className:"mb-6 bg-card rounded-lg border border-border overflow-hidden",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[(0,L.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Quick Memo"}),(0,L.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"auto-saved"})]}),(0,L.jsx)("textarea",{value:O,onChange:a=>{var b;P(b=a.target.value),ab.current&&clearTimeout(ab.current),ab.current=setTimeout(()=>{fetch("/api/global-memo",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:b})})},500)},placeholder:"자유롭게 메모하세요...",className:"w-full bg-transparent px-4 py-3 text-sm text-foreground resize-none focus:outline-none leading-relaxed font-mono min-h-[150px] max-h-[400px]",style:{height:Math.max(150,Math.min(400,(O.split("\n").length+1)*22))}})]}),m&&(0,L.jsxs)("form",{onSubmit:am,className:"mb-6 p-5 bg-card rounded-lg border border-border",children:[(0,L.jsx)("input",{type:"text",placeholder:"Workspace name",value:o,onChange:a=>p(a.target.value),className:"w-full bg-input border border-border rounded-lg px-4 py-2.5 mb-3 focus:border-primary focus:outline-none text-foreground",autoFocus:!0}),(0,L.jsx)("input",{type:"text",placeholder:"Description (optional)",value:q,onChange:a=>r(a.target.value),className:"w-full bg-input border border-border rounded-lg px-4 py-2.5 mb-3 focus:border-primary focus:outline-none text-foreground"}),(0,L.jsx)("div",{className:"mb-4",children:(0,L.jsx)("button",{type:"button",onClick:()=>x(!0),className:"w-full bg-input border border-border rounded-lg px-4 py-2.5 text-left text-sm hover:border-primary transition-colors",children:s?(0,L.jsx)("span",{className:"font-mono text-foreground",children:s}):(0,L.jsx)("span",{className:"text-muted-foreground",children:"Workspace folder (optional)"})})}),(0,L.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,L.jsx)("button",{type:"button",onClick:()=>n(!1),className:"px-4 py-2 text-muted-foreground hover:text-foreground transition-colors text-sm",children:"Cancel"}),(0,L.jsx)("button",{type:"submit",className:"px-4 py-2 bg-primary hover:bg-primary-hover text-white rounded-lg transition-colors text-sm",children:"Create"})]})]}),u?(0,L.jsx)("div",{className:"text-center text-muted-foreground py-20",children:"Loading..."}):"archive"===ae?0===K.length?(0,L.jsxs)("div",{className:"text-center py-20 text-muted-foreground",children:[(0,L.jsx)("p",{className:"text-lg mb-2",children:"No archived tasks"}),(0,L.jsx)("p",{className:"text-sm",children:"Archived tasks will appear here"})]}):(0,L.jsx)("div",{className:"space-y-2",children:K.map(a=>(0,L.jsxs)("div",{className:"flex items-center gap-3 p-3 bg-card border border-border rounded-lg transition-colors group",children:[(0,L.jsx)("span",{className:"text-sm",children:ap[a.status]}),(0,L.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,L.jsx)("span",{className:"text-sm font-medium",children:a.title}),(0,L.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[a.projectName,a.subProjectName?` / ${a.subProjectName}`:""]}),a.description&&(0,L.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a.description})]}),(0,L.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,L.jsx)("button",{onClick:async()=>{await fetch("/api/archive",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:a.id,action:"restore"})}),aj(),ai()},className:"px-2 py-1 text-xs text-primary hover:bg-primary/10 rounded transition-colors",children:"Restore"}),(0,L.jsx)("button",{onClick:async()=>{await fetch("/api/archive",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:a.id,action:"delete"})}),aj()},className:"px-2 py-1 text-xs text-destructive hover:bg-destructive/10 rounded transition-colors",children:"Delete"})]})]},a.id))}):"today"===ae?0===g.length?(0,L.jsxs)("div",{className:"text-center py-20 text-muted-foreground",children:[(0,L.jsx)("p",{className:"text-lg mb-2",children:"No tasks marked for today"}),(0,L.jsx)("p",{className:"text-sm",children:"Mark tasks with the Today button in task detail"})]}):(0,L.jsx)("div",{className:"space-y-2",children:g.map(a=>(0,L.jsxs)("div",{onClick:()=>c(a.project_id,a.projectName,a.sub_project_id,a.id),className:"flex items-center gap-3 p-3 bg-card hover:bg-card-hover border border-border rounded-lg cursor-pointer transition-colors",children:[(0,L.jsx)("span",{className:"text-sm",children:ap[a.status]}),(0,L.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,L.jsx)("span",{className:"text-sm font-medium",children:a.title}),(0,L.jsxs)("span",{className:"text-xs text-muted-foreground ml-2",children:[a.projectName," / ",a.subProjectName]})]})]},a.id))}):(0,L.jsx)(L.Fragment,{children:"all"===ae?0===e.length?(0,L.jsxs)("div",{className:"text-center py-20",children:[(0,L.jsx)("p",{className:"text-muted-foreground text-lg mb-2",children:"No workspaces yet"}),(0,L.jsx)("p",{className:"text-muted-foreground text-sm",children:"Click + Workspace to get started"})]}):(0,L.jsx)("div",{className:"space-y-6",children:e.map(a=>(0,L.jsxs)("div",{children:[(0,L.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,L.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer hover:text-primary transition-colors",onClick:()=>c(a.id,a.name),children:[(0,L.jsx)("h2",{className:"text-sm font-semibold",children:a.name}),a.project_path&&(0,L.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate max-w-48",children:a.project_path})]}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("button",{onClick:b=>{b.stopPropagation(),B(a),D(a.name),F(a.description),H(a.project_path||"")},className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Edit"}),(0,L.jsx)("button",{onClick:b=>{var c;return c=a.id,void(b.stopPropagation(),z(c))},className:"text-xs text-muted-foreground hover:text-destructive transition-colors",children:"Delete"})]})]}),0===a.subProjects.length?(0,L.jsxs)("div",{className:"text-xs text-muted-foreground py-4 text-center border border-dashed border-border rounded-lg",children:["No projects."," ",(0,L.jsx)("span",{className:"text-primary cursor-pointer hover:underline",onClick:()=>c(a.id,a.name),children:"Open workspace"})," ","to add one."]}):(0,L.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:a.subProjects.map(b=>(0,L.jsx)(ah,{subProject:b,projectName:a.name,onClick:()=>c(a.id,a.name,b.id)},b.id))})]},a.id))}):0===(a=(()=>{let a=[];for(let b of e)for(let c of b.subProjects)"active"===ae?(c.active_count>0||c.problem_count>0)&&a.push({sp:c,projectName:b.name,projectId:b.id}):"all"===ae&&a.push({sp:c,projectName:b.name,projectId:b.id});return a.sort((a,b)=>b.sp.active_count+b.sp.problem_count-(a.sp.active_count+a.sp.problem_count)),a})()).length?(0,L.jsxs)("div",{className:"text-center py-20 text-muted-foreground",children:[(0,L.jsx)("p",{className:"text-lg mb-2",children:"No active tasks"}),(0,L.jsx)("p",{className:"text-sm",children:"Submit tasks to see them here"})]}):(0,L.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:a.map(({sp:a,projectName:b,projectId:d})=>(0,L.jsx)(ah,{subProject:a,projectName:b,onClick:()=>{let f=e.find(a=>a.id===d);c(d,f?.name||b,a.id)}},a.id))})}),w&&(0,L.jsx)(ac,{onSelect:a=>{t(a),x(!1)},onCancel:()=>x(!1)}),Q&&(0,L.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,L.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>R(!1)}),(0,L.jsxs)("div",{className:"relative bg-card border border-border rounded-xl shadow-2xl w-[480px] animate-dialog-in",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold",children:"DB Sync"}),(0,L.jsx)("button",{onClick:()=>R(!1),className:"text-muted-foreground hover:text-foreground text-lg px-1",children:"x"})]}),(0,L.jsxs)("div",{className:"p-5 space-y-4",children:[null===S?(0,L.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading..."}):S.initialized?(0,L.jsxs)("div",{className:"space-y-3",children:[(0,L.jsxs)("div",{className:"text-xs space-y-1",children:[(0,L.jsxs)("p",{children:[(0,L.jsx)("span",{className:"text-muted-foreground",children:"Remote:"})," ",(0,L.jsx)("span",{className:"font-mono",children:S.remoteUrl||"none"})]}),(0,L.jsxs)("p",{children:[(0,L.jsx)("span",{className:"text-muted-foreground",children:"Last sync:"})," ",S.lastCommit||"never"]})]}),(0,L.jsxs)("div",{className:"flex gap-2",children:[(0,L.jsx)("button",{onClick:()=>al("push"),disabled:V,className:"flex-1 px-4 py-2 text-sm bg-primary text-white rounded-lg hover:bg-primary-hover transition-colors disabled:opacity-50",children:V?"...":"Push"}),(0,L.jsx)("button",{onClick:()=>al("pull"),disabled:V,className:"flex-1 px-4 py-2 text-sm bg-muted text-foreground border border-border rounded-lg hover:bg-card-hover transition-colors disabled:opacity-50",children:V?"...":"Pull"})]})]}):(0,L.jsxs)("div",{className:"space-y-3",children:[(0,L.jsx)("p",{className:"text-sm text-muted-foreground",children:"Git 저장소 URL을 입력하세요."}),(0,L.jsx)("input",{value:Z,onChange:a=>$(a.target.value),placeholder:"https://github.com/user/repo.git",className:"w-full bg-input border border-border rounded-lg px-3 py-2 text-sm focus:border-primary focus:outline-none text-foreground"}),(0,L.jsx)("button",{onClick:()=>al("init"),disabled:V||!Z.trim(),className:"w-full px-4 py-2 text-sm bg-primary text-white rounded-lg hover:bg-primary-hover transition-colors disabled:opacity-50",children:V?"Initializing...":"Initialize"})]}),X&&(0,L.jsx)("p",{className:`text-xs ${X.startsWith("Error")?"text-destructive":"text-success"}`,children:X})]})]})]}),A&&(0,L.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,L.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>B(null)}),(0,L.jsxs)("div",{className:"relative bg-card border border-border rounded-xl shadow-2xl w-[480px] animate-dialog-in",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold",children:"Edit Workspace"}),(0,L.jsx)("button",{onClick:()=>B(null),className:"text-muted-foreground hover:text-foreground text-lg px-1",children:"x"})]}),(0,L.jsxs)("div",{className:"p-5 space-y-3",children:[(0,L.jsx)("input",{type:"text",value:C,onChange:a=>D(a.target.value),placeholder:"Workspace name",className:"w-full bg-input border border-border rounded-lg px-4 py-2.5 focus:border-primary focus:outline-none text-foreground",autoFocus:!0}),(0,L.jsx)("input",{type:"text",value:E,onChange:a=>F(a.target.value),placeholder:"Description (optional)",className:"w-full bg-input border border-border rounded-lg px-4 py-2.5 focus:border-primary focus:outline-none text-foreground"}),(0,L.jsx)("button",{type:"button",onClick:()=>J(!0),className:"w-full bg-input border border-border rounded-lg px-4 py-2.5 text-left text-sm hover:border-primary transition-colors",children:G?(0,L.jsx)("span",{className:"font-mono text-foreground",children:G}):(0,L.jsx)("span",{className:"text-muted-foreground",children:"Workspace folder (optional)"})}),G&&(0,L.jsx)("button",{type:"button",onClick:()=>H(""),className:"text-xs text-muted-foreground hover:text-destructive transition-colors",children:"Clear folder link"})]}),(0,L.jsxs)("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[(0,L.jsx)("button",{onClick:()=>B(null),className:"px-4 py-2 text-muted-foreground hover:text-foreground transition-colors text-sm",children:"Cancel"}),(0,L.jsx)("button",{onClick:ao,disabled:!C.trim(),className:"px-4 py-2 bg-primary hover:bg-primary-hover text-white rounded-lg transition-colors text-sm disabled:opacity-50",children:"Save"})]})]})]}),I&&(0,L.jsx)(ac,{onSelect:a=>{H(a),J(!1)},onCancel:()=>J(!1),initialPath:G||void 0}),(0,L.jsx)(ad,{open:!!y,title:"Delete workspace?",description:"This will permanently delete the workspace and all its data.",confirmLabel:"Delete",variant:"danger",onConfirm:an,onCancel:()=>z(null)})]})}function aj({projectId:a,onCollapse:b}){let[c,d]=(0,M.useState)(""),[e,f]=(0,M.useState)(!1),[g,h]=(0,M.useState)(!1),i=(0,M.useRef)(null),j=(0,M.useRef)(null),k=(0,M.useCallback)(async b=>{f(!0),await fetch(`/api/projects/${a}/brainstorm`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:b})}),f(!1)},[a]);return g?(0,L.jsxs)("div",{className:"flex flex-col h-full",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[(0,L.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:"BRAINSTORMING"}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground",children:e?"저장 중...":c?"저장됨":""}),b&&(0,L.jsx)("button",{onClick:b,className:"text-muted-foreground hover:text-foreground transition-colors text-xs px-1",title:"접기 (B)",children:"\xab"})]})]}),(0,L.jsx)("div",{className:"editor-container",children:(0,L.jsx)("textarea",{ref:j,value:c,onChange:a=>{let b=a.target.value;d(b),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{k(b)},1e3)},placeholder:`자유롭게 아이디어를 적어보세요...
|
|
7
3
|
|
|
8
4
|
예시:
|
|
@@ -29,5 +25,9 @@ ${b}
|
|
|
29
25
|
- 코드 제안 시 기존 컨벤션을 따를 것`,className:"w-full bg-input border border-border rounded-lg px-4 py-3 text-sm text-foreground resize-none focus:border-primary focus:outline-none leading-relaxed font-mono min-h-[300px]"})}),(0,L.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground",children:"Cmd+Enter to save"}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("button",{onClick:d,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-md transition-colors",children:"Cancel"}),(0,L.jsx)("button",{onClick:()=>c(e),className:"px-3 py-1.5 text-xs bg-primary text-white rounded-md hover:bg-primary-hover transition-colors",children:"Save"})]})]})]})]}):null}let w7={success:{icon:"✅",color:"text-success"},error:{icon:"❌",color:"text-destructive"},"no-git":{icon:"➖",color:"text-muted-foreground"},"no-path":{icon:"➖",color:"text-muted-foreground"}};function w8({open:a,results:b,onClose:c}){let d=(0,M.useRef)(null);if(!a)return null;let e=b.filter(a=>"success"===a.status).length,f=b.filter(a=>"error"===a.status).length,g=b.filter(a=>"no-git"===a.status||"no-path"===a.status).length;return(0,L.jsx)("div",{ref:d,onClick:a=>{a.target===d.current&&c()},className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)"},children:(0,L.jsxs)("div",{className:"bg-card border border-border rounded-xl shadow-2xl shadow-black/40 w-full max-w-md mx-4 animate-dialog-in",children:[(0,L.jsxs)("div",{className:"p-5 border-b border-border",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Git Sync Results"}),(0,L.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:[e," synced, ",f," failed, ",g," skipped"]})]}),(0,L.jsx)("div",{className:"max-h-64 overflow-y-auto p-3 space-y-1.5",children:0===b.length?(0,L.jsx)("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No projects with linked folders"}):b.map(a=>{let b=w7[a.status];return(0,L.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg bg-muted/50",children:[(0,L.jsx)("span",{className:"text-sm flex-shrink-0",children:b.icon}),(0,L.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,L.jsx)("div",{className:"text-xs font-medium truncate",children:a.projectName}),(0,L.jsx)("div",{className:`text-xs ${b.color} truncate`,title:a.message,children:a.message})]})]},a.projectId)})}),(0,L.jsx)("div",{className:"flex justify-end px-5 pb-4 pt-2",children:(0,L.jsx)("button",{onClick:c,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground bg-muted hover:bg-card-hover border border-border rounded-md transition-colors",children:"Close"})})]})})}let w9={ts:"TS",tsx:"TX",js:"JS",jsx:"JX",json:"{}",md:"MD",css:"CS",scss:"SC",html:"HT",svg:"SV",png:"PN",jpg:"JP",py:"PY",go:"GO",rs:"RS",java:"JA",sql:"SQ",sh:"SH",yml:"YM",yaml:"YM",toml:"TM",xml:"XM",txt:"TX",env:"EN",lock:"LK",gitignore:"GI"};function xa({rootPath:a,onClose:b}){let[c,d]=(0,M.useState)({}),[e,f]=(0,M.useState)(new Set([a])),g=(0,M.useRef)(null),h=(0,M.useCallback)(async a=>{d(b=>({...b,[a]:{entries:[],loaded:!1,loading:!0}}));try{let b=await fetch(`/api/filesystem/tree?path=${encodeURIComponent(a)}`);if(!b.ok)throw Error("Failed to load");let c=await b.json();d(b=>({...b,[a]:{entries:c.entries,loaded:!0,loading:!1}}))}catch{d(b=>({...b,[a]:{entries:[],loaded:!0,loading:!1,error:"Failed to load"}}))}},[]),i=(a,b)=>{let d=c[a];return d?d.loading?(0,L.jsx)("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:16*b+12},children:(0,L.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"Loading..."})}):d.error?(0,L.jsx)("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:16*b+12},children:(0,L.jsx)("span",{className:"text-xs text-destructive",children:d.error})}):0===d.entries.length?(0,L.jsx)("div",{className:"flex items-center gap-2 py-1",style:{paddingLeft:16*b+12},children:(0,L.jsx)("span",{className:"text-xs text-muted-foreground italic",children:"Empty"})}):d.entries.map(a=>{var d,g;let j="directory"===a.type,k=e.has(a.path);return(0,L.jsxs)("div",{children:[(0,L.jsx)("div",{className:`flex items-center gap-1.5 py-[3px] pr-3 cursor-pointer transition-colors hover:bg-card-hover group ${j?"text-foreground":"text-muted-foreground"}`,style:{paddingLeft:16*b+12},onClick:()=>{var b;return j&&(b=a.path,void f(a=>{let d=new Set(a);return d.has(b)?d.delete(b):(d.add(b),c[b]?.loaded||c[b]?.loading||h(b)),d}))},children:j?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:"w-4 text-center text-xs text-muted-foreground flex-shrink-0",children:k?"▼":"▶"}),(0,L.jsx)("span",{className:"text-sm flex-shrink-0",children:k?"\uD83D\uDCC2":"\uD83D\uDCC1"}),(0,L.jsx)("span",{className:"text-sm truncate flex-1 font-medium",children:a.name})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:"w-4 flex-shrink-0"}),(0,L.jsx)("span",{className:"text-[10px] font-mono w-5 text-center flex-shrink-0 text-muted-foreground/70",children:(d=a.extension)?w9[d]||d.slice(0,2).toUpperCase():"--"}),(0,L.jsx)("span",{className:"text-sm truncate flex-1",children:a.name}),void 0!==a.size&&(0,L.jsx)("span",{className:"text-[10px] text-muted-foreground/50 tabular-nums flex-shrink-0",children:(g=a.size)<1024?`${g}B`:g<1048576?`${(g/1024).toFixed(0)}K`:`${(g/1048576).toFixed(1)}M`})]})}),j&&k&&i(a.path,b+1)]},a.path)}):null},j=a.split("/").pop()||a;return(0,L.jsxs)("div",{ref:g,className:"fixed inset-0 z-50 flex justify-end",onClick:a=>{a.target===g.current&&b()},children:[(0,L.jsx)("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]"}),(0,L.jsxs)("div",{className:"relative w-[420px] max-w-[85vw] h-full bg-card border-l border-border shadow-2xl flex flex-col animate-drawer-in",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[(0,L.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,L.jsx)("span",{className:"text-base",children:"\uD83D\uDCC2"}),(0,L.jsxs)("div",{className:"min-w-0",children:[(0,L.jsx)("h2",{className:"text-sm font-semibold truncate",children:j}),(0,L.jsx)("p",{className:"text-[10px] text-muted-foreground font-mono truncate",children:a})]})]}),(0,L.jsx)("button",{onClick:b,className:"text-muted-foreground hover:text-foreground transition-colors text-lg px-1",title:"Close (ESC)",children:"\xd7"})]}),(0,L.jsx)("div",{className:"flex-1 overflow-y-auto py-2",children:i(a,0)}),(0,L.jsx)("div",{className:"px-4 py-2 border-t border-border flex-shrink-0",children:(0,L.jsx)("p",{className:"text-[10px] text-muted-foreground",children:"ESC to close"})})]})]})}function xb({open:a,projectId:b,onClose:c,onApplied:d}){let[e,f]=(0,M.useState)(!1),[g,h]=(0,M.useState)(!1),[i,j]=(0,M.useState)(null),[k,l]=(0,M.useState)([]),[m,n]=(0,M.useState)(new Set),o=async()=>{f(!0),j(null);try{let a=await fetch(`/api/projects/${b}/auto-distribute`,{method:"POST"}),c=await a.json();if(!a.ok){let a=c.raw?`
|
|
30
26
|
|
|
31
27
|
AI 응답:
|
|
32
|
-
${c.raw}`:"";j((c.error||"Failed to get distribution")+a);return}l(c.distributions||[])}catch{j("AI 호출에 실패했습니다.")}finally{f(!1)}},p=async()=>{let a=k.filter(a=>a.tasks.length>0);if(0!==a.length){h(!0);try{let e=await fetch(`/api/projects/${b}/apply-distribute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({distributions:a})});if(e.ok)d(),c();else{let a=await e.json();j(a.error||"Failed to apply")}}catch{j("적용에 실패했습니다.")}finally{h(!1)}}},q=k.reduce((a,b)=>a+b.tasks.length,0);return a?(0,L.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,L.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:c}),(0,L.jsxs)("div",{className:"relative bg-card border border-border rounded-xl shadow-2xl w-[720px] max-h-[85vh] flex flex-col animate-dialog-in",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("h3",{className:"text-sm font-semibold",children:"Auto Distribute"}),(0,L.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"AI가 브레인스토밍을 분석하여 태스크를 분배합니다"})]}),(0,L.jsx)("button",{onClick:c,className:"text-muted-foreground hover:text-foreground text-lg px-1",children:"x"})]}),(0,L.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[e&&(0,L.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[(0,L.jsx)("div",{className:"w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin"}),(0,L.jsx)("p",{className:"text-sm text-muted-foreground",children:"AI가 분석 중..."})]}),i&&(0,L.jsxs)("div",{className:"bg-danger/10 border border-danger/30 rounded-lg p-3 mb-3",children:[(0,L.jsx)("pre",{className:"text-xs text-danger whitespace-pre-wrap break-all max-h-[200px] overflow-y-auto",children:i}),(0,L.jsx)("button",{onClick:o,className:"text-xs text-accent hover:underline mt-1",children:"다시 시도"})]}),!e&&k.length>0&&(0,L.jsx)("div",{className:"space-y-3",children:k.map((a,b)=>(0,L.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,L.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/50",children:[(0,L.jsx)("button",{onClick:()=>{n(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"text-xs text-muted-foreground hover:text-foreground w-4",children:m.has(b)?"▶":"▼"}),(0,L.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${a.is_new?"bg-success/15 text-success":"bg-accent/15 text-accent"}`,children:a.is_new?"NEW":"EXISTING"}),(0,L.jsx)("input",{value:a.sub_project_name,onChange:a=>{var c;return c=a.target.value,void l(a=>a.map((a,d)=>d===b?{...a,sub_project_name:c}:a))},className:"flex-1 bg-transparent text-sm font-medium text-foreground focus:outline-none border-b border-transparent focus:border-primary"}),(0,L.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:a.tasks.length}),(0,L.jsx)("button",{onClick:()=>{l(a=>a.filter((a,c)=>c!==b))},className:"text-xs text-muted-foreground hover:text-danger px-1",title:"Remove group",children:"x"})]}),!m.has(b)&&(0,L.jsxs)("div",{className:"divide-y divide-border",children:[a.tasks.map((a,c)=>{var d;return(0,L.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 group hover:bg-muted/30",children:[(d=a.priority,(0,L.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${{high:"bg-danger",medium:"bg-warning",low:"bg-muted-foreground/40"}[d]}`})),(0,L.jsx)("input",{value:a.title,onChange:a=>{var d;return d=a.target.value,void l(a=>a.map((a,e)=>e===b?{...a,tasks:a.tasks.map((a,b)=>b===c?{...a,title:d}:a)}:a))},className:"flex-1 bg-transparent text-xs text-foreground focus:outline-none border-b border-transparent focus:border-primary"}),(0,L.jsxs)("select",{value:a.priority,onChange:a=>{var d;return d=a.target.value,void l(a=>a.map((a,e)=>e===b?{...a,tasks:a.tasks.map((a,b)=>b===c?{...a,priority:d}:a)}:a))},className:"text-[10px] bg-transparent text-muted-foreground cursor-pointer hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,L.jsx)("option",{value:"high",children:"high"}),(0,L.jsx)("option",{value:"medium",children:"medium"}),(0,L.jsx)("option",{value:"low",children:"low"})]}),k.length>1&&(0,L.jsxs)("select",{value:"",onChange:a=>{let d=parseInt(a.target.value);isNaN(d)||l(a=>{let e=a[b].tasks[c];return a.map((a,f)=>f===b?{...a,tasks:a.tasks.filter((a,b)=>b!==c)}:f===d?{...a,tasks:[...a.tasks,e]}:a)})},className:"text-[10px] bg-transparent text-muted-foreground cursor-pointer hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",title:"Move to...",children:[(0,L.jsx)("option",{value:"",children:"Move"}),k.map((a,c)=>c!==b&&(0,L.jsx)("option",{value:c,children:a.sub_project_name},c))]}),(0,L.jsx)("button",{onClick:()=>{l(a=>a.map((a,d)=>d===b?{...a,tasks:a.tasks.filter((a,b)=>b!==c)}:a))},className:"text-xs text-muted-foreground hover:text-danger opacity-0 group-hover:opacity-100 transition-opacity px-0.5",children:"x"})]},c)}),0===a.tasks.length&&(0,L.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:"No tasks (this group will be skipped)"})]})]},b))}),!e&&!i&&0===k.length&&(0,L.jsx)("div",{className:"text-center py-16 text-sm text-muted-foreground",children:"No distribution available"})]}),(0,L.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground",children:k.length>0&&`${k.length} projects, ${q} tasks`}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[!e&&k.length>0&&(0,L.jsx)("button",{onClick:o,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-md transition-colors",children:"Retry"}),(0,L.jsx)("button",{onClick:c,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-md transition-colors",children:"Cancel"}),(0,L.jsx)("button",{onClick:p,disabled:g||e||0===q,className:"px-4 py-1.5 text-xs bg-primary text-white rounded-md hover:bg-primary-hover transition-colors disabled:opacity-50",children:g?"Applying...":`Apply (${q})`})]})]})]})]}):null}function xc({id:a,initialSubId:b,initialTaskId:c}){let{state:d,setActiveTab:e,consumeInitial:f,updateTabName:g}=U();d.activeTabId,(0,M.useRef)(b),(0,M.useRef)(c);let[h,i]=(0,M.useState)(null),[j,k]=(0,M.useState)([]),[l,m]=(0,M.useState)(null),[n,o]=(0,M.useState)([]),[p,q]=(0,M.useState)(null),[r,s]=(0,M.useState)(!1),[t,u]=(0,M.useState)(null),[v,w]=(0,M.useState)(!1),[x,y]=(0,M.useState)(!0),[z,A]=(0,M.useState)(""),[B,C]=(0,M.useState)(!1),[D,E]=(0,M.useState)(!1),[F,G]=(0,M.useState)(null),[H,I]=(0,M.useState)(null),[J,K]=(0,M.useState)(!1),[N,O]=(0,M.useState)(!1),[P,Q]=(0,M.useState)({}),R=(0,M.useRef)(!1),[S,T]=(0,M.useState)(500),[V,W]=(0,M.useState)(500),X=(0,M.useRef)(null),Y=(0,M.useRef)(null),Z=(0,M.useRef)(0),$=(0,M.useRef)(0),_=(0,M.useCallback)((a,b)=>{b.preventDefault(),Y.current=a,Z.current=b.clientX,$.current="left"===a?S:V},[S,V]),aa=(0,M.useCallback)(async()=>{let b=await fetch(`/api/projects/${a}/sub-projects`);if(!b.ok)return;let c=await b.json();return k(c),c},[a]),ab=n.find(a=>a.id===p)??null,ae=async()=>{if(!z.trim())return;let b=await fetch(`/api/projects/${a}/sub-projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.trim()})});if(b.ok){let a=await b.json();A(""),w(!1),await aa(),m(a.id)}},af=async b=>{if(!l)return;let c=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:b})});if(c.ok){let a=await c.json();o(b=>[...b,a]),q(a.id),aa()}},ag=async(b,c)=>{let d=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:c})});if(d.ok){let a=await d.json();o(c=>c.map(c=>c.id===b?a:c)),aa()}},ah=async(b,c)=>{let d=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({is_today:c})});if(d.ok){let a=await d.json();o(c=>c.map(c=>c.id===b?a:c))}},ai=async b=>{if(!p||!l)return;let c=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${p}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(c.ok){let a=await c.json();o(b=>b.map(b=>b.id===p?a:b)),aa()}},ak=async b=>{k(a=>{let c=new Map(a.map(a=>[a.id,a]));return b.map(a=>c.get(a)).filter(Boolean)}),await fetch(`/api/projects/${a}/sub-projects`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:b})})},al=a=>{let b=a||p;b&&u({type:"delete-task",id:b})},am=async b=>{t&&("delete-sub"===t.type?(await fetch(`/api/projects/${a}/sub-projects/${t.id}`,{method:"DELETE"}),l===t.id&&(m(null),q(null)),aa()):"delete-task"===t.type&&(await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${t.id}?mode=${b||"archive"}`,{method:"DELETE"}),o(a=>a.filter(a=>a.id!==t.id)),p===t.id&&q(null),aa()),u(null))},an=async b=>{let c=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_path:b})});c.ok&&(i(await c.json()),s(!1))},ao=async b=>{let c=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({ai_context:b})});c.ok&&(i(await c.json()),C(!1))},ap=(0,M.useCallback)(async(b=!1)=>{if(!R.current){R.current=!0,b||E(!0);try{let c=await fetch(`/api/projects/${a}/git-sync`,{method:"POST"});if(c.ok){let a=await c.json();I(new Date),b||G(a)}}catch{}finally{R.current=!1,b||E(!1)}}},[a]),aq=async()=>{if(!h)return;let b=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({watch_enabled:!h.watch_enabled})});b.ok&&i(await b.json())};return h?(0,L.jsxs)("div",{className:"flex flex-col h-full",children:[(0,L.jsxs)("header",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card flex-shrink-0",children:[(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[(0,L.jsx)("button",{onClick:()=>e("dashboard"),className:"text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-sm px-2 py-1 rounded-md",children:"← Back"}),(0,L.jsx)("span",{className:"text-border",children:"|"}),(0,L.jsx)("h1",{className:"text-sm font-semibold",children:h.name}),h.project_path&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate max-w-48",title:h.project_path,children:h.project_path}),(0,L.jsx)("button",{onClick:()=>K(!0),className:"text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors px-1.5 py-0.5 rounded",title:"View file tree",children:"\uD83D\uDCC2"})]})]}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsxs)("select",{value:h.agent_type||"claude",onChange:async b=>{let c=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_type:b.target.value})});c.ok&&i(await c.json())},className:"px-2 py-1.5 text-xs bg-muted border border-border rounded-md text-foreground cursor-pointer hover:bg-card-hover transition-colors",title:"AI Agent",children:[(0,L.jsx)("option",{value:"claude",children:"Claude"}),(0,L.jsx)("option",{value:"gemini",children:"Gemini"}),(0,L.jsx)("option",{value:"codex",children:"Codex"})]}),(0,L.jsxs)("button",{onClick:aq,className:`px-3 py-1.5 text-xs border rounded-md transition-colors flex items-center gap-1.5 ${h.watch_enabled?"bg-success/15 text-success border-success/30 hover:bg-success/25":"bg-muted hover:bg-card-hover text-muted-foreground border-border"}`,title:h.watch_enabled?"Watch ON":"Watch OFF",children:[(0,L.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${h.watch_enabled?"bg-success animate-pulse":"bg-muted-foreground/40"}`}),"Watch"]}),(0,L.jsxs)("button",{onClick:()=>C(!0),className:`px-3 py-1.5 text-xs border rounded-md transition-colors ${h.ai_context?"bg-accent/15 text-accent border-accent/30 hover:bg-accent/25":"bg-muted hover:bg-card-hover text-muted-foreground border-border"}`,children:["AI Policy",h.ai_context?" *":""]}),h.project_path?(0,L.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,L.jsxs)("button",{onClick:()=>ap(!1),disabled:D,className:"px-3 py-1.5 text-xs bg-muted hover:bg-card-hover text-foreground border border-border rounded-md transition-colors disabled:opacity-50 flex items-center gap-1.5",title:H?`Last sync: ${H.toLocaleTimeString()}`:"Git pull",children:[(0,L.jsx)("span",{className:D?"animate-spin":"",children:"↻"}),D?"Syncing...":"Git Sync"]}),H&&(0,L.jsx)("span",{className:"text-xs text-muted-foreground",children:H.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}):(0,L.jsx)("button",{onClick:()=>s(!0),className:"px-3 py-1.5 text-xs bg-muted hover:bg-card-hover text-foreground border border-border rounded-md transition-colors",children:"Link folder"})]})]}),(0,L.jsxs)("div",{ref:X,className:"flex-1 flex overflow-hidden",children:[x?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{style:{width:S},className:"border-r border-border flex flex-col flex-shrink-0",children:(0,L.jsx)(aj,{projectId:a,onCollapse:()=>y(!1)})}),(0,L.jsx)("div",{className:"panel-resize-handle",onMouseDown:a=>_("left",a),children:(0,L.jsx)("div",{className:"panel-resize-handle-bar"})})]}):(0,L.jsx)("button",{onClick:()=>y(!0),className:"w-8 border-r border-border flex-shrink-0 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-card-hover transition-colors text-xs",title:"Show brainstorming (B)",style:{writingMode:"vertical-rl"},children:"Brainstorm"}),(0,L.jsxs)("div",{style:{width:V},className:"border-r border-border flex flex-col flex-shrink-0",children:[v&&(0,L.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,L.jsx)("input",{type:"text",value:z,onChange:a=>A(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ae(),"Escape"===a.key&&(A(""),w(!1))},placeholder:"Project name...",className:"w-full bg-input border border-border rounded px-2 py-1 text-xs focus:border-primary focus:outline-none text-foreground",autoFocus:!0})}),(0,L.jsx)(cg,{subProjects:j,tasks:n,selectedSubId:l,selectedTaskId:p,onSelectSub:a=>{m(a),q(null)},onSelectTask:a=>{q(a),Q(b=>{if("done"!==b[a])return b;let c={...b};return delete c[a],c})},onCreateSub:()=>w(!0),onDeleteSub:a=>{u({type:"delete-sub",id:a})},onRenameSub:async(b,c)=>{(await fetch(`/api/projects/${a}/sub-projects/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c})})).ok&&aa()},onCreateTask:af,onStatusChange:ag,onTodayToggle:ah,onDeleteTask:al,onReorderSubs:ak,onAutoDistribute:()=>O(!0),chatStates:P})]}),(0,L.jsx)("div",{className:"panel-resize-handle",onMouseDown:a=>_("center",a),children:(0,L.jsx)("div",{className:"panel-resize-handle-bar"})}),(0,L.jsx)("div",{className:"flex-1 min-w-0",children:ab?(0,L.jsx)(w5,{task:ab,projectId:a,subProjectId:l,siblingTasks:n,onUpdate:ai,onDelete:al,onTaskPromoted:a=>o(b=>[...b,a]),onChatStateChange:(a,b)=>{Q(c=>({...c,[a]:b}))}}):(0,L.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:n.length>0?"Select a task":l?"Create a task to get started":"Select a project"})})]}),r&&(0,L.jsx)(ac,{onSelect:an,onCancel:()=>s(!1),initialPath:h.project_path||void 0}),(0,L.jsx)(ad,{open:t?.type==="delete-sub",title:"Delete project?",description:"This will delete the project and all its tasks.",confirmLabel:"Delete",variant:"danger",onConfirm:()=>am(),onCancel:()=>u(null)}),t?.type==="delete-task"&&(0,L.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)"},children:(0,L.jsxs)("div",{className:"bg-card border border-border rounded-xl shadow-2xl shadow-black/40 w-full max-w-sm mx-4 animate-dialog-in",children:[(0,L.jsxs)("div",{className:"p-5",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Remove task"}),(0,L.jsx)("p",{className:"text-xs text-muted-foreground mt-1.5 leading-relaxed",children:"보관함에 넣으면 나중에 복원하거나 프롬프트를 참고할 수 있습니다."})]}),(0,L.jsxs)("div",{className:"flex justify-end gap-2 px-5 pb-4",children:[(0,L.jsx)("button",{onClick:()=>u(null),className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground bg-muted hover:bg-card-hover border border-border rounded-md transition-colors",children:"Cancel"}),(0,L.jsx)("button",{onClick:()=>am("permanent"),className:"px-3 py-1.5 text-xs text-white bg-destructive hover:bg-destructive/80 rounded-md transition-colors",children:"Delete"}),(0,L.jsx)("button",{onClick:()=>am("archive"),className:"px-3 py-1.5 text-xs text-white bg-primary hover:bg-primary-hover rounded-md transition-colors",children:"Archive"})]})]})}),(0,L.jsx)(w6,{open:B,content:h.ai_context||"",onSave:ao,onClose:()=>C(!1)}),(0,L.jsx)(w8,{open:!!F,results:F||[],onClose:()=>G(null)}),J&&h.project_path&&(0,L.jsx)(xa,{rootPath:h.project_path,onClose:()=>K(!1)}),(0,L.jsx)(xb,{open:N,projectId:a,onClose:()=>O(!1),onApplied:()=>{aa()}})]}):(0,L.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Loading..."})}function xd(){let[a,b]=(0,M.useState)(!1),[c,d]=(0,M.useState)(""),[e,f]=(0,M.useState)([]),[g,h]=(0,M.useState)(0),[i,j]=(0,M.useState)(!1),k=(0,M.useRef)(null),{openProject:l}=U();(0,M.useRef)(null);let m=(0,M.useCallback)(a=>{l(a.projectId,a.projectName,a.subProjectId,a.taskId),b(!1)},[l]);return a?(0,L.jsx)("div",{onClick:()=>b(!1),className:"fixed inset-0 z-[60] flex items-start justify-center pt-[14vh]",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(3px)"},children:(0,L.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-xl animate-dialog-in",children:[(0,L.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-muted-foreground",children:"\uD83D\uDD0E"}),(0,L.jsx)("input",{ref:k,value:c,onChange:a=>d(a.target.value),onKeyDown:a=>{if("Escape"===a.key)return void b(!1);if("ArrowDown"===a.key){a.preventDefault(),h(a=>Math.min(a+1,e.length-1));return}if("ArrowUp"===a.key){a.preventDefault(),h(a=>Math.max(a-1,0));return}if("Enter"===a.key){a.preventDefault();let b=e[g];b&&m(b)}},placeholder:"태스크 \xb7 프로젝트 \xb7 워크스페이스 검색… (⌘P)",className:"flex-1 bg-transparent text-sm text-foreground focus:outline-none"}),(0,L.jsx)("span",{className:"text-[10px] text-muted-foreground/70 px-1.5 py-0.5 border border-border rounded",children:"↑↓ \xb7 ↵ \xb7 Esc"})]}),(0,L.jsxs)("div",{className:"max-h-[55vh] overflow-y-auto",children:[i&&(0,L.jsx)("div",{className:"px-4 py-6 text-xs text-muted-foreground",children:"검색 중…"}),!i&&c.trim()&&0===e.length&&(0,L.jsx)("div",{className:"px-4 py-6 text-xs text-muted-foreground",children:"일치하는 항목 없음"}),!i&&!c.trim()&&(0,L.jsx)("div",{className:"px-4 py-6 text-xs text-muted-foreground",children:"무엇을 찾으시나요? 태스크 제목\xb7본문, 프로젝트\xb7워크스페이스 이름을 검색합니다."}),(0,L.jsx)("ul",{children:e.map((a,b)=>(0,L.jsxs)("li",{onMouseEnter:()=>h(b),onClick:()=>m(a),className:`px-4 py-2.5 cursor-pointer border-l-2 ${b===g?"bg-muted border-primary":"border-transparent"}`,children:[(0,L.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,L.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wide ${"task"===a.type?"bg-primary/15 text-primary":"project"===a.type?"bg-accent/15 text-accent":"bg-warning/15 text-warning"}`,children:"sub-project"===a.type?"project":a.type}),(0,L.jsx)("span",{children:a.projectName}),a.subProjectName&&"task"===a.type&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:"opacity-50",children:"›"}),(0,L.jsx)("span",{children:a.subProjectName})]}),a.isArchived&&(0,L.jsx)("span",{className:"text-muted-foreground/70 italic",children:"(archived)"})]}),(0,L.jsx)("div",{className:"text-sm text-foreground mt-0.5 truncate",children:a.title}),a.snippet&&(0,L.jsx)("div",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate",children:a.snippet})]},`${a.type}-${a.taskId??a.subProjectId??a.projectId}`))})]})]})}):null}function xe(){let[a,b]=(0,M.useState)(!1),[c,d]=(0,M.useState)([]),[e,f]=(0,M.useState)(""),[g,h]=(0,M.useState)(""),[i,j]=(0,M.useState)(""),[k,l]=(0,M.useState)(!1),[m,n]=(0,M.useState)(null),o=(0,M.useRef)(null),{openProject:p}=U(),q=async()=>{let a=i.trim();if(a&&e&&g&&!k){l(!0),n(null);try{let d=await fetch(`/api/projects/${e}/sub-projects/${g}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a})});if(!d.ok)throw Error(`HTTP ${d.status}`);let f=await d.json();try{localStorage.setItem("im-quick-capture-last-dest",JSON.stringify({projectId:e,subProjectId:g}))}catch{}let h=c.find(a=>a.id===e);h&&p(h.id,h.name,g,f.id),b(!1)}catch(a){n(a instanceof Error?a.message:"생성 실패"),l(!1)}}};if(!a)return null;let r=c.find(a=>a.id===e),s=r?.subProjects??[];return(0,L.jsx)("div",{onClick:()=>b(!1),className:"fixed inset-0 z-[60] flex items-start justify-center pt-[16vh]",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(3px)"},children:(0,L.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-md animate-dialog-in p-4 flex flex-col gap-3",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"빠른 태스크 캡처"}),(0,L.jsx)("span",{className:"text-[10px] text-muted-foreground/70 px-1.5 py-0.5 border border-border rounded",children:"⌘N \xb7 Esc"})]}),(0,L.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,L.jsx)("select",{value:e,onChange:a=>f(a.target.value),className:"bg-input border border-border rounded-md px-2 py-1.5 text-sm text-foreground focus:border-primary focus:outline-none",children:c.map(a=>(0,L.jsx)("option",{value:a.id,children:a.name},a.id))}),(0,L.jsx)("select",{value:g,onChange:a=>h(a.target.value),disabled:!s.length,className:"bg-input border border-border rounded-md px-2 py-1.5 text-sm text-foreground focus:border-primary focus:outline-none disabled:opacity-50",children:0===s.length?(0,L.jsx)("option",{value:"",children:"프로젝트 없음"}):s.map(a=>(0,L.jsx)("option",{value:a.id,children:a.name},a.id))})]}),(0,L.jsx)("input",{ref:o,value:i,onChange:a=>j(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),q()),"Escape"===a.key&&(a.preventDefault(),b(!1))},placeholder:"태스크 제목을 입력하고 Enter…",className:"w-full bg-input border border-border rounded-md px-3 py-2 text-sm text-foreground focus:border-primary focus:outline-none"}),m&&(0,L.jsxs)("div",{className:"text-xs text-destructive",children:["⚠ ",m]}),(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsx)("div",{className:"text-[10px] text-muted-foreground/70",children:"저장 후 해당 태스크 워크스페이스로 바로 이동"}),(0,L.jsxs)("div",{className:"flex gap-2",children:[(0,L.jsx)("button",{onClick:()=>b(!1),className:"text-xs text-muted-foreground px-2 py-1",children:"취소"}),(0,L.jsx)("button",{onClick:q,disabled:!i.trim()||!e||!g||k,className:"text-xs px-3 py-1 bg-primary text-primary-foreground rounded disabled:opacity-40",children:k?"…":"생성"})]})]})]})})}function xf(){let{state:a}=U();return(0,L.jsxs)("div",{className:"h-screen flex flex-col",children:[(0,L.jsx)(ab,{}),(0,L.jsx)(xd,{}),(0,L.jsx)(xe,{}),(0,L.jsx)("div",{className:"flex-1 min-h-0 relative",children:a.tabs.map(b=>(0,L.jsx)("div",{className:"absolute inset-0 flex flex-col",style:{display:b.id===a.activeTabId?"flex":"none"},children:"dashboard"===b.type?(0,L.jsx)(ai,{}):(0,L.jsx)(xc,{id:b.projectId,initialSubId:b.initialSubId,initialTaskId:b.initialTaskId})},b.id))})]})}function xg(){return(0,L.jsx)(Z,{children:(0,L.jsx)(V,{children:(0,L.jsx)(xf,{})})})}},8301:(a,b,c)=>{Promise.resolve().then(c.bind(c,4494))},8335:()=>{},8354:a=>{"use strict";a.exports=require("util")},8620:a=>{function b(){return a.exports=b=Object.assign?Object.assign.bind():function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)({}).hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},a.exports.__esModule=!0,a.exports.default=a.exports,b.apply(null,arguments)}a.exports=b,a.exports.__esModule=!0,a.exports.default=a.exports},9121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},9294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},9889:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>D.a,__next_app__:()=>L,handler:()=>N,routeModule:()=>M});var d=c(7553),e=c(4006),f=c(7798),g=c(4775),h=c(9373),i=c(3461),j=c(1020),k=c(6349),l=c(4365),m=c(6023),n=c(3747),o=c(4235),p=c(3938),q=c(261),r=c(6758),s=c(7243),t=c(6713),u=c(7527),v=c(2820),w=c(8216),x=c(7929),y=c(9551),z=c(9125),A=c(6439),B=c(7068),C=c(5547),D=c.n(C),E=c(1287),F=c(1494),G=c(722),H=c(753),I=c(3954),J={};for(let a in E)0>["default","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(J[a]=()=>E[a]);c.d(b,J);let K=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,4494)),"/Users/young/Toy/idea-manager/src/app/page.tsx"]}]},{layout:[()=>Promise.resolve().then(c.bind(c,6537)),"/Users/young/Toy/idea-manager/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,5547,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,5091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,5270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,8193,23)),"next/dist/client/components/builtin/unauthorized.js"]}],L={require:c,loadChunk:()=>Promise.resolve()},M=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:K},distDir:".next",relativeProjectDir:""});async function N(a,b,d){var C;M.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let J=!!(0,h.getRequestMeta)(a,"minimalMode"),O="/page";"/index"===O&&(O="/");let P=await M.prepare(a,b,{srcPage:O,multiZoneDraftMode:!1});if(!P)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Q,query:R,params:S,pageIsDynamic:T,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,serverActionsManifest:X,clientReferenceManifest:Y,subresourceIntegrityManifest:Z,prerenderManifest:$,isDraftMode:_,resolvedPathname:aa,revalidateOnlyGenerated:ab,routerServerContext:ac,nextConfig:ad,parsedUrl:ae,interceptionRoutePatterns:af,deploymentId:ag}=P,ah=(0,q.normalizeAppPath)(O),{isOnDemandRevalidate:ai}=P,aj=ad.experimental.ppr&&!ad.cacheComponents&&(0,I.isInterceptionRouteAppPath)(aa)?null:M.match(aa,$),ak=!!$.routes[aa],al=a.headers["user-agent"]||"",am=(0,t.getBotType)(al),an=(0,p.isHtmlBotRequest)(a),ao=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[s.NEXT_ROUTER_PREFETCH_HEADER],ap=(0,h.getRequestMeta)(a,"isRSCRequest")??!!a.headers[s.RSC_HEADER],aq=(0,r.getIsPossibleServerAction)(a),ar=(0,m.checkIsAppPPREnabled)(ad.experimental.ppr);if(!(0,h.getRequestMeta)(a,"postponed")&&ar&&"1"===a.headers[x.NEXT_RESUME_HEADER]&&"POST"===a.method){let b=[];for await(let c of a)b.push(c);let c=Buffer.concat(b).toString("utf8");(0,h.addRequestMeta)(a,"postponed",c)}let as=ar&&(null==(C=$.routes[ah]??$.dynamicRoutes[ah])?void 0:C.renderingMode)==="PARTIALLY_STATIC",at=!1,au=!1,av=as?(0,h.getRequestMeta)(a,"postponed"):void 0,aw=as&&ap&&!ao;J&&(aw=aw&&!!av);let ax=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ay=(!an||!as)&&(!al||(0,p.shouldServeStreamingMetadata)(al,ad.htmlLimitedBots)),az=!!((aj||ak||$.routes[ah])&&!(an&&as)),aA=as&&!0===ad.cacheComponents,aB=!0===M.isDev||!az||"string"==typeof av||(aA&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aw&&!J:aw),aC=an&&as,aD=null;_||!az||aB||aq||av||aw||(aD=aa);let aE=aD;!aE&&M.isDev&&(aE=aa),M.isDev||_||!az||!ap||aw||(0,k.d)(a.headers);let aF={...E,tree:K,GlobalError:D(),handler:N,routeModule:M,__next_app__:L};X&&Y&&(0,o.setManifestsSingleton)({page:O,clientReferenceManifest:Y,serverActionsManifest:X});let aG=a.method||"GET",aH=(0,g.getTracer)(),aI=aH.getActiveScopeSpan(),aJ=async()=>((null==ac?void 0:ac.render404)?await ac.render404(a,b,ae,!1):b.end("This page could not be found"),null);try{let f=M.getVaryHeader(aa,af);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return M.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aH.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aG} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aG} ${O}`)})},m=(0,h.getRequestMeta)(a,"incrementalCache"),o=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let l={query:R,params:S,page:ah,sharedContext:{buildId:Q},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aF,Component:(0,j.T)(aF),params:S,routeModule:M,page:O,postponed:f,shouldWaitOnAllReady:aC,serveStreamingMetadata:ay,supportsDynamicResponse:"string"==typeof f||aB,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,subresourceIntegrityManifest:Z,setCacheStatus:null==ac?void 0:ac.setCacheStatus,setIsrStatus:null==ac?void 0:ac.setIsrStatus,setReactDebugChannel:null==ac?void 0:ac.setReactDebugChannel,sendErrorsToBrowser:null==ac?void 0:ac.sendErrorsToBrowser,dir:c(3873).join(process.cwd(),M.relativeProjectDir),isDraftMode:_,botType:am,isOnDemandRevalidate:ai,isPossibleServerAction:aq,assetPrefix:ad.assetPrefix,nextConfigOutput:ad.output,crossOrigin:ad.crossOrigin,trailingSlash:ad.trailingSlash,images:ad.images,previewProps:$.preview,deploymentId:ag,enableTainting:ad.experimental.taint,htmlLimitedBots:ad.htmlLimitedBots,reactMaxHeadersLength:ad.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:m,cacheLifeProfiles:ad.cacheLife,basePath:ad.basePath,serverActions:ad.experimental.serverActions,...at||au?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:at}:{},cacheComponents:!!ad.cacheComponents,experimental:{isRoutePPREnabled:as,expireTime:ad.expireTime,staleTimes:ad.experimental.staleTimes,dynamicOnHover:!!ad.experimental.dynamicOnHover,inlineCss:!!ad.experimental.inlineCss,authInterrupts:!!ad.experimental.authInterrupts,clientTraceMetadata:ad.experimental.clientTraceMetadata||[],clientParamParsingOrigins:ad.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,B.parseMaxPostponedStateSize)(ad.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>M.onRequestError(a,b,d,e,ac),err:(0,h.getRequestMeta)(a,"invokeError"),dev:M.isDev}};at&&(l.renderOpts.nextExport=!0,l.renderOpts.supportsDynamicResponse=!1,l.renderOpts.isDebugDynamicAccesses=at),i&&(l.renderOpts.supportsDynamicResponse=!1);let n=await k(e,l),{metadata:o}=n,{cacheControl:p,headers:q={},fetchTags:r,fetchMetrics:s}=o;if(r&&(q[x.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,az&&(null==p?void 0:p.revalidate)===0&&!M.isDev&&!as){let a=o.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${aa}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
|
|
28
|
+
${c.raw}`:"";j((c.error||"Failed to get distribution")+a);return}l(c.distributions||[])}catch{j("AI 호출에 실패했습니다.")}finally{f(!1)}},p=async()=>{let a=k.filter(a=>a.tasks.length>0);if(0!==a.length){h(!0);try{let e=await fetch(`/api/projects/${b}/apply-distribute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({distributions:a})});if(e.ok)d(),c();else{let a=await e.json();j(a.error||"Failed to apply")}}catch{j("적용에 실패했습니다.")}finally{h(!1)}}},q=k.reduce((a,b)=>a+b.tasks.length,0);return a?(0,L.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,L.jsx)("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:c}),(0,L.jsxs)("div",{className:"relative bg-card border border-border rounded-xl shadow-2xl w-[720px] max-h-[85vh] flex flex-col animate-dialog-in",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[(0,L.jsxs)("div",{children:[(0,L.jsx)("h3",{className:"text-sm font-semibold",children:"Auto Distribute"}),(0,L.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"AI가 브레인스토밍을 분석하여 태스크를 분배합니다"})]}),(0,L.jsx)("button",{onClick:c,className:"text-muted-foreground hover:text-foreground text-lg px-1",children:"x"})]}),(0,L.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[e&&(0,L.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-3",children:[(0,L.jsx)("div",{className:"w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin"}),(0,L.jsx)("p",{className:"text-sm text-muted-foreground",children:"AI가 분석 중..."})]}),i&&(0,L.jsxs)("div",{className:"bg-danger/10 border border-danger/30 rounded-lg p-3 mb-3",children:[(0,L.jsx)("pre",{className:"text-xs text-danger whitespace-pre-wrap break-all max-h-[200px] overflow-y-auto",children:i}),(0,L.jsx)("button",{onClick:o,className:"text-xs text-accent hover:underline mt-1",children:"다시 시도"})]}),!e&&k.length>0&&(0,L.jsx)("div",{className:"space-y-3",children:k.map((a,b)=>(0,L.jsxs)("div",{className:"border border-border rounded-lg overflow-hidden",children:[(0,L.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/50",children:[(0,L.jsx)("button",{onClick:()=>{n(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},className:"text-xs text-muted-foreground hover:text-foreground w-4",children:m.has(b)?"▶":"▼"}),(0,L.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${a.is_new?"bg-success/15 text-success":"bg-accent/15 text-accent"}`,children:a.is_new?"NEW":"EXISTING"}),(0,L.jsx)("input",{value:a.sub_project_name,onChange:a=>{var c;return c=a.target.value,void l(a=>a.map((a,d)=>d===b?{...a,sub_project_name:c}:a))},className:"flex-1 bg-transparent text-sm font-medium text-foreground focus:outline-none border-b border-transparent focus:border-primary"}),(0,L.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:a.tasks.length}),(0,L.jsx)("button",{onClick:()=>{l(a=>a.filter((a,c)=>c!==b))},className:"text-xs text-muted-foreground hover:text-danger px-1",title:"Remove group",children:"x"})]}),!m.has(b)&&(0,L.jsxs)("div",{className:"divide-y divide-border",children:[a.tasks.map((a,c)=>{var d;return(0,L.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 group hover:bg-muted/30",children:[(d=a.priority,(0,L.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${{high:"bg-danger",medium:"bg-warning",low:"bg-muted-foreground/40"}[d]}`})),(0,L.jsx)("input",{value:a.title,onChange:a=>{var d;return d=a.target.value,void l(a=>a.map((a,e)=>e===b?{...a,tasks:a.tasks.map((a,b)=>b===c?{...a,title:d}:a)}:a))},className:"flex-1 bg-transparent text-xs text-foreground focus:outline-none border-b border-transparent focus:border-primary"}),(0,L.jsxs)("select",{value:a.priority,onChange:a=>{var d;return d=a.target.value,void l(a=>a.map((a,e)=>e===b?{...a,tasks:a.tasks.map((a,b)=>b===c?{...a,priority:d}:a)}:a))},className:"text-[10px] bg-transparent text-muted-foreground cursor-pointer hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,L.jsx)("option",{value:"high",children:"high"}),(0,L.jsx)("option",{value:"medium",children:"medium"}),(0,L.jsx)("option",{value:"low",children:"low"})]}),k.length>1&&(0,L.jsxs)("select",{value:"",onChange:a=>{let d=parseInt(a.target.value);isNaN(d)||l(a=>{let e=a[b].tasks[c];return a.map((a,f)=>f===b?{...a,tasks:a.tasks.filter((a,b)=>b!==c)}:f===d?{...a,tasks:[...a.tasks,e]}:a)})},className:"text-[10px] bg-transparent text-muted-foreground cursor-pointer hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",title:"Move to...",children:[(0,L.jsx)("option",{value:"",children:"Move"}),k.map((a,c)=>c!==b&&(0,L.jsx)("option",{value:c,children:a.sub_project_name},c))]}),(0,L.jsx)("button",{onClick:()=>{l(a=>a.map((a,d)=>d===b?{...a,tasks:a.tasks.filter((a,b)=>b!==c)}:a))},className:"text-xs text-muted-foreground hover:text-danger opacity-0 group-hover:opacity-100 transition-opacity px-0.5",children:"x"})]},c)}),0===a.tasks.length&&(0,L.jsx)("div",{className:"px-3 py-2 text-xs text-muted-foreground italic",children:"No tasks (this group will be skipped)"})]})]},b))}),!e&&!i&&0===k.length&&(0,L.jsx)("div",{className:"text-center py-16 text-sm text-muted-foreground",children:"No distribution available"})]}),(0,L.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground",children:k.length>0&&`${k.length} projects, ${q} tasks`}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[!e&&k.length>0&&(0,L.jsx)("button",{onClick:o,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-md transition-colors",children:"Retry"}),(0,L.jsx)("button",{onClick:c,className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground border border-border rounded-md transition-colors",children:"Cancel"}),(0,L.jsx)("button",{onClick:p,disabled:g||e||0===q,className:"px-4 py-1.5 text-xs bg-primary text-white rounded-md hover:bg-primary-hover transition-colors disabled:opacity-50",children:g?"Applying...":`Apply (${q})`})]})]})]})]}):null}function xc({projectId:a,onClose:b}){let[c,d]=(0,M.useState)([]),[e,f]=(0,M.useState)(""),[g,h]=(0,M.useState)(!1),i=(0,M.useRef)(null),j=(0,M.useRef)(null),k=`/api/projects/${a}/advisor`;(0,M.useCallback)(async()=>{try{let a=await fetch(k);if(!a.ok)return;let b=await a.json();Array.isArray(b)&&d(b)}catch{}},[k]);let l=(0,M.useCallback)(async()=>{let b=e.trim();if(!b||g)return;f(""),h(!0);let c=`temp-${Date.now()}`,i={id:c,project_id:a,role:"user",content:b,created_at:new Date().toISOString()};d(a=>[...a,i]);try{let a=await fetch(k,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:b})});if(a.ok){let b=await a.json();d(a=>[...a.filter(a=>a.id!==c),b.userMessage,b.aiMessage])}}catch{}h(!1),j.current?.focus()},[e,g,k,a]),m=(0,M.useCallback)(async()=>{await fetch(k,{method:"DELETE"}),d([]),j.current?.focus()},[k]);return(0,L.jsxs)("div",{className:"fixed inset-0 z-50 flex justify-end",onClick:b,children:[(0,L.jsx)("div",{className:"absolute inset-0 bg-black/40",style:{backdropFilter:"blur(2px)"}}),(0,L.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"relative w-[480px] max-w-[85vw] h-full bg-card border-l border-border shadow-2xl flex flex-col",style:{animation:"dialog-in 0.15s ease-out"},children:[(0,L.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center justify-between flex-shrink-0",children:[(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-sm font-semibold text-foreground",children:"Project Advisor"}),(0,L.jsx)("span",{className:"text-[10px] text-muted-foreground/60",children:"⌘L"})]}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[c.length>0&&(0,L.jsx)("button",{onClick:m,className:"text-xs text-muted-foreground hover:text-foreground transition-colors px-1",title:"대화 초기화",children:"Clear"}),(0,L.jsx)("button",{onClick:b,className:"text-muted-foreground hover:text-foreground transition-colors text-lg leading-none",children:"\xd7"})]})]}),(0,L.jsxs)("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3 min-h-0",children:[0===c.length&&!g&&(0,L.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-center gap-3 text-muted-foreground",children:[(0,L.jsx)("div",{className:"text-2xl",children:"\uD83E\uDDED"}),(0,L.jsx)("div",{className:"text-sm",children:"프로젝트 전체 맥락을 보고 답합니다"}),(0,L.jsxs)("div",{className:"text-xs text-muted-foreground/70 max-w-[300px] leading-relaxed",children:['"다음 뭐부터 하면 좋겠어?"',(0,L.jsx)("br",{}),'"빠진 작업 없나?"',(0,L.jsx)("br",{}),'"이번 주 진행 상황 정리해줘"',(0,L.jsx)("br",{}),'"이 방향이 맞는지 검토해줘"']})]}),c.filter(a=>"system"!==a.role).map(a=>(0,L.jsx)("div",{className:`flex flex-col ${"user"===a.role?"items-end":"items-start"}`,children:(0,L.jsx)("div",{className:`max-w-[92%] px-3 py-2 rounded-lg text-sm leading-relaxed ${"user"===a.role?"bg-accent text-white rounded-br-sm whitespace-pre-wrap":"bg-muted text-foreground rounded-bl-sm chat-markdown"}`,children:"assistant"===a.role?(0,L.jsx)(fz,{remarkPlugins:[gK],children:a.content}):a.content})},a.id)),g&&(0,L.jsx)("div",{className:"flex items-start",children:(0,L.jsx)("div",{className:"px-3 py-2 rounded-lg bg-muted text-foreground rounded-bl-sm",children:(0,L.jsxs)("div",{className:"flex gap-1",children:[(0,L.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce",style:{animationDelay:"0ms"}}),(0,L.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce",style:{animationDelay:"150ms"}}),(0,L.jsx)("div",{className:"w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce",style:{animationDelay:"300ms"}})]})})}),(0,L.jsx)("div",{ref:i})]}),(0,L.jsxs)("div",{className:"flex gap-1.5 px-3 py-3 border-t border-border flex-shrink-0",children:[(0,L.jsx)("textarea",{ref:j,value:e,onChange:a=>f(a.target.value),onKeyDown:a=>{"Enter"!==a.key||a.shiftKey||(a.preventDefault(),l())},placeholder:"프로젝트에 대해 무엇이든 물어보세요…",rows:2,className:"flex-1 bg-input border border-border rounded-md px-3 py-2 text-sm text-foreground resize-none focus:border-primary focus:outline-none"}),(0,L.jsx)("button",{onClick:l,disabled:!e.trim()||g,className:"px-3 py-2 bg-accent text-white text-sm rounded-md disabled:opacity-40 hover:bg-accent/80 transition-colors flex-shrink-0 self-end",children:"Send"})]})]})]})}function xd({id:a,initialSubId:b,initialTaskId:c}){let{state:d,setActiveTab:e,consumeInitial:f,updateTabName:g}=U();d.activeTabId,(0,M.useRef)(b),(0,M.useRef)(c);let[h,i]=(0,M.useState)(null),[j,k]=(0,M.useState)([]),[l,m]=(0,M.useState)(null),[n,o]=(0,M.useState)([]),[p,q]=(0,M.useState)(null),[r,s]=(0,M.useState)(!1),[t,u]=(0,M.useState)(null),[v,w]=(0,M.useState)(!1),[x,y]=(0,M.useState)(!0),[z,A]=(0,M.useState)(""),[B,C]=(0,M.useState)(!1),[D,E]=(0,M.useState)(!1),[F,G]=(0,M.useState)(!1),[H,I]=(0,M.useState)(null),[J,K]=(0,M.useState)(null),[N,O]=(0,M.useState)(!1),[P,Q]=(0,M.useState)(!1),[R,S]=(0,M.useState)({}),T=(0,M.useRef)(!1),[V,W]=(0,M.useState)(500),[X,Y]=(0,M.useState)(500),Z=(0,M.useRef)(null),$=(0,M.useRef)(null),_=(0,M.useRef)(0),aa=(0,M.useRef)(0),ab=(0,M.useCallback)((a,b)=>{b.preventDefault(),$.current=a,_.current=b.clientX,aa.current="left"===a?V:X},[V,X]),ae=(0,M.useCallback)(async()=>{let b=await fetch(`/api/projects/${a}/sub-projects`);if(!b.ok)return;let c=await b.json();return k(c),c},[a]),af=n.find(a=>a.id===p)??null,ag=async()=>{if(!z.trim())return;let b=await fetch(`/api/projects/${a}/sub-projects`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z.trim()})});if(b.ok){let a=await b.json();A(""),w(!1),await ae(),m(a.id)}},ah=async b=>{if(!l)return;let c=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:b})});if(c.ok){let a=await c.json();o(b=>[...b,a]),q(a.id),ae()}},ai=async(b,c)=>{let d=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:c})});if(d.ok){let a=await d.json();o(c=>c.map(c=>c.id===b?a:c)),ae()}},ak=async(b,c)=>{let d=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({is_today:c})});if(d.ok){let a=await d.json();o(c=>c.map(c=>c.id===b?a:c))}},al=async b=>{if(!p||!l)return;let c=await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${p}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(c.ok){let a=await c.json();o(b=>b.map(b=>b.id===p?a:b)),ae()}},am=async b=>{k(a=>{let c=new Map(a.map(a=>[a.id,a]));return b.map(a=>c.get(a)).filter(Boolean)}),await fetch(`/api/projects/${a}/sub-projects`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({orderedIds:b})})},an=a=>{let b=a||p;b&&u({type:"delete-task",id:b})},ao=async b=>{t&&("delete-sub"===t.type?(await fetch(`/api/projects/${a}/sub-projects/${t.id}`,{method:"DELETE"}),l===t.id&&(m(null),q(null)),ae()):"delete-task"===t.type&&(await fetch(`/api/projects/${a}/sub-projects/${l}/tasks/${t.id}?mode=${b||"archive"}`,{method:"DELETE"}),o(a=>a.filter(a=>a.id!==t.id)),p===t.id&&q(null),ae()),u(null))},ap=async b=>{let c=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_path:b})});c.ok&&(i(await c.json()),s(!1))},aq=async b=>{let c=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({ai_context:b})});c.ok&&(i(await c.json()),C(!1))},ar=(0,M.useCallback)(async(b=!1)=>{if(!T.current){T.current=!0,b||G(!0);try{let c=await fetch(`/api/projects/${a}/git-sync`,{method:"POST"});if(c.ok){let a=await c.json();K(new Date),b||I(a)}}catch{}finally{T.current=!1,b||G(!1)}}},[a]),as=async()=>{if(!h)return;let b=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({watch_enabled:!h.watch_enabled})});b.ok&&i(await b.json())};return h?(0,L.jsxs)("div",{className:"flex flex-col h-full",children:[(0,L.jsxs)("header",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-card flex-shrink-0",children:[(0,L.jsxs)("div",{className:"flex items-center gap-3",children:[(0,L.jsx)("button",{onClick:()=>e("dashboard"),className:"text-muted-foreground hover:text-foreground hover:bg-muted transition-colors text-sm px-2 py-1 rounded-md",children:"← Back"}),(0,L.jsx)("span",{className:"text-border",children:"|"}),(0,L.jsx)("h1",{className:"text-sm font-semibold",children:h.name}),h.project_path&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate max-w-48",title:h.project_path,children:h.project_path}),(0,L.jsx)("button",{onClick:()=>O(!0),className:"text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors px-1.5 py-0.5 rounded",title:"View file tree",children:"\uD83D\uDCC2"})]})]}),(0,L.jsxs)("div",{className:"flex items-center gap-2",children:[(0,L.jsxs)("select",{value:h.agent_type||"claude",onChange:async b=>{let c=await fetch(`/api/projects/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_type:b.target.value})});c.ok&&i(await c.json())},className:"px-2 py-1.5 text-xs bg-muted border border-border rounded-md text-foreground cursor-pointer hover:bg-card-hover transition-colors",title:"AI Agent",children:[(0,L.jsx)("option",{value:"claude",children:"Claude"}),(0,L.jsx)("option",{value:"gemini",children:"Gemini"}),(0,L.jsx)("option",{value:"codex",children:"Codex"})]}),(0,L.jsxs)("button",{onClick:as,className:`px-3 py-1.5 text-xs border rounded-md transition-colors flex items-center gap-1.5 ${h.watch_enabled?"bg-success/15 text-success border-success/30 hover:bg-success/25":"bg-muted hover:bg-card-hover text-muted-foreground border-border"}`,title:h.watch_enabled?"Watch ON":"Watch OFF",children:[(0,L.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${h.watch_enabled?"bg-success animate-pulse":"bg-muted-foreground/40"}`}),"Watch"]}),(0,L.jsxs)("button",{onClick:()=>C(!0),className:`px-3 py-1.5 text-xs border rounded-md transition-colors ${h.ai_context?"bg-accent/15 text-accent border-accent/30 hover:bg-accent/25":"bg-muted hover:bg-card-hover text-muted-foreground border-border"}`,children:["AI Policy",h.ai_context?" *":""]}),(0,L.jsx)("button",{onClick:()=>E(!0),className:`px-3 py-1.5 text-xs border rounded-md transition-colors ${D?"bg-primary/15 text-primary border-primary/30":"bg-muted hover:bg-card-hover text-muted-foreground border-border"}`,title:"프로젝트 어드바이저 (⌘L)",children:"Advisor"}),h.project_path?(0,L.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,L.jsxs)("button",{onClick:()=>ar(!1),disabled:F,className:"px-3 py-1.5 text-xs bg-muted hover:bg-card-hover text-foreground border border-border rounded-md transition-colors disabled:opacity-50 flex items-center gap-1.5",title:J?`Last sync: ${J.toLocaleTimeString()}`:"Git pull",children:[(0,L.jsx)("span",{className:F?"animate-spin":"",children:"↻"}),F?"Syncing...":"Git Sync"]}),J&&(0,L.jsx)("span",{className:"text-xs text-muted-foreground",children:J.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}):(0,L.jsx)("button",{onClick:()=>s(!0),className:"px-3 py-1.5 text-xs bg-muted hover:bg-card-hover text-foreground border border-border rounded-md transition-colors",children:"Link folder"})]})]}),(0,L.jsxs)("div",{ref:Z,className:"flex-1 flex overflow-hidden",children:[x?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("div",{style:{width:V},className:"border-r border-border flex flex-col flex-shrink-0",children:(0,L.jsx)(aj,{projectId:a,onCollapse:()=>y(!1)})}),(0,L.jsx)("div",{className:"panel-resize-handle",onMouseDown:a=>ab("left",a),children:(0,L.jsx)("div",{className:"panel-resize-handle-bar"})})]}):(0,L.jsx)("button",{onClick:()=>y(!0),className:"w-8 border-r border-border flex-shrink-0 flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-card-hover transition-colors text-xs",title:"Show brainstorming (B)",style:{writingMode:"vertical-rl"},children:"Brainstorm"}),(0,L.jsxs)("div",{style:{width:X},className:"border-r border-border flex flex-col flex-shrink-0",children:[v&&(0,L.jsx)("div",{className:"px-3 py-2 border-b border-border",children:(0,L.jsx)("input",{type:"text",value:z,onChange:a=>A(a.target.value),onKeyDown:a=>{"Enter"===a.key&&ag(),"Escape"===a.key&&(A(""),w(!1))},placeholder:"Project name...",className:"w-full bg-input border border-border rounded px-2 py-1 text-xs focus:border-primary focus:outline-none text-foreground",autoFocus:!0})}),(0,L.jsx)(cg,{subProjects:j,tasks:n,selectedSubId:l,selectedTaskId:p,onSelectSub:a=>{m(a),q(null)},onSelectTask:a=>{q(a),S(b=>{if("done"!==b[a])return b;let c={...b};return delete c[a],c})},onCreateSub:()=>w(!0),onDeleteSub:a=>{u({type:"delete-sub",id:a})},onRenameSub:async(b,c)=>{(await fetch(`/api/projects/${a}/sub-projects/${b}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:c})})).ok&&ae()},onCreateTask:ah,onStatusChange:ai,onTodayToggle:ak,onDeleteTask:an,onReorderSubs:am,onAutoDistribute:()=>Q(!0),chatStates:R})]}),(0,L.jsx)("div",{className:"panel-resize-handle",onMouseDown:a=>ab("center",a),children:(0,L.jsx)("div",{className:"panel-resize-handle-bar"})}),(0,L.jsx)("div",{className:"flex-1 min-w-0",children:af?(0,L.jsx)(w5,{task:af,projectId:a,subProjectId:l,siblingTasks:n,onUpdate:al,onDelete:an,onTaskPromoted:a=>o(b=>[...b,a]),onChatStateChange:(a,b)=>{S(c=>({...c,[a]:b}))}}):(0,L.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:n.length>0?"Select a task":l?"Create a task to get started":"Select a project"})})]}),r&&(0,L.jsx)(ac,{onSelect:ap,onCancel:()=>s(!1),initialPath:h.project_path||void 0}),(0,L.jsx)(ad,{open:t?.type==="delete-sub",title:"Delete project?",description:"This will delete the project and all its tasks.",confirmLabel:"Delete",variant:"danger",onConfirm:()=>ao(),onCancel:()=>u(null)}),t?.type==="delete-task"&&(0,L.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(2px)"},children:(0,L.jsxs)("div",{className:"bg-card border border-border rounded-xl shadow-2xl shadow-black/40 w-full max-w-sm mx-4 animate-dialog-in",children:[(0,L.jsxs)("div",{className:"p-5",children:[(0,L.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Remove task"}),(0,L.jsx)("p",{className:"text-xs text-muted-foreground mt-1.5 leading-relaxed",children:"보관함에 넣으면 나중에 복원하거나 프롬프트를 참고할 수 있습니다."})]}),(0,L.jsxs)("div",{className:"flex justify-end gap-2 px-5 pb-4",children:[(0,L.jsx)("button",{onClick:()=>u(null),className:"px-3 py-1.5 text-xs text-muted-foreground hover:text-foreground bg-muted hover:bg-card-hover border border-border rounded-md transition-colors",children:"Cancel"}),(0,L.jsx)("button",{onClick:()=>ao("permanent"),className:"px-3 py-1.5 text-xs text-white bg-destructive hover:bg-destructive/80 rounded-md transition-colors",children:"Delete"}),(0,L.jsx)("button",{onClick:()=>ao("archive"),className:"px-3 py-1.5 text-xs text-white bg-primary hover:bg-primary-hover rounded-md transition-colors",children:"Archive"})]})]})}),(0,L.jsx)(w6,{open:B,content:h.ai_context||"",onSave:aq,onClose:()=>C(!1)}),(0,L.jsx)(w8,{open:!!H,results:H||[],onClose:()=>I(null)}),N&&h.project_path&&(0,L.jsx)(xa,{rootPath:h.project_path,onClose:()=>O(!1)}),(0,L.jsx)(xb,{open:P,projectId:a,onClose:()=>Q(!1),onApplied:()=>{ae()}}),D&&(0,L.jsx)(xc,{projectId:a,onClose:()=>E(!1)})]}):(0,L.jsx)("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Loading..."})}function xe(){let[a,b]=(0,M.useState)(!1),[c,d]=(0,M.useState)(""),[e,f]=(0,M.useState)([]),[g,h]=(0,M.useState)(0),[i,j]=(0,M.useState)(!1),k=(0,M.useRef)(null),{openProject:l}=U();(0,M.useRef)(null);let m=(0,M.useCallback)(a=>{l(a.projectId,a.projectName,a.subProjectId,a.taskId),b(!1)},[l]);return a?(0,L.jsx)("div",{onClick:()=>b(!1),className:"fixed inset-0 z-[60] flex items-start justify-center pt-[14vh]",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(3px)"},children:(0,L.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-xl animate-dialog-in",children:[(0,L.jsxs)("div",{className:"px-4 py-3 border-b border-border flex items-center gap-2",children:[(0,L.jsx)("span",{className:"text-muted-foreground",children:"\uD83D\uDD0E"}),(0,L.jsx)("input",{ref:k,value:c,onChange:a=>d(a.target.value),onKeyDown:a=>{if("Escape"===a.key)return void b(!1);if("ArrowDown"===a.key){a.preventDefault(),h(a=>Math.min(a+1,e.length-1));return}if("ArrowUp"===a.key){a.preventDefault(),h(a=>Math.max(a-1,0));return}if("Enter"===a.key){a.preventDefault();let b=e[g];b&&m(b)}},placeholder:"태스크 \xb7 프로젝트 \xb7 워크스페이스 검색… (⌘P)",className:"flex-1 bg-transparent text-sm text-foreground focus:outline-none"}),(0,L.jsx)("span",{className:"text-[10px] text-muted-foreground/70 px-1.5 py-0.5 border border-border rounded",children:"↑↓ \xb7 ↵ \xb7 Esc"})]}),(0,L.jsxs)("div",{className:"max-h-[55vh] overflow-y-auto",children:[i&&(0,L.jsx)("div",{className:"px-4 py-6 text-xs text-muted-foreground",children:"검색 중…"}),!i&&c.trim()&&0===e.length&&(0,L.jsx)("div",{className:"px-4 py-6 text-xs text-muted-foreground",children:"일치하는 항목 없음"}),!i&&!c.trim()&&(0,L.jsx)("div",{className:"px-4 py-6 text-xs text-muted-foreground",children:"무엇을 찾으시나요? 태스크 제목\xb7본문, 프로젝트\xb7워크스페이스 이름을 검색합니다."}),(0,L.jsx)("ul",{children:e.map((a,b)=>(0,L.jsxs)("li",{onMouseEnter:()=>h(b),onClick:()=>m(a),className:`px-4 py-2.5 cursor-pointer border-l-2 ${b===g?"bg-muted border-primary":"border-transparent"}`,children:[(0,L.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,L.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] uppercase tracking-wide ${"task"===a.type?"bg-primary/15 text-primary":"project"===a.type?"bg-accent/15 text-accent":"bg-warning/15 text-warning"}`,children:"sub-project"===a.type?"project":a.type}),(0,L.jsx)("span",{children:a.projectName}),a.subProjectName&&"task"===a.type&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)("span",{className:"opacity-50",children:"›"}),(0,L.jsx)("span",{children:a.subProjectName})]}),a.isArchived&&(0,L.jsx)("span",{className:"text-muted-foreground/70 italic",children:"(archived)"})]}),(0,L.jsx)("div",{className:"text-sm text-foreground mt-0.5 truncate",children:a.title}),a.snippet&&(0,L.jsx)("div",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate",children:a.snippet})]},`${a.type}-${a.taskId??a.subProjectId??a.projectId}`))})]})]})}):null}function xf(){let[a,b]=(0,M.useState)(!1),[c,d]=(0,M.useState)([]),[e,f]=(0,M.useState)(""),[g,h]=(0,M.useState)(""),[i,j]=(0,M.useState)(""),[k,l]=(0,M.useState)(!1),[m,n]=(0,M.useState)(null),o=(0,M.useRef)(null),{openProject:p}=U(),q=async()=>{let a=i.trim();if(a&&e&&g&&!k){l(!0),n(null);try{let d=await fetch(`/api/projects/${e}/sub-projects/${g}/tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:a})});if(!d.ok)throw Error(`HTTP ${d.status}`);let f=await d.json();try{localStorage.setItem("im-quick-capture-last-dest",JSON.stringify({projectId:e,subProjectId:g}))}catch{}let h=c.find(a=>a.id===e);h&&p(h.id,h.name,g,f.id),b(!1)}catch(a){n(a instanceof Error?a.message:"생성 실패"),l(!1)}}};if(!a)return null;let r=c.find(a=>a.id===e),s=r?.subProjects??[];return(0,L.jsx)("div",{onClick:()=>b(!1),className:"fixed inset-0 z-[60] flex items-start justify-center pt-[16vh]",style:{background:"rgba(0,0,0,0.5)",backdropFilter:"blur(3px)"},children:(0,L.jsxs)("div",{onClick:a=>a.stopPropagation(),className:"bg-card border border-border rounded-xl shadow-2xl w-full max-w-md animate-dialog-in p-4 flex flex-col gap-3",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"빠른 태스크 캡처"}),(0,L.jsx)("span",{className:"text-[10px] text-muted-foreground/70 px-1.5 py-0.5 border border-border rounded",children:"⌘N \xb7 Esc"})]}),(0,L.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,L.jsx)("select",{value:e,onChange:a=>f(a.target.value),className:"bg-input border border-border rounded-md px-2 py-1.5 text-sm text-foreground focus:border-primary focus:outline-none",children:c.map(a=>(0,L.jsx)("option",{value:a.id,children:a.name},a.id))}),(0,L.jsx)("select",{value:g,onChange:a=>h(a.target.value),disabled:!s.length,className:"bg-input border border-border rounded-md px-2 py-1.5 text-sm text-foreground focus:border-primary focus:outline-none disabled:opacity-50",children:0===s.length?(0,L.jsx)("option",{value:"",children:"프로젝트 없음"}):s.map(a=>(0,L.jsx)("option",{value:a.id,children:a.name},a.id))})]}),(0,L.jsx)("input",{ref:o,value:i,onChange:a=>j(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),q()),"Escape"===a.key&&(a.preventDefault(),b(!1))},placeholder:"태스크 제목을 입력하고 Enter…",className:"w-full bg-input border border-border rounded-md px-3 py-2 text-sm text-foreground focus:border-primary focus:outline-none"}),m&&(0,L.jsxs)("div",{className:"text-xs text-destructive",children:["⚠ ",m]}),(0,L.jsxs)("div",{className:"flex items-center justify-between",children:[(0,L.jsx)("div",{className:"text-[10px] text-muted-foreground/70",children:"저장 후 해당 태스크 워크스페이스로 바로 이동"}),(0,L.jsxs)("div",{className:"flex gap-2",children:[(0,L.jsx)("button",{onClick:()=>b(!1),className:"text-xs text-muted-foreground px-2 py-1",children:"취소"}),(0,L.jsx)("button",{onClick:q,disabled:!i.trim()||!e||!g||k,className:"text-xs px-3 py-1 bg-primary text-primary-foreground rounded disabled:opacity-40",children:k?"…":"생성"})]})]})]})})}function xg(){let{state:a}=U();return(0,L.jsxs)("div",{className:"h-screen flex flex-col",children:[(0,L.jsx)(ab,{}),(0,L.jsx)(xe,{}),(0,L.jsx)(xf,{}),(0,L.jsx)("div",{className:"flex-1 min-h-0 relative",children:a.tabs.map(b=>(0,L.jsx)("div",{className:"absolute inset-0 flex flex-col",style:{display:b.id===a.activeTabId?"flex":"none"},children:"dashboard"===b.type?(0,L.jsx)(ai,{}):(0,L.jsx)(xd,{id:b.projectId,initialSubId:b.initialSubId,initialTaskId:b.initialTaskId})},b.id))})]})}function xh(){return(0,L.jsx)(Z,{children:(0,L.jsx)(V,{children:(0,L.jsx)(xg,{})})})}},3873:a=>{"use strict";a.exports=require("path")},3954:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/interception-routes")},4188:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,5547,23))},4268:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,1921,23))},4451:a=>{a.exports=function(a,b){if(null==a)return{};var c={};for(var d in a)if(({}).hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c},a.exports.__esModule=!0,a.exports.default=a.exports},4494:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(7943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/Users/young/Toy/idea-manager/src/app/page.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/young/Toy/idea-manager/src/app/page.tsx","default")},5091:(a,b,c)=>{"use strict";Object.defineProperty(b,"__esModule",{value:!0}),Object.defineProperty(b,"default",{enumerable:!0,get:function(){return f}});let d=c(5735),e=c(2675);function f(){return(0,d.jsx)(e.HTTPAccessErrorFallback,{status:404,message:"This page could not be found."})}("function"==typeof b.default||"object"==typeof b.default&&null!==b.default)&&void 0===b.default.__esModule&&(Object.defineProperty(b.default,"__esModule",{value:!0}),Object.assign(b.default,b),a.exports=b.default)},5565:(a,b,c)=>{Promise.resolve().then(c.bind(c,3543))},5712:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,1921,23)),Promise.resolve().then(c.t.bind(c,440,23)),Promise.resolve().then(c.t.bind(c,4342,23)),Promise.resolve().then(c.t.bind(c,2265,23)),Promise.resolve().then(c.t.bind(c,5421,23)),Promise.resolve().then(c.t.bind(c,1335,23)),Promise.resolve().then(c.t.bind(c,664,23)),Promise.resolve().then(c.bind(c,4661))},5827:a=>{"use strict";var b=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=function(a){return"function"==typeof Array.isArray?Array.isArray(a):"[object Array]"===c.call(a)},g=function(a){if(!a||"[object Object]"!==c.call(a))return!1;var d,e=b.call(a,"constructor"),f=a.constructor&&a.constructor.prototype&&b.call(a.constructor.prototype,"isPrototypeOf");if(a.constructor&&!e&&!f)return!1;for(d in a);return void 0===d||b.call(a,d)},h=function(a,b){d&&"__proto__"===b.name?d(a,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):a[b.name]=b.newValue},i=function(a,c){if("__proto__"===c){if(!b.call(a,c))return;else if(e)return e(a,c).value}return a[c]};a.exports=function a(){var b,c,d,e,j,k,l=arguments[0],m=1,n=arguments.length,o=!1;for("boolean"==typeof l&&(o=l,l=arguments[1]||{},m=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});m<n;++m)if(b=arguments[m],null!=b)for(c in b)d=i(l,c),l!==(e=i(b,c))&&(o&&e&&(g(e)||(j=f(e)))?(j?(j=!1,k=d&&f(d)?d:[]):k=d&&g(d)?d:{},h(l,{name:c,newValue:a(o,k,e)})):void 0!==e&&h(l,{name:c,newValue:e}));return l}},6439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},6487:()=>{},6510:a=>{"use strict";var b=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,c=/\n/g,d=/^\s*/,e=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,f=/^:\s*/,g=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,h=/^[;\s]*/,i=/^\s+|\s+$/g;function j(a){return a?a.replace(i,""):""}a.exports=function(a,i){if("string"!=typeof a)throw TypeError("First argument must be a string");if(!a)return[];i=i||{};var k=1,l=1;function m(a){var b=a.match(c);b&&(k+=b.length);var d=a.lastIndexOf("\n");l=~d?a.length-d:l+a.length}function n(){var a={line:k,column:l};return function(b){return b.position=new o(a),q(d),b}}function o(a){this.start=a,this.end={line:k,column:l},this.source=i.source}function p(b){var c=Error(i.source+":"+k+":"+l+": "+b);if(c.reason=b,c.filename=i.source,c.line=k,c.column=l,c.source=a,i.silent);else throw c}function q(b){var c=b.exec(a);if(c){var d=c[0];return m(d),a=a.slice(d.length),c}}function r(a){var b;for(a=a||[];b=s();)!1!==b&&a.push(b);return a}function s(){var b=n();if("/"==a.charAt(0)&&"*"==a.charAt(1)){for(var c=2;""!=a.charAt(c)&&("*"!=a.charAt(c)||"/"!=a.charAt(c+1));)++c;if(c+=2,""===a.charAt(c-1))return p("End of comment missing");var d=a.slice(2,c-2);return l+=2,m(d),a=a.slice(c),l+=2,b({type:"comment",comment:d})}}o.prototype.content=a,q(d);var t,u=[];for(r(u);t=function(){var a=n(),c=q(e);if(c){if(s(),!q(f))return p("property missing ':'");var d=q(g),i=a({type:"declaration",property:j(c[0].replace(b,"")),value:d?j(d[0].replace(b,"")):""});return q(h),i}}();)!1!==t&&(u.push(t),r(u));return u}},6537:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>j,metadata:()=>i});var d=c(5735),e=c(210),f=c.n(e),g=c(84),h=c.n(g);c(1135);let i={title:"IM - 아이디어 매니저",description:"아이디어에서 실행 가능한 프롬프트까지, 멀티 워크스페이스 워크플로우 매니저",icons:{icon:"/favicon.svg",apple:"/icon-192.png"},manifest:"/manifest.json",themeColor:"#6366f1",appleWebApp:{capable:!0,statusBarStyle:"black-translucent",title:"IM"}};function j({children:a}){return(0,d.jsxs)("html",{lang:"ko",children:[(0,d.jsx)("head",{children:(0,d.jsx)("link",{rel:"stylesheet",as:"style",crossOrigin:"anonymous",href:"https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css"})}),(0,d.jsxs)("body",{className:`${f().variable} ${h().variable} antialiased`,children:[a,(0,d.jsx)("script",{dangerouslySetInnerHTML:{__html:`
|
|
29
|
+
if ('serviceWorker' in navigator) {
|
|
30
|
+
navigator.serviceWorker.register('/sw.js');
|
|
31
|
+
}
|
|
32
|
+
`}})]})]})}},6713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},7068:a=>{"use strict";a.exports=require("next/dist/shared/lib/size-limit")},8301:(a,b,c)=>{Promise.resolve().then(c.bind(c,4494))},8335:()=>{},8354:a=>{"use strict";a.exports=require("util")},8620:a=>{function b(){return a.exports=b=Object.assign?Object.assign.bind():function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)({}).hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},a.exports.__esModule=!0,a.exports.default=a.exports,b.apply(null,arguments)}a.exports=b,a.exports.__esModule=!0,a.exports.default=a.exports},9121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},9294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},9889:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>D.a,__next_app__:()=>L,handler:()=>N,routeModule:()=>M});var d=c(7553),e=c(4006),f=c(7798),g=c(4775),h=c(9373),i=c(3461),j=c(1020),k=c(6349),l=c(4365),m=c(6023),n=c(3747),o=c(4235),p=c(3938),q=c(261),r=c(6758),s=c(7243),t=c(6713),u=c(7527),v=c(2820),w=c(8216),x=c(7929),y=c(9551),z=c(9125),A=c(6439),B=c(7068),C=c(5547),D=c.n(C),E=c(1287),F=c(1494),G=c(722),H=c(753),I=c(3954),J={};for(let a in E)0>["default","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(J[a]=()=>E[a]);c.d(b,J);let K=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,4494)),"/Users/young/Toy/idea-manager/src/app/page.tsx"]}]},{layout:[()=>Promise.resolve().then(c.bind(c,6537)),"/Users/young/Toy/idea-manager/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,5547,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,5091,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,5270,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,8193,23)),"next/dist/client/components/builtin/unauthorized.js"]}],L={require:c,loadChunk:()=>Promise.resolve()},M=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:K},distDir:".next",relativeProjectDir:""});async function N(a,b,d){var C;M.isDev&&(0,h.addRequestMeta)(a,"devRequestTimingInternalsEnd",process.hrtime.bigint());let J=!!(0,h.getRequestMeta)(a,"minimalMode"),O="/page";"/index"===O&&(O="/");let P=await M.prepare(a,b,{srcPage:O,multiZoneDraftMode:!1});if(!P)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:Q,query:R,params:S,pageIsDynamic:T,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,serverActionsManifest:X,clientReferenceManifest:Y,subresourceIntegrityManifest:Z,prerenderManifest:$,isDraftMode:_,resolvedPathname:aa,revalidateOnlyGenerated:ab,routerServerContext:ac,nextConfig:ad,parsedUrl:ae,interceptionRoutePatterns:af,deploymentId:ag}=P,ah=(0,q.normalizeAppPath)(O),{isOnDemandRevalidate:ai}=P,aj=ad.experimental.ppr&&!ad.cacheComponents&&(0,I.isInterceptionRouteAppPath)(aa)?null:M.match(aa,$),ak=!!$.routes[aa],al=a.headers["user-agent"]||"",am=(0,t.getBotType)(al),an=(0,p.isHtmlBotRequest)(a),ao=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[s.NEXT_ROUTER_PREFETCH_HEADER],ap=(0,h.getRequestMeta)(a,"isRSCRequest")??!!a.headers[s.RSC_HEADER],aq=(0,r.getIsPossibleServerAction)(a),ar=(0,m.checkIsAppPPREnabled)(ad.experimental.ppr);if(!(0,h.getRequestMeta)(a,"postponed")&&ar&&"1"===a.headers[x.NEXT_RESUME_HEADER]&&"POST"===a.method){let b=[];for await(let c of a)b.push(c);let c=Buffer.concat(b).toString("utf8");(0,h.addRequestMeta)(a,"postponed",c)}let as=ar&&(null==(C=$.routes[ah]??$.dynamicRoutes[ah])?void 0:C.renderingMode)==="PARTIALLY_STATIC",at=!1,au=!1,av=as?(0,h.getRequestMeta)(a,"postponed"):void 0,aw=as&&ap&&!ao;J&&(aw=aw&&!!av);let ax=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ay=(!an||!as)&&(!al||(0,p.shouldServeStreamingMetadata)(al,ad.htmlLimitedBots)),az=!!((aj||ak||$.routes[ah])&&!(an&&as)),aA=as&&!0===ad.cacheComponents,aB=!0===M.isDev||!az||"string"==typeof av||(aA&&(0,h.getRequestMeta)(a,"onCacheEntryV2")?aw&&!J:aw),aC=an&&as,aD=null;_||!az||aB||aq||av||aw||(aD=aa);let aE=aD;!aE&&M.isDev&&(aE=aa),M.isDev||_||!az||!ap||aw||(0,k.d)(a.headers);let aF={...E,tree:K,GlobalError:D(),handler:N,routeModule:M,__next_app__:L};X&&Y&&(0,o.setManifestsSingleton)({page:O,clientReferenceManifest:Y,serverActionsManifest:X});let aG=a.method||"GET",aH=(0,g.getTracer)(),aI=aH.getActiveScopeSpan(),aJ=async()=>((null==ac?void 0:ac.render404)?await ac.render404(a,b,ae,!1):b.end("This page could not be found"),null);try{let f=M.getVaryHeader(aa,af);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return M.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let a=aH.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let d=a.get("next.route");if(d){let a=`${aG} ${d}`;c.setAttributes({"next.route":d,"http.route":d,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aG} ${O}`)})},m=(0,h.getRequestMeta)(a,"incrementalCache"),o=async({span:e,postponed:f,fallbackRouteParams:g,forceStaticRender:i})=>{let l={query:R,params:S,page:ah,sharedContext:{buildId:Q},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aF,Component:(0,j.T)(aF),params:S,routeModule:M,page:O,postponed:f,shouldWaitOnAllReady:aC,serveStreamingMetadata:ay,supportsDynamicResponse:"string"==typeof f||aB,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,subresourceIntegrityManifest:Z,setCacheStatus:null==ac?void 0:ac.setCacheStatus,setIsrStatus:null==ac?void 0:ac.setIsrStatus,setReactDebugChannel:null==ac?void 0:ac.setReactDebugChannel,sendErrorsToBrowser:null==ac?void 0:ac.sendErrorsToBrowser,dir:c(3873).join(process.cwd(),M.relativeProjectDir),isDraftMode:_,botType:am,isOnDemandRevalidate:ai,isPossibleServerAction:aq,assetPrefix:ad.assetPrefix,nextConfigOutput:ad.output,crossOrigin:ad.crossOrigin,trailingSlash:ad.trailingSlash,images:ad.images,previewProps:$.preview,deploymentId:ag,enableTainting:ad.experimental.taint,htmlLimitedBots:ad.htmlLimitedBots,reactMaxHeadersLength:ad.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:m,cacheLifeProfiles:ad.cacheLife,basePath:ad.basePath,serverActions:ad.experimental.serverActions,...at||au?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isDebugDynamicAccesses:at}:{},cacheComponents:!!ad.cacheComponents,experimental:{isRoutePPREnabled:as,expireTime:ad.expireTime,staleTimes:ad.experimental.staleTimes,dynamicOnHover:!!ad.experimental.dynamicOnHover,inlineCss:!!ad.experimental.inlineCss,authInterrupts:!!ad.experimental.authInterrupts,clientTraceMetadata:ad.experimental.clientTraceMetadata||[],clientParamParsingOrigins:ad.experimental.clientParamParsingOrigins,maxPostponedStateSizeBytes:(0,B.parseMaxPostponedStateSize)(ad.experimental.maxPostponedStateSize)},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d,e)=>M.onRequestError(a,b,d,e,ac),err:(0,h.getRequestMeta)(a,"invokeError"),dev:M.isDev}};at&&(l.renderOpts.nextExport=!0,l.renderOpts.supportsDynamicResponse=!1,l.renderOpts.isDebugDynamicAccesses=at),i&&(l.renderOpts.supportsDynamicResponse=!1);let n=await k(e,l),{metadata:o}=n,{cacheControl:p,headers:q={},fetchTags:r,fetchMetrics:s}=o;if(r&&(q[x.NEXT_CACHE_TAGS_HEADER]=r),a.fetchMetrics=s,az&&(null==p?void 0:p.revalidate)===0&&!M.isDev&&!as){let a=o.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${aa}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
|
|
33
33
|
see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__NEXT_ERROR_CODE",{value:"E132",enumerable:!1,configurable:!0});if(null==a?void 0:a.stack){let c=a.stack;b.stack=b.message+c.substring(c.indexOf("\n"))}throw b}return{value:{kind:u.CachedRouteKind.APP_PAGE,html:n,headers:q,rscData:o.flightData,postponed:o.postponed,status:o.statusCode,segmentData:o.segmentData},cacheControl:p}},p=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i,forceStaticRender:j=!1})=>{let k,l=!1===M.isDev,q=c||b.writableEnded;if(ai&&ab&&!f&&!J)return(null==ac?void 0:ac.render404)?await ac.render404(a,b):(b.statusCode=404,b.end("This page could not be found")),null;if(aj&&(k=(0,v.parseFallbackField)(aj.fallback)),k===v.FallbackMode.PRERENDER&&(0,t.isBot)(al)&&(!as||an)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ai=!0),ai&&(k!==v.FallbackMode.NOT_FOUND||f)&&(k=v.FallbackMode.BLOCKING_STATIC_RENDER),!J&&k!==v.FallbackMode.BLOCKING_STATIC_RENDER&&aE&&!q&&!_&&T&&(l||!ak)){if((l||aj)&&k===v.FallbackMode.NOT_FOUND){if(ad.experimental.adapterPath)return await aJ();throw new A.NoFallbackError}if(as&&(ad.cacheComponents?!aw:!ap)){let b=l&&"string"==typeof(null==aj?void 0:aj.fallback)?aj.fallback:ah,c=l&&(null==aj?void 0:aj.fallbackRouteParams)?(0,n.createOpaqueFallbackRouteParams)(aj.fallbackRouteParams):au?(0,n.getFallbackRouteParams)(ah,M):null,f=await M.handleResponse({cacheKey:b,req:a,nextConfig:ad,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:$,isRoutePPREnabled:as,responseGenerator:async()=>o({span:i,postponed:void 0,fallbackRouteParams:c,forceStaticRender:!1}),waitUntil:d.waitUntil,isMinimalMode:J});if(null===f)return null;if(f)return delete f.cacheControl,f}}let r=ai||g||!av?void 0:av;if(aA&&!J&&m&&aw&&!j){let b=await m.get(aa,{kind:u.IncrementalCacheKind.APP_PAGE,isRoutePPREnabled:!0,isFallback:!1});b&&b.value&&b.value.kind===u.CachedRouteKind.APP_PAGE&&(r=b.value.postponed,b&&(-1===b.isStale||!0===b.isStale)&&(0,H.scheduleOnNextTick)(async()=>{let b=M.getResponseCache(a);try{await b.revalidate(aa,m,as,!1,a=>p({...a,forceStaticRender:!0}),null,c,d.waitUntil)}catch(a){console.error("Error revalidating the page in the background",a)}}))}if(at&&void 0!==r)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:u.CachedRouteKind.PAGES,html:w.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let s=l&&(null==aj?void 0:aj.fallbackRouteParams)&&(0,h.getRequestMeta)(a,"renderFallbackShell")?(0,n.createOpaqueFallbackRouteParams)(aj.fallbackRouteParams):au?(0,n.getFallbackRouteParams)(ah,M):null;return o({span:i,postponed:r,fallbackRouteParams:s,forceStaticRender:j})},q=async c=>{var f,g,i,j,k;let l,m=await M.handleResponse({cacheKey:aD,responseGenerator:a=>p({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ai,isRoutePPREnabled:as,req:a,nextConfig:ad,prerenderManifest:$,waitUntil:d.waitUntil,isMinimalMode:J});if(_&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),M.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!m){if(aD)throw Object.defineProperty(Error("invariant: cache entry required but not generated"),"__NEXT_ERROR_CODE",{value:"E62",enumerable:!1,configurable:!0});return null}if((null==(f=m.value)?void 0:f.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=m.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let n="string"==typeof m.value.postponed;az&&!aw&&(!n||ao)&&(J||b.setHeader("x-nextjs-cache",ai?"REVALIDATED":m.isMiss?"MISS":m.isStale?"STALE":"HIT"),b.setHeader(s.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=m;if(av)l={revalidate:0,expire:void 0};else if(aw)l={revalidate:0,expire:void 0};else if(!M.isDev)if(_)l={revalidate:0,expire:void 0};else if(az){if(m.cacheControl)if("number"==typeof m.cacheControl.revalidate){if(m.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${m.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:m.cacheControl.revalidate,expire:(null==(j=m.cacheControl)?void 0:j.expire)??ad.expireTime}}else l={revalidate:x.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(m.cacheControl=l,"string"==typeof ax&&(null==q?void 0:q.kind)===u.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[x.NEXT_CACHE_TAGS_HEADER];J&&az&&c&&"string"==typeof c&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(ax);return void 0!==d?(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.fromStatic(d,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl}):(b.statusCode=204,(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl}))}let r=aA?(0,h.getRequestMeta)(a,"onCacheEntryV2")??(0,h.getRequestMeta)(a,"onCacheEntry"):(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r(m,{url:(0,h.getRequestMeta)(a,"initURL")??a.url}))return null;if(q.headers){let a={...q.headers};for(let[c,d]of(J&&az||delete a[x.NEXT_CACHE_TAGS_HEADER],Object.entries(a)))if(void 0!==d)if(Array.isArray(d))for(let a of d)b.appendHeader(c,a);else"number"==typeof d&&(d=d.toString()),b.appendHeader(c,d)}let t=null==(g=q.headers)?void 0:g[x.NEXT_CACHE_TAGS_HEADER];if(J&&az&&t&&"string"==typeof t&&b.setHeader(x.NEXT_CACHE_TAGS_HEADER,t),!q.status||ap&&as||(b.statusCode=q.status),!J&&q.status&&F.RedirectStatusCode[q.status]&&ap&&(b.statusCode=200),n&&!aw&&b.setHeader(s.NEXT_DID_POSTPONE_HEADER,"1"),ap&&!_){if(void 0===q.rscData){if(q.html.contentType!==s.RSC_CONTENT_TYPE_HEADER)if(ad.cacheComponents)return b.statusCode=404,(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.EMPTY,cacheControl:m.cacheControl});else throw Object.defineProperty(new G.InvariantError(`Expected RSC response, got ${q.html.contentType}`),"__NEXT_ERROR_CODE",{value:"E789",enumerable:!1,configurable:!0});return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:q.html,cacheControl:m.cacheControl})}return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:w.default.fromStatic(q.rscData,s.RSC_CONTENT_TYPE_HEADER),cacheControl:m.cacheControl})}let v=q.html;if(!n||J||ap)return(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:m.cacheControl});if(at)return v.push(new ReadableStream({start(a){a.enqueue(y.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}});let A=new TransformStream;return v.push(A.readable),o({span:c,postponed:q.postponed,fallbackRouteParams:null,forceStaticRender:!1}).then(async a=>{var b,c;if(!a)throw Object.defineProperty(Error("Invariant: expected a result to be returned"),"__NEXT_ERROR_CODE",{value:"E463",enumerable:!1,configurable:!0});if((null==(b=a.value)?void 0:b.kind)!==u.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant: expected a page response, got ${null==(c=a.value)?void 0:c.kind}`),"__NEXT_ERROR_CODE",{value:"E305",enumerable:!1,configurable:!0});await a.value.html.pipeTo(A.writable)}).catch(a=>{A.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,z.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:v,cacheControl:{revalidate:0,expire:void 0}})};if(!aI)return await aH.withPropagatedContext(a.headers,()=>aH.trace(i.BaseServerSpan.handleRequest,{spanName:`${aG} ${O}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aG,"http.target":a.url}},q));await q(aI)}catch(b){throw b instanceof A.NoFallbackError||await M.onRequestError(a,b,{routerKind:"App Router",routePath:O,routeType:"render",revalidateReason:(0,f.c)({isStaticGeneration:az,isOnDemandRevalidate:ai})},!1,ac),b}}}};var b=require("../webpack-runtime.js");b.C(a);var c=b.X(0,[445,471],()=>b(b.s=9889));module.exports=c})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/"},"ssrModuleMapping":{"484":{"*":{"id":"664","name":"*","chunks":[],"async":false}},"1048":{"*":{"id":"8935","name":"*","chunks":[],"async":false}},"1304":{"*":{"id":"440","name":"*","chunks":[],"async":false}},"4581":{"*":{"id":"1335","name":"*","chunks":[],"async":false}},"4777":{"*":{"id":"2265","name":"*","chunks":[],"async":false}},"6869":{"*":{"id":"4661","name":"*","chunks":[],"async":false}},"7121":{"*":{"id":"5421","name":"*","chunks":[],"async":false}},"7123":{"*":{"id":"1921","name":"*","chunks":[],"async":false}},"
|
|
1
|
+
globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/page"]={"moduleLoading":{"prefix":"/_next/"},"ssrModuleMapping":{"484":{"*":{"id":"664","name":"*","chunks":[],"async":false}},"1048":{"*":{"id":"8935","name":"*","chunks":[],"async":false}},"1304":{"*":{"id":"440","name":"*","chunks":[],"async":false}},"4581":{"*":{"id":"1335","name":"*","chunks":[],"async":false}},"4777":{"*":{"id":"2265","name":"*","chunks":[],"async":false}},"6869":{"*":{"id":"4661","name":"*","chunks":[],"async":false}},"7121":{"*":{"id":"5421","name":"*","chunks":[],"async":false}},"7123":{"*":{"id":"1921","name":"*","chunks":[],"async":false}},"8616":{"*":{"id":"4342","name":"*","chunks":[],"async":false}},"9768":{"*":{"id":"3543","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/Users/young/Toy/idea-manager/node_modules/next/dist/client/components/builtin/global-error.js":{"id":7123,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/client/components/builtin/global-error.js":{"id":7123,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/client/components/client-page.js":{"id":1304,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/client/components/client-page.js":{"id":1304,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/client/components/client-segment.js":{"id":8616,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/client/components/client-segment.js":{"id":8616,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/client/components/http-access-fallback/error-boundary.js":{"id":4777,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/client/components/http-access-fallback/error-boundary.js":{"id":4777,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/client/components/layout-router.js":{"id":7121,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/client/components/layout-router.js":{"id":7121,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/client/components/render-from-template-context.js":{"id":4581,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":4581,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/lib/framework/boundary-components.js":{"id":484,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/lib/framework/boundary-components.js":{"id":484,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/lib/metadata/generate/icon-mark.js":{"id":6869,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/dist/esm/lib/metadata/generate/icon-mark.js":{"id":6869,"name":"*","chunks":[],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.tsx\",\"import\":\"Geist\",\"arguments\":[{\"variable\":\"--font-geist-sans\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistSans\"}":{"id":421,"name":"*","chunks":["558","static/chunks/app/layout-52917f6c941a9818.js"],"async":false},"/Users/young/Toy/idea-manager/node_modules/next/font/google/target.css?{\"path\":\"src/app/layout.tsx\",\"import\":\"Geist_Mono\",\"arguments\":[{\"variable\":\"--font-geist-mono\",\"subsets\":[\"latin\"]}],\"variableName\":\"geistMono\"}":{"id":9695,"name":"*","chunks":["558","static/chunks/app/layout-52917f6c941a9818.js"],"async":false},"/Users/young/Toy/idea-manager/src/app/globals.css":{"id":1743,"name":"*","chunks":["558","static/chunks/app/layout-52917f6c941a9818.js"],"async":false},"/Users/young/Toy/idea-manager/src/app/page.tsx":{"id":9768,"name":"*","chunks":["79","static/chunks/363642f4-9eb39e0bc542c65b.js","374","static/chunks/374-769431701aab500f.js","974","static/chunks/app/page-e935ee928da68ca2.js"],"async":false},"/Users/young/Toy/idea-manager/src/app/projects/[id]/page.tsx":{"id":1048,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/Users/young/Toy/idea-manager/src/":[],"/Users/young/Toy/idea-manager/src/app/layout":[{"inlined":false,"path":"static/css/e4c7cd5a570312d9.css"}],"/Users/young/Toy/idea-manager/src/app/page":[]},"rscModuleMapping":{"484":{"*":{"id":"8562","name":"*","chunks":[],"async":false}},"1048":{"*":{"id":"8965","name":"*","chunks":[],"async":false}},"1304":{"*":{"id":"5098","name":"*","chunks":[],"async":false}},"1743":{"*":{"id":"1135","name":"*","chunks":[],"async":false}},"4581":{"*":{"id":"6237","name":"*","chunks":[],"async":false}},"4777":{"*":{"id":"3859","name":"*","chunks":[],"async":false}},"6869":{"*":{"id":"6675","name":"*","chunks":[],"async":false}},"7121":{"*":{"id":"8099","name":"*","chunks":[],"async":false}},"7123":{"*":{"id":"5547","name":"*","chunks":[],"async":false}},"8616":{"*":{"id":"7644","name":"*","chunks":[],"async":false}},"9768":{"*":{"id":"4494","name":"*","chunks":[],"async":false}}},"edgeRscModuleMapping":{}}
|