@betteroffice/pptx-react 0.1.1 → 0.5.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/README.md +115 -102
- package/dist/chunk-3Y6BQIW3.js +1 -0
- package/dist/chunk-66PPYFHW.js +4 -0
- package/dist/chunk-HGG45CCF.js +1 -0
- package/dist/chunk-HQ2N3DQ7.js +1 -0
- package/dist/chunk-J3YQUJUG.js +1 -0
- package/dist/chunk-M267LYSF.js +1 -0
- package/dist/chunk-O2XFH626.js +1 -0
- package/dist/chunk-V62S3LXB.js +1 -0
- package/dist/chunk-X2M23RXQ.js +1 -0
- package/dist/chunk-X6B77B3U.js +1 -0
- package/dist/index.d.ts +1137 -46
- package/dist/index.js +1 -4
- package/package.json +9 -6
package/dist/index.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import {StaleProposalError,initWasm,openPresentation,sizeCanvasForSlide,paintSlide,PRESENCE_LABEL_DURATION_MS,presentationImageBlob,slideToPng}from'@betteroffice/pptx';import {createContext,useMemo,useContext,useState,useRef,useCallback,useEffect,useId}from'react';import {en,deepMerge,createT}from'@betteroffice/pptx-i18n';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var Wn=createContext(en),Kn=createContext("en");function Ct({i18n:e,children:t}){let o=typeof e?._lang=="string"?e._lang:"en",r=useMemo(()=>deepMerge(en,e),[e]);return jsx(Kn.Provider,{value:o,children:jsx(Wn.Provider,{value:r,children:t})})}function Te(){let e=useContext(Wn),t=useContext(Kn);return {t:useMemo(()=>createT(e,t),[e,t])}}function jn({handle:e,proposals:t,snapshot:o,resolveImage:r,onAccept:a,onReject:s,onNavigate:d,onClose:m}){let{t:f}=Te(),g=useId(),[l,y]=useState(null),[I,K]=useState(null),[X,j]=useState(null),b=useRef(null),w=useRef(null);useEffect(()=>{if(l){if(!t.some(h=>h.id===l.id)){y(null);return}try{let h=e.previewProposal(l.id),T=h.proposal.changes[l.index],O=h.snapshot.slides.findIndex(se=>se.id===T?.slideId);if(O<0)throw new Error(f("proposals.targetMissing"));let Z=e.layoutSlide(O),Se=e.layoutProposalSlide(l.id,O);K({data:h,before:Z,after:Se}),j(null);}catch(h){K(null),j(h instanceof Error?h.message:String(h));}}},[e,t,o,l,f]),useEffect(()=>{let h=b.current;l&&h&&!h.open&&h.showModal(),!l&&h?.open&&h.close();},[l]);let B=h=>{let T=o.slides.findIndex(Z=>Z.id===h.slideId),O=h.before?.name||f("notes.panelLabel");return T<0?f("proposals.targetMissing"):f("proposals.target",{slide:T+1,name:O})},k=(h,T,O)=>{w.current=O;let Z=h.changes[T];d(Z.slideId,Z.shapeId,h.id),K(null),j(null),y({id:h.id,index:T});},N=h=>{if(!(!l||!I))try{let T=e.previewProposal(l.id);if(JSON.stringify(T.proposal.changes)!==JSON.stringify(I.data.proposal.changes)){let O=T.proposal.changes[l.index],Z=T.snapshot.slides.findIndex(Se=>Se.id===O.slideId);K({data:T,before:e.layoutSlide(Z),after:e.layoutProposalSlide(l.id,Z)}),j(f("proposals.changedAgain"));return}a(l.id,h);}catch(T){K(null),j(T instanceof Error?T.message:String(T));}};return jsxs("aside",{"data-testid":"pptx-proposals-panel","aria-label":f("proposals.title"),style:D.panel,children:[jsxs("header",{style:D.header,children:[jsxs("strong",{children:[f("proposals.title")," ",jsx("span",{style:D.count,children:t.length})]}),jsx("button",{type:"button",onClick:m,"aria-label":f("proposals.close"),style:D.button,children:"\xD7"})]}),t.length===0&&jsx("p",{style:D.muted,children:f("proposals.empty")}),t.map(h=>jsxs("section",{"data-testid":"pptx-proposal","data-proposal-id":h.id,style:D.card,children:[jsx("strong",{style:D.author,children:h.agentId}),h.note&&jsx("p",{style:D.note,children:h.note}),h.changes.map((T,O)=>jsxs("div",{style:D.change,children:[jsx("button",{type:"button",onClick:()=>d(T.slideId,T.shapeId,h.id),style:D.link,children:B(T)}),T.oldText!==T.newText?jsxs("div",{style:D.textDiff,children:[jsx("del",{style:D.deleted,children:T.oldText||f("proposals.blank")}),jsx("ins",{style:D.inserted,children:T.newText||f("proposals.blank")})]}):null,T.before&&T.after&&jsx(Pr,{change:T}),jsx("button",{type:"button","data-testid":"pptx-proposal-preview",style:D.button,onClick:Z=>k(h,O,Z.currentTarget),children:f("proposals.preview")})]},`${T.slideId}:${T.shapeId??"notes"}`)),h.staleTargets.length>0&&jsx("p",{role:"alert","data-testid":"pptx-proposal-stale",style:D.warning,children:f("proposals.stale")}),jsxs("div",{style:D.actions,children:[jsx("button",{type:"button","data-testid":"pptx-proposal-accept",style:D.primary,onClick:()=>a(h.id),children:f("proposals.accept")}),jsx("button",{type:"button","data-testid":"pptx-proposal-reject",style:D.button,onClick:()=>s(h.id),children:f("proposals.reject")})]})]},h.id)),jsxs("dialog",{ref:b,"data-testid":"pptx-proposal-preview-dialog","aria-labelledby":g,style:D.dialog,onCancel:()=>y(null),onClose:()=>{y(null),w.current?.focus();},children:[jsxs("header",{style:D.header,children:[jsx("strong",{id:g,children:f("proposals.previewTitle")}),jsx("button",{type:"button",style:D.button,onClick:()=>y(null),children:f("proposals.close")})]}),X&&jsx("p",{role:"alert",style:D.warning,children:X}),I&&l&&jsxs(Fragment,{children:[jsxs("p",{children:[jsx("strong",{children:I.data.proposal.agentId}),I.data.proposal.note&&jsxs(Fragment,{children:[" \xB7 ",I.data.proposal.note]})]}),jsxs("label",{children:[f("proposals.targetLabel")," ",jsx("select",{"aria-label":f("proposals.targetLabel"),value:l.index,onChange:h=>{let T=Number(h.target.value),O=I.data.proposal.changes[T];d(O.slideId,O.shapeId,l.id),y({id:l.id,index:T});},children:I.data.proposal.changes.map((h,T)=>jsx("option",{value:T,children:B(h)},T))})]}),I.data.proposal.changes[l.index].oldText!==I.data.proposal.changes[l.index].newText&&jsxs("div",{style:D.textDiff,children:[jsx("del",{style:D.deleted,children:I.data.proposal.changes[l.index].oldText||f("proposals.blank")}),jsx("ins",{style:D.inserted,children:I.data.proposal.changes[l.index].newText||f("proposals.blank")})]}),jsxs("div",{style:D.previews,children:[jsx(Un,{label:f("proposals.before"),frame:I.before,resolveImage:r}),jsx(Un,{label:f("proposals.after"),frame:I.after,resolveImage:r})]}),I.data.proposal.staleTargets.length>0&&jsx("p",{role:"alert",style:D.warning,children:f("proposals.stalePreview")}),jsxs("div",{style:D.actions,children:[I.data.proposal.staleTargets.length>0?jsx("button",{type:"button","data-testid":"pptx-proposal-force",style:D.primary,onClick:()=>N(true),children:f("proposals.force")}):jsx("button",{type:"button",style:D.primary,onClick:()=>N(false),children:f("proposals.accept")}),jsx("button",{type:"button",style:D.button,onClick:()=>s(l.id),children:f("proposals.reject")})]})]})]})]})}function Pr({change:e}){let{t}=Te(),o=e.before,r=e.after,a=o.x!==r.x||o.y!==r.y||o.width!==r.width||o.height!==r.height,s=d=>[d.x,d.y,d.width,d.height].map(m=>(m/12700).toFixed(1)).join(", ");return jsxs(Fragment,{children:[a&&jsxs("p",{style:D.detail,children:[t("proposals.geometry"),jsx("br",{}),s(o)," \u2192 ",s(r)," pt"]}),JSON.stringify({...o,x:0,y:0,width:0,height:0})!==JSON.stringify({...r,x:0,y:0,width:0,height:0})&&e.oldText===e.newText&&jsx("p",{style:D.detail,children:t("proposals.appearance")})]})}function Un({label:e,frame:t,resolveImage:o}){let r=useRef(null),[a,s]=useState(null);return useEffect(()=>{let d=false,m=r.current;if(!m)return;let f=document.createElement("canvas"),g=f.getContext("2d"),l=m.getContext("2d");if(!g||!l)return;let y=Math.min(1,560/t.width),I=window.devicePixelRatio||1;return sizeCanvasForSlide(f,t,I,y),s(null),paintSlide(g,t,I,y,{resolveImage:o}).then(()=>{d||(sizeCanvasForSlide(m,t,I,y),l.setTransform(1,0,0,1,0,0),l.drawImage(f,0,0));}).catch(K=>{d||s(K instanceof Error?K.message:String(K));}),()=>{d=true;}},[t,o]),jsxs("figure",{style:D.figure,children:[jsx("figcaption",{style:D.caption,children:e}),jsx("canvas",{ref:r,role:"img","aria-label":e,style:{maxWidth:"100%",height:"auto",display:"block",background:"#fff"}}),a&&jsx("p",{role:"alert",children:a})]})}var D={panel:{width:340,maxWidth:"45%",flex:"0 0 auto",overflowY:"auto",background:"#fff",borderLeft:"1px solid #dbe3ee",padding:16,fontSize:13},header:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},count:{color:"#64748b",marginLeft:6},card:{border:"1px solid #dbe3ee",borderLeft:"3px solid #6366f1",borderRadius:8,padding:12,marginTop:16},author:{color:"#4338ca"},note:{margin:"6px 0 12px",lineHeight:1.5},change:{borderTop:"1px solid #eef2f7",padding:"10px 0"},textDiff:{display:"grid",gap:6,margin:"8px 0",whiteSpace:"pre-wrap",overflowWrap:"anywhere",maxHeight:200,overflowY:"auto"},deleted:{color:"#9f1239",background:"#fff1f2",padding:"4px 6px"},inserted:{color:"#166534",background:"#f0fdf4",padding:"4px 6px",textDecoration:"none"},actions:{display:"flex",flexWrap:"wrap",gap:8,marginTop:12},button:{border:"1px solid #cbd5e1",borderRadius:5,background:"#fff",color:"#334155",padding:"6px 10px",cursor:"pointer",font:"inherit"},primary:{border:"1px solid #4338ca",borderRadius:5,background:"#4338ca",color:"#fff",padding:"6px 10px",cursor:"pointer",font:"inherit"},link:{background:"none",border:0,padding:0,color:"#4338ca",textAlign:"left",cursor:"pointer",font:"inherit",fontWeight:600},warning:{padding:10,borderRadius:5,background:"#fffbeb",color:"#92400e",lineHeight:1.5},detail:{color:"#64748b",lineHeight:1.5},muted:{color:"#64748b",marginTop:24},dialog:{width:"min(1200px, 92vw)",maxHeight:"90vh",overflow:"auto",padding:24,border:"1px solid #cbd5e1",borderRadius:12,color:"#172033",background:"#f8fafc"},previews:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(min(360px, 100%), 1fr))",gap:16,margin:"20px 0"},figure:{margin:0,minWidth:0},caption:{fontWeight:600,marginBottom:8}};var Gn=["nw","n","ne","e","se","s","sw","w"];var Ir=Math.fround(Math.fround(Math.PI)/180);function gt(e,t,o,r){if(!Number.isFinite(e.width)||!Number.isFinite(e.height)||e.width<=0||e.height<=0)return null;let a=(o-e.left)*t.width/e.width,s=(r-e.top)*t.height/e.height;return Number.isFinite(a)&&Number.isFinite(s)?{x:a,y:s}:null}function Ee(e,t){for(let o of e){if(o.id===t)return o;let r=Ee(o.children,t);if(r)return r}return null}function Zn(e){let t=new Map,o=[...e];for(;o.length>0;){let r=o.pop();t.set(r.id,r),o.push(...r.children);}return t}function tn(e,t){for(let o of e.shapes)if(o.id===t||Ee(o.children,t))return o;return null}function $n(e,t){return !!(e&&e.id===t.slideId&&Ee(e.shapes,t.shapeId))}function kt(e,t){return e?.pointerId===t}function nn(e){return e.width>0&&e.height>0}function Rt(e){let t=(e.rotationDeg%360+360)%360;return nn(e)&&t===0&&!e.flipH&&!e.flipV}function Ve(e,t,o){let r=new Set;Jn(o,r);let a=t.primitives.filter(l=>l.shapeId&&r.has(l.shapeId));if(a.length===0)return o.width<=0||o.height<=0||e.widthEmu<=0||e.heightEmu<=0?null:{x:o.x*t.width/e.widthEmu,y:o.y*t.height/e.heightEmu,width:o.width*t.width/e.widthEmu,height:o.height*t.height/e.heightEmu};let s=a.map(l=>{let y=(l.transform?.rotationDeg??0)*Math.PI/180,I=Math.abs(l.w*Math.cos(y))+Math.abs(l.h*Math.sin(y)),K=Math.abs(l.w*Math.sin(y))+Math.abs(l.h*Math.cos(y));return {x:l.x+(l.w-I)/2,y:l.y+(l.h-K)/2,width:I,height:K}}),d=Math.min(...s.map(l=>l.x)),m=Math.min(...s.map(l=>l.y)),f=Math.max(...s.map(l=>l.x+l.width)),g=Math.max(...s.map(l=>l.y+l.height));return {x:d,y:m,width:f-d,height:g-m}}function on(e,t,o,r){let a=e.primitives.find(l=>l.kind==="textBox"&&l.shapeId===t&&l.storyId===o);if(!a||a.lines.length===0)return null;let s=Yn(a,r),d=0;for(let l=1;l<a.lines.length;l+=1){let y=a.lines[l],I=a.lines[d];Mt(y.y,y.height,s.y)<Mt(I.y,I.height,s.y)&&(d=l);}let m=a.lines[d],f=m.caretStops[0];return f?{position:m.caretStops.reduce((l,y)=>Math.abs(y.x-s.x)<Math.abs(l.x-s.x)?y:l,f).position,lineIndex:d}:{position:m.start,lineIndex:d}}function wr(e,t){let o={x:Math.fround(t.x),y:Math.fround(t.y)};for(let r=e.primitives.length-1;r>=0;r-=1){let a=e.primitives[r];if(!a.shapeId)continue;let s=Vn(a,o);if(s)return a.kind==="textBox"&&a.storyId&&Tr(a,s.y)?"text":"shape"}return null}function Yn(e,t){let o=e.transform;if(!o||!o.rotationDeg&&!o.flipH&&!o.flipV)return t;let r=Math.fround,a=r(r(e.x)+r(r(e.w)/2)),s=r(r(e.y)+r(r(e.h)/2)),d=r(r(o.rotationDeg??0)*Ir),m=r(Math.cos(d)),f=r(Math.sin(d)),g=r(t.x-a),l=r(t.y-s),y=r(r(g*m)+r(l*f)),I=r(r(l*m)-r(g*f));return o.flipH&&(y=-y),o.flipV&&(I=-I),{x:r(a+y),y:r(s+I)}}function Xn(e,t){return Math.fround(Math.fround(e)+Math.fround(t))}function Vn(e,t){let o=Yn(e,t);return o.x>=Math.fround(e.x)&&o.x<=Xn(e.x,e.w)&&o.y>=Math.fround(e.y)&&o.y<=Xn(e.y,e.h)?o:null}function Tr(e,t){return e.lines.length===0?false:e.lines.reduce((r,a)=>Mt(a.y,a.height,t)<Mt(r.y,r.height,t)?a:r).caretStops.length>0}function qn(e,t,o,r){return {x:o.x+Math.round(r.x*e.widthEmu/t.width),y:o.y+Math.round(r.y*e.heightEmu/t.height)}}function rn(e,t,o,r,a=4){return Math.hypot(o-e,r-t)>=a}function Jn(e,t){t.add(e.id);for(let o of e.children)Jn(o,t);}function Mt(e,t,o){return o<e?e-o:o>e+t?o-e-t:0}function Qn(e,t){let o=t.includes("w")?e.x:t.includes("e")?e.x+e.width:e.x+e.width/2,r=t.startsWith("n")?e.y:t.startsWith("s")?e.y+e.height:e.y+e.height/2;return {x:o,y:r}}function eo(e){return e==="nw"||e==="se"?"nwse-resize":e==="ne"||e==="sw"?"nesw-resize":e==="n"||e==="s"?"ns-resize":"ew-resize"}function Cr(e,t,o,r){let{x:a,y:s,width:d,height:m}=e;if(t.includes("w")){let f=Math.min(o.x,d-r);a+=f,d-=f;}else t.includes("e")&&(d=Math.max(r,d+o.x));if(t.startsWith("n")){let f=Math.min(o.y,m-r);s+=f,m-=f;}else t.startsWith("s")&&(m=Math.max(r,m+o.y));return {x:a,y:s,width:d,height:m}}function to(e,t,o){return o?{x:o.x-e.x,y:o.y-e.y}:t}function an(e,t,o,r,a){if(!Rt(o))return null;let s={x:Math.round(a.x*e.widthEmu/t.width),y:Math.round(a.y*e.heightEmu/t.height)},d=Cr({x:o.x,y:o.y,width:o.width,height:o.height},r,s,76200);return {x:d.x,y:d.y,width:d.width,height:d.height}}function no(e,t,o,r,a){let s=an(e,t,o,r,a);return !s||e.widthEmu<=0||e.heightEmu<=0?null:{x:s.x*t.width/e.widthEmu,y:s.y*t.height/e.heightEmu,width:s.width*t.width/e.widthEmu,height:s.height*t.height/e.heightEmu}}function sn(e,t,o=1){let r=wr(e,t);if(r!=="text")return r;let a={x:Math.fround(t.x),y:Math.fround(t.y)};for(let s=e.primitives.length-1;s>=0;s-=1){let d=e.primitives[s];if(!d.shapeId)continue;let m=Vn(d,a);if(m)return Er(d,m,o)?"shape":"text"}return r}function Er(e,t,o){let r=Number.isFinite(o)&&o>0?o:1,a=Math.min(6/r,e.w/3,e.h/3);return t.x-e.x<=a||e.x+e.w-t.x<=a||t.y-e.y<=a||e.y+e.h-t.y<=a}function ao(e,t,o,r){let[a,s]=useState(true),[d,m]=useState(null),f=o?.slides[r]?.id,g=useMemo(()=>t.filter(I=>I.changes.some(K=>K.slideId===f)),[t,f]),l=g.find(I=>I.id===d)??g[0]??null,y=useMemo(()=>{if(!a||!e||!l)return {diff:null,error:null};try{return {diff:e.layoutProposalDiffSlide(l.id,r),error:null}}catch(I){return {diff:null,error:I instanceof Error?I.message:String(I)}}},[a,e,l,r,o]);return useEffect(()=>{s(true),m(null);},[e]),{...y,available:g,selected:l,enabled:a,setEnabled:s,select:m,reviewing:a&&l!==null}}function so({review:e,ready:t,onAccept:o,onReject:r,onDetails:a}){let{t:s}=Te();if(!e.selected)return null;let d=e.selected.staleTargets.length>0,m=d||!!e.error||e.enabled&&!t;return jsxs("div",{style:J.toolbar,"data-testid":"pptx-canvas-review-toolbar",children:[jsxs("div",{style:J.row,children:[jsxs("label",{style:J.label,children:[s("proposals.canvasTitle"),jsx("select",{"aria-label":s("proposals.canvasTitle"),value:e.selected.id,onChange:f=>{e.select(f.target.value),e.setEnabled(true);},style:J.select,children:e.available.map((f,g)=>jsxs("option",{value:f.id,children:[g+1,". ",f.agentId,f.note?` \xB7 ${f.note}`:""]},f.id))})]}),jsx("button",{type:"button",style:J.button,"data-testid":"pptx-canvas-review-toggle","aria-pressed":e.enabled,onClick:()=>e.setEnabled(!e.enabled),children:s(e.enabled?"proposals.editSlide":"proposals.showDiff")}),jsx("button",{type:"button",style:J.button,onClick:a,children:s("proposals.details")}),jsx("button",{type:"button",style:{...J.primary,opacity:m?.45:1,cursor:m?"default":"pointer"},disabled:m,"data-testid":"pptx-canvas-proposal-accept",onClick:()=>o(e.selected.id),children:s("proposals.accept")}),jsx("button",{type:"button",style:J.button,"data-testid":"pptx-canvas-proposal-reject",onClick:()=>r(e.selected.id),children:s("proposals.reject")})]}),e.enabled&&jsxs("div",{style:J.legend,children:[jsx("span",{style:J.removed,children:s("proposals.removed")}),jsx("span",{style:J.added,children:s("proposals.added")}),jsx("span",{children:s("proposals.reviewHint")})]}),d&&jsx("p",{role:"status",style:J.warning,children:s("proposals.canvasStale")}),e.error&&jsx("p",{role:"alert",style:J.warning,children:e.error})]})}function lo({diff:e,current:t,frame:o,slideIndex:r,scale:a,resolveImage:s,onTarget:d,onPainted:m}){let{t:f}=Te(),g=useRef(null),[l,y]=useState(null),[I,K]=useState(null),X=t.slides[r]?.id,j=e.proposal.changes.filter(b=>b.slideId===X&&b.shapeId&&b.before&&b.after);return useEffect(()=>{let b=false,w=g.current;if(!w)return;let B=document.createElement("canvas"),k=B.getContext("2d"),N=w.getContext("2d");if(!k||!N)return;let h=window.devicePixelRatio||1;return sizeCanvasForSlide(B,e.frame,h,a),w.dataset.ready="false",y(null),paintSlide(k,e.frame,h,a,{resolveImage:s,textChanges:e.textChanges}).then(()=>{b||(sizeCanvasForSlide(w,e.frame,h,a),N.setTransform(1,0,0,1,0,0),N.drawImage(B,0,0),w.dataset.ready="true",K(e),m(e));}).catch(T=>{b||y(T instanceof Error?T.message:String(T));}),()=>{b=true;}},[e,a,s,m]),jsxs("div",{style:J.overlay,"data-testid":"pptx-canvas-proposal-diff",children:[jsx("canvas",{ref:g,role:"img","aria-label":f("proposals.canvasTitle"),style:{...J.canvas,visibility:I===e?"visible":"hidden"}}),I!==e&&!l&&jsx("p",{role:"status",style:J.paintError,children:f("proposals.loadingDiff")}),j.map(b=>{let w=Ve(t,o,b.before),B=Ve(e.snapshot,e.frame,b.after);if(!B)return null;let k=w&&(w.x!==B.x||w.y!==B.y||w.width!==B.width||w.height!==B.height),N=h=>({left:h.x*a,top:h.y*a,width:Math.max(1,h.width*a),height:Math.max(1,h.height*a)});return jsxs("div",{children:[k&&jsx("span",{"data-testid":"pptx-proposal-old-bounds",style:{...J.outline,...N(w),borderColor:"#b91c1c",borderStyle:"dashed",pointerEvents:"none"},"aria-hidden":"true",children:jsx("span",{style:{...J.tag,color:"#b91c1c",background:"#fee2e2"},children:f("proposals.previousPosition")})}),jsx("button",{type:"button","data-testid":"pptx-proposal-canvas-target","aria-label":`${e.proposal.agentId}: ${b.after.name}`,onClick:()=>d(b.slideId,b.shapeId),style:{...J.outline,...N(B),borderColor:"#16a34a",cursor:"pointer"},children:k&&jsx("span",{style:{...J.tag,left:"auto",right:-1,color:"#166534",background:"#dcfce7"},children:f("proposals.proposedPosition")})})]},b.shapeId)}),jsx("div",{style:J.srOnly,children:j.map(b=>jsxs("p",{children:[b.after.name,": ",jsx("del",{children:b.oldText})," ",jsx("ins",{children:b.newText})]},b.shapeId))}),l&&jsx("p",{role:"alert",style:J.paintError,children:l})]})}function co({diff:e,slideId:t}){let{t:o}=Te(),r=e?.proposal.changes.find(a=>a.slideId===t&&!a.shapeId&&a.oldText!==a.newText);return r?jsxs("section",{"aria-label":o("notes.panelLabel"),style:J.notes,"data-testid":"pptx-proposal-notes-diff",children:[jsx("strong",{children:o("notes.panelLabel")}),jsx("del",{style:J.removed,children:r.oldText||o("proposals.blank")}),jsx("ins",{style:J.added,children:r.newText||o("proposals.blank")})]}):null}var J={toolbar:{flex:"0 0 auto",padding:"10px 14px",background:"#fff",borderBottom:"1px solid #dbe3ee",fontSize:12},row:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},label:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8,minWidth:0,fontWeight:600},select:{maxWidth:260,minWidth:80,padding:5,border:"1px solid #cbd5e1",borderRadius:4,font:"inherit"},legend:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,marginTop:8,color:"#64748b"},removed:{color:"#b91c1c",background:"#fee2e2",textDecoration:"line-through",padding:"2px 5px"},added:{color:"#166534",background:"#dcfce7",textDecoration:"underline",padding:"2px 5px"},button:{padding:"5px 9px",border:"1px solid #cbd5e1",borderRadius:5,background:"#fff",color:"#334155",cursor:"pointer",font:"inherit"},primary:{padding:"5px 9px",border:"1px solid #4338ca",borderRadius:5,background:"#4338ca",color:"#fff",cursor:"pointer",font:"inherit"},warning:{margin:"8px 0 0",color:"#92400e"},overlay:{position:"absolute",inset:0,overflow:"hidden",background:"#fff"},canvas:{position:"absolute",inset:0,display:"block",pointerEvents:"none"},outline:{position:"absolute",border:"1px solid",background:"transparent",padding:0},tag:{position:"absolute",left:-1,top:-18,fontSize:11,lineHeight:"16px",padding:"0 4px",whiteSpace:"nowrap"},srOnly:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clipPath:"inset(50%)",whiteSpace:"nowrap"},notes:{display:"grid",gap:6,padding:"10px 14px",maxHeight:160,overflow:"auto",background:"#fff",fontSize:12,whiteSpace:"pre-wrap"},paintError:{position:"absolute",top:8,left:8,right:8,padding:8,background:"#fff1f2",color:"#b91c1c"}};var rt=createContext(null);function Dr(){let e=useContext(rt);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}function ee({name:e,size:t=20,style:o}){return jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",style:{display:"inline-flex",flexShrink:0,...o},children:[e==="save"&&jsx("path",{d:"M12 3v11m0 0 4-4m-4 4-4-4M5 19h14"}),e==="image"&&jsxs(Fragment,{children:[jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"2"}),jsx("circle",{cx:"8.5",cy:"9.5",r:"1.25"}),jsx("path",{d:"m6 17 4.5-4.5 3.25 3.25L16 13.5l2 2"})]}),e==="undo"&&jsx("path",{d:"m9 7-5 5 5 5M5 12h9a6 6 0 0 1 6 6"}),e==="redo"&&jsx("path",{d:"m15 7 5 5-5 5m4-5h-9a6 6 0 0 0-6 6"}),e==="newSlide"&&jsxs(Fragment,{children:[jsx("rect",{x:"3",y:"5",width:"15",height:"14",rx:"1.5"}),jsx("path",{d:"M7 9h7M7 13h5M20 9v6m-3-3h6"})]}),e==="select"&&jsx("path",{d:"m6 3 12 9-6 1.5L9 19Z"}),e==="textBox"&&jsxs(Fragment,{children:[jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"1.5"}),jsx("path",{d:"M8 8h8m-4 0v8m-3 0h6"})]}),e==="shape"&&jsx("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"}),e==="fillColor"&&jsxs(Fragment,{children:[jsx("path",{d:"m7 4 10 10-5 5-7-7Z"}),jsx("path",{d:"m5 12 7-7m6 12h2"})]}),e==="borderColor"&&jsx(Fragment,{children:jsx("path",{d:"M5 18h14M8 15l8-8 2 2-8 8H8Z"})}),e==="borderWidth"&&jsxs(Fragment,{children:[jsx("path",{d:"M5 7h14",strokeWidth:"1"}),jsx("path",{d:"M5 12h14",strokeWidth:"2"}),jsx("path",{d:"M5 18h14",strokeWidth:"3"})]}),e==="bold"&&jsx("path",{d:"M7 4h6a4 4 0 0 1 0 8H7zm0 8h7a4 4 0 0 1 0 8H7z"}),e==="italic"&&jsx("path",{d:"M10 4h8M6 20h8M14 4 10 20"}),e==="underline"&&jsxs(Fragment,{children:[jsx("path",{d:"M7 4v7a5 5 0 0 0 10 0V4"}),jsx("path",{d:"M5 20h14"})]}),e==="textColor"&&jsxs(Fragment,{children:[jsx("path",{d:"m7 16 5-12 5 12M9 11h6"}),jsx("path",{d:"M5 20h14",strokeWidth:"3"})]}),e==="alignLeft"&&jsx("path",{d:"M4 6h16M4 10h10M4 14h16M4 18h10"}),e==="alignCenter"&&jsx("path",{d:"M4 6h16M7 10h10M4 14h16M7 18h10"}),e==="alignRight"&&jsx("path",{d:"M4 6h16M10 10h10M4 14h16M10 18h10"}),e==="alignJustify"&&jsx("path",{d:"M4 6h16M4 10h16M4 14h16M4 18h16"}),e==="more"&&jsxs(Fragment,{children:[jsx("circle",{cx:"5",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),jsx("circle",{cx:"19",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]}),e==="chevronDown"&&jsx("path",{d:"m7 10 5 5 5-5"}),e==="remove"&&jsx("path",{d:"M5 12h14"}),e==="add"&&jsx("path",{d:"M12 5v14M5 12h14"})]})}var A={text:"#3c4043",muted:"#5f6368",disabled:"#9aa0a6",hover:"#e2e7ef",active:"#d3e3fd",border:"#c7cacf",surface:"#ffffff",rail:"#edf2fa"},Ar={appearance:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:2,minWidth:28,height:28,padding:"0 5px",border:0,borderRadius:4,color:A.text,font:"500 13px ui-sans-serif, system-ui, sans-serif",lineHeight:1,whiteSpace:"nowrap",boxSizing:"border-box"};function fo(e,t,o,r){return {...Ar,background:t?A.active:o&&!e?A.hover:"transparent",color:e?A.disabled:A.text,cursor:e?"default":"pointer",opacity:e?.48:1,...r}}function Pe({active:e=false,disabled:t=false,title:o,onClick:r,children:a,style:s,testId:d,ariaExpanded:m}){let[f,g]=useState(false);return jsx("button",{type:"button","data-testid":d,disabled:t,"aria-label":o,"aria-pressed":e||void 0,"aria-expanded":m,title:o,onMouseDown:l=>l.preventDefault(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),onClick:t?void 0:r,style:fo(t,e,f,s),children:a})}function Me({label:e,children:t,style:o}){return jsx("div",{role:"group","aria-label":e,style:{display:"inline-flex",alignItems:"center",gap:1,flex:"0 0 auto",...o},children:t})}function _e(){return jsx("div",{role:"separator",style:{width:1,height:24,margin:"0 5px",background:A.border,flex:"0 0 auto"}})}function qe({title:e,trigger:t,children:o,disabled:r=false,active:a=false,menuWidth:s=220,style:d,testId:m}){let[f,g]=useState(false),[l,y]=useState(false),[I,K]=useState({top:0,left:0}),X=useRef(null),j=useRef(null),b=useCallback(()=>g(false),[]);return useEffect(()=>{if(!f||!X.current)return;let w=X.current.getBoundingClientRect(),B=Math.min(w.left,Math.max(8,window.innerWidth-s-8));K({top:w.bottom+4,left:B});},[f,s]),useEffect(()=>{if(!f)return;let w=N=>{let h=N.target;!X.current?.contains(h)&&!j.current?.contains(h)&&b();},B=N=>{N.key==="Escape"&&b();},k=()=>b();return document.addEventListener("mousedown",w),document.addEventListener("keydown",B),window.addEventListener("scroll",k,true),()=>{document.removeEventListener("mousedown",w),document.removeEventListener("keydown",B),window.removeEventListener("scroll",k,true);}},[f,b]),jsxs("div",{style:{position:"relative",display:"inline-flex",flex:"0 0 auto"},children:[jsx("button",{ref:X,type:"button","data-testid":m,disabled:r,"aria-label":e,"aria-haspopup":"menu","aria-expanded":f,title:e,onMouseDown:w=>w.preventDefault(),onMouseEnter:()=>y(true),onMouseLeave:()=>y(false),onClick:()=>!r&&g(w=>!w),style:fo(r,a||f,l,d),children:t}),f&&jsx("div",{ref:j,role:"menu","aria-label":e,onMouseDown:w=>w.preventDefault(),style:{position:"fixed",top:I.top,left:I.left,zIndex:1e4,width:s,maxHeight:"min(440px, calc(100vh - 16px))",overflowY:"auto",padding:6,border:`1px solid ${A.border}`,borderRadius:8,background:A.surface,boxShadow:"0 4px 16px rgba(60, 64, 67, 0.24)",boxSizing:"border-box"},children:o(b)})]})}function it({label:e,icon:t,selected:o=false,disabled:r=false,onClick:a,close:s}){let[d,m]=useState(false);return jsxs("button",{type:"button",role:"menuitem",disabled:r,"aria-label":e,onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),onClick:()=>{r||(a?.(),s?.());},style:{appearance:"none",display:"flex",alignItems:"center",gap:10,width:"100%",minHeight:32,padding:"5px 9px",border:0,borderRadius:4,background:d&&!r?A.hover:"transparent",color:r?A.disabled:A.text,cursor:r?"default":"pointer",opacity:r?.48:1,font:"400 13px ui-sans-serif, system-ui, sans-serif",textAlign:"left",boxSizing:"border-box"},children:[jsx("span",{style:{display:"inline-grid",placeItems:"center",width:20,flex:"0 0 auto"},children:t}),jsx("span",{style:{flex:1},children:e}),o&&jsx("span",{"aria-hidden":"true",children:"\u2713"})]})}function Br(){return jsx("div",{role:"separator",style:{height:1,margin:"5px 2px",background:A.border}})}function Dt({value:e,label:t,onChange:o,onClear:r,icon:a="textColor",none:s=false,clearLabel:d,disabled:m=false,testId:f}){let[g,l]=useState(false);return jsxs("span",{style:{display:"inline-flex",alignItems:"center",height:28},children:[jsxs("label",{title:t,"aria-label":t,style:{display:"inline-grid",placeItems:"center",width:28,height:28,borderRadius:4,background:g&&!m?A.hover:"transparent",color:m?A.disabled:A.text,cursor:m?"default":"pointer",opacity:m?.48:1,boxSizing:"border-box",position:"relative"},onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),children:[jsx(ee,{name:a,size:20}),jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:5,right:5,bottom:2,height:3,borderRadius:2,background:s?"transparent":e,border:s?`1px solid ${A.disabled}`:0,boxSizing:"border-box"}}),s?jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:5,bottom:3,width:18,height:1,background:"#d93025",transform:"rotate(-18deg)"}}):null,jsx("input",{"data-testid":f,type:"color",value:e,disabled:m,"aria-label":t,onChange:y=>o?.(y.target.value),style:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:0}})]}),r?jsx("button",{type:"button",disabled:m,"aria-label":d??t,title:d??t,onMouseDown:y=>y.preventDefault(),onClick:r,style:{appearance:"none",width:15,height:28,padding:0,border:0,borderRadius:3,background:"transparent",color:m?A.disabled:A.muted,cursor:m?"default":"pointer",opacity:m?.48:1,font:"500 14px ui-sans-serif, system-ui, sans-serif"},children:"\xD7"}):null]})}function Ft({value:e,options:t,label:o,onCommit:r,disabled:a=false,width:s=72,inputStyle:d,testId:m}){let[f,g]=useState(e),[l,y]=useState(false),[I,K]=useState({top:0,left:0,width:s}),X=useRef(null),j=useRef(null),b=useRef(null);useEffect(()=>g(e),[e]);let w=useCallback(()=>y(false),[]);useEffect(()=>{if(!l||!X.current)return;let k=X.current.getBoundingClientRect();K({top:k.bottom+4,left:k.left,width:Math.max(k.width,s)});},[l,s]),useEffect(()=>{if(!l)return;let k=h=>{let T=h.target;!X.current?.contains(T)&&!j.current?.contains(T)&&w();},N=h=>{h.key==="Escape"&&(g(e),w());};return document.addEventListener("mousedown",k),document.addEventListener("keydown",N),()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",N);}},[l,w,e]);let B=useCallback(()=>{!a&&r&&f.trim()&&r(f.trim()),g(e);},[a,r,f,e]);return jsxs("div",{ref:X,style:{display:"inline-flex",alignItems:"center",width:s,height:28,border:`1px solid ${A.border}`,borderRadius:4,background:a?"rgba(255,255,255,0.5)":A.surface,opacity:a?.48:1,boxSizing:"border-box",flex:"0 0 auto"},children:[jsx("input",{ref:b,"data-testid":m,role:"combobox","aria-label":o,"aria-autocomplete":"list","aria-expanded":l,disabled:a,value:f,onFocus:k=>{a||(y(true),k.currentTarget.select());},onChange:k=>g(k.target.value),onKeyDown:k=>{k.key==="Enter"?(B(),w(),k.currentTarget.blur()):k.key==="ArrowDown"&&(y(true),k.preventDefault());},onBlur:()=>{requestAnimationFrame(()=>{j.current?.contains(document.activeElement)||B();});},style:{appearance:"none",width:"calc(100% - 22px)",height:26,padding:"0 2px 0 7px",border:0,outline:0,background:"transparent",color:A.text,font:"500 13px ui-sans-serif, system-ui, sans-serif",boxSizing:"border-box",...d}}),jsx("button",{type:"button",disabled:a,tabIndex:-1,"aria-label":o,title:o,onMouseDown:k=>k.preventDefault(),onClick:()=>{a||(y(k=>!k),b.current?.focus());},style:{appearance:"none",display:"grid",placeItems:"center",width:21,height:26,padding:0,border:0,background:"transparent",color:A.muted,cursor:a?"default":"pointer"},children:jsx(ee,{name:"chevronDown",size:14})}),l&&!a&&jsx("div",{ref:j,role:"listbox","aria-label":o,style:{position:"fixed",top:I.top,left:I.left,zIndex:1e4,width:I.width,maxHeight:260,overflowY:"auto",padding:4,border:`1px solid ${A.border}`,borderRadius:6,background:A.surface,boxShadow:"0 4px 16px rgba(60, 64, 67, 0.24)",boxSizing:"border-box"},children:t.map(k=>jsx("button",{type:"button",role:"option","aria-selected":k.value===e,onMouseDown:N=>N.preventDefault(),onClick:()=>{g(k.label),r?.(k.value),w();},style:{appearance:"none",display:"block",width:"100%",minHeight:28,padding:"4px 7px",border:0,borderRadius:3,background:k.value===e?A.active:"transparent",color:A.text,cursor:"pointer",font:"400 13px ui-sans-serif, system-ui, sans-serif",textAlign:"left"},children:k.label},k.value))})]})}var St=[{geometry:"rect",labelKey:"toolbar.shapes.rect"},{geometry:"roundRect",labelKey:"toolbar.shapes.roundRect"},{geometry:"ellipse",labelKey:"toolbar.shapes.ellipse"},{geometry:"triangle",labelKey:"toolbar.shapes.triangle"},{geometry:"rtTriangle",labelKey:"toolbar.shapes.rtTriangle"},{geometry:"diamond",labelKey:"toolbar.shapes.diamond"},{geometry:"parallelogram",labelKey:"toolbar.shapes.parallelogram"},{geometry:"trapezoid",labelKey:"toolbar.shapes.trapezoid"},{geometry:"pentagon",labelKey:"toolbar.shapes.pentagon"},{geometry:"hexagon",labelKey:"toolbar.shapes.hexagon"},{geometry:"octagon",labelKey:"toolbar.shapes.octagon"},{geometry:"star5",labelKey:"toolbar.shapes.star5"},{geometry:"rightArrow",labelKey:"toolbar.shapes.rightArrow"},{geometry:"leftArrow",labelKey:"toolbar.shapes.leftArrow"},{geometry:"upArrow",labelKey:"toolbar.shapes.upArrow"},{geometry:"downArrow",labelKey:"toolbar.shapes.downArrow"},{geometry:"chevron",labelKey:"toolbar.shapes.chevron"}],_r=[.5,.75,1,1.25,1.5,2],Ur=["Arial","Calibri","Cambria","Georgia","Roboto","Times New Roman","Verdana"],jr=[8,9,10,11,12,14,16,18,20,24,28,36,48,72],Xr=[{value:"l",icon:"alignLeft",labelKey:"toolbar.align.left",testId:"left"},{value:"ctr",icon:"alignCenter",labelKey:"toolbar.align.center",testId:"center"},{value:"r",icon:"alignRight",labelKey:"toolbar.align.right",testId:"right"},{value:"just",icon:"alignJustify",labelKey:"toolbar.align.justify",testId:"justify"}],Gr=[1,2,3,4,8],Zr=[0,10,17,25,33,50],$r=[0,10,20,30,40,50,60,70,80,90,100];function Yr(e){let t={};for(let o of Object.keys(e))e[o]!==void 0&&(t[o]=e[o]);return t}function Vr(e){let t=useContext(rt);return t?{...t,...Yr(e)}:e}function xo(e,t,o){return o>0?t.find(r=>r>e)??e+1:[...t].reverse().find(r=>r<e)??Math.max(1,e-1)}function qr(e){if(!e)return null;if(e.adj!==void 0)return ["adj",e.adj];if(e.adj1!==void 0)return ["adj1",e.adj1];let t=Object.keys(e).sort()[0];return t?[t,e[t]]:null}function At(e){let{t}=Te(),{currentFormatting:o={},textSelectionActive:r=false,onFormat:a,currentShapeFormatting:s={},shapeSelectionActive:d=false,onShapeFormat:m,onInsertSlide:f,slideLayouts:g=[],currentLayoutPartPath:l,onSave:y,onExportPng:I,onUndo:K,onRedo:X,canUndo:j=false,canRedo:b=false,zoom:w="fit",onZoomChange:B,activeTool:k="select",onToolChange:N,fontFamilies:h=Ur,fontSizes:T=jr,disabled:O=false,className:Z,style:Se,children:se}=Vr(e),ne=useRef(null),[Ae,we]=useState(Number.POSITIVE_INFINITY),L=!O&&r&&!!a,oe=!O&&d&&!!m,Be=!O&&!!f,je=!O&&!!N,v=o.fontSize??24,Ke=t("toolbar.fit"),x=w==="fit"?Ke:`${Math.round(w*100)}%`,V=qr(s.adjustments),q=s.geometry==="roundRect"&&V?.[0]==="adj";useEffect(()=>{let C=ne.current;if(!C)return;let R=()=>we(C.clientWidth);R();let ve=new ResizeObserver(R);return ve.observe(C),()=>ve.disconnect()},[]);let ce=useMemo(()=>[{value:Ke,label:Ke},..._r.map(C=>({value:`${C*100}%`,label:`${C*100}%`}))],[Ke]),dt=useMemo(()=>T.map(C=>({value:String(C),label:String(C)})),[T]),$=C=>{L&&a?.(C);},he=C=>{oe&&m?.(C);},ae=[{key:"file",width:72,node:jsxs(Me,{label:t("toolbar.groups.file"),children:[jsx(Pe,{title:t("toolbar.save"),disabled:O||!y,onClick:y,testId:"pptx-save",children:jsx(ee,{name:"save",size:18})}),jsx(Pe,{title:t("toolbar.exportPng"),disabled:O||!I,onClick:I,testId:"pptx-export-png",children:jsx(ee,{name:"image",size:18})})]})},{key:"new-slide",width:59,node:jsxs(Me,{label:t("toolbar.groups.slides"),children:[jsx(Pe,{title:t("toolbar.newSlide"),disabled:!Be,onClick:()=>f?.(),style:{borderRadius:"4px 0 0 4px"},testId:"pptx-new-slide",children:jsx(ee,{name:"newSlide"})}),jsx(qe,{title:t("toolbar.newSlideWithLayout"),disabled:!Be||g.length===0,menuWidth:230,testId:"pptx-new-slide-layout",style:{minWidth:20,width:20,padding:0,borderRadius:"0 4px 4px 0"},trigger:jsx(ee,{name:"chevronDown",size:13}),children:C=>jsx(Fragment,{children:g.map((R,ve)=>jsx(it,{label:R.label??t("toolbar.layoutOption",{number:ve+1}),selected:(R.partPath??null)===(l??null),onClick:()=>f?.(R.partPath),close:C},R.partPath??`default-${ve}`))})})]})},{key:"history",width:75,node:jsxs(Fragment,{children:[jsx(_e,{}),jsxs(Me,{label:t("toolbar.groups.history"),children:[jsx(Pe,{title:t("toolbar.undoShortcut"),disabled:O||!j||!K,onClick:K,testId:"pptx-undo",children:jsx(ee,{name:"undo"})}),jsx(Pe,{title:t("toolbar.redoShortcut"),disabled:O||!b||!X,onClick:X,testId:"pptx-redo",children:jsx(ee,{name:"redo"})})]})]})},{key:"zoom",width:82,node:jsx(Me,{label:t("toolbar.groups.zoom"),children:jsx(Ft,{value:x,options:ce,label:t("toolbar.zoomValue",{value:x}),disabled:O||!B,onCommit:C=>{if(C===Ke){B?.("fit");return}let R=Number.parseFloat(C.replace("%",""));Number.isFinite(R)&&R>=25&&R<=400&&B?.(R/100);},width:76,testId:"pptx-zoom"})})},{key:"tools",width:127,node:jsxs(Fragment,{children:[jsx(_e,{}),jsxs(Me,{label:t("toolbar.groups.tools"),children:[jsx(Pe,{title:t("toolbar.selectToolShortcut"),active:k==="select",disabled:!je,onClick:()=>N?.("select"),testId:"pptx-tool-select",children:jsx(ee,{name:"select"})}),jsx(Pe,{title:t("toolbar.textBoxTool"),active:k==="textBox",disabled:!je,onClick:()=>N?.("textBox"),testId:"pptx-tool-text-box",children:jsx(ee,{name:"textBox"})}),jsx(qe,{title:t("toolbar.shapeTool"),active:k.startsWith("shape:"),disabled:!je,menuWidth:264,testId:"pptx-tool-shape",style:{minWidth:46,padding:"0 4px"},trigger:jsxs(Fragment,{children:[jsx(ee,{name:"shape"}),jsx(ee,{name:"chevronDown",size:11})]}),children:C=>jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 44px)",gap:4,padding:2},children:St.map(R=>jsx("button",{type:"button",role:"menuitem","data-testid":`pptx-shape-${R.geometry}`,"aria-label":t(R.labelKey),title:t(R.labelKey),onClick:()=>{N?.(`shape:${R.geometry}`),C();},style:{appearance:"none",display:"grid",placeItems:"center",width:44,height:38,padding:5,border:`1px solid ${A.border}`,borderRadius:4,background:k===`shape:${R.geometry}`?A.active:A.surface,color:A.text,cursor:"pointer"},children:jsx(Jr,{geometry:R.geometry})},R.geometry))})})]})]})},{key:"font-family",width:137,node:jsxs(Fragment,{children:[jsx(_e,{}),jsx(Me,{label:t("toolbar.groups.font"),children:jsx(qe,{title:t("toolbar.fontFamily"),disabled:!L,menuWidth:210,testId:"pptx-font-family",style:{width:120,justifyContent:"space-between"},trigger:jsxs(Fragment,{children:[jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:o.fontFamily??t("toolbar.mixed")}),jsx(ee,{name:"chevronDown",size:13})]}),children:C=>jsx(Fragment,{children:h.map(R=>jsx(it,{label:R,selected:o.fontFamily===R,onClick:()=>$({type:"fontFamily",value:R}),close:C},R))})})})]})},{key:"font-size",width:116,node:jsxs(Me,{label:t("toolbar.groups.font"),children:[jsx(Pe,{title:t("toolbar.decreaseFontSize"),disabled:!L,onClick:()=>$({type:"fontSize",value:xo(v,T,-1)}),children:jsx(ee,{name:"remove"})}),jsx(Ft,{value:o.fontSize===void 0?"":String(v),options:dt,label:t("toolbar.fontSize"),disabled:!L,onCommit:C=>{let R=Number.parseFloat(C);Number.isFinite(R)&&R>=1&&R<=400&&$({type:"fontSize",value:R});},width:50,inputStyle:{textAlign:"center"},testId:"pptx-font-size"}),jsx(Pe,{title:t("toolbar.increaseFontSize"),disabled:!L,onClick:()=>$({type:"fontSize",value:xo(v,T,1)}),children:jsx(ee,{name:"add"})})]})},{key:"text",width:133,node:jsxs(Fragment,{children:[jsx(_e,{}),jsxs(Me,{label:t("toolbar.groups.text"),children:[jsx(Pe,{title:t("toolbar.boldShortcut"),active:o.bold,disabled:!L,onClick:()=>$("bold"),testId:"pptx-bold",children:jsx(ee,{name:"bold"})}),jsx(Pe,{title:t("toolbar.italicShortcut"),active:o.italic,disabled:!L,onClick:()=>$("italic"),testId:"pptx-italic",children:jsx(ee,{name:"italic"})}),jsx(Pe,{title:t("toolbar.underlineShortcut"),active:o.underline,disabled:!L,onClick:()=>$("underline"),testId:"pptx-underline",children:jsx(ee,{name:"underline"})}),jsx(Dt,{value:o.textColor??"#000000",label:t("toolbar.textColor"),disabled:!L,onChange:C=>$({type:"textColor",value:C}),testId:"pptx-text-color"})]})]})},{key:"align",width:126,node:jsxs(Fragment,{children:[jsx(_e,{}),jsx(Me,{label:t("toolbar.groups.alignment"),children:Xr.map(C=>jsx(Pe,{title:t(C.labelKey),active:o.align===C.value,disabled:!L,onClick:()=>$({type:"align",value:C.value}),testId:`pptx-align-${C.testId}`,children:jsx(ee,{name:C.icon})},C.value))})]})},{key:"shape-formatting",width:V?244:172,node:jsxs(Fragment,{children:[jsx(_e,{}),jsxs(Me,{label:t("toolbar.groups.shape"),children:[jsx(Dt,{value:s.fillColor??"#d9eaf7",label:t("toolbar.fillColor"),clearLabel:t("toolbar.noFill"),icon:"fillColor",none:!s.fillColor,disabled:!oe,onChange:C=>he({type:"fillColor",value:C}),onClear:()=>he({type:"fillColor",value:null}),testId:"pptx-shape-fill"}),jsx(Dt,{value:s.strokeColor??"#202124",label:t("toolbar.borderColor"),clearLabel:t("toolbar.noBorder"),icon:"borderColor",none:!s.strokeColor,disabled:!oe,onChange:C=>he({type:"strokeColor",value:C}),onClear:()=>he({type:"strokeColor",value:null}),testId:"pptx-shape-border-color"}),jsx(qe,{title:t("toolbar.borderWidth"),disabled:!oe,menuWidth:170,testId:"pptx-shape-border-width",trigger:jsx(ee,{name:"borderWidth"}),children:C=>jsxs(Fragment,{children:[jsx(it,{label:t("toolbar.noBorder"),selected:s.strokeWidthPt===null,onClick:()=>he({type:"strokeWidth",value:null}),close:C}),Gr.map(R=>jsx(it,{label:t("toolbar.borderWidthValue",{width:R}),selected:s.strokeWidthPt===R,icon:jsx("span",{"aria-hidden":"true",style:{width:18,borderTop:`${Math.min(R,5)}px solid currentColor`}}),onClick:()=>he({type:"strokeWidth",value:R}),close:C},R))]})}),V?jsx(Ft,{value:`${Math.round(V[1]*100)}%`,options:(q?Zr:$r).map(C=>({value:String(C),label:`${C}%`})),label:t(q?"toolbar.cornerRadius":"toolbar.shapeAdjustment"),disabled:!oe,onCommit:C=>{let R=Number.parseFloat(C.replace("%",""));if(Number.isFinite(R)){let ve=q?50:100;he({type:"adjust",name:V[0],value:Math.max(0,Math.min(ve,R))/100});}},width:68,inputStyle:{textAlign:"center"},testId:q?"pptx-shape-corner-radius":"pptx-shape-adjustment"}):null]})]})}];se&&ae.push({key:"custom",width:40,node:se});let Ce=Math.max(0,Ae-48),ct=0,Qe=ae.length;for(let C=0;C<ae.length;C++)if(ct+=ae[C].width,ct>Ce){Qe=C;break}let It=ae.slice(0,Qe),et=ae.slice(Qe);return jsxs("div",{ref:ne,className:Z,role:"toolbar","aria-label":t("toolbar.label"),"data-testid":"pptx-formatting-toolbar",style:{display:"flex",alignItems:"center",minWidth:0,minHeight:36,margin:"0 8px 5px",padding:"4px 7px",borderRadius:18,background:A.rail,color:A.text,overflow:"hidden",boxSizing:"border-box",...Se},children:[It.map(C=>jsx("span",{style:{display:"contents"},children:C.node},C.key)),jsx("span",{style:{marginLeft:"auto",flex:"0 0 auto"},children:jsx(qe,{title:t("toolbar.more"),disabled:et.length===0,menuWidth:390,testId:"pptx-toolbar-more",trigger:jsx(ee,{name:"more"}),children:()=>jsx("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:2},children:et.map(C=>jsx("span",{style:{display:"contents"},children:C.node},C.key))})})})]})}function Jr({geometry:e}){let t={rect:"M3 5h18v14H3Z",roundRect:"M7 5h10a4 4 0 0 1 4 4v6a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a4 4 0 0 1 4-4Z",ellipse:"M3 12a9 7 0 1 0 18 0 9 7 0 1 0-18 0",triangle:"m12 4 9 16H3Z",rtTriangle:"M4 4v16h16Z",diamond:"m12 3 9 9-9 9-9-9Z",parallelogram:"M7 5h14l-4 14H3Z",trapezoid:"M7 5h10l4 14H3Z",pentagon:"m12 3 9 7-4 11H7L3 10Z",hexagon:"m7 4 10 0 5 8-5 8H7l-5-8Z",octagon:"m7 3 10 0 4 4v10l-4 4H7l-4-4V7Z",star5:"m12 2.5 2.8 6 6.5.6-5 4.3 1.6 6.4-5.7-3.4-5.7 3.4 1.6-6.4-5-4.3 6.5-.6Z",rightArrow:"M3 8h11V4l7 8-7 8v-4H3Z",leftArrow:"m21 8H10V4l-7 8 7 8v-4h11Z",upArrow:"M8 21V10H4l8-7 8 7h-4v11Z",downArrow:"M8 3v11H4l8 7 8-7h-4V3Z",chevron:"M4 4h9l7 8-7 8H4l7-8Z"}[e];return jsx("svg",{width:"30",height:"24",viewBox:"0 0 24 24",fill:"rgba(60, 64, 67, 0.08)",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round","aria-hidden":"true",children:jsx("path",{d:t})})}function Qr({children:e,className:t,style:o,...r}){return jsx(rt.Provider,{value:r,children:jsx("div",{className:t,"data-testid":"pptx-editor-toolbar",style:{display:"flex",flexDirection:"column",flex:"0 0 auto",...o},children:e})})}var vt=Qr;vt.Toolbar=At;function Io({handle:e,slideCount:t,startIndex:o,resolveImage:r,label:a,counterLabel:s,exitLabel:d,previousLabel:m,nextLabel:f,onExit:g,onError:l}){let y=useRef(null),I=useRef(null),K=useRef(null),X=useRef({onExit:g,onError:l});X.current={onExit:g,onError:l};let[j,b]=useState(o),w=Math.max(0,Math.min(j,t-1)),[B,k]=useState({width:0,height:0}),N=h=>b(Math.max(0,Math.min(w+h,t-1)));return useEffect(()=>{b(h=>Math.max(0,Math.min(h,t-1))),t===0&&X.current.onExit();},[t]),useEffect(()=>{let h=I.current,T=y.current,O=document.activeElement,Z=true;h.showModal(),h.focus(),T.requestFullscreen?.().then(()=>{Z?(h.close(),h.showModal(),h.focus()):document.fullscreenElement===T&&document.exitFullscreen().catch(()=>{});}).catch(()=>{});let Se=()=>{document.fullscreenElement||X.current.onExit();},se=()=>k({width:window.innerWidth,height:window.innerHeight});return se(),window.addEventListener("resize",se),document.addEventListener("fullscreenchange",Se),()=>{Z=false,window.removeEventListener("resize",se),document.removeEventListener("fullscreenchange",Se),document.fullscreenElement===T&&document.exitFullscreen().catch(()=>{}),h.close(),O instanceof HTMLElement&&O.isConnected&&O.focus();}},[]),useEffect(()=>{let h=K.current;if(!h||t===0||B.width<=0||B.height<=0)return;let T=false;return (async()=>{let Z=e.layoutSlide(w),Se=document.createElement("canvas"),se=Se.getContext("2d");if(!se)return;let ne=Math.min(B.width/Z.width,B.height/Z.height),Ae=window.devicePixelRatio||1;sizeCanvasForSlide(Se,Z,Ae,ne),await paintSlide(se,Z,Ae,ne,{resolveImage:r}),!T&&(sizeCanvasForSlide(h,Z,Ae,ne),h.getContext("2d")?.drawImage(Se,0,0));})().catch(Z=>{T||(X.current.onError(Z),X.current.onExit());}),()=>{T=true;}},[e,w,t,r,B]),jsx("div",{ref:y,children:jsxs("dialog",{ref:I,"aria-label":a,tabIndex:-1,style:Je.presentationOverlay,onCancel:h=>{h.preventDefault(),g();},onClick:h=>{h.target===I.current&&N(1);},onKeyDown:h=>{if(!(h.altKey||h.ctrlKey||h.metaKey)){switch(h.key){case " ":if(h.target instanceof HTMLElement&&h.target.closest("button"))return;N(1);break;case "ArrowRight":case "ArrowDown":case "PageDown":N(1);break;case "ArrowLeft":case "ArrowUp":case "PageUp":N(-1);break;case "Home":b(0);break;case "End":b(Math.max(0,t-1));break;case "Escape":g();break;default:return}h.preventDefault(),h.stopPropagation();}},children:[jsx("canvas",{ref:K,style:Je.presentationCanvas}),jsx("button",{type:"button",onClick:g,"aria-label":d,title:d,style:Je.presentationExit,children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:jsx("path",{d:"M6 6 18 18M18 6 6 18"})})}),jsxs("div",{style:Je.presentationControls,children:[jsx("button",{type:"button",onClick:()=>N(-1),disabled:w===0,"aria-label":m,style:Je.presentationNavButton,children:jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4","aria-hidden":"true",children:jsx("path",{d:"m15 6-6 6 6 6"})})}),jsx("span",{style:Je.presentationCounter,"aria-live":"polite",children:s(w+1,t)}),jsx("button",{type:"button",onClick:()=>N(1),disabled:w>=t-1,"aria-label":f,style:Je.presentationNavButton,children:jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4","aria-hidden":"true",children:jsx("path",{d:"m9 6 6 6-6 6"})})})]})]})})}var Je={presentationOverlay:{position:"fixed",margin:0,padding:0,border:0,width:"100vw",height:"100vh",maxWidth:"none",maxHeight:"none",inset:0,zIndex:2147483e3,display:"flex",alignItems:"center",justifyContent:"center",background:"#000000",cursor:"pointer"},presentationCanvas:{display:"block",pointerEvents:"none"},presentationExit:{position:"absolute",top:16,right:16,display:"inline-flex",alignItems:"center",justifyContent:"center",width:36,height:36,border:0,borderRadius:999,background:"rgba(255, 255, 255, 0.14)",color:"#ffffff",cursor:"pointer"},presentationControls:{position:"absolute",bottom:20,left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:12,padding:"6px 14px",borderRadius:999,background:"rgba(255, 255, 255, 0.12)"},presentationNavButton:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,border:0,borderRadius:999,background:"rgba(255, 255, 255, 0.14)",color:"#ffffff",cursor:"pointer"},presentationCounter:{minWidth:64,color:"#ffffff",fontSize:12,fontWeight:600,textAlign:"center"}};function wo(e,t=12){return {visible:e.slice(0,t),overflow:Math.max(0,e.length-t)}}function To(e,t,o=4){let r=new Map;for(let a of e){let s=a.state.cursor?.slideId;if(!s||!t.has(s))continue;let d=r.get(s)??{visible:[],overflow:0};d.visible.length<o?d.visible.push(a):d.overflow+=1,r.set(s,d);}return r}function Co(e,t,o,r=24){let a=new Map,s=0;for(let d of e){let m=d.state.cursor;if(m?.slideId!==t||!m.shapeId||!o.has(m.shapeId))continue;let f=a.get(m.shapeId);f?(f.count+=1,d.cursorMovedAt>f.peer.cursorMovedAt&&(f.peer=d)):a.size<r?a.set(m.shapeId,{shapeId:m.shapeId,peer:d,count:1}):s+=1;}return {visible:[...a.values()],overflow:s}}function zt(e,t,o,r){let a=ii(e,t,o,r),s=at(a,"underline");return {bold:at(a,"bold"),italic:at(a,"italic"),underline:s===void 0?void 0:s!=="none",fontSize:at(a,"fontSizePt"),textColor:at(a,"color"),fontFamily:at(a,"fontFamily")}}function Eo(e,t){return zt(e,0,e.length,t)}var ti={left:"l",center:"ctr",right:"r",justify:"just"},ni={l:"l",ctr:"ctr",r:"r",just:"just",justLow:"just",dist:"just",thaiDist:"just"};function pn(e,t,o,r){let a=ri(e),s=a[a.length-1]?.end??0,d=Math.min(Math.min(o,r),s),m=Math.max(o,r),f=a.map((l,y)=>({range:l,index:y})).filter(({range:l})=>d===m?d>=l.start&&d<=l.end:d<=l.end&&m>l.start).map(({index:l})=>oi(e,t,l));if(f.length===0)return;let g=f[0];return f.every(l=>l===g)?g:void 0}function oi(e,t,o){let r=e.paragraphs[o]?.alignment;if(r)return ni[r]??"l";let a=t?.paragraphs[o]?.align;return a?ti[a]??"l":"l"}function ri(e){let t=0;return e.paragraphs.map(o=>{let r=t+o.runs.reduce((s,d)=>s+d.text.length,0),a={start:t,end:r};return t=r+1,a})}function Mo(e,t,o,r){let a=zt(e,t,o,r);return {bold:a.bold??r.bold,italic:a.italic??r.italic,underline:a.underline===void 0?r.underline:a.underline?"sng":"none",fontSizePt:a.fontSize??r.fontSizePt,color:a.textColor??r.color,fontFamily:a.fontFamily??r.fontFamily}}function ii(e,t,o,r){let a=ai(e,r);if(a.length===0)return [r];let s=Math.min(t,o),d=Math.max(t,o);if(s===d){let g=a.find(y=>s>=y.start&&s<y.end);return g?[g.style]:[[...a].reverse().find(y=>y.end<=s)?.style??a[0].style]}let m=a.filter(g=>g.end>s&&g.start<d).map(g=>g.style);return m.length>0?m:[[...a].reverse().find(g=>g.end<=s)?.style??a[0].style]}function ai(e,t){let o=[],r=0;return e.paragraphs.forEach((a,s)=>{for(let d of a.runs){let m=r;r+=d.text.length,r>m&&o.push({start:m,end:r,style:si(d.style,t)});}s<e.paragraphs.length-1&&(r+=1);}),o}function si(e,t){return {bold:e.bold??t.bold,italic:e.italic??t.italic,underline:e.underline??t.underline,fontSizePt:e.fontSizePt??t.fontSizePt,color:e.color??t.color,fontFamily:e.fontFamily??t.fontFamily}}function at(e,t){let o=e[0]?.[t];return e.every(r=>r[t]===o)?o:void 0}function Ro(e){let t=e?.fill?.type==="none"?null:ko(e?.resolvedFillColor),o=ko(e?.resolvedOutlineColor);return {geometry:e?.geometry,fillColor:t,strokeColor:o,strokeWidthPt:o&&e?.outline?.width!==void 0?e.outline.width/12700:o?1:null,adjustments:e?.adjustValues??{}}}function ko(e){if(!e)return null;let t=e.replace(/^#/,"");return /^[0-9a-f]{6}$/i.test(t)?`#${t}`:null}var Lo=new Intl.Segmenter(void 0,{granularity:"word"});function fn(e,t,o){return o==="word"?li(e,t):di(e,t)}function li(e,t){let o=hn(e,t),r=[...Lo.segment(e)],a=r.find(s=>o>=s.index&&o<s.index+s.segment.length)??r[r.length-1];return a?{start:a.index,end:a.index+a.segment.length}:{start:o,end:o}}function di(e,t){let o=hn(e,t),r=e.lastIndexOf(`
|
|
2
|
-
`,Math.max(0,o-1))+1,a=e.indexOf(`
|
|
3
|
-
`,o);return {start:r,end:a===-1?e.length:a}}function Do(e,t){return t.start<e.start?{anchor:e.end,focus:t.start}:t.end>e.end?{anchor:e.start,focus:t.end}:{anchor:e.start,focus:e.end}}function hn(e,t){return Number.isFinite(t)?Math.max(0,Math.min(e.length,Math.trunc(t))):0}function Fo(e,t){return e.shapeId===t.shapeId&&e.position===t.position&&e.lineIndex===t.lineIndex}function mn(e,t){return e[Pt(e,t)]?.caretStops.find(r=>r.position===t.position)?.x}function Ao(e,t,o,r){if(e.length===0)return {position:t.position,lineIndex:0};let a=Pt(e,t),s=a+(o==="up"?-1:1),d=e[s];if(!d)return {position:t.position,lineIndex:a};let m=r??mn(e,t);return m===void 0?{position:d.start,lineIndex:s}:{position:d.caretStops.reduce((g,l)=>g===null||Math.abs(l.x-m)<Math.abs(g.x-m)?l:g,null)?.position??d.start,lineIndex:s}}function Ht(e,t,o){let r=Pt(e,t),a=e[r];return a?{position:o==="start"?a.start:a.end,lineIndex:r}:{position:t.position,lineIndex:r}}function Bo(e,t,o){let r=hn(e,t),a=[...Lo.segment(e)].filter(d=>d.isWordLike).flatMap(d=>[d.index,d.index+d.segment.length]),s=o<0?a.filter(d=>d<r):a.filter(d=>d>r);return s.length===0?o<0?0:e.length:o<0?Math.max(...s):Math.min(...s)}function Pt(e,t){let o=t.lineIndex;if(o!==void 0&&o>=0&&o<e.length&&t.position>=e[o].start&&t.position<=e[o].end)return o;let r=-1;for(let a=0;a<e.length;a+=1){let s=e[a];t.position>=s.start&&t.position<=s.end&&(r=a);}return r===-1?Math.max(0,e.length-1):r}var mi="application/vnd.openxmlformats-officedocument.presentationml.presentation";function gi(e,t){return `${(e??"presentation.pptx").replace(/\.pptx$/i,"")}-slide-${t+1}.png`}function Ho(e,t,o){let r=new Blob([new Uint8Array(e)],{type:o}),a=URL.createObjectURL(r),s=document.createElement("a");s.href=a,s.download=t,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(a);}var bi=530,Wt=9,Nt={bold:false,italic:false,underline:"none",fontSizePt:24,color:"#111827",fontFamily:"Arial"};function xi({i18n:e,...t}){return jsx(Ct,{i18n:e,children:jsx(yi,{...t})})}function yi({file:e,fonts:t,clientId:o,collaboration:r,className:a,fileName:s,onReady:d,onChange:m,onError:f,onSave:g}){let{t:l}=Te(),y=l("errors.decodeSlideImage"),I=r?.clientId??o,K=r?.initialUpdate,X=r?.onReplica,j=r?.presence,b=useRef(null),w=useRef(null),B=useRef(d),k=useRef(m),N=useRef(f),h=useRef(null),T=useRef(null),O=useRef(null),[Z,Se]=useState(false),se=useRef(null),ne=useRef(null),[Ae,we]=useState(null),L=useRef(null),oe=useRef(null),Be=useRef(new Map),je=Ci(t),[v,Ke]=useState(null),[x,V]=useState(null),[q,ce]=useState(null),[dt,$]=useState(null),[he,ae]=useState(null),[Ce,ct]=useState(Nt),[Qe,It]=useState({canUndo:false,canRedo:false}),[et,C]=useState("fit"),[R,ve]=useState("select"),[xn,Kt]=useState(null),[ut,_o]=useState({width:0,height:0}),[yn,_t]=useState(null),[Uo,wt]=useState(false),[Ut,Sn]=useState(null),[Xe,jt]=useState([]),[jo,Xt]=useState(false),[Gt,Zt]=useState([]),[vn,pt]=useState(false),Pn=useRef(null),re=ao(b.current,Gt,v?.snapshot,v?.slideIndex??0),[Xo,Go]=useState(null),Zo=useCallback(n=>st(n,b,Be,y),[y]);useEffect(()=>{re.reviewing&&(V(null),ce(null),L.current=null,ne.current=null,we(null),$(null),ae(null));},[re.reviewing]),B.current=d,k.current=m,N.current=f,w.current=v;let U=useCallback(n=>{let i=n instanceof Error?n:new Error(String(n));_t(i.message),N.current?.(i);},[]),le=useCallback((n,i=false,u=false)=>{let c=b.current;if(!c)return null;try{se.current=null;let p=c.snapshot(),P=wi(n??w.current?.slideIndex??0,p.slides.length),E=new Map;for(let z=0;z<p.slides.length;z+=1){let ye=p.slides[z],Le=w.current?.thumbnails.get(ye.id);z!==P&&Le&&!u?E.set(ye.id,Le):z!==P&&E.set(ye.id,c.layoutSlide(z));}let M=p.slides.length>0?c.layoutSlide(P):null;M&&E.set(p.slides[P].id,M);let de={snapshot:p,slideIndex:P,frame:M,thumbnails:E},Y=p.slides[P];V(z=>z&&Y&&Ee(Y.shapes,z.shapeId)?z:null),ce(z=>z&&Y?.id===z.slideId&&Ee(Y.shapes,z.shapeId)?z:null);let G=L.current;G&&(!Y||Y.id!==G.slideId||G.kind!=="textBox"&&G.kind!=="shapeInsert"&&!Ee(Y.shapes,G.shapeId))&&(L.current=null,oe.current=null,$(null),ae(null));let ue=ne.current;return ue&&!$n(Y,ue)&&(ne.current=null,we(null)),w.current=de,Ke(de),It({canUndo:c.canUndo(),canRedo:c.canRedo()}),Zt(c.listProposals()),_t(null),i&&k.current?.(p),de}catch(p){return U(p),null}},[U]),In=useCallback(()=>{le(void 0,false,true);},[le]),wn=useCallback((n,i,u)=>{let c=w.current?.snapshot.slides.findIndex(E=>E.id===n)??-1;if(c<0)return;let p=le(c),P=p?.snapshot.slides[p.slideIndex];V(null),ce(i&&P&&Ee(P.shapes,i)?{slideId:n,shapeId:i}:null),u&&re.select(u),re.setEnabled(true);},[le,re.select,re.setEnabled]),tt=useCallback(()=>{try{Zt(b.current?.listProposals()??[]);}catch(n){U(n);}},[U]),Tn=useCallback((n,i=false)=>{try{b.current?.acceptProposal(n,{force:i}),le(void 0,!0,!0);}catch(u){tt(),u instanceof StaleProposalError||U(u);}},[le,tt,U]),Cn=useCallback(n=>{try{b.current?.rejectProposal(n),tt();}catch(i){U(i);}},[tt,U]);useEffect(()=>{let n=false,i=null,u=[],c=()=>{};if(b.current?.dispose(),b.current=null,Sn(null),w.current=null,Ke(null),V(null),ce(null),$(null),ae(null),we(null),It({canUndo:false,canRedo:false}),ve("select"),Xt(false),Zt([]),pt(false),L.current=null,ne.current=null,se.current=null,oe.current=null,_t(null),Be.current.clear(),!!e)return wt(true),Promise.all([initWasm(),Fi(je)]).then(([,p])=>{if(u=p,n){No(u);return}try{i=openPresentation(e,{clientId:I,fonts:je,initialUpdate:K}),b.current=i,c=i.onUpdate((E,M)=>{M==="remote"&&le(void 0,!0,!0);}),le(0),wt(!1),Sn(i);let P=i;B.current?.({handle:P,refresh:In,refreshProposals:tt,save:()=>P.save(),focus:()=>h.current?.focus()});}catch(P){wt(false),U(P);}},p=>{n||(wt(false),U(p));}),()=>{n=true,c(),i?.dispose(),b.current===i&&(b.current=null),No(u);}},[I,K,e,je,In,le,U]),useEffect(()=>{if(!(!X||!Ut))return X(Ut),()=>X(null)},[X,Ut]),useEffect(()=>Kt(null),[R]),useEffect(()=>{if(!j){jt([]);return}return jt(j.peers),j.onPresence(jt)},[j]),useEffect(()=>{let n=T.current;if(!n)return;let i=()=>_o({width:n.clientWidth,height:n.clientHeight});i();let u=new ResizeObserver(i);return u.observe(n),()=>u.disconnect()},[]);let $o=useMemo(()=>!v?.frame||ut.width<=0||ut.height<=0?1:Math.min((ut.width-40)/v.frame.width,(ut.height-40)/v.frame.height,1),[v?.frame,ut]),Q=et==="fit"?$o:et;useEffect(()=>{let n=O.current,i=v?.frame;if(!n||!i)return;let u=n.getContext("2d");if(!u)return;let c=window.devicePixelRatio||1;sizeCanvasForSlide(n,i,c,Q);let p=false;return paintSlide(u,i,c,Q,{resolveImage:P=>st(P,b,Be,y)}).catch(P=>{p||U(P);}),()=>{p=true;}},[y,v?.frame,U,Q]);let me=useMemo(()=>{if(!v?.frame||!q)return null;let n=v.snapshot.slides[v.slideIndex];return !n||n.id!==q.slideId?null:Ee(n.shapes,q.shapeId)},[v,q]),Fe=me?.textStories[0]?.id??null,Yo=useMemo(()=>Ro(me),[me]),Ge=useMemo(()=>v?.frame&&me?Ve(v.snapshot,v.frame,me):null,[v,me]),ft=useMemo(()=>{if(!v?.frame||!x||Ge)return null;let n=v.snapshot.slides[v.slideIndex],i=n?Ee(n.shapes,x.shapeId):null;return i?Ve(v.snapshot,v.frame,i):null},[v,Ge,x]),xe=v?.snapshot.slides[v.slideIndex],ht=xe?.id,$t=useMemo(()=>{if(xe){if(q?.slideId===xe.id)return q.shapeId;if(x)return tn(xe,x.shapeId)?.id}},[xe,x,q]);useEffect(()=>{j&&j.setCursor(ht?{slideId:ht,...$t?{shapeId:$t}:{}}:null);},[j,ht,$t]),useEffect(()=>()=>{j?.setCursor(null);},[j]);let mt=useMemo(()=>wo(Xe),[Xe]),Yt=useMemo(()=>{if(!v?.frame||!xe)return {visible:[],overflow:0};let n=Zn(xe.shapes),i=Co(Xe,xe.id,n),u=[],c=i.overflow;for(let p of i.visible){let P=n.get(p.shapeId);if(!P)continue;let E=Ve(v.snapshot,v.frame,P);E?u.push({peer:p.peer,peerCount:p.count,shapeId:p.shapeId,bounds:E}):c+=p.count;}return {visible:u,overflow:c}},[xe,v,Xe]),Vo=useMemo(()=>{let n=new Set(v?.snapshot.slides.map(i=>i.id));return To(Xe,n)},[v,Xe]);useEffect(()=>{let n=b.current;if(!(!n||!x))try{let i=n.story(x.storyId);ct(Mo(i,x.anchor,x.focus,Nt));}catch(i){U(i);}},[v,U,x]);let Ze=useMemo(()=>{if(x&&x.anchor===x.focus)return Ot(Ce);let n=b.current;if(!n)return Ot(Ce);try{return x?zt(n.story(x.storyId),x.anchor,x.focus,Nt):Fe?Eo(n.story(Fe),Nt):Ot(Ce)}catch{return Ot(Ce)}},[v,Fe,x,Ce]),qo=useMemo(()=>{let n=b.current,i=x?.storyId??Fe;if(!(!n||!i))try{let u=n.story(i),c=v?.frame?.primitives.find(p=>p.kind==="textBox"&&p.storyId===i);return x?pn(u,c,x.anchor,x.focus):pn(u,c,0,u.length)}catch{return}},[v,Fe,x]),Jo=useMemo(()=>{let n=new Set;for(let i of v?.snapshot.slides??[])n.add(i.layoutPartPath);return [...n].map(i=>({partPath:i}))},[v?.snapshot]),Qo=n=>{se.current=null,ne.current=null,we(null),V(null),ce(null),$(null),ae(null),L.current=null,oe.current=null,le(n),h.current?.focus();},er=(n,i)=>{let u=b.current,c=w.current;if(!u||!c?.frame)return;let p=c.snapshot.slides[c.slideIndex];if(!p)return;let P=Math.abs(i.x-n.x)>=6||Math.abs(i.y-n.y)>=6,E=P?Math.abs(i.x-n.x):c.frame.width*.36,M=P?Math.abs(i.y-n.y):c.frame.height*.12,de=Math.max(0,Math.min(P?Math.min(n.x,i.x):n.x,c.frame.width-E)),Y=Math.max(0,Math.min(P?Math.min(n.y,i.y):n.y,c.frame.height-M));try{let G=u.addTextBox(p.id,{name:l("objects.defaultTextBoxName"),rect:{x:Math.round(de*c.snapshot.widthEmu/c.frame.width),y:Math.round(Y*c.snapshot.heightEmu/c.frame.height),width:Math.round(Math.max(12,E)*c.snapshot.widthEmu/c.frame.width),height:Math.round(Math.max(12,M)*c.snapshot.heightEmu/c.frame.height)},text:"",style:Ce}),ue=le(void 0,!0);ve("select"),ce(null),$(null),ae(null),L.current=null,oe.current=null;let z=ue?.snapshot.slides[ue.slideIndex]?.shapes.find(Le=>Le.id===G.shapeId),ye=z?.textStories[0];ye&&(V({shapeId:z.id,storyId:ye.id,anchor:0,focus:0,focusLine:0}),h.current?.focus());}catch(G){U(G);}},tr=(n,i,u)=>{let c=b.current,p=w.current;if(!c||!p?.frame)return;let P=p.snapshot.slides[p.slideIndex],E=St.find(z=>z.geometry===n);if(!P||!E)return;let M=Math.abs(u.x-i.x)>=6||Math.abs(u.y-i.y)>=6,de=M?Math.abs(u.x-i.x):p.frame.width*.22,Y=M?Math.abs(u.y-i.y):p.frame.height*.18,G=Math.max(0,Math.min(M?Math.min(i.x,u.x):i.x-de/2,p.frame.width-de)),ue=Math.max(0,Math.min(M?Math.min(i.y,u.y):i.y-Y/2,p.frame.height-Y));try{let z=c.addShape(P.id,{name:l(E.labelKey),geometry:n,rect:{x:Math.round(G*p.snapshot.widthEmu/p.frame.width),y:Math.round(ue*p.snapshot.heightEmu/p.frame.height),width:Math.round(Math.max(12,de)*p.snapshot.widthEmu/p.frame.width),height:Math.round(Math.max(12,Y)*p.snapshot.heightEmu/p.frame.height)},fill:"#d9eaf7"}),ye=le(void 0,!0);ve("select"),V(null),ce({slideId:P.id,shapeId:z.shapeId}),$(null),ae(null),L.current=null,oe.current=null,ye&&h.current?.focus();}catch(z){U(z);}},nr=n=>{if(!n.isPrimary||n.button!==0)return;let i=b.current,u=w.current;if(!i||!u?.frame)return;let c=gt(n.currentTarget.getBoundingClientRect(),u.frame,n.clientX,n.clientY);if(!c)return;se.current=null,ne.current=null,we(null);let p=u.snapshot.slides[u.slideIndex],P=Ti(R);if((R==="textBox"||P)&&p){V(null),ce(null),$(null),ae({start:c,end:c}),oe.current=null,L.current=P?{kind:"shapeInsert",pointerId:n.pointerId,slideId:p.id,geometry:P,start:c,last:c}:{kind:"textBox",pointerId:n.pointerId,slideId:p.id,start:c,last:c},n.currentTarget.setPointerCapture(n.pointerId),h.current?.focus(),n.preventDefault();return}try{i.layoutSlide(u.slideIndex);let E=i.hitTest(c.x,c.y),M=E?.kind==="text"&&sn(u.frame,c,Q)==="shape"?{kind:"shape",shapeId:E.shapeId}:E,de=p&&M?tn(p,M.shapeId):null,Y=oe.current,G=!!(p&&de&&Y?.slideId===p.id&&Y.shapeId===de.id&&n.timeStamp-Y.timeStamp<=600&&Math.hypot(n.clientX-Y.clientX,n.clientY-Y.clientY)<=6),ue=G&&Y?Math.min(Y.count+1,3):1,z=M?.kind==="text"?on(u.frame,M.shapeId,M.storyId,c):null;if(oe.current=null,p&&M?.kind==="text"&&de&&ue>=2){let ye=i.story(M.storyId),Le=ue>=3?"paragraph":"word",Tt=fn(lt(ye),M.position,Le);V({shapeId:M.shapeId,storyId:M.storyId,anchor:Tt.start,focus:Tt.end,focusLine:z?.lineIndex}),ce(null),$(null),L.current={kind:"text",pointerId:n.pointerId,slideId:p.id,shapeId:M.shapeId,storyId:M.storyId,anchor:Tt.start,focus:Tt.end,focusLine:z?.lineIndex,granularity:Le,clickCount:ue,clickShapeId:de.id,startClientX:n.clientX,startClientY:n.clientY,dragging:!1},n.currentTarget.setPointerCapture(n.pointerId);}else if(p&&x&&M?.kind==="text"&&M.shapeId===x.shapeId&&M.storyId===x.storyId){i.story(M.storyId);let ye=n.shiftKey?x.anchor:M.position;V({shapeId:M.shapeId,storyId:M.storyId,anchor:ye,focus:M.position,focusLine:z?.lineIndex}),ce(null),$(null),L.current={kind:"text",pointerId:n.pointerId,slideId:p.id,shapeId:M.shapeId,storyId:M.storyId,anchor:ye,focus:M.position,focusLine:z?.lineIndex,granularity:"character",clickCount:ue,clickShapeId:de?.id??M.shapeId,startClientX:n.clientX,startClientY:n.clientY,dragging:!1},n.currentTarget.setPointerCapture(n.pointerId);}else p&&M?de?(V(null),ce({slideId:p.id,shapeId:de.id}),$(null),nn(de)?(L.current={kind:"shape",pointerId:n.pointerId,slideId:p.id,shapeId:de.id,startClientX:n.clientX,startClientY:n.clientY,start:c,last:c,dragThreshold:G?8:4,clickCount:ue,dragging:!1},n.currentTarget.setPointerCapture(n.pointerId)):L.current=null):(V(null),ce(null),oe.current=null,L.current=null):(V(null),ce(null),$(null),oe.current=null,L.current=null);h.current?.focus(),n.preventDefault();}catch(E){U(E);}},En=n=>{let i=L.current,u=b.current,c=w.current;if(!i||i.pointerId!==n.pointerId||!u||!c?.frame)return false;let p=gt(n.currentTarget.getBoundingClientRect(),c.frame,n.clientX,n.clientY);if(!p||c.snapshot.slides[c.slideIndex]?.id!==i.slideId)return false;if(i.kind==="text"){!i.dragging&&rn(i.startClientX,i.startClientY,n.clientX,n.clientY)&&(i.dragging=true);let P=on(c.frame,i.shapeId,i.storyId,p);if(P){let E=i.granularity==="character"?{anchor:i.anchor,focus:P.position}:Do({start:i.anchor,end:i.focus},fn(lt(u.story(i.storyId)),P.position,i.granularity));V({shapeId:i.shapeId,storyId:i.storyId,...E,focusLine:P.lineIndex});}}else i.kind==="shape"?(i.last=p,!i.dragging&&rn(i.startClientX,i.startClientY,n.clientX,n.clientY,i.dragThreshold)&&(i.dragging=true),i.dragging&&$({shapeId:i.shapeId,delta:{x:p.x-i.start.x,y:p.y-i.start.y}})):(i.last=p,ae({start:i.start,end:p}));return true},or=n=>{if(En(n)){n.preventDefault();return}if(L.current||R!=="select")return;let i=w.current;if(!i?.frame)return;let u=gt(n.currentTarget.getBoundingClientRect(),i.frame,n.clientX,n.clientY);Kt(u?sn(i.frame,u,Q):null);},rr=()=>{L.current||Kt(null);},ir=n=>{En(n);let i=L.current;if(!i||i.pointerId!==n.pointerId)return;if(L.current=null,$(null),n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),i.kind==="textBox"){ae(null),er(i.start,i.last),n.preventDefault();return}if(i.kind==="shapeInsert"){ae(null),tr(i.geometry,i.start,i.last),n.preventDefault();return}if(i.kind==="text"){oe.current=i.dragging?null:{slideId:i.slideId,shapeId:i.clickShapeId,clientX:n.clientX,clientY:n.clientY,timeStamp:n.timeStamp,count:i.clickCount};return}if(i.kind!=="shape")return;if(!i.dragging){oe.current={slideId:i.slideId,shapeId:i.shapeId,clientX:n.clientX,clientY:n.clientY,timeStamp:n.timeStamp,count:i.clickCount};return}oe.current=null;let u=b.current,c=w.current,p=c?.snapshot.slides[c.slideIndex];if(!u||!c?.frame||p?.id!==i.slideId)return;let P=Ee(p.shapes,i.shapeId);if(P)try{let E=qn(c.snapshot,c.frame,P,{x:i.last.x-i.start.x,y:i.last.y-i.start.y});(E.x!==P.x||E.y!==P.y)&&(u.moveShape(p.id,P.id,E.x,E.y),le(void 0,!0)),ce({slideId:p.id,shapeId:P.id}),n.preventDefault();}catch(E){U(E);}},Mn=n=>{L.current?.pointerId===n.pointerId&&(L.current=null,$(null),ae(null),oe.current=null);},nt=n=>{V(n?{...n,focusLine:void 0}:null),ce(null),oe.current=null,le(void 0,true);},ar=n=>{let i=b.current;if(!i)return;let u=n.metaKey||n.ctrlKey;if(n.key==="Escape"){re.setEnabled(false),ve("select"),ae(null),L.current=null,ne.current=null,we(null),n.preventDefault();return}if(u&&(n.key==="z"||n.key==="Z")){n.preventDefault(),Vt(n.shiftKey?"redo":"undo");return}if(u&&(n.key==="s"||n.key==="S")){n.preventDefault(),kn();return}if(re.reviewing||!x&&!Fe)return;if(u&&(n.key==="b"||n.key==="B")){n.preventDefault(),ze({bold:x?!Ce.bold:!Ze.bold});return}if(u&&(n.key==="i"||n.key==="I")){n.preventDefault(),ze({italic:x?!Ce.italic:!Ze.italic});return}if(u&&(n.key==="u"||n.key==="U")){n.preventDefault(),ze({underline:x?Ce.underline==="none"?"sng":"none":Ze.underline?"none":"sng"});return}if(!x)return;let c=Math.min(x.anchor,x.focus),p=Math.max(x.anchor,x.focus);try{let P=sr(n,x);if(P!==null){n.preventDefault(),V({...x,anchor:n.shiftKey?x.anchor:P.position,focus:P.position,focusLine:P.lineIndex});return}if(n.key==="Backspace"){if(n.preventDefault(),c!==p){i.deleteText(x.storyId,c,p),nt({...x,anchor:c,focus:c});return}let E=Li(i.story(x.storyId),c);E<c&&(i.deleteText(x.storyId,E,c),nt({...x,anchor:E,focus:E}));return}if(n.key==="Delete"){if(n.preventDefault(),c!==p){i.deleteText(x.storyId,c,p),nt({...x,anchor:c,focus:c});return}let E=Di(i.story(x.storyId),p);E>p&&(i.deleteText(x.storyId,p,E),nt({...x,anchor:p,focus:p}));return}if(n.key==="Enter"){n.preventDefault(),c!==p&&i.deleteText(x.storyId,c,p),i.insertParagraphBreak(x.storyId,c),nt({...x,anchor:c+1,focus:c+1});return}if(n.key.length>0&&!n.metaKey&&!n.ctrlKey&&!n.altKey&&Array.from(n.key).length===1){n.preventDefault(),c!==p&&i.deleteText(x.storyId,c,p),i.insertText(x.storyId,c,n.key,Ce);let E=c+n.key.length;nt({...x,anchor:E,focus:E});}}catch(P){U(P);}},ze=n=>{ct(u=>({...u,...n}));let i=b.current;if(i)try{if(x){if(x.anchor===x.focus)return;i.formatText(x.storyId,Math.min(x.anchor,x.focus),Math.max(x.anchor,x.focus),n);}else if(Fe){let u=i.story(Fe);Ri(i,u,n);}else return;le(void 0,!0);}catch(u){U(u);}},sr=(n,i)=>{let u=b.current;if(!u)return null;let c=u.story(i.storyId),p=Math.max(0,c.length-1),P=G=>Math.max(0,Math.min(p,G)),E=Bi(v?.frame,i),M={position:i.focus,lineIndex:i.focusLine},de=n.altKey||n.ctrlKey&&!n.metaKey,Y=n.metaKey;if(n.key==="ArrowUp"||n.key==="ArrowDown"){let G={shapeId:i.shapeId,...M},ue=se.current&&Fo(se.current,G)?se.current.goalX:mn(E,M),z=n.key==="ArrowUp"?"up":"down",ye=Ao(E,M,z,ue),Le={...ye,position:P(ye.position)};return se.current=ue===void 0?null:{shapeId:i.shapeId,goalX:ue,position:Le.position,lineIndex:Le.lineIndex},Le}if(se.current=null,n.key==="ArrowLeft"||n.key==="ArrowRight"){let G=n.key==="ArrowLeft"?-1:1;if(Y){let z=Ht(E,M,G<0?"start":"end");return {...z,position:P(z.position)}}let ue=de?Bo(lt(c),i.focus,G):i.focus+G;return {position:P(ue),lineIndex:i.focusLine}}if(n.key==="Home"){if(Y||n.ctrlKey)return {position:0,lineIndex:0};let G=Ht(E,M,"start");return {...G,position:P(G.position)}}if(n.key==="End"){if(Y||n.ctrlKey)return {position:p,lineIndex:Math.max(0,E.length-1)};let G=Ht(E,M,"end");return {...G,position:P(G.position)}}return null},lr=n=>{let i=b.current,u=x?.storyId??Fe;if(!(!i||!u))try{x?i.setParagraphAlignment(u,Math.min(x.anchor,x.focus),Math.max(x.anchor,x.focus),n):i.setParagraphAlignment(u,0,i.story(u).length,n),le(void 0,!0);}catch(c){U(c);}},dr=n=>{n==="bold"?ze({bold:!Ze.bold}):n==="italic"?ze({italic:!Ze.italic}):n==="underline"?ze({underline:Ze.underline?"none":"sng"}):n.type==="fontFamily"?ze({fontFamily:n.value}):n.type==="fontSize"?ze({fontSizePt:n.value}):n.type==="textColor"?ze({color:n.value}):n.type==="align"&&lr(n.value);},cr=n=>{let i=b.current;if(!(!i||!q||!me))try{n.type==="fillColor"?i.setShapeFill(q.slideId,q.shapeId,n.value):n.type==="strokeColor"?i.setShapeStroke(q.slideId,q.shapeId,n.value?{color:n.value}:{}):n.type==="strokeWidth"?i.setShapeStroke(q.slideId,q.shapeId,n.value===null?{}:{widthPt:n.value}):i.setShapeAdjust(q.slideId,q.shapeId,{...me.adjustValues,[n.name]:n.value}),le(void 0,!0);}catch(u){U(u);}},ur=n=>{let i=b.current,u=w.current;if(!(!i||!u))try{let c=u.slideIndex+1,p=n===void 0?u.snapshot.slides[u.slideIndex]?.layoutPartPath??void 0:n??void 0;i.insertSlide(c,p),V(null),ce(null),$(null),ae(null),ve("select"),L.current=null,oe.current=null,ne.current=null,we(null),le(c,!0,!0);}catch(c){U(c);}},Vt=n=>{let i=b.current;if(i)try{n==="undo"?i.undo():i.redo(),V(null),$(null),ae(null),ve("select"),L.current=null,oe.current=null,ne.current=null,we(null),le(void 0,!0);}catch(u){U(u);}},kn=()=>{let n=b.current;if(n)try{let i=n.save();g?g(i):Ho(i,s??"presentation.pptx",mi);}catch(i){U(i);}},Rn=(n,i)=>{let u=O.current,c=v?.frame;return !u||!c?null:gt(u.getBoundingClientRect(),c,n,i)},pr=n=>i=>{if(!q||!me||!Rt(me))return;let u=Rn(i.clientX,i.clientY);u&&(i.preventDefault(),i.stopPropagation(),ne.current={pointerId:i.pointerId,handle:n,start:u,slideId:q.slideId,shapeId:q.shapeId,delta:{x:0,y:0}},we({x:0,y:0}),i.currentTarget.setPointerCapture(i.pointerId));},Ln=n=>{let i=ne.current;return kt(i,n.pointerId)?to(i.start,i.delta,Rn(n.clientX,n.clientY)):null},fr=n=>{let i=ne.current,u=Ln(n);!kt(i,n.pointerId)||!u||(i.delta=u,we(u));},Dn=n=>{let i=ne.current;return kt(i,n.pointerId)?(ne.current=null,we(null),n.currentTarget.hasPointerCapture(n.pointerId)&&n.currentTarget.releasePointerCapture(n.pointerId),i):null},Fn=n=>{Dn(n);},hr=n=>{let i=Ln(n),u=Dn(n),c=b.current,p=w.current,P=p?.snapshot.slides[p.slideIndex],E=P&&u?Ee(P.shapes,u.shapeId):null;if(!(!u||!i||!c||!p?.frame||P?.id!==u.slideId||!E)&&!(i.x===0&&i.y===0))try{let M=an(p.snapshot,p.frame,E,u.handle,i);M&&(M.x!==E.x||M.y!==E.y||M.width!==E.width||M.height!==E.height)&&(c.setShapeRect(u.slideId,u.shapeId,M),le(void 0,!0));}catch(M){U(M);}},$e=v?.snapshot.slides.length??0,Ye=v?.slideIndex??0,mr=()=>{$e!==0&&Xt(true);},gr=()=>{let n=v?.frame,i=b.current;if(!n||!i)return;let u={current:i},c={current:new Map};slideToPng(n,{scale:window.devicePixelRatio||1,resolveImage:p=>st(p,u,c,y)}).then(async p=>{let P=new Uint8Array(await p.arrayBuffer());b.current===i&&Ho(P,gi(s,Ye),"image/png");}).catch(p=>{b.current===i&&U(p);});},An=dt&&dt.shapeId===q?.shapeId?dt.delta:null,qt=ne.current?.handle,br=v?.frame&&me&&Ae&&qt?no(v.snapshot,v.frame,me,qt,Ae):null,ot=Ge?Ae&&qt?br??Ge:{...Ge,x:Ge.x+(An?.x??0),y:Ge.y+(An?.y??0)}:null;return jsxs("div",{className:a,style:W.root,children:[jsxs("div",{style:W.toolbarShell,children:[jsx(vt,{currentFormatting:{...Ze,align:qo},textSelectionActive:!re.reviewing&&(x!==null||Fe!==null),onFormat:dr,currentShapeFormatting:Yo,shapeSelectionActive:!re.reviewing&&me?.kind==="shape",onShapeFormat:cr,onInsertSlide:ur,slideLayouts:Jo,currentLayoutPartPath:v?.snapshot.slides[Ye]?.layoutPartPath,onSave:kn,onExportPng:gr,onUndo:()=>Vt("undo"),onRedo:()=>Vt("redo"),canUndo:Qe.canUndo,canRedo:Qe.canRedo,zoom:et,onZoomChange:C,activeTool:R,onToolChange:n=>{re.setEnabled(false),ve(n),n!=="select"&&(V(null),ce(null)),ae(null),L.current=null,ne.current=null,we(null),h.current?.focus();},disabled:!v||$e===0,style:W.toolbar,children:jsx(vt.Toolbar,{})}),b.current?.isProposalsAvailable()&&jsxs("button",{ref:Pn,type:"button","data-testid":"pptx-proposals-button","aria-expanded":vn,style:W.presentButton,onClick:()=>{tt(),pt(n=>!n);},children:[l("proposals.title")," ",jsx("span",{"data-testid":"pptx-proposals-count",children:Gt.length})]}),Xe.length>0?jsxs("div",{style:W.presenceStrip,role:"list","aria-label":"Collaborators",children:[mt.visible.map(n=>{let i=n.state.cursor?.slideId===ht;return jsx("span",{role:"listitem",style:Oo(n.state.user.color,i),title:n.state.user.name,"aria-label":n.state.user.name,children:Ni(n.state.user.name)},n.state.clientId)}),mt.overflow>0?jsxs("span",{role:"listitem",style:Oo("#64748b",true),title:`${mt.overflow} more collaborators`,"aria-label":`${mt.overflow} more collaborators`,children:["+",mt.overflow]}):null]}):null,jsxs("button",{type:"button",onClick:mr,disabled:$e===0,"data-testid":"pptx-present",style:W.presentButton,children:[jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"M6 4.5v15l13-7.5Z"})}),l("toolbar.present")]})]}),jsxs("div",{style:W.workspace,children:[jsx("aside",{style:W.slideStrip,"aria-label":l("slides.panelLabel"),children:v?.snapshot.slides.map((n,i)=>{let u=Vo.get(n.id);return jsxs("button",{type:"button","aria-current":i===Ye?"page":void 0,style:Oi(i===Ye),onClick:()=>Qo(i),children:[jsx("span",{style:W.slideNumber,children:i+1}),jsxs("span",{style:W.slidePreview,children:[v.thumbnails.get(n.id)?jsx(Pi,{frame:v.thumbnails.get(n.id),resolveImage:c=>st(c,b,Be,y)}):jsx("span",{style:W.slideTitle,children:Hi(n.shapes)||l("slides.fallbackTitle",{number:i+1})}),n.id!==ht&&u&&(u.visible.length>0||u.overflow>0)?jsxs("span",{style:W.thumbnailPresence,"aria-hidden":"true",children:[u.visible.map(c=>jsx("span",{style:{...W.thumbnailPresenceDot,backgroundColor:c.state.user.color}},c.state.clientId)),u.overflow>0?jsxs("span",{style:W.thumbnailPresenceOverflow,children:["+",u.overflow]}):null]}):null]})]},n.id)})}),jsxs("div",{ref:h,style:W.stage,tabIndex:0,role:"application","aria-label":l("editor.appLabel"),onKeyDown:ar,onFocus:()=>Se(true),onBlur:()=>Se(false),children:[jsx(so,{review:re,ready:Xo===re.diff,onAccept:Tn,onReject:Cn,onDetails:()=>pt(true)}),jsx("div",{ref:T,style:W.canvasHost,children:v?.frame?jsxs("div",{style:{...W.canvasFrame,width:v.frame.width*Q,height:v.frame.height*Q},children:[jsx("canvas",{ref:O,"data-testid":"pptx-slide-canvas","aria-hidden":re.reviewing,style:{...W.canvas,cursor:R!=="select"?"crosshair":xn==="text"?"text":xn==="shape"?"move":"default"},onPointerDown:re.reviewing?void 0:nr,onPointerMove:or,onPointerUp:ir,onPointerLeave:rr,onPointerCancel:Mn,onLostPointerCapture:Mn,"aria-label":me?l("slides.canvasLabelWithSelection",{current:Ye+1,total:$e,name:me.name}):l("slides.canvasLabel",{current:Ye+1,total:$e})}),!re.reviewing&&jsxs(Fragment,{children:[jsx(Ii,{frame:v.frame,selection:x,scale:Q,focused:Z}),Yt.visible.map(({peer:n,peerCount:i,shapeId:u,bounds:c},p)=>jsx(Si,{peer:n,peerCount:i,bounds:c,scale:Q,labelOffset:p},u)),Yt.overflow>0?jsxs("span",{style:W.remoteShapeOverflow,"aria-hidden":"true",children:["+",Yt.overflow," selections"]}):null,ot?jsxs(Fragment,{children:[jsx("span",{style:{...W.shapeSelection,left:ot.x*Q,top:ot.y*Q,width:Math.max(1,ot.width*Q),height:Math.max(1,ot.height*Q)},"aria-hidden":"true"}),me&&Rt(me)?Gn.map(n=>{let i=Qn(ot,n);return jsx("span",{"data-testid":`pptx-resize-${n}`,onPointerDown:pr(n),onPointerMove:fr,onPointerUp:hr,onPointerCancel:Fn,onLostPointerCapture:Fn,style:{...W.resizeHandle,left:i.x*Q-Wt/2,top:i.y*Q-Wt/2,cursor:eo(n)}},n)}):null]}):null,ft?jsx("span",{style:{...W.textEditOutline,left:ft.x*Q,top:ft.y*Q,width:Math.max(1,ft.width*Q),height:Math.max(1,ft.height*Q)},"aria-hidden":"true"}):null,he?jsx("span",{style:{...W.textBoxPreview,left:Math.min(he.start.x,he.end.x)*Q,top:Math.min(he.start.y,he.end.y)*Q,width:Math.max(1,Math.abs(he.end.x-he.start.x))*Q,height:Math.max(1,Math.abs(he.end.y-he.start.y))*Q},"aria-hidden":"true"}):null]}),re.diff&&jsx(lo,{diff:re.diff,current:v.snapshot,frame:v.frame,slideIndex:v.slideIndex,scale:Q,resolveImage:Zo,onPainted:Go,onTarget:(n,i)=>{wn(n,i,re.selected?.id),pt(true);}},`${re.diff.proposal.id}:${v.slideIndex}`)]}):jsx("div",{style:W.empty,children:l(Uo?"editor.opening":e?"editor.noSlides":"editor.openPrompt")})}),yn?jsx("div",{style:W.error,children:yn}):null]}),vn&&v&&b.current&&jsx(jn,{handle:b.current,proposals:Gt,snapshot:v.snapshot,resolveImage:n=>st(n,b,Be,y),onAccept:Tn,onReject:Cn,onNavigate:wn,onClose:()=>{pt(false),Pn.current?.focus();}})]}),xe&&re.diff?.proposal.changes.some(n=>n.slideId===xe.id&&!n.shapeId&&n.oldText!==n.newText)?jsx(co,{diff:re.diff,slideId:xe.id}):xe?jsx(vi,{value:xe.notes??"",disabled:!v||re.reviewing,label:l("notes.panelLabel"),placeholder:l("notes.placeholder"),onCommit:n=>{let i=b.current;if(i)try{i.setSlideNotes(xe.id,n),le(void 0,!0);}catch(u){U(u);}}},xe.id):null,jo&&$e>0&&b.current?jsx(Io,{handle:b.current,slideCount:$e,startIndex:Ye,resolveImage:n=>st(n,b,Be,y),counterLabel:(n,i)=>l("presentation.slideCounter",{current:n,total:i}),label:l("presentation.label"),exitLabel:l("presentation.exit"),previousLabel:l("presentation.previousSlide"),nextLabel:l("presentation.nextSlide"),onExit:()=>Xt(false),onError:U}):null]})}function Si({peer:e,peerCount:t,bounds:o,scale:r,labelOffset:a}){let[s,d]=useState(()=>Date.now()-e.cursorMovedAt<PRESENCE_LABEL_DURATION_MS);return useEffect(()=>{let m=PRESENCE_LABEL_DURATION_MS-(Date.now()-e.cursorMovedAt);if(m<=0){d(false);return}d(true);let f=setTimeout(()=>d(false),m);return ()=>clearTimeout(f)},[e.cursorMovedAt]),jsxs("span",{style:{...W.remoteShapeSelection,left:o.x*r,top:o.y*r,width:Math.max(1,o.width*r),height:Math.max(1,o.height*r),borderColor:e.state.user.color},"aria-hidden":"true",children:[jsx("span",{style:{...W.remoteShapeWash,backgroundColor:e.state.user.color}}),s?jsxs("span",{style:{...W.remoteShapeLabel,top:-4-a%3*20,backgroundColor:e.state.user.color},children:[e.state.user.name,t>1?` +${t-1}`:""]}):null]})}function vi({value:e,disabled:t,label:o,placeholder:r,onCommit:a}){return jsxs("div",{style:W.notesPanel,children:[jsx("span",{style:W.notesLabel,children:o}),jsx("textarea",{"aria-label":o,style:W.notesTextarea,value:e,disabled:t,placeholder:r,"data-testid":"pptx-notes-textarea",onChange:s=>a(s.target.value)})]})}function Pi({frame:e,resolveImage:t}){let o=useRef(null);return useEffect(()=>{let r=o.current;if(!r)return;let a=r.getContext("2d");if(!a)return;let s=128/e.width,d=window.devicePixelRatio||1;sizeCanvasForSlide(r,e,d,s),paintSlide(a,e,d,s,{resolveImage:t}).catch(()=>{});},[e,t]),jsx("canvas",{ref:o,style:W.thumbnailCanvas,"aria-hidden":"true"})}function Ii({frame:e,selection:t,scale:o,focused:r}){let a=useRef(null),[s,d]=useState(()=>typeof document>"u"||document.visibilityState==="visible"),[m,f]=useState(false);return useEffect(()=>{if(typeof document>"u")return;let g=()=>d(document.visibilityState==="visible");return document.addEventListener("visibilitychange",g),()=>document.removeEventListener("visibilitychange",g)},[]),useEffect(()=>{let g=r&&s&&t!==null&&t.anchor===t.focus;if(f(g),!g)return;let l=window.setInterval(()=>f(y=>!y),bi);return ()=>window.clearInterval(l)},[r,s,t]),useEffect(()=>{let g=a.current;if(!g)return;let l=g.getContext("2d");if(!l)return;let y=window.devicePixelRatio||1;sizeCanvasForSlide(g,e,y,o),zi(l,e,t,y,o,m);},[m,e,o,t]),jsx("canvas",{ref:a,style:W.canvasOverlay,"aria-hidden":"true"})}function wi(e,t){return t===0?0:Math.max(0,Math.min(t-1,e))}function Ti(e){if(!e.startsWith("shape:"))return null;let t=e.slice(6);return St.some(o=>o.geometry===t)?t:null}function Ci(e){let t=useRef(e);return Ei(t.current,e)||(t.current=e),t.current}function Ei(e,t){return e===t?true:e.length!==t.length?false:e.every((o,r)=>Mi(o,t[r]))}function Mi(e,t){return e.family===t.family&&(e.bold??false)===(t.bold??false)&&(e.italic??false)===(t.italic??false)&&ki(e.bytes,t.bytes)}function ki(e,t){return e===t?true:e.byteLength!==t.byteLength?false:e.every((o,r)=>o===t[r])}function lt(e){return e.paragraphs.map(t=>t.runs.map(o=>o.text).join("")).join(`
|
|
4
|
-
`)}function Ri(e,t,o){e.formatText(t.id,0,t.length,o);}function Li(e,t){let o=lt(e).slice(0,t),r=Array.from(o),a=r[r.length-1];return a?t-a.length:t}function Di(e,t){let o=Array.from(lt(e).slice(t))[0];return o?t+o.length:t}function Ot(e){return {bold:e.bold,italic:e.italic,underline:e.underline!=="none",fontSize:e.fontSizePt,textColor:e.color,fontFamily:e.fontFamily}}async function Fi(e){return typeof FontFace>"u"||typeof document>"u"?[]:await Promise.all(e.map(async o=>{let r=o.bytes.slice().buffer,s=await new FontFace(o.family,r,{style:o.italic?"italic":"normal",weight:o.bold?"700":"400"}).load();return document.fonts.add(s),s}))}function No(e){if(!(typeof document>"u"))for(let t of e)document.fonts.delete(t);}function st(e,t,o,r){let a=o.current.get(e);if(a)return a;let s=Ai(t.current?.mediaBytes(e),r);return o.current.set(e,s),s}async function Ai(e,t){if(!e)return null;let o=presentationImageBlob(e);if(typeof createImageBitmap=="function")return createImageBitmap(o);let r=URL.createObjectURL(o);try{return await new Promise((a,s)=>{let d=new Image;d.onload=()=>a(d),d.onerror=()=>s(new Error(t)),d.src=r;})}finally{URL.revokeObjectURL(r);}}function Bi(e,t){return e?.primitives.find(r=>r.kind==="textBox"&&r.storyId===t.storyId&&r.shapeId===t.shapeId)?.lines??[]}function zi(e,t,o,r,a,s=true){if(!o)return;let d=t.primitives.find(g=>g.kind==="textBox"&&g.storyId===o.storyId&&g.shapeId===o.shapeId);if(!d)return;let m=Math.min(o.anchor,o.focus),f=Math.max(o.anchor,o.focus);if(e.save(),e.setTransform(r*a,0,0,r*a,0,0),m!==f){e.fillStyle="rgba(59, 130, 246, 0.26)";for(let g of d.lines){let l=Math.max(m,g.start),y=Math.min(f,g.end);if(l>=y)continue;let I=gn(g,l),K=gn(g,y);e.fillRect(Math.min(I,K),g.y,Math.max(1,Math.abs(K-I)),g.height);}}else if(s){let g=d.lines[Pt(d.lines,{position:m,lineIndex:o.focusLine})];if(g){let l=gn(g,m);e.fillStyle="#1d4ed8",e.fillRect(l,g.y,1.5,g.height);}}e.restore();}function gn(e,t){let o=e.caretStops[0];return o?e.caretStops.reduce((r,a)=>Math.abs(a.position-t)<Math.abs(r.position-t)?a:r,o).x:e.x}function Hi(e){for(let t of e)for(let o of t.textStories){let r=lt(o).trim();if(r)return r.slice(0,40)}return ""}var W={root:{display:"flex",flexDirection:"column",width:"100%",height:"100%",minHeight:480,overflow:"hidden",color:"#172033",background:"#f3f5f8",fontFamily:"ui-sans-serif, system-ui, sans-serif"},toolbarShell:{display:"flex",alignItems:"center",flex:"0 0 auto",padding:"4px 0 5px",background:"#ffffff",borderBottom:"1px solid #e2e8f0"},toolbar:{flex:"1 1 auto",minWidth:0},presenceStrip:{display:"flex",alignItems:"center",gap:4,flex:"0 0 auto",maxWidth:"35%",padding:"0 10px 0 2px",overflowX:"auto"},workspace:{display:"flex",flex:1,minHeight:0},slideStrip:{width:184,padding:"14px 10px",overflowY:"auto",background:"#eef1f5",borderRight:"1px solid #d8dee9",boxSizing:"border-box"},slideNumber:{width:18,flex:"0 0 auto",paddingTop:3,fontSize:11,color:"#647087",textAlign:"right"},slidePreview:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:132,aspectRatio:"16 / 9",padding:8,overflow:"hidden",background:"#ffffff",boxSizing:"border-box",boxShadow:"0 1px 4px rgba(20, 31, 50, 0.16)"},slideTitle:{fontSize:9,lineHeight:1.25,color:"#39445a",textAlign:"center"},thumbnailCanvas:{display:"block",maxWidth:"100%",height:"auto"},thumbnailPresence:{position:"absolute",top:4,right:4,display:"flex",gap:3,padding:2,borderRadius:999,background:"rgba(255, 255, 255, 0.88)",boxShadow:"0 1px 3px rgba(15, 23, 42, 0.2)"},thumbnailPresenceDot:{width:7,height:7,borderRadius:999,boxShadow:"0 0 0 1px rgba(255, 255, 255, 0.9)"},thumbnailPresenceOverflow:{color:"#475569",fontSize:8,fontWeight:700,lineHeight:"8px"},stage:{position:"relative",display:"flex",flexDirection:"column",flex:1,minWidth:0,outline:"none",overflow:"hidden"},canvasHost:{display:"flex",flex:1,minHeight:0,alignItems:"center",justifyContent:"center",width:"100%",overflow:"auto"},canvasFrame:{position:"relative",flex:"0 0 auto"},canvas:{display:"block",flex:"0 0 auto",background:"#fff",boxShadow:"0 8px 32px rgba(27, 39, 61, 0.2)",touchAction:"none"},canvasOverlay:{position:"absolute",inset:0,display:"block",pointerEvents:"none"},textEditOutline:{position:"absolute",zIndex:3,border:"2px dashed #6b7280",boxSizing:"border-box",boxShadow:"0 0 0 1px rgba(255, 255, 255, 0.9)",pointerEvents:"none"},resizeHandle:{position:"absolute",zIndex:4,width:Wt,height:Wt,borderRadius:"50%",border:"1px solid #2563eb",background:"#ffffff",boxShadow:"0 1px 2px rgba(15, 23, 42, 0.35)",boxSizing:"border-box",touchAction:"none"},shapeSelection:{position:"absolute",zIndex:3,border:"2px solid #2563eb",boxSizing:"border-box",boxShadow:"0 0 0 1px rgba(255, 255, 255, 0.9)",pointerEvents:"none"},remoteShapeSelection:{position:"absolute",zIndex:2,border:"2px solid",borderRadius:2,boxSizing:"border-box",boxShadow:"0 0 0 1px rgba(255, 255, 255, 0.88)",pointerEvents:"none"},remoteShapeWash:{position:"absolute",inset:0,opacity:.12},remoteShapeLabel:{position:"absolute",left:-2,maxWidth:180,overflow:"hidden",padding:"3px 6px",borderRadius:"4px 4px 4px 0",color:"#ffffff",fontSize:11,fontWeight:650,lineHeight:"14px",textOverflow:"ellipsis",whiteSpace:"nowrap",transform:"translateY(-100%)",boxShadow:"0 1px 3px rgba(15, 23, 42, 0.25)"},remoteShapeOverflow:{position:"absolute",top:8,right:8,zIndex:3,padding:"3px 6px",borderRadius:999,backgroundColor:"#475569",color:"#ffffff",fontSize:10,fontWeight:700,pointerEvents:"none"},textBoxPreview:{position:"absolute",border:"1.5px dashed #1a73e8",background:"rgba(26, 115, 232, 0.08)",boxSizing:"border-box",pointerEvents:"none"},notesPanel:{flex:"0 0 auto",display:"flex",flexDirection:"column",gap:4,padding:"8px 14px 10px",background:"#ffffff",borderTop:"1px solid #e2e8f0"},notesLabel:{fontSize:11,fontWeight:650,color:"#647087",textTransform:"uppercase",letterSpacing:"0.02em"},notesTextarea:{width:"100%",height:64,resize:"vertical",border:"1px solid #d8dee9",borderRadius:6,padding:"6px 8px",font:"13px ui-sans-serif, system-ui, sans-serif",color:"#172033",boxSizing:"border-box",outline:"none"},empty:{margin:"auto",color:"#6b7587",fontSize:14},error:{position:"absolute",left:16,right:16,bottom:14,padding:"9px 12px",color:"#8b1e2d",background:"#fff0f2",border:"1px solid #efb8c0",borderRadius:6,fontSize:12},presentButton:{display:"inline-flex",alignItems:"center",gap:6,flex:"0 0 auto",margin:"0 12px 0 4px",padding:"0 14px",height:30,border:0,borderRadius:15,background:"#1a73e8",color:"#ffffff",font:"600 13px ui-sans-serif, system-ui, sans-serif",cursor:"pointer"}};function Ni(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.slice(0,2).map(o=>o[0]).join("").toUpperCase()}function Oo(e,t){return {display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,flex:"0 0 auto",border:"2px solid #ffffff",borderRadius:999,backgroundColor:e,boxShadow:"0 0 0 1px rgba(15, 23, 42, 0.14)",color:"#ffffff",fontSize:10,fontWeight:700,letterSpacing:"-0.02em",opacity:t?1:.38}}function Oi(e){return {display:"flex",alignItems:"flex-start",gap:7,width:"100%",marginBottom:12,padding:4,border:e?"2px solid #325ee6":"2px solid transparent",borderRadius:5,background:"transparent",cursor:"pointer"}}export{vt as EditorToolbar,rt as EditorToolbarContext,Ct as LocaleProvider,xi as PptxEditor,At as PptxToolbar,St as SHAPE_PRESETS,At as Toolbar,Pe as ToolbarButton,qe as ToolbarDropdown,Me as ToolbarGroup,it as ToolbarMenuItem,Br as ToolbarMenuSeparator,_e as ToolbarSeparator,Dr as useEditorToolbar,Te as useTranslation};
|
|
1
|
+
export{b as PptxEditor,a as PptxWorkerEditorChunkLoadError}from'./chunk-66PPYFHW.js';export{E as EditorToolbar,v as EditorToolbarContext,B as PptxPluginToolbar,D as PptxToolbar,D as Toolbar,A as ToolbarCommand,y as ToolbarCommandButton,z as ToolbarCommandSelect,C as ToolbarOverflow,Q as definePptxPlugin,w as useEditorToolbar}from'./chunk-X6B77B3U.js';export{a as LocaleProvider,w as PptxCommandAdmissionError,B as PptxCommandProvider,k as SHAPE_PRESETS,Z as ToolbarButton,ba as ToolbarDropdown,_ as ToolbarGroup,ca as ToolbarMenuItem,da as ToolbarMenuSeparator,$ as ToolbarSeparator,E as usePptxCommand,D as usePptxCommandState,C as usePptxCommands,b as useTranslation}from'./chunk-X2M23RXQ.js';import'./chunk-O2XFH626.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betteroffice/pptx-react",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "PowerPoint-faithful React PPTX editor and viewer
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "PowerPoint-faithful React PPTX editor and viewer: full OOXML fidelity, real-time human + AI agent collaboration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pptx",
|
|
7
7
|
"powerpoint",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"typecheck": "tsc --noEmit -p ."
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@betteroffice/pptx": "0.
|
|
44
|
-
"@betteroffice/pptx-i18n": "0.
|
|
43
|
+
"@betteroffice/pptx": "0.5.0",
|
|
44
|
+
"@betteroffice/pptx-i18n": "0.5.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^18.0.0 || ^19.0.0",
|
|
48
48
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@happy-dom/global-registrator": "^
|
|
51
|
+
"@happy-dom/global-registrator": "^21.0.4",
|
|
52
52
|
"@testing-library/react": "^16.0.0",
|
|
53
|
-
"@types/bun": "^1.
|
|
53
|
+
"@types/bun": "^1.4.2",
|
|
54
54
|
"@types/react": "^19.2.17",
|
|
55
55
|
"@types/react-dom": "^19.2.3",
|
|
56
56
|
"react": "^19.2.7",
|
|
@@ -65,6 +65,9 @@
|
|
|
65
65
|
"url": "https://github.com/openooxml/betteroffice.git",
|
|
66
66
|
"directory": "packages/pptx-react"
|
|
67
67
|
},
|
|
68
|
+
"bugs": {
|
|
69
|
+
"url": "https://github.com/openooxml/betteroffice/issues"
|
|
70
|
+
},
|
|
68
71
|
"publishConfig": {
|
|
69
72
|
"access": "public"
|
|
70
73
|
}
|