@synapse-research/synapse 0.2.2 → 0.2.3
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/bin/synapse.mjs +5 -18
- package/dist/.next/BUILD_ID +1 -1
- package/dist/.next/app-build-manifest.json +115 -115
- package/dist/.next/app-path-routes-manifest.json +31 -31
- package/dist/.next/build-manifest.json +2 -2
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/activity/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/dashboard/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/documents/[documentUuid]/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/documents/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-designs/new/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiment-runs/[runUuid]/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiments/new/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/experiments/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/insights/page.js +1 -1
- package/dist/.next/server/app/(dashboard)/research-projects/[uuid]/research-questions/page.js +1 -1
- package/dist/.next/server/app/_not-found.html +1 -1
- package/dist/.next/server/app/_not-found.rsc +1 -1
- package/dist/.next/server/app/admin/companies/new.html +1 -1
- package/dist/.next/server/app/admin/companies/new.rsc +1 -1
- package/dist/.next/server/app/admin/companies.html +1 -1
- package/dist/.next/server/app/admin/companies.rsc +1 -1
- package/dist/.next/server/app/admin.html +1 -1
- package/dist/.next/server/app/admin.rsc +1 -1
- package/dist/.next/server/app/api/mcp/route.js +3 -3
- package/dist/.next/server/app/api/research-projects/[uuid]/activity/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/available/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/documents/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/experiment-designs/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/experiment-designs/summary/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/experiment-runs/dependencies/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/experiment-runs/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/experiments/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/related-works/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/research-questions/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/[uuid]/route.js +1 -1
- package/dist/.next/server/app/api/research-projects/route.js +1 -1
- package/dist/.next/server/app/index.html +1 -1
- package/dist/.next/server/app/index.rsc +1 -1
- package/dist/.next/server/app/login/admin.html +1 -1
- package/dist/.next/server/app/login/admin.rsc +1 -1
- package/dist/.next/server/app/login/callback.html +1 -1
- package/dist/.next/server/app/login/callback.rsc +1 -1
- package/dist/.next/server/app/login/silent-refresh.html +1 -1
- package/dist/.next/server/app/login/silent-refresh.rsc +1 -1
- package/dist/.next/server/app/login.html +1 -1
- package/dist/.next/server/app/login.rsc +1 -1
- package/dist/.next/server/app/research-projects/new.html +1 -1
- package/dist/.next/server/app/research-projects/new.rsc +1 -1
- package/dist/.next/server/app/research-projects.html +1 -1
- package/dist/.next/server/app/research-projects.rsc +1 -1
- package/dist/.next/server/app/settings.html +1 -1
- package/dist/.next/server/app/settings.rsc +1 -1
- package/dist/.next/server/app-paths-manifest.json +31 -31
- package/dist/.next/server/chunks/1512.js +1 -1
- package/dist/.next/server/chunks/2653.js +1 -1
- package/dist/.next/server/chunks/759.js +1 -1
- package/dist/.next/server/chunks/7878.js +1 -1
- package/dist/.next/server/chunks/8322.js +4 -4
- package/dist/.next/server/chunks/8481.js +2 -2
- package/dist/.next/server/chunks/9993.js +1 -1
- package/dist/.next/server/middleware-manifest.json +1 -1
- package/dist/.next/server/pages/404.html +1 -1
- package/dist/.next/server/pages/500.html +1 -1
- package/package.json +1 -1
- /package/dist/.next/static/{A0gSMjwZFdpcu3AYOGpNG → JSDpzmO29w6Ket-Y2K6Nw}/_buildManifest.js +0 -0
- /package/dist/.next/static/{A0gSMjwZFdpcu3AYOGpNG → JSDpzmO29w6Ket-Y2K6Nw}/_ssgManifest.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(()=>{var a={};a.id=6827,a.ids=[6827,8112],a.modules={261:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/app-paths")},573:(a,b,c)=>{Promise.resolve().then(c.bind(c,43775)),Promise.resolve().then(c.bind(c,92851)),Promise.resolve().then(c.bind(c,11226)),Promise.resolve().then(c.bind(c,13065)),Promise.resolve().then(c.bind(c,64098)),Promise.resolve().then(c.bind(c,49442)),Promise.resolve().then(c.bind(c,66542)),Promise.resolve().then(c.bind(c,87827)),Promise.resolve().then(c.bind(c,81448)),Promise.resolve().then(c.bind(c,53392)),Promise.resolve().then(c.bind(c,97271)),Promise.resolve().then(c.bind(c,73814)),Promise.resolve().then(c.bind(c,62329)),Promise.resolve().then(c.bind(c,2768)),Promise.resolve().then(c.bind(c,1159)),Promise.resolve().then(c.bind(c,69757)),Promise.resolve().then(c.bind(c,92521)),Promise.resolve().then(c.bind(c,6873)),Promise.resolve().then(c.bind(c,10375)),Promise.resolve().then(c.bind(c,4176)),Promise.resolve().then(c.bind(c,33914)),Promise.resolve().then(c.bind(c,19868)),Promise.resolve().then(c.bind(c,32886)),Promise.resolve().then(c.bind(c,20294)),Promise.resolve().then(c.bind(c,94733)),Promise.resolve().then(c.bind(c,61298)),Promise.resolve().then(c.bind(c,8013)),Promise.resolve().then(c.bind(c,44236)),Promise.resolve().then(c.bind(c,5699)),Promise.resolve().then(c.t.bind(c,18198,23)),Promise.resolve().then(c.bind(c,53460)),Promise.resolve().then(c.bind(c,41890)),Promise.resolve().then(c.bind(c,88603)),Promise.resolve().then(c.bind(c,1322)),Promise.resolve().then(c.bind(c,67413)),Promise.resolve().then(c.bind(c,17212)),Promise.resolve().then(c.bind(c,6309))},1322:(a,b,c)=>{"use strict";c.d(b,{DesignValidationChecklist:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call DesignValidationChecklist() from the server but DesignValidationChecklist is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/design-validation-checklist.tsx","DesignValidationChecklist")},1461:(a,b,c)=>{"use strict";c.d(b,{u:()=>t});var d=c(10837),e=c(21968),f=c(41074),g=c(93555),h=c(34971),i=c(86196),j=c(23702),k=c(61848),l=c(89291),m=c(52840),n=c(85063),o=c(21345),p=c(65665),q=c(95921);let r=["hsl(var(--primary))","#22c55e","#3b82f6","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6"];function s({raw:a,chartType:b}){let c=(0,e.useMemo)(()=>(function(a){let b=a.trim().split("\n").filter(Boolean);if(b.length<2)return null;let c=b[0].includes(" ")?" ":",",d=b[0].split(c).map(a=>a.trim());if(d.length<2)return null;let e=b.slice(1).map(a=>{let b=a.split(c).map(a=>a.trim()),e={};return d.forEach((a,c)=>{let d=b[c]??"",f=Number(d);e[a]=isNaN(f)?d:f}),e}),f=d.slice(1);return e.every(a=>f.every(b=>"number"==typeof a[b]))?{type:"bar",data:e,keys:f}:null})(a),[a]);if(!c)return(0,d.jsx)("pre",{className:"overflow-x-auto rounded-lg bg-secondary p-4 text-sm",children:a});let f="line"===b?"line":c.type,g=Object.keys(c.data[0]??{})[0]??"label";return(0,d.jsx)("div",{className:"my-4 rounded-lg border border-border bg-card p-4",children:(0,d.jsx)(i.u,{width:"100%",height:300,children:"line"===f?(0,d.jsxs)(j.b,{data:c.data,children:[(0,d.jsx)(k.d,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),(0,d.jsx)(l.W,{dataKey:g,tick:{fontSize:12},stroke:"hsl(var(--muted-foreground))"}),(0,d.jsx)(m.h,{tick:{fontSize:12},stroke:"hsl(var(--muted-foreground))"}),(0,d.jsx)(n.m,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),c.keys.map((a,b)=>(0,d.jsx)(o.N1,{type:"monotone",dataKey:a,stroke:r[b%r.length],strokeWidth:2,dot:{r:3}},a))]}):(0,d.jsxs)(p.E,{data:c.data,children:[(0,d.jsx)(k.d,{strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),(0,d.jsx)(l.W,{dataKey:g,tick:{fontSize:12},stroke:"hsl(var(--muted-foreground))"}),(0,d.jsx)(m.h,{tick:{fontSize:12},stroke:"hsl(var(--muted-foreground))"}),(0,d.jsx)(n.m,{contentStyle:{background:"hsl(var(--card))",border:"1px solid hsl(var(--border))",borderRadius:8,fontSize:12}}),c.keys.map((a,b)=>(0,d.jsx)(q.yP,{dataKey:a,fill:r[b%r.length],radius:[4,4,0,0]},a))]})})})}function t({children:a}){return(0,d.jsx)(f.oz,{remarkPlugins:[g.A],rehypePlugins:[h.A],components:{h1:({children:a})=>(0,d.jsx)("h1",{className:"mt-6 mb-4 text-2xl font-bold text-foreground",children:a}),h2:({children:a})=>(0,d.jsx)("h2",{className:"mt-5 mb-3 text-xl font-semibold text-foreground",children:a}),h3:({children:a})=>(0,d.jsx)("h3",{className:"mt-4 mb-2 text-lg font-semibold text-foreground",children:a}),h4:({children:a})=>(0,d.jsx)("h4",{className:"mt-3 mb-2 text-base font-semibold text-foreground",children:a}),p:({children:a})=>(0,d.jsx)("p",{className:"my-2 leading-7",children:a}),ul:({children:a})=>(0,d.jsx)("ul",{className:"my-2 ml-6 list-disc space-y-1",children:a}),ol:({children:a})=>(0,d.jsx)("ol",{className:"my-2 ml-6 list-decimal space-y-1",children:a}),li:({children:a})=>(0,d.jsx)("li",{className:"leading-7",children:a}),blockquote:({children:a})=>(0,d.jsx)("blockquote",{className:"my-3 border-l-4 border-primary/30 pl-4 italic text-muted-foreground",children:a}),hr:()=>(0,d.jsx)("hr",{className:"my-6 border-border"}),a:({href:a,children:b})=>(0,d.jsx)("a",{href:a,className:"text-primary underline underline-offset-2 hover:text-primary/80",target:"_blank",rel:"noopener noreferrer",children:b}),strong:({children:a})=>(0,d.jsx)("strong",{className:"font-semibold text-foreground",children:a}),code({className:a,children:b,...c}){let e=/language-chart(?::(\w+))?/.exec(a||"");return e?(0,d.jsx)(s,{raw:String(b).replace(/\n$/,""),chartType:e[1]}):a?(0,d.jsx)("code",{className:a,...c,children:b}):(0,d.jsx)("code",{className:"rounded bg-secondary px-1.5 py-0.5 text-sm font-mono",...c,children:b})},pre:({children:a})=>(0,d.jsx)("pre",{className:"overflow-x-auto rounded-lg bg-secondary/80 p-4 text-sm",children:a}),table:({children:a})=>(0,d.jsx)("div",{className:"my-4 overflow-x-auto rounded-lg border border-border",children:(0,d.jsx)("table",{className:"min-w-full text-sm",children:a})}),thead:({children:a})=>(0,d.jsx)("thead",{className:"border-b border-border bg-secondary/50",children:a}),th:({children:a})=>(0,d.jsx)("th",{className:"whitespace-nowrap px-4 py-2.5 text-left text-xs font-semibold text-muted-foreground",children:a}),td:({children:a})=>(0,d.jsx)("td",{className:"px-4 py-2.5 text-foreground border-b border-border/30",children:a}),img:({src:a,alt:b})=>(0,d.jsxs)("span",{className:"my-4 block",children:[(0,d.jsx)("img",{src:a,alt:b||"",className:"max-w-full rounded-lg border border-border",loading:"lazy"}),b&&(0,d.jsx)("span",{className:"mt-1 block text-center text-xs text-muted-foreground",children:b})]})},children:a})}},1708:a=>{"use strict";a.exports=require("node:process")},3295:a=>{"use strict";a.exports=require("next/dist/server/app-render/after-task-async-storage.external.js")},4045:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},4133:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{k:()=>m,n:()=>n});var e=c(2613);c(50785);var f=c(9259),g=c(466),h=c(15369),i=c(67738),j=c(97307),k=c(12217),l=a([f,g,h,i]);[f,g,h,i]=l.then?(await l)():l;let o=j.vF.child({module:"research_question"});async function m(a){let b=await (0,f.d)();if(!b)return{comments:[],total:0};try{return await (0,g.fg)({companyUuid:b.companyUuid,targetType:"research_question",targetUuid:a,skip:0,take:100})}catch(a){return o.error({err:a},"Failed to get idea comments"),{comments:[],total:0}}}async function n(a,b){let c=await (0,f.d)();if(!c)return{success:!1,error:"Unauthorized"};if(!b.trim())return{success:!1,error:"Comment content is required"};try{let d=await (0,h._W)(c.companyUuid,a);if(!d)return{success:!1,error:"Idea not found"};let e=await (0,g.eT)({companyUuid:c.companyUuid,targetType:"research_question",targetUuid:a,content:b.trim(),authorType:c.type,authorUuid:c.actorUuid});return await (0,i.createActivity)({companyUuid:c.companyUuid,researchProjectUuid:d.researchProjectUuid,targetType:"research_question",targetUuid:a,actorType:c.type,actorUuid:c.actorUuid,action:"comment_added"}),{success:!0,comment:e}}catch(a){return o.error({err:a},"Failed to create idea comment"),{success:!1,error:"Failed to create comment"}}}(0,k.D)([m,n]),(0,e.A)(m,"4011018a1c0a397f619a0d0f28f49a61730f474874",null),(0,e.A)(n,"60a3f1338a100846860fe056719a21232d69b3ce75",null),d()}catch(a){d(a)}})},4284:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255);c(62729);var e=c(27138),f=a([d,e]);[d,e]=f.then?(await f)():f,b()}catch(a){b(a)}})},4573:a=>{"use strict";a.exports=require("node:buffer")},5486:a=>{"use strict";a.exports=require("bcrypt")},6070:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{D:()=>S});var e=c(10837),f=c(21968),g=c(1007),h=c(81512),i=c.n(h),j=c(9222),k=c(24364),l=c(87461),m=c(10694),n=c(16235),o=c(86460),p=c(97443),q=c(24714),r=c(9810),s=c(65956),t=c(79543),u=c(49599),v=c(42424),w=c(9994),x=c(20170),y=c(2852),z=c(74645),A=c(84819),B=c(10297),C=c(11568),D=c(6019),E=c(80251),F=c(12793),G=c(94521);c(85292);var H=c(41709),I=c(83457),J=c(82831),K=c(24433),L=c(97601),M=c(53376),N=c(13537),O=c(12351),P=c(76172),Q=a([I,J]);[I,J]=Q.then?(await Q)():Q;let T={open:"bg-[#FFF3E0] text-[#E65100]",elaborating:"bg-[#E3F2FD] text-[#1976D2]",proposal_created:"bg-[#F3E5F5] text-[#7B1FA2]",completed:"bg-[#E0F2F1] text-[#00796B]",closed:"bg-[#F5F5F5] text-[#9A9A9A]"},U={open:"open",elaborating:"elaborating",proposal_created:"proposal_created",completed:"completed",closed:"closed"};function R(a,b){let c=new Date(a),d=new Date().getTime()-c.getTime(),e=Math.floor(d/6e4),f=Math.floor(d/36e5),g=Math.floor(d/864e5);return e<1?b("time.justNow"):e<60?b("time.minutesAgo",{minutes:e}):f<24?b("time.hoursAgo",{hours:f}):g<7?b("time.daysAgo",{days:g}):c.toLocaleDateString()}function S({idea:a,projectUuid:b,currentUserUuid:c,onClose:d,onDeleted:h}){let Q=(0,j.c)(),S=(0,g.useRouter)(),[V,W]=(0,f.useState)(""),[X,Y]=(0,f.useState)([]),[Z,$]=(0,f.useState)(!0),[_,aa]=(0,f.useState)(!1),ab=(0,f.useRef)(null),[ac,ad]=(0,f.useState)([]),[ae,af]=(0,f.useState)(!0),[ag,ah]=(0,f.useState)(!1),[ai,aj]=(0,f.useState)(null),ak=(0,f.useCallback)(async()=>{let b=await (0,N.R)(a.uuid);b.success&&b.data&&aj(b.data)},[a.uuid]);(0,P.l9)(ak),(0,P.w0)("research_question",a.uuid,b=>{b.actorUuid!==c&&(0,F.k)(a.uuid).then(a=>{Y(a.comments)})});let[al,am]=(0,f.useState)(!1),[an,ao]=(0,f.useState)(""),[ap,aq]=(0,f.useState)(!1),[ar,as]=(0,f.useState)(null),[at,au]=(0,f.useState)(!1),[av,aw]=(0,f.useState)(a.title),[ax,ay]=(0,f.useState)(a.content||""),[az,aA]=(0,f.useState)(!1),[aB,aC]=(0,f.useState)(null),[aD,aE]=(0,f.useState)(!1),[aF,aG]=(0,f.useState)(!1),[aH,aI]=(0,f.useState)([]),[aJ,aK]=(0,f.useState)(!1),[aL,aM]=(0,f.useState)(null),[aN,aO]=(0,f.useState)(!1),[aP,aQ]=(0,f.useState)(null),[aR,aS]=(0,f.useState)(!1),aT="completed"!==a.status&&"closed"!==a.status,aU="resolved"===a.elaborationStatus,aV=("elaborating"===a.status||"proposal_created"===a.status||"completed"===a.status)&&aU,aW="elaborating"===a.status&&(!a.elaborationStatus||"resolved"!==a.elaborationStatus)&&a.assignee?.uuid===c,aX="completed"!==a.status&&"closed"!==a.status,aY=async()=>{if(!V.trim()||_)return;aa(!0);let b=await (0,G.n)(a.uuid,V);aa(!1),b.success&&b.comment&&(Y(a=>[...a,b.comment]),W(""),ab.current?.clear())},aZ=()=>{au(!1),aw(a.title),ay(a.content||""),aC(null)},a$=async()=>{if(!av.trim())return void aC(Q("ideas.titleRequired"));aA(!0),aC(null);try{let b=await fetch(`/api/research-questions/${a.uuid}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:av.trim(),content:ax.trim()||null})});aA(!1),b.ok?(au(!1),S.refresh()):aC(Q("ideas.updateFailed"))}catch{aA(!1),aC(Q("ideas.updateFailed"))}},a_=async()=>{aE(!0);try{let b=await fetch(`/api/research-questions/${a.uuid}`,{method:"DELETE"});aE(!1),b.ok&&(h?.(),d(),S.refresh())}catch{aE(!1)}},a0=async()=>{if(!an.trim())return void as(Q("elaboration.skipReasonRequired"));aq(!0),as(null);let b=await (0,O.s)(a.uuid,an.trim());aq(!1),b.success?(am(!1),ao(""),S.refresh()):as(b.error||Q("common.genericError"))},a1=async()=>{aG(!0),aM(null),aQ(null),aK(!0);try{let[a,c]=await Promise.all([fetch("/api/research-projects?pageSize=100"),fetch("/api/project-groups")]),[d,e]=await Promise.all([a.json(),c.json()]);if(d.success){let a=d.data.filter(a=>a.uuid!==b).map(a=>({uuid:a.uuid,name:a.name,groupUuid:a.groupUuid})),c=new Map;if(e.success)for(let a of e.data.groups||e.data)c.set(a.uuid,a.name);let f=new Map,g=[];for(let b of a)b.groupUuid&&c.has(b.groupUuid)?(f.has(b.groupUuid)||f.set(b.groupUuid,{uuid:b.groupUuid,name:c.get(b.groupUuid),projects:[]}),f.get(b.groupUuid).projects.push({uuid:b.uuid,name:b.name})):g.push({uuid:b.uuid,name:b.name});let h=[...f.values()];g.length>0&&h.push({uuid:"ungrouped",name:Q("ideas.ungrouped"),projects:g}),aI(h)}}catch{aI([])}aK(!1)},a2=async()=>{if(aL&&!aN){aO(!0),aQ(null);try{let b=await fetch(`/api/research-questions/${a.uuid}/move`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetProjectUuid:aL.uuid})}),c=await b.json();c.success?(aG(!1),d(),S.refresh()):aQ("string"==typeof c.error?c.error:c.error?.message||Q("ideas.moveFailed"))}catch{aQ(Q("ideas.moveFailed"))}aO(!1)}};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:d}),(0,e.jsxs)("div",{className:`fixed right-0 top-14 md:top-0 z-50 flex h-[calc(100%-3.5rem)] md:h-full w-full md:w-[480px] flex-col bg-white shadow-xl border-l border-[#E5E0D8] ${aR?"":"animate-in slide-in-from-right duration-300"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-[#F5F2EC] px-6 py-5",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:at?(0,e.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C]",children:Q("ideas.editIdea")}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C] truncate",children:a.title}),(0,e.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,e.jsx)(u.E,{className:T[a.status]||"",children:Q(`status.${U[a.status]||a.status}`)}),(0,e.jsx)("span",{className:"text-xs text-[#9A9A9A]",children:new Date(a.createdAt).toLocaleDateString()})]})]})}),(0,e.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[aX&&!at&&(0,e.jsx)(v.$,{variant:"outline",size:"icon",className:"h-8 w-8 border-[#E5E0D8]",onClick:a1,title:Q("ideas.moveToProject"),children:(0,e.jsx)(k.A,{className:"h-4 w-4 text-[#6B6B6B]"})}),aX&&!at&&(0,e.jsx)(v.$,{variant:"outline",size:"icon",className:"h-8 w-8 border-[#E5E0D8]",onClick:()=>{aw(a.title),ay(a.content||""),aC(null),au(!0)},children:(0,e.jsx)(l.A,{className:"h-4 w-4 text-[#6B6B6B]"})}),(0,e.jsx)(v.$,{variant:"outline",size:"icon",className:"h-8 w-8 border-[#E5E0D8]",onClick:at?aZ:d,children:(0,e.jsx)(m.A,{className:"h-4 w-4 text-[#6B6B6B]"})})]})]}),(0,e.jsx)(z.F,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:(0,e.jsx)("div",{className:"flex min-h-full flex-col px-6 py-5",children:at?(0,e.jsxs)("div",{className:"space-y-5",children:[aB&&(0,e.jsx)("div",{className:"rounded-lg bg-destructive/10 p-3 text-sm text-destructive",children:aB}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(y.J,{htmlFor:"edit-title",className:"text-[13px] font-medium text-[#2C2C2C]",children:Q("ideas.titleLabel")}),(0,e.jsx)(w.p,{id:"edit-title",value:av,onChange:a=>aw(a.target.value),className:"border-[#E5E0D8] text-sm focus-visible:ring-[#C67A52]",autoFocus:!0})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(y.J,{htmlFor:"edit-content",className:"text-[13px] font-medium text-[#2C2C2C]",children:Q("common.content")}),(0,e.jsx)(x.T,{id:"edit-content",value:ax,onChange:a=>ay(a.target.value),rows:8,className:"border-[#E5E0D8] text-sm resize-none focus-visible:ring-[#C67A52]"})]})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:Q("common.assignee")}),(0,e.jsx)("div",{className:"mt-2 flex items-center gap-2.5 rounded-lg bg-[#FAF8F4] p-3",children:a.assignee?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(E.eu,{className:"h-7 w-7",children:(0,e.jsx)(E.q5,{className:"agent"===a.assignee.type?"bg-[#C67A52] text-white":"bg-[#E5E0D8] text-[#6B6B6B]",children:"agent"===a.assignee.type?(0,e.jsx)(n.A,{className:"h-3.5 w-3.5"}):a.assignee.name.charAt(0).toUpperCase()})}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"text-sm font-medium text-[#2C2C2C]",children:a.assignee.name}),(0,e.jsx)("div",{className:"text-xs text-[#6B6B6B]",children:"agent"===a.assignee.type?`${Q("common.agent")} • ${a.assignee.assignedAt?new Date(a.assignee.assignedAt).toLocaleDateString():""}`:Q("common.user")})]})]}):(0,e.jsx)("span",{className:"text-sm text-[#9A9A9A]",children:Q("common.unassigned")})})]}),ai&&ai.rounds.length>0&&(0,e.jsx)("div",{className:"mt-5",children:(0,e.jsx)(M.R,{questionUuid:a.uuid,elaboration:ai,onRefresh:async()=>{let b=await (0,N.R)(a.uuid);b.success&&b.data&&aj(b.data)}})}),(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:Q("common.content")}),(0,e.jsx)("div",{className:"mt-2",children:a.content?(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[13px] leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(H.jH,{plugins:{code:I.a},children:a.content})}):(0,e.jsx)("p",{className:"text-sm italic text-[#9A9A9A]",children:Q("common.noContent")})})]}),(0,e.jsxs)("div",{className:"mt-5 flex-1",children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:Q("common.activity")}),(0,e.jsx)("div",{className:"mt-2 space-y-3",children:ae?(0,e.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,e.jsx)(o.A,{className:"h-4 w-4 animate-spin text-[#9A9A9A]"})}):0===ac.length?(0,e.jsx)("p",{className:"text-sm text-[#9A9A9A] italic",children:Q("common.noActivity")}):ac.map(a=>(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)("div",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-[#F5F2EC]",children:(0,e.jsx)("div",{className:`h-2 w-2 rounded-full ${function(a){switch(a){case"idea_created":return"bg-[#C67A52]";case"idea_assigned":case"idea_claimed":return"bg-[#1976D2]";case"idea_started":return"bg-[#5A9E6F]";case"idea_completed":return"bg-[#00796B]";case"idea_released":return"bg-[#E65100]";default:return"bg-[#6B6B6B]"}}(a.action)}`})}),(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("p",{className:"text-xs text-[#2C2C2C]",children:function(a,b){let{action:c,actorName:d}=a;switch(c){case"idea_created":return b("activity.ideaCreated",{actor:d});case"idea_assigned":return b("activity.ideaAssigned",{actor:d});case"idea_claimed":return b("activity.ideaClaimed",{actor:d});case"idea_released":return b("activity.ideaReleased",{actor:d});case"idea_status_changed":return b("activity.ideaStatusChanged",{actor:d});default:return`${d}: ${c}`}}(a,Q)}),(0,e.jsx)("p",{className:"text-[10px] text-[#9A9A9A]",children:R(a.createdAt,Q)})]})]},a.uuid))})]}),(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:Q("comments.title")}),(0,e.jsx)("div",{className:"mt-3 space-y-3",children:Z?(0,e.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,e.jsx)(o.A,{className:"h-4 w-4 animate-spin text-[#9A9A9A]"})}):0===X.length?(0,e.jsx)("p",{className:"text-sm text-[#9A9A9A] italic",children:Q("comments.noComments")}):X.map(a=>(0,e.jsxs)("div",{className:"flex gap-2.5",children:[(0,e.jsx)(E.eu,{className:"h-6 w-6 shrink-0",children:(0,e.jsx)(E.q5,{className:"agent"===a.author.type?"bg-[#C67A52] text-white":"bg-[#E5E0D8] text-[#6B6B6B] text-[10px]",children:"agent"===a.author.type?(0,e.jsx)(n.A,{className:"h-3 w-3"}):a.author.name.charAt(0).toUpperCase()})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-[#2C2C2C]",children:a.author.name}),(0,e.jsx)("span",{className:"text-[10px] text-[#9A9A9A]",children:R(a.createdAt,Q)})]}),(0,e.jsx)("div",{className:"mt-1 text-xs leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(J.z7,{children:a.content})})]})]},a.uuid))}),(0,e.jsx)(A.Separator,{className:"my-3 bg-[#F5F2EC]"}),(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(E.eu,{className:"mt-1.5 h-6 w-6",children:(0,e.jsx)(E.q5,{className:"bg-[#C67A52] text-white text-[10px]",children:(0,e.jsx)(p.A,{className:"h-3 w-3"})})}),(0,e.jsx)("div",{className:"flex-1",children:(0,e.jsx)(K.c,{ref:ab,value:V,onChange:W,onSubmit:aY,placeholder:Q("comments.addComment"),className:"border-none bg-[#FAF8F4] text-sm",disabled:_})}),(0,e.jsx)(v.$,{size:"icon",variant:"ghost",className:"mt-1 h-7 w-7",disabled:!V.trim()||_,onClick:aY,children:_?(0,e.jsx)(o.A,{className:"h-3.5 w-3.5 animate-spin text-[#9A9A9A]"}):(0,e.jsx)(q.A,{className:"h-3.5 w-3.5 text-[#C67A52]"})})]})]})]})})}),(0,e.jsx)("div",{className:"border-t border-[#F5F2EC] px-6 py-4",children:(0,e.jsx)("div",{className:"flex items-center gap-3",children:at?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:aZ,disabled:az,children:Q("common.cancel")}),(0,e.jsx)(v.$,{className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",onClick:a$,disabled:az||!av.trim(),children:az?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{className:"mr-2 h-4 w-4 animate-spin"}),Q("common.saving")]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(r.A,{className:"mr-2 h-4 w-4"}),Q("ideas.saveChanges")]})})]}):(0,e.jsxs)(e.Fragment,{children:[aT&&(0,e.jsxs)(v.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:()=>ah(!0),children:[(0,e.jsx)(p.A,{className:"mr-2 h-4 w-4"}),a.assignee?Q("common.reassign"):Q("common.assign")]}),aW&&(0,e.jsx)(v.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:()=>{ao(""),as(null),am(!0)},children:Q("elaboration.skipButton")}),aV&&(0,e.jsx)(i(),{href:`/research-projects/${b}/experiment-designs/new?questionUuid=${a.uuid}`,children:(0,e.jsxs)(v.$,{className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:[(0,e.jsx)(s.A,{className:"mr-2 h-4 w-4"}),Q("proposals.createExperimentDesign")]})}),"elaborating"===a.status&&!aU&&!aW&&(0,e.jsx)("div",{className:"text-xs text-[#9A9A9A]",children:Q("elaboration.elaborationRequiredHint")}),"completed"===a.status||"closed"===a.status?(0,e.jsx)("div",{className:"text-sm text-[#9A9A9A] text-center w-full",children:"completed"===a.status?Q("status.completed"):Q("status.closed")}):null,(0,e.jsx)("div",{className:"ml-auto",children:(0,e.jsxs)(D.Lt,{children:[(0,e.jsx)(D.tv,{asChild:!0,children:(0,e.jsx)(v.$,{variant:"outline",size:"icon",className:"h-9 w-9 border-[#E5E0D8] text-[#D32F2F] hover:bg-[#FFEBEE] hover:text-[#D32F2F] hover:border-[#D32F2F]",children:(0,e.jsx)(t.A,{className:"h-4 w-4"})})}),(0,e.jsxs)(D.EO,{children:[(0,e.jsxs)(D.wd,{children:[(0,e.jsx)(D.r7,{children:Q("ideas.deleteResearchQuestion")}),(0,e.jsx)(D.$v,{children:Q("ideas.deleteResearchQuestionConfirm",{title:a.title})})]}),(0,e.jsxs)(D.ck,{children:[(0,e.jsx)(D.Zr,{children:Q("common.cancel")}),(0,e.jsx)(D.Rx,{variant:"destructive",onClick:a_,disabled:aD,children:aD?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{className:"mr-2 h-4 w-4 animate-spin"}),Q("common.delete")]}):Q("common.delete")})]})]})]})})]})})})]}),(0,e.jsx)(D.Lt,{open:al,onOpenChange:am,children:(0,e.jsxs)(D.EO,{children:[(0,e.jsxs)(D.wd,{children:[(0,e.jsx)(D.r7,{children:Q("elaboration.skipConfirmTitle")}),(0,e.jsx)(D.$v,{children:Q("elaboration.skipConfirmDescription")})]}),(0,e.jsxs)("div",{className:"space-y-2 py-2",children:[(0,e.jsx)(y.J,{htmlFor:"skip-reason",className:"text-[13px] font-medium text-[#2C2C2C]",children:Q("elaboration.skipReasonLabel")}),(0,e.jsx)(w.p,{id:"skip-reason",value:an,onChange:a=>{ao(a.target.value),ar&&as(null)},placeholder:Q("elaboration.skipReasonPlaceholder"),className:"border-[#E5E0D8] text-sm focus-visible:ring-[#C67A52]",autoFocus:!0}),ar&&(0,e.jsx)("p",{className:"text-xs text-destructive",children:ar})]}),(0,e.jsxs)(D.ck,{children:[(0,e.jsx)(D.Zr,{disabled:ap,children:Q("common.cancel")}),(0,e.jsx)(D.Rx,{onClick:a=>{a.preventDefault(),a0()},disabled:ap||!an.trim(),className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:ap?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{className:"mr-2 h-4 w-4 animate-spin"}),Q("common.processing")]}):Q("elaboration.skipButton")})]})]})}),(0,e.jsx)(C.lG,{open:aF,onOpenChange:aG,children:(0,e.jsxs)(C.Cf,{children:[(0,e.jsxs)(C.c7,{children:[(0,e.jsx)(C.L3,{children:Q("ideas.moveIdeaTitle")}),(0,e.jsx)(C.rr,{children:Q("ideas.moveIdeaDescription")})]}),aP&&(0,e.jsx)("p",{className:"text-xs text-destructive",children:aP}),aJ?(0,e.jsx)("div",{className:"flex items-center justify-center h-[320px] border border-[#E5E0D8] rounded-lg",children:(0,e.jsx)(o.A,{className:"h-4 w-4 animate-spin text-[#9A9A9A]"})}):(0,e.jsxs)(B.uB,{className:"border border-[#E5E0D8] rounded-lg",filter:(a,b,c)=>{let d=b.toLowerCase();return a.toLowerCase().includes(d)||c?.some(a=>a.toLowerCase().includes(d))?1:0},children:[(0,e.jsx)(B.G7,{placeholder:Q("ideas.searchProjects")}),(0,e.jsxs)(B.oI,{className:"h-[280px]",children:[(0,e.jsx)(B.xL,{children:Q("ideas.noProjectsFound")}),aH.map(a=>(0,e.jsx)(B.L$,{heading:a.name,children:a.projects.map(b=>(0,e.jsxs)(B.h_,{value:b.name,keywords:[a.name],onSelect:()=>aM(b),className:aL?.uuid===b.uuid?"bg-[#C67A52] text-white data-[selected=true]:bg-[#B56A42] data-[selected=true]:text-white":"",children:[(0,e.jsx)(r.A,{className:`mr-2 h-4 w-4 ${aL?.uuid===b.uuid?"opacity-100":"opacity-0"}`}),b.name]},b.uuid))},a.uuid))]})]}),(0,e.jsxs)("div",{className:"flex justify-end gap-3 pt-2",children:[(0,e.jsx)(v.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:()=>aG(!1),disabled:aN,children:Q("common.cancel")}),(0,e.jsx)(v.$,{className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",onClick:a2,disabled:!aL||aN,children:aN?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{className:"mr-2 h-4 w-4 animate-spin"}),Q("ideas.moving")]}):Q("ideas.moveToProject")})]})]})}),ag&&(0,e.jsx)(L.i,{idea:{uuid:a.uuid,title:a.title,content:a.content,status:a.status,assignee:a.assignee?{type:a.assignee.type,uuid:a.assignee.uuid,name:a.assignee.name}:null},projectUuid:b,currentUserUuid:c,onClose:()=>{ah(!1),d()}})]})}d()}catch(a){d(a)}})},6309:(a,b,c)=>{"use strict";c.d(b,{Separator:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call Separator() from the server but Separator is 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.")},"/home/ubuntu/Synapse/src/components/ui/separator.tsx","Separator")},6511:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{R:()=>m,c8:()=>n,sW:()=>o});var e=c(2613);c(50785);var f=c(5562),g=c(9259),h=c(9480),i=c(15369),j=c(97307),k=c(12217),l=a([g,h,i]);[g,h,i]=l.then?(await l)():l;let p=j.vF.child({module:"research_question"});async function m(a){let b=await (0,g.d)();if(!b)return{success:!1,error:"Unauthorized"};try{let c=await (0,h.LI)({companyUuid:b.companyUuid,researchQuestionUuid:a});return{success:!0,data:c}}catch(a){return p.error({err:a},"Failed to get elaboration"),{success:!1,error:a instanceof Error?a.message:"Failed to get elaboration"}}}async function n(a,b,c){let d=await (0,g.d)();if(!d)return{success:!1,error:"Unauthorized"};try{let e=await (0,h.nQ)({companyUuid:d.companyUuid,researchQuestionUuid:a,roundUuid:b,actorUuid:d.actorUuid,actorType:d.type,answers:c}),g=await (0,i.ol)(d.companyUuid,a);return g&&((0,f.revalidatePath)(`/research-projects/${g.researchProjectUuid}/research-questions/${a}`),(0,f.revalidatePath)(`/research-projects/${g.researchProjectUuid}/research-questions`)),{success:!0,data:e}}catch(a){return p.error({err:a},"Failed to submit elaboration answers"),{success:!1,error:a instanceof Error?a.message:"Failed to submit answers"}}}async function o(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{await (0,h.m)({companyUuid:c.companyUuid,researchQuestionUuid:a,actorUuid:c.actorUuid,actorType:c.type,reason:b});let d=await (0,i.ol)(c.companyUuid,a);return d&&((0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/research-questions/${a}`),(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/research-questions`)),{success:!0}}catch(a){return p.error({err:a},"Failed to skip elaboration"),{success:!1,error:a instanceof Error?a.message:"Failed to skip elaboration"}}}(0,k.D)([m,n,o]),(0,e.A)(m,"40100bfdbae4e8dda08100983a865107b49118eeb4",null),(0,e.A)(n,"707a4a486695fd0b49c89e5eeec64dc88d3093c6dd",null),(0,e.A)(o,"60271778b05e6dbedf1923fed6f941bf38aab81d09",null),d()}catch(a){d(a)}})},7667:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{CL:()=>m,IK:()=>t,Lx:()=>v,RE:()=>n,S$:()=>u,UY:()=>r,dj:()=>p,eZ:()=>o,fZ:()=>q,ji:()=>w,wq:()=>s});var e=c(2613);c(50785);var f=c(5562),g=c(9259),h=c(90097),i=c(67738),j=c(97307),k=c(12217),l=a([g,h,i]);[g,h,i]=l.then?(await l)():l;let x=j.vF.child({module:"experiment_design"});async function m(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{let d=await (0,h.Qr)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};if("pending"!==d.status)return{success:!1,error:"Proposal is not pending review"};return await (0,h.Xw)(a,c.companyUuid,c.actorUuid,b||null),await (0,i.createActivity)({companyUuid:c.companyUuid,researchProjectUuid:d.researchProjectUuid,targetType:"experiment_design",targetUuid:a,actorType:c.type,actorUuid:c.actorUuid,action:"approved",value:b?{reviewNote:b}:void 0}),(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs/${a}`),(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs`),{success:!0}}catch(a){return x.error({err:a},"Failed to approve proposal"),{success:!1,error:"Failed to approve proposal"}}}async function n(a){let b=await (0,g.d)();if(!b)return{success:!1,error:"Unauthorized"};try{let c=await (0,h.Qr)(b.companyUuid,a);if(!c)return{success:!1,error:"Proposal not found"};if("draft"!==c.status)return{success:!1,error:"Proposal is not in draft status"};return await (0,h.sp)(a,b.companyUuid),(0,f.revalidatePath)(`/research-projects/${c.researchProjectUuid}/experiment-designs/${a}`),(0,f.revalidatePath)(`/research-projects/${c.researchProjectUuid}/experiment-designs`),{success:!0}}catch(a){return x.error({err:a},"Failed to submit proposal"),{success:!1,error:"Failed to submit proposal"}}}async function o(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{let d=await (0,h.Qr)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};if("pending"!==d.status)return{success:!1,error:"Proposal is not pending review"};return await (0,h.x7)(a,c.actorUuid,b||""),await (0,i.createActivity)({companyUuid:c.companyUuid,researchProjectUuid:d.researchProjectUuid,targetType:"experiment_design",targetUuid:a,actorType:c.type,actorUuid:c.actorUuid,action:"rejected_to_draft",value:b?{reviewNote:b}:void 0}),(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs/${a}`),(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs`),{success:!0}}catch(a){return x.error({err:a},"Failed to reject proposal"),{success:!1,error:"Failed to reject proposal"}}}async function p(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{let d=await (0,h.Qr)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};if("pending"!==d.status)return{success:!1,error:"Proposal is not pending review"};return await (0,h.ci)(a,c.actorUuid,b),(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs/${a}`),(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs`),{success:!0}}catch(a){return x.error({err:a},"Failed to close proposal"),{success:!1,error:"Failed to close proposal"}}}async function q(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{if(!await (0,h.Qr)(c.companyUuid,a))return{success:!1,error:"Proposal not found"};return await (0,h.xv)(a,c.companyUuid),(0,f.revalidatePath)(`/research-projects/${b}/experiment-designs`),{success:!0}}catch(a){return x.error({err:a},"Failed to delete proposal"),{success:!1,error:"Failed to delete proposal"}}}async function r(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{let d=await (0,h.Qr)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};let e=await (0,h.M9)(a,c.companyUuid,b);return(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs/${a}`),{success:!0,proposal:e}}catch(a){return x.error({err:a},"Failed to add document draft"),{success:!1,error:a instanceof Error?a.message:"Failed to add document draft"}}}async function s(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{let d=await (0,h.Qr)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};let e=await (0,h.EN)(a,c.companyUuid,b);return(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs/${a}`),{success:!0,proposal:e}}catch(a){return x.error({err:a},"Failed to add task draft"),{success:!1,error:a instanceof Error?a.message:"Failed to add task draft"}}}async function t(a,b,c){let d=await (0,g.d)();if(!d)return{success:!1,error:"Unauthorized"};try{let e=await (0,h.Qr)(d.companyUuid,a);if(!e)return{success:!1,error:"Proposal not found"};let g=await (0,h.gT)(a,d.companyUuid,b,c);return(0,f.revalidatePath)(`/research-projects/${e.researchProjectUuid}/experiment-designs/${a}`),{success:!0,proposal:g}}catch(a){return x.error({err:a},"Failed to update document draft"),{success:!1,error:a instanceof Error?a.message:"Failed to update document draft"}}}async function u(a,b,c){let d=await (0,g.d)();if(!d)return{success:!1,error:"Unauthorized"};try{let e=await (0,h.Qr)(d.companyUuid,a);if(!e)return{success:!1,error:"Proposal not found"};let g=await (0,h.wZ)(a,d.companyUuid,b,c);return(0,f.revalidatePath)(`/research-projects/${e.researchProjectUuid}/experiment-designs/${a}`),{success:!0,proposal:g}}catch(a){return x.error({err:a},"Failed to update task draft"),{success:!1,error:a instanceof Error?a.message:"Failed to update task draft"}}}async function v(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{let d=await (0,h.Qr)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};let e=await (0,h.nW)(a,c.companyUuid,b);return(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs/${a}`),{success:!0,proposal:e}}catch(a){return x.error({err:a},"Failed to remove document draft"),{success:!1,error:a instanceof Error?a.message:"Failed to remove document draft"}}}async function w(a,b){let c=await (0,g.d)();if(!c)return{success:!1,error:"Unauthorized"};try{let d=await (0,h.Qr)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};let e=await (0,h.Z4)(a,c.companyUuid,b);return(0,f.revalidatePath)(`/research-projects/${d.researchProjectUuid}/experiment-designs/${a}`),{success:!0,proposal:e}}catch(a){return x.error({err:a},"Failed to remove task draft"),{success:!1,error:a instanceof Error?a.message:"Failed to remove task draft"}}}(0,k.D)([m,n,o,p,q,r,s,t,u,v,w]),(0,e.A)(m,"60384ebcd42431ae2748ac9aa2c5e4547deb67f37f",null),(0,e.A)(n,"40348a47e9c6d517853417ec881a0cf018000a74e6",null),(0,e.A)(o,"60b89233272953b0e6a6a7139329648c8a8cc068f3",null),(0,e.A)(p,"600dbf09f310464450650ac57bbaaf97bfc4995b91",null),(0,e.A)(q,"6026e770a51d2b511dbddb2d1e583ca13beca7d374",null),(0,e.A)(r,"6036b14c7a0b485d68bb436fcc5c9a726686abd8c6",null),(0,e.A)(s,"6099501305ac6eaccd915d3909faeba37aef0a6a81",null),(0,e.A)(t,"70706397cc55ec694918ffe090cec7e476c444e25a",null),(0,e.A)(u,"7001eb4571b8964fd95ad3b7fcbbd3a2195e7de288",null),(0,e.A)(v,"60e8964f43a0c46fd7eb5bd44d07a1998e66e2269c",null),(0,e.A)(w,"607ac07f8a321d8f99cd779629db2138ea431c900d",null),d()}catch(a){d(a)}})},8086:a=>{"use strict";a.exports=require("module")},8176:(a,b,c)=>{"use strict";c.r(b),c.d(b,{GlobalError:()=>D.a,__next_app__:()=>J,handler:()=>L,pages:()=>I,routeModule:()=>K,tree:()=>H});var d=c(76929),e=c(30630),f=c(59862),g=c(91959),h=c(8877),i=c(57717),j=c(85532),k=c(38317),l=c(80605),m=c(41431),n=c(28259),o=c(40740),p=c(16002),q=c(66271),r=c(261),s=c(81958),t=c(26331),u=c(26713),v=c(39959),w=c(76644),x=c(23640),y=c(68249),z=c(30143),A=c(47653),B=c(86439),C=c(29723),D=c.n(C),E=c(39303),F=c(79254),G={};for(let a in E)0>["default","tree","pages","GlobalError","__next_app__","routeModule","handler"].indexOf(a)&&(G[a]=()=>E[a]);c.d(b,G);let H={children:["",{children:["(dashboard)",{children:["research-projects",{children:["[uuid]",{children:["experiment-designs",{children:["[designUuid]",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(c.bind(c,17258)),"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/page.tsx"]}]},{}]},{}]},{loading:[()=>Promise.resolve().then(c.bind(c,42733)),"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/loading.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(c.bind(c,16352)),"/home/ubuntu/Synapse/src/app/(dashboard)/layout.tsx"],loading:[()=>Promise.resolve().then(c.bind(c,69436)),"/home/ubuntu/Synapse/src/app/(dashboard)/loading.tsx"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,3155,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,37942,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,1537,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,33367))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(c.bind(c,40340)),"/home/ubuntu/Synapse/src/app/layout.tsx"],"global-error":[()=>Promise.resolve().then(c.t.bind(c,29723,23)),"next/dist/client/components/builtin/global-error.js"],"not-found":[()=>Promise.resolve().then(c.t.bind(c,3155,23)),"next/dist/client/components/builtin/not-found.js"],forbidden:[()=>Promise.resolve().then(c.t.bind(c,37942,23)),"next/dist/client/components/builtin/forbidden.js"],unauthorized:[()=>Promise.resolve().then(c.t.bind(c,1537,23)),"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await Promise.resolve().then(c.bind(c,33367))).default(a)],apple:[],openGraph:[],twitter:[],manifest:void 0}}]}.children,I=["/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/page.tsx"],J={require:c,loadChunk:()=>Promise.resolve()},K=new d.AppPageRouteModule({definition:{kind:e.RouteKind.APP_PAGE,page:"/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/page",pathname:"/research-projects/[uuid]/experiment-designs/[designUuid]",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:H},distDir:".next",relativeProjectDir:""});async function L(a,b,d){var C;let G="/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/page";"/index"===G&&(G="/");let M=(0,h.getRequestMeta)(a,"postponed"),N=(0,h.getRequestMeta)(a,"minimalMode"),O=await K.prepare(a,b,{srcPage:G,multiZoneDraftMode:!1});if(!O)return b.statusCode=400,b.end("Bad Request"),null==d.waitUntil||d.waitUntil.call(d,Promise.resolve()),null;let{buildId:P,query:Q,params:R,parsedUrl: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,interceptionRoutePatterns:ae}=O,af=S.pathname||"/",ag=(0,r.normalizeAppPath)(G),{isOnDemandRevalidate:ah}=O,ai=K.match(af,$),aj=!!$.routes[aa],ak=!!(ai||aj||$.routes[ag]),al=a.headers["user-agent"]||"",am=(0,u.getBotType)(al),an=(0,p.isHtmlBotRequest)(a),ao=(0,h.getRequestMeta)(a,"isPrefetchRSCRequest")??"1"===a.headers[t.NEXT_ROUTER_PREFETCH_HEADER],ap=(0,h.getRequestMeta)(a,"isRSCRequest")??!!a.headers[t.RSC_HEADER],aq=(0,s.getIsPossibleServerAction)(a),ar=(0,m.checkIsAppPPREnabled)(ad.experimental.ppr)&&(null==(C=$.routes[ag]??$.dynamicRoutes[ag])?void 0:C.renderingMode)==="PARTIALLY_STATIC",as=!1,at=!1,au=ar?M:void 0,av=ar&&ap&&!ao,aw=(0,h.getRequestMeta)(a,"segmentPrefetchRSCRequest"),ax=!al||(0,p.shouldServeStreamingMetadata)(al,ad.htmlLimitedBots);an&&ar&&(ak=!1,ax=!1);let ay=!0===K.isDev||!ak||"string"==typeof M||av,az=an&&ar,aA=null;_||!ak||ay||aq||au||av||(aA=aa);let aB=aA;!aB&&K.isDev&&(aB=aa),K.isDev||_||!ak||!ap||av||(0,k.d)(a.headers);let aC={...E,tree:H,pages:I,GlobalError:D(),handler:L,routeModule:K,__next_app__:J};X&&Y&&(0,o.setReferenceManifestsSingleton)({page:G,clientReferenceManifest:Y,serverActionsManifest:X,serverModuleMap:(0,q.createServerModuleMap)({serverActionsManifest:X})});let aD=a.method||"GET",aE=(0,g.getTracer)(),aF=aE.getActiveScopeSpan();try{let f=K.getVaryHeader(aa,ae);b.setHeader("Vary",f);let k=async(c,d)=>{let e=new l.NodeNextRequest(a),f=new l.NodeNextResponse(b);return K.render(e,f,d).finally(()=>{if(!c)return;c.setAttributes({"http.status_code":b.statusCode,"next.rsc":!1});let d=aE.getRootSpanAttributes();if(!d)return;if(d.get("next.span_type")!==i.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${d.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let e=d.get("next.route");if(e){let a=`${aD} ${e}`;c.setAttributes({"next.route":e,"http.route":e,"next.span_name":a}),c.updateName(a)}else c.updateName(`${aD} ${a.url}`)})},m=async({span:e,postponed:f,fallbackRouteParams:g})=>{let i={query:Q,params:R,page:ag,sharedContext:{buildId:P},serverComponentsHmrCache:(0,h.getRequestMeta)(a,"serverComponentsHmrCache"),fallbackRouteParams:g,renderOpts:{App:()=>null,Document:()=>null,pageConfig:{},ComponentMod:aC,Component:(0,j.T)(aC),params:R,routeModule:K,page:G,postponed:f,shouldWaitOnAllReady:az,serveStreamingMetadata:ax,supportsDynamicResponse:"string"==typeof f||ay,buildManifest:U,nextFontManifest:V,reactLoadableManifest:W,subresourceIntegrityManifest:Z,serverActionsManifest:X,clientReferenceManifest:Y,setIsrStatus:null==ac?void 0:ac.setIsrStatus,dir:c(33873).join(process.cwd(),K.relativeProjectDir),isDraftMode:_,isRevalidate:ak&&!f&&!av,botType:am,isOnDemandRevalidate:ah,isPossibleServerAction:aq,assetPrefix:ad.assetPrefix,nextConfigOutput:ad.output,crossOrigin:ad.crossOrigin,trailingSlash:ad.trailingSlash,previewProps:$.preview,deploymentId:ad.deploymentId,enableTainting:ad.experimental.taint,htmlLimitedBots:ad.htmlLimitedBots,devtoolSegmentExplorer:ad.experimental.devtoolSegmentExplorer,reactMaxHeadersLength:ad.reactMaxHeadersLength,multiZoneDraftMode:!1,incrementalCache:(0,h.getRequestMeta)(a,"incrementalCache"),cacheLifeProfiles:ad.experimental.cacheLife,basePath:ad.basePath,serverActions:ad.experimental.serverActions,...as?{nextExport:!0,supportsDynamicResponse:!1,isStaticGeneration:!0,isRevalidate:!0,isDebugDynamicAccesses:as}:{},experimental:{isRoutePPREnabled:ar,expireTime:ad.expireTime,staleTimes:ad.experimental.staleTimes,cacheComponents:!!ad.experimental.cacheComponents,clientSegmentCache:!!ad.experimental.clientSegmentCache,clientParamParsing:!!ad.experimental.clientParamParsing,dynamicOnHover:!!ad.experimental.dynamicOnHover,inlineCss:!!ad.experimental.inlineCss,authInterrupts:!!ad.experimental.authInterrupts,clientTraceMetadata:ad.experimental.clientTraceMetadata||[]},waitUntil:d.waitUntil,onClose:a=>{b.on("close",a)},onAfterTaskError:()=>{},onInstrumentationRequestError:(b,c,d)=>K.onRequestError(a,b,d,ac),err:(0,h.getRequestMeta)(a,"invokeError"),dev:K.isDev}},l=await k(e,i),{metadata:m}=l,{cacheControl:n,headers:o={},fetchTags:p}=m;if(p&&(o[y.NEXT_CACHE_TAGS_HEADER]=p),a.fetchMetrics=m.fetchMetrics,ak&&(null==n?void 0:n.revalidate)===0&&!K.isDev&&!ar){let a=m.staticBailoutInfo,b=Object.defineProperty(Error(`Page changed from static to dynamic at runtime ${aa}${(null==a?void 0:a.description)?`, reason: ${a.description}`:""}
|
|
2
|
-
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:v.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},o=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i})=>{let j,k=!1===K.isDev,l=c||b.writableEnded;if(ah&&ab&&!f&&!N)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(ai&&(j=(0,w.parseFallbackField)(ai.fallback)),j===w.FallbackMode.PRERENDER&&(0,u.isBot)(al)&&(!ar||an)&&(j=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ah=!0),ah&&(j!==w.FallbackMode.NOT_FOUND||f)&&(j=w.FallbackMode.BLOCKING_STATIC_RENDER),!N&&j!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aB&&!l&&!_&&T&&(k||!aj)){let b;if((k||ai)&&j===w.FallbackMode.NOT_FOUND)throw new B.NoFallbackError;if(ar&&!ap){let c="string"==typeof(null==ai?void 0:ai.fallback)?ai.fallback:k?ag:null;if(b=await K.handleResponse({cacheKey:c,req:a,nextConfig:ad,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:$,isRoutePPREnabled:ar,responseGenerator:async()=>m({span:i,postponed:void 0,fallbackRouteParams:k||at?(0,n.u)(ag):null}),waitUntil:d.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let o=ah||g||!au?void 0:au;if(as&&void 0!==o)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let p=T&&ar&&((0,h.getRequestMeta)(a,"renderFallbackShell")||at)?(0,n.u)(af):null;return m({span:i,postponed:o,fallbackRouteParams:p})},p=async c=>{var f,g,i,j,k;let l,n=await K.handleResponse({cacheKey:aA,responseGenerator:a=>o({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ah,isRoutePPREnabled:ar,req:a,nextConfig:ad,prerenderManifest:$,waitUntil:d.waitUntil});if(_&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),K.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!n){if(aA)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=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof n.value.postponed;ak&&!av&&(!p||ao)&&(N||b.setHeader("x-nextjs-cache",ah?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=n;if(au)l={revalidate:0,expire:void 0};else if(N&&ap&&!ao&&ar)l={revalidate:0,expire:void 0};else if(!K.isDev)if(_)l={revalidate:0,expire:void 0};else if(ak){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??ad.expireTime}}else l={revalidate:y.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(n.cacheControl=l,"string"==typeof aw&&(null==q?void 0:q.kind)===v.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];N&&ak&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(aw);return void 0!==d?(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let r=(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...n,value:{...n.value,kind:"PAGE"}},{url:(0,h.getRequestMeta)(a,"initURL")}))return null;if(p&&au)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(N&&ak||delete a[y.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 s=null==(g=q.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(N&&ak&&s&&"string"==typeof s&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,s),!q.status||ap&&ar||(b.statusCode=q.status),!N&&q.status&&F.RedirectStatusCode[q.status]&&ap&&(b.statusCode=200),p&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),ap&&!_){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:q.html,cacheControl:av?{revalidate:0,expire:void 0}:n.cacheControl})}return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.fromStatic(q.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let u=q.html;if(!p||N||ap)return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:n.cacheControl});if(as)return u.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:{revalidate:0,expire:void 0}});let w=new TransformStream;return u.push(w.readable),m({span:c,postponed:q.postponed,fallbackRouteParams:null}).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)!==v.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(w.writable)}).catch(a=>{w.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:{revalidate:0,expire:void 0}})};if(!aF)return await aE.withPropagatedContext(a.headers,()=>aE.trace(i.BaseServerSpan.handleRequest,{spanName:`${aD} ${a.url}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aD,"http.target":a.url}},p));await p(aF)}catch(b){throw b instanceof B.NoFallbackError||await K.onRequestError(a,b,{routerKind:"App Router",routePath:G,routeType:"render",revalidateReason:(0,f.c)({isRevalidate:ak,isOnDemandRevalidate:ah})},ac),b}}},8777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Cs:()=>l,Nn:()=>o,YE:()=>k,hG:()=>p,lC:()=>j,lU:()=>n,ui:()=>m});var e=c(52618),f=c(76872),g=c(911),h=a([e,f]);async function i(a,b=!1){let c=await (0,f.LS)(a.createdByUuid),d={uuid:a.uuid,type:a.type,title:a.title,version:a.version,experimentDesignUuid:a.experimentDesignUuid,createdBy:c,createdAt:a.createdAt.toISOString(),updatedAt:a.updatedAt.toISOString()};return b&&void 0!==a.content&&(d.content=a.content),a.researchProject&&(d.project=a.researchProject),d}async function j({companyUuid:a,researchProjectUuid:b,skip:c,take:d,type:f}){let g={researchProjectUuid:b,companyUuid:a,...f&&{type:f}},[h,j]=await Promise.all([e.prisma.document.findMany({where:g,skip:c,take:d,orderBy:{updatedAt:"desc"},select:{uuid:!0,type:!0,title:!0,version:!0,experimentDesignUuid:!0,createdByUuid:!0,createdAt:!0,updatedAt:!0}}),e.prisma.document.count({where:g})]);return{documents:await Promise.all(h.map(a=>i(a))),total:j}}async function k(a,b){let c=await e.prisma.document.findFirst({where:{uuid:b,companyUuid:a},include:{researchProject:{select:{uuid:!0,name:!0}}}});return c?i(c,!0):null}async function l(a,b){return e.prisma.document.findFirst({where:{uuid:b,companyUuid:a}})}async function m(a){let b=await e.prisma.document.create({data:{companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,type:a.type,title:a.title,content:a.content,version:1,experimentDesignUuid:a.experimentDesignUuid,createdByUuid:a.createdByUuid},select:{uuid:!0,type:!0,title:!0,content:!0,version:!0,experimentDesignUuid:!0,createdByUuid:!0,createdAt:!0,updatedAt:!0}});return g.B.emitChange({companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,entityType:"document",entityUuid:b.uuid,action:"created"}),i(b,!0)}async function n(a,{title:b,content:c,incrementVersion:d}){let f={};void 0!==b&&(f.title=b),void 0!==c&&(f.content=c),d&&(f.version={increment:1});let g=await e.prisma.document.update({where:{uuid:a},data:f,include:{researchProject:{select:{uuid:!0,name:!0}}}});return i(g,!0)}async function o(a){return e.prisma.document.delete({where:{uuid:a}})}async function p(a,b,c,d,f){let g=await e.prisma.document.create({data:{companyUuid:a,researchProjectUuid:b,type:f.type||"prd",title:f.title,content:f.content||null,version:1,experimentDesignUuid:c,createdByUuid:d},select:{uuid:!0,type:!0,title:!0,content:!0,version:!0,experimentDesignUuid:!0,createdByUuid:!0,createdAt:!0,updatedAt:!0}});return i(g,!0)}[e,f]=h.then?(await h)():h,d()}catch(a){d(a)}})},9480:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{LI:()=>k,m:()=>j,nQ:()=>i});var e=c(71255),f=c(62729),g=c(85806),h=a([e,g]);async function i({companyUuid:a,researchQuestionUuid:b,roundUuid:c,actorUuid:d,actorType:h,answers:i}){let j=await e.z.hypothesisFormulation.findFirst({where:{uuid:c,researchQuestionUuid:b,companyUuid:a},include:{questions:!0}});if(!j)throw Error("HypothesisFormulation round not found");if("pending_answers"!==j.status)throw Error(`Round is '${j.status}', expected 'pending_answers'`);let k=new Date;for(let a of i){let b=j.questions.find(b=>b.questionId===a.questionId);if(!b)throw Error(`Question '${a.questionId}' not found in round`);if(null!==a.selectedOptionId){if(!b.options.find(b=>b.id===a.selectedOptionId))throw Error(`Invalid option '${a.selectedOptionId}' for question '${a.questionId}'`)}else if(!a.customText?.trim())throw Error(`Question '${a.questionId}': custom text is required when no option is selected`);await e.z.hypothesisFormulationQuestion.update({where:{uuid:b.uuid},data:{selectedOptionId:a.selectedOptionId,customText:a.customText,answeredAt:k,answeredByType:h,answeredByUuid:d}})}(await e.z.hypothesisFormulationQuestion.findMany({where:{roundUuid:c}})).filter(a=>a.required).every(a=>null!==a.answeredAt)&&(await e.z.hypothesisFormulation.update({where:{uuid:c},data:{status:"answered"}}),await e.z.researchQuestion.update({where:{uuid:b},data:{elaborationStatus:"validating"}}));let m=await e.z.researchQuestion.findFirst({where:{uuid:b,companyUuid:a}});await g.f0.createActivity({companyUuid:a,researchProjectUuid:m.researchProjectUuid,targetType:"research_question",targetUuid:b,actorType:h,actorUuid:d,action:"elaboration_answered",value:{roundNumber:j.roundNumber,answeredCount:i.length}}),f.B.emitChange({companyUuid:a,researchProjectUuid:m.researchProjectUuid,entityType:"research_question",entityUuid:b,action:"updated"});let n=await e.z.hypothesisFormulation.findUnique({where:{uuid:c},include:{questions:!0}});return l(n)}async function j({companyUuid:a,researchQuestionUuid:b,actorUuid:c,actorType:d,reason:h}){let i=await e.z.researchQuestion.findFirst({where:{uuid:b,companyUuid:a}});if(!i)throw Error("ResearchQuestion not found");if(i.assigneeUuid!==c)throw Error("Only the assigned agent can skip hypothesis formulation");if("elaborating"!==i.status)throw Error(`Cannot skip hypothesis formulation from status '${i.status}'`);await e.z.researchQuestion.update({where:{uuid:b},data:{elaborationDepth:"minimal",elaborationStatus:"resolved"}}),await g.f0.createActivity({companyUuid:a,researchProjectUuid:i.researchProjectUuid,targetType:"research_question",targetUuid:b,actorType:d,actorUuid:c,action:"elaboration_skipped",value:{reason:h}}),f.B.emitChange({companyUuid:a,researchProjectUuid:i.researchProjectUuid,entityType:"research_question",entityUuid:b,action:"updated"})}async function k({companyUuid:a,researchQuestionUuid:b}){let c=await e.z.researchQuestion.findFirst({where:{uuid:b,companyUuid:a}});if(!c)throw Error("ResearchQuestion not found");let d=await e.z.hypothesisFormulation.findMany({where:{researchQuestionUuid:b,companyUuid:a},include:{questions:!0},orderBy:{roundNumber:"asc"}}),f=d.flatMap(a=>a.questions),g=f.filter(a=>null!==a.answeredAt),h=d.filter(a=>"validated"===a.status),i=d.find(a=>"pending_answers"===a.status);return{researchQuestionUuid:b,depth:c.elaborationDepth,status:c.elaborationStatus,rounds:d.map(l),summary:{totalQuestions:f.length,answeredQuestions:g.length,validatedRounds:h.length,pendingRound:i?.roundNumber||null}}}function l(a){return{uuid:a.uuid,roundNumber:a.roundNumber,status:a.status,createdBy:{type:a.createdByType,uuid:a.createdByUuid},validatedAt:a.validatedAt?.toISOString()||null,createdAt:a.createdAt.toISOString(),questions:a.questions.map(m)}}function m(a){return{uuid:a.uuid,questionId:a.questionId,text:a.text,category:a.category,options:a.options,required:a.required,answer:a.answeredAt?{selectedOptionId:a.selectedOptionId,customText:a.customText,answeredAt:a.answeredAt.toISOString(),answeredBy:{type:a.answeredByType,uuid:a.answeredByUuid}}:null,issue:a.issueType?{type:a.issueType,description:a.issueDescription||""}:null}}[e,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},10768:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12102:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},12351:(a,b,c)=>{"use strict";c.d(b,{s:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60271778b05e6dbedf1923fed6f941bf38aab81d09",d.callServer,void 0,d.findSourceMapURL,"skipHypothesisFormulationAction")},12412:a=>{"use strict";a.exports=require("assert")},12793:(a,b,c)=>{"use strict";c.d(b,{k:()=>e});var d=c(42377);let e=(0,d.createServerReference)("4011018a1c0a397f619a0d0f28f49a61730f474874",d.callServer,void 0,d.findSourceMapURL,"getResearchQuestionCommentsAction")},13151:(a,b,c)=>{"use strict";c.d(b,{DesignActions:()=>q});var d=c(10837),e=c(1007),f=c(21968),g=c(9222),h=c(42424),i=c(11568),j=c(20170),k=c(42377);let l=(0,k.createServerReference)("40348a47e9c6d517853417ec881a0cf018000a74e6",k.callServer,void 0,k.findSourceMapURL,"submitDesignAction"),m=(0,k.createServerReference)("60384ebcd42431ae2748ac9aa2c5e4547deb67f37f",k.callServer,void 0,k.findSourceMapURL,"approveDesignAction"),n=(0,k.createServerReference)("60b89233272953b0e6a6a7139329648c8a8cc068f3",k.callServer,void 0,k.findSourceMapURL,"rejectDesignAction"),o=(0,k.createServerReference)("600dbf09f310464450650ac57bbaaf97bfc4995b91",k.callServer,void 0,k.findSourceMapURL,"closeDesignAction"),p=(0,k.createServerReference)("6026e770a51d2b511dbddb2d1e583ca13beca7d374",k.callServer,void 0,k.findSourceMapURL,"deleteExperimentDesignAction");function q({designUuid:a,projectUuid:b,status:c}){let k=(0,g.c)(),q=(0,e.useRouter)(),[r,s]=(0,f.useTransition)(),[t,u]=(0,f.useState)(!1),[v,w]=(0,f.useState)(""),[x,y]=(0,f.useState)(!1),[z,A]=(0,f.useState)(""),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(""),[F,G]=(0,f.useState)(!1),[H,I]=(0,f.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex gap-2",children:["draft"===c&&(0,d.jsx)(h.$,{onClick:()=>G(!0),disabled:r,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:k(r?"common.processing":"proposals.submitForReview")}),"pending"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>C(!0),disabled:r,className:"border-[#6B6B6B] text-[#6B6B6B] hover:bg-[#F5F5F5]",children:k("proposals.closeProposal")}),(0,d.jsx)(h.$,{variant:"outline",onClick:()=>y(!0),disabled:r,className:"border-[#D32F2F] text-[#D32F2F] hover:bg-[#FFEBEE]",children:k("common.reject")}),(0,d.jsx)(h.$,{onClick:()=>u(!0),disabled:r,className:"bg-[#5A9E6F] hover:bg-[#4A8E5F] text-white",children:k("common.approve")})]}),(0,d.jsx)(h.$,{variant:"outline",onClick:()=>I(!0),disabled:r,className:"border-[#D32F2F] text-[#D32F2F] hover:bg-[#FFEBEE]",children:k("proposals.deleteExperimentDesign")}),(0,d.jsx)(h.$,{variant:"outline",className:"border-[#E5E0D8] text-[#6B6B6B]",onClick:()=>q.back(),children:k("common.back")})]}),(0,d.jsx)(i.lG,{open:F,onOpenChange:G,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.confirmSubmit")}),(0,d.jsx)(i.rr,{children:k("proposals.confirmSubmitDesc")})]}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>G(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await l(a)).success&&(G(!1),q.refresh())})},disabled:r,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:k(r?"common.processing":"proposals.submitForReview")})]})]})}),(0,d.jsx)(i.lG,{open:t,onOpenChange:u,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.approveProposal")}),(0,d.jsx)(i.rr,{children:k("proposals.approveProposalDesc")})]}),(0,d.jsx)(j.T,{value:v,onChange:a=>w(a.target.value),placeholder:k("proposals.approveNotePlaceholder"),className:"min-h-[100px] border-[#E5E0D8]"}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>u(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await m(a,v.trim()||void 0)).success&&(u(!1),w(""),q.refresh())})},disabled:r,className:"bg-[#5A9E6F] hover:bg-[#4A8E5F] text-white",children:k(r?"common.processing":"common.approve")})]})]})}),(0,d.jsx)(i.lG,{open:x,onOpenChange:y,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.rejectProposal")}),(0,d.jsx)(i.rr,{children:k("proposals.rejectProposalDesc")})]}),(0,d.jsx)(j.T,{value:z,onChange:a=>A(a.target.value),placeholder:k("proposals.rejectReasonPlaceholder"),className:"min-h-[100px] border-[#E5E0D8]"}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>y(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await n(a,z)).success&&(y(!1),A(""),q.refresh())})},disabled:r||!z.trim(),className:"bg-[#D32F2F] hover:bg-[#B71C1C] text-white",children:k(r?"common.processing":"common.reject")})]})]})}),(0,d.jsx)(i.lG,{open:B,onOpenChange:C,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.closeProposal")}),(0,d.jsx)(i.rr,{children:k("proposals.closeProposalDesc")})]}),(0,d.jsx)(j.T,{value:D,onChange:a=>E(a.target.value),placeholder:k("proposals.closeReasonPlaceholder"),className:"min-h-[100px] border-[#E5E0D8]"}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>C(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await o(a,D)).success&&(C(!1),E(""),q.refresh())})},disabled:r||!D.trim(),className:"bg-[#6B6B6B] hover:bg-[#555555] text-white",children:k(r?"common.processing":"proposals.closeProposal")})]})]})}),(0,d.jsx)(i.lG,{open:H,onOpenChange:I,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.deleteExperimentDesign")}),(0,d.jsx)(i.rr,{children:k("proposals.deleteExperimentDesignDesc")})]}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>I(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await p(a,b)).success&&(I(!1),q.push(`/research-projects/${b}/experiment-designs`),q.refresh())})},disabled:r,className:"bg-[#D32F2F] hover:bg-[#B71C1C] text-white",children:k(r?"common.processing":"common.delete")})]})]})})]})}},13537:(a,b,c)=>{"use strict";c.d(b,{R:()=>e});var d=c(42377);let e=(0,d.createServerReference)("40100bfdbae4e8dda08100983a865107b49118eeb4",d.callServer,void 0,d.findSourceMapURL,"getHypothesisFormulationAction")},14985:a=>{"use strict";a.exports=require("dns")},17212:(a,b,c)=>{"use strict";c.d(b,{MarkdownContent:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call MarkdownContent() from the server but MarkdownContent is 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.")},"/home/ubuntu/Synapse/src/components/markdown-content.tsx","MarkdownContent")},17258:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{default:()=>H});var e=c(10023),f=c(66530),g=c(18198),h=c.n(g),i=c(67706),j=c(10768),k=c(61159),l=c(61007),m=c(92190),n=c(38369),o=c(67341),p=c(12102),q=c(87991),r=c(29669),s=c(75335),t=c(74236),u=c(57609),v=c(6309),w=c(17212),x=c(29662),y=c(78112),z=c(90136),A=c(85034),B=c(53460),C=c(88603),D=c(41890),E=c(67413),F=c(1322),G=a([x,y,z,A]);[x,y,z,A]=G.then?(await G)():G;let I={draft:"bg-[#F5F5F5] text-[#6B6B6B]",pending:"bg-[#FFF3E0] text-[#E65100]",approved:"bg-[#E8F5E9] text-[#5A9E6F]",rejected:"bg-[#FFEBEE] text-[#C4574C]",revised:"bg-[#E3F2FD] text-[#1976D2]",closed:"bg-[#F5F5F5] text-[#9A9A9A]"},J={approved:"bg-[#E8F5E9] text-[#5A9E6F]",rejected:"bg-[#FFEBEE] text-[#C4574C]",closed:"bg-[#F5F5F5] text-[#6B6B6B]"},K={draft:"draft",pending:"pending",approved:"approved",rejected:"rejected",revised:"revised",closed:"closed"},L={research_question:{key:"ideas.title"},document:{key:"documents.title"}};async function H({params:a}){let b=await (0,x.d)();b||(0,f.redirect)("/login");let{uuid:c,designUuid:d}=await a,g=await (0,i.A)();await (0,A.vP)(b.companyUuid,c)||(0,f.redirect)("/research-projects");let G=await (0,y.o4)(b.companyUuid,d);if(!G)return(0,e.jsxs)("div",{className:"flex h-full flex-col items-center justify-center",children:[(0,e.jsx)("div",{className:"text-muted-foreground",children:g("proposals.proposalNotFound")}),(0,e.jsx)(h(),{href:`/research-projects/${c}/experiment-designs`,className:"mt-4 text-[#C67A52] hover:underline",children:g("proposals.backToProposals")})]});let H=G.documentDrafts,M=G.taskDrafts,N="research_question"===G.inputType&&G.inputUuids?.length?(await Promise.all(G.inputUuids.map(a=>(0,z.ok)(b.companyUuid,a)))).filter(Boolean):[];return(0,e.jsxs)("div",{className:"px-4 py-4 md:px-10 md:py-8",children:[(0,e.jsxs)("div",{className:"mb-7 flex items-center gap-2 text-xs",children:[(0,e.jsx)(h(),{href:`/research-projects/${c}/experiment-designs`,className:"text-muted-foreground hover:text-foreground transition-colors",children:g("nav.proposals")}),(0,e.jsx)(j.A,{className:"h-3.5 w-3.5 text-[#D0CCC4]"}),(0,e.jsx)("span",{className:"font-medium text-[#6B6B6B]",children:G.title})]}),(0,e.jsxs)("div",{className:"mb-8 flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-[#F5F2EC]",children:(0,e.jsx)(k.A,{className:"h-6 w-6 text-[#C67A52]"})}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2.5",children:[(0,e.jsx)(u.E,{className:`text-[11px] font-semibold border-0 ${I[G.status]||""}`,children:g(`status.${K[G.status]||G.status}`)}),N.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.basedOn")}),N.map(a=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-[#C67A5215] px-2 py-0.5 text-[11px] font-medium text-[#C67A52]",children:[(0,e.jsx)(l.A,{className:"h-3 w-3"}),a.title]},a.uuid))]}):(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g("proposals.basedOn")," ",g(L[G.inputType]?.key||"common.unknown")]})]}),(0,e.jsx)("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:G.title}),(0,e.jsxs)("div",{className:"mt-2 flex items-center gap-2.5 text-xs text-muted-foreground",children:[(0,e.jsxs)("span",{children:[g("common.created")," ",new Date(G.createdAt).toLocaleDateString()]}),G.createdBy&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[#D0CCC4]",children:"\xb7"}),(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)(m.A,{className:"h-3 w-3"}),G.createdBy.name]})]})]})]})]}),(0,e.jsx)(B.DesignActions,{designUuid:d,projectUuid:c,status:G.status})]}),(0,e.jsxs)("div",{className:"flex flex-col lg:flex-row gap-5 lg:gap-7",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-6",children:[G.description&&(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("common.description")})}),(0,e.jsx)(t.Wu,{className:"px-5 py-4",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[#6B6B6B]",children:(0,e.jsx)(w.MarkdownContent,{children:G.description})})})]}),"draft"===G.status&&(0,e.jsx)(F.DesignValidationChecklist,{projectUuid:c,designUuid:d,status:G.status}),(0,e.jsx)(C.DesignEditor,{designUuid:d,projectUuid:c,status:G.status,documentDrafts:H,taskDrafts:M})]}),(0,e.jsxs)("div",{className:"w-full lg:w-80 lg:shrink-0 space-y-5",children:[(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("common.details")})}),(0,e.jsxs)(t.Wu,{className:"space-y-3 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("common.status")}),(0,e.jsx)(u.E,{className:`text-[11px] font-medium border-0 ${I[G.status]||""}`,children:g(`status.${K[G.status]||G.status}`)})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.inputType")}),(0,e.jsx)("span",{className:"text-xs font-medium text-foreground",children:g(L[G.inputType]?.key||"common.unknown")})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.creatorType")}),(0,e.jsx)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-foreground",children:"agent"===G.createdByType?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{className:"h-3 w-3 text-[#C67A52]"}),g("common.agent")]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{className:"h-3 w-3 text-muted-foreground"}),g("common.user")]})})]}),(0,e.jsx)(v.Separator,{className:"bg-[#F5F2EC]"}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("common.created")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:new Date(G.createdAt).toLocaleDateString()})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("common.updated")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:new Date(G.updatedAt).toLocaleDateString()})]})]})]}),N.length>0&&(0,e.jsx)(E.SourceQuestionsCard,{ideas:N.map(a=>({uuid:a.uuid,title:a.title,content:a.content,status:a.status,assignee:a.assignee,createdAt:a.createdAt})),projectUuid:c,currentUserUuid:b.actorUuid}),(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("proposals.containerSummary")})}),(0,e.jsxs)(t.Wu,{className:"space-y-3 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(p.A,{className:"h-3.5 w-3.5"})," ",g("proposals.documents")]}),(0,e.jsx)("span",{className:"text-[13px] font-semibold text-[#6B6B6B]",children:H?.length||0})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(q.A,{className:"h-3.5 w-3.5"})," ",g("proposals.tasks")]}),(0,e.jsx)("span",{className:"text-[13px] font-semibold text-[#C67A52]",children:M?.length||0})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"})," ",g("proposals.inputs")]}),(0,e.jsx)("span",{className:"text-[13px] font-semibold text-[#6B6B6B]",children:G.inputUuids?.length||0})]})]})]}),G.review&&(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("proposals.reviewInfo")})}),(0,e.jsxs)(t.Wu,{className:"space-y-3 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.reviewedBy")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:G.review.reviewedBy?.name||"-"})]}),G.review.reviewedAt&&(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.reviewedAt")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:new Date(G.review.reviewedAt).toLocaleDateString()})]}),G.review.reviewNote&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v.Separator,{className:"bg-[#F5F2EC]"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:g("proposals.reviewNote")}),(0,e.jsx)("div",{className:`mt-1.5 rounded-lg px-3 py-2 text-xs font-medium ${J[G.status]||"bg-[#F5F2EC] text-[#6B6B6B]"}`,children:G.review.reviewNote})]})]})]})]}),"draft"===G.status&&G.review?.reviewNote&&(0,e.jsx)(t.Zp,{className:"border-[#C4574C] bg-[#FFEBEE] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsx)(t.Wu,{className:"p-4",children:(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(r.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-[#C4574C]"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xs font-semibold text-[#C4574C]",children:g("proposals.rejectionReason")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-[#6B6B6B]",children:G.review.reviewNote}),G.review.reviewedBy&&(0,e.jsxs)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["— ",G.review.reviewedBy.name,G.review.reviewedAt&&`, ${new Date(G.review.reviewedAt).toLocaleDateString()}`]})]})]})})}),"closed"===G.status&&G.review?.reviewNote&&(0,e.jsx)(t.Zp,{className:"border-[#D0CCC4] bg-[#F5F2EC] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsx)(t.Wu,{className:"p-4",children:(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(r.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xs font-semibold text-[#6B6B6B]",children:g("proposals.rejectionReason")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-[#6B6B6B]",children:G.review.reviewNote}),G.review.reviewedBy&&(0,e.jsxs)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["— ",G.review.reviewedBy.name,G.review.reviewedAt&&`, ${new Date(G.review.reviewedAt).toLocaleDateString()}`]})]})]})})}),(0,e.jsx)(D.DesignComments,{designUuid:d,currentUserUuid:b.actorUuid}),"draft"===G.status&&(0,e.jsx)(t.Zp,{className:"border-[#D0CCC4] bg-[#F5F2EC] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsxs)(t.Wu,{className:"p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[#6B6B6B]",children:[(0,e.jsx)(s.A,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"font-medium",children:g("proposals.draftStatus")})]}),(0,e.jsx)("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:g("proposals.draftNotice")})]})}),"pending"===G.status&&(0,e.jsx)(t.Zp,{className:"border-[#C67A52] bg-[#FFFBF8] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsxs)(t.Wu,{className:"p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[#E65100]",children:[(0,e.jsx)(r.A,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"font-medium",children:g("proposals.awaitingReview")})]}),(0,e.jsx)("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:g("proposals.reviewInstructions")})]})}),"closed"===G.status&&(0,e.jsx)(t.Zp,{className:"border-[#D0CCC4] bg-[#F5F2EC] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsx)(t.Wu,{className:"p-4",children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(r.A,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"font-medium",children:g("proposals.closedNotice")})]})})})]})]})]})}d()}catch(a){d(a)}})},18369:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{DesignEditor:()=>H});var e=c(10837),f=c(21968),g=c(1007),h=c(9222),i=c(21268),j=c(34457);c(98088),c(24346);var k=c(65956),l=c(92900),m=c(21790),n=c(49102),o=c(24493),p=c(71693),q=c(4045),r=c(35198),s=c(42424),t=c(49599),u=c(9994),v=c(20170),w=c(2852),x=c(11568),y=c(55732),z=c(41709),A=c(83457),B=c(50388),C=c(68989),D=c(98175),E=c(62221),F=c(45433),G=a([A,F]);[A,F]=G.then?(await G)():G;let I={high:{bg:"bg-[#FFEBEE]",text:"text-[#C4574C]"},medium:{bg:"bg-[#FFF3E0]",text:"text-[#E65100]"},low:{bg:"bg-[#F5F2EC]",text:"text-[#6B6B6B]"}},J={prd:"Prd",tech_design:"TechDesign",adr:"Adr",spec:"Spec",guide:"Guide"},K={taskDraftNode:function({data:a}){let b=(0,h.c)(),c=I[a.priority||"medium"]||I.medium;return(0,e.jsxs)("div",{className:"rounded-lg border-2 border-[#E5E2DC] bg-white px-4 py-3 shadow-sm min-w-[200px] max-w-[260px] cursor-pointer hover:border-[#C67A52] transition-colors",children:[(0,e.jsx)(i.h7,{type:"target",position:j.yX.Top,className:"!bg-[#C67A52] !w-2 !h-2"}),(0,e.jsx)("div",{className:"flex items-center gap-2 mb-1.5",children:a.priority&&(0,e.jsx)(t.E,{className:`text-[10px] border-0 ${c.bg} ${c.text}`,children:b(`priority.${a.priority}`)})}),(0,e.jsx)("p",{className:"text-xs font-medium text-[#2C2C2C] leading-snug line-clamp-2",children:a.title}),(0,e.jsx)(i.h7,{type:"source",position:j.yX.Bottom,className:"!bg-[#C67A52] !w-2 !h-2"})]})}};function H({designUuid:a,status:b,documentDrafts:c,taskDrafts:d}){let j=(0,h.c)(),G=(0,g.useRouter)(),[H,L]=(0,f.useTransition)(),[M,N]=(0,f.useState)("cards"),[O,P]=(0,f.useState)(new Set),[Q,R]=(0,f.useState)(!1),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)("prd"),[W,X]=(0,f.useState)(""),[Y,Z]=(0,f.useState)(""),[$,_]=(0,f.useState)(null),[aa,ab]=(0,f.useState)(!1),[ac,ad]=(0,f.useState)(null),[ae,af]=(0,f.useState)(null),ag="draft"===b,ah=(0,f.useMemo)(()=>$&&d&&d.find(a=>a.uuid===$)||null,[$,d]),[ai,aj,ak]=(0,i.ck)([]),[al,am,an]=(0,i.fM)([]),ao=(0,f.useCallback)(async b=>{if(!b.source||!b.target||!ag||b.source===b.target)return;af(null);let c=b.target,e=b.source,f=d?.find(a=>a.uuid===c);if(!f)return;let g=f.dependsOnDraftUuids||[];if(g.includes(e))return void af(j("proposals.dependencyExists"));if(((a,b)=>{let c=new Set,e=[a];for(;e.length>0;){let a=e.shift();if(a===b)return!0;if(c.has(a))continue;c.add(a);let f=d?.find(b=>b.uuid===a);f?.dependsOnDraftUuids&&e.push(...f.dependsOnDraftUuids)}return!1})(e,c))return void af(j("proposals.cyclicDependency"));let h=[...g,e];L(async()=>{let b=await (0,B.S)(a,c,{dependsOnDraftUuids:h});b.success?G.refresh():af(b.error||j("proposals.failedToAddDependency"))})},[ag,d,a,G,L,j]),ap=(0,f.useCallback)((a,b)=>{ab(!1),_(b.id)},[]),aq=c&&c.length>0,ar=d&&d.length>0,as=null!==$||aa;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(r.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsxs)(r.aR,{className:"flex-row items-center justify-between border-b border-[#F5F2EC] px-6 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)(k.A,{className:"h-[18px] w-[18px] text-[#C67A52]"}),(0,e.jsx)(r.ZB,{className:"text-sm font-semibold text-foreground",children:j("proposals.documentDrafts")}),(0,e.jsx)(t.E,{variant:"secondary",className:"border-0 bg-[#F5F2EC] text-[11px] font-medium text-muted-foreground",children:c?.length||0})]}),ag&&(0,e.jsxs)(s.$,{variant:"ghost",size:"sm",onClick:()=>{T(null),V("prd"),X(""),Z(""),R(!0)},className:"h-7 gap-1 text-xs font-medium text-[#C67A52] hover:bg-[#FFFBF8] hover:text-[#C67A52]",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"}),j("proposals.addDocumentDraft")]})]}),(0,e.jsx)(r.Wu,{className:"p-0",children:aq?(0,e.jsx)("div",{className:"space-y-0 divide-y divide-[#F5F2EC]",children:c.map(b=>{let c=O.has(b.uuid);return(0,e.jsxs)("div",{className:"px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("button",{onClick:()=>{var a;return a=b.uuid,void P(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},className:"flex items-center gap-2.5 text-left cursor-pointer hover:opacity-80 transition-opacity",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:c?(0,e.jsx)(m.A,{className:"h-4 w-4"}):(0,e.jsx)(n.A,{className:"h-4 w-4"})}),(0,e.jsx)(t.E,{variant:"outline",className:"text-[10px] font-medium text-[#6B6B6B] border-[#E5E2DC] bg-[#FAF8F4]",children:j(`proposals.docType${J[b.type]||"Guide"}`)}),(0,e.jsx)("span",{className:"text-[13px] font-medium text-foreground",children:b.title})]}),ag&&(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)(s.$,{variant:"ghost",size:"sm",onClick:()=>{T(b),V(b.type),X(b.title),Z(b.content),R(!0)},className:"h-6 text-[11px] text-muted-foreground hover:text-foreground",children:j("proposals.editDraft")}),(0,e.jsx)(s.$,{variant:"ghost",size:"sm",onClick:()=>{confirm(j("common.confirmDelete"))&&L(async()=>{(await (0,E.L)(a,b.uuid)).success&&G.refresh()})},disabled:H,className:"h-6 text-[11px] text-[#C4574C] hover:bg-[#FFEBEE] hover:text-[#C4574C]",children:j("proposals.deleteDraft")})]})]}),c&&b.content&&(0,e.jsx)("div",{className:"mt-3 border-t border-[#F5F2EC] pt-4",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-foreground",children:(0,e.jsx)(z.jH,{plugins:{code:A.a},children:b.content})})})]},b.uuid)})}):(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 px-6 py-8",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-[10px] bg-[#F5F2EC]",children:(0,e.jsx)(k.A,{className:"h-[18px] w-[18px] text-[#D0CCC4]"})}),(0,e.jsx)("p",{className:"text-[13px] text-muted-foreground",children:j("proposals.emptyContainer")})]})})]}),(0,e.jsxs)(r.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsxs)(r.aR,{className:"flex-row items-center justify-between border-b border-[#F5F2EC] px-6 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)(o.A,{className:"h-[18px] w-[18px] text-[#C67A52]"}),(0,e.jsx)(r.ZB,{className:"text-sm font-semibold text-foreground",children:j("proposals.taskDrafts")}),(0,e.jsx)(t.E,{className:"border-0 bg-[#C67A5220] text-[11px] font-semibold text-[#C67A52]",children:d?.length||0})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[ar&&(0,e.jsxs)("div",{className:"flex rounded-lg bg-[#F5F2EC] p-0.5",children:[(0,e.jsx)("button",{onClick:()=>N("cards"),className:`rounded-md px-3 py-1 text-[11px] font-medium transition-colors ${"cards"===M?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:j("proposals.cardsView")}),(0,e.jsx)("button",{onClick:()=>N("dag"),className:`rounded-md px-3 py-1 text-[11px] font-medium transition-colors ${"dag"===M?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"DAG"})]}),ag&&(0,e.jsxs)(s.$,{variant:"ghost",size:"sm",onClick:()=>{_(null),ab(!0)},className:"h-7 gap-1 text-xs font-medium text-[#C67A52] hover:bg-[#FFFBF8] hover:text-[#C67A52]",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"}),j("proposals.addTaskDraft")]})]})]}),(0,e.jsx)(r.Wu,{className:"p-0",children:ar?"cards"===M?(0,e.jsx)("div",{className:"space-y-2.5 p-5",children:d.map(a=>{let b=I[a.priority||"medium"]||I.medium,c=a.dependsOnDraftUuids?.length||0,d=$===a.uuid;return(0,e.jsxs)("div",{onClick:()=>{ab(!1),_(a.uuid)},className:`cursor-pointer rounded-[10px] border bg-white p-3.5 transition-colors ${d?"border-[#C67A52] shadow-sm":"border-[#E5E2DC] hover:border-[#C67A52]/50"}`,children:[(0,e.jsx)("div",{className:"mb-1.5",children:(0,e.jsx)("span",{className:"text-[13px] font-medium leading-snug text-foreground",children:a.title})}),a.description&&(0,e.jsx)("p",{className:"mb-3 text-[11px] leading-relaxed text-[#6B6B6B]",children:a.description}),a.acceptanceCriteria&&(0,e.jsxs)("div",{className:"mb-3 rounded-lg bg-[#F5F2EC] p-3",children:[(0,e.jsx)("div",{className:"mb-1 text-[10px] font-medium text-muted-foreground",children:j("tasks.acceptanceCriteria")}),(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[11px] text-[#6B6B6B]",children:(0,e.jsx)(z.jH,{plugins:{code:A.a},children:a.acceptanceCriteria})})]}),a.acceptanceCriteriaItems&&a.acceptanceCriteriaItems.length>0&&(0,e.jsxs)("div",{className:"mb-3 rounded-lg bg-[#F5F2EC] p-3",children:[(0,e.jsxs)("div",{className:"mb-1.5 flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[(0,e.jsx)(p.A,{className:"h-2.5 w-2.5"}),j("acceptanceCriteria.title")]}),(0,e.jsx)("div",{className:"space-y-1",children:a.acceptanceCriteriaItems.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,e.jsx)("span",{className:"flex-1 text-[#6B6B6B]",children:a.description}),(0,e.jsx)(t.E,{className:`text-[9px] font-medium border-0 shrink-0 ${a.required??!0?"bg-[#FFF3E0] text-[#E65100]":"bg-white text-[#9A9A9A]"}`,children:a.required??!0?j("acceptanceCriteria.required"):j("acceptanceCriteria.optional")})]},b))})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[a.priority&&(0,e.jsx)(t.E,{className:`text-[10px] font-medium border-0 ${b.bg} ${b.text}`,children:j(`priority.${a.priority}`)}),c>0&&(0,e.jsxs)(t.E,{variant:"outline",className:"text-[10px] font-medium text-muted-foreground border-[#E5E2DC]",children:[c," ",1===c?"dep":"deps"]})]}),null!=a.computeBudgetHours&&a.computeBudgetHours>0&&(0,e.jsxs)("span",{className:"flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[(0,e.jsx)(q.A,{className:"h-2.5 w-2.5 text-[#C67A52]"}),a.computeBudgetHours," SP"]})]})]},a.uuid)})}):(0,e.jsxs)("div",{className:"h-[400px] relative",children:[ae&&(0,e.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10 rounded-lg bg-red-50 border border-red-200 px-4 py-2 text-xs text-red-700 shadow-sm",children:[ae,(0,e.jsx)("button",{className:"ml-2 font-medium hover:text-red-900",onClick:()=>af(null),children:"x"})]}),(0,e.jsxs)(i.Gc,{nodes:ai,edges:al,onNodesChange:ak,onEdgesChange:an,onConnect:ao,onNodeClick:ap,nodeTypes:K,fitView:!0,fitViewOptions:{padding:.3},minZoom:.3,maxZoom:1.5,proOptions:{hideAttribution:!0},children:[(0,e.jsx)(i.VS,{color:"#E5E0D8",gap:20}),(0,e.jsx)(i.H2,{className:"[&>button]:border-[#E5E0D8] [&>button]:bg-white [&>button]:text-[#2C2C2C] [&>button:hover]:bg-[#FAF8F4]"})]})]}):(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 px-6 py-8",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-[10px] bg-[#F5F2EC]",children:(0,e.jsx)(o.A,{className:"h-[18px] w-[18px] text-[#D0CCC4]"})}),(0,e.jsx)("p",{className:"text-[13px] text-muted-foreground",children:j("proposals.emptyContainer")})]})})]}),(0,e.jsx)(x.lG,{open:Q,onOpenChange:R,children:(0,e.jsxs)(x.Cf,{className:"max-w-2xl",children:[(0,e.jsx)(x.c7,{children:(0,e.jsx)(x.L3,{children:S?j("proposals.editDraft"):j("proposals.addDocumentDraft")})}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(w.J,{className:"mb-2 block text-muted-foreground",children:j("proposals.documentType")}),(0,e.jsxs)(y.l6,{value:U,onValueChange:V,children:[(0,e.jsx)(y.bq,{className:"border-[#E5E2DC]",children:(0,e.jsx)(y.yv,{})}),(0,e.jsxs)(y.gC,{children:[(0,e.jsx)(y.eb,{value:"prd",children:j("proposals.docTypePrd")}),(0,e.jsx)(y.eb,{value:"tech_design",children:j("proposals.docTypeTechDesign")}),(0,e.jsx)(y.eb,{value:"adr",children:j("proposals.docTypeAdr")}),(0,e.jsx)(y.eb,{value:"spec",children:j("proposals.docTypeSpec")}),(0,e.jsx)(y.eb,{value:"guide",children:j("proposals.docTypeGuide")})]})]})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)(w.J,{className:"mb-2 block text-muted-foreground",children:[j("proposals.documentTitle")," *"]}),(0,e.jsx)(u.p,{value:W,onChange:a=>X(a.target.value),placeholder:j("proposals.titlePlaceholder"),className:"border-[#E5E2DC]"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)(w.J,{className:"mb-2 block text-muted-foreground",children:j("proposals.documentContent")}),(0,e.jsx)(v.T,{value:Y,onChange:a=>Z(a.target.value),className:"h-64 resize-none border-[#E5E2DC] font-mono",placeholder:"# Document Title Write your content in Markdown..."})]}),ac&&(0,e.jsx)("div",{className:"rounded-lg bg-[#FFEBEE] p-3 text-sm text-[#C4574C]",children:ac}),(0,e.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,e.jsx)(s.$,{variant:"outline",onClick:()=>R(!1),disabled:H,className:"border-[#E5E2DC]",children:j("common.cancel")}),(0,e.jsx)(s.$,{onClick:()=>{if(!W.trim())return void ad(j("proposals.titleRequired"));ad(null),L(async()=>{let b;(b=S?await (0,C.I)(a,S.uuid,{type:U,title:W.trim(),content:Y}):await (0,D.U)(a,{type:U,title:W.trim(),content:Y})).success?(R(!1),G.refresh()):ad(b.error||j("proposals.failedToSaveDocDraft"))})},disabled:H,className:"bg-[#C67A52] text-white hover:bg-[#B56A42]",children:H?j("common.saving"):j("common.save")})]})]})]})}),as&&(0,e.jsx)(F.O,{taskDraft:aa?null:ah,allTaskDrafts:d||[],designUuid:a,canEdit:ag,onClose:()=>{_(null),ab(!1)},onSaved:()=>{aa&&ab(!1)},onDeleted:()=>{_(null),ab(!1)}})]})}d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19133:(a,b,c)=>{Promise.resolve().then(c.bind(c,13753)),Promise.resolve().then(c.bind(c,81093)),Promise.resolve().then(c.bind(c,14672)),Promise.resolve().then(c.bind(c,25711)),Promise.resolve().then(c.bind(c,70952)),Promise.resolve().then(c.bind(c,98556)),Promise.resolve().then(c.bind(c,14220)),Promise.resolve().then(c.bind(c,5989)),Promise.resolve().then(c.bind(c,15906)),Promise.resolve().then(c.bind(c,45106)),Promise.resolve().then(c.bind(c,13277)),Promise.resolve().then(c.bind(c,55212)),Promise.resolve().then(c.bind(c,73935)),Promise.resolve().then(c.bind(c,50382)),Promise.resolve().then(c.bind(c,66529)),Promise.resolve().then(c.bind(c,41335)),Promise.resolve().then(c.bind(c,66619)),Promise.resolve().then(c.bind(c,53187)),Promise.resolve().then(c.bind(c,28121)),Promise.resolve().then(c.bind(c,63658)),Promise.resolve().then(c.bind(c,95556)),Promise.resolve().then(c.bind(c,28386)),Promise.resolve().then(c.bind(c,15644)),Promise.resolve().then(c.bind(c,25400)),Promise.resolve().then(c.bind(c,93319)),Promise.resolve().then(c.bind(c,31284)),Promise.resolve().then(c.bind(c,2807)),Promise.resolve().then(c.bind(c,59782)),Promise.resolve().then(c.bind(c,80501)),Promise.resolve().then(c.t.bind(c,81512,23)),Promise.resolve().then(c.bind(c,13151)),Promise.resolve().then(c.bind(c,89792)),Promise.resolve().then(c.bind(c,18369)),Promise.resolve().then(c.bind(c,51277)),Promise.resolve().then(c.bind(c,68199)),Promise.resolve().then(c.bind(c,97450)),Promise.resolve().then(c.bind(c,84819))},21692:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},21820:a=>{"use strict";a.exports=require("os")},24364:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]])},24493:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]])},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},26849:a=>{"use strict";a.exports=require("@prisma/client/runtime/client")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28874:(a,b,c)=>{"use strict";c.d(b,{$:()=>e});var d=c(42377);let e=(0,d.createServerReference)("400e0adbec22ef37d015830c0c3ff93385846f0f2c",d.callServer,void 0,d.findSourceMapURL,"getDesignCommentsAction")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29669:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},33527:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{"400e0adbec22ef37d015830c0c3ff93385846f0f2c":()=>f.$,"40100bfdbae4e8dda08100983a865107b49118eeb4":()=>i.R,"4011018a1c0a397f619a0d0f28f49a61730f474874":()=>g.k,"40348a47e9c6d517853417ec881a0cf018000a74e6":()=>e.RE,"40b8e6a8f5b487648e2f31fb6caacf3faecaa89d14":()=>h.q,"600dbf09f310464450650ac57bbaaf97bfc4995b91":()=>e.dj,"6026e770a51d2b511dbddb2d1e583ca13beca7d374":()=>e.fZ,"60271778b05e6dbedf1923fed6f941bf38aab81d09":()=>i.sW,"6036b14c7a0b485d68bb436fcc5c9a726686abd8c6":()=>e.UY,"60384ebcd42431ae2748ac9aa2c5e4547deb67f37f":()=>e.CL,"607ac07f8a321d8f99cd779629db2138ea431c900d":()=>e.ji,"6099501305ac6eaccd915d3909faeba37aef0a6a81":()=>e.wq,"60a3f1338a100846860fe056719a21232d69b3ce75":()=>g.n,"60b89233272953b0e6a6a7139329648c8a8cc068f3":()=>e.eZ,"60e8964f43a0c46fd7eb5bd44d07a1998e66e2269c":()=>e.Lx,"60eb8b406bda37b41cbdbf1462e45ee2945bc7aa10":()=>f.e,"7001eb4571b8964fd95ad3b7fcbbd3a2195e7de288":()=>e.S$,"70706397cc55ec694918ffe090cec7e476c444e25a":()=>e.IK,"707a4a486695fd0b49c89e5eeec64dc88d3093c6dd":()=>i.c8});var e=c(7667),f=c(44875),g=c(4133),h=c(38309),i=c(6511),j=a([e,f,g,h,i]);[e,f,g,h,i]=j.then?(await j)():j,d()}catch(a){d(a)}})},33873:a=>{"use strict";a.exports=require("path")},33962:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])},34631:a=>{"use strict";a.exports=require("tls")},38309:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{q:()=>l});var e=c(2613);c(50785);var f=c(9259),g=c(67738),h=c(15369),i=c(97307),j=c(12217),k=a([f,g,h]);[f,g,h]=k.then?(await k)():k;let m=i.vF.child({module:"research_question"});async function l(a){let b=await (0,f.d)();if(!b)return{activities:[],total:0};try{let c=await (0,h._W)(b.companyUuid,a);if(!c)return{activities:[],total:0};return await (0,g.listActivitiesWithActorNames)({companyUuid:b.companyUuid,researchProjectUuid:c.researchProjectUuid,targetType:"research_question",targetUuid:a,skip:0,take:50})}catch(a){return m.error({err:a},"Failed to get idea activities"),{activities:[],total:0}}}(0,j.D)([l]),(0,e.A)(l,"40b8e6a8f5b487648e2f31fb6caacf3faecaa89d14",null),d()}catch(a){d(a)}})},38369:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},40869:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(77219);c(86099),c(71902);var e=c(86963),f=a([d,e]);[d,e]=f.then?(await f)():f,b()}catch(a){b(a)}})},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41204:a=>{"use strict";a.exports=require("string_decoder")},41890:(a,b,c)=>{"use strict";c.d(b,{DesignComments:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call DesignComments() from the server but DesignComments is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/design-comments.tsx","DesignComments")},44217:(a,b,c)=>{"use strict";c.d(b,{w:()=>e});var d=c(42377);let e=(0,d.createServerReference)("6099501305ac6eaccd915d3909faeba37aef0a6a81",d.callServer,void 0,d.findSourceMapURL,"addRunDraftAction")},44865:a=>{"use strict";a.exports=import("@prisma/client/runtime/query_compiler_fast_bg.postgresql.wasm-base64.mjs")},44875:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>m,e:()=>n});var e=c(2613);c(50785);var f=c(9259),g=c(466),h=c(90097),i=c(67738),j=c(97307),k=c(12217),l=a([f,g,h,i]);[f,g,h,i]=l.then?(await l)():l;let o=j.vF.child({module:"experiment_design"});async function m(a){let b=await (0,f.d)();if(!b)return{comments:[],total:0};try{return await (0,g.fg)({companyUuid:b.companyUuid,targetType:"experiment_design",targetUuid:a,skip:0,take:100})}catch(a){return o.error({err:a},"Failed to get proposal comments"),{comments:[],total:0}}}async function n(a,b){let c=await (0,f.d)();if(!c)return{success:!1,error:"Unauthorized"};if(!b.trim())return{success:!1,error:"Comment content is required"};try{let d=await (0,h.o4)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};let e=await (0,g.eT)({companyUuid:c.companyUuid,targetType:"experiment_design",targetUuid:a,content:b.trim(),authorType:c.type,authorUuid:c.actorUuid});return d.project?.uuid&&await (0,i.createActivity)({companyUuid:c.companyUuid,researchProjectUuid:d.project.uuid,targetType:"experiment_design",targetUuid:a,actorType:c.type,actorUuid:c.actorUuid,action:"comment_added"}),{success:!0,comment:e}}catch(a){return o.error({err:a},"Failed to create proposal comment"),{success:!1,error:"Failed to create comment"}}}(0,k.D)([m,n]),(0,e.A)(m,"400e0adbec22ef37d015830c0c3ff93385846f0f2c",null),(0,e.A)(n,"60eb8b406bda37b41cbdbf1462e45ee2945bc7aa10",null),d()}catch(a){d(a)}})},45433:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{O:()=>G});var e=c(10837),f=c(21968),g=c(1007),h=c(9222),i=c(33407),j=c(10694),k=c(92900),l=c(71693),m=c(79543),n=c(4045),o=c(87461),p=c(86460),q=c(9810),r=c(49599),s=c(42424),t=c(9994),u=c(20170),v=c(2852),w=c(74645),x=c(88536),y=c(55732),z=c(6019),A=c(41709),B=c(83457),C=c(44217),D=c(50388),E=c(66430),F=a([B]);B=(F.then?(await F)():F)[0];let H={high:{bg:"bg-[#FFEBEE]",text:"text-[#C4574C]"},medium:{bg:"bg-[#FFF3E0]",text:"text-[#E65100]"},low:{bg:"bg-[#F5F2EC]",text:"text-[#6B6B6B]"}};function G({taskDraft:a,allTaskDrafts:b,designUuid:c,canEdit:d,onClose:F,onSaved:G,onDeleted:I}){let J=(0,h.c)(),K=(0,g.useRouter)(),[L,M]=(0,f.useTransition)(),[N,O]=(0,f.useState)(!1),P=null===a,[Q,R]=(0,f.useState)(P),[S,T]=(0,f.useState)(a?.title||""),[U,V]=(0,f.useState)(a?.description||""),[W,X]=(0,f.useState)(a?.priority||"medium"),[Y,Z]=(0,f.useState)(a?.computeBudgetHours?.toString()||""),[$,_]=(0,f.useState)(a?.acceptanceCriteriaItems?.map(a=>({description:a.description,required:a.required??!0}))||[]),[aa,ab]=(0,f.useState)([]),[ac,ad]=(0,f.useState)(null),ae=(0,f.useMemo)(()=>P?aa:a?.dependsOnDraftUuids??[],[P,aa,a?.dependsOnDraftUuids]),af=(0,f.useMemo)(()=>ae.map(a=>b.find(b=>b.uuid===a)).filter(Boolean),[ae,b]),ag=(0,f.useMemo)(()=>{let c=new Set(ae);return b.filter(b=>b.uuid!==a?.uuid&&!c.has(b.uuid))},[a?.uuid,ae,b]),ah=()=>{a&&(T(a.title),V(a.description||""),X(a.priority||"medium"),Z(a.computeBudgetHours?.toString()||""),_(a.acceptanceCriteriaItems?.map(a=>({description:a.description,required:a.required??!0}))||[]),ad(null),R(!0))},ai=()=>{if(P)return void F();R(!1),a&&(T(a.title),V(a.description||""),X(a.priority||"medium"),Z(a.computeBudgetHours?.toString()||""),_(a.acceptanceCriteriaItems?.map(a=>({description:a.description,required:a.required??!0}))||[])),ad(null)},aj=H[a?.priority||"medium"]||H.medium,ak=()=>(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:J("proposals.dependsOn")}),af.length>0?(0,e.jsx)("div",{className:"mt-2 space-y-1.5",children:af.map(b=>(0,e.jsxs)("div",{className:"group flex items-center justify-between rounded-lg bg-[#FAF8F4] p-2.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)(i.A,{className:"h-3.5 w-3.5 shrink-0 text-[#C67A52]"}),(0,e.jsx)("span",{className:"text-xs text-[#2C2C2C] truncate",children:b.title})]}),d&&(0,e.jsx)(s.$,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity ml-2 shrink-0",onClick:()=>(b=>{if(P)return void ab(a=>a.filter(a=>a!==b));if(!a)return;let d=(a.dependsOnDraftUuids||[]).filter(a=>a!==b);M(async()=>{let b=await (0,D.S)(c,a.uuid,{dependsOnDraftUuids:d});b.success?(K.refresh(),G()):ad(b.error||J("proposals.failedToAddDependency"))})})(b.uuid),disabled:L,children:(0,e.jsx)(j.A,{className:"h-3.5 w-3.5 text-[#9A9A9A] hover:text-[#D32F2F]"})})]},b.uuid))}):(0,e.jsx)("p",{className:"mt-2 text-sm italic text-[#9A9A9A]",children:J("proposals.noDependencies")}),d&&ag.length>0&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsxs)(y.l6,{onValueChange:d=>(d=>{if(P)return void ab(a=>[...a,d]);if(!a)return;if(((a,c)=>{let d=new Set,e=[a];for(;e.length>0;){let a=e.shift();if(a===c)return!0;if(d.has(a))continue;d.add(a);let f=b.find(b=>b.uuid===a);f?.dependsOnDraftUuids&&e.push(...f.dependsOnDraftUuids)}return!1})(d,a.uuid))return void ad(J("proposals.cyclicDependency"));ad(null);let e=[...a.dependsOnDraftUuids||[],d];M(async()=>{let b=await (0,D.S)(c,a.uuid,{dependsOnDraftUuids:e});b.success?(K.refresh(),G()):ad(b.error||J("proposals.failedToAddDependency"))})})(d),children:[(0,e.jsx)(y.bq,{className:"h-8 border-[#E5E0D8] text-xs text-[#6B6B6B] focus:ring-[#C67A52]",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(k.A,{className:"h-3 w-3"}),(0,e.jsx)(y.yv,{placeholder:J("proposals.selectDependency")})]})}),(0,e.jsx)(y.gC,{children:ag.map(a=>(0,e.jsx)(y.eb,{value:a.uuid,children:(0,e.jsx)("span",{className:"truncate",children:a.title})},a.uuid))})]},af.length)})]});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:F}),(0,e.jsxs)("div",{className:`fixed right-0 top-14 md:top-0 z-50 flex h-[calc(100%-3.5rem)] md:h-full w-full md:w-[480px] flex-col bg-white shadow-xl border-l border-[#E5E0D8] ${N?"":"animate-in slide-in-from-right duration-300"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-[#F5F2EC] px-6 py-5",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:Q?(0,e.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C]",children:P?J("proposals.newTaskDraft"):J("proposals.editTaskDraft")}):a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C] truncate",children:a.title}),(0,e.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[a.priority&&(0,e.jsx)(r.E,{className:`text-[10px] font-medium border-0 ${aj.bg} ${aj.text}`,children:J(`priority.${a.priority}`)}),null!=a.computeBudgetHours&&a.computeBudgetHours>0&&(0,e.jsxs)("span",{className:"flex items-center gap-1 rounded bg-[#F5F2EC] px-2 py-0.5 text-xs font-medium text-[#6B6B6B]",children:[(0,e.jsx)(n.A,{className:"h-2.5 w-2.5 text-[#C67A52]"}),a.computeBudgetHours," SP"]})]})]}):null}),(0,e.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[a&&!Q&&d&&(0,e.jsxs)(s.$,{variant:"outline",size:"sm",className:"h-8 gap-1.5 border-[#E5E0D8] text-[#2C2C2C]",onClick:ah,children:[(0,e.jsx)(o.A,{className:"h-3.5 w-3.5 text-[#6B6B6B]"}),(0,e.jsx)("span",{className:"text-xs",children:J("common.edit")})]}),(0,e.jsx)(s.$,{variant:"outline",size:"icon",className:"h-8 w-8 border-[#E5E0D8]",onClick:Q&&!P?ai:F,children:(0,e.jsx)(j.A,{className:"h-4 w-4 text-[#6B6B6B]"})})]})]}),(0,e.jsx)(w.F,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:(0,e.jsx)("div",{className:"flex min-h-full flex-col px-6 py-5",children:Q?(0,e.jsxs)("div",{className:"space-y-5",children:[ac&&(0,e.jsx)("div",{className:"rounded-lg bg-[#FFEBEE] p-3 text-sm text-[#C4574C]",children:ac}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(v.J,{htmlFor:"edit-title",className:"text-[13px] font-medium text-[#2C2C2C]",children:[J("proposals.taskTitle")," *"]}),(0,e.jsx)(t.p,{id:"edit-title",value:S,onChange:a=>T(a.target.value),placeholder:J("proposals.titlePlaceholder"),className:"border-[#E5E2DC] text-sm focus-visible:ring-[#C67A52]",autoFocus:!0})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(v.J,{htmlFor:"edit-description",className:"text-[13px] font-medium text-[#2C2C2C]",children:J("proposals.taskDescription")}),(0,e.jsx)(u.T,{id:"edit-description",value:U,onChange:a=>V(a.target.value),rows:4,className:"border-[#E5E2DC] text-sm resize-none focus-visible:ring-[#C67A52]",placeholder:J("proposals.descriptionPlaceholder")})]}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(v.J,{htmlFor:"edit-priority",className:"text-[13px] font-medium text-[#2C2C2C]",children:J("proposals.taskPriority")}),(0,e.jsxs)(y.l6,{value:W,onValueChange:X,children:[(0,e.jsx)(y.bq,{className:"border-[#E5E2DC] text-sm focus:ring-[#C67A52]",children:(0,e.jsx)(y.yv,{})}),(0,e.jsxs)(y.gC,{children:[(0,e.jsx)(y.eb,{value:"low",children:J("priority.low")}),(0,e.jsx)(y.eb,{value:"medium",children:J("priority.medium")}),(0,e.jsx)(y.eb,{value:"high",children:J("priority.high")})]})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(v.J,{htmlFor:"edit-story-points",className:"text-[13px] font-medium text-[#2C2C2C]",children:J("proposals.taskStoryPoints")}),(0,e.jsx)(t.p,{id:"edit-story-points",type:"number",min:"0",step:"0.5",value:Y,onChange:a=>Z(a.target.value),placeholder:J("proposals.computeBudgetHoursPlaceholder"),className:"border-[#E5E2DC] text-sm focus-visible:ring-[#C67A52]"})]})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)(v.J,{className:"text-[13px] font-medium text-[#2C2C2C] flex items-center gap-1.5",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 text-[#C67A52]"}),J("acceptanceCriteria.title")]}),$.length>0&&(0,e.jsx)("div",{className:"space-y-2",children:$.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-[#E5E2DC] bg-[#FAF8F4] p-2.5",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(t.p,{value:a.description,onChange:a=>{let c=[...$];c[b]={...c[b],description:a.target.value},_(c)},placeholder:J("acceptanceCriteria.criterionPlaceholder"),className:"border-[#E5E2DC] text-sm focus-visible:ring-[#C67A52] h-8"})}),(0,e.jsxs)("div",{className:"flex items-center gap-2 shrink-0 pt-1",children:[(0,e.jsx)(x.d,{checked:a.required??!0,onCheckedChange:a=>{let c=[...$];c[b]={...c[b],required:a},_(c)},className:"data-[state=checked]:bg-[#C67A52]"}),(0,e.jsx)("span",{className:"text-[10px] font-medium text-[#6B6B6B] min-w-[52px]",children:a.required??!0?J("acceptanceCriteria.required"):J("acceptanceCriteria.optional")}),(0,e.jsx)(s.$,{variant:"outline",size:"sm",className:"h-7 w-7 p-0 border-[#E5E2DC] text-[#9A9A9A] hover:text-[#D32F2F] hover:border-[#D32F2F] hover:bg-[#FFEBEE]",onClick:()=>{_($.filter((a,c)=>c!==b))},children:(0,e.jsx)(m.A,{className:"h-3 w-3"})})]})]},b))}),(0,e.jsxs)(s.$,{variant:"outline",size:"sm",className:"h-8 gap-1.5 border-[#E5E2DC] text-xs text-[#6B6B6B] hover:text-[#C67A52] hover:border-[#C67A52]",onClick:()=>{_([...$,{description:"",required:!0}])},children:[(0,e.jsx)(k.A,{className:"h-3 w-3"}),J("acceptanceCriteria.addCriterion")]})]}),ak()]}):a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:J("common.description")}),(0,e.jsx)("div",{className:"mt-2",children:a.description?(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[13px] leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(A.jH,{plugins:{code:B.a},children:a.description})}):(0,e.jsx)("p",{className:"text-sm italic text-[#9A9A9A]",children:J("common.noDescription")})})]}),a.acceptanceCriteria&&(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:J("tasks.acceptanceCriteria")}),(0,e.jsx)("div",{className:"mt-2",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[13px] leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(A.jH,{plugins:{code:B.a},children:a.acceptanceCriteria})})})]}),a.acceptanceCriteriaItems&&a.acceptanceCriteriaItems.length>0&&(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsxs)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A] flex items-center gap-1.5",children:[(0,e.jsx)(l.A,{className:"h-3 w-3"}),J("acceptanceCriteria.title")]}),(0,e.jsx)("div",{className:"mt-2 space-y-1.5",children:a.acceptanceCriteriaItems.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg bg-[#FAF8F4] p-2.5",children:[(0,e.jsx)("span",{className:"flex-1 text-[13px] text-[#2C2C2C]",children:a.description}),(0,e.jsx)(r.E,{className:`text-[10px] font-medium border-0 shrink-0 ${a.required??!0?"bg-[#FFF3E0] text-[#E65100]":"bg-[#F5F2EC] text-[#6B6B6B]"}`,children:a.required??!0?J("acceptanceCriteria.required"):J("acceptanceCriteria.optional")})]},b))})]}),ac&&(0,e.jsx)("div",{className:"mt-5 rounded-lg bg-[#FFEBEE] p-2.5 text-xs text-[#C4574C]",children:ac}),ak()]}):null})}),(0,e.jsx)("div",{className:"border-t border-[#F5F2EC] px-6 py-4",children:(0,e.jsx)("div",{className:"flex items-center gap-3",children:Q?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:ai,disabled:L,children:J("common.cancel")}),(0,e.jsx)(s.$,{className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",onClick:()=>{if(!S.trim())return void ad(J("proposals.titleRequired"));ad(null),M(async()=>{let b,d=$.filter(a=>a.description.trim().length>0),e={title:S.trim(),description:U.trim()||void 0,priority:W,computeBudgetHours:Y?parseFloat(Y):void 0,acceptanceCriteriaItems:d.length>0?d.map(a=>({description:a.description.trim(),required:a.required??!0})):void 0,...P&&aa.length>0?{dependsOnDraftUuids:aa}:{}};(b=P?await (0,C.w)(c,e):await (0,D.S)(c,a.uuid,e)).success?(R(!1),K.refresh(),G()):ad(b.error||J("proposals.failedToSaveTaskDraft"))})},disabled:L||!S.trim(),children:L?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.A,{className:"mr-2 h-4 w-4 animate-spin"}),J("common.saving")]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{className:"mr-2 h-4 w-4"}),P?J("common.create"):J("common.save")]})})]}):a?(0,e.jsxs)(e.Fragment,{children:[d&&(0,e.jsxs)(s.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:ah,children:[(0,e.jsx)(o.A,{className:"mr-2 h-4 w-4"}),J("common.edit")]}),d&&(0,e.jsx)("div",{className:"ml-auto",children:(0,e.jsxs)(z.Lt,{children:[(0,e.jsx)(z.tv,{asChild:!0,children:(0,e.jsx)(s.$,{variant:"outline",size:"icon",className:"h-9 w-9 border-[#E5E0D8] text-[#D32F2F] hover:bg-[#FFEBEE] hover:text-[#D32F2F] hover:border-[#D32F2F]",children:(0,e.jsx)(m.A,{className:"h-4 w-4"})})}),(0,e.jsxs)(z.EO,{children:[(0,e.jsxs)(z.wd,{children:[(0,e.jsx)(z.r7,{children:J("proposals.deleteExperimentRunDraft")}),(0,e.jsx)(z.$v,{children:J("proposals.deleteExperimentRunDraftConfirm")})]}),(0,e.jsxs)(z.ck,{children:[(0,e.jsx)(z.Zr,{children:J("common.cancel")}),(0,e.jsx)(z.Rx,{onClick:()=>{a&&M(async()=>{(await (0,E.j)(c,a.uuid)).success&&(K.refresh(),I?.())})},disabled:L,className:"bg-[#D32F2F] hover:bg-[#B71C1C] text-white",children:L?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.A,{className:"mr-2 h-4 w-4 animate-spin"}),J("common.delete")]}):J("common.delete")})]})]})]})})]}):null})})]})]})}d()}catch(a){d(a)}})},48161:a=>{"use strict";a.exports=require("node:os")},49102:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},50388:(a,b,c)=>{"use strict";c.d(b,{S:()=>e});var d=c(42377);let e=(0,d.createServerReference)("7001eb4571b8964fd95ad3b7fcbbd3a2195e7de288",d.callServer,void 0,d.findSourceMapURL,"updateRunDraftAction")},51277:(a,b,c)=>{"use strict";c.d(b,{DesignValidationChecklist:()=>t});var d=c(10837),e=c(21968),f=c(9222),g=c(97825),h=c(55775),i=c(21692),j=c(71693),k=c(98893),l=c(85487),m=c(21790),n=c(35198),o=c(49599),p=c(96307);function q({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"skeleton",className:(0,p.cn)("bg-accent animate-pulse rounded-md",a),...b})}let r={error:g.A,warning:h.A,info:i.A},s={error:{icon:"text-red-500",bg:"bg-red-50",badge:"bg-red-100 text-red-700"},warning:{icon:"text-amber-500",bg:"bg-amber-50",badge:"bg-amber-100 text-amber-700"},info:{icon:"text-blue-500",bg:"bg-blue-50",badge:"bg-blue-100 text-blue-700"}};function t({projectUuid:a,designUuid:b,status:c}){let i=(0,f.c)("proposalValidation"),[p,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(!0),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1);if("draft"!==c)return null;if(u)return(0,d.jsx)(n.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0",children:(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{className:"text-[13px] font-semibold text-foreground",children:i("title")})]}),(0,d.jsx)(q,{className:"h-5 w-20"})]})});if(w)return(0,d.jsx)(n.Zp,{className:"border-red-200 shadow-none rounded-2xl gap-0 py-0",children:(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{className:"text-[13px] font-semibold text-foreground",children:i("title")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-600",children:[(0,d.jsx)(g.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{children:w})]})]})});if(!p)return null;let A={error:[],warning:[],info:[]};for(let a of p.issues)A[a.level].push(a);let B=[...A.error,...A.warning,...A.info],C=A.error.length,D=A.warning.length,E=(0,d.jsxs)("button",{type:"button",onClick:()=>z(!y),className:"flex w-full items-center justify-between px-5 py-3.5 cursor-pointer hover:bg-[#FAF8F4] transition-colors rounded-2xl",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{className:"text-[13px] font-semibold text-foreground",children:i("title")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[p.valid?(0,d.jsxs)(o.E,{className:"border-0 bg-green-100 text-green-700 text-[11px] font-medium",children:[(0,d.jsx)(k.A,{className:"mr-1 h-3 w-3"}),i("passed")]}):(0,d.jsxs)(d.Fragment,{children:[C>0&&(0,d.jsxs)(o.E,{className:"border-0 bg-red-100 text-red-700 text-[11px] font-medium",children:[(0,d.jsx)(g.A,{className:"mr-1 h-3 w-3"}),i("errorCount",{count:C})]}),D>0&&(0,d.jsxs)(o.E,{className:"border-0 bg-amber-100 text-amber-700 text-[11px] font-medium",children:[(0,d.jsx)(h.A,{className:"mr-1 h-3 w-3"}),i("warningCount",{count:D})]})]}),y?(0,d.jsx)(l.A,{className:"h-4 w-4 text-muted-foreground"}):(0,d.jsx)(m.A,{className:"h-4 w-4 text-muted-foreground"})]})]});return(0,d.jsxs)(n.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[E,y&&(0,d.jsx)(n.Wu,{className:"px-4 pb-4 pt-0",children:0===B.length?(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-green-600 px-1 py-2",children:[(0,d.jsx)(k.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{children:i("passed")})]}):(0,d.jsx)("div",{className:"space-y-2",children:B.map((a,b)=>{let c=r[a.level],e=s[a.level];return(0,d.jsxs)("div",{className:`flex items-center gap-2.5 rounded-lg px-3 py-2.5 ${e.bg}`,children:[(0,d.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 ${e.icon}`}),(0,d.jsx)("span",{className:"flex-1 min-w-0 text-xs text-foreground",children:a.field?i(a.id,{title:a.field}):i(a.id)}),(0,d.jsx)(o.E,{className:`shrink-0 border-0 text-[10px] font-medium ${e.badge}`,children:i(a.level)})]},`${a.id}-${b}`)})})})]})}},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},53376:(a,b,c)=>{"use strict";c.d(b,{R:()=>w});var d=c(10837),e=c(21968),f=c(1007),g=c(9222),h=c(9810),i=c(21790),j=c(86460),k=c(49599),l=c(42424),m=c(35198),n=c(9994),o=c(2852),p=c(11225),q=c(82658),r=c(42377);let s=(0,r.createServerReference)("707a4a486695fd0b49c89e5eeec64dc88d3093c6dd",r.callServer,void 0,r.findSourceMapURL,"submitHypothesisFormulationAnswersAction"),t="__other__",u={hypothesis:"hypothesis",methodology:"methodology",prior_work:"priorWork",resources:"resources",success_metrics:"successMetrics",scope:"scope"},v={hypothesis:"bg-[#E8F5E9] text-[#2E7D32]",methodology:"bg-[#E3F2FD] text-[#1565C0]",prior_work:"bg-[#FFF3E0] text-[#E65100]",resources:"bg-[#F3E5F5] text-[#7B1FA2]",success_metrics:"bg-[#E0F2F1] text-[#00796B]",scope:"bg-[#FBE9E7] text-[#BF360C]"};function w({questionUuid:a,elaboration:b,onRefresh:c}){let e=(0,g.c)("elaboration"),h=(0,f.useRouter)();if(!b||0===b.rounds.length)return null;let{summary:i,rounds:j}=b;return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:e("title")}),(0,d.jsx)("span",{className:"text-xs font-medium text-[#C67A52]",children:e("answeredCounter",{answered:i.answeredQuestions,total:i.totalQuestions})})]}),(0,d.jsx)("div",{className:"space-y-2.5",children:j.map(b=>(0,d.jsx)(x,{round:b,questionUuid:a,onAnswered:()=>{c?.(),h.refresh()}},b.uuid))})]})}function x({round:a,questionUuid:b,onAnswered:c}){let f=(0,g.c)("elaboration"),j="pending_answers"===a.status,l="validated"===a.status,[n,o]=(0,e.useState)(j);return(0,d.jsx)(q.Nt,{open:n,onOpenChange:o,children:(0,d.jsxs)(m.Zp,{className:`border-[#E5E0D8] overflow-hidden ${j?"border-[#C67A52] border-[1.5px]":""}`,children:[(0,d.jsx)(q.R6,{asChild:!0,children:(0,d.jsxs)("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-[#FAF8F4] transition-colors",children:[(0,d.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#C67A52] text-[11px] font-semibold text-white",children:a.roundNumber}),(0,d.jsx)("span",{className:"flex-1 text-sm font-medium text-[#2C2C2C]",children:f("roundLabel",{number:a.roundNumber})}),l?(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 text-[#5A9E6F]"}),(0,d.jsx)("span",{className:"text-[11px] font-medium text-[#5A9E6F]",children:f("validated")})]}):j?(0,d.jsx)(k.E,{className:"bg-[#FFF3E0] text-[#E65100] border-transparent text-[10px]",children:f("pendingAnswers")}):(0,d.jsx)(k.E,{className:"bg-[#E3F2FD] text-[#1976D2] border-transparent text-[10px]",children:f("statusAnswered")}),(0,d.jsx)(i.A,{className:`h-4 w-4 text-[#9A9A9A] transition-transform ${n?"rotate-180":""}`})]})}),(0,d.jsx)(q.Ke,{children:(0,d.jsx)("div",{className:"border-t border-[#F5F2EC] px-4 py-3",children:j?(0,d.jsx)(A,{round:a,questionUuid:b,onAnswered:c}):(0,d.jsx)(y,{round:a})})})]})})}function y({round:a}){let b=(0,g.c)("elaboration");return(0,d.jsx)("div",{className:"space-y-3",children:a.questions.map(a=>(0,d.jsx)(z,{question:a,t:b},a.uuid))})}function z({question:a,t:b}){let c=a.answer?.selectedOptionId?a.options.find(b=>b.id===a.answer?.selectedOptionId):null,e=u[a.category]||a.category,f=v[a.category]||"bg-[#F5F5F5] text-[#6B6B6B]";return(0,d.jsx)("div",{className:"space-y-1.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 border-[#C67A52]",children:(0,d.jsx)("span",{className:"h-2 w-2 rounded-full bg-[#C67A52]"})}),(0,d.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("p",{className:"text-[13px] leading-snug text-[#2C2C2C]",children:a.text}),(0,d.jsx)(k.E,{className:`shrink-0 border-transparent text-[9px] px-1.5 py-0 ${f}`,children:b(`category.${e}`)})]}),(0,d.jsx)("p",{className:"text-[12px] text-[#6B6B6B]",children:a.answer?.customText?a.answer.customText:c?.label||b("noAnswer")})]})]})})}function A({round:a,questionUuid:b,onAnswered:c}){let f=(0,g.c)("elaboration"),[h,i]=(0,e.useState)({}),[m,q]=(0,e.useState)(!1),[r,w]=(0,e.useState)(null),x=(0,e.useCallback)((a,b)=>{i(c=>({...c,[a]:{questionId:a,selectedOptionId:b===t?null:b,customText:b===t?c[a]?.customText||"":null}}))},[]),y=(0,e.useCallback)((a,b)=>{i(c=>({...c,[a]:{...c[a],questionId:a,selectedOptionId:null,customText:b}}))},[]),z=a.questions.filter(a=>a.required).every(a=>{let b=h[a.questionId];return!!b&&!!(b.selectedOptionId||b.customText&&b.customText.trim())}),A=async()=>{q(!0),w(null);let d=Object.values(h),e=await s(b,a.uuid,d);q(!1),e.success?c():w(e.error||f("submitFailed"))};return(0,d.jsxs)("div",{className:"space-y-4",children:[a.questions.map(a=>{let b=u[a.category]||a.category,c=v[a.category]||"bg-[#F5F5F5] text-[#6B6B6B]",e=(a=>{let b=h[a];return b?null===b.selectedOptionId&&null!==b.customText&&void 0!==b.customText?t:b.selectedOptionId||"":""})(a.questionId);return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsxs)("p",{className:"flex-1 text-[13px] font-medium leading-snug text-[#2C2C2C]",children:[a.text,a.required&&(0,d.jsx)("span",{className:"ml-0.5 text-[#C67A52]",children:"*"})]}),(0,d.jsx)(k.E,{className:`shrink-0 border-transparent text-[9px] px-1.5 py-0 ${c}`,children:f(`category.${b}`)})]}),(0,d.jsxs)(p.z,{value:e,onValueChange:b=>x(a.questionId,b),className:"gap-2 pl-1",children:[a.options.map(b=>(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(p.C,{value:b.id,id:`${a.uuid}-${b.id}`,className:"mt-0.5 border-[#C67A52] text-[#C67A52] data-[state=checked]:border-[#C67A52]"}),(0,d.jsxs)(o.J,{htmlFor:`${a.uuid}-${b.id}`,className:"text-[12px] leading-snug text-[#2C2C2C] font-normal cursor-pointer",children:[b.label,b.description&&(0,d.jsx)("span",{className:"block text-[11px] text-[#6B6B6B]",children:b.description})]})]},b.id)),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(p.C,{value:t,id:`${a.uuid}-other`,className:"mt-0.5 border-[#C67A52] text-[#C67A52] data-[state=checked]:border-[#C67A52]"}),(0,d.jsx)(o.J,{htmlFor:`${a.uuid}-other`,className:"text-[12px] leading-snug text-[#2C2C2C] font-normal cursor-pointer",children:f("otherOption")})]}),e===t&&(0,d.jsx)(n.p,{value:h[a.questionId]?.customText||"",onChange:b=>y(a.questionId,b.target.value),placeholder:f("otherPlaceholder"),className:"ml-6 h-8 max-w-sm border-[#E5E0D8] text-[12px] focus-visible:ring-[#C67A52]",autoFocus:!0})]})]})]},a.uuid)}),r&&(0,d.jsx)("div",{className:"rounded-lg bg-destructive/10 p-2.5 text-[12px] text-destructive",children:r}),(0,d.jsx)("div",{className:"flex justify-end pt-1",children:(0,d.jsx)(l.$,{onClick:A,disabled:!z||m,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white text-[13px]",children:m?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),f("submitting")]}):f("submitAnswers")})})]})}},53460:(a,b,c)=>{"use strict";c.d(b,{DesignActions:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call DesignActions() from the server but DesignActions is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/design-actions.tsx","DesignActions")},55063:a=>{"use strict";a.exports=import("shiki/engine/javascript")},55511:a=>{"use strict";a.exports=require("crypto")},57609:(a,b,c)=>{"use strict";c.d(b,{E:()=>i});var d=c(10023);c(73426);var e=c(89571),f=c(15362),g=c(63413);let h=(0,e.F)("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline",success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100"}},defaultVariants:{variant:"default"}});function i({className:a,variant:b="default",asChild:c=!1,...e}){let i=c?f.bL:"span";return(0,d.jsx)(i,{"data-slot":"badge","data-variant":b,className:(0,g.cn)(h({variant:b}),a),...e})}},59780:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},60123:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},61007:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},61159:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]])},62221:(a,b,c)=>{"use strict";c.d(b,{L:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60e8964f43a0c46fd7eb5bd44d07a1998e66e2269c",d.callServer,void 0,d.findSourceMapURL,"removeDocumentDraftAction")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{"use strict";a.exports=import("pg")},66430:(a,b,c)=>{"use strict";c.d(b,{j:()=>e});var d=c(42377);let e=(0,d.createServerReference)("607ac07f8a321d8f99cd779629db2138ea431c900d",d.callServer,void 0,d.findSourceMapURL,"removeRunDraftAction")},67341:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},67413:(a,b,c)=>{"use strict";c.d(b,{SourceQuestionsCard:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call SourceQuestionsCard() from the server but SourceQuestionsCard is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/source-questions-card.tsx","SourceQuestionsCard")},68199:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{SourceQuestionsCard:()=>m});var e=c(10837),f=c(21968),g=c(9222),h=c(5797),i=c(33962),j=c(35198),k=c(6070),l=a([k]);function m({ideas:a,projectUuid:b,currentUserUuid:c}){let d=(0,g.c)("proposals"),[l,m]=(0,f.useState)(null);return 0===a.length?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(j.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(j.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(h.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,e.jsx)(j.ZB,{className:"text-[13px] font-semibold text-foreground",children:d("sourceIdeas")})]})}),(0,e.jsx)(j.Wu,{className:"space-y-2 px-5 py-3",children:a.map(a=>(0,e.jsxs)("button",{onClick:()=>m(a),className:"flex w-full items-center gap-2 rounded-lg bg-[#F5F2EC] px-3 py-2 text-left transition-colors hover:bg-[#EDE9E3]",children:[(0,e.jsx)(h.A,{className:"h-3.5 w-3.5 shrink-0 text-[#C67A52]"}),(0,e.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-[#C67A52]",children:a.title}),(0,e.jsx)(i.A,{className:"h-3 w-3 shrink-0 text-[#9A9A9A]"})]},a.uuid))})]}),l&&(0,e.jsx)(k.D,{idea:l,projectUuid:b,currentUserUuid:c,onClose:()=>m(null)})]})}k=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},68989:(a,b,c)=>{"use strict";c.d(b,{I:()=>e});var d=c(42377);let e=(0,d.createServerReference)("70706397cc55ec694918ffe090cec7e476c444e25a",d.callServer,void 0,d.findSourceMapURL,"updateDocumentDraftAction")},71693:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("clipboard-check",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]])},71902:(a,b,c)=>{"use strict";c(5486),c(97307).vF.child({module:"auth"})},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73566:a=>{"use strict";a.exports=require("worker_threads")},74236:(a,b,c)=>{"use strict";c.d(b,{Wu:()=>i,ZB:()=>h,Zp:()=>f,aR:()=>g});var d=c(10023);c(73426);var e=c(63413);function f({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card",className:(0,e.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...b})}function g({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:(0,e.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...b})}function h({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:(0,e.cn)("leading-none font-semibold",a),...b})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:(0,e.cn)("px-6",a),...b})}},75335:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},75811:a=>{"use strict";a.exports=import("@prisma/client/runtime/query_compiler_fast_bg.postgresql.mjs")},76760:a=>{"use strict";a.exports=require("node:path")},78112:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M9:()=>x,Qh:()=>t,Qr:()=>s,Tn:()=>q,Xw:()=>u,Yu:()=>p,ci:()=>w,eN:()=>A,gT:()=>y,nW:()=>z,o4:()=>r,x7:()=>v});var e=c(55511),f=c(52618),g=c(18818),h=c(76872),i=c(911),j=c(8777),k=c(46499),l=a([f,h,j,k]);function m(a){return{...a,uuid:a.uuid||(0,e.randomUUID)()}}function n(a){return{...a,uuid:a.uuid||(0,e.randomUUID)()}}async function o(a){let b="user"===a.createdByType?"user":"agent",[c,d]=await Promise.all([(0,h.LS)(a.createdByUuid,b),(0,h.SJ)(a.reviewedByUuid,a.reviewNote,a.reviewedAt)]),e={uuid:a.uuid,title:a.title,description:a.description,inputType:a.inputType,inputUuids:a.inputUuids,documentDrafts:a.documentDrafts,taskDrafts:a.taskDrafts,status:a.status,createdBy:c,createdByType:a.createdByType,review:d,createdAt:a.createdAt.toISOString(),updatedAt:a.updatedAt.toISOString()};return a.researchProject&&(e.project=a.researchProject),e}async function p(a,b){let c=await f.prisma.experimentDesign.findFirst({where:{uuid:b,companyUuid:a}});if(!c)throw Error("ExperimentDesign not found");let d=[],e=c.documentDrafts||[],g=c.taskDrafts||[],h=c.inputUuids||[];for(let a of(0===e.length&&d.push({id:"E1",level:"error",message:"Proposal must contain at least one document draft"}),e))(!a.content||a.content.length<100)&&d.push({id:"E2",level:"error",message:`Document draft "${a.title}" must have content with at least 100 characters`,field:a.title});if(0===g.length&&d.push({id:"E3",level:"error",message:"Proposal must contain at least one task draft"}),0===h.length&&d.push({id:"E4",level:"error",message:"Proposal must have at least one input (idea or other source)"}),"research_question"===c.inputType&&h.length>0)for(let b of(await f.prisma.researchQuestion.findMany({where:{uuid:{in:h},companyUuid:a},select:{uuid:!0,title:!0,elaborationStatus:!0}})))"resolved"!==b.elaborationStatus&&d.push({id:"E5",level:"error",message:`Input idea "${b.title}" has unresolved elaboration (status: ${b.elaborationStatus})`,field:b.title});for(let a of(e.some(a=>"tech_design"===a.type)||d.push({id:"W1",level:"warning",message:"Proposal should contain at least one tech design document draft"}),g))a.description&&0!==a.description.trim().length||d.push({id:"W2",level:"warning",message:`Task draft "${a.title}" is missing a description`,field:a.title});for(let a of g)a.acceptanceCriteriaItems&&0!==a.acceptanceCriteriaItems.length||d.push({id:"E-AC",level:"error",message:`Task draft "${a.title}" is missing acceptance criteria (structured items required)`,field:a.title});for(let a of(g.length>=2&&(g.some(a=>a.dependsOnDraftUuids&&a.dependsOnDraftUuids.length>0)||d.push({id:"W4",level:"warning",message:"When there are multiple tasks, at least one should declare dependencies"})),c.description&&0!==c.description.trim().length||d.push({id:"W5",level:"warning",message:"Proposal description should not be empty"}),g))a.priority||d.push({id:"I1",level:"info",message:`Task draft "${a.title}" does not have a priority set`,field:a.title});for(let a of g)null==a.computeBudgetHours&&d.push({id:"I2",level:"info",message:`Task draft "${a.title}" does not have story points set`,field:a.title});return{valid:!d.some(a=>"error"===a.level),issues:d}}async function q({companyUuid:a,researchProjectUuid:b,skip:c,take:d,status:e}){let g={researchProjectUuid:b,companyUuid:a,...e&&{status:e}},[h,i]=await Promise.all([f.prisma.experimentDesign.findMany({where:g,skip:c,take:d,orderBy:{createdAt:"desc"},select:{uuid:!0,title:!0,description:!0,inputType:!0,inputUuids:!0,documentDrafts:!0,taskDrafts:!0,status:!0,createdByUuid:!0,createdByType:!0,reviewedByUuid:!0,reviewNote:!0,reviewedAt:!0,createdAt:!0,updatedAt:!0}}),f.prisma.experimentDesign.count({where:g})]);return{experimentDesigns:await Promise.all(h.map(a=>o(a))),total:i}}async function r(a,b){let c=await f.prisma.experimentDesign.findFirst({where:{uuid:b,companyUuid:a},include:{researchProject:{select:{uuid:!0,name:!0}}}});return c?o(c):null}async function s(a,b){return f.prisma.experimentDesign.findFirst({where:{uuid:b,companyUuid:a}})}async function t(a){let b=a.documentDrafts?.map(m),c=a.taskDrafts?.map(n),d=await f.prisma.experimentDesign.create({data:{companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,title:a.title,description:a.description,inputType:a.inputType,inputUuids:a.inputUuids,...b&&{documentDrafts:b},...c&&{taskDrafts:c},status:"draft",createdByUuid:a.createdByUuid,createdByType:a.createdByType||"agent"},select:{uuid:!0,title:!0,description:!0,inputType:!0,inputUuids:!0,documentDrafts:!0,taskDrafts:!0,status:!0,createdByUuid:!0,createdByType:!0,reviewedByUuid:!0,reviewNote:!0,reviewedAt:!0,createdAt:!0,updatedAt:!0}});return i.B.emitChange({companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,entityType:"experiment_design",entityUuid:d.uuid,action:"created"}),o(d)}async function u(a,b,c,d){let e=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b}});if(!e)throw Error("ExperimentDesign not found");let{updatedProposal:g,materializedTasks:h,materializedDocuments:l}=await f.prisma.$transaction(async b=>{let f=await b.experimentDesign.update({where:{uuid:a},data:{status:"approved",reviewedByUuid:c,reviewNote:d||null,reviewedAt:new Date},include:{researchProject:{select:{uuid:!0,name:!0}}}}),g=e.documentDrafts,h=e.taskDrafts,i=[],l=[];if(g&&g.length>0)for(let a of g){let b=await (0,j.hG)(e.companyUuid,e.researchProjectUuid,e.uuid,e.createdByUuid,a);l.push({draftUuid:a.uuid,documentUuid:b.uuid,title:b.title})}if(h&&h.length>0){for(let a of h)if(a.acceptanceCriteriaItems&&a.acceptanceCriteriaItems.length>0)for(let b=0;b<a.acceptanceCriteriaItems.length;b++){let c=a.acceptanceCriteriaItems[b];if(!c.description||"string"!=typeof c.description||0===c.description.trim().length)throw Error(`Task draft "${a.title}": acceptanceCriteriaItems[${b}] has an empty or invalid description`)}let{draftToTaskUuidMap:a}=await (0,k.Kb)(e.companyUuid,e.researchProjectUuid,e.uuid,e.createdByUuid,h);for(let b of h){let c=a.get(b.uuid);c&&i.push({draftUuid:b.uuid,runUuid:c,title:b.title})}for(let c of h){if(c.dependsOnDraftUuids&&c.dependsOnDraftUuids.length>0){let d=a.get(c.uuid);if(!d)continue;for(let e of c.dependsOnDraftUuids){let c=a.get(e);c&&await b.runDependency.create({data:{runUuid:d,dependsOnRunUuid:c}})}}if(c.acceptanceCriteriaItems&&c.acceptanceCriteriaItems.length>0){let d=a.get(c.uuid);if(!d)continue;await b.acceptanceCriterion.createMany({data:c.acceptanceCriteriaItems.map((a,b)=>({runUuid:d,description:a.description.trim(),required:a.required??!0,sortOrder:b}))})}}}return{updatedProposal:f,materializedTasks:i,materializedDocuments:l}});if(i.B.emitChange({companyUuid:e.companyUuid,researchProjectUuid:e.researchProjectUuid,entityType:"experiment_design",entityUuid:a,action:"updated"}),"research_question"===e.inputType){let a=e.inputUuids||[];a.length>0&&await f.prisma.researchQuestion.updateMany({where:{uuid:{in:a},companyUuid:b,status:"proposal_created"},data:{status:"completed"}})}let m=await o(g);return h.length>0&&(m.materializedTasks=h),l.length>0&&(m.materializedDocuments=l),m}async function v(a,b,c){let d=await f.prisma.experimentDesign.update({where:{uuid:a},data:{status:"draft",reviewedByUuid:b,reviewNote:c,reviewedAt:new Date},include:{researchProject:{select:{uuid:!0,name:!0}}}});return i.B.emitChange({companyUuid:d.companyUuid,researchProjectUuid:d.researchProjectUuid,entityType:"experiment_design",entityUuid:d.uuid,action:"updated"}),o(d)}async function w(a,b,c){let d=await f.prisma.experimentDesign.update({where:{uuid:a},data:{status:"closed",reviewedByUuid:b,reviewNote:c,reviewedAt:new Date},include:{researchProject:{select:{uuid:!0,name:!0}}}});return i.B.emitChange({companyUuid:d.companyUuid,researchProjectUuid:d.researchProjectUuid,entityType:"experiment_design",entityUuid:d.uuid,action:"updated"}),o(d)}async function x(a,b,c){let d=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b,status:"draft"}});if(!d)throw Error("ExperimentDesign not found or not in draft status");let e=d.documentDrafts||[],g=m(c),h=[...e,g],i=await f.prisma.experimentDesign.update({where:{uuid:a},data:{documentDrafts:h},include:{researchProject:{select:{uuid:!0,name:!0}}}});return o(i)}async function y(a,b,c,d){let e=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b,status:"draft"}});if(!e)throw Error("ExperimentDesign not found or not in draft status");let g=e.documentDrafts||[],h=g.findIndex(a=>a.uuid===c);if(-1===h)throw Error("Document draft not found");g[h]={...g[h],...d};let i=await f.prisma.experimentDesign.update({where:{uuid:a},data:{documentDrafts:g},include:{researchProject:{select:{uuid:!0,name:!0}}}});return o(i)}async function z(a,b,c){let d=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b,status:"draft"}});if(!d)throw Error("ExperimentDesign not found or not in draft status");let e=(d.documentDrafts||[]).filter(a=>a.uuid!==c),h=await f.prisma.experimentDesign.update({where:{uuid:a},data:{documentDrafts:e.length>0?e:g.D1.Fj},include:{researchProject:{select:{uuid:!0,name:!0}}}});return o(h)}async function A(a,b){let c=await f.prisma.experimentDesign.findMany({where:{companyUuid:a,researchProjectUuid:b,status:"approved"},select:{uuid:!0,title:!0,createdAt:!0},orderBy:{createdAt:"asc"}}),d=await f.prisma.experimentRun.groupBy({by:["experimentDesignUuid"],where:{companyUuid:a,researchProjectUuid:b,experimentDesignUuid:{in:c.map(a=>a.uuid)}},_count:!0}),e=new Map(d.map(a=>[a.experimentDesignUuid,a._count]));return c.map((a,b)=>({uuid:a.uuid,title:a.title,sequenceNumber:b+1,taskCount:e.get(a.uuid)??0}))}[f,h,j,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},78474:a=>{"use strict";a.exports=require("node:events")},78908:a=>{"use strict";a.exports=import("shiki")},79428:a=>{"use strict";a.exports=require("buffer")},79551:a=>{"use strict";a.exports=require("url")},82658:(a,b,c)=>{"use strict";c.d(b,{Ke:()=>h,Nt:()=>f,R6:()=>g});var d=c(10837),e=c(70952);function f({...a}){return(0,d.jsx)(e.Root,{"data-slot":"collapsible",...a})}function g({...a}){return(0,d.jsx)(e.Trigger,{"data-slot":"collapsible-trigger",...a})}function h({...a}){return(0,d.jsx)(e.Content,{"data-slot":"collapsible-content",...a})}},82870:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=c(40869),f=c(92633),g=a([d,e,f]);[d,e,f]=g.then?(await g)():g,b()}catch(a){b(a)}})},83696:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},83997:a=>{"use strict";a.exports=require("tty")},84297:a=>{"use strict";a.exports=require("async_hooks")},85292:(a,b,c)=>{"use strict";c.d(b,{q:()=>e});var d=c(42377);let e=(0,d.createServerReference)("40b8e6a8f5b487648e2f31fb6caacf3faecaa89d14",d.callServer,void 0,d.findSourceMapURL,"getQuestionActivitiesAction")},85806:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{f0:()=>l});var e=c(15369),f=c(23180),g=c(90097),h=c(93890),i=c(9480),j=c(28774),k=c(466),l=c(67738),m=c(82870),n=c(30457),o=c(92592),p=c(34923),q=c(53870),r=c(59780),s=c(83696),t=c(4284),u=c(92256),v=c(51870),w=c(60123),x=a([e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w]);[e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w]=x.then?(await x)():x,d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87991:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]])},88536:(a,b,c)=>{"use strict";c.d(b,{d:()=>g});var d=c(10837);c(21968);var e=c(15644),f=c(96307);function g({className:a,...b}){return(0,d.jsx)(e.Root,{"data-slot":"switch",className:(0,f.cn)("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:ring-ring/50 inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...b,children:(0,d.jsx)(e.Thumb,{"data-slot":"switch-thumb",className:(0,f.cn)("bg-background pointer-events-none block size-4 rounded-full ring-0 shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}},88603:(a,b,c)=>{"use strict";c.d(b,{DesignEditor:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call DesignEditor() from the server but DesignEditor is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/design-editor.tsx","DesignEditor")},89792:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{DesignComments:()=>v});var e=c(10837),f=c(21968),g=c(9222),h=c(86460),i=c(16235),j=c(97443),k=c(24714),l=c(35198),m=c(42424),n=c(84819),o=c(80251),p=c(24433),q=c(28874),r=c(92425),s=c(82831),t=c(76172),u=a([s]);function v({designUuid:a,currentUserUuid:b}){let c=(0,g.c)(),[d,u]=(0,f.useState)(""),[v,w]=(0,f.useState)([]),[x,y]=(0,f.useState)(!0),[z,A]=(0,f.useState)(!1),B=(0,f.useRef)(null);(0,t.w0)("experiment_design",a,c=>{b&&c.actorUuid===b||(0,q.$)(a).then(a=>{w(a.comments)})});let C=async()=>{if(!d.trim()||z)return;A(!0);let b=await (0,r.e)(a,d);A(!1),b.success&&b.comment&&(w(a=>[...a,b.comment]),u(""),B.current?.clear())};return(0,e.jsxs)(l.Zp,{className:"border-[#E5E0D8] p-4",children:[(0,e.jsx)("h3",{className:"mb-3 text-sm font-medium text-[#6B6B6B]",children:c("comments.title")}),(0,e.jsx)("div",{className:"space-y-3",children:x?(0,e.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,e.jsx)(h.A,{className:"h-4 w-4 animate-spin text-[#9A9A9A]"})}):0===v.length?(0,e.jsx)("p",{className:"text-sm text-[#9A9A9A] italic",children:c("comments.noComments")}):v.map(a=>(0,e.jsxs)("div",{className:"flex gap-2.5",children:[(0,e.jsx)(o.eu,{className:"h-6 w-6",children:(0,e.jsx)(o.q5,{className:"agent"===a.author.type?"bg-[#C67A52] text-white":"bg-[#E5E0D8] text-[#6B6B6B] text-[10px]",children:"agent"===a.author.type?(0,e.jsx)(i.A,{className:"h-3 w-3"}):a.author.name.charAt(0).toUpperCase()})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-[#2C2C2C]",children:a.author.name}),(0,e.jsx)("span",{className:"text-[10px] text-[#9A9A9A]",children:function(a,b){let c=new Date(a),d=new Date().getTime()-c.getTime(),e=Math.floor(d/6e4),f=Math.floor(d/36e5),g=Math.floor(d/864e5);return e<1?b("time.justNow"):e<60?b("time.minutesAgo",{minutes:e}):f<24?b("time.hoursAgo",{hours:f}):g<7?b("time.daysAgo",{days:g}):c.toLocaleDateString()}(a.createdAt,c)})]}),(0,e.jsx)("div",{className:"mt-1 text-xs leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(s.z7,{children:a.content})})]})]},a.uuid))}),(0,e.jsx)(n.Separator,{className:"my-3 bg-[#F5F2EC]"}),(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(o.eu,{className:"mt-1.5 h-6 w-6",children:(0,e.jsx)(o.q5,{className:"bg-[#C67A52] text-white text-[10px]",children:(0,e.jsx)(j.A,{className:"h-3 w-3"})})}),(0,e.jsx)("div",{className:"flex-1",children:(0,e.jsx)(p.c,{ref:B,value:d,onChange:u,onSubmit:C,placeholder:c("comments.addComment"),className:"border-none bg-[#FAF8F4] text-sm",disabled:z})}),(0,e.jsx)(m.$,{size:"icon",variant:"ghost",className:"mt-1 h-7 w-7",disabled:!d.trim()||z,onClick:C,children:z?(0,e.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin text-[#9A9A9A]"}):(0,e.jsx)(k.A,{className:"h-3.5 w-3.5 text-[#C67A52]"})})]})]})}s=(u.then?(await u)():u)[0],d()}catch(a){d(a)}})},91645:a=>{"use strict";a.exports=require("net")},92190:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]])},92256:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},92425:(a,b,c)=>{"use strict";c.d(b,{e:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60eb8b406bda37b41cbdbf1462e45ee2945bc7aa10",d.callServer,void 0,d.findSourceMapURL,"createDesignCommentAction")},94521:(a,b,c)=>{"use strict";c.d(b,{n:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60a3f1338a100846860fe056719a21232d69b3ce75",d.callServer,void 0,d.findSourceMapURL,"createResearchQuestionCommentAction")},94735:a=>{"use strict";a.exports=require("events")},97450:(a,b,c)=>{"use strict";c.d(b,{MarkdownContent:()=>f});var d=c(10837),e=c(1461);function f({children:a}){return(0,d.jsx)(e.u,{children:a})}},97601:(a,b,c)=>{"use strict";c.d(b,{i:()=>p});var d=c(10837),e=c(21968),f=c(1007),g=c(9222),h=c(10694),i=c(86460),j=c(16235),k=c(97443),l=c(42424),m=c(2852),n=c(11225),o=c(55732);function p({idea:a,projectUuid:b,currentUserUuid:c,onClose:p}){let q=(0,g.c)(),r=(0,f.useRouter)(),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)("self"),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)([]),[E,F]=(0,e.useState)(!0),G=!!a.assignee,H=async()=>{t(!0);try{let b;if("self"===u)b=await fetch(`/api/research-questions/${a.uuid}/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assignToSelf:!0})});else if("agent"===u&&w)b=await fetch(`/api/research-questions/${a.uuid}/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentUuid:w})});else if("user"===u&&y)b=await fetch(`/api/research-questions/${a.uuid}/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assignToSelf:!1,userUuid:y})});else{if("release"!==u)return void t(!1);b=await fetch(`/api/research-questions/${a.uuid}/release`,{method:"POST"})}t(!1),b.ok&&(r.refresh(),p())}catch{t(!1)}},I="self"===u||"agent"===u&&w||"user"===u&&y||"release"===u&&G;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40",onClick:p}),(0,d.jsxs)("div",{className:"fixed left-1/2 top-1/2 z-50 w-[400px] -translate-x-1/2 -translate-y-1/2 rounded-2xl bg-white shadow-xl border border-[#E5E0D8]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between border-b border-[#E5E0D8] px-6 py-5",children:[(0,d.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C]",children:q("ideas.assignIdea")}),(0,d.jsx)("button",{onClick:p,className:"text-[#9A9A9A] hover:text-[#6B6B6B] transition-colors",children:(0,d.jsx)(h.A,{className:"h-5 w-5"})})]}),(0,d.jsxs)("div",{className:"p-6 space-y-4",children:[(0,d.jsxs)("div",{className:"rounded-lg bg-[#FAF8F4] p-3",children:[(0,d.jsx)("p",{className:"text-[13px] font-medium text-[#2C2C2C]",children:a.title}),a.content&&(0,d.jsx)("p",{className:"mt-1 text-[11px] text-[#6B6B6B] line-clamp-2",children:a.content})]}),G&&(0,d.jsx)("div",{className:"rounded-lg bg-[#E3F2FD] p-3",children:(0,d.jsxs)("p",{className:"text-xs text-[#1976D2]",children:[q("common.currentAssignee"),": ",(0,d.jsx)("span",{className:"font-medium",children:a.assignee?.name})]})}),(0,d.jsx)("p",{className:"text-[13px] text-[#6B6B6B]",children:q("ideas.selectIdeaAssignee")}),E?(0,d.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,d.jsx)(i.A,{className:"h-6 w-6 animate-spin text-[#9A9A9A]"})}):(0,d.jsxs)(n.z,{value:u,onValueChange:a=>v(a),className:"space-y-3",children:[(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors cursor-pointer ${"self"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8] hover:border-[#C67A52]/50"}`,onClick:()=>v("self"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(n.C,{value:"self",id:"idea-self",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-self",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("assign.assignToMyself")})]}),(0,d.jsx)("p",{className:"mt-2 ml-6 text-xs text-[#6B6B6B] leading-relaxed",children:q("ideas.assignToMyselfIdeaDesc")})]}),(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors ${"agent"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8]"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 cursor-pointer",onClick:()=>v("agent"),children:[(0,d.jsx)(n.C,{value:"agent",id:"idea-agent",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-agent",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("ideas.orAssignToPmAgent")})]}),(0,d.jsx)("p",{className:"mt-2 ml-6 text-xs text-[#6B6B6B] leading-relaxed",children:q("ideas.onlySelectedPmAgentCanWork")}),"agent"===u&&(0,d.jsx)("div",{className:"mt-3 ml-6",children:(0,d.jsxs)(o.l6,{value:w,onValueChange:x,children:[(0,d.jsx)(o.bq,{className:"w-full border-[#E5E0D8]",children:(0,d.jsx)(o.yv,{placeholder:q("ideas.selectPmAgent")})}),(0,d.jsx)(o.gC,{children:A.length>0?A.map(a=>(0,d.jsx)(o.eb,{value:a.uuid,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{children:a.name})]})},a.uuid)):(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-[#9A9A9A]",children:q("ideas.noPmAgentsAvailable")})})]})})]}),(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors ${"user"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8]"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 cursor-pointer",onClick:()=>v("user"),children:[(0,d.jsx)(n.C,{value:"user",id:"idea-user",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-user",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("assign.orAssignToUser")})]}),"user"===u&&(0,d.jsx)("div",{className:"mt-3 ml-6",children:(0,d.jsxs)(o.l6,{value:y,onValueChange:z,children:[(0,d.jsx)(o.bq,{className:"w-full border-[#E5E0D8]",children:(0,d.jsx)(o.yv,{placeholder:q("tasks.selectUser")})}),(0,d.jsx)(o.gC,{children:C.length>0?C.map(a=>(0,d.jsx)(o.eb,{value:a.uuid,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(k.A,{className:"h-4 w-4 text-[#6B6B6B]"}),(0,d.jsx)("span",{children:a.name||a.email})]})},a.uuid)):(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-[#9A9A9A]",children:q("tasks.noUsersAvailable")})})]})})]}),G&&(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors cursor-pointer ${"release"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8] hover:border-[#C67A52]/50"}`,onClick:()=>v("release"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(n.C,{value:"release",id:"idea-release",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-release",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("assign.releaseAssignee")})]}),(0,d.jsx)("p",{className:"mt-2 ml-6 text-xs text-[#6B6B6B] leading-relaxed",children:q("ideas.releaseIdeaAssigneeDesc")})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-4 rounded-b-2xl bg-white px-6 py-6 border-t border-[#E5E0D8]",children:[(0,d.jsx)(l.$,{variant:"outline",onClick:p,disabled:s,className:"border-[#E5E0D8]",children:q("common.cancel")}),(0,d.jsx)(l.$,{onClick:H,disabled:s||!I,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:s?(0,d.jsx)(i.A,{className:"h-4 w-4 animate-spin"}):q("release"===u?"common.release":"common.assign")})]})]})]})}},98175:(a,b,c)=>{"use strict";c.d(b,{U:()=>e});var d=c(42377);let e=(0,d.createServerReference)("6036b14c7a0b485d68bb436fcc5c9a726686abd8c6",d.callServer,void 0,d.findSourceMapURL,"addDocumentDraftAction")}};var b=require("../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[8843,7352,936,9833,3548,8481,8322,9516,1512,7201,7878,865,5826,117,9642,2956,3173,9865,2411,2914,5248,3656,1539,907,6088,5628,3513,5854,7357,314,3791,6499,8283,7018,691,759],()=>b(b.s=8176));module.exports=c})();
|
|
2
|
+
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:v.CachedRouteKind.APP_PAGE,html:l,headers:o,rscData:m.flightData,postponed:m.postponed,status:m.statusCode,segmentData:m.segmentData},cacheControl:n}},o=async({hasResolved:c,previousCacheEntry:f,isRevalidating:g,span:i})=>{let j,k=!1===K.isDev,l=c||b.writableEnded;if(ah&&ab&&!f&&!N)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(ai&&(j=(0,w.parseFallbackField)(ai.fallback)),j===w.FallbackMode.PRERENDER&&(0,u.isBot)(al)&&(!ar||an)&&(j=w.FallbackMode.BLOCKING_STATIC_RENDER),(null==f?void 0:f.isStale)===-1&&(ah=!0),ah&&(j!==w.FallbackMode.NOT_FOUND||f)&&(j=w.FallbackMode.BLOCKING_STATIC_RENDER),!N&&j!==w.FallbackMode.BLOCKING_STATIC_RENDER&&aB&&!l&&!_&&T&&(k||!aj)){let b;if((k||ai)&&j===w.FallbackMode.NOT_FOUND)throw new B.NoFallbackError;if(ar&&!ap){let c="string"==typeof(null==ai?void 0:ai.fallback)?ai.fallback:k?ag:null;if(b=await K.handleResponse({cacheKey:c,req:a,nextConfig:ad,routeKind:e.RouteKind.APP_PAGE,isFallback:!0,prerenderManifest:$,isRoutePPREnabled:ar,responseGenerator:async()=>m({span:i,postponed:void 0,fallbackRouteParams:k||at?(0,n.u)(ag):null}),waitUntil:d.waitUntil}),null===b)return null;if(b)return delete b.cacheControl,b}}let o=ah||g||!au?void 0:au;if(as&&void 0!==o)return{cacheControl:{revalidate:1,expire:void 0},value:{kind:v.CachedRouteKind.PAGES,html:x.default.EMPTY,pageData:{},headers:void 0,status:void 0}};let p=T&&ar&&((0,h.getRequestMeta)(a,"renderFallbackShell")||at)?(0,n.u)(af):null;return m({span:i,postponed:o,fallbackRouteParams:p})},p=async c=>{var f,g,i,j,k;let l,n=await K.handleResponse({cacheKey:aA,responseGenerator:a=>o({span:c,...a}),routeKind:e.RouteKind.APP_PAGE,isOnDemandRevalidate:ah,isRoutePPREnabled:ar,req:a,nextConfig:ad,prerenderManifest:$,waitUntil:d.waitUntil});if(_&&b.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate"),K.isDev&&b.setHeader("Cache-Control","no-store, must-revalidate"),!n){if(aA)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=n.value)?void 0:f.kind)!==v.CachedRouteKind.APP_PAGE)throw Object.defineProperty(Error(`Invariant app-page handler received invalid cache entry ${null==(i=n.value)?void 0:i.kind}`),"__NEXT_ERROR_CODE",{value:"E707",enumerable:!1,configurable:!0});let p="string"==typeof n.value.postponed;ak&&!av&&(!p||ao)&&(N||b.setHeader("x-nextjs-cache",ah?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),b.setHeader(t.NEXT_IS_PRERENDER_HEADER,"1"));let{value:q}=n;if(au)l={revalidate:0,expire:void 0};else if(N&&ap&&!ao&&ar)l={revalidate:0,expire:void 0};else if(!K.isDev)if(_)l={revalidate:0,expire:void 0};else if(ak){if(n.cacheControl)if("number"==typeof n.cacheControl.revalidate){if(n.cacheControl.revalidate<1)throw Object.defineProperty(Error(`Invalid revalidate configuration provided: ${n.cacheControl.revalidate} < 1`),"__NEXT_ERROR_CODE",{value:"E22",enumerable:!1,configurable:!0});l={revalidate:n.cacheControl.revalidate,expire:(null==(j=n.cacheControl)?void 0:j.expire)??ad.expireTime}}else l={revalidate:y.CACHE_ONE_YEAR,expire:void 0}}else b.getHeader("Cache-Control")||(l={revalidate:0,expire:void 0});if(n.cacheControl=l,"string"==typeof aw&&(null==q?void 0:q.kind)===v.CachedRouteKind.APP_PAGE&&q.segmentData){b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"2");let c=null==(k=q.headers)?void 0:k[y.NEXT_CACHE_TAGS_HEADER];N&&ak&&c&&"string"==typeof c&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,c);let d=q.segmentData.get(aw);return void 0!==d?(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.fromStatic(d,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl}):(b.statusCode=204,(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.EMPTY,cacheControl:n.cacheControl}))}let r=(0,h.getRequestMeta)(a,"onCacheEntry");if(r&&await r({...n,value:{...n.value,kind:"PAGE"}},{url:(0,h.getRequestMeta)(a,"initURL")}))return null;if(p&&au)throw Object.defineProperty(Error("Invariant: postponed state should not be present on a resume request"),"__NEXT_ERROR_CODE",{value:"E396",enumerable:!1,configurable:!0});if(q.headers){let a={...q.headers};for(let[c,d]of(N&&ak||delete a[y.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 s=null==(g=q.headers)?void 0:g[y.NEXT_CACHE_TAGS_HEADER];if(N&&ak&&s&&"string"==typeof s&&b.setHeader(y.NEXT_CACHE_TAGS_HEADER,s),!q.status||ap&&ar||(b.statusCode=q.status),!N&&q.status&&F.RedirectStatusCode[q.status]&&ap&&(b.statusCode=200),p&&b.setHeader(t.NEXT_DID_POSTPONE_HEADER,"1"),ap&&!_){if(void 0===q.rscData){if(q.postponed)throw Object.defineProperty(Error("Invariant: Expected postponed to be undefined"),"__NEXT_ERROR_CODE",{value:"E372",enumerable:!1,configurable:!0});return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:q.html,cacheControl:av?{revalidate:0,expire:void 0}:n.cacheControl})}return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:x.default.fromStatic(q.rscData,t.RSC_CONTENT_TYPE_HEADER),cacheControl:n.cacheControl})}let u=q.html;if(!p||N||ap)return(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:n.cacheControl});if(as)return u.push(new ReadableStream({start(a){a.enqueue(z.ENCODED_TAGS.CLOSED.BODY_AND_HTML),a.close()}})),(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:{revalidate:0,expire:void 0}});let w=new TransformStream;return u.push(w.readable),m({span:c,postponed:q.postponed,fallbackRouteParams:null}).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)!==v.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(w.writable)}).catch(a=>{w.writable.abort(a).catch(a=>{console.error("couldn't abort transformer",a)})}),(0,A.sendRenderResult)({req:a,res:b,generateEtags:ad.generateEtags,poweredByHeader:ad.poweredByHeader,result:u,cacheControl:{revalidate:0,expire:void 0}})};if(!aF)return await aE.withPropagatedContext(a.headers,()=>aE.trace(i.BaseServerSpan.handleRequest,{spanName:`${aD} ${a.url}`,kind:g.SpanKind.SERVER,attributes:{"http.method":aD,"http.target":a.url}},p));await p(aF)}catch(b){throw b instanceof B.NoFallbackError||await K.onRequestError(a,b,{routerKind:"App Router",routePath:G,routeType:"render",revalidateReason:(0,f.c)({isRevalidate:ak,isOnDemandRevalidate:ah})},ac),b}}},8777:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{Cs:()=>l,Nn:()=>o,YE:()=>k,hG:()=>p,lC:()=>j,lU:()=>n,ui:()=>m});var e=c(52618),f=c(76872),g=c(911),h=a([e,f]);async function i(a,b=!1){let c=await (0,f.LS)(a.createdByUuid),d={uuid:a.uuid,type:a.type,title:a.title,version:a.version,experimentDesignUuid:a.experimentDesignUuid,createdBy:c,createdAt:a.createdAt.toISOString(),updatedAt:a.updatedAt.toISOString()};return b&&void 0!==a.content&&(d.content=a.content),a.researchProject&&(d.project=a.researchProject),d}async function j({companyUuid:a,researchProjectUuid:b,skip:c,take:d,type:f}){let g={researchProjectUuid:b,companyUuid:a,...f&&{type:f}},[h,j]=await Promise.all([e.prisma.document.findMany({where:g,skip:c,take:d,orderBy:{updatedAt:"desc"},select:{uuid:!0,type:!0,title:!0,version:!0,experimentDesignUuid:!0,createdByUuid:!0,createdAt:!0,updatedAt:!0}}),e.prisma.document.count({where:g})]);return{documents:await Promise.all(h.map(a=>i(a))),total:j}}async function k(a,b){let c=await e.prisma.document.findFirst({where:{uuid:b,companyUuid:a},include:{researchProject:{select:{uuid:!0,name:!0}}}});return c?i(c,!0):null}async function l(a,b){return e.prisma.document.findFirst({where:{uuid:b,companyUuid:a}})}async function m(a){let b=await e.prisma.document.create({data:{companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,type:a.type,title:a.title,content:a.content,version:1,experimentDesignUuid:a.experimentDesignUuid,createdByUuid:a.createdByUuid},select:{uuid:!0,type:!0,title:!0,content:!0,version:!0,experimentDesignUuid:!0,createdByUuid:!0,createdAt:!0,updatedAt:!0}});return g.B.emitChange({companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,entityType:"document",entityUuid:b.uuid,action:"created"}),i(b,!0)}async function n(a,{title:b,content:c,incrementVersion:d}){let f={};void 0!==b&&(f.title=b),void 0!==c&&(f.content=c),d&&(f.version={increment:1});let g=await e.prisma.document.update({where:{uuid:a},data:f,include:{researchProject:{select:{uuid:!0,name:!0}}}});return i(g,!0)}async function o(a){return e.prisma.document.delete({where:{uuid:a}})}async function p(a,b,c,d,f){let g=await e.prisma.document.create({data:{companyUuid:a,researchProjectUuid:b,type:f.type||"prd",title:f.title,content:f.content||null,version:1,experimentDesignUuid:c,createdByUuid:d},select:{uuid:!0,type:!0,title:!0,content:!0,version:!0,experimentDesignUuid:!0,createdByUuid:!0,createdAt:!0,updatedAt:!0}});return i(g,!0)}[e,f]=h.then?(await h)():h,d()}catch(a){d(a)}})},9480:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{LI:()=>k,m:()=>j,nQ:()=>i});var e=c(71255),f=c(62729),g=c(85806),h=a([e,g]);async function i({companyUuid:a,researchQuestionUuid:b,roundUuid:c,actorUuid:d,actorType:h,answers:i}){let j=await e.z.hypothesisFormulation.findFirst({where:{uuid:c,researchQuestionUuid:b,companyUuid:a},include:{questions:!0}});if(!j)throw Error("HypothesisFormulation round not found");if("pending_answers"!==j.status)throw Error(`Round is '${j.status}', expected 'pending_answers'`);let k=new Date;for(let a of i){let b=j.questions.find(b=>b.questionId===a.questionId);if(!b)throw Error(`Question '${a.questionId}' not found in round`);if(null!==a.selectedOptionId){if(!b.options.find(b=>b.id===a.selectedOptionId))throw Error(`Invalid option '${a.selectedOptionId}' for question '${a.questionId}'`)}else if(!a.customText?.trim())throw Error(`Question '${a.questionId}': custom text is required when no option is selected`);await e.z.hypothesisFormulationQuestion.update({where:{uuid:b.uuid},data:{selectedOptionId:a.selectedOptionId,customText:a.customText,answeredAt:k,answeredByType:h,answeredByUuid:d}})}(await e.z.hypothesisFormulationQuestion.findMany({where:{roundUuid:c}})).filter(a=>a.required).every(a=>null!==a.answeredAt)&&(await e.z.hypothesisFormulation.update({where:{uuid:c},data:{status:"answered"}}),await e.z.researchQuestion.update({where:{uuid:b},data:{elaborationStatus:"validating"}}));let m=await e.z.researchQuestion.findFirst({where:{uuid:b,companyUuid:a}});await g.f0.createActivity({companyUuid:a,researchProjectUuid:m.researchProjectUuid,targetType:"research_question",targetUuid:b,actorType:h,actorUuid:d,action:"elaboration_answered",value:{roundNumber:j.roundNumber,answeredCount:i.length}}),f.B.emitChange({companyUuid:a,researchProjectUuid:m.researchProjectUuid,entityType:"research_question",entityUuid:b,action:"updated"});let n=await e.z.hypothesisFormulation.findUnique({where:{uuid:c},include:{questions:!0}});return l(n)}async function j({companyUuid:a,researchQuestionUuid:b,actorUuid:c,actorType:d,reason:h}){let i=await e.z.researchQuestion.findFirst({where:{uuid:b,companyUuid:a}});if(!i)throw Error("ResearchQuestion not found");if(i.assigneeUuid!==c)throw Error("Only the assigned agent can skip hypothesis formulation");if("elaborating"!==i.status)throw Error(`Cannot skip hypothesis formulation from status '${i.status}'`);await e.z.researchQuestion.update({where:{uuid:b},data:{elaborationDepth:"minimal",elaborationStatus:"resolved"}}),await g.f0.createActivity({companyUuid:a,researchProjectUuid:i.researchProjectUuid,targetType:"research_question",targetUuid:b,actorType:d,actorUuid:c,action:"elaboration_skipped",value:{reason:h}}),f.B.emitChange({companyUuid:a,researchProjectUuid:i.researchProjectUuid,entityType:"research_question",entityUuid:b,action:"updated"})}async function k({companyUuid:a,researchQuestionUuid:b}){let c=await e.z.researchQuestion.findFirst({where:{uuid:b,companyUuid:a}});if(!c)throw Error("ResearchQuestion not found");let d=await e.z.hypothesisFormulation.findMany({where:{researchQuestionUuid:b,companyUuid:a},include:{questions:!0},orderBy:{roundNumber:"asc"}}),f=d.flatMap(a=>a.questions),g=f.filter(a=>null!==a.answeredAt),h=d.filter(a=>"validated"===a.status),i=d.find(a=>"pending_answers"===a.status);return{researchQuestionUuid:b,depth:c.elaborationDepth,status:c.elaborationStatus,rounds:d.map(l),summary:{totalQuestions:f.length,answeredQuestions:g.length,validatedRounds:h.length,pendingRound:i?.roundNumber||null}}}function l(a){return{uuid:a.uuid,roundNumber:a.roundNumber,status:a.status,createdBy:{type:a.createdByType,uuid:a.createdByUuid},validatedAt:a.validatedAt?.toISOString()||null,createdAt:a.createdAt.toISOString(),questions:a.questions.map(m)}}function m(a){return{uuid:a.uuid,questionId:a.questionId,text:a.text,category:a.category,options:a.options,required:a.required,answer:a.answeredAt?{selectedOptionId:a.selectedOptionId,customText:a.customText,answeredAt:a.answeredAt.toISOString(),answeredBy:{type:a.answeredByType,uuid:a.answeredByUuid}}:null,issue:a.issueType?{type:a.issueType,description:a.issueDescription||""}:null}}[e,g]=h.then?(await h)():h,d()}catch(a){d(a)}})},10768:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},10846:a=>{"use strict";a.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},12102:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},12351:(a,b,c)=>{"use strict";c.d(b,{s:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60271778b05e6dbedf1923fed6f941bf38aab81d09",d.callServer,void 0,d.findSourceMapURL,"skipHypothesisFormulationAction")},12412:a=>{"use strict";a.exports=require("assert")},12793:(a,b,c)=>{"use strict";c.d(b,{k:()=>e});var d=c(42377);let e=(0,d.createServerReference)("4011018a1c0a397f619a0d0f28f49a61730f474874",d.callServer,void 0,d.findSourceMapURL,"getResearchQuestionCommentsAction")},13151:(a,b,c)=>{"use strict";c.d(b,{DesignActions:()=>q});var d=c(10837),e=c(1007),f=c(21968),g=c(9222),h=c(42424),i=c(11568),j=c(20170),k=c(42377);let l=(0,k.createServerReference)("40348a47e9c6d517853417ec881a0cf018000a74e6",k.callServer,void 0,k.findSourceMapURL,"submitDesignAction"),m=(0,k.createServerReference)("60384ebcd42431ae2748ac9aa2c5e4547deb67f37f",k.callServer,void 0,k.findSourceMapURL,"approveDesignAction"),n=(0,k.createServerReference)("60b89233272953b0e6a6a7139329648c8a8cc068f3",k.callServer,void 0,k.findSourceMapURL,"rejectDesignAction"),o=(0,k.createServerReference)("600dbf09f310464450650ac57bbaaf97bfc4995b91",k.callServer,void 0,k.findSourceMapURL,"closeDesignAction"),p=(0,k.createServerReference)("6026e770a51d2b511dbddb2d1e583ca13beca7d374",k.callServer,void 0,k.findSourceMapURL,"deleteExperimentDesignAction");function q({designUuid:a,projectUuid:b,status:c}){let k=(0,g.c)(),q=(0,e.useRouter)(),[r,s]=(0,f.useTransition)(),[t,u]=(0,f.useState)(!1),[v,w]=(0,f.useState)(""),[x,y]=(0,f.useState)(!1),[z,A]=(0,f.useState)(""),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)(""),[F,G]=(0,f.useState)(!1),[H,I]=(0,f.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex gap-2",children:["draft"===c&&(0,d.jsx)(h.$,{onClick:()=>G(!0),disabled:r,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:k(r?"common.processing":"proposals.submitForReview")}),"pending"===c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>C(!0),disabled:r,className:"border-[#6B6B6B] text-[#6B6B6B] hover:bg-[#F5F5F5]",children:k("proposals.closeProposal")}),(0,d.jsx)(h.$,{variant:"outline",onClick:()=>y(!0),disabled:r,className:"border-[#D32F2F] text-[#D32F2F] hover:bg-[#FFEBEE]",children:k("common.reject")}),(0,d.jsx)(h.$,{onClick:()=>u(!0),disabled:r,className:"bg-[#5A9E6F] hover:bg-[#4A8E5F] text-white",children:k("common.approve")})]}),(0,d.jsx)(h.$,{variant:"outline",onClick:()=>I(!0),disabled:r,className:"border-[#D32F2F] text-[#D32F2F] hover:bg-[#FFEBEE]",children:k("proposals.deleteExperimentDesign")}),(0,d.jsx)(h.$,{variant:"outline",className:"border-[#E5E0D8] text-[#6B6B6B]",onClick:()=>q.back(),children:k("common.back")})]}),(0,d.jsx)(i.lG,{open:F,onOpenChange:G,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.confirmSubmit")}),(0,d.jsx)(i.rr,{children:k("proposals.confirmSubmitDesc")})]}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>G(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await l(a)).success&&(G(!1),q.refresh())})},disabled:r,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:k(r?"common.processing":"proposals.submitForReview")})]})]})}),(0,d.jsx)(i.lG,{open:t,onOpenChange:u,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.approveProposal")}),(0,d.jsx)(i.rr,{children:k("proposals.approveProposalDesc")})]}),(0,d.jsx)(j.T,{value:v,onChange:a=>w(a.target.value),placeholder:k("proposals.approveNotePlaceholder"),className:"min-h-[100px] border-[#E5E0D8]"}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>u(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await m(a,v.trim()||void 0)).success&&(u(!1),w(""),q.refresh())})},disabled:r,className:"bg-[#5A9E6F] hover:bg-[#4A8E5F] text-white",children:k(r?"common.processing":"common.approve")})]})]})}),(0,d.jsx)(i.lG,{open:x,onOpenChange:y,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.rejectProposal")}),(0,d.jsx)(i.rr,{children:k("proposals.rejectProposalDesc")})]}),(0,d.jsx)(j.T,{value:z,onChange:a=>A(a.target.value),placeholder:k("proposals.rejectReasonPlaceholder"),className:"min-h-[100px] border-[#E5E0D8]"}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>y(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await n(a,z)).success&&(y(!1),A(""),q.refresh())})},disabled:r||!z.trim(),className:"bg-[#D32F2F] hover:bg-[#B71C1C] text-white",children:k(r?"common.processing":"common.reject")})]})]})}),(0,d.jsx)(i.lG,{open:B,onOpenChange:C,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.closeProposal")}),(0,d.jsx)(i.rr,{children:k("proposals.closeProposalDesc")})]}),(0,d.jsx)(j.T,{value:D,onChange:a=>E(a.target.value),placeholder:k("proposals.closeReasonPlaceholder"),className:"min-h-[100px] border-[#E5E0D8]"}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>C(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await o(a,D)).success&&(C(!1),E(""),q.refresh())})},disabled:r||!D.trim(),className:"bg-[#6B6B6B] hover:bg-[#555555] text-white",children:k(r?"common.processing":"proposals.closeProposal")})]})]})}),(0,d.jsx)(i.lG,{open:H,onOpenChange:I,children:(0,d.jsxs)(i.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(i.c7,{children:[(0,d.jsx)(i.L3,{children:k("proposals.deleteExperimentDesign")}),(0,d.jsx)(i.rr,{children:k("proposals.deleteExperimentDesignDesc")})]}),(0,d.jsxs)(i.Es,{className:"gap-2",children:[(0,d.jsx)(h.$,{variant:"outline",onClick:()=>I(!1),className:"border-[#E5E0D8] text-[#6B6B6B]",children:k("common.cancel")}),(0,d.jsx)(h.$,{onClick:()=>{s(async()=>{(await p(a,b)).success&&(I(!1),q.push(`/research-projects/${b}/experiment-designs`),q.refresh())})},disabled:r,className:"bg-[#D32F2F] hover:bg-[#B71C1C] text-white",children:k(r?"common.processing":"common.delete")})]})]})})]})}},13537:(a,b,c)=>{"use strict";c.d(b,{R:()=>e});var d=c(42377);let e=(0,d.createServerReference)("40100bfdbae4e8dda08100983a865107b49118eeb4",d.callServer,void 0,d.findSourceMapURL,"getHypothesisFormulationAction")},14985:a=>{"use strict";a.exports=require("dns")},17212:(a,b,c)=>{"use strict";c.d(b,{MarkdownContent:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call MarkdownContent() from the server but MarkdownContent is 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.")},"/home/ubuntu/Synapse/src/components/markdown-content.tsx","MarkdownContent")},17258:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{default:()=>H});var e=c(10023),f=c(66530),g=c(18198),h=c.n(g),i=c(67706),j=c(10768),k=c(61159),l=c(61007),m=c(92190),n=c(38369),o=c(67341),p=c(12102),q=c(87991),r=c(29669),s=c(75335),t=c(74236),u=c(57609),v=c(6309),w=c(17212),x=c(29662),y=c(78112),z=c(90136),A=c(62653),B=c(53460),C=c(88603),D=c(41890),E=c(67413),F=c(1322),G=a([x,y,z,A]);[x,y,z,A]=G.then?(await G)():G;let I={draft:"bg-[#F5F5F5] text-[#6B6B6B]",pending:"bg-[#FFF3E0] text-[#E65100]",approved:"bg-[#E8F5E9] text-[#5A9E6F]",rejected:"bg-[#FFEBEE] text-[#C4574C]",revised:"bg-[#E3F2FD] text-[#1976D2]",closed:"bg-[#F5F5F5] text-[#9A9A9A]"},J={approved:"bg-[#E8F5E9] text-[#5A9E6F]",rejected:"bg-[#FFEBEE] text-[#C4574C]",closed:"bg-[#F5F5F5] text-[#6B6B6B]"},K={draft:"draft",pending:"pending",approved:"approved",rejected:"rejected",revised:"revised",closed:"closed"},L={research_question:{key:"ideas.title"},document:{key:"documents.title"}};async function H({params:a}){let b=await (0,x.d)();b||(0,f.redirect)("/login");let{uuid:c,designUuid:d}=await a,g=await (0,i.A)();await (0,A.vP)(b.companyUuid,c)||(0,f.redirect)("/research-projects");let G=await (0,y.o4)(b.companyUuid,d);if(!G)return(0,e.jsxs)("div",{className:"flex h-full flex-col items-center justify-center",children:[(0,e.jsx)("div",{className:"text-muted-foreground",children:g("proposals.proposalNotFound")}),(0,e.jsx)(h(),{href:`/research-projects/${c}/experiment-designs`,className:"mt-4 text-[#C67A52] hover:underline",children:g("proposals.backToProposals")})]});let H=G.documentDrafts,M=G.taskDrafts,N="research_question"===G.inputType&&G.inputUuids?.length?(await Promise.all(G.inputUuids.map(a=>(0,z.ok)(b.companyUuid,a)))).filter(Boolean):[];return(0,e.jsxs)("div",{className:"px-4 py-4 md:px-10 md:py-8",children:[(0,e.jsxs)("div",{className:"mb-7 flex items-center gap-2 text-xs",children:[(0,e.jsx)(h(),{href:`/research-projects/${c}/experiment-designs`,className:"text-muted-foreground hover:text-foreground transition-colors",children:g("nav.proposals")}),(0,e.jsx)(j.A,{className:"h-3.5 w-3.5 text-[#D0CCC4]"}),(0,e.jsx)("span",{className:"font-medium text-[#6B6B6B]",children:G.title})]}),(0,e.jsxs)("div",{className:"mb-8 flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-[#F5F2EC]",children:(0,e.jsx)(k.A,{className:"h-6 w-6 text-[#C67A52]"})}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2.5",children:[(0,e.jsx)(u.E,{className:`text-[11px] font-semibold border-0 ${I[G.status]||""}`,children:g(`status.${K[G.status]||G.status}`)}),N.length>0?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.basedOn")}),N.map(a=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-[#C67A5215] px-2 py-0.5 text-[11px] font-medium text-[#C67A52]",children:[(0,e.jsx)(l.A,{className:"h-3 w-3"}),a.title]},a.uuid))]}):(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[g("proposals.basedOn")," ",g(L[G.inputType]?.key||"common.unknown")]})]}),(0,e.jsx)("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:G.title}),(0,e.jsxs)("div",{className:"mt-2 flex items-center gap-2.5 text-xs text-muted-foreground",children:[(0,e.jsxs)("span",{children:[g("common.created")," ",new Date(G.createdAt).toLocaleDateString()]}),G.createdBy&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"text-[#D0CCC4]",children:"\xb7"}),(0,e.jsxs)("span",{className:"flex items-center gap-1",children:[(0,e.jsx)(m.A,{className:"h-3 w-3"}),G.createdBy.name]})]})]})]})]}),(0,e.jsx)(B.DesignActions,{designUuid:d,projectUuid:c,status:G.status})]}),(0,e.jsxs)("div",{className:"flex flex-col lg:flex-row gap-5 lg:gap-7",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1 space-y-6",children:[G.description&&(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("common.description")})}),(0,e.jsx)(t.Wu,{className:"px-5 py-4",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[#6B6B6B]",children:(0,e.jsx)(w.MarkdownContent,{children:G.description})})})]}),"draft"===G.status&&(0,e.jsx)(F.DesignValidationChecklist,{projectUuid:c,designUuid:d,status:G.status}),(0,e.jsx)(C.DesignEditor,{designUuid:d,projectUuid:c,status:G.status,documentDrafts:H,taskDrafts:M})]}),(0,e.jsxs)("div",{className:"w-full lg:w-80 lg:shrink-0 space-y-5",children:[(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("common.details")})}),(0,e.jsxs)(t.Wu,{className:"space-y-3 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("common.status")}),(0,e.jsx)(u.E,{className:`text-[11px] font-medium border-0 ${I[G.status]||""}`,children:g(`status.${K[G.status]||G.status}`)})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.inputType")}),(0,e.jsx)("span",{className:"text-xs font-medium text-foreground",children:g(L[G.inputType]?.key||"common.unknown")})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.creatorType")}),(0,e.jsx)("span",{className:"flex items-center gap-1.5 text-xs font-medium text-foreground",children:"agent"===G.createdByType?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(n.A,{className:"h-3 w-3 text-[#C67A52]"}),g("common.agent")]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(o.A,{className:"h-3 w-3 text-muted-foreground"}),g("common.user")]})})]}),(0,e.jsx)(v.Separator,{className:"bg-[#F5F2EC]"}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("common.created")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:new Date(G.createdAt).toLocaleDateString()})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("common.updated")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:new Date(G.updatedAt).toLocaleDateString()})]})]})]}),N.length>0&&(0,e.jsx)(E.SourceQuestionsCard,{ideas:N.map(a=>({uuid:a.uuid,title:a.title,content:a.content,status:a.status,assignee:a.assignee,createdAt:a.createdAt})),projectUuid:c,currentUserUuid:b.actorUuid}),(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("proposals.containerSummary")})}),(0,e.jsxs)(t.Wu,{className:"space-y-3 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(p.A,{className:"h-3.5 w-3.5"})," ",g("proposals.documents")]}),(0,e.jsx)("span",{className:"text-[13px] font-semibold text-[#6B6B6B]",children:H?.length||0})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(q.A,{className:"h-3.5 w-3.5"})," ",g("proposals.tasks")]}),(0,e.jsx)("span",{className:"text-[13px] font-semibold text-[#C67A52]",children:M?.length||0})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"})," ",g("proposals.inputs")]}),(0,e.jsx)("span",{className:"text-[13px] font-semibold text-[#6B6B6B]",children:G.inputUuids?.length||0})]})]})]}),G.review&&(0,e.jsxs)(t.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(t.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsx)(t.ZB,{className:"text-[13px] font-semibold text-foreground",children:g("proposals.reviewInfo")})}),(0,e.jsxs)(t.Wu,{className:"space-y-3 px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.reviewedBy")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:G.review.reviewedBy?.name||"-"})]}),G.review.reviewedAt&&(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:g("proposals.reviewedAt")}),(0,e.jsx)("span",{className:"text-xs font-medium text-[#6B6B6B]",children:new Date(G.review.reviewedAt).toLocaleDateString()})]}),G.review.reviewNote&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(v.Separator,{className:"bg-[#F5F2EC]"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{className:"text-[11px] text-muted-foreground",children:g("proposals.reviewNote")}),(0,e.jsx)("div",{className:`mt-1.5 rounded-lg px-3 py-2 text-xs font-medium ${J[G.status]||"bg-[#F5F2EC] text-[#6B6B6B]"}`,children:G.review.reviewNote})]})]})]})]}),"draft"===G.status&&G.review?.reviewNote&&(0,e.jsx)(t.Zp,{className:"border-[#C4574C] bg-[#FFEBEE] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsx)(t.Wu,{className:"p-4",children:(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(r.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-[#C4574C]"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xs font-semibold text-[#C4574C]",children:g("proposals.rejectionReason")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-[#6B6B6B]",children:G.review.reviewNote}),G.review.reviewedBy&&(0,e.jsxs)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["— ",G.review.reviewedBy.name,G.review.reviewedAt&&`, ${new Date(G.review.reviewedAt).toLocaleDateString()}`]})]})]})})}),"closed"===G.status&&G.review?.reviewNote&&(0,e.jsx)(t.Zp,{className:"border-[#D0CCC4] bg-[#F5F2EC] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsx)(t.Wu,{className:"p-4",children:(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(r.A,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"text-xs font-semibold text-[#6B6B6B]",children:g("proposals.rejectionReason")}),(0,e.jsx)("p",{className:"mt-1 text-xs text-[#6B6B6B]",children:G.review.reviewNote}),G.review.reviewedBy&&(0,e.jsxs)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["— ",G.review.reviewedBy.name,G.review.reviewedAt&&`, ${new Date(G.review.reviewedAt).toLocaleDateString()}`]})]})]})})}),(0,e.jsx)(D.DesignComments,{designUuid:d,currentUserUuid:b.actorUuid}),"draft"===G.status&&(0,e.jsx)(t.Zp,{className:"border-[#D0CCC4] bg-[#F5F2EC] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsxs)(t.Wu,{className:"p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[#6B6B6B]",children:[(0,e.jsx)(s.A,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"font-medium",children:g("proposals.draftStatus")})]}),(0,e.jsx)("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:g("proposals.draftNotice")})]})}),"pending"===G.status&&(0,e.jsx)(t.Zp,{className:"border-[#C67A52] bg-[#FFFBF8] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsxs)(t.Wu,{className:"p-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-[#E65100]",children:[(0,e.jsx)(r.A,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"font-medium",children:g("proposals.awaitingReview")})]}),(0,e.jsx)("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:g("proposals.reviewInstructions")})]})}),"closed"===G.status&&(0,e.jsx)(t.Zp,{className:"border-[#D0CCC4] bg-[#F5F2EC] shadow-none rounded-2xl gap-0 py-0",children:(0,e.jsx)(t.Wu,{className:"p-4",children:(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)(r.A,{className:"h-3.5 w-3.5"}),(0,e.jsx)("span",{className:"font-medium",children:g("proposals.closedNotice")})]})})})]})]})]})}d()}catch(a){d(a)}})},18369:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{DesignEditor:()=>H});var e=c(10837),f=c(21968),g=c(1007),h=c(9222),i=c(21268),j=c(34457);c(98088),c(24346);var k=c(65956),l=c(92900),m=c(21790),n=c(49102),o=c(24493),p=c(71693),q=c(4045),r=c(35198),s=c(42424),t=c(49599),u=c(9994),v=c(20170),w=c(2852),x=c(11568),y=c(55732),z=c(41709),A=c(83457),B=c(50388),C=c(68989),D=c(98175),E=c(62221),F=c(45433),G=a([A,F]);[A,F]=G.then?(await G)():G;let I={high:{bg:"bg-[#FFEBEE]",text:"text-[#C4574C]"},medium:{bg:"bg-[#FFF3E0]",text:"text-[#E65100]"},low:{bg:"bg-[#F5F2EC]",text:"text-[#6B6B6B]"}},J={prd:"Prd",tech_design:"TechDesign",adr:"Adr",spec:"Spec",guide:"Guide"},K={taskDraftNode:function({data:a}){let b=(0,h.c)(),c=I[a.priority||"medium"]||I.medium;return(0,e.jsxs)("div",{className:"rounded-lg border-2 border-[#E5E2DC] bg-white px-4 py-3 shadow-sm min-w-[200px] max-w-[260px] cursor-pointer hover:border-[#C67A52] transition-colors",children:[(0,e.jsx)(i.h7,{type:"target",position:j.yX.Top,className:"!bg-[#C67A52] !w-2 !h-2"}),(0,e.jsx)("div",{className:"flex items-center gap-2 mb-1.5",children:a.priority&&(0,e.jsx)(t.E,{className:`text-[10px] border-0 ${c.bg} ${c.text}`,children:b(`priority.${a.priority}`)})}),(0,e.jsx)("p",{className:"text-xs font-medium text-[#2C2C2C] leading-snug line-clamp-2",children:a.title}),(0,e.jsx)(i.h7,{type:"source",position:j.yX.Bottom,className:"!bg-[#C67A52] !w-2 !h-2"})]})}};function H({designUuid:a,status:b,documentDrafts:c,taskDrafts:d}){let j=(0,h.c)(),G=(0,g.useRouter)(),[H,L]=(0,f.useTransition)(),[M,N]=(0,f.useState)("cards"),[O,P]=(0,f.useState)(new Set),[Q,R]=(0,f.useState)(!1),[S,T]=(0,f.useState)(null),[U,V]=(0,f.useState)("prd"),[W,X]=(0,f.useState)(""),[Y,Z]=(0,f.useState)(""),[$,_]=(0,f.useState)(null),[aa,ab]=(0,f.useState)(!1),[ac,ad]=(0,f.useState)(null),[ae,af]=(0,f.useState)(null),ag="draft"===b,ah=(0,f.useMemo)(()=>$&&d&&d.find(a=>a.uuid===$)||null,[$,d]),[ai,aj,ak]=(0,i.ck)([]),[al,am,an]=(0,i.fM)([]),ao=(0,f.useCallback)(async b=>{if(!b.source||!b.target||!ag||b.source===b.target)return;af(null);let c=b.target,e=b.source,f=d?.find(a=>a.uuid===c);if(!f)return;let g=f.dependsOnDraftUuids||[];if(g.includes(e))return void af(j("proposals.dependencyExists"));if(((a,b)=>{let c=new Set,e=[a];for(;e.length>0;){let a=e.shift();if(a===b)return!0;if(c.has(a))continue;c.add(a);let f=d?.find(b=>b.uuid===a);f?.dependsOnDraftUuids&&e.push(...f.dependsOnDraftUuids)}return!1})(e,c))return void af(j("proposals.cyclicDependency"));let h=[...g,e];L(async()=>{let b=await (0,B.S)(a,c,{dependsOnDraftUuids:h});b.success?G.refresh():af(b.error||j("proposals.failedToAddDependency"))})},[ag,d,a,G,L,j]),ap=(0,f.useCallback)((a,b)=>{ab(!1),_(b.id)},[]),aq=c&&c.length>0,ar=d&&d.length>0,as=null!==$||aa;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(r.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsxs)(r.aR,{className:"flex-row items-center justify-between border-b border-[#F5F2EC] px-6 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)(k.A,{className:"h-[18px] w-[18px] text-[#C67A52]"}),(0,e.jsx)(r.ZB,{className:"text-sm font-semibold text-foreground",children:j("proposals.documentDrafts")}),(0,e.jsx)(t.E,{variant:"secondary",className:"border-0 bg-[#F5F2EC] text-[11px] font-medium text-muted-foreground",children:c?.length||0})]}),ag&&(0,e.jsxs)(s.$,{variant:"ghost",size:"sm",onClick:()=>{T(null),V("prd"),X(""),Z(""),R(!0)},className:"h-7 gap-1 text-xs font-medium text-[#C67A52] hover:bg-[#FFFBF8] hover:text-[#C67A52]",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"}),j("proposals.addDocumentDraft")]})]}),(0,e.jsx)(r.Wu,{className:"p-0",children:aq?(0,e.jsx)("div",{className:"space-y-0 divide-y divide-[#F5F2EC]",children:c.map(b=>{let c=O.has(b.uuid);return(0,e.jsxs)("div",{className:"px-5 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("button",{onClick:()=>{var a;return a=b.uuid,void P(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},className:"flex items-center gap-2.5 text-left cursor-pointer hover:opacity-80 transition-opacity",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:c?(0,e.jsx)(m.A,{className:"h-4 w-4"}):(0,e.jsx)(n.A,{className:"h-4 w-4"})}),(0,e.jsx)(t.E,{variant:"outline",className:"text-[10px] font-medium text-[#6B6B6B] border-[#E5E2DC] bg-[#FAF8F4]",children:j(`proposals.docType${J[b.type]||"Guide"}`)}),(0,e.jsx)("span",{className:"text-[13px] font-medium text-foreground",children:b.title})]}),ag&&(0,e.jsxs)("div",{className:"flex gap-1",children:[(0,e.jsx)(s.$,{variant:"ghost",size:"sm",onClick:()=>{T(b),V(b.type),X(b.title),Z(b.content),R(!0)},className:"h-6 text-[11px] text-muted-foreground hover:text-foreground",children:j("proposals.editDraft")}),(0,e.jsx)(s.$,{variant:"ghost",size:"sm",onClick:()=>{confirm(j("common.confirmDelete"))&&L(async()=>{(await (0,E.L)(a,b.uuid)).success&&G.refresh()})},disabled:H,className:"h-6 text-[11px] text-[#C4574C] hover:bg-[#FFEBEE] hover:text-[#C4574C]",children:j("proposals.deleteDraft")})]})]}),c&&b.content&&(0,e.jsx)("div",{className:"mt-3 border-t border-[#F5F2EC] pt-4",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-foreground",children:(0,e.jsx)(z.jH,{plugins:{code:A.a},children:b.content})})})]},b.uuid)})}):(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 px-6 py-8",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-[10px] bg-[#F5F2EC]",children:(0,e.jsx)(k.A,{className:"h-[18px] w-[18px] text-[#D0CCC4]"})}),(0,e.jsx)("p",{className:"text-[13px] text-muted-foreground",children:j("proposals.emptyContainer")})]})})]}),(0,e.jsxs)(r.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsxs)(r.aR,{className:"flex-row items-center justify-between border-b border-[#F5F2EC] px-6 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)(o.A,{className:"h-[18px] w-[18px] text-[#C67A52]"}),(0,e.jsx)(r.ZB,{className:"text-sm font-semibold text-foreground",children:j("proposals.taskDrafts")}),(0,e.jsx)(t.E,{className:"border-0 bg-[#C67A5220] text-[11px] font-semibold text-[#C67A52]",children:d?.length||0})]}),(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[ar&&(0,e.jsxs)("div",{className:"flex rounded-lg bg-[#F5F2EC] p-0.5",children:[(0,e.jsx)("button",{onClick:()=>N("cards"),className:`rounded-md px-3 py-1 text-[11px] font-medium transition-colors ${"cards"===M?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:j("proposals.cardsView")}),(0,e.jsx)("button",{onClick:()=>N("dag"),className:`rounded-md px-3 py-1 text-[11px] font-medium transition-colors ${"dag"===M?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"DAG"})]}),ag&&(0,e.jsxs)(s.$,{variant:"ghost",size:"sm",onClick:()=>{_(null),ab(!0)},className:"h-7 gap-1 text-xs font-medium text-[#C67A52] hover:bg-[#FFFBF8] hover:text-[#C67A52]",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5"}),j("proposals.addTaskDraft")]})]})]}),(0,e.jsx)(r.Wu,{className:"p-0",children:ar?"cards"===M?(0,e.jsx)("div",{className:"space-y-2.5 p-5",children:d.map(a=>{let b=I[a.priority||"medium"]||I.medium,c=a.dependsOnDraftUuids?.length||0,d=$===a.uuid;return(0,e.jsxs)("div",{onClick:()=>{ab(!1),_(a.uuid)},className:`cursor-pointer rounded-[10px] border bg-white p-3.5 transition-colors ${d?"border-[#C67A52] shadow-sm":"border-[#E5E2DC] hover:border-[#C67A52]/50"}`,children:[(0,e.jsx)("div",{className:"mb-1.5",children:(0,e.jsx)("span",{className:"text-[13px] font-medium leading-snug text-foreground",children:a.title})}),a.description&&(0,e.jsx)("p",{className:"mb-3 text-[11px] leading-relaxed text-[#6B6B6B]",children:a.description}),a.acceptanceCriteria&&(0,e.jsxs)("div",{className:"mb-3 rounded-lg bg-[#F5F2EC] p-3",children:[(0,e.jsx)("div",{className:"mb-1 text-[10px] font-medium text-muted-foreground",children:j("tasks.acceptanceCriteria")}),(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[11px] text-[#6B6B6B]",children:(0,e.jsx)(z.jH,{plugins:{code:A.a},children:a.acceptanceCriteria})})]}),a.acceptanceCriteriaItems&&a.acceptanceCriteriaItems.length>0&&(0,e.jsxs)("div",{className:"mb-3 rounded-lg bg-[#F5F2EC] p-3",children:[(0,e.jsxs)("div",{className:"mb-1.5 flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[(0,e.jsx)(p.A,{className:"h-2.5 w-2.5"}),j("acceptanceCriteria.title")]}),(0,e.jsx)("div",{className:"space-y-1",children:a.acceptanceCriteriaItems.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-center gap-2 text-[11px]",children:[(0,e.jsx)("span",{className:"flex-1 text-[#6B6B6B]",children:a.description}),(0,e.jsx)(t.E,{className:`text-[9px] font-medium border-0 shrink-0 ${a.required??!0?"bg-[#FFF3E0] text-[#E65100]":"bg-white text-[#9A9A9A]"}`,children:a.required??!0?j("acceptanceCriteria.required"):j("acceptanceCriteria.optional")})]},b))})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[a.priority&&(0,e.jsx)(t.E,{className:`text-[10px] font-medium border-0 ${b.bg} ${b.text}`,children:j(`priority.${a.priority}`)}),c>0&&(0,e.jsxs)(t.E,{variant:"outline",className:"text-[10px] font-medium text-muted-foreground border-[#E5E2DC]",children:[c," ",1===c?"dep":"deps"]})]}),null!=a.computeBudgetHours&&a.computeBudgetHours>0&&(0,e.jsxs)("span",{className:"flex items-center gap-1 text-[10px] font-medium text-muted-foreground",children:[(0,e.jsx)(q.A,{className:"h-2.5 w-2.5 text-[#C67A52]"}),a.computeBudgetHours," SP"]})]})]},a.uuid)})}):(0,e.jsxs)("div",{className:"h-[400px] relative",children:[ae&&(0,e.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-10 rounded-lg bg-red-50 border border-red-200 px-4 py-2 text-xs text-red-700 shadow-sm",children:[ae,(0,e.jsx)("button",{className:"ml-2 font-medium hover:text-red-900",onClick:()=>af(null),children:"x"})]}),(0,e.jsxs)(i.Gc,{nodes:ai,edges:al,onNodesChange:ak,onEdgesChange:an,onConnect:ao,onNodeClick:ap,nodeTypes:K,fitView:!0,fitViewOptions:{padding:.3},minZoom:.3,maxZoom:1.5,proOptions:{hideAttribution:!0},children:[(0,e.jsx)(i.VS,{color:"#E5E0D8",gap:20}),(0,e.jsx)(i.H2,{className:"[&>button]:border-[#E5E0D8] [&>button]:bg-white [&>button]:text-[#2C2C2C] [&>button:hover]:bg-[#FAF8F4]"})]})]}):(0,e.jsxs)("div",{className:"flex flex-col items-center gap-2 px-6 py-8",children:[(0,e.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-[10px] bg-[#F5F2EC]",children:(0,e.jsx)(o.A,{className:"h-[18px] w-[18px] text-[#D0CCC4]"})}),(0,e.jsx)("p",{className:"text-[13px] text-muted-foreground",children:j("proposals.emptyContainer")})]})})]}),(0,e.jsx)(x.lG,{open:Q,onOpenChange:R,children:(0,e.jsxs)(x.Cf,{className:"max-w-2xl",children:[(0,e.jsx)(x.c7,{children:(0,e.jsx)(x.L3,{children:S?j("proposals.editDraft"):j("proposals.addDocumentDraft")})}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(w.J,{className:"mb-2 block text-muted-foreground",children:j("proposals.documentType")}),(0,e.jsxs)(y.l6,{value:U,onValueChange:V,children:[(0,e.jsx)(y.bq,{className:"border-[#E5E2DC]",children:(0,e.jsx)(y.yv,{})}),(0,e.jsxs)(y.gC,{children:[(0,e.jsx)(y.eb,{value:"prd",children:j("proposals.docTypePrd")}),(0,e.jsx)(y.eb,{value:"tech_design",children:j("proposals.docTypeTechDesign")}),(0,e.jsx)(y.eb,{value:"adr",children:j("proposals.docTypeAdr")}),(0,e.jsx)(y.eb,{value:"spec",children:j("proposals.docTypeSpec")}),(0,e.jsx)(y.eb,{value:"guide",children:j("proposals.docTypeGuide")})]})]})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)(w.J,{className:"mb-2 block text-muted-foreground",children:[j("proposals.documentTitle")," *"]}),(0,e.jsx)(u.p,{value:W,onChange:a=>X(a.target.value),placeholder:j("proposals.titlePlaceholder"),className:"border-[#E5E2DC]"})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)(w.J,{className:"mb-2 block text-muted-foreground",children:j("proposals.documentContent")}),(0,e.jsx)(v.T,{value:Y,onChange:a=>Z(a.target.value),className:"h-64 resize-none border-[#E5E2DC] font-mono",placeholder:"# Document Title Write your content in Markdown..."})]}),ac&&(0,e.jsx)("div",{className:"rounded-lg bg-[#FFEBEE] p-3 text-sm text-[#C4574C]",children:ac}),(0,e.jsxs)("div",{className:"flex justify-end gap-3",children:[(0,e.jsx)(s.$,{variant:"outline",onClick:()=>R(!1),disabled:H,className:"border-[#E5E2DC]",children:j("common.cancel")}),(0,e.jsx)(s.$,{onClick:()=>{if(!W.trim())return void ad(j("proposals.titleRequired"));ad(null),L(async()=>{let b;(b=S?await (0,C.I)(a,S.uuid,{type:U,title:W.trim(),content:Y}):await (0,D.U)(a,{type:U,title:W.trim(),content:Y})).success?(R(!1),G.refresh()):ad(b.error||j("proposals.failedToSaveDocDraft"))})},disabled:H,className:"bg-[#C67A52] text-white hover:bg-[#B56A42]",children:H?j("common.saving"):j("common.save")})]})]})]})}),as&&(0,e.jsx)(F.O,{taskDraft:aa?null:ah,allTaskDrafts:d||[],designUuid:a,canEdit:ag,onClose:()=>{_(null),ab(!1)},onSaved:()=>{aa&&ab(!1)},onDeleted:()=>{_(null),ab(!1)}})]})}d()}catch(a){d(a)}})},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},19133:(a,b,c)=>{Promise.resolve().then(c.bind(c,13753)),Promise.resolve().then(c.bind(c,81093)),Promise.resolve().then(c.bind(c,14672)),Promise.resolve().then(c.bind(c,25711)),Promise.resolve().then(c.bind(c,70952)),Promise.resolve().then(c.bind(c,98556)),Promise.resolve().then(c.bind(c,14220)),Promise.resolve().then(c.bind(c,5989)),Promise.resolve().then(c.bind(c,15906)),Promise.resolve().then(c.bind(c,45106)),Promise.resolve().then(c.bind(c,13277)),Promise.resolve().then(c.bind(c,55212)),Promise.resolve().then(c.bind(c,73935)),Promise.resolve().then(c.bind(c,50382)),Promise.resolve().then(c.bind(c,66529)),Promise.resolve().then(c.bind(c,41335)),Promise.resolve().then(c.bind(c,66619)),Promise.resolve().then(c.bind(c,53187)),Promise.resolve().then(c.bind(c,28121)),Promise.resolve().then(c.bind(c,63658)),Promise.resolve().then(c.bind(c,95556)),Promise.resolve().then(c.bind(c,28386)),Promise.resolve().then(c.bind(c,15644)),Promise.resolve().then(c.bind(c,25400)),Promise.resolve().then(c.bind(c,93319)),Promise.resolve().then(c.bind(c,31284)),Promise.resolve().then(c.bind(c,2807)),Promise.resolve().then(c.bind(c,59782)),Promise.resolve().then(c.bind(c,80501)),Promise.resolve().then(c.t.bind(c,81512,23)),Promise.resolve().then(c.bind(c,13151)),Promise.resolve().then(c.bind(c,89792)),Promise.resolve().then(c.bind(c,18369)),Promise.resolve().then(c.bind(c,51277)),Promise.resolve().then(c.bind(c,68199)),Promise.resolve().then(c.bind(c,97450)),Promise.resolve().then(c.bind(c,84819))},21692:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},21820:a=>{"use strict";a.exports=require("os")},24364:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("arrow-right-left",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]])},24493:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]])},26713:a=>{"use strict";a.exports=require("next/dist/shared/lib/router/utils/is-bot")},26849:a=>{"use strict";a.exports=require("@prisma/client/runtime/client")},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},28874:(a,b,c)=>{"use strict";c.d(b,{$:()=>e});var d=c(42377);let e=(0,d.createServerReference)("400e0adbec22ef37d015830c0c3ff93385846f0f2c",d.callServer,void 0,d.findSourceMapURL,"getDesignCommentsAction")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},29669:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},33527:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.r(b),c.d(b,{"400e0adbec22ef37d015830c0c3ff93385846f0f2c":()=>f.$,"40100bfdbae4e8dda08100983a865107b49118eeb4":()=>i.R,"4011018a1c0a397f619a0d0f28f49a61730f474874":()=>g.k,"40348a47e9c6d517853417ec881a0cf018000a74e6":()=>e.RE,"40b8e6a8f5b487648e2f31fb6caacf3faecaa89d14":()=>h.q,"600dbf09f310464450650ac57bbaaf97bfc4995b91":()=>e.dj,"6026e770a51d2b511dbddb2d1e583ca13beca7d374":()=>e.fZ,"60271778b05e6dbedf1923fed6f941bf38aab81d09":()=>i.sW,"6036b14c7a0b485d68bb436fcc5c9a726686abd8c6":()=>e.UY,"60384ebcd42431ae2748ac9aa2c5e4547deb67f37f":()=>e.CL,"607ac07f8a321d8f99cd779629db2138ea431c900d":()=>e.ji,"6099501305ac6eaccd915d3909faeba37aef0a6a81":()=>e.wq,"60a3f1338a100846860fe056719a21232d69b3ce75":()=>g.n,"60b89233272953b0e6a6a7139329648c8a8cc068f3":()=>e.eZ,"60e8964f43a0c46fd7eb5bd44d07a1998e66e2269c":()=>e.Lx,"60eb8b406bda37b41cbdbf1462e45ee2945bc7aa10":()=>f.e,"7001eb4571b8964fd95ad3b7fcbbd3a2195e7de288":()=>e.S$,"70706397cc55ec694918ffe090cec7e476c444e25a":()=>e.IK,"707a4a486695fd0b49c89e5eeec64dc88d3093c6dd":()=>i.c8});var e=c(7667),f=c(44875),g=c(4133),h=c(38309),i=c(6511),j=a([e,f,g,h,i]);[e,f,g,h,i]=j.then?(await j)():j,d()}catch(a){d(a)}})},33873:a=>{"use strict";a.exports=require("path")},33962:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])},34631:a=>{"use strict";a.exports=require("tls")},38309:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{q:()=>l});var e=c(2613);c(50785);var f=c(9259),g=c(67738),h=c(15369),i=c(97307),j=c(12217),k=a([f,g,h]);[f,g,h]=k.then?(await k)():k;let m=i.vF.child({module:"research_question"});async function l(a){let b=await (0,f.d)();if(!b)return{activities:[],total:0};try{let c=await (0,h._W)(b.companyUuid,a);if(!c)return{activities:[],total:0};return await (0,g.listActivitiesWithActorNames)({companyUuid:b.companyUuid,researchProjectUuid:c.researchProjectUuid,targetType:"research_question",targetUuid:a,skip:0,take:50})}catch(a){return m.error({err:a},"Failed to get idea activities"),{activities:[],total:0}}}(0,j.D)([l]),(0,e.A)(l,"40b8e6a8f5b487648e2f31fb6caacf3faecaa89d14",null),d()}catch(a){d(a)}})},38369:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},40869:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(77219);c(86099),c(71902);var e=c(86963),f=a([d,e]);[d,e]=f.then?(await f)():f,b()}catch(a){b(a)}})},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41204:a=>{"use strict";a.exports=require("string_decoder")},41890:(a,b,c)=>{"use strict";c.d(b,{DesignComments:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call DesignComments() from the server but DesignComments is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/design-comments.tsx","DesignComments")},44217:(a,b,c)=>{"use strict";c.d(b,{w:()=>e});var d=c(42377);let e=(0,d.createServerReference)("6099501305ac6eaccd915d3909faeba37aef0a6a81",d.callServer,void 0,d.findSourceMapURL,"addRunDraftAction")},44865:a=>{"use strict";a.exports=import("@prisma/client/runtime/query_compiler_fast_bg.postgresql.wasm-base64.mjs")},44875:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{$:()=>m,e:()=>n});var e=c(2613);c(50785);var f=c(9259),g=c(466),h=c(90097),i=c(67738),j=c(97307),k=c(12217),l=a([f,g,h,i]);[f,g,h,i]=l.then?(await l)():l;let o=j.vF.child({module:"experiment_design"});async function m(a){let b=await (0,f.d)();if(!b)return{comments:[],total:0};try{return await (0,g.fg)({companyUuid:b.companyUuid,targetType:"experiment_design",targetUuid:a,skip:0,take:100})}catch(a){return o.error({err:a},"Failed to get proposal comments"),{comments:[],total:0}}}async function n(a,b){let c=await (0,f.d)();if(!c)return{success:!1,error:"Unauthorized"};if(!b.trim())return{success:!1,error:"Comment content is required"};try{let d=await (0,h.o4)(c.companyUuid,a);if(!d)return{success:!1,error:"Proposal not found"};let e=await (0,g.eT)({companyUuid:c.companyUuid,targetType:"experiment_design",targetUuid:a,content:b.trim(),authorType:c.type,authorUuid:c.actorUuid});return d.project?.uuid&&await (0,i.createActivity)({companyUuid:c.companyUuid,researchProjectUuid:d.project.uuid,targetType:"experiment_design",targetUuid:a,actorType:c.type,actorUuid:c.actorUuid,action:"comment_added"}),{success:!0,comment:e}}catch(a){return o.error({err:a},"Failed to create proposal comment"),{success:!1,error:"Failed to create comment"}}}(0,k.D)([m,n]),(0,e.A)(m,"400e0adbec22ef37d015830c0c3ff93385846f0f2c",null),(0,e.A)(n,"60eb8b406bda37b41cbdbf1462e45ee2945bc7aa10",null),d()}catch(a){d(a)}})},45433:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{O:()=>G});var e=c(10837),f=c(21968),g=c(1007),h=c(9222),i=c(33407),j=c(10694),k=c(92900),l=c(71693),m=c(79543),n=c(4045),o=c(87461),p=c(86460),q=c(9810),r=c(49599),s=c(42424),t=c(9994),u=c(20170),v=c(2852),w=c(74645),x=c(88536),y=c(55732),z=c(6019),A=c(41709),B=c(83457),C=c(44217),D=c(50388),E=c(66430),F=a([B]);B=(F.then?(await F)():F)[0];let H={high:{bg:"bg-[#FFEBEE]",text:"text-[#C4574C]"},medium:{bg:"bg-[#FFF3E0]",text:"text-[#E65100]"},low:{bg:"bg-[#F5F2EC]",text:"text-[#6B6B6B]"}};function G({taskDraft:a,allTaskDrafts:b,designUuid:c,canEdit:d,onClose:F,onSaved:G,onDeleted:I}){let J=(0,h.c)(),K=(0,g.useRouter)(),[L,M]=(0,f.useTransition)(),[N,O]=(0,f.useState)(!1),P=null===a,[Q,R]=(0,f.useState)(P),[S,T]=(0,f.useState)(a?.title||""),[U,V]=(0,f.useState)(a?.description||""),[W,X]=(0,f.useState)(a?.priority||"medium"),[Y,Z]=(0,f.useState)(a?.computeBudgetHours?.toString()||""),[$,_]=(0,f.useState)(a?.acceptanceCriteriaItems?.map(a=>({description:a.description,required:a.required??!0}))||[]),[aa,ab]=(0,f.useState)([]),[ac,ad]=(0,f.useState)(null),ae=(0,f.useMemo)(()=>P?aa:a?.dependsOnDraftUuids??[],[P,aa,a?.dependsOnDraftUuids]),af=(0,f.useMemo)(()=>ae.map(a=>b.find(b=>b.uuid===a)).filter(Boolean),[ae,b]),ag=(0,f.useMemo)(()=>{let c=new Set(ae);return b.filter(b=>b.uuid!==a?.uuid&&!c.has(b.uuid))},[a?.uuid,ae,b]),ah=()=>{a&&(T(a.title),V(a.description||""),X(a.priority||"medium"),Z(a.computeBudgetHours?.toString()||""),_(a.acceptanceCriteriaItems?.map(a=>({description:a.description,required:a.required??!0}))||[]),ad(null),R(!0))},ai=()=>{if(P)return void F();R(!1),a&&(T(a.title),V(a.description||""),X(a.priority||"medium"),Z(a.computeBudgetHours?.toString()||""),_(a.acceptanceCriteriaItems?.map(a=>({description:a.description,required:a.required??!0}))||[])),ad(null)},aj=H[a?.priority||"medium"]||H.medium,ak=()=>(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:J("proposals.dependsOn")}),af.length>0?(0,e.jsx)("div",{className:"mt-2 space-y-1.5",children:af.map(b=>(0,e.jsxs)("div",{className:"group flex items-center justify-between rounded-lg bg-[#FAF8F4] p-2.5",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,e.jsx)(i.A,{className:"h-3.5 w-3.5 shrink-0 text-[#C67A52]"}),(0,e.jsx)("span",{className:"text-xs text-[#2C2C2C] truncate",children:b.title})]}),d&&(0,e.jsx)(s.$,{variant:"ghost",size:"icon",className:"h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity ml-2 shrink-0",onClick:()=>(b=>{if(P)return void ab(a=>a.filter(a=>a!==b));if(!a)return;let d=(a.dependsOnDraftUuids||[]).filter(a=>a!==b);M(async()=>{let b=await (0,D.S)(c,a.uuid,{dependsOnDraftUuids:d});b.success?(K.refresh(),G()):ad(b.error||J("proposals.failedToAddDependency"))})})(b.uuid),disabled:L,children:(0,e.jsx)(j.A,{className:"h-3.5 w-3.5 text-[#9A9A9A] hover:text-[#D32F2F]"})})]},b.uuid))}):(0,e.jsx)("p",{className:"mt-2 text-sm italic text-[#9A9A9A]",children:J("proposals.noDependencies")}),d&&ag.length>0&&(0,e.jsx)("div",{className:"mt-3",children:(0,e.jsxs)(y.l6,{onValueChange:d=>(d=>{if(P)return void ab(a=>[...a,d]);if(!a)return;if(((a,c)=>{let d=new Set,e=[a];for(;e.length>0;){let a=e.shift();if(a===c)return!0;if(d.has(a))continue;d.add(a);let f=b.find(b=>b.uuid===a);f?.dependsOnDraftUuids&&e.push(...f.dependsOnDraftUuids)}return!1})(d,a.uuid))return void ad(J("proposals.cyclicDependency"));ad(null);let e=[...a.dependsOnDraftUuids||[],d];M(async()=>{let b=await (0,D.S)(c,a.uuid,{dependsOnDraftUuids:e});b.success?(K.refresh(),G()):ad(b.error||J("proposals.failedToAddDependency"))})})(d),children:[(0,e.jsx)(y.bq,{className:"h-8 border-[#E5E0D8] text-xs text-[#6B6B6B] focus:ring-[#C67A52]",children:(0,e.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,e.jsx)(k.A,{className:"h-3 w-3"}),(0,e.jsx)(y.yv,{placeholder:J("proposals.selectDependency")})]})}),(0,e.jsx)(y.gC,{children:ag.map(a=>(0,e.jsx)(y.eb,{value:a.uuid,children:(0,e.jsx)("span",{className:"truncate",children:a.title})},a.uuid))})]},af.length)})]});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:F}),(0,e.jsxs)("div",{className:`fixed right-0 top-14 md:top-0 z-50 flex h-[calc(100%-3.5rem)] md:h-full w-full md:w-[480px] flex-col bg-white shadow-xl border-l border-[#E5E0D8] ${N?"":"animate-in slide-in-from-right duration-300"}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between border-b border-[#F5F2EC] px-6 py-5",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:Q?(0,e.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C]",children:P?J("proposals.newTaskDraft"):J("proposals.editTaskDraft")}):a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C] truncate",children:a.title}),(0,e.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[a.priority&&(0,e.jsx)(r.E,{className:`text-[10px] font-medium border-0 ${aj.bg} ${aj.text}`,children:J(`priority.${a.priority}`)}),null!=a.computeBudgetHours&&a.computeBudgetHours>0&&(0,e.jsxs)("span",{className:"flex items-center gap-1 rounded bg-[#F5F2EC] px-2 py-0.5 text-xs font-medium text-[#6B6B6B]",children:[(0,e.jsx)(n.A,{className:"h-2.5 w-2.5 text-[#C67A52]"}),a.computeBudgetHours," SP"]})]})]}):null}),(0,e.jsxs)("div",{className:"flex items-center gap-2 ml-4",children:[a&&!Q&&d&&(0,e.jsxs)(s.$,{variant:"outline",size:"sm",className:"h-8 gap-1.5 border-[#E5E0D8] text-[#2C2C2C]",onClick:ah,children:[(0,e.jsx)(o.A,{className:"h-3.5 w-3.5 text-[#6B6B6B]"}),(0,e.jsx)("span",{className:"text-xs",children:J("common.edit")})]}),(0,e.jsx)(s.$,{variant:"outline",size:"icon",className:"h-8 w-8 border-[#E5E0D8]",onClick:Q&&!P?ai:F,children:(0,e.jsx)(j.A,{className:"h-4 w-4 text-[#6B6B6B]"})})]})]}),(0,e.jsx)(w.F,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:(0,e.jsx)("div",{className:"flex min-h-full flex-col px-6 py-5",children:Q?(0,e.jsxs)("div",{className:"space-y-5",children:[ac&&(0,e.jsx)("div",{className:"rounded-lg bg-[#FFEBEE] p-3 text-sm text-[#C4574C]",children:ac}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)(v.J,{htmlFor:"edit-title",className:"text-[13px] font-medium text-[#2C2C2C]",children:[J("proposals.taskTitle")," *"]}),(0,e.jsx)(t.p,{id:"edit-title",value:S,onChange:a=>T(a.target.value),placeholder:J("proposals.titlePlaceholder"),className:"border-[#E5E2DC] text-sm focus-visible:ring-[#C67A52]",autoFocus:!0})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(v.J,{htmlFor:"edit-description",className:"text-[13px] font-medium text-[#2C2C2C]",children:J("proposals.taskDescription")}),(0,e.jsx)(u.T,{id:"edit-description",value:U,onChange:a=>V(a.target.value),rows:4,className:"border-[#E5E2DC] text-sm resize-none focus-visible:ring-[#C67A52]",placeholder:J("proposals.descriptionPlaceholder")})]}),(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(v.J,{htmlFor:"edit-priority",className:"text-[13px] font-medium text-[#2C2C2C]",children:J("proposals.taskPriority")}),(0,e.jsxs)(y.l6,{value:W,onValueChange:X,children:[(0,e.jsx)(y.bq,{className:"border-[#E5E2DC] text-sm focus:ring-[#C67A52]",children:(0,e.jsx)(y.yv,{})}),(0,e.jsxs)(y.gC,{children:[(0,e.jsx)(y.eb,{value:"low",children:J("priority.low")}),(0,e.jsx)(y.eb,{value:"medium",children:J("priority.medium")}),(0,e.jsx)(y.eb,{value:"high",children:J("priority.high")})]})]})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(v.J,{htmlFor:"edit-story-points",className:"text-[13px] font-medium text-[#2C2C2C]",children:J("proposals.taskStoryPoints")}),(0,e.jsx)(t.p,{id:"edit-story-points",type:"number",min:"0",step:"0.5",value:Y,onChange:a=>Z(a.target.value),placeholder:J("proposals.computeBudgetHoursPlaceholder"),className:"border-[#E5E2DC] text-sm focus-visible:ring-[#C67A52]"})]})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)(v.J,{className:"text-[13px] font-medium text-[#2C2C2C] flex items-center gap-1.5",children:[(0,e.jsx)(l.A,{className:"h-3.5 w-3.5 text-[#C67A52]"}),J("acceptanceCriteria.title")]}),$.length>0&&(0,e.jsx)("div",{className:"space-y-2",children:$.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-[#E5E2DC] bg-[#FAF8F4] p-2.5",children:[(0,e.jsx)("div",{className:"flex-1 min-w-0",children:(0,e.jsx)(t.p,{value:a.description,onChange:a=>{let c=[...$];c[b]={...c[b],description:a.target.value},_(c)},placeholder:J("acceptanceCriteria.criterionPlaceholder"),className:"border-[#E5E2DC] text-sm focus-visible:ring-[#C67A52] h-8"})}),(0,e.jsxs)("div",{className:"flex items-center gap-2 shrink-0 pt-1",children:[(0,e.jsx)(x.d,{checked:a.required??!0,onCheckedChange:a=>{let c=[...$];c[b]={...c[b],required:a},_(c)},className:"data-[state=checked]:bg-[#C67A52]"}),(0,e.jsx)("span",{className:"text-[10px] font-medium text-[#6B6B6B] min-w-[52px]",children:a.required??!0?J("acceptanceCriteria.required"):J("acceptanceCriteria.optional")}),(0,e.jsx)(s.$,{variant:"outline",size:"sm",className:"h-7 w-7 p-0 border-[#E5E2DC] text-[#9A9A9A] hover:text-[#D32F2F] hover:border-[#D32F2F] hover:bg-[#FFEBEE]",onClick:()=>{_($.filter((a,c)=>c!==b))},children:(0,e.jsx)(m.A,{className:"h-3 w-3"})})]})]},b))}),(0,e.jsxs)(s.$,{variant:"outline",size:"sm",className:"h-8 gap-1.5 border-[#E5E2DC] text-xs text-[#6B6B6B] hover:text-[#C67A52] hover:border-[#C67A52]",onClick:()=>{_([...$,{description:"",required:!0}])},children:[(0,e.jsx)(k.A,{className:"h-3 w-3"}),J("acceptanceCriteria.addCriterion")]})]}),ak()]}):a?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:J("common.description")}),(0,e.jsx)("div",{className:"mt-2",children:a.description?(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[13px] leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(A.jH,{plugins:{code:B.a},children:a.description})}):(0,e.jsx)("p",{className:"text-sm italic text-[#9A9A9A]",children:J("common.noDescription")})})]}),a.acceptanceCriteria&&(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:J("tasks.acceptanceCriteria")}),(0,e.jsx)("div",{className:"mt-2",children:(0,e.jsx)("div",{className:"prose prose-sm max-w-none text-[13px] leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(A.jH,{plugins:{code:B.a},children:a.acceptanceCriteria})})})]}),a.acceptanceCriteriaItems&&a.acceptanceCriteriaItems.length>0&&(0,e.jsxs)("div",{className:"mt-5",children:[(0,e.jsxs)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A] flex items-center gap-1.5",children:[(0,e.jsx)(l.A,{className:"h-3 w-3"}),J("acceptanceCriteria.title")]}),(0,e.jsx)("div",{className:"mt-2 space-y-1.5",children:a.acceptanceCriteriaItems.map((a,b)=>(0,e.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg bg-[#FAF8F4] p-2.5",children:[(0,e.jsx)("span",{className:"flex-1 text-[13px] text-[#2C2C2C]",children:a.description}),(0,e.jsx)(r.E,{className:`text-[10px] font-medium border-0 shrink-0 ${a.required??!0?"bg-[#FFF3E0] text-[#E65100]":"bg-[#F5F2EC] text-[#6B6B6B]"}`,children:a.required??!0?J("acceptanceCriteria.required"):J("acceptanceCriteria.optional")})]},b))})]}),ac&&(0,e.jsx)("div",{className:"mt-5 rounded-lg bg-[#FFEBEE] p-2.5 text-xs text-[#C4574C]",children:ac}),ak()]}):null})}),(0,e.jsx)("div",{className:"border-t border-[#F5F2EC] px-6 py-4",children:(0,e.jsx)("div",{className:"flex items-center gap-3",children:Q?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:ai,disabled:L,children:J("common.cancel")}),(0,e.jsx)(s.$,{className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",onClick:()=>{if(!S.trim())return void ad(J("proposals.titleRequired"));ad(null),M(async()=>{let b,d=$.filter(a=>a.description.trim().length>0),e={title:S.trim(),description:U.trim()||void 0,priority:W,computeBudgetHours:Y?parseFloat(Y):void 0,acceptanceCriteriaItems:d.length>0?d.map(a=>({description:a.description.trim(),required:a.required??!0})):void 0,...P&&aa.length>0?{dependsOnDraftUuids:aa}:{}};(b=P?await (0,C.w)(c,e):await (0,D.S)(c,a.uuid,e)).success?(R(!1),K.refresh(),G()):ad(b.error||J("proposals.failedToSaveTaskDraft"))})},disabled:L||!S.trim(),children:L?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.A,{className:"mr-2 h-4 w-4 animate-spin"}),J("common.saving")]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(q.A,{className:"mr-2 h-4 w-4"}),P?J("common.create"):J("common.save")]})})]}):a?(0,e.jsxs)(e.Fragment,{children:[d&&(0,e.jsxs)(s.$,{variant:"outline",className:"border-[#E5E0D8]",onClick:ah,children:[(0,e.jsx)(o.A,{className:"mr-2 h-4 w-4"}),J("common.edit")]}),d&&(0,e.jsx)("div",{className:"ml-auto",children:(0,e.jsxs)(z.Lt,{children:[(0,e.jsx)(z.tv,{asChild:!0,children:(0,e.jsx)(s.$,{variant:"outline",size:"icon",className:"h-9 w-9 border-[#E5E0D8] text-[#D32F2F] hover:bg-[#FFEBEE] hover:text-[#D32F2F] hover:border-[#D32F2F]",children:(0,e.jsx)(m.A,{className:"h-4 w-4"})})}),(0,e.jsxs)(z.EO,{children:[(0,e.jsxs)(z.wd,{children:[(0,e.jsx)(z.r7,{children:J("proposals.deleteExperimentRunDraft")}),(0,e.jsx)(z.$v,{children:J("proposals.deleteExperimentRunDraftConfirm")})]}),(0,e.jsxs)(z.ck,{children:[(0,e.jsx)(z.Zr,{children:J("common.cancel")}),(0,e.jsx)(z.Rx,{onClick:()=>{a&&M(async()=>{(await (0,E.j)(c,a.uuid)).success&&(K.refresh(),I?.())})},disabled:L,className:"bg-[#D32F2F] hover:bg-[#B71C1C] text-white",children:L?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.A,{className:"mr-2 h-4 w-4 animate-spin"}),J("common.delete")]}):J("common.delete")})]})]})]})})]}):null})})]})]})}d()}catch(a){d(a)}})},48161:a=>{"use strict";a.exports=require("node:os")},49102:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},50388:(a,b,c)=>{"use strict";c.d(b,{S:()=>e});var d=c(42377);let e=(0,d.createServerReference)("7001eb4571b8964fd95ad3b7fcbbd3a2195e7de288",d.callServer,void 0,d.findSourceMapURL,"updateRunDraftAction")},51277:(a,b,c)=>{"use strict";c.d(b,{DesignValidationChecklist:()=>t});var d=c(10837),e=c(21968),f=c(9222),g=c(97825),h=c(55775),i=c(21692),j=c(71693),k=c(98893),l=c(85487),m=c(21790),n=c(35198),o=c(49599),p=c(96307);function q({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"skeleton",className:(0,p.cn)("bg-accent animate-pulse rounded-md",a),...b})}let r={error:g.A,warning:h.A,info:i.A},s={error:{icon:"text-red-500",bg:"bg-red-50",badge:"bg-red-100 text-red-700"},warning:{icon:"text-amber-500",bg:"bg-amber-50",badge:"bg-amber-100 text-amber-700"},info:{icon:"text-blue-500",bg:"bg-blue-50",badge:"bg-blue-100 text-blue-700"}};function t({projectUuid:a,designUuid:b,status:c}){let i=(0,f.c)("proposalValidation"),[p,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(!0),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1);if("draft"!==c)return null;if(u)return(0,d.jsx)(n.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0",children:(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{className:"text-[13px] font-semibold text-foreground",children:i("title")})]}),(0,d.jsx)(q,{className:"h-5 w-20"})]})});if(w)return(0,d.jsx)(n.Zp,{className:"border-red-200 shadow-none rounded-2xl gap-0 py-0",children:(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{className:"text-[13px] font-semibold text-foreground",children:i("title")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-red-600",children:[(0,d.jsx)(g.A,{className:"h-3.5 w-3.5"}),(0,d.jsx)("span",{children:w})]})]})});if(!p)return null;let A={error:[],warning:[],info:[]};for(let a of p.issues)A[a.level].push(a);let B=[...A.error,...A.warning,...A.info],C=A.error.length,D=A.warning.length,E=(0,d.jsxs)("button",{type:"button",onClick:()=>z(!y),className:"flex w-full items-center justify-between px-5 py-3.5 cursor-pointer hover:bg-[#FAF8F4] transition-colors rounded-2xl",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{className:"text-[13px] font-semibold text-foreground",children:i("title")})]}),(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[p.valid?(0,d.jsxs)(o.E,{className:"border-0 bg-green-100 text-green-700 text-[11px] font-medium",children:[(0,d.jsx)(k.A,{className:"mr-1 h-3 w-3"}),i("passed")]}):(0,d.jsxs)(d.Fragment,{children:[C>0&&(0,d.jsxs)(o.E,{className:"border-0 bg-red-100 text-red-700 text-[11px] font-medium",children:[(0,d.jsx)(g.A,{className:"mr-1 h-3 w-3"}),i("errorCount",{count:C})]}),D>0&&(0,d.jsxs)(o.E,{className:"border-0 bg-amber-100 text-amber-700 text-[11px] font-medium",children:[(0,d.jsx)(h.A,{className:"mr-1 h-3 w-3"}),i("warningCount",{count:D})]})]}),y?(0,d.jsx)(l.A,{className:"h-4 w-4 text-muted-foreground"}):(0,d.jsx)(m.A,{className:"h-4 w-4 text-muted-foreground"})]})]});return(0,d.jsxs)(n.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[E,y&&(0,d.jsx)(n.Wu,{className:"px-4 pb-4 pt-0",children:0===B.length?(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs text-green-600 px-1 py-2",children:[(0,d.jsx)(k.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{children:i("passed")})]}):(0,d.jsx)("div",{className:"space-y-2",children:B.map((a,b)=>{let c=r[a.level],e=s[a.level];return(0,d.jsxs)("div",{className:`flex items-center gap-2.5 rounded-lg px-3 py-2.5 ${e.bg}`,children:[(0,d.jsx)(c,{className:`h-3.5 w-3.5 shrink-0 ${e.icon}`}),(0,d.jsx)("span",{className:"flex-1 min-w-0 text-xs text-foreground",children:a.field?i(a.id,{title:a.field}):i(a.id)}),(0,d.jsx)(o.E,{className:`shrink-0 border-0 text-[10px] font-medium ${e.badge}`,children:i(a.level)})]},`${a.id}-${b}`)})})})]})}},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},53376:(a,b,c)=>{"use strict";c.d(b,{R:()=>w});var d=c(10837),e=c(21968),f=c(1007),g=c(9222),h=c(9810),i=c(21790),j=c(86460),k=c(49599),l=c(42424),m=c(35198),n=c(9994),o=c(2852),p=c(11225),q=c(82658),r=c(42377);let s=(0,r.createServerReference)("707a4a486695fd0b49c89e5eeec64dc88d3093c6dd",r.callServer,void 0,r.findSourceMapURL,"submitHypothesisFormulationAnswersAction"),t="__other__",u={hypothesis:"hypothesis",methodology:"methodology",prior_work:"priorWork",resources:"resources",success_metrics:"successMetrics",scope:"scope"},v={hypothesis:"bg-[#E8F5E9] text-[#2E7D32]",methodology:"bg-[#E3F2FD] text-[#1565C0]",prior_work:"bg-[#FFF3E0] text-[#E65100]",resources:"bg-[#F3E5F5] text-[#7B1FA2]",success_metrics:"bg-[#E0F2F1] text-[#00796B]",scope:"bg-[#FBE9E7] text-[#BF360C]"};function w({questionUuid:a,elaboration:b,onRefresh:c}){let e=(0,g.c)("elaboration"),h=(0,f.useRouter)();if(!b||0===b.rounds.length)return null;let{summary:i,rounds:j}=b;return(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("label",{className:"text-[11px] font-medium uppercase tracking-wide text-[#9A9A9A]",children:e("title")}),(0,d.jsx)("span",{className:"text-xs font-medium text-[#C67A52]",children:e("answeredCounter",{answered:i.answeredQuestions,total:i.totalQuestions})})]}),(0,d.jsx)("div",{className:"space-y-2.5",children:j.map(b=>(0,d.jsx)(x,{round:b,questionUuid:a,onAnswered:()=>{c?.(),h.refresh()}},b.uuid))})]})}function x({round:a,questionUuid:b,onAnswered:c}){let f=(0,g.c)("elaboration"),j="pending_answers"===a.status,l="validated"===a.status,[n,o]=(0,e.useState)(j);return(0,d.jsx)(q.Nt,{open:n,onOpenChange:o,children:(0,d.jsxs)(m.Zp,{className:`border-[#E5E0D8] overflow-hidden ${j?"border-[#C67A52] border-[1.5px]":""}`,children:[(0,d.jsx)(q.R6,{asChild:!0,children:(0,d.jsxs)("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-[#FAF8F4] transition-colors",children:[(0,d.jsx)("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-[#C67A52] text-[11px] font-semibold text-white",children:a.roundNumber}),(0,d.jsx)("span",{className:"flex-1 text-sm font-medium text-[#2C2C2C]",children:f("roundLabel",{number:a.roundNumber})}),l?(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[(0,d.jsx)(h.A,{className:"h-3.5 w-3.5 text-[#5A9E6F]"}),(0,d.jsx)("span",{className:"text-[11px] font-medium text-[#5A9E6F]",children:f("validated")})]}):j?(0,d.jsx)(k.E,{className:"bg-[#FFF3E0] text-[#E65100] border-transparent text-[10px]",children:f("pendingAnswers")}):(0,d.jsx)(k.E,{className:"bg-[#E3F2FD] text-[#1976D2] border-transparent text-[10px]",children:f("statusAnswered")}),(0,d.jsx)(i.A,{className:`h-4 w-4 text-[#9A9A9A] transition-transform ${n?"rotate-180":""}`})]})}),(0,d.jsx)(q.Ke,{children:(0,d.jsx)("div",{className:"border-t border-[#F5F2EC] px-4 py-3",children:j?(0,d.jsx)(A,{round:a,questionUuid:b,onAnswered:c}):(0,d.jsx)(y,{round:a})})})]})})}function y({round:a}){let b=(0,g.c)("elaboration");return(0,d.jsx)("div",{className:"space-y-3",children:a.questions.map(a=>(0,d.jsx)(z,{question:a,t:b},a.uuid))})}function z({question:a,t:b}){let c=a.answer?.selectedOptionId?a.options.find(b=>b.id===a.answer?.selectedOptionId):null,e=u[a.category]||a.category,f=v[a.category]||"bg-[#F5F5F5] text-[#6B6B6B]";return(0,d.jsx)("div",{className:"space-y-1.5",children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 border-[#C67A52]",children:(0,d.jsx)("span",{className:"h-2 w-2 rounded-full bg-[#C67A52]"})}),(0,d.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("p",{className:"text-[13px] leading-snug text-[#2C2C2C]",children:a.text}),(0,d.jsx)(k.E,{className:`shrink-0 border-transparent text-[9px] px-1.5 py-0 ${f}`,children:b(`category.${e}`)})]}),(0,d.jsx)("p",{className:"text-[12px] text-[#6B6B6B]",children:a.answer?.customText?a.answer.customText:c?.label||b("noAnswer")})]})]})})}function A({round:a,questionUuid:b,onAnswered:c}){let f=(0,g.c)("elaboration"),[h,i]=(0,e.useState)({}),[m,q]=(0,e.useState)(!1),[r,w]=(0,e.useState)(null),x=(0,e.useCallback)((a,b)=>{i(c=>({...c,[a]:{questionId:a,selectedOptionId:b===t?null:b,customText:b===t?c[a]?.customText||"":null}}))},[]),y=(0,e.useCallback)((a,b)=>{i(c=>({...c,[a]:{...c[a],questionId:a,selectedOptionId:null,customText:b}}))},[]),z=a.questions.filter(a=>a.required).every(a=>{let b=h[a.questionId];return!!b&&!!(b.selectedOptionId||b.customText&&b.customText.trim())}),A=async()=>{q(!0),w(null);let d=Object.values(h),e=await s(b,a.uuid,d);q(!1),e.success?c():w(e.error||f("submitFailed"))};return(0,d.jsxs)("div",{className:"space-y-4",children:[a.questions.map(a=>{let b=u[a.category]||a.category,c=v[a.category]||"bg-[#F5F5F5] text-[#6B6B6B]",e=(a=>{let b=h[a];return b?null===b.selectedOptionId&&null!==b.customText&&void 0!==b.customText?t:b.selectedOptionId||"":""})(a.questionId);return(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsxs)("p",{className:"flex-1 text-[13px] font-medium leading-snug text-[#2C2C2C]",children:[a.text,a.required&&(0,d.jsx)("span",{className:"ml-0.5 text-[#C67A52]",children:"*"})]}),(0,d.jsx)(k.E,{className:`shrink-0 border-transparent text-[9px] px-1.5 py-0 ${c}`,children:f(`category.${b}`)})]}),(0,d.jsxs)(p.z,{value:e,onValueChange:b=>x(a.questionId,b),className:"gap-2 pl-1",children:[a.options.map(b=>(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(p.C,{value:b.id,id:`${a.uuid}-${b.id}`,className:"mt-0.5 border-[#C67A52] text-[#C67A52] data-[state=checked]:border-[#C67A52]"}),(0,d.jsxs)(o.J,{htmlFor:`${a.uuid}-${b.id}`,className:"text-[12px] leading-snug text-[#2C2C2C] font-normal cursor-pointer",children:[b.label,b.description&&(0,d.jsx)("span",{className:"block text-[11px] text-[#6B6B6B]",children:b.description})]})]},b.id)),(0,d.jsxs)("div",{className:"space-y-1.5",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(p.C,{value:t,id:`${a.uuid}-other`,className:"mt-0.5 border-[#C67A52] text-[#C67A52] data-[state=checked]:border-[#C67A52]"}),(0,d.jsx)(o.J,{htmlFor:`${a.uuid}-other`,className:"text-[12px] leading-snug text-[#2C2C2C] font-normal cursor-pointer",children:f("otherOption")})]}),e===t&&(0,d.jsx)(n.p,{value:h[a.questionId]?.customText||"",onChange:b=>y(a.questionId,b.target.value),placeholder:f("otherPlaceholder"),className:"ml-6 h-8 max-w-sm border-[#E5E0D8] text-[12px] focus-visible:ring-[#C67A52]",autoFocus:!0})]})]})]},a.uuid)}),r&&(0,d.jsx)("div",{className:"rounded-lg bg-destructive/10 p-2.5 text-[12px] text-destructive",children:r}),(0,d.jsx)("div",{className:"flex justify-end pt-1",children:(0,d.jsx)(l.$,{onClick:A,disabled:!z||m,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white text-[13px]",children:m?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(j.A,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),f("submitting")]}):f("submitAnswers")})})]})}},53460:(a,b,c)=>{"use strict";c.d(b,{DesignActions:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call DesignActions() from the server but DesignActions is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/design-actions.tsx","DesignActions")},55063:a=>{"use strict";a.exports=import("shiki/engine/javascript")},55511:a=>{"use strict";a.exports=require("crypto")},57609:(a,b,c)=>{"use strict";c.d(b,{E:()=>i});var d=c(10023);c(73426);var e=c(89571),f=c(15362),g=c(63413);let h=(0,e.F)("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline",success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-100",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-100"}},defaultVariants:{variant:"default"}});function i({className:a,variant:b="default",asChild:c=!1,...e}){let i=c?f.bL:"span";return(0,d.jsx)(i,{"data-slot":"badge","data-variant":b,className:(0,g.cn)(h({variant:b}),a),...e})}},59780:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},60123:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},61007:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},61159:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]])},62221:(a,b,c)=>{"use strict";c.d(b,{L:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60e8964f43a0c46fd7eb5bd44d07a1998e66e2269c",d.callServer,void 0,d.findSourceMapURL,"removeDocumentDraftAction")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64939:a=>{"use strict";a.exports=import("pg")},66430:(a,b,c)=>{"use strict";c.d(b,{j:()=>e});var d=c(42377);let e=(0,d.createServerReference)("607ac07f8a321d8f99cd779629db2138ea431c900d",d.callServer,void 0,d.findSourceMapURL,"removeRunDraftAction")},67341:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},67413:(a,b,c)=>{"use strict";c.d(b,{SourceQuestionsCard:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call SourceQuestionsCard() from the server but SourceQuestionsCard is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/source-questions-card.tsx","SourceQuestionsCard")},68199:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{SourceQuestionsCard:()=>m});var e=c(10837),f=c(21968),g=c(9222),h=c(5797),i=c(33962),j=c(35198),k=c(6070),l=a([k]);function m({ideas:a,projectUuid:b,currentUserUuid:c}){let d=(0,g.c)("proposals"),[l,m]=(0,f.useState)(null);return 0===a.length?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(j.Zp,{className:"border-[#E5E2DC] shadow-none rounded-2xl gap-0 py-0 overflow-hidden",children:[(0,e.jsx)(j.aR,{className:"border-b border-[#F5F2EC] px-5 py-4",children:(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(h.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,e.jsx)(j.ZB,{className:"text-[13px] font-semibold text-foreground",children:d("sourceIdeas")})]})}),(0,e.jsx)(j.Wu,{className:"space-y-2 px-5 py-3",children:a.map(a=>(0,e.jsxs)("button",{onClick:()=>m(a),className:"flex w-full items-center gap-2 rounded-lg bg-[#F5F2EC] px-3 py-2 text-left transition-colors hover:bg-[#EDE9E3]",children:[(0,e.jsx)(h.A,{className:"h-3.5 w-3.5 shrink-0 text-[#C67A52]"}),(0,e.jsx)("span",{className:"flex-1 truncate text-xs font-medium text-[#C67A52]",children:a.title}),(0,e.jsx)(i.A,{className:"h-3 w-3 shrink-0 text-[#9A9A9A]"})]},a.uuid))})]}),l&&(0,e.jsx)(k.D,{idea:l,projectUuid:b,currentUserUuid:c,onClose:()=>m(null)})]})}k=(l.then?(await l)():l)[0],d()}catch(a){d(a)}})},68989:(a,b,c)=>{"use strict";c.d(b,{I:()=>e});var d=c(42377);let e=(0,d.createServerReference)("70706397cc55ec694918ffe090cec7e476c444e25a",d.callServer,void 0,d.findSourceMapURL,"updateDocumentDraftAction")},71693:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(56556).A)("clipboard-check",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]])},71902:(a,b,c)=>{"use strict";c(5486),c(97307).vF.child({module:"auth"})},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73566:a=>{"use strict";a.exports=require("worker_threads")},74236:(a,b,c)=>{"use strict";c.d(b,{Wu:()=>i,ZB:()=>h,Zp:()=>f,aR:()=>g});var d=c(10023);c(73426);var e=c(63413);function f({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card",className:(0,e.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...b})}function g({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-header",className:(0,e.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...b})}function h({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-title",className:(0,e.cn)("leading-none font-semibold",a),...b})}function i({className:a,...b}){return(0,d.jsx)("div",{"data-slot":"card-content",className:(0,e.cn)("px-6",a),...b})}},75335:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},75811:a=>{"use strict";a.exports=import("@prisma/client/runtime/query_compiler_fast_bg.postgresql.mjs")},76760:a=>{"use strict";a.exports=require("node:path")},78112:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{M9:()=>x,Qh:()=>t,Qr:()=>s,Tn:()=>q,Xw:()=>u,Yu:()=>p,ci:()=>w,eN:()=>A,gT:()=>y,nW:()=>z,o4:()=>r,x7:()=>v});var e=c(55511),f=c(52618),g=c(18818),h=c(76872),i=c(911),j=c(8777),k=c(46499),l=a([f,h,j,k]);function m(a){return{...a,uuid:a.uuid||(0,e.randomUUID)()}}function n(a){return{...a,uuid:a.uuid||(0,e.randomUUID)()}}async function o(a){let b="user"===a.createdByType?"user":"agent",[c,d]=await Promise.all([(0,h.LS)(a.createdByUuid,b),(0,h.SJ)(a.reviewedByUuid,a.reviewNote,a.reviewedAt)]),e={uuid:a.uuid,title:a.title,description:a.description,inputType:a.inputType,inputUuids:a.inputUuids,documentDrafts:a.documentDrafts,taskDrafts:a.taskDrafts,status:a.status,createdBy:c,createdByType:a.createdByType,review:d,createdAt:a.createdAt.toISOString(),updatedAt:a.updatedAt.toISOString()};return a.researchProject&&(e.project=a.researchProject),e}async function p(a,b){let c=await f.prisma.experimentDesign.findFirst({where:{uuid:b,companyUuid:a}});if(!c)throw Error("ExperimentDesign not found");let d=[],e=c.documentDrafts||[],g=c.taskDrafts||[],h=c.inputUuids||[];for(let a of(0===e.length&&d.push({id:"E1",level:"error",message:"Proposal must contain at least one document draft"}),e))(!a.content||a.content.length<100)&&d.push({id:"E2",level:"error",message:`Document draft "${a.title}" must have content with at least 100 characters`,field:a.title});if(0===g.length&&d.push({id:"E3",level:"error",message:"Proposal must contain at least one task draft"}),0===h.length&&d.push({id:"E4",level:"error",message:"Proposal must have at least one input (idea or other source)"}),"research_question"===c.inputType&&h.length>0)for(let b of(await f.prisma.researchQuestion.findMany({where:{uuid:{in:h},companyUuid:a},select:{uuid:!0,title:!0,elaborationStatus:!0}})))"resolved"!==b.elaborationStatus&&d.push({id:"E5",level:"error",message:`Input idea "${b.title}" has unresolved elaboration (status: ${b.elaborationStatus})`,field:b.title});for(let a of(e.some(a=>"tech_design"===a.type)||d.push({id:"W1",level:"warning",message:"Proposal should contain at least one tech design document draft"}),g))a.description&&0!==a.description.trim().length||d.push({id:"W2",level:"warning",message:`Task draft "${a.title}" is missing a description`,field:a.title});for(let a of g)a.acceptanceCriteriaItems&&0!==a.acceptanceCriteriaItems.length||d.push({id:"E-AC",level:"error",message:`Task draft "${a.title}" is missing acceptance criteria (structured items required)`,field:a.title});for(let a of(g.length>=2&&(g.some(a=>a.dependsOnDraftUuids&&a.dependsOnDraftUuids.length>0)||d.push({id:"W4",level:"warning",message:"When there are multiple tasks, at least one should declare dependencies"})),c.description&&0!==c.description.trim().length||d.push({id:"W5",level:"warning",message:"Proposal description should not be empty"}),g))a.priority||d.push({id:"I1",level:"info",message:`Task draft "${a.title}" does not have a priority set`,field:a.title});for(let a of g)null==a.computeBudgetHours&&d.push({id:"I2",level:"info",message:`Task draft "${a.title}" does not have story points set`,field:a.title});return{valid:!d.some(a=>"error"===a.level),issues:d}}async function q({companyUuid:a,researchProjectUuid:b,skip:c,take:d,status:e}){let g={researchProjectUuid:b,companyUuid:a,...e&&{status:e}},[h,i]=await Promise.all([f.prisma.experimentDesign.findMany({where:g,skip:c,take:d,orderBy:{createdAt:"desc"},select:{uuid:!0,title:!0,description:!0,inputType:!0,inputUuids:!0,documentDrafts:!0,taskDrafts:!0,status:!0,createdByUuid:!0,createdByType:!0,reviewedByUuid:!0,reviewNote:!0,reviewedAt:!0,createdAt:!0,updatedAt:!0}}),f.prisma.experimentDesign.count({where:g})]);return{experimentDesigns:await Promise.all(h.map(a=>o(a))),total:i}}async function r(a,b){let c=await f.prisma.experimentDesign.findFirst({where:{uuid:b,companyUuid:a},include:{researchProject:{select:{uuid:!0,name:!0}}}});return c?o(c):null}async function s(a,b){return f.prisma.experimentDesign.findFirst({where:{uuid:b,companyUuid:a}})}async function t(a){let b=a.documentDrafts?.map(m),c=a.taskDrafts?.map(n),d=await f.prisma.experimentDesign.create({data:{companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,title:a.title,description:a.description,inputType:a.inputType,inputUuids:a.inputUuids,...b&&{documentDrafts:b},...c&&{taskDrafts:c},status:"draft",createdByUuid:a.createdByUuid,createdByType:a.createdByType||"agent"},select:{uuid:!0,title:!0,description:!0,inputType:!0,inputUuids:!0,documentDrafts:!0,taskDrafts:!0,status:!0,createdByUuid:!0,createdByType:!0,reviewedByUuid:!0,reviewNote:!0,reviewedAt:!0,createdAt:!0,updatedAt:!0}});return i.B.emitChange({companyUuid:a.companyUuid,researchProjectUuid:a.researchProjectUuid,entityType:"experiment_design",entityUuid:d.uuid,action:"created"}),o(d)}async function u(a,b,c,d){let e=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b}});if(!e)throw Error("ExperimentDesign not found");let{updatedProposal:g,materializedTasks:h,materializedDocuments:l}=await f.prisma.$transaction(async b=>{let f=await b.experimentDesign.update({where:{uuid:a},data:{status:"approved",reviewedByUuid:c,reviewNote:d||null,reviewedAt:new Date},include:{researchProject:{select:{uuid:!0,name:!0}}}}),g=e.documentDrafts,h=e.taskDrafts,i=[],l=[];if(g&&g.length>0)for(let a of g){let b=await (0,j.hG)(e.companyUuid,e.researchProjectUuid,e.uuid,e.createdByUuid,a);l.push({draftUuid:a.uuid,documentUuid:b.uuid,title:b.title})}if(h&&h.length>0){for(let a of h)if(a.acceptanceCriteriaItems&&a.acceptanceCriteriaItems.length>0)for(let b=0;b<a.acceptanceCriteriaItems.length;b++){let c=a.acceptanceCriteriaItems[b];if(!c.description||"string"!=typeof c.description||0===c.description.trim().length)throw Error(`Task draft "${a.title}": acceptanceCriteriaItems[${b}] has an empty or invalid description`)}let{draftToTaskUuidMap:a}=await (0,k.Kb)(e.companyUuid,e.researchProjectUuid,e.uuid,e.createdByUuid,h);for(let b of h){let c=a.get(b.uuid);c&&i.push({draftUuid:b.uuid,runUuid:c,title:b.title})}for(let c of h){if(c.dependsOnDraftUuids&&c.dependsOnDraftUuids.length>0){let d=a.get(c.uuid);if(!d)continue;for(let e of c.dependsOnDraftUuids){let c=a.get(e);c&&await b.runDependency.create({data:{runUuid:d,dependsOnRunUuid:c}})}}if(c.acceptanceCriteriaItems&&c.acceptanceCriteriaItems.length>0){let d=a.get(c.uuid);if(!d)continue;await b.acceptanceCriterion.createMany({data:c.acceptanceCriteriaItems.map((a,b)=>({runUuid:d,description:a.description.trim(),required:a.required??!0,sortOrder:b}))})}}}return{updatedProposal:f,materializedTasks:i,materializedDocuments:l}});if(i.B.emitChange({companyUuid:e.companyUuid,researchProjectUuid:e.researchProjectUuid,entityType:"experiment_design",entityUuid:a,action:"updated"}),"research_question"===e.inputType){let a=e.inputUuids||[];a.length>0&&await f.prisma.researchQuestion.updateMany({where:{uuid:{in:a},companyUuid:b,status:"proposal_created"},data:{status:"completed"}})}let m=await o(g);return h.length>0&&(m.materializedTasks=h),l.length>0&&(m.materializedDocuments=l),m}async function v(a,b,c){let d=await f.prisma.experimentDesign.update({where:{uuid:a},data:{status:"draft",reviewedByUuid:b,reviewNote:c,reviewedAt:new Date},include:{researchProject:{select:{uuid:!0,name:!0}}}});return i.B.emitChange({companyUuid:d.companyUuid,researchProjectUuid:d.researchProjectUuid,entityType:"experiment_design",entityUuid:d.uuid,action:"updated"}),o(d)}async function w(a,b,c){let d=await f.prisma.experimentDesign.update({where:{uuid:a},data:{status:"closed",reviewedByUuid:b,reviewNote:c,reviewedAt:new Date},include:{researchProject:{select:{uuid:!0,name:!0}}}});return i.B.emitChange({companyUuid:d.companyUuid,researchProjectUuid:d.researchProjectUuid,entityType:"experiment_design",entityUuid:d.uuid,action:"updated"}),o(d)}async function x(a,b,c){let d=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b,status:"draft"}});if(!d)throw Error("ExperimentDesign not found or not in draft status");let e=d.documentDrafts||[],g=m(c),h=[...e,g],i=await f.prisma.experimentDesign.update({where:{uuid:a},data:{documentDrafts:h},include:{researchProject:{select:{uuid:!0,name:!0}}}});return o(i)}async function y(a,b,c,d){let e=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b,status:"draft"}});if(!e)throw Error("ExperimentDesign not found or not in draft status");let g=e.documentDrafts||[],h=g.findIndex(a=>a.uuid===c);if(-1===h)throw Error("Document draft not found");g[h]={...g[h],...d};let i=await f.prisma.experimentDesign.update({where:{uuid:a},data:{documentDrafts:g},include:{researchProject:{select:{uuid:!0,name:!0}}}});return o(i)}async function z(a,b,c){let d=await f.prisma.experimentDesign.findFirst({where:{uuid:a,companyUuid:b,status:"draft"}});if(!d)throw Error("ExperimentDesign not found or not in draft status");let e=(d.documentDrafts||[]).filter(a=>a.uuid!==c),h=await f.prisma.experimentDesign.update({where:{uuid:a},data:{documentDrafts:e.length>0?e:g.D1.Fj},include:{researchProject:{select:{uuid:!0,name:!0}}}});return o(h)}async function A(a,b){let c=await f.prisma.experimentDesign.findMany({where:{companyUuid:a,researchProjectUuid:b,status:"approved"},select:{uuid:!0,title:!0,createdAt:!0},orderBy:{createdAt:"asc"}}),d=await f.prisma.experimentRun.groupBy({by:["experimentDesignUuid"],where:{companyUuid:a,researchProjectUuid:b,experimentDesignUuid:{in:c.map(a=>a.uuid)}},_count:!0}),e=new Map(d.map(a=>[a.experimentDesignUuid,a._count]));return c.map((a,b)=>({uuid:a.uuid,title:a.title,sequenceNumber:b+1,taskCount:e.get(a.uuid)??0}))}[f,h,j,k]=l.then?(await l)():l,d()}catch(a){d(a)}})},78474:a=>{"use strict";a.exports=require("node:events")},78908:a=>{"use strict";a.exports=import("shiki")},79428:a=>{"use strict";a.exports=require("buffer")},79551:a=>{"use strict";a.exports=require("url")},82658:(a,b,c)=>{"use strict";c.d(b,{Ke:()=>h,Nt:()=>f,R6:()=>g});var d=c(10837),e=c(70952);function f({...a}){return(0,d.jsx)(e.Root,{"data-slot":"collapsible",...a})}function g({...a}){return(0,d.jsx)(e.Trigger,{"data-slot":"collapsible-trigger",...a})}function h({...a}){return(0,d.jsx)(e.Content,{"data-slot":"collapsible-content",...a})}},82870:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=c(40869),f=c(92633),g=a([d,e,f]);[d,e,f]=g.then?(await g)():g,b()}catch(a){b(a)}})},83696:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},83997:a=>{"use strict";a.exports=require("tty")},84297:a=>{"use strict";a.exports=require("async_hooks")},85292:(a,b,c)=>{"use strict";c.d(b,{q:()=>e});var d=c(42377);let e=(0,d.createServerReference)("40b8e6a8f5b487648e2f31fb6caacf3faecaa89d14",d.callServer,void 0,d.findSourceMapURL,"getQuestionActivitiesAction")},85806:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{f0:()=>l});var e=c(15369),f=c(23180),g=c(90097),h=c(93890),i=c(9480),j=c(28774),k=c(466),l=c(67738),m=c(82870),n=c(30457),o=c(92592),p=c(34923),q=c(53870),r=c(59780),s=c(83696),t=c(4284),u=c(92256),v=c(51870),w=c(60123),x=a([e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w]);[e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w]=x.then?(await x)():x,d()}catch(a){d(a)}})},86439:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external")},87991:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]])},88536:(a,b,c)=>{"use strict";c.d(b,{d:()=>g});var d=c(10837);c(21968);var e=c(15644),f=c(96307);function g({className:a,...b}){return(0,d.jsx)(e.Root,{"data-slot":"switch",className:(0,f.cn)("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:ring-ring/50 inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",a),...b,children:(0,d.jsx)(e.Thumb,{"data-slot":"switch-thumb",className:(0,f.cn)("bg-background pointer-events-none block size-4 rounded-full ring-0 shadow-lg transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})})}},88603:(a,b,c)=>{"use strict";c.d(b,{DesignEditor:()=>d});let d=(0,c(37143).registerClientReference)(function(){throw Error("Attempted to call DesignEditor() from the server but DesignEditor is 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.")},"/home/ubuntu/Synapse/src/app/(dashboard)/research-projects/[uuid]/experiment-designs/[designUuid]/design-editor.tsx","DesignEditor")},89792:(a,b,c)=>{"use strict";c.a(a,async(a,d)=>{try{c.d(b,{DesignComments:()=>v});var e=c(10837),f=c(21968),g=c(9222),h=c(86460),i=c(16235),j=c(97443),k=c(24714),l=c(35198),m=c(42424),n=c(84819),o=c(80251),p=c(24433),q=c(28874),r=c(92425),s=c(82831),t=c(76172),u=a([s]);function v({designUuid:a,currentUserUuid:b}){let c=(0,g.c)(),[d,u]=(0,f.useState)(""),[v,w]=(0,f.useState)([]),[x,y]=(0,f.useState)(!0),[z,A]=(0,f.useState)(!1),B=(0,f.useRef)(null);(0,t.w0)("experiment_design",a,c=>{b&&c.actorUuid===b||(0,q.$)(a).then(a=>{w(a.comments)})});let C=async()=>{if(!d.trim()||z)return;A(!0);let b=await (0,r.e)(a,d);A(!1),b.success&&b.comment&&(w(a=>[...a,b.comment]),u(""),B.current?.clear())};return(0,e.jsxs)(l.Zp,{className:"border-[#E5E0D8] p-4",children:[(0,e.jsx)("h3",{className:"mb-3 text-sm font-medium text-[#6B6B6B]",children:c("comments.title")}),(0,e.jsx)("div",{className:"space-y-3",children:x?(0,e.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,e.jsx)(h.A,{className:"h-4 w-4 animate-spin text-[#9A9A9A]"})}):0===v.length?(0,e.jsx)("p",{className:"text-sm text-[#9A9A9A] italic",children:c("comments.noComments")}):v.map(a=>(0,e.jsxs)("div",{className:"flex gap-2.5",children:[(0,e.jsx)(o.eu,{className:"h-6 w-6",children:(0,e.jsx)(o.q5,{className:"agent"===a.author.type?"bg-[#C67A52] text-white":"bg-[#E5E0D8] text-[#6B6B6B] text-[10px]",children:"agent"===a.author.type?(0,e.jsx)(i.A,{className:"h-3 w-3"}):a.author.name.charAt(0).toUpperCase()})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-[#2C2C2C]",children:a.author.name}),(0,e.jsx)("span",{className:"text-[10px] text-[#9A9A9A]",children:function(a,b){let c=new Date(a),d=new Date().getTime()-c.getTime(),e=Math.floor(d/6e4),f=Math.floor(d/36e5),g=Math.floor(d/864e5);return e<1?b("time.justNow"):e<60?b("time.minutesAgo",{minutes:e}):f<24?b("time.hoursAgo",{hours:f}):g<7?b("time.daysAgo",{days:g}):c.toLocaleDateString()}(a.createdAt,c)})]}),(0,e.jsx)("div",{className:"mt-1 text-xs leading-relaxed text-[#2C2C2C]",children:(0,e.jsx)(s.z7,{children:a.content})})]})]},a.uuid))}),(0,e.jsx)(n.Separator,{className:"my-3 bg-[#F5F2EC]"}),(0,e.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,e.jsx)(o.eu,{className:"mt-1.5 h-6 w-6",children:(0,e.jsx)(o.q5,{className:"bg-[#C67A52] text-white text-[10px]",children:(0,e.jsx)(j.A,{className:"h-3 w-3"})})}),(0,e.jsx)("div",{className:"flex-1",children:(0,e.jsx)(p.c,{ref:B,value:d,onChange:u,onSubmit:C,placeholder:c("comments.addComment"),className:"border-none bg-[#FAF8F4] text-sm",disabled:z})}),(0,e.jsx)(m.$,{size:"icon",variant:"ghost",className:"mt-1 h-7 w-7",disabled:!d.trim()||z,onClick:C,children:z?(0,e.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin text-[#9A9A9A]"}):(0,e.jsx)(k.A,{className:"h-3.5 w-3.5 text-[#C67A52]"})})]})]})}s=(u.then?(await u)():u)[0],d()}catch(a){d(a)}})},91645:a=>{"use strict";a.exports=require("net")},92190:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});let d=(0,c(91533).A)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]])},92256:(a,b,c)=>{"use strict";c.a(a,async(a,b)=>{try{var d=c(71255),e=a([d]);d=(e.then?(await e)():e)[0],b()}catch(a){b(a)}})},92425:(a,b,c)=>{"use strict";c.d(b,{e:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60eb8b406bda37b41cbdbf1462e45ee2945bc7aa10",d.callServer,void 0,d.findSourceMapURL,"createDesignCommentAction")},94521:(a,b,c)=>{"use strict";c.d(b,{n:()=>e});var d=c(42377);let e=(0,d.createServerReference)("60a3f1338a100846860fe056719a21232d69b3ce75",d.callServer,void 0,d.findSourceMapURL,"createResearchQuestionCommentAction")},94735:a=>{"use strict";a.exports=require("events")},97450:(a,b,c)=>{"use strict";c.d(b,{MarkdownContent:()=>f});var d=c(10837),e=c(1461);function f({children:a}){return(0,d.jsx)(e.u,{children:a})}},97601:(a,b,c)=>{"use strict";c.d(b,{i:()=>p});var d=c(10837),e=c(21968),f=c(1007),g=c(9222),h=c(10694),i=c(86460),j=c(16235),k=c(97443),l=c(42424),m=c(2852),n=c(11225),o=c(55732);function p({idea:a,projectUuid:b,currentUserUuid:c,onClose:p}){let q=(0,g.c)(),r=(0,f.useRouter)(),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)("self"),[w,x]=(0,e.useState)(""),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)([]),[E,F]=(0,e.useState)(!0),G=!!a.assignee,H=async()=>{t(!0);try{let b;if("self"===u)b=await fetch(`/api/research-questions/${a.uuid}/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assignToSelf:!0})});else if("agent"===u&&w)b=await fetch(`/api/research-questions/${a.uuid}/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agentUuid:w})});else if("user"===u&&y)b=await fetch(`/api/research-questions/${a.uuid}/claim`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({assignToSelf:!1,userUuid:y})});else{if("release"!==u)return void t(!1);b=await fetch(`/api/research-questions/${a.uuid}/release`,{method:"POST"})}t(!1),b.ok&&(r.refresh(),p())}catch{t(!1)}},I="self"===u||"agent"===u&&w||"user"===u&&y||"release"===u&&G;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40",onClick:p}),(0,d.jsxs)("div",{className:"fixed left-1/2 top-1/2 z-50 w-[400px] -translate-x-1/2 -translate-y-1/2 rounded-2xl bg-white shadow-xl border border-[#E5E0D8]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between border-b border-[#E5E0D8] px-6 py-5",children:[(0,d.jsx)("h2",{className:"text-base font-semibold text-[#2C2C2C]",children:q("ideas.assignIdea")}),(0,d.jsx)("button",{onClick:p,className:"text-[#9A9A9A] hover:text-[#6B6B6B] transition-colors",children:(0,d.jsx)(h.A,{className:"h-5 w-5"})})]}),(0,d.jsxs)("div",{className:"p-6 space-y-4",children:[(0,d.jsxs)("div",{className:"rounded-lg bg-[#FAF8F4] p-3",children:[(0,d.jsx)("p",{className:"text-[13px] font-medium text-[#2C2C2C]",children:a.title}),a.content&&(0,d.jsx)("p",{className:"mt-1 text-[11px] text-[#6B6B6B] line-clamp-2",children:a.content})]}),G&&(0,d.jsx)("div",{className:"rounded-lg bg-[#E3F2FD] p-3",children:(0,d.jsxs)("p",{className:"text-xs text-[#1976D2]",children:[q("common.currentAssignee"),": ",(0,d.jsx)("span",{className:"font-medium",children:a.assignee?.name})]})}),(0,d.jsx)("p",{className:"text-[13px] text-[#6B6B6B]",children:q("ideas.selectIdeaAssignee")}),E?(0,d.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,d.jsx)(i.A,{className:"h-6 w-6 animate-spin text-[#9A9A9A]"})}):(0,d.jsxs)(n.z,{value:u,onValueChange:a=>v(a),className:"space-y-3",children:[(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors cursor-pointer ${"self"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8] hover:border-[#C67A52]/50"}`,onClick:()=>v("self"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(n.C,{value:"self",id:"idea-self",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-self",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("assign.assignToMyself")})]}),(0,d.jsx)("p",{className:"mt-2 ml-6 text-xs text-[#6B6B6B] leading-relaxed",children:q("ideas.assignToMyselfIdeaDesc")})]}),(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors ${"agent"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8]"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 cursor-pointer",onClick:()=>v("agent"),children:[(0,d.jsx)(n.C,{value:"agent",id:"idea-agent",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-agent",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("ideas.orAssignToPmAgent")})]}),(0,d.jsx)("p",{className:"mt-2 ml-6 text-xs text-[#6B6B6B] leading-relaxed",children:q("ideas.onlySelectedPmAgentCanWork")}),"agent"===u&&(0,d.jsx)("div",{className:"mt-3 ml-6",children:(0,d.jsxs)(o.l6,{value:w,onValueChange:x,children:[(0,d.jsx)(o.bq,{className:"w-full border-[#E5E0D8]",children:(0,d.jsx)(o.yv,{placeholder:q("ideas.selectPmAgent")})}),(0,d.jsx)(o.gC,{children:A.length>0?A.map(a=>(0,d.jsx)(o.eb,{value:a.uuid,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(j.A,{className:"h-4 w-4 text-[#C67A52]"}),(0,d.jsx)("span",{children:a.name})]})},a.uuid)):(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-[#9A9A9A]",children:q("ideas.noPmAgentsAvailable")})})]})})]}),(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors ${"user"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8]"}`,children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 cursor-pointer",onClick:()=>v("user"),children:[(0,d.jsx)(n.C,{value:"user",id:"idea-user",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-user",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("assign.orAssignToUser")})]}),"user"===u&&(0,d.jsx)("div",{className:"mt-3 ml-6",children:(0,d.jsxs)(o.l6,{value:y,onValueChange:z,children:[(0,d.jsx)(o.bq,{className:"w-full border-[#E5E0D8]",children:(0,d.jsx)(o.yv,{placeholder:q("tasks.selectUser")})}),(0,d.jsx)(o.gC,{children:C.length>0?C.map(a=>(0,d.jsx)(o.eb,{value:a.uuid,children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(k.A,{className:"h-4 w-4 text-[#6B6B6B]"}),(0,d.jsx)("span",{children:a.name||a.email})]})},a.uuid)):(0,d.jsx)("div",{className:"px-3 py-2 text-xs text-[#9A9A9A]",children:q("tasks.noUsersAvailable")})})]})})]}),G&&(0,d.jsxs)("div",{className:`rounded-[10px] p-4 transition-colors cursor-pointer ${"release"===u?"bg-[#FDF8F6] border-2 border-[#C67A52]":"bg-white border border-[#E5E0D8] hover:border-[#C67A52]/50"}`,onClick:()=>v("release"),children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(n.C,{value:"release",id:"idea-release",className:"border-[#C67A52] text-[#C67A52]"}),(0,d.jsx)(m.J,{htmlFor:"idea-release",className:"text-sm font-medium text-[#2C2C2C] cursor-pointer",children:q("assign.releaseAssignee")})]}),(0,d.jsx)("p",{className:"mt-2 ml-6 text-xs text-[#6B6B6B] leading-relaxed",children:q("ideas.releaseIdeaAssigneeDesc")})]})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-end gap-4 rounded-b-2xl bg-white px-6 py-6 border-t border-[#E5E0D8]",children:[(0,d.jsx)(l.$,{variant:"outline",onClick:p,disabled:s,className:"border-[#E5E0D8]",children:q("common.cancel")}),(0,d.jsx)(l.$,{onClick:H,disabled:s||!I,className:"bg-[#C67A52] hover:bg-[#B56A42] text-white",children:s?(0,d.jsx)(i.A,{className:"h-4 w-4 animate-spin"}):q("release"===u?"common.release":"common.assign")})]})]})]})}},98175:(a,b,c)=>{"use strict";c.d(b,{U:()=>e});var d=c(42377);let e=(0,d.createServerReference)("6036b14c7a0b485d68bb436fcc5c9a726686abd8c6",d.callServer,void 0,d.findSourceMapURL,"addDocumentDraftAction")}};var b=require("../../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[8843,7352,936,9833,3548,8481,8322,9516,1512,7201,7878,865,5826,117,9642,2956,3173,9865,2411,2914,5248,3656,1539,907,6088,5628,3513,5854,7357,314,3791,6499,8283,7018,691,759],()=>b(b.s=8176));module.exports=c})();
|