1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="95ef14d3-7a2f-4d02-a852-07815c4db7c4",e._sentryDebugIdIdentifier="sentry-dbid-95ef14d3-7a2f-4d02-a852-07815c4db7c4")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7681],{25043:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/test-project",function(){return s(25552)}])},13803:function(e,t,s){"use strict";s.d(t,{RM:function(){return c},SC:function(){return o},iA:function(){return n},pj:function(){return m},ss:function(){return u},xD:function(){return l}});var a=s(85893),r=s(67294),i=s(72741);let n=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("div",{className:"relative w-full overflow-auto",children:(0,a.jsx)("table",{ref:t,className:(0,i.cn)("w-full caption-bottom text-sm",s),...r})})});n.displayName="Table";let l=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("thead",{ref:t,className:(0,i.cn)("[&_tr]:border-b",s),...r})});l.displayName="TableHeader";let c=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("tbody",{ref:t,className:(0,i.cn)("[&_tr:last-child]:border-0",s),...r})});c.displayName="TableBody";let d=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("tfoot",{ref:t,className:(0,i.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...r})});d.displayName="TableFooter";let o=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("tr",{ref:t,className:(0,i.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...r})});o.displayName="TableRow";let u=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("th",{ref:t,className:(0,i.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...r})});u.displayName="TableHead";let m=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("td",{ref:t,className:(0,i.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...r})});m.displayName="TableCell";let j=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("caption",{ref:t,className:(0,i.cn)("mt-4 text-sm text-muted-foreground",s),...r})});j.displayName="TableCaption"},82839:function(e,t,s){"use strict";s.d(t,{g:function(){return n}});var a=s(85893),r=s(67294),i=s(72741);let n=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)("textarea",{className:(0,i.cn)("flex min-h-[120px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 resize-none",s),ref:t,...r})});n.displayName="Textarea"},25552:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return g},default:function(){return y}});var a=s(85893),r=s(9008),i=s.n(r),n=s(41664),l=s.n(n),c=s(67294),d=s(38921),o=s(58058),u=s(80100),m=s(46532),j=s(82839),p=s(13803),x=s(50010),h=s(97456),f=s(5502);let v=JSON.stringify({nodes:[],edges:[],viewport:{x:0,y:0,zoom:1}},null,2);async function b(e){let t=await e.json();if(!e.ok)throw Error(t.error||"请æ±å¤±è´¥");return t}var g=!0;function y(){let{toast:e}=(0,h.pm)(),[t,s]=(0,c.useState)([]),[r,n]=(0,c.useState)(1),[g,y]=(0,c.useState)(!1),[N,w]=(0,c.useState)(!1),[C,S]=(0,c.useState)(!1),[_,E]=(0,c.useState)(null),[I,R]=(0,c.useState)(""),[T,k]=(0,c.useState)(""),[P,z]=(0,c.useState)(""),[D,F]=(0,c.useState)(null),[O,U]=(0,c.useState)(!1),[A,L]=(0,c.useState)(""),[J,Z]=(0,c.useState)(""),[H,M]=(0,c.useState)(""),[V,W]=(0,c.useState)(f.WL.PRIVATE),[Y,B]=(0,c.useState)(v),X=(0,c.useCallback)(async t=>{w(!0);try{let e=await fetch("/api/projects?page=".concat(t,"&pageSize=20")),a=await b(e);s(a.data.projects),n(a.data.page),y(a.data.hasMore)}catch(t){e({variant:"destructive",title:"å 载失败",description:t instanceof Error?t.message:"æªç¥é误"})}finally{w(!1)}},[e]);(0,c.useEffect)(()=>{X(1)},[X]);let q=async t=>{U(!0);try{var s,a;let e=await fetch("/api/projects/".concat(encodeURIComponent(t))),r=await b(e),i=r.data;F(i),L(i.project.name),Z(null!==(s=i.project.description)&&void 0!==s?s:""),M(null!==(a=i.project.thumbnail)&&void 0!==a?a:""),W(i.project.privacy),B(JSON.stringify(i.document.content,null,2))}catch(t){e({variant:"destructive",title:"读å失败",description:t instanceof Error?t.message:"æªç¥é误"})}finally{U(!1)}},G=async()=>{if(!I.trim()){e({variant:"destructive",title:"åæ°é误",description:"项ç®åç§°ä¸è½ä¸ºç©º"});return}S(!0);try{let t=await fetch("/api/projects",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:I,description:T||null,teamId:P.trim()||null})}),s=await b(t);R(""),k(""),z(""),await X(1),await q(s.data.project.id),e({title:"å建æå",description:s.data.project.id})}catch(t){e({variant:"destructive",title:"å建失败",description:t instanceof Error?t.message:"æªç¥é误"})}finally{S(!1)}},K=async()=>{if(D){S(!0);try{let t=await fetch("/api/projects/".concat(encodeURIComponent(D.project.id)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:A,description:J||null,thumbnail:H||null,privacy:V})});await b(t),await X(r),await q(D.project.id),e({title:"ä¿åæå"})}catch(t){e({variant:"destructive",title:"ä¿å失败",description:t instanceof Error?t.message:"æªç¥é误"})}finally{S(!1)}}},Q=async t=>{if(window.confirm("确认å é¤é¡¹ç®â".concat(t.name,"âåï¼"))){E(t.id);try{let s=await fetch("/api/projects/".concat(encodeURIComponent(t.id)),{method:"DELETE"});await b(s),(null==D?void 0:D.project.id)===t.id&&F(null),await X(r),e({title:"å 餿å"})}catch(t){e({variant:"destructive",title:"å é¤å¤±è´¥",description:t instanceof Error?t.message:"æªç¥é误"})}finally{E(null)}}};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i(),{children:(0,a.jsx)("title",{children:"Project CRUD æµè¯ | Zopia"})}),(0,a.jsxs)("main",{className:"mx-auto flex w-full max-w-7xl flex-col gap-6 p-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold",children:"React Flow Project CRUD"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"æ¤é¡µé¢è°ç¨æ£å¼ Project APIãç³»ç»ç®¡çååªè½ä¿®æ¹èªå·±ææ Team ç¼è¾æéç项ç®ã"})]}),(0,a.jsxs)(o.Zb,{children:[(0,a.jsx)(o.Ol,{children:(0,a.jsx)(o.ll,{children:"å建 Project"})}),(0,a.jsxs)(o.aY,{className:"grid gap-4 md:grid-cols-2",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(m._,{htmlFor:"create-project-name",children:"åç§°"}),(0,a.jsx)(u.I,{id:"create-project-name",value:I,onChange:e=>R(e.target.value),placeholder:"æ° Project"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(m._,{htmlFor:"create-project-team",children:"Team IDï¼ç空为个人项ç®ï¼"}),(0,a.jsx)(u.I,{id:"create-project-team",value:P,onChange:e=>z(e.target.value),placeholder:"team_xxx"})]}),(0,a.jsxs)("div",{className:"space-y-2 md:col-span-2",children:[(0,a.jsx)(m._,{htmlFor:"create-project-description",children:"æè¿°"}),(0,a.jsx)(j.g,{id:"create-project-description",value:T,onChange:e=>k(e.target.value)})]}),(0,a.jsx)("div",{className:"md:col-span-2",children:(0,a.jsx)(d.z,{onClick:G,disabled:C,children:C?"å建ä¸â¦":"å建 Project"})})]})]}),(0,a.jsxs)(o.Zb,{children:[(0,a.jsxs)(o.Ol,{className:"flex-row items-center justify-between",children:[(0,a.jsx)(o.ll,{children:"Project å表"}),(0,a.jsx)(d.z,{variant:"outline",onClick:()=>X(r),disabled:N,children:"å·æ°"})]}),(0,a.jsxs)(o.aY,{children:[N?(0,a.jsx)("div",{className:"flex justify-center py-10",children:(0,a.jsx)(x.Z,{})}):(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)(p.iA,{children:[(0,a.jsx)(p.xD,{children:(0,a.jsxs)(p.SC,{children:[(0,a.jsx)(p.ss,{children:"åç§° / ID"}),(0,a.jsx)(p.ss,{children:"å½å±"}),(0,a.jsx)(p.ss,{children:"éç§"}),(0,a.jsx)(p.ss,{children:"æé"}),(0,a.jsx)(p.ss,{children:"æ´æ°æ¶é´"}),(0,a.jsx)(p.ss,{className:"text-right",children:"æä½"})]})}),(0,a.jsxs)(p.RM,{children:[t.map(e=>(0,a.jsxs)(p.SC,{children:[(0,a.jsxs)(p.pj,{children:[(0,a.jsx)("div",{className:"font-medium",children:e.name}),(0,a.jsx)("code",{className:"text-xs text-muted-foreground",children:e.id})]}),(0,a.jsx)(p.pj,{children:e.teamId?"Team: ".concat(e.teamId):"User: ".concat(e.ownerUserId)}),(0,a.jsxs)(p.pj,{children:[e.privacy,e.isFeatured?" \xb7 featured":""]}),(0,a.jsx)(p.pj,{children:e.permission.reason}
1),(0,a.jsx)(p.pj,{children:new Date(e.updatedAt).toLocaleString()}),(0,a.jsx)(p.pj,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(d.z,{variant:"outline",size:"sm",asChild:!0,children:(0,a.jsx)(l(),{href:"/project?projectId=".concat(encodeURIComponent(e.id)),target:"_blank",rel:"noreferrer",children:"æå¼ç»å¸"})}),(0,a.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>q(e.id),disabled:O,children:"æ¥ç"}),(0,a.jsx)(d.z,{variant:"destructive",size:"sm",disabled:!e.permission.canEdit||_===e.id,onClick:()=>Q(e),children:_===e.id?"å é¤ä¸â¦":"å é¤"})]})})]},e.id)),!t.length&&(0,a.jsx)(p.SC,{children:(0,a.jsx)(p.pj,{colSpan:6,className:"py-10 text-center text-muted-foreground",children:"ææ Project"})})]})]})}),(0,a.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,a.jsx)(d.z,{variant:"outline",disabled:r<=1||N,onClick:()=>X(r-1),children:"ä¸ä¸é¡µ"}),(0,a.jsxs)("span",{className:"text-sm text-muted-foreground",children:["第 ",r," 页"]}),(0,a.jsx)(d.z,{variant:"outline",disabled:!g||N,onClick:()=>X(r+1),children:"ä¸ä¸é¡µ"})]})]})]}),D&&(0,a.jsxs)(o.Zb,{children:[(0,a.jsx)(o.Ol,{children:(0,a.jsx)(o.ll,{children:"Project 详æ
䏿´æ°"})}),(0,a.jsxs)(o.aY,{className:"grid gap-4 md:grid-cols-2",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(m._,{htmlFor:"edit-project-name",children:"åç§°"}),(0,a.jsx)(u.I,{id:"edit-project-name",value:A,disabled:!D.permission.canEdit,onChange:e=>L(e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(m._,{htmlFor:"edit-project-thumbnail",children:"缩ç¥å¾ URL"}),(0,a.jsx)(u.I,{id:"edit-project-thumbnail",value:H,disabled:!D.permission.canEdit,onChange:e=>M(e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2 md:col-span-2",children:[(0,a.jsx)(m._,{htmlFor:"edit-project-description",children:"æè¿°"}),(0,a.jsx)(j.g,{id:"edit-project-description",value:J,disabled:!D.permission.canEdit,onChange:e=>Z(e.target.value)})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(m._,{htmlFor:"edit-project-privacy",children:"éç§"}),(0,a.jsxs)("select",{id:"edit-project-privacy",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:V,disabled:!D.permission.canEdit,onChange:e=>W(e.target.value),children:[(0,a.jsx)("option",{value:f.WL.PRIVATE,children:"private"}),(0,a.jsx)("option",{value:f.WL.PUBLIC,children:"public"})]})]}),(0,a.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground",children:[(0,a.jsxs)("div",{children:["Revision: ",D.document.revision]}),(0,a.jsxs)("div",{children:["Schema version: ",D.document.schemaVersion]}),(0,a.jsxs)("div",{children:["Permission: ",D.permission.reason]})]}),(0,a.jsxs)("div",{className:"space-y-2 md:col-span-2",children:[(0,a.jsx)(m._,{htmlFor:"edit-project-content",children:"ç»å¸ Content JSONï¼åªè¯»ï¼"}),(0,a.jsx)(j.g,{id:"edit-project-content",className:"min-h-80 font-mono text-xs",value:Y,readOnly:!0})]}),(0,a.jsx)("div",{className:"md:col-span-2",children:(0,a.jsx)(d.z,{onClick:K,disabled:C||!D.permission.canEdit,children:C?"ä¿åä¸â¦":"ä¿å Project"})})]})]})]})]})}}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=25043)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.