pptx-react-viewer 1.1.16 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/viewer/index.js +3 -3
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +3 -3
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4658,7 +4658,7 @@ ${h}
|
|
|
4658
4658
|
from { stroke-dashoffset: var(--ink-path-length); }
|
|
4659
4659
|
to { stroke-dashoffset: 0; }
|
|
4660
4660
|
}`;function YQ(t,e,n={}){let r=n.strokeDurationMs??600,o=n.strokeDelayMs??200,i=n.easing??"ease-in-out",s=t*(r+o),a=Math.max(e,1);return {pathLength:a,animationDelay:`${s}ms`,animationDuration:`${r}ms`,animation:`${WQ} ${r}ms ${i} ${s}ms forwards`,strokeDasharray:`${a}`,strokeDashoffset:`${a}`}}function qQ(t,e={}){return t.inkPaths.map((n,r)=>{let o=WR(n),i=XQ(o);return YQ(r,i,e)})}function KQ(t,e={}){return t.map((n,r)=>{let o=WR(n.path),i=XQ(o);return YQ(r,i,e)})}function ZQ(t,e){return !t||e>=t.length?1:Math.max(0,Math.min(1,t[e]))}function JQ(t,e,n="#000"){return !t||e>=t.length?n:t[e]||n}function QQ(t,e,n=3){return !t||e>=t.length?n:t[e]>0?t[e]:n}function eee(t){switch(t.type){case "image":case "picture":return "img";case "table":return "table";case "group":return "group";case "chart":return "img";case "smartArt":return "img";case "connector":return "img";case "media":return "application";case "ink":return "img";case "model3d":return "img";case "text":return;case "shape":return ot(t)&&t.text?void 0:"img";default:return}}function tee(t){if((t.type==="image"||t.type==="picture")&&"altText"in t&&typeof t.altText=="string"&&t.altText.trim())return t.altText.trim();if(ot(t)&&t.text){let e=t.text.trim();if(e)return e.length>120?`${e.slice(0,117)}...`:e}if(t.type==="chart"&&"chartData"in t&&t.chartData){let e=t.chartData;return e.title?`Chart: ${e.title}`:"Chart"}return t.type==="smartArt"?"SmartArt diagram":t.type==="table"?"Table":t.type==="media"?"Media element":t.type==="group"?"Group of elements":t.type==="connector"?"Connector line":t.type==="ink"?"Ink drawing":t.type==="model3d"?"3D Model":t.type==="shape"?"shapeType"in t&&t.shapeType?`Shape: ${t.shapeType}`:"Shape":SOe(t.type)}function SOe(t){switch(t){case "text":return "Text box";case "shape":return "Shape";case "image":case "picture":return "Image";case "table":return "Table";case "chart":return "Chart";case "connector":return "Connector";case "group":return "Group";case "smartArt":return "SmartArt";case "media":return "Media";case "ink":return "Drawing";case "ole":return "Embedded object";case "contentPart":return "Content part";case "model3d":return "3D Model";default:return "Element"}}function nee(t){switch(t.type){case "shape":{let e="shapeType"in t&&typeof t.shapeType=="string"?t.shapeType:void 0;return e?`shape: ${e}`:"shape"}case "chart":return "chart";case "connector":return "connector line";case "smartArt":return "diagram";case "image":case "picture":return "image";case "table":return "data table";case "group":return "grouped elements";case "media":return "media player";case "ink":return "ink drawing";case "model3d":return "3D model";default:return}}function YR(t,e){if(e.size===0)return [];let n=new Map;for(let o of t)n.set(o.id,o);let r=[];for(let o of t){if(o.type!=="connector")continue;let i=o.shapeStyle;if(!i)continue;let s=i,a=s.connectorStartConnection,l=s.connectorEndConnection,c=a?.shapeId&&e.has(a.shapeId),d=l?.shapeId&&e.has(l.shapeId);if(!c&&!d||e.has(o.id))continue;let u=wOe(o,a,l,n);u&&r.push(u);}return r}function wOe(t,e,n,r){let o,i;if(e?.shapeId){let l=r.get(e.shapeId);if(!l)return null;let c=gd(l.width,l.height),d=e.connectionSiteIndex??0,u=c[d]??c[0];o=l.x+u.x,i=l.y+u.y;}else o=t.x,i=t.y;let s,a;if(n?.shapeId){let l=r.get(n.shapeId);if(!l)return null;let c=gd(l.width,l.height),d=n.connectionSiteIndex??0,u=c[d]??c[0];s=l.x+u.x,a=l.y+u.y;}else s=t.x+t.width,a=t.y+t.height;return {id:t.id,x:Math.min(o,s),y:Math.min(i,a),width:Math.abs(s-o)||1,height:Math.abs(a-i)||1}}function qR(t,e){if(e.length===0)return t;let n=new Map;for(let r of e)n.set(r.id,r);return t.map(r=>{let o=n.get(r.id);return o?{...r,x:o.x,y:o.y,width:o.width,height:o.height}:r})}var COe=new Set(["javascript:","data:","vbscript:","mhtml:","x-]javascript:"]);function Wb(t){if(!t||typeof t!="string")return false;let e=t.trim();if(e.length===0)return false;let r=e.toLowerCase().replace(/[\s\u200b\ufeff]/g,"").replace(/\u200c/g,"").replace(/\u200d/g,"").replaceAll("\0","");for(let o of COe)if(r.startsWith(o))return false;return true}function Xg(t){return Wb(t)?(window.open(t,"_blank","noopener,noreferrer"),true):(typeof console<"u"&&console.warn(`[pptx-viewer] Blocked attempt to open unsafe URL: ${t.slice(0,100)}`),false)}function pU(t){return !t||typeof t!="string"?false:t.toLowerCase().startsWith("ppaction://")}function ree(t){if(!pU(t))return null;let e,n=t.indexOf("?");if(n>=0){let r=t.slice(n+1),o=new URLSearchParams(r),i=o.get("slideIndex");if(i!==null){let l=parseInt(i,10);Number.isFinite(l)&&(e=l);}o.delete("slideIndex");let s=o.toString();return {action:s?`${t.slice(0,n)}?${s}`:t.slice(0,n),targetSlideIndex:e}}return {action:t,targetSlideIndex:e}}function hU({className:t}){return jsx("div",{className:le("h-full w-full flex items-center justify-center text-muted-foreground",t),children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-primary"}),jsx("span",{children:"Loading presentation..."})]})})}function mU({className:t,error:e}){return jsx("div",{className:le("h-full w-full flex items-center justify-center p-6 text-center text-red-400",t),children:e})}function xU({isOpen:t,onClose:e}){return t?jsxs("div",{"data-pptx-shortcuts-panel":"true",className:"absolute top-14 right-3 z-40 w-[min(24rem,calc(100%-1.5rem))] rounded border border-border bg-popover shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[jsx("span",{className:"text-xs uppercase tracking-wide text-foreground",children:"Keyboard shortcuts"}),jsx("button",{type:"button",onClick:e,className:"rounded px-2 py-1 text-[11px] text-foreground hover:bg-muted hover:text-foreground",children:"Close"})]}),jsx("div",{className:"max-h-64 overflow-y-auto p-2 space-y-1",children:mE.map(n=>jsxs("div",{className:"flex items-center justify-between gap-3 rounded bg-muted/80 px-2 py-1.5",children:[jsx("span",{className:"text-xs text-foreground",children:n.action}),jsx("span",{className:"font-mono text-[11px] text-foreground whitespace-nowrap",children:n.shortcut})]},n.action))})]}):null}function yU({isOpen:t,issues:e,onClose:n,reducedMotion:r,onToggleReducedMotion:o}){let{t:i}=useTranslation();return t?jsxs("div",{role:"dialog","aria-label":i("pptx.accessibility.title"),className:"absolute top-14 right-3 z-40 w-[min(28rem,calc(100%-1.5rem))] rounded border border-border bg-popover shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[jsx("span",{className:"text-xs uppercase tracking-wide text-foreground",children:i("pptx.accessibility.title")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptx.accessibility.issueCount",{count:e.length})}),jsx("button",{type:"button",onClick:n,"aria-label":i("pptx.accessibility.closePanel"),className:"rounded px-2 py-1 text-[11px] text-foreground hover:bg-muted hover:text-foreground",children:i("pptx.accessibility.close")})]})]}),o!==void 0&&jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[jsx("label",{htmlFor:"reduced-motion-toggle",className:"text-xs text-foreground",children:i("pptx.accessibility.reduceMotion")}),jsx("button",{id:"reduced-motion-toggle",type:"button",role:"switch","aria-checked":r??false,onClick:o,className:le("relative inline-flex h-5 w-9 items-center rounded-full transition-colors",r?"bg-primary":"bg-muted-foreground/30"),children:jsx("span",{className:le("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",r?"translate-x-4":"translate-x-0.5")})})]}),jsx("div",{role:"list","aria-label":i("pptx.accessibility.issuesList"),className:"max-h-72 overflow-y-auto p-2 space-y-1",children:e.length===0?jsx("div",{role:"listitem",className:"text-center text-xs text-muted-foreground py-4",children:i("pptx.accessibility.noIssues")}):e.map((s,a)=>jsxs("div",{role:"listitem",className:le("flex items-start gap-2 rounded px-2 py-1.5 text-xs",s.severity==="error"?"bg-red-900/30 text-red-300":s.severity==="warning"?"bg-amber-900/30 text-amber-300":"bg-muted/50 text-muted-foreground"),children:[jsx("span",{className:"shrink-0 mt-0.5","aria-hidden":"true",children:s.severity==="error"?"\u25CF":s.severity==="warning"?"\u25B2":"\u2139"}),jsxs("span",{children:[s.severity==="error"?i("pptx.accessibility.error"):s.severity==="warning"?i("pptx.accessibility.warning"):i("pptx.accessibility.info"),s.message]})]},a))})]}):null}function vU({isOpen:t,title:e,progress:n,statusMessage:r,onCancel:o}){let{t:i}=useTranslation();if(!t)return null;let s=Math.min(100,Math.max(0,Math.round(n)));return jsx("div",{style:{zIndex:1200},className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:jsxs("div",{className:"w-96 rounded-xl border border-border bg-background p-6 shadow-2xl",children:[jsx("h3",{className:"mb-4 text-sm font-semibold text-foreground",children:e}),jsx("div",{className:"mb-3 h-2.5 w-full overflow-hidden rounded-full bg-accent",children:jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-300 ease-out",style:{width:`${s}%`}})}),jsxs("div",{className:"mb-4 flex items-center justify-between text-xs text-muted-foreground",children:[jsx("span",{children:r??i("pptx.export.processing")}),jsxs("span",{className:"tabular-nums",children:[s,"%"]})]}),jsx("div",{className:"flex justify-end",children:jsx("button",{type:"button",onClick:o,className:"rounded-md border border-border bg-muted px-4 py-1.5 text-xs text-foreground transition-colors hover:bg-accent",children:i("pptx.export.cancel")})})]})})}function LOe(t,e){let n=Date.now()-t,r=Math.floor(n/6e4);return r<1?e("pptx.autosave.justNow"):r===1?e("pptx.autosave.oneMinAgo"):e("pptx.autosave.minutesAgo",{count:r})}function SU({slideCount:t,activeSlideIndex:e,isDirty:n,autosaveStatus:r,scale:o,onZoomIn:i,onZoomOut:s,onZoomToFit:a,isNotesExpanded:l,onToggleNotes:c,mode:d,onSetMode:u,onToggleSlideSorter:p,collaborationSlot:f}){let{t:h}=useTranslation(),m;r?.state==="saving"?m=h("pptx.autosave.saving"):r?.state==="saved"?m=h("pptx.autosave.saved",{time:LOe(r.timestamp,h)}):r?.state==="error"?m=h("pptx.autosave.error"):n?m=h("pptx.statusBar.unsavedChanges"):m=h("pptx.statusBar.allSaved");let x="p-1 rounded-sm transition-colors hover:bg-accent/60 text-muted-foreground active:scale-95 active:opacity-80";return jsxs("div",{className:"w-full px-2 py-0.5 border-t border-border bg-secondary/50 text-[10px] text-muted-foreground flex items-center gap-1",children:[jsx("span",{className:"shrink-0",children:t>0?h("pptx.statusBar.slideOf",{current:Math.min(e+1,t),total:t}):h("pptx.statusBar.noSlides")}),jsx("div",{className:"w-px h-3 bg-border/40 mx-1 max-md:hidden"}),jsx("span",{className:"shrink-0 max-md:hidden text-[10px]",children:h("pptx.statusBar.language")}),jsx("div",{className:"w-px h-3 bg-border/60 mx-1 max-md:hidden"}),jsx("span",{className:le("shrink-0 max-md:hidden",r?.state==="error"?"text-red-400":r?.state==="saving"?"text-yellow-400":""),children:m}),jsx("div",{className:"flex-1"}),c&&jsxs("button",{type:"button",onClick:c,className:le(x,"flex items-center gap-1 text-[10px]",l&&"text-primary"),title:h("pptx.statusBar.toggleNotes"),"aria-label":h("pptx.statusBar.toggleNotes"),children:[jsx(LuStickyNote,{className:"w-3 h-3"}),jsx("span",{className:"max-md:hidden",children:h("pptx.notes.title")})]}),jsx("div",{className:"w-px h-3 bg-border/60 mx-0.5"}),u&&jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>u("edit"),className:le(x,d==="edit"&&"text-primary"),title:h("pptx.statusBar.normalView"),"aria-label":h("pptx.statusBar.normalView"),children:jsx(LuMonitor,{className:"w-3.5 h-3.5"})}),p&&jsx("button",{type:"button",onClick:p,className:x,title:h("pptx.statusBar.slideSorter"),"aria-label":h("pptx.statusBar.slideSorter"),children:jsx(LuColumns2,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>u("present"),className:le(x,d==="present"&&"text-primary"),title:h("pptx.statusBar.slideShow"),"aria-label":h("pptx.statusBar.slideShow"),children:jsx(LuPresentation,{className:"w-3.5 h-3.5"})})]}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-3 bg-border/40 mx-0.5"}),f]}),o!==void 0&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-3 bg-border/60 mx-0.5"}),jsxs("div",{className:"flex items-center gap-0.5",children:[s&&jsx("button",{type:"button",onClick:s,className:x,title:h("pptx.statusBar.zoomOut"),"aria-label":h("pptx.statusBar.zoomOut"),children:jsx(LuMinus,{className:"w-3 h-3"})}),jsxs("button",{type:"button",onClick:a,className:"px-1.5 py-0.5 rounded-sm hover:bg-accent/60 text-[10px] text-muted-foreground tabular-nums min-w-[3rem] text-center transition-colors",title:h("pptx.statusBar.zoomToFit"),children:[Math.round((o??1)*100),"%"]}),i&&jsx("button",{type:"button",onClick:i,className:x,title:h("pptx.statusBar.zoomIn"),"aria-label":h("pptx.statusBar.zoomIn"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function Cp({direction:t,onResize:e,onResizeEnd:n,className:r}){let o=useRef(0),i=useCallback(s=>{s.preventDefault(),s.stopPropagation();let a=s.currentTarget;a.setPointerCapture(s.pointerId),o.current=t==="horizontal"?s.clientX:s.clientY;let l=d=>{let u=t==="horizontal"?d.clientX:d.clientY,p=u-o.current;o.current=u,e(p);},c=()=>{a.removeEventListener("pointermove",l),a.removeEventListener("pointerup",c),a.removeEventListener("pointercancel",c),n?.();};a.addEventListener("pointermove",l),a.addEventListener("pointerup",c),a.addEventListener("pointercancel",c);},[t,e,n]);return jsx("div",{role:"separator","aria-orientation":t,className:le("relative flex-shrink-0 z-20 group",t==="horizontal"?"w-3 cursor-col-resize -mx-1":"h-3 cursor-row-resize -my-1",r),onPointerDown:i,children:jsx("div",{className:le("absolute transition-colors",t==="horizontal"?"top-0 bottom-0 left-1/2 -translate-x-1/2 w-0.5 group-hover:w-1 group-hover:bg-primary/40 group-active:w-1 group-active:bg-primary/60":"left-0 right-0 top-1/2 -translate-y-1/2 h-0.5 group-hover:h-1 group-hover:bg-primary/40 group-active:h-1 group-active:bg-primary/60")})})}function UOe({slide:t,templateElements:e,canvasSize:n}){let r=Math.max(n.width,1),o=Math.max(n.height,1),i=156/r,s=Math.max(56,Math.round(o*i)),a=[...e,...t.elements].slice(0,60);return jsxs("div",{className:"relative w-full overflow-hidden rounded border border-border bg-white",style:{height:s},children:[t.backgroundColor&&t.backgroundColor!=="transparent"&&jsx("div",{className:"absolute inset-0",style:{backgroundColor:ut(t.backgroundColor,"#ffffff")}}),t.backgroundGradient&&jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:t.backgroundGradient}}),t.backgroundImage&&jsx("img",{src:t.backgroundImage,alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",draggable:false}),jsxs("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:r,height:o,transform:`scale(${i})`,transformOrigin:"top left"},children:[t.transition&&t.transition.type!=="none"&&t.transition.type!=="cut"&&jsx("div",{className:"absolute top-0.5 right-0.5 z-10 px-1 py-px rounded bg-primary/80 text-[7px] text-white leading-tight pointer-events-none",title:`Transition: ${Z5.find(l=>l.value===t.transition?.type)?.label??t.transition.type}`,children:Z5.find(l=>l.value===t.transition?.type)?.label??t.transition.type}),a.map(l=>{let c=Math.max(l.width,1),d=Math.max(l.height,1),u=mn(l)?l.shapeStyle:void 0,p=u?.fillColor!==void 0&&u?.fillColor!=="transparent"||!!(Bu(u)||u?.fillGradient)||u?.fillMode==="pattern"&&!!u.fillPatternPreset,f=ut(u?.fillColor,Pf),h=Math.max(0,u?.strokeWidth||0),m=ut(u?.strokeColor,Fu),x=Hu(l,p,f,h,m),y=Vu(l,p,f,h,m),v=l.type==="shape"&&p?"#ffffff":bi,S=If(l,v),w=ju(l),C=Nf(l),T=ot(l)?l.text:void 0,E=ot(l)?l.textSegments:void 0,M=typeof T=="string"&&T.trim().length>0||(E?.length??0)>0,A=ty(l,C)?cs(l):"";return jsx("div",{className:"absolute overflow-hidden",style:{left:l.x,top:l.y,width:c,height:d,transform:hd(l),transformOrigin:"center"},children:(l.type==="picture"||l.type==="image")&&(l.svgData||l.imageData)?xd(l)?jsx("div",{className:"pointer-events-none w-full h-full",style:Xu(l)}):jsx("img",{src:l.svgData||l.imageData,alt:"",className:"pointer-events-none",style:w,draggable:false}):l.type==="table"?jsx($Oe,{element:l,textStyle:S}):jsxs("div",{className:"relative w-full h-full overflow-hidden",style:x,children:[y,C&&M&&jsx("div",{className:"w-full h-full whitespace-pre-wrap break-words px-1 py-0.5 leading-[1.3]",style:{...Sc(l),...S,transform:kf(l),transformOrigin:"center"},children:Al(l,v)}),!M&&A.length>0&&jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground",children:A})]})},l.id)})]})]})}function $Oe({element:t,textStyle:e}){let n=B1(t,e);if(n)return jsx("div",{className:"w-full h-full overflow-hidden pointer-events-none",children:jsxs("table",{className:"w-full h-full border-collapse table-fixed",children:[n.columnPercentages.length>0&&jsx("colgroup",{children:n.columnPercentages.map((o,i)=>jsx("col",{style:{width:`${o.toFixed(2)}%`}},`${t.id}-tc-${i}`))}),jsx("tbody",{children:n.rows.map((o,i)=>{let s=zn(o["a:tc"]),a=Number.parseInt(String(o["@_h"]||""),10),l=Number.isFinite(a)&&a>0?Math.max(16,a/9525):void 0;return jsx("tr",{style:l?{height:l}:void 0,children:s.map((c,d)=>{let u=c["@_hMerge"]==="1",p=c["@_vMerge"]==="1";if(u||p)return null;let f=Number.parseInt(String(c["@_gridSpan"]||""),10),h=Number.isFinite(f)&&f>1?f:void 0,m=Number.parseInt(String(c["@_rowSpan"]||""),10),x=Number.isFinite(m)&&m>1?m:void 0,y=oy(t,i,d,n.rowCount,n.columnCount);return jsx("td",{className:"border border-gray-300/50 px-1 py-0.5 align-top",colSpan:h,rowSpan:x,style:{...Hm(c,e),...y},children:Df(c)||"\xA0"},`${t.id}-td-${i}-${d}`)})},`${t.id}-tr-${i}`)})})]})});let r=t;if(r.tableData&&r.tableData.rows.length>0){let o=r.tableData;return jsx("div",{className:"w-full h-full overflow-hidden pointer-events-none",children:jsx("table",{className:"w-full h-full border-collapse table-fixed",children:jsx("tbody",{children:o.rows.map((i,s)=>jsx("tr",{style:i.height?{height:i.height}:void 0,children:i.cells.map((a,l)=>{if(a.hMerge||a.vMerge)return null;let c=oy(t,s,l,o.rows.length,i.cells.length);return jsx("td",{className:"border border-gray-300/50 px-1 py-0.5 align-top",colSpan:a.gridSpan&&a.gridSpan>1?a.gridSpan:void 0,rowSpan:a.rowSpan&&a.rowSpan>1?a.rowSpan:void 0,style:{...Gm(a.style),...c},children:a.text||"\xA0"},`${t.id}-tdd-${s}-${l}`)})},`${t.id}-tdr-${s}`))})})})}return jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground pointer-events-none",children:"Table"})}function HOe(t,e){return !(t.slide.id!==e.slide.id||t.slide.isDirty!==e.slide.isDirty||t.slide.hidden!==e.slide.hidden||t.slide.elements!==e.slide.elements||t.slide.backgroundColor!==e.slide.backgroundColor||t.slide.backgroundImage!==e.slide.backgroundImage||t.slide.backgroundGradient!==e.slide.backgroundGradient||t.templateElements!==e.templateElements||t.canvasSize.width!==e.canvasSize.width||t.canvasSize.height!==e.canvasSize.height)}var Qa=Vn__default.memo(UOe,HOe);function CU({contextMenuState:t,mode:e,selectedElement:n,tableEditorState:r,hasMultiSelection:o,onAction:i,onInsertTableRow:s,onDeleteTableRow:a,onInsertTableColumn:l,onDeleteTableColumn:c,onMergeCellRight:d,onMergeCellDown:u,onMergeSelectedCells:p,onSplitCell:f,onClose:h}){let{t:m}=useTranslation();if(!t||e!=="edit")return null;let x=n?.type==="table"&&r!==null,y=x&&r!==null&&Array.isArray(r.selectedCells)&&r.selectedCells.length>=2,v=(()=>{if(!x||!r)return false;let w=n.tableData;if(!w)return false;let C=w.rows[r.rowIndex]?.cells[r.columnIndex];return C?C.gridSpan!==void 0&&C.gridSpan>1||C.rowSpan!==void 0&&C.rowSpan>1:false})();return jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[119]",onClick:h,onContextMenu:S=>{S.preventDefault(),h();}}),jsxs("div",{"data-pptx-context-menu":"true",className:"fixed z-[120] min-w-[180px] rounded border border-border bg-popover shadow-2xl py-1.5 text-xs text-foreground",style:{left:Math.max(t.x,8),top:Math.max(t.y,8)},children:[jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("copy"),children:m("pptx.contextMenu.copy")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("cut"),children:m("pptx.contextMenu.cut")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("paste"),children:m("pptx.contextMenu.paste")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("duplicate"),children:m("pptx.contextMenu.duplicate")}),jsx("div",{className:"my-1 border-t border-border"}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("bring-forward"),children:m("pptx.contextMenu.bringForward")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("send-backward"),children:m("pptx.contextMenu.sendBackward")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("bring-front"),children:m("pptx.contextMenu.bringToFront")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("send-back"),children:m("pptx.contextMenu.sendToBack")}),jsx("div",{className:"my-1 border-t border-border"}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>i("comment"),children:m("pptx.contextMenu.addComment")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{i("editHyperlink"),h();},children:m("pptx.contextMenu.editHyperlink")}),x&&r&&jsxs(Fragment,{children:[jsx("div",{className:"my-1 border-t border-border"}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{s("above"),h();},children:m("pptx.contextMenu.insertRowAbove")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{s("below"),h();},children:m("pptx.contextMenu.insertRowBelow")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{a(),h();},children:m("pptx.contextMenu.deleteRow")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{l("left"),h();},children:m("pptx.contextMenu.insertColumnLeft")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{l("right"),h();},children:m("pptx.contextMenu.insertColumnRight")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{c(),h();},children:m("pptx.contextMenu.deleteColumn")}),jsx("div",{className:"my-1 border-t border-border"}),y&&p&&jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{p(),h();},children:m("pptx.contextMenu.mergeSelectedCells")}),!y&&!v&&d&&jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{d(),h();},children:m("pptx.contextMenu.mergeCells")}),!y&&!v&&u&&jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{u(),h();},children:m("pptx.table.mergeDown")}),v&&f&&jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{f(),h();},children:m("pptx.contextMenu.splitCell")})]}),jsx("div",{className:"my-1 border-t border-border"}),o&&jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{i("group"),h();},children:m("pptx.contextMenu.group")}),n?.type==="group"&&jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left hover:bg-muted",onClick:()=>{i("ungroup"),h();},children:m("pptx.contextMenu.ungroup")}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-left text-red-300 hover:bg-red-900/40",onClick:()=>i("delete"),children:m("pptx.contextMenu.delete")})]})]})}function aee({connectorText:t,connectorTextSegments:e,connectorTextStyle:n}){return !t||!e||e.length===0?null:jsx("div",{className:"absolute inset-0 flex items-center justify-center overflow-hidden",style:{pointerEvents:"none",textAlign:(n?.align==="justLow"||n?.align==="dist"||n?.align==="thaiDist"?"justify":n?.align)??"center"},children:jsx("div",{className:"px-1",style:{fontFamily:n?.fontFamily??"inherit",fontSize:n?.fontSize?`${n.fontSize}pt`:"10pt",color:n?.color??"#000000",fontWeight:n?.bold?"bold":"normal",fontStyle:n?.italic?"italic":"normal",textDecoration:n?.underline?"underline":"none",whiteSpace:"pre-wrap",lineHeight:1.2,maxWidth:"100%"},children:e.map((r,o)=>jsx("span",{style:{fontFamily:r.style?.fontFamily??n?.fontFamily??"inherit",fontSize:r.style?.fontSize?`${r.style.fontSize}pt`:void 0,color:r.style?.color??n?.color??"#000000",fontWeight:r.style?.bold||n?.bold?"bold":"normal",fontStyle:r.style?.italic||n?.italic?"italic":"normal",textDecoration:r.style?.underline?"underline":"none"},children:r.text},o))})})}var MU={touchAction:"none"},GOe=[{handle:"nw",posClass:"-left-1.5 -top-1.5 max-md:-left-2.5 max-md:-top-2.5",cursor:"cursor-nwse-resize"},{handle:"ne",posClass:"-right-1.5 -top-1.5 max-md:-right-2.5 max-md:-top-2.5",cursor:"cursor-nesw-resize"},{handle:"sw",posClass:"-left-1.5 -bottom-1.5 max-md:-left-2.5 max-md:-bottom-2.5",cursor:"cursor-nesw-resize"},{handle:"se",posClass:"-right-1.5 -bottom-1.5 max-md:-right-2.5 max-md:-bottom-2.5",cursor:"cursor-nwse-resize"}],VOe=[{handle:"n",posClass:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2",cursor:"cursor-ns-resize",sizeClass:"w-5 h-2 max-md:w-8 max-md:h-3 rounded-sm"},{handle:"s",posClass:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2",cursor:"cursor-ns-resize",sizeClass:"w-5 h-2 max-md:w-8 max-md:h-3 rounded-sm"},{handle:"e",posClass:"right-0 top-1/2 translate-x-1/2 -translate-y-1/2",cursor:"cursor-ew-resize",sizeClass:"w-2 h-5 max-md:w-3 max-md:h-8 rounded-sm"},{handle:"w",posClass:"left-0 top-1/2 -translate-x-1/2 -translate-y-1/2",cursor:"cursor-ew-resize",sizeClass:"w-2 h-5 max-md:w-3 max-md:h-8 rounded-sm"}];function ZR({elementId:t,adjustmentHandleDescriptor:e,onResizePointerDown:n,onAdjustmentPointerDown:r,forcePointerEvents:o}){let i=o?{...MU,pointerEvents:"auto"}:MU,s=(a,l)=>{a.pointerType!=="mouse"&&(a.stopPropagation(),a.currentTarget.setPointerCapture?.(a.pointerId),n(t,a,l));};return jsxs(Fragment,{children:[GOe.map(({handle:a,posClass:l,cursor:c})=>jsxs("button",{type:"button",className:le("absolute z-10 group",l,c),style:i,onPointerDown:d=>s(d,a),onMouseDown:d=>{d.stopPropagation(),n(t,d,a);},children:[jsx("div",{className:"w-3 h-3 max-md:w-5.5 max-md:h-5.5 rounded-full border border-white bg-primary shadow"}),jsx("div",{className:"absolute -inset-1.5 max-md:-inset-1"})]},a)),VOe.map(({handle:a,posClass:l,cursor:c,sizeClass:d})=>jsxs("button",{type:"button",className:le("absolute z-10",l,c),style:i,onPointerDown:u=>s(u,a),onMouseDown:u=>{u.stopPropagation(),n(t,u,a);},children:[jsx("div",{className:le(d,"border border-white bg-primary shadow")}),jsx("div",{className:"absolute -inset-2 max-md:-inset-1"})]},a)),e?jsx("button",{type:"button","aria-label":"Adjust shape",className:"absolute h-2.5 w-2.5 max-md:h-4 max-md:w-4 rotate-45 border border-amber-700 bg-amber-300 shadow z-10",style:{left:e.left-5,top:e.top,cursor:e.cursor,...MU,...o?{pointerEvents:"auto"}:{}},onPointerDown:a=>{a.pointerType!=="mouse"&&(a.stopPropagation(),a.currentTarget.setPointerCapture?.(a.pointerId),r(t,a));},onMouseDown:a=>{a.stopPropagation(),r(t,a);}}):null]})}var lee=Vn__default.memo(function({el:e,isSelected:n,canInteract:r,showResizeHandles:o,showHoverBorder:i,selectionColorClass:s,opacity:a,zIndex:l,adjustmentHandleDescriptor:c,onResizePointerDown:d,onAdjustmentPointerDown:u,animationState:p}){let f=mn(e)?e:void 0,h=Math.max(e.width,1),m=Math.max(e.height,1),x=f?.shapeStyle,y=Math.max(0,x?.strokeWidth??2),v=ut(x?.strokeColor,Fu),S=Cr(v,x?.strokeOpacity),w=Bm(x?.strokeDash),C=yE(w,Math.max(y,1),x?.customDashSegments),T=x?.connectorStartArrow,E=x?.connectorEndArrow,M=x?.compoundLine,A=e.id.replace(/[^a-zA-Z0-9_-]/g,"_"),R=`${A}-sel-start`,k=`${A}-sel-end`,N=k1(M,y),F=I1(M,y),B=ot(e)?e:void 0,D=B?.text?.trim()??"",O=B?.textSegments,U=B?.textStyle,H=f?R1(f):{pathData:`M 0 0 L ${h} ${m}`,startX:0,startY:0,endX:h,endY:m},j=Math.max(y*3,14),Z=s==="blue-400"?"#60a5fa":"#3b82f6",J=_1(e),W=E1(e);return jsxs("div",{"data-pptx-element":"true","data-element-id":e.id,className:"absolute",style:{left:e.x,top:e.y,width:Math.max(e.width,12),height:Math.max(e.height,12),transform:hd(e),transformOrigin:"center",background:"transparent",border:"none",pointerEvents:"none",opacity:a,zIndex:l,visibility:p?.visible===false?"hidden":"visible",animation:p?.cssAnimation,...W?{filter:W}:{}},children:[jsxs("svg",{viewBox:`0 0 ${h} ${m}`,className:"w-full h-full",preserveAspectRatio:"none",style:{overflow:"visible",pointerEvents:"none"},children:[jsxs("defs",{children:[$m(R,T,S,x?.connectorStartArrowWidth,x?.connectorStartArrowLength),$m(k,E,S,x?.connectorEndArrowWidth,x?.connectorEndArrowLength),J&&jsx("filter",{id:`${A}-line-shadow`,x:"-50%",y:"-50%",width:"200%",height:"200%",children:jsx("feDropShadow",{dx:x?.lineShadowOffsetX??2,dy:x?.lineShadowOffsetY??2,stdDeviation:Math.max(0,(x?.lineShadowBlur??4)/2),floodColor:x?.lineShadowColor??"#000000",floodOpacity:x?.lineShadowOpacity??.35})})]}),n&&jsx("path",{d:H.pathData,fill:"none",stroke:Z,strokeWidth:Math.max(y,2)+6,strokeOpacity:.35,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",style:{pointerEvents:"none"}}),!n&&i&&jsx("path",{d:H.pathData,fill:"none",stroke:"#93c5fd",strokeWidth:Math.max(y,2)+4,strokeOpacity:0,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",className:"transition-[stroke-opacity] duration-150 group-hover:stroke-opacity-40",style:{pointerEvents:"none"}}),jsx("path",{d:H.pathData,fill:"none",stroke:"transparent",strokeWidth:j,strokeLinecap:"round",strokeLinejoin:"round",style:{pointerEvents:"stroke",cursor:r?"move":"default"}}),N.map((te,se)=>jsx("path",{d:H.pathData,fill:"none",stroke:S,strokeWidth:Math.max(F[se]??y,1),strokeDasharray:C,strokeLinecap:"round",strokeLinejoin:"round",markerStart:se===0&&T&&T!=="none"?`url(#${R})`:void 0,markerEnd:se===N.length-1&&E&&E!=="none"?`url(#${k})`:void 0,vectorEffect:"non-scaling-stroke",filter:se===0&&J?`url(#${A}-line-shadow)`:void 0,style:{pointerEvents:"none",...te!==0?{transform:`translate(0, ${te}px)`}:{}}},se)),n&&jsxs(Fragment,{children:[jsx("circle",{cx:H.startX,cy:H.startY,r:4,fill:Z,stroke:"white",strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("circle",{cx:H.endX,cy:H.endY,r:4,fill:Z,stroke:"white",strokeWidth:1.5,style:{pointerEvents:"none"}})]})]}),O&&jsx(aee,{connectorText:D,connectorTextSegments:O,connectorTextStyle:U}),o&&jsx(ZR,{elementId:e.id,adjustmentHandleDescriptor:c,onResizePointerDown:d,onAdjustmentPointerDown:u,forcePointerEvents:true})]})});function cee(t){if(!$F(t))return null;let e=t.shapeStyle?.dagDuotone;return e?HF(t.id,e.color1,e.color2):null}function dee({el:t,isFullscreenMedia:e,isImg:n,zIndex:r,opacity:o,animationState:i,shapeVisualStyle:s,has3DExtrusion:a}){let l=a?"visible":n?"hidden":void 0;return {left:e?0:t.x,top:e?0:t.y,width:e?"100%":Math.max(t.width,12),height:e?"100%":Math.max(t.height,12),transform:e?"none":hd(t),transformOrigin:"center",overflow:l,clipPath:n&&!a?N1(t):void 0,zIndex:e?20:r,opacity:o,visibility:i?.visible===false?"hidden":"visible",animation:i?.cssAnimation,background:e?"#000":void 0,transition:e?"left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease":void 0,borderColor:e?"transparent":void 0,...s}}function uee({clickTooltip:t,hoverTooltip:e}){return jsx("div",{className:"absolute -top-1 -right-1 z-20 w-4 h-4 rounded-full bg-amber-500 flex items-center justify-center shadow",title:t||e||"Has action",children:jsx("svg",{className:"w-2.5 h-2.5 text-white",viewBox:"0 0 24 24",fill:"currentColor",children:jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})})})}function pee(t,e,n,r){let o=r!==void 0?r/44444:1,i=.2*Math.max(0,Math.min(o,4)),s=e*(.2+n*.6),a=s+e*i/2,l=s-e*i/2;return `M 0,${a} L ${t},${l}`}function fee(t,e,n,r){let o=r!==void 0?r/44444:1,i=.2*Math.max(0,Math.min(o,4)),s=e*(.2+n*.6),a=s-e*i/2,l=s+e*i/2;return `M 0,${a} L ${t},${l}`}var YOe=new Set(["textArchUp","textArchDown","textCircle","textWave1","textInflate","textDeflate","textCurveUp","textCurveDown","textWave2","textWave4","textDoubleWave1","textCanUp","textCanDown","textButton","textRingInside","textRingOutside","textCascadeUp","textCascadeDown","textTriangle","textTriangleInverted","textStop","textChevron","textChevronInverted","textInflateBottom","textInflateTop","textDeflateBottom","textDeflateTop","textSlantUp","textSlantDown","textFadeRight","textFadeLeft","textFadeUp","textFadeDown","textArchUpPour","textArchDownPour","textCirclePour","textButtonPour","textDeflateInflate","textDeflateInflateDeflate"]);function qOe(t,e,n,r){let i=.85*(r!==void 0?Math.max(0,Math.min(r/216e5,1)):.5)/.5,s=e*Math.max(0,i-n*.7);return s<1?`M 0,${e} L ${t},${e}`:`M 0,${e} A ${t/2},${s} 0 0,1 ${t},${e}`}function KOe(t,e,n,r){let i=.15*(r!==void 0?Math.max(0,Math.min(r/216e5,1)):.5)/.5,s=e*(i+n*.7);return s<1?`M 0,0 L ${t},0`:`M 0,0 A ${t/2},${s} 0 0,0 ${t},0`}function ZOe(t,e,n,r){let o=t/2,i=e/2,a=.45+(r!==void 0?Math.max(0,Math.min(r/216e5,1)):.5)*1.1,l=Math.min(1,a)-n*.55,c=Math.max(1,t/2*l),d=Math.max(1,e/2*l);return `M ${o},${i-d} A ${c},${d} 0 1,1 ${o},${i+d} A ${c},${d} 0 1,1 ${o},${i-d}`}function JOe(t,e,n,r,o){let i=e*(.25+n*.5),s=r!==void 0?r/12500:1,a=e*.2*Math.max(0,Math.min(s,4)),l=o!==void 0?o/1e5*t*.3:0,c=t/3+l,d=2*t/3+l;return `M 0,${i} C ${c},${i-a} ${d},${i+a} ${t},${i}`}function QOe(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=e*.3*(1-2*n)*Math.max(0,Math.min(i,4));return `M 0,${o} Q ${t/2},${o-s} ${t},${o}`}function e4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=e*.3*(2*n-1)*Math.max(0,Math.min(i,4));return `M 0,${o} Q ${t/2},${o-s} ${t},${o}`}function t4e(t,e,n,r){let o=e*(.35+n*.55),i=r!==void 0?r/45977:1,s=e*.4*(1-n*.3)*Math.max(0,Math.min(i,4));return `M 0,${o} Q ${t/2},${o-s} ${t},${o}`}function n4e(t,e,n,r){let o=e*(.1+n*.55),i=r!==void 0?r/45977:1,s=e*.4*(1-(1-n)*.3)*Math.max(0,Math.min(i,4));return `M 0,${o} Q ${t/2},${o+s} ${t},${o}`}function r4e(t,e,n,r,o){let i=e*(.25+n*.5),s=r!==void 0?r/12500:1,a=e*.2*Math.max(0,Math.min(s,4)),l=o!==void 0?o/1e5*t*.3:0,c=t/3+l,d=2*t/3+l;return `M 0,${i} C ${c},${i+a} ${d},${i-a} ${t},${i}`}function o4e(t,e,n,r,o){let i=e*(.25+n*.5),s=r!==void 0?r/12500:1,a=e*.15*Math.max(0,Math.min(s,4)),l=o!==void 0?o/1e5*t*.15:0,c=t/4;return `M 0,${i} C ${c+l},${i-a} ${2*c+l},${i+a} ${t/2},${i} C ${t/2+c+l},${i-a} ${t-c+l},${i+a} ${t},${i}`}function i4e(t,e,n,r,o){let i=e*(.25+n*.5),s=r!==void 0?r/6250:1,a=e*.18*Math.max(0,Math.min(s,4)),l=o!==void 0?o/1e5*t*.15:0,c=t/4;return `M 0,${i} C ${c+l},${i-a} ${2*c+l},${i+a} ${t/2},${i} C ${t/2+c+l},${i+a} ${t-c+l},${i-a} ${t},${i}`}function s4e(t,e,n,r){let o=r!==void 0?r/18750:1,i=Math.max(0,Math.min(o,4)),s=e*(.35-n*.25)*i;return s<1?`M 0,${e} L ${t},${e}`:`M 0,${e} A ${t/2},${s} 0 0,1 ${t},${e}`}function a4e(t,e,n,r){let o=r!==void 0?r/18750:1,i=Math.max(0,Math.min(o,4)),s=e*(.1+n*.25)*i;return s<1?`M 0,0 L ${t},0`:`M 0,0 A ${t/2},${s} 0 0,0 ${t},0`}function l4e(t,e,n,r){let o=e*(.1+n*.8),i=r!==void 0?r/18750:1,s=e*.15*(1-2*n)*Math.max(0,Math.min(i,4));return `M 0,${o} Q ${t/2},${o-s} ${t},${o}`}function c4e(t,e,n,r){let o=t/2,i=e/2,s=r!==void 0?r/18750:1,a=.35*Math.max(0,Math.min(s,4)),l=.7-n*a,c=Math.max(1,t/2*l),d=Math.max(1,e/2*l);return `M ${o},${i-d} A ${c},${d} 0 1,1 ${o},${i+d} A ${c},${d} 0 1,1 ${o},${i-d}`}function d4e(t,e,n,r){let o=t/2,i=e/2,s=r!==void 0?r/18750:1,a=.35*Math.max(0,Math.min(s,4)),l=1-n*a,c=Math.max(1,t/2*l),d=Math.max(1,e/2*l);return `M ${o},${i-d} A ${c},${d} 0 1,1 ${o},${i+d} A ${c},${d} 0 1,1 ${o},${i-d}`}function u4e(t,e,n,r){let o=r!==void 0?r/1e5:.5,i=t*(1-Math.max(0,Math.min(o,1)))*.3,s=i+n*(t-i),a=(t-s)/2,l=e*(.1+n*.8);return `M ${a},${l} L ${a+s},${l}`}function p4e(t,e,n,r){let o=r!==void 0?r/1e5:.5,i=t*(1-Math.max(0,Math.min(o,1)))*.3,s=t-n*(t-i),a=(t-s)/2,l=e*(.1+n*.8);return `M ${a},${l} L ${a+s},${l}`}function f4e(t,e,n,r){let o=r!==void 0?r/25e3:1,i=Math.max(0,Math.min(o,4)),s=t*.15*(1-(1-2*Math.abs(n-.5))**2)*i,a=e*(.1+n*.8);return `M ${s},${a} L ${t-s},${a}`}function h4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/25e3:1,s=e*.2*(1-n)*Math.max(0,Math.min(i,4));return `M 0,${o} L ${t/2},${o+s} L ${t},${o}`}function m4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/25e3:1,s=e*.2*n*Math.max(0,Math.min(i,4));return `M 0,${o} L ${t/2},${o-s} L ${t},${o}`}function g4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=n>.4?e*.25*((n-.4)/.6)*Math.max(0,Math.min(i,4)):0;return `M 0,${o} Q ${t/2},${o+s} ${t},${o}`}function x4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=n<.6?e*.25*((.6-n)/.6)*Math.max(0,Math.min(i,4)):0;return `M 0,${o} Q ${t/2},${o-s} ${t},${o}`}function y4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=n>.4?e*.2*((n-.4)/.6)*Math.max(0,Math.min(i,4)):0;return `M 0,${o} Q ${t/2},${o-s} ${t},${o}`}function b4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=n<.6?e*.2*((.6-n)/.6)*Math.max(0,Math.min(i,4)):0;return `M 0,${o} Q ${t/2},${o+s} ${t},${o}`}function v4e(t,e,n,r){let o=r!==void 0?r/55e3:1,i=.25*Math.max(0,Math.min(o,4)),s=e*(.175+n*.55),a=s+e*i/2,l=s-e*i/2;return `M 0,${a} L ${t},${l}`}function S4e(t,e,n,r){let o=r!==void 0?r/55e3:1,i=.25*Math.max(0,Math.min(o,4)),s=e*(.175+n*.55),a=s-e*i/2,l=s+e*i/2;return `M 0,${a} L ${t},${l}`}function w4e(t,e,n,r){let o=r!==void 0?r/5e4:1,i=Math.max(0,Math.min(o,4)),s=e*(.1+n*.8),a=.35*(1-2*n)*i,l=e*(.5+a*.4);return `M 0,${s} L ${t},${l}`}function C4e(t,e,n,r){let o=r!==void 0?r/5e4:1,i=Math.max(0,Math.min(o,4)),s=.35*(1-2*n)*i,a=e*(.5+s*.4),l=e*(.1+n*.8);return `M 0,${a} L ${t},${l}`}function T4e(t,e,n,r){let o=r!==void 0?r/5e4:1,s=1-.7*Math.max(0,Math.min(o,4)),a=t*Math.max(0,s),l=a+n*(t-a),c=(t-l)/2,d=e*(.1+n*.8);return `M ${c},${d} L ${c+l},${d}`}function M4e(t,e,n,r){let o=r!==void 0?r/5e4:1,s=1-.7*Math.max(0,Math.min(o,4)),a=t*Math.max(0,s),l=t-n*(t-a),c=(t-l)/2,d=e*(.1+n*.8);return `M ${c},${d} L ${c+l},${d}`}function _4e(t,e,n,r){let i=.7*(r!==void 0?Math.max(0,Math.min(r/216e5,1)):.5)/.5,s=e*Math.max(0,i-n*.5);return s<1?`M 0,${e} L ${t},${e}`:`M 0,${e} A ${t/2},${s} 0 0,1 ${t},${e}`}function E4e(t,e,n,r){let i=.2*(r!==void 0?Math.max(0,Math.min(r/216e5,1)):.5)/.5,s=e*(i+n*.5);return s<1?`M 0,0 L ${t},0`:`M 0,0 A ${t/2},${s} 0 0,0 ${t},0`}function A4e(t,e,n,r){let o=t/2,i=e/2,s=r!==void 0?Math.max(0,Math.min(r/216e5,1)):.5,a=.35+Number(s),l=Math.min(1,a)-n*.45,c=Math.max(1,t/2*l),d=Math.max(1,e/2*l);return `M ${o},${i-d} A ${c},${d} 0 1,1 ${o},${i+d} A ${c},${d} 0 1,1 ${o},${i-d}`}function P4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=e*.12*(1-2*n)*Math.max(0,Math.min(i,4));return `M 0,${o} Q ${t/2},${o-s} ${t},${o}`}function R4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=Math.sin(n*Math.PI),a=e*.2*(s-.5)*Math.max(0,Math.min(i,4));return `M 0,${o} Q ${t/2},${o-a} ${t},${o}`}function k4e(t,e,n,r){let o=e*(.15+n*.7),i=r!==void 0?r/18750:1,s=Math.max(0,Math.min(i,4)),a=Math.sin(n*Math.PI*2),l=e*.15*a*s,c=t/3,d=2*t/3;return `M 0,${o} Q ${c},${o-l} ${t/2},${o} Q ${d},${o+l} ${t},${o}`}var I4e={textArchUp:qOe,textArchDown:KOe,textCircle:ZOe,textWave1:JOe,textInflate:QOe,textDeflate:e4e,textCurveUp:t4e,textCurveDown:n4e,textWave2:r4e,textWave4:o4e,textDoubleWave1:i4e,textCanUp:s4e,textCanDown:a4e,textButton:l4e,textRingInside:c4e,textRingOutside:d4e,textCascadeUp:pee,textCascadeDown:fee,textTriangle:u4e,textTriangleInverted:p4e,textStop:f4e,textChevron:h4e,textChevronInverted:m4e,textInflateBottom:g4e,textInflateTop:x4e,textDeflateBottom:y4e,textDeflateTop:b4e,textSlantUp:v4e,textSlantDown:S4e,textFadeRight:w4e,textFadeLeft:C4e,textFadeUp:T4e,textFadeDown:M4e,textArchUpPour:_4e,textArchDownPour:E4e,textCirclePour:A4e,textButtonPour:P4e,textDeflateInflate:R4e,textDeflateInflateDeflate:k4e};function $T(t){return !t||t==="textNoShape"||t==="textPlain"?false:YOe.has(t)}function AU(t,e,n,r,o,i,s){let a=o<=1?.5:r/(o-1),l=I4e[t];if(l)return l(e,n,a,i,s);let c=n*(.2+a*.6);return `M 0,${c} L ${e},${c}`}function N4e(t,e){if(!t.textSegments||t.textSegments.length===0)return t.text?[{segments:[{text:t.text,style:{}}]}]:[];let n=[],r=[];for(let o of t.textSegments)if(o.isParagraphBreak)r.length>0&&n.push({segments:r}),r=[];else {let i=o;if(o.fieldType&&e){let s=y1(o.text,o.fieldType,e);s!==o.text&&(i={...o,text:s});}r.push(i);}return r.length>0&&n.push({segments:r}),n}function D4e(t){switch(t){case "center":return {startOffset:"50%",textAnchor:"middle"};case "right":return {startOffset:"100%",textAnchor:"end"};default:return {startOffset:"0%",textAnchor:"start"}}}function L4e(t,e,n){let r=t.style||{},o=[];return (r.underline||r.hyperlink)&&o.push("underline"),r.strikethrough&&o.push("line-through"),{fill:r.hyperlink?ut(r.color||e.textStyle?.color,Vx):ut(r.color||e.textStyle?.color,n),fontSize:r.fontSize??e.textStyle?.fontSize??24,fontWeight:r.bold?700:400,fontStyle:r.italic?"italic":void 0,fontFamily:r.fontFamily||e.textStyle?.fontFamily?a1(r.fontFamily||e.textStyle?.fontFamily||""):Dm,textDecoration:o.length>0?o.join(" "):void 0}}function QR({element:t,width:e,height:n,fallbackColor:r,fieldContext:o}){if(!ot(t))return null;let i=t,s=i.textStyle?.textWarpPreset;if(!s||!$T(s))return null;let a=N4e(i,o);if(a.length===0)return null;let l=a.length,c=`warp-${t.id}`,d=i.textStyle?.textWarpAdj,u=i.textStyle?.textWarpAdj2,p=i.textStyle?.align??"center",{startOffset:f,textAnchor:h}=D4e(p),m=i.textStyle?.fontSize??24,x=i.textStyle?.fontFamily?a1(i.textStyle.fontFamily):Dm,y=ut(i.textStyle?.color,r);return jsxs("svg",{width:e,height:n,viewBox:`0 0 ${e} ${n}`,xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible",position:"absolute",inset:0,pointerEvents:"none"},"aria-hidden":"true",children:[jsx("defs",{children:a.map((v,S)=>jsx("path",{id:`${c}-${S}`,d:AU(s,e,n,S,l,d,u),fill:"none"},`${c}-def-${S}`))}),a.map((v,S)=>jsx("text",{fontSize:m,fontFamily:x,fill:y,fontWeight:i.textStyle?.bold?700:400,fontStyle:i.textStyle?.italic?"italic":"normal",children:jsx("textPath",{href:`#${c}-${S}`,startOffset:f,textAnchor:h,children:v.segments.map((w,C)=>jsx("tspan",{...L4e(w,i,r),children:w.text},`${c}-ts-${S}-${C}`))})},`${c}-txt-${S}`))]})}var qb=Object.fromEntries(Lm.map(t=>[t.shapeType,t.iconPath]));qb.actionButtonForwardOrNext=qb.actionButtonForwardNext;qb.actionButtonBackOrPrevious=qb.actionButtonBackPrevious;function mee(t){return !!(t&&t in qb)}function B4e(t){if(!t)return;let e=qb[t];return e&&e.length>0?e:void 0}function gee({element:t,color:e}){let n="shapeType"in t?t.shapeType:void 0,r=B4e(n);if(!r)return null;let o=e??("textStyle"in t&&t.textStyle?.color||"#ffffff");return jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid meet",style:{position:"absolute",inset:0,pointerEvents:"none",padding:"20%"},"aria-hidden":"true",children:jsx("path",{d:r,fill:"none",stroke:o,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})}function xee({src:t,clrChange:e,tolerancePct:n,style:r,className:o,alt:i}){let s=n??sU,a=zQ(t,e.clrFrom,e.clrTo,s,!!e.clrToTransparent),l=XR(a),[c,d]=useState(l??null);return useEffect(()=>{if(XR(a)){d(XR(a)??null);return}let u=false;return HQ(t,e.clrFrom,e.clrTo,s,!!e.clrToTransparent).then(p=>{u||(GQ(a,p.dataUrl),d(p.dataUrl));}).catch(()=>{}),()=>{u=true;}},[t,a,e.clrFrom,e.clrTo,s,e.clrToTransparent]),jsx("img",{src:c??t,alt:i,className:o,style:r,draggable:false,onError:u=>{u.currentTarget.style.display="none";}})}function H4e(t,e,n){let r=t.length;for(let o=0;o<r;o+=4){let s=(.2126*t[o]+.7152*t[o+1]+.0722*t[o+2])/255,a=1-s;t[o]=Math.round(e.r*a+n.r*s),t[o+1]=Math.round(e.g*a+n.g*s),t[o+2]=Math.round(e.b*a+n.b*s);}}function yee(t,e,n){return new Promise((r,o)=>{let i=FT(e),s=FT(n);if(!i||!s){o(new Error(`Invalid hex colour: shadow="${e}" highlight="${n}"`));return}let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{let{naturalWidth:l,naturalHeight:c}=a;if(l===0||c===0){o(new Error("Image has zero dimensions"));return}let d=document.createElement("canvas");d.width=l,d.height=c;let u=d.getContext("2d");if(!u){o(new Error("Cannot create 2D canvas context"));return}u.drawImage(a,0,0);let p=u.getImageData(0,0,l,c);H4e(p.data,i,s),u.putImageData(p,0,0),r({dataUrl:d.toDataURL("image/png"),width:l,height:c});},a.onerror=()=>{o(new Error("Failed to load image for duotone processing"));},a.src=t;})}var zT=new Map,z4e=64;function bee(t,e,n){return `dt|${t.length>64?t.slice(0,64):t}|${e}|${n}`}function PU(t){return zT.get(t)}function vee(t,e){if(zT.size>=z4e){let n=zT.keys().next().value;n!==void 0&&zT.delete(n);}zT.set(t,e);}var See=[{labelKey:"pptx.image.duotonePresetNavyGold",shadow:"#000080",highlight:"#FFD700"},{labelKey:"pptx.image.duotonePresetTealWhite",shadow:"#004D4D",highlight:"#FFFFFF"},{labelKey:"pptx.image.duotonePresetPurplePink",shadow:"#2D004B",highlight:"#FF69B4"},{labelKey:"pptx.image.duotonePresetBlueOrange",shadow:"#001F4D",highlight:"#FF8C00"},{labelKey:"pptx.image.duotonePresetGreenYellow",shadow:"#003300",highlight:"#CCFF00"},{labelKey:"pptx.image.duotonePresetRedCream",shadow:"#4D0000",highlight:"#FFFDD0"},{labelKey:"pptx.image.duotonePresetBlackWhite",shadow:"#000000",highlight:"#FFFFFF"},{labelKey:"pptx.image.duotonePresetSepiaWarm",shadow:"#3B2614",highlight:"#F5DEB3"}];function wee({src:t,duotone:e,style:n,className:r,alt:o}){let i=bee(t,e.color1,e.color2),s=PU(i),[a,l]=useState(s??null);return useEffect(()=>{let c=PU(i);if(c){l(c);return}let d=false;return yee(t,e.color1,e.color2).then(u=>{d||(vee(i,u.dataUrl),l(u.dataUrl));}).catch(()=>{}),()=>{d=true;}},[t,i,e.color1,e.color2]),jsx("img",{src:a??t,alt:o,className:r,style:n,draggable:false,onError:c=>{c.currentTarget.style.display="none";}})}function Cee(t){return "svgData"in t&&t.svgData?t.svgData:"imageData"in t?t.imageData:void 0}function ek(t,e,n,r,o){let i=Cee(t);if(!i){let m="imagePath"in t?t.imagePath:void 0;if(m){let x=m.split(".").pop()?.toLowerCase();if(x==="emf"||x==="wmf")return jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center text-[11px] text-gray-400 bg-gray-50 border border-dashed border-gray-200 rounded",children:[jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-1 text-gray-300",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),jsxs("span",{children:[x.toUpperCase()," metafile"]})]})}return jsx("div",{className:"w-full h-full flex items-center justify-center text-[11px] text-gray-500 bg-gray-100",children:"Image"})}let s={...n?{filter:n}:{},...o!==void 0?{opacity:o}:{}},a=yi(t)?t.imageEffects?.artisticEffect:void 0,l=yi(t)?t.imageEffects?.artisticRadius??5:5;if(xd(t)){if(!Cee(t))return jsx("div",{className:"w-full h-full flex items-center justify-center text-[11px] text-gray-500 bg-gray-100",children:"Image"});let x=_E(t);return jsxs(Fragment,{children:[x&&ME(t.id,x.color1,x.color2),FF(t.id,a,l),UF(t),jsx("div",{className:"pointer-events-none select-none w-full h-full",style:{...Xu(t),...s}})]})}let c="imageEffects"in t?t.imageEffects?.colorWash:void 0,d="imageEffects"in t?t.imageEffects?.clrChange:void 0,u=_E(t),p=!!(u&&!d),f=p?A1(t,{excludeDuotone:true}):n,h={...f?{filter:f}:{},...o!==void 0?{opacity:o}:{}};return jsxs(Fragment,{children:[u&&!p&&ME(t.id,u.color1,u.color2),FF(t.id,a,l),UF(t),p&&u?jsx(wee,{src:i,duotone:u,alt:r,className:"pointer-events-none select-none",style:{...e,...h}}):d?jsx(xee,{src:i,clrChange:d,alt:r,className:"pointer-events-none select-none",style:{...e,...s}}):jsx("img",{src:i,alt:r,className:"pointer-events-none select-none",style:{...e,...s},draggable:false,onError:m=>{m.currentTarget.style.display="none";}}),c&&jsx("div",{className:"pointer-events-none absolute inset-0",style:{backgroundColor:c.color,opacity:c.opacity/100}})]})}function RU(t,e,n,r,o,i){let s=WR(t),a=jQ(s,e,{baseWidth:n,minRadius:.5,maxRadius:n*1.5});return jsx("g",{opacity:o,children:a.map((l,c)=>jsx("circle",{cx:l.cx,cy:l.cy,r:l.r,fill:r},`${i}-pc-${c}`))})}function Mee(t,e){let n=e?.replay??false;!!t.inkPointPressures&&t.inkPointPressures.length>0;!!t.inkWidths&&t.inkWidths.length>1&&BT(t.inkWidths);let a=n?qQ(t,e?.replayConfig):null;return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${Math.max(t.width,1)} ${Math.max(t.height,1)}`,preserveAspectRatio:"none",children:[n&&jsx("style",{children:uU}),t.inkPaths.map((l,c)=>{let d=JQ(t.inkColors,c),u=QQ(t.inkWidths,c),p=ZQ(t.inkOpacities,c);{let h=t.inkPointPressures?.[c];if(h&&h.length>1&&BT(h)){let m=dU(h,u);return jsx("g",{children:RU(l,m,u,d,p,`${t.id}-ink-${c}`)},`${t.id}-ink-${c}`)}if(t.inkWidths&&t.inkWidths.length>1&&BT(t.inkWidths))return jsx("g",{children:RU(l,t.inkWidths,u,d,p,`${t.id}-ink-${c}`)},`${t.id}-ink-${c}`)}let f=a?.[c];return jsx("path",{d:l,fill:"none",stroke:d,strokeWidth:u,strokeOpacity:p,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",...f?{strokeDasharray:f.strokeDasharray,strokeDashoffset:f.strokeDashoffset,style:{animation:f.animation,"--ink-path-length":f.pathLength}}:{}},`${t.id}-ink-${c}`)})]})}function _ee(t){return jsx("div",{className:"relative w-full h-full pointer-events-none",children:t.map((e,n)=>{let{hf:r,fc:o,sw:i,sc:s}=kU(e),a=Hu(e,r,o,i,s),l=Vu(e,r,o,i,s),c=If(e,bi),d=Nf(e),u=e.type==="picture"||e.type==="image";return jsx("div",{className:"absolute",style:{left:e.x,top:e.y,width:Math.max(e.width,12),height:Math.max(e.height,12),transform:hd(e),transformOrigin:"center",overflow:u?"hidden":void 0,clipPath:u?N1(e):void 0,...a,zIndex:n},children:u&&("svgData"in e&&e.svgData||"imageData"in e&&e.imageData)?xd(e)?jsx("div",{className:"pointer-events-none select-none w-full h-full",style:Xu(e)}):jsx("img",{src:"svgData"in e&&e.svgData?e.svgData:e.imageData,alt:"Group child",className:"pointer-events-none select-none",style:ju(e),draggable:false}):jsxs(Fragment,{children:[l,d?jsx("div",{className:"relative z-10 w-full h-full pointer-events-none whitespace-pre-wrap break-words leading-[1.3]",style:c,children:Al(e,bi)}):null]})},e.id)})})}function Eee(t,e){if(t.inkStrokes&&t.inkStrokes.length>0){let n=e?.replay??false,r=e?.pressureSensitive??true,o=n?KQ(t.inkStrokes,e?.replayConfig):null;return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${Math.max(t.width,1)} ${Math.max(t.height,1)}`,preserveAspectRatio:"none",children:[n&&jsx("style",{children:uU}),t.inkStrokes.map((i,s)=>{if(r&&i.pressures&&i.pressures.length>1&&BT(i.pressures)){let l=dU(i.pressures,i.width);return jsx("g",{children:RU(i.path,l,i.width,i.color,i.opacity,`${t.id}-cp-ink-${s}`)},`${t.id}-cp-ink-${s}`)}let a=o?.[s];return jsx("path",{d:i.path,fill:"none",stroke:i.color,strokeWidth:i.width,strokeOpacity:i.opacity,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",...a?{strokeDasharray:a.strokeDasharray,strokeDashoffset:a.strokeDashoffset,style:{animation:a.animation,"--ink-path-length":a.pathLength}}:{}},`${t.id}-cp-ink-${s}`)})]})}return jsx("div",{className:"w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none",children:"Content Part"})}function Aee(t){if(t.oleObjectType&&t.oleObjectType!=="package"&&t.oleObjectType!=="unknown")return t.oleObjectType;let e=t.oleProgId?.toLowerCase()??"";return e.includes("excel")?"excel":e.includes("word")?"word":e.includes("acroexch")||e.includes("acrobat")||e.includes("pdf")?"pdf":e.includes("visio")?"visio":e.includes("equation")||e.includes("mathtype")?"mathtype":"unknown"}function Pee(t){switch(t){case "excel":return "#217346";case "word":return "#2B579A";case "pdf":return "#D4272E";case "visio":return "#3955A3";case "mathtype":return "#7B2D8E";default:return "#666666"}}function Ree(t){switch(t){case "excel":return "Excel Spreadsheet";case "word":return "Word Document";case "pdf":return "PDF Document";case "visio":return "Visio Diagram";case "mathtype":return "Math Equation";default:return "Embedded Object"}}function X4e(t,e=32){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9",stroke:t,strokeWidth:"1"}),jsx("line",{x1:"3",y1:"15",x2:"21",y2:"15",stroke:t,strokeWidth:"1"}),jsx("line",{x1:"9",y1:"3",x2:"9",y2:"21",stroke:t,strokeWidth:"1"}),jsx("line",{x1:"15",y1:"3",x2:"15",y2:"21",stroke:t,strokeWidth:"1"})]})}function W4e(t,e=32){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("line",{x1:"7",y1:"7",x2:"17",y2:"7",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"7",y1:"11",x2:"17",y2:"11",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"7",y1:"15",x2:"13",y2:"15",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"})]})}function Y4e(t,e=32){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("text",{x:"12",y:"14",textAnchor:"middle",fill:t,fontSize:"7",fontWeight:"bold",children:"PDF"})]})}function q4e(t,e=32){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx("rect",{x:"8",y:"2",width:"8",height:"5",rx:"1",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("line",{x1:"12",y1:"7",x2:"12",y2:"10",stroke:t,strokeWidth:"1.5"}),jsx("line",{x1:"6",y1:"10",x2:"18",y2:"10",stroke:t,strokeWidth:"1.5"}),jsx("line",{x1:"6",y1:"10",x2:"6",y2:"13",stroke:t,strokeWidth:"1.5"}),jsx("line",{x1:"18",y1:"10",x2:"18",y2:"13",stroke:t,strokeWidth:"1.5"}),jsx("rect",{x:"2",y:"13",width:"8",height:"5",rx:"1",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("rect",{x:"14",y:"13",width:"8",height:"5",rx:"1",stroke:t,strokeWidth:"1.5",fill:"none"})]})}function K4e(t,e=32){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("text",{x:"12",y:"15",textAnchor:"middle",fill:t,fontSize:"9",fontStyle:"italic",fontWeight:"bold",children:"f(x)"})]})}function Z4e(t,e=32){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[jsx("rect",{x:"2",y:"5",width:"9",height:"7",rx:"1.5",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("rect",{x:"13",y:"12",width:"9",height:"7",rx:"1.5",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("line",{x1:"11",y1:"8.5",x2:"13",y2:"15.5",stroke:t,strokeWidth:"1.5",strokeLinecap:"round"})]})}function J4e(t,e,n=32){switch(t){case "excel":return X4e(e,n);case "word":return W4e(e,n);case "pdf":return Y4e(e,n);case "visio":return q4e(e,n);case "mathtype":return K4e(e,n);default:return Z4e(e,n)}}function Q4e(t){let e=Aee(t),n=Ree(e);return t.fileName?`${n}: ${t.fileName}`:n}function eUe(t){let e=Pee(t),n=t==="unknown"?"OLE":t.toUpperCase();return jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",className:"absolute bottom-1 right-1 z-10",children:[jsx("rect",{x:"2",y:"2",width:"20",height:"20",rx:"3",fill:e}),jsx("text",{x:"12",y:"16",textAnchor:"middle",fill:"white",fontSize:n.length>4?"6":"10",fontWeight:"bold",children:n})]})}function kee(t){let e=Aee(t),n=Q4e(t);if(t.previewImageData)return jsxs("div",{className:"relative w-full h-full",role:"img","aria-label":n,title:"Double-click to open",children:[jsx("img",{src:t.previewImageData,alt:n,className:"pointer-events-none select-none w-full h-full object-contain",draggable:false}),eUe(e)]});let r=Pee(e),o=Ree(e),i=t.fileName??o;return jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center pointer-events-none",role:"img","aria-label":n,title:"Double-click to open",style:{border:`2px solid ${r}33`,borderRadius:6,backgroundColor:`${r}0D`},children:[J4e(e,r,36),jsx("span",{className:"mt-2 text-[12px] font-medium max-w-[90%] truncate",style:{color:r},children:i}),t.fileName&&jsx("span",{className:"mt-0.5 text-[10px] text-white/50 max-w-[90%] truncate",children:o})]})}var IU=null;function Dee(t){IU=t;}function Lee(){let t=IU;return IU=null,t}function Fee(t){if(!t||t.length===0)return null;let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return null;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}=e;if(!n||!o)return null;let s=nUe(n);if(!s||!s.contains(o))return null;let a=Iee(s,n,r,t),l=Iee(s,o,i,t);if(!a||!l)return null;let[c,d]=a.absOffset<=l.absOffset?[a,l]:[l,a];return {startSegIdx:c.segIdx,startOffset:c.offsetInSeg,endSegIdx:d.segIdx,endOffset:d.offsetInSeg}}function nUe(t){return (t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest("[data-inline-editor]")??null}function Iee(t,e,n,r){let o=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(!o)return null;let i=o.closest("[data-seg-idx]");if(!i||!t.contains(i))return null;let s=parseInt(i.getAttribute("data-seg-idx"),10);if(isNaN(s)||s<0||s>=r.length)return null;let a=rUe(i,e,n),l=0;for(let c=0;c<s;c++)l+=r[c].text.length;return l+=a,{segIdx:s,offsetInSeg:a,absOffset:l}}function rUe(t,e,n){if(e===t||e.nodeType===Node.ELEMENT_NODE){let s=e===t?t:e,a=0;for(let l=0;l<n&&l<s.childNodes.length;l++)a+=(s.childNodes[l].textContent||"").length;return a}let r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),o=0,i;for(;i=r.nextNode();){if(i===e)return o+n;o+=i.length;}return o}function Bee(t,e,n){let{startSegIdx:r,startOffset:o,endSegIdx:i,endOffset:s}=e,a=[],l=-1,c=0,d=-1,u=0;for(let p=0;p<t.length;p++){let f=t[p];if(f.isParagraphBreak||f.text===`
|
|
4661
|
-
`){a.push({...f,style:{...f.style}});continue}if(p<r){a.push({...f,style:{...f.style}});continue}if(p>i){a.push({...f,style:{...f.style}});continue}if(p===r&&p===i){oUe(f,o,s,n,a);let h=(o>0?1:0)+1+(s<f.text.length?1:0),m=a.length-h+(o>0?1:0);l=m,c=0,d=m,u=s-o;continue}if(p===r){if(o===0)l=a.length,c=0,a.push({...f,style:{...f.style,...n}});else {let h={text:f.text.slice(0,o),style:{...f.style}};f.bulletInfo&&(h.bulletInfo=f.bulletInfo),a.push(h),l=a.length,c=0,a.push({text:f.text.slice(o),style:{...f.style,...n}});}continue}if(p===i){s>=f.text.length?(a.push({...f,style:{...f.style,...n}}),d=a.length-1,u=f.text.length):(a.push({text:f.text.slice(0,s),style:{...f.style,...n}}),d=a.length-1,u=s,a.push({text:f.text.slice(s),style:{...f.style}}));continue}a.push({...f,style:{...f.style,...n}});}return {newSegments:a,newSelection:{startSegIdx:l,startOffset:c,endSegIdx:d,endOffset:u}}}function oUe(t,e,n,r,o){if(e===0&&n>=t.text.length){o.push({...t,style:{...t.style,...r}});return}if(e>0){let i={text:t.text.slice(0,e),style:{...t.style}};t.bulletInfo&&(i.bulletInfo=t.bulletInfo),o.push(i);}o.push({text:t.text.slice(e,n),style:{...t.style,...r}}),n<t.text.length&&o.push({text:t.text.slice(n),style:{...t.style}});}function Oee(t,e,n,r,o){let i=window.getSelection();if(!i)return;let s=Nee(t,e,n),a=Nee(t,r,o);if(!s||!a)return;let l=document.createRange();l.setStart(s.node,s.offset),l.setEnd(a.node,a.offset),i.removeAllRanges(),i.addRange(l);}function Nee(t,e,n){let r=t.querySelector(`[data-seg-idx="${e}"]`);if(!r)return null;let o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),i=0,s;for(;s=o.nextNode();){let l=s.length;if(i+l>=n)return {node:s,offset:n-i};i+=l;}let a=r.querySelector("*")?null:r.firstChild;return a&&a.nodeType===Node.TEXT_NODE?{node:a,offset:a.length}:null}function $ee({initialText:t,spellCheck:e,rtl:n,textDirection:r,textStyle:o,textStyleRaw:i,layoutStyle:s,element:a,onCommit:l,onCancel:c,onEditChange:d,onFormatText:u}){let p=useRef(null),f=useRef(null);f.current===null&&(f.current={initialText:t,hasRichSegments:!!(ot(a)&&a.textSegments&&a.textSegments.length>0)});let h=f.current,m=useCallback(()=>{let E=p.current;return E?E.innerText||"":h.initialText},[h]),x=useCallback(()=>{d(m());},[m,d]);useEffect(()=>{let E=p.current;if(!E)return;E.focus();let M=window.getSelection();if(M){let A=document.createRange();A.selectNodeContents(E),A.collapse(false),M.removeAllRanges(),M.addRange(A);}},[]);let y=useRef(false);useLayoutEffect(()=>{if(!y.current){y.current=true;return}let E=Lee();!E||!p.current||Oee(p.current,E.startSegIdx,E.startOffset,E.endSegIdx,E.endOffset);});let v=qx(i),S=kf(a),w=v?.transform,C=[S,w].filter(Boolean).join(" ")||void 0,T={...s,...o,...v,transform:C,transformOrigin:v?.transformOrigin||"center"};return jsx("div",{ref:p,contentEditable:true,suppressContentEditableWarning:true,"data-inline-editor":true,spellCheck:e,dir:n?"rtl":"ltr",className:"relative z-10 w-full h-full whitespace-pre-wrap break-words leading-[1.3] outline-none",style:{...T,cursor:"text",minHeight:"1em"},onMouseDown:E=>E.stopPropagation(),onClick:E=>E.stopPropagation(),onInput:x,onBlur:()=>{d(m()),l();},onKeyDown:E=>{if((E.ctrlKey||E.metaKey)&&!E.shiftKey&&u){let M=E.key.toLowerCase();if(M==="b"||M==="i"||M==="u"){E.preventDefault(),E.stopPropagation();let R=(ot(a)?a.textSegments?.[0]:void 0)?.style??(ot(a)?a.textStyle:void 0);switch(M){case "b":u({bold:!R?.bold});break;case "i":u({italic:!R?.italic});break;case "u":u({underline:!R?.underline});break}return}}if(E.key==="Escape"){E.preventDefault(),c();return}E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),d(m()),l());},onPaste:E=>{E.preventDefault();let M=E.clipboardData.getData("text/plain");document.execCommand("insertText",false,M);},children:h.hasRichSegments?Al(a,bi):h.initialText})}function gUe(){return null}var xUe=Vn__default.lazy(async()=>{try{return await Promise.resolve().then(()=>(Gee(),zee))}catch{return {default:gUe}}});function yUe(t){if(t)try{let e=t.indexOf(",");if(e===-1)return;let n=t.slice(0,e),r=t.slice(e+1),i=n.match(/data:([^;]+)/)?.[1]??"application/octet-stream",s=atob(r),a=new Uint8Array(s.length);for(let c=0;c<s.length;c++)a[c]=s.charCodeAt(c);let l=new Blob([a],{type:i});return URL.createObjectURL(l)}catch{return}}function bUe({element:t,width:e,height:n}){let r=t.posterImage??t.imageData;return r?jsx("img",{src:r,alt:"3D Model",className:"pointer-events-none select-none",style:{width:e,height:n,objectFit:"contain"},draggable:false}):jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center text-[11px] text-gray-400 bg-gray-50 border border-dashed border-gray-200 rounded",style:{width:e,height:n},children:[jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-1 text-gray-300",children:[jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]}),jsx("span",{children:"3D Model"})]})}var DU=class extends Vn__default.Component{constructor(e){super(e),this.state={hasError:false};}static getDerivedStateFromError(){return {hasError:true}}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Wee({element:t,width:e,height:n,interactive:r}){let[o,i]=useState(null);useEffect(()=>{let l=false;return Promise.resolve().then(()=>(hh(),GO)).then(()=>{l||i(true);}).catch(()=>{l||i(false);}),()=>{l=true;}},[]);let s=useMemo(()=>yUe(t.modelData),[t.modelData]);useEffect(()=>()=>{s&&URL.revokeObjectURL(s);},[s]);let a=jsx(bUe,{element:t,width:e,height:n});return o===null||!o||!s?a:jsx(DU,{fallback:a,children:jsx(Suspense,{fallback:a,children:jsx(xUe,{modelUrl:s,interactive:r,width:e,height:n})})})}function Co(t,e,n,r){let i=e/(t.length*.6),s=n*.5;return Math.max(6,Math.min(r,i,s))}function LU(t,e,n,r){let o=Math.min(n*.2,r*.4);return [`${t},${e}`,`${t+n-o},${e}`,`${t+n},${e+r/2}`,`${t+n-o},${e+r}`,`${t},${e+r}`,`${t+o},${e+r/2}`].join(" ")}function Yee(t,e,n,r,o){let i=[],s=Math.PI*2/(o*2);for(let a=0;a<o*2;a++){let l=a*s-Math.PI/2,c=a%2===0?n:r,d=t+c*Math.cos(l),u=e+c*Math.sin(l);i.push(a===0?`M${d},${u}`:`L${d},${u}`);}return i.push("Z"),i.join(" ")}function FU(t,e,n){let r={};return t?.backgroundColor&&(r.backgroundColor=t.backgroundColor),t?.outlineColor&&(r.border=`${t.outlineWidth??1}px solid ${t.outlineColor}`),jsx("div",{className:`w-full h-full ${n}`,style:r,children:e})}function qee({elementId:t,shapes:e,style:n,palette:r}){let o=1/0,i=1/0,s=-1/0,a=-1/0;for(let p of e)p.x<o&&(o=p.x),p.y<i&&(i=p.y),p.x+p.width>s&&(s=p.x+p.width),p.y+p.height>a&&(a=p.y+p.height);let l=s-o||1,c=a-i||1,d=fn(n),u=ar(n);return jsx("svg",{viewBox:`0 0 ${l} ${c}`,className:"w-full h-full pointer-events-none",preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-drawing-shapes",children:e.map((p,f)=>{let h=p.fillColor??Gt(f,r),m=p.x-o,x=p.y-i,y=p.shapeType==="roundRect"?Math.min(p.width,p.height)*.1:0,v=p.shapeType==="ellipse",S=p.shapeType==="chevron"||p.shapeType==="homePlate",w=p.rotation?`rotate(${p.rotation} ${m+p.width/2} ${x+p.height/2})`:void 0,C=p.strokeColor??(u>0?"rgba(255,255,255,0.3)":"none"),T=p.strokeWidth??u,E=p.fontSize??Co(p.text??"",p.width*.85,p.height,14);return jsxs("g",{style:{filter:d},children:[v?jsx("ellipse",{cx:m+p.width/2,cy:x+p.height/2,rx:p.width/2,ry:p.height/2,fill:h,stroke:C,strokeWidth:T,transform:w}):S?jsx("polygon",{points:LU(m,x,p.width,p.height),fill:h,stroke:C,strokeWidth:T,transform:w}):jsx("rect",{x:m,y:x,width:p.width,height:p.height,rx:y,fill:h,stroke:C,strokeWidth:T,transform:w}),p.text?jsx("text",{x:m+p.width/2,y:x+p.height/2,textAnchor:"middle",dominantBaseline:"central",fill:p.fontColor??"white",fontSize:E,className:"pointer-events-none",children:sn(p.text,40)}):null]},`${t}-dsp-${p.id}-${f}`)})})}function tk({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=4,c=(i-s*2-a*(e.length-1))/e.length,d=o-s*2,u=Math.min(6,c*.15),p=fn(r),f=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-list",children:e.map((h,m)=>{let x=s+m*(c+a),y=Co(h.text,d*.9,c,12);return jsxs("g",{style:{filter:p},children:[jsx("rect",{x:s,y:x,width:d,height:c,rx:u,fill:Gt(m,n),opacity:bn(m,e.length,r),stroke:f>0?"rgba(255,255,255,0.3)":"none",strokeWidth:f}),jsx("text",{x:s+d/2,y:x+c/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:y,className:"pointer-events-none",children:sn(h.text,40)})]},`${t.id}-list-${h.id}-${m}`)})})}function Kee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=4,l=Math.min(16,o*.04),d=(o-s*2-a*(e.length-1))/e.length,u=Math.min(i-s*2,i*.6),p=i/2,f=fn(r),h=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-process",children:e.map((m,x)=>{let y=s+x*(d+a),v=u/2,S=x===0,w=x===e.length-1,C=S?`${y},${p-v} ${y+d-l},${p-v} ${y+d},${p} ${y+d-l},${p+v} ${y},${p+v}`:w?`${y},${p-v} ${y+d},${p-v} ${y+d},${p+v} ${y},${p+v} ${y+l},${p}`:`${y},${p-v} ${y+d-l},${p-v} ${y+d},${p} ${y+d-l},${p+v} ${y},${p+v} ${y+l},${p}`,T=Co(m.text,d*.7,u,12);return jsxs("g",{style:{filter:f},children:[jsx("polygon",{points:C,fill:Gt(x,n),opacity:bn(x,e.length,r),stroke:h>0?"rgba(255,255,255,0.3)":"none",strokeWidth:h}),jsx("text",{x:y+d/2,y:p,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:T,className:"pointer-events-none",children:sn(m.text,25)})]},`${t.id}-process-${m.id}-${x}`)})})}function Zee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=Math.min(o,i),a=o/2,l=i/2,c=s*.35,d=Math.max(s*.06,Math.min(s*.12,200/e.length)),u=fn(r),p=ar(r);return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-cycle",children:[e.map((f,h)=>{let m=h/e.length*Math.PI*2-Math.PI/2,x=a+c*Math.cos(m),y=l+c*Math.sin(m),S=(h+1)%e.length/e.length*Math.PI*2-Math.PI/2,w=a+c*Math.cos(S),C=l+c*Math.sin(S),T=(m+S)/2,E=h===e.length-1?(m+S+Math.PI*2)/2:T,M=c*.15,A=a+(c+M)*Math.cos(E),R=l+(c+M)*Math.sin(E);return jsx("path",{d:`M${x},${y} Q${A},${R} ${w},${C}`,fill:"none",stroke:"#94a3b8",strokeWidth:1.5,opacity:.5,markerEnd:void 0},`${t.id}-cycle-conn-${h}`)}),e.map((f,h)=>{let m=h/e.length*Math.PI*2-Math.PI/2,x=a+c*Math.cos(m),y=l+c*Math.sin(m),v=Co(f.text,d*1.4,d*2,11);return jsxs("g",{style:{filter:u},children:[jsx("circle",{cx:x,cy:y,r:d,fill:Gt(h,n),opacity:bn(h,e.length,r),stroke:p>0?"rgba(255,255,255,0.3)":"none",strokeWidth:p}),jsx("text",{x,y,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:v,className:"pointer-events-none",children:sn(f.text,20)})]},`${t.id}-cycle-${f.id}-${h}`)})]})}function Jee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=Math.ceil(Math.sqrt(e.length)),a=Math.ceil(e.length/s),l=8,c=6,d=o-l*2,u=i-l*2,p=(d-c*(s-1))/s,f=(u-c*(a-1))/a,h=Math.min(6,Math.min(p,f)*.1),m=fn(r),x=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-matrix",children:e.map((y,v)=>{let S=v%s,w=Math.floor(v/s),C=l+S*(p+c),T=l+w*(f+c),E=Co(y.text,p*.85,f,12);return jsxs("g",{style:{filter:m},children:[jsx("rect",{x:C,y:T,width:p,height:f,rx:h,fill:Gt(v,n),opacity:bn(v,e.length,r),stroke:x>0?"rgba(255,255,255,0.3)":"none",strokeWidth:x}),jsx("text",{x:C+p/2,y:T+f/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:E,fontWeight:500,className:"pointer-events-none",children:sn(y.text,30)})]},`${t.id}-matrix-${y.id}-${v}`)})})}function Qee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=3,c=(i-s*2-a*(e.length-1))/e.length,d=o-s*2,u=fn(r),p=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-pyramid",children:e.map((f,h)=>{let m=.3+h/Math.max(e.length-1,1)*.7,x=h<e.length-1?.3+(h+1)/Math.max(e.length-1,1)*.7:1,y=d*m,v=d*x,S=s+h*(c+a),w=(o-y)/2,C=w+y,T=(o-v)/2,E=T+v,M=[`${w},${S}`,`${C},${S}`,`${E},${S+c}`,`${T},${S+c}`].join(" "),A=Co(f.text,y*.85,c,12);return jsxs("g",{style:{filter:u},children:[jsx("polygon",{points:M,fill:Gt(h,n),opacity:bn(h,e.length,r),stroke:p>0?"rgba(255,255,255,0.3)":"none",strokeWidth:p}),jsx("text",{x:o/2,y:S+c/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:A,className:"pointer-events-none",children:sn(f.text,30)})]},`${t.id}-pyramid-${f.id}-${h}`)})})}function ete({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=fn(r);if(e.length<=4){let p=o/2,f=i/2,h=Math.min(o,i)*.28,m=h*.55;return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-venn",children:e.map((x,y)=>{let v=y/e.length*Math.PI*2-Math.PI/2,S=p+m*Math.cos(v),w=f+m*Math.sin(v),C=Co(x.text,h*1.2,h*2,11);return jsxs("g",{style:{filter:s},children:[jsx("circle",{cx:S,cy:w,r:h,fill:Gt(y,n),opacity:.35}),jsx("text",{x:S,y:w,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:C,fontWeight:"bold",className:"pointer-events-none",children:sn(x.text,20)})]},`${t.id}-venn-${x.id}-${y}`)})})}let a=Math.min(i*.38,o/(e.length*.9)),l=a*.5,c=e.length*(a*2-l)+l,d=(o-c)/2+a,u=i/2;return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-venn",children:e.map((p,f)=>{let h=d+f*(a*2-l),m=Co(p.text,a*1.2,a*2,10);return jsxs("g",{style:{filter:s},children:[jsx("circle",{cx:h,cy:u,r:a,fill:Gt(f,n),opacity:.35}),jsx("text",{x:h,y:u,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:m,fontWeight:"bold",className:"pointer-events-none",children:sn(p.text,20)})]},`${t.id}-venn-${p.id}-${f}`)})})}function tte({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=o-s*2,l=(i-s*2)/e.length,c=fn(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-funnel",children:e.map((d,u)=>{let p=a*(1-u/e.length),f=a*(1-(u+1)/e.length),h=s+u*l,m=(o-p)/2,x=m+p,y=(o-f)/2,v=y+f,S=[`${m},${h}`,`${x},${h}`,`${v},${h+l}`,`${y},${h+l}`].join(" "),w=Co(d.text,p*.85,l,11);return jsxs("g",{style:{filter:c},children:[jsx("polygon",{points:S,fill:Gt(u,n),opacity:bn(u,e.length,r)}),jsx("text",{x:o/2,y:h+l/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:w,className:"pointer-events-none",children:sn(d.text,30)})]},`${t.id}-funnel-${d.id}-${u}`)})})}function nte({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=o*.4,a=i/2,l=Math.min(s-8,a-8),c=Math.max(7,Math.min(10,l/(e.length+1))),d=s+l+8,u=fn(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-target",children:e.map((p,f)=>{let h=l*((e.length-f)/e.length);return jsxs("g",{style:{filter:u},children:[jsx("circle",{cx:s,cy:a,r:Math.max(h,4),fill:Gt(f,n),opacity:bn(f,e.length,r)}),jsx("line",{x1:s+Math.max(h,4),y1:a,x2:d-2,y2:8+f*(c+6),stroke:Gt(f,n),strokeWidth:1,opacity:.6}),jsx("text",{x:d,y:8+f*(c+6)+c/2,textAnchor:"start",dominantBaseline:"central",fill:Gt(f,n),fontSize:c,className:"pointer-events-none",children:sn(p.text,30)})]},`${t.id}-target-${p.id}-${f}`)})})}function BU({element:t,nodes:e,palette:n,style:r}){let o=N4(e);if(o.length===0)return jsx(tk,{element:t,nodes:e,palette:n,style:r});let i=o.reduce((w,C)=>w+gh(C),0),s=Math.max(...o.map(OR)),a=t.width,l=t.height,c=a/i,d=l/Math.max(s,1),u=Math.min(c*.8,140),p=Math.min(d*.4,36),f=Math.min(6,p*.15),h=fn(r),m=ar(r),x=[],y=0;function v(w,C,T){let E=gh(w),M=(C+E/2)*c,A=T*d+d/2,R=y++,k=Co(w.node.text,u*.9,p,11);for(let F of w.children){let B=gh(F),D=C;for(let j of w.children){if(j===F)break;D+=gh(j);}let O=(D+B/2)*c,U=(T+1)*d+d/2,H=A+p/2+(U-p/2-(A+p/2))/2;x.push(jsx("path",{d:`M${M},${A+p/2} L${M},${H} L${O},${H} L${O},${U-p/2}`,fill:"none",stroke:"#94a3b8",strokeWidth:1.5,opacity:.5},`${t.id}-hier-conn-${w.node.id}-${F.node.id}`));}x.push(jsxs("g",{style:{filter:h},children:[jsx("rect",{x:M-u/2,y:A-p/2,width:u,height:p,rx:f,fill:Gt(R,n),opacity:bn(R,e.length,r),stroke:m>0?"rgba(255,255,255,0.3)":"none",strokeWidth:m}),jsx("text",{x:M,y:A,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:k,className:"pointer-events-none",children:sn(w.node.text,40)})]},`${t.id}-hier-group-${w.node.id}`));let N=C;for(let F of w.children)v(F,N,T+1),N+=gh(F);return E}let S=0;for(let w of o)S+=v(w,S,0);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-hierarchy",children:x})}function UU({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=e.slice(0,3),a=e.slice(3),l=s.length,c=a.length>0?o*.7:o,d=c/(l+1),u=Math.min(d*.4,i*.35),p=u*.7,f=8,h=fn(r);return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-gear",children:[s.map((m,x)=>{let y=d*(x+1),v=i/2+(x%2===0?0:u*.35),S=Co(m.text,p*1.2,p*2,11);return jsxs("g",{style:{filter:h},children:[jsx("path",{d:Yee(y,v,u,p,f),fill:Gt(x,n),opacity:bn(x,e.length,r)}),jsx("circle",{cx:y,cy:v,r:p*.5,fill:"white",opacity:.25}),jsx("text",{x:y,y:v,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:S,fontWeight:"bold",className:"pointer-events-none",children:sn(m.text,20)})]},`${t.id}-gear-${m.id}-${x}`)}),a.map((m,x)=>{let y=c+10,v=14+x*18;return jsxs("g",{children:[jsx("circle",{cx:y,cy:v,r:3,fill:Gt(l+x,n),opacity:bn(l+x,e.length,r)}),jsx("text",{x:y+8,y:v,textAnchor:"start",dominantBaseline:"central",fill:Gt(l+x,n),fontSize:10,className:"pointer-events-none",children:sn(m.text,30)})]},`${t.id}-gear-extra-${m.id}-${x}`)})]})}function $U({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=24,a=i/2,l=s,c=o-s,d=c-l,u=Math.max(4,Math.min(8,d/(e.length*4))),p=Math.min(i*.28,40),f=fn(r);return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-timeline",children:[jsx("line",{x1:l,y1:a,x2:c,y2:a,stroke:"#94a3b8",strokeWidth:2}),jsx("polygon",{points:`${c-6},${a-4} ${c},${a} ${c-6},${a+4}`,fill:"#94a3b8"}),e.map((h,m)=>{let x=e.length===1?(l+c)/2:l+m/(e.length-1)*d,y=m%2===0,v=y?a-p:a+p,S=y?a-u-2:a+u+2,w=Co(h.text,d/e.length*.9,p,10);return jsxs("g",{style:{filter:f},children:[jsx("line",{x1:x,y1:S,x2:x,y2:v+(y?w:-w),stroke:Gt(m,n),strokeWidth:1,opacity:.5}),jsx("circle",{cx:x,cy:a,r:u,fill:Gt(m,n),opacity:bn(m,e.length,r)}),jsx("text",{x,y:v,textAnchor:"middle",dominantBaseline:y?"auto":"hanging",fill:Gt(m,n),fontSize:w,className:"pointer-events-none",children:sn(h.text,20)})]},`${t.id}-timeline-${h.id}-${m}`)})]})}function zU({element:t,nodes:e,palette:n,style:r}){let i=t.width,s=t.height,a=Math.ceil(e.length/4),l=8,c=8,d=(i-l*2)/4,u=(s-c*2)/Math.max(a,1),p=d*.8,f=Math.min(u*.6,32),h=Math.min(5,f*.15),m=6,x=fn(r),y=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-bending",children:e.map((v,S)=>{let w=Math.floor(S/4),C=S%4,T=w%2===0?C:3-C,E=l+T*d+d/2,M=c+w*u+u/2,A=Co(v.text,p*.85,f,10),R=null;if(S<e.length-1){let k=Math.floor((S+1)/4),N=(S+1)%4,F=k%2===0?N:3-N,B=l+F*d+d/2,D=c+k*u+u/2;if(k===w){let O=B>E?1:-1,U=E+O*(p/2+2),H=B-O*(p/2+2);R=jsxs("g",{children:[jsx("line",{x1:U,y1:M,x2:H,y2:M,stroke:"#94a3b8",strokeWidth:1.5}),jsx("polygon",{points:`${H},${M-m/2} ${H+O*m},${M} ${H},${M+m/2}`,fill:"#94a3b8"})]},`${t.id}-snake-arrow-${S}`);}else {let O=M+f/2+2,U=D-f/2-2;R=jsxs("g",{children:[jsx("line",{x1:E,y1:O,x2:B,y2:U,stroke:"#94a3b8",strokeWidth:1.5}),jsx("polygon",{points:`${B-m/2},${U} ${B},${U+m} ${B+m/2},${U}`,fill:"#94a3b8"})]},`${t.id}-snake-arrow-${S}`);}}return jsxs("g",{style:{filter:x},children:[R,jsx("rect",{x:E-p/2,y:M-f/2,width:p,height:f,rx:h,fill:Gt(S,n),opacity:bn(S,e.length,r),stroke:y>0?"rgba(255,255,255,0.3)":"none",strokeWidth:y}),jsx("text",{x:E,y:M,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:A,className:"pointer-events-none",children:sn(v.text,20)})]},`${t.id}-snake-${v.id}-${S}`)})})}function TUe({element:t,className:e=""}){if(t.type!=="smartArt"||!t.smartArtData)return jsx("div",{className:`w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none ${e}`,children:"SmartArt"});let{nodes:n,drawingShapes:r,chrome:o}=t.smartArtData;if(n.length===0)return jsx("div",{className:`w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none ${e}`,children:"SmartArt"});let i=k4(t),s=I4(t);if(r&&r.length>0)return FU(o,jsx(qee,{elementId:t.id,shapes:r,style:s,palette:i}),e);let a=t.smartArtData.layout,l=a?D4(a):(t.smartArtData.resolvedLayoutType??t.smartArtData.layoutType??"list").toLowerCase(),c=MUe(l,t,n,i,s);return FU(o,c,e)}function MUe(t,e,n,r,o){return t.includes("hierarchy")||t.includes("org")?jsx(BU,{element:e,nodes:n,palette:r,style:o}):t.includes("process")||t.includes("chevron")||t.includes("arrow")?jsx(Kee,{element:e,nodes:n,palette:r,style:o}):t.includes("cycle")||t.includes("radial")?jsx(Zee,{element:e,nodes:n,palette:r,style:o}):t.includes("matrix")?jsx(Jee,{element:e,nodes:n,palette:r,style:o}):t.includes("pyramid")?jsx(Qee,{element:e,nodes:n,palette:r,style:o}):t.includes("venn")?jsx(ete,{element:e,nodes:n,palette:r,style:o}):t.includes("funnel")?jsx(tte,{element:e,nodes:n,palette:r,style:o}):t.includes("target")||t.includes("bullseye")?jsx(nte,{element:e,nodes:n,palette:r,style:o}):t.includes("gear")?jsx(UU,{element:e,nodes:n,palette:r,style:o}):t.includes("timeline")||t.includes("linear")?jsx($U,{element:e,nodes:n,palette:r,style:o}):t.includes("bending")||t.includes("snake")?jsx(zU,{element:e,nodes:n,palette:r,style:o}):t.includes("stepdown")?jsx(Fragment,{children:L4(e,n,r,o)}):t.includes("alternatingflow")||t.includes("alternating")?jsx(Fragment,{children:F4(e,n,r,o)}):t.includes("descending")?jsx(Fragment,{children:B4(e,n,r,o)}):t.includes("pictureaccent")?jsx(Fragment,{children:O4(e,n,r,o)}):t.includes("verticalblock")?jsx(Fragment,{children:U4(e,n,r,o)}):t.includes("grouped")?jsx(Fragment,{children:$4(e,n,r,o)}):t.includes("pyramidlist")?jsx(Fragment,{children:H4(e,n,r,o)}):t.includes("horizontalpicture")?jsx(Fragment,{children:z4(e,n,r,o)}):t.includes("accentprocess")?jsx(Fragment,{children:G4(e,n,r,o)}):t.includes("verticalchevron")?jsx(Fragment,{children:V4(e,n,r,o)}):jsx(tk,{element:e,nodes:n,palette:r,style:o})}function _Ue(t,e){if(t.className!==e.className||t.element.id!==e.element.id||t.element.type!==e.element.type||t.element.width!==e.element.width||t.element.height!==e.element.height||t.element.x!==e.element.x||t.element.y!==e.element.y)return false;let n=t.element.type==="smartArt"?t.element.smartArtData:void 0,r=e.element.type==="smartArt"?e.element.smartArtData:void 0;return n===r}var ote=Vn__default.memo(TUe,_Ue);function ite({element:t,slides:e,isPresentationMode:n,onZoomClick:r,sourceSlideIndex:o}){let i=e?.[t.targetSlideIndex],s=c=>{!n||!r||(c.stopPropagation(),r(t.targetSlideIndex,o??0));},a=c=>{!n||!r||(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),r(t.targetSlideIndex,o??0));},l=!!t.imageData;return jsxs("div",{className:"zoom-element-container",style:{width:"100%",height:"100%",position:"relative",cursor:n?"pointer":"default",overflow:"hidden",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",transition:"box-shadow 0.2s ease, transform 0.15s ease"},"data-zoom-type":t.zoomType,"data-zoom-target":t.targetSlideIndex,"data-testid":"zoom-element",onClick:s,onKeyDown:a,role:n?"button":void 0,tabIndex:n?0:-1,"aria-label":`Zoom to slide ${t.targetSlideIndex+1}${t.zoomType==="section"&&t.targetSectionId?` (section: ${t.targetSectionId})`:""}`,children:[l?ek(t,{width:"100%",height:"100%",objectFit:"contain"},void 0,`Preview of slide ${t.targetSlideIndex+1}`):jsx(EUe,{targetSlide:i,slideIndex:t.targetSlideIndex}),n&&jsx("div",{className:"zoom-hover-overlay",style:{position:"absolute",inset:0,background:"transparent",transition:"background 0.2s ease",pointerEvents:"none"}}),jsxs("div",{style:{position:"absolute",bottom:4,right:4,fontSize:"9px",padding:"1px 4px",borderRadius:"2px",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"#fff",pointerEvents:"none",lineHeight:"1.4"},children:[t.zoomType==="section"?"Section":"Slide"," Zoom"]})]})}function EUe({targetSlide:t,slideIndex:e}){let n=t?.backgroundColor||"#f0f0f0",r=t?`Slide ${t.slideNumber}`:`Slide ${e+1}`;return jsxs("div",{"data-testid":"zoom-thumbnail",style:{width:"100%",height:"100%",backgroundColor:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"1px solid rgba(0, 0, 0, 0.1)"},children:[jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"rgba(0, 0, 0, 0.5)",marginBottom:"4px"},children:r}),t?.sectionName&&jsx("div",{style:{fontSize:"10px",color:"rgba(0, 0, 0, 0.4)"},children:t.sectionName})]})}function lte(t,e,n,r,o,i,s,a,l,c,d,u,p,f,h,m,x,y,v,S,w,C,T,E,M,A,R,k,N,F,B,D,O,U,H,j,Z){if(t.type==="model3d")return jsx(Wee,{element:t,width:t.width,height:t.height,interactive:!k});if(t.type==="zoom")return jsx(ite,{element:t,slides:D,isPresentationMode:k,onZoomClick:O,sourceSlideIndex:U});if(e)return ek(t,l,c,u,d);if(n)return jsxs(Fragment,{children:[a,jsx($ee,{initialText:r,spellCheck:o,rtl:i?.rtl,textDirection:i?.textDirection,textStyle:s,textStyleRaw:i,layoutStyle:Sc(t),element:t,onCommit:S,onCancel:w,onEditChange:v,onFormatText:Z})]});if(t.type==="table")return aY(t,s,{editable:m,selectedCell:m?h:null,onSelectCell:C,onCommitCellEdit:T,onResizeColumns:E,onResizeRow:M,styleCtx:j});if(t.type==="chart")return AQ(t);if(t.type==="smartArt")return jsx(ote,{element:t});if(t.type==="media")return Z4(t,f,{autoPlay:k,fullScreen:k&&!!t.fullScreen,isPresentationMode:k,onPlayStateChange:N});if(x&&Cj(t))return Mee(t,{replay:k});if(t.type==="contentPart")return Eee(t,{replay:k});if(t.type==="ole")return kee(t);if(y&&t.type==="group"&&t.children)return _ee(t.children);if(ty(t,p))return jsx("div",{className:"w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none",children:cs(t)});let J=ot(t)&&t.linkedTxbxId!==void 0,W=J?{overflow:"hidden"}:{},te=J&&B?D5(t,B):void 0,se=ot(t)?t.textStyle?.textWarpPreset:void 0,Ce=$T(se),ee=ot(t)?fF(t.textStyle):void 0,de=[kf(t),ee?.transform].filter(Boolean).join(" ")||void 0,Ne=ee?{...ee.perspective?{perspective:ee.perspective}:{},...ee.transformStyle?{transformStyle:ee.transformStyle}:{}}:void 0,Ue="shapeType"in t?t.shapeType:void 0,he=mee(Ue);return jsxs(Fragment,{children:[a,he&&jsx(gee,{element:t}),p?Ce?jsx("div",{className:le("relative z-10 w-full h-full",R?"":"pointer-events-none"),style:{...Sc(t),transform:de,transformOrigin:"center",...Ne,...W},children:jsx(QR,{element:t,width:t.width,height:t.height,fallbackColor:bi,findHighlights:A,fieldContext:H})}):jsx("div",{className:le("relative z-10 w-full h-full whitespace-pre-wrap break-words leading-[1.3]",R?"":"pointer-events-none"),style:{...Sc(t),...s,...qx(i),transform:de,transformOrigin:"center",...Ne,...W},children:Al(t,bi,void 0,A,R,H,F,te??void 0,!k)}):ot(t)&&t.promptText?Ce?jsx("div",{className:le("relative z-10 w-full h-full",R?"":"pointer-events-none"),style:{...Sc(t),transform:de,transformOrigin:"center",...Ne,...W},children:jsx(QR,{element:t,width:t.width,height:t.height,fallbackColor:bi,findHighlights:A,fieldContext:H})}):jsx("div",{className:le("relative z-10 w-full h-full whitespace-pre-wrap break-words leading-[1.3]",R?"":"pointer-events-none"),style:{...Sc(t),...s,...qx(i),transform:de,transformOrigin:"center",...Ne,...W},children:Al(t,bi,void 0,A,R,H,F,te??void 0,!k)}):null]})}var dte=Vn__default.memo(function({data:e}){return !e.hasExtrusion||e.panels.length===0?null:jsxs("div",{className:"extrusion-3d-wrapper",style:e.wrapperStyle,"aria-hidden":"true",children:[e.panels.map(n=>jsx("div",{className:`extrusion-3d-panel extrusion-3d-panel--${n.side}`,style:n.style},n.side)),e.materialOverlay&&jsx("div",{className:"extrusion-3d-material-overlay",style:{position:"absolute",inset:0,backgroundImage:e.materialOverlay,pointerEvents:"none",borderRadius:"inherit",transform:e.frontFaceStyle.transform,transformStyle:"preserve-3d",backfaceVisibility:"hidden",mixBlendMode:"normal"}})]})});function ute({label:t,hasUrl:e}){return jsx("div",{className:"pointer-events-none absolute left-1 top-full z-[9999] mt-1 max-w-64 opacity-0 transition-opacity duration-150 group-hover/link:opacity-100",children:jsxs("div",{className:"rounded border border-border bg-popover px-2.5 py-1.5 shadow-lg",children:[jsx("div",{className:"truncate text-xs text-foreground",children:t}),jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:e?"Ctrl+Click to follow link":"Active in presentation mode"})]})})}function kU(t){let e=mn(t)?t.shapeStyle:void 0,n=Math.max(0,e?.strokeWidth||0),r=ut(e?.strokeColor,Fu),o=ut(e?.fillColor,Pf);return {hf:e?.fillColor!==void 0&&e?.fillColor!=="transparent"||!!(Bu(e)||e?.fillGradient)||e?.fillMode==="pattern"&&!!e.fillPatternPreset,fc:o,sw:n,sc:r}}var rk=Vn__default.memo(function({element:e,activeSlide:n,isSelected:r,isInlineEditing:o,inlineEditingText:i,canInteract:s,spellCheckEnabled:a,mediaDataUrls:l,tableEditorState:c,selectionColorClass:d,showHoverBorder:u,opacity:p,zIndex:f,imageAltText:h,showResizeHandles:m,renderInk:x,renderGroups:y,adjustmentHandleDescriptor:v,onResizePointerDown:S,onAdjustmentPointerDown:w,onInlineEditChange:C,onInlineEditCommit:T,onInlineEditCancel:E,onTableCellSelect:M,onCommitCellEdit:A,onResizeTableColumns:R,onResizeTableRow:k,findHighlights:N,onActionClick:F,onHyperlinkClick:B,animationState:D,presentationElementStates:O,allSlides:U,onZoomClick:H,sourceSlideIndex:j,fieldContext:Z,tableStyleContext:J}){let W=M?Ke=>M(Ke,e.id):void 0,te=A?(Ke,Ct,ne)=>A(e.id,Ke,Ct,ne):void 0,se=R?Ke=>R(e.id,Ke):void 0,Ce=k?(Ke,Ct)=>k(e.id,Ke,Ct):void 0,{hf:ee,fc:ce,sw:de,sc:Ne}=kU(e),Ue=e.locks,he=Nf(e)&&!Ue?.noTextEdit,Be=ot(e)?e.textStyle:void 0,Me=Hu(e,ee,ce,de,Ne),ge=If(e,bi),Te=Vu(e,ee,ce,de,Ne),be=e.type==="picture"||e.type==="image",xe=e.type==="model3d",Pe=L7(e),Xe=mn(e)?e.shapeStyle:void 0,Y=useMemo(()=>j7(Xe?.shape3d,Xe?.scene3d,ce,e.width,e.height),[Xe?.shape3d,Xe?.scene3d,ce,e.width,e.height]),[Ge,Ve]=useState(false),We=useCallback(Ke=>{Ve(Ke);},[]);if(Pe)return jsx(lee,{el:e,isSelected:r,canInteract:s,showResizeHandles:m&&!Ue?.noResize,showHoverBorder:u,selectionColorClass:d,opacity:p,zIndex:f,adjustmentHandleDescriptor:v,onResizePointerDown:S,onAdjustmentPointerDown:w,animationState:D});let ke=s&&!Ue?.noSelect,wt=m&&!Ue?.noResize,V=o&&!Ue?.noTextEdit,$=!!(e.actionClick&&F),ie=!!e.actionHover,ve=!!B,De=e.type==="zoom"&&!!H,$e=$||ie||ve||De,ze=r?`border-${d} ring-2 ring-${d}/50`:u?"border-transparent hover:border-primary/40":"border-transparent",ae=V?"cursor-text":ke?Ue?.noMove?"cursor-default":"cursor-move":$||De?"cursor-pointer":"",Se=!ke,Ye=e.type==="media"&&!!e.fullScreen&&Se&&Ge,Q=eee(e),pe=tee(e),Re=nee(e),nt=ke||$e;return jsxs("div",{"data-pptx-element":"true","data-element-id":e.id,role:Q,"aria-label":pe,"aria-roledescription":Re,"aria-selected":r?true:void 0,tabIndex:nt?0:-1,className:le("absolute border","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",ae,ke||$e?"":"pointer-events-none",Ye?"pointer-events-auto":"",ze,ke&&e.actionClick&&"group/link"),style:dee({el:e,isFullscreenMedia:Ye,isImg:be||xe,zIndex:f,opacity:p,animationState:D,shapeVisualStyle:Me,has3DExtrusion:Y.hasExtrusion}),onKeyDown:Ke=>{if(Ke.key==="Enter"&&he&&ke&&!V){Ke.preventDefault(),Ke.stopPropagation();let Ct=new MouseEvent("dblclick",{bubbles:true});Ke.currentTarget.dispatchEvent(Ct);}else Ke.key==="Escape"&&V&&(Ke.preventDefault(),Ke.stopPropagation(),E());},onClick:Ke=>{if(e.actionClick&&F&&(!ke||Ke.ctrlKey||Ke.metaKey)){if(Ke.stopPropagation(),Ke.preventDefault(),e.actionClick.highlightClick){let ne=Ke.currentTarget;ne.style.filter="brightness(1.18)",ne.style.outline="2px solid rgba(59, 130, 246, 0.6)",window.setTimeout(()=>{ne.style.filter="",ne.style.outline="";},320);}F(e.id,e.actionClick);}},onMouseEnter:Ke=>{if(ie&&e.actionHover?.highlightClick){let Ct=Ke.currentTarget;Ct.style.filter="brightness(1.15)",Ct.style.outline="2px solid rgba(59, 130, 246, 0.5)";}Se&&e.actionHover&&F&&(e.actionHover.url||e.actionHover.targetSlideIndex!==void 0)&&F(e.id,e.actionHover);},onMouseLeave:ie&&e.actionHover?.highlightClick?Ke=>{let Ct=Ke.currentTarget;Ct.style.filter="",Ct.style.outline="";}:void 0,title:ke&&e.actionClick?void 0:e.actionClick?.tooltip||e.actionHover?.tooltip||void 0,children:[cee(e),Y.hasExtrusion&&jsx(dte,{data:Y}),lte(e,be,V,i,a,Be,ge,Te,ju(e),A1(e),GF(e),h,he,l,c,r,x,y,C,T,E,W,te,se,Ce,N,B,Se,We,O,n?.elements,U,H,j,Z,J),(e.actionClick||e.actionHover)&&s&&jsx(uee,{clickTooltip:e.actionClick?.tooltip,hoverTooltip:e.actionHover?.tooltip}),ke&&e.actionClick&&jsx(ute,{label:e.actionClick.tooltip||e.actionClick.url||e.actionClick.action||"Link",hasUrl:!!e.actionClick.url}),wt&&!V&&jsx(ZR,{elementId:e.id,adjustmentHandleDescriptor:v,onResizePointerDown:S,onAdjustmentPointerDown:w})]})});var ZT="w-3.5 h-3.5",mte="inline-flex items-center justify-center rounded p-1 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",jU=`${mte} hover:bg-accent text-muted-foreground hover:text-foreground`,hte=`${mte} px-2 py-1 bg-muted hover:bg-accent text-foreground text-xs`;function XU({findQuery:t,replaceQuery:e,findMatchCase:n,findResults:r,findResultIndex:o,onSetFindQuery:i,onSetReplaceQuery:s,onSetFindMatchCase:a,onPerformFind:l,onNavigateResult:c,onReplace:d,onReplaceAll:u,onClose:p}){let{t:f}=useTranslation(),h=useRef(null);useEffect(()=>{h.current?.focus();},[]),useEffect(()=>{l();},[t,n]);let m=useCallback(S=>{S.key==="Escape"?p():S.key==="Enter"&&(S.shiftKey?c(-1):c(1));},[p,c]),x=useCallback(S=>{S.key==="Escape"?p():S.key==="Enter"&&d();},[p,d]),y=r.length>0,v=y?f("pptx.findReplace.matchCount",{current:o+1,total:r.length}):t.length>0?f("pptx.findReplace.noMatches"):"";return jsxs("div",{className:"absolute top-2 right-2 z-40 bg-popover border border-border rounded-lg shadow-lg p-3 text-xs text-foreground w-80 backdrop-blur",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"font-semibold text-sm inline-flex items-center gap-1.5",children:[jsx(LuSearch,{className:ZT}),f("pptx.findReplace.title")]}),jsx("button",{type:"button",className:jU,onClick:p,title:f("pptx.findReplace.closeEscape"),"aria-label":f("pptx.findReplace.closeAriaLabel"),children:jsx(LuX,{className:ZT})})]}),jsxs("div",{className:"flex items-center gap-1 mb-1.5",children:[jsxs("div",{className:"relative flex-1",children:[jsx("input",{ref:h,type:"text",value:t,onChange:S=>i(S.target.value),onKeyDown:m,placeholder:f("pptx.findReplace.findPlaceholder"),className:"w-full bg-muted border border-border rounded px-2 py-1 pr-7 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:outline-none","aria-label":f("pptx.findReplace.searchText")}),jsx("button",{type:"button",className:`absolute right-1 top-1/2 -translate-y-1/2 p-0.5 rounded transition-colors ${n?"bg-primary/80 text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,onClick:()=>a(!n),title:f("pptx.findReplace.matchCase"),"aria-label":f("pptx.findReplace.toggleMatchCase"),"aria-pressed":n,children:jsx(LuCaseSensitive,{className:ZT})})]}),jsx("button",{type:"button",className:jU,onClick:()=>c(-1),disabled:!y,title:f("pptx.findReplace.previousMatch"),"aria-label":f("pptx.findReplace.previousMatch"),children:jsx(LuChevronUp,{className:ZT})}),jsx("button",{type:"button",className:jU,onClick:()=>c(1),disabled:!y,title:f("pptx.findReplace.nextMatch"),"aria-label":f("pptx.findReplace.nextMatch"),children:jsx(LuChevronDown,{className:ZT})})]}),v&&jsx("div",{className:"text-[11px] text-muted-foreground mb-2 pl-0.5 tabular-nums",children:v}),jsx("div",{className:"flex items-center gap-1 mb-2",children:jsxs("div",{className:"relative flex-1",children:[jsx(LuReplace,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground"}),jsx("input",{type:"text",value:e,onChange:S=>s(S.target.value),onKeyDown:x,placeholder:f("pptx.findReplace.replacePlaceholder"),className:"w-full bg-muted border border-border rounded pl-7 pr-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:outline-none","aria-label":f("pptx.findReplace.replacementText")})]})}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("button",{type:"button",className:hte,onClick:d,disabled:!y,title:f("pptx.findReplace.replaceCurrent"),children:f("pptx.findReplace.replace")}),jsx("button",{type:"button",className:hte,onClick:u,disabled:!y,title:f("pptx.findReplace.replaceAllMatches"),children:f("pptx.findReplace.replaceAll")})]})]})}var xte=5;function WUe(t,e,n,r,o=xte){let i=Math.max(e,1),s=t*i;if(t===0)return {startIndex:0,endIndex:-1,totalHeight:0,offsetY:0,visibleRange:{start:0,end:-1}};let a=Math.floor(n/i),l=Math.min(t-1,Math.floor((n+r)/i)),c=Math.max(0,a-o),d=Math.min(t-1,l+o),u=c*i;return {startIndex:c,endIndex:d,totalHeight:s,offsetY:u,visibleRange:{start:a,end:l}}}function yte({totalItems:t,itemHeight:e,overscan:n=xte}){let r=useRef(null),[o,i]=useState(0),[s,a]=useState(0);useEffect(()=>{let u=r.current;if(!u)return;let p=()=>{i(u.scrollTop);};a(u.clientHeight),i(u.scrollTop),u.addEventListener("scroll",p,{passive:true});let f;return typeof ResizeObserver<"u"&&(f=new ResizeObserver(h=>{for(let m of h)a(m.contentRect.height);}),f.observe(u)),()=>{u.removeEventListener("scroll",p),f?.disconnect();}},[]);let l=WUe(t,e,o,s,n),c=Math.max(e,1),d=useCallback((u,p="smooth")=>{let f=r.current;if(!f)return;let h=u*c,m=h+c,x=f.scrollTop,y=x+f.clientHeight;h<x?f.scrollTo({top:h,behavior:p}):m>y&&f.scrollTo({top:m-f.clientHeight,behavior:p});},[c]);return {...l,scrollContainerRef:r,scrollToIndex:d}}var YUe=/^[a-zA-Z0-9_-]{1,128}$/;function YU(t){if(!YUe.test(t))throw new Error(`Invalid collaboration room ID: "${t}". Must be 1-128 alphanumeric characters, hyphens, or underscores.`);return t}function bte(t){return typeof t!="string"?"Anonymous":t.replace(/<[^>]*>/g,"").trim().slice(0,64)||"Anonymous"}function WU(t,e,n){if(typeof t!="number"||!Number.isFinite(t))return 0;let r=20;return Math.max(e-r,Math.min(n+r,t))}var qUe=/^#[0-9a-fA-F]{6}$/;function ok(t,e="#6366f1"){return typeof t!="string"?e:qUe.test(t)?t:e}function vte(t){if(typeof t=="string")try{let e=new URL(t);if(e.protocol==="https:"||e.protocol==="http:"||e.protocol==="data:")return t}catch{}}function Ste(t){return typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.floor(t))}function qU(t,e,n){return typeof t.clientId!="number"?null:{clientId:t.clientId,userName:bte(t.userName),userAvatar:vte(t.userAvatar),userColor:ok(t.userColor),activeSlideIndex:Ste(t.activeSlideIndex),cursorX:WU(t.cursorX,0,e),cursorY:WU(t.cursorY,0,n),lastUpdated:typeof t.lastUpdated=="string"?t.lastUpdated:new Date().toISOString(),selectedElementId:typeof t.selectedElementId=="string"?t.selectedElementId.slice(0,128):void 0,role:t.role==="broadcaster"||t.role==="viewer"||t.role==="collaborator"?t.role:void 0}}var wte=50,JUe=3e4;function ZU({awareness:t,localClientId:e,userName:n,userColor:r,userAvatar:o,role:i,canvasWidth:s,canvasHeight:a}){let[l,c]=useState([]),d=useRef(0),u=useRef(null),p=useRef({}),f=useCallback(h=>{if(!t)return;Object.assign(p.current,h);let x=Date.now()-d.current,y=()=>{let v={...p.current,userName:n,userColor:r,userAvatar:o,role:i,lastUpdated:new Date().toISOString()};t.setLocalStateField("presence",v),d.current=Date.now();};x>=wte?(u.current&&(clearTimeout(u.current),u.current=null),y()):u.current||(u.current=setTimeout(()=>{u.current=null,y();},wte-x));},[t,n,r,o,i]);return useEffect(()=>{t&&t.setLocalStateField("presence",{userName:n,userColor:r,userAvatar:o,role:i,activeSlideIndex:0,cursorX:0,cursorY:0,lastUpdated:new Date().toISOString()});},[t,n,r,o,i]),useEffect(()=>{if(!t||e===null)return;let h=()=>{let m=Date.now(),x=t.getStates(),y=[];x.forEach((v,S)=>{if(S===e)return;let C=v?.presence;if(!C||typeof C!="object")return;let T=qU({...C,clientId:S},s,a);if(!T)return;let E=new Date(T.lastUpdated).getTime();Number.isNaN(E)||m-E>JUe||y.push(T);}),c(y);};return t.on("change",h),t.on("update",h),h(),()=>{t.off("change",h),t.off("update",h);}},[t,e,s,a]),useEffect(()=>{if(!t)return;let h=setInterval(()=>{t.setLocalStateField("presence",{...p.current,userName:n,userColor:r,userAvatar:o,role:i,lastUpdated:new Date().toISOString()});},1e4);return ()=>clearInterval(h)},[t,n,r,o,i]),useEffect(()=>()=>{u.current&&clearTimeout(u.current);},[]),{remoteUsers:l,broadcastPresence:f}}var nHe=3e4;function w6({config:t}){let[e,n]=useState("disconnected"),[r,o]=useState(null),[i,s]=useState(null),[a,l]=useState(null),c=useRef(null),d=useRef(null),u=useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),c.current?.(),c.current=null;},[]),p=useCallback(async()=>{u();let h=YU(t.roomId);n("connecting");try{let[m,{WebsocketProvider:x}]=await Promise.all([Promise.resolve().then(()=>(p6(),u6)),Promise.resolve().then(()=>(ioe(),ooe))]),y=new m.Doc,v=new x(t.serverUrl,h,y,{params:t.authToken?{token:t.authToken}:void 0}),S=!1,w=C=>{C.status==="connected"?(S=!0,d.current&&(clearTimeout(d.current),d.current=null),n("connected")):C.status==="disconnected"&&n("disconnected");};v.on("status",w),v.wsconnected&&(S=!0,n("connected")),S||(d.current=setTimeout(()=>{d.current=null,S||(v.off("status",w),v.destroy(),y.destroy(),s(null),o(null),l(null),c.current=null,n("error"));},nHe)),s(y),o(v.awareness),l(v.awareness.clientID),c.current=()=>{v.off("status",w),v.destroy(),y.destroy(),s(null),o(null),l(null),n("disconnected");};}catch(m){console.warn("[pptx-viewer] Collaboration packages not available:",m instanceof Error?m.message:m),n("error");}},[t.roomId,t.serverUrl,t.authToken,u]);useEffect(()=>(p(),u),[p,u]);let f=useCallback(()=>{p();},[p]);return {status:e,awareness:r,doc:i,clientId:a,retry:f}}function C6({config:t,canvasWidth:e,canvasHeight:n}){let r=ok(t.userColor,"#6366f1"),{status:o,awareness:i,doc:s,clientId:a,retry:l}=w6({config:t}),{remoteUsers:c,broadcastPresence:d}=ZU({awareness:i,localClientId:a,userName:t.userName,userColor:r,userAvatar:t.userAvatar,role:t.role,canvasWidth:e,canvasHeight:n}),u=o==="connected"?c.length+1:c.length;return {status:o,remoteUsers:c,broadcastPresence:d,connectedCount:u,config:t,doc:s,retry:l}}var aoe=createContext(null);function qi(){return useContext(aoe)}function T6({config:t,canvasWidth:e,canvasHeight:n,children:r}){let o=C6({config:t,canvasWidth:e,canvasHeight:n});return jsx(aoe.Provider,{value:o,children:r})}function M6({remoteUsers:t,activeSlideIndex:e,canvasWidth:n,canvasHeight:r}){let o=t.filter(i=>i.activeSlideIndex===e);return o.length===0?null:jsx("svg",{"data-testid":"remote-user-cursors","data-export-ignore":"true",className:"absolute inset-0 pointer-events-none",style:{zIndex:9999},width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true",children:o.map(i=>jsxs("g",{transform:`translate(${i.cursorX}, ${i.cursorY})`,"data-testid":`remote-cursor-${i.clientId}`,children:[jsx("path",{d:"M0 0 L0 16 L4.5 12.5 L8 20 L10.5 19 L7 11.5 L12 11 Z",fill:i.userColor,stroke:"#fff",strokeWidth:1,opacity:.9}),jsxs("g",{transform:"translate(14, 18)",children:[jsx("rect",{rx:3,ry:3,x:-2,y:-10,width:Math.min(i.userName.length*7+8,150),height:16,fill:i.userColor,opacity:.85}),jsx("text",{fill:"#fff",fontSize:10,fontFamily:"system-ui, sans-serif",fontWeight:500,dominantBaseline:"central",y:-2,x:2,children:i.userName.length>20?`${i.userName.slice(0,18)}...`:i.userName})]})]},i.clientId))})}var aHe={connected:{dot:"bg-green-400",text:"text-green-400",label:"Connected"},connecting:{dot:"bg-yellow-400 animate-pulse",text:"text-yellow-400",label:"Connecting..."},disconnected:{dot:"bg-gray-500",text:"text-gray-500",label:"Disconnected"},error:{dot:"bg-red-400",text:"text-red-400",label:"Connection error"}};function E6({status:t,connectedCount:e,onRetry:n}){let{t:r}=useTranslation(),o=aHe[t];return jsxs("div",{"data-testid":"collaboration-status",className:"flex items-center gap-1.5","aria-label":r("pptx.collaboration.statusAriaLabel",{status:r(`pptx.collaboration.status.${t}`),count:e}),children:[jsx("span",{className:`inline-block w-2 h-2 rounded-full ${o.dot}`,"aria-hidden":"true"}),jsx("span",{className:`text-[10px] ${o.text}`,children:t==="connected"?r("pptx.collaboration.userCount",{count:e}):r(`pptx.collaboration.status.${t}`)}),t==="error"&&n&&jsx("button",{type:"button",onClick:n,className:"text-[10px] text-blue-400 hover:text-blue-300 underline underline-offset-2 transition-colors","aria-label":r("pptx.collaboration.retry"),children:r("pptx.collaboration.retry")})]})}function A6({activeSlideIndex:t,canvasWidth:e,canvasHeight:n,selectedElementId:r}){let o=qi(),i=useRef(null),s=useRef(r);return useEffect(()=>{!o||r===s.current||(s.current=r,o.broadcastPresence({selectedElementId:r??void 0,activeSlideIndex:t}));},[o,r,t]),useEffect(()=>{if(!o)return;let a=i.current?.parentElement;if(!a)return;let l=c=>{let d=a.getBoundingClientRect(),u=(c.clientX-d.left)/d.width*e,p=(c.clientY-d.top)/d.height*n;o.broadcastPresence({cursorX:u,cursorY:p,activeSlideIndex:t});};return a.addEventListener("pointermove",l),()=>a.removeEventListener("pointermove",l)},[o,e,n,t]),o?jsx("div",{ref:i,"data-testid":"collab-pointer-tracker","data-export-ignore":"true",style:{display:"contents"},children:jsx(M6,{remoteUsers:o.remoteUsers,activeSlideIndex:t,canvasWidth:e,canvasHeight:n})}):null}function R6({elements:t,activeSlideIndex:e}){let n=qi();if(!n)return null;let r=new Map;for(let i of t)r.set(i.id,i);let o=[];for(let i of n.remoteUsers)if(i.activeSlideIndex===e&&i.selectedElementId){let s=r.get(i.selectedElementId);s&&o.push({userName:i.userName,userColor:i.userColor,element:s});}return o.length===0?null:jsx(Fragment,{children:o.map(i=>jsx("div",{"data-testid":`remote-selection-${i.element.id}`,"data-export-ignore":"true",className:"absolute pointer-events-none",style:{left:i.element.x,top:i.element.y,width:i.element.width,height:i.element.height,zIndex:9997,border:`2px solid ${i.userColor}`,borderRadius:2},children:jsx("span",{className:"absolute -top-5 left-0 px-1 py-0.5 text-[9px] font-medium text-white rounded-sm whitespace-nowrap leading-none",style:{backgroundColor:i.userColor},children:i.userName})},`remote-sel-${i.element.id}`))})}function poe({state:t,sectionGroups:e,totalSlides:n,onStartRename:r,onDeleteSection:o,onMoveSectionUp:i,onMoveSectionDown:s,onAddSection:a,onClose:l}){let{t:c}=useTranslation(),d=()=>{let u=e.find(h=>h.id===t.sectionId);if(!u)return;let p=u.slideIndexes[u.slideIndexes.length-1]??0,f=Math.min(p+1,n-1);a?.(c("pptx.sections.defaultName"),f),l();};return jsxs("div",{className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-popover py-1 shadow-xl",style:{left:t.x,top:t.y},onClick:u=>u.stopPropagation(),children:[jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:()=>{let u=e.find(p=>p.id===t.sectionId);u&&r(t.sectionId,u.label);},children:c("pptx.sections.rename")}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:()=>{o?.(t.sectionId),l();},children:c("pptx.sections.delete")}),jsx("div",{className:"my-1 border-t border-border"}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed",disabled:t.sectionIndex===0,onClick:()=>{i?.(t.sectionId),l();},children:c("pptx.sections.moveUp")}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed",disabled:t.sectionIndex>=t.totalSections-1,onClick:()=>{s?.(t.sectionId),l();},children:c("pptx.sections.moveDown")}),jsx("div",{className:"my-1 border-t border-border"}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:d,children:c("pptx.sections.addAfter")})]})}function k6({sectionId:t,label:e,slideCount:n,isCollapsed:r,isRenaming:o,renameValue:i,canEdit:s,sectionIndex:a,totalSections:l,renameInputRef:c,onToggle:d,onContextMenu:u,onStartRename:p,onRenameValueChange:f,onCommitRename:h,onCancelRename:m}){return jsxs("button",{type:"button",className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-[11px] uppercase tracking-wide text-muted-foreground hover:bg-muted/60 hover:text-foreground",onClick:()=>d(t),onContextMenu:x=>s?u(x,t,a,l):void 0,onDoubleClick:x=>{s&&(x.stopPropagation(),p(t,e));},children:[jsx(LuChevronDown,{className:le("h-3 w-3 flex-shrink-0 transition-transform",r?"-rotate-90":"rotate-0")}),o?jsx("input",{ref:c,type:"text",className:"flex-1 bg-muted text-[11px] text-foreground rounded px-1 py-0.5 outline-none border border-primary",value:i,onChange:x=>f(x.target.value),onKeyDown:x=>{x.key==="Enter"?(x.preventDefault(),h()):x.key==="Escape"&&(x.preventDefault(),m()),x.stopPropagation();},onClick:x=>x.stopPropagation(),onBlur:h}):jsxs(Fragment,{children:[jsx("span",{className:"truncate text-left",children:e}),jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:n})]})]})}function moe({state:t,onAddSection:e,onClose:n}){let{t:r}=useTranslation();return jsx("div",{className:"fixed z-50 min-w-[180px] rounded-md border border-border bg-popover py-1 shadow-xl",style:{left:t.x,top:t.y},onClick:o=>o.stopPropagation(),children:jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:()=>{e?.(r("pptx.sections.defaultName"),t.slideIndex),n();},children:r("pptx.sections.addBefore")})})}function bHe({slide:t,canvasSize:e,previewHeight:n}){let r=useRef(null),[o,i]=useState(false);return useEffect(()=>{let s=r.current;if(!s)return;if(typeof IntersectionObserver>"u"){i(true);return}let a=new IntersectionObserver(([l])=>{l?.isIntersecting&&(i(true),a.disconnect());},{rootMargin:"200px 0px"});return a.observe(s),()=>{a.disconnect();}},[]),jsx("div",{ref:r,children:o?jsx(Qa,{slide:t,templateElements:[],canvasSize:e}):jsx("div",{className:"relative w-full overflow-hidden rounded border border-border bg-muted/30 animate-pulse",style:{height:n,minWidth:156}})})}var goe=Vn__default.memo(bHe);function xoe(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function yoe(t,e,n){let r=[];for(let o=0;o<t.length;o++){let i=t[o];if(e&&r.push({type:"section",sectionIndex:o,sectionId:i.id}),!(n[i.id]??false))for(let a of i.slideIndexes)r.push({type:"slide",slideIndex:a});}return r}function boe(t,e){let n=Math.max(t,1),r=Math.max(e,1),o=156/n;return Math.max(56,Math.round(r*o))+30}function THe({slide:t,slideIndex:e,isActive:n,canvasSize:r,canEdit:o,rehearsalTimings:i,presenceUsers:s,onSelectSlide:a,onSlideContextMenu:l,onAddSection:c,onOpenSlideCtxMenu:d,onDragStart:u,onDragOver:p,onDrop:f,slideRef:h}){let m=!!t.hidden,x=useCallback(C=>{o&&c?(C.preventDefault(),C.stopPropagation(),d(C.clientX,C.clientY,e)):l(C,e);},[o,c,d,l,e]),y=Math.max(r.width,1),v=Math.max(r.height,1),S=156/y,w=Math.max(56,Math.round(v*S));return jsxs("div",{ref:h,className:le("group relative flex items-center gap-1 cursor-pointer py-0.5 px-1 transition-all",n&&"bg-accent/40 before:absolute before:left-0 before:top-1 before:bottom-1 before:w-[3px] before:bg-primary before:rounded-r",m&&"opacity-50"),draggable:o,onClick:()=>a(e),onContextMenu:x,onDragStart:C=>u(C,e),onDragOver:p,onDrop:C=>f(C,e),children:[jsxs("div",{className:"flex flex-col items-center gap-0.5 w-5 shrink-0",children:[jsx("span",{className:le("text-[10px] tabular-nums text-right select-none w-full",n?"text-primary font-medium":"text-muted-foreground"),children:e+1}),s&&s.length>0&&jsx("div",{className:"flex flex-wrap justify-center gap-px",children:s.slice(0,4).map((C,T)=>jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{backgroundColor:C.userColor},title:C.userName},T))})]}),jsxs("div",{className:le("relative flex-1 overflow-hidden border transition-colors bg-white",n?"border-primary/60":"border-transparent group-hover:border-border/40"),children:[m&&jsx("div",{className:"absolute inset-0 pointer-events-none z-10 bg-[repeating-linear-gradient(135deg,transparent,transparent_4px,rgba(255,255,255,0.04)_4px,rgba(255,255,255,0.04)_8px)]"}),jsx(goe,{slide:t,canvasSize:r,previewHeight:w}),(t.comments?.length??0)>0&&jsxs("div",{className:"absolute top-0.5 right-0.5 flex items-center gap-0.5 rounded bg-amber-500/90 px-1 py-0.5 text-[8px] font-medium text-white leading-none z-10",children:[jsx(LuMessageSquare,{className:"w-2 h-2"}),t.comments?.length]}),m&&jsx("div",{className:"absolute bottom-0.5 right-0.5 z-10",children:jsx(LuEyeOff,{className:"w-3 h-3 text-muted-foreground"})}),i&&typeof i[e]=="number"&&jsx("div",{className:"absolute bottom-0.5 left-0.5 z-10",children:jsx("span",{className:"text-[8px] font-mono text-amber-400/80 tabular-nums bg-black/50 px-0.5 rounded",children:xoe(i[e])})})]})]})}var N6=Vn__default.memo(THe);function voe(t,e){let[n,r]=useState({}),[o,i]=useState(null),[s,a]=useState(""),[l,c]=useState(null),[d,u]=useState(null);useEffect(()=>{if(!l&&!d)return;let E=()=>{c(null),u(null);};return document.addEventListener("click",E),()=>document.removeEventListener("click",E)},[l,d]);let p=useCallback((E,M)=>{E.dataTransfer.setData("text/plain",String(M)),E.dataTransfer.effectAllowed="move";},[]),f=useCallback(E=>{E.preventDefault(),E.dataTransfer.dropEffect="move";},[]),h=useCallback((E,M)=>{E.preventDefault();let A=E.dataTransfer.getData("text/plain"),R=parseInt(A,10);!isNaN(R)&&R!==M&&t(R,M);},[t]),m=useCallback(E=>{r(M=>({...M,[E]:!M[E]}));},[]),x=useCallback((E,M)=>{i(E),a(M),c(null);},[]),y=useCallback(()=>{o&&s.trim().length>0&&e?.(o,s.trim()),i(null),a("");},[o,s,e]),v=useCallback(()=>{i(null),a("");},[]),S=useCallback((E,M,A,R)=>{E.preventDefault(),E.stopPropagation(),c({x:E.clientX,y:E.clientY,sectionId:M,sectionIndex:A,totalSections:R});},[]),w=useCallback((E,M,A)=>{u({x:E,y:M,slideIndex:A});},[]),C=useCallback(()=>{c(null);},[]),T=useCallback(()=>{u(null);},[]);return {collapsedSections:n,renamingSectionId:o,renameValue:s,sectionContextMenu:l,slideCtxMenu:d,setRenameValue:a,handleDragStart:p,handleDragOver:f,handleDrop:h,toggleSection:m,startRename:x,commitRename:y,cancelRename:v,handleSectionContextMenu:S,handleOpenSlideCtxMenu:w,closeSectionContextMenu:C,closeSlideCtxMenu:T}}var PHe=50;function F2({slides:t,activeSlideIndex:e,canvasSize:n,sectionGroups:r,isOpen:o,canEdit:i,onSelectSlide:s,onSlideContextMenu:a,onMoveSlide:l,onAddSlide:c,onCollapse:d,onAddSection:u,onRenameSection:p,onDeleteSection:f,onMoveSectionUp:h,onMoveSectionDown:m,rehearsalTimings:x,panelWidth:y}){let{t:v}=useTranslation(),S=qi(),w=useRef(new Map),C=useRef(null),T=useMemo(()=>{if(!S||S.remoteUsers.length===0)return;let xe=new Map;for(let Pe of S.remoteUsers){let Xe=Pe.activeSlideIndex,Y=xe.get(Xe),Ge={userName:Pe.userName,userColor:Pe.userColor};Y?Y.push(Ge):xe.set(Xe,[Ge]);}return xe},[S]),E=useMemo(()=>boe(n.width,n.height),[n.width,n.height]),M=r.length>1,{collapsedSections:A,renamingSectionId:R,renameValue:k,sectionContextMenu:N,slideCtxMenu:F,setRenameValue:B,handleDragStart:D,handleDragOver:O,handleDrop:U,toggleSection:H,startRename:j,commitRename:Z,cancelRename:J,handleSectionContextMenu:W,handleOpenSlideCtxMenu:te,closeSectionContextMenu:se,closeSlideCtxMenu:Ce}=voe(l,p),ee=useMemo(()=>yoe(r,M,A),[r,M,A]),ce=t.length>=PHe,{startIndex:de,endIndex:Ne,totalHeight:Ue,offsetY:he,scrollContainerRef:Be,scrollToIndex:Me}=yte({totalItems:ce?ee.length:0,itemHeight:E});useEffect(()=>{if(ce){let xe=ee.findIndex(Pe=>Pe.type==="slide"&&Pe.slideIndex===e);xe>=0&&Me(xe);}else {let xe=w.current.get(e);xe&&xe.scrollIntoView({behavior:"smooth",block:"nearest"});}},[e,ce,Me,ee]),useEffect(()=>{R&&C.current&&(C.current.focus(),C.current.select());},[R]);let ge=useCallback(xe=>Pe=>{Pe?w.current.set(xe,Pe):w.current.delete(xe);},[]);return o?jsxs("aside",{role:"navigation","aria-label":"Slides",className:"flex h-full flex-col border-r border-border bg-secondary/30",style:y?{width:y,flexShrink:0}:void 0,children:[ce?(()=>{let xe=ee.slice(de,Ne+1);return jsx("div",{ref:Be,className:"flex-1 overflow-y-auto px-1.5 pb-2",children:jsx("div",{style:{height:Ue,position:"relative"},children:jsx("div",{style:{position:"absolute",top:he,left:0,right:0},children:jsx("div",{className:"space-y-1",children:xe.map(Pe=>{if(Pe.type==="section"){let Y=r[Pe.sectionIndex];if(!Y)return null;let Ge=A[Y.id]??false;return jsx(k6,{sectionId:Y.id,label:Y.label,slideCount:Y.slideIndexes.length,isCollapsed:Ge,isRenaming:R===Y.id,renameValue:k,canEdit:i,sectionIndex:Pe.sectionIndex,totalSections:r.length,renameInputRef:C,onToggle:H,onContextMenu:W,onStartRename:j,onRenameValueChange:B,onCommitRename:Z,onCancelRename:J},`section-${Y.id}`)}let Xe=t[Pe.slideIndex];return Xe?jsx(N6,{slide:Xe,slideIndex:Pe.slideIndex,isActive:Pe.slideIndex===e,canvasSize:n,canEdit:i,rehearsalTimings:x,presenceUsers:T?.get(Pe.slideIndex),onSelectSlide:s,onSlideContextMenu:a,onAddSection:u,onOpenSlideCtxMenu:te,onDragStart:D,onDragOver:O,onDrop:U,slideRef:ge(Pe.slideIndex)},Xe.id??Pe.slideIndex):null})})})})})})():jsx("div",{className:"flex-1 space-y-1 overflow-y-auto px-1.5 pb-2",children:r.map((xe,Pe)=>{let Xe=A[xe.id]??false;return jsxs("div",{className:"space-y-1",children:[M&&jsx(k6,{sectionId:xe.id,label:xe.label,slideCount:xe.slideIndexes.length,isCollapsed:Xe,isRenaming:R===xe.id,renameValue:k,canEdit:i,sectionIndex:Pe,totalSections:r.length,renameInputRef:C,onToggle:H,onContextMenu:W,onStartRename:j,onRenameValueChange:B,onCommitRename:Z,onCancelRename:J}),!Xe&&xe.slideIndexes.map(Y=>{let Ge=t[Y];return Ge?jsx(N6,{slide:Ge,slideIndex:Y,isActive:Y===e,canvasSize:n,canEdit:i,rehearsalTimings:x,presenceUsers:T?.get(Y),onSelectSlide:s,onSlideContextMenu:a,onAddSection:u,onOpenSlideCtxMenu:te,onDragStart:D,onDragOver:O,onDrop:U,slideRef:ge(Y)},Ge.id??Y):null})]},xe.id)})}),i&&jsx("div",{className:"border-t border-border/60 px-2 py-1.5",children:jsxs("button",{type:"button",className:"flex w-full items-center justify-center gap-1 rounded-sm px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-40",disabled:!i,onClick:c,children:[jsx(LuPlus,{className:"h-3 w-3"}),v("pptx.sections.addSlide")]})}),N&&jsx(poe,{state:N,sectionGroups:r,totalSlides:t.length,onStartRename:j,onDeleteSection:f,onMoveSectionUp:h,onMoveSectionDown:m,onAddSection:u,onClose:se}),F&&jsx(moe,{state:F,onAddSection:u,onClose:Ce})]}):null}var kHe=[1,2,3,4,6,9];function Coe({handoutMaster:t,slidesPerPage:e,onSlidesPerPageChange:n}){let{t:r}=useTranslation();return t?jsxs("div",{className:"space-y-2 px-1",children:[jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1.5",children:r("pptx.master.handoutSlidesPerPage")}),jsx("div",{className:"grid grid-cols-3 gap-1",children:kHe.map(o=>jsx("button",{type:"button",className:le("px-2 py-1.5 rounded text-[11px] font-medium transition-colors",e===o?"bg-primary text-white":"bg-accent/50 text-muted-foreground hover:bg-accent/70 hover:text-foreground"),onClick:()=>n(o),children:o},o))})]}),jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:r("pptx.master.handoutBackground")}),jsx("div",{className:"w-full h-8 rounded border border-border",style:{backgroundColor:t.backgroundColor??"#ffffff"}})]}),t.placeholders&&t.placeholders.length>0&&jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1.5",children:r("pptx.master.handoutPlaceholders")}),jsx("div",{className:"space-y-1",children:t.placeholders.map(o=>jsxs("div",{className:"flex items-center gap-2 rounded px-1.5 py-1 bg-background/50 text-[10px] text-foreground",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500/60 flex-shrink-0"}),o.type]},`${o.type}-${o.idx??"default"}`))})]})]}):jsx("div",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:r("pptx.master.noHandoutMaster")})}function Toe({notesMaster:t}){let{t:e}=useTranslation(),n=useMemo(()=>t?.placeholders?t.placeholders.map(r=>{let o=r.type==="body"?e("pptx.master.notesMasterBody"):r.type==="sldImg"?e("pptx.master.notesMasterSlideImage"):r.type==="hdr"?e("pptx.master.notesMasterHeader"):r.type==="ftr"?e("pptx.master.notesMasterFooter"):r.type==="dt"?e("pptx.master.notesMasterDate"):r.type==="sldNum"?e("pptx.master.notesMasterPageNumber"):r.type;return {type:r.type,label:o,idx:r.idx}}):[],[t?.placeholders,e]);return t?jsxs("div",{className:"space-y-2 px-1",children:[jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:e("pptx.master.notesMasterBackground")}),jsx("div",{className:"w-full h-8 rounded border border-border",style:{backgroundColor:t.backgroundColor??"#ffffff"}})]}),jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1.5",children:e("pptx.master.notesMasterPlaceholders")}),n.length>0?jsx("div",{className:"space-y-1",children:n.map(r=>jsxs("div",{className:"flex items-center gap-2 rounded px-1.5 py-1 bg-background/50 text-[10px] text-foreground",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-green-500/60 flex-shrink-0"}),r.label]},`${r.type}-${r.idx??"default"}`))}):jsx("div",{className:"text-[10px] text-muted-foreground",children:e("pptx.master.noPlaceholders")})]})]}):jsx("div",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:e("pptx.master.noNotesMaster")})}function BHe(t){return {id:t.path,rId:"",slideNumber:0,elements:t.elements??[],backgroundColor:t.backgroundColor,backgroundImage:t.backgroundImage}}function OHe(t){return {id:t.path,rId:"",slideNumber:0,elements:t.elements??[],backgroundColor:t.backgroundColor,backgroundImage:t.backgroundImage}}function Moe({slideMasters:t,activeMasterIndex:e,activeLayoutIndex:n,canvasSize:r,onSelectMaster:o,onSelectLayout:i}){let s=useRef(null);useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"nearest"});},[e,n]);let{t:a}=useTranslation();return jsxs(Fragment,{children:[t.map((l,c)=>{let d=c===e&&n===null,u=l.layouts??[];return jsxs("div",{className:"space-y-1",children:[jsxs("div",{ref:d?s:void 0,className:le("group relative cursor-pointer rounded-lg border-2 p-1 transition-all",d?"border-amber-500 bg-amber-500/10":"border-border bg-background/40 hover:border-border"),onClick:()=>o(c),children:[jsx("div",{className:"relative overflow-hidden rounded bg-white",children:jsx(Qa,{slide:BHe(l),templateElements:[],canvasSize:r})}),jsx("div",{className:"mt-1 px-1",children:jsx("span",{className:le("text-[10px] font-medium",d?"text-amber-400":"text-muted-foreground"),children:l.name||a("pptx.master.master")})})]}),u.length>0&&jsx("div",{className:"ml-3 space-y-1 border-l border-border/40 pl-2",children:u.map((p,f)=>{let h=c===e&&f===n;return jsxs("div",{ref:h?s:void 0,className:le("group relative cursor-pointer rounded-md border-2 p-0.5 transition-all",h?"border-primary bg-primary/10":"border-border bg-background/40 hover:border-border"),onClick:()=>i(c,f),children:[jsx("div",{className:"relative overflow-hidden rounded bg-white",children:jsx(Qa,{slide:OHe(p),templateElements:l.elements??[],canvasSize:r})}),jsx("div",{className:"mt-0.5 px-0.5",children:jsx("span",{className:le("text-[9px]",h?"text-primary":"text-muted-foreground"),children:p.name||a("pptx.master.layout")})})]},p.path)})})]},l.path)}),t.length===0&&jsx("div",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:a("pptx.master.noMasters")})]})}var GHe=[{key:"slides",labelKey:"pptx.master.tabSlides"},{key:"notes",labelKey:"pptx.master.tabNotes"},{key:"handout",labelKey:"pptx.master.tabHandout"}];function B6({slideMasters:t,activeMasterIndex:e,activeLayoutIndex:n,canvasSize:r,masterViewTab:o,notesMaster:i,handoutMaster:s,handoutSlidesPerPage:a,onSelectMaster:l,onSelectLayout:c,onCollapse:d,onTabChange:u,onHandoutSlidesPerPageChange:p}){let f=useRef(null),{t:h}=useTranslation(),m=useCallback(y=>{l(y);},[l]),x=useCallback((y,v)=>{c(y,v);},[c]);return jsxs("aside",{className:"flex h-full flex-col border-r border-border/80 bg-background/70 backdrop-blur-sm w-56",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:h(o==="slides"?"pptx.master.title":o==="notes"?"pptx.master.notesMasterTitle":"pptx.master.handoutMasterTitle")}),jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",title:h("pptx.master.collapseMasterPane"),onClick:d,children:jsx(LuPanelLeftClose,{className:"h-3.5 w-3.5"})})]}),jsx("div",{className:"flex border-b border-border/60 px-1",children:GHe.map(y=>jsx("button",{type:"button",className:le("flex-1 px-1 py-1.5 text-[10px] font-medium transition-colors border-b-2",o===y.key?"border-amber-500 text-amber-400":"border-transparent text-muted-foreground hover:text-foreground"),onClick:()=>u(y.key),children:h(y.labelKey)},y.key))}),jsxs("div",{ref:f,className:"flex-1 space-y-2 overflow-y-auto px-1.5 pb-2 pt-1",children:[o==="slides"&&jsx(Moe,{slideMasters:t,activeMasterIndex:e,activeLayoutIndex:n,canvasSize:r,onSelectMaster:m,onSelectLayout:x}),o==="notes"&&jsx(Toe,{notesMaster:i}),o==="handout"&&jsx(Coe,{handoutMaster:s,slidesPerPage:a,onSlidesPerPageChange:p})]})]})}var jHe=720,XHe=960,WHe={sldImg:"pptx.master.notesMasterSlideImage",body:"pptx.master.notesMasterBody",hdr:"pptx.master.notesMasterHeader",ftr:"pptx.master.notesMasterFooter",dt:"pptx.master.notesMasterDate",sldNum:"pptx.master.notesMasterPageNumber"},YHe={sldImg:{x:.1,y:.05,w:.8,h:.4},body:{x:.1,y:.5,w:.8,h:.4},hdr:{x:0,y:0,w:.4,h:.04},ftr:{x:0,y:.96,w:.4,h:.04},dt:{x:.6,y:0,w:.4,h:.04},sldNum:{x:.6,y:.96,w:.4,h:.04}};function O6({notesMaster:t,canvasSize:e,notesCanvasSize:n,slideThumbnail:r,notesText:o,slideNumber:i}){let{t:s}=useTranslation(),a=n?.width??jHe,l=n?.height??XHe,c=useMemo(()=>{let f=e.width/a,h=e.height/l;return Math.min(f,h,1)*.85},[e.width,e.height,a,l]),d=a*c,u=l*c,p=useMemo(()=>t?.placeholders?t.placeholders:[{type:"sldImg",idx:void 0},{type:"body",idx:void 0},{type:"hdr",idx:void 0},{type:"ftr",idx:void 0},{type:"dt",idx:void 0},{type:"sldNum",idx:void 0}],[t?.placeholders]);return t?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxs("div",{className:"relative bg-white shadow-lg border border-border rounded",style:{width:d,height:u},children:[t.backgroundColor&&jsx("div",{className:"absolute inset-0 rounded",style:{backgroundColor:t.backgroundColor}}),p.map(f=>{let h=YHe[f.type];if(!h)return null;let m=WHe[f.type]??f.type,x=f.type==="sldImg",y=f.type==="body",v=f.type==="sldNum";return x&&r?jsx("div",{className:"absolute overflow-hidden border border-solid border-gray-300",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u},children:jsx("img",{src:r,alt:i?`Slide ${i}`:"Slide",className:"w-full h-full object-contain"})},`${f.type}-${f.idx??"default"}`):y&&o!==void 0?jsx("div",{className:"absolute overflow-auto border border-solid border-gray-200 p-2",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u,fontSize:Math.max(8,Math.min(11,d*.015)),lineHeight:1.4,color:"#374151",whiteSpace:"pre-wrap"},children:o||s("pptx.notes.noNotes")},`${f.type}-${f.idx??"default"}`):v&&i!==void 0?jsx("div",{className:"absolute flex items-center justify-center",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u,fontSize:Math.max(8,Math.min(12,d*.018)),color:"rgba(156, 163, 175, 0.6)"},children:i},`${f.type}-${f.idx??"default"}`):jsx("div",{className:"absolute flex items-center justify-center border border-dashed",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u,borderColor:x?"rgba(59, 130, 246, 0.5)":y?"rgba(34, 197, 94, 0.5)":"rgba(156, 163, 175, 0.4)",backgroundColor:x?"rgba(59, 130, 246, 0.05)":y?"rgba(34, 197, 94, 0.05)":"transparent"},children:jsx("span",{className:"text-center px-1",style:{fontSize:Math.max(8,Math.min(12,d*.018)),color:x?"rgba(59, 130, 246, 0.7)":y?"rgba(34, 197, 94, 0.7)":"rgba(156, 163, 175, 0.6)"},children:s(m)})},`${f.type}-${f.idx??"default"}`)})]})}):jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:s("pptx.master.noNotesMaster")})}var Poe=720,Roe=960,koe=.06;function ZHe(t,e){let n=koe,r=koe,o=1-2*n,i=1-2*r,s=.02;switch(t){case 1:{let a=o*.8,l=a/e;return [{x:n+(o-a)/2,y:r+(i-l)/2,w:a,h:l}]}case 2:{let a=o*.75,l=a/e,c=l*2+s,d=r+(i-c)/2;return [0,1].map(u=>({x:n+(o-a)/2,y:d+u*(l+s),w:a,h:l}))}case 3:{let a=o*.5,l=a/e,c=l*3+s*2,d=r+(i-c)/2;return [0,1,2].map(u=>({x:n,y:d+u*(l+s),w:a,h:l}))}case 4:{let c=(o-s)/2,d=c/e,u=d*2+s*1,p=r+(i-u)/2;return Array.from({length:4},(f,h)=>({x:n+h%2*(c+s),y:p+Math.floor(h/2)*(d+s),w:c,h:d}))}case 6:{let c=(o-s)/2,d=c/e,u=d*3+s*2,p=r+(i-u)/2;return Array.from({length:6},(f,h)=>({x:n+h%2*(c+s),y:p+Math.floor(h/2)*(d+s),w:c,h:d}))}case 9:{let c=(o-s*2)/3,d=c/e,u=d*3+s*2,p=r+(i-u)/2;return Array.from({length:9},(f,h)=>({x:n+h%3*(c+s),y:p+Math.floor(h/3)*(d+s),w:c,h:d}))}default:return []}}function U6({handoutMaster:t,canvasSize:e,slidesPerPage:n,slideThumbnails:r,pageNumber:o}){let{t:i}=useTranslation(),s=4/3,a=useMemo(()=>{let u=e.width/Poe,p=e.height/Roe;return Math.min(u,p,1)*.85},[e.width,e.height]),l=Poe*a,c=Roe*a,d=useMemo(()=>ZHe(n,s),[n,s]);return t?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxs("div",{className:"relative bg-white shadow-lg border border-gray-300 rounded",style:{width:l,height:c},children:[t.backgroundColor&&jsx("div",{className:"absolute inset-0 rounded",style:{backgroundColor:t.backgroundColor}}),d.map((u,p)=>{let f=r?.[p];return jsx("div",{className:`absolute flex items-center justify-center overflow-hidden ${f?"border border-solid border-gray-300":"border border-dashed border-blue-400/50 bg-blue-50/30"}`,style:{left:u.x*l,top:u.y*c,width:u.w*l,height:u.h*c},children:f?jsx("img",{src:f,alt:`Slide ${(o?(o-1)*n:0)+p+1}`,className:"w-full h-full object-contain"}):jsx("span",{className:"text-blue-400/60 font-medium",style:{fontSize:Math.max(8,Math.min(14,u.w*l*.08))},children:i("pptx.master.handoutSlideSlot",{number:p+1})})},p)}),jsx("div",{className:"absolute left-0 top-0 px-1 text-gray-400/50 border-b border-r border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:i("pptx.master.notesMasterHeader")}),jsx("div",{className:"absolute right-0 top-0 px-1 text-gray-400/50 border-b border-l border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:i("pptx.master.notesMasterDate")}),jsx("div",{className:"absolute left-0 bottom-0 px-1 text-gray-400/50 border-t border-r border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:i("pptx.master.notesMasterFooter")}),jsx("div",{className:"absolute right-0 bottom-0 px-1 text-gray-400/50 border-t border-l border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:o!==void 0?String(o):i("pptx.master.notesMasterPageNumber")})]})}):jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:i("pptx.master.noHandoutMaster")})}function Noe({section:t,slides:e,gridCols:n,zoomScale:r,renderSlideCard:o}){let[i,s]=useState(t.defaultCollapsed??false);return jsxs("div",{className:"mb-4",children:[jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 rounded px-2 py-1.5 text-[11px] uppercase tracking-wide text-muted-foreground hover:bg-muted/60 hover:text-foreground mb-2",onClick:()=>s(a=>!a),children:[t.color&&jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:t.color}}),jsx(LuChevronDown,{className:le("h-3 w-3 transition-transform",i?"-rotate-90":"rotate-0")}),jsx("span",{className:"truncate text-left",children:t.label}),jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:t.slideIndexes.length})]}),!i&&jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:t.slideIndexes.map(a=>{let l=e[a];return l?o(l,a):null})})]})}function rze({slide:t,index:e,isActive:n,isDragTarget:r,isSelected:o,selectedCount:i,selectionOrder:s,canvasSize:a,canEdit:l,onSlideClick:c,onDoubleClick:d,onContextMenu:u,onDragStart:p,onDragOver:f,onDragLeave:h,onDrop:m}){return jsxs("div",{className:le("group relative cursor-pointer rounded-lg border-2 p-1 transition-all",r?"border-primary bg-primary/20":o?"border-primary bg-primary/10 ring-1 ring-primary/50":n?"border-primary/50 bg-primary/5":"border-border bg-background/50 hover:border-border",t.hidden&&"opacity-40"),onClick:x=>c(x,e),onDoubleClick:()=>d(e),onContextMenu:x=>u(x,e),draggable:l,onDragStart:x=>p(x,e),onDragOver:x=>f(x,e),onDragLeave:h,onDrop:x=>m(x,e),children:[jsx("div",{className:"aspect-video overflow-hidden rounded bg-white",children:jsx(Qa,{slide:t,templateElements:[],canvasSize:a})}),jsxs("div",{className:"mt-1 flex items-center justify-between px-0.5",children:[jsx("span",{className:le("text-[11px] font-medium",o?"text-primary":n?"text-primary/70":"text-muted-foreground"),children:e+1}),t.hidden&&jsx(LuEyeOff,{className:"h-3 w-3 text-muted-foreground"})]}),o&&i>1&&jsx("div",{className:"absolute top-2 right-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white text-[10px] font-bold",children:s})]})}function oze(t,e){return !(t.slide.id!==e.slide.id||t.slide.isDirty!==e.slide.isDirty||t.slide.hidden!==e.slide.hidden||t.slide.elements!==e.slide.elements||t.index!==e.index||t.isActive!==e.isActive||t.isDragTarget!==e.isDragTarget||t.isSelected!==e.isSelected||t.selectedCount!==e.selectedCount||t.selectionOrder!==e.selectionOrder||t.canEdit!==e.canEdit||t.canvasSize.width!==e.canvasSize.width||t.canvasSize.height!==e.canvasSize.height||t.onSlideClick!==e.onSlideClick||t.onDoubleClick!==e.onDoubleClick||t.onContextMenu!==e.onContextMenu||t.onDragStart!==e.onDragStart||t.onDragOver!==e.onDragOver||t.onDragLeave!==e.onDragLeave||t.onDrop!==e.onDrop)}var Loe=Vn__default.memo(rze,oze);function Foe({x:t,y:e,selectedCount:n,hasClipboard:r,hasHiddenInSelection:o,hasVisibleInSelection:i,sectionGroups:s,onDelete:a,onDuplicate:l,onCopy:c,onPaste:d,onToggleHide:u,onClose:p}){let{t:f}=useTranslation(),h=Math.max(8,Math.min(t,window.innerWidth-220)),m=Math.max(8,Math.min(e,window.innerHeight-300)),x=n>1?` (${n})`:"";return jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[119]",onClick:p,onContextMenu:y=>{y.preventDefault(),p();}}),jsxs("div",{className:"fixed z-[120] min-w-[200px] rounded border border-border bg-popover shadow-2xl py-1.5 text-xs text-foreground",style:{left:h,top:m},children:[jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:c,children:[jsx(LuCopy,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.copy"),x]}),r&&jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:d,children:[jsx(LuClipboardPaste,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.paste")]}),jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:l,children:[jsx(LuCopyPlus,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.duplicate"),x]}),jsx("div",{className:"my-1 border-t border-border"}),i&&jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:u,children:[jsx(LuEyeOff,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.hideSlides"),x]}),o&&jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:u,children:[jsx(LuEye,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.showSlides"),x]}),jsx("div",{className:"my-1 border-t border-border"}),jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-red-300 hover:bg-red-900/40",onClick:a,children:[jsx(LuTrash2,{className:"h-3.5 w-3.5"}),f("pptx.slideSorter.contextMenu.delete"),x]})]})]})}function Boe(t){let{slides:e,activeSlideIndex:n,canEdit:r,selectedSlideIds:o,selectedIndexes:i,contextMenu:s,setContextMenu:a,setSelectedSlideIds:l,setZoom:c,onClose:d,handleDeleteSelected:u,handleCopySelected:p,handlePaste:f,handleDuplicateSelected:h,handleSelectAll:m}=t;useEffect(()=>{let x=y=>{s&&a(null);let v=y.ctrlKey||y.metaKey;if(y.key==="Escape"){if(y.stopPropagation(),o.length>1){let S=e[n];l(S?.id?[S.id]:[]);}else d();return}if((y.key==="Delete"||y.key==="Backspace")&&r){y.preventDefault(),i.length>0&&u();return}if(v&&y.key==="c"){y.preventDefault(),p();return}if(v&&y.key==="v"&&r){y.preventDefault(),f();return}if(v&&y.key==="d"&&r){y.preventDefault(),h();return}if(v&&y.key==="a"){y.preventDefault(),m();return}if(v&&(y.key==="="||y.key==="+")){y.preventDefault(),c(S=>Math.min(200,S+10));return}v&&y.key==="-"&&(y.preventDefault(),c(S=>Math.max(50,S-10)));};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[d,r,o,i,n,e,s,a,l,c,u,p,f,h,m]);}function Ooe(t){let{slides:e,activeSlideIndex:n,canEdit:r,sectionGroups:o,onSelectSlide:i,onMoveSlide:s,onDeleteSlides:a,onDuplicateSlides:l,onToggleHideSlides:c,onClose:d}=t,[u,p]=useState(null),[f,h]=useState(()=>{let he=e[n];return he?.id?[he.id]:[]}),[m,x]=useState(n),[y,v]=useState(null),[S,w]=useState(100),[C,T]=useState([]),E=useRef(null),M=useMemo(()=>{let he=new Map;return e.forEach((Be,Me)=>he.set(Be.id,Me)),he},[e]),A=useMemo(()=>f.map(he=>M.get(he)).filter(he=>he!==void 0).sort((he,Be)=>he-Be),[f,M]),R=useCallback(he=>f.includes(he),[f]),k=useCallback((he,Be)=>{let Me=e[Be];if(Me)if(he.ctrlKey||he.metaKey)h(ge=>ge.includes(Me.id)?ge.filter(Te=>Te!==Me.id):[...ge,Me.id]),x(Be);else if(he.shiftKey){let ge=Math.min(m,Be),Te=Math.max(m,Be),be=[];for(let xe=ge;xe<=Te;xe++)e[xe]?.id&&be.push(e[xe].id);h(be);}else h([Me.id]),x(Be);},[e,m]),N=useCallback((he,Be)=>{he.preventDefault(),he.stopPropagation();let Me=e[Be];Me&&(f.includes(Me.id)||(h([Me.id]),x(Be)),v({x:he.clientX,y:he.clientY,slideIndex:Be}));},[e,f]),F=useCallback(()=>{v(null);},[]),B=useCallback(()=>{A.length!==0&&(a(A),h([]),F());},[A,a,F]),D=useCallback(()=>{A.length!==0&&(l(A),F());},[A,l,F]),O=useCallback(()=>{T([...f]),F();},[f,F]),U=useCallback(()=>{if(C.length===0)return;let he=C.map(Be=>M.get(Be)).filter(Be=>Be!==void 0).sort((Be,Me)=>Be-Me);he.length>0&&l(he),F();},[C,M,l,F]),H=useCallback(()=>{A.length!==0&&(c(A),F());},[A,c,F]),j=useCallback(()=>{h(e.map(he=>he.id));},[e]);Boe({slides:e,activeSlideIndex:n,canEdit:r,selectedSlideIds:f,selectedIndexes:A,contextMenu:y,setContextMenu:v,setSelectedSlideIds:h,setZoom:w,onClose:d,handleDeleteSelected:B,handleCopySelected:O,handlePaste:U,handleDuplicateSelected:D,handleSelectAll:j});let Z=useCallback(he=>{he.target===E.current&&d();},[d]),J=useCallback((he,Be)=>{he.dataTransfer.setData("text/plain",String(Be)),he.dataTransfer.effectAllowed="move";},[]),W=useCallback((he,Be)=>{he.preventDefault(),he.dataTransfer.dropEffect="move",p(Be);},[]),te=useCallback(()=>p(null),[]),se=useCallback((he,Be)=>{he.preventDefault(),p(null);let Me=parseInt(he.dataTransfer.getData("text/plain"),10);!isNaN(Me)&&Me!==Be&&s(Me,Be);},[s]),Ce=useCallback(he=>i(he),[i]),ee=S/100,ce=useMemo(()=>ee>=1.8?2:ee>=1.4?3:ee>=1?4:ee>=.7?5:6,[ee]),de=o.length>1,Ne=useMemo(()=>A.some(he=>e[he]?.hidden),[A,e]),Ue=useMemo(()=>A.some(he=>!e[he]?.hidden),[A,e]);return {dragOverIndex:u,selectedSlideIds:f,contextMenu:y,zoom:S,setZoom:w,clipboardSlideIds:C,backdropRef:E,selectedIndexes:A,isSelected:R,handleSlideClick:k,handleContextMenu:N,closeContextMenu:F,handleDeleteSelected:B,handleDuplicateSelected:D,handleCopySelected:O,handlePaste:U,handleToggleHideSelected:H,handleBackdropClick:Z,handleDragStart:J,handleDragOver:W,handleDragLeave:te,handleDrop:se,handleDoubleClick:Ce,zoomScale:ee,gridCols:ce,showSectionHeaders:de,hasHiddenInSelection:Ne,hasVisibleInSelection:Ue}}function $6({slides:t,activeSlideIndex:e,canvasSize:n,canEdit:r,sectionGroups:o,onSelectSlide:i,onMoveSlide:s,onDeleteSlides:a,onDuplicateSlides:l,onToggleHideSlides:c,onClose:d}){let{t:u}=useTranslation(),p=Ooe({slides:t,activeSlideIndex:e,canEdit:r,sectionGroups:o,onSelectSlide:i,onMoveSlide:s,onDeleteSlides:a,onDuplicateSlides:l,onToggleHideSlides:c,onClose:d}),f=(h,m)=>jsx(Loe,{slide:h,index:m,isActive:m===e,isDragTarget:p.dragOverIndex===m,isSelected:p.isSelected(h.id),selectedCount:p.selectedSlideIds.length,selectionOrder:p.selectedIndexes.indexOf(m)+1,canvasSize:n,canEdit:r,onSlideClick:p.handleSlideClick,onDoubleClick:p.handleDoubleClick,onContextMenu:p.handleContextMenu,onDragStart:p.handleDragStart,onDragOver:p.handleDragOver,onDragLeave:p.handleDragLeave,onDrop:p.handleDrop},h.id||m);return jsxs("div",{ref:p.backdropRef,style:{zIndex:1200},className:"fixed inset-0 flex flex-col bg-black/70 backdrop-blur-sm",onClick:p.handleBackdropClick,children:[jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border/50",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("h2",{className:"text-sm font-medium text-foreground",children:u("pptx.slideSorter.title")}),p.selectedSlideIds.length>1&&jsx("span",{className:"text-xs text-muted-foreground",children:u("pptx.slideSorter.selectedCount",{count:p.selectedSlideIds.length})})]}),jsx("button",{type:"button",onClick:d,className:"flex h-8 w-8 items-center justify-center rounded-full bg-muted text-foreground hover:bg-accent hover:text-white transition-colors","aria-label":u("pptx.slideSorter.close"),children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:jsx("div",{className:"mx-auto",style:{maxWidth:`${Math.max(600,p.gridCols*220*p.zoomScale)}px`},children:p.showSectionHeaders?o.map(h=>jsx(Noe,{section:h,slides:t,gridCols:p.gridCols,zoomScale:p.zoomScale,renderSlideCard:f},h.id)):jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${p.gridCols}, minmax(0, 1fr))`},children:t.map((h,m)=>f(h,m))})})}),jsxs("div",{className:"flex items-center justify-between px-6 py-2.5 border-t border-border/50 bg-background/50",children:[jsx("div",{className:"text-xs text-muted-foreground",children:u("pptx.slideSorter.slideCount",{count:t.length})}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",disabled:p.zoom<=50,onClick:()=>p.setZoom(h=>Math.max(50,h-10)),"aria-label":u("pptx.slideSorter.zoomOut"),children:jsx(LuMinus,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:50,max:200,step:10,value:p.zoom,onChange:h=>p.setZoom(Number(h.target.value)),className:"h-1 w-24 cursor-pointer appearance-none rounded-full bg-accent accent-primary","aria-label":u("pptx.slideSorter.zoom")}),jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",disabled:p.zoom>=200,onClick:()=>p.setZoom(h=>Math.min(200,h+10)),"aria-label":u("pptx.slideSorter.zoomIn"),children:jsx(LuPlus,{className:"h-3.5 w-3.5"})}),jsxs("span",{className:"min-w-[3ch] text-right text-xs text-muted-foreground",children:[p.zoom,"%"]})]})]}),p.contextMenu&&r&&jsx(Foe,{x:p.contextMenu.x,y:p.contextMenu.y,selectedCount:p.selectedSlideIds.length,hasClipboard:p.clipboardSlideIds.length>0,hasHiddenInSelection:p.hasHiddenInSelection,hasVisibleInSelection:p.hasVisibleInSelection,sectionGroups:p.showSectionHeaders?o:[],onDelete:p.handleDeleteSelected,onDuplicate:p.handleDuplicateSelected,onCopy:p.handleCopySelected,onPaste:p.handlePaste,onToggleHide:p.handleToggleHideSelected,onClose:p.closeContextMenu})]})}function Dh(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function kv(t){let e=t.split(`
|
|
4661
|
+
`){a.push({...f,style:{...f.style}});continue}if(p<r){a.push({...f,style:{...f.style}});continue}if(p>i){a.push({...f,style:{...f.style}});continue}if(p===r&&p===i){oUe(f,o,s,n,a);let h=(o>0?1:0)+1+(s<f.text.length?1:0),m=a.length-h+(o>0?1:0);l=m,c=0,d=m,u=s-o;continue}if(p===r){if(o===0)l=a.length,c=0,a.push({...f,style:{...f.style,...n}});else {let h={text:f.text.slice(0,o),style:{...f.style}};f.bulletInfo&&(h.bulletInfo=f.bulletInfo),a.push(h),l=a.length,c=0,a.push({text:f.text.slice(o),style:{...f.style,...n}});}continue}if(p===i){s>=f.text.length?(a.push({...f,style:{...f.style,...n}}),d=a.length-1,u=f.text.length):(a.push({text:f.text.slice(0,s),style:{...f.style,...n}}),d=a.length-1,u=s,a.push({text:f.text.slice(s),style:{...f.style}}));continue}a.push({...f,style:{...f.style,...n}});}return {newSegments:a,newSelection:{startSegIdx:l,startOffset:c,endSegIdx:d,endOffset:u}}}function oUe(t,e,n,r,o){if(e===0&&n>=t.text.length){o.push({...t,style:{...t.style,...r}});return}if(e>0){let i={text:t.text.slice(0,e),style:{...t.style}};t.bulletInfo&&(i.bulletInfo=t.bulletInfo),o.push(i);}o.push({text:t.text.slice(e,n),style:{...t.style,...r}}),n<t.text.length&&o.push({text:t.text.slice(n),style:{...t.style}});}function Oee(t,e,n,r,o){let i=window.getSelection();if(!i)return;let s=Nee(t,e,n),a=Nee(t,r,o);if(!s||!a)return;let l=document.createRange();l.setStart(s.node,s.offset),l.setEnd(a.node,a.offset),i.removeAllRanges(),i.addRange(l);}function Nee(t,e,n){let r=t.querySelector(`[data-seg-idx="${e}"]`);if(!r)return null;let o=document.createTreeWalker(r,NodeFilter.SHOW_TEXT),i=0,s;for(;s=o.nextNode();){let l=s.length;if(i+l>=n)return {node:s,offset:n-i};i+=l;}let a=r.querySelector("*")?null:r.firstChild;return a&&a.nodeType===Node.TEXT_NODE?{node:a,offset:a.length}:null}function $ee({initialText:t,spellCheck:e,rtl:n,textDirection:r,textStyle:o,textStyleRaw:i,layoutStyle:s,element:a,onCommit:l,onCancel:c,onEditChange:d,onFormatText:u}){let p=useRef(null),f=useRef(null);f.current===null&&(f.current={initialText:t,hasRichSegments:!!(ot(a)&&a.textSegments&&a.textSegments.length>0)});let h=f.current,m=useCallback(()=>{let E=p.current;return E?E.innerText||"":h.initialText},[h]),x=useCallback(()=>{d(m());},[m,d]);useEffect(()=>{let E=p.current;if(!E)return;E.focus();let M=window.getSelection();if(M){let A=document.createRange();A.selectNodeContents(E),A.collapse(false),M.removeAllRanges(),M.addRange(A);}},[]);let y=useRef(false);useLayoutEffect(()=>{if(!y.current){y.current=true;return}let E=Lee();!E||!p.current||Oee(p.current,E.startSegIdx,E.startOffset,E.endSegIdx,E.endOffset);});let v=qx(i),S=kf(a),w=v?.transform,C=[S,w].filter(Boolean).join(" ")||void 0,T={...s,...o,...v,transform:C,transformOrigin:v?.transformOrigin||"center"};return jsx("div",{ref:p,contentEditable:true,suppressContentEditableWarning:true,"data-inline-editor":true,spellCheck:e,dir:n?"rtl":"ltr",className:"relative z-10 w-full h-full whitespace-pre-wrap break-words leading-[1.3] outline-none",style:{...T,cursor:"text",minHeight:"1em"},onPointerDown:E=>E.stopPropagation(),onMouseDown:E=>E.stopPropagation(),onClick:E=>E.stopPropagation(),onInput:x,onBlur:()=>{d(m()),l();},onKeyDown:E=>{if((E.ctrlKey||E.metaKey)&&!E.shiftKey&&u){let M=E.key.toLowerCase();if(M==="b"||M==="i"||M==="u"){E.preventDefault(),E.stopPropagation();let R=(ot(a)?a.textSegments?.[0]:void 0)?.style??(ot(a)?a.textStyle:void 0);switch(M){case "b":u({bold:!R?.bold});break;case "i":u({italic:!R?.italic});break;case "u":u({underline:!R?.underline});break}return}}if(E.key==="Escape"){E.preventDefault(),c();return}E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),d(m()),l());},onPaste:E=>{E.preventDefault();let M=E.clipboardData.getData("text/plain");document.execCommand("insertText",false,M);},children:h.hasRichSegments?Al(a,bi):h.initialText})}function gUe(){return null}var xUe=Vn__default.lazy(async()=>{try{return await Promise.resolve().then(()=>(Gee(),zee))}catch{return {default:gUe}}});function yUe(t){if(t)try{let e=t.indexOf(",");if(e===-1)return;let n=t.slice(0,e),r=t.slice(e+1),i=n.match(/data:([^;]+)/)?.[1]??"application/octet-stream",s=atob(r),a=new Uint8Array(s.length);for(let c=0;c<s.length;c++)a[c]=s.charCodeAt(c);let l=new Blob([a],{type:i});return URL.createObjectURL(l)}catch{return}}function bUe({element:t,width:e,height:n}){let r=t.posterImage??t.imageData;return r?jsx("img",{src:r,alt:"3D Model",className:"pointer-events-none select-none",style:{width:e,height:n,objectFit:"contain"},draggable:false}):jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center text-[11px] text-gray-400 bg-gray-50 border border-dashed border-gray-200 rounded",style:{width:e,height:n},children:[jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"mb-1 text-gray-300",children:[jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),jsx("line",{x1:"12",y1:"22.08",x2:"12",y2:"12"})]}),jsx("span",{children:"3D Model"})]})}var DU=class extends Vn__default.Component{constructor(e){super(e),this.state={hasError:false};}static getDerivedStateFromError(){return {hasError:true}}render(){return this.state.hasError?this.props.fallback:this.props.children}};function Wee({element:t,width:e,height:n,interactive:r}){let[o,i]=useState(null);useEffect(()=>{let l=false;return Promise.resolve().then(()=>(hh(),GO)).then(()=>{l||i(true);}).catch(()=>{l||i(false);}),()=>{l=true;}},[]);let s=useMemo(()=>yUe(t.modelData),[t.modelData]);useEffect(()=>()=>{s&&URL.revokeObjectURL(s);},[s]);let a=jsx(bUe,{element:t,width:e,height:n});return o===null||!o||!s?a:jsx(DU,{fallback:a,children:jsx(Suspense,{fallback:a,children:jsx(xUe,{modelUrl:s,interactive:r,width:e,height:n})})})}function Co(t,e,n,r){let i=e/(t.length*.6),s=n*.5;return Math.max(6,Math.min(r,i,s))}function LU(t,e,n,r){let o=Math.min(n*.2,r*.4);return [`${t},${e}`,`${t+n-o},${e}`,`${t+n},${e+r/2}`,`${t+n-o},${e+r}`,`${t},${e+r}`,`${t+o},${e+r/2}`].join(" ")}function Yee(t,e,n,r,o){let i=[],s=Math.PI*2/(o*2);for(let a=0;a<o*2;a++){let l=a*s-Math.PI/2,c=a%2===0?n:r,d=t+c*Math.cos(l),u=e+c*Math.sin(l);i.push(a===0?`M${d},${u}`:`L${d},${u}`);}return i.push("Z"),i.join(" ")}function FU(t,e,n){let r={};return t?.backgroundColor&&(r.backgroundColor=t.backgroundColor),t?.outlineColor&&(r.border=`${t.outlineWidth??1}px solid ${t.outlineColor}`),jsx("div",{className:`w-full h-full ${n}`,style:r,children:e})}function qee({elementId:t,shapes:e,style:n,palette:r}){let o=1/0,i=1/0,s=-1/0,a=-1/0;for(let p of e)p.x<o&&(o=p.x),p.y<i&&(i=p.y),p.x+p.width>s&&(s=p.x+p.width),p.y+p.height>a&&(a=p.y+p.height);let l=s-o||1,c=a-i||1,d=fn(n),u=ar(n);return jsx("svg",{viewBox:`0 0 ${l} ${c}`,className:"w-full h-full pointer-events-none",preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-drawing-shapes",children:e.map((p,f)=>{let h=p.fillColor??Gt(f,r),m=p.x-o,x=p.y-i,y=p.shapeType==="roundRect"?Math.min(p.width,p.height)*.1:0,v=p.shapeType==="ellipse",S=p.shapeType==="chevron"||p.shapeType==="homePlate",w=p.rotation?`rotate(${p.rotation} ${m+p.width/2} ${x+p.height/2})`:void 0,C=p.strokeColor??(u>0?"rgba(255,255,255,0.3)":"none"),T=p.strokeWidth??u,E=p.fontSize??Co(p.text??"",p.width*.85,p.height,14);return jsxs("g",{style:{filter:d},children:[v?jsx("ellipse",{cx:m+p.width/2,cy:x+p.height/2,rx:p.width/2,ry:p.height/2,fill:h,stroke:C,strokeWidth:T,transform:w}):S?jsx("polygon",{points:LU(m,x,p.width,p.height),fill:h,stroke:C,strokeWidth:T,transform:w}):jsx("rect",{x:m,y:x,width:p.width,height:p.height,rx:y,fill:h,stroke:C,strokeWidth:T,transform:w}),p.text?jsx("text",{x:m+p.width/2,y:x+p.height/2,textAnchor:"middle",dominantBaseline:"central",fill:p.fontColor??"white",fontSize:E,className:"pointer-events-none",children:sn(p.text,40)}):null]},`${t}-dsp-${p.id}-${f}`)})})}function tk({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=4,c=(i-s*2-a*(e.length-1))/e.length,d=o-s*2,u=Math.min(6,c*.15),p=fn(r),f=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-list",children:e.map((h,m)=>{let x=s+m*(c+a),y=Co(h.text,d*.9,c,12);return jsxs("g",{style:{filter:p},children:[jsx("rect",{x:s,y:x,width:d,height:c,rx:u,fill:Gt(m,n),opacity:bn(m,e.length,r),stroke:f>0?"rgba(255,255,255,0.3)":"none",strokeWidth:f}),jsx("text",{x:s+d/2,y:x+c/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:y,className:"pointer-events-none",children:sn(h.text,40)})]},`${t.id}-list-${h.id}-${m}`)})})}function Kee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=4,l=Math.min(16,o*.04),d=(o-s*2-a*(e.length-1))/e.length,u=Math.min(i-s*2,i*.6),p=i/2,f=fn(r),h=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-process",children:e.map((m,x)=>{let y=s+x*(d+a),v=u/2,S=x===0,w=x===e.length-1,C=S?`${y},${p-v} ${y+d-l},${p-v} ${y+d},${p} ${y+d-l},${p+v} ${y},${p+v}`:w?`${y},${p-v} ${y+d},${p-v} ${y+d},${p+v} ${y},${p+v} ${y+l},${p}`:`${y},${p-v} ${y+d-l},${p-v} ${y+d},${p} ${y+d-l},${p+v} ${y},${p+v} ${y+l},${p}`,T=Co(m.text,d*.7,u,12);return jsxs("g",{style:{filter:f},children:[jsx("polygon",{points:C,fill:Gt(x,n),opacity:bn(x,e.length,r),stroke:h>0?"rgba(255,255,255,0.3)":"none",strokeWidth:h}),jsx("text",{x:y+d/2,y:p,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:T,className:"pointer-events-none",children:sn(m.text,25)})]},`${t.id}-process-${m.id}-${x}`)})})}function Zee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=Math.min(o,i),a=o/2,l=i/2,c=s*.35,d=Math.max(s*.06,Math.min(s*.12,200/e.length)),u=fn(r),p=ar(r);return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-cycle",children:[e.map((f,h)=>{let m=h/e.length*Math.PI*2-Math.PI/2,x=a+c*Math.cos(m),y=l+c*Math.sin(m),S=(h+1)%e.length/e.length*Math.PI*2-Math.PI/2,w=a+c*Math.cos(S),C=l+c*Math.sin(S),T=(m+S)/2,E=h===e.length-1?(m+S+Math.PI*2)/2:T,M=c*.15,A=a+(c+M)*Math.cos(E),R=l+(c+M)*Math.sin(E);return jsx("path",{d:`M${x},${y} Q${A},${R} ${w},${C}`,fill:"none",stroke:"#94a3b8",strokeWidth:1.5,opacity:.5,markerEnd:void 0},`${t.id}-cycle-conn-${h}`)}),e.map((f,h)=>{let m=h/e.length*Math.PI*2-Math.PI/2,x=a+c*Math.cos(m),y=l+c*Math.sin(m),v=Co(f.text,d*1.4,d*2,11);return jsxs("g",{style:{filter:u},children:[jsx("circle",{cx:x,cy:y,r:d,fill:Gt(h,n),opacity:bn(h,e.length,r),stroke:p>0?"rgba(255,255,255,0.3)":"none",strokeWidth:p}),jsx("text",{x,y,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:v,className:"pointer-events-none",children:sn(f.text,20)})]},`${t.id}-cycle-${f.id}-${h}`)})]})}function Jee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=Math.ceil(Math.sqrt(e.length)),a=Math.ceil(e.length/s),l=8,c=6,d=o-l*2,u=i-l*2,p=(d-c*(s-1))/s,f=(u-c*(a-1))/a,h=Math.min(6,Math.min(p,f)*.1),m=fn(r),x=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-matrix",children:e.map((y,v)=>{let S=v%s,w=Math.floor(v/s),C=l+S*(p+c),T=l+w*(f+c),E=Co(y.text,p*.85,f,12);return jsxs("g",{style:{filter:m},children:[jsx("rect",{x:C,y:T,width:p,height:f,rx:h,fill:Gt(v,n),opacity:bn(v,e.length,r),stroke:x>0?"rgba(255,255,255,0.3)":"none",strokeWidth:x}),jsx("text",{x:C+p/2,y:T+f/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:E,fontWeight:500,className:"pointer-events-none",children:sn(y.text,30)})]},`${t.id}-matrix-${y.id}-${v}`)})})}function Qee({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=3,c=(i-s*2-a*(e.length-1))/e.length,d=o-s*2,u=fn(r),p=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-pyramid",children:e.map((f,h)=>{let m=.3+h/Math.max(e.length-1,1)*.7,x=h<e.length-1?.3+(h+1)/Math.max(e.length-1,1)*.7:1,y=d*m,v=d*x,S=s+h*(c+a),w=(o-y)/2,C=w+y,T=(o-v)/2,E=T+v,M=[`${w},${S}`,`${C},${S}`,`${E},${S+c}`,`${T},${S+c}`].join(" "),A=Co(f.text,y*.85,c,12);return jsxs("g",{style:{filter:u},children:[jsx("polygon",{points:M,fill:Gt(h,n),opacity:bn(h,e.length,r),stroke:p>0?"rgba(255,255,255,0.3)":"none",strokeWidth:p}),jsx("text",{x:o/2,y:S+c/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:A,className:"pointer-events-none",children:sn(f.text,30)})]},`${t.id}-pyramid-${f.id}-${h}`)})})}function ete({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=fn(r);if(e.length<=4){let p=o/2,f=i/2,h=Math.min(o,i)*.28,m=h*.55;return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-venn",children:e.map((x,y)=>{let v=y/e.length*Math.PI*2-Math.PI/2,S=p+m*Math.cos(v),w=f+m*Math.sin(v),C=Co(x.text,h*1.2,h*2,11);return jsxs("g",{style:{filter:s},children:[jsx("circle",{cx:S,cy:w,r:h,fill:Gt(y,n),opacity:.35}),jsx("text",{x:S,y:w,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:C,fontWeight:"bold",className:"pointer-events-none",children:sn(x.text,20)})]},`${t.id}-venn-${x.id}-${y}`)})})}let a=Math.min(i*.38,o/(e.length*.9)),l=a*.5,c=e.length*(a*2-l)+l,d=(o-c)/2+a,u=i/2;return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-venn",children:e.map((p,f)=>{let h=d+f*(a*2-l),m=Co(p.text,a*1.2,a*2,10);return jsxs("g",{style:{filter:s},children:[jsx("circle",{cx:h,cy:u,r:a,fill:Gt(f,n),opacity:.35}),jsx("text",{x:h,y:u,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:m,fontWeight:"bold",className:"pointer-events-none",children:sn(p.text,20)})]},`${t.id}-venn-${p.id}-${f}`)})})}function tte({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=8,a=o-s*2,l=(i-s*2)/e.length,c=fn(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-funnel",children:e.map((d,u)=>{let p=a*(1-u/e.length),f=a*(1-(u+1)/e.length),h=s+u*l,m=(o-p)/2,x=m+p,y=(o-f)/2,v=y+f,S=[`${m},${h}`,`${x},${h}`,`${v},${h+l}`,`${y},${h+l}`].join(" "),w=Co(d.text,p*.85,l,11);return jsxs("g",{style:{filter:c},children:[jsx("polygon",{points:S,fill:Gt(u,n),opacity:bn(u,e.length,r)}),jsx("text",{x:o/2,y:h+l/2,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:w,className:"pointer-events-none",children:sn(d.text,30)})]},`${t.id}-funnel-${d.id}-${u}`)})})}function nte({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=o*.4,a=i/2,l=Math.min(s-8,a-8),c=Math.max(7,Math.min(10,l/(e.length+1))),d=s+l+8,u=fn(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-target",children:e.map((p,f)=>{let h=l*((e.length-f)/e.length);return jsxs("g",{style:{filter:u},children:[jsx("circle",{cx:s,cy:a,r:Math.max(h,4),fill:Gt(f,n),opacity:bn(f,e.length,r)}),jsx("line",{x1:s+Math.max(h,4),y1:a,x2:d-2,y2:8+f*(c+6),stroke:Gt(f,n),strokeWidth:1,opacity:.6}),jsx("text",{x:d,y:8+f*(c+6)+c/2,textAnchor:"start",dominantBaseline:"central",fill:Gt(f,n),fontSize:c,className:"pointer-events-none",children:sn(p.text,30)})]},`${t.id}-target-${p.id}-${f}`)})})}function BU({element:t,nodes:e,palette:n,style:r}){let o=N4(e);if(o.length===0)return jsx(tk,{element:t,nodes:e,palette:n,style:r});let i=o.reduce((w,C)=>w+gh(C),0),s=Math.max(...o.map(OR)),a=t.width,l=t.height,c=a/i,d=l/Math.max(s,1),u=Math.min(c*.8,140),p=Math.min(d*.4,36),f=Math.min(6,p*.15),h=fn(r),m=ar(r),x=[],y=0;function v(w,C,T){let E=gh(w),M=(C+E/2)*c,A=T*d+d/2,R=y++,k=Co(w.node.text,u*.9,p,11);for(let F of w.children){let B=gh(F),D=C;for(let j of w.children){if(j===F)break;D+=gh(j);}let O=(D+B/2)*c,U=(T+1)*d+d/2,H=A+p/2+(U-p/2-(A+p/2))/2;x.push(jsx("path",{d:`M${M},${A+p/2} L${M},${H} L${O},${H} L${O},${U-p/2}`,fill:"none",stroke:"#94a3b8",strokeWidth:1.5,opacity:.5},`${t.id}-hier-conn-${w.node.id}-${F.node.id}`));}x.push(jsxs("g",{style:{filter:h},children:[jsx("rect",{x:M-u/2,y:A-p/2,width:u,height:p,rx:f,fill:Gt(R,n),opacity:bn(R,e.length,r),stroke:m>0?"rgba(255,255,255,0.3)":"none",strokeWidth:m}),jsx("text",{x:M,y:A,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:k,className:"pointer-events-none",children:sn(w.node.text,40)})]},`${t.id}-hier-group-${w.node.id}`));let N=C;for(let F of w.children)v(F,N,T+1),N+=gh(F);return E}let S=0;for(let w of o)S+=v(w,S,0);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${a} ${l}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-hierarchy",children:x})}function UU({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=e.slice(0,3),a=e.slice(3),l=s.length,c=a.length>0?o*.7:o,d=c/(l+1),u=Math.min(d*.4,i*.35),p=u*.7,f=8,h=fn(r);return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-gear",children:[s.map((m,x)=>{let y=d*(x+1),v=i/2+(x%2===0?0:u*.35),S=Co(m.text,p*1.2,p*2,11);return jsxs("g",{style:{filter:h},children:[jsx("path",{d:Yee(y,v,u,p,f),fill:Gt(x,n),opacity:bn(x,e.length,r)}),jsx("circle",{cx:y,cy:v,r:p*.5,fill:"white",opacity:.25}),jsx("text",{x:y,y:v,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:S,fontWeight:"bold",className:"pointer-events-none",children:sn(m.text,20)})]},`${t.id}-gear-${m.id}-${x}`)}),a.map((m,x)=>{let y=c+10,v=14+x*18;return jsxs("g",{children:[jsx("circle",{cx:y,cy:v,r:3,fill:Gt(l+x,n),opacity:bn(l+x,e.length,r)}),jsx("text",{x:y+8,y:v,textAnchor:"start",dominantBaseline:"central",fill:Gt(l+x,n),fontSize:10,className:"pointer-events-none",children:sn(m.text,30)})]},`${t.id}-gear-extra-${m.id}-${x}`)})]})}function $U({element:t,nodes:e,palette:n,style:r}){let o=t.width,i=t.height,s=24,a=i/2,l=s,c=o-s,d=c-l,u=Math.max(4,Math.min(8,d/(e.length*4))),p=Math.min(i*.28,40),f=fn(r);return jsxs("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${o} ${i}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-timeline",children:[jsx("line",{x1:l,y1:a,x2:c,y2:a,stroke:"#94a3b8",strokeWidth:2}),jsx("polygon",{points:`${c-6},${a-4} ${c},${a} ${c-6},${a+4}`,fill:"#94a3b8"}),e.map((h,m)=>{let x=e.length===1?(l+c)/2:l+m/(e.length-1)*d,y=m%2===0,v=y?a-p:a+p,S=y?a-u-2:a+u+2,w=Co(h.text,d/e.length*.9,p,10);return jsxs("g",{style:{filter:f},children:[jsx("line",{x1:x,y1:S,x2:x,y2:v+(y?w:-w),stroke:Gt(m,n),strokeWidth:1,opacity:.5}),jsx("circle",{cx:x,cy:a,r:u,fill:Gt(m,n),opacity:bn(m,e.length,r)}),jsx("text",{x,y:v,textAnchor:"middle",dominantBaseline:y?"auto":"hanging",fill:Gt(m,n),fontSize:w,className:"pointer-events-none",children:sn(h.text,20)})]},`${t.id}-timeline-${h.id}-${m}`)})]})}function zU({element:t,nodes:e,palette:n,style:r}){let i=t.width,s=t.height,a=Math.ceil(e.length/4),l=8,c=8,d=(i-l*2)/4,u=(s-c*2)/Math.max(a,1),p=d*.8,f=Math.min(u*.6,32),h=Math.min(5,f*.15),m=6,x=fn(r),y=ar(r);return jsx("svg",{className:"w-full h-full pointer-events-none",viewBox:`0 0 ${i} ${s}`,preserveAspectRatio:"xMidYMid meet","data-testid":"smartart-bending",children:e.map((v,S)=>{let w=Math.floor(S/4),C=S%4,T=w%2===0?C:3-C,E=l+T*d+d/2,M=c+w*u+u/2,A=Co(v.text,p*.85,f,10),R=null;if(S<e.length-1){let k=Math.floor((S+1)/4),N=(S+1)%4,F=k%2===0?N:3-N,B=l+F*d+d/2,D=c+k*u+u/2;if(k===w){let O=B>E?1:-1,U=E+O*(p/2+2),H=B-O*(p/2+2);R=jsxs("g",{children:[jsx("line",{x1:U,y1:M,x2:H,y2:M,stroke:"#94a3b8",strokeWidth:1.5}),jsx("polygon",{points:`${H},${M-m/2} ${H+O*m},${M} ${H},${M+m/2}`,fill:"#94a3b8"})]},`${t.id}-snake-arrow-${S}`);}else {let O=M+f/2+2,U=D-f/2-2;R=jsxs("g",{children:[jsx("line",{x1:E,y1:O,x2:B,y2:U,stroke:"#94a3b8",strokeWidth:1.5}),jsx("polygon",{points:`${B-m/2},${U} ${B},${U+m} ${B+m/2},${U}`,fill:"#94a3b8"})]},`${t.id}-snake-arrow-${S}`);}}return jsxs("g",{style:{filter:x},children:[R,jsx("rect",{x:E-p/2,y:M-f/2,width:p,height:f,rx:h,fill:Gt(S,n),opacity:bn(S,e.length,r),stroke:y>0?"rgba(255,255,255,0.3)":"none",strokeWidth:y}),jsx("text",{x:E,y:M,textAnchor:"middle",dominantBaseline:"central",fill:"white",fontSize:A,className:"pointer-events-none",children:sn(v.text,20)})]},`${t.id}-snake-${v.id}-${S}`)})})}function TUe({element:t,className:e=""}){if(t.type!=="smartArt"||!t.smartArtData)return jsx("div",{className:`w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none ${e}`,children:"SmartArt"});let{nodes:n,drawingShapes:r,chrome:o}=t.smartArtData;if(n.length===0)return jsx("div",{className:`w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none ${e}`,children:"SmartArt"});let i=k4(t),s=I4(t);if(r&&r.length>0)return FU(o,jsx(qee,{elementId:t.id,shapes:r,style:s,palette:i}),e);let a=t.smartArtData.layout,l=a?D4(a):(t.smartArtData.resolvedLayoutType??t.smartArtData.layoutType??"list").toLowerCase(),c=MUe(l,t,n,i,s);return FU(o,c,e)}function MUe(t,e,n,r,o){return t.includes("hierarchy")||t.includes("org")?jsx(BU,{element:e,nodes:n,palette:r,style:o}):t.includes("process")||t.includes("chevron")||t.includes("arrow")?jsx(Kee,{element:e,nodes:n,palette:r,style:o}):t.includes("cycle")||t.includes("radial")?jsx(Zee,{element:e,nodes:n,palette:r,style:o}):t.includes("matrix")?jsx(Jee,{element:e,nodes:n,palette:r,style:o}):t.includes("pyramid")?jsx(Qee,{element:e,nodes:n,palette:r,style:o}):t.includes("venn")?jsx(ete,{element:e,nodes:n,palette:r,style:o}):t.includes("funnel")?jsx(tte,{element:e,nodes:n,palette:r,style:o}):t.includes("target")||t.includes("bullseye")?jsx(nte,{element:e,nodes:n,palette:r,style:o}):t.includes("gear")?jsx(UU,{element:e,nodes:n,palette:r,style:o}):t.includes("timeline")||t.includes("linear")?jsx($U,{element:e,nodes:n,palette:r,style:o}):t.includes("bending")||t.includes("snake")?jsx(zU,{element:e,nodes:n,palette:r,style:o}):t.includes("stepdown")?jsx(Fragment,{children:L4(e,n,r,o)}):t.includes("alternatingflow")||t.includes("alternating")?jsx(Fragment,{children:F4(e,n,r,o)}):t.includes("descending")?jsx(Fragment,{children:B4(e,n,r,o)}):t.includes("pictureaccent")?jsx(Fragment,{children:O4(e,n,r,o)}):t.includes("verticalblock")?jsx(Fragment,{children:U4(e,n,r,o)}):t.includes("grouped")?jsx(Fragment,{children:$4(e,n,r,o)}):t.includes("pyramidlist")?jsx(Fragment,{children:H4(e,n,r,o)}):t.includes("horizontalpicture")?jsx(Fragment,{children:z4(e,n,r,o)}):t.includes("accentprocess")?jsx(Fragment,{children:G4(e,n,r,o)}):t.includes("verticalchevron")?jsx(Fragment,{children:V4(e,n,r,o)}):jsx(tk,{element:e,nodes:n,palette:r,style:o})}function _Ue(t,e){if(t.className!==e.className||t.element.id!==e.element.id||t.element.type!==e.element.type||t.element.width!==e.element.width||t.element.height!==e.element.height||t.element.x!==e.element.x||t.element.y!==e.element.y)return false;let n=t.element.type==="smartArt"?t.element.smartArtData:void 0,r=e.element.type==="smartArt"?e.element.smartArtData:void 0;return n===r}var ote=Vn__default.memo(TUe,_Ue);function ite({element:t,slides:e,isPresentationMode:n,onZoomClick:r,sourceSlideIndex:o}){let i=e?.[t.targetSlideIndex],s=c=>{!n||!r||(c.stopPropagation(),r(t.targetSlideIndex,o??0));},a=c=>{!n||!r||(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),r(t.targetSlideIndex,o??0));},l=!!t.imageData;return jsxs("div",{className:"zoom-element-container",style:{width:"100%",height:"100%",position:"relative",cursor:n?"pointer":"default",overflow:"hidden",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",transition:"box-shadow 0.2s ease, transform 0.15s ease"},"data-zoom-type":t.zoomType,"data-zoom-target":t.targetSlideIndex,"data-testid":"zoom-element",onClick:s,onKeyDown:a,role:n?"button":void 0,tabIndex:n?0:-1,"aria-label":`Zoom to slide ${t.targetSlideIndex+1}${t.zoomType==="section"&&t.targetSectionId?` (section: ${t.targetSectionId})`:""}`,children:[l?ek(t,{width:"100%",height:"100%",objectFit:"contain"},void 0,`Preview of slide ${t.targetSlideIndex+1}`):jsx(EUe,{targetSlide:i,slideIndex:t.targetSlideIndex}),n&&jsx("div",{className:"zoom-hover-overlay",style:{position:"absolute",inset:0,background:"transparent",transition:"background 0.2s ease",pointerEvents:"none"}}),jsxs("div",{style:{position:"absolute",bottom:4,right:4,fontSize:"9px",padding:"1px 4px",borderRadius:"2px",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"#fff",pointerEvents:"none",lineHeight:"1.4"},children:[t.zoomType==="section"?"Section":"Slide"," Zoom"]})]})}function EUe({targetSlide:t,slideIndex:e}){let n=t?.backgroundColor||"#f0f0f0",r=t?`Slide ${t.slideNumber}`:`Slide ${e+1}`;return jsxs("div",{"data-testid":"zoom-thumbnail",style:{width:"100%",height:"100%",backgroundColor:n,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"1px solid rgba(0, 0, 0, 0.1)"},children:[jsx("div",{style:{fontSize:"14px",fontWeight:600,color:"rgba(0, 0, 0, 0.5)",marginBottom:"4px"},children:r}),t?.sectionName&&jsx("div",{style:{fontSize:"10px",color:"rgba(0, 0, 0, 0.4)"},children:t.sectionName})]})}function lte(t,e,n,r,o,i,s,a,l,c,d,u,p,f,h,m,x,y,v,S,w,C,T,E,M,A,R,k,N,F,B,D,O,U,H,j,Z){if(t.type==="model3d")return jsx(Wee,{element:t,width:t.width,height:t.height,interactive:!k});if(t.type==="zoom")return jsx(ite,{element:t,slides:D,isPresentationMode:k,onZoomClick:O,sourceSlideIndex:U});if(e)return ek(t,l,c,u,d);if(n)return jsxs(Fragment,{children:[a,jsx($ee,{initialText:r,spellCheck:o,rtl:i?.rtl,textDirection:i?.textDirection,textStyle:s,textStyleRaw:i,layoutStyle:Sc(t),element:t,onCommit:S,onCancel:w,onEditChange:v,onFormatText:Z})]});if(t.type==="table")return aY(t,s,{editable:m,selectedCell:m?h:null,onSelectCell:C,onCommitCellEdit:T,onResizeColumns:E,onResizeRow:M,styleCtx:j});if(t.type==="chart")return AQ(t);if(t.type==="smartArt")return jsx(ote,{element:t});if(t.type==="media")return Z4(t,f,{autoPlay:k,fullScreen:k&&!!t.fullScreen,isPresentationMode:k,onPlayStateChange:N});if(x&&Cj(t))return Mee(t,{replay:k});if(t.type==="contentPart")return Eee(t,{replay:k});if(t.type==="ole")return kee(t);if(y&&t.type==="group"&&t.children)return _ee(t.children);if(ty(t,p))return jsx("div",{className:"w-full h-full flex items-center justify-center text-[11px] text-white/80 pointer-events-none",children:cs(t)});let J=ot(t)&&t.linkedTxbxId!==void 0,W=J?{overflow:"hidden"}:{},te=J&&B?D5(t,B):void 0,se=ot(t)?t.textStyle?.textWarpPreset:void 0,Ce=$T(se),ee=ot(t)?fF(t.textStyle):void 0,de=[kf(t),ee?.transform].filter(Boolean).join(" ")||void 0,Ne=ee?{...ee.perspective?{perspective:ee.perspective}:{},...ee.transformStyle?{transformStyle:ee.transformStyle}:{}}:void 0,Ue="shapeType"in t?t.shapeType:void 0,he=mee(Ue);return jsxs(Fragment,{children:[a,he&&jsx(gee,{element:t}),p?Ce?jsx("div",{className:le("relative z-10 w-full h-full",R?"":"pointer-events-none"),style:{...Sc(t),transform:de,transformOrigin:"center",...Ne,...W},children:jsx(QR,{element:t,width:t.width,height:t.height,fallbackColor:bi,findHighlights:A,fieldContext:H})}):jsx("div",{className:le("relative z-10 w-full h-full whitespace-pre-wrap break-words leading-[1.3]",R?"":"pointer-events-none"),style:{...Sc(t),...s,...qx(i),transform:de,transformOrigin:"center",...Ne,...W},children:Al(t,bi,void 0,A,R,H,F,te??void 0,!k)}):ot(t)&&t.promptText?Ce?jsx("div",{className:le("relative z-10 w-full h-full",R?"":"pointer-events-none"),style:{...Sc(t),transform:de,transformOrigin:"center",...Ne,...W},children:jsx(QR,{element:t,width:t.width,height:t.height,fallbackColor:bi,findHighlights:A,fieldContext:H})}):jsx("div",{className:le("relative z-10 w-full h-full whitespace-pre-wrap break-words leading-[1.3]",R?"":"pointer-events-none"),style:{...Sc(t),...s,...qx(i),transform:de,transformOrigin:"center",...Ne,...W},children:Al(t,bi,void 0,A,R,H,F,te??void 0,!k)}):null]})}var dte=Vn__default.memo(function({data:e}){return !e.hasExtrusion||e.panels.length===0?null:jsxs("div",{className:"extrusion-3d-wrapper",style:e.wrapperStyle,"aria-hidden":"true",children:[e.panels.map(n=>jsx("div",{className:`extrusion-3d-panel extrusion-3d-panel--${n.side}`,style:n.style},n.side)),e.materialOverlay&&jsx("div",{className:"extrusion-3d-material-overlay",style:{position:"absolute",inset:0,backgroundImage:e.materialOverlay,pointerEvents:"none",borderRadius:"inherit",transform:e.frontFaceStyle.transform,transformStyle:"preserve-3d",backfaceVisibility:"hidden",mixBlendMode:"normal"}})]})});function ute({label:t,hasUrl:e}){return jsx("div",{className:"pointer-events-none absolute left-1 top-full z-[9999] mt-1 max-w-64 opacity-0 transition-opacity duration-150 group-hover/link:opacity-100",children:jsxs("div",{className:"rounded border border-border bg-popover px-2.5 py-1.5 shadow-lg",children:[jsx("div",{className:"truncate text-xs text-foreground",children:t}),jsx("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:e?"Ctrl+Click to follow link":"Active in presentation mode"})]})})}function kU(t){let e=mn(t)?t.shapeStyle:void 0,n=Math.max(0,e?.strokeWidth||0),r=ut(e?.strokeColor,Fu),o=ut(e?.fillColor,Pf);return {hf:e?.fillColor!==void 0&&e?.fillColor!=="transparent"||!!(Bu(e)||e?.fillGradient)||e?.fillMode==="pattern"&&!!e.fillPatternPreset,fc:o,sw:n,sc:r}}var rk=Vn__default.memo(function({element:e,activeSlide:n,isSelected:r,isInlineEditing:o,inlineEditingText:i,canInteract:s,spellCheckEnabled:a,mediaDataUrls:l,tableEditorState:c,selectionColorClass:d,showHoverBorder:u,opacity:p,zIndex:f,imageAltText:h,showResizeHandles:m,renderInk:x,renderGroups:y,adjustmentHandleDescriptor:v,onResizePointerDown:S,onAdjustmentPointerDown:w,onInlineEditChange:C,onInlineEditCommit:T,onInlineEditCancel:E,onTableCellSelect:M,onCommitCellEdit:A,onResizeTableColumns:R,onResizeTableRow:k,findHighlights:N,onActionClick:F,onHyperlinkClick:B,animationState:D,presentationElementStates:O,allSlides:U,onZoomClick:H,sourceSlideIndex:j,fieldContext:Z,tableStyleContext:J}){let W=M?Ke=>M(Ke,e.id):void 0,te=A?(Ke,Ct,ne)=>A(e.id,Ke,Ct,ne):void 0,se=R?Ke=>R(e.id,Ke):void 0,Ce=k?(Ke,Ct)=>k(e.id,Ke,Ct):void 0,{hf:ee,fc:ce,sw:de,sc:Ne}=kU(e),Ue=e.locks,he=Nf(e)&&!Ue?.noTextEdit,Be=ot(e)?e.textStyle:void 0,Me=Hu(e,ee,ce,de,Ne),ge=If(e,bi),Te=Vu(e,ee,ce,de,Ne),be=e.type==="picture"||e.type==="image",xe=e.type==="model3d",Pe=L7(e),Xe=mn(e)?e.shapeStyle:void 0,Y=useMemo(()=>j7(Xe?.shape3d,Xe?.scene3d,ce,e.width,e.height),[Xe?.shape3d,Xe?.scene3d,ce,e.width,e.height]),[Ge,Ve]=useState(false),We=useCallback(Ke=>{Ve(Ke);},[]);if(Pe)return jsx(lee,{el:e,isSelected:r,canInteract:s,showResizeHandles:m&&!Ue?.noResize,showHoverBorder:u,selectionColorClass:d,opacity:p,zIndex:f,adjustmentHandleDescriptor:v,onResizePointerDown:S,onAdjustmentPointerDown:w,animationState:D});let ke=s&&!Ue?.noSelect,wt=m&&!Ue?.noResize,V=o&&!Ue?.noTextEdit,$=!!(e.actionClick&&F),ie=!!e.actionHover,ve=!!B,De=e.type==="zoom"&&!!H,$e=$||ie||ve||De,ze=r?`border-${d} ring-2 ring-${d}/50`:u?"border-transparent hover:border-primary/40":"border-transparent",ae=V?"cursor-text":ke?Ue?.noMove?"cursor-default":"cursor-move":$||De?"cursor-pointer":"",Se=!ke,Ye=e.type==="media"&&!!e.fullScreen&&Se&&Ge,Q=eee(e),pe=tee(e),Re=nee(e),nt=ke||$e;return jsxs("div",{"data-pptx-element":"true","data-element-id":e.id,role:Q,"aria-label":pe,"aria-roledescription":Re,"aria-selected":r?true:void 0,tabIndex:nt?0:-1,className:le("absolute border","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500",ae,ke||$e?"":"pointer-events-none",Ye?"pointer-events-auto":"",ze,ke&&e.actionClick&&"group/link"),style:dee({el:e,isFullscreenMedia:Ye,isImg:be||xe,zIndex:f,opacity:p,animationState:D,shapeVisualStyle:Me,has3DExtrusion:Y.hasExtrusion}),onKeyDown:Ke=>{if(Ke.key==="Enter"&&he&&ke&&!V){Ke.preventDefault(),Ke.stopPropagation();let Ct=new MouseEvent("dblclick",{bubbles:true});Ke.currentTarget.dispatchEvent(Ct);}else Ke.key==="Escape"&&V&&(Ke.preventDefault(),Ke.stopPropagation(),E());},onClick:Ke=>{if(e.actionClick&&F&&(!ke||Ke.ctrlKey||Ke.metaKey)){if(Ke.stopPropagation(),Ke.preventDefault(),e.actionClick.highlightClick){let ne=Ke.currentTarget;ne.style.filter="brightness(1.18)",ne.style.outline="2px solid rgba(59, 130, 246, 0.6)",window.setTimeout(()=>{ne.style.filter="",ne.style.outline="";},320);}F(e.id,e.actionClick);}},onMouseEnter:Ke=>{if(ie&&e.actionHover?.highlightClick){let Ct=Ke.currentTarget;Ct.style.filter="brightness(1.15)",Ct.style.outline="2px solid rgba(59, 130, 246, 0.5)";}Se&&e.actionHover&&F&&(e.actionHover.url||e.actionHover.targetSlideIndex!==void 0)&&F(e.id,e.actionHover);},onMouseLeave:ie&&e.actionHover?.highlightClick?Ke=>{let Ct=Ke.currentTarget;Ct.style.filter="",Ct.style.outline="";}:void 0,title:ke&&e.actionClick?void 0:e.actionClick?.tooltip||e.actionHover?.tooltip||void 0,children:[cee(e),Y.hasExtrusion&&jsx(dte,{data:Y}),lte(e,be,V,i,a,Be,ge,Te,ju(e),A1(e),GF(e),h,he,l,c,r,x,y,C,T,E,W,te,se,Ce,N,B,Se,We,O,n?.elements,U,H,j,Z,J),(e.actionClick||e.actionHover)&&s&&jsx(uee,{clickTooltip:e.actionClick?.tooltip,hoverTooltip:e.actionHover?.tooltip}),ke&&e.actionClick&&jsx(ute,{label:e.actionClick.tooltip||e.actionClick.url||e.actionClick.action||"Link",hasUrl:!!e.actionClick.url}),wt&&!V&&jsx(ZR,{elementId:e.id,adjustmentHandleDescriptor:v,onResizePointerDown:S,onAdjustmentPointerDown:w})]})});var ZT="w-3.5 h-3.5",mte="inline-flex items-center justify-center rounded p-1 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",jU=`${mte} hover:bg-accent text-muted-foreground hover:text-foreground`,hte=`${mte} px-2 py-1 bg-muted hover:bg-accent text-foreground text-xs`;function XU({findQuery:t,replaceQuery:e,findMatchCase:n,findResults:r,findResultIndex:o,onSetFindQuery:i,onSetReplaceQuery:s,onSetFindMatchCase:a,onPerformFind:l,onNavigateResult:c,onReplace:d,onReplaceAll:u,onClose:p}){let{t:f}=useTranslation(),h=useRef(null);useEffect(()=>{h.current?.focus();},[]),useEffect(()=>{l();},[t,n]);let m=useCallback(S=>{S.key==="Escape"?p():S.key==="Enter"&&(S.shiftKey?c(-1):c(1));},[p,c]),x=useCallback(S=>{S.key==="Escape"?p():S.key==="Enter"&&d();},[p,d]),y=r.length>0,v=y?f("pptx.findReplace.matchCount",{current:o+1,total:r.length}):t.length>0?f("pptx.findReplace.noMatches"):"";return jsxs("div",{className:"absolute top-2 right-2 z-40 bg-popover border border-border rounded-lg shadow-lg p-3 text-xs text-foreground w-80 backdrop-blur",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"font-semibold text-sm inline-flex items-center gap-1.5",children:[jsx(LuSearch,{className:ZT}),f("pptx.findReplace.title")]}),jsx("button",{type:"button",className:jU,onClick:p,title:f("pptx.findReplace.closeEscape"),"aria-label":f("pptx.findReplace.closeAriaLabel"),children:jsx(LuX,{className:ZT})})]}),jsxs("div",{className:"flex items-center gap-1 mb-1.5",children:[jsxs("div",{className:"relative flex-1",children:[jsx("input",{ref:h,type:"text",value:t,onChange:S=>i(S.target.value),onKeyDown:m,placeholder:f("pptx.findReplace.findPlaceholder"),className:"w-full bg-muted border border-border rounded px-2 py-1 pr-7 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:outline-none","aria-label":f("pptx.findReplace.searchText")}),jsx("button",{type:"button",className:`absolute right-1 top-1/2 -translate-y-1/2 p-0.5 rounded transition-colors ${n?"bg-primary/80 text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"}`,onClick:()=>a(!n),title:f("pptx.findReplace.matchCase"),"aria-label":f("pptx.findReplace.toggleMatchCase"),"aria-pressed":n,children:jsx(LuCaseSensitive,{className:ZT})})]}),jsx("button",{type:"button",className:jU,onClick:()=>c(-1),disabled:!y,title:f("pptx.findReplace.previousMatch"),"aria-label":f("pptx.findReplace.previousMatch"),children:jsx(LuChevronUp,{className:ZT})}),jsx("button",{type:"button",className:jU,onClick:()=>c(1),disabled:!y,title:f("pptx.findReplace.nextMatch"),"aria-label":f("pptx.findReplace.nextMatch"),children:jsx(LuChevronDown,{className:ZT})})]}),v&&jsx("div",{className:"text-[11px] text-muted-foreground mb-2 pl-0.5 tabular-nums",children:v}),jsx("div",{className:"flex items-center gap-1 mb-2",children:jsxs("div",{className:"relative flex-1",children:[jsx(LuReplace,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground"}),jsx("input",{type:"text",value:e,onChange:S=>s(S.target.value),onKeyDown:x,placeholder:f("pptx.findReplace.replacePlaceholder"),className:"w-full bg-muted border border-border rounded pl-7 pr-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:outline-none","aria-label":f("pptx.findReplace.replacementText")})]})}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("button",{type:"button",className:hte,onClick:d,disabled:!y,title:f("pptx.findReplace.replaceCurrent"),children:f("pptx.findReplace.replace")}),jsx("button",{type:"button",className:hte,onClick:u,disabled:!y,title:f("pptx.findReplace.replaceAllMatches"),children:f("pptx.findReplace.replaceAll")})]})]})}var xte=5;function WUe(t,e,n,r,o=xte){let i=Math.max(e,1),s=t*i;if(t===0)return {startIndex:0,endIndex:-1,totalHeight:0,offsetY:0,visibleRange:{start:0,end:-1}};let a=Math.floor(n/i),l=Math.min(t-1,Math.floor((n+r)/i)),c=Math.max(0,a-o),d=Math.min(t-1,l+o),u=c*i;return {startIndex:c,endIndex:d,totalHeight:s,offsetY:u,visibleRange:{start:a,end:l}}}function yte({totalItems:t,itemHeight:e,overscan:n=xte}){let r=useRef(null),[o,i]=useState(0),[s,a]=useState(0);useEffect(()=>{let u=r.current;if(!u)return;let p=()=>{i(u.scrollTop);};a(u.clientHeight),i(u.scrollTop),u.addEventListener("scroll",p,{passive:true});let f;return typeof ResizeObserver<"u"&&(f=new ResizeObserver(h=>{for(let m of h)a(m.contentRect.height);}),f.observe(u)),()=>{u.removeEventListener("scroll",p),f?.disconnect();}},[]);let l=WUe(t,e,o,s,n),c=Math.max(e,1),d=useCallback((u,p="smooth")=>{let f=r.current;if(!f)return;let h=u*c,m=h+c,x=f.scrollTop,y=x+f.clientHeight;h<x?f.scrollTo({top:h,behavior:p}):m>y&&f.scrollTo({top:m-f.clientHeight,behavior:p});},[c]);return {...l,scrollContainerRef:r,scrollToIndex:d}}var YUe=/^[a-zA-Z0-9_-]{1,128}$/;function YU(t){if(!YUe.test(t))throw new Error(`Invalid collaboration room ID: "${t}". Must be 1-128 alphanumeric characters, hyphens, or underscores.`);return t}function bte(t){return typeof t!="string"?"Anonymous":t.replace(/<[^>]*>/g,"").trim().slice(0,64)||"Anonymous"}function WU(t,e,n){if(typeof t!="number"||!Number.isFinite(t))return 0;let r=20;return Math.max(e-r,Math.min(n+r,t))}var qUe=/^#[0-9a-fA-F]{6}$/;function ok(t,e="#6366f1"){return typeof t!="string"?e:qUe.test(t)?t:e}function vte(t){if(typeof t=="string")try{let e=new URL(t);if(e.protocol==="https:"||e.protocol==="http:"||e.protocol==="data:")return t}catch{}}function Ste(t){return typeof t!="number"||!Number.isFinite(t)?0:Math.max(0,Math.floor(t))}function qU(t,e,n){return typeof t.clientId!="number"?null:{clientId:t.clientId,userName:bte(t.userName),userAvatar:vte(t.userAvatar),userColor:ok(t.userColor),activeSlideIndex:Ste(t.activeSlideIndex),cursorX:WU(t.cursorX,0,e),cursorY:WU(t.cursorY,0,n),lastUpdated:typeof t.lastUpdated=="string"?t.lastUpdated:new Date().toISOString(),selectedElementId:typeof t.selectedElementId=="string"?t.selectedElementId.slice(0,128):void 0,role:t.role==="broadcaster"||t.role==="viewer"||t.role==="collaborator"?t.role:void 0}}var wte=50,JUe=3e4;function ZU({awareness:t,localClientId:e,userName:n,userColor:r,userAvatar:o,role:i,canvasWidth:s,canvasHeight:a}){let[l,c]=useState([]),d=useRef(0),u=useRef(null),p=useRef({}),f=useCallback(h=>{if(!t)return;Object.assign(p.current,h);let x=Date.now()-d.current,y=()=>{let v={...p.current,userName:n,userColor:r,userAvatar:o,role:i,lastUpdated:new Date().toISOString()};t.setLocalStateField("presence",v),d.current=Date.now();};x>=wte?(u.current&&(clearTimeout(u.current),u.current=null),y()):u.current||(u.current=setTimeout(()=>{u.current=null,y();},wte-x));},[t,n,r,o,i]);return useEffect(()=>{t&&t.setLocalStateField("presence",{userName:n,userColor:r,userAvatar:o,role:i,activeSlideIndex:0,cursorX:0,cursorY:0,lastUpdated:new Date().toISOString()});},[t,n,r,o,i]),useEffect(()=>{if(!t||e===null)return;let h=()=>{let m=Date.now(),x=t.getStates(),y=[];x.forEach((v,S)=>{if(S===e)return;let C=v?.presence;if(!C||typeof C!="object")return;let T=qU({...C,clientId:S},s,a);if(!T)return;let E=new Date(T.lastUpdated).getTime();Number.isNaN(E)||m-E>JUe||y.push(T);}),c(y);};return t.on("change",h),t.on("update",h),h(),()=>{t.off("change",h),t.off("update",h);}},[t,e,s,a]),useEffect(()=>{if(!t)return;let h=setInterval(()=>{t.setLocalStateField("presence",{...p.current,userName:n,userColor:r,userAvatar:o,role:i,lastUpdated:new Date().toISOString()});},1e4);return ()=>clearInterval(h)},[t,n,r,o,i]),useEffect(()=>()=>{u.current&&clearTimeout(u.current);},[]),{remoteUsers:l,broadcastPresence:f}}var nHe=3e4;function w6({config:t}){let[e,n]=useState("disconnected"),[r,o]=useState(null),[i,s]=useState(null),[a,l]=useState(null),c=useRef(null),d=useRef(null),u=useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),c.current?.(),c.current=null;},[]),p=useCallback(async()=>{u();let h=YU(t.roomId);n("connecting");try{let[m,{WebsocketProvider:x}]=await Promise.all([Promise.resolve().then(()=>(p6(),u6)),Promise.resolve().then(()=>(ioe(),ooe))]),y=new m.Doc,v=new x(t.serverUrl,h,y,{params:t.authToken?{token:t.authToken}:void 0}),S=!1,w=C=>{C.status==="connected"?(S=!0,d.current&&(clearTimeout(d.current),d.current=null),n("connected")):C.status==="disconnected"&&n("disconnected");};v.on("status",w),v.wsconnected&&(S=!0,n("connected")),S||(d.current=setTimeout(()=>{d.current=null,S||(v.off("status",w),v.destroy(),y.destroy(),s(null),o(null),l(null),c.current=null,n("error"));},nHe)),s(y),o(v.awareness),l(v.awareness.clientID),c.current=()=>{v.off("status",w),v.destroy(),y.destroy(),s(null),o(null),l(null),n("disconnected");};}catch(m){console.warn("[pptx-viewer] Collaboration packages not available:",m instanceof Error?m.message:m),n("error");}},[t.roomId,t.serverUrl,t.authToken,u]);useEffect(()=>(p(),u),[p,u]);let f=useCallback(()=>{p();},[p]);return {status:e,awareness:r,doc:i,clientId:a,retry:f}}function C6({config:t,canvasWidth:e,canvasHeight:n}){let r=ok(t.userColor,"#6366f1"),{status:o,awareness:i,doc:s,clientId:a,retry:l}=w6({config:t}),{remoteUsers:c,broadcastPresence:d}=ZU({awareness:i,localClientId:a,userName:t.userName,userColor:r,userAvatar:t.userAvatar,role:t.role,canvasWidth:e,canvasHeight:n}),u=o==="connected"?c.length+1:c.length;return {status:o,remoteUsers:c,broadcastPresence:d,connectedCount:u,config:t,doc:s,retry:l}}var aoe=createContext(null);function qi(){return useContext(aoe)}function T6({config:t,canvasWidth:e,canvasHeight:n,children:r}){let o=C6({config:t,canvasWidth:e,canvasHeight:n});return jsx(aoe.Provider,{value:o,children:r})}function M6({remoteUsers:t,activeSlideIndex:e,canvasWidth:n,canvasHeight:r}){let o=t.filter(i=>i.activeSlideIndex===e);return o.length===0?null:jsx("svg",{"data-testid":"remote-user-cursors","data-export-ignore":"true",className:"absolute inset-0 pointer-events-none",style:{zIndex:9999},width:n,height:r,viewBox:`0 0 ${n} ${r}`,"aria-hidden":"true",children:o.map(i=>jsxs("g",{transform:`translate(${i.cursorX}, ${i.cursorY})`,"data-testid":`remote-cursor-${i.clientId}`,children:[jsx("path",{d:"M0 0 L0 16 L4.5 12.5 L8 20 L10.5 19 L7 11.5 L12 11 Z",fill:i.userColor,stroke:"#fff",strokeWidth:1,opacity:.9}),jsxs("g",{transform:"translate(14, 18)",children:[jsx("rect",{rx:3,ry:3,x:-2,y:-10,width:Math.min(i.userName.length*7+8,150),height:16,fill:i.userColor,opacity:.85}),jsx("text",{fill:"#fff",fontSize:10,fontFamily:"system-ui, sans-serif",fontWeight:500,dominantBaseline:"central",y:-2,x:2,children:i.userName.length>20?`${i.userName.slice(0,18)}...`:i.userName})]})]},i.clientId))})}var aHe={connected:{dot:"bg-green-400",text:"text-green-400",label:"Connected"},connecting:{dot:"bg-yellow-400 animate-pulse",text:"text-yellow-400",label:"Connecting..."},disconnected:{dot:"bg-gray-500",text:"text-gray-500",label:"Disconnected"},error:{dot:"bg-red-400",text:"text-red-400",label:"Connection error"}};function E6({status:t,connectedCount:e,onRetry:n}){let{t:r}=useTranslation(),o=aHe[t];return jsxs("div",{"data-testid":"collaboration-status",className:"flex items-center gap-1.5","aria-label":r("pptx.collaboration.statusAriaLabel",{status:r(`pptx.collaboration.status.${t}`),count:e}),children:[jsx("span",{className:`inline-block w-2 h-2 rounded-full ${o.dot}`,"aria-hidden":"true"}),jsx("span",{className:`text-[10px] ${o.text}`,children:t==="connected"?r("pptx.collaboration.userCount",{count:e}):r(`pptx.collaboration.status.${t}`)}),t==="error"&&n&&jsx("button",{type:"button",onClick:n,className:"text-[10px] text-blue-400 hover:text-blue-300 underline underline-offset-2 transition-colors","aria-label":r("pptx.collaboration.retry"),children:r("pptx.collaboration.retry")})]})}function A6({activeSlideIndex:t,canvasWidth:e,canvasHeight:n,selectedElementId:r}){let o=qi(),i=useRef(null),s=useRef(r);return useEffect(()=>{!o||r===s.current||(s.current=r,o.broadcastPresence({selectedElementId:r??void 0,activeSlideIndex:t}));},[o,r,t]),useEffect(()=>{if(!o)return;let a=i.current?.parentElement;if(!a)return;let l=c=>{let d=a.getBoundingClientRect(),u=(c.clientX-d.left)/d.width*e,p=(c.clientY-d.top)/d.height*n;o.broadcastPresence({cursorX:u,cursorY:p,activeSlideIndex:t});};return a.addEventListener("pointermove",l),()=>a.removeEventListener("pointermove",l)},[o,e,n,t]),o?jsx("div",{ref:i,"data-testid":"collab-pointer-tracker","data-export-ignore":"true",style:{display:"contents"},children:jsx(M6,{remoteUsers:o.remoteUsers,activeSlideIndex:t,canvasWidth:e,canvasHeight:n})}):null}function R6({elements:t,activeSlideIndex:e}){let n=qi();if(!n)return null;let r=new Map;for(let i of t)r.set(i.id,i);let o=[];for(let i of n.remoteUsers)if(i.activeSlideIndex===e&&i.selectedElementId){let s=r.get(i.selectedElementId);s&&o.push({userName:i.userName,userColor:i.userColor,element:s});}return o.length===0?null:jsx(Fragment,{children:o.map(i=>jsx("div",{"data-testid":`remote-selection-${i.element.id}`,"data-export-ignore":"true",className:"absolute pointer-events-none",style:{left:i.element.x,top:i.element.y,width:i.element.width,height:i.element.height,zIndex:9997,border:`2px solid ${i.userColor}`,borderRadius:2},children:jsx("span",{className:"absolute -top-5 left-0 px-1 py-0.5 text-[9px] font-medium text-white rounded-sm whitespace-nowrap leading-none",style:{backgroundColor:i.userColor},children:i.userName})},`remote-sel-${i.element.id}`))})}function poe({state:t,sectionGroups:e,totalSlides:n,onStartRename:r,onDeleteSection:o,onMoveSectionUp:i,onMoveSectionDown:s,onAddSection:a,onClose:l}){let{t:c}=useTranslation(),d=()=>{let u=e.find(h=>h.id===t.sectionId);if(!u)return;let p=u.slideIndexes[u.slideIndexes.length-1]??0,f=Math.min(p+1,n-1);a?.(c("pptx.sections.defaultName"),f),l();};return jsxs("div",{className:"fixed z-50 min-w-[160px] rounded-md border border-border bg-popover py-1 shadow-xl",style:{left:t.x,top:t.y},onClick:u=>u.stopPropagation(),children:[jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:()=>{let u=e.find(p=>p.id===t.sectionId);u&&r(t.sectionId,u.label);},children:c("pptx.sections.rename")}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:()=>{o?.(t.sectionId),l();},children:c("pptx.sections.delete")}),jsx("div",{className:"my-1 border-t border-border"}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed",disabled:t.sectionIndex===0,onClick:()=>{i?.(t.sectionId),l();},children:c("pptx.sections.moveUp")}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:cursor-not-allowed",disabled:t.sectionIndex>=t.totalSections-1,onClick:()=>{s?.(t.sectionId),l();},children:c("pptx.sections.moveDown")}),jsx("div",{className:"my-1 border-t border-border"}),jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:d,children:c("pptx.sections.addAfter")})]})}function k6({sectionId:t,label:e,slideCount:n,isCollapsed:r,isRenaming:o,renameValue:i,canEdit:s,sectionIndex:a,totalSections:l,renameInputRef:c,onToggle:d,onContextMenu:u,onStartRename:p,onRenameValueChange:f,onCommitRename:h,onCancelRename:m}){return jsxs("button",{type:"button",className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-[11px] uppercase tracking-wide text-muted-foreground hover:bg-muted/60 hover:text-foreground",onClick:()=>d(t),onContextMenu:x=>s?u(x,t,a,l):void 0,onDoubleClick:x=>{s&&(x.stopPropagation(),p(t,e));},children:[jsx(LuChevronDown,{className:le("h-3 w-3 flex-shrink-0 transition-transform",r?"-rotate-90":"rotate-0")}),o?jsx("input",{ref:c,type:"text",className:"flex-1 bg-muted text-[11px] text-foreground rounded px-1 py-0.5 outline-none border border-primary",value:i,onChange:x=>f(x.target.value),onKeyDown:x=>{x.key==="Enter"?(x.preventDefault(),h()):x.key==="Escape"&&(x.preventDefault(),m()),x.stopPropagation();},onClick:x=>x.stopPropagation(),onBlur:h}):jsxs(Fragment,{children:[jsx("span",{className:"truncate text-left",children:e}),jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:n})]})]})}function moe({state:t,onAddSection:e,onClose:n}){let{t:r}=useTranslation();return jsx("div",{className:"fixed z-50 min-w-[180px] rounded-md border border-border bg-popover py-1 shadow-xl",style:{left:t.x,top:t.y},onClick:o=>o.stopPropagation(),children:jsx("button",{type:"button",className:"flex w-full items-center px-3 py-1.5 text-xs text-foreground hover:bg-muted",onClick:()=>{e?.(r("pptx.sections.defaultName"),t.slideIndex),n();},children:r("pptx.sections.addBefore")})})}function bHe({slide:t,canvasSize:e,previewHeight:n}){let r=useRef(null),[o,i]=useState(false);return useEffect(()=>{let s=r.current;if(!s)return;if(typeof IntersectionObserver>"u"){i(true);return}let a=new IntersectionObserver(([l])=>{l?.isIntersecting&&(i(true),a.disconnect());},{rootMargin:"200px 0px"});return a.observe(s),()=>{a.disconnect();}},[]),jsx("div",{ref:r,children:o?jsx(Qa,{slide:t,templateElements:[],canvasSize:e}):jsx("div",{className:"relative w-full overflow-hidden rounded border border-border bg-muted/30 animate-pulse",style:{height:n,minWidth:156}})})}var goe=Vn__default.memo(bHe);function xoe(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function yoe(t,e,n){let r=[];for(let o=0;o<t.length;o++){let i=t[o];if(e&&r.push({type:"section",sectionIndex:o,sectionId:i.id}),!(n[i.id]??false))for(let a of i.slideIndexes)r.push({type:"slide",slideIndex:a});}return r}function boe(t,e){let n=Math.max(t,1),r=Math.max(e,1),o=156/n;return Math.max(56,Math.round(r*o))+30}function THe({slide:t,slideIndex:e,isActive:n,canvasSize:r,canEdit:o,rehearsalTimings:i,presenceUsers:s,onSelectSlide:a,onSlideContextMenu:l,onAddSection:c,onOpenSlideCtxMenu:d,onDragStart:u,onDragOver:p,onDrop:f,slideRef:h}){let m=!!t.hidden,x=useCallback(C=>{o&&c?(C.preventDefault(),C.stopPropagation(),d(C.clientX,C.clientY,e)):l(C,e);},[o,c,d,l,e]),y=Math.max(r.width,1),v=Math.max(r.height,1),S=156/y,w=Math.max(56,Math.round(v*S));return jsxs("div",{ref:h,className:le("group relative flex items-center gap-1 cursor-pointer py-0.5 px-1 transition-all",n&&"bg-accent/40 before:absolute before:left-0 before:top-1 before:bottom-1 before:w-[3px] before:bg-primary before:rounded-r",m&&"opacity-50"),draggable:o,onClick:()=>a(e),onContextMenu:x,onDragStart:C=>u(C,e),onDragOver:p,onDrop:C=>f(C,e),children:[jsxs("div",{className:"flex flex-col items-center gap-0.5 w-5 shrink-0",children:[jsx("span",{className:le("text-[10px] tabular-nums text-right select-none w-full",n?"text-primary font-medium":"text-muted-foreground"),children:e+1}),s&&s.length>0&&jsx("div",{className:"flex flex-wrap justify-center gap-px",children:s.slice(0,4).map((C,T)=>jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{backgroundColor:C.userColor},title:C.userName},T))})]}),jsxs("div",{className:le("relative flex-1 overflow-hidden border transition-colors bg-white",n?"border-primary/60":"border-transparent group-hover:border-border/40"),children:[m&&jsx("div",{className:"absolute inset-0 pointer-events-none z-10 bg-[repeating-linear-gradient(135deg,transparent,transparent_4px,rgba(255,255,255,0.04)_4px,rgba(255,255,255,0.04)_8px)]"}),jsx(goe,{slide:t,canvasSize:r,previewHeight:w}),(t.comments?.length??0)>0&&jsxs("div",{className:"absolute top-0.5 right-0.5 flex items-center gap-0.5 rounded bg-amber-500/90 px-1 py-0.5 text-[8px] font-medium text-white leading-none z-10",children:[jsx(LuMessageSquare,{className:"w-2 h-2"}),t.comments?.length]}),m&&jsx("div",{className:"absolute bottom-0.5 right-0.5 z-10",children:jsx(LuEyeOff,{className:"w-3 h-3 text-muted-foreground"})}),i&&typeof i[e]=="number"&&jsx("div",{className:"absolute bottom-0.5 left-0.5 z-10",children:jsx("span",{className:"text-[8px] font-mono text-amber-400/80 tabular-nums bg-black/50 px-0.5 rounded",children:xoe(i[e])})})]})]})}var N6=Vn__default.memo(THe);function voe(t,e){let[n,r]=useState({}),[o,i]=useState(null),[s,a]=useState(""),[l,c]=useState(null),[d,u]=useState(null);useEffect(()=>{if(!l&&!d)return;let E=()=>{c(null),u(null);};return document.addEventListener("click",E),()=>document.removeEventListener("click",E)},[l,d]);let p=useCallback((E,M)=>{E.dataTransfer.setData("text/plain",String(M)),E.dataTransfer.effectAllowed="move";},[]),f=useCallback(E=>{E.preventDefault(),E.dataTransfer.dropEffect="move";},[]),h=useCallback((E,M)=>{E.preventDefault();let A=E.dataTransfer.getData("text/plain"),R=parseInt(A,10);!isNaN(R)&&R!==M&&t(R,M);},[t]),m=useCallback(E=>{r(M=>({...M,[E]:!M[E]}));},[]),x=useCallback((E,M)=>{i(E),a(M),c(null);},[]),y=useCallback(()=>{o&&s.trim().length>0&&e?.(o,s.trim()),i(null),a("");},[o,s,e]),v=useCallback(()=>{i(null),a("");},[]),S=useCallback((E,M,A,R)=>{E.preventDefault(),E.stopPropagation(),c({x:E.clientX,y:E.clientY,sectionId:M,sectionIndex:A,totalSections:R});},[]),w=useCallback((E,M,A)=>{u({x:E,y:M,slideIndex:A});},[]),C=useCallback(()=>{c(null);},[]),T=useCallback(()=>{u(null);},[]);return {collapsedSections:n,renamingSectionId:o,renameValue:s,sectionContextMenu:l,slideCtxMenu:d,setRenameValue:a,handleDragStart:p,handleDragOver:f,handleDrop:h,toggleSection:m,startRename:x,commitRename:y,cancelRename:v,handleSectionContextMenu:S,handleOpenSlideCtxMenu:w,closeSectionContextMenu:C,closeSlideCtxMenu:T}}var PHe=50;function F2({slides:t,activeSlideIndex:e,canvasSize:n,sectionGroups:r,isOpen:o,canEdit:i,onSelectSlide:s,onSlideContextMenu:a,onMoveSlide:l,onAddSlide:c,onCollapse:d,onAddSection:u,onRenameSection:p,onDeleteSection:f,onMoveSectionUp:h,onMoveSectionDown:m,rehearsalTimings:x,panelWidth:y}){let{t:v}=useTranslation(),S=qi(),w=useRef(new Map),C=useRef(null),T=useMemo(()=>{if(!S||S.remoteUsers.length===0)return;let xe=new Map;for(let Pe of S.remoteUsers){let Xe=Pe.activeSlideIndex,Y=xe.get(Xe),Ge={userName:Pe.userName,userColor:Pe.userColor};Y?Y.push(Ge):xe.set(Xe,[Ge]);}return xe},[S]),E=useMemo(()=>boe(n.width,n.height),[n.width,n.height]),M=r.length>1,{collapsedSections:A,renamingSectionId:R,renameValue:k,sectionContextMenu:N,slideCtxMenu:F,setRenameValue:B,handleDragStart:D,handleDragOver:O,handleDrop:U,toggleSection:H,startRename:j,commitRename:Z,cancelRename:J,handleSectionContextMenu:W,handleOpenSlideCtxMenu:te,closeSectionContextMenu:se,closeSlideCtxMenu:Ce}=voe(l,p),ee=useMemo(()=>yoe(r,M,A),[r,M,A]),ce=t.length>=PHe,{startIndex:de,endIndex:Ne,totalHeight:Ue,offsetY:he,scrollContainerRef:Be,scrollToIndex:Me}=yte({totalItems:ce?ee.length:0,itemHeight:E});useEffect(()=>{if(ce){let xe=ee.findIndex(Pe=>Pe.type==="slide"&&Pe.slideIndex===e);xe>=0&&Me(xe);}else {let xe=w.current.get(e);xe&&xe.scrollIntoView({behavior:"smooth",block:"nearest"});}},[e,ce,Me,ee]),useEffect(()=>{R&&C.current&&(C.current.focus(),C.current.select());},[R]);let ge=useCallback(xe=>Pe=>{Pe?w.current.set(xe,Pe):w.current.delete(xe);},[]);return o?jsxs("aside",{role:"navigation","aria-label":"Slides",className:"flex h-full flex-col border-r border-border bg-secondary/30",style:y?{width:y,flexShrink:0}:void 0,children:[ce?(()=>{let xe=ee.slice(de,Ne+1);return jsx("div",{ref:Be,className:"flex-1 overflow-y-auto px-1.5 pb-2",children:jsx("div",{style:{height:Ue,position:"relative"},children:jsx("div",{style:{position:"absolute",top:he,left:0,right:0},children:jsx("div",{className:"space-y-1",children:xe.map(Pe=>{if(Pe.type==="section"){let Y=r[Pe.sectionIndex];if(!Y)return null;let Ge=A[Y.id]??false;return jsx(k6,{sectionId:Y.id,label:Y.label,slideCount:Y.slideIndexes.length,isCollapsed:Ge,isRenaming:R===Y.id,renameValue:k,canEdit:i,sectionIndex:Pe.sectionIndex,totalSections:r.length,renameInputRef:C,onToggle:H,onContextMenu:W,onStartRename:j,onRenameValueChange:B,onCommitRename:Z,onCancelRename:J},`section-${Y.id}`)}let Xe=t[Pe.slideIndex];return Xe?jsx(N6,{slide:Xe,slideIndex:Pe.slideIndex,isActive:Pe.slideIndex===e,canvasSize:n,canEdit:i,rehearsalTimings:x,presenceUsers:T?.get(Pe.slideIndex),onSelectSlide:s,onSlideContextMenu:a,onAddSection:u,onOpenSlideCtxMenu:te,onDragStart:D,onDragOver:O,onDrop:U,slideRef:ge(Pe.slideIndex)},Xe.id??Pe.slideIndex):null})})})})})})():jsx("div",{className:"flex-1 space-y-1 overflow-y-auto px-1.5 pb-2",children:r.map((xe,Pe)=>{let Xe=A[xe.id]??false;return jsxs("div",{className:"space-y-1",children:[M&&jsx(k6,{sectionId:xe.id,label:xe.label,slideCount:xe.slideIndexes.length,isCollapsed:Xe,isRenaming:R===xe.id,renameValue:k,canEdit:i,sectionIndex:Pe,totalSections:r.length,renameInputRef:C,onToggle:H,onContextMenu:W,onStartRename:j,onRenameValueChange:B,onCommitRename:Z,onCancelRename:J}),!Xe&&xe.slideIndexes.map(Y=>{let Ge=t[Y];return Ge?jsx(N6,{slide:Ge,slideIndex:Y,isActive:Y===e,canvasSize:n,canEdit:i,rehearsalTimings:x,presenceUsers:T?.get(Y),onSelectSlide:s,onSlideContextMenu:a,onAddSection:u,onOpenSlideCtxMenu:te,onDragStart:D,onDragOver:O,onDrop:U,slideRef:ge(Y)},Ge.id??Y):null})]},xe.id)})}),i&&jsx("div",{className:"border-t border-border/60 px-2 py-1.5",children:jsxs("button",{type:"button",className:"flex w-full items-center justify-center gap-1 rounded-sm px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent hover:text-foreground transition-colors disabled:cursor-not-allowed disabled:opacity-40",disabled:!i,onClick:c,children:[jsx(LuPlus,{className:"h-3 w-3"}),v("pptx.sections.addSlide")]})}),N&&jsx(poe,{state:N,sectionGroups:r,totalSlides:t.length,onStartRename:j,onDeleteSection:f,onMoveSectionUp:h,onMoveSectionDown:m,onAddSection:u,onClose:se}),F&&jsx(moe,{state:F,onAddSection:u,onClose:Ce})]}):null}var kHe=[1,2,3,4,6,9];function Coe({handoutMaster:t,slidesPerPage:e,onSlidesPerPageChange:n}){let{t:r}=useTranslation();return t?jsxs("div",{className:"space-y-2 px-1",children:[jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1.5",children:r("pptx.master.handoutSlidesPerPage")}),jsx("div",{className:"grid grid-cols-3 gap-1",children:kHe.map(o=>jsx("button",{type:"button",className:le("px-2 py-1.5 rounded text-[11px] font-medium transition-colors",e===o?"bg-primary text-white":"bg-accent/50 text-muted-foreground hover:bg-accent/70 hover:text-foreground"),onClick:()=>n(o),children:o},o))})]}),jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:r("pptx.master.handoutBackground")}),jsx("div",{className:"w-full h-8 rounded border border-border",style:{backgroundColor:t.backgroundColor??"#ffffff"}})]}),t.placeholders&&t.placeholders.length>0&&jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1.5",children:r("pptx.master.handoutPlaceholders")}),jsx("div",{className:"space-y-1",children:t.placeholders.map(o=>jsxs("div",{className:"flex items-center gap-2 rounded px-1.5 py-1 bg-background/50 text-[10px] text-foreground",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-purple-500/60 flex-shrink-0"}),o.type]},`${o.type}-${o.idx??"default"}`))})]})]}):jsx("div",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:r("pptx.master.noHandoutMaster")})}function Toe({notesMaster:t}){let{t:e}=useTranslation(),n=useMemo(()=>t?.placeholders?t.placeholders.map(r=>{let o=r.type==="body"?e("pptx.master.notesMasterBody"):r.type==="sldImg"?e("pptx.master.notesMasterSlideImage"):r.type==="hdr"?e("pptx.master.notesMasterHeader"):r.type==="ftr"?e("pptx.master.notesMasterFooter"):r.type==="dt"?e("pptx.master.notesMasterDate"):r.type==="sldNum"?e("pptx.master.notesMasterPageNumber"):r.type;return {type:r.type,label:o,idx:r.idx}}):[],[t?.placeholders,e]);return t?jsxs("div",{className:"space-y-2 px-1",children:[jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:e("pptx.master.notesMasterBackground")}),jsx("div",{className:"w-full h-8 rounded border border-border",style:{backgroundColor:t.backgroundColor??"#ffffff"}})]}),jsxs("div",{className:"rounded-md border border-border/60 bg-muted/40 p-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1.5",children:e("pptx.master.notesMasterPlaceholders")}),n.length>0?jsx("div",{className:"space-y-1",children:n.map(r=>jsxs("div",{className:"flex items-center gap-2 rounded px-1.5 py-1 bg-background/50 text-[10px] text-foreground",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-green-500/60 flex-shrink-0"}),r.label]},`${r.type}-${r.idx??"default"}`))}):jsx("div",{className:"text-[10px] text-muted-foreground",children:e("pptx.master.noPlaceholders")})]})]}):jsx("div",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:e("pptx.master.noNotesMaster")})}function BHe(t){return {id:t.path,rId:"",slideNumber:0,elements:t.elements??[],backgroundColor:t.backgroundColor,backgroundImage:t.backgroundImage}}function OHe(t){return {id:t.path,rId:"",slideNumber:0,elements:t.elements??[],backgroundColor:t.backgroundColor,backgroundImage:t.backgroundImage}}function Moe({slideMasters:t,activeMasterIndex:e,activeLayoutIndex:n,canvasSize:r,onSelectMaster:o,onSelectLayout:i}){let s=useRef(null);useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"nearest"});},[e,n]);let{t:a}=useTranslation();return jsxs(Fragment,{children:[t.map((l,c)=>{let d=c===e&&n===null,u=l.layouts??[];return jsxs("div",{className:"space-y-1",children:[jsxs("div",{ref:d?s:void 0,className:le("group relative cursor-pointer rounded-lg border-2 p-1 transition-all",d?"border-amber-500 bg-amber-500/10":"border-border bg-background/40 hover:border-border"),onClick:()=>o(c),children:[jsx("div",{className:"relative overflow-hidden rounded bg-white",children:jsx(Qa,{slide:BHe(l),templateElements:[],canvasSize:r})}),jsx("div",{className:"mt-1 px-1",children:jsx("span",{className:le("text-[10px] font-medium",d?"text-amber-400":"text-muted-foreground"),children:l.name||a("pptx.master.master")})})]}),u.length>0&&jsx("div",{className:"ml-3 space-y-1 border-l border-border/40 pl-2",children:u.map((p,f)=>{let h=c===e&&f===n;return jsxs("div",{ref:h?s:void 0,className:le("group relative cursor-pointer rounded-md border-2 p-0.5 transition-all",h?"border-primary bg-primary/10":"border-border bg-background/40 hover:border-border"),onClick:()=>i(c,f),children:[jsx("div",{className:"relative overflow-hidden rounded bg-white",children:jsx(Qa,{slide:OHe(p),templateElements:l.elements??[],canvasSize:r})}),jsx("div",{className:"mt-0.5 px-0.5",children:jsx("span",{className:le("text-[9px]",h?"text-primary":"text-muted-foreground"),children:p.name||a("pptx.master.layout")})})]},p.path)})})]},l.path)}),t.length===0&&jsx("div",{className:"px-2 py-4 text-center text-xs text-muted-foreground",children:a("pptx.master.noMasters")})]})}var GHe=[{key:"slides",labelKey:"pptx.master.tabSlides"},{key:"notes",labelKey:"pptx.master.tabNotes"},{key:"handout",labelKey:"pptx.master.tabHandout"}];function B6({slideMasters:t,activeMasterIndex:e,activeLayoutIndex:n,canvasSize:r,masterViewTab:o,notesMaster:i,handoutMaster:s,handoutSlidesPerPage:a,onSelectMaster:l,onSelectLayout:c,onCollapse:d,onTabChange:u,onHandoutSlidesPerPageChange:p}){let f=useRef(null),{t:h}=useTranslation(),m=useCallback(y=>{l(y);},[l]),x=useCallback((y,v)=>{c(y,v);},[c]);return jsxs("aside",{className:"flex h-full flex-col border-r border-border/80 bg-background/70 backdrop-blur-sm w-56",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:h(o==="slides"?"pptx.master.title":o==="notes"?"pptx.master.notesMasterTitle":"pptx.master.handoutMasterTitle")}),jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",title:h("pptx.master.collapseMasterPane"),onClick:d,children:jsx(LuPanelLeftClose,{className:"h-3.5 w-3.5"})})]}),jsx("div",{className:"flex border-b border-border/60 px-1",children:GHe.map(y=>jsx("button",{type:"button",className:le("flex-1 px-1 py-1.5 text-[10px] font-medium transition-colors border-b-2",o===y.key?"border-amber-500 text-amber-400":"border-transparent text-muted-foreground hover:text-foreground"),onClick:()=>u(y.key),children:h(y.labelKey)},y.key))}),jsxs("div",{ref:f,className:"flex-1 space-y-2 overflow-y-auto px-1.5 pb-2 pt-1",children:[o==="slides"&&jsx(Moe,{slideMasters:t,activeMasterIndex:e,activeLayoutIndex:n,canvasSize:r,onSelectMaster:m,onSelectLayout:x}),o==="notes"&&jsx(Toe,{notesMaster:i}),o==="handout"&&jsx(Coe,{handoutMaster:s,slidesPerPage:a,onSlidesPerPageChange:p})]})]})}var jHe=720,XHe=960,WHe={sldImg:"pptx.master.notesMasterSlideImage",body:"pptx.master.notesMasterBody",hdr:"pptx.master.notesMasterHeader",ftr:"pptx.master.notesMasterFooter",dt:"pptx.master.notesMasterDate",sldNum:"pptx.master.notesMasterPageNumber"},YHe={sldImg:{x:.1,y:.05,w:.8,h:.4},body:{x:.1,y:.5,w:.8,h:.4},hdr:{x:0,y:0,w:.4,h:.04},ftr:{x:0,y:.96,w:.4,h:.04},dt:{x:.6,y:0,w:.4,h:.04},sldNum:{x:.6,y:.96,w:.4,h:.04}};function O6({notesMaster:t,canvasSize:e,notesCanvasSize:n,slideThumbnail:r,notesText:o,slideNumber:i}){let{t:s}=useTranslation(),a=n?.width??jHe,l=n?.height??XHe,c=useMemo(()=>{let f=e.width/a,h=e.height/l;return Math.min(f,h,1)*.85},[e.width,e.height,a,l]),d=a*c,u=l*c,p=useMemo(()=>t?.placeholders?t.placeholders:[{type:"sldImg",idx:void 0},{type:"body",idx:void 0},{type:"hdr",idx:void 0},{type:"ftr",idx:void 0},{type:"dt",idx:void 0},{type:"sldNum",idx:void 0}],[t?.placeholders]);return t?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxs("div",{className:"relative bg-white shadow-lg border border-border rounded",style:{width:d,height:u},children:[t.backgroundColor&&jsx("div",{className:"absolute inset-0 rounded",style:{backgroundColor:t.backgroundColor}}),p.map(f=>{let h=YHe[f.type];if(!h)return null;let m=WHe[f.type]??f.type,x=f.type==="sldImg",y=f.type==="body",v=f.type==="sldNum";return x&&r?jsx("div",{className:"absolute overflow-hidden border border-solid border-gray-300",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u},children:jsx("img",{src:r,alt:i?`Slide ${i}`:"Slide",className:"w-full h-full object-contain"})},`${f.type}-${f.idx??"default"}`):y&&o!==void 0?jsx("div",{className:"absolute overflow-auto border border-solid border-gray-200 p-2",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u,fontSize:Math.max(8,Math.min(11,d*.015)),lineHeight:1.4,color:"#374151",whiteSpace:"pre-wrap"},children:o||s("pptx.notes.noNotes")},`${f.type}-${f.idx??"default"}`):v&&i!==void 0?jsx("div",{className:"absolute flex items-center justify-center",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u,fontSize:Math.max(8,Math.min(12,d*.018)),color:"rgba(156, 163, 175, 0.6)"},children:i},`${f.type}-${f.idx??"default"}`):jsx("div",{className:"absolute flex items-center justify-center border border-dashed",style:{left:h.x*d,top:h.y*u,width:h.w*d,height:h.h*u,borderColor:x?"rgba(59, 130, 246, 0.5)":y?"rgba(34, 197, 94, 0.5)":"rgba(156, 163, 175, 0.4)",backgroundColor:x?"rgba(59, 130, 246, 0.05)":y?"rgba(34, 197, 94, 0.05)":"transparent"},children:jsx("span",{className:"text-center px-1",style:{fontSize:Math.max(8,Math.min(12,d*.018)),color:x?"rgba(59, 130, 246, 0.7)":y?"rgba(34, 197, 94, 0.7)":"rgba(156, 163, 175, 0.6)"},children:s(m)})},`${f.type}-${f.idx??"default"}`)})]})}):jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:s("pptx.master.noNotesMaster")})}var Poe=720,Roe=960,koe=.06;function ZHe(t,e){let n=koe,r=koe,o=1-2*n,i=1-2*r,s=.02;switch(t){case 1:{let a=o*.8,l=a/e;return [{x:n+(o-a)/2,y:r+(i-l)/2,w:a,h:l}]}case 2:{let a=o*.75,l=a/e,c=l*2+s,d=r+(i-c)/2;return [0,1].map(u=>({x:n+(o-a)/2,y:d+u*(l+s),w:a,h:l}))}case 3:{let a=o*.5,l=a/e,c=l*3+s*2,d=r+(i-c)/2;return [0,1,2].map(u=>({x:n,y:d+u*(l+s),w:a,h:l}))}case 4:{let c=(o-s)/2,d=c/e,u=d*2+s*1,p=r+(i-u)/2;return Array.from({length:4},(f,h)=>({x:n+h%2*(c+s),y:p+Math.floor(h/2)*(d+s),w:c,h:d}))}case 6:{let c=(o-s)/2,d=c/e,u=d*3+s*2,p=r+(i-u)/2;return Array.from({length:6},(f,h)=>({x:n+h%2*(c+s),y:p+Math.floor(h/2)*(d+s),w:c,h:d}))}case 9:{let c=(o-s*2)/3,d=c/e,u=d*3+s*2,p=r+(i-u)/2;return Array.from({length:9},(f,h)=>({x:n+h%3*(c+s),y:p+Math.floor(h/3)*(d+s),w:c,h:d}))}default:return []}}function U6({handoutMaster:t,canvasSize:e,slidesPerPage:n,slideThumbnails:r,pageNumber:o}){let{t:i}=useTranslation(),s=4/3,a=useMemo(()=>{let u=e.width/Poe,p=e.height/Roe;return Math.min(u,p,1)*.85},[e.width,e.height]),l=Poe*a,c=Roe*a,d=useMemo(()=>ZHe(n,s),[n,s]);return t?jsx("div",{className:"flex items-center justify-center h-full w-full",children:jsxs("div",{className:"relative bg-white shadow-lg border border-gray-300 rounded",style:{width:l,height:c},children:[t.backgroundColor&&jsx("div",{className:"absolute inset-0 rounded",style:{backgroundColor:t.backgroundColor}}),d.map((u,p)=>{let f=r?.[p];return jsx("div",{className:`absolute flex items-center justify-center overflow-hidden ${f?"border border-solid border-gray-300":"border border-dashed border-blue-400/50 bg-blue-50/30"}`,style:{left:u.x*l,top:u.y*c,width:u.w*l,height:u.h*c},children:f?jsx("img",{src:f,alt:`Slide ${(o?(o-1)*n:0)+p+1}`,className:"w-full h-full object-contain"}):jsx("span",{className:"text-blue-400/60 font-medium",style:{fontSize:Math.max(8,Math.min(14,u.w*l*.08))},children:i("pptx.master.handoutSlideSlot",{number:p+1})})},p)}),jsx("div",{className:"absolute left-0 top-0 px-1 text-gray-400/50 border-b border-r border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:i("pptx.master.notesMasterHeader")}),jsx("div",{className:"absolute right-0 top-0 px-1 text-gray-400/50 border-b border-l border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:i("pptx.master.notesMasterDate")}),jsx("div",{className:"absolute left-0 bottom-0 px-1 text-gray-400/50 border-t border-r border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:i("pptx.master.notesMasterFooter")}),jsx("div",{className:"absolute right-0 bottom-0 px-1 text-gray-400/50 border-t border-l border-dashed border-gray-300/40",style:{fontSize:Math.max(6,8*a)},children:o!==void 0?String(o):i("pptx.master.notesMasterPageNumber")})]})}):jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:i("pptx.master.noHandoutMaster")})}function Noe({section:t,slides:e,gridCols:n,zoomScale:r,renderSlideCard:o}){let[i,s]=useState(t.defaultCollapsed??false);return jsxs("div",{className:"mb-4",children:[jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 rounded px-2 py-1.5 text-[11px] uppercase tracking-wide text-muted-foreground hover:bg-muted/60 hover:text-foreground mb-2",onClick:()=>s(a=>!a),children:[t.color&&jsx("span",{className:"inline-block h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:t.color}}),jsx(LuChevronDown,{className:le("h-3 w-3 transition-transform",i?"-rotate-90":"rotate-0")}),jsx("span",{className:"truncate text-left",children:t.label}),jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:t.slideIndexes.length})]}),!i&&jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`},children:t.slideIndexes.map(a=>{let l=e[a];return l?o(l,a):null})})]})}function rze({slide:t,index:e,isActive:n,isDragTarget:r,isSelected:o,selectedCount:i,selectionOrder:s,canvasSize:a,canEdit:l,onSlideClick:c,onDoubleClick:d,onContextMenu:u,onDragStart:p,onDragOver:f,onDragLeave:h,onDrop:m}){return jsxs("div",{className:le("group relative cursor-pointer rounded-lg border-2 p-1 transition-all",r?"border-primary bg-primary/20":o?"border-primary bg-primary/10 ring-1 ring-primary/50":n?"border-primary/50 bg-primary/5":"border-border bg-background/50 hover:border-border",t.hidden&&"opacity-40"),onClick:x=>c(x,e),onDoubleClick:()=>d(e),onContextMenu:x=>u(x,e),draggable:l,onDragStart:x=>p(x,e),onDragOver:x=>f(x,e),onDragLeave:h,onDrop:x=>m(x,e),children:[jsx("div",{className:"aspect-video overflow-hidden rounded bg-white",children:jsx(Qa,{slide:t,templateElements:[],canvasSize:a})}),jsxs("div",{className:"mt-1 flex items-center justify-between px-0.5",children:[jsx("span",{className:le("text-[11px] font-medium",o?"text-primary":n?"text-primary/70":"text-muted-foreground"),children:e+1}),t.hidden&&jsx(LuEyeOff,{className:"h-3 w-3 text-muted-foreground"})]}),o&&i>1&&jsx("div",{className:"absolute top-2 right-2 flex h-5 w-5 items-center justify-center rounded-full bg-primary text-white text-[10px] font-bold",children:s})]})}function oze(t,e){return !(t.slide.id!==e.slide.id||t.slide.isDirty!==e.slide.isDirty||t.slide.hidden!==e.slide.hidden||t.slide.elements!==e.slide.elements||t.index!==e.index||t.isActive!==e.isActive||t.isDragTarget!==e.isDragTarget||t.isSelected!==e.isSelected||t.selectedCount!==e.selectedCount||t.selectionOrder!==e.selectionOrder||t.canEdit!==e.canEdit||t.canvasSize.width!==e.canvasSize.width||t.canvasSize.height!==e.canvasSize.height||t.onSlideClick!==e.onSlideClick||t.onDoubleClick!==e.onDoubleClick||t.onContextMenu!==e.onContextMenu||t.onDragStart!==e.onDragStart||t.onDragOver!==e.onDragOver||t.onDragLeave!==e.onDragLeave||t.onDrop!==e.onDrop)}var Loe=Vn__default.memo(rze,oze);function Foe({x:t,y:e,selectedCount:n,hasClipboard:r,hasHiddenInSelection:o,hasVisibleInSelection:i,sectionGroups:s,onDelete:a,onDuplicate:l,onCopy:c,onPaste:d,onToggleHide:u,onClose:p}){let{t:f}=useTranslation(),h=Math.max(8,Math.min(t,window.innerWidth-220)),m=Math.max(8,Math.min(e,window.innerHeight-300)),x=n>1?` (${n})`:"";return jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[119]",onClick:p,onContextMenu:y=>{y.preventDefault(),p();}}),jsxs("div",{className:"fixed z-[120] min-w-[200px] rounded border border-border bg-popover shadow-2xl py-1.5 text-xs text-foreground",style:{left:h,top:m},children:[jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:c,children:[jsx(LuCopy,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.copy"),x]}),r&&jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:d,children:[jsx(LuClipboardPaste,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.paste")]}),jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:l,children:[jsx(LuCopyPlus,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.duplicate"),x]}),jsx("div",{className:"my-1 border-t border-border"}),i&&jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:u,children:[jsx(LuEyeOff,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.hideSlides"),x]}),o&&jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left hover:bg-muted",onClick:u,children:[jsx(LuEye,{className:"h-3.5 w-3.5 text-muted-foreground"}),f("pptx.slideSorter.contextMenu.showSlides"),x]}),jsx("div",{className:"my-1 border-t border-border"}),jsxs("button",{type:"button",className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-red-300 hover:bg-red-900/40",onClick:a,children:[jsx(LuTrash2,{className:"h-3.5 w-3.5"}),f("pptx.slideSorter.contextMenu.delete"),x]})]})]})}function Boe(t){let{slides:e,activeSlideIndex:n,canEdit:r,selectedSlideIds:o,selectedIndexes:i,contextMenu:s,setContextMenu:a,setSelectedSlideIds:l,setZoom:c,onClose:d,handleDeleteSelected:u,handleCopySelected:p,handlePaste:f,handleDuplicateSelected:h,handleSelectAll:m}=t;useEffect(()=>{let x=y=>{s&&a(null);let v=y.ctrlKey||y.metaKey;if(y.key==="Escape"){if(y.stopPropagation(),o.length>1){let S=e[n];l(S?.id?[S.id]:[]);}else d();return}if((y.key==="Delete"||y.key==="Backspace")&&r){y.preventDefault(),i.length>0&&u();return}if(v&&y.key==="c"){y.preventDefault(),p();return}if(v&&y.key==="v"&&r){y.preventDefault(),f();return}if(v&&y.key==="d"&&r){y.preventDefault(),h();return}if(v&&y.key==="a"){y.preventDefault(),m();return}if(v&&(y.key==="="||y.key==="+")){y.preventDefault(),c(S=>Math.min(200,S+10));return}v&&y.key==="-"&&(y.preventDefault(),c(S=>Math.max(50,S-10)));};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[d,r,o,i,n,e,s,a,l,c,u,p,f,h,m]);}function Ooe(t){let{slides:e,activeSlideIndex:n,canEdit:r,sectionGroups:o,onSelectSlide:i,onMoveSlide:s,onDeleteSlides:a,onDuplicateSlides:l,onToggleHideSlides:c,onClose:d}=t,[u,p]=useState(null),[f,h]=useState(()=>{let he=e[n];return he?.id?[he.id]:[]}),[m,x]=useState(n),[y,v]=useState(null),[S,w]=useState(100),[C,T]=useState([]),E=useRef(null),M=useMemo(()=>{let he=new Map;return e.forEach((Be,Me)=>he.set(Be.id,Me)),he},[e]),A=useMemo(()=>f.map(he=>M.get(he)).filter(he=>he!==void 0).sort((he,Be)=>he-Be),[f,M]),R=useCallback(he=>f.includes(he),[f]),k=useCallback((he,Be)=>{let Me=e[Be];if(Me)if(he.ctrlKey||he.metaKey)h(ge=>ge.includes(Me.id)?ge.filter(Te=>Te!==Me.id):[...ge,Me.id]),x(Be);else if(he.shiftKey){let ge=Math.min(m,Be),Te=Math.max(m,Be),be=[];for(let xe=ge;xe<=Te;xe++)e[xe]?.id&&be.push(e[xe].id);h(be);}else h([Me.id]),x(Be);},[e,m]),N=useCallback((he,Be)=>{he.preventDefault(),he.stopPropagation();let Me=e[Be];Me&&(f.includes(Me.id)||(h([Me.id]),x(Be)),v({x:he.clientX,y:he.clientY,slideIndex:Be}));},[e,f]),F=useCallback(()=>{v(null);},[]),B=useCallback(()=>{A.length!==0&&(a(A),h([]),F());},[A,a,F]),D=useCallback(()=>{A.length!==0&&(l(A),F());},[A,l,F]),O=useCallback(()=>{T([...f]),F();},[f,F]),U=useCallback(()=>{if(C.length===0)return;let he=C.map(Be=>M.get(Be)).filter(Be=>Be!==void 0).sort((Be,Me)=>Be-Me);he.length>0&&l(he),F();},[C,M,l,F]),H=useCallback(()=>{A.length!==0&&(c(A),F());},[A,c,F]),j=useCallback(()=>{h(e.map(he=>he.id));},[e]);Boe({slides:e,activeSlideIndex:n,canEdit:r,selectedSlideIds:f,selectedIndexes:A,contextMenu:y,setContextMenu:v,setSelectedSlideIds:h,setZoom:w,onClose:d,handleDeleteSelected:B,handleCopySelected:O,handlePaste:U,handleDuplicateSelected:D,handleSelectAll:j});let Z=useCallback(he=>{he.target===E.current&&d();},[d]),J=useCallback((he,Be)=>{he.dataTransfer.setData("text/plain",String(Be)),he.dataTransfer.effectAllowed="move";},[]),W=useCallback((he,Be)=>{he.preventDefault(),he.dataTransfer.dropEffect="move",p(Be);},[]),te=useCallback(()=>p(null),[]),se=useCallback((he,Be)=>{he.preventDefault(),p(null);let Me=parseInt(he.dataTransfer.getData("text/plain"),10);!isNaN(Me)&&Me!==Be&&s(Me,Be);},[s]),Ce=useCallback(he=>i(he),[i]),ee=S/100,ce=useMemo(()=>ee>=1.8?2:ee>=1.4?3:ee>=1?4:ee>=.7?5:6,[ee]),de=o.length>1,Ne=useMemo(()=>A.some(he=>e[he]?.hidden),[A,e]),Ue=useMemo(()=>A.some(he=>!e[he]?.hidden),[A,e]);return {dragOverIndex:u,selectedSlideIds:f,contextMenu:y,zoom:S,setZoom:w,clipboardSlideIds:C,backdropRef:E,selectedIndexes:A,isSelected:R,handleSlideClick:k,handleContextMenu:N,closeContextMenu:F,handleDeleteSelected:B,handleDuplicateSelected:D,handleCopySelected:O,handlePaste:U,handleToggleHideSelected:H,handleBackdropClick:Z,handleDragStart:J,handleDragOver:W,handleDragLeave:te,handleDrop:se,handleDoubleClick:Ce,zoomScale:ee,gridCols:ce,showSectionHeaders:de,hasHiddenInSelection:Ne,hasVisibleInSelection:Ue}}function $6({slides:t,activeSlideIndex:e,canvasSize:n,canEdit:r,sectionGroups:o,onSelectSlide:i,onMoveSlide:s,onDeleteSlides:a,onDuplicateSlides:l,onToggleHideSlides:c,onClose:d}){let{t:u}=useTranslation(),p=Ooe({slides:t,activeSlideIndex:e,canEdit:r,sectionGroups:o,onSelectSlide:i,onMoveSlide:s,onDeleteSlides:a,onDuplicateSlides:l,onToggleHideSlides:c,onClose:d}),f=(h,m)=>jsx(Loe,{slide:h,index:m,isActive:m===e,isDragTarget:p.dragOverIndex===m,isSelected:p.isSelected(h.id),selectedCount:p.selectedSlideIds.length,selectionOrder:p.selectedIndexes.indexOf(m)+1,canvasSize:n,canEdit:r,onSlideClick:p.handleSlideClick,onDoubleClick:p.handleDoubleClick,onContextMenu:p.handleContextMenu,onDragStart:p.handleDragStart,onDragOver:p.handleDragOver,onDragLeave:p.handleDragLeave,onDrop:p.handleDrop},h.id||m);return jsxs("div",{ref:p.backdropRef,style:{zIndex:1200},className:"fixed inset-0 flex flex-col bg-black/70 backdrop-blur-sm",onClick:p.handleBackdropClick,children:[jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border/50",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("h2",{className:"text-sm font-medium text-foreground",children:u("pptx.slideSorter.title")}),p.selectedSlideIds.length>1&&jsx("span",{className:"text-xs text-muted-foreground",children:u("pptx.slideSorter.selectedCount",{count:p.selectedSlideIds.length})})]}),jsx("button",{type:"button",onClick:d,className:"flex h-8 w-8 items-center justify-center rounded-full bg-muted text-foreground hover:bg-accent hover:text-white transition-colors","aria-label":u("pptx.slideSorter.close"),children:jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsx("div",{className:"flex-1 overflow-y-auto px-6 py-6",children:jsx("div",{className:"mx-auto",style:{maxWidth:`${Math.max(600,p.gridCols*220*p.zoomScale)}px`},children:p.showSectionHeaders?o.map(h=>jsx(Noe,{section:h,slides:t,gridCols:p.gridCols,zoomScale:p.zoomScale,renderSlideCard:f},h.id)):jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${p.gridCols}, minmax(0, 1fr))`},children:t.map((h,m)=>f(h,m))})})}),jsxs("div",{className:"flex items-center justify-between px-6 py-2.5 border-t border-border/50 bg-background/50",children:[jsx("div",{className:"text-xs text-muted-foreground",children:u("pptx.slideSorter.slideCount",{count:t.length})}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",disabled:p.zoom<=50,onClick:()=>p.setZoom(h=>Math.max(50,h-10)),"aria-label":u("pptx.slideSorter.zoomOut"),children:jsx(LuMinus,{className:"h-3.5 w-3.5"})}),jsx("input",{type:"range",min:50,max:200,step:10,value:p.zoom,onChange:h=>p.setZoom(Number(h.target.value)),className:"h-1 w-24 cursor-pointer appearance-none rounded-full bg-accent accent-primary","aria-label":u("pptx.slideSorter.zoom")}),jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",disabled:p.zoom>=200,onClick:()=>p.setZoom(h=>Math.min(200,h+10)),"aria-label":u("pptx.slideSorter.zoomIn"),children:jsx(LuPlus,{className:"h-3.5 w-3.5"})}),jsxs("span",{className:"min-w-[3ch] text-right text-xs text-muted-foreground",children:[p.zoom,"%"]})]})]}),p.contextMenu&&r&&jsx(Foe,{x:p.contextMenu.x,y:p.contextMenu.y,selectedCount:p.selectedSlideIds.length,hasClipboard:p.clipboardSlideIds.length>0,hasHiddenInSelection:p.hasHiddenInSelection,hasVisibleInSelection:p.hasVisibleInSelection,sectionGroups:p.showSectionHeaders?o:[],onDelete:p.handleDeleteSelected,onDuplicate:p.handleDuplicateSelected,onCopy:p.handleCopySelected,onPaste:p.handlePaste,onToggleHide:p.handleToggleHideSelected,onClose:p.closeContextMenu})]})}function Dh(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function kv(t){let e=t.split(`
|
|
4662
4662
|
`),n=[];return e.forEach((r,o)=>{n.push({text:r,style:{}}),o<e.length-1&&n.push({text:"",style:{},isParagraphBreak:true});}),n.length===0&&n.push({text:"",style:{}}),n}function G2(t){return t.map(e=>e.isParagraphBreak?`
|
|
4663
4663
|
`:e.text).join("")}function Iv(t){let e=t.filter(n=>n.isParagraphBreak||n.text.length>0);for(;e.length>0&&e[e.length-1].isParagraphBreak;)e.pop();return e.length>0?e:[{text:"",style:{}}]}function $oe(t){if(!t)return;let e=Number.parseFloat(t);if(!(Number.isNaN(e)||!Number.isFinite(e)))return t.endsWith("px")?e*.75:e}function Uoe(t){let e=t[0],n="none",r=0;return e?.bulletInfo&&(e.bulletInfo.char?n="bullet":e.bulletInfo.autoNumType&&(n="numbered")),e?.style.paragraphMarginLeft&&(r=Math.min(4,Math.max(0,Math.round(e.style.paragraphMarginLeft/24)))),{segments:t.length>0?t:[{text:"",style:{}}],bulletType:n,indentLevel:r}}function M0(t){let e=Iv(t),n=[],r=[];for(let o of e)o.isParagraphBreak?(n.push(Uoe(r)),r=[]):r.push(o);return r.length>0&&n.push(Uoe(r)),n.length===0&&n.push({segments:[{text:"",style:{}}],bulletType:"none",indentLevel:0}),n}function Hoe(t){let e=[],n=0;return t.forEach((r,o)=>{r.bulletType==="numbered"?n++:n=0,r.segments.forEach((i,s)=>{let a={...i,style:{...i.style}};r.indentLevel>0?a.style.paragraphMarginLeft=r.indentLevel*24:delete a.style.paragraphMarginLeft,s===0&&(r.bulletType==="bullet"?a.bulletInfo={char:"\u2022"}:r.bulletType==="numbered"?a.bulletInfo={autoNumType:"arabicPeriod",paragraphIndex:n-1}:delete a.bulletInfo),e.push(a);}),o<t.length-1&&e.push({text:"",style:{},isParagraphBreak:true});}),e}function zoe(t,e){let n=window.getSelection();if(!n||n.rangeCount===0)return 0;let r=n.getRangeAt(0),o=0,i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),s=i.nextNode();for(;s;){if(r.startContainer===s){o+=r.startOffset;break}o+=(s.textContent??"").length,s=i.nextNode();}let a=0,l=0;for(let c of e){if(c.isParagraphBreak){a++,l++;continue}let d=c.text.length;if(l+d>o)return a;l+=d;}return a}var bze=/^[a-zA-Z0-9 _,.\-+#'%/]{1,100}$/;function Goe(t){if(t==null)return false;let e=String(t);return e.length>0&&bze.test(e)}function vze(t,e){let n={...e},r=t.tagName.toLowerCase();if((r==="b"||r==="strong")&&(n.bold=true),(r==="i"||r==="em")&&(n.italic=true),r==="u"&&(n.underline=true),(r==="s"||r==="strike")&&(n.strikethrough=true),r==="a"){let s=t.getAttribute("href");s&&(n.hyperlink=s),n.underline=true,n.color="#4a9eff";}let o=t.style;(o.fontWeight==="bold"||Number(o.fontWeight)>=600)&&(n.bold=true),o.fontStyle==="italic"&&(n.italic=true),(o.textDecoration.includes("underline")||o.textDecorationLine.includes("underline"))&&(n.underline=true),(o.textDecoration.includes("line-through")||o.textDecorationLine.includes("line-through"))&&(n.strikethrough=true),o.color&&(n.color=o.color);let i=$oe(o.fontSize);return i!==void 0&&(n.fontSize=i),o.fontFamily&&(n.fontFamily=o.fontFamily),n}function Voe(t){let e=[],n=(r,o)=>{if(r.nodeType===Node.TEXT_NODE){let u=r.textContent??"";u.length>0&&e.push({text:u,style:{...o}});return}if(!(r instanceof HTMLElement))return;if(r.tagName.toLowerCase()==="br"){e.push({text:"",style:{},isParagraphBreak:true});return}let i=vze(r,o),s=r.tagName.toLowerCase(),a=["div","p","li"].includes(s),l,c=0;if(a&&r.dataset.bulletType){let u=r.dataset.bulletType;u==="bullet"?l={char:"\u2022"}:u==="numbered"&&(l={autoNumType:"arabicPeriod"});}a&&r.dataset.indentLevel&&(c=Number.parseInt(r.dataset.indentLevel,10)||0);let d=e.length;if(r.childNodes.forEach(u=>n(u,i)),a&&(l||c>0)){for(let u=d;u<e.length;u++)if(!e[u].isParagraphBreak){l&&(e[u].bulletInfo=l),c>0&&(e[u].style={...e[u].style,paragraphMarginLeft:c*24});break}}a&&e.push({text:"",style:{},isParagraphBreak:true});};return t.childNodes.forEach(r=>n(r,{})),Iv(e)}function joe(t){let e=M0(t),n=0;return e.map(r=>{r.bulletType==="numbered"?n++:n=0;let o=r.segments.map(u=>{if(u.isParagraphBreak)return "";let p=[];u.style.bold&&p.push("font-weight:700"),u.style.italic&&p.push("font-style:italic"),u.style.underline&&p.push("text-decoration:underline"),u.style.strikethrough&&p.push("text-decoration:line-through"),u.style.color&&Goe(u.style.color)&&p.push(`color:${u.style.color}`),u.style.fontSize&&Number.isFinite(Number(u.style.fontSize))&&p.push(`font-size:${Number(u.style.fontSize)}pt`),u.style.fontFamily&&Goe(u.style.fontFamily)&&p.push(`font-family:${u.style.fontFamily}`);let f=Dh(u.text);if(u.style.hyperlink&&Wb(u.style.hyperlink)){let m=Dh(u.style.hyperlink);return `<a href="${m}" style="color:#4a9eff;text-decoration:underline;cursor:pointer" data-hyperlink="${m}">${f}</a>`}return `<span${p.length>0?` style="${p.join(";")}"`:""}>${f}</span>`}).join(""),i=[];r.bulletType!=="none"&&i.push(`data-bullet-type="${r.bulletType}"`),r.indentLevel>0&&i.push(`data-indent-level="${r.indentLevel}"`);let s=r.indentLevel*24,a=[];s>0&&a.push(`padding-left:${s}px`);let l="";r.bulletType==="bullet"?l='<span style="margin-right:6px;color:#9ca3af" contenteditable="false">\u2022</span>':r.bulletType==="numbered"&&(l=`<span style="margin-right:6px;color:#9ca3af" contenteditable="false">${n}.</span>`);let c=a.length>0?` style="${a.join(";")}"`:"";return `<div${i.length>0?` ${i.join(" ")}`:""}${c}>${l}${o||"<br />"}</div>`}).join("")}function SI(t){let e=M0(t),n=[],r=0;return e.forEach((o,i)=>{o.bulletType==="numbered"?r++:r=0;let s={};o.indentLevel>0&&(s.paddingLeft=o.indentLevel*24);let a=[];o.bulletType==="bullet"?a.push(jsx("span",{style:{marginRight:6,color:"#9ca3af"},children:"\u2022"},"bullet")):o.bulletType==="numbered"&&a.push(jsxs("span",{style:{marginRight:6,color:"#9ca3af"},children:[r,"."]},"num")),o.segments.forEach((l,c)=>{if(l.isParagraphBreak)return;let d={};if(l.style.bold&&(d.fontWeight="bold"),l.style.italic&&(d.fontStyle="italic"),l.style.underline&&(d.textDecoration="underline"),l.style.strikethrough&&(d.textDecoration=`${d.textDecoration?`${d.textDecoration} `:""}line-through`),l.style.color&&(d.color=l.style.color),l.style.fontSize&&(d.fontSize=`${l.style.fontSize}pt`),l.style.fontFamily&&(d.fontFamily=l.style.fontFamily),l.style.hyperlink&&Wb(l.style.hyperlink)){let u=l.style.hyperlink;d.color="#4a9eff",d.textDecoration="underline",d.cursor="pointer",a.push(jsx("a",{href:u,style:d,onClick:p=>{p.preventDefault(),Xg(u);},children:l.text},`seg-${i}-${c}`));}else a.push(jsx("span",{style:d,children:l.text},`seg-${i}-${c}`));}),n.push(jsx("div",{style:s,children:a.length>0?a:jsx("br",{})},`p-${i}`));}),n}function Woe({slides:t,onClose:e}){let{t:n}=useTranslation(),r=useRef(null),o=useCallback(()=>{let i=r.current;if(!i?.contentWindow)return;let s=i.contentWindow.document;s.open(),s.write(`<!DOCTYPE html><html><head><style>
|
|
4664
4664
|
body { font-family: Arial, sans-serif; margin: 0; padding: 20px; color: #222; }
|
|
@@ -4675,7 +4675,7 @@ ${h}
|
|
|
4675
4675
|
</style></head><body>`);for(let a of t){let l=Xoe(a),c=M0(l);s.write('<div class="slide-page">'),s.write(`<div class="slide-header">${Dh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write(`<div class="slide-thumb">${Dh(n("pptx.notes.slideN",{n:a.slideNumber}))}</div>`),s.write('<div class="notes-text">');let d=0;for(let u of c){u.bulletType==="numbered"?d++:d=0;let p=u.indentLevel*24,f="";u.bulletType==="bullet"?f="\u2022 ":u.bulletType==="numbered"&&(f=`${d}. `);let h=u.segments.filter(m=>!m.isParagraphBreak).map(m=>Dh(m.text)).join("");s.write(`<div class="para" style="padding-left:${p}px">${Dh(f)}${h}</div>`);}s.write("</div></div>");}s.write("</body></html>"),s.close(),setTimeout(()=>{i.contentWindow?.print();},200);},[t,n]);return jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:jsxs("div",{className:"bg-background border border-border rounded-lg shadow-xl w-[640px] max-h-[80vh] flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("span",{className:"text-sm font-medium text-foreground",children:n("pptx.notes.printNotes")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-sm",children:n("common.close")})]}),jsx("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:t.map(i=>{let s=Xoe(i),a=G2(s).trim().length>0;return jsxs("div",{className:"border border-border/50 rounded p-3",children:[jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:n("pptx.notes.slideN",{n:i.slideNumber})}),jsx("div",{className:"w-full aspect-video bg-muted rounded mb-2 flex items-center justify-center text-muted-foreground text-sm",children:n("pptx.notes.slideN",{n:i.slideNumber})}),jsx("div",{className:"text-xs text-foreground whitespace-pre-wrap",children:a?SI(s):jsx("span",{className:"italic text-muted-foreground",children:n("pptx.notes.noNotes")})})]},i.id)})}),jsx("div",{className:"flex justify-end px-4 py-3 border-t border-border",children:jsx("button",{type:"button",onClick:o,className:"px-3 py-1.5 text-xs bg-primary hover:bg-primary/80 text-white rounded",children:n("pptx.notes.print")})}),jsx("iframe",{ref:r,title:"print-notes",className:"hidden",sandbox:"allow-same-origin"})]})})}function Xoe(t){return t.notesSegments&&t.notesSegments.length>0?t.notesSegments:kv(t.notes??"")}function qoe({initialText:t,onInsert:e,onClose:n}){let{t:r}=useTranslation(),[o,i]=useState(""),[s,a]=useState(t),l=useRef(null);useEffect(()=>{l.current?.focus();},[]);let c=useCallback(d=>{if(d.preventDefault(),o.trim().length===0)return;let u=o.startsWith("http")?o:`https://${o}`;e(u,s||u);},[o,s,e]);return jsx("div",{className:"absolute bottom-full left-0 mb-1 z-10 bg-muted border border-border rounded-lg shadow-lg p-3 w-72",children:jsxs("form",{onSubmit:c,className:"space-y-2",children:[jsxs("div",{children:[jsx("label",{className:"block text-[10px] text-muted-foreground mb-0.5",children:r("pptx.notes.linkUrl")}),jsx("input",{ref:l,type:"text",value:o,onChange:d=>i(d.target.value),placeholder:"https://...",className:"w-full px-2 py-1 text-xs bg-background border border-border rounded text-foreground focus:outline-none focus:border-primary"})]}),jsxs("div",{children:[jsx("label",{className:"block text-[10px] text-muted-foreground mb-0.5",children:r("pptx.notes.linkDisplayText")}),jsx("input",{type:"text",value:s,onChange:d=>a(d.target.value),placeholder:r("pptx.notes.linkDisplayText"),className:"w-full px-2 py-1 text-xs bg-background border border-border rounded text-foreground focus:outline-none focus:border-primary"})]}),jsxs("div",{className:"flex justify-end gap-2",children:[jsx("button",{type:"button",onClick:n,className:"px-2 py-1 text-[10px] text-muted-foreground hover:text-foreground",children:r("common.cancel")}),jsx("button",{type:"submit",className:"px-2 py-1 text-[10px] bg-primary hover:bg-primary/80 text-white rounded",children:r("pptx.notes.insertLink")})]})]})})}function Zoe({isRichEditEnabled:t,showLinkPopover:e,savedSelectionText:n,hasAllSlides:r,onApplyRichCommand:o,onToggleBulletList:i,onToggleNumberedList:s,onIndent:a,onOutdent:l,onLinkButtonClick:c,onInsertLink:d,onCloseLinkPopover:u,onPrintClick:p,onToggleRichEdit:f}){let{t:h}=useTranslation();return jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[jsxs("div",{className:"inline-flex items-center rounded bg-muted text-xs overflow-hidden border border-border/60 relative",children:[jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.bold"),onClick:()=>o("bold"),children:jsx(LuBold,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.italic"),onClick:()=>o("italic"),children:jsx(LuItalic,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.underline"),onClick:()=>o("underline"),children:jsx(LuUnderline,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.strikethrough"),onClick:()=>o("strikeThrough"),children:jsx(LuStrikethrough,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.bulletList"),onClick:i,children:jsx(LuList,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.numberedList"),onClick:s,children:jsx(LuListOrdered,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.indent"),onClick:a,children:jsx(LuIndentIncrease,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.outdent"),onClick:l,children:jsx(LuIndentDecrease,{className:"w-3.5 h-3.5"})}),jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent",title:h("pptx.notes.insertLink"),onClick:c,children:jsx(LuLink,{className:"w-3.5 h-3.5"})}),r&&jsx("button",{type:"button",className:"px-2 py-1 hover:bg-accent border-l border-border/60",title:h("pptx.notes.printNotes"),onClick:p,children:jsx(LuPrinter,{className:"w-3.5 h-3.5"})}),e&&jsx(qoe,{initialText:n,onInsert:d,onClose:u})]}),jsx("button",{type:"button",className:"text-[10px] px-2 py-1 rounded bg-muted hover:bg-accent border border-border/60",onClick:f,title:h("pptx.notes.toggleRichPlainEditor"),children:h(t?"pptx.notes.plainEditor":"pptx.notes.richEditor")})]})}function Joe({activeSlide:t,isExpanded:e,canEdit:n,onToggle:r,onUpdateNotes:o}){let i=useMemo(()=>t?.notesSegments&&t.notesSegments.length>0?Iv(t.notesSegments):kv(t?.notes??""),[t?.notes,t?.notesSegments]),[s,a]=useState(t?.notes??""),[l,c]=useState(i),[d,u]=useState(i.length>0),[p,f]=useState(false),[h,m]=useState(false),x=useRef(null),y=useRef(null),v=useRef(null),S=useRef(null),w=useRef(false),C=useRef(null);useEffect(()=>{let W=t?.notes??"";if(W===C.current)return;let te=t?.notesSegments&&t.notesSegments.length>0?Iv(t.notesSegments):kv(W);a(W),c(te),u(te.length>0);},[t?.id,t?.notes,t?.notesSegments]),useEffect(()=>{if(!(!d||!e||!n||!v.current)){if(w.current){w.current=false;return}v.current.innerHTML=joe(l);}},[n,l,e,d]);let T=useCallback((W,te)=>{x.current&&(clearTimeout(x.current),x.current=null),C.current=W,o(W,te);},[o]),E=useCallback((W,te)=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{C.current=W,o(W,te),x.current=null;},600);},[o]);useEffect(()=>()=>{x.current&&clearTimeout(x.current);},[]);let M=useCallback(W=>{let te=W.target.value,se=kv(te);a(te),c(se),E(te,se);},[E]),A=useCallback(W=>{W.stopPropagation(),W.key==="Enter"&&(W.metaKey||W.ctrlKey)&&(T(s,l),r());},[s,l,T,r]),R=useCallback(()=>{if(!v.current)return;w.current=true;let W=Voe(v.current),te=G2(W);a(te),c(W),E(te,W);},[E]),k=useCallback(()=>{T(s,l);},[s,l,T]),N=useCallback(W=>{if(!v.current)return;let te=zoe(v.current,l),se=M0(l);te>=0&&te<se.length&&(se[te]=W(se[te],te));let Ce=Hoe(se),ee=G2(Ce);a(ee),c(Ce),E(ee,Ce);},[l,E]),F=useCallback(W=>{document.execCommand(W),R(),v.current?.focus();},[R]),B=useCallback(()=>{N(W=>({...W,bulletType:W.bulletType==="bullet"?"none":"bullet"})),v.current?.focus();},[N]),D=useCallback(()=>{N(W=>({...W,bulletType:W.bulletType==="numbered"?"none":"numbered"})),v.current?.focus();},[N]),O=useCallback(()=>{N(W=>({...W,indentLevel:Math.min(4,W.indentLevel+1)})),v.current?.focus();},[N]),U=useCallback(()=>{N(W=>({...W,indentLevel:Math.max(0,W.indentLevel-1)})),v.current?.focus();},[N]),H=useCallback(W=>{if(W.stopPropagation(),W.key==="Enter"&&(W.metaKey||W.ctrlKey)){T(s,l),r();return}W.key==="Tab"&&(W.preventDefault(),W.shiftKey?U():O());},[s,l,T,r,O,U]),j=useCallback(()=>{let W=window.getSelection();S.current={text:W?.toString()??""},f(true);},[]),Z=useCallback((W,te)=>{if(f(false),!v.current)return;v.current.focus();let se=window.getSelection();if(se&&se.rangeCount>0){let Ce=se.getRangeAt(0);Ce.deleteContents();let ee=document.createElement("a");ee.href=W,ee.textContent=te,ee.style.color="#4a9eff",ee.style.textDecoration="underline",ee.style.cursor="pointer",ee.setAttribute("data-hyperlink",W),Ce.insertNode(ee),Ce.setStartAfter(ee),Ce.collapse(true),se.removeAllRanges(),se.addRange(Ce);}R();},[R]),J=useCallback(W=>{let te=W.target;if(!(te instanceof HTMLAnchorElement))return;let se=te.getAttribute("data-hyperlink")||te.getAttribute("href");se&&(W.ctrlKey||W.metaKey)&&(W.preventDefault(),Xg(se));},[]);return {draft:s,draftSegments:l,isRichEditEnabled:d,setIsRichEditEnabled:u,showLinkPopover:p,setShowLinkPopover:f,showPrintDialog:h,setShowPrintDialog:m,textareaRef:y,richEditorRef:v,savedSelectionRef:S,handlePlainChange:M,handleRichInput:R,handleBlur:k,handleKeyDownPlain:A,handleKeyDownRich:H,applyRichCommand:F,toggleBulletList:B,toggleNumberedList:D,handleIndent:O,handleOutdent:U,handleLinkButtonClick:j,handleInsertLink:Z,handleEditorClick:J}}var V6=({activeSlide:t,allSlides:e,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i,panelHeight:s})=>{let{t:a}=useTranslation(),{draft:l,draftSegments:c,isRichEditEnabled:d,setIsRichEditEnabled:u,showLinkPopover:p,setShowLinkPopover:f,showPrintDialog:h,setShowPrintDialog:m,textareaRef:x,richEditorRef:y,savedSelectionRef:v,handlePlainChange:S,handleRichInput:w,handleBlur:C,handleKeyDownPlain:T,handleKeyDownRich:E,applyRichCommand:M,toggleBulletList:A,toggleNumberedList:R,handleIndent:k,handleOutdent:N,handleLinkButtonClick:F,handleInsertLink:B,handleEditorClick:D}=Joe({activeSlide:t,isExpanded:n,canEdit:r,onToggle:o,onUpdateNotes:i}),O=l.trim().length>0,U=t?a("pptx.notes.slideN",{n:t.slideNumber}):a("pptx.notes.noSlide");return jsxs("div",{className:le("flex flex-col border-t border-border/60 bg-background select-none",!n&&"max-md:hidden"),children:[jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1.5 px-3 py-1 text-[11px] text-muted-foreground hover:text-foreground hover:bg-accent/30 transition-colors w-full text-left shrink-0 max-md:hidden","aria-expanded":n,"aria-controls":"slide-notes-content",children:["Notes",!n&&O&&jsx("span",{className:"text-muted-foreground/50 text-[10px]",children:"(has notes)"})]}),n&&jsxs("div",{id:"slide-notes-content",className:"px-3 pb-2 overflow-y-auto",style:{maxHeight:s??240},children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:U}),r?jsxs(Fragment,{children:[jsx(Zoe,{isRichEditEnabled:d,showLinkPopover:p,savedSelectionText:v.current?.text??"",hasAllSlides:e!==void 0&&e.length>0,onApplyRichCommand:M,onToggleBulletList:A,onToggleNumberedList:R,onIndent:k,onOutdent:N,onLinkButtonClick:F,onInsertLink:B,onCloseLinkPopover:()=>f(false),onPrintClick:()=>m(true),onToggleRichEdit:()=>u(H=>!H)}),d?jsx("div",{ref:y,contentEditable:true,suppressContentEditableWarning:true,onInput:w,onBlur:C,onKeyDown:E,onClick:D,className:"w-full overflow-y-auto rounded-md border border-border/50 bg-muted/60 px-2.5 py-1.5 text-xs text-foreground focus:border-primary/50 focus:outline-none focus:ring-1 focus:ring-primary/30 transition-colors whitespace-pre-wrap",style:{maxHeight:192,minHeight:72}}):jsx("textarea",{ref:x,name:"slide-notes",value:l,onChange:S,onBlur:C,onKeyDown:T,placeholder:a("pptx.notes.clickToAddNotes"),rows:4,className:"w-full resize-none rounded-md border border-border/50 bg-muted/60 px-2.5 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:border-primary/50 focus:outline-none focus:ring-1 focus:ring-primary/30 transition-colors",style:{maxHeight:192}})]}):jsx("div",{className:"w-full rounded-md border border-border/30 bg-muted/40 px-2.5 py-1.5 text-xs text-muted-foreground overflow-y-auto whitespace-pre-wrap",style:{maxHeight:168,minHeight:60},children:O?SI(c):jsx("span",{className:"italic text-muted-foreground",children:a("pptx.notes.noNotes")})})]}),h&&e&&jsx(Woe,{slides:e,onClose:()=>m(false)})]})};var Zze="pptx-viewer-autosave",Jze=1,Dv="recoveryVersions";function Qoe(){return new Promise((t,e)=>{let n=indexedDB.open(Zze,Jze);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(Dv)||r.createObjectStore(Dv,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function Qze(t){try{let e=await Qoe();return new Promise(n=>{let i=e.transaction(Dv,"readonly").objectStore(Dv).get(t);i.onsuccess=()=>{e.close();let s=i.result;n(s?[s]:[]);},i.onerror=()=>{e.close(),n([]);};})}catch{return []}}async function eGe(t){try{let e=await Qoe();return new Promise(n=>{let r=e.transaction(Dv,"readwrite");r.objectStore(Dv).delete(t),r.oncomplete=()=>{e.close(),n();},r.onerror=()=>{e.close(),n();};})}catch{}}function tGe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function nGe(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function rGe(t){let e=Date.now()-t,n=Math.floor(e/6e4);if(n<1)return "Just now";if(n<60)return `${n}m ago`;let r=Math.floor(n/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function X6({isOpen:t,filePath:e,onClose:n,onRestore:r}){let{t:o}=useTranslation(),[i,s]=useState([]),[a,l]=useState(false),[c,d]=useState(null),[u,p]=useState(null),f=useCallback(async()=>{if(e){l(true);try{let x=await Qze(e);s(x);}catch{s([]);}finally{l(false);}}},[e]);useEffect(()=>{t&&f();},[t,f]);let h=useCallback(async x=>{d(x.key);try{x.data&&(r(x.data),n());}finally{d(null);}},[r,n]),m=useCallback(async x=>{p(x.key);try{await eGe(x.key),await f();}finally{p(null);}},[f]);return t?jsxs("div",{className:"absolute inset-y-0 right-0 w-80 bg-background border-l border-border z-50 flex flex-col shadow-xl",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[jsx(LuClock,{className:"w-4 h-4"}),o("pptx.versionHistory.title")]}),jsx("button",{onClick:n,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&jsx("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:o("common.loading")}),!a&&i.length===0&&jsx("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:o("pptx.versionHistory.noVersions")}),!a&&i.map(x=>jsxs("div",{className:"px-3 py-2.5 border-b border-border hover:bg-muted/50 group",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-xs text-foreground",children:nGe(x.timestamp)}),jsx("div",{className:"text-[10px] text-muted-foreground",children:rGe(x.timestamp)})]}),jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:tGe(x.size)}),jsxs("div",{className:"flex items-center gap-1 mt-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[jsxs("button",{onClick:()=>{h(x);},disabled:c===x.key,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] bg-primary/20 text-primary hover:bg-primary/30 disabled:opacity-40",children:[jsx(LuDownload,{className:"w-3 h-3"}),c===x.key?o("common.loading"):o("pptx.versionHistory.restore")]}),jsxs("button",{onClick:()=>{m(x);},disabled:u===x.key,className:"inline-flex items-center gap-1 px-2 py-1 rounded text-[10px] bg-red-600/20 text-red-400 hover:bg-red-600/30 disabled:opacity-40",children:[jsx(LuTrash2,{className:"w-3 h-3"}),o("common.delete")]})]})]},x.key))]})]}):null}function fGe({kind:t}){switch(t){case "added":return jsx(LuPlus,{className:"w-3 h-3 text-green-400"});case "removed":return jsx(LuMinus,{className:"w-3 h-3 text-red-400"});case "moved":return jsx(LuMove,{className:"w-3 h-3 text-primary"});case "resized":return jsx(LuMove,{className:"w-3 h-3 text-amber-400"});case "textChanged":return jsx(LuType,{className:"w-3 h-3 text-purple-400"})}}function tie({diff:t,diffIndex:e,canvasSize:n,accepted:r,rejected:o,onAccept:i,onReject:s}){let{t:a}=useTranslation(),[l,c]=useState(t.status==="changed"),d=(()=>{switch(t.status){case "added":return a("pptx.compare.statusAdded");case "removed":return a("pptx.compare.statusRemoved");case "changed":return a("pptx.compare.statusChanged");case "unchanged":return a("pptx.compare.statusUnchanged")}})(),u=(()=>{switch(t.status){case "added":return "text-green-400 bg-green-900/30";case "removed":return "text-red-400 bg-red-900/30";case "changed":return "text-amber-400 bg-amber-900/30";case "unchanged":return "text-muted-foreground bg-muted/30"}})();if(t.status==="unchanged")return null;let p=r||o,f=t.baseIndex>=0?t.baseIndex+1:t.compareIndex+1;return jsxs("div",{className:le("rounded-lg border transition-colors",p?"border-border/60 bg-card/40 opacity-60":"border-border bg-background/70"),children:[jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-2 text-left",onClick:()=>c(h=>!h),children:[l?jsx(LuChevronDown,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}):jsx(LuChevronRight,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),jsx("span",{className:"text-xs text-foreground",children:a("pptx.compare.slideNumber",{number:f})}),jsx("span",{className:le("rounded-full px-2 py-0.5 text-[10px] font-medium",u),children:d}),t.changes.length>0&&jsxs("span",{className:"text-[10px] text-muted-foreground",children:[t.changes.length," ",t.changes.length===1?"change":"changes"]}),jsx("span",{className:"flex-1"}),p&&jsx("span",{className:le("text-[10px] font-medium",r?"text-green-400":"text-muted-foreground"),children:a(r?"pptx.compare.accepted":"pptx.compare.rejected")})]}),l&&jsxs("div",{className:"px-3 pb-3 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[t.baseSlide&&jsxs("div",{className:"flex-1",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:a("pptx.compare.current")}),jsx("div",{className:"rounded border border-border overflow-hidden",children:jsx(Qa,{slide:t.baseSlide,templateElements:[],canvasSize:n})})]}),t.compareSlide&&jsxs("div",{className:"flex-1",children:[jsx("div",{className:"text-[10px] text-muted-foreground mb-1",children:a("pptx.compare.incoming")}),jsx("div",{className:le("rounded border overflow-hidden",t.status==="added"?"border-green-700/60":t.status==="changed"?"border-amber-700/60":"border-border"),children:jsx(Qa,{slide:t.compareSlide,templateElements:[],canvasSize:n})})]})]}),t.changes.length>0&&jsx("div",{className:"space-y-1",children:t.changes.map((h,m)=>jsxs("div",{className:"flex items-start gap-2 rounded bg-muted/60 px-2 py-1.5 text-[11px]",children:[jsx(fGe,{kind:h.kind}),jsx("span",{className:"text-foreground",children:h.description})]},`${h.elementId}-${h.kind}-${m}`))}),!p&&jsxs("div",{className:"flex items-center gap-2 pt-1",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-green-700/80 px-2.5 py-1 text-[11px] text-green-50 hover:bg-green-600 transition-colors",onClick:()=>i(e),children:[jsx(LuCheck,{className:"w-3 h-3"}),a("pptx.compare.accept")]}),jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-accent px-2.5 py-1 text-[11px] text-foreground hover:bg-accent/80 transition-colors",onClick:()=>s(e),children:[jsx(LuX,{className:"w-3 h-3"}),a("pptx.compare.reject")]})]})]})]})}function Y6({isOpen:t,compareResult:e,canvasSize:n,onClose:r,onAcceptSlide:o,onRejectSlide:i,onAcceptAll:s}){let{t:a}=useTranslation(),[l,c]=useState({}),[d,u]=useState({}),p=useCallback(x=>{c(y=>({...y,[x]:true})),u(y=>{let v={...y};return delete v[x],v}),o(x);},[o]),f=useCallback(x=>{u(y=>({...y,[x]:true})),c(y=>{let v={...y};return delete v[x],v}),i(x);},[i]),h=useCallback(()=>{if(!e)return;let x={};e.diffs.forEach((y,v)=>{y.status!=="unchanged"&&(x[v]=true);}),c(x),u({}),s();},[e,s]);if(!t||!e)return null;let m=e.diffs.filter(x=>x.status!=="unchanged");return jsxs("div",{className:"fixed inset-y-0 right-0 z-50 flex flex-col w-[440px] border-l border-border bg-popover backdrop-blur-lg shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsxs("div",{children:[jsx("h3",{className:"text-sm font-medium text-foreground",children:a("pptx.compare.title")}),jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:a("pptx.compare.summary",{added:e.addedCount,removed:e.removedCount,changed:e.changedCount})})]}),jsx("button",{type:"button",className:"rounded p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",onClick:r,title:a("pptx.compare.close"),children:jsx(LuX,{className:"w-4 h-4"})})]}),m.length>0&&jsx("div",{className:"px-4 py-2 border-b border-border/60",children:jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded bg-green-700/80 px-3 py-1.5 text-xs text-green-50 hover:bg-green-600 transition-colors",onClick:h,children:[jsx(LuCheck,{className:"w-3.5 h-3.5"}),a("pptx.compare.acceptAll")]})}),jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-2",children:m.length===0?jsx("div",{className:"text-center py-8 text-xs text-muted-foreground",children:a("pptx.compare.noDifferences")}):e.diffs.map((x,y)=>jsx(tie,{diff:x,diffIndex:y,canvasSize:n,accepted:!!l[y],rejected:!!d[y],onAccept:p,onReject:f},`diff-${y}-${x.status}`))})]})}function CGe(t){if(!t)return 0;let e=0;return t.length>=8&&e++,t.length>=12&&e++,/[A-Z]/.test(t)&&/[a-z]/.test(t)&&e++,/\d/.test(t)&&e++,/[^A-Za-z0-9]/.test(t)&&e++,Math.min(e,4)}var TGe=["bg-red-500","bg-orange-500","bg-yellow-500","bg-lime-500","bg-green-500"];function K6({isOpen:t,isCurrentlyProtected:e,onClose:n,onSetPassword:r,onRemovePassword:o}){let{t:i}=useTranslation(),[s,a]=useState(""),[l,c]=useState(""),[d,u]=useState(false),[p,f]=useState(""),h=useMemo(()=>CGe(s),[s]),m=useMemo(()=>{let S=[i("pptx.security.strengthVeryWeak"),i("pptx.security.strengthWeak"),i("pptx.security.strengthFair"),i("pptx.security.strengthStrong"),i("pptx.security.strengthVeryStrong")];return s?S[h]:""},[h,s,i]),x=useCallback(()=>{if(f(""),!s){f(i("pptx.security.errorPasswordRequired"));return}if(s!==l){f(i("pptx.security.errorPasswordMismatch"));return}if(s.length<4){f(i("pptx.security.errorPasswordTooShort"));return}r(s),a(""),c(""),n();},[s,l,r,n,i]),y=useCallback(()=>{o(),a(""),c(""),n();},[o,n]),v=useCallback(()=>{a(""),c(""),f(""),n();},[n]);return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":i("common.close"),onClick:v}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuLock,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:i("pptx.security.protectPresentation")})]}),jsx("button",{type:"button",onClick:v,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":i("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsxs("div",{className:"px-5 py-4 space-y-4",children:[e&&jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-green-900/30 border border-green-700/40 px-3 py-2",children:[jsx(LuShieldCheck,{className:"w-4 h-4 text-green-400 shrink-0"}),jsx("span",{className:"text-xs text-green-300",children:i("pptx.security.currentlyProtected")})]}),jsx("p",{className:"text-xs text-muted-foreground",children:i("pptx.security.description")}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:i("pptx.security.password")}),jsxs("div",{className:"relative",children:[jsx("input",{type:d?"text":"password",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:i("pptx.security.passwordPlaceholder"),value:s,onChange:S=>{a(S.target.value),f("");}}),jsx("button",{type:"button",onClick:()=>u(!d),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":d?"Hide password":"Show password",children:d?jsx(LuEyeOff,{className:"w-4 h-4"}):jsx(LuEye,{className:"w-4 h-4"})})]})]}),s&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"flex gap-1",children:Array.from({length:5}).map((S,w)=>jsx("div",{className:`h-1 flex-1 rounded-full transition-colors ${w<=h?TGe[h]:"bg-accent"}`},`str-${w}`))}),jsx("p",{className:"text-[11px] text-muted-foreground",children:m})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:i("pptx.security.confirmPassword")}),jsx("input",{type:d?"text":"password",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:i("pptx.security.confirmPasswordPlaceholder"),value:l,onChange:S=>{c(S.target.value),f("");}})]}),p&&jsx("p",{className:"text-xs text-red-400",children:p})]}),jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border/60",children:[jsx("div",{children:e&&jsx("button",{type:"button",onClick:y,className:"text-xs text-red-400 hover:text-red-300 transition-colors",children:i("pptx.security.removePassword")})}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{type:"button",onClick:v,className:"px-3 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:i("common.cancel")}),jsx("button",{type:"button",onClick:x,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors",children:i(e?"pptx.security.updatePassword":"pptx.security.setPassword")})]})]})]})})]}):null}var PGe=[{value:"lpwstr",labelKey:"pptx.documentProperties.custom.typeText"},{value:"i4",labelKey:"pptx.documentProperties.custom.typeNumber"},{value:"filetime",labelKey:"pptx.documentProperties.custom.typeDate"},{value:"bool",labelKey:"pptx.documentProperties.custom.typeYesNo"}];function Z6({customProperties:t,onUpdate:e}){let{t:n}=useTranslation(),r=useCallback(()=>{e([...t,{name:"",value:"",type:"lpwstr"}]);},[t,e]),o=useCallback(l=>{e(t.filter((c,d)=>d!==l));},[t,e]),i=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,name:c}:d));},[t,e]),s=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,value:c}:d));},[t,e]),a=useCallback((l,c)=>{e(t.map((d,u)=>u===l?{...d,type:c}:d));},[t,e]);return jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-muted-foreground",children:n("pptx.documentProperties.custom.description")}),jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_32px] gap-1 text-[11px] font-medium text-muted-foreground px-1",children:[jsx("span",{children:n("pptx.documentProperties.custom.name")}),jsx("span",{children:n("pptx.documentProperties.custom.value")}),jsx("span",{children:n("pptx.documentProperties.custom.type")}),jsx("span",{})]}),jsx("div",{className:"max-h-[240px] overflow-y-auto space-y-1",children:t.map((l,c)=>jsxs("div",{className:"grid grid-cols-[1fr_1fr_100px_32px] gap-1 items-center",children:[jsx("input",{type:"text",className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:n("pptx.documentProperties.custom.namePlaceholder"),value:l.name,onChange:d=>i(c,d.target.value)}),l.type==="bool"?jsxs("select",{className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:l.value,onChange:d=>s(c,d.target.value),children:[jsx("option",{value:"true",children:n("pptx.documentProperties.custom.yes")}),jsx("option",{value:"false",children:n("pptx.documentProperties.custom.no")})]}):jsx("input",{type:l.type==="i4"?"number":"text",className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",placeholder:n("pptx.documentProperties.custom.valuePlaceholder"),value:l.value,onChange:d=>s(c,d.target.value)}),jsx("select",{className:"w-full rounded border border-border bg-muted px-2 py-1 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:l.type,onChange:d=>a(c,d.target.value),children:PGe.map(d=>jsx("option",{value:d.value,children:n(d.labelKey)},d.value))}),jsx("button",{type:"button",onClick:()=>o(c),className:"p-1 rounded hover:bg-red-500/20 text-muted-foreground hover:text-red-400 transition-colors","aria-label":n("pptx.documentProperties.custom.deleteProperty"),children:jsx(LuTrash2,{className:"w-3.5 h-3.5"})})]},`custom-prop-${c}`))}),t.length===0&&jsx("p",{className:"text-xs text-muted-foreground/60 text-center py-4",children:n("pptx.documentProperties.custom.empty")}),jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:[jsx(LuPlus,{className:"w-3.5 h-3.5"}),n("pptx.documentProperties.custom.addProperty")]})]})}var IGe=[{key:"application",labelKey:"pptx.documentProperties.statistics.application",editable:false},{key:"appVersion",labelKey:"pptx.documentProperties.statistics.appVersion",editable:false},{key:"presentationFormat",labelKey:"pptx.documentProperties.statistics.presentationFormat",editable:false},{key:"slides",labelKey:"pptx.documentProperties.statistics.slides",editable:false},{key:"hiddenSlides",labelKey:"pptx.documentProperties.statistics.hiddenSlides",editable:false},{key:"notes",labelKey:"pptx.documentProperties.statistics.notes",editable:false},{key:"totalTime",labelKey:"pptx.documentProperties.statistics.totalTime",editable:false},{key:"words",labelKey:"pptx.documentProperties.statistics.words",editable:false},{key:"paragraphs",labelKey:"pptx.documentProperties.statistics.paragraphs",editable:false},{key:"template",labelKey:"pptx.documentProperties.statistics.template",editable:false},{key:"company",labelKey:"pptx.documentProperties.statistics.company",editable:true},{key:"manager",labelKey:"pptx.documentProperties.statistics.manager",editable:true}];function NGe(t,e){if(t==null)return e("pptx.documentProperties.statistics.notAvailable");let n=Math.floor(t/60),r=t%60;return e("pptx.documentProperties.statistics.hoursMinutes",{hours:n,minutes:r})}function DGe(t,e,n){return t==="totalTime"?NGe(e,n):e==null?n("pptx.documentProperties.statistics.notAvailable"):String(e)}function J6({appProperties:t,onUpdateAppProperties:e,canEdit:n}){let{t:r}=useTranslation(),o=useCallback((i,s)=>{e({[i]:s});},[e]);return jsx("div",{className:"space-y-3",children:IGe.map(({key:i,labelKey:s,editable:a})=>jsxs("div",{className:"flex items-center gap-3",children:[jsx("label",{className:"block text-xs text-foreground w-[140px] shrink-0",children:r(s)}),a&&n?jsx("input",{type:"text",className:"flex-1 rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:String(t[i]??""),onChange:l=>o(i,l.target.value)}):jsx("span",{className:"flex-1 px-3 py-2 text-sm text-muted-foreground",children:DGe(i,t[i],r)})]},i))})}var oie=[{key:"title",labelKey:"pptx.documentProperties.summary.title"},{key:"subject",labelKey:"pptx.documentProperties.summary.subject"},{key:"creator",labelKey:"pptx.documentProperties.summary.author"},{key:"keywords",labelKey:"pptx.documentProperties.summary.keywords"},{key:"description",labelKey:"pptx.documentProperties.summary.description",multiline:true},{key:"category",labelKey:"pptx.documentProperties.summary.category"}];function Q6({isOpen:t,coreProperties:e,customProperties:n,appProperties:r,onClose:o,onSave:i}){let{t:s}=useTranslation(),[a,l]=useState("summary"),[c,d]=useState({}),[u,p]=useState([]),[f,h]=useState({}),[m,x]=useState(false);t&&!m&&(d({...e}),p(n.map(E=>({...E}))),h({company:r?.company,manager:r?.manager}),l("summary")),t!==m&&x(t);let y=useCallback((E,M)=>{d(A=>({...A,[E]:M}));},[]),v=useMemo(()=>{if(oie.some(({key:R})=>(c[R]??"")!==(e[R]??"")))return true;let M=(f.company??"")!==(r?.company??""),A=(f.manager??"")!==(r?.manager??"");return M||A||u.length!==n.length?true:u.some((R,k)=>R.name!==n[k]?.name||R.value!==n[k]?.value||R.type!==n[k]?.type)},[c,u,f,e,n,r]),S=useCallback(E=>{h(M=>({...M,...E}));},[]),w=useCallback(()=>{let E=(f.company??"")!==(r?.company??"")||(f.manager??"")!==(r?.manager??"");i(c,u,E?f:void 0),o();},[c,u,f,r,i,o]),C=useCallback(()=>{o();},[o]);if(!t)return null;let T=[{id:"summary",labelKey:"pptx.documentProperties.tabs.summary"},{id:"custom",labelKey:"pptx.documentProperties.tabs.custom"},{id:"statistics",labelKey:"pptx.documentProperties.tabs.statistics"}];return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":s("common.close"),onClick:C}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[520px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuFileText,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.documentProperties.dialogTitle")})]}),jsx("button",{type:"button",onClick:C,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"flex border-b border-border/60",children:T.map(E=>jsx("button",{type:"button",onClick:()=>l(E.id),className:`px-4 py-2 text-xs font-medium transition-colors ${a===E.id?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:s(E.labelKey)},E.id))}),jsxs("div",{className:"px-5 py-4 min-h-[280px]",children:[a==="summary"&&jsx("div",{className:"space-y-3",children:oie.map(({key:E,labelKey:M,multiline:A})=>jsxs("div",{children:[jsx("label",{className:"block text-xs text-foreground mb-1",children:s(M)}),A?jsx("textarea",{className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none resize-none",rows:3,value:c[E]??"",onChange:R=>y(E,R.target.value)}):jsx("input",{type:"text",className:"w-full rounded-lg border border-border bg-muted px-3 py-2 text-sm text-foreground placeholder-muted-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:c[E]??"",onChange:R=>y(E,R.target.value)})]},E))}),a==="custom"&&jsx(Z6,{customProperties:u,onUpdate:p}),a==="statistics"&&jsx(J6,{appProperties:{...r,company:f.company,manager:f.manager},onUpdateAppProperties:S,canEdit:true})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border/60",children:[jsx("button",{type:"button",onClick:C,className:"px-3 py-1.5 text-xs rounded-lg border border-border text-foreground hover:bg-muted transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:w,disabled:!v,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("common.save")})]})]})})]})}function YGe(t){if(typeof document>"u")return false;try{return document.fonts.check(`12px "${t}"`)}catch{return false}}function t8({isOpen:t,embedFontsEnabled:e,usedFontFamilies:n,embeddedFonts:r,onClose:o,onToggleEmbedFonts:i}){let{t:s}=useTranslation(),[a,l]=useState(new Set),[c,d]=useState(false),[u,p]=useState(false),f=useCallback(async()=>{d(true);try{await document.fonts.ready;let x=new Set;for(let y of n)YGe(y)&&x.add(y);l(x),p(!0);}catch{}finally{d(false);}},[n]);if(useEffect(()=>{t&&!u&&f();},[t,u,f]),!t)return null;let h=n.filter(x=>!a.has(x)),m=new Set(r);return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":s("common.close"),onClick:o}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[460px] max-h-[80vh] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60 shrink-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuType,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.fonts.embedFonts")})]}),jsx("button",{type:"button",onClick:o,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1",children:[jsx("p",{className:"text-xs text-muted-foreground",children:s("pptx.fonts.embedDescription")}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[jsxs("div",{className:"relative",children:[jsx("input",{type:"checkbox",className:"sr-only",checked:e,onChange:x=>i(x.target.checked)}),jsx("div",{className:`w-9 h-5 rounded-full transition-colors ${e?"bg-primary":"bg-muted-foreground"}`}),jsx("div",{className:`absolute top-0.5 left-0.5 w-4 h-4 rounded-full bg-white transition-transform ${e?"translate-x-4":""}`})]}),jsx("span",{className:"text-xs text-foreground",children:s("pptx.fonts.enableEmbedding")})]}),jsxs("div",{className:"space-y-1",children:[jsxs("h3",{className:"text-xs font-medium text-foreground",children:[s("pptx.fonts.usedFonts")," (",n.length,")"]}),c?jsxs("div",{className:"flex items-center gap-2 py-4 justify-center",children:[jsx(LuLoader,{className:"w-4 h-4 text-muted-foreground animate-spin"}),jsx("span",{className:"text-xs text-muted-foreground",children:s("pptx.fonts.scanning")})]}):jsx("div",{className:"space-y-1 max-h-[280px] overflow-y-auto",children:n.map(x=>{let y=a.has(x),v=m.has(x);return jsxs("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg bg-muted/60",children:[jsx("span",{className:"text-xs text-foreground",children:x}),jsxs("div",{className:"flex items-center gap-2",children:[v&&jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-green-900/40 text-green-400 border border-green-700/40",children:s("pptx.fonts.embedded")}),y?jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}):jsx("span",{className:"text-[10px] text-yellow-400",children:s("pptx.fonts.notFound")})]})]},x)})})]}),h.length>0&&!c&&jsx("p",{className:"text-[11px] text-yellow-400/80",children:s("pptx.fonts.missingWarning",{count:h.length})})]}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60 shrink-0",children:jsx("button",{type:"button",onClick:o,className:"px-3 py-1.5 text-xs rounded-lg bg-primary text-white hover:bg-primary/80 transition-colors",children:s("common.done")})})]})})]})}function r8({isOpen:t,onClose:e,hasSignatures:n,signatureCount:r}){let{t:o}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":o("common.close"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[n?jsx(LuShieldCheck,{className:"w-5 h-5 text-green-400"}):jsx(LuShieldAlert,{className:"w-5 h-5 text-amber-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:o("pptx.digitalSignatures.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":o("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6 space-y-4",children:n?jsxs(Fragment,{children:[jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-green-900/20 border border-green-700/30 px-4 py-3",children:[jsx(LuSignature,{className:"w-5 h-5 text-green-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-1",children:[jsx("p",{className:"text-xs text-green-200",children:o("pptx.digitalSignatures.signed")}),jsx("p",{className:"text-[11px] text-green-300/70",children:o("pptx.digitalSignatures.signatureCount",{count:r})})]})]}),jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-amber-900/20 border border-amber-700/30 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-amber-400 shrink-0 mt-0.5"}),jsx("p",{className:"text-xs text-amber-200",children:o("pptx.digitalSignatures.editWarning")})]})]}):jsx(Fragment,{children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-muted/30 border border-border/40 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-muted-foreground shrink-0 mt-0.5"}),jsx("p",{className:"text-xs text-muted-foreground",children:o("pptx.digitalSignatures.noSignatures")})]})})}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60",children:jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:o("common.close")})})]})})]}):null}function o8({hasSignatures:t,signatureCount:e,onClick:n}){let{t:r}=useTranslation();return !t||e===0?null:jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 px-2 py-0.5 text-[11px] font-medium rounded-md bg-green-900/30 border border-green-700/40 text-green-300 hover:bg-green-900/50 transition-colors",title:r("pptx.digitalSignatures.signatureCount",{count:e}),children:[jsx(LuShieldCheck,{className:"w-3.5 h-3.5"}),jsx("span",{children:r("pptx.digitalSignatures.badge")})]})}function i8({isOpen:t,signatureCount:e,onConfirm:n,onCancel:r}){let{t:o}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":o("common.close"),onClick:r}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuTriangleAlert,{className:"w-5 h-5 text-amber-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:o("pptx.digitalSignatures.strippedTitle")})]}),jsx("button",{type:"button",onClick:r,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":o("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6",children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-amber-900/20 border border-amber-700/30 px-4 py-3",children:[jsx(LuTriangleAlert,{className:"w-5 h-5 text-amber-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"text-xs text-amber-200",children:o("pptx.digitalSignatures.strippedMessage",{count:e})}),jsx("p",{className:"text-[11px] text-amber-300/70",children:o("pptx.digitalSignatures.editWarning")})]})]})}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border/60",children:[jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:o("common.cancel")}),jsx("button",{type:"button",onClick:n,className:"px-3 py-1.5 text-xs rounded-lg bg-amber-600 text-white hover:bg-amber-500 transition-colors",children:o("pptx.digitalSignatures.strippedConfirm")})]})]})})]}):null}function s8({isOpen:t,onClose:e}){let{t:n}=useTranslation();return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":n("common.close"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[420px] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuLock,{className:"w-5 h-5 text-red-400"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:n("pptx.encryptedFile.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":n("common.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"px-5 py-6 space-y-4",children:jsxs("div",{className:"flex items-start gap-3 rounded-lg bg-red-900/20 border border-red-700/30 px-4 py-3",children:[jsx(LuInfo,{className:"w-5 h-5 text-red-400 shrink-0 mt-0.5"}),jsxs("div",{className:"space-y-2",children:[jsx("p",{className:"text-xs text-red-200",children:n("pptx.encryptedFile.message")}),jsx("p",{className:"text-[11px] text-red-300/70",children:n("pptx.encryptedFile.instructions")})]})]})}),jsx("div",{className:"flex items-center justify-end px-5 py-3 border-t border-border/60",children:jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded-lg bg-accent text-foreground hover:bg-accent/80 transition-colors",children:n("common.close")})})]})})]}):null}var a8=10,l8=32,c8=2,cie=14;function d8(t){return Math.max(a8,Math.min(l8,t))}function die(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function q2(t){let e=Math.floor(t/1e3),n=Math.floor(e/3600),r=Math.floor(e%3600/60),o=e%60;return n>0?`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`:`${String(r).padStart(2,"0")}:${String(o).padStart(2,"0")}`}function uie(t){return t.map((e,n)=>{if(e.isParagraphBreak)return Vn__default.createElement("br",{key:`br-${n}`});let r={};return e.style.bold&&(r.fontWeight="bold"),e.style.italic&&(r.fontStyle="italic"),e.style.underline&&(r.textDecoration="underline"),e.style.strikethrough&&(r.textDecoration=`${r.textDecoration?`${r.textDecoration} `:""}line-through`),e.style.color&&(r.color=e.style.color),e.style.fontSize&&(r.fontSize=`${e.style.fontSize}pt`),e.style.fontFamily&&(r.fontFamily=e.style.fontFamily),Vn__default.createElement("span",{key:`seg-${n}`,style:r},e.text)})}function gVe({slide:t,templateElements:e,canvasSize:n,className:r}){let o=useRef(null),[i,s]=useState(0);useEffect(()=>{let p=o.current;if(!p)return;let f=new ResizeObserver(h=>{let m=h[0];m&&s(m.contentRect.width);});return f.observe(p),()=>f.disconnect()},[]);let a=Math.max(n.width,1),l=Math.max(n.height,1),c=i>0?i/a:.2,d=Math.max(40,Math.round(l*c)),u=[...e,...t.elements].slice(0,80);return jsxs("div",{ref:o,className:`relative w-full overflow-hidden rounded border border-border bg-white ${r??""}`,style:{height:d},children:[t.backgroundColor&&t.backgroundColor!=="transparent"&&jsx("div",{className:"absolute inset-0",style:{backgroundColor:ut(t.backgroundColor,"#ffffff")}}),t.backgroundImage&&jsx("img",{src:t.backgroundImage,alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",draggable:false}),t.backgroundGradient&&jsx("div",{className:"absolute inset-0",style:{backgroundImage:t.backgroundGradient}}),jsx("div",{className:"absolute top-0 left-0 origin-top-left",style:{width:a,height:l,transform:`scale(${c})`,transformOrigin:"top left"},children:u.map(p=>{let f=Math.max(p.width,1),h=Math.max(p.height,1),m=mn(p)?p.shapeStyle:void 0,x=m?.fillColor!==void 0&&m?.fillColor!=="transparent"||!!(Bu(m)||m?.fillGradient)||m?.fillMode==="pattern"&&!!m.fillPatternPreset,y=ut(m?.fillColor,Pf),v=Math.max(0,m?.strokeWidth||0),S=ut(m?.strokeColor,Fu),w=Hu(p,x,y,v,S),C=Vu(p,x,y,v,S),T=p.type==="shape"&&x?"#ffffff":bi,E=If(p,T),M=ju(p),A=Nf(p),R=ot(p)?p.text:void 0,k=ot(p)?p.textSegments:void 0,N=typeof R=="string"&&R.trim().length>0||(k?.length??0)>0,F=ty(p,A)?cs(p):"";return jsx("div",{className:"absolute overflow-hidden",style:{left:p.x,top:p.y,width:f,height:h,transform:hd(p),transformOrigin:"center"},children:(p.type==="picture"||p.type==="image")&&(p.svgData||p.imageData)?xd(p)?jsx("div",{className:"pointer-events-none w-full h-full",style:Xu(p)}):jsx("img",{src:p.svgData||p.imageData,alt:"",className:"pointer-events-none",style:M,draggable:false}):jsxs("div",{className:"relative w-full h-full overflow-hidden",style:w,children:[C,A&&N&&jsx("div",{className:"w-full h-full whitespace-pre-wrap break-words px-1 py-0.5 leading-[1.3]",style:{...Sc(p),...E,transform:kf(p),transformOrigin:"center"},children:Al(p,T)}),!N&&F.length>0&&jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[10px] text-muted-foreground",children:F})]})},p.id)})})]})}function xVe(t,e){return !(t.slide.id!==e.slide.id||t.slide.isDirty!==e.slide.isDirty||t.slide.hidden!==e.slide.hidden||t.slide.elements!==e.slide.elements||t.slide.backgroundColor!==e.slide.backgroundColor||t.slide.backgroundImage!==e.slide.backgroundImage||t.slide.backgroundGradient!==e.slide.backgroundGradient||t.templateElements!==e.templateElements||t.canvasSize.width!==e.canvasSize.width||t.canvasSize.height!==e.canvasSize.height||t.className!==e.className)}var u8=Vn__default.memo(gVe,xVe);function f8({slides:t,currentSlideIndex:e,canvasSize:n,templateElements:r,presentationStartTime:o,onMovePresentationSlide:i,onExit:s,onOpenAudienceWindow:a,onCloseAudienceWindow:l,isAudienceWindowOpen:c}){let{t:d}=useTranslation(),[u,p]=useState(false);useEffect(()=>{let N=window.setTimeout(()=>p(true),300);return ()=>window.clearTimeout(N)},[]);let[f,h]=useState(Date.now());useEffect(()=>{let N=window.setInterval(()=>h(Date.now()),1e3);return ()=>window.clearInterval(N)},[]);let m=o?f-o:0,[x,y]=useState(cie),v=useCallback(()=>{y(N=>d8(N+c8));},[]),S=useCallback(()=>{y(N=>d8(N-c8));},[]),w=t[e],C=e+1<t.length?t[e+1]:void 0,T=w?.notes??"",E=w?.notesSegments,M=E&&E.length>0;if(!w)return jsx("div",{className:"absolute inset-0 z-50 flex items-center justify-center bg-card text-muted-foreground",children:d("pptx.presenter.noSlides")});let A=300*1e3,R=Math.min(100,m%A/A*100),k=Math.floor(m/A);return jsxs("div",{className:"absolute inset-0 z-50 flex flex-col bg-card text-foreground",children:[jsxs("div",{className:"flex flex-1 min-h-0",children:[jsxs("div",{className:"flex-[7] flex flex-col items-center justify-center bg-black p-6 min-w-0",children:[jsx(u8,{slide:w,templateElements:r,canvasSize:n}),jsx("div",{className:"mt-3 text-xs font-mono tabular-nums text-white/50 select-none",children:d("pptx.presenter.slideLabel",{current:e+1,total:t.length,defaultValue:`Slide ${e+1} of ${t.length}`})})]}),jsxs("div",{className:"flex-[3] flex flex-col bg-background border-l border-border min-w-[260px] max-w-[440px]",children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/60",children:[jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:d("pptx.presenter.currentTime")}),jsx("span",{className:"text-lg font-mono tabular-nums text-foreground",children:die(new Date(f))})]}),jsxs("div",{className:"flex flex-col items-end",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:d("pptx.presenter.elapsed")}),jsx("span",{className:"text-lg font-mono tabular-nums text-primary",children:q2(m)})]}),jsxs("div",{className:"flex items-center gap-1",children:[a&&u&&jsx("button",{type:"button",onClick:()=>{c?l?.():a();},className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:d(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),"aria-label":d(c?"pptx.presenter.closeAudienceWindow":"pptx.presenter.openAudienceWindow"),children:c?jsx(LuMonitorOff,{className:"w-5 h-5"}):jsx(LuMonitor,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:s,className:"p-1.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:d("pptx.presenter.endPresentation"),"aria-label":d("pptx.presenter.endPresentation"),children:jsx(LuX,{className:"w-5 h-5"})})]})]}),jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/60",children:[jsxs("button",{type:"button",onClick:()=>i(-1),disabled:e===0,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:d("pptx.presenter.previousSlide"),children:[jsx(LuChevronLeft,{className:"w-4 h-4"}),d("pptx.presenter.prev")]}),jsxs("span",{className:"text-sm font-mono tabular-nums text-foreground",children:[e+1," / ",t.length]}),jsxs("button",{type:"button",onClick:()=>i(1),disabled:e>=t.length-1,className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded bg-muted hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:d("pptx.presenter.nextSlide"),children:[d("pptx.presenter.next"),jsx(LuChevronRight,{className:"w-4 h-4"})]})]}),jsxs("div",{className:"px-4 py-3 border-b border-border/60",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-2",children:d("pptx.presenter.nextSlidePreview")}),C?jsx(u8,{slide:C,templateElements:r,canvasSize:n}):jsx("div",{className:"flex items-center justify-center h-16 rounded border border-border/30 bg-muted/40 text-xs text-muted-foreground italic",children:d("pptx.presenter.endOfPresentation")})]}),jsxs("div",{className:"flex-1 flex flex-col min-h-0 px-4 py-3",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:d("pptx.presenter.speakerNotes")}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",onClick:S,disabled:x<=a8,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:d("pptx.presenter.decreaseFontSize"),"aria-label":d("pptx.presenter.decreaseFontSize"),children:jsx(LuMinus,{className:"w-3.5 h-3.5"})}),jsxs("span",{className:"text-[10px] font-mono tabular-nums text-muted-foreground min-w-[28px] text-center select-none",children:[x,"px"]}),jsx("button",{type:"button",onClick:v,disabled:x>=l8,className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:d("pptx.presenter.increaseFontSize"),"aria-label":d("pptx.presenter.increaseFontSize"),children:jsx(LuPlus,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"flex-1 overflow-y-auto rounded border border-border/30 bg-muted/40 px-3 py-2 text-foreground whitespace-pre-wrap leading-relaxed",style:{fontSize:`${x}px`},children:M?uie(E):T.trim().length>0?T:jsx("span",{className:"italic text-muted-foreground",children:d("pptx.presenter.noNotes")})})]})]})]}),jsx("div",{className:"h-1.5 w-full bg-muted/60 flex-shrink-0",role:"progressbar","aria-valuenow":Math.round(R),"aria-valuemin":0,"aria-valuemax":100,"aria-label":d("pptx.presenter.timerProgress"),title:`${q2(m)} (segment ${k+1})`,children:jsx("div",{className:"h-full bg-primary transition-[width] duration-1000 ease-linear",style:{width:`${R}%`}})})]})}function mie(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function m8({presentationStartTime:t,slideStartTime:e,paused:n,onTogglePause:r}){let{t:o}=useTranslation(),[i,s]=useState(0);useEffect(()=>{if(n)return;let d=window.setInterval(()=>s(u=>u+1),250);return ()=>window.clearInterval(d)},[n]);let a=Date.now(),l=e!==null?a-e:0,c=t!==null?a-t:0;return jsxs("div",{className:"fixed bottom-4 left-4 z-[9999] flex items-center gap-3 rounded-lg bg-black/80 px-4 py-2 text-white shadow-xl backdrop-blur-sm select-none",children:[jsxs("div",{className:"flex flex-col text-xs leading-tight",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.rehearse.slideTime")}),jsx("span",{className:"text-lg font-mono tabular-nums",children:mie(l)})]}),jsx("div",{className:"w-px h-8 bg-border"}),jsxs("div",{className:"flex flex-col text-xs leading-tight",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.rehearse.totalTime")}),jsx("span",{className:"text-lg font-mono tabular-nums",children:mie(c)})]}),jsx("button",{type:"button",onClick:r,className:"ml-1 rounded p-1.5 hover:bg-white/20 transition-colors",title:o(n?"pptx.rehearse.resume":"pptx.rehearse.pause"),"aria-label":o(n?"pptx.rehearse.resume":"pptx.rehearse.pause"),children:n?jsx(LuPlay,{className:"w-4 h-4"}):jsx(LuPause,{className:"w-4 h-4"})})]})}function gie(t){let e=Math.max(0,Math.floor(t/1e3)),n=Math.floor(e/60),r=e%60;return `${String(n)}:${String(r).padStart(2,"0")}`}function g8({slides:t,canvasSize:e,recordedTimings:n,onSave:r,onDiscard:o}){let{t:i}=useTranslation(),s=Object.values(n).reduce((l,c)=>l+c,0),a=Object.entries(n).map(([l,c])=>({slideIndex:Number(l),ms:c})).sort((l,c)=>l.slideIndex-c.slideIndex);return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",children:jsxs("div",{className:"w-full max-w-lg rounded-xl border border-border bg-background shadow-2xl",children:[jsxs("div",{className:"border-b border-border px-5 py-4",children:[jsx("h2",{className:"text-base font-semibold text-foreground",children:i("pptx.rehearse.summaryTitle")}),jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[i("pptx.rehearse.totalPresentationTime"),":"," ",jsx("span",{className:"font-mono text-foreground",children:gie(s)})]})]}),jsx("div",{className:"max-h-72 overflow-y-auto px-5 py-3",children:jsxs("table",{className:"w-full text-xs",children:[jsx("thead",{children:jsxs("tr",{className:"text-muted-foreground uppercase tracking-wide",children:[jsx("th",{className:"pb-2 text-left",children:"#"}),jsx("th",{className:"pb-2 text-left",children:i("pptx.rehearse.slide")}),jsx("th",{className:"pb-2 text-right",children:i("pptx.rehearse.time")})]})}),jsx("tbody",{children:a.map(({slideIndex:l,ms:c})=>{let d=t[l];return jsxs("tr",{className:"border-t border-border",children:[jsx("td",{className:"py-2 text-muted-foreground tabular-nums",children:l+1}),jsx("td",{className:"py-2",children:d&&jsx("div",{className:"w-20 rounded overflow-hidden bg-white",children:jsx(Qa,{slide:d,templateElements:[],canvasSize:e})})}),jsx("td",{className:"py-2 text-right font-mono text-foreground tabular-nums",children:gie(c)})]},l)})})]})}),jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-border px-5 py-3",children:[jsx("button",{type:"button",onClick:o,className:"rounded-lg px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",children:i("pptx.rehearse.discard")}),jsx("button",{type:"button",onClick:r,className:"rounded-lg bg-primary px-4 py-2 text-sm text-white hover:bg-primary/80 transition-colors",children:i("pptx.rehearse.saveTimings")})]})]})})}function BVe(t,e){return ot(t)&&t.text&&t.text.trim().length>0?t.text.trim().slice(0,32):`${{text:"Text Box",shape:"Shape",connector:"Connector",image:"Image",picture:"Picture",chart:"Chart",table:"Table",smartArt:"SmartArt",media:"Media",group:"Group",ink:"Ink",ole:"Object",unknown:"Object"}[t.type]??"Object"} ${e+1}`}function y8({slides:t,activeSlideIndex:e,selectedElementId:n,selectedElementIds:r,canEdit:o,setSelectedElementId:i,setSelectedElementIds:s,setSlides:a,markDirty:l,onClose:c}){let{t:d}=useTranslation(),p=t[e]?.elements??[],[f,h]=useState(null),[m,x]=useState(""),y=useRef(null),[v,S]=useState(null),[w,C]=useState(null),T=useCallback(B=>{i(B),s([B]);},[i,s]),E=useCallback(B=>{a(D=>{let O=[...D],U=O[e];if(!U)return D;let H=[...U.elements??[]],j=H.findIndex(Z=>Z.id===B);return j===-1?D:(H[j]={...H[j],hidden:!H[j].hidden},O[e]={...U,elements:H},O)}),l();},[e,a,l]),M=useCallback((B,D)=>{o&&(h(B.id),x(D),setTimeout(()=>y.current?.select(),0));},[o]),A=useCallback(()=>{h(null);},[]),R=useCallback(B=>{S(B);},[]),k=useCallback((B,D)=>{B.preventDefault(),v!==null&&v!==D&&C(D);},[v]),N=useCallback(B=>{if(v===null||v===B){S(null),C(null);return}a(D=>{let O=[...D],U=O[e];if(!U)return D;let H=[...U.elements??[]],[j]=H.splice(v,1);return H.splice(B,0,j),O[e]={...U,elements:H},O}),l(),S(null),C(null);},[v,e,a,l]),F=[...p].reverse();return jsxs("div",{className:"flex flex-col h-full bg-popover border-l border-border w-56",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[jsx("span",{className:"text-xs font-medium text-foreground",children:d("pptx.selectionPane.title")}),jsx("button",{type:"button",onClick:c,className:"text-muted-foreground hover:text-foreground text-xs",title:d("pptx.selectionPane.close"),children:"\xD7"})]}),jsx("div",{className:"flex-1 overflow-y-auto py-1",children:F.length===0?jsx("div",{className:"px-3 py-4 text-xs text-muted-foreground italic",children:d("pptx.selectionPane.empty")}):F.map((B,D)=>{let O=p.length-1-D,U=n===B.id||r.includes(B.id),H=BVe(B,O),j=f===B.id;return jsxs("div",{draggable:o,onDragStart:()=>R(O),onDragOver:Z=>k(Z,O),onDrop:()=>N(O),onDragEnd:()=>{S(null),C(null);},className:le("flex items-center gap-1.5 px-2 py-1 text-xs cursor-pointer transition-colors",U?"bg-primary/30 text-primary":"hover:bg-muted text-foreground",w===O?"border-t-2 border-primary":""),onClick:()=>T(B.id),onDoubleClick:()=>M(B,H),children:[o&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground flex-shrink-0 cursor-grab"}),jsx("span",{className:"flex-1 truncate",children:j?jsx("input",{ref:y,type:"text",value:m,onChange:Z=>x(Z.target.value),onBlur:A,onKeyDown:Z=>{Z.key==="Enter"&&A(),Z.key==="Escape"&&h(null);},className:"w-full bg-muted text-xs px-1 py-0.5 rounded border border-border outline-none",onClick:Z=>Z.stopPropagation()}):H}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground flex-shrink-0",title:B.hidden?d("pptx.selectionPane.show"):d("pptx.selectionPane.hide"),onClick:Z=>{Z.stopPropagation(),E(B.id);},children:B.hidden?jsx(LuEyeOff,{className:"w-3.5 h-3.5"}):jsx(LuEye,{className:"w-3.5 h-3.5 opacity-50"})})]},B.id)})})]})}var Sie="inline-flex items-center justify-center px-2.5 py-1.5 max-md:min-h-[44px] max-md:min-w-[44px] active:scale-95 active:opacity-80",Po=`${Sie} border-r border-border hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Js=`${Sie} hover:bg-accent disabled:opacity-40 disabled:cursor-not-allowed`,Ji="inline-flex items-center rounded bg-muted text-xs overflow-hidden",ft="inline-flex items-center gap-1.5 px-2.5 py-1.5 max-md:min-h-[44px] rounded bg-muted hover:bg-accent text-xs transition-colors active:scale-95 active:opacity-80",Un=jsx("div",{className:"w-px self-stretch bg-border/40 mx-1 max-md:hidden"}),Qe="w-4 h-4",lr="w-3.5 h-3.5";var wie=[{k:"left",el:jsx(LuAlignLeft,{className:Qe})},{k:"center",el:jsx(LuAlignCenter,{className:Qe})},{k:"right",el:jsx(LuAlignRight,{className:Qe})},{k:"top",el:jsx(LuChevronUp,{className:Qe})},{k:"middle",el:jsx(LuAlignCenter,{className:`${Qe} rotate-90`})},{k:"bottom",el:jsx(LuChevronDown,{className:Qe})}],Cie=[{id:"select",icon:jsx(LuMoveRight,{className:Qe}),t:"Select",ac:"bg-primary text-white"},{id:"pen",icon:jsx(LuPencil,{className:Qe}),t:"Pen",ac:"bg-primary text-white"},{id:"highlighter",icon:jsx(LuType,{className:Qe}),t:"Highlighter",ac:"bg-yellow-600 text-white"},{id:"eraser",icon:jsx(LuMinus,{className:Qe}),t:"Eraser",ac:"bg-red-600 text-white"},{id:"freeform",icon:jsx(LuSpline,{className:Qe}),t:"Freeform",ac:"bg-primary text-white"}],Tie=[{k:"png",l:"Export as PNG",i:jsx(LuDownload,{className:`${lr} text-muted-foreground`})},{k:"pdf",l:"Export as PDF",i:jsx(LuFileText,{className:`${lr} text-muted-foreground`})},{k:"video",l:"Export as Video",i:jsx(LuVideo,{className:`${lr} text-muted-foreground`})},{k:"gif",l:"Export as GIF",i:jsx(LuImage,{className:`${lr} text-muted-foreground`})},{k:"package",l:"Package for Sharing",i:jsx(LuFolderOpen,{className:`${lr} text-muted-foreground`})},{k:"pptx",l:"Save as Presentation (.pptx)",i:jsx(LuDownload,{className:`${lr} text-muted-foreground`})},{k:"ppsx",l:"Save as Slide Show (.ppsx)",i:jsx(LuPlay,{className:`${lr} text-muted-foreground`})},{k:"pptm",l:"Save as Macro-Enabled (.pptm)",i:jsx(LuDatabase,{className:`${lr} text-muted-foreground`})},{k:"---0",l:"",i:null},{k:"print",l:"Print",i:jsx(LuPrinter,{className:`${lr} text-muted-foreground`})},{k:"copyImg",l:"Copy Slide as Image",i:jsx(LuCopy,{className:`${lr} text-muted-foreground`})},{k:"---",l:"",i:null},{k:"a11y",l:"Accessibility Check",i:jsx(LuCheck,{className:`${lr} text-muted-foreground`})},{k:"shortcuts",l:"Keyboard Shortcuts",i:jsx(LuSearch,{className:`${lr} text-muted-foreground`})},{k:"---2",l:"",i:null},{k:"versionHistory",l:"Version History",i:jsx(LuClock,{className:`${lr} text-muted-foreground`})},{k:"---3",l:"",i:null},{k:"documentProperties",l:"Document Properties\u2026",i:jsx(LuInfo,{className:`${lr} text-muted-foreground`})},{k:"passwordProtection",l:"Protect Presentation",i:jsx(LuLock,{className:`${lr} text-muted-foreground`})},{k:"fontEmbedding",l:"Embed Fonts",i:jsx(LuType,{className:`${lr} text-muted-foreground`})},{k:"digitalSignatures",l:"Digital Signatures\u2026",i:jsx(LuShieldAlert,{className:`${lr} text-muted-foreground`})}],Mie=[{i:jsx(LuBold,{className:Qe}),t:"Bold"},{i:jsx(LuItalic,{className:Qe}),t:"Italic"},{i:jsx(LuUnderline,{className:Qe}),t:"Underline"},{i:jsx(LuStrikethrough,{className:Qe}),t:"Strikethrough"}],_ie=[{i:jsx(LuAlignLeft,{className:Qe}),t:"Align left"},{i:jsx(LuAlignCenter,{className:Qe}),t:"Align center"},{i:jsx(LuAlignRight,{className:Qe}),t:"Align right"},{i:jsx(LuAlignJustify,{className:Qe}),t:"Justify"}];var x9e=[{group:"Entrance",items:[{value:"appear",label:"Appear"},{value:"fadeIn",label:"Fade In"},{value:"flyIn",label:"Fly In"}]},{group:"Emphasis",items:[{value:"pulse",label:"Pulse"},{value:"spin",label:"Spin"}]},{group:"Exit",items:[{value:"disappear",label:"Disappear"},{value:"fadeOut",label:"Fade Out"}]}];function kI(t){let{t:e}=useTranslation(),[n,r]=useState(false),o=t.selectedElement!==null,i=!t.canEdit||!o;return jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:()=>{i||(r(true),setTimeout(()=>r(false),1200));},disabled:i,className:le(ft,n?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.previewTooltip"),children:[jsx(LuPlay,{className:Qe}),e("pptx.animations.preview")]}),Un,jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:i,className:ft,title:e("pptx.animations.addTooltip"),children:[jsx(LuSparkles,{className:Qe}),e("pptx.animations.addAnimation"),jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-44 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:x9e.map(a=>jsxs(Vn__default.Fragment,{children:[jsx("div",{className:"px-3 pt-1.5 pb-0.5 text-[10px] font-semibold text-muted-foreground uppercase tracking-wider",children:e(`pptx.animations.group.${a.group.toLowerCase()}`)}),a.items.map(l=>jsx("button",{type:"button",disabled:i,onClick:()=>t.onAddAnimation?.(l.value,a.group.toLowerCase()),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:e("pptx.animations.applyAnimation",{name:e(`pptx.animations.preset.${l.value}`)}),children:e(`pptx.animations.preset.${l.value}`)},l.value))]},a.group))})})]}),Un,jsxs("button",{type:"button",disabled:i,onClick:t.onRemoveAnimation,className:ft,title:e("pptx.animations.removeTooltip"),children:[jsx(LuTrash2,{className:Qe}),e("pptx.animations.remove")]}),Un,jsxs("button",{type:"button",onClick:t.onOpenAnimationPanel??t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:e("pptx.animations.openPanelTooltip"),children:[jsx(LuPanelRight,{className:Qe}),e("pptx.animations.animationPanel")]})]})}function II(t){let{t:e}=useTranslation(),n=!!t.selectedElement,r=n&&t.canEdit;return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:wie.map((o,i,s)=>jsx("button",{type:"button",onClick:()=>t.onAlignElements(o.k),disabled:!r,className:i<s.length-1?Po:Js,title:e("pptx.arrange.align",{direction:o.k}),children:o.el},o.k))}),jsxs("div",{className:Ji,children:[jsx("button",{onClick:t.onCopy,disabled:!n,className:Po,title:e("pptx.arrange.copy"),children:jsx(LuCopy,{className:Qe})}),jsx("button",{onClick:t.onCut,disabled:!r,className:Po,title:e("pptx.arrange.cut"),children:e("pptx.arrange.cut")}),jsx("button",{onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Js,title:e("pptx.arrange.paste"),children:jsx(LuClipboardPaste,{className:Qe})})]}),t.onToggleFormatPainter&&jsxs("button",{type:"button",onClick:t.onToggleFormatPainter,disabled:!t.canEdit||t.canActivateFormatPainter===false&&!t.formatPainterActive,"data-testid":"format-painter-toggle",className:le(ft,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:e("pptx.arrange.formatPainter"),children:[jsx(LuPaintbrush,{className:Qe}),e("pptx.arrange.format")]}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",onClick:()=>t.onFlip("horizontal"),disabled:!r,className:Po,title:e("pptx.arrange.flipHorizontally"),children:e("pptx.arrange.flipH")}),jsx("button",{type:"button",onClick:()=>t.onFlip("vertical"),disabled:!r,className:Js,title:e("pptx.arrange.flipVertically"),children:e("pptx.arrange.flipV")})]}),jsxs("div",{className:Ji,children:[jsx("button",{onClick:()=>t.onMoveLayer("backward"),disabled:!r,className:Po,title:e("pptx.arrange.sendBackward"),children:jsx(LuChevronDown,{className:Qe})}),jsx("button",{onClick:()=>t.onMoveLayer("forward"),disabled:!r,className:Po,title:e("pptx.arrange.bringForward"),children:jsx(LuChevronUp,{className:Qe})}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("back"),disabled:!r,className:Po,title:e("pptx.arrange.sendToBack"),children:e("pptx.arrange.back")}),jsx("button",{onClick:()=>t.onMoveLayerToEdge("front"),disabled:!r,className:Js,title:e("pptx.arrange.bringToFront"),children:e("pptx.arrange.front")})]}),jsxs("button",{onClick:t.onDuplicate,disabled:!r,className:ft,title:e("pptx.arrange.duplicate"),children:[jsx(LuCopy,{className:Qe}),e("pptx.arrange.duplicate")]}),jsxs("button",{onClick:t.onDelete,disabled:!r,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 rounded bg-red-700/80 hover:bg-red-600 disabled:opacity-40 disabled:cursor-not-allowed text-xs transition-colors",title:e("pptx.arrange.delete"),children:[jsx(LuTrash2,{className:Qe}),e("pptx.arrange.delete")]})]})}function NI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onToggleThemeGallery,disabled:!t.canEdit,className:le(ft,t.isThemeGalleryOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Browse and apply built-in themes",children:[jsx(LuPalette,{className:lr}),"Browse Themes"]}),jsxs("button",{onClick:t.onToggleThemeEditor,disabled:!t.canEdit,className:le(ft,t.isThemeEditorOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Edit presentation theme colors and fonts",children:[jsx(LuPencil,{className:lr}),"Edit Theme"]}),Un,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:ft,title:"Change slide dimensions (16:9, 4:3, custom)",children:[jsx(LuMonitor,{className:lr}),"Slide Size"]}),t.onToggleInspector&&jsxs("button",{onClick:t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open inspector to edit slide background",children:[jsx(LuPaintBucket,{className:lr}),"Format Background"]})]})}var F9e=[{value:"none",label:"None"},{value:"fade",label:"Fade"},{value:"push",label:"Push"},{value:"wipe",label:"Wipe"},{value:"split",label:"Split"},{value:"reveal",label:"Reveal"},{value:"cut",label:"Cut"},{value:"cover",label:"Cover"},{value:"uncover",label:"Uncover"}];function DI(t){let[e,n]=Vn__default.useState("none"),[r,o]=Vn__default.useState("00.50");return jsxs(Fragment,{children:[jsxs("button",{type:"button",className:ft,title:"Preview transition",children:[jsx(LuPlay,{className:lr}),"Preview"]}),Un,jsx("div",{className:"inline-flex items-center gap-0.5 overflow-x-auto max-w-[420px]",children:F9e.map(i=>jsx("button",{type:"button",onClick:()=>n(i.value),className:le("flex-shrink-0 px-2 py-1 max-md:min-h-[44px] rounded border text-[11px] leading-tight transition-colors",e===i.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted hover:bg-accent text-foreground"),title:`${i.label} transition`,children:i.label},i.value))}),Un,jsxs("label",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[jsx("span",{className:"whitespace-nowrap",children:"Duration:"}),jsx("input",{type:"text",value:r,onChange:i=>o(i.target.value),className:"w-14 px-1.5 py-1 rounded border border-border bg-muted text-xs text-foreground text-center",title:"Transition duration in seconds"})]}),Un,jsxs("button",{type:"button",className:ft,title:"Apply transition to all slides",children:[jsx(LuCopy,{className:lr}),"Apply to All"]}),Un,jsxs("button",{type:"button",onClick:t.onToggleInspector,className:le(ft,t.isInspectorPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Open Inspector for full transition options",children:[jsx(LuPanelRight,{className:Qe}),"Inspector"]})]})}function LI(t){return jsxs(Fragment,{children:[t.onToggleComments&&jsxs("button",{onClick:t.onToggleComments,className:le(ft,t.isCommentsPanelOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle comments panel",children:[jsx(LuMessageSquare,{className:Qe}),"Comments",(t.slideCommentCount??0)>0&&jsx("span",{className:"inline-flex items-center justify-center min-w-[16px] h-4 rounded-full bg-amber-500 text-[10px] font-medium text-white px-1",children:t.slideCommentCount})]}),jsxs("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:le(ft,t.spellCheckEnabled?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle spell check",children:[jsx(LuSpellCheck,{className:Qe}),"Spelling"]}),t.onCompare&&jsxs("button",{onClick:t.onCompare,disabled:!t.canEdit,className:ft,title:"Compare with another presentation",children:[jsx(LuGitCompare,{className:Qe}),"Compare"]})]})}function BI(t){return jsxs(Fragment,{children:[jsx("div",{className:Ji,children:Cie.map((e,n,r)=>jsx("button",{type:"button",onClick:()=>t.onSetActiveTool(e.id),className:le(n<r.length-1?Po:Js,t.activeTool===e.id?e.ac??"bg-accent text-foreground":""),title:e.t,children:e.icon},e.id))}),jsxs("div",{className:"inline-flex items-center gap-2 text-xs",children:[jsxs("label",{className:"inline-flex items-center gap-1 text-muted-foreground",title:"Pen colour",children:["Colour",jsx("input",{type:"color",value:t.drawingColor,onChange:e=>t.onSetDrawingColor(e.target.value),className:"w-6 h-6 rounded border border-border bg-transparent cursor-pointer"})]}),jsxs("label",{className:"inline-flex items-center gap-1 text-muted-foreground",title:"Stroke width",children:["Width",jsx("input",{type:"range",min:1,max:12,value:t.drawingWidth,onChange:e=>t.onSetDrawingWidth(Number(e.target.value)),className:"w-16 h-1 accent-primary"}),jsx("span",{className:"text-foreground w-4 text-right",children:t.drawingWidth})]})]})]})}function OI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:t.onSaveAsPptx,className:ft,title:"Save as Presentation (.pptx)",children:[jsx(LuDownload,{className:Qe}),"Save .pptx"]}),jsxs("button",{onClick:t.onSaveAsPpsx,className:ft,title:"Save as Slide Show (.ppsx)",children:[jsx(LuPlay,{className:Qe}),"Save .ppsx"]}),t.hasMacros&&jsxs("button",{onClick:t.onSaveAsPptm,className:ft,title:"Save as Macro-Enabled (.pptm)",children:[jsx(LuFileText,{className:Qe}),"Save .pptm"]}),jsxs("button",{onClick:t.onPackageForSharing,className:ft,title:"Package for Sharing",children:[jsx(LuFolderOpen,{className:Qe}),"Package"]}),Un,jsxs("button",{onClick:t.onExportPng,className:ft,title:"Export as PNG",children:[jsx(LuDownload,{className:Qe}),"PNG"]}),jsxs("button",{onClick:t.onExportPdf,className:ft,title:"Export as PDF",children:[jsx(LuFileText,{className:Qe}),"PDF"]}),jsxs("button",{onClick:t.onExportVideo,className:ft,title:"Export as Video",children:[jsx(LuVideo,{className:Qe}),"Video"]}),jsxs("button",{onClick:t.onExportGif,className:ft,title:"Export as GIF",children:[jsx(LuImage,{className:Qe}),"GIF"]}),jsxs("button",{onClick:t.onCopySlideAsImage,className:ft,title:"Copy Slide as Image",children:[jsx(LuCopy,{className:Qe}),"Copy Image"]}),Un,jsxs("button",{onClick:t.onPrint,className:ft,title:"Print",children:[jsx(LuPrinter,{className:Qe}),"Print"]}),Un,t.onOpenDocumentProperties&&jsxs("button",{onClick:t.onOpenDocumentProperties,className:ft,title:"Document Properties",children:[jsx(LuInfo,{className:Qe}),"Properties"]}),t.onOpenPasswordProtection&&jsxs("button",{onClick:t.onOpenPasswordProtection,className:ft,title:"Protect Presentation",children:[jsx(LuLock,{className:Qe}),"Protect"]}),t.onOpenFontEmbedding&&jsxs("button",{onClick:t.onOpenFontEmbedding,className:ft,title:"Embed Fonts",children:[jsx(LuType,{className:Qe}),"Fonts"]}),t.onOpenDigitalSignatures&&jsxs("button",{onClick:t.onOpenDigitalSignatures,className:ft,title:"Digital Signatures",children:[jsx(LuShieldAlert,{className:Qe}),"Signatures"]})]})}function tje(t){let e={fontFamily:"Segoe UI",fontSize:"24"};if(!t||!ot(t))return e;let n=t.textSegments?.[0]?.style,r=t.textStyle,o=n?.fontFamily??r?.fontFamily??e.fontFamily,i=n?.fontSize??r?.fontSize;return {fontFamily:o,fontSize:i!=null?String(i):e.fontSize}}var nje=["Arial","Calibri","Cambria","Comic Sans MS","Courier New","Georgia","Helvetica","Impact","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Verdana"],rje=[8,9,10,11,12,14,16,18,20,24,28,32,36,40,44,48,54,60,72,96];function UI(t){let[e,n]=useState(false),[r,o]=useState(false),[i,s]=useState(false),[a,l]=useState(false),[c,d]=useState(false),u=useRef(null),p=useRef(null),f=useRef(null),{fontFamily:h,fontSize:m}=tje(t.selectedElement),x=useCallback(()=>{if(t.layoutOptions.length>0){let y=t.layoutOptions[0];t.onInsertSlideFromLayout(y.path,y.name);}},[t]);return useEffect(()=>{if(!e)return;let y=v=>{u.current&&!u.current.contains(v.target)&&n(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[e]),useEffect(()=>{if(!r)return;let y=v=>{p.current&&!p.current.contains(v.target)&&o(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[r]),useEffect(()=>{if(!i)return;let y=v=>{f.current&&!f.current.contains(v.target)&&s(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:Ji,children:[jsx("button",{type:"button",onClick:t.onPaste,disabled:!t.clipboardPayload||!t.canEdit,className:Po,title:"Paste",children:jsx(LuClipboardPaste,{className:Qe})}),jsx("button",{type:"button",onClick:()=>{t.onCut(),d(true),setTimeout(()=>d(false),600);},disabled:!t.canEdit,className:le(Po,c&&"bg-green-600/20 text-green-400"),title:"Cut",children:jsx(LuScissors,{className:Qe})}),jsx("button",{type:"button",onClick:()=>{t.onCopy(),l(true),setTimeout(()=>l(false),600);},className:le(Po,a&&"bg-green-600/20 text-green-400"),title:"Copy",children:jsx(LuCopy,{className:Qe})}),t.onToggleFormatPainter&&jsx("button",{type:"button",onClick:t.onToggleFormatPainter,disabled:!t.canEdit||t.canActivateFormatPainter===false&&!t.formatPainterActive,"data-testid":"format-painter-toggle",className:le(Js,t.formatPainterActive?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Format Painter",children:jsx(LuPaintbrush,{className:Qe})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Clipboard"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"relative inline-flex items-center",ref:u,children:[jsxs("button",{type:"button",onClick:x,disabled:!t.canEdit||t.layoutOptions.length===0,className:le(ft,"whitespace-nowrap",t.layoutOptions.length>0?"rounded-r-none":""),title:"New Slide",children:[jsx(LuPlus,{className:Qe}),"New Slide"]}),t.layoutOptions.length>0&&jsx("button",{type:"button",disabled:!t.canEdit,className:"inline-flex items-center justify-center self-stretch px-1 rounded-r bg-muted hover:bg-accent text-xs transition-colors border-l border-border/40 active:scale-95 active:opacity-80",title:"Choose layout",onClick:()=>n(y=>!y),children:jsx(LuChevronDown,{className:"w-3 h-3"})}),e&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:t.layoutOptions.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onInsertSlideFromLayout(y.path,y.name),n(false);},children:y.name},y.path))})})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Slides"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",ref:p,children:[jsxs("button",{type:"button",onClick:()=>o(y=>!y),className:"inline-flex items-center justify-between px-2 py-1 rounded-sm border border-border/60 bg-background/60 text-[11px] text-foreground min-w-[120px] truncate hover:bg-accent/40 transition-colors cursor-pointer",children:[jsx("span",{className:"truncate",children:h}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),r&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:nje.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",style:{fontFamily:y},onClick:()=>{t.onUpdateTextStyle?.({fontFamily:y}),o(false);},children:y},y))})})]}),jsxs("div",{className:"relative",ref:f,children:[jsxs("button",{type:"button",onClick:()=>s(y=>!y),className:"inline-flex items-center justify-between px-2 py-1 rounded-sm border border-border/60 bg-background/60 text-[11px] text-foreground min-w-[50px] text-center hover:bg-accent/40 transition-colors cursor-pointer",children:[jsx("span",{className:"truncate",children:m}),jsx(LuChevronDown,{className:"w-3 h-3 ml-1 shrink-0 text-muted-foreground"})]}),i&&jsx("div",{className:"absolute left-0 top-full z-50 flex flex-col w-48 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1 max-h-60 overflow-y-auto",children:rje.map(y=>jsx("button",{type:"button",className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>{t.onUpdateTextStyle?.({fontSize:y}),s(false);},children:y},y))})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),Un]})}function $I(t){let{t:e}=useTranslation(),{canEdit:n}=t,[r,o]=useState(false),[i,s]=useState(""),[a,l]=useState("locale"),c=useRef(null),d=useCallback(()=>{let p=new Date,f=h=>String(h).padStart(2,"0");s(`${p.getFullYear()}-${f(p.getMonth()+1)}-${f(p.getDate())}T${f(p.getHours())}:${f(p.getMinutes())}`),l("locale"),o(true);},[]),u=useCallback(()=>{if(!t.onInsertField)return;let p=new Date(i);if(isNaN(p.getTime()))return;let f;switch(a){case "iso":f=p.toISOString().slice(0,10);break;case "long":f=p.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"});break;case "short":f=p.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"});break;case "time":f=p.toLocaleString();break;default:f=p.toLocaleDateString();break}t.onInsertField("datetime",f),o(false);},[i,a,t]);return useEffect(()=>{if(!r)return;let p=f=>{c.current&&!c.current.contains(f.target)&&o(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[r]),jsxs(Fragment,{children:[jsxs("button",{onClick:t.onAddTextBox,disabled:!n,className:ft,title:"Add text box",children:[jsx(LuType,{className:Qe}),"Text"]}),jsxs("div",{className:Ji,children:[jsx("select",{value:t.newShapeType,onChange:p=>t.onSetNewShapeType(p.target.value),className:"bg-transparent py-1.5 pl-2 pr-1 outline-none text-xs",title:"Shape type",children:m1.map(p=>jsx("option",{value:p.type,className:"bg-background",children:p.label},p.type))}),jsxs("button",{onClick:t.onAddShape,disabled:!n,className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 border-l border-border hover:bg-accent transition-colors text-xs",title:"Add shape",children:[m1.find(p=>p.type===t.newShapeType)?.icon||jsx(LuSquare,{className:Qe}),"Shape"]})]}),jsxs("button",{onClick:t.onOpenImagePicker,disabled:!n,className:ft,title:"Insert image",children:[jsx(LuImage,{className:Qe}),"Image"]}),jsxs("button",{onClick:t.onOpenMediaPicker,disabled:!n,className:ft,title:"Insert audio or video",children:[jsx(LuVideo,{className:Qe}),"Media"]}),jsxs("button",{onClick:t.onAddTable,disabled:!n,className:ft,title:"Insert table",children:[jsx(LuDatabase,{className:Qe}),"Table"]}),jsxs("button",{onClick:t.onAddSmartArt,disabled:!n,className:ft,title:"Insert SmartArt",children:[jsx(LuLayers,{className:Qe}),"SmartArt"]}),jsxs("button",{onClick:t.onAddEquation,disabled:!n,className:ft,title:"Insert Equation",children:[jsx("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M4 17h6M7 14v6M14 7l4.5 10M15.5 14h5"})}),"Equation"]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:ft,title:"Insert action button",children:[jsxs("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M13 7l4 5-4 5"})]}),"Action",jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-40 pt-1",children:jsx("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:Lm.map(p=>jsxs("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onAddActionButton(p.shapeType),children:[jsx("svg",{className:"w-4 h-4 flex-shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:p.iconPath})}),p.label]},p.shapeType))})})]}),t.onInsertField&&jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,className:ft,title:e("pptx.field.insertField"),children:[jsxs("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M4 7h16M4 12h10M4 17h12"}),jsx("circle",{cx:"19",cy:"15",r:"3"})]}),e("pptx.field.field"),jsx(LuChevronDown,{className:"w-3 h-3"})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:flex flex-col w-44 pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:[jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("slidenum"),children:e("pptx.field.slideNumber")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:d,children:e("pptx.field.dateTime")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("header"),children:e("pptx.field.header")}),jsx("button",{type:"button",disabled:!n,className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",onClick:()=>t.onInsertField("footer"),children:e("pptx.field.footer")})]})})]}),r&&jsx("div",{ref:c,className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/30",onMouseDown:p=>{p.target===p.currentTarget&&o(false);},children:jsxs("div",{className:"rounded-lg border border-border bg-popover shadow-2xl p-4 w-72 space-y-3",children:[jsx("div",{className:"text-sm font-medium text-foreground",children:e("pptx.field.dateTime")}),jsx("input",{type:"datetime-local",className:"w-full rounded border border-border bg-muted px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:i,onChange:p=>s(p.target.value)}),jsxs("div",{children:[jsx("label",{className:"block text-[11px] text-muted-foreground mb-1",children:e("pptx.field.format","Format")}),jsxs("select",{className:"w-full rounded border border-border bg-muted px-2.5 py-1.5 text-xs text-foreground focus:border-primary focus:ring-1 focus:ring-primary outline-none",value:a,onChange:p=>l(p.target.value),children:[jsx("option",{value:"locale",children:new Date(i||Date.now()).toLocaleDateString()}),jsx("option",{value:"long",children:new Date(i||Date.now()).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})}),jsx("option",{value:"short",children:new Date(i||Date.now()).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}),jsx("option",{value:"iso",children:new Date(i||Date.now()).toISOString().slice(0,10)}),jsx("option",{value:"time",children:new Date(i||Date.now()).toLocaleString()})]})]}),jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded border border-border text-foreground hover:bg-muted transition-colors",onClick:()=>o(false),children:e("pptx.common.cancel","Cancel")}),jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded bg-primary text-white hover:bg-primary/90 transition-colors",onClick:u,children:e("pptx.common.insert","Insert")})]})]})})]})}function HI(t){return jsxs(Fragment,{children:[jsxs("button",{onClick:()=>t.onSetMode("present"),className:ft,title:"Start slide show from beginning",children:[jsx(LuPlay,{className:Qe}),"From Beginning"]}),jsxs("button",{onClick:t.onPresent,className:ft,title:"Start slide show from current slide",children:[jsx(LuPlay,{className:Qe}),"From Current Slide"]}),Un,jsxs("button",{onClick:t.onEnterPresenterView,className:ft,title:"Presenter view",children:[jsx(LuMonitor,{className:Qe}),"Presenter View"]}),jsxs("button",{onClick:t.onEnterRehearsalMode,className:ft,title:"Rehearse timings",children:[jsx(LuClock,{className:Qe}),"Rehearse Timings"]}),Un,jsxs("button",{onClick:t.onOpenSetUpSlideShow,className:ft,title:"Set up slide show",children:[jsx(LuSettings,{className:Qe}),"Set Up Slide Show"]}),jsxs("button",{onClick:t.onOpenBroadcastDialog,className:ft,title:"Broadcast slide show",children:[jsx(LuCast,{className:Qe}),"Broadcast"]}),Un,jsxs("button",{onClick:t.onToggleSubtitles,className:le(ft,t.showSubtitles?"bg-primary hover:bg-primary/80 text-white":""),title:"Toggle subtitles",children:[jsx(LuCaptions,{className:Qe}),"Subtitles"]})]})}function Pje(t,e){if(t){if(ot(t))return t.textStyle;if(t.type==="table"&&e&&t.tableData)return t.tableData.rows[e.rowIndex]?.cells[e.columnIndex]?.style}}var Rje=["#000000","#ffffff","#ff0000","#00aa00","#0000ff","#ff8800","#8800cc","#00cccc","#ff69b4","#808080"],kje=["#ffff00","#00ff00","#00ffff","#ff00ff","#0000ff","#ff0000","#000080","#008080","#008000","#800080"];function zI(t){let e=!!t.selectedElement,n=e&&t.canEdit,r=e&&t.selectedElement!==null&&ot(t.selectedElement),o=e&&t.selectedElement?.type==="table",i=r||o,s=Pje(t.selectedElement,t.tableEditorState),a=r&&t.selectedElement&&ot(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.color??t.selectedElement.textStyle?.color??"#000000":s?.color??"#000000",l=r&&t.selectedElement&&ot(t.selectedElement)?t.selectedElement.textSegments?.[0]?.style?.highlightColor??t.selectedElement.textStyle?.highlightColor??"#ffff00":"#ffff00",c=useRef(null),d=useRef(null),u=useCallback(f=>{i&&t.onUpdateTextStyle({color:f});},[i,t]),p=useCallback(f=>{i&&t.onUpdateTextStyle({highlightColor:f});},[i,t]);return jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsx("div",{className:Ji,children:Mie.map((f,h,m)=>jsx("button",{type:"button",disabled:!n,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let y=s;switch(f.t){case "Bold":t.onUpdateTextStyle({bold:!y?.bold});break;case "Italic":t.onUpdateTextStyle({italic:!y?.italic});break;case "Underline":t.onUpdateTextStyle({underline:!y?.underline});break;case "Strikethrough":t.onUpdateTextStyle({strikethrough:!y?.strikethrough});break}},className:h<m.length-1?Po:Js,title:f.t,children:f.i},f.t))}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.fontSize??18;t.onUpdateTextStyle({fontSize:f+2});},className:Po,title:"Increase Font Size",children:jsx(LuAArrowUp,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.fontSize??18;t.onUpdateTextStyle({fontSize:Math.max(1,f-2)});},className:Po,title:"Decrease Font Size",children:jsx(LuAArrowDown,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{i&&t.onUpdateTextStyle({bold:false,italic:false,underline:false,strikethrough:false,highlightColor:void 0});},className:Js,title:"Clear Formatting",children:jsx(LuRemoveFormatting,{className:Qe})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),className:ft,title:"Font Color",children:[jsx("svg",{className:Qe,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M6 20h12M9.5 4h5L18 16H6L9.5 4z"})}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:a}})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 w-36",children:[jsx("div",{className:"grid grid-cols-5 gap-1.5 mb-2",children:Rje.map(f=>jsx("button",{type:"button",className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${a?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:h=>h.preventDefault(),onClick:()=>u(f)},f))}),jsx("button",{type:"button",className:"w-full text-[10px] text-muted-foreground hover:text-foreground py-1 transition-colors",onMouseDown:f=>f.preventDefault(),onClick:()=>c.current?.click(),children:"Custom colour..."}),jsx("input",{ref:c,type:"color",className:"sr-only",value:a,onChange:f=>u(f.target.value)})]})})]}),jsxs("div",{className:"relative group",children:[jsxs("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),className:ft,title:"Text Highlight Color",children:[jsx(LuHighlighter,{className:Qe}),jsx("div",{className:"w-4 h-1 rounded-sm -mt-0.5",style:{backgroundColor:l}})]}),jsx("div",{className:"absolute left-0 top-full z-50 hidden group-hover:block pt-1",children:jsxs("div",{className:"rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl p-2 w-36",children:[jsx("div",{className:"grid grid-cols-5 gap-1.5 mb-2",children:kje.map(f=>jsx("button",{type:"button",className:`w-5 h-5 rounded-full border transition-transform hover:scale-125 ${l?.toLowerCase()===f?"border-primary ring-1 ring-primary":"border-border"}`,style:{backgroundColor:f},onMouseDown:h=>h.preventDefault(),onClick:()=>p(f)},f))}),jsx("button",{type:"button",className:"w-full text-[10px] text-muted-foreground hover:text-foreground py-1 transition-colors",onMouseDown:f=>f.preventDefault(),onClick:()=>d.current?.click(),children:"Custom colour..."}),jsx("input",{ref:d,type:"color",className:"sr-only",value:l,onChange:f=>p(f.target.value)})]})})]})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Font"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{!i||!t.selectedElement||t.onUpdateTextStyle({listType:s?.listType==="bullet"?"none":"bullet"});},className:Po,title:"Bullet List",children:jsx(LuList,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{!i||!t.selectedElement||t.onUpdateTextStyle({listType:s?.listType==="numbered"?"none":"numbered"});},className:Js,title:"Numbered List",children:jsx(LuListOrdered,{className:Qe})})]}),jsxs("div",{className:Ji,children:[jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:Math.max(0,f-24)});},className:Po,title:"Decrease Indent",children:jsx(LuIndentDecrease,{className:Qe})}),jsx("button",{type:"button",disabled:!n,onMouseDown:f=>f.preventDefault(),onClick:()=>{if(!i||!t.selectedElement)return;let f=s?.paragraphMarginLeft??0;t.onUpdateTextStyle({paragraphMarginLeft:f+24});},className:Js,title:"Increase Indent",children:jsx(LuIndentIncrease,{className:Qe})})]}),jsx("div",{className:Ji,children:_ie.map((f,h,m)=>jsx("button",{type:"button",disabled:!n,onMouseDown:y=>y.preventDefault(),onClick:()=>{if(!i)return;let v={"Align left":"left","Align center":"center","Align right":"right",Justify:"justify"}[f.t];v&&t.onUpdateTextStyle({align:v});},className:h<m.length-1?Po:Js,title:f.t,children:f.i},f.t))})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Paragraph"})]})]})}function GI(t){let{t:e}=useTranslation();return jsxs(Fragment,{children:[jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{className:ft,title:"Normal view",children:"Normal"}),t.onToggleSlideSorter?jsx("button",{className:ft,onClick:t.onToggleSlideSorter,title:"Slide Sorter view",children:"Slide Sorter"}):jsx("button",{className:ft,title:"Slide Sorter view",children:"Slide Sorter"}),jsx("button",{className:ft,title:"Reading View",children:"Reading View"})]}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Presentation Views"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("div",{className:"flex items-center gap-0.5",children:jsx("button",{onClick:t.onEnterMasterView,disabled:!t.canEdit,className:ft,title:"Edit slide masters and layouts",children:"Slide Master"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Master Views"})]}),Un,jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("div",{className:"flex items-center gap-0.5",children:t.onZoomToFit&&jsx("button",{className:ft,onClick:t.onZoomToFit,title:"Zoom to fit slide in window",children:"Zoom to Fit"})}),jsx("span",{className:"text-[9px] text-muted-foreground leading-none",children:"Zoom"})]}),Un,jsx("button",{onClick:()=>t.onSetEditTemplateMode(!t.editTemplateMode),disabled:!t.canEdit,className:le(ft,t.editTemplateMode?"bg-amber-600 hover:bg-amber-500 text-amber-50":""),title:"Toggle template/master element editing",children:t.editTemplateMode?"Templates On":"Templates Off"}),t.onToggleSelectionPane&&jsxs("button",{type:"button",onClick:t.onToggleSelectionPane,className:le(ft,t.isSelectionPaneOpen?"bg-primary hover:bg-primary/80 text-white":""),title:"Selection Pane",children:[jsx(LuList,{className:Qe}),"Selection"]}),t.onToggleEyedropper&&jsxs("button",{type:"button",onClick:t.onToggleEyedropper,disabled:!t.canEdit,className:le(ft,t.eyedropperActive?"bg-purple-600 hover:bg-purple-500 text-purple-50":""),title:"Eyedropper \u2014 sample a colour from the slide",children:[jsx(LuPipette,{className:Qe}),"Eyedropper"]}),jsx("button",{onClick:()=>t.onSetShowGrid(!t.showGrid),className:le(ft,t.showGrid?"bg-primary text-white":""),title:e("pptx.grid.toggleGrid"),children:e("pptx.grid.grid")}),jsx("button",{onClick:()=>t.onSetShowRulers(!t.showRulers),className:le(ft,t.showRulers?"bg-primary text-white":""),title:e("pptx.ruler.toggleRulers"),children:e("pptx.ruler.rulers")}),jsx("button",{onClick:()=>t.onSetSnapToGrid(!t.snapToGrid),className:le(ft,t.snapToGrid?"bg-primary text-white":""),title:e("pptx.grid.snapToGrid"),children:e("pptx.grid.snapToGrid")}),jsx("button",{onClick:()=>t.onSetSnapToShape(!t.snapToShape),className:le(ft,t.snapToShape?"bg-primary text-white":""),title:e("pptx.grid.snapToShape"),children:e("pptx.grid.snapToShape")}),jsx("button",{onClick:()=>t.onAddGuide("h"),className:ft,title:"Add horizontal guide",children:"H Guide"}),jsx("button",{onClick:()=>t.onAddGuide("v"),className:ft,title:"Add vertical guide",children:"V Guide"}),jsx("button",{onClick:()=>t.onSetSpellCheckEnabled(!t.spellCheckEnabled),className:le(ft,t.spellCheckEnabled?"bg-primary text-white":""),title:"Toggle spell check",children:"Spell"})]})}function VI({open:t,onClose:e,title:n,children:r,heightFraction:o=.6,fullScreen:i=false,className:s,headerRight:a}){let l=useRef(null),[c,d]=useState(0),u=useRef(null),p=useCallback(x=>{u.current=x.clientY,x.target.setPointerCapture?.(x.pointerId);},[]),f=useCallback(x=>{if(u.current===null)return;let y=x.clientY-u.current;d(Math.max(0,y));},[]),h=useCallback(x=>{if(u.current===null)return;let y=x.clientY-u.current;u.current=null,x.target.releasePointerCapture?.(x.pointerId),y>120&&e(),d(0);},[e]);if(useEffect(()=>{if(!t)return;let x=y=>{y.key==="Escape"&&e();};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[t,e]),!t)return null;let m=i?{height:"calc(100dvh - env(safe-area-inset-top))"}:{height:`${Math.round(o*100)}dvh`};return jsxs("div",{className:"fixed inset-0 z-50 flex flex-col justify-end md:hidden",role:"dialog","aria-modal":"true",children:[jsx("button",{type:"button","aria-label":"Close",className:"absolute inset-0 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150",onClick:e}),jsxs("div",{ref:l,className:le("relative bg-background border-t border-border rounded-t-2xl shadow-2xl flex flex-col overflow-hidden","animate-in slide-in-from-bottom duration-200",s),style:{...m,transform:c>0?`translateY(${c}px)`:void 0,transition:u.current===null?"transform 150ms ease-out":"none"},children:[jsx("div",{className:"flex items-center justify-center pt-2 pb-1 cursor-grab active:cursor-grabbing touch-none",onPointerDown:p,onPointerMove:f,onPointerUp:h,onPointerCancel:h,children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),(n||a)&&jsxs("div",{className:"flex items-center justify-between gap-2 px-4 pb-2 border-b border-border/60",children:[jsx("div",{className:"text-sm font-semibold text-foreground truncate",children:n}),a]}),jsx("div",{className:"flex-1 overflow-y-auto overscroll-contain",children:r})]})]})}var Qje=[{key:"home",label:"Home",icon:LuClipboardCopy},{key:"insert",label:"Insert",icon:LuPlus},{key:"text",label:"Text",icon:LuType},{key:"draw",label:"Draw",icon:LuPaintbrush},{key:"arrange",label:"Arrange",icon:LuShapes},{key:"design",label:"Design",icon:LuLayoutGrid},{key:"transitions",label:"Transitions",icon:LuSparkles},{key:"animations",label:"Animations",icon:LuWand},{key:"slideShow",label:"Slide Show",icon:LuPresentation},{key:"review",label:"Review",icon:LuTextCursorInput},{key:"view",label:"View",icon:LuSettings},{key:"file",label:"File",icon:LuFile}];function Bie(t){let{open:e,onClose:n}=t,[r,o]=useState("home");return jsx(VI,{open:e,onClose:n,fullScreen:true,title:"Menu",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"sticky top-0 z-10 bg-background border-b border-border",children:jsx("div",{className:"flex gap-1.5 overflow-x-auto px-3 py-2 scrollbar-none",children:Qje.map(({key:i,label:s,icon:a})=>jsxs("button",{type:"button",onClick:()=>o(r===i?null:i),className:le("inline-flex items-center gap-1.5 shrink-0 px-3 py-2 rounded-full text-[12px] font-medium border transition-colors min-h-[36px]",r===i?"bg-primary text-white border-primary":"border-border text-muted-foreground hover:text-foreground hover:bg-accent/40"),children:[jsx(a,{className:"w-4 h-4"}),s]},i))})}),jsx("div",{className:"p-3",children:jsx(eXe,{active:r,...t})})]})})}function eXe({active:t,...e}){let n="flex flex-wrap items-center gap-2";switch(t){case "home":return jsx("div",{className:n,children:jsx(UI,{canEdit:e.canEdit,clipboardPayload:e.clipboardPayload,formatPainterActive:e.formatPainterActive,canActivateFormatPainter:e.canActivateFormatPainter,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onToggleFormatPainter:e.onToggleFormatPainter,layoutOptions:e.layoutOptions,onInsertSlideFromLayout:e.onInsertSlideFromLayout,selectedElement:e.selectedElement,onUpdateTextStyle:e.onUpdateTextStyle})});case "insert":return jsx("div",{className:n,children:jsx($I,{canEdit:e.canEdit,newShapeType:e.newShapeType,onSetNewShapeType:e.onSetNewShapeType,onAddTextBox:e.onAddTextBox,onAddShape:e.onAddShape,onAddTable:e.onAddTable,onAddSmartArt:e.onAddSmartArt,onAddEquation:e.onAddEquation,onAddActionButton:e.onAddActionButton,onInsertField:e.onInsertField,onOpenImagePicker:e.onOpenImagePicker,onOpenMediaPicker:e.onOpenMediaPicker})});case "text":return jsx("div",{className:n,children:jsx(zI,{canEdit:e.canEdit,selectedElement:e.selectedElement,tableEditorState:e.tableEditorState,onUpdateTextStyle:e.onUpdateTextStyle})});case "draw":return jsx("div",{className:n,children:jsx(BI,{activeTool:e.activeTool,drawingColor:e.drawingColor,drawingWidth:e.drawingWidth,onSetActiveTool:e.onSetActiveTool,onSetDrawingColor:e.onSetDrawingColor,onSetDrawingWidth:e.onSetDrawingWidth})});case "arrange":return jsx("div",{className:n,children:jsx(II,{canEdit:e.canEdit,selectedElement:e.selectedElement,clipboardPayload:e.clipboardPayload,onAlignElements:e.onAlignElements,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onFlip:e.onFlip,onMoveLayer:e.onMoveLayer,onMoveLayerToEdge:e.onMoveLayerToEdge,onDuplicate:e.onDuplicate,onDelete:e.onDelete,formatPainterActive:e.formatPainterActive,onToggleFormatPainter:e.onToggleFormatPainter,canActivateFormatPainter:e.canActivateFormatPainter})});case "design":return jsx("div",{className:n,children:jsx(NI,{canEdit:e.canEdit,onToggleThemeGallery:e.onToggleThemeGallery,isThemeGalleryOpen:e.isThemeGalleryOpen,onToggleThemeEditor:e.onToggleThemeEditor,isThemeEditorOpen:e.isThemeEditorOpen,onOpenDocumentProperties:e.onOpenDocumentProperties,onToggleInspector:e.onToggleInspector,isInspectorPaneOpen:e.isInspectorPaneOpen})});case "transitions":return jsx("div",{className:n,children:jsx(DI,{isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector})});case "animations":return jsx("div",{className:n,children:jsx(kI,{canEdit:e.canEdit,selectedElement:e.selectedElement,isInspectorPaneOpen:e.isInspectorPaneOpen,onToggleInspector:e.onToggleInspector,onOpenAnimationPanel:e.onOpenAnimationPanel,onAddAnimation:e.onAddAnimation,onRemoveAnimation:e.onRemoveAnimation})});case "slideShow":return jsx("div",{className:n,children:jsx(HI,{onPresent:()=>e.onSetMode("present"),onEnterPresenterView:e.onEnterPresenterView??(()=>{}),onEnterRehearsalMode:e.onEnterRehearsalMode??(()=>{}),onOpenSetUpSlideShow:e.onOpenSetUpSlideShow??(()=>{}),onOpenBroadcastDialog:e.onOpenBroadcastDialog??(()=>{}),onToggleSubtitles:e.onToggleSubtitles??(()=>{}),showSubtitles:e.showSubtitles??false,onSetMode:e.onSetMode})});case "review":return jsx("div",{className:n,children:jsx(LI,{canEdit:e.canEdit,spellCheckEnabled:e.spellCheckEnabled,onSetSpellCheckEnabled:e.onSetSpellCheckEnabled,onToggleComments:e.onToggleComments,isCommentsPanelOpen:e.isCommentsPanelOpen,slideCommentCount:e.slideCommentCount,onCompare:e.onCompare})});case "view":return jsx("div",{className:n,children:jsx(GI,{canEdit:e.canEdit,editTemplateMode:e.editTemplateMode,onSetEditTemplateMode:e.onSetEditTemplateMode,spellCheckEnabled:e.spellCheckEnabled,onSetSpellCheckEnabled:e.onSetSpellCheckEnabled,showGrid:e.showGrid,showRulers:e.showRulers,snapToGrid:e.snapToGrid,snapToShape:e.snapToShape,onSetShowGrid:e.onSetShowGrid,onSetShowRulers:e.onSetShowRulers,onSetSnapToGrid:e.onSetSnapToGrid,onSetSnapToShape:e.onSetSnapToShape,onAddGuide:e.onAddGuide,onEnterMasterView:e.onEnterMasterView,isSelectionPaneOpen:e.isSelectionPaneOpen,onToggleSelectionPane:e.onToggleSelectionPane,eyedropperActive:e.eyedropperActive,onToggleEyedropper:e.onToggleEyedropper})});case "file":return jsx("div",{className:n,children:jsx(OI,{onExportPng:e.onExportPng,onExportPdf:e.onExportPdf,onExportVideo:e.onExportVideo,onExportGif:e.onExportGif,onPackageForSharing:e.onPackageForSharing,onSaveAsPptx:e.onSaveAsPptx,onSaveAsPpsx:e.onSaveAsPpsx,onSaveAsPptm:e.onSaveAsPptm,hasMacros:e.hasMacros,onCopySlideAsImage:e.onCopySlideAsImage,onPrint:e.onPrint,onOpenDocumentProperties:e.onOpenDocumentProperties,onOpenPasswordProtection:e.onOpenPasswordProtection,onOpenFontEmbedding:e.onOpenFontEmbedding,onOpenDigitalSignatures:e.onOpenDigitalSignatures})});default:return jsxs("div",{className:"text-center text-sm text-muted-foreground py-8",children:[jsx(LuChevronRight,{className:"w-5 h-5 inline-block opacity-50"})," Select a section above"]})}}function Uie(t){let{t:e}=useTranslation(),{mode:n,canUndo:r,canRedo:o,onUndo:i,onRedo:s,onSetMode:a}=t,[l,c]=useState(false),d=n==="edit"||n==="master",u="inline-flex items-center justify-center min-w-[44px] min-h-[44px] rounded-md text-foreground/80 hover:bg-accent/60 disabled:opacity-40 disabled:cursor-not-allowed active:scale-95 transition-transform";return jsxs("div",{role:"toolbar","aria-label":"Toolbar",className:"relative z-20 flex items-center gap-1 px-2 py-1 border-b border-border bg-secondary/50 min-h-[52px] pt-[max(env(safe-area-inset-top),0px)]",children:[d&&jsx("button",{type:"button",onClick:()=>c(true),className:u,title:"Menu","aria-label":"Menu",children:jsx(LuMenu,{className:"w-5 h-5"})}),d&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:i,disabled:!r,className:u,title:e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:"w-5 h-5"})}),jsx("button",{type:"button",onClick:s,disabled:!o,className:u,title:e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex-1"}),jsx("button",{type:"button",onClick:()=>a("present"),className:le(u,"text-primary"),title:e("pptx.toolbar.present"),"aria-label":e("pptx.toolbar.present"),children:jsx(LuPresentation,{className:"w-5 h-5"})}),d&&jsx("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:le(u,"bg-primary text-white hover:bg-primary/90 px-3"),title:e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:jsx(LuShare2,{className:"w-4 h-4"})}),jsx(Bie,{open:l,onClose:()=>c(false),...t})]})}function $ie({customShows:t,activeCustomShowId:e,canEdit:n,isCurrentSlideInActiveShow:r,onSetActiveCustomShowId:o,onCreateCustomShow:i,onRenameActiveCustomShow:s,onDeleteActiveCustomShow:a,onToggleCurrentSlideInActiveShow:l}){return t.length>0?jsxs(Fragment,{children:[Un,jsxs("select",{value:e??"",onChange:c=>o(c.target.value||null),className:"h-6 px-1.5 text-[11px] rounded bg-muted text-foreground border border-border hover:bg-accent transition-colors cursor-pointer",title:"Custom show","aria-label":"Select custom show",children:[jsx("option",{value:"",children:"All Slides"}),t.map(c=>jsx("option",{value:c.id,children:c.name},c.id))]}),n&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:i,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Create custom show",children:"+ Show"}),e&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:s,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Rename active custom show",children:"Rename"}),jsx("button",{type:"button",onClick:a,className:"px-2 py-1 rounded bg-red-700/80 hover:bg-red-600 text-[11px] transition-colors",title:"Delete active custom show",children:"Delete"}),jsx("button",{type:"button",onClick:l,className:le("px-2 py-1 rounded text-[11px] transition-colors",r?"bg-primary text-white":"bg-muted hover:bg-accent"),title:"Include/exclude current slide in active custom show",children:r?"In Show":"Add Slide"})]})]})]}):n?jsxs(Fragment,{children:[Un,jsx("button",{type:"button",onClick:i,className:"px-2 py-1 rounded bg-muted hover:bg-accent text-[11px] transition-colors",title:"Create custom show",children:"+ Show"})]}):null}function Hie({isActive:t,onPresent:e,onPresenterView:n,onRehearse:r,onSetUpSlideShow:o,onBroadcast:i,onToggleSubtitles:s,showSubtitles:a}){let[l,c]=useState(false);return jsxs("div",{className:"relative",children:[jsxs("div",{className:"inline-flex border-l border-border",children:[jsx("button",{type:"button",onClick:e,className:le("px-2 py-1 transition-colors",t?"bg-primary text-white":"hover:bg-accent text-foreground"),title:"Present (fullscreen)",children:"Present"}),jsx("button",{type:"button",onClick:()=>c(d=>!d),className:le("px-1 py-1 transition-colors border-l border-border",l?"bg-primary text-white":"hover:bg-accent text-foreground"),title:"Presentation options","aria-label":"Presentation options",children:jsx(LuChevronDown,{className:"w-3 h-3"})})]}),l&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":"Close menu",onClick:()=>c(false)}),jsxs("div",{className:"absolute right-0 top-full mt-1 z-50 w-52 rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:[jsxs("button",{type:"button",onClick:()=>{c(false),e();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuPlay,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Present"]}),n&&jsxs("button",{type:"button",onClick:()=>{c(false),n();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuMonitor,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Presenter View"]}),r&&jsxs("button",{type:"button",onClick:()=>{c(false),r();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuClock,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Rehearse Timings"]}),jsx("div",{className:"my-1 border-t border-border/60"}),o&&jsxs("button",{type:"button",onClick:()=>{c(false),o();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuSettings,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Set Up Slide Show"]}),i&&jsxs("button",{type:"button",onClick:()=>{c(false),i();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuRadio,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Present Online"]}),s&&jsxs("button",{type:"button",onClick:()=>{c(false),s();},className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[jsx(LuCaptions,{className:"w-3.5 h-3.5 text-muted-foreground"}),jsx("span",{className:"flex-1 text-left",children:"Subtitles"}),a&&jsx(LuCheck,{className:"w-3 h-3 text-primary"})]})]})]})]})}function zie({mode:t,onSetMode:e,onCloseMasterView:n,onEnterPresenterView:r,onEnterRehearsalMode:o,onOpenSetUpSlideShow:i,onOpenBroadcastDialog:s,onToggleSubtitles:a,showSubtitles:l}){return t==="master"?jsxs("div",{className:"inline-flex items-center gap-1.5",children:[jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm bg-amber-600/90 text-[10px] text-amber-50",children:"Master View"}),jsx("button",{type:"button",onClick:n,className:"px-2 py-0.5 rounded-sm hover:bg-accent text-[10px] text-foreground transition-colors",title:"Close master view",children:"Close"})]}):jsx(Hie,{isActive:t==="present",onPresent:()=>e("present"),onPresenterView:r,onRehearse:o,onSetUpSlideShow:i,onBroadcast:s,onToggleSubtitles:a,showSubtitles:l})}function Gie(t){let e=n=>{t.onSetOverflowMenuOpen(false),{png:t.onExportPng,pdf:t.onExportPdf,video:t.onExportVideo,gif:t.onExportGif,package:t.onPackageForSharing,pptx:t.onSaveAsPptx,ppsx:t.onSaveAsPpsx,pptm:t.onSaveAsPptm,print:t.onPrint,copyImg:t.onCopySlideAsImage,a11y:t.onRunAccessibilityCheck,shortcuts:t.onToggleShortcuts,versionHistory:t.onToggleVersionHistory,documentProperties:t.onOpenDocumentProperties,passwordProtection:t.onOpenPasswordProtection,fontEmbedding:t.onOpenFontEmbedding,digitalSignatures:t.onOpenDigitalSignatures}[n]?.();};return jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>t.onSetOverflowMenuOpen(!t.isOverflowMenuOpen),className:le("p-1.5 rounded transition-colors",t.isOverflowMenuOpen?"bg-primary/80 text-white":"bg-muted hover:bg-accent"),title:"More actions","aria-label":"More actions",children:jsx(LuEllipsis,{className:Qe})}),t.isOverflowMenuOpen&&jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-40","aria-label":"Close menu",onClick:()=>t.onSetOverflowMenuOpen(false)}),jsx("div",{className:"absolute right-0 top-full mt-1 z-50 w-44 rounded-lg border border-border bg-popover backdrop-blur-lg shadow-2xl py-1",children:Tie.filter(n=>n.k!=="pptm"||t.hasMacros).map(n=>n.k.startsWith("---")?jsx("div",{className:"my-1 border-t border-border/60"},n.k):jsxs("button",{type:"button",onClick:()=>e(n.k),className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[n.i,n.l]},n.k))})]})]})}function Vie(t){let{t:e}=useTranslation(),{mode:n,canEdit:r,isSidebarCollapsed:o,isInspectorPaneOpen:i,canUndo:s,canRedo:a,undoLabel:l,redoLabel:c,findReplaceOpen:d,onToggleSidebar:u,onToggleInspector:p,onUndo:f,onRedo:h,onToggleFindReplace:m}=t,x=qi(),y="p-1 max-md:p-2 max-md:min-h-[40px] max-md:min-w-[40px] rounded-sm transition-colors hover:bg-accent/60 disabled:opacity-40 disabled:cursor-not-allowed active:scale-90 active:opacity-70";return jsxs("div",{className:"flex items-center gap-0.5 max-md:gap-0 px-1.5 py-0.5 max-md:px-1",children:[n!=="present"&&jsx("button",{type:"button",onClick:u,className:le(y,o?"text-muted-foreground":"text-foreground"),title:e("pptx.toolbar.toggleSlidesPanel"),"aria-label":e("pptx.toolbar.toggleSlidesPanel"),children:jsx(LuPanelLeft,{className:Qe})}),Un,jsx("button",{type:"button",onClick:f,disabled:!r||!s,className:le(y,"text-muted-foreground"),title:l?e("pptx.toolbar.undoAction",{action:l}):e("pptx.toolbar.undo"),"aria-label":e("pptx.toolbar.undo"),children:jsx(LuUndo,{className:lr})}),jsx("button",{type:"button",onClick:h,disabled:!r||!a,className:le(y,"text-muted-foreground"),title:c?e("pptx.toolbar.redoAction",{action:c}):e("pptx.toolbar.redo"),"aria-label":e("pptx.toolbar.redo"),children:jsx(LuRedo,{className:lr})}),(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:m,className:le(y,"max-md:hidden",d?"text-foreground":"text-muted-foreground"),title:e("pptx.findReplace.title"),"aria-label":e("pptx.findReplace.title"),children:jsx(LuSearch,{className:lr})}),jsx("div",{className:"flex-1 min-w-2 max-md:min-w-1"}),(n==="edit"||n==="master")&&jsxs("button",{type:"button",onClick:t.onToggleComments,className:le(y,"relative max-md:hidden",t.isCommentsPanelOpen?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.comments"),"aria-label":e("pptx.toolbar.comments"),children:[jsx(LuMessageSquare,{className:lr}),(t.slideCommentCount??0)>0&&jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center w-3.5 h-3.5 rounded-full bg-primary text-[8px] text-white leading-none",children:t.slideCommentCount})]}),x&&(x.status==="connected"||x.status==="connecting")&&x.remoteUsers.length>0&&jsxs("button",{type:"button",onClick:t.onOpenShareDialog,className:"flex items-center -space-x-1.5 mx-1 rounded-sm px-1 py-0.5 hover:bg-accent/60 transition-colors cursor-pointer",title:e("pptx.toolbar.sharingUsers",{count:x.connectedCount}),children:[x.remoteUsers.slice(0,4).map(v=>jsx("div",{className:"w-6 h-6 rounded-full border-2 border-background flex items-center justify-center text-[8px] font-semibold text-white shrink-0",style:{backgroundColor:v.userColor},title:v.userName,children:v.userAvatar?jsx("img",{src:v.userAvatar,alt:v.userName,className:"w-full h-full rounded-full object-cover"}):v.userName.slice(0,2).toUpperCase()},v.clientId)),x.remoteUsers.length>4&&jsxs("div",{className:"w-6 h-6 rounded-full border-2 border-background bg-muted flex items-center justify-center text-[8px] text-muted-foreground shrink-0",children:["+",x.remoteUsers.length-4]})]}),jsx(zie,{mode:t.mode,onSetMode:t.onSetMode,onCloseMasterView:t.onCloseMasterView,onToggleSlideSorter:t.onToggleSlideSorter,onEnterPresenterView:t.onEnterPresenterView,onEnterRehearsalMode:t.onEnterRehearsalMode,onOpenSetUpSlideShow:t.onOpenSetUpSlideShow,onOpenBroadcastDialog:t.onOpenBroadcastDialog,onToggleSubtitles:t.onToggleSubtitles,showSubtitles:t.showSubtitles}),jsx($ie,{customShows:t.customShows,activeCustomShowId:t.activeCustomShowId,canEdit:t.canEdit,isCurrentSlideInActiveShow:t.isCurrentSlideInActiveShow,onSetActiveCustomShowId:t.onSetActiveCustomShowId,onCreateCustomShow:t.onCreateCustomShow,onRenameActiveCustomShow:t.onRenameActiveCustomShow,onDeleteActiveCustomShow:t.onDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:t.onToggleCurrentSlideInActiveShow}),Un,(n==="edit"||n==="master")&&jsxs("button",{type:"button",onClick:t.onOpenShareDialog??t.onPackageForSharing,className:le("relative inline-flex items-center gap-1 px-2.5 py-1 rounded-sm text-[11px] font-medium transition-colors",x&&x.status==="connected"?"bg-green-600 hover:bg-green-500 text-white":"bg-primary hover:bg-primary/90 text-white"),title:x&&x.status==="connected"?e("pptx.toolbar.sharingUsers",{count:x.connectedCount}):e("pptx.toolbar.share"),"aria-label":e("pptx.toolbar.share"),children:[jsx(LuShare2,{className:"w-3 h-3"}),jsx("span",{className:"max-md:hidden",children:x&&x.status==="connected"?e("pptx.toolbar.sharingCount",{count:x.connectedCount}):e("pptx.toolbar.share")})]}),(n==="edit"||n==="master")&&jsx("button",{type:"button",onClick:p,className:le(y,i?"text-foreground":"text-muted-foreground"),title:e("pptx.toolbar.toggleInspector"),"aria-label":e("pptx.toolbar.toggleInspector"),children:jsx(LuPanelRight,{className:Qe})}),jsx("button",{type:"button",onClick:t.onOpenSettings??t.onToggleShortcuts,className:le(y,"text-muted-foreground"),title:e("pptx.toolbar.settingsShortcuts"),"aria-label":e("pptx.toolbar.settings"),children:jsx(LuSettings,{className:lr})}),!r&&jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-sm bg-amber-600/90 text-[10px] text-amber-50",children:e("pptx.toolbar.readOnly")}),jsx(Gie,{...t})]})}function R8(t){let{mode:e,isNarrowViewport:n,isCompactToolbarOpen:r,toolbarSection:o,onSetToolbarSection:i}=t;if(n&&e!=="present")return jsx(Uie,{...t});let s=o==="file",a=o==="home",l=o==="insert",c=a||o==="text",d=o==="arrange",u=o==="draw",p=o==="design",f=o==="transitions",h=o==="animations",m=o==="slideShow",x=o==="review",y=o==="view",v=o==="help",S=e==="edit"||e==="master";return jsxs("div",{role:"toolbar","aria-label":"Presentation toolbar",className:"relative z-20 border-b border-border bg-secondary/50 overflow-visible",children:[jsx(Vie,{...t}),S&&jsxs("div",{className:"flex items-center border-b border-border/60 px-1 max-md:overflow-x-auto max-md:scrollbar-none",children:[IW.map(w=>jsx("button",{type:"button",onClick:()=>i(w.id),className:le("relative px-3.5 py-2 text-[12px] font-medium whitespace-nowrap transition-colors max-md:min-h-[36px] max-md:px-3",o===w.id?w.id==="file"?"text-white bg-primary/80 rounded-sm":"text-foreground after:absolute after:-bottom-px after:left-0 after:right-0 after:h-[2.5px] after:bg-primary":w.id==="file"?"text-primary hover:bg-primary/15 rounded-sm":"text-muted-foreground hover:text-foreground hover:bg-accent/30"),children:w.label},w.id)),jsx("div",{className:"flex-1"}),n&&jsx("button",{type:"button",onClick:t.onToggleCompactToolbar,className:le("px-2 py-1 rounded text-[11px] transition-colors mr-1",r?"bg-primary/80 text-white":"text-muted-foreground hover:text-foreground"),title:"Toggle ribbon",children:r?"Collapse":"Expand"})]}),S&&jsxs("div",{className:le("flex items-center gap-1.5 px-2 py-1 max-md:px-1 max-md:py-0.5 overflow-visible flex-nowrap",n&&!r&&"hidden"),children:[s&&jsx(OI,{onExportPng:t.onExportPng,onExportPdf:t.onExportPdf,onExportVideo:t.onExportVideo,onExportGif:t.onExportGif,onPackageForSharing:t.onPackageForSharing,onSaveAsPptx:t.onSaveAsPptx,onSaveAsPpsx:t.onSaveAsPpsx,onSaveAsPptm:t.onSaveAsPptm,hasMacros:t.hasMacros,onCopySlideAsImage:t.onCopySlideAsImage,onPrint:t.onPrint,onOpenDocumentProperties:t.onOpenDocumentProperties,onOpenPasswordProtection:t.onOpenPasswordProtection,onOpenFontEmbedding:t.onOpenFontEmbedding,onOpenDigitalSignatures:t.onOpenDigitalSignatures}),a&&jsx(UI,{canEdit:t.canEdit,clipboardPayload:t.clipboardPayload,formatPainterActive:t.formatPainterActive,canActivateFormatPainter:t.canActivateFormatPainter,onCopy:t.onCopy,onCut:t.onCut,onPaste:t.onPaste,onToggleFormatPainter:t.onToggleFormatPainter,layoutOptions:t.layoutOptions,onInsertSlideFromLayout:t.onInsertSlideFromLayout,selectedElement:t.selectedElement,onUpdateTextStyle:t.onUpdateTextStyle}),l&&jsx($I,{canEdit:t.canEdit,newShapeType:t.newShapeType,onSetNewShapeType:t.onSetNewShapeType,onAddTextBox:t.onAddTextBox,onAddShape:t.onAddShape,onAddTable:t.onAddTable,onAddSmartArt:t.onAddSmartArt,onAddEquation:t.onAddEquation,onAddActionButton:t.onAddActionButton,onInsertField:t.onInsertField,onOpenImagePicker:t.onOpenImagePicker,onOpenMediaPicker:t.onOpenMediaPicker}),c&&jsx(zI,{canEdit:t.canEdit,selectedElement:t.selectedElement,tableEditorState:t.tableEditorState,onUpdateTextStyle:t.onUpdateTextStyle}),u&&jsx(BI,{activeTool:t.activeTool,drawingColor:t.drawingColor,drawingWidth:t.drawingWidth,onSetActiveTool:t.onSetActiveTool,onSetDrawingColor:t.onSetDrawingColor,onSetDrawingWidth:t.onSetDrawingWidth}),d&&jsx(II,{canEdit:t.canEdit,selectedElement:t.selectedElement,clipboardPayload:t.clipboardPayload,onAlignElements:t.onAlignElements,onCopy:t.onCopy,onCut:t.onCut,onPaste:t.onPaste,onFlip:t.onFlip,onMoveLayer:t.onMoveLayer,onMoveLayerToEdge:t.onMoveLayerToEdge,onDuplicate:t.onDuplicate,onDelete:t.onDelete,formatPainterActive:t.formatPainterActive,onToggleFormatPainter:t.onToggleFormatPainter,canActivateFormatPainter:t.canActivateFormatPainter}),p&&jsx(NI,{canEdit:t.canEdit,onToggleThemeGallery:t.onToggleThemeGallery,isThemeGalleryOpen:t.isThemeGalleryOpen,onToggleThemeEditor:t.onToggleThemeEditor,isThemeEditorOpen:t.isThemeEditorOpen,onOpenDocumentProperties:t.onOpenDocumentProperties,onToggleInspector:t.onToggleInspector,isInspectorPaneOpen:t.isInspectorPaneOpen}),f&&jsx(DI,{isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector}),h&&jsx(kI,{canEdit:t.canEdit,selectedElement:t.selectedElement,isInspectorPaneOpen:t.isInspectorPaneOpen,onToggleInspector:t.onToggleInspector,onOpenAnimationPanel:t.onOpenAnimationPanel,onAddAnimation:t.onAddAnimation,onRemoveAnimation:t.onRemoveAnimation}),m&&jsx(HI,{onPresent:()=>t.onSetMode("present"),onEnterPresenterView:t.onEnterPresenterView??(()=>{}),onEnterRehearsalMode:t.onEnterRehearsalMode??(()=>{}),onOpenSetUpSlideShow:t.onOpenSetUpSlideShow??(()=>{}),onOpenBroadcastDialog:t.onOpenBroadcastDialog??(()=>{}),onToggleSubtitles:t.onToggleSubtitles??(()=>{}),showSubtitles:t.showSubtitles??false,onSetMode:t.onSetMode}),x&&jsx(LI,{canEdit:t.canEdit,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,onToggleComments:t.onToggleComments,isCommentsPanelOpen:t.isCommentsPanelOpen,slideCommentCount:t.slideCommentCount,onCompare:t.onCompare}),y&&jsx(GI,{canEdit:t.canEdit,editTemplateMode:t.editTemplateMode,onSetEditTemplateMode:t.onSetEditTemplateMode,spellCheckEnabled:t.spellCheckEnabled,onSetSpellCheckEnabled:t.onSetSpellCheckEnabled,showGrid:t.showGrid,showRulers:t.showRulers,snapToGrid:t.snapToGrid,snapToShape:t.snapToShape,onSetShowGrid:t.onSetShowGrid,onSetShowRulers:t.onSetShowRulers,onSetSnapToGrid:t.onSetSnapToGrid,onSetSnapToShape:t.onSetSnapToShape,onAddGuide:t.onAddGuide,onEnterMasterView:t.onEnterMasterView,isSelectionPaneOpen:t.isSelectionPaneOpen,onToggleSelectionPane:t.onToggleSelectionPane,eyedropperActive:t.eyedropperActive,onToggleEyedropper:t.onToggleEyedropper}),v&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:t.onToggleShortcuts,className:ft,title:"Keyboard shortcuts",children:"Keyboard Shortcuts"}),jsx("button",{type:"button",onClick:t.onRunAccessibilityCheck,className:ft,title:"Accessibility check",children:"Accessibility"})]})]})]})}var WI="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",$p="bg-muted border border-border rounded px-2 py-1 w-full text-[11px]",jie=gE.filter(t=>t.value==="fadeIn"||t.value==="flyIn"||t.value==="zoomIn"),Xie=gE.filter(t=>t.value==="fadeOut"||t.value==="flyOut"||t.value==="zoomOut"),Wie=gE.filter(t=>t.value==="spin"||t.value==="pulse"||t.value==="colorWave"||t.value==="bounce"||t.value==="flash"||t.value==="growShrink"||t.value==="teeter"),Yie=[{value:"onClick",labelKey:"pptx.animation.trigger.onClick"},{value:"onShapeClick",labelKey:"pptx.animation.trigger.onShapeClick"},{value:"onHover",labelKey:"pptx.animation.trigger.onHover"},{value:"afterPrevious",labelKey:"pptx.animation.trigger.afterPrevious"},{value:"withPrevious",labelKey:"pptx.animation.trigger.withPrevious"}],qie=[{value:"ease",labelKey:"pptx.animation.timingCurve.ease"},{value:"ease-in",labelKey:"pptx.animation.timingCurve.easeIn"},{value:"ease-out",labelKey:"pptx.animation.timingCurve.easeOut"},{value:"linear",labelKey:"pptx.animation.timingCurve.linear"}],Kie=[{value:"none",labelKey:"pptx.animation.repeatUntil.none"},{value:"untilNextClick",labelKey:"pptx.animation.repeatUntil.untilNextClick"},{value:"untilEndOfSlide",labelKey:"pptx.animation.repeatUntil.untilEndOfSlide"}],Zie=[{value:"fromTop",labelKey:"pptx.animation.direction.fromTop",icon:LuArrowDown},{value:"fromBottom",labelKey:"pptx.animation.direction.fromBottom",icon:LuArrowUp},{value:"fromLeft",labelKey:"pptx.animation.direction.fromLeft",icon:LuArrowRight},{value:"fromRight",labelKey:"pptx.animation.direction.fromRight",icon:LuArrowLeft}],Jie=[{value:"asOne",labelKey:"pptx.animation.sequence.asOne"},{value:"byParagraph",labelKey:"pptx.animation.sequence.byParagraph"},{value:"byWord",labelKey:"pptx.animation.sequence.byWord"},{value:"byLetter",labelKey:"pptx.animation.sequence.byLetter"}];function HXe(t){return t.entrance?"bg-green-500/60":t.emphasis?"bg-yellow-500/60":t.exit?"bg-red-500/60":"bg-muted-foreground/40"}function zXe(t){return t.entrance??t.emphasis??t.exit??"custom"}function ese({selectedElementId:t,canEdit:e,handlers:n}){let{t:r}=useTranslation(),{sortedAnimations:o,dragIndex:i,dragOverIndex:s,timelineBarData:a,handleAnimationHover:l,handleAnimationHoverEnd:c,handleDragStart:d,handleDragOver:u,handleDragEnter:p,handleDragLeave:f,handleDrop:h,handleDragEnd:m,handleMoveUp:x,handleMoveDown:y,getTimelineLabel:v}=n;return o.length===0&&a.length===0?null:jsxs(Fragment,{children:[a.length>0&&jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-1",children:r("pptx.animation.timelineBar")}),jsx("div",{className:"relative h-6 rounded bg-muted/50 border border-border overflow-hidden",children:a.map(S=>jsx("div",{className:le("absolute top-0.5 bottom-0.5 rounded-sm transition-colors",HXe(S.anim),S.anim.elementId===t&&"ring-1 ring-primary"),style:{left:`${S.leftPercent}%`,width:`${Math.max(S.widthPercent,2)}%`},title:`${v(S.anim)} - ${zXe(S.anim)} (${S.anim.durationMs??500}ms)`,onMouseEnter:()=>l(S.anim),onMouseLeave:c},S.anim.elementId))})]}),o.length>0&&jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-1",children:r("pptx.animation.timeline")}),jsx("div",{className:"space-y-0.5 max-h-40 overflow-y-auto",children:o.map((S,w)=>{let C=t===S.elementId;return jsxs("div",{draggable:e,onDragStart:M=>d(w,M),onDragOver:M=>u(w,M),onDragEnter:()=>p(w),onDragLeave:f,onDrop:M=>h(w,M),onDragEnd:m,onMouseEnter:()=>l(S),onMouseLeave:c,className:le("flex items-center gap-1 px-1 py-0.5 rounded text-[10px] cursor-grab transition-colors",C?"bg-primary/30 text-primary":"bg-muted/50 text-muted-foreground",i===w&&"opacity-40",s===w&&"border-t-2 border-primary"),children:[e&&jsx(LuGripVertical,{className:"w-3 h-3 text-muted-foreground/50 shrink-0"}),jsxs("span",{className:"text-muted-foreground w-4 shrink-0",children:[w+1,"."]}),jsx("span",{className:"truncate flex-1",children:v(S)}),S.entrance&&jsx(LuMoveRight,{className:"w-3 h-3 text-green-400/70 shrink-0"}),S.emphasis&&jsx(LuRotateCw,{className:"w-3 h-3 text-yellow-400/70 shrink-0"}),S.exit&&jsx(LuMoveRight,{className:"w-3 h-3 text-red-400/70 rotate-180 shrink-0"}),e&&jsxs("div",{className:"flex gap-0.5 shrink-0",children:[jsx("button",{type:"button",disabled:w===0,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:M=>{M.stopPropagation(),x(w);},title:r("pptx.animation.moveUp"),children:jsx(LuChevronUp,{className:"w-3 h-3"})}),jsx("button",{type:"button",disabled:w===o.length-1,className:"text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",onClick:M=>{M.stopPropagation(),y(w);},title:r("pptx.animation.moveDown"),children:jsx(LuChevronDown,{className:"w-3 h-3"})})]})]},S.elementId)})})]})]})}var k8=new Set(["flyIn","flyOut"]);function nse({canEdit:t,updateAnimations:e}){let[n,r]=useState(null),[o,i]=useState(null),s=useRef(0),a=useCallback((x,y)=>{t&&(r(x),y.dataTransfer.effectAllowed="move",y.dataTransfer.setData("text/plain",String(x)));},[t]),l=useCallback((x,y)=>{y.preventDefault(),y.dataTransfer.dropEffect="move",i(x);},[]),c=useCallback(x=>{s.current++,i(x);},[]),d=useCallback(()=>{s.current--,s.current<=0&&(i(null),s.current=0);},[]),u=useCallback((x,y)=>{e(v=>{let S=[...v].sort((C,T)=>(C.order??0)-(T.order??0)),[w]=S.splice(x,1);return S.splice(y,0,w),S.map((C,T)=>({...C,order:T}))});},[e]),p=useCallback((x,y)=>{y.preventDefault(),s.current=0;let v=n;r(null),i(null),!(v===null||v===x)&&u(v,x);},[n,u]),f=useCallback(()=>{r(null),i(null),s.current=0;},[]),h=useCallback(x=>{x<=0||u(x,x-1);},[u]),m=useCallback(x=>{e(y=>{let v=[...y].sort((w,C)=>(w.order??0)-(C.order??0));if(x>=v.length-1)return y;let S=v[x+1];return v[x+1]=v[x],v[x]=S,v.map((w,C)=>({...w,order:C}))});},[e]);return {dragIndex:n,dragOverIndex:o,handleDragStart:a,handleDragOver:l,handleDragEnter:c,handleDragLeave:d,handleDrop:p,handleDragEnd:f,handleMoveUp:h,handleMoveDown:m}}function rse({selectedElementId:t,selectedElementAnimation:e}){let n=useCallback(i=>{let s=i.entrance??i.emphasis??i.exit;!s||s==="none"||oU(i.elementId,s,{direction:i.direction,durationMs:i.durationMs??500,timingCurve:i.timingCurve});},[]),r=useCallback(()=>iU(),[]),o=useCallback(()=>{if(!e)return;let i=e.entrance??e.emphasis??e.exit;!i||i==="none"||oU(t,i,{direction:e.direction,durationMs:e.durationMs??500,timingCurve:e.timingCurve});},[t,e]);return {handleAnimationHover:n,handleAnimationHoverEnd:r,handlePreviewClick:o}}function ose({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let o=useMemo(()=>(e.animations??[]).find(k=>k.elementId===t.id),[e,t]),i=useMemo(()=>[...e.animations??[]].sort((k,N)=>(k.order??0)-(N.order??0)),[e.animations]),s=useCallback(k=>{if(!n)return;let N=e.animations??[];r({animations:k([...N])});},[n,e.animations,r]),a=useCallback((k,N)=>{s(F=>F.map(B=>B.elementId===t.id?{...B,[k]:N}:B));},[s,t.id]),l=useCallback((k,N,F)=>{n&&s(B=>{let D=B.findIndex(U=>U.elementId===t.id),O=k||N||F;if(D>=0){if(!O)return B.filter(U=>U.elementId!==t.id);B[D]={...B[D],entrance:k,exit:N,emphasis:F};}else O&&B.push({elementId:t.id,entrance:k,exit:N,emphasis:F,durationMs:500,order:B.length,trigger:"onClick"});return B});},[n,s,t.id]),c=useCallback(k=>{let N=k.target.value;l(N==="none"?void 0:N,o?.exit,o?.emphasis);},[l,o]),d=useCallback(k=>{let N=k.target.value;l(o?.entrance,N==="none"?void 0:N,o?.emphasis);},[l,o]),u=useCallback(k=>{let N=k.target.value;l(o?.entrance,o?.exit,N==="none"?void 0:N);},[l,o]),p=useCallback(k=>{let N=k.target.value;a("trigger",N),N!=="onShapeClick"&&a("triggerShapeId",void 0);},[a]),f=useCallback(k=>a("triggerShapeId",k.target.value||void 0),[a]),h=useCallback(k=>a("timingCurve",k.target.value),[a]),m=useCallback(k=>a("durationMs",Math.max(100,Math.min(1e4,Number(k.target.value)||450))),[a]),x=useCallback(k=>a("delayMs",Math.max(0,Math.min(1e4,Number(k.target.value)||0))),[a]),y=useCallback(k=>a("repeatCount",Math.max(1,Math.min(100,Number(k.target.value)||1))),[a]),v=useCallback(k=>{let N=k.target.value;a("repeatMode",N==="none"?void 0:N);},[a]),S=useCallback(k=>a("direction",k),[a]),w=useCallback(k=>a("sequence",k.target.value),[a]),C=rse({selectedElementId:t.id,selectedElementAnimation:o}),T=nse({canEdit:n,updateAnimations:s}),E=useCallback(k=>{let N=e.elements?.find(B=>B.id===k.elementId);return N?(ot(N)?N.text:void 0)||cs(N):k.elementId.slice(0,8)},[e.elements]),M=!!(o?.entrance||o?.exit||o?.emphasis),A=M&&(k8.has(o?.entrance??"")||k8.has(o?.exit??"")),R=useMemo(()=>{if(i.length===0)return [];let k=0,N=i.map(B=>{let D=B.delayMs??0,O=B.durationMs??500,U=D+O;return U>k&&(k=U),{anim:B,startMs:D,durationMs:O,endMs:U}}),F=Math.max(k,1);return N.map(B=>({anim:B.anim,leftPercent:B.startMs/F*100,widthPercent:B.durationMs/F*100}))},[i]);return {selectedElementAnimation:o,sortedAnimations:i,hasAnimation:M,showDirectionPicker:A,timelineBarData:R,handleEntranceChange:c,handleExitChange:d,handleEmphasisChange:u,handleTriggerChange:p,handleTriggerShapeChange:f,handleTimingCurveChange:h,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:y,handleRepeatModeChange:v,handleDirectionChange:S,handleSequenceChange:w,getTimelineLabel:E,...C,...T}}function ise({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=ose({selectedElement:t,activeSlide:e,canEdit:n,onUpdateSlide:r}),{selectedElementAnimation:s,hasAnimation:a,showDirectionPicker:l,handleEntranceChange:c,handleExitChange:d,handleEmphasisChange:u,handleTriggerChange:p,handleTriggerShapeChange:f,handleTimingCurveChange:h,handleDurationChange:m,handleDelayChange:x,handleRepeatCountChange:y,handleRepeatModeChange:v,handleDirectionChange:S,handleSequenceChange:w,handlePreviewClick:C}=i;return jsxs("div",{className:"rounded border border-border bg-card p-2 space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:o("pptx.animation.title")}),a&&jsxs("button",{type:"button",className:"flex items-center gap-1 text-[10px] text-primary hover:text-primary/80 transition-colors",onClick:C,title:o("pptx.animation.preview"),children:[jsx(LuPlay,{className:"w-3 h-3"}),o("pptx.animation.preview")]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.entrance")}),jsxs("select",{value:s?.entrance??"none",onChange:c,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),jie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.emphasis")}),jsxs("select",{value:s?.emphasis??"none",onChange:u,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Wie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.exit")}),jsxs("select",{value:s?.exit??"none",onChange:d,disabled:!n,className:$p,children:[jsx("option",{value:"none",children:o("pptx.animation.none")}),Xie.map(T=>jsx("option",{value:T.value,children:o(`pptx.animation.preset.${T.value}`)},T.value))]})]}),a&&jsxs(Fragment,{children:[l&&jsxs("div",{className:"pt-1 border-t border-border",children:[jsx("span",{className:"text-muted-foreground text-[11px] block mb-1",children:o("pptx.animation.direction")}),jsx("div",{className:"flex gap-1",children:Zie.map(T=>{let E=T.icon,M=s?.direction===T.value;return jsx("button",{type:"button",disabled:!n,className:le("flex items-center justify-center w-7 h-7 rounded border transition-colors",M?"border-primary bg-primary/20 text-primary":"border-border bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>S(T.value),title:o(T.labelKey),children:jsx(E,{className:"w-3.5 h-3.5"})},T.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.sequence")}),jsx("select",{value:s?.sequence??"asOne",onChange:w,disabled:!n,className:$p,children:Jie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground pt-1 border-t border-border",children:o("pptx.animation.timing")}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.trigger")}),jsx("select",{value:s?.trigger??"onClick",onChange:p,disabled:!n,className:$p,children:Yie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),s?.trigger==="onShapeClick"&&jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.trigger.shapeLabel")}),jsxs("select",{value:s?.triggerShapeId??"",onChange:f,disabled:!n,className:$p,children:[jsx("option",{value:"",children:o("pptx.animation.trigger.selectShape")}),e.elements.filter(T=>T.id!==t.id).map(T=>jsx("option",{value:T.id,children:cs(T)},T.id))]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.duration")}),jsx("input",{type:"number",min:100,max:1e4,step:50,disabled:!n,value:s?.durationMs??450,onChange:m,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.delay")}),jsx("input",{type:"number",min:0,max:1e4,step:50,disabled:!n,value:s?.delayMs??0,onChange:x,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.timingCurve")}),jsx("select",{value:s?.timingCurve??"ease",onChange:h,disabled:!n,className:$p,children:qie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.repeatCount")}),jsx("input",{type:"number",min:1,max:100,step:1,disabled:!n,value:s?.repeatCount??1,onChange:y,className:WI})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.animation.repeatUntil")}),jsx("select",{value:s?.repeatMode??"none",onChange:v,disabled:!n,className:$p,children:Kie.map(T=>jsx("option",{value:T.value,children:o(T.labelKey)},T.value))})]})]}),jsx(ese,{selectedElementId:t.id,canEdit:n,handlers:i})]})}var sse=[{key:"elements",label:"Elements",icon:LuLayers},{key:"properties",label:"Properties",icon:LuSettings2},{key:"comments",label:"Comments",icon:LuMessageSquare}],hn="text-[11px] uppercase tracking-wide text-muted-foreground",xn="rounded border border-border bg-card p-2 space-y-2",Fn="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",Xr="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",ase=[["X","x"],["Y","y"],["W","width"],["H","height"]];var JXe=[{value:"none",label:"None"},{value:"url",label:"Go to URL"},{value:"slide",label:"Go to Slide"},{value:"firstSlide",label:"First Slide"},{value:"lastSlide",label:"Last Slide"},{value:"prevSlide",label:"Previous Slide"},{value:"nextSlide",label:"Next Slide"},{value:"endShow",label:"End Show"}];function cse({selectedElement:t,slides:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.actionClick?R5(t.actionClick,"click"):void 0,s=t.actionHover?R5(t.actionHover,"hover"):void 0,a=i?.type??"none",l=s?.type??"none",c=(d,u,p,f)=>{let m=iE({type:u,url:p,slideIndex:f});r(d==="click"?{actionClick:m}:{actionHover:m});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.action.title","Action")}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx(lse,{label:o("pptx.action.onClick","On Click"),trigger:"click",activeType:a,action:i,fallbackUrl:t.actionClick?.url,fallbackSlideIndex:t.actionClick?.targetSlideIndex,canEdit:n,slideCount:e.length,onChangeType:d=>c("click",d,i?.url,i?.slideIndex),onChangeUrl:d=>c("click","url",d),onChangeSlide:d=>c("click","slide",void 0,d)}),jsx(lse,{label:o("pptx.action.onHover","On Hover"),trigger:"hover",activeType:l,action:s,fallbackUrl:t.actionHover?.url,fallbackSlideIndex:t.actionHover?.targetSlideIndex,canEdit:n,slideCount:e.length,onChangeType:d=>c("hover",d,s?.url,s?.slideIndex),onChangeUrl:d=>c("hover","url",d),onChangeSlide:d=>c("hover","slide",void 0,d)})]})]})}function lse({label:t,activeType:e,action:n,fallbackUrl:r,fallbackSlideIndex:o,canEdit:i,slideCount:s,onChangeType:a,onChangeUrl:l,onChangeSlide:c}){return jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-muted-foreground font-medium",children:t}),jsx("select",{disabled:!i,className:le(Fn,"w-full"),value:e,onChange:d=>a(d.target.value),children:JXe.map(d=>jsx("option",{value:d.value,children:d.label},d.value))}),e==="url"&&jsx("input",{type:"text",disabled:!i,className:le(Fn,"w-full"),placeholder:"https://...",value:n?.url??r??"",onChange:d=>l(d.target.value)}),e==="slide"&&jsx("input",{type:"number",disabled:!i,className:le(Fn,"w-full"),placeholder:"Slide number (1-based)",min:1,max:s,value:(n?.slideIndex??o??0)+1,onChange:d=>{let u=Number(d.target.value);Number.isFinite(u)&&c(Math.max(0,u-1));}})]})}var Bv="text-[11px] uppercase tracking-wide text-muted-foreground",Ov="rounded border border-border bg-card p-2 space-y-2",Uv="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",L8="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",YI="bg-muted border border-border rounded px-1 py-0.5 text-[11px] w-full text-center",dse=[{value:"bar",labelKey:"pptx.chart.typeBar"},{value:"line",labelKey:"pptx.chart.typeLine"},{value:"pie",labelKey:"pptx.chart.typePie"},{value:"doughnut",labelKey:"pptx.chart.typeDoughnut"},{value:"area",labelKey:"pptx.chart.typeArea"},{value:"scatter",labelKey:"pptx.chart.typeScatter"},{value:"bubble",labelKey:"pptx.chart.typeBubble"},{value:"radar",labelKey:"pptx.chart.typeRadar"},{value:"stock",labelKey:"pptx.chart.typeStock"},{value:"waterfall",labelKey:"pptx.chart.typeWaterfall"},{value:"combo",labelKey:"pptx.chart.typeCombo"}],use=[{value:"clustered",labelKey:"pptx.chart.groupingClustered"},{value:"stacked",labelKey:"pptx.chart.groupingStacked"},{value:"percentStacked",labelKey:"pptx.chart.groupingPercentStacked"}],pse=[{value:"t",labelKey:"pptx.chart.legendTop"},{value:"b",labelKey:"pptx.chart.legendBottom"},{value:"l",labelKey:"pptx.chart.legendLeft"},{value:"r",labelKey:"pptx.chart.legendRight"}],fse=new Set(["bar","line","area"]);function gse({series:t,categories:e,canEdit:n,onUpdateSeries:r,onUpdateCategoryLabel:o,onUpdateValue:i,onAddCategory:s,onRemoveCategory:a,onAddSeries:l,onRemoveSeries:c}){let{t:d}=useTranslation();return jsxs("div",{className:Ov,children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:Bv,children:d("pptx.chart.data")}),n&&jsxs("div",{className:"flex gap-1",children:[jsxs("button",{type:"button",className:L8,title:d("pptx.chart.addCategory"),onClick:s,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),d("pptx.chart.cat")]}),jsxs("button",{type:"button",className:L8,title:d("pptx.chart.addSeries"),onClick:l,children:[jsx(LuPlus,{className:"inline w-3 h-3 mr-0.5"}),d("pptx.chart.seriesShort")]})]})]}),jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"w-full text-[11px] border-collapse",children:[jsx("thead",{children:jsxs("tr",{children:[jsx("th",{className:"text-muted-foreground p-0.5 text-left min-w-[60px]"}),t.map((u,p)=>jsx("th",{className:"p-0.5 font-normal min-w-[72px]",children:jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("input",{type:"text",disabled:!n,className:YI,value:u.name,onChange:f=>r(p,{name:f.target.value})}),n&&t.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:d("pptx.chart.removeSeries"),onClick:()=>c(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})},p))]})}),jsx("tbody",{children:e.map((u,p)=>jsxs("tr",{children:[jsx("td",{className:"p-0.5",children:jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("input",{type:"text",disabled:!n,className:YI,value:u,onChange:f=>o(p,f.target.value)}),n&&e.length>1&&jsx("button",{type:"button",className:"text-muted-foreground hover:text-red-400 shrink-0",title:d("pptx.chart.removeCategory"),onClick:()=>a(p),children:jsx(LuTrash2,{className:"w-3 h-3"})})]})}),t.map((f,h)=>jsx("td",{className:"p-0.5",children:jsx("input",{type:"number",disabled:!n,className:YI,value:f.values[p]??0,onChange:m=>i(h,p,m.target.value)})},h))]},p))})]})})]})}function xse({style:t,canEdit:e,onUpdateStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:Ov,children:[jsx("div",{className:Bv,children:r("pptx.chart.display")}),jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasTitle??false,onChange:o=>n({hasTitle:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showTitle")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasLegend??false,onChange:o=>n({hasLegend:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showLegend")})]}),t?.hasLegend&&jsxs("label",{className:"flex items-center gap-2 text-[11px] ml-4",children:[jsx("span",{className:"w-12 text-muted-foreground shrink-0",children:r("pptx.chart.legendPosition")}),jsx("select",{disabled:!e,className:Uv,value:t.legendPosition??"b",onChange:o=>n({legendPosition:o.target.value}),children:pse.map(o=>jsx("option",{value:o.value,children:r(o.labelKey)},o.value))})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasGridlines??false,onChange:o=>n({hasGridlines:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showGridlines")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:t?.hasDataLabels??false,onChange:o=>n({hasDataLabels:o.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:r("pptx.chart.showDataLabels")})]})]})]})}function yse({title:t,chartType:e,grouping:n,seriesCount:r,categoryCount:o,canEdit:i,onUpdateChartData:s}){let{t:a}=useTranslation(),l=fse.has(e);return jsxs("div",{className:Ov,children:[jsx("div",{className:Bv,children:a("pptx.chart.heading")}),jsxs("div",{className:"text-[11px] text-muted-foreground mb-1",children:[r," ",a("pptx.chart.series")," \xB7 ",o," ",a("pptx.chart.categories")]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.title")}),jsx("input",{type:"text",disabled:!i,className:Uv,value:t??"",onChange:c=>s({title:c.target.value})})]}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.type")}),jsx("select",{disabled:!i,className:Uv,value:e,onChange:c=>s({chartType:c.target.value}),children:dse.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]}),l&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground shrink-0",children:a("pptx.chart.grouping")}),jsx("select",{disabled:!i,className:Uv,value:n??"clustered",onChange:c=>s({grouping:c.target.value}),children:use.map(c=>jsx("option",{value:c.value,children:a(c.labelKey)},c.value))})]})]})}function bse({selectedElement:t,canEdit:e,onUpdateElement:n}){let r=t.chartData,o=r?.title,i=r?.chartType,s=r?.categories,a=r?.series,l=r?.style,c=r?.grouping,d=useCallback(w=>{n({chartData:w});},[n]),u=useCallback(w=>{if(r){if(w.chartType&&w.chartType!==r.chartType){let C=SX(r,w.chartType),{chartType:T,...E}=w;d({...C,...E});return}n({chartData:{...r,...w}});}},[r,n,d]),p=useCallback(w=>{r&&n({chartData:{...r,style:{...l,...w}}});},[r,l,n]),f=useCallback((w,C)=>{if(!a)return;let T=a.map((E,M)=>M===w?{...E,...C}:E);u({series:T});},[a,u]),h=useCallback((w,C)=>{if(!s)return;let T=s.map((E,M)=>M===w?C:E);u({categories:T});},[s,u]),m=useCallback((w,C,T)=>{if(!r)return;let E=Number.parseFloat(T);Number.isFinite(E)&&d(vX(r,w,C,E));},[r,d]),x=useCallback(()=>{!r||!s||d(wX(r,`Cat ${s.length+1}`));},[r,s,d]),y=useCallback(w=>{!r||!s||s.length<=1||d(CX(r,w));},[r,s,d]),v=useCallback(()=>{!r||!s||!a||d(yX(r,{name:`Series ${a.length+1}`,values:s.map(()=>0)}));},[r,s,a,d]),S=useCallback(w=>{!r||!a||a.length<=1||d(bX(r,w));},[r,a,d]);return !r||!s||!a?null:jsxs(Fragment,{children:[jsx(yse,{title:o,chartType:i,grouping:c,seriesCount:a.length,categoryCount:s.length,canEdit:e,onUpdateChartData:u}),jsx(xse,{style:l,canEdit:e,onUpdateStyle:p}),jsx(gse,{categories:s,series:a,canEdit:e,onUpdateSeries:f,onUpdateCategoryLabel:h,onUpdateValue:m,onAddCategory:x,onRemoveCategory:y,onAddSeries:v,onRemoveSeries:S})]})}function vse({selectedElement:t,canEdit:e,onUpdateElementStyle:n}){return t.type!=="connector"?null:jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Connector"}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[["Start","connectorStartArrow"],["End","connectorEndArrow"]].map(([r,o])=>jsxs("label",{className:"flex flex-col gap-1",children:[jsxs("span",{className:"text-muted-foreground",children:[r," Arrow"]}),jsxs("select",{disabled:!e,className:le(Fn,"w-full"),value:t.shapeStyle?.[o]??"none",onChange:i=>n({[o]:i.target.value}),children:[jsx("option",{value:"none",children:"None"}),jsx("option",{value:"triangle",children:"Triangle"}),jsx("option",{value:"arrow",children:"Arrow"}),jsx("option",{value:"stealth",children:"Stealth"}),jsx("option",{value:"diamond",children:"Diamond"}),jsx("option",{value:"oval",children:"Oval"})]})]},o))})]})}function Sse({selectedElement:t}){if(t.type!=="group")return null;let e=t;return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Group"}),jsx("div",{className:"text-[11px] text-muted-foreground",children:Array.isArray(e.children)?`${e.children.length} children`:"Grouped element"})]})}function wse({selectedElement:t}){let{t:e}=useTranslation();if(t.type!=="ole")return null;let n=t;return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:e("pptx.ole.title")}),jsxs("div",{className:"space-y-1.5 text-[11px]",children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.type")}),jsx("span",{className:"text-foreground truncate",children:Ij(n.oleObjectType)})]}),n.fileName&&jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.fileName")}),jsx("span",{className:"text-foreground truncate",title:n.fileName,children:n.fileName})]}),jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:e("pptx.ole.linkStatus")}),jsx("span",{className:le("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-medium",n.isLinked?"bg-blue-500/20 text-blue-400":"bg-green-500/20 text-green-400"),children:n.isLinked?e("pptx.ole.linked"):e("pptx.ole.embedded")})]})]})]})}function Cse({selectedElement:t,canEdit:e,onUpdateElement:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Transform"}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Rotation (\xB0)"}),jsx("input",{type:"number",disabled:!e,className:Fn,value:Math.round(t.rotation||0),onChange:r=>n({rotation:Number(r.target.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Opacity"}),jsx("input",{type:"range",disabled:!e,min:0,max:100,value:Math.round((t.opacity??1)*100),className:"accent-primary",onChange:r=>n({opacity:Number(r.target.value)/100})})]})]})]})}function Tse({canEdit:t,onMoveLayer:e}){return jsxs("div",{className:"flex gap-1",children:[jsx("button",{type:"button",className:le("flex-1",Xr),disabled:!t,onClick:()=>e("forward"),children:"\u2191 Forward"}),jsx("button",{type:"button",className:le("flex-1",Xr),disabled:!t,onClick:()=>e("backward"),children:"\u2193 Backward"})]})}var sWe=[["none","pptx.image.effectNone",""],["blur","pptx.image.effectBlur","blur(4px)"],["grayscale","pptx.image.effectGrayscale","grayscale(100%)"],["sepia","pptx.image.effectSepia","sepia(100%)"],["pencilSketch","pptx.image.effectPencilSketch","grayscale(100%) contrast(150%) brightness(80%)"],["lineDrawing","pptx.image.effectLineDrawing","grayscale(100%) contrast(150%)"],["watercolorSponge","pptx.image.effectWatercolor","saturate(150%) blur(1px)"],["paintStrokes","pptx.image.effectPaintStrokes","blur(3px) saturate(140%)"],["glow_edges","pptx.image.effectGlowEdges","contrast(180%) invert(5%) brightness(110%)"],["glowDiffused","pptx.image.effectGlowDiffused","blur(3px) brightness(120%)"],["cement","pptx.image.effectCement","contrast(200%) brightness(60%)"],["photocopy","pptx.image.effectPhotocopy","grayscale(100%) contrast(200%) brightness(120%)"],["filmGrain","pptx.image.effectFilmGrain","contrast(110%) brightness(105%)"],["mosaic","pptx.image.effectMosaic","blur(8px) contrast(105%)"],["chalkSketch","pptx.image.effectChalk","grayscale(80%) contrast(140%) brightness(110%)"],["marker","pptx.image.effectMarker","contrast(130%) saturate(130%)"],["cutout","pptx.image.effectCutout","contrast(300%) brightness(120%)"],["pastelsSmooth","pptx.image.effectPastels","blur(4px) saturate(120%)"],["paint","pptx.image.effectPaint","blur(3px) saturate(160%) contrast(110%)"],["plasticWrap","pptx.image.effectPlasticWrap","contrast(150%) brightness(115%) saturate(80%)"],["lightScreen","pptx.image.effectLightScreen","brightness(130%) contrast(80%)"],["sharpen","pptx.image.effectSharpen","contrast(160%) brightness(105%)"],["texturizer","pptx.image.effectTexturizer","contrast(110%) brightness(105%)"],["crisscrossEtching","pptx.image.effectCrisscross","grayscale(60%) contrast(120%)"]];function _se({imgSrc:t,fx:e,canEdit:n,updateEffects:r}){let{t:o}=useTranslation();return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.image.artisticEffects")}),jsx("div",{className:"grid grid-cols-4 gap-1",children:sWe.map(([i,s,a])=>{let l=i==="none"?!e?.artisticEffect:e?.artisticEffect===i;return jsxs("button",{type:"button",disabled:!n,className:le("flex flex-col items-center gap-0.5 rounded border p-0.5 hover:bg-accent/50",l?"border-primary bg-primary/10":"border-border"),title:o(s),onClick:()=>r({artisticEffect:i==="none"?void 0:i,...i==="grayscale"?{grayscale:void 0}:{}}),children:[jsx("div",{className:"w-10 h-7 rounded overflow-hidden bg-muted",style:{backgroundImage:t?`url(${t})`:void 0,backgroundSize:"cover",backgroundPosition:"center",filter:a||void 0}}),jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full text-center",children:o(s)})]},i)})})]})}function es({value:t,disabled:e,className:n,onCommit:r}){let[o,i]=useState(t),s=useRef(r);s.current=r,useEffect(()=>{i(t);},[t]);let a=useCallback(d=>{i(d.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let d=c.current;if(!d)return;let u=()=>{s.current(d.value);};return d.addEventListener("change",u),()=>d.removeEventListener("change",u)},[]),jsx("input",{ref:c,type:"color",disabled:e,value:o,className:n,onChange:a,onBlur:l})}function Rse({fx:t,canEdit:e,updateEffects:n}){let{t:r}=useTranslation(),o=t?.clrChange;return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChange")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o,onChange:i=>n({clrChange:i.target.checked?{clrFrom:"#ffffff",clrTo:"#000000",clrToTransparent:false}:void 0})})]}),o&&jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeFrom")}),jsx(es,{disabled:!e,value:ut(o.clrFrom,"#ffffff"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({clrChange:{...o,clrFrom:i,clrTo:o.clrTo??"#000000"}})})]}),jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeTo")}),jsx(es,{disabled:!e||!!o.clrToTransparent,value:ut(o.clrTo,"#000000"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({clrChange:{...o,clrFrom:o.clrFrom??"#ffffff",clrTo:i}})})]}),jsxs("label",{className:"flex items-center justify-between gap-2 col-span-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorChangeTransparent")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o.clrToTransparent,onChange:i=>n({clrChange:{clrFrom:o.clrFrom??"#ffffff",clrTo:o.clrTo??"#000000",clrToTransparent:i.target.checked}})})]})]})]})}function kse({fx:t,canEdit:e,updateEffects:n}){let{t:r}=useTranslation(),o=t?.colorWash;return jsxs("div",{className:"space-y-1 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.colorWash")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o,onChange:i=>n({colorWash:i.target.checked?{color:"#0066cc",opacity:40}:void 0})})]}),o&&jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.washColor")}),jsx(es,{disabled:!e,value:ut(o.color,"#0066cc"),className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:i=>n({colorWash:{color:i,opacity:o.opacity??40}})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.washOpacity")}),jsx("input",{type:"range",min:0,max:100,disabled:!e,className:"accent-primary",value:o.opacity,onChange:i=>n({colorWash:{color:o.color??"#0066cc",opacity:Number(i.target.value)}})})]})]})]})}function Dse({value:t,disabled:e,className:n,onCommit:r}){let[o,i]=useState(t),s=useRef(r);s.current=r,useEffect(()=>{i(t);},[t]);let a=useCallback(d=>{i(d.target.value);},[]),l=useCallback(()=>{s.current(o);},[o]),c=useRef(null);return useEffect(()=>{let d=c.current;if(!d)return;let u=()=>{s.current(d.value);};return d.addEventListener("change",u),()=>d.removeEventListener("change",u)},[]),jsx("input",{ref:c,type:"color",disabled:e,className:n,value:o,onChange:a,onBlur:l})}function Lse({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o="imageEffects"in t?t.imageEffects:void 0,i=useCallback((c,d)=>{n({imageEffects:{...o,duotone:{color1:c,color2:d}}});},[o,n]),s=useCallback(()=>{n({imageEffects:{...o,duotone:void 0}});},[o,n]),a=ut(o?.duotone?.color1,"#000000"),l=ut(o?.duotone?.color2,"#ffffff");return jsxs("div",{className:"space-y-2 text-[11px]",children:[jsx("div",{className:"text-muted-foreground font-medium",children:r("pptx.image.duotone")}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("label",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.duotoneShadows")}),jsx(Dse,{disabled:!e,value:a,className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:c=>i(c,l)})]}),jsxs("label",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.image.duotoneHighlights")}),jsx(Dse,{disabled:!e,value:l,className:"h-6 w-8 rounded border border-border bg-transparent cursor-pointer",onCommit:c=>i(a,c)})]})]}),jsxs("div",{className:"space-y-1",children:[jsx("div",{className:"text-muted-foreground text-[10px]",children:r("pptx.image.duotonePresets")}),jsx("div",{className:"grid grid-cols-4 gap-1",children:See.map(c=>jsxs("button",{type:"button",disabled:!e,className:"flex flex-col items-center gap-0.5 rounded border border-border hover:bg-accent p-1 transition-colors",title:r(c.labelKey),onClick:()=>i(c.shadow,c.highlight),children:[jsxs("div",{className:"flex h-4 w-full rounded overflow-hidden",children:[jsx("div",{className:"flex-1",style:{backgroundColor:c.shadow}}),jsx("div",{className:"flex-1",style:{backgroundColor:c.highlight}})]}),jsx("span",{className:"text-[8px] text-muted-foreground truncate w-full text-center",children:r(c.labelKey)})]},c.labelKey))})]}),o?.duotone&&jsx("button",{type:"button",disabled:!e,className:"w-full rounded bg-muted hover:bg-accent border border-border px-2 py-1 text-foreground transition-colors",onClick:s,children:r("pptx.image.duotoneClear")})]})}function Fse({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=useMemo(()=>"imageEffects"in t?t.imageEffects:void 0,[t]),s=100-(o?.alphaModFix??100),a=o?.biLevel??0,l=o?.alphaModFix!==void 0||o?.biLevel!==void 0,c=useCallback(f=>{n({imageEffects:{...o,...f}});},[o,n]),d=useCallback(f=>{let h=Number(f.target.value);c({alphaModFix:100-h});},[c]),u=useCallback(f=>{c({biLevel:Number(f.target.value)});},[c]),p=useCallback(()=>{c({alphaModFix:void 0,biLevel:void 0});},[c]);return jsxs("div",{className:"space-y-3 text-[11px]",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-muted-foreground font-medium",children:r("pptx.imageAdjustments.title")}),l&&jsx("button",{type:"button",disabled:!e,className:"rounded bg-muted hover:bg-accent border border-border px-1.5 py-0.5 text-[10px] text-foreground disabled:opacity-50",onClick:p,children:r("common.reset")})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.imageAdjustments.transparency")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"accent-primary flex-1",value:s,onChange:d}),jsxs("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:[s,"%"]})]})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.imageAdjustments.biLevelThreshold")}),jsx("p",{className:"text-[10px] text-muted-foreground/70",children:r("pptx.imageAdjustments.biLevelDescription")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"accent-primary flex-1",value:a,onChange:u}),jsx("span",{className:"w-8 text-right tabular-nums text-muted-foreground",children:a})]})]})]})}function JI({label:t,disabled:e,value:n,onChange:r}){return jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"range",min:-100,max:100,disabled:e,className:"accent-primary",value:n,onChange:o=>r(Number(o.target.value))})]})}function Ose({selectedElement:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.imageEffects,i=s=>{n({imageEffects:{...o,...s}});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:r("pptx.image.properties")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:"Alt Text"}),jsx("textarea",{rows:2,disabled:!e,className:le(Fn,"resize-none text-[11px]"),value:t.altText??"",onChange:s=>n({altText:s.target.value})})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsx(JI,{label:"Brightness",disabled:!e,value:o?.brightness??0,onChange:s=>i({brightness:s})}),jsx(JI,{label:"Contrast",disabled:!e,value:o?.contrast??0,onChange:s=>i({contrast:s})}),jsx(JI,{label:r("pptx.image.saturation"),disabled:!e,value:o?.saturation??0,onChange:s=>i({saturation:s})})]}),jsx(Fse,{selectedElement:t,canEdit:e,onUpdateElement:n}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Grayscale"}),jsx("input",{type:"checkbox",disabled:!e,checked:!!o?.grayscale,onChange:s=>i({grayscale:s.target.checked})})]}),jsx(Lse,{selectedElement:t,canEdit:e,onUpdateElement:n})]}),jsx(kse,{fx:o,canEdit:e,updateEffects:i}),jsx(Rse,{fx:o,canEdit:e,updateEffects:i}),jsx(_se,{imgSrc:t.imageData,fx:o,canEdit:e,updateEffects:i}),jsx("button",{type:"button",disabled:!e,className:"w-full text-[11px] rounded bg-muted hover:bg-accent border border-border px-2 py-1 text-foreground",onClick:()=>n({imageEffects:{brightness:0,contrast:0,saturation:0,grayscale:false,artisticEffect:void 0,colorWash:void 0,alphaModFix:void 0,biLevel:void 0,duotone:void 0},cropShape:"none"}),children:r("pptx.image.resetImage")})]})]})}var vWe="text-[11px] uppercase tracking-wide text-muted-foreground",SWe="rounded border border-border bg-card p-2 space-y-2",wWe="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",CWe="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",TWe="flex items-center justify-between gap-2",Gse="text-muted-foreground";function QI(t){if(!Number.isFinite(t)||t<0)return "00:00";let e=Math.round(t/1e3),n=Math.floor(e/60),r=e%60;return `${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}`}function Hse(t){let e=t.trim();if(e.length===0)return;let n=e.indexOf(":");if(n>=0){let o=e.slice(0,n),i=e.slice(n+1),s=parseInt(o,10),a=parseInt(i,10);return !Number.isFinite(s)||!Number.isFinite(a)||s<0||a<0||a>=60?void 0:(s*60+a)*1e3}let r=parseInt(e,10);if(!(!Number.isFinite(r)||r<0))return r*1e3}function MWe(t,e,n){return t<0||e<0?"pptx.media.trimErrorNegative":e>0&&t>=e?"pptx.media.trimErrorStartAfterEnd":n>0&&t>n||n>0&&e>n?"pptx.media.trimErrorBeyondDuration":null}function zse({label:t,valueMs:e,maxMs:n,disabled:r,onChange:o}){let[i,s]=useState(null),[a,l]=useState(false),c=i??QI(e),d=useCallback(()=>{s(QI(e)),l(false);},[e]),u=useCallback(()=>{if(i!==null){let h=Hse(i);h!==void 0&&h>=0&&(n<=0||h<=n)&&o(h),l(false);}s(null);},[i,n,o]),p=useCallback(h=>{let m=h.target.value;s(m);let x=Hse(m);l(x===void 0);},[]),f=useCallback(h=>{h.key==="Enter"?h.currentTarget.blur():h.key==="Escape"&&(s(null),l(false));},[]);return jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Gse}`,children:t}),jsx("input",{type:"text",disabled:r,className:`${wWe} text-[11px] tabular-nums ${a?"border-red-400":""}`,value:c,placeholder:"00:00",onFocus:d,onBlur:u,onChange:p,onKeyDown:f})]})}function Vse({element:t,canEdit:e,durationSeconds:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=t.trimStartMs??0,s=t.trimEndMs??0,a=n*1e3,l=useMemo(()=>{let h=i,m=s>0?s:a;return m<=h||a<=0?QI(a):QI(m-h)},[i,s,a]),c=useMemo(()=>MWe(i,s,a),[i,s,a]),d=i>0||s>0,u=useCallback(h=>{r({trimStartMs:h});},[r]),p=useCallback(h=>{r({trimEndMs:h});},[r]),f=useCallback(()=>{r({trimStartMs:0,trimEndMs:0});},[r]);return jsxs("div",{className:SWe,children:[jsxs("div",{className:vWe,children:[jsx(LuScissors,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.trim")]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsx(zse,{label:o("pptx.media.trimStartTime"),valueMs:i,maxMs:a,disabled:!e,onChange:u}),jsx(zse,{label:o("pptx.media.trimEndTime"),valueMs:s,maxMs:a,disabled:!e,onChange:p})]}),jsxs("div",{className:TWe,children:[jsxs("span",{className:`text-[11px] ${Gse}`,children:[jsx(LuClock,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.trimmedDuration")]}),jsx("span",{className:"text-[11px] tabular-nums font-medium",children:l})]}),c&&jsx("div",{className:"text-[10px] text-red-400",children:o(c)}),e&&d&&jsx("button",{type:"button",className:`${CWe} w-full text-center`,onClick:f,children:o("pptx.media.resetTrim")})]})}function Hh(t){let e=Math.floor(t/60),n=Math.floor(t%60),r=Math.round(t%1*10);return `${e}:${String(n).padStart(2,"0")}.${r}`}function jse(){return `bmk-${Date.now()}-${Math.random().toString(36).slice(2,7)}`}var Vv="text-[11px] uppercase tracking-wide text-muted-foreground",jv="rounded border border-border bg-card p-2 space-y-2",oM="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full",eN="rounded bg-muted hover:bg-accent px-2 py-1 text-[11px] transition-colors",nc="flex items-center justify-between gap-2",Is="text-muted-foreground";function Xse({duration:t,trimStartMs:e,trimEndMs:n,currentTime:r,bookmarks:o,canEdit:i,onTrimChange:s,onSeek:a}){let l=useRef(null),[c,d]=useState(null),u=e/1e3,p=n>0?n/1e3:t,f=t>0?t:1,h=u/f*100,m=p/f*100,x=r/f*100,y=useCallback(S=>{let w=l.current;if(!w)return 0;let C=w.getBoundingClientRect();return Math.max(0,Math.min(1,(S-C.left)/C.width))*f},[f]);useEffect(()=>{if(!c)return;let S=C=>{let T=y(C.clientX);if(c==="start"){let E=Math.min(T,p-.1);s(Math.max(0,E)*1e3,n);}else {let E=Math.max(T,u+.1);s(e,Math.min(E,t)*1e3);}},w=()=>{d(null);};return window.addEventListener("pointermove",S),window.addEventListener("pointerup",w),()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",w);}},[c,t,y,s,n,p,e,u]);let v=S=>{let w=y(S.clientX);a(w);};return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[jsx("span",{children:Hh(u)}),jsx("span",{children:Hh(p)})]}),jsxs("div",{ref:l,className:"relative h-5 rounded bg-muted cursor-pointer select-none",onClick:v,children:[jsx("div",{className:"absolute top-0 bottom-0 bg-primary/30 rounded",style:{left:`${h}%`,width:`${m-h}%`}}),jsx("div",{className:"absolute top-0 bottom-0 w-0.5 bg-white z-10",style:{left:`${Math.min(x,100)}%`}}),i&&jsx("div",{className:"absolute top-0 bottom-0 w-2 bg-primary rounded-l cursor-ew-resize z-20 hover:bg-primary/80",style:{left:`calc(${h}% - 4px)`},onPointerDown:S=>{S.stopPropagation(),d("start");}}),i&&jsx("div",{className:"absolute top-0 bottom-0 w-2 bg-primary rounded-r cursor-ew-resize z-20 hover:bg-primary/80",style:{left:`calc(${m}% - 4px)`},onPointerDown:S=>{S.stopPropagation(),d("end");}}),o.map(S=>{let w=S.time/f*100;return jsx("div",{className:"absolute top-0 bottom-0 w-1 bg-yellow-400/70 z-10 cursor-pointer",style:{left:`${w}%`},title:S.label,onClick:C=>{C.stopPropagation(),a(S.time);}},S.id)})]})]})}function Yse({element:t,canEdit:e,currentTime:n,bookmarks:r,onUpdateElement:o,onSeekTo:i}){let{t:s}=useTranslation(),[a,l]=useState(""),c=Math.round((t.volume??1)*100),d=useCallback(()=>{let p=a.trim()||`${s("pptx.media.bookmark")} ${r.length+1}`,f={id:jse(),time:n,label:p};o({bookmarks:[...r,f]}),l("");},[r,n,a,o,s]),u=useCallback(p=>{o({bookmarks:r.filter(f=>f.id!==p)});},[r,o]);return jsxs(Fragment,{children:[jsxs("div",{className:jv,children:[jsx("div",{className:Vv,children:s("pptx.media.playback")}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.volume")}),jsxs("div",{className:"flex items-center gap-1 flex-1 max-w-[140px]",children:[jsx("input",{type:"range",min:0,max:100,step:1,disabled:!e,className:"flex-1",value:c,onChange:p=>o({volume:Number(p.target.value)/100})}),jsxs("span",{className:"text-[10px] text-muted-foreground w-7 text-right tabular-nums",children:[c,"%"]})]})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.speed")}),jsxs("select",{disabled:!e,className:`${oM} text-[11px] max-w-[100px]`,value:t.playbackSpeed??1,onChange:p=>o({playbackSpeed:Number(p.target.value)}),children:[jsx("option",{value:.25,children:"0.25x"}),jsx("option",{value:.5,children:"0.5x"}),jsx("option",{value:.75,children:"0.75x"}),jsx("option",{value:1,children:"1x"}),jsx("option",{value:1.25,children:"1.25x"}),jsx("option",{value:1.5,children:"1.5x"}),jsx("option",{value:2,children:"2x"}),jsx("option",{value:3,children:"3x"}),jsx("option",{value:4,children:"4x"})]})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fadeIn")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${oM} text-[11px]`,value:t.fadeInDuration??0,onChange:p=>o({fadeInDuration:Number(p.target.value)||void 0})})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fadeOut")}),jsx("input",{type:"number",min:0,step:.1,disabled:!e,className:`${oM} text-[11px]`,value:t.fadeOutDuration??0,onChange:p=>o({fadeOutDuration:Number(p.target.value)||void 0})})]})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.loop")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.loop,onChange:p=>o({loop:p.target.checked||void 0})})]}),jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.startTrigger")}),jsxs("select",{disabled:!e,className:"text-[11px] bg-transparent border border-border rounded px-1 py-0.5",value:t.autoPlay?"auto":"onClick",onChange:p=>o({autoPlay:p.target.value==="auto"||void 0}),children:[jsx("option",{value:"onClick",children:s("pptx.media.startOnClick")}),jsx("option",{value:"auto",children:s("pptx.media.startAutomatically")})]})]}),t.mediaType==="audio"&&jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.playAcrossSlides")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.playAcrossSlides,onChange:p=>o({playAcrossSlides:p.target.checked||void 0,...p.target.checked?{autoPlay:true}:{}})})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.fullScreen")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.fullScreen,onChange:p=>o({fullScreen:p.target.checked||void 0})})]}),jsxs("label",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:s("pptx.media.hideWhenNotPlaying")}),jsx("input",{type:"checkbox",disabled:!e,checked:!!t.hideWhenNotPlaying,onChange:p=>o({hideWhenNotPlaying:p.target.checked||void 0})})]})]}),jsxs("div",{className:jv,children:[jsxs("div",{className:Vv,children:[jsx(LuBookmark,{className:"inline w-3 h-3 mr-1"}),s("pptx.media.bookmarks")]}),r.length>0&&jsx("div",{className:"space-y-1 max-h-32 overflow-y-auto",children:r.slice().sort((p,f)=>p.time-f.time).map(p=>jsxs("div",{className:"flex items-center gap-1 text-[11px] group",children:[jsx("button",{type:"button",className:"text-primary hover:text-primary/80 truncate flex-1 text-left",onClick:()=>i(p.time),title:s("pptx.media.seekToBookmark"),children:p.label}),jsx("span",{className:"text-muted-foreground tabular-nums text-[10px]",children:Hh(p.time)}),e&&jsx("button",{type:"button",className:"opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-300 transition-opacity",onClick:()=>u(p.id),title:s("common.remove"),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},p.id))}),e&&jsxs("div",{className:"flex items-center gap-1",children:[jsx("input",{type:"text",className:`${oM} text-[11px]`,placeholder:s("pptx.media.bookmarkLabel"),value:a,onChange:p=>l(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),d());}}),jsx("button",{type:"button",className:eN,onClick:d,title:s("pptx.media.addBookmark"),children:jsx(LuPlus,{className:"w-3 h-3"})})]})]})]})}function Kse({element:t,mediaDataUrls:e,canEdit:n,onUpdateElement:r}){let{t:o}=useTranslation(),i=useRef(null),[s,a]=useState(false),[l,c]=useState(0),[d,u]=useState(0),p=t.mediaData??(t.mediaPath?e.get(t.mediaPath):void 0),f=t.bookmarks??[],h=t.mediaType==="video";useEffect(()=>{let w=i.current;if(!w)return;let C=()=>c(w.currentTime),T=()=>{Number.isFinite(w.duration)&&u(w.duration);},E=()=>a(true),M=()=>a(false),A=()=>a(false);return w.addEventListener("timeupdate",C),w.addEventListener("durationchange",T),w.addEventListener("loadedmetadata",T),w.addEventListener("play",E),w.addEventListener("pause",M),w.addEventListener("ended",A),()=>{w.removeEventListener("timeupdate",C),w.removeEventListener("durationchange",T),w.removeEventListener("loadedmetadata",T),w.removeEventListener("play",E),w.removeEventListener("pause",M),w.removeEventListener("ended",A);}},[p]);let m=useCallback(()=>{let w=i.current;w&&(w.paused?w.play():w.pause());},[]),x=useCallback(w=>{let C=i.current;C&&(C.currentTime=w,c(w));},[]),y=useCallback((w,C)=>{r({trimStartMs:w,trimEndMs:C});},[r]),[v,S]=useState(t.metadata);return useEffect(()=>{let w=i.current;if(!w)return;if(t.metadata?.duration!==void 0){S(t.metadata);return}let C=()=>{if(!Number.isFinite(w.duration)||w.duration===0)return;let T={duration:w.duration};w instanceof HTMLVideoElement&&(w.videoWidth>0&&(T.videoWidth=w.videoWidth),w.videoHeight>0&&(T.videoHeight=w.videoHeight));let E=w.querySelector("source");E?.type&&(T.codecInfo=E.type),t.metadata=T,S(T);};return w.addEventListener("loadedmetadata",C),w.readyState>=1&&C(),()=>{w.removeEventListener("loadedmetadata",C);}},[p,t]),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:jv,children:[jsx("div",{className:Vv,children:o("pptx.media.title")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:o(h?"pptx.media.videoClip":"pptx.media.audioClip")}),p&&jsxs("div",{className:"space-y-1",children:[h?jsx("video",{ref:i,className:"w-full rounded bg-black max-h-32 object-contain",src:p,preload:"metadata"}):jsx("audio",{ref:i,className:"w-full",src:p,preload:"metadata"}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",className:eN,onClick:m,title:o(s?"pptx.media.pause":"pptx.media.play"),children:s?jsx(LuPause,{className:"w-3 h-3"}):jsx(LuPlay,{className:"w-3 h-3"})}),jsxs("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:[Hh(l)," / ",Hh(d)]})]})]}),d>0&&jsx(Xse,{duration:d,trimStartMs:t.trimStartMs??0,trimEndMs:t.trimEndMs??0,currentTime:l,bookmarks:f,canEdit:n,onTrimChange:y,onSeek:x})]}),jsx(Vse,{element:t,canEdit:n,durationSeconds:d,onUpdateElement:r}),(v||t.posterFrameData)&&jsxs("div",{className:jv,children:[jsxs("div",{className:Vv,children:[jsx(LuInfo,{className:"inline w-3 h-3 mr-1"}),o("pptx.media.info")]}),t.posterFrameData&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:`text-[11px] ${Is}`,children:o("pptx.media.posterFrame")}),jsx("img",{src:t.posterFrameData,alt:o("pptx.media.posterFrame"),className:"w-full max-h-20 object-contain rounded bg-black/20"})]}),v?.duration!==void 0&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.duration")}),jsx("span",{className:"text-[11px] tabular-nums",children:Hh(v.duration)})]}),v?.videoWidth!==void 0&&v?.videoHeight!==void 0&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.resolution")}),jsxs("span",{className:"text-[11px] tabular-nums",children:[v.videoWidth," x ",v.videoHeight]})]}),v?.codecInfo&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.format")}),jsx("span",{className:"text-[11px] truncate max-w-[140px]",title:v.codecInfo,children:v.codecInfo})]}),t.mediaPath&&jsxs("div",{className:nc,children:[jsx("span",{className:`text-[11px] ${Is}`,children:o("pptx.media.filePath")}),jsx("span",{className:"text-[10px] truncate max-w-[140px] text-muted-foreground",title:t.mediaPath,children:t.mediaPath.split("/").pop()})]})]}),jsx(Yse,{element:t,canEdit:n,currentTime:l,bookmarks:f,onUpdateElement:r,onSeekTo:x})]})}function Zse({selectedElement:t,canEdit:e,onUpdateElement:n,onUpdateElementStyle:r,onUpdateTextStyle:o}){let{t:i}=useTranslation();return jsxs(Fragment,{children:[mn(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.shape.type","Shape Type")}),jsx("select",{value:t.shapeType||"rect",disabled:!e,className:le(Fn,"w-full"),onChange:s=>n({shapeType:s.target.value}),children:m1.filter(s=>s.type!=="connector").map(s=>jsx("option",{value:s.type,children:s.label},s.type))})]}),mn(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.shape.fillStroke","Fill & Stroke")}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Fill"}),jsx(es,{disabled:!e,value:ut(t.shapeStyle?.fillColor,"#3b82f6"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>r({fillColor:s,fillMode:"solid"})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Stroke"}),jsx(es,{disabled:!e,value:ut(t.shapeStyle?.strokeColor,"#1f2937"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>r({strokeColor:s})})]}),jsxs("label",{className:"flex items-center gap-1 col-span-2",children:[jsx("span",{className:"w-16 text-muted-foreground",children:"Stroke W"}),jsx("input",{type:"number",disabled:!e,className:Fn,min:0,max:20,value:t.shapeStyle?.strokeWidth??1,onChange:s=>r({strokeWidth:Number(s.target.value)})})]})]})]}),ot(t)&&jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:i("pptx.text.title","Text")}),jsxs("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Size"}),jsx("input",{type:"number",disabled:!e,className:Fn,min:6,max:200,value:t.textStyle?.fontSize??18,onChange:s=>o({fontSize:Number(s.target.value)})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Color"}),jsx(es,{disabled:!e,value:ut(t.textStyle?.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:s=>o({color:s})})]}),jsxs("div",{className:"flex gap-1 col-span-2",children:[jsx(U8,{label:"B",active:!!t.textStyle?.bold,disabled:!e,onClick:()=>o({bold:!t.textStyle?.bold})}),jsx(U8,{label:"I",active:!!t.textStyle?.italic,disabled:!e,italic:true,onClick:()=>o({italic:!t.textStyle?.italic})}),jsx(U8,{label:"U",active:!!t.textStyle?.underline,disabled:!e,underline:true,onClick:()=>o({underline:!t.textStyle?.underline})})]})]})]})]})}function U8({label:t,active:e,disabled:n,italic:r,underline:o,onClick:i}){return jsx("button",{type:"button",disabled:n,className:le("px-2 py-1 rounded text-[11px] transition-colors",r&&"italic",o&&"underline",e?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:i,children:t})}function GWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"2",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M14 16 L17 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("rect",{x:"19",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M31 16 L34 16",stroke:"currentColor",strokeWidth:"1.5",opacity:.5}),jsx("rect",{x:"36",y:"10",width:"10",height:"12",rx:"2",fill:"currentColor",opacity:.7})]})}function VWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"17",y:"2",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("path",{d:"M24 10 L12 18 M24 10 L36 18",stroke:"currentColor",strokeWidth:"1",opacity:.5}),jsx("rect",{x:"4",y:"18",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"30",y:"18",width:"14",height:"8",rx:"2",fill:"currentColor",opacity:.7})]})}function jWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("circle",{cx:"24",cy:"5",r:"4",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"37",cy:"20",r:"4",fill:"currentColor",opacity:.7}),jsx("circle",{cx:"11",cy:"20",r:"4",fill:"currentColor",opacity:.7}),jsx("path",{d:"M28 6 L34 17 M33 23 L14 23 M14 18 L20 7",stroke:"currentColor",strokeWidth:"1",opacity:.4,fill:"none"})]})}function XWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"4",y:"3",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"26",y:"3",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"18",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"26",y:"18",width:"18",height:"11",rx:"2",fill:"currentColor",opacity:.7})]})}function WWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"16",y:"2",width:"16",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"10",y:"12",width:"28",height:"8",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"22",width:"40",height:"8",rx:"2",fill:"currentColor",opacity:.7})]})}function YWe(){return jsxs("svg",{viewBox:"0 0 48 32",className:"w-full h-full",children:[jsx("rect",{x:"4",y:"3",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"13",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7}),jsx("rect",{x:"4",y:"23",width:"40",height:"7",rx:"2",fill:"currentColor",opacity:.7})]})}var Jse={process:GWe,hierarchy:VWe,cycle:jWe,matrix:XWe,pyramid:WWe,list:YWe};var KWe=VX.map(t=>({type:t,i18nKey:`pptx.smartart.category.${t}`}));function eae({smartArtData:t,canEdit:e,onUpdateSmartArt:n}){let{t:r}=useTranslation(),o=t.resolvedLayoutType??"list",i=s=>{if(!e||s===o)return;let a=jX(t,s);n({layoutType:a.layoutType,resolvedLayoutType:a.resolvedLayoutType,layout:a.layout});};return jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:r("pptx.smartart.switchLayout")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:KWe.map(({type:s,i18nKey:a})=>{let l=o===s,c=Jse[s];return jsxs("button",{type:"button",disabled:!e,className:le("flex flex-col items-center gap-0.5 rounded border p-1.5 transition-colors","text-[9px] leading-tight",l?"border-primary bg-primary/15 text-primary":"border-border text-muted-foreground hover:bg-muted hover:text-foreground",!e&&"opacity-50 cursor-not-allowed"),onClick:()=>i(s),title:r(a),children:[jsx("div",{className:"w-10 h-7",children:c?jsx(c,{}):null}),jsx("span",{className:"truncate w-full text-center",children:r(a)})]},s)})})]})}var JWe=["colorful1","colorful2","colorful3","monochromatic1","monochromatic2"],QWe=["flat","moderate","intense"];function tae({smartArtData:t,canEdit:e,onUpdateElement:n}){let{t:r}=useTranslation(),o=t.nodes??[],i=h=>{n({smartArtData:{...t,...h}});},s=h=>{n({smartArtData:h});},a=(h,m)=>{s(hX(t,h,m));},l=()=>{s(k5(t));},c=h=>{s(k5(t,h,"Sub-item"));},d=h=>{s(fX(t,h));},u=h=>{i({nodes:o.map(m=>m.id===h?{...m,parentId:void 0}:m),drawingShapes:void 0});},p=h=>{let m=o.filter(y=>!y.parentId),x=m.findIndex(y=>y.id===h);if(x>0){let y=m[x-1].id;i({nodes:o.map(v=>v.id===h?{...v,parentId:y}:v),drawingShapes:void 0});}},f=(h,m)=>{h.key==="Tab"&&!h.shiftKey?(h.preventDefault(),p(m)):h.key==="Tab"&&h.shiftKey&&(h.preventDefault(),u(m));};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:r("pptx.smartart.title")}),jsxs("div",{className:"space-y-2",children:[jsx(eae,{smartArtData:t,canEdit:e,onUpdateSmartArt:i}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.smartart.colorScheme")}),jsx("select",{disabled:!e,className:le(Fn,"w-full"),value:t.colorScheme??"colorful1",onChange:h=>i({colorScheme:h.target.value}),children:JWe.map(h=>jsx("option",{value:h,children:h},h))})]}),jsxs("label",{className:"flex flex-col gap-1 text-[11px]",children:[jsx("span",{className:"text-muted-foreground",children:r("pptx.smartart.style")}),jsx("div",{className:"flex gap-1",children:QWe.map(h=>jsx("button",{type:"button",disabled:!e,className:le("flex-1 px-2 py-1 text-[10px] rounded border transition-colors",(t.style??"flat")===h?"border-primary bg-primary/20 text-primary":"border-border text-muted-foreground hover:bg-muted"),onClick:()=>i({style:h}),children:h},h))})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsxs("span",{className:"text-[11px] text-muted-foreground",children:[r("pptx.smartart.textPane")," (",o.length,")"]}),jsx("button",{type:"button",disabled:!e,className:Xr,onClick:l,children:r("pptx.smartart.addItem")})]}),jsx("div",{className:"max-h-52 overflow-y-auto space-y-1 pr-1",children:o.map((h,m)=>{let x=!!h.parentId;return jsx("div",{className:le("rounded border bg-background/60 p-1.5",x?"border-border/60 ml-4":"border-border"),children:jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-[9px] text-muted-foreground w-3 shrink-0",children:x?"\u2022":`${m+1}`}),jsx("input",{type:"text",disabled:!e,className:le(Fn,"flex-1 text-[11px] py-0.5"),value:h.text,onChange:y=>a(h.id,y.target.value),onKeyDown:y=>f(y,h.id),placeholder:r("pptx.smartart.typePlaceholder")}),jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[!x&&jsx("button",{type:"button",disabled:!e,className:"text-[9px] text-muted-foreground hover:text-primary px-1",onClick:()=>c(h.id),title:r("pptx.smartart.addSubItem"),children:"+Sub"}),jsx("button",{type:"button",disabled:!e||o.length<=1,className:"text-[9px] text-muted-foreground hover:text-red-400 px-1",onClick:()=>d(h.id),title:r("pptx.smartart.remove"),children:"x"})]})]})},h.id)})}),jsx("div",{className:"text-[9px] text-muted-foreground mt-1",children:r("pptx.smartart.tabHint")})]})]})}function nae(t,e,n){let r=t.rows[e];if(!r)return null;let o=r.cells[n],i=Math.max(1,o?.gridSpan??1),s=n+i,a=r.cells[s];if(!a||a.hMerge||a.vMerge)return null;let l=Math.max(1,a.gridSpan??1);return t.rows.map((c,d)=>{if(d!==e)return c;let u=c.cells.map((p,f)=>f===n?{...p,gridSpan:i+l}:f>=s&&f<s+l?{...p,hMerge:true,text:""}:p);return {...c,cells:u}})}function rae(t,e,n){let r=t.rows[e];if(!r)return null;let o=r.cells[n];if(!o)return null;let i=Math.max(1,o.rowSpan??1),s=e+i;if(s>=t.rows.length)return null;let l=t.rows[s]?.cells[n];if(!l||l.hMerge||l.vMerge)return null;let c=Math.max(1,l.rowSpan??1);return t.rows.map((d,u)=>u===e?{...d,cells:d.cells.map((p,f)=>f===n?{...p,rowSpan:i+c}:p)}:u===s?{...d,cells:d.cells.map((p,f)=>f===n?{...p,vMerge:true,text:""}:p)}:d)}function oae(t,e,n){let r=t.rows[e],o=r?.cells[n];if(!r||!o)return null;let i=Math.max(1,o.gridSpan??1),s=Math.max(1,o.rowSpan??1);return i===1&&s===1?null:t.rows.map((a,l)=>{let c=a.cells.map((d,u)=>l===e&&u===n?{...d,gridSpan:void 0,rowSpan:void 0}:l===e&&u>n&&u<n+i?{...d,hMerge:void 0}:l>e&&l<e+s&&u===n?{...d,vMerge:void 0}:d);return {...a,cells:c}})}var nN="bg-muted border border-border rounded px-2 py-1 text-[11px] w-full",rN="flex-1 bg-muted border border-border rounded px-1.5 py-0.5 w-full text-[11px]",Vp="text-muted-foreground text-[11px]",iae="text-[11px] uppercase tracking-wide text-muted-foreground",sae=[{value:"solid",i18nKey:"pptx.table.fillSolid"},{value:"gradient",i18nKey:"pptx.table.fillGradient"},{value:"pattern",i18nKey:"pptx.table.fillPattern"},{value:"none",i18nKey:"pptx.table.fillNone"}],aae=[{value:"linear",i18nKey:"pptx.table.gradientLinear"},{value:"radial",i18nKey:"pptx.table.gradientRadial"}],lae=oF.slice(0,20);function cae({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.fillMode??"solid",i=s=>{let a=s;n(a==="gradient"?{fillMode:"gradient",gradientFillType:t.gradientFillType??"linear",gradientFillAngle:t.gradientFillAngle??90,gradientFillStops:t.gradientFillStops??[{color:"#FF0000",position:0},{color:"#0000FF",position:100}]}:a==="pattern"?{fillMode:"pattern",patternFillPreset:t.patternFillPreset??"ltDnDiag",patternFillForeground:t.patternFillForeground??"#000000",patternFillBackground:t.patternFillBackground??"#FFFFFF"}:{fillMode:a});};return jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:Vp,children:r("pptx.table.fillMode")}),jsx("select",{disabled:!e,className:nN,value:o,onChange:s=>i(s.target.value),children:sae.map(s=>jsx("option",{value:s.value??"",children:r(s.i18nKey)},s.value))})]}),o==="gradient"&&jsx(e7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),o==="pattern"&&jsx(t7e,{cellStyle:t,canEdit:e,onUpdateCellStyle:n}),jsxs("div",{className:"space-y-1",children:[jsx("span",{className:iae,children:r("pptx.table.margins")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:[["marginTop","pptx.table.marginTop"],["marginBottom","pptx.table.marginBottom"],["marginLeft","pptx.table.marginLeft"],["marginRight","pptx.table.marginRight"]].map(([s,a])=>jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r(a)}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:200,value:t[s]??0,onChange:l=>n({[s]:Number(l.target.value)})})]},s))})]})]})}function e7e({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation(),o=t.gradientFillStops??[],i=t.gradientFillType??"linear",s=(l,c)=>{let d=o.map((u,p)=>p===l?{...u,...c}:u);n({gradientFillStops:d});},a=()=>{n({gradientFillStops:[...o,{color:"#888888",position:50}]});};return jsxs("div",{className:"space-y-1.5",children:[jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.gradientType")}),jsx("select",{disabled:!e,className:nN,value:i,onChange:l=>n({gradientFillType:l.target.value}),children:aae.map(l=>jsx("option",{value:l.value,children:r(l.i18nKey)},l.value))})]}),i==="linear"&&jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.gradientAngle")}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:360,value:t.gradientFillAngle??90,onChange:l=>n({gradientFillAngle:Number(l.target.value)})})]})]}),jsx("span",{className:Vp,children:r("pptx.table.gradientStops")}),o.map((l,c)=>jsxs("div",{className:"flex items-center gap-1",children:[jsx("input",{type:"color",disabled:!e,className:"h-6 w-6 rounded border border-border cursor-pointer",value:l.color,onChange:d=>s(c,{color:d.target.value})}),jsx("input",{type:"number",disabled:!e,className:rN,min:0,max:100,value:Math.round(l.position),onChange:d=>s(c,{position:Number(d.target.value)})}),jsx("span",{className:"text-[10px] text-muted-foreground",children:"%"})]},c)),jsx("button",{type:"button",disabled:!e,className:"text-[10px] text-primary hover:underline",onClick:a,children:r("pptx.table.gradientAddStop")})]})}function t7e({cellStyle:t,canEdit:e,onUpdateCellStyle:n}){let{t:r}=useTranslation();return jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternPreset")}),jsx("select",{disabled:!e,className:nN,value:t.patternFillPreset??"ltDnDiag",onChange:o=>n({patternFillPreset:o.target.value}),children:lae.map(o=>jsx("option",{value:o,children:o},o))})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternForeground")}),jsx("input",{type:"color",disabled:!e,className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",value:t.patternFillForeground??"#000000",onChange:o=>n({patternFillForeground:o.target.value})})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:Vp,children:r("pptx.table.patternBackground")}),jsx("input",{type:"color",disabled:!e,className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",value:t.patternFillBackground??"#FFFFFF",onChange:o=>n({patternFillBackground:o.target.value})})]})]})]})}function dae({tableData:t,tableEditorState:e,canEdit:n,onUpdateTableData:r}){let{t:o}=useTranslation(),{rowIndex:i,columnIndex:s}=e,a=t.rows[i]?.cells[s];if(!a)return null;let l=a.style??{},c=d=>{let u=t.rows.map((p,f)=>f!==i?p:{...p,cells:p.cells.map((h,m)=>m!==s?h:{...h,style:{...l,...d}})});r({rows:u});};return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.cell",{row:i+1,col:s+1})}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-10 text-muted-foreground",children:o("pptx.table.fontSize")}),jsx("input",{type:"number",disabled:!n,className:Fn,min:6,max:200,value:l.fontSize??14,onChange:d=>c({fontSize:Number(d.target.value)})})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.color")}),jsx(es,{disabled:!n,value:ut(l.color,"#000000"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:d=>c({color:d})})]}),jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:o("pptx.table.background")}),jsx(es,{disabled:!n,value:ut(l.backgroundColor,"#ffffff"),className:"w-full h-7 rounded border border-border bg-transparent cursor-pointer",onCommit:d=>c({backgroundColor:d})})]})]}),jsx(cae,{cellStyle:l,canEdit:n,onUpdateCellStyle:c}),jsx("div",{className:"flex gap-1",children:[["bold","B","font-bold"],["italic","I","italic"],["underline","U","underline"]].map(([d,u,p])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",p,l[d]?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({[d]:!l[d]}),children:u},d))}),jsx("div",{className:"flex gap-1",children:[["left","L"],["center","C"],["right","R"]].map(([d,u])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",l.align===d?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({align:d}),children:u},d))}),jsx("div",{className:"flex gap-1",children:[["top","T"],["middle","M"],["bottom","B"]].map(([d,u])=>jsx("button",{type:"button",disabled:!n,className:le("px-2 py-1 rounded text-[11px] transition-colors",l.vAlign===d?"bg-primary text-white":"bg-muted hover:bg-accent"),onClick:()=>c({vAlign:d}),children:u},d))}),jsxs("div",{className:"space-y-1.5",children:[jsx("span",{className:"text-muted-foreground text-[11px]",children:o("pptx.table.cellBorders")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:[["Top","borderTopColor","borderTopWidth"],["Bottom","borderBottomColor","borderBottomWidth"],["Left","borderLeftColor","borderLeftWidth"],["Right","borderRightColor","borderRightWidth"]].map(([d,u,p])=>jsxs("div",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:o(`pptx.table.border${d}`)}),jsxs("div",{className:"flex gap-1 items-center",children:[jsx(es,{disabled:!n,value:ut(l[u],"#374151"),className:"w-7 h-6 rounded border border-border bg-transparent cursor-pointer shrink-0",onCommit:f=>c({[u]:f})}),jsx("input",{type:"number",disabled:!n,className:le(Fn,"w-14"),min:0,max:10,value:l[p]??1,onChange:f=>c({[p]:Number(f.target.value)})})]})]},d))})]}),jsxs("div",{className:"grid grid-cols-3 gap-1",children:[jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let d=nae(t,i,s);d&&r({rows:d});},children:o("pptx.table.mergeRight")}),jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let d=rae(t,i,s);d&&r({rows:d});},children:o("pptx.table.mergeDown")}),jsx("button",{type:"button",disabled:!n,className:le(Xr,"text-center"),onClick:()=>{let d=oae(t,i,s);d&&r({rows:d});},children:o("pptx.table.split")})]})]})]})}function uae({tableElement:t,canEdit:e,onUpdateElement:n,tableEditorState:r}){let{t:o}=useTranslation(),i=t.tableData;if(!i)return null;let s=i.rows.length,a=i.columnWidths.length,l=c=>{n({tableData:{...i,...c}});};return jsxs(Fragment,{children:[jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.title")}),jsx("div",{className:"text-[11px] text-muted-foreground mb-2",children:o("pptx.table.rowsColumns",{rows:s,cols:a})}),jsx("div",{className:"space-y-1",children:[["bandedRows","pptx.table.bandedRows"],["firstRowHeader","pptx.table.headerRow"],["bandedColumns","pptx.table.bandedColumns"],["firstCol","pptx.table.firstColumn"],["lastCol","pptx.table.lastColumn"],["lastRow","pptx.table.lastRow"]].map(([c,d])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",disabled:!e,checked:!!i[c],onChange:u=>l({[c]:u.target.checked}),className:"accent-primary"}),jsx("span",{className:"text-[11px]",children:o(d)})]},c))}),i.bandedRows&&jsxs("label",{className:"flex items-center gap-2 mt-1",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:o("pptx.table.bandRowCycle")}),jsx("input",{type:"number",min:1,max:99,disabled:!e,value:i.bandRowCycle??1,onChange:c=>l({bandRowCycle:Math.max(1,parseInt(c.target.value,10)||1)}),className:"w-14 rounded border border-border bg-background px-1 py-0.5 text-[11px]"})]}),i.bandedColumns&&jsxs("label",{className:"flex items-center gap-2 mt-1",children:[jsx("span",{className:"text-[11px] text-muted-foreground",children:o("pptx.table.bandColCycle")}),jsx("input",{type:"number",min:1,max:99,disabled:!e,value:i.bandColCycle??1,onChange:c=>l({bandColCycle:Math.max(1,parseInt(c.target.value,10)||1)}),className:"w-14 rounded border border-border bg-background px-1 py-0.5 text-[11px]"})]})]}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:o("pptx.table.stylePresets")}),jsx("div",{className:"grid grid-cols-3 gap-1.5",children:DW.map(c=>jsx("button",{type:"button",disabled:!e,title:c.label,className:"rounded border border-border hover:border-primary overflow-hidden h-10 transition-colors",onClick:()=>{let d=i.rows.map((u,p)=>({...u,cells:u.cells.map(f=>({...f,style:{...f.style,backgroundColor:p===0&&i.firstRowHeader?c.headerBg:i.bandedRows&&(p-(i.firstRowHeader?1:0))%2===0?c.bandBg:void 0,color:p===0&&i.firstRowHeader?c.headerFg:f.style?.color,bold:p===0&&i.firstRowHeader?true:f.style?.bold,borderColor:c.borderColor}}))}));l({rows:d});},children:jsxs("div",{className:"flex flex-col h-full",children:[jsx("div",{className:"flex-1",style:{backgroundColor:c.headerBg}}),jsx("div",{className:"flex-1",style:{backgroundColor:c.bandBg}}),jsx("div",{className:"flex-1 border-t",style:{borderColor:c.borderColor}})]})},c.id))})]}),jsxs("div",{className:xn,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:hn,children:o("pptx.table.columnWidths")}),jsx("button",{type:"button",className:Xr,disabled:!e,onClick:()=>{let c=1/a;l({columnWidths:Array(a).fill(c)});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.columnWidths.map((c,d)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:d+1}),jsx("input",{type:"range",disabled:!e,min:5,max:80,value:Math.round(c*100),className:"flex-1 accent-primary",onChange:u=>{let p=Number(u.target.value)/100,f=i.columnWidths[d],h=p-f,m=[...i.columnWidths];m[d]=p;let x=1-f;if(x>0)for(let S=0;S<m.length;S++)S!==d&&(m[S]=Math.max(.05,i.columnWidths[S]-h*(i.columnWidths[S]/x)));let y=m.reduce((S,w)=>S+w,0),v=m.map(S=>S/y);l({columnWidths:v});}}),jsxs("span",{className:"w-10 text-right text-muted-foreground",children:[Math.round(c*100),"%"]})]},d))})]}),jsxs("div",{className:xn,children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("div",{className:hn,children:o("pptx.table.rowHeights")}),jsx("button",{type:"button",className:Xr,disabled:!e,onClick:()=>{let c=Math.round(i.rows.reduce((d,u)=>d+(u.height??32),0)/s);l({rows:i.rows.map(d=>({...d,height:c}))});},children:o("pptx.table.even")})]}),jsx("div",{className:"space-y-1",children:i.rows.map((c,d)=>jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-6 text-muted-foreground shrink-0",children:d+1}),jsx("input",{type:"number",disabled:!e,className:Fn,min:16,max:500,value:c.height??32,onChange:u=>{let p=i.rows.map((f,h)=>h===d?{...f,height:Number(u.target.value)}:f);l({rows:p});}}),jsx("span",{className:"w-6 text-muted-foreground",children:"px"})]},d))})]}),r&&jsx(dae,{tableData:i,tableEditorState:r,canEdit:e,onUpdateTableData:l})]})}function pae({selectedElement:t,canEdit:e,slides:n,tableEditorState:r,mediaDataUrls:o,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a,onMoveLayer:l}){let{t:c}=useTranslation();return jsxs(Fragment,{children:[jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:c("pptx.inspector.element")}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:ase.map(([d,u])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-4 text-muted-foreground",children:d}),jsx("input",{type:"number",className:Fn,disabled:!e,value:Math.round(t[u]??0),onChange:p=>i({[u]:Number(p.target.value)})})]},u))})]}),t.type==="table"&&jsx(uae,{tableElement:t,canEdit:e,onUpdateElement:i,tableEditorState:r}),t.type==="chart"&&jsx(bse,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="smartArt"&&t.smartArtData&&jsx(tae,{smartArtData:t.smartArtData,canEdit:e,onUpdateElement:i}),yi(t)&&jsx(Ose,{selectedElement:t,canEdit:e,onUpdateElement:i}),t.type==="media"&&jsx(Kse,{element:t,mediaDataUrls:o??new Map,canEdit:e,onUpdateElement:i}),jsx(vse,{selectedElement:t,canEdit:e,onUpdateElementStyle:s}),jsx(Sse,{selectedElement:t}),jsx(wse,{selectedElement:t}),jsx(Zse,{selectedElement:t,canEdit:e,onUpdateElement:i,onUpdateElementStyle:s,onUpdateTextStyle:a}),jsx(cse,{selectedElement:t,slides:n,canEdit:e,onUpdateElement:i}),jsx(Cse,{selectedElement:t,canEdit:e,onUpdateElement:i}),jsx(Tse,{canEdit:e,onMoveLayer:l})]})}function z8({comment:t,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:d,onDeleteComment:u,onToggleCommentResolved:p,onStartReply:f,onCancelReply:h,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:y,depth:v=0}){let{t:S}=useTranslation(),w=r===t.id,C=i===t.id,T=s[t.id]??"",[E,M]=useState(true),A=t.replies??[],R=t.elementId?n?.elements?.find(k=>k.id===t.elementId)??null:null;return jsxs("div",{className:le("rounded border border-border bg-card p-2",v>0&&"ml-3 border-l-2 border-l-primary/40"),children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[jsx("span",{className:"text-[11px] font-medium text-foreground truncate",children:t.author||"Author"}),t.resolved&&jsxs("span",{className:"inline-flex items-center gap-0.5 rounded-full bg-green-900/40 px-1.5 py-0.5 text-[9px] font-medium text-green-300 flex-shrink-0",children:[jsx(LuCheck,{className:"h-2.5 w-2.5"}),S("pptx.comments.resolved")]})]}),jsx("span",{className:"text-[10px] text-muted-foreground flex-shrink-0",children:F7(t.createdAt)})]}),t.elementId&&(R?jsxs("button",{type:"button",className:"mt-1 inline-flex items-center gap-1 rounded bg-primary/20 px-1.5 py-0.5 text-[10px] text-primary hover:bg-primary/30 transition-colors",title:S("pptx.comments.commentingOn",{element:cs(R)}),onClick:()=>y(R.id),children:[jsx(LuType,{className:"h-2.5 w-2.5"}),cs(R)]}):jsx("span",{className:"mt-1 inline-flex items-center gap-1 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] text-muted-foreground",children:S("pptx.comments.deletedElement")})),w?jsxs("div",{className:"mt-1.5 space-y-1.5",children:[jsx("textarea",{value:o,onChange:k=>d(k.target.value),rows:3,className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground outline-none focus:border-primary resize-y"}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>l(t.id),disabled:String(o).trim().length===0,children:S("pptx.comments.save")}),jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent",onClick:c,children:S("pptx.comments.cancel")})]})]}):jsxs(Fragment,{children:[jsx("div",{className:"mt-1 whitespace-pre-wrap break-words text-[11px] text-foreground",children:t.text}),e&&jsxs("div",{className:"mt-1.5 inline-flex items-center rounded bg-muted overflow-hidden",children:[jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 hover:bg-accent text-foreground hover:text-foreground transition-colors",onClick:()=>a(t.id),title:S("pptx.comments.edit"),children:jsx(LuPencil,{className:"h-3 w-3"})}),f&&v===0&&jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 border-l border-border hover:bg-accent text-foreground hover:text-foreground transition-colors",onClick:()=>f(t.id),title:S("pptx.comments.reply"),children:jsx(LuReply,{className:"h-3 w-3"})}),p&&jsx("button",{type:"button",className:le("inline-flex items-center justify-center p-1.5 border-l border-border transition-colors",t.resolved?"bg-green-900/40 text-green-300 hover:bg-green-900/60":"hover:bg-accent text-foreground hover:text-foreground"),onClick:()=>p(t.id),title:t.resolved?S("pptx.comments.unresolve"):S("pptx.comments.resolve"),children:jsx(LuCheck,{className:"h-3 w-3"})}),jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1.5 border-l border-border hover:bg-red-900/40 text-muted-foreground hover:text-red-300 transition-colors",onClick:()=>u(t.id),title:S("pptx.comments.delete"),children:jsx(LuTrash2,{className:"h-3 w-3"})})]})]}),A.length>0&&jsxs("div",{className:"mt-2",children:[jsxs("button",{type:"button",className:"flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",onClick:()=>M(k=>!k),children:[E?jsx(LuChevronDown,{className:"h-3 w-3"}):jsx(LuChevronRight,{className:"h-3 w-3"}),S("pptx.comments.repliesCount",{count:A.length})]}),E&&jsx("div",{className:"mt-1.5 space-y-1.5",children:A.map((k,N)=>jsx(z8,{comment:k,canEdit:e,activeSlide:n,editingCommentId:r,commentEditDraft:o,replyingToCommentId:i,replyDraftByCommentId:s,onStartEditComment:a,onSaveEditComment:l,onCancelEditComment:c,onSetCommentEditDraft:d,onDeleteComment:u,onToggleCommentResolved:p,onStartReply:f,onCancelReply:h,onReplyDraftChange:m,onSubmitReply:x,onSelectElement:y,depth:v+1},`${k.id}-${N}`))})]}),C&&h&&m&&x&&jsxs("div",{className:"mt-2 space-y-1.5 pl-3 border-l-2 border-l-primary/40",children:[jsx("textarea",{value:T,onChange:k=>m(t.id,k.target.value),rows:2,placeholder:S("pptx.comments.replyPlaceholder",{author:t.author||"Author"}),className:"w-full rounded border border-border bg-background px-2 py-1.5 text-xs text-foreground outline-none focus:border-primary resize-y",onKeyDown:k=>{k.key==="Enter"&&(k.metaKey||k.ctrlKey)&&(k.preventDefault(),x(t.id));}}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-primary px-2 py-1 text-[11px] text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed",onClick:()=>x(t.id),disabled:T.trim().length===0,children:[jsx(LuReply,{className:"h-3 w-3"}),S("pptx.comments.addReply")]}),jsx("button",{type:"button",className:"inline-flex items-center gap-1 rounded bg-muted px-2 py-1 text-[11px] text-foreground hover:bg-accent",onClick:h,children:S("pptx.comments.cancel")})]})]})]})}function mae({comments:t,canEdit:e,activeSlide:n,selectedElement:r,editingCommentId:o,commentEditDraft:i,commentDraft:s,replyingToCommentId:a,replyDraftByCommentId:l,onSetCommentDraft:c,onAddComment:d,onDeleteComment:u,onStartEditComment:p,onSaveEditComment:f,onCancelEditComment:h,onSetCommentEditDraft:m,onToggleCommentResolved:x,onStartReply:y,onCancelReply:v,onReplyDraftChange:S,onSubmitReply:w,onSelectElement:C}){let{t:T}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:T("pptx.comments.slideComments")}),jsx("div",{className:"text-[11px] text-muted-foreground",children:t.length})]}),t.length===0?jsx("div",{className:"text-xs text-muted-foreground",children:T("pptx.comments.noComments")}):jsx("div",{className:"space-y-2 max-h-[42vh] overflow-y-auto pr-1",children:t.map((M,A)=>jsx(z8,{comment:M,canEdit:e,activeSlide:n,editingCommentId:o,commentEditDraft:i,replyingToCommentId:a,replyDraftByCommentId:l,onStartEditComment:p,onSaveEditComment:f,onCancelEditComment:h,onSetCommentEditDraft:m,onDeleteComment:u,onToggleCommentResolved:x,onStartReply:y,onCancelReply:v,onReplyDraftChange:S,onSubmitReply:w,onSelectElement:C},`${M.id}-${A}`))}),e&&jsxs("div",{className:"space-y-1.5 pt-1 border-t border-border",children:[r&&jsxs("div",{className:"inline-flex items-center gap-1 rounded bg-primary/20 px-1.5 py-0.5 text-[10px] text-primary",children:[jsx(LuType,{className:"h-2.5 w-2.5"}),T("pptx.comments.commentingOn",{element:cs(r)})]}),jsx("textarea",{rows:2,placeholder:r?T("pptx.comments.addOnElement",{element:cs(r)}):T("pptx.comments.addPlaceholder"),value:s,className:"w-full bg-muted border border-border rounded px-2 py-1 text-xs resize-y outline-none focus:border-primary",onChange:M=>c(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.metaKey||M.ctrlKey)&&(M.preventDefault(),d());}}),jsxs("button",{type:"button",onClick:d,disabled:!s.trim(),className:le("w-full inline-flex items-center justify-center gap-1 rounded px-2 py-1 text-[11px] font-medium transition-colors",s.trim()?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:[jsx(LuMessageSquare,{className:"w-3.5 h-3.5"}),T("pptx.comments.addComment")]})]})]})}function G8({label:t,value:e}){return jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("span",{children:t}),jsx("span",{className:"text-muted-foreground",children:e})]})}function oN({label:t,disabled:e,value:n,onChange:r}){return jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"text",className:Fn,disabled:e,value:n,onChange:o=>r(o.target.value)})]})}function y7e({customProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:"text-muted-foreground",children:"Custom Properties"}),e&&jsx("button",{type:"button",className:Xr,onClick:()=>n([...t,{name:`Property ${t.length+1}`,value:"",type:"lpwstr"}]),children:"Add"})]}),t.length===0?jsx("div",{className:"text-[10px] text-muted-foreground",children:"No custom properties"}):t.map((r,o)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1",children:[jsx("input",{type:"text",className:Fn,disabled:!e,value:r.name,onChange:i=>n(t.map((s,a)=>a===o?{...s,name:i.target.value}:s))}),jsx("input",{type:"text",className:Fn,disabled:!e,value:r.value,onChange:i=>n(t.map((s,a)=>a===o?{...s,value:i.target.value}:s))}),e&&jsx("button",{type:"button",className:le(Xr,"px-1.5 text-red-400 hover:text-red-300"),onClick:()=>n(t.filter((i,s)=>s!==o)),children:"\xD7"})]},`${r.name}-${o}`))]})}function gae({notesCanvasSize:t,notesMaster:e,handoutMaster:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Notes & Handout"}),jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[jsx(G8,{label:"Notes Size",value:t?`${t.width} \xD7 ${t.height}px`:"Not available"}),jsx(G8,{label:"Notes Master",value:e?`${e.placeholders?.length??0} placeholders`:"Not available"}),jsx(G8,{label:"Handout Master",value:n?`${n.placeholders?.length??0} placeholders`:"Not available"})]})]})}function xae({coreProperties:t,appProperties:e,customProperties:n,canEdit:r,onUpdateCoreProperties:o,onUpdateAppProperties:i,onUpdateCustomProperties:s}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Document"}),jsxs("div",{className:"space-y-2 text-[11px] text-muted-foreground",children:[jsx(oN,{label:"Title",disabled:!r,value:t?.title??"",onChange:a=>o({title:a})}),jsx(oN,{label:"Author",disabled:!r,value:t?.creator??"",onChange:a=>o({creator:a})}),jsx(oN,{label:"Company",disabled:!r,value:e?.company??"",onChange:a=>i({company:a})}),jsx(oN,{label:"Application",disabled:!r,value:e?.application??"",onChange:a=>i({application:a})}),jsx(y7e,{customProperties:n,canEdit:r,onUpdate:s})]})]})}function iN({label:t,disabled:e,checked:n,onChange:r}){return jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:t}),jsx("input",{type:"checkbox",disabled:e,checked:n,onChange:o=>r(o.target.checked)})]})}function yae({presentationProperties:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Presentation"}),jsxs("div",{className:"space-y-1.5 text-[11px]",children:[jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Show Type"}),jsxs("select",{disabled:!e,className:le(Fn,"w-28"),value:t.showType??"presented",onChange:r=>n({showType:r.target.value}),children:[jsx("option",{value:"presented",children:"Presented"}),jsx("option",{value:"browsed",children:"Browsed"}),jsx("option",{value:"kiosk",children:"Kiosk"})]})]}),jsx(iN,{label:"Loop Continuously",disabled:!e,checked:!!t.loopContinuously,onChange:r=>n({loopContinuously:r})}),jsx(iN,{label:"Show Narration",disabled:!e,checked:t.showWithNarration!==false,onChange:r=>n({showWithNarration:r})}),jsx(iN,{label:"Show Animation",disabled:!e,checked:t.showWithAnimation!==false,onChange:r=>n({showWithAnimation:r})}),jsx(iN,{label:"Frame Slides",disabled:!e,checked:!!t.printFrameSlides,onChange:r=>n({printFrameSlides:r})}),jsxs("label",{className:"flex items-center justify-between gap-2",children:[jsx("span",{className:"text-muted-foreground",children:"Slides/Page"}),jsx("input",{type:"number",min:1,max:16,disabled:!e,className:le(Fn,"w-20"),value:t.printSlidesPerPage??1,onChange:r=>n({printSlidesPerPage:Number(r.target.value)})})]})]})]})}function bae({themeOptions:t,selectedThemePath:e,setSelectedThemePath:n,canEdit:r,onApplyTheme:o}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Theme"}),jsxs("div",{className:"space-y-2 text-[11px]",children:[jsxs("label",{className:"flex flex-col gap-1",children:[jsx("span",{className:"text-muted-foreground",children:"Theme"}),jsx("select",{disabled:t.length===0,className:Fn,value:e,onChange:i=>n(i.target.value),children:t.length===0?jsx("option",{value:"",children:"No themes"}):t.map(i=>jsx("option",{value:i.path,children:i.name||i.path.split("/").pop()},i.path))})]}),jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[jsx("button",{type:"button",className:Xr,disabled:!r||!e,onClick:()=>o(e,false),children:"Apply First Master"}),jsx("button",{type:"button",className:Xr,disabled:!r||!e,onClick:()=>o(e,true),children:"Apply All Masters"})]})]})]})}function vae({canvasSize:t,canEdit:e,onUpdate:n}){return jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:"Slide Size"}),jsx("div",{className:"grid grid-cols-2 gap-1.5 text-[11px]",children:[["W","width"],["H","height"]].map(([r,o])=>jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:r}),jsx("input",{type:"number",className:Fn,disabled:!e,value:t[o],onChange:i=>n({...t,[o]:Number(i.target.value)})})]},o))})]})}var Sae={bg1:"Background 1",tx1:"Text 1",bg2:"Background 2",tx2:"Text 2",accent1:"Accent 1",accent2:"Accent 2",accent3:"Accent 3",accent4:"Accent 4",accent5:"Accent 5",accent6:"Accent 6",hlink:"Hyperlink",folHlink:"Followed Hyperlink"};function wae({activeSlide:t,theme:e,canEdit:n,onUpdateSlide:r}){let{t:o}=useTranslation(),i=t?.clrMapOverride,s=uX(i),a=useMemo(()=>[...Mf],[]),l=useCallback(u=>{if(u){let p={};for(let f of Iu)p[f]=Nu[f];r({clrMapOverride:p});}else r({clrMapOverride:void 0});},[r]),c=useCallback((u,p)=>{let h={...i??{},[u]:p};for(let m of Iu)h[m]||(h[m]=Nu[m]);r({clrMapOverride:h});},[i,r]),d=useCallback(u=>e?.colorScheme?e.colorScheme[u]:void 0,[e]);return t?jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:"inline-flex items-center gap-2 text-xs",children:[jsx("input",{type:"checkbox",disabled:!n,checked:s,onChange:u=>l(u.target.checked)}),o("pptx.themeOverride.enableOverride")]}),s&&i&&jsx("div",{className:"space-y-1.5",children:Iu.map(u=>{let p=i[u]??Nu[u],f=d(p);return jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"w-24 truncate text-muted-foreground",title:Sae[u],children:Sae[u]}),jsx("div",{className:"h-4 w-4 rounded-sm border border-border shrink-0",style:{backgroundColor:f?`#${f.replace(/^#/,"")}`:void 0}}),jsx("select",{disabled:!n,className:"flex-1 bg-muted border border-border rounded px-1 py-0.5 text-[11px]",value:p,onChange:h=>c(u,h.target.value),children:a.map(h=>jsx("option",{value:h,children:h},h))})]},u)})})]}):null}function Cae({tagCollections:t,onUpdateTagCollections:e,canEdit:n}){let{t:r}=useTranslation(),[o,i]=useState(true),s=t.flatMap((d,u)=>d.tags.map((p,f)=>({...p,colIdx:u,tagIdx:f}))),a=(d,u,p,f)=>{let h=t.map((m,x)=>x!==d?m:{...m,tags:m.tags.map((y,v)=>v===u?{...y,[p]:f}:y)});e(h);},l=(d,u)=>{let p=t.map((f,h)=>h!==d?f:{...f,tags:f.tags.filter((m,x)=>x!==u)});e(p);},c=()=>{if(t.length===0)e([{path:"ppt/tags/tag1.xml",tags:[{name:"",value:""}]}]);else {let d=t.map((u,p)=>p!==0?u:{...u,tags:[...u.tags,{name:"",value:""}]});e(d);}};return jsxs("div",{className:xn,children:[jsxs("button",{type:"button",className:"flex items-center gap-1 w-full",onClick:()=>i(!o),children:[o?jsx(LuChevronRight,{className:"w-3 h-3 text-muted-foreground"}):jsx(LuChevronDown,{className:"w-3 h-3 text-muted-foreground"}),jsx("span",{className:hn,children:r("pptx.tags.title")}),jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:s.length})]}),!o&&jsxs("div",{className:"space-y-1.5",children:[s.length===0?jsx("div",{className:"text-[10px] text-muted-foreground",children:r("pptx.tags.noTags")}):s.map((d,u)=>jsxs("div",{className:"grid grid-cols-[1fr,1fr,auto] gap-1 text-[11px]",children:[jsx("input",{type:"text",className:Fn,disabled:!n,placeholder:r("pptx.tags.name"),value:d.name,onChange:p=>a(d.colIdx,d.tagIdx,"name",p.target.value)}),jsx("input",{type:"text",className:Fn,disabled:!n,placeholder:r("pptx.tags.value"),value:d.value,onChange:p=>a(d.colIdx,d.tagIdx,"value",p.target.value)}),n&&jsx("button",{type:"button",className:le(Xr,"px-1.5 text-red-400 hover:text-red-300"),title:r("pptx.tags.deleteTag"),onClick:()=>l(d.colIdx,d.tagIdx),children:jsx(LuTrash2,{className:"w-3 h-3"})})]},`${d.colIdx}-${d.tagIdx}-${u}`)),n&&jsx("button",{type:"button",className:Xr,onClick:c,children:r("pptx.tags.addTag")})]})]})}function Tae({presentationProperties:t,canEdit:e,onUpdatePresentationProperties:n,themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,onApplyTheme:s,activeSlide:a,theme:l,onUpdateSlide:c,canvasSize:d,onUpdateCanvasSize:u,notesCanvasSize:p,notesMaster:f,handoutMaster:h,coreProperties:m,onUpdateCoreProperties:x,appProperties:y,onUpdateAppProperties:v,customProperties:S,onUpdateCustomProperties:w,tagCollections:C,onUpdateTagCollections:T}){let{t:E}=useTranslation();return jsxs("div",{className:"space-y-3",children:[jsx(yae,{presentationProperties:t,canEdit:e,onUpdate:n}),jsx(bae,{themeOptions:r,selectedThemePath:o,setSelectedThemePath:i,canEdit:e,onApplyTheme:s}),jsxs("div",{className:xn,children:[jsx("div",{className:hn,children:E("pptx.themeOverride.heading")}),jsx(wae,{activeSlide:a,theme:l,canEdit:e,onUpdateSlide:c})]}),jsx(vae,{canvasSize:d,canEdit:e,onUpdate:u}),jsx(gae,{notesCanvasSize:p,notesMaster:f,handoutMaster:h}),jsx(xae,{coreProperties:m,appProperties:y,customProperties:S,canEdit:e,onUpdateCoreProperties:x,onUpdateAppProperties:v,onUpdateCustomProperties:w}),C&&T&&jsx(Cae,{tagCollections:C,onUpdateTagCollections:T,canEdit:e}),a&&jsxs("div",{className:le(xn,"space-y-1"),children:[jsx("div",{className:hn,children:"Slide"}),jsxs("div",{className:"text-[11px] text-muted-foreground",children:[a.elements?.length??0," elements"]})]})]})}function Mae({activeSlide:t,canEdit:e,onUpdateSlide:n,editTemplateMode:r,slideMasters:o,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s}){let a=useRef(null);return jsxs(Fragment,{children:[jsxs("div",{className:le(xn,"space-y-2"),children:[jsx("div",{className:hn,children:"Background"}),jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-10 shrink-0",children:"Colour"}),jsx(es,{value:ut(t.backgroundColor,"#ffffff"),disabled:!e,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:l=>n({backgroundColor:l})}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:t.backgroundColor||"none"})]}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-10 shrink-0",children:"Image"}),jsx("input",{ref:a,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp,image/svg+xml",className:"hidden",disabled:!e,onChange:l=>{let c=l.target.files?.[0];if(!c)return;let d=new FileReader;d.onload=()=>{typeof d.result=="string"&&n({backgroundImage:d.result});},d.readAsDataURL(c),l.target.value="";}}),jsx("button",{type:"button",className:le(Xr,"flex-1 text-center"),disabled:!e,onClick:()=>a.current?.click(),children:t.backgroundImage?"Replace Image":"Choose Image"})]}),t.backgroundImage&&jsxs("div",{className:"relative mt-1",children:[jsx("img",{src:t.backgroundImage,alt:"Background preview",className:"w-full h-16 object-cover rounded border border-border"}),jsx("button",{type:"button",className:"absolute top-0.5 right-0.5 rounded bg-background/80 hover:bg-red-700 p-0.5 text-[10px] transition-colors",disabled:!e,title:"Remove background image",onClick:()=>n({backgroundImage:void 0}),children:jsx(LuX,{className:"w-3 h-3"})})]})]}),(t.backgroundColor||t.backgroundImage||t.backgroundGradient)&&jsx("button",{type:"button",className:le(Xr,"w-full text-center text-red-400 hover:text-red-300"),disabled:!e,onClick:()=>n({backgroundColor:void 0,backgroundImage:void 0,backgroundGradient:void 0}),children:"Clear Background"})]}),r&&i&&s&&jsx(P7e,{activeSlide:t,slideMasters:o,canEdit:e,onSetTemplateBackground:i,onGetTemplateBackgroundColor:s})]})}function P7e({activeSlide:t,slideMasters:e,canEdit:n,onSetTemplateBackground:r,onGetTemplateBackgroundColor:o}){return jsxs("div",{className:le(xn,"space-y-2"),children:[jsx("div",{className:hn,children:"Template Backgrounds"}),t.layoutPath&&jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-14 shrink-0 truncate",title:t.layoutName??t.layoutPath,children:"Layout"}),jsx(es,{value:ut(o(t.layoutPath),"#ffffff"),disabled:!n,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:i=>r(t.layoutPath,i)}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:t.layoutName??"Layout"})]}),(()=>{let i=e?.find(s=>s.layoutPaths?.includes(t.layoutPath??""));return i?jsxs("label",{className:"flex items-center gap-2 text-[11px]",children:[jsx("span",{className:"text-muted-foreground w-14 shrink-0 truncate",title:i.name??i.path,children:"Master"}),jsx(es,{value:ut(o(i.path),"#ffffff"),disabled:!n,className:"h-6 w-8 rounded border border-border bg-muted cursor-pointer",onCommit:s=>r(i.path,s)}),jsx("span",{className:"text-muted-foreground text-[10px] truncate",children:i.name??"Master"})]}):null})()]})}function W8(t){let{isOpen:e,canEdit:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:d,onClose:u,onUpdateElement:p,onSelectElement:f,onMoveLayer:h,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:E,onUpdateCoreProperties:M,onUpdateAppProperties:A,onUpdateCustomProperties:R,tagCollections:k,onUpdateTagCollections:N,onApplyTheme:F,comments:B,commentDraft:D,editingCommentId:O,commentEditDraft:U,onSetCommentDraft:H,onAddComment:j,onDeleteComment:Z,onStartEditComment:J,onSaveEditComment:W,onCancelEditComment:te,onSetCommentEditDraft:se,onToggleCommentResolved:Ce,onStartReply:ee,onCancelReply:ce,onReplyDraftChange:de,onSubmitReply:Ne,replyingToCommentId:Ue,replyDraftByCommentId:he,onUpdateCanvasSize:Be,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe,mediaDataUrls:Y,theme:Ge,panelWidth:Ve}=t,We=s!==null,{t:ke}=useTranslation(),[wt,V]=useState(""),$=80,ie=500,ve=220,[De,$e]=useState(ve),ze=useCallback(ae=>{$e(Se=>Math.min(ie,Math.max($,Se-ae)));},[]);return useEffect(()=>{let ae=xe?.[0]?.themePath;if(ae&&ae.length>0){V(ae);return}let Se=E[0]?.path??"";V(Ye=>Ye||Se);},[xe,E]),jsxs(Fragment,{children:[e&&jsx("button",{type:"button","aria-label":ke("common.close"),onClick:u,className:"md:hidden fixed inset-0 z-20 bg-black/40 backdrop-blur-[2px] animate-in fade-in duration-150"}),jsxs("div",{className:le("bg-background flex flex-col text-xs text-foreground shadow-xl","max-md:fixed max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:max-h-[75dvh] max-md:rounded-t-2xl max-md:border-t max-md:border-border max-md:z-30 max-md:pb-[max(env(safe-area-inset-bottom),0px)]","max-md:transition-transform max-md:duration-200 max-md:ease-in-out",e?"max-md:translate-y-0":"max-md:translate-y-full","md:h-full md:border-l md:border-border",!Ve&&"md:w-72"),style:Ve?{width:Ve}:void 0,children:[jsx("div",{className:"md:hidden flex items-center justify-center pt-2 pb-1",children:jsx("div",{className:"h-1 w-10 rounded-full bg-muted-foreground/40"})}),jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border",children:[jsx("div",{className:"flex items-center gap-1 rounded bg-muted p-0.5",children:sse.map(({key:ae,label:Se,icon:Ye})=>jsxs("button",{type:"button",title:Se,className:le("flex items-center gap-1 px-2 py-1 rounded text-[11px] transition-colors",c===ae?"bg-primary text-white":"text-muted-foreground hover:text-foreground hover:bg-accent"),onClick:()=>d(ae),children:[jsx(Ye,{className:"w-3.5 h-3.5"}),jsx("span",{className:"hidden sm:inline",children:Se})]},ae))}),jsx("button",{type:"button",onClick:u,title:ke("common.close"),className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:[c==="elements"&&jsxs("div",{className:"space-y-1",children:[jsx("div",{className:le(hn,"mb-2"),children:ke("pptx.inspector.layerOrder")}),r?[...r.elements||[]].reverse().map((ae,Se)=>{let Ye=(r.elements||[]).length-1-Se,Q=s?.id===ae.id||a.includes(ae.id),pe=(ot(ae)?(ae.text||"").slice(0,24):void 0)||ae.type;return jsxs("div",{title:`${ae.type} \u2014 ${ae.id}`,className:le("flex items-center gap-2 px-2 py-1 rounded cursor-pointer transition-colors",Q?"bg-primary/30 text-primary":"hover:bg-muted text-foreground"),onClick:()=>f(ae.id),children:[jsx("span",{className:"text-muted-foreground w-4 text-right",children:Ye+1}),jsx("span",{className:"flex-1 truncate",children:pe})]},ae.id)}):jsx("div",{className:"text-muted-foreground italic",children:ke("pptx.inspector.noSlideSelected")})]}),c==="properties"&&jsx("div",{className:"space-y-3",children:We&&s?jsx(pae,{selectedElement:s,canEdit:n,slides:o,tableEditorState:l,mediaDataUrls:Y,onUpdateElement:p,onUpdateElementStyle:Me,onUpdateTextStyle:ge,onMoveLayer:h}):jsxs(Fragment,{children:[jsx(Tae,{canEdit:n,canvasSize:i,presentationProperties:m,onUpdatePresentationProperties:x,notesMaster:y,handoutMaster:v,notesCanvasSize:S,coreProperties:w,appProperties:C,customProperties:T,themeOptions:E,selectedThemePath:wt,setSelectedThemePath:V,onApplyTheme:F,onUpdateCoreProperties:M,onUpdateAppProperties:A,onUpdateCustomProperties:R,tagCollections:k,onUpdateTagCollections:N,onUpdateCanvasSize:Be,activeSlide:r,theme:Ge,onUpdateSlide:Te}),r&&jsx(Mae,{activeSlide:r,canEdit:n,onUpdateSlide:Te,editTemplateMode:be,slideMasters:xe,onSetTemplateBackground:Pe,onGetTemplateBackgroundColor:Xe})]})}),c==="comments"&&jsx(mae,{comments:B,canEdit:n,activeSlide:r,selectedElement:s,editingCommentId:O,commentEditDraft:U,commentDraft:D,replyingToCommentId:Ue??null,replyDraftByCommentId:he??{},onSetCommentDraft:H,onAddComment:j,onDeleteComment:Z,onStartEditComment:J,onSaveEditComment:W,onCancelEditComment:te,onSetCommentEditDraft:se,onToggleCommentResolved:Ce,onStartReply:ee,onCancelReply:ce,onReplyDraftChange:de,onSubmitReply:Ne,onSelectElement:f})]}),We&&s&&r&&jsxs(Fragment,{children:[jsx(Cp,{direction:"vertical",onResize:ze}),jsx("div",{className:"border-t border-border p-3 overflow-y-auto flex-shrink-0",style:{height:De},children:jsx(ise,{selectedElement:s,activeSlide:r,canEdit:n,onUpdateSlide:Te})})]})]})]})}function L7e(t){if(t.length===0)return "";let e=t[0],n=`M ${e.x} ${e.y}`;for(let r=1;r<t.length;r++){let o=t[r];n+=` L ${o.x} ${o.y}`;}return n}function F7e(t){switch(t){case "laser":return "none";case "pen":return "crosshair";case "highlighter":return "crosshair";case "eraser":return "crosshair";default:return "default"}}function q8({canvasSize:t,editorScale:e,presentationTool:n,annotationStrokes:r,currentStroke:o,laserPosition:i,onPointerDown:s,onPointerMove:a,onPointerUp:l,onLaserMove:c,onLaserLeave:d,onEraseAtPoint:u}){let p=useRef(null),f=useRef(false),h=useCallback((w,C)=>{let T=p.current;if(!T)return null;let E=T.getBoundingClientRect(),M=(w-E.left)/e,A=(C-E.top)/e;return {x:M,y:A}},[e]),m=useCallback(w=>{if(n==="none")return;w.preventDefault(),w.stopPropagation();let C=h(w.clientX,w.clientY);if(C){if(n==="eraser"){f.current=true,u(C.x,C.y);return}(n==="pen"||n==="highlighter")&&s(C.x,C.y);}},[n,h,s,u]),x=useCallback(w=>{if(n==="none")return;let C=h(w.clientX,w.clientY);if(C){if(n==="laser"){c(C.x,C.y);return}if(n==="eraser"&&f.current){u(C.x,C.y);return}(n==="pen"||n==="highlighter")&&a(C.x,C.y);}},[n,h,a,c,u]),y=useCallback(w=>{if(n!=="none"){if(w.preventDefault(),n==="eraser"){f.current=false;return}l();}},[n,l]),v=useCallback(()=>{n==="laser"&&d(),n==="eraser"&&(f.current=false),l();},[n,d,l]);if(n==="none")return null;let S=o?[...r,o]:r;return jsxs("div",{className:"absolute inset-0",style:{zIndex:60,cursor:F7e(n),pointerEvents:"auto"},children:[jsx("svg",{ref:p,className:"absolute",style:{width:t.width,height:t.height,transformOrigin:"top left",transform:`scale(${e})`},viewBox:`0 0 ${t.width} ${t.height}`,onPointerDown:m,onPointerMove:x,onPointerUp:y,onPointerLeave:v,children:S.map(w=>jsx("path",{d:L7e(w.points),fill:"none",stroke:w.color,strokeWidth:w.width,strokeLinecap:"round",strokeLinejoin:"round",opacity:w.opacity},w.id))}),n==="laser"&&i&&jsx("div",{className:"absolute rounded-full pointer-events-none",style:{width:24,height:24,left:i.x*e-12,top:i.y*e-12,backgroundColor:"rgba(255, 0, 0, 0.85)",boxShadow:"0 0 12px 6px rgba(255, 0, 0, 0.5), 0 0 24px 12px rgba(255, 0, 0, 0.25)",filter:"drop-shadow(0 0 8px rgba(255, 0, 0, 0.7))",zIndex:70}})]})}function Aae(t,e){return `${t+1} / ${e}`}var K7e=["#ff0000","#0000ff","#00aa00","#ff8800","#ffffff","#000000","#ff00ff","#00cccc"],Z7e=["#ffff00","#00ff00","#ff69b4","#00bfff","#ff8c00","#adff2f","#ff6347","#87ceeb"];function J8({presentationTool:t,penColor:e,highlighterColor:n,hasAnnotations:r,onSetTool:o,onSetPenColor:i,onSetHighlighterColor:s,onClearAnnotations:a,currentSlideIndex:l,totalSlides:c,onMovePresentationSlide:d,presentationStartTime:u,onEndPresentation:p,onTogglePresenterView:f,presenterMode:h}){let{t:m}=useTranslation(),[x,y]=useState(false),[v,S]=useState(false),w=useRef(null),[C,T]=useState(Date.now());useEffect(()=>{if(!u)return;let F=window.setInterval(()=>T(Date.now()),1e3);return ()=>window.clearInterval(F)},[u]);let E=u?C-u:0;useEffect(()=>{let F=B=>{w.current&&!w.current.contains(B.target)&&(y(false),S(false));};return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[]);let M=useCallback(F=>{o(F),y(false),S(false);},[o]),A=useCallback(F=>{F.preventDefault(),y(B=>!B),S(false);},[]),R=useCallback(F=>{F.preventDefault(),S(B=>!B),y(false);},[]),k=F=>`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${t===F?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,N="flex items-center justify-center w-9 h-9 rounded-md transition-colors text-white/70 hover:text-white hover:bg-white/10 disabled:text-white/20 disabled:cursor-not-allowed";return jsxs("div",{ref:w,className:"flex items-center gap-1 px-3 py-2 rounded-xl bg-neutral-900/90 backdrop-blur-md border border-white/15 shadow-2xl",onClick:F=>F.stopPropagation(),children:[jsx("button",{type:"button",className:N,onClick:()=>d(-1),disabled:l===0,title:m("pptx.presenter.previousSlide"),"aria-label":m("pptx.presenter.previousSlide"),children:jsx(LuChevronLeft,{size:18})}),jsx("span",{className:"text-xs font-mono tabular-nums text-white/80 px-1.5 select-none min-w-[48px] text-center",children:Aae(l,c)}),jsx("button",{type:"button",className:N,onClick:()=>d(1),disabled:l>=c-1,title:m("pptx.presenter.nextSlide"),"aria-label":m("pptx.presenter.nextSlide"),children:jsx(LuChevronRight,{size:18})}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsxs("div",{className:"flex items-center gap-1.5 text-xs font-mono tabular-nums text-white/60 px-1 select-none",title:m("pptx.presenter.elapsed"),children:[jsx(LuTimer,{size:14}),jsx("span",{children:q2(E)})]}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),jsx("button",{type:"button",className:k("laser"),onClick:()=>M("laser"),title:m("pptx.presentation.laserPointer"),children:jsx(LuMousePointer2,{size:18})}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:k("pen"),onClick:()=>M("pen"),onContextMenu:A,title:m("pptx.presentation.pen"),children:[jsx(LuPenTool,{size:18}),jsx("div",{className:"absolute bottom-0.5 left-1/2 -translate-x-1/2 w-3 h-0.5 rounded-full",style:{backgroundColor:e}})]}),jsx("button",{type:"button",className:"flex items-center justify-center w-7 h-9 -ml-1 rounded-r-md transition-colors text-white/50 hover:text-white hover:bg-white/10",onClick:()=>{y(F=>!F),S(false);},title:`${m("pptx.presentation.pen")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),x&&jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 p-3 bg-neutral-800 rounded-lg border border-white/20 shadow-xl grid grid-cols-4 gap-2",children:K7e.map(F=>jsx("button",{type:"button",className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${e===F?"border-white":"border-white/20"}`,style:{backgroundColor:F},onClick:()=>{i(F),y(false),t!=="pen"&&o("pen");}},F))})]}),jsxs("div",{className:"relative flex items-center",children:[jsxs("button",{type:"button",className:k("highlighter"),onClick:()=>M("highlighter"),onContextMenu:R,title:m("pptx.presentation.highlighter"),children:[jsx(LuHighlighter,{size:18}),jsx("div",{className:"absolute bottom-0.5 left-1/2 -translate-x-1/2 w-3 h-0.5 rounded-full",style:{backgroundColor:n}})]}),jsx("button",{type:"button",className:"flex items-center justify-center w-7 h-9 -ml-1 rounded-r-md transition-colors text-white/50 hover:text-white hover:bg-white/10",onClick:()=>{S(F=>!F),y(false);},title:`${m("pptx.presentation.highlighter")} \u2014 color`,children:jsx(LuChevronDown,{size:12})}),v&&jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 p-3 bg-neutral-800 rounded-lg border border-white/20 shadow-xl grid grid-cols-4 gap-2",children:Z7e.map(F=>jsx("button",{type:"button",className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${n===F?"border-white":"border-white/20"}`,style:{backgroundColor:F},onClick:()=>{s(F),S(false),t!=="highlighter"&&o("highlighter");}},F))})]}),jsx("button",{type:"button",className:k("eraser"),onClick:()=>M("eraser"),title:m("pptx.presentation.eraser"),children:jsx(LuEraser,{size:18})}),jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${r?"text-white/70 hover:text-red-400 hover:bg-white/10":"text-white/30 cursor-not-allowed"}`,onClick:r?a:void 0,title:m("pptx.presentation.clearAnnotations"),disabled:!r,children:jsx(LuTrash2,{size:18})}),jsx("div",{className:"w-px h-6 bg-white/20 mx-1"}),f&&jsx("button",{type:"button",className:`flex items-center justify-center w-9 h-9 rounded-md transition-colors ${h?"bg-white/25 text-white":"text-white/70 hover:text-white hover:bg-white/10"}`,onClick:f,title:m("pptx.presenter.presenterView",{defaultValue:"Presenter view (N)"}),"aria-label":m("pptx.presenter.presenterView",{defaultValue:"Presenter view"}),children:jsx(LuPanelRight,{size:18})}),jsx("button",{type:"button",className:"flex items-center justify-center w-9 h-9 rounded-md transition-colors text-white/70 hover:text-red-400 hover:bg-white/10",onClick:p,title:m("pptx.presenter.endPresentation"),"aria-label":m("pptx.presenter.endPresentation"),children:jsx(LuX,{size:18})})]})}var kae=768,Iae=1024;function Q7e(){return typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints!==null&&navigator.msMaxTouchPoints>0}function eYe(t){if(typeof window>"u")return ()=>{};let e=()=>t();return window.addEventListener("pointerdown",e,{once:true}),()=>window.removeEventListener("pointerdown",e)}function Nae(){return typeof window>"u"?"landscape":typeof screen<"u"&&screen.orientation?screen.orientation.type.startsWith("portrait")?"portrait":"landscape":window.innerHeight>window.innerWidth?"portrait":"landscape"}function cN(t){let e=t?.containerRef,n=useSyncExternalStore(eYe,Q7e,()=>false),[r,o]=useState(()=>typeof window>"u"?1024:e?.current?.clientWidth??window.innerWidth),[i,s]=useState(Nae),[a,l]=useState(false),[c]=useState(()=>typeof window<"u"?window.innerHeight:800);useEffect(()=>{let f=e?.current;if(f){let m=new ResizeObserver(x=>{let y=x[0];y&&o(y.contentRect.width);});return m.observe(f),o(f.clientWidth),()=>m.disconnect()}let h=()=>{o(window.innerWidth);};return window.addEventListener("resize",h),h(),()=>window.removeEventListener("resize",h)},[e]),useEffect(()=>{if(typeof window>"u")return;let f=()=>{s(Nae());};return screen.orientation&&screen.orientation.addEventListener("change",f),window.addEventListener("resize",f),()=>{screen.orientation&&screen.orientation.removeEventListener("change",f),window.removeEventListener("resize",f);}},[]),useEffect(()=>{if(!n||typeof window>"u")return;let f=()=>{let x=(window.visualViewport?.height??window.innerHeight)/c;l(x<.7);},h=window.visualViewport;return h?(h.addEventListener("resize",f),()=>h.removeEventListener("resize",f)):(window.addEventListener("resize",f),()=>window.removeEventListener("resize",f))},[n,c]);let d=r<kae,u=r>=kae&&r<Iae,p=r>=Iae;return {isMobile:d,isTablet:u,isDesktop:p,isTouchDevice:n,orientation:i,isVirtualKeyboardOpen:a,containerWidth:r}}function eH({currentSlideIndex:t,totalSlides:e,onMovePresentationSlide:n,onEndPresentation:r}){let{t:o}=useTranslation(),{isTouchDevice:i}=cN();if(!i)return null;let s="pointer-events-auto flex items-center justify-center w-11 h-11 min-w-11 min-h-11 rounded-full bg-black/55 text-white shadow-lg active:bg-black/75",a=l=>{l.stopPropagation();};return jsxs(Fragment,{children:[jsx("button",{type:"button",className:`fixed z-[90] ${s}`,style:{top:"calc(env(safe-area-inset-top, 0px) + 0.5rem)",right:"calc(env(safe-area-inset-right, 0px) + 0.5rem)",touchAction:"manipulation"},onClick:l=>{a(l),r();},"aria-label":o("pptx.presenter.endPresentation"),children:jsx(LuX,{size:22})}),jsx("button",{type:"button",className:`fixed z-[90] top-1/2 -translate-y-1/2 ${s} disabled:opacity-30`,style:{left:"calc(env(safe-area-inset-left, 0px) + 0.5rem)",touchAction:"manipulation"},disabled:t<=0,onClick:l=>{a(l),n(-1);},"aria-label":o("pptx.presenter.previousSlide"),children:jsx(LuChevronLeft,{size:26})}),jsx("button",{type:"button",className:`fixed z-[90] top-1/2 -translate-y-1/2 ${s} disabled:opacity-30`,style:{right:"calc(env(safe-area-inset-right, 0px) + 0.5rem)",touchAction:"manipulation"},disabled:t>=e-1,onClick:l=>{a(l),n(1);},"aria-label":o("pptx.presenter.nextSlide"),children:jsx(LuChevronRight,{size:26})}),jsx("span",{className:"fixed z-[90] left-1/2 -translate-x-1/2 px-3 py-1 rounded-full bg-black/55 text-white text-xs font-mono tabular-nums pointer-events-none",style:{bottom:"calc(env(safe-area-inset-bottom, 0px) + 0.5rem)"},children:e===0?"0 / 0":`${t+1} / ${e}`})]})}function nH({visible:t}){let{t:e}=useTranslation(),[n,r]=useState(""),[o,i]=useState("unknown"),s=useRef(null),a=useRef(false);if(useEffect(()=>{if(!t){a.current=false,s.current?.stop(),s.current=null,r("");return}a.current=true;let c=window,d=c.SpeechRecognition??c.webkitSpeechRecognition;if(!d){i("unsupported");return}i("supported");let u=new d;u.continuous=true,u.interimResults=true,u.lang=navigator.language||"en-US",u.onresult=p=>{let f="",h="";for(let x=p.resultIndex;x<p.results.length;x+=1){let y=p.results[x],v=y?.[0]?.transcript??"";y?.isFinal?f+=v:h+=v;}let m=`${f} ${h}`.trim();m.length>0&&r(m);},u.onerror=()=>{},u.onend=()=>{if(a.current)try{u.start();}catch{}},s.current=u;try{u.start();}catch{i("unsupported");}return ()=>{a.current=false,u.stop(),s.current=null;}},[t]),!t)return null;let l=o==="unsupported"?e("pptx.subtitles.notSupported"):n.length>0?n:e("pptx.subtitles.listening");return jsx("div",{className:"absolute bottom-14 left-1/2 -translate-x-1/2 z-[70] max-w-[80%] min-w-[300px]",children:jsx("div",{className:"px-6 py-3 rounded-lg bg-black/75 backdrop-blur-sm border border-white/10",children:jsx("p",{className:"text-center text-[15px] text-white/70 italic",children:l})})})}function rH({isOpen:t,annotationCount:e,slideCount:n,onKeep:r,onDiscard:o}){let{t:i}=useTranslation();return t?jsx("div",{style:{zIndex:1200},className:"fixed inset-0 flex items-center justify-center bg-black/50",children:jsxs("div",{className:"bg-background border border-border rounded-lg shadow-xl w-[420px] max-w-[90vw] p-6 animate-in fade-in zoom-in-95 duration-200",children:[jsxs("div",{className:"flex items-center gap-3 mb-4",children:[jsx("div",{className:"flex items-center justify-center w-10 h-10 rounded-full bg-primary/10",children:jsx(LuPenTool,{className:"w-5 h-5 text-primary"})}),jsxs("div",{children:[jsx("h2",{className:"text-base font-semibold text-foreground",children:i("pptx.presentation.keepAnnotationsTitle")}),jsx("p",{className:"text-sm text-muted-foreground",children:i("pptx.presentation.keepAnnotationsDescription",{count:e,slides:n})})]})]}),jsxs("div",{className:"flex justify-end gap-2 mt-6",children:[jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md border border-border bg-background text-foreground hover:bg-accent transition-colors",onClick:o,children:[jsx(LuTrash2,{className:"w-4 h-4"}),i("pptx.presentation.discardAnnotations")]}),jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md bg-primary text-white hover:bg-primary/90 transition-colors",onClick:r,children:[jsx(LuPenTool,{className:"w-4 h-4"}),i("pptx.presentation.keepAnnotations")]})]})]})}):null}var uYe=.48,pYe=6,Bae=16/9;function fYe(t,e,n=jc){let r=n.width-n.marginLeft-n.marginRight,o=n.height-n.marginTop-n.marginBottom,i=o*uYe,s=r,a=s/Bae;a>i&&(a=i,s=a*Bae);let l=(r-s)/2,c=(i-a)/2,d=i+pYe,u=o-d;return {pageIndex:t,slideIndex:e,slideArea:{x:l,y:c,width:s,height:a},textArea:{x:0,y:d,width:r,height:Math.max(0,u)}}}function oH(t){return t.map((e,n)=>fYe(n,e))}function iH(){return {width:jc.width-jc.marginLeft-jc.marginRight,height:jc.height-jc.marginTop-jc.marginBottom}}var ic=.9,Uae=5;function sH({slideIndices:t,slides:e,frameSlides:n,maxPages:r=3}){let{t:o}=useTranslation(),i=useMemo(()=>oH(t),[t]),s=useMemo(()=>iH(),[]),a=i.slice(0,r),l=s.width*ic,c=s.height*ic;return t.length===0?jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:o("pptx.print.preview.noSlides")}):jsxs("div",{className:"flex flex-col items-center gap-3 py-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:o("pptx.print.preview.title")}),a.map(d=>{let p=!!e[d.slideIndex]?.notes;return jsxs("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:l,height:c,overflow:"hidden"},children:[jsx("div",{className:`absolute flex items-center justify-center rounded-sm bg-gray-50 ${n?"border-2 border-gray-800":"border border-gray-300"}`,style:{left:d.slideArea.x*ic,top:d.slideArea.y*ic,width:d.slideArea.width*ic,height:d.slideArea.height*ic},children:jsx("span",{className:"text-[9px] font-medium text-gray-400",children:d.slideIndex+1})}),jsx("div",{className:"absolute left-1 right-1 border-b border-gray-200",style:{top:d.textArea.y*ic-1}}),jsx("div",{className:"absolute",style:{left:d.textArea.x*ic+4,top:d.textArea.y*ic,width:d.textArea.width*ic-8,height:d.textArea.height*ic},children:Array.from({length:Uae},(h,m)=>{let x=d.textArea.height*ic/(Uae+1);return jsx("div",{className:`absolute left-0 right-0 border-b ${p?"border-gray-300":"border-gray-200"}`,style:{top:x*(m+1)}},m)})})]},d.pageIndex)}),i.length>r&&jsx("span",{className:"text-[10px] text-muted-foreground",children:o("pptx.print.preview.morePages",{count:i.length-r})})]})}var Kv=.9;function dN({slideIndices:t,slidesPerPage:e,orientation:n,frameSlides:r,maxPages:o=3}){let{t:i}=useTranslation(),s=useMemo(()=>aU(t,e,n),[t,e,n]),a=useMemo(()=>lU(n),[n]),l=s.slice(0,o),c=e===3,d=cU(),u=a.width*Kv,p=a.height*Kv,f=.5;return t.length===0?jsx("div",{className:"flex items-center justify-center h-full text-xs text-muted-foreground",children:i("pptx.print.preview.noSlides")}):jsxs("div",{className:"flex flex-col items-center gap-3 py-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wide",children:i("pptx.print.preview.title")}),l.map(h=>jsx("div",{className:"relative bg-white border border-gray-200 shadow-sm rounded",style:{width:u,height:p,overflow:"hidden"},children:h.cells.map((m,x)=>{let y=m.slideIndex<0,v=m.x*Kv,S=m.y*Kv,w=m.width*Kv,C=m.height*Kv;return jsxs("div",{className:"absolute flex items-start",style:{left:v,top:S,gap:c?2:0},children:[jsx("div",{className:`flex items-center justify-center rounded-sm bg-gray-50 ${y?"opacity-30":""} ${r?"border-2 border-gray-800":"border border-gray-300"}`,style:{width:w,height:C},children:!y&&jsx("span",{className:"text-[9px] font-medium text-gray-400",children:m.slideIndex+1})}),c&&!y&&jsx("div",{className:"relative border-l border-gray-200 pl-1",style:{width:u*f,height:C},children:Array.from({length:d},(E,M)=>{let A=C/(d+1)*(M+1);return jsx("div",{className:"absolute left-1 right-0 border-b border-gray-200",style:{top:A}},M)})})]},x)})},h.pageIndex)),s.length>o&&jsx("span",{className:"text-[10px] text-muted-foreground",children:i("pptx.print.preview.morePages",{count:s.length-o})})]})}var uN=[1,2,3,4,6,9],al=t=>`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm cursor-pointer transition-colors ${t?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`;function Gae({printWhat:t,onPrintWhatChange:e,orientation:n,onOrientationChange:r,colorMode:o,onColorModeChange:i,frameSlides:s,onFrameSlidesChange:a,slidesPerPage:l,onSlidesPerPageChange:c,slideRange:d,onSlideRangeChange:u,customFrom:p,onCustomFromChange:f,customTo:h,onCustomToChange:m,totalSlides:x,activeSlideIndex:y}){let{t:v}=useTranslation();return jsxs("div",{className:"flex-1 space-y-5 min-w-0",children:[jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.printWhat")}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("label",{className:al(t==="slides"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="slides",onChange:()=>e("slides")}),jsx(LuFileText,{className:"w-4 h-4 shrink-0"}),v("pptx.print.fullPageSlides")]}),jsxs("label",{className:al(t==="handouts"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="handouts",onChange:()=>e("handouts")}),jsx(LuGrid2X2,{className:"w-4 h-4 shrink-0"}),v("pptx.print.handouts")]}),jsxs("label",{className:al(t==="notes"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="notes",onChange:()=>e("notes")}),jsx(LuStickyNote,{className:"w-4 h-4 shrink-0"}),v("pptx.print.notesPages")]}),jsxs("label",{className:al(t==="outline"),children:[jsx("input",{type:"radio",name:"printWhat",className:"sr-only",checked:t==="outline",onChange:()=>e("outline")}),jsx(LuList,{className:"w-4 h-4 shrink-0"}),v("pptx.print.outline")]})]})]}),t==="handouts"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.slidesPerPage")}),jsx("div",{className:"flex gap-1.5 flex-wrap",children:uN.map(S=>jsx("button",{type:"button",onClick:()=>c(S),className:`px-3 py-1.5 rounded-md text-sm font-medium border transition-colors ${l===S?"border-primary bg-primary/10 text-foreground":"border-border bg-background text-muted-foreground hover:border-primary/40"}`,children:S},S))})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.slideRange")}),jsxs("div",{className:"space-y-2",children:[jsxs("label",{className:al(d==="all"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="all",onChange:()=>u("all")}),v("pptx.print.allSlides")," (",x,")"]}),jsxs("label",{className:al(d==="current"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="current",onChange:()=>u("current")}),v("pptx.print.currentSlide")," (",y+1,")"]}),jsxs("label",{className:al(d==="custom"),children:[jsx("input",{type:"radio",name:"slideRange",className:"sr-only",checked:d==="custom",onChange:()=>u("custom")}),v("pptx.print.customRange")]}),d==="custom"&&jsxs("div",{className:"flex items-center gap-2 pl-6",children:[jsx("span",{className:"text-xs text-muted-foreground",children:v("pptx.print.from")}),jsx("input",{type:"number",min:1,max:x,value:p,onChange:S=>f(Math.max(1,parseInt(S.target.value,10)||1)),className:"w-16 px-2 py-1 text-sm border border-border rounded bg-background text-foreground"}),jsx("span",{className:"text-xs text-muted-foreground",children:v("pptx.print.to")}),jsx("input",{type:"number",min:1,max:x,value:h,onChange:S=>m(Math.max(1,parseInt(S.target.value,10)||1)),className:"w-16 px-2 py-1 text-sm border border-border rounded bg-background text-foreground"})]})]})]}),t==="slides"&&jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.orientation")}),jsxs("div",{className:"flex gap-2",children:[jsxs("label",{className:al(n==="landscape"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="landscape",onChange:()=>r("landscape")}),v("pptx.print.landscape")]}),jsxs("label",{className:al(n==="portrait"),children:[jsx("input",{type:"radio",name:"orientation",className:"sr-only",checked:n==="portrait",onChange:()=>r("portrait")}),v("pptx.print.portrait")]})]})]}),jsxs("fieldset",{children:[jsx("legend",{className:"text-xs font-medium text-muted-foreground mb-2 uppercase tracking-wide",children:v("pptx.print.colorMode")}),jsxs("div",{className:"flex gap-2 flex-wrap",children:[jsxs("label",{className:al(o==="color"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="color",onChange:()=>i("color")}),v("pptx.print.color")]}),jsxs("label",{className:al(o==="grayscale"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="grayscale",onChange:()=>i("grayscale")}),v("pptx.print.grayscale")]}),jsxs("label",{className:al(o==="blackAndWhite"),children:[jsx("input",{type:"radio",name:"colorMode",className:"sr-only",checked:o==="blackAndWhite",onChange:()=>i("blackAndWhite")}),v("pptx.print.blackAndWhite")]})]})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:s,onChange:S=>a(S.target.checked),className:"rounded border-border"}),jsx("span",{className:"text-sm text-foreground",children:v("pptx.print.frameSlides")})]})]})}function aH({open:t,onClose:e,onPrint:n,slides:r,activeSlideIndex:o,defaultSlidesPerPage:i,defaultFrameSlides:s}){let{t:a}=useTranslation(),[l,c]=useState("slides"),[d,u]=useState("landscape"),[p,f]=useState("color"),[h,m]=useState(s??false),[x,y]=useState(uN.includes(i)?i:6),[v,S]=useState("all"),[w,C]=useState(1),[T,E]=useState(r.length),M=useMemo(()=>l==="notes"||l==="outline"||l==="handouts"?"portrait":d,[l,d]),A=useMemo(()=>{if(v==="all")return r.length;if(v==="current")return 1;let F=Math.max(1,Math.min(w,r.length));return Math.max(F,Math.min(T,r.length))-F+1},[v,r.length,w,T]),R=useMemo(()=>l==="slides"||l==="notes"?A:l==="outline"?1:Math.ceil(A/x),[l,A,x]),k=useMemo(()=>{if(v==="current")return [o];if(v==="custom"){let F=Math.max(0,w-1),B=Math.min(r.length-1,T-1);return Array.from({length:Math.max(0,B-F+1)},(D,O)=>F+O)}return Array.from({length:r.length},(F,B)=>B)},[v,o,w,T,r.length]),N=useCallback(()=>{n({printWhat:l,orientation:M,colorMode:p,frameSlides:h,slidesPerPage:x,slideRange:v,customRangeFrom:Math.max(1,Math.min(w,r.length)),customRangeTo:Math.max(1,Math.min(T,r.length))});},[l,M,p,h,x,v,w,T,r.length,n]);return t?jsx("div",{style:{zIndex:1200},className:"fixed inset-0 flex items-center justify-center bg-black/60 backdrop-blur-sm",children:jsxs("div",{className:"w-[780px] max-h-[90vh] rounded-xl border border-border bg-background shadow-2xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuPrinter,{className:"w-4 h-4 text-muted-foreground"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:a("pptx.print.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex gap-5",children:[jsx(Gae,{printWhat:l,onPrintWhatChange:c,orientation:d,onOrientationChange:u,colorMode:p,onColorModeChange:f,frameSlides:h,onFrameSlidesChange:m,slidesPerPage:x,onSlidesPerPageChange:y,slideRange:v,onSlideRangeChange:S,customFrom:w,onCustomFromChange:C,customTo:T,onCustomToChange:E,totalSlides:r.length,activeSlideIndex:o}),l==="handouts"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(dN,{slideIndices:k,slidesPerPage:x,orientation:M,frameSlides:h})}),l==="notes"&&jsx("div",{className:"w-[230px] shrink-0 border-l border-border pl-4 overflow-y-auto",children:jsx(sH,{slideIndices:k,slides:r,frameSlides:h})})]}),jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-t border-border",children:[jsx("span",{className:"text-xs text-muted-foreground",children:a("pptx.print.pageEstimate",{pages:R,slides:A})}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{type:"button",onClick:e,className:"px-4 py-2 text-sm rounded-lg border border-border text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a("common.cancel")}),jsxs("button",{type:"button",onClick:N,className:"px-4 py-2 text-sm rounded-lg bg-primary text-white hover:bg-primary/90 transition-colors flex items-center gap-1.5",children:[jsx(LuPrinter,{className:"w-3.5 h-3.5"}),a("pptx.print.printButton")]})]})]})]})}):null}function jae({draft:t,update:e}){let{t:n}=useTranslation();return jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:n("pptx.slideShow.showOptions")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:!!t.loopContinuously,onChange:r=>e({loopContinuously:r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.loopContinuously")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:t.showWithNarration===false,onChange:r=>e({showWithNarration:!r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showWithoutNarration")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:t.showWithAnimation===false,onChange:r=>e({showWithAnimation:!r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showWithoutAnimation")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:!!t.showSubtitles,onChange:r=>e({showSubtitles:r.target.checked}),className:"accent-primary"}),jsx("span",{children:n("pptx.slideShow.showSubtitles")})]})]})}function Xae({draft:t,update:e,showSlidesMode:n,slideCount:r,customShows:o}){let{t:i}=useTranslation();return jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:i("pptx.slideShow.showSlides")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"all",checked:n==="all",onChange:()=>e({showSlidesMode:"all"}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.allSlides")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"range",checked:n==="range",onChange:()=>e({showSlidesMode:"range",showSlidesFrom:t.showSlidesFrom??1,showSlidesTo:t.showSlidesTo??r}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.fromTo")})]}),n==="range"&&jsxs("div",{className:"flex items-center gap-2 ml-6",children:[jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.slideShow.from")}),jsx("input",{type:"number",min:1,max:r,value:t.showSlidesFrom??1,onChange:s=>e({showSlidesFrom:Math.max(1,Number.parseInt(s.target.value,10)||1)}),className:"w-14 px-1.5 py-0.5 rounded bg-muted border border-border text-foreground text-[11px]"})]}),jsxs("label",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-muted-foreground",children:i("pptx.slideShow.to")}),jsx("input",{type:"number",min:1,max:r,value:t.showSlidesTo??r,onChange:s=>e({showSlidesTo:Math.min(r,Number.parseInt(s.target.value,10)||r)}),className:"w-14 px-1.5 py-0.5 rounded bg-muted border border-border text-foreground text-[11px]"})]})]}),o.length>0&&jsxs(Fragment,{children:[jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showSlides",value:"customShow",checked:n==="customShow",onChange:()=>e({showSlidesMode:"customShow",showSlidesCustomShowId:t.showSlidesCustomShowId??o[0]?.id}),className:"accent-primary"}),jsx("span",{children:i("pptx.slideShow.customShow")})]}),n==="customShow"&&jsx("div",{className:"ml-6",children:jsx("select",{value:t.showSlidesCustomShowId??o[0]?.id??"",onChange:s=>e({showSlidesCustomShowId:s.target.value}),className:"w-full px-2 py-1 rounded bg-muted border border-border text-foreground text-[11px]",children:o.map(s=>jsx("option",{value:s.id,children:s.name},s.id))})})]})]})}function lH({open:t,onClose:e,properties:n,onSave:r,customShows:o,slideCount:i}){let{t:s}=useTranslation(),[a,l]=useState({...n}),c=useCallback(f=>{l(h=>({...h,...f}));},[]),d=useCallback(()=>{r(a),e();},[a,r,e]);if(!t)return null;let u=a.showType??"presented",p=a.showSlidesMode??"all";return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":"Close dialog",onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-xl border border-border bg-background shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:s("pptx.slideShow.setUpTitle")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"px-5 py-4 space-y-5 text-[12px] text-foreground max-h-[70vh] overflow-y-auto",children:[jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:s("pptx.slideShow.showType")}),[["presented",s("pptx.slideShow.presentedBySpeaker")],["browsed",s("pptx.slideShow.browsedByIndividual")],["kiosk",s("pptx.slideShow.browsedAtKiosk")]].map(([f,h])=>jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"showType",value:f,checked:u===f,onChange:()=>c({showType:f,...f==="kiosk"?{loopContinuously:true}:{}}),className:"accent-primary"}),jsx("span",{children:h})]},f))]}),jsx(Xae,{draft:a,update:c,showSlidesMode:p,slideCount:i,customShows:o}),jsxs("fieldset",{className:"space-y-1.5",children:[jsx("legend",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:s("pptx.slideShow.advanceSlides")}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"advanceMode",value:"manual",checked:(a.advanceMode??"manual")==="manual",onChange:()=>c({advanceMode:"manual"}),className:"accent-primary"}),jsx("span",{children:s("pptx.slideShow.manually")})]}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"radio",name:"advanceMode",value:"useTimings",checked:a.advanceMode==="useTimings",onChange:()=>c({advanceMode:"useTimings"}),className:"accent-primary"}),jsx("span",{children:s("pptx.slideShow.useTimings")})]})]}),jsx(jae,{draft:a,update:c})]}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:d,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-[12px] text-white transition-colors",children:s("common.ok")})]})]})})]})}function fH({open:t,onClose:e,onStartBroadcast:n,onStopBroadcast:r,onStartPresenting:o,defaultRoomId:i,defaultUserName:s,defaultServerUrl:a}){let{t:l}=useTranslation(),c=qi(),d=c!==null&&c.status!=="disconnected"&&c.status!=="error"&&c.config.role==="broadcaster",[u,p]=useState(""),[f,h]=useState(""),[m,x]=useState(""),[y,v]=useState(false),S=useRef(null);useEffect(()=>{if(t&&!d){let A=i?`broadcast-${i}`:`broadcast-${Math.random().toString(36).slice(2,10)}`;p(A),h(s??""),x(a??"ws://localhost:1234");}},[t,d,i,s,a]),useEffect(()=>{if(!t)return;function A(R){R.key==="Escape"&&e();}return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[t,e]),useEffect(()=>{t&&S.current&&S.current.focus();},[t]);let w=typeof window<"u"?`${window.location.origin}${window.location.pathname}?broadcast=${encodeURIComponent(d?c.config.roomId:u)}&server=${encodeURIComponent(d?c.config.serverUrl:m)}`:u,C=useCallback(()=>{navigator.clipboard.writeText(w).then(()=>{v(true),setTimeout(()=>v(false),2e3);});},[w]),T=useCallback(()=>{!u.trim()||!f.trim()||(n?.({roomId:u.trim(),serverUrl:m.trim(),userName:f.trim(),role:"broadcaster"}),setTimeout(()=>{o?.();},100),e());},[u,f,m,n,o,e]),E=useCallback(()=>{r?.(),e();},[r,e]),M=u.trim().length>0&&f.trim().length>0&&m.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":"Close dialog",onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-label":l("pptx.broadcast.title"),tabIndex:-1,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsxs("h2",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[jsx(LuCast,{className:"w-4 h-4"}),l(d?"pptx.broadcast.broadcasting":"pptx.broadcast.title")]}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:d?jsx(UYe,{collab:c,broadcastUrl:w,copied:y,onCopyUrl:C,onStopBroadcast:E}):jsx(OYe,{roomId:u,userName:f,serverUrl:m,onRoomIdChange:p,onUserNameChange:h,onServerUrlChange:x})}),!d&&jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:l("common.close")}),jsx("button",{type:"button",disabled:!M,onClick:T,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/90 text-[12px] text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:l("pptx.broadcast.startBroadcast")})]})]})})]}):null}function OYe({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i}){let{t:s}=useTranslation();return jsxs("div",{className:"space-y-4",children:[jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed",children:s("pptx.broadcast.description")}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-room-id",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.sessionName")}),jsx("input",{id:"broadcast-room-id",type:"text",value:t,onChange:a=>r(a.target.value),placeholder:"broadcast-abc123",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-user-name",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.displayName")}),jsx("input",{id:"broadcast-user-name",type:"text",value:e,onChange:a=>o(a.target.value),placeholder:"Presenter",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"broadcast-server-url",className:"block text-[12px] font-medium text-foreground",children:s("pptx.broadcast.serverLabel")}),jsx("input",{id:"broadcast-server-url",type:"text",value:n,onChange:a=>i(a.target.value),placeholder:"ws://localhost:1234",className:"w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary"})]}),jsx("p",{className:"text-[11px] text-muted-foreground/70 leading-relaxed",children:s("pptx.broadcast.hint")})]})}function UYe({collab:t,broadcastUrl:e,copied:n,onCopyUrl:r,onStopBroadcast:o}){let{t:i}=useTranslation(),s=t.status==="connected"?"text-green-400":t.status==="connecting"?"text-yellow-400":"text-red-400",a=t.status==="connected"||t.status==="connecting"?jsx(LuWifi,{className:"w-4 h-4"}):jsx(LuWifiOff,{className:"w-4 h-4"}),l=t.remoteUsers.filter(c=>c.role==="viewer").length;return jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:s,children:a}),jsx("span",{className:"text-[13px] font-medium text-foreground capitalize",children:t.status}),jsxs("span",{className:"text-[12px] text-muted-foreground ml-auto flex items-center gap-1",children:[jsx(LuUsers,{className:"w-3.5 h-3.5"}),i("pptx.broadcast.viewerCount",{count:l})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.broadcast.viewerLink")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex-1 px-3 py-1.5 rounded border border-border bg-background text-[11px] text-foreground select-all font-mono truncate",children:e}),jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2.5 py-1.5 rounded border border-border bg-muted hover:bg-accent text-[12px] text-foreground transition-colors shrink-0",title:i("pptx.broadcast.copyLink"),children:n?jsxs(Fragment,{children:[jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}),jsx("span",{children:i("pptx.share.copied")})]}):jsxs(Fragment,{children:[jsx(LuCopy,{className:"w-3.5 h-3.5"}),jsx("span",{children:i("pptx.share.copyUrl")})]})})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:i("pptx.broadcast.shareHint")})]}),t.remoteUsers.length>0&&jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.broadcast.viewers")}),jsx("div",{className:"rounded border border-border bg-background divide-y divide-border max-h-[120px] overflow-y-auto",children:t.remoteUsers.map(c=>jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-semibold text-white shrink-0",style:{backgroundColor:c.userColor},children:c.userName.slice(0,2).toUpperCase()}),jsx("span",{className:"text-[12px] text-foreground truncate",children:c.userName}),jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["Slide ",c.activeSlideIndex+1]})]},c.clientId))})]}),jsx("button",{type:"button",onClick:o,className:"w-full px-3 py-2 rounded border border-red-500/30 bg-red-500/10 hover:bg-red-500/20 text-[12px] text-red-400 font-medium transition-colors",children:i("pptx.broadcast.stopBroadcast")})]})}function qae(t){let e=t.trim().split(/\s+/);return e.length>=2?(e[0][0]+e[e.length-1][0]).toUpperCase():t.slice(0,2).toUpperCase()}function xH({open:t,onClose:e,activeCollaboration:n,onStartCollaboration:r,onStopCollaboration:o,preconfigured:i,defaultRoomId:s,defaultUserName:a,defaultServerUrl:l}){let c=qi(),d=c!==null&&c.status!=="disconnected"&&c.status!=="error",{t:u}=useTranslation(),[p,f]=useState(s??""),[h,m]=useState(a??""),[x,y]=useState(l??""),[v,S]=useState(false),w=useRef(null);useEffect(()=>{n&&(f(n.roomId),m(n.userName),y(n.serverUrl));},[n]),useEffect(()=>{if(!t)return;function M(A){A.key==="Escape"&&e();}return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[t,e]),useEffect(()=>{t&&w.current&&w.current.focus();},[t]);let C=useCallback(()=>{let M=n??{roomId:p,serverUrl:x},A=typeof window<"u"?`${window.location.origin}${window.location.pathname}?room=${encodeURIComponent(M.roomId)}&server=${encodeURIComponent(M.serverUrl)}`:M.roomId;navigator.clipboard.writeText(A).then(()=>{S(true),setTimeout(()=>S(false),2e3);});},[n,p,x]),T=useCallback(()=>{!p.trim()||!h.trim()||r?.({roomId:p.trim(),serverUrl:x.trim(),userName:h.trim()});},[p,h,x,r]),E=p.trim().length>0&&h.trim().length>0&&x.trim().length>0;return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50","aria-label":u("pptx.share.closeDialog"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-label":u("pptx.share.title"),tabIndex:-1,className:"pointer-events-auto w-full max-w-md rounded-xl border border-border bg-popover text-foreground shadow-2xl outline-none",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:u(d?"pptx.share.collaborationActive":"pptx.share.title")}),jsx("button",{type:"button",onClick:e,className:"text-muted-foreground hover:text-foreground text-lg leading-none","aria-label":u("pptx.share.close"),children:"\xD7"})]}),jsx("div",{className:"px-5 py-4",children:d?jsx(WYe,{collab:c,activeCollaboration:n,copied:v,onCopyRoomId:C,onStopCollaboration:o}):jsx(XYe,{roomId:p,userName:h,serverUrl:x,onRoomIdChange:f,onUserNameChange:m,onServerUrlChange:y,preconfigured:i})}),jsxs("div",{className:"flex justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 rounded bg-muted hover:bg-accent text-[12px] text-foreground transition-colors",children:u(d?"pptx.share.close":"pptx.share.cancel")}),!d&&jsx("button",{type:"button",disabled:!E,onClick:T,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/90 text-[12px] text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:u("pptx.share.startSharing")})]})]})})]}):null}function XYe({roomId:t,userName:e,serverUrl:n,onRoomIdChange:r,onUserNameChange:o,onServerUrlChange:i,preconfigured:s}){let{t:a}=useTranslation(),l=s?" opacity-70 cursor-not-allowed":"";return jsxs("div",{className:"space-y-4",children:[jsx("p",{className:"text-[13px] text-muted-foreground leading-relaxed",children:a(s?"pptx.share.preconfiguredDescription":"pptx.share.description")}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-room-id",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.sessionName")}),jsx("input",{id:"share-room-id",type:"text",value:t,onChange:c=>r(c.target.value),readOnly:s,placeholder:a("pptx.share.sessionPlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`}),jsx("p",{className:"text-[11px] text-muted-foreground",children:a("pptx.share.sessionHint")})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-user-name",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.displayName")}),jsx("input",{id:"share-user-name",type:"text",value:e,onChange:c=>o(c.target.value),readOnly:s,placeholder:a("pptx.share.namePlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{htmlFor:"share-server-url",className:"block text-[12px] font-medium text-foreground",children:a("pptx.share.serverLabel")}),jsx("input",{id:"share-server-url",type:"text",value:n,onChange:c=>i(c.target.value),readOnly:s,placeholder:a("pptx.share.serverPlaceholder"),className:`w-full px-3 py-1.5 rounded border border-border bg-background text-foreground text-[13px] placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary${l}`})]}),jsxs("p",{className:"text-[11px] text-muted-foreground/70 leading-relaxed",children:["Run"," ",jsx("code",{className:"px-1 py-0.5 rounded bg-muted text-[10px] font-mono",children:"bun run collab"})," ","to start the server. Others can join at"," ",jsx("code",{className:"px-1 py-0.5 rounded bg-muted text-[10px] font-mono",children:"?room=SESSION_NAME"})]})]})}function WYe({collab:t,activeCollaboration:e,copied:n,onCopyRoomId:r,onStopCollaboration:o}){let{t:i}=useTranslation(),s=t.status==="connected"?"text-green-400":t.status==="connecting"?"text-yellow-400":"text-red-400",a=t.status==="connected"||t.status==="connecting"?jsx(LuWifi,{className:"w-4 h-4"}):jsx(LuWifiOff,{className:"w-4 h-4"});return jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:s,children:a}),jsx("span",{className:"text-[13px] font-medium text-foreground capitalize",children:t.status}),jsxs("span",{className:"text-[12px] text-muted-foreground ml-auto flex items-center gap-1",children:[jsx(LuUsers,{className:"w-3.5 h-3.5"}),i("pptx.collaboration.userCount",{count:t.connectedCount})]})]}),jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.share.shareLink")}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"flex-1 px-3 py-1.5 rounded border border-border bg-background text-[11px] text-foreground select-all font-mono truncate",children:typeof window<"u"?`${window.location.origin}${window.location.pathname}?room=${encodeURIComponent(t.config.roomId)}&server=${encodeURIComponent(t.config.serverUrl)}`:t.config.roomId}),jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1 px-2.5 py-1.5 rounded border border-border bg-muted hover:bg-accent text-[12px] text-foreground transition-colors shrink-0",title:i("pptx.share.copyLink"),children:n?jsxs(Fragment,{children:[jsx(LuCheck,{className:"w-3.5 h-3.5 text-green-400"}),jsx("span",{children:i("pptx.share.copied")})]}):jsxs(Fragment,{children:[jsx(LuCopy,{className:"w-3.5 h-3.5"}),jsx("span",{children:i("pptx.share.copyUrl")})]})})]}),jsx("p",{className:"text-[11px] text-muted-foreground",children:i("pptx.share.shareHint")})]}),jsxs("div",{className:"flex items-center gap-3 text-[11px] text-muted-foreground",children:[jsxs("span",{children:[i("pptx.share.room")," ",jsx("code",{className:"font-mono text-foreground",children:t.config.roomId})]}),jsxs("span",{children:[i("pptx.share.server")," ",jsx("code",{className:"font-mono text-foreground",children:t.config.serverUrl})]})]}),t.remoteUsers.length>0&&jsxs("div",{className:"space-y-1.5",children:[jsx("label",{className:"block text-[12px] font-medium text-foreground",children:i("pptx.share.connectedUsers")}),jsxs("div",{className:"rounded border border-border bg-background divide-y divide-border max-h-[140px] overflow-y-auto",children:[jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-semibold text-white shrink-0",style:{backgroundColor:t.config.userColor??"#6366f1"},children:qae(e?.userName??t.config.userName)}),jsx("span",{className:"text-[12px] text-foreground truncate",children:e?.userName??t.config.userName}),jsx("span",{className:"text-[10px] text-muted-foreground ml-auto",children:i("pptx.share.you")})]}),t.remoteUsers.map(l=>jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-[9px] font-semibold text-white shrink-0",style:{backgroundColor:l.userColor},children:l.userAvatar?jsx("img",{src:l.userAvatar,alt:"",className:"w-full h-full rounded-full object-cover"}):qae(l.userName)}),jsx("span",{className:"text-[12px] text-foreground truncate",children:l.userName}),jsxs("span",{className:"text-[10px] text-muted-foreground ml-auto",children:["Slide ",l.activeSlideIndex+1]})]},l.clientId))]})]}),o&&jsx("button",{type:"button",onClick:o,className:"w-full px-3 py-2 rounded border border-red-500/30 bg-red-500/10 hover:bg-red-500/20 text-[12px] text-red-400 font-medium transition-colors",children:i("pptx.share.stopSharing")})]})}var mN={"ppaction://hlinkshowjump?jump=nextslide":"nextSlide","ppaction://hlinkshowjump?jump=previousslide":"prevSlide","ppaction://hlinkshowjump?jump=firstslide":"firstSlide","ppaction://hlinkshowjump?jump=lastslide":"lastSlide","ppaction://hlinkshowjump?jump=endshow":"endShow"},Kae={nextSlide:"ppaction://hlinkshowjump?jump=nextslide",prevSlide:"ppaction://hlinkshowjump?jump=previousslide",firstSlide:"ppaction://hlinkshowjump?jump=firstslide",lastSlide:"ppaction://hlinkshowjump?jump=lastslide",endShow:"ppaction://hlinkshowjump?jump=endshow"};function Zae(t,e){return e&&e.startsWith("ppaction://")?e.includes("hlinksldjump")?"slide":(mN[e.toLowerCase()],"action"):t?t.startsWith("mailto:")?"email":/^[a-zA-Z]:\\|^\.\.?[/\\]|^file:/i.test(t)?"file":"url":"url"}function Jae(t){if(!t.startsWith("mailto:"))return {address:t,subject:""};let e=t.slice(7),n=e.indexOf("?");if(n<0)return {address:e,subject:""};let r=e.slice(0,n),o=new URLSearchParams(e.slice(n+1));return {address:r,subject:o.get("subject")||""}}function Qae(t,e){if(e==="ppaction://hlinksldjump"&&t){let n=t.match(/slide(\d+)\.xml$/i);if(n)return parseInt(n[1],10)}if(t){let n=t.match(/#\s*Slide\s+(\d+)/i);if(n)return parseInt(n[1],10)}return 1}function ele(t){let e=t.tooltip.trim()||void 0;switch(t.targetType){case "email":return {url:t.emailSubject?`mailto:${t.emailAddress}?subject=${encodeURIComponent(t.emailSubject)}`:`mailto:${t.emailAddress}`,tooltip:e};case "slide":return {url:`slide${t.slideNumber}.xml`,action:"ppaction://hlinksldjump",tooltip:e};case "file":return {url:t.filePath,tooltip:e};case "action":return {url:"",action:Kae[t.actionVerb],tooltip:e};default:return {url:t.url,tooltip:e}}}function tle({targetType:t,url:e,setUrl:n,tooltip:r,setTooltip:o,emailAddress:i,setEmailAddress:s,emailSubject:a,setEmailSubject:l,slideNumber:c,setSlideNumber:d,slideCount:u,filePath:p,setFilePath:f,actionVerb:h,setActionVerb:m,inputRef:x,inputCls:y,onEnterConfirm:v}){let{t:S}=useTranslation(),w=C=>{C.key==="Enter"&&v();};return jsxs("div",{className:"px-4 py-3 space-y-3",children:[t==="url"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.urlLabel")}),jsx("input",{ref:x,type:"url",className:y,placeholder:"https://example.com",value:e,onChange:C=>n(C.target.value),onKeyDown:w})]}),t==="email"&&jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.emailLabel")}),jsx("input",{ref:x,type:"email",className:y,placeholder:"user@example.com",value:i,onChange:C=>s(C.target.value),onKeyDown:w})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.subjectLabel")}),jsx("input",{type:"text",className:y,value:a,onChange:C=>l(C.target.value)})]})]}),t==="slide"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.slideLabel")}),jsx("input",{ref:x,type:"number",min:1,max:u,className:y,value:c,onChange:C=>d(parseInt(C.target.value,10)||1),onKeyDown:w}),jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:S("pptx.hyperlink.slideRange",{max:u})})]}),t==="file"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.fileLabel")}),jsx("input",{ref:x,type:"text",className:y,placeholder:"../documents/file.docx",value:p,onChange:C=>f(C.target.value),onKeyDown:w})]}),t==="action"&&jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.actionLabel")}),jsxs("select",{className:y,value:h,onChange:C=>m(C.target.value),children:[jsx("option",{value:"nextSlide",children:S("pptx.hyperlink.actionNextSlide")}),jsx("option",{value:"prevSlide",children:S("pptx.hyperlink.actionPrevSlide")}),jsx("option",{value:"firstSlide",children:S("pptx.hyperlink.actionFirstSlide")}),jsx("option",{value:"lastSlide",children:S("pptx.hyperlink.actionLastSlide")}),jsx("option",{value:"endShow",children:S("pptx.hyperlink.actionEndShow")})]})]}),jsxs("div",{children:[jsx("label",{className:"block text-xs text-muted-foreground mb-1",children:S("pptx.hyperlink.tooltipLabel")}),jsx("input",{type:"text",className:y,value:r,onChange:C=>o(C.target.value)})]})]})}function yH({open:t,initialUrl:e,initialTooltip:n,initialAction:r,slideCount:o,onConfirm:i,onCancel:s}){let{t:a}=useTranslation(),l=useRef(null),c=Zae(e,r),d=Jae(e||""),u=Qae(e,r),p=r&&mN[r.toLowerCase()]||"nextSlide",[f,h]=useState(c),[m,x]=useState(c==="email"||c==="slide"||c==="action"?"":e||""),[y,v]=useState(n||""),[S,w]=useState(d.address),[C,T]=useState(d.subject),[E,M]=useState(u),[A,R]=useState(c==="file"&&e||""),[k,N]=useState(p);if(useEffect(()=>{t&&setTimeout(()=>l.current?.focus(),50);},[t]),!t)return null;let F=()=>{i({targetType:f,url:m,tooltip:y,emailAddress:S,emailSubject:C,slideNumber:E,filePath:A,actionVerb:k});},B=O=>le("px-3 py-1.5 text-xs rounded-t border-b-2 transition-colors",O?"border-primary text-primary font-medium":"border-transparent text-muted-foreground hover:text-foreground hover:border-border");return jsxs(Fragment,{children:[jsx("div",{style:{zIndex:1200},className:"fixed inset-0 bg-black/40",onClick:s}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[440px] rounded-lg border border-border bg-popover shadow-2xl",onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:a("pptx.hyperlink.editTitle")}),jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground",onClick:s,children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex gap-1 px-4 pt-2 border-b border-border",children:[jsx("button",{type:"button",className:B(f==="url"),onClick:()=>h("url"),children:a("pptx.hyperlink.tabUrl")}),jsx("button",{type:"button",className:B(f==="email"),onClick:()=>h("email"),children:a("pptx.hyperlink.tabEmail")}),jsx("button",{type:"button",className:B(f==="slide"),onClick:()=>h("slide"),children:a("pptx.hyperlink.tabSlide")}),jsx("button",{type:"button",className:B(f==="file"),onClick:()=>h("file"),children:a("pptx.hyperlink.tabFile")}),jsx("button",{type:"button",className:B(f==="action"),onClick:()=>h("action"),children:a("pptx.hyperlink.tabAction")})]}),jsx(tle,{targetType:f,url:m,setUrl:x,tooltip:y,setTooltip:v,emailAddress:S,setEmailAddress:w,emailSubject:C,setEmailSubject:T,slideNumber:E,setSlideNumber:M,slideCount:o,filePath:A,setFilePath:R,actionVerb:k,setActionVerb:N,inputRef:l,inputCls:"w-full rounded border border-border bg-background px-2.5 py-1.5 text-xs text-foreground outline-none focus:ring-1 focus:ring-primary",onEnterConfirm:F}),jsxs("div",{className:"flex justify-end gap-2 px-4 py-3 border-t border-border",children:[jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded border border-border text-foreground hover:bg-muted",onClick:s,children:a("common.cancel")}),jsx("button",{type:"button",className:"px-3 py-1.5 text-xs rounded bg-primary text-white hover:bg-primary/90",onClick:F,children:a("common.apply")})]})]})})]})}function nle({guides:t,onDeleteGuide:e,onStartGuideDrag:n}){return jsx(Fragment,{children:t.map(r=>jsx("div",{className:"absolute z-[49] pointer-events-auto",style:r.axis==="h"?{left:0,right:0,top:r.position,height:1,backgroundColor:"rgba(250, 204, 21, 0.9)",cursor:"row-resize"}:{top:0,bottom:0,left:r.position,width:1,backgroundColor:"rgba(250, 204, 21, 0.9)",cursor:"col-resize"},onDoubleClick:o=>{o.stopPropagation(),e?.(r.id);},onPointerDown:o=>{o.stopPropagation(),o.currentTarget.setPointerCapture(o.pointerId),n({id:r.id,axis:r.axis,pointerId:o.pointerId});},title:"Drag guide. Double-click to remove."},r.id))})}function rle({backgroundImage:t,backgroundGradient:e}){return jsxs(Fragment,{children:[t&&jsx("img",{src:t,alt:"",className:"absolute inset-0 w-full h-full object-cover pointer-events-none",draggable:false}),e&&jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:e}})]})}function ole({marqueeSelectionState:t}){return t?jsx("div",{className:"absolute border border-primary bg-primary/10 pointer-events-none z-50",style:{left:Math.min(t.startX,t.currentX),top:Math.min(t.startY,t.currentY),width:Math.abs(t.currentX-t.startX),height:Math.abs(t.currentY-t.startY)}}):null}function ile({snapLines:t}){return jsx(Fragment,{children:t.map((e,n)=>jsx("div",{className:"absolute bg-red-500 pointer-events-none z-50",style:e.axis==="x"?{left:e.position,top:0,width:1,height:"100%"}:{left:0,top:e.position,width:"100%",height:1}},n))})}function ale({comments:t,canvasSize:e,onCommentMarkerClick:n}){return jsx("div",{className:"absolute inset-0 pointer-events-none z-[45]",children:t.map((r,o)=>{let i=B7(r,o,e.width,e.height);return jsx("div",{className:"absolute pointer-events-auto cursor-pointer",style:{left:i.x-10,top:i.y-10,width:20,height:20,borderRadius:"50%",backgroundColor:"rgba(255, 165, 0, 0.9)",border:"2px solid #fff",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,fontWeight:700,color:"#fff",lineHeight:1},title:`${r.author??"Comment"}: ${r.text}`,onClick:s=>{s.stopPropagation(),n?.(r.id);},children:o+1},r.id)})})}function lle({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r,onConnectionSiteDown:o,onConnectorDragMove:i,onConnectionSiteDrop:s,onConnectorDragEnd:a}){return jsxs("div",{className:"absolute inset-0 z-[55] pointer-events-none",onMouseMove:i,onMouseUp:a,style:{pointerEvents:r?"auto":"none"},children:[t.elements.filter(l=>l.type!=="connector").map(l=>gd(l.width,l.height).map(d=>jsx("div",{className:"absolute rounded-full border-2 border-blue-500 bg-blue-400/60 hover:bg-blue-500 hover:scale-125 transition-transform cursor-crosshair",style:{left:l.x+d.x-5,top:l.y+d.y-5,width:10,height:10,pointerEvents:"auto",zIndex:56},onMouseDown:u=>o(l.id,d.index,u),onMouseUp:()=>r?s(l.id,d.index):void 0},`${l.id}-site-${d.index}`))),r&&jsx(nqe,{activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r})]})}function nqe({activeSlide:t,canvasSize:e,zoom:n,connectorDragState:r}){let o=t.elements.find(h=>h.id===r.startElementId);if(!o)return null;let i=gd(o.width,o.height),s=i[r.startSiteIndex]??i[0],a=o.x+s.x,l=o.y+s.y,c=n.canvasStageRef.current;if(!c)return null;let d=c.getBoundingClientRect(),u=n.editorScale||1,p=(r.currentX-d.left)/u,f=(r.currentY-d.top)/u;return jsx("svg",{className:"absolute inset-0",style:{width:e.width,height:e.height,pointerEvents:"none"},viewBox:`0 0 ${e.width} ${e.height}`,children:jsx("line",{x1:a,y1:l,x2:p,y2:f,stroke:"#3b82f6",strokeWidth:2,strokeDasharray:"6 4",strokeLinecap:"round"})})}function dle({canvasSize:t,activeTool:e,drawingColor:n,drawingWidth:r,isStrokeActive:o,liveStrokeD:i,onPointerDown:s,onPointerMove:a,onPointerUp:l}){return jsx("svg",{className:"absolute inset-0 z-[60]",style:{width:t.width,height:t.height,cursor:"crosshair",touchAction:"none"},viewBox:`0 0 ${t.width} ${t.height}`,onPointerDown:s,onPointerMove:a,onPointerUp:l,children:o&&i&&jsx("path",{d:i,fill:"none",stroke:n,strokeWidth:r,strokeOpacity:e==="highlighter"?.4:1,strokeLinecap:"round",strokeLinejoin:"round"})})}function ule({canvasSize:t,gridSpacingPx:e=8,visible:n}){let r=Math.max(e,2),o=useMemo(()=>`grid-dot-pattern-${Math.random().toString(36).slice(2,8)}`,[]);return n?jsxs("svg",{className:"absolute inset-0 pointer-events-none z-[2]",width:t.width,height:t.height,xmlns:"http://www.w3.org/2000/svg",children:[jsx("defs",{children:jsx("pattern",{id:o,width:r,height:r,patternUnits:"userSpaceOnUse",children:jsx("circle",{cx:r/2,cy:r/2,r:.6,fill:"rgba(156, 163, 175, 0.55)"})})}),jsx("rect",{width:t.width,height:t.height,fill:`url(#${o})`})]}):null}var sqe=37.79527559055118,Qn=20,dM=10;function vH(t,e,n){let r=n==="inches"?96:sqe,o=r*e,s=n==="inches"?8:10,a=4;for(;s>1&&o/s<a&&(s=Math.max(1,Math.floor(s/2)),!(s<=1)););let l=1,c=30;for(;o*l<c;)l*=2;let d=t/r,u=Math.ceil(d*s),p=[];for(let f=0;f<=u;f++){let h=f/s,m=h*r;if(m>t+.5)break;let x=m*e,y=f%s===0,v=Math.round(h),S=y&&v%l===0;p.push({position:x,label:S?String(v):"",isMajor:y});}return p}var fle=Vn__default.memo(function({ticks:e,widthPx:n,highlight:r}){return jsxs("svg",{width:n,height:Qn,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:n,height:Qn,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:0,y1:Qn-.5,x2:n,y2:Qn-.5,className:"stroke-border",strokeWidth:1}),r&&jsx("rect",{x:r.start,y:0,width:Math.max(r.end-r.start,1),height:Qn,className:"fill-primary/20"}),e.map((o,i)=>{let s=o.isMajor?Qn*.6:Qn*.3;return jsxs("g",{children:[jsx("line",{x1:o.position,y1:Qn,x2:o.position,y2:Qn-s,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:o.isMajor?1:.5}),o.label&&jsx("text",{x:o.position+2,y:dM+1,fontSize:dM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})}),hle=Vn__default.memo(function({ticks:e,heightPx:n,highlight:r}){return jsxs("svg",{width:Qn,height:n,className:"block select-none","aria-hidden":"true",children:[jsx("rect",{width:Qn,height:n,className:"fill-gray-100 dark:fill-gray-800"}),jsx("line",{x1:Qn-.5,y1:0,x2:Qn-.5,y2:n,className:"stroke-border",strokeWidth:1}),r&&jsx("rect",{x:0,y:r.start,width:Qn,height:Math.max(r.end-r.start,1),className:"fill-primary/20"}),e.map((o,i)=>{let s=o.isMajor?Qn*.6:Qn*.3;return jsxs("g",{children:[jsx("line",{x1:Qn,y1:o.position,x2:Qn-s,y2:o.position,className:"stroke-gray-400 dark:stroke-gray-500",strokeWidth:o.isMajor?1:.5}),o.label&&jsx("text",{x:2,y:o.position+dM+2,fontSize:dM,className:"fill-gray-500 dark:fill-gray-400",style:{fontFamily:"system-ui, sans-serif"},children:o.label})]},i)})]})});function gle({canvasSize:t,editorScale:e,unit:n,visible:r,selectedBounds:o,onCreateGuideFromRuler:i}){let s=useMemo(()=>vH(t.width,e,n),[t.width,e,n]),a=useMemo(()=>vH(t.height,e,n),[t.height,e,n]),l=useMemo(()=>o?{start:o.x*e,end:(o.x+o.width)*e}:null,[o,e]),c=useMemo(()=>o?{start:o.y*e,end:(o.y+o.height)*e}:null,[o,e]),[d,u]=useState(null),p=useRef(null),f=useRef(null),h=useCallback(S=>{i&&(S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),u({axis:"h",pointerId:S.pointerId}));},[i]),m=useCallback(S=>{i&&(S.preventDefault(),S.currentTarget.setPointerCapture(S.pointerId),u({axis:"v",pointerId:S.pointerId}));},[i]),x=useCallback(S=>{if(!d||!i)return;try{S.currentTarget.releasePointerCapture(d.pointerId);}catch{}let w=e||1;if(d.axis==="h"){let C=p.current;if(!C){u(null);return}let T=C.getBoundingClientRect(),E=S.clientY-T.top;if(E>Qn){let M=(E-Qn)/w;M>=0&&M<=t.height&&i("h",M);}}else {let C=f.current;if(!C){u(null);return}let T=C.getBoundingClientRect(),E=S.clientX-T.left;if(E>Qn){let M=(E-Qn)/w;M>=0&&M<=t.width&&i("v",M);}}u(null);},[d,i,e,t]);if(!r)return null;let y=t.width*e,v=t.height*e;return jsxs(Fragment,{children:[jsx("div",{className:"absolute z-[51] bg-gray-100 dark:bg-gray-800 border-r border-b border-border",style:{top:0,left:0,width:Qn,height:Qn}}),jsx("div",{ref:p,className:"absolute z-[50] overflow-visible",style:{top:0,left:Qn,width:y,height:Qn,cursor:i?"row-resize":void 0},onPointerDown:h,onPointerUp:x,children:jsx(fle,{ticks:s,widthPx:y,highlight:l})}),jsx("div",{ref:f,className:"absolute z-[50] overflow-visible",style:{top:Qn,left:0,width:Qn,height:v,cursor:i?"col-resize":void 0},onPointerDown:m,onPointerUp:x,children:jsx(hle,{ticks:a,heightPx:v,highlight:c})})]})}function Zv(t){let e=t.target;for(;e;){if(e.dataset?.pptxElement==="true")return e.dataset.elementId||null;e=e.parentElement;}return null}var uqe=300;function ble({cbRef:t,onCanvasMouseDown:e,findResults:n,findResultIndex:r,activeSlideIndex:o,selectedElement:i,zoom:s,onMoveGuide:a}){let l=useMemo(()=>{let C=new Map;if(!n||n.length===0||o===null)return C;for(let T=0;T<n.length;T++){let E=n[T];if(E.slideIndex!==o)continue;C.has(E.elementId)||C.set(E.elementId,new Map);let M=C.get(E.elementId);M.has(E.segmentIndex)||M.set(E.segmentIndex,[]),M.get(E.segmentIndex).push({startOffset:E.startOffset,length:E.length,isCurrent:T===(r??-1)});}return C},[n,r,o]),c=useMemo(()=>i?{x:i.x,y:i.y,width:i.width,height:i.height}:null,[i]),d=useCallback(C=>{let T=Zv(C);T&&t.current.onClick(T,C);},[t]),u=useCallback(C=>{let T=Zv(C);T&&t.current.onDoubleClick(T,C);},[t]),p=useRef(false),f=useCallback(C=>{if(p.current){p.current=false;return}let T=Zv(C);if(T){t.current.onMouseDown(T,C);return}e?.(C);},[t,e]),h=useRef(null),m=useCallback(C=>{if(C.pointerType==="mouse")return;p.current=true,C.currentTarget.setPointerCapture?.(C.pointerId);let T=Zv(C);if(T){let E=C.timeStamp||Date.now(),M=h.current;if(M&&M.id===T&&E-M.time<uqe){h.current=null,t.current.onDoubleClick(T,C);return}h.current={id:T,time:E},t.current.onMouseDown(T,C);return}h.current=null,e?.(C);},[t,e]),x=useCallback(C=>{let T=Zv(C);T&&t.current.onContextMenu(T,C);},[t]),[y,v]=useState(null),S=useCallback(C=>{if(!y||!a)return;let T=s.canvasStageRef.current;if(!T)return;let E=T.getBoundingClientRect(),M=s.editorScale||1,A=y.axis==="h"?(C.clientY-E.top)/M:(C.clientX-E.left)/M;a(y.id,A);},[y,a,s.canvasStageRef,s.editorScale]),w=useCallback(C=>{if(y){try{C.currentTarget.releasePointerCapture(y.pointerId);}catch{}v(null);}},[y]);return {elementFindHighlightsMap:l,selectedBounds:c,handleStageClick:d,handleStageDblClick:u,handleStageMouseDown:f,handleStagePointerDown:m,handleStageContextMenu:x,draggingGuide:y,setDraggingGuide:v,handleStagePointerMove:S,handleStagePointerUp:w}}function vle({activeSlide:t,zoom:e,onCreateConnector:n}){let[r,o]=useState(null),i=useCallback((c,d,u)=>{u.stopPropagation(),u.preventDefault(),o({startElementId:c,startSiteIndex:d,currentX:u.clientX,currentY:u.clientY});},[]),s=useCallback(c=>{r&&o(d=>d?{...d,currentX:c.clientX,currentY:c.clientY}:null);},[r]),a=useCallback((c,d)=>{if(!r||!n)return;if(r.startElementId===c){o(null);return}let u=t?.elements.find(R=>R.id===r.startElementId),p=t?.elements.find(R=>R.id===c);if(!u||!p){o(null);return}let f=gd(u.width,u.height),h=gd(p.width,p.height),m=f[r.startSiteIndex]??f[0],x=h[d]??h[0],y=u.x+m.x,v=u.y+m.y,S=p.x+x.x,w=p.y+x.y,C=Math.abs(S-y),T=Math.abs(w-v),E=Math.sqrt(C*C+T*T),M=E<100?"straightConnector1":E<300?"bentConnector3":"curvedConnector3",A={id:`conn-new-${Date.now()}`,type:"connector",x:Math.min(y,S),y:Math.min(v,w),width:Math.abs(S-y)||1,height:Math.abs(w-v)||1,shapeType:M,shapeStyle:{strokeColor:"#4472C4",strokeWidth:2,connectorStartConnection:{shapeId:r.startElementId,connectionSiteIndex:r.startSiteIndex},connectorEndConnection:{shapeId:c,connectionSiteIndex:d}}};n(A),o(null);},[r,n,t?.elements]),l=useCallback(()=>{o(null);},[]);return {connectorDragState:r,handleConnectionSiteDown:i,handleConnectorDragMove:s,handleConnectionSiteDrop:a,handleConnectorDragEnd:l}}function Sle({activeTool:t,activeSlide:e,zoom:n,drawingColor:r,drawingWidth:o,isDrawingRef:i,onAddInkElement:s,onAddFreeformShape:a,onEraseInkElement:l}){let c=t!=="select",[d,u]=useState([]),[p,f]=useState([]),[h,m]=useState(false),x=useCallback(T=>{let E=n.canvasStageRef.current;if(!E)return null;let M=E.getBoundingClientRect(),A=n.editorScale||1;return {x:(T.clientX-M.left)/A,y:(T.clientY-M.top)/A}},[n.canvasStageRef,n.editorScale]),y=useCallback(T=>{if(T.length===0)return "";let E=[`M ${T[0].x} ${T[0].y}`];for(let M=1;M<T.length;M++)E.push(`L ${T[M].x} ${T[M].y}`);return E.join(" ")},[]),v=useCallback(T=>{if(t==="select")return;if(t==="eraser"&&e){let M=x(T);if(!M)return;let A=15;for(let R of [...e.elements].reverse())if(R.type==="ink"&&M.x>=R.x-A&&M.x<=R.x+R.width+A&&M.y>=R.y-A&&M.y<=R.y+R.height+A){l?.(R.id);break}return}let E=x(T);E&&(T.preventDefault(),T.target.setPointerCapture(T.pointerId),u([E]),f([T.pressure]),m(true),i&&(i.current=true));},[t,e,x,i,l]),S=useCallback(T=>{if(!h||t==="select"||t==="eraser")return;let E=x(T);E&&(u(M=>[...M,E]),f(M=>[...M,T.pressure]));},[h,t,x]),w=useCallback(T=>{if(!h||t==="select"||t==="eraser")return;if(T.target.releasePointerCapture(T.pointerId),m(false),i&&(i.current=false),d.length<2){u([]);return}let E=1/0,M=1/0,A=-1/0,R=-1/0;for(let D of d)D.x<E&&(E=D.x),D.y<M&&(M=D.y),D.x>A&&(A=D.x),D.y>R&&(R=D.y);let k=o;E-=k,M-=k,A+=k,R+=k;let N=Math.max(A-E,1),F=Math.max(R-M,1),B=d.map(D=>({x:D.x-E,y:D.y-M}));if(t==="freeform"){let O=Math.round(N*100),U=Math.round(F*100),H=[];for(let Z=0;Z<B.length;Z++){let J={x:Math.round(B[Z].x*100),y:Math.round(B[Z].y*100)};H.push(Z===0?{type:"moveTo",pt:J}:{type:"lineTo",pt:J});}H.length>2&&H.push({type:"close"});let j={id:`shape-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"shape",x:E,y:M,width:N,height:F,shapeType:"custom",shapeStyle:{fillColor:"transparent",strokeColor:r,strokeWidth:o},customGeometryPaths:[{width:O,height:U,segments:H}]};a?.(j);}else {let D=y(B),O=t==="highlighter",U=p.length>=2&&p.some(j=>Math.abs(j-p[0])>.01),H={id:`ink-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,type:"ink",x:E,y:M,width:N,height:F,inkPaths:[D],inkColors:[r],inkWidths:[o],inkOpacities:[O?.4:1],inkTool:O?"highlighter":"pen",...U?{inkPointPressures:[p]}:{}};s?.(H);}u([]),f([]);},[h,t,d,r,o,i,s,a,y,p]),C=useMemo(()=>h?y(d):"",[h,d,y]);return {isDrawing:c,isStrokeActive:h,liveStrokeD:C,currentStrokePoints:d,handleDrawPointerDown:v,handleDrawPointerMove:S,handleDrawPointerUp:w}}function wle(t){let e=useRef(t);e.current=t;let n=useCallback((u,p,f)=>e.current.onResizePointerDown(u,p,f),[]),r=useCallback((u,p)=>e.current.onAdjustmentPointerDown(u,p),[]),o=useCallback(u=>e.current.onInlineEditChange(u),[]),i=useCallback(()=>e.current.onInlineEditCommit(),[]),s=useCallback(()=>e.current.onInlineEditCancel(),[]),a=useCallback((u,p)=>e.current.onTableCellSelect(u,p),[]),l=useCallback((u,p,f,h)=>e.current.onCommitCellEdit?.(u,p,f,h),[]),c=useCallback((u,p)=>e.current.onResizeTableColumns?.(u,p),[]),d=useCallback((u,p,f)=>e.current.onResizeTableRow?.(u,p,f),[]);return {cbRef:e,stableResizePointerDown:n,stableAdjustmentPointerDown:r,stableInlineEditChange:o,stableInlineEditCommit:i,stableInlineEditCancel:s,stableTableCellSelect:a,stableCommitCellEdit:l,stableResizeTableColumns:c,stableResizeTableRow:d}}function CH({activeSlide:t,templateElements:e,canvasSize:n,zoom:r,mode:o,canEdit:i,editTemplateMode:s,selectedElementIdSet:a,selectedElement:l,inlineEditingElementId:c,inlineEditingText:d,spellCheckEnabled:u,mediaDataUrls:p,tableEditorState:f,marqueeSelectionState:h,snapLines:m,showGrid:x,gridSpacingPx:y,showRulers:v,rulerUnit:S="inches",guides:w,presentationElementStates:C,presentationKeyframesCss:T,onClick:E,onDoubleClick:M,onMouseDown:A,onContextMenu:R,onCanvasMouseDown:k,onResizePointerDown:N,onAdjustmentPointerDown:F,onInlineEditChange:B,onInlineEditCommit:D,onInlineEditCancel:O,onTableCellSelect:U,onCommitCellEdit:H,onResizeTableColumns:j,onResizeTableRow:Z,findResults:J,findResultIndex:W,activeSlideIndex:te,activeTool:se="select",drawingColor:Ce="#000000",drawingWidth:ee=3,isDrawingRef:ce,onAddInkElement:de,onAddFreeformShape:Ne,onEraseInkElement:Ue,onActionClick:he,onHyperlinkClick:Be,comments:Me,showCommentMarkers:ge=false,onCommentMarkerClick:Te,onMoveGuide:be,onDeleteGuide:xe,onCreateGuideFromRuler:Pe,connectorCreationMode:Xe=false,onCreateConnector:Y,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt,collaborationOverlay:V}){let $=(o==="edit"||o==="master")&&i,{cbRef:ie,stableResizePointerDown:ve,stableAdjustmentPointerDown:De,stableInlineEditChange:$e,stableInlineEditCommit:ze,stableInlineEditCancel:ae,stableTableCellSelect:Se,stableCommitCellEdit:Ye,stableResizeTableColumns:Q,stableResizeTableRow:pe}=wle({onClick:E,onDoubleClick:M,onMouseDown:A,onContextMenu:R,onResizePointerDown:N,onAdjustmentPointerDown:F,onInlineEditChange:B,onInlineEditCommit:D,onInlineEditCancel:O,onTableCellSelect:U,onCommitCellEdit:H,onResizeTableColumns:j,onResizeTableRow:Z}),{elementFindHighlightsMap:Re,selectedBounds:nt,handleStageClick:Ke,handleStageDblClick:Ct,handleStageMouseDown:ne,handleStagePointerDown:Ze,handleStageContextMenu:Le,setDraggingGuide:rt,handleStagePointerMove:qe,handleStagePointerUp:He}=ble({cbRef:ie,onCanvasMouseDown:k,findResults:J,findResultIndex:W,activeSlideIndex:te,selectedElement:l,zoom:r,onMoveGuide:be}),{connectorDragState:gt,handleConnectionSiteDown:Nt,handleConnectorDragMove:In,handleConnectionSiteDrop:yn,handleConnectorDragEnd:Zo}=vle({activeSlide:t,zoom:r,onCreateConnector:Y}),{isDrawing:Ii,isStrokeActive:La,liveStrokeD:Qc,handleDrawPointerDown:ed,handleDrawPointerMove:ra,handleDrawPointerUp:oa}=Sle({activeTool:se,activeSlide:t,zoom:r,drawingColor:Ce,drawingWidth:ee,isDrawingRef:ce,onAddInkElement:de,onAddFreeformShape:Ne,onEraseInkElement:Ue}),Fs=v?Qn:0;return jsx("div",{ref:r.canvasViewportRef,className:"flex-1 overflow-auto relative",style:{touchAction:"pan-x pan-y"},children:jsxs("div",{ref:r.editWrapperRef,className:"relative mx-auto my-4",style:{width:n.width*r.editorScale+Fs,height:n.height*r.editorScale+Fs},children:[jsx(gle,{canvasSize:n,editorScale:r.editorScale,unit:S,visible:v,selectedBounds:nt,onCreateGuideFromRuler:Pe}),jsxs("div",{ref:r.canvasStageRef,role:"region","aria-label":`Slide ${(te??0)+1}`,"aria-roledescription":"slide",className:"relative shadow-2xl",style:{width:n.width,height:n.height,transform:`scale(${r.editorScale})`,transformOrigin:"top left",marginTop:Fs,marginLeft:Fs,touchAction:$?"none":void 0,backgroundColor:t?.backgroundColor&&t.backgroundColor!=="transparent"?t.backgroundColor:"#ffffff"},onClick:Ke,onDoubleClick:Ct,onMouseDown:ne,onPointerDown:$?Ze:void 0,onContextMenu:Le,onPointerMove:qe,onPointerUp:He,children:[T&&jsx("style",{children:T}),jsx(ule,{canvasSize:n,gridSpacingPx:y,visible:x}),jsx(nle,{guides:w,onDeleteGuide:xe,onStartGuideDrag:rt}),jsx(rle,{backgroundImage:t?.backgroundImage,backgroundGradient:t?.backgroundGradient}),e.map((Sr,pl)=>jsx(rk,{element:Sr,activeSlide:t,isSelected:a.has(Sr.id),isInlineEditing:c===Sr.id,inlineEditingText:d,canInteract:(o==="edit"||o==="master")&&i&&s,spellCheckEnabled:u,mediaDataUrls:p,selectionColorClass:"blue-400",showHoverBorder:false,opacity:.95,zIndex:pl,imageAltText:"Template element",showResizeHandles:a.has(Sr.id)&&a.size<=1&&!c,renderInk:false,renderGroups:false,adjustmentHandleDescriptor:l?.id===Sr.id?kE(Sr):null,onResizePointerDown:ve,onAdjustmentPointerDown:De,onInlineEditChange:$e,onInlineEditCommit:ze,onInlineEditCancel:ae,onActionClick:he,onHyperlinkClick:Be,animationState:C?.get(Sr.id),presentationElementStates:C,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt},`tpl-${Sr.id}`)),t?.elements.map((Sr,pl)=>jsx(rk,{element:Sr,activeSlide:t,isSelected:a.has(Sr.id),isInlineEditing:c===Sr.id,inlineEditingText:d,canInteract:(o==="edit"||o==="master")&&i,spellCheckEnabled:u,mediaDataUrls:p,tableEditorState:f,selectionColorClass:"blue-500",showHoverBorder:true,zIndex:e.length+pl,imageAltText:"Slide element",showResizeHandles:a.has(Sr.id)&&a.size<=1&&!c,renderInk:true,renderGroups:true,adjustmentHandleDescriptor:l?.id===Sr.id?kE(Sr):null,onResizePointerDown:ve,onAdjustmentPointerDown:De,onInlineEditChange:$e,onInlineEditCommit:ze,onInlineEditCancel:ae,onTableCellSelect:Se,onCommitCellEdit:Ye,onResizeTableColumns:Q,onResizeTableRow:pe,findHighlights:Re.get(Sr.id),onActionClick:he,onHyperlinkClick:Be,animationState:C?.get(Sr.id),presentationElementStates:C,allSlides:Ge,onZoomClick:Ve,sourceSlideIndex:We,fieldContext:ke,tableStyleContext:wt},Sr.id)),jsx(ole,{marqueeSelectionState:h}),ge&&Me&&Me.length>0&&jsx(ale,{comments:Me,canvasSize:n,onCommentMarkerClick:Te}),jsx(ile,{snapLines:m}),Xe&&t&&jsx(lle,{activeSlide:t,canvasSize:n,zoom:r,connectorDragState:gt,onConnectionSiteDown:Nt,onConnectorDragMove:In,onConnectionSiteDrop:yn,onConnectorDragEnd:Zo}),Ii&&jsx(dle,{canvasSize:n,activeTool:se,drawingColor:Ce,drawingWidth:ee,isStrokeActive:La,liveStrokeD:Qc,onPointerDown:ed,onPointerMove:ra,onPointerUp:oa}),V]})]})})}function MH({isShortcutHelpOpen:t,isAccessibilityPanelOpen:e,showSlideSorter:n,accessibilityIssues:r,slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onCloseShortcuts:c,onCloseAccessibility:d,onSelectSlide:u,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onCloseSorter:x,reducedMotion:y,onToggleReducedMotion:v}){return t||e||n?jsxs(Fragment,{children:[t&&jsx(xU,{isOpen:t,onClose:c}),e&&jsx(yU,{isOpen:e,issues:r,onClose:d,reducedMotion:y,onToggleReducedMotion:v}),n&&jsx($6,{slides:o,activeSlideIndex:i,canvasSize:s,canEdit:a,sectionGroups:l,onSelectSlide:u,onMoveSlide:p,onDeleteSlides:f,onDuplicateSlides:h,onToggleHideSlides:m,onClose:x})]}):null}function EH({activeSlide:t,allSlides:e,isSlideNotesCollapsed:n,canEdit:r,slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,onToggleNotes:l,onUpdateNotes:c,collaborationSlot:d,notesPanelHeight:u,onResizeBottom:p,scale:f,onZoomIn:h,onZoomOut:m,onZoomToFit:x,mode:y,onSetMode:v,onToggleSlideSorter:S,hideStatusBar:w=false}){return jsxs(Fragment,{children:[p&&!n&&jsx(Cp,{direction:"vertical",onResize:p}),jsx(V6,{activeSlide:t,allSlides:e,isExpanded:!n,canEdit:r,onToggle:l,onUpdateNotes:c,panelHeight:u}),!w&&jsx(SU,{slideCount:o,activeSlideIndex:i,isDirty:s,autosaveStatus:a,scale:f,onZoomIn:h,onZoomOut:m,onZoomToFit:x,isNotesExpanded:!n,onToggleNotes:l,mode:y,onSetMode:v,onToggleSlideSorter:S,collaborationSlot:d})]})}function AH({isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,effectiveSelectedIds:a,tableEditorState:l,sidebarPanelMode:c,activeSlideIndex:d,comments:u,onSetSidebarPanelMode:p,onClose:f,onUpdateElementStyle:h,onUpdateTextStyle:m,onUpdateElement:x,onApplySelection:y,onSetCanvasSize:v,onMoveLayer:S,onMoveLayerToEdge:w,onDeleteElement:C,onUpdateSlide:T,presentationProperties:E,onUpdatePresentationProperties:M,notesMaster:A,handoutMaster:R,notesCanvasSize:k,coreProperties:N,appProperties:F,customProperties:B,themeOptions:D,onUpdateCoreProperties:O,onUpdateAppProperties:U,onUpdateCustomProperties:H,tagCollections:j,onUpdateTagCollections:Z,onApplyTheme:J,editTemplateMode:W,slideMasters:te,onSetTemplateBackground:se,onGetTemplateBackgroundColor:Ce,mediaDataUrls:ee,theme:ce,panelWidth:de}){if(!t)return null;let Ne=c;if(!s&&Ne!=="comments"&&Ne!=="properties")return null;let Ue=r?.id??"",he=u.commentDraftBySlideId[Ue]??"",Be=u.editingCommentIdBySlideId[Ue]??null;return jsx("div",{role:"complementary","aria-label":"Properties",className:"h-full flex-shrink-0 max-md:absolute max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:z-30",style:de?{width:de}:void 0,children:jsx(W8,{isOpen:t,canEdit:e,mode:n,activeSlide:r,slides:o,canvasSize:i,selectedElement:s,selectedElementIds:a,tableEditorState:l,activeTab:c,onSetActiveTab:Me=>p(Me),onClose:f,onUpdateElementStyle:h,onUpdateTextStyle:m,onUpdateElement:x,onUpdateSlide:T,onSelectElement:Me=>y(Me),onMoveLayer:S,onMoveLayerToEdge:w,onDeleteElement:C,comments:r?.comments??[],presentationProperties:E,onUpdatePresentationProperties:M,notesMaster:A,handoutMaster:R,notesCanvasSize:k,coreProperties:N,appProperties:F,customProperties:B,themeOptions:D,onUpdateCoreProperties:O,onUpdateAppProperties:U,onUpdateCustomProperties:H,tagCollections:j,onUpdateTagCollections:Z,onApplyTheme:J,commentDraft:he,editingCommentId:Be,commentEditDraft:Be?u.commentEditDraftByCommentId[Be]??"":"",onSetCommentDraft:Me=>u.handleCommentDraftChange(Ue,Me),onAddComment:()=>u.handleAddSlideComment(d),onDeleteComment:Me=>u.handleDeleteSlideComment(d,Me),onStartEditComment:Me=>u.handleStartCommentEdit(Ue,Me),onSaveEditComment:Me=>u.handleSaveCommentEdit(d,Me),onCancelEditComment:()=>u.handleCancelCommentEdit(Ue),onSetCommentEditDraft:Me=>u.handleSetCommentEditDraft(u.editingCommentIdBySlideId[Ue]??"",Me),onToggleCommentResolved:Me=>u.handleToggleCommentResolved(d,Me),onStartReply:Me=>u.handleStartReply(d,Me),onCancelReply:u.handleCancelReply,onReplyDraftChange:(Me,ge)=>u.handleReplyDraftChange(Me,ge),onSubmitReply:Me=>u.handleSubmitReply(d,Me),replyingToCommentId:u.replyingToCommentId,replyDraftByCommentId:u.replyDraftByCommentId,onUpdateCanvasSize:v,editTemplateMode:W,slideMasters:te,onSetTemplateBackground:se,onGetTemplateBackgroundColor:Ce,mediaDataUrls:ee,theme:ce,panelWidth:de})})}function Mle(t,e){if(!e?.layoutPath||!t.some(d=>d.masterPath))return t;let o=t.find(d=>d.path===e.layoutPath)?.masterPath;if(!o)return t;let i=t.filter(d=>d.masterPath===o),s=new Map;for(let d of i){let u=d.path===e.layoutPath;(!s.get(d.name)||u)&&s.set(d.name,d);}let a=new Set(Array.from(s.values()).map(d=>d.path)),l=[],c=new Set;for(let d of i)a.has(d.path)&&(c.has(d.name)||(c.add(d.name),l.push(d)));return l}function PH(t){let{mode:e,canEdit:n,state:r,selectedElement:o,activeSlide:i,zoom:s,history:a,findReplace:l,manipulation:c,insertHandlers:d,exportHandlers:u,printHandlers:p,propertyHandlers:f,dialogs:h,slideOps:m,ops:x,onSetMode:y,onEnterPresenterView:v,onEnterRehearsalMode:S,onOpenSettings:w,onOpenShareDialog:C,onToggleFormatPainter:T}=t,E=useCallback((N,F)=>{if(!o||!i)return;let B=i.animations??[],D=B.find(U=>U.elementId===o.id),O=N;if(D){let U=B.map(H=>H.elementId===o.id?{...H,[F]:O}:H);f.handleUpdateSlide({animations:U});}else {let U={elementId:o.id,[F]:O,durationMs:500,order:B.length,trigger:"onClick"};f.handleUpdateSlide({animations:[...B,U]});}},[o,i,f]),M=useCallback(()=>{if(!o||!i)return;let F=(i.animations??[]).filter(B=>B.elementId!==o.id);f.handleUpdateSlide({animations:F});},[o,i,f]),A=useCallback(N=>{if(!i)return;let F=i.transition??{type:"none"};f.handleUpdateSlide({transition:{...F,...N}});},[i,f]),R=Vn__default.useMemo(()=>Mle(r.layoutOptions,i),[r.layoutOptions,i]),k=useCallback(()=>{let N=i?.transition;N&&(x.updateSlides(F=>F.map(B=>({...B,transition:N}))),a.markDirty());},[i,x,a]);return jsxs(Fragment,{children:[jsx(R8,{mode:e,canEdit:n,isNarrowViewport:h.isNarrowViewport,isSidebarCollapsed:!r.isSlidesPaneOpen,isInspectorPaneOpen:r.isInspectorPaneOpen,isCompactToolbarOpen:r.isCompactToolbarOpen,toolbarSection:r.toolbarSection,scale:s.scale,canUndo:a.canUndo,canRedo:a.canRedo,undoLabel:a.undoLabel,redoLabel:a.redoLabel,findReplaceOpen:l.findReplaceOpen,selectedElement:o,tableEditorState:r.tableEditorState,editTemplateMode:r.editTemplateMode,newShapeType:r.newShapeType,activeTool:r.activeTool,drawingColor:r.drawingColor,drawingWidth:r.drawingWidth,clipboardPayload:r.clipboardPayload,onSetMode:y,onToggleSidebar:()=>r.setIsSlidesPaneOpen(N=>!N),onToggleInspector:()=>r.setIsInspectorPaneOpen(N=>!N),onOpenAnimationPanel:()=>{r.setIsInspectorPaneOpen(true),r.setSidebarPanelMode("properties");},onAddAnimation:E,onRemoveAnimation:M,onToggleCompactToolbar:()=>r.setIsCompactToolbarOpen(N=>!N),onSetToolbarSection:r.setToolbarSection,onZoomIn:s.handleZoomIn,onZoomOut:s.handleZoomOut,onZoomToFit:s.handleZoomToFit,onUndo:a.handleUndo,onRedo:a.handleRedo,onToggleFindReplace:()=>l.setFindReplaceOpen(!l.findReplaceOpen),onSetNewShapeType:r.setNewShapeType,onAddTextBox:d.handleAddTextBox,onAddShape:d.handleAddShape,onAddTable:d.handleAddTable,onAddSmartArt:()=>h.setIsSmartArtDialogOpen(true),onAddEquation:()=>{h.setEditingEquationOmml(null),h.setIsEquationDialogOpen(true);},onAddActionButton:d.handleAddActionButton,onInsertField:d.handleInsertField,onOpenImagePicker:()=>r.imageInputRef.current?.click(),onOpenMediaPicker:()=>r.mediaInputRef.current?.click(),onSetActiveTool:r.setActiveTool,onSetDrawingColor:r.setDrawingColor,onSetDrawingWidth:r.setDrawingWidth,onSetEditTemplateMode:r.setEditTemplateMode,spellCheckEnabled:r.spellCheckEnabled,showGrid:r.showGrid,showRulers:r.showRulers,snapToGrid:r.snapToGrid,snapToShape:r.snapToShape,onSetSpellCheckEnabled:r.setSpellCheckEnabled,onSetShowGrid:r.setShowGrid,onSetShowRulers:r.setShowRulers,onSetSnapToGrid:r.setSnapToGrid,onSetSnapToShape:r.setSnapToShape,onAddGuide:h.handleAddGuide,onAlignElements:c.handleAlignElements,onCopy:c.handleCopy,onCut:c.handleCut,onPaste:c.handlePaste,onFlip:c.handleFlip,onMoveLayer:c.handleMoveLayer,onMoveLayerToEdge:c.handleMoveLayerToEdge,onDuplicate:c.handleDuplicate,onDelete:c.handleDelete,onExportPng:u.handleExportPng,onExportPdf:u.handleExportPdf,onExportVideo:u.handleExportVideo,onExportGif:u.handleExportGif,onPackageForSharing:u.handlePackageForSharing,onOpenShareDialog:C,onSaveAsPptx:u.handleSaveAsPptx,onSaveAsPpsx:u.handleSaveAsPpsx,onSaveAsPptm:u.handleSaveAsPptm,hasMacros:r.hasMacros,onCopySlideAsImage:u.handleCopySlideAsImage,onPrint:p.handlePrint,onToggleShortcuts:()=>r.setIsShortcutHelpOpen(N=>!N),onOpenSettings:w,onRunAccessibilityCheck:h.handleRunAccessibilityCheck,onToggleSlideSorter:()=>r.setShowSlideSorter(N=>!N),onUpdateTextStyle:x.updateSelectedTextStyle,isOverflowMenuOpen:r.isOverflowMenuOpen,onSetOverflowMenuOpen:r.setIsOverflowMenuOpen,layoutOptions:R,onInsertSlideFromLayout:m.handleInsertSlideFromLayout,customShows:r.customShows,activeCustomShowId:r.activeCustomShowId,onSetActiveCustomShowId:r.setActiveCustomShowId,onCreateCustomShow:h.handleCreateCustomShow,onRenameActiveCustomShow:h.handleRenameActiveCustomShow,onDeleteActiveCustomShow:h.handleDeleteActiveCustomShow,onToggleCurrentSlideInActiveShow:h.handleToggleCurrentSlideInActiveShow,isCurrentSlideInActiveShow:h.isCurrentSlideInActiveShow,onEnterMasterView:h.handleEnterMasterView,onCloseMasterView:h.handleCloseMasterView,onToggleVersionHistory:()=>f.setIsVersionHistoryOpen(N=>!N),onOpenPasswordProtection:()=>h.setIsPasswordDialogOpen(true),onOpenDocumentProperties:()=>h.setIsDocPropsDialogOpen(true),onOpenFontEmbedding:()=>h.setIsFontEmbeddingOpen(true),onOpenDigitalSignatures:()=>h.setIsDigitalSigDialogOpen(true),onEnterPresenterView:v,onEnterRehearsalMode:S,onToggleThemeEditor:()=>r.setIsThemeEditorOpen(N=>!N),isThemeEditorOpen:r.isThemeEditorOpen,onToggleThemeGallery:()=>r.setIsThemeGalleryOpen(N=>!N),isThemeGalleryOpen:r.isThemeGalleryOpen,onCompare:f.handleCompare,onToggleComments:()=>{r.setSidebarPanelMode("comments"),r.isInspectorPaneOpen||r.setIsInspectorPaneOpen(true);},isCommentsPanelOpen:r.isInspectorPaneOpen,slideCommentCount:i?.comments?.length??0,formatPainterActive:r.formatPainterActive,canActivateFormatPainter:$Q(o),onToggleFormatPainter:T??(()=>r.setFormatPainterActive(N=>!N)),isSelectionPaneOpen:r.isSelectionPaneOpen,onToggleSelectionPane:()=>r.setIsSelectionPaneOpen(N=>!N),eyedropperActive:r.eyedropperActive,onToggleEyedropper:()=>r.setEyedropperActive(N=>!N),onOpenSetUpSlideShow:()=>h.setIsSetUpSlideShowOpen(true),onOpenBroadcastDialog:()=>h.setIsBroadcastDialogOpen(true),onToggleSubtitles:h.handleToggleSubtitles,showSubtitles:!!r.presentationProperties.showSubtitles,activeSlide:i,onTransitionChange:A,onApplyTransitionToAll:k}),r.hasDigitalSignatures&&jsx("div",{className:"flex items-center px-3 py-1 z-10",children:jsx(o8,{hasSignatures:r.hasDigitalSignatures,signatureCount:r.digitalSignatureCount,onClick:()=>h.setIsDigitalSigDialogOpen(true)})}),jsx("input",{ref:r.imageInputRef,type:"file",name:"image-upload",accept:"image/*",className:"hidden",onChange:d.handleImageFileChange}),jsx("input",{ref:r.mediaInputRef,type:"file",name:"media-upload",accept:"video/*,audio/*",className:"hidden",onChange:d.handleMediaFileChange})]})}var hM={"\\alpha":"\u03B1","\\beta":"\u03B2","\\gamma":"\u03B3","\\delta":"\u03B4","\\epsilon":"\u03B5","\\varepsilon":"\u03B5","\\zeta":"\u03B6","\\eta":"\u03B7","\\theta":"\u03B8","\\vartheta":"\u03D1","\\iota":"\u03B9","\\kappa":"\u03BA","\\lambda":"\u03BB","\\mu":"\u03BC","\\nu":"\u03BD","\\xi":"\u03BE","\\pi":"\u03C0","\\rho":"\u03C1","\\sigma":"\u03C3","\\tau":"\u03C4","\\upsilon":"\u03C5","\\phi":"\u03C6","\\varphi":"\u03D5","\\chi":"\u03C7","\\psi":"\u03C8","\\omega":"\u03C9","\\Gamma":"\u0393","\\Delta":"\u0394","\\Theta":"\u0398","\\Lambda":"\u039B","\\Xi":"\u039E","\\Pi":"\u03A0","\\Sigma":"\u03A3","\\Phi":"\u03A6","\\Psi":"\u03A8","\\Omega":"\u03A9"},mM={"\\times":"\xD7","\\div":"\xF7","\\pm":"\xB1","\\mp":"\u2213","\\cdot":"\xB7","\\leq":"\u2264","\\geq":"\u2265","\\neq":"\u2260","\\approx":"\u2248","\\equiv":"\u2261","\\ll":"\u226A","\\gg":"\u226B","\\subset":"\u2282","\\supset":"\u2283","\\subseteq":"\u2286","\\supseteq":"\u2287","\\in":"\u2208","\\notin":"\u2209","\\cup":"\u222A","\\cap":"\u2229","\\to":"\u2192","\\rightarrow":"\u2192","\\leftarrow":"\u2190","\\Rightarrow":"\u21D2","\\Leftarrow":"\u21D0","\\infty":"\u221E","\\partial":"\u2202","\\nabla":"\u2207","\\forall":"\u2200","\\exists":"\u2203","\\ldots":"\u2026","\\cdots":"\u22EF","\\le":"\u2264","\\ge":"\u2265","\\ne":"\u2260"},gM={"\\sum":"\u2211","\\prod":"\u220F","\\int":"\u222B","\\iint":"\u222C","\\iiint":"\u222D","\\oint":"\u222E","\\coprod":"\u2210","\\bigcup":"\u22C3","\\bigcap":"\u22C2"},_le=new Set(["sin","cos","tan","cot","sec","csc","arcsin","arccos","arctan","sinh","cosh","tanh","coth","log","ln","exp","lim","min","max","sup","inf","det","dim","mod","gcd","deg","hom","ker"]);function Ele(t){let e=[],n=0;for(;n<t.length;){let r=t[n];if(r==="{")e.push({type:"group_start",value:"{"}),n++;else if(r==="}")e.push({type:"group_end",value:"}"}),n++;else if(r==="^")e.push({type:"superscript",value:"^"}),n++;else if(r==="_")e.push({type:"subscript",value:"_"}),n++;else if(r==="\\"){let o="\\";if(n++,n<t.length&&/[a-zA-Z]/.test(t[n]))for(;n<t.length&&/[a-zA-Z]/.test(t[n]);)o+=t[n],n++;else n<t.length&&(o+=t[n],n++);e.push({type:"command",value:o});}else /\s/.test(r)?(n++,e.push({type:"whitespace",value:" "})):(e.push({type:"text",value:r}),n++);}return e}function Zp(t,e){let n=false,r=false,o=[],i=[];for(let s=0;s<2;s++){let a=t.peek();a?.type==="superscript"&&!n?(t.next(),o=t.parseSingleOrGroup(),n=true):a?.type==="subscript"&&!r&&(t.next(),i=t.parseSingleOrGroup(),r=true);}return n&&r?{"m:sSubSup":{"m:e":t.wrapE([e]),"m:sub":t.wrapE(i),"m:sup":t.wrapE(o)}}:n?{"m:sSup":{"m:e":t.wrapE([e]),"m:sup":t.wrapE(o)}}:r?{"m:sSub":{"m:e":t.wrapE([e]),"m:sub":t.wrapE(i)}}:e}function Ale(t,e){let n=[],r=[],o=false,i=false;for(let l=0;l<2;l++){let c=t.peek();c?.type==="subscript"&&!o?(t.next(),n=t.parseSingleOrGroup(),o=true):c?.type==="superscript"&&!i&&(t.next(),r=t.parseSingleOrGroup(),i=true);}let s=t.parseSingleOrGroup(),a={"m:chr":{"@_val":e}};return o||(a["m:subHide"]={"@_val":"1"}),i||(a["m:supHide"]={"@_val":"1"}),{"m:nary":{"m:naryPr":a,"m:sub":o?t.wrapE(n):{},"m:sup":i?t.wrapE(r):{},"m:e":t.wrapE(s)}}}function Ple(t){let e=t.next(),n=e?.value==="."?"":e?.value??"(",r=[];for(;t.peek();){if(t.peek().type==="command"&&t.peek().value==="\\right"){t.next();break}let a=t.parseAtom();a&&r.push(a);}let o=t.next(),i=o?.value==="."?"":o?.value??")",s={};return n!=="("&&(s["m:begChr"]={"@_val":n}),i!==")"&&(s["m:endChr"]={"@_val":i}),{"m:d":{"m:dPr":Object.keys(s).length>0?s:void 0,"m:e":t.wrapE(r)}}}function Rle(t,e){let n=t.makeRun(e,true),r=Zp(t,n),o=[];if(t.peek()?.type==="group_start")o=t.parseGroup();else if(t.peek()&&t.peek().type!=="group_end"){let i=t.parseAtom();i&&(o=[i]);}return o.length===0?r:{"m:func":{"m:fName":t.wrapE([r]),"m:e":t.wrapE(o)}}}var RH=class{tokens;pos=0;constructor(e){this.tokens=e;}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(e){let n=this.next();if(!n||n.type!==e)throw new Error(`Expected ${e}, got ${n?.type??"EOF"}`);return n}parseGroup(){this.expect("group_start");let e=[];for(;this.peek()&&this.peek().type!=="group_end";){let n=this.parseAtom();n&&e.push(n);}return this.expect("group_end"),e}parseSingleOrGroup(){if(this.peek()?.type==="group_start")return this.parseGroup();let e=this.parseAtom();return e?[e]:[]}wrapE(e){if(e.length===1)return {"m:r":e[0]["m:r"],"m:f":e[0]["m:f"],"m:rad":e[0]["m:rad"],"m:sSup":e[0]["m:sSup"],"m:sSub":e[0]["m:sSub"],"m:sSubSup":e[0]["m:sSubSup"],"m:nary":e[0]["m:nary"],"m:d":e[0]["m:d"],"m:func":e[0]["m:func"]};let n={};for(let r of e)for(let o of Object.keys(r))if(n[o]){let i=n[o];Array.isArray(i)?i.push(r[o]):n[o]=[i,r[o]];}else n[o]=r[o];return n}makeRun(e,n=false){let r={"m:t":e};return n&&(r["m:rPr"]={"m:nor":{"@_val":"1"}}),{"m:r":r}}parseAtom(){let e=this.peek();if(!e)return null;if(e.type==="whitespace")return this.next(),this.parseAtom();if(e.type==="text"){this.next();let n=this.makeRun(e.value);return Zp(this,n)}if(e.type==="group_start"){let n=this.parseGroup();if(n.length===0)return null;let r=n.length===1?n[0]:this.wrapE(n);return Zp(this,r)}if(e.type==="command"){this.next();let n=e.value;if(hM[n]){let i=this.makeRun(hM[n]);return Zp(this,i)}if(mM[n])return this.makeRun(mM[n]);if(gM[n])return Ale(this,gM[n]);if(n==="\\frac"){let i=this.parseGroup(),s=this.parseGroup(),a={"m:f":{"m:num":this.wrapE(i),"m:den":this.wrapE(s)}};return Zp(this,a)}if(n==="\\sqrt"){if(this.peek()?.type==="text"&&this.peek()?.value==="["){this.next();let a="";for(;this.peek()&&!(this.peek().type==="text"&&this.peek().value==="]");)a+=this.next().value;this.peek()?.value==="]"&&this.next();let l=this.parseGroup(),c={"m:rad":{"m:deg":this.wrapE([this.makeRun(a)]),"m:e":this.wrapE(l)}};return Zp(this,c)}let i=this.parseGroup(),s={"m:rad":{"m:radPr":{"m:degHide":{"@_val":"1"}},"m:e":this.wrapE(i)}};return Zp(this,s)}if(n==="\\text"){let s=this.parseGroup().map(a=>{let l=a["m:r"];return l?String(l["m:t"]??""):""}).join("");return this.makeRun(s,true)}if(n==="\\left")return Ple(this);if(n==="\\right")return null;let r=n.slice(1);if(_le.has(r))return Rle(this,r);let o=this.makeRun(n.slice(1),true);return Zp(this,o)}if(e.type==="superscript"||e.type==="subscript"){this.next();let n=this.parseSingleOrGroup(),r=this.makeRun("");return e.type==="superscript"?{"m:sSup":{"m:e":this.wrapE([r]),"m:sup":this.wrapE(n)}}:{"m:sSub":{"m:e":this.wrapE([r]),"m:sub":this.wrapE(n)}}}return null}parseAll(){let e=[];for(;this.peek();){let n=this.parseAtom();n&&e.push(n);}return e}};function wN(t){let e=t.trim();if(e.length===0)return {};let n=Ele(e),o=new RH(n).parseAll();if(o.length===0)return {};let i={};for(let s of o)for(let a of Object.keys(s))if(i[a]){let l=i[a];Array.isArray(l)?l.push(s[a]):i[a]=[l,s[a]];}else i[a]=s[a];return {"m:oMathPara":{"m:oMath":i}}}var kH={};for(let[t,e]of Object.entries(hM))kH[e]=t;var CN={};for(let[t,e]of Object.entries(mM))CN[e]||(CN[e]=t);var IH={};for(let[t,e]of Object.entries(gM))IH[e]||(IH[e]=t);function wqe(t){return t==null?[]:Array.isArray(t)?t:typeof t=="object"?[t]:[]}function br(t,e){if(!t)return {};let n=t[e];return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}function X0(t){if(!t)return "";let e=t["@_val"];return typeof e=="string"?e:e!==void 0?String(e):""}function pi(t){if(!t||typeof t!="object")return "";let e=[];for(let n of Object.keys(t)){if(n.startsWith("@_"))continue;let r=wqe(t[n]);for(let o of r){let i=Cqe(n,o);i&&e.push(i);}}return e.join("")}function Cqe(t,e){switch(t){case "m:r":{let n=typeof e["m:t"]=="string"?e["m:t"]:e["m:t"]!==void 0?String(e["m:t"]):"";if(n.length===0)return "";if(kH[n])return `${kH[n]} `;if(CN[n])return `${CN[n]} `;let r=br(e,"m:rPr"),o=X0(br(r,"m:nor"));return o==="1"||o==="on"||o==="true"?`\\text{${n}}`:n}case "m:f":{let n=pi(br(e,"m:num")),r=pi(br(e,"m:den"));return `\\frac{${n}}{${r}}`}case "m:rad":{let n=br(e,"m:radPr"),r=X0(br(n,"m:degHide")),o=pi(br(e,"m:e"));if(r==="1"||r==="on"||r==="true")return `\\sqrt{${o}}`;let i=pi(br(e,"m:deg"));return i?`\\sqrt[${i}]{${o}}`:`\\sqrt{${o}}`}case "m:sSup":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sup"));return `${n}^{${r}}`}case "m:sSub":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sub"));return `${n}_{${r}}`}case "m:sSubSup":{let n=pi(br(e,"m:e")),r=pi(br(e,"m:sub")),o=pi(br(e,"m:sup"));return `${n}_{${r}}^{${o}}`}case "m:nary":{let n=br(e,"m:naryPr"),r=X0(br(n,"m:chr")),o=IH[r]??"\\int",i=X0(br(n,"m:subHide")),s=X0(br(n,"m:supHide")),a=pi(br(e,"m:sub")),l=pi(br(e,"m:sup")),c=pi(br(e,"m:e")),d=o;return a&&i!=="1"&&(d+=`_{${a}}`),l&&s!=="1"&&(d+=`^{${l}}`),d+=`{${c}}`,d}case "m:d":{let n=br(e,"m:dPr"),r=X0(br(n,"m:begChr"))||"(",o=X0(br(n,"m:endChr"))||")",i=pi(br(e,"m:e"));return `\\left${r}${i}\\right${o}`}case "m:func":{let n=pi(br(e,"m:fName")),r=pi(br(e,"m:e"));return `${n}{${r}}`}case "m:oMath":return pi(e);default:return ""}}function NH(t){if(!t||typeof t!="object")return "";let e,n=t["m:oMathPara"];return n?.["m:oMath"]?e=n["m:oMath"]:t["m:oMath"]?e=t["m:oMath"]:e=t,pi(e)}function Dle(t){let e=gPe;return typeof e.sanitize!="function"?t:e.sanitize(t,{USE_PROFILES:{mathMl:true,svg:true}})}var Lle=[{label:"Fraction",latex:"\\frac{a}{b}",i18nKey:"pptx.equation.template.fraction"},{label:"Quadratic",latex:"x=\\frac{-b\\pm\\sqrt{b^{2}-4ac}}{2a}",i18nKey:"pptx.equation.template.quadratic"},{label:"Pythagorean",latex:"a^{2}+b^{2}=c^{2}",i18nKey:"pptx.equation.template.pythagorean"},{label:"Sum",latex:"\\sum_{i=1}^{n}{a_{i}}",i18nKey:"pptx.equation.template.sum"},{label:"Integral",latex:"\\int_{a}^{b}{f(x)}dx",i18nKey:"pptx.equation.template.integral"},{label:"Square Root",latex:"\\sqrt{x^{2}+y^{2}}",i18nKey:"pptx.equation.template.squareRoot"},{label:"Limit",latex:"\\lim_{x\\to\\infty}{f(x)}",i18nKey:"pptx.equation.template.limit"},{label:"Euler's",latex:"e^{i\\pi}+1=0",i18nKey:"pptx.equation.template.euler"},{label:"Matrix 2x2",latex:"\\left[a,b;c,d\\right]",i18nKey:"pptx.equation.template.matrix"},{label:"Binomial",latex:"\\left(a+b\\right)^{n}",i18nKey:"pptx.equation.template.binomial"},{label:"Derivative",latex:"\\frac{dy}{dx}",i18nKey:"pptx.equation.template.derivative"},{label:"Trig Identity",latex:"\\sin^{2}\\theta+\\cos^{2}\\theta=1",i18nKey:"pptx.equation.template.trigIdentity"}],Pqe=Lle.map(t=>{try{let e=wN(t.latex),n=T1(e);return n?Dle(n):""}catch{return ""}});function Rqe({mathml:t}){let e=useRef(null);return useEffect(()=>{e.current&&(t?e.current.innerHTML=Dle(t):e.current.innerHTML="");},[t]),jsx("div",{ref:e,className:"flex items-center justify-center min-h-[80px] text-2xl text-foreground",style:{fontFamily:'"Cambria Math", "STIX Two Math", serif'}})}function Fle({isOpen:t,onClose:e,onInsert:n,existingOmml:r}){let{t:o}=useTranslation(),i=useMemo(()=>r?NH(r):"",[r]),[s,a]=useState(i),l=useDeferredValue(s),c=useRef(null);useEffect(()=>{t&&(a(i),setTimeout(()=>c.current?.focus(),50));},[t,i]);let{mathml:d,omml:u}=useMemo(()=>{if(!l.trim())return {mathml:"",omml:{}};try{let y=wN(l);return {mathml:T1(y),omml:y}}catch{return {mathml:"",omml:{}}}},[l]),p=useCallback(()=>{s.trim()&&(n(u),e());},[s,u,n,e]),f=useCallback(y=>{a(y);},[]),h=useCallback(y=>{y.key==="Enter"&&(y.metaKey||y.ctrlKey)&&(y.preventDefault(),p()),y.key==="Escape"&&(y.preventDefault(),e());},[p,e]);if(!t)return null;let m=!!r,x=s.trim().length>0&&Object.keys(u).length>0;return jsx("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:y=>{y.target===y.currentTarget&&e();},onKeyDown:h,children:jsxs("div",{className:"bg-background border border-border rounded-xl shadow-2xl w-[640px] max-h-[85vh] flex flex-col overflow-hidden",onClick:y=>y.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-semibold text-foreground",children:m?o("pptx.equation.editTitle","Edit Equation"):o("pptx.equation.insertTitle","Insert Equation")}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-4",children:[jsx("div",{className:"rounded-lg border border-border bg-muted/60 p-4 min-h-[80px] flex items-center justify-center",children:x?jsx(Rqe,{mathml:d}):jsx("span",{className:"text-sm text-muted-foreground italic",children:o("pptx.equation.previewPlaceholder","Equation preview will appear here")})}),jsxs("div",{children:[jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1.5",children:o("pptx.equation.latexInput","LaTeX Input")}),jsx("textarea",{ref:c,value:s,onChange:y=>a(y.target.value),placeholder:"\\\\frac{a}{b} + \\\\sqrt{c}",className:"w-full h-24 px-3 py-2 rounded-lg border border-border bg-muted text-foreground text-sm font-mono resize-none focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary placeholder:text-muted-foreground",spellCheck:false}),jsx("p",{className:"mt-1 text-[11px] text-muted-foreground",children:o("pptx.equation.latexHint","Use LaTeX syntax. Ctrl+Enter to insert.")})]}),jsxs("div",{children:[jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:o("pptx.equation.templates","Common Templates")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Lle.map((y,v)=>{let S=Pqe[v];return jsxs("button",{type:"button",onClick:()=>f(y.latex),className:le("flex flex-col items-center gap-1 p-2 rounded-lg border transition-colors",s===y.latex?"border-primary bg-primary/10":"border-border bg-muted/40 hover:bg-accent/60 hover:border-border"),title:o(y.i18nKey,y.label),children:[jsx("div",{className:"text-sm text-foreground h-8 flex items-center justify-center overflow-hidden",style:{fontFamily:'"Cambria Math", "STIX Two Math", serif'},dangerouslySetInnerHTML:{__html:S}}),jsx("span",{className:"text-[10px] text-muted-foreground truncate w-full text-center",children:o(y.i18nKey,y.label)})]},y.latex)})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-4 py-1.5 rounded-lg text-xs text-foreground hover:bg-accent transition-colors",children:o("pptx.equation.cancel","Cancel")}),jsx("button",{type:"button",onClick:p,disabled:!x,className:"px-4 py-1.5 rounded-lg text-xs font-medium bg-primary hover:bg-primary/80 text-white disabled:opacity-40 disabled:cursor-not-allowed transition-colors",children:m?o("pptx.equation.update","Update"):o("pptx.equation.insert","Insert")})]})]})})}var LH=[{layout:"basicBlockList",label:"Basic Block List",category:"list",defaultItems:["Item 1","Item 2","Item 3"]},{layout:"stackedList",label:"Stacked List",category:"list",defaultItems:["Item 1","Item 2","Item 3"]},{layout:"horizontalBulletList",label:"Horizontal Bullet List",category:"list",defaultItems:["Topic 1","Topic 2","Topic 3"]},{layout:"tableList",label:"Table List",category:"list",defaultItems:["Row 1","Row 2","Row 3"]},{layout:"basicChevronProcess",label:"Chevron Process",category:"process",defaultItems:["Step 1","Step 2","Step 3"]},{layout:"segmentedProcess",label:"Segmented Process",category:"process",defaultItems:["Phase 1","Phase 2","Phase 3"]},{layout:"continuousBlockProcess",label:"Continuous Block Process",category:"process",defaultItems:["Start","Middle","End"]},{layout:"upwardArrow",label:"Upward Arrow",category:"process",defaultItems:["Stage 1","Stage 2","Stage 3"]},{layout:"basicCycle",label:"Basic Cycle",category:"cycle",defaultItems:["Phase 1","Phase 2","Phase 3","Phase 4"]},{layout:"basicRadial",label:"Basic Radial",category:"cycle",defaultItems:["Center","Spoke 1","Spoke 2","Spoke 3"]},{layout:"basicPie",label:"Basic Pie",category:"cycle",defaultItems:["Segment 1","Segment 2","Segment 3"]},{layout:"convergingRadial",label:"Converging Radial",category:"cycle",defaultItems:["Goal","Input 1","Input 2","Input 3"]},{layout:"hierarchy",label:"Hierarchy",category:"hierarchy",defaultItems:["Manager","Lead A","Lead B"]},{layout:"basicVenn",label:"Basic Venn",category:"relationship",defaultItems:["Set A","Set B","Set C"]},{layout:"linearVenn",label:"Linear Venn",category:"relationship",defaultItems:["Group 1","Group 2","Group 3"]},{layout:"alternatingHexagons",label:"Alternating Hexagons",category:"relationship",defaultItems:["Hex 1","Hex 2","Hex 3"]},{layout:"trapezoidList",label:"Trapezoid List",category:"relationship",defaultItems:["Level 1","Level 2","Level 3"]},{layout:"pictureAccentList",label:"Picture Accent List",category:"list",defaultItems:["Feature 1","Feature 2","Feature 3"]},{layout:"verticalBlockList",label:"Vertical Block List",category:"list",defaultItems:["Block 1","Block 2","Block 3"]},{layout:"groupedList",label:"Grouped List",category:"list",defaultItems:["Item A","Item B","Item C","Item D"]},{layout:"horizontalPictureList",label:"Horizontal Picture List",category:"list",defaultItems:["Photo 1","Photo 2","Photo 3"]},{layout:"verticalChevronList",label:"Vertical Chevron List",category:"list",defaultItems:["Priority 1","Priority 2","Priority 3"]},{layout:"pyramidList",label:"Pyramid List",category:"list",defaultItems:["Level 1","Level 2","Level 3"]},{layout:"stepDownProcess",label:"Step Down Process",category:"process",defaultItems:["Step 1","Step 2","Step 3"]},{layout:"alternatingFlow",label:"Alternating Flow",category:"process",defaultItems:["Stage 1","Stage 2","Stage 3","Stage 4"]},{layout:"descendingProcess",label:"Descending Process",category:"process",defaultItems:["Top","Middle","Bottom"]},{layout:"accentProcess",label:"Accent Process",category:"process",defaultItems:["Phase 1","Phase 2","Phase 3"]}],Ble=[{id:"list",label:"pptx.smartart.category.list"},{id:"process",label:"pptx.smartart.category.process"},{id:"cycle",label:"pptx.smartart.category.cycle"},{id:"hierarchy",label:"pptx.smartart.category.hierarchy"},{id:"relationship",label:"pptx.smartart.category.relationship"}];var sc=["#3b82f6","#22c55e","#f97316","#eab308"];function Iqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>jsx("rect",{x:4,y:3+t*12,width:52,height:10,rx:2,fill:sc[t],opacity:.85},t))})}function Nqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>{let e=2+t*19,n=`${e},10 ${e+14},10 ${e+18},20 ${e+14},30 ${e},30 ${t>0?e+4:e},20`;return jsx("polygon",{points:n,fill:sc[t],opacity:.85},t)})})}function Dqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2,3].map(t=>{let e=t/4*Math.PI*2-Math.PI/2,n=30+13*Math.cos(e),r=20+10*Math.sin(e);return jsx("circle",{cx:n,cy:r,r:6,fill:sc[t],opacity:.85},t)})})}function Lqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("rect",{x:20,y:3,width:20,height:10,rx:2,fill:sc[0],opacity:.85}),jsx("line",{x1:30,y1:13,x2:30,y2:18,stroke:"#94a3b8",strokeWidth:1}),jsx("line",{x1:15,y1:18,x2:45,y2:18,stroke:"#94a3b8",strokeWidth:1}),jsx("rect",{x:4,y:20,width:18,height:10,rx:2,fill:sc[1],opacity:.85}),jsx("rect",{x:38,y:20,width:18,height:10,rx:2,fill:sc[2],opacity:.85}),jsx("line",{x1:15,y1:18,x2:15,y2:20,stroke:"#94a3b8",strokeWidth:1}),jsx("line",{x1:45,y1:18,x2:45,y2:20,stroke:"#94a3b8",strokeWidth:1})]})}function Fqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:22,cy:20,r:14,fill:sc[0],opacity:.3}),jsx("circle",{cx:38,cy:20,r:14,fill:sc[1],opacity:.3}),jsx("circle",{cx:30,cy:10,r:14,fill:sc[2],opacity:.3})]})}function Bqe(){return jsxs("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[jsx("circle",{cx:30,cy:20,r:7,fill:sc[0],opacity:.85}),[0,1,2].map(t=>{let e=t/3*Math.PI*2-Math.PI/2,n=30+15*Math.cos(e),r=20+12*Math.sin(e);return jsxs(Vn__default.Fragment,{children:[jsx("line",{x1:30,y1:20,x2:n,y2:r,stroke:"#94a3b8",strokeWidth:1,opacity:.5}),jsx("circle",{cx:n,cy:r,r:5,fill:sc[t+1],opacity:.85})]},t)})]})}function Oqe(){return jsx("svg",{viewBox:"0 0 60 40",className:"w-full h-full",children:[0,1,2].map(t=>jsx("rect",{x:4+t*18,y:8,width:16,height:24,rx:3,fill:sc[t],opacity:.85},t))})}function Ole(t){switch(t){case "basicBlockList":case "stackedList":case "tableList":case "horizontalBulletList":return jsx(Iqe,{});case "basicChevronProcess":case "segmentedProcess":case "continuousBlockProcess":case "upwardArrow":return jsx(Nqe,{});case "basicCycle":case "basicPie":return jsx(Dqe,{});case "basicRadial":case "convergingRadial":return jsx(Bqe,{});case "hierarchy":return jsx(Lqe,{});case "basicVenn":case "linearVenn":return jsx(Fqe,{});default:return jsx(Oqe,{})}}function $le({isOpen:t,onClose:e,onInsert:n}){let{t:r}=useTranslation(),[o,i]=useState("list"),[s,a]=useState(null),l=LH.filter(d=>d.category===o),c=useCallback(()=>{if(!s)return;let d=LH.find(u=>u.layout===s);d&&(n(d.layout,d.defaultItems),e());},[s,n,e]);return t?jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/50",onClick:e,"aria-label":"Close"}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[600px] max-w-[90vw] max-h-[80vh] rounded-lg border border-border bg-background shadow-2xl flex flex-col",role:"dialog","aria-modal":"true","aria-label":r("pptx.smartart.insertTitle"),children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[jsx("h2",{className:"text-sm font-medium text-foreground",children:r("pptx.smartart.insertTitle")}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-muted transition-colors","aria-label":r("pptx.smartart.close"),children:jsx(LuX,{className:"w-4 h-4"})})]}),jsxs("div",{className:"flex flex-1 overflow-hidden",children:[jsx("div",{className:"w-40 border-r border-border py-2",children:Ble.map(d=>jsx("button",{type:"button",onClick:()=>{i(d.id),a(null);},className:le("w-full text-left px-3 py-1.5 text-xs transition-colors",o===d.id?"bg-primary text-white":"text-foreground hover:bg-muted"),children:r(d.label)},d.id))}),jsx("div",{className:"flex-1 p-3 overflow-y-auto",children:jsx("div",{className:"grid grid-cols-3 gap-2",children:l.map(d=>jsxs("button",{type:"button",onClick:()=>a(d.layout),onDoubleClick:()=>{a(d.layout),n(d.layout,d.defaultItems),e();},className:le("flex flex-col items-center gap-1 p-2 rounded border transition-colors",s===d.layout?"border-primary bg-primary/20":"border-border hover:border-border hover:bg-muted/50"),children:[jsx("div",{className:"w-16 h-12 flex items-center justify-center bg-muted rounded",children:Ole(d.layout)}),jsx("span",{className:"text-[10px] text-foreground text-center leading-tight",children:d.label})]},d.layout))})})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-4 py-3 border-t border-border",children:[jsx("button",{type:"button",onClick:e,className:"px-3 py-1.5 text-xs rounded bg-muted hover:bg-accent text-foreground transition-colors",children:r("pptx.smartart.cancel")}),jsx("button",{type:"button",onClick:c,disabled:!s,className:le("px-3 py-1.5 text-xs rounded transition-colors",s?"bg-primary hover:bg-primary/80 text-white":"bg-muted text-muted-foreground cursor-not-allowed"),children:r("pptx.smartart.insert")})]})]})})]}):null}function FH(t){let{dialogs:e,insertHandlers:n,exportHandlers:r,printHandlers:o,propertyHandlers:i,annotations:s,slides:a,activeSlideIndex:l,canvasSize:c,filePath:d,coreProperties:u,customProperties:p,appProperties:f,embeddedFonts:h,hasDigitalSignatures:m,digitalSignatureCount:x,presentationProperties:y,customShows:v,selectedElements:S,isEncryptedDialogOpen:w,setIsEncryptedDialogOpen:C,showKeepAnnotationsDialog:T,onKeepAnnotations:E,onDiscardAnnotations:M}=t;return jsxs(Fragment,{children:[jsx(X6,{isOpen:i.isVersionHistoryOpen,filePath:d,onClose:()=>i.setIsVersionHistoryOpen(false),onRestore:i.handleRestoreVersion}),jsx(Y6,{isOpen:i.isComparePanelOpen,compareResult:i.compareResult,canvasSize:c,onClose:()=>i.setIsComparePanelOpen(false),onAcceptSlide:i.handleAcceptSlide,onRejectSlide:i.handleRejectSlide,onAcceptAll:i.handleAcceptAllSlides}),jsx(K6,{isOpen:e.isPasswordDialogOpen,isCurrentlyProtected:e.isPasswordProtected,onClose:()=>e.setIsPasswordDialogOpen(false),onSetPassword:e.handleSetPassword,onRemovePassword:e.handleRemovePassword}),jsx(Q6,{isOpen:e.isDocPropsDialogOpen,coreProperties:u??{},customProperties:p,appProperties:f,onClose:()=>e.setIsDocPropsDialogOpen(false),onSave:(A,R,k)=>{i.handleUpdateCoreProperties(A),i.handleUpdateCustomProperties(R),k&&i.handleUpdateAppProperties(k);}}),jsx(t8,{isOpen:e.isFontEmbeddingOpen,embedFontsEnabled:e.embedFontsEnabled,usedFontFamilies:i.usedFontFamilies,embeddedFonts:h.map(A=>A.name),onClose:()=>e.setIsFontEmbeddingOpen(false),onToggleEmbedFonts:e.setEmbedFontsEnabled}),jsx(r8,{isOpen:e.isDigitalSigDialogOpen,onClose:()=>e.setIsDigitalSigDialogOpen(false),hasSignatures:m,signatureCount:x}),jsx(i8,{isOpen:e.isSignatureStrippedDialogOpen,signatureCount:x,onConfirm:()=>e.setIsSignatureStrippedDialogOpen(false),onCancel:()=>e.setIsSignatureStrippedDialogOpen(false)}),jsx(s8,{isOpen:w,onClose:()=>C(false)}),jsx($le,{isOpen:e.isSmartArtDialogOpen,onClose:()=>e.setIsSmartArtDialogOpen(false),onInsert:n.handleInsertSmartArt}),jsx(Fle,{isOpen:e.isEquationDialogOpen,onClose:()=>e.setIsEquationDialogOpen(false),onInsert:n.handleInsertEquation,existingOmml:e.editingEquationOmml}),jsx(yH,{open:e.isHyperlinkDialogOpen,initialUrl:S[0]?.actionClick?.url,initialTooltip:S[0]?.actionClick?.tooltip,initialAction:S[0]?.actionClick?.action,slideCount:a.length,onConfirm:n.handleHyperlinkConfirm,onCancel:()=>e.setIsHyperlinkDialogOpen(false)}),jsx(vU,{isOpen:r.exportModalOpen,title:r.exportModalTitle,progress:r.exportProgress,statusMessage:r.exportStatusMessage,onCancel:r.handleCancelExport}),jsx(lH,{open:e.isSetUpSlideShowOpen,onClose:()=>e.setIsSetUpSlideShowOpen(false),properties:y,onSave:e.handleSaveSlideShowSettings,customShows:v,slideCount:a.length}),jsx(aH,{open:o.isPrintDialogOpen,onClose:()=>o.setIsPrintDialogOpen(false),onPrint:o.handlePrintWithSettings,slides:a,activeSlideIndex:l,defaultSlidesPerPage:y.printSlidesPerPage,defaultFrameSlides:y.printFrameSlides}),jsx(rH,{isOpen:T,annotationCount:Array.from(s.allSlideAnnotations.values()).reduce((A,R)=>A+R.length,0),slideCount:s.allSlideAnnotations.size,onKeep:E,onDiscard:M})]})}function OH(t){let{mode:e,slides:n,canvasSize:r,templateElements:o,presentation:i,onExitPresentation:s}=t;return jsxs(Fragment,{children:[e==="present"&&i.presenterMode&&jsx(f8,{slides:n,currentSlideIndex:i.presentationSlideIndex,canvasSize:r,templateElements:o,presentationStartTime:i.presentationStartTime,onMovePresentationSlide:i.movePresentationSlide,onExit:s,onOpenAudienceWindow:i.openAudienceWindow,onCloseAudienceWindow:i.closeAudienceWindow,isAudienceWindowOpen:i.isAudienceWindowOpen()}),e==="present"&&i.rehearsing&&jsx(m8,{presentationStartTime:i.presentationStartTime,slideStartTime:i.slideStartTime,paused:i.rehearsalPaused,onTogglePause:i.toggleRehearsalPause}),i.showRehearsalSummary&&jsx(g8,{slides:n,canvasSize:r,recordedTimings:i.recordedTimings,onSave:i.saveRehearsalTimings,onDiscard:i.dismissRehearsalSummary})]})}var Yqe=50;function zle(t){let{enabled:e,onNext:n,onPrev:r}=t,o=useRef(null),i=useCallback(a=>{if(!e||a.changedTouches.length!==1){o.current=null;return}let l=a.changedTouches[0];o.current={x:l.clientX,y:l.clientY};},[e]),s=useCallback(a=>{let l=o.current;if(o.current=null,!e||l===null||a.changedTouches.length!==1)return;let c=a.changedTouches[0],d=c.clientX-l.x,u=c.clientY-l.y;Math.abs(d)<Yqe||Math.abs(d)<=Math.abs(u)||(d<0?n():r());},[e,n,r]);return {onTouchStart:i,onTouchEnd:s}}function UH(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:s,canvasSize:a,activeSlideIndex:l,gridSpacingPx:c,zoom:d,state:u,selectedElement:p,canvasHandlers:f,insertHandlers:h,tableOps:m,annotations:x,presentation:y,onEndPresentation:v,findReplace:S}=t,w=e==="master"?i:o,C=e==="master"?u.activeLayout?u.activeMaster?.elements??[]:[]:s,T=useMemo(()=>{let U=u.headerFooter,H;if(o)for(let j of o.elements){let Z=j.placeholderType;if(Z==="title"||Z==="ctrTitle"){let J=j.text;if(J){H=J;break}}}return {slideNumber:o?.slideNumber,dateTimeText:U.dateTimeText,dateFormat:U.dateFormat,footerText:U.footerText,headerText:U.headerText,slideTitle:H,customProperties:u.customProperties.map(j=>({name:j.name,value:j.value}))}},[u.headerFooter,u.customProperties,o]),E=useMemo(()=>{if(!(!u.theme&&!u.tableStyleMap))return {theme:u.theme,tableStyleMap:u.tableStyleMap}},[u.theme,u.tableStyleMap]),M=useCallback((U,H)=>{e==="present"?y.handlePresentationAction(H):H.url&&Xg(H.url);},[e,y]),A=useCallback(U=>{if(pU(U)){if(e==="present"){let H=ree(U);if(H){let j={action:H.action,targetSlideIndex:H.targetSlideIndex};y.handlePresentationAction(j);}}return}Xg(U);},[e,y]),R=useRef(false),k=useCallback(()=>{R.current=true,x.setToolbarVisible(true);},[x]),N=useCallback(()=>{R.current=false;},[]),F=e==="preview"||e==="present",B=useCallback(()=>{e==="present"?y.movePresentationSlide(1):u.setActiveSlideIndex(U=>Math.min(r.length-1,U+1));},[e,y,u,r.length]),D=useCallback(()=>{e==="present"?y.movePresentationSlide(-1):u.setActiveSlideIndex(U=>Math.max(0,U-1));},[e,y,u]),O=zle({enabled:F,onNext:B,onPrev:D});return jsxs("main",{"aria-label":"Slide editor",className:"flex-1 min-w-0 relative flex flex-col bg-background",onTouchStart:O.onTouchStart,onTouchEnd:O.onTouchEnd,children:[S.findReplaceOpen&&jsx(XU,{findQuery:S.findQuery,replaceQuery:S.replaceQuery,findMatchCase:S.findMatchCase,findResults:S.findResults,findResultIndex:S.findResultIndex,onSetFindQuery:S.setFindQuery,onSetReplaceQuery:S.setReplaceQuery,onSetFindMatchCase:S.setFindMatchCase,onPerformFind:S.performFind,onNavigateResult:S.navigateFindResult,onReplace:S.handleReplace,onReplaceAll:S.handleReplaceAll,onClose:()=>S.setFindReplaceOpen(false)}),e==="master"&&u.masterViewTab==="notes"?jsx(O6,{notesMaster:u.notesMaster,canvasSize:a,notesCanvasSize:u.notesCanvasSize}):e==="master"&&u.masterViewTab==="handout"?jsx(U6,{handoutMaster:u.handoutMaster,canvasSize:a,slidesPerPage:u.handoutSlidesPerPage}):jsx(CH,{activeSlide:w,templateElements:C,canvasSize:a,zoom:d,mode:e,canEdit:n,editTemplateMode:e==="master"||u.editTemplateMode,selectedElementIdSet:u.selectedElementIdSet,selectedElement:p,inlineEditingElementId:u.inlineEditingElementId,inlineEditingText:u.inlineEditingText,spellCheckEnabled:u.spellCheckEnabled,mediaDataUrls:u.mediaDataUrls,tableEditorState:u.tableEditorState,marqueeSelectionState:u.marqueeSelectionState,snapLines:u.snapLines,showGrid:u.showGrid,gridSpacingPx:c,showRulers:u.showRulers,guides:u.guides,presentationElementStates:e==="present"?y.presentationElementStates:void 0,presentationKeyframesCss:e==="present"?y.presentationKeyframesCss:void 0,onClick:f.handleElementClick,onDoubleClick:f.handleElementDoubleClick,onMouseDown:f.handleElementMouseDown,onContextMenu:f.handleElementContextMenu,onCanvasMouseDown:f.handleCanvasMouseDown,onResizePointerDown:f.handleResizePointerDown,onAdjustmentPointerDown:f.handleAdjustmentPointerDown,onInlineEditChange:u.setInlineEditingText,onInlineEditCommit:f.handleInlineEditCommit,onInlineEditCancel:()=>u.setInlineEditingElementId(null),onTableCellSelect:(U,H)=>u.setTableEditorState(U?{...U,elementId:H}:null),onCommitCellEdit:m.handleCommitCellEdit,onResizeTableColumns:m.handleResizeTableColumns,onResizeTableRow:m.handleResizeTableRow,findResults:S.findResults,findResultIndex:S.findResultIndex,activeSlideIndex:l,activeTool:u.activeTool,drawingColor:u.drawingColor,drawingWidth:u.drawingWidth,isDrawingRef:u.isDrawingRef,onAddInkElement:h.handleAddInkElement,onAddFreeformShape:h.handleAddFreeformShape,onEraseInkElement:h.handleEraseInkElement,onActionClick:M,onHyperlinkClick:A,allSlides:e==="present"?r:void 0,onZoomClick:e==="present"?y.handleZoomClick:void 0,sourceSlideIndex:e==="present"?l:void 0,fieldContext:T,tableStyleContext:E,collaborationOverlay:jsxs(Fragment,{children:[jsx(R6,{elements:w?.elements??[],activeSlideIndex:l}),jsx(A6,{activeSlideIndex:l,canvasWidth:a.width,canvasHeight:a.height,selectedElementId:u.selectedElementId})]}),comments:o?.comments,showCommentMarkers:u.sidebarPanelMode==="comments",onCommentMarkerClick:()=>u.setSidebarPanelMode("comments"),onMoveGuide:(U,H)=>{u.setGuides(j=>j.map(Z=>Z.id===U?{...Z,position:Z.axis==="h"?Math.max(0,Math.min(a.height,H)):Math.max(0,Math.min(a.width,H))}:Z));},onDeleteGuide:U=>{u.setGuides(H=>H.filter(j=>j.id!==U));},onCreateGuideFromRuler:(U,H)=>{u.setGuides(j=>[...j,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:U,position:H}]);}}),e==="present"&&x.presentationTool!=="none"&&jsx(q8,{canvasSize:a,editorScale:d.editorScale,presentationTool:x.presentationTool,annotationStrokes:x.annotationStrokes,currentStroke:x.currentStroke,laserPosition:x.laserPosition,onPointerDown:x.handlePointerDown,onPointerMove:x.handlePointerMove,onPointerUp:x.handlePointerUp,onLaserMove:x.handleLaserMove,onLaserLeave:x.handleLaserLeave,onEraseAtPoint:x.eraseAtPoint}),e==="present"&&jsx(nH,{visible:!!u.presentationProperties.showSubtitles}),e==="present"&&jsx(eH,{currentSlideIndex:y.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:y.movePresentationSlide,onEndPresentation:v??(()=>{})}),e==="present"&&jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 z-[80] transition-opacity duration-300",style:{opacity:x.toolbarVisible?1:0,pointerEvents:x.toolbarVisible?"auto":"none"},onMouseEnter:k,onMouseLeave:N,children:jsx(J8,{presentationTool:x.presentationTool,penColor:x.penColor,highlighterColor:x.highlighterColor,hasAnnotations:x.annotationStrokes.length>0,onSetTool:x.setPresentationTool,onSetPenColor:x.setPenColor,onSetHighlighterColor:x.setHighlighterColor,onClearAnnotations:x.clearAnnotations,currentSlideIndex:y.presentationSlideIndex,totalSlides:r.length,onMovePresentationSlide:y.movePresentationSlide,presentationStartTime:y.presentationStartTime,onEndPresentation:v??(()=>{}),onTogglePresenterView:y.togglePresenterView,presenterMode:y.presenterMode})})]})}var qh="rounded bg-muted/50 p-2.5 space-y-2",Kh="text-[11px] font-medium uppercase tracking-wide text-muted-foreground mb-1.5",xM="w-full rounded border border-border bg-background px-2 py-1 text-xs text-foreground focus:border-primary focus:outline-none",jle="rounded bg-primary px-3 py-1.5 text-xs font-medium text-white hover:bg-primary/80 disabled:opacity-40 disabled:cursor-not-allowed transition-colors",Xle="rounded bg-accent px-3 py-1.5 text-xs font-medium text-foreground hover:bg-accent/80 disabled:opacity-40 disabled:cursor-not-allowed transition-colors";var MN=[{name:"Office",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"},majorFont:"Calibri Light",minorFont:"Calibri"},{name:"Facet",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2C3C43",lt2:"#CFD7D9",accent1:"#90C226",accent2:"#54A021",accent3:"#E6B91E",accent4:"#E76618",accent5:"#C42F1A",accent6:"#918655",hlink:"#99CA3C",folHlink:"#B9D181"},majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"},{name:"Integral",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#335B74",lt2:"#DFE3E5",accent1:"#1CADE4",accent2:"#2683C6",accent3:"#27CED7",accent4:"#42BA97",accent5:"#3E8853",accent6:"#62A39F",hlink:"#6BA5D1",folHlink:"#9DCCE0"},majorFont:"Tw Cen MT Condensed",minorFont:"Tw Cen MT"},{name:"Ion",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#262626",lt2:"#E1E1E1",accent1:"#B01513",accent2:"#EA6312",accent3:"#E6B729",accent4:"#6AAC90",accent5:"#5F9C9D",accent6:"#9B6BF2",hlink:"#F09415",folHlink:"#D14D0F"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Retrospect",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#637052",lt2:"#CCDDEA",accent1:"#E48312",accent2:"#BD582C",accent3:"#865640",accent4:"#9B8357",accent5:"#C2BC80",accent6:"#94A088",hlink:"#3A7CCB",folHlink:"#8C8C8C"},majorFont:"Calibri Light",minorFont:"Calibri"},{name:"Organic",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#283138",lt2:"#E3DED1",accent1:"#83992A",accent2:"#3C9770",accent3:"#44709D",accent4:"#A23C33",accent5:"#D97828",accent6:"#DEB340",hlink:"#A8B97F",folHlink:"#89C2A3"},majorFont:"Garamond",minorFont:"Garamond"},{name:"Wisp",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#46393B",lt2:"#E8DCD8",accent1:"#A53010",accent2:"#DE7E18",accent3:"#9F8351",accent4:"#728653",accent5:"#92AA4C",accent6:"#6AAC91",hlink:"#FB4F14",folHlink:"#E25839"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Berlin",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3E5C61",lt2:"#D5E0D0",accent1:"#F09415",accent2:"#C1B56B",accent3:"#89C2A3",accent4:"#729BBE",accent5:"#9A90C2",accent6:"#BE8DBE",hlink:"#25A0DA",folHlink:"#FF7F00"},majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"},{name:"Slice",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2E3B4C",lt2:"#C7CDD3",accent1:"#E2751D",accent2:"#C53B23",accent3:"#A13D69",accent4:"#58599E",accent5:"#36749D",accent6:"#4EA39A",hlink:"#FD6B32",folHlink:"#D14D0F"},majorFont:"Century Gothic",minorFont:"Century Gothic"},{name:"Dividend",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3D3D3D",lt2:"#E1E1E1",accent1:"#4D1434",accent2:"#903163",accent3:"#B2324B",accent4:"#D34817",accent5:"#E8971C",accent6:"#FDCB00",hlink:"#A03068",folHlink:"#C34882"},majorFont:"Gill Sans MT",minorFont:"Gill Sans MT"}],Y0=["Arial","Calibri","Calibri Light","Cambria","Century Gothic","Comic Sans MS","Consolas","Garamond","Georgia","Gill Sans MT","Impact","Lucida Console","Palatino Linotype","Segoe UI","Tahoma","Times New Roman","Trebuchet MS","Tw Cen MT","Verdana"];function Wle({editColors:t,canEdit:e,activePickerKey:n,majorFont:r,minorFont:o,onSetActivePickerKey:i,onColorChange:s,onMajorFontChange:a,onMinorFontChange:l}){let{t:c}=useTranslation(),d=useMemo(()=>tY(t),[t]),u=useCallback(p=>{n&&/^#[0-9a-fA-F]{6}$/.test(p)&&s(n,p);},[n,s]);return jsxs(Fragment,{children:[jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.colorScheme")}),jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Mf.map(p=>jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[jsx("button",{type:"button",disabled:!e,className:`h-6 w-full rounded-sm border transition-colors ${n===p?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground"} disabled:opacity-40 disabled:cursor-not-allowed`,style:{backgroundColor:t[p]},title:`${L1[p]}: ${t[p]}`,onClick:()=>i(n===p?null:p)}),jsx("span",{className:"text-[9px] text-muted-foreground truncate w-full text-center",children:L1[p]})]},p))}),n&&jsxs("div",{className:"mt-2 flex items-center gap-2 rounded bg-background p-2",children:[jsx("span",{className:"text-[10px] text-muted-foreground min-w-[60px]",children:L1[n]}),jsx("input",{type:"color",disabled:!e,className:"h-6 w-8 cursor-pointer rounded border-0 bg-transparent p-0",value:t[n],onChange:p=>s(n,p.target.value)}),jsx("input",{type:"text",disabled:!e,className:"flex-1 rounded border border-border bg-muted px-1.5 py-0.5 text-[10px] text-foreground font-mono",value:t[n],onChange:p=>u(p.target.value)})]})]}),d&&jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.preview")}),jsx("div",{className:"flex flex-col gap-px",children:d.map((p,f)=>jsx("div",{className:"grid grid-cols-12 gap-px",children:p.map(h=>jsx("div",{className:"h-3.5 rounded-sm",style:{backgroundColor:h.hex},title:`${h.colLabel} -- ${h.rowLabel} (${h.hex})`},`${h.schemeKey}-${f}`))},f))})]}),jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:c("pptx.themeEditor.fonts")}),jsxs("div",{className:"space-y-1.5",children:[jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:c("pptx.themeEditor.headingFont")}),jsxs("select",{className:xM,disabled:!e,value:Y0.includes(r)?r:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&a(p.target.value);},children:[Y0.map(p=>jsx("option",{value:p,children:p},p)),!Y0.includes(r)&&jsx("option",{value:"__custom__",children:r})]})]}),jsxs("label",{className:"flex flex-col gap-0.5",children:[jsx("span",{className:"text-[10px] text-muted-foreground",children:c("pptx.themeEditor.bodyFont")}),jsxs("select",{className:xM,disabled:!e,value:Y0.includes(o)?o:"__custom__",onChange:p=>{p.target.value!=="__custom__"&&l(p.target.value);},children:[Y0.map(p=>jsx("option",{value:p,children:p},p)),!Y0.includes(o)&&jsx("option",{value:"__custom__",children:o})]})]}),jsxs("div",{className:"flex items-center gap-2 pt-1 text-[10px] text-muted-foreground",children:[jsx("span",{style:{fontFamily:r},className:"text-foreground",children:c("pptx.themeEditor.headingSample")}),jsx("span",{className:"text-muted-foreground",children:"|"}),jsx("span",{style:{fontFamily:o},className:"text-foreground",children:c("pptx.themeEditor.bodySample")})]})]})]})]})}var nKe=["accent1","accent2","accent3","accent4","accent5","accent6"];function qle({canEdit:t,currentThemeName:e,onSelectPreset:n}){let{t:r}=useTranslation();return jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:r("pptx.themeEditor.presetThemes")}),jsx("div",{className:"grid grid-cols-2 gap-1.5",children:MN.map(o=>jsxs("button",{type:"button",disabled:!t,className:`flex flex-col items-start gap-1 rounded border p-1.5 text-left transition-colors ${e===o.name?"border-primary bg-primary/10":"border-border hover:border-muted-foreground hover:bg-muted"} disabled:opacity-40 disabled:cursor-not-allowed`,onClick:()=>n(o),title:o.name,children:[jsx("div",{className:"flex gap-px w-full",children:nKe.map(i=>jsx("div",{className:"h-3 flex-1 first:rounded-l-sm last:rounded-r-sm",style:{backgroundColor:o.colorScheme[i]}},i))}),jsx("span",{className:"text-[10px] text-muted-foreground truncate w-full",children:o.name})]},o.name))})]})}function Kle({theme:t,canEdit:e,onUpdateColorScheme:n,onUpdateFontScheme:r,onUpdateThemeName:o,onApplyToPresentation:i,onClose:s}){let{t:a}=useTranslation(),[l,c]=useState(()=>t?.colorScheme??MN[0].colorScheme),[d,u]=useState(()=>t?.fontScheme?.majorFont?.latin??"Calibri Light"),[p,f]=useState(()=>t?.fontScheme?.minorFont?.latin??"Calibri"),[h,m]=useState(()=>t?.name??"Custom Theme"),[x,y]=useState(null),v=useCallback((M,A)=>{let R={...l,[M]:A};c(R),n(R);},[l,n]),S=useCallback(M=>{c(M.colorScheme),u(M.majorFont),f(M.minorFont),m(M.name),n(M.colorScheme),r({majorFont:{latin:M.majorFont},minorFont:{latin:M.minorFont}}),o(M.name);},[n,r,o]),w=useCallback(()=>{t?.colorScheme&&(c(t.colorScheme),u(t.fontScheme?.majorFont?.latin??"Calibri Light"),f(t.fontScheme?.minorFont?.latin??"Calibri"),m(t.name??"Custom Theme"),n(t.colorScheme),r({majorFont:{latin:t.fontScheme?.majorFont?.latin??"Calibri Light"},minorFont:{latin:t.fontScheme?.minorFont?.latin??"Calibri"}}),o(t.name??"Custom Theme"));},[t,n,r,o]),C=useCallback(M=>{u(M),r({majorFont:{latin:M},minorFont:{latin:p}});},[p,r]),T=useCallback(M=>{f(M),r({majorFont:{latin:d},minorFont:{latin:M}});},[d,r]),E=useCallback(M=>{m(M),o(M);},[o]);return jsxs("div",{className:"flex flex-col gap-2 overflow-y-auto max-h-[calc(100vh-120px)]",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{className:"text-sm font-semibold text-foreground",children:a("pptx.themeEditor.title")}),jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",title:a("pptx.themeEditor.close"),children:jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),jsxs("div",{className:qh,children:[jsx("div",{className:Kh,children:a("pptx.themeEditor.themeName")}),jsx("input",{type:"text",className:xM,disabled:!e,value:h,onChange:M=>E(M.target.value),placeholder:a("pptx.themeEditor.themeNamePlaceholder")})]}),jsx(qle,{canEdit:e,currentThemeName:h,onSelectPreset:S}),jsx(Wle,{editColors:l,canEdit:e,activePickerKey:x,majorFont:d,minorFont:p,onSetActivePickerKey:y,onColorChange:v,onMajorFontChange:C,onMinorFontChange:T}),jsxs("div",{className:"flex gap-1.5 pt-1",children:[jsx("button",{type:"button",disabled:!e,className:jle,onClick:i,children:a("pptx.themeEditor.applyToPresentation")}),jsx("button",{type:"button",disabled:!e,className:Xle,onClick:w,children:a("pptx.themeEditor.reset")})]})]})}var $H=[{id:"office",name:"Office",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#44546A",lt2:"#E7E6E6",accent1:"#4472C4",accent2:"#ED7D31",accent3:"#A5A5A5",accent4:"#FFC000",accent5:"#5B9BD5",accent6:"#70AD47",hlink:"#0563C1",folHlink:"#954F72"},fontScheme:{majorFont:"Calibri Light",minorFont:"Calibri"}},{id:"facet",name:"Facet",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2C3C43",lt2:"#CFD7D9",accent1:"#90C226",accent2:"#54A021",accent3:"#E6B91E",accent4:"#E76618",accent5:"#C42F1A",accent6:"#918655",hlink:"#99CA3C",folHlink:"#B9D181"},fontScheme:{majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"}},{id:"integral",name:"Integral",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#335B74",lt2:"#DFE3E5",accent1:"#1CADE4",accent2:"#2683C6",accent3:"#27CED7",accent4:"#42BA97",accent5:"#3E8853",accent6:"#62A39F",hlink:"#6BA5D1",folHlink:"#9DCCE0"},fontScheme:{majorFont:"Tw Cen MT Condensed",minorFont:"Tw Cen MT"}},{id:"ion",name:"Ion",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#262626",lt2:"#E1E1E1",accent1:"#B01513",accent2:"#EA6312",accent3:"#E6B729",accent4:"#6AAC90",accent5:"#5F9C9D",accent6:"#9B6BF2",hlink:"#F09415",folHlink:"#D14D0F"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"retrospect",name:"Retrospect",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#637052",lt2:"#CCDDEA",accent1:"#E48312",accent2:"#BD582C",accent3:"#865640",accent4:"#9B8357",accent5:"#C2BC80",accent6:"#94A088",hlink:"#3A7CCB",folHlink:"#8C8C8C"},fontScheme:{majorFont:"Calibri Light",minorFont:"Calibri"}},{id:"organic",name:"Organic",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#283138",lt2:"#E3DED1",accent1:"#83992A",accent2:"#3C9770",accent3:"#44709D",accent4:"#A23C33",accent5:"#D97828",accent6:"#DEB340",hlink:"#A8B97F",folHlink:"#89C2A3"},fontScheme:{majorFont:"Garamond",minorFont:"Garamond"}},{id:"wisp",name:"Wisp",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#46393B",lt2:"#E8DCD8",accent1:"#A53010",accent2:"#DE7E18",accent3:"#9F8351",accent4:"#728653",accent5:"#92AA4C",accent6:"#6AAC91",hlink:"#FB4F14",folHlink:"#E25839"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"berlin",name:"Berlin",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3E5C61",lt2:"#D5E0D0",accent1:"#F09415",accent2:"#C1B56B",accent3:"#89C2A3",accent4:"#729BBE",accent5:"#9A90C2",accent6:"#BE8DBE",hlink:"#25A0DA",folHlink:"#FF7F00"},fontScheme:{majorFont:"Trebuchet MS",minorFont:"Trebuchet MS"}},{id:"slice",name:"Slice",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#2E3B4C",lt2:"#C7CDD3",accent1:"#E2751D",accent2:"#C53B23",accent3:"#A13D69",accent4:"#58599E",accent5:"#36749D",accent6:"#4EA39A",hlink:"#FD6B32",folHlink:"#D14D0F"},fontScheme:{majorFont:"Century Gothic",minorFont:"Century Gothic"}},{id:"dividend",name:"Dividend",colorScheme:{dk1:"#000000",lt1:"#FFFFFF",dk2:"#3D3D3D",lt2:"#E1E1E1",accent1:"#4D1434",accent2:"#903163",accent3:"#B2324B",accent4:"#D34817",accent5:"#E8971C",accent6:"#FDCB00",hlink:"#A03068",folHlink:"#C34882"},fontScheme:{majorFont:"Gill Sans MT",minorFont:"Gill Sans MT"}}];function HH({theme:t,selected:e,onClick:n}){let{colorScheme:r}=t;return jsxs("button",{type:"button",onClick:n,className:le("group relative flex flex-col rounded-lg border-2 transition-all overflow-hidden",e?"border-primary shadow-lg scale-[1.02]":"border-border hover:border-primary/50 hover:shadow-md"),title:t.name,children:[jsxs("div",{className:"h-24 flex flex-col",children:[jsxs("div",{className:"h-10 flex",children:[jsx("div",{className:"flex-1",style:{backgroundColor:r.accent1}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.accent2}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.accent3}})]}),jsxs("div",{className:"flex-1 flex",children:[jsx("div",{className:"w-1/3",style:{backgroundColor:r.dk2}}),jsx("div",{className:"flex-1",style:{backgroundColor:r.lt2}})]})]}),jsx("div",{className:"bg-background border-t border-border px-2 py-1.5",children:jsx("p",{className:"text-xs font-medium text-foreground text-center",children:t.name})}),e&&jsx("div",{className:"absolute top-1 right-1 bg-primary text-white rounded-full p-1",children:jsx(LuCheck,{className:"w-3 h-3"})})]})}function Jle({open:t,currentTheme:e,canEdit:n,onClose:r,onApplyTheme:o,onImportTheme:i}){let{t:s}=useTranslation(),[a,l]=useState(e??null),c=useRef(null);if(!t)return null;let d=()=>{a&&(o(a),r());},u=()=>{c.current?.click();},p=f=>{let h=f.target.files?.[0];h&&i&&i(h),f.target.value="";};return jsxs(Fragment,{children:[jsx("button",{type:"button",className:"fixed inset-0 z-[100] bg-black/60 backdrop-blur-sm",onClick:r,"aria-label":s("common.close")}),jsx("div",{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:jsxs("div",{className:"bg-background border border-border rounded-xl shadow-2xl max-w-5xl w-full max-h-[90vh] flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[jsxs("div",{children:[jsx("h2",{className:"text-lg font-semibold text-foreground",children:s("powerpoint.toolbar.themes.gallery.title")}),jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s("powerpoint.toolbar.themes.gallery.description")})]}),jsx("button",{type:"button",onClick:r,className:"p-2 rounded hover:bg-accent transition-colors","aria-label":s("common.close"),children:jsx(LuX,{className:"w-5 h-5"})})]}),jsx("div",{className:"flex-1 overflow-auto p-6",children:jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:$H.map(f=>jsx(HH,{theme:f,selected:a?.id===f.id,onClick:()=>l(f)},f.id))})}),jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-border",children:[jsx("div",{className:"flex items-center gap-2",children:i&&jsxs(Fragment,{children:[jsxs("button",{type:"button",onClick:u,disabled:!n,className:"inline-flex items-center gap-2 px-3 py-1.5 rounded bg-accent hover:bg-accent/80 text-xs font-medium text-foreground transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[jsx(LuUpload,{className:"w-3.5 h-3.5"}),s("powerpoint.toolbar.themes.gallery.importTheme")]}),jsx("input",{ref:c,type:"file",accept:".thmx,.pptx",className:"hidden",onChange:p})]})}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{type:"button",onClick:r,className:"px-3 py-1.5 rounded bg-accent hover:bg-accent/80 text-xs font-medium text-foreground transition-colors",children:s("common.cancel")}),jsx("button",{type:"button",onClick:d,disabled:!n||!a,className:"px-3 py-1.5 rounded bg-primary hover:bg-primary/80 text-xs font-medium text-white transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:s("common.apply")})]})]})]})})]})}function zH(t){let{mode:e,canEdit:n,activeSlide:r,masterPseudoSlide:o,slides:i,canvasSize:s,activeSlideIndex:a,selectedElement:l,state:c,comments:d,ops:u,manipulation:p,propertyHandlers:f,themeHandlers:h,history:m,panelWidth:x,onResizeRight:y}=t,v=e==="master"?o:r;return jsxs(Fragment,{children:[(e==="edit"||e==="master")&&c.isInspectorPaneOpen&&y&&jsx(Cp,{direction:"horizontal",onResize:y}),jsx(AH,{isOpen:(e==="edit"||e==="master")&&c.isInspectorPaneOpen,canEdit:n,mode:e,activeSlide:v,slides:i,canvasSize:s,selectedElement:l,effectiveSelectedIds:c.effectiveSelectedIds,tableEditorState:c.tableEditorState,sidebarPanelMode:c.sidebarPanelMode,activeSlideIndex:a,comments:d,onSetSidebarPanelMode:c.setSidebarPanelMode,onClose:()=>c.setIsInspectorPaneOpen(false),onUpdateElementStyle:u.updateSelectedShapeStyle,onUpdateTextStyle:u.updateSelectedTextStyle,onUpdateElement:u.updateSelectedElement,onApplySelection:u.applySelection,onSetCanvasSize:c.setCanvasSize,onMoveLayer:p.handleMoveLayer,onMoveLayerToEdge:p.handleMoveLayerToEdge,onDeleteElement:p.handleDelete,onUpdateSlide:f.handleUpdateSlide,presentationProperties:c.presentationProperties,onUpdatePresentationProperties:f.handleUpdatePresentationProperties,editTemplateMode:c.editTemplateMode,slideMasters:c.slideMasters,themeOptions:c.themeOptions,notesMaster:c.notesMaster,handoutMaster:c.handoutMaster,notesCanvasSize:c.notesCanvasSize,coreProperties:c.coreProperties,appProperties:c.appProperties,customProperties:c.customProperties,tagCollections:c.tagCollections,onUpdateTagCollections:c.setTagCollections,onUpdateCoreProperties:f.handleUpdateCoreProperties,onUpdateAppProperties:f.handleUpdateAppProperties,onUpdateCustomProperties:f.handleUpdateCustomProperties,onApplyTheme:h.handleApplyTheme,onSetTemplateBackground:h.handleSetTemplateBackground,onGetTemplateBackgroundColor:h.handleGetTemplateBackgroundColor,mediaDataUrls:c.mediaDataUrls,theme:c.theme,panelWidth:x}),c.isSelectionPaneOpen&&(e==="edit"||e==="master")&&jsx("div",{className:"absolute right-0 top-0 z-30 h-full max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:h-auto max-md:max-h-[50vh]",children:jsx(y8,{slides:i,activeSlideIndex:a,selectedElementId:c.selectedElementId,selectedElementIds:c.selectedElementIds,canEdit:n,setSelectedElementId:c.setSelectedElementId,setSelectedElementIds:c.setSelectedElementIds,setSlides:c.setSlides,markDirty:m.markDirty,onClose:()=>c.setIsSelectionPaneOpen(false)})}),c.isThemeEditorOpen&&e==="edit"&&jsx("div",{className:"absolute right-0 top-0 z-30 h-full w-72 overflow-y-auto border-l border-border bg-card p-2.5 shadow-xl max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:w-full max-md:h-auto max-md:max-h-[60vh] max-md:rounded-t-xl max-md:border-t max-md:border-l-0",children:jsx(Kle,{theme:c.theme,canEdit:n,onUpdateColorScheme:h.handleUpdateThemeColorScheme,onUpdateFontScheme:h.handleUpdateThemeFontScheme,onUpdateThemeName:h.handleUpdateThemeName,onApplyToPresentation:h.handleApplyThemeToPresentation,onClose:()=>c.setIsThemeEditorOpen(false)})}),jsx(Jle,{open:c.isThemeGalleryOpen,currentTheme:null,canEdit:n,onClose:()=>c.setIsThemeGalleryOpen(false),onApplyTheme:S=>{h.handleApplyThemeData(S.colorScheme,{majorFont:{latin:S.fontScheme.majorFont,eastAsia:S.fontScheme.majorFont,complexScript:S.fontScheme.majorFont},minorFont:{latin:S.fontScheme.minorFont,eastAsia:S.fontScheme.minorFont,complexScript:S.fontScheme.minorFont}},S.name);}})]})}function GH(t){let{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,activeSlideIndex:s,canvasSize:a,gridSpacingPx:l,slideSectionGroups:c,showSlidesPane:d,showMasterPane:u,selectedElement:p,state:f,editorOps:h,dialogs:m,presentation:x,annotations:y,propertyHandlers:v,themeHandlers:S,history:w,comments:C,zoom:T,isMobile:E=false,isTouchDevice:M=false,onEndPresentation:A,leftPanelWidth:R,onResizeLeft:k,rightPanelWidth:N,onResizeRight:F}=t,{ops:B,sectionOps:D,canvasHandlers:O,insertHandlers:U,manipulation:H,slideOps:j,tableOps:Z,findReplace:J}=h;return jsxs("div",{className:"relative z-10 flex flex-1 min-h-0",children:[d&&jsxs(Fragment,{children:[jsx(F2,{slides:r,activeSlideIndex:s,canvasSize:a,sectionGroups:c,isOpen:f.isSlidesPaneOpen,canEdit:n,onSelectSlide:f.setActiveSlideIndex,onSlideContextMenu:j.handleSlideContextMenu,onMoveSlide:j.handleMoveSlide,onAddSlide:j.handleAddSlide,onCollapse:()=>f.setIsSlidesPaneOpen(false),onAddSection:D.addSection,onRenameSection:D.renameSection,onDeleteSection:D.deleteSection,onMoveSectionUp:D.moveSectionUp,onMoveSectionDown:D.moveSectionDown,rehearsalTimings:Object.keys(x.recordedTimings).length>0?x.recordedTimings:void 0,panelWidth:R}),k&&jsx(Cp,{direction:"horizontal",onResize:k})]}),u&&jsx(B6,{slideMasters:f.slideMasters,activeMasterIndex:f.activeMasterIndex,activeLayoutIndex:f.activeLayoutIndex,canvasSize:a,masterViewTab:f.masterViewTab,notesMaster:f.notesMaster,handoutMaster:f.handoutMaster,handoutSlidesPerPage:f.handoutSlidesPerPage,onSelectMaster:m.handleSelectMaster,onSelectLayout:m.handleSelectLayout,onCollapse:()=>f.setIsSlidesPaneOpen(false),onTabChange:f.setMasterViewTab,onHandoutSlidesPerPageChange:f.setHandoutSlidesPerPage}),jsx(UH,{mode:e,canEdit:n,slides:r,activeSlide:o,masterPseudoSlide:i,templateElements:f.templateElements,canvasSize:a,activeSlideIndex:s,gridSpacingPx:l,zoom:T,state:f,selectedElement:p,canvasHandlers:O,insertHandlers:U,tableOps:Z,annotations:y,presentation:x,onEndPresentation:A,findReplace:J}),f.contextMenuState&&jsx(CU,{contextMenuState:f.contextMenuState,mode:e,selectedElement:p,tableEditorState:f.tableEditorState,hasMultiSelection:f.effectiveSelectedIds.length>1,onAction:H.handleContextMenuAction,onInsertTableRow:Z.handleInsertTableRow,onDeleteTableRow:Z.handleDeleteTableRow,onInsertTableColumn:Z.handleInsertTableColumn,onDeleteTableColumn:Z.handleDeleteTableColumn,onMergeCellRight:Z.handleMergeCellRight,onMergeCellDown:Z.handleMergeCellDown,onMergeSelectedCells:Z.handleMergeSelectedCells,onSplitCell:Z.handleSplitCell,onClose:()=>f.setContextMenuState(null)}),jsx(zH,{mode:e,canEdit:n,activeSlide:o,masterPseudoSlide:i,slides:r,canvasSize:a,activeSlideIndex:s,selectedElement:p,state:f,comments:C,ops:B,manipulation:H,propertyHandlers:v,themeHandlers:S,history:w,panelWidth:N,onResizeRight:F})]})}function ece({onOpenSlides:t,onOpenInsert:e,onOpenInspector:n,onOpenComments:r,onToggleNotes:o,activeSheet:i,commentCount:s}){return jsx("nav",{"aria-label":"Editor actions",className:"md:hidden flex items-stretch justify-around border-t border-border bg-secondary/80 backdrop-blur supports-[backdrop-filter]:bg-secondary/60 pb-[max(env(safe-area-inset-bottom),0px)]",children:[{key:"slides",label:"Slides",icon:LuLayers,onClick:t},{key:"insert",label:"Insert",icon:LuPlus,onClick:e},{key:"inspector",label:"Format",icon:LuSettings2,onClick:n},{key:"comments",label:"Comments",icon:LuMessageSquare,onClick:r,badge:s},{key:"notes",label:"Notes",icon:LuStickyNote,onClick:o}].map(({key:l,label:c,icon:d,onClick:u,badge:p})=>{let f=i===l;return jsxs("button",{type:"button",onClick:u,className:le("relative flex flex-col items-center justify-center gap-0.5 flex-1 min-h-[56px] py-1.5 text-[10px] font-medium transition-colors active:scale-95",f?"text-primary":"text-muted-foreground hover:text-foreground"),"aria-pressed":f,children:[jsx(d,{className:"w-5 h-5"}),jsx("span",{children:c}),p!==void 0&&p>0&&jsx("span",{className:"absolute top-1 right-1/4 flex items-center justify-center min-w-[16px] h-4 px-1 rounded-full bg-primary text-[9px] font-semibold text-white",children:p>99?"99+":p}),f&&jsx("span",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-8 h-0.5 rounded-full bg-primary"})]},l)})})}function tce({open:t,onClose:e,...n}){return jsx(VI,{open:t,onClose:e,heightFraction:.7,title:"Slides",children:jsx("div",{className:"h-full",children:jsx(F2,{...n})})})}function rce(t){let{state:e,editorOps:n,presentation:r,slides:o,activeSlideIndex:i,canvasSize:s,slideSectionGroups:a,canEdit:l,commentCount:c}=t,d=e.isSlidesPaneOpen?"slides":e.isInspectorPaneOpen?e.sidebarPanelMode==="comments"?"comments":"inspector":e.isSlideNotesCollapsed?null:"notes",u=()=>{e.setIsSlidesPaneOpen(false),e.setIsInspectorPaneOpen(false),e.setIsSlideNotesCollapsed(true);},p=f=>{switch(u(),f){case "slides":e.setIsSlidesPaneOpen(true);break;case "inspector":e.setSidebarPanelMode("properties"),e.setIsInspectorPaneOpen(true);break;case "comments":e.setSidebarPanelMode("comments"),e.setIsInspectorPaneOpen(true);break;case "notes":e.setIsSlideNotesCollapsed(false);break}};return jsxs(Fragment,{children:[jsx(tce,{open:e.isSlidesPaneOpen,onClose:()=>e.setIsSlidesPaneOpen(false),slides:o,activeSlideIndex:i,canvasSize:s,sectionGroups:a,isOpen:true,canEdit:l,onSelectSlide:f=>{e.setActiveSlideIndex(f),e.setIsSlidesPaneOpen(false);},onSlideContextMenu:n.slideOps.handleSlideContextMenu,onMoveSlide:n.slideOps.handleMoveSlide,onAddSlide:n.slideOps.handleAddSlide,onCollapse:()=>e.setIsSlidesPaneOpen(false),onAddSection:n.sectionOps.addSection,onRenameSection:n.sectionOps.renameSection,onDeleteSection:n.sectionOps.deleteSection,onMoveSectionUp:n.sectionOps.moveSectionUp,onMoveSectionDown:n.sectionOps.moveSectionDown,rehearsalTimings:Object.keys(r.recordedTimings).length>0?r.recordedTimings:void 0}),jsx(ece,{activeSheet:d,commentCount:c,onOpenSlides:()=>e.isSlidesPaneOpen?e.setIsSlidesPaneOpen(false):p("slides"),onOpenInsert:()=>{n.insertHandlers.handleAddTextBox();},onOpenInspector:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode!=="comments"?e.setIsInspectorPaneOpen(false):p("inspector"),onOpenComments:()=>e.isInspectorPaneOpen&&e.sidebarPanelMode==="comments"?e.setIsInspectorPaneOpen(false):p("comments"),onToggleNotes:()=>e.isSlideNotesCollapsed?p("notes"):e.setIsSlideNotesCollapsed(true)})]})}function nS({label:t,enabled:e,onToggle:n}){return jsxs("div",{className:"flex items-center justify-between py-2.5 px-3",children:[jsx("span",{className:"text-sm text-foreground",children:t}),jsx("button",{type:"button",onClick:n,className:le("relative inline-flex h-5 w-9 items-center rounded-full transition-colors",e?"bg-primary":"bg-muted-foreground/30"),role:"switch","aria-checked":e,"aria-label":t,children:jsx("span",{className:le("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})]})}function ice({isOpen:t,onClose:e,spellCheckEnabled:n=false,onSetSpellCheckEnabled:r,showGrid:o=false,onSetShowGrid:i,showRulers:s=false,onSetShowRulers:a,snapToGrid:l=false,onSetSnapToGrid:c,reducedMotion:d=false,onToggleReducedMotion:u}){let[p,f]=useState("general"),[h,m]=useState(true),{t:x}=useTranslation(),y=useCallback(S=>{S.key==="Escape"&&e();},[e]);if(useEffect(()=>{if(t)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t,y]),!t)return null;let v=[{id:"general",label:x("pptx.settings.general")},{id:"shortcuts",label:x("pptx.settings.keyboardShortcuts")}];return jsxs(Fragment,{children:[jsx("button",{type:"button",style:{zIndex:1200},className:"fixed inset-0 bg-black/60","aria-label":x("pptx.settings.closeSettings"),onClick:e}),jsx("div",{style:{zIndex:1201},className:"fixed inset-0 flex items-center justify-center pointer-events-none",children:jsxs("div",{className:"pointer-events-auto w-[min(32rem,calc(100%-2rem))] rounded-xl border border-border bg-popover backdrop-blur-xl shadow-2xl",children:[jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/60",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(LuSettings,{className:"w-5 h-5 text-primary"}),jsx("h2",{className:"text-sm font-semibold text-foreground",children:x("pptx.settings.title")})]}),jsx("button",{type:"button",onClick:e,className:"p-1 rounded hover:bg-accent transition-colors","aria-label":x("pptx.settings.close"),children:jsx(LuX,{className:"w-4 h-4 text-muted-foreground"})})]}),jsx("div",{className:"flex border-b border-border/60 px-5",children:v.map(S=>jsxs("button",{type:"button",onClick:()=>f(S.id),className:le("px-3 py-2 text-xs font-medium transition-colors relative",p===S.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[S.label,p===S.id&&jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full"})]},S.id))}),jsxs("div",{className:"px-5 py-4 max-h-[60vh] overflow-y-auto",children:[p==="general"&&jsxs("div",{className:"space-y-0.5",children:[jsx(nS,{label:x("pptx.settings.autoSave"),enabled:h,onToggle:()=>m(!h)}),jsx(nS,{label:x("pptx.settings.spellCheck"),enabled:n,onToggle:()=>r?.(!n)}),jsx(nS,{label:x("pptx.settings.showGrid"),enabled:o,onToggle:()=>i?.(!o)}),jsx(nS,{label:x("pptx.settings.showRulers"),enabled:s,onToggle:()=>a?.(!s)}),jsx(nS,{label:x("pptx.settings.snapToGrid"),enabled:l,onToggle:()=>c?.(!l)}),jsx(nS,{label:x("pptx.settings.reducedMotion"),enabled:d,onToggle:()=>u?.()})]}),p==="shortcuts"&&jsx("div",{className:"space-y-0.5",children:mE.map((S,w)=>jsxs("div",{className:le("flex items-center justify-between gap-3 rounded px-3 py-2",w%2===0?"bg-muted/60":""),children:[jsx("span",{className:"text-xs text-foreground",children:S.action}),jsx("span",{className:"font-mono text-[11px] text-muted-foreground whitespace-nowrap",children:S.shortcut})]},S.action))})]})]})})]})}function XH({doc:t,slides:e,setSlides:n,isConnected:r}){let o=useRef(false),i=useRef(""),s=useRef(false),a=useCallback(()=>t?t.getMap("slides-data"):null,[t]);useEffect(()=>{if(!r||!t||o.current||e.length===0)return;let l=a();if(!l)return;let c=JSON.stringify(e);c!==i.current&&(i.current=c,t.transact(()=>{let d=l.get("count");if(typeof d=="number"&&d>e.length)for(let u=e.length;u<d;u++)l.delete(`slide-${u}`);l.set("count",e.length);for(let u=0;u<e.length;u++){let p=JSON.stringify(e[u]);l.get(`slide-${u}`)!==p&&l.set(`slide-${u}`,p);}}));},[t,e,r,a]),useEffect(()=>{if(!r||!t)return;let l=a();if(!l)return;let c=()=>{let d=l.get("count");if(typeof d!="number"||d===0)return;let u=[];for(let f=0;f<d;f++){let h=l.get(`slide-${f}`);if(typeof h=="string")try{u.push(JSON.parse(h));}catch{}}if(u.length===0)return;let p=JSON.stringify(u);p!==i.current&&(i.current=p,o.current=true,n(u),requestAnimationFrame(()=>{o.current=false;}));};if(l.observe(c),!s.current){s.current=true;let d=l.get("count");typeof d=="number"&&d>0&&c();}return ()=>{l.unobserve(c);}},[t,r,a,n]);}function WH({collab:t,activeSlideIndex:e,setActiveSlideIndex:n,slideCount:r}){let o=useRef(-1);useEffect(()=>{if(!t||t.config.role!=="viewer")return;let i=t.remoteUsers.find(a=>a.role==="broadcaster");if(!i)return;let s=i.activeSlideIndex;s<0||s>=r||s!==o.current&&(o.current=s,s!==e&&n(s));},[t,e,n,r]);}function RKe(t){if(t){let e=Math.round(t.cx/9525);if(e>0)return e}return 8}function kKe(t,e,n){if(e){let r=n.find(o=>o.id===e);if(r){let o=new Map;return t.forEach((i,s)=>o.set(i.rId,s)),r.slideRIds.map(i=>o.get(i)).filter(i=>i!==void 0)}}return t.map((r,o)=>o).filter(r=>!t[r]?.hidden)}function IKe(t,e){if(t.length===0)return [];if(e.length>0){let n=new Map,r=[];for(let i=0;i<t.length;i++){let s=t[i].sectionId;if(s){let a=n.get(s);a?a.push(i):n.set(s,[i]);}else r.push(i);}let o=e.map(i=>({id:i.id,label:i.name,slideIndexes:n.get(i.id)??[],color:i.color,defaultCollapsed:i.collapsed})).filter(i=>i.slideIndexes.length>0);return r.length>0&&o.push({id:kW,label:"Ungrouped Slides",slideIndexes:r}),o.length>0?o:[{id:"default",label:"Slides",slideIndexes:t.map((i,s)=>s)}]}return [{id:"default",label:"Slides",slideIndexes:t.map((n,r)=>r)}]}function NKe(t,e,n){if(t==="master"){if(e)return {id:e.path,rId:"",slideNumber:0,elements:e.elements??[],backgroundColor:e.backgroundColor??n?.backgroundColor,backgroundImage:e.backgroundImage??n?.backgroundImage};if(n)return {id:n.path,rId:"",slideNumber:0,elements:n.elements??[],backgroundColor:n.backgroundColor,backgroundImage:n.backgroundImage}}}function ace(t){let{slides:e,sections:n,customShows:r,activeCustomShowId:o,mode:i,activeLayout:s,activeMaster:a,presentationGridSpacing:l}=t,c=useMemo(()=>RKe(l),[l]),d=useMemo(()=>kKe(e,o,r),[e,o,r]),u=useMemo(()=>IKe(e,n),[e,n]),p=useMemo(()=>NKe(i,s,a),[i,s,a]);return {gridSpacingPx:c,visibleSlideIndexes:d,slideSectionGroups:u,masterPseudoSlide:p}}var DKe=120;function cce(t){let{slides:e,canvasSize:n,activeSlideIndex:r,templateElementsBySlideId:o,loading:i,error:s,hasActivePointerInteraction:a,pointerCommitNonce:l,setSlides:c,setCanvasSize:d,setActiveSlideIndex:u,setTemplateElementsBySlideId:p,setSelectedElementId:f,setSelectedElementIds:h}=t,m=useRef([]),x=useRef([]),y=useRef(null),v=useRef(""),S=useRef(""),w=useRef(false),C=useRef(null),[T,E]=useState(false),[M,A]=useState(false),[R,k]=useState(void 0),[N,F]=useState(void 0),[B,D]=useState(false),O=useCallback(()=>{E(m.current.length>0),A(x.current.length>0);let se=m.current[m.current.length-1];k(se?.actionLabel);let Ce=x.current[x.current.length-1];F(Ce?.actionLabel);},[]),U=useCallback(se=>({width:n.width,height:n.height,activeSlideIndex:r,slides:e.map(fE),templateElementsBySlideId:hE(o),...se?{actionLabel:se}:{}}),[r,n,e,o]),H=useCallback(se=>{let Ce=Math.max(se.slides.length-1,0);d({width:se.width,height:se.height}),c(se.slides.map(fE)),p(hE(se.templateElementsBySlideId)),u(Math.min(se.activeSlideIndex,Ce)),h([]),f(null);},[u,d,f,h,c,p]),j=useCallback(()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{w.current=false;},0);},[]),Z=useCallback(()=>{D(se=>se||true);},[]),J=useCallback(()=>{let se=m.current.pop();if(!se)return;let Ce=U();x.current.push(Ce),w.current=true;let ee=Lu(se);y.current=Lu(ee),v.current=JSON.stringify(ee),H(ee),O(),j(),Z();},[H,U,Z,j,O]),W=useCallback(()=>{let se=x.current.pop();if(!se)return;let Ce=U();m.current.push(Ce),w.current=true;let ee=Lu(se);y.current=Lu(ee),v.current=JSON.stringify(ee),H(ee),O(),j(),Z();},[H,U,Z,j,O]),te=useCallback(se=>{if(m.current=[],x.current=[],se){let Ce=Lu(se);y.current=Ce,v.current=JSON.stringify(Ce);}else y.current=null,v.current="";O();},[O]);return useEffect(()=>()=>{C.current&&(clearTimeout(C.current),C.current=null);},[]),useEffect(()=>{if(i||s||w.current||a())return;let se=`${e.length}|${r}|${n.width}x${n.height}|${e.map(de=>`${de.id}:${de.elements.length}`).join("/")}`;if(se===S.current)return;let Ce=U(),ee=JSON.stringify(Ce);if(ee===v.current){S.current=se;return}let ce=y.current;if(!ce){y.current=Lu(Ce),v.current=ee,S.current=se,O();return}m.current.push(Lu(ce)),m.current.length>DKe&&m.current.shift(),x.current=[],y.current=Lu(Ce),v.current=ee,S.current=se,O();},[r,U,n.height,n.width,s,a,i,l,e,O]),{canUndo:T,canRedo:M,undoLabel:R,redoLabel:N,handleUndo:J,handleRedo:W,resetHistory:te,markDirty:Z,buildHistorySnapshot:U}}function PN(t,e,n){let r={...n};if(!e||e.length===0)return [{text:t,style:r}];let o=[[]];for(let u of e)u.text===`
|
|
4676
4676
|
`||u.isParagraphBreak?o.push([]):o[o.length-1].push(u);let i=t.split(`
|
|
4677
4677
|
`),s=o.flat().find(u=>u.text.trim().length>0),a=s?.style?{...s.style}:r;function l(u,p){if(p.length===0)return u.length>0?[{text:u,style:{...a}}]:[{text:"",style:{...a}}];let f=p[0].bulletInfo;if(u.length===0){let v=[{text:"",style:{...p[0].style}}];return f&&(v[0].bulletInfo=f),v}if(p.reduce((y,v)=>y+v.text.length,0)===0){let y=[{text:u,style:{...p[0].style}}];return f&&(y[0].bulletInfo=f),y}let m=[],x=0;for(let y=0;y<p.length;y++){let v=p[y],S=y===p.length-1,w=v.text.length;if(x>=u.length)break;let C;if(S?C=u.slice(x):C=u.slice(x,x+w),C.length>0){let T={text:C,style:{...v.style}};m.length===0&&f&&(T.bulletInfo=f),m.push(T);}x+=S?C.length:w;}if(m.length===0){let y={text:u,style:{...p[0].style}};return f&&(y.bulletInfo=f),[y]}return m}let c=[],d=o[o.length-1];for(let u=0;u<i.length;u++){if(u>0){let h=o[u-1]??[],m=h[0]?.style?{...h[0].style}:{...a};c.push({text:`
|
|
4678
|
-
`,style:m,isParagraphBreak:true});}let p=o[u]??d??[],f=l(i[u],p);c.push(...f);}return c.length>0?c:[{text:"",style:{...a}}]}function dce(t){let{mode:e,canEdit:n,canvasSize:r,selectedElementId:o,selectedElementIds:i,selectedElementIdSet:s,inlineEditingElementId:a,effectiveSelectedIds:l,elementLookup:c,activeTool:d,editorScale:u,canvasStageRef:p,dragStateRef:f,resizeStateRef:h,shapeAdjustmentDragStateRef:m,marqueeStateRef:x,setInlineEditingElementId:y,setInlineEditingText:v,setContextMenuState:S,setMarqueeSelectionState:w,setSnapLines:C,inlineEditingText:T,ops:E,history:M,presentationHandleAction:A,setEditingEquationOmml:R,setIsEquationDialogOpen:k}=t,N=useRef(false);return {handleElementClick:(J,W)=>{if(W.stopPropagation(),e==="present"){let te=c.get(J);te?.actionClick&&A(te.actionClick);return}if(W.shiftKey||W.metaKey){let te=i.length?i:o?[o]:[],se=te.includes(J)?te.filter(Ce=>Ce!==J):[...te,J];E.applySelection(se[0]??null,se);}else if(s.has(J)&&!a)if(N.current)N.current=false;else {let te=c.get(J);te&&ot(te)&&!te.locks?.noTextEdit&&(y(J),v(te.text??""));}else E.applySelection(J);},handleElementDoubleClick:(J,W)=>{let te=c.get(J);if(te){if(ot(te)&&te.textSegments?.some(se=>se.equationXml)){let se=te.textSegments?.find(Ce=>Ce.equationXml);if(se?.equationXml){R(se.equationXml),k(true);return}}ot(te)&&(y(J),v(te.text??""));}},handleElementMouseDown:(J,W)=>{if(W.button!==0)return;let te=s.has(J);te?N.current=false:(E.applySelection(J),N.current=true);let se=te?l.length?l:[J]:[J],Ce={},ee=new Map;for(let ce of se){let de=c.get(ce);de&&(Ce[ce]={x:de.x,y:de.y});let Ne=document.querySelector(`[data-element-id="${ce}"]`);Ne&&ee.set(ce,Ne);}f.current={elementId:J,startClientX:W.clientX,startClientY:W.clientY,startPositionsById:Ce,domEls:ee,moved:false,lastDx:0,lastDy:0},C([]);},handleElementContextMenu:(J,W)=>{W.preventDefault(),W.stopPropagation(),s.has(J)||E.applySelection(J),S({x:W.clientX,y:W.clientY,elementId:J});},handleCanvasMouseDown:J=>{if(e!=="edit"||!n||J.button!==0||d!=="select")return;let W=p.current;if(!W)return;let te=W.getBoundingClientRect(),se=u||1,Ce=Math.max(0,Math.min(r.width,(J.clientX-te.left)/se)),ee=Math.max(0,Math.min(r.height,(J.clientY-te.top)/se)),ce=J.shiftKey||J.metaKey,de={startX:Ce,startY:ee,currentX:Ce,currentY:ee,additive:ce,baseSelectionIds:ce?l:[]};x.current=de,w(de),S(null);},handleResizePointerDown:(J,W,te)=>{W.stopPropagation();let se=c.get(J);se&&(h.current={elementId:J,startClientX:W.clientX,startClientY:W.clientY,startX:se.x,startY:se.y,startWidth:se.width,startHeight:se.height,handle:te,moved:false,domEl:document.querySelector(`[data-element-id="${J}"]`),lastX:se.x,lastY:se.y,lastWidth:se.width,lastHeight:se.height});},handleAdjustmentPointerDown:(J,W)=>{W.stopPropagation();let te=c.get(J);if(!te||!("shapeType"in te)||!("shapeAdjustments"in te))return;let se=Object.entries(te.shapeAdjustments??{});if(!se.length)return;let[Ce,ee]=se[0];m.current={elementId:J,key:Ce,shapeType:te.shapeType??"rect",startClientX:W.clientX,startClientY:W.clientY,startAdjustment:ee,startWidth:te.width,startHeight:te.height,moved:false};},handleInlineEditCommit:()=>{let J=a;if(!J)return;let W=c.get(J);if(W&&ot(W)){let te=PN(T,W.textSegments,W.textStyle);E.updateElementById(J,{text:T,textSegments:te}),M.markDirty();}y(null),v("");}}}function YH(){return `comment-${crypto.randomUUID()}`}function uce(t,e,n){return t.map((r,o)=>o===e?{...r,comments:[...r.comments||[],n]}:r)}function pce(t,e,n){let r=false;return {slides:t.map((i,s)=>{if(s!==e)return i;let a=i.comments||[],l=a.filter(c=>{let d=c.id!==n;return d||(r=true),d});return l.length===a.length?i:{...i,comments:l}}),didDelete:r}}function fce(t,e,n,r){let o=false;return {slides:t.map((s,a)=>{if(a!==e)return s;let l=(s.comments||[]).map(c=>c.id!==n?c:(o=true,{...c,text:r}));return o?{...s,comments:l}:s}),didUpdate:o}}function hce(t,e,n){let r=false;return {slides:t.map((i,s)=>{if(s!==e)return i;let a=(i.comments||[]).map(l=>l.id!==n?l:(r=true,{...l,resolved:!l.resolved}));return r?{...i,comments:a}:i}),didUpdate:r}}function mce(t,e){let n={},r=false;for(let[o,i]of Object.entries(t)){if(!e.has(o)){r=true;continue}n[o]=i;}return r?n:null}function gce({slides:t,canEdit:e,userName:n="You",selectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState({}),[l,c]=useState({}),[d,u]=useState({}),[p,f]=useState({}),[h,m]=useState(null),x=useCallback((N,F)=>{a(B=>({...B,[N]:F}));},[]),y=useCallback((N,F)=>{u(B=>({...B,[N]:F}));},[]),v=useCallback(N=>{if(!e)return;let F=t[N];if(!F)return;let B=String(s[F.id]||"").trim();if(B.length===0)return;let D={id:YH(),text:B,author:n,createdAt:new Date().toISOString(),elementId:r??void 0};o(O=>uce(O,N,D)),a(O=>({...O,[F.id]:""})),i();},[e,s,i,o,r,t,n]),S=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=false;o(O=>{let U=pce(O,N,F);return D=U.didDelete,U.slides}),D&&(c(O=>({...O,[B.id]:null})),i());},[e,i,o,t]),w=useCallback((N,F)=>{let B=t.find(O=>O.id===N);if(!B)return;let D=(B.comments||[]).find(O=>O.id===F);D&&(c(O=>({...O,[N]:F})),u(O=>({...O,[F]:D.text||""})));},[t]),C=useCallback(N=>{c(F=>({...F,[N]:null}));},[]),T=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=String(d[F]||"").trim();if(D.length===0)return;let O=false;o(U=>{let H=fce(U,N,F,D);return O=H.didUpdate,H.slides}),O&&(c(U=>({...U,[B.id]:null})),i());},[e,d,i,o,t]),E=useCallback((N,F)=>{if(!e||!t[N])return;let D=false;o(O=>{let U=hce(O,N,F);return D=U.didUpdate,U.slides}),D&&i();},[e,i,o,t]),M=useCallback((N,F)=>{m(F),f(B=>({...B,[F]:""}));},[]),A=useCallback(()=>{m(null);},[]),R=useCallback((N,F)=>{f(B=>({...B,[N]:F}));},[]),k=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=(B.comments||[]).find(H=>H.id===F);if(!D)return;let O=String(p[F]||"").trim();if(O.length===0)return;let U={id:YH(),text:O,author:n,createdAt:new Date().toISOString(),threadId:F,elementId:D.elementId};o(H=>H.map((j,Z)=>{if(Z!==N)return j;let J=(j.comments||[]).map(W=>W.id!==F?W:{...W,replies:[...W.replies||[],U]});return {...j,comments:J}})),m(null),f(H=>{let j={...H};return delete j[F],j}),i();},[e,i,o,p,t,n]);return useEffect(()=>{let N=new Set(t.map(F=>F.id));a(F=>mce(F,N)??F);},[t]),{commentDraftBySlideId:s,editingCommentIdBySlideId:l,commentEditDraftByCommentId:d,replyingToCommentId:h,replyDraftByCommentId:p,handleCommentDraftChange:x,handleAddSlideComment:v,handleDeleteSlideComment:S,handleStartCommentEdit:w,handleCancelCommentEdit:C,handleSaveCommentEdit:T,handleSetCommentEditDraft:y,handleToggleCommentResolved:E,handleStartReply:M,handleCancelReply:A,handleReplyDraftChange:R,handleSubmitReply:k}}function xo(){return `el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function xce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,editTemplateMode:i,clipboardPayload:s,setClipboardPayload:a,setTemplateElementsBySlideId:l,ops:c,history:d}=t,u=()=>{r&&a({element:structuredClone(r),isTemplate:i});},p=()=>{let x=o;if(!x.length||!e)return;let y=new Set(x);i?l(v=>{let S=e.id,w=v[S]??[];return {...v,[S]:w.filter(C=>!y.has(C.id))}}):c.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:S.elements.filter(C=>!y.has(C.id))}:S)),c.clearSelection(),d.markDirty();};return {handleCopy:u,handleCut:()=>{u(),p();},handlePaste:()=>{if(!s||!e)return;let x=structuredClone(s.element);x.id=xo(),x.x+=20,x.y+=20,c.updateSlides(y=>y.map((v,S)=>S===n?{...v,elements:[...v.elements,x]}:v)),c.applySelection(x.id),d.markDirty();},handleDuplicate:()=>{if(!r||!e)return;let x=structuredClone(r);x.id=xo(),x.x+=20,x.y+=20,c.updateSlides(y=>y.map((v,S)=>S===n?{...v,elements:[...v.elements,x]}:v)),c.applySelection(x.id),d.markDirty();},handleDelete:p}}function BKe(t){return t.type==="shape"||t.type==="image"||t.type==="picture"}function OKe(t){if("pathData"in t&&typeof t.pathData=="string"&&t.pathData)return t.pathData;if("shapeType"in t&&typeof t.shapeType=="string"){let e=O5(t.shapeType);if(e){let n=UKe(e,t.width,t.height);if(n)return n}}return `M 0 0 L ${t.width} 0 L ${t.width} ${t.height} L 0 ${t.height} Z`}function UKe(t,e,n){let r=t.match(/polygon\(([^)]+)\)/i);if(!r)return null;let o=r[1].split(",").map(a=>a.trim()),i=[];for(let a of o){let l=a.split(/\s+/);if(l.length<2)continue;let c=l[0],d=l[1],u,p;c.endsWith("%")?u=parseFloat(c)/100*e:u=parseFloat(c),d.endsWith("%")?p=parseFloat(d)/100*n:p=parseFloat(d),!isNaN(u)&&!isNaN(p)&&i.push({x:u,y:p});}if(i.length<3)return null;let s=[`M ${i[0].x} ${i[0].y}`];for(let a=1;a<i.length;a++)s.push(`L ${i[a].x} ${i[a].y}`);return s.push("Z"),s.join(" ")}function $Ke(t,e){let n=Ml(t);if(n.length===0)return t;let r=e.width,o=e.height;"pathWidth"in e&&typeof e.pathWidth=="number"&&(r=e.pathWidth),"pathHeight"in e&&typeof e.pathHeight=="number"&&(o=e.pathHeight);let i=r>0?e.width/r:1,s=o>0?e.height/o:1,a=n.map(l=>l.map(c=>({x:c.x*i+e.x,y:c.y*s+e.y})));return Gx(a)}function yce(t,e,n,r,o){let i=Ml(t);if(i.length===0)return t;let s=i.map(a=>a.map(l=>({x:l.x-e,y:l.y-n})));return Gx(s)}function bce(t){let e=Ml(t),n=1/0,r=1/0,o=-1/0,i=-1/0;for(let s of e)for(let a of s)a.x<n&&(n=a.x),a.y<r&&(r=a.y),a.x>o&&(o=a.x),a.y>i&&(i=a.y);return isFinite(n)?{x:n,y:r,width:o-n,height:i-r}:{x:0,y:0,width:0,height:0}}function vce(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,effectiveSelectedIds:o,setSelectedElementIds:i,ops:s,history:a}=t,l=r.filter(BKe),c=l.length>=2;return {handleMergeShapes:u=>{if(!c||!e)return;let p=l;if(p.length<2)return;let f=p.map(h=>{let m=OKe(h);return $Ke(m,h)});if(u==="fragment"){let h=[],m=f[0];for(let v=1;v<f.length;v++){let S=G5("fragment",m,f[v]);Array.isArray(S)&&(h=S),v<f.length-1&&h.length>0&&(m=h[0]);}if(h.length===0)return;let x=new Set(o),y=[];for(let v of h){if(!v)continue;let S=bce(v);if(S.width<=0||S.height<=0)continue;let w=yce(v,S.x,S.y),C={id:xo(),type:"shape",x:S.x,y:S.y,width:S.width,height:S.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:p[0].opacity??1,rawXml:{},shapeStyle:{...p[0].shapeStyle},shapeType:"custGeom",pathData:w,pathWidth:S.width,pathHeight:S.height};y.push(C);}if(y.length===0)return;s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements.filter(C=>!x.has(C.id)),...y]}:S)),i(y.map(v=>v.id)),a.markDirty();}else {let h=f[0];for(let w=1;w<f.length;w++){let C=G5(u,h,f[w]);typeof C=="string"&&(h=C);}if(!h)return;let m=bce(h);if(m.width<=0||m.height<=0)return;let x=yce(h,m.x,m.y),y=p[0],v={id:xo(),type:"shape",x:m.x,y:m.y,width:m.width,height:m.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:y.opacity??1,rawXml:{},shapeStyle:{...y.shapeStyle},shapeType:"custGeom",pathData:x,pathWidth:m.width,pathHeight:m.height},S=new Set(o);s.updateSlides(w=>w.map((C,T)=>T===n?{...C,elements:[...C.elements.filter(E=>!S.has(E.id)),v]}:C)),s.applySelection(v.id),a.markDirty();}},canMergeShapes:c}}function Sce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,selectedElements:i,elementLookup:s,setSelectedElementIds:a,ops:l,history:c}=t,d=()=>{let v=o;if(v.length<2||!e)return;let S=new Set(v),w=e.elements.filter(k=>S.has(k.id));if(w.length<2)return;let C=1/0,T=1/0,E=-1/0,M=-1/0;for(let k of w)C=Math.min(C,k.x),T=Math.min(T,k.y),E=Math.max(E,k.x+k.width),M=Math.max(M,k.y+k.height);let A=w.map(k=>({...structuredClone(k),x:k.x-C,y:k.y-T})),R={id:xo(),type:"group",x:C,y:T,width:E-C,height:M-T,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:1,rawXml:{},children:A};l.updateSlides(k=>k.map((N,F)=>F===n?{...N,elements:[...N.elements.filter(B=>!S.has(B.id)),R]}:N)),l.applySelection(R.id),c.markDirty();},u=()=>{if(!r||r.type!=="group"||!e)return;let v=r,S=v.children.map(w=>({...structuredClone(w),id:w.id||xo(),x:w.x+v.x,y:w.y+v.y}));l.updateSlides(w=>w.map((C,T)=>T===n?{...C,elements:[...C.elements.filter(E=>E.id!==v.id),...S]}:C)),a(S.map(w=>w.id)),c.markDirty();},p=v=>{if(!r)return;let S=v==="horizontal"?{flipHorizontal:!r.flipHorizontal}:{flipVertical:!r.flipVertical};l.updateSelectedElement(S),c.markDirty();},f=v=>{if(i.length<2)return;let S=i.map(R=>({id:R.id,left:R.x,top:R.y,right:R.x+R.width,bottom:R.y+R.height})),w=Math.min(...S.map(R=>R.left)),C=Math.min(...S.map(R=>R.top)),T=Math.max(...S.map(R=>R.right)),E=Math.max(...S.map(R=>R.bottom)),M=(w+T)/2,A=(C+E)/2;for(let R of S){let k=s.get(R.id);if(!k)continue;let N=k.x,F=k.y;switch(v){case "left":N=w;break;case "center":N=M-k.width/2;break;case "right":N=T-k.width;break;case "top":F=C;break;case "middle":F=A-k.height/2;break;case "bottom":F=E-k.height;break}l.updateElementById(R.id,{x:N,y:F});}c.markDirty();},h=v=>{if(!r||!e)return;let S=e.elements,w=S.findIndex(T=>T.id===r.id);if(w===-1)return;let C=[...S];v==="forward"&&w<S.length-1?[C[w],C[w+1]]=[C[w+1],C[w]]:v==="backward"&&w>0&&([C[w],C[w-1]]=[C[w-1],C[w]]),l.updateSlides(T=>T.map((E,M)=>M===n?{...E,elements:C}:E)),c.markDirty();},m=v=>{if(!r||!e)return;let S=e.elements,w=S.findIndex(M=>M.id===r.id);if(w===-1)return;let C=S[w],T=S.filter((M,A)=>A!==w),E=v==="front"?[...T,C]:[C,...T];l.updateSlides(M=>M.map((A,R)=>R===n?{...A,elements:E}:A)),c.markDirty();},{handleMergeShapes:x,canMergeShapes:y}=vce({activeSlide:e,activeSlideIndex:n,selectedElements:i,effectiveSelectedIds:o,setSelectedElementIds:a,ops:l,history:c});return {handleGroupElements:d,handleUngroupElement:u,handleFlip:p,handleAlignElements:f,handleMoveLayer:h,handleMoveLayerToEdge:m,handleMergeShapes:x,canMergeShapes:y}}function wce(t){let{setIsInspectorPaneOpen:e,setSidebarPanelMode:n,onOpenHyperlinkDialog:r}=t,{handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleDelete:l}=xce(t),{handleGroupElements:c,handleUngroupElement:d,handleFlip:u,handleAlignElements:p,handleMoveLayer:f,handleMoveLayerToEdge:h,handleMergeShapes:m,canMergeShapes:x}=Sce(t);return {handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleGroupElements:c,handleUngroupElement:d,handleDelete:l,handleFlip:u,handleAlignElements:p,handleMoveLayer:f,handleMoveLayerToEdge:h,handleMergeShapes:m,canMergeShapes:x,handleContextMenuAction:v=>{switch(v){case "copy":o();break;case "cut":i();break;case "paste":s();break;case "duplicate":a();break;case "delete":l();break;case "bring-forward":case "bringForward":f("forward");break;case "send-backward":case "sendBackward":f("backward");break;case "bring-front":case "bringToFront":h("front");break;case "send-back":case "sendToBack":h("back");break;case "comment":case "addComment":e(true),n("comments");break;case "group":c();break;case "ungroup":d();break;case "editHyperlink":r();break}}}}function Cce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,selectedElementId:o,history:i,setSlides:s,setTemplateElementsBySlideId:a,setSelectedElementId:l,setSelectedElementIds:c,setInlineEditingElementId:d,setContextMenuState:u}=t,p=useCallback((w,C=[])=>{l(w),c(C);},[l,c]),f=useCallback(()=>{p(null,[]),d(null),u(null);},[p,d,u]),h=useCallback((w,C)=>{D7(w)?a(E=>{let M=e?.id;if(!M)return E;let A=E[M]??[];return {...E,[M]:A.map(R=>R.id===w?{...R,...C}:R)}}):s(E=>E.map((M,A)=>A!==n?M:{...M,elements:M.elements.map(R=>R.id===w?{...R,...C}:R)})),i.markDirty();},[e?.id,n,i,s,a]),m=useCallback(w=>{o&&h(o,w);},[o,h]),x=useCallback(w=>{!r||!mn(r)||m({shapeStyle:{...r.shapeStyle,...w}});},[r,m]),y=useCallback(w=>{if(!r||!ot(r))return;let C=Fee(r.textSegments);if(C&&r.textSegments){let{newSegments:M,newSelection:A}=Bee(r.textSegments,C,w);Dee(A),m({textSegments:M});return}let T={...r.textStyle,...w},E=r.textSegments?.map(M=>({...M,style:{...M.style,...w}}));m({textStyle:T,textSegments:E});},[r,m]),v=useCallback(w=>{s(C=>w(C));},[s]),S=useCallback(async()=>null,[]);return {applySelection:p,clearSelection:f,updateElementById:h,updateSelectedElement:m,updateSelectedShapeStyle:x,updateSelectedTextStyle:y,updateSlides:v,serializeSlides:S}}function zKe(t,e,n){if(!e)return [];let r=[],o=n?e:e.toLowerCase();return t.forEach((i,s)=>{for(let a of i.elements||[]){if(!ot(a))continue;(a.textSegments??[]).forEach((c,d)=>{let u=n?c.text:(c.text||"").toLowerCase(),p=0;for(;p<u.length;){let f=u.indexOf(o,p);if(f===-1)break;r.push({slideIndex:s,elementId:a.id,segmentIndex:d,startOffset:f,length:e.length}),p=f+1;}});}}),r}function GKe(t,e,n){if(e.length===0)return t;let r=[...t],o=new Map;for(let i of e){let s=`${i.slideIndex}::${i.elementId}::${i.segmentIndex}`;o.has(s)||o.set(s,[]),o.get(s).push(i);}for(let[,i]of o){let s=[...i].sort((a,l)=>l.startOffset-a.startOffset);for(let a of s){let l=r[a.slideIndex];if(!l)continue;let c=(l.elements||[]).findIndex(x=>x.id===a.elementId);if(c===-1)continue;let d=l.elements[c];if(!ot(d))continue;let u=[...d.textSegments??[]],p=u[a.segmentIndex];if(!p)continue;let f=p.text.slice(0,a.startOffset),h=p.text.slice(a.startOffset+a.length);u[a.segmentIndex]={...p,text:f+n+h};let m=[...l.elements];m[c]={...d,text:u.map(x=>x.text).join(""),textSegments:u},r[a.slideIndex]={...l,elements:m};}}return r}function Tce({slides:t,mode:e,onSetActiveSlideIndex:n,onSetSelectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState(false),[l,c]=useState(""),[d,u]=useState(""),[p,f]=useState(false),[h,m]=useState([]),[x,y]=useState(-1),v=useCallback(()=>{let E=zKe(t,l,p);if(!l){m([]),y(-1);return}m(E),y(E.length>0?0:-1),E.length>0&&(n(E[0].slideIndex),r(E[0].elementId));},[t,l,p,n,r]),S=useCallback(E=>{if(h.length===0)return;let M=(x+E+h.length)%h.length;y(M);let A=h[M];A&&(n(A.slideIndex),r(A.elementId));},[h,x,n,r]),w=useCallback(E=>{E.length!==0&&(o(M=>GKe(M,E,d)),i());},[d,o,i]),C=useCallback(()=>{h.length===0||x<0||(w([h[x]]),setTimeout(v,0));},[h,x,w,v]),T=useCallback(()=>{h.length!==0&&(w(h),setTimeout(v,0));},[h,w,v]);return useEffect(()=>{let E=M=>{if((M.metaKey||M.ctrlKey)&&M.key==="f"){if(e!=="edit")return;M.preventDefault(),a(A=>!A);}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e]),{findReplaceOpen:s,setFindReplaceOpen:a,findQuery:l,setFindQuery:c,replaceQuery:d,setReplaceQuery:u,findMatchCase:p,setFindMatchCase:f,findResults:h,findResultIndex:x,performFind:v,navigateFindResult:S,handleReplace:C,handleReplaceAll:T}}function Mce(t){let{activeSlide:e,canvasSize:n,addElement:r}=t;return {handleImageFileChange:s=>{let a=s.target.files?.[0];if(!a||!e)return;s.target.value="";let l=new FileReader;l.onload=()=>{let c=l.result;if(!c)return;let d=new Image;d.onload=()=>{let f=d.naturalWidth||400,h=d.naturalHeight||300;if(f>500||h>400){let m=Math.min(500/f,400/h);f=Math.round(f*m),h=Math.round(h*m);}r({id:xo(),type:"image",x:Math.round((n.width-f)/2),y:Math.round((n.height-h)/2),width:f,height:h,imageData:c});},d.onerror=()=>{r({id:xo(),type:"image",x:100,y:100,width:400,height:300,imageData:c});},d.src=c;},l.readAsDataURL(a);},handleMediaFileChange:s=>{let a=s.target.files?.[0];if(!a||!e)return;s.target.value="";let l=a.type.startsWith("audio/")?"audio":a.type.startsWith("video/")?"video":null;if(!l)return;let c=a.path,d=(p,f,h)=>{r({id:xo(),type:"media",mediaType:l,mediaMimeType:a.type||void 0,mediaData:p,x:Math.round((n.width-f)/2),y:Math.round((n.height-h)/2),width:f,height:h});};if(c){let p=c.replace(/\\/g,"/");p.startsWith("/")||(p=`/${p}`);let f=`pptx-resource://media${encodeURI(p)}`;if(l==="audio"){d(f,420,64);return}let h=URL.createObjectURL(a),m=document.createElement("video");m.preload="metadata",m.onloadedmetadata=()=>{URL.revokeObjectURL(h);let x=640,y=360,v=m.videoWidth||x,S=m.videoHeight||y;if(v>x||S>y){let w=Math.min(x/v,y/S);v=Math.round(v*w),S=Math.round(S*w);}d(f,v,S);},m.onerror=()=>{URL.revokeObjectURL(h),d(f,640,360);},m.src=h;return}let u=new FileReader;u.onload=()=>{let p=u.result;if(!p)return;if(l==="audio"){d(p,420,64);return}let f=document.createElement("video");f.preload="metadata",f.onloadedmetadata=()=>{let x=f.videoWidth||640,y=f.videoHeight||360;if(x>640||y>360){let v=Math.min(640/x,360/y);x=Math.round(x*v),y=Math.round(y*v);}d(p,x,y);},f.onerror=()=>{d(p,640,360);},f.src=p;},u.readAsDataURL(a);}}}function _ce(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,ops:o,history:i,addElement:s}=t;return {handleInsertSmartArt:(p,f)=>{if(!e)return;let h=f.map((x,y)=>`node-${Date.now()}-${y}-${Math.random().toString(36).slice(2,8)}`),m=f.map((x,y)=>{let v={id:h[y],text:x};return p==="hierarchy"&&y>0&&(v.parentId=h[0]),v});s({id:xo(),type:"smartArt",x:100,y:120,width:600,height:340,smartArtData:{layout:p,colorScheme:"colorful1",style:"flat",nodes:m}});},handleInsertEquation:p=>{e&&s({id:xo(),type:"shape",x:120,y:200,width:400,height:80,text:"[Equation]",textStyle:{fontSize:18,fontFamily:"Cambria Math"},textSegments:[{text:"[Equation]",style:{fontSize:18,fontFamily:"Cambria Math"},equationXml:p}]});},handleHyperlinkConfirm:p=>{let f=r[0];if(!f)return;let h=ele(p),m={url:h.url||void 0,action:h.action,tooltip:h.tooltip};o.updateElementById(f.id,{actionClick:m}),i.markDirty();},handleInsertField:(p,f)=>{if(!e)return;let h={slidenum:String(n+1),datetime:new Date().toLocaleDateString(),header:"Header",footer:"Footer"},m=f||h[p]||p,x=`{${crypto.randomUUID().toUpperCase()}}`;s({id:xo(),type:"shape",x:120,y:200,width:200,height:40,text:m,textStyle:{fontSize:14},textSegments:[{text:m,style:{fontSize:14},fieldType:p,fieldGuid:x}]});},handleAddActionButton:p=>{if(!e)return;let f=Lm.find(m=>m.shapeType===p);if(!f)return;let h=iE({type:f.defaultAction});h&&(h.tooltip=f.label,h.highlightClick=true),s({id:xo(),type:"shape",x:150,y:150,width:120,height:50,shapeType:f.shapeType,text:f.label,textStyle:{fontSize:11,fontColor:"#FFFFFF",align:"center",verticalAlign:"middle"},textSegments:[{text:f.label,style:{fontSize:11,fontColor:"#FFFFFF",bold:true}}],shapeStyle:{fillColor:"#4472C4",strokeColor:"#2F5597",strokeWidth:1},actionClick:h});}}}function Ece(t){let{activeSlide:e,activeSlideIndex:n,canvasSize:r,newShapeType:o,selectedElements:i,ops:s,history:a}=t,l=y=>{s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements,y]}:S)),s.applySelection(y.id),a.markDirty();},c=()=>{e&&l({id:xo(),type:"text",x:100,y:100,width:300,height:60,text:"",textStyle:{fontSize:24}});},d=()=>{e&&l({id:xo(),type:"shape",x:150,y:150,width:200,height:150,shapeType:o,shapeStyle:{fillColor:"#3b82f6",strokeColor:"#1f2937",strokeWidth:2}});},u=()=>{if(!e)return;let y=Array.from({length:3},()=>({cells:Array.from({length:3},()=>({text:"",style:{}}))})),v=Array.from({length:3},()=>1/3);l({id:xo(),type:"table",x:100,y:200,width:600,height:250,tableData:{rows:y,columnWidths:v}});},p=_ce({activeSlide:e,activeSlideIndex:n,selectedElements:i,ops:s,history:a,addElement:l}),f=Mce({activeSlide:e,canvasSize:r,addElement:l});return {handleAddTextBox:c,handleAddShape:d,handleAddTable:u,...p,handleAddInkElement:y=>{e&&(s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements,y]}:S)),a.markDirty());},handleAddFreeformShape:y=>{e&&l(y);},handleEraseInkElement:y=>{e&&(s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:S.elements.filter(C=>C.id!==y)}:S)),a.markDirty());},...f}}function jKe(){let t=()=>Math.floor(Math.random()*65536).toString(16).padStart(4,"0");return `{${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}}`}function Ace(t){let{sections:e,setSections:n,slides:r,setSlides:o,markDirty:i}=t,s=useCallback((p,f)=>{let h=jKe(),x=r[f]?.sectionId,y=[];for(let v=f;v<r.length&&(v===f||r[v].sectionId===x);v++)y.push(v);o(v=>v.map((S,w)=>y.includes(w)?{...S,sectionId:h,sectionName:p}:S)),n(v=>{let S=x?v.findIndex(M=>M.id===x)+1:v.length,w=y.map(M=>{let A=r[M],k=A?.rawXml?.["p:sld"];return String(k?.["@_id"]||A?.slideNumber||M+1)}),C=v.map(M=>M.id===x?{...M,slideIds:M.slideIds.filter(A=>!w.includes(A))}:M),T={id:h,name:p,slideIds:w},E=[...C];return E.splice(S,0,T),E}),i();},[r,o,n,i]),a=useCallback((p,f)=>{n(h=>h.map(m=>m.id===p?{...m,name:f}:m)),o(h=>h.map(m=>m.sectionId===p?{...m,sectionName:f}:m)),i();},[n,o,i]),l=useCallback(p=>{n(m=>{let x=m.findIndex(w=>w.id===p);if(x===-1)return m;let y=m[x],v=x>0?m[x-1]:void 0,S=m.filter(w=>w.id!==p);return v&&y?S.map(w=>w.id===v.id?{...w,slideIds:[...w.slideIds,...y.slideIds]}:w):S});let f=e.findIndex(m=>m.id===p),h=f>0?e[f-1]:void 0;o(m=>m.map(x=>x.sectionId!==p?x:h?{...x,sectionId:h.id,sectionName:h.name}:{...x,sectionId:void 0,sectionName:void 0})),i();},[e,n,o,i]),c=useCallback(p=>{n(f=>{let h=f.findIndex(x=>x.id===p);if(h<=0)return f;let m=[...f];return [m[h-1],m[h]]=[m[h],m[h-1]],m}),i();},[n,i]),d=useCallback(p=>{n(f=>{let h=f.findIndex(x=>x.id===p);if(h===-1||h>=f.length-1)return f;let m=[...f];return [m[h],m[h+1]]=[m[h+1],m[h]],m}),i();},[n,i]),u=useCallback((p,f)=>{let h=e.find(m=>m.id===f);h&&(o(m=>m.map((x,y)=>p.includes(y)?{...x,sectionId:f,sectionName:h.name}:x)),n(m=>{let x=p.map(y=>{let v=r[y],w=v?.rawXml?.["p:sld"];return String(w?.["@_id"]||v?.slideNumber||y+1)});return m.map(y=>y.id===f?{...y,slideIds:[...y.slideIds,...x.filter(v=>!y.slideIds.includes(v))]}:{...y,slideIds:y.slideIds.filter(v=>!x.includes(v))})}),i());},[e,r,o,n,i]);return {addSection:s,renameSection:a,deleteSection:l,moveSectionUp:c,moveSectionDown:d,moveSlidesToSection:u}}function XKe(t,e,n){let r=[...t],o=Math.max(0,Math.min(e+1,r.length));return r.splice(o,0,n),r}function Pce(t){let{slides:e,activeSlideIndex:n,setActiveSlideIndex:r,ops:o,history:i,handlerRef:s}=t;return {handleAddSlide:()=>{let h={id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,rId:"",slideNumber:e.length+1,elements:[]};o.updateSlides(m=>{let x=[...m];return x.splice(n+1,0,h),x}),r(n+1),i.markDirty();},handleMoveSlide:(h,m)=>{h!==m&&(o.updateSlides(x=>{let y=[...x],[v]=y.splice(h,1);return y.splice(m,0,v),y}),r(m),i.markDirty());},handleSlideContextMenu:(h,m)=>{},handleDeleteSlides:h=>{if(h.length===0||e.length<=1)return;let m=[...h].sort((y,v)=>v-y);o.updateSlides(y=>{let v=[...y];for(let S of m)v.length>1&&v.splice(S,1);return v});let x=Math.min(...h);r(Math.min(x,e.length-h.length-1,Math.max(e.length-h.length-1,0))),i.markDirty();},handleDuplicateSlides:h=>{if(h.length===0)return;let m=[...h].sort((x,y)=>x-y);o.updateSlides(x=>{let y=[...x],v=0;for(let S of m){let w=y[S+v];if(!w)continue;let C={...w,id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,elements:w.elements.map(T=>({...T,id:`${T.id}-dup-${Math.random().toString(36).slice(2,6)}`}))};y.splice(S+v+1,0,C),v++;}return y}),i.markDirty();},handleToggleHideSlides:h=>{h.length!==0&&(o.updateSlides(m=>{let x=[...m];for(let y of h){let v=x[y];v&&(x[y]={...v,hidden:!v.hidden});}return x}),i.markDirty());},handleInsertSlideFromLayout:(h,m)=>{let x=n+1,y={id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,rId:"",slideNumber:e.length+1,elements:[],layoutPath:h,...m?{layoutName:m}:{}},v=[];o.updateSlides(w=>(v=XKe(w,n,y),v)),r(x),i.markDirty();let S=s?.current;S&&S.applyLayoutToSlide(x,h,v).then(w=>{o.updateSlides(C=>{if(C[x]?.id!==y.id)return C;let T=[...C];return T[x]=w,T});},()=>{});}}}function Rce(t){let{selectedElement:e,tableEditorState:n,setTableEditorState:r,ops:o,history:i}=t;return {handleMergeCellRight:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,f=p.rows[d]?.cells[u];if(!f)return;let h=Math.max(1,f.gridSpan??1),m=u+h,x=p.rows[d]?.cells[m];if(!x||x.hMerge||x.vMerge)return;let y=O1([{row:d,col:u},{row:d,col:m}],p),v={tableData:y},S=iy(e,y);S&&(v.rawXml=S),o.updateSelectedElement(v),i.markDirty();},handleMergeCellDown:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,f=p.rows[d]?.cells[u];if(!f)return;let h=Math.max(1,f.rowSpan??1),m=d+h;if(m>=p.rows.length)return;let x=p.rows[m]?.cells[u];if(!x||x.hMerge||x.vMerge)return;let y=O1([{row:d,col:u},{row:m,col:u}],p),v={tableData:y},S=iy(e,y);S&&(v.rawXml=S),o.updateSelectedElement(v),i.markDirty();},handleMergeSelectedCells:()=>{if(!e||e.type!=="table"||!e.tableData||!n||!n.selectedCells||n.selectedCells.length<2)return;let d=e.tableData,u=O1(n.selectedCells,d),p={tableData:u},f=iy(e,u);f&&(p.rawXml=f),o.updateSelectedElement(p),r({rowIndex:n.rowIndex,columnIndex:n.columnIndex}),i.markDirty();},handleSplitCell:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,f=JF(d,u,p),h={tableData:f},m=iy(e,f);m&&(h.rawXml=m),o.updateSelectedElement(h),i.markDirty();}}}function kce(){return {text:"",style:{}}}function Ice(t){let{selectedElement:e,tableEditorState:n,elementLookup:r,setTableEditorState:o,ops:i,history:s}=t;return {handleCommitCellEdit:(m,x,y,v)=>{let S=r.get(m);if(!S||S.type!=="table")return;let w={};if(S.tableData){let C=S.tableData.rows.map((T,E)=>E!==x?T:{...T,cells:T.cells.map((M,A)=>A!==y?M:{...M,text:v})});w.tableData={...S.tableData,rows:C};}if(S.rawXml){let C=KF(S,x,y,v);C&&(w.rawXml=C);}Object.keys(w).length!==0&&(i.updateElementById(m,w),s.markDirty(),o({rowIndex:x,columnIndex:y,elementId:m}));},handleUpdateCellTextStyle:m=>{if(!e||e.type!=="table"||!n)return;let x=e.id,{rowIndex:y,columnIndex:v}=n,S={};if(e.rawXml){let w=ZF(e,y,v,m);w&&(S.rawXml=w);}if(e.tableData){let w=e.tableData.rows.map((C,T)=>T!==y?C:{...C,cells:C.cells.map((E,M)=>M!==v?E:{...E,style:{...E.style,...m}})});S.tableData={...e.tableData,rows:w};}Object.keys(S).length!==0&&(i.updateElementById(x,S),s.markDirty());},handleResizeTableColumns:(m,x)=>{let y=r.get(m);!y||y.type!=="table"||!y.tableData||(i.updateElementById(m,{tableData:{...y.tableData,columnWidths:x}}),s.markDirty());},handleResizeTableRow:(m,x,y)=>{let v=r.get(m);if(!v||v.type!=="table"||!v.tableData)return;let S=v.tableData.rows.map((w,C)=>C===x?{...w,height:y}:w);i.updateElementById(m,{tableData:{...v.tableData,rows:S}}),s.markDirty();},handleInsertTableRow:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=n?.rowIndex??0,y=m==="above"?x:x+1,v=e.tableData,S=v.columnWidths.length,w=[];for(let R=0;R<S;R++){let k=false;for(let N=0;N<y;N++){let F=v.rows[N]?.cells[R];if(!F)continue;let B=Math.max(1,F.rowSpan??1);if(B>1&&N+B>y&&!F.vMerge&&!F.hMerge){k=true;break}}k?w.push({text:"",vMerge:true}):w.push(kce());}let T=[...v.rows.map((R,k)=>{if(k>=y)return R;let N=false,F=R.cells.map(B=>{let D=Math.max(1,B.rowSpan??1);return D>1&&k+D>y&&!B.vMerge&&!B.hMerge?(N=true,{...B,rowSpan:D+1}):B});return N?{...R,cells:F}:R})];T.splice(y,0,{cells:w,height:40});let E={...v,rows:T},M={tableData:E},A=sy(e,E);A&&(M.rawXml=A),i.updateSelectedElement(M),s.markDirty();},handleDeleteTableRow:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData;if(m.rows.length<=1)return;let x=n?.rowIndex??0;if(x<0||x>=m.rows.length)return;let y=m.rows[x],v=[...m.rows],S=(M,A,R)=>M.map((k,N)=>N===A?{...k,rowSpan:R}:k);for(let M=0;M<y.cells.length;M++){let A=y.cells[M];if(A.vMerge)for(let R=x-1;R>=0;R--){let k=v[R]?.cells[M];if(!k)break;if(!k.vMerge){let N=Math.max(1,k.rowSpan??1);N>1&&(v[R]={...v[R],cells:S(v[R].cells,M,N-1>1?N-1:void 0)});break}}else {let R=Math.max(1,A.rowSpan??1);if(R>1){let k=x+1;k<v.length&&(v[k]={...v[k],cells:v[k].cells.map((N,F)=>{if(F!==M)return N;let B=R-1;return {...N,text:A.text||N.text,style:N.style||A.style,rowSpan:B>1?B:void 0,vMerge:void 0,gridSpan:A.gridSpan}})});}}}let w=v.filter((M,A)=>A!==x),C={...m,rows:w},T={tableData:C},E=sy(e,C);E&&(T.rawXml=E),i.updateSelectedElement(T),s.markDirty();},handleInsertTableColumn:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=e.tableData,y=n?.columnIndex??0,v=m==="left"?y:y+1,S=[...x.columnWidths],w=v<S.length?v:S.length-1,T=(S[w]??1/S.length)/2;S[w]=T,S.splice(v,0,T);let E=S.reduce((B,D)=>B+D,0),M=E>0?S.map(B=>B/E):S,R=x.rows.map(B=>{let D=false;for(let H=0;H<v&&H<B.cells.length;H++){let j=B.cells[H];if(!j)continue;let Z=Math.max(1,j.gridSpan??1);if(Z>1&&H+Z>v&&!j.hMerge){D=true;break}}let O=[...B.cells],U=D?{text:"",hMerge:true}:kce();return O.splice(v,0,U),{...B,cells:O}}).map(B=>{let D=false,O=B.cells.map((U,H)=>{if(H>=v)return U;let j=Math.max(1,U.gridSpan??1);return j>1&&H+j>v&&!U.hMerge&&!U.vMerge?(D=true,{...U,gridSpan:j+1}):U});return D?{...B,cells:O}:B}),k={...x,rows:R,columnWidths:M},N={tableData:k},F=sy(e,k);F&&(N.rawXml=F),i.updateSelectedElement(N),s.markDirty();},handleDeleteTableColumn:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData;if(m.columnWidths.length<=1)return;let x=n?.columnIndex??0;if(x<0||x>=m.columnWidths.length)return;let y=m.rows.map(M=>{let A=[...M.cells],R=A[x];if(R)if(R.hMerge)for(let k=x-1;k>=0;k--){let N=A[k];if(!N)break;if(!N.hMerge){let F=Math.max(1,N.gridSpan??1);F>1&&(A[k]={...N,gridSpan:F-1>1?F-1:void 0});break}}else {let k=Math.max(1,R.gridSpan??1);if(k>1){let N=x+1;if(N<A.length){let F=A[N];A[N]={...F,text:R.text||F.text,style:F.style||R.style,gridSpan:k-1>1?k-1:void 0,hMerge:void 0,rowSpan:R.rowSpan};}}}return {...M,cells:A.filter((k,N)=>N!==x)}}),v=m.columnWidths.filter((M,A)=>A!==x),S=v.reduce((M,A)=>M+A,0),w=S>0?v.map(M=>M/S):v,C={...m,rows:y,columnWidths:w},T={tableData:C},E=sy(e,C);E&&(T.rawXml=E),i.updateSelectedElement(T),s.markDirty();}}}function Nce(t){let e=Ice(t),n=Rce(t);return {...e,...n}}function Bce(t){let{state:e,history:n,zoom:r,mode:o,canEdit:i,slides:s,activeSlide:a,activeSlideIndex:l,selectedElement:c,selectedElementId:d,selectedElementIds:u,canvasSize:p,dialogs:f,presentation:h,userName:m,handlerRef:x}=t,y=Cce({activeSlide:a,activeSlideIndex:l,selectedElement:c,selectedElementId:d,templateElementsBySlideId:e.templateElementsBySlideId,history:n,setSlides:e.setSlides,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setSelectedElementId:e.setSelectedElementId,setSelectedElementIds:e.setSelectedElementIds,setInlineEditingElementId:e.setInlineEditingElementId,setContextMenuState:e.setContextMenuState}),v=Ace({sections:e.sections,setSections:e.setSections,slides:s,setSlides:e.setSlides,markDirty:n.markDirty}),S=Tce({slides:s,mode:o,onSetActiveSlideIndex:e.setActiveSlideIndex,onSetSelectedElementId:e.setSelectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),w=gce({slides:s,canEdit:i,userName:m,selectedElementId:e.selectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),C=dce({mode:o,canEdit:i,canvasSize:p,selectedElementId:d,selectedElementIds:u,selectedElementIdSet:e.selectedElementIdSet,inlineEditingElementId:e.inlineEditingElementId,effectiveSelectedIds:e.effectiveSelectedIds,elementLookup:e.elementLookup,activeTool:e.activeTool,editTemplateMode:e.editTemplateMode,editorScale:r.editorScale,canvasStageRef:r.canvasStageRef,dragStateRef:e.dragStateRef,resizeStateRef:e.resizeStateRef,shapeAdjustmentDragStateRef:e.shapeAdjustmentDragStateRef,marqueeStateRef:e.marqueeStateRef,setInlineEditingElementId:e.setInlineEditingElementId,setInlineEditingText:e.setInlineEditingText,setContextMenuState:e.setContextMenuState,setMarqueeSelectionState:e.setMarqueeSelectionState,setSnapLines:e.setSnapLines,inlineEditingText:e.inlineEditingText,ops:y,history:n,presentationHandleAction:h.handlePresentationAction,setEditingEquationOmml:f.setEditingEquationOmml,setIsEquationDialogOpen:f.setIsEquationDialogOpen}),T=Ece({activeSlide:a,activeSlideIndex:l,canvasSize:p,newShapeType:e.newShapeType,selectedElements:e.selectedElements,ops:y,history:n}),E=wce({activeSlide:a,activeSlideIndex:l,selectedElement:c,effectiveSelectedIds:e.effectiveSelectedIds,selectedElements:e.selectedElements,selectedElementIdSet:e.selectedElementIdSet,elementLookup:e.elementLookup,editTemplateMode:e.editTemplateMode,clipboardPayload:e.clipboardPayload,setClipboardPayload:e.setClipboardPayload,setSelectedElementIds:e.setSelectedElementIds,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setIsInspectorPaneOpen:e.setIsInspectorPaneOpen,setSidebarPanelMode:e.setSidebarPanelMode,ops:y,history:n,onOpenHyperlinkDialog:()=>f.setIsHyperlinkDialogOpen(true)}),M=Pce({slides:s,activeSlideIndex:l,setActiveSlideIndex:e.setActiveSlideIndex,ops:y,history:n,handlerRef:x}),A=Nce({selectedElement:c,elementLookup:e.elementLookup,tableEditorState:e.tableEditorState,setTableEditorState:e.setTableEditorState,ops:y,history:n}),R=useCallback(H=>{if(c?.type==="table"&&e.tableEditorState){A.handleUpdateCellTextStyle(H);return}y.updateSelectedTextStyle(H);},[c,e.tableEditorState,A,y]),k=useMemo(()=>({...y,updateSelectedTextStyle:R}),[y,R]),N=useRef(null),F=useRef(false),{formatPainterActive:B,setFormatPainterActive:D,elementLookup:O}=e;useEffect(()=>{B&&!F.current&&c?N.current=OQ(c):B||(N.current=null),F.current=B;},[B,c]),useEffect(()=>{if(!B)return;let H=j=>{j.key==="Escape"&&D(false);};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[B,D]);let U=useMemo(()=>({...C,handleElementClick:(H,j)=>{if(B&&N.current){j.stopPropagation();let Z=O.get(H);if(Z){let J=UQ(Z,N.current),W={};mn(J)&&(W.shapeStyle=J.shapeStyle),ot(J)&&(W.textStyle=J.textStyle),y.updateElementById(H,W);}N.current=null,D(false),y.applySelection(H);return}C.handleElementClick(H,j);},handleCanvasMouseDown:H=>{if(B){D(false);return}C.handleCanvasMouseDown(H);}}),[C,y,B,D,O]);return {ops:k,sectionOps:v,findReplace:S,comments:w,canvasHandlers:U,insertHandlers:T,manipulation:E,slideOps:M,tableOps:A}}function kN(){}var YKe=2.5,qKe=14,KKe=.4,Uce=16,$ce=0;function ZKe(){return $ce+=1,`stroke-${$ce}`}function Hce(t){let{isActive:e,activeSlideIndex:n}=t,[r,o]=useState("none"),[i,s]=useState("#ff0000"),[a,l]=useState("#ffff00"),[c,d]=useState(null),[u,p]=useState(null),[f,h]=useState(false),m=useRef(new Map),[x,y]=useState([]),[v,S]=useState(0),w=useRef(false),C=useRef(n);C.current=n;let T=useRef(n);useEffect(()=>{e&&T.current!==n&&(y(j=>(j.length>0?m.current.set(T.current,j):m.current.delete(T.current),S(Z=>Z+1),m.current.get(n)??[])),T.current=n);},[e,n]);let E=useCallback(j=>{e&&o(Z=>Z===j?"none":j);},[e]),M=useCallback((j,Z)=>{if(e&&(r==="pen"||r==="highlighter")){w.current=true;let J=r==="pen";d({id:ZKe(),points:[{x:j,y:Z}],color:J?i:a,width:J?YKe:qKe,opacity:J?1:KKe});}},[e,r,i,a]),A=useCallback((j,Z)=>{!e||!w.current||d(J=>J?{...J,points:[...J.points,{x:j,y:Z}]}:null);},[e]),R=useCallback(()=>{w.current&&(w.current=false,d(j=>(j&&j.points.length>1&&y(Z=>{if(Z.some(W=>W.id===j.id))return Z;let J=[...Z,j];return m.current.set(C.current,J),S(W=>W+1),J}),null)));},[]),k=useCallback((j,Z)=>{!e||r!=="laser"||p({x:j,y:Z});},[e,r]),N=useCallback(()=>{p(null);},[]),F=useCallback((j,Z)=>{!e||r!=="eraser"||y(J=>{let W=J.filter(te=>!te.points.some(se=>{let Ce=se.x-j,ee=se.y-Z;return Ce*Ce+ee*ee<Uce*Uce}));return W.length>0?m.current.set(C.current,W):m.current.delete(C.current),S(te=>te+1),W});},[e,r]),B=useCallback(()=>{y([]),d(null),w.current=false,m.current.delete(C.current),S(j=>j+1);},[]),D=useCallback(()=>{y([]),d(null),w.current=false,m.current.clear(),S(j=>j+1);},[]),O=useRef(0);useEffect(()=>{if(!e){h(false),o("none"),d(null),p(null);return}let j=()=>{h(true),window.clearTimeout(O.current),O.current=window.setTimeout(()=>{h(false);},3e3);};return window.addEventListener("mousemove",j),()=>{window.removeEventListener("mousemove",j),window.clearTimeout(O.current);}},[e]);let U=useCallback(()=>{let j=new Map(m.current);return x.length>0&&j.set(n,x),j},[x,n]),H=v>=0&&(x.length>0||m.current.size>0);return {presentationTool:r,setPresentationTool:E,penColor:i,setPenColor:s,highlighterColor:a,setHighlighterColor:l,annotationStrokes:x,currentStroke:c,laserPosition:u,toolbarVisible:f,setToolbarVisible:h,handlePointerDown:M,handlePointerMove:A,handlePointerUp:R,handleLaserMove:k,handleLaserLeave:N,clearAnnotations:B,eraseAtPoint:F,allSlideAnnotations:U(),hasAnyAnnotations:H,clearAllAnnotations:D}}function zce(t){return !!t.loopContinuously||t.showType==="kiosk"}function Gce(t,e){return t.map((n,r)=>{let o=e[r];return typeof o!="number"?n:{...n,transition:{...n.transition,type:n.transition?.type??"none",advanceAfterMs:o}}})}function Vce(t,e){return Math.max(0,t||0)+e*60}function iS(t,e,n,r){for(let o of t.steps)o.stopSound?kN():o.soundPath&&e&&e(o.soundPath);n(o=>{let i=new Map(o);for(let s of t.steps){let a=i.get(s.elementId)??{visible:true},l=s.presetClass==="exit"?a.visible:true;i.set(s.elementId,{visible:l,cssAnimation:s.cssAnimation});}return i});for(let o of t.steps){let i=window.setTimeout(()=>{n(s=>{let a=new Map(s),l=a.get(o.elementId)??{visible:true},c=o.presetClass==="exit"?false:l.visible;return a.set(o.elementId,{visible:c,cssAnimation:void 0}),a});},Math.max(0,o.delayMs+o.durationMs+8));r.current.push(i);}}function Xce(t){let{slides:e,onPlayActionSound:n,showWithAnimation:r}=t,o=r!==false,[i,s]=useState([]),[a,l]=useState(new Map),[c,d]=useState(""),[u,p]=useState(new Set),[f,h]=useState(new Set),m=useRef([]),x=useRef(null),y=useCallback(()=>{m.current.forEach(A=>{window.clearTimeout(A);}),m.current=[];},[]),v=useCallback(A=>{if(!A.shouldAutoAdvance())return;let R=A.getAutoAdvanceDelay(),k=A.peekNext();if(!k)return;let N=R+(k.autoAdvanceDelayMs??0),F=window.setTimeout(()=>{let B=A.advance();B&&(iS(B,n,l,m),v(A));},Math.max(0,N));m.current.push(F);},[n]),S=useCallback(A=>{let R=e[A];if(!R){x.current=null,l(new Map),d(""),p(new Set),h(new Set);return}let k=R.nativeAnimations??[],N=new Map;for(let O of k)if(O.buildType&&O.buildType!=="allAtOnce"&&O.targetId){let U=R.elements.find(H=>H.id===O.targetId);U&&ot(U)&&U.textSegments&&U.textSegments.length>0&&N.set(O.targetId,hF(U.textSegments));}let F=N.size>0?mF(k,N):k,B=C1.fromAnimations(F);x.current=B,d(B.getTimeline().keyframesCss),p(B.getInteractiveTriggerShapeIds()),h(B.getHoverTriggerShapeIds());let D=R.elements.map(O=>O.id);for(let O of F)O.targetId&&O.targetId.includes(_l)&&D.push(O.targetId);l(B.getElementStates(D));},[e]),w=useCallback(()=>{if(!o)return false;let A=x.current;if(!A||!A.hasMoreSteps())return false;let R=A.advance();return R?(iS(R,n,l,m),v(A),true):false},[o,n,v]),C=useCallback(A=>{let R=x.current;if(!R||!R.hasInteractiveSequence(A))return false;let k=R.advanceInteractive(A);return k?(iS(k,n,l,m),true):false},[n]),T=useCallback(A=>{if(!o)return false;let R=x.current;if(!R||!R.hasHoverSequence(A))return false;R.resetHover(A);let k=R.advanceHover(A);return k?(iS(k,n,l,m),true):false},[o,n]),E=useCallback(A=>{let R=x.current;!R||!R.hasHoverSequence(A)||R.resetHover(A);},[]),M=useCallback(A=>{if(y(),!o){x.current=null,s([]),l(new Map),d(""),p(new Set),h(new Set);return}S(A);let R=e[A];if(!R){s([]);return}let k=x.current;if(k&&k.hasMoreSteps()){let F=k.peekNext();if(F&&F.autoAdvance){let B=window.setTimeout(()=>{let D=k.advance();D&&(iS(D,n,l,m),v(k));},F.autoAdvanceDelayMs??0);m.current.push(B);}}let N=[...R.animations||[]].filter(F=>!!F.entrance).sort((F,B)=>(F.order||Number.MAX_SAFE_INTEGER)-(B.order||Number.MAX_SAFE_INTEGER));if(N.length===0){s([]);return}s(N.map(F=>({elementId:F.elementId,state:"hidden",animation:F}))),N.forEach((F,B)=>{let D=Vce(F.delayMs,B),O=window.setTimeout(()=>{s(U=>U.map(H=>H.elementId===F.elementId?{...H,state:"visible"}:H));},D);m.current.push(O);});},[o,y,S,e,n,v]);return {presentationAnimations:i,presentationElementStates:a,presentationKeyframesCss:c,interactiveTriggerShapeIds:u,hoverTriggerShapeIds:f,clearPresentationTimers:y,playNextAnimationGroup:w,handleInteractiveShapeClick:C,handleHoverStart:T,handleHoverEnd:E,runPresentationEntranceAnimations:M,presentationTimersRef:m}}var JKe="pptx-viewer-audience";var sS="content",Wce="pptx-bytes";function Yce(){return new Promise((t,e)=>{let n=indexedDB.open(JKe,1);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(sS)||r.createObjectStore(sS);},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function qce(t){let e=await Yce();return new Promise((n,r)=>{let o=e.transaction(sS,"readwrite"),i=o.objectStore(sS),a={bytes:t instanceof Uint8Array?t:new Uint8Array(t),createdAt:Date.now()};i.put(a,Wce),o.oncomplete=()=>{e.close(),n();},o.onerror=()=>{e.close(),r(o.error);};})}async function _M(){try{let t=await Yce();return new Promise(e=>{let n=t.transaction(sS,"readwrite");n.objectStore(sS).delete(Wce),n.oncomplete=()=>{t.close(),e();},n.onerror=()=>{t.close(),e();};})}catch{}}var KH="pptx-viewer-presenter",DN="#pptx-audience",LN="pptx-viewer-presenter",Kce="nonce";function QKe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function Zce(){let t=window.location.hash;if(!t.startsWith(DN))return null;let e=t.slice(DN.length);return e?new URLSearchParams(e.replace(/^[&;?]/,"")).get(Kce):null}function ZH(){return window.location.hash.startsWith(DN)}function Jce(t){let{currentSlideIndex:e,isPresenterMode:n,content:r}=t,o=useRef(null),i=useRef(null),s=useRef(null),a=useRef(""),l=useCallback(()=>(i.current||(i.current=new BroadcastChannel(KH)),i.current),[]),c=useCallback(()=>o.current!==null&&!o.current.closed,[]),d=useCallback(f=>{if(!a.current)return;let h={origin:LN,type:"presenter-slide-change",slideIndex:f,sessionId:a.current};try{l().postMessage(h);}catch{}},[l]),u=useCallback(()=>{if(a.current)try{let h={origin:LN,type:"presenter-exit",sessionId:a.current};l().postMessage(h);}catch{}let f=o.current;if(f&&!f.closed)try{f.close();}catch{}o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null),_M();},[l]),p=useCallback(()=>{c()&&u();let f=window.open("about:blank","_blank");if(!f)return false;o.current=f;let h=QKe();a.current=h;let m=new URL(window.location.href),x=new URLSearchParams;x.set(Kce,h),m.hash=`${DN}&${x.toString()}`;let y=v=>{let S=o.current;if(!(!S||S.closed)){if(!v){try{S.close();}catch{}o.current=null,a.current="";return}try{S.location.replace(m.toString());}catch{try{S.close();}catch{}o.current=null,a.current="";}}};return r?qce(r).then(()=>y(true)).catch(()=>y(false)):y(true),window.setTimeout(()=>d(e),1500),s.current=setInterval(()=>{let v=o.current;(!v||v.closed)&&(o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null));},1e3),true},[c,u,d,e,r]);return useEffect(()=>{n&&c()&&d(e);},[e,n,c,d]),useEffect(()=>()=>{u();try{i.current?.close();}catch{}},[u]),useEffect(()=>{n||u();},[n,u]),useEffect(()=>{let f=()=>{_M();};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[]),{openAudienceWindow:p,closeAudienceWindow:u,isAudienceWindowOpen:c,syncSlideToAudience:d}}function ede(t){let{onSetMode:n,onSetActiveSlideIndex:r,containerRef:o}=t,i=useRef(false);useEffect(()=>{if(!ZH()||i.current)return;i.current=true;let s=window.setTimeout(()=>{try{let a=o.current;a&&typeof a.requestFullscreen=="function"&&a.requestFullscreen().catch(()=>{});}catch{}n("present");},800);return ()=>window.clearTimeout(s)},[o,n]),useEffect(()=>{if(!ZH())return;let s=Zce(),a;try{a=new BroadcastChannel(KH);}catch{return}return a.onmessage=l=>{let c=l.data;if(!(!c||c.origin!==LN)&&!(s&&c.sessionId!==s)&&(c.type==="presenter-slide-change"&&r(c.slideIndex),c.type==="presenter-exit")){_M(),n("edit");try{window.close();}catch{}}},()=>{try{a.close();}catch{}}},[n,r]);}function tde(t,e){return t==="Escape"?{action:"exit"}:t==="ArrowRight"||t==="PageDown"||t===" "?{action:"next"}:t==="ArrowLeft"||t==="PageUp"?{action:"prev"}:t==="l"||t==="L"?{action:"toggleLaser"}:t==="p"||t==="P"?{action:"togglePen"}:t==="e"||t==="E"?{action:"toggleEraser"}:t==="m"&&e?{action:"toggleToolbar"}:t==="n"||t==="N"?{action:"togglePresenterView"}:{action:"none"}}function nde(t){let{mode:e,movePresentationSlide:n,onSetMode:r,onToggleLaser:o,onTogglePen:i,onToggleEraser:s,onToggleToolbar:a,onTogglePresenterView:l,rehearsing:c,recordCurrentSlideTime:d,presentationSlideIndex:u,setShowRehearsalSummary:p}=t;useEffect(()=>{if(e!=="present")return;let f=h=>{let m=tde(h.key,h.ctrlKey);if(m.action!=="none")switch(h.preventDefault(),m.action){case "exit":c&&(d(u),p(true)),r("edit");return;case "next":n(1);return;case "prev":n(-1);return;case "toggleLaser":o?.();return;case "togglePen":i?.();return;case "toggleEraser":s?.();return;case "toggleToolbar":a?.();return;case "togglePresenterView":l?.();break}};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[e,n,r,o,i,s,a,l,c,d,u,p]);}function ode(t){let{containerRef:e,onSetMode:n,onSaveRehearsalTimings:r,setPresentationStartTime:o,setPresenterMode:i}=t,[s,a]=useState(false),[l,c]=useState({}),[d,u]=useState(null),[p,f]=useState(false),[h,m]=useState(false),x=useRef(0),y=useRef(null),v=useCallback(E=>{if(d===null)return;let M=x.current;y.current!==null&&(M+=Date.now()-y.current);let A=Date.now()-d-M;c(R=>({...R,[E]:Math.max(0,A)})),x.current=0,y.current=h?Date.now():null,u(Date.now());},[d,h]),S=useCallback(()=>{f(false),a(false),c({});},[]),w=useCallback(()=>{r?.(l),f(false),a(false);},[r,l]),C=useCallback(()=>{i(false),a(true),c({}),m(false),f(false),x.current=0,y.current=null;let E=Date.now();o(E),u(E);try{let M=e.current;M&&typeof M.requestFullscreen=="function"&&M.requestFullscreen().catch(()=>{});}catch{}n("present");},[e,n,o,i]),T=useCallback(()=>{m(E=>(E?y.current!==null&&(x.current+=Date.now()-y.current,y.current=null):y.current=Date.now(),!E));},[]);return {rehearsing:s,setRehearsing:a,recordedTimings:l,slideStartTime:d,showRehearsalSummary:p,setShowRehearsalSummary:f,rehearsalPaused:h,recordCurrentSlideTime:v,dismissRehearsalSummary:S,saveRehearsalTimings:w,enterRehearsalMode:C,toggleRehearsalPause:T}}function ide(t,e){let n=t.action||"";if(t.soundPath&&e.onPlayActionSound&&e.onPlayActionSound(t.soundPath),typeof t.targetSlideIndex=="number"){let r=Math.max(0,Math.min(e.slidesLength-1,Math.floor(t.targetSlideIndex)));e.slidesLength>0&&e.navigateToSlide(r);return}if(n.includes("hlinkshowjump")){let r=n.toLowerCase();r.includes("nextslide")?e.movePresentationSlide(1):r.includes("previousslide")?e.movePresentationSlide(-1):r.includes("firstslide")?e.navigateToSlide(0):r.includes("lastslide")?e.navigateToSlide(e.slidesLength-1):r.includes("endshow")&&e.onSetMode("edit");return}n.includes("hlinksldjump")||t.url&&!n.includes("hlinksldjump")&&Wb(t.url)&&window.open(t.url,"_blank","noopener,noreferrer");}function JH(t,e){let n=e.slides[e.currentSlideIndex];n?.transition?.soundPath&&e.onPlayActionSound&&e.onPlayActionSound(n.transition.soundPath);let r=Math.max(120,n?.transition?.durationMs||320);e.setPresentationSlideVisible(false),e.clearPresentationTimers();let o=window.setTimeout(()=>{e.setPresentationSlideIndex(t),e.onSetActiveSlideIndex(t),e.setPresentationSlideVisible(true),e.runPresentationEntranceAnimations(t),e.scheduleAutoAdvanceForSlide?.(t);},Math.min(r,480));e.presentationTimersRef.current.push(o);}function sde(t){let{slides:e,visibleSlideIndexes:n,presentationSlideIndex:r,setPresentationSlideIndex:o,setPresentationSlideVisible:i,onSetMode:s,onSetActiveSlideIndex:a,onPlayActionSound:l,loopContinuously:c,useTimings:d,playNextAnimationGroup:u,clearPresentationTimers:p,runPresentationEntranceAnimations:f,presentationTimersRef:h,rehearsing:m,recordCurrentSlideTime:x,setShowRehearsalSummary:y}=t,v=useRef(()=>{}),S=useCallback(E=>{if(d===false)return;let A=e[E]?.transition?.advanceAfterMs;if(typeof A!="number"||!Number.isFinite(A)||A<0)return;let R=window.setTimeout(()=>{v.current(1);},Math.max(0,A));h.current.push(R);},[e,h,d]),w=useCallback(E=>{if(E===1&&u())return;let M=n.length>0?n:e.map((B,D)=>D);if(M.length===0)return;let A=M.indexOf(r),k=(A>=0?A:0)+E;if(m&&E===1&&k>=M.length){x(r);try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}s("edit"),y(true);return}let N;c&&!m&&E===1&&k>=M.length?N=0:N=Math.min(M.length-1,Math.max(0,k));let F=M[N];F===void 0||F===r||(m&&E===1&&x(r),JH(F,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:f,scheduleAutoAdvanceForSlide:m?void 0:S,presentationTimersRef:h}));},[p,c,l,a,s,u,r,h,x,m,f,S,y,e,n,i,o]);v.current=w;let C=useCallback(E=>{E<0||E>=e.length||E!==r&&JH(E,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:f,scheduleAutoAdvanceForSlide:S,presentationTimersRef:h});},[p,l,a,r,h,f,S,e,o,i]),T=useCallback(E=>{ide(E,{movePresentationSlide:w,navigateToSlide:C,onPlayActionSound:l,onSetMode:s,slidesLength:e.length});},[w,C,l,s,e.length]);return {movePresentationSlide:w,navigateToSlide:C,handlePresentationAction:T,scheduleAutoAdvanceForSlide:S}}function ade(t){let{navigateToSlide:e}=t,n=useRef(null),r=useCallback((s,a)=>{n.current=a,e(s);},[e]),o=useCallback(()=>{let s=n.current;return s===null?false:(n.current=null,e(s),true)},[e]),i=useCallback(()=>{n.current=null;},[]);return {handleZoomClick:r,zoomReturnSlideIndex:n,returnToZoomSlide:o,clearZoomReturn:i}}function lde(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:f,onSaveRehearsalTimings:h,loopContinuously:m,showWithAnimation:x,useTimings:y}=t,[v,S]=useState(0),[w,C]=useState(true),[T,E]=useState(false),[M,A]=useState(null),R=useRef(false),{presentationAnimations:k,presentationElementStates:N,presentationKeyframesCss:F,interactiveTriggerShapeIds:B,hoverTriggerShapeIds:D,clearPresentationTimers:O,playNextAnimationGroup:U,handleInteractiveShapeClick:H,handleHoverStart:j,handleHoverEnd:Z,runPresentationEntranceAnimations:J,presentationTimersRef:W}=Xce({slides:n,onPlayActionSound:c,showWithAnimation:x}),{rehearsing:te,setRehearsing:se,recordedTimings:Ce,slideStartTime:ee,showRehearsalSummary:ce,setShowRehearsalSummary:de,rehearsalPaused:Ne,recordCurrentSlideTime:Ue,dismissRehearsalSummary:he,saveRehearsalTimings:Be,enterRehearsalMode:Me,toggleRehearsalPause:ge}=ode({containerRef:i,onSetMode:a,onSaveRehearsalTimings:h,setPresentationStartTime:A,setPresenterMode:E}),{movePresentationSlide:Te,navigateToSlide:be,handlePresentationAction:xe,scheduleAutoAdvanceForSlide:Pe}=sde({slides:n,visibleSlideIndexes:r,presentationSlideIndex:v,setPresentationSlideIndex:S,setPresentationSlideVisible:C,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,loopContinuously:m,useTimings:y,playNextAnimationGroup:U,clearPresentationTimers:O,runPresentationEntranceAnimations:J,presentationTimersRef:W,rehearsing:te,recordCurrentSlideTime:Ue,setShowRehearsalSummary:de}),{handleZoomClick:Xe,zoomReturnSlideIndex:Y,returnToZoomSlide:Ge,clearZoomReturn:Ve}=ade({navigateToSlide:be}),{openAudienceWindow:We,closeAudienceWindow:ke,isAudienceWindowOpen:wt,syncSlideToAudience:V}=Jce({currentSlideIndex:v,isPresenterMode:T,content:s});ede({onSetMode:a,onSetActiveSlideIndex:l,containerRef:i});let $=useCallback(()=>{E(false),se(false),A(Date.now());try{let ae=i.current;ae&&typeof ae.requestFullscreen=="function"&&ae.requestFullscreen().catch(()=>{});}catch{}a("present");},[i,a,se]),ie=useCallback(()=>{E(true),se(false),A(Date.now()),a("present");},[a,se]),ve=useCallback(()=>{if(T){E(false);try{let ae=i.current;ae&&typeof ae.requestFullscreen=="function"&&ae.requestFullscreen().catch(()=>{});}catch{}}else {R.current=true;try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}E(true),M||A(Date.now());}},[T,M,i]);nde({mode:e,movePresentationSlide:Te,onSetMode:a,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:f,onTogglePresenterView:ve,rehearsing:te,recordCurrentSlideTime:Ue,presentationSlideIndex:v,setShowRehearsalSummary:de});let De=useRef(J);De.current=J;let $e=useRef(Pe);$e.current=Pe;let ze=useRef(o);return ze.current=o,useEffect(()=>{if(e==="present"){let ae=ze.current;S(ae),De.current(ae),$e.current(ae);}},[e]),useEffect(()=>{if(e==="present")return ()=>{try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}}},[e]),useEffect(()=>{if(e!=="present"||T)return;let ae=!!document.fullscreenElement,Se=()=>{if(R.current){R.current=false,ae=!!document.fullscreenElement;return}let Ye=!!document.fullscreenElement;ae&&!Ye&&(te&&(Ue(v),de(true)),a("edit")),ae=Ye;};return document.addEventListener("fullscreenchange",Se),()=>{document.removeEventListener("fullscreenchange",Se);}},[e,a,T,te,Ue,v,de]),useEffect(()=>{let ae=W;return ()=>{ae.current.forEach(Se=>{window.clearTimeout(Se);});}},[W]),{presentationSlideIndex:v,setPresentationSlideIndex:S,presentationSlideVisible:w,presentationAnimations:k,presentationElementStates:N,presentationKeyframesCss:F,clearPresentationTimers:O,runPresentationEntranceAnimations:J,movePresentationSlide:Te,navigateToSlide:be,handlePresentationAction:xe,handleInteractiveShapeClick:H,interactiveTriggerShapeIds:B,hoverTriggerShapeIds:D,handleHoverStart:j,handleHoverEnd:Z,enterPresentMode:$,presenterMode:T,enterPresenterView:ie,togglePresenterView:ve,presentationStartTime:M,rehearsing:te,enterRehearsalMode:Me,recordedTimings:Ce,slideStartTime:ee,showRehearsalSummary:ce,dismissRehearsalSummary:he,saveRehearsalTimings:Be,rehearsalPaused:Ne,toggleRehearsalPause:ge,handleZoomClick:Xe,zoomReturnSlideIndex:Y,returnToZoomSlide:Ge,clearZoomReturn:Ve,openAudienceWindow:We,closeAudienceWindow:ke,isAudienceWindowOpen:wt,syncSlideToAudience:V}}function dde(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,mediaDataUrls:a,presentationProperties:l,setMode:c,setActiveSlideIndex:d,setSlides:u,history:p}=t,f=useRef(null),[,h]=useState(false),m=useRef("edit"),x=Hce({isActive:e==="present",activeSlideIndex:o});return {presentation:lde({mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:v=>{e==="present"&&v!=="present"&&x.hasAnyAnnotations?(m.current=v,h(true)):(e==="present"&&v!=="present"&&(Gb(),kN()),c(v));},onSetActiveSlideIndex:d,onPlayActionSound:v=>{(async()=>{if(!v)return;let S=a.get(v);if(S){try{new Audio(S).play().catch(()=>{});}catch{}return}let w=f.current;if(w)try{let C=await w.getImageData(v);if(!C)return;a.set(v,C),new Audio(C).play().catch(()=>{});}catch{}})();},onToggleLaser:()=>x.setPresentationTool("laser"),onTogglePen:()=>x.setPresentationTool("pen"),onToggleEraser:()=>x.setPresentationTool("eraser"),onToggleToolbar:()=>x.setToolbarVisible(!x.toolbarVisible),onSaveRehearsalTimings:v=>{u(S=>Gce(S,v)),p.markDirty();},loopContinuously:zce(l),showWithAnimation:l.showWithAnimation,useTimings:l.advanceMode!=="manual"}),annotations:x,actionSoundHandlerRef:f}}function cZe(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function dZe(){return false}function uZe(t){if(typeof window>"u")return ()=>{};let e=window.matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function ude(){let t=useSyncExternalStore(uZe,cZe,dZe),[e,n]=useState(false),r=t||e,o=useCallback(()=>{n(i=>!i);},[]);return useEffect(()=>{let i=document.documentElement;return r?i.classList.add("pptx-reduced-motion"):i.classList.remove("pptx-reduced-motion"),()=>{i.classList.remove("pptx-reduced-motion");}},[r]),{osReducedMotion:t,manualReducedMotion:e,reducedMotion:r,toggleReducedMotion:o,setManualReducedMotion:n}}var pZe=120,fZe=400,hZe=180,mZe=220,gZe=480,xZe=288,yZe=60,bZe=400,vZe=120;function pde(){let[t,e]=useState(hZe),[n,r]=useState(xZe),[o,i]=useState(vZe),s=useCallback(c=>{e(d=>Math.min(fZe,Math.max(pZe,d+c)));},[]),a=useCallback(c=>{r(d=>Math.min(gZe,Math.max(mZe,d-c)));},[]),l=useCallback(c=>{i(d=>Math.min(bZe,Math.max(yZe,d-c)));},[]);return {leftWidth:t,rightWidth:n,bottomHeight:o,onResizeLeft:s,onResizeRight:a,onResizeBottom:l}}var CZe=50,TZe=100,MZe=500,fde=10;function hde(t,e){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function _Ze(t){return Math.min(Math.max(t,.2),5)}function mde(t){let{targetRef:e,currentScale:n,callbacks:r,enabled:o=true}=t,i=useRef(r);i.current=r;let s=useRef(n);s.current=n;let[a,l]=useState(0),c=useRef(null);e.current!==c.current&&(c.current=e.current,queueMicrotask(()=>l(d=>d+1))),useEffect(()=>{let d=e.current;if(!d||!o)return;let u=0,p=1,f=false,h=0,m=0,x=null,y=0,v=0,S=()=>{x!==null&&(clearTimeout(x),x=null);},w=M=>{M.touches.length===2?(f=true,u=hde(M.touches[0],M.touches[1]),p=s.current,S(),M.preventDefault()):M.touches.length===1&&(h=M.touches[0].clientX,m=M.touches[0].clientY,y=M.touches[0].clientX,v=M.touches[0].clientY,S(),x=setTimeout(()=>{x=null,i.current.onLongPress?.(y,v);},MZe));},C=M=>{if(M.touches.length===2&&f){M.preventDefault();let A=hde(M.touches[0],M.touches[1]);if(u>0){let R=A/u,k=_Ze(p*R);i.current.onPinchZoom?.(k);}}else if(M.touches.length===1){let A=M.touches[0].clientX-y,R=M.touches[0].clientY-v;(Math.abs(A)>fde||Math.abs(R)>fde)&&S();}},T=M=>{if(f){f=false,u=0;return}if(S(),M.changedTouches.length===1&&M.touches.length===0){let A=M.changedTouches[0].clientX,R=M.changedTouches[0].clientY,k=A-h,N=R-m;Math.abs(k)>=CZe&&Math.abs(N)<TZe&&i.current.onSwipe?.(k>0?1:-1);}},E=()=>{f=false,u=0,S();};return d.addEventListener("touchstart",w,{passive:false}),d.addEventListener("touchmove",C,{passive:false}),d.addEventListener("touchend",T,{passive:true}),d.addEventListener("touchcancel",E,{passive:true}),()=>{d.removeEventListener("touchstart",w),d.removeEventListener("touchmove",C),d.removeEventListener("touchend",T),d.removeEventListener("touchcancel",E),S();}},[e,o,a]);}function RM(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function oz(t,e){try{return window.prompt(t,e)}catch{return null}}function gde(t){try{return window.confirm(t)}catch{return false}}function EZe(t){if(typeof t!="string"||t.trim().length===0)return "presentation.pptx";let e=t.replace(/[\x00-\x1f\x7f"\\/:*?<>|]/g,"_").replace(/\.\./g,"__").replace(/^\.+/,"").trim();if(e.length===0)return "presentation.pptx";if(e.length>200){let n=e.lastIndexOf(".");if(n>0&&e.length-n<=16){let r=e.slice(n);e=e.slice(0,200-r.length)+r;}else e=e.slice(0,200);}return e}function $N(t,e){let n=EZe(e),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n,document.body.appendChild(o),o.click(),setTimeout(()=>{document.body.removeChild(o),URL.revokeObjectURL(r);},200);}function xde(t){let{activeSlide:e,customShows:n,activeCustomShowId:r,setCustomShows:o,setActiveCustomShowId:i,history:s}=t,a=()=>{let f=oz("Custom show name","Custom Show")?.trim()||`Custom Show ${n.length+1}`,h=`custShow-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,m=e?.rId&&e.rId.length>0?[e.rId]:[];o(x=>[...x,{id:h,name:f,slideRIds:m}]),i(h),s.markDirty();},l=()=>{if(!r)return;let p=n.find(h=>h.id===r);if(!p)return;let f=oz("Rename custom show",p.name)?.trim();f&&(o(h=>h.map(m=>m.id===p.id?{...m,name:f}:m)),s.markDirty());},c=()=>{let p=r;if(!p)return;let f=n.find(h=>h.id===p);f&&gde(`Delete custom show "${f.name}"?`)&&(o(h=>h.filter(m=>m.id!==p)),i(null),s.markDirty());},d=()=>{let p=r,f=e?.rId;!p||!f||(o(h=>h.map(m=>{if(m.id!==p)return m;let x=m.slideRIds.includes(f);return {...m,slideRIds:x?m.slideRIds.filter(y=>y!==f):[...m.slideRIds,f]}})),s.markDirty());},u=useMemo(()=>{if(!r||!e?.rId)return false;let p=n.find(f=>f.id===r);return p?p.slideRIds.includes(e.rId):false},[r,e?.rId,n]);return {handleCreateCustomShow:a,handleRenameActiveCustomShow:l,handleDeleteActiveCustomShow:c,handleToggleCurrentSlideInActiveShow:d,isCurrentSlideInActiveShow:u}}function bde(t){let{mode:e,slides:n,activeSlide:r,canvasSize:o,containerRef:i,customShows:s,activeCustomShowId:a,setCustomShows:l,setActiveCustomShowId:c,setGuides:d,setPresentationProperties:u,setAccessibilityIssues:p,setIsAccessibilityPanelOpen:f,setMode:h,setPreMasterMode:m,setActiveMasterIndex:x,setActiveLayoutIndex:y,setSelectedElementId:v,setSelectedElementIds:S,preMasterMode:w,hasDigitalSignatures:C,isDirty:T,history:E}=t,[M,A]=useState(false),[R,k]=useState(false),[N,F]=useState(false),[B,D]=useState(false),[O,U]=useState(false),[H,j]=useState(false),[Z,J]=useState(false),[W,te]=useState(false),se=useRef(false),[Ce,ee]=useState(false),[ce,de]=useState(false),[Ne,Ue]=useState(false),[he,Be]=useState(null),[Me,ge]=useState(false),[Te,be]=useState(()=>typeof window<"u"?window.innerWidth<768:false);useEffect(()=>{let ie=()=>be(window.innerWidth<768),ve=null,De=0,$e=()=>{let ze=i.current;if(!ze){De=requestAnimationFrame($e);return}ve=new ResizeObserver(ae=>{let Se=ae[0];Se&&be(Se.contentRect.width<768);}),ve.observe(ze),be(ze.clientWidth<768);};return $e(),window.addEventListener("resize",ie),()=>{cancelAnimationFrame(De),ve?.disconnect(),window.removeEventListener("resize",ie);}},[]),useEffect(()=>{T&&C&&!se.current&&te(true);},[T,C]);let xe=useCallback(()=>{m(e==="master"?"edit":e),h("master"),x(0),y(null),v(null),S([]);},[e,m,h,x,y,v,S]),Pe=useCallback(()=>{h(w),v(null),S([]);},[w,h,v,S]),Xe=useCallback(ie=>{x(ie),y(null),v(null),S([]);},[x,y,v,S]),Y=useCallback((ie,ve)=>{x(ie),y(ve),v(null),S([]);},[x,y,v,S]),Ge=ie=>{let ve=ie==="h"?o.height/2:o.width/2;d(De=>[...De,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:ie,position:ve}]);},Ve=xde({activeSlide:r,customShows:s,activeCustomShowId:a,setCustomShows:l,setActiveCustomShowId:c,history:E}),We=useCallback(ie=>{u(ie),E.markDirty();},[u,E]),ke=useCallback(()=>{u(ie=>({...ie,showSubtitles:!ie.showSubtitles})),E.markDirty();},[u,E]),wt=useCallback(ie=>{Ue(true);},[]),V=useCallback(()=>{Ue(false);},[]);return {isSmartArtDialogOpen:M,setIsSmartArtDialogOpen:A,isEquationDialogOpen:R,setIsEquationDialogOpen:k,isHyperlinkDialogOpen:N,setIsHyperlinkDialogOpen:F,isPasswordDialogOpen:B,setIsPasswordDialogOpen:D,isDocPropsDialogOpen:O,setIsDocPropsDialogOpen:U,isFontEmbeddingOpen:H,setIsFontEmbeddingOpen:j,isDigitalSigDialogOpen:Z,setIsDigitalSigDialogOpen:J,isSignatureStrippedDialogOpen:W,setIsSignatureStrippedDialogOpen:te,isSetUpSlideShowOpen:Ce,setIsSetUpSlideShowOpen:ee,isBroadcastDialogOpen:ce,setIsBroadcastDialogOpen:de,isPasswordProtected:Ne,editingEquationOmml:he,setEditingEquationOmml:Be,embedFontsEnabled:Me,setEmbedFontsEnabled:ge,isNarrowViewport:Te,handleEnterMasterView:xe,handleCloseMasterView:Pe,handleSelectMaster:Xe,handleSelectLayout:Y,handleAddGuide:Ge,...Ve,handleSaveSlideShowSettings:We,handleToggleSubtitles:ke,handleSetPassword:wt,handleRemovePassword:V,handleRunAccessibilityCheck:()=>{let ie=[];n.forEach((ve,De)=>{for(let $e of ve.elements)($e.type==="image"||$e.type==="picture")&&!("altText"in $e&&$e.altText)&&ie.push({slideIndex:De,elementId:$e.id,severity:"warning",message:"Image missing alt text"});}),ie.length>0&&console.info(`[Accessibility] Found ${ie.length} issue(s):`,ie),p(ie),f(true);}}}function vde(t){let{mode:e,presentation:n,annotations:r,history:o,setMode:i,setSlides:s}=t,[a,l]=useState(false),c=useRef("edit"),d=useCallback(m=>{m==="present"?n.enterPresentMode():e==="present"&&r.hasAnyAnnotations?(Gb(),c.current=m,l(true)):(e==="present"&&Gb(),i(m));},[n,e,r.hasAnyAnnotations,i]),u=useCallback(()=>{let m=r.allSlideAnnotations;if(m.size===0){l(false),i(c.current),r.clearAllAnnotations();return}s(x=>x.map((y,v)=>{let S=m.get(v);if(!S||S.length===0)return y;let w=S.map(C=>{let T=1/0,E=1/0,M=-1/0,A=-1/0;for(let B of C.points)B.x<T&&(T=B.x),B.y<E&&(E=B.y),B.x>M&&(M=B.x),B.y>A&&(A=B.y);let R=Math.max(M-T,1),k=Math.max(A-E,1),N=[];for(let B=0;B<C.points.length;B++){let D=C.points[B],O=D.x-T,U=D.y-E;N.push(B===0?`M ${O} ${U}`:`L ${O} ${U}`);}let F=C.opacity<1?"highlighter":"pen";return {id:`ink-annotation-${C.id}`,type:"ink",x:T,y:E,width:R,height:k,inkPaths:[N.join(" ")],inkColors:[C.color],inkWidths:[C.width],inkOpacities:[C.opacity],inkTool:F}});return {...y,elements:[...y.elements,...w]}})),o.markDirty(),r.clearAllAnnotations(),l(false),i(c.current);},[r,i,s,o]),p=useCallback(()=>{r.clearAllAnnotations(),l(false),i(c.current);},[r,i]),f=useCallback(()=>{n.enterPresenterView();},[n]),h=useCallback(()=>{n.enterRehearsalMode();},[n]);return {showKeepAnnotationsDialog:a,handleSetMode:d,handleKeepAnnotations:u,handleDiscardAnnotations:p,handleEnterPresenterView:f,handleEnterRehearsalMode:h}}function Sde(t){return Math.max(t,10)*1e3}var LZe="pptx-viewer-autosave",FZe=1,cS="recoveryVersions";function Cde(){return new Promise((t,e)=>{let n=indexedDB.open(LZe,FZe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(cS)||r.createObjectStore(cS,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function BZe(){let t=await Cde();return new Promise(e=>{try{let n=t.transaction(cS,"readwrite"),r=n.objectStore(cS),o=null,i=1/0,s=r.openCursor();s.onsuccess=()=>{let a=s.result;if(a){let l=a.value;typeof l.timestamp=="number"&&l.timestamp<i&&(i=l.timestamp,o=a.primaryKey),a.continue();}else o!==null&&r.delete(o);},n.oncomplete=()=>{t.close(),e(o!==null);},n.onerror=()=>{t.close(),e(!1);};}catch{try{t.close();}catch{}e(false);}})}function wde(t,e){return Cde().then(n=>new Promise((r,o)=>{let i=n.transaction(cS,"readwrite");i.objectStore(cS).put({key:t,data:e,timestamp:Date.now(),size:e.byteLength}),i.oncomplete=()=>{n.close(),r(true);},i.onerror=()=>{n.close(),o(i.error);};}))}async function OZe(t,e){try{return await wde(t,e)}catch(n){if((n instanceof Error||n instanceof DOMException?n.name:"")!=="QuotaExceededError"||!await BZe())throw n;return wde(t,e)}}function Tde(t){let{isDirty:e,filePath:n,serializeSlides:r,intervalSeconds:o=120,enabled:i=true}=t,[s,a]=useState({state:"idle"}),l=useRef(e),c=useRef(n),d=useRef(r),u=useRef(false);useEffect(()=>{l.current=e;},[e]),useEffect(()=>{c.current=n;},[n]),useEffect(()=>{d.current=r;},[r]);let p=useCallback(async()=>{if(c.current&&l.current&&!u.current){u.current=true,a({state:"saving"});try{let f=await d.current();if(!f){a({state:"idle"}),u.current=!1;return}await OZe(c.current,f),a({state:"saved",timestamp:Date.now()});}catch(f){a({state:"error",message:f instanceof Error?f.message:"Autosave failed"});}finally{u.current=false;}}},[]);return useEffect(()=>{if(!i||!n)return;let f=Sde(o),h=setInterval(()=>{p();},f);return ()=>clearInterval(h)},[i,n,o,p]),{autosaveStatus:s,triggerAutosave:p}}var Mde={"Atkinson Hyperlegible":"Atkinson+Hyperlegible:wght@400;700",Roboto:"Roboto:wght@400;700","Open Sans":"Open+Sans:wght@400;700",Lato:"Lato:wght@400;700",Montserrat:"Montserrat:wght@400;700",Poppins:"Poppins:wght@400;700",Raleway:"Raleway:wght@400;700",Nunito:"Nunito:wght@400;700","Playfair Display":"Playfair+Display:wght@400;700","Source Sans Pro":"Source+Sans+Pro:wght@400;700","PT Sans":"PT+Sans:wght@400;700",Merriweather:"Merriweather:wght@400;700",Ubuntu:"Ubuntu:wght@400;700",Oswald:"Oswald:wght@400;700","Noto Sans":"Noto+Sans:wght@400;700","Fira Sans":"Fira+Sans:wght@400;700",Inter:"Inter:wght@400;700","Work Sans":"Work+Sans:wght@400;700",Quicksand:"Quicksand:wght@400;700",Cabin:"Cabin:wght@400;700"},_de="pptx-embedded-fonts",Ede="pptx-google-fonts",Ade="pptx-symbol-font-fallback",$Ze=["Wingdings","Wingdings 2","Wingdings 3","Symbol","Webdings"];function HZe(t){let e=new Set;for(let n of t)for(let r of n.elements)if(ot(r)&&r.textSegments)for(let o of r.textSegments)o.style.fontFamily&&e.add(o.style.fontFamily);return e}var Pde=/["\\\n\r;}<>]/,zZe=new Set(["truetype","opentype","woff","woff2","svg","embedded-opentype"]),GZe=/^data:font\/[a-z0-9+.-]+(?:;charset=[a-z0-9-]+)?;base64,[A-Za-z0-9+/=]+$/i;function VZe(t){return typeof t!="string"||t.length===0?false:t.startsWith("blob:")?true:GZe.test(t)}function Rde({embeddedFonts:t,slides:e}){useEffect(()=>{if(!t.length)return;let r=document.createElement("style");r.id=_de;let o=t.flatMap(i=>{if(typeof i.name!="string"||i.name.length===0||Pde.test(i.name))return [];if(!VZe(i.dataUrl))return [];let s=i.format??"truetype";if(!zZe.has(s))return [];let a=i.bold?"700":"400",l=i.italic?"italic":"normal";return [`@font-face {
|
|
4678
|
+
`,style:m,isParagraphBreak:true});}let p=o[u]??d??[],f=l(i[u],p);c.push(...f);}return c.length>0?c:[{text:"",style:{...a}}]}function dce(t){let{mode:e,canEdit:n,canvasSize:r,selectedElementId:o,selectedElementIds:i,selectedElementIdSet:s,inlineEditingElementId:a,effectiveSelectedIds:l,elementLookup:c,activeTool:d,editorScale:u,canvasStageRef:p,dragStateRef:f,resizeStateRef:h,shapeAdjustmentDragStateRef:m,marqueeStateRef:x,setInlineEditingElementId:y,setInlineEditingText:v,setContextMenuState:S,setMarqueeSelectionState:w,setSnapLines:C,inlineEditingText:T,ops:E,history:M,presentationHandleAction:A,setEditingEquationOmml:R,setIsEquationDialogOpen:k}=t,N=useRef(false),F=()=>{let J=a;if(!J)return;let W=c.get(J);if(W&&ot(W)){let te=PN(T,W.textSegments,W.textStyle);E.updateElementById(J,{text:T,textSegments:te}),M.markDirty();}y(null),v("");};return {handleElementClick:(J,W)=>{if(W.stopPropagation(),e==="present"){let te=c.get(J);te?.actionClick&&A(te.actionClick);return}if(W.shiftKey||W.metaKey){let te=i.length?i:o?[o]:[],se=te.includes(J)?te.filter(Ce=>Ce!==J):[...te,J];E.applySelection(se[0]??null,se);}else if(s.has(J)&&!a)if(N.current)N.current=false;else {let te=c.get(J);te&&ot(te)&&!te.locks?.noTextEdit&&(y(J),v(te.text??""));}else E.applySelection(J);},handleElementDoubleClick:(J,W)=>{let te=c.get(J);if(te){if(ot(te)&&te.textSegments?.some(se=>se.equationXml)){let se=te.textSegments?.find(Ce=>Ce.equationXml);if(se?.equationXml){R(se.equationXml),k(true);return}}ot(te)&&(y(J),v(te.text??""));}},handleElementMouseDown:(J,W)=>{if(W.button!==0)return;a&&a!==J&&F();let te=s.has(J);te?N.current=false:(E.applySelection(J),N.current=true);let se=te?l.length?l:[J]:[J],Ce={},ee=new Map;for(let ce of se){let de=c.get(ce);de&&(Ce[ce]={x:de.x,y:de.y});let Ne=document.querySelector(`[data-element-id="${ce}"]`);Ne&&ee.set(ce,Ne);}f.current={elementId:J,startClientX:W.clientX,startClientY:W.clientY,startPositionsById:Ce,domEls:ee,moved:false,lastDx:0,lastDy:0},C([]);},handleElementContextMenu:(J,W)=>{W.preventDefault(),W.stopPropagation(),s.has(J)||E.applySelection(J),S({x:W.clientX,y:W.clientY,elementId:J});},handleCanvasMouseDown:J=>{if(e!=="edit"||!n||J.button!==0||d!=="select")return;a&&F();let W=p.current;if(!W)return;let te=W.getBoundingClientRect(),se=u||1,Ce=Math.max(0,Math.min(r.width,(J.clientX-te.left)/se)),ee=Math.max(0,Math.min(r.height,(J.clientY-te.top)/se)),ce=J.shiftKey||J.metaKey,de={startX:Ce,startY:ee,currentX:Ce,currentY:ee,additive:ce,baseSelectionIds:ce?l:[]};x.current=de,w(de),S(null);},handleResizePointerDown:(J,W,te)=>{W.stopPropagation();let se=c.get(J);se&&(h.current={elementId:J,startClientX:W.clientX,startClientY:W.clientY,startX:se.x,startY:se.y,startWidth:se.width,startHeight:se.height,handle:te,moved:false,domEl:document.querySelector(`[data-element-id="${J}"]`),lastX:se.x,lastY:se.y,lastWidth:se.width,lastHeight:se.height});},handleAdjustmentPointerDown:(J,W)=>{W.stopPropagation();let te=c.get(J);if(!te||!("shapeType"in te)||!("shapeAdjustments"in te))return;let se=Object.entries(te.shapeAdjustments??{});if(!se.length)return;let[Ce,ee]=se[0];m.current={elementId:J,key:Ce,shapeType:te.shapeType??"rect",startClientX:W.clientX,startClientY:W.clientY,startAdjustment:ee,startWidth:te.width,startHeight:te.height,moved:false};},handleInlineEditCommit:F}}function YH(){return `comment-${crypto.randomUUID()}`}function uce(t,e,n){return t.map((r,o)=>o===e?{...r,comments:[...r.comments||[],n]}:r)}function pce(t,e,n){let r=false;return {slides:t.map((i,s)=>{if(s!==e)return i;let a=i.comments||[],l=a.filter(c=>{let d=c.id!==n;return d||(r=true),d});return l.length===a.length?i:{...i,comments:l}}),didDelete:r}}function fce(t,e,n,r){let o=false;return {slides:t.map((s,a)=>{if(a!==e)return s;let l=(s.comments||[]).map(c=>c.id!==n?c:(o=true,{...c,text:r}));return o?{...s,comments:l}:s}),didUpdate:o}}function hce(t,e,n){let r=false;return {slides:t.map((i,s)=>{if(s!==e)return i;let a=(i.comments||[]).map(l=>l.id!==n?l:(r=true,{...l,resolved:!l.resolved}));return r?{...i,comments:a}:i}),didUpdate:r}}function mce(t,e){let n={},r=false;for(let[o,i]of Object.entries(t)){if(!e.has(o)){r=true;continue}n[o]=i;}return r?n:null}function gce({slides:t,canEdit:e,userName:n="You",selectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState({}),[l,c]=useState({}),[d,u]=useState({}),[p,f]=useState({}),[h,m]=useState(null),x=useCallback((N,F)=>{a(B=>({...B,[N]:F}));},[]),y=useCallback((N,F)=>{u(B=>({...B,[N]:F}));},[]),v=useCallback(N=>{if(!e)return;let F=t[N];if(!F)return;let B=String(s[F.id]||"").trim();if(B.length===0)return;let D={id:YH(),text:B,author:n,createdAt:new Date().toISOString(),elementId:r??void 0};o(O=>uce(O,N,D)),a(O=>({...O,[F.id]:""})),i();},[e,s,i,o,r,t,n]),S=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=false;o(O=>{let U=pce(O,N,F);return D=U.didDelete,U.slides}),D&&(c(O=>({...O,[B.id]:null})),i());},[e,i,o,t]),w=useCallback((N,F)=>{let B=t.find(O=>O.id===N);if(!B)return;let D=(B.comments||[]).find(O=>O.id===F);D&&(c(O=>({...O,[N]:F})),u(O=>({...O,[F]:D.text||""})));},[t]),C=useCallback(N=>{c(F=>({...F,[N]:null}));},[]),T=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=String(d[F]||"").trim();if(D.length===0)return;let O=false;o(U=>{let H=fce(U,N,F,D);return O=H.didUpdate,H.slides}),O&&(c(U=>({...U,[B.id]:null})),i());},[e,d,i,o,t]),E=useCallback((N,F)=>{if(!e||!t[N])return;let D=false;o(O=>{let U=hce(O,N,F);return D=U.didUpdate,U.slides}),D&&i();},[e,i,o,t]),M=useCallback((N,F)=>{m(F),f(B=>({...B,[F]:""}));},[]),A=useCallback(()=>{m(null);},[]),R=useCallback((N,F)=>{f(B=>({...B,[N]:F}));},[]),k=useCallback((N,F)=>{if(!e)return;let B=t[N];if(!B)return;let D=(B.comments||[]).find(H=>H.id===F);if(!D)return;let O=String(p[F]||"").trim();if(O.length===0)return;let U={id:YH(),text:O,author:n,createdAt:new Date().toISOString(),threadId:F,elementId:D.elementId};o(H=>H.map((j,Z)=>{if(Z!==N)return j;let J=(j.comments||[]).map(W=>W.id!==F?W:{...W,replies:[...W.replies||[],U]});return {...j,comments:J}})),m(null),f(H=>{let j={...H};return delete j[F],j}),i();},[e,i,o,p,t,n]);return useEffect(()=>{let N=new Set(t.map(F=>F.id));a(F=>mce(F,N)??F);},[t]),{commentDraftBySlideId:s,editingCommentIdBySlideId:l,commentEditDraftByCommentId:d,replyingToCommentId:h,replyDraftByCommentId:p,handleCommentDraftChange:x,handleAddSlideComment:v,handleDeleteSlideComment:S,handleStartCommentEdit:w,handleCancelCommentEdit:C,handleSaveCommentEdit:T,handleSetCommentEditDraft:y,handleToggleCommentResolved:E,handleStartReply:M,handleCancelReply:A,handleReplyDraftChange:R,handleSubmitReply:k}}function xo(){return `el-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function xce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,editTemplateMode:i,clipboardPayload:s,setClipboardPayload:a,setTemplateElementsBySlideId:l,ops:c,history:d}=t,u=()=>{r&&a({element:structuredClone(r),isTemplate:i});},p=()=>{let x=o;if(!x.length||!e)return;let y=new Set(x);i?l(v=>{let S=e.id,w=v[S]??[];return {...v,[S]:w.filter(C=>!y.has(C.id))}}):c.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:S.elements.filter(C=>!y.has(C.id))}:S)),c.clearSelection(),d.markDirty();};return {handleCopy:u,handleCut:()=>{u(),p();},handlePaste:()=>{if(!s||!e)return;let x=structuredClone(s.element);x.id=xo(),x.x+=20,x.y+=20,c.updateSlides(y=>y.map((v,S)=>S===n?{...v,elements:[...v.elements,x]}:v)),c.applySelection(x.id),d.markDirty();},handleDuplicate:()=>{if(!r||!e)return;let x=structuredClone(r);x.id=xo(),x.x+=20,x.y+=20,c.updateSlides(y=>y.map((v,S)=>S===n?{...v,elements:[...v.elements,x]}:v)),c.applySelection(x.id),d.markDirty();},handleDelete:p}}function BKe(t){return t.type==="shape"||t.type==="image"||t.type==="picture"}function OKe(t){if("pathData"in t&&typeof t.pathData=="string"&&t.pathData)return t.pathData;if("shapeType"in t&&typeof t.shapeType=="string"){let e=O5(t.shapeType);if(e){let n=UKe(e,t.width,t.height);if(n)return n}}return `M 0 0 L ${t.width} 0 L ${t.width} ${t.height} L 0 ${t.height} Z`}function UKe(t,e,n){let r=t.match(/polygon\(([^)]+)\)/i);if(!r)return null;let o=r[1].split(",").map(a=>a.trim()),i=[];for(let a of o){let l=a.split(/\s+/);if(l.length<2)continue;let c=l[0],d=l[1],u,p;c.endsWith("%")?u=parseFloat(c)/100*e:u=parseFloat(c),d.endsWith("%")?p=parseFloat(d)/100*n:p=parseFloat(d),!isNaN(u)&&!isNaN(p)&&i.push({x:u,y:p});}if(i.length<3)return null;let s=[`M ${i[0].x} ${i[0].y}`];for(let a=1;a<i.length;a++)s.push(`L ${i[a].x} ${i[a].y}`);return s.push("Z"),s.join(" ")}function $Ke(t,e){let n=Ml(t);if(n.length===0)return t;let r=e.width,o=e.height;"pathWidth"in e&&typeof e.pathWidth=="number"&&(r=e.pathWidth),"pathHeight"in e&&typeof e.pathHeight=="number"&&(o=e.pathHeight);let i=r>0?e.width/r:1,s=o>0?e.height/o:1,a=n.map(l=>l.map(c=>({x:c.x*i+e.x,y:c.y*s+e.y})));return Gx(a)}function yce(t,e,n,r,o){let i=Ml(t);if(i.length===0)return t;let s=i.map(a=>a.map(l=>({x:l.x-e,y:l.y-n})));return Gx(s)}function bce(t){let e=Ml(t),n=1/0,r=1/0,o=-1/0,i=-1/0;for(let s of e)for(let a of s)a.x<n&&(n=a.x),a.y<r&&(r=a.y),a.x>o&&(o=a.x),a.y>i&&(i=a.y);return isFinite(n)?{x:n,y:r,width:o-n,height:i-r}:{x:0,y:0,width:0,height:0}}function vce(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,effectiveSelectedIds:o,setSelectedElementIds:i,ops:s,history:a}=t,l=r.filter(BKe),c=l.length>=2;return {handleMergeShapes:u=>{if(!c||!e)return;let p=l;if(p.length<2)return;let f=p.map(h=>{let m=OKe(h);return $Ke(m,h)});if(u==="fragment"){let h=[],m=f[0];for(let v=1;v<f.length;v++){let S=G5("fragment",m,f[v]);Array.isArray(S)&&(h=S),v<f.length-1&&h.length>0&&(m=h[0]);}if(h.length===0)return;let x=new Set(o),y=[];for(let v of h){if(!v)continue;let S=bce(v);if(S.width<=0||S.height<=0)continue;let w=yce(v,S.x,S.y),C={id:xo(),type:"shape",x:S.x,y:S.y,width:S.width,height:S.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:p[0].opacity??1,rawXml:{},shapeStyle:{...p[0].shapeStyle},shapeType:"custGeom",pathData:w,pathWidth:S.width,pathHeight:S.height};y.push(C);}if(y.length===0)return;s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements.filter(C=>!x.has(C.id)),...y]}:S)),i(y.map(v=>v.id)),a.markDirty();}else {let h=f[0];for(let w=1;w<f.length;w++){let C=G5(u,h,f[w]);typeof C=="string"&&(h=C);}if(!h)return;let m=bce(h);if(m.width<=0||m.height<=0)return;let x=yce(h,m.x,m.y),y=p[0],v={id:xo(),type:"shape",x:m.x,y:m.y,width:m.width,height:m.height,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:y.opacity??1,rawXml:{},shapeStyle:{...y.shapeStyle},shapeType:"custGeom",pathData:x,pathWidth:m.width,pathHeight:m.height},S=new Set(o);s.updateSlides(w=>w.map((C,T)=>T===n?{...C,elements:[...C.elements.filter(E=>!S.has(E.id)),v]}:C)),s.applySelection(v.id),a.markDirty();}},canMergeShapes:c}}function Sce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,effectiveSelectedIds:o,selectedElements:i,elementLookup:s,setSelectedElementIds:a,ops:l,history:c}=t,d=()=>{let v=o;if(v.length<2||!e)return;let S=new Set(v),w=e.elements.filter(k=>S.has(k.id));if(w.length<2)return;let C=1/0,T=1/0,E=-1/0,M=-1/0;for(let k of w)C=Math.min(C,k.x),T=Math.min(T,k.y),E=Math.max(E,k.x+k.width),M=Math.max(M,k.y+k.height);let A=w.map(k=>({...structuredClone(k),x:k.x-C,y:k.y-T})),R={id:xo(),type:"group",x:C,y:T,width:E-C,height:M-T,rotation:0,flipHorizontal:false,flipVertical:false,hidden:false,opacity:1,rawXml:{},children:A};l.updateSlides(k=>k.map((N,F)=>F===n?{...N,elements:[...N.elements.filter(B=>!S.has(B.id)),R]}:N)),l.applySelection(R.id),c.markDirty();},u=()=>{if(!r||r.type!=="group"||!e)return;let v=r,S=v.children.map(w=>({...structuredClone(w),id:w.id||xo(),x:w.x+v.x,y:w.y+v.y}));l.updateSlides(w=>w.map((C,T)=>T===n?{...C,elements:[...C.elements.filter(E=>E.id!==v.id),...S]}:C)),a(S.map(w=>w.id)),c.markDirty();},p=v=>{if(!r)return;let S=v==="horizontal"?{flipHorizontal:!r.flipHorizontal}:{flipVertical:!r.flipVertical};l.updateSelectedElement(S),c.markDirty();},f=v=>{if(i.length<2)return;let S=i.map(R=>({id:R.id,left:R.x,top:R.y,right:R.x+R.width,bottom:R.y+R.height})),w=Math.min(...S.map(R=>R.left)),C=Math.min(...S.map(R=>R.top)),T=Math.max(...S.map(R=>R.right)),E=Math.max(...S.map(R=>R.bottom)),M=(w+T)/2,A=(C+E)/2;for(let R of S){let k=s.get(R.id);if(!k)continue;let N=k.x,F=k.y;switch(v){case "left":N=w;break;case "center":N=M-k.width/2;break;case "right":N=T-k.width;break;case "top":F=C;break;case "middle":F=A-k.height/2;break;case "bottom":F=E-k.height;break}l.updateElementById(R.id,{x:N,y:F});}c.markDirty();},h=v=>{if(!r||!e)return;let S=e.elements,w=S.findIndex(T=>T.id===r.id);if(w===-1)return;let C=[...S];v==="forward"&&w<S.length-1?[C[w],C[w+1]]=[C[w+1],C[w]]:v==="backward"&&w>0&&([C[w],C[w-1]]=[C[w-1],C[w]]),l.updateSlides(T=>T.map((E,M)=>M===n?{...E,elements:C}:E)),c.markDirty();},m=v=>{if(!r||!e)return;let S=e.elements,w=S.findIndex(M=>M.id===r.id);if(w===-1)return;let C=S[w],T=S.filter((M,A)=>A!==w),E=v==="front"?[...T,C]:[C,...T];l.updateSlides(M=>M.map((A,R)=>R===n?{...A,elements:E}:A)),c.markDirty();},{handleMergeShapes:x,canMergeShapes:y}=vce({activeSlide:e,activeSlideIndex:n,selectedElements:i,effectiveSelectedIds:o,setSelectedElementIds:a,ops:l,history:c});return {handleGroupElements:d,handleUngroupElement:u,handleFlip:p,handleAlignElements:f,handleMoveLayer:h,handleMoveLayerToEdge:m,handleMergeShapes:x,canMergeShapes:y}}function wce(t){let{setIsInspectorPaneOpen:e,setSidebarPanelMode:n,onOpenHyperlinkDialog:r}=t,{handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleDelete:l}=xce(t),{handleGroupElements:c,handleUngroupElement:d,handleFlip:u,handleAlignElements:p,handleMoveLayer:f,handleMoveLayerToEdge:h,handleMergeShapes:m,canMergeShapes:x}=Sce(t);return {handleCopy:o,handleCut:i,handlePaste:s,handleDuplicate:a,handleGroupElements:c,handleUngroupElement:d,handleDelete:l,handleFlip:u,handleAlignElements:p,handleMoveLayer:f,handleMoveLayerToEdge:h,handleMergeShapes:m,canMergeShapes:x,handleContextMenuAction:v=>{switch(v){case "copy":o();break;case "cut":i();break;case "paste":s();break;case "duplicate":a();break;case "delete":l();break;case "bring-forward":case "bringForward":f("forward");break;case "send-backward":case "sendBackward":f("backward");break;case "bring-front":case "bringToFront":h("front");break;case "send-back":case "sendToBack":h("back");break;case "comment":case "addComment":e(true),n("comments");break;case "group":c();break;case "ungroup":d();break;case "editHyperlink":r();break}}}}function Cce(t){let{activeSlide:e,activeSlideIndex:n,selectedElement:r,selectedElementId:o,history:i,setSlides:s,setTemplateElementsBySlideId:a,setSelectedElementId:l,setSelectedElementIds:c,setInlineEditingElementId:d,setContextMenuState:u}=t,p=useCallback((w,C=[])=>{l(w),c(C);},[l,c]),f=useCallback(()=>{p(null,[]),d(null),u(null);},[p,d,u]),h=useCallback((w,C)=>{D7(w)?a(E=>{let M=e?.id;if(!M)return E;let A=E[M]??[];return {...E,[M]:A.map(R=>R.id===w?{...R,...C}:R)}}):s(E=>E.map((M,A)=>A!==n?M:{...M,elements:M.elements.map(R=>R.id===w?{...R,...C}:R)})),i.markDirty();},[e?.id,n,i,s,a]),m=useCallback(w=>{o&&h(o,w);},[o,h]),x=useCallback(w=>{!r||!mn(r)||m({shapeStyle:{...r.shapeStyle,...w}});},[r,m]),y=useCallback(w=>{if(!r||!ot(r))return;let C=Fee(r.textSegments);if(C&&r.textSegments){let{newSegments:M,newSelection:A}=Bee(r.textSegments,C,w);Dee(A),m({textSegments:M});return}let T={...r.textStyle,...w},E=r.textSegments?.map(M=>({...M,style:{...M.style,...w}}));m({textStyle:T,textSegments:E});},[r,m]),v=useCallback(w=>{s(C=>w(C));},[s]),S=useCallback(async()=>null,[]);return {applySelection:p,clearSelection:f,updateElementById:h,updateSelectedElement:m,updateSelectedShapeStyle:x,updateSelectedTextStyle:y,updateSlides:v,serializeSlides:S}}function zKe(t,e,n){if(!e)return [];let r=[],o=n?e:e.toLowerCase();return t.forEach((i,s)=>{for(let a of i.elements||[]){if(!ot(a))continue;(a.textSegments??[]).forEach((c,d)=>{let u=n?c.text:(c.text||"").toLowerCase(),p=0;for(;p<u.length;){let f=u.indexOf(o,p);if(f===-1)break;r.push({slideIndex:s,elementId:a.id,segmentIndex:d,startOffset:f,length:e.length}),p=f+1;}});}}),r}function GKe(t,e,n){if(e.length===0)return t;let r=[...t],o=new Map;for(let i of e){let s=`${i.slideIndex}::${i.elementId}::${i.segmentIndex}`;o.has(s)||o.set(s,[]),o.get(s).push(i);}for(let[,i]of o){let s=[...i].sort((a,l)=>l.startOffset-a.startOffset);for(let a of s){let l=r[a.slideIndex];if(!l)continue;let c=(l.elements||[]).findIndex(x=>x.id===a.elementId);if(c===-1)continue;let d=l.elements[c];if(!ot(d))continue;let u=[...d.textSegments??[]],p=u[a.segmentIndex];if(!p)continue;let f=p.text.slice(0,a.startOffset),h=p.text.slice(a.startOffset+a.length);u[a.segmentIndex]={...p,text:f+n+h};let m=[...l.elements];m[c]={...d,text:u.map(x=>x.text).join(""),textSegments:u},r[a.slideIndex]={...l,elements:m};}}return r}function Tce({slides:t,mode:e,onSetActiveSlideIndex:n,onSetSelectedElementId:r,onUpdateSlides:o,onMarkDirty:i}){let[s,a]=useState(false),[l,c]=useState(""),[d,u]=useState(""),[p,f]=useState(false),[h,m]=useState([]),[x,y]=useState(-1),v=useCallback(()=>{let E=zKe(t,l,p);if(!l){m([]),y(-1);return}m(E),y(E.length>0?0:-1),E.length>0&&(n(E[0].slideIndex),r(E[0].elementId));},[t,l,p,n,r]),S=useCallback(E=>{if(h.length===0)return;let M=(x+E+h.length)%h.length;y(M);let A=h[M];A&&(n(A.slideIndex),r(A.elementId));},[h,x,n,r]),w=useCallback(E=>{E.length!==0&&(o(M=>GKe(M,E,d)),i());},[d,o,i]),C=useCallback(()=>{h.length===0||x<0||(w([h[x]]),setTimeout(v,0));},[h,x,w,v]),T=useCallback(()=>{h.length!==0&&(w(h),setTimeout(v,0));},[h,w,v]);return useEffect(()=>{let E=M=>{if((M.metaKey||M.ctrlKey)&&M.key==="f"){if(e!=="edit")return;M.preventDefault(),a(A=>!A);}};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[e]),{findReplaceOpen:s,setFindReplaceOpen:a,findQuery:l,setFindQuery:c,replaceQuery:d,setReplaceQuery:u,findMatchCase:p,setFindMatchCase:f,findResults:h,findResultIndex:x,performFind:v,navigateFindResult:S,handleReplace:C,handleReplaceAll:T}}function Mce(t){let{activeSlide:e,canvasSize:n,addElement:r}=t;return {handleImageFileChange:s=>{let a=s.target.files?.[0];if(!a||!e)return;s.target.value="";let l=new FileReader;l.onload=()=>{let c=l.result;if(!c)return;let d=new Image;d.onload=()=>{let f=d.naturalWidth||400,h=d.naturalHeight||300;if(f>500||h>400){let m=Math.min(500/f,400/h);f=Math.round(f*m),h=Math.round(h*m);}r({id:xo(),type:"image",x:Math.round((n.width-f)/2),y:Math.round((n.height-h)/2),width:f,height:h,imageData:c});},d.onerror=()=>{r({id:xo(),type:"image",x:100,y:100,width:400,height:300,imageData:c});},d.src=c;},l.readAsDataURL(a);},handleMediaFileChange:s=>{let a=s.target.files?.[0];if(!a||!e)return;s.target.value="";let l=a.type.startsWith("audio/")?"audio":a.type.startsWith("video/")?"video":null;if(!l)return;let c=a.path,d=(p,f,h)=>{r({id:xo(),type:"media",mediaType:l,mediaMimeType:a.type||void 0,mediaData:p,x:Math.round((n.width-f)/2),y:Math.round((n.height-h)/2),width:f,height:h});};if(c){let p=c.replace(/\\/g,"/");p.startsWith("/")||(p=`/${p}`);let f=`pptx-resource://media${encodeURI(p)}`;if(l==="audio"){d(f,420,64);return}let h=URL.createObjectURL(a),m=document.createElement("video");m.preload="metadata",m.onloadedmetadata=()=>{URL.revokeObjectURL(h);let x=640,y=360,v=m.videoWidth||x,S=m.videoHeight||y;if(v>x||S>y){let w=Math.min(x/v,y/S);v=Math.round(v*w),S=Math.round(S*w);}d(f,v,S);},m.onerror=()=>{URL.revokeObjectURL(h),d(f,640,360);},m.src=h;return}let u=new FileReader;u.onload=()=>{let p=u.result;if(!p)return;if(l==="audio"){d(p,420,64);return}let f=document.createElement("video");f.preload="metadata",f.onloadedmetadata=()=>{let x=f.videoWidth||640,y=f.videoHeight||360;if(x>640||y>360){let v=Math.min(640/x,360/y);x=Math.round(x*v),y=Math.round(y*v);}d(p,x,y);},f.onerror=()=>{d(p,640,360);},f.src=p;},u.readAsDataURL(a);}}}function _ce(t){let{activeSlide:e,activeSlideIndex:n,selectedElements:r,ops:o,history:i,addElement:s}=t;return {handleInsertSmartArt:(p,f)=>{if(!e)return;let h=f.map((x,y)=>`node-${Date.now()}-${y}-${Math.random().toString(36).slice(2,8)}`),m=f.map((x,y)=>{let v={id:h[y],text:x};return p==="hierarchy"&&y>0&&(v.parentId=h[0]),v});s({id:xo(),type:"smartArt",x:100,y:120,width:600,height:340,smartArtData:{layout:p,colorScheme:"colorful1",style:"flat",nodes:m}});},handleInsertEquation:p=>{e&&s({id:xo(),type:"shape",x:120,y:200,width:400,height:80,text:"[Equation]",textStyle:{fontSize:18,fontFamily:"Cambria Math"},textSegments:[{text:"[Equation]",style:{fontSize:18,fontFamily:"Cambria Math"},equationXml:p}]});},handleHyperlinkConfirm:p=>{let f=r[0];if(!f)return;let h=ele(p),m={url:h.url||void 0,action:h.action,tooltip:h.tooltip};o.updateElementById(f.id,{actionClick:m}),i.markDirty();},handleInsertField:(p,f)=>{if(!e)return;let h={slidenum:String(n+1),datetime:new Date().toLocaleDateString(),header:"Header",footer:"Footer"},m=f||h[p]||p,x=`{${crypto.randomUUID().toUpperCase()}}`;s({id:xo(),type:"shape",x:120,y:200,width:200,height:40,text:m,textStyle:{fontSize:14},textSegments:[{text:m,style:{fontSize:14},fieldType:p,fieldGuid:x}]});},handleAddActionButton:p=>{if(!e)return;let f=Lm.find(m=>m.shapeType===p);if(!f)return;let h=iE({type:f.defaultAction});h&&(h.tooltip=f.label,h.highlightClick=true),s({id:xo(),type:"shape",x:150,y:150,width:120,height:50,shapeType:f.shapeType,text:f.label,textStyle:{fontSize:11,fontColor:"#FFFFFF",align:"center",verticalAlign:"middle"},textSegments:[{text:f.label,style:{fontSize:11,fontColor:"#FFFFFF",bold:true}}],shapeStyle:{fillColor:"#4472C4",strokeColor:"#2F5597",strokeWidth:1},actionClick:h});}}}function Ece(t){let{activeSlide:e,activeSlideIndex:n,canvasSize:r,newShapeType:o,selectedElements:i,ops:s,history:a}=t,l=y=>{s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements,y]}:S)),s.applySelection(y.id),a.markDirty();},c=()=>{e&&l({id:xo(),type:"text",x:100,y:100,width:300,height:60,text:"",textStyle:{fontSize:24}});},d=()=>{e&&l({id:xo(),type:"shape",x:150,y:150,width:200,height:150,shapeType:o,shapeStyle:{fillColor:"#3b82f6",strokeColor:"#1f2937",strokeWidth:2}});},u=()=>{if(!e)return;let y=Array.from({length:3},()=>({cells:Array.from({length:3},()=>({text:"",style:{}}))})),v=Array.from({length:3},()=>1/3);l({id:xo(),type:"table",x:100,y:200,width:600,height:250,tableData:{rows:y,columnWidths:v}});},p=_ce({activeSlide:e,activeSlideIndex:n,selectedElements:i,ops:s,history:a,addElement:l}),f=Mce({activeSlide:e,canvasSize:r,addElement:l});return {handleAddTextBox:c,handleAddShape:d,handleAddTable:u,...p,handleAddInkElement:y=>{e&&(s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:[...S.elements,y]}:S)),a.markDirty());},handleAddFreeformShape:y=>{e&&l(y);},handleEraseInkElement:y=>{e&&(s.updateSlides(v=>v.map((S,w)=>w===n?{...S,elements:S.elements.filter(C=>C.id!==y)}:S)),a.markDirty());},...f}}function jKe(){let t=()=>Math.floor(Math.random()*65536).toString(16).padStart(4,"0");return `{${t()}${t()}-${t()}-${t()}-${t()}-${t()}${t()}${t()}}`}function Ace(t){let{sections:e,setSections:n,slides:r,setSlides:o,markDirty:i}=t,s=useCallback((p,f)=>{let h=jKe(),x=r[f]?.sectionId,y=[];for(let v=f;v<r.length&&(v===f||r[v].sectionId===x);v++)y.push(v);o(v=>v.map((S,w)=>y.includes(w)?{...S,sectionId:h,sectionName:p}:S)),n(v=>{let S=x?v.findIndex(M=>M.id===x)+1:v.length,w=y.map(M=>{let A=r[M],k=A?.rawXml?.["p:sld"];return String(k?.["@_id"]||A?.slideNumber||M+1)}),C=v.map(M=>M.id===x?{...M,slideIds:M.slideIds.filter(A=>!w.includes(A))}:M),T={id:h,name:p,slideIds:w},E=[...C];return E.splice(S,0,T),E}),i();},[r,o,n,i]),a=useCallback((p,f)=>{n(h=>h.map(m=>m.id===p?{...m,name:f}:m)),o(h=>h.map(m=>m.sectionId===p?{...m,sectionName:f}:m)),i();},[n,o,i]),l=useCallback(p=>{n(m=>{let x=m.findIndex(w=>w.id===p);if(x===-1)return m;let y=m[x],v=x>0?m[x-1]:void 0,S=m.filter(w=>w.id!==p);return v&&y?S.map(w=>w.id===v.id?{...w,slideIds:[...w.slideIds,...y.slideIds]}:w):S});let f=e.findIndex(m=>m.id===p),h=f>0?e[f-1]:void 0;o(m=>m.map(x=>x.sectionId!==p?x:h?{...x,sectionId:h.id,sectionName:h.name}:{...x,sectionId:void 0,sectionName:void 0})),i();},[e,n,o,i]),c=useCallback(p=>{n(f=>{let h=f.findIndex(x=>x.id===p);if(h<=0)return f;let m=[...f];return [m[h-1],m[h]]=[m[h],m[h-1]],m}),i();},[n,i]),d=useCallback(p=>{n(f=>{let h=f.findIndex(x=>x.id===p);if(h===-1||h>=f.length-1)return f;let m=[...f];return [m[h],m[h+1]]=[m[h+1],m[h]],m}),i();},[n,i]),u=useCallback((p,f)=>{let h=e.find(m=>m.id===f);h&&(o(m=>m.map((x,y)=>p.includes(y)?{...x,sectionId:f,sectionName:h.name}:x)),n(m=>{let x=p.map(y=>{let v=r[y],w=v?.rawXml?.["p:sld"];return String(w?.["@_id"]||v?.slideNumber||y+1)});return m.map(y=>y.id===f?{...y,slideIds:[...y.slideIds,...x.filter(v=>!y.slideIds.includes(v))]}:{...y,slideIds:y.slideIds.filter(v=>!x.includes(v))})}),i());},[e,r,o,n,i]);return {addSection:s,renameSection:a,deleteSection:l,moveSectionUp:c,moveSectionDown:d,moveSlidesToSection:u}}function XKe(t,e,n){let r=[...t],o=Math.max(0,Math.min(e+1,r.length));return r.splice(o,0,n),r}function Pce(t){let{slides:e,activeSlideIndex:n,setActiveSlideIndex:r,ops:o,history:i,handlerRef:s}=t;return {handleAddSlide:()=>{let h={id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,rId:"",slideNumber:e.length+1,elements:[]};o.updateSlides(m=>{let x=[...m];return x.splice(n+1,0,h),x}),r(n+1),i.markDirty();},handleMoveSlide:(h,m)=>{h!==m&&(o.updateSlides(x=>{let y=[...x],[v]=y.splice(h,1);return y.splice(m,0,v),y}),r(m),i.markDirty());},handleSlideContextMenu:(h,m)=>{},handleDeleteSlides:h=>{if(h.length===0||e.length<=1)return;let m=[...h].sort((y,v)=>v-y);o.updateSlides(y=>{let v=[...y];for(let S of m)v.length>1&&v.splice(S,1);return v});let x=Math.min(...h);r(Math.min(x,e.length-h.length-1,Math.max(e.length-h.length-1,0))),i.markDirty();},handleDuplicateSlides:h=>{if(h.length===0)return;let m=[...h].sort((x,y)=>x-y);o.updateSlides(x=>{let y=[...x],v=0;for(let S of m){let w=y[S+v];if(!w)continue;let C={...w,id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,elements:w.elements.map(T=>({...T,id:`${T.id}-dup-${Math.random().toString(36).slice(2,6)}`}))};y.splice(S+v+1,0,C),v++;}return y}),i.markDirty();},handleToggleHideSlides:h=>{h.length!==0&&(o.updateSlides(m=>{let x=[...m];for(let y of h){let v=x[y];v&&(x[y]={...v,hidden:!v.hidden});}return x}),i.markDirty());},handleInsertSlideFromLayout:(h,m)=>{let x=n+1,y={id:`slide-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,rId:"",slideNumber:e.length+1,elements:[],layoutPath:h,...m?{layoutName:m}:{}},v=[];o.updateSlides(w=>(v=XKe(w,n,y),v)),r(x),i.markDirty();let S=s?.current;S&&S.applyLayoutToSlide(x,h,v).then(w=>{o.updateSlides(C=>{if(C[x]?.id!==y.id)return C;let T=[...C];return T[x]=w,T});},()=>{});}}}function Rce(t){let{selectedElement:e,tableEditorState:n,setTableEditorState:r,ops:o,history:i}=t;return {handleMergeCellRight:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,f=p.rows[d]?.cells[u];if(!f)return;let h=Math.max(1,f.gridSpan??1),m=u+h,x=p.rows[d]?.cells[m];if(!x||x.hMerge||x.vMerge)return;let y=O1([{row:d,col:u},{row:d,col:m}],p),v={tableData:y},S=iy(e,y);S&&(v.rawXml=S),o.updateSelectedElement(v),i.markDirty();},handleMergeCellDown:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,f=p.rows[d]?.cells[u];if(!f)return;let h=Math.max(1,f.rowSpan??1),m=d+h;if(m>=p.rows.length)return;let x=p.rows[m]?.cells[u];if(!x||x.hMerge||x.vMerge)return;let y=O1([{row:d,col:u},{row:m,col:u}],p),v={tableData:y},S=iy(e,y);S&&(v.rawXml=S),o.updateSelectedElement(v),i.markDirty();},handleMergeSelectedCells:()=>{if(!e||e.type!=="table"||!e.tableData||!n||!n.selectedCells||n.selectedCells.length<2)return;let d=e.tableData,u=O1(n.selectedCells,d),p={tableData:u},f=iy(e,u);f&&(p.rawXml=f),o.updateSelectedElement(p),r({rowIndex:n.rowIndex,columnIndex:n.columnIndex}),i.markDirty();},handleSplitCell:()=>{if(!e||e.type!=="table"||!e.tableData||!n)return;let{rowIndex:d,columnIndex:u}=n,p=e.tableData,f=JF(d,u,p),h={tableData:f},m=iy(e,f);m&&(h.rawXml=m),o.updateSelectedElement(h),i.markDirty();}}}function kce(){return {text:"",style:{}}}function Ice(t){let{selectedElement:e,tableEditorState:n,elementLookup:r,setTableEditorState:o,ops:i,history:s}=t;return {handleCommitCellEdit:(m,x,y,v)=>{let S=r.get(m);if(!S||S.type!=="table")return;let w={};if(S.tableData){let C=S.tableData.rows.map((T,E)=>E!==x?T:{...T,cells:T.cells.map((M,A)=>A!==y?M:{...M,text:v})});w.tableData={...S.tableData,rows:C};}if(S.rawXml){let C=KF(S,x,y,v);C&&(w.rawXml=C);}Object.keys(w).length!==0&&(i.updateElementById(m,w),s.markDirty(),o({rowIndex:x,columnIndex:y,elementId:m}));},handleUpdateCellTextStyle:m=>{if(!e||e.type!=="table"||!n)return;let x=e.id,{rowIndex:y,columnIndex:v}=n,S={};if(e.rawXml){let w=ZF(e,y,v,m);w&&(S.rawXml=w);}if(e.tableData){let w=e.tableData.rows.map((C,T)=>T!==y?C:{...C,cells:C.cells.map((E,M)=>M!==v?E:{...E,style:{...E.style,...m}})});S.tableData={...e.tableData,rows:w};}Object.keys(S).length!==0&&(i.updateElementById(x,S),s.markDirty());},handleResizeTableColumns:(m,x)=>{let y=r.get(m);!y||y.type!=="table"||!y.tableData||(i.updateElementById(m,{tableData:{...y.tableData,columnWidths:x}}),s.markDirty());},handleResizeTableRow:(m,x,y)=>{let v=r.get(m);if(!v||v.type!=="table"||!v.tableData)return;let S=v.tableData.rows.map((w,C)=>C===x?{...w,height:y}:w);i.updateElementById(m,{tableData:{...v.tableData,rows:S}}),s.markDirty();},handleInsertTableRow:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=n?.rowIndex??0,y=m==="above"?x:x+1,v=e.tableData,S=v.columnWidths.length,w=[];for(let R=0;R<S;R++){let k=false;for(let N=0;N<y;N++){let F=v.rows[N]?.cells[R];if(!F)continue;let B=Math.max(1,F.rowSpan??1);if(B>1&&N+B>y&&!F.vMerge&&!F.hMerge){k=true;break}}k?w.push({text:"",vMerge:true}):w.push(kce());}let T=[...v.rows.map((R,k)=>{if(k>=y)return R;let N=false,F=R.cells.map(B=>{let D=Math.max(1,B.rowSpan??1);return D>1&&k+D>y&&!B.vMerge&&!B.hMerge?(N=true,{...B,rowSpan:D+1}):B});return N?{...R,cells:F}:R})];T.splice(y,0,{cells:w,height:40});let E={...v,rows:T},M={tableData:E},A=sy(e,E);A&&(M.rawXml=A),i.updateSelectedElement(M),s.markDirty();},handleDeleteTableRow:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData;if(m.rows.length<=1)return;let x=n?.rowIndex??0;if(x<0||x>=m.rows.length)return;let y=m.rows[x],v=[...m.rows],S=(M,A,R)=>M.map((k,N)=>N===A?{...k,rowSpan:R}:k);for(let M=0;M<y.cells.length;M++){let A=y.cells[M];if(A.vMerge)for(let R=x-1;R>=0;R--){let k=v[R]?.cells[M];if(!k)break;if(!k.vMerge){let N=Math.max(1,k.rowSpan??1);N>1&&(v[R]={...v[R],cells:S(v[R].cells,M,N-1>1?N-1:void 0)});break}}else {let R=Math.max(1,A.rowSpan??1);if(R>1){let k=x+1;k<v.length&&(v[k]={...v[k],cells:v[k].cells.map((N,F)=>{if(F!==M)return N;let B=R-1;return {...N,text:A.text||N.text,style:N.style||A.style,rowSpan:B>1?B:void 0,vMerge:void 0,gridSpan:A.gridSpan}})});}}}let w=v.filter((M,A)=>A!==x),C={...m,rows:w},T={tableData:C},E=sy(e,C);E&&(T.rawXml=E),i.updateSelectedElement(T),s.markDirty();},handleInsertTableColumn:m=>{if(!e||e.type!=="table"||!e.tableData)return;let x=e.tableData,y=n?.columnIndex??0,v=m==="left"?y:y+1,S=[...x.columnWidths],w=v<S.length?v:S.length-1,T=(S[w]??1/S.length)/2;S[w]=T,S.splice(v,0,T);let E=S.reduce((B,D)=>B+D,0),M=E>0?S.map(B=>B/E):S,R=x.rows.map(B=>{let D=false;for(let H=0;H<v&&H<B.cells.length;H++){let j=B.cells[H];if(!j)continue;let Z=Math.max(1,j.gridSpan??1);if(Z>1&&H+Z>v&&!j.hMerge){D=true;break}}let O=[...B.cells],U=D?{text:"",hMerge:true}:kce();return O.splice(v,0,U),{...B,cells:O}}).map(B=>{let D=false,O=B.cells.map((U,H)=>{if(H>=v)return U;let j=Math.max(1,U.gridSpan??1);return j>1&&H+j>v&&!U.hMerge&&!U.vMerge?(D=true,{...U,gridSpan:j+1}):U});return D?{...B,cells:O}:B}),k={...x,rows:R,columnWidths:M},N={tableData:k},F=sy(e,k);F&&(N.rawXml=F),i.updateSelectedElement(N),s.markDirty();},handleDeleteTableColumn:()=>{if(!e||e.type!=="table"||!e.tableData)return;let m=e.tableData;if(m.columnWidths.length<=1)return;let x=n?.columnIndex??0;if(x<0||x>=m.columnWidths.length)return;let y=m.rows.map(M=>{let A=[...M.cells],R=A[x];if(R)if(R.hMerge)for(let k=x-1;k>=0;k--){let N=A[k];if(!N)break;if(!N.hMerge){let F=Math.max(1,N.gridSpan??1);F>1&&(A[k]={...N,gridSpan:F-1>1?F-1:void 0});break}}else {let k=Math.max(1,R.gridSpan??1);if(k>1){let N=x+1;if(N<A.length){let F=A[N];A[N]={...F,text:R.text||F.text,style:F.style||R.style,gridSpan:k-1>1?k-1:void 0,hMerge:void 0,rowSpan:R.rowSpan};}}}return {...M,cells:A.filter((k,N)=>N!==x)}}),v=m.columnWidths.filter((M,A)=>A!==x),S=v.reduce((M,A)=>M+A,0),w=S>0?v.map(M=>M/S):v,C={...m,rows:y,columnWidths:w},T={tableData:C},E=sy(e,C);E&&(T.rawXml=E),i.updateSelectedElement(T),s.markDirty();}}}function Nce(t){let e=Ice(t),n=Rce(t);return {...e,...n}}function Bce(t){let{state:e,history:n,zoom:r,mode:o,canEdit:i,slides:s,activeSlide:a,activeSlideIndex:l,selectedElement:c,selectedElementId:d,selectedElementIds:u,canvasSize:p,dialogs:f,presentation:h,userName:m,handlerRef:x}=t,y=Cce({activeSlide:a,activeSlideIndex:l,selectedElement:c,selectedElementId:d,templateElementsBySlideId:e.templateElementsBySlideId,history:n,setSlides:e.setSlides,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setSelectedElementId:e.setSelectedElementId,setSelectedElementIds:e.setSelectedElementIds,setInlineEditingElementId:e.setInlineEditingElementId,setContextMenuState:e.setContextMenuState}),v=Ace({sections:e.sections,setSections:e.setSections,slides:s,setSlides:e.setSlides,markDirty:n.markDirty}),S=Tce({slides:s,mode:o,onSetActiveSlideIndex:e.setActiveSlideIndex,onSetSelectedElementId:e.setSelectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),w=gce({slides:s,canEdit:i,userName:m,selectedElementId:e.selectedElementId,onUpdateSlides:y.updateSlides,onMarkDirty:n.markDirty}),C=dce({mode:o,canEdit:i,canvasSize:p,selectedElementId:d,selectedElementIds:u,selectedElementIdSet:e.selectedElementIdSet,inlineEditingElementId:e.inlineEditingElementId,effectiveSelectedIds:e.effectiveSelectedIds,elementLookup:e.elementLookup,activeTool:e.activeTool,editTemplateMode:e.editTemplateMode,editorScale:r.editorScale,canvasStageRef:r.canvasStageRef,dragStateRef:e.dragStateRef,resizeStateRef:e.resizeStateRef,shapeAdjustmentDragStateRef:e.shapeAdjustmentDragStateRef,marqueeStateRef:e.marqueeStateRef,setInlineEditingElementId:e.setInlineEditingElementId,setInlineEditingText:e.setInlineEditingText,setContextMenuState:e.setContextMenuState,setMarqueeSelectionState:e.setMarqueeSelectionState,setSnapLines:e.setSnapLines,inlineEditingText:e.inlineEditingText,ops:y,history:n,presentationHandleAction:h.handlePresentationAction,setEditingEquationOmml:f.setEditingEquationOmml,setIsEquationDialogOpen:f.setIsEquationDialogOpen}),T=Ece({activeSlide:a,activeSlideIndex:l,canvasSize:p,newShapeType:e.newShapeType,selectedElements:e.selectedElements,ops:y,history:n}),E=wce({activeSlide:a,activeSlideIndex:l,selectedElement:c,effectiveSelectedIds:e.effectiveSelectedIds,selectedElements:e.selectedElements,selectedElementIdSet:e.selectedElementIdSet,elementLookup:e.elementLookup,editTemplateMode:e.editTemplateMode,clipboardPayload:e.clipboardPayload,setClipboardPayload:e.setClipboardPayload,setSelectedElementIds:e.setSelectedElementIds,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setIsInspectorPaneOpen:e.setIsInspectorPaneOpen,setSidebarPanelMode:e.setSidebarPanelMode,ops:y,history:n,onOpenHyperlinkDialog:()=>f.setIsHyperlinkDialogOpen(true)}),M=Pce({slides:s,activeSlideIndex:l,setActiveSlideIndex:e.setActiveSlideIndex,ops:y,history:n,handlerRef:x}),A=Nce({selectedElement:c,elementLookup:e.elementLookup,tableEditorState:e.tableEditorState,setTableEditorState:e.setTableEditorState,ops:y,history:n}),R=useCallback(H=>{if(c?.type==="table"&&e.tableEditorState){A.handleUpdateCellTextStyle(H);return}y.updateSelectedTextStyle(H);},[c,e.tableEditorState,A,y]),k=useMemo(()=>({...y,updateSelectedTextStyle:R}),[y,R]),N=useRef(null),F=useRef(false),{formatPainterActive:B,setFormatPainterActive:D,elementLookup:O}=e;useEffect(()=>{B&&!F.current&&c?N.current=OQ(c):B||(N.current=null),F.current=B;},[B,c]),useEffect(()=>{if(!B)return;let H=j=>{j.key==="Escape"&&D(false);};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[B,D]);let U=useMemo(()=>({...C,handleElementClick:(H,j)=>{if(B&&N.current){j.stopPropagation();let Z=O.get(H);if(Z){let J=UQ(Z,N.current),W={};mn(J)&&(W.shapeStyle=J.shapeStyle),ot(J)&&(W.textStyle=J.textStyle),y.updateElementById(H,W);}N.current=null,D(false),y.applySelection(H);return}C.handleElementClick(H,j);},handleCanvasMouseDown:H=>{if(B){D(false);return}C.handleCanvasMouseDown(H);}}),[C,y,B,D,O]);return {ops:k,sectionOps:v,findReplace:S,comments:w,canvasHandlers:U,insertHandlers:T,manipulation:E,slideOps:M,tableOps:A}}function kN(){}var YKe=2.5,qKe=14,KKe=.4,Uce=16,$ce=0;function ZKe(){return $ce+=1,`stroke-${$ce}`}function Hce(t){let{isActive:e,activeSlideIndex:n}=t,[r,o]=useState("none"),[i,s]=useState("#ff0000"),[a,l]=useState("#ffff00"),[c,d]=useState(null),[u,p]=useState(null),[f,h]=useState(false),m=useRef(new Map),[x,y]=useState([]),[v,S]=useState(0),w=useRef(false),C=useRef(n);C.current=n;let T=useRef(n);useEffect(()=>{e&&T.current!==n&&(y(j=>(j.length>0?m.current.set(T.current,j):m.current.delete(T.current),S(Z=>Z+1),m.current.get(n)??[])),T.current=n);},[e,n]);let E=useCallback(j=>{e&&o(Z=>Z===j?"none":j);},[e]),M=useCallback((j,Z)=>{if(e&&(r==="pen"||r==="highlighter")){w.current=true;let J=r==="pen";d({id:ZKe(),points:[{x:j,y:Z}],color:J?i:a,width:J?YKe:qKe,opacity:J?1:KKe});}},[e,r,i,a]),A=useCallback((j,Z)=>{!e||!w.current||d(J=>J?{...J,points:[...J.points,{x:j,y:Z}]}:null);},[e]),R=useCallback(()=>{w.current&&(w.current=false,d(j=>(j&&j.points.length>1&&y(Z=>{if(Z.some(W=>W.id===j.id))return Z;let J=[...Z,j];return m.current.set(C.current,J),S(W=>W+1),J}),null)));},[]),k=useCallback((j,Z)=>{!e||r!=="laser"||p({x:j,y:Z});},[e,r]),N=useCallback(()=>{p(null);},[]),F=useCallback((j,Z)=>{!e||r!=="eraser"||y(J=>{let W=J.filter(te=>!te.points.some(se=>{let Ce=se.x-j,ee=se.y-Z;return Ce*Ce+ee*ee<Uce*Uce}));return W.length>0?m.current.set(C.current,W):m.current.delete(C.current),S(te=>te+1),W});},[e,r]),B=useCallback(()=>{y([]),d(null),w.current=false,m.current.delete(C.current),S(j=>j+1);},[]),D=useCallback(()=>{y([]),d(null),w.current=false,m.current.clear(),S(j=>j+1);},[]),O=useRef(0);useEffect(()=>{if(!e){h(false),o("none"),d(null),p(null);return}let j=()=>{h(true),window.clearTimeout(O.current),O.current=window.setTimeout(()=>{h(false);},3e3);};return window.addEventListener("mousemove",j),()=>{window.removeEventListener("mousemove",j),window.clearTimeout(O.current);}},[e]);let U=useCallback(()=>{let j=new Map(m.current);return x.length>0&&j.set(n,x),j},[x,n]),H=v>=0&&(x.length>0||m.current.size>0);return {presentationTool:r,setPresentationTool:E,penColor:i,setPenColor:s,highlighterColor:a,setHighlighterColor:l,annotationStrokes:x,currentStroke:c,laserPosition:u,toolbarVisible:f,setToolbarVisible:h,handlePointerDown:M,handlePointerMove:A,handlePointerUp:R,handleLaserMove:k,handleLaserLeave:N,clearAnnotations:B,eraseAtPoint:F,allSlideAnnotations:U(),hasAnyAnnotations:H,clearAllAnnotations:D}}function zce(t){return !!t.loopContinuously||t.showType==="kiosk"}function Gce(t,e){return t.map((n,r)=>{let o=e[r];return typeof o!="number"?n:{...n,transition:{...n.transition,type:n.transition?.type??"none",advanceAfterMs:o}}})}function Vce(t,e){return Math.max(0,t||0)+e*60}function iS(t,e,n,r){for(let o of t.steps)o.stopSound?kN():o.soundPath&&e&&e(o.soundPath);n(o=>{let i=new Map(o);for(let s of t.steps){let a=i.get(s.elementId)??{visible:true},l=s.presetClass==="exit"?a.visible:true;i.set(s.elementId,{visible:l,cssAnimation:s.cssAnimation});}return i});for(let o of t.steps){let i=window.setTimeout(()=>{n(s=>{let a=new Map(s),l=a.get(o.elementId)??{visible:true},c=o.presetClass==="exit"?false:l.visible;return a.set(o.elementId,{visible:c,cssAnimation:void 0}),a});},Math.max(0,o.delayMs+o.durationMs+8));r.current.push(i);}}function Xce(t){let{slides:e,onPlayActionSound:n,showWithAnimation:r}=t,o=r!==false,[i,s]=useState([]),[a,l]=useState(new Map),[c,d]=useState(""),[u,p]=useState(new Set),[f,h]=useState(new Set),m=useRef([]),x=useRef(null),y=useCallback(()=>{m.current.forEach(A=>{window.clearTimeout(A);}),m.current=[];},[]),v=useCallback(A=>{if(!A.shouldAutoAdvance())return;let R=A.getAutoAdvanceDelay(),k=A.peekNext();if(!k)return;let N=R+(k.autoAdvanceDelayMs??0),F=window.setTimeout(()=>{let B=A.advance();B&&(iS(B,n,l,m),v(A));},Math.max(0,N));m.current.push(F);},[n]),S=useCallback(A=>{let R=e[A];if(!R){x.current=null,l(new Map),d(""),p(new Set),h(new Set);return}let k=R.nativeAnimations??[],N=new Map;for(let O of k)if(O.buildType&&O.buildType!=="allAtOnce"&&O.targetId){let U=R.elements.find(H=>H.id===O.targetId);U&&ot(U)&&U.textSegments&&U.textSegments.length>0&&N.set(O.targetId,hF(U.textSegments));}let F=N.size>0?mF(k,N):k,B=C1.fromAnimations(F);x.current=B,d(B.getTimeline().keyframesCss),p(B.getInteractiveTriggerShapeIds()),h(B.getHoverTriggerShapeIds());let D=R.elements.map(O=>O.id);for(let O of F)O.targetId&&O.targetId.includes(_l)&&D.push(O.targetId);l(B.getElementStates(D));},[e]),w=useCallback(()=>{if(!o)return false;let A=x.current;if(!A||!A.hasMoreSteps())return false;let R=A.advance();return R?(iS(R,n,l,m),v(A),true):false},[o,n,v]),C=useCallback(A=>{let R=x.current;if(!R||!R.hasInteractiveSequence(A))return false;let k=R.advanceInteractive(A);return k?(iS(k,n,l,m),true):false},[n]),T=useCallback(A=>{if(!o)return false;let R=x.current;if(!R||!R.hasHoverSequence(A))return false;R.resetHover(A);let k=R.advanceHover(A);return k?(iS(k,n,l,m),true):false},[o,n]),E=useCallback(A=>{let R=x.current;!R||!R.hasHoverSequence(A)||R.resetHover(A);},[]),M=useCallback(A=>{if(y(),!o){x.current=null,s([]),l(new Map),d(""),p(new Set),h(new Set);return}S(A);let R=e[A];if(!R){s([]);return}let k=x.current;if(k&&k.hasMoreSteps()){let F=k.peekNext();if(F&&F.autoAdvance){let B=window.setTimeout(()=>{let D=k.advance();D&&(iS(D,n,l,m),v(k));},F.autoAdvanceDelayMs??0);m.current.push(B);}}let N=[...R.animations||[]].filter(F=>!!F.entrance).sort((F,B)=>(F.order||Number.MAX_SAFE_INTEGER)-(B.order||Number.MAX_SAFE_INTEGER));if(N.length===0){s([]);return}s(N.map(F=>({elementId:F.elementId,state:"hidden",animation:F}))),N.forEach((F,B)=>{let D=Vce(F.delayMs,B),O=window.setTimeout(()=>{s(U=>U.map(H=>H.elementId===F.elementId?{...H,state:"visible"}:H));},D);m.current.push(O);});},[o,y,S,e,n,v]);return {presentationAnimations:i,presentationElementStates:a,presentationKeyframesCss:c,interactiveTriggerShapeIds:u,hoverTriggerShapeIds:f,clearPresentationTimers:y,playNextAnimationGroup:w,handleInteractiveShapeClick:C,handleHoverStart:T,handleHoverEnd:E,runPresentationEntranceAnimations:M,presentationTimersRef:m}}var JKe="pptx-viewer-audience";var sS="content",Wce="pptx-bytes";function Yce(){return new Promise((t,e)=>{let n=indexedDB.open(JKe,1);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(sS)||r.createObjectStore(sS);},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function qce(t){let e=await Yce();return new Promise((n,r)=>{let o=e.transaction(sS,"readwrite"),i=o.objectStore(sS),a={bytes:t instanceof Uint8Array?t:new Uint8Array(t),createdAt:Date.now()};i.put(a,Wce),o.oncomplete=()=>{e.close(),n();},o.onerror=()=>{e.close(),r(o.error);};})}async function _M(){try{let t=await Yce();return new Promise(e=>{let n=t.transaction(sS,"readwrite");n.objectStore(sS).delete(Wce),n.oncomplete=()=>{t.close(),e();},n.onerror=()=>{t.close(),e();};})}catch{}}var KH="pptx-viewer-presenter",DN="#pptx-audience",LN="pptx-viewer-presenter",Kce="nonce";function QKe(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`s${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`}function Zce(){let t=window.location.hash;if(!t.startsWith(DN))return null;let e=t.slice(DN.length);return e?new URLSearchParams(e.replace(/^[&;?]/,"")).get(Kce):null}function ZH(){return window.location.hash.startsWith(DN)}function Jce(t){let{currentSlideIndex:e,isPresenterMode:n,content:r}=t,o=useRef(null),i=useRef(null),s=useRef(null),a=useRef(""),l=useCallback(()=>(i.current||(i.current=new BroadcastChannel(KH)),i.current),[]),c=useCallback(()=>o.current!==null&&!o.current.closed,[]),d=useCallback(f=>{if(!a.current)return;let h={origin:LN,type:"presenter-slide-change",slideIndex:f,sessionId:a.current};try{l().postMessage(h);}catch{}},[l]),u=useCallback(()=>{if(a.current)try{let h={origin:LN,type:"presenter-exit",sessionId:a.current};l().postMessage(h);}catch{}let f=o.current;if(f&&!f.closed)try{f.close();}catch{}o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null),_M();},[l]),p=useCallback(()=>{c()&&u();let f=window.open("about:blank","_blank");if(!f)return false;o.current=f;let h=QKe();a.current=h;let m=new URL(window.location.href),x=new URLSearchParams;x.set(Kce,h),m.hash=`${DN}&${x.toString()}`;let y=v=>{let S=o.current;if(!(!S||S.closed)){if(!v){try{S.close();}catch{}o.current=null,a.current="";return}try{S.location.replace(m.toString());}catch{try{S.close();}catch{}o.current=null,a.current="";}}};return r?qce(r).then(()=>y(true)).catch(()=>y(false)):y(true),window.setTimeout(()=>d(e),1500),s.current=setInterval(()=>{let v=o.current;(!v||v.closed)&&(o.current=null,a.current="",s.current!==null&&(clearInterval(s.current),s.current=null));},1e3),true},[c,u,d,e,r]);return useEffect(()=>{n&&c()&&d(e);},[e,n,c,d]),useEffect(()=>()=>{u();try{i.current?.close();}catch{}},[u]),useEffect(()=>{n||u();},[n,u]),useEffect(()=>{let f=()=>{_M();};return window.addEventListener("beforeunload",f),()=>window.removeEventListener("beforeunload",f)},[]),{openAudienceWindow:p,closeAudienceWindow:u,isAudienceWindowOpen:c,syncSlideToAudience:d}}function ede(t){let{onSetMode:n,onSetActiveSlideIndex:r,containerRef:o}=t,i=useRef(false);useEffect(()=>{if(!ZH()||i.current)return;i.current=true;let s=window.setTimeout(()=>{try{let a=o.current;a&&typeof a.requestFullscreen=="function"&&a.requestFullscreen().catch(()=>{});}catch{}n("present");},800);return ()=>window.clearTimeout(s)},[o,n]),useEffect(()=>{if(!ZH())return;let s=Zce(),a;try{a=new BroadcastChannel(KH);}catch{return}return a.onmessage=l=>{let c=l.data;if(!(!c||c.origin!==LN)&&!(s&&c.sessionId!==s)&&(c.type==="presenter-slide-change"&&r(c.slideIndex),c.type==="presenter-exit")){_M(),n("edit");try{window.close();}catch{}}},()=>{try{a.close();}catch{}}},[n,r]);}function tde(t,e){return t==="Escape"?{action:"exit"}:t==="ArrowRight"||t==="PageDown"||t===" "?{action:"next"}:t==="ArrowLeft"||t==="PageUp"?{action:"prev"}:t==="l"||t==="L"?{action:"toggleLaser"}:t==="p"||t==="P"?{action:"togglePen"}:t==="e"||t==="E"?{action:"toggleEraser"}:t==="m"&&e?{action:"toggleToolbar"}:t==="n"||t==="N"?{action:"togglePresenterView"}:{action:"none"}}function nde(t){let{mode:e,movePresentationSlide:n,onSetMode:r,onToggleLaser:o,onTogglePen:i,onToggleEraser:s,onToggleToolbar:a,onTogglePresenterView:l,rehearsing:c,recordCurrentSlideTime:d,presentationSlideIndex:u,setShowRehearsalSummary:p}=t;useEffect(()=>{if(e!=="present")return;let f=h=>{let m=tde(h.key,h.ctrlKey);if(m.action!=="none")switch(h.preventDefault(),m.action){case "exit":c&&(d(u),p(true)),r("edit");return;case "next":n(1);return;case "prev":n(-1);return;case "toggleLaser":o?.();return;case "togglePen":i?.();return;case "toggleEraser":s?.();return;case "toggleToolbar":a?.();return;case "togglePresenterView":l?.();break}};return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f);}},[e,n,r,o,i,s,a,l,c,d,u,p]);}function ode(t){let{containerRef:e,onSetMode:n,onSaveRehearsalTimings:r,setPresentationStartTime:o,setPresenterMode:i}=t,[s,a]=useState(false),[l,c]=useState({}),[d,u]=useState(null),[p,f]=useState(false),[h,m]=useState(false),x=useRef(0),y=useRef(null),v=useCallback(E=>{if(d===null)return;let M=x.current;y.current!==null&&(M+=Date.now()-y.current);let A=Date.now()-d-M;c(R=>({...R,[E]:Math.max(0,A)})),x.current=0,y.current=h?Date.now():null,u(Date.now());},[d,h]),S=useCallback(()=>{f(false),a(false),c({});},[]),w=useCallback(()=>{r?.(l),f(false),a(false);},[r,l]),C=useCallback(()=>{i(false),a(true),c({}),m(false),f(false),x.current=0,y.current=null;let E=Date.now();o(E),u(E);try{let M=e.current;M&&typeof M.requestFullscreen=="function"&&M.requestFullscreen().catch(()=>{});}catch{}n("present");},[e,n,o,i]),T=useCallback(()=>{m(E=>(E?y.current!==null&&(x.current+=Date.now()-y.current,y.current=null):y.current=Date.now(),!E));},[]);return {rehearsing:s,setRehearsing:a,recordedTimings:l,slideStartTime:d,showRehearsalSummary:p,setShowRehearsalSummary:f,rehearsalPaused:h,recordCurrentSlideTime:v,dismissRehearsalSummary:S,saveRehearsalTimings:w,enterRehearsalMode:C,toggleRehearsalPause:T}}function ide(t,e){let n=t.action||"";if(t.soundPath&&e.onPlayActionSound&&e.onPlayActionSound(t.soundPath),typeof t.targetSlideIndex=="number"){let r=Math.max(0,Math.min(e.slidesLength-1,Math.floor(t.targetSlideIndex)));e.slidesLength>0&&e.navigateToSlide(r);return}if(n.includes("hlinkshowjump")){let r=n.toLowerCase();r.includes("nextslide")?e.movePresentationSlide(1):r.includes("previousslide")?e.movePresentationSlide(-1):r.includes("firstslide")?e.navigateToSlide(0):r.includes("lastslide")?e.navigateToSlide(e.slidesLength-1):r.includes("endshow")&&e.onSetMode("edit");return}n.includes("hlinksldjump")||t.url&&!n.includes("hlinksldjump")&&Wb(t.url)&&window.open(t.url,"_blank","noopener,noreferrer");}function JH(t,e){let n=e.slides[e.currentSlideIndex];n?.transition?.soundPath&&e.onPlayActionSound&&e.onPlayActionSound(n.transition.soundPath);let r=Math.max(120,n?.transition?.durationMs||320);e.setPresentationSlideVisible(false),e.clearPresentationTimers();let o=window.setTimeout(()=>{e.setPresentationSlideIndex(t),e.onSetActiveSlideIndex(t),e.setPresentationSlideVisible(true),e.runPresentationEntranceAnimations(t),e.scheduleAutoAdvanceForSlide?.(t);},Math.min(r,480));e.presentationTimersRef.current.push(o);}function sde(t){let{slides:e,visibleSlideIndexes:n,presentationSlideIndex:r,setPresentationSlideIndex:o,setPresentationSlideVisible:i,onSetMode:s,onSetActiveSlideIndex:a,onPlayActionSound:l,loopContinuously:c,useTimings:d,playNextAnimationGroup:u,clearPresentationTimers:p,runPresentationEntranceAnimations:f,presentationTimersRef:h,rehearsing:m,recordCurrentSlideTime:x,setShowRehearsalSummary:y}=t,v=useRef(()=>{}),S=useCallback(E=>{if(d===false)return;let A=e[E]?.transition?.advanceAfterMs;if(typeof A!="number"||!Number.isFinite(A)||A<0)return;let R=window.setTimeout(()=>{v.current(1);},Math.max(0,A));h.current.push(R);},[e,h,d]),w=useCallback(E=>{if(E===1&&u())return;let M=n.length>0?n:e.map((B,D)=>D);if(M.length===0)return;let A=M.indexOf(r),k=(A>=0?A:0)+E;if(m&&E===1&&k>=M.length){x(r);try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}s("edit"),y(true);return}let N;c&&!m&&E===1&&k>=M.length?N=0:N=Math.min(M.length-1,Math.max(0,k));let F=M[N];F===void 0||F===r||(m&&E===1&&x(r),JH(F,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:f,scheduleAutoAdvanceForSlide:m?void 0:S,presentationTimersRef:h}));},[p,c,l,a,s,u,r,h,x,m,f,S,y,e,n,i,o]);v.current=w;let C=useCallback(E=>{E<0||E>=e.length||E!==r&&JH(E,{slides:e,currentSlideIndex:r,onPlayActionSound:l,setPresentationSlideVisible:i,clearPresentationTimers:p,setPresentationSlideIndex:o,onSetActiveSlideIndex:a,runPresentationEntranceAnimations:f,scheduleAutoAdvanceForSlide:S,presentationTimersRef:h});},[p,l,a,r,h,f,S,e,o,i]),T=useCallback(E=>{ide(E,{movePresentationSlide:w,navigateToSlide:C,onPlayActionSound:l,onSetMode:s,slidesLength:e.length});},[w,C,l,s,e.length]);return {movePresentationSlide:w,navigateToSlide:C,handlePresentationAction:T,scheduleAutoAdvanceForSlide:S}}function ade(t){let{navigateToSlide:e}=t,n=useRef(null),r=useCallback((s,a)=>{n.current=a,e(s);},[e]),o=useCallback(()=>{let s=n.current;return s===null?false:(n.current=null,e(s),true)},[e]),i=useCallback(()=>{n.current=null;},[]);return {handleZoomClick:r,zoomReturnSlideIndex:n,returnToZoomSlide:o,clearZoomReturn:i}}function lde(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:f,onSaveRehearsalTimings:h,loopContinuously:m,showWithAnimation:x,useTimings:y}=t,[v,S]=useState(0),[w,C]=useState(true),[T,E]=useState(false),[M,A]=useState(null),R=useRef(false),{presentationAnimations:k,presentationElementStates:N,presentationKeyframesCss:F,interactiveTriggerShapeIds:B,hoverTriggerShapeIds:D,clearPresentationTimers:O,playNextAnimationGroup:U,handleInteractiveShapeClick:H,handleHoverStart:j,handleHoverEnd:Z,runPresentationEntranceAnimations:J,presentationTimersRef:W}=Xce({slides:n,onPlayActionSound:c,showWithAnimation:x}),{rehearsing:te,setRehearsing:se,recordedTimings:Ce,slideStartTime:ee,showRehearsalSummary:ce,setShowRehearsalSummary:de,rehearsalPaused:Ne,recordCurrentSlideTime:Ue,dismissRehearsalSummary:he,saveRehearsalTimings:Be,enterRehearsalMode:Me,toggleRehearsalPause:ge}=ode({containerRef:i,onSetMode:a,onSaveRehearsalTimings:h,setPresentationStartTime:A,setPresenterMode:E}),{movePresentationSlide:Te,navigateToSlide:be,handlePresentationAction:xe,scheduleAutoAdvanceForSlide:Pe}=sde({slides:n,visibleSlideIndexes:r,presentationSlideIndex:v,setPresentationSlideIndex:S,setPresentationSlideVisible:C,onSetMode:a,onSetActiveSlideIndex:l,onPlayActionSound:c,loopContinuously:m,useTimings:y,playNextAnimationGroup:U,clearPresentationTimers:O,runPresentationEntranceAnimations:J,presentationTimersRef:W,rehearsing:te,recordCurrentSlideTime:Ue,setShowRehearsalSummary:de}),{handleZoomClick:Xe,zoomReturnSlideIndex:Y,returnToZoomSlide:Ge,clearZoomReturn:Ve}=ade({navigateToSlide:be}),{openAudienceWindow:We,closeAudienceWindow:ke,isAudienceWindowOpen:wt,syncSlideToAudience:V}=Jce({currentSlideIndex:v,isPresenterMode:T,content:s});ede({onSetMode:a,onSetActiveSlideIndex:l,containerRef:i});let $=useCallback(()=>{E(false),se(false),A(Date.now());try{let ae=i.current;ae&&typeof ae.requestFullscreen=="function"&&ae.requestFullscreen().catch(()=>{});}catch{}a("present");},[i,a,se]),ie=useCallback(()=>{E(true),se(false),A(Date.now()),a("present");},[a,se]),ve=useCallback(()=>{if(T){E(false);try{let ae=i.current;ae&&typeof ae.requestFullscreen=="function"&&ae.requestFullscreen().catch(()=>{});}catch{}}else {R.current=true;try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}E(true),M||A(Date.now());}},[T,M,i]);nde({mode:e,movePresentationSlide:Te,onSetMode:a,onToggleLaser:d,onTogglePen:u,onToggleEraser:p,onToggleToolbar:f,onTogglePresenterView:ve,rehearsing:te,recordCurrentSlideTime:Ue,presentationSlideIndex:v,setShowRehearsalSummary:de});let De=useRef(J);De.current=J;let $e=useRef(Pe);$e.current=Pe;let ze=useRef(o);return ze.current=o,useEffect(()=>{if(e==="present"){let ae=ze.current;S(ae),De.current(ae),$e.current(ae);}},[e]),useEffect(()=>{if(e==="present")return ()=>{try{document.fullscreenElement&&document.exitFullscreen().catch(()=>{});}catch{}}},[e]),useEffect(()=>{if(e!=="present"||T)return;let ae=!!document.fullscreenElement,Se=()=>{if(R.current){R.current=false,ae=!!document.fullscreenElement;return}let Ye=!!document.fullscreenElement;ae&&!Ye&&(te&&(Ue(v),de(true)),a("edit")),ae=Ye;};return document.addEventListener("fullscreenchange",Se),()=>{document.removeEventListener("fullscreenchange",Se);}},[e,a,T,te,Ue,v,de]),useEffect(()=>{let ae=W;return ()=>{ae.current.forEach(Se=>{window.clearTimeout(Se);});}},[W]),{presentationSlideIndex:v,setPresentationSlideIndex:S,presentationSlideVisible:w,presentationAnimations:k,presentationElementStates:N,presentationKeyframesCss:F,clearPresentationTimers:O,runPresentationEntranceAnimations:J,movePresentationSlide:Te,navigateToSlide:be,handlePresentationAction:xe,handleInteractiveShapeClick:H,interactiveTriggerShapeIds:B,hoverTriggerShapeIds:D,handleHoverStart:j,handleHoverEnd:Z,enterPresentMode:$,presenterMode:T,enterPresenterView:ie,togglePresenterView:ve,presentationStartTime:M,rehearsing:te,enterRehearsalMode:Me,recordedTimings:Ce,slideStartTime:ee,showRehearsalSummary:ce,dismissRehearsalSummary:he,saveRehearsalTimings:Be,rehearsalPaused:Ne,toggleRehearsalPause:ge,handleZoomClick:Xe,zoomReturnSlideIndex:Y,returnToZoomSlide:Ge,clearZoomReturn:Ve,openAudienceWindow:We,closeAudienceWindow:ke,isAudienceWindowOpen:wt,syncSlideToAudience:V}}function dde(t){let{mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,mediaDataUrls:a,presentationProperties:l,setMode:c,setActiveSlideIndex:d,setSlides:u,history:p}=t,f=useRef(null),[,h]=useState(false),m=useRef("edit"),x=Hce({isActive:e==="present",activeSlideIndex:o});return {presentation:lde({mode:e,slides:n,visibleSlideIndexes:r,activeSlideIndex:o,containerRef:i,content:s,onSetMode:v=>{e==="present"&&v!=="present"&&x.hasAnyAnnotations?(m.current=v,h(true)):(e==="present"&&v!=="present"&&(Gb(),kN()),c(v));},onSetActiveSlideIndex:d,onPlayActionSound:v=>{(async()=>{if(!v)return;let S=a.get(v);if(S){try{new Audio(S).play().catch(()=>{});}catch{}return}let w=f.current;if(w)try{let C=await w.getImageData(v);if(!C)return;a.set(v,C),new Audio(C).play().catch(()=>{});}catch{}})();},onToggleLaser:()=>x.setPresentationTool("laser"),onTogglePen:()=>x.setPresentationTool("pen"),onToggleEraser:()=>x.setPresentationTool("eraser"),onToggleToolbar:()=>x.setToolbarVisible(!x.toolbarVisible),onSaveRehearsalTimings:v=>{u(S=>Gce(S,v)),p.markDirty();},loopContinuously:zce(l),showWithAnimation:l.showWithAnimation,useTimings:l.advanceMode!=="manual"}),annotations:x,actionSoundHandlerRef:f}}function cZe(){return typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function dZe(){return false}function uZe(t){if(typeof window>"u")return ()=>{};let e=window.matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function ude(){let t=useSyncExternalStore(uZe,cZe,dZe),[e,n]=useState(false),r=t||e,o=useCallback(()=>{n(i=>!i);},[]);return useEffect(()=>{let i=document.documentElement;return r?i.classList.add("pptx-reduced-motion"):i.classList.remove("pptx-reduced-motion"),()=>{i.classList.remove("pptx-reduced-motion");}},[r]),{osReducedMotion:t,manualReducedMotion:e,reducedMotion:r,toggleReducedMotion:o,setManualReducedMotion:n}}var pZe=120,fZe=400,hZe=180,mZe=220,gZe=480,xZe=288,yZe=60,bZe=400,vZe=120;function pde(){let[t,e]=useState(hZe),[n,r]=useState(xZe),[o,i]=useState(vZe),s=useCallback(c=>{e(d=>Math.min(fZe,Math.max(pZe,d+c)));},[]),a=useCallback(c=>{r(d=>Math.min(gZe,Math.max(mZe,d-c)));},[]),l=useCallback(c=>{i(d=>Math.min(bZe,Math.max(yZe,d-c)));},[]);return {leftWidth:t,rightWidth:n,bottomHeight:o,onResizeLeft:s,onResizeRight:a,onResizeBottom:l}}var CZe=50,TZe=100,MZe=500,fde=10;function hde(t,e){let n=t.clientX-e.clientX,r=t.clientY-e.clientY;return Math.sqrt(n*n+r*r)}function _Ze(t){return Math.min(Math.max(t,.2),5)}function mde(t){let{targetRef:e,currentScale:n,callbacks:r,enabled:o=true}=t,i=useRef(r);i.current=r;let s=useRef(n);s.current=n;let[a,l]=useState(0),c=useRef(null);e.current!==c.current&&(c.current=e.current,queueMicrotask(()=>l(d=>d+1))),useEffect(()=>{let d=e.current;if(!d||!o)return;let u=0,p=1,f=false,h=0,m=0,x=null,y=0,v=0,S=()=>{x!==null&&(clearTimeout(x),x=null);},w=M=>{M.touches.length===2?(f=true,u=hde(M.touches[0],M.touches[1]),p=s.current,S(),M.preventDefault()):M.touches.length===1&&(h=M.touches[0].clientX,m=M.touches[0].clientY,y=M.touches[0].clientX,v=M.touches[0].clientY,S(),x=setTimeout(()=>{x=null,i.current.onLongPress?.(y,v);},MZe));},C=M=>{if(M.touches.length===2&&f){M.preventDefault();let A=hde(M.touches[0],M.touches[1]);if(u>0){let R=A/u,k=_Ze(p*R);i.current.onPinchZoom?.(k);}}else if(M.touches.length===1){let A=M.touches[0].clientX-y,R=M.touches[0].clientY-v;(Math.abs(A)>fde||Math.abs(R)>fde)&&S();}},T=M=>{if(f){f=false,u=0;return}if(S(),M.changedTouches.length===1&&M.touches.length===0){let A=M.changedTouches[0].clientX,R=M.changedTouches[0].clientY,k=A-h,N=R-m;Math.abs(k)>=CZe&&Math.abs(N)<TZe&&i.current.onSwipe?.(k>0?1:-1);}},E=()=>{f=false,u=0,S();};return d.addEventListener("touchstart",w,{passive:false}),d.addEventListener("touchmove",C,{passive:false}),d.addEventListener("touchend",T,{passive:true}),d.addEventListener("touchcancel",E,{passive:true}),()=>{d.removeEventListener("touchstart",w),d.removeEventListener("touchmove",C),d.removeEventListener("touchend",T),d.removeEventListener("touchcancel",E),S();}},[e,o,a]);}function RM(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function oz(t,e){try{return window.prompt(t,e)}catch{return null}}function gde(t){try{return window.confirm(t)}catch{return false}}function EZe(t){if(typeof t!="string"||t.trim().length===0)return "presentation.pptx";let e=t.replace(/[\x00-\x1f\x7f"\\/:*?<>|]/g,"_").replace(/\.\./g,"__").replace(/^\.+/,"").trim();if(e.length===0)return "presentation.pptx";if(e.length>200){let n=e.lastIndexOf(".");if(n>0&&e.length-n<=16){let r=e.slice(n);e=e.slice(0,200-r.length)+r;}else e=e.slice(0,200);}return e}function $N(t,e){let n=EZe(e),r=URL.createObjectURL(t),o=document.createElement("a");o.href=r,o.download=n,document.body.appendChild(o),o.click(),setTimeout(()=>{document.body.removeChild(o),URL.revokeObjectURL(r);},200);}function xde(t){let{activeSlide:e,customShows:n,activeCustomShowId:r,setCustomShows:o,setActiveCustomShowId:i,history:s}=t,a=()=>{let f=oz("Custom show name","Custom Show")?.trim()||`Custom Show ${n.length+1}`,h=`custShow-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,m=e?.rId&&e.rId.length>0?[e.rId]:[];o(x=>[...x,{id:h,name:f,slideRIds:m}]),i(h),s.markDirty();},l=()=>{if(!r)return;let p=n.find(h=>h.id===r);if(!p)return;let f=oz("Rename custom show",p.name)?.trim();f&&(o(h=>h.map(m=>m.id===p.id?{...m,name:f}:m)),s.markDirty());},c=()=>{let p=r;if(!p)return;let f=n.find(h=>h.id===p);f&&gde(`Delete custom show "${f.name}"?`)&&(o(h=>h.filter(m=>m.id!==p)),i(null),s.markDirty());},d=()=>{let p=r,f=e?.rId;!p||!f||(o(h=>h.map(m=>{if(m.id!==p)return m;let x=m.slideRIds.includes(f);return {...m,slideRIds:x?m.slideRIds.filter(y=>y!==f):[...m.slideRIds,f]}})),s.markDirty());},u=useMemo(()=>{if(!r||!e?.rId)return false;let p=n.find(f=>f.id===r);return p?p.slideRIds.includes(e.rId):false},[r,e?.rId,n]);return {handleCreateCustomShow:a,handleRenameActiveCustomShow:l,handleDeleteActiveCustomShow:c,handleToggleCurrentSlideInActiveShow:d,isCurrentSlideInActiveShow:u}}function bde(t){let{mode:e,slides:n,activeSlide:r,canvasSize:o,containerRef:i,customShows:s,activeCustomShowId:a,setCustomShows:l,setActiveCustomShowId:c,setGuides:d,setPresentationProperties:u,setAccessibilityIssues:p,setIsAccessibilityPanelOpen:f,setMode:h,setPreMasterMode:m,setActiveMasterIndex:x,setActiveLayoutIndex:y,setSelectedElementId:v,setSelectedElementIds:S,preMasterMode:w,hasDigitalSignatures:C,isDirty:T,history:E}=t,[M,A]=useState(false),[R,k]=useState(false),[N,F]=useState(false),[B,D]=useState(false),[O,U]=useState(false),[H,j]=useState(false),[Z,J]=useState(false),[W,te]=useState(false),se=useRef(false),[Ce,ee]=useState(false),[ce,de]=useState(false),[Ne,Ue]=useState(false),[he,Be]=useState(null),[Me,ge]=useState(false),[Te,be]=useState(()=>typeof window<"u"?window.innerWidth<768:false);useEffect(()=>{let ie=()=>be(window.innerWidth<768),ve=null,De=0,$e=()=>{let ze=i.current;if(!ze){De=requestAnimationFrame($e);return}ve=new ResizeObserver(ae=>{let Se=ae[0];Se&&be(Se.contentRect.width<768);}),ve.observe(ze),be(ze.clientWidth<768);};return $e(),window.addEventListener("resize",ie),()=>{cancelAnimationFrame(De),ve?.disconnect(),window.removeEventListener("resize",ie);}},[]),useEffect(()=>{T&&C&&!se.current&&te(true);},[T,C]);let xe=useCallback(()=>{m(e==="master"?"edit":e),h("master"),x(0),y(null),v(null),S([]);},[e,m,h,x,y,v,S]),Pe=useCallback(()=>{h(w),v(null),S([]);},[w,h,v,S]),Xe=useCallback(ie=>{x(ie),y(null),v(null),S([]);},[x,y,v,S]),Y=useCallback((ie,ve)=>{x(ie),y(ve),v(null),S([]);},[x,y,v,S]),Ge=ie=>{let ve=ie==="h"?o.height/2:o.width/2;d(De=>[...De,{id:`guide-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,axis:ie,position:ve}]);},Ve=xde({activeSlide:r,customShows:s,activeCustomShowId:a,setCustomShows:l,setActiveCustomShowId:c,history:E}),We=useCallback(ie=>{u(ie),E.markDirty();},[u,E]),ke=useCallback(()=>{u(ie=>({...ie,showSubtitles:!ie.showSubtitles})),E.markDirty();},[u,E]),wt=useCallback(ie=>{Ue(true);},[]),V=useCallback(()=>{Ue(false);},[]);return {isSmartArtDialogOpen:M,setIsSmartArtDialogOpen:A,isEquationDialogOpen:R,setIsEquationDialogOpen:k,isHyperlinkDialogOpen:N,setIsHyperlinkDialogOpen:F,isPasswordDialogOpen:B,setIsPasswordDialogOpen:D,isDocPropsDialogOpen:O,setIsDocPropsDialogOpen:U,isFontEmbeddingOpen:H,setIsFontEmbeddingOpen:j,isDigitalSigDialogOpen:Z,setIsDigitalSigDialogOpen:J,isSignatureStrippedDialogOpen:W,setIsSignatureStrippedDialogOpen:te,isSetUpSlideShowOpen:Ce,setIsSetUpSlideShowOpen:ee,isBroadcastDialogOpen:ce,setIsBroadcastDialogOpen:de,isPasswordProtected:Ne,editingEquationOmml:he,setEditingEquationOmml:Be,embedFontsEnabled:Me,setEmbedFontsEnabled:ge,isNarrowViewport:Te,handleEnterMasterView:xe,handleCloseMasterView:Pe,handleSelectMaster:Xe,handleSelectLayout:Y,handleAddGuide:Ge,...Ve,handleSaveSlideShowSettings:We,handleToggleSubtitles:ke,handleSetPassword:wt,handleRemovePassword:V,handleRunAccessibilityCheck:()=>{let ie=[];n.forEach((ve,De)=>{for(let $e of ve.elements)($e.type==="image"||$e.type==="picture")&&!("altText"in $e&&$e.altText)&&ie.push({slideIndex:De,elementId:$e.id,severity:"warning",message:"Image missing alt text"});}),ie.length>0&&console.info(`[Accessibility] Found ${ie.length} issue(s):`,ie),p(ie),f(true);}}}function vde(t){let{mode:e,presentation:n,annotations:r,history:o,setMode:i,setSlides:s}=t,[a,l]=useState(false),c=useRef("edit"),d=useCallback(m=>{m==="present"?n.enterPresentMode():e==="present"&&r.hasAnyAnnotations?(Gb(),c.current=m,l(true)):(e==="present"&&Gb(),i(m));},[n,e,r.hasAnyAnnotations,i]),u=useCallback(()=>{let m=r.allSlideAnnotations;if(m.size===0){l(false),i(c.current),r.clearAllAnnotations();return}s(x=>x.map((y,v)=>{let S=m.get(v);if(!S||S.length===0)return y;let w=S.map(C=>{let T=1/0,E=1/0,M=-1/0,A=-1/0;for(let B of C.points)B.x<T&&(T=B.x),B.y<E&&(E=B.y),B.x>M&&(M=B.x),B.y>A&&(A=B.y);let R=Math.max(M-T,1),k=Math.max(A-E,1),N=[];for(let B=0;B<C.points.length;B++){let D=C.points[B],O=D.x-T,U=D.y-E;N.push(B===0?`M ${O} ${U}`:`L ${O} ${U}`);}let F=C.opacity<1?"highlighter":"pen";return {id:`ink-annotation-${C.id}`,type:"ink",x:T,y:E,width:R,height:k,inkPaths:[N.join(" ")],inkColors:[C.color],inkWidths:[C.width],inkOpacities:[C.opacity],inkTool:F}});return {...y,elements:[...y.elements,...w]}})),o.markDirty(),r.clearAllAnnotations(),l(false),i(c.current);},[r,i,s,o]),p=useCallback(()=>{r.clearAllAnnotations(),l(false),i(c.current);},[r,i]),f=useCallback(()=>{n.enterPresenterView();},[n]),h=useCallback(()=>{n.enterRehearsalMode();},[n]);return {showKeepAnnotationsDialog:a,handleSetMode:d,handleKeepAnnotations:u,handleDiscardAnnotations:p,handleEnterPresenterView:f,handleEnterRehearsalMode:h}}function Sde(t){return Math.max(t,10)*1e3}var LZe="pptx-viewer-autosave",FZe=1,cS="recoveryVersions";function Cde(){return new Promise((t,e)=>{let n=indexedDB.open(LZe,FZe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(cS)||r.createObjectStore(cS,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function BZe(){let t=await Cde();return new Promise(e=>{try{let n=t.transaction(cS,"readwrite"),r=n.objectStore(cS),o=null,i=1/0,s=r.openCursor();s.onsuccess=()=>{let a=s.result;if(a){let l=a.value;typeof l.timestamp=="number"&&l.timestamp<i&&(i=l.timestamp,o=a.primaryKey),a.continue();}else o!==null&&r.delete(o);},n.oncomplete=()=>{t.close(),e(o!==null);},n.onerror=()=>{t.close(),e(!1);};}catch{try{t.close();}catch{}e(false);}})}function wde(t,e){return Cde().then(n=>new Promise((r,o)=>{let i=n.transaction(cS,"readwrite");i.objectStore(cS).put({key:t,data:e,timestamp:Date.now(),size:e.byteLength}),i.oncomplete=()=>{n.close(),r(true);},i.onerror=()=>{n.close(),o(i.error);};}))}async function OZe(t,e){try{return await wde(t,e)}catch(n){if((n instanceof Error||n instanceof DOMException?n.name:"")!=="QuotaExceededError"||!await BZe())throw n;return wde(t,e)}}function Tde(t){let{isDirty:e,filePath:n,serializeSlides:r,intervalSeconds:o=120,enabled:i=true}=t,[s,a]=useState({state:"idle"}),l=useRef(e),c=useRef(n),d=useRef(r),u=useRef(false);useEffect(()=>{l.current=e;},[e]),useEffect(()=>{c.current=n;},[n]),useEffect(()=>{d.current=r;},[r]);let p=useCallback(async()=>{if(c.current&&l.current&&!u.current){u.current=true,a({state:"saving"});try{let f=await d.current();if(!f){a({state:"idle"}),u.current=!1;return}await OZe(c.current,f),a({state:"saved",timestamp:Date.now()});}catch(f){a({state:"error",message:f instanceof Error?f.message:"Autosave failed"});}finally{u.current=false;}}},[]);return useEffect(()=>{if(!i||!n)return;let f=Sde(o),h=setInterval(()=>{p();},f);return ()=>clearInterval(h)},[i,n,o,p]),{autosaveStatus:s,triggerAutosave:p}}var Mde={"Atkinson Hyperlegible":"Atkinson+Hyperlegible:wght@400;700",Roboto:"Roboto:wght@400;700","Open Sans":"Open+Sans:wght@400;700",Lato:"Lato:wght@400;700",Montserrat:"Montserrat:wght@400;700",Poppins:"Poppins:wght@400;700",Raleway:"Raleway:wght@400;700",Nunito:"Nunito:wght@400;700","Playfair Display":"Playfair+Display:wght@400;700","Source Sans Pro":"Source+Sans+Pro:wght@400;700","PT Sans":"PT+Sans:wght@400;700",Merriweather:"Merriweather:wght@400;700",Ubuntu:"Ubuntu:wght@400;700",Oswald:"Oswald:wght@400;700","Noto Sans":"Noto+Sans:wght@400;700","Fira Sans":"Fira+Sans:wght@400;700",Inter:"Inter:wght@400;700","Work Sans":"Work+Sans:wght@400;700",Quicksand:"Quicksand:wght@400;700",Cabin:"Cabin:wght@400;700"},_de="pptx-embedded-fonts",Ede="pptx-google-fonts",Ade="pptx-symbol-font-fallback",$Ze=["Wingdings","Wingdings 2","Wingdings 3","Symbol","Webdings"];function HZe(t){let e=new Set;for(let n of t)for(let r of n.elements)if(ot(r)&&r.textSegments)for(let o of r.textSegments)o.style.fontFamily&&e.add(o.style.fontFamily);return e}var Pde=/["\\\n\r;}<>]/,zZe=new Set(["truetype","opentype","woff","woff2","svg","embedded-opentype"]),GZe=/^data:font\/[a-z0-9+.-]+(?:;charset=[a-z0-9-]+)?;base64,[A-Za-z0-9+/=]+$/i;function VZe(t){return typeof t!="string"||t.length===0?false:t.startsWith("blob:")?true:GZe.test(t)}function Rde({embeddedFonts:t,slides:e}){useEffect(()=>{if(!t.length)return;let r=document.createElement("style");r.id=_de;let o=t.flatMap(i=>{if(typeof i.name!="string"||i.name.length===0||Pde.test(i.name))return [];if(!VZe(i.dataUrl))return [];let s=i.format??"truetype";if(!zZe.has(s))return [];let a=i.bold?"700":"400",l=i.italic?"italic":"normal";return [`@font-face {
|
|
4679
4679
|
font-family: "${i.name}";
|
|
4680
4680
|
src: url("${i.dataUrl}") format("${s}");
|
|
4681
4681
|
font-weight: ${a};
|
|
@@ -4803,7 +4803,7 @@ ${h}
|
|
|
4803
4803
|
</html>`),i.document.close(),i.focus(),setTimeout(()=>{i.print();},300),true}function yJe(t){let e=window.open("","_blank","noopener,noreferrer");return e?(e.document.open(),e.document.write(t),e.document.close(),e.focus(),setTimeout(()=>{e.print();},300),true):false}function Gde(t){let{slides:e,activeSlideIndex:n,canvasStageRef:r,setActiveSlideIndex:o,pptxData:i}=t,[s,a]=useState(false),l=()=>{a(true);},c=async u=>{if(a(false),!i||u.printWhat!=="slides")return d(u);let p=u.colorMode==="grayscale"?"filter: grayscale(1);":u.colorMode==="blackAndWhite"?"filter: grayscale(1) contrast(2);":"",f=(()=>{if(u.slideRange==="current")return [n];if(u.slideRange==="custom"){let h=Math.max(0,u.customRangeFrom-1),m=Math.min(e.length-1,u.customRangeTo-1);return Array.from({length:m-h+1},(x,y)=>h+y)}return Array.from({length:e.length},(h,m)=>m)})();try{let h=Ez(i,{slideIndices:f});if(h.length===0)return;let m=Az(h,i.width,i.height,{title:"Slides (Vector)",orientation:u.orientation,colorFilter:p});yJe(m);}catch(h){return console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:",h),d(u)}},d=async u=>{a(false);let p=u.colorMode==="grayscale"?"filter: grayscale(1);":u.colorMode==="blackAndWhite"?"filter: grayscale(1) contrast(2);":"",f=(()=>{if(u.slideRange==="current")return [n];if(u.slideRange==="custom"){let h=Math.max(0,u.customRangeFrom-1),m=Math.min(e.length-1,u.customRangeTo-1);return Array.from({length:m-h+1},(x,y)=>h+y)}return Array.from({length:e.length},(h,m)=>m)})();if(u.printWhat==="outline"){let h=f.map(m=>{let x=e[m];if(!x)return "";let y=x.elements?.find(w=>"text"in w&&w.text),v=y&&"text"in y?String(y.text):`Slide ${m+1}`,S=x.notes?.trim()||"";return `<h2>${RM(v)}</h2>${S?`<p>${RM(S)}</p>`:""}`}).join("");jN("Outline",`<div class="outline-page">${h}</div>`,u.orientation,p,u.frameSlides);return}try{if(!r.current)return;let h=await Sz(r,e.length,o,n,{scale:3});if(h.length===0)return;let m=f.map(x=>h[x]).filter(Boolean);if(u.printWhat==="slides"){let x=m.map((y,v)=>`<section class="page slide-page"><img class="slide-img" src="${VN(y)}" alt="Slide ${f[v]+1}" /></section>`).join("");jN("Slides",x,u.orientation,p,u.frameSlides);return}if(u.printWhat==="notes"){let x=m.map((y,v)=>{let S=f[v],w=e[S]?.notes?.trim()||"";return `<section class="page notes-page">
|
|
4804
4804
|
<img class="notes-slide" src="${VN(y)}" alt="Slide ${S+1}" />
|
|
4805
4805
|
<div class="notes-text">${RM(w)}</div>
|
|
4806
|
-
</section>`}).join("");jN("Notes Pages",x,"portrait",p,u.frameSlides);return}if(u.printWhat==="handouts"){let x=u.slidesPerPage,v={1:{rows:1,columns:1},2:{rows:2,columns:1},3:{rows:3,columns:1},4:{rows:2,columns:2},6:{rows:3,columns:2},9:{rows:3,columns:3}}[x]??{rows:3,columns:2},S=x===3,w=[],C=()=>`<div class="handout-note-lines">${Array.from({length:8},(E,M)=>`<div class="handout-note-line" style="top: ${(M+1)/9*100}%"></div>`).join("")}</div>`;for(let T=0;T<m.length;T+=x){let E=m.slice(T,T+x);if(S){let M=Array.from({length:x},(A,R)=>{let k=E[R];return `<div class="handout-row-3">${k?`<div class="handout-cell"><img src="${VN(k)}" alt="Slide ${f[T+R]+1}" /></div>`:'<div class="handout-cell"></div>'}${C()}</div>`}).join("");w.push(`<section class="page"><div class="handout-grid-3">${M}</div></section>`);}else {let M=Array.from({length:x},(A,R)=>{let k=E[R];return k?`<div class="handout-cell"><img src="${VN(k)}" alt="Slide ${f[T+R]+1}" /></div>`:'<div class="handout-cell"></div>'}).join("");w.push(`<section class="page"><div class="handout-grid" style="grid-template-columns: repeat(${v.columns}, minmax(0, 1fr)); grid-template-rows: repeat(${v.rows}, minmax(0, 1fr));">${M}</div></section>`);}}jN(`Handout ${x} per page`,w.join(""),"portrait",p,u.frameSlides);}}catch(h){console.error("[PowerPointViewer] Print layout failed:",h);}};return {handlePrint:l,handlePrintWithSettings:d,handlePrintSvg:c,isPrintDialogOpen:s,setIsPrintDialogOpen:a}}function Vde(t){let e=new Set;for(let n of t)for(let r of n.elements??[])jde(r,e);return Array.from(e).sort()}function jde(t,e){if(ot(t)&&(t.textStyle?.fontFamily&&e.add(t.textStyle.fontFamily),t.textSegments))for(let n of t.textSegments)n.style?.fontFamily&&e.add(n.style.fontFamily);if(t.type==="group"&&t.children)for(let n of t.children)jde(n,e);}function Xde(t,e){let n=[...t];return e.status==="added"&&e.compareSlide?n.splice(Math.min(e.compareIndex,n.length),0,{...e.compareSlide}):e.status==="changed"&&e.compareSlide&&e.baseIndex>=0?n[e.baseIndex]={...e.compareSlide}:e.status==="removed"&&e.baseIndex>=0&&n.splice(e.baseIndex,1),n}function Wde(t,e){let n=[...t],r=[...e.diffs];for(let o=r.length-1;o>=0;o--){let i=r[o];i.status==="removed"&&i.baseIndex>=0&&i.baseIndex<n.length&&n.splice(i.baseIndex,1);}for(let o of r)o.status==="changed"&&o.compareSlide&&o.baseIndex>=0&&o.baseIndex<n.length&&(n[o.baseIndex]={...o.compareSlide});for(let o of r)o.status==="added"&&o.compareSlide&&n.splice(Math.min(o.compareIndex,n.length),0,{...o.compareSlide});return n}function Yde(t){let{slides:e,activeSlideIndex:n,canvasSize:r,setContent:o,setPresentationProperties:i,setCoreProperties:s,setAppProperties:a,setCustomProperties:l,setSlides:c,setIsDirty:d,ops:u,history:p}=t,[f,h]=useState(false),[m,x]=useState(false),[y,v]=useState(null),S=(D,O)=>{u.updateSlides(U=>U.map((H,j)=>j===n?{...H,notes:D,notesSegments:O&&O.length>0?O:H.notesSegments}:H)),p.markDirty();},w=D=>{u.updateSlides(O=>O.map((U,H)=>H===n?{...U,...D}:U)),p.markDirty();},C=D=>{i(O=>({...O,...D})),p.markDirty();},T=D=>{s(O=>({...O,...D})),p.markDirty();},E=D=>{a(O=>({...O,...D})),p.markDirty();},M=D=>{l(D),p.markDirty();},A=useCallback(D=>{o(D);},[o]),R=useCallback(async()=>{let D=document.createElement("input");D.type="file",D.accept=".pptx",D.onchange=async()=>{let O=D.files?.[0];if(O)try{let U=await O.arrayBuffer(),j=await new l1().load(U);if(!j)return;let Z={slides:e,width:r.width,height:r.height};v(LQ(Z,j)),x(!0);}catch(U){console.warn("Compare failed:",U);}},D.click();},[e,r.width,r.height]),k=useCallback(D=>{if(!y)return;let O=y.diffs[D];!O||O.status==="unchanged"||(c(U=>Xde(U,O)),d(true));},[y,c,d]),N=useCallback(D=>{},[]),F=useCallback(()=>{y&&(c(D=>Wde(D,y)),d(true));},[y,c,d]),B=useMemo(()=>Vde(e),[e]);return {handleUpdateNotes:S,handleUpdateSlide:w,handleUpdatePresentationProperties:C,handleUpdateCoreProperties:T,handleUpdateAppProperties:E,handleUpdateCustomProperties:M,handleRestoreVersion:A,handleCompare:R,handleAcceptSlide:k,handleRejectSlide:N,handleAcceptAllSlides:F,isVersionHistoryOpen:f,setIsVersionHistoryOpen:h,isComparePanelOpen:m,setIsComparePanelOpen:x,compareResult:y,usedFontFamilies:B}}function qde(t){let{handlerRef:e,serializeSlides:n,setContent:r,onContentChange:o,setTheme:i,setSlideMasters:s,slideMasters:a,history:l}=t,c=async()=>{let w=await n();w&&(r(w),o&&o(w),l.markDirty());};return {handleApplyTheme:async(w,C)=>{let T=e.current;T&&(await T.setPresentationTheme(w,C),s(E=>E.map((M,A)=>C||A===0?{...M,themePath:w}:M)),await c());},handleUpdateThemeColorScheme:async w=>{let C=e.current;C&&(await C.updateThemeColorScheme(w),i(T=>T?{...T,colorScheme:w}:{colorScheme:w}),await c());},handleUpdateThemeFontScheme:async w=>{let C=e.current;C&&(await C.updateThemeFontScheme(w),i(T=>T?{...T,fontScheme:w}:{fontScheme:w}),await c());},handleUpdateThemeName:async w=>{let C=e.current;C&&(await C.updateThemeName(w),i(T=>T?{...T,name:w}:{name:w}),l.markDirty());},handleApplyThemeToPresentation:async()=>{let w=e.current;if(!w)return;let C=a[0]?.themePath;C&&await w.setPresentationTheme(C,true),await c();},handleApplyThemeData:async(w,C,T)=>{let E=e.current;E&&(await E.applyTheme(w,C,T),i(M=>({...M,colorScheme:w,fontScheme:C,...T&&{name:T}})),await c());},handleSetTemplateBackground:(w,C)=>{let T=e.current;T&&(T.setTemplateBackground(w,C),s(E=>E.map(M=>M.path===w?{...M,backgroundColor:C}:M)),l.markDirty());},handleGetTemplateBackgroundColor:w=>{let C=e.current;if(C)return C.getTemplateBackgroundColor(w)},handleGetAvailableThemes:async()=>{let w=e.current;return w?w.getAvailableThemes():[]},handleSwitchTheme:async w=>{let C=e.current;C&&(await C.setPresentationTheme(w,true),s(T=>T.map(E=>({...E,themePath:w}))),await c());}}}function Kde(t){let{state:e,slides:n,activeSlideIndex:r,canvasSize:o,filePath:i,history:s,ops:a,zoom:l,handlerRef:c,serializeSlides:d,setContent:u,onContentChange:p}=t,f=zde({slides:n,activeSlide:n[r],activeSlideIndex:r,filePath:i,canvasStageRef:l.canvasStageRef,setActiveSlideIndex:e.setActiveSlideIndex,handlerRef:c,serializeSlides:d,headerFooter:e.headerFooter,presentationProperties:e.presentationProperties,customShows:e.customShows,sections:e.sections,coreProperties:e.coreProperties??null,appProperties:e.appProperties??null,customProperties:e.customProperties,notesMaster:e.notesMaster,handoutMaster:e.handoutMaster,guides:e.guides,activeSlideIndexForGuides:e.activeSlideIndex}),h=Gde({slides:n,activeSlideIndex:r,canvasStageRef:l.canvasStageRef,setActiveSlideIndex:e.setActiveSlideIndex}),m=qde({handlerRef:c,serializeSlides:d,setContent:u,onContentChange:p,setTheme:e.setTheme,setSlideMasters:e.setSlideMasters,slideMasters:e.slideMasters,history:s}),x=Yde({slides:n,activeSlideIndex:r,canvasSize:o,setContent:u,setPresentationProperties:e.setPresentationProperties,setCoreProperties:e.setCoreProperties,setAppProperties:e.setAppProperties,setCustomProperties:e.setCustomProperties,setSlides:e.setSlides,setIsDirty:e.setIsDirty,ops:a,history:s});return {exportHandlers:f,printHandlers:h,themeHandlers:m,propertyHandlers:x}}var CJe=2,TJe=20;function Zde(t){let e=useRef(t);e.current=t;let n=useCallback(r=>{let{mode:o,canEdit:i,inlineEditingElementId:s,tableEditorState:a,activeTool:l,hasSelection:c,onDelete:d,onCopy:u,onCut:p,onPaste:f,onDuplicate:h,onUndo:m,onRedo:x,onSelectAll:y,onEscape:v,onNudge:S,onPrevSlide:w,onNextSlide:C}=e.current;if(o!=="edit"||!i)return;let T=r.target,E=T?.tagName==="INPUT"||T?.tagName==="TEXTAREA"||T?.isContentEditable;if(r.key==="Escape"){r.preventDefault(),v();return}if(s||a?.isEditing||l!=="select"||E)return;let M=r.metaKey||r.ctrlKey;if((r.key==="Delete"||r.key==="Backspace")&&c){r.preventDefault(),d();return}if(M)switch(r.key.toLowerCase()){case "z":r.preventDefault(),r.shiftKey?x():m();return;case "y":r.preventDefault(),x();return;case "c":c&&(r.preventDefault(),u());return;case "x":c&&(r.preventDefault(),p());return;case "v":r.preventDefault(),f();return;case "d":c&&(r.preventDefault(),h());return;case "a":r.preventDefault(),y();return}if(c&&(r.key==="ArrowUp"||r.key==="ArrowDown"||r.key==="ArrowLeft"||r.key==="ArrowRight")){r.preventDefault();let A=r.shiftKey?TJe:CJe,R=0,k=0;switch(r.key){case "ArrowUp":k=-A;break;case "ArrowDown":k=A;break;case "ArrowLeft":R=-A;break;case "ArrowRight":R=A;break}S(R,k);return}!c&&(r.key==="ArrowLeft"||r.key==="ArrowRight")&&(r.preventDefault(),r.key==="ArrowLeft"?w?.():C?.());},[]);useEffect(()=>{let r=t.containerRef.current;return r&&r.addEventListener("keydown",n),window.addEventListener("keydown",n),()=>{r&&r.removeEventListener("keydown",n),window.removeEventListener("keydown",n);}},[t.containerRef,n]);}function Jde(t){let{state:e,mode:n,canEdit:r,slides:o,activeSlide:i,ops:s,manipulation:a,history:l}=t;Zde({containerRef:e.containerRef,mode:n,canEdit:r,inlineEditingElementId:e.inlineEditingElementId,tableEditorState:e.tableEditorState,activeTool:e.activeTool,hasSelection:e.effectiveSelectedIds.length>0,effectiveSelectedIds:e.effectiveSelectedIds,onDelete:a.handleDelete,onCopy:a.handleCopy,onCut:a.handleCut,onPaste:a.handlePaste,onDuplicate:a.handleDuplicate,onUndo:l.handleUndo,onRedo:l.handleRedo,onSelectAll:()=>{if(!i)return;let c=i.elements.map(d=>d.id);c.length>0&&s.applySelection(c[0],c);},onEscape:()=>{e.inlineEditingElementId?(e.setInlineEditingElementId(null),e.setInlineEditingText("")):e.contextMenuState?e.setContextMenuState(null):e.tableEditorState?e.setTableEditorState(null):s.clearSelection();},onNudge:(c,d)=>{let u=e.effectiveSelectedIds;if(u.length){for(let p of u){let f=e.elementLookup.get(p);f&&s.updateElementById(p,{x:f.x+c,y:f.y+d});}l.markDirty();}},onPrevSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.max(0,c-1));},onNextSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.min(o.length-1,c+1));}});}function MJe(t,e,n,r,o,i,s,a,l){let c=e,d=n,u=r,p=o;switch(t){case "se":u=Math.max(12,r+i),p=Math.max(12,o+s);break;case "sw":c=e+i,u=Math.max(12,r-i),p=Math.max(12,o+s);break;case "ne":d=n+s,u=Math.max(12,r+i),p=Math.max(12,o-s);break;case "nw":c=e+i,d=n+s,u=Math.max(12,r-i),p=Math.max(12,o-s);break;case "n":d=n+s,p=Math.max(12,o-s);break;case "s":p=Math.max(12,o+s);break;case "e":u=Math.max(12,r+i);break;case "w":c=e+i,u=Math.max(12,r-i);break}if(a){let f=l;if(t==="se"||t==="ne"||t==="e"){let h=Math.round((c+u)/f)*f;u=Math.max(12,h-c);}if(t==="sw"||t==="nw"||t==="w"){let h=Math.round(c/f)*f;u=Math.max(12,u+(c-h)),c=h;}if(t==="se"||t==="sw"||t==="s"){let h=Math.round((d+p)/f)*f;p=Math.max(12,h-d);}if(t==="ne"||t==="nw"||t==="n"){let h=Math.round(d/f)*f;p=Math.max(12,p+(d-h)),d=h;}}return {x:c,y:d,width:u,height:p}}function _Je(t,e,n){let o=e/(n||200);return Math.max(0,Math.min(1,t+o))}function Qde(t,e,n){let{editorScale:r,canvasStageRef:o,canvasSize:i,snapToGrid:s,snapToShape:a,gridSpacingPx:l,editTemplateMode:c,templateElements:d,activeSlide:u,guides:p,elementLookup:f,marqueeStateRef:h,dragStateRef:m,resizeStateRef:x,shapeAdjustmentDragStateRef:y,setMarqueeSelectionState:v,setSnapLines:S,updateElementById:w}=e,C=h.current;if(C){EJe(t,C,o,i,r,v);return}let T=m.current;if(T){AJe(t,T,r,s,a,l,c,d,u,p,f,n,S);return}let E=x.current;if(E){PJe(t,E,r,s,l);return}let M=y.current;M&&RJe(t,M,r,w);}function EJe(t,e,n,r,o,i){let s=n.current;if(!s)return;let a=s.getBoundingClientRect();e.currentX=Math.max(0,Math.min(r.width,(t.clientX-a.left)/o)),e.currentY=Math.max(0,Math.min(r.height,(t.clientY-a.top)/o)),i({...e});}function AJe(t,e,n,r,o,i,s,a,l,c,d,u,p){let f=(t.clientX-e.startClientX)/n,h=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(f)>2||Math.abs(h)>2)&&(e.moved=true),!e.moved)return;let m=f,x=h,y=Object.keys(e.startPositionsById),v=y[0],S=v?e.startPositionsById[v]:void 0,w=v?d.get(v):void 0;if(S&&w){let C=S.x+m,T=S.y+x;if(r&&(C=Math.round(C/i)*i,T=Math.round(T/i)*i),o){let M=(s?a:l?.elements??[]).map(N=>({id:N.id,x:N.x,y:N.y,width:N.width,height:N.height})),A=K7(C,T,w.width,w.height,M,new Set(y),c.map(N=>({axis:N.axis,position:N.position})));C=A.x,T=A.y;let R=A.lines.map(N=>({axis:N.axis==="v"?"x":"y",position:N.position})),k=JSON.stringify(R);k!==u.lastSnapLinesKey&&(u.lastSnapLinesKey=k,p(R));}else u.lastSnapLinesKey!=="[]"&&(u.lastSnapLinesKey="[]",p([]));m=C-S.x,x=T-S.y;}e.lastDx=m,e.lastDy=x;for(let[C,T]of e.domEls){let E=e.startPositionsById[C];E&&(T.style.left=`${E.x+m}px`,T.style.top=`${E.y+x}px`);}}function PJe(t,e,n,r,o){let i=(t.clientX-e.startClientX)/n,s=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(i)>2||Math.abs(s)>2)&&(e.moved=true),!e.moved)return;let a=MJe(e.handle,e.startX,e.startY,e.startWidth,e.startHeight,i,s,r,o);e.lastX=a.x,e.lastY=a.y,e.lastWidth=a.width,e.lastHeight=a.height,e.domEl&&(e.domEl.style.left=`${a.x}px`,e.domEl.style.top=`${a.y}px`,e.domEl.style.width=`${Math.max(a.width,12)}px`,e.domEl.style.height=`${Math.max(a.height,12)}px`);}function RJe(t,e,n,r){let o=(t.clientX-e.startClientX)/n,i=_Je(e.startAdjustment,o,e.startWidth);!e.moved&&Math.abs(o)>2&&(e.moved=true),e.moved&&r(e.elementId,{shapeAdjustments:{[e.key]:i}});}function kJe(t,e){let n=Math.min(t.startX,t.currentX),r=Math.min(t.startY,t.currentY),o=Math.max(t.startX,t.currentX),i=Math.max(t.startY,t.currentY),s=o-n,a=i-r;return s<=3&&a<=3?[]:e.filter(l=>{let c=l.x,d=l.y,u=l.x+Math.max(l.width,12),p=l.y+Math.max(l.height,12);return !(u<n||c>o||p<r||d>i)}).map(l=>l.id)}function IJe(t,e){return Array.from(new Set([...t??[],...e]))}function eue(t){let{editTemplateMode:e,templateElements:n,activeSlide:r,activeSlideIndex:o,marqueeStateRef:i,dragStateRef:s,resizeStateRef:a,shapeAdjustmentDragStateRef:l,setMarqueeSelectionState:c,setSnapLines:d,setTemplateElementsBySlideId:u,setPointerCommitNonce:p,applySelection:f,clearSelection:h,updateSlides:m,updateElementById:x,markDirty:y}=t,v=i.current,S=s.current,w=a.current,C=l.current;if(v&&(NJe(v,e,n,r,f,h),i.current=null,c(null)),S?.moved&&DJe(S,e,r,o,u,m),w?.moved){let E=w.elementId,M={x:w.lastX,y:w.lastY,width:w.lastWidth,height:w.lastHeight};x(E,M);let A=new Set([E]);m(R=>R.map((k,N)=>{if(N!==o)return k;let F=YR(k.elements,A);return F.length===0?k:{...k,elements:qR(k.elements,F)}}));}let T=S?.moved||w?.moved||C?.moved;i.current=null,s.current=null,a.current=null,l.current=null,c(null),d([]),T&&(y(),p(E=>E+1));}function NJe(t,e,n,r,o,i){let s=e?n:r?.elements??[],a=kJe(t,s);if(t.additive){let l=IJe(t.baseSelectionIds,a);l.length>0?o(l[0],l):i();}else a.length>0?o(a[0],a):i();}function DJe(t,e,n,r,o,i){let s=t.lastDx,a=t.lastDy;if(e){let l=new Set(Object.keys(t.startPositionsById));o(c=>{let d=n?.id;if(!d)return c;let p=(c[d]??[]).map(h=>{let m=t.startPositionsById[h.id];return m?{...h,x:m.x+s,y:m.y+a}:h}),f=YR(p,l);return {...c,[d]:qR(p,f)}});}else {let l=new Set(Object.keys(t.startPositionsById));i(c=>c.map((d,u)=>{if(u!==r)return d;let p=d.elements.map(h=>{let m=t.startPositionsById[h.id];return m?{...h,x:m.x+s,y:m.y+a}:h}),f=YR(p,l);return {...d,elements:qR(p,f)}}));}}function tue(t){let{editorScale:e,canvasStageRef:n,canvasSize:r,activeSlide:o,activeSlideIndex:i,gridSpacingPx:s,dragStateRef:a,resizeStateRef:l,shapeAdjustmentDragStateRef:c,marqueeStateRef:d,editTemplateMode:u,snapToGrid:p,snapToShape:f,guides:h,templateElements:m,elementLookup:x,setMarqueeSelectionState:y,setSnapLines:v,setTemplateElementsBySlideId:S,setPointerCommitNonce:w,applySelection:C,clearSelection:T,updateSlides:E,updateElementById:M,markDirty:A}=t;useEffect(()=>{let R={rafId:0,pendingMoveEvent:null,lastSnapLinesKey:""},k=F=>{R.pendingMoveEvent=F,R.rafId===0&&(R.rafId=requestAnimationFrame(()=>{R.rafId=0,R.pendingMoveEvent&&(Qde(R.pendingMoveEvent,t,R),R.pendingMoveEvent=null);}));},N=()=>{R.rafId!==0&&(cancelAnimationFrame(R.rafId),R.rafId=0,R.pendingMoveEvent=null),eue(t);};return document.addEventListener("pointermove",k),document.addEventListener("pointerup",N),()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",N),R.rafId!==0&&cancelAnimationFrame(R.rafId);}},[e,n,a,l,c,d,u,p,f,h,m,y,v,x,S,w,o,i,r.width,r.height,s,C,T,E,M,A,t]);}function nue(t){let{alreadyChecked:e,filePath:n,loading:r,error:o,slideCount:i}=t;return !(e||!n||r||o||i===0)}var FJe=1440*60*1e3;function BJe(t,e){return e-t<FJe}function rue(t,e){return t.length===0?false:BJe(t[0].timestamp,e)}var $Je="pptx-viewer-autosave",HJe=1,XN="recoveryVersions";function zJe(){return new Promise((t,e)=>{let n=indexedDB.open($Je,HJe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(XN)||r.createObjectStore(XN,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function GJe(t){try{let e=await zJe();return new Promise(n=>{let i=e.transaction(XN,"readonly").objectStore(XN).get(t);i.onsuccess=()=>{e.close(),n(i.result);},i.onerror=()=>{e.close(),n(void 0);};})}catch{return}}function oue(t){let{filePath:e,loading:n,error:r,slideCount:o,openVersionHistory:i}=t,s=useRef(false);useEffect(()=>{nue({alreadyChecked:s.current,filePath:e,loading:n,error:r,slideCount:o})&&(s.current=true,!(typeof indexedDB>"u")&&(async()=>{try{let a=await GJe(e);a&&rue([a],Date.now())&&i();}catch{}})());},[e,n,r,o,i]);}function iue(t){let{state:e,zoom:n,history:r,presentation:o,annotations:i,actionSoundHandlerRef:s,editorOps:a,gridSpacingPx:l,content:c,filePath:d,canEdit:u,mode:p,slides:f,activeSlide:h,activeSlideIndex:m,canvasSize:x,loading:y,error:v,ref:S,setContent:w,onContentChange:C,onDirtyChange:T,onActiveSlideChange:E}=t;tue({editorScale:n.editorScale,canvasStageRef:n.canvasStageRef,canvasSize:x,activeSlide:h,activeSlideIndex:m,gridSpacingPx:l,dragStateRef:e.dragStateRef,resizeStateRef:e.resizeStateRef,shapeAdjustmentDragStateRef:e.shapeAdjustmentDragStateRef,marqueeStateRef:e.marqueeStateRef,editTemplateMode:e.editTemplateMode,snapToGrid:e.snapToGrid,snapToShape:e.snapToShape,guides:e.guides,templateElements:e.templateElements,elementLookup:e.elementLookup,setMarqueeSelectionState:e.setMarqueeSelectionState,setSnapLines:e.setSnapLines,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setPointerCommitNonce:e.setPointerCommitNonce,effectiveSelectedIds:e.effectiveSelectedIds,applySelection:a.ops.applySelection,clearSelection:a.ops.clearSelection,updateSlides:a.ops.updateSlides,updateElementById:a.ops.updateElementById,markDirty:r.markDirty});let[M,A]=useState(false),{handlerRef:R,serializeSlides:k,autosaveStatus:N}=Nde({content:c,filePath:d,slides:f,state:e,history:r,ops:a.ops,actionSoundHandlerRef:s,setIsEncryptedDialogOpen:A}),{exportHandlers:F,printHandlers:B,themeHandlers:D,propertyHandlers:O}=Kde({state:e,slides:f,activeSlideIndex:m,canvasSize:x,filePath:d,history:r,ops:a.ops,zoom:n,handlerRef:R,serializeSlides:k,setContent:w,onContentChange:C}),{showKeepAnnotationsDialog:U,handleSetMode:H,handleKeepAnnotations:j,handleDiscardAnnotations:Z,handleEnterPresenterView:J,handleEnterRehearsalMode:W}=vde({mode:p,presentation:o,annotations:i,history:r,setMode:e.setMode,setSlides:e.setSlides});return oue({filePath:d,loading:y,error:v,slideCount:f.length,openVersionHistory:()=>O.setIsVersionHistoryOpen(true)}),useImperativeHandle(S,()=>({async getContent(){let te=await k();return te&&C&&C(te),te??new Uint8Array(0)}}),[k,C]),useEffect(()=>{T&&T(e.isDirty);},[e.isDirty,T]),useEffect(()=>{E&&E(m);},[m,E]),useEffect(()=>{e.activeSlideIndexRef.current=m;},[m,e.activeSlideIndexRef]),Jde({state:e,mode:p,canEdit:u,slides:f,activeSlide:h,ops:a.ops,manipulation:a.manipulation,history:r}),{exportHandlers:F,printHandlers:B,themeHandlers:D,propertyHandlers:O,showKeepAnnotationsDialog:U,handleSetMode:H,handleKeepAnnotations:j,handleDiscardAnnotations:Z,handleEnterPresenterView:J,handleEnterRehearsalMode:W,autosaveStatus:N,isEncryptedDialogOpen:M,setIsEncryptedDialogOpen:A}}function XJe(t,e){let n=new Map;for(let r of t)n.set(r.id,r);for(let r of e)n.set(r.id,r);return n}function WJe(t,e){return e.length>0?e:t?[t]:[]}function YJe(t,e){if(!(e===null||!t?.layouts))return t.layouts[e]}function qJe(t,e){return e?e.elements??[]:t?t.elements??[]:[]}function sue(t){let{slides:e,activeSlideIndex:n,templateElementsBySlideId:r,selectedElementId:o,selectedElementIds:i,slideMasters:s,activeMasterIndex:a,activeLayoutIndex:l,notesMaster:c,handoutMaster:d}=t,u=e[n],p=useMemo(()=>u?r[u.id]??[]:[],[u,r]),f=useMemo(()=>XJe(p,u?.elements??[]),[u,p]),h=useMemo(()=>o?f.get(o)??null:null,[f,o]),m=useMemo(()=>WJe(o,i),[o,i]),x=useMemo(()=>new Set(m),[m]),y=useMemo(()=>m.map(E=>f.get(E)).filter(Boolean),[m,f]),v=s[a],S=useMemo(()=>YJe(v,l),[v,l]),w=useMemo(()=>qJe(v,S),[v,S]),C=useMemo(()=>c?.elements??[],[c]),T=useMemo(()=>d?.elements??[],[d]);return {activeSlide:u,templateElements:p,elementLookup:f,selectedElement:h,effectiveSelectedIds:m,selectedElementIdSet:x,selectedElements:y,activeMaster:v,activeLayout:S,masterViewElements:w,notesMasterElements:C,handoutMasterElements:T}}function lue(t){let e=useRef(null),n=useRef(null),r=useRef(null),o=useRef(0),i=useRef(null),s=useRef(null),a=useRef(null),l=useRef(null),c=useRef(false),[d,u]=useState("edit"),[p,f]=useState(true),[h,m]=useState(null),[x,y]=useState([]),[v,S]=useState({}),[w,C]=useState({width:1280,height:720}),[T,E]=useState(0),[M,A]=useState(null),[R,k]=useState([]),[N,F]=useState(false),B=useRef(null),D=useRef(""),[O,U]=useState(null),[H,j]=useState(""),Z=useCallback(yo=>{let ia=typeof yo=="function"?yo(B.current):yo;B.current=ia,U(yo);},[]),J=useCallback(yo=>{let ia=typeof yo=="function"?yo(D.current):yo;D.current=ia,j(yo);},[]),[W,te]=useState(false),[se,Ce]=useState("rect"),[ee,ce]=useState(null),[de,Ne]=useState(0),[Ue,he]=useState({}),[Be,Me]=useState([]),[ge,Te]=useState([]),[be,xe]=useState(),[Pe,Xe]=useState(),[Y,Ge]=useState([]),[Ve,We]=useState([]),[ke,wt]=useState(null),[V,$]=useState([]),[ie,ve]=useState({}),[De,$e]=useState(),[ze,ae]=useState(),[Se,Ye]=useState(),[Q,pe]=useState([]),[Re,nt]=useState([]),[Ke,Ct]=useState(),[ne,Ze]=useState(),[Le,rt]=useState([]),[qe,He]=useState(false),[gt,Nt]=useState(false),[In,yn]=useState(0),[Zo,Ii]=useState(0),[La,Qc]=useState(null),[ed,ra]=useState("edit"),[oa,Fs]=useState("slides"),[Sr,pl]=useState(4),Bs=sue({slides:x,activeSlideIndex:T,templateElementsBySlideId:v,selectedElementId:M,selectedElementIds:R,slideMasters:ge,activeMasterIndex:Zo,activeLayoutIndex:La,notesMaster:De,handoutMaster:ze});return {containerRef:e,imageInputRef:n,mediaInputRef:r,activeSlideIndexRef:o,inlineEditingElementIdRef:B,inlineEditingTextRef:D,dragStateRef:i,resizeStateRef:s,shapeAdjustmentDragStateRef:a,marqueeStateRef:l,isDrawingRef:c,mode:d,setMode:u,loading:p,setLoading:f,error:h,setError:m,slides:x,setSlides:y,templateElementsBySlideId:v,setTemplateElementsBySlideId:S,canvasSize:w,setCanvasSize:C,activeSlideIndex:T,setActiveSlideIndex:E,selectedElementId:M,setSelectedElementId:A,selectedElementIds:R,setSelectedElementIds:k,isDirty:N,setIsDirty:F,inlineEditingElementId:O,setInlineEditingElementId:Z,inlineEditingText:H,setInlineEditingText:J,editTemplateMode:W,setEditTemplateMode:te,newShapeType:se,setNewShapeType:Ce,clipboardPayload:ee,setClipboardPayload:ce,pointerCommitNonce:de,setPointerCommitNonce:Ne,headerFooter:Ue,setHeaderFooter:he,layoutOptions:Be,setLayoutOptions:Me,slideMasters:ge,setSlideMasters:Te,theme:be,setTheme:xe,tableStyleMap:Pe,setTableStyleMap:Xe,themeOptions:Y,setThemeOptions:Ge,customShows:Ve,setCustomShows:We,activeCustomShowId:ke,setActiveCustomShowId:wt,sections:V,setSections:$,presentationProperties:ie,setPresentationProperties:ve,notesMaster:De,setNotesMaster:$e,handoutMaster:ze,setHandoutMaster:ae,notesCanvasSize:Se,setNotesCanvasSize:Ye,customProperties:Q,setCustomProperties:pe,tagCollections:Re,setTagCollections:nt,coreProperties:Ke,setCoreProperties:Ct,appProperties:ne,setAppProperties:Ze,embeddedFonts:Le,setEmbeddedFonts:rt,hasMacros:qe,setHasMacros:He,hasDigitalSignatures:gt,setHasDigitalSignatures:Nt,digitalSignatureCount:In,setDigitalSignatureCount:yn,activeMasterIndex:Zo,setActiveMasterIndex:Ii,activeLayoutIndex:La,setActiveLayoutIndex:Qc,preMasterMode:ed,setPreMasterMode:ra,masterViewTab:oa,setMasterViewTab:Fs,handoutSlidesPerPage:Sr,setHandoutSlidesPerPage:pl,...Bs}}function cue(){let[t,e]=useState(false),[n,r]=useState("home"),[o,i]=useState(()=>typeof window>"u"?true:window.innerWidth>=768),[s,a]=useState(false),[l,c]=useState(true),[d,u]=useState(false),[p,f]=useState(false),[h,m]=useState("properties"),[x,y]=useState(false),[v,S]=useState(false),[w,C]=useState(false),[T,E]=useState([]),[M,A]=useState(null),[R,k]=useState(null),[N,F]=useState(true),[B,D]=useState(false),[O,U]=useState(false),[H,j]=useState(true),[Z,J]=useState(true),[W,te]=useState([]),[se,Ce]=useState(null),[ee,ce]=useState([]),[de,Ne]=useState(new Map),[Ue,he]=useState("select"),[Be,Me]=useState("#000000"),[ge,Te]=useState(3),[be,xe]=useState(false),[Pe,Xe]=useState(false),[Y,Ge]=useState(false),[Ve,We]=useState(false),[ke,wt]=useState(false);return {isCompactToolbarOpen:t,setIsCompactToolbarOpen:e,toolbarSection:n,setToolbarSection:r,isSlidesPaneOpen:o,setIsSlidesPaneOpen:i,isInspectorPaneOpen:s,setIsInspectorPaneOpen:a,isSlideNotesCollapsed:l,setIsSlideNotesCollapsed:c,isOverflowMenuOpen:d,setIsOverflowMenuOpen:u,isSidebarCollapsed:p,setIsSidebarCollapsed:f,sidebarPanelMode:h,setSidebarPanelMode:m,showSlideSorter:x,setShowSlideSorter:y,isShortcutHelpOpen:v,setIsShortcutHelpOpen:S,isAccessibilityPanelOpen:w,setIsAccessibilityPanelOpen:C,accessibilityIssues:T,setAccessibilityIssues:E,contextMenuState:M,setContextMenuState:A,tableEditorState:R,setTableEditorState:k,spellCheckEnabled:N,setSpellCheckEnabled:F,showGrid:B,setShowGrid:D,showRulers:O,setShowRulers:U,snapToGrid:H,setSnapToGrid:j,snapToShape:Z,setSnapToShape:J,guides:W,setGuides:te,marqueeSelectionState:se,setMarqueeSelectionState:Ce,snapLines:ee,setSnapLines:ce,mediaDataUrls:de,setMediaDataUrls:Ne,activeTool:Ue,setActiveTool:he,drawingColor:Be,setDrawingColor:Me,drawingWidth:ge,setDrawingWidth:Te,isThemeEditorOpen:be,setIsThemeEditorOpen:xe,isThemeGalleryOpen:Pe,setIsThemeGalleryOpen:Xe,formatPainterActive:Y,setFormatPainterActive:Ge,isSelectionPaneOpen:Ve,setIsSelectionPaneOpen:We,eyedropperActive:ke,setEyedropperActive:wt}}function due(t){let e=lue(),n=cue();return {...e,...n}}function hue({canvasSize:t,selectedElements:e}){let n=useRef(null),r=useRef(null),o=useRef(null),i=useRef(1),[s,a]=useState(1),[l,c]=useState(null),d=l||{width:t.width,height:t.height},u=useMemo(()=>{if(!d.width||!d.height)return 1;let C=d.width/t.width,T=d.height/t.height;return Math.min(C,T,1)},[t,d.height,d.width]),p=u*s;useEffect(()=>{i.current=p;},[p]);let f=useCallback((C,T)=>{let E=n.current,M=o.current;if(!E||!M)return;let A=Math.min(Math.max(T,.2),5),R=u*A,k=(C.minX+C.maxX)/2,N=(C.minY+C.maxY)/2,F=M.offsetLeft+k*R-E.clientWidth/2,B=M.offsetTop+N*R-E.clientHeight/2;E.scrollTo({left:Math.max(F,0),top:Math.max(B,0),behavior:"smooth"});},[u]),h=useCallback(()=>{a(C=>Math.min(C+.1,5));},[]),m=useCallback(()=>{a(C=>Math.max(C-.1,.2));},[]),x=useCallback(()=>{a(1);},[]),y=useCallback(()=>{a(1);},[]),v=useCallback(()=>{if(e.length===0)return;let C=Number.POSITIVE_INFINITY,T=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,M=Number.NEGATIVE_INFINITY;if(e.forEach(U=>{C=Math.min(C,U.x),T=Math.min(T,U.y),E=Math.max(E,U.x+Math.max(U.width,12)),M=Math.max(M,U.y+Math.max(U.height,12));}),!Number.isFinite(C)||!Number.isFinite(T)||!Number.isFinite(E)||!Number.isFinite(M))return;let A={minX:C,minY:T,maxX:E,maxY:M},R=Math.max(A.maxX-A.minX,12),k=Math.max(A.maxY-A.minY,12),N=Math.max(d.width-96,12),F=Math.max(d.height-96,12),B=Math.min(N/R,F/k),D=u>Number.EPSILON?u:Number.EPSILON,O=Math.min(Math.max(B/D,.2),5);a(O),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{f(A,O);});});},[f,d.height,d.width,u,e]),S=useCallback(C=>{if(!C.ctrlKey)return;C.preventDefault();let T=C.deltaY*-1e-3;a(E=>Math.min(Math.max(E+T,.2),5));},[]);useEffect(()=>{let C=o.current;if(C)return C.addEventListener("wheel",S,{passive:false}),()=>{C.removeEventListener("wheel",S);}},[S]);let w=useCallback((C,T)=>{let E=r.current;if(!E)return null;let M=E.getBoundingClientRect();if(M.width<=0||M.height<=0)return null;let A=(C-M.left)/p,R=(T-M.top)/p;return {x:Math.max(0,Math.min(t.width,A)),y:Math.max(0,Math.min(t.height,R))}},[t.height,t.width,p]);return {editWrapperRef:n,canvasStageRef:r,canvasViewportRef:o,renderScaleRef:i,scale:s,setScale:a,editorDimensions:l,setEditorDimensions:c,fitScale:u,editorScale:p,handleZoomIn:h,handleZoomOut:m,handleResetZoom:x,handleZoomToFit:y,handleZoomToSelection:v,handleWheel:S,centerBoundsInViewport:f,getCanvasPointFromClient:w}}var xue=forwardRef(function(e,n){let{content:r,filePath:o,canEdit:i=false,onContentChange:s,onDirtyChange:a,onActiveSlideChange:l,theme:c,authorName:d,collaboration:u,onStartCollaboration:p,onStopCollaboration:f,shareDefaults:h}=e,m=q5(c),[x,y]=useState(r);useEffect(()=>{y(r);},[r]);let[v,S]=useState(false),[w,C]=useState(false),{reducedMotion:T,toggleReducedMotion:E}=ude(),M=due(),{containerRef:A,mode:R,slides:k,canvasSize:N,loading:F,error:B,activeSlideIndex:D,selectedElementId:O,selectedElementIds:U,templateElementsBySlideId:H,activeSlide:j,selectedElement:Z}=M,J=cN({containerRef:A}),{isMobile:W,isTouchDevice:te,isVirtualKeyboardOpen:se}=J,Ce=pde(),{gridSpacingPx:ee,visibleSlideIndexes:ce,slideSectionGroups:de,masterPseudoSlide:Ne}=ace({slides:k,sections:M.sections,customShows:M.customShows,activeCustomShowId:M.activeCustomShowId,mode:R,activeLayout:M.activeLayout,activeMaster:M.activeMaster,presentationGridSpacing:M.presentationProperties.gridSpacing}),Ue=useCallback(()=>!!(M.dragStateRef.current||M.resizeStateRef.current||M.marqueeStateRef.current||M.shapeAdjustmentDragStateRef.current||M.isDrawingRef.current),[M.dragStateRef,M.resizeStateRef,M.marqueeStateRef,M.shapeAdjustmentDragStateRef,M.isDrawingRef]),he=hue({canvasSize:N,selectedElements:M.selectedElements}),Be=cce({slides:k,canvasSize:N,activeSlideIndex:D,templateElementsBySlideId:H,editTemplateMode:M.editTemplateMode,headerFooter:M.headerFooter,loading:F,error:B,hasActivePointerInteraction:Ue,pointerCommitNonce:M.pointerCommitNonce,setSlides:M.setSlides,setCanvasSize:M.setCanvasSize,setActiveSlideIndex:M.setActiveSlideIndex,setTemplateElementsBySlideId:M.setTemplateElementsBySlideId,setSelectedElementId:M.setSelectedElementId,setSelectedElementIds:M.setSelectedElementIds,setEditTemplateMode:M.setEditTemplateMode,setHeaderFooter:M.setHeaderFooter}),{presentation:Me,annotations:ge,actionSoundHandlerRef:Te}=dde({mode:R,slides:k,visibleSlideIndexes:ce,activeSlideIndex:D,containerRef:A,content:x,mediaDataUrls:M.mediaDataUrls,presentationProperties:M.presentationProperties,setMode:M.setMode,setActiveSlideIndex:M.setActiveSlideIndex,setSlides:M.setSlides,history:Be});mde({targetRef:he.canvasViewportRef,currentScale:he.scale,callbacks:{onPinchZoom:Se=>he.setScale(Se),onSwipe:R==="present"?Se=>Me.movePresentationSlide(Se===1?-1:1):void 0,onLongPress:(Se,Ye)=>{R!=="edit"||!i||M.selectedElementId&&M.setContextMenuState({x:Se,y:Ye,elementId:M.selectedElementId});}},enabled:te});let be=bde({mode:R,slides:k,activeSlide:j,canvasSize:N,containerRef:A,customShows:M.customShows,activeCustomShowId:M.activeCustomShowId,setCustomShows:M.setCustomShows,setActiveCustomShowId:M.setActiveCustomShowId,setGuides:M.setGuides,setPresentationProperties:M.setPresentationProperties,setAccessibilityIssues:M.setAccessibilityIssues,setIsAccessibilityPanelOpen:M.setIsAccessibilityPanelOpen,setMode:M.setMode,setPreMasterMode:M.setPreMasterMode,setActiveMasterIndex:M.setActiveMasterIndex,setActiveLayoutIndex:M.setActiveLayoutIndex,setSelectedElementId:M.setSelectedElementId,setSelectedElementIds:M.setSelectedElementIds,preMasterMode:M.preMasterMode,hasDigitalSignatures:M.hasDigitalSignatures,isDirty:M.isDirty,history:Be});useEffect(()=>{M.setSelectedElementId(null),M.setSelectedElementIds([]),M.setInlineEditingElementId(null);},[D]);let xe=Bce({state:M,history:Be,zoom:he,mode:R,canEdit:i,slides:k,activeSlide:j,activeSlideIndex:D,selectedElement:Z,selectedElementId:O,selectedElementIds:U,canvasSize:N,dialogs:be,presentation:Me,userName:d??u?.userName,handlerRef:Te}),{exportHandlers:Pe,printHandlers:Xe,themeHandlers:Y,propertyHandlers:Ge,showKeepAnnotationsDialog:Ve,handleSetMode:We,handleKeepAnnotations:ke,handleDiscardAnnotations:wt,handleEnterPresenterView:V,handleEnterRehearsalMode:$,autosaveStatus:ie,isEncryptedDialogOpen:ve,setIsEncryptedDialogOpen:De}=iue({state:M,zoom:he,history:Be,presentation:Me,annotations:ge,actionSoundHandlerRef:Te,editorOps:xe,gridSpacingPx:ee,content:x,filePath:o,canEdit:i,mode:R,slides:k,activeSlide:j,activeSlideIndex:D,canvasSize:N,loading:F,error:B,ref:n,setContent:y,onContentChange:s,onDirtyChange:a,onActiveSlideChange:l});if(F)return jsx(hU,{});if(B)return jsx(mU,{error:B});let $e=R==="edit"&&!W&&!be.isNarrowViewport&&M.isSlidesPaneOpen,ze=R==="master"&&!W&&M.isSlidesPaneOpen,ae=jsxs("div",{ref:A,tabIndex:0,style:m,"data-pptx-viewer":"",className:"h-full w-full bg-background text-foreground flex flex-col relative overflow-hidden outline-none",children:[R!=="present"&&jsx(PH,{mode:R,canEdit:i,state:M,selectedElement:Z,activeSlide:j,zoom:he,history:Be,findReplace:xe.findReplace,manipulation:xe.manipulation,insertHandlers:xe.insertHandlers,exportHandlers:Pe,printHandlers:Xe,propertyHandlers:Ge,dialogs:be,slideOps:xe.slideOps,ops:xe.ops,onSetMode:We,onEnterPresenterView:V,onEnterRehearsalMode:$,onOpenSettings:()=>S(true),onOpenShareDialog:()=>C(true)}),jsx(GH,{mode:R,canEdit:i,slides:k,activeSlide:j,masterPseudoSlide:Ne,activeSlideIndex:D,canvasSize:N,gridSpacingPx:ee,slideSectionGroups:de,showSlidesPane:$e,showMasterPane:ze,selectedElement:Z,state:M,editorOps:xe,dialogs:be,presentation:Me,annotations:ge,propertyHandlers:Ge,themeHandlers:Y,history:Be,comments:xe.comments,zoom:he,isMobile:W,isTouchDevice:te,onEndPresentation:()=>We("edit"),leftPanelWidth:W?void 0:Ce.leftWidth,onResizeLeft:W?void 0:Ce.onResizeLeft,rightPanelWidth:W?void 0:Ce.rightWidth,onResizeRight:W?void 0:Ce.onResizeRight}),R!=="present"&&!se&&jsx(EH,{activeSlide:j,allSlides:k,isSlideNotesCollapsed:M.isSlideNotesCollapsed,canEdit:i,slideCount:k.length,activeSlideIndex:D,isDirty:M.isDirty,autosaveStatus:ie,onToggleNotes:()=>M.setIsSlideNotesCollapsed(Se=>!Se),onUpdateNotes:Ge.handleUpdateNotes,collaborationSlot:u?jsx(QJe,{}):void 0,notesPanelHeight:W?void 0:Ce.bottomHeight,onResizeBottom:W?void 0:Ce.onResizeBottom,scale:he.scale,onZoomIn:he.handleZoomIn,onZoomOut:he.handleZoomOut,onZoomToFit:he.handleZoomToFit,mode:R,onSetMode:We,onToggleSlideSorter:()=>M.setShowSlideSorter(Se=>!Se),hideStatusBar:W}),R!=="present"&&W&&jsx(rce,{state:M,editorOps:xe,presentation:Me,slides:k,activeSlideIndex:D,canvasSize:N,slideSectionGroups:de,canEdit:i,commentCount:j?.comments?.length??0}),jsx(FH,{dialogs:be,insertHandlers:xe.insertHandlers,exportHandlers:Pe,printHandlers:Xe,propertyHandlers:Ge,annotations:ge,slides:k,activeSlideIndex:D,canvasSize:N,filePath:o,coreProperties:M.coreProperties,customProperties:M.customProperties,appProperties:M.appProperties,embeddedFonts:M.embeddedFonts,hasDigitalSignatures:M.hasDigitalSignatures,digitalSignatureCount:M.digitalSignatureCount,presentationProperties:M.presentationProperties,customShows:M.customShows,selectedElements:M.selectedElements,isEncryptedDialogOpen:ve,setIsEncryptedDialogOpen:De,showKeepAnnotationsDialog:Ve,onKeepAnnotations:ke,onDiscardAnnotations:wt}),jsx(ice,{isOpen:v,onClose:()=>S(false),spellCheckEnabled:M.spellCheckEnabled,onSetSpellCheckEnabled:M.setSpellCheckEnabled,showGrid:M.showGrid,onSetShowGrid:M.setShowGrid,showRulers:M.showRulers,onSetShowRulers:M.setShowRulers,snapToGrid:M.snapToGrid,onSetSnapToGrid:M.setSnapToGrid,reducedMotion:T,onToggleReducedMotion:E}),jsx(xH,{open:w,onClose:()=>C(false),activeCollaboration:u,onStartCollaboration:p,onStopCollaboration:f,preconfigured:!!u,defaultRoomId:h?.roomId,defaultUserName:h?.userName,defaultServerUrl:h?.serverUrl}),jsx(fH,{open:be.isBroadcastDialogOpen,onClose:()=>be.setIsBroadcastDialogOpen(false),onStartBroadcast:p,onStopBroadcast:f,onStartPresenting:()=>We("present"),defaultRoomId:h?.roomId,defaultUserName:h?.userName,defaultServerUrl:h?.serverUrl}),jsx(MH,{isShortcutHelpOpen:M.isShortcutHelpOpen,isAccessibilityPanelOpen:M.isAccessibilityPanelOpen,showSlideSorter:M.showSlideSorter,accessibilityIssues:M.accessibilityIssues,slides:k,activeSlideIndex:D,canvasSize:N,canEdit:i,sectionGroups:de,onCloseShortcuts:()=>M.setIsShortcutHelpOpen(false),onCloseAccessibility:()=>M.setIsAccessibilityPanelOpen(false),onSelectSlide:Se=>{M.setActiveSlideIndex(Se),M.setShowSlideSorter(false);},onMoveSlide:xe.slideOps.handleMoveSlide,onDeleteSlides:xe.slideOps.handleDeleteSlides,onDuplicateSlides:xe.slideOps.handleDuplicateSlides,onToggleHideSlides:xe.slideOps.handleToggleHideSlides,onCloseSorter:()=>M.setShowSlideSorter(false),reducedMotion:T,onToggleReducedMotion:E}),jsx(OH,{mode:R,slides:k,canvasSize:N,templateElements:M.templateElements,presentation:Me,onExitPresentation:()=>We("edit")})]});return jsx(pE,{theme:c,children:u?jsxs(T6,{config:u,canvasWidth:N.width,canvasHeight:N.height,children:[jsx(eQe,{slides:k,setSlides:M.setSlides}),jsx(tQe,{activeSlideIndex:D,setActiveSlideIndex:M.setActiveSlideIndex,slideCount:k.length}),ae]}):ae})});xue.displayName="PowerPointViewer";function QJe(){let t=qi();return t?jsx(E6,{status:t.status,connectedCount:t.connectedCount,onRetry:t.retry}):null}function eQe({slides:t,setSlides:e}){let n=qi();return XH({doc:n?.doc??null,slides:t,setSlides:e,isConnected:n?.status==="connected"}),null}function tQe({activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n}){let r=qi();return WH({collab:r,activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n}),null}/**
|
|
4806
|
+
</section>`}).join("");jN("Notes Pages",x,"portrait",p,u.frameSlides);return}if(u.printWhat==="handouts"){let x=u.slidesPerPage,v={1:{rows:1,columns:1},2:{rows:2,columns:1},3:{rows:3,columns:1},4:{rows:2,columns:2},6:{rows:3,columns:2},9:{rows:3,columns:3}}[x]??{rows:3,columns:2},S=x===3,w=[],C=()=>`<div class="handout-note-lines">${Array.from({length:8},(E,M)=>`<div class="handout-note-line" style="top: ${(M+1)/9*100}%"></div>`).join("")}</div>`;for(let T=0;T<m.length;T+=x){let E=m.slice(T,T+x);if(S){let M=Array.from({length:x},(A,R)=>{let k=E[R];return `<div class="handout-row-3">${k?`<div class="handout-cell"><img src="${VN(k)}" alt="Slide ${f[T+R]+1}" /></div>`:'<div class="handout-cell"></div>'}${C()}</div>`}).join("");w.push(`<section class="page"><div class="handout-grid-3">${M}</div></section>`);}else {let M=Array.from({length:x},(A,R)=>{let k=E[R];return k?`<div class="handout-cell"><img src="${VN(k)}" alt="Slide ${f[T+R]+1}" /></div>`:'<div class="handout-cell"></div>'}).join("");w.push(`<section class="page"><div class="handout-grid" style="grid-template-columns: repeat(${v.columns}, minmax(0, 1fr)); grid-template-rows: repeat(${v.rows}, minmax(0, 1fr));">${M}</div></section>`);}}jN(`Handout ${x} per page`,w.join(""),"portrait",p,u.frameSlides);}}catch(h){console.error("[PowerPointViewer] Print layout failed:",h);}};return {handlePrint:l,handlePrintWithSettings:d,handlePrintSvg:c,isPrintDialogOpen:s,setIsPrintDialogOpen:a}}function Vde(t){let e=new Set;for(let n of t)for(let r of n.elements??[])jde(r,e);return Array.from(e).sort()}function jde(t,e){if(ot(t)&&(t.textStyle?.fontFamily&&e.add(t.textStyle.fontFamily),t.textSegments))for(let n of t.textSegments)n.style?.fontFamily&&e.add(n.style.fontFamily);if(t.type==="group"&&t.children)for(let n of t.children)jde(n,e);}function Xde(t,e){let n=[...t];return e.status==="added"&&e.compareSlide?n.splice(Math.min(e.compareIndex,n.length),0,{...e.compareSlide}):e.status==="changed"&&e.compareSlide&&e.baseIndex>=0?n[e.baseIndex]={...e.compareSlide}:e.status==="removed"&&e.baseIndex>=0&&n.splice(e.baseIndex,1),n}function Wde(t,e){let n=[...t],r=[...e.diffs];for(let o=r.length-1;o>=0;o--){let i=r[o];i.status==="removed"&&i.baseIndex>=0&&i.baseIndex<n.length&&n.splice(i.baseIndex,1);}for(let o of r)o.status==="changed"&&o.compareSlide&&o.baseIndex>=0&&o.baseIndex<n.length&&(n[o.baseIndex]={...o.compareSlide});for(let o of r)o.status==="added"&&o.compareSlide&&n.splice(Math.min(o.compareIndex,n.length),0,{...o.compareSlide});return n}function Yde(t){let{slides:e,activeSlideIndex:n,canvasSize:r,setContent:o,setPresentationProperties:i,setCoreProperties:s,setAppProperties:a,setCustomProperties:l,setSlides:c,setIsDirty:d,ops:u,history:p}=t,[f,h]=useState(false),[m,x]=useState(false),[y,v]=useState(null),S=(D,O)=>{u.updateSlides(U=>U.map((H,j)=>j===n?{...H,notes:D,notesSegments:O&&O.length>0?O:H.notesSegments}:H)),p.markDirty();},w=D=>{u.updateSlides(O=>O.map((U,H)=>H===n?{...U,...D}:U)),p.markDirty();},C=D=>{i(O=>({...O,...D})),p.markDirty();},T=D=>{s(O=>({...O,...D})),p.markDirty();},E=D=>{a(O=>({...O,...D})),p.markDirty();},M=D=>{l(D),p.markDirty();},A=useCallback(D=>{o(D);},[o]),R=useCallback(async()=>{let D=document.createElement("input");D.type="file",D.accept=".pptx",D.onchange=async()=>{let O=D.files?.[0];if(O)try{let U=await O.arrayBuffer(),j=await new l1().load(U);if(!j)return;let Z={slides:e,width:r.width,height:r.height};v(LQ(Z,j)),x(!0);}catch(U){console.warn("Compare failed:",U);}},D.click();},[e,r.width,r.height]),k=useCallback(D=>{if(!y)return;let O=y.diffs[D];!O||O.status==="unchanged"||(c(U=>Xde(U,O)),d(true));},[y,c,d]),N=useCallback(D=>{},[]),F=useCallback(()=>{y&&(c(D=>Wde(D,y)),d(true));},[y,c,d]),B=useMemo(()=>Vde(e),[e]);return {handleUpdateNotes:S,handleUpdateSlide:w,handleUpdatePresentationProperties:C,handleUpdateCoreProperties:T,handleUpdateAppProperties:E,handleUpdateCustomProperties:M,handleRestoreVersion:A,handleCompare:R,handleAcceptSlide:k,handleRejectSlide:N,handleAcceptAllSlides:F,isVersionHistoryOpen:f,setIsVersionHistoryOpen:h,isComparePanelOpen:m,setIsComparePanelOpen:x,compareResult:y,usedFontFamilies:B}}function qde(t){let{handlerRef:e,serializeSlides:n,setContent:r,onContentChange:o,setTheme:i,setSlideMasters:s,slideMasters:a,history:l}=t,c=async()=>{let w=await n();w&&(r(w),o&&o(w),l.markDirty());};return {handleApplyTheme:async(w,C)=>{let T=e.current;T&&(await T.setPresentationTheme(w,C),s(E=>E.map((M,A)=>C||A===0?{...M,themePath:w}:M)),await c());},handleUpdateThemeColorScheme:async w=>{let C=e.current;C&&(await C.updateThemeColorScheme(w),i(T=>T?{...T,colorScheme:w}:{colorScheme:w}),await c());},handleUpdateThemeFontScheme:async w=>{let C=e.current;C&&(await C.updateThemeFontScheme(w),i(T=>T?{...T,fontScheme:w}:{fontScheme:w}),await c());},handleUpdateThemeName:async w=>{let C=e.current;C&&(await C.updateThemeName(w),i(T=>T?{...T,name:w}:{name:w}),l.markDirty());},handleApplyThemeToPresentation:async()=>{let w=e.current;if(!w)return;let C=a[0]?.themePath;C&&await w.setPresentationTheme(C,true),await c();},handleApplyThemeData:async(w,C,T)=>{let E=e.current;E&&(await E.applyTheme(w,C,T),i(M=>({...M,colorScheme:w,fontScheme:C,...T&&{name:T}})),await c());},handleSetTemplateBackground:(w,C)=>{let T=e.current;T&&(T.setTemplateBackground(w,C),s(E=>E.map(M=>M.path===w?{...M,backgroundColor:C}:M)),l.markDirty());},handleGetTemplateBackgroundColor:w=>{let C=e.current;if(C)return C.getTemplateBackgroundColor(w)},handleGetAvailableThemes:async()=>{let w=e.current;return w?w.getAvailableThemes():[]},handleSwitchTheme:async w=>{let C=e.current;C&&(await C.setPresentationTheme(w,true),s(T=>T.map(E=>({...E,themePath:w}))),await c());}}}function Kde(t){let{state:e,slides:n,activeSlideIndex:r,canvasSize:o,filePath:i,history:s,ops:a,zoom:l,handlerRef:c,serializeSlides:d,setContent:u,onContentChange:p}=t,f=zde({slides:n,activeSlide:n[r],activeSlideIndex:r,filePath:i,canvasStageRef:l.canvasStageRef,setActiveSlideIndex:e.setActiveSlideIndex,handlerRef:c,serializeSlides:d,headerFooter:e.headerFooter,presentationProperties:e.presentationProperties,customShows:e.customShows,sections:e.sections,coreProperties:e.coreProperties??null,appProperties:e.appProperties??null,customProperties:e.customProperties,notesMaster:e.notesMaster,handoutMaster:e.handoutMaster,guides:e.guides,activeSlideIndexForGuides:e.activeSlideIndex}),h=Gde({slides:n,activeSlideIndex:r,canvasStageRef:l.canvasStageRef,setActiveSlideIndex:e.setActiveSlideIndex}),m=qde({handlerRef:c,serializeSlides:d,setContent:u,onContentChange:p,setTheme:e.setTheme,setSlideMasters:e.setSlideMasters,slideMasters:e.slideMasters,history:s}),x=Yde({slides:n,activeSlideIndex:r,canvasSize:o,setContent:u,setPresentationProperties:e.setPresentationProperties,setCoreProperties:e.setCoreProperties,setAppProperties:e.setAppProperties,setCustomProperties:e.setCustomProperties,setSlides:e.setSlides,setIsDirty:e.setIsDirty,ops:a,history:s});return {exportHandlers:f,printHandlers:h,themeHandlers:m,propertyHandlers:x}}var CJe=2,TJe=20;function Zde(t){let e=useRef(t);e.current=t;let n=useCallback(r=>{let{mode:o,canEdit:i,inlineEditingElementId:s,tableEditorState:a,activeTool:l,hasSelection:c,onDelete:d,onCopy:u,onCut:p,onPaste:f,onDuplicate:h,onUndo:m,onRedo:x,onSelectAll:y,onEscape:v,onNudge:S,onPrevSlide:w,onNextSlide:C}=e.current;if(o!=="edit"||!i)return;let T=r.target,E=T?.tagName==="INPUT"||T?.tagName==="TEXTAREA"||T?.isContentEditable;if(r.key==="Escape"){r.preventDefault(),v();return}if(s||a?.isEditing||l!=="select"||E)return;let M=r.metaKey||r.ctrlKey;if((r.key==="Delete"||r.key==="Backspace")&&c){r.preventDefault(),d();return}if(M)switch(r.key.toLowerCase()){case "z":r.preventDefault(),r.shiftKey?x():m();return;case "y":r.preventDefault(),x();return;case "c":c&&(r.preventDefault(),u());return;case "x":c&&(r.preventDefault(),p());return;case "v":r.preventDefault(),f();return;case "d":c&&(r.preventDefault(),h());return;case "a":r.preventDefault(),y();return}if(c&&(r.key==="ArrowUp"||r.key==="ArrowDown"||r.key==="ArrowLeft"||r.key==="ArrowRight")){r.preventDefault();let A=r.shiftKey?TJe:CJe,R=0,k=0;switch(r.key){case "ArrowUp":k=-A;break;case "ArrowDown":k=A;break;case "ArrowLeft":R=-A;break;case "ArrowRight":R=A;break}S(R,k);return}!c&&(r.key==="ArrowLeft"||r.key==="ArrowRight")&&(r.preventDefault(),r.key==="ArrowLeft"?w?.():C?.());},[]);useEffect(()=>{let r=t.containerRef.current;return r&&r.addEventListener("keydown",n),window.addEventListener("keydown",n),()=>{r&&r.removeEventListener("keydown",n),window.removeEventListener("keydown",n);}},[t.containerRef,n]);}function Jde(t){let{state:e,mode:n,canEdit:r,slides:o,activeSlide:i,ops:s,manipulation:a,history:l}=t;Zde({containerRef:e.containerRef,mode:n,canEdit:r,inlineEditingElementId:e.inlineEditingElementId,tableEditorState:e.tableEditorState,activeTool:e.activeTool,hasSelection:e.effectiveSelectedIds.length>0,effectiveSelectedIds:e.effectiveSelectedIds,onDelete:a.handleDelete,onCopy:a.handleCopy,onCut:a.handleCut,onPaste:a.handlePaste,onDuplicate:a.handleDuplicate,onUndo:l.handleUndo,onRedo:l.handleRedo,onSelectAll:()=>{if(!i)return;let c=i.elements.map(d=>d.id);c.length>0&&s.applySelection(c[0],c);},onEscape:()=>{e.inlineEditingElementId?(e.setInlineEditingElementId(null),e.setInlineEditingText("")):e.contextMenuState?e.setContextMenuState(null):e.tableEditorState?e.setTableEditorState(null):s.clearSelection();},onNudge:(c,d)=>{let u=e.effectiveSelectedIds;if(u.length){for(let p of u){let f=e.elementLookup.get(p);f&&s.updateElementById(p,{x:f.x+c,y:f.y+d});}l.markDirty();}},onPrevSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.max(0,c-1));},onNextSlide:()=>{o.length!==0&&e.setActiveSlideIndex(c=>Math.min(o.length-1,c+1));}});}function MJe(t,e,n,r,o,i,s,a,l){let c=e,d=n,u=r,p=o;switch(t){case "se":u=Math.max(12,r+i),p=Math.max(12,o+s);break;case "sw":c=e+i,u=Math.max(12,r-i),p=Math.max(12,o+s);break;case "ne":d=n+s,u=Math.max(12,r+i),p=Math.max(12,o-s);break;case "nw":c=e+i,d=n+s,u=Math.max(12,r-i),p=Math.max(12,o-s);break;case "n":d=n+s,p=Math.max(12,o-s);break;case "s":p=Math.max(12,o+s);break;case "e":u=Math.max(12,r+i);break;case "w":c=e+i,u=Math.max(12,r-i);break}if(a){let f=l;if(t==="se"||t==="ne"||t==="e"){let h=Math.round((c+u)/f)*f;u=Math.max(12,h-c);}if(t==="sw"||t==="nw"||t==="w"){let h=Math.round(c/f)*f;u=Math.max(12,u+(c-h)),c=h;}if(t==="se"||t==="sw"||t==="s"){let h=Math.round((d+p)/f)*f;p=Math.max(12,h-d);}if(t==="ne"||t==="nw"||t==="n"){let h=Math.round(d/f)*f;p=Math.max(12,p+(d-h)),d=h;}}return {x:c,y:d,width:u,height:p}}function _Je(t,e,n){let o=e/(n||200);return Math.max(0,Math.min(1,t+o))}function Qde(t,e,n){let{editorScale:r,canvasStageRef:o,canvasSize:i,snapToGrid:s,snapToShape:a,gridSpacingPx:l,editTemplateMode:c,templateElements:d,activeSlide:u,guides:p,elementLookup:f,marqueeStateRef:h,dragStateRef:m,resizeStateRef:x,shapeAdjustmentDragStateRef:y,setMarqueeSelectionState:v,setSnapLines:S,updateElementById:w}=e,C=h.current;if(C){EJe(t,C,o,i,r,v);return}let T=m.current;if(T){AJe(t,T,r,s,a,l,c,d,u,p,f,n,S);return}let E=x.current;if(E){PJe(t,E,r,s,l);return}let M=y.current;M&&RJe(t,M,r,w);}function EJe(t,e,n,r,o,i){let s=n.current;if(!s)return;let a=s.getBoundingClientRect();e.currentX=Math.max(0,Math.min(r.width,(t.clientX-a.left)/o)),e.currentY=Math.max(0,Math.min(r.height,(t.clientY-a.top)/o)),i({...e});}function AJe(t,e,n,r,o,i,s,a,l,c,d,u,p){let f=(t.clientX-e.startClientX)/n,h=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(f)>2||Math.abs(h)>2)&&(e.moved=true),!e.moved)return;let m=f,x=h,y=Object.keys(e.startPositionsById),v=y[0],S=v?e.startPositionsById[v]:void 0,w=v?d.get(v):void 0;if(S&&w){let C=S.x+m,T=S.y+x;if(r&&(C=Math.round(C/i)*i,T=Math.round(T/i)*i),o){let M=(s?a:l?.elements??[]).map(N=>({id:N.id,x:N.x,y:N.y,width:N.width,height:N.height})),A=K7(C,T,w.width,w.height,M,new Set(y),c.map(N=>({axis:N.axis,position:N.position})));C=A.x,T=A.y;let R=A.lines.map(N=>({axis:N.axis==="v"?"x":"y",position:N.position})),k=JSON.stringify(R);k!==u.lastSnapLinesKey&&(u.lastSnapLinesKey=k,p(R));}else u.lastSnapLinesKey!=="[]"&&(u.lastSnapLinesKey="[]",p([]));m=C-S.x,x=T-S.y;}e.lastDx=m,e.lastDy=x;for(let[C,T]of e.domEls){let E=e.startPositionsById[C];E&&(T.style.left=`${E.x+m}px`,T.style.top=`${E.y+x}px`);}}function PJe(t,e,n,r,o){let i=(t.clientX-e.startClientX)/n,s=(t.clientY-e.startClientY)/n;if(!e.moved&&(Math.abs(i)>2||Math.abs(s)>2)&&(e.moved=true),!e.moved)return;let a=MJe(e.handle,e.startX,e.startY,e.startWidth,e.startHeight,i,s,r,o);e.lastX=a.x,e.lastY=a.y,e.lastWidth=a.width,e.lastHeight=a.height,e.domEl&&(e.domEl.style.left=`${a.x}px`,e.domEl.style.top=`${a.y}px`,e.domEl.style.width=`${Math.max(a.width,12)}px`,e.domEl.style.height=`${Math.max(a.height,12)}px`);}function RJe(t,e,n,r){let o=(t.clientX-e.startClientX)/n,i=_Je(e.startAdjustment,o,e.startWidth);!e.moved&&Math.abs(o)>2&&(e.moved=true),e.moved&&r(e.elementId,{shapeAdjustments:{[e.key]:i}});}function kJe(t,e){let n=Math.min(t.startX,t.currentX),r=Math.min(t.startY,t.currentY),o=Math.max(t.startX,t.currentX),i=Math.max(t.startY,t.currentY),s=o-n,a=i-r;return s<=3&&a<=3?[]:e.filter(l=>{let c=l.x,d=l.y,u=l.x+Math.max(l.width,12),p=l.y+Math.max(l.height,12);return !(u<n||c>o||p<r||d>i)}).map(l=>l.id)}function IJe(t,e){return Array.from(new Set([...t??[],...e]))}function eue(t){let{editTemplateMode:e,templateElements:n,activeSlide:r,activeSlideIndex:o,marqueeStateRef:i,dragStateRef:s,resizeStateRef:a,shapeAdjustmentDragStateRef:l,setMarqueeSelectionState:c,setSnapLines:d,setTemplateElementsBySlideId:u,setPointerCommitNonce:p,applySelection:f,clearSelection:h,updateSlides:m,updateElementById:x,markDirty:y}=t,v=i.current,S=s.current,w=a.current,C=l.current;if(v&&(NJe(v,e,n,r,f,h),i.current=null,c(null)),S?.moved&&DJe(S,e,r,o,u,m),w?.moved){let E=w.elementId,M={x:w.lastX,y:w.lastY,width:w.lastWidth,height:w.lastHeight};x(E,M);let A=new Set([E]);m(R=>R.map((k,N)=>{if(N!==o)return k;let F=YR(k.elements,A);return F.length===0?k:{...k,elements:qR(k.elements,F)}}));}let T=S?.moved||w?.moved||C?.moved;i.current=null,s.current=null,a.current=null,l.current=null,c(null),d([]),T&&(y(),p(E=>E+1));}function NJe(t,e,n,r,o,i){let s=e?n:r?.elements??[],a=kJe(t,s);if(t.additive){let l=IJe(t.baseSelectionIds,a);l.length>0?o(l[0],l):i();}else a.length>0?o(a[0],a):i();}function DJe(t,e,n,r,o,i){let s=t.lastDx,a=t.lastDy;if(e){let l=new Set(Object.keys(t.startPositionsById));o(c=>{let d=n?.id;if(!d)return c;let p=(c[d]??[]).map(h=>{let m=t.startPositionsById[h.id];return m?{...h,x:m.x+s,y:m.y+a}:h}),f=YR(p,l);return {...c,[d]:qR(p,f)}});}else {let l=new Set(Object.keys(t.startPositionsById));i(c=>c.map((d,u)=>{if(u!==r)return d;let p=d.elements.map(h=>{let m=t.startPositionsById[h.id];return m?{...h,x:m.x+s,y:m.y+a}:h}),f=YR(p,l);return {...d,elements:qR(p,f)}}));}}function tue(t){let{editorScale:e,canvasStageRef:n,canvasSize:r,activeSlide:o,activeSlideIndex:i,gridSpacingPx:s,dragStateRef:a,resizeStateRef:l,shapeAdjustmentDragStateRef:c,marqueeStateRef:d,editTemplateMode:u,snapToGrid:p,snapToShape:f,guides:h,templateElements:m,elementLookup:x,setMarqueeSelectionState:y,setSnapLines:v,setTemplateElementsBySlideId:S,setPointerCommitNonce:w,applySelection:C,clearSelection:T,updateSlides:E,updateElementById:M,markDirty:A}=t;useEffect(()=>{let R={rafId:0,pendingMoveEvent:null,lastSnapLinesKey:""},k=F=>{R.pendingMoveEvent=F,R.rafId===0&&(R.rafId=requestAnimationFrame(()=>{R.rafId=0,R.pendingMoveEvent&&(Qde(R.pendingMoveEvent,t,R),R.pendingMoveEvent=null);}));},N=()=>{R.rafId!==0&&(cancelAnimationFrame(R.rafId),R.rafId=0,R.pendingMoveEvent=null),eue(t);};return document.addEventListener("pointermove",k),document.addEventListener("pointerup",N),()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",N),R.rafId!==0&&cancelAnimationFrame(R.rafId);}},[e,n,a,l,c,d,u,p,f,h,m,y,v,x,S,w,o,i,r.width,r.height,s,C,T,E,M,A,t]);}function nue(t){let{alreadyChecked:e,filePath:n,loading:r,error:o,slideCount:i}=t;return !(e||!n||r||o||i===0)}var FJe=1440*60*1e3;function BJe(t,e){return e-t<FJe}function rue(t,e){return t.length===0?false:BJe(t[0].timestamp,e)}var $Je="pptx-viewer-autosave",HJe=1,XN="recoveryVersions";function zJe(){return new Promise((t,e)=>{let n=indexedDB.open($Je,HJe);n.onupgradeneeded=()=>{let r=n.result;r.objectStoreNames.contains(XN)||r.createObjectStore(XN,{keyPath:"key"});},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error);})}async function GJe(t){try{let e=await zJe();return new Promise(n=>{let i=e.transaction(XN,"readonly").objectStore(XN).get(t);i.onsuccess=()=>{e.close(),n(i.result);},i.onerror=()=>{e.close(),n(void 0);};})}catch{return}}function oue(t){let{filePath:e,loading:n,error:r,slideCount:o,openVersionHistory:i}=t,s=useRef(false);useEffect(()=>{nue({alreadyChecked:s.current,filePath:e,loading:n,error:r,slideCount:o})&&(s.current=true,!(typeof indexedDB>"u")&&(async()=>{try{let a=await GJe(e);a&&rue([a],Date.now())&&i();}catch{}})());},[e,n,r,o,i]);}function iue(t){let{state:e,zoom:n,history:r,presentation:o,annotations:i,actionSoundHandlerRef:s,editorOps:a,gridSpacingPx:l,content:c,filePath:d,canEdit:u,mode:p,slides:f,activeSlide:h,activeSlideIndex:m,canvasSize:x,loading:y,error:v,ref:S,setContent:w,onContentChange:C,onDirtyChange:T,onActiveSlideChange:E}=t;tue({editorScale:n.editorScale,canvasStageRef:n.canvasStageRef,canvasSize:x,activeSlide:h,activeSlideIndex:m,gridSpacingPx:l,dragStateRef:e.dragStateRef,resizeStateRef:e.resizeStateRef,shapeAdjustmentDragStateRef:e.shapeAdjustmentDragStateRef,marqueeStateRef:e.marqueeStateRef,editTemplateMode:e.editTemplateMode,snapToGrid:e.snapToGrid,snapToShape:e.snapToShape,guides:e.guides,templateElements:e.templateElements,elementLookup:e.elementLookup,setMarqueeSelectionState:e.setMarqueeSelectionState,setSnapLines:e.setSnapLines,setTemplateElementsBySlideId:e.setTemplateElementsBySlideId,setPointerCommitNonce:e.setPointerCommitNonce,effectiveSelectedIds:e.effectiveSelectedIds,applySelection:a.ops.applySelection,clearSelection:a.ops.clearSelection,updateSlides:a.ops.updateSlides,updateElementById:a.ops.updateElementById,markDirty:r.markDirty});let[M,A]=useState(false),{handlerRef:R,serializeSlides:k,autosaveStatus:N}=Nde({content:c,filePath:d,slides:f,state:e,history:r,ops:a.ops,actionSoundHandlerRef:s,setIsEncryptedDialogOpen:A}),{exportHandlers:F,printHandlers:B,themeHandlers:D,propertyHandlers:O}=Kde({state:e,slides:f,activeSlideIndex:m,canvasSize:x,filePath:d,history:r,ops:a.ops,zoom:n,handlerRef:R,serializeSlides:k,setContent:w,onContentChange:C}),{showKeepAnnotationsDialog:U,handleSetMode:H,handleKeepAnnotations:j,handleDiscardAnnotations:Z,handleEnterPresenterView:J,handleEnterRehearsalMode:W}=vde({mode:p,presentation:o,annotations:i,history:r,setMode:e.setMode,setSlides:e.setSlides});return oue({filePath:d,loading:y,error:v,slideCount:f.length,openVersionHistory:()=>O.setIsVersionHistoryOpen(true)}),useImperativeHandle(S,()=>({async getContent(){let te=await k();return te&&C&&C(te),te??new Uint8Array(0)}}),[k,C]),useEffect(()=>{T&&T(e.isDirty);},[e.isDirty,T]),useEffect(()=>{E&&E(m);},[m,E]),useEffect(()=>{e.activeSlideIndexRef.current=m;},[m,e.activeSlideIndexRef]),Jde({state:e,mode:p,canEdit:u,slides:f,activeSlide:h,ops:a.ops,manipulation:a.manipulation,history:r}),{exportHandlers:F,printHandlers:B,themeHandlers:D,propertyHandlers:O,showKeepAnnotationsDialog:U,handleSetMode:H,handleKeepAnnotations:j,handleDiscardAnnotations:Z,handleEnterPresenterView:J,handleEnterRehearsalMode:W,autosaveStatus:N,isEncryptedDialogOpen:M,setIsEncryptedDialogOpen:A}}function XJe(t,e){let n=new Map;for(let r of t)n.set(r.id,r);for(let r of e)n.set(r.id,r);return n}function WJe(t,e){return e.length>0?e:t?[t]:[]}function YJe(t,e){if(!(e===null||!t?.layouts))return t.layouts[e]}function qJe(t,e){return e?e.elements??[]:t?t.elements??[]:[]}function sue(t){let{slides:e,activeSlideIndex:n,templateElementsBySlideId:r,selectedElementId:o,selectedElementIds:i,slideMasters:s,activeMasterIndex:a,activeLayoutIndex:l,notesMaster:c,handoutMaster:d}=t,u=e[n],p=useMemo(()=>u?r[u.id]??[]:[],[u,r]),f=useMemo(()=>XJe(p,u?.elements??[]),[u,p]),h=useMemo(()=>o?f.get(o)??null:null,[f,o]),m=useMemo(()=>WJe(o,i),[o,i]),x=useMemo(()=>new Set(m),[m]),y=useMemo(()=>m.map(E=>f.get(E)).filter(Boolean),[m,f]),v=s[a],S=useMemo(()=>YJe(v,l),[v,l]),w=useMemo(()=>qJe(v,S),[v,S]),C=useMemo(()=>c?.elements??[],[c]),T=useMemo(()=>d?.elements??[],[d]);return {activeSlide:u,templateElements:p,elementLookup:f,selectedElement:h,effectiveSelectedIds:m,selectedElementIdSet:x,selectedElements:y,activeMaster:v,activeLayout:S,masterViewElements:w,notesMasterElements:C,handoutMasterElements:T}}function lue(t){let e=useRef(null),n=useRef(null),r=useRef(null),o=useRef(0),i=useRef(null),s=useRef(null),a=useRef(null),l=useRef(null),c=useRef(false),[d,u]=useState("edit"),[p,f]=useState(true),[h,m]=useState(null),[x,y]=useState([]),[v,S]=useState({}),[w,C]=useState({width:1280,height:720}),[T,E]=useState(0),[M,A]=useState(null),[R,k]=useState([]),[N,F]=useState(false),B=useRef(null),D=useRef(""),[O,U]=useState(null),[H,j]=useState(""),Z=useCallback(yo=>{let ia=typeof yo=="function"?yo(B.current):yo;B.current=ia,U(yo);},[]),J=useCallback(yo=>{let ia=typeof yo=="function"?yo(D.current):yo;D.current=ia,j(yo);},[]),[W,te]=useState(false),[se,Ce]=useState("rect"),[ee,ce]=useState(null),[de,Ne]=useState(0),[Ue,he]=useState({}),[Be,Me]=useState([]),[ge,Te]=useState([]),[be,xe]=useState(),[Pe,Xe]=useState(),[Y,Ge]=useState([]),[Ve,We]=useState([]),[ke,wt]=useState(null),[V,$]=useState([]),[ie,ve]=useState({}),[De,$e]=useState(),[ze,ae]=useState(),[Se,Ye]=useState(),[Q,pe]=useState([]),[Re,nt]=useState([]),[Ke,Ct]=useState(),[ne,Ze]=useState(),[Le,rt]=useState([]),[qe,He]=useState(false),[gt,Nt]=useState(false),[In,yn]=useState(0),[Zo,Ii]=useState(0),[La,Qc]=useState(null),[ed,ra]=useState("edit"),[oa,Fs]=useState("slides"),[Sr,pl]=useState(4),Bs=sue({slides:x,activeSlideIndex:T,templateElementsBySlideId:v,selectedElementId:M,selectedElementIds:R,slideMasters:ge,activeMasterIndex:Zo,activeLayoutIndex:La,notesMaster:De,handoutMaster:ze});return {containerRef:e,imageInputRef:n,mediaInputRef:r,activeSlideIndexRef:o,inlineEditingElementIdRef:B,inlineEditingTextRef:D,dragStateRef:i,resizeStateRef:s,shapeAdjustmentDragStateRef:a,marqueeStateRef:l,isDrawingRef:c,mode:d,setMode:u,loading:p,setLoading:f,error:h,setError:m,slides:x,setSlides:y,templateElementsBySlideId:v,setTemplateElementsBySlideId:S,canvasSize:w,setCanvasSize:C,activeSlideIndex:T,setActiveSlideIndex:E,selectedElementId:M,setSelectedElementId:A,selectedElementIds:R,setSelectedElementIds:k,isDirty:N,setIsDirty:F,inlineEditingElementId:O,setInlineEditingElementId:Z,inlineEditingText:H,setInlineEditingText:J,editTemplateMode:W,setEditTemplateMode:te,newShapeType:se,setNewShapeType:Ce,clipboardPayload:ee,setClipboardPayload:ce,pointerCommitNonce:de,setPointerCommitNonce:Ne,headerFooter:Ue,setHeaderFooter:he,layoutOptions:Be,setLayoutOptions:Me,slideMasters:ge,setSlideMasters:Te,theme:be,setTheme:xe,tableStyleMap:Pe,setTableStyleMap:Xe,themeOptions:Y,setThemeOptions:Ge,customShows:Ve,setCustomShows:We,activeCustomShowId:ke,setActiveCustomShowId:wt,sections:V,setSections:$,presentationProperties:ie,setPresentationProperties:ve,notesMaster:De,setNotesMaster:$e,handoutMaster:ze,setHandoutMaster:ae,notesCanvasSize:Se,setNotesCanvasSize:Ye,customProperties:Q,setCustomProperties:pe,tagCollections:Re,setTagCollections:nt,coreProperties:Ke,setCoreProperties:Ct,appProperties:ne,setAppProperties:Ze,embeddedFonts:Le,setEmbeddedFonts:rt,hasMacros:qe,setHasMacros:He,hasDigitalSignatures:gt,setHasDigitalSignatures:Nt,digitalSignatureCount:In,setDigitalSignatureCount:yn,activeMasterIndex:Zo,setActiveMasterIndex:Ii,activeLayoutIndex:La,setActiveLayoutIndex:Qc,preMasterMode:ed,setPreMasterMode:ra,masterViewTab:oa,setMasterViewTab:Fs,handoutSlidesPerPage:Sr,setHandoutSlidesPerPage:pl,...Bs}}function cue(){let[t,e]=useState(false),[n,r]=useState("home"),[o,i]=useState(()=>typeof window>"u"?true:window.innerWidth>=768),[s,a]=useState(false),[l,c]=useState(true),[d,u]=useState(false),[p,f]=useState(false),[h,m]=useState("properties"),[x,y]=useState(false),[v,S]=useState(false),[w,C]=useState(false),[T,E]=useState([]),[M,A]=useState(null),[R,k]=useState(null),[N,F]=useState(true),[B,D]=useState(false),[O,U]=useState(false),[H,j]=useState(true),[Z,J]=useState(true),[W,te]=useState([]),[se,Ce]=useState(null),[ee,ce]=useState([]),[de,Ne]=useState(new Map),[Ue,he]=useState("select"),[Be,Me]=useState("#000000"),[ge,Te]=useState(3),[be,xe]=useState(false),[Pe,Xe]=useState(false),[Y,Ge]=useState(false),[Ve,We]=useState(false),[ke,wt]=useState(false);return {isCompactToolbarOpen:t,setIsCompactToolbarOpen:e,toolbarSection:n,setToolbarSection:r,isSlidesPaneOpen:o,setIsSlidesPaneOpen:i,isInspectorPaneOpen:s,setIsInspectorPaneOpen:a,isSlideNotesCollapsed:l,setIsSlideNotesCollapsed:c,isOverflowMenuOpen:d,setIsOverflowMenuOpen:u,isSidebarCollapsed:p,setIsSidebarCollapsed:f,sidebarPanelMode:h,setSidebarPanelMode:m,showSlideSorter:x,setShowSlideSorter:y,isShortcutHelpOpen:v,setIsShortcutHelpOpen:S,isAccessibilityPanelOpen:w,setIsAccessibilityPanelOpen:C,accessibilityIssues:T,setAccessibilityIssues:E,contextMenuState:M,setContextMenuState:A,tableEditorState:R,setTableEditorState:k,spellCheckEnabled:N,setSpellCheckEnabled:F,showGrid:B,setShowGrid:D,showRulers:O,setShowRulers:U,snapToGrid:H,setSnapToGrid:j,snapToShape:Z,setSnapToShape:J,guides:W,setGuides:te,marqueeSelectionState:se,setMarqueeSelectionState:Ce,snapLines:ee,setSnapLines:ce,mediaDataUrls:de,setMediaDataUrls:Ne,activeTool:Ue,setActiveTool:he,drawingColor:Be,setDrawingColor:Me,drawingWidth:ge,setDrawingWidth:Te,isThemeEditorOpen:be,setIsThemeEditorOpen:xe,isThemeGalleryOpen:Pe,setIsThemeGalleryOpen:Xe,formatPainterActive:Y,setFormatPainterActive:Ge,isSelectionPaneOpen:Ve,setIsSelectionPaneOpen:We,eyedropperActive:ke,setEyedropperActive:wt}}function due(t){let e=lue(),n=cue();return {...e,...n}}function hue({canvasSize:t,selectedElements:e}){let n=useRef(null),r=useRef(null),o=useRef(null),i=useRef(1),[s,a]=useState(1),[l,c]=useState(null),d=l||{width:t.width,height:t.height},u=useMemo(()=>{if(!d.width||!d.height)return 1;let C=d.width/t.width,T=d.height/t.height;return Math.min(C,T,1)},[t,d.height,d.width]),p=u*s;useEffect(()=>{i.current=p;},[p]);let f=useCallback((C,T)=>{let E=n.current,M=o.current;if(!E||!M)return;let A=Math.min(Math.max(T,.2),5),R=u*A,k=(C.minX+C.maxX)/2,N=(C.minY+C.maxY)/2,F=M.offsetLeft+k*R-E.clientWidth/2,B=M.offsetTop+N*R-E.clientHeight/2;E.scrollTo({left:Math.max(F,0),top:Math.max(B,0),behavior:"smooth"});},[u]),h=useCallback(()=>{a(C=>Math.min(C+.1,5));},[]),m=useCallback(()=>{a(C=>Math.max(C-.1,.2));},[]),x=useCallback(()=>{a(1);},[]),y=useCallback(()=>{a(1);},[]),v=useCallback(()=>{if(e.length===0)return;let C=Number.POSITIVE_INFINITY,T=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,M=Number.NEGATIVE_INFINITY;if(e.forEach(U=>{C=Math.min(C,U.x),T=Math.min(T,U.y),E=Math.max(E,U.x+Math.max(U.width,12)),M=Math.max(M,U.y+Math.max(U.height,12));}),!Number.isFinite(C)||!Number.isFinite(T)||!Number.isFinite(E)||!Number.isFinite(M))return;let A={minX:C,minY:T,maxX:E,maxY:M},R=Math.max(A.maxX-A.minX,12),k=Math.max(A.maxY-A.minY,12),N=Math.max(d.width-96,12),F=Math.max(d.height-96,12),B=Math.min(N/R,F/k),D=u>Number.EPSILON?u:Number.EPSILON,O=Math.min(Math.max(B/D,.2),5);a(O),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{f(A,O);});});},[f,d.height,d.width,u,e]),S=useCallback(C=>{if(!C.ctrlKey)return;C.preventDefault();let T=C.deltaY*-1e-3;a(E=>Math.min(Math.max(E+T,.2),5));},[]);useEffect(()=>{let C=o.current;if(C)return C.addEventListener("wheel",S,{passive:false}),()=>{C.removeEventListener("wheel",S);}},[S]);let w=useCallback((C,T)=>{let E=r.current;if(!E)return null;let M=E.getBoundingClientRect();if(M.width<=0||M.height<=0)return null;let A=(C-M.left)/p,R=(T-M.top)/p;return {x:Math.max(0,Math.min(t.width,A)),y:Math.max(0,Math.min(t.height,R))}},[t.height,t.width,p]);return {editWrapperRef:n,canvasStageRef:r,canvasViewportRef:o,renderScaleRef:i,scale:s,setScale:a,editorDimensions:l,setEditorDimensions:c,fitScale:u,editorScale:p,handleZoomIn:h,handleZoomOut:m,handleResetZoom:x,handleZoomToFit:y,handleZoomToSelection:v,handleWheel:S,centerBoundsInViewport:f,getCanvasPointFromClient:w}}var xue=forwardRef(function(e,n){let{content:r,filePath:o,canEdit:i=false,onContentChange:s,onDirtyChange:a,onActiveSlideChange:l,theme:c,authorName:d,collaboration:u,onStartCollaboration:p,onStopCollaboration:f,shareDefaults:h}=e,m=q5(c),[x,y]=useState(r);useEffect(()=>{y(r);},[r]);let[v,S]=useState(false),[w,C]=useState(false),{reducedMotion:T,toggleReducedMotion:E}=ude(),M=due(),{containerRef:A,mode:R,slides:k,canvasSize:N,loading:F,error:B,activeSlideIndex:D,selectedElementId:O,selectedElementIds:U,templateElementsBySlideId:H,activeSlide:j,selectedElement:Z}=M,J=cN({containerRef:A}),{isMobile:W,isTouchDevice:te,isVirtualKeyboardOpen:se}=J,Ce=pde(),{gridSpacingPx:ee,visibleSlideIndexes:ce,slideSectionGroups:de,masterPseudoSlide:Ne}=ace({slides:k,sections:M.sections,customShows:M.customShows,activeCustomShowId:M.activeCustomShowId,mode:R,activeLayout:M.activeLayout,activeMaster:M.activeMaster,presentationGridSpacing:M.presentationProperties.gridSpacing}),Ue=useCallback(()=>!!(M.dragStateRef.current||M.resizeStateRef.current||M.marqueeStateRef.current||M.shapeAdjustmentDragStateRef.current||M.isDrawingRef.current),[M.dragStateRef,M.resizeStateRef,M.marqueeStateRef,M.shapeAdjustmentDragStateRef,M.isDrawingRef]),he=hue({canvasSize:N,selectedElements:M.selectedElements}),Be=cce({slides:k,canvasSize:N,activeSlideIndex:D,templateElementsBySlideId:H,editTemplateMode:M.editTemplateMode,headerFooter:M.headerFooter,loading:F,error:B,hasActivePointerInteraction:Ue,pointerCommitNonce:M.pointerCommitNonce,setSlides:M.setSlides,setCanvasSize:M.setCanvasSize,setActiveSlideIndex:M.setActiveSlideIndex,setTemplateElementsBySlideId:M.setTemplateElementsBySlideId,setSelectedElementId:M.setSelectedElementId,setSelectedElementIds:M.setSelectedElementIds,setEditTemplateMode:M.setEditTemplateMode,setHeaderFooter:M.setHeaderFooter}),{presentation:Me,annotations:ge,actionSoundHandlerRef:Te}=dde({mode:R,slides:k,visibleSlideIndexes:ce,activeSlideIndex:D,containerRef:A,content:x,mediaDataUrls:M.mediaDataUrls,presentationProperties:M.presentationProperties,setMode:M.setMode,setActiveSlideIndex:M.setActiveSlideIndex,setSlides:M.setSlides,history:Be});mde({targetRef:he.canvasViewportRef,currentScale:he.scale,callbacks:{onPinchZoom:Se=>he.setScale(Se),onSwipe:R==="present"?Se=>Me.movePresentationSlide(Se===1?-1:1):void 0,onLongPress:(Se,Ye)=>{R!=="edit"||!i||M.selectedElementId&&M.setContextMenuState({x:Se,y:Ye,elementId:M.selectedElementId});}},enabled:te});let be=bde({mode:R,slides:k,activeSlide:j,canvasSize:N,containerRef:A,customShows:M.customShows,activeCustomShowId:M.activeCustomShowId,setCustomShows:M.setCustomShows,setActiveCustomShowId:M.setActiveCustomShowId,setGuides:M.setGuides,setPresentationProperties:M.setPresentationProperties,setAccessibilityIssues:M.setAccessibilityIssues,setIsAccessibilityPanelOpen:M.setIsAccessibilityPanelOpen,setMode:M.setMode,setPreMasterMode:M.setPreMasterMode,setActiveMasterIndex:M.setActiveMasterIndex,setActiveLayoutIndex:M.setActiveLayoutIndex,setSelectedElementId:M.setSelectedElementId,setSelectedElementIds:M.setSelectedElementIds,preMasterMode:M.preMasterMode,hasDigitalSignatures:M.hasDigitalSignatures,isDirty:M.isDirty,history:Be});useEffect(()=>{M.setSelectedElementId(null),M.setSelectedElementIds([]),M.setInlineEditingElementId(null);},[D]);let xe=Bce({state:M,history:Be,zoom:he,mode:R,canEdit:i,slides:k,activeSlide:j,activeSlideIndex:D,selectedElement:Z,selectedElementId:O,selectedElementIds:U,canvasSize:N,dialogs:be,presentation:Me,userName:d??u?.userName,handlerRef:Te}),{exportHandlers:Pe,printHandlers:Xe,themeHandlers:Y,propertyHandlers:Ge,showKeepAnnotationsDialog:Ve,handleSetMode:We,handleKeepAnnotations:ke,handleDiscardAnnotations:wt,handleEnterPresenterView:V,handleEnterRehearsalMode:$,autosaveStatus:ie,isEncryptedDialogOpen:ve,setIsEncryptedDialogOpen:De}=iue({state:M,zoom:he,history:Be,presentation:Me,annotations:ge,actionSoundHandlerRef:Te,editorOps:xe,gridSpacingPx:ee,content:x,filePath:o,canEdit:i,mode:R,slides:k,activeSlide:j,activeSlideIndex:D,canvasSize:N,loading:F,error:B,ref:n,setContent:y,onContentChange:s,onDirtyChange:a,onActiveSlideChange:l});if(F)return jsx(hU,{});if(B)return jsx(mU,{error:B});let $e=R==="edit"&&!W&&!be.isNarrowViewport&&M.isSlidesPaneOpen,ze=R==="master"&&!W&&M.isSlidesPaneOpen,ae=jsxs("div",{ref:A,tabIndex:0,style:m,"data-pptx-viewer":"",className:"h-full w-full bg-background text-foreground flex flex-col relative overflow-hidden outline-none",children:[R!=="present"&&jsx(PH,{mode:R,canEdit:i,state:M,selectedElement:Z,activeSlide:j,zoom:he,history:Be,findReplace:xe.findReplace,manipulation:xe.manipulation,insertHandlers:xe.insertHandlers,exportHandlers:Pe,printHandlers:Xe,propertyHandlers:Ge,dialogs:be,slideOps:xe.slideOps,ops:xe.ops,onSetMode:We,onEnterPresenterView:V,onEnterRehearsalMode:$,onOpenSettings:()=>S(true),onOpenShareDialog:()=>C(true)}),jsx(GH,{mode:R,canEdit:i,slides:k,activeSlide:j,masterPseudoSlide:Ne,activeSlideIndex:D,canvasSize:N,gridSpacingPx:ee,slideSectionGroups:de,showSlidesPane:$e,showMasterPane:ze,selectedElement:Z,state:M,editorOps:xe,dialogs:be,presentation:Me,annotations:ge,propertyHandlers:Ge,themeHandlers:Y,history:Be,comments:xe.comments,zoom:he,isMobile:W,isTouchDevice:te,onEndPresentation:()=>We("edit"),leftPanelWidth:W?void 0:Ce.leftWidth,onResizeLeft:W?void 0:Ce.onResizeLeft,rightPanelWidth:W?void 0:Ce.rightWidth,onResizeRight:W?void 0:Ce.onResizeRight}),R!=="present"&&(!se||!M.isSlideNotesCollapsed)&&jsx(EH,{activeSlide:j,allSlides:k,isSlideNotesCollapsed:M.isSlideNotesCollapsed,canEdit:i,slideCount:k.length,activeSlideIndex:D,isDirty:M.isDirty,autosaveStatus:ie,onToggleNotes:()=>M.setIsSlideNotesCollapsed(Se=>!Se),onUpdateNotes:Ge.handleUpdateNotes,collaborationSlot:u?jsx(QJe,{}):void 0,notesPanelHeight:W?void 0:Ce.bottomHeight,onResizeBottom:W?void 0:Ce.onResizeBottom,scale:he.scale,onZoomIn:he.handleZoomIn,onZoomOut:he.handleZoomOut,onZoomToFit:he.handleZoomToFit,mode:R,onSetMode:We,onToggleSlideSorter:()=>M.setShowSlideSorter(Se=>!Se),hideStatusBar:W}),R!=="present"&&W&&jsx(rce,{state:M,editorOps:xe,presentation:Me,slides:k,activeSlideIndex:D,canvasSize:N,slideSectionGroups:de,canEdit:i,commentCount:j?.comments?.length??0}),jsx(FH,{dialogs:be,insertHandlers:xe.insertHandlers,exportHandlers:Pe,printHandlers:Xe,propertyHandlers:Ge,annotations:ge,slides:k,activeSlideIndex:D,canvasSize:N,filePath:o,coreProperties:M.coreProperties,customProperties:M.customProperties,appProperties:M.appProperties,embeddedFonts:M.embeddedFonts,hasDigitalSignatures:M.hasDigitalSignatures,digitalSignatureCount:M.digitalSignatureCount,presentationProperties:M.presentationProperties,customShows:M.customShows,selectedElements:M.selectedElements,isEncryptedDialogOpen:ve,setIsEncryptedDialogOpen:De,showKeepAnnotationsDialog:Ve,onKeepAnnotations:ke,onDiscardAnnotations:wt}),jsx(ice,{isOpen:v,onClose:()=>S(false),spellCheckEnabled:M.spellCheckEnabled,onSetSpellCheckEnabled:M.setSpellCheckEnabled,showGrid:M.showGrid,onSetShowGrid:M.setShowGrid,showRulers:M.showRulers,onSetShowRulers:M.setShowRulers,snapToGrid:M.snapToGrid,onSetSnapToGrid:M.setSnapToGrid,reducedMotion:T,onToggleReducedMotion:E}),jsx(xH,{open:w,onClose:()=>C(false),activeCollaboration:u,onStartCollaboration:p,onStopCollaboration:f,preconfigured:!!u,defaultRoomId:h?.roomId,defaultUserName:h?.userName,defaultServerUrl:h?.serverUrl}),jsx(fH,{open:be.isBroadcastDialogOpen,onClose:()=>be.setIsBroadcastDialogOpen(false),onStartBroadcast:p,onStopBroadcast:f,onStartPresenting:()=>We("present"),defaultRoomId:h?.roomId,defaultUserName:h?.userName,defaultServerUrl:h?.serverUrl}),jsx(MH,{isShortcutHelpOpen:M.isShortcutHelpOpen,isAccessibilityPanelOpen:M.isAccessibilityPanelOpen,showSlideSorter:M.showSlideSorter,accessibilityIssues:M.accessibilityIssues,slides:k,activeSlideIndex:D,canvasSize:N,canEdit:i,sectionGroups:de,onCloseShortcuts:()=>M.setIsShortcutHelpOpen(false),onCloseAccessibility:()=>M.setIsAccessibilityPanelOpen(false),onSelectSlide:Se=>{M.setActiveSlideIndex(Se),M.setShowSlideSorter(false);},onMoveSlide:xe.slideOps.handleMoveSlide,onDeleteSlides:xe.slideOps.handleDeleteSlides,onDuplicateSlides:xe.slideOps.handleDuplicateSlides,onToggleHideSlides:xe.slideOps.handleToggleHideSlides,onCloseSorter:()=>M.setShowSlideSorter(false),reducedMotion:T,onToggleReducedMotion:E}),jsx(OH,{mode:R,slides:k,canvasSize:N,templateElements:M.templateElements,presentation:Me,onExitPresentation:()=>We("edit")})]});return jsx(pE,{theme:c,children:u?jsxs(T6,{config:u,canvasWidth:N.width,canvasHeight:N.height,children:[jsx(eQe,{slides:k,setSlides:M.setSlides}),jsx(tQe,{activeSlideIndex:D,setActiveSlideIndex:M.setActiveSlideIndex,slideCount:k.length}),ae]}):ae})});xue.displayName="PowerPointViewer";function QJe(){let t=qi();return t?jsx(E6,{status:t.status,connectedCount:t.connectedCount,onRetry:t.retry}):null}function eQe({slides:t,setSlides:e}){let n=qi();return XH({doc:n?.doc??null,slides:t,setSlides:e,isConnected:n?.status==="connected"}),null}function tQe({activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n}){let r=qi();return WH({collab:r,activeSlideIndex:t,setActiveSlideIndex:e,slideCount:n}),null}/**
|
|
4807
4807
|
* @fileoverview Save-side writer for slide-layout parts (`p:sldLayout`).
|
|
4808
4808
|
*
|
|
4809
4809
|
* Strategy mirrors {@link PptxHandlerRuntimeSaveSlideMaster}: layouts are
|