import{c as L,d as oe,f as Q,r as z,j as e,B as E,ae as re,H as O,S as G,aa as Y,P as ee,a6 as ce,ac as U,I as H,T as de,ad as me,v as xe}from"./index-CshikkKk.js";import{C as Z,a as X,b as J}from"./card-D52MYnXt.js";/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pe=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ue=L("ArrowDown",pe);/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const he=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],fe=L("ArrowUp",he);/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ge=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ye=L("ChevronRight",ge);/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const be=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],ke=L("GripVertical",be);/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const je=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],ve=L("PanelRightClose",je);/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ne=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],we=L("PanelRightOpen",Ne);/**
* @license lucide-react v0.475.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ce=[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]],Se=L("Printer",Ce),F=[{key:"info",defaultTitle:"基本信息",kind:"info",fixed:!0},{key:"education",defaultTitle:"教育经历",kind:"edu",fixed:!0},{key:"skills",defaultTitle:"核心技能",kind:"text"},{key:"projects",defaultTitle:"项目经历",kind:"list",types:["竞赛","科研","实习实践"]},{key:"certs",defaultTitle:"证书与荣誉",kind:"list",types:["荣誉惩处","证书技能"]},{key:"campus",defaultTitle:"在校经历",kind:"list",types:["学生工作","志愿公益"]},{key:"activity",defaultTitle:"文体活动",kind:"list",types:["文体活动"]},{key:"other",defaultTitle:"其他经历",kind:"list"},{key:"self",defaultTitle:"自我评价",kind:"text",fixed:!0}],D={skills:{text:`程序设计:熟悉 Python 与 C/C++,掌握常用数据结构与算法,能独立完成中小型工具与脚本开发。
网络安全:熟悉常见 Web 漏洞原理(SQL 注入、XSS、CSRF 等)与防护方案,掌握 Burp Suite、Nmap、Wireshark 等常用工具。
网络基础:熟悉 TCP/IP 协议栈与交换路由基础配置,理解 VLAN、NAT、ACL 等核心技术。
运维基础:熟悉 Linux 常用操作与 Shell 脚本,了解 Docker 容器化部署与 Nginx 服务配置。`},campus:{items:[{title:"校图书馆学生助理",subtitle:"读者服务岗",date:"2024.9 - 2025.6",desc:"负责书库整理与借阅服务,协助开展入馆培训与阅读推广活动,累计服务读者千余人次。培养了责任意识与服务意识,锻炼了多任务时间管理能力。"},{title:"院学生会宣传部干事",subtitle:"平面设计与文案",date:"2023.9 - 2024.6",desc:"参与学院活动的海报设计与推文撰写,负责活动现场的后勤与设备保障。锻炼了审美表达、协作沟通与临场应变能力。"}]},self:{text:"性格沉稳踏实,做事有计划性,习惯提前预判风险并准备预案;学习能力强,能快速上手新技术与工具;责任心强,注重细节与条理,凡事有始有终,能独立推进任务并在压力下保持稳定输出。"}};function W(){return{version:2,template:"tech",accent:"#3056d3",fontScale:1,density:"normal",onePage:!1,sections:F.map(a=>({key:a.key,title:a.defaultTitle,enabled:!0,kind:a.kind,types:a.types,...a.key==="skills"?{text:D.skills.text}:{},...a.key==="campus"?{items:D.campus.items}:{},...a.key==="self"?{text:D.self.text}:{}}))}}function te(a){const g=W();if(!a||typeof a!="object")return g;const u=a,j=Array.isArray(u.sections)?u.sections:[],r=g.sections.map(n=>{var v;const h=j.find(c=>c.key===n.key),l=F.find(c=>c.key===n.key),N={...n,enabled:(h==null?void 0:h.enabled)??!0,title:(h==null?void 0:h.title)??(l==null?void 0:l.defaultTitle)??n.title};return n.key==="skills"&&!N.text&&(N.text=D.skills.text),n.key==="campus"&&!((v=N.items)!=null&&v.length)&&(N.items=D.campus.items),n.key==="self"&&!N.text&&(N.text=D.self.text),N});for(const n of j)r.some(h=>h.key===n.key)||r.push({key:n.key,title:n.title||n.key,enabled:n.enabled??!0,kind:"text",text:""});return{version:2,template:u.template??"tech",accent:u.accent??"#3056d3",fontScale:Math.min(1.2,Math.max(.8,u.fontScale??1)),density:u.density??"normal",onePage:u.onePage??!1,sections:r}}function _e(){return F.filter(a=>a.types).flatMap(a=>a.types)}function ze(a){const g=[a.organizer,a.level,a.award_grade].filter(j=>j!=null&&j!=="").map(String).join(" · "),u=[a.result,a.description].filter(j=>j!=null&&j!=="").map(String).join(" — ");return{title:a.title,subtitle:g||void 0,date:a.start_date??a.created_at.slice(0,10),desc:u||void 0,fromRecord:a.id}}function se(a,g){const u=[],j=_e();for(const r of g.sections){if(!r.enabled)continue;const n=F.find(c=>c.key===r.key);if(r.key==="info"){u.push({key:r.key,title:r.title,kind:"info"});continue}if(r.key==="self"||r.kind==="text"){u.push({key:r.key,title:r.title,kind:"text",text:r.text??""});continue}const h=new Set(r.excluded??[]);let l=[];const N=n==null?void 0:n.types;N?l=a.filter(c=>N.includes(c.type_name)&&c.status!=="draft"&&!h.has(c.id)):l=a.filter(c=>c.status!=="draft"&&!h.has(c.id)&&!j.includes(c.type_name));const v=l.map(ze).filter(c=>!c.fromRecord||!h.has(c.fromRecord)).map(c=>{var S;return{...c,...((S=r.overrides)==null?void 0:S[String(c.fromRecord)])??{}}});for(const c of r.items??[])v.push({...c});v.sort((c,S)=>(S.date??"").localeCompare(c.date??"")),v.length&&u.push({key:r.key,title:r.title,kind:"list",items:v})}return u}const ne=[{key:"tech",name:"互联网技术风",desc:"品牌色标题 + 左侧色条,紧凑现代"},{key:"minimal",name:"极简风",desc:"灰色大写字距标题,大量留白"},{key:"classic",name:"经典风",desc:"黑色衬线标题 + 通栏分隔线,正式通用"}],ie=["#3056d3","#0f766e","#7c3aed","#c2410c","#0e7490","#1f2937"],w=a=>String(a??"").replace(/&/g,"&").replace(//g,">");function Pe(a,g,u,j){const r=u.fontScale,n=p=>(p*r).toFixed(1)+"pt",h=u.accent,l=g,N={classic:"font-size:"+n(14)+";color:#111;border-bottom:1.5pt solid #333;padding-bottom:3pt;margin:14pt 0 7pt",tech:"font-size:"+n(14)+";color:"+h+";border-bottom:1pt solid "+h+";padding-bottom:3pt;margin:14pt 0 7pt",minimal:"font-size:"+n(11.5)+";color:#555;letter-spacing:1.5pt;text-transform:uppercase;border-bottom:0.75pt solid #e0e0e0;padding-bottom:3pt;margin:14pt 0 7pt"},v=u.template==="tech"?h:"#111",c=[l.school,l.college,l.major,l.degree].filter(p=>p!=="").map(p=>w(p)).join(" · "),S=[l.phone,l.email,l.homepage].filter(p=>p!=="").map(p=>w(p)).join(" · "),d=j&&l.photoUrl?'
+') | ':"",k=''+w(l.name||"个人简历")+" "+(c?''+c+" ":"")+(S?''+S+" ":"")+" | "+d+"
",P=p=>'| '+w(p.title)+' | '+w(p.date??"")+" |
"+(p.subtitle?''+w(p.subtitle)+"
":"")+(p.desc?''+w(p.desc)+"
":""),o=a.map(p=>{let i="";if(p.kind==="edu"){const M=[["学校",l.school??""],["专业",l.major??""],["学制",l.eduLength??""],["学历",l.degree??""],["入学",l.eduStart??""],["毕业",l.eduEnd??""]].filter(C=>C[1]!=="");i=''+M.map(C=>'| '+w(C[0])+' | '+w(C[1])+" |
").join("")+"
"+(l.majorCourses?'主修课程:'+w(l.majorCourses)+"
":"")}else if(p.kind==="info"){const M=[["姓名",l.name??""],["性别",l.gender??""],["出生年月",l.birth??""],["民族",l.nation??""],["籍贯",l.native??""],["政治面貌",l.political??""],["班级",l.className??""],["学号",l.studentId??""],["学历",l.degree??""],["手机",l.phone??""],["邮箱",l.email??""]].filter(C=>C[1]!=="");i=''+M.map((C,I)=>(I%2===0?"":"")+'| '+w(C[0])+' | '+w(C[1])+" | "+(I%2===1?"
":"")).join("")+"
"}else p.kind==="list"?i=""+(p.items??[]).map(P).join("")+"
":i=''+w(p.text??"").replace(/\n/g,"
")+"
";return''+w(p.title)+"
"+i}).join("");return''+w(l.name||"个人简历")+''+k+o+""}const Re=Object.freeze(Object.defineProperty({__proto__:null,ACCENT_CHOICES:ie,RESUME_SECTION_DEFS:F,TEMPLATES:ne,assembleSections:se,defaultResumeConfig:W,migrateResumeConfig:te,resumeToWordHtml:Pe},Symbol.toStringTag,{value:"Module"}));function T({html:a,onCommit:g,className:u}){const j=a.replace(/&/g,"&").replace(//g,">");return e.jsx("span",{contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,className:"outline-none rounded-sm transition-shadow focus:shadow-[0_0_0_1.5px_rgba(48,86,211,0.5)] cursor-text "+(u??""),dangerouslySetInnerHTML:{__html:j},onBlur:r=>{const n=(r.currentTarget.textContent??"").trim();n!==a&&g(n)}})}function Me(){var V,q,$;const a=oe(),g=Q({queryKey:["profile"],queryFn:me}),u=Q({queryKey:["resume-records"],queryFn:()=>xe({page:1,page_size:500})}),[j,r]=z.useState(null),[n,h]=z.useState(""),[l,N]=z.useState(!0),[v,c]=z.useState(new Set),[S,d]=z.useState(1),k=z.useRef(null),P=z.useRef(null);z.useEffect(()=>{var m,s;const t=(m=g.data)==null?void 0:m.content;t&&(r(te(t.resume)),h(((s=t.info)==null?void 0:s.selfIntro)??""))},[g.data]);const o={...((q=(V=g.data)==null?void 0:V.content)==null?void 0:q.info)??{}},p=(($=u.data)==null?void 0:$.items)??[],i=j??W(),M={...o,selfIntro:n},C=z.useMemo(()=>se(p,i),[p,i]),I=(t,m)=>r(s=>{if(!s)return s;const f=[...s.sections],b=t+m;return b<0||b>=f.length?s:([f[t],f[b]]=[f[b],f[t]],{...s,sections:f})}),_=t=>{r(t),U({info:{...o,selfIntro:n},resume:t}).catch(m=>a("error",m.message))},A=t=>{r(m=>{const s=m??i,f=s.sections.map(x=>{var y;if(x.key!==t.secKey)return x;if(t.field==="text")return{...x,text:t.value};if(t.fromRecord!=null){const R={...((y=x.overrides)==null?void 0:y[t.fromRecord])??{},[t.field]:t.value};return{...x,overrides:{...x.overrides??{},[t.fromRecord]:R}}}if(t.itemIdx!=null&&x.items){const R=[...x.items];return R[t.itemIdx]={...R[t.itemIdx],[t.field]:t.value},{...x,items:R}}return x}),b={...s,sections:f};return U({info:{...o,selfIntro:n},resume:b}).catch(x=>a("error",x.message)),b})},K=(t,m)=>{U({info:{...M,[t]:m}}).then(()=>g.refetch()).catch(s=>a("error",s.message))};z.useEffect(()=>{if(!i.onePage){d(1);return}const t=k.current;if(!t)return;const m=1043,s=t.scrollHeight;d(s>m?Math.max(.7,m/s):1)},[i.onePage,i.fontScale,i.density,C]);const B=i.fontScale*(i.onePage?S:1),le=()=>{ce(()=>Promise.resolve().then(()=>Re),void 0).then(function(t){const m=t.resumeToWordHtml(C,M,i,o.photoUrl),s=new Blob(["\uFEFF"+m],{type:"application/msword"}),f=URL.createObjectURL(s),b=document.createElement("a");b.href=f,b.download=(o.name||"个人简历")+".doc",b.click(),setTimeout(()=>URL.revokeObjectURL(f),6e4),a("success","Word 文档已导出")})},ae=t=>{var m,s;return((s=(m=F.find(f=>f.key===t))==null?void 0:m.types)==null?void 0:s.join(" / "))??"固定板块"};return e.jsxs("div",{className:"mx-auto max-w-[1280px] px-3 py-4 sm:px-6 sm:py-5",children:[e.jsxs("div",{className:"no-print mb-4 flex flex-wrap items-center justify-between gap-2",children:[e.jsx("h2",{className:"text-[15px] font-semibold text-ink-1",children:"我的简历"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(E,{variant:"secondary",onClick:()=>N(t=>!t),children:[l?e.jsx(ve,{size:13}):e.jsx(we,{size:13}),l?"收起设置":"展开设置"]}),e.jsxs(E,{variant:"secondary",onClick:le,children:[e.jsx(re,{size:13})," 导出 Word"]}),e.jsxs(E,{variant:"primary",onClick:()=>window.print(),children:[e.jsx(Se,{size:13})," 打印 / PDF"]})]})]}),e.jsxs("div",{className:"grid gap-4 "+(l?"lg:grid-cols-[1fr_340px]":"grid-cols-1"),children:[e.jsxs("div",{children:[e.jsx("div",{className:"print-sheet mx-auto w-full max-w-[794px] rounded-lg border border-line bg-white shadow-card",style:{minHeight:i.onePage?1123:void 0},children:e.jsxs("div",{ref:k,className:"p-8 sm:p-10 resume-tpl-"+i.template,style:{zoom:B,"--accent":i.accent},children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-[26px] font-bold leading-tight "+(i.template==="tech"?"text-[var(--accent)]":"text-neutral-900"),children:o.name||"姓名"}),e.jsx("div",{className:"mt-1.5 text-[12.5px] text-neutral-500",children:[o.school,o.college,o.major,o.degree].filter(Boolean).join(" · ")||"完善个人信息后自动展示"}),e.jsx("div",{className:"mt-1 text-[12px] text-neutral-500",children:[o.phone,o.email,o.homepage].filter(Boolean).join(" · ")})]}),o.photoUrl&&e.jsx("img",{src:o.photoUrl,alt:"证件照",className:"h-[110px] w-[82px] rounded border border-neutral-200 object-cover"})]}),C.map(t=>{var m;return e.jsxs("div",{className:"mb-5 r-sec",children:[e.jsx("div",{className:"r-sec-title mb-2.5 text-[14px] font-bold text-neutral-900",children:e.jsx(T,{html:t.title,onCommit:s=>A({secKey:t.key,field:"title",value:s})})}),t.kind==="edu"?e.jsxs("div",{children:[e.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1 text-[12.5px]",children:[["学校",o.school,"school"],["专业",o.major,"major"],["学制",o.eduLength,"eduLength"],["学历",o.degree,"degree"],["入学",o.eduStart,"eduStart"],["毕业",o.eduEnd,"eduEnd"]].filter(s=>s[1]).map(s=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:s[0]}),e.jsx(T,{html:s[1]??"",onCommit:f=>K(s[2],f)})]},s[0]))}),o.majorCourses&&e.jsxs("p",{className:"mt-2.5 text-[12.5px] leading-relaxed text-neutral-700",children:[e.jsx("b",{children:"主修课程:"}),e.jsx(T,{html:o.majorCourses,onCommit:s=>K("majorCourses",s)})]})]}):t.kind==="info"?e.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1 text-[12.5px]",children:[["姓名",o.name],["性别",o.gender],["出生年月",o.birth],["民族",o.nation],["籍贯",o.native],["政治面貌",o.political],["班级",o.className],["学号",o.studentId],["手机",o.phone],["邮箱",o.email]].filter(s=>s[1]).map(s=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:s[0]}),e.jsx("span",{children:s[1]})]},s[0]))}):t.kind==="text"?e.jsx("p",{className:"whitespace-pre-wrap text-neutral-700 "+(i.density==="compact"?"":"leading-relaxed"),children:e.jsx(T,{html:t.text??"",onCommit:s=>A({secKey:t.key,field:"text",value:s})})}):e.jsx("div",{className:i.density==="compact"?"flex flex-col gap-1.5":"flex flex-col gap-3",children:(m=t.items)==null?void 0:m.map((s,f)=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"text-[13px] font-semibold text-neutral-900 r-item-title",children:e.jsx(T,{html:s.title,onCommit:b=>A({secKey:t.key,field:"title",value:b,itemIdx:f,fromRecord:s.fromRecord})})}),e.jsx("span",{className:"num shrink-0 text-[11.5px] text-neutral-500",children:e.jsx(T,{html:s.date??"",onCommit:b=>A({secKey:t.key,field:"date",value:b,itemIdx:f,fromRecord:s.fromRecord})})})]}),s.subtitle&&e.jsx("div",{className:"text-[12px] text-neutral-600",children:s.subtitle}),s.desc&&e.jsx("p",{className:"text-[12px] text-neutral-500 "+(i.density==="compact"?"":"mt-0.5"),children:e.jsx(T,{html:s.desc,onCommit:b=>A({secKey:t.key,field:"desc",value:b,itemIdx:f,fromRecord:s.fromRecord})})})]},(s.title??"")+(s.date??"")+f))})]},t.key)})]})}),i.onePage&&e.jsxs("div",{className:"no-print mt-2 text-center text-[11.5px] text-ink-3",children:["一页限定已启用:内容自动缩放 ",Math.round(B*100),"% 以适配单页 A4"]})]}),l&&e.jsxs("div",{className:"no-print flex flex-col gap-4 lg:sticky lg:top-4 lg:max-h-[calc(100vh-2rem)] lg:self-start lg:overflow-y-auto lg:pr-1",children:[e.jsxs(Z,{children:[e.jsx(X,{title:"模板与风格"}),e.jsxs(J,{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2",children:ne.map(t=>e.jsxs("button",{className:"rounded-md border px-3 py-2 text-left transition-all "+(i.template===t.key?"border-brand bg-brand-subtle":"border-line bg-surface hover:border-line-strong"),onClick:()=>_({...i,template:t.key}),children:[e.jsx("div",{className:"text-[12.5px] font-semibold "+(i.template===t.key?"text-brand-text":"text-ink-1"),children:t.name}),e.jsx("div",{className:"text-[11px] text-ink-3",children:t.desc})]},t.key))}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(O,{label:"主题色",children:e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:ie.map(t=>e.jsx("button",{"aria-label":"主题色 "+t,className:"size-5 rounded-full border-2 transition-transform "+(i.accent===t?"scale-110 border-ink-1":"border-transparent"),style:{backgroundColor:t},onClick:()=>_({...i,accent:t})},t))})}),e.jsx(O,{label:"字号",children:e.jsx(G,{value:String(i.fontScale),onChange:t=>_({...i,fontScale:Number(t.target.value)}),options:[{value:"0.9",label:"小"},{value:"1",label:"标准"},{value:"1.1",label:"大"}]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(O,{label:"间距",children:e.jsx(G,{value:i.density,onChange:t=>_({...i,density:t.target.value}),options:[{value:"compact",label:"紧凑"},{value:"normal",label:"标准"},{value:"relaxed",label:"宽松"}]})}),e.jsx(O,{label:"单页限定",children:e.jsx("button",{className:"flex h-9 w-full items-center justify-center gap-1.5 rounded-md border text-[12px] transition-colors "+(i.onePage?"border-brand bg-brand-subtle text-brand-text":"border-line bg-surface text-ink-2"),onClick:()=>_({...i,onePage:!i.onePage}),children:i.onePage?"已开启":"已关闭"})})]})]})]}),e.jsxs(Z,{children:[e.jsx(X,{title:"板块布局",extra:e.jsx("span",{className:"text-[11px] text-ink-3",children:"拖动排序 · 点击预览可改内容"})}),e.jsx(J,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col divide-y divide-line",children:[i.sections.map((t,m)=>{var b;const s=v.has(t.key),f=t.kind==="info"?"固定":t.kind==="text"?"文本":t.kind==="edu"?"教育":"记录";return e.jsxs("div",{draggable:!0,onDragStart:()=>{P.current=t.key},onDragOver:x=>x.preventDefault(),onDrop:()=>{const x=i.sections.findIndex(y=>y.key===P.current);if(x>=0&&x!==m){const y=[...i.sections],R=y.splice(x,1)[0];y.splice(m,0,R),_({...i,sections:y})}P.current=null},className:"bg-surface "+(P.current===t.key?"opacity-40":""),children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-2",children:[e.jsx(ke,{size:13,className:"shrink-0 cursor-grab text-ink-3"}),e.jsx("input",{className:"min-w-0 flex-1 rounded-sm border border-transparent bg-transparent px-1 py-0.5 text-[12.5px] font-medium text-ink-1 hover:border-line focus:border-brand focus:outline-none",value:t.title,onChange:x=>_({...i,sections:i.sections.map(y=>y.key===t.key?{...y,title:x.target.value}:y)})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"上移",disabled:m===0,onClick:()=>I(m,-1),children:e.jsx(fe,{size:12})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"下移",disabled:m===i.sections.length-1,onClick:()=>I(m,1),children:e.jsx(ue,{size:12})}),e.jsx("button",{className:"ml-0.5 rounded-sm border px-1.5 py-0.5 text-[11px] transition-colors "+(t.enabled?"border-brand/40 bg-brand-subtle text-brand-text":"border-line bg-surface-2 text-ink-3"),onClick:()=>_({...i,sections:i.sections.map(x=>x.key===t.key?{...x,enabled:!x.enabled}:x)}),children:t.enabled?"显示":"隐藏"}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1","aria-label":"展开编辑",onClick:()=>c(x=>{const y=new Set(x);return y.has(t.key)?y.delete(t.key):y.add(t.key),y}),children:e.jsx(ye,{size:13,className:"transition-transform "+(s?"rotate-90":"")})})]}),s&&e.jsx("div",{className:"border-t border-line bg-surface-2 px-3 py-2.5",children:t.kind==="text"?e.jsx(Y,{rows:4,value:t.text??"",placeholder:"输入该板块内容…",onChange:x=>_({...i,sections:i.sections.map(y=>y.key===t.key?{...y,text:x.target.value}:y)})}):t.kind==="list"?e.jsx(Te,{cfg:i,section:t,records:p,persist:_,sectionTypes:ae(t.key)}):e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"该板块内容来自「个人信息」页与记录数据。"})}),e.jsxs("div",{className:"px-3 pb-1.5 text-[10.5px] text-ink-3",children:[f,(b=t.types)!=null&&b.length?" · "+t.types.join("/"):""]})]},t.key)}),e.jsx("div",{className:"p-3",children:e.jsxs(E,{size:"sm",variant:"secondary",className:"w-full",onClick:()=>{const t="custom_"+Date.now();_({...i,sections:[...i.sections,{key:t,title:"自定义板块",enabled:!0,kind:"text",text:""}]}),c(m=>new Set(m).add(t))},children:[e.jsx(ee,{size:13})," 新增文本板块"]})})]})})]})]})]})]})}function Te({cfg:a,section:g,records:u,persist:j,sectionTypes:r}){const[n,h]=z.useState(null),l=new Set(g.excluded??[]),N=u.filter(d=>(g.types??[]).includes(d.type_name)&&d.status!=="draft").sort((d,k)=>(k.start_date??k.created_at).localeCompare(d.start_date??d.created_at)),v=g.items??[],c=d=>j({...a,sections:a.sections.map(k=>k.key===g.key?{...k,...d}:k)}),S=d=>{const k=new Set(g.excluded??[]);k.has(d)?k.delete(d):k.add(d),c({excluded:[...k]})};return e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"text-[11px] text-ink-3",children:"来自记录的条目(勾选 = 显示)· 另可添加自定义条目"}),N.map(d=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5",checked:!l.has(d.id),onChange:()=>S(d.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:d.title}),e.jsx("span",{className:"num shrink-0 text-[11px] text-ink-3",children:(d.start_date??"").slice(0,7)})]},d.id)),e.jsxs("div",{className:"mt-1 border-t border-line pt-2",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11.5px] font-medium text-ink-2",children:["自定义条目(",v.length,")"]}),e.jsxs(E,{size:"sm",variant:"ghost",onClick:()=>h({title:""}),children:[e.jsx(ee,{size:12})," 添加"]})]}),n&&e.jsxs("div",{className:"mb-2 rounded-md border border-line bg-surface p-2",children:[e.jsx(H,{className:"mb-1.5",placeholder:"标题",value:n.title,onChange:d=>h({...n,title:d.target.value})}),e.jsxs("div",{className:"mb-1.5 grid grid-cols-2 gap-1.5",children:[e.jsx(H,{placeholder:"副标题(单位/角色)",value:n.subtitle??"",onChange:d=>h({...n,subtitle:d.target.value})}),e.jsx(H,{placeholder:"日期(2025.9)",value:n.date??"",onChange:d=>h({...n,date:d.target.value})})]}),e.jsx(Y,{rows:2,placeholder:"描述:做了什么、负责什么、学会什么",value:n.desc??"",onChange:d=>h({...n,desc:d.target.value})}),e.jsxs("div",{className:"mt-1.5 flex gap-1.5",children:[e.jsx(E,{size:"sm",variant:"primary",disabled:!n.title.trim(),onClick:()=>{n.title.trim()&&(c({items:[...v,n]}),h(null))},children:"添加"}),e.jsx(E,{size:"sm",variant:"ghost",onClick:()=>h(null),children:"取消"})]})]}),v.map((d,k)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-line bg-surface p-1.5 text-[12px]",children:[e.jsxs("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:[d.title,e.jsxs("span",{className:"text-ink-3",children:[" · ",d.date??""]})]}),e.jsx("button",{className:"text-ink-3 hover:text-danger","aria-label":"删除条目",onClick:()=>c({items:v.filter((P,o)=>o!==k)}),children:e.jsx(de,{size:12})})]},k)),!v.length&&!n&&e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"暂无自定义条目"})]}),e.jsxs("p",{className:"text-[11px] text-ink-3",children:["「",r,"」相关条目来自你的记录数据,此处可隐藏不需要展示的条目;描述可在预览中点击直接修改。"]})]})}export{Me as ResumePage};