PageSourceSearch

https://legalaios2.manus.space/assets/Knowledge-C4b45VsF.js

js legalaios2.manus.space collected 2026-10-03 05:03:16 UTC 26,215 bytes, 8 lines download raw bytes

1import{r as d,j as e}from"./vendor-react-D_PmJq1g.js";import{C as xe,S as me,a as pe,b as he,c as ue,d as we,E as be}from"./ConsolePage-hLYCyqMG.js";import{B as $}from"./badge-DKUuEzvb.js";import{v as je,n as w,p as g,B as x,I as J,T as Ke,E as A,r as Ne,D as X,w as Y,x as Z,y as ee,z as se,A as te}from"./index-CH-dzzKG.js";import{L as R,T as ve,a as fe,b as ae,c as le}from"./tabs-DD8ws5u5.js";import{L as Q,R as ne,a3 as ye,a4 as ke,F as Ie,a5 as Ce,a6 as ce,a7 as Se,q as ze,v as Le,P as Me,a8 as Pe,c as Te,a9 as De}from"./vendor-ui-CX5AecA-.js";import"./vendor-data-tjINLo7H.js";const oe=36;function de(l,k){const c=l.replace(/\r\n/g,`
2`).split(`
3`),m=k.replace(/\r\n/g,`
4`).split(`
5`),o=[];let a=0,t=0;const b=()=>{o.push({kind:"removed",content:c[a]??"",oldLine:a+1,newLine:null}),a+=1},h=()=>{o.push({kind:"added",content:m[t]??"",oldLine:null,newLine:t+1}),t+=1};for(;a<c.length&&t<m.length;){if(c[a]===m[t]){o.push({kind:"unchanged",content:c[a]??"",oldLine:a+1,newLine:t+1}),a+=1,t+=1;continue}const r=m.slice(t+1,t+1+oe).findIndex(i=>i===c[a]),K=c.slice(a+1,a+1+oe).findIndex(i=>i===m[t]);if(r>=0&&(K<0||r<=K)){for(let i=0;i<=r;i+=1)h();continue}if(K>=0){for(let i=0;i<=K;i+=1)b();continue}b(),h()}for(;a<c.length;)b();for(;t<m.length;)h();const f=o.filter(r=>r.kind==="added").length,I=o.filter(r=>r.kind==="removed").length,C=o.filter(r=>r.kind==="unchanged").length,j=Math.max(c.length,m.length,1),S=Math.min(100,Math.round((f+I)/j*100));return{lines:o,added:f,removed:I,unchanged:C,changedPercent:S}}const Fe={rule:"規則文件",faq:"FAQ",brand:"品牌設定"};function Oe(){const{activeSiteId:l,refresh:k}=je(),c=w.useUtils(),m=d.useRef(null),[o,a]=d.useState(null),[t,b]=d.useState(!1),[h,f]=d.useState(""),[I,C]=d.useState("rule"),[j,S]=d.useState(""),[r,K]=d.use
5State(null),[i,D]=d.useState("editor"),[B,z]=d.useState(""),[L,M]=d.useState(null),[P,F]=d.useState(null),O=w.knowledge.list.useQuery({siteId:l??0},{enabled:!!l}),u=O.data??[],T=w.knowledge.get.useQuery({siteId:l??0,documentId:o??0},{enabled:!!(l&&o&&!t)}),_=w.knowledge.releases.useQuery({siteId:l??0},{enabled:!!l});d.useEffect(()=>{!t&&u.length>0&&!u.some(s=>s.id===o)&&a(u[0].id),u.length===0&&!t&&a(null)},[t,u,o]),d.useEffect(()=>{const s=T.data?.document;!s||t||(f(s.title),C(s.kind),S(s.content),K(s.fileName),D(s.sourceType),z(""))},[t,T.data?.document]);const W=w.knowledge.create.useMutation({onSuccess:async s=>{await Promise.all([c.knowledge.list.invalidate(),k()]),b(!1),a(s.id),g.success("知識文件已建立並儲存為草稿")},onError:s=>g.error(s.message)}),H=w.knowledge.saveDraft.useMutation({onSuccess:async s=>{await Promise.all([c.knowledge.list.invalidate({siteId:s.siteId}),c.knowledge.get.invalidate({siteId:s.siteId,documentId:s.id}),k()]),g.success(`草稿 v${s.currentVersion} 已儲存`)},onError:s=>g.error(s.message)}),U=w.knowledge.publishDocument.useMutation({onSuccess:async s=>{await Promise.all([c.knowledge.list.invalidate({siteId:s.document.siteId}),c.knowledge.get.invalidate({siteId:s.document.siteId,documentId:s.document.id}),k()]),g.success(`「${s.document.title}」已發布`)},onError:s=>g.error(s.message)}),E=w.knowledge.rollback.useMutation({onSuccess:async s=>{await Promise.all([c.knowledge.list.invalidate({siteId:s.siteId}),c.knowledge.get.invalidate({siteId:s.siteId,documentId:s.id})]),M(null),g.success(`已建立回滾草稿 v${s.currentVersion}`)},onError:s=>g.error(s.message)}),V=w.knowledge.publishWorkspace.useMutation({onSuccess:async s=>{await Promise.all([c.knowledge.releases.invalidate(),k()]),g.success(`工作區 Release ${s.versionNumber} 已發布`)},onError:s=>g.error(s.message)});function q(){b(!0),a(null),f(""),C("rule"),S(`# 新知識文件
6
7請在此輸入品牌規則、FAQ 或法律知識內容。
8`),K(null),D("editor"),z("")}async function re(s){if(!s.name.toLowerCase().endsWith(".md")&&s.type!=="text/markdown"&&s.type!=="text/plain"){g.error("請選擇 Markdown(.md)文件");return}if(s.size>75e4){g.error("單一文件不可超過 750 KB");return}const n=await s.text();b(!0),a(null),f(s.name.replace(/\.md$/i,"")),C("rule"),S(n),K(s.name),D("upload"),z("")}function ie(){!l||h.trim().length<2||j.trim().length===0||(t?W.mutate({siteId:l,title:h,kind:I,content:j,sourceType:i,fileName:r}):o&&H.mutate({siteId:l,documentId:o,title:h,kind:I,content:j,changeSummary:B||void 0}))}const p=T.data?.document,N=T.data?.versions??[],v=d.useMemo(()=>{if(!P||!p||N.length===0)return null;const s=N.find(y=>y.versionNumber===P),n=N.find(y=>y.versionNumber===p.currentVersion);if(!s||!n)return null;if(s.versionNumber===n.versionNumber){const y=N.find(ge=>ge.versionNumber===n.versionNumber-1);return y?{from:y,to:n,result:de(y.content,n.content)}:null}return{from:s,to:n,result:de(s.content,n.content)}},[P,p,N]),G=W.isPending||H.isPending;return e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:209",className:"mx-auto max-w-[1600px]",children:[e.jsx(xe,{"data-loc":"client/src/pages/console/Knowledge.tsx:210",eyebrow:"Knowledge Operations",title:"知識庫",description:"匯入 Markdown、FAQ 與品牌規則,先在草稿中預覽與測試,再建立可回溯的正式發布版本。",action:e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:215",onClick:()=>l&&V.mutate({siteId:l}),disabled:!l||u.every(s=>s.status!=="published")||V.isPending,className:"h-10 rounded-xl bg-champagne-400 px-4 font-bold text-navy-950 hover:bg-champagne-300",children:[V.isPending?e.jsx(Q,{"data-loc":"client/src/pages/console/Knowledge.tsx:220",className:"mr-2 size-4 animate-spin"}):e.jsx(ne,{"data-loc":"client/src/pages/console/Knowledge.tsx:220",className:"mr-2 size-4"}),"發布工作區"]})}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:226",className:"grid gap-5 xl:grid-cols-[20rem_minmax(0,1fr)_18rem]",children:[e.jsxs("aside",{"data-loc":"client/src/pages/console/Knowledge.tsx:227",className:"glass-panel h-fit roun
8ded-[1.35rem] p-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:228",className:"grid grid-cols-2 gap-2",children:[e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:229",onClick:q,variant:"outline",className:"rounded-xl border-slate-200 bg-slate-50 text-slate-800 hover:bg-slate-100",children:[e.jsx(ye,{"data-loc":"client/src/pages/console/Knowledge.tsx:230",className:"mr-2 size-4"})," 新增"]}),e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:232",onClick:()=>m.current?.click(),variant:"outline",className:"rounded-xl border-slate-200 bg-slate-50 text-slate-800 hover:bg-slate-100",children:[e.jsx(ke,{"data-loc":"client/src/pages/console/Knowledge.tsx:233",className:"mr-2 size-4"})," 匯入"]}),e.jsx("input",{"data-loc":"client/src/pages/console/Knowledge.tsx:235",ref:m,type:"file",accept:".md,text/markdown,text/plain",className:"hidden",onChange:s=>{const n=s.target.files?.[0];n&&re(n),s.currentTarget.value=""}})]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:248",className:"mt-5 flex items-center justify-between px-1",children:[e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:249",className:"text-[0.62rem] font-bold tracking-[0.15em] text-champagne-700 uppercase",children:"Documents"}),e.jsx("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:250",className:"text-[0.65rem] text-slate-600",children:u.length})]}),e.jsx("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:252",className:"mt-3 space-y-2",children:u.map(s=>{const n=!t&&s.id===o;return e.jsx("button",{"data-loc":"client/src/pages/console/Knowledge.tsx:256",type:"button",onClick:()=>{b(!1),a(s.id)},className:`w-full rounded-xl border p-3 text-left ${n?"border-champagne-400/24 bg-champagne-400/8":"border-slate-200 bg-white hover:bg-slate-50"}`,children:e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:265",className:"flex items-start gap-3",children:[e.jsx("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:266",className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-lg bg-slate-100 text-champagne-700",children:e.jsx(Ie,{"data-loc":"client/src/pages/console/Knowledge.tsx:266",className:"size-3.5"})}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:267",className:"min-w-0 flex-1",children:[e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:268",className:"truncate text-sm font-bold text-navy-950",children:s.title}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:269",className:"mt-2 flex items-center gap-2 text-[0.6rem]",children:[e.jsxs("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:269",className:"text-slate-600",children:["v",s.currentVersion]}),e.jsx("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:269",className:s.status==="published"?"text-emerald-700":"text-amber-200",children:s.status==="published"?"已發布":"草稿"})]})]})]})},s.id)})}),u.length===0&&!O.isLoading&&e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:277",className:"mt-5 rounded-xl border border-dashed border-slate-200 px-4 py-7 text-center text-xs leading-6 text-slate-600",children:"尚無知識文件。新增內容或匯入 .md 開始。"})]}),e.jsx("main",{"data-loc":"client/src/pages/console/Knowledge.tsx:281",className:"glass-panel min-w-0 rounded-[1.35rem] p-4 sm:p-6",children:t||p?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:284",className:"grid gap-4 md:grid-cols-[1fr_11rem]",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:285",className:"space-y-2",children:[e.jsx(R,{"data-loc":"client/src/pages/console/Knowledge.tsx:285",htmlFor:"doc-title",className:"text-xs text-slate-500",children:"文件名稱"}),e.jsx(J,{"data-loc":"client/src/pages/console/Knowledge.tsx:285",id:"doc-title",value:h,onChange:s=>f(s.target.value),className:"h-11 border-slate-200 bg-white"})]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:286",className:"space-y-2",children:[e.jsx(R,{"data-loc":"client/src/pages/console/Knowledge.tsx:286",className:"text-xs text-slate-500",children:"類型"}),e.jsxs(me,{"data-loc":"client/src/pages/console/Knowledge.tsx:286",value:I,onValueChange:s=>C(s),children:[e.jsx(pe,{"data-loc":"client/src/pages/console/Knowledge.tsx:286",className:"h-11 border-slate-200 bg-white",children:e.jsx(he,{"data-loc":"client/src/pages/console/Knowledge.tsx:286"})}),e.jsx(ue,{"data-loc":"client/src/pages/console/Knowledge.tsx:286",children:Object.entries(Fe).map(([s,n])=>e.jsx(we,{"data-loc":"client/src/pages/console/Knowledge.tsx:286",value:s,children:n},s))})]})]})]}),e.jsxs(ve,{"data-loc":"client/src/pages/console/Knowledge.tsx:289",defaultValue:"edit",className:"mt-5",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:290",className:"flex flex-col gap-3 border-b border-slate-200 pb-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs(fe,{"data-loc":"client/src/pages/console/Knowledge.tsx:291",className:"h-9 rounded-xl border border-slate-200 bg-white p-1",children:[e.jsxs(ae,{"data-loc":"client/src/pages/console/Knowledge.tsx:292",value:"edit",className:"rounded-lg px-4 text-xs data-[state=active]:bg-champagne-400 data-[state=active]:font-bold data-[state=active]:text-navy-950",children:[e.jsx(Ce,{"data-loc":"client/src/pages/console/Knowledge.tsx:292",className:"mr-2 size-3.5"}),"編輯"]}),e.jsxs(ae,{"data-loc":"client/src/pages/console/Knowledge.tsx:293",value:"preview",className:"rounded-lg px-4 text-xs data-[state=active]:bg-champagne-400 data-[state=active]:font-bold data-[state=active]:text-navy-950",children:[e.jsx(ce,{"data-loc":"client/src/pages/console/Knowledge.tsx:293",className:"mr-2 size-3.5"}),"預覽"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:295",className:"flex items-center gap-2",children:[e.jsx($,{"data-loc":"client/src/pages/console/Knowledge.tsx:295",variant:"outline",className:"border-slate-200 text-[0.62rem] text-slate-600",children:i==="upload"?r||"Markdown 匯入":"線上編輯"}),p&&e.jsxs($,{"data-loc":"client/src/pages/console/Knowledge.tsx:295",variant:"outline",className:"border-slate-200 text-[0.62rem] text-slate-600",children:["v",p.currentVersion]})]})]}),e.jsx(le,{"data-loc":"client/src/pages/console/Knowledge.tsx:297",value:"edit",className:"mt-4",children:e.jsx(Ke,{"data-loc":"client/src/pages/console/Knowledge.tsx:297",value:j,onChange:s=>S(s.target.value),className:"min-h-[32rem] resize-y border-slate-200 bg-white font-mono text-xs leading-6",spellCheck:!1})}),e.jsx(le,{"data-loc":"client/src/pages/console/Knowledge.tsx:298",value:"preview",className:"mt-4",children:e.jsx(A,{"data-loc":"client/src/pages/console/Knowledge.tsx:298",className:"h-[32rem] rounded-xl border border-slate-200 bg-white",children:e.jsx("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:298",className:"prose max-w-none p-5 text-sm prose-headings:font-display prose-headings:text-navy-950 prose-a:text-champagne-700 prose-strong:text-champagne-700",children:e.jsx(Ne,{"data-loc":"client/src/pages/console/Knowledge.tsx:298",children:j||"尚無內容"})})})})]}),!t&&e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:302",className:"mt-4 space-y-2",children:[e.jsx(R,{"data-loc":"client/src/pages/console/Knowledge.tsx:302",htmlFor:"change-summary",className:"text-xs text-slate-500",children:"版本摘要(選填)"}),e.jsx(J,{"data-loc":"client/src/pages/console/Knowledge.tsx:302",id:"change-summary",value:
8B,onChange:s=>z(s.target.value),placeholder:"例如:更新退費規則與轉真人條件",className:"h-10 border-slate-200 bg-white text-sm"})]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:305",className:"mt-5 flex flex-col gap-3 border-t border-slate-200 pt-5 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:306",className:"flex items-center gap-2 text-xs text-slate-600",children:[e.jsx(Se,{"data-loc":"client/src/pages/console/Knowledge.tsx:306",className:"size-4 text-champagne-700"}),"每次儲存會建立 S3 文件與不可覆寫的版本紀錄。"]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:307",className:"flex gap-2",children:[!t&&p&&e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:309",onClick:()=>l&&U.mutate({siteId:l,documentId:p.id}),disabled:U.isPending,variant:"outline",className:"rounded-xl border-emerald-300/18 bg-emerald-300/5 text-emerald-800 hover:bg-emerald-300/10",children:[e.jsx(ze,{"data-loc":"client/src/pages/console/Knowledge.tsx:309",className:"mr-2 size-4"}),"發布文件"]}),e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:311",onClick:ie,disabled:G||h.trim().length<2||!j.trim(),className:"rounded-xl bg-champagne-400 font-bold text-navy-950 hover:bg-champagne-300",children:[G?e.jsx(Q,{"data-loc":"client/src/pages/console/Knowledge.tsx:311",className:"mr-2 size-4 animate-spin"}):e.jsx(Le,{"data-loc":"client/src/pages/console/Knowledge.tsx:311",className:"mr-2 size-4"}),t?"建立草稿":"儲存新版本"]})]})]})]}):e.jsx(be,{"data-loc":"client/src/pages/console/Knowledge.tsx:316",icon:e.jsx(Me,{"data-loc":"client/src/pages/console/Knowledge.tsx:316",className:"size-5"}),title:"建立第一份知識文件",description:"可直接編輯 Markdown,或匯入現有的規則、FAQ 與品牌設定檔。",action:e.jsx(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:316",onClick:q,className:"bg-champagne-400 font-bold text-navy-950 hover:bg-champagne-300",children:"新增文件"})})}),e.jsxs("aside",{"data-loc":"client/src/pages/console/Knowledge.tsx:320",className:"space-y-5",children:[e.jsxs("section",{"data-loc":"client/src/pages/console/Knowledge.tsx:321",className:"glass-panel rounded-[1.35rem] p-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:322",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:322",children:[e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:322",className:"text-[0.62rem] font-bold tracking-[0.15em] text-champagne-700 uppercase",children:"Version history"}),e.jsxs("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:322",className:"mt-1 text-xs text-slate-600",children:[N.length," 個版本"]})]}),e.jsx(Pe,{"data-loc":"client/src/pages/console/Knowledge.tsx:322",className:"size-4.5 text-champagne-700"})]}),e.jsx(A,{"data-loc":"client/src/pages/console/Knowledge.tsx:323",className:"mt-4 h-72 pr-2",children:e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:324",className:"space-y-2",children:[N.map(s=>e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:326",className:"rounded-xl border border-slate-200 bg-white p-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:327",className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:327",className:"text-xs font-bold text-navy-950",children:["v",s.versionNumber]}),e.jsx($,{"data-loc":"client/src/pages/console/Knowledge.tsx:327",variant:"outline",className:`border-slate-200 text-[0.58rem] ${s.state==="published"?"text-emerald-700":"text-slate-500"}`,children:s.state==="published"?"已發布":s.state==="draft"?"草稿":"封存"})]}),e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:328",className:"mt-2 line-clamp-2 text-[0.65rem] leading-5 text-slate-600",children:s.changeSummary||"未提供摘要"}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:329",className:"mt-3 flex items-center justify-between gap-2",children:[e.jsxs("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:329",className:"flex items-center gap-1 text-[0.58rem] text-slate-500",children:[e.jsx(Te,{"data-loc":"client/src/pages/console/Knowledge.tsx:329",className:"size-3"}),new Date(s.createdAt).toLocaleDateString("zh-TW")]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:329",className:"flex items-center",children:[e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:329",onClick:()=>F(s.versionNumber),size:"sm",variant:"ghost",className:"h-7 px-2 text-[0.62rem] text-slate-500 hover:text-champagne-700",children:[e.jsx(ce,{"data-loc":"client/src/pages/console/Knowledge.tsx:329",className:"mr-1 size-3"}),"差異"]}),p&&s.versionNumber!==p.currentVersion&&e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:329",onClick:()=>M(s.versionNumber),size:"sm",variant:"ghost",className:"h-7 px-2 text-[0.62rem] text-slate-500 hover:text-champagne-700",children:[e.jsx(De,{"data-loc":"client/src/pages/console/Knowledge.tsx:329",className:"mr-1 size-3"}),"回滾"]})]})]})]},s.id)),N.length===0&&e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:332",className:"py-10 text-center text-xs text-slate-500",children:"選擇文件以查看版本"})]})})]}),e.jsxs("section",{"data-loc":"client/src/pages/console/Knowledge.tsx:337",className:"glass-panel roun
8ded-[1.35rem] p-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:338",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:338",children:[e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:338",className:"text-[0.62rem] font-bold tracking-[0.15em] text-champagne-700 uppercase",children:"Releases"}),e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:338",className:"mt-1 text-xs text-slate-600",children:"整站發布紀錄"})]}),e.jsx(ne,{"data-loc":"client/src/pages/console/Knowledge.tsx:338",className:"size-4.5 text-champagne-700"})]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:339",className:"mt-4 space-y-2",children:[(_.data??[]).slice(0,4).map(s=>e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:339",className:"flex items-center justify-between rounded-lg border border-slate-200 px-3 py-2.5",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:339",children:[e.jsxs("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:339",className:"text-xs font-bold text-navy-950",children:["Release ",s.versionNumber]}),e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:339",className:"mt-1 text-[0.58rem] text-slate-600",children:new Date(s.createdAt).toLocaleString("zh-TW")})]}),e.jsx("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:339",className:"size-2 rounded-full bg-emerald-300"})]},s.id)),(_.data??[]).length===0&&e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:339",className:"rounded-lg border border-dashed border-slate-200 px-3 py-6 text-center text-[0.65rem] leading-5 text-slate-500",children:"發布文件後可建立第一個工作區 Release。"})]})]})]})]}),e.jsx(X,{"data-loc":"client/src/pages/console/Knowledge.tsx:344",open:P!==null,onOpenChange:s=>!s&&F(null),children:e.jsxs(Y,{"data-loc":"client/src/pages/console/Knowledge.tsx:345",className:"max-h-[88vh] border-champagne-400/12 bg-popover sm:max-w-4xl",children:[e.jsxs(Z,{"data-loc":"client/src/pages/console/Knowledge.tsx:346",children:[e.jsx(ee,{"data-loc":"client/src/pages/console/Knowledge.tsx:347",className:"font-display text-navy-950",children:"Markdown 版本差異"}),e.jsx(se,{"data-loc":"client/src/pages/console/Knowledge.tsx:348",children:v?`比較 v${v.from.versionNumber} → v${v.to.versionNumber}
8;逐行顯示新增與刪除內容。`:"所選版本沒有可比較的前一版本。"})]}),v?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:354",className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:355",className:"rounded-xl border border-emerald-300/12 bg-emerald-300/5 px-4 py-3",children:[e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:355",className:"text-[0.62rem] font-bold tracking-[0.12em] text-emerald-700 uppercase",children:"新增"}),e.jsxs("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:355",className:"mt-1 text-xl font-bold text-navy-950",children:["+",v.result.added]})]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:356",className:"rounded-xl border border-rose-300/12 bg-rose-300/5 px-4 py-3",children:[e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:356",className:"text-[0.62rem] font-bold tracking-[0.12em] text-rose-700 uppercase",children:"刪除"}),e.jsxs("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:356",className:"mt-1 text-xl font-bold text-navy-950",children:["−",v.result.removed]})]}),e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:357",className:"rounded-xl border border-slate-200 bg-slate-50 px-4 py-3",children:[e.jsx("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:357",className:"text-[0.62rem] font-bold tracking-[0.12em] text-slate-500 uppercase",children:"變動比例"}),e.jsxs("p",{"data-loc":"client/src/pages/console/Knowledge.tsx:357",className:"mt-1 text-xl font-bold text-navy-950",children:[v.result.changedPercent,"%"]})]})]}),e.jsx(A,{"data-loc":"client/src/pages/console/Knowledge.tsx:359",className:"h-[52vh] rounded-xl border border-slate-200 bg-white",children:e.jsx("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:360",className:"min-w-[38rem] py-2 font-mono text-[0.7rem] leading-5",children:v.result.lines.map((s,n)=>e.jsxs("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:362",className:`grid grid-cols-[2.5rem_2.5rem_1.5rem_1fr] px-3 ${s.kind==="added"?"bg-emerald-300/7 text-emerald-100":s.kind==="removed"?"bg-rose-300/7 text-rose-100":"text-slate-500"}`,children:[e.jsx("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:363",className:"select-none text-right text-slate-500",children:s.oldLine??""}),e.jsx("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:364",className:"select-none text-right text-slate-500",children:s.newLine??""}),e.jsx("span",{"data-loc":"client/src/pages/console/Knowledge.tsx:365",className:`select-none text-center ${s.kind==="added"?"text-emerald-700":s.kind==="removed"?"text-rose-700":"text-slate-500"}`,children:s.kind==="added"?"+":s.kind==="removed"?"−":""}),e.jsx("pre",{"data-loc":"client/src/pages/console/Knowledge.tsx:366",className:"overflow-visible whitespace-pre-wrap break-words pl-2",children:s.content||" "})]},`${s.kind}-${n}`))})})]}):e.jsx("div",{"data-loc":"client/src/pages/console/Knowledge.tsx:373",className:"rounded-xl border border-dashed border-slate-200 px-5 py-12 text-center text-sm text-slate-600",children:"建立第二個版本後即可檢視差異。"}),e.jsx(te,{"data-loc":"client/src/pages/console/Knowledge.tsx:375",children:e.jsx(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:375",variant:"outline",onClick:()=>F(null),className:"border-slate-200",children:"關閉"})})]})}),e.jsx(X,{"data-loc":"client/src/pages/console/Knowledge.tsx:379",open:L!==null,onOpenChange:s=>!s&&M(null),children:e.jsxs(Y,{"data-loc":"client/src/pages/console/Knowledge.tsx:380",className:"border-champagne-400/12 bg-popover sm:max-w-md",children:[e.jsxs(Z,{"data-loc":"client/src/pages/console/Knowledge.tsx:381",children:[e.jsxs(ee,{"data-loc":"client/src/pages/console/Knowledge.tsx:381",className:"font-display text-navy-950",children:["回滾至 v",L]}),e.jsx(se,{"data-loc":"client/src/pages/console/Knowledge.tsx:381",children:"系統不會刪除目前版本,而是以所選內容建立新的草稿版本,保留完整歷史。"})]}),e.jsxs(te,{"data-loc":"client/src/pages/console/Knowledge.tsx:382",children:[e.jsx(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:382",variant:"outline",onClick:()=>M(null),className:"border-slate-200",children:"取消"}),e.jsxs(x,{"data-loc":"client/src/pages/console/Knowledge.tsx:382",onClick:()=>l&&o&&L&&E.mutate({siteId:l,documentId:o,versionNumber:L}),disabled:E.isPending,className:"bg-champagne-400 font-bold text-navy-950 hover:bg-champagne-300",children:[E.isPending&&e.jsx(Q,{"data-loc":"client/src/pages/console/Knowledge.tsx:382",className:"mr-2 size-4 animate-spin"}),"建立回滾草稿"]})]})]})})]})}export{Oe as default};

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.