import{c as L,d as Ne,f as se,r as T,j as e,B as P,ag as we,ae as K,H as U,S as ne,ac as de,P as $,F as Ce,a8 as Se,T as ie,I as V,af as _e,v as ze}from"./index-AIpE8C-f.js";import{C as ae,a as le,b as re}from"./card-DRk0nwkp.js";import{R as Re}from"./refresh-cw-DydAoMbT.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"}]],me=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 Ee=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],xe=L("ArrowUp",Ee);/** * @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 Te=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Oe=L("ChevronRight",Te);/** * @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 Fe=[["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"}]],Ie=L("GripVertical",Fe);/** * @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 Le=[["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"}]],Me=L("PanelRightClose",Le);/** * @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 De=[["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"}]],Ae=L("PanelRightOpen",De);/** * @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 Ke=[["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"}]],Ue=L("Printer",Ke);/** * @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=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],oe=L("RotateCcw",Be),A=[{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 q(){return{version:2,template:"tech",accent:"#3056d3",fontScale:1,density:"normal",onePage:!1,sections:A.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 W(a){const f=q();if(!a||typeof a!="object")return f;const h=a,w=Array.isArray(h.sections)?h.sections:[],y=f.sections.map(l=>{var C;const i=w.find(R=>R.key===l.key),_=A.find(R=>R.key===l.key),j={...l,...i??{},enabled:(i==null?void 0:i.enabled)??!0,title:(i==null?void 0:i.title)??(_==null?void 0:_.defaultTitle)??l.title,kind:_?l.kind:(i==null?void 0:i.kind)??l.kind,types:(_==null?void 0:_.types)??(i==null?void 0:i.types)};return l.key==="skills"&&j.text==null&&(j.text=D.skills.text),l.key==="campus"&&!((C=j.items)!=null&&C.length)&&(j.items=D.campus.items),l.key==="self"&&j.text==null&&(j.text=D.self.text),j}),c=new Set(["awards","competition","practice","research"]);for(const l of w)c.has(l.key)||y.some(i=>i.key===l.key)||y.push({key:l.key,title:l.title||l.key,enabled:l.enabled??!0,kind:"text",text:""});return{version:2,template:h.template??"tech",accent:h.accent??"#3056d3",fontScale:Math.min(1.2,Math.max(.8,h.fontScale??1)),density:h.density??"normal",onePage:h.onePage??!1,sections:y}}function He(){return A.filter(a=>a.types).flatMap(a=>a.types)}function We(a){const f=[a.organizer,a.level,a.award_grade].filter(w=>w!=null&&w!=="").map(String).join(" · "),h=[a.result,a.description].filter(w=>w!=null&&w!=="").map(String).join(" — ");return{title:a.title,subtitle:f||void 0,date:a.start_date??a.created_at.slice(0,10),desc:h||void 0,fromRecord:a.id}}function pe(a,f){var c;const h=[],w=He(),y=new Set;for(const l of f.sections){if(!l.enabled)continue;const i=A.find(m=>m.key===l.key);if(l.key==="info"){h.push({key:l.key,title:l.title,kind:"info",hiddenFields:l.hiddenFields??[]});continue}if(l.key==="self"||l.kind==="text"){const m=l.text??"";if(!m.trim())continue;h.push({key:l.key,title:l.title,kind:"text",text:m});continue}const _=new Set(l.excluded??[]);let j=[];const C=i==null?void 0:i.types;C?j=a.filter(m=>C.includes(m.type_name)&&m.status!=="draft"&&!_.has(m.id)&&!y.has(m.id)):j=a.filter(m=>m.status!=="draft"&&!_.has(m.id)&&!y.has(m.id)&&!w.includes(m.type_name));const R=new Map((l.itemOrder??[]).map((m,v)=>[m,v])),k=[];for(const m of j){const v={itemKey:"r"+m.id,...We(m),...((c=l.overrides)==null?void 0:c[String(m.id)])??{}};k.push({...v,_ord:R.get(v.itemKey)??9999}),y.add(m.id)}for(const m of l.items??[]){const v=m.id??"c"+(l.items??[]).indexOf(m);k.push({itemKey:v,...m,_ord:R.get(v)??9999})}k.sort((m,v)=>m._ord-v._ord||(v.date??"").localeCompare(m.date??"")),k.length&&h.push({key:l.key,title:l.title,kind:"list",items:k.map(m=>{const{_ord:v,...d}=m;return d})})}return h}const he=[{key:"tech",name:"互联网技术风",desc:"品牌色标题 + 左侧色条,紧凑现代"},{key:"minimal",name:"极简风",desc:"灰色大写字距标题,大量留白"},{key:"classic",name:"经典风",desc:"黑色衬线标题 + 通栏分隔线,正式通用"}],ue=["#3056d3","#0f766e","#7c3aed","#c2410c","#0e7490","#1f2937"],z=a=>String(a??"").replace(/&/g,"&").replace(//g,">");function qe(a,f,h,w){var F,s,x;const y=h.fontScale,c=o=>(o*y).toFixed(1)+"pt",l=h.accent,i=f,_={classic:"font-size:"+c(14)+";color:#111;border-bottom:1.5pt solid #333;padding-bottom:3pt;margin:14pt 0 7pt",tech:"font-size:"+c(14)+";color:"+l+";border-bottom:1pt solid "+l+";padding-bottom:3pt;margin:14pt 0 7pt",minimal:"font-size:"+c(11.5)+";color:#555;letter-spacing:1.5pt;text-transform:uppercase;border-bottom:0.75pt solid #e0e0e0;padding-bottom:3pt;margin:14pt 0 7pt"},j=h.template==="tech"?l:"#111",C=[i.school,i.college,i.major,i.degree].filter(o=>o!=="").map(o=>z(o)).join(" · "),R=[i.phone,i.email,i.homepage].filter(o=>o!=="").map(o=>z(o)).join(" · "),k=(((F=h.header)==null?void 0:F.showPhoto)??!0)&&w&&i.photoUrl?'证件照':"",m='"+k+"
'+z(i.name||"个人简历")+"
"+((((s=h.header)==null?void 0:s.showSchool)??!0)&&C?'
'+C+"
":"")+((((x=h.header)==null?void 0:x.showContact)??!0)&&R?'
'+R+"
":"")+"
",v=o=>'
'+z(o.title)+''+z(o.date??"")+"
"+(o.subtitle?'
'+z(o.subtitle)+"
":"")+(o.desc?'
'+z(o.desc)+"
":""),d=a.map(o=>{let S="";if(o.kind==="edu"){const M=[["学校",i.school??""],["专业",i.major??""],["学制",i.eduLength??""],["学历",i.degree??""],["入学",i.eduStart??""],["毕业",i.eduEnd??""]].filter(b=>b[1]!=="");S=''+M.map(b=>'").join("")+"
'+z(b[0])+''+z(b[1])+"
"+(i.majorCourses?'
主修课程:'+z(i.majorCourses)+"
":"")}else if(o.kind==="info"){const M=[["name","姓名",i.name??""],["gender","性别",i.gender??""],["birth","出生年月",i.birth??""],["nation","民族",i.nation??""],["native","籍贯",i.native??""],["political","政治面貌",i.political??""],["className","班级",i.className??""],["studentId","学号",i.studentId??""],["degree","学历",i.degree??""],["phone","手机",i.phone??""],["email","邮箱",i.email??""]].filter(b=>b[2]!==""&&!(o.hiddenFields??[]).includes(b[0]));S=''+M.map((b,I)=>(I%2===0?"":"")+'"+(I%2===1?"":"")).join("")+"
'+z(b[1])+''+z(b[2])+"
"}else o.kind==="list"?S="
"+(o.items??[]).map(v).join("")+"
":S='

'+z(o.text??"").replace(/\n/g,"
")+"

";return'
'+z(o.title)+"
"+S}).join("");return''+z(i.name||"个人简历")+''+m+d+""}const Ve=Object.freeze(Object.defineProperty({__proto__:null,ACCENT_CHOICES:ue,RESUME_SECTION_DEFS:A,TEMPLATES:he,assembleSections:pe,defaultResumeConfig:q,migrateResumeConfig:W,resumeToWordHtml:qe},Symbol.toStringTag,{value:"Module"})),$e={姓名:"name",性别:"gender",出生年月:"birth",民族:"nation",籍贯:"native",政治面貌:"political",班级:"className",学号:"studentId",手机:"phone",邮箱:"email"},Ge=[["name","姓名"],["gender","性别"],["birth","出生年月"],["nation","民族"],["native","籍贯"],["political","政治面貌"],["className","班级"],["studentId","学号"],["phone","手机"],["email","邮箱"]];function ce(a){const f=/^(\d{4})-(\d{1,2})/.exec(a??"");return f?f[1]+"."+Number(f[2]):a??""}function O({html:a,onCommit:f,className:h}){const w=a.replace(/&/g,"&").replace(//g,">");return e.jsx("span",{contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!1,className:"outline-none break-words rounded-sm transition-shadow focus:shadow-[0_0_0_1.5px_rgba(48,86,211,0.5)] cursor-text "+(h??""),dangerouslySetInnerHTML:{__html:w},onBlur:y=>{const c=(y.currentTarget.textContent??"").trim();c!==a&&f(c)}})}function Xe(){var J,Y,Z,X,ee,te;const a=Ne(),f=se({queryKey:["profile"],queryFn:_e}),h=se({queryKey:["resume-records"],queryFn:()=>ze({page:1,page_size:500})}),[w,y]=T.useState(null),[c,l]=T.useState(""),[i,_]=T.useState(!0),[j,C]=T.useState(new Set),[R,k]=T.useState(1),m=T.useRef(null),v=T.useRef(null);T.useEffect(()=>{var r,n;const t=(r=f.data)==null?void 0:r.content;t&&(y(W(t.resume)),l(((n=t.info)==null?void 0:n.selfIntro)??""))},[f.data]);const d={...((Y=(J=f.data)==null?void 0:J.content)==null?void 0:Y.info)??{}},F=((Z=h.data)==null?void 0:Z.items)??[],s=w??q(),x={...d,selfIntro:c},o=[ce(d.eduStart),ce(d.eduEnd)].filter(Boolean).join("-"),S=T.useMemo(()=>pe(F,s),[F,s]),M=(t,r)=>y(n=>{if(!n)return n;const u=[...n.sections],N=t+r;return N<0||N>=u.length?n:([u[t],u[N]]=[u[N],u[t]],{...n,sections:u})}),b=t=>{y(t),K({info:{...d,selfIntro:c},resume:t}).catch(r=>a("error",r.message))},I=t=>{y(r=>{const n=r??s,u=n.sections.map(p=>{var g;if(p.key!==t.secKey)return p;if(t.field==="text")return{...p,text:t.value};if(t.fromRecord!=null){const E={...((g=p.overrides)==null?void 0:g[t.fromRecord])??{},[t.field]:t.value};return{...p,overrides:{...p.overrides??{},[t.fromRecord]:E}}}if(t.itemIdx!=null&&p.items){const E=[...p.items];return E[t.itemIdx]={...E[t.itemIdx],[t.field]:t.value},{...p,items:E}}return p}),N={...n,sections:u};return K({info:{...d,selfIntro:c},resume:N}).catch(p=>a("error",p.message)),N})},B=(t,r)=>{K({info:{...x,[t]:r}}).then(()=>f.refetch()).catch(n=>a("error",n.message))};T.useEffect(()=>{if(!s.onePage){k(1);return}const t=m.current;if(!t)return;const r=1043,n=t.scrollHeight;k(n>r?Math.max(.7,r/n):1)},[s.onePage,s.fontScale,s.density,S]);const G=s.fontScale*(s.onePage?R:1),fe=()=>{Se(()=>Promise.resolve().then(()=>Ve),void 0).then(function(t){const r=t.resumeToWordHtml(S,x,s,d.photoUrl),n=new Blob(["\uFEFF"+r],{type:"application/msword"}),u=URL.createObjectURL(n),N=document.createElement("a");N.href=u,N.download=(d.name||"个人简历")+".doc",N.click(),setTimeout(()=>URL.revokeObjectURL(u),6e4),a("success","Word 文档已导出")})},Q=t=>{const r="custom_"+Date.now();b({...s,sections:[...s.sections,t==="text"?{key:r,title:"自定义板块",enabled:!0,kind:"text",text:""}:{key:r,title:"自定义经历",enabled:!0,kind:"list",items:[]}]}),C(n=>new Set(n).add(r))},ge=t=>{var r,n;return((n=(r=A.find(u=>u.key===t))==null?void 0:r.types)==null?void 0:n.join(" / "))??"固定板块"},[ye,H]=T.useState(!1),be=()=>{const t=q();y(t),C(new Set),K({info:{...d,selfIntro:c},resume:t}).then(()=>f.refetch()).then(()=>{H(!1),a("success","简历已初始化为默认模板")}).catch(r=>a("error",r.message))},je=async()=>{var t,r;try{const[n]=await Promise.all([f.refetch(),h.refetch()]),u=(t=n.data)==null?void 0:t.content;u&&(y(W(u.resume)),l(((r=u.info)==null?void 0:r.selfIntro)??"")),a("success","已重新载入最新数据")}catch(n){a("error",n.message)}},ke=()=>{const t=new Blob([JSON.stringify(s,null,2)],{type:"application/json"}),r=URL.createObjectURL(t),n=document.createElement("a");n.href=r,n.download="简历配置.json",n.click(),setTimeout(()=>URL.revokeObjectURL(r),6e4),a("success","简历配置已导出")},ve=t=>{t&&t.text().then(r=>{try{const n=W(JSON.parse(r));b(n),a("success","配置已导入")}catch{a("error","配置文件格式不正确")}})};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(P,{variant:"secondary",onClick:()=>_(t=>!t),children:[i?e.jsx(Me,{size:13}):e.jsx(Ae,{size:13}),i?"收起设置":"展开设置"]}),e.jsxs(P,{variant:"secondary",onClick:()=>void je(),children:[e.jsx(Re,{size:13})," 重新载入"]}),e.jsxs(P,{variant:"ghost",className:"text-danger hover:bg-danger-subtle",onClick:()=>H(!0),children:[e.jsx(oe,{size:13})," 初始化简历"]}),e.jsxs(P,{variant:"secondary",onClick:fe,children:[e.jsx(we,{size:13})," 导出 Word"]}),e.jsxs(P,{variant:"primary",onClick:()=>window.print(),children:[e.jsx(Ue,{size:13})," 打印 / PDF"]})]})]}),e.jsxs("div",{className:"grid gap-4 "+(i?"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:s.onePage?1123:void 0},children:e.jsxs("div",{ref:m,className:"min-w-0 overflow-x-hidden p-5 sm:p-10 resume-tpl-"+s.template,style:{zoom:G,"--accent":s.accent},children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between gap-4 sm:gap-6",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"text-[26px] font-bold leading-tight "+(s.template==="tech"?"text-[var(--accent)]":"text-neutral-900"),children:d.name||"姓名"}),(((X=s.header)==null?void 0:X.showSchool)??!0)&&e.jsx("div",{className:"mt-1.5 text-[12.5px] text-neutral-500",children:[d.school,d.college,d.major,d.degree].filter(Boolean).join(" · ")||"完善个人信息后自动展示"}),(((ee=s.header)==null?void 0:ee.showContact)??!0)&&e.jsx("div",{className:"mt-1 text-[12px] text-neutral-500",children:[d.phone,d.email,d.homepage].filter(Boolean).join(" · ")})]}),(((te=s.header)==null?void 0:te.showPhoto)??!0)&&d.photoUrl&&e.jsx("img",{src:d.photoUrl,alt:"证件照",className:"h-[110px] w-[82px] rounded border border-neutral-200 object-cover"})]}),S.map(t=>{var r;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(O,{html:t.title,onCommit:n=>I({secKey:t.key,field:"title",value:n})})}),t.kind==="edu"?e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4 gap-y-0.5 text-[13px]",children:[e.jsx("span",{className:"num shrink-0 text-neutral-500",children:e.jsx(O,{html:o,onCommit:n=>{const u=/(\d{4})\.(\d{1,2})\s*[-—~至]\s*(\d{4})\.(\d{1,2})/.exec(n);if(!u){a("error","时间格式:2023.9-2027.6");return}K({info:{...x,eduStart:u[1]+"-"+u[2].padStart(2,"0"),eduEnd:u[3]+"-"+u[4].padStart(2,"0")}}).then(()=>f.refetch()).catch(N=>a("error",N.message))}})}),e.jsx("span",{className:"min-w-0 font-semibold text-neutral-900",children:e.jsx(O,{html:d.school??"",onCommit:n=>B("school",n)})}),e.jsxs("span",{className:"shrink-0 text-neutral-600",children:[e.jsx(O,{html:d.major??"",onCommit:n=>B("major",n)}),d.degree?e.jsxs("span",{children:[" | ",e.jsx(O,{html:d.degree,onCommit:n=>B("degree",n)})]}):null]})]}),d.majorCourses&&e.jsxs("p",{className:"mt-1.5 text-[12px] leading-relaxed text-justify text-neutral-700",children:[e.jsx("b",{children:"主修课程:"}),e.jsx(O,{html:d.majorCourses,onCommit:n=>B("majorCourses",n)})]})]}):t.kind==="info"?e.jsx("div",{className:"grid grid-cols-1 gap-x-8 gap-y-1 text-[12.5px] sm:grid-cols-2",children:[["姓名",d.name],["性别",d.gender],["出生年月",d.birth],["民族",d.nation],["籍贯",d.native],["政治面貌",d.political],["班级",d.className],["学号",d.studentId],["手机",d.phone],["邮箱",d.email]].filter(n=>n[1]&&!(t.hiddenFields??[]).includes($e[n[0]])).map(n=>e.jsxs("div",{className:"flex gap-2",children:[e.jsx("span",{className:"w-16 shrink-0 text-neutral-500",children:n[0]}),e.jsx("span",{children:n[1]})]},n[0]))}):t.kind==="text"?e.jsx("p",{className:"whitespace-pre-wrap text-justify text-neutral-700 "+(s.density==="compact"?"":"leading-relaxed"),children:e.jsx(O,{html:t.text??"",onCommit:n=>I({secKey:t.key,field:"text",value:n})})}):e.jsx("div",{className:s.density==="compact"?"flex flex-col gap-1.5":"flex flex-col gap-3",children:(r=t.items)==null?void 0:r.map((n,u)=>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(O,{html:n.title,onCommit:N=>I({secKey:t.key,field:"title",value:N,itemIdx:u,fromRecord:n.fromRecord})})}),e.jsx("span",{className:"num shrink-0 text-[11.5px] text-neutral-500",children:e.jsx(O,{html:n.date??"",onCommit:N=>I({secKey:t.key,field:"date",value:N,itemIdx:u,fromRecord:n.fromRecord})})})]}),n.subtitle&&e.jsx("div",{className:"text-[12px] text-neutral-600",children:n.subtitle}),n.desc&&e.jsx("p",{className:"text-justify text-[12px] text-neutral-500 "+(s.density==="compact"?"":"mt-0.5"),children:e.jsx(O,{html:n.desc,onCommit:N=>I({secKey:t.key,field:"desc",value:N,itemIdx:u,fromRecord:n.fromRecord})})})]},n.itemKey??(n.title??"")+u))})]},t.key)})]})}),s.onePage&&e.jsxs("div",{className:"no-print mt-2 text-center text-[11.5px] text-ink-3",children:["一页限定已启用:内容自动缩放 ",Math.round(G*100),"% 以适配单页 A4"]})]}),i&&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(ae,{children:[e.jsx(le,{title:"模板与风格"}),e.jsxs(re,{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2",children:he.map(t=>e.jsxs("button",{className:"rounded-md border px-3 py-2 text-left transition-all "+(s.template===t.key?"border-brand bg-brand-subtle":"border-line bg-surface hover:border-line-strong"),onClick:()=>b({...s,template:t.key}),children:[e.jsx("div",{className:"text-[12.5px] font-semibold "+(s.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(U,{label:"主题色",children:e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:ue.map(t=>e.jsx("button",{"aria-label":"主题色 "+t,className:"size-5 rounded-full border-2 transition-transform "+(s.accent===t?"scale-110 border-ink-1":"border-transparent"),style:{backgroundColor:t},onClick:()=>b({...s,accent:t})},t))})}),e.jsx(U,{label:"字号",children:e.jsx(ne,{value:String(s.fontScale),onChange:t=>b({...s,fontScale:Number(t.target.value)}),options:[{value:"0.9",label:"小"},{value:"1",label:"标准"},{value:"1.1",label:"大"}]})})]}),e.jsx(U,{label:"头部布局",children:e.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:[["showPhoto","证件照"],["showContact","联系行"],["showSchool","学校行"]].map(t=>{var n;const r=((n=s.header)==null?void 0:n[t[0]])??!0;return e.jsx("button",{className:"rounded-md border px-2.5 py-1 text-[11.5px] transition-colors "+(r?"border-brand bg-brand-subtle text-brand-text":"border-line bg-surface text-ink-3"),onClick:()=>b({...s,header:{...s.header,[t[0]]:!r}}),children:t[1]},t[0])})})}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(U,{label:"间距",children:e.jsx(ne,{value:s.density,onChange:t=>b({...s,density:t.target.value}),options:[{value:"compact",label:"紧凑"},{value:"normal",label:"标准"},{value:"relaxed",label:"宽松"}]})}),e.jsx(U,{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 "+(s.onePage?"border-brand bg-brand-subtle text-brand-text":"border-line bg-surface text-ink-2"),onClick:()=>b({...s,onePage:!s.onePage}),children:s.onePage?"已开启":"已关闭"})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t border-line pt-3",children:[e.jsx(P,{size:"sm",variant:"secondary",onClick:ke,children:"导出配置"}),e.jsxs("label",{className:"flex h-8 cursor-pointer items-center justify-center rounded-md border border-line bg-surface text-[12px] text-ink-2 transition-colors hover:border-line-strong",children:["导入配置",e.jsx("input",{type:"file",accept:"application/json",className:"hidden",onChange:t=>{var r;ve((r=t.target.files)==null?void 0:r[0]),t.target.value=""}})]})]})]})]}),e.jsxs(ae,{children:[e.jsx(le,{title:"板块布局",extra:e.jsx("span",{className:"text-[11px] text-ink-3",children:"拖动排序 · 点击预览可改内容"})}),e.jsx(re,{className:"p-0",children:e.jsxs("div",{className:"flex flex-col divide-y divide-line",children:[s.sections.map((t,r)=>{var N;const n=j.has(t.key),u=t.kind==="info"?"固定":t.kind==="text"?"文本":t.kind==="edu"?"教育":"记录";return e.jsxs("div",{draggable:!0,onDragStart:()=>{v.current=t.key},onDragOver:p=>p.preventDefault(),onDrop:()=>{const p=s.sections.findIndex(g=>g.key===v.current);if(p>=0&&p!==r){const g=[...s.sections],E=g.splice(p,1)[0];g.splice(r,0,E),b({...s,sections:g})}v.current=null},className:"bg-surface "+(v.current===t.key?"opacity-40":""),children:[e.jsxs("div",{className:"flex items-center gap-1 px-3 py-2",children:[e.jsx(Ie,{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:p=>b({...s,sections:s.sections.map(g=>g.key===t.key?{...g,title:p.target.value}:g)})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"上移",disabled:r===0,onClick:()=>M(r,-1),children:e.jsx(xe,{size:12})}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1 disabled:opacity-30","aria-label":"下移",disabled:r===s.sections.length-1,onClick:()=>M(r,1),children:e.jsx(me,{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:()=>b({...s,sections:s.sections.map(p=>p.key===t.key?{...p,enabled:!p.enabled}:p)}),children:t.enabled?"显示":"隐藏"}),e.jsx("button",{className:"rounded p-1 text-ink-3 hover:text-ink-1","aria-label":"展开编辑",onClick:()=>C(p=>{const g=new Set(p);return g.has(t.key)?g.delete(t.key):g.add(t.key),g}),children:e.jsx(Oe,{size:13,className:"transition-transform "+(n?"rotate-90":"")})})]}),n&&e.jsx("div",{className:"border-t border-line bg-surface-2 px-3 py-2.5",children:t.kind==="text"?e.jsx(de,{rows:4,value:t.text??"",placeholder:"输入该板块内容…",onChange:p=>b({...s,sections:s.sections.map(g=>g.key===t.key?{...g,text:p.target.value}:g)})}):t.kind==="info"?e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{className:"mb-0.5 text-[11px] text-ink-3",children:"勾选 = 在基本信息中显示"}),Ge.map(p=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-[12px]",children:[e.jsx("input",{type:"checkbox",className:"size-3.5",checked:!(t.hiddenFields??[]).includes(p[0]),onChange:()=>b({...s,sections:s.sections.map(g=>{if(g.key!==t.key)return g;const E=new Set(g.hiddenFields??[]);return E.has(p[0])?E.delete(p[0]):E.add(p[0]),{...g,hiddenFields:[...E]}})})}),p[1]]},p[0]))]}):t.kind==="list"?e.jsx(Qe,{cfg:s,section:t,records:F,persist:b,sectionTypes:ge(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:[u,(N=t.types)!=null&&N.length?" · "+t.types.join("/"):""]})]},t.key)}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 p-3",children:[e.jsxs(P,{size:"sm",variant:"secondary",onClick:()=>Q("text"),children:[e.jsx($,{size:13})," 文本板块"]}),e.jsxs(P,{size:"sm",variant:"secondary",onClick:()=>Q("list"),children:[e.jsx($,{size:13})," 列表板块"]})]})]})})]})]})]}),e.jsx(Ce,{open:ye,onClose:()=>H(!1),width:440,title:"初始化简历",footer:e.jsxs(e.Fragment,{children:[e.jsx(P,{variant:"ghost",onClick:()=>H(!1),children:"取消"}),e.jsxs(P,{variant:"primary",className:"!bg-danger !text-white",disabled:!1,onClick:be,children:[e.jsx(oe,{size:13})," 确认初始化"]})]}),children:e.jsxs("div",{className:"text-[12.5px] leading-relaxed text-ink-2",children:["将清除全部个性化修改(板块调整、自定义条目、文字覆盖、样式设置), 恢复为默认模板与示例内容。",e.jsx("div",{className:"mt-2 text-ink-3",children:"记录数据与个人信息不受影响,随时可重新修改。"})]})})]})}function Qe({cfg:a,section:f,records:h,persist:w,sectionTypes:y}){const[c,l]=T.useState(null),i=new Set(f.excluded??[]),_=h.filter(s=>(f.types??[]).includes(s.type_name)&&s.status!=="draft").sort((s,x)=>(x.start_date??x.created_at).localeCompare(s.start_date??s.created_at)),j=f.items??[],C=s=>w({...a,sections:a.sections.map(x=>x.key===f.key?{...x,...s}:x)}),R=s=>{const x=new Set(f.excluded??[]);x.has(s)?x.delete(s):x.add(s),C({excluded:[...x]})},k=[...f.itemOrder??[]],m=new Set(k),v=new Map;_.forEach(s=>{const x="r"+s.id;v.set(x,{type:"record",r:s}),m.has(x)||(k.push(x),m.add(x))}),j.forEach((s,x)=>{const o=s.id??"c"+x;v.set(o,{type:"custom",c:s,idx:x}),m.has(o)||(k.push(o),m.add(o))});const d=(s,x)=>{const o=k.indexOf(s),S=o+x;o<0||S<0||S>=k.length||([k[o],k[S]]=[k[S],k[o]],C({itemOrder:k}))},F=({k:s})=>e.jsxs("span",{className:"flex shrink-0 flex-col",children:[e.jsx("button",{className:"text-ink-3 hover:text-ink-1","aria-label":"上移",onClick:()=>d(s,-1),children:e.jsx(xe,{size:11})}),e.jsx("button",{className:"text-ink-3 hover:text-ink-1","aria-label":"下移",onClick:()=>d(s,1),children:e.jsx(me,{size:11})})]});return e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsx("div",{className:"text-[11px] text-ink-3",children:"条目排序(↑↓)· 记录勾选显隐 · 自定义条目可增删"}),k.map(s=>{const x=v.get(s);if(!x)return null;if(x.type==="record"){const o=x.r;return e.jsxs("div",{className:"flex items-center gap-2 text-[12px]",children:[e.jsx(F,{k:s}),e.jsxs("label",{className:"flex min-w-0 flex-1 cursor-pointer items-center gap-2",children:[e.jsx("input",{type:"checkbox",className:"size-3.5",checked:!i.has(o.id),onChange:()=>R(o.id)}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:o.title})]}),e.jsx("span",{className:"num shrink-0 text-[11px] text-ink-3",children:(o.start_date??"").slice(0,7)})]},s)}return e.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-line bg-surface p-1.5 text-[12px]",children:[e.jsx(F,{k:s}),e.jsxs("span",{className:"min-w-0 flex-1 truncate text-ink-1",children:[x.c.title,e.jsxs("span",{className:"text-ink-3",children:[" · ",x.c.date??""]})]}),e.jsx("button",{className:"text-ink-3 hover:text-danger","aria-label":"删除条目",onClick:()=>C({items:j.filter((o,S)=>S!==x.idx)}),children:e.jsx(ie,{size:12})})]},s)}),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:["自定义条目(",j.length,")"]}),e.jsxs(P,{size:"sm",variant:"ghost",onClick:()=>l({title:""}),children:[e.jsx($,{size:12})," 添加"]})]}),c&&e.jsxs("div",{className:"mb-2 rounded-md border border-line bg-surface p-2",children:[e.jsx(V,{className:"mb-1.5",placeholder:"标题",value:c.title,onChange:s=>l({...c,title:s.target.value})}),e.jsxs("div",{className:"mb-1.5 grid grid-cols-2 gap-1.5",children:[e.jsx(V,{placeholder:"副标题(单位/角色)",value:c.subtitle??"",onChange:s=>l({...c,subtitle:s.target.value})}),e.jsx(V,{placeholder:"日期(2025.9)",value:c.date??"",onChange:s=>l({...c,date:s.target.value})})]}),e.jsx(de,{rows:2,placeholder:"描述:做了什么、负责什么、学会什么",value:c.desc??"",onChange:s=>l({...c,desc:s.target.value})}),e.jsxs("div",{className:"mt-1.5 flex gap-1.5",children:[e.jsx(P,{size:"sm",variant:"primary",disabled:!c.title.trim(),onClick:()=>{c.title.trim()&&(C({items:[...j,{...c,id:"c"+Date.now()}]}),l(null))},children:"添加"}),e.jsx(P,{size:"sm",variant:"ghost",onClick:()=>l(null),children:"取消"})]})]}),j.map((s,x)=>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:[s.title,e.jsxs("span",{className:"text-ink-3",children:[" · ",s.date??""]})]}),e.jsx("button",{className:"text-ink-3 hover:text-danger","aria-label":"删除条目",onClick:()=>C({items:j.filter((o,S)=>S!==x)}),children:e.jsx(ie,{size:12})})]},x)),!j.length&&!c&&e.jsx("p",{className:"text-[11.5px] text-ink-3",children:"暂无自定义条目"})]}),e.jsxs("p",{className:"text-[11px] text-ink-3",children:["「",y,"」相关条目来自你的记录数据,此处可隐藏不需要展示的条目;描述可在预览中点击直接修改。"]})]})}export{Xe as ResumePage};