@json-to-office/jto 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/client/assets/{HomePage-D3vuZyJI.js → HomePage-jkIz_s7u.js} +4 -4
- package/dist/client/assets/{HomePage-D3vuZyJI.js.map → HomePage-jkIz_s7u.js.map} +1 -1
- package/dist/client/assets/{JsonEditorPage-Cqy_bBQ5.js → JsonEditorPage-DR8UoROz.js} +3 -3
- package/dist/client/assets/{JsonEditorPage-Cqy_bBQ5.js.map → JsonEditorPage-DR8UoROz.js.map} +1 -1
- package/dist/client/assets/{MonacoPluginProvider-BNFHf2Mg.js → MonacoPluginProvider-CE5NPGwN.js} +3 -3
- package/dist/client/assets/{MonacoPluginProvider-BNFHf2Mg.js.map → MonacoPluginProvider-CE5NPGwN.js.map} +1 -1
- package/dist/client/assets/{editor-CN0fauKm.js → editor-edmvhW9F.js} +2 -2
- package/dist/client/assets/{editor-CN0fauKm.js.map → editor-edmvhW9F.js.map} +1 -1
- package/dist/client/assets/{editor-monaco-json-HXjjUFz_.js → editor-monaco-json-CAlvfPc7.js} +2 -2
- package/dist/client/assets/{editor-monaco-json-HXjjUFz_.js.map → editor-monaco-json-CAlvfPc7.js.map} +1 -1
- package/dist/client/assets/{editor-refs-store-C7y0QHBG.js → editor-refs-store-DKOJcTAk.js} +2 -2
- package/dist/client/assets/{editor-refs-store-C7y0QHBG.js.map → editor-refs-store-DKOJcTAk.js.map} +1 -1
- package/dist/client/assets/index-DLlW4q4v.js +5 -0
- package/dist/client/assets/index-DLlW4q4v.js.map +1 -0
- package/dist/client/assets/{preview-BoIgsKxW.js → preview-zo-CHAU0.js} +2 -2
- package/dist/client/assets/{preview-BoIgsKxW.js.map → preview-zo-CHAU0.js.map} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/templates/media/tech-report/fonts/OFL.txt +93 -0
- package/package.json +7 -7
- package/dist/client/assets/index-ClBlf8v3.js +0 -5
- package/dist/client/assets/index-ClBlf8v3.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as u,j as e,c as T}from"./react-vendor-BmQ2Ko_D.js";import{S as O,c as y,h as V,F as $,A}from"./index-ClBlf8v3.js";import{S as k,B as oe,P as de,b as ue,D as me,c as xe,d as fe,e as he}from"./HomePage-D3vuZyJI.js";import{B as _}from"./editor-refs-store-C7y0QHBG.js";import{e as pe,Q as P,x as ge}from"./ui-vendor-DpjQWJgX.js";import{u as M,a as K,b as je,d as ve}from"./MonacoPluginProvider-BNFHf2Mg.js";import{ad as Q,ae as we}from"./radix-ui-DFNP5I4e.js";import"./query-vendor--rhYD8mC.js";import"./monaco-editor-DJsdM0WK.js";import"./state-vendor-Cq67_JbF.js";function X(s){const[t]=u.useState(()=>Date.now()),r=s??t,[a,n]=u.useState(()=>Date.now());return u.useEffect(()=>{const c=setInterval(()=>n(Date.now()),100);return()=>clearInterval(c)},[]),Math.max(0,(a-r)/1e3)}function be(s){var t,r;if(!s)return null;try{const a=JSON.parse(s);if(!a||typeof a!="object")return null;const n=new Map,c=[a];for(;c.length>0;){const l=c.pop();if(!l||typeof l!="object")continue;const{name:i,children:f}=l;typeof i=="string"&&n.set(i,(n.get(i)??0)+1),Array.isArray(f)&&c.push(...f)}const d=[["slide","slide","slides"],["section","section","sections"],["visual","visual","visuals"],["chart","chart","charts"],["image","image","images"],["table","table","tables"],["shape","shape","shapes"],["paragraph","paragraph","paragraphs"]].map(([l,i,f])=>{const x=n.get(l)??0;return{label:x===1?i:f,count:x}}).filter(l=>l.count>0).slice(0,5),m=(r=(t=a.props)==null?void 0:t.metadata)==null?void 0:r.title;return{title:typeof m=="string"?m:void 0,counts:d,visualCount:(n.get("visual")??0)+(n.get("chart")??0),imageCount:n.get("image")??0}}catch{return null}}function Ne(s){const t=[];return s&&s.visualCount>0&&t.push(`${s.visualCount} visual${s.visualCount===1?"":"s"} in this document ${s.visualCount===1?"is":"are"} rasterized on first build — later builds reuse the cached renders.`),s&&s.imageCount>3&&t.push("Large embedded images dominate build time — downscaling them speeds up iteration."),t.push("Re-running an unchanged document is served from the cache almost instantly.","Generation warnings, if any, will appear above the preview when the build completes."),t}const ye=()=>e.jsx("svg",{className:"h-3.5 w-3.5 text-success",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 8.5L6.5 12L13 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});function Se({className:s,currentStage:t="parsing",message:r,documentText:a,startedAt:n,onCancel:c}){const o=["parsing","building","rendering","finalizing"],d={parsing:"Validating JSON",building:"Building structure",rendering:"Rendering content",finalizing:"Finalizing document"},m=o.indexOf(t),l=X(n),i=u.useMemo(()=>be(a),[a]),f=u.useMemo(()=>Ne(i),[i]),x=l>3,w=Math.floor(Math.max(0,l-3)/5)%f.length;return e.jsxs("div",{className:y("p-6 max-w-lg mx-auto space-y-5",s),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(O,{size:"md"}),e.jsxs("div",{className:"space-y-0.5 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i!=null&&i.title?`Generating “${i.title}”`:"Generating document"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",role:"status","aria-live":"polite",children:r||`${d[t]}...`})]})]}),e.jsxs("span",{className:"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[l.toFixed(1),"s"]})]}),i&&i.counts.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5","aria-label":"Document contents",children:i.counts.map(({label:g,count:b})=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground tabular-nums",children:b}),g]},g))}),e.jsx("div",{className:"space-y-3",children:o.map((g,b)=>{const j=b===m,N=b<m;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:y(j?"text-primary font-medium":N?"text-muted-foreground":"text-muted-foreground/60"),children:d[g]}),N?e.jsx(ye,{}):j?e.jsx(O,{size:"sm",className:"h-3.5 w-3.5"}):e.jsx("span",{className:"h-3.5 w-3.5 rounded-full border border-muted-foreground/40"})]}),e.jsx("div",{className:"w-full bg-secondary rounded-full h-1.5 overflow-hidden",children:N?e.jsx("div",{className:"h-full w-full rounded-full bg-success"}):j?e.jsx("div",{className:"h-full w-2/5 rounded-full bg-primary animate-progress-indeterminate"}):null})]},g)})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-8",children:[e.jsx("p",{className:y("text-xs text-muted-foreground/80 italic transition-opacity duration-500",x?"opacity-100":"opacity-0"),children:f[w]}),c&&e.jsx(_,{variant:"outline",size:"sm",onClick:c,className:"shrink-0",children:"Cancel"})]})]})}function ke({mode:s,message:t,startedAt:r,onCancel:a,className:n}){const c=X(r);return e.jsxs("div",{className:y("flex flex-col items-center gap-2 rounded-md border bg-background/95 px-6 py-4 shadow-sm",n),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{size:"md"}),e.jsx("p",{className:"text-sm font-medium",role:"status","aria-live":"polite",children:s==="generating"?"Generating":"Rendering"}),e.jsxs("span",{className:"rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[c.toFixed(1),"s"]})]}),t&&e.jsx("p",{className:"max-w-xs text-center text-xs text-muted-foreground truncate",children:t}),s==="generating"&&a&&e.jsx(_,{variant:"outline",size:"sm",onClick:a,children:"Cancel"})]})}function Re({renderingLibrary:s,className:t}){const r=c=>{switch(c){case"LibreOffice":return{name:"LibreOffice",description:"Converting document to PDF locally..."};case"Office":return{name:"Microsoft Office",description:"Uploading file and loading Office viewer..."};case"Docs":return{name:"Google Docs",description:"Uploading file and loading Docs viewer..."};default:return{name:"Default",description:"Processing document..."}}},{name:a,description:n}=r(s);return e.jsxs("div",{className:y("flex flex-col items-center justify-center h-full p-8 space-y-4",t),children:[e.jsx(O,{size:"lg"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Rendering Preview"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Using ",a," renderer"]}),e.jsx("p",{className:"text-xs text-muted-foreground/80",children:n})]}),e.jsxs("div",{className:"w-full max-w-md space-y-3",children:[e.jsx(k,{className:"h-16 w-full"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-4 w-full"}),e.jsx(k,{className:"h-4 w-3/4"}),e.jsx(k,{className:"h-4 w-1/2"})]}),e.jsx(k,{className:"h-12 w-full"})]})]})}const Y=T.forwardRef(({isLoading:s,iframeSrc:t,iframeSrcDoc:r,isGenerating:a,generationProgress:n,generationDocumentText:c,generationStartedAt:o,onCancelGeneration:d},m)=>{const[l,i]=u.useState(!1);u.useEffect(()=>{i(!1)},[t,r]);const f=()=>{i(!0)},x=()=>{console.warn("Iframe failed to load content"),i(!1)},w=r?"allow-scripts allow-popups allow-forms":void 0,g=!!(t||r);return a&&!g?e.jsx("div",{className:"grow",children:e.jsx(Se,{currentStage:n==null?void 0:n.stage,message:n==null?void 0:n.message,documentText:c,startedAt:o,onCancel:d})}):s&&!g?e.jsx("div",{className:"grow",children:e.jsx(Re,{renderingLibrary:"LibreOffice"})}):g?e.jsxs("div",{className:"h-full w-full relative bg-white",children:[!l&&e.jsx("div",{className:"absolute inset-0 bg-muted/80 flex items-center justify-center z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading preview..."})]})}),(a||s)&&e.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-[2px] flex items-center justify-center z-20 transition-opacity duration-200",children:e.jsx(ke,{mode:a?"generating":"rendering",message:a?n==null?void 0:n.message:void 0,startedAt:a?o:void 0,onCancel:a?d:void 0})}),e.jsx("iframe",{ref:m,className:"w-full h-full border-0",style:{backgroundColor:"white",opacity:l?1:0,transition:"opacity 0.2s ease-in-out"},src:t,srcDoc:r,onLoad:f,onError:x,sandbox:w,title:"Document preview","aria-label":`Preview of rendered ${V.toLowerCase()}`},r?"srcdoc":"src")]}):null});Y.displayName="PreviewFrame";const Ee=T.memo(Y);function Ce({warnings:s,className:t}){const[r,a]=T.useState(!1);return!s||s.length===0?null:e.jsxs("div",{className:t,children:[e.jsxs("button",{type:"button",onClick:()=>a(!r),className:"flex w-full items-center gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-1.5 text-left transition-colors hover:bg-warning/20",children:[e.jsx(pe,{className:`h-3.5 w-3.5 text-warning transition-transform flex-shrink-0 ${r?"rotate-90":""}`}),e.jsx(P,{className:"h-3.5 w-3.5 text-warning flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-medium text-warning",children:[s.length," warning",s.length!==1?"s":""]})]}),r&&e.jsx("div",{className:"mt-1.5 space-y-1.5",children:s.map((n,c)=>e.jsxs("div",{className:"flex items-start gap-2 rounded-sm border bg-card px-3 py-2",children:[n.severity==="info"?e.jsx(ge,{className:"h-3.5 w-3.5 mt-0.5 text-data-blue flex-shrink-0"}):e.jsx(P,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("code",{className:"text-[11px] font-medium text-warning bg-warning/15 px-1 py-0.5 rounded-sm",children:n.component}),n.severity==="info"&&e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-data-blue font-medium",children:"info"})]}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground leading-relaxed",children:n.message}),n.context&&Object.keys(n.context).length>0&&e.jsxs("details",{className:"mt-1.5",children:[e.jsx("summary",{className:"text-[11px] text-muted-foreground/70 cursor-pointer hover:text-foreground",children:"Context"}),e.jsx("pre",{className:"mt-1 text-[11px] bg-header-bg p-1.5 rounded-sm overflow-x-auto text-muted-foreground",children:JSON.stringify(n.context,null,2)})]})]})]},c))})]})}const W={pptx:["default","dark","minimal"],docx:["minimal","corporate","modern"]};function Le({className:s}){var o;const t=M(d=>d.activeTab),r=M(d=>d.documentTypes),a=M(d=>d.documents),n=K(d=>d.customThemes),c=u.useMemo(()=>{var l,i,f;if(!t||r[t]==="application/json+theme")return null;const d=a.find(x=>x.name===t);if(!(d!=null&&d.text))return null;let m;try{m=(i=(l=JSON.parse(d.text))==null?void 0:l.props)==null?void 0:i.theme}catch{return null}if(typeof m!="string"||!m||(f=W[$])!=null&&f.includes(m))return null;for(const x of Object.values(n))if(x.valid&&x.name===m)return null;return m},[t,r,a,n]);return c?e.jsxs("div",{className:`flex items-start gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-2 ${s??""}`,children:[e.jsx(P,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 text-xs leading-relaxed",children:[e.jsxs("span",{className:"font-medium text-warning",children:["Theme"," ",e.jsx("code",{className:"bg-warning/20 px-1 py-0.5 rounded-sm text-warning",children:c})," ","is not available."]})," ",e.jsxs("span",{className:"text-warning/80",children:["Add it as a custom theme or use a built-in theme (",(o=W[$])==null?void 0:o.join(", "),"). The renderer will fall back to a default."]})]})]}):null}async function Me(s,t,r,a,n){const c=typeof r=="string"&&r.length>0;let o;if(c){let l;try{l=JSON.parse(r)}catch(f){throw new Error(`Invalid JSON document: ${f.message}`)}const i={jsonDefinition:l,customThemes:a??{},options:{sourceName:s,...n?{renderer:n}:{}}};o=await fetch(A.preview.libreofficeFromJson,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}else{const l=new FormData,i=$==="pptx"?".pptx":".docx";l.append("file",t,`${s}${i}`),o=await fetch(A.preview.libreoffice,{method:"POST",body:l})}if(!o.ok){let l=`LibreOffice preview failed (${o.status})`;try{const i=await o.json();i&&typeof i=="object"&&typeof i.error=="string"&&(l=i.error)}catch{}throw new Error(l)}const d=await o.blob();if(!d.size)throw new Error("LibreOffice preview returned an empty PDF");const m=URL.createObjectURL(d);return{iframeSrc:m,cleanup:()=>URL.revokeObjectURL(m)}}async function Oe(s,t,r,a,n){try{if(!t||t.size===0)throw new Error("Invalid or empty document blob");const c=await Me(s,t,r,a,n);return{status:"success",name:s,payload:c}}catch(c){const o=c instanceof Error?c.message:String(c);return{status:"error",name:s,payload:new Error(o)}}}const U=u.forwardRef(({className:s,value:t,...r},a)=>e.jsx(Q,{ref:a,className:y("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...r,children:e.jsx(we,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));U.displayName=Q.displayName;function Z(s){if(s===0)return"0 B";const t=1024,r=["B","KB","MB","GB"],a=Math.floor(Math.log(s)/Math.log(t));return parseFloat((s/Math.pow(t,a)).toFixed(2))+" "+r[a]}function Te(){const[s,t]=u.useState(null),[r,a]=u.useState(!0),[n,c]=u.useState(null);if(u.useEffect(()=>{const m=new AbortController,l=async()=>{try{const x=await fetch(A.cacheStats,{signal:m.signal});if(!x.ok)throw new Error("Failed to fetch cache stats");const w=await x.json();m.signal.aborted||(t(w.data),c(null))}catch(x){m.signal.aborted||(x instanceof Error&&x.name!=="AbortError"?c(x.message):(!(x instanceof Error)||x.name!=="AbortError")&&c("Failed to load cache stats"))}finally{m.signal.aborted||a(!1)}};l();const i=setInterval(l,5e3),f=()=>l();return window.addEventListener("cache:cleared",f),()=>{m.abort(),clearInterval(i),window.removeEventListener("cache:cleared",f)}},[]),r)return e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})});if(n)return e.jsxs("div",{className:"text-destructive p-4",children:["Error loading cache metrics: ",n]});if(!s)return null;const{document:o}=s,d=o.hitRate*100;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Hit Rate"})," ",e.jsxs("span",{className:"font-semibold text-base",children:[d.toFixed(1),"%"]}),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.hits," hits / ",o.misses," misses)"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Size"})," ",e.jsx("span",{className:"font-semibold",children:Z(o.size)}),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.itemCount," items)"]})]}),e.jsx(oe,{variant:o.enabled?"default":"secondary",children:o.enabled?"Enabled":"Disabled"})]}),e.jsx(U,{value:d,className:"h-2","aria-label":"Cache hit rate"}),s.rasterizer&&e.jsx(De,{data:s.rasterizer})]})}function De({data:s}){const t=s.diskHits+s.diskMisses;if(t+s.dedupedRequests+s.rendered+s.entries===0)return null;const a=s.hitRate*100,n=s.prepass?s.prepass.collected-s.prepass.unique:s.dedupedRequests;return e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Visual Rasterizer"}),e.jsxs("div",{className:"px-3 py-1.5 text-sm space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Disk cache"}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:t>0?`${a.toFixed(0)}% hit`:"no lookups"}),e.jsxs("span",{children:["(",s.diskHits," hits / ",s.diskMisses," misses)"]}),e.jsxs("span",{children:[s.entries," PNGs, ",Z(s.bytes)]})]})]}),e.jsx(U,{value:a,className:"h-1.5","aria-label":"Rasterizer disk cache hit rate"}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.rendered," rendered",s.failed>0?`, ${s.failed} failed`:""]}),e.jsxs("span",{children:[n," duplicate visual",n===1?"":"s"," deduped",s.prepass?` (${s.prepass.collected} collected → ${s.prepass.unique} unique)`:""]})]})]})]})}function Je(){var L,q;const{name:s,text:t,blob:r,renderer:a,isGenerating:n,generationProgress:c,generationStartedAt:o,cancelGeneration:d,globalError:m,cacheStatus:l,cacheHitRate:i,warnings:f,isRendering:x,isPreviewStale:w,editSequence:g,lastBuiltSequence:b,setOutput:j}=je(p=>p),N=M(p=>{var h;return p.activeTab&&p.documentTypes[p.activeTab]!=="application/json+theme"?(h=p.documents.find(I=>I.name===p.activeTab))==null?void 0:h.text:void 0}),H=K(p=>p.customThemes),G=u.useMemo(()=>{const p={};for(const h of Object.values(H))h.valid&&h.name&&h.parsed&&(p[h.name]=h.parsed);return p},[H]),[ee,se]=u.useState(void 0),[te,ne]=u.useState(void 0),[re,D]=u.useState(!1),ae=T.useRef(null),R=u.useRef(null),F=u.useRef(!1),E=u.useCallback(()=>{R.current&&(R.current(),R.current=null)},[]),C=u.useCallback(async(p,h,I,le,ce)=>{j({isRendering:!0,isPreviewStale:!1,globalError:void 0});try{const{status:S,payload:v}=await Oe(p,h,I,le,ce);if(S!=="success")throw v instanceof Error?v:new Error(String(v));E(),se(v.iframeSrc||void 0),ne(v.iframeSrcDoc||void 0),R.current=v.cleanup||null}catch(S){const v=S instanceof Error?S.message:String(S);let B=v;v.includes("Failed to fetch")?B="Network error: Unable to load required resources. Check if the server is running properly.":v.includes("timeout")&&(B="Render timeout: The rendering process took too long."),j({globalError:B})}finally{j({isRendering:!1})}},[j,E]),ie=u.useRef({name:s,blob:r,text:t,doRender:C});u.useEffect(()=>{ie.current={name:s,blob:r,text:t,doRender:C}});const z=u.useCallback(async()=>{F.current=!0,window.dispatchEvent(new CustomEvent("preview:flushAndBuild"))},[]);u.useEffect(()=>{if(!(!r||!s)){if(F.current){F.current=!1,C(s,r,t,G,a);return}j({isPreviewStale:!0})}},[r,s,t,G,a,C,j]),u.useEffect(()=>()=>{E()},[E]),u.useEffect(()=>{const p=()=>z(),h=()=>D(!0);return window.addEventListener("preview:manualRender",p),window.addEventListener("preview:showCacheMetrics",h),()=>{window.removeEventListener("preview:manualRender",p),window.removeEventListener("preview:showCacheMetrics",h)}},[z]);const J=((q=(L=ve)==null?void 0:L.getState)==null?void 0:q.call(L).useGlobalPreviewHeader)===!1;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-full flex-col",children:[J&&e.jsx(de,{name:(s==null?void 0:s.trim())||"Preview",blob:r,onManualRender:z,isGenerating:n,isRendering:x,onShowCacheMetrics:()=>D(!0),documentText:t,editorDocumentText:N,warnings:f}),!J&&e.jsx(ue,{}),(()=>{const p=(g??0)>(b??0),h=(w||p)&&!n&&!x;return(l&&l!=="UNKNOWN"||h)&&e.jsxs("div",{className:`px-3 py-1.5 flex items-center justify-between border-b overflow-hidden ${h?"bg-warning/10":"bg-header-bg"}`,children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0 truncate",children:l==="HIT"&&!h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success flex-shrink-0"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:"Cached"})]}):l==="MISS"&&!h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-accent2 flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["Fresh ",V.toLowerCase()]})]}):h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-warning flex-shrink-0"}),e.jsx("span",{className:"text-xs text-warning truncate",children:"Outdated — click Run"})]}):null}),!h&&i&&i!=="0.0%"&&e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0 ml-2",children:[i," hit rate"]})]})})(),e.jsx(Ce,{warnings:f,className:"mx-3 my-2"}),e.jsx(Le,{className:"mx-3 my-2"}),m&&!n?e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"max-w-md rounded-sm border-l-4 border-l-destructive bg-destructive/10 px-4 py-3 text-sm text-destructive",children:[e.jsx("p",{className:"font-medium mb-1",children:"Generation failed"}),e.jsx("p",{className:"text-xs text-destructive/80 break-words",children:m})]})}):e.jsx(Ee,{ref:ae,isLoading:!!x,iframeSrc:ee,iframeSrcDoc:te,isGenerating:!!n,generationProgress:c,generationDocumentText:N??t,generationStartedAt:o,onCancelGeneration:d})]}),e.jsx(me,{open:re,onOpenChange:D,children:e.jsxs(xe,{className:"max-w-2xl",children:[e.jsx(fe,{children:e.jsx(he,{children:"Cache Performance"})}),e.jsx(Te,{})]})})]})}export{Je as Preview};
|
|
2
|
-
//# sourceMappingURL=preview-
|
|
1
|
+
import{r as u,j as e,c as T}from"./react-vendor-BmQ2Ko_D.js";import{S as O,c as y,h as V,F as $,A}from"./index-DLlW4q4v.js";import{S as k,B as oe,P as de,b as ue,D as me,c as xe,d as fe,e as he}from"./HomePage-jkIz_s7u.js";import{B as _}from"./editor-refs-store-DKOJcTAk.js";import{e as pe,Q as P,x as ge}from"./ui-vendor-DpjQWJgX.js";import{u as M,a as K,b as je,d as ve}from"./MonacoPluginProvider-CE5NPGwN.js";import{ad as Q,ae as we}from"./radix-ui-DFNP5I4e.js";import"./query-vendor--rhYD8mC.js";import"./monaco-editor-DJsdM0WK.js";import"./state-vendor-Cq67_JbF.js";function X(s){const[t]=u.useState(()=>Date.now()),r=s??t,[a,n]=u.useState(()=>Date.now());return u.useEffect(()=>{const c=setInterval(()=>n(Date.now()),100);return()=>clearInterval(c)},[]),Math.max(0,(a-r)/1e3)}function be(s){var t,r;if(!s)return null;try{const a=JSON.parse(s);if(!a||typeof a!="object")return null;const n=new Map,c=[a];for(;c.length>0;){const l=c.pop();if(!l||typeof l!="object")continue;const{name:i,children:f}=l;typeof i=="string"&&n.set(i,(n.get(i)??0)+1),Array.isArray(f)&&c.push(...f)}const d=[["slide","slide","slides"],["section","section","sections"],["visual","visual","visuals"],["chart","chart","charts"],["image","image","images"],["table","table","tables"],["shape","shape","shapes"],["paragraph","paragraph","paragraphs"]].map(([l,i,f])=>{const x=n.get(l)??0;return{label:x===1?i:f,count:x}}).filter(l=>l.count>0).slice(0,5),m=(r=(t=a.props)==null?void 0:t.metadata)==null?void 0:r.title;return{title:typeof m=="string"?m:void 0,counts:d,visualCount:(n.get("visual")??0)+(n.get("chart")??0),imageCount:n.get("image")??0}}catch{return null}}function Ne(s){const t=[];return s&&s.visualCount>0&&t.push(`${s.visualCount} visual${s.visualCount===1?"":"s"} in this document ${s.visualCount===1?"is":"are"} rasterized on first build — later builds reuse the cached renders.`),s&&s.imageCount>3&&t.push("Large embedded images dominate build time — downscaling them speeds up iteration."),t.push("Re-running an unchanged document is served from the cache almost instantly.","Generation warnings, if any, will appear above the preview when the build completes."),t}const ye=()=>e.jsx("svg",{className:"h-3.5 w-3.5 text-success",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:e.jsx("path",{d:"M3 8.5L6.5 12L13 4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})});function Se({className:s,currentStage:t="parsing",message:r,documentText:a,startedAt:n,onCancel:c}){const o=["parsing","building","rendering","finalizing"],d={parsing:"Validating JSON",building:"Building structure",rendering:"Rendering content",finalizing:"Finalizing document"},m=o.indexOf(t),l=X(n),i=u.useMemo(()=>be(a),[a]),f=u.useMemo(()=>Ne(i),[i]),x=l>3,w=Math.floor(Math.max(0,l-3)/5)%f.length;return e.jsxs("div",{className:y("p-6 max-w-lg mx-auto space-y-5",s),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(O,{size:"md"}),e.jsxs("div",{className:"space-y-0.5 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i!=null&&i.title?`Generating “${i.title}”`:"Generating document"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",role:"status","aria-live":"polite",children:r||`${d[t]}...`})]})]}),e.jsxs("span",{className:"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[l.toFixed(1),"s"]})]}),i&&i.counts.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5","aria-label":"Document contents",children:i.counts.map(({label:g,count:b})=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground tabular-nums",children:b}),g]},g))}),e.jsx("div",{className:"space-y-3",children:o.map((g,b)=>{const j=b===m,N=b<m;return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:y(j?"text-primary font-medium":N?"text-muted-foreground":"text-muted-foreground/60"),children:d[g]}),N?e.jsx(ye,{}):j?e.jsx(O,{size:"sm",className:"h-3.5 w-3.5"}):e.jsx("span",{className:"h-3.5 w-3.5 rounded-full border border-muted-foreground/40"})]}),e.jsx("div",{className:"w-full bg-secondary rounded-full h-1.5 overflow-hidden",children:N?e.jsx("div",{className:"h-full w-full rounded-full bg-success"}):j?e.jsx("div",{className:"h-full w-2/5 rounded-full bg-primary animate-progress-indeterminate"}):null})]},g)})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 min-h-8",children:[e.jsx("p",{className:y("text-xs text-muted-foreground/80 italic transition-opacity duration-500",x?"opacity-100":"opacity-0"),children:f[w]}),c&&e.jsx(_,{variant:"outline",size:"sm",onClick:c,className:"shrink-0",children:"Cancel"})]})]})}function ke({mode:s,message:t,startedAt:r,onCancel:a,className:n}){const c=X(r);return e.jsxs("div",{className:y("flex flex-col items-center gap-2 rounded-md border bg-background/95 px-6 py-4 shadow-sm",n),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{size:"md"}),e.jsx("p",{className:"text-sm font-medium",role:"status","aria-live":"polite",children:s==="generating"?"Generating":"Rendering"}),e.jsxs("span",{className:"rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums","aria-hidden":"true",children:[c.toFixed(1),"s"]})]}),t&&e.jsx("p",{className:"max-w-xs text-center text-xs text-muted-foreground truncate",children:t}),s==="generating"&&a&&e.jsx(_,{variant:"outline",size:"sm",onClick:a,children:"Cancel"})]})}function Re({renderingLibrary:s,className:t}){const r=c=>{switch(c){case"LibreOffice":return{name:"LibreOffice",description:"Converting document to PDF locally..."};case"Office":return{name:"Microsoft Office",description:"Uploading file and loading Office viewer..."};case"Docs":return{name:"Google Docs",description:"Uploading file and loading Docs viewer..."};default:return{name:"Default",description:"Processing document..."}}},{name:a,description:n}=r(s);return e.jsxs("div",{className:y("flex flex-col items-center justify-center h-full p-8 space-y-4",t),children:[e.jsx(O,{size:"lg"}),e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Rendering Preview"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Using ",a," renderer"]}),e.jsx("p",{className:"text-xs text-muted-foreground/80",children:n})]}),e.jsxs("div",{className:"w-full max-w-md space-y-3",children:[e.jsx(k,{className:"h-16 w-full"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{className:"h-4 w-full"}),e.jsx(k,{className:"h-4 w-3/4"}),e.jsx(k,{className:"h-4 w-1/2"})]}),e.jsx(k,{className:"h-12 w-full"})]})]})}const Y=T.forwardRef(({isLoading:s,iframeSrc:t,iframeSrcDoc:r,isGenerating:a,generationProgress:n,generationDocumentText:c,generationStartedAt:o,onCancelGeneration:d},m)=>{const[l,i]=u.useState(!1);u.useEffect(()=>{i(!1)},[t,r]);const f=()=>{i(!0)},x=()=>{console.warn("Iframe failed to load content"),i(!1)},w=r?"allow-scripts allow-popups allow-forms":void 0,g=!!(t||r);return a&&!g?e.jsx("div",{className:"grow",children:e.jsx(Se,{currentStage:n==null?void 0:n.stage,message:n==null?void 0:n.message,documentText:c,startedAt:o,onCancel:d})}):s&&!g?e.jsx("div",{className:"grow",children:e.jsx(Re,{renderingLibrary:"LibreOffice"})}):g?e.jsxs("div",{className:"h-full w-full relative bg-white",children:[!l&&e.jsx("div",{className:"absolute inset-0 bg-muted/80 flex items-center justify-center z-10",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-foreground mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading preview..."})]})}),(a||s)&&e.jsx("div",{className:"absolute inset-0 bg-background/60 backdrop-blur-[2px] flex items-center justify-center z-20 transition-opacity duration-200",children:e.jsx(ke,{mode:a?"generating":"rendering",message:a?n==null?void 0:n.message:void 0,startedAt:a?o:void 0,onCancel:a?d:void 0})}),e.jsx("iframe",{ref:m,className:"w-full h-full border-0",style:{backgroundColor:"white",opacity:l?1:0,transition:"opacity 0.2s ease-in-out"},src:t,srcDoc:r,onLoad:f,onError:x,sandbox:w,title:"Document preview","aria-label":`Preview of rendered ${V.toLowerCase()}`},r?"srcdoc":"src")]}):null});Y.displayName="PreviewFrame";const Ee=T.memo(Y);function Ce({warnings:s,className:t}){const[r,a]=T.useState(!1);return!s||s.length===0?null:e.jsxs("div",{className:t,children:[e.jsxs("button",{type:"button",onClick:()=>a(!r),className:"flex w-full items-center gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-1.5 text-left transition-colors hover:bg-warning/20",children:[e.jsx(pe,{className:`h-3.5 w-3.5 text-warning transition-transform flex-shrink-0 ${r?"rotate-90":""}`}),e.jsx(P,{className:"h-3.5 w-3.5 text-warning flex-shrink-0"}),e.jsxs("span",{className:"text-xs font-medium text-warning",children:[s.length," warning",s.length!==1?"s":""]})]}),r&&e.jsx("div",{className:"mt-1.5 space-y-1.5",children:s.map((n,c)=>e.jsxs("div",{className:"flex items-start gap-2 rounded-sm border bg-card px-3 py-2",children:[n.severity==="info"?e.jsx(ge,{className:"h-3.5 w-3.5 mt-0.5 text-data-blue flex-shrink-0"}):e.jsx(P,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("code",{className:"text-[11px] font-medium text-warning bg-warning/15 px-1 py-0.5 rounded-sm",children:n.component}),n.severity==="info"&&e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-data-blue font-medium",children:"info"})]}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground leading-relaxed",children:n.message}),n.context&&Object.keys(n.context).length>0&&e.jsxs("details",{className:"mt-1.5",children:[e.jsx("summary",{className:"text-[11px] text-muted-foreground/70 cursor-pointer hover:text-foreground",children:"Context"}),e.jsx("pre",{className:"mt-1 text-[11px] bg-header-bg p-1.5 rounded-sm overflow-x-auto text-muted-foreground",children:JSON.stringify(n.context,null,2)})]})]})]},c))})]})}const W={pptx:["default","dark","minimal"],docx:["minimal","corporate","modern"]};function Le({className:s}){var o;const t=M(d=>d.activeTab),r=M(d=>d.documentTypes),a=M(d=>d.documents),n=K(d=>d.customThemes),c=u.useMemo(()=>{var l,i,f;if(!t||r[t]==="application/json+theme")return null;const d=a.find(x=>x.name===t);if(!(d!=null&&d.text))return null;let m;try{m=(i=(l=JSON.parse(d.text))==null?void 0:l.props)==null?void 0:i.theme}catch{return null}if(typeof m!="string"||!m||(f=W[$])!=null&&f.includes(m))return null;for(const x of Object.values(n))if(x.valid&&x.name===m)return null;return m},[t,r,a,n]);return c?e.jsxs("div",{className:`flex items-start gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-2 ${s??""}`,children:[e.jsx(P,{className:"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 text-xs leading-relaxed",children:[e.jsxs("span",{className:"font-medium text-warning",children:["Theme"," ",e.jsx("code",{className:"bg-warning/20 px-1 py-0.5 rounded-sm text-warning",children:c})," ","is not available."]})," ",e.jsxs("span",{className:"text-warning/80",children:["Add it as a custom theme or use a built-in theme (",(o=W[$])==null?void 0:o.join(", "),"). The renderer will fall back to a default."]})]})]}):null}async function Me(s,t,r,a,n){const c=typeof r=="string"&&r.length>0;let o;if(c){let l;try{l=JSON.parse(r)}catch(f){throw new Error(`Invalid JSON document: ${f.message}`)}const i={jsonDefinition:l,customThemes:a??{},options:{sourceName:s,...n?{renderer:n}:{}}};o=await fetch(A.preview.libreofficeFromJson,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)})}else{const l=new FormData,i=$==="pptx"?".pptx":".docx";l.append("file",t,`${s}${i}`),o=await fetch(A.preview.libreoffice,{method:"POST",body:l})}if(!o.ok){let l=`LibreOffice preview failed (${o.status})`;try{const i=await o.json();i&&typeof i=="object"&&typeof i.error=="string"&&(l=i.error)}catch{}throw new Error(l)}const d=await o.blob();if(!d.size)throw new Error("LibreOffice preview returned an empty PDF");const m=URL.createObjectURL(d);return{iframeSrc:m,cleanup:()=>URL.revokeObjectURL(m)}}async function Oe(s,t,r,a,n){try{if(!t||t.size===0)throw new Error("Invalid or empty document blob");const c=await Me(s,t,r,a,n);return{status:"success",name:s,payload:c}}catch(c){const o=c instanceof Error?c.message:String(c);return{status:"error",name:s,payload:new Error(o)}}}const U=u.forwardRef(({className:s,value:t,...r},a)=>e.jsx(Q,{ref:a,className:y("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...r,children:e.jsx(we,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));U.displayName=Q.displayName;function Z(s){if(s===0)return"0 B";const t=1024,r=["B","KB","MB","GB"],a=Math.floor(Math.log(s)/Math.log(t));return parseFloat((s/Math.pow(t,a)).toFixed(2))+" "+r[a]}function Te(){const[s,t]=u.useState(null),[r,a]=u.useState(!0),[n,c]=u.useState(null);if(u.useEffect(()=>{const m=new AbortController,l=async()=>{try{const x=await fetch(A.cacheStats,{signal:m.signal});if(!x.ok)throw new Error("Failed to fetch cache stats");const w=await x.json();m.signal.aborted||(t(w.data),c(null))}catch(x){m.signal.aborted||(x instanceof Error&&x.name!=="AbortError"?c(x.message):(!(x instanceof Error)||x.name!=="AbortError")&&c("Failed to load cache stats"))}finally{m.signal.aborted||a(!1)}};l();const i=setInterval(l,5e3),f=()=>l();return window.addEventListener("cache:cleared",f),()=>{m.abort(),clearInterval(i),window.removeEventListener("cache:cleared",f)}},[]),r)return e.jsx("div",{className:"flex items-center justify-center p-8",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})});if(n)return e.jsxs("div",{className:"text-destructive p-4",children:["Error loading cache metrics: ",n]});if(!s)return null;const{document:o}=s,d=o.hitRate*100;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Hit Rate"})," ",e.jsxs("span",{className:"font-semibold text-base",children:[d.toFixed(1),"%"]}),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.hits," hits / ",o.misses," misses)"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:"Size"})," ",e.jsx("span",{className:"font-semibold",children:Z(o.size)}),e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.itemCount," items)"]})]}),e.jsx(oe,{variant:o.enabled?"default":"secondary",children:o.enabled?"Enabled":"Disabled"})]}),e.jsx(U,{value:d,className:"h-2","aria-label":"Cache hit rate"}),s.rasterizer&&e.jsx(De,{data:s.rasterizer})]})}function De({data:s}){const t=s.diskHits+s.diskMisses;if(t+s.dedupedRequests+s.rendered+s.entries===0)return null;const a=s.hitRate*100,n=s.prepass?s.prepass.collected-s.prepass.unique:s.dedupedRequests;return e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-sm font-medium",children:"Visual Rasterizer"}),e.jsxs("div",{className:"px-3 py-1.5 text-sm space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:"Disk cache"}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:t>0?`${a.toFixed(0)}% hit`:"no lookups"}),e.jsxs("span",{children:["(",s.diskHits," hits / ",s.diskMisses," misses)"]}),e.jsxs("span",{children:[s.entries," PNGs, ",Z(s.bytes)]})]})]}),e.jsx(U,{value:a,className:"h-1.5","aria-label":"Rasterizer disk cache hit rate"}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.rendered," rendered",s.failed>0?`, ${s.failed} failed`:""]}),e.jsxs("span",{children:[n," duplicate visual",n===1?"":"s"," deduped",s.prepass?` (${s.prepass.collected} collected → ${s.prepass.unique} unique)`:""]})]})]})]})}function Je(){var L,q;const{name:s,text:t,blob:r,renderer:a,isGenerating:n,generationProgress:c,generationStartedAt:o,cancelGeneration:d,globalError:m,cacheStatus:l,cacheHitRate:i,warnings:f,isRendering:x,isPreviewStale:w,editSequence:g,lastBuiltSequence:b,setOutput:j}=je(p=>p),N=M(p=>{var h;return p.activeTab&&p.documentTypes[p.activeTab]!=="application/json+theme"?(h=p.documents.find(I=>I.name===p.activeTab))==null?void 0:h.text:void 0}),H=K(p=>p.customThemes),G=u.useMemo(()=>{const p={};for(const h of Object.values(H))h.valid&&h.name&&h.parsed&&(p[h.name]=h.parsed);return p},[H]),[ee,se]=u.useState(void 0),[te,ne]=u.useState(void 0),[re,D]=u.useState(!1),ae=T.useRef(null),R=u.useRef(null),F=u.useRef(!1),E=u.useCallback(()=>{R.current&&(R.current(),R.current=null)},[]),C=u.useCallback(async(p,h,I,le,ce)=>{j({isRendering:!0,isPreviewStale:!1,globalError:void 0});try{const{status:S,payload:v}=await Oe(p,h,I,le,ce);if(S!=="success")throw v instanceof Error?v:new Error(String(v));E(),se(v.iframeSrc||void 0),ne(v.iframeSrcDoc||void 0),R.current=v.cleanup||null}catch(S){const v=S instanceof Error?S.message:String(S);let B=v;v.includes("Failed to fetch")?B="Network error: Unable to load required resources. Check if the server is running properly.":v.includes("timeout")&&(B="Render timeout: The rendering process took too long."),j({globalError:B})}finally{j({isRendering:!1})}},[j,E]),ie=u.useRef({name:s,blob:r,text:t,doRender:C});u.useEffect(()=>{ie.current={name:s,blob:r,text:t,doRender:C}});const z=u.useCallback(async()=>{F.current=!0,window.dispatchEvent(new CustomEvent("preview:flushAndBuild"))},[]);u.useEffect(()=>{if(!(!r||!s)){if(F.current){F.current=!1,C(s,r,t,G,a);return}j({isPreviewStale:!0})}},[r,s,t,G,a,C,j]),u.useEffect(()=>()=>{E()},[E]),u.useEffect(()=>{const p=()=>z(),h=()=>D(!0);return window.addEventListener("preview:manualRender",p),window.addEventListener("preview:showCacheMetrics",h),()=>{window.removeEventListener("preview:manualRender",p),window.removeEventListener("preview:showCacheMetrics",h)}},[z]);const J=((q=(L=ve)==null?void 0:L.getState)==null?void 0:q.call(L).useGlobalPreviewHeader)===!1;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-full flex-col",children:[J&&e.jsx(de,{name:(s==null?void 0:s.trim())||"Preview",blob:r,onManualRender:z,isGenerating:n,isRendering:x,onShowCacheMetrics:()=>D(!0),documentText:t,editorDocumentText:N,warnings:f}),!J&&e.jsx(ue,{}),(()=>{const p=(g??0)>(b??0),h=(w||p)&&!n&&!x;return(l&&l!=="UNKNOWN"||h)&&e.jsxs("div",{className:`px-3 py-1.5 flex items-center justify-between border-b overflow-hidden ${h?"bg-warning/10":"bg-header-bg"}`,children:[e.jsx("div",{className:"flex items-center gap-2 min-w-0 truncate",children:l==="HIT"&&!h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success flex-shrink-0"}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:"Cached"})]}):l==="MISS"&&!h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-accent2 flex-shrink-0"}),e.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["Fresh ",V.toLowerCase()]})]}):h?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-warning flex-shrink-0"}),e.jsx("span",{className:"text-xs text-warning truncate",children:"Outdated — click Run"})]}):null}),!h&&i&&i!=="0.0%"&&e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0 ml-2",children:[i," hit rate"]})]})})(),e.jsx(Ce,{warnings:f,className:"mx-3 my-2"}),e.jsx(Le,{className:"mx-3 my-2"}),m&&!n?e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"max-w-md rounded-sm border-l-4 border-l-destructive bg-destructive/10 px-4 py-3 text-sm text-destructive",children:[e.jsx("p",{className:"font-medium mb-1",children:"Generation failed"}),e.jsx("p",{className:"text-xs text-destructive/80 break-words",children:m})]})}):e.jsx(Ee,{ref:ae,isLoading:!!x,iframeSrc:ee,iframeSrcDoc:te,isGenerating:!!n,generationProgress:c,generationDocumentText:N??t,generationStartedAt:o,onCancelGeneration:d})]}),e.jsx(me,{open:re,onOpenChange:D,children:e.jsxs(xe,{className:"max-w-2xl",children:[e.jsx(fe,{children:e.jsx(he,{children:"Cache Performance"})}),e.jsx(Te,{})]})})]})}export{Je as Preview};
|
|
2
|
+
//# sourceMappingURL=preview-zo-CHAU0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview-BoIgsKxW.js","sources":["../../../src/client/components/ui/loading-states.tsx","../../../src/client/components/playground/preview-frame.tsx","../../../src/client/components/playground/warnings-panel.tsx","../../../src/client/components/playground/unavailable-theme-warning.tsx","../../../src/client/lib/render.ts","../../../src/client/components/ui/progress.tsx","../../../src/client/components/cache-metrics.tsx","../../../src/client/components/playground/preview.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { cn } from '@/lib/utils';\nimport { Spinner } from './spinner';\nimport { Skeleton } from './skeleton';\nimport { Button } from './button';\n\ninterface LoadingOverlayProps {\n isLoading: boolean;\n children: React.ReactNode;\n message?: string;\n className?: string;\n}\n\nexport function LoadingOverlay({\n isLoading,\n children,\n message = 'Loading...',\n className,\n}: LoadingOverlayProps) {\n return (\n <div className={cn('relative', className)}>\n {children}\n {isLoading && (\n <div className=\"absolute inset-0 bg-background/80 backdrop-blur-sm flex items-center justify-center z-50\">\n <div className=\"flex flex-col items-center gap-2\">\n <Spinner size=\"lg\" />\n <p className=\"text-sm text-muted-foreground\">{message}</p>\n </div>\n </div>\n )}\n </div>\n );\n}\n\ninterface DocumentGenerationLoaderProps {\n className?: string;\n currentStage?: 'parsing' | 'building' | 'rendering' | 'finalizing';\n message?: string;\n /** Source JSON of the document being built — drives the content summary. */\n documentText?: string;\n /** Date.now() when the build started — drives the elapsed timer. */\n startedAt?: number;\n /** When provided, renders a Cancel button that aborts the build. */\n onCancel?: () => void;\n}\n\n/** Ticks every 100ms and returns whole elapsed seconds since `startedAt`. */\nfunction useElapsedSeconds(startedAt?: number): number {\n // Freeze the fallback start on first render so a caller that never passes\n // `startedAt` still gets a stable timer instead of one reset per render.\n const [fallbackStart] = useState(() => Date.now());\n const start = startedAt ?? fallbackStart;\n const [now, setNow] = useState(() => Date.now());\n useEffect(() => {\n const id = setInterval(() => setNow(Date.now()), 100);\n return () => clearInterval(id);\n }, []);\n return Math.max(0, (now - start) / 1000);\n}\n\ninterface DocumentSummary {\n title?: string;\n counts: { label: string; count: number }[];\n visualCount: number;\n imageCount: number;\n}\n\n/**\n * Walk a JTO document tree and count the component types worth narrating.\n * Best-effort: any parse/shape surprise returns null and the loader simply\n * omits the summary row.\n */\nfunction summarizeDocument(text?: string): DocumentSummary | null {\n if (!text) return null;\n try {\n const root = JSON.parse(text);\n if (!root || typeof root !== 'object') return null;\n const counts = new Map<string, number>();\n const stack: unknown[] = [root];\n while (stack.length > 0) {\n const node = stack.pop();\n if (!node || typeof node !== 'object') continue;\n const { name, children } = node as {\n name?: unknown;\n children?: unknown;\n };\n if (typeof name === 'string') {\n counts.set(name, (counts.get(name) ?? 0) + 1);\n }\n if (Array.isArray(children)) stack.push(...children);\n }\n // Ordered by how much each type usually tells the user about build cost.\n const interesting: [key: string, singular: string, plural: string][] = [\n ['slide', 'slide', 'slides'],\n ['section', 'section', 'sections'],\n ['visual', 'visual', 'visuals'],\n ['chart', 'chart', 'charts'],\n ['image', 'image', 'images'],\n ['table', 'table', 'tables'],\n ['shape', 'shape', 'shapes'],\n ['paragraph', 'paragraph', 'paragraphs'],\n ];\n const summary = interesting\n .map(([key, singular, plural]) => {\n const count = counts.get(key) ?? 0;\n return { label: count === 1 ? singular : plural, count };\n })\n .filter((entry) => entry.count > 0)\n .slice(0, 5);\n const title = (root as { props?: { metadata?: { title?: unknown } } }).props\n ?.metadata?.title;\n return {\n title: typeof title === 'string' ? title : undefined,\n counts: summary,\n visualCount: (counts.get('visual') ?? 0) + (counts.get('chart') ?? 0),\n imageCount: counts.get('image') ?? 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Rotating context lines shown once a build takes more than a moment. */\nfunction buildHints(summary: DocumentSummary | null): string[] {\n const hints: string[] = [];\n if (summary && summary.visualCount > 0) {\n hints.push(\n `${summary.visualCount} visual${summary.visualCount === 1 ? '' : 's'} in this document ${\n summary.visualCount === 1 ? 'is' : 'are'\n } rasterized on first build — later builds reuse the cached renders.`\n );\n }\n if (summary && summary.imageCount > 3) {\n hints.push(\n 'Large embedded images dominate build time — downscaling them speeds up iteration.'\n );\n }\n hints.push(\n 'Re-running an unchanged document is served from the cache almost instantly.',\n 'Generation warnings, if any, will appear above the preview when the build completes.'\n );\n return hints;\n}\n\nconst CheckIcon = () => (\n <svg\n className=\"h-3.5 w-3.5 text-success\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M3 8.5L6.5 12L13 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport function DocumentGenerationLoader({\n className,\n currentStage = 'parsing',\n message,\n documentText,\n startedAt,\n onCancel,\n}: DocumentGenerationLoaderProps) {\n const stages = ['parsing', 'building', 'rendering', 'finalizing'] as const;\n const stageLabels: Record<(typeof stages)[number], string> = {\n parsing: 'Validating JSON',\n building: 'Building structure',\n rendering: 'Rendering content',\n finalizing: 'Finalizing document',\n };\n\n const currentStageIndex = stages.indexOf(currentStage);\n const elapsed = useElapsedSeconds(startedAt);\n const summary = useMemo(\n () => summarizeDocument(documentText),\n [documentText]\n );\n const hints = useMemo(() => buildHints(summary), [summary]);\n // Hints appear only for builds long enough to leave the user wondering,\n // then rotate so a long rasterization pass keeps saying something new.\n const showHints = elapsed > 3;\n const hintIndex = Math.floor(Math.max(0, elapsed - 3) / 5) % hints.length;\n\n return (\n <div className={cn('p-6 max-w-lg mx-auto space-y-5', className)}>\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex items-center gap-3 min-w-0\">\n <Spinner size=\"md\" />\n <div className=\"space-y-0.5 min-w-0\">\n <p className=\"text-sm font-medium truncate\">\n {summary?.title\n ? `Generating “${summary.title}”`\n : 'Generating document'}\n </p>\n {/* The live region covers only the stage message — putting it on\n the container would re-announce the whole loader every 100ms\n elapsed-timer tick. */}\n <p\n className=\"text-xs text-muted-foreground truncate\"\n role=\"status\"\n aria-live=\"polite\"\n >\n {message || `${stageLabels[currentStage]}...`}\n </p>\n </div>\n </div>\n <span\n className=\"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums\"\n aria-hidden=\"true\"\n >\n {elapsed.toFixed(1)}s\n </span>\n </div>\n\n {summary && summary.counts.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\" aria-label=\"Document contents\">\n {summary.counts.map(({ label, count }) => (\n <span\n key={label}\n className=\"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs text-muted-foreground\"\n >\n <span className=\"font-medium text-foreground tabular-nums\">\n {count}\n </span>\n {label}\n </span>\n ))}\n </div>\n )}\n\n <div className=\"space-y-3\">\n {stages.map((stage, index) => {\n const isActive = index === currentStageIndex;\n const isCompleted = index < currentStageIndex;\n return (\n <div key={stage} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between text-xs\">\n <span\n className={cn(\n isActive\n ? 'text-primary font-medium'\n : isCompleted\n ? 'text-muted-foreground'\n : 'text-muted-foreground/60'\n )}\n >\n {stageLabels[stage]}\n </span>\n {isCompleted ? (\n <CheckIcon />\n ) : isActive ? (\n <Spinner size=\"sm\" className=\"h-3.5 w-3.5\" />\n ) : (\n <span className=\"h-3.5 w-3.5 rounded-full border border-muted-foreground/40\" />\n )}\n </div>\n <div className=\"w-full bg-secondary rounded-full h-1.5 overflow-hidden\">\n {isCompleted ? (\n <div className=\"h-full w-full rounded-full bg-success\" />\n ) : isActive ? (\n // Honest indeterminate sweep — we have no real progress\n // signal within a stage, so don't fake a full bar.\n <div className=\"h-full w-2/5 rounded-full bg-primary animate-progress-indeterminate\" />\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n\n <div className=\"flex items-center justify-between gap-3 min-h-8\">\n <p\n className={cn(\n 'text-xs text-muted-foreground/80 italic transition-opacity duration-500',\n showHints ? 'opacity-100' : 'opacity-0'\n )}\n >\n {hints[hintIndex]}\n </p>\n {onCancel && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={onCancel}\n className=\"shrink-0\"\n >\n Cancel\n </Button>\n )}\n </div>\n </div>\n );\n}\n\ninterface GenerationOverlayProps {\n mode: 'generating' | 'rendering';\n message?: string;\n startedAt?: number;\n onCancel?: () => void;\n className?: string;\n}\n\n/**\n * Compact card for the overlay shown on top of an existing preview while a\n * rebuild or re-render is in flight.\n */\nexport function GenerationOverlay({\n mode,\n message,\n startedAt,\n onCancel,\n className,\n}: GenerationOverlayProps) {\n const elapsed = useElapsedSeconds(startedAt);\n return (\n <div\n className={cn(\n 'flex flex-col items-center gap-2 rounded-md border bg-background/95 px-6 py-4 shadow-sm',\n className\n )}\n >\n <div className=\"flex items-center gap-2\">\n <Spinner size=\"md\" />\n {/* Live region on the label only — the elapsed badge ticks every\n 100ms and must not retrigger screen-reader announcements. */}\n <p className=\"text-sm font-medium\" role=\"status\" aria-live=\"polite\">\n {mode === 'generating' ? 'Generating' : 'Rendering'}\n </p>\n <span\n className=\"rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums\"\n aria-hidden=\"true\"\n >\n {elapsed.toFixed(1)}s\n </span>\n </div>\n {message && (\n <p className=\"max-w-xs text-center text-xs text-muted-foreground truncate\">\n {message}\n </p>\n )}\n {mode === 'generating' && onCancel && (\n <Button variant=\"outline\" size=\"sm\" onClick={onCancel}>\n Cancel\n </Button>\n )}\n </div>\n );\n}\n\ninterface PreviewLoadingProps {\n renderingLibrary?: string;\n className?: string;\n}\n\nexport function PreviewLoading({\n renderingLibrary,\n className,\n}: PreviewLoadingProps) {\n const getLibraryInfo = (library?: string) => {\n switch (library) {\n case 'LibreOffice':\n return {\n name: 'LibreOffice',\n description: 'Converting document to PDF locally...',\n };\n case 'Office':\n return {\n name: 'Microsoft Office',\n description: 'Uploading file and loading Office viewer...',\n };\n case 'Docs':\n return {\n name: 'Google Docs',\n description: 'Uploading file and loading Docs viewer...',\n };\n default:\n return { name: 'Default', description: 'Processing document...' };\n }\n };\n\n const { name, description } = getLibraryInfo(renderingLibrary);\n\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center h-full p-8 space-y-4',\n className\n )}\n >\n <Spinner size=\"lg\" />\n <div className=\"text-center space-y-2\">\n <p className=\"text-sm font-medium\">Rendering Preview</p>\n <p className=\"text-xs text-muted-foreground\">Using {name} renderer</p>\n <p className=\"text-xs text-muted-foreground/80\">{description}</p>\n </div>\n\n <div className=\"w-full max-w-md space-y-3\">\n <Skeleton className=\"h-16 w-full\" />\n <div className=\"space-y-2\">\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-3/4\" />\n <Skeleton className=\"h-4 w-1/2\" />\n </div>\n <Skeleton className=\"h-12 w-full\" />\n </div>\n </div>\n );\n}\n\ninterface InlineLoaderProps {\n message?: string;\n size?: 'sm' | 'md';\n className?: string;\n}\n\nexport function InlineLoader({\n message = 'Loading...',\n size = 'sm',\n className,\n}: InlineLoaderProps) {\n return (\n <div className={cn('flex items-center gap-2', className)}>\n <Spinner size={size} />\n <span className=\"text-sm text-muted-foreground\">{message}</span>\n </div>\n );\n}\n\ninterface FileOperationLoaderProps {\n operation: 'upload' | 'download' | 'save' | 'delete';\n fileName?: string;\n progress?: number;\n className?: string;\n}\n\nexport function FileOperationLoader({\n operation,\n fileName,\n progress,\n className,\n}: FileOperationLoaderProps) {\n const operationLabels = {\n upload: 'Uploading',\n download: 'Downloading',\n save: 'Saving',\n delete: 'Deleting',\n };\n\n return (\n <div\n className={cn(\n 'flex items-center gap-3 p-3 border rounded-sm bg-header-bg',\n className\n )}\n >\n <Spinner size=\"sm\" />\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium truncate\">\n {operationLabels[operation]} {fileName && `\"${fileName}\"`}\n </p>\n {progress !== undefined && (\n <div className=\"mt-1\">\n <div className=\"flex justify-between text-xs mb-1\">\n <span>{progress}%</span>\n <span className=\"text-muted-foreground\">\n {progress < 100 ? 'In progress...' : 'Complete'}\n </span>\n </div>\n <div className=\"w-full bg-secondary rounded-full h-1.5\">\n <div\n className=\"bg-primary h-1.5 rounded-full transition-all duration-300\"\n style={{ width: `${progress}%` }}\n />\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n","import React, { useEffect, useState } from 'react';\nimport {\n DocumentGenerationLoader,\n GenerationOverlay,\n PreviewLoading,\n} from '../ui/loading-states';\nimport { FORMAT_LABEL } from '../../lib/env';\n\nconst PreviewFrame = React.forwardRef<\n HTMLIFrameElement,\n {\n isLoading: boolean;\n iframeSrc?: string;\n iframeSrcDoc?: string;\n isGenerating?: boolean;\n generationProgress?: {\n stage: 'parsing' | 'building' | 'rendering' | 'finalizing';\n message?: string;\n };\n /** Source JSON being built — feeds the loader's content summary. */\n generationDocumentText?: string;\n /** Date.now() when the build started — feeds the elapsed timer. */\n generationStartedAt?: number;\n /** Aborts the in-flight build; renders a Cancel button when present. */\n onCancelGeneration?: () => void;\n }\n>(\n (\n {\n isLoading,\n iframeSrc,\n iframeSrcDoc,\n isGenerating,\n generationProgress,\n generationDocumentText,\n generationStartedAt,\n onCancelGeneration,\n },\n ref\n ) => {\n const [iframeLoaded, setIframeLoaded] = useState(false);\n\n // Reset iframe loaded state when content changes\n useEffect(() => {\n setIframeLoaded(false);\n }, [iframeSrc, iframeSrcDoc]);\n\n // Handle iframe load event\n const handleIframeLoad = () => {\n setIframeLoaded(true);\n };\n\n // Handle iframe errors\n const handleIframeError = () => {\n console.warn('Iframe failed to load content');\n setIframeLoaded(false);\n };\n\n // PDF blob URLs and remote viewers can be blocked by Chromium-based browsers\n // when loaded in a sandboxed iframe. Keep sandbox only for srcDoc-based preview.\n const iframeSandbox = iframeSrcDoc\n ? 'allow-scripts allow-popups allow-forms'\n : undefined;\n\n const hasContent = Boolean(iframeSrc || iframeSrcDoc);\n\n // Full-screen loaders only when no existing content\n if (isGenerating && !hasContent) {\n return (\n <div className=\"grow\">\n <DocumentGenerationLoader\n currentStage={generationProgress?.stage}\n message={generationProgress?.message}\n documentText={generationDocumentText}\n startedAt={generationStartedAt}\n onCancel={onCancelGeneration}\n />\n </div>\n );\n }\n\n if (isLoading && !hasContent) {\n return (\n <div className=\"grow\">\n <PreviewLoading renderingLibrary=\"LibreOffice\" />\n </div>\n );\n }\n\n if (hasContent) {\n return (\n <div className=\"h-full w-full relative bg-white\">\n {/* Loading overlay */}\n {!iframeLoaded && (\n <div className=\"absolute inset-0 bg-muted/80 flex items-center justify-center z-10\">\n <div className=\"text-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-foreground mx-auto mb-2\"></div>\n <p className=\"text-sm text-muted-foreground\">\n Loading preview...\n </p>\n </div>\n </div>\n )}\n {/* Generating/Rendering overlay on top of existing content */}\n {(isGenerating || isLoading) && (\n <div className=\"absolute inset-0 bg-background/60 backdrop-blur-[2px] flex items-center justify-center z-20 transition-opacity duration-200\">\n <GenerationOverlay\n mode={isGenerating ? 'generating' : 'rendering'}\n message={isGenerating ? generationProgress?.message : undefined}\n startedAt={isGenerating ? generationStartedAt : undefined}\n onCancel={isGenerating ? onCancelGeneration : undefined}\n />\n </div>\n )}\n {/* Key forces remount when switching between srcDoc (sandboxed) and\n src (blob URL, no sandbox) to avoid stale sandbox race condition */}\n <iframe\n key={iframeSrcDoc ? 'srcdoc' : 'src'}\n ref={ref}\n className=\"w-full h-full border-0\"\n style={{\n backgroundColor: 'white',\n // Fade in after load to prevent flash\n opacity: iframeLoaded ? 1 : 0,\n transition: 'opacity 0.2s ease-in-out',\n }}\n src={iframeSrc}\n srcDoc={iframeSrcDoc}\n onLoad={handleIframeLoad}\n onError={handleIframeError}\n // Security: sandbox srcDoc to prevent XSS from rendered HTML.\n // Blob URLs (src) must NOT be sandboxed without allow-same-origin.\n sandbox={iframeSandbox}\n // Accessibility\n title=\"Document preview\"\n aria-label={`Preview of rendered ${FORMAT_LABEL.toLowerCase()}`}\n />\n </div>\n );\n }\n return null;\n }\n);\n\nPreviewFrame.displayName = 'PreviewFrame';\nexport const PreviewFrameMemoized = React.memo(PreviewFrame);\n","import React from 'react';\nimport { AlertTriangle, Info, ChevronRight } from 'lucide-react';\nimport type { GenerationWarning } from '../../store/output-store';\n\ninterface WarningsPanelProps {\n warnings: GenerationWarning[] | null | undefined;\n className?: string;\n}\n\nexport function WarningsPanel({ warnings, className }: WarningsPanelProps) {\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n if (!warnings || warnings.length === 0) {\n return null;\n }\n\n return (\n <div className={className}>\n <button\n type=\"button\"\n onClick={() => setIsExpanded(!isExpanded)}\n className=\"flex w-full items-center gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-1.5 text-left transition-colors hover:bg-warning/20\"\n >\n <ChevronRight\n className={`h-3.5 w-3.5 text-warning transition-transform flex-shrink-0 ${isExpanded ? 'rotate-90' : ''}`}\n />\n <AlertTriangle className=\"h-3.5 w-3.5 text-warning flex-shrink-0\" />\n <span className=\"text-xs font-medium text-warning\">\n {warnings.length} warning{warnings.length !== 1 ? 's' : ''}\n </span>\n </button>\n\n {isExpanded && (\n <div className=\"mt-1.5 space-y-1.5\">\n {warnings.map((warning, index) => (\n <div\n key={index}\n className=\"flex items-start gap-2 rounded-sm border bg-card px-3 py-2\"\n >\n {warning.severity === 'info' ? (\n <Info className=\"h-3.5 w-3.5 mt-0.5 text-data-blue flex-shrink-0\" />\n ) : (\n <AlertTriangle className=\"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0\" />\n )}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-1.5\">\n <code className=\"text-[11px] font-medium text-warning bg-warning/15 px-1 py-0.5 rounded-sm\">\n {warning.component}\n </code>\n {warning.severity === 'info' && (\n <span className=\"text-[10px] uppercase tracking-wide text-data-blue font-medium\">\n info\n </span>\n )}\n </div>\n <p className=\"mt-0.5 text-xs text-muted-foreground leading-relaxed\">\n {warning.message}\n </p>\n {warning.context && Object.keys(warning.context).length > 0 && (\n <details className=\"mt-1.5\">\n <summary className=\"text-[11px] text-muted-foreground/70 cursor-pointer hover:text-foreground\">\n Context\n </summary>\n <pre className=\"mt-1 text-[11px] bg-header-bg p-1.5 rounded-sm overflow-x-auto text-muted-foreground\">\n {JSON.stringify(warning.context, null, 2)}\n </pre>\n </details>\n )}\n </div>\n </div>\n ))}\n </div>\n )}\n </div>\n );\n}\n","import { useMemo } from 'react';\nimport { AlertTriangle } from 'lucide-react';\nimport { useDocumentsStore } from '../../store/documents-store-provider';\nimport { useThemesStore } from '../../store/themes-store-provider';\nimport { FORMAT } from '../../lib/env';\n\n// Theme names registered in the server-side core packages. Documents may\n// reference these even without a matching customThemes entry.\nconst BUILTIN_THEMES: Record<string, readonly string[]> = {\n pptx: ['default', 'dark', 'minimal'],\n docx: ['minimal', 'corporate', 'modern'],\n};\n\nexport function UnavailableThemeWarning({ className }: { className?: string }) {\n const activeTab = useDocumentsStore((s) => s.activeTab);\n const documentTypes = useDocumentsStore((s) => s.documentTypes);\n const documents = useDocumentsStore((s) => s.documents);\n const customThemes = useThemesStore((s) => s.customThemes);\n\n const missingThemeName = useMemo(() => {\n if (!activeTab) return null;\n if (documentTypes[activeTab] === 'application/json+theme') return null;\n\n const doc = documents.find((d) => d.name === activeTab);\n if (!doc?.text) return null;\n\n let themeName: unknown;\n try {\n themeName = JSON.parse(doc.text)?.props?.theme;\n } catch {\n return null;\n }\n if (typeof themeName !== 'string' || !themeName) return null;\n\n if (BUILTIN_THEMES[FORMAT]?.includes(themeName)) return null;\n\n for (const ct of Object.values(customThemes)) {\n if (ct.valid && ct.name === themeName) return null;\n }\n\n return themeName;\n }, [activeTab, documentTypes, documents, customThemes]);\n\n if (!missingThemeName) return null;\n\n return (\n <div\n className={`flex items-start gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-2 ${className ?? ''}`}\n >\n <AlertTriangle className=\"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0\" />\n <div className=\"flex-1 min-w-0 text-xs leading-relaxed\">\n <span className=\"font-medium text-warning\">\n Theme{' '}\n <code className=\"bg-warning/20 px-1 py-0.5 rounded-sm text-warning\">\n {missingThemeName}\n </code>{' '}\n is not available.\n </span>{' '}\n <span className=\"text-warning/80\">\n Add it as a custom theme or use a built-in theme (\n {BUILTIN_THEMES[FORMAT]?.join(', ')}). The renderer will fall back to\n a default.\n </span>\n </div>\n </div>\n );\n}\n","import { FORMAT } from './env';\nimport { API_ENDPOINTS } from '../config/api';\n\nexport type RenderPayload = {\n iframeSrc?: string;\n iframeSrcDoc?: string;\n cleanup?: () => void;\n};\n\nasync function renderWithLibreOffice(\n name: string,\n blob: Blob,\n jsonText?: string,\n customThemes?: Record<string, unknown>,\n renderer?: string\n): Promise<RenderPayload> {\n // When we know the source JSON, hit the from-json endpoint. The server\n // generates + converts in one step and passes resolved fonts directly to\n // the LibreOffice font stager — embedded fonts render correctly in the PDF.\n // Falling back to the upload path is still useful if the JSON is lost or\n // we're previewing an externally-supplied file.\n const useJsonPath = typeof jsonText === 'string' && jsonText.length > 0;\n\n let response: Response;\n if (useJsonPath) {\n let jsonDefinition: unknown;\n try {\n jsonDefinition = JSON.parse(jsonText!);\n } catch (err) {\n throw new Error(`Invalid JSON document: ${(err as Error).message}`);\n }\n const body: Record<string, unknown> = {\n jsonDefinition,\n customThemes: customThemes ?? {},\n // sourceName lets the server resolve relative asset paths against the\n // discovered document's own directory (#142). Names only — the server\n // maps them to paths itself.\n //\n // `renderer` is what keeps the preview honest: the server regenerates\n // the document here, and without it the PDF on screen came from the\n // default backend while the download came from the selected one (#255).\n options: { sourceName: name, ...(renderer ? { renderer } : {}) },\n };\n response = await fetch(API_ENDPOINTS.preview.libreofficeFromJson, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n } else {\n const formData = new FormData();\n const ext = FORMAT === 'pptx' ? '.pptx' : '.docx';\n formData.append('file', blob, `${name}${ext}`);\n response = await fetch(API_ENDPOINTS.preview.libreoffice, {\n method: 'POST',\n body: formData,\n });\n }\n\n if (!response.ok) {\n let message = `LibreOffice preview failed (${response.status})`;\n try {\n const json = await response.json();\n if (json && typeof json === 'object' && typeof json.error === 'string') {\n message = json.error;\n }\n } catch {}\n throw new Error(message);\n }\n\n const pdfBlob = await response.blob();\n if (!pdfBlob.size) {\n throw new Error('LibreOffice preview returned an empty PDF');\n }\n\n const objectUrl = URL.createObjectURL(pdfBlob);\n return {\n iframeSrc: objectUrl,\n cleanup: () => URL.revokeObjectURL(objectUrl),\n };\n}\n\nexport function cleanupIframe(iframe: HTMLIFrameElement) {\n try {\n if (iframe.contentWindow) {\n iframe.contentWindow.location.replace('about:blank');\n }\n iframe.src = 'about:blank';\n iframe.srcdoc = '';\n if (iframe.parentNode) {\n iframe.parentNode.removeChild(iframe);\n }\n } catch (error) {\n console.warn('Error cleaning up iframe:', error);\n }\n}\n\nexport async function renderDocument(\n name: string,\n blob: Blob,\n jsonText?: string,\n customThemes?: Record<string, unknown>,\n renderer?: string\n) {\n try {\n if (!blob || blob.size === 0) {\n throw new Error('Invalid or empty document blob');\n }\n\n const payload = await renderWithLibreOffice(\n name,\n blob,\n jsonText,\n customThemes,\n renderer\n );\n\n return { status: 'success' as const, name, payload };\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return { status: 'error' as const, name, payload: new Error(errorMessage) };\n }\n}\n\n// Keep backward compat exports for pptx code\nexport const renderPptx = (name: string, blob: Blob) =>\n renderDocument(name, blob);\n","import * as React from 'react';\nimport * as ProgressPrimitive from '@radix-ui/react-progress';\nimport { cn } from '../../lib/utils';\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>\n>(({ className, value, ...props }, ref) => (\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\n 'relative h-4 w-full overflow-hidden rounded-full bg-secondary',\n className\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n className=\"h-full w-full flex-1 bg-primary transition-all\"\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n));\nProgress.displayName = ProgressPrimitive.Root.displayName;\n\nexport { Progress };\n","import { useEffect, useState } from 'react';\nimport { Badge } from './ui/badge';\nimport { Progress } from './ui/progress';\nimport { API_ENDPOINTS } from '../config/api';\n\ninterface CacheStats {\n document: {\n hits: number;\n misses: number;\n hitRate: number;\n size: number;\n itemCount: number;\n enabled: boolean;\n };\n rasterizer?: RasterizerCacheData;\n}\n\ninterface RasterizerCacheData {\n diskHits: number;\n diskMisses: number;\n hitRate: number;\n dedupedRequests: number;\n rendered: number;\n failed: number;\n entries: number;\n bytes: number;\n prepass?: {\n documents: number;\n collected: number;\n unique: number;\n };\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes === 0) return '0 B';\n const k = 1024;\n const sizes = ['B', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n}\n\nexport function CacheMetrics() {\n const [stats, setStats] = useState<CacheStats | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n const controller = new AbortController();\n\n const fetchData = async () => {\n try {\n const response = await fetch(API_ENDPOINTS.cacheStats, {\n signal: controller.signal,\n });\n if (!response.ok) throw new Error('Failed to fetch cache stats');\n const data = await response.json();\n\n if (!controller.signal.aborted) {\n setStats(data.data);\n setError(null);\n }\n } catch (err) {\n if (!controller.signal.aborted) {\n if (err instanceof Error && err.name !== 'AbortError') {\n setError(err.message);\n } else if (!(err instanceof Error) || err.name !== 'AbortError') {\n setError('Failed to load cache stats');\n }\n }\n } finally {\n if (!controller.signal.aborted) setLoading(false);\n }\n };\n\n fetchData();\n const interval = setInterval(fetchData, 5000);\n\n const handleCacheCleared = () => fetchData();\n window.addEventListener('cache:cleared', handleCacheCleared);\n\n return () => {\n controller.abort();\n clearInterval(interval);\n window.removeEventListener('cache:cleared', handleCacheCleared);\n };\n }, []);\n\n if (loading) {\n return (\n <div className=\"flex items-center justify-center p-8\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-primary\" />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"text-destructive p-4\">\n Error loading cache metrics: {error}\n </div>\n );\n }\n\n if (!stats) return null;\n\n const { document: doc } = stats;\n const hitRatePct = doc.hitRate * 100;\n\n return (\n <div className=\"space-y-4\">\n {/* Summary row */}\n <div className=\"flex items-center gap-6 text-sm\">\n <div>\n <span className=\"text-muted-foreground\">Hit Rate</span>{' '}\n <span className=\"font-semibold text-base\">\n {hitRatePct.toFixed(1)}%\n </span>\n <span className=\"text-muted-foreground ml-1\">\n ({doc.hits} hits / {doc.misses} misses)\n </span>\n </div>\n <div>\n <span className=\"text-muted-foreground\">Size</span>{' '}\n <span className=\"font-semibold\">{formatBytes(doc.size)}</span>\n <span className=\"text-muted-foreground ml-1\">\n ({doc.itemCount} items)\n </span>\n </div>\n <Badge variant={doc.enabled ? 'default' : 'secondary'}>\n {doc.enabled ? 'Enabled' : 'Disabled'}\n </Badge>\n </div>\n\n <Progress\n value={hitRatePct}\n className=\"h-2\"\n aria-label=\"Cache hit rate\"\n />\n\n {/* Visual rasterizer caches (disk PNG cache + batch dedupe) */}\n {stats.rasterizer && <RasterizerBreakdown data={stats.rasterizer} />}\n </div>\n );\n}\n\nfunction RasterizerBreakdown({ data }: { data: RasterizerCacheData }) {\n const lookups = data.diskHits + data.diskMisses;\n const activity =\n lookups + data.dedupedRequests + data.rendered + data.entries;\n if (activity === 0) return null;\n\n const hitRatePct = data.hitRate * 100;\n const dedupeSaved = data.prepass\n ? data.prepass.collected - data.prepass.unique\n : data.dedupedRequests;\n\n return (\n <div className=\"space-y-2\">\n <h4 className=\"text-sm font-medium\">Visual Rasterizer</h4>\n <div className=\"px-3 py-1.5 text-sm space-y-1.5\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-muted-foreground\">Disk cache</span>\n <div className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n <span>\n {lookups > 0 ? `${hitRatePct.toFixed(0)}% hit` : 'no lookups'}\n </span>\n <span>\n ({data.diskHits} hits / {data.diskMisses} misses)\n </span>\n <span>\n {data.entries} PNGs, {formatBytes(data.bytes)}\n </span>\n </div>\n </div>\n <Progress\n value={hitRatePct}\n className=\"h-1.5\"\n aria-label=\"Rasterizer disk cache hit rate\"\n />\n <div className=\"flex items-center justify-between text-xs text-muted-foreground\">\n <span>\n {data.rendered} rendered\n {data.failed > 0 ? `, ${data.failed} failed` : ''}\n </span>\n <span>\n {dedupeSaved} duplicate visual{dedupeSaved === 1 ? '' : 's'} deduped\n {data.prepass\n ? ` (${data.prepass.collected} collected → ${data.prepass.unique} unique)`\n : ''}\n </span>\n </div>\n </div>\n </div>\n );\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { PreviewFrameMemoized } from './preview-frame';\nimport { PreviewHeaderMemoized } from './preview-header';\nimport { WarningsPanel } from './warnings-panel';\nimport { UnavailableThemeWarning } from './unavailable-theme-warning';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/dialog';\nimport { Separator } from '../ui/separator';\nimport { useOutputStore } from '../../store/output-store-provider';\nimport { useSettingsStore } from '../../store/settings-store-provider';\nimport { renderDocument } from '../../lib/render';\nimport { useDocumentsStore } from '../../store/documents-store-provider';\nimport { useThemesStore } from '../../store/themes-store-provider';\nimport { CacheMetrics } from '../cache-metrics';\nimport { FORMAT_LABEL } from '../../lib/env';\n\nexport function Preview() {\n const {\n name,\n text,\n blob,\n renderer,\n isGenerating,\n generationProgress,\n generationStartedAt,\n cancelGeneration,\n globalError,\n cacheStatus,\n cacheHitRate,\n warnings,\n isRendering,\n isPreviewStale,\n editSequence,\n lastBuiltSequence,\n setOutput,\n } = useOutputStore((state) => state);\n // Editor text for \"Copy standard components\" — exists before the first Run,\n // unlike the output store's `text` (#155). Themes have no expansion.\n const editorDocumentText = useDocumentsStore((s) =>\n s.activeTab && s.documentTypes[s.activeTab] !== 'application/json+theme'\n ? s.documents.find((d) => d.name === s.activeTab)?.text\n : undefined\n );\n // Select the raw map (stable reference until themes mutate), then memoize\n // the transform. A selector that returns a freshly-constructed object on\n // every call would burn through Zustand's Object.is equality and retrigger\n // renders indefinitely.\n const customThemesMap = useThemesStore((state) => state.customThemes);\n const themesForServer = useMemo(() => {\n const out: Record<string, unknown> = {};\n for (const ct of Object.values(customThemesMap)) {\n if (ct.valid && ct.name && ct.parsed) out[ct.name] = ct.parsed;\n }\n return out;\n }, [customThemesMap]);\n\n const [iframeSrc, setIframeSrc] = useState<string | undefined>(undefined);\n const [iframeSrcDoc, setIframeSrcDoc] = useState<string | undefined>(\n undefined\n );\n const [showCacheMetrics, setShowCacheMetrics] = useState<boolean>(false);\n const iframeRef = React.useRef<HTMLIFrameElement>(null);\n\n const renderCleanupRef = useRef<(() => void) | null>(null);\n const pendingManualRenderRef = useRef(false);\n\n const cleanupRenderedPreview = useCallback(() => {\n if (renderCleanupRef.current) {\n renderCleanupRef.current();\n renderCleanupRef.current = null;\n }\n }, []);\n\n // Core render function\n const doRender = useCallback(\n async (\n docName: string,\n docBlob: Blob,\n docText?: string,\n themes?: Record<string, unknown>,\n renderer?: string\n ) => {\n setOutput({\n isRendering: true,\n isPreviewStale: false,\n globalError: undefined,\n });\n\n try {\n const { status, payload } = await renderDocument(\n docName,\n docBlob,\n docText,\n themes,\n renderer\n );\n\n if (status !== 'success') {\n throw payload instanceof Error ? payload : new Error(String(payload));\n }\n\n cleanupRenderedPreview();\n setIframeSrc(payload.iframeSrc || undefined);\n setIframeSrcDoc(payload.iframeSrcDoc || undefined);\n renderCleanupRef.current = payload.cleanup || null;\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n\n let displayMessage = errorMessage;\n if (errorMessage.includes('Failed to fetch')) {\n displayMessage =\n 'Network error: Unable to load required resources. Check if the server is running properly.';\n } else if (errorMessage.includes('timeout')) {\n displayMessage =\n 'Render timeout: The rendering process took too long.';\n }\n\n setOutput({ globalError: displayMessage });\n } finally {\n setOutput({ isRendering: false });\n }\n },\n [setOutput, cleanupRenderedPreview]\n );\n\n // Ref to always hold latest manual-render deps so the event listener never goes stale\n const manualRenderRef = useRef({ name, blob, text, doRender });\n useEffect(() => {\n manualRenderRef.current = { name, blob, text, doRender };\n });\n\n const handleManualRender = useCallback(async () => {\n // Set flag so blob-change effect renders the new blob when it arrives\n pendingManualRenderRef.current = true;\n // Flush debounces + trigger build via editor.tsx\n window.dispatchEvent(new CustomEvent('preview:flushAndBuild'));\n }, []); // stable — reads from ref\n\n // A new blob renders only when a Run asked for it. Converting through\n // LibreOffice costs a round trip, so an edit marks the preview stale and\n // waits rather than rebuilding under the author.\n useEffect(() => {\n if (!blob || !name) return;\n if (pendingManualRenderRef.current) {\n pendingManualRenderRef.current = false;\n // Use the backend captured with this blob, never the live picker: the\n // selection may have changed while generation was in flight (#255).\n doRender(name, blob, text, themesForServer, renderer);\n return;\n }\n setOutput({ isPreviewStale: true });\n }, [blob, name, text, themesForServer, renderer, doRender, setOutput]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n cleanupRenderedPreview();\n };\n }, [cleanupRenderedPreview]);\n\n // Listen for global header events (stable — handleManualRender never changes)\n useEffect(() => {\n const onManual = () => handleManualRender();\n const onShowCache = () => setShowCacheMetrics(true);\n\n window.addEventListener('preview:manualRender', onManual);\n window.addEventListener('preview:showCacheMetrics', onShowCache);\n return () => {\n window.removeEventListener('preview:manualRender', onManual);\n window.removeEventListener('preview:showCacheMetrics', onShowCache);\n };\n }, [handleManualRender]);\n\n const localHeaderVisible =\n (useSettingsStore as any)?.getState?.().useGlobalPreviewHeader === false;\n\n return (\n <>\n <div className=\"flex h-full flex-col\">\n {localHeaderVisible && (\n <PreviewHeaderMemoized\n name={name?.trim() || 'Preview'}\n blob={blob}\n onManualRender={handleManualRender}\n isGenerating={isGenerating}\n isRendering={isRendering}\n onShowCacheMetrics={() => setShowCacheMetrics(true)}\n documentText={text}\n editorDocumentText={editorDocumentText}\n warnings={warnings}\n />\n )}\n {/* The local header draws its own `border-b`; a standalone separator\n underneath it stacked two hairlines. */}\n {!localHeaderVisible && <Separator />}\n {/* Status Bar: cache + stale combined */}\n {(() => {\n const hasUnsyncedEdits =\n (editSequence ?? 0) > (lastBuiltSequence ?? 0);\n const isStale =\n (isPreviewStale || hasUnsyncedEdits) &&\n !isGenerating &&\n !isRendering;\n return (\n ((cacheStatus && cacheStatus !== 'UNKNOWN') || isStale) && (\n <div\n className={`px-3 py-1.5 flex items-center justify-between border-b overflow-hidden ${\n isStale ? 'bg-warning/10' : 'bg-header-bg'\n }`}\n >\n <div className=\"flex items-center gap-2 min-w-0 truncate\">\n {cacheStatus === 'HIT' && !isStale ? (\n <>\n <div className=\"h-1.5 w-1.5 rounded-full bg-success flex-shrink-0\" />\n <span className=\"text-xs text-muted-foreground truncate\">\n Cached\n </span>\n </>\n ) : cacheStatus === 'MISS' && !isStale ? (\n <>\n <div className=\"h-1.5 w-1.5 rounded-full bg-accent2 flex-shrink-0\" />\n <span className=\"text-xs text-muted-foreground truncate\">\n Fresh {FORMAT_LABEL.toLowerCase()}\n </span>\n </>\n ) : isStale ? (\n <>\n <div className=\"h-1.5 w-1.5 rounded-full bg-warning flex-shrink-0\" />\n <span className=\"text-xs text-warning truncate\">\n Outdated — click Run\n </span>\n </>\n ) : null}\n </div>\n {!isStale && cacheHitRate && cacheHitRate !== '0.0%' && (\n <span className=\"text-xs text-muted-foreground flex-shrink-0 ml-2\">\n {cacheHitRate} hit rate\n </span>\n )}\n </div>\n )\n );\n })()}\n {/* Warnings Panel */}\n <WarningsPanel warnings={warnings} className=\"mx-3 my-2\" />\n <UnavailableThemeWarning className=\"mx-3 my-2\" />\n {/* Generation Error — centered in preview area */}\n {globalError && !isGenerating ? (\n <div className=\"flex-1 flex items-center justify-center p-6\">\n <div className=\"max-w-md rounded-sm border-l-4 border-l-destructive bg-destructive/10 px-4 py-3 text-sm text-destructive\">\n <p className=\"font-medium mb-1\">Generation failed</p>\n <p className=\"text-xs text-destructive/80 break-words\">\n {globalError}\n </p>\n </div>\n </div>\n ) : (\n <PreviewFrameMemoized\n ref={iframeRef}\n isLoading={Boolean(isRendering)}\n iframeSrc={iframeSrc}\n iframeSrcDoc={iframeSrcDoc}\n isGenerating={Boolean(isGenerating)}\n generationProgress={generationProgress}\n generationDocumentText={editorDocumentText ?? text}\n generationStartedAt={generationStartedAt}\n onCancelGeneration={cancelGeneration}\n />\n )}\n </div>\n\n {/* Cache Metrics Dialog */}\n <Dialog open={showCacheMetrics} onOpenChange={setShowCacheMetrics}>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>Cache Performance</DialogTitle>\n </DialogHeader>\n <CacheMetrics />\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"names":["useElapsedSeconds","startedAt","fallbackStart","useState","start","now","setNow","useEffect","id","summarizeDocument","text","root","counts","stack","node","name","children","summary","key","singular","plural","count","entry","title","_b","_a","buildHints","hints","CheckIcon","jsx","DocumentGenerationLoader","className","currentStage","message","documentText","onCancel","stages","stageLabels","currentStageIndex","elapsed","useMemo","showHints","hintIndex","cn","jsxs","Spinner","label","stage","index","isActive","isCompleted","Button","GenerationOverlay","mode","PreviewLoading","renderingLibrary","getLibraryInfo","library","description","Skeleton","PreviewFrame","React","isLoading","iframeSrc","iframeSrcDoc","isGenerating","generationProgress","generationDocumentText","generationStartedAt","onCancelGeneration","ref","iframeLoaded","setIframeLoaded","handleIframeLoad","handleIframeError","iframeSandbox","hasContent","FORMAT_LABEL","PreviewFrameMemoized","WarningsPanel","warnings","isExpanded","setIsExpanded","ChevronRight","AlertTriangle","warning","Info","BUILTIN_THEMES","UnavailableThemeWarning","activeTab","useDocumentsStore","s","documentTypes","documents","customThemes","useThemesStore","missingThemeName","doc","d","themeName","_c","FORMAT","ct","renderWithLibreOffice","blob","jsonText","renderer","useJsonPath","response","jsonDefinition","err","body","API_ENDPOINTS","formData","ext","json","pdfBlob","objectUrl","renderDocument","payload","error","errorMessage","Progress","React.forwardRef","value","props","ProgressPrimitive.Root","ProgressPrimitive.Indicator","formatBytes","bytes","k","sizes","i","CacheMetrics","stats","setStats","loading","setLoading","setError","controller","fetchData","data","interval","handleCacheCleared","hitRatePct","Badge","RasterizerBreakdown","lookups","dedupeSaved","Preview","cancelGeneration","globalError","cacheStatus","cacheHitRate","isRendering","isPreviewStale","editSequence","lastBuiltSequence","setOutput","useOutputStore","state","editorDocumentText","customThemesMap","themesForServer","out","setIframeSrc","setIframeSrcDoc","showCacheMetrics","setShowCacheMetrics","iframeRef","renderCleanupRef","useRef","pendingManualRenderRef","cleanupRenderedPreview","useCallback","doRender","docName","docBlob","docText","themes","status","displayMessage","manualRenderRef","handleManualRender","onManual","onShowCache","localHeaderVisible","useSettingsStore","Fragment","PreviewHeaderMemoized","Separator","hasUnsyncedEdits","isStale","Dialog","DialogContent","DialogHeader","DialogTitle"],"mappings":"4jBA+CA,SAASA,EAAkBC,EAA4B,CAGrD,KAAM,CAACC,CAAa,EAAIC,EAAAA,SAAS,IAAM,KAAK,KAAK,EAC3CC,EAAQH,GAAaC,EACrB,CAACG,EAAKC,CAAM,EAAIH,EAAAA,SAAS,IAAM,KAAK,KAAK,EAC/CI,OAAAA,EAAAA,UAAU,IAAM,CACd,MAAMC,EAAK,YAAY,IAAMF,EAAO,KAAK,IAAA,CAAK,EAAG,GAAG,EACpD,MAAO,IAAM,cAAcE,CAAE,CAC/B,EAAG,CAAA,CAAE,EACE,KAAK,IAAI,GAAIH,EAAMD,GAAS,GAAI,CACzC,CAcA,SAASK,GAAkBC,EAAuC,SAChE,GAAI,CAACA,EAAM,OAAO,KAClB,GAAI,CACF,MAAMC,EAAO,KAAK,MAAMD,CAAI,EAC5B,GAAI,CAACC,GAAQ,OAAOA,GAAS,SAAU,OAAO,KAC9C,MAAMC,MAAa,IACbC,EAAmB,CAACF,CAAI,EAC9B,KAAOE,EAAM,OAAS,GAAG,CACvB,MAAMC,EAAOD,EAAM,IAAA,EACnB,GAAI,CAACC,GAAQ,OAAOA,GAAS,SAAU,SACvC,KAAM,CAAE,KAAAC,EAAM,SAAAC,CAAA,EAAaF,EAIvB,OAAOC,GAAS,UAClBH,EAAO,IAAIG,GAAOH,EAAO,IAAIG,CAAI,GAAK,GAAK,CAAC,EAE1C,MAAM,QAAQC,CAAQ,GAAGH,EAAM,KAAK,GAAGG,CAAQ,CACrD,CAYA,MAAMC,EAViE,CACrE,CAAC,QAAS,QAAS,QAAQ,EAC3B,CAAC,UAAW,UAAW,UAAU,EACjC,CAAC,SAAU,SAAU,SAAS,EAC9B,CAAC,QAAS,QAAS,QAAQ,EAC3B,CAAC,QAAS,QAAS,QAA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AAA,CAAAf,EAAAA,IAAC,IAAA,CAAE,UAAU,mBAAmB,SAAA,oBAAiB,EACjDA,EAAAA,IAAC,IAAA,CAAE,UAAU,0CACV,SAAA0H,CAAA,CACH,CAAA,CAAA,CACF,EACF,EAEA1H,EAAAA,IAACiD,GAAA,CACC,IAAK2F,GACL,UAAW,EAAQf,EACnB,UAAA3F,GACA,aAAAC,GACA,aAAc,EAAQC,EACtB,mBAAAC,EACA,uBAAwB+F,GAAsBvJ,EAC9C,oBAAA0D,EACA,mBAAoBkF,CAAA,CAAA,CACtB,EAEJ,EAGAzH,EAAAA,IAACoK,IAAO,KAAM1B,GAAkB,aAAcC,EAC5C,SAAA5H,EAAAA,KAACsJ,GAAA,CAAc,UAAU,YACvB,SAAA,CAAArK,MAACsK,GAAA,CACC,SAAAtK,EAAAA,IAACuK,GAAA,CAAY,SAAA,mBAAA,CAAiB,EAChC,QACC/D,GAAA,CAAA,CAAa,CAAA,CAAA,CAChB,CAAA,CACF,CAAA,EACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"preview-zo-CHAU0.js","sources":["../../../src/client/components/ui/loading-states.tsx","../../../src/client/components/playground/preview-frame.tsx","../../../src/client/components/playground/warnings-panel.tsx","../../../src/client/components/playground/unavailable-theme-warning.tsx","../../../src/client/lib/render.ts","../../../src/client/components/ui/progress.tsx","../../../src/client/components/cache-metrics.tsx","../../../src/client/components/playground/preview.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport { cn } from '@/lib/utils';\nimport { Spinner } from './spinner';\nimport { Skeleton } from './skeleton';\nimport { Button } from './button';\n\ninterface LoadingOverlayProps {\n isLoading: boolean;\n children: React.ReactNode;\n message?: string;\n className?: string;\n}\n\nexport function LoadingOverlay({\n isLoading,\n children,\n message = 'Loading...',\n className,\n}: LoadingOverlayProps) {\n return (\n <div className={cn('relative', className)}>\n {children}\n {isLoading && (\n <div className=\"absolute inset-0 bg-background/80 backdrop-blur-sm flex items-center justify-center z-50\">\n <div className=\"flex flex-col items-center gap-2\">\n <Spinner size=\"lg\" />\n <p className=\"text-sm text-muted-foreground\">{message}</p>\n </div>\n </div>\n )}\n </div>\n );\n}\n\ninterface DocumentGenerationLoaderProps {\n className?: string;\n currentStage?: 'parsing' | 'building' | 'rendering' | 'finalizing';\n message?: string;\n /** Source JSON of the document being built — drives the content summary. */\n documentText?: string;\n /** Date.now() when the build started — drives the elapsed timer. */\n startedAt?: number;\n /** When provided, renders a Cancel button that aborts the build. */\n onCancel?: () => void;\n}\n\n/** Ticks every 100ms and returns whole elapsed seconds since `startedAt`. */\nfunction useElapsedSeconds(startedAt?: number): number {\n // Freeze the fallback start on first render so a caller that never passes\n // `startedAt` still gets a stable timer instead of one reset per render.\n const [fallbackStart] = useState(() => Date.now());\n const start = startedAt ?? fallbackStart;\n const [now, setNow] = useState(() => Date.now());\n useEffect(() => {\n const id = setInterval(() => setNow(Date.now()), 100);\n return () => clearInterval(id);\n }, []);\n return Math.max(0, (now - start) / 1000);\n}\n\ninterface DocumentSummary {\n title?: string;\n counts: { label: string; count: number }[];\n visualCount: number;\n imageCount: number;\n}\n\n/**\n * Walk a JTO document tree and count the component types worth narrating.\n * Best-effort: any parse/shape surprise returns null and the loader simply\n * omits the summary row.\n */\nfunction summarizeDocument(text?: string): DocumentSummary | null {\n if (!text) return null;\n try {\n const root = JSON.parse(text);\n if (!root || typeof root !== 'object') return null;\n const counts = new Map<string, number>();\n const stack: unknown[] = [root];\n while (stack.length > 0) {\n const node = stack.pop();\n if (!node || typeof node !== 'object') continue;\n const { name, children } = node as {\n name?: unknown;\n children?: unknown;\n };\n if (typeof name === 'string') {\n counts.set(name, (counts.get(name) ?? 0) + 1);\n }\n if (Array.isArray(children)) stack.push(...children);\n }\n // Ordered by how much each type usually tells the user about build cost.\n const interesting: [key: string, singular: string, plural: string][] = [\n ['slide', 'slide', 'slides'],\n ['section', 'section', 'sections'],\n ['visual', 'visual', 'visuals'],\n ['chart', 'chart', 'charts'],\n ['image', 'image', 'images'],\n ['table', 'table', 'tables'],\n ['shape', 'shape', 'shapes'],\n ['paragraph', 'paragraph', 'paragraphs'],\n ];\n const summary = interesting\n .map(([key, singular, plural]) => {\n const count = counts.get(key) ?? 0;\n return { label: count === 1 ? singular : plural, count };\n })\n .filter((entry) => entry.count > 0)\n .slice(0, 5);\n const title = (root as { props?: { metadata?: { title?: unknown } } }).props\n ?.metadata?.title;\n return {\n title: typeof title === 'string' ? title : undefined,\n counts: summary,\n visualCount: (counts.get('visual') ?? 0) + (counts.get('chart') ?? 0),\n imageCount: counts.get('image') ?? 0,\n };\n } catch {\n return null;\n }\n}\n\n/** Rotating context lines shown once a build takes more than a moment. */\nfunction buildHints(summary: DocumentSummary | null): string[] {\n const hints: string[] = [];\n if (summary && summary.visualCount > 0) {\n hints.push(\n `${summary.visualCount} visual${summary.visualCount === 1 ? '' : 's'} in this document ${\n summary.visualCount === 1 ? 'is' : 'are'\n } rasterized on first build — later builds reuse the cached renders.`\n );\n }\n if (summary && summary.imageCount > 3) {\n hints.push(\n 'Large embedded images dominate build time — downscaling them speeds up iteration.'\n );\n }\n hints.push(\n 'Re-running an unchanged document is served from the cache almost instantly.',\n 'Generation warnings, if any, will appear above the preview when the build completes.'\n );\n return hints;\n}\n\nconst CheckIcon = () => (\n <svg\n className=\"h-3.5 w-3.5 text-success\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <path\n d=\"M3 8.5L6.5 12L13 4.5\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nexport function DocumentGenerationLoader({\n className,\n currentStage = 'parsing',\n message,\n documentText,\n startedAt,\n onCancel,\n}: DocumentGenerationLoaderProps) {\n const stages = ['parsing', 'building', 'rendering', 'finalizing'] as const;\n const stageLabels: Record<(typeof stages)[number], string> = {\n parsing: 'Validating JSON',\n building: 'Building structure',\n rendering: 'Rendering content',\n finalizing: 'Finalizing document',\n };\n\n const currentStageIndex = stages.indexOf(currentStage);\n const elapsed = useElapsedSeconds(startedAt);\n const summary = useMemo(\n () => summarizeDocument(documentText),\n [documentText]\n );\n const hints = useMemo(() => buildHints(summary), [summary]);\n // Hints appear only for builds long enough to leave the user wondering,\n // then rotate so a long rasterization pass keeps saying something new.\n const showHints = elapsed > 3;\n const hintIndex = Math.floor(Math.max(0, elapsed - 3) / 5) % hints.length;\n\n return (\n <div className={cn('p-6 max-w-lg mx-auto space-y-5', className)}>\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"flex items-center gap-3 min-w-0\">\n <Spinner size=\"md\" />\n <div className=\"space-y-0.5 min-w-0\">\n <p className=\"text-sm font-medium truncate\">\n {summary?.title\n ? `Generating “${summary.title}”`\n : 'Generating document'}\n </p>\n {/* The live region covers only the stage message — putting it on\n the container would re-announce the whole loader every 100ms\n elapsed-timer tick. */}\n <p\n className=\"text-xs text-muted-foreground truncate\"\n role=\"status\"\n aria-live=\"polite\"\n >\n {message || `${stageLabels[currentStage]}...`}\n </p>\n </div>\n </div>\n <span\n className=\"shrink-0 rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums\"\n aria-hidden=\"true\"\n >\n {elapsed.toFixed(1)}s\n </span>\n </div>\n\n {summary && summary.counts.length > 0 && (\n <div className=\"flex flex-wrap gap-1.5\" aria-label=\"Document contents\">\n {summary.counts.map(({ label, count }) => (\n <span\n key={label}\n className=\"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs text-muted-foreground\"\n >\n <span className=\"font-medium text-foreground tabular-nums\">\n {count}\n </span>\n {label}\n </span>\n ))}\n </div>\n )}\n\n <div className=\"space-y-3\">\n {stages.map((stage, index) => {\n const isActive = index === currentStageIndex;\n const isCompleted = index < currentStageIndex;\n return (\n <div key={stage} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between text-xs\">\n <span\n className={cn(\n isActive\n ? 'text-primary font-medium'\n : isCompleted\n ? 'text-muted-foreground'\n : 'text-muted-foreground/60'\n )}\n >\n {stageLabels[stage]}\n </span>\n {isCompleted ? (\n <CheckIcon />\n ) : isActive ? (\n <Spinner size=\"sm\" className=\"h-3.5 w-3.5\" />\n ) : (\n <span className=\"h-3.5 w-3.5 rounded-full border border-muted-foreground/40\" />\n )}\n </div>\n <div className=\"w-full bg-secondary rounded-full h-1.5 overflow-hidden\">\n {isCompleted ? (\n <div className=\"h-full w-full rounded-full bg-success\" />\n ) : isActive ? (\n // Honest indeterminate sweep — we have no real progress\n // signal within a stage, so don't fake a full bar.\n <div className=\"h-full w-2/5 rounded-full bg-primary animate-progress-indeterminate\" />\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n\n <div className=\"flex items-center justify-between gap-3 min-h-8\">\n <p\n className={cn(\n 'text-xs text-muted-foreground/80 italic transition-opacity duration-500',\n showHints ? 'opacity-100' : 'opacity-0'\n )}\n >\n {hints[hintIndex]}\n </p>\n {onCancel && (\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={onCancel}\n className=\"shrink-0\"\n >\n Cancel\n </Button>\n )}\n </div>\n </div>\n );\n}\n\ninterface GenerationOverlayProps {\n mode: 'generating' | 'rendering';\n message?: string;\n startedAt?: number;\n onCancel?: () => void;\n className?: string;\n}\n\n/**\n * Compact card for the overlay shown on top of an existing preview while a\n * rebuild or re-render is in flight.\n */\nexport function GenerationOverlay({\n mode,\n message,\n startedAt,\n onCancel,\n className,\n}: GenerationOverlayProps) {\n const elapsed = useElapsedSeconds(startedAt);\n return (\n <div\n className={cn(\n 'flex flex-col items-center gap-2 rounded-md border bg-background/95 px-6 py-4 shadow-sm',\n className\n )}\n >\n <div className=\"flex items-center gap-2\">\n <Spinner size=\"md\" />\n {/* Live region on the label only — the elapsed badge ticks every\n 100ms and must not retrigger screen-reader announcements. */}\n <p className=\"text-sm font-medium\" role=\"status\" aria-live=\"polite\">\n {mode === 'generating' ? 'Generating' : 'Rendering'}\n </p>\n <span\n className=\"rounded-full bg-secondary px-2 py-0.5 text-xs text-muted-foreground tabular-nums\"\n aria-hidden=\"true\"\n >\n {elapsed.toFixed(1)}s\n </span>\n </div>\n {message && (\n <p className=\"max-w-xs text-center text-xs text-muted-foreground truncate\">\n {message}\n </p>\n )}\n {mode === 'generating' && onCancel && (\n <Button variant=\"outline\" size=\"sm\" onClick={onCancel}>\n Cancel\n </Button>\n )}\n </div>\n );\n}\n\ninterface PreviewLoadingProps {\n renderingLibrary?: string;\n className?: string;\n}\n\nexport function PreviewLoading({\n renderingLibrary,\n className,\n}: PreviewLoadingProps) {\n const getLibraryInfo = (library?: string) => {\n switch (library) {\n case 'LibreOffice':\n return {\n name: 'LibreOffice',\n description: 'Converting document to PDF locally...',\n };\n case 'Office':\n return {\n name: 'Microsoft Office',\n description: 'Uploading file and loading Office viewer...',\n };\n case 'Docs':\n return {\n name: 'Google Docs',\n description: 'Uploading file and loading Docs viewer...',\n };\n default:\n return { name: 'Default', description: 'Processing document...' };\n }\n };\n\n const { name, description } = getLibraryInfo(renderingLibrary);\n\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center h-full p-8 space-y-4',\n className\n )}\n >\n <Spinner size=\"lg\" />\n <div className=\"text-center space-y-2\">\n <p className=\"text-sm font-medium\">Rendering Preview</p>\n <p className=\"text-xs text-muted-foreground\">Using {name} renderer</p>\n <p className=\"text-xs text-muted-foreground/80\">{description}</p>\n </div>\n\n <div className=\"w-full max-w-md space-y-3\">\n <Skeleton className=\"h-16 w-full\" />\n <div className=\"space-y-2\">\n <Skeleton className=\"h-4 w-full\" />\n <Skeleton className=\"h-4 w-3/4\" />\n <Skeleton className=\"h-4 w-1/2\" />\n </div>\n <Skeleton className=\"h-12 w-full\" />\n </div>\n </div>\n );\n}\n\ninterface InlineLoaderProps {\n message?: string;\n size?: 'sm' | 'md';\n className?: string;\n}\n\nexport function InlineLoader({\n message = 'Loading...',\n size = 'sm',\n className,\n}: InlineLoaderProps) {\n return (\n <div className={cn('flex items-center gap-2', className)}>\n <Spinner size={size} />\n <span className=\"text-sm text-muted-foreground\">{message}</span>\n </div>\n );\n}\n\ninterface FileOperationLoaderProps {\n operation: 'upload' | 'download' | 'save' | 'delete';\n fileName?: string;\n progress?: number;\n className?: string;\n}\n\nexport function FileOperationLoader({\n operation,\n fileName,\n progress,\n className,\n}: FileOperationLoaderProps) {\n const operationLabels = {\n upload: 'Uploading',\n download: 'Downloading',\n save: 'Saving',\n delete: 'Deleting',\n };\n\n return (\n <div\n className={cn(\n 'flex items-center gap-3 p-3 border rounded-sm bg-header-bg',\n className\n )}\n >\n <Spinner size=\"sm\" />\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium truncate\">\n {operationLabels[operation]} {fileName && `\"${fileName}\"`}\n </p>\n {progress !== undefined && (\n <div className=\"mt-1\">\n <div className=\"flex justify-between text-xs mb-1\">\n <span>{progress}%</span>\n <span className=\"text-muted-foreground\">\n {progress < 100 ? 'In progress...' : 'Complete'}\n </span>\n </div>\n <div className=\"w-full bg-secondary rounded-full h-1.5\">\n <div\n className=\"bg-primary h-1.5 rounded-full transition-all duration-300\"\n style={{ width: `${progress}%` }}\n />\n </div>\n </div>\n )}\n </div>\n </div>\n );\n}\n","import React, { useEffect, useState } from 'react';\nimport {\n DocumentGenerationLoader,\n GenerationOverlay,\n PreviewLoading,\n} from '../ui/loading-states';\nimport { FORMAT_LABEL } from '../../lib/env';\n\nconst PreviewFrame = React.forwardRef<\n HTMLIFrameElement,\n {\n isLoading: boolean;\n iframeSrc?: string;\n iframeSrcDoc?: string;\n isGenerating?: boolean;\n generationProgress?: {\n stage: 'parsing' | 'building' | 'rendering' | 'finalizing';\n message?: string;\n };\n /** Source JSON being built — feeds the loader's content summary. */\n generationDocumentText?: string;\n /** Date.now() when the build started — feeds the elapsed timer. */\n generationStartedAt?: number;\n /** Aborts the in-flight build; renders a Cancel button when present. */\n onCancelGeneration?: () => void;\n }\n>(\n (\n {\n isLoading,\n iframeSrc,\n iframeSrcDoc,\n isGenerating,\n generationProgress,\n generationDocumentText,\n generationStartedAt,\n onCancelGeneration,\n },\n ref\n ) => {\n const [iframeLoaded, setIframeLoaded] = useState(false);\n\n // Reset iframe loaded state when content changes\n useEffect(() => {\n setIframeLoaded(false);\n }, [iframeSrc, iframeSrcDoc]);\n\n // Handle iframe load event\n const handleIframeLoad = () => {\n setIframeLoaded(true);\n };\n\n // Handle iframe errors\n const handleIframeError = () => {\n console.warn('Iframe failed to load content');\n setIframeLoaded(false);\n };\n\n // PDF blob URLs and remote viewers can be blocked by Chromium-based browsers\n // when loaded in a sandboxed iframe. Keep sandbox only for srcDoc-based preview.\n const iframeSandbox = iframeSrcDoc\n ? 'allow-scripts allow-popups allow-forms'\n : undefined;\n\n const hasContent = Boolean(iframeSrc || iframeSrcDoc);\n\n // Full-screen loaders only when no existing content\n if (isGenerating && !hasContent) {\n return (\n <div className=\"grow\">\n <DocumentGenerationLoader\n currentStage={generationProgress?.stage}\n message={generationProgress?.message}\n documentText={generationDocumentText}\n startedAt={generationStartedAt}\n onCancel={onCancelGeneration}\n />\n </div>\n );\n }\n\n if (isLoading && !hasContent) {\n return (\n <div className=\"grow\">\n <PreviewLoading renderingLibrary=\"LibreOffice\" />\n </div>\n );\n }\n\n if (hasContent) {\n return (\n <div className=\"h-full w-full relative bg-white\">\n {/* Loading overlay */}\n {!iframeLoaded && (\n <div className=\"absolute inset-0 bg-muted/80 flex items-center justify-center z-10\">\n <div className=\"text-center\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-foreground mx-auto mb-2\"></div>\n <p className=\"text-sm text-muted-foreground\">\n Loading preview...\n </p>\n </div>\n </div>\n )}\n {/* Generating/Rendering overlay on top of existing content */}\n {(isGenerating || isLoading) && (\n <div className=\"absolute inset-0 bg-background/60 backdrop-blur-[2px] flex items-center justify-center z-20 transition-opacity duration-200\">\n <GenerationOverlay\n mode={isGenerating ? 'generating' : 'rendering'}\n message={isGenerating ? generationProgress?.message : undefined}\n startedAt={isGenerating ? generationStartedAt : undefined}\n onCancel={isGenerating ? onCancelGeneration : undefined}\n />\n </div>\n )}\n {/* Key forces remount when switching between srcDoc (sandboxed) and\n src (blob URL, no sandbox) to avoid stale sandbox race condition */}\n <iframe\n key={iframeSrcDoc ? 'srcdoc' : 'src'}\n ref={ref}\n className=\"w-full h-full border-0\"\n style={{\n backgroundColor: 'white',\n // Fade in after load to prevent flash\n opacity: iframeLoaded ? 1 : 0,\n transition: 'opacity 0.2s ease-in-out',\n }}\n src={iframeSrc}\n srcDoc={iframeSrcDoc}\n onLoad={handleIframeLoad}\n onError={handleIframeError}\n // Security: sandbox srcDoc to prevent XSS from rendered HTML.\n // Blob URLs (src) must NOT be sandboxed without allow-same-origin.\n sandbox={iframeSandbox}\n // Accessibility\n title=\"Document preview\"\n aria-label={`Preview of rendered ${FORMAT_LABEL.toLowerCase()}`}\n />\n </div>\n );\n }\n return null;\n }\n);\n\nPreviewFrame.displayName = 'PreviewFrame';\nexport const PreviewFrameMemoized = React.memo(PreviewFrame);\n","import React from 'react';\nimport { AlertTriangle, Info, ChevronRight } from 'lucide-react';\nimport type { GenerationWarning } from '../../store/output-store';\n\ninterface WarningsPanelProps {\n warnings: GenerationWarning[] | null | undefined;\n className?: string;\n}\n\nexport function WarningsPanel({ warnings, className }: WarningsPanelProps) {\n const [isExpanded, setIsExpanded] = React.useState(false);\n\n if (!warnings || warnings.length === 0) {\n return null;\n }\n\n return (\n <div className={className}>\n <button\n type=\"button\"\n onClick={() => setIsExpanded(!isExpanded)}\n className=\"flex w-full items-center gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-1.5 text-left transition-colors hover:bg-warning/20\"\n >\n <ChevronRight\n className={`h-3.5 w-3.5 text-warning transition-transform flex-shrink-0 ${isExpanded ? 'rotate-90' : ''}`}\n />\n <AlertTriangle className=\"h-3.5 w-3.5 text-warning flex-shrink-0\" />\n <span className=\"text-xs font-medium text-warning\">\n {warnings.length} warning{warnings.length !== 1 ? 's' : ''}\n </span>\n </button>\n\n {isExpanded && (\n <div className=\"mt-1.5 space-y-1.5\">\n {warnings.map((warning, index) => (\n <div\n key={index}\n className=\"flex items-start gap-2 rounded-sm border bg-card px-3 py-2\"\n >\n {warning.severity === 'info' ? (\n <Info className=\"h-3.5 w-3.5 mt-0.5 text-data-blue flex-shrink-0\" />\n ) : (\n <AlertTriangle className=\"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0\" />\n )}\n <div className=\"flex-1 min-w-0\">\n <div className=\"flex items-center gap-1.5\">\n <code className=\"text-[11px] font-medium text-warning bg-warning/15 px-1 py-0.5 rounded-sm\">\n {warning.component}\n </code>\n {warning.severity === 'info' && (\n <span className=\"text-[10px] uppercase tracking-wide text-data-blue font-medium\">\n info\n </span>\n )}\n </div>\n <p className=\"mt-0.5 text-xs text-muted-foreground leading-relaxed\">\n {warning.message}\n </p>\n {warning.context && Object.keys(warning.context).length > 0 && (\n <details className=\"mt-1.5\">\n <summary className=\"text-[11px] text-muted-foreground/70 cursor-pointer hover:text-foreground\">\n Context\n </summary>\n <pre className=\"mt-1 text-[11px] bg-header-bg p-1.5 rounded-sm overflow-x-auto text-muted-foreground\">\n {JSON.stringify(warning.context, null, 2)}\n </pre>\n </details>\n )}\n </div>\n </div>\n ))}\n </div>\n )}\n </div>\n );\n}\n","import { useMemo } from 'react';\nimport { AlertTriangle } from 'lucide-react';\nimport { useDocumentsStore } from '../../store/documents-store-provider';\nimport { useThemesStore } from '../../store/themes-store-provider';\nimport { FORMAT } from '../../lib/env';\n\n// Theme names registered in the server-side core packages. Documents may\n// reference these even without a matching customThemes entry.\nconst BUILTIN_THEMES: Record<string, readonly string[]> = {\n pptx: ['default', 'dark', 'minimal'],\n docx: ['minimal', 'corporate', 'modern'],\n};\n\nexport function UnavailableThemeWarning({ className }: { className?: string }) {\n const activeTab = useDocumentsStore((s) => s.activeTab);\n const documentTypes = useDocumentsStore((s) => s.documentTypes);\n const documents = useDocumentsStore((s) => s.documents);\n const customThemes = useThemesStore((s) => s.customThemes);\n\n const missingThemeName = useMemo(() => {\n if (!activeTab) return null;\n if (documentTypes[activeTab] === 'application/json+theme') return null;\n\n const doc = documents.find((d) => d.name === activeTab);\n if (!doc?.text) return null;\n\n let themeName: unknown;\n try {\n themeName = JSON.parse(doc.text)?.props?.theme;\n } catch {\n return null;\n }\n if (typeof themeName !== 'string' || !themeName) return null;\n\n if (BUILTIN_THEMES[FORMAT]?.includes(themeName)) return null;\n\n for (const ct of Object.values(customThemes)) {\n if (ct.valid && ct.name === themeName) return null;\n }\n\n return themeName;\n }, [activeTab, documentTypes, documents, customThemes]);\n\n if (!missingThemeName) return null;\n\n return (\n <div\n className={`flex items-start gap-2 rounded-sm border border-transparent bg-warning/10 px-3 py-2 ${className ?? ''}`}\n >\n <AlertTriangle className=\"h-3.5 w-3.5 mt-0.5 text-warning flex-shrink-0\" />\n <div className=\"flex-1 min-w-0 text-xs leading-relaxed\">\n <span className=\"font-medium text-warning\">\n Theme{' '}\n <code className=\"bg-warning/20 px-1 py-0.5 rounded-sm text-warning\">\n {missingThemeName}\n </code>{' '}\n is not available.\n </span>{' '}\n <span className=\"text-warning/80\">\n Add it as a custom theme or use a built-in theme (\n {BUILTIN_THEMES[FORMAT]?.join(', ')}). The renderer will fall back to\n a default.\n </span>\n </div>\n </div>\n );\n}\n","import { FORMAT } from './env';\nimport { API_ENDPOINTS } from '../config/api';\n\nexport type RenderPayload = {\n iframeSrc?: string;\n iframeSrcDoc?: string;\n cleanup?: () => void;\n};\n\nasync function renderWithLibreOffice(\n name: string,\n blob: Blob,\n jsonText?: string,\n customThemes?: Record<string, unknown>,\n renderer?: string\n): Promise<RenderPayload> {\n // When we know the source JSON, hit the from-json endpoint. The server\n // generates + converts in one step and passes resolved fonts directly to\n // the LibreOffice font stager — embedded fonts render correctly in the PDF.\n // Falling back to the upload path is still useful if the JSON is lost or\n // we're previewing an externally-supplied file.\n const useJsonPath = typeof jsonText === 'string' && jsonText.length > 0;\n\n let response: Response;\n if (useJsonPath) {\n let jsonDefinition: unknown;\n try {\n jsonDefinition = JSON.parse(jsonText!);\n } catch (err) {\n throw new Error(`Invalid JSON document: ${(err as Error).message}`);\n }\n const body: Record<string, unknown> = {\n jsonDefinition,\n customThemes: customThemes ?? {},\n // sourceName lets the server resolve relative asset paths against the\n // discovered document's own directory (#142). Names only — the server\n // maps them to paths itself.\n //\n // `renderer` is what keeps the preview honest: the server regenerates\n // the document here, and without it the PDF on screen came from the\n // default backend while the download came from the selected one (#255).\n options: { sourceName: name, ...(renderer ? { renderer } : {}) },\n };\n response = await fetch(API_ENDPOINTS.preview.libreofficeFromJson, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n } else {\n const formData = new FormData();\n const ext = FORMAT === 'pptx' ? '.pptx' : '.docx';\n formData.append('file', blob, `${name}${ext}`);\n response = await fetch(API_ENDPOINTS.preview.libreoffice, {\n method: 'POST',\n body: formData,\n });\n }\n\n if (!response.ok) {\n let message = `LibreOffice preview failed (${response.status})`;\n try {\n const json = await response.json();\n if (json && typeof json === 'object' && typeof json.error === 'string') {\n message = json.error;\n }\n } catch {}\n throw new Error(message);\n }\n\n const pdfBlob = await response.blob();\n if (!pdfBlob.size) {\n throw new Error('LibreOffice preview returned an empty PDF');\n }\n\n const objectUrl = URL.createObjectURL(pdfBlob);\n return {\n iframeSrc: objectUrl,\n cleanup: () => URL.revokeObjectURL(objectUrl),\n };\n}\n\nexport function cleanupIframe(iframe: HTMLIFrameElement) {\n try {\n if (iframe.contentWindow) {\n iframe.contentWindow.location.replace('about:blank');\n }\n iframe.src = 'about:blank';\n iframe.srcdoc = '';\n if (iframe.parentNode) {\n iframe.parentNode.removeChild(iframe);\n }\n } catch (error) {\n console.warn('Error cleaning up iframe:', error);\n }\n}\n\nexport async function renderDocument(\n name: string,\n blob: Blob,\n jsonText?: string,\n customThemes?: Record<string, unknown>,\n renderer?: string\n) {\n try {\n if (!blob || blob.size === 0) {\n throw new Error('Invalid or empty document blob');\n }\n\n const payload = await renderWithLibreOffice(\n name,\n blob,\n jsonText,\n customThemes,\n renderer\n );\n\n return { status: 'success' as const, name, payload };\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return { status: 'error' as const, name, payload: new Error(errorMessage) };\n }\n}\n\n// Keep backward compat exports for pptx code\nexport const renderPptx = (name: string, blob: Blob) =>\n renderDocument(name, blob);\n","import * as React from 'react';\nimport * as ProgressPrimitive from '@radix-ui/react-progress';\nimport { cn } from '../../lib/utils';\n\nconst Progress = React.forwardRef<\n React.ElementRef<typeof ProgressPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>\n>(({ className, value, ...props }, ref) => (\n <ProgressPrimitive.Root\n ref={ref}\n className={cn(\n 'relative h-4 w-full overflow-hidden rounded-full bg-secondary',\n className\n )}\n {...props}\n >\n <ProgressPrimitive.Indicator\n className=\"h-full w-full flex-1 bg-primary transition-all\"\n style={{ transform: `translateX(-${100 - (value || 0)}%)` }}\n />\n </ProgressPrimitive.Root>\n));\nProgress.displayName = ProgressPrimitive.Root.displayName;\n\nexport { Progress };\n","import { useEffect, useState } from 'react';\nimport { Badge } from './ui/badge';\nimport { Progress } from './ui/progress';\nimport { API_ENDPOINTS } from '../config/api';\n\ninterface CacheStats {\n document: {\n hits: number;\n misses: number;\n hitRate: number;\n size: number;\n itemCount: number;\n enabled: boolean;\n };\n rasterizer?: RasterizerCacheData;\n}\n\ninterface RasterizerCacheData {\n diskHits: number;\n diskMisses: number;\n hitRate: number;\n dedupedRequests: number;\n rendered: number;\n failed: number;\n entries: number;\n bytes: number;\n prepass?: {\n documents: number;\n collected: number;\n unique: number;\n };\n}\n\nfunction formatBytes(bytes: number): string {\n if (bytes === 0) return '0 B';\n const k = 1024;\n const sizes = ['B', 'KB', 'MB', 'GB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];\n}\n\nexport function CacheMetrics() {\n const [stats, setStats] = useState<CacheStats | null>(null);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n const controller = new AbortController();\n\n const fetchData = async () => {\n try {\n const response = await fetch(API_ENDPOINTS.cacheStats, {\n signal: controller.signal,\n });\n if (!response.ok) throw new Error('Failed to fetch cache stats');\n const data = await response.json();\n\n if (!controller.signal.aborted) {\n setStats(data.data);\n setError(null);\n }\n } catch (err) {\n if (!controller.signal.aborted) {\n if (err instanceof Error && err.name !== 'AbortError') {\n setError(err.message);\n } else if (!(err instanceof Error) || err.name !== 'AbortError') {\n setError('Failed to load cache stats');\n }\n }\n } finally {\n if (!controller.signal.aborted) setLoading(false);\n }\n };\n\n fetchData();\n const interval = setInterval(fetchData, 5000);\n\n const handleCacheCleared = () => fetchData();\n window.addEventListener('cache:cleared', handleCacheCleared);\n\n return () => {\n controller.abort();\n clearInterval(interval);\n window.removeEventListener('cache:cleared', handleCacheCleared);\n };\n }, []);\n\n if (loading) {\n return (\n <div className=\"flex items-center justify-center p-8\">\n <div className=\"animate-spin rounded-full h-8 w-8 border-b-2 border-primary\" />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"text-destructive p-4\">\n Error loading cache metrics: {error}\n </div>\n );\n }\n\n if (!stats) return null;\n\n const { document: doc } = stats;\n const hitRatePct = doc.hitRate * 100;\n\n return (\n <div className=\"space-y-4\">\n {/* Summary row */}\n <div className=\"flex items-center gap-6 text-sm\">\n <div>\n <span className=\"text-muted-foreground\">Hit Rate</span>{' '}\n <span className=\"font-semibold text-base\">\n {hitRatePct.toFixed(1)}%\n </span>\n <span className=\"text-muted-foreground ml-1\">\n ({doc.hits} hits / {doc.misses} misses)\n </span>\n </div>\n <div>\n <span className=\"text-muted-foreground\">Size</span>{' '}\n <span className=\"font-semibold\">{formatBytes(doc.size)}</span>\n <span className=\"text-muted-foreground ml-1\">\n ({doc.itemCount} items)\n </span>\n </div>\n <Badge variant={doc.enabled ? 'default' : 'secondary'}>\n {doc.enabled ? 'Enabled' : 'Disabled'}\n </Badge>\n </div>\n\n <Progress\n value={hitRatePct}\n className=\"h-2\"\n aria-label=\"Cache hit rate\"\n />\n\n {/* Visual rasterizer caches (disk PNG cache + batch dedupe) */}\n {stats.rasterizer && <RasterizerBreakdown data={stats.rasterizer} />}\n </div>\n );\n}\n\nfunction RasterizerBreakdown({ data }: { data: RasterizerCacheData }) {\n const lookups = data.diskHits + data.diskMisses;\n const activity =\n lookups + data.dedupedRequests + data.rendered + data.entries;\n if (activity === 0) return null;\n\n const hitRatePct = data.hitRate * 100;\n const dedupeSaved = data.prepass\n ? data.prepass.collected - data.prepass.unique\n : data.dedupedRequests;\n\n return (\n <div className=\"space-y-2\">\n <h4 className=\"text-sm font-medium\">Visual Rasterizer</h4>\n <div className=\"px-3 py-1.5 text-sm space-y-1.5\">\n <div className=\"flex items-center justify-between\">\n <span className=\"text-muted-foreground\">Disk cache</span>\n <div className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n <span>\n {lookups > 0 ? `${hitRatePct.toFixed(0)}% hit` : 'no lookups'}\n </span>\n <span>\n ({data.diskHits} hits / {data.diskMisses} misses)\n </span>\n <span>\n {data.entries} PNGs, {formatBytes(data.bytes)}\n </span>\n </div>\n </div>\n <Progress\n value={hitRatePct}\n className=\"h-1.5\"\n aria-label=\"Rasterizer disk cache hit rate\"\n />\n <div className=\"flex items-center justify-between text-xs text-muted-foreground\">\n <span>\n {data.rendered} rendered\n {data.failed > 0 ? `, ${data.failed} failed` : ''}\n </span>\n <span>\n {dedupeSaved} duplicate visual{dedupeSaved === 1 ? '' : 's'} deduped\n {data.prepass\n ? ` (${data.prepass.collected} collected → ${data.prepass.unique} unique)`\n : ''}\n </span>\n </div>\n </div>\n </div>\n );\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { PreviewFrameMemoized } from './preview-frame';\nimport { PreviewHeaderMemoized } from './preview-header';\nimport { WarningsPanel } from './warnings-panel';\nimport { UnavailableThemeWarning } from './unavailable-theme-warning';\nimport { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/dialog';\nimport { Separator } from '../ui/separator';\nimport { useOutputStore } from '../../store/output-store-provider';\nimport { useSettingsStore } from '../../store/settings-store-provider';\nimport { renderDocument } from '../../lib/render';\nimport { useDocumentsStore } from '../../store/documents-store-provider';\nimport { useThemesStore } from '../../store/themes-store-provider';\nimport { CacheMetrics } from '../cache-metrics';\nimport { FORMAT_LABEL } from '../../lib/env';\n\nexport function Preview() {\n const {\n name,\n text,\n blob,\n renderer,\n isGenerating,\n generationProgress,\n generationStartedAt,\n cancelGeneration,\n globalError,\n cacheStatus,\n cacheHitRate,\n warnings,\n isRendering,\n isPreviewStale,\n editSequence,\n lastBuiltSequence,\n setOutput,\n } = useOutputStore((state) => state);\n // Editor text for \"Copy standard components\" — exists before the first Run,\n // unlike the output store's `text` (#155). Themes have no expansion.\n const editorDocumentText = useDocumentsStore((s) =>\n s.activeTab && s.documentTypes[s.activeTab] !== 'application/json+theme'\n ? s.documents.find((d) => d.name === s.activeTab)?.text\n : undefined\n );\n // Select the raw map (stable reference until themes mutate), then memoize\n // the transform. A selector that returns a freshly-constructed object on\n // every call would burn through Zustand's Object.is equality and retrigger\n // renders indefinitely.\n const customThemesMap = useThemesStore((state) => state.customThemes);\n const themesForServer = useMemo(() => {\n const out: Record<string, unknown> = {};\n for (const ct of Object.values(customThemesMap)) {\n if (ct.valid && ct.name && ct.parsed) out[ct.name] = ct.parsed;\n }\n return out;\n }, [customThemesMap]);\n\n const [iframeSrc, setIframeSrc] = useState<string | undefined>(undefined);\n const [iframeSrcDoc, setIframeSrcDoc] = useState<string | undefined>(\n undefined\n );\n const [showCacheMetrics, setShowCacheMetrics] = useState<boolean>(false);\n const iframeRef = React.useRef<HTMLIFrameElement>(null);\n\n const renderCleanupRef = useRef<(() => void) | null>(null);\n const pendingManualRenderRef = useRef(false);\n\n const cleanupRenderedPreview = useCallback(() => {\n if (renderCleanupRef.current) {\n renderCleanupRef.current();\n renderCleanupRef.current = null;\n }\n }, []);\n\n // Core render function\n const doRender = useCallback(\n async (\n docName: string,\n docBlob: Blob,\n docText?: string,\n themes?: Record<string, unknown>,\n renderer?: string\n ) => {\n setOutput({\n isRendering: true,\n isPreviewStale: false,\n globalError: undefined,\n });\n\n try {\n const { status, payload } = await renderDocument(\n docName,\n docBlob,\n docText,\n themes,\n renderer\n );\n\n if (status !== 'success') {\n throw payload instanceof Error ? payload : new Error(String(payload));\n }\n\n cleanupRenderedPreview();\n setIframeSrc(payload.iframeSrc || undefined);\n setIframeSrcDoc(payload.iframeSrcDoc || undefined);\n renderCleanupRef.current = payload.cleanup || null;\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n\n let displayMessage = errorMessage;\n if (errorMessage.includes('Failed to fetch')) {\n displayMessage =\n 'Network error: Unable to load required resources. Check if the server is running properly.';\n } else if (errorMessage.includes('timeout')) {\n displayMessage =\n 'Render timeout: The rendering process took too long.';\n }\n\n setOutput({ globalError: displayMessage });\n } finally {\n setOutput({ isRendering: false });\n }\n },\n [setOutput, cleanupRenderedPreview]\n );\n\n // Ref to always hold latest manual-render deps so the event listener never goes stale\n const manualRenderRef = useRef({ name, blob, text, doRender });\n useEffect(() => {\n manualRenderRef.current = { name, blob, text, doRender };\n });\n\n const handleManualRender = useCallback(async () => {\n // Set flag so blob-change effect renders the new blob when it arrives\n pendingManualRenderRef.current = true;\n // Flush debounces + trigger build via editor.tsx\n window.dispatchEvent(new CustomEvent('preview:flushAndBuild'));\n }, []); // stable — reads from ref\n\n // A new blob renders only when a Run asked for it. Converting through\n // LibreOffice costs a round trip, so an edit marks the preview stale and\n // waits rather than rebuilding under the author.\n useEffect(() => {\n if (!blob || !name) return;\n if (pendingManualRenderRef.current) {\n pendingManualRenderRef.current = false;\n // Use the backend captured with this blob, never the live picker: the\n // selection may have changed while generation was in flight (#255).\n doRender(name, blob, text, themesForServer, renderer);\n return;\n }\n setOutput({ isPreviewStale: true });\n }, [blob, name, text, themesForServer, renderer, doRender, setOutput]);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n cleanupRenderedPreview();\n };\n }, [cleanupRenderedPreview]);\n\n // Listen for global header events (stable — handleManualRender never changes)\n useEffect(() => {\n const onManual = () => handleManualRender();\n const onShowCache = () => setShowCacheMetrics(true);\n\n window.addEventListener('preview:manualRender', onManual);\n window.addEventListener('preview:showCacheMetrics', onShowCache);\n return () => {\n window.removeEventListener('preview:manualRender', onManual);\n window.removeEventListener('preview:showCacheMetrics', onShowCache);\n };\n }, [handleManualRender]);\n\n const localHeaderVisible =\n (useSettingsStore as any)?.getState?.().useGlobalPreviewHeader === false;\n\n return (\n <>\n <div className=\"flex h-full flex-col\">\n {localHeaderVisible && (\n <PreviewHeaderMemoized\n name={name?.trim() || 'Preview'}\n blob={blob}\n onManualRender={handleManualRender}\n isGenerating={isGenerating}\n isRendering={isRendering}\n onShowCacheMetrics={() => setShowCacheMetrics(true)}\n documentText={text}\n editorDocumentText={editorDocumentText}\n warnings={warnings}\n />\n )}\n {/* The local header draws its own `border-b`; a standalone separator\n underneath it stacked two hairlines. */}\n {!localHeaderVisible && <Separator />}\n {/* Status Bar: cache + stale combined */}\n {(() => {\n const hasUnsyncedEdits =\n (editSequence ?? 0) > (lastBuiltSequence ?? 0);\n const isStale =\n (isPreviewStale || hasUnsyncedEdits) &&\n !isGenerating &&\n !isRendering;\n return (\n ((cacheStatus && cacheStatus !== 'UNKNOWN') || isStale) && (\n <div\n className={`px-3 py-1.5 flex items-center justify-between border-b overflow-hidden ${\n isStale ? 'bg-warning/10' : 'bg-header-bg'\n }`}\n >\n <div className=\"flex items-center gap-2 min-w-0 truncate\">\n {cacheStatus === 'HIT' && !isStale ? (\n <>\n <div className=\"h-1.5 w-1.5 rounded-full bg-success flex-shrink-0\" />\n <span className=\"text-xs text-muted-foreground truncate\">\n Cached\n </span>\n </>\n ) : cacheStatus === 'MISS' && !isStale ? (\n <>\n <div className=\"h-1.5 w-1.5 rounded-full bg-accent2 flex-shrink-0\" />\n <span className=\"text-xs text-muted-foreground truncate\">\n Fresh {FORMAT_LABEL.toLowerCase()}\n </span>\n </>\n ) : isStale ? (\n <>\n <div className=\"h-1.5 w-1.5 rounded-full bg-warning flex-shrink-0\" />\n <span className=\"text-xs text-warning truncate\">\n Outdated — click Run\n </span>\n </>\n ) : null}\n </div>\n {!isStale && cacheHitRate && cacheHitRate !== '0.0%' && (\n <span className=\"text-xs text-muted-foreground flex-shrink-0 ml-2\">\n {cacheHitRate} hit rate\n </span>\n )}\n </div>\n )\n );\n })()}\n {/* Warnings Panel */}\n <WarningsPanel warnings={warnings} className=\"mx-3 my-2\" />\n <UnavailableThemeWarning className=\"mx-3 my-2\" />\n {/* Generation Error — centered in preview area */}\n {globalError && !isGenerating ? (\n <div className=\"flex-1 flex items-center justify-center p-6\">\n <div className=\"max-w-md rounded-sm border-l-4 border-l-destructive bg-destructive/10 px-4 py-3 text-sm text-destructive\">\n <p className=\"font-medium mb-1\">Generation failed</p>\n <p className=\"text-xs text-destructive/80 break-words\">\n {globalError}\n </p>\n </div>\n </div>\n ) : (\n <PreviewFrameMemoized\n ref={iframeRef}\n isLoading={Boolean(isRendering)}\n iframeSrc={iframeSrc}\n iframeSrcDoc={iframeSrcDoc}\n isGenerating={Boolean(isGenerating)}\n generationProgress={generationProgress}\n generationDocumentText={editorDocumentText ?? text}\n generationStartedAt={generationStartedAt}\n onCancelGeneration={cancelGeneration}\n />\n )}\n </div>\n\n {/* Cache Metrics Dialog */}\n <Dialog open={showCacheMetrics} onOpenChange={setShowCacheMetrics}>\n <DialogContent className=\"max-w-2xl\">\n <DialogHeader>\n <DialogTitle>Cache Performance</DialogTitle>\n </DialogHeader>\n <CacheMetrics />\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"names":["useElapsedSeconds","startedAt","fallbackStart","useState","start","now","setNow","useEffect","id","summarizeDocument","text","root","counts","stack","node","name","children","summary","key","singular","plural","count","entry","title","_b","_a","buildHints","hints","CheckIcon","jsx","DocumentGenerationLoader","className","currentStage","message","documentText","onCancel","stages","stageLabels","currentStageIndex","elapsed","useMemo","showHints","hintIndex","cn","jsxs","Spinner","label","stage","index","isActive","isCompleted","Button","GenerationOverlay","mode","PreviewLoading","renderingLibrary","getLibraryInfo","library","description","Skeleton","PreviewFrame","React","isLoading","iframeSrc","iframeSrcDoc","isGenerating","generationProgress","generationDocumentText","generationStartedAt","onCancelGeneration","ref","iframeLoaded","setIframeLoaded","handleIframeLoad","handleIframeError","iframeSandbox","hasContent","FORMAT_LABEL","PreviewFrameMemoized","WarningsPanel","warnings","isExpanded","setIsExpanded","ChevronRight","AlertTriangle","warning","Info","BUILTIN_THEMES","UnavailableThemeWarning","activeTab","useDocumentsStore","s","documentTypes","documents","customThemes","useThemesStore","missingThemeName","doc","d","themeName","_c","FORMAT","ct","renderWithLibreOffice","blob","jsonText","renderer","useJsonPath","response","jsonDefinition","err","body","API_ENDPOINTS","formData","ext","json","pdfBlob","objectUrl","renderDocument","payload","error","errorMessage","Progress","React.forwardRef","value","props","ProgressPrimitive.Root","ProgressPrimitive.Indicator","formatBytes","bytes","k","sizes","i","CacheMetrics","stats","setStats","loading","setLoading","setError","controller","fetchData","data","interval","handleCacheCleared","hitRatePct","Badge","RasterizerBreakdown","lookups","dedupeSaved","Preview","cancelGeneration","globalError","cacheStatus","cacheHitRate","isRendering","isPreviewStale","editSequence","lastBuiltSequence","setOutput","useOutputStore","state","editorDocumentText","customThemesMap","themesForServer","out","setIframeSrc","setIframeSrcDoc","showCacheMetrics","setShowCacheMetrics","iframeRef","renderCleanupRef","useRef","pendingManualRenderRef","cleanupRenderedPreview","useCallback","doRender","docName","docBlob","docText","themes","status","displayMessage","manualRenderRef","handleManualRender","onManual","onShowCache","localHeaderVisible","useSettingsStore","Fragment","PreviewHeaderMemoized","Separator","hasUnsyncedEdits","isStale","Dialog","DialogContent","DialogHeader","DialogTitle"],"mappings":"4jBA+CA,SAASA,EAAkBC,EAA4B,CAGrD,K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2F,GACL,UAAW,EAAQf,EACnB,UAAA3F,GACA,aAAAC,GACA,aAAc,EAAQC,EACtB,mBAAAC,EACA,uBAAwB+F,GAAsBvJ,EAC9C,oBAAA0D,EACA,mBAAoBkF,CAAA,CAAA,CACtB,EAEJ,EAGAzH,EAAAA,IAACoK,IAAO,KAAM1B,GAAkB,aAAcC,EAC5C,SAAA5H,EAAAA,KAACsJ,GAAA,CAAc,UAAU,YACvB,SAAA,CAAArK,MAACsK,GAAA,CACC,SAAAtK,EAAAA,IAACuK,GAAA,CAAY,SAAA,mBAAA,CAAiB,EAChC,QACC/D,GAAA,CAAA,CAAa,CAAA,CAAA,CAChB,CAAA,CACF,CAAA,EACF,CAEJ"}
|
package/dist/client/index.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
10
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
11
11
|
<title>JSON to Office</title>
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-DLlW4q4v.js"></script>
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-BmQ2Ko_D.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/query-vendor--rhYD8mC.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-DFNP5I4e.js">
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2014 The DM Sans Project Authors (https://github.com/googlefonts/dm-fonts)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|