1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jspdf.es.min-BHjX0qxm.js","assets/index-BawMCgu8.js","assets/locale-en-B8Z5F_o1.js","assets/locale-zh-CN-CFdD1mPv.js","assets/locale-fr-j4CMJpfE.js","assets/locale-de-DuE2gagy.js","assets/locale-it-C6yb6RzN.js","assets/locale-ja-VjZBy5eF.js","assets/locale-ko-Cl0W-Az5.js","assets/locale-es-DwboUZze.js","assets/locale-zh-Hant-uT5aTnfX.js","assets/locale-ru-DEr1xfTZ.js","assets/locale-id-Buh3Uolz.js","assets/locale-pt-BR-CqD5J4_0.js","assets/index-BpvGeALH.css","assets/pptxgen.es-CRI-nGi7.js","assets/jszip.min-CCODYnd_.js","assets/_commonjs-dynamic-modules-TDtrdbi3.js","assets/pdfmake-D5Y9vCQw.js","assets/vfs_fonts-B2Vntlz5.js","assets/exceljs.min-0TxIC6ny.js"])))=>i.map(i=>d[i]); 2import{a as Xe,r as u,u as ge,_ as $e,b as ve,z as Ne,j as e,P as Bs,d as Ct,X as Ee,e as U,L as Ve,D as at,f as Bt,F as Ue,I as et,M as mt,g as Be,C as Me,h as $t,i as ot,k as st,T as Qe,l as Us,m as Hs,n as mr,o as qs,p as Gs,Q as Ws,q as Dt,s as St,S as xr,t as vt,E as Pt,v as Jt,w as gt,V as xs,x as Yt,G as yt,N as hr,A as Vs,y as Et,B as Ut,H as gr,J as fr,K as br,O as Ht,R as hs,U as yr,W as vr,Y as wr,Z as jr,$ as Nr,a0 as Ks,a1 as gs,a2 as kr,a3 as qt,a4 as Js,a5 as Ys,a6 as Cr,a7 as fs,a8 as Lt,a9 as $r,aa as Sr,ab as N,ac as Tr,ad as Zt,ae as Zs,af as Qs,ag as Gt,ah as Rr,ai as Dr,aj as bs,ak as ys,al as Lr,am as zr,an as zt,ao as Er,ap as vs,aq as Ft,ar as Qt,as as Fr,at as Pr,au as Ir,av as ws,aw as Ar,ax as js,ay as Ns,az as Mr,aA as _r,aB as Or}from"./index-BawMCgu8.js";import{i as Br,a as Ur,b as Hr,C as Xs,c as qr,P as Wt}from"./broadcastSync-Bxymz8bD.js";import{F as tt,i as Gr}from"./index-xSdyNPg7.js";import{S as Xt}from"./share-2-CNcYfc7P.js";import{M as es}from"./more-horizontal-CzzSxaHy.js";import{P as ft}from"./pen-line-Fq8TC4Qi.js";import{Z as It}from"./zoom-out-DwpmibdW.js";import{Z as At}from"./zoom-in-CWl6FHRb.js";import{S as ut}from"./Select-CBvYay3K.js";import{B as Wr,I as Vr,A as er,a as Vt,b as Kr,U as Jr}from"./undo-2-B7yg3O6I.js";import{U as Yr,S as Zr,H as Qr,a as Xr,b as en}from"./underline-x2bjYOL2.js";import{U as ts}from"./undo-D42EHzQk.js";import{L as ss}from"./link-C1iEqoKY.js";import{F as tn}from"./filter-l8m5dkwE.js";import{R as sn}from"./rotate-cw-Cs8sg7VG.js";import{M as rn}from"./maximize-C_UxdIWU.js";import{S as rs}from"./save-BInnCtLF.js";import{R as nn}from"./redo-2-BNRfpAAM.js";import{C as ks}from"./columns-2-CeB2BBlB.js";import{G as tr}from"./grip-vertical-DlO1V8kJ.js";import{S as ln}from"./star-D2cPXFZS.js";import{P as an}from"./pen-Cr8eAFPX.js";import"./locale-en-B8Z5F_o1.js";import"./locale-zh-CN-CFdD1mPv.js";import"./locale-fr-j4CMJpfE.js";import"./locale-de-DuE2gagy.js";import"./locale-it-C6yb6RzN.js";import"./locale-ja-VjZBy5eF.js";import"./locale-ko-Cl0W-Az5.js";import"./locale-es-DwboUZze.js";import"./locale-zh-Hant-uT5aTnfX.js";import"./locale-ru-DEr1xfTZ.js";import"./locale-id-Buh3Uolz.js";import"./locale-pt-BR-CqD5J4_0.js";/** 3 * @license lucide-react v0.309.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const on=Xe("AlignJustify",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["line",{x1:"3",x2:"21",y1:"18",y2:"18",key:"kwyyxn"}]]);/** 8 * @license lucide-react v0.309.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const dn=Xe("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/** 13 * @license lucide-react v0.309.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const Cs=Xe("ArrowUpNarrowWide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]]);/** 18 * @license lucide-react v0.309.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree.
22 */const cn=Xe("Clipboard",[["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"}]]);/** 23 * @license lucide-react v0.309.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const sr=Xe("Code2",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** 28 * @license lucide-react v0.309.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const pn=Xe("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** 33 * @license lucide-react v0.309.0 - ISC 34 * 35 * This source code is licensed under the ISC license. 36 * See the LICENSE file in the root directory of this source tree. 37 */const un=Xe("Equal",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]]);/** 38 * @license lucide-react v0.309.0 - ISC 39 * 40 * This source code is licensed under the ISC license. 41 * See the LICENSE file in the root directory of this source tree. 42 */const mn=Xe("FileJson",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** 43 * @license lucide-react v0.309.0 - ISC 44 * 45 * This source code is licensed under the ISC license. 46 * See the LICENSE file in the root directory of this source tree. 47 */const xn=Xe("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** 48 * @license lucide-react v0.309.0 - ISC 49 * 50 * This source code is licensed under the ISC license. 51 * See the LICENSE file in the root directory of this source tree. 52 */const hn=Xe("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** 53 * @license lucide-react v0.309.0 - ISC 54 * 55 * This source code is licensed under the ISC license. 56 * See the LICENSE file in the root directory of this source tree. 57 */const gn=Xe("Wind",[["path",{d:"M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2",key:"1k4u03"}],["path",{d:"M9.6 4.6A2 2 0 1 1 11 8H2",key:"b7d0fd"}],["path",{d:"M12.6 19.4A2 2 0 1 0 14 16H2",key:"1p5cb3"}]]),$s={modern:{name:"Modern",primaryColor:"#2563eb",secondaryColor:"#3b82f6",backgroundColor:"#ffffff",textColor:"#1f2937",fontFamily:"'Inter', 'Noto Sans SC', sans-serif",accentColor:"#8b5cf6",cardBackground:"#f8fafc",borderColor:"#e2e8f0"},dark:{name:"Dark Mode",primaryColor:"#818cf8",secondaryColor:"#6366f1",backgroundColor:"#0f172a",textColor:"#f1f5f9",fontFamily:"'Inter', 'Noto Sans SC', sans-serif",accentColor:"#22d3ee",cardBackground:"#1e293b",borderColor:"#334155"},gradient:{name:"Gradient",primaryColor:"#ffffff",secondaryColor:"#f0abfc",backgroundColor:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",textColor:"#ffffff",fontFamily:"'Poppins', 'Noto Sans SC', sans-serif",accentColor:"#fbbf24",cardBackground:"rgba(255,255,255,0.1)",borderColor:"rgba(255,255,255,0.2)"},corporate:{name:"Corporate",primaryColor:"#0066cc",secondaryColor:"#004c99",backgroundColor:"#f8fafc",textColor:"#1e293b",fontFamily:"'Roboto', 'Noto Sans SC', sans-serif",accentColor:"#059669",cardBackground:"#ffffff",borderColor:"#cbd5e1"},minimalist:{name:"Minimalist",primaryColor:"#111827",secondaryColor:"#374151",backgroundColor:"#ffffff",textColor:"#374151",fontFamily:"'Plus Jakarta Sans', 'Noto Sans SC', sans-serif",accentColor:"#ef4444",cardBackground:"#f9fafb",borderColor:"#e5e7eb"},tech:{name:"Tech",primaryColor:"#00d4ff",secondaryColor:"#00ff88",backgroundColor:"#0a0a1a",textColor:"#e0e7ff",fontFamily:"'JetBrains Mono', 'Noto Sans SC', monospace",accentColor:"#ff6b6b",gradientOverlay:"radial-gradient(ellipse at top, rgba(0,212,255,0.1) 0%, transparent 50%)",cardBackgroun
57d:"rgba(0,212,255,0.05)",borderColor:"rgba(0,212,255,0.2)"},nature:{name:"Nature",primaryColor:"#059669",secondaryColor:"#10b981",backgroundColor:"#f0fdf4",textColor:"#14532d",fontFamily:"'Nunito', 'Noto Sans SC', sans-serif",accentColor:"#f59e0b",cardBackground:"#ffffff",borderColor:"#bbf7d0"},elegant:{name:"Elegant",primaryColor:"#78350f",secondaryColor:"#92400e",backgroundColor:"#fffbeb",textColor:"#451a03",fontFamily:"'Playfair Display', 'Noto Serif SC', serif",accentColor:"#b45309",cardBackground:"#fef3c7",borderColor:"#fcd34d"},ocean:{name:"Ocean",primaryColor:"#0077b6",secondaryColor:"#00b4d8",backgroundColor:"#caf0f8",textColor:"#03045e",fontFamily:"'Source Sans Pro', 'Noto Sans SC', sans-serif",accentColor:"#ff6b35",cardBackground:"#ffffff",borderColor:"#90e0ef"},sunset:{name:"Sunset",primaryColor:"#ff6b6b",secondaryColor:"#feca57",backgroundColor:"linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%)",textColor:"#2d3436",fontFamily:"'Quicksand', 'Noto Sans SC', sans-serif",accentColor:"#ff9ff3",cardBackground:"rgba(255,255,255,0.9)",borderColor:"rgba(255,107,107,0.3)"},monochrome:{name:"Monochrome",primaryColor:"#000000",secondaryColor:"#333333",backgroundColor:"#ffffff",textColor:"#000000",fontFamily:"'IBM Plex Sans', 'Noto Sans SC', sans-serif",accentColor:"#666666",cardBackground:"#f5f5f5",borderColor:"#e0e0e0"},neon:{name:"Neon",primaryColor:"#ff00ff",secondaryColor:"#00ffff",backgroundColor:"#0d0221",textColor:"#ffffff",fontFamily:"'Orbitron', 'Noto Sans SC', sans-serif",accentColor:"#ffff00",gradientOverlay:"radial-gradient(ellipse at bottom, rgba(255,0,255,0.15) 0%, transparent 60%)",cardBackground:"rgba(255,0,255,0.1)",borderColor:"rgba(0,255,255,0.3)"}};function ns(t){const s=t.toLowerCase();return $s[s]||$s.modern}function fn(t){const{style:s,colors:n,name:r}=t,l={corporate:"'Roboto', 'Noto Sans SC', sans-serif",tech:"'JetBrains Mono', 'Noto Sans SC', monospace",creative:"'Poppins', 'Noto Sans SC', sans-serif",minimal:"'Plus Jakarta Sans', 'Noto Sans SC', sans-serif",nature:"'Nunito', 'Noto Sans SC', sans-serif",luxury:"'Playfair Display', 'Noto Serif SC', serif"};if(!n)return ns(s||"modern");const c=bn(n.background);return{name:r||(s?s.charAt(0).toUpperCase()+s.slice(1):"Custom"),primaryColor:n.primary,secondaryColor:n.secondary,backgroundColor:n.background,textColor:n.text,accentColor:n.accent,fontFamily:l[s||"corporate"]||l.corporate,cardBackground:c?"rgba(255,255,255,0.1)":n.background,borderColor:c?"rgba(255,255,255,0.2)":n.muted}}function bn(t){if(!t.startsWith("#"))return!1;const s=t.replace("#",""),n=parseInt(s.substring(0,2),16),r=parseInt(s.substring(2,4),16),l=parseInt(s.substring(4,6),16);return(.299*n+.587*r+.114*l)/255<.5}function yn(){const t=u.useRef(!1);u.useEffect(()=>{if(!Br()){console.log("[useBroadcastSync] BroadcastChannel not available");return}if(t.current)return;t.current=!0,Ur();const s=Hr(n=>{var l,c,o,d;const r=ge.getState();switch(console.log("[useBroadcastSync] Received:",n.type,"sessionId:",n.sessionId,"currentSessionId:",r.currentSessionId),n.type){case"streaming_start":{ge.getState().addActiveStreamingSession(n.sessionId),r.currentSessionId===n.sessionId&&(r.streaming.isStreaming||ge.setState({streaming:{...r.streaming,isStreaming:!0,sessionId:n.sessionId}}));break}case"streaming_event":{const a=n.data;if(!a)break;if(r.currentSessionId!==n.sessionId){const p=r.sessionStreamingCache[n.sessionId],i=p?{...p}:{isStreaming:!0,currentContent:"",currentPlan:null,currentArtifacts:[],thinkingText:"",reasoningText:"",sessionId:n.sessionId};if(a.type==="content"&&((l=a.data)!=null&&l.text)){const m=a.data.text,x=i.currentContent||"";if(m.length>50&&x.includes(m)){console.warn("[useBroadcastSync] Skipping duplicate content block");break}if(x.endsWith(m)&&m.length>20){console.warn("[useBroadcastSync] Skipping duplicate trailing content");break}i.currentContent=x+m}else if(a.type==="artifact"&&a.data){const m=[...i.currentArtifacts||[]],x=m.findIndex(g=>g.id===a.data.id);x>=0?m[x]=a.data:m.push(a.data),i.currentArtifacts=m}else if(a.type==="artifact_update"&&a.data){const m=[...i.currentArtifacts||[]],x=m.findIndex(g=>g.id===a.data.artifactId);if(x>=0){const g={...m[x]};((c=a.data.payload)==null?void 0:c.progress)!==void 0&&(g.progress=a.data.payload.progress),(o=a.data.payload)!=null&&o.status&&(g.status=a.data.payload.status),(d=a.data.payload)!=null&&d.currentStep&&(g.currentStep=a.data.payload.currentStep),m[x]=g,i.currentArtifacts=m}}ge.setState({sessionStreamingCache:{...r.sessionStreamingCache,[n.sessionId]:i}})}else ge.getState().handleAgentEvent(a,n.sessionId);break}case"streaming_end":{ge.getState().removeActiveStreamingSession(n.sessionId);const{finalContent:a,artifacts:p}=n.data||{};if(r.currentSessionId!==n.sessionId){const i=r.sessionStreamingCache[n.sessionId];i&&ge.setState({sessionStreamingCache:{...r.sessionStreamingCache,[n.sessionId]:{...i,isStreaming:!1,currentContent:a||i.currentContent,currentArtifacts:p||i.currentArtifacts}}})}else if(r.streaming.sessionId===n.sessionId){ge.setState({streaming:{...r.streaming,isStreaming:!1,currentContent:a||r.streaming.currentContent,currentArtifacts:p||r.streaming.currentArtifacts}});const m=[...r.messages].reverse().find(x=>x.role==="assistant");m&&a&&ge.getState().updateMessage(m.id,{content:a,artifacts:p&&p.length>0?p:void 0})}break}case"state_update":{const{content:a,artifacts:p,isStreaming:i}=n.data||{};if(r.currentSessionId!==n.sessionId){const m=r.sessionStreamingCache[n.sessionId]||{isStreaming:i??!1,currentContent:"",currentPlan:null,currentArtifacts:[],thinkingText:"",reasoningText:"",sessionId:n.sessionId};ge.setState({sessionStreamingCache:{...r.sessionStreamingCache,[n.sessionId]:{...m,isStreaming:i??m.isStreaming,currentContent:a??m.currentContent,currentArtifacts:p??m.currentArtifacts}}})}break}}});return()=>{s()}},[])}async function rr(t){var l;const s=(await $e(async()=>{const{default:c}
57=await import("./html2canvas.esm-CBrSDip1.js");return{default:c}},[])).default,n=t.contentDocument||((l=t.contentWindow)==null?void 0:l.document);if(!(n!=null&&n.body))throw new Error("Cannot access iframe content");const r=await s(n.body,{backgroundColor:"#ffffff",scale:2,useCORS:!0,allowTaint:!0});return new Promise(c=>{r.toBlob(o=>c(o),"image/png")})}function vn(t){return`<!DOCTYPE html> 58<html lang="zh-CN"> 59<head> 60 <meta charset="UTF-8"> 61 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 62 <title>${t.title}</title> 63 <style> 64 * { margin: 0; padding: 0; box-sizing: border-box; } 65 body { font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif; } 66 ${t.code.css||""} 67 </style> 68</head> 69<body> 70 ${t.code.html} 71 <script>${t.code.js||""}<\/script> 72</body> 73</html>`}async function Oe(t,s){const n=(await $e(async()=>{const{default:l}=await import("./html2canvas.esm-CBrSDip1.js");return{default:l}},[])).default;if(s){const l=await rr(s);tt.saveAs(l,`${t.title}.png`);return}const r=document.createElement("div");r.style.cssText="position: fixed; left: -9999px; top: 0; width: 1200px; background: white;",r.innerHTML=` 74 <style> 75 * { margin: 0; padding: 0; box-sizing: border-box; } 76 body { font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif; } 77 ${t.code.css||""} 78 </style> 79 ${t.code.html} 80 `,document.body.appendChild(r);try{await new Promise(o=>setTimeout(o,100));const l=await n(r,{backgroundColor:"#ffffff",scale:2,useCORS:!0,allowTaint:!0}),c=await new Promise(o=>{l.toBlob(d=>o(d),"image/png")});tt.saveAs(c,`${t.title}.png`)}finally{document.body.removeChild(r)}}async function Rt(t,s){var l;const n=document.createElement("div");n.innerHTML=t.code.html;const r=n.querySelector("svg");if(r){const c=new XMLSerializer().serializeToString(r),o=new Blob([c],{type:"image/svg+xml"});tt.saveAs(o,`${t.title}.svg`);return}if(s){const c=s.contentDocument||((l=s.contentWindow)==null?void 0:l.document);if(c!=null&&c.body){const d=c.querySelector("svg");if(d){const a=new XMLSerializer().serializeToString(d),p=new Blob([a],{type:"image/svg+xml"});tt.saveAs(p,`${t.title}.svg`);return}}const o=await rr(s);tt.saveAs(o,`${t.title}.png`);return}await Oe(t,null)}async function Pe(t){const s=vn(t),n=new Blob([s],{type:"text/html;charset=utf-8"});tt.saveAs(n,`${t.title}.html`)}async function Ge(t,s){var a;const{jsPDF:n}=await $e(async()=>{const{jsPDF:p}=await import("./jspdf.es.min-BHjX0qxm.js").then(i=>i.j);return{jsPDF:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])),r=(await $e(async()=>{const{default:p}=await import("./html2canvas.esm-CBrSDip1.js");return{default:p}},[])).default;let l;if(s){const p=s.contentDocument||((a=s.contentWindow)==null?void 0:a.document);if(!(p!=null&&p.body))throw new Error("Cannot access content");l=p.body}else{const p=document.createElement("div");p.style.cssText="position: fixed; left: -9999px; top: 0; width: 1200px; background: white;",p.innerHTML=` 81 <style> 82 * { margin: 0; padding: 0; box-sizing: border-box; } 83 body { font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif; } 84 ${t.code.css||""} 85 </style> 86 ${t.code.html} 87 `,document.body.appendChild(p),await new Promise(i=>setTimeout(i,100)),l=p;try{const i=await r(l,{backgroundColor:"#ffffff",scale:2,useCORS:!0}),m=i.toDataURL("image/png"),x=new n({orientation:i.width>i.height?"landscape":"portrait",unit:"px",format:[i.width/2,i.height/2]});x.addImage(m,"PNG",0,0,i.width/2,i.height/2),x.save(`${t.title}.pdf`)}finally{document.body.removeChild(p)}return}const c=await r(l,{backgroundColor:"#ffffff",scale:2,useCORS:!0}),o=c.toDataURL("image/png"),d=new n({orientation:c.width>c.height?"landscape":"portrait",unit:"px",format:[c.width/2,c.height/2]});d.addImage(o,"PNG",0,0,c.width/2,c.height/2),d.save(`${t.title}.pdf`)}async function wn(t,s){var l;const n=(await $e(async()=>{const{default:c}=await import("./pptxgen.es-CRI-nGi7.js");return{default:c}},__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17]))).default,r=new n;if(r.author="AI Assistant",r.title=t.title,r.subject=t.description||"",s){const c=s.contentDocument||((l=s.contentWindow)==null?void 0:l.document);
87if(c){const o=c.querySelectorAll(".slide, [data-slide], section");if(o.length>0)for(let d=0;d<o.length;d++){const a=o[d],p=r.addSlide(),i=a.querySelector("h1, h2, .slide-title");i&&p.addText(i.textContent||"",{x:.5,y:.5,w:"90%",fontSize:32,bold:!0,color:"363636"});const m=a.querySelector(".slide-content, .content, p");m&&p.addText(m.textContent||"",{x:.5,y:1.5,w:"90%",fontSize:18,color:"666666"});try{const x=(await $e(async()=>{const{default:C}=await import("./html2canvas.esm-CBrSDip1.js");return{default:C}},[])).default,b=(await x(a,{backgroundColor:"#ffffff",scale:1})).toDataURL("image/png");p.addImage({data:b,x:0,y:0,w:"100%",h:"100%"})}catch{}}else{const d=r.addSlide();d.addText(t.title,{x:.5,y:.5,w:"90%",fontSize:36,bold:!0,color:"363636"}),t.description&&d.addText(t.description,{x:.5,y:1.5,w:"90%",fontSize:18,color:"666666"});try{const a=(await $e(async()=>{const{default:m}=await import("./html2canvas.esm-CBrSDip1.js");return{default:m}},[])).default,i=(await a(c.body,{backgroundColor:"#ffffff",scale:1})).toDataURL("image/png");d.addImage({data:i,x:.5,y:2,w:9,h:4.5})}catch{}}}}else r.addSlide().addText(t.title,{x:.5,y:2,w:"90%",fontSize:44,bold:!0,align:"center",color:"363636"});await r.writeFile({fileName:`${t.title}.pptx`})}async function Ss(t,s){var m;const{Document:n,Packer:r,Paragraph:l,TextRun:c,HeadingLevel:o,ImageRun:d}=await $e(async()=>{const{Document:x,Packer:g,Paragraph:b,TextRun:C,HeadingLevel:w,ImageRun:D}=await import("./index-C7JpgO3f.js");return{Document:x,Packer:g,Paragraph:b,TextRun:C,HeadingLevel:w,ImageRun:D}},[]),a=[];if(a.push(new l({text:t.title,heading:o.TITLE})),t.description&&(a.push(new l({children:[new c({text:t.description,italics:!0,color:"666666"})]})),a.push(new l({text:""}))),s){const x=s.contentDocument||((m=s.contentWindow)==null?void 0:m.document);if(x){x.querySelectorAll("p, h1, h2, h3, h4, li").forEach(b=>{var D;const C=b.tagName.toLowerCase(),w=((D=b.textContent)==null?void 0:D.trim())||"";if(w)if(C.startsWith("h")){const R=parseInt(C[1]);a.push(new l({text:w,heading:R<=2?o.HEADING_1:o.HEADING_2}))}else C==="li"?a.push(new l({text:`⢠${w}`})):a.push(new l({text:w}))});try{const b=(await $e(async()=>{const{default:R}=await import("./html2canvas.esm-CBrSDip1.js");return{default:R}},[])).default,D=(await b(x.body,{backgroundColor:"#ffffff",scale:1})).toDataURL("image/png").split(",")[1];a.push(new l({text:""})),a.push(new l({children:[new d({data:Uint8Array.from(atob(D),R=>R.charCodeAt(0)),transformation:{width:600,height:400},type:"png"})]}))}catch{}}}const p=new n({sections:[{children:a}]}),i=await r.toBlob(p);tt.saveAs(i,`${t.title}.docx`)}async function Ts(t,s){var o;const n=(await $e(async()=>{const{default:d}=await import("./xlsx-D_0l8YDs.js");return{default:d}},[])).default;let r=[];if(s){const d=s.contentDocument||((o=s.contentWindow)==null?void 0:o.document);if(d){const a=d.querySelector("table");a&&a.querySelectorAll("tr").forEach(i=>{const m=[];i.querySelectorAll("td, th").forEach(x=>{var g;m.push(((g=x.textContent)==null?void 0:g.trim())||"")}),m.length>0&&r.push(m)})}}r.length===0&&(r=[["Title",t.title],["Description",t.description||""],["Created At",new Date().toLocaleString()]]);const l=n.utils.aoa_to_sheet(r),c=n.utils.book_new();n.utils.book_append_sheet(c,l,"Sheet1"),n.writeFile(c,`${t.title}.xlsx`)}async function jn(t,s){var l;let n="";if(s){const c=s.contentDocument||((l=s.contentWindow)==null?void 0:l.document);if(c){const o=c.querySelector("table");o&&o.querySelectorAll("tr").forEach(a=>{const p=[];a.querySelectorAll("td, th").forEach(i=>{var x;let m=((x=i.textContent)==null?void 0:x.trim())||"";(m.includes(",")||m.includes('"')||m.includes(` 88`))&&(m=`"${m.replace(/"/g,'""')}"`),p.push(m)}),n+=p.join(",")+` 89`})}}n||(n=`Title,${t.title} 90Description,${t.description||""} 91`);const r=new Blob(["\uFEFF"+n],{type:"text/csv;charset=utf-8"});tt.saveAs(r,`${t.title}.csv`)}async function Nn(t){const s={title:t.title,description:t.description,contentType:t.contentType,code:t.code,createdAt:t.createdAt},n=new Blob([JSON.stringify(s,null,2)],{type:"application/json"});tt.saveAs(n,`${t.title}.json`)}async function Rs(t,s){var l;let n=`# ${t.title} 92 93`;if(t.description&&(n+=`> ${t.description} 94 95`),s){const c=s.contentDocument||((l=s.contentWindow)==null?void 0:l.document);c&&c.body.querySelectorAll("h1, h2, h3, h4, p, ul, ol, li, table").forEach(d=>{var i;const a=d.tagName.toLowerCase(),p=((i=d.textContent)==null?void 0:i.trim())||"";if(a.startsWith("h")){const m=parseInt(a[1]);n+=`${"#".repeat(m)} ${p} 96 97`}else a==="p"?n+=`${p} 98 99`:a==="li"&&(n+=`- ${p} 100`)})}const r=new Blob([n],{type:"text/markdown;charset=utf-8"});tt.saveAs(r,`${t.title}.md`)}const Ds={chart:[{format:"png",label:"PNG Image",icon:"image",handler:Oe},{format:"svg",label:"SVG Vector",icon:"pen-tool",handler:Rt},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],table:[{format:"xlsx",label:"Excel Spreadsheet",icon:"table",handler:Ts},{format:"csv",label:"CSV File",icon:"file-spreadsheet",handler:jn},{format:"json",label:"JSON Data",icon:"braces",handler:Nn},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],dashboard:[{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe},{format:"pdf",label:"PDF Report",icon:"file-text",handler:Ge},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],visualization:[{format:"png",label:"PNG Image",icon:"image",handler:Oe},{format:"svg",label:"SVG Vector",icon:"pen-tool",handler:Rt},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],document:[{format:"docx",label:"Word Document",icon:"file-text",handler:Ss},{format:"pdf",label:"PDF Document",icon:"file",handler:Ge},{format:"md",label:"Markdown",icon:"file-code",handler:Rs},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],form:[{format:"html",label:"HTML Page",icon:"code",handler:Pe},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe}],webpage:[{format:"html",label:"HTML Page",icon:"code",handler:Pe},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe}],article:[{format:"docx",label:"Word Document",icon:"file-text",handler:Ss},{format:"pdf",label:"PDF Document",icon:"file",handler:Ge},{format:"md",label:"Markdown",icon:"file-code",handler:Rs},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],presentation:[{format:"pptx",label:"PowerPoint",icon:"presentation",handler:wn},{format:"pdf",label:"PDF Document",icon:"file",handler:Ge},{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],infographic:[{format:"png",label:"PNG Image",icon:"image",handler:Oe},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"svg",label:"SVG Vector",icon:"pen-tool",handler:Rt},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],landing:[{format:"html",label:"HTML Page",icon:"code",handler:Pe},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe}],portfolio:[{format:"html",label:"HTML Page",icon:"code",handler:Pe},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe}],card:[{format:"png",label:"PNG Image",icon:"image",handler:Oe},{format:"svg",label:"SVG Vector",icon:"pen-tool",handler:Rt},{format:"html",label:"HTML Code",icon:"code",handler:Pe}],timeline:[{format:"png",label:"PNG Image",icon:"image",handler:Oe},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],comparison:[{format:"png",label:"PNG Image",icon:"image",handler:Oe},{format:"pdf",label:"PDF Document",icon:"file-text",handler:Ge},{format:"xlsx",label:"Excel Spreadsheet",icon:"table",handler:Ts},{format:"html",label:"HTML Page",icon:"code",handler:Pe}],game:[{format:"html",label:"HTML File",icon:"code",handler:Pe},{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe}],app:[{format:"html",label:"HTML File",icon:"code",handler:Pe},{format:"png",label:"PNG Screenshot",icon:"image",handler:Oe}]},kn={chart:"Chart",table:"Table",dashboard:"Dashboard",visualization:"Visualization",document:"Document",form:"Form",webpage:"Webpage",article:"Article",presentation:"Presentation",infographic:"Infographic",landing:"Landing Page",portfolio:"Portfolio",card:"Card",timeline:"Timeline",comparison:"Comparison",game:"Game",app:"App"};function Cn(t,s){const n=a=>s?s("pptViewer.slideN",{n:a,defaultValue:`Slide ${a}`}):`Slide ${a}`,l=new DOMParser().parseFromString(t,"text/html"),c=[],o=l.querySelector(".presentation-sli
100des-container");if(o){const a=o.querySelectorAll("section.slide");if(a.length>0)return a.forEach((p,i)=>{var b;const m=p.getAttribute("data-slide-title"),x=p.querySelector("h1, h2, .slide-title, .title"),g=m||((b=x==null?void 0:x.textContent)==null?void 0:b.trim())||n(i+1);c.push({id:`slide-${i}`,htmlContent:p.innerHTML,title:g})}),c}let d=l.querySelectorAll(".slide, [data-slide], section.slide, .swiper-slide");if(d.length===0){const a=l.body.querySelector("div");if(a){const p=a.querySelectorAll(":scope > div");p.length>1&&(d=p)}}return d.length>0?d.forEach((a,p)=>{var m;const i=a.querySelector("h1, h2, .slide-title, .title");c.push({id:`slide-${p}`,htmlContent:a.innerHTML||a.outerHTML,title:((m=i==null?void 0:i.textContent)==null?void 0:m.trim())||n(p+1)})}):c.push({id:"slide-0",htmlContent:t,title:n(1)}),c}function $n({initialHtml:t,title:s,onExport:n}){const{t:r}=ve(),[l,c]=u.useState(()=>Cn(t,r)),[o,d]=u.useState(0),[a,p]=u.useState(!1),[i,m]=u.useState(!1),[x,g]=u.useState(100),[b,C]=u.useState(!1),[w,D]=u.useState(!1),[R,B]=u.useState(!1),[,Z]=u.useState(null),M=u.useRef(null),k=u.useRef(null),v=u.useRef(null),S=l[o],J=u.useMemo(()=>{const P=new Date;return`${P.getHours().toString().padStart(2,"0")}:${P.getMinutes().toString().padStart(2,"0")}`},[]),H=u.useCallback(P=>{d(Math.max(0,Math.min(P,l.length-1)))},[l.length]);u.useEffect(()=>{if(M.current){const P=M.current.querySelector(`[data-slide-index="${o}"]`);P&&P.scrollIntoView({behavior:"smooth",block:"nearest"})}},[o]);const f=u.useCallback(()=>{p(!0),d(0)},[]),y=u.useCallback(()=>{i?(v.current&&(clearInterval(v.current),v.current=null),m(!1)):(m(!0),v.current=setInterval(()=>{d(P=>P>=l.length-1?(v.current&&(clearInterval(v.current),v.current=null),m(!1),P):P+1)},3e3))},[i,l.length]),L=u.useCallback(()=>{p(!1),m(!1),v.current&&(clearInterval(v.current),v.current=null)},[]);u.useEffect(()=>()=>{v.current&&clearInterval(v.current)},[]);const E=u.useCallback(P=>{g(A=>Math.max(50,Math.min(200,A+P)))},[]),_=u.useCallback(()=>{const P={id:`slide-${Date.now()}`,htmlContent:` 101 <div class="slide" style="padding: 60px; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);"> 102 <h1 style="font-size: 48px; color: white; margin-bottom: 20px;">${r("preview.newSlideTitle")}</h1> 103 <p style="font-size: 24px; color: rgba(255,255,255,0.8);">${r("preview.newSlideContent")}</p> 104 </div> 105 `,title:`${r("preview.newSlideTitle")} ${l.length+1}`},A=[...l];A.splice(o+1,0,P),c(A),d(o+1)},[l,o,r]),Q=u.useCallback(()=>{if(l.length<=1)return;const P=l.filter((A,T)=>T!==o);c(P),d(Math.max(0,o-1))},[l,o]),$=u.useCallback(()=>{const P=l[o],A={...P,id:`slide-${Date.now()}`,title:`${P.title}${r("preview.duplicateSuffix")}`},T=[...l];T.splice(o+1,0,A),c(T),d(o+1)},[l,o,r]),K=u.useCallback(async P=>{var A,T;B(!0),Z(P),C(!1);try{const I=(await $e(async()=>{const{default:le}=await import("./html2canvas.esm-CBrSDip1.js");return{default:le}},[])).default,V=document.createElement("div");V.style.cssText="position: fixed; left: -9999px; top: 0; width: 1200px; height: 675px;",document.body.appendChild(V);const ie=[];for(let le=0;le<l.length;le++){const be=l[le],ae=document.createElement("iframe");ae.style.cssText="width: 1200px; height: 675px; border: none;",V.innerHTML="",V.appendChild(ae);const pe=ae.contentDocument||((A=ae.contentWindow)==null?void 0:A.document);pe&&(pe.open(),pe.write(` 106 <!DOCTYPE html> 107 <html> 108 <head> 109 <meta charset="UTF-8"> 110 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap" rel="stylesheet"> 111 <style> 112 * { margin: 0; padding: 0; box-sizing: border-box; } 113 html, body { width: 1200px; height: 675px; overflow: hidden; } 114 body { font-family: 'Inter', 'Noto Sans SC', sans-serif; } 115 </style> 116 </head> 117 <body>${be.htmlContent}</body> 118 </html> 119 `),pe.close()),await new Promise(ne=>setTimeout(ne,500));const te=await I(((T=ae.contentDocument)==null?void 0:T.body)||ae,{width:1200,height:675,scale:2,useCORS:!0,allowTaint:!0});ie.push(te.toDataURL("image/png"))}if(document.body.removeChild(V),P==="png")if(ie.length===1){const le=document.createElement("a");le.download=`${s||"slide"}.png`,le.href=ie[0],le.click()}else{const le=(await $e(async()=>{const{default:te}=await import("./jszip.min-CCODYnd_.js").then(ne=>ne.j);return{default:te}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17]))).default,be=ne
119w le;ie.forEach((te,ne)=>{const ee=te.split(",")[1];be.file(`slide-${ne+1}.png`,ee,{base64:!0})});const ae=await be.generateAsync({type:"blob"}),pe=document.createElement("a");pe.download=`${s||"presentation"}-slides.zip`,pe.href=URL.createObjectURL(ae),pe.click(),URL.revokeObjectURL(pe.href)}else if(P==="pdf"){const{jsPDF:le}=await $e(async()=>{const{jsPDF:ae}=await import("./jspdf.es.min-BHjX0qxm.js").then(pe=>pe.j);return{jsPDF:ae}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])),be=new le({orientation:"landscape",unit:"px",format:[1200,675]});ie.forEach((ae,pe)=>{pe>0&&be.addPage([1200,675],"landscape"),be.addImage(ae,"PNG",0,0,1200,675)}),be.save(`${s||"presentation"}.pdf`)}else if(P==="pptx"){const le=(await $e(async()=>{const{default:ae}=await import("./pptxgen.es-CRI-nGi7.js");return{default:ae}},__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17]))).default,be=new le;be.author="UniAI",be.title=s||"Presentation",be.subject="Generated by UniAI",ie.forEach(ae=>{be.addSlide().addImage({data:ae,x:0,y:0,w:"100%",h:"100%"})}),await be.writeFile({fileName:`${s||"presentation"}.pptx`})}n==null||n(P)}catch(I){console.error("Export error:",I),Ne.error(r("preview.exportFailed"))}finally{B(!1),Z(null)}},[l,s,n]);u.useEffect(()=>{const P=A=>{A.key==="ArrowLeft"||A.key==="ArrowUp"?(A.preventDefault(),H(o-1)):A.key==="ArrowRight"||A.key==="ArrowDown"||A.key===" "?(A.preventDefault(),H(o+1)):A.key==="Escape"?(p(!1),m(!1),v.current&&(clearInterval(v.current),v.current=null)):A.key==="Home"?H(0):A.key==="End"&&H(l.length-1)};return window.addEventListener("keydown",P),()=>window.removeEventListener("keydown",P)},[o,H,l.length]);const F=(P,A)=>{const T=o===A;return e.jsxs("div",{"data-slide-index":A,onClick:()=>H(A),className:U("group relative cursor-pointer transition-all duration-200",T&&"scale-[1.02]"),children:[e.jsx("div",{className:U("absolute -left-6 top-1/2 -translate-y-1/2 text-xs font-medium w-5 text-center",T?"text-blue-400":"text-muted-foreground"),children:A+1}),e.jsxs("div",{className:U("relative w-full aspect-[16/9] rounded-md overflow-hidden border-2 transition-all duration-200",T?"border-blue-500 shadow-lg shadow-blue-500/20":"border-transparent hover:border-gray-600"),children:[e.jsx("div",{className:"absolute inset-0 bg-background transform scale-[0.2] origin-top-left",style:{width:"500%",height:"500%"},children:e.jsx("iframe",{srcDoc:` 120 <!DOCTYPE html> 121 <html> 122 <head> 123 <meta charset="UTF-8"> 124 <link rel="preconnect" href="https://fonts.bunny.net"> 125 <link rel="preconnect" href="https://fonts.bunny.net" crossorigin> 126 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet"> 127 <style> 128 * { margin: 0; padding: 0; box-sizing: border-box; } 129 html, body { 130 width: 100%; 131 height: 100%; 132 overflow: hidden; 133 } 134 body { 135 font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif; 136 } 137 </style> 138 </head> 139 <body>${P.htmlContent}</body> 140 </html> 141 `,className:"w-full h-full border-none pointer-events-none",title:`Slide ${A+1}`})}),e.jsxs("div",{className:U("absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-all flex items-center justify-center gap-2 opacity-0 group-hover:opacity-100",T&&"opacity-0 group-hover:opacity-100"),children:[e.jsx("button",{onClick:I=>{I.stopPropagation(),$()},className:"p-1.5 bg-background/90 rounded-full hover:bg-background transition-colors",title:r("preview.duplicateSlide"),children:e.jsx(st,{className:"w-3 h-3 text-foreground"})}),l.length>1&&e.jsx("button",{onClick:I=>{I.stopPropagation(),Q()},className:"p-1.5 bg-background/90 rounded-full hover:bg-background transition-colors",title:r("preview.deleteSlideBtn"),children:e.jsx(Qe,{className:"w-3 h-3 text-red-500"})})]})]})]},P.id)};return a?e.jsxs("div",{className:"fixed inset-0 z-50 bg-black flex items-center justify-center",onClick:()=>H(o+1),children:[e.jsxs("div",{className:"absolute top-0 left-0 right-0 p-4 flex items-center justify-between bg-gradient-to-b from-black/50 to-transparent opacity-0 hover:opacity-100 transition-opacity",children:[e.jsx("div",{className:"text-white/80 text-sm",children:s||r("preview.unnamedPresentation")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:P=>{P.stopPropagation(),y()},className:"p-2 text-white/60 hover:text-white transition-colors rounded-lg hover:bg-background/10",title:r(i?"preview.pauseLabel":"preview.autoPlay"),children:i?e.jsx(Bs,{className:"w-5 h-5"}):e.jsx(Ct,{className:"w-5 h-5"})}),e.jsx("button",{onClick:P=>{P.stopPropagation(),L()},className:"p-2 text-white/60 hover:text-white transition-colors rounded-lg hover:bg-background/10",title:r("preview.exitFullscreen"),children:e.jsx(Ee,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"w-full h-full max-w-[1920px] max-h-[1080px] aspect-video",children:e.jsx("iframe",{srcDoc:` 142 <!DOCTYPE html> 143 <html> 144 <head> 145 <meta charset="UTF-8"> 146 <meta name="viewport" content="width=device-width, initial-scale=1.0">
147 <link rel="preconnect" href="https://fonts.bunny.net"> 148 <link rel="preconnect" href="https://fonts.bunny.net" crossorigin> 149 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=JetBrains+Mono:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&family=Quicksand:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=Playfair+Display:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap" rel="stylesheet"> 150 <script src="https://unpkg.com/lucide@latest"><\/script> 151 <style> 152 * { margin: 0; padding: 0; box-sizing: border-box; } 153 html, body { 154 width: 100%; 155 height: 100%; 156 overflow: hidden; 157 } 158 body { 159 font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif; 160 } 161 </style> 162 </head> 163 <body> 164 ${(S==null?void 0:S.htmlContent)||""} 165 <script> 166 // åå§å Lucide 徿 167 if (typeof lucide !== 'undefined') { 168 lucide.createIcons(); 169 } 170 <\/script> 171 </body> 172 </html> 173 `,className:"w-full h-full border-none",title:"Presentation"})}),e.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 flex gap-2",children:l.map((P,A)=>e.jsx("button",{onClick:T=>{T.stopPropagation(),H(A)},className:U("w-2 h-2 rounded-full transition-all",o===A?"bg-background w-6":"bg-background/40 hover:bg-background/60")},A))}),e.jsxs("div",{className:"absolute bottom-6 right-6 text-white/60 text-sm",children:[o+1," / ",l.length]})]}):e.jsxs("div",{className:U("h-full flex flex-col bg-gray-900",a&&"fixed inset-0 z-50"),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gray-900 border-b border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-sm font-medium text-white truncate max-w-[300px]",children:s||r("preview.unnamedPresentation")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r("preview.lastModified",{time:J})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.shareTitle"),children:e.jsx(Xt,{className:"w-4 h-4"})}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>!R&&C(!b),disabled:R,className:U("p-2 rounded-lg transition-colors",R?"text-blue-400 cursor-not-allowed":"text-muted-foreground/60 hover:text-white hover:bg-gray-800"),title:r("preview.downloadTitle"),children:R?e.jsx(Ve,{className:"w-4 h-4 animate-spin"}):e.jsx(at,{className:"w-4 h-4"})}),b&&!R&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-44 bg-gray-800 rounded-lg shadow-2xl border border-gray-600 py-1 z-50",children:[e.jsxs("button",{onClick:()=>K("pptx"),className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(Bt,{className:"w-4 h-4"}),r("preview.exportAsPptx")]}),e.jsxs("button",{onClick:()=>K("pdf"),className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(Ue,{className:"w-4 h-4"}),r("preview.exportAsPdf")]}),e.jsxs("button",{onClick:()=>K("png"),className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(et,{className:"w-4 h-4"}),r("preview.exportAsImage")]})]})]}),e.jsx("button",{onClick:f,className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.playPresentation"),children:e.jsx(Ct,{className:"w-4 h-4"})}
173),e.jsx("button",{className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.moreOptions"),children:e.jsx(es,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>p(!a),className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors ml-2",title:r(a?"preview.exitFullscreen":"preview.fullscreen"),children:a?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-[140px] bg-gray-900 border-r border-gray-800 flex flex-col shrink-0",children:[e.jsx("div",{ref:M,className:"flex-1 overflow-y-auto py-4 px-3 pl-8 space-y-3 scrollbar-thin scrollbar-track-gray-900 scrollbar-thumb-gray-700",children:l.map((P,A)=>F(P,A))}),e.jsx("div",{className:"p-3 pl-8 border-t border-gray-800",children:e.jsxs("button",{onClick:_,className:"w-full py-2 border border-dashed border-gray-700 rounded-lg text-muted-foreground hover:border-blue-500 hover:text-blue-400 transition-colors flex items-center justify-center gap-1 text-xs",children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),r("preview.addSlideBtn")]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col bg-gray-950 overflow-hidden",children:[e.jsx("div",{ref:k,className:"flex-1 flex items-center justify-center p-8 overflow-auto",children:e.jsx("div",{className:"relative bg-background rounded-lg shadow-2xl overflow-hidden transition-transform duration-200",style:{width:`min(100%, ${960*x/100}px)`,aspectRatio:"16/9",transform:`scale(${x/100})`,transformOrigin:"center center"},children:w?e.jsx("div",{className:"w-full h-full",children:e.jsx("textarea",{defaultValue:S==null?void 0:S.htmlContent,onChange:P=>{const A=[...l];A[o]={...A[o],htmlContent:P.target.value},c(A)},maxLength:2e3,className:"w-full h-full p-4 text-sm font-mono bg-gray-900 text-gray-100 resize-none border-none outline-none"})}):e.jsx("iframe",{srcDoc:` 174 <!DOCTYPE html> 175 <html> 176 <head> 177 <meta charset="UTF-8"> 178 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 179 <link rel="preconnect" href="https://fonts.bunny.net"> 180 <link rel="preconnect" href="https://fonts.bunny.net" crossorigin> 181 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=Poppins:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=JetBrains+Mono:wght@400;500;600;700&family=Nunito:wght@400;500;600;700&family=Quicksand:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=Playfair+Display:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600;700&display=swap" rel="stylesheet"> 182 <script src="https://unpkg.com/lucide@latest"><\/script> 183 <style> 184 * { margin: 0; padding: 0; box-sizing: border-box; } 185 html, body { 186 width: 100%; 187 height: 100%; 188 overflow: hidden; 189 } 190 body { 191 font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif; 192 } 193 </style> 194 </head> 195 <body> 196 ${(S==null?void 0:S.htmlContent)||""} 197 <script> 198 // åå§å Lucide 徿 199 if (typeof lucide !== 'undefined') { 200 lucide.createIcons(); 201 } 202 <\/script> 203 </body> 204 </html> 205 `,className:"w-full h-full border-none",title:"Slide Preview"})})}),e.jsxs("div",{className:"flex items-center justify-between px-6 py-3 bg-gray-900 border-t border-gray-800 shrink-0",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("button",{onClick:()=>D(!w),className:U("flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-lg transition-colors",w?"bg-blue-600 text-white":"text-muted-foreground
205/60 hover:text-white hover:bg-gray-800"),children:w?e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-3.5 h-3.5"}),r("preview.finishEditing")]}):e.jsxs(e.Fragment,{children:[e.jsx(ft,{className:"w-3.5 h-3.5"}),r("preview.editCodeBtn")]})})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>H(o-1),disabled:o===0,className:"p-1.5 text-muted-foreground/60 hover:text-white disabled:text-muted-foreground disabled:cursor-not-allowed transition-colors",children:e.jsx($t,{className:"w-5 h-5"})}),e.jsxs("span",{className:"text-sm text-muted-foreground/60 min-w-[60px] text-center",children:[o+1," / ",l.length]}),e.jsx("button",{onClick:()=>H(o+1),disabled:o===l.length-1,className:"p-1.5 text-muted-foreground/60 hover:text-white disabled:text-muted-foreground disabled:cursor-not-allowed transition-colors",children:e.jsx(ot,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>E(-10),className:"p-1.5 text-muted-foreground/60 hover:text-white transition-colors",title:r("preview.zoomOutTitle"),children:e.jsx(It,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-xs text-muted-foreground min-w-[40px] text-center",children:[x,"%"]}),e.jsx("button",{onClick:()=>E(10),className:"p-1.5 text-muted-foreground/60 hover:text-white transition-colors",title:r("preview.zoomInTitle"),children:e.jsx(At,{className:"w-4 h-4"})})]})]})]})]})]})}function Sn({initialHtml:t,title:s,onExport:n}){const{t:r}=ve(),l=u.useRef(null),[c,o]=u.useState(!1),[d,a]=u.useState(16),[p,i]=u.useState(!1),[m,x]=u.useState(!1),[g,b]=u.useState(100),[C,w]=u.useState([]),[D,R]=u.useState(null),B=u.useMemo(()=>{const F=new Date;return`${F.getHours().toString().padStart(2,"0")}:${F.getMinutes().toString().padStart(2,"0")}`},[]),Z=u.useMemo(()=>l.current?(l.current.textContent||"").replace(/\s/g,"").length:0,[]);u.useEffect(()=>{l.current&&(l.current.innerHTML=t,M())},[t]);const M=u.useCallback(()=>{if(!l.current)return;const F=l.current.querySelectorAll("h1, h2, h3, h4"),P=[];F.forEach((A,T)=>{const I=`heading-${T}`;A.id=I,P.push({id:I,level:parseInt(A.tagName[1]),text:A.textContent||"",element:A})}),w(P)},[]),k=u.useCallback(F=>{F.element.scrollIntoView({behavior:"smooth",block:"start"}),R(F.id)},[]),v=u.useCallback((F,P)=>{var A;document.execCommand(F,!1,P),(A=l.current)==null||A.focus(),setTimeout(M,100)},[M]),S=[{icon:Wr,command:"bold",title:r("preview.boldTitle")},{icon:Vr,command:"italic",title:r("preview.italicTitle")},{icon:Yr,command:"underline",title:r("preview.underlineTitle")},{icon:Zr,command:"strikeThrough",title:r("preview.strikeTitle")}],J=[{icon:er,command:"justifyLeft",title:r("preview.alignLeftTitle")},{icon:Vt,command:"justifyCenter",title:r("preview.alignCenterTitle")},{icon:Kr,command:"justifyRight",title:r("preview.alignRightTitle")},{icon:on,command:"justifyFull",title:r("preview.alignJustifyTitle")}],H=[{icon:Us,command:"insertUnorderedList",title:r("preview.bulletListTitle")},{icon:Hs,command:"insertOrderedList",title:r("preview.numberedListTitle")}],f=u.useCallback(F=>{v("formatBlock",`h${F}`)},[v]),y=u.useCallback(()=>{v("formatBlock","blockquote")},[v]),L=u.useCallback(()=>{const F=prompt(r("preview.insertLinkPrompt"));F&&v("createLink",F)},[v,r]),E=u.useCallback(()=>{const F=prompt(r("preview.insertImagePrompt"));F&&v("insertImage",F)},[v,r]),_=u.useCallback(F=>{a(F),l.current&&(l.current.style.fontSize=`${F}px`)},[]),Q=u.useCallback(F=>{v("foreColor",F),i(!1)},[v]),$=u.useCallback(F=>{b(P=>Math.max(50,Math.min(200,P+F)))},[]),K=["#000000","#434343","#666666","#999999","#cccccc","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#3b82f6","#6366f1","#a855f7","#ec4899","#f43f5e"];return e.jsxs("div",{className:U("h-full flex flex-col bg-gray-900",c&&"fixed inset-0 z-50"),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gray-900 border-b border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ue,{className:"w-5 h-5 text-blue-400"}),e.jsx("h1",{className:"text-sm font-medium text-white truncate max-w-[300px]",children:s||r("preview.unnamedDocument")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r("preview.lastModified",{time:B})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>
205window.print(),className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.printTitle"),children:e.jsx(mr,{className:"w-4 h-4"})}),e.jsx("button",{className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.shareTitle"),children:e.jsx(Xt,{className:"w-4 h-4"})}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>x(!m),className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.downloadTitle"),children:e.jsx(at,{className:"w-4 h-4"})}),m&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-44 bg-gray-800 rounded-lg shadow-xl border border-gray-700 py-1 z-20",children:[e.jsxs("button",{onClick:()=>{n==null||n("docx"),x(!1)},className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(Ue,{className:"w-4 h-4"}),r("preview.exportAsWord")]}),e.jsxs("button",{onClick:()=>{n==null||n("pdf"),x(!1)},className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(Ue,{className:"w-4 h-4"}),r("preview.exportAsPdf")]}),e.jsxs("button",{onClick:()=>{n==null||n("md"),x(!1)},className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(Ue,{className:"w-4 h-4"}),r("preview.exportAsMarkdown")]})]})]}),e.jsx("button",{className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.moreOptions"),children:e.jsx(es,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>o(!c),className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors ml-2",title:r(c?"preview.exitFullscreen":"preview.fullscreen"),children:c?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 px-4 py-2 bg-gray-850 border-b border-gray-800 flex-wrap shrink-0",style:{backgroundColor:"rgb(30, 30, 35)"},children:[e.jsx("button",{onClick:()=>v("undo"),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.undoTitle"),children:e.jsx(ts,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>v("redo"),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.redoTitle"),children:e.jsx(xn,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-2"}),e.jsx("button",{onClick:()=>f(1),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.heading1Title"),children:e.jsx(Qr,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>f(2),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.heading2Title"),children:e.jsx(Xr,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>f(3),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.heading3Title"),children:e.jsx(en,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-2"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(qs,{className:"w-4 h-4 text-muted-foreground"}),e.jsx(ut,{value:String(d),onChange:F=>_(parseInt(F)),options:[12,14,16,18,20,24,28,32,36,48].map(F=>({value:String(F),label:String(F)})),className:"w-20"})]}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-2"}),S.map(({icon:F,command:P,title:A})=>e.jsx("button",{onClick:()=>v(P),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:A,children:e.jsx(F,{className:"w-4 h-4"})},P)),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>i(!p),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.fontColorTitle"),children:e.jsx(Gs,{className:"w-4 h-4"})}),p&&e.jsx("div",{className:"absolute top-full left-0 mt-1 p-2 bg-gray-800 rounded-lg shadow-xl border border-gray-700 z-10",children:e.jsx("div",{className:"grid grid-cols-5 ga
205p-1",children:K.map(F=>e.jsx("button",{onClick:()=>Q(F),className:"w-6 h-6 rounded border border-gray-600 hover:scale-110 transition-transform",style:{backgroundColor:F}},F))})})]}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-2"}),J.map(({icon:F,command:P,title:A})=>e.jsx("button",{onClick:()=>v(P),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:A,children:e.jsx(F,{className:"w-4 h-4"})},P)),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-2"}),H.map(({icon:F,command:P,title:A})=>e.jsx("button",{onClick:()=>v(P),className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:A,children:e.jsx(F,{className:"w-4 h-4"})},P)),e.jsx("button",{onClick:y,className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.quoteTitle"),children:e.jsx(Ws,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-2"}),e.jsx("button",{onClick:L,className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.insertLinkTitle"),children:e.jsx(ss,{className:"w-4 h-4"})}),e.jsx("button",{onClick:E,className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.insertImageTitle"),children:e.jsx(et,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-[200px] bg-gray-900 border-r border-gray-800 flex flex-col shrink-0",children:[e.jsx("div",{className:"px-4 py-3 border-b border-gray-800",children:e.jsx("h3",{className:"text-xs font-medium text-muted-foreground/60 uppercase tracking-wider",children:r("preview.documentOutline")})}),e.jsx("div",{className:"flex-1 overflow-y-auto py-2 scrollbar-thin scrollbar-track-gray-900 scrollbar-thumb-gray-700",children:C.length>0?e.jsx("div",{className:"space-y-0.5",children:C.map(F=>e.jsxs("button",{onClick:()=>k(F),className:U("w-full text-left px-4 py-2 text-sm transition-colors flex items-center gap-2",D===F.id?"bg-blue-600/20 text-blue-400 border-l-2 border-blue-500":"text-muted-foreground/60 hover:text-white hover:bg-gray-800"),style:{paddingLeft:`${16+(F.level-1)*12}px`},children:[e.jsx(ot,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:F.text||r("preview.noHeadingTitle")})]},F.id))}):e.jsxs("div",{className:"px-4 py-8 text-center text-muted-foreground text-sm",children:[e.jsx("p",{children:r("preview.noOutline")}),e.jsx("p",{className:"mt-1 text-xs",children:r("preview.noOutlineHint")})]})}),e.jsx("div",{className:"px-4 py-3 border-t border-gray-800",children:e.jsx("div",{className:"text-xs text-muted-foreground",children:e.jsx("span",{children:r("preview.wordCountStat",{count:Z})})})})]}),e.jsxs("div",{className:"flex-1 flex flex-col bg-gray-950 overflow-hidden",children:[e.jsx("div",{className:"flex-1 overflow-auto p-8",children:e.jsx("div",{className:"mx-auto bg-background shadow-2xl rounded-lg transition-transform duration-200",style:{width:`min(100%, ${816*g/100}px)`,minHeight:`${1056*g/100}px`,transform:`scale(${g/100})`,transformOrigin:"top center"},children:e.jsx("div",{ref:l,contentEditable:!0,suppressContentEditableWarning:!0,className:"p-12 min-h-[1056px] outline-none prose prose-lg max-w-none",style:{fontSize:`${d}px`,lineHeight:"1.8"},onInput:M})})}),e.jsxs("div",{className:"flex items-center justify-between px-6 py-2 bg-gray-900 border-t border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsx("span",{children:r("preview.pageInfo")}),e.jsx("span",{children:"|"}),e.jsx("span",{children:r("preview.wordCountStat",{count:Z})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>$(-10),className:"p-1 text-muted-foreground/60 hover:text-white transition-colors",title:r("preview.zoomOutTitle"),children:e.jsx(It,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-xs text-muted-foreground min-w-[40px] text-center",children:[g,"%"]}),e.jsx("button",{onClick:()=>
205$(10),className:"p-1 text-muted-foreground/60 hover:text-white transition-colors",title:r("preview.zoomInTitle"),children:e.jsx(At,{className:"w-4 h-4"})})]})]})]})]})]})}function Tn(t){const r=new DOMParser().parseFromString(`<div>${t}</div>`,"text/html").querySelectorAll("table"),l=[];return r.forEach((c,o)=>{var g,b;const d=[],a=[],i=((b=(g=c.querySelector("caption"))==null?void 0:g.textContent)==null?void 0:b.trim())||`Sheet ${o+1}`;if(c.querySelectorAll("thead th, thead td, tr:first-child th").forEach(C=>{var w;d.push(((w=C.textContent)==null?void 0:w.trim())||"")}),d.length===0){const C=c.querySelector("tr");C&&C.querySelectorAll("th, td").forEach(w=>{var D;d.push(((D=w.textContent)==null?void 0:D.trim())||"")})}c.querySelectorAll("tbody tr, tr:not(:first-child)").forEach(C=>{const w=[];C.querySelectorAll("td, th").forEach(D=>{var R;w.push(((R=D.textContent)==null?void 0:R.trim())||"")}),w.length>0&&!w.every(D=>d.includes(D))&&a.push(w)}),d.length>0&&(a.length===0&&a.push(new Array(d.length).fill("")),l.push({id:`sheet-${o}`,name:i,headers:d,rows:a}))}),l.length===0&&l.push({id:"sheet-0",name:"Sheet 1",headers:["A","B","C","D","E"],rows:[["","","","",""],["","","","",""],["","","","",""],["","","","",""],["","","","",""]]}),l}function Ls(t){let s="";for(;t>=0;)s=String.fromCharCode(65+t%26)+s,t=Math.floor(t/26)-1;return s}function Rn({initialHtml:t,title:s,onExport:n}){var le,be,ae,pe,te,ne,ee;const{t:r}=ve(),[l,c]=u.useState(()=>Tn(t)),[o,d]=u.useState(0),[a,p]=u.useState(null),[i,m]=u.useState(null),[x,g]=u.useState(!1),[b,C]=u.useState(""),[w,D]=u.useState(null),[R,B]=u.useState(100),[Z,M]=u.useState(!1),[k,v]=u.useState(""),S=u.useRef(null),J=u.useRef(null),H=l[o],f=u.useMemo(()=>{const q=new Date;return`${q.getHours().toString().padStart(2,"0")}:${q.getMinutes().toString().padStart(2,"0")}`},[]);u.useEffect(()=>{i&&S.current&&(S.current.focus(),S.current.select())},[i]),u.useEffect(()=>{var q;a?a.row===-1?v(H.headers[a.col]||""):v(((q=H.rows[a.row])==null?void 0:q[a.col])||""):v("")},[a,H]);const y=u.useCallback((q,O)=>{p({row:q,col:O})},[]),L=u.useCallback((q,O)=>{m({row:q,col:O}),p({row:q,col:O})},[]),E=u.useCallback(()=>{m(null)},[]),_=u.useCallback((q,O,z)=>{c(se=>se.map((ce,fe)=>fe!==o?ce:q===-1?{...ce,headers:ce.headers.map((Ce,_e)=>_e===O?z:Ce)}:{...ce,rows:ce.rows.map((Ce,_e)=>_e===q?Ce.map((Fe,Re)=>
205Re===O?z:Fe):Ce)})),v(z)},[o]),Q=u.useCallback(q=>{const O=new Array(H.headers.length).fill("");c(z=>z.map((se,ce)=>{if(ce!==o)return se;const fe=q!==void 0?q+1:se.rows.length;return{...se,rows:[...se.rows.slice(0,fe),O,...se.rows.slice(fe)]}}))},[(le=H==null?void 0:H.headers)==null?void 0:le.length,o]),$=u.useCallback(q=>{H.rows.length<=1||(c(O=>O.map((z,se)=>se!==o?z:{...z,rows:z.rows.filter((ce,fe)=>fe!==q)})),p(null),m(null))},[(be=H==null?void 0:H.rows)==null?void 0:be.length,o]),K=u.useCallback(q=>{c(O=>O.map((z,se)=>{if(se!==o)return z;const ce=q!==void 0?q+1:z.headers.length,fe=Ls(z.headers.length);return{...z,headers:[...z.headers.slice(0,ce),fe,...z.headers.slice(ce)],rows:z.rows.map(Ce=>[...Ce.slice(0,ce),"",...Ce.slice(ce)])}}))},[o]),F=u.useCallback(q=>{H.headers.length<=1||(c(O=>O.map((z,se)=>se!==o?z:{...z,headers:z.headers.filter((ce,fe)=>fe!==q),rows:z.rows.map(ce=>ce.filter((fe,Ce)=>Ce!==q))})),p(null),m(null))},[(ae=H==null?void 0:H.headers)==null?void 0:ae.length,o]),P=u.useCallback(()=>{const q={id:`sheet-${Date.now()}`,name:`Sheet ${l.length+1}`,headers:["A","B","C","D","E"],rows:[["","","","",""],["","","","",""],["","","","",""]]};c(O=>[...O,q]),d(l.length)},[l.length]),A=u.useCallback(q=>{l.length<=1||(c(O=>O.filter((z,se)=>se!==q)),d(Math.max(0,o-1)))},[l.length,o]),T=u.useCallback(q=>{const O=(w==null?void 0:w.col)===q&&w.direction==="asc"?"desc":"asc";D({col:q,direction:O}),c(z=>z.map((se,ce)=>ce!==o?se:{...se,rows:[...se.rows].sort((fe,Ce)=>{const _e=fe[q]||"",Fe=Ce[q]||"",Re=parseFloat(_e),ue=parseFloat(Fe);return!isNaN(Re)&&!isNaN(ue)?O==="asc"?Re-ue:ue-Re:O==="asc"?_e.localeCompare(Fe):Fe.localeCompare(_e)})}))},[w,o]),I=u.useCallback(q=>{B(O=>Math.max(50,Math.min(200,O+q)))},[]),V=u.useMemo(()=>b?(H==null?void 0:H.rows.filter(q=>q.some(O=>O.toLowerCase().includes(b.toLowerCase()))))||[]:(H==null?void 0:H.rows)||[],[H==null?void 0:H.rows,b]);u.useEffect(()=>{const q=O=>{if(!a||i)return;const{row:z,col:se}=a;switch(O.key){case"ArrowUp":O.preventDefault(),z>-1&&p({row:z-1,col:se});break;case"ArrowDown":O.preventDefault(),z<H.rows.length-1&&p({row:z+1,col:se});break;case"ArrowLeft":O.preventDefault(),se>0&&p({row:z,col:se-1});break;case"ArrowRight":O.preventDefault(),se<H.headers.length-1&&p({row:z,col:se+1});break;case"Enter":O.preventDefault(),L(z,se);break;case"Delete":case"Backspace":O.preventDefault(),_(z,se,"");break}};return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[a,i,(pe=H==null?void 0:H.rows)==null?void 0:pe.length,(te=H==null?void 0:H.headers)==null?void 0:te.length,L,_]);const ie=(q,O,z)=>{const se=(a==null?void 0:a.row)===O&&(a==null?void 0:a.col)===z,ce=(i==null?void 0:i.row)===O&&(i==null?void 0:i.col)===z;return e.jsx("td",{onClick:()=>y(O,z),onDoubleClick:()=>L(O,z),className:U("border-r border-b border-gray-700 px-2 py-1.5 cursor-cell transition-colors relative text-sm","bg-gray-900 text-gray-200",se&&"bg-blue-900/50 ring-2 ring-blue-500 ring-inset z-10",!ce&&!se&&"hover:bg-gray-800"),style:{minWidth:"80px",maxWidth:"200px"},children:ce?e.jsx("input",{ref:S,type:"text",value:q,onChange:fe=>_(O,z,fe.target.value),onBlur:E,maxLength:1e3,onKeyDown:fe=>{fe.key==="Enter"&&!fe.nativeEvent.isComposing&&(E(),O<H.rows.length-1&&p({row:O+1,col:z})),fe.key==="Tab"&&(fe.preventDefault(),E(),z<H.headers.length-1&&p({row:O,col:z+1})),fe.key==="Escape"&&E()},className:"w-full h-full absolute inset-0 px-2 py-1.5 outline-none bg-blue-900 text-white text-sm"}):e.jsx("span",{className:"block truncate",children:q})},z)};return e.jsxs("div",{className:U("h-full flex flex-col bg-gray-900",x&&"fixed inset-0 z-50"),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-gray-900 border-b border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Dt,{className:"w-5 h-5 text-green-400"}),e.jsx("h1",{className:"text-sm font-medium text-white truncate max-w-[300px]",children:s||r("preview.unnamedTable")}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r("preview.lastModified",{time:f})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{className:"p-2 text-muted-foreground
205/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.shareTitle"),children:e.jsx(Xt,{className:"w-4 h-4"})}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>M(!Z),className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.downloadTitle"),children:e.jsx(at,{className:"w-4 h-4"})}),Z&&e.jsxs("div",{className:"absolute right-0 top-full mt-1 w-44 bg-gray-800 rounded-lg shadow-xl border border-gray-700 py-1 z-20",children:[e.jsxs("button",{onClick:()=>{n==null||n("xlsx"),M(!1)},className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(Dt,{className:"w-4 h-4"}),r("preview.exportAsExcel")]}),e.jsxs("button",{onClick:()=>{n==null||n("csv"),M(!1)},className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(St,{className:"w-4 h-4"}),r("preview.exportAsCsv")]}),e.jsxs("button",{onClick:()=>{n==null||n("json"),M(!1)},className:"w-full px-4 py-2 text-left text-sm text-gray-300 hover:bg-gray-700 hover:text-white flex items-center gap-2",children:[e.jsx(Dt,{className:"w-4 h-4"}),r("preview.exportAsJson")]})]})]}),e.jsx("button",{className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors",title:r("preview.moreOptions"),children:e.jsx(es,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>g(!x),className:"p-2 text-muted-foreground/60 hover:text-white hover:bg-gray-800 rounded-lg transition-colors ml-2",title:r(x?"preview.exitFullscreen":"preview.fullscreen"),children:x?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-gray-850 border-b border-gray-800 shrink-0",style:{backgroundColor:"rgb(30, 30, 35)"},children:[e.jsxs("button",{onClick:()=>Q(a==null?void 0:a.row),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.addRowTitle"),children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),r("preview.addRowBtn")]}),e.jsxs("button",{onClick:()=>K(a==null?void 0:a.col),className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.addColumnTitle"),children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),r("preview.addColumnBtn")]}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),a&&a.row>=0&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>$(a.row),disabled:H.rows.length<=1,className:"flex items-center gap-1 px-2 py-1 text-xs text-red-400 hover:text-red-300 hover:bg-gray-700 rounded disabled:opacity-50 disabled:cursor-not-allowed",title:r("preview.deleteRowTitle"),children:e.jsx(Qe,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>F(a.col),disabled:H.headers.length<=1,className:"flex items-center gap-1 px-2 py-1 text-xs text-red-400 hover:text-red-300 hover:bg-gray-700 rounded disabled:opacity-50 disabled:cursor-not-allowed",title:r("preview.deleteColumnTitle"),children:e.jsx(Qe,{className:"w-3.5 h-3.5"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"})]}),e.jsx("button",{className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.copyTitle"),children:e.jsx(st,{className:"w-4 h-4"})}),e.jsx("button",{className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.pasteTitle"),children:e.jsx(cn,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-gray-700 mx-1"}),e.jsx("button",{className:"p-1.5 text-muted-foreground/60 hover:text-white hover:bg-gray-700 rounded",title:r("preview.filterTitle"),children:e.jsx(tn,{className:"w-4 h-4"})}),e.jsxs("div",{className:"relative ml-auto",children:[e.jsx(xr,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx("input",{type:"text",value:b,onChange:q=>C(q.target.value),placeholder:r("preview.searchPlaceholder"),maxLength:200,className:"pl-7 pr-3 py-1 text-xs bg-gray-800 text-gray-300 border border-gray-700 rounded w-40 placeholder-gray-600"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5 bg-gray-900 border-b border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground min-w-[60px]",children:[e.jsx(Xs,{className:"w-3.5 h-3.5"}),a&&e.jsxs("span",{className:"font-mono",children:[Ls(a.col),a.row>=0?a.row+1:""]})]}),e.jsx("div",{className:"w-px h-4 bg-gray-700"}),e.jsx("input",{type:"text",value:k,onChange:q=>{a&&_(a.row,a.col,q.target.value)},maxLength:1e3,className:"flex-1 px-2 py-1 text-sm bg-gray-800 text-gray-200 border border-gray-700 rounded font-mono",placeholder:r("preview.cellSelectPlaceholder")})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden min-h-0",children:[e.jsxs("div",{className:"w-[160px] bg-gray-900 border-r border-gray-800 flex flex-col shrink-0",children:[e.jsx("div",{className:"px-4 py-3 border-b border-gray-800",children:e.jsx("h3",{className:"text-xs font-medium text-muted-foreground
205/60 uppercase tracking-wider",children:r("preview.worksheetsLabel")})}),e.jsx("div",{className:"flex-1 overflow-y-auto py-2 scrollbar-thin scrollbar-track-gray-900 scrollbar-thumb-gray-700",children:l.map((q,O)=>e.jsxs("button",{onClick:()=>d(O),className:U("w-full text-left px-4 py-2.5 text-sm transition-colors flex items-center justify-between group",o===O?"bg-green-600/20 text-green-400 border-l-2 border-green-500":"text-muted-foreground/60 hover:text-white hover:bg-gray-800"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ot,{className:"w-3 h-3 shrink-0"}),e.jsx("span",{className:"truncate",children:q.name})]}),l.length>1&&e.jsx("button",{onClick:z=>{z.stopPropagation(),A(O)},className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-gray-700 rounded transition-opacity",children:e.jsx(Ee,{className:"w-3 h-3 text-muted-foreground hover:text-red-400"})})]},q.id))}),e.jsx("div",{className:"p-3 border-t border-gray-800",children:e.jsxs("button",{onClick:P,className:"w-full py-2 border border-dashed border-gray-700 rounded-lg text-muted-foreground hover:border-green-500 hover:text-green-400 transition-colors flex items-center justify-center gap-1 text-xs",children:[e.jsx(Be,{className:"w-3.5 h-3.5"}),r("preview.addWorksheet")]})})]}),e.jsxs("div",{className:"flex-1 flex flex-col bg-gray-950 overflow-hidden",children:[e.jsx("div",{ref:J,className:"flex-1 overflow-auto",style:{transform:`scale(${R/100})`,transformOrigin:"top left"},children:e.jsxs("table",{className:"border-collapse min-w-full",children:[e.jsx("thead",{className:"sticky top-0 z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"border-r border-b border-gray-700 bg-gray-800 px-2 py-1.5 text-xs text-muted-foreground w-12 sticky left-0 z-20",children:"#"}),H==null?void 0:H.headers.map((q,O)=>e.jsx("th",{onClick:()=>y(-1,O),onDoubleClick:()=>L(-1,O),className:U("border-r border-b border-gray-700 bg-gray-800 px-2 py-1.5 text-xs font-medium cursor-pointer group",(a==null?void 0:a.row)===-1&&(a==null?void 0:a.col)===O&&"bg-blue-900/50 ring-2 ring-blue-500 ring-inset"),children:e.jsxs("div",{className:"flex items-center justify-between gap-1 text-muted-foreground/60",children:[(i==null?void 0:i.row)===-1&&(i==null?void 0:i.col)===O?e.jsx("input",{ref:S,type:"text",value:q,onChange:z=>_(-1,O,z.target.value),onBlur:E,maxLength:200,onKeyDown:z=>{(z.key==="Enter"&&!z.nativeEvent.isComposing||z.key==="Escape")&&E()},className:"w-full outline-none bg-transparent text-white"}):e.jsx("span",{className:"truncate",children:q}),e.jsx("button",{onClick:z=>{z.stopPropagation(),T(O)},className:"opacity-0 group-hover:opacity-100 p-0.5 hover:bg-gray-700 rounded transition-opacity",children:(w==null?void 0:w.col)===O?w.direction==="asc"?e.jsx(Cs,{className:"w-3 h-3"}):e.jsx(dn,{className:"w-3 h-3"}):e.jsx(Cs,{className:"w-3 h-3 text-muted-foreground"})})]})},O))]})}),e.jsx("tbody",{children:V.map((q,O)=>e.jsxs("tr",{children:[e.jsx("td",{className:"border-r border-b border-gray-700 bg-gray-800 px-2 py-1.5 text-xs text-muted-foreground text-center sticky left-0",children:O+1}),q.map((z,se)=>ie(z,O,se))]},O))})]})}),e.jsxs("div",{className:"flex items-center justify-between px-6 py-2 bg-gray-900 border-t border-gray-800 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[e.jsx("span",{children:r("preview.rowColStat",{rows:((ne=H==null?void 0:H.rows)==null?void 0:ne.length)||0,cols:((ee=H==null?void 0:H.headers)==null?void 0:ee.length)||0})}),b&&e.jsx("span",{children:r("preview.filteredRowsStat",{count:V.length})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>I(-10),className:"p-1 text-muted-foreground/60 hover:text-white transition-colors",title:r("preview.zoomOutTitle"),children:e.jsx(It,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-xs text-muted-foreground min-w-[40px] text-center",children:[R,"%"]}),e.jsx("button",{onClick:()=>I(10),className:"p-1 text-muted-foreground/60 hover:text-white transition-colors",title:r("preview.zoomInTitle"),children:e.jsx(At,{className:"w-4 h-4"})})]})]})]})]})]})}function Dn(t){switch(t){case"presentation":return"presentation";case"document":case"article":return"document";case"table":case"comparison":return"table";default:return"default"}}function Ln({artifact:t}){const{t:s}=ve(),n=u.useRef(null),r=u.useMemo(()=>Dn(t.contentType),[t.contentType]),[l,c]=u.useState(()=>r!=="default"?"edit":"preview"),[o,d]=u.useState("html"),[a,p]=u.useState(!1),[i,m]=u.useState(null),[x,g]=u.useState(null),[b,C]=u.useState(null),[w,D]=u.useState(!1),{copy:R,copied:B}=vt(),Z=u.useMemo(()=>Ds[t.contentType]||Ds.webpage,[t.contentType]),M=kn[t.contentType]||t.contentType,k=u.useMemo(()=>` 206<!DOCTYPE html> 207<html lang="zh-CN"> 208<head> 209 <meta charset="UTF-8"> 210 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 211 <title>${t.title}</title> 212 213 <!-- é¢å è½½çåº --> 214 <script src="https://cdn.sheetjs.com/xlsx-0.20.0/package/dist/xlsx.full.min.js"><\/script> 215 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.umd.min.js"><\/script> 216 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"><\/script> 217 <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"><\/script> 218 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/html2canvas.min.js"><\/script> 219 <script src="https://unpkg.com/lucide@latest"><\/script> 220 221 <!-- Google Fonts -->
222 <link rel="preconnect" href="https://fonts.bunny.net"> 223 <link rel="preconnect" href="https://fonts.bunny.net" crossorigin> 224 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap" rel="stylesheet"> 225 226 <style> 227 * { 228 margin: 0; 229 padding: 0; 230 box-sizing: border-box; 231 } 232 body { 233 font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; 234 padding: 16px; 235 background: #ffffff; 236 color: #1a1a1a; 237 } 238 ${t.code.css||""} 239 </style> 240</head> 241<body> 242 ${t.code.html} 243 244 <script> 245 ${t.code.js||""} 246 247 // åå§å Lucide 徿 248 if (typeof lucide !== 'undefined') { 249 lucide.createIcons(); 250 } 251 252 // ç嬿¥èªç¶çªå£çæ¶æ¯ 253 window.addEventListener('message', function(event) { 254 if (event.data && event.data.type === 'download') { 255 const format = event.data.format; 256 const fnName = 'download' + format.charAt(0).toUpperCase() + format.slice(1); 257 if (typeof window[fnName] === 'function') { 258 window[fnName](); 259 } else if (typeof window.downloadFile === 'function') { 260 window.downloadFile(format); 261 } 262 } 263 }); 264 265 // éç¥ç¶çªå£å è½½å®æ 266 window.parent.postMessage({ type: 'loaded' }, '*'); 267 <\/script> 268</body> 269</html> 270 `,[t]),v=u.useCallback(async _=>{m(_.format),C(null),p(!1);try{await _.handler(t,n.current),g(_.format),setTimeout(()=>g(null),2e3)}catch(Q){console.error("Export failed:",Q),C(Q instanceof Error?Q.message:s("preview.exportFailed")),setTimeout(()=>C(null),3e3)}finally{m(null)}},[t]),S=u.useCallback(()=>{const _=o==="html"?t.code.html:o==="css"?t.code.css||"":t.code.js||"";R(_)},[o,t.code,R]),J=u.useCallback(()=>{D(_=>!_)},[]),H=u.useCallback(()=>{c("edit"),D(!0)},[]),f=u.useCallback(()=>{c("preview"),D(!1)},[]),y=u.useMemo(()=>[{id:"html",label:"HTML",hasContent:!0},{id:"css",label:"CSS",hasContent:!!t.code.css},{id:"js",label:"JavaScript",hasContent:!!t.code.js}].filter(Q=>Q.hasContent),[t.code]),L=u.useMemo(()=>t.code[o]||"",[t.code,o]),E=()=>{const _=Q=>{const $=Z.find(K=>K.format===Q);$&&v($)};switch(r){case"presentation":return e.jsx($n,{initialHtml:t.code.html,title:t.title,onExport:_});case"document":return e.jsx(Sn,{initialHtml:t.code.html,title:t.title,onExport:_});case"table":return e.jsx(Rn,{initialHtml:t.code.html,title:t.title,onExport:_});default:return e.jsxs("div",{className:"h-full flex flex-col bg-gray-900",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-800 border-b border-gray-700",children:[e.jsx("span",{className:"text-sm text-gray-300",children:s("preview.codeEditMode")}),e.jsxs("button",{onClick:f,className:"flex items-center gap-1 px-3 py-1.5 text-xs text-gray-300 hover:text-white hover:bg-gray-700 rounded",children:[e.jsx(Ee,{className:"w-3.5 h-3.5"}),s("preview.exitEditBtn")]})]}),e.jsx("div",{className:"flex-1 p-4 overflow-auto",children:e.jsx("textarea",{value:t.code.html,readOnly:!0,maxLength:1e4,className:"w-full h-full p-4 text-sm font-mono bg-gray-800 text-gray-100 rounded resize-none"})})]})}};return l==="edit"?e.jsx("div",{className:"h-full",children:E()}):e.jsxs("div",{className:U("h-full flex flex-col bg-background rounded-lg border border-border overflow-hidden",w&&"fixed inset-0 z-50 rounded-none border-none"),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/50 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground px-2 py-1 bg-muted rounded",children:M}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate max-w-[200px]",children:t.title})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center bg-muted rounded-md p-0.5",children:[e.jsxs("button",{onClick:()=>c("preview"),className:U("flex items-center gap-1 px-2 py-1 text-xs font-medium rounded transition-colors",l==="preview"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Pt,{className:"w-3.5 h-3.5"}),s("preview.previewMode")]}),e.jsxs("button",{onClick:()=>c("code"),className:U("flex items-center gap-1 px-2 py-1 text-xs font-medium rounded transition-colors",l==="code"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Jt,{className:"w-3.5 h-3.5"}),s("preview.codeMode")]})]}),r!=="default"&&e.jsxs("button",{onClick:H,className:"flex items-center gap-1 px-2 py-1.5 text-xs font-medium text-blue-600 dar
270k:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-500/10 rounded transition-colors",title:"Visual Editor",children:[e.jsx(ft,{className:"w-3.5 h-3.5"}),s("preview.editContentBtn")]}),e.jsx("button",{onClick:J,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors",title:s(w?"preview.exitFullscreen":"preview.fullscreen"),children:w?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>p(!a),className:U("flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded-md transition-colors","bg-blue-600 text-white hover:bg-blue-700",i&&"opacity-75 cursor-not-allowed"),disabled:!!i,children:[i?e.jsx(Ve,{className:"w-3.5 h-3.5 animate-spin"}):x?e.jsx(Me,{className:"w-3.5 h-3.5"}):e.jsx(at,{className:"w-3.5 h-3.5"}),s("preview.exportBtn"),e.jsx(gt,{className:"w-3 h-3"})]}),a&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-48 bg-background rounded-lg shadow-lg border border-border py-1 z-10",children:Z.map(_=>e.jsxs("button",{onClick:()=>v(_),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-muted transition-colors",children:[e.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-muted-foreground/60",children:i===_.format?e.jsx(Ve,{className:"w-3.5 h-3.5 animate-spin"}):x===_.format?e.jsx(Me,{className:"w-3.5 h-3.5 text-green-500"}):e.jsx(at,{className:"w-3.5 h-3.5"})}),_.label]},_.format))})]})]})]}),b&&e.jsx("div",{className:"px-4 py-2 bg-red-500/10 border-b border-red-500/20 text-sm text-red-600 dark:text-red-400 shrink-0",children:b}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:l==="preview"?e.jsx("iframe",{ref:n,srcDoc:k,sandbox:"allow-scripts allow-downloads allow-same-origin",className:"w-full h-full border-none bg-background",title:t.title}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-1 px-4 py-2 border-b border-border bg-muted/50 shrink-0",children:[y.map(_=>e.jsx("button",{onClick:()=>d(_.id),className:U("px-3 py-1 text-xs font-medium rounded transition-colors",o===_.id?"bg-gray-800 text-white":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:_.label},_.id)),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:S,className:"flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors",children:B?e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-3.5 h-3.5 text-green-500"}),s("preview.copiedLabel")]}):e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-3.5 h-3.5"}),s("preview.copyLabel")]})})]}),e.jsx("div",{className:"flex-1 overflow-hidden min-h-0",children:e.jsx("pre",{className:"h-full p-4 text-sm font-mono bg-gray-900 overflow-auto",children:e.jsx("code",{className:"text-gray-100 whitespace-pre-wrap break-words",children:L})})})]})})]})}function zn({artifact:t}){const{t:s}=ve(),n=()=>{switch(t.searchType){case"images":return e.jsx(et,{className:"w-5 h-5"});case"news":return e.jsx(hr,{className:"w-5 h-5"});case"videos":return e.jsx(xs,{className:"w-5 h-5"});default:return e.jsx(yt,{className:"w-5 h-5"})}},r=()=>e.jsx("div",{className:"space-y-4",children:t.results.map((d,a)=>e.jsx("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"block p-4 rounded-lg border border-border hover:border-primary/50 hover:bg-secondary/30 transition-all group",children:e.jsxs("div",{className:"flex items-start gap-3",children:[d.thumbnail&&e.jsx("img",{src:d.thumbnail,alt:"",className:"w-16 h-16 rounded object-cover flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium text-primary group-hover:underline line-clamp-2",children:d.title}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:[d.source||new URL(d.url).hostname,d.date&&` · ${d.date}`]}),d.snippet&&e.jsx("p",{className:"text-sm text-muted-foreground mt-2 line-clamp-2",children:d.snippet})]}),e.jsx(Yt,{className:"w-4 h-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})},a))}),l=()=>e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:t.results.map((d,a)=>e.jsxs("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"group relative aspect-square rounded-lg overflow-hidden border border-border hover:border-primary/50 transition-all",children:[e.jsx("img",{src:d.thumbnail||d.url,alt:d.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"}),e.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("p",{className:"text-xs text-white line-clamp-2",children:d.title})})]},a))}),c=()=>e.jsx("div",{className:"space-y-4",children:t.results.map((d,a)=>e.jsxs("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"flex gap-4 p-4 rounded-lg border border-border hover:border-primary/50 hover:bg-secondary/30 transition-all group",children:[d.thumbnail&&e.jsx("img",{src:d.thumbnail,alt:"",className:"w-24 h-20 rounded object-cover flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium group-hover:text-primary line-clamp-2",children:d.title}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[d.source,d.date&&` · ${d.date}`]}),d.snippet&&e.jsx("p",{className:"text-sm text-muted-foreground mt-2 line-clamp-2",children:d.snippet})]})]},a))}),o=()=>e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:t.results.map((d,a)=>e.jsxs("a",{href:d.url,target:"_blank",rel:"noopener noreferrer",className:"group rounded-lg border border-border hover:border-primary/50 overflow-hidden transition-all",children:[e.jsxs("div",{className:"relative aspect-video bg-secondary",children:[d.thumbnail?e.jsx("img",{src:d.thumbnail,alt:"",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(xs,{className:"w-12 h-12 text-muted-foreground"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-background/90 flex items-center justify-center",children:e.jsx("div",{className:"w-0 h-0 border-t-6 border-b-6 border-l-10 border-transparent border-l-black ml-1"})})})]}),e.jsxs("div",{className:"p-3",children:[e.jsx("h4",{className:"font-medium line-clamp-2 group-hover:text-primary",children:d.title}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.source})]})]},a))});return e.jsxs("div",{className:"h-full overflow-auto p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4 pb-4 border-b border-border",children:[n(),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[s("preview.searchQueryLabel",{query:t.query}),t.totalResults&&s("preview.searchResultCount",{count:t.totalResults})]})]}),t.searchType==="images"&&l(),t.searchType==="news"&&c(),t.searchType==="videos"&&o(),t.searchType==="web"&&r(),t.results.length===0&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:s("preview.noResultsLabel")})]})}function zs({img:t,className:s,transform:n,overrideSrc:r}){const l=Ut(t.assetId,void 0,t.thumbnail||t.url);return e.jsx("img",{src:r||l||t.url,alt:t.alt||"",className:s,style:n?{transform:n}:void 0})}function En({artifact:t}){const[s,n]=u.useState(0),[r,l]=u.useState(1),[c,o]=u.useState(0),d=t.images[s],a=t.images.length>1,[p,i]=u.useState(null);u.useEffect(()=>{i(null)},[s]);const m=!p&&((d==null?void 0:d.assetState)==="in_recycle_bin"||(d==null?void 0:d.assetState)==="hard_deleted"),x=()=>{n(R=>(R-1+t.images.length)%t.images.length),b()},g=()=>{n(R=>(R+1)%t.images.length),b()},b=()=>{l(1),o(0)},C=()=>l(R=>Math.min(R+.25,3)),w=()=>l(R=>Math.max(R-.25,.5)),D=()=>o(R=>(R+90)%360);return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-1 relative overflow-hidden bg-secondary/30 flex items-center justify-center",children:[m?e.jsx(Vs,{data:{assetState:d.assetState,recycleBinDaysLeft:d.recycleBinDaysLeft},contentWidth:"100%",contentHeight:"100%",assetId:d.assetId,onRestored:async()=>
270{if(d.assetId)try{i(await Et.getUrl(d.assetId))}catch{}}}):e.jsx(zs,{img:d,overrideSrc:p||void 0,className:"max-w-full max-h-full object-contain transition-transform duration-200",transform:`scale(${r}) rotate(${c}deg)`}),a&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:x,className:"absolute left-4 top-1/2 -translate-y-1/2 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors",children:e.jsx($t,{className:"w-6 h-6"})}),e.jsx("button",{onClick:g,className:"absolute right-4 top-1/2 -translate-y-1/2 p-2 rounded-full bg-black/50 text-white hover:bg-black/70 transition-colors",children:e.jsx(ot,{className:"w-6 h-6"})})]}),e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-2 px-3 py-2 rounded-full bg-black/50 text-white",children:[e.jsx("button",{onClick:w,className:"p-1 hover:bg-background/20 rounded",children:e.jsx(It,{className:"w-5 h-5"})}),e.jsxs("span",{className:"text-sm min-w-[3rem] text-center",children:[Math.round(r*100),"%"]}),e.jsx("button",{onClick:C,className:"p-1 hover:bg-background/20 rounded",children:e.jsx(At,{className:"w-5 h-5"})}),e.jsx("div",{className:"w-px h-5 bg-background/30 mx-1"}),e.jsx("button",{onClick:D,className:"p-1 hover:bg-background/20 rounded",children:e.jsx(sn,{className:"w-5 h-5"})})]})]}),a&&e.jsx("div",{className:"flex gap-2 p-3 border-t border-border overflow-x-auto",children:t.images.map((R,B)=>e.jsx("button",{onClick:()=>{n(B),b()},className:U("w-16 h-16 rounded border-2 overflow-hidden flex-shrink-0 transition-all",B===s?"border-primary":"border-transparent hover:border-primary/50"),children:e.jsx(zs,{img:R,className:"w-full h-full object-cover"})},B))}),d.alt&&e.jsxs("div",{className:"px-4 py-2 text-sm text-muted-foreground border-t border-border",children:[d.alt,d.width&&d.height&&e.jsxs("span",{className:"ml-2",children:["(",d.width," x ",d.height,")"]})]})]})}function Fn({artifact:t}){const{t:s}=ve(),[n,r]=u.useState(!1),[l,c]=u.useState(!1),[o,d]=u.useState(!1),a=u.useRef(null),p=u.useRef(null),i=Ut(t.assetId,void 0,t.videoUrl,{stable:!0}),m=Ut(t.coverAssetId,void 0,t.coverUrl),[x,g]=u.useState(null),b=!x&&(t.assetState==="in_recycle_bin"||t.assetState==="hard_deleted"),C=x||i||t.videoUrl,w=m||t.coverUrl,D=()=>{a.current&&(n?a.current.pause():a.current.play(),r(!n))},R=()=>{a.current&&(a.current.muted=!l,c(!l))},B=()=>{var k,v,S;p.current&&(o?(S=document.exitFullscreen)==null||S.call(document):(v=(k=p.current).requestFullscreen)==null||v.call(k),d(!o))},Z=async()=>{let k=t.videoUrl;if(t.assetId)try{k=await Et.getUrl(t.assetId)}catch{}const v=document.createElement("a");v.href=k,v.download=`video-${Date.now()}.mp4`,v.click()},M=k=>{if(!k)return"--:--";const v=Math.floor(k/60),S=Math.floor(k%60);return`${v}:${S.toString().padStart(2,"0")}`};return e.jsxs("div",{ref:p,className:"h-full flex flex-col bg-black",children:[e.jsxs("div",{className:"flex-1 flex items-center justify-center relative group",children:[b?e.jsx(Vs,{data:{assetState:t.assetState,recycleBinDaysLeft:t.recycleBinDaysLeft},contentWidth:"100%",contentHeight:"100%",assetId:t.assetId,onRestored:async()=>{if(t.assetId)try{g(await Et.getUrl(t.assetId))}catch{}}}):e.jsx("video",{ref:a,src:C,poster:w,className:"max-h-full max-w-full",onPlay:()=>r(!0),onPause:()=>r(!1),onEnded:()=>r(!1),loop:!0}),!b&&!n&&e.jsx("button",{onClick:D,className:"absolute inset-0 flex items-center justify-center bg-black/30 transition-opacity",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-background/90 flex items-center justify-center",children:e.jsx(Ct,{className:"w-8 h-8 text-black ml-1"})})}),e.jsx("div",{className:"absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/80 to-transparent opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:D,className:"p-2 rounded-full hover:bg-background/20 text-white",children:n?e.jsx(Bs,{className:"w-5 h-5"}):e.jsx(Ct,{className:"w-5 h-5"})}),e.jsx("button",{onClick:R,className:"p-2 rounded-full hover:bg-background/20 text-white",children:l?e.jsx(gr,{className:"w-5 h-5"}):e.jsx(fr,{className:"w-5 h-5"})}),e.jsx("span",{className:"text-white text-sm",children:M(t.duration)}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:Z,className:"p-2 rounded-full hover:bg-background/20 text-white",title:s("preview.downloadVideo"),children:e.jsx(at,{className:"w-5 h-5"})}),e.jsx("button",{onClick:B,className:"p-2 rounded-full hover:bg-background/20 text-white",title:s("preview.fullscreen"),children:e.jsx(rn,{className:"w-5 h-5"})})]})})]}),e.jsx("div",{className:"p-3 bg-background border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-1",children:t.description})]}),t.mode&&e.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-secondary",children:t.mode==="text2video"?s("preview.text2video"):s("preview.img2video")})]})})]})}function Pn({artifact:t}){var C,w,D;const{t:s}=ve(),[n,r]=u.useState(t.dataType==="json"?"json":"table"),[l,c]=u.useState(null),[o,d]=u.useState("asc"),[a,p]=u.useState(!0),i=t.columns||((C=t.rows)!=null&&C[0]?Object.keys(t.rows[0]):[]),m=[...t.rows||[]].sort((R,B)=>
270{if(!l)return 0;const Z=R[l],M=B[l];if(Z===M)return 0;const k=String(Z??""),v=String(M??""),S=k<v?-1:1;return o==="asc"?S:-S}),x=R=>{l===R?d(B=>B==="asc"?"desc":"asc"):(c(R),d("asc"))},g=()=>e.jsxs("div",{className:"overflow-auto",children:[e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-secondary/50",children:i.map(R=>e.jsx("th",{onClick:()=>x(R),className:"px-4 py-3 text-left text-sm font-medium border-b border-border cursor-pointer hover:bg-secondary transition-colors",children:e.jsxs("div",{className:"flex items-center gap-1",children:[R,l===R&&(o==="asc"?e.jsx(Ht,{className:"w-4 h-4"}):e.jsx(gt,{className:"w-4 h-4"}))]})},R))})}),e.jsx("tbody",{children:m.map((R,B)=>e.jsx("tr",{className:"hover:bg-secondary/30 transition-colors",children:i.map(Z=>e.jsx("td",{className:"px-4 py-3 text-sm border-b border-border",children:In(R[Z])},Z))},B))})]}),m.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:s("preview.noDataLabel")})]}),b=()=>e.jsx("div",{className:"p-4 overflow-auto",children:e.jsx("pre",{className:"text-sm font-mono bg-secondary/30 p-4 rounded-lg overflow-auto",children:JSON.stringify(t.rawData||t.rows,null,2)})});return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"flex items-center bg-secondary rounded-lg p-1",children:[e.jsxs("button",{className:U("flex items-center gap-1 px-3 py-1 text-sm rounded-md transition-colors",n==="table"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>r("table"),children:[e.jsx(St,{className:"w-4 h-4"}),e.jsx("span",{children:s("preview.tableViewLabel")})]}),e.jsxs("button",{className:U("flex items-center gap-1 px-3 py-1 text-sm rounded-md transition-colors",n==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>r("json"),children:[e.jsx(sr,{className:"w-4 h-4"}),e.jsx("span",{children:s("preview.jsonViewLabel")})]})]})}),e.jsx("span",{className:"text-sm text-muted-foreground",children:s("preview.recordCountLabel",{count:((w=t.rows)==null?void 0:w.length)||0})})]}),(t.summary||((D=t.insights)==null?void 0:D.length))&&e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("button",{onClick:()=>p(!a),className:"w-full flex items-center justify-between px-4 py-2 hover:bg-secondary/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[e.jsx(br,{className:"w-4 h-4 text-yellow-500"}),e.jsx("span",{children:s("preview.dataInsights")})]}),a?e.jsx(Ht,{className:"w-4 h-4"}):e.jsx(gt,{className:"w-4 h-4"})]}),a&&e.jsxs("div",{className:"px-4 pb-3 space-y-2",children:[t.summary&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.summary}),t.insights&&t.insights.length>0&&e.jsx("ul",{className:"space-y-1",children:t.insights.map((R,B)=>e.jsxs("li",{className:"text-sm text-muted-foreground flex items-start gap-2",children:[e.jsx("span",{className:"text-primary",children:"â¢"}),R]},B))})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:n==="table"?g():b()})]})}function In(t){return t==null?"-":typeof t=="object"?JSON.stringify(t):String(t)}function An({artifact:t}){const{t:s}=ve(),{copy:n,copied:r}=vt(),l=()=>{n(t.result)},c=()=>{switch(t.textType){case"translation":return e.jsx(wr,{className:"w-5 h-5 text-blue-500"});case"summary":return e.jsx(Ue,{className:"w-5 h-5 text-green-500"});case"rewrite":return e.jsx(vr,{className:"w-5 h-5 text-purple-500"});case"extraction":return e.jsx(hs,{className:"w-5 h-5 text-orange-500"});default:return e.jsx(Ue,{className:"w-5 h-5"})}},o=()=>{switch(t.textType){case"translation":return s("preview.translationResult");case"summary":return s("preview.summaryResult");case"rewrite":return s("preview.rewriteResult");case"extraction":return s("preview.extractionResult");case"comparison":return s("preview.comparisonResult");default:return s("preview.processResult")}},d=()=>e.jsxs("div",{className:"grid grid-cols-2 gap-4 h-full",children:[e.jsxs("div",{className:"flex flex-col border-r border-border",children:[e.jsx("div",{className:"px-4 py-2 border-b border-border bg-secondary/30",children:e.jsx("span",{className:"text-sm font-medium",children:s("preview.originalLabel")})}),e.jsx("div",{className:"flex-1 p-4 overflow-auto",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.original})})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"px-4 py-2 border-b border-border bg-secondary/30 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-medium",children:o()}),e.jsx("button",{onClick:l,className:"p-1 hover:bg-secondary rounded transition-colors",children:r?e.jsx(Me,{className:"w-4 h-4 text-green-500"}):e.jsx(st,{className:"w-4 h-4 text-muted-foreground"})})]}),e.jsx("div",{className:"flex-1 p-4 overflow-auto",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.result})})]})]}),a=()=>{const i=t.metadata;return e.jsxs("div",{className:"p-4 space-y-4 overflow-auto",children:[e.jsx("div",{className:"p-4 bg-secondary/30 rounded-lg",children:e.jsx("p",{className:"text-sm whitespace-pre-wrap",children:t.result})}),(i==null?void 0:i.keywords)&&i.keywords.length>0&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(hs,{className:"w-4 h-4"}),s("preview.keywordsLabel")]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.keywords.map((m,x)=>e.jsx("span",{className:"px-2 py-1 text-xs bg-primary/10 text-primary rounded-full",children:m},x))})]}),(i==null?void 0:i.topics)&&i.topics.length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium mb-2",children:s("preview.topicsLabel")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:i.topics.map((m,x)=>e.jsx("span",{className:"px-2 py-1 text-xs bg-blue-500/10 text-blue-600 dar
270k:text-blue-400 rounded-full",children:m},x))})]}),(i==null?void 0:i.sentiment)&&e.jsxs("div",{children:[e.jsxs("h4",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[e.jsx(yr,{className:"w-4 h-4"}),s("preview.sentimentLabel")]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:U("px-3 py-1 text-sm rounded-full",i.sentiment==="positive"&&"bg-green-500/10 text-green-600 dark:text-green-400",i.sentiment==="negative"&&"bg-red-500/10 text-red-600 dark:text-red-400",i.sentiment==="neutral"&&"bg-muted/500/10 text-muted-foreground",i.sentiment==="mixed"&&"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400"),children:[i.sentiment==="positive"&&s("preview.positiveLabel"),i.sentiment==="negative"&&s("preview.negativeLabel"),i.sentiment==="neutral"&&s("preview.neutralLabel"),i.sentiment==="mixed"&&s("preview.mixedLabel")]}),i.emotions&&e.jsx("span",{className:"text-sm text-muted-foreground",children:i.emotions.join(", ")})]})]})]})},p=()=>e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[c(),e.jsx("span",{className:"font-medium",children:o()})]}),e.jsx("button",{onClick:l,className:"flex items-center gap-1 px-3 py-1 text-sm hover:bg-secondary rounded-lg transition-colors",children:r?e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-4 h-4 text-green-500"}),e.jsx("span",{children:s("preview.copiedLabel")})]}):e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-4 h-4"}),e.jsx("span",{children:s("preview.copyLabel")})]})})]}),e.jsx("div",{className:"flex-1 p-4 overflow-auto",children:e.jsx("div",{className:"prose prose-sm max-w-none",children:e.jsx("p",{className:"whitespace-pre-wrap",children:t.result})})}),t.metadata&&Object.keys(t.metadata).length>0&&(()=>{const i=t.metadata;return e.jsx("div",{className:"px-4 py-2 border-t border-border bg-secondary/30",children:e.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[i.sourceLength!==void 0&&e.jsxs("span",{children:[s("preview.originalLabel"),": ",String(i.sourceLength)]}),i.resultLength!==void 0&&e.jsxs("span",{children:[s("preview.processResult"),": ",String(i.resultLength)]}),i.compressionRatio!==void 0&&e.jsx("span",{children:String(i.compressionRatio)})]})})})()]});return(t.textType==="translation"||t.textType==="rewrite")&&t.original?e.jsx("div",{className:"h-full",children:d()}):t.textType==="extraction"?e.jsx("div",{className:"h-full overflow-hidden",children:a()}):p()}const Es={"01d":"âï¸","01n":"ð","02d":"â ","02n":"âï¸","03d":"âï¸","03n":"âï¸","04d":"âï¸","04n":"âï¸","09d":"ð§ï¸","09n":"ð§ï¸","10d":"ð¦ï¸","10n":"ð§ï¸","11d":"âï¸","11n":"âï¸","13d":"âï¸","13n":"âï¸","50d":"ð«ï¸","50n":"ð«ï¸"};function Mn({artifact:t}){const{t:s}=ve(),{current:n,forecast:r,city:l}=t,c=Es[n.icon]||"ð¤ï¸";return e.jsxs("div",{className:"h-full overflow-auto p-4",children:[e.jsxs("div",{className:"bg-gradient-to-br from-blue-500 to-purple-600 rounded-2xl p-6 text-white shadow-lg",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:l}),e.jsx("p",{className:"text-white/80 mt-1",children:n.description})]}),e.jsx("span",{className:"text-6xl",children:c})]}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex items-end gap-2",children:[e.jsx("span",{className:"text-7xl font-light",children:n.temperature}),e.jsx("span",{className:"text-3xl mb-3",children:"°C"})]}),e.jsxs("p",{className:"text-white/80 flex items-center gap-1 mt-1",children:[e.jsx(hn,{className:"w-4 h-4"}),s("preview.feelsLike",{temp:n.feelsLike})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6 pt-6 border-t border-white/20",children:[e.jsxs("div",{className:"text-center",children:[e.jsx(pn,{className:"w-5 h-5 mx-auto mb-1 opacity-80"}),e.jsx("p",{className:"text-sm opacity-80",children:s("preview.humidityLabel")}),e.jsxs("p",{className:"font-medium",children:[n.humidity,"%"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx(gn,{className:"w-5 h-5 mx-auto mb-1 opacity-80"}),e.jsx("p",{className:"text-sm opacity-80",children:s("preview.windSpeedLabel")}),e.jsxs("p",{className:"font-medium",children:[n.windSpeed," m/s"]})]}),e.jsxs("div",{className:"text-center",children:[e.jsx(qr,{className:"w-5 h-5 mx-auto mb-1 opacity-80"}),e.jsx("p",{className:"text-sm opacity-80",children:s("preview.windDirLabel")}),e.jsx("p",{className:"font-medium",children:n.windDirection})]})]})]}),r&&r.length>0&&e.jsxs("div",{className:"mt-6",children:[e.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[e.jsx(jr,{className:"w-5 h-5"}),s("preview.forecastLabel")]}),e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:r.map((o,d)=>e.jsxs("div",{className:"p-4 rounded-xl bg-secondary/50 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:_n(o.date,s)}),e.jsx("span",{className:"text-3xl my-2 block",children:Es[o.icon]||"ð¤ï¸"}),e.jsx("p",{className:"text-sm",children:o.description}),e.jsxs("div",{className:"mt-2 flex items-center justify-center gap-2 text-sm",children:[e.jsxs("span",{className:"text-red-500",children:[o.tempMax,"°"]}),e.jsx("span",{className:"text-muted-foreground",children:"/"}),e.jsxs("span",{className:"text-blue-500",children:[o.tempMin,"°"]})]})]},d))})]}),e.jsx("div",{className:"mt-6 p-4 rounded-lg bg-secondary/30 text-sm text-muted-foreground",children:e.jsx("p",{children:On(n.temperature,n.description,s)})})]})}function _n(t,s){const n=new Date(t),r=new Date,l=new Date(r);return l.setDate(l.getDate()+1),n.toDateString()===r.toDateString()?s("preview.todayLabel"):n.toDateString()===l.toDateString()?s("preview.tomorrowLabel"):n.toLocaleDateString(void 0,{weekday:"short"})}function On(t,s,n){return s.includes("é¨")||s.toLowerCase().includes("rain")?n("preview.weatherTipRain"):s.includes("éª")||s.toLowerCase().includes("snow")?n("preview.weatherTipSnow"):t>35?n("preview.weatherTipHot35"):t>30?n("preview.weatherTipHot30"):t<5?n("preview.weatherTipCold5"):t<15?n("preview.weatherTipCold15"):n("preview.weatherTipNice")}function Bn({artifact:t}){var d,a,p;const{t:s,i18n:n}=ve(),{copy:r,copied:l}=vt(),c=()=>{r(t.content)},o=new URL(t.url).hostname;return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"px-6 py-4 border-b border-border",children:[e.jsx("h1",{className:"text-xl font-bold leading-tight",children:t.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 mt-3 text-sm text-muted-foreground",children:[((d=t.metadata)==null?void 0:d.siteName)&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(yt,{className:"w-4 h-4"}),t.metadata.siteName]}),((a=t.metadata)==null?void 0:a.author)&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Nr,{className:"w-4 h-4"}),t.metadata.author]}),((p=t.metadata)==null?void 0:p.publishDate)&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ks,{className:"w-4 h-4"}),Un(t.metadata.publishDate,n.language)]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-4",children:[e.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(Yt,{className:"w-4 h-4"}),s("preview.viewOriginal")]}),e.jsx("button",{onClick:c,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm border border-border rounded-lg hover:bg-secondary transition-colors",children:l?e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-4 h-4 text-green-500"}),s("preview.copiedLabel")]}):e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-4 h-4"}),s("preview.copyContent")]})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("article",{className:"max-w-3xl mx-auto px-6 py-6",children:e.jsx("div",{className:"prose prose-sm max-w-none",children:t.content.split(` 271 272`).map((i,m)=>e.jsx("p",{className:"mb-4 leading-relaxed",children:i},m))})})}),e.jsx("div",{className:"px-6 py-3 border-t border-border bg-secondary/30",children:e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[o," · ",t.url]})})]})}function Un(t,s){try{return new Date(t).toLocaleDateString(s,{year:"numeric",month:"long",day:"numeric"})}catch{return t}}function Hn({artifact:t}){const{t:s}=ve(),{copy:n,copied:r}=vt(),l=()=>{n(String(t.result))};return e.jsx("div",{className:"h-full flex flex-col items-center justify-center p-8",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center",children:e.jsx(Xs,{className:"w-8 h-8 text-white"})})}),e.jsx("h2",{className:"text-xl font-bold text-center mb-8",children:t.title}),e.jsxs("div",{className:"bg-secondary/30 rounded-2xl p-6 space-y-4",children:[t.expression&&e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:s("preview.expressionLabel")}),e.jsx("p",{className:"text-lg font-mono bg-background rounded-lg px-4 py-2",children:t.expression})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(un,{className:"w-6 h-6 text-muted-foreground"})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:s("preview.resultLabel")}),e.jsxs("div",{className:"relative",children:[e.jsx("p",{className:"text-4xl font-bold text-primary py-4",children:t.formatted||t.result}),e.jsx("button",{onClick:l,className:"absolute right-0 top-1/2 -translate-y-1/2 p-2 hover:bg-secondary rounded-lg transition-colors",children:r?e.jsx(Me,{className:"w-5 h-5 text-green-500"}):e.jsx(st,{className:"w-5 h-5 text-muted-foreground"})})]})]})]}),t.steps&&t.steps.length>0&&e.jsxs("div",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-medium mb-3",children:s("preview.calcSteps")}),e.jsx("div",{className:"space-y-2",children:t.steps.map((c,o)=>e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-secondary/30 rounded-lg",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-primary/10 text-primary text-sm flex items-center justify-center flex-shrink-0",children:o+1}),e.jsx("span",{className:"text-sm",children:c})]},o))})]}),t.description&&e.jsx("p",{className:"mt-6 text-sm text-muted-foreground text-center",children:t.description})]})})}function qn({artifact:t}){const{t:s}=ve(),[n,r]=u.useState("preview"),l=()=>{switch(t.fileType){case"excel":case"csv":return e.jsx(Dt,{className:"w-8 h-8 text-green-600"});case"pdf":return e.jsx(Ue,{className:"w-8 h-8 text-red-600"});case"json":return e.jsx(mn,{className:"w-8 h-8 text-yellow-600"});case"image":return e.jsx(kr,{className:"w-8 h-8 text-blue-600"});default:return e.jsx(gs,{className:"w-8 h-8 text-muted-foreground"})}},c=a=>a?a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(1)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`:s("preview.unknownSize"),o=()=>
272{if(t.preview)return e.jsx("div",{className:"p-4 overflow-auto",children:e.jsx("pre",{className:"text-sm whitespace-pre-wrap font-mono bg-secondary/30 p-4 rounded-lg",children:t.preview})});if(t.data&&Array.isArray(t.data)){const a=t.data;if(a.length>0){const p=Object.keys(a[0]);return e.jsxs("div",{className:"overflow-auto",children:[e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-secondary/50",children:p.map(i=>e.jsx("th",{className:"px-4 py-3 text-left text-sm font-medium border-b border-border",children:i},i))})}),e.jsx("tbody",{children:a.slice(0,100).map((i,m)=>e.jsx("tr",{className:"hover:bg-secondary/30",children:p.map(x=>e.jsx("td",{className:"px-4 py-3 text-sm border-b border-border",children:Gn(i[x])},x))},m))})]}),a.length>100&&e.jsx("p",{className:"text-center py-4 text-sm text-muted-foreground",children:s("preview.showingRows",{shown:100,total:a.length})})]})}}return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground",children:[e.jsx(gs,{className:"w-16 h-16 mb-4 opacity-50"}),e.jsx("p",{children:s("preview.cannotPreview")})]})},d=()=>t.data?e.jsx("div",{className:"p-4 overflow-auto",children:e.jsx("pre",{className:"text-sm font-mono bg-secondary/30 p-4 rounded-lg overflow-auto",children:JSON.stringify(t.data,null,2)})}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:e.jsx("p",{children:s("preview.noDataAvailable")})});return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-4 px-4 py-4 border-b border-border",children:[l(),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-medium truncate",children:t.fileName}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.fileType.toUpperCase()," · ",c(t.fileSize)]})]})]}),e.jsx("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border",children:e.jsxs("div",{className:"flex items-center bg-secondary rounded-lg p-1",children:[e.jsxs("button",{className:U("flex items-center gap-1 px-3 py-1 text-sm rounded-md transition-colors",n==="preview"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>r("preview"),children:[e.jsx(St,{className:"w-4 h-4"}),e.jsx("span",{children:s("preview.previewMode")})]}),e.jsxs("button",{className:U("flex items-center gap-1 px-3 py-1 text-sm rounded-md transition-colors",n==="data"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>r("data"),children:[e.jsx(sr,{className:"w-4 h-4"}),e.jsx("span",{children:s("preview.rawDataLabel")})]})]})}),e.jsx("div",{className:"flex-1 overflow-hidden",children:n==="preview"?o():d()})]})}function Gn(t){return t==null?"-":typeof t=="object"?JSON.stringify(t):String(t)}function Wn({artifact:t,onUpdate:s}){const{t:n}=ve(),r=t.sections??[],[l,c]=u.useState("preview"),[o,d]=u.useState(r),[a,p]=u.useState(null),[i,m]=u.useState(!1),[x,g]=u.useState(r),b=u.useRef(null),C={report:n("preview.docTypeReport"),article:n("preview.docTypeArticle"),proposal:n("preview.docTypeProposal"),analysis:n("preview.docTypeAnalysis"),manual:n("preview.docTypeManual"),letter:n("preview.docTypeLetter"),contract:n("preview.docTypeContract")};u.useEffect(()=>{const y=t.sections??[];y!==x&&y.length>0&&(d(y),g(y),m(!1))},[t.sections,x]);const w=u.useCallback((y,L,E)=>{d(_=>_.map(Q=>Q.id===y?{...Q,[L]:E}:Q)),m(!0)},[]),D=u.useCallback(y=>{const L={id:qt(),level:1,title:n("preview.newSectionTitle"),content:n("preview.newSectionContent")};d(E=>{const _=[...E];return _.splice(y+1,0,L),_}),m(!0),p(L.id)},[]),R=u.useCallback(y=>{if(o.length<=1){Ne.error(n("preview.minOneSectionError"));return}d(L=>L.filter(E=>E.id!==y)),m(!0),p(null)},[o.length]),B=u.useCallback((y,L)=>{d(E=>{const _=E.findIndex(K=>K.id===y);if(_===-1||L==="up"&&_===0||L==="down"&&_===E.length-1)return E;const Q=[...E],$=L==="up"?_-1:_+1;return[Q[_],Q[$]]=[Q[$],Q[_]],Q}),m(!0)},[]),Z=u.useCallback((y,L)=>{d(E=>E.map(_=>_.id===y?{..._,level:L}:_)),m(!0)},[]),M=u.useCallback(()=>{s==null||s(o),g(o),m(!1)},[o,s]),k=u.useCallback(()=>{d(x),m(!1),p(null)},[x]),v=u.useCallback(y=>{const L=document.getElementById(`section-${y}`);L==null||L.scrollIntoView({behavior:"smooth",block:"start"})},[]);if(!t.sections||t.sections.length===0)return e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground
272/60",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Ue,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:n("preview.documentGenerating")})]})});const S=o.reduce((y,L)=>{const E=(L.content.match(/[\u4e00-\u9fa5]/g)||[]).length,_=(L.content.match(/[a-zA-Z]+/g)||[]).length;return y+E+_},0),J=()=>e.jsx("div",{ref:b,className:"h-full overflow-auto bg-background",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-8 py-10",children:[e.jsxs("header",{className:"text-center mb-10 pb-8 border-b-2 border-border",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground mb-4",children:t.title}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[C[t.documentType]||t.documentType," · ",S.toLocaleString()," · ",o.length]})]}),e.jsxs("nav",{className:"mb-10 p-6 bg-muted rounded-lg",children:[e.jsx("h3",{className:"text-lg font-semibold mb-4 text-foreground",children:n("preview.tableOfContents")}),e.jsx("ul",{className:"space-y-2",children:o.map((y,L)=>e.jsxs("li",{className:U("cursor-pointer hover:text-primary transition-colors",y.level===2&&"ml-4",y.level===3&&"ml-8"),onClick:()=>v(y.id),children:[e.jsxs("span",{className:"text-primary mr-2",children:[L+1,"."]}),e.jsx("span",{className:"text-foreground/80",children:y.title})]},y.id))})]}),e.jsx("main",{className:"space-y-8",children:o.map((y,L)=>e.jsxs("section",{id:`section-${y.id}`,className:"scroll-mt-4",children:[e.jsxs("h2",{className:U("font-bold text-foreground mb-4 pb-2 border-b border-border",y.level===1&&"text-2xl",y.level===2&&"text-xl ml-4",y.level===3&&"text-lg ml-8"),children:[e.jsxs("span",{className:"text-primary mr-2",children:[L+1,"."]}),y.title]}),e.jsx("div",{className:U("prose prose-neutral dark:prose-invert max-w-none prose-headings:text-foreground prose-p:text-foreground/90 prose-li:text-foreground/90 prose-strong:text-foreground",y.level===2&&"ml-4",y.level===3&&"ml-8"),children:e.jsx(Js,{remarkPlugins:[Ys],children:y.content})})]},y.id))}),e.jsx("footer",{className:"mt-16 pt-6 border-t border-border text-center text-sm text-muted-foreground",children:"Generated by AI Document Assistant"})]})}),H=()=>e.jsxs("div",{className:"h-full flex bg-background",children:[e.jsx("div",{className:"w-64 border-r border-border bg-muted overflow-auto",children:e.jsxs("div",{className:"p-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-foreground/70 mb-3",children:n("preview.sectionList")}),e.jsx("div",{className:"space-y-1",children:o.map((y,L)=>e.jsxs("div",{className:U("flex items-center gap-2 p-2 rounded-lg cursor-pointer transition-colors",a===y.id?"bg-primary/10 border border-primary":"hover:bg-accent"),onClick:()=>p(y.id),children:[e.jsx("span",{className:U("w-5 h-5 rounded text-xs flex items-center justify-center font-medium",y.level===1&&"bg-primary text-primary-foreground",y.level===2&&"bg-secondary text-secondary-foreground",y.level===3&&"bg-muted-foreground text-background"),children:L+1}),e.jsx("span",{className:"flex-1 text-sm truncate text-foreground/80",children:y.title})]},y.id))}),e.jsxs("button",{onClick:()=>D(o.length-1),className:"mt-4 w-full flex items-center justify-center gap-2 py-2 text-sm text-primary hover:bg-primary/10 rounded-lg transition-colors",children:[e.jsx(Be,{className:"w-4 h-4"}),n("preview.addSection")]})]})}),e.jsx("div",{className:"flex-1 overflow-auto bg-background",children:a?e.jsx(Vn,{section:o.find(y=>y.id===a),index:o.findIndex(y=>y.id===a),totalSections:o.length,onChange:w,onDelete:R,onMove:B,onLevelChange:Z,onAddAfter:D}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ft,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:n("preview.selectSectionToEdit")})]})})})]}),f=()=>e.jsx("div",{className:"h-full overflow-auto p-6 bg-background",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsx("h2",{className:"text-xl font-bold mb-6 text-foreground",children:t.title}),e.jsx("div",{className:"space-y-3",children:o.map((y,L)=>e.jsxs("div",{className:U("p-4 rounded-lg border border-border hover:border-primary/50 transition-colors cursor-pointer bg-card",y.level===2&&"ml-6",y.level===3&&"ml-12"),onClick:()=>{c("preview"),setTimeout(()=>v(y.id),100)},children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:U("w-6 h-6 rounded text-xs flex items-center justify-center font-medium",y.level===1&&"bg-primary text-primary-foreground",y.level===2&&"bg-secondary text-secondary-foreground",y.level===3&&"bg-muted-foreground text-background"),children:L+1}),e.jsx("span",{className:"font-medium text-foreground",children:y.title})]}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground line-clamp-2",children:[y.content.replace(/[#*`\[\]]/g,"").slice(0,150),"..."]})]},y.id))}),e.jsx("div",{className:"mt-8 pt-6 border-t border-border",children:e.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[e.jsx("span",{children:n("preview.sectionCountLabel",{count:o.length})}),e.jsx("span",{children:n("preview.wordCountLabelFull",{count:S})}),e.jsx("span",{children:n("preview.languageLabel",{lang:t.language==="en"?n("preview.langEn"):n("preview.langZh")})})]})})]})});return e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ue,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-sm text-foreground",children:t.title}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[C[t.documentType]||t.documentType,i&&e.jsxs("span",{className:"ml-2 text-destructive",children:["· ",n("preview.unsaved")]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:k,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-muted-foreground hover:bg-accent rounded-lg transition-colors",title:"Undo changes",children:e.jsx(ts,{className:"w-4 h-4"})}),e.jsxs("button",{onClick:M,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-primary text-primary-foreground hover:bg-primary/90 rounded-lg transition-colors",children:[e.jsx(rs,{className:"w-4 h-4"}),e.jsx("span",{children:n("preview.saveBtn")})]}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"})]}),e.jsxs("div",{className:"flex items-center bg-secondary rounded-lg p-0.5",children:[e.jsxs("button",{onClick:()=>c("preview"),className:U("flex items-center gap-1.5 px-3 py-1 text-sm rounded-md transition-colors",l==="preview"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Pt,{className:"w-4 h-4"}),e.jsx("span",{children:n("preview.previewMode")})]}),e.jsxs("button",{onClick:()=>c("edit"),className:U("flex items-center gap-1.5 px-3 py-1 text-sm rounded-md transition-colors",l==="edit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(ft,{className:"w-4 h-4"}),e.jsx("span",{children:n("common.edit")})]}),e.jsxs("button",{onClick:()=>c("outline"),className:U("flex items-center gap-1.5 px-3 py-1 text-sm rounded-md transition-colors",l==="outline"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Us,{className:"w-4 h-4"}),e.jsx("span",{children:n("preview.outlineView")})]})]})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[l==="preview"&&J(),l==="edit"&&H(),l==="outline"&&f()]})]})}function Vn({section:t,index:s,totalSections:n,onChange:r,onDelete:l,onMove:c,onLevelChange:o,onAddAfter:d}){const{t:a}=ve(),[p,i]=u.useState(t.content),m=u.useRef(null);return u.useEffect(()=>{i(t.content)},[t.id,t.content]),u.useEffect(()=>{m.current&&(m.current.style.height="auto",m.current.style.height=m.current.scrollHeight+"px")},[p]),u.useEffect(()=>{const x=setTimeout(()=>{p!==t.content&&r(t.id,"content",p)},300);return()=>clearTimeout(x)},[p,t.id,t.content,r]),e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-muted",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:a("preview.sectionNumber",{num:s+1})}),e.jsx("div",{className:"flex items-center gap-1 bg-secondary rounded-lg p-0.5",children:[1,2,3].map(x=>e.jsxs("button",{onClick:()=>o(t.id,x),className:U("px-2 py-0.5 text-xs rounded transition-colors",t.level===x?"bg-background shadow-sm text-foreground":"hover:bg-accent text-muted-foreground"),children:["H",x]},x))})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>c(t.id,"up"),disabled:s===0,className:"p-1.5 hover:bg-accent rounded disabled:opacity-30 disabled:cursor-not-allowed text-foreground",title:a("preview.moveUp"),children:e.jsx(Ht,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>
272c(t.id,"down"),disabled:s===n-1,className:"p-1.5 hover:bg-accent rounded disabled:opacity-30 disabled:cursor-not-allowed text-foreground",title:a("preview.moveDown"),children:e.jsx(gt,{className:"w-4 h-4"})}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx("button",{onClick:()=>d(s),className:"p-1.5 hover:bg-accent rounded text-primary",title:a("preview.addSectionBelow"),children:e.jsx(Be,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>l(t.id),className:"p-1.5 hover:bg-destructive/10 rounded text-destructive",title:a("preview.deleteSectionBtn"),children:e.jsx(Qe,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[e.jsx("input",{type:"text",value:t.title,onChange:x=>r(t.id,"title",x.target.value),className:"w-full text-xl font-bold bg-transparent border-none outline-none mb-4 text-foreground placeholder-muted-foreground",placeholder:a("preview.sectionTitlePlaceholder"),maxLength:200}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:m,value:p,onChange:x=>i(x.target.value),maxLength:2e3,className:"w-full min-h-[300px] p-4 bg-muted rounded-lg border border-border outline-none focus:border-primary resize-none font-mono text-sm text-foreground placeholder-muted-foreground",placeholder:`Write content in Markdown format... 273 274Supported formats: 275**bold** *italic* 276- List item 2771. Ordered list 278> Blockquote 279\`code\` 280`}),e.jsx("div",{className:"absolute bottom-2 right-2 text-xs text-muted-foreground",children:a("preview.markdownSupported")})]}),e.jsxs("div",{className:"mt-6",children:[e.jsx("h4",{className:"text-sm font-medium text-muted-foreground mb-3",children:a("preview.realtimePreview")}),e.jsx("div",{className:"p-4 bg-card rounded-lg border border-border prose prose-sm prose-neutral dark:prose-invert max-w-none prose-headings:text-foreground prose-p:text-foreground/90",children:e.jsx(Js,{remarkPlugins:[Ys],children:p||a("preview.noContent")})})]})]})]})}function Kn(t){var n;switch((n=t.split(".").pop())==null?void 0:n.toLowerCase()){case"html":return"text-orange-500";case"css":return"text-blue-500";case"js":return"text-yellow-500";case"json":return"text-green-500";case"md":return"text-muted-foreground";default:return"text-muted-foreground/60"}}function nr({artifact:t,onGenerateLink:s,onClose:n}){var ae,pe;const{t:r}=ve(),[l,c]=u.useState(t.status==="generating"?"code":"preview"),[o,d]=u.useState(!1),[a,p]=u.useState(new Set(["/"])),[i,m]=u.useState(null),{copy:x,copied:g}=vt(),[b,C]=u.useState(!1),[w,D]=u.useState(null),{copy:R,copied:B}=vt(),[Z,M]=u.useState("index.html"),[k,v]=u.useState(!1),[S,J]=u.useState(!1),H=u.useCallback(()=>{J(te=>!te)},[]);u.useEffect(()=>{const te=ne=>{ne.key==="Escape"&&S&&J(!1)};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[S]);const[f,y]=u.useState(""),[L,E]=u.useState(!1),_=u.useRef(null),Q=u.useRef(null);u.useEffect(()=>{t.status==="generating"?c("code"):t.status==="generated"&&c("preview")},[t.status]),u.useEffect(()=>{var te;if(t.status==="generating"&&((te=t.files)!=null&&te.length)){const ne=t.files[t.files.length-1];m(ne);const q=(ne.path.startsWith("/")?ne.path:"/"+ne.path).split("/").filter(Boolean),O=new Set(a);O.add("/");let z="";for(let se=0;se<q.length-1;se++)z+="/"+q[se],O.add(z);p(O)}},[(ae=t.files)==null?void 0:ae.length,t.status]),u.useEffect(()=>{var se,ce;if(!i){y(""),E(!1);return}const te=i.content,ne=i.path;if(((se=_.current)==null?void 0:se.fileId)===ne&&((ce=_.current)==null?void 0:ce.targetContent)===te)return;if(t.status==="generated"){y(te),E(!1),_.current={fileId:ne,targetContent:te};return}_.current={fileId:ne,targetContent:te},E(!0),y("");let ee=0;const q=20,z=setInterval(()=>{var fe;if(((fe=_.current)==null?void 0:fe.fileId)!==ne){clearInterval(z);return}if(ee<te.length){const Ce=Math.min(ee+q,te.length);y(te.slice(0,Ce)),ee=Ce,Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)}else clearInterval(z),E(!1)},8);return()=>clearInterval(z)},[i,t.status]);const $=u.useMemo(()=>{const te={name:t.title||"project",path:"/",isDirectory:!0,children:[]};
280(t.files||[]).forEach(q=>{let O=q.path;O.startsWith("/")&&(O=O.slice(1));const z=O.split("/");let se=te,ce="";for(let fe=0;fe<z.length;fe++){const Ce=z[fe];if(ce+="/"+Ce,fe===z.length-1)se.children=se.children||[],se.children.push({name:Ce,path:ce,isDirectory:!1,file:q});else{se.children=se.children||[];let Fe=se.children.find(Re=>Re.isDirectory&&Re.name===Ce);Fe||(Fe={name:Ce,path:ce,isDirectory:!0,children:[]},se.children.push(Fe)),se=Fe}}});const ee=q=>{q.children&&(q.children.sort((O,z)=>O.isDirectory&&!z.isDirectory?-1:!O.isDirectory&&z.isDirectory?1:O.name.localeCompare(z.name)),q.children.forEach(ee))};return ee(te),te},[t.files,t.title]);u.useEffect(()=>{const te=ne=>{var ee,q,O;if(((ee=ne.data)==null?void 0:ee.type)==="navigate"&&((q=ne.data)!=null&&q.href)){const z=ne.data.href,se=(O=t.files)==null?void 0:O.find(ce=>ce.path.split("/").pop()===z||ce.path===z||ce.path==="/"+z);se&&M(se.path)}};return window.addEventListener("message",te),()=>window.removeEventListener("message",te)},[t.files]);const K=u.useMemo(()=>{var fe,Ce,_e,Fe,Re;const ne=((fe=t.files)==null?void 0:fe.find(ue=>{const X=ue.path.split("/").pop(),G=Z.split("/").pop();return X===G||ue.path===Z||ue.path==="/"+Z}))||((Ce=t.files)==null?void 0:Ce.find(ue=>ue.path==="index.html"||ue.path==="/index.html"||ue.path.endsWith("/index.html")))||((_e=t.files)==null?void 0:_e.find(ue=>ue.path.endsWith(".html")));if(!ne)return null;let ee=ne.content;{let ue=0;for(;ue<ee.length;){const G=ee.substring(ue).match(/<script(?![^>]*\bsrc\s*=)[^>]*>/i);if(!G||G.index===void 0)break;const de=ue+G.index,ze=de+G[0].length,Se=ee.indexOf("<\/script>",ze);if(Se===-1||/<script[\s>]/i.test(ee.substring(ze,Se))){const De=ee.substring(ze),Ie=De.match(/<[a-zA-Z]/);(Ie==null?void 0:Ie.index)!==void 0?ee=ee.substring(0,de)+De.substring(Ie.index):ee=ee.substring(0,de)}else ue=Se+9}}{const ue=[],X=/<svg\b[\s\S]*?<\/svg>/gi;let G;for(;(G=X.exec(ee))!==null;)ue.push([G.index,G.index+G[0].length]);const de=De=>ue.some(([Ie,dt])=>De>=Ie&&De<dt),ze=[],Se=/<(?:path|circle|rect|polyline|polygon|ellipse|line|use|defs|symbol)\b/gi;let We;for(;(We=Se.exec(ee))!==null;){if(de(We.index))continue;const De=We.index,Ie=ee.substring(De),dt=Ie.substring(1).indexOf("<"),wt=dt===-1?Ie.length:1+dt,jt=Ie.substring(0,wt).indexOf("/>"),Nt=jt!==-1?jt+2:wt;ze.push([De,De+Nt]),Se.lastIndex=De+Nt}if(ze.length>0)for(let De=ze.length-1;De>=0;De--){const[Ie,dt]=ze[De];ee=ee.substring(0,Ie)+ee.substring(dt)}}const q=((Fe=t.files)==null?void 0:Fe.filter(ue=>ue.path.endsWith(".css")))||[];for(const ue of q){const X=ue.path.split("/").pop();if(X){const G=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),de=new RegExp(`<link[^>]*href=["'][^"']*${G}["'][^>]*>`,"gi");ee=ee.replace(de,`<style>${ue.content}</style>`)}}const O=((Re=t.files)==null?void 0:Re.filter(ue=>ue.path.endsWith(".js")))||[];for(const ue of O){const X=ue.path.split("/").pop();if(X){const G=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),de=new RegExp(`<script[^>]*src=["'][^"']*${G}["'][^>]*>\\s*<\/script>`,"gi");ee=ee.replace(de,`<script>${ue.content}<\/script>`)}}ee=ee.replace(/<link[^>]*href=["'](?!https?:\/\/)[^"']+\.css["'][^>]*>/gi,""),ee=ee.replace(/<script[^>]*src=["'](?!https?:\/\/)[^"']+["'][^>]*>\s*<\/script>/gi,""),ee=ee.replace(/<script[^>]*src=["']https?:\/\/cdn\.tailwindcss\.com[^"']*["'][^>]*>\s*<\/script>/gi,'<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"><\/script>'),ee=ee.replace(/<script>\s*tailwind\.config\s*=\s*\{[\s\S]*?\}\s*<\/script>/gi,ue=>{const X=ue.match(/primary:\s*['"]([^'"]+)['"]/),G=X?X[1]:"#3b82f6";return`<style> 281.bg-primary{background-color:${G}}.text-primary{color:${G}}.border-primary{border-color:${G}} 282.hover\\:bg-primary:hover{background-color:${G}}.ring-primary{--tw-ring-color:${G}} 283.bg-primary\\/10{background-color:${G}1a}.hover\\:bg-primary\\/90:hover{background-color:${G}e6} 284.aspect-square{aspect-ratio:1/1}.aspect-video{aspect-ratio:16/9} 285.line-clamp-1{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden} 286.line-clamp-2{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden} 287.line-clamp-3{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden} 288.backdrop-blur-sm{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)} 289.backdrop-blur-md{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)} 290.backdrop-blur-lg{-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px)} 291.snap-x{scroll-snap-type:x mandatory}.snap-start{scroll-snap-align:start} 292.scroll-smooth{scroll-behavior:smooth} 293</style>`});const ce=` 294<script> 295 document.addEventListener('DOMContentLoaded', function() { 296 setTimeout(function() { 297 document.querySelectorAll('.fade-in:not(.active),.slide-up:not(.active)').forEach(function(el) { 298 el.classList.add('active'); 299 }); 300 }, 1500); 301 }); 302<\/script> 303`+` 304<script> 305 document.addEventListener('click', function(e) { 306 var link = e.target.closest('a'); 307 if (!link) return; 308 var href = link.getAttribute('href'); 309 if (!href) { 310 e.preventDefault(); 311 e.stopPropagation(); 312 return false;
313 } 314 // Hash links: always preventDefault to avoid srcdoc iframe edge cases 315 // where the browser falls back to parent origin navigation. 316 // For real anchor targets (e.g. #features), perform smooth scroll inside the iframe. 317 // For placeholder href="#", silently swallow the click. 318 if (href.charAt(0) === '#') { 319 e.preventDefault(); 320 e.stopPropagation(); 321 if (href.length > 1) { 322 try { 323 var target = document.getElementById(href.slice(1)); 324 if (target && typeof target.scrollIntoView === 'function') { 325 target.scrollIntoView({ behavior: 'smooth', block: 'start' }); 326 } 327 } catch (_) {} 328 } 329 return false; 330 } 331 // Navigate between .html pages via parent postMessage 332 if (href.endsWith('.html')) { 333 e.preventDefault(); 334 e.stopPropagation(); 335 window.parent.postMessage({ type: 'navigate', href: href }, '*'); 336 return false; 337 } 338 // External http(s) links: open in new tab (parent context) instead of 339 // breaking the iframe with a blocked top-navigation 340 if (/^https?:\\/\\//i.test(href)) { 341 e.preventDefault(); 342 e.stopPropagation(); 343 try { window.open(href, '_blank', 'noopener,noreferrer'); } catch (_) {} 344 return false; 345 } 346 // Block ALL other navigation to prevent blank page in srcdoc iframe 347 e.preventDefault(); 348 e.stopPropagation(); 349 return false; 350 }, true); 351<\/script> 352`;return ee.includes("</body>")?ee=ee.replace("</body>",ce+"</body>"):ee=ee+ce,ee},[t.files,Z]),F=te=>{p(ne=>{const ee=new Set(ne);return ee.has(te)?ee.delete(te):ee.add(te),ee})},P=(te,ne=0)=>{var O,z;const ee=a.has(te.path),q=ne*12;if(te.isDirectory)return e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>F(te.path),className:"w-full flex items-center gap-1.5 px-2 py-1 hover:bg-secondary rounded text-sm",style:{paddingLeft:`${q+8}px`},children:[ee?e.jsx(gt,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}):e.jsx(ot,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),ee?e.jsx($r,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}):e.jsx(Sr,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"}),e.jsx("span",{className:"font-medium text-foreground truncate",children:te.name})]}),ee&&te.children&&e.jsx("div",{children:te.children.map(se=>P(se,ne+1))})]},te.path);{const se=(i==null?void 0:i.path)===((O=te.file)==null?void 0:O.path),ce=t.status==="generating"&&t.files&&t.files.length>0&&t.files[t.files.length-1].path===((z=te.file)==null?void 0:z.path);return e.jsxs("button",{onClick:()=>te.file&&m(te.file),className:U("w-full flex items-center gap-1.5 px-2 py-1 rounded text-sm text-left",se?"bg-primary/10 text-primary":"hover:bg-secondary text-muted-foreground",ce&&"bg-green-50 dark:bg-green-900/20"),style:{paddingLeft:`${q+28}px`},children:[ce?e.jsx(fs,{className:"w-4 h-4 flex-shrink-0 text-green-500 animate-pulse"}):e.jsx(Lt,{className:U("w-4 h-4 flex-shrink-0",Kn(te.name))}),e.jsx("span",{className:"truncate",children:te.name}),ce&&e.jsx(Ve,{className:"ml-auto w-3.5 h-3.5 text-green-500 animate-spin"})]},te.path)}},A=te=>{x(te)};u.useCallback(async()=>{if(s){C(!0);try{const te=await s();te&&D(te)}finally{C(!1)}}},[s]);const T=u.useCallback(()=>{w&&R(w)},[w,R]),I=u.useCallback(async()=>{var te;if(!((te=t.files)!=null&&te.length)){Ne.error(r("preview.noDataToExport"));return}v(!0);try{await Cr.downloadAsZipLocal(t.title||"website",t.files.map(ne=>({path:ne.path,content:ne.content})))}catch(ne){console.error("Export failed:",ne),Ne.error(r("preview.exportFailed"))}finally{v(!1)}},[t.files,t.title]),V=K!==null,ie=t.status==="generating",le=((pe=t.files)==null?void 0:pe.length)||0,be=l==="code";return e.jsx("div",{className:U("h-full flex flex-col bg-background",S&&"fixed inset-0 z-50"),children:e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[be&&e.jsxs("div",{className:U("border-r border-border bg-secondary/30 flex flex-col transition-all duration-300",o?"w-0 overflow-hidden":"w-56"),children:[e.jsxs("div",{className:"p-3 border-b border-border flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yt,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:r("preview.filesLabel")})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:le})]}),ie&&e.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:r("preview.generatingProgress")}),e.jsxs("span",{className:"text-primary",children:[t.progress||0,"%"]})]}),e.jsx("div",{className:"h-1.5 bg-secondary rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${t.progress||0}%`}})}),t.currentStep&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Ve,{className:"w-3 h-3 animate-spin text-primary"}),e.jsx("span",{className:"truncate",children:t.currentStep})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:P($)})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto] items-center px-4 py-2 border-b border-border gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l==="code"&&e.jsx("button",{onClick:()=>d(!o),className:"p-2 rounded-lg hover:bg-secondary transition-colors",title:r(o?"preview.expandSidebar":"preview.collapseSidebar"),children:o?e.jsx(ot,{className:"w-4 h-4"}):e.jsx($t,{className:"w-4 h-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(yt,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium truncate max-w-[150px]",children:t.title})]})]}),e.jsx("div",{className:"flex justify-center",children:t.status==="generated"&&e.jsxs("div",{className:"flex items-center bg-secondary rounded-md p-0.5",children:[e.jsx("button",{onClick:()=>c("preview"),className:U("p-2 rounded transition-colors",l==="preview"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("preview.previewMode"),children:e.jsx(Pt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c("code"),className:U("p-2 rounded transition-colors",l==="code"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:r("preview.codeMode"),children:e.jsx(Jt,{className:"w-4 h-4"})})]})}),e.jsxs("div",{className:"flex items-center gap-1",children:[!1,w&&e.jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-lg hover:bg-secondary transition-colors text-green-600",title:r("preview.openLink"),children:e.jsx(Yt,{className:"w-4 h-4"})}),t.status==="generated"&&e.jsx("button",{onClick:I,disabled:k,className:"p-2 rounded-lg hover:bg-secondary transition-colors text-foreground",title:r("preview.exportZip"),children:k?e.jsx(Ve,{className:"w-4 h-4 animate-spin"}):e.jsx(at,{className:"w-4 h-4"})}),e.jsx("button",{onClick:H,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors",title:r(S?"preview.exitFullscreen":"preview.fullscreen"),children:S?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})}),n&&e.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-secondary transition-colors text-foreground",title:r("preview.closeLabel"),children:e.jsx(Ee,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:l==="preview"?e.jsxs("div",{className:"h-full flex flex-col",children:[w&&e.jsxs("div",{className:"px-4 py-2 bg-green-50 dark:bg-green-900/20 border-b border-green-200 dark:border-green-800 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(ss,{className:"w-4 h-4 text-green-600 flex-shrink-0"}),e.jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-green-700 dark:text-green-400 hover:underline truncate",children:w})]}),e.jsx("button",{onClick:T,className:"flex items-center gap-1 px-2 py-1 text-xs text-green-700 dark:text-green-400 hover:bg-green-100 dark:hover:bg-green-800/50 rounded transition-colors flex-shrink-0",children:B?e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-3.5 h-3.5"}),r("preview.copiedLabel")]}):e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-3.5 h-3.5"}),r("preview.copyLabel")]})})]}),V?e.jsx("iframe",{srcDoc:K||"",className:"flex-1 w-full border-none bg-background",title:t.title,sandbox:"allow-scripts allow-same-origin"}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(yt,{className:"w-12 h-12 mx-auto mb-3 opacity-50"}),e.jsx("p",{className:"text-lg mb-2",children:r("preview.noPreviewPage")}),e.jsx("p",{className:"text-sm",children:r("preview.noPreviewPageDesc")})]})})]}):e.jsx("div",{className:"h-full flex flex-col",children:i?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-secondary/30 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[L?e.jsx(fs,{className:"w-4 h-4 text-green-500 animate-pulse"}):e.jsx(Lt,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:i.path}),L&&e.jsx("span",{className:"text-xs text-green-600 animate-pulse",children:r("preview.generatingLabel")})]}),e.jsx("button",{onClick:()=>A(i.content),className:"flex items-center gap-1 px-2 py-1 text-sm text-muted-foreground hover:text-foreground hover:bg-secondary rounded transition-colors",disabled:L,children:g?e.jsxs(e.Fragment,{children:[e.jsx(Me,{className:"w-4 h-4 text-green-500"}),e.jsx("span",{className:"text-green-600",children:r("preview.copiedLabel")})]}):e.jsxs(e.Fragment,{children:[e.jsx(st,{className:"w-4 h-4"}),e.jsx("span",{children:r("preview.copyLabel")})]})})]}),e.jsx("div",{className:"flex-1 overflow-auto bg-[#1e1e1e]",ref:Q,children:e.jsxs("pre",{className:"p-4 text-sm text-gray-100 font-mono whitespace-pre-wrap break-all",children:[f,L&&e.jsx("span",{className:"inline-block w-2 h-4 bg-green-400 animate-pulse ml-0.5"})]})})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(Lt,{className:"w-12 h-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:r("preview.selectFileToView")})]})})})})]})]})})}function pt(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Jn(t,s,n){if(t==null)return'<span style="color: #9ca3af;">-</span>';switch(s){case"currency":const r=typeof t=="number"?t:parseFloat(String(t));return isNaN(r)?pt(String(t)):r>=1e4&&(n!=null&&n.startsWith("zh"))?`<span style="font-weight: 500; color: #059669;">Â¥${(r/1e4).toFixed(1)}ä¸</span>`:`<span style="font-weight: 500; color: #059669;">
352Â¥${r.toLocaleString(n||"en")}</span>`;case"percentage":const l=typeof t=="number"?t:parseFloat(String(t));if(isNaN(l))return pt(String(t));const c=l>0?"+":"";return`<span style="font-weight: 500; color: ${l>0?"#22c55e":l<0?"#ef4444":"#6b7280"};">${c}${l}%</span>`;case"status":const d=String(t);let a="#f3f4f6",p="#6b7280";return d.includes("宿")||d.includes("éè¿")||d.includes("æå")||d.toLowerCase().includes("complete")||d.toLowerCase().includes("pass")||d.toLowerCase().includes("success")?(a="#dcfce7",p="#166534"):(d.includes("è¿è¡")||d.includes("å¤ç")||d.includes("å®¡æ ¸")||d.toLowerCase().includes("in progress")||d.toLowerCase().includes("processing")||d.toLowerCase().includes("review"))&&(a="#dbeafe",p="#1d4ed8"),`<span style="display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 12px; font-weight: 500; background: ${a}; color: ${p};">${pt(d)}</span>`;case"progress":const i=typeof t=="number"?t:parseInt(String(t));if(isNaN(i))return pt(String(t));let m="#d1d5db";return i>=80?m="#22c55e":i>=50?m="#3b82f6":i>0&&(m="#eab308"),` 353 <div style="display: flex; align-items: center; gap: 8px;"> 354 <div style="flex: 1; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; min-width: 60px;"> 355 <div style="height: 100%; width: ${i}%; background: ${m}; border-radius: 4px;"></div> 356 </div> 357 <span style="font-size: 12px; color: #6b7280; min-width: 36px; text-align: right;">${i}%</span> 358 </div> 359 `;case"boolean":return t?"â":"â";default:return pt(String(t))}}function Yn({artifact:t,onUpdate:s}){var A;const{t:n,i18n:r}=ve(),c=(t.sheets??[])[0]??{id:qt(),name:"Sheet 1",columns:[],rows:[]},[o,d]=u.useState("preview"),[a,p]=u.useState(c),[i,m]=u.useState(!1),[x,g]=u.useState(c),[b,C]=u.useState(null),[w,D]=u.useState(null),[R,B]=u.useState(!1),Z=u.useMemo(()=>[{value:"string",label:n("preview.colTypeString")},{value:"number",label:n("preview.colTypeNumber")},{value:"date",label:n("preview.colTypeDate")},{value:"currency",label:n("preview.colTypeCurrency")},{value:"percentage",label:n("preview.colTypePercentage")},{value:"status",label:n("preview.colTypeStatus")},{value:"progress",label:n("preview.colTypeProgress")},{value:"boolean",label:n("preview.colTypeBoolean")}],[n]),M=u.useCallback(()=>{B(T=>!T)},[]);u.useEffect(()=>{const T=I=>{I.key==="Escape"&&R&&B(!1)};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[R]),u.useEffect(()=>{var I;const T=(I=t.sheets)==null?void 0:I[0];T&&T!==x&&(p(T),g(T),m(!1))},[t.sheets,x]),u.useEffect(()=>{const T=()=>D(null);return document.addEventListener("click",T),()=>document.removeEventListener("click",T)},[]);const k=u.useCallback((T,I,V)=>{p(ie=>({...ie,rows:ie.rows.map((le,be)=>be===T?{...le,[I]:V}:le)})),m(!0)},[]),v=u.useCallback(T=>{const I={};a.columns.forEach(V=>{I[V.key]=V.type==="number"||V.type==="currency"||V.type==="percentage"||V.type==="progress"?0:""}),p(V=>{const ie=[...V.rows],le=T!==void 0?T+1:ie.length;return ie.splice(le,0,I),{...V,rows:ie}}),m(!0)},[a.columns]),S=u.useCallback(T=>{if(a.rows.length<=1){Ne.error(n("preview.minOneRowError"));return}p(I=>({...I,rows:I.rows.filter((V,ie)=>ie!==T)})),m(!0)},[a.rows.length]),J=u.useCallback(T=>{const I=`col_${qt(6)}`,V={key:I,title:n("preview.newColumnTitle"),type:"string"};p(ie=>{const le=[...ie.columns],be=T!==void 0?T+1:le.length;le.splice(be,0,V);const ae=ie.rows.map(pe=>({...pe,[I]:""}));return{...ie,columns:le,rows:ae}}),m(!0)},[]),H=u.useCallback(T=>{if(a.columns.length<=1){Ne.error(n("preview.minOneColumnError"));return}const I=a.columns[T].key;p(V=>({...V,columns:V.columns.filter((ie,le)=>le!==T),rows:V.rows.map(ie=>{const le={...ie};return delete le[I],le})})),m(!0)},[a.columns]),f=u.useCallback((T,I)=>{p(V=>({...V,columns:V.columns.map((ie,le)=>le===T?{...ie,title:I}:ie)})),m(!0)},[]),y=u.useCallback((T,I)=>{p(V=>({...V,columns:V.columns.map((ie,le)=>le===T?{...ie,type:I}:ie)})),m(!0)},[]),L=u.useCallback(()=>{s==null||s([a]),g(a),m(!1)},[a,s]),E=u.useCallback(()=>{p(x),m(!1),C(null)},[x]),_=u.useCallback((T,I,V)=>{T.preventDefault(),D({x:T.clientX,y:T.clientY,type:I,index:V})},[]),Q=u.useMemo(()=>{const T=a.columns.map(ie=>`<th style="padding: 12px 16px; text-align: left; font-weight: 600; color: #ffffff; white-space: nowrap; border-bottom: 2px solid #3b82f6;">${pt(ie.title)}</th>`).join(""),I=a.rows.map((ie,le)=>{const be=a.columns.map(pe=>{const te=ie[pe.key];return`<td style="padding: 12px 16px; border-bottom: 1px solid #e5e7eb; color: #374151;">${Jn(te,pe.type,r.language)}</td>`}).join("");return`<tr style="background: ${le%2===1?"#f9fafb":"#ffffff"};">${be}</tr>`}).join(""),V=` 360<div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 100%; background: #ffffff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1);"> 361 <div style="padding: 20px 24px; border-bottom: 1px solid #e5e7eb;"> 362 <h2 style="font-size: 20px; font-weight: 600; color: #111827; margin: 0 0 8px 0;">${pt(t.title)}</h2> 363 <div style="display: flex; gap: 16px; font-size: 13px; color: #6b7280;">
364 <span>${a.columns.length} à ${a.rows.length}</span> 365 <span>${new Date().toLocaleDateString()}</span> 366 </div> 367 </div> 368 <div style="overflow-x: auto;"> 369 <table style="width: 100%; border-collapse: collapse; font-size: 14px;"> 370 <thead> 371 <tr style="background: #1f2937;">${T}</tr> 372 </thead> 373 <tbody> 374 ${I} 375 </tbody> 376 </table> 377 </div> 378 <div style="padding: 12px 24px; border-top: 1px solid #e5e7eb; text-align: center; font-size: 12px; color: #9ca3af;"> 379 ${n("preview.generatedByAI")} 380 </div> 381</div> 382 `;return` 383<!DOCTYPE html> 384<html lang="zh-CN"> 385<head> 386 <meta charset="UTF-8"> 387 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 388 <title>${pt(t.title)}</title> 389 <link rel="preconnect" href="https://fonts.bunny.net"> 390 <link rel="preconnect" href="https://fonts.bunny.net" crossorigin> 391 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap" rel="stylesheet"> 392 <style> 393 * { margin: 0; padding: 0; box-sizing: border-box; } 394 body { 395 font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif; 396 background: #f8fafc; 397 min-height: 100vh; 398 padding: 24px; 399 } 400 tr:hover { background: #f3f4f6 !important; } 401 </style> 402</head> 403<body> 404 ${V} 405</body> 406</html> 407 `},[t.title,a,r.language]),$=(T,I)=>{if(T==null)return"-";switch(I){case"currency":const V=typeof T=="number"?T:parseFloat(String(T));return isNaN(V)?String(T):`Â¥${V.toLocaleString()}`;case"percentage":const ie=typeof T=="number"?T:parseFloat(String(T));return isNaN(ie)?String(T):`${ie}%`;case"boolean":return n(T?"preview.boolTrue":"preview.boolFalse");case"progress":return`${T}%`;default:return String(T)}},K=T=>T.includes("宿")||T.includes("éè¿")||T.includes("æå")||T.toLowerCase().includes("complete")||T.toLowerCase().includes("pass")||T.toLowerCase().includes("success")?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":T.includes("è¿è¡")||T.includes("å¤ç")||T.includes("å®¡æ ¸")||T.toLowerCase().includes("progress")||T.toLowerCase().includes("processing")||T.toLowerCase().includes("review")?"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400",F=()=>e.jsx("iframe",{srcDoc:Q,sandbox:"allow-scripts allow-downloads allow-same-origin",className:"w-full h-full border-none bg-background",title:t.title}),P=()=>e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border bg-muted/50",children:[e.jsxs("button",{onClick:()=>v(),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-primary text-primary-foreground hover:bg-primary/90 rounded-lg transition-colors",children:[e.jsx(Be,{className:"w-4 h-4"}),n("preview.addRowBtn")]}),e.jsxs("button",{onClick:()=>J(),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-secondary text-secondary-foreground hover:bg-secondary/80 rounded-lg transition-colors",children:[e.jsx(Be,{className:"w-4 h-4"}),n("preview.addColumnBtn")]}),e.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[a.rows.length," à ",a.columns.length]})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"min-w-max",children:[e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"w-10 p-2 bg-muted border border-border text-center text-xs text-muted-foreground",children:"#"}),a.columns.map((T,I)=>e.jsx("th",{className:"min-w-[150px] p-0 bg-muted border border-border",onContextMenu:V=>_(V,"column",I),children:e.jsxs("div",{className:"flex flex-col",children:[e.jsx("input",{type:"text",value:T.title,onChange:V=>f(I,V.target.value),className:"w-full px-3 py-2 bg-transparent text-sm font-semibold text-foreground border-none outline-none focus:bg-background",placeholder:n("preview.columnTitlePlaceholder"),maxLength:200}
407),e.jsx(ut,{value:T.type,onChange:V=>y(I,V),options:Z,className:"w-full"})]})},T.key)),e.jsx("th",{className:"w-10 p-2 bg-muted border border-border",children:e.jsx("button",{onClick:()=>J(),className:"p-1 hover:bg-accent rounded text-muted-foreground",title:n("preview.addColumnBtn"),children:e.jsx(Be,{className:"w-4 h-4"})})})]})}),e.jsx("tbody",{children:a.rows.map((T,I)=>e.jsxs("tr",{className:"hover:bg-muted/30",onContextMenu:V=>_(V,"row",I),children:[e.jsx("td",{className:"p-2 bg-muted/50 border border-border text-center text-xs text-muted-foreground",children:I+1}),a.columns.map(V=>e.jsx("td",{className:U("p-0 border border-border",(b==null?void 0:b.rowIndex)===I&&(b==null?void 0:b.colKey)===V.key?"bg-primary/5 ring-2 ring-primary ring-inset":"hover:bg-muted/20"),onClick:()=>C({rowIndex:I,colKey:V.key}),children:(b==null?void 0:b.rowIndex)===I&&(b==null?void 0:b.colKey)===V.key?e.jsx(Zn,{value:T[V.key],type:V.type,onChange:ie=>k(I,V.key,ie),onBlur:()=>C(null),autoFocus:!0}):e.jsx("div",{className:"px-3 py-2 min-h-[40px] text-sm",children:V.type==="status"?e.jsx("span",{className:U("px-2 py-0.5 rounded-full text-xs",K(String(T[V.key]||""))),children:T[V.key]||"-"}):V.type==="progress"?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all",style:{width:`${Math.min(100,Math.max(0,Number(T[V.key])||0))}%`}})}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[T[V.key],"%"]})]}):$(T[V.key],V.type)})},V.key)),e.jsx("td",{className:"w-10 p-1 border border-border",children:e.jsx("button",{onClick:()=>S(I),className:"p-1 hover:bg-destructive/10 rounded text-muted-foreground hover:text-destructive",title:"Delete row",children:e.jsx(Qe,{className:"w-3 h-3"})})})]},I))})]}),e.jsxs("button",{onClick:()=>v(),className:"w-full mt-2 py-2 text-sm text-muted-foreground hover:text-primary hover:bg-primary/5 border border-dashed border-border rounded-lg transition-colors",children:[e.jsx(Be,{className:"w-4 h-4 inline mr-1"}),n("preview.addNewRow")]})]})}),w&&e.jsx("div",{className:"fixed z-[60] bg-popover border border-border rounded-lg shadow-lg py-1 min-w-[120px]",style:{left:w.x,top:w.y},children:w.type==="row"?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{v(w.index),D(null)},className:"w-full px-3 py-1.5 text-sm text-left hover:bg-accent flex items-center gap-2",children:[e.jsx(Be,{className:"w-4 h-4"}),n("preview.insertRowBelow")]}),e.jsxs("button",{onClick:()=>{S(w.index),D(null)},className:"w-full px-3 py-1.5 text-sm text-left hover:bg-destructive/10 text-destructive flex items-center gap-2",children:[e.jsx(Qe,{className:"w-4 h-4"}),n("preview.deleteRowBtn")]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>{J(w.index),D(null)},className:"w-full px-3 py-1.5 text-sm text-left hover:bg-accent flex items-center gap-2",children:[e.jsx(Be,{className:"w-4 h-4"}),n("preview.insertColumnRight")]}),e.jsxs("button",{onClick:()=>{H(w.index),D(null)},className:"w-full px-3 py-1.5 text-sm text-left hover:bg-destructive/10 text-destructive flex items-center gap-2",children:[e.jsx(Qe,{className:"w-4 h-4"}),n("preview.deleteColumnBtn")]})]})})]});return!t.sheets||t.sheets.length===0||!((A=t.sheets[0].columns)!=null&&A.length)?e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground/60",children:e.jsxs("div",{className:"text-center",children:[e.jsx(St,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),e.jsx("p",{children:n("preview.spreadsheetGenerating")})]})}):e.jsxs("div",{className:U("h-full flex flex-col bg-background",R&&"fixed inset-0 z-50"),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(St,{className:"w-5 h-5 text-primary"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-sm text-foreground",children:t.title}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.rows.length," Ã ",a.
407columns.length,i&&e.jsxs("span",{className:"ml-2 text-destructive",children:["· ",n("preview.unsaved")]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:E,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm text-muted-foreground hover:bg-accent rounded-lg transition-colors",title:n("preview.undoTitle"),children:e.jsx(ts,{className:"w-4 h-4"})}),e.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-primary text-primary-foreground hover:bg-primary/90 rounded-lg transition-colors",children:[e.jsx(rs,{className:"w-4 h-4"}),e.jsx("span",{children:n("preview.saveBtn")})]}),e.jsx("div",{className:"w-px h-6 bg-border mx-1"})]}),e.jsxs("div",{className:"flex items-center bg-secondary rounded-lg p-0.5",children:[e.jsxs("button",{onClick:()=>d("preview"),className:U("flex items-center gap-1.5 px-3 py-1 text-sm rounded-md transition-colors",o==="preview"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Pt,{className:"w-4 h-4"}),e.jsx("span",{children:n("preview.previewMode")})]}),e.jsxs("button",{onClick:()=>d("edit"),className:U("flex items-center gap-1.5 px-3 py-1 text-sm rounded-md transition-colors",o==="edit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(ft,{className:"w-4 h-4"}),e.jsx("span",{children:n("common.edit")})]})]}),e.jsx("button",{onClick:M,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors",title:n(R?"preview.exitFullscreen":"preview.fullscreen"),children:R?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden",children:[o==="preview"&&F(),o==="edit"&&P()]})]})}function Zn({value:t,type:s,onChange:n,onBlur:r,autoFocus:l}){const{t:c}=ve(),o=u.useRef(null);u.useEffect(()=>{l&&o.current&&(o.current.focus(),o.current.select())},[l]);const d=p=>{(p.key==="Enter"&&!p.nativeEvent.isComposing||p.key==="Escape")&&r()};if(s==="boolean")return e.jsx(ut,{value:t?"true":"false",onChange:p=>{n(p==="true"),r()},options:[{value:"true",label:c("preview.boolTrue")},{value:"false",label:c("preview.boolFalse")}],className:"w-full"});if(s==="status")return e.jsx(ut,{value:String(t||""),onChange:p=>{n(p),r()},options:[{value:"",label:c("preview.pleaseSelect")},{value:c("preview.statusNotStarted"),label:c("preview.statusNotStarted")},{value:c("preview.statusInProgress"),label:c("preview.statusInProgress")},{value:c("preview.statusCompleted"),label:c("preview.statusCompleted")},{value:c("preview.statusCancelled"),label:c("preview.statusCancelled")},{value:c("preview.statusPendingReview"),label:c("preview.statusPendingReview")},{value:c("preview.statusApproved"),label:c("preview.statusApproved")}],className:"w-full"});const a=s==="number"||s==="currency"||s==="percentage"||s==="progress"?"number":"text";return e.jsx("input",{ref:o,type:a,value:t!=null?String(t):"",onChange:p=>{const i=a==="number"?p.target.value?Number(p.target.value):null:p.target.value;n(i)},onBlur:r,onKeyDown:d,maxLength:a==="number"?10:1e3,className:"w-full h-full px-3 py-2 bg-transparent outline-none text-sm",placeholder:s==="date"?"YYYY-MM-DD":""})}const it={titleFontSize:"large",bodyFontSize:"medium",textAlign:"left",backgroundEffect:"none",animation:"none",titleWeight:"bold",bulletStyle:"disc",cardStyle:"none"};function ir(t){if(!t)return"content";const s=t.toLowerCase();if(t.includes("ä¼å¿")&&t.includes("å£å¿")||t.includes("â")&&t.includes("â")||s.includes("#22c55e")&&s.includes("#ef4444"))return"comparison";if(s.includes("two-column")||s.includes("grid-cols-2")||s.includes("left-column"))return"two-column";if(s.includes("full-image")||s.includes("background-image")&&!s.includes("<ul"))return"full-image";if(s.includes("image-left")||s.includes("<img")&&s.indexOf("<img")<s.indexOf("<ul"))return"image-left";if(s.includes("image-right")||s.includes("<img")&&s.indexOf("<img")>s.indexOf("<ul"))return"image-right";if(s.includes("blockquote")||s.includes("quote"))return"quote";if(s.includes("stat-value")||s.includes("stats-grid"))return"stats";if(s.includes("chart")||s.includes("canvas"))return"chart";if(s.includes("timeline"))return"timeline";const n=s.includes("<li")||s.includes("<ul"),r=/<p[^>]*>(?!.*\d+\s*$)[^<]+<\/p>/i.test(t);return!n&&r&&(s.includes("text-center")||s.includes("justify-center")||s.includes("items-center"))?"title":"content"}function Qn(t){const s=ir(t),n=Xn(t,s);return{layout:s,content:n}}function Xn(t,s){var r,l,c,o;const n={title:"",subtitle:"",bullets:[],notes:"",imageUrl:"",imageKeywords:"",leftColumn:[],right
407Column:[],leftTitle:"",rightTitle:"",quote:"",quoteAuthor:"",stats:[]};if(!t)return n;try{const a=new DOMParser().parseFromString(t,"text/html"),p=a.querySelector("h1, h2");n.title=((r=p==null?void 0:p.textContent)==null?void 0:r.trim())||"";const i=a.querySelectorAll("p");for(const x of i)if(!x.closest("li")&&!x.closest("footer")&&!x.closest("blockquote")){const g=(l=x.textContent)==null?void 0:l.trim();if(g&&!/^\d+$/.test(g)&&g.length>2){n.subtitle=g;break}}const m=a.querySelector("img");switch(m&&(n.imageUrl=m.getAttribute("src")||""),s){case"two-column":case"comparison":n.leftColumn=Fs(a,"left"),n.rightColumn=Fs(a,"right");break;case"quote":const x=a.querySelector("blockquote");n.quote=((c=x==null?void 0:x.textContent)==null?void 0:c.trim())||"";const g=a.querySelector("cite, .quote-author");let b=((o=g==null?void 0:g.textContent)==null?void 0:o.trim())||"";b.startsWith("â")&&(b=b.substring(1).trim()),b.startsWith("-")&&(b=b.substring(1).trim()),n.quoteAuthor=b;break;case"stats":let C=a.querySelectorAll(".stat, .stat-item");if(C.length===0&&(C=a.querySelectorAll(".stats-grid > div")),C.length===0){const B=a.querySelector('div[style*="grid-template-columns"]');B&&(C=B.querySelectorAll(":scope > div"))}C.forEach(B=>{var k,v,S,J,H,f,y,L;let Z=((v=(k=B.querySelector(".stat-value, .value"))==null?void 0:k.textContent)==null?void 0:v.trim())||"",M=((J=(S=B.querySelector(".stat-label, .label"))==null?void 0:S.textContent)==null?void 0:J.trim())||"";if(!Z&&!M){const E=B.querySelectorAll(":scope > div");E.length>=2&&(Z=((f=(H=E[0])==null?void 0:H.textContent)==null?void 0:f.trim())||"",M=((L=(y=E[1])==null?void 0:y.textContent)==null?void 0:L.trim())||"")}(Z||M)&&n.stats.push({value:Z,label:M})});break;default:const w=a.querySelectorAll('div[style*="grid-template-columns"] > div'),D=new Set;w.forEach(B=>{B.querySelectorAll("li").forEach(Z=>D.add(Z))}),a.querySelectorAll("li").forEach(B=>{if(D.has(B))return;const Z=ei(B);Z&&n.bullets.push(Z)});break}return n}catch(d){return console.error("Error parsing slide HTML:",d),n}}function ei(t){var r,l;const s=t.querySelectorAll("span");let n="";for(let c=s.length-1;c>=0;c--){const o=(r=s[c].textContent)==null?void 0:r.trim();o&&o.length>2&&o.length>n.length&&(n=o)}return n||(n=((l=t.textContent)==null?void 0:l.trim())||""),n}function Fs(t,s){const n=[],r=s==="left"?'.left-column li, .col-left li, [class*="left"] li':'.right-column li, .col-right li, [class*="right"] li';if(t.querySelectorAll(r).forEach(c=>{var d;const o=(d=c.textContent)==null?void 0:d.trim();o&&n.push(o)}),n.length===0){let c=t.querySelectorAll('div[style*="grid-template-columns"] > div');if(c.length<2&&(c=t.querySelectorAll('[class*="grid"] > div, [class*="flex"] > div')),c.length>=2){const d=c[s==="left"?0:1];d==null||d.querySelectorAll("li").forEach(a=>{var i,m;const p=a.querySelectorAll("span");if(p.length>0){const x=p[p.length-1],g=(i=x==null?void 0:x.textContent)==null?void 0:i.trim();g&&n.push(g)}else{const x=(m=a.textContent)==null?void 0:m.trim();x&&n.push(x)}})}}return n}const Je={small:"36px",medium:"48px",large:"56px",xlarge:"64px"},Ye={small:"16px",medium:"20px",large:"24px"},Ze={normal:"400",medium:"500",semibold:"600",bold:"700"},Ke={disc:(t,s)=>`<span style="width: 8px; height: 8px; border-radius: 50%; background: ${t}; ${s?"margin-left":"margin-right"}: 12px; flex-shrink: 0;"></span>`,circle:(t,s)=>`<span style="width: 8px; height: 8px; border-radius: 50%; border: 2px solid ${t}; ${s?"margin-left":"margin-right"}: 12px; flex-shrink: 0;"></span>`,square:(t,s)=>`<span style="width: 8px; height: 8px; background: ${t}; ${s?"margin-left":"margin-right"}: 12px; flex-shrink: 0;"></span>`,check:(t,s)=>`<span style="width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; ${s?"margin-left":"margin-right"}: 12px; flex-shrink: 0; color: ${t};">â</span>`,arrow:(t,s)=>`<span style="width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; ${s?"margin-left":"margin-right"}: 12px; flex-shrink: 0; color: ${t};">â</span>`,number:(t,s)=>`<span style="width: 24px; height: 24px; border-radius: 50%; background: ${t}; color: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; ${s?"margin-left":"margin-right"}: 12px; flex-shrink: 0;">{{INDEX}}</span>`};function ti(t,s){switch(t){case"gradient":return`linear-gradient(135deg, ${s.primaryColor}11 0%, ${s.secondaryColor}11 100%)`;case"pattern-dots":return`radial-gradient(circle, ${s.primaryColor}22 1px, transparent 1px)`;
407case"pattern-grid":return`linear-gradient(${s.primaryColor}11 1px, transparent 1px), linear-gradient(90deg, ${s.primaryColor}11 1px, transparent 1px)`;case"pattern-waves":return`repeating-linear-gradient(45deg, ${s.primaryColor}08, ${s.primaryColor}08 10px, transparent 10px, transparent 20px)`;default:return"none"}}function si(t){switch(t){case"fade":return` 408 @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } 409 .animated { animation: fadeIn 0.5s ease-out; } 410 `;case"slide-up":return` 411 @keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } } 412 .animated { animation: slideUp 0.5s ease-out; } 413 `;case"slide-left":return` 414 @keyframes slideLeft { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } } 415 .animated { animation: slideLeft 0.5s ease-out; } 416 `;case"zoom":return` 417 @keyframes zoomIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } } 418 .animated { animation: zoomIn 0.4s ease-out; } 419 `;default:return""}}function xt(t,s){switch(t){case"shadow":return"box-shadow: 0 10px 40px -10px rgba(0,0,0,0.15); border-radius: 16px;";case"border":return`border: 2px solid ${s.borderColor||s.primaryColor}33; border-radius: 16px;`;case"glass":return"background: rgba(255,255,255,0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.2); border-radius: 16px;";default:return""}}function lr(t,s="left"){const n=t.primaryColor,r=t.accentColor,l=t.secondaryColor;return[`<div style="width: 100%; height: 100%; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, ${n}15 0%, ${r}10 100%); position: relative;"> 420 <div style="position: absolute; top: 20%; left: 15%; width: 120px; height: 120px; border-radius: 50%; background: ${n}25; filter: blur(1px);"></div> 421 <div style="position: absolute; top: 45%; right: 20%; width: 80px; height: 80px; border-radius: 50%; background: ${r}30;"></div> 422 <div style="position: absolute; bottom: 20%; left: 30%; width: 60px; height: 60px; border-radius: 50%; background: ${l}20; filter: blur(1px);"></div> 423 <div style="position: absolute; top: 60%; left: 45%; width: 100px; height: 100px; border-radius: 50%; border: 3px solid ${n}25;"></div> 424 <div style="position: absolute; top: 15%; right: 25%; width: 40px; height: 40px; border-radius: 50%; background: ${n}35;"></div> 425 </div>`,`<div style="width: 100%; height: 100%; border-radius: 16px; overflow: hidden; background: linear-gradient(180deg, ${n}08 0%, ${r}12 100%); position: relative;"> 426 <svg style="position: absolute; bottom: 0; left: 0; width: 100%; height: 60%;" viewBox="0 0 400 200" preserveAspectRatio="none"> 427 <path d="M0,100 Q100,50 200,100 T400,100 L400,200 L0,200 Z" fill="${n}15"/> 428 <path d="M0,120 Q100,80 200,120 T400,120 L400,200 L0,200 Z" fill="${r}12"/> 429 <path d="M0,140 Q100,100 200,140 T400,140 L400,200 L0,200 Z" fill="${l}10"/> 430 </svg> 431 <div style="position: absolute; top: 15%; left: 20%; width: 8px; height: 8px; border-radius: 50%; background: ${n}50;"></div> 432 <div style="position: absolute; top: 25%; right: 30%; width: 12px; height: 12px; border-radius: 50%; background: ${r}40;"></div> 433 <div style="position: absolute; top: 10%; right: 15%; width: 6px; height: 6px; border-radius: 50%; background: ${l}60;"></div> 434 </div>`,`<div style="width: 100%; height: 100%; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, ${n}08 0%, ${r}05 100%); position: relative;"> 435 <div style="position: absolute; inset: 20px; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(5, 1fr); gap: 16px;"> 436 ${Array(30).fill(0).map((d,a)=>{const p=Math.random()*.4+.1,i=Math.random()*8+4,m=a%3===0?n:a%3===1?r:l;return`<div style="width: ${i}px; height: ${i}px; border-radius: 50%; background: ${m}; opacity: ${p}; margin: auto;"></div>`}).join("")} 437 </div> 438 <div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 80px; height: 80px; border: 2px dashed ${n}30; border-radius: 50%;"></div> 439 </div>`][s==="left"?0:s==="right"?1:2]}
439function Ps(t,s,n,r,l){const c=l||ns(n),o={...it,...s.style},d={...c,primaryColor:o.customPrimaryColor||c.primaryColor,accentColor:o.customAccentColor||c.accentColor};o.customBackgroundGradient&&o.customBackgroundGradient.length>=2&&(d.backgroundColor=`linear-gradient(135deg, ${o.customBackgroundGradient.join(", ")})`,o.customPrimaryColor||(d.primaryColor="#ffffff"),d.textColor="#ffffff",d.cardBackground="rgba(255,255,255,0.1)",d.borderColor="rgba(255,255,255,0.2)");const a=si(o.animation),p=ti(o.backgroundEffect,d),i=o.backgroundEffect!=="none"?`background-image: ${p}; background-size: ${o.backgroundEffect.includes("pattern")?"20px 20px":"100%"};`:"",m=` 440 * { margin: 0; padding: 0; box-sizing: border-box; } 441 html, body { width: 1200px; height: 675px; overflow: hidden; } 442 body { font-family: '${d.fontFamily}', 'Inter', 'Noto Sans SC', sans-serif; } 443 ${a} 444 `;let x;switch(t){case"title":x=ni(s,d,r,o);break;case"two-column":x=li(s,d,r,o);break;case"image-left":x=ai(s,d,r,o);break;case"image-right":x=oi(s,d,r,o);break;case"full-image":x=di(s,d,r,o);break;case"quote":x=ci(s,d,r,o);break;case"stats":x=pi(s,d,r,o);break;case"chart":x=ui(s,d,r,o);break;case"comparison":x=mi(s,d,r,o);break;case"timeline":x=xi(s,d,r,o);break;case"summary":x=hi(s,d,r,o);break;case"content":default:x=ii(s,d,r,o);break}return o.backgroundEffect!=="none"&&(x=x.replace(/background:\s*([^;]+);/,`background: $1; ${i}`)),`<!DOCTYPE html> 445<html> 446<head> 447 <meta charset="UTF-8"> 448 <meta name="viewport" content="width=1200, height=675"> 449 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap" rel="stylesheet"> 450 <style>${m}</style> 451</head> 452<body> 453${x} 454</body> 455</html>`}function ri(t,s,n,r=Ye.medium){if(t.length===0)return"";const l=Ke[n.bulletStyle]||Ke.disc,c=n.textAlign==="right";return`<ul style="list-style: none; padding: 0; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 16px; ${c?"align-items: flex-end;":""}"> 456 ${t.map((d,a)=>{let p=l(s.accentColor,c);return p=p.replace("{{INDEX}}",String(a+1)),` 457 <li style="display: flex; align-items: center; font-size: ${r}; line-height: 1.5; ${c?"flex-direction: row-reverse;":""}"> 458 ${p} 459 <span>${d}</span> 460 </li> 461 `}).join("")} 462 </ul>`}function ni(t,s,n,r){const l=r.titleFontSize==="xlarge"?"72px":Je[r.titleFontSize],c=Ze[r.titleWeight],o=r.textAlign;return` 463 <div ${r.animation!=="none"?'class="animated"':""} style="width: 1200px; height: 675px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: ${o}; padding: 80px; background: ${s.backgroundColor}; color: ${s.textColor};"> 464 <h1 style="font-size: ${l}; font-weight: ${c}; margin-bottom: 24px; color: ${s.primaryColor}; line-height: 1.2;"> 465 ${t.title||N.t("slideTemplates.defaults.title")} 466 </h1> 467 ${t.subtitle?` 468 <p style="font-size: ${Ye[r.bodyFontSize]}; opacity: 0.8; max-width: 800px; line-height: 1.5;"> 469 ${t.subtitle} 470 </p> 471 `:""} 472 <div style="position: absolute; bottom: 40px; left: 0; right: 0; text-align: center; font-size: 16px; opacity: 0.4;"> 473 ${n+1} 474 </div> 475 </div>`}function ii(t,s,n,r){const l=Je[r.titleFontSize],c=Ze[r.titleWeight],o=Ye[r.bodyFontSize],d=r.textAlign,a=xt(r.cardStyle,s),p=r.animation!=="none"?'class="animated"':"",i=ri(t.bullets,s,r,o);return` 476 <div ${p} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor}; text-align: ${d};"> 477 <h1 style="font-size: ${l}; font-weight: ${c}; margin-bottom: 16px; color: ${s.primaryColor};"> 478 ${t.title||N.t("slideTemplates.defaults.title")} 479 </h1> 480 ${t.subtitle?` 481 <p style="font-size: ${o}; margin-bottom: 32px; opacity: 0.75;"> 482 ${t.subtitle} 483 </p> 484 `:'<div style="margin-bottom: 32px;"></div>'} 485 ${a?`<div style="${a} padding: 24px; flex: 1;">${i}</div>`:i} 486 <div style="margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 487 ${n+1} 488 </div> 489 </div>`}function li(t,s,n,r){const l=t.leftColumn&&t.leftColumn.length>0?t.leftColumn:t.bullets.slice(0,Math.ceil(t.bullets.length/2)),c=t.rightColumn&&t.rightColumn.length>0?t.rightColumn:t.bullets.slice(Math.ceil(t.bullets.length/2)),o=Je[r.titleFontSize],d=Ze[r.titleWeight],a=Ye[r.bodyFontSize],p=xt(r.cardStyle,s),i=r.animation!=="none"?'class="animated"':"",m=g=>{const b=Ke[r.bulletStyle]||Ke.disc;return g.map((C,w)=>{let D=b(s.accentColor);return D=D.replace("{{INDEX}}",String(w+1)),` 490 <li style="display: flex; align-items: center; font-size: ${a}; line-height: 1.5;"> 491 ${D}
492 <span style="flex: 1;">${C}</span> 493 </li> 494 `}).join("")},x=` 495 <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 48px;"> 496 <ul class="left-column" style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px;"> 497 ${m(l)} 498 </ul> 499 <ul class="right-column" style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px;"> 500 ${m(c)} 501 </ul> 502 </div> 503 `;return` 504 <div ${i} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor};"> 505 <h1 style="font-size: ${o}; font-weight: ${d}; margin-bottom: 16px; color: ${s.primaryColor};"> 506 ${t.title||N.t("slideTemplates.defaults.title")} 507 </h1> 508 ${t.subtitle?`<p style="font-size: ${a}; margin-bottom: 32px; opacity: 0.75;">${t.subtitle}</p>`:'<div style="margin-bottom: 32px;"></div>'} 509 ${p?`<div style="${p} padding: 24px; flex: 1;">${x}</div>`:x} 510 <div style="margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 511 ${n+1} 512 </div> 513 </div>`}function ai(t,s,n,r){const l=Ye[r.bodyFontSize],c=Je[r.titleFontSize],o=Ze[r.titleWeight],d=xt(r.cardStyle,s),a=r.animation!=="none"?'class="animated"':"",p=Ke[r.bulletStyle]||Ke.disc,i=t.bullets.map((g,b)=>{let C=p(s.accentColor);return C=C.replace("{{INDEX}}",String(b+1)),` 514 <li style="display: flex; align-items: center; font-size: ${l}; line-height: 1.5;"> 515 ${C} 516 <span style="flex: 1;">${g}</span> 517 </li> 518 `}).join(""),m=t.imageUrl?`<div style="width: 100%; height: 100%; border-radius: 12px; overflow: hidden;"> 519 <img src="${t.imageUrl}" style="width: 100%; height: 100%; object-fit: contain;" alt="${t.title}" /> 520 </div>`:lr(s,"left"),x=` 521 <h1 style="font-size: ${c}; font-weight: ${o}; margin-bottom: 16px; color: ${s.primaryColor};"> 522 ${t.title||N.t("slideTemplates.defaults.title")} 523 </h1> 524 ${t.subtitle?`<p style="font-size: ${l}; margin-bottom: 24px; opacity: 0.75;">${t.subtitle}</p>`:""} 525 <ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px;"> 526 ${i} 527 </ul> 528 `;return` 529 <div ${a} style="width: 1200px; height: 675px; padding: 60px; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; background: ${s.backgroundColor}; color: ${s.textColor}; position: relative;"> 530 <div style="display: flex; align-items: center; height: 100%;"> 531 ${m} 532 </div> 533 <div style="display: flex; flex-direction: column; justify-content: center; ${d?d+" padding: 24px;":""}"> 534 ${x} 535 </div> 536 <div style="position: absolute; bottom: 24px; right: 40px; font-size: 16px; opacity: 0.4;"> 537 ${n+1} 538 </div> 539 </div>`}function oi(t,s,n,r){const l=Ye[r.bodyFontSize],c=Je[r.titleFontSize],o=Ze[r.titleWeight],d=xt(r.cardStyle,s),a=r.animation!=="none"?'class="animated"':"",p=Ke[r.bulletStyle]||Ke.disc,i=t.bullets.map((g,b)=>{let C=p(s.accentColor);return C=C.replace("{{INDEX}}",String(b+1)),` 540 <li style="display: flex; align-items: center; font-size: ${l}; line-height: 1.5;"> 541 ${C} 542 <span style="flex: 1;">${g}</span> 543 </li> 544 `}).join(""),m=t.imageUrl?`<div style="width: 100%; height: 100%; border-radius: 12px; overflow: hidden;"> 545 <img src="${t.imageUrl}" style="width: 100%; height: 100%; object-fit: contain;" alt="${t.title}" /> 546 </div>`:lr(s,"right"),x=` 547 <h1 style="font-size: ${c}; font-weight: ${o}; margin-bottom: 16px; color: ${s.primaryColor};"> 548 ${t.title||N.t("slideTemplates.defaults.title")} 549 </h1> 550 ${t.subtitle?`<p style="font-size: ${l}; margin-bottom: 24px; opacity: 0.75;">${t.subtitle}</p>`:""} 551 <ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px;"> 552 ${i} 553 </ul> 554 `;return` 555 <div ${a} style="width: 1200px; height: 675px; padding: 60px; display: grid; grid-template-columns: 1fr 1fr; gap: 48px; background: ${s.backgroundColor}; color: ${s.textColor}; position: relative;"> 556 <div style="display: flex; flex-direction: column; justify-content: center; ${d?d+" padding: 24px;":""}"> 557 ${x} 558 </div> 559 <div style="display: flex; align-items: center; height: 100%;"> 560 ${m} 561 </div> 562 <div style="position: absolute; bottom: 24px; right: 40px; font-size: 16px; opacity: 0.4;"> 563 ${n+1} 564 </div> 565 </div>`}function di(t,s,n,r){const l=Je[r.titleFontSize],c=Ze[r.titleWeight],o=Ye[r.bodyFontSize],d=r.animation!=="none"?'class="animated"':"",a=t.imageUrl?`<img src="${t.imageUrl}" style="position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
565" alt="${N.t("slideDefaults.backgroundAlt","Background")}" />`:`<div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.primaryColor}, ${s.accentColor});"></div>`;return` 566 <div ${d} style="width: 1200px; height: 675px; position: relative; overflow: hidden; background: #000;"> 567 ${a} 568 <div style="position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0) 100%);"></div> 569 <div style="position: absolute; bottom: 60px; left: 60px; right: 60px; color: white;"> 570 <h1 style="font-size: ${l}; font-weight: ${c}; margin-bottom: 16px; text-shadow: 0 2px 8px rgba(0,0,0,0.3);"> 571 ${t.title||N.t("slideTemplates.defaults.title")} 572 </h1> 573 ${t.subtitle?` 574 <p style="font-size: ${o}; opacity: 0.9; max-width: 700px; text-shadow: 0 1px 4px rgba(0,0,0,0.3);"> 575 ${t.subtitle} 576 </p> 577 `:""} 578 </div> 579 <div style="position: absolute; bottom: 24px; right: 40px; font-size: 16px; color: white; opacity: 0.6;"> 580 ${n+1} 581 </div> 582 </div>`}function ci(t,s,n,r){const l=t.quote||N.t("slideTemplates.defaults.quotePlaceholder"),c=t.quoteAuthor||"",o=Je[r.titleFontSize],d=Ze[r.titleWeight],a=xt(r.cardStyle,s),p=r.animation!=="none"?'class="animated"':"",i=` 583 ${t.title?` 584 <h1 style="font-size: ${o}; font-weight: ${d}; margin-bottom: 32px; color: ${s.primaryColor};"> 585 ${t.title} 586 </h1> 587 `:""} 588 <blockquote style="font-size: 36px; font-style: italic; line-height: 1.6; max-width: 900px; margin-bottom: 32px;"> 589 ${l} 590 </blockquote> 591 ${c?` 592 <cite style="font-size: 20px; opacity: 0.7; font-style: normal;"> 593 â ${c} 594 </cite> 595 `:""} 596 `;return` 597 <div ${p} style="width: 1200px; height: 675px; padding: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: ${s.backgroundColor}; color: ${s.textColor}; position: relative;"> 598 ${a?`<div style="${a} padding: 48px; display: flex; flex-direction: column; align-items: center;">${i}</div>`:i} 599 <div style="position: absolute; bottom: 24px; right: 40px; font-size: 16px; opacity: 0.4;"> 600 ${n+1} 601 </div> 602 </div>`}function pi(t,s,n,r){const l=Je[r.titleFontSize],c=Ze[r.titleWeight],o=Ye[r.bodyFontSize],d=xt(r.cardStyle,s),a=r.animation!=="none"?'class="animated"':"",p=t.stats&&t.stats.length>0?t.stats:[{value:"100+",label:N.t("slideDefaults.customer","Customers")},{value:"50%",label:N.t("slideDefaults.growthRate","Growth Rate")},{value:"99%",label:N.t("slideDefaults.satisfaction","Satisfaction")}];let i="";if(t.echartsOption){const g=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),b=` 603 <script> 604 (function() { 605 var initFn = function() { 606 var chartDom = document.getElementById('echarts-stats-${n}'); 607 if (chartDom && typeof echarts !== 'undefined') { 608 var myChart = echarts.init(chartDom); 609 var option = ${g}; 610 myChart.setOption(option); 611 window.addEventListener('resize', function() { 612 myChart.resize(); 613 }); 614 } 615 }; 616 // 注åå°å ¨å±åå§å彿°å表 617 window.echartsInitFunctions = window.echartsInitFunctions || []; 618 window.echartsInitFunctions.push(initFn); 619 // 妿 DOM å·²å è½½ä¸ ECharts å·²å¯ç¨ï¼ç«å³æ§è¡ 620 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { 621 initFn(); 622 } 623 })(); 624 <\/script> 625 `;i=` 626 <div id="echarts-stats-${n}" style=" 627 width: 100%; 628 height: 280px; 629 margin-bottom: 24px; 630 background: ${s.primaryColor}05; 631 border-radius: 12px; 632 "></div> 633 ${b} 634 `}const m=p.map(g=>` 635 <div class="stat-item" style="text-align: center; padding: 24px;"> 636 <div class="stat-value" style="font-size: ${t.echartsOption?"40px":"56px"}; font-weight: 700; color: ${s.primaryColor}; margin-bottom: 8px;"> 637 ${g.value} 638 </div> 639 <div class="stat-label" style="font-size: ${o}; opacity: 0.7;"> 640 ${g.label} 641 </div> 642 </div> 643 `).join(""),x=` 644 <div class="stats-grid" style="display: grid; grid-template-columns: repeat(${Math.min(p.length,4)}, 1fr); gap: 32px; align-items: center;"> 645 ${m} 646 </div> 647 `;return` 648 <div ${a} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor};"> 649 <h1 style="font-size: ${l}; font-weight: ${c}; margin-bottom: 16px; color: ${s.primaryColor}; text-align: center;"> 650 ${t.title||N.t("slideTemplates.defaults.statsTitle")} 651 </h1> 652 ${t.subtitle?`<p style="font-size: ${o}; margin-bottom: 24px; opacity: 0.75; text-align: center;">${t.subtitle}</p>`:'<div style="margin-bottom: 24px;"></div>'} 653 654 ${i} 655 656 ${d?`<div style="${d} padding: 24px; flex: 1;">${x}</div>`:x} 657 <div style="margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 658 ${n+1} 659 </div> 660 </div>`}function ui(t,s,n,r){const l=Je[r.titleFontSize],c=Ze[r.titleWeight],o=Ye[r.bodyFontSize],d=r.animation!=="none"?'class="animated"':"",a=t.stats&&t.stats.length>0?t.stats:[{value:"25%",label:"Q1"},{value:"45%",label:"Q2"},{value:"65%",label:"Q3"},{value:"85%",label:"Q4"}];if(t.echartsOption){const x=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),g=` 661 <script> 662 (function() { 663 var initFn = function() { 664 var chartDom = document.getElementById('echarts-container-${n}'); 665 if (chartDom && typeof echarts !== 'undefined') { 666 var myChart = echarts.init(chartDom); 667 var option = ${x}; 668 myChart.setOption(option); 669 window.addEventListener('resize', function() { 670 myChart.resize(); 671 }); 672 } 673 }; 674 // 注åå°å ¨å±åå§å彿°å表 675 window.echartsInitFunctions = window.echartsInitFunctions || []; 676 window.echartsInitFunctions.push(initFn); 677 // 妿 DOM å·²å è½½ä¸ ECharts å·²å¯ç¨ï¼ç«å³æ§è¡ 678 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { 679 initFn(); 680 } 681 })(); 682 <\/script> 683 `;return` 684 <div ${d} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor};"> 685 <h1 style="font-size: ${l}; font-weight: ${c}; margin-bottom: 8px; color: ${s.primaryColor};"> 686 ${t.title||N.t("slideTemplates.defaults.chartTitle")} 687 </h1> 688 ${t.subtitle?`<p style="font-size: ${o}; margin-bottom: 24px; opacity: 0.75;">${t.subtitle}</p>`:'<div style="margin-bottom: 24px;"></div>'} 689 690 <div style="flex: 1; display: flex; flex-direction: column;"> 691 <!-- ECharts å¾è¡¨åºå --> 692 <div id="echarts-container-${n}" style=" 693 flex: 1; 694 min-height: 350px; 695 background: ${s.primaryColor}08; 696 border-radius: 16px; 697 "></div> 698 </div> 699 700 <div style="margin-top: auto; padding-top: 16px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 701 ${n+1} 702 </div> 703 </div> 704 ${g}`}const p=x=>{const g=x.match(/[\d.]+/);if(g){const b=parseFloat(g[0]);if(x.includes("%"))return Math.min(b,100);if(b>100){const C=Math.max(...a.map(w=>{const D=w.value.match(/[\d.]+/);return D?parseFloat(D[0]):0}));return b/C*90+10}return Math.min(b*10,100)}return 50},i=a.map((x,g)=>{const b=p(x.value),C=g===a.length-1;return` 705 <div style="flex: 1; display: flex; flex-direction: column; align-items: center; max-width: 120px;"> 706 <div style=" 707 width: 100%; 708 max-width: 60px; 709 height: ${b}%; 710 background: ${C?s.primaryColor:s.secondaryColor}; 711 border-radius: 8px 8px 0 0; 712 transition: all 0.3s; 713 "></div> 714 <p style="font-size: 14px; margin-top: 12px; color: ${s.textColor}80;">${x.label}</p> 715 <p style="font-size: 16px; font-weight: 600; color: ${s.primaryColor};">${x.value}</p> 716 </div> 717 `}).join(""),m=t.bullets&&t.bullets.length>0?` 718 <div style="margin-top: 24px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;"> 719 ${t.bullets.slice(0,4).map(x=>` 720 <div style=" 721 display: flex; 722 align-items: center; 723 gap: 8px; 724 padding: 8px 16px; 725 background: ${s.primaryColor}10; 726 border-radius: 20px; 727 font-size: 14px; 728 ">
729 <span style="color: ${s.primaryColor};">â¢</span> 730 <span>${x}</span> 731 </div> 732 `).join("")} 733 </div> 734 `:"";return` 735 <div ${d} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor};"> 736 <h1 style="font-size: ${l}; font-weight: ${c}; margin-bottom: 8px; color: ${s.primaryColor};"> 737 ${t.title||N.t("slideTemplates.defaults.chartTitle")} 738 </h1> 739 ${t.subtitle?`<p style="font-size: ${o}; margin-bottom: 24px; opacity: 0.75;">${t.subtitle}</p>`:'<div style="margin-bottom: 24px;"></div>'} 740 741 <div style="flex: 1; display: flex; flex-direction: column;"> 742 <!-- æ±ç¶å¾åºå --> 743 <div style=" 744 flex: 1; 745 display: flex; 746 align-items: flex-end; 747 justify-content: center; 748 gap: 24px; 749 padding: 24px 32px; 750 background: ${s.primaryColor}08; 751 border-radius: 16px; 752 "> 753 ${i} 754 </div> 755 756 <!-- è¦ç¹/说æ --> 757 ${m} 758 </div> 759 760 <div style="margin-top: auto; padding-top: 16px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 761 ${n+1} 762 </div> 763 </div>`}function mi(t,s,n,r){const l=t.leftColumn&&t.leftColumn.length>0?t.leftColumn:[N.t("slideDefaults.advantage1","Advantage 1"),N.t("slideDefaults.advantage2","Advantage 2"),N.t("slideDefaults.advantage3","Advantage 3")],c=t.rightColumn&&t.rightColumn.length>0?t.rightColumn:[N.t("slideDefaults.disadvantage1","Disadvantage 1"),N.t("slideDefaults.disadvantage2","Disadvantage 2"),N.t("slideDefaults.disadvantage3","Disadvantage 3")],o=Je[r.titleFontSize],d=Ze[r.titleWeight],a=Ye[r.bodyFontSize],p=xt(r.cardStyle,s),i=r.animation!=="none"?'class="animated"':"",m=Ke[r.bulletStyle]||Ke.disc,x=(b,C)=>b.map((w,D)=>{let R=m(C);return R=R.replace("{{INDEX}}",String(D+1)),` 764 <li style="display: flex; align-items: center; font-size: ${a}; line-height: 1.5;"> 765 ${R} 766 <span>${w}</span> 767 </li> 768 `}).join(""),g=p||"";return` 769 <div ${i} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor};"> 770 <h1 style="font-size: ${o}; font-weight: ${d}; margin-bottom: 32px; color: ${s.primaryColor}; text-align: center;"> 771 ${t.title||N.t("slideTemplates.defaults.comparisonAnalysis")} 772 </h1> 773 <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 32px;"> 774 <div style="background: ${s.primaryColor}11; border-radius: 12px; padding: 32px; ${g}"> 775 <h3 style="font-size: 24px; font-weight: 600; margin-bottom: 24px; color: ${s.primaryColor};">${N.t("slideTemplates.defaults.advantages")}</h3> 776 <ul style="list-style: none; padding: 0; display: flex; flex-direction: column; gap: 16px;"> 777 ${x(l,"#22c55e")} 778 </ul> 779 </div> 780 <div style="background: ${s.accentColor}11; border-radius: 12px; padding: 32px; ${g}"> 781 <h3 style="font-size: 24px; font-weight: 600; margin-bottom: 24px; color: ${s.accentColor};">${N.t("slideTemplates.defaults.disadvantages")}</h3> 782 <ul style="list-style: none; padding: 0; display: flex; flex-direction: column; gap: 16px;"> 783 ${x(c,"#ef4444")} 784 </ul> 785 </div> 786 </div> 787 <div style="margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 788 ${n+1} 789 </div> 790 </div>`}function xi(t,s,n,r){const l=t.bullets&&t.bullets.length>0?t.bullets:[N.t("slideDefaults.phase1","Phase 1"),N.t("slideDefaults.phase2","Phase 2"),N.t("slideDefaults.phase3","Phase 3"),N.t("slideDefaults.phase4","Phase 4")],c=Je[r.titleFontSize],o=Ze[r.titleWeight],d=Ye[r.bodyFontSize];return` 791 <div ${r.animation!=="none"?'class="animated"':""} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor};"> 792 <h1 style="font-size: ${c}; font-weight: ${o}; margin-bottom: 48px; color: ${s.primaryColor}; text-align: center;"> 793 ${t.title||N.t("slideTemplates.defaults.timeline")} 794 </h1> 795 <div style="flex: 1; display: flex; align-items: center; position: relative;"> 796 <div style="position: absolute; top: 50%; left: 60px; right: 60px; height: 4px; background: ${s.primaryColor}33;"></div> 797 <div style="display: flex; justify-content: space-between; width: 100%; padding: 0 40px;"> 798 ${l.map((p,i)=>` 799 <div style="display: flex; flex-direction: column; align-items: center; position: relative; z-index: 1;"> 800 <div style="width: 40px; height: 40px; border-radius: 50%; background: ${s.primaryColor}; color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; margin-bottom: 16px;"> 801 ${i+1} 802 </div> 803 <div style="text-align: center; max-width: 150px; font-size: ${d};"> 804 ${p} 805 </div> 806 </div> 807 `).join("")} 808 </div> 809 </div> 810 <div style="margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 811 ${n+1} 812 </div> 813 </div>`}function hi(t,s,n,r){const l=Je[r.titleFontSize],c=Ze[r.titleWeight],o=Ye[r.bodyFontSize],d=xt(r.cardStyle,s),a=r.animation!=="none"?'class="animated"':"",p=Ke[r.bulletStyle]||Ke.disc,m=` 814 <ul style="list-style: none; padding: 0; margin: 0 auto; max-width: 900px; display: flex; flex-direction: column; gap: 24px;"> 815 ${t.bullets.map((x,g)=>{let b=p(s.accentColor);return b=b.replace("{{INDEX}}",String(g+1)),` 816 <li style="display: flex; align-items: center; font-size: ${o}; line-height: 1.5;"> 817 ${b}
818 <span style="flex: 1;">${x}</span> 819 </li> 820 `}).join("")} 821 </ul> 822 `;return` 823 <div ${a} style="width: 1200px; height: 675px; padding: 60px 80px; display: flex; flex-direction: column; background: ${s.backgroundColor}; color: ${s.textColor};"> 824 <h1 style="font-size: ${l}; font-weight: ${c}; margin-bottom: 16px; color: ${s.primaryColor}; text-align: center;"> 825 ${t.title||N.t("slideTemplates.defaults.summary")} 826 </h1> 827 ${t.subtitle?`<p style="font-size: ${o}; margin-bottom: 40px; opacity: 0.75; text-align: center;">${t.subtitle}</p>`:'<div style="margin-bottom: 40px;"></div>'} 828 ${d?`<div style="${d} padding: 32px; flex: 1; display: flex; align-items: center;">${m}</div>`:m} 829 <div style="margin-top: auto; padding-top: 24px; display: flex; justify-content: flex-end; font-size: 16px; opacity: 0.4;"> 830 ${n+1} 831 </div> 832 </div>`}function gi(){return{title:"",subtitle:"",bullets:[],notes:"",imageUrl:"",imageKeywords:"",leftColumn:[],rightColumn:[],leftTitle:"",rightTitle:"",quote:"",quoteAuthor:"",stats:[]}}function fi(t){switch(t){case"title":return{title:N.t("slideDefaults.presentationTitle","Presentation Title"),subtitle:N.t("slideDefaults.subtitleText","Subtitle or description text")};case"content":return{title:N.t("slideDefaults.contentTitle","Content Title"),bullets:[N.t("slideDefaults.pointOne","Point One"),N.t("slideDefaults.pointTwo","Point Two"),N.t("slideDefaults.pointThree","Point Three")]};case"two-column":return{title:N.t("slideDefaults.twoColumnTitle","Two-Column Layout"),leftColumn:[N.t("slideDefaults.leftPoint1","Left Point 1"),N.t("slideDefaults.leftPoint2","Left Point 2")],rightColumn:[N.t("slideDefaults.rightPoint1","Right Point 1"),N.t("slideDefaults.rightPoint2","Right Point 2")]};case"image-left":case"image-right":return{title:N.t("slideDefaults.imageTextTitle","Image & Text Layout"),bullets:[N.t("slideDefaults.pointOne","Point One"),N.t("slideDefaults.pointTwo","Point Two")],imageKeywords:N.t("slideDefaults.imageKeywords","Relevant image keywords")};case"full-image":return{title:N.t("slideDefaults.fullImageTitle","Full-Screen Image"),subtitle:N.t("slideDefaults.imageCaption","Image caption")};case"quote":return{title:N.t("slideDefaults.quoteTitle","Quote"),quote:N.t("slideDefaults.quoteContent","Quote content goes here"),quoteAuthor:N.t("slideDefaults.quoteAuthor","Author name")};case"stats":return{title:N.t("slideDefaults.statsTitle","Key Metrics"),stats:[{value:"100+",label:N.t("slideDefaults.customerCount","Number of Customers")},{value:"50%",label:N.t("slideDefaults.growthRate","Growth Rate")}]};case"comparison":return{title:N.t("slideDefaults.comparisonTitle","Comparison Analysis"),leftColumn:[N.t("slideDefaults.advantage1","Advantage 1"),N.t("slideDefaults.advantage2","Advantage 2")],rightColumn:[N.t("slideDefaults.disadvantage1","Disadvantage 1"),N.t("slideDefaults.disadvantage2","Disadvantage 2")]};case"timeline":return{title:N.t("slideDefaults.timelineTitle","Timeline"),bullets:[N.t("slideDefaults.phase1","Phase 1"),N.t("slideDefaults.phase2","Phase 2"),N.t("slideDefaults.phase3","Phase 3"),N.t("slideDefaults.phase4","Phase 4")]};case"summary":return{title:N.t("slideDefaults.summaryTitle","Summary"),bullets:[N.t("slideDefaults.pointOne","Point One"),N.t("slideDefaults.pointTwo","Point Two"),N.t("slideDefaults.pointThree","Point Three")]};default:return{title:N.t("slideDefaults.newSlide","New Slide")}}}function bi(t){return{primary:t.primaryColor,secondary:t.secondaryColor,accent:t.accentColor,background:t.backgroundColor,text:t.textColor,muted:t.mutedColor||t.textColor+"99"}}function yi(t,s,n){if(s===0)return"cover";if(s===n-1)return"end";switch(t){case"title":return"cover";case"two-column":return"comparison";case"comparison":return"comparison";case"stats":return"chart";case"chart":return"chart";case"timeline":return"timeline";case"quote":return"content";case"summary":return"content";case"image-left":return"image-left";case"image-right":return"image-right";case"full-image":return"full-image";default:return"content"}}function Is(t,s,n,r,l){const c=Array(r).fill(0).map((d,a)=>` 833 <div style="width: 8px; height: 8px; border-radius: 50%; transition: all 0.3s; ${a===n?"background: white; transform: scale(1.25);":"background: rgba(255,255,255,0.3);"}"></div> 834 `).join("");let o="";if(l==="cover")t.imageUrl?o=` 835 <div style="position: absolute; inset: 0; z-index: 0;"> 836 <img src="${t.imageUrl}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 837 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.background}dd 0%, ${s.background}99 50%, ${s.background}66 100%);"></div> 838 </div> 839 <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: center;"> 840 <div style="width: 80px; height: 4px; margin-bottom: 24px; background: ${s.secondary};"></div> 841 <h1 style="font-size: 48px; font-weight: 700; margin-bottom: 16px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 842 <p style="font-size: 20px; letter-spacing: 0.1em; color: ${s.muted};">${t.subtitle||""}</p> 843 </div> 844 `:o=` 845 <div style="height: 100%; display: flex; flex-direction: column; justify-content: center;"> 846 <div style="width: 80px; height: 4px; margin-bottom: 24px; background: ${s.secondary};"></div> 847 <h1 style="font-size: 48px; font-weight: 700; margin-bottom: 16px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 848 <p style="font-size: 20px; letter-spacing: 0.1em; color: ${s.muted};">${t.subtitle||""}</p> 849 </div> 850 `;else if(l==="end")o=` 851 <div style="height: 100%; display: flex; flex-direction: column; justify-content: center;"> 852 <div style="width: 80px; height: 4px; margin-bottom: 24px; background: ${s.secondary};"></div> 853 <h1 style="font-size: 48px; font-weight: 700; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 854 <p style="font-size: 20px; letter-spacing: 0.1em; color: ${s.muted};">${t.subtitle||""}</p> 855 </div> 856 `;else if(l==="section"){const d=t.bullets||[];o=` 857 <div style="height: 100%; display: flex; flex-direction: column; justify-content: center;"> 858 <h2 style="font-size: 32px; font-weight: 700; margin-bottom: 40px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.agenda")}</h2> 859 <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px;"> 860 ${d.map((a,p)=>` 861 <div style="display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 8px; background: ${s.primary}08;">
862 <span style="font-size: 32px; font-weight: 300; color: ${s.primary};">${String(p+1).padStart(2,"0")}</span> 863 <span style="font-size: 18px; color: ${s.text};">${a}</span> 864 </div> 865 `).join("")} 866 </div> 867 </div> 868 `}else if(l==="comparison"){const d=t.leftColumn&&t.leftColumn.length>0?t.leftColumn:t.bullets.slice(0,3),a=t.rightColumn&&t.rightColumn.length>0?t.rightColumn:t.bullets.slice(3);o=` 869 <div style="height: 100%; display: flex; flex-direction: column;"> 870 <h2 style="font-size: 32px; font-weight: 700; margin-bottom: 32px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.comparison")}</h2> 871 <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 32px;"> 872 <div style="padding: 24px; border-radius: 8px; border-left: 4px solid ${s.primary}; background: ${s.primary}05;"> 873 <h3 style="font-size: 20px; font-weight: 600; margin-bottom: 16px; color: ${s.primary};">${t.leftTitle||N.t("slideTemplates.defaults.leftColumn")}</h3> 874 ${d.map(p=>` 875 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px;"> 876 <div style="width: 6px; height: 6px; border-radius: 50%; background: ${s.primary};"></div> 877 <span style="color: ${s.text};">${p}</span> 878 </div> 879 `).join("")} 880 </div> 881 <div style="padding: 24px; border-radius: 8px; border-left: 4px solid ${s.secondary}; background: ${s.secondary}05;"> 882 <h3 style="font-size: 20px; font-weight: 600; margin-bottom: 16px; color: ${s.secondary};">${t.rightTitle||N.t("slideTemplates.defaults.rightColumn")}</h3> 883 ${a.map(p=>` 884 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px;"> 885 <div style="width: 6px; height: 6px; border-radius: 50%; background: ${s.secondary};"></div> 886 <span style="color: ${s.text};">${p}</span> 887 </div> 888 `).join("")} 889 </div> 890 </div> 891 </div> 892 `}else if(l==="chart"){const d=t.stats&&t.stats.length>0?t.stats:[{value:"60%",label:"Q1"},{value:"80%",label:"Q2"},{value:"70%",label:"Q3"},{value:"95%",label:"Q4"}];if(t.echartsOption){const a=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),p=` 893 <script> 894 (function() { 895 var initFn = function() { 896 var chartDom = document.getElementById('echarts-corporate-${n}'); 897 if (chartDom && typeof echarts !== 'undefined') { 898 var myChart = echarts.init(chartDom); 899 var option = ${a}; 900 myChart.setOption(option); 901 window.addEventListener('resize', function() { myChart.resize(); }); 902 } 903 }; 904 window.echartsInitFunctions = window.echartsInitFunctions || []; 905 window.echartsInitFunctions.push(initFn); 906 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { initFn(); } 907 })(); 908 <\/script> 909 `;o=` 910 <div style="height: 100%; display: flex; flex-direction: column;"> 911 <div style="margin-bottom: 24px;"> 912 <h2 style="font-size: 32px; font-weight: 700; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 913 <p style="font-size: 14px; text-transform: uppercase; letter-spacing: 0.2em; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 914 </div> 915 <div id="echarts-corporate-${n}" style="flex: 1; min-height: 300px; border-radius: 12px; background: ${s.primary}05;"></div> 916 </div> 917 ${p} 918 `}else{const a=x=>{const g=x.match(/[\d.]+/);return g?parseFloat(g[0]):50},p=d.map(x=>a(x.value)),i=Math.max(...p,1),m=p.map(x=>Math.round(20+x/i*75));o=` 919 <div style="height: 100%; display: flex; flex-direction: column;"> 920 <div style="margin-bottom: 32px;"> 921 <h2 style="font-size: 32px; font-weight: 700; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 922 <p style="font-size: 14px; text-transform: uppercase; letter-spacing: 0.2em; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 923 </div> 924 <div style="flex: 1; display: flex; align-items: center;"> 925 <div style="width: 100%; display: grid; grid-template-columns: repeat(${d.length}, 1fr); gap: 24px;"> 926 ${d.map((x,g)=>` 927 <div style="display: flex; flex-direction: column; align-items: center;"> 928 <div style="width: 100%; height: 160px; position: relative; display: flex; align-items: flex-end; justify-content: center; margin-bottom: 12px;"> 929 <div style="width: 100%; max-width: 64px; height: ${m[g]}%; background: ${g===d.length-1?s.primary:s.secondary}; border-radius: 4px 4px 0 0;"></div> 930 </div> 931 <p style="font-size: 12px; font-weight: 500; color: ${s.muted};">${x.label}</p> 932 <p style="font-size: 14px; font-weight: 700; color: ${s.primary};">${x.value}</p> 933 </div> 934 `).join("")} 935 </div> 936 </div> 937 </div> 938 `}}else if(l==="image-left"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 939 <div style="height: 100%; display: grid; grid-template-columns: 40% 60%; gap: 32px;"> 940 <div style="position: relative; border-radius: 8px; overflow: hidden; background: ${s.primary}10;"> 941 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 942 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.primary}20, transparent);"></div> 943 </div> 944 <div style="display: flex; flex-direction: column; justify-content: center;"> 945 <h2 style="font-size: 32px; font-weight: 700; margin-bottom: 12px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 946 <p style="font-size: 14px; text-transform: uppercase; letter-spacing: 0.2em; margin-bottom: 24px; color: ${s.muted};">${t.subtitle||""}</p> 947 <div style="display: flex; flex-direction: column; gap: 16px;"> 948 ${d.map(p=>` 949 <div style="display: flex; align-items: flex-start; gap: 12px;"> 950 <div style="width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; background: ${s.secondary};"></div> 951 <p style="font-size: 16px; line-height: 1.5; color: ${s.text};">${p}</p> 952 </div> 953 `).join("")} 954 </div> 955 </div> 956 </div> 957 `}else if(l==="image-right"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 958 <div style="height: 100%; display: grid; grid-template-columns: 60% 40%; gap: 32px;"> 959 <div style="display: flex; flex-direction: column; justify-content: center;"> 960 <h2 style="font-size: 32px; font-weight: 700; margin-bottom: 12px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 961 <p style="font-size: 14px; text-transform: uppercase; letter-spacing: 0.2em; margin-bottom: 24px; color: ${s.muted};">${t.subtitle||""}</p> 962 <div style="display: flex; flex-direction: column; gap: 16px;"> 963 ${d.map(p=>` 964 <div style="display: flex; align-items: flex-start; gap: 12px;"> 965 <div style="width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; background: ${s.secondary};"></div> 966 <p style="font-size: 16px; line-height: 1.5; color: ${s.text};">${p}</p> 967 </div> 968 `).join("")} 969 </div> 970 </div> 971 <div style="position: relative; border-radius: 8px; overflow: hidden; background: ${s.primary}10;"> 972 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 973 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, transparent, ${s.primary}20);"></div> 974 </div> 975 </div> 976 `}else if(l==="full-image")o=` 977 <div style="position: absolute; inset: 0;"> 978 <img src="${t.imageUrl||"https://picsum.photos/1200/675?random="+n}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 979 <div style="position: absolute; inset: 0; background: linear-gradient(to right, ${s.background}ee 0%, ${s.background}99 40%, transparent 70%);"></div> 980 <div style="position: absolute; inset: 0; padding: 64px; display: flex; flex-direction: column; justify-content: center; max-width: 50%;"> 981 <h2 style="font-size: 40px; font-weight: 700; margin-bottom: 16px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 982 <p style="font-size: 18px; line-height: 1.6; color: ${s.muted};">${t.subtitle||""}</p> 983 </div> 984 </div> 985 `;else{const d=t.bullets||[];o=` 986 <div style="height: 100%; display: flex; flex-direction: column;"> 987 <div style="margin-bottom: 32px;"> 988 <h2 style="font-size: 32px; font-weight: 700; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 989 <p style="font-size: 14px; text-transform: uppercase; letter-spacing: 0.2em; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 990 </div> 991 <div style="flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px;"> 992 ${d.map(a=>` 993 <div style="display: flex; align-items: flex-start; gap: 16px;"> 994 <div style="width: 8px; height: 8px; border-radius: 50%; margin-top: 10px; flex-shrink: 0; background: ${s.secondary};"></div> 995 <p style="font-size: 18px; line-height: 1.5; color: ${s.text};">${a}
995</p> 996 </div> 997 `).join("")} 998 </div> 999 </div> 1000 `}return` 1001 <div class="slide" style="position: relative; width: 1200px; height: 675px; background: ${s.background}; overflow: hidden;"> 1002 <!-- Left Sidebar --> 1003 <div style="position: absolute; left: 0; top: 0; bottom: 0; width: 64px; background: ${s.primary};"> 1004 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 32px 0;"> 1005 <div style="width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.2);"></div> 1006 <div style="display: flex; flex-direction: column; gap: 8px;"> 1007 ${c} 1008 </div> 1009 <div style="width: 24px; height: 24px; border: 2px solid rgba(255,255,255,0.3); border-radius: 4px;"></div> 1010 </div> 1011 </div> 1012 <!-- Main Content --> 1013 <div style="position: absolute; left: 64px; right: 0; top: 0; bottom: 0; padding: 40px;"> 1014 ${o} 1015 </div> 1016 <!-- Page Number --> 1017 <div style="position: absolute; bottom: 16px; right: 24px; font-size: 14px; color: ${s.muted};"> 1018 ${String(n+1).padStart(2,"0")} / ${String(r).padStart(2,"0")} 1019 </div> 1020 </div> 1021 `}function vi(t,s,n,r,l){const c=`<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="${s.secondary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"></polygon></svg>`;let o="";if(l==="cover")t.imageUrl?o=` 1022 <div style="position: absolute; inset: 0; z-index: 0;"> 1023 <img src="${t.imageUrl}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1024 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.background}ee 0%, ${s.background}cc 50%, ${s.background}99 100%);"></div> 1025 </div> 1026 <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1027 <div style="position: relative;"> 1028 <h1 style="font-size: 56px; font-weight: 700; margin-bottom: 16px; color: ${s.text}; text-shadow: 0 0 40px ${s.primary}60, 0 0 80px ${s.primary}30;">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1029 <p style="font-size: 20px; letter-spacing: 0.5em; text-transform: uppercase; color: ${s.secondary};">${t.subtitle||""}</p> 1030 </div> 1031 <div style="position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;"> 1032 <div style="width: 64px; height: 1px; background: ${s.secondary};"></div> 1033 <div style="width: 12px; height: 12px; transform: rotate(45deg); border: 1px solid ${s.primary};"></div> 1034 <div style="width: 64px; height: 1px; background: ${s.secondary};"></div> 1035 </div> 1036 </div> 1037 `:o=` 1038 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1039 <div style="position: relative;"> 1040 <h1 style="font-size: 56px; font-weight: 700; margin-bottom: 16px; color: ${s.text}; text-shadow: 0 0 40px ${s.primary}60, 0 0 80px ${s.primary}30;">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1041 <p style="font-size: 20px; letter-spacing: 0.5em; text-transform: uppercase; color: ${s.secondary};">${t.subtitle||""}</p> 1042 </div> 1043 <div style="position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;"> 1044 <div style="width: 64px; height: 1px; background: ${s.secondary};"></div> 1045 <div style="width: 12px; height: 12px; transform: rotate(45deg); border: 1px solid ${s.primary};"></div> 1046 <div style="width: 64px; height: 1px; background: ${s.secondary};"></div> 1047 </div> 1048 </div> 1049 `;else if(l==="end")o=` 1050 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1051 <div style="position: relative;"> 1052 <h1 style="font-size: 56px; font-weight: 700; margin-bottom: 16px; color: ${s.text}; text-shadow: 0 0 40px ${s.primary}60, 0 0 80px ${s.primary}30;">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1053 <p style="font-size: 20px; letter-spacing: 0.5em; text-transform: uppercase; color: ${s.secondary};">${t.subtitle||""}</p> 1054 </div> 1055 <div style="position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;"> 1056 <div style="width: 64px; height: 1px; background: ${s.secondary};"></div> 1057 <div style="width: 12px; height: 12px; transform: rotate(45deg); border: 1px solid ${s.primary};"></div> 1058 <div style="width: 64px; height: 1px; background: ${s.secondary};"></div> 1059 </div> 1060 </div> 1061 `;else if(l==="section"){const d=t.bullets||[];o=` 1062 <div style="height: 100%; display: flex; align-items: center;"> 1063 <div style="width: 100%;"> 1064 <h2 style="font-size: 40px; font-weight: 700; margin-bottom: 48px; letter-spacing: 0.1em; color: ${s.primary};">< ${t.title||N.t("slideTemplates.defaults.agendaTech")} /></h2> 1065 <div style="display: flex; flex-direction: column; gap: 16px;"> 1066 ${d.map((a,p)=>` 1067 <div style="display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 4px; border: 1px solid ${s.primary}40; background: ${s.primary}10; backdrop-filter: blur(4px);">
1068 <span style="font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 24px; color: ${s.secondary};">${String(p+1).padStart(2,"0")}</span> 1069 <span style="font-size: 18px; color: ${s.text};">${a}</span> 1070 <div style="margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: ${s.accent};"></div> 1071 </div> 1072 `).join("")} 1073 </div> 1074 </div> 1075 </div> 1076 `}else if(l==="chart"){const d=t.stats&&t.stats.length>0?t.stats:[{value:"100K+",label:"QPS"},{value:"<10ms",label:N.t("slideDefaults.latency","Latency")},{value:"99.99%",label:N.t("slideDefaults.availability","Availability")},{value:"50K",label:N.t("slideDefaults.concurrency","Concurrency")}];if(t.echartsOption){const a=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),p=` 1077 <script> 1078 (function() { 1079 var initFn = function() { 1080 var chartDom = document.getElementById('echarts-tech-${n}'); 1081 if (chartDom && typeof echarts !== 'undefined') { 1082 var myChart = echarts.init(chartDom); 1083 var option = ${a}; 1084 myChart.setOption(option); 1085 window.addEventListener('resize', function() { myChart.resize(); }); 1086 } 1087 }; 1088 window.echartsInitFunctions = window.echartsInitFunctions || []; 1089 window.echartsInitFunctions.push(initFn); 1090 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { initFn(); } 1091 })(); 1092 <\/script> 1093 `;o=` 1094 <div style="height: 100%; display: flex; flex-direction: column;"> 1095 <div style="margin-bottom: 24px;"> 1096 <h2 style="font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; color: ${s.text};">$ ${t.title||N.t("slideTemplates.defaults.performanceMetrics")}</h2> 1097 <p style="font-size: 14px; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-top: 8px; color: ${s.secondary};">${t.subtitle||""}</p> 1098 </div> 1099 <div id="echarts-tech-${n}" style="flex: 1; min-height: 300px; border-radius: 4px; border: 1px solid ${s.primary}60; background: ${s.primary}10;"></div> 1100 </div> 1101 ${p} 1102 `}else o=` 1103 <div style="height: 100%; display: flex; flex-direction: column;"> 1104 <div style="margin-bottom: 32px;"> 1105 <h2 style="font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; color: ${s.text};">$ ${t.title||N.t("slideTemplates.defaults.performanceMetrics")}</h2> 1106 <p style="font-size: 14px; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-top: 8px; color: ${s.secondary};">${t.subtitle||""}</p> 1107 </div> 1108 <div style="flex: 1; display: flex; align-items: center; justify-content: center;"> 1109 <div style="display: grid; grid-template-columns: repeat(${d.length}, 1fr); gap: 32px; width: 100%; max-width: 800px;"> 1110 ${d.map(a=>` 1111 <div style="text-align: center; padding: 16px; border-radius: 4px; border: 1px solid ${s.primary}60; background: ${s.primary}10; backdrop-filter: blur(4px);"> 1112 <p style="font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-bottom: 8px; color: ${s.secondary};">${a.value}</p> 1113 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: ${s.muted};">${a.label}</p> 1114 </div> 1115 `).join("")} 1116 </div> 1117 </div> 1118 </div> 1119 `}else if(l==="timeline"){const d=t.bullets||[];o=` 1120 <div style="height: 100%; display: flex; flex-direction: column;"> 1121 <h2 style="font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-bottom: 32px; color: ${s.text};">< ${t.title||N.t("slideTemplates.defaults.techStack")} /></h2> 1122 <div style="flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 12px;"> 1123 ${d.map((a,p)=>` 1124 <div style="display: flex; align-items: center; gap: 16px; padding: 12px; border-radius: 4px; font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 14px; border: 1px solid ${s.primary}40; background: ${s.primary}08;">
1125 <span style="font-size: 12px; padding: 2px 8px; border-radius: 4px; background: ${s.secondary}; color: ${s.background};">${String(p+1).padStart(2,"0")}</span> 1126 <code style="color: ${s.text};">${a}</code> 1127 </div> 1128 `).join("")} 1129 </div> 1130 </div> 1131 `}else if(l==="image-left"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 1132 <div style="height: 100%; display: grid; grid-template-columns: 40% 60%; gap: 32px;"> 1133 <div style="position: relative; border-radius: 4px; overflow: hidden; border: 1px solid ${s.primary}60; box-shadow: 0 0 20px ${s.primary}40;"> 1134 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1135 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.primary}30, transparent);"></div> 1136 </div> 1137 <div style="display: flex; flex-direction: column; justify-content: center;"> 1138 <h2 style="font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-bottom: 12px; color: ${s.text};">// ${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1139 <p style="font-size: 14px; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-bottom: 24px; color: ${s.secondary};">${t.subtitle||""}</p> 1140 <div style="display: flex; flex-direction: column; gap: 12px;"> 1141 ${d.map(p=>` 1142 <div style="display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 4px; border-left: 2px solid ${s.primary}; background: ${s.primary}08;"> 1143 ${c} 1144 <p style="font-size: 14px; line-height: 1.5; color: ${s.text};">${p}</p> 1145 </div> 1146 `).join("")} 1147 </div> 1148 </div> 1149 </div> 1150 `}else if(l==="image-right"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 1151 <div style="height: 100%; display: grid; grid-template-columns: 60% 40%; gap: 32px;"> 1152 <div style="display: flex; flex-direction: column; justify-content: center;"> 1153 <h2 style="font-size: 28px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-bottom: 12px; color: ${s.text};">// ${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1154 <p style="font-size: 14px; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-bottom: 24px; color: ${s.secondary};">${t.subtitle||""}</p> 1155 <div style="display: flex; flex-direction: column; gap: 12px;"> 1156 ${d.map(p=>` 1157 <div style="display: flex; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 4px; border-left: 2px solid ${s.primary}; background: ${s.primary}08;"> 1158 ${c} 1159 <p style="font-size: 14px; line-height: 1.5; color: ${s.text};">${p}</p> 1160 </div> 1161 `).join("")} 1162 </div> 1163 </div> 1164 <div style="position: relative; border-radius: 4px; overflow: hidden; border: 1px solid ${s.primary}60; box-shadow: 0 0 20px ${s.primary}40;"> 1165 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1166 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, transparent, ${s.primary}30);"></div> 1167 </div> 1168 </div> 1169 `}else if(l==="full-image")o=` 1170 <div style="position: absolute; inset: 0;"> 1171 <img src="${t.imageUrl||"https://picsum.photos/1200/675?random="+n}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1172 <div style="position: absolute; inset: 0; background: linear-gradient(to right, ${s.background}ee 0%, ${s.background}cc 40%, ${s.background}40 100%);"></div> 1173 <div style="position: absolute; inset: 0; padding: 64px; display: flex; flex-direction: column; justify-content: center; max-width: 50%;"> 1174 <h2 style="font-size: 36px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-bottom: 16px; color: ${s.text}; text-shadow: 0 0 20px ${s.primary}60;">< ${t.title||N.t("slideTemplates.defaults.contentTitle")} /></h2> 1175 <p style="font-size: 16px; font-family: 'JetBrains Mono', 'Fira Code', monospace; line-height: 1.6; color: ${s.secondary};">${t.subtitle||""}</p> 1176 </div> 1177 </div> 1178 `;else{const d=t.bullets||[];o=` 1179 <div style="height: 100%; display: flex; flex-direction: column;"> 1180 <div style="margin-bottom: 32px;"> 1181 <h2 style="font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', 'Fira Code', monospace; color: ${s.text};">// ${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1182 <p style="font-size: 14px; font-family: 'JetBrains Mono', 'Fira Code', monospace; margin-top: 8px; color: ${s.secondary};">${t.subtitle||""}</p> 1183 </div> 1184 <div style="flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px;"> 1185 ${d.map(a=>` 1186 <div style="display: flex; align-items: flex-start; gap: 16px; padding: 12px; border-radius: 4px; border-left: 2px solid ${s.primary}; background: ${s.primary}08;"> 1187 ${c} 1188 <p style="font-size: 16px; line-height: 1.5; color: ${s.text};">${a}
1188</p> 1189 </div> 1190 `).join("")} 1191 </div> 1192 </div> 1193 `}return` 1194 <div style="position: relative; width: 1200px; height: 675px; background: ${s.background}; overflow: hidden;"> 1195 <!-- Grid Background --> 1196 <div style="position: absolute; inset: 0; opacity: 0.1; background-image: linear-gradient(${s.primary}40 1px, transparent 1px), linear-gradient(90deg, ${s.primary}40 1px, transparent 1px); background-size: 40px 40px;"></div> 1197 <!-- Neon Glow Top-Right --> 1198 <div style="position: absolute; top: 0; right: 0; width: 384px; height: 384px; opacity: 0.2; filter: blur(48px); background: radial-gradient(circle, ${s.primary} 0%, transparent 70%);"></div> 1199 <!-- Neon Glow Bottom-Left --> 1200 <div style="position: absolute; bottom: 0; left: 0; width: 288px; height: 288px; opacity: 0.2; filter: blur(48px); background: radial-gradient(circle, ${s.secondary} 0%, transparent 70%);"></div> 1201 <!-- Top Neon Line --> 1202 <div style="position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, ${s.secondary}, ${s.primary}, transparent);"></div> 1203 <!-- Bottom Neon Line --> 1204 <div style="position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, ${s.primary}, ${s.secondary}, transparent);"></div> 1205 <!-- Main Content --> 1206 <div style="position: relative; height: 100%; padding: 40px; z-index: 10;"> 1207 ${o} 1208 </div> 1209 <!-- Page Number --> 1210 <div style="position: absolute; bottom: 16px; right: 24px; font-size: 14px; font-family: 'JetBrains Mono', 'Fira Code', monospace; color: ${s.muted};"> 1211 [${String(n+1).padStart(2,"0")}/${String(r).padStart(2,"0")}] 1212 </div> 1213 </div> 1214 `}function wi(t,s,n,r,l){const c='<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"/><path d="M5 3v4"/><path d="M19 17v4"/><path d="M3 5h4"/><path d="M17 19h4"/></svg>';let o="";if(l==="cover")t.imageUrl?o=` 1215 <div style="position: absolute; inset: 0; z-index: 0;"> 1216 <img src="${t.imageUrl}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1217 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.background}dd 0%, ${s.background}aa 50%, ${s.background}77 100%);"></div> 1218 </div> 1219 <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1220 <div style="display: inline-block; padding: 32px; border-radius: 24px; margin-bottom: 24px; background: linear-gradient(135deg, ${s.primary}30, ${s.secondary}30); backdrop-filter: blur(10px);"> 1221 <h1 style="font-size: 48px; font-weight: 900; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1222 </div> 1223 <p style="font-size: 20px; font-weight: 500; color: ${s.muted};">${t.subtitle||""}</p> 1224 </div> 1225 `:o=` 1226 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1227 <div style="display: inline-block; padding: 32px; border-radius: 24px; margin-bottom: 24px; background: linear-gradient(135deg, ${s.primary}20, ${s.secondary}20);"> 1228 <h1 style="font-size: 48px; font-weight: 900; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1229 </div> 1230 <p style="font-size: 20px; font-weight: 500; color: ${s.muted};">${t.subtitle||""}</p> 1231 </div> 1232 `;else if(l==="end")o=` 1233 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1234 <div style="display: inline-block; padding: 32px; border-radius: 24px; margin-bottom: 24px; background: linear-gradient(135deg, ${s.primary}20, ${s.secondary}20);"> 1235 <h1 style="font-size: 48px; font-weight: 900; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1236 </div> 1237 <p style="font-size: 20px; font-weight: 500; color: ${s.muted};">${t.subtitle||""}</p> 1238 </div> 1239 `;else if(l==="section"){const d=t.bullets||[];o=` 1240 <div style="height: 100%; display: flex; align-items: center;"> 1241 <div style="width: 100%;"> 1242 <h2 style="font-size: 40px; font-weight: 900; margin-bottom: 40px; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.proposalOverview")}</h2> 1243 <div style="display: flex; flex-wrap: wrap; gap: 16px;"> 1244 ${d.map((a,p)=>` 1245 <div style="padding: 16px 24px; border-radius: 16px; border: 2px solid ${p%2===0?s.primary:s.secondary}; background: ${p%2===0?s.primary:s.secondary}10; transition: transform 0.3s;">
1246 <span style="font-size: 18px; font-weight: 600; color: ${s.text};">${a}</span> 1247 </div> 1248 `).join("")} 1249 </div> 1250 </div> 1251 </div> 1252 `}else if(l==="comparison"){const d=t.leftColumn&&t.leftColumn.length>0?t.leftColumn:t.bullets.slice(0,3),a=t.rightColumn&&t.rightColumn.length>0?t.rightColumn:t.bullets.slice(3);o=` 1253 <div style="height: 100%; display: flex; flex-direction: column;"> 1254 <h2 style="font-size: 32px; font-weight: 900; margin-bottom: 32px; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.comparison")}</h2> 1255 <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 32px;"> 1256 <div style="padding: 24px; border-radius: 24px; background: linear-gradient(180deg, ${s.primary}15, ${s.primary}05);"> 1257 <h3 style="font-size: 20px; font-weight: 700; margin-bottom: 16px; color: ${s.primary};">${t.leftTitle||N.t("slideTemplates.defaults.leftColumn")}</h3> 1258 ${d.map(p=>` 1259 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px;"> 1260 <div style="width: 8px; height: 8px; border-radius: 50%; background: ${s.primary};"></div> 1261 <span style="color: ${s.text};">${p}</span> 1262 </div> 1263 `).join("")} 1264 </div> 1265 <div style="padding: 24px; border-radius: 24px; background: linear-gradient(180deg, ${s.secondary}15, ${s.secondary}05);"> 1266 <h3 style="font-size: 20px; font-weight: 700; margin-bottom: 16px; color: ${s.secondary};">${t.rightTitle||N.t("slideTemplates.defaults.rightColumn")}</h3> 1267 ${a.map(p=>` 1268 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px;"> 1269 <div style="width: 8px; height: 8px; border-radius: 50%; background: ${s.secondary};"></div> 1270 <span style="color: ${s.text};">${p}</span> 1271 </div> 1272 `).join("")} 1273 </div> 1274 </div> 1275 </div> 1276 `}else if(l==="chart"){const d=t.stats&&t.stats.length>0?t.stats:[{value:"50%",label:"Q1"},{value:"70%",label:"Q2"},{value:"60%",label:"Q3"},{value:"90%",label:"Q4"}];if(t.echartsOption){const a=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),p=` 1277 <script> 1278 (function() { 1279 var initFn = function() { 1280 var chartDom = document.getElementById('echarts-creative-${n}'); 1281 if (chartDom && typeof echarts !== 'undefined') { 1282 var myChart = echarts.init(chartDom); 1283 var option = ${a}; 1284 myChart.setOption(option); 1285 window.addEventListener('resize', function() { myChart.resize(); }); 1286 } 1287 }; 1288 window.echartsInitFunctions = window.echartsInitFunctions || []; 1289 window.echartsInitFunctions.push(initFn); 1290 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { initFn(); } 1291 })(); 1292 <\/script> 1293 `;o=` 1294 <div style="height: 100%; display: flex; flex-direction: column;"> 1295 <div style="margin-bottom: 24px;"> 1296 <h2 style="font-size: 32px; font-weight: 900; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 1297 <p style="font-size: 14px; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1298 </div> 1299 <div id="echarts-creative-${n}" style="flex: 1; min-height: 300px; border-radius: 24px; background: linear-gradient(135deg, ${s.primary}10, ${s.secondary}10);"></div> 1300 </div> 1301 ${p} 1302 `}else{const a=x=>{const g=x.match(/[\d.]+/);return g?parseFloat(g[0]):50},p=d.map(x=>a(x.value)),i=Math.max(...p,1),m=p.map(x=>Math.round(20+x/i*75));o=` 1303 <div style="height: 100%; display: flex; flex-direction: column;"> 1304 <div style="margin-bottom: 32px;"> 1305 <h2 style="font-size: 32px; font-weight: 900; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 1306 <p style="font-size: 14px; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1307 </div> 1308 <div style="flex: 1; display: flex; align-items: center; justify-content: center;"> 1309 <div style="display: flex; align-items: flex-end; gap: 32px; height: 192px;"> 1310 ${d.map((x,g)=>` 1311 <div style="display: flex; flex-direction: column; align-items: center;"> 1312 <div style="width: 64px; height: ${m[g]}%; border-radius: 16px 16px 0 0; transition: all 0.3s; background: linear-gradient(180deg, ${g===d.length-1?s.accent:s.primary}, ${s.secondary});"></div> 1313 <p style="font-size: 12px; margin-top: 12px; font-weight: 500; color: ${s.muted};">${x.label}</p> 1314 <p style="font-size: 14px; font-weight: 700; color: ${s.primary};">${x.value}</p> 1315 </div> 1316 `).join("")} 1317 </div> 1318 </div> 1319 </div> 1320 `}}else if(l==="image-left"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 1321 <div style="height: 100%; display: grid; grid-template-columns: 40% 60%; gap: 32px;"> 1322 <div style="position: relative; border-radius: 24px; overflow: hidden; background: linear-gradient(135deg, ${s.primary}20, ${s.secondary}20);"> 1323 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1324 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.primary}30, transparent);"></div> 1325 </div> 1326 <div style="display: flex; flex-direction: column; justify-content: center;"> 1327 <h2 style="font-size: 28px; font-weight: 900; margin-bottom: 12px; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1328 <p style="font-size: 14px; margin-bottom: 24px; color: ${s.muted};">${t.subtitle||""}</p> 1329 <div style="display: flex; flex-direction: column; gap: 16px;"> 1330 ${d.map(p=>` 1331 <div style="display: flex; align-items: flex-start; gap: 12px;"> 1332 <div style="width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: linear-gradient(135deg, ${s.primary}, ${s.secondary});"> 1333 ${c} 1334 </div> 1335 <p style="font-size: 16px; line-height: 1.5; padding-top: 6px; color: ${s.text};">${p}</p> 1336 </div> 1337 `).join("")} 1338 </div> 1339 </div> 1340 </div> 1341 `}else if(l==="image-right"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 1342 <div style="height: 100%; display: grid; grid-template-columns: 60% 40%; gap: 32px;"> 1343 <div style="display: flex; flex-direction: column; justify-content: center;"> 1344 <h2 style="font-size: 28px; font-weight: 900; margin-bottom: 12px; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1345 <p style="font-size: 14px; margin-bottom: 24px; color: ${s.muted};">${t.subtitle||""}</p> 1346 <div style="display: flex; flex-direction: column; gap: 16px;"> 1347 ${d.map(p=>` 1348 <div style="display: flex; align-items: flex-start; gap: 12px;"> 1349 <div style="width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: linear-gradient(135deg, ${s.primary}, ${s.secondary});"> 1350 ${c} 1351 </div> 1352 <p style="font-size: 16px; line-height: 1.5; padding-top: 6px; color: ${s.text};">${p}</p> 1353 </div> 1354 `).join("")} 1355 </div> 1356 </div> 1357 <div style="position: relative; border-radius: 24px; overflow: hidden; background: linear-gradient(135deg, ${s.primary}20, ${s.secondary}20);"> 1358 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1359 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, transparent, ${s.secondary}30);"></div> 1360 </div> 1361 </div> 1362 `}else if(l==="full-image")o=` 1363 <div style="position: absolute; inset: 0;"> 1364 <img src="${t.imageUrl||"https://picsum.photos/1200/675?random="+n}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1365 <div style="position: absolute; inset: 0; background: linear-gradient(to right, ${s.background}ee 0%, ${s.background}aa 40%, transparent 70%);"></div> 1366 <div style="position: absolute; inset: 0; padding: 64px; display: flex; flex-direction: column; justify-content: center; max-width: 50%;"> 1367 <h2 style="font-size: 40px; font-weight: 900; margin-bottom: 16px; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1368 <p style="font-size: 18px; line-height: 1.6; color: ${s.muted};">${t.subtitle||""}</p> 1369 </div> 1370 </div> 1371 `;else{const d=t.bullets||[];o=` 1372 <div style="height: 100%; display: flex; flex-direction: column;"> 1373 <div style="margin-bottom: 32px;"> 1374 <h2 style="font-size: 32px; font-weight: 900; background: linear-gradient(135deg, ${s.primary}, ${s.secondary}); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1375 <p style="font-size: 14px; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1376 </div> 1377 <div style="flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px;"> 1378 ${d.map(a=>` 1379 <div style="display: flex; align-items: flex-start; gap: 16px;"> 1380 <div style="width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: linear-gradient(135deg, ${s.primary}, ${s.secondary});"> 1381 ${c} 1382 </div> 1383 <p style="font-size: 18px; line-height: 1.5; padding-top: 8px; color: ${s.text};">${a}
1383</p> 1384 </div> 1385 `).join("")} 1386 </div> 1387 </div> 1388 `}return` 1389 <div style="position: relative; width: 1200px; height: 675px; background: ${s.background}; overflow: hidden;"> 1390 <!-- Gradient Blob Top-Right --> 1391 <div style="position: absolute; top: -80px; right: -80px; width: 320px; height: 320px; border-radius: 50%; opacity: 0.3; filter: blur(48px); background: linear-gradient(135deg, ${s.primary}, ${s.secondary});"></div> 1392 <!-- Gradient Blob Bottom-Left --> 1393 <div style="position: absolute; bottom: -40px; left: -40px; width: 240px; height: 240px; border-radius: 50%; opacity: 0.2; filter: blur(32px); background: linear-gradient(135deg, ${s.secondary}, ${s.accent});"></div> 1394 <!-- Dashed Circle SVG --> 1395 <svg style="position: absolute; top: 40px; right: 40px; width: 128px; height: 128px; opacity: 0.2;" viewBox="0 0 100 100"> 1396 <circle cx="50" cy="50" r="40" fill="none" stroke="${s.primary}" stroke-width="2" stroke-dasharray="10 5" /> 1397 </svg> 1398 <!-- Main Content --> 1399 <div style="position: relative; height: 100%; padding: 40px; z-index: 10;"> 1400 ${o} 1401 </div> 1402 <!-- Page Number --> 1403 <div style="position: absolute; bottom: 16px; right: 24px; font-size: 14px; font-weight: 500; padding: 4px 12px; border-radius: 9999px; background: ${s.primary}20; color: ${s.primary};"> 1404 ${n+1} / ${r} 1405 </div> 1406 </div> 1407 `}function ji(t,s,n,r,l){let c="";if(l==="cover")t.imageUrl?c=` 1408 <div style="position: absolute; inset: 0; z-index: 0;"> 1409 <img src="${t.imageUrl}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1410 <div style="position: absolute; inset: 0; background: linear-gradient(to right, ${s.background}ee 0%, ${s.background}cc 40%, ${s.background}88 100%);"></div> 1411 </div> 1412 <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: center;"> 1413 <h1 style="font-size: 56px; font-weight: 200; letter-spacing: -0.02em; margin-bottom: 16px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1414 <div style="width: 48px; height: 1px; margin: 24px 0; background: ${s.text};"></div> 1415 <p style="font-size: 18px; font-weight: 300; letter-spacing: 0.2em; text-transform: uppercase; color: ${s.muted};">${t.subtitle||""}</p> 1416 </div> 1417 `:c=` 1418 <div style="height: 100%; display: flex; flex-direction: column; justify-content: center;"> 1419 <h1 style="font-size: 56px; font-weight: 200; letter-spacing: -0.02em; margin-bottom: 16px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1420 <div style="width: 48px; height: 1px; margin: 24px 0; background: ${s.text};"></div> 1421 <p style="font-size: 18px; font-weight: 300; letter-spacing: 0.2em; text-transform: uppercase; color: ${s.muted};">${t.subtitle||""}</p> 1422 </div> 1423 `;else if(l==="end")c=` 1424 <div style="height: 100%; display: flex; flex-direction: column; justify-content: center;"> 1425 <h1 style="font-size: 56px; font-weight: 200; letter-spacing: -0.02em; margin-bottom: 16px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1426 <div style="width: 48px; height: 1px; margin: 24px 0; background: ${s.text};"></div> 1427 <p style="font-size: 18px; font-weight: 300; letter-spacing: 0.2em; text-transform: uppercase; color: ${s.muted};">${t.subtitle||""}</p> 1428 </div> 1429 `;else if(l==="section"){const o=t.bullets||[];c=` 1430 <div style="height: 100%; display: flex; flex-direction: column; justify-content: center;"> 1431 <div style="margin-bottom: 48px;"> 1432 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.3em; margin-bottom: 8px; color: ${s.muted};">${t.title||N.t("slideTemplates.defaults.agenda")}</p> 1433 </div> 1434 <div style="display: flex; flex-direction: column; gap: 32px;"> 1435 ${o.map((d,a)=>{const p=String(a+1).padStart(2,"0"),i=d.startsWith(p)?d.substring(3):d;return` 1436 <div style="display: flex; align-items: center; gap: 32px;">
1437 <span style="font-size: 40px; font-weight: 200; color: ${s.accent};">${p}</span> 1438 <span style="font-size: 20px; font-weight: 300; color: ${s.text};">${i}</span> 1439 </div> 1440 `}).join("")} 1441 </div> 1442 </div> 1443 `}else if(l==="chart"){const o=t.stats&&t.stats.length>0?t.stats:[{value:N.t("slideDefaults.weeks2","2 wks"),label:N.t("slideDefaults.research","Research")},{value:N.t("slideDefaults.weeks3","3 wks"),label:N.t("slideDefaults.design","Design")},{value:N.t("slideDefaults.weeks5","5 wks"),label:N.t("slideDefaults.development","Development")},{value:N.t("slideDefaults.weeks2","2 wks"),label:N.t("slideDefaults.testing","Testing")}];if(t.echartsOption){const d=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),a=` 1444 <script> 1445 (function() { 1446 var initFn = function() { 1447 var chartDom = document.getElementById('echarts-minimal-${n}'); 1448 if (chartDom && typeof echarts !== 'undefined') { 1449 var myChart = echarts.init(chartDom); 1450 var option = ${d}; 1451 myChart.setOption(option); 1452 window.addEventListener('resize', function() { myChart.resize(); }); 1453 } 1454 }; 1455 window.echartsInitFunctions = window.echartsInitFunctions || []; 1456 window.echartsInitFunctions.push(initFn); 1457 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { initFn(); } 1458 })(); 1459 <\/script> 1460 `;c=` 1461 <div style="height: 100%; display: flex; flex-direction: column;"> 1462 <div style="margin-bottom: 32px;"> 1463 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.3em; margin-bottom: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1464 <h2 style="font-size: 40px; font-weight: 200; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 1465 </div> 1466 <div id="echarts-minimal-${n}" style="flex: 1; min-height: 300px; border: 1px solid ${s.text}10;"></div> 1467 </div> 1468 ${a} 1469 `}else c=` 1470 <div style="height: 100%; display: flex; flex-direction: column;"> 1471 <div style="margin-bottom: 48px;"> 1472 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.3em; margin-bottom: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1473 <h2 style="font-size: 40px; font-weight: 200; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 1474 </div> 1475 <div style="flex: 1; display: flex; align-items: center;"> 1476 <div style="width: 100%; display: grid; grid-template-columns: repeat(${o.length}, 1fr); gap: 1px; background: ${s.text}10;"> 1477 ${o.map(d=>` 1478 <div style="padding: 32px; text-align: center; background: ${s.background};"> 1479 <p style="font-size: 32px; font-weight: 200; margin-bottom: 8px; color: ${s.text};">${d.value}</p> 1480 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: ${s.muted};">${d.label}</p> 1481 </div> 1482 `).join("")} 1483 </div> 1484 </div> 1485 </div> 1486 `}else if(l==="image-left"){const o=t.bullets||[],d=t.imageUrl||"https://picsum.photos/480/400?random="+n;c=` 1487 <div style="height: 100%; display: grid; grid-template-columns: 40% 60%; gap: 48px;"> 1488 <div style="position: relative; border: 1px solid ${s.text}10;"> 1489 <img src="${d}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1490 </div> 1491 <div style="display: flex; flex-direction: column; justify-content: center;"> 1492 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.3em; margin-bottom: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1493 <h2 style="font-size: 36px; font-weight: 200; margin-bottom: 32px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1494 <div style="display: flex; flex-direction: column; gap: 20px;"> 1495 ${o.map((a,p)=>` 1496 <div style="display: flex; align-items: flex-start; gap: 20px;">
1497 <span style="font-size: 14px; font-weight: 300; color: ${s.accent};">${String(p+1).padStart(2,"0")}</span> 1498 <p style="font-size: 16px; font-weight: 300; line-height: 1.5; color: ${s.text};">${a}</p> 1499 </div> 1500 `).join("")} 1501 </div> 1502 </div> 1503 </div> 1504 `}else if(l==="image-right"){const o=t.bullets||[],d=t.imageUrl||"https://picsum.photos/480/400?random="+n;c=` 1505 <div style="height: 100%; display: grid; grid-template-columns: 60% 40%; gap: 48px;"> 1506 <div style="display: flex; flex-direction: column; justify-content: center;"> 1507 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.3em; margin-bottom: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1508 <h2 style="font-size: 36px; font-weight: 200; margin-bottom: 32px; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1509 <div style="display: flex; flex-direction: column; gap: 20px;"> 1510 ${o.map((a,p)=>` 1511 <div style="display: flex; align-items: flex-start; gap: 20px;"> 1512 <span style="font-size: 14px; font-weight: 300; color: ${s.accent};">
1512${String(p+1).padStart(2,"0")}</span> 1513 <p style="font-size: 16px; font-weight: 300; line-height: 1.5; color: ${s.text};">${a}</p> 1514 </div> 1515 `).join("")} 1516 </div> 1517 </div> 1518 <div style="position: relative; border: 1px solid ${s.text}10;"> 1519 <img src="${d}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1520 </div> 1521 </div> 1522 `}else if(l==="full-image")c=` 1523 <div style="position: absolute; inset: 0;"> 1524 <img src="${t.imageUrl||"https://picsum.photos/1200/675?random="+n}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1525 <div style="position: absolute; inset: 0; background: linear-gradient(to right, ${s.background}ee 0%, ${s.background}cc 35%, transparent 60%);"></div> 1526 <div style="position: absolute; inset: 0; padding: 64px; display: flex; flex-direction: column; justify-content: center; max-width: 45%;"> 1527 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.3em; margin-bottom: 16px; color: ${s.muted};">${t.subtitle||""}</p> 1528 <h2 style="font-size: 48px; font-weight: 200; letter-spacing: -0.02em; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1529 <div style="width: 48px; height: 1px; margin-top: 24px; background: ${s.text};"></div> 1530 </div> 1531 </div> 1532 `;else{const o=t.bullets||[];c=` 1533 <div style="height: 100%; display: flex; flex-direction: column;"> 1534 <div style="margin-bottom: 48px;"> 1535 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.3em; margin-bottom: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1536 <h2 style="font-size: 40px; font-weight: 200; color: ${s.text};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1537 </div> 1538 <div style="flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 24px;"> 1539 ${o.map((d,a)=>` 1540 <div style="display: flex; align-items: flex-start; gap: 24px;"> 1541 <span style="font-size: 14px; font-weight: 300; color: ${s.accent};">
1541${String(a+1).padStart(2,"0")}</span> 1542 <p style="font-size: 18px; font-weight: 300; line-height: 1.5; color: ${s.text};">${d}</p> 1543 </div> 1544 `).join("")} 1545 </div> 1546 </div> 1547 `}return` 1548 <div style="position: relative; width: 1200px; height: 675px; background: ${s.background}; overflow: hidden;"> 1549 <!-- Top Thin Line --> 1550 <div style="position: absolute; top: 32px; left: 32px; right: 32px; height: 1px; background: ${s.text}10;"></div> 1551 <!-- Bottom Thin Line --> 1552 <div style="position: absolute; bottom: 32px; left: 32px; right: 32px; height: 1px; background: ${s.text}10;"></div> 1553 <!-- Main Content --> 1554 <div style="position: relative; height: 100%; padding: 48px;"> 1555 ${c} 1556 </div> 1557 <!-- Page Number --> 1558 <div style="position: absolute; bottom: 16px; right: 32px; font-size: 12px; font-weight: 300; letter-spacing: 0.1em; color: ${s.muted};"> 1559 ${n+1}â${r} 1560 </div> 1561 </div> 1562 `}function Ni(t,s,n,r,l){const c=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="${s.primary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"/><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12"/></svg>`,o=`<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="${s.primary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="opacity: 0.3;"><path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"/><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12"/></svg>`;let d="";if(l==="cover")t.imageUrl?d=` 1563 <div style="position: absolute; inset: 0; z-index: 0;"> 1564 <img src="${t.imageUrl}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1565 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.background}dd 0%, ${s.background}aa 50%, ${s.background}77 100%);"></div> 1566 </div> 1567 <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1568 <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${s.primary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-bottom: 24px;"><path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"/><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12"/></svg> 1569 <h1 style="font-size: 48px; font-weight: 600; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1570 <p style="font-size: 20px; color: ${s.muted};">${t.subtitle||""}</p> 1571 </div> 1572 `:d=` 1573 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1574 <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${s.primary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-bottom: 24px;"><path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"/><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12"/></svg> 1575 <h1 style="font-size: 48px; font-weight: 600; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1576 <p style="font-size: 20px; color: ${s.muted};">${t.subtitle||""}</p> 1577 </div> 1578 `;else if(l==="end")d=` 1579 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1580 <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="${s.primary}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-bottom: 24px;"><path d="M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z"/><path d="M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12"/></svg> 1581 <h1 style="font-size: 48px; font-weight: 600; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1582 <p style="font-size: 20px; color: ${s.muted};">${t.subtitle||""}</p> 1583 </div> 1584 `;else if(l==="section"){const a=t.bullets||[];d=` 1585 <div style="height: 100%; display: flex; align-items: center;"> 1586 <div style="width: 100%;"> 1587 <h2 style="font-size: 32px; font-weight: 600; margin-bottom: 40px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.reportContent")}</h2> 1588 <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px;"> 1589 ${a.map((p,i)=>{const m=String(i+1).padStart(2,"0"),x=p.startsWith(m)?p.substring(3):p;return` 1590 <div style="display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: 16px; background: ${s.primary}10;"> 1591 <div style="width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: ${s.primary};">
1592 <span style="font-weight: 500; color: white;">${m}</span> 1593 </div> 1594 <span style="font-size: 18px; color: ${s.text};">${x}</span> 1595 </div> 1596 `}).join("")} 1597 </div> 1598 </div> 1599 </div> 1600 `}else if(l==="chart"){const a=t.stats&&t.stats.length>0?t.stats:[{value:N.t("slideDefaults.baseline","Baseline"),label:"2021"},{value:"-25%",label:"2023"},{value:"-50%",label:"2025"},{value:N.t("slideDefaults.netZero","Net Zero"),label:"2030"}];if(t.echartsOption){const p=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),i=` 1601 <script> 1602 (function() { 1603 var initFn = function() { 1604 var chartDom = document.getElementById('echarts-nature-${n}'); 1605 if (chartDom && typeof echarts !== 'undefined') { 1606 var myChart = echarts.init(chartDom); 1607 var option = ${p}; 1608 myChart.setOption(option); 1609 window.addEventListener('resize', function() { myChart.resize(); }); 1610 } 1611 }; 1612 window.echartsInitFunctions = window.echartsInitFunctions || []; 1613 window.echartsInitFunctions.push(initFn); 1614 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { initFn(); } 1615 })(); 1616 <\/script> 1617 `;d=` 1618 <div style="height: 100%; display: flex; flex-direction: column;"> 1619 <div style="margin-bottom: 24px;"> 1620 <h2 style="font-size: 32px; font-weight: 600; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.progress")}</h2> 1621 <p style="font-size: 14px; margin-top: 4px; color: ${s.muted};">${t.subtitle||""}</p> 1622 </div> 1623 <div id="echarts-nature-${n}" style="flex: 1; min-height: 300px; border-radius: 16px; background: ${s.primary}08;"></div> 1624 </div> 1625 ${i} 1626 `}else{const p=g=>{const b=g.match(/[\d.]+/);return b?parseFloat(b[0]):50},i=a.map(g=>p(g.value)),m=Math.max(...i,1),x=i.map(g=>Math.round(20+g/m*75));d=` 1627 <div style="height: 100%; display: flex; flex-direction: column;"> 1628 <div style="margin-bottom: 32px;"> 1629 <h2 style="font-size: 32px; font-weight: 600; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.progress")}</h2> 1630 <p style="font-size: 14px; margin-top: 4px; color: ${s.muted};">${t.subtitle||""}</p> 1631 </div> 1632 <div style="flex: 1; display: flex; align-items: center; justify-content: center;"> 1633 <div style="display: flex; align-items: flex-end; gap: 40px; height: 192px;"> 1634 ${a.map((g,b)=>` 1635 <div style="display: flex; flex-direction: column; align-items: center;"> 1636 <div style="width: 56px; height: ${x[b]}%; border-radius: 9999px; transition: all 0.3s; background: ${b===a.length-1?s.primary:s.secondary};"></div> 1637 <p style="font-size: 12px; margin-top: 12px; color: ${s.muted};">${g.label}</p> 1638 <p style="font-size: 14px; font-weight: 600; color: ${s.primary};">${g.value}</p> 1639 </div> 1640 `).join("")} 1641 </div> 1642 </div> 1643 </div> 1644 `}}else if(l==="image-left"){const a=t.bullets||[],p=t.imageUrl||"https://picsum.photos/480/400?random="+n;d=` 1645 <div style="height: 100%; display: grid; grid-template-columns: 40% 60%; gap: 32px;"> 1646 <div style="position: relative; border-radius: 16px; overflow: hidden; background: ${s.primary}10;"> 1647 <img src="${p}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1648 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.primary}20, transparent);"></div> 1649 </div> 1650 <div style="display: flex; flex-direction: column; justify-content: center;"> 1651 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 24px;"> 1652 ${c} 1653 <div> 1654 <h2 style="font-size: 28px; font-weight: 600; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1655 <p style="font-size: 14px; margin-top: 4px; color: ${s.muted};">${t.subtitle||""}</p> 1656 </div> 1657 </div> 1658 <div style="display: flex; flex-direction: column; gap: 16px;"> 1659 ${a.map((i,m)=>` 1660 <div style="display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 10px; background: ${s.primary}08;">
1661 <div style="width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; background: ${s.accent};"> 1662 <span style="font-size: 11px; font-weight: 500; color: white;">${m+1}</span> 1663 </div> 1664 <p style="font-size: 14px; line-height: 1.5; color: ${s.text};">${i}</p> 1665 </div> 1666 `).join("")} 1667 </div> 1668 </div> 1669 </div> 1670 `}else if(l==="image-right"){const a=t.bullets||[],p=t.imageUrl||"https://picsum.photos/480/400?random="+n;d=` 1671 <div style="height: 100%; display: grid; grid-template-columns: 60% 40%; gap: 32px;"> 1672 <div style="display: flex; flex-direction: column; justify-content: center;"> 1673 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 24px;"> 1674 ${c} 1675 <div> 1676 <h2 style="font-size: 28px; font-weight: 600; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1677 <p style="font-size: 14px; margin-top: 4px; color: ${s.muted};">${t.subtitle||""}</p> 1678 </div> 1679 </div> 1680 <div style="display: flex; flex-direction: column; gap: 16px;"> 1681 ${a.map((i,m)=>` 1682 <div style="display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: 10px; background: ${s.primary}08;"> 1683 <div style="width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; background: ${s.accent};"> 1684 <span style="font-size: 11px; font-weight: 500; color: white;">${m+1}</span> 1685 </div> 1686 <p style="font-size: 14px; line-height: 1.5; color: ${s.text};">${i}</p> 1687 </div> 1688 `).join("")} 1689 </div> 1690 </div> 1691 <div style="position: relative; border-radius: 16px; overflow: hidden; background: ${s.primary}10;"> 1692 <img src="${p}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1693 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, transparent, ${s.primary}20);"></div> 1694 </div> 1695 </div> 1696 `}else if(l==="full-image")d=` 1697 <div style="position: absolute; inset: 0;"> 1698 <img src="${t.imageUrl||"https://picsum.photos/1200/675?random="+n}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1699 <div style="position: absolute; inset: 0; background: linear-gradient(to right, ${s.background}ee 0%, ${s.background}cc 40%, transparent 70%);"></div> 1700 <div style="position: absolute; inset: 0; padding: 64px; display: flex; flex-direction: column; justify-content: center; max-width: 45%;"> 1701 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 16px;"> 1702 ${c} 1703 </div> 1704 <h2 style="font-size: 40px; font-weight: 600; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1705 <p style="font-size: 18px; line-height: 1.6; color: ${s.muted};">${t.subtitle||""}</p> 1706 </div> 1707 </div> 1708 `;else{const a=t.bullets||[];d=` 1709 <div style="height: 100%; display: flex; flex-direction: column;"> 1710 <div style="margin-bottom: 32px; display: flex; align-items: center; gap: 12px;"> 1711 ${c} 1712 <div> 1713 <h2 style="font-size: 32px; font-weight: 600; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1714 <p style="font-size: 14px; margin-top: 4px; color: ${s.muted};">${t.subtitle||""}</p> 1715 </div> 1716 </div> 1717 <div style="flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px;"> 1718 ${a.map((p,i)=>` 1719 <div style="display: flex; align-items: flex-start; gap: 16px; padding: 16px; border-radius: 12px; background: ${s.primary}08;"> 1720 <div style="width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; background: ${s.accent};">
1721 <span style="font-size: 12px; font-weight: 500; color: white;">${i+1}</span> 1722 </div> 1723 <p style="font-size: 16px; line-height: 1.5; color: ${s.text};">${p}</p> 1724 </div> 1725 `).join("")} 1726 </div> 1727 </div> 1728 `}return` 1729 <div style="position: relative; width: 1200px; height: 675px; background: ${s.background}; overflow: hidden;"> 1730 <!-- Organic Curve SVG Top-Right --> 1731 <svg style="position: absolute; top: 0; right: 0; width: 256px; height: 256px; opacity: 0.2;" viewBox="0 0 200 200"> 1732 <path d="M 100 0 Q 200 50, 150 100 Q 100 150, 100 200 Q 100 150, 50 100 Q 0 50, 100 0" fill="none" stroke="${s.primary}" stroke-width="1" /> 1733 </svg> 1734 <!-- Concentric Circles SVG Bottom-Left --> 1735 <svg style="position: absolute; bottom: 0; left: 0; width: 192px; height: 192px; opacity: 0.15;" viewBox="0 0 200 200"> 1736 <circle cx="100" cy="100" r="80" fill="none" stroke="${s.secondary}" stroke-width="1" /> 1737 <circle cx="100" cy="100" r="60" fill="none" stroke="${s.secondary}" stroke-width="1" /> 1738 <circle cx="100" cy="100" r="40" fill="none" stroke="${s.secondary}" stroke-width="1" /> 1739 </svg> 1740 <!-- Leaf Decoration Top-Right --> 1741 <div style="position: absolute; top: 24px; right: 24px;"> 1742 ${o} 1743 </div> 1744 <!-- Main Content --> 1745 <div style="position: relative; height: 100%; padding: 40px; z-index: 10;"> 1746 ${d} 1747 </div> 1748 <!-- Bottom Gradient Bar --> 1749 <div style="position: absolute; bottom: 0; left: 0; right: 0; height: 8px; background: linear-gradient(90deg, ${s.primary}, ${s.secondary}, ${s.accent});"></div> 1750 <!-- Page Number --> 1751 <div style="position: absolute; bottom: 24px; right: 24px; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; background: ${s.primary}; color: white;"> 1752 ${n+1} 1753 </div> 1754 </div> 1755 `}function ki(t,s,n,r,l){const c=`<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="${s.accent}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m2 4 3 12h14l3-12-6 7-4-7-4 7-6-7zm3 16h14"/></svg>`;let o="";if(l==="cover")t.imageUrl?o=` 1756 <div style="position: absolute; inset: 0; z-index: 0;"> 1757 <img src="${t.imageUrl}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1758 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.background}ee 0%, ${s.background}cc 50%, ${s.background}88 100%);"></div> 1759 </div> 1760 <div style="position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1761 ${c} 1762 <h1 style="font-size: 48px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-top: 24px; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1763 <div style="display: flex; align-items: center; gap: 16px; margin-top: 8px;"> 1764 <div style="width: 48px; height: 1px; background: ${s.accent};"></div> 1765 <p style="font-size: 18px; letter-spacing: 0.3em; text-transform: uppercase; color: ${s.muted};">${t.subtitle||""}</p> 1766 <div style="width: 48px; height: 1px; background: ${s.accent};"></div> 1767 </div> 1768 </div> 1769 `:o=` 1770 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1771 ${c} 1772 <h1 style="font-size: 48px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-top: 24px; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1773 <div style="display: flex; align-items: center; gap: 16px; margin-top: 8px;"> 1774 <div style="width: 48px; height: 1px; background: ${s.accent};"></div> 1775 <p style="font-size: 18px; letter-spacing: 0.3em; text-transform: uppercase; color: ${s.muted};">${t.subtitle||""}</p> 1776 <div style="width: 48px; height: 1px; background: ${s.accent};"></div> 1777 </div> 1778 </div> 1779 `;else if(l==="end")o=` 1780 <div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;"> 1781 ${c} 1782 <h1 style="font-size: 48px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-top: 24px; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.title")}</h1> 1783 <div style="display: flex; align-items: center; gap: 16px; margin-top: 8px;"> 1784 <div style="width: 48px; height: 1px; background: ${s.accent};"></div> 1785 <p style="font-size: 18px; letter-spacing: 0.3em; text-transform: uppercase; color: ${s.muted};">${t.subtitle||""}</p> 1786 <div style="width: 48px; height: 1px; background: ${s.accent};"></div> 1787 </div> 1788 </div> 1789 `;else if(l==="section"){const d=t.bullets||[];o=` 1790 <div style="height: 100%; display: flex; flex-direction: column; justify-content: center;"> 1791 <h2 style="font-size: 32px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 40px; text-align: center; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.agenda")}</h2> 1792 <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 32px;"> 1793 ${d.map(a=>` 1794 <div style="display: flex; align-items: center; gap: 16px; justify-content: center;"> 1795 <div style="width: 8px; height: 8px; transform: rotate(45deg); background: ${s.accent};"></div>
1796 <span style="font-size: 18px; color: ${s.text};">${a}</span> 1797 </div> 1798 `).join("")} 1799 </div> 1800 </div> 1801 `}else if(l==="comparison"){const d=t.leftColumn&&t.leftColumn.length>0?t.leftColumn:t.bullets.slice(0,3),a=t.rightColumn&&t.rightColumn.length>0?t.rightColumn:t.bullets.slice(3);o=` 1802 <div style="height: 100%; display: flex; flex-direction: column;"> 1803 <h2 style="font-size: 32px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 32px; text-align: center; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.comparison")}</h2> 1804 <div style="flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 32px;"> 1805 <div style="padding: 24px; border: 1px solid ${s.accent}40; border-radius: 4px;"> 1806 <h3 style="font-size: 20px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 16px; text-align: center; color: ${s.primary};">${t.leftTitle||N.t("slideTemplates.defaults.leftColumn")}</h3> 1807 <div style="width: 32px; height: 1px; margin: 0 auto 16px; background: ${s.accent};"></div> 1808 ${d.map(p=>` 1809 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px; justify-content: center;"> 1810 <div style="width: 6px; height: 6px; transform: rotate(45deg); background: ${s.accent};"></div> 1811 <span style="color: ${s.text};">${p}</span> 1812 </div> 1813 `).join("")} 1814 </div> 1815 <div style="padding: 24px; border: 1px solid ${s.accent}40; border-radius: 4px;"> 1816 <h3 style="font-size: 20px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 16px; text-align: center; color: ${s.primary};">${t.rightTitle||N.t("slideTemplates.defaults.rightColumn")}</h3> 1817 <div style="width: 32px; height: 1px; margin: 0 auto 16px; background: ${s.accent};"></div> 1818 ${a.map(p=>` 1819 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px; justify-content: center;"> 1820 <div style="width: 6px; height: 6px; transform: rotate(45deg); background: ${s.accent};"></div> 1821 <span style="color: ${s.text};">${p}</span> 1822 </div> 1823 `).join("")} 1824 </div> 1825 </div> 1826 </div> 1827 `}else if(l==="chart"){const d=t.stats&&t.stats.length>0?t.stats:[{value:"100+",label:N.t("slideDefaults.customer","Customers")},{value:"50%",label:N.t("slideDefaults.growth","Growth")},{value:"99%",label:N.t("slideDefaults.satisfied","Satisfied")},{value:"24/7",label:N.t("slideDefaults.service","Service")}];if(t.echartsOption){const a=JSON.stringify(t.echartsOption).replace(/</g,"\\u003c"),p=` 1828 <script> 1829 (function() { 1830 var initFn = function() { 1831 var chartDom = document.getElementById('echarts-luxury-${n}'); 1832 if (chartDom && typeof echarts !== 'undefined') { 1833 var myChart = echarts.init(chartDom); 1834 var option = ${a}; 1835 myChart.setOption(option); 1836 window.addEventListener('resize', function() { myChart.resize(); }); 1837 } 1838 }; 1839 window.echartsInitFunctions = window.echartsInitFunctions || []; 1840 window.echartsInitFunctions.push(initFn); 1841 if (document.readyState !== 'loading' && typeof echarts !== 'undefined') { initFn(); } 1842 })(); 1843 <\/script> 1844 `;o=` 1845 <div style="height: 100%; display: flex; flex-direction: column;"> 1846 <div style="margin-bottom: 24px; text-align: center;"> 1847 <h2 style="font-size: 32px; font-family: 'Playfair Display', 'Times New Roman', serif; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 1848 <p style="font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1849 </div> 1850 <div id="echarts-luxury-${n}" style="flex: 1; min-height: 300px; border: 1px solid ${s.accent}30; border-radius: 4px;"></div> 1851 </div> 1852 ${p} 1853 `}else o=` 1854 <div style="height: 100%; display: flex; flex-direction: column;"> 1855 <div style="margin-bottom: 32px; text-align: center;"> 1856 <h2 style="font-size: 32px; font-family: 'Playfair Display', 'Times New Roman', serif; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.dataTitle")}</h2> 1857 <p style="font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1858 </div> 1859 <div style="flex: 1; display: flex; align-items: center; justify-content: center;"> 1860 <div style="display: grid; grid-template-columns: repeat(${d.length}, 1fr); gap: 24px;"> 1861 ${d.map(a=>` 1862 <div style="text-align: center; padding: 24px; border: 1px solid ${s.accent}30; border-radius: 4px;"> 1863 <p style="font-size: 28px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 8px; color: ${s.primary};">${a.value}</p> 1864 <p style="font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: ${s.muted};">${a.label}</p> 1865 </div> 1866 `).join("")} 1867 </div> 1868 </div> 1869 </div> 1870 `}else if(l==="image-left"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 1871 <div style="height: 100%; display: grid; grid-template-columns: 40% 60%; gap: 40px;"> 1872 <div style="position: relative; border: 2px solid ${s.accent}40; border-radius: 4px; overflow: hidden;"> 1873 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1874 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, ${s.accent}20, transparent);"></div> 1875 </div> 1876 <div style="display: flex; flex-direction: column; justify-content: center;"> 1877 <h2 style="font-size: 28px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 12px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1878 <p style="font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 24px; color: ${s.muted};">${t.subtitle||""}</p> 1879 <div style="display: flex; flex-direction: column; gap: 16px;"> 1880 ${d.map(p=>` 1881 <div style="display: flex; align-items: flex-start; gap: 12px;">
1882 <div style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;"> 1883 <div style="width: 6px; height: 6px; transform: rotate(45deg); background: ${s.accent};"></div> 1884 </div> 1885 <p style="font-size: 14px; line-height: 1.5; color: ${s.text};">${p}</p> 1886 </div> 1887 `).join("")} 1888 </div> 1889 </div> 1890 </div> 1891 `}else if(l==="image-right"){const d=t.bullets||[],a=t.imageUrl||"https://picsum.photos/480/400?random="+n;o=` 1892 <div style="height: 100%; display: grid; grid-template-columns: 60% 40%; gap: 40px;"> 1893 <div style="display: flex; flex-direction: column; justify-content: center;"> 1894 <h2 style="font-size: 28px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 12px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1895 <p style="font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 24px; color: ${s.muted};">${t.subtitle||""}</p> 1896 <div style="display: flex; flex-direction: column; gap: 16px;"> 1897 ${d.map(p=>` 1898 <div style="display: flex; align-items: flex-start; gap: 12px;"> 1899 <div style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;"> 1900 <div style="width: 6px; height: 6px; transform: rotate(45deg); background: ${s.accent};"></div> 1901 </div> 1902 <p style="font-size: 14px; line-height: 1.5; color: ${s.text};">${p}</p> 1903 </div> 1904 `).join("")} 1905 </div> 1906 </div> 1907 <div style="position: relative; border: 2px solid ${s.accent}40; border-radius: 4px; overflow: hidden;"> 1908 <img src="${a}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1909 <div style="position: absolute; inset: 0; background: linear-gradient(135deg, transparent, ${s.accent}20);"></div> 1910 </div> 1911 </div> 1912 `}else if(l==="full-image")o=` 1913 <div style="position: absolute; inset: 0;"> 1914 <img src="${t.imageUrl||"https://picsum.photos/1200/675?random="+n}" alt="" style="width: 100%; height: 100%; object-fit: cover;" onerror="this.style.display='none';" /> 1915 <div style="position: absolute; inset: 0; background: linear-gradient(to right, ${s.background}ee 0%, ${s.background}cc 35%, transparent 60%);"></div> 1916 <div style="position: absolute; inset: 0; padding: 80px; display: flex; flex-direction: column; justify-content: center; max-width: 45%;"> 1917 <div style="width: 32px; height: 1px; margin-bottom: 24px; background: ${s.accent};"></div> 1918 <h2 style="font-size: 40px; font-family: 'Playfair Display', 'Times New Roman', serif; margin-bottom: 16px; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1919 <p style="font-size: 16px; letter-spacing: 0.1em; line-height: 1.6; color: ${s.muted};">${t.subtitle||""}</p> 1920 <div style="width: 32px; height: 1px; margin-top: 24px; background: ${s.accent};"></div> 1921 </div> 1922 </div> 1923 `;else{const d=t.bullets||[];o=` 1924 <div style="height: 100%; display: flex; flex-direction: column;"> 1925 <div style="margin-bottom: 32px; text-align: center;"> 1926 <h2 style="font-size: 32px; font-family: 'Playfair Display', 'Times New Roman', serif; color: ${s.primary};">${t.title||N.t("slideTemplates.defaults.contentTitle")}</h2> 1927 <p style="font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 8px; color: ${s.muted};">${t.subtitle||""}</p> 1928 </div> 1929 <div style="flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 20px;"> 1930 ${d.map(a=>` 1931 <div style="display: flex; align-items: flex-start; gap: 16px;"> 1932 <div style="width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;"> 1933 <div style="width: 8px; height: 8px; transform: rotate(45deg); background: ${s.accent};"></div> 1934 </div> 1935 <p style="font-size: 16px; line-height: 1.5; color: ${s.text};">${a}
1935</p> 1936 </div> 1937 `).join("")} 1938 </div> 1939 </div> 1940 `}return` 1941 <div style="position: relative; width: 1200px; height: 675px; background: ${s.background}; overflow: hidden;"> 1942 <!-- Outer Border --> 1943 <div style="position: absolute; inset: 16px; border: 2px solid ${s.accent}40; border-radius: 4px;"></div> 1944 <!-- Inner Border --> 1945 <div style="position: absolute; inset: 24px; border: 1px solid ${s.accent}20; border-radius: 4px;"></div> 1946 <!-- Corner Decorations --> 1947 <div style="position: absolute; top: 16px; left: 16px; width: 32px; height: 32px; border-top: 2px solid ${s.accent}; border-left: 2px solid ${s.accent};"></div> 1948 <div style="position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-top: 2px solid ${s.accent}; border-right: 2px solid ${s.accent};"></div> 1949 <div style="position: absolute; bottom: 16px; left: 16px; width: 32px; height: 32px; border-bottom: 2px solid ${s.accent}; border-left: 2px solid ${s.accent};"></div> 1950 <div style="position: absolute; bottom: 16px; right: 16px; width: 32px; height: 32px; border-bottom: 2px solid ${s.accent}; border-right: 2px solid ${s.accent};"></div> 1951 <!-- Main Content --> 1952 <div style="position: relative; height: 100%; padding: 56px; z-index: 10;"> 1953 ${o} 1954 </div> 1955 <!-- Page Number --> 1956 <div style="position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;"> 1957 <div style="width: 24px; height: 1px; background: ${s.accent};"></div> 1958 <span style="font-size: 14px; font-family: 'Playfair Display', 'Times New Roman', serif; color: ${s.muted};">${n+1}</span> 1959 <div style="width: 24px; height: 1px; background: ${s.accent};"></div> 1960 </div> 1961 </div> 1962 `}function ar(t,s,n,r,l="corporate",c=6){const o=bi(n),d=yi(t,r,c);let a;switch(l){case"corporate":a=Is(s,o,r,c,d);break;case"tech":a=vi(s,o,r,c,d);break;case"creative":a=wi(s,o,r,c,d);break;case"minimal":a=ji(s,o,r,c,d);break;case"nature":a=Ni(s,o,r,c,d);break;case"luxury":a=ki(s,o,r,c,d);break;default:a=Is(s,o,r,c,d)}return`<!DOCTYPE html> 1963<html> 1964<head> 1965 <meta charset="UTF-8"> 1966 <meta name="viewport" content="width=1200, height=675"> 1967 <link href="https://fonts.bunny.net/css2?family=Inter:wght@200;300;400;500;600;700;900&family=Noto+Sans+SC:wght@200;300;400;500;600;700;900&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet"> 1968 ${s.echartsOption!==void 0?` 1969 <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/echarts.min.js"><\/script> 1970 <script> 1971 // å ¨å±åå§å彿°å表 1972 window.echartsInitFunctions = window.echartsInitFunctions || []; 1973 1974 // DOM å è½½å®æååå§åææå¾è¡¨ 1975 document.addEventListener('DOMContentLoaded', function() { 1976 if (typeof echarts !== 'undefined') { 1977 window.echartsInitFunctions.forEach(function(fn) { 1978 try { fn(); } catch(e) { console.error('ECharts init error:', e); } 1979 }); 1980 } 1981 }); 1982 <\/script>`:""} 1983 <style> 1984 * { margin: 0; padding: 0; box-sizing: border-box; } 1985 html, body { width: 1200px; height: 675px; overflow: hidden; } 1986 body { font-family: 'Inter', 'Noto Sans SC', sans-serif; } 1987 </style> 1988</head> 1989<body> 1990${a} 1991</body> 1992</html>`}function or(t){const s=t.content&&(t.content.includes("<")||t.content.includes("<!DOCTYPE")),n=t.comparison&&(t.comparison.leftItems&&t.comparison.leftItems.length>0||t.comparison.rightItems&&t.comparison.rightItems.length>0),r=t.timeline&&t.timeline.length>0,l=!!(t.title||t.bullets&&t.bullets.length>0||t.stats&&t.stats.length>0||t.leftColumn&&t.leftColumn.length>0||t.rightColumn&&t.rightColumn.length>0||t.quote||n||r);return!s&&l}function dr(t){var d;let s=t.leftColumn||[],n=t.rightColumn||[],r=t.leftTitle||"",l=t.rightTitle||"";t.comparison&&(s=t.comparison.leftItems||s,n=t.comparison.rightItems||n,r=t.comparison.leftTitle||r,l=t.comparison.rightTitle||l);let c=t.bullets||[];t.timeline&&t.timeline.length>0&&c.length===0&&(c=t.timeline.map(a=>`${a.time} - ${a.event}`));let o=[];return t.stats&&t.stats.length>0?o=t.stats.map(a=>({value:a.value,label:a.label})):t.items&&t.items.length>0&&(o=t.items.map(a=>({value:a.value,label:a.label}))),{title:t.title||"",subtitle:t.subtitle||"",bullets:c,notes:t.notes||"",imageUrl:t.imageUrl||"",imageKeywords:((d=t.imageKeywords)==null?void 0:d.join(", "))||"",leftColumn:s,right
1992Column:n,leftTitle:r,rightTitle:l,quote:t.quote||"",quoteAuthor:t.quoteAuthor||"",stats:o,chartType:t.chartType,echartsOption:t.echartsOption}}function Ci({status:t,currentStep:s,outline:n,progress:r,theme:l}){const{t:c}=ve(),o=u.useMemo(()=>{switch(t){case"initializing":return{icon:Ve,text:c("pptRender.statusInitializing"),color:"text-blue-500",spin:!0};case"outline":return{icon:Ue,text:c("pptRender.statusOutline"),color:"text-purple-500",spin:!1};case"generating":return{icon:Qs,text:c("pptRender.statusGenerating"),color:"text-green-500",spin:!1};case"completed":return{icon:Zs,text:c("pptRender.statusCompleted"),color:"text-green-600",spin:!1};case"error":return{icon:Zt,text:c("pptRender.statusError"),color:"text-red-500",spin:!1};default:return{icon:Ve,text:c("pptRender.statusReady"),color:"text-muted-foreground",spin:!0}}},[t,c]),d=o.icon;return e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center p-8 overflow-auto",style:{backgroundColor:l.backgroundColor},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx(d,{className:U("w-8 h-8",o.color,o.spin&&"animate-spin")}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl font-semibold",style:{color:l.textColor},children:o.text}),s&&e.jsx("p",{className:"text-sm opacity-70",style:{color:l.textColor},children:s})]})]}),r!==void 0&&t!=="completed"&&e.jsxs("div",{className:"w-full max-w-md mb-8",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[e.jsx("span",{style:{color:l.textColor},children:c("pptRender.progress")}),e.jsxs("span",{className:"font-medium",style:{color:l.primaryColor},children:[Math.round(r),"%"]})]}),e.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full transition-all duration-500 rounded-full",style:{width:`${r}%`,backgroundColor:l.primaryColor}})})]}),n&&n.length>0&&e.jsxs("div",{className:"w-full max-w-2xl rounded-xl p-6 border",style:{backgroundColor:l.backgroundColor,borderColor:l.primaryColor+"30"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(Gt,{className:"w-5 h-5",style:{color:l.primaryColor}}),e.jsx("span",{className:"font-medium",style:{color:l.textColor},children:c("pptRender.outlineTitle",{count:n.length})})]}),e.jsx("div",{className:"space-y-4 max-h-[400px] overflow-y-auto",children:n.map((a,p)=>e.jsx("div",{className:"p-4 rounded-lg transition-colors",style:{backgroundColor:l.primaryColor+"08"},children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"flex-shrink-0 w-7 h-7 rounded-full flex items-center justify-center text-sm font-bold",style:{backgroundColor:l.primaryColor,color:"#fff"},children:p+1}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-base",style:{color:l.textColor},children:a.title}),e.jsx("p",{className:"text-xs mt-1 opacity-60",style:{color:l.textColor},children:c("pptRender.slideType",{type:a.type})}),a.keyPoints&&a.keyPoints.length>0&&e.jsx("ul",{className:"mt-2 space-y-1",children:a.keyPoints.map((i,m)=>e.jsxs("li",{className:"text-sm flex items-start gap-2",style:{color:l.textColor},children:[e.jsx("span",{style:{color:l.primaryColor},children:"â¢"}),e.jsx("span",{className:"opacity-80",children:i})]},m))}),a.notes&&e.jsx("p",{className:"mt-2 text-xs italic opacity-50",style:{color:l.textColor},children:c("pptRender.slideNotes",{notes:a.notes})})]})]})},p))})]})]})}function bt(t){return t?t.trim().startsWith("<"):!1}function As({status:t}){switch(t){case"generating":return e.jsx(Ve,{className:"w-3 h-3 animate-spin text-blue-500"});case"completed":return e.jsx(Zs,{className:"w-3 h-3 text-green-500"});case"error":return e.jsx(Zt,{className:"w-3 h-3 text-red-500"});case"pending":default:return e.jsx("div",{className:"w-3 h-3 rounded-full bg-muted-foreground/30"})}}function $i({slide:t,index:s,isActive:n,theme:r,onClick:l,isDragging:c,isDragOver:o,onDragStart:d,onDragEnd:a,onDragOver:p,onDragLeave:i,onDrop:m,templateStyle:x,totalSlides:g}){const b=bt(t.content),C=is(t.content),w=or(t),D=u.useMemo(()=>{const R=` 1993<script> 1994(function() { 1995 function applyScale() { 1996 var body = document.body; 1997 if (!body) return; 1998 1999 // æ¥æ¾å¹»ç¯çå ç´ ï¼å¯è½æ¯ .slide ç±»æç¬¬ä¸ä¸ªåå ç´ ï¼ 2000 var slide = document.querySelector('.slide') || body.firstElementChild || body; 2001 2002 // ä»å ç´ è·åå®é 尺寸 2003 var computedStyle = window.getComputedStyle(slide); 2004 var slideWidth = parseInt(slide.style.width) || parseInt(computedStyle.width) || 1200; 2005 var slideHeight = parseInt(slide.style.height) || parseInt(computedStyle.height) || 675; 2006
2007 // å¦æå°ºå¯¸å¤ªå°ï¼ä½¿ç¨é»è®¤å¼ 2008 if (slideWidth < 100) slideWidth = 1200; 2009 if (slideHeight < 100) slideHeight = 675; 2010 2011 var viewWidth = window.innerWidth || document.documentElement.clientWidth; 2012 var viewHeight = window.innerHeight || document.documentElement.clientHeight; 2013 var scale = Math.min(viewWidth / slideWidth, viewHeight / slideHeight); 2014 2015 // Get body background first 2016 var bodyStyle = window.getComputedStyle(body); 2017 var bg = bodyStyle.background || bodyStyle.backgroundColor; 2018 2019 body.style.transform = 'scale(' + scale + ')'; 2020 body.style.transformOrigin = 'top left'; 2021 body.style.width = slideWidth + 'px'; 2022 body.style.height = slideHeight + 'px'; 2023 body.style.overflow = 'hidden'; 2024 body.style.position = 'absolute'; 2025 body.style.top = '0'; 2026 body.style.left = '0'; 2027 2028 // Set html background to match body 2029 document.documentElement.style.background = bg; 2030 document.documentElement.style.width = '100%'; 2031 document.documentElement.style.height = '100%'; 2032 document.documentElement.style.overflow = 'hidden'; 2033 } 2034 if (document.readyState === 'complete') { 2035 applyScale(); 2036 } else { 2037 window.addEventListener('load', applyScale); 2038 } 2039 window.addEventListener('resize', applyScale); 2040})(); 2041<\/script>`;if(w){const B=dr(t),Z=t.layout||"content";return ar(Z,B,r,t.index,x||"corporate",g||6).replace("</body>",R+"</body>")}return!t.content||!b?"":C?t.content.replace("</body>",R+"</body>"):`<!DOCTYPE html> 2042<html> 2043<head> 2044 <meta charset="UTF-8"> 2045 <style> 2046 * { margin: 0; padding: 0; box-sizing: border-box; } 2047 html { overflow: hidden; } 2048 body { 2049 width: 1200px; 2050 height: 675px; 2051 font-family: ${r.fontFamily}; 2052 background: ${r.backgroundColor}; 2053 color: ${r.textColor}; 2054 overflow: hidden; 2055 } 2056 </style> 2057</head> 2058<body>${t.content}${R}</body> 2059</html>`},[t.content,t.title,t.bullets,t.stats,t.leftColumn,t.rightColumn,t.quote,t.layout,t.index,b,C,w,x,r,g]);return e.jsxs("div",{draggable:!0,onDragStart:d,onDragEnd:a,onDragOver:p,onDragLeave:i,onDrop:m,onClick:l,className:U("w-full p-2 rounded-lg transition-all text-left group cursor-grab active:cursor-grabbing",n?"bg-primary/10 ring-2 ring-primary":"hover:bg-secondary/80",c&&"opacity-50 ring-2 ring-primary ring-dashed",o&&"bg-primary/20 ring-2 ring-primary"),children:[e.jsxs("div",{className:U("w-full aspect-video rounded-md overflow-hidden mb-2 relative","bg-background border",n?"border-primary":"border-border"),children:[b||w?e.jsx("iframe",{srcDoc:D,className:"w-full h-full border-0 pointer-events-none",style:{backgroundColor:C?"transparent":r.backgroundColor},title:`Slide ${s+1} thumbnail`,tabIndex:-1}):e.jsxs("div",{className:"w-full h-full p-2 flex flex-col",style:{backgroundColor:r.backgroundColor,color:r.textColor,fontFamily:r.fontFamily},children:[e.jsx("div",{className:"text-[8px] font-bold truncate",style:{color:r.primaryColor},children:t.title}),t.bullets&&e.jsx("div",{className:"mt-1 space-y-0.5",children:t.bullets.slice(0,3).map((R,B)=>e.jsxs("div",{className:"text-[6px] truncate opacity-70",children:["⢠",R]},B))})]}),t.status&&t.status!=="completed"&&e.jsx("div",{className:"absolute inset-0 bg-background/50 flex items-center justify-center",children:e.jsx(As,{status:t.status})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:U("text-xs font-medium",n?"text-primary":"text-muted-foreground"),children:s+1}),e.jsx("span",{className:U("text-xs truncate flex-1",n?"text-foreground":"text-muted-foreground"),children:t.title}),e.jsx(As,{status:t.status})]})]})}function is(t){if(!t)return!1;const s=t.trim();return s.startsWith("<!DOCTYPE")||s.toLowerCase().startsWith("<html")}function Si({slide:t,theme:s,presentationTitle:n,templateStyle:r="corporate",totalSlides:l=6}){const{t:c}=ve(),o=u.useRef(null),d=bt(t.content),a=is(t.content),p=or(t),i=u.useMemo(()=>{const x=` 2060<script> 2061 (function() { 2062 function scaleSlide() { 2063 var slide = document.querySelector('.slide') || document.body.firstElementChild; 2064 if (!slide) return; 2065 2066 // ä»å ç´ çå èæ ·å¼æè®¡ç®æ ·å¼ä¸è·ååå§å°ºå¯¸ 2067 var computedStyle = window.getComputedStyle(slide); 2068 var slideWidth = parseInt(slide.style.width) || parseInt(computedStyle.width) || 1200; 2069 var slideHeight = parseInt(slide.style.height) || parseInt(computedStyle.height) || 675; 2070
2071 // å¦æå°ºå¯¸å¤ªå°ï¼ä½¿ç¨é»è®¤ç 16:9 尺寸 2072 if (slideWidth < 100) slideWidth = 1200; 2073 if (slideHeight < 100) slideHeight = 675; 2074 2075 // è·å容å¨å°ºå¯¸ 2076 var containerWidth = document.documentElement.clientWidth || window.innerWidth; 2077 var containerHeight = document.documentElement.clientHeight || window.innerHeight; 2078 2079 // ç¡®ä¿å®¹å¨å°ºå¯¸ææ 2080 if (containerWidth <= 0 || containerHeight <= 0) { 2081 setTimeout(scaleSlide, 50); 2082 return; 2083 } 2084 2085 // 计ç®ç¼©æ¾æ¯ä¾ï¼ä¿æå®½é«æ¯ 2086 var scaleX = containerWidth / slideWidth; 2087 var scaleY = containerHeight / slideHeight; 2088 var scale = Math.min(scaleX, scaleY); 2089 2090 // åºç¨ç¼©æ¾åå± ä¸æ ·å¼ 2091 slide.style.transform = 'scale(' + scale + ')'; 2092 slide.style.transformOrigin = 'center center'; 2093 slide.style.position = 'relative'; 2094 slide.style.left = 'auto'; 2095 slide.style.top = 'auto'; 2096 } 2097 2098 // 夿¬¡å°è¯ä»¥ç¡®ä¿ iframe å°ºå¯¸å·²ç¡®å® 2099 function tryScale() { 2100 scaleSlide(); 2101 setTimeout(scaleSlide, 100); 2102 setTimeout(scaleSlide, 300); 2103 } 2104 2105 if (document.readyState === 'complete') { 2106 tryScale(); 2107 } else { 2108 window.addEventListener('load', tryScale); 2109 } 2110 window.addEventListener('resize', scaleSlide); 2111 })(); 2112<\/script>`,g=` 2113<style> 2114 * { margin: 0; padding: 0; box-sizing: border-box; } 2115 html, body { 2116 width: 100%; 2117 height: 100%; 2118 overflow: hidden; 2119 background: transparent; 2120 display: flex; 2121 align-items: center; 2122 justify-content: center; 2123 } 2124 /* æ¯æ .slide ç±»åç´æ¥åå ç´ */ 2125 .slide, body > div:first-child { 2126 transform-origin: center center !important; 2127 position: relative !important; 2128 left: auto !important; 2129 top: auto !important; 2130 flex-shrink: 0; 2131 } 2132</style>`;if(p){const b=dr(t),C=t.layout||"content";return ar(C,b,s,t.index,r,l).replace("</head>",g+"</head>").replace("</body>",x+"</body>")}return t.content?a?t.content.replace("</head>",g+"</head>").replace("</body>",x+"</body>"):d?`<!DOCTYPE html> 2133<html> 2134<head> 2135 <meta charset="UTF-8"> 2136 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 2137 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap" rel="stylesheet"> 2138 <style> 2139 * { margin: 0; padding: 0; box-sizing: border-box; } 2140 html, body { 2141 width: 100%; 2142 height: 100%; 2143 overflow: hidden; 2144 background: transparent; 2145 } 2146 body { 2147 font-family: ${s.fontFamily}; 2148 color: ${s.textColor}; 2149 } 2150 </style> 2151</head> 2152<body> 2153 ${t.content} 2154 <script src="https://unpkg.com/lucide@latest/dist/umd/lucide.min.js"><\/script> 2155 <script> 2156 if (typeof lucide !== 'undefined') { 2157 lucide.createIcons(); 2158 } 2159 // èªéåºç¼©æ¾ - èªå¨æ£æµå¹»ç¯çå°ºå¯¸å¹¶å± ä¸ 2160 (function() { 2161 function scaleSlide() { 2162 var slide = document.querySelector('.slide') || document.body.firstElementChild; 2163 if (!slide) return; 2164 2165 // ä»å ç´ è·åå®é 尺寸 2166 var computedStyle = window.getComputedStyle(slide); 2167 var slideWidth = parseInt(slide.style.width) || parseInt(computedStyle.width) || 1200; 2168 var slideHeight = parseInt(slide.style.height) || parseInt(computedStyle.height) || 675; 2169 2170 // å¦æå°ºå¯¸å¤ªå°ï¼ä½¿ç¨é»è®¤å¼ 2171 if (slideWidth < 100) slideWidth = 1200; 2172 if (slideHeight < 100) slideHeight = 675; 2173 2174 var containerWidth = window.innerWidth; 2175 var containerHeight = window.innerHeight; 2176 2177 var scaleX = containerWidth / slideWidth; 2178 var scaleY = containerHeight / slideHeight; 2179 var scale = Math.min(scaleX, scaleY); 2180 2181 slide.style.transform = 'scale(' + scale + ')'; 2182 slide.style.transformOrigin = 'top left'; 2183 slide.style.position = 'absolute'; 2184 slide.style.left = ((containerWidth - slideWidth * scale) / 2) + 'px'; 2185 slide.style.top = ((containerHeight - slideHeight * scale) / 2) + 'px'; 2186 } 2187 2188 scaleSlide(); 2189 window.addEventListener('resize', scaleSlide); 2190 })(); 2191 <\/script> 2192</body> 2193</html>`:"":""}
2193,[t.content,t.title,t.subtitle,t.bullets,t.stats,t.leftColumn,t.rightColumn,t.quote,t.quoteAuthor,t.layout,t.index,a,d,p,r,s,l]);if(t.status==="generating"||t.status==="pending")return e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-4",style:{backgroundColor:s.backgroundColor},children:[e.jsx(Ve,{className:"w-12 h-12 animate-spin text-primary"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg font-medium",style:{color:s.textColor},children:t.status==="generating"?c("pptRender.generatingSlide"):c("pptRender.waitingSlide")}),e.jsx("p",{className:"text-sm opacity-60",style:{color:s.textColor},children:t.title})]})]});if(t.status==="error")return e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center gap-4",style:{backgroundColor:s.backgroundColor},children:[e.jsx(Zt,{className:"w-12 h-12 text-red-500"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg font-medium text-red-500",children:c("pptRender.slideGenerationFailed")}),e.jsx("p",{className:"text-sm opacity-60",style:{color:s.textColor},children:t.title})]})]});if(d||a||p)return e.jsx("iframe",{ref:o,srcDoc:i,className:"w-full h-full border-0",title:t.title,tabIndex:-1});const m=s.backgroundColor.includes("gradient");return e.jsxs("div",{className:"w-full h-full p-12 flex flex-col",style:{fontFamily:s.fontFamily,color:s.textColor,...m?{background:s.backgroundColor}:{backgroundColor:s.backgroundColor}},children:[e.jsx("h2",{className:"text-4xl font-bold mb-6",style:{color:s.primaryColor},children:t.title}),t.subtitle&&e.jsx("p",{className:"text-xl mb-6 opacity-80",children:t.subtitle}),t.bullets&&t.bullets.length>0&&e.jsx("ul",{className:"space-y-4 flex-1",children:t.bullets.map((x,g)=>e.jsxs("li",{className:"flex items-start gap-3 text-xl",children:[e.jsx("span",{className:"mt-2.5 w-3 h-3 rounded-full shrink-0",style:{backgroundColor:s.accentColor}}),e.jsx("span",{children:x})]},g))}),t.imageUrl&&e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("img",{src:t.imageUrl,alt:t.title,className:"max-h-full max-w-full object-contain rounded-lg shadow-lg"})}),t.content&&!d&&!t.bullets&&e.jsx("p",{className:"flex-1 text-lg",children:t.content}),e.jsxs("div",{className:"mt-auto pt-6 flex items-center justify-between text-sm opacity-50",children:[e.jsx("span",{children:n}),e.jsx("span",{children:t.index+1})]})]})}function Ms({value:t,onChange:s,label:n,placeholder:r,theme:l}){const{t:c}=ve(),[o,d]=u.useState("url"),[a,p]=u.useState(!1),i=u.useRef(null),m=u.useCallback(C=>{var R;const w=(R=C.target.files)==null?void 0:R[0];if(!w)return;if(!w.type.startsWith("image/")){Ne.error(c("pptRender.selectImageFile"));return}if(w.size>5*1024*1024){Ne.error(c("pptRender.imageTooLarge"));return}p(!0);const D=new FileReader;D.onload=B=>{var M;const Z=(M=B.target)==null?void 0:M.result;s(Z),p(!1)},D.onerror=()=>{Ne.error(c("pptRender.imageReadFailed")),p(!1)},D.readAsDataURL(w)},[s]),x=u.useCallback(C=>{var R;C.preventDefault(),C.stopPropagation();const w=(R=C.dataTransfer.files)==null?void 0:R[0];if(!w||!w.type.startsWith("image/"))return;if(w.size>5*1024*1024){Ne.error(c("pptRender.imageTooLarge"));return}p(!0);const D=new FileReader;D.onload=B=>{var M;const Z=(M=B.target)==null?void 0:M.result;s(Z),p(!1)},D.onerror=()=>{Ne.error(c("pptRender.imageReadFailed")),p(!1)},D.readAsDataURL(w)},[s]),g=u.useCallback(C=>{C.preventDefault(),C.stopPropagation()},[]),b=u.useCallback(()=>{s(""),i.current&&(i.current.value="")},[s]);return e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:n}),e.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[e.jsxs("button",{type:"button",onClick:()=>d("url"),className:U("flex items-center gap-1 px-2 py-1 text-xs rounded-md transition-colors",o==="url"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"),children:[e.jsx(ss,{className:"w-3 h-3"}),"URL"]}),e.jsxs("button",{type:"button",onClick:()=>d("upload"),className:U("flex items-center gap-1 px-2 py-1 text-xs rounded-md transition-colors",o==="upload"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"),children:[e.jsx(ys,{className:"w-3 h-3"}),c("pptRender.upload")]})]}),o==="url"&&e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:t.startsWith("data:")?"":t,onChange:C=>s(C.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors pr-8",placeholder:r||c("pptRender.enterImageUrl"),maxLength:500}),t&&!t.startsWith("data:")&&e.jsx("button",{type:"button",onClick:b,className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground rounded",children:e.jsx(Ee,{className:"w-3 h-3"})})]}),o==="upload"&&e.jsxs("div",{onDrop:x,onDragOver:g,className:U("border-2 border-dashed rounded-lg p-4 text-center transition-colors cursor-pointer",a?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),onClick:()=>{var C;return(C=i.current)==null?void 0:C.click()},children:[e.jsx("input",{ref:i,type:"file",accept:"image/*",onChange:m,className:"hidden"}),a?e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(Ve,{className:"w-6 h-6 animate-spin text-primary"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:c("pptRender.uploading")})]}):e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(ys,{className:"w-6 h-6 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:c("pptRender.dragDropHint")}
2193),e.jsx("span",{className:"text-[10px] text-muted-foreground/70",children:c("pptRender.imageFormats")})]})]}),t&&e.jsxs("div",{className:"mt-3 relative group",children:[e.jsx("div",{className:"rounded-lg overflow-hidden border border-border flex items-center justify-center",style:{maxHeight:"200px"},children:e.jsx("img",{src:t,alt:c("pptRender.previewLabel"),className:"max-w-full max-h-[200px] object-contain",onError:C=>{C.target.style.display="none"}})}),e.jsx("button",{type:"button",onClick:b,className:"absolute top-2 right-2 p-1.5 bg-destructive text-destructive-foreground rounded-md opacity-0 group-hover:opacity-100 transition-opacity shadow-lg",title:c("pptRender.removeImage"),children:e.jsx(Ee,{className:"w-4 h-4"})}),t.startsWith("data:")&&e.jsx("span",{className:"absolute bottom-2 left-2 px-2 py-0.5 text-[10px] bg-background/80 rounded text-muted-foreground",children:c("pptRender.localImage")})]}),!t&&e.jsx("div",{className:"mt-3 h-[120px] rounded-lg border border-dashed border-border flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(et,{className:"w-8 h-8 mx-auto mb-2 text-muted-foreground/50"}),e.jsx("span",{className:"text-xs text-muted-foreground/50",children:c("pptRender.noImage")})]})})]})}const Ti=[{id:"title",nameKey:"pptRender.layoutTitle",icon:Dr,descKey:"pptRender.layoutTitleDesc"},{id:"content",nameKey:"pptRender.layoutContent",icon:er,descKey:"pptRender.layoutContentDesc"},{id:"two-column",nameKey:"pptRender.layoutTwoColumn",icon:ks,descKey:"pptRender.layoutTwoColumnDesc"},{id:"image-left",nameKey:"pptRender.layoutImageLeft",icon:bs,descKey:"pptRender.layoutImageLeftDesc"},{id:"image-right",nameKey:"pptRender.layoutImageRight",icon:bs,descKey:"pptRender.layoutImageRightDesc"},{id:"full-image",nameKey:"pptRender.layoutFullImage",icon:Vt,descKey:"pptRender.layoutFullImageDesc"},{id:"quote",nameKey:"pptRender.layoutQuote",icon:Ue,descKey:"pptRender.layoutQuoteDesc"},{id:"stats",nameKey:"pptRender.layoutStats",icon:Gt,descKey:"pptRender.layoutStatsDesc"},{id:"comparison",nameKey:"pptRender.layoutComparison",icon:ks,descKey:"pptRender.layoutComparisonDesc"},{id:"timeline",nameKey:"pptRender.layoutTimeline",icon:Vt,descKey:"pptRender.layoutTimelineDesc"},{id:"summary",nameKey:"pptRender.layoutSummary",icon:Gt,descKey:"pptRender.layoutSummaryDesc"}],cr=[{id:"modern",nameKey:"pptRender.themeModern",color:"#2563eb"},{id:"corporate",nameKey:"pptRender.themeCorporate",color:"#0066cc"},{id:"minimalist",nameKey:"pptRender.themeMinimalist",color:"#111827"},{id:"dark",nameKey:"pptRender.themeDark",color:"#818cf8"},{id:"nature",nameKey:"pptRender.themeNature",color:"#059669"},{id:"tech",nameKey:"pptRender.themeTech",color:"#00d4ff"},{id:"elegant",nameKey:"pptRender.themeElegant",color:"#78350f"},{id:"ocean",nameKey:"pptRender.themeOcean",color:"#0077b6"},{id:"monochrome",nameKey:"pptRender.themeMonochrome",color:"#000000"},{id:"neon",nameKey:"pptRender.themeNeon",color:"#ff00ff"}],pr=[{id:"gradient",nameKey:"pptRender.themeGradient",colors:["#667eea","#764ba2"]},{id:"sunset",nameKey:"pptRender.themeSunset",colors:["#ff9a9e","#fecfef"]}],_s={primary:["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#000000","#525252","#ffffff"],gradients:[{nameKey:"pptRender.gradientPurpleBlue",colors:["#667eea","#764ba2"]},{nameKey:"pptRender.gradientPink",colors:["#ff9a9e","#fecfef"]},{nameKey:"pptRender.gradientTeal",colors:["#11998e","#38ef7d"]},{nameKey:"pptRender.gradientOrangeRed",colors:["#ff512f","#f09819"]},{nameKey:"pptRender.gradientDeepBlue",colors:["#2193b0","#6dd5ed"]},{nameKey:"pptRender.gradientPurpleRed",colors:["#ee0979","#ff6a00"]},{nameKey:"pptRender.gradientCyanBlue",colors:["#00c6ff","#0072ff"]},{nameKey:"pptRender.gradientNight",colors:["#0f0c29","#302b63","#24243e"]},{nameKey:"pptRender.gradientAurora",colors:["#00d2ff","#3a7bd5"]},{nameKey:"pptRender.gradientFlame",colors:["#f12711","#f5af19"]}]};[...cr,...pr.map(t=>({id:t.id,nameKey:t.nameKey,color:t.colors[0]}))];function Ri(t,s){if(!s)return t;const n={...t};return s.primary&&(n.primaryColor=s.primary,n.accentColor=s.primary),s.gradient&&s.gradient.length>=2&&(n.backgroundColor=`linear-gradient(135deg, ${s.gradient.join(", ")})`,s.primary||(n.primaryColor="#ffffff"),n.textColor="#ffffff",n.cardBackgroun
2193d="rgba(255,255,255,0.1)",n.borderColor="rgba(255,255,255,0.2)"),n}function Di({slide:t,theme:s,themeName:n,allSlides:r,onSave:l,onCancel:c,onAddSlide:o,onDeleteSlide:d,onDuplicateSlide:a,onThemeChange:p}){var wt,Mt,jt,Nt,ls,as,os,ds,cs,ps;const{t:i}=ve(),[m,x]=u.useState("content"),[g,b]=u.useState(null),C=u.useMemo(()=>g?Ri(s,g):s,[s,g]),[w,D]=u.useState(t.content||""),R=!!(t.content&&bt(t.content)),[B,Z]=u.useState(R?"preserve":"template"),[M,k]=u.useState([]),v=u.useCallback(h=>{if(!h)return{elements:[],modifiedHtml:h};try{const Y=new DOMParser().parseFromString(h,"text/html"),W=[];let me=0;const Te={title:i("pptRender.fieldTitle"),subtitle:i("pptRender.fieldSubtitle"),bullet:i("pptRender.fieldBulletItem"),text:i("pptRender.fieldTitle"),"stat-value":i("pptRender.fieldStatValue"),"stat-label":i("pptRender.fieldStatLabel"),quote:i("pptRender.fieldQuoteContent"),"quote-author":i("pptRender.fieldAuthor"),"timeline-item":i("pptRender.fieldPhase"),"comparison-item":i("pptRender.fieldLeftColumnComparison"),content:i("pptRender.fieldBullets")},ke=(oe,xe)=>{const re=oe.tagName.toLowerCase(),he=oe.className?`.${oe.className.split(" ").filter(je=>je&&!je.includes("lucide")).join(".")}`:"";return`${re}${he}[data-edit-id="${xe}"]`},ct=oe=>{const xe=oe.getAttribute("data-editable");if(xe&&Te[xe])return Te[xe];const re=oe.tagName.toLowerCase(),he=(oe.className||"").toLowerCase();return re==="h1"||he.includes("title")?i("pptRender.fieldTitle"):re==="h2"||re==="h3"||he.includes("subtitle")||he.includes("sub-title")?i("pptRender.fieldSubtitle"):he.includes("stat-number")||he.includes("stat-value")?i("pptRender.fieldStatValue"):he.includes("stat-label")?i("pptRender.fieldStatLabel"):he.includes("quote")||re==="blockquote"?i("pptRender.fieldQuoteContent"):he.includes("author")||re==="cite"?i("pptRender.fieldAuthor"):re==="li"?i("pptRender.fieldBulletItem"):re==="p"?i("pptRender.fieldBullets"):re==="span"?i("pptRender.fieldTitle"):re.toUpperCase()},we=oe=>{var he,je;const xe=Array.from(oe.childNodes).some(ye=>{var Ae;return ye.nodeType===Node.TEXT_NODE&&((Ae=ye.textContent)==null?void 0:Ae.trim())});let re="";return oe.children.length===0||xe?(re=Array.from(oe.childNodes).filter(ye=>ye.nodeType===Node.TEXT_NODE).map(ye=>{var Ae;return(Ae=ye.textContent)==null?void 0:Ae.trim()}).filter(Boolean).join(" "),re||(re=((he=oe.textContent)==null?void 0:he.trim())||"")):re=((je=oe.textContent)==null?void 0:je.trim())||"",re},He=(oe,xe)=>!(!xe||xe.length===0||oe.closest("script")||oe.closest("style")||/^(\d{1,2}|page\s*\d+|第\s*\d+\s*页)$/i.test(xe)),ht=Y.body.querySelectorAll("[data-editable]"),rt=new Set;if(ht.forEach(oe=>{const xe=we(oe);if(!He(oe,xe))return;const re=me++;oe.setAttribute("data-edit-id",String(re)),rt.add(oe);const he=oe.getAttribute("data-editable")||"";W.push({id:`element-${re}`,selector:ke(oe,re),tagName:oe.tagName.toLowerCase(),text:xe,label:ct(oe),className:oe.className||"",isMultiline:he==="text"||he==="quote"||xe.length>50})}),W.length===0){const oe=["h1","h2","h3","h4","h5","h6","p","li","blockquote","cite",".title",".subtitle",".sub-title",".stat-number",".stat-value",".stat-label",".quote",".author","span:not(:has(*))","div.stat-card > div:not(:has(svg))"];
2193Y.body.querySelectorAll(oe.join(", ")).forEach(re=>{if(rt.has(re)||!Array.from(re.childNodes).some(Ae=>{var qe;return Ae.nodeType===Node.TEXT_NODE&&((qe=Ae.textContent)==null?void 0:qe.trim())})&&re.children.length>0&&Array.from(re.children).filter(qe=>qe.tagName.toLowerCase()!=="svg"&&qe.tagName.toLowerCase()!=="i").length>0)return;const je=we(re);if(!He(re,je))return;const ye=me++;re.setAttribute("data-edit-id",String(ye)),W.push({id:`element-${ye}`,selector:ke(re,ye),tagName:re.tagName.toLowerCase(),text:je,label:ct(re),className:re.className||"",isMultiline:re.tagName.toLowerCase()==="p"||re.tagName.toLowerCase()==="blockquote"||je.length>50})})}Y.body.querySelectorAll("img[src]").forEach(oe=>{const xe=oe,re=xe.getAttribute("src")||"";if(!re||re.length<10)return;const he=me++;xe.setAttribute("data-edit-id",String(he));const je=xe.getAttribute("alt")||"",ye=re.startsWith("data:");W.push({id:`element-${he}`,selector:`img[data-edit-id="${he}"]`,tagName:"img",text:ye?"":re,label:i(ye?"pptRender.base64ImageHint":"pptRender.fieldTitle"),className:xe.className||"",isMultiline:!1,isImage:!0,imageAlt:je})});const Tt=h.includes("<!DOCTYPE")||h.includes("<html");let Le;return Tt?Le=`<!DOCTYPE html> 2194`+Y.documentElement.outerHTML:Le=Y.body.innerHTML,{elements:W,modifiedHtml:Le}}catch(j){return console.error("Failed to extract editable elements:",j),{elements:[],modifiedHtml:h}}},[]),S=u.useCallback((h,j)=>{k(Y=>Y.find(me=>me.id===h)?Y.map(me=>me.id===h?{...me,text:j}:me):Y),D(Y=>{if(!Y)return console.warn("[updateHtmlElement] No preserved HTML"),Y;try{const me=new DOMParser().parseFromString(Y,"text/html"),Te=h.replace("element-",""),ke=me.querySelector(`[data-edit-id="${Te}"]`);if(!ke)return Y;if(ke.tagName.toLowerCase()==="img")ke.setAttribute("src",j);else if(ke.children.length>0){let ht=!1;Array.from(ke.childNodes).forEach(rt=>{rt.nodeType===Node.TEXT_NODE&&!ht&&(rt.textContent=j,ht=!0)}),ht||ke.insertBefore(me.createTextNode(j),ke.firstChild)}else ke.textContent=j;return Y.includes("<!DOCTYPE")||Y.includes("<html")?`<!DOCTYPE html> 2195`+me.documentElement.outerHTML:me.body.innerHTML}catch(W){return console.error("[updateHtmlElement] Failed to update HTML:",W),Y}})},[]);u.useEffect(()=>{if(R&&B==="preserve"){const{elements:h,modifiedHtml:j}=v(t.content||"");k(h),D(j)}},[t.id,B,R,v]);const J=u.useCallback(()=>{if(t.content&&bt(t.content)){const h=Qn(t.content);return{...h.content,title:t.title||h.content.title,subtitle:t.subtitle||h.content.subtitle,bullets:t.bullets&&t.bullets.length>0?[...t.bullets]:h.content.bullets,notes:t.notes||h.content.notes,imageUrl:t.imageUrl||h.content.imageUrl||"",leftColumn:t.leftColumn&&t.leftColumn.length>0?[...t.leftColumn]:h.content.leftColumn,rightColumn:t.rightColumn&&t.rightColumn.length>0?[...t.rightColumn]:h.content.rightColumn,quote:h.content.quote||"",quoteAuthor:h.content.quoteAuthor||""}}return{...gi(),title:t.title||"",subtitle:t.subtitle||"",bullets:t.bullets?[...t.bullets]:[],notes:t.notes||"",imageUrl:t.imageUrl||"",leftColumn:t.leftColumn?[...t.leftColumn]:[],rightColumn:t.rightColumn?[...t.rightColumn]:[]}},[t.content,t.title,t.subtitle,t.bullets,t.notes,t.imageUrl,t.leftColumn,t.rightColumn]),H=u.useCallback(()=>t.layout?t.layout:t.content&&bt(t.content)?ir(t.content):"content",[t.layout,t.content]),[f,y]=u.useState(J),[L,E]=u.useState(H),[_,Q]=u.useState([]),[$,K]=u.useState(-1),[F,P]=u.useState(null),[A,T]=u.useState(null);u.useEffect(()=>{const h=J(),j=H();y(h),E(j),P(null),T(null),Q([{content:h,layout:j}]),K(0);const Y=!!(t.content&&bt(t.content));Z(Y?"preserve":"template")},[t.index,t.id,J,H]),u.useCallback((h,j)=>{var Y,W,me,Te,ke;if(!h)return"";try{const we=new DOMParser().parseFromString(h,"text/html"),He=we.querySelector("h1, h2, .title");if(He)j.title&&(He.textContent=j.title);else if(j.title){const Le=we.querySelector("blockquote");if(Le){const oe=we.body.querySelector("div");if(oe){const xe=we.createElement("h1");xe.setAttribute("style","font-size: 44px; font-weight: 700; margin-bottom: 32px; color: #2563eb;"),xe.textContent=j.title,oe.insertBefore(xe,Le)}}}const ht=we.querySelectorAll("p");for(const Le of ht)if(!Le.closest("li")&&!Le.closest("footer")&&!Le.closest(".column")){const oe=(Y=Le.textContent)==null?void 0:Y.trim();if(oe&&!/^\d+$/.test(oe)&&oe.length>2){j.subtitle&&(Le.textContent=j.subtitle);break}}if(j.quote){const Le=we.querySelector("blockquote");Le&&(Le.textContent=j.quote)}const rt=we.querySelector("cite");rt&&(j.quoteAuthor?rt.textContent=`â ${j.quoteAuthor}`:rt.textContent="");const kt=we.querySelectorAll('div[style*="grid-template-columns"] > div'),Tt=(Le,oe,xe,re)=>{if(!Le)return;const he=Le.querySelector("ul");if(!he)return;const je=Array.from(he.querySelectorAll("li"));for(;je.length>
2195oe.length;){const ye=je.pop();ye==null||ye.remove()}oe.forEach((ye,Ae)=>{if(je[Ae]){const qe=je[Ae].querySelectorAll("span"),nt=qe[qe.length-1];nt&&(nt.textContent=ye)}else{const qe=he.querySelector("li");if(qe){const nt=qe.cloneNode(!0),us=nt.querySelectorAll("span"),ms=us[us.length-1];ms&&(ms.textContent=ye),he.appendChild(nt)}else{const nt=we.createElement("li");nt.setAttribute("style","display: flex; align-items: center; gap: 12px; font-size: 18px;"),nt.innerHTML=`<span style="color: ${xe};">${re}</span><span>${ye}</span>`,he.appendChild(nt)}}})};if(j.leftColumn&&kt.length>=1&&Tt(kt[0],j.leftColumn,"#22c55e","â"),j.rightColumn&&kt.length>=2&&Tt(kt[1],j.rightColumn,"#ef4444","â"),j.bullets&&j.bullets.length>0){const Le=we.querySelectorAll("ul");let oe=null;for(const xe of Le)if(!xe.closest('div[style*="grid-template-columns"] > div')){oe=xe;break}if(oe){const xe=Array.from(oe.querySelectorAll(":scope > li"));for(;xe.length>j.bullets.length;){const re=xe.pop();re==null||re.remove()}j.bullets.forEach((re,he)=>{if(xe[he]){const je=xe[he].querySelectorAll("span");if(je.length>0){const ye=je[je.length-1];ye&&(ye.textContent=re)}else{const ye=xe[he].firstChild;ye&&ye.nodeType===Node.TEXT_NODE&&(xe[he].textContent=re)}}else{const je=oe.querySelector("li");if(je){const ye=je.cloneNode(!0),Ae=ye.querySelectorAll("span");if(Ae.length>0){const qe=Ae[Ae.length-1];qe&&(qe.textContent=re)}oe.appendChild(ye)}}})}}if(j.imageUrl){const Le=we.querySelector('img:not([src*="icon"]):not([width="24"])');if(Le)Le.setAttribute("src",j.imageUrl);else{const oe=we.querySelectorAll("div");let xe=!1;for(const re of oe){const he=re.children.length===0,je=((W=re.textContent)==null?void 0:W.trim())==="å¾çåºå"||((me=re.textContent)==null?void 0:me.trim())==="å¾ç";if(he&&je){const ye=we.createElement("img");ye.setAttribute("src",j.imageUrl),ye.setAttribute("style","width: 100%; height: 100%; object-fit: contain;"),ye.setAttribute("alt",j.title||i("preview.imageAlt","Image")),re.innerHTML="",re.style.background="none",re.style.display="flex",re.style.alignItems="center",re.style.justifyContent="center",re.appendChild(ye),xe=!0;break}}if(!xe){const re=we.querySelectorAll('div[style*="border-radius"][style*="flex"]');for(const he of re)if((Te=he.textContent)!=null&&Te.includes("å¾çåºå")||(ke=he.textContent)!=null&&ke.includes("å¾ç")){const je=we.createElement("img");je.setAttribute("src",j.imageUrl),je.setAttribute("style","width: 100%; height: 100%; object-fit: contain;"),je.setAttribute("alt",j.title||i("preview.imageAlt","Image")),he.innerHTML="",he.style.background="none",he.appendChild(je);break}}}}return`<!DOCTYPE html> 2196`+we.documentElement.outerHTML}catch(ct){return console.error("Error updating HTML content:",ct),h}},[]);const I=u.useCallback((h,j)=>{y(Y=>({...Y,[h]:j}))},[]),V=u.useCallback(()=>{y(h=>({...h,bullets:[...h.bullets,""]}))},[]),ie=u.useCallback(h=>{y(j=>({...j,bullets:j.bullets.filter((Y,W)=>W!==h)}))},[]),le=u.useCallback((h,j)=>{y(Y=>{const W=[...Y.bullets];return W[h]=j,{...Y,bullets:W}})},[]),be=u.useCallback(()=>{y(h=>({...h,leftColumn:[...h.leftColumn,""]}))},[]),ae=u.useCallback(()=>{y(h=>({...h,rightColumn:[...h.rightColumn,""]}))},[]),pe=u.useCallback((h,j)=>{y(Y=>{const W=[...Y.leftColumn];return W[h]=j,{...Y,leftColumn:W}})},[]),te=u.useCallback((h,j)=>{y(Y=>{const W=[...Y.rightColumn];return W[h]=j,{...Y,rightColumn:W}})},[]),ne=u.useCallback(h=>{y(j=>({...j,leftColumn:j.leftColumn.filter((Y,W)=>W!==h)}))},[]),ee=u.useCallback(h=>{y(j=>({...j,rightColumn:j.rightColumn.filter((Y,W)=>W!==h)}))},[]),q=u.useCallback(()=>{y(h=>({...h,stats:[...h.stats,{value:"",label:""}]}))},[]),O=u.useCallback(h=>{y(j=>({...j,stats:j.stats.filter((Y,W)=>W!==h)}))},[]),z=u.useCallback((h,j,Y)=>{y(W=>{const me=[...W.stats];return me[h]={...me[h],[j]:Y},{...W,stats:me}})},[]),se=u.useCallback((h,j)=>{P(j),h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("text/plain",String(j)),setTimeout(()=>{h.target.style.opacity="0.5"},0)},[]),ce=u.useCallback(h=>{P(null),T(null),h.target.style.opacity="1"},[]),fe=u.useCallback((h,j)=>{h.preventDefault(),h.dataTransfer.dropEffect="move",F!==null&&F!==j&&T(j)},[F]),Ce=u.useCallback(()=>{T(null)},[]),_e=u.useCallback((h,j)=>{if(h.preventDefault(),F===null||F===j){P(null),T(null);return}y(Y=>{const W=[...Y.bullets],[me]=W.splice(F,1);return W.splice(j,0,me),{...Y,bullets:W}}),P(null),T(null)},[F]),Fe=u.useCallback(h=>{E(h);const j=fi(h);y(Y=>{const W={...Y};
2196return!W.title&&j.title&&(W.title=j.title),j.leftColumn&&W.leftColumn.length===0&&(W.leftColumn=j.leftColumn),j.rightColumn&&W.rightColumn.length===0&&(W.rightColumn=j.rightColumn),j.stats&&W.stats.length===0&&(W.stats=j.stats),j.quote&&!W.quote&&(W.quote=j.quote),j.quoteAuthor&&!W.quoteAuthor&&(W.quoteAuthor=j.quoteAuthor),W})},[]),Re=u.useCallback(()=>{const h={content:{...f},layout:L};Q(j=>{const Y=j.slice(0,$+1);return Y.push(h),Y.length>50&&Y.shift(),Y}),K(j=>Math.min(j+1,49))},[f,L,$]),ue=u.useCallback(()=>{if($>0){const h=_[$-1];y({...h.content}),E(h.layout),K(j=>j-1)}},[_,$]),X=u.useCallback(()=>{if($<_.length-1){const h=_[$+1];y({...h.content}),E(h.layout),K(j=>j+1)}},[_,$]);u.useEffect(()=>{const h=j=>{(j.ctrlKey||j.metaKey)&&j.key==="s"&&(j.preventDefault(),ze()),(j.ctrlKey||j.metaKey)&&j.key==="z"&&!j.shiftKey&&(j.preventDefault(),ue()),(j.ctrlKey||j.metaKey)&&(j.key==="y"||j.key==="z"&&j.shiftKey)&&(j.preventDefault(),X()),j.key==="Escape"&&(j.preventDefault(),c())};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[ue,X,c]);const G=u.useRef(null);u.useEffect(()=>(G.current&&clearTimeout(G.current),G.current=setTimeout(()=>{Re()},500),()=>{G.current&&clearTimeout(G.current)}),[f,L]);const de=u.useMemo(()=>B==="preserve"&&w?w:Ps(L,f,n,t.index,C),[B,L,f,n,t.index,w,C]),ze=u.useCallback(()=>{const h=f.bullets.filter(W=>W.trim());let j,Y=f.title||i("pptRender.untitledSlide");if(B==="preserve"&&w){j=w;const W=M.find(me=>me.label===i("pptRender.fieldTitle"));W&&(Y=W.text||i("pptRender.untitledSlide"))}else j=Ps(L,f,n,t.index,C);l({...t,layout:L,title:Y,subtitle:f.subtitle||void 0,bullets:h,notes:f.notes||void 0,imageUrl:f.imageUrl||void 0,leftColumn:f.leftColumn.length>0?f.leftColumn:void 0,rightColumn:f.rightColumn.length>0?f.rightColumn:void 0,content:j})},[t,f,L,n,B,M,w,l,C]),Se=$>0,We=$<_.length-1,De=(h,j,Y,W,me,Te,ke=!1)=>e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:me}),e.jsxs("div",{className:"space-y-2",children:[h.map((ct,we)=>e.jsxs("div",{draggable:ke,onDragStart:ke?He=>se(He,we):void 0,onDragEnd:ke?ce:void 0,onDragOver:ke?He=>fe(He,we):void 0,onDragLeave:ke?Ce:void 0,onDrop:ke?He=>_e(He,we):void 0,className:U("flex items-center gap-2 group transition-all",ke&&F===we&&"opacity-50",ke&&A===we&&"border-t-2 border-primary pt-1"),children:[ke&&e.jsx("div",{className:"cursor-grab active:cursor-grabbing p-1 hover:bg-muted rounded",children:e.jsx(tr,{className:"w-4 h-4 text-muted-foreground"})}),e.jsx("input",{type:"text",value:ct,onChange:He=>j(we,He.target.value),className:"flex-1 px-2 py-1.5 text-sm rounded-md border border-border bg-background text-foreground focus:ring-1 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:`${Te} ${we+1}...`,maxLength:1e3}),e.jsx("button",{onClick:()=>W(we),className:"p-1 text-muted-foreground hover:text-destructive rounded opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Qe,{className:"w-4 h-4"})})]},we)),e.jsxs("button",{onClick:Y,className:"flex items-center gap-1 px-2 py-1.5 text-xs text-muted-foreground hover:text-primary hover:bg-primary/5 rounded-md border border-dashed border-border hover:border-primary transition-colors",children:[e.jsx(Be,{className:"w-3 h-3"}),i("pptRender.addItem",{placeholder:Te})]})]})]}),Ie=()=>{if(M.length===0)return e.jsxs("div",{className:"text-center text-muted-foreground py-8",children:[e.jsx("p",{className:"text-sm",children:i("pptRender.noEditableElements")}),e.jsx("p",{className:"text-xs mt-1",children:i("pptRender.noEditableElementsHint")})]});const h={};return M.forEach(j=>{const Y=j.label;h[Y]||(h[Y]=[]),h[Y].push(j)}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 pb-2 border-b border-border",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:i("pptRender.preserveModeHeader",{count:M.length})}),e.jsx("span",{className:"text-[10px] text-amber-600 dark:text-amber-400",children:i("pptRender.preserveOriginalStyle")})]}),Object.entries(h).map(([j,Y])=>e.jsxs("div",{className:"space-y-2",children:[Object.keys(h).length>1&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:j}),e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:["(",Y.length,")"]})]}),Y.map((W,me)=>e.jsxs("div",{className:"group",children:[e.jsxs("label",{className:"block text-[10px] font-medium mb-1 text-muted-foreground",children:[Object.keys(h).length===1?j:""," ",Y.length>1?`#${me+1}`:"",e.jsxs("span",{className:"ml-2 text-[9px] text-muted-foreground
2196/60",children:["<",W.tagName,">"]})]}),W.isImage?e.jsxs("div",{className:"space-y-2",children:[W.label.includes("Base64")&&!W.text&&e.jsx("p",{className:"text-[10px] text-amber-600 dark:text-amber-400",children:i("pptRender.base64ImageHint")}),e.jsx("div",{className:"flex gap-2",children:e.jsx("input",{type:"text",value:W.text,onChange:Te=>S(W.id,Te.target.value),className:"flex-1 px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:W.label.includes("Base64")?i("pptRender.inputNewImageUrl"):i("pptRender.inputImageUrl"),maxLength:500})}),W.text&&e.jsx("div",{className:"relative w-full h-24 rounded-lg border border-border overflow-hidden bg-secondary/30",children:e.jsx("img",{src:W.text,alt:W.imageAlt||i("pptRender.previewLabel"),className:"w-full h-full object-contain",onError:Te=>{Te.target.style.display="none"}})})]}):W.isMultiline?e.jsx("textarea",{value:W.text,onChange:Te=>S(W.id,Te.target.value),rows:Math.min(6,Math.max(2,Math.ceil(W.text.length/50))),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors resize-none",placeholder:`${W.label}...`,maxLength:1e3}):e.jsx("input",{type:"text",value:W.text,onChange:Te=>S(W.id,Te.target.value),className:U("w-full px-3 py-2 rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",W.tagName==="h1"?"text-lg font-bold":W.tagName==="h2"?"text-base font-semibold":W.tagName==="h3"?"text-sm font-medium":"text-sm"),placeholder:`${W.label}...`,maxLength:200})]},W.id))]},j))]})},dt=()=>{switch(L){case"title":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitle")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2.5 text-lg font-bold rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTitle"),maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldSubtitle")}),e.jsx("input",{type:"text",value:f.subtitle,onChange:h=>I("subtitle",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputSubtitle"),maxLength:200})]})]});case"two-column":case"comparison":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitle")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2.5 text-lg font-bold rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTitleGeneric"),maxLength:200})]}),L==="two-column"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldSubtitle")}),e.jsx("input",{type:"text",value:f.subtitle,onChange:h=>I("subtitle",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputSubtitleGeneric"),maxLength:200})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx("div",{children:De(f.leftColumn,pe,be,ne,i(L==="comparison"?"pptRender.fieldLeftColumnComparison":"pptRender.fieldLeftColumnTwo"),i(L==="comparison"?"pptRender.fieldLeftColumnComparison":"pptRender.fieldBullets"))}),e.jsx("div",{children:De(f.rightColumn,te,ae,ee,i(L==="comparison"?"pptRender.fieldRightColumnComparison":"pptRender.fieldRightColumnTwo"),i(L==="comparison"?"pptRender.fieldRightColumnComparison":"pptRender.fieldBullets"))})]})]});case"image-left":case"image-right":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitle")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2.5 text-lg font-bold rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTitleGeneric"),maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldSubtitle")}),e.jsx("input",{type:"text",value:f.subtitle,onChange:h=>I("subtitle",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputSubtitleGeneric"),maxLength:200})]}),e.jsx(Ms,{value:f.imageUrl,onChange:h=>I("imageUrl",h),label:i(L==="image-left"?"pptRender.fieldLeftImage":"pptRender.fieldRightImage"),placeholder:i("pptRender.inputImageUrl"),theme:s}),De(f.bullets,le,V,ie,i("pptRender.fieldBullets"),i("pptRender.fieldBulletItem"),!0)]});case"full-image":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitle")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2.5 text-lg font-bold rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTitleGeneric"),maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldSubtitle")}),e.jsx("input",{type:"text",value:f.subtitle,onChange:h=>I("subtitle",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputSubtitleGeneric"),maxLength:200})]}),e.jsx(Ms,{value:f.imageUrl,onChange:h=>I("imageUrl",h),label:i("pptRender.fieldBgImage"),placeholder:i("pptRender.fieldBgImagePlaceholder"),theme:s})]});case"quote":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitleOptional")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTitleGeneric"),maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldQuoteContent")}),e.jsx("textarea",{value:f.quote,onChange:h=>I("quote",h.target.value),rows:4,className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors resize-none",placeholder:i("pptRender.inputQuote"),maxLength:1e3})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldAuthor")}),e.jsx("input",{type:"text",value:f.quoteAuthor,onChange:h=>I("quoteAuthor",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputAuthor"),maxLength:200})]})]});case"stats":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitle")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2.5 text-lg font-bold rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTitleGeneric"),maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldSubtitle")}),e.jsx("input",{type:"text",value:f.subtitle,onChange:h=>I("subtitle",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputSubtitleGeneric"),maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldStats")}),e.jsxs("div",{className:"space-y-2",children:[f.stats.map((h,j)=>e.jsxs("div",{className:"flex items-center gap-2 group",children:[e.jsx("input",{type:"text",value:h.value,onChange:Y=>z(j,"value",Y.target.value),className:"w-24 px-2 py-1.5 text-sm font-bold rounded-md border border-border bg-background text-foreground focus:ring-1 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.fieldStatValue"),maxLength:50}),e.jsx("input",{type:"text",value:h.label,onChange:Y=>z(j,"label",Y.target.value),className:"flex-1 px-2 py-1.5 text-sm rounded-md border border-border bg-background text-foreground focus:ring-1 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.fieldStatLabel"),maxLength:200}),e.jsx("button",{onClick:()=>O(j),className:"p-1 text-muted-foreground hover:text-destructive rounded opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Qe,{className:"w-4 h-4"})})]},j)),e.jsxs("button",{onClick:q,className:"flex items-center gap-1 px-2 py-1.5 text-xs text-muted-foreground hover:text-primary hover:bg-primary/5 rounded-md border border-dashed border-border hover:border-primary w-full justify-center transition-colors",children:[e.jsx(Be,{className:"w-3 h-3"}),i("pptRender.addStat")]})]})]})]});case"timeline":return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitle")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2.5 text-lg font-bold rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTimelineTitle"),maxLength:200})]}),De(f.bullets,le,V,ie,i("pptRender.fieldTimelineNodes"),i("pptRender.fieldPhase"),!0)]});case"summary":case"content":default:return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldTitle")}),e.jsx("input",{type:"text",value:f.title,onChange:h=>I("title",h.target.value),className:"w-full px-3 py-2.5 text-lg font-bold rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputTitleGeneric"),maxLength:200})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.fieldSubtitle")}),e.jsx("input",{type:"text",value:f.subtitle,onChange:h=>I("subtitle",h.target.value),className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none transition-colors",placeholder:i("pptRender.inputSubtitleGeneric"),maxLength:200})]}),De(f.bullets,le,V,ie,i(L==="summary"?"pptRender.fieldSummaryPoints":"pptRender.fieldBullets"),i("pptRender.fieldBulletItem"),!0)]})}};return e.jsxs("div",{className:"w-full h-full flex flex-col overflow-hidden bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border bg-muted/50",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:i("pptRender.slideCount",{current:t.index+1,total:r.length})}),e.jsx("div",{className:"h-4 w-px bg-border"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:ue,disabled:!Se,className:U("p-1.5 rounded-md transition-colors",Se?"hover:bg-muted text-muted-foreground hover:text-foreground":"text-muted-foreground
2196/30 cursor-not-allowed"),title:i("pptRender.undoTitle"),children:e.jsx(Jr,{className:"w-4 h-4"})}),e.jsx("button",{onClick:X,disabled:!We,className:U("p-1.5 rounded-md transition-colors",We?"hover:bg-muted text-muted-foreground hover:text-foreground":"text-muted-foreground/30 cursor-not-allowed"),title:i("pptRender.redoTitle"),children:e.jsx(nn,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center bg-muted rounded-lg p-1",children:[e.jsxs("button",{onClick:()=>x("content"),className:U("px-3 py-1 text-xs font-medium rounded-md transition-colors flex items-center gap-1.5",m==="content"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(qs,{className:"w-3.5 h-3.5"}),i("pptRender.tabContent")]}),e.jsxs("button",{onClick:()=>x("design"),className:U("px-3 py-1 text-xs font-medium rounded-md transition-colors flex items-center gap-1.5",m==="design"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Gs,{className:"w-3.5 h-3.5"}),i("pptRender.tabDesign")]}),e.jsxs("button",{onClick:()=>x("notes"),className:U("px-3 py-1 text-xs font-medium rounded-md transition-colors flex items-center gap-1.5",m==="notes"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Rr,{className:"w-3.5 h-3.5"}),i("pptRender.tabNotes")]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[o&&e.jsx("button",{onClick:o,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded-md transition-colors",title:i("pptRender.addSlide"),children:e.jsx(Be,{className:"w-4 h-4"})}),a&&e.jsx("button",{onClick:a,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded-md transition-colors",title:i("pptRender.copySlide"),children:e.jsx(st,{className:"w-4 h-4"})}),d&&r.length>1&&e.jsx("button",{onClick:d,className:"p-1.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 rounded-md transition-colors",title:i("pptRender.deleteSlide"),children:e.jsx(Qe,{className:"w-4 h-4"})}),e.jsx("div",{className:"h-4 w-px bg-border mx-1"}),e.jsx("button",{onClick:c,className:"px-3 py-1.5 text-sm text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",children:i("pptRender.cancel")}),e.jsxs("button",{onClick:ze,className:"px-3 py-1.5 text-sm bg-primary text-primary-foreground hover:bg-primary/90 rounded-lg transition-colors flex items-center gap-1",children:[e.jsx(Me,{className:"w-4 h-4"}
2196),i("pptRender.save")]})]})]}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsxs("div",{className:"flex-1 overflow-y-auto border-r border-border bg-background",children:[m==="content"&&e.jsx("div",{className:"p-4 space-y-4",children:R&&B==="preserve"?Ie():dt()}),m==="design"&&e.jsxs("div",{className:"p-4 space-y-6",children:[R&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-2 text-muted-foreground",children:i("pptRender.editMode")}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>Z("preserve"),className:U("flex-1 p-3 rounded-lg border-2 transition-all text-left",B==="preserve"?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx("div",{className:"text-xs font-medium mb-0.5",children:i("pptRender.editModePreserve")}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:i("pptRender.editModePreserveDesc")})]}),e.jsxs("button",{onClick:()=>Z("template"),className:U("flex-1 p-3 rounded-lg border-2 transition-all text-left",B==="template"?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx("div",{className:"text-xs font-medium mb-0.5",children:i("pptRender.editModeTemplate")}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:i("pptRender.editModeTemplateDesc")})]})]}),B==="preserve"&&e.jsx("p",{className:"mt-2 text-[10px] text-amber-600 dark:text-amber-400",children:i("pptRender.editModePreserveTip")})]}),e.jsxs("div",{className:U(B==="preserve"&&R&&"opacity-50 pointer-events-none"),children:[e.jsx("label",{className:"block text-xs font-medium mb-2 text-muted-foreground",children:i("pptRender.slideLayout")}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:Ti.map(h=>{const j=h.icon;return e.jsxs("button",{onClick:()=>Fe(h.id),className:U("p-3 rounded-lg border-2 transition-all text-left",L===h.id?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx(j,{className:U("w-5 h-5 mb-1.5",L===h.id?"text-primary":"text-muted-foreground")}),e.jsx("div",{className:"text-xs font-medium",children:i(h.nameKey)}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:i(h.descKey)})]},h.id)})})]}),e.jsxs("div",{className:U(B==="preserve"&&R&&"opacity-50 pointer-events-none","space-y-4"),children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-2 text-muted-foreground",children:i("pptRender.solidThemes")}),e.jsxs("div",{className:"grid grid-cols-5 gap-1.5",children:[cr.map(h=>{var j,Y;return e.jsxs("button",{onClick:()=>{b(null),I("style",{...f.style,customPrimaryColor:void 0,customAccentColor:void 0,customBackgroundGradient:void 0}),p==null||p(h.id)},title:i(h.nameKey),className:U("p-1.5 rounded-lg border-2 transition-all flex flex-col items-center gap-1",n===h.id&&!g&&!((j=f.style)!=null&&j.customPrimaryColor)&&!((Y=f.style)!=null&&Y.customBackgroundGradient)?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx("div",{className:"w-5 h-5 rounded-full shrink-0 shadow-sm",style:{backgroundColor:h.color}}),e.jsx("span",{className:"text-[9px] font-medium truncate w-full text-center",children:i(h.nameKey)})]},h.id)}),e.jsxs("label",{title:i("pptRender.customSolid"),className:U("p-1.5 rounded-lg border-2 transition-all flex flex-col items-center gap-1 cursor-pointer","border-dashed border-border hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx("div",{className:"w-5 h-5 rounded-full shrink-0 shadow-sm bg-gradient-to-br from-red-500 via-green-500 to-blue-500 flex items-center justify-center",children:e.jsx("span",{className:"text-white text-[8px] font-bold",children:"+"})}),e.jsx("span",{className:"text-[9px] font-medium truncate w-full text-center",children:i("pptRender.customSolid")}),e.jsx("input",{type:"color",className:"sr-only",onChange:h=>{const j=h.target.value;b(null),I("style",{...f.style,customPrimaryColor:j,customAccentColor:j,customBackgroundGradient:void 0}),p==null||p("minimalist")}})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-2 text-muted-foreground",children:i("pptRender.gradientThemes")}),e.jsxs("div",{className:"grid grid-cols-4 gap-1.5",children:[pr.map(h=>{var j,Y;return e.jsxs("button",{onClick:()=>{b(null),I("style",{...f.style,customPrimaryColor:void 0,customAccentColor:void 0,customBackgroun
2196dGradient:void 0}),p==null||p(h.id)},title:i(h.nameKey),className:U("p-1.5 rounded-lg border-2 transition-all flex flex-col items-center gap-1",n===h.id&&!g&&!((j=f.style)!=null&&j.customPrimaryColor)&&!((Y=f.style)!=null&&Y.customBackgroundGradient)?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx("div",{className:"w-full h-5 rounded shrink-0 shadow-sm",style:{background:`linear-gradient(135deg, ${h.colors.join(", ")})`}}),e.jsx("span",{className:"text-[9px] font-medium truncate w-full text-center",children:i(h.nameKey)})]},h.id)}),_s.gradients.map((h,j)=>{var W,me;const Y=((me=(W=f.style)==null?void 0:W.customBackgroundGradient)==null?void 0:me.join(","))===h.colors.join(",");return e.jsxs("button",{onClick:()=>{b(Te=>({...Te,gradient:h.colors})),I("style",{...f.style,customBackgroundGradient:h.colors})},title:i(h.nameKey),className:U("p-1.5 rounded-lg border-2 transition-all flex flex-col items-center gap-1",Y?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-muted/50"),children:[e.jsx("div",{className:"w-full h-5 rounded shrink-0 shadow-sm",style:{background:`linear-gradient(135deg, ${h.colors.join(", ")})`}}
2196),e.jsx("span",{className:"text-[9px] font-medium truncate w-full text-center",children:i(h.nameKey)})]},`gradient-${j}`)})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptRender.customGradientLabel")}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"color",value:((Mt=(wt=f.style)==null?void 0:wt.customBackgroundGradient)==null?void 0:Mt[0])||"#667eea",className:"w-6 h-6 rounded cursor-pointer border border-border",title:i("pptRender.gradientStart"),onChange:h=>{var me,Te;const j=h.target.value,Y=((Te=(me=f.style)==null?void 0:me.customBackgroundGradient)==null?void 0:Te[1])||"#764ba2",W=[j,Y];b(ke=>({...ke,gradient:W})),I("style",{...f.style,customBackgroundGradient:W})}}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"â"}),e.jsx("input",{type:"color",value:((Nt=(jt=f.style)==null?void 0:jt.customBackgroundGradient)==null?void 0:Nt[1])||"#764ba2",className:"w-6 h-6 rounded cursor-pointer border border-border",title:i("pptRender.gradientEnd"),onChange:h=>{var me,Te;const j=((Te=(me=f.style)==null?void 0:me.customBackgroundGradient)==null?void 0:Te[0])||"#667eea",Y=h.target.value,W=[j,Y];b(ke=>({...ke,gradient:W})),I("style",{...f.style,customBackgroundGradient:W})}})]}),e.jsx("div",{className:"flex-1 h-4 rounded shadow-sm border border-border",style:{background:(ls=f.style)!=null&&ls.customBackgroundGradient?`linear-gradient(135deg, ${f.style.customBackgroundGradient.join(", ")})`:"linear-gradient(135deg, #667eea, #764ba2)"}})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-2 text-muted-foreground",children:i("pptRender.primaryColor")}),e.jsxs("div",{className:"flex flex-wrap gap-1 items-center",children:[_s.primary.map((h,j)=>{var W;const Y=((W=f.style)==null?void 0:W.customPrimaryColor)===h;return e.jsx("button",{onClick:()=>{b(me=>({...me,primary:h})),I("style",{...f.style,customPrimaryColor:h,customAccentColor:h})},title:h,className:U("w-5 h-5 rounded-full border-2 hover:scale-110 transition-transform shadow-sm",Y?"border-primary ring-2 ring-primary/50":"border-border"),style:{backgroundColor:h}},`color-${j}`)}),e.jsxs("label",{title:i("pptRender.customColorLabel"),className:"w-5 h-5 rounded-full border-2 border-dashed border-border hover:scale-110 transition-transform cursor-pointer bg-gradient-to-br from-red-500 via-green-500 to-blue-500 flex items-center justify-center",children:[e.jsx("span",{className:"text-white text-[8px] font-bold",children:"+"}),e.jsx("input",{type:"color",className:"sr-only",defaultValue:((as=f.style)==null?void 0:as.customPrimaryColor)||"#2563eb",onChange:h=>{const j=h.target.value;b(Y=>({...Y,primary:j})),I("style",{...f.style,customPrimaryColor:j,customAccentColor:j})}})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("button",{onClick:()=>{b(null),I("style",{...f.style,customPrimaryColor:void 0,customAccentColor:void 0,customBackgroundGradient:void 0})},className:"text-[10px] text-muted-foreground hover:text-primary",children:i("pptRender.resetToDefault")}),((os=f.style)==null?void 0:os.customPrimaryColor)&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[i("pptRender.currentColorLabel")," ",e.jsx("span",{style:{color:f.style.customPrimaryColor},children:f.style.customPrimaryColor})]})]})]})]}),e.jsxs("div",{className:U(B==="preserve"&&R&&"hidden"),children:[e.jsxs("label",{className:"block text-xs font-medium mb-2 text-muted-foreground",children:[i("pptRender.themePreview")," ",g&&e.jsx("span",{className:"text-primary",children:i("pptRender.themeCustomIndicator")})]}),e.jsxs("div",{className:"p-4 rounded-lg border border-border overflow-hidden",style:{...C.backgroundColor.includes("gradient")?{background:C.backgroundColor}:{backgroundColor:C.backgroundColor}},children:[e.jsx("div",{className:"text-sm font-bold mb-1",style:{color:C.primaryColor},children:i("pptRender.titleText")}),e.jsx("div",{className:"text-xs mb-2",style:{color:C.textColor},children:i("pptRender.bodyContent")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:C.accentColor}}),e.jsx("span",{className:"text-xs",style:{color:C.textColor},children:i("pptRender.bulletExample")})]})]})]}),e.jsxs("div",{className:U(B==="preserve"&&R&&"opacity-50 pointer-events-none","space-y-4 border-t border-border pt-4"),children:[e.jsx("div",{className:"text-xs font-medium text-foreground",children:i("pptRender.styleSettings")}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.titleSize")}),e.jsx(ut,{value:((ds=f.style)==null?void 0:ds.titleFontSize)||it.titleFontSize,onChange:h=>I("style",{...f.style,titleFontSize:h}),options:[{value:"small",label:i("pptRender.fontSizeSmall")},{value:"medium",label:i("pptRender.fontSizeMedium")},{value:"large",label:i("pptRender.fontSizeLarge")},{value:"xlarge",label:i("pptRender.fontSizeXLarge")}],className:"w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.bodySize")}),e.jsx(ut,{value:((cs=f.style)==null?void 0:cs.bodyFontSize)||it.bodyFontSize,onChange:h=>I("style",{...f.style,bodyFontSize:h}),options:[{value:"small",label:i("pptRender.fontSizeSmall")},{value:"medium",label:i("pptRender.fontSizeMedium")},{value:"large",label:i("pptRender.fontSizeLarge")}],className:"w-full"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.textAlign")}),e.jsx("div",{className:"flex gap-1",children:["left","center","right"].map(h=>{var j;return e.jsx("button",{onClick:()=>I("style",{...f.style,textAlign:h}),className:U("flex-1 p-1.5 rounded border text-xs",(((j=f.style)==null?void 0:j.textAlign)||it.textAlign)===h?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:i(h==="left"?"pptRender.textAlignLeft":h==="center"?"pptRender.textAlignCenter":"pptRender.textAlignRight")},h)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.titleWeight")}),e.jsx(ut,{value:((ps=f.style)==null?void 0:ps.titleWeight)||it.titleWeight,onChange:h=>I("style",{...f.style,titleWeight:h}),options:[{value:"normal",label:i("pptRender.weightNormal")},{value:"medium",label:i("pptRender.weightMedium")},{value:"semibold",label:i("pptRender.weightSemibold")},{value:"bold",label:i("pptRender.weightBold")}],className:"w-full"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.bulletStyle")}),e.jsx("div",{className:"grid grid-cols-6 gap-1",children:[{id:"disc",label:"â"},{id:"circle",label:"â"},{id:"square",label:"â "},{id:"check",label:"â"},{id:"arrow",label:"â"},{id:"number",label:"1."}].map(h=>{var j;return e.jsx("button",{onClick:()=>I("style",{...f.style,bulletStyle:h.id}),className:U("p-2 rounded border text-xs flex items-center justify-center",(((j=f.style)==null?void 0:j.bulletStyle)||it.bulletStyle)===h.id?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:h.label},h.id)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.backgroundEffect")}
2196),e.jsx("div",{className:"grid grid-cols-5 gap-1",children:[{id:"none",labelKey:"pptRender.bgEffectNone"},{id:"gradient",labelKey:"pptRender.bgEffectGradient"},{id:"pattern-dots",labelKey:"pptRender.bgEffectDots"},{id:"pattern-grid",labelKey:"pptRender.bgEffectGrid"},{id:"pattern-waves",labelKey:"pptRender.bgEffectWaves"}].map(h=>{var j;return e.jsx("button",{onClick:()=>I("style",{...f.style,backgroundEffect:h.id}),className:U("p-1.5 rounded border text-[10px]",(((j=f.style)==null?void 0:j.backgroundEffect)||it.backgroundEffect)===h.id?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:i(h.labelKey)},h.id)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.animationEffect")}),e.jsx("div",{className:"grid grid-cols-5 gap-1",children:[{id:"none",labelKey:"pptRender.animNone"},{id:"fade",labelKey:"pptRender.animFade"},{id:"slide-up",labelKey:"pptRender.animSlideUp"},{id:"slide-left",labelKey:"pptRender.animSlideLeft"},{id:"zoom",labelKey:"pptRender.animZoom"}].map(h=>{var j;return e.jsx("button",{onClick:()=>I("style",{...f.style,animation:h.id}),className:U("p-1.5 rounded border text-[10px]",(((j=f.style)==null?void 0:j.animation)||it.animation)===h.id?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:i(h.labelKey)},h.id)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] font-medium mb-1.5 text-muted-foreground",children:i("pptRender.cardStyle")}),e.jsx("div",{className:"grid grid-cols-4 gap-1",children:[{id:"none",labelKey:"pptRender.cardNone"},{id:"shadow",labelKey:"pptRender.cardShadow"},{id:"border",labelKey:"pptRender.cardBorder"},{id:"glass",labelKey:"pptRender.cardGlass"}].map(h=>{var j;return e.jsx("button",{onClick:()=>I("style",{...f.style,cardStyle:h.id}),className:U("p-1.5 rounded border text-[10px]",(((j=f.style)==null?void 0:j.cardStyle)||it.cardStyle)===h.id?"border-primary bg-primary/10 text-primary":"border-border hover:border-primary/50"),children:i(h.labelKey)},h.id)})})]})]})]}),m==="notes"&&e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium mb-1.5 text-muted-foreground",children:i("pptRender.speakerNotes")}),e.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:i("pptRender.speakerNotesDesc")}),e.jsx("textarea",{value:f.notes,onChange:h=>I("notes",h.target.value),rows:12,className:"w-full px-3 py-2 text-sm rounded-lg border border-border bg-background text-foreground focus:ring-2 focus:ring-primary focus:border-primary outline-none resize-none transition-colors",placeholder:i("pptRender.addNotes"),maxLength:2e3})]}),e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 border border-border",children:[e.jsx("div",{className:"text-xs font-medium text-foreground mb-2",children:i("pptRender.notesTips")}),e.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsx("li",{children:i("pptRender.notesTip1")}),e.jsx("li",{children:i("pptRender.notesTip2")}),e.jsx("li",{children:i("pptRender.notesTip3")}),e.jsx("li",{children:i("pptRender.notesTip4")})]})]})]})]}),e.jsxs("div",{className:"w-1/2 flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border bg-background flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:i("pptRender.livePreview")}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptRender.ctrlSToSave")})]}),e.jsx("div",{className:"flex-1 p-4 overflow-hidden flex items-center justify-center",children:e.jsx("div",{className:"w-full max-h-full rounded-lg shadow-lg overflow-hidden",style:{aspectRatio:"16/9",maxWidth:"100%",backgroundColor:s.backgroundColor.includes("gradient")?"#1a1a2e":s.backgroundColor},children:e.jsx(Li,{html:de,theme:s})})})]})]})]})}function Li({html:t,theme:s}){const n=is(t),r=u.useMemo(()=>{const l=` 2197<script> 2198(function() { 2199 function applyScale() { 2200 var body = document.body; 2201 if (!body) return; 2202 2203 // æ¥æ¾å¹»ç¯çå ç´ 2204 var slide = document.querySelector('.slide') || body.firstElementChild || body; 2205 2206 // ä»å ç´ è·åå®é 尺寸 2207 var computedStyle = window.getComputedStyle(slide); 2208 var slideWidth = parseInt(slide.style.width) || parseInt(computedStyle.width) || 1200; 2209 var slideHeight = parseInt(slide.style.height) || parseInt(computedStyle.height) || 675; 2210
2211 // å¦æå°ºå¯¸å¤ªå°ï¼ä½¿ç¨é»è®¤å¼ 2212 if (slideWidth < 100) slideWidth = 1200; 2213 if (slideHeight < 100) slideHeight = 675; 2214 2215 var viewWidth = window.innerWidth || document.documentElement.clientWidth; 2216 var viewHeight = window.innerHeight || document.documentElement.clientHeight; 2217 var scale = Math.min(viewWidth / slideWidth, viewHeight / slideHeight); 2218 2219 var bodyStyle = window.getComputedStyle(body); 2220 var bg = bodyStyle.background || bodyStyle.backgroundColor; 2221 2222 body.style.transform = 'scale(' + scale + ')'; 2223 body.style.transformOrigin = 'top left'; 2224 body.style.width = slideWidth + 'px'; 2225 body.style.height = slideHeight + 'px'; 2226 body.style.overflow = 'hidden'; 2227 body.style.position = 'absolute'; 2228 body.style.top = '0'; 2229 body.style.left = '0'; 2230 2231 document.documentElement.style.background = bg; 2232 document.documentElement.style.width = '100%'; 2233 document.documentElement.style.height = '100%'; 2234 document.documentElement.style.overflow = 'hidden'; 2235 } 2236 if (document.readyState === 'complete') { 2237 applyScale(); 2238 } else { 2239 window.addEventListener('load', applyScale); 2240 } 2241 window.addEventListener('resize', applyScale); 2242})(); 2243<\/script>`;return t.includes("</body>")?t.replace("</body>",l+"</body>"):t+l},[t]);return e.jsx("iframe",{srcDoc:r,className:"w-full h-full border-0",title:"Template preview",tabIndex:-1,style:{backgroundColor:n?"transparent":s.backgroundColor}})}function zi({content:t,mode:s,onUpdate:n}){var ue;const{t:r}=ve(),[l,c]=u.useState(0),[o,d]=u.useState(!1),[a,p]=u.useState(!1),[i,m]=u.useState(!1),[x,g]=u.useState([]),b=u.useRef(null),C=u.useRef(null),[w,D]=u.useState(null),[R,B]=u.useState(null),Z=t.data,M=t,k=(Z==null?void 0:Z.slides)||(M==null?void 0:M.slides)||[],v=x.length>0?x:k,S=(Z==null?void 0:Z.themeName)||((ue=M==null?void 0:M.theme)==null?void 0:ue.name)||(M==null?void 0:M.themeName)||"modern",J=u.useRef(null),H=u.useRef(!1);u.useEffect(()=>{const X=t.id;X!==J.current?(J.current=X,H.current=!1,k.length>0?g([...k]):g([])):!H.current&&k.length>0&&g([...k])},[t.id,k]);const f=u.useCallback(X=>{H.current=!0,g(G=>{const de=G.length>0?G:[...k];if(de.length===0)return console.error("No slides available for update"),G;const ze=de.map((Se,We)=>We===l?X:Se);return n==null||n(ze),ze})},[l,n,k]),y=u.useCallback(()=>{m(!1)},[]),L=u.useCallback(()=>{m(!0),!document.fullscreenElement&&b.current&&(b.current.requestFullscreen(),d(!0),p(!1))},[]),[E,_]=u.useState(S),Q=E||S,$=t.templateInfo,K=u.useMemo(()=>$!=null&&$.colors?fn({style:$.style,colors:$.colors,name:$.name}):ns(Q),[$,Q]),F=u.useCallback(()=>{H.current=!0;const X={id:`slide-${Date.now()}`,index:v.length,layout:"content",title:r("pptRender.noTitle"),subtitle:"",bullets:[],status:"completed",content:""};g(G=>{const ze=[...G.length>0?G:[...k],X];return n==null||n(ze),ze}),c(v.length)},[v.length,k,n]),P=u.useCallback(()=>{v.length<=1||(H.current=!0,g(X=>{const de=(X.length>0?X:[...k]).filter((ze,Se)=>Se!==l);return de.forEach((ze,Se)=>{ze.index=Se}),n==null||n(de),de}),c(X=>Math.max(0,X-1)),m(!1))},[v.length,l,k,n]),A=u.useCallback(()=>{H.current=!0;const X=v[l],G={...X,id:`slide-${Date.now()}`,index:l+1,title:`${X.title}${r("pptRender.duplicateSuffix")}`};g(de=>{const Se=[...de.length>0?de:[...k]];return Se.splice(l+1,0,G),Se.forEach((We,De)=>{We.index=De}),n==null||n(Se),Se}),c(l+1)},[v,l,k,n]),T=u.useCallback((X,G)=>{X!==G&&(H.current=!0,g(de=>{const Se=[...de.length>0?de:[...k]],[We]=Se.splice(X,1);return Se.splice(G,0,We),Se.forEach((De,Ie)=>{De.index=Ie}),n==null||n(Se),Se}),l===X?c(G):X<l&&G>=l?c(de=>de-1):X>l&&G<=l&&c(de=>de+1))},[k,n,l]),I=u.useCallback(X=>G=>{D(X),G.dataTransfer.effectAllowed="move",G.dataTransfer.setData("text/plain",String(X)),setTimeout(()=>{G.target.classList.add("dragging")},0)},[]),V=u.useCallback(()=>{D(null),B(null)},[]),ie=u.useCallback(X=>G=>{G.preventDefault(),G.dataTransfer.dropEffect="move",w!==null&&w!==X&&B(X)},[w]),le=u.useCallback(()=>{B(null)},[]),be=u.useCallback(X=>G=>{G.preventDefault();const de=parseInt(G.dataTransfer.getData("text/plain"),10);!isNaN(de)&&de!==X&&T(de,X),D(null),B(null)},[T]),ae=u.useCallback(X=>{_(X),H.current=!0},[]),pe=u.useRef(v.length);u.useEffect(()=>{if(v.length>pe.current){const X=v.findIndex((G,de)=>G.status==="generating"||de===v.length-1&&G.status==="completed");X>=0&&c(Math.max(0,X))}pe.current=v.length},[v]),u.useEffect(()=>
2243{if(C.current){const X=C.current.querySelector(`[data-slide-index="${l}"]`);X&&X.scrollIntoView({behavior:"smooth",block:"nearest"})}},[l]);const te=u.useCallback(()=>{!document.fullscreenElement&&b.current?(b.current.requestFullscreen(),d(!0),p(!1)):document.exitFullscreen&&(document.exitFullscreen(),d(!1),p(!1),m(!1))},[]);u.useEffect(()=>{const X=()=>{document.fullscreenElement||(d(!1),m(!1))};return document.addEventListener("fullscreenchange",X),()=>document.removeEventListener("fullscreenchange",X)},[]),u.useEffect(()=>{const X=G=>{if(i){G.key==="Escape"&&(G.preventDefault(),m(!1));return}o&&(G.key==="ArrowRight"||G.key===" "?(G.preventDefault(),c(de=>Math.min(v.length-1,de+1))):G.key==="ArrowLeft"?(G.preventDefault(),c(de=>Math.max(0,de-1))):G.key==="ArrowUp"?(G.preventDefault(),c(de=>Math.max(0,de-1))):G.key==="ArrowDown"?(G.preventDefault(),c(de=>Math.min(v.length-1,de+1))):G.key==="Escape"?(d(!1),m(!1)):(G.key==="f"||G.key==="F")&&!G.ctrlKey&&!G.metaKey?te():(G.key==="e"||G.key==="E")&&L())};return window.addEventListener("keydown",X),()=>window.removeEventListener("keydown",X)},[v.length,o,i,te,L]),u.useEffect(()=>{if(!o)return;const X=setTimeout(()=>{var G;(G=b.current)==null||G.focus()},100);return()=>clearTimeout(X)},[o]);const ne=t.status,ee=t.currentStep,q=t.outline,O=t.progress,z=t.totalSlides,se=t.completedSlides,ce=z||v.length,fe=se??v.filter(X=>X.status==="completed").length,Ce=ce>0?Math.round(fe/ce*100):0,_e=v.some(X=>X.status==="generating")||ne==="generating",Fe=u.useCallback(()=>{var X;(X=b.current)==null||X.focus()},[]);if(v.length===0||ne==="outline"||ne==="initializing")return e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bt,{className:"w-5 h-5 text-primary"}),e.jsx("span",{className:"font-medium",children:t.title||r("pptRender.presentationLabel")})]}),ne&&e.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-primary/10 text-primary",children:r(ne==="outline"?"pptRender.statusOutlineLabel":ne==="initializing"?"pptRender.statusInitializingLabel":"pptRender.statusReadyLabel")})]}),e.jsx("div",{className:"flex-1",children:e.jsx(Ci,{status:ne,currentStep:ee,outline:q,progress:O,theme:K})})]});const Re=v[l];return e.jsxs("div",{ref:b,tabIndex:-1,className:U("h-full flex bg-background outline-none",o&&"fixed inset-0 z-50 bg-muted"),children:[e.jsxs("div",{className:U("border-r border-border bg-secondary/30 flex flex-col transition-all duration-300",a?"w-0 overflow-hidden":"w-56"),children:[e.jsxs("div",{className:"p-3 border-b border-border flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Bt,{className:"w-4 h-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:r("pptRender.slidesLabel")})]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[v.length,"/",ce]})]}),(_e||ne==="generating")&&e.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:r("pptRender.generationProgress")}),e.jsxs("span",{className:"text-primary",children:[O||Ce,"%"]})]}),e.jsx("div",{className:"h-1.5 bg-secondary rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${O||Ce}%`}})}),ee&&e.jsxs("div",{className:"mt-2 flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Ve,{className:"w-3 h-3 animate-spin text-primary"}),e.jsx("span",{className:"truncate",children:ee})]})]}),e.jsx("div",{ref:C,className:"flex-1 overflow-y-auto p-2 space-y-2",children:v.map((X,G)=>e.jsx("div",{"data-slide-index":G,children:e.jsx($i,{slide:X,index:G,isActive:G===l,theme:K,onClick:()=>c(G),isDragging:w===G,isDragOver:R===G,onDragStart:I(G),onDragEnd:V,onDragOver:ie(G),onDragLeave:le,onDrop:be(G),templateStyle:($==null?void 0:$.style)||"corporate",totalSlides:v.length})},X.id||G))})]}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:U("grid grid-cols-[auto_1fr_auto] items-center px-4 py-2 border-b gap-4",o?"bg-background/95 backdrop-blur-sm border-border text-foreground shadow-sm":"border-border bg-background"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>p(!a),className:U("p-2 rounded-lg transition-colors",o?"hover:bg-muted":"hover:bg-secondary"),title:r(a?"pptRender.expandSidebar":"pptRender.collapseSidebar"),children:a?e.jsx(ot,{className:"w-4 h-4"}):e.jsx($t,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>c(Math.max(0,l-1)),disabled:l===0,className:U("p-2 rounded-lg transition-colors",l===0?"text-muted-foreground cursor-not-allowed":o?"hover:bg-muted":"hover:bg-secondary"),title:r("pptRender.prevSlide"),children:e.jsx($t,{className:"w-4 h-4"})}),e.jsxs("span",{className:"text-sm font-medium min-w-[60px] text-center",children:[l+1," / ",v.length]}),e.jsx("button",{onClick:()=>c(Math.min(v.length-1,l+1)),disabled:l===v.length-1,className:U("p-2 rounded-lg transition-colors",l===v.length-1?"text-muted-foreground cursor-not-allowed":o?"hover:bg-muted":"hover:bg-secondary"),title:r("pptRender.nextSlide"),children:e.jsx(ot,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"flex justify-center min-w-0",children:e.jsx("span",{className:"text-sm font-medium truncate max-w-[300px] text-center",title:Re==null?void 0:Re.title,children:(Re==null?void 0:Re.title)||r("pptRender.noTitle")})}),e.jsxs("div",{className:"flex items-center gap-1",children:[!i&&e.jsx("button",{onClick:L,className:U("p-2 rounded-lg transition-colors",o?"text-white hover:text-white/80":"text-foreground hover:text-foreground
2243/70"),title:r("pptRender.editSlide"),children:e.jsx(ft,{className:"w-4 h-4"})}),!o&&e.jsx("button",{onClick:te,disabled:i,className:U("p-2 rounded-lg transition-colors",i?"text-foreground/30 cursor-not-allowed":"text-foreground hover:text-foreground/70"),title:r("preview.playPresentation"),children:e.jsx(Ct,{className:"w-4 h-4"})}),e.jsx("button",{onClick:te,className:U("p-2 rounded-lg transition-colors",o?"text-foreground hover:text-foreground":"text-foreground hover:text-foreground/70"),title:r(o?"preview.exitFullscreen":"preview.fullscreen"),children:o?e.jsx(Tr,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:U("flex-1 flex items-center justify-center overflow-hidden min-h-0",o?"p-0":"px-8 py-4"),children:i&&Re?e.jsx("div",{className:U("bg-background rounded-lg shadow-2xl overflow-hidden",o?"w-full h-full max-h-full":"w-full h-full max-w-5xl"),children:e.jsx(Di,{slide:Re,theme:K,themeName:Q,allSlides:v,onSave:f,onCancel:y,onAddSlide:F,onDeleteSlide:P,onDuplicateSlide:A,onThemeChange:ae},`editor-${l}-${Re.id||l}`)}):e.jsx("div",{onClick:Fe,className:U("rounded-lg shadow-2xl overflow-hidden transition-all cursor-pointer",o?"max-w-[1400px]":"w-full max-w-4xl"),style:{aspectRatio:"16/9",maxHeight:o?"85vh":"calc(100% - 0px)",width:o?"90vw":void 0,backgroundColor:"#ffffff"},children:Re&&e.jsx(Si,{slide:Re,theme:K,presentationTitle:t.title,templateStyle:($==null?void 0:$.style)||"corporate",totalSlides:v.length})})}),o&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-2 bg-background/90 backdrop-blur-sm px-4 py-2 rounded-full shadow-lg border border-border",children:v.map((X,G)=>e.jsx("button",{onClick:()=>{c(G),setTimeout(()=>{var de;return(de=b.current)==null?void 0:de.focus()},0)},className:U("w-2.5 h-2.5 rounded-full transition-all",G===l?"bg-primary scale-125":"bg-muted-foreground/30 hover:bg-muted-foreground/50"),title:X.title},X.id||G))})]})]})}const Kt={modern:{name:"modern",label:"Modern",labelZh:"ç°ä»£é£æ ¼",description:"Clean and contemporary with plenty of whitespace",primaryColor:"#2563eb",secondaryColor:"#64748b",backgroundColor:"#ffffff",textColor:"#1e293b",accentColor:"#3b82f6",fontFamily:"'Inter', 'Noto Sans SC', system-ui, sans-serif",headerBg:"linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%)",headerTextColor:"#ffffff",borderRadius:"8px",sectionTitleStyle:"underline"},classic:{name:"classic",label:"Classic",labelZh:"ç»å ¸é£æ ¼",description:"Traditional and formal, suitable for conservative industries",primaryColor:"#1e3a5f",secondaryColor:"#4a5568",backgroundColor:"#ffffff",textColor:"#2d3748",accentColor:"#2c5282",fontFamily:"'Georgia', 'Noto Serif SC', serif",headerBg:"#1e3a5f",headerTextColor:"#ffffff",borderRadius:"0",sectionTitleStyle:"simple"},minimalist:{name:"minimalist",label:"Minimalist",labelZh:"ç®çº¦é£æ ¼",description:"Ultra-clean with focus on content",primaryColor:"#000000",secondaryColor:"#6b7280",backgroundColor:"#ffffff",textColor:"#374151",accentColor:"#4b5563",fontFamily:"'Helvetica Neue', 'PingFang SC', system-ui, sans-serif",headerBg:"transparent",headerTextColor:"#000000",borderRadius:"0",sectionTitleStyle:"border-left"},creative:{name:"creative",label:"Creative",labelZh:"åæé£æ ¼",description:"Bold and unique for creative industries",primaryColor:"#ec4899",secondaryColor:"#8b5cf6",backgroundColor:"#fdf4ff",textColor:"#1f2937",accentColor:"#a855f7",fontFamily:"'Poppins', 'Noto Sans SC', system-ui, sans-serif",headerBg:"linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%)",headerTextColor:"#ffffff",borderRadius:"16px",sectionTitleStyle:"background"},tech:{name:"tech",label:"Tech",labelZh:"ææ¯é£æ ¼",description:"Dark theme with code aesthetic for tech roles",primaryColor:"#10b981",secondaryColor:"#6ee7b7",backgroundColor:"#0f172a",textColor:"#e2e8f0",accentColor:"#34d399",fontFamily:"'JetBrains Mono', 'Source Code Pro', monospace",headerBg:"linear-gradient(135deg, #0f172a 0%, #1e293b 100%)",headerTextColor:"#10b981",borderRadius:"4px",sectionTitleStyle:"border-left"},executive:{name:"executive",label:"Executive",labelZh:"é«ç®¡é£æ ¼",description:"Sophisticated and achievement-focused for senior roles",primaryColor:"#7c3aed",secondaryColor:"#a78bfa",backgroundColor:"#ffffff",textColor:"#1f2937",accentColor:"#8b5cf6",fontFamily:"'Playfair Display', 'Noto Serif SC', serif",headerBg:"#18181b",headerTextColor:"#ffffff",borderRadius:"0",sectionTitleStyle:"underline"},academic:{name:"academic",label:"Academic",labelZh:"妿¯é£æ ¼",description:"Detailed and formal for research and academic positions",primaryColor:"#0369a1",secondaryColor:"#0891b2",backgroundColor:"#f8fafc",textColor:"#1e293b",accentColor:"#0284c7",fontFamily:"'Times New Roman', 'Noto Serif SC', serif",headerBg:"#0369a1",headerTextColor:"#ffffff",borderRadius:"2px",sectionTitleStyle:"simple"}};function Ei(t){return Kt[t]||Kt.modern}function Fi(){return Object.keys(Kt)}function Pi(t){return` 2244 --resume-primary: ${t.primaryColor}; 2245 --resume-secondary: ${t.secondaryColor}; 2246 --resume-bg: ${t.backgroundColor}; 2247 --resume-text: ${t.textColor}; 2248 --resume-accent: ${t.accentColor}; 2249 --resume-font: ${t.fontFamily}; 2250 --resume-header-bg: ${t.headerBg}; 2251 --resume-header-text: ${t.headerTextColor}; 2252 --resume-radius: ${t.borderRadius}; 2253 `}function Ii(t,s){switch(t){case"underline":return` 2254 padding-bottom: 8px; 2255 border-bottom: 2px solid ${s.primaryColor}; 2256 `;case"background":return` 2257 background: ${s.primaryColor}15; 2258 padding: 8px 12px; 2259 border-radius: ${s.borderRadius}; 2260 `;case"border-left":return` 2261 padding-left: 12px; 2262 border-left: 3px solid ${s.primaryColor}; 2263 `;case"simple":default:return` 2264 border-bottom: 1px solid ${s.secondaryColor}40; 2265 padding-bottom: 4px; 2266 `}}const Os={modern:{headerLayout:"centered",showAvatar:!1,sectionSpacing:"normal",bulletStyle:"disc",datePosition:"right",skillsLayout:"tags"},classic:{headerLayout:"centered",showAvatar:!1,sectionSpacing:"normal",bulletStyle:"disc",datePosition:"right",skillsLayout:"list"},minimalist:{headerLayout:"left-aligned",showAvatar:!1,sectionSpacing:"spacious",bulletStyle:"dash",datePosition:"inline",skillsLayout:"grouped"},creative:{headerLayout:"two-column",showAvatar:!0,sectionSpacing:"normal",bulletStyle:"arrow",datePosition:"below",skillsLayout:"bars"},tech:{headerLayout:"left-aligned",showAvatar:!1,sectionSpacing:"compact",bulletStyle:"square",datePosition:"inline",skillsLayout:"tags"},executive:{headerLayout:"centered",showAvatar:!1,sectionSpacing:"spacious",bulletStyle:"disc",datePosition:"right",skillsLayout:"grouped"},academic:{headerLayout:"left-aligned",showAvatar:!1,sectionSpacing:"compact",bulletStyle:"disc",datePosition:"right",skillsLayout:"list"}};function Ai(t){return Os[t]||Os.modern}function Mi(t,s){const n={compact:"16px",normal:"24px",spacious:"32px"}
2266[s.sectionSpacing],r={disc:'"\\2022"',circle:'"\\25E6"',square:'"\\25AA"',dash:'"\\2014"',arrow:'"\\2192"'}[s.bulletStyle];return` 2267.resume-container { 2268 ${Pi(t)} 2269 font-family: var(--resume-font); 2270 background: var(--resume-bg); 2271 color: var(--resume-text); 2272 max-width: 800px; 2273 margin: 0 auto; 2274 padding: 40px; 2275 line-height: 1.6; 2276} 2277 2278/* Header styles */ 2279.resume-header { 2280 background: var(--resume-header-bg); 2281 color: var(--resume-header-text); 2282 padding: 30px; 2283 margin: -40px -40px 30px -40px; 2284 border-radius: var(--resume-radius) var(--resume-radius) 0 0; 2285 ${s.headerLayout==="centered"?"text-align: center;":""} 2286 ${s.headerLayout==="two-column"?"display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center;":""} 2287} 2288 2289.resume-name { 2290 font-size: 28px; 2291 font-weight: 700; 2292 margin: 0 0 8px 0; 2293 letter-spacing: -0.5px; 2294} 2295 2296.resume-title { 2297 font-size: 16px; 2298 font-weight: 400; 2299 margin: 0; 2300 opacity: 0.9; 2301} 2302 2303.contact-info { 2304 display: flex; 2305 ${s.headerLayout==="centered"?"justify-content: center;":""} 2306 flex-wrap: wrap; 2307 gap: 16px; 2308 margin-top: 16px; 2309 font-size: 14px; 2310} 2311 2312/* Section styles */ 2313.resume-section { 2314 margin-bottom: ${n}; 2315} 2316 2317.section-title { 2318 font-size: 14px; 2319 font-weight: 700; 2320 color: var(--resume-primary); 2321 text-transform: uppercase; 2322 letter-spacing: 1px; 2323 margin: 0 0 16px 0; 2324 ${Ii(t.sectionTitleStyle,t)} 2325} 2326 2327/* Entry styles */ 2328.entry-item { 2329 margin-bottom: 16px; 2330 padding-bottom: 16px; 2331 border-bottom: 1px solid ${t.secondaryColor}20; 2332} 2333 2334.entry-item:last-child { 2335 border-bottom: none; 2336 margin-bottom: 0; 2337 padding-bottom: 0; 2338} 2339 2340.entry-header { 2341 display: flex; 2342 ${s.datePosition==="right"?"justify-content: space-between;":"flex-direction: column;"} 2343 align-items: ${s.datePosition==="right","flex-start"}; 2344 margin-bottom: 8px; 2345} 2346 2347.entry-main { 2348 flex: 1; 2349} 2350 2351.entry-company, 2352.entry-school { 2353 font-size: 16px; 2354 font-weight: 600; 2355 color: var(--resume-text); 2356 margin: 0; 2357} 2358 2359.entry-position, 2360.entry-degree { 2361 font-size: 14px; 2362 color: var(--resume-secondary); 2363} 2364 2365.entry-date { 2366 font-size: 13px; 2367 color: var(--resume-secondary); 2368 ${s.datePosition==="inline"?"margin-left: 8px;":""} 2369 ${s.datePosition==="below"?"margin-top: 4px;":""} 2370} 2371 2372/* Highlights */ 2373.highlights { 2374 margin: 12px 0; 2375 padding-left: 20px; 2376 list-style: none; 2377} 2378 2379.highlights li { 2380 font-size: 14px; 2381 margin-bottom: 6px; 2382 position: relative; 2383 padding-left: 16px; 2384} 2385 2386.highlights li::before { 2387 content: ${r}; 2388 position: absolute; 2389 left: 0; 2390 color: var(--resume-primary); 2391} 2392 2393/* Skills */ 2394.skills-container { 2395 ${s.skillsLayout==="tags"?"display: flex; flex-wrap: wrap; gap: 8px;":""} 2396 ${s.skillsLayout==="bars"?"display: grid; gap: 12px;":""} 2397 ${s.skillsLayout==="grouped"?"display: grid; gap: 16px;":""} 2398} 2399 2400.skill-tag { 2401 font-size: 13px; 2402 padding: 6px 12px; 2403 background: ${t.primaryColor}10; 2404 color: var(--resume-primary); 2405 border-radius: var(--resume-radius); 2406 font-weight: 500; 2407} 2408 2409.skill-tag[data-level="expert"] { 2410 background: var(--resume-primary); 2411 color: white; 2412} 2413 2414.skill-tag[data-level="advanced"] { 2415 background: ${t.primaryColor}30; 2416} 2417 2418.skill-bar { 2419 display: flex; 2420 align-items: center; 2421 gap: 12px; 2422} 2423 2424.skill-bar-name { 2425 flex: 0 0 120px; 2426 font-size: 14px; 2427} 2428 2429.skill-bar-track { 2430 flex: 1; 2431 height: 8px; 2432 background: ${t.secondaryColor}20; 2433 border-radius: 4px; 2434 overflow: hidden; 2435} 2436 2437.skill-bar-fill { 2438 height: 100%; 2439 background: var(--resume-primary); 2440 border-radius: 4px; 2441} 2442 2443.skill-category { 2444 margin-bottom: 12px; 2445} 2446 2447.skill-category-name { 2448 font-size: 14px; 2449 font-weight: 600; 2450 color: var(--resume-text); 2451 margin: 0 0 8px 0; 2452} 2453 2454/* Technologies */ 2455.tech-tags { 2456 display: flex; 2457 flex-wrap: wrap; 2458 gap: 6px; 2459 margin-top: 8px; 2460} 2461 2462.tech-tag { 2463 font-size: 12px; 2464 padding: 4px 8px; 2465 background: ${t.primaryColor}10; 2466 color: var(--resume-primary); 2467 border-radius: 4px; 2468} 2469 2470/* Print styles */ 2471@media print { 2472 .resume-container { 2473 padding: 20px; 2474 max-width: 100%; 2475 } 2476 2477 .resume-header { 2478 margin: -20px -20px 20px -20px; 2479 print-color-adjust: exact; 2480 -webkit-print-color-adjust: exact; 2481 } 2482 2483 .resume-section { 2484 page-break-inside: avoid; 2485 } 2486} 2487 2488/* Responsive */ 2489@media (max-width: 600px) { 2490 .resume-container { 2491 padding: 20px; 2492 } 2493 2494 .resume-header { 2495 margin: -20px -20px 20px -20px; 2496 padding: 20px; 2497 } 2498 2499 .resume-name { 2500 font-size: 24px; 2501 } 2502 2503 .entry-header { 2504 flex-direction: column; 2505 } 2506 2507 .entry-date { 2508 margin-left: 0; 2509 margin-top: 4px; 2510 } 2511} 2512`}function _i({data:t,onChange:s,onSave:n}){const{t:r}=ve(),[l,c]=u.useState("personal"),[o,d]=u.useState(null),a=u.useCallback((k,v)=>{s({...t,personal:{...t.personal,[k]:v}})},[t,s]),p=u.useCallback((k,v,S)=>{const J=[...t.experience];J[k]={...J[k],[v]:S},s({...t,experience:J})},[t,s]),i=u.useCallback(k=>{const v=[...t.experience];v[k].highlights.push(""),s({...t,experience:v})},[t,s]),m=u.useCallback((k,v,S)=>{const J=[...t.experience];J[k].highlights[v]=S,s({...t,experience:J})},[t,s]),x=u.useCallback((k,v)=>{const S=[...t.experience];S[k].highlights.splice(v,1),s({...t,experience:S})},[t,s]),g=u.useCallback(()=>{const k={id:`exp-${Date.now()}`,company:"",position:"",startDate:"",highlights:[]};s({...t,experience:[...t.experience,k]})},[t,s]),b=u.useCallback(k=>{const v=[...t.experience];v.splice(k,1),s({...t,experience:v})},[t,s]),C=u.useCallback((k,v)=>{d({section:k,index:v})},[]),w=u.useCallback(k=>{k.preventDefault()},[]),D=u.useCallback((k,v)=>{if(!o||o.section!==k)return;const S=o.index;if(S!==v){if(k==="experience"){const J=[...t.experience],[H]=J.splice(S,1);J.splice(v,0,H),s({...t,experience:J})}d(null)}},[o,t,s]),R=u.useCallback((k,v,S)=>{const J=[...t.skills];v==="category"&&(J[k].category=S),s({...t,skills:J})},[t,s]),B=u.useCallback((k,v)=>{const S=[...t.skills];S[k].skills.push({name:v,level:"intermediate"}),s({...t,skills:S})},[t,s]),Z=u.useCallback((k,v)=>{const S=[...t.skills];S[k].skills.splice(v,1),s({...t,skills:S})},[t,s]),M=u.useCallback(()=>{const k={category:r("resume.newCategory"),skills:[]};s({...t,skills:[...t.skills,k]})},[t,s,r]);return e.jsxs("div",{className:"resume-editor",children:[e.jsx("div",{className:"editor-nav",children:["personal","experience","education","skills","projects"].map(k=>e.jsxs("button",{className:`nav-btn ${l===k?"active":""}`,onClick:()=>c(k),children:[k==="personal"&&r("resume.navPersonal"),k==="experience"&&r("resume.navExperience"),k==="education"&&r("resume.navEducation"),k==="skills"&&r("resume.navSkills"),k==="projects"&&r("resume.navProjects")]},k))}),e.jsxs("div",{className:"editor-content",children:[l==="personal"&&e.jsxs("div",{className:"section-editor personal-editor",children:[e.jsx("h3",{children:r("resume.personalInfo")}),e.jsxs("div",{className:"form-grid",children:[e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{children:[r("resume.name")," *"]}),e.jsx("input",{type:"text",value:t.personal.name,onChange:k=>a("name",k.target.value),placeholder:r("resume.namePlaceholder"),maxLength:200})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:r("resume.title")}),e.jsx("input",{type:"text",value:t.personal.title||"",onChange:k=>a("title",k.target.value),placeholder:r("resume.titlePlaceholder"),maxLength:200})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{children:[r("resume.email")," *"]}),e.jsx("input",{type:"email",value:t.personal.email,onChange:k=>a("email",k.target.value),placeholder:"[email protected]",maxLength:200})]}),e.jsxs("div",{className:"form-group",children:[e.jsxs("label",{children:[r("resume.phone")," *"]}),e.jsx("input",{type:"tel",value:t.personal.phone,onChange:k=>a("phone",k.target.value),placeholder:"+86 138 0000 0000",maxLength:200})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:r("resume.location")}),e.jsx("input",{type:"text",value:t.personal.location||"",onChange:k=>a("location",k.target.value),placeholder:r("resume.locationPlaceholder"),maxLength:200})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"LinkedIn"}),e.jsx("input",{type:"text",value:t.personal.linkedin||"",onChange:k=>a("linkedin",k.target.value),placeholder:"linkedin.com/in/username",maxLength:500})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:"GitHub"}),e.jsx("input",{type:"text",value:t.personal.github||"",onChange:k=>a("github",k.target.value),placeholder:"github.com/username",maxLength:500})]}),e.jsxs("div",{className:"form-group full-width",children:[e.jsx("label",{children:r("resume.summary")}
2512),e.jsx("textarea",{value:t.personal.summary||"",onChange:k=>a("summary",k.target.value),placeholder:r("resume.summaryPlaceholder"),rows:4,maxLength:2e3})]})]})]}),l==="experience"&&e.jsxs("div",{className:"section-editor experience-editor",children:[e.jsxs("div",{className:"section-header",children:[e.jsx("h3",{children:r("resume.workExperience")}),e.jsxs("button",{className:"btn-add",onClick:g,children:["+ ",r("resume.addExperience")]})]}),e.jsx("div",{className:"experience-list",children:t.experience.map((k,v)=>e.jsxs("div",{className:"experience-card",draggable:!0,onDragStart:()=>C("experience",v),onDragOver:w,onDrop:()=>D("experience",v),children:[e.jsxs("div",{className:"card-header",children:[e.jsx("span",{className:"drag-handle",children:"â®â®"}),e.jsxs("span",{className:"card-number",children:["#",v+1]}),e.jsx("button",{className:"btn-remove",onClick:()=>b(v),children:"Ã"})]}),e.jsxs("div",{className:"form-grid",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:r("resume.company")}),e.jsx("input",{type:"text",value:k.company,onChange:S=>p(v,"company",S.target.value),maxLength:200})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:r("resume.position")}),e.jsx("input",{type:"text",value:k.position,onChange:S=>p(v,"position",S.target.value),maxLength:200})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:r("resume.startDate")}),e.jsx("input",{type:"month",value:k.startDate,onChange:S=>p(v,"startDate",S.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:r("resume.endDate")}),e.jsxs("div",{className:"date-input-group",children:[e.jsx("input",{type:"month",value:k.endDate||"",onChange:S=>p(v,"endDate",S.target.value),disabled:k.current}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:k.current||!1,onChange:S=>p(v,"current",S.target.checked)}),r("resume.current")]})]})]}),e.jsxs("div",{className:"form-group full-width",children:[e.jsx("label",{children:r("resume.description")}),e.jsx("textarea",{value:k.description||"",onChange:S=>p(v,"description",S.target.value),rows:2,maxLength:2e3})]})]}),e.jsxs("div",{className:"highlights-section",children:[e.jsxs("div",{className:"highlights-header",children:[e.jsx("label",{children:r("resume.highlights")}),e.jsx("button",{className:"btn-add-small",onClick:()=>i(v),children:"+"})]}),k.highlights.map((S,J)=>e.jsxs("div",{className:"highlight-item",children:[e.jsx("input",{type:"text",value:S,onChange:H=>m(v,J,H.target.value),placeholder:r("resume.highlightPlaceholder"),maxLength:200}),e.jsx("button",{className:"btn-remove-small",onClick:()=>x(v,J),children:"Ã"})]},J))]})]},k.id))})]}),l==="skills"&&e.jsxs("div",{className:"section-editor skills-editor",children:[e.jsxs("div",{className:"section-header",children:[e.jsx("h3",{children:r("resume.skills")}),e.jsxs("button",{className:"btn-add",onClick:M,children:["+ ",r("resume.addCategory")]})]}),e.jsx("div",{className:"skills-categories",children:t.skills.map((k,v)=>e.jsxs("div",{className:"skill-category-card",children:[e.jsx("div",{className:"category-header",children:e.jsx("input",{type:"text",className:"category-name-input",value:k.category,onChange:S=>R(v,"category",S.target.value),maxLength:200})}),e.jsxs("div",{className:"skills-tags",children:[k.skills.map((S,J)=>e.jsxs("span",{className:"skill-edit-tag",children:[S.name,e.jsx("button",{className:"tag-remove",onClick:()=>Z(v,J),children:"Ã"})]},J)),e.jsx("input",{type:"text",className:"skill-add-input",placeholder:r("resume.addSkillPlaceholder"),maxLength:200,onKeyDown:S=>{S.key==="Enter"&&!S.nativeEvent.isComposing&&S.currentTarget.value&&(B(v,S.currentTarget.value),S.currentTarget.value="")}})]})]},v))})]}),l==="education"&&e.jsxs("div",{className:"section-editor",children:[e.jsx("h3",{children:r("resume.education")}),e.jsx("p",{className:"placeholder-text",children:r("resume.educationComingSoon")})]}),l==="projects"&&e.jsxs("div",{className:"section-editor",children:[e.jsx("h3",{children:r("resume.projects")}),e.jsx("p",{className:"placeholder-text",children:r("resume.projectsComingSoon")})]})]}),n&&e.jsx("div",{className:"editor-footer",children:e.jsx("button",{className:"btn-save",onClick:n,children:r("resume.saveChanges")}
2512)}),e.jsx("style",{children:` 2513 .resume-editor { 2514 display: flex; 2515 flex-direction: column; 2516 height: 100%; 2517 background: #f8fafc; 2518 } 2519 2520 .editor-nav { 2521 display: flex; 2522 gap: 4px; 2523 padding: 12px 16px; 2524 background: white; 2525 border-bottom: 1px solid #e5e7eb; 2526 overflow-x: auto; 2527 } 2528 2529 .nav-btn { 2530 padding: 8px 16px; 2531 border: none; 2532 background: transparent; 2533 color: #64748b; 2534 font-size: 14px; 2535 cursor: pointer; 2536 border-radius: 6px; 2537 white-space: nowrap; 2538 transition: all 0.2s; 2539 } 2540 2541 .nav-btn:hover { 2542 background: #f1f5f9; 2543 } 2544 2545 .nav-btn.active { 2546 background: #2563eb; 2547 color: white; 2548 } 2549 2550 .editor-content { 2551 flex: 1; 2552 overflow-y: auto; 2553 padding: 20px; 2554 } 2555 2556 .section-editor { 2557 background: white; 2558 border-radius: 12px; 2559 padding: 24px; 2560 } 2561 2562 .section-editor h3 { 2563 font-size: 18px; 2564 margin: 0 0 20px 0; 2565 color: #1e293b; 2566 } 2567 2568 .section-header { 2569 display: flex; 2570 justify-content: space-between; 2571 align-items: center; 2572 margin-bottom: 20px; 2573 } 2574 2575 .section-header h3 { 2576 margin: 0; 2577 } 2578 2579 .form-grid { 2580 display: grid; 2581 grid-template-columns: 1fr 1fr; 2582 gap: 16px; 2583 } 2584 2585 .form-group { 2586 display: flex; 2587 flex-direction: column; 2588 gap: 6px; 2589 } 2590 2591 .form-group.full-width { 2592 grid-column: 1 / -1; 2593 } 2594 2595 .form-group label { 2596 font-size: 13px; 2597 font-weight: 500; 2598 color: #64748b; 2599 } 2600 2601 .form-group input, 2602 .form-group textarea { 2603 padding: 10px 12px; 2604 border: 1px solid #e5e7eb; 2605 border-radius: 8px; 2606 font-size: 14px; 2607 transition: border-color 0.2s; 2608 } 2609 2610 .form-group input:focus, 2611 .form-group textarea:focus { 2612 outline: none; 2613 border-color: #2563eb; 2614 } 2615 2616 .form-group textarea { 2617 resize: vertical; 2618 min-height: 80px; 2619 } 2620 2621 .btn-add { 2622 padding: 8px 16px; 2623 background: #2563eb; 2624 color: white; 2625 border: none; 2626 border-radius: 8px; 2627 font-size: 14px; 2628 cursor: pointer; 2629 transition: background 0.2s; 2630 } 2631 2632 .btn-add:hover { 2633 background: #1d4ed8; 2634 } 2635 2636 .experience-list { 2637 display: flex; 2638 flex-direction: column; 2639 gap: 16px; 2640 } 2641 2642 .experience-card { 2643 background: #f8fafc; 2644 border: 1px solid #e5e7eb; 2645 border-radius: 12px; 2646 padding: 20px; 2647 cursor: move; 2648 } 2649 2650 .experience-card:hover { 2651 border-color: #cbd5e1; 2652 } 2653 2654 .card-header { 2655 display: flex; 2656 align-items: center; 2657 gap: 8px; 2658 margin-bottom: 16px; 2659 } 2660 2661 .drag-handle { 2662 color: #94a3b8; 2663 cursor: move; 2664 } 2665 2666 .card-number { 2667 font-size: 13px; 2668 font-weight: 600; 2669 color: #64748b; 2670 flex: 1; 2671 } 2672 2673 .btn-remove { 2674 width: 24px; 2675 height: 24px; 2676 border: none; 2677 background: #fee2e2; 2678 color: #dc2626; 2679 border-radius: 6px; 2680 cursor: pointer; 2681 font-size: 16px; 2682 display: flex; 2683 align-items: center; 2684 justify-content: center; 2685 } 2686 2687 .btn-remove:hover { 2688 background: #fecaca; 2689 } 2690 2691 .date-input-group { 2692 display: flex; 2693 align-items: center; 2694 gap: 12px; 2695 } 2696 2697 .date-input-group input[type="month"] { 2698 flex: 1; 2699 } 2700 2701 .checkbox-label { 2702 display: flex; 2703 align-items: center; 2704 gap: 6px; 2705 font-size: 13px; 2706 color: #64748b; 2707 white-space: nowrap; 2708 } 2709 2710 .highlights-section { 2711 margin-top: 16px; 2712 padding-top: 16px; 2713 border-top: 1px solid #e5e7eb; 2714 } 2715 2716 .highlights-header { 2717 display: flex; 2718 justify-content: space-between; 2719 align-items: center; 2720 margin-bottom: 12px; 2721 } 2722 2723 .highlights-header label { 2724 font-size: 13px; 2725 font-weight: 500; 2726 color: #64748b; 2727 } 2728 2729 .btn-add-small { 2730 width: 24px; 2731 height: 24px; 2732 border: 1px solid #2563eb; 2733 background: white; 2734 color: #2563eb; 2735 border-radius: 6px; 2736 cursor: pointer; 2737 font-size: 16px; 2738 } 2739 2740 .highlight-item { 2741 display: flex; 2742 gap: 8px; 2743 margin-bottom: 8px; 2744 } 2745 2746 .highlight-item input { 2747 flex: 1; 2748 padding: 8px 12px; 2749 border: 1px solid #e5e7eb; 2750 border-radius: 6px; 2751 font-size: 14px; 2752 } 2753 2754 .btn-remove-small {
2755 width: 28px; 2756 height: 28px; 2757 border: none; 2758 background: #f1f5f9; 2759 color: #64748b; 2760 border-radius: 6px; 2761 cursor: pointer; 2762 } 2763 2764 .btn-remove-small:hover { 2765 background: #fee2e2; 2766 color: #dc2626; 2767 } 2768 2769 .skills-categories { 2770 display: flex; 2771 flex-direction: column; 2772 gap: 16px; 2773 } 2774 2775 .skill-category-card { 2776 background: #f8fafc; 2777 border: 1px solid #e5e7eb; 2778 border-radius: 12px; 2779 padding: 16px; 2780 } 2781 2782 .category-header { 2783 margin-bottom: 12px; 2784 } 2785 2786 .category-name-input { 2787 font-size: 15px; 2788 font-weight: 600; 2789 padding: 6px 10px; 2790 border: 1px solid transparent; 2791 border-radius: 6px; 2792 background: transparent; 2793 width: 200px; 2794 } 2795 2796 .category-name-input:focus { 2797 border-color: #2563eb; 2798 background: white; 2799 outline: none; 2800 } 2801 2802 .skills-tags { 2803 display: flex; 2804 flex-wrap: wrap; 2805 gap: 8px; 2806 align-items: center; 2807 } 2808 2809 .skill-edit-tag { 2810 display: flex; 2811 align-items: center; 2812 gap: 6px; 2813 padding: 6px 12px; 2814 background: #2563eb15; 2815 color: #2563eb; 2816 border-radius: 6px; 2817 font-size: 13px; 2818 } 2819 2820 .tag-remove { 2821 border: none; 2822 background: transparent; 2823 color: #2563eb; 2824 cursor: pointer; 2825 padding: 0; 2826 font-size: 14px; 2827 opacity: 0.6; 2828 } 2829 2830 .tag-remove:hover { 2831 opacity: 1; 2832 } 2833 2834 .skill-add-input { 2835 padding: 6px 12px; 2836 border: 1px dashed #cbd5e1; 2837 border-radius: 6px; 2838 font-size: 13px; 2839 width: 120px; 2840 } 2841 2842 .skill-add-input:focus { 2843 outline: none; 2844 border-style: solid; 2845 border-color: #2563eb; 2846 } 2847 2848 .placeholder-text { 2849 color: #94a3b8; 2850 text-align: center; 2851 padding: 40px; 2852 } 2853 2854 .editor-footer { 2855 padding: 16px; 2856 background: white; 2857 border-top: 1px solid #e5e7eb; 2858 display: flex; 2859 justify-content: flex-end; 2860 } 2861 2862 .btn-save { 2863 padding: 10px 24px; 2864 background: #2563eb; 2865 color: white; 2866 border: none; 2867 border-radius: 8px; 2868 font-size: 14px; 2869 font-weight: 500; 2870 cursor: pointer; 2871 } 2872 2873 .btn-save:hover { 2874 background: #1d4ed8; 2875 } 2876 2877 @media (max-width: 600px) { 2878 .form-grid { 2879 grid-template-columns: 1fr; 2880 } 2881 2882 .editor-nav { 2883 padding: 8px 12px; 2884 } 2885 2886 .nav-btn { 2887 padding: 6px 12px; 2888 font-size: 13px; 2889 } 2890 } 2891 `})]})}function Oi({content:t,mode:s="preview"}){var M,k,v,S,J,H;const{t:n}=ve(),[r,l]=u.useState(((k=(M=t.data)==null?void 0:M.metadata)==null?void 0:k.templateStyle)||"modern"),[c,o]=u.useState(!1),[d,a]=u.useState(s==="edit"),p=u.useMemo(()=>{try{const f=t.data;return f!=null&&f.personal?f:null}catch{return null}},[t.data]),[i,m]=u.useState(p);u.useEffect(()=>{p&&!i&&m(p)},[p,i]);const x=d?i:p,g=u.useCallback(f=>{m(f)},[]),b=u.useMemo(()=>{try{const f=t.data;return f!=null&&f.optimizationData?f.optimizationData:null}catch{return null}},[t.data]),C=u.useMemo(()=>Ei(r),[r]),w=u.useMemo(()=>Ai(r),[r]),D=u.useMemo(()=>Mi(C,w),[C,w]),R=!!((v=t.preview)!=null&&v.html||(S=t.data)!=null&&S.html),B=u.useCallback(()=>{if(!x)return null;const{personal:f,experience:y,education:L,skills:E,projects:_,certifications:Q}=x;return e.jsxs("div",{className:"resume-container",children:[e.jsxs("header",{className:"resume-header",children:[e.jsx("h1",{className:"resume-name",children:f.name}),f.title&&e.jsx("h2",{className:"resume-title",children:f.title}),e.jsxs("div",{className:"contact-info",children:[f.email&&e.jsx("span",{children:f.email}),f.phone&&e.jsx("span",{children:f.phone}),f.location&&e.jsx("span",{children:f.location}),f.linkedin&&e.jsx("span",{children:f.linkedin}),f.github&&e.jsx("span",{children:f.github})]})]}),f.summary&&e.jsxs("section",{className:"resume-section",children:[e.jsx("h3",{className:"section-title",children:n("resume.summary")}
2891),e.jsx("p",{className:"summary-text",children:f.summary})]}),y.length>0&&e.jsxs("section",{className:"resume-section",children:[e.jsx("h3",{className:"section-title",children:n("resume.experience")}),y.map($=>e.jsxs("div",{className:"entry-item",children:[e.jsxs("div",{className:"entry-header",children:[e.jsxs("div",{className:"entry-main",children:[e.jsx("h4",{className:"entry-company",children:$.company}),e.jsx("span",{className:"entry-position",children:$.position})]}),e.jsxs("span",{className:"entry-date",children:[$.startDate," - ",$.current?n("resume.present"):$.endDate]})]}),$.description&&e.jsx("p",{className:"entry-description",children:$.description}),$.highlights.length>0&&e.jsx("ul",{className:"highlights",children:$.highlights.map((K,F)=>e.jsx("li",{children:K},F))}),$.technologies&&$.technologies.length>0&&e.jsx("div",{className:"tech-tags",children:$.technologies.map((K,F)=>e.jsx("span",{className:"tech-tag",children:K},F))})]},$.id))]}),L.length>0&&e.jsxs("section",{className:"resume-section",children:[e.jsx("h3",{className:"section-title",children:n("resume.education")}),L.map($=>e.jsxs("div",{className:"entry-item",children:[e.jsxs("div",{className:"entry-header",children:[e.jsxs("div",{className:"entry-main",children:[e.jsx("h4",{className:"entry-school",children:$.school}),e.jsxs("span",{className:"entry-degree",children:[$.degree," - ",$.major]})]}),e.jsxs("span",{className:"entry-date",children:[$.startDate," - ",$.endDate||n("resume.present")]})]}),$.gpa&&e.jsxs("p",{className:"entry-gpa",children:["GPA: ",$.gpa]}),$.honors&&$.honors.length>0&&e.jsxs("p",{className:"entry-honors",children:[n("resume.honors"),$.honors.join(", ")]})]},$.id))]}),E.length>0&&e.jsxs("section",{className:"resume-section",children:[e.jsx("h3",{className:"section-title",children:n("resume.skills")}),e.jsx("div",{className:"skills-container",children:w.skillsLayout==="grouped"?E.map(($,K)=>e.jsxs("div",{className:"skill-category",children:[e.jsx("h4",{className:"skill-category-name",children:$.category}),e.jsx("div",{className:"skill-tags-group",children:$.skills.map((F,P)=>e.jsx("span",{className:"skill-tag","data-level":F.level||"intermediate",children:F.name},P))})]},K)):w.skillsLayout==="bars"?E.flatMap($=>$.skills.map((K,F)=>e.jsxs("div",{className:"skill-bar",children:[e.jsx("span",{className:"skill-bar-name",children:K.name}),e.jsx("div",{className:"skill-bar-track",children:e.jsx("div",{className:"skill-bar-fill",style:{width:K.level==="expert"?"100%":K.level==="advanced"?"80%":K.level==="intermediate"?"60%":"40%"}})})]},F))):E.flatMap($=>$.skills.map((K,F)=>e.jsx("span",{className:"skill-tag","data-level":K.level||"intermediate",children:K.name},F)))})]}),_&&_.length>0&&e.jsxs("section",{className:"resume-section",children:[e.jsx("h3",{className:"section-title",children:n("resume.projects")}),_.map($=>e.jsxs("div",{className:"entry-item",children:[e.jsxs("div",{className:"entry-header",children:[e.jsx("h4",{className:"entry-company",children:$.name}),$.role&&e.jsx("span",{className:"entry-position",children:$.role})]}),e.jsx("p",{className:"entry-description",children:$.description}),$.highlights.length>0&&e.jsx("ul",{className:"highlights",children:$.highlights.map((K,F)=>e.jsx("li",{children:K},F))}),$.technologies&&$.technologies.length>0&&e.jsx("div",{className:"tech-tags",children:$.technologies.map((K,F)=>e.jsx("span",{className:"tech-tag",children:K},F))})]},$.id))]}),Q&&Q.length>0&&e.jsxs("section",{className:"resume-section",children:[e.jsx("h3",{className:"section-title",children:n("resume.certifications")}),e.jsx("div",{className:"certifications-list",children:Q.map($=>e.jsxs("div",{className:"certification-item",children:[e.jsx("span",{className:"cert-name",children:$.name}),e.jsx("span",{className:"cert-issuer",children:$.issuer}),e.jsx("span",{className:"cert-date",children:$.date})]},$.id))})]})]})},[x,w,n]),Z=u.useCallback(()=>{if(!(b!=null&&b.matchAnalysis))return null;const{matchAnalysis:f,jobKeywords:y,suggestions:L}=b,E=(y==null?void 0:y.filter(Q=>Q.found))||[],_=(y==null?void 0:y.filter(Q=>!Q.found&&Q.importance==="high"))||[];return e.jsxs("div",{className:"optimization-panel",children:[e.jsxs("div",{className:"score-section",children:[e.jsxs("div",{className:"score-circle",children:[e.jsx("span",{className:"score-value",children:f.overallScore}),e.jsx("span",{className:"score-label",children:n("resumeRender.matchScore")})]}),e.jsxs("div",{className:"score-details",children:[e.jsxs("div",{className:"score-item",children:[e.jsx("span",{className:"label",children:n("resumeRender.skillMatch")}),e.jsx("div",{className:"progress-bar",children:e.jsx("div",{className:"progress",style:{width:`${f.skillMatch}%`}})}),e.jsxs("span",{className:"value",children:[f.skillMatch,"%"]})]}),e.jsxs("div",{className:"score-item",children:[e.jsx("span",{className:"label",children:n("resumeRender.experienceMatch")}),e.jsx("div",{className:"progress-bar",children:e.jsx("div",{className:"progress",style:{width:`${f.experienceMatch}%`}})}),e.jsxs("span",{className:"value",children:[f.experienceMatch,"%"]})]}),e.jsxs("div",{className:"score-item",children:[e.jsx("span",{className:"label",children:n("resumeRender.atsScore")}),e.jsx("div",{className:"progress-bar",children:e.jsx("div",{className:"progress",style:{width:`${f.atsScore}%`}})}),e.jsxs("span",{className:"value",children:[f.atsScore,"%"]})]})]})]}),E.length>0&&e.jsxs("div",{className:"keywords-section",children:[e.jsx("h4",{children:n("resumeRender.matchedKeywords")}),e.jsx("div",{className:"keywords-found",children:E.slice(0,10).map((Q,$)=>e.jsx("span",{className:"keyword found",children:Q.keyword},$))})]}),_.length>0&&e.jsxs("div",{className:"keywords-section",children:[e.jsx("h4",{children:n("resumeRender.suggestAdd")}),e.jsx("div",{className:"keywords-missing",children:_.slice(0,5).map((Q,$)=>e.jsx("span",{className:"keyword missing",children:Q.keyword},$))})]}),L&&L.length>0&&e.jsxs("div",{className:"suggestions-section",children:[e.jsx("h4",{children:n("resumeRender.optimizationSuggestions")}),e.jsx("ul",{className:"suggestions-list",children:L.slice(0,3).map((Q,$)=>e.jsxs("li",{className:`suggestion ${Q.priority}`,children:[e.jsx("span",{className:"suggestion-type",children:Q.section}),e.jsx("p",{className:"suggestion-text",children:Q.suggested}),e.jsx("span",{className:"suggestion-reason",children:Q.reason})]},$))})]})]})},[b]);return!x&&!R?e.jsx("div",{className:"resume-renderer-empty",children:e.jsxs("div",{className:"empty-state",children:[e.jsx("svg",{className:"empty-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),e.jsx("p",{children:n("resumeRender.loadError")})]})}):e.jsxs("div",{className:`resume-renderer ${s}`,children:[e.jsxs("div",{className:"resume-toolbar",children:[e.jsxs("div",{className:"template-selector",children:[e.jsx("label",{children:n("resumeRender.templateStyle")}),e.jsx(ut,{value:r,onChange:f=>l(f),options:Fi().map(f=>({value:f,label:n(`resumeTemplates.${f}.label`)}))})]}),e.jsxs("div",{className:"toolbar-actions",children:[b&&e.jsxs("button",{className:`btn-optimization ${c?"active":""}`,onClick:()=>o(!c),children:[n(c?"resumeRender.hideAnalysis":"resumeRender.viewAnalysis"),b.matchAnalysis&&e.jsxs("span",{className:"score-badge",children:[b.matchAnalysis.overallScore,"%"]})]}),e.jsx("button",{className:`btn-edit ${d?"active":""}`,onClick:()=>a(!d),children:n(d?"resumeRender.preview":"resumeRender.edit")})]})]}),e.jsxs("div",{className:`resume-content-wrapper ${c?"with-panel":""}`,children:[c&&Z(),d&&i?e.jsx(_i,{data:i,onChange:g}):e.jsxs("div",{className:"resume-preview",children:[e.jsx("style",{children:D}),R&&!d?e.jsx("div",{className:"resume-html-content",dangerouslySetInnerHTML:{__html:Lr(((J=t.preview)==null?void 0:J.html)||((H=t.data)==null?void 0:H.html)||"")}}):B()]})]}),e.jsx("style",{children:` 2892 .resume-renderer { 2893 height: 100%; 2894 display: flex; 2895 flex-direction: column; 2896 background: #f1f5f9; 2897 } 2898 2899 .resume-toolbar { 2900 display: flex; 2901 justify-content: space-between; 2902 align-items: center; 2903 padding: 12px 16px; 2904 background: white; 2905 border-bottom: 1px solid #e5e7eb; 2906 } 2907 2908 .template-selector { 2909 display: flex; 2910 align-items: center; 2911 gap: 8px; 2912 } 2913 2914 .template-selector label { 2915 font-size: 14px; 2916 color: #64748b; 2917 } 2918 2919 .toolbar-actions { 2920 display: flex; 2921 gap: 8px; 2922 } 2923 2924 .toolbar-actions button { 2925 padding: 6px 12px; 2926 border: 1px solid #e5e7eb; 2927 border-radius: 6px; 2928 font-size: 14px; 2929 background: white; 2930 cursor: pointer; 2931 display: flex; 2932 align-items: center; 2933 gap: 6px; 2934 transition: all 0.2s; 2935 } 2936 2937 .toolbar-actions button:hover { 2938 background: #f8fafc; 2939 border-color: #cbd5e1; 2940 } 2941 2942 .toolbar-actions button.active { 2943 background: #2563eb; 2944 color: white; 2945 border-color: #2563eb; 2946 } 2947 2948 .score-badge { 2949 background: #10b981; 2950 color: white; 2951 padding: 2px 6px; 2952 border-radius: 4px; 2953 font-size: 12px; 2954 font-weight: 600; 2955 } 2956 2957 .resume-content-wrapper { 2958 flex: 1; 2959 display: flex; 2960 overflow: hidden; 2961 } 2962 2963 .resume-content-wrapper.with-panel { 2964 display: grid; 2965 grid-template-columns: 280px 1fr; 2966 } 2967 2968 .optimization-panel { 2969 background: linear-gradient(135deg, #1e293b 0%, #334155 100%); 2970 color: white; 2971 padding: 20px; 2972 overflow-y: auto; 2973 } 2974 2975 .score-circle { 2976 width: 100px; 2977 height: 100px; 2978 border-radius: 50%; 2979 background: conic-gradient(#10b981 calc(var(--score, 0) * 1%), #374151 0); 2980 display: flex; 2981 flex-direction: column; 2982 align-items: center; 2983 justify-content: center; 2984 margin: 0 auto 16px; 2985 position: relative; 2986 } 2987 2988 .score-circle::before { 2989 content: ''; 2990 width: 80px; 2991 height: 80px; 2992 background: #1e293b; 2993 border-radius: 50%; 2994 position: absolute; 2995 } 2996 2997 .score-value { 2998 font-size: 28px; 2999 font-weight: 700; 3000 position: relative; 3001 z-index: 1; 3002 } 3003 3004 .score-label { 3005 font-size: 11px; 3006 opacity: 0.8; 3007 position: relative; 3008 z-index: 1; 3009 } 3010 3011 .score-details { 3012 display: flex; 3013 flex-direction: column; 3014 gap: 10px; 3015 } 3016 3017 .score-item { 3018 display: grid; 3019 grid-template-columns: 60px 1fr 36px; 3020 align-items: center; 3021 gap: 8px; 3022 font-size: 12px; 3023 } 3024 3025 .progress-bar { 3026 height: 6px; 3027 background: #374151; 3028 border-radius: 3px; 3029 overflow: hidden; 3030 } 3031 3032 .progress { 3033 height: 100%; 3034 background: linear-gradient(90deg, #10b981, #34d399); 3035 border-radius: 3px; 3036 } 3037 3038 .keywords-section { 3039 margin-top: 20px; 3040 padding-top: 20px; 3041 border-top: 1px solid rgba(255,255,255,0.1); 3042 } 3043 3044 .keywords-section h4 { 3045 font-size: 12px; 3046 margin: 0 0 10px 0; 3047 opacity: 0.8; 3048 } 3049 3050 .keywords-found, .keywords-missing { 3051 display: flex; 3052 flex-wrap: wrap; 3053 gap: 6px; 3054 } 3055 3056 .keyword { 3057 font-size: 11px; 3058 padding: 3px 8px; 3059 border-radius: 4px; 3060 } 3061 3062 .keyword.found { 3063 background: rgba(16, 185, 129, 0.2); 3064 color: #6ee7b7; 3065 } 3066 3067 .keyword.missing { 3068 background: rgba(239, 68, 68, 0.2); 3069 color: #fca5a5; 3070 } 3071 3072 .suggestions-section { 3073 margin-top: 20px; 3074 padding-top: 20px; 3075 border-top: 1px solid rgba(255,255,255,0.1); 3076 } 3077 3078 .suggestions-section h4 { 3079 font-size: 12px; 3080 margin: 0 0 10px 0; 3081 opacity: 0.8; 3082 } 3083 3084 .suggestions-list { 3085 list-style: none; 3086 padding: 0; 3087 margin: 0; 3088 } 3089 3090 .suggestion { 3091 background: rgba(255,255,255,0.05); 3092 padding: 10px; 3093 border-radius: 6px; 3094 margin-bottom: 8px; 3095 font-size: 12px; 3096 } 3097 3098 .suggestion.high { 3099 border-left: 3px solid #ef4444; 3100 } 3101 3102 .suggestion.medium { 3103 border-left: 3px solid #f59e0b; 3104 } 3105 3106 .suggestion-type { 3107 display: inline-block; 3108 background: rgba(255,255,255,0.1); 3109 padding: 2px 6px; 3110 border-radius: 3px; 3111 font-size: 10px; 3112 margin-bottom: 4px; 3113 } 3114 3115 .suggestion-text { 3116 margin: 4px 0; 3117 line-height: 1.4; 3118 } 3119 3120 .suggestion-reason { 3121 font-size: 11px; 3122 opacity: 0.7; 3123 } 3124 3125 .resume-preview { 3126 flex: 1; 3127 overflow-y: auto; 3128 padding: 24px; 3129 background: #f1f5f9; 3130 } 3131 3132 .resume-html-content { 3133 background: white; 3134 border-radius: 8px; 3135 box-shadow: 0 4px 16px rgba(0,0,0,0.08); 3136 min-height: 100%; 3137 } 3138 3139 .resume-renderer-empty { 3140 display: flex; 3141 align-items: center; 3142 justify-content: center; 3143 height: 100%; 3144 background: #f8fafc; 3145 } 3146 3147 .empty-state { 3148 text-align: center; 3149 color: #94a3b8; 3150 } 3151 3152 .empty-icon { 3153 width: 48px; 3154 height: 48px; 3155 margin-bottom: 12px; 3156 } 3157 3158 /* Additional styles for rendered content */ 3159 .summary-text { 3160 font-size: 15px; 3161 line-height: 1.8; 3162 color: var(--resume-secondary, #64748b); 3163 } 3164 3165 .entry-description { 3166 font-size: 14px; 3167 margin: 8px 0; 3168 color: var(--resume-secondary, #64748b); 3169 } 3170 3171 .entry-gpa, 3172 .entry-honors { 3173 font-size: 13px; 3174 margin: 4px 0; 3175 color: var(--resume-secondary, #64748b); 3176 } 3177 3178 .certifications-list { 3179 display: grid; 3180 gap: 10px; 3181 } 3182 3183 .certification-item { 3184 display: flex; 3185 align-items: center; 3186 gap: 12px; 3187 font-size: 14px; 3188 } 3189 3190 .cert-name { 3191 font-weight: 600; 3192 flex: 1; 3193 } 3194 3195 .cert-issuer { 3196 color: var(--resume-secondary, #64748b); 3197 } 3198 3199 .cert-date { 3200 font-size: 13px; 3201 color: var(--resume-secondary, #64748b); 3202 } 3203 3204 .skill-tags-group { 3205 display: flex; 3206 flex-wrap: wrap; 3207 gap: 6px; 3208 } 3209 `})]})}function Bi(t){const s=[],n=t.split(` 3210`);let r=[],l=null;const c=()=>{r.length>0&&l&&(l==="ul"?s.push({ul:r.map(o=>_t(o)),margin:[0,5,0,10]}):s.push({ol:r.map(o=>_t(o)),margin:[0,5,0,10]}),r=[],l=null)};for(let o=0;o<n.length;o++){const d=n[o].trim();if(!d){c();continue}if(d.startsWith("### ")){c(),s.push({text:d.slice(4),style:"h3",margin:[0,15,0,5]});continue}if(d.startsWith("## ")){c(),s.push({text:d.slice(3),style:"h2",margin:[0,15,0,5]});continue}if(d.match(/^[-*]\s+/)){l!=="ul"&&(c(),l="ul"),r.push(d.replace(/^[-*]\s+/,""));continue}if(d.match(/^\d+\.\s+/)){l!=="ol"&&(c(),l="ol"),r.push(d.replace(/^\d+\.\s+/,""));continue}if(d.startsWith("> ")){c(),s.push({text:d.slice(2),style:"quote",margin:[20,5,20,5]});continue}c(),s.push({text:_t(d),style:"paragraph",margin:[0,0,0,10]})}return c(),s}function _t(t){let s=t;const n=/\*\*([^*]+)\*\*/g,r=/\*([^*]+)\*/g,l=/`([^`]+)`/g;return s=s.replace(n,(c,o)=>o),s=s.replace(r,(c,o)=>o),s=s.replace(l,(c,o)=>o),s}async function Ui(t,s){const n={...t,sections:s};try{const r=await zr.export(n,"pdf"),l=URL.createObjectURL(r),c=document.createElement("a");c.href=l,c.download=`${t.title}.pdf`,c.click(),URL.revokeObjectURL(l)}
3210catch(r){console.error("PDF export error:",r),await Hi(t,s)}}async function Hi(t,s){var i;const n=await $e(()=>import("./pdfmake-D5Y9vCQw.js").then(m=>m.p),__vite__mapDeps([18,1,2,3,4,5,6,7,8,9,10,11,12,13,14])),r=await $e(()=>import("./vfs_fonts-B2Vntlz5.js").then(m=>m.v),__vite__mapDeps([19,1,2,3,4,5,6,7,8,9,10,11,12,13,14])),l=n.default||n,c=r.default||r;(i=c.pdfMake)!=null&&i.vfs?l.vfs=c.pdfMake.vfs:c.vfs?l.vfs=c.vfs:(console.warn("pdfmake vfs not found, using empty vfs"),l.vfs={});const o=[];o.push({text:t.title,style:"title",alignment:"center",margin:[0,0,0,10]});const d={report:"Report",article:"Article",proposal:"Proposal",analysis:"Analysis",manual:"Manual",letter:"Letter",contract:"Contract"};o.push({text:`${d[t.documentType]||t.documentType} · ${s.length} sections`,style:"subtitle",alignment:"center",margin:[0,0,0,30]}),o.push({text:"Table of Contents",style:"h1",margin:[0,0,0,10]});const a=s.map((m,x)=>({text:`${x+1}. ${m.title}`,style:"toc",margin:[m.level===1?0:(m.level-1)*20,3,0,3]}));o.push(...a),o.push({text:"",pageBreak:"after"}),s.forEach((m,x)=>{const g=m.level===1?"h1":m.level===2?"h2":"h3";o.push({text:`${x+1}. ${m.title}`,style:g,margin:[0,x===0?0:20,0,10]});const b=Bi(m.content);o.push(...b)}),o.push({text:` 3211 3212Generated by AI Document Assistant`,style:"footer",alignment:"center",margin:[0,40,0,0]});const p={content:o,defaultStyle:{font:"Roboto",fontSize:11,lineHeight:1.5},styles:{title:{fontSize:24,bold:!0},subtitle:{fontSize:12,color:"#666666"},h1:{fontSize:18,bold:!0},h2:{fontSize:16,bold:!0},h3:{fontSize:14,bold:!0},paragraph:{fontSize:11,alignment:"justify"},toc:{fontSize:11,color:"#333333"},quote:{fontSize:11,italics:!0,color:"#555555"},code:{font:"Roboto",fontSize:10,background:"#f5f5f5"},bold:{bold:!0},italic:{italics:!0},footer:{fontSize:10,color:"#999999"}},pageSize:"A4",pageMargins:[60,60,60,60],info:{title:t.title,author:"AI Document Assistant",subject:t.documentType},footer:(m,x)=>({text:`${m} / ${x}`,alignment:"center",margin:[0,20,0,0],fontSize:10,color:"#999999"})};l.createPdf(p).download(`${t.title}.pdf`)}async function qi(t,s){const{Document:n,Packer:r,Paragraph:l,HeadingLevel:c,TextRun:o,AlignmentType:d}=await $e(async()=>{const{Document:g,Packer:b,Paragraph:C,HeadingLevel:w,TextRun:D,AlignmentType:R}=await import("./index-C7JpgO3f.js");return{Document:g,Packer:b,Paragraph:C,HeadingLevel:w,TextRun:D,AlignmentType:R}},[]),a=[];a.push(new l({text:t.title,heading:c.TITLE,alignment:d.CENTER,spacing:{after:400}}));for(let g=0;g<s.length;g++){const b=s[g];a.push(new l({text:`${g+1}. ${b.title}`,heading:b.level===1?c.HEADING_1:b.level===2?c.HEADING_2:c.HEADING_3,spacing:{before:400,after:200}}));const C=b.content.split(` 3213 3214`);for(const w of C)if(w.trim()){const D=w.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#+\s*/gm,"").replace(/^[-*]\s+/gm,"⢠").trim();a.push(new l({children:[new o(D)],spacing:{after:200}}))}}const p=new n({sections:[{properties:{},children:a}]}),i=await r.toBlob(p),m=URL.createObjectURL(i),x=document.createElement("a");x.href=m,x.download=`${t.title}.docx`,x.click(),URL.revokeObjectURL(m)}function Gi(t,s){let n=`# ${t.title} 3215 3216`;s.forEach((o,d)=>{const a="#".repeat(o.level+1);n+=`${a} ${d+1}. ${o.title} 3217 3218${o.content} 3219 3220`});const r=new Blob([n],{type:"text/markdown"}),l=URL.createObjectURL(r),c=document.createElement("a");c.href=l,c.download=`${t.title}.md`,c.click(),URL.revokeObjectURL(l)}function Wi(t,s){const n=s.map((d,a)=>` 3221 <section> 3222 <h${d.level+1}>${a+1}. ${Ot(d.title)}</h${d.level+1}> 3223 <div class="content">${Vi(d.content)}</div> 3224 </section> 3225 `).join(` 3226`),r=`<!DOCTYPE html> 3227<html lang="${t.language||"zh"}"> 3228<head> 3229 <meta charset="UTF-8"> 3230 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 3231 <title>${Ot(t.title)}</title> 3232 <style> 3233 body { 3234 font-family: 'Noto Serif SC', Georgia, serif; 3235 max-width: 800px; 3236 margin: 0 auto; 3237 padding: 40px; 3238 line-height: 1.8; 3239 color: #333; 3240 } 3241 h1 { text-align: center; margin-bottom: 40px; } 3242 h2 { border-bottom: 1px solid #eee; padding-bottom: 10px; margin-top: 30px; } 3243 h3, h4 { margin-top: 20px; } 3244 p { margin: 12px 0; text-align: justify; } 3245 ul, ol { margin: 12px 0; padding-left: 24px; } 3246 blockquote { margin: 16px 0; padding: 12px 20px; background: #f8f9fa; border-left: 4px solid #0066cc; } 3247 code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; } 3248 pre { background: #282c34; color: #abb2bf; padding: 16px; border-radius: 6px; overflow-x: auto; } 3249 </style> 3250</head> 3251<body> 3252 <h1>${Ot(t.title)}</h1> 3253 ${n} 3254 <footer style="margin-top: 60px; text-align: center; color: #999; font-size: 12px;"> 3255 Generated by AI Document Assistant 3256 </footer> 3257</body> 3258</html>`,l=new Blob([r],{type:"text/html"}),c=URL.createObjectURL(l),o=document.createElement("a");o.href=c,o.download=`${t.title}.html`,o.click(),URL.revokeObjectURL(c)}function Ot(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Vi(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/```(\w*)\n([\s\S]*?)```/g,"<pre><code>$2</code></pre>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/\*([^*]+)\*/g,"<em>$1</em>").replace(/^### (.+)$/gm,"<h4>$1</h4>").replace(/^## (.+)$/gm,"<h3>$1</h3>").replace(/^[-*] (.+)$/gm,"<li>$1</li>").replace(/^\d+\. (.+)$/gm,"<li>$1</li>").replace(/^> (.+)$/gm,"<blockquote>$1</blockquote>").replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>').replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>").replace(/(<li>.*<\/li>\s*)+/g,"<ul>$&</ul>")}function Ki(t){switch(t.type){case"code":const s=t;return s.contentType==="table"?[{format:"xlsx",label:"Excel Spreadsheet"},{format:"csv",label:"CSV File"},{format:"png",label:"PNG Screenshot"},{format:"html",label:"HTML File"}]:s.contentType==="chart"||s.contentType==="visualization"?[{format:"png",label:"PNG Image"},{format:"svg",label:"SVG Vector"},{format:"pdf",label:"PDF Document"},{format:"html",label:"HTML File"}]:[{format:"png",label:"PNG Screenshot"},{format:"pdf",label:"PDF Document"},{format:"html",label:"HTML File"}];case"search":return[{format:"json",label:"JSON Data"},{format:"md",label:"Markdown"},{format:"txt",label:"Plain Text"}];case"image":return[{format:"png",label:"PNG Image"},{format:"jpg",label:"JPG Image"}];case"video":return[{format:"mp4",label:"MP4 Video"}];case"data":return[{format:"xlsx",label:"Excel Spreadsheet"},{format:"csv",label:"CSV File"},{format:"json",label:"JSON Data"}];case"text":return[{format:"txt",label:"Plain Text"},{format:"md",label:"Markdown"},{format:"pdf",label:"PDF Document"}];case"weather":return[{format:"png",label:"PNG Screenshot"},{format:"json",label:"JSON Data"}];case"webcontent":return[{format:"md",label:"Markdown"},{format:"txt",label:"Plain Text"},{format:"pdf",label:"PDF Document"},{format:"html",label:"HTML File"}];case"file":const n=t;return n.fileType==="excel"||n.fileType==="csv"?[{format:"xlsx",label:"Excel Spreadsheet"},{format:"csv",label:"CSV File"},{format:"json",label:"JSON Data"}]:[{format:"json",label:"JSON Data"},{format:"txt",label:"Plain Text"}];case"calculation":return[{format:"txt",label:"Plain Text"},{format:"png",label:"PNG Screenshot"}];case"presentation":return[{format:"pptx",label:"PowerPoint"},{format:"pdf",label:"PDF Document"},{format:"png",label:"PNG Image"}];case"document":return[{format:"pdf",label:"PDF Document"},{format:"docx",label:"Word Document"},{format:"html",label:"HTML File"},{format:"md",label:"Markdown"}];case"resume":return[{format:"pdf",label:"PDF Document"},{format:"docx",label:"Word Document"},{format:"html",label:"HTML File"}];case"website":return[{format:"zip",label:"ZIP Archive"},{format:"html",label:"HTML File"}];case"spreadsheet":return[{format:"xlsx",label:"Excel Spreadsheet"},{format:"csv",label:"CSV File"},{format:"html",label:"HTML File"},{format:"png",label:"PNG Screenshot"}];default:return[{format:"json",label:"JSON Data"},{format:"txt",label:"Plain Text"}]}}async function Ji(t,s){const n=`${t.title||"download"}.${s}`;if(t.type==="presentation"){await ol(t,s);return}if(t.type==="document"){const r=t;
3258try{switch(s){case"pdf":await Ui(r,r.sections);return;case"docx":await qi(r,r.sections);return;case"md":Gi(r,r.sections);return;case"html":Wi(r,r.sections);return}}catch(l){console.error("Document export error:",l),Ne.error(N.t("preview.exportFailed"));return}}switch(s){case"json":Yi(t,n);break;case"txt":Zi(t,n);break;case"md":Qi(t,n);break;case"csv":Xi(t,n);break;case"html":el(t,n);break;case"png":case"jpg":t.type==="image"?sl(t,s,n):await rl(s,n);break;case"pdf":await nl(n);break;case"xlsx":await il(t,n);break;case"svg":ll(n);break;case"mp4":tl(t,n);break;case"docx":await al(t,n);break;default:console.warn(`Unsupported format: ${s}`)}}function Yi(t,s){const n=JSON.stringify(t,null,2);lt(n,s,"application/json")}function Zi(t,s){let n="";if(t.type==="text")n=t.result;else if(t.type==="webcontent")n=t.content;else if(t.type==="calculation"){const r=t;n=`${r.expression||""} = ${r.result}`}else t.type==="search"?n=t.results.map(l=>`${l.title} 3259${l.url} 3260${l.snippet||""}`).join(` 3261 3262`):n=JSON.stringify(t,null,2);lt(n,s,"text/plain")}function Qi(t,s){let n=`# ${t.title} 3263 3264`;if(t.type==="text"){const r=t;r.original?n+=`## Original 3265 3266${r.original} 3267 3268## Result 3269 3270${r.result}`:n+=r.result}else if(t.type==="webcontent"){const r=t;n+=`> Source: [${r.url}](${r.url}) 3271 3272${r.content}`}else t.type==="search"?t.results.forEach((l,c)=>{n+=`## ${c+1}. [${l.title}](${l.url}) 3273 3274${l.snippet||""} 3275 3276`}):t.type==="document"?t.sections.forEach((l,c)=>{const o="#".repeat(l.level+1);n+=`${o} ${c+1}. ${l.title} 3277 3278${l.content} 3279 3280`}):n+="```json\n"+JSON.stringify(t,null,2)+"\n```";lt(n,s,"text/markdown")}function Xi(t,s){let n=[];if(t.type==="data")n=t.rows||[];else if(t.type==="file"){const c=t.data;Array.isArray(c)&&(n=c)}else if(t.type==="search")n=t.results.map(c=>({title:c.title,url:c.url,snippet:c.snippet||""}));else if(t.type==="spreadsheet"){const c=t;c.sheets&&c.sheets.length>0&&(n=c.sheets[0].rows||[])}if(n.length===0){Ne.error(N.t("preview.noDataToExport"));return}const r=Object.keys(n[0]),l=[r.join(","),...n.map(c=>r.map(o=>{const d=c[o];return`"${(d==null?"":String(d)).replace(/"/g,'""')}"`}).join(","))].join(` 3281`);lt(l,s,"text/csv")}function el(t,s){if(t.type==="code"){const n=t.code,r=`<!DOCTYPE html> 3282<html lang="zh-CN"> 3283<head> 3284 <meta charset="UTF-8"> 3285 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 3286 <title>${t.title}</title> 3287 <style>${n.css||""}</style> 3288</head> 3289<body> 3290 ${n.html} 3291 <script>${n.js||""}<\/script> 3292</body> 3293</html>`;lt(r,s,"text/html")}else if(t.type==="document"){const n=t,r=`<!DOCTYPE html> 3294<html lang="${n.language||"zh"}"> 3295<head> 3296 <meta charset="UTF-8"> 3297 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 3298 <title>${n.title}</title> 3299 <style>${n.css}</style> 3300</head> 3301<body> 3302 ${n.html} 3303</body> 3304</html>`;lt(r,s,"text/html")}else if(t.type==="spreadsheet"){const n=t,r=`<!DOCTYPE html> 3305<html lang="zh-CN"> 3306<head> 3307 <meta charset="UTF-8"> 3308 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 3309 <title>${n.title}</title> 3310 <style>${n.css||""}</style> 3311</head> 3312<body> 3313 ${n.html} 3314</body> 3315</html>`;lt(r,s,"text/html")}else{const n=`<!DOCTYPE html> 3316<html> 3317<head><title>${t.title}</title></head> 3318<body><pre>${JSON.stringify(t,null,2)}</pre></body> 3319</html>`;lt(n,s,"text/html")}}async function ur(t,s,n){let r=s;if(t)try{r=await Et.getUrl(t)}catch{}const l=document.createElement("a");l.href=r,l.download=n,l.target="_blank",document.body.appendChild(l),l.click(),document.body.removeChild(l)}async function tl(t,s){if(!t.videoUrl){Ne.error("Video URL not found");return}await ur(t.assetId,t.videoUrl,s)}async function sl(t,s,n){const r=t.images;if(!r||r.length===0){Ne.error("No image available to download");return}await ur(r[0].assetId,r[0].url,n)}async function rl(t,s){const n=document.querySelector(".artifact-viewer");if(!n){Ne.error("Failed to capture screenshot");return}try{const r=(await $e(async()=>{const{default:o}=await import("./html2canvas.esm-CBrSDip1.js");return{default:o}},[])).default,l=await r(n,{backgroundColor:"#ffffff",scale:2}),c=document.createElement("a");c.download=s,c.href=l.toDataURL(t==="jpg"?"image/jpeg":"image/png",.9),c.click()}catch(r){console.error("Screenshot error:",r),Ne.error(N.t("preview.screenshotFailed"))}}async function nl(t){const s=document.querySelector(".artifact-viewer");if(!s){Ne.error("Failed to generate PDF");return}try{const n=(await $e(async()=>{const{default:d}
3319=await import("./html2canvas.esm-CBrSDip1.js");return{default:d}},[])).default,{jsPDF:r}=await $e(async()=>{const{jsPDF:d}=await import("./jspdf.es.min-BHjX0qxm.js").then(a=>a.j);return{jsPDF:d}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])),l=await n(s,{backgroundColor:"#ffffff",scale:2}),c=l.toDataURL("image/png"),o=new r({orientation:l.width>l.height?"landscape":"portrait",unit:"px",format:[l.width,l.height]});o.addImage(c,"PNG",0,0,l.width,l.height),o.save(t)}catch(n){console.error("PDF error:",n),Ne.error(N.t("preview.pdfFailed"))}}async function il(t,s){if(t.type==="spreadsheet"){const r=t;if(!r.sheets||r.sheets.length===0){Ne.error(N.t("preview.noDataToExport"));return}try{const l=await $e(()=>import("./exceljs.min-0TxIC6ny.js").then(g=>g.e),__vite__mapDeps([20,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17])),c=new l.Workbook;c.creator="UniAI",c.created=new Date;const o=r.sheets[0],d=c.addWorksheet(o.name||"Sheet 1");d.columns=o.columns.map(g=>({header:g.title,key:g.key,width:g.width||18}));const a=d.getRow(1);a.height=28,a.eachCell(g=>{g.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FF1F2937"}},g.font={bold:!0,color:{argb:"FFFFFFFF"},size:12},g.alignment={vertical:"middle",horizontal:"center"},g.border={top:{style:"thin",color:{argb:"FFE5E7EB"}},left:{style:"thin",color:{argb:"FFE5E7EB"}},bottom:{style:"medium",color:{argb:"FF3B82F6"}},right:{style:"thin",color:{argb:"FFE5E7EB"}}}}),o.rows.forEach((g,b)=>{const C=d.addRow(g);C.height=24,C.eachCell((w,D)=>{const R=o.columns[D-1],B=b%2===1;if(w.fill={type:"pattern",pattern:"solid",fgColor:{argb:B?"FFF9FAFB":"FFFFFFFF"}},w.border={top:{style:"thin",color:{argb:"FFE5E7EB"}},left:{style:"thin",color:{argb:"FFE5E7EB"}},bottom:{style:"thin",color:{argb:"FFE5E7EB"}},right:{style:"thin",color:{argb:"FFE5E7EB"}}},w.alignment={vertical:"middle",horizontal:(R==null?void 0:R.type)==="number"||(R==null?void 0:R.type)==="currency"||(R==null?void 0:R.type)==="percentage"||(R==null?void 0:R.type)==="progress"?"right":"left"},R){const Z=g[R.key];switch(R.type){case"currency":w.numFmt="Â¥#,##0.00",w.font={color:{argb:"FF059669"}};break;case"percentage":w.numFmt="0.00%";const M=typeof Z=="number"?Z:parseFloat(String(Z));isNaN(M)||(w.value=M/100,w.font={color:{argb:M>=0?"FF22C55E":"FFEF4444"}});break;case"progress":w.numFmt="0%";const k=typeof Z=="number"?Z:parseFloat(String(Z));if(!isNaN(k)){w.value=k/100;let J="FFD1D5DB";k>=80?J="FF22C55E":k>=50?J="FF3B82F6":k>0&&(J="FFEAB308"),w.font={color:{argb:J}}}break;case"status":const v=String(Z||"");let S="FF6B7280";v.includes("宿")||v.includes("éè¿")||v.toLowerCase().includes("complete")||v.toLowerCase().includes("pass")?S="FF166534":(v.includes("è¿è¡")||v.includes("å¤ç")||v.toLowerCase().includes("progress")||v.toLowerCase().includes("processing"))&&(S="FF1D4ED8"),w.font={color:{argb:S},bold:!0};break;case"date":w.numFmt="yyyy-mm-dd";break}}})}),o.columns.forEach((g,b)=>{if(g.type==="progress"&&o.rows.length>0){const C=String.fromCharCode(65+b),w=`${C}2:${C}${o.rows.length+1}`;d.addConditionalFormatting({ref:w,rules:[{type:"dataBar",priority:1,showValue:!0,gradient:!0,minLength:0,maxLength:100,cfvo:[{type:"num",value:0},{type:"num",value:1}]}]})}}),d.views=[{state:"frozen",ySplit:1}],d.autoFilter={from:{row:1,column:1},to:{row:1,column:o.columns.length}};const p=await c.xlsx.writeBuffer(),i=new Blob([p],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),m=URL.createObjectURL(i),x=document.createElement("a");x.href=m,x.download=s,x.click(),URL.revokeObjectURL(m)}catch(l){console.error("Excel export error:",l),Ne.error(N.t("preview.excelExportFailed"))}return}let n=[];if(t.type==="data")n=t.rows||[];else if(t.type==="file"){const r=t.data;Array.isArray(r)&&(n=r)}if(n.length===0){Ne.error(N.t("preview.noDataToExport"));return}$e(()=>import("./xlsx-D_0l8YDs.js"),[]).then(r=>{const l=r.utils.json_to_sheet(n),c=r.utils.book_new();r.utils.book_append_sheet(c,l,"Sheet1"),r.writeFile(c,s)}).catch(()=>{Ne.error(N.t("preview.excelExportFailed"))})}function ll(t){const s=document.querySelector(".artifact-viewer"),n=s==null?void 0:s.querySelector("svg");if(!n){Ne.error("SVG element not found");return}const r=new XMLSerializer().serializeToString(n);lt(r,t,"image/svg+xml")}async function al(t,s){try{const{Document:n,Packer:r,Paragraph:l,HeadingLevel:c,TextRun:o}=await $e(async()=>{const{Document:x,Packer:g,Paragraph:b,HeadingLevel:C,TextRun:w}=await import("./index-C7JpgO3f.js");return{Document:x,Packer:g,Paragraph:b,HeadingLevel:C,TextRun:w}},[]),d=[];d.push(new l({text:t.title,heading:c.TITLE,spacing:{after:400}}));for(const x of t.sections){d.push(new l({text:x.title,heading:x.level===1?c.HEADING_1:x.level===2?c.HEADING_2:c.HEADING_3,spacing:{before:400,after:200}}));const g=x.content.split(` 3320 3321`);for(const b of g)if(b.trim()){const C=b.replace(/\*\*([^*]+)\*\*/g,"$1").replace(/\*([^*]+)\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#+\s*/gm,"").replace(/^[-*]\s+/gm,"⢠").trim();d.push(new l({children:[new o(C)],spacing:{after:200}}))}}const a=new n({sections:[{properties:{},children:d}]}),p=await r.toBlob(a),i=URL.createObjectURL(p),m=document.createElement("a");m.href=i,m.download=s,m.click(),URL.revokeObjectURL(i)}catch(n){console.error("DOCX export error:",n),Ne.error(N.t("preview.wordExportFailed"))}}async function ol(t,s,n){const r=t.slides||[];if(r.length===0){Ne.error("No slides available to export");return}const l=t.title||"presentation";try{async function c(){var m,x;const a=(await $e(async()=>{const{default:g}
3321=await import("./html2canvas.esm-CBrSDip1.js");return{default:g}},[])).default,p=document.createElement("div");p.style.cssText="position: fixed; left: -9999px; top: 0; width: 1200px; height: 675px;",document.body.appendChild(p);const i=[];for(const g of r){if(!g.content){i.push("");continue}const b=document.createElement("iframe");b.style.cssText="width: 1200px; height: 675px; border: none;",p.innerHTML="",p.appendChild(b);const C=b.contentDocument||((m=b.contentWindow)==null?void 0:m.document);if(C){const D=g.content.includes("<!DOCTYPE")||g.content.includes("<html")?g.content:`<!DOCTYPE html> 3322<html> 3323<head> 3324 <meta charset="UTF-8"> 3325 <link href="https://fonts.bunny.net/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap" rel="stylesheet"> 3326 <style> 3327 * { margin: 0; padding: 0; box-sizing: border-box; } 3328 html, body { width: 1200px; height: 675px; overflow: hidden; } 3329 body { font-family: 'Inter', 'Noto Sans SC', sans-serif; } 3330 </style> 3331</head> 3332<body>${g.content}</body> 3333</html>`;C.open(),C.write(D),C.close()}await new Promise(D=>setTimeout(D,500));const w=await a(((x=b.contentDocument)==null?void 0:x.body)||b,{width:1200,height:675,scale:2,useCORS:!0,allowTaint:!0});i.push(w.toDataURL("image/png"))}return document.body.removeChild(p),i}if(s==="pptx"){const a=await c();if(a.filter(m=>m).length===0){Ne.error("Failed to generate slide image");return}const p=(await $e(async()=>{const{default:m}=await import("./pptxgen.es-CRI-nGi7.js");return{default:m}},__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17]))).default,i=new p;i.author="UniAI",i.title=l,i.subject="Generated by UniAI",i.layout="LAYOUT_16x9",a.forEach((m,x)=>{var b;if(!m)return;const g=i.addSlide();g.addImage({data:m,x:0,y:0,w:"100%",h:"100%"}),(b=r[x])!=null&&b.notes&&g.addNotes(r[x].notes)}),await i.writeFile({fileName:`${l}.pptx`});return}const d=(await c()).filter(a=>a);if(d.length===0){Ne.error("Failed to generate slide image");return}if(s==="png")if(d.length===1){const a=document.createElement("a");a.download=`${l}.png`,a.href=d[0],a.click()}else{const a=(await $e(async()=>{const{default:x}=await import("./jszip.min-CCODYnd_.js").then(g=>g.j);return{default:x}},__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17]))).default,p=new a;d.forEach((x,g)=>{if(!x)return;const b=x.split(",")[1];p.file(`slide-${g+1}.png`,b,{base64:!0})});const i=await p.generateAsync({type:"blob"}),m=document.createElement("a");m.download=`${l}-slides.zip`,m.href=URL.createObjectURL(i),m.click(),URL.revokeObjectURL(m.href)}else if(s==="pdf"){const{jsPDF:a}=await $e(async()=>{const{jsPDF:i}=await import("./jspdf.es.min-BHjX0qxm.js").then(m=>m.j);return{jsPDF:i}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])),p=new a({orientation:"landscape",unit:"px",format:[1200,675]});d.forEach((i,m)=>{i&&(m>0&&p.addPage([1200,675],"landscape"),p.addImage(i,"PNG",0,0,1200,675))}),p.save(`${l}.pdf`)}}catch(c){console.error("Presentation export error:",c),Ne.error(N.t("preview.exportFailed"))}}function lt(t,s,n){const r=new Blob([t],{type:n}),l=URL.createObjectURL(r),c=document.createElement("a");c.href=l,c.download=s,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l)}function dl({artifact:t}){const{t:s}=ve(),{setShowPreview:n,updateArtifact:r,selectedMessageId:l}=zt(),[c,o]=u.useState(!1),[d,a]=u.useState(!1),[p,i]=u.useState(t),m=u.useRef(null),x=u.useRef(!1),[g,b]=u.useState(!1),C=u.useCallback(()=>{b(S=>!S)},[]);u.useEffect(()=>{const S=J=>{J.key==="Escape"&&g&&b(!1)};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[g]);const w=u.useRef(t.id);u.useEffect(()=>{t.id!==w.current?(w.current=t.id,x.current=!1,i(t)):x.current||i(t)},[t]);const D=Ki(p),R=u.useCallback(async S=>{if(t.type==="presentation"){x.current=!0;const J={...p,slides:S};if(i(J),r==null||r(J),l){const f=ge.getState().messages.find(y=>y.id===l);if(f&&f.artifacts){const y=f.artifacts.map(L=>L.id===t.id?J:L);ge.getState().updateMessage(l,{artifacts:y})}try{const{accessToken:y}=Er.getState(),E=await(await fetch(`/api/v1/agent-v2/presentations/${t.id}/slides`,{method:"POST",headers:{"Content-Type":"application/json",...y?{Authorization:`Bearer ${y}`}:{}},body:JSON.stringify({messageId:l,slides:S})})).json();E.success||console.error("Failed to save slides:",E.error)}catch(y){console.error("Error saving slides:",y)}}}},[t.type,t.id,p,r,l]),B=u.useCallback(async S=>{if(t.type==="document"){x.current=!0;const J={...p,sections:S};if(i(J),r==null||r(J),l){const f=ge.getState().messages.find(y=>y.id===l);if(f&&f.artifacts){const y=f.artifacts.map(L=>L.id===t.id?J:L);ge.getState().updateMessage(l,{artifacts:y})}try{const y=await vs.updateDocument(l,t.id,S);y.success||console.error("Failed to save document sections:",y.error)}catch(y){console.error("Error saving document sections:",y)}}}},[t.type,t.id,p,r,l]),Z=u.useCallback(async S=>{if(t.type==="spreadsheet"){x.current=!0;const J={...p,sheets:S};if(i(J),r==null||r(J),l){const f=ge.getState().messages.find(y=>y.id===l);if(f&&f.artifacts){const y=f.artifacts.map(L=>L.id===t.id?J:L);ge.getState().updateMessage(l,{artifacts:y})}try{const y=await vs.updateSpreadsheet(l,t.id,S);y.success||console.error("Failed to save spreadsheet sheets:",y.error)}catch(y){console.error("Error saving spreadsheet sheets:",y)}}}},[t.type,t.id,p,r,l]);u.useEffect(()=>{const S=J=>{m.current&&!m.current.contains(J.target)&&o(!1)};
3333return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[]);const M=async S=>{a(!0);try{await Ji(p,S)}finally{a(!1),o(!1)}},k=()=>{switch(t.type){case"code":return e.jsx(Ln,{artifact:t});case"search":return e.jsx(zn,{artifact:t});case"image":return e.jsx(En,{artifact:t});case"video":return e.jsx(Fn,{artifact:t});case"data":return e.jsx(Pn,{artifact:t});case"text":return e.jsx(An,{artifact:t});case"weather":return e.jsx(Mn,{artifact:t});case"webcontent":return e.jsx(Bn,{artifact:t});case"calculation":return e.jsx(Hn,{artifact:t});case"file":return e.jsx(qn,{artifact:t});case"document":return e.jsx(Wn,{artifact:p,onUpdate:B});case"presentation":return e.jsx(zi,{content:p,onUpdate:R});case"resume":return e.jsx(Oi,{content:{id:t.id,type:"resume",title:t.title,data:t.data,preview:{html:t.html,css:t.css}}});case"website":return e.jsx(nr,{artifact:t,onClose:()=>n(!1)});case"spreadsheet":return e.jsx(Yn,{artifact:p,onUpdate:Z});default:return e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsx("p",{children:"Unsupported content type"})})}},v=t.type==="code"||t.type==="website";return e.jsxs("div",{className:U("h-full flex flex-col bg-background",g&&"fixed inset-0 z-50"),children:[v?e.jsx("div",{className:"absolute top-2 right-2 z-10",children:e.jsx("button",{onClick:()=>n(!1),className:"p-2 bg-background/80 hover:bg-background rounded-lg shadow-sm transition-colors",title:"Close",children:e.jsx(Ee,{className:"w-4 h-4"})})}):e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("h3",{className:"font-medium truncate",children:p.title}),e.jsx("span",{className:"text-xs text-muted-foreground px-2 py-0.5 bg-secondary rounded",children:p.type})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[D.length>0&&e.jsxs("div",{className:"relative",ref:m,children:[e.jsxs("button",{onClick:()=>o(!c),disabled:d,className:U("flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-lg transition-colors","bg-primary text-primary-foreground hover:bg-primary/90",d&&"opacity-50 cursor-not-allowed"),children:[e.jsx(at,{className:"w-4 h-4"}),e.jsx("span",{children:"Download"}),e.jsx(gt,{className:U("w-3 h-3 transition-transform",c&&"rotate-180")})]}),c&&e.jsx("div",{className:"absolute right-0 top-full mt-1 py-1 min-w-[160px] bg-popover border border-border rounded-lg shadow-lg z-50",children:D.map(S=>e.jsxs("button",{onClick:()=>M(S.format),className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent transition-colors text-left",children:[e.jsx(at,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("span",{children:S.label}),e.jsxs("span",{className:"ml-auto text-xs text-muted-foreground uppercase",children:[".",S.format]})]},S.format))})]}),t.type!=="spreadsheet"&&t.type!=="presentation"&&e.jsx("button",{onClick:C,className:"p-1.5 text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors",title:s(g?"preview.exitFullscreen":"preview.fullscreen"),children:g?e.jsx(Ee,{className:"w-4 h-4"}):e.jsx(mt,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>n(!1),className:"p-2 hover:bg-secondary rounded-lg transition-colors",children:e.jsx(Ee,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:U("flex-1 overflow-hidden artifact-viewer",v&&"relative"),children:k()})]})}function cl({data:t,onConfirm:s,onCancel:n,readOnly:r}){const{t:l}=ve(),{charts:c,images:o,recommendedSelection:d}=t,[a,p]=u.useState(new Set(d.chartIds)),[i,m]=u.useState(new Set(d.imageIds)),x=D=>{p(R=>{const B=new Set(R);return B.has(D)?B.delete(D):B.add(D),B})},g=D=>{m(R=>{const B=new Set(R);return B.has(D)?B.delete(D):B.add(D),B})},b=()=>{s(Array.from(a),Array.from(i))},C=a.size+i.size,w=c.length+o.length;return e.jsxs("div",{className:"h-full flex flex-col bg-muted/30",children:[e.jsx("div",{className:"px-6 py-5 bg-background border-b border-border/80 shadow-sm",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-violet-500 to-indigo-600 flex items-center justify-center shadow-lg shadow-violet-200",children:e.jsx(Qs,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:l("chatUI.resourceSelector.title")}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:l("chatUI.resourceSelector.subtitle")})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[c.length>0&&e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 flex items-center justify-center",children:e.jsx(Ft,{className:"w-4 h-4 text-blue-600"})}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:l("chatUI.resourceSelector.charts")}
3333),e.jsxs("span",{className:"text-xs text-muted-foreground/60 ml-1",children:["(",c.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:c.map(D=>e.jsx(pl,{chart:D,selected:a.has(D.id),onToggle:()=>x(D.id)},D.id))})]}),o.length>0&&e.jsxs("div",{className:"p-6 pt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-emerald-100 flex items-center justify-center",children:e.jsx(et,{className:"w-4 h-4 text-emerald-600"})}),e.jsx("h3",{className:"text-base font-semibold text-foreground",children:l("chatUI.resourceSelector.images")}),e.jsxs("span",{className:"text-xs text-muted-foreground/60 ml-1",children:["(",o.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(D=>e.jsx(ul,{image:D,selected:i.has(D.id),onToggle:()=>g(D.id)},D.id))})]}),c.length===0&&o.length===0&&e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground/60",children:e.jsx("p",{children:l("chatUI.resourceSelector.noMaterial")})})]}),e.jsx("div",{className:"px-6 py-4 bg-background border-t border-border/80 shadow-[0_-4px_20px_-4px_rgba(0,0,0,0.05)]",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-violet-500/10 rounded-full",children:[e.jsx(Me,{className:"w-4 h-4 text-violet-600"}),e.jsx("span",{className:"text-sm font-medium text-violet-700 dark:text-violet-400",children:l("chatUI.resourceSelector.selected",{selected:C,total:w})})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:n,className:"px-5 py-2.5 text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-muted rounded-xl transition-all",children:l("chatUI.resourceSelector.cancel")}),e.jsxs("button",{onClick:b,disabled:r,className:`group flex items-center gap-2 px-6 py-2.5 text-sm font-semibold rounded-xl transition-all ${r?"text-muted-foreground/60 bg-muted cursor-not-allowed":"text-white bg-gradient-to-r from-violet-600 to-indigo-600 hover:from-violet-700 hover:to-indigo-700 shadow-lg shadow-violet-200 hover:shadow-xl hover:shadow-violet-300"}`,title:r?l("chatUI.resourceSelector.complete"):"",children:[e.jsx("span",{children:l("chatUI.resourceSelector.next")}),e.jsx(Qt,{className:"w-4 h-4 group-hover:translate-x-0.5 transition-transform"})]})]})]})})]})}function pl({chart:t,selected:s,onToggle:n}){const{t:r}=ve();return e.jsxs("div",{onClick:n,className:` 3334 group relative rounded-2xl cursor-pointer transition-all duration-300 overflow-hidden 3335 ${s?"ring-2 ring-violet-500 ring-offset-2 shadow-lg shadow-violet-100":"hover:shadow-lg hover:shadow-lg border border-border/80"} 3336 `,children:[e.jsxs("div",{className:"aspect-[4/3] bg-background relative",children:[e.jsx(ml,{chart:t}),e.jsx("div",{className:` 3337 absolute inset-0 transition-all duration-300 3338 ${s?"bg-violet-500/5":"bg-transparent group-hover:bg-foreground
3338/5"} 3339 `}),e.jsx("div",{className:` 3340 absolute top-3 right-3 w-7 h-7 rounded-full flex items-center justify-center transition-all duration-300 3341 ${s?"bg-violet-600 scale-100 shadow-lg":"bg-background/90 backdrop-blur-sm border-2 border-border scale-90 group-hover:scale-100"} 3342 `,children:s&&e.jsx(Me,{className:"w-4 h-4 text-white",strokeWidth:3})}),t.recommended&&e.jsxs("div",{className:"absolute top-3 left-3 flex items-center gap-1 px-2 py-1 bg-amber-400 rounded-full shadow-sm",children:[e.jsx(ln,{className:"w-3 h-3 text-white fill-white"}),e.jsx("span",{className:"text-xs font-medium text-white",children:r("chatUI.recommended")})]})]}),e.jsxs("div",{className:"p-4 bg-background border-t border-border",children:[e.jsx("h4",{className:"font-semibold text-foreground text-sm",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1",children:t.description}),e.jsx("div",{className:"mt-2 flex items-center gap-1.5",children:e.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-md",children:t.type==="bar"?r("chatUI.chartType.bar"):t.type==="pie"?r("chatUI.chartType.pie"):t.type==="line"?r("chatUI.chartType.line"):r("chatUI.chartType.default")})})]})]})}function ul({image:t,selected:s,onToggle:n}){const[r,l]=u.useState(!1),[c,o]=u.useState(!1);return e.jsx("div",{onClick:n,className:` 3343 group relative rounded-xl cursor-pointer transition-all duration-300 overflow-hidden 3344 ${s?"ring-2 ring-emerald-500 ring-offset-2 shadow-lg shadow-emerald-100":"hover:shadow-lg hover:shadow-lg border border-border/80"} 3345 `,children:e.jsxs("div",{className:"aspect-[4/3] bg-muted relative overflow-hidden",children:[!r&&!c&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"w-8 h-8 border-3 border-emerald-500 border-t-transparent rounded-full animate-spin"})}),c?e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground/60",children:e.jsx(et,{className:"w-8 h-8 opacity-50"})}):e.jsx("img",{src:t.thumbnailUrl||t.url,alt:"",className:` 3346 w-full h-full object-cover transition-all duration-500 3347 ${r?"opacity-100 scale-100":"opacity-0 scale-105"} 3348 group-hover:scale-105 3349 `,onLoad:()=>l(!0),onError:()=>o(!0)}),e.jsx("div",{className:` 3350 absolute inset-0 transition-all duration-300 3351 ${s?"bg-emerald-500/10":"bg-transparent group-hover:bg-foreground
3351/10"} 3352 `}),e.jsx("div",{className:` 3353 absolute top-3 right-3 w-7 h-7 rounded-full flex items-center justify-center transition-all duration-300 3354 ${s?"bg-emerald-600 scale-100 shadow-lg":"bg-background/90 backdrop-blur-sm border-2 border-border scale-90 group-hover:scale-100"} 3355 `,children:s&&e.jsx(Me,{className:"w-4 h-4 text-white",strokeWidth:3})})]})})}function ml({chart:t}){const s=u.useRef(null),n=u.useRef(null);return u.useEffect(()=>{if(!s.current)return;n.current=Gr(s.current,void 0,{renderer:"canvas"});const r=t.echartsOption||{},l={...r,animation:!0,animationDuration:800,animationEasing:"cubicOut",color:r.color||["#6366f1","#8b5cf6","#a78bfa","#c4b5fd","#ddd6fe"],grid:{top:20,right:20,bottom:30,left:50,containLabel:!1},tooltip:{...r.tooltip||{},backgroundColor:"rgba(255, 255, 255, 0.95)",borderColor:"#e5e7eb",borderWidth:1,textStyle:{color:"#374151",fontSize:12},boxShadow:"0 4px 20px rgba(0, 0, 0, 0.1)"},xAxis:r.xAxis?{...r.xAxis,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#9ca3af",fontSize:10},splitLine:{show:!1}}:void 0,yAxis:r.yAxis?{...r.yAxis,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#9ca3af",fontSize:10},splitLine:{lineStyle:{color:"#f3f4f6",type:"dashed"}}}:void 0,series:Array.isArray(r.series)?r.series.map(o=>({...o,...o.type==="bar"?{itemStyle:{borderRadius:[4,4,0,0],...o.itemStyle||{}},barWidth:"60%"}:{},...o.type==="pie"?{radius:["45%","75%"],itemStyle:{borderRadius:6,borderColor:"#fff",borderWidth:2,...o.itemStyle||{}},label:{show:!1}}:{}})):r.series};n.current.setOption(l);const c=new ResizeObserver(()=>{var o;(o=n.current)==null||o.resize()});return c.observe(s.current),()=>{var o;c.disconnect(),(o=n.current)==null||o.dispose()}},[t.echartsOption]),e.jsx("div",{ref:s,className:"w-full h-full"})}const xl={cover:e.jsx(Ue,{className:"w-4 h-4"}),section:e.jsx(Wt,{className:"w-4 h-4"}),content:e.jsx(Ue,{className:"w-4 h-4"}),stats:e.jsx(Ft,{className:"w-4 h-4"}),chart:e.jsx(Ft,{className:"w-4 h-4"}),"image-left":e.jsx(et,{className:"w-4 h-4"}),"image-right":e.jsx(et,{className:"w-4 h-4"}),"full-image":e.jsx(et,{className:"w-4 h-4"}),quote:e.jsx(Ws,{className:"w-4 h-4"}),timeline:e.jsx(Ks,{className:"w-4 h-4"}),comparison:e.jsx(Wt,{className:"w-4 h-4"}),end:e.jsx(Pr,{className:"w-4 h-4"})};function hl(){const{t}=ve();return{cover:t("outline.slideTypes.cover"),section:t("outline.slideTypes.section"),content:t("outline.slideTypes.content"),stats:t("outline.slideTypes.stats"),chart:t("outline.slideTypes.chart"),"image-left":t("outline.slideTypes.imageLeft"),"image-right":t("outline.slideTypes.imageRight"),"full-image":t("outline.slideTypes.fullImage"),quote:t("outline.slideTypes.quote"),timeline:t("outline.slideTypes.timeline"),comparison:t("outline.slideTypes.comparison"),end:t("outline.slideTypes.end")}}function gl({data:t,onConfirm:s,onRegenerate:n,onCancel:r,readOnly:l}){const{t:c}=ve(),o=hl(),[d,a]=u.useState(t.outline),[p,i]=u.useState(null),[m,x]=u.useState(""),[g,b]=u.useState(!1),[C,w]=u.useState(""),[D,R]=u.useState(null),[B,Z]=u.useState(null),M=u.useRef(null),k=$=>{i($.id),x($.title)},v=()=>{p&&(a($=>$.map(K=>K.id===p?{...K,title:m}:K)),i(null),x(""))},S=()=>{i(null),x("")},J=$=>{a(K=>
3355K.filter(F=>F.id!==$))},H=($,K)=>{R(K),M.current=$.currentTarget,$.dataTransfer.effectAllowed="move",$.dataTransfer.setData("text/plain",K.toString()),setTimeout(()=>{M.current&&(M.current.style.opacity="0.5")},0)},f=()=>{M.current&&(M.current.style.opacity="1"),R(null),Z(null),M.current=null},y=($,K)=>{$.preventDefault(),$.dataTransfer.dropEffect="move",!(D===null||D===K)&&Z(K)},L=()=>{Z(null)},E=($,K)=>{if($.preventDefault(),D===null||D===K){Z(null);return}a(F=>{const P=[...F],[A]=P.splice(D,1);return P.splice(K,0,A),P.map((T,I)=>({...T,index:I}))}),Z(null)},_=()=>{s(d)},Q=()=>{n(C||void 0),b(!1)};return e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsx("div",{className:"px-6 py-4 border-b border-border bg-gradient-to-r from-purple-50 via-indigo-50 to-pink-50",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-gradient-to-br from-purple-500 to-indigo-600 flex items-center justify-center shadow-lg",children:e.jsx(Hs,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:c("outline.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.message})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[e.jsx("div",{className:"space-y-2",children:d.map(($,K)=>e.jsx(fl,{item:$,index:K,isEditing:p===$.id,editingTitle:m,onEditTitleChange:x,onStartEdit:()=>k($),onSaveEdit:v,onCancelEdit:S,onDelete:()=>J($.id),isDragging:D===K,isDragOver:B===K,onDragStart:F=>H(F,K),onDragEnd:f,onDragOver:F=>y(F,K),onDragLeave:L,onDrop:F=>E(F,K),slideTypeLabels:o},$.id))}),d.length===0&&e.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground/60",children:e.jsx("p",{children:c("outline.emptyContent")})})]}),(t.unusedResources.chartIds.length>0||t.unusedResources.imageIds.length>0)&&e.jsx("div",{className:"px-4 py-2 bg-amber-500/10 border-t border-amber-500/20",children:e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:c("outline.unusedResources",{charts:t.unusedResources.chartIds.length,images:t.unusedResources.imageIds.length})})}),e.jsx("div",{className:"px-6 py-4 border-t border-border bg-muted/50/50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>b(!0),className:"flex items-center gap-1.5 px-3 py-2 text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-muted rounded-lg transition-colors",children:[e.jsx(Fr,{className:"w-4 h-4"}),c("outline.regenerate")]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:c("outline.pageCount",{count:d.length})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:c("outline.cancel")}),e.jsxs("button",{onClick:_,disabled:l,className:`flex items-center gap-2 px-5 py-2.5 text-sm font-medium rounded-xl transition-all ${l?"text-muted-foreground/60 bg-muted cursor-not-allowed":"text-white bg-gradient-to-r from-purple-500 to-indigo-600 hover:from-purple-600 hover:to-indigo-700 shadow-md hover:shadow-lg"}`,title:l?c("outline.readOnly"):"",children:[e.jsx("span",{children:c("outline.startGenerate")}),e.jsx(Qt,{className:"w-4 h-4"})]})]})]})}),g&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-background rounded-xl shadow-xl w-full max-w-md mx-4 overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border",children:e.jsx("h4",{className:"font-semibold text-foreground",children:c("outline.regenerateModal.title")})}),e.jsxs("div",{className:"p-4",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground mb-2",children:c("outline.regenerateModal.instructions")}),e.jsx("textarea",{value:C,onChange:$=>w($.target.value),placeholder:c("outline.regenerateModal.placeholder"),className:"w-full px-3 py-2 border border-border rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500 resize-none",rows:3,maxLength:500})]}),e.jsxs("div",{className:"px-4 py-3 bg-muted/50 flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>b(!1),className:"px-4 py-2 text-sm font-medium text-foreground bg-background border border-border rounded-lg hover:bg-muted/50",children:c("outline.regenerateModal.cancel")}),e.jsx("button",{onClick:Q,className:"px-4 py-2 text-sm font-medium text-white bg-purple-600 rounded-lg hover:bg-purple-700",children:c("outline.regenerateModal.confirm")})]})]})})]})}
3355function fl({item:t,index:s,isEditing:n,editingTitle:r,onEditTitleChange:l,onStartEdit:c,onSaveEdit:o,onCancelEdit:d,onDelete:a,isDragging:p,isDragOver:i,onDragStart:m,onDragEnd:x,onDragOver:g,onDragLeave:b,onDrop:C,slideTypeLabels:w}){var R;const{t:D}=ve();return e.jsxs("div",{draggable:!n,onDragStart:m,onDragEnd:x,onDragOver:g,onDragLeave:b,onDrop:C,className:` 3356 flex items-center gap-3 px-4 py-3 rounded-xl border-2 transition-all 3357 ${n?"border-purple-400 bg-purple-500/10 shadow-sm":i?"border-purple-400 bg-purple-500/10 border-dashed":p?"border-border bg-muted/50 opacity-50":"border-border bg-background hover:border-border hover:shadow-sm"} 3358 ${n?"":"cursor-grab active:cursor-grabbing"} 3359 `,children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground/60",children:[e.jsx(tr,{className:"w-4 h-4"}),e.jsx("span",{className:"w-6 h-6 rounded-full bg-muted flex items-center justify-center text-xs font-semibold text-muted-foreground",children:s+1})]}),e.jsx("div",{className:` 3360 w-9 h-9 rounded-lg flex items-center justify-center shrink-0 3361 ${bl(t.type)} 3362 `,children:xl[t.type]||e.jsx(Ue,{className:"w-4 h-4"})}),e.jsx("div",{className:"flex-1 min-w-0",children:n?e.jsx("input",{type:"text",value:r,onChange:B=>l(B.target.value),className:"w-full px-3 py-1.5 text-sm border border-purple-300 rounded-lg focus:ring-2 focus:ring-purple-500 focus:border-purple-500",autoFocus:!0,maxLength:500,onKeyDown:B=>{B.key==="Enter"&&!B.nativeEvent.isComposing&&o(),B.key==="Escape"&&d()}}):e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:t.title})}),e.jsx("span",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded-full shrink-0",children:w[t.type]||t.type}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[t.chartId&&e.jsx("span",{className:"w-6 h-6 rounded-lg bg-blue-100 flex items-center justify-center",title:D("outline.containsChart"),children:e.jsx(Ft,{className:"w-3.5 h-3.5 text-blue-600"})}),t.imageId&&e.jsx("span",{className:"w-6 h-6 rounded-lg bg-green-100 flex items-center justify-center",title:D("outline.containsImage"),children:e.jsx(et,{className:"w-3.5 h-3.5 text-green-600"})})]}),e.jsx("div",{className:"flex items-center gap-0.5 shrink-0",children:n?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:o,className:"p-1.5 text-green-600 hover:bg-green-100 rounded-lg transition-colors",title:D("common.save"),children:e.jsx(rs,{className:"w-4 h-4"})}),e.jsx("button",{onClick:d,className:"p-1.5 text-muted-foreground hover:bg-muted rounded-lg transition-colors",title:D("common.cancel"),children:e.jsx(Ee,{className:"w-4 h-4"})})]}):e.jsxs(e.Fragment,{children:[((R=t.editable)==null?void 0:R.title)&&e.jsx("button",{onClick:c,className:"p-1.5 text-muted-foreground/60 hover:text-purple-600 hover:bg-purple-100 rounded-lg transition-colors",title:D("common.edit"),children:e.jsx(an,{className:"w-4 h-4"})}),e.jsx("button",{onClick:a,className:"p-1.5 text-muted-foreground/60 hover:text-red-600 hover:bg-red-100 rounded-lg transition-colors",title:D("common.delete"),children:e.jsx(Qe,{className:"w-4 h-4"})})]})})]})}function bl(t){return{cover:"bg-purple-100 text-purple-600",section:"bg-blue-100 text-blue-600",content:"bg-muted text-muted-foreground",stats:"bg-orange-100 text-orange-600",chart:"bg-blue-100 text-blue-600","image-left":"bg-green-100 text-green-600","image-right":"bg-green-100 text-green-600",quote:"bg-pink-100 text-pink-600",timeline:"bg-amber-100 text-amber-600",comparison:"bg-indigo-100 text-indigo-600",end:"bg-emerald-100 text-emerald-600"}[t]||"bg-muted text-muted-foreground"}function yl({data:t,onConfirm:s,onModify:n,onCancel:r,readOnly:l}){var Z;const{t:c}=ve(),{requirements:o,architecture:d}=t,[a,p]=u.useState(new Set(["pages","tech"])),[i,m]=u.useState(!1),[x,g]=u.useState(""),[b,C]=u.useState(!1),w=()=>{b||(C(!0),s())},D=M=>{p(k=>{const v=new Set(k);return v.has(M)?v.delete(M):v.add(M),v})},R=()=>{x.trim()&&(n(x.trim()),m(!1),g(""))},B=({id:M,icon:k,title:v,count:S,color:J})=>e.jsxs("button",{onClick:()=>D(M),className:"w-full flex items-center gap-3 p-3 rounded-xl hover:bg-muted/50 transition-colors",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl ${J} flex items-center justify-center`,children:e.jsx(k,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:v}),S!==void 0&&e.jsx("span",{className:"text-xs text-muted-foreground
3362/60",children:c("architecture.itemCount",{count:S})})]}),a.has(M)?e.jsx(gt,{className:"w-5 h-5 text-muted-foreground/60"}):e.jsx(ot,{className:"w-5 h-5 text-muted-foreground/60"})]});return e.jsxs("div",{className:"h-full flex flex-col bg-muted/30",children:[e.jsx("div",{className:"px-6 py-5 bg-background border-b border-border/80 shadow-sm",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-12 h-12 rounded-2xl bg-gradient-to-br from-emerald-500 to-teal-600 flex items-center justify-center shadow-lg shadow-emerald-200",children:e.jsx(yt,{className:"w-6 h-6 text-white"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-xl font-bold text-foreground",children:o.projectName}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:c("architecture.subtitle",{type:o.websiteType.toUpperCase()})})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[e.jsxs("div",{className:"bg-background rounded-2xl p-4 shadow-sm border border-border",children:[e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:o.description}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:o.keyFeatures.slice(0,6).map((M,k)=>e.jsx("span",{className:"px-2.5 py-1 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 text-xs rounded-full font-medium",children:M},k))})]}),e.jsxs("div",{className:"bg-background rounded-2xl shadow-sm border border-border overflow-hidden",children:[e.jsx(B,{id:"tech",icon:Jt,title:c("architecture.techStack"),color:"bg-gradient-to-br from-violet-500 to-purple-600"}),a.has("tech")&&e.jsx("div",{className:"px-4 pb-4 grid grid-cols-2 gap-2",children:Object.entries(d.techStack).filter(([M,k])=>k&&k!=="None"&&k!=="none").map(([M,k])=>e.jsxs("div",{className:"flex items-center gap-2 p-2.5 bg-muted/50 rounded-xl",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-violet-400"}),e.jsxs("span",{className:"text-xs text-muted-foreground capitalize",children:[M,":"]}),e.jsx("span",{className:"text-xs font-medium text-foreground",children:k})]},M))})]}),e.jsxs("div",{className:"bg-background rounded-2xl shadow-sm border border-border overflow-hidden",children:[e.jsx(B,{id:"pages",icon:Wt,title:c("architecture.pageArchitecture"),count:((Z=d.pageArchitecture)==null?void 0:Z.length)||o.pages.length,color:"bg-gradient-to-br from-blue-500 to-indigo-600"}),a.has("pages")&&e.jsx("div",{className:"px-4 pb-4 space-y-3",children:(d.pageArchitecture||o.pages.map(M=>({path:M.path,name:M.name,components:M.components,sections:[],metadata:{title:M.name,description:M.description}}))).map((M,k)=>{var v;return e.jsxs("div",{className:"p-3 bg-muted/50 rounded-xl",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-100 flex items-center justify-center flex-shrink-0",children:e.jsx(Lt,{className:"w-4 h-4 text-blue-600"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:M.name}),e.jsx("code",{className:"text-xs text-muted-foreground/60 bg-muted/50 px-1.5 py-0.5 rounded",children:M.path}),M.isProtected&&e.jsx(Ir,{className:"w-3.5 h-3.5 text-amber-500"})]}),M.sections&&M.sections.length>0&&e.jsx("div",{className:"ml-10 space-y-1",children:M.sections.map((S,J)=>e.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-blue-400 mt-1.5 flex-shrink-0"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:S.name}),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["- ",S.description]})]})]},J))}),M.components&&M.components.length>0&&!((v=M.sections)!=null&&v.length)&&e.jsx("div",{className:"ml-10 flex flex-wrap gap-1",children:M.components.map((S,J)=>e.jsx("span",{className:"text-xs px-2 py-0.5 bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded",children:S},J))})]},k)})})]})]}),i&&e.jsx("div",{className:"px-4 py-3 bg-background border-t border-border",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("textarea",{value:x,onChange:M=>g(M.target.value),placeholder:c("architecture.modifyPlaceholder"),className:"flex-1 text-sm border border-border rounded-xl p-3 resize-none focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500",rows:3,maxLength:2e3,autoFocus:!0}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("button",{onClick:R,disabled:!x.trim(),className:"p-2.5 bg-emerald-500 text-white rounded-xl hover:bg-emerald-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:e.jsx(Me,{className:"w-5 h-5"})}),e.jsx("button",{onClick:()=>{m(!1),g("")},className:"p-2.5 bg-muted text-muted-foreground rounded-xl hover:bg-muted transition-colors",children:e.jsx(Ee,{className:"w-5 h-5"})})]})]})}),!l&&!i&&e.jsxs("div",{className:"px-4 py-4 bg-background border-t border-border flex gap-3",children:[e.jsxs("button",{onClick:()=>m(!0),className:"flex-1 flex items-center justify-center gap-2 py-3 px-4 bg-muted text-foreground rounded-xl font-medium hover:bg-muted transition-colors",children:[e.jsx(ft,{className:"w-4 h-4"}),c("architecture.modifyPlan")]}),e.jsx("button",{onClick:w,disabled:b,className:`flex-1 flex items-center justify-center gap-2 py-3 px-4 roun
3362ded-xl font-medium transition-all shadow-lg ${b?"bg-muted text-muted-foreground cursor-not-allowed":"bg-gradient-to-r from-emerald-500 to-teal-600 text-white hover:from-emerald-600 hover:to-teal-700 shadow-emerald-200"}`,children:b?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),c("architecture.generating")]}):e.jsxs(e.Fragment,{children:[c("architecture.confirmGenerate"),e.jsx(Qt,{className:"w-4 h-4"})]})})]}),l&&e.jsx("div",{className:"px-4 py-4 bg-background border-t border-border",children:e.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 px-4 bg-muted text-muted-foreground rounded-xl",children:[e.jsx(Me,{className:"w-4 h-4"}),c("architecture.confirmed")]})})]})}function ea(){const{t,i18n:s}=ve();yn();const{showPreview:n,selectedArtifact:r,selectedSessionId:l,updateArtifact:c,previewMode:o,closeConfirmation:d,setShowPreview:a}=zt(),{handleAgentEvent:p,currentSessionId:i,clearPendingConfirmation:m,updatePendingConfirmation:x,pendingConfirmation:g}=ge(f=>({handleAgentEvent:f.handleAgentEvent,currentSessionId:f.currentSessionId,clearPendingConfirmation:f.clearPendingConfirmation,updatePendingConfirmation:f.updatePendingConfirmation,pendingConfirmation:f.pendingConfirmation})),b=ge(f=>f.streaming.currentArtifacts),C=(g==null?void 0:g.sessionId)===i;u.useEffect(()=>{if(r&&b.length>0){const f=b.find(y=>y.id===r.id);f&&c(f)}},[b,r==null?void 0:r.id,c]);const w=u.useCallback(()=>{var Q,$,K;const f=ge.getState(),y=f.currentSessionId,L=f.messages,E=[...L].reverse().find(F=>F.role==="assistant"),_=(f.streaming.currentContent||"").trim();if(console.log("[finalizeStreamingMessage] Called. sessionId:",y),console.log("[finalizeStreamingMessage] streaming.currentContent length:",(Q=f.streaming.currentContent)==null?void 0:Q.length),console.log("[finalizeStreamingMessage] streamingContent (trimmed) length:",_.length),console.log("[finalizeStreamingMessage] messages count:",L.length),console.log("[finalizeStreamingMessage] lastAssistantMessage:",E==null?void 0:E.id,"content length:",($=E==null?void 0:E.content)==null?void 0:$.length),E&&_){console.log("[finalizeStreamingMessage] Will update message with content");const F=E.artifacts||[],P=(f.streaming.currentArtifacts||[]).filter(ae=>{if(ae.type==="presentation"){const pe=ae;return pe.slides&&pe.slides.length>0}return ae.type!=="search"}),A=[...F,...P.filter(ae=>!F.some(pe=>pe.id===ae.id))],T={content:_};A.length>0&&(T.artifacts=A),console.log("[finalizeStreamingMessage] Calling updateMessage with id:",E.id,"content length:",_.length),f.updateMessage(E.id,T);const V=ge.getState().messages.find(ae=>ae.id===E.id);console.log("[finalizeStreamingMessage] After updateMessage, message content length:",(K=V==null?void 0:V.content)==null?void 0:K.length),y&&ws.updateContent(y,E.id,_).catch(ae=>console.error("Failed to persist final message content:",ae));const ie=_.length,le=E.id,be=(ae=0)=>{var q;const ne=ge.getState().messages.find(O=>O.id===le),ee=((q=ne==null?void 0:ne.content)==null?void 0:q.length)||0;console.log(`[finalizeStreamingMessage] Check #${ae}: message content length: ${ee}, target: ${ie}`),ee>=ie||ae>=20?(console.log("[finalizeStreamingMessage] Now clearing streaming state, attempts:",ae),ge.getState().clearStreamingState()):setTimeout(()=>be(ae+1),50)};setTimeout(()=>be(0),100)}else console.log("[finalizeStreamingMessage] No lastAssistantMessage or empty content, clearing immediately"),ge.getState().clearStreamingState()},[]),D=u.useCallback(async(f,y)=>{var q,O;if(!i)return;const L=ge.getState(),E=L.pendingConfirmation,_=L.messages.filter(z=>z.role==="assistant").pop(),Q=(_==null?void 0:_.content)||"",$=L.streaming.currentContent||"",K=(E==null?void 0:E.preservedContent)||"",F=[$,K,Q].sort((z,se)=>se.length-z.length)[0],P=E==null?void 0:E.data,A=((q=P==null?void 0:P.charts)==null?void 0:q.length)||0,T=((O=P==null?void 0:P.images)==null?void 0:O.length)||0,I=((P==null?void 0:P.images)||[]).filter(z=>y.includes(z.id)),V=((P==null?void 0:P.charts)||[]).filter(z=>f.includes(z.id)),ie=I.length>0?` 3363 3364${t("pptProgress.selectedImages",{count:I.length})} 3365 3366${I.map(z=>``).join(" ")}`:"",le=V.length>0?` 3367 3368${t("pptProgress.selectedCharts",{count:V.length})}`:"",be=` 3369 3370${t("pptProgress.generatingOutline")}`,ae=F+ie+le+be,pe=F+ie+le;ge.setState(z=>({streaming:{...z.streaming,isStreaming:!0,currentContent:ae}}));const ne=[...L.messages].reverse().find(z=>z.role==="assistant");ne&&ws.updateContent(i,ne.id,pe).catch(z=>console.error("Failed to persist selected resources:",z)),d(),x({status:"processing",selectedInfo:{selectedChartsCount:f.length,selectedImagesCount:y.length,totalChartsCount:A,totalImagesCount:T,selectedImages:I,selectedCharts:V}});const ee=i;try{await Ar(ee,f,y,z=>p(z,ee),z=>{console.error("Resource confirm error:",z);const se=ge.getState().pendingConfirmation;(se==null?void 0:se.type)==="resource"&&m(),w()},()=>{const z=ge.getState().pendingConfirmation;(z==null?void 0:z.type)==="resource"&&m()},s.language)}catch(z){console.error("Failed to confirm resources:",z);const se=ge.getState().pendingConfirmation;(se==null?void 0:se.type)==="resource"&&m(),w()}},[i,g,d,x,m,p,w]),R=u.useCallback(async f=>{if(!i)return;const y=ge.getState(),L=y.pendingConfirmation,E=y.messages.filter(T=>
3370T.role==="assistant").pop(),_=(E==null?void 0:E.content)||"",Q=y.streaming.currentContent||"",$=(L==null?void 0:L.preservedContent)||"",F=[Q,$,_].sort((T,I)=>I.length-T.length)[0]+` 3371 3372${t("pptProgress.generatingContent")}`;ge.setState(T=>({streaming:{...T.streaming,isStreaming:!0,currentContent:F}})),d(),m();const P=async()=>{try{const I=[...await Or.getMessages(i)].reverse().find(V=>V.role==="assistant");if(I){const V=ge.getState(),ie=[...V.messages].reverse().find(q=>q.role==="assistant"),le=(ie==null?void 0:ie.artifacts)||[],be=(V.streaming.currentArtifacts||[]).filter(q=>{if(q.type==="presentation"){const O=q;return O.slides&&O.slides.length>0}return q.type!=="search"}),ae=[...le,...be.filter(q=>!le.some(O=>O.id===q.id))],pe=I.content||V.streaming.currentContent||"",te=I.artifacts||[],ne=te.length>0?te:ae;ie&&V.updateMessage(ie.id,{content:pe,artifacts:ne});const ee=zt.getState();if(ee.selectedArtifact){const q=ne.find(O=>{var z;return O.id===((z=ee.selectedArtifact)==null?void 0:z.id)});q&&ee.updateArtifact(q)}}}catch(T){console.error("Failed to fetch latest message:",T),w();return}ge.getState().clearStreamingState()},A=i;try{await js(A,f,"confirm",T=>p(T,A),T=>{console.error("Outline confirm error:",T),w()},()=>{P()},void 0,s.language)}catch(T){console.error("Failed to confirm outline:",T),w()}},[i,d,m,p,w]),B=u.useCallback(async f=>{if(!i)return;const y=ge.getState(),L=y.pendingConfirmation,E=y.messages.filter(A=>A.role==="assistant").pop(),_=(E==null?void 0:E.content)||"",Q=y.streaming.currentContent||"",$=(L==null?void 0:L.preservedContent)||"",F=[Q,$,_].sort((A,T)=>T.length-A.length)[0]+` 3373 3374${t("pptProgress.regeneratingOutline")}`;ge.setState(A=>({streaming:{...A.streaming,isStreaming:!0,currentContent:F}}));const P=i;try{await js(P,[],"regenerate",A=>p(A,P),A=>{console.error("Outline regenerate error:",A),w()},()=>{},f,s.language)}catch(A){console.error("Failed to regenerate outline:",A),w()}},[i,p,w]),Z=u.useCallback(async()=>{if(console.log("[handleArchitectureConfirm] Called, currentSessionId:",i),!i)return;const f=ge.getState(),y=f.pendingConfirmation,L=f.messages.filter(A=>A.role==="assistant").pop(),E=(L==null?void 0:L.content)||"",_=f.streaming.currentContent||"",Q=(y==null?void 0:y.preservedContent)||"",$=[_,Q,E].sort((A,T)=>T.length-A.length)[0];console.log("[handleArchitectureConfirm] streamContent length:",_.length),console.log("[handleArchitectureConfirm] dbContent length:",E.length),console.log("[handleArchitectureConfirm] baseContent length:",$.length);const K=$+` 3375 3376${t("pptProgress.architectureConfirmed")}`;console.log("[handleArchitectureConfirm] newContent length:",K.length),ge.setState(A=>({streaming:{...A.streaming,isStreaming:!0,currentContent:K}}));const F=ge.getState();console.log("[handleArchitectureConfirm] After setState, currentContent length:",F.streaming.currentContent.length),d(),m();const P=i;try{await Ns(P,"confirm",void 0,A=>p(A,P),A=>{console.error("Architecture confirm error:",A),w()},()=>{w()})}catch(A){console.error("Failed to confirm architecture:",A),w()}},[i,d,m,p,w]),M=u.useCallback(async f=>{if(!i)return;const y=ge.getState(),L=y.pendingConfirmation,E=y.messages.filter(A=>A.role==="assistant").pop(),_=(E==null?void 0:E.content)||"",Q=y.streaming.currentContent||"",$=(L==null?void 0:L.preservedContent)||"",F=[Q,$,_].sort((A,T)=>T.length-A.length)[0]+` 3377 3378${t("pptProgress.redesigningArchitecture")} 3379> ${f}`;ge.setState(A=>({streaming:{...A.streaming,isStreaming:!0,currentContent:F}})),d(),m();const P=i;try{await Ns(P,"modify",f,A=>p(A,P),A=>{console.error("Architecture modify error:",A),w()},()=>{})}catch(A){console.error("Failed to modify architecture:",A),w()}},[i,d,m,p,w]),k=u.useCallback(()=>{d(),m(),w()},[d,m,w]),v=u.useCallback(async()=>{var _;if(!i)return console.error("[handleGenerateLink] No session ID"),null;const f=zt.getState(),y=f.selectedArtifact;if(!y||y.type!=="website")return console.error("[handleGenerateLink] No website artifact selected"),null;const L=(_=y.files)==null?void 0:_.map(Q=>({path:Q.path,content:Q.content}));
3379if(!L||L.length===0)return console.error("[handleGenerateLink] No files in artifact"),null;console.log("[handleGenerateLink] Generating link for session:",i,"with",L.length,"files");let E=null;try{return await new Promise((Q,$)=>{Mr(i,K=>{var F;if(console.log("[handleGenerateLink] Event:",K.type,K.data),K.type==="artifact_update"){const P=K.data;(F=P==null?void 0:P.payload)!=null&&F.previewUrl&&(E=P.payload.previewUrl,console.log("[handleGenerateLink] Found previewUrl:",E))}},K=>{console.error("[handleGenerateLink] Error:",K),$(K)},()=>{console.log("[handleGenerateLink] Complete, URL:",E),Q()},L)}),E&&f.updateArtifact({...y,previewUrl:E}),E}catch(Q){return console.error("[handleGenerateLink] Failed:",Q),null}},[i]),S=!l||l===i,J=n&&(o.type==="artifact"&&r&&S||o.type==="resource-selector"&&(o.readOnly||C)||o.type==="outline-editor"&&(o.readOnly||C)||o.type==="website-architecture-confirm"&&(o.readOnly||C)||o.type==="website-preview"),H=()=>{var f;switch(o.type){case"resource-selector":return e.jsx(cl,{data:o.data,onConfirm:D,onCancel:d,readOnly:o.readOnly});case"outline-editor":return e.jsx(gl,{data:o.data,onConfirm:R,onRegenerate:B,onCancel:d,readOnly:o.readOnly});case"website-architecture-confirm":return e.jsx(yl,{data:o.data,onConfirm:Z,onModify:M,onCancel:k,readOnly:o.readOnly});case"website-preview":const y=o.data,L=b.find(_=>_.type==="website"&&_.id===((r==null?void 0:r.id)||(y==null?void 0:y.id))),E=L||((r==null?void 0:r.type)==="website"?r:y);return console.log("[Layout] website-preview render:",{streamingWebsiteId:L==null?void 0:L.id,selectedArtifactId:r==null?void 0:r.id,previewModeDataId:y==null?void 0:y.id,filesCount:((f=E==null?void 0:E.files)==null?void 0:f.length)||0,progress:E==null?void 0:E.progress}),e.jsx(nr,{artifact:E,onGenerateLink:v,onClose:()=>a(!1)});case"artifact":default:return r?e.jsx(dl,{artifact:r}):null}};return e.jsx("div",{className:"flex h-full bg-background",children:e.jsxs("main",{className:"flex-1 flex overflow-hidden",children:[e.jsx("div",{className:`flex-1 flex flex-col ${J?"w-1/2":"w-full"}`,children:e.jsx(_r,{})}),J&&e.jsxs("div",{className:"w-1/2 border-l border-border relative",children:[(o.type==="resource-selector"||o.type==="outline-editor"||o.type==="website-architecture-confirm")&&e.jsx("button",{onClick:()=>a(!1),className:"absolute top-4 right-4 z-20 p-2 bg-background/80 hover:bg-background rounded-lg shadow-sm transition-colors",title:t("appCommon.closePanel"),children:e.jsx(Ee,{className:"w-4 h-4"})}),H()]})]})})}export{ea as Layout};
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.