@betteroffice/pptx-react 0.2.0 → 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 -350
- 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 +167 -6
- package/dist/index.js +1 -4
- package/package.json +8 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {H,Q,c,S,d,E,e,b,Z,R,C,y,_,U,D,X,I,J,q,p,f,h,g,z,i,m,k,j as j$1,aa,ca,Y,n,o,A,W,O,P,T,N,L,$,x,V as V$1,G,K,F,a,M,s,r,u,t}from'./chunk-X2M23RXQ.js';import {a as a$1}from'./chunk-O2XFH626.js';import {createContext,forwardRef,useRef,useId,useState,useCallback,useImperativeHandle,useEffect,useLayoutEffect,useContext,useSyncExternalStore,useReducer,useMemo,Component}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';var be=createContext(null);function oa(){let e=useContext(be);if(!e)throw new Error("useEditorToolbar must be used within an <EditorToolbar> component");return e}var ke=createContext(null),fn=createContext(false);function hn({value:e,label:t,onChange:n,onClear:o,icon:r="textColor",none:i=false,clearLabel:u,disabled:a=false,description:p,testId:s}){let[x,c]=useState(false),m=Q(),h=X(a,p);return jsxs("span",{style:{display:"inline-flex",alignItems:"center",height:28},children:[jsxs("label",{title:W(t,null,h.reason),"aria-label":t,style:{display:"inline-grid",placeItems:"center",width:28,height:28,borderRadius:6,background:x&&!a?H.hover:"transparent",color:x&&!a?H.ink:H.inkMuted,cursor:a?"default":"pointer",opacity:a?I:1,boxSizing:"border-box",position:"relative",...J(m.focusRing)},onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),children:[jsx(R,{name:r}),jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:7,right:7,bottom:5,height:3,borderRadius:1,boxShadow:`inset 0 0 0 1px ${H.line}`,background:i?"transparent":e,border:i?`1px solid ${H.inkMuted}`:0,boxSizing:"border-box"}}),i?jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:7,bottom:6,width:14,height:1,background:"#d93025",transform:"rotate(-18deg)"}}):null,h.node,jsx("input",{"data-testid":s,type:"color",...m.focusProps,value:e,...h.props,"aria-label":t,onClick:g=>{a&&g.preventDefault();},onKeyDown:g=>{a&&(g.key==="Enter"||g.key===" ")&&g.preventDefault();},onChange:g=>{a||n?.(g.target.value);},style:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:0}})]}),o?jsx("button",{type:"button",disabled:a,"aria-label":u??t,title:u??t,onMouseDown:g=>g.preventDefault(),onClick:o,style:{appearance:"none",width:15,height:28,padding:0,border:0,borderRadius:6,background:"transparent",color:H.inkMuted,cursor:a?"default":"pointer",opacity:a?I:1,font:"500 14px ui-sans-serif, system-ui, sans-serif"},children:"\xD7"}):null]})}function Ue({value:e,options:t,label:n,onCommit:o,disabled:r=false,description:i,width:u=72,inputStyle:a,testId:p}){let s=X(r,i),[x,c]=useState(e),[m,h]=useState(false),[g,R$1]=useState(null),[w,L]=useState(null),H$1=Q(),[N,M]=useState({top:0,left:0,width:u}),D=useRef(null),A=useRef(null),$=useRef(null),v=useRef(false);useEffect(()=>{v.current=false,c(e);},[e]);let z=useCallback(()=>h(false),[]);useEffect(()=>{if(!m||!D.current)return;let l=D.current.getBoundingClientRect();M({top:l.bottom+4,left:l.left,width:Math.max(l.width,u)});},[m,u]),useEffect(()=>{if(!m)return;let l=b=>{let E=b.target;!D.current?.contains(E)&&!A.current?.contains(E)&&z();},f=b=>{b.key==="Escape"&&(v.current=false,c(e),z());};return document.addEventListener("mousedown",l),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",f);}},[m,z,e]);let C=useCallback(()=>{v.current&&(v.current=false,c(e),!r&&o&&x.trim()&&o(x.trim()));},[r,o,x,e]);return jsxs("div",{ref:D,style:{display:"inline-flex",alignItems:"center",width:u,height:28,border:`1px solid ${H.line}`,borderRadius:6,background:H.surface,opacity:r?I:1,boxSizing:"border-box",flex:"0 0 auto",...J(H$1.focusRing)},children:[jsx("input",{ref:$,"data-testid":p,role:"combobox","aria-label":n,"aria-autocomplete":"list","aria-expanded":m,...s.props,readOnly:r,title:s.reason?W(n,null,s.reason):void 0,value:x,onFocus:l=>{H$1.focusProps.onFocus(l),!r&&(h(true),l.currentTarget.select());},onChange:l=>{v.current=true,c(l.target.value);},onKeyDown:l=>{r||(l.key==="Enter"?(C(),z(),l.currentTarget.blur()):l.key==="Escape"?(v.current=false,c(e)):l.key==="ArrowDown"&&(h(true),l.preventDefault()));},onBlur:l=>{if(H$1.focusProps.onBlur(l),r){v.current=false,c(e);return}requestAnimationFrame(()=>{A.current?.contains(document.activeElement)||C();});},style:{appearance:"none",width:"calc(100% - 22px)",height:26,padding:"0 2px 0 7px",border:0,outline:0,background:"transparent",color:H.ink,font:"500 13px ui-sans-serif, system-ui, sans-serif",boxSizing:"border-box",...a}}),s.node,jsx("button",{type:"button",disabled:r,tabIndex:-1,"aria-label":n,title:n,onMouseDown:l=>l.preventDefault(),onClick:()=>{r||(h(l=>!l),$.current?.focus());},style:{appearance:"none",display:"grid",placeItems:"center",width:21,height:26,padding:0,border:0,background:"transparent",color:H.inkMuted,cursor:r?"default":"pointer"},children:jsx(R,{name:"chevronDown",size:18})}),m&&!r&&jsx("div",{ref:A,role:"listbox","aria-label":n,style:{position:"fixed",top:N.top,left:N.left,zIndex:1e4,width:N.width,maxHeight:260,overflowY:"auto",...O},children:t.map(l=>jsxs("button",{type:"button",role:"option","aria-selected":l.value===e,onMouseDown:f=>f.preventDefault(),onClick:()=>{v.current=false,c(l.label),o?.(l.value),z();},onMouseEnter:()=>R$1(l.value),onMouseLeave:()=>R$1(null),onFocus:()=>L(l.value),onBlur:()=>L(null),style:{...P({hovered:g===l.value,focusRing:w===l.value}),gap:6,minHeight:28,padding:"4px 8px 4px 4px"},children:[jsx("span",{style:{display:"inline-flex",width:18,flex:"0 0 auto"},children:l.value===e&&jsx(R,{name:"check",size:18})}),l.label]},l.value))})]})}var mt="pointer",Pn=false;function ft(){if(Pn||typeof document>"u")return;Pn=true;let e=()=>{mt="pointer";};document.addEventListener("pointerdown",e,true),document.addEventListener("mousedown",e,true),document.addEventListener("keydown",()=>{mt="keyboard";},true);}function No(e,t){ft(),!(mt!=="pointer"||t.ok&&t.status==="opened")&&requestAnimationFrame(()=>y(e)?.focusEditor());}function de(e,t,n){ft(),e.execute(t,n).then(o=>No(e,o));}ft();var _o={bold:"bold",italic:"italic",underline:"underline",textColor:"textColor",insertSlide:"newSlide",insertImage:"insertImage",shapeFill:"fillColor",shapeStrokeColor:"borderColor",shapeStrokeWidth:"borderWidth",zOrder:"bringToFront",save:"save",exportPng:"image",undo:"undo",redo:"redo"},Xe={l:{icon:"alignLeft",labelKey:"toolbar.align.left",testId:"left"},ctr:{icon:"alignCenter",labelKey:"toolbar.align.center",testId:"center"},r:{icon:"alignRight",labelKey:"toolbar.align.right",testId:"right"},just:{icon:"alignJustify",labelKey:"toolbar.align.justify",testId:"justify"}},gt={forward:{icon:"bringForward",labelKey:"toolbar.bringForward"},backward:{icon:"sendBackward",labelKey:"toolbar.sendBackward"},front:{icon:"bringToFront",labelKey:"toolbar.bringToFront"},back:{icon:"sendToBack",labelKey:"toolbar.sendToBack"}},Sn=["forward","backward","front","back"],Wo={bold:"pptx-bold",italic:"pptx-italic",underline:"pptx-underline",insertSlide:"pptx-new-slide",insertImage:"pptx-insert-image",save:"pptx-save",exportPng:"pptx-export-png",undo:"pptx-undo",redo:"pptx-redo"};function V(e){return e.enabled?void 0:e.disabledReason.message}function ce(e){return e&&typeof e=="object"?e:null}function ht(e,t){let n=ce(t)?.value;return e==="alignment"&&typeof n=="string"?Xe[n]?.icon:e==="zOrder"&&typeof n=="string"?gt[n]?.icon:e==="tool"&&typeof n=="string"?n==="select"?"select":n==="textBox"?"textBox":"shape":e==="fontSizeStep"?ce(t)?.direction==="increase"?"add":"remove":_o[e]}function Cn(e,t,n,o){let r=ce(t)?.value;if(e==="alignment"&&typeof r=="string"){let i=Xe[r];if(i)return n(i.labelKey)}if(e==="zOrder"&&typeof r=="string"){let i=gt[r];if(i)return n(i.labelKey)}if(e==="tool"&&typeof r=="string"){if(r==="select")return n("commands.selectTool");if(r==="textBox")return n("toolbar.textBoxTool");let i=k.find(u=>`shape:${u.geometry}`===r);if(i)return n(i.labelKey)}return e==="fontSizeStep"?n(ce(t)?.direction==="increase"?"toolbar.increaseFontSize":"toolbar.decreaseFontSize"):o}function $o(e,t){let n=ce(t)?.value;if(e==="alignment"&&typeof n=="string"){let o=Xe[n];return o?`pptx-align-${o.testId}`:void 0}if(e==="tool"&&n==="select")return "pptx-tool-select";if(e==="tool"&&n==="textBox")return "pptx-tool-text-box";if(e==="fontSizeStep")return ce(t)?.direction==="increase"?"pptx-font-size-increase":"pptx-font-size-decrease";if(!(e==="insertSlide"&&ce(t)?.layoutPartPath!==void 0))return Wo[e]}function wn(e,t){return e==="tool"&&ce(t)?.value==="select"?"Esc":j$1(e,t)}function En(e,t){return y(e)?.prepare(t)??{execute:n=>e.execute(t,n)}}function qe(e$1,t,n,o,r){let i=e$1.getState(n,o),u=ht(n,o);return {kind:"item",id:r,label:Cn(n,o,t,t(e$1.getDescriptor(n).labelKey)),icon:u?jsx(R,{name:u,size:16}):void 0,shortcut:wn(n,o)??void 0,checked:i.active,disabled:!i.enabled,description:V(i),onSelect:()=>{e$1.execute(n,o??e(n));}}}function Go(e,t,n){return (n.options??[]).map((o,r)=>({kind:"item",id:`${t}-${r}`,label:o.label,radio:true,checked:o.state.active===true,disabled:!o.state.enabled,description:o.state.enabled?void 0:o.state.disabledReason.message,onSelect:()=>{e.execute(t,o.args);}}))}function jo(e,t,n,o){let r=e.getState(n),i=V(r),u=Go(e,n,r);if(n==="insertSlide"&&u.unshift(qe(e,t,"insertSlide",{},"insertSlide-current"),{kind:"separator",id:"insertSlide-separator"}),n==="fontSize"&&o.prompt){let a=o.prompt;u.push({kind:"item",id:"fontSize-custom",label:t("commands.customFontSize"),disabled:!r.enabled,description:i,onSelect:()=>{let p=En(e,"fontSize");a({title:t("toolbar.fontSize"),label:t("commands.fontSizePoints"),initialValue:typeof r.value=="number"?String(r.value):"",valid:s=>/^\d+(\.\d+)?$/.test(s)&&e.getState("fontSize",{points:Number(s)}).enabled,submit:s=>{p.execute({points:Number(s)});}});}});}return {kind:"submenu",id:n,label:t(e.getDescriptor(n).labelKey),disabled:!r.enabled,description:i,entries:u}}var Tn={shapeFill:"toolbar.noFill",shapeStrokeColor:"toolbar.noBorder"};function Ve(e){return {color:e}}function Zo(e,t,n,o){let r=e.getState(n),i=!r.enabled,u=V(r),a=typeof r.value=="string"?r.value:null,p=t(e.getDescriptor(n).labelKey),s=[],x=Tn[n];if(x&&s.push({kind:"item",id:`${n}-clear`,label:t(x),radio:true,checked:r.value===null,disabled:i,description:u,onSelect:()=>{e.execute(n,Ve(null));}}),o.prompt){let c=o.prompt;s.push({kind:"item",id:`${n}-custom`,label:t("commands.customColor"),disabled:i,description:u,onSelect:()=>{let m=En(e,n);c({title:p,label:t("commands.hexColor"),placeholder:"#1A73E8",initialValue:a??"",valid:h=>/^#?[0-9a-f]{6}$/i.test(h),submit:h=>{m.execute(Ve(`#${h.replace(/^#/,"").toLowerCase()}`));}});}});}return {kind:"submenu",id:n,label:p,disabled:i,description:u,entries:s}}function Uo(e,t){let n=e.getState("zOrder");return {kind:"submenu",id:"zOrder",label:t(e.getDescriptor("zOrder").labelKey),disabled:!n.enabled,description:V(n),entries:Sn.map(o=>qe(e,t,"zOrder",{value:o},`zOrder-${o}`))}}var Rn=new Set(["fontFamily","fontSize","alignment","insertSlide","tool","shapeStrokeWidth","shapeAdjustment","zoom","proposalSelect"]);function Vo(e,t,n,o,r={}){{if(Rn.has(n))return jo(e,t,n,r);if(n==="textColor"||n==="shapeFill"||n==="shapeStrokeColor")return Zo(e,t,n,r);if(n==="zOrder")return Uo(e,t)}return qe(e,t,n,o,n)}function Xo(e,t,n){let o=C(),{t:r}=b(),i=useContext(T)?.prompt;U(e,()=>[Vo(o,r,t,n,{prompt:i})]);}function j(e$1){let{id:t,children:n,label:o,className:r,style:i}=e$1,u=e$1.args,a=d(t)?null:t,p=E(t,u??(a?e(a):null)),{t:s}=b();if(!a&&p.descriptor===null)return null;let x=a?ht(a,u):void 0,c=o??(a?Cn(a,u,s,p.label):p.label);return jsx(Z,{active:p.state.active,disabled:!p.state.enabled,description:V(p.state),title:c,shortcut:(a?wn(a,u):p.shortcut)??void 0,className:r,style:!x&&!n?{padding:"0 8px",...i}:i,testId:a?$o(a,u):void 0,onClick:()=>{p.execute();},children:n??(x?jsx(R,{name:x}):c)})}function xt({id:e,children:t,className:n,style:o}){let r=useRef(null);return Xo(r,e),jsx("span",{ref:r,className:n,style:{display:"inline-flex",alignItems:"center",gap:1,flex:"0 0 auto",...o},children:t})}function qo(){let e=C(),t=D("fontFamily"),{t:n}=b();return jsx(aa,{title:n("toolbar.fontFamily"),disabled:!t.enabled,description:V(t),menuWidth:210,testId:"pptx-font-family",style:{width:120,justifyContent:"space-between"},trigger:jsxs(Fragment,{children:[jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:t.value??n("toolbar.mixed")}),jsx(R,{name:"chevronDown",size:18})]}),children:o=>(t.options??[]).map(r=>jsx(ca,{label:r.label,radio:true,selected:t.value===r.args.family,onClick:()=>de(e,"fontFamily",r.args),close:o},r.args.family))})}function bt(e){return Number.parseFloat(e.replace("%","").trim())}function Yo(){let e=C(),t=D("fontSize"),{t:n$1}=b();return jsx(Ue,{value:typeof t.value=="number"?String(t.value):"",options:(t.options??[]).map(o=>({value:String(o.args.points),label:o.label})),label:n$1("toolbar.fontSize"),disabled:!t.enabled,description:V(t),onCommit:o$1=>{let r=bt(o$1);Number.isFinite(r)&&r>=n&&r<=o&&de(e,"fontSize",{points:r});},width:50,inputStyle:{textAlign:"center"},testId:"pptx-font-size"})}function Jo(){let e=C(),t=D("zoom"),{t:n}=b(),o=n("toolbar.fit"),r=t.value??"fit",i=r==="fit"?o:`${Math.round(r*100)}%`;return jsx(Ue,{value:i,options:(t.options??[]).map(u=>({value:u.label,label:u.label})),label:n("toolbar.zoomValue",{value:i}),disabled:!t.enabled,description:V(t),onCommit:u=>{if(u===o){de(e,"zoom",{scale:"fit"});return}let a=bt(u)/100;Number.isFinite(a)&&a>=p&&a<=q&&de(e,"zoom",{scale:a});},width:76,testId:"pptx-zoom"})}function Qo(){let e=C(),t=D("alignment"),{t:n}=b();return jsx(Fragment,{children:(t.options??[]).map(o=>jsx(er,{store:e,value:o.args.value,t:n},o.args.value))})}function er({store:e,value:t,t:n}){let o=D("alignment",{value:t}),r=Xe[t];return jsx(Y,{title:n(r.labelKey),active:o.active,disabled:!o.enabled,description:V(o),onClick:()=>{e.execute("alignment",{value:t});},testId:`pptx-align-${r.testId}`,children:jsx(R,{name:r.icon})})}function tr(){let e=C(),t=D("insertSlide"),n=E("insertSlide",{}),{t:o}=b(),r=t.options??[];return jsxs(Fragment,{children:[jsx(Y,{title:o("toolbar.newSlide"),disabled:!n.state.enabled,description:V(n.state),onClick:()=>{n.execute();},style:{borderRadius:"6px 0 0 6px"},testId:"pptx-new-slide",children:jsx(R,{name:"newSlide"})}),jsx(aa,{title:o("toolbar.newSlideWithLayout"),disabled:!t.enabled||r.length===0,description:V(t),menuWidth:230,testId:"pptx-new-slide-layout",style:{minWidth:20,width:20,padding:0,borderRadius:"0 6px 6px 0"},trigger:jsx(R,{name:"chevronDown",size:18}),children:i=>r.map((u,a)=>jsx(ca,{label:u.label,radio:true,selected:(u.args.layoutPartPath??null)===(t.value??null),onClick:()=>{e.execute("insertSlide",u.args);},close:i},u.args.layoutPartPath??`default-${a}`))})]})}function Pt(){let e=C(),t=D("tool"),n=D("tool",{value:"shape:rect"}),{t:o}=b(),r=useRef(null),i=useId();U(r,()=>[{kind:"submenu",id:i,label:o("toolbar.shapeTool"),disabled:!n.enabled,description:V(n),entries:k.map(a=>qe(e,o,"tool",{value:`shape:${a.geometry}`},`${i}-${a.geometry}`))}]);let u=t.value??"select";return jsx("span",{ref:r,style:{display:"inline-flex",flex:"0 0 auto"},children:jsx(aa,{title:o("toolbar.shapeTool"),active:u.startsWith("shape:"),disabled:!n.enabled,description:V(n),menuWidth:264,testId:"pptx-tool-shape",style:{minWidth:46,padding:"0 4px"},trigger:jsxs(Fragment,{children:[jsx(R,{name:"shape"}),jsx(R,{name:"chevronDown",size:18})]}),children:a=>jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 44px)",gap:4,padding:2},children:k.map(p=>{let s=`shape:${p.geometry}`;return jsx("button",{type:"button",role:"menuitemradio",tabIndex:-1,"aria-checked":u===s,"data-testid":`pptx-shape-${p.geometry}`,"aria-label":o(p.labelKey),title:o(p.labelKey),onClick:()=>{a(),de(e,"tool",{value:s});},style:{appearance:"none",display:"grid",placeItems:"center",width:44,height:38,padding:5,border:`1px solid ${H.line}`,borderRadius:6,background:u===s?H.selected:H.surface,color:H.ink,cursor:"pointer"},children:jsx(pr,{geometry:p.geometry})},p.geometry)})})})})}function nr(){let e=C(),t=D("shapeStrokeWidth"),{t:n}=b();return jsx(aa,{title:n("toolbar.borderWidth"),disabled:!t.enabled,description:V(t),menuWidth:170,testId:"pptx-shape-border-width",trigger:jsx(R,{name:"borderWidth"}),children:o=>(t.options??[]).map(r=>jsx(ca,{label:r.label,radio:true,selected:t.value===r.args.points,icon:r.args.points===null?void 0:jsx("span",{"aria-hidden":"true",style:{width:18,borderTop:`${Math.min(r.args.points,5)}px solid currentColor`}}),onClick:()=>{e.execute("shapeStrokeWidth",r.args);},close:o},String(r.args.points)))})}function or(){let e=C(),t=D("shapeAdjustment"),{t:n}=b(),o=t.value;if(!o)return null;let r=t.options??[],i=r.length>0?r[r.length-1].args.value:1,u=i<1;return jsx(Ue,{value:`${Math.round(o.value*100)}%`,options:r.map(a=>({value:String(Math.round(a.args.value*100)),label:a.label})),label:n(u?"toolbar.cornerRadius":"toolbar.shapeAdjustment"),disabled:!t.enabled,description:V(t),onCommit:a=>{let p=bt(a);Number.isFinite(p)&&de(e,"shapeAdjustment",{name:o.name,value:Math.max(0,Math.min(i*100,p))/100});},width:68,inputStyle:{textAlign:"center"},testId:u?"pptx-shape-corner-radius":"pptx-shape-adjustment"})}function rr({className:e}){let t=C(),n=D("proposalSelect"),{t:o}=b(),r=!n.enabled;return jsx("select",{className:e,"aria-label":o("proposals.canvasTitle"),"aria-disabled":r||void 0,title:V(n),value:n.value??"",onChange:i=>{r||t.execute("proposalSelect",{proposalId:i.target.value});},style:{maxWidth:220,font:"400 13px ui-sans-serif, system-ui, sans-serif"},children:(n.options??[]).map(i=>jsx("option",{value:i.args.proposalId,children:i.label},i.args.proposalId))})}function ir({id:e,className:t}){let n=null;switch(e){case "fontFamily":n=jsx(qo,{});break;case "fontSize":n=jsx(Yo,{});break;case "alignment":n=jsx(Qo,{});break;case "insertSlide":n=jsx(tr,{});break;case "tool":n=jsxs(Fragment,{children:[jsx(yn,{value:"select"}),jsx(yn,{value:"textBox"}),jsx(Pt,{})]});break;case "shapeStrokeWidth":n=jsx(nr,{});break;case "shapeAdjustment":n=jsx(or,{});break;case "zoom":n=jsx(Jo,{});break;case "proposalSelect":n=jsx(rr,{});break}return e==="tool"?jsx("span",{className:t,style:{display:"inline-flex",alignItems:"center",gap:1,flex:"0 0 auto"},children:n}):jsx(xt,{id:e,className:t,children:n})}function yn({value:e}){return jsx(j,{id:"tool",args:{value:e}})}var ar={textColor:"pptx-text-color",shapeFill:"pptx-shape-fill",shapeStrokeColor:"pptx-shape-border-color"},lr={textColor:"#000000",shapeFill:"#d9eaf7",shapeStrokeColor:"#202124"};function sr({id:e}){let t=C(),n=D(e),{t:o}=b(),r=Tn[e],i=typeof n.value=="string"?n.value:null,u=!n.enabled;return jsx(xt,{id:e,children:jsx(hn,{value:i??lr[e],label:o(t.getDescriptor(e).labelKey),clearLabel:r?o(r):void 0,icon:ht(e,void 0),none:!!r&&!i,disabled:u,description:V(n),onChange:a=>de(t,e,Ve(a)),onClear:r?()=>{t.execute(e,Ve(null));}:void 0,testId:ar[e]})})}function ur(){let e=C(),t=D("zOrder"),{t:n}=b();return jsx(xt,{id:"zOrder",children:jsx(aa,{title:n("toolbar.arrange"),disabled:!t.enabled,description:V(t),menuWidth:190,testId:"pptx-shape-arrange",trigger:jsx(R,{name:"bringToFront"}),children:o=>Sn.map(r=>jsx(dr,{store:e,value:r,close:o,t:n},r))})})}function dr({store:e,value:t,close:n,t:o}){let r=D("zOrder",{value:t}),i=gt[t];return jsx(ca,{label:o(i.labelKey),icon:jsx(R,{name:i.icon,size:16}),disabled:!r.enabled,description:V(r),onClick:()=>{e.execute("zOrder",{value:t});},close:n})}function cr(){return jsxs(Fragment,{children:[jsx(j,{id:"fontSizeStep",args:{direction:"decrease"}}),jsx(j,{id:"fontSizeStep",args:{direction:"increase"}})]})}function ee(e){let{id:t,className:n}=e;if(d(t))return jsx(j,{id:t,className:n});let o=e.args;if(o===void 0){if(Rn.has(t))return jsx(ir,{id:t,className:n});switch(t){case "textColor":case "shapeFill":case "shapeStrokeColor":return jsx(sr,{id:t});case "zOrder":return jsx(ur,{});case "fontSizeStep":return jsx(cr,{});}}return jsx(j,{id:t,args:o,className:n})}function pr({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})})}var gr=Object.freeze([]);function In(){let e=C(),t=y(e),n=useCallback(()=>t?.pluginToolbar()??gr,[t]),o=useSyncExternalStore(e.subscribe,n,n),{t:r}=b();return o.length===0?null:jsx(_,{label:r("plugins.toolbarGroup"),children:o.map(i=>jsx(j,{id:i},i))})}var Pr={surface:H.surface,text:H.ink,mutedText:H.inkMuted,border:H.line,hover:H.hover,shadow:"rgba(0, 0, 0, 0.12)",focus:H.accent},Mn='[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]',pe=8,yr=320;function vr(e,t,n){let o=t.offsetWidth,r=t.scrollHeight,i=window.innerWidth,u=window.innerHeight,a=n?e.right:e.right-o;n&&a+o>i-pe&&(a=e.left-o),a=Math.max(pe,Math.min(a,i-o-pe));let p=u-pe-(n?e.top:e.bottom+4),s=(n?e.bottom:e.top-4)-pe;if(r<=p||p>=s)return {top:n?e.top:e.bottom+4,left:a,maxHeight:Math.max(p,80)};let x=Math.max(s,80),c=n?e.bottom:e.top-4;return {top:Math.max(pe,c-Math.min(r,x)),left:a,maxHeight:x}}function Sr(){return jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:jsx("path",{d:"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z",fill:"currentColor"})})}function Cr(){return jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:jsx("path",{d:"M10 6 8.6 7.4 13.2 12l-4.6 4.6L10 18l6-6z",fill:"currentColor"})})}function On({id:e,label:t,entries:n,anchor:o,beside:r,colors:i,initialFocus:u,onClose:a,onSelect:p,registerMenu:s}){let x=useRef(null),c=useId(),[m,h]=useState(null),g=useRef(false),[R,w]=useState(null),[L,H]=useState(null),[N,M]=useState(null),D=useRef(new Map),A=S({container:x,itemSelector:Mn,scope:'[role="menu"]',labelOf:C=>C.dataset.label??C.textContent??""});useLayoutEffect(()=>x.current?s(x.current):void 0,[s]),useLayoutEffect(()=>{let C=o(),l=x.current;if(!C||!l)return;let f=vr(C,l,r);h(b=>b&&b.top===f.top&&b.left===f.left&&b.maxHeight===f.maxHeight?b:f);},[o,r,n]),useLayoutEffect(()=>{!m||g.current||(g.current=true,u==="first"?A.focusFirst():u==="last"?A.focusLast():u==="menu"&&x.current?.focus({preventScroll:true}));},[u,m,A]);let $=(C,l)=>M({id:C,focus:l}),v=C=>{if(C.target instanceof Node&&!x.current?.contains(C.target))return;let l=C.target instanceof HTMLElement?C.target.closest(Mn):null,f=l&&l.closest('[role="menu"]')===x.current?l:null;if(C.key==="Escape"){C.preventDefault(),C.stopPropagation(),a(r?"parent":"escape");return}if(C.key==="Tab"){setTimeout(()=>a("tab"),0);return}if(r&&C.key==="ArrowLeft"){C.preventDefault(),C.stopPropagation(),a("parent");return}if(f?.dataset.submenu&&(C.key==="ArrowRight"||C.key==="Enter"||C.key===" ")){C.preventDefault(),C.stopPropagation(),f.getAttribute("aria-disabled")!=="true"&&$(f.dataset.submenu,"first");return}if(f&&(C.key==="Enter"||C.key===" ")){C.preventDefault(),C.stopPropagation();let b=Ln(n,f.dataset.entry??"");b&&!b.disabled&&p(b,"keyboard");return}A.onKeyDown(C)&&C.stopPropagation();},z=C=>C.map(l=>{if(l.kind==="separator")return jsx("div",{role:"separator",style:{height:1,margin:"4px 0",background:i.border}},l.id);if(l.kind==="group"){let W=`${c}-${l.id}-label`;return jsxs("div",{role:"group","aria-labelledby":l.label?W:void 0,children:[l.label&&jsx("div",{id:W,style:{padding:"6px 12px 2px",fontSize:11,fontWeight:500,color:i.mutedText,overflowWrap:"anywhere"},children:l.label}),z(l.entries)]},l.id)}let f=l.description?`${c}-${l.id}-description`:void 0,b=l.kind==="submenu",E=b?"menuitem":l.radio?"menuitemradio":l.checked!==void 0?"menuitemcheckbox":"menuitem",_=b?void 0:l.checked,q=b&&N?.id===l.id;return jsxs("div",{style:{position:"relative"},children:[jsxs("div",{role:E,tabIndex:-1,"data-entry":l.id,"data-label":l.label,"data-submenu":b?l.id:void 0,"aria-haspopup":b?"menu":void 0,"aria-expanded":b?q:void 0,"aria-checked":E==="menuitemcheckbox"||E==="menuitemradio"?_==="mixed"?"mixed":_===true:void 0,"aria-disabled":l.disabled?true:void 0,"aria-describedby":f,title:l.description,ref:W=>{b&&W&&D.current.set(l.id,W);},onMouseDown:W=>W.preventDefault(),onMouseEnter:()=>{b&&!l.disabled?$(l.id,"none"):N&&M(null),H(l.id);},onMouseLeave:()=>H(null),onFocus:()=>w(l.id),onBlur:()=>w(W=>W===l.id?null:W),onClick:()=>{l.disabled||(b?$(l.id,"none"):p(l,"pointer"));},style:{display:"flex",alignItems:"center",gap:8,minHeight:32,margin:"0 4px",padding:"4px 12px 4px 8px",borderRadius:6,fontSize:13,cursor:l.disabled?"default":"pointer",color:l.disabled?i.mutedText:i.text,opacity:l.disabled?.6:1,background:!l.disabled&&(L===l.id||R===l.id)?i.hover:"transparent",...R===l.id?{outline:`2px solid ${i.focus}`,outlineOffset:-2}:{outline:"none"}},children:[jsx("span",{style:{width:16,flexShrink:0,display:"inline-flex",justifyContent:"center"},children:_===true?jsx(Sr,{}):_==="mixed"?"\u2013":null}),l.icon&&jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",flexShrink:0},children:l.icon}),jsx("span",{style:{flex:1,minWidth:0,overflowWrap:"anywhere"},children:l.label}),!b&&l.shortcut&&jsx("span",{"aria-hidden":"true",style:{marginLeft:16,flexShrink:0,whiteSpace:"nowrap",fontSize:12,color:i.mutedText},children:l.shortcut}),b&&jsx("span",{style:{display:"inline-flex",flexShrink:0},children:jsx(Cr,{})})]}),f&&jsx("span",{id:f,hidden:true,children:l.description}),b&&q&&jsx(On,{label:l.label,entries:l.entries,anchor:()=>D.current.get(l.id)?.getBoundingClientRect()??null,beside:true,colors:i,initialFocus:N?.focus??"none",onClose:W=>{M(null),W==="parent"?D.current.get(l.id)?.focus():a(W);},onSelect:p,registerMenu:s})]},l.id)});return jsx("div",{ref:x,id:e,role:"menu","aria-label":t,"aria-orientation":"vertical",tabIndex:-1,onKeyDown:v,style:{position:"fixed",top:m?.top??0,left:m?.left??0,maxHeight:m?.maxHeight,visibility:m?"visible":"hidden",overflowY:"auto",overflowX:"hidden",minWidth:Math.min(200,window.innerWidth-2*pe),maxWidth:Math.min(yr,window.innerWidth-2*pe),padding:"4px 0",background:i.surface,color:i.text,border:`1px solid ${i.border}`,borderRadius:8,boxShadow:`0 4px 16px ${i.shadow}`,zIndex:1e4,boxSizing:"border-box",outline:"none"},children:z(n)})}function Ln(e,t){for(let n of e){if(n.kind==="item"&&n.id===t)return n;if(n.kind==="group"){let o=Ln(n.entries,t);if(o)return o}}return null}var Dn=forwardRef(function({label:t,trigger:n,entries:o,colors:r,triggerClassName:i,triggerStyle:u,testId:a,onItemSelected:p},s){let x=useRef(null),c=useRef(new Set),m=useId(),[h,g]=useState(null),[R,w]=useState(false),L=Q(),H={...Pr,...r},N=useCallback(()=>g(null),[]);useImperativeHandle(s,()=>({focus:()=>x.current?.focus({preventScroll:true}),close:N}),[N]);let M=useCallback(A=>(c.current.add(A),()=>{c.current.delete(A);}),[]);useEffect(()=>{if(!h)return;let A=v=>{let z=v.target;if(!x.current?.contains(z)){for(let C of c.current)if(C.contains(z))return;N();}},$=()=>{let v=document.activeElement,z=[...c.current].some(C=>C.contains(v));N(),z&&x.current?.focus({preventScroll:true});};return document.addEventListener("mousedown",A,true),window.addEventListener("resize",$),()=>{document.removeEventListener("mousedown",A,true),window.removeEventListener("resize",$);}},[h,N]);let D=useCallback(()=>x.current?.getBoundingClientRect()??null,[]);return jsxs("span",{style:{display:"inline-flex",flex:"0 0 auto"},children:[jsx("button",{ref:x,type:"button",className:i,style:typeof u=="function"?u({hovered:R,open:h!==null,focusRing:L.focusRing}):u,...L.focusProps,onMouseEnter:()=>w(true),onMouseLeave:()=>w(false),"data-testid":a,"aria-label":t,title:t,"aria-haspopup":"menu","aria-expanded":h!==null,"aria-controls":h?m:void 0,onMouseDown:A=>A.preventDefault(),onClick:()=>g(A=>A?null:"menu"),onKeyDown:A=>{A.key==="Enter"||A.key===" "||A.key==="ArrowDown"?(A.preventDefault(),g("first")):A.key==="ArrowUp"&&(A.preventDefault(),g("last"));},children:n}),h&&jsx(On,{id:m,label:t,entries:o,anchor:D,beside:false,colors:H,initialFocus:h,onClose:A=>{N(),A!=="tab"&&x.current?.focus({preventScroll:true});},onSelect:(A,$)=>{N(),$==="keyboard"&&x.current?.focus({preventScroll:true}),A.onSelect(),p?.($);},registerMenu:M})]})});var Tr={position:"absolute",visibility:"hidden",pointerEvents:"none",insetInlineStart:"0"},Fn={overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin"},Rr=new WeakMap,Hn=new WeakMap,Nn=["a[href]","button",'input:not([type="hidden"])',"select","textarea","summary","[tabindex]",'[contenteditable]:not([contenteditable="false"])'].join(", ");function _n(e,t){if(t.length===0)return false;let n=Array.from(e.querySelectorAll(Nn));return e.matches(Nn)&&n.push(e),n.every(o=>t.some(r=>r.contains(o)))}function Bn(e){let t=getComputedStyle(e),n=(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0);return e.getBoundingClientRect().width+n}function kr(e){let t=getComputedStyle(e),n=(parseFloat(t.paddingLeft)||0)+(parseFloat(t.paddingRight)||0);return e.getBoundingClientRect().width-n}function Ct(e,t,n,o){let r=n.get(e);if(o===!!r)return false;let i=Object.keys(t);if(o){let u={};for(let a of i)u[a]=e.style[a],e.style[a]=t[a]??"";n.set(e,u);}else {for(let u of i)e.style[u]=r?.[u]??"";n.delete(e);}return true}function Je(e,t){Ct(e,Tr,Rr,t)&&(t?e.setAttribute("aria-hidden","true"):e.removeAttribute("aria-hidden"),e.inert=t);}function Kn(e,t){let n=e.getBoundingClientRect(),o=t.getBoundingClientRect();o.left<n.left?e.scrollLeft-=n.left-o.left:o.right>n.right&&(e.scrollLeft+=Math.min(o.right-n.right,o.left-n.left));}function Ir(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}function Wn(e){let t=useRef(e);t.current=e;let[n,o]=useState([]),r=useRef(n);r.current=n;let i=useRef(e.moreWidth??32),u=useCallback(()=>{let{items:a,more:p,canHide:s,onFocusHidden:x}=t.current,c=a.current,m=c?.parentElement;if(!c||!m)return;let h=c.scrollLeft,g=p.current;g&&(i.current=Bn(g));let R=Array.from(c.children).filter(v=>v instanceof HTMLElement);for(let v of R)Je(v,false);let w=parseFloat(getComputedStyle(c).columnGap)||0,L=kr(m),H=g?.style.position;g&&(g.style.position="absolute");let N=R.map(Bn);g&&(g.style.position=H??"");let M=N.reduce((v,z)=>v+z,0)+w*Math.max(0,R.length-1),D=[],A=false;if(M>L+.5){let v=L-i.current,z=R.map(f=>s(f)),C=R.reduce((f,b,E)=>z[E]?f:f+N[E]+w,0),l=false;R.forEach((f,b)=>{if(z[b]){if(!l&&C+N[b]<=v){C+=N[b]+w;return}l=true,D.push(f);}}),A=C-w>(D.length>0?v:L)+.5;}Ct(c,Fn,Hn,A);for(let v of R)Je(v,D.includes(v));for(let v of r.current)R.includes(v)||Je(v,false);c.scrollLeft=h;let $=document.activeElement;$&&D.some(v=>v.contains($))?x?.():A&&$&&c.contains($)&&Kn(c,$),Ir(D,r.current)||(r.current=D,o(D));},[]);return useLayoutEffect(()=>{u();}),useLayoutEffect(()=>{let a=t.current.items.current;if(!a)return;let p=new Set,s=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>u()),x=()=>{if(s)for(let h of [a,a.parentElement,...Array.from(a.children)])h&&!p.has(h)&&(p.add(h),s.observe(h));};x();let c=typeof MutationObserver>"u"?null:new MutationObserver(()=>{x(),u();});c?.observe(a,{childList:true});let m=h=>{h.target instanceof Element&&Kn(a,h.target);};return a.addEventListener("focusin",m),window.addEventListener("resize",u),document.fonts?.ready.then(u,()=>{}),()=>{s?.disconnect(),c?.disconnect(),a.removeEventListener("focusin",m),window.removeEventListener("resize",u),Ct(a,Fn,Hn,false);for(let h of Array.from(a.children))h instanceof HTMLElement&&Je(h,false);}},[u]),{hidden:n,remeasure:u}}var Or="input, button:not([disabled])",jn={height:30,padding:"0 12px"};function Un({prompt:e,onClose:t}){let{t:n}=b(),o=Q(),r=Q(),[i,u]=useState(e.initialValue??""),a=useRef(null),p=useRef(null),s=useId(),x=useId(),c=i.trim(),m=e.valid(c);return useLayoutEffect(()=>{p.current?.focus(),p.current?.select();},[]),jsx("div",{style:{position:"fixed",inset:0,zIndex:10001,display:"flex",alignItems:"center",justifyContent:"center",padding:16,background:"rgba(32, 33, 36, 0.32)"},onMouseDown:g=>{g.target===g.currentTarget&&t();},children:jsxs("form",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":s,onKeyDown:g=>{if(g.key==="Escape"){g.preventDefault(),g.stopPropagation(),t();return}if(g.key!=="Tab")return;let R=Array.from(a.current?.querySelectorAll(Or)??[]);if(R.length===0)return;let w=R.indexOf(document.activeElement),L=g.shiftKey?w<=0?R.length-1:w-1:w===R.length-1?0:w+1;g.preventDefault(),R[L].focus();},onSubmit:g=>{g.preventDefault(),m&&(t(),e.submit(c));},style:{width:"min(320px, 100%)",boxSizing:"border-box",padding:16,borderRadius:8,background:H.surface,color:H.ink,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.18)",font:"400 13px ui-sans-serif, system-ui, sans-serif"},children:[jsx("h2",{id:s,style:{margin:"0 0 12px",fontSize:15,fontWeight:600},children:e.title}),jsx("label",{htmlFor:x,style:{display:"block",marginBottom:4,fontSize:12},children:e.label}),jsx("input",{id:x,ref:p,value:i,placeholder:e.placeholder,"aria-invalid":c!==""&&!m,onChange:g=>u(g.target.value),style:{width:"100%",boxSizing:"border-box",padding:"6px 8px",border:`1px solid ${H.line}`,borderRadius:6,background:H.surface,color:H.ink,outlineColor:H.accent}}),jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:16},children:[jsx("button",{type:"button",onClick:t,...o.focusProps,style:{...L({focusRing:o.focusRing}),...jn,border:`1px solid ${H.line}`,color:H.ink},children:n("commands.cancel")}),jsx("button",{type:"submit",disabled:!m,...r.focusProps,style:{...M({disabled:!m,focusRing:r.focusRing}),...jn},children:n("commands.apply")})]})]})})}function zr(e){return e instanceof HTMLElement&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.tagName==="SELECT"||e.tagName==="OPTION")}function Fr(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Tt({children:e,className:t,style:n,testId:o}){let{t:r}=b(),i=C(),u=useRef(null),a=useRef(null),p=useRef(null),s=useRef(new Set),[x,c]=useReducer(v=>v+1,0),[,m]=useReducer(v=>v+1,0),[h,g]=useState(false),[R$1,w]=useState(null),L$1=useRef(false),H=useMemo(()=>({register(v){return s.current.add(v),c(),()=>{s.current.delete(v),c();}},overflowing:()=>L$1.current,changed(){L$1.current&&m();},prompt:w,anchor:()=>a.current?.querySelector("button")??null}),[]),N$1=useCallback(v=>{let z=[];for(let C of s.current){let l=C.element();l&&v.contains(l)&&z.push({element:l,source:C});}return z.sort((C,l)=>Fr(C.element,l.element))},[]),{hidden:M,remeasure:D}=Wn({items:u,more:a,canHide:v=>v.getAttribute("role")==="separator"||_n(v,N$1(v).map(({element:z})=>z)),onFocusHidden:()=>g(true)});useLayoutEffect(()=>{D();},[x,D]),useLayoutEffect(()=>{!h||M.length===0||(g(false),p.current?.focus());},[h,M]),L$1.current=M.length>0,useEffect(()=>{if(M.length!==0)return i.subscribe(m)},[M.length,i]);let A=[];M.forEach((v,z)=>{let C=N$1(v).flatMap(({source:f})=>f.entries());if(C.length===0)return;let l=v.getAttribute("role")==="group"?v.getAttribute("aria-label"):null;A.push({kind:"group",id:`unit-${z}`,label:l??void 0,entries:C});});let $=A.flatMap((v,z)=>z===0?[v]:[{kind:"separator",id:`separator-${z}`},v]);return jsxs("div",{className:t,role:"toolbar","aria-label":r("toolbar.label"),"data-testid":o,onMouseDown:v=>{zr(v.target)||v.preventDefault();},style:{display:"flex",alignItems:"center",minWidth:0,...N,margin:"0 8px 4px",boxSizing:"border-box",...n},children:[jsx(T.Provider,{value:H,children:jsx("div",{ref:u,"data-toolbar-items":"",style:{position:"relative",display:"flex",alignItems:"center",flex:"1 1 auto",minWidth:0,overflow:"hidden"},children:e})}),M.length>0&&jsx("span",{ref:a,style:{display:"inline-flex",flex:"0 0 auto",marginLeft:4},children:jsx(Dn,{ref:p,label:r("toolbar.more"),trigger:jsx(R,{name:"more"}),entries:$,triggerStyle:L,testId:"pptx-toolbar-more",onItemSelected:v=>{v==="pointer"&&y(i)?.focusEditor();}})}),R$1&&jsx(Un,{prompt:R$1,onClose:()=>{w(null),p.current?.focus();}})]})}function pl({label:e,onSelect:t,disabled:n,description:o,checked:r,children:i}){let u=useRef(null),a=useId();return U(u,()=>[{kind:"item",id:a,label:e,checked:r,disabled:n,description:n?o:void 0,onSelect:t}]),jsx("span",{ref:u,style:{display:"inline-flex",alignItems:"center",flex:"0 0 auto"},children:i})}function Yn({children:e}){let{t}=b(),n=V$1(),o=useRef(null),r=useRef(null),i=G(),u=useCallback(w=>{r.current=w,i(w);},[i]),a=useId(),p=t("commands.moreControls"),[s,x]=useState(null),[c,m]=useState(null),[h,g]=useState({});U(o,()=>[{kind:"item",id:a,label:p,onSelect:()=>x({anchor:n?.anchor()??null,width:o.current?.getBoundingClientRect().width??0})}]);let R=useCallback(w=>{let L=s?.anchor;x(null),w&&L?.focus({preventScroll:true});},[s]);return useLayoutEffect(()=>{let w=r.current;if(!s||!w){m(null);return}let L=s.anchor?.getBoundingClientRect(),H=w.offsetWidth,N=Math.max(8,Math.min((L?.right??8)-H,window.innerWidth-H-8));m({top:(L?.bottom??8)+4,left:N}),g(K(s.anchor)),w.querySelector("button, input, select, textarea, a[href], [tabindex]")?.focus();},[s]),useEffect(()=>{if(!s)return;let w=H=>{r.current?.contains(H.target)||R(false);},L=()=>R(false);return document.addEventListener("mousedown",w),window.addEventListener("resize",L),()=>{document.removeEventListener("mousedown",w),window.removeEventListener("resize",L);}},[s,R]),jsxs(T.Provider,{value:null,children:[jsx("span",{ref:o,style:{display:"inline-flex",alignItems:"center",gap:1,flex:"0 0 auto",width:s?s.width:void 0},children:s?null:e}),s&&createPortal(jsx("div",{ref:u,role:"dialog","aria-label":p,tabIndex:-1,onKeyDown:w=>{w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),R(true));},onBlur:w=>{let L=w.relatedTarget;L&&!r.current?.contains(L)&&R(false);},style:{position:"fixed",top:c?.top??0,left:c?.left??0,visibility:c?"visible":"hidden",zIndex:1e4,display:"flex",flexWrap:"wrap",alignItems:"center",gap:2,maxWidth:"calc(100vw - 16px)",...O,...h},children:e}),document.body)]})}var $r={bold:"onFormat",italic:"onFormat",underline:"onFormat",fontFamily:"onFormat",fontSize:"onFormat",fontSizeStep:"onFormat",textColor:"onFormat",alignment:"onFormat",shapeFill:"onShapeFormat",shapeStrokeColor:"onShapeFormat",shapeStrokeWidth:"onShapeFormat",shapeAdjustment:"onShapeFormat",zOrder:"onShapeFormat",insertSlide:"onInsertSlide",insertImage:"onInsertImage",tool:"onToolChange",save:"onSave",exportPng:"onExportPng",undo:"onUndo",redo:"onRedo",zoom:"onZoomChange"},Rt={ok:true,status:"requested"};function Gr(e,t){let n=e.currentFormatting??{},o=e.currentShapeFormatting??{};return {status:"ready",readOnly:false,reviewing:false,pendingInput:false,canUndo:e.canUndo??false,canRedo:e.canRedo??false,slide:{id:"",layoutPartPath:e.currentLayoutPartPath??null},layouts:(e.slideLayouts??[]).map((r,i)=>({args:{layoutPartPath:r.partPath},label:r.label??t("toolbar.layoutOption",{number:i+1})})),text:e.textSelectionActive?{kind:"range",bold:n.bold??false,italic:n.italic??false,underline:n.underline??false,fontFamily:n.fontFamily??null,fontSize:n.fontSize??null,color:n.textColor??null,alignment:n.align??null}:null,shape:e.shapeSelectionActive||e.shapeArrangeActive?{formattable:!!e.shapeSelectionActive,geometry:o.geometry??null,fill:o.fillColor??null,stroke:o.strokeColor??null,strokeWidth:o.strokeWidthPt??null,adjustments:o.adjustments??{},order:null}:null,tool:e.activeTool??"select",zoom:e.zoom??"fit",fontFamilies:e.fontFamilies??r,fontSizes:e.fontSizes??s,proposals:null,hostDisabled:r=>{let i=$r[r];return !!e.disabled||!i||!e[i]},translate:t}}function jr(e,t$1,n){let o=t$1;switch(e){case "bold":case "italic":case "underline":return e;case "fontFamily":return {type:"fontFamily",value:o.family};case "fontSize":return {type:"fontSize",value:o.points};case "fontSizeStep":{let r=n.text&&n.text!=="unsupported"?n.text.fontSize:null;return {type:"fontSize",value:u(r??t,n.fontSizes,o.direction==="increase"?1:-1)}}case "textColor":return {type:"textColor",value:o.color};case "alignment":return {type:"align",value:o.value};default:return null}}function Zr(e,t){let n=t;switch(e){case "shapeFill":return {type:"fillColor",value:n.color};case "shapeStrokeColor":return {type:"strokeColor",value:n.color};case "shapeStrokeWidth":return {type:"strokeWidth",value:n.points};case "shapeAdjustment":return {type:"adjust",name:n.name,value:n.value};case "zOrder":return {type:"zOrder",value:n.value};default:return null}}function Ur(e,t,n,o){let r=jr(t,n,o);if(r)return e.onFormat?.(r),Rt;let i=Zr(t,n);if(i)return e.onShapeFormat?.(i),Rt;let u=n;switch(t){case "insertSlide":e.onInsertSlide?.(u.layoutPartPath);break;case "insertImage":e.onInsertImage?.();break;case "tool":e.onToolChange?.(u.value);break;case "save":e.onSave?.();break;case "exportPng":e.onExportPng?.();break;case "undo":e.onUndo?.();break;case "redo":e.onRedo?.();break;case "zoom":e.onZoomChange?.(u.scale);break}return Rt}function eo(e){let{t}=b(),n=useRef({props:e,t});n.current={props:e,t};let[o]=useState(()=>{let r=x(),i={environment:()=>Gr(n.current.props,n.current.t),ordered:()=>false,admit:u=>Promise.resolve().then(u),perform:(u,a,p)=>Ur(n.current.props,u,a,p),capture:()=>({generation:0}),resume:()=>null,chrome:()=>({i18n:void 0}),focusEditor:()=>{}};return r.attach(i),r});return useLayoutEffect(()=>{o.refresh();}),o.store}function kt(e){return e==="mixed"?void 0:e}function Qn(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Vr(e){let t=s=>e.getState(s),n=(s,x)=>{e.execute(s,x);},o=t("fontFamily"),r=t("fontSize"),i=t("textColor"),u=t("alignment"),a=t("shapeAdjustment").value,p=t("insertSlide");return {currentFormatting:Qn({bold:kt(t("bold").active),italic:kt(t("italic").active),underline:kt(t("underline").active),fontFamily:o.value??void 0,fontSize:r.value??void 0,textColor:i.value??void 0,align:u.value??void 0}),textSelectionActive:t("bold").enabled,onFormat:s=>{typeof s=="string"?n(s,null):s.type==="fontFamily"?n("fontFamily",{family:s.value}):s.type==="fontSize"?n("fontSize",{points:s.value}):s.type==="textColor"?n("textColor",{color:s.value}):n("alignment",{value:s.value});},currentShapeFormatting:Qn({fillColor:t("shapeFill").value,strokeColor:t("shapeStrokeColor").value,strokeWidthPt:t("shapeStrokeWidth").value,adjustments:a?{[a.name]:a.value}:void 0}),shapeSelectionActive:t("shapeFill").enabled,shapeArrangeActive:t("zOrder").enabled,onShapeFormat:s=>{s.type==="fillColor"?n("shapeFill",{color:s.value}):s.type==="strokeColor"?n("shapeStrokeColor",{color:s.value}):s.type==="strokeWidth"?n("shapeStrokeWidth",{points:s.value}):s.type==="adjust"?n("shapeAdjustment",{name:s.name,value:s.value}):n("zOrder",{value:s.value});},onInsertSlide:s=>n("insertSlide",s===void 0?{}:{layoutPartPath:s}),onInsertImage:()=>n("insertImage",null),slideLayouts:(p.options??[]).map(s=>({partPath:s.args.layoutPartPath??null,label:s.label})),currentLayoutPartPath:p.value??null,onSave:()=>n("save",null),onExportPng:()=>n("exportPng",null),onUndo:()=>n("undo",null),onRedo:()=>n("redo",null),canUndo:t("undo").enabled,canRedo:t("redo").enabled,zoom:t("zoom").value??"fit",onZoomChange:s=>n("zoom",{scale:s}),activeTool:t("tool").value??"select",onToolChange:s=>n("tool",{value:s}),fontFamilies:(o.options??[]).map(s=>s.args.family),fontSizes:(r.options??[]).map(s=>s.args.points),disabled:!t("save").enabled}}function to(e){let[t,n]=useReducer(o=>o+1,0);return useEffect(()=>e.subscribe(n),[e]),useMemo(()=>Vr(e),[e,t])}var Xr=["currentFormatting","textSelectionActive","onFormat","currentShapeFormatting","shapeSelectionActive","shapeArrangeActive","onShapeFormat","onInsertSlide","onInsertImage","slideLayouts","currentLayoutPartPath","onSave","onExportPng","onUndo","onRedo","canUndo","canRedo","zoom","onZoomChange","activeTool","onToolChange","fontFamilies","fontSizes","disabled"];function It(e,t){let n=Xr.filter(o=>e[o]!==void 0);if(n.length>0)throw new Error(`${t} in command mode reads state from the editor's commands; remove ${n.join(", ")} or use mode="legacy".`)}function oo(){let{t:e}=b();return jsxs(Fragment,{children:[jsxs(_,{label:e("toolbar.groups.history"),children:[jsx(j,{id:"undo"}),jsx(j,{id:"redo"})]}),jsx($,{}),jsxs(_,{label:e("toolbar.groups.file"),children:[jsx(j,{id:"save"}),jsx(j,{id:"exportPng"})]}),jsx(_,{label:e("toolbar.groups.slides"),children:jsx(ee,{id:"insertSlide"})}),jsx($,{}),jsx(_,{label:e("toolbar.groups.zoom"),children:jsx(ee,{id:"zoom"})}),jsx($,{}),jsxs(_,{label:e("toolbar.groups.tools"),children:[jsx(j,{id:"tool",args:{value:"select"}}),jsx(j,{id:"tool",args:{value:"textBox"}}),jsx(j,{id:"insertImage"}),jsx(Pt,{})]}),jsx($,{}),jsxs(_,{label:e("toolbar.groups.font"),children:[jsx(ee,{id:"fontFamily"}),jsx(j,{id:"fontSizeStep",args:{direction:"decrease"}}),jsx(ee,{id:"fontSize"}),jsx(j,{id:"fontSizeStep",args:{direction:"increase"}})]}),jsx($,{}),jsxs(_,{label:e("toolbar.groups.text"),children:[jsx(j,{id:"bold"}),jsx(j,{id:"italic"}),jsx(j,{id:"underline"}),jsx(ee,{id:"textColor"})]}),jsx($,{}),jsx(_,{label:e("toolbar.groups.alignment"),children:jsx(ee,{id:"alignment"})}),jsx($,{}),jsxs(_,{label:e("toolbar.groups.shape"),children:[jsx(ee,{id:"shapeFill"}),jsx(ee,{id:"shapeStrokeColor"}),jsx(ee,{id:"shapeStrokeWidth"}),jsx(ee,{id:"shapeAdjustment"}),jsx(ee,{id:"zOrder"})]}),jsx(In,{})]})}function qr(e){let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t}function Yr(e){let t=useContext(be),n=t?{...t,...qr(e)}:e,o=eo(n);return jsx(A.Provider,{value:o,children:jsxs(Tt,{className:n.className,style:n.style,testId:"pptx-formatting-toolbar",children:[jsx(oo,{}),n.children?jsx(Yn,{children:n.children}):null]})})}function Jr(e){return It(e,"Toolbar"),jsx(Tt,{className:e.className,style:e.style,testId:"pptx-formatting-toolbar",children:e.children??jsx(oo,{})})}function Mt(e){let t=useContext(ke);return (e.mode??t??"legacy")==="commands"?jsx(Jr,{...e,mode:"commands"}):jsx(Yr,{...e})}var ro={display:"flex",flexDirection:"column",flex:"0 0 auto"};function oi({i18n:e,children:t}){let n=y(C()),o=F(),r=useRef(null);return useLayoutEffect(()=>{let i=r.current;if(!(!i||!n))return n.registerChrome(i)},[n]),jsx("div",{ref:r,style:{display:"contents"},children:jsx(a,{i18n:e??o?.i18n,children:t})})}function ri(e){It(e,"EditorToolbar");let{children:t,className:n,style:o,i18n:r}=e,i=to(C()),u=useContext(fn),a=jsx(ke.Provider,{value:"commands",children:jsx(be.Provider,{value:i,children:jsx("div",{className:n,"data-testid":"pptx-editor-toolbar",style:{...ro,...o},children:t??jsx(Mt,{mode:"commands"})})})});return u?a:jsx(oi,{i18n:r,children:a})}function ii({children:e,className:t,style:n,...o}){return jsx(ke.Provider,{value:"legacy",children:jsx(be.Provider,{value:o,children:jsx("div",{className:t,"data-testid":"pptx-editor-toolbar",style:{...ro,...n},children:e})})})}function ai(e){return e.mode==="commands"?jsx(ri,{...e}):jsx(ii,{...e})}var li=ai;li.Toolbar=Mt;function jl(){let e=C(),t=D("slideshow"),{t:n}=b(),o=X(!t.enabled,t.enabled?void 0:t.disabledReason?.message),r=Q();return jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:()=>{t.enabled&&e.execute("slideshow",null);},...o.props,title:o.reason,"data-testid":"pptx-present",...r.focusProps,style:{...si,opacity:t.enabled?1:I,...J(r.focusRing)},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"})}),n("toolbar.present")]}),o.node]})}var si={display:"inline-flex",alignItems:"center",gap:6,flex:"0 0 auto",margin:"0 12px 0 4px",padding:"0 12px",height:28,border:0,borderRadius:6,background:H.accent,color:H.accentInk,font:"500 13px ui-sans-serif, system-ui, sans-serif",cursor:"pointer"};function Jl({buttonRef:e,count:t}){let n=C(),o=D("proposalsPanel"),{t:r}=b(),i=X(!o.enabled,o.enabled?void 0:o.disabledReason?.message),u=Q();return jsxs(Fragment,{children:[jsxs("button",{ref:e,type:"button","data-testid":"pptx-proposals-button",...i.props,"aria-expanded":o.value??false,title:i.reason,...u.focusProps,style:{...di,...J(u.focusRing)},onClick:()=>{o.enabled&&n.execute("proposalsPanel",null);},children:[r("proposals.title")," ",jsx("span",{"data-testid":"pptx-proposals-count",children:t})]}),i.node]})}var di={display:"inline-flex",alignItems:"center",gap:6,flex:"0 0 auto",margin:"0 0 0 4px",padding:"0 10px",height:28,border:`1px solid ${H.line}`,borderRadius:6,background:H.surface,color:H.ink,font:"500 13px ui-sans-serif, system-ui, sans-serif",cursor:"pointer",boxSizing:"border-box"};var At=new WeakMap;function Ot(e,t){At.has(e)||At.set(e,t);}function so(e){return At.get(e)??null}var Qe={"data-pptx-plugin-chrome":""};function ts(e){return e instanceof Element&&e.closest("[data-pptx-plugin-chrome]")!==null}var gi=Object.values(c).flatMap(e=>e.shortcuts.map(t=>({id:e.id,shortcut:t}))),hi=new Set(["save"]),xi=new Set(["undo","redo"]);function uo(e){let n=(e instanceof Element?e:null)?.closest("input, textarea, select, [contenteditable]");return !!n&&n.getAttribute("contenteditable")!=="false"}function as({commands:e,containerRef:t,editorInput:n,suspended:o}){let r=useRef(o);r.current=o,useEffect(()=>{let i$1=a=>{let p=so(a);if(p)return e.ownsStore(p);let s=a.target;return s instanceof Node&&(t.current?.contains(s)??false)||e.ownsChrome(s)},u=a=>{if(a.defaultPrevented||a.isComposing||a.keyCode===229||!i$1(a)||r.current())return;let p=gi.find(({shortcut:m})=>i(m.chord,a));if(!p){let m=e.pluginShortcuts().find(({chord:h})=>i(h,a));if(!m||uo(a.target)&&a.target!==n?.current)return;a.preventDefault(),a.repeat||e.store.execute(m.id,null);return}let{id:s,shortcut:x}=p;if(uo(a.target)&&!hi.has(s))return;let c=e.store.getState(s,x.args);!c.enabled&&c.disabledReason.code==="host-disabled"||(a.preventDefault(),!(a.repeat&&!xi.has(s))&&e.store.execute(s,x.args));};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u);}},[e,t,n]);}var Dt=class extends Component{constructor(){super(...arguments);a$1(this,"state",{failed:false});}static getDerivedStateFromError(){return {failed:true}}componentDidCatch(n){this.props.onError(n);}render(){return this.state.failed?null:this.props.children}};function et({host:e,activation:t,phase:n="render",claimPointerEvents:o=false,children:r}){let i=e.commandStore(t),u=o?a=>Ot(a.nativeEvent,i):void 0;return jsx(Dt,{onError:a=>e.fail(t.pluginId,n,a),children:jsx(A.Provider,{value:i,children:jsx("div",{style:{display:"contents"},onKeyDownCapture:a=>Ot(a.nativeEvent,i),onPointerDownCapture:u,onPointerMoveCapture:u,onPointerUpCapture:u,onPointerCancelCapture:u,onLostPointerCaptureCapture:u,children:r})})})}function hs({host:e,activations:t,layerRef:n,claimPointerEvents:o}){return jsx("div",{ref:n,...Qe,className:"pptx-plugin-overlays","data-testid":"plugin-overlays",style:{position:"absolute",inset:0,pointerEvents:"none",overflow:"visible"},children:t.map(r=>{let i=r.plugin.overlay,u=r.context.geometry;return i&&u?jsx(et,{host:e,activation:r,claimPointerEvents:o,children:jsx(i,{context:r.context,geometry:u})},r.key):null})})}var yi={left:280,right:280,bottom:200},Nt={left:160,right:160,bottom:120},vi=640,ae={surface:"#ffffff",border:"#e2e8f0",text:"#172033",muted:"#647087",selected:"#e8f0fe",primary:"#1a73e8"};function Si(e,t,n){let o=e==="bottom"?n.height:n.width,r=Math.max(Nt[e],Math.floor(o*.4));return Math.max(Nt[e],Math.min(t??yi[e],r))}function mo(e=true){let t=useRef(null),[n,o]=useState({width:0,height:0});return useEffect(()=>{let r=t.current;if(!e||!r)return;let i=()=>o(a=>a.width===r.clientWidth&&a.height===r.clientHeight?a:{width:r.clientWidth,height:r.clientHeight});if(i(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(i);return u.observe(r),()=>u.disconnect()},[e]),[t,n]}var Cs=mo;function Ci({host:e,activation:t,id:n,labelledBy:o}){let[r,i]=mo(),u=t.plugin.panel.render;return jsx("div",{ref:r,id:n,role:"tabpanel","aria-labelledby":o,className:"pptx-plugin-dock__panel",style:{flex:1,minHeight:0,minWidth:0,overflow:"auto"},children:jsx(et,{host:e,activation:t,children:jsx(u,{context:t.context,width:i.width,height:i.height})})})}var wi=e=>({maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"4px 8px",border:0,borderRadius:4,background:e?ae.selected:"transparent",color:e?ae.primary:ae.muted,font:"12px ui-sans-serif, system-ui, sans-serif",cursor:"pointer"}),co={flex:"0 0 auto",padding:"0 6px",border:0,borderRadius:4,background:"transparent",color:ae.muted,font:"13px ui-sans-serif, system-ui, sans-serif",cursor:"pointer"};function ws({host:e,placement:t,activations:n,available:o}){let{t:r}=b(),i=useId(),[u,a]=useState(null),[p,s]=useState({}),[x,c]=useState(false),m=useRef(null),h=useRef(null),g=t!=="bottom"&&o.width>0&&o.width<vi,R=g&&x&&n.length>0;if(useEffect(()=>{R&&h.current?.focus();},[R]),n.length===0)return null;let w=n.find(E=>E.pluginId===u)??n[0],L=w.plugin.panel,H=g?!R:p[w.pluginId]??L.defaultCollapsed??false,N=Si(t,L.preferredSize,o),M=E=>`${i}-tab-${E}`,D=`${i}-panel`,A=E=>m.current?.querySelector(`[data-plugin-tab="${E}"]`)?.focus(),$=E=>{g?c(!(R&&E===w.pluginId)):E===w.pluginId&&H&&s(_=>({..._,[E]:false})),a(E);},v=()=>{c(false),A(w.pluginId);},z=E=>{let _=n.findIndex(P=>P.pluginId===w.pluginId),q=n.length-1,W=E.key==="ArrowRight"||E.key==="ArrowDown"?_===q?0:_+1:E.key==="ArrowLeft"||E.key==="ArrowUp"?_===0?q:_-1:E.key==="Home"?0:E.key==="End"?q:null;if(W===null)return;E.preventDefault();let d=n[W].pluginId;a(d),A(d);},C=r(H?"plugins.expandPanel":"plugins.collapsePanel",{title:L.title}),l=t==="bottom",f=g||!l&&H,b$1=jsx(Ci,{host:e,activation:w,id:D,labelledBy:M(w.pluginId)},w.key);return jsxs("section",{...Qe,className:`pptx-plugin-dock pptx-plugin-dock--${t}`,"data-testid":`plugin-dock-${t}`,"aria-label":r("plugins.panelTabs"),style:{position:"relative",display:"flex",flexDirection:"column",flexShrink:0,minWidth:0,minHeight:0,background:ae.surface,color:ae.text,...l?{height:H?void 0:N,borderTop:`1px solid ${ae.border}`}:{width:H||g?void 0:N,maxWidth:H||g?96:void 0,[t==="left"?"borderRight":"borderLeft"]:`1px solid ${ae.border}`}},children:[jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,padding:4,flexWrap:"wrap"},children:[jsx("div",{ref:m,role:"tablist","aria-label":r("plugins.panelTabs"),"aria-orientation":f?"vertical":"horizontal",onKeyDown:z,style:{display:"flex",flexDirection:f?"column":"row",gap:2,flex:1,minWidth:0,overflow:"hidden"},children:n.map(E=>{let _=E.pluginId===w.pluginId;return jsx("button",{type:"button",role:"tab",id:M(E.pluginId),"data-plugin-tab":E.pluginId,"aria-selected":_,"aria-controls":_&&!H?D:void 0,"aria-expanded":g?_&&R:void 0,tabIndex:_?0:-1,title:E.plugin.panel.title,onClick:()=>$(E.pluginId),style:wi(_),children:E.plugin.panel.title},E.pluginId)})}),!g&&jsx("button",{type:"button","aria-expanded":!H,"aria-label":C,title:C,onClick:()=>s(E=>({...E,[w.pluginId]:!H})),style:co,children:H?"+":"\u2212"})]}),!H&&!g&&b$1,R&&jsxs("div",{ref:h,tabIndex:-1,"data-testid":`plugin-drawer-${t}`,onKeyDown:E=>{E.key==="Escape"&&(E.stopPropagation(),v());},style:{position:"absolute",top:0,bottom:0,[t==="left"?"left":"right"]:"100%",width:Math.min(N,Math.max(Nt[t],o.width-64)),zIndex:60,display:"flex",flexDirection:"column",background:ae.surface,boxShadow:"0 4px 16px rgba(15, 23, 42, 0.18)",outline:"none"},children:[jsx("div",{style:{display:"flex",justifyContent:"flex-end",padding:4},children:jsx("button",{type:"button","aria-label":C,title:C,onClick:v,style:co,children:"\xD7"})}),b$1]})]})}var go=new WeakMap,Ei=/^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,126}[A-Za-z0-9])?$/,Ti=new Set(["left","right","bottom"]),ho=e=>e!==null&&typeof e=="object"?Object.freeze({...e}):e;function Ri(e){return Array.isArray(e?.shortcuts)?Object.freeze({...e,shortcuts:Object.freeze([...e.shortcuts])}):ho(e)}function ks(e){let t={...e};t.panel!==void 0&&(t.panel=ho(t.panel)),Array.isArray(t.commands)&&(t.commands=Object.freeze(t.commands.map(Ri))),Array.isArray(t.toolbar)&&(t.toolbar=Object.freeze([...t.toolbar]));let n=Object.freeze(t),o=Object.freeze(n.revision===void 0?{id:n.id}:{id:n.id,revision:n.revision});return go.set(o,n),o}function xo(e){return e!==null&&typeof e=="object"?go.get(e)??null:null}function fo(e){return typeof e=="function"||e!==null&&typeof e=="object"}var ki=/^f([1-9]|1[0-2])$/i;function Ii(e){let t=f(e);if(t===null)return false;let n=t.split("+"),o=n[n.length-1];return n.includes("Mod")||n.includes("Alt")||ki.test(o)}function Bt(e){return e===void 0||typeof e=="function"}function bo(e){if(typeof e.createState!="function")return new TypeError("createState must be a function");if(!Bt(e.initialize)||!Bt(e.onEvent))return new TypeError("initialize and onEvent must be functions");if(e.overlay!==void 0&&!fo(e.overlay))return new TypeError("overlay must be a component");let t=e.panel;if(t!==void 0&&(typeof t?.title!="string"||!Ti.has(t.placement)||!fo(t.render)||t.preferredSize!==void 0&&!(Number.isFinite(t.preferredSize)&&t.preferredSize>0)))return new TypeError("panel needs a title, a left, right or bottom placement and a renderer");let n=e.commands??[];if(!Array.isArray(n))return new TypeError("commands must be an array");let o=new Set;for(let i of n){if(!Ei.test(i?.id??""))return new TypeError(`Invalid command id ${JSON.stringify(i?.id)}`);if(o.has(i.id))return new TypeError(`Duplicate command id "${i.id}"`);if(o.add(i.id),typeof i.label!="string"||typeof i.mutatesDocument!="boolean"||typeof i.execute!="function"||!Bt(i.getState))return new TypeError(`Command "${i.id}" needs a label, mutatesDocument and execute`);let u=i.shortcuts??[];if(!Array.isArray(u)||u.some(a=>!Ii(a)))return new TypeError(`Command "${i.id}" has an invalid shortcut`)}let r=e.toolbar??[];return !Array.isArray(r)||r.some(i=>!o.has(i))?new TypeError("toolbar may only list the plugin\u2019s own command ids"):null}function As(e){return e!==void 0&&Number.isFinite(e)&&e>0?Math.min(q,Math.max(p,e)):"fit"}var Mi={open:["editor.openError","editor.openErrorDescription"],stopped:["editor.stoppedError","editor.stoppedErrorDescription"],load:["editor.loadError","editor.loadErrorDescription"]},Ai={position:"absolute",inset:0,zIndex:3,justifyContent:"center",padding:24,background:"#ffffff"},Oi={position:"absolute",left:0,right:0,bottom:0,zIndex:3,padding:"10px 16px",borderTop:"1px solid #e0e0e0",background:"#fafafa"},yo={marginTop:4,padding:"6px 16px",border:"1px solid #dadce0",borderRadius:6,background:"#ffffff",color:"#202124",font:"inherit",cursor:"pointer"};function Ds({kind:e,details:t,onReload:n,children:o,className:r,style:i}){let{t:u}=b(),[a,p]=Mi[e];return jsxs("div",{"data-testid":"pptx-error","data-failure":e,role:"alert",className:r,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,boxSizing:"border-box",textAlign:"center",color:"#202124",font:"14px ui-sans-serif, system-ui, sans-serif",...e==="stopped"?Oi:Ai,...i},children:[jsx("strong",{style:{fontSize:e==="stopped"?14:16,fontWeight:600},children:u(a)}),jsx("span",{style:{maxWidth:420,color:"#5f6368"},children:u(p)}),n&&jsx("button",{type:"button",onClick:n,style:yo,children:u("editor.reloadPage")}),o,t&&jsxs("details",{style:{maxWidth:480,color:"#5f6368",fontSize:12},children:[jsx("summary",{style:{cursor:"pointer"},children:u("editor.showDetails")}),jsx("pre",{style:{margin:"8px 0 0",whiteSpace:"pre-wrap",wordBreak:"break-word",textAlign:"start"},children:t})]})]})}var zs=yo;var Ns=["nw","n","ne","e","se","s","sw","w"];var Li=Math.fround(Math.fround(Math.PI)/180);function Bs(e,t,n,o){if(!Number.isFinite(e.width)||!Number.isFinite(e.height)||e.width<=0||e.height<=0)return null;let r=(n-e.left)*t.width/e.width,i=(o-e.top)*t.height/e.height;return Number.isFinite(r)&&Number.isFinite(i)?{x:r,y:i}:null}function ze(e,t){for(let n of e){if(n.id===t)return n;let o=ze(n.children,t);if(o)return o}return null}function Ks(e){let t=new Map,n=[...e];for(;n.length>0;){let o=n.pop();t.set(o.id,o),n.push(...o.children);}return t}function _s(e,t){for(let n of e.shapes)if(n.id===t||ze(n.children,t))return n;return null}function Ws(e,t){return !!(e&&e.id===t.slideId&&ze(e.shapes,t.shapeId))}function $s(e,t){return e?.pointerId===t}function ot(e){if(e.width>0&&e.height>0)return {x:e.x,y:e.y,width:e.width,height:e.height};let t=e.inherited;return !t||t.width<=0||t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}}function Di(e){return ot(e)!==null}function zi(e){let n=((e.inherited?.rotationDeg??e.rotationDeg)%360+360)%360,o=e.inherited?.flipH??e.flipH,r=e.inherited?.flipV??e.flipV;return Di(e)&&n===0&&!o&&!r}function Gs(e,t,n){let o=Kt(t,n);if(o)return o;let r=ot(n);return !r||e.widthEmu<=0||e.heightEmu<=0?null:{x:r.x*t.width/e.widthEmu,y:r.y*t.height/e.heightEmu,width:r.width*t.width/e.widthEmu,height:r.height*t.height/e.heightEmu}}function Kt(e,t){let n=new Set;Eo(t,n);let o=e.primitives.filter(s=>s.shapeId&&n.has(s.shapeId));if(o.length===0)return null;let r=o.map(s=>{let x=(s.transform?.rotationDeg??0)*Math.PI/180,c=Math.abs(s.w*Math.cos(x))+Math.abs(s.h*Math.sin(x)),m=Math.abs(s.w*Math.sin(x))+Math.abs(s.h*Math.cos(x));return {x:s.x+(s.w-c)/2,y:s.y+(s.h-m)/2,width:c,height:m}}),i=Math.min(...r.map(s=>s.x)),u=Math.min(...r.map(s=>s.y)),a=Math.max(...r.map(s=>s.x+s.width)),p=Math.max(...r.map(s=>s.y+s.height));return {x:i,y:u,width:a-i,height:p-u}}function js(e,t,n,o){let r=e.primitives.find(c=>c.kind==="textBox"&&c.shapeId===t&&c.storyId===n);if(!r||r.lines.length===0)return null;let i=So(r,o),u=wo(r),a=0;for(let c=1;c<r.lines.length;c+=1){let m=r.lines[c],h=r.lines[a];nt(m,i,u)<nt(h,i,u)&&(a=c);}let p=r.lines[a],s=p.caretStops[0];return s?{position:p.caretStops.reduce((c,m)=>Math.abs(m.x-i.x)<Math.abs(c.x-i.x)?m:c,s).position,lineIndex:a}:{position:p.start,lineIndex:a}}function Fi(e,t){let n={x:Math.fround(t.x),y:Math.fround(t.y)};for(let o=e.primitives.length-1;o>=0;o-=1){let r=e.primitives[o];if(!r.shapeId)continue;let i=Co(r,n);if(i)return r.kind==="textBox"&&r.storyId&&Hi(r,i)?"text":"shape"}return null}function So(e,t){let n=e.transform;if(!n||!n.rotationDeg&&!n.flipH&&!n.flipV)return t;let o=Math.fround,r=o(o(e.x)+o(o(e.w)/2)),i=o(o(e.y)+o(o(e.h)/2)),u=o(o(n.rotationDeg??0)*Li),a=o(Math.cos(u)),p=o(Math.sin(u)),s=o(t.x-r),x=o(t.y-i),c=o(o(s*a)+o(x*p)),m=o(o(x*a)-o(s*p));return n.flipH&&(c=-c),n.flipV&&(m=-m),{x:o(r+c),y:o(i+m)}}function vo(e,t){return Math.fround(Math.fround(e)+Math.fround(t))}function Co(e,t){let n=So(e,t);return n.x>=Math.fround(e.x)&&n.x<=vo(e.x,e.w)&&n.y>=Math.fround(e.y)&&n.y<=vo(e.y,e.h)?n:null}function wo(e){return e.lines.some((t,n)=>n>0&&(t.columnOffset??0)!==(e.lines[n-1].columnOffset??0))}function nt(e,t,n){let o=Math.max(e.x-t.x,t.x-e.x-e.width,0),r=Ni(e.y,e.height,t.y);return n?o*o+r*r:r}function Hi(e,t){if(e.lines.length===0)return false;let n=wo(e);return e.lines.reduce((r,i)=>nt(i,t,n)<nt(r,t,n)?i:r).caretStops.length>0}function Zs(e,t,n,o){let r=ot(n);return r?{...r,x:r.x+Math.round(o.x*e.widthEmu/t.width),y:r.y+Math.round(o.y*e.heightEmu/t.height)}:null}function Us(e,t,n,o,r=4){return Math.hypot(n-e,o-t)>=r}function Eo(e,t){t.add(e.id);for(let n of e.children)Eo(n,t);}function Ni(e,t,n){return n<e?e-n:n>e+t?n-e-t:0}function Vs(e,t){let n=t.includes("w")?e.x:t.includes("e")?e.x+e.width:e.x+e.width/2,o=t.startsWith("n")?e.y:t.startsWith("s")?e.y+e.height:e.y+e.height/2;return {x:n,y:o}}function Xs(e){return e==="nw"||e==="se"?"nwse-resize":e==="ne"||e==="sw"?"nesw-resize":e==="n"||e==="s"?"ns-resize":"ew-resize"}function Bi(e,t,n,o,r=false){if(r&&t.length===2&&e.width>0&&e.height>0){let s=t.includes("w")?-n.x:n.x,x=t.startsWith("n")?-n.y:n.y,c=Math.max(1+(s*e.width+x*e.height)/(e.width**2+e.height**2),o/e.width,o/e.height),m=Math.round(e.width*c),h=Math.round(e.height*c);return {x:t.includes("w")?e.x+e.width-m:e.x,y:t.startsWith("n")?e.y+e.height-h:e.y,width:m,height:h}}let{x:i,y:u,width:a,height:p}=e;if(t.includes("w")){let s=Math.min(n.x,a-o);i+=s,a-=s;}else t.includes("e")&&(a=Math.max(o,a+n.x));if(t.startsWith("n")){let s=Math.min(n.y,p-o);u+=s,p-=s;}else t.startsWith("s")&&(p=Math.max(o,p+n.y));return {x:i,y:u,width:a,height:p}}function qs(e,t,n){return n?{x:n.x-e.x,y:n.y-e.y}:t}function Ki(e,t,n,o,r){if(!zi(n))return null;let i={x:Math.round(r.x*e.widthEmu/t.width),y:Math.round(r.y*e.heightEmu/t.height)},u=ot(n);if(!u)return null;let a=Bi(u,o,i,76200,n.aspectRatioLocked);return {x:a.x,y:a.y,width:a.width,height:a.height}}function Ys(e,t,n,o,r){let i=Ki(e,t,n,o,r);return !i||e.widthEmu<=0||e.heightEmu<=0?null:{x:i.x*t.width/e.widthEmu,y:i.y*t.height/e.heightEmu,width:i.width*t.width/e.widthEmu,height:i.height*t.height/e.heightEmu}}function Js(e,t,n=1){let o=Fi(e,t);if(o!=="text")return o;let r={x:Math.fround(t.x),y:Math.fround(t.y)};for(let i=e.primitives.length-1;i>=0;i-=1){let u=e.primitives[i];if(!u.shapeId)continue;let a=Co(u,r);if(a)return _i(u,a,n)?"shape":"text"}return o}function _i(e,t,n){let o=Number.isFinite(n)&&n>0?n:1,r=Math.min(6/o,e.w/3,e.h/3);return t.x-e.x<=r||e.x+e.w-t.x<=r||t.y-e.y<=r||e.y+e.h-t.y<=r}var Wi=Object.freeze({commands:Object.freeze([])});function To(e){if(!e||typeof e!="object")return Wi;let t=Array.isArray(e.commands)?[...new Set(e.commands.filter(n=>typeof n=="string"))].sort():[];return e.document!=="write"?Object.freeze({commands:Object.freeze(t)}):Object.freeze({commands:Object.freeze(t),document:"write",...e.editBatches===true?{editBatches:true}:{},...e.untrackedHistory===true?{untrackedHistory:true}:{}})}function Ro(e,t){let n=e.commands??[],o=t.commands??[];return e.document===t.document&&e.editBatches===t.editBatches&&e.untrackedHistory===t.untrackedHistory&&n.length===o.length&&n.every((r,i)=>r===o[i])}function ko(e,t){return e.commands?.includes(t)??false}function Io(e){return e.document==="write"}function _t(e,t){return e.document==="write"&&e.editBatches===true&&(t!=="none"||e.untrackedHistory===true)}var $i=/^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,126}[A-Za-z0-9])?$/;function Gi(e){return typeof e=="string"&&$i.test(e)}function Mo(e){return e.revision===void 0?"":`${typeof e.revision}:${e.revision}`}var Ao=10;function Wt(e){return e.type==="load"?"document-change":e.type}function ji(e){return e!==null&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function $t(e){let t=new AbortController;if(e.aborted)return t.abort(),{controller:t,release:()=>{}};let n=()=>t.abort();return e.addEventListener("abort",n,{once:true}),{controller:t,release:()=>e.removeEventListener("abort",n)}}function Oo(e){let t=new Map,n=null,o=false,r={},i=new Map,u=new WeakSet,a=new Set,p=new Set,s=0,x=0,c=null,m=[],h=false,g=new Set,R=()=>!h&&[...t.values()].every(({activation:d})=>!d||d.status==="disposed"||d.status==="ready"&&!d.running&&!d.pumping&&!d.pending.length),w=()=>{if(!(!g.size||!R())){for(let d of g)d();g.clear();}},L=d=>{try{e.report(d);}catch(P){console.error("[plugins] onPluginError threw",P);}},H=d=>{let P=Object.hasOwn(r,d)?r[d]:void 0,k=i.get(d);if(k&&k.source===P)return k.grant;let y=To(P);return i.set(d,{source:P,grant:y}),y},N=d=>{let P=`${s}:${d.stateRevision}`;if(d.rendered?.key===P)return d.rendered.entry;let k=C(d,d.lifetime.signal),y={pluginId:d.registration.id,plugin:d.registration.plugin,generation:d.generation,activation:d.token,key:d.key,context:e.context(k,d.registration.plugin)};return d.rendered={key:P,entry:y},y},M=()=>{h=false;let d=[];for(let k of t.values()){let y=k.activation;y?.status==="ready"&&d.push(N(y));}d.length===m.length&&d.every((k,y)=>k===m[y])||(m=d);for(let k of [...p])k();w();},D=()=>{s+=1,!h&&(h=true,queueMicrotask(M));},A=(d,P)=>d.status==="disposed"?d.ended==="document-replaced"?"document-replaced":"plugin-unavailable":P.aborted?"aborted":null,$=(d,P,k)=>{let y=I=>L({pluginId:d.registration.id,generation:d.generation,phase:"cleanup",error:I});try{let I=P(k);ji(I)&&I.then(void 0,y);}catch(I){y(I);}},v=(d,P)=>{if(d.status!=="disposed"){d.status="disposed",d.ended=P,d.pending=[],d.registration.activation===d&&(d.registration.activation=null),d.lifetime.abort();for(let k of d.cleanups.splice(0).reverse())$(d,k,P);D();}},z=(d,P,k)=>{d.status!=="disposed"&&(d.registration.quarantined=true,L({pluginId:d.registration.id,generation:d.generation,phase:P,error:k}),v(d,"failed"));};function C(d,P){let k=e.snapshot(d.registration.id,d.generation);return {pluginId:d.registration.id,activation:d.token,snapshot:k,signal:P,lifetimeSignal:d.lifetime.signal,state:()=>d.state,setState(I,T){if(A(d,P)!==null)return false;let K=e.currentVersion();return K===null||(T??k.version)!==K?false:(d.state=typeof I=="function"?I(d.state):I,d.stateRevision+=1,D(),true)},onCleanup(I){if(typeof I!="function")throw new TypeError("A cleanup must be a function");d.status==="disposed"?$(d,I,d.ended??"unmounted"):d.cleanups.push(I);},run:I=>l(d,I),commit(I){let T=c;c=P;try{return I()}finally{c=T;}},refusal:()=>A(d,P)}}async function l(d,P){let{controller:k,release:y}=$t(d.lifetime.signal);if(!k.signal.aborted)try{await P(C(d,k.signal));}catch(I){k.signal.aborted||z(d,"action",I);}finally{y();}}async function f(d,P,k,y){let{controller:I,release:T}=$t(d.lifetime.signal);d.running={channel:k,controller:I};try{let K=C(d,I.signal);return await y(e.context(K,d.registration.plugin),K),d.status==="disposed"?"ended":I.signal.aborted?"aborted":"ok"}catch(K){return d.status==="disposed"?"ended":I.signal.aborted?"aborted":(z(d,P,K),"ended")}finally{T(),d.running?.controller===I&&(d.running=null);}}async function b(d){if(!d.pumping){d.pumping=true;try{for(;d.status==="ready";){let P=d.pending.shift();if(!P)break;if(!d.registration.plugin.onEvent)continue;if(await f(d,"event",Wt(P),y=>d.registration.plugin.onEvent?.(y,P))==="ended")break}}finally{d.pumping=false,w();}}}let E=(d,P)=>{if(d.status==="disposed"||P.generation!==d.generation)return;let k=Wt(P),y=d.pending.findIndex(T=>Wt(T)===k);if(y>=0){if(d.pending[y].type==="load")return;d.pending[y]=P;}else d.pending.push(P);let I=d.running;I?.channel===k&&I.controller.signal!==c&&I.controller.abort(),d.status==="ready"&&queueMicrotask(()=>{b(d);});};async function _(d,P,k){x+=1;let y={token:Object.freeze({}),key:`${d.id}#${x}`,registration:d,generation:P,lifetime:new AbortController,status:"initializing",ended:null,state:void 0,stateRevision:0,cleanups:[],pending:[],running:null,pumping:false,rendered:null};d.activation=y;try{y.state=d.plugin.createState();}catch(T){z(y,"initialize",T);return}if(d.plugin.initialize&&await f(y,"initialize","initialize",K=>y.registration.plugin.initialize?.(K))==="ended")return;let I="aborted";for(let T=0;I==="aborted"&&y.status!=="disposed";T+=1){if(T===Ao){z(y,"event",new Error(`Document changes superseded the load hook ${Ao} times`));return}y.pending=[],I=await f(y,"event","document-change",(K,Y)=>y.registration.plugin.onEvent?.(K,e.loadEvent(Y.snapshot,k)));}I!=="ok"||y.status==="disposed"||(y.status="ready",D(),b(y));}let q=(d,P)=>L({pluginId:d,generation:n,phase:"definition",error:P}),W=d=>{n=null,d==="unmounted"&&(o=false);for(let P of t.values())P.activation&&v(P.activation,d);D();};return {setPlugins(d){let P=new Map;for(let T of d){let K=Gi(T?.id)?e.validate?.(T):new TypeError(`Invalid plugin id ${JSON.stringify(T?.id)}`);if(K!=null){T&&typeof T=="object"&&!u.has(T)&&(u.add(T),q(typeof T.id=="string"?T.id:"",K));continue}let Y=P.get(T.id);Y?Y.push(T):P.set(T.id,[T]);}let k=new Set,y=new Map,I=[];for(let[T,K]of P){if(K.length>1){k.add(T),a.has(T)||q(T,new Error(`${K.length} plugins share the id "${T}"`));continue}let Y=K[0],oe=t.get(T);if(oe&&Mo(oe.plugin)===Mo(Y)){oe.plugin=Y,y.set(T,oe);continue}oe&&I.push([oe,"definition-replaced"]),y.set(T,{id:T,plugin:Y,quarantined:false,activation:null});}a=k;for(let[T,K]of t)y.has(T)||I.push([K,"removed"]);t=y;for(let[T,K]of I)T.activation&&v(T.activation,K);if(n!==null)for(let T of t.values())!T.activation&&!T.quarantined&&_(T,n,"attached");D();},setGrants(d){let P=new Map([...t.keys()].map(y=>[y,H(y)]));r=d??{},i.clear();let k=false;for(let y of t.values()){let I=H(y.id),T=P.get(y.id);if(Ro(T,I)){i.get(y.id).grant=T;continue}k=true;let K=y.activation;K&&E(K,e.grantsEvent(e.snapshot(y.id,K.generation),I));}k&&D();},grant:H,open(d){if(n===d)return;n!==null&&W("document-replaced"),n=d;let P=o?"replaced":"loaded";o=true;for(let k of t.values())k.quarantined=false,_(k,d,P);D();},close:W,generation:()=>n,notify(d){if(d.generation===n){for(let P of t.values())P.activation&&E(P.activation,d);D();}},notificationsIdle(){return R()?Promise.resolve():new Promise(d=>g.add(d))},touch:D,activations:()=>m,subscribe(d){return p.add(d),()=>{p.delete(d);}},guard(d,P,k,y){let I=t.get(d)?.activation;if(I?.status!=="ready")return y;try{return k(N(I).context)}catch(T){return queueMicrotask(()=>z(I,P,T)),y}},async invoke(d,P,k){let y=t.get(d)?.activation;if(y?.status!=="ready")return {ok:false,reason:"plugin-unavailable"};let{controller:I,release:T}=$t(y.lifetime.signal),K=C(y,I.signal);try{return {ok:!0,value:await k(e.context(K,y.registration.plugin))}}catch(Y){let oe=K.refusal();return oe?{ok:false,reason:oe}:(z(y,P,Y),{ok:false,reason:"failed"})}finally{T();}},fail(d,P,k){let y=t.get(d)?.activation;y&&z(y,P,k);}}}var Zi={"plugin-unavailable":"The plugin is no longer active","document-replaced":"The presentation was replaced",aborted:"This plugin context was superseded","permission-denied":"The host has not granted this operation","read-only":"The editor is read-only","input-failed":"Pending input could not be applied","unsupported-policy":"Plugins cannot run this operation yet","plugin-failed":"The plugin failed"},Ui={"stale-version":"The presentation changed after that version","missing-target":"The target is not in the presentation","ambiguous-target":"The target does not identify one object","layout-unavailable":"The slide cannot be shown",unsupported:"The editor cannot show this target now"};function Fe(e,t=Zi[e]){return {ok:false,failure:{code:e,message:t}}}function Ce(e){let t=e.refusal();return t?Fe(t):null}function Gt(e,t,n){return {deny(o){let r=e.refusal();if(r)return r;if(d(o))return o.startsWith(`plugin:${e.pluginId}/`)?null:"permission-denied";let i=t();return !ko(i,o)||c[o].mutatesDocument&&!Io(i)?"permission-denied":null},subscribe:n}}function Vi(e,t,n){return !n()&&e.some(o=>o.aborted)?Promise.resolve(null):new Promise((o,r)=>{let i=()=>{n()||(u(),o(null));},u=()=>{for(let a of e)a.removeEventListener("abort",i);};for(let a of e)a.addEventListener("abort",i,{once:true});t.then(a=>{u(),o(a);},a=>{u(),r(a);});})}function Lo(e,t,n,o){let r=async c=>{let m=Ce(e);if(m)return m;let h=t.handle();if(!h)return Fe("plugin-unavailable");let g=false,R=await Vi([e.signal,e.lifetimeSignal],t.admit(h,()=>{let w=Ce(e);return w?{refused:w}:(g=true,{value:c(h)})}),()=>g);return R?R.ok?"refused"in R.value?R.value.refused:R.value.value:Ce(e)??Fe(R.code):Ce(e)??Fe("aborted")},i={version:()=>r(c=>({ok:true,version:c.version()})),readContent:c=>r(m=>m.readContent(c)),findText:c=>r(m=>m.findText(c)),validateEdits:c=>r(m=>t.readOnlyRefusal(m)??m.validateEdits(c))},u=c=>Ce(e)??(_t(n(),c)?null:Fe("permission-denied")),a=_t(n(),"separate")?{async applyEdits(c){let m=u(c.history);return m||r(h=>t.applyEdits(h,c,()=>u(c.history),g=>e.commit(g)))}}:null,p={getDescriptor:c=>o.getDescriptor(c),getState:(c,m)=>o.getState(c,m),subscribe:c=>o.subscribe(c),execute:async(c,m)=>Ce(e)??o.execute(c,m)},s=async(c,m)=>{let h=await r(g=>g.version()===c?.expectVersion?m(g,c.focus===true):"stale-version");return h===null?{ok:true}:typeof h=="object"?h:{ok:false,failure:{code:h,message:Ui[h]}}};return {read:i,commands:p,edits:a,navigation:{goToSlide:(c,m)=>s(m,(h,g)=>t.navigator.goToSlide(h,c,g)),selectShape:(c,m)=>s(m,(h,g)=>t.navigator.selectShape(h,c,g)),selectText:(c,m)=>s(m,(h,g)=>t.navigator.selectText(h,c,g))}}}function jt(e,t){return e?.scoped(t)??z}var Xi=Object.freeze({enabled:true});function qi(e){let t=e;if(!t||typeof t.enabled!="boolean")throw new TypeError("A command getState must return a CommandState");if(!t.enabled&&(typeof t.disabledReason?.code!="string"||typeof t.disabledReason.message!="string"))throw new TypeError("A disabled command state needs a disabledReason");return e}function Yi(e){let t=e;return t&&typeof t.ok=="boolean"?e:{ok:true,status:"executed"}}function Ji(e,t){return e===t||!!e&&!!t&&e.id===t.id&&e.version===t.version}function rt(e){try{return e.version()}catch{return null}}function mu(e,t){let n=t??((l,f,b)=>{if(!("handle"in e))throw new TypeError("Plugin clients require document access");return Lo(l,e,f,b)}),o,r=null,i=null,u=false,a=0,p=null,s={version:"",readOnly:false,selection:null,layout:null},x=new WeakMap,c=new WeakMap,m$1=0,h$1=l=>{let f=c.get(l);return f===void 0&&(m$1+=1,f=m$1,c.set(l,f)),f},g$1=new WeakSet,R=new Set,w=l=>{if(!o){console.error(`[PptxEditor] plugin "${l.pluginId}" failed (${l.phase})`,l.error);return}try{o(l);}catch(f){console.error("[PptxEditor] onPluginError threw",f);}},L=()=>e.commands(),H=l=>{let f=()=>M.grant(l.pluginId);if(l.signal!==l.lifetimeSignal)return Gt(l,f,M.subscribe);let b=x.get(l.activation);return b||(b=Gt(l,f,M.subscribe),x.set(l.activation,b)),b},N=l=>{let f=l.pluginId,b=n(l,()=>M.grant(f),jt(L(),H(l))),E=e.geometry();return {pluginId:f,snapshot:l.snapshot,get state(){return l.state()},signal:l.signal,lifetimeSignal:l.lifetimeSignal,read:b.read,commands:b.commands,edits:b.edits,geometry:E&&l.snapshot.layout?.id===E.layout.id?E:null,navigation:b.navigation,setState:(_,q)=>l.setState(_,q),onCleanup:_=>l.onCleanup(_),run:_=>l.run(q=>_(N(q)))}},M=Oo({context:l=>N(l),snapshot:(l,f)=>({generation:f,version:s.version,readOnly:s.readOnly,grant:M.grant(l),selection:s.selection,layout:s.layout}),currentVersion:()=>r&&M.generation()!==null?rt(r):null,loadEvent:(l,f)=>({type:"load",generation:l.generation,version:l.version,reason:f}),grantsEvent:(l,f)=>({type:"grants-change",generation:l.generation,grant:f}),validate:bo,report:w}),D=l=>M.notify(l),A=()=>{let l=M.generation(),f=r?rt(r):null;!l||!f||f===s.version||(s.version=f,D({type:"document-change",generation:l,version:f}),s.layout&&s.layout.version!==f&&(s.layout=null,D({type:"layout-change",generation:l,layout:null})));},$=()=>{if(!u||!r){i?.(),i=null;return}if(!i){s.version=rt(r)??s.version;try{i=r.onUpdate(A);}catch(l){console.error("[PptxEditor] observing presentation changes for plugins failed",l);}}},v=()=>{i?.(),i=null,r=null;},z$1=(l,f)=>M.guard(l,"command-state",b=>qi(f.getState?f.getState(b):Xi),{enabled:false,disabledReason:m("plugin-unavailable",{translate:e.translate})}),C=async(l,f)=>{let b=await M.invoke(l,"command",_=>f.execute(_));if(b.ok)return Yi(b.value);let E=b.reason==="failed"?"command-failed":b.reason;return {ok:false,failure:m(E,{translate:e.translate})}};return {setPlugins(l){let f=[];for(let b of l??[]){let E=xo(b);if(E){f.push(E);continue}if(b!==null&&typeof b=="object"){if(g$1.has(b))continue;g$1.add(b);}w({pluginId:typeof b?.id=="string"?b.id:"",generation:M.generation(),phase:"definition",error:new TypeError("Plugins must be created with definePptxPlugin")});}u=f.length>0,$(),M.setPlugins(f);},setGrants:l=>M.setGrants(l),setReporter(l){o=l;},open(l){v(),r=l,s.version=rt(l)??"",s.layout=null,s.selection=null,$(),a+=1,M.open(`presentation-${a}`);},close(l){v(),s.layout=null,M.close(l);},generation:()=>M.generation(),version:()=>s.version,selectionChanged(l){if(JSON.stringify(l)===JSON.stringify(s.selection))return;s.selection=l;let f=M.generation();f&&D({type:"selection-change",generation:f,version:s.version,selection:l});},modeChanged(l){if(l===s.readOnly)return;s.readOnly=l;let f=M.generation();f&&D({type:"mode-change",generation:f,readOnly:l});},layoutChanged(l){let f=l&&l.version===s.version?l:null;if(Ji(f,s.layout))return;s.layout=f;let b=M.generation();b&&D({type:"layout-change",generation:b,layout:f});},layoutId:()=>M.generation()===null?null:s.layout?.id??null,geometryChanged:()=>M.touch(),activations:()=>M.activations(),subscribe:l=>M.subscribe(l),commandStore(l){let f=x.get(l.activation);return f?jt(L(),f):z},syncCommands(){let l=L();if(!l)return;let f$1=[],b=[],E=new Map,_=[];for(let W of M.activations()){let d=W.plugin;_.push(`${W.pluginId}:${h$1(d)}:${h$1(W.activation)}`);for(let P of d.commands??[]){let k=`plugin:${W.pluginId}/${P.id}`,y=[];for(let I of P.shortcuts??[]){let T=f(I),K=h.has(T)?"a built-in command":g.has(T)?"text editing":E.get(T);if(!K){E.set(T,k),y.push({chord:I,args:null});continue}let Y=`${W.pluginId}\0${T}`;R.has(Y)||(R.add(Y),w({pluginId:W.pluginId,generation:W.generation,phase:"definition",error:new Error(`Shortcut ${I} of ${k} is already used by ${K}; it was not bound`)}));}f$1.push({descriptor:Object.freeze({id:k,label:P.label,mutatesDocument:P.mutatesDocument,shortcuts:Object.freeze(y)}),state:()=>z$1(W.pluginId,P),execute:()=>C(W.pluginId,P)});}for(let P of d.toolbar??[])b.push(`plugin:${W.pluginId}/${P}`);}let q=_.join("|");if(q===p){l.refresh();return}p=q,l.setPluginCommands(f$1,b);},guard:(l,f,b,E)=>M.guard(l,f,b,E),fail:(l,f,b)=>M.fail(l,f,b)}}var it=9525,Do=new WeakMap,zo=0;function Qi(e){let t=Do.get(e);return t||(zo+=1,t=`slide-layout-${zo}`,Do.set(e,t)),t}function hu(e,t){if(!e||t===null||e.version!==t)return null;let n=e.snapshot.slides[e.slideIndex];return n?{id:Qi(e),version:t,slideId:n.id,slide:e.slideIndex+1,zoom:e.scale,width:e.frame.width,height:e.frame.height}:null}function ea(e){let t=e;return !!t&&Number.isFinite(t.x)&&Number.isFinite(t.y)&&Number.isFinite(t.width)&&Number.isFinite(t.height)}function ta(e,t,n,o){let r=e.getBoundingClientRect(),i=t.getBoundingClientRect();if(!(n.width>0&&n.height>0&&r.width>0&&r.height>0))return null;let u=r.width/n.width,a=r.height/n.height,p=r.left-i.left-t.clientLeft+t.scrollLeft,s=r.top-i.top-t.clientTop+t.scrollTop;return {x:p+o.x*u,y:s+o.y*a,width:o.width*u,height:o.height*a}}function xu(e,t,n,o,r,i){let u=a=>r()?ta(n,o,t.frame,a):null;return {layout:e,toOverlayRect(a){let p=a?.rect;return ea(p)?a.space==="slide-px"?u(p):a.space!=="slide-emu"?null:u({x:p.x/it,y:p.y/it,width:p.width/it,height:p.height/it}):null},getShapeRect(a){let p=t.snapshot.slides[t.slideIndex],s=p&&typeof a=="string"?ze(p.shapes,a):null,x=s?Kt(t.frame,s):null;return x?u(x):null},getPositionAtPoint(a,p){if(!r())return null;let s=i(t.frame,a,p);return s?{...s,version:e.version,layoutId:e.id}:null}}}function Pu(e,t=12){return {visible:e.slice(0,t),overflow:Math.max(0,e.length-t)}}function yu(e,t,n=4){let o=new Map;for(let r of e){let i=r.state.cursor?.slideId;if(!i||!t.has(i))continue;let u=o.get(i)??{visible:[],overflow:0};u.visible.length<n?u.visible.push(r):u.overflow+=1,o.set(i,u);}return o}function vu(e,t,n,o=24){let r=new Map,i=0;for(let u of e){let a=u.state.cursor;if(a?.slideId!==t||!a.shapeId||!n.has(a.shapeId))continue;let p=r.get(a.shapeId);p?(p.count+=1,u.cursorMovedAt>p.peer.cursorMovedAt&&(p.peer=u)):r.size<o?r.set(a.shapeId,{shapeId:a.shapeId,peer:u,count:1}):i+=1;}return {visible:[...r.values()],overflow:i}}var Cu="legacySyncApi";var Eu={panel:{flex:"0 0 auto",display:"flex",flexDirection:"column",gap:4,padding:"8px 14px 10px",background:"#ffffff",borderTop:"1px solid #e2e8f0"},label:{fontSize:11,fontWeight:650,color:"#647087",textTransform:"uppercase",letterSpacing:"0.02em"},textarea:{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"}},Tu={row:{display:"flex",flexWrap:"wrap",gap:6,paddingTop:8},button:{flex:"1 1 auto",height:26,whiteSpace:"nowrap",padding:"0 8px",border:"1px solid #cbd5e1",borderRadius:5,background:"#ffffff",color:"#334155",font:"12px ui-sans-serif, system-ui, sans-serif",cursor:"pointer"}};export{Ds as $,ee as A,In as B,pl as C,Mt as D,li as E,jl as F,Jl as G,so as H,ts as I,as as J,hs as K,Cs as L,ws as M,_t as N,Fe as O,Vi as P,ks as Q,mu as R,it as S,hu as T,ta as U,xu as V,Pu as W,yu as X,vu as Y,Cu as Z,As as _,Ns as a,zs as aa,Bs as b,Eu as ba,ze as c,Tu as ca,Ks as d,_s as e,Ws as f,$s as g,ot as h,Di as i,zi as j,Gs as k,js as l,Zs as m,Us as n,Vs as o,Xs as p,Bi as q,qs as r,Ki as s,Ys as t,Js as u,be as v,oa as w,fn as x,j as y,ir as z};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { ComponentType, ReactNode, CSSProperties } from 'react';
|
|
1
|
+
import * as _betteroffice_pptx from '@betteroffice/pptx';
|
|
3
2
|
import { ParagraphAlignment, PptxEditRefusal, PptxReadRequest, PptxReadResult, PptxFindRequest, PptxFindResult, PptxEditRequest, PptxValidationResult, PptxEditResult, PptxFontFace, CollaborationReplica, PptxPresence, HitTestResult, PresentationHandle, DeckSnapshot } from '@betteroffice/pptx';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ComponentType, ReactNode, CSSProperties, JSX } from 'react';
|
|
4
5
|
import { TranslationKey, Translations, TFunction } from '@betteroffice/pptx-i18n';
|
|
6
|
+
import { PptxWorkerEditorFailedError, PptxWorkerEditorAccess, PptxWorkerEditorRecovery, PresentationCommandAccessMethod, PresentationCommandAccessMethods, PresentationCommandMutationMethods } from '@betteroffice/pptx/worker';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* A value that survives `JSON.stringify` / `JSON.parse` unchanged.
|
|
@@ -262,7 +264,7 @@ interface PptxCommandArgs {
|
|
|
262
264
|
slideshow: null;
|
|
263
265
|
undo: null;
|
|
264
266
|
redo: null;
|
|
265
|
-
/** 1 is 100%, from 0.
|
|
267
|
+
/** 1 is 100%, from 0.1 to 5; `'fit'` fits the slide to the window. */
|
|
266
268
|
zoom: {
|
|
267
269
|
scale: number | 'fit';
|
|
268
270
|
};
|
|
@@ -760,6 +762,62 @@ interface PptxEditorPluginProps {
|
|
|
760
762
|
onPluginError?(error: PptxPluginError): void;
|
|
761
763
|
}
|
|
762
764
|
|
|
765
|
+
declare const LEGACY_SYNC_API: "legacySyncApi";
|
|
766
|
+
|
|
767
|
+
/** @experimental */
|
|
768
|
+
interface PptxWorkerEditorApi extends Omit<PptxEditorApi, 'handle' | 'save'> {
|
|
769
|
+
readonly handle: null;
|
|
770
|
+
save(): null;
|
|
771
|
+
saveAsync(): Promise<Uint8Array>;
|
|
772
|
+
goToSlideAsync(slide: number): Promise<boolean>;
|
|
773
|
+
readonly hydrated: boolean;
|
|
774
|
+
readonly failure: PptxWorkerEditorFailedError | undefined;
|
|
775
|
+
whenHydrated(): Promise<void>;
|
|
776
|
+
handleAsync(): Promise<PptxWorkerEditorAccess>;
|
|
777
|
+
recoverySave(): Promise<PptxWorkerEditorRecovery>;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
type PptxWorkerEditorProps = Omit<PptxInThreadEditorProps, 'onReady' | 'readOnly' | 'experimentalWorkerOpen' | 'collaboration'> & {
|
|
781
|
+
/** @deprecated Removed in 0.6.0. Omit for the async editor. */
|
|
782
|
+
[LEGACY_SYNC_API]: true;
|
|
783
|
+
collaboration?: undefined;
|
|
784
|
+
/** Edits in the worker; without it the legacy runtime runs in-thread. */
|
|
785
|
+
experimentalWorkerOpen: true;
|
|
786
|
+
readOnly?: false;
|
|
787
|
+
/** Without `Worker`, falls back to the in-thread engine and passes `PptxEditorApi`. */
|
|
788
|
+
onReady?: (api: PptxWorkerEditorApi) => void;
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
type AsyncOperations = Pick<PptxWorkerEditorApi, 'getPositionAtPoint' | 'clearSelection' | 'selectText' | 'goToSlide' | 'refresh' | 'refreshProposals'>;
|
|
792
|
+
type PptxAsyncEditorAccess = {
|
|
793
|
+
[K in PresentationCommandAccessMethod]: (...args: Parameters<PresentationCommandAccessMethods[K]>) => Promise<ReturnType<PresentationCommandAccessMethods[K]>>;
|
|
794
|
+
} & {
|
|
795
|
+
[K in keyof PresentationCommandMutationMethods]: (...args: Parameters<PresentationCommandMutationMethods[K]>) => Promise<ReturnType<PresentationCommandMutationMethods[K]>>;
|
|
796
|
+
} & Pick<PptxWorkerEditorApi, 'version' | 'readContent' | 'findText' | 'validateEdits' | 'applyEdits'> & {
|
|
797
|
+
registerFont(face: PptxFontFace): Promise<number>;
|
|
798
|
+
registerFallbackFont(face: PptxFontFace): Promise<number>;
|
|
799
|
+
};
|
|
800
|
+
type PptxAsyncEditorApi = Omit<PptxWorkerEditorApi, 'handle' | 'save' | 'saveAsync' | 'handleAsync' | 'recoverySave' | keyof AsyncOperations> & {
|
|
801
|
+
[K in keyof AsyncOperations]: (...args: Parameters<AsyncOperations[K]>) => Promise<ReturnType<AsyncOperations[K]>>;
|
|
802
|
+
} & Pick<PptxAsyncEditorAccess, 'exportStructured' | 'exportMarkdown'> & {
|
|
803
|
+
handleAsync(): Promise<PptxAsyncEditorAccess>;
|
|
804
|
+
/** Flushes pending input, then serializes the presentation to .pptx bytes. Does not call onSave or download. */
|
|
805
|
+
save(): Promise<Uint8Array>;
|
|
806
|
+
/** @deprecated Use {@link save}, which is async on the default editor. */
|
|
807
|
+
saveAsync(): Promise<Uint8Array>;
|
|
808
|
+
recoverySave(): Promise<{
|
|
809
|
+
bytes: Uint8Array;
|
|
810
|
+
recovery: true;
|
|
811
|
+
throughSeq: number;
|
|
812
|
+
version: string;
|
|
813
|
+
}>;
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
declare class PptxWorkerEditorChunkLoadError extends Error {
|
|
817
|
+
readonly cause: unknown;
|
|
818
|
+
readonly code = "chunk-load-failed";
|
|
819
|
+
constructor(cause: unknown);
|
|
820
|
+
}
|
|
763
821
|
interface PptxTextSelection {
|
|
764
822
|
shapeId: string;
|
|
765
823
|
storyId: string;
|
|
@@ -815,18 +873,43 @@ interface PptxEditorApi {
|
|
|
815
873
|
*/
|
|
816
874
|
applyEdits: (request: PptxEditRequest) => Promise<PptxEditResult>;
|
|
817
875
|
}
|
|
876
|
+
/** @experimental */
|
|
877
|
+
interface PptxWorkerViewerApi extends Omit<PptxEditorApi, 'handle' | 'save' | 'getPositionAtPoint' | 'selectText' | 'version' | 'readContent' | 'findText' | 'validateEdits' | 'applyEdits'> {
|
|
878
|
+
handle: null;
|
|
879
|
+
save: () => null;
|
|
880
|
+
getPositionAtPoint: (clientX: number, clientY: number) => null;
|
|
881
|
+
selectText: (target: PptxTextSelectionTarget) => false;
|
|
882
|
+
saveAsync: () => Promise<Uint8Array | null>;
|
|
883
|
+
version: () => Promise<string | null>;
|
|
884
|
+
readContent: (request?: PptxReadRequest) => Promise<PptxReadResult | null>;
|
|
885
|
+
findText: (request: PptxFindRequest) => Promise<PptxFindResult | null>;
|
|
886
|
+
validateEdits: (request: PptxEditRequest) => Promise<PptxValidationResult | null>;
|
|
887
|
+
applyEdits: (request: PptxEditRequest) => Promise<PptxEditResult | null>;
|
|
888
|
+
/** Accepts a 1-based slide number; resolves after painting. */
|
|
889
|
+
goToSlideAsync: (slide: number) => Promise<boolean>;
|
|
890
|
+
}
|
|
891
|
+
interface PptxAsyncCollaborationOptions extends Omit<PptxEditorCollaborationOptions, 'clientId' | 'onReplica'> {
|
|
892
|
+
/** Generated for each opened session when omitted. */
|
|
893
|
+
clientId?: number;
|
|
894
|
+
/** Change to open a different collaboration room. */
|
|
895
|
+
roomId?: string;
|
|
896
|
+
onReplica?: (replica: _betteroffice_pptx.AsyncCollaborationReplica | null) => void;
|
|
897
|
+
}
|
|
818
898
|
interface PptxEditorCollaborationOptions {
|
|
819
899
|
clientId: number;
|
|
820
900
|
initialUpdate?: Uint8Array;
|
|
821
901
|
onReplica?: (replica: CollaborationReplica | null) => void;
|
|
822
902
|
presence?: PptxPresence;
|
|
823
903
|
}
|
|
824
|
-
interface
|
|
904
|
+
interface PptxInThreadEditorProps extends PptxEditorPluginProps {
|
|
825
905
|
file?: Uint8Array;
|
|
826
906
|
/** Font faces; equivalent inline arrays do not reopen the presentation. */
|
|
827
907
|
fonts: ReadonlyArray<PptxFontFace>;
|
|
828
908
|
clientId?: number;
|
|
909
|
+
/** Uses the deprecated in-thread engine when set. */
|
|
829
910
|
collaboration?: PptxEditorCollaborationOptions;
|
|
911
|
+
/** @deprecated Omit this prop to use the default worker-owned editor. */
|
|
912
|
+
experimentalWorkerOpen?: false;
|
|
830
913
|
i18n?: Translations;
|
|
831
914
|
className?: string;
|
|
832
915
|
/** Download name for the save button; falls back to `presentation.pptx`. */
|
|
@@ -852,7 +935,78 @@ interface PptxEditorProps extends PptxEditorPluginProps {
|
|
|
852
935
|
/** Shows the toolbar region; defaults to true. */
|
|
853
936
|
showToolbar?: boolean;
|
|
854
937
|
}
|
|
855
|
-
|
|
938
|
+
/** @deprecated Removed in 0.6.0. Use PptxAsyncEditorProps. */
|
|
939
|
+
type PptxWorkerViewerProps = Omit<PptxInThreadEditorProps, 'onReady' | 'readOnly' | 'experimentalWorkerOpen' | 'collaboration' | 'plugins' | 'onChange'> & {
|
|
940
|
+
/** @deprecated Removed in 0.6.0. Omit for the async editor. */
|
|
941
|
+
[LEGACY_SYNC_API]: true;
|
|
942
|
+
collaboration?: undefined;
|
|
943
|
+
plugins?: readonly [];
|
|
944
|
+
onChange?: undefined;
|
|
945
|
+
readOnly: true;
|
|
946
|
+
/** Opens in the worker; without it the legacy runtime runs in-thread. */
|
|
947
|
+
experimentalWorkerOpen: true;
|
|
948
|
+
/** Without `Worker`, falls back to the in-thread engine and passes `PptxEditorApi`. */
|
|
949
|
+
onReady?: (api: PptxWorkerViewerApi) => void;
|
|
950
|
+
};
|
|
951
|
+
interface PptxDocumentChange {
|
|
952
|
+
version: string;
|
|
953
|
+
}
|
|
954
|
+
interface PptxAsyncPresentationProps {
|
|
955
|
+
/** Receives the version after a committed edit changes the presentation. */
|
|
956
|
+
onDocumentChange?: (change: PptxDocumentChange) => void;
|
|
957
|
+
/** Whether Save also downloads a copy. Defaults to true without onSave, false with it. */
|
|
958
|
+
downloadOnSave?: boolean;
|
|
959
|
+
/** Initial zoom scale, clamped to 0.1 to 5; omit to fit the slide. */
|
|
960
|
+
initialZoom?: number;
|
|
961
|
+
/** Rendered while the presentation opens. */
|
|
962
|
+
loadingIndicator?: ReactNode;
|
|
963
|
+
/** Inline styles for the editor root. */
|
|
964
|
+
style?: CSSProperties;
|
|
965
|
+
}
|
|
966
|
+
type PptxAsyncEditorProps = Omit<PptxInThreadEditorProps, 'file' | 'onReady' | 'collaboration' | 'experimentalWorkerOpen'> & PptxAsyncPresentationProps & {
|
|
967
|
+
file?: Uint8Array | ArrayBuffer;
|
|
968
|
+
/** @deprecated Removed in 0.6.0. Omit for the async editor. */
|
|
969
|
+
[LEGACY_SYNC_API]?: false;
|
|
970
|
+
/** @deprecated False selects the in-thread engine. */
|
|
971
|
+
experimentalWorkerOpen?: boolean;
|
|
972
|
+
collaboration?: PptxAsyncCollaborationOptions;
|
|
973
|
+
onReady?: (api: PptxAsyncEditorApi) => void | (() => void);
|
|
974
|
+
};
|
|
975
|
+
/** @deprecated Removed in 0.6.0. Use PptxAsyncEditorProps. */
|
|
976
|
+
type PptxLegacyEditorProps = PptxInThreadEditorProps & {
|
|
977
|
+
/** @deprecated Removed in 0.6.0. Omit for the async editor. */
|
|
978
|
+
[LEGACY_SYNC_API]: true;
|
|
979
|
+
};
|
|
980
|
+
type WorkerSessionProps = Omit<PptxWorkerEditorProps, 'readOnly' | 'onReady' | 'experimentalWorkerOpen'> & {
|
|
981
|
+
experimentalWorkerOpen: true;
|
|
982
|
+
readOnly?: boolean;
|
|
983
|
+
onReady?: (api: PptxWorkerEditorApi | PptxWorkerViewerApi) => void;
|
|
984
|
+
};
|
|
985
|
+
type WorkerEditorSessionProps = Omit<PptxWorkerEditorProps, 'readOnly'> & {
|
|
986
|
+
readOnly?: boolean;
|
|
987
|
+
};
|
|
988
|
+
type CollaborationSessionProps = Omit<PptxLegacyEditorProps, 'experimentalWorkerOpen'> & {
|
|
989
|
+
collaboration: PptxEditorCollaborationOptions;
|
|
990
|
+
experimentalWorkerOpen?: boolean;
|
|
991
|
+
};
|
|
992
|
+
type GeneralEditorSessionProps = Omit<PptxLegacyEditorProps, 'experimentalWorkerOpen' | 'onReady'> & {
|
|
993
|
+
experimentalWorkerOpen?: boolean;
|
|
994
|
+
onReady?: (api: PptxEditorApi | PptxWorkerEditorApi | PptxWorkerViewerApi) => void;
|
|
995
|
+
};
|
|
996
|
+
type PptxEditorProps = PptxAsyncEditorProps | GeneralEditorSessionProps;
|
|
997
|
+
declare function PptxEditor(props: PptxAsyncEditorProps): JSX.Element;
|
|
998
|
+
declare function PptxEditor(props: PptxLegacyEditorProps): JSX.Element;
|
|
999
|
+
declare function PptxEditor(props: CollaborationSessionProps): JSX.Element;
|
|
1000
|
+
declare function PptxEditor(props: PptxWorkerEditorProps): JSX.Element;
|
|
1001
|
+
declare function PptxEditor(props: WorkerEditorSessionProps & {
|
|
1002
|
+
onChange: NonNullable<PptxInThreadEditorProps['onChange']>;
|
|
1003
|
+
}): JSX.Element;
|
|
1004
|
+
declare function PptxEditor(props: WorkerEditorSessionProps & {
|
|
1005
|
+
plugins: readonly [PptxPlugin, ...PptxPlugin[]];
|
|
1006
|
+
}): JSX.Element;
|
|
1007
|
+
declare function PptxEditor(props: PptxWorkerViewerProps): JSX.Element;
|
|
1008
|
+
declare function PptxEditor(props: WorkerSessionProps): JSX.Element;
|
|
1009
|
+
declare function PptxEditor(props: PptxEditorProps): JSX.Element;
|
|
856
1010
|
|
|
857
1011
|
/**
|
|
858
1012
|
* Props of the legacy toolbar, which shows the state it is given and reports
|
|
@@ -1019,6 +1173,13 @@ interface PptxCommandProviderProps {
|
|
|
1019
1173
|
*/
|
|
1020
1174
|
declare function PptxCommandProvider({ commands, children }: PptxCommandProviderProps): react.JSX.Element;
|
|
1021
1175
|
|
|
1176
|
+
type PptxCommandAdmissionCode = Extract<PptxCommandFailureCode, 'input-failed' | 'document-replaced' | 'target-changed' | 'gesture-active' | 'editor-unavailable' | 'read-only' | 'invalid-arguments'>;
|
|
1177
|
+
/** Raised when an admitted command cannot run against its originating input or target. */
|
|
1178
|
+
declare class PptxCommandAdmissionError extends Error {
|
|
1179
|
+
readonly code: PptxCommandAdmissionCode;
|
|
1180
|
+
constructor(code: PptxCommandAdmissionCode);
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1022
1183
|
/**
|
|
1023
1184
|
* The nearest editor's command store.
|
|
1024
1185
|
* @experimental
|
|
@@ -1163,4 +1324,4 @@ declare function definePptxPlugin<S>(definition: PptxPluginDefinition<S>): PptxP
|
|
|
1163
1324
|
*/
|
|
1164
1325
|
declare function PptxPluginToolbar(): React.ReactElement | null;
|
|
1165
1326
|
|
|
1166
|
-
export { type CommandReason, type CommandState, type CommandToolbarProps, EditorToolbar, type EditorToolbarCommandProps, EditorToolbarContext, type EditorToolbarProps, type FormattingAction, type JsonValue, LocaleProvider, type LocaleProviderProps, type MaybePromise, type PluginCleanupReason, type PluginGrant, type PluginLoadReason, type PptxBoundCommand, type PptxBoundPluginCommand, type PptxCommandArgs, type PptxCommandDescriptor, type PptxCommandDisabledCode, type PptxCommandFailureCode, type PptxCommandId, type PptxCommandOption, PptxCommandProvider, type PptxCommandProviderProps, type PptxCommandResult, type PptxCommandShortcut, type PptxCommandState, type PptxCommandStatus, type PptxCommandStore, type PptxCommandValues, type PptxControlCommandId, PptxEditor, type PptxEditorApi, type PptxEditorCollaborationOptions, type PptxEditorPluginProps, type PptxEditorProps, type PptxEditorTool, type PptxPlugin, type PptxPluginCommand, type PptxPluginCommandClient, type PptxPluginCommandDescriptor, type PptxPluginCommandId, type PptxPluginCommandResult, type PptxPluginCommandState, type PptxPluginContext, type PptxPluginDefinition, type PptxPluginEditClient, type PptxPluginError, type PptxPluginErrorPhase, type PptxPluginEvent, type PptxPluginFailureCode, type PptxPluginGeometry, type PptxPluginGrant, type PptxPluginLayout, type PptxPluginNavigation, type PptxPluginNavigationFailureCode, type PptxPluginNavigationOptions, type PptxPluginNavigationResult, type PptxPluginPanel, type PptxPluginPointPosition, type PptxPluginReadClient, type PptxPluginRect, type PptxPluginRefusal, type PptxPluginSelection, type PptxPluginSnapshot, PptxPluginToolbar, type PptxPointPosition, type PptxSelectCommandId, type PptxShapePreset, type PptxTextSelection, type PptxTextSelectionTarget, Toolbar as PptxToolbar, type PptxZOrderMove, type PptxZoom, SHAPE_PRESETS, type SelectionFormatting, type ShapeFormatting, type ShapeFormattingAction, type SlideLayoutOption, Toolbar, ToolbarButton, type ToolbarButtonProps, ToolbarCommand, type ToolbarCommandArgs, ToolbarCommandButton, type ToolbarCommandButtonProps, type ToolbarCommandProps, ToolbarCommandSelect, type ToolbarCommandSelectProps, ToolbarDropdown, type ToolbarDropdownProps, ToolbarGroup, ToolbarMenuItem, type ToolbarMenuItemProps, ToolbarMenuSeparator, ToolbarOverflow, type ToolbarOverflowProps, type ToolbarProps, ToolbarSeparator, definePptxPlugin, useEditorToolbar, usePptxCommand, usePptxCommandState, usePptxCommands, useTranslation };
|
|
1327
|
+
export { type CommandReason, type CommandState, type CommandToolbarProps, EditorToolbar, type EditorToolbarCommandProps, EditorToolbarContext, type EditorToolbarProps, type FormattingAction, type JsonValue, LocaleProvider, type LocaleProviderProps, type MaybePromise, type PluginCleanupReason, type PluginGrant, type PluginLoadReason, type PptxAsyncCollaborationOptions, type PptxAsyncEditorAccess, type PptxAsyncEditorApi, type PptxAsyncEditorProps, type PptxBoundCommand, type PptxBoundPluginCommand, type PptxCommandAdmissionCode, PptxCommandAdmissionError, type PptxCommandArgs, type PptxCommandDescriptor, type PptxCommandDisabledCode, type PptxCommandFailureCode, type PptxCommandId, type PptxCommandOption, PptxCommandProvider, type PptxCommandProviderProps, type PptxCommandResult, type PptxCommandShortcut, type PptxCommandState, type PptxCommandStatus, type PptxCommandStore, type PptxCommandValues, type PptxControlCommandId, type PptxDocumentChange, PptxEditor, type PptxEditorApi, type PptxEditorCollaborationOptions, type PptxEditorPluginProps, type PptxEditorProps, type PptxEditorTool, type PptxLegacyEditorProps, type PptxPlugin, type PptxPluginCommand, type PptxPluginCommandClient, type PptxPluginCommandDescriptor, type PptxPluginCommandId, type PptxPluginCommandResult, type PptxPluginCommandState, type PptxPluginContext, type PptxPluginDefinition, type PptxPluginEditClient, type PptxPluginError, type PptxPluginErrorPhase, type PptxPluginEvent, type PptxPluginFailureCode, type PptxPluginGeometry, type PptxPluginGrant, type PptxPluginLayout, type PptxPluginNavigation, type PptxPluginNavigationFailureCode, type PptxPluginNavigationOptions, type PptxPluginNavigationResult, type PptxPluginPanel, type PptxPluginPointPosition, type PptxPluginReadClient, type PptxPluginRect, type PptxPluginRefusal, type PptxPluginSelection, type PptxPluginSnapshot, PptxPluginToolbar, type PptxPointPosition, type PptxSelectCommandId, type PptxShapePreset, type PptxTextSelection, type PptxTextSelectionTarget, Toolbar as PptxToolbar, type PptxWorkerEditorApi, PptxWorkerEditorChunkLoadError, type PptxWorkerEditorProps, type PptxWorkerViewerApi, type PptxWorkerViewerProps, type PptxZOrderMove, type PptxZoom, SHAPE_PRESETS, type SelectionFormatting, type ShapeFormatting, type ShapeFormattingAction, type SlideLayoutOption, Toolbar, ToolbarButton, type ToolbarButtonProps, ToolbarCommand, type ToolbarCommandArgs, ToolbarCommandButton, type ToolbarCommandButtonProps, type ToolbarCommandProps, ToolbarCommandSelect, type ToolbarCommandSelectProps, ToolbarDropdown, type ToolbarDropdownProps, ToolbarGroup, ToolbarMenuItem, type ToolbarMenuItemProps, ToolbarMenuSeparator, ToolbarOverflow, type ToolbarOverflowProps, type ToolbarProps, ToolbarSeparator, definePptxPlugin, useEditorToolbar, usePptxCommand, usePptxCommandState, usePptxCommands, useTranslation };
|