@nice2dev/ui-presentations 1.1.10 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -97,8 +97,8 @@ ${o}
97
97
  </svg>`}function Wt(e,t,n,i,o){const r=ze(e);if(r.length===0)return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}" />`;const a=r[0].values,s=a.reduce((g,y)=>g+y,0)||1,c=t/2,u=n/2,m=Math.min(t,n)*.38,p=o?m*.55:0,h=[];let f=-Math.PI/2;return a.forEach((g,y)=>{const v=g/s*Math.PI*2,k=f+v,b=v>Math.PI?1:0,S=i[y%i.length],_=c+m*Math.cos(f),R=u+m*Math.sin(f),j=c+m*Math.cos(k),Q=u+m*Math.sin(k);if(o){const X=c+p*Math.cos(f),C=u+p*Math.sin(f),$=c+p*Math.cos(k),I=u+p*Math.sin(k);h.push(`<path d="M ${_} ${R} A ${m} ${m} 0 ${b} 1 ${j} ${Q} L ${$} ${I} A ${p} ${p} 0 ${b} 0 ${X} ${C} Z" fill="${S}" />`)}else h.push(`<path d="M ${c} ${u} L ${_} ${R} A ${m} ${m} 0 ${b} 1 ${j} ${Q} Z" fill="${S}" />`);const A=f+v/2,P=m*1.15,L=c+P*Math.cos(A),H=u+P*Math.sin(A);e.labels[y]&&h.push(`<text x="${L}" y="${H}" text-anchor="middle" font-size="11" fill="#444">${Ae(e.labels[y])}</text>`),f=k}),`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}">
98
98
  ${h.join(`
99
99
  `)}
100
- </svg>`}function Ae(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const ae=({slide:e,slideSize:t,theme:n,scale:i=1,selectedElementId:o,onSelectElement:r,onElementDrag:a,onElementResize:s,onElementRotate:c,interactive:u=!1,showGrid:m=!1,gridSnap:p=0,className:h})=>{const[f,g]=d.useState(null),[y,v]=d.useState(null),k=A=>p>0?Math.round(A/p)*p:A,b=d.useMemo(()=>{const A=e.background;if(A.type==="gradient"&&A.gradientStops){const P=A.gradientStops.map(L=>`${L.color} ${L.position*100}%`).join(", ");return{background:`linear-gradient(${A.gradientDirection??180}deg, ${P})`}}return A.type==="image"&&A.imageUrl?{backgroundImage:`url(${A.imageUrl})`,backgroundSize:A.imageFit??"cover",backgroundPosition:"center",backgroundColor:A.color??n.backgroundColor}:{backgroundColor:A.color??n.backgroundColor}},[e.background,n.backgroundColor]),S=d.useCallback((A,P)=>{!u||P.locked||(A.stopPropagation(),r==null||r(P.id),g({id:P.id,startX:A.clientX,startY:A.clientY,elStartX:P.position.x,elStartY:P.position.y}))},[u,r]),_=d.useCallback(A=>{if(f&&a){const P=(A.clientX-f.startX)/i,L=(A.clientY-f.startY)/i,H=k(f.elStartX+P/t.width*100),X=k(f.elStartY+L/t.height*100);a(f.id,H,X)}if(y&&s){const P=(A.clientX-y.startX)/i/t.width*100,L=(A.clientY-y.startY)/i/t.height*100,H=y.elPos;let{x:X,y:C,width:$,height:I}=H;const q=y.handle;q.includes("e")&&($=k(Math.max(2,H.width+P))),q.includes("w")&&($=k(Math.max(2,H.width-P)),X=k(H.x+(H.width-$))),q.includes("s")&&(I=k(Math.max(2,H.height+L))),q.includes("n")&&(I=k(Math.max(2,H.height-L)),C=k(H.y+(H.height-I))),s(y.id,$,I,X,C)}},[f,y,a,s,i,t,k]),R=d.useCallback(()=>{g(null),v(null)},[]),j=d.useCallback((A,P,L)=>{u&&(A.stopPropagation(),A.preventDefault(),v({id:P.id,handle:L,startX:A.clientX,startY:A.clientY,elPos:{...P.position}}))},[u]),Q=d.useCallback(A=>{A.target.classList.contains("nice-slide-canvas__surface")&&(r==null||r(null))},[r]);return l.jsxs("div",{className:`nice-slide-canvas ${h??""}`,style:{width:t.width*i,height:t.height*i,position:"relative",overflow:"hidden",boxShadow:"0 2px 12px var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",borderRadius:4,...b,color:n.textColor,fontFamily:n.fontFamily},onMouseMove:_,onMouseUp:R,onMouseLeave:R,onClick:Q,children:[l.jsx("div",{className:"nice-slide-canvas__surface",style:{width:"100%",height:"100%",position:"absolute"}}),m&&l.jsx("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",opacity:.15},children:Array.from({length:9},(A,P)=>{const L=(P+1)*10;return l.jsxs(d.Fragment,{children:[l.jsx("line",{x1:`${L}%`,y1:"0",x2:`${L}%`,y2:"100%",stroke:"var(--nice-text-secondary, #666)",strokeWidth:"0.5"}),l.jsx("line",{x1:"0",y1:`${L}%`,x2:"100%",y2:`${L}%`,stroke:"var(--nice-text-secondary, #666)",strokeWidth:"0.5"})]},P)})}),[...e.elements].sort((A,P)=>(A.zIndex??0)-(P.zIndex??0)).map(A=>l.jsx(Vt,{element:A,slideSize:t,scale:i,theme:n,isSelected:o===A.id,onMouseDown:P=>S(P,A),onResizeStart:(P,L)=>j(P,A,L),interactive:u},A.id))]})},Bt=["nw","n","ne","e","se","s","sw","w"],Ut={nw:"nwse-resize",n:"ns-resize",ne:"nesw-resize",e:"ew-resize",se:"nwse-resize",s:"ns-resize",sw:"nesw-resize",w:"ew-resize"},Ht={nw:{top:-4,left:-4},n:{top:-4,left:"50%",marginLeft:-4},ne:{top:-4,right:-4},e:{top:"50%",right:-4,marginTop:-4},se:{bottom:-4,right:-4},s:{bottom:-4,left:"50%",marginLeft:-4},sw:{bottom:-4,left:-4},w:{top:"50%",left:-4,marginTop:-4}},Vt=({element:e,slideSize:t,scale:n,theme:i,isSelected:o,onMouseDown:r,onResizeStart:a,interactive:s})=>{const{position:c,content:u,rotation:m,opacity:p}=e,h=c.x/100*t.width*n,f=c.y/100*t.height*n,g=c.width/100*t.width*n,y=c.height/100*t.height*n,v={position:"absolute",left:h,top:f,width:g,height:y,opacity:p??1,transform:m?`rotate(${m}deg)`:void 0,cursor:s&&!e.locked?"move":"default",outline:o?"2px solid var(--nice-primary, #2196f3)":void 0,outlineOffset:o?2:void 0,zIndex:e.zIndex??0};return l.jsxs("div",{style:v,onMouseDown:r,children:[Qt(u,g,y,n,i),o&&s&&!e.locked&&Bt.map(k=>l.jsx("div",{style:{position:"absolute",width:8,height:8,background:"var(--nice-primary, #2196f3)",border:"1px solid var(--nice-bg, #FFF)",borderRadius:2,cursor:Ut[k],zIndex:10,...Ht[k]},onMouseDown:b=>a(b,k)},k))]})};function Qt(e,t,n,i,o){switch(e.kind){case"text":{const r=e;return l.jsx("div",{style:{width:"100%",height:"100%",fontSize:(r.fontSize??16)*i,fontFamily:r.fontFamily??o.fontFamily,fontWeight:r.fontWeight??"normal",color:r.fontColor??o.textColor,textAlign:r.textAlign??"left",lineHeight:r.lineHeight??1.4,whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"hidden"},children:r.text})}case"image":{const r=e;return l.jsx("img",{src:r.src,alt:r.alt??"",style:{width:"100%",height:"100%",objectFit:r.objectFit??"contain",borderRadius:r.borderRadius??0,boxShadow:r.shadow?"0 4px 16px var(--nice-overlay-20, rgba(0, 0, 0, 0.2))":void 0}})}case"shape":{const r=e;return l.jsx("div",{style:{width:"100%",height:"100%",backgroundColor:r.fill??"var(--nice-border, #ccc)",border:r.strokeWidth?`${r.strokeWidth}px solid ${r.stroke??"var(--nice-text, #333)"}`:void 0,borderRadius:r.shapeType==="ellipse"?"50%":0}})}case"code":{const r=e;return l.jsx("pre",{style:{width:"100%",height:"100%",margin:0,padding:12*i,fontSize:(r.fontSize??14)*i,fontFamily:o.codeFontFamily??"monospace",backgroundColor:r.theme==="light"?"var(--nice-bg-secondary, #f5f5f5)":"var(--nice-bg, #1e1e1e)",color:r.theme==="light"?"var(--nice-text, #333)":"var(--nice-text, #d4d4d4)",borderRadius:8,overflow:"auto",whiteSpace:"pre"},children:l.jsx("code",{children:r.code})})}case"chart":{const a=Be(e,t,n);return l.jsx("div",{style:{width:"100%",height:"100%"},dangerouslySetInnerHTML:{__html:a}})}case"table":{const r=e;return l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14*i},children:[l.jsx("thead",{children:l.jsx("tr",{children:r.headers.map((a,s)=>l.jsx("th",{style:{padding:`${6*i}px ${8*i}px`,backgroundColor:r.headerBg??o.primaryColor,color:r.headerColor??"var(--nice-text-on-primary, #fff)",textAlign:"left",borderBottom:`2px solid ${r.borderColor??"var(--nice-border, #ddd)"}`},children:a},s))})}),l.jsx("tbody",{children:r.rows.map((a,s)=>l.jsx("tr",{style:{backgroundColor:r.stripedRows&&s%2===1?"var(--nice-overlay-3, rgba(0, 0, 0, 0.03))":void 0},children:a.map((c,u)=>l.jsx("td",{style:{padding:`${4*i}px ${8*i}px`,borderBottom:`1px solid ${r.borderColor??"var(--nice-border, #eee)"}`},children:c},u))},s))})]})}default:return l.jsx("div",{style:{width:"100%",height:"100%",background:"var(--nice-bg-secondary, #f0f0f0)",borderRadius:4}})}}ae.displayName="SlideCanvas";const Kt=["blank","titleSlide","titleContent","twoColumn","titleOnly","sectionHeader","comparison","custom"],Se=({slide:e,selectedElement:t,onSlideChange:n,onElementChange:i,onRemoveElement:o,className:r})=>{const a=se();return e?t&&e?l.jsxs("div",{className:`nice-pres-panel ${r??""}`,children:[l.jsx("h3",{className:"nice-pres-panel__title",children:a("panel.elementProperties")}),l.jsxs("div",{className:"nice-pres-panel__row",children:[l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["X (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.x*10)/10,min:0,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,x:s??0}}),className:"nice-pres-panel__input"})]}),l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["Y (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.y*10)/10,min:0,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,y:s??0}}),className:"nice-pres-panel__input"})]})]}),l.jsxs("div",{className:"nice-pres-panel__row",children:[l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["W (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.width*10)/10,min:1,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,width:s??1}}),className:"nice-pres-panel__input"})]}),l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["H (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.height*10)/10,min:1,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,height:s??1}}),className:"nice-pres-panel__input"})]})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:["Opacity",l.jsx(E.NiceSlider,{min:0,max:1,step:.05,value:t.opacity??1,onChange:s=>i==null?void 0:i(e.id,t.id,{opacity:s})})]}),t.content.kind==="text"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"nice-pres-panel__label",children:[a("element.text"),l.jsx("textarea",{value:t.content.text,onChange:s=>i==null?void 0:i(e.id,t.id,{content:{...t.content,text:s.target.value}}),className:"nice-pres-panel__textarea",rows:4})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:["Font Size",l.jsx(E.NiceNumberInput,{value:t.content.fontSize??16,min:8,max:200,onChange:s=>i==null?void 0:i(e.id,t.id,{content:{...t.content,fontSize:s??16}}),className:"nice-pres-panel__input"})]})]}),l.jsx(E.NiceButton,{className:"nice-pres-panel__btn nice-pres-panel__btn--danger",variant:"ghost",size:"sm",onClick:()=>o==null?void 0:o(e.id,t.id),children:"Delete Element"})]}):l.jsxs("div",{className:`nice-pres-panel ${r??""}`,children:[l.jsx("h3",{className:"nice-pres-panel__title",children:a("panel.slideProperties")}),l.jsxs("label",{className:"nice-pres-panel__label",children:["Title",l.jsx(E.NiceTextInput,{value:e.title,onChange:s=>n==null?void 0:n(e.id,{title:s}),className:"nice-pres-panel__input"})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.layout"),l.jsx(E.NiceSelect,{value:e.layout,onChange:s=>n==null?void 0:n(e.id,{layout:s}),options:Kt.map(s=>({value:s,label:a(`layout.${s}`)})),className:"nice-pres-panel__select"})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.background"),l.jsx(E.NiceColorPicker,{value:e.background.color??"var(--nice-bg, #fff)",onChange:s=>n==null?void 0:n(e.id,{background:{...e.background,type:"solid",color:s}}),className:"nice-pres-panel__color"})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.notes"),l.jsx("textarea",{value:e.notes??"",onChange:s=>n==null?void 0:n(e.id,{notes:s.target.value||void 0}),className:"nice-pres-panel__textarea",rows:4,placeholder:a("panel.notes")})]})]}):l.jsx("div",{className:`nice-pres-panel nice-pres-panel--empty ${r??""}`,children:l.jsx("p",{style:{color:"var(--nice-text-muted, #999)",fontStyle:"italic",textAlign:"center",padding:16},children:a("panel.noSelection")})})};Se.displayName="SlidePropertyPanel";const Yt=180,we=({slides:e,slideSize:t,theme:n,currentIndex:i,onSelectSlide:o,onAddSlide:r,onDuplicateSlide:a,onRemoveSlide:s,className:c})=>{const u=se(),m=Yt/t.width;return l.jsxs("div",{className:`nice-slide-thumbs ${c??""}`,style:{overflowY:"auto",padding:8},children:[e.map((p,h)=>l.jsxs("div",{className:`nice-slide-thumbs__item ${h===i?"nice-slide-thumbs__item--active":""}`,onClick:()=>o(h),style:{marginBottom:8,border:h===i?"2px solid var(--nice-primary, #2196f3)":"2px solid transparent",borderRadius:4,cursor:"pointer",position:"relative"},children:[l.jsx("div",{style:{pointerEvents:"none"},children:l.jsx(ae,{slide:p,slideSize:t,theme:n,scale:m})}),l.jsxs("div",{style:{fontSize:10,textAlign:"center",padding:"2px 0",color:"var(--nice-text-secondary, #666)"},children:[h+1,". ",p.title]}),(a||s)&&l.jsxs("div",{className:"nice-slide-thumbs__actions",style:{position:"absolute",top:2,right:2,display:"flex",gap:2},children:[a&&l.jsx(E.NiceButton,{className:"nice-slide-thumbs__action-btn",variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),a(p.id)},title:u("toolbar.duplicateSlide"),"aria-label":u("toolbar.duplicateSlide"),style:{fontSize:10,padding:"1px 4px"},children:l.jsx(E.NiceIcon,{name:"copy",size:12})}),s&&e.length>1&&l.jsx(E.NiceButton,{className:"nice-slide-thumbs__action-btn",variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),s(p.id)},title:u("toolbar.deleteSlide"),style:{fontSize:10,padding:"1px 4px",color:"var(--nice-danger-dark, #d32f2f)"},children:"×"})]})]},p.id)),r&&l.jsxs(E.NiceButton,{className:"nice-slide-thumbs__add",variant:"ghost",size:"sm",onClick:r,style:{width:"100%",padding:"8px 0",fontSize:13,color:"var(--nice-text-secondary, #888)"},children:[l.jsx(E.NiceIcon,{name:"plus",size:12})," ",u("toolbar.addSlide")]})]})};we.displayName="SlideThumbnailList";const Xt=[{target:".nice-pres-editor",titleKey:"tutorial.presentationEditor.intro.title",title:"Presentation editor",contentKey:"tutorial.presentationEditor.intro.content",content:"Build slides from the thumbnail rail, add and arrange elements on the canvas, edit them in the property panel, then present or export.",placement:"auto"}];function Gt(e){const t={x:20,y:20,width:60,height:40};switch(e){case"text":return{position:{x:10,y:30,width:80,height:20},content:{kind:"text",text:"New Text",fontSize:24,textAlign:"left"}};case"shape":return{position:{x:30,y:30,width:40,height:30},content:{kind:"shape",shapeType:"rectangle",fill:"var(--nice-info, #6366f1)",stroke:"var(--nice-accent, #4f46e5)",strokeWidth:2}};case"code":return{position:{x:10,y:20,width:80,height:50},content:{kind:"code",code:`// Your code here
101
- console.log("Hello!");`,language:"typescript",theme:"dark"}};case"chart":return{position:t,content:{kind:"chart",chartType:"bar",data:{labels:["Q1","Q2","Q3","Q4"],series:[{name:"Revenue",values:[30,45,60,80],color:"var(--nice-info, #6366f1)"}]}}};case"table":return{position:{x:10,y:20,width:80,height:40},content:{kind:"table",headers:["Name","Value","Status"],rows:[["Item A","100","Active"],["Item B","200","Pending"]],stripedRows:!0}};case"image":return{position:t,content:{kind:"image",src:"",alt:"Image",objectFit:"contain"}};case"diagram":return{position:t,content:{kind:"diagram",autoPlayAnimations:!1}};case"icon":return{position:{x:45,y:40,width:10,height:15},content:{kind:"icon",name:"star",size:48,color:"var(--nice-info, #6366f1)"}};default:return{position:t,content:{kind:"text",text:e,fontSize:16}}}}const Ue=({initialDocument:e,onChange:t,onExport:n,onPresent:i,lang:o="en",showToolbar:r=!0,showThumbnails:a=!0,showPropertyPanel:s=!0,className:c,style:u,tutorial:m})=>{const p=We(e),[h,f]=d.useState(null),[g,y]=d.useState(!1),[v,k]=d.useState(5),b=d.useRef(p.document);p.document!==b.current&&(b.current=p.document,t==null||t(p.document));const S=p.currentSlide,_=d.useMemo(()=>h&&S?S.elements.find(x=>x.id===h)??null:null,[h,S]),R=d.useRef(null),[j,Q]=d.useState(null);d.useEffect(()=>{const x=R.current;if(!x||typeof ResizeObserver>"u")return;const T=new ResizeObserver(([O])=>{Q({w:O.contentRect.width,h:O.contentRect.height})});return T.observe(x),()=>T.disconnect()},[]);const A=d.useMemo(()=>{const{width:x,height:T}=p.document.slideSize;return!j||j.w<=0||j.h<=0?Math.min(1,800/x):Math.min(1,j.w/x,j.h/T)},[p.document.slideSize,j]),P=d.useCallback(x=>{if(!S)return;const{content:T,position:O}=Gt(x),V=p.addElement(S.id,{type:x,position:O,content:T});V&&f(V.id)},[S,p]),L=d.useCallback(x=>{p.addSlide(p.currentSlideIndex,x),p.setCurrentSlideIndex(p.currentSlideIndex+1)},[p]),H=d.useCallback(x=>{p.removeSlide(x),p.currentSlideIndex>=p.slides.length-1&&p.setCurrentSlideIndex(Math.max(0,p.slides.length-2))},[p]),X=d.useCallback((x,T,O)=>{if(!S)return;const V=S.elements.find(K=>K.id===x);V&&p.moveElement(S.id,x,{...V.position,x:T,y:O})},[S,p]),C=d.useCallback((x,T,O,V,K)=>{if(!S)return;const U=S.elements.find(G=>G.id===x);U&&p.moveElement(S.id,x,{...U.position,width:T,height:O,...V!=null?{x:V}:{},...K!=null?{y:K}:{}})},[S,p]),$=d.useCallback(()=>{if(!S||!h)return;const x=Math.max(0,...S.elements.map(T=>T.zIndex??0));p.updateElement(S.id,h,{zIndex:x+1})},[S,h,p]),I=d.useCallback(()=>{if(!S||!h)return;const x=Math.min(0,...S.elements.map(T=>T.zIndex??0));p.updateElement(S.id,h,{zIndex:x-1})},[S,h,p]),q=d.useCallback(x=>{const T=p.document;let O;switch(x){case"ndp":O=Le(T,!0);break;case"html":O=qe(T);break}n==null||n(x,O)},[p,n]),F=d.useCallback(()=>{i==null||i(p.document,p.currentSlideIndex)},[p,i]),W=r?l.jsx(ve,{onAddElement:P,onAddSlide:L,onUndo:p.undo,onRedo:p.redo,canUndo:p.canUndo,canRedo:p.canRedo,onPresent:F,onExport:q}):void 0,J=r?l.jsxs("div",{style:{display:"flex",gap:4,padding:"2px 8px",borderBottom:"1px solid var(--nice-border-color, #eee)",alignItems:"center",fontSize:"0.85em",flexWrap:"wrap"},children:[l.jsx(E.NiceButton,{size:"sm",variant:g?"primary":"ghost",onClick:()=>y(x=>!x),children:"⊞ Grid"}),_&&l.jsxs(l.Fragment,{children:[l.jsx(E.NiceButton,{size:"sm",variant:"ghost",onClick:$,title:"Bring to front",children:"↑ Front"}),l.jsx(E.NiceButton,{size:"sm",variant:"ghost",onClick:I,title:"Send to back",children:"↓ Back"}),l.jsxs(E.NiceButton,{size:"sm",variant:"ghost",onClick:()=>{if(S&&h){const x={..._,id:`el-${Date.now().toString(36)}`,position:{..._.position,x:_.position.x+3,y:_.position.y+3}};p.addElement(S.id,x)}},title:"Duplicate",children:[l.jsx(E.NiceIcon,{name:"copy",size:14})," Duplicate"]})]})]}):void 0,N=a||S?l.jsxs("div",{style:{display:"flex",minHeight:0,height:"100%"},children:[a&&l.jsx("div",{style:{width:200,flexShrink:0,borderRight:"1px solid var(--nice-border-color, #ddd)",background:"var(--nice-bg-secondary, #fafafa)",overflowY:"auto"},children:l.jsx(we,{slides:p.slides,slideSize:p.document.slideSize,theme:p.theme,currentIndex:p.currentSlideIndex,onSelectSlide:p.setCurrentSlideIndex,onAddSlide:()=>L(),onDuplicateSlide:x=>p.duplicateSlide(x),onRemoveSlide:H})}),S&&l.jsxs("div",{style:{width:180,flexShrink:0,borderRight:"1px solid var(--nice-border-color, #ddd)",background:"var(--nice-bg-secondary, #fafafa)",overflowY:"auto",fontSize:"0.85em"},"aria-label":"Slide elements",children:[l.jsxs("div",{style:{padding:"8px 10px",fontWeight:600,borderBottom:"1px solid var(--nice-border-color, #ddd)",position:"sticky",top:0,background:"var(--nice-bg-secondary, #fafafa)"},children:["Elements (",S.elements.length,")"]}),S.elements.length===0?l.jsx("div",{style:{padding:10,color:"var(--nice-text-secondary, #888)",fontStyle:"italic"},children:"No elements yet."}):l.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:S.elements.map((x,T)=>{var K;const O=x.id===h,V=x.content&&x.content.text?`“${x.content.text.slice(0,20)}”`:((K=x.content)==null?void 0:K.kind)||x.type;return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>f(x.id),style:{width:"100%",textAlign:"left",padding:"6px 10px",background:O?"var(--nice-color-primary, #6366f1)":"transparent",color:O?"var(--nice-text-on-primary, #fff)":"inherit",border:"none",borderBottom:"1px solid var(--nice-border-color, #eee)",cursor:"pointer",display:"flex",justifyContent:"space-between",gap:6,font:"inherit"},children:[l.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[T+1,". ",V]}),l.jsx("span",{style:{opacity:.7,fontSize:"0.75em"},children:x.type})]})},x.id)})})]})]}):void 0,M=s?l.jsx("div",{style:{width:260,height:"100%",borderLeft:"1px solid var(--nice-border-color, #ddd)",overflowY:"auto",background:"var(--nice-bg-secondary, #fafafa)"},children:l.jsx(Se,{slide:S,selectedElement:_,onSlideChange:p.updateSlide,onElementChange:p.updateElement,onRemoveElement:p.removeElement})}):void 0;return l.jsx(Oe,{lang:o,children:l.jsxs("div",{className:`nice-pres-editor ${c??""}`,style:{position:"relative",height:"100%",maxWidth:"100%",overflow:"hidden",background:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #111)",...u},children:[l.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:30},children:l.jsx(E.NiceTutorialButton,{steps:E.resolveTutorial(m,Xt)})}),l.jsx(E.NiceAppShell,{flush:!0,menubar:W,toolbar:J,sidebar:N,rightSidebar:M,children:l.jsx("div",{ref:R,style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--nice-bg-tertiary, #e8e8e8)",overflow:"auto",padding:24,minWidth:0},children:S&&l.jsx(ae,{slide:S,slideSize:p.document.slideSize,theme:p.theme,scale:A,selectedElementId:h,onSelectElement:f,onElementDrag:X,onElementResize:C,showGrid:g,gridSnap:v,interactive:!0})})})]})})};Ue.displayName="NicePresentationEditor";const Ee={linear:e=>e,easeIn:e=>e*e,easeOut:e=>e*(2-e),easeInOut:e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*.5)*Math.exp(-6*e),bounce:e=>{if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const n=e-.5454545454545454;return 7.5625*n*n+.75}if(e<2.5/2.75){const n=e-.8181818181818182;return 7.5625*n*n+.9375}const t=e-2.625/2.75;return 7.5625*t*t+.984375}},ye={opacity:1,transform:"",filter:"",visible:!0};function Jt(e,t,n){if(!e)return{...ye};const i=e.entrance;if(!i)return{...ye};if((e.trigger==="onClick"||e.trigger==="afterPrevious")&&!n)return{...ye,opacity:0,visible:!1};const o=i.delayMs??0,r=t-o;if(r<0)return{...ye,opacity:0,visible:!1};const a=Math.min(r/i.durationMs,1),s=(Ee[i.easing??"linear"]??Ee.linear)(a);return Zt(i.effect,s)}function Zt(e,t){const n={opacity:1,transform:"",filter:"",visible:!0};switch(e){case"fadeIn":n.opacity=t;break;case"fadeOut":n.opacity=1-t;break;case"slideInLeft":n.transform=`translateX(${-100*(1-t)}%)`,n.opacity=t;break;case"slideInRight":n.transform=`translateX(${100*(1-t)}%)`,n.opacity=t;break;case"slideInTop":n.transform=`translateY(${-100*(1-t)}%)`,n.opacity=t;break;case"slideInBottom":n.transform=`translateY(${100*(1-t)}%)`,n.opacity=t;break;case"zoomIn":n.transform=`scale(${t})`,n.opacity=t;break;case"zoomOut":n.transform=`scale(${2-t})`,n.opacity=t;break;case"bounceIn":n.transform=`scale(${t>.8?1+.1*Math.sin((t-.8)/.2*Math.PI):t})`,n.opacity=t;break;case"flipInX":n.transform=`perspective(400px) rotateX(${90*(1-t)}deg)`,n.opacity=t;break;case"flipInY":n.transform=`perspective(400px) rotateY(${90*(1-t)}deg)`,n.opacity=t;break;case"rotateIn":n.transform=`rotate(${-180*(1-t)}deg) scale(${t})`,n.opacity=t;break;case"typewriter":n.opacity=t>0?1:0;break;case"wipeLeft":n.transform=`scaleX(${t})`,n.opacity=1;break;case"wipeRight":n.transform=`scaleX(${t})`,n.opacity=1;break;case"splitReveal":n.transform=`scaleY(${t})`,n.opacity=1;break;case"pulse":n.transform=`scale(${1+.05*Math.sin(t*Math.PI*4)})`;break;case"shake":n.transform=`translateX(${5*Math.sin(t*Math.PI*8)*(1-t)}px)`;break;case"glow":n.filter=`drop-shadow(0 0 ${8*t}px gold)`;break}return n}function He(e,t,n="left"){const i={},o={};switch(e){case"fade":i.opacity=1-t,o.opacity=t;break;case"slide":{const r=n==="right"||n==="down"?-1:1,a=n==="up"||n==="down"?"Y":"X";i.transform=`translate${a}(${-r*t*100}%)`,o.transform=`translate${a}(${r*(1-t)*100}%)`;break}case"zoom":i.transform=`scale(${1-t*.3})`,i.opacity=1-t,o.transform=`scale(${.7+t*.3})`,o.opacity=t;break;case"flip":i.transform=`perspective(1000px) rotateY(${t*90}deg)`,i.opacity=t>.5?0:1,o.transform=`perspective(1000px) rotateY(${(1-t)*-90}deg)`,o.opacity=t>.5?1:0;break;default:i.opacity=1-t,o.opacity=t;break}return{outgoing:i,incoming:o}}const en={width:1920,height:1080},tn={width:1024,height:768},nn={width:2560,height:1440},Ve={name:"Corporate",backgroundColor:"#fff",primaryColor:"#1a365d",secondaryColor:"#2b6cb0",accentColor:"#ed8936",textColor:"#2d3748",headingColor:"#1a365d",fontFamily:'"Segoe UI", Roboto, sans-serif',headingFontFamily:'"Segoe UI", Roboto, sans-serif',codeFontFamily:'"Cascadia Code", "Fira Code", monospace'},on={name:"Modern Dark",backgroundColor:"#1a1a2e",primaryColor:"#e94560",secondaryColor:"#0f3460",accentColor:"#16213e",textColor:"#e0e0e0",headingColor:"#fff",fontFamily:"Inter, sans-serif",headingFontFamily:"Inter, sans-serif",codeFontFamily:'"JetBrains Mono", monospace'},rn={name:"Minimal",backgroundColor:"#fafafa",primaryColor:"#333333",secondaryColor:"#666666",accentColor:"#2196f3",textColor:"#333333",headingColor:"#111111",fontFamily:'"Helvetica Neue", Arial, sans-serif',codeFontFamily:'"SF Mono", monospace'},an={name:"NiceToDev",backgroundColor:"#f8f9fa",primaryColor:"#6366f1",secondaryColor:"#8b5cf6",accentColor:"#06b6d4",textColor:"#334155",headingColor:"#1e293b",fontFamily:"Inter, sans-serif",headingFontFamily:'"Plus Jakarta Sans", Inter, sans-serif',codeFontFamily:'"Fira Code", monospace'},sn=500,Qe=({document:e,startSlide:t=0,onExit:n,autoAdvanceMs:i=0,showNotes:o=!1,showSlideNumber:r=!0,showProgressBar:a=!0,showTimer:s=!1,enableTouch:c=!0,autoFullscreen:u=!1,className:m})=>{const[p,h]=d.useState(t),[f,g]=d.useState(0),[y,v]=d.useState(!1),[k,b]=d.useState(0),[S,_]=d.useState(null),[R,j]=d.useState(!1),[Q,A]=d.useState(0),P=d.useRef(null),L=d.useRef(0),H=d.useRef(null),X=d.useRef(null),C=e.slides,$=C[p]??null,I=S!==null?C[S]??null:null,q=e.theme??Ve,F=e.slideSize,W=C.length,J=d.useMemo(()=>{if(!$)return 0;const z=$.elements.filter(D=>{var Y;return(Y=D.animation)==null?void 0:Y.entrance}).map(D=>{var Y;return((Y=D.animation)==null?void 0:Y.buildOrder)??0});return z.length>0?Math.max(...z)+1:0},[$]),N=d.useCallback(z=>{var ce,le;if(z<0||z>=W||z===p||y)return;const D=C[z];if((((ce=D==null?void 0:D.transition)==null?void 0:ce.effect)??"none")==="none"){_(null),h(z),g(0);return}_(p),h(z),g(0),v(!0);const B=((le=D==null?void 0:D.transition)==null?void 0:le.durationMs)??sn,ee=performance.now(),ie=he=>{const _e=Math.min(1,(he-ee)/B);b(_e),_e<1?L.current=requestAnimationFrame(ie):(v(!1),_(null))};L.current=requestAnimationFrame(ie)},[p,W,y,C]),M=d.useCallback(()=>{if(f<J){g(z=>z+1);return}p<W-1&&N(p+1)},[f,J,p,W,N]),x=d.useCallback(()=>{if(f>0){g(z=>z-1);return}p>0&&N(p-1)},[f,p,N]);d.useEffect(()=>{const z=D=>{switch(D.key){case"ArrowRight":case"ArrowDown":case" ":case"Enter":D.preventDefault(),M();break;case"ArrowLeft":case"ArrowUp":case"Backspace":D.preventDefault(),x();break;case"Escape":D.preventDefault(),n==null||n();break;case"Home":D.preventDefault(),N(0);break;case"End":D.preventDefault(),N(W-1);break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[M,x,n,N,W]);const T=d.useCallback(z=>{if(!c)return;const D=z.touches[0];H.current={x:D.clientX,y:D.clientY,time:Date.now()}},[c]),O=d.useCallback(z=>{if(!c||!H.current)return;const D=z.changedTouches[0],Y=D.clientX-H.current.x,B=D.clientY-H.current.y,ee=Date.now()-H.current.time;if(H.current=null,ee>500||Math.abs(Y)<30&&Math.abs(B)<30){M();return}Math.abs(Y)>Math.abs(B)&&(Y<-30?M():Y>30&&x())},[c,M,x]);d.useEffect(()=>{if(s)return X.current=setInterval(()=>A(z=>z+1e3),1e3),()=>{X.current&&clearInterval(X.current)}},[s]);const V=z=>{const D=Math.floor(z/1e3),Y=Math.floor(D/60),B=Math.floor(Y/60);return B>0?`${B}:${String(Y%60).padStart(2,"0")}:${String(D%60).padStart(2,"0")}`:`${Y}:${String(D%60).padStart(2,"0")}`};d.useEffect(()=>{const z=D=>{(D.key==="g"||D.key==="G")&&j(Y=>!Y)};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[]),d.useEffect(()=>{if(i<=0||y)return;const z=setTimeout(M,i);return()=>clearTimeout(z)},[i,M,y,p,f]),d.useEffect(()=>{var D;const z=P.current;return u&&z&&!window.document.fullscreenElement&&((D=z.requestFullscreen)==null||D.call(z).catch(()=>{})),()=>{var Y,B;u&&window.document.fullscreenElement&&((B=(Y=window.document).exitFullscreen)==null||B.call(Y).catch(()=>{})),L.current&&cancelAnimationFrame(L.current)}},[]);const K=d.useMemo(()=>$?$.elements.filter(z=>{var Y;return(Y=z.animation)!=null&&Y.entrance?(z.animation.buildOrder??0)<=f:!0}):[],[$,f]),U=d.useMemo(()=>{if(!y||!$)return{outgoing:{},incoming:{}};const z=$.transition??{effect:"fade"};return He(z.effect,k,z.direction)},[y,$,k]),[G,ne]=d.useState(1),[Z,te]=d.useState(!1);d.useEffect(()=>{const z=()=>{const Y=F.width,B=F.height,ee=!!window.document.fullscreenElement;te(ee);const ie=P.current;let ce,le;if(ee||u)ce=window.innerWidth,le=window.innerHeight;else if(ie){const he=ie.getBoundingClientRect();ce=he.width||Y,le=he.height||B}else ce=Y,le=B;ne(Math.min(ce/Y,le/B))};z();const D=typeof ResizeObserver<"u"&&P.current?new ResizeObserver(z):null;return D&&P.current&&D.observe(P.current),window.addEventListener("resize",z),window.document.addEventListener("fullscreenchange",z),()=>{window.removeEventListener("resize",z),window.document.removeEventListener("fullscreenchange",z),D==null||D.disconnect()}},[F,u]);const ue=d.useCallback(()=>{var D,Y,B;const z=P.current;z&&(window.document.fullscreenElement?(Y=(D=window.document).exitFullscreen)==null||Y.call(D).catch(()=>{}):(B=z.requestFullscreen)==null||B.call(z).catch(()=>{}))},[]),me=u||Z;return l.jsxs("div",{ref:P,className:`nice-pres-player ${m??""}`,style:me?{position:"fixed",inset:0,background:"#000",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",cursor:"none",zIndex:9999}:{position:"relative",width:"100%",height:"100%",minHeight:240,background:"#000",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},onClick:M,onContextMenu:z=>{z.preventDefault(),x()},onTouchStart:T,onTouchEnd:O,children:[R&&l.jsx("div",{style:{position:"absolute",inset:0,zIndex:100,background:"var(--nice-overlay-90, rgba(0, 0, 0, 0.9))",overflowY:"auto",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:16,padding:24,alignContent:"start"},onClick:z=>z.stopPropagation(),children:C.map((z,D)=>l.jsxs("div",{style:{cursor:"pointer",border:D===p?"3px solid var(--nice-primary, #2196f3)":"2px solid transparent",borderRadius:4,overflow:"hidden"},onClick:()=>{N(D),j(!1)},children:[l.jsx(ae,{slide:z,slideSize:F,theme:q,scale:240/F.width,interactive:!1}),l.jsxs("div",{style:{color:"var(--nice-text-primary, #fff)",fontSize:12,textAlign:"center",padding:4},children:[D+1,". ",z.title]})]},z.id))}),y&&I&&l.jsx("div",{style:{position:"absolute",...U.outgoing},children:l.jsx(ae,{slide:I,slideSize:F,theme:q,scale:G,interactive:!1})}),$&&l.jsx("div",{style:{position:"absolute",...y?U.incoming:{}},children:l.jsx(ae,{slide:{...$,elements:K},slideSize:F,theme:q,scale:G,interactive:!1})}),r&&l.jsxs("div",{style:{position:"absolute",bottom:12,right:20,color:"var(--nice-overlay-light-50, rgba(255, 255, 255, 0.5))",fontSize:14,fontFamily:"sans-serif",pointerEvents:"none"},children:[p+1," / ",W]}),o&&($==null?void 0:$.notes)&&l.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",color:"var(--nice-text-on-primary, #fff)",padding:"12px 24px",fontSize:14,fontFamily:"sans-serif",maxHeight:"20vh",overflowY:"auto",pointerEvents:"none"},children:$.notes}),a&&l.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:3,background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",pointerEvents:"none",zIndex:50},children:l.jsx("div",{style:{height:"100%",width:`${(p+1)/W*100}%`,background:"var(--nice-primary, #2196f3)",transition:"width 0.3s ease"}})}),s&&l.jsx("div",{style:{position:"absolute",top:12,right:20,color:"var(--nice-overlay-light-50, rgba(255, 255, 255, 0.5))",fontSize:14,fontFamily:"monospace",pointerEvents:"none",zIndex:50},children:V(Q)}),l.jsxs("div",{className:"nice-pres-player-controls",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,opacity:.3},onMouseEnter:z=>{z.currentTarget.style.opacity="0.9",z.currentTarget.style.cursor="pointer"},onMouseLeave:z=>{z.currentTarget.style.opacity="0.3"},children:[l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),x()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-text-on-primary, #fff)",padding:"6px 14px",borderRadius:4,fontSize:16},title:"Previous","aria-label":"Previous",children:l.jsx(E.NiceIcon,{name:"chevron-left",size:16})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),M()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-text-on-primary, #fff)",padding:"6px 14px",borderRadius:4,fontSize:16},title:"Next","aria-label":"Next",children:l.jsx(E.NiceIcon,{name:"chevron-right",size:16})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),n==null||n()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-text-on-primary, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:"Exit (Esc)","aria-label":"Exit",children:l.jsx(E.NiceIcon,{name:"close",size:14})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),j(D=>!D)},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-text-on-primary, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:"Overview (G)","aria-label":"Overview",children:l.jsx(E.NiceIcon,{name:"grid",size:14})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),ue()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-text-on-primary, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:Z?"Exit fullscreen":"Fullscreen","aria-label":Z?"Exit fullscreen":"Fullscreen",children:l.jsx(E.NiceIcon,{name:Z?"collapse":"expand",size:14})})]})]})};Qe.displayName="NicePresentationPlayer";const cn="_interactiveElement_19xs5_13",ln="_interactiveButton_19xs5_27",dn="_disabled_19xs5_57",un="_variant_primary_19xs5_87",pn="_variant_secondary_19xs5_101",fn="_variant_outline_19xs5_111",mn="_variant_ghost_19xs5_123",hn="_size_small_19xs5_143",yn="_size_medium_19xs5_153",gn="_size_large_19xs5_163",xn="_buttonIcon_19xs5_173",bn="_buttonLabel_19xs5_181",vn="_interactivePoll_19xs5_193",Sn="_pollQuestion_19xs5_213",wn="_pollOptions_19xs5_227",kn="_pollOption_19xs5_227",In="_pollOptionDisabled_19xs5_265",Cn="_pollOptionSelected_19xs5_275",Mn="_pollOptionContent_19xs5_293",zn="_pollOptionIcon_19xs5_309",An="_pollOptionText_19xs5_317",$n="_pollCheckbox_19xs5_325",_n="_pollResultBar_19xs5_335",Tn="_pollResultFill_19xs5_357",En="_pollResultPercent_19xs5_369",Nn="_pollResultCount_19xs5_385",Rn="_pollSubmitBtn_19xs5_399",Pn="_pollTotalVotes_19xs5_435",qn="_pollVotedMessage_19xs5_447",Dn="_interactiveQuiz_19xs5_489",jn="_quizHeader_19xs5_509",On="_quizQuestion_19xs5_523",Fn="_quizTimer_19xs5_541",Ln="_quizTimerWarning_19xs5_559",Wn="_timerPulse_19xs5_1",Bn="_quizPoints_19xs5_591",Un="_quizAnswers_19xs5_609",Hn="_quizAnswer_19xs5_609",Vn="_quizAnswerDisabled_19xs5_647",Qn="_quizAnswerSelected_19xs5_657",Kn="_quizAnswerCorrect_19xs5_675",Yn="_quizAnswerIncorrect_19xs5_685",Xn="_quizAnswerMarker_19xs5_695",Gn="_quizAnswerText_19xs5_705",Jn="_quizCorrectMark_19xs5_717",Zn="_quizIncorrectMark_19xs5_729",ei="_quizSubmitBtn_19xs5_741",ti="_quizFeedback_19xs5_789",ni="_quizFeedbackMessage_19xs5_797",ii="_quizFeedbackCorrect_19xs5_811",oi="_quizFeedbackIncorrect_19xs5_821",ri="_quizExplanation_19xs5_831",ai="_interactiveCountdown_19xs5_855",si="_countdownWarning_19xs5_871",ci="_countdownPulse_19xs5_1",li="_countdownComplete_19xs5_899",di="_countdownDigital_19xs5_909",ui="_countdownSeparator_19xs5_927",pi="_countdownDigit_19xs5_909",fi="_countdownCircular_19xs5_947",mi="_countdownCircleSvg_19xs5_959",hi="_countdownProgressRing_19xs5_971",yi="_countdownCircleText_19xs5_979",gi="_countdownLargeSeconds_19xs5_999",xi="_countdownFlip_19xs5_1009",bi="_flipCardContainer_19xs5_1021",vi="_flipCard_19xs5_1021",Si="_flipLabel_19xs5_1065",wi="_flipSeparator_19xs5_1079",ki="_countdownMinimal_19xs5_1095",Ii="_countdownCompleteMessage_19xs5_1107",Ci="_interactiveQnA_19xs5_1125",Mi="_qnaHeader_19xs5_1149",zi="_qnaTitle_19xs5_1165",Ai="_qnaCount_19xs5_1179",$i="_qnaInputForm_19xs5_1189",_i="_qnaInputWrapper_19xs5_1201",Ti="_qnaInput_19xs5_1189",Ei="_qnaCharCount_19xs5_1251",Ni="_qnaInputActions_19xs5_1267",Ri="_qnaAnonymousToggle_19xs5_1281",Pi="_qnaSubmitBtn_19xs5_1311",qi="_qnaClosedMessage_19xs5_1353",Di="_qnaQuestionsList_19xs5_1371",ji="_qnaQuestion_19xs5_1371",Oi="_qnaQuestionAnswered_19xs5_1413",Fi="_qnaQuestionContent_19xs5_1423",Li="_qnaQuestionText_19xs5_1437",Wi="_qnaQuestionMeta_19xs5_1449",Bi="_qnaAuthor_19xs5_1463",Ui="_qnaQuestionActions_19xs5_1471",Hi="_qnaUpvoteBtn_19xs5_1485",Vi="_qnaUpvoted_19xs5_1521",Qi="_qnaUpvoteIcon_19xs5_1541",Ki="_qnaUpvoteCount_19xs5_1549",Yi="_qnaAnsweredBtn_19xs5_1559",Xi="_qnaMarkedAnswered_19xs5_1587",Gi="_qnaEmptyState_19xs5_1599",Ji="_qnaMoreQuestions_19xs5_1613",Zi="_qnaStyle_stack_19xs5_1631",eo="_qnaStyle_floating_19xs5_1641",w={interactiveElement:cn,interactiveButton:ln,disabled:dn,variant_primary:un,variant_secondary:pn,variant_outline:fn,variant_ghost:mn,size_small:hn,size_medium:yn,size_large:gn,buttonIcon:xn,buttonLabel:bn,interactivePoll:vn,pollQuestion:Sn,pollOptions:wn,pollOption:kn,pollOptionDisabled:In,pollOptionSelected:Cn,pollOptionContent:Mn,pollOptionIcon:zn,pollOptionText:An,pollCheckbox:$n,pollResultBar:_n,pollResultFill:Tn,pollResultPercent:En,pollResultCount:Nn,pollSubmitBtn:Rn,pollTotalVotes:Pn,pollVotedMessage:qn,"pollStyle_horizontal-bar":"_pollStyle_horizontal-bar_19xs5_467",interactiveQuiz:Dn,quizHeader:jn,quizQuestion:On,quizTimer:Fn,quizTimerWarning:Ln,timerPulse:Wn,quizPoints:Bn,quizAnswers:Un,quizAnswer:Hn,quizAnswerDisabled:Vn,quizAnswerSelected:Qn,quizAnswerCorrect:Kn,quizAnswerIncorrect:Yn,quizAnswerMarker:Xn,quizAnswerText:Gn,quizCorrectMark:Jn,quizIncorrectMark:Zn,quizSubmitBtn:ei,quizFeedback:ti,quizFeedbackMessage:ni,quizFeedbackCorrect:ii,quizFeedbackIncorrect:oi,quizExplanation:ri,interactiveCountdown:ai,countdownWarning:si,countdownPulse:ci,countdownComplete:li,countdownDigital:di,countdownSeparator:ui,countdownDigit:pi,countdownCircular:fi,countdownCircleSvg:mi,countdownProgressRing:hi,countdownCircleText:yi,countdownLargeSeconds:gi,countdownFlip:xi,flipCardContainer:bi,flipCard:vi,flipLabel:Si,flipSeparator:wi,countdownMinimal:ki,countdownCompleteMessage:Ii,interactiveQnA:Ci,qnaHeader:Mi,qnaTitle:zi,qnaCount:Ai,qnaInputForm:$i,qnaInputWrapper:_i,qnaInput:Ti,qnaCharCount:Ei,qnaInputActions:Ni,qnaAnonymousToggle:Ri,qnaSubmitBtn:Pi,qnaClosedMessage:qi,qnaQuestionsList:Di,qnaQuestion:ji,qnaQuestionAnswered:Oi,qnaQuestionContent:Fi,qnaQuestionText:Li,qnaQuestionMeta:Wi,qnaAuthor:Bi,qnaQuestionActions:Ui,qnaUpvoteBtn:Hi,qnaUpvoted:Vi,qnaUpvoteIcon:Qi,qnaUpvoteCount:Ki,qnaAnsweredBtn:Yi,qnaMarkedAnswered:Xi,qnaEmptyState:Gi,qnaMoreQuestions:Ji,qnaStyle_stack:Zi,qnaStyle_floating:eo},to=({content:e,onAction:t,disabled:n=!1,className:i,theme:o})=>{const{label:r,action:a,variant:s="primary",size:c="medium",icon:u,iconPosition:m="left",backgroundColor:p,textColor:h,borderRadius:f}=e,g=d.useCallback(()=>{if(!n){if(a.type==="openUrl"){const{url:b,newTab:S=!0}=a;S?window.open(b,"_blank","noopener,noreferrer"):window.location.href=b}t==null||t(a)}},[a,n,t]),y={backgroundColor:p??(s==="primary"?o==null?void 0:o.primaryColor:void 0),color:h,borderRadius:f!==void 0?`${f}px`:void 0,fontFamily:o==null?void 0:o.fontFamily},v=[w.interactiveButton,w[`variant_${s}`],w[`size_${c}`],n?w.disabled:"",i??""].filter(Boolean).join(" "),k=()=>u?l.jsx("span",{className:w.buttonIcon,children:l.jsx(E.NiceIcon,{name:no(u),size:16})}):null;return l.jsxs("button",{className:v,style:y,onClick:g,disabled:n,type:"button",children:[m==="left"&&k(),l.jsx("span",{className:w.buttonLabel,children:r}),m==="right"&&k()]})};function no(e){return{external:"external-link",share:"external-link",question:"help",heart:"heart",delete:"trash"}[e]??e}const io=({content:e,onVote:t,onResultsUpdate:n,votingClosed:i=!1,userVote:o,className:r,theme:a})=>{const s=se(),{question:c,options:u,multiSelect:m=!1,showResultsAfterVote:p=!0,liveResults:h=!1,displayStyle:f="buttons",resultColors:g,results:y={}}=e,[v,k]=d.useState(o??[]),[b,S]=d.useState(!!(o!=null&&o.length)),[_,R]=d.useState(y),j=d.useMemo(()=>Object.values(_).reduce((C,$)=>C+$,0),[_]),Q=[(a==null?void 0:a.primaryColor)??"var(--nice-info, #6366f1)","var(--nice-accent, #8b5cf6)","var(--nice-info, #06b6d4)","var(--nice-success, #10b981)","var(--nice-warning, #f59e0b)","var(--nice-danger, #ef4444)"],A=g??Q,P=d.useCallback(C=>{b||i||k($=>m?$.includes(C)?$.filter(I=>I!==C):[...$,C]:[C])},[b,i,m]),L=d.useCallback(()=>{if(v.length===0||b)return;const C={..._};v.forEach($=>{C[$]=(C[$]??0)+1}),R(C),S(!0),t==null||t(v),n==null||n(C)},[v,b,_,t,n]),H=h||p&&b,X=(C,$)=>{const I=v.includes(C.id),q=_[C.id]??0,F=j>0?q/j*100:0,W=C.color??A[$%A.length],J=[w.pollOption,w[`pollStyle_${f}`],I?w.pollOptionSelected:"",b||i?w.pollOptionDisabled:""].filter(Boolean).join(" ");return l.jsxs("button",{className:J,onClick:()=>P(C.id),disabled:b||i,type:"button",style:{"--poll-option-color":W,fontFamily:a==null?void 0:a.fontFamily},children:[l.jsxs("div",{className:w.pollOptionContent,children:[C.icon&&l.jsx("span",{className:w.pollOptionIcon,children:l.jsx(E.NiceIcon,{name:C.icon,size:16})}),l.jsx("span",{className:w.pollOptionText,children:C.text}),m&&!b&&l.jsx("span",{className:w.pollCheckbox,children:l.jsx(E.NiceIcon,{name:I?"check-square":"square",size:16})})]}),H&&l.jsxs("div",{className:w.pollResultBar,children:[l.jsx("div",{className:w.pollResultFill,style:{width:`${F}%`,backgroundColor:W}}),l.jsxs("span",{className:w.pollResultPercent,children:[F.toFixed(0),"%"]}),l.jsxs("span",{className:w.pollResultCount,children:["(",q,")"]})]})]},C.id)};return l.jsxs("div",{className:`${w.interactivePoll} ${r??""}`,children:[l.jsx("h3",{className:w.pollQuestion,style:{fontFamily:a==null?void 0:a.fontFamily},children:c}),l.jsx("div",{className:w.pollOptions,children:u.map((C,$)=>X(C,$))}),!b&&!i&&v.length>0&&l.jsx("button",{className:w.pollSubmitBtn,onClick:L,style:{backgroundColor:a==null?void 0:a.primaryColor,fontFamily:a==null?void 0:a.fontFamily},children:s("interactive.poll.vote","Submit vote")}),H&&j>0&&l.jsxs("div",{className:w.pollTotalVotes,children:[s("interactive.poll.totalVotes","Total votes:")," ",j]}),b&&l.jsxs("div",{className:w.pollVotedMessage,children:[l.jsx(E.NiceIcon,{name:"check",size:14})," ",s("interactive.poll.thanks","Thanks for your vote!")]})]})},oo=({content:e,onSubmit:t,locked:n=!1,className:i,theme:o})=>{const r=se(),{question:a,answers:s,quizType:c="single",showCorrectAfterSubmit:u=!0,timeLimitSeconds:m=0,points:p=10,correctFeedback:h,incorrectFeedback:f,explanation:g}=e,y=h??r("interactive.quiz.correctFeedback","Correct answer!"),v=f??r("interactive.quiz.incorrectFeedback","Sorry, that is not the correct answer."),k=r("interactive.quiz.points","pts"),[b,S]=d.useState([]),[_,R]=d.useState(!1),[j,Q]=d.useState(!1),[A,P]=d.useState(m),L=d.useRef(null);d.useEffect(()=>{if(m>0&&!_&&!n)return P(m),L.current=setInterval(()=>{P(I=>I<=1?(clearInterval(L.current),0):I-1)},1e3),()=>{L.current&&clearInterval(L.current)}},[m,_,n]),d.useEffect(()=>{A===0&&m>0&&!_&&X()},[A,m,_]);const H=d.useCallback(I=>{_||n||S(q=>c==="single"||c==="true-false"?[I]:q.includes(I)?q.filter(F=>F!==I):[...q,I])},[_,n,c]),X=d.useCallback(()=>{if(_||b.length===0)return;L.current&&clearInterval(L.current);const I=s.filter(N=>N.isCorrect).map(N=>N.id),q=new Set(b),F=new Set(I),W=q.size===F.size&&[...q].every(N=>F.has(N));Q(W),R(!0);const J=W?p:0;t==null||t(b,W,J)},[_,b,s,p,t]),C=I=>{const q=Math.floor(I/60),F=I%60;return q>0?`${q}:${F.toString().padStart(2,"0")}`:`${F}s`},$=I=>{const q=b.includes(I.id),F=_&&u,W=[w.quizAnswer,q?w.quizAnswerSelected:"",_?w.quizAnswerDisabled:"",F&&I.isCorrect?w.quizAnswerCorrect:"",F&&q&&!I.isCorrect?w.quizAnswerIncorrect:""].filter(Boolean).join(" ");return l.jsxs("button",{className:W,onClick:()=>H(I.id),disabled:_||n,type:"button",style:{fontFamily:o==null?void 0:o.fontFamily},children:[l.jsxs("span",{className:w.quizAnswerMarker,children:[c==="multiple"&&l.jsx(E.NiceIcon,{name:q?"check-square":"square",size:16}),(c==="single"||c==="true-false")&&l.jsx(E.NiceIcon,{name:q?"check":"circle",size:16})]}),l.jsx("span",{className:w.quizAnswerText,children:I.text}),F&&I.isCorrect&&l.jsx("span",{className:w.quizCorrectMark,children:l.jsx(E.NiceIcon,{name:"check",size:14})}),F&&q&&!I.isCorrect&&l.jsx("span",{className:w.quizIncorrectMark,children:l.jsx(E.NiceIcon,{name:"close",size:14})})]},I.id)};return l.jsxs("div",{className:`${w.interactiveQuiz} ${i??""}`,children:[l.jsxs("div",{className:w.quizHeader,children:[l.jsx("h3",{className:w.quizQuestion,style:{fontFamily:o==null?void 0:o.fontFamily},children:a}),m>0&&!_&&l.jsxs("div",{className:`${w.quizTimer} ${A<=10?w.quizTimerWarning:""}`,children:[l.jsx(E.NiceIcon,{name:"clock",size:14})," ",C(A)]}),p>0&&l.jsx("div",{className:w.quizPoints,children:_?j?`+${p} ${k}`:`0 ${k}`:`${p} ${k}`})]}),l.jsx("div",{className:w.quizAnswers,children:s.map($)}),!_&&!n&&b.length>0&&l.jsx("button",{className:w.quizSubmitBtn,onClick:X,style:{backgroundColor:o==null?void 0:o.primaryColor,fontFamily:o==null?void 0:o.fontFamily},children:r("interactive.quiz.submit","Submit answer")}),_&&u&&l.jsxs("div",{className:w.quizFeedback,children:[l.jsx("div",{className:`${w.quizFeedbackMessage} ${j?w.quizFeedbackCorrect:w.quizFeedbackIncorrect}`,children:j?y:v}),g&&l.jsxs("div",{className:w.quizExplanation,children:[l.jsx("strong",{children:r("interactive.quiz.explanation","Explanation:")})," ",g]})]})]})},ro=({content:e,onComplete:t,paused:n=!1,className:i,theme:o})=>{const{target:r,format:a="mm:ss",style:s="digital",showLabels:c=!0,onComplete:u,textColor:m,backgroundColor:p,warningThreshold:h=10,warningColor:f="var(--nice-danger, #ef4444)"}=e,[g,y]=d.useState(()=>{if(typeof r=="number")return r;const I=new Date(r),q=new Date;return Math.max(0,Math.floor((I.getTime()-q.getTime())/1e3))}),[v,k]=d.useState(!1),S=se()("countdown.timeUp"),_=S==="countdown.timeUp"?"Time's up!":S,R=d.useRef(null);d.useEffect(()=>{if(n||v){R.current&&(clearInterval(R.current),R.current=null);return}return R.current=setInterval(()=>{y(I=>I<=1?(clearInterval(R.current),k(!0),0):I-1)},1e3),()=>{R.current&&clearInterval(R.current)}},[n,v]),d.useEffect(()=>{v&&(t==null||t(u))},[v,t,u]);const j=d.useMemo(()=>{const I=Math.floor(g/3600),q=Math.floor(g%3600/60),F=g%60;return{hours:I,minutes:q,seconds:F}},[g]),Q=g<=h&&g>0,A=(I,q=2)=>I.toString().padStart(q,"0"),P=()=>{const{hours:I,minutes:q,seconds:F}=j;let W=[];return a==="hh:mm:ss"||I>0?W=[A(I),A(q),A(F)]:a==="mm:ss"?W=[A(q),A(F)]:W=[F.toString()],l.jsx("div",{className:w.countdownDigital,children:W.map((J,N)=>l.jsxs(d.Fragment,{children:[N>0&&l.jsx("span",{className:w.countdownSeparator,children:":"}),l.jsx("span",{className:w.countdownDigit,children:J})]},N))})},L=()=>{const{hours:I,minutes:q,seconds:F}=j,W=typeof r=="number"?r:g,J=W>0?g/W:0,N=2*Math.PI*45;return l.jsxs("div",{className:w.countdownCircular,children:[l.jsxs("svg",{viewBox:"0 0 100 100",className:w.countdownCircleSvg,children:[l.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"currentColor",strokeWidth:"8",opacity:"0.2"}),l.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:Q?f:m??(o==null?void 0:o.primaryColor)??"var(--nice-info, #6366f1)",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:N,strokeDashoffset:N*(1-J),transform:"rotate(-90 50 50)",className:w.countdownProgressRing})]}),l.jsx("div",{className:w.countdownCircleText,children:a!=="ss"?l.jsxs(l.Fragment,{children:[I>0&&l.jsxs("span",{children:[A(I),":"]}),l.jsxs("span",{children:[A(q),":"]}),l.jsx("span",{children:A(F)})]}):l.jsx("span",{className:w.countdownLargeSeconds,children:F})})]})},H=()=>{const{hours:I,minutes:q,seconds:F}=j,W=(J,N)=>l.jsxs("div",{className:w.flipCardContainer,children:[l.jsx("div",{className:w.flipCard,children:l.jsx("span",{children:J})}),c&&l.jsx("span",{className:w.flipLabel,children:N})]});return l.jsxs("div",{className:w.countdownFlip,children:[(a==="hh:mm:ss"||I>0)&&l.jsxs(l.Fragment,{children:[W(A(I),"godz."),l.jsx("span",{className:w.flipSeparator,children:":"})]}),a!=="ss"&&l.jsxs(l.Fragment,{children:[W(A(q),"min."),l.jsx("span",{className:w.flipSeparator,children:":"})]}),W(A(F),"sek.")]})},X=()=>{const{hours:I,minutes:q,seconds:F}=j;if(a==="ss")return l.jsxs("span",{className:w.countdownMinimal,children:[F,"s"]});let W="";return I>0&&(W+=`${I}h `),(q>0||I>0)&&(W+=`${q}m `),W+=`${F}s`,l.jsx("span",{className:w.countdownMinimal,children:W.trim()})},C={color:Q?f:m,backgroundColor:p,fontFamily:o==null?void 0:o.fontFamily},$=[w.interactiveCountdown,w[`countdownStyle_${s}`],Q?w.countdownWarning:"",v?w.countdownComplete:"",i??""].filter(Boolean).join(" ");return l.jsxs("div",{className:$,style:C,children:[s==="digital"&&P(),s==="circular"&&L(),s==="flip"&&H(),s==="minimal"&&X(),v&&l.jsxs("div",{className:w.countdownCompleteMessage,children:[l.jsx(E.NiceIcon,{name:"clock",size:18})," ",_]})]})},ao=({content:e,userName:t,onSubmitQuestion:n,onUpvote:i,onMarkAnswered:o,submissionClosed:r=!1,isModerator:a=!1,upvotedQuestions:s=[],className:c,theme:u})=>{const m=se(),p=Fe(),{placeholder:h,allowAnonymous:f=!0,moderated:g=!1,allowUpvote:y=!0,maxVisible:v=10,displayStyle:k="list",charLimit:b=500,questions:S=[]}=e,_=h??m("interactive.qna.placeholder","Ask a question..."),[R,j]=d.useState(S),[Q,A]=d.useState(""),[P,L]=d.useState(!1),[H,X]=d.useState(new Set(s)),C=d.useMemo(()=>[...R].filter(N=>!g||N.answered||a).sort((N,M)=>M.upvotes!==N.upvotes?M.upvotes-N.upvotes:new Date(M.timestamp).getTime()-new Date(N.timestamp).getTime()).slice(0,v),[R,g,a,v]),$=d.useCallback(N=>{N.preventDefault();const M=Q.trim();if(!M||r)return;const x={id:`q_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,text:M,author:P||!t?void 0:t,timestamp:new Date().toISOString(),upvotes:0,answered:!1};j(T=>[x,...T]),A(""),n==null||n({text:x.text,author:x.author,answered:!1})},[Q,r,P,t,n]),I=d.useCallback(N=>{!y||H.has(N)||(j(M=>M.map(x=>x.id===N?{...x,upvotes:x.upvotes+1}:x)),X(M=>new Set(M).add(N)),i==null||i(N))},[y,H,i]),q=d.useCallback(N=>{a&&(j(M=>M.map(x=>x.id===N?{...x,answered:!x.answered}:x)),o==null||o(N))},[a,o]),F=()=>l.jsxs("form",{className:w.qnaInputForm,onSubmit:$,children:[l.jsxs("div",{className:w.qnaInputWrapper,children:[l.jsx("textarea",{className:w.qnaInput,placeholder:_,value:Q,onChange:N=>A(N.target.value.slice(0,b)),disabled:r,rows:2,style:{fontFamily:u==null?void 0:u.fontFamily}}),l.jsxs("span",{className:w.qnaCharCount,children:[Q.length,"/",b]})]}),l.jsxs("div",{className:w.qnaInputActions,children:[f&&l.jsxs("label",{className:w.qnaAnonymousToggle,children:[l.jsx("input",{type:"checkbox",checked:P,onChange:N=>L(N.target.checked)}),l.jsx("span",{children:m("interactive.qna.anonymously","Anonymously")})]}),l.jsx("button",{type:"submit",className:w.qnaSubmitBtn,disabled:!Q.trim()||r,style:{backgroundColor:u==null?void 0:u.primaryColor,fontFamily:u==null?void 0:u.fontFamily},children:m("interactive.qna.submit","Submit question")})]})]}),W=N=>{const M=H.has(N.id);return l.jsxs("div",{className:`${w.qnaQuestion} ${N.answered?w.qnaQuestionAnswered:""}`,children:[l.jsxs("div",{className:w.qnaQuestionContent,children:[l.jsx("span",{className:w.qnaQuestionText,style:{fontFamily:u==null?void 0:u.fontFamily},children:N.text}),l.jsxs("div",{className:w.qnaQuestionMeta,children:[l.jsx("span",{className:w.qnaAuthor,children:N.author?`@${N.author}`:l.jsxs(l.Fragment,{children:[l.jsx(E.NiceIcon,{name:"user",size:14})," ",m("interactive.qna.anonymous","Anonymous")]})}),l.jsx("span",{className:w.qnaTimestamp,children:so(m,p,N.timestamp)})]})]}),l.jsxs("div",{className:w.qnaQuestionActions,children:[y&&l.jsxs("button",{className:`${w.qnaUpvoteBtn} ${M?w.qnaUpvoted:""}`,onClick:()=>I(N.id),disabled:M,title:M?m("interactive.qna.alreadyUpvoted","You already upvoted this"):m("interactive.qna.upvote","Upvote"),children:[l.jsx("span",{className:w.qnaUpvoteIcon,children:l.jsx(E.NiceIcon,{name:"arrow-up",size:14})}),l.jsx("span",{className:w.qnaUpvoteCount,children:N.upvotes})]}),a&&l.jsx("button",{className:`${w.qnaAnsweredBtn} ${N.answered?w.qnaMarkedAnswered:""}`,onClick:()=>q(N.id),title:N.answered?m("interactive.qna.markUnanswered","Mark as unanswered"):m("interactive.qna.markAnswered","Mark as answered"),"aria-label":N.answered?m("interactive.qna.markUnanswered","Mark as unanswered"):m("interactive.qna.markAnswered","Mark as answered"),children:l.jsx(E.NiceIcon,{name:N.answered?"check":"circle",size:16})})]})]},N.id)},J=[w.interactiveQnA,w[`qnaStyle_${k}`],c??""].filter(Boolean).join(" ");return l.jsxs("div",{className:J,children:[l.jsxs("div",{className:w.qnaHeader,children:[l.jsx("h3",{className:w.qnaTitle,style:{fontFamily:u==null?void 0:u.fontFamily},children:m("interactive.qna.title","Questions & answers")}),l.jsxs("span",{className:w.qnaCount,children:[R.length," ",R.length===1?m("interactive.qna.questionOne","question"):m("interactive.qna.questionMany","questions")]})]}),!r&&F(),r&&l.jsx("div",{className:w.qnaClosedMessage,children:m("interactive.qna.closed","Question submission is closed")}),l.jsx("div",{className:w.qnaQuestionsList,children:C.length===0?l.jsx("div",{className:w.qnaEmptyState,children:m("interactive.qna.empty","No questions yet. Be the first!")}):C.map(W)}),R.length>v&&l.jsxs("div",{className:w.qnaMoreQuestions,children:["+",R.length-v," ",m("interactive.qna.moreQuestions","more questions")]})]})};function so(e,t,n){const i=new Date(n),r=new Date().getTime()-i.getTime(),a=Math.floor(r/6e4);if(a<1)return e("interactive.qna.justNow","Just now");if(a<60)return e("interactive.qna.minutesAgo","{n} min ago").replace("{n}",String(a));const s=Math.floor(a/60);return s<24?e("interactive.qna.hoursAgo","{n}h ago").replace("{n}",String(s)):i.toLocaleDateString(t,{day:"numeric",month:"short"})}const Ke={id:"fade",name:"Fade",description:"Smooth fade between slides",outgoingStyles:{from:{opacity:1},to:{opacity:0}},incomingStyles:{from:{opacity:0},to:{opacity:1}},defaultDuration:500,defaultEasing:"ease-in-out",category:"basic"},Ye={id:"slide-left",name:"Slide Left",description:"Slide to the left",outgoingStyles:{from:{transform:"translateX(0%)"},to:{transform:"translateX(-100%)"}},incomingStyles:{from:{transform:"translateX(100%)"},to:{transform:"translateX(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Xe={id:"slide-right",name:"Slide Right",description:"Slide to the right",outgoingStyles:{from:{transform:"translateX(0%)"},to:{transform:"translateX(100%)"}},incomingStyles:{from:{transform:"translateX(-100%)"},to:{transform:"translateX(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Ge={id:"slide-up",name:"Slide Up",description:"Slide upward",outgoingStyles:{from:{transform:"translateY(0%)"},to:{transform:"translateY(-100%)"}},incomingStyles:{from:{transform:"translateY(100%)"},to:{transform:"translateY(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Je={id:"slide-down",name:"Slide Down",description:"Slide downward",outgoingStyles:{from:{transform:"translateY(0%)"},to:{transform:"translateY(100%)"}},incomingStyles:{from:{transform:"translateY(-100%)"},to:{transform:"translateY(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Ze={id:"zoom-in",name:"Zoom In",description:"Zoom in from center",outgoingStyles:{from:{transform:"scale(1)",opacity:1},to:{transform:"scale(1.2)",opacity:0}},incomingStyles:{from:{transform:"scale(0.8)",opacity:0},to:{transform:"scale(1)",opacity:1}},defaultDuration:500,defaultEasing:"ease-out",category:"zoom"},et={id:"zoom-out",name:"Zoom Out",description:"Zoom out to center",outgoingStyles:{from:{transform:"scale(1)",opacity:1},to:{transform:"scale(0.8)",opacity:0}},incomingStyles:{from:{transform:"scale(1.2)",opacity:0},to:{transform:"scale(1)",opacity:1}},defaultDuration:500,defaultEasing:"ease-out",category:"zoom"},tt={id:"flip-horizontal",name:"Flip Horizontal",description:"3D flip around vertical axis",outgoingStyles:{from:{transform:"perspective(1000px) rotateY(0deg)",opacity:1},to:{transform:"perspective(1000px) rotateY(-90deg)",opacity:0}},incomingStyles:{from:{transform:"perspective(1000px) rotateY(90deg)",opacity:0},to:{transform:"perspective(1000px) rotateY(0deg)",opacity:1}},defaultDuration:700,defaultEasing:"ease-in-out",category:"3d"},nt={id:"flip-vertical",name:"Flip Vertical",description:"3D flip around horizontal axis",outgoingStyles:{from:{transform:"perspective(1000px) rotateX(0deg)",opacity:1},to:{transform:"perspective(1000px) rotateX(90deg)",opacity:0}},incomingStyles:{from:{transform:"perspective(1000px) rotateX(-90deg)",opacity:0},to:{transform:"perspective(1000px) rotateX(0deg)",opacity:1}},defaultDuration:700,defaultEasing:"ease-in-out",category:"3d"},it={id:"cube-left",name:"Cube Left",description:"3D cube rotation to the left",outgoingStyles:{from:{transform:"perspective(1000px) translateZ(0) rotateY(0deg)"},to:{transform:"perspective(1000px) translateZ(-50%) rotateY(90deg)"}},incomingStyles:{from:{transform:"perspective(1000px) translateZ(-50%) rotateY(-90deg)"},to:{transform:"perspective(1000px) translateZ(0) rotateY(0deg)"}},defaultDuration:800,defaultEasing:"ease-in-out",category:"3d"},ot={id:"rotate-in",name:"Rotate In",description:"Rotate and fade in",outgoingStyles:{from:{transform:"rotate(0deg) scale(1)",opacity:1},to:{transform:"rotate(-15deg) scale(0.8)",opacity:0}},incomingStyles:{from:{transform:"rotate(15deg) scale(0.8)",opacity:0},to:{transform:"rotate(0deg) scale(1)",opacity:1}},defaultDuration:600,defaultEasing:"ease-out",category:"rotate"},rt={id:"blur-fade",name:"Blur Fade",description:"Fade with blur effect",outgoingStyles:{from:{filter:"blur(0px)",opacity:1},to:{filter:"blur(10px)",opacity:0}},incomingStyles:{from:{filter:"blur(10px)",opacity:0},to:{filter:"blur(0px)",opacity:1}},defaultDuration:600,defaultEasing:"ease-in-out",category:"blur"},at={id:"wipe-left",name:"Wipe Left",description:"Wipe from right to left",outgoingStyles:{from:{clipPath:"inset(0 0 0 0)"},to:{clipPath:"inset(0 100% 0 0)"}},incomingStyles:{from:{clipPath:"inset(0 0 0 100%)"},to:{clipPath:"inset(0 0 0 0)"}},defaultDuration:600,defaultEasing:"ease-in-out",category:"creative"},st={id:"wipe-right",name:"Wipe Right",description:"Wipe from left to right",outgoingStyles:{from:{clipPath:"inset(0 0 0 0)"},to:{clipPath:"inset(0 0 0 100%)"}},incomingStyles:{from:{clipPath:"inset(0 100% 0 0)"},to:{clipPath:"inset(0 0 0 0)"}},defaultDuration:600,defaultEasing:"ease-in-out",category:"creative"},ct={id:"circle-reveal",name:"Circle Reveal",description:"Reveal with expanding circle",outgoingStyles:{from:{clipPath:"circle(100% at 50% 50%)"},to:{clipPath:"circle(0% at 50% 50%)"}},incomingStyles:{from:{clipPath:"circle(0% at 50% 50%)"},to:{clipPath:"circle(100% at 50% 50%)"}},defaultDuration:700,defaultEasing:"ease-out",category:"creative"},lt={id:"glitch",name:"Glitch",description:"Digital glitch effect",outgoingStyles:{from:{transform:"translateX(0)",filter:"hue-rotate(0deg)"},keyframes:[{offset:.2,style:{transform:"translateX(-5px)",filter:"hue-rotate(90deg)"}},{offset:.4,style:{transform:"translateX(5px)",filter:"hue-rotate(180deg)"}},{offset:.6,style:{transform:"translateX(-3px)",filter:"hue-rotate(270deg)"}},{offset:.8,style:{transform:"translateX(3px)",filter:"hue-rotate(360deg)"}}],to:{transform:"translateX(0)",filter:"hue-rotate(0deg)",opacity:0}},incomingStyles:{from:{transform:"translateX(0)",filter:"hue-rotate(0deg)",opacity:0},keyframes:[{offset:.2,style:{transform:"translateX(5px)",filter:"hue-rotate(270deg)",opacity:.5}},{offset:.4,style:{transform:"translateX(-5px)",filter:"hue-rotate(180deg)",opacity:.7}},{offset:.6,style:{transform:"translateX(3px)",filter:"hue-rotate(90deg)",opacity:.9}},{offset:.8,style:{transform:"translateX(-3px)",filter:"hue-rotate(0deg)",opacity:1}}],to:{transform:"translateX(0)",filter:"hue-rotate(0deg)",opacity:1}},defaultDuration:500,defaultEasing:"linear",category:"creative"},dt={id:"morph",name:"Morph",description:"Smooth morphing effect",outgoingStyles:{from:{transform:"scale(1)",borderRadius:"0%",opacity:1},to:{transform:"scale(0.5)",borderRadius:"50%",opacity:0}},incomingStyles:{from:{transform:"scale(0.5)",borderRadius:"50%",opacity:0},to:{transform:"scale(1)",borderRadius:"0%",opacity:1}},defaultDuration:700,defaultEasing:"ease-in-out",category:"creative"},ut=[Ke,Ye,Xe,Ge,Je,Ze,et,tt,nt,it,ot,rt,at,st,ct,lt,dt];class co{constructor(){this.transitions=new Map,ut.forEach(t=>this.transitions.set(t.id,t))}get(t){return this.transitions.get(t)}register(t){this.transitions.has(t.id)&&console.warn(`Transition "${t.id}" already exists and will be overwritten.`),this.transitions.set(t.id,t)}unregister(t){this.transitions.delete(t)}getAll(){return Array.from(this.transitions.values())}getByCategory(t){return this.getAll().filter(n=>n.category===t)}}const pt=new co;function Ne(e,t,n,i){if(i&&i.length>0){const o=[{offset:0,style:e},...i,{offset:1,style:t}].sort((u,m)=>u.offset-m.offset);let r=o[0],a=o[o.length-1];for(let u=0;u<o.length-1;u++)if(n>=o[u].offset&&n<=o[u+1].offset){r=o[u],a=o[u+1];break}const s=a.offset-r.offset,c=s>0?(n-r.offset)/s:1;return Re(r.style,a.style,c)}return Re(e,t,n)}function Re(e,t,n){const i={};return new Set([...Object.keys(e),...Object.keys(t)]).forEach(r=>{const a=e[r],s=t[r];a===void 0?i[r]=s:s===void 0?i[r]=a:typeof a=="number"&&typeof s=="number"?i[r]=a+(s-a)*n:i[r]=n<.5?a:s}),i}function lo(e,t){const n=pt.get(e);if(!n)return{progress:t,outgoingStyle:{opacity:1-t},incomingStyle:{opacity:t},isComplete:t>=1};const{outgoingStyles:i,incomingStyles:o}=n;return{progress:t,outgoingStyle:Ne(i.from,i.to,t,i.keyframes),incomingStyle:Ne(o.from,o.to,t,o.keyframes),isComplete:t>=1}}function uo(e,t){return{none:"fade",fade:"fade",slide:t==="right"?"slide-right":t==="up"?"slide-up":t==="down"?"slide-down":"slide-left",zoom:"zoom-in",flip:"flip-horizontal",cube:"cube-left",wipe:t==="right"?"wipe-right":"wipe-left",dissolve:"blur-fade",push:t==="right"?"slide-right":"slide-left",cover:"slide-left"}[e]??"fade"}function po(e,t){switch(t){case"linear":return e;case"ease-in":return e*e;case"ease-out":return 1-Math.pow(1-e,2);case"ease-in-out":return e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2;case"ease":default:return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}}function fo(e,t,n,i,o){return{id:e,name:t,outgoingStyles:n,incomingStyles:i,defaultDuration:(o==null?void 0:o.defaultDuration)??500,defaultEasing:(o==null?void 0:o.defaultEasing)??"ease-in-out",description:o==null?void 0:o.description,supportsDirection:o==null?void 0:o.supportsDirection,previewUrl:o==null?void 0:o.previewUrl,category:(o==null?void 0:o.category)??"custom"}}function mo(e,t){const n=t==="outgoing"?e.outgoingStyles:e.incomingStyles,i=[];return i.push({...n.from,offset:0}),n.keyframes&&n.keyframes.forEach(o=>{i.push({...o.style,offset:o.offset})}),i.push({...n.to,offset:1}),i}function fe(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function ge(e){return`${e>=0?"+":""}${e.toFixed(1)}%`}function xe(e){return e>=0?"#10b981":"#ef4444"}function ho(e){return{id:"slide-title",title:"Title",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1E3A8A",position:0},{color:"#3b82f6",position:100}],gradientDirection:135},elements:[{id:"title-main",type:"text",position:{x:10,y:35,width:80,height:15,unit:"percent"},content:{type:"text",text:`${e.quarter} ${e.year} Quarterly Report`,style:{fontFamily:"Inter, sans-serif",fontSize:56,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:800,delayMs:200}},{id:"title-company",type:"text",position:{x:10,y:52,width:80,height:8,unit:"percent"},content:{type:"text",text:e.companyName,style:{fontFamily:"Inter, sans-serif",fontSize:32,fontWeight:400,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:600}},{id:"title-date",type:"text",position:{x:10,y:85,width:80,height:5,unit:"percent"},content:{type:"text",text:e.reportDate||new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),style:{fontFamily:"Inter, sans-serif",fontSize:18,color:"#bfdbfe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}],notes:"Welcome stakeholders. This presentation covers our Q"+e.quarter[1]+" results.",durationMs:3e4}}function yo(e){const t=[{id:"kpi-revenue",type:"shape",position:{x:5,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:200}},{id:"kpi-revenue-icon",type:"text",position:{x:7,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"💰",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-revenue-label",type:"text",position:{x:7,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Revenue",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-revenue-value",type:"text",position:{x:7,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:fe(e.kpis.revenue.value),style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-revenue-change",type:"text",position:{x:7,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.revenue.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.revenue.change),textAlign:"center"}}},{id:"kpi-profit",type:"shape",position:{x:28,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:350}},{id:"kpi-profit-icon",type:"text",position:{x:30,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"📈",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-profit-label",type:"text",position:{x:30,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Profit",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-profit-value",type:"text",position:{x:30,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:fe(e.kpis.profit.value),style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-profit-change",type:"text",position:{x:30,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.profit.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.profit.change),textAlign:"center"}}},{id:"kpi-customers",type:"shape",position:{x:51,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:500}},{id:"kpi-customers-icon",type:"text",position:{x:53,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"👥",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-customers-label",type:"text",position:{x:53,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Customers",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-customers-value",type:"text",position:{x:53,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:e.kpis.customers.value.toLocaleString(),style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-customers-change",type:"text",position:{x:53,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.customers.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.customers.change),textAlign:"center"}}},{id:"kpi-satisfaction",type:"shape",position:{x:74,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:650}},{id:"kpi-satisfaction-icon",type:"text",position:{x:76,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"⭐",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-satisfaction-label",type:"text",position:{x:76,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Satisfaction",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-satisfaction-value",type:"text",position:{x:76,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:`${e.kpis.satisfaction.value}%`,style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-satisfaction-change",type:"text",position:{x:76,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.satisfaction.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.satisfaction.change),textAlign:"center"}}}];return{id:"slide-kpis",title:"Key Performance Indicators",layout:"titleContent",background:{type:"solid",color:"#f3f4f6"},elements:[{id:"kpis-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Key Performance Indicators",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...t],notes:"Review each KPI and highlight the most significant changes from last quarter.",durationMs:45e3}}function go(e){var n;const t={type:"chart",chartType:"bar",title:"Monthly Revenue",data:{labels:e.financials.revenueByMonth.map(i=>i.month),datasets:[{label:`${e.year}`,data:e.financials.revenueByMonth.map(i=>i.value),backgroundColor:"#3b82f6"},...((n=e.financials.revenueByMonth[0])==null?void 0:n.lastYear)!==void 0?[{label:`${e.year-1}`,data:e.financials.revenueByMonth.map(i=>i.lastYear||0),backgroundColor:"#93c5fd"}]:[]]},options:{showLegend:!0,showGridLines:!0,animation:!0}};return{id:"slide-revenue",title:"Revenue Analysis",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"revenue-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Revenue Analysis",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"revenue-chart",type:"chart",position:{x:5,y:18,width:90,height:75,unit:"percent"},content:t,animation:{effect:"fadeIn",durationMs:800,delayMs:400}}],notes:"Highlight the revenue trend and compare with last year if applicable.",durationMs:6e4}}function xo(e){const t={type:"chart",chartType:"pie",title:"Cost Breakdown",data:{labels:e.financials.costBreakdown.map(n=>n.category),datasets:[{label:"Cost Distribution",data:e.financials.costBreakdown.map(n=>n.value),backgroundColor:["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#6366f1"]}]},options:{showLegend:!0,showDataLabels:!0,animation:!0}};return{id:"slide-costs",title:"Cost Analysis",layout:"twoColumn",background:{type:"solid",color:"#fff"},elements:[{id:"costs-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Cost Analysis",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"costs-chart",type:"chart",position:{x:5,y:18,width:45,height:70,unit:"percent"},content:t,animation:{effect:"zoomIn",durationMs:600,delayMs:400}},{id:"costs-table",type:"table",position:{x:52,y:18,width:43,height:70,unit:"percent"},content:{type:"table",headers:["Category","Amount","%"],rows:e.financials.costBreakdown.map(n=>[n.category,fe(n.value),`${n.percentage}%`]),style:{headerBackground:"#f3f4f6",headerColor:"#374151",cellPadding:12,fontSize:14,borderColor:"#e5e7eb"}},animation:{effect:"slideInRight",durationMs:600,delayMs:600}}],notes:"Discuss major cost categories and opportunities for optimization.",durationMs:6e4}}function bo(e){const t=e.pipeline.opportunities.map((i,o)=>({id:`pipeline-stage-${o}`,type:"shape",position:{x:5+o*2,y:25+o*12,width:90-o*4,height:10,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:`hsl(${220-o*15}, 70%, ${50+o*8}%)`,cornerRadius:6},animation:{effect:"slideInLeft",durationMs:400,delayMs:200+o*150}})),n=e.pipeline.opportunities.map((i,o)=>({id:`pipeline-label-${o}`,type:"text",position:{x:8+o*2,y:26.5+o*12,width:84-o*4,height:7,unit:"percent"},content:{type:"text",text:`${i.stage}: ${i.count} opportunities (${fe(i.value)})`,style:{fontSize:16,fontWeight:600,color:o<2?"#fff":"#1f2937",textAlign:"center"}}}));return{id:"slide-pipeline",title:"Sales Pipeline",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"pipeline-title",type:"text",position:{x:5,y:5,width:60,height:10,unit:"percent"},content:{type:"text",text:"Sales Pipeline",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"pipeline-total",type:"text",position:{x:65,y:5,width:30,height:10,unit:"percent"},content:{type:"text",text:`Total: ${fe(e.pipeline.totalValue)}`,style:{fontSize:28,fontWeight:700,color:"#3b82f6",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},...t,...n],notes:"Walk through the pipeline stages and highlight key deals approaching close.",durationMs:6e4}}function vo(e){const t={high:"#ef4444",medium:"#f59e0b",low:"#10b981"},n=e.risks.slice(0,5).flatMap((i,o)=>[{id:`risk-card-${o}`,type:"shape",position:{x:5,y:20+o*15,width:90,height:13,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:t[i.impact],strokeWidth:2,cornerRadius:8},animation:{effect:"slideInLeft",durationMs:400,delayMs:200+o*100}},{id:`risk-name-${o}`,type:"text",position:{x:7,y:21.5+o*15,width:50,height:5,unit:"percent"},content:{type:"text",text:i.name,style:{fontSize:16,fontWeight:600,color:"#1f2937"}}},{id:`risk-impact-${o}`,type:"text",position:{x:58,y:21.5+o*15,width:15,height:5,unit:"percent"},content:{type:"text",text:`Impact: ${i.impact.toUpperCase()}`,style:{fontSize:12,fontWeight:500,color:t[i.impact]}}},{id:`risk-prob-${o}`,type:"text",position:{x:75,y:21.5+o*15,width:18,height:5,unit:"percent"},content:{type:"text",text:`Prob: ${i.probability.toUpperCase()}`,style:{fontSize:12,fontWeight:500,color:"#6b7280"}}},{id:`risk-mitigation-${o}`,type:"text",position:{x:7,y:27+o*15,width:86,height:4,unit:"percent"},content:{type:"text",text:`Mitigation: ${i.mitigation}`,style:{fontSize:12,color:"#6b7280"}}}]);return{id:"slide-risks",title:"Risks & Mitigation",layout:"titleContent",background:{type:"solid",color:"#f9fafb"},elements:[{id:"risks-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Risks & Mitigation",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...n],notes:"Discuss each risk, its current status, and mitigation actions in progress.",durationMs:9e4}}function So(e){const t={"on-track":"#10b981","at-risk":"#f59e0b",completed:"#3b82f6","not-started":"#9ca3af"},n={"on-track":"✅","at-risk":"⚠️",completed:"🎉","not-started":"⏳"},i=e.plan.slice(0,6).flatMap((o,r)=>[{id:`plan-item-${r}`,type:"shape",position:{x:5,y:18+r*13,width:90,height:11,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:t[o.status],strokeWidth:2,cornerRadius:8},animation:{effect:"slideInRight",durationMs:400,delayMs:200+r*100}},{id:`plan-icon-${r}`,type:"text",position:{x:7,y:20+r*13,width:5,height:7,unit:"percent"},content:{type:"text",text:n[o.status],style:{fontSize:24}}},{id:`plan-goal-${r}`,type:"text",position:{x:13,y:20+r*13,width:60,height:7,unit:"percent"},content:{type:"text",text:o.goal,style:{fontSize:16,fontWeight:500,color:"#1f2937"}}},{id:`plan-status-${r}`,type:"text",position:{x:75,y:20+r*13,width:18,height:7,unit:"percent"},content:{type:"text",text:o.status.replace("-"," ").toUpperCase(),style:{fontSize:12,fontWeight:600,color:t[o.status],textAlign:"right"}}}]);return{id:"slide-plan",title:"Strategic Plan",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"plan-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Strategic Plan Status",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...i],notes:"Review progress on strategic initiatives and discuss any blockers.",durationMs:6e4}}function wo(e){const t=e.team||{headcount:0,newHires:0,departures:0,highlights:[]};return{id:"slide-team",title:"Team Updates",layout:"twoColumn",background:{type:"gradient",gradientStops:[{color:"#f0f9ff",position:0},{color:"#e0f2fe",position:100}],gradientDirection:180},elements:[{id:"team-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Team Updates",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"team-headcount-card",type:"shape",position:{x:5,y:20,width:28,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#3b82f6",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:200}},{id:"team-headcount-icon",type:"text",position:{x:12,y:23,width:14,height:8,unit:"percent"},content:{type:"text",text:"👥",style:{fontSize:40,textAlign:"center"}}},{id:"team-headcount-value",type:"text",position:{x:7,y:32,width:24,height:8,unit:"percent"},content:{type:"text",text:t.headcount.toString(),style:{fontSize:36,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"team-headcount-label",type:"text",position:{x:7,y:40,width:24,height:4,unit:"percent"},content:{type:"text",text:"Total Headcount",style:{fontSize:12,color:"#6b7280",textAlign:"center"}}},{id:"team-new-card",type:"shape",position:{x:36,y:20,width:28,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#10b981",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:350}},{id:"team-new-icon",type:"text",position:{x:43,y:23,width:14,height:8,unit:"percent"},content:{type:"text",text:"🆕",style:{fontSize:40,textAlign:"center"}}},{id:"team-new-value",type:"text",position:{x:38,y:32,width:24,height:8,unit:"percent"},content:{type:"text",text:`+${t.newHires||0}`,style:{fontSize:36,fontWeight:700,color:"#10b981",textAlign:"center"}}},{id:"team-new-label",type:"text",position:{x:38,y:40,width:24,height:4,unit:"percent"},content:{type:"text",text:"New Hires",style:{fontSize:12,color:"#6b7280",textAlign:"center"}}},{id:"team-dept-card",type:"shape",position:{x:67,y:20,width:28,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#f59e0b",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:500}},{id:"team-dept-icon",type:"text",position:{x:74,y:23,width:14,height:8,unit:"percent"},content:{type:"text",text:"👋",style:{fontSize:40,textAlign:"center"}}},{id:"team-dept-value",type:"text",position:{x:69,y:32,width:24,height:8,unit:"percent"},content:{type:"text",text:`-${t.departures||0}`,style:{fontSize:36,fontWeight:700,color:"#f59e0b",textAlign:"center"}}},{id:"team-dept-label",type:"text",position:{x:69,y:40,width:24,height:4,unit:"percent"},content:{type:"text",text:"Departures",style:{fontSize:12,color:"#6b7280",textAlign:"center"}}},{id:"team-highlights-title",type:"text",position:{x:5,y:50,width:90,height:6,unit:"percent"},content:{type:"text",text:"Team Highlights",style:{fontSize:24,fontWeight:600,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:700}},...(t.highlights||[]).slice(0,4).map((n,i)=>({id:`team-highlight-${i}`,type:"text",position:{x:7,y:58+i*8,width:88,height:6,unit:"percent"},content:{type:"text",text:`• ${n}`,style:{fontSize:16,color:"#374151"}},animation:{effect:"slideInLeft",durationMs:300,delayMs:800+i*100}}))],notes:"Celebrate new team members and acknowledge departures. Highlight team achievements.",durationMs:45e3}}function ko(e){return{id:"slide-qa",title:"Q&A",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1E3A8A",position:0},{color:"#3b82f6",position:100}],gradientDirection:135},elements:[{id:"qa-title",type:"text",position:{x:10,y:35,width:80,height:20,unit:"percent"},content:{type:"text",text:"Questions?",style:{fontFamily:"Inter, sans-serif",fontSize:72,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:800,delayMs:200}},{id:"qa-subtitle",type:"text",position:{x:10,y:55,width:80,height:10,unit:"percent"},content:{type:"text",text:"Thank you for your attention",style:{fontFamily:"Inter, sans-serif",fontSize:28,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:800}},{id:"qa-contact",type:"text",position:{x:10,y:85,width:80,height:5,unit:"percent"},content:{type:"text",text:e.preparedBy?`Prepared by: ${e.preparedBy}`:e.companyName,style:{fontSize:16,color:"#bfdbfe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Open floor for questions. Have backup slides ready for detailed questions.",durationMs:3e5}}function Io(e){return{version:"1.0",id:`quarterly-report-${e.quarter}-${e.year}`,title:`${e.quarter} ${e.year} Quarterly Report - ${e.companyName}`,author:e.preparedBy,slideSize:{width:1920,height:1080,unit:"px"},slides:[ho(e),yo(e),go(e),xo(e),bo(e),vo(e),So(e),wo(e),ko(e)],theme:{colors:{primary:"#3b82f6",secondary:"#10b981",background:"#fff",text:"#1f2937",accent:"#f59e0b"},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"},spacing:{base:16}},speakerSettings:{showTimer:!0,showNotes:!0,showNextSlide:!0},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),tags:["quarterly-report",e.quarter,e.year.toString()],templateId:"quarterly-report-v1"}}}function Co(){return{quarter:"Q4",year:2024,companyName:"TechCorp Inc.",reportDate:"January 15, 2025",preparedBy:"Finance Team",kpis:{revenue:{value:125e5,change:15.3,target:12e6},profit:{value:28e5,change:8.7,target:25e5},customers:{value:1250,change:22.5,target:1e3},satisfaction:{value:92,change:3.2,target:90}},financials:{revenueByMonth:[{month:"Oct",value:38e5,lastYear:32e5},{month:"Nov",value:42e5,lastYear:35e5},{month:"Dec",value:45e5,lastYear:4e6}],costBreakdown:[{category:"Personnel",value:52e5,percentage:42},{category:"Infrastructure",value:23e5,percentage:18},{category:"Marketing",value:18e5,percentage:14},{category:"R&D",value:15e5,percentage:12},{category:"Operations",value:11e5,percentage:9},{category:"Other",value:6e5,percentage:5}],profitMargin:[{month:"Oct",margin:21},{month:"Nov",margin:22},{month:"Dec",margin:24}]},pipeline:{totalValue:185e5,opportunities:[{stage:"Qualified",count:45,value:85e5},{stage:"Proposal",count:28,value:52e5},{stage:"Negotiation",count:15,value:32e5},{stage:"Closing",count:8,value:16e5}]},risks:[{name:"Supply chain delays",impact:"high",probability:"medium",mitigation:"Diversifying suppliers and increasing inventory buffer",owner:"Operations"},{name:"Key talent retention",impact:"high",probability:"low",mitigation:"Competitive compensation review and career development programs",owner:"HR"},{name:"Market competition",impact:"medium",probability:"high",mitigation:"Accelerating product innovation and customer loyalty programs",owner:"Product"}],plan:[{goal:"Launch v2.0 platform",status:"on-track",dueDate:"Q1 2025",owner:"Engineering"},{goal:"Expand to EMEA market",status:"at-risk",dueDate:"Q2 2025",owner:"Sales"},{goal:"Achieve SOC2 certification",status:"completed",owner:"Security"},{goal:"Implement AI-powered support",status:"on-track",dueDate:"Q1 2025",owner:"Support"},{goal:"Reduce customer churn by 15%",status:"on-track",dueDate:"Q4 2024",owner:"Customer Success"}],team:{headcount:156,newHires:23,departures:8,highlights:["Promoted 12 team members to senior roles","Launched engineering mentorship program","Achieved 95% employee engagement score","Completed company-wide DEI training"]}}}function Mo(e){const t=e.problem.painPoints.slice(0,4).map((n,i)=>({id:`pain-${i}`,type:"text",position:{x:55,y:28+i*15,width:40,height:12,unit:"percent"},content:{type:"text",text:`❌ ${n}`,style:{fontSize:20,color:"#374151",lineHeight:1.5}},animation:{effect:"slideInRight",durationMs:400,delayMs:400+i*200}}));return{id:"slide-problem",title:"The Problem",layout:"twoColumn",background:{type:"solid",color:"#fef2f2"},elements:[{id:"problem-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:e.problem.headline,style:{fontSize:48,fontWeight:700,color:"#991b1b"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"problem-icon",type:"text",position:{x:10,y:30,width:35,height:40,unit:"percent"},content:{type:"text",text:"😫",style:{fontSize:150,textAlign:"center"}},animation:{effect:"zoomIn",durationMs:500,delayMs:200}},...t,...(e.problem.statistics||[]).slice(0,2).map((n,i)=>({id:`stat-${i}`,type:"shape",position:{x:5+i*47,y:80,width:43,height:15,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fee2e2",cornerRadius:8},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3+i*200}}))],notes:"Set up the problem. Make the audience feel the pain before presenting the solution.",durationMs:6e4}}function zo(e){const t=e.solution.keyBenefits.slice(0,3).flatMap((n,i)=>[{id:`benefit-card-${i}`,type:"shape",position:{x:5+i*32,y:45,width:29,height:45,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#10b981",strokeWidth:2,cornerRadius:12},animation:{effect:"slideInUp",durationMs:500,delayMs:400+i*200}},{id:`benefit-icon-${i}`,type:"text",position:{x:10+i*32,y:50,width:19,height:12,unit:"percent"},content:{type:"text",text:n.icon||"✅",style:{fontSize:48,textAlign:"center"}}},{id:`benefit-title-${i}`,type:"text",position:{x:7+i*32,y:64,width:25,height:8,unit:"percent"},content:{type:"text",text:n.title,style:{fontSize:20,fontWeight:600,color:"#1f2937",textAlign:"center"}}},{id:`benefit-desc-${i}`,type:"text",position:{x:7+i*32,y:73,width:25,height:14,unit:"percent"},content:{type:"text",text:n.description,style:{fontSize:14,color:"#6b7280",textAlign:"center",lineHeight:1.4}}}]);return{id:"slide-solution",title:"The Solution",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"#ecfdf5",position:0},{color:"#d1fae5",position:100}],gradientDirection:180},elements:[{id:"solution-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:e.solution.headline,style:{fontSize:48,fontWeight:700,color:"#047857"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"solution-desc",type:"text",position:{x:5,y:20,width:90,height:15,unit:"percent"},content:{type:"text",text:e.solution.description,style:{fontSize:24,color:"#374151",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:500,delayMs:300}},...t],notes:"Introduce your solution as the hero. Emphasize key benefits.",durationMs:6e4}}function Ao(e){var n,i;const t=(((n=e.demo)==null?void 0:n.features)||[]).slice(0,5).map((o,r)=>({id:`demo-feature-${r}`,type:"text",position:{x:55,y:25+r*12,width:40,height:10,unit:"percent"},content:{type:"text",text:`▸ ${o.name}`,style:{fontSize:18,color:"#374151",fontWeight:500}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+r*150}}));return{id:"slide-demo",title:"Product Demo",layout:"twoColumn",background:{type:"solid",color:"#fff"},elements:[{id:"demo-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:`See ${e.productName} in Action`,style:{fontSize:44,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"demo-screenshot",type:"shape",position:{x:5,y:22,width:45,height:70,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#f3f4f6",stroke:"#e5e7eb",strokeWidth:2,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:600,delayMs:300}},{id:"demo-placeholder",type:"text",position:{x:15,y:50,width:25,height:10,unit:"percent"},content:{type:"text",text:(i=e.demo)!=null&&i.screenshotUrl?"":"📱 Demo Screenshot",style:{fontSize:20,color:"#9ca3af",textAlign:"center"}}},{id:"features-title",type:"text",position:{x:55,y:18,width:40,height:6,unit:"percent"},content:{type:"text",text:"Key Features",style:{fontSize:24,fontWeight:600,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},...t],notes:"This is where you do the live demo or show screenshots. Keep it focused.",durationMs:12e4}}function $o(e){const t=e.features.slice(0,6).flatMap((n,i)=>{const o=Math.floor(i/3),r=i%3,a=n.highlight;return[{id:`feature-card-${i}`,type:"shape",position:{x:5+r*32,y:22+o*38,width:29,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:a?"#3b82f6":"#fff",stroke:a?"#2563eb":"#e5e7eb",strokeWidth:a?3:1,cornerRadius:12},animation:{effect:"zoomIn",durationMs:400,delayMs:200+i*100}},{id:`feature-icon-${i}`,type:"text",position:{x:10+r*32,y:26+o*38,width:19,height:10,unit:"percent"},content:{type:"text",text:n.icon||"⚡",style:{fontSize:36,textAlign:"center"}}},{id:`feature-name-${i}`,type:"text",position:{x:7+r*32,y:37+o*38,width:25,height:6,unit:"percent"},content:{type:"text",text:n.name,style:{fontSize:18,fontWeight:600,color:a?"#fff":"#1f2937",textAlign:"center"}}},{id:`feature-desc-${i}`,type:"text",position:{x:7+r*32,y:44+o*38,width:25,height:10,unit:"percent"},content:{type:"text",text:n.description,style:{fontSize:12,color:a?"#dbeafe":"#6b7280",textAlign:"center",lineHeight:1.3}}}]});return{id:"slide-features",title:"Features",layout:"titleContent",background:{type:"solid",color:"#f9fafb"},elements:[{id:"features-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:"Powerful Features",style:{fontSize:44,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Highlight key features. Focus on benefits, not just functionality.",durationMs:6e4}}function _o(e){const t=e.pricing.plans.slice(0,3).flatMap((n,i)=>{const o=n.highlighted,r=o?18:22,a=o?72:65;return[{id:`pricing-card-${i}`,type:"shape",position:{x:5+i*32,y:r,width:29,height:a,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:o?"#3b82f6":"#fff",stroke:o?"#1d4ed8":"#e5e7eb",strokeWidth:o?3:1,cornerRadius:16},animation:{effect:"slideInUp",durationMs:500,delayMs:200+i*150}},...o?[{id:`pricing-badge-${i}`,type:"text",position:{x:10+i*32,y:r+2,width:19,height:4,unit:"percent"},content:{type:"text",text:"⭐ POPULAR",style:{fontSize:12,fontWeight:700,color:"#fcd34d",textAlign:"center"}}}]:[],{id:`pricing-name-${i}`,type:"text",position:{x:7+i*32,y:r+(o?8:5),width:25,height:6,unit:"percent"},content:{type:"text",text:n.name,style:{fontSize:24,fontWeight:600,color:o?"#fff":"#1f2937",textAlign:"center"}}},{id:`pricing-price-${i}`,type:"text",position:{x:7+i*32,y:r+(o?16:13),width:25,height:10,unit:"percent"},content:{type:"text",text:n.price==="custom"?"Custom":`${e.pricing.currency}${n.price}/${n.period==="month"?"mo":n.period==="year"?"yr":""}`,style:{fontSize:36,fontWeight:700,color:o?"#fff":"#3b82f6",textAlign:"center"}}},...n.features.slice(0,5).map((s,c)=>({id:`pricing-feature-${i}-${c}`,type:"text",position:{x:7+i*32,y:r+(o?28:25)+c*7,width:25,height:5,unit:"percent"},content:{type:"text",text:`✓ ${s}`,style:{fontSize:12,color:o?"#dbeafe":"#6b7280",textAlign:"center"}}})),{id:`pricing-cta-${i}`,type:"shape",position:{x:9+i*32,y:r+a-12,width:21,height:8,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:o?"#fff":"#3b82f6",cornerRadius:8}},{id:`pricing-cta-text-${i}`,type:"text",position:{x:9+i*32,y:r+a-10.5,width:21,height:5,unit:"percent"},content:{type:"text",text:n.cta||"Get Started",style:{fontSize:14,fontWeight:600,color:o?"#3b82f6":"#fff",textAlign:"center"}}}]});return{id:"slide-pricing",title:"Pricing",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"pricing-title",type:"text",position:{x:5,y:3,width:90,height:10,unit:"percent"},content:{type:"text",text:"Simple, Transparent Pricing",style:{fontSize:44,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Present pricing clearly. Emphasize value, not just cost.",durationMs:6e4}}function To(e){return{id:"slide-cta",title:"Call to Action",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1e40af",position:0},{color:"#3b82f6",position:50},{color:"#60a5fa",position:100}],gradientDirection:135},elements:[{id:"cta-headline",type:"text",position:{x:10,y:25,width:80,height:20,unit:"percent"},content:{type:"text",text:e.cta.headline,style:{fontSize:56,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:700,delayMs:0}},...e.cta.subheadline?[{id:"cta-subheadline",type:"text",position:{x:15,y:48,width:70,height:10,unit:"percent"},content:{type:"text",text:e.cta.subheadline,style:{fontSize:24,color:"#bfdbfe",textAlign:"center",lineHeight:1.4}},animation:{effect:"fadeIn",durationMs:500,delayMs:500}}]:[],{id:"cta-button",type:"shape",position:{x:35,y:65,width:30,height:12,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",cornerRadius:30},animation:{effect:"slideInUp",durationMs:500,delayMs:800}},{id:"cta-button-text",type:"text",position:{x:35,y:68,width:30,height:6,unit:"percent"},content:{type:"text",text:e.cta.buttonText,style:{fontSize:24,fontWeight:700,color:"#1e40af",textAlign:"center"}}},...e.cta.contactEmail?[{id:"cta-contact",type:"text",position:{x:20,y:82,width:60,height:6,unit:"percent"},content:{type:"text",text:`📧 ${e.cta.contactEmail}`,style:{fontSize:18,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}]:[],...e.cta.websiteUrl?[{id:"cta-website",type:"text",position:{x:20,y:88,width:60,height:5,unit:"percent"},content:{type:"text",text:`🌐 ${e.cta.websiteUrl}`,style:{fontSize:16,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1100}}]:[]],notes:"Strong call to action. Make it easy for them to take the next step.",durationMs:6e4}}function Eo(e){return{id:"slide-title",title:"Title",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#0f172a",position:0},{color:"#1e293b",position:100}],gradientDirection:180},elements:[{id:"title-product",type:"text",position:{x:10,y:30,width:80,height:20,unit:"percent"},content:{type:"text",text:e.productName,style:{fontSize:72,fontWeight:800,color:"#fff",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:800,delayMs:200}},{id:"title-tagline",type:"text",position:{x:15,y:52,width:70,height:12,unit:"percent"},content:{type:"text",text:e.tagline,style:{fontSize:28,color:"#94a3b8",textAlign:"center",lineHeight:1.4}},animation:{effect:"fadeIn",durationMs:600,delayMs:800}},{id:"title-company",type:"text",position:{x:10,y:88,width:80,height:6,unit:"percent"},content:{type:"text",text:e.companyName,style:{fontSize:18,color:"#64748b",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Opening slide. Create intrigue and set the tone.",durationMs:15e3}}function No(e){return{version:"1.0",id:`product-pitch-${e.productName.toLowerCase().replace(/\s+/g,"-")}`,title:`${e.productName} - Product Pitch`,slideSize:{width:1920,height:1080,unit:"px"},slides:[Eo(e),Mo(e),zo(e),Ao(e),$o(e),_o(e),To(e)],theme:{colors:{primary:"#3b82f6",secondary:"#10b981",background:"#fff",text:"#1f2937",accent:"#f59e0b"},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"},spacing:{base:16}},speakerSettings:{showTimer:!0,showNotes:!0,showNextSlide:!0},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),tags:["product-pitch","sales"],templateId:"product-pitch-v1"}}}function Ro(){return{productName:"FlowSync",tagline:"Seamless workflow automation that actually works",companyName:"FlowSync Inc.",problem:{headline:"Manual processes are killing productivity",painPoints:["Teams waste 20+ hours/week on repetitive tasks","Data silos cause costly errors and delays","No visibility into process bottlenecks","Integration nightmares with existing tools"],statistics:[{stat:"60%",description:"of knowledge workers spend time on busy work"},{stat:"$1.8T",description:"lost annually to inefficient processes"}]},solution:{headline:"Automate in minutes, not months",description:"FlowSync connects your existing tools and automates workflows with AI-powered intelligence. No coding required.",keyBenefits:[{title:"Easy Setup",description:"Connect apps in seconds with 200+ integrations",icon:"🔌"},{title:"AI-Powered",description:"Smart automation that learns from your workflows",icon:"🧠"},{title:"Real-time Insights",description:"Dashboard with live metrics and bottleneck detection",icon:"📊"}]},demo:{features:[{name:"Visual Workflow Builder",description:"Drag-and-drop interface"},{name:"Smart Triggers",description:"Event-based automation"},{name:"Error Handling",description:"Automatic retry and alerts"},{name:"Version Control",description:"Track changes and rollback"},{name:"Team Collaboration",description:"Share and comment on flows"}]},features:[{name:"Visual Builder",description:"Intuitive drag-and-drop workflow design",icon:"🎨",highlight:!0},{name:"200+ Integrations",description:"Connect to popular apps instantly",icon:"🔗"},{name:"AI Suggestions",description:"Get smart automation recommendations",icon:"🤖"},{name:"Real-time Monitoring",description:"Track all workflows in one dashboard",icon:"📈"},{name:"Enterprise Security",description:"SOC2 compliant, encrypted data",icon:"🔒"},{name:"24/7 Support",description:"Expert help whenever you need it",icon:"💬"}],pricing:{currency:"$",plans:[{name:"Starter",price:29,period:"month",features:["5 workflows","1,000 runs/month","10 integrations","Email support"],cta:"Start Free"},{name:"Professional",price:99,period:"month",features:["Unlimited workflows","50,000 runs/month","All integrations","Priority support","AI suggestions"],highlighted:!0,cta:"Try 14 Days Free"},{name:"Enterprise",price:"custom",period:"month",features:["Everything in Pro","Unlimited runs","Dedicated support","Custom integrations","SLA guarantee"],cta:"Contact Sales"}]},cta:{headline:"Ready to automate your workflow?",subheadline:"Join 10,000+ teams already saving hours every week",buttonText:"Start Your Free Trial",contactEmail:"hello@flowsync.io",websiteUrl:"flowsync.io"}}}function Po(e){const t=Math.round(e.completed.totalPoints/e.completed.committedPoints*100);return{id:"slide-title",title:"Sprint Review",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1E3A8A",position:0},{color:"#3b82f6",position:100}],gradientDirection:135},elements:[{id:"title-sprint",type:"text",position:{x:10,y:25,width:80,height:15,unit:"percent"},content:{type:"text",text:`Sprint ${e.sprint.number} Review`,style:{fontSize:64,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"title-name",type:"text",position:{x:15,y:42,width:70,height:8,unit:"percent"},content:{type:"text",text:e.sprint.name,style:{fontSize:32,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:500,delayMs:300}},{id:"title-team",type:"text",position:{x:30,y:55,width:40,height:5,unit:"percent"},content:{type:"text",text:`Team ${e.team.name}`,style:{fontSize:20,color:"#bfdbfe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"title-dates",type:"text",position:{x:25,y:62,width:50,height:5,unit:"percent"},content:{type:"text",text:`${e.sprint.startDate} - ${e.sprint.endDate}`,style:{fontSize:18,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:600}},{id:"title-completion",type:"text",position:{x:35,y:75,width:30,height:10,unit:"percent"},content:{type:"text",text:`${t}% Complete`,style:{fontSize:36,fontWeight:700,color:t>=80?"#4ade80":t>=60?"#fbbf24":"#f87171",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:600,delayMs:800}}],notes:"Welcome stakeholders. Quick overview of sprint completion.",durationMs:3e4}}function qo(e){return{id:"slide-goal",title:"Sprint Goal",layout:"titleContent",background:{type:"solid",color:"#f0f9ff"},elements:[{id:"goal-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Sprint Goal",style:{fontSize:44,fontWeight:700,color:"#1E3A8A"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"goal-card",type:"shape",position:{x:10,y:25,width:80,height:30,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#3b82f6",strokeWidth:3,cornerRadius:16},animation:{effect:"slideInUp",durationMs:500,delayMs:200}},{id:"goal-icon",type:"text",position:{x:15,y:30,width:10,height:15,unit:"percent"},content:{type:"text",text:"🎯",style:{fontSize:64}}},{id:"goal-text",type:"text",position:{x:27,y:32,width:58,height:20,unit:"percent"},content:{type:"text",text:e.sprint.goal,style:{fontSize:28,color:"#1f2937",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"goal-status",type:"text",position:{x:10,y:60,width:80,height:8,unit:"percent"},content:{type:"text",text:e.completed.totalPoints>=e.completed.committedPoints*.8?"✅ Goal Achieved":"⚠️ Goal Partially Met",style:{fontSize:32,fontWeight:600,color:e.completed.totalPoints>=e.completed.committedPoints*.8?"#059669":"#d97706",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:500,delayMs:700}}],notes:"Review whether the sprint goal was achieved and why.",durationMs:45e3}}function Do(e){const t=e.completed.stories.slice(0,8).map((n,i)=>{const o=Math.floor(i/2),r=i%2,a=n.type==="feature"?"✨":n.type==="bug"?"🐛":n.type==="tech-debt"?"🔧":"🔬",s=n.type==="feature"?"#059669":n.type==="bug"?"#dc2626":n.type==="tech-debt"?"#7c3aed":"#0891b2";return{id:`story-${i}`,type:"text",position:{x:5+r*48,y:22+o*9,width:44,height:7,unit:"percent"},content:{type:"text",text:`${a} ${n.key}: ${n.title}`,style:{fontSize:16,color:s,fontWeight:n.demo?700:400}},animation:{effect:"slideInRight",durationMs:300,delayMs:300+i*100}}});return{id:"slide-completed",title:"Completed Work",layout:"titleContent",background:{type:"solid",color:"#f0fdf4"},elements:[{id:"completed-title",type:"text",position:{x:5,y:5,width:60,height:10,unit:"percent"},content:{type:"text",text:"Completed Work",style:{fontSize:44,fontWeight:700,color:"#166534"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"completed-points",type:"text",position:{x:70,y:5,width:25,height:12,unit:"percent"},content:{type:"text",text:`${e.completed.totalPoints} / ${e.completed.committedPoints} pts`,style:{fontSize:32,fontWeight:700,color:"#059669",textAlign:"right"}},animation:{effect:"zoomIn",durationMs:500,delayMs:200}},...t,{id:"legend",type:"text",position:{x:5,y:90,width:90,height:5,unit:"percent"},content:{type:"text",text:"✨ Feature | 🐛 Bug Fix | 🔧 Tech Debt | 🔬 Spike",style:{fontSize:14,color:"#6b7280",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Walk through completed items. Highlight any notable achievements.",durationMs:9e4}}function jo(e){const t=Math.max(...e.velocity.history.map(o=>o.points),e.velocity.current),n=e.velocity.history.slice(-5).map((o,r)=>{const a=o.points/t*45;return{id:`bar-${r}`,type:"shape",position:{x:10+r*16,y:75-a,width:12,height:a,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#93c5fd",cornerRadius:8},animation:{effect:"slideInUp",durationMs:500,delayMs:400+r*100}}}),i=e.velocity.current/t*45;return{id:"slide-velocity",title:"Velocity",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"velocity-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Sprint Velocity",style:{fontSize:44,fontWeight:700,color:"#1E3A8A"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...n,{id:"current-bar",type:"shape",position:{x:10+e.velocity.history.slice(-5).length*16,y:75-i,width:12,height:i,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#3b82f6",cornerRadius:8},animation:{effect:"slideInUp",durationMs:600,delayMs:900}},{id:"current-label",type:"text",position:{x:10+e.velocity.history.slice(-5).length*16,y:77,width:12,height:6,unit:"percent"},content:{type:"text",text:`S${e.sprint.number}`,style:{fontSize:14,color:"#1E3A8A",fontWeight:600,textAlign:"center"}}},{id:"current-value",type:"text",position:{x:10+e.velocity.history.slice(-5).length*16,y:70-i,width:12,height:5,unit:"percent"},content:{type:"text",text:`${e.velocity.current}`,style:{fontSize:18,color:"#3b82f6",fontWeight:700,textAlign:"center"}}},{id:"average-line",type:"text",position:{x:5,y:18,width:35,height:10,unit:"percent"},content:{type:"text",text:`Average: ${e.velocity.average} pts/sprint`,style:{fontSize:24,color:"#6b7280"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"trend",type:"text",position:{x:60,y:18,width:35,height:10,unit:"percent"},content:{type:"text",text:e.velocity.current>=e.velocity.average?"📈 On Track":"📉 Below Average",style:{fontSize:24,color:e.velocity.current>=e.velocity.average?"#059669":"#dc2626",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}],notes:"Review velocity trends. Discuss any significant changes.",durationMs:6e4}}function Oo(e){const t=(e.impediments||[]).slice(0,5).map((n,i)=>{const o=n.status==="resolved"?"✅":n.status==="ongoing"?"🔄":"🚨",r=n.status==="resolved"?"#059669":n.status==="ongoing"?"#d97706":"#dc2626";return{id:`impediment-${i}`,type:"text",position:{x:5,y:25+i*13,width:90,height:11,unit:"percent"},content:{type:"text",text:`${o} ${n.description}${n.owner?` (${n.owner})`:""}`,style:{fontSize:20,color:r,lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:400,delayMs:300+i*150}}});return{id:"slide-impediments",title:"Impediments",layout:"titleContent",background:{type:"solid",color:"#fef2f2"},elements:[{id:"impediments-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:"Impediments & Blockers",style:{fontSize:44,fontWeight:700,color:"#991b1b"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t,{id:"legend-impediments",type:"text",position:{x:5,y:90,width:90,height:5,unit:"percent"},content:{type:"text",text:"✅ Resolved | 🔄 Ongoing | 🚨 Escalated",style:{fontSize:14,color:"#6b7280",textAlign:"center"}}}],notes:"Discuss blockers and what help is needed from stakeholders.",durationMs:6e4}}function Fo(e){const t=e.nextSprint.topPriorities.slice(0,5).map((n,i)=>({id:`priority-${i}`,type:"text",position:{x:5,y:45+i*10,width:90,height:8,unit:"percent"},content:{type:"text",text:`${i+1}. ${n.key}: ${n.title}${n.points?` (${n.points} pts)`:""}`,style:{fontSize:20,color:"#374151",lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+i*100}}));return{id:"slide-next",title:"Next Sprint",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"#eef2ff",position:0},{color:"#e0e7ff",position:100}],gradientDirection:180},elements:[{id:"next-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:`Sprint ${e.sprint.number+1} Preview`,style:{fontSize:44,fontWeight:700,color:"#4338ca"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"next-goal-label",type:"text",position:{x:5,y:18,width:20,height:6,unit:"percent"},content:{type:"text",text:"Sprint Goal:",style:{fontSize:20,fontWeight:600,color:"#6366f1"}}},{id:"next-goal",type:"text",position:{x:5,y:25,width:90,height:12,unit:"percent"},content:{type:"text",text:e.nextSprint.goal,style:{fontSize:28,color:"#1f2937",lineHeight:1.4}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},{id:"priorities-label",type:"text",position:{x:5,y:40,width:30,height:5,unit:"percent"},content:{type:"text",text:"Top Priorities:",style:{fontSize:20,fontWeight:600,color:"#6366f1"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},...t,{id:"capacity",type:"text",position:{x:70,y:5,width:25,height:10,unit:"percent"},content:{type:"text",text:`Capacity: ${e.nextSprint.capacity} pts`,style:{fontSize:20,fontWeight:600,color:"#059669",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}}],notes:"Preview next sprint. Get stakeholder input on priorities.",durationMs:6e4}}function Lo(e){const t=[Po(e),qo(e),Do(e),jo(e)];return e.impediments&&e.impediments.length>0&&t.push(Oo(e)),t.push(Fo(e)),{version:"1.0",id:`sprint-review-${e.sprint.number}`,title:`Sprint ${e.sprint.number} Review - ${e.team.name}`,slideSize:{width:1920,height:1080,unit:"px"},slides:t,theme:{colors:{primary:"#3b82f6",secondary:"#10b981",background:"#fff",text:"#1f2937",accent:"#8b5cf6"},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"},spacing:{base:16}},speakerSettings:{showTimer:!0,showNotes:!0,showNextSlide:!0},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),tags:["sprint-review","agile","scrum"],templateId:"sprint-review-v1"}}}function Wo(){return{sprint:{number:24,name:"Phoenix Release",startDate:"2024-03-04",endDate:"2024-03-15",goal:"Complete user authentication flow and improve dashboard performance by 50%"},team:{name:"Alpha",members:[{name:"Sarah Chen",role:"Tech Lead"},{name:"Mike Johnson",role:"Senior Dev"},{name:"Emily Davis",role:"Frontend Dev"},{name:"Alex Kim",role:"QA Engineer"}]},completed:{stories:[{key:"AUTH-123",title:"OAuth2 integration",points:8,assignee:"Sarah",type:"feature",demo:!0},{key:"AUTH-124",title:"Password reset flow",points:5,assignee:"Mike",type:"feature",demo:!0},{key:"DASH-45",title:"Query optimization",points:8,assignee:"Sarah",type:"tech-debt"},{key:"DASH-46",title:"Caching layer",points:5,assignee:"Mike",type:"feature"},{key:"BUG-89",title:"Login timeout issue",points:3,assignee:"Emily",type:"bug"},{key:"BUG-90",title:"Memory leak in charts",points:5,assignee:"Emily",type:"bug"}],totalPoints:34,committedPoints:40},notCompleted:[{key:"AUTH-125",title:"MFA implementation",points:6,reason:"Blocked by security review"}],demos:[{title:"OAuth2 Login",description:"Full OAuth2 flow with Google and GitHub",presenter:"Sarah"},{title:"Password Reset",description:"Email-based password reset with security tokens",presenter:"Mike"}],velocity:{current:34,history:[{sprint:"S20",points:28},{sprint:"S21",points:32},{sprint:"S22",points:35},{sprint:"S23",points:30}],average:31},metrics:{bugsFixed:2,bugsCreated:1,testCoverage:78,deployments:3,cycleTime:4.2},impediments:[{description:"Security review delayed MFA implementation",status:"ongoing",owner:"Security Team"},{description:"CI pipeline slow - 45min builds",status:"resolved",owner:"DevOps"}],nextSprint:{goal:"Complete MFA implementation and launch beta user onboarding",topPriorities:[{key:"AUTH-125",title:"MFA implementation",points:6},{key:"ONBOARD-01",title:"Welcome wizard",points:8},{key:"ONBOARD-02",title:"User tutorial system",points:5},{key:"DASH-50",title:"Real-time notifications",points:5}],capacity:32}}}function Bo(e){return{id:"slide-title",title:"Architecture Overview",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#0f172a",position:0},{color:"#1e293b",position:100}],gradientDirection:135},elements:[{id:"title-main",type:"text",position:{x:10,y:28,width:80,height:15,unit:"percent"},content:{type:"text",text:e.project.name,style:{fontSize:64,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"title-subtitle",type:"text",position:{x:15,y:45,width:70,height:8,unit:"percent"},content:{type:"text",text:"Architecture Overview",style:{fontSize:36,color:"#60a5fa",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:500,delayMs:300}},{id:"title-version",type:"text",position:{x:35,y:58,width:30,height:5,unit:"percent"},content:{type:"text",text:`v${e.project.version}`,style:{fontSize:20,color:"#94a3b8",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"title-desc",type:"text",position:{x:15,y:68,width:70,height:12,unit:"percent"},content:{type:"text",text:e.project.description,style:{fontSize:18,color:"#cbd5e1",textAlign:"center",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:700}},...e.project.team?[{id:"title-team",type:"text",position:{x:10,y:88,width:80,height:5,unit:"percent"},content:{type:"text",text:`Team: ${e.project.team}`,style:{fontSize:16,color:"#64748b",textAlign:"center"}}}]:[]],notes:"Introduction to the system architecture. Set context for the audience.",durationMs:3e4}}function Uo(e){const t=e.systemOverview.keyCharacteristics.slice(0,4).map((n,i)=>[{id:`char-card-${i}`,type:"shape",position:{x:5+i*24,y:65,width:22,height:28,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#1e293b",stroke:"#334155",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInUp",durationMs:400,delayMs:600+i*100}},{id:`char-value-${i}`,type:"text",position:{x:7+i*24,y:70,width:18,height:10,unit:"percent"},content:{type:"text",text:n.value,style:{fontSize:32,fontWeight:700,color:"#60a5fa",textAlign:"center"}}},{id:`char-label-${i}`,type:"text",position:{x:7+i*24,y:82,width:18,height:8,unit:"percent"},content:{type:"text",text:n.label,style:{fontSize:14,color:"#94a3b8",textAlign:"center"}}}]).flat();return{id:"slide-overview",title:"System Overview",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"overview-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"System Overview",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"overview-summary",type:"text",position:{x:5,y:18,width:90,height:15,unit:"percent"},content:{type:"text",text:e.systemOverview.summary,style:{fontSize:22,color:"#cbd5e1",lineHeight:1.6}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},{id:"diagram-placeholder",type:"shape",position:{x:20,y:35,width:60,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#1e293b",stroke:"#334155",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:400}},{id:"diagram-label",type:"text",position:{x:35,y:45,width:30,height:6,unit:"percent"},content:{type:"text",text:"📊 System Diagram",style:{fontSize:18,color:"#64748b",textAlign:"center"}}},...t],notes:"High-level system overview. Explain the main purpose and characteristics.",durationMs:6e4}}function Ho(e){const t={frontend:"#3b82f6",backend:"#10b981",service:"#8b5cf6",database:"#f59e0b",cache:"#ec4899",queue:"#06b6d4",external:"#6b7280"},n={frontend:"🖥️",backend:"⚙️",service:"🔧",database:"🗄️",cache:"⚡",queue:"📬",external:"🔗"},i=e.components.slice(0,6).flatMap((o,r)=>{const a=Math.floor(r/3),s=r%3,c=t[o.type]||"#6b7280",u=n[o.type]||"📦";return[{id:`comp-card-${r}`,type:"shape",position:{x:5+s*32,y:22+a*38,width:29,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#1e293b",stroke:c,strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:400,delayMs:200+r*100}},{id:`comp-icon-${r}`,type:"text",position:{x:7+s*32,y:25+a*38,width:6,height:8,unit:"percent"},content:{type:"text",text:u,style:{fontSize:28}}},{id:`comp-name-${r}`,type:"text",position:{x:14+s*32,y:26+a*38,width:18,height:6,unit:"percent"},content:{type:"text",text:o.name,style:{fontSize:18,fontWeight:600,color:"#f8fafc"}}},{id:`comp-tech-${r}`,type:"text",position:{x:7+s*32,y:34+a*38,width:25,height:5,unit:"percent"},content:{type:"text",text:o.technology,style:{fontSize:12,color:c,fontWeight:500}}},{id:`comp-desc-${r}`,type:"text",position:{x:7+s*32,y:40+a*38,width:25,height:14,unit:"percent"},content:{type:"text",text:o.description,style:{fontSize:12,color:"#94a3b8",lineHeight:1.4}}}]});return{id:"slide-components",title:"Components",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"components-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"System Components",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...i],notes:"Walk through each component. Explain responsibilities and interactions.",durationMs:9e4}}function Vo(e){const n=[{key:"frontend",label:"Frontend",icon:"🖥️",color:"#3b82f6"},{key:"backend",label:"Backend",icon:"⚙️",color:"#10b981"},{key:"database",label:"Database",icon:"🗄️",color:"#f59e0b"},{key:"infrastructure",label:"Infrastructure",icon:"☁️",color:"#8b5cf6"}].flatMap((i,o)=>{const r=e.techStack[i.key];if(!r||r.length===0)return[];const a=o%2,s=Math.floor(o/2);return[{id:`tech-header-${i.key}`,type:"text",position:{x:5+a*48,y:20+s*40,width:44,height:6,unit:"percent"},content:{type:"text",text:`${i.icon} ${i.label}`,style:{fontSize:24,fontWeight:600,color:i.color}},animation:{effect:"fadeIn",durationMs:400,delayMs:200+o*100}},...r.slice(0,4).map((c,u)=>({id:`tech-item-${i.key}-${u}`,type:"text",position:{x:7+a*48,y:28+s*40+u*7,width:40,height:5,unit:"percent"},content:{type:"text",text:`• ${c.name}${c.version?` v${c.version}`:""} - ${c.purpose}`,style:{fontSize:14,color:"#cbd5e1",lineHeight:1.3}},animation:{effect:"slideInRight",durationMs:300,delayMs:400+o*100+u*50}}))]});return{id:"slide-techstack",title:"Tech Stack",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"techstack-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Technology Stack",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...n],notes:"Overview of technologies used. Explain key decisions.",durationMs:6e4}}function Qo(e){const t=e.infrastructure.services.slice(0,8).map((n,i)=>{const o=i%4,r=Math.floor(i/4);return{id:`infra-svc-${i}`,type:"text",position:{x:5+o*24,y:50+r*15,width:22,height:12,unit:"percent"},content:{type:"text",text:`${n.icon||"☁️"} ${n.name}
100
+ </svg>`}function Ae(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const ae=({slide:e,slideSize:t,theme:n,scale:i=1,selectedElementId:o,onSelectElement:r,onElementDrag:a,onElementResize:s,onElementRotate:c,interactive:u=!1,showGrid:m=!1,gridSnap:p=0,className:h})=>{const[f,g]=d.useState(null),[y,v]=d.useState(null),k=A=>p>0?Math.round(A/p)*p:A,b=d.useMemo(()=>{const A=e.background;if(A.type==="gradient"&&A.gradientStops){const P=A.gradientStops.map(L=>`${L.color} ${L.position*100}%`).join(", ");return{background:`linear-gradient(${A.gradientDirection??180}deg, ${P})`}}return A.type==="image"&&A.imageUrl?{backgroundImage:`url(${A.imageUrl})`,backgroundSize:A.imageFit??"cover",backgroundPosition:"center",backgroundColor:A.color??n.backgroundColor}:{backgroundColor:A.color??n.backgroundColor}},[e.background,n.backgroundColor]),S=d.useCallback((A,P)=>{!u||P.locked||(A.stopPropagation(),r==null||r(P.id),g({id:P.id,startX:A.clientX,startY:A.clientY,elStartX:P.position.x,elStartY:P.position.y}))},[u,r]),_=d.useCallback(A=>{if(f&&a){const P=(A.clientX-f.startX)/i,L=(A.clientY-f.startY)/i,H=k(f.elStartX+P/t.width*100),X=k(f.elStartY+L/t.height*100);a(f.id,H,X)}if(y&&s){const P=(A.clientX-y.startX)/i/t.width*100,L=(A.clientY-y.startY)/i/t.height*100,H=y.elPos;let{x:X,y:C,width:$,height:I}=H;const q=y.handle;q.includes("e")&&($=k(Math.max(2,H.width+P))),q.includes("w")&&($=k(Math.max(2,H.width-P)),X=k(H.x+(H.width-$))),q.includes("s")&&(I=k(Math.max(2,H.height+L))),q.includes("n")&&(I=k(Math.max(2,H.height-L)),C=k(H.y+(H.height-I))),s(y.id,$,I,X,C)}},[f,y,a,s,i,t,k]),R=d.useCallback(()=>{g(null),v(null)},[]),j=d.useCallback((A,P,L)=>{u&&(A.stopPropagation(),A.preventDefault(),v({id:P.id,handle:L,startX:A.clientX,startY:A.clientY,elPos:{...P.position}}))},[u]),Q=d.useCallback(A=>{A.target.classList.contains("nice-slide-canvas__surface")&&(r==null||r(null))},[r]);return l.jsxs("div",{className:`nice-slide-canvas ${h??""}`,style:{width:t.width*i,height:t.height*i,position:"relative",overflow:"hidden",boxShadow:"0 2px 12px var(--nice-overlay-15, rgba(0, 0, 0, 0.15))",borderRadius:4,...b,color:n.textColor,fontFamily:n.fontFamily},onMouseMove:_,onMouseUp:R,onMouseLeave:R,onClick:Q,children:[l.jsx("div",{className:"nice-slide-canvas__surface",style:{width:"100%",height:"100%",position:"absolute"}}),m&&l.jsx("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",opacity:.15},children:Array.from({length:9},(A,P)=>{const L=(P+1)*10;return l.jsxs(d.Fragment,{children:[l.jsx("line",{x1:`${L}%`,y1:"0",x2:`${L}%`,y2:"100%",stroke:"var(--nice-text-secondary, #666)",strokeWidth:"0.5"}),l.jsx("line",{x1:"0",y1:`${L}%`,x2:"100%",y2:`${L}%`,stroke:"var(--nice-text-secondary, #666)",strokeWidth:"0.5"})]},P)})}),[...e.elements].sort((A,P)=>(A.zIndex??0)-(P.zIndex??0)).map(A=>l.jsx(Vt,{element:A,slideSize:t,scale:i,theme:n,isSelected:o===A.id,onMouseDown:P=>S(P,A),onResizeStart:(P,L)=>j(P,A,L),interactive:u},A.id))]})},Bt=["nw","n","ne","e","se","s","sw","w"],Ut={nw:"nwse-resize",n:"ns-resize",ne:"nesw-resize",e:"ew-resize",se:"nwse-resize",s:"ns-resize",sw:"nesw-resize",w:"ew-resize"},Ht={nw:{top:-4,left:-4},n:{top:-4,left:"50%",marginLeft:-4},ne:{top:-4,right:-4},e:{top:"50%",right:-4,marginTop:-4},se:{bottom:-4,right:-4},s:{bottom:-4,left:"50%",marginLeft:-4},sw:{bottom:-4,left:-4},w:{top:"50%",left:-4,marginTop:-4}},Vt=({element:e,slideSize:t,scale:n,theme:i,isSelected:o,onMouseDown:r,onResizeStart:a,interactive:s})=>{const{position:c,content:u,rotation:m,opacity:p}=e,h=c.x/100*t.width*n,f=c.y/100*t.height*n,g=c.width/100*t.width*n,y=c.height/100*t.height*n,v={position:"absolute",left:h,top:f,width:g,height:y,opacity:p??1,transform:m?`rotate(${m}deg)`:void 0,cursor:s&&!e.locked?"move":"default",outline:o?"2px solid var(--nice-primary, #2196f3)":void 0,outlineOffset:o?2:void 0,zIndex:e.zIndex??0};return l.jsxs("div",{style:v,onMouseDown:r,children:[Qt(u,g,y,n,i),o&&s&&!e.locked&&Bt.map(k=>l.jsx("div",{style:{position:"absolute",width:8,height:8,background:"var(--nice-primary, #2196f3)",border:"1px solid var(--nice-bg, #FFF)",borderRadius:2,cursor:Ut[k],zIndex:10,...Ht[k]},onMouseDown:b=>a(b,k)},k))]})};function Qt(e,t,n,i,o){switch(e.kind){case"text":{const r=e;return l.jsx("div",{style:{width:"100%",height:"100%",fontSize:(r.fontSize??16)*i,fontFamily:r.fontFamily??o.fontFamily,fontWeight:r.fontWeight??"normal",color:r.fontColor??o.textColor,textAlign:r.textAlign??"left",lineHeight:r.lineHeight??1.4,whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"hidden"},children:r.text})}case"image":{const r=e;return l.jsx("img",{src:r.src,alt:r.alt??"",style:{width:"100%",height:"100%",objectFit:r.objectFit??"contain",borderRadius:r.borderRadius??0,boxShadow:r.shadow?"0 4px 16px var(--nice-overlay-20, rgba(0, 0, 0, 0.2))":void 0}})}case"shape":{const r=e;return l.jsx("div",{style:{width:"100%",height:"100%",backgroundColor:r.fill??"var(--nice-border, #ccc)",border:r.strokeWidth?`${r.strokeWidth}px solid ${r.stroke??"var(--nice-text, #333)"}`:void 0,borderRadius:r.shapeType==="ellipse"?"50%":0}})}case"code":{const r=e;return l.jsx("pre",{style:{width:"100%",height:"100%",margin:0,padding:12*i,fontSize:(r.fontSize??14)*i,fontFamily:o.codeFontFamily??"monospace",backgroundColor:r.theme==="light"?"var(--nice-bg-secondary, #f5f5f5)":"var(--nice-bg, #1e1e1e)",color:r.theme==="light"?"var(--nice-text, #333)":"var(--nice-text, #d4d4d4)",borderRadius:8,overflow:"auto",whiteSpace:"pre"},children:l.jsx("code",{children:r.code})})}case"chart":{const a=Be(e,t,n);return l.jsx("div",{style:{width:"100%",height:"100%"},dangerouslySetInnerHTML:{__html:a}})}case"table":{const r=e;return l.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14*i},children:[l.jsx("thead",{children:l.jsx("tr",{children:r.headers.map((a,s)=>l.jsx("th",{style:{padding:`${6*i}px ${8*i}px`,backgroundColor:r.headerBg??o.primaryColor,color:r.headerColor??"var(--nice-color-white, #fff)",textAlign:"left",borderBottom:`2px solid ${r.borderColor??"var(--nice-border, #ddd)"}`},children:a},s))})}),l.jsx("tbody",{children:r.rows.map((a,s)=>l.jsx("tr",{style:{backgroundColor:r.stripedRows&&s%2===1?"var(--nice-overlay-3, rgba(0, 0, 0, 0.03))":void 0},children:a.map((c,u)=>l.jsx("td",{style:{padding:`${4*i}px ${8*i}px`,borderBottom:`1px solid ${r.borderColor??"var(--nice-border, #eee)"}`},children:c},u))},s))})]})}default:return l.jsx("div",{style:{width:"100%",height:"100%",background:"var(--nice-bg-secondary, #f0f0f0)",borderRadius:4}})}}ae.displayName="SlideCanvas";const Kt=["blank","titleSlide","titleContent","twoColumn","titleOnly","sectionHeader","comparison","custom"],Se=({slide:e,selectedElement:t,onSlideChange:n,onElementChange:i,onRemoveElement:o,className:r})=>{const a=se();return e?t&&e?l.jsxs("div",{className:`nice-pres-panel ${r??""}`,children:[l.jsx("h3",{className:"nice-pres-panel__title",children:a("panel.elementProperties")}),l.jsxs("div",{className:"nice-pres-panel__row",children:[l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["X (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.x*10)/10,min:0,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,x:s??0}}),className:"nice-pres-panel__input"})]}),l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["Y (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.y*10)/10,min:0,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,y:s??0}}),className:"nice-pres-panel__input"})]})]}),l.jsxs("div",{className:"nice-pres-panel__row",children:[l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["W (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.width*10)/10,min:1,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,width:s??1}}),className:"nice-pres-panel__input"})]}),l.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["H (%)",l.jsx(E.NiceNumberInput,{value:Math.round(t.position.height*10)/10,min:1,max:100,step:.5,onChange:s=>i==null?void 0:i(e.id,t.id,{position:{...t.position,height:s??1}}),className:"nice-pres-panel__input"})]})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:["Opacity",l.jsx(E.NiceSlider,{min:0,max:1,step:.05,value:t.opacity??1,onChange:s=>i==null?void 0:i(e.id,t.id,{opacity:s})})]}),t.content.kind==="text"&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"nice-pres-panel__label",children:[a("element.text"),l.jsx("textarea",{value:t.content.text,onChange:s=>i==null?void 0:i(e.id,t.id,{content:{...t.content,text:s.target.value}}),className:"nice-pres-panel__textarea",rows:4})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:["Font Size",l.jsx(E.NiceNumberInput,{value:t.content.fontSize??16,min:8,max:200,onChange:s=>i==null?void 0:i(e.id,t.id,{content:{...t.content,fontSize:s??16}}),className:"nice-pres-panel__input"})]})]}),l.jsx(E.NiceButton,{className:"nice-pres-panel__btn nice-pres-panel__btn--danger",variant:"ghost",size:"sm",onClick:()=>o==null?void 0:o(e.id,t.id),children:"Delete Element"})]}):l.jsxs("div",{className:`nice-pres-panel ${r??""}`,children:[l.jsx("h3",{className:"nice-pres-panel__title",children:a("panel.slideProperties")}),l.jsxs("label",{className:"nice-pres-panel__label",children:["Title",l.jsx(E.NiceTextInput,{value:e.title,onChange:s=>n==null?void 0:n(e.id,{title:s}),className:"nice-pres-panel__input"})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.layout"),l.jsx(E.NiceSelect,{value:e.layout,onChange:s=>n==null?void 0:n(e.id,{layout:s}),options:Kt.map(s=>({value:s,label:a(`layout.${s}`)})),className:"nice-pres-panel__select"})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.background"),l.jsx(E.NiceColorPicker,{value:e.background.color??"var(--nice-bg, #fff)",onChange:s=>n==null?void 0:n(e.id,{background:{...e.background,type:"solid",color:s}}),className:"nice-pres-panel__color"})]}),l.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.notes"),l.jsx("textarea",{value:e.notes??"",onChange:s=>n==null?void 0:n(e.id,{notes:s.target.value||void 0}),className:"nice-pres-panel__textarea",rows:4,placeholder:a("panel.notes")})]})]}):l.jsx("div",{className:`nice-pres-panel nice-pres-panel--empty ${r??""}`,children:l.jsx("p",{style:{color:"var(--nice-text-muted, #999)",fontStyle:"italic",textAlign:"center",padding:16},children:a("panel.noSelection")})})};Se.displayName="SlidePropertyPanel";const Yt=180,we=({slides:e,slideSize:t,theme:n,currentIndex:i,onSelectSlide:o,onAddSlide:r,onDuplicateSlide:a,onRemoveSlide:s,className:c})=>{const u=se(),m=Yt/t.width;return l.jsxs("div",{className:`nice-slide-thumbs ${c??""}`,style:{overflowY:"auto",padding:8},children:[e.map((p,h)=>l.jsxs("div",{className:`nice-slide-thumbs__item ${h===i?"nice-slide-thumbs__item--active":""}`,onClick:()=>o(h),style:{marginBottom:8,border:h===i?"2px solid var(--nice-primary, #2196f3)":"2px solid transparent",borderRadius:4,cursor:"pointer",position:"relative"},children:[l.jsx("div",{style:{pointerEvents:"none"},children:l.jsx(ae,{slide:p,slideSize:t,theme:n,scale:m})}),l.jsxs("div",{style:{fontSize:10,textAlign:"center",padding:"2px 0",color:"var(--nice-text-secondary, #666)"},children:[h+1,". ",p.title]}),(a||s)&&l.jsxs("div",{className:"nice-slide-thumbs__actions",style:{position:"absolute",top:2,right:2,display:"flex",gap:2},children:[a&&l.jsx(E.NiceButton,{className:"nice-slide-thumbs__action-btn",variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),a(p.id)},title:u("toolbar.duplicateSlide"),"aria-label":u("toolbar.duplicateSlide"),style:{fontSize:10,padding:"1px 4px"},children:l.jsx(E.NiceIcon,{name:"copy",size:12})}),s&&e.length>1&&l.jsx(E.NiceButton,{className:"nice-slide-thumbs__action-btn",variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),s(p.id)},title:u("toolbar.deleteSlide"),style:{fontSize:10,padding:"1px 4px",color:"var(--nice-danger-dark, #d32f2f)"},children:"×"})]})]},p.id)),r&&l.jsxs(E.NiceButton,{className:"nice-slide-thumbs__add",variant:"ghost",size:"sm",onClick:r,style:{width:"100%",padding:"8px 0",fontSize:13,color:"var(--nice-text-secondary, #888)"},children:[l.jsx(E.NiceIcon,{name:"plus",size:12})," ",u("toolbar.addSlide")]})]})};we.displayName="SlideThumbnailList";const Xt=[{target:".nice-pres-editor",titleKey:"tutorial.presentationEditor.intro.title",title:"Presentation editor",contentKey:"tutorial.presentationEditor.intro.content",content:"Build slides from the thumbnail rail, add and arrange elements on the canvas, edit them in the property panel, then present or export.",placement:"auto"}];function Gt(e){const t={x:20,y:20,width:60,height:40};switch(e){case"text":return{position:{x:10,y:30,width:80,height:20},content:{kind:"text",text:"New Text",fontSize:24,textAlign:"left"}};case"shape":return{position:{x:30,y:30,width:40,height:30},content:{kind:"shape",shapeType:"rectangle",fill:"var(--nice-info, #6366f1)",stroke:"var(--nice-accent, #4f46e5)",strokeWidth:2}};case"code":return{position:{x:10,y:20,width:80,height:50},content:{kind:"code",code:`// Your code here
101
+ console.log("Hello!");`,language:"typescript",theme:"dark"}};case"chart":return{position:t,content:{kind:"chart",chartType:"bar",data:{labels:["Q1","Q2","Q3","Q4"],series:[{name:"Revenue",values:[30,45,60,80],color:"var(--nice-info, #6366f1)"}]}}};case"table":return{position:{x:10,y:20,width:80,height:40},content:{kind:"table",headers:["Name","Value","Status"],rows:[["Item A","100","Active"],["Item B","200","Pending"]],stripedRows:!0}};case"image":return{position:t,content:{kind:"image",src:"",alt:"Image",objectFit:"contain"}};case"diagram":return{position:t,content:{kind:"diagram",autoPlayAnimations:!1}};case"icon":return{position:{x:45,y:40,width:10,height:15},content:{kind:"icon",name:"star",size:48,color:"var(--nice-info, #6366f1)"}};default:return{position:t,content:{kind:"text",text:e,fontSize:16}}}}const Ue=({initialDocument:e,onChange:t,onExport:n,onPresent:i,lang:o="en",showToolbar:r=!0,showThumbnails:a=!0,showPropertyPanel:s=!0,className:c,style:u,tutorial:m})=>{const p=We(e),[h,f]=d.useState(null),[g,y]=d.useState(!1),[v,k]=d.useState(5),b=d.useRef(p.document);p.document!==b.current&&(b.current=p.document,t==null||t(p.document));const S=p.currentSlide,_=d.useMemo(()=>h&&S?S.elements.find(x=>x.id===h)??null:null,[h,S]),R=d.useRef(null),[j,Q]=d.useState(null);d.useEffect(()=>{const x=R.current;if(!x||typeof ResizeObserver>"u")return;const T=new ResizeObserver(([O])=>{Q({w:O.contentRect.width,h:O.contentRect.height})});return T.observe(x),()=>T.disconnect()},[]);const A=d.useMemo(()=>{const{width:x,height:T}=p.document.slideSize;return!j||j.w<=0||j.h<=0?Math.min(1,800/x):Math.min(1,j.w/x,j.h/T)},[p.document.slideSize,j]),P=d.useCallback(x=>{if(!S)return;const{content:T,position:O}=Gt(x),V=p.addElement(S.id,{type:x,position:O,content:T});V&&f(V.id)},[S,p]),L=d.useCallback(x=>{p.addSlide(p.currentSlideIndex,x),p.setCurrentSlideIndex(p.currentSlideIndex+1)},[p]),H=d.useCallback(x=>{p.removeSlide(x),p.currentSlideIndex>=p.slides.length-1&&p.setCurrentSlideIndex(Math.max(0,p.slides.length-2))},[p]),X=d.useCallback((x,T,O)=>{if(!S)return;const V=S.elements.find(K=>K.id===x);V&&p.moveElement(S.id,x,{...V.position,x:T,y:O})},[S,p]),C=d.useCallback((x,T,O,V,K)=>{if(!S)return;const U=S.elements.find(G=>G.id===x);U&&p.moveElement(S.id,x,{...U.position,width:T,height:O,...V!=null?{x:V}:{},...K!=null?{y:K}:{}})},[S,p]),$=d.useCallback(()=>{if(!S||!h)return;const x=Math.max(0,...S.elements.map(T=>T.zIndex??0));p.updateElement(S.id,h,{zIndex:x+1})},[S,h,p]),I=d.useCallback(()=>{if(!S||!h)return;const x=Math.min(0,...S.elements.map(T=>T.zIndex??0));p.updateElement(S.id,h,{zIndex:x-1})},[S,h,p]),q=d.useCallback(x=>{const T=p.document;let O;switch(x){case"ndp":O=Le(T,!0);break;case"html":O=qe(T);break}n==null||n(x,O)},[p,n]),F=d.useCallback(()=>{i==null||i(p.document,p.currentSlideIndex)},[p,i]),W=r?l.jsx(ve,{onAddElement:P,onAddSlide:L,onUndo:p.undo,onRedo:p.redo,canUndo:p.canUndo,canRedo:p.canRedo,onPresent:F,onExport:q}):void 0,J=r?l.jsxs("div",{style:{display:"flex",gap:4,padding:"2px 8px",borderBottom:"1px solid var(--nice-border-color, #eee)",alignItems:"center",fontSize:"0.85em",flexWrap:"wrap"},children:[l.jsx(E.NiceButton,{size:"sm",variant:g?"primary":"ghost",onClick:()=>y(x=>!x),children:"⊞ Grid"}),_&&l.jsxs(l.Fragment,{children:[l.jsx(E.NiceButton,{size:"sm",variant:"ghost",onClick:$,title:"Bring to front",children:"↑ Front"}),l.jsx(E.NiceButton,{size:"sm",variant:"ghost",onClick:I,title:"Send to back",children:"↓ Back"}),l.jsxs(E.NiceButton,{size:"sm",variant:"ghost",onClick:()=>{if(S&&h){const x={..._,id:`el-${Date.now().toString(36)}`,position:{..._.position,x:_.position.x+3,y:_.position.y+3}};p.addElement(S.id,x)}},title:"Duplicate",children:[l.jsx(E.NiceIcon,{name:"copy",size:14})," Duplicate"]})]})]}):void 0,N=a||S?l.jsxs("div",{style:{display:"flex",minHeight:0,height:"100%"},children:[a&&l.jsx("div",{style:{width:200,flexShrink:0,borderRight:"1px solid var(--nice-border-color, #ddd)",background:"var(--nice-bg-secondary, #fafafa)",overflowY:"auto"},children:l.jsx(we,{slides:p.slides,slideSize:p.document.slideSize,theme:p.theme,currentIndex:p.currentSlideIndex,onSelectSlide:p.setCurrentSlideIndex,onAddSlide:()=>L(),onDuplicateSlide:x=>p.duplicateSlide(x),onRemoveSlide:H})}),S&&l.jsxs("div",{style:{width:180,flexShrink:0,borderRight:"1px solid var(--nice-border-color, #ddd)",background:"var(--nice-bg-secondary, #fafafa)",overflowY:"auto",fontSize:"0.85em"},"aria-label":"Slide elements",children:[l.jsxs("div",{style:{padding:"8px 10px",fontWeight:600,borderBottom:"1px solid var(--nice-border-color, #ddd)",position:"sticky",top:0,background:"var(--nice-bg-secondary, #fafafa)"},children:["Elements (",S.elements.length,")"]}),S.elements.length===0?l.jsx("div",{style:{padding:10,color:"var(--nice-text-secondary, #888)",fontStyle:"italic"},children:"No elements yet."}):l.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:S.elements.map((x,T)=>{var K;const O=x.id===h,V=x.content&&x.content.text?`“${x.content.text.slice(0,20)}”`:((K=x.content)==null?void 0:K.kind)||x.type;return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>f(x.id),style:{width:"100%",textAlign:"left",padding:"6px 10px",background:O?"var(--nice-color-primary, #6366f1)":"transparent",color:O?"var(--nice-color-white, #fff)":"inherit",border:"none",borderBottom:"1px solid var(--nice-border-color, #eee)",cursor:"pointer",display:"flex",justifyContent:"space-between",gap:6,font:"inherit"},children:[l.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[T+1,". ",V]}),l.jsx("span",{style:{opacity:.7,fontSize:"0.75em"},children:x.type})]})},x.id)})})]})]}):void 0,M=s?l.jsx("div",{style:{width:260,height:"100%",borderLeft:"1px solid var(--nice-border-color, #ddd)",overflowY:"auto",background:"var(--nice-bg-secondary, #fafafa)"},children:l.jsx(Se,{slide:S,selectedElement:_,onSlideChange:p.updateSlide,onElementChange:p.updateElement,onRemoveElement:p.removeElement})}):void 0;return l.jsx(Oe,{lang:o,children:l.jsxs("div",{className:`nice-pres-editor ${c??""}`,style:{position:"relative",height:"100%",maxWidth:"100%",overflow:"hidden",background:"var(--nice-bg-primary, #fff)",color:"var(--nice-text-primary, #111)",...u},children:[l.jsx("span",{style:{position:"absolute",top:6,right:6,zIndex:30},children:l.jsx(E.NiceTutorialButton,{steps:E.resolveTutorial(m,Xt)})}),l.jsx(E.NiceAppShell,{flush:!0,menubar:W,toolbar:J,sidebar:N,rightSidebar:M,children:l.jsx("div",{ref:R,style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"var(--nice-bg-tertiary, #e8e8e8)",overflow:"auto",padding:24,minWidth:0},children:S&&l.jsx(ae,{slide:S,slideSize:p.document.slideSize,theme:p.theme,scale:A,selectedElementId:h,onSelectElement:f,onElementDrag:X,onElementResize:C,showGrid:g,gridSnap:v,interactive:!0})})})]})})};Ue.displayName="NicePresentationEditor";const Ee={linear:e=>e,easeIn:e=>e*e,easeOut:e=>e*(2-e),easeInOut:e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*.5)*Math.exp(-6*e),bounce:e=>{if(e<1/2.75)return 7.5625*e*e;if(e<2/2.75){const n=e-.5454545454545454;return 7.5625*n*n+.75}if(e<2.5/2.75){const n=e-.8181818181818182;return 7.5625*n*n+.9375}const t=e-2.625/2.75;return 7.5625*t*t+.984375}},ye={opacity:1,transform:"",filter:"",visible:!0};function Jt(e,t,n){if(!e)return{...ye};const i=e.entrance;if(!i)return{...ye};if((e.trigger==="onClick"||e.trigger==="afterPrevious")&&!n)return{...ye,opacity:0,visible:!1};const o=i.delayMs??0,r=t-o;if(r<0)return{...ye,opacity:0,visible:!1};const a=Math.min(r/i.durationMs,1),s=(Ee[i.easing??"linear"]??Ee.linear)(a);return Zt(i.effect,s)}function Zt(e,t){const n={opacity:1,transform:"",filter:"",visible:!0};switch(e){case"fadeIn":n.opacity=t;break;case"fadeOut":n.opacity=1-t;break;case"slideInLeft":n.transform=`translateX(${-100*(1-t)}%)`,n.opacity=t;break;case"slideInRight":n.transform=`translateX(${100*(1-t)}%)`,n.opacity=t;break;case"slideInTop":n.transform=`translateY(${-100*(1-t)}%)`,n.opacity=t;break;case"slideInBottom":n.transform=`translateY(${100*(1-t)}%)`,n.opacity=t;break;case"zoomIn":n.transform=`scale(${t})`,n.opacity=t;break;case"zoomOut":n.transform=`scale(${2-t})`,n.opacity=t;break;case"bounceIn":n.transform=`scale(${t>.8?1+.1*Math.sin((t-.8)/.2*Math.PI):t})`,n.opacity=t;break;case"flipInX":n.transform=`perspective(400px) rotateX(${90*(1-t)}deg)`,n.opacity=t;break;case"flipInY":n.transform=`perspective(400px) rotateY(${90*(1-t)}deg)`,n.opacity=t;break;case"rotateIn":n.transform=`rotate(${-180*(1-t)}deg) scale(${t})`,n.opacity=t;break;case"typewriter":n.opacity=t>0?1:0;break;case"wipeLeft":n.transform=`scaleX(${t})`,n.opacity=1;break;case"wipeRight":n.transform=`scaleX(${t})`,n.opacity=1;break;case"splitReveal":n.transform=`scaleY(${t})`,n.opacity=1;break;case"pulse":n.transform=`scale(${1+.05*Math.sin(t*Math.PI*4)})`;break;case"shake":n.transform=`translateX(${5*Math.sin(t*Math.PI*8)*(1-t)}px)`;break;case"glow":n.filter=`drop-shadow(0 0 ${8*t}px gold)`;break}return n}function He(e,t,n="left"){const i={},o={};switch(e){case"fade":i.opacity=1-t,o.opacity=t;break;case"slide":{const r=n==="right"||n==="down"?-1:1,a=n==="up"||n==="down"?"Y":"X";i.transform=`translate${a}(${-r*t*100}%)`,o.transform=`translate${a}(${r*(1-t)*100}%)`;break}case"zoom":i.transform=`scale(${1-t*.3})`,i.opacity=1-t,o.transform=`scale(${.7+t*.3})`,o.opacity=t;break;case"flip":i.transform=`perspective(1000px) rotateY(${t*90}deg)`,i.opacity=t>.5?0:1,o.transform=`perspective(1000px) rotateY(${(1-t)*-90}deg)`,o.opacity=t>.5?1:0;break;default:i.opacity=1-t,o.opacity=t;break}return{outgoing:i,incoming:o}}const en={width:1920,height:1080},tn={width:1024,height:768},nn={width:2560,height:1440},Ve={name:"Corporate",backgroundColor:"#fff",primaryColor:"#1a365d",secondaryColor:"#2b6cb0",accentColor:"#ed8936",textColor:"#2d3748",headingColor:"#1a365d",fontFamily:'"Segoe UI", Roboto, sans-serif',headingFontFamily:'"Segoe UI", Roboto, sans-serif',codeFontFamily:'"Cascadia Code", "Fira Code", monospace'},on={name:"Modern Dark",backgroundColor:"#1a1a2e",primaryColor:"#e94560",secondaryColor:"#0f3460",accentColor:"#16213e",textColor:"#e0e0e0",headingColor:"#fff",fontFamily:"Inter, sans-serif",headingFontFamily:"Inter, sans-serif",codeFontFamily:'"JetBrains Mono", monospace'},rn={name:"Minimal",backgroundColor:"#fafafa",primaryColor:"#333333",secondaryColor:"#666666",accentColor:"#2196f3",textColor:"#333333",headingColor:"#111111",fontFamily:'"Helvetica Neue", Arial, sans-serif',codeFontFamily:'"SF Mono", monospace'},an={name:"NiceToDev",backgroundColor:"#f8f9fa",primaryColor:"#6366f1",secondaryColor:"#8b5cf6",accentColor:"#06b6d4",textColor:"#334155",headingColor:"#1e293b",fontFamily:"Inter, sans-serif",headingFontFamily:'"Plus Jakarta Sans", Inter, sans-serif',codeFontFamily:'"Fira Code", monospace'},sn=500,Qe=({document:e,startSlide:t=0,onExit:n,autoAdvanceMs:i=0,showNotes:o=!1,showSlideNumber:r=!0,showProgressBar:a=!0,showTimer:s=!1,enableTouch:c=!0,autoFullscreen:u=!1,className:m})=>{const[p,h]=d.useState(t),[f,g]=d.useState(0),[y,v]=d.useState(!1),[k,b]=d.useState(0),[S,_]=d.useState(null),[R,j]=d.useState(!1),[Q,A]=d.useState(0),P=d.useRef(null),L=d.useRef(0),H=d.useRef(null),X=d.useRef(null),C=e.slides,$=C[p]??null,I=S!==null?C[S]??null:null,q=e.theme??Ve,F=e.slideSize,W=C.length,J=d.useMemo(()=>{if(!$)return 0;const z=$.elements.filter(D=>{var Y;return(Y=D.animation)==null?void 0:Y.entrance}).map(D=>{var Y;return((Y=D.animation)==null?void 0:Y.buildOrder)??0});return z.length>0?Math.max(...z)+1:0},[$]),N=d.useCallback(z=>{var ce,le;if(z<0||z>=W||z===p||y)return;const D=C[z];if((((ce=D==null?void 0:D.transition)==null?void 0:ce.effect)??"none")==="none"){_(null),h(z),g(0);return}_(p),h(z),g(0),v(!0);const B=((le=D==null?void 0:D.transition)==null?void 0:le.durationMs)??sn,ee=performance.now(),ie=he=>{const _e=Math.min(1,(he-ee)/B);b(_e),_e<1?L.current=requestAnimationFrame(ie):(v(!1),_(null))};L.current=requestAnimationFrame(ie)},[p,W,y,C]),M=d.useCallback(()=>{if(f<J){g(z=>z+1);return}p<W-1&&N(p+1)},[f,J,p,W,N]),x=d.useCallback(()=>{if(f>0){g(z=>z-1);return}p>0&&N(p-1)},[f,p,N]);d.useEffect(()=>{const z=D=>{switch(D.key){case"ArrowRight":case"ArrowDown":case" ":case"Enter":D.preventDefault(),M();break;case"ArrowLeft":case"ArrowUp":case"Backspace":D.preventDefault(),x();break;case"Escape":D.preventDefault(),n==null||n();break;case"Home":D.preventDefault(),N(0);break;case"End":D.preventDefault(),N(W-1);break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[M,x,n,N,W]);const T=d.useCallback(z=>{if(!c)return;const D=z.touches[0];H.current={x:D.clientX,y:D.clientY,time:Date.now()}},[c]),O=d.useCallback(z=>{if(!c||!H.current)return;const D=z.changedTouches[0],Y=D.clientX-H.current.x,B=D.clientY-H.current.y,ee=Date.now()-H.current.time;if(H.current=null,ee>500||Math.abs(Y)<30&&Math.abs(B)<30){M();return}Math.abs(Y)>Math.abs(B)&&(Y<-30?M():Y>30&&x())},[c,M,x]);d.useEffect(()=>{if(s)return X.current=setInterval(()=>A(z=>z+1e3),1e3),()=>{X.current&&clearInterval(X.current)}},[s]);const V=z=>{const D=Math.floor(z/1e3),Y=Math.floor(D/60),B=Math.floor(Y/60);return B>0?`${B}:${String(Y%60).padStart(2,"0")}:${String(D%60).padStart(2,"0")}`:`${Y}:${String(D%60).padStart(2,"0")}`};d.useEffect(()=>{const z=D=>{(D.key==="g"||D.key==="G")&&j(Y=>!Y)};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[]),d.useEffect(()=>{if(i<=0||y)return;const z=setTimeout(M,i);return()=>clearTimeout(z)},[i,M,y,p,f]),d.useEffect(()=>{var D;const z=P.current;return u&&z&&!window.document.fullscreenElement&&((D=z.requestFullscreen)==null||D.call(z).catch(()=>{})),()=>{var Y,B;u&&window.document.fullscreenElement&&((B=(Y=window.document).exitFullscreen)==null||B.call(Y).catch(()=>{})),L.current&&cancelAnimationFrame(L.current)}},[]);const K=d.useMemo(()=>$?$.elements.filter(z=>{var Y;return(Y=z.animation)!=null&&Y.entrance?(z.animation.buildOrder??0)<=f:!0}):[],[$,f]),U=d.useMemo(()=>{if(!y||!$)return{outgoing:{},incoming:{}};const z=$.transition??{effect:"fade"};return He(z.effect,k,z.direction)},[y,$,k]),[G,ne]=d.useState(1),[Z,te]=d.useState(!1);d.useEffect(()=>{const z=()=>{const Y=F.width,B=F.height,ee=!!window.document.fullscreenElement;te(ee);const ie=P.current;let ce,le;if(ee||u)ce=window.innerWidth,le=window.innerHeight;else if(ie){const he=ie.getBoundingClientRect();ce=he.width||Y,le=he.height||B}else ce=Y,le=B;ne(Math.min(ce/Y,le/B))};z();const D=typeof ResizeObserver<"u"&&P.current?new ResizeObserver(z):null;return D&&P.current&&D.observe(P.current),window.addEventListener("resize",z),window.document.addEventListener("fullscreenchange",z),()=>{window.removeEventListener("resize",z),window.document.removeEventListener("fullscreenchange",z),D==null||D.disconnect()}},[F,u]);const ue=d.useCallback(()=>{var D,Y,B;const z=P.current;z&&(window.document.fullscreenElement?(Y=(D=window.document).exitFullscreen)==null||Y.call(D).catch(()=>{}):(B=z.requestFullscreen)==null||B.call(z).catch(()=>{}))},[]),me=u||Z;return l.jsxs("div",{ref:P,className:`nice-pres-player ${m??""}`,style:me?{position:"fixed",inset:0,background:"#000",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",cursor:"none",zIndex:9999}:{position:"relative",width:"100%",height:"100%",minHeight:240,background:"#000",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},onClick:M,onContextMenu:z=>{z.preventDefault(),x()},onTouchStart:T,onTouchEnd:O,children:[R&&l.jsx("div",{style:{position:"absolute",inset:0,zIndex:100,background:"var(--nice-overlay-90, rgba(0, 0, 0, 0.9))",overflowY:"auto",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))",gap:16,padding:24,alignContent:"start"},onClick:z=>z.stopPropagation(),children:C.map((z,D)=>l.jsxs("div",{style:{cursor:"pointer",border:D===p?"3px solid var(--nice-primary, #2196f3)":"2px solid transparent",borderRadius:4,overflow:"hidden"},onClick:()=>{N(D),j(!1)},children:[l.jsx(ae,{slide:z,slideSize:F,theme:q,scale:240/F.width,interactive:!1}),l.jsxs("div",{style:{color:"var(--nice-text-primary, #fff)",fontSize:12,textAlign:"center",padding:4},children:[D+1,". ",z.title]})]},z.id))}),y&&I&&l.jsx("div",{style:{position:"absolute",...U.outgoing},children:l.jsx(ae,{slide:I,slideSize:F,theme:q,scale:G,interactive:!1})}),$&&l.jsx("div",{style:{position:"absolute",...y?U.incoming:{}},children:l.jsx(ae,{slide:{...$,elements:K},slideSize:F,theme:q,scale:G,interactive:!1})}),r&&l.jsxs("div",{style:{position:"absolute",bottom:12,right:20,color:"var(--nice-overlay-light-50, rgba(255, 255, 255, 0.5))",fontSize:14,fontFamily:"sans-serif",pointerEvents:"none"},children:[p+1," / ",W]}),o&&($==null?void 0:$.notes)&&l.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"var(--nice-overlay-80, rgba(0, 0, 0, 0.8))",color:"var(--nice-color-white, #fff)",padding:"12px 24px",fontSize:14,fontFamily:"sans-serif",maxHeight:"20vh",overflowY:"auto",pointerEvents:"none"},children:$.notes}),a&&l.jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:3,background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",pointerEvents:"none",zIndex:50},children:l.jsx("div",{style:{height:"100%",width:`${(p+1)/W*100}%`,background:"var(--nice-primary, #2196f3)",transition:"width 0.3s ease"}})}),s&&l.jsx("div",{style:{position:"absolute",top:12,right:20,color:"var(--nice-overlay-light-50, rgba(255, 255, 255, 0.5))",fontSize:14,fontFamily:"monospace",pointerEvents:"none",zIndex:50},children:V(Q)}),l.jsxs("div",{className:"nice-pres-player-controls",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,opacity:.3},onMouseEnter:z=>{z.currentTarget.style.opacity="0.9",z.currentTarget.style.cursor="pointer"},onMouseLeave:z=>{z.currentTarget.style.opacity="0.3"},children:[l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),x()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-color-white, #fff)",padding:"6px 14px",borderRadius:4,fontSize:16},title:"Previous","aria-label":"Previous",children:l.jsx(E.NiceIcon,{name:"chevron-left",size:16})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),M()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-color-white, #fff)",padding:"6px 14px",borderRadius:4,fontSize:16},title:"Next","aria-label":"Next",children:l.jsx(E.NiceIcon,{name:"chevron-right",size:16})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),n==null||n()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-color-white, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:"Exit (Esc)","aria-label":"Exit",children:l.jsx(E.NiceIcon,{name:"close",size:14})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),j(D=>!D)},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-color-white, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:"Overview (G)","aria-label":"Overview",children:l.jsx(E.NiceIcon,{name:"grid",size:14})}),l.jsx(E.NiceButton,{variant:"ghost",size:"sm",onClick:z=>{z.stopPropagation(),ue()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-color-white, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:Z?"Exit fullscreen":"Fullscreen","aria-label":Z?"Exit fullscreen":"Fullscreen",children:l.jsx(E.NiceIcon,{name:Z?"collapse":"expand",size:14})})]})]})};Qe.displayName="NicePresentationPlayer";const cn="_interactiveElement_19xs5_13",ln="_interactiveButton_19xs5_27",dn="_disabled_19xs5_57",un="_variant_primary_19xs5_87",pn="_variant_secondary_19xs5_101",fn="_variant_outline_19xs5_111",mn="_variant_ghost_19xs5_123",hn="_size_small_19xs5_143",yn="_size_medium_19xs5_153",gn="_size_large_19xs5_163",xn="_buttonIcon_19xs5_173",bn="_buttonLabel_19xs5_181",vn="_interactivePoll_19xs5_193",Sn="_pollQuestion_19xs5_213",wn="_pollOptions_19xs5_227",kn="_pollOption_19xs5_227",In="_pollOptionDisabled_19xs5_265",Cn="_pollOptionSelected_19xs5_275",Mn="_pollOptionContent_19xs5_293",zn="_pollOptionIcon_19xs5_309",An="_pollOptionText_19xs5_317",$n="_pollCheckbox_19xs5_325",_n="_pollResultBar_19xs5_335",Tn="_pollResultFill_19xs5_357",En="_pollResultPercent_19xs5_369",Nn="_pollResultCount_19xs5_385",Rn="_pollSubmitBtn_19xs5_399",Pn="_pollTotalVotes_19xs5_435",qn="_pollVotedMessage_19xs5_447",Dn="_interactiveQuiz_19xs5_489",jn="_quizHeader_19xs5_509",On="_quizQuestion_19xs5_523",Fn="_quizTimer_19xs5_541",Ln="_quizTimerWarning_19xs5_559",Wn="_timerPulse_19xs5_1",Bn="_quizPoints_19xs5_591",Un="_quizAnswers_19xs5_609",Hn="_quizAnswer_19xs5_609",Vn="_quizAnswerDisabled_19xs5_647",Qn="_quizAnswerSelected_19xs5_657",Kn="_quizAnswerCorrect_19xs5_675",Yn="_quizAnswerIncorrect_19xs5_685",Xn="_quizAnswerMarker_19xs5_695",Gn="_quizAnswerText_19xs5_705",Jn="_quizCorrectMark_19xs5_717",Zn="_quizIncorrectMark_19xs5_729",ei="_quizSubmitBtn_19xs5_741",ti="_quizFeedback_19xs5_789",ni="_quizFeedbackMessage_19xs5_797",ii="_quizFeedbackCorrect_19xs5_811",oi="_quizFeedbackIncorrect_19xs5_821",ri="_quizExplanation_19xs5_831",ai="_interactiveCountdown_19xs5_855",si="_countdownWarning_19xs5_871",ci="_countdownPulse_19xs5_1",li="_countdownComplete_19xs5_899",di="_countdownDigital_19xs5_909",ui="_countdownSeparator_19xs5_927",pi="_countdownDigit_19xs5_909",fi="_countdownCircular_19xs5_947",mi="_countdownCircleSvg_19xs5_959",hi="_countdownProgressRing_19xs5_971",yi="_countdownCircleText_19xs5_979",gi="_countdownLargeSeconds_19xs5_999",xi="_countdownFlip_19xs5_1009",bi="_flipCardContainer_19xs5_1021",vi="_flipCard_19xs5_1021",Si="_flipLabel_19xs5_1065",wi="_flipSeparator_19xs5_1079",ki="_countdownMinimal_19xs5_1095",Ii="_countdownCompleteMessage_19xs5_1107",Ci="_interactiveQnA_19xs5_1125",Mi="_qnaHeader_19xs5_1149",zi="_qnaTitle_19xs5_1165",Ai="_qnaCount_19xs5_1179",$i="_qnaInputForm_19xs5_1189",_i="_qnaInputWrapper_19xs5_1201",Ti="_qnaInput_19xs5_1189",Ei="_qnaCharCount_19xs5_1251",Ni="_qnaInputActions_19xs5_1267",Ri="_qnaAnonymousToggle_19xs5_1281",Pi="_qnaSubmitBtn_19xs5_1311",qi="_qnaClosedMessage_19xs5_1353",Di="_qnaQuestionsList_19xs5_1371",ji="_qnaQuestion_19xs5_1371",Oi="_qnaQuestionAnswered_19xs5_1413",Fi="_qnaQuestionContent_19xs5_1423",Li="_qnaQuestionText_19xs5_1437",Wi="_qnaQuestionMeta_19xs5_1449",Bi="_qnaAuthor_19xs5_1463",Ui="_qnaQuestionActions_19xs5_1471",Hi="_qnaUpvoteBtn_19xs5_1485",Vi="_qnaUpvoted_19xs5_1521",Qi="_qnaUpvoteIcon_19xs5_1541",Ki="_qnaUpvoteCount_19xs5_1549",Yi="_qnaAnsweredBtn_19xs5_1559",Xi="_qnaMarkedAnswered_19xs5_1587",Gi="_qnaEmptyState_19xs5_1599",Ji="_qnaMoreQuestions_19xs5_1613",Zi="_qnaStyle_stack_19xs5_1631",eo="_qnaStyle_floating_19xs5_1641",w={interactiveElement:cn,interactiveButton:ln,disabled:dn,variant_primary:un,variant_secondary:pn,variant_outline:fn,variant_ghost:mn,size_small:hn,size_medium:yn,size_large:gn,buttonIcon:xn,buttonLabel:bn,interactivePoll:vn,pollQuestion:Sn,pollOptions:wn,pollOption:kn,pollOptionDisabled:In,pollOptionSelected:Cn,pollOptionContent:Mn,pollOptionIcon:zn,pollOptionText:An,pollCheckbox:$n,pollResultBar:_n,pollResultFill:Tn,pollResultPercent:En,pollResultCount:Nn,pollSubmitBtn:Rn,pollTotalVotes:Pn,pollVotedMessage:qn,"pollStyle_horizontal-bar":"_pollStyle_horizontal-bar_19xs5_467",interactiveQuiz:Dn,quizHeader:jn,quizQuestion:On,quizTimer:Fn,quizTimerWarning:Ln,timerPulse:Wn,quizPoints:Bn,quizAnswers:Un,quizAnswer:Hn,quizAnswerDisabled:Vn,quizAnswerSelected:Qn,quizAnswerCorrect:Kn,quizAnswerIncorrect:Yn,quizAnswerMarker:Xn,quizAnswerText:Gn,quizCorrectMark:Jn,quizIncorrectMark:Zn,quizSubmitBtn:ei,quizFeedback:ti,quizFeedbackMessage:ni,quizFeedbackCorrect:ii,quizFeedbackIncorrect:oi,quizExplanation:ri,interactiveCountdown:ai,countdownWarning:si,countdownPulse:ci,countdownComplete:li,countdownDigital:di,countdownSeparator:ui,countdownDigit:pi,countdownCircular:fi,countdownCircleSvg:mi,countdownProgressRing:hi,countdownCircleText:yi,countdownLargeSeconds:gi,countdownFlip:xi,flipCardContainer:bi,flipCard:vi,flipLabel:Si,flipSeparator:wi,countdownMinimal:ki,countdownCompleteMessage:Ii,interactiveQnA:Ci,qnaHeader:Mi,qnaTitle:zi,qnaCount:Ai,qnaInputForm:$i,qnaInputWrapper:_i,qnaInput:Ti,qnaCharCount:Ei,qnaInputActions:Ni,qnaAnonymousToggle:Ri,qnaSubmitBtn:Pi,qnaClosedMessage:qi,qnaQuestionsList:Di,qnaQuestion:ji,qnaQuestionAnswered:Oi,qnaQuestionContent:Fi,qnaQuestionText:Li,qnaQuestionMeta:Wi,qnaAuthor:Bi,qnaQuestionActions:Ui,qnaUpvoteBtn:Hi,qnaUpvoted:Vi,qnaUpvoteIcon:Qi,qnaUpvoteCount:Ki,qnaAnsweredBtn:Yi,qnaMarkedAnswered:Xi,qnaEmptyState:Gi,qnaMoreQuestions:Ji,qnaStyle_stack:Zi,qnaStyle_floating:eo},to=({content:e,onAction:t,disabled:n=!1,className:i,theme:o})=>{const{label:r,action:a,variant:s="primary",size:c="medium",icon:u,iconPosition:m="left",backgroundColor:p,textColor:h,borderRadius:f}=e,g=d.useCallback(()=>{if(!n){if(a.type==="openUrl"){const{url:b,newTab:S=!0}=a;S?window.open(b,"_blank","noopener,noreferrer"):window.location.href=b}t==null||t(a)}},[a,n,t]),y={backgroundColor:p??(s==="primary"?o==null?void 0:o.primaryColor:void 0),color:h,borderRadius:f!==void 0?`${f}px`:void 0,fontFamily:o==null?void 0:o.fontFamily},v=[w.interactiveButton,w[`variant_${s}`],w[`size_${c}`],n?w.disabled:"",i??""].filter(Boolean).join(" "),k=()=>u?l.jsx("span",{className:w.buttonIcon,children:l.jsx(E.NiceIcon,{name:no(u),size:16})}):null;return l.jsxs("button",{className:v,style:y,onClick:g,disabled:n,type:"button",children:[m==="left"&&k(),l.jsx("span",{className:w.buttonLabel,children:r}),m==="right"&&k()]})};function no(e){return{external:"external-link",share:"external-link",question:"help",heart:"heart",delete:"trash"}[e]??e}const io=({content:e,onVote:t,onResultsUpdate:n,votingClosed:i=!1,userVote:o,className:r,theme:a})=>{const s=se(),{question:c,options:u,multiSelect:m=!1,showResultsAfterVote:p=!0,liveResults:h=!1,displayStyle:f="buttons",resultColors:g,results:y={}}=e,[v,k]=d.useState(o??[]),[b,S]=d.useState(!!(o!=null&&o.length)),[_,R]=d.useState(y),j=d.useMemo(()=>Object.values(_).reduce((C,$)=>C+$,0),[_]),Q=[(a==null?void 0:a.primaryColor)??"var(--nice-info, #6366f1)","var(--nice-accent, #8b5cf6)","var(--nice-info, #06b6d4)","var(--nice-success, #10b981)","var(--nice-warning, #f59e0b)","var(--nice-danger, #ef4444)"],A=g??Q,P=d.useCallback(C=>{b||i||k($=>m?$.includes(C)?$.filter(I=>I!==C):[...$,C]:[C])},[b,i,m]),L=d.useCallback(()=>{if(v.length===0||b)return;const C={..._};v.forEach($=>{C[$]=(C[$]??0)+1}),R(C),S(!0),t==null||t(v),n==null||n(C)},[v,b,_,t,n]),H=h||p&&b,X=(C,$)=>{const I=v.includes(C.id),q=_[C.id]??0,F=j>0?q/j*100:0,W=C.color??A[$%A.length],J=[w.pollOption,w[`pollStyle_${f}`],I?w.pollOptionSelected:"",b||i?w.pollOptionDisabled:""].filter(Boolean).join(" ");return l.jsxs("button",{className:J,onClick:()=>P(C.id),disabled:b||i,type:"button",style:{"--poll-option-color":W,fontFamily:a==null?void 0:a.fontFamily},children:[l.jsxs("div",{className:w.pollOptionContent,children:[C.icon&&l.jsx("span",{className:w.pollOptionIcon,children:l.jsx(E.NiceIcon,{name:C.icon,size:16})}),l.jsx("span",{className:w.pollOptionText,children:C.text}),m&&!b&&l.jsx("span",{className:w.pollCheckbox,children:l.jsx(E.NiceIcon,{name:I?"check-square":"square",size:16})})]}),H&&l.jsxs("div",{className:w.pollResultBar,children:[l.jsx("div",{className:w.pollResultFill,style:{width:`${F}%`,backgroundColor:W}}),l.jsxs("span",{className:w.pollResultPercent,children:[F.toFixed(0),"%"]}),l.jsxs("span",{className:w.pollResultCount,children:["(",q,")"]})]})]},C.id)};return l.jsxs("div",{className:`${w.interactivePoll} ${r??""}`,children:[l.jsx("h3",{className:w.pollQuestion,style:{fontFamily:a==null?void 0:a.fontFamily},children:c}),l.jsx("div",{className:w.pollOptions,children:u.map((C,$)=>X(C,$))}),!b&&!i&&v.length>0&&l.jsx("button",{className:w.pollSubmitBtn,onClick:L,style:{backgroundColor:a==null?void 0:a.primaryColor,fontFamily:a==null?void 0:a.fontFamily},children:s("interactive.poll.vote","Submit vote")}),H&&j>0&&l.jsxs("div",{className:w.pollTotalVotes,children:[s("interactive.poll.totalVotes","Total votes:")," ",j]}),b&&l.jsxs("div",{className:w.pollVotedMessage,children:[l.jsx(E.NiceIcon,{name:"check",size:14})," ",s("interactive.poll.thanks","Thanks for your vote!")]})]})},oo=({content:e,onSubmit:t,locked:n=!1,className:i,theme:o})=>{const r=se(),{question:a,answers:s,quizType:c="single",showCorrectAfterSubmit:u=!0,timeLimitSeconds:m=0,points:p=10,correctFeedback:h,incorrectFeedback:f,explanation:g}=e,y=h??r("interactive.quiz.correctFeedback","Correct answer!"),v=f??r("interactive.quiz.incorrectFeedback","Sorry, that is not the correct answer."),k=r("interactive.quiz.points","pts"),[b,S]=d.useState([]),[_,R]=d.useState(!1),[j,Q]=d.useState(!1),[A,P]=d.useState(m),L=d.useRef(null);d.useEffect(()=>{if(m>0&&!_&&!n)return P(m),L.current=setInterval(()=>{P(I=>I<=1?(clearInterval(L.current),0):I-1)},1e3),()=>{L.current&&clearInterval(L.current)}},[m,_,n]),d.useEffect(()=>{A===0&&m>0&&!_&&X()},[A,m,_]);const H=d.useCallback(I=>{_||n||S(q=>c==="single"||c==="true-false"?[I]:q.includes(I)?q.filter(F=>F!==I):[...q,I])},[_,n,c]),X=d.useCallback(()=>{if(_||b.length===0)return;L.current&&clearInterval(L.current);const I=s.filter(N=>N.isCorrect).map(N=>N.id),q=new Set(b),F=new Set(I),W=q.size===F.size&&[...q].every(N=>F.has(N));Q(W),R(!0);const J=W?p:0;t==null||t(b,W,J)},[_,b,s,p,t]),C=I=>{const q=Math.floor(I/60),F=I%60;return q>0?`${q}:${F.toString().padStart(2,"0")}`:`${F}s`},$=I=>{const q=b.includes(I.id),F=_&&u,W=[w.quizAnswer,q?w.quizAnswerSelected:"",_?w.quizAnswerDisabled:"",F&&I.isCorrect?w.quizAnswerCorrect:"",F&&q&&!I.isCorrect?w.quizAnswerIncorrect:""].filter(Boolean).join(" ");return l.jsxs("button",{className:W,onClick:()=>H(I.id),disabled:_||n,type:"button",style:{fontFamily:o==null?void 0:o.fontFamily},children:[l.jsxs("span",{className:w.quizAnswerMarker,children:[c==="multiple"&&l.jsx(E.NiceIcon,{name:q?"check-square":"square",size:16}),(c==="single"||c==="true-false")&&l.jsx(E.NiceIcon,{name:q?"check":"circle",size:16})]}),l.jsx("span",{className:w.quizAnswerText,children:I.text}),F&&I.isCorrect&&l.jsx("span",{className:w.quizCorrectMark,children:l.jsx(E.NiceIcon,{name:"check",size:14})}),F&&q&&!I.isCorrect&&l.jsx("span",{className:w.quizIncorrectMark,children:l.jsx(E.NiceIcon,{name:"close",size:14})})]},I.id)};return l.jsxs("div",{className:`${w.interactiveQuiz} ${i??""}`,children:[l.jsxs("div",{className:w.quizHeader,children:[l.jsx("h3",{className:w.quizQuestion,style:{fontFamily:o==null?void 0:o.fontFamily},children:a}),m>0&&!_&&l.jsxs("div",{className:`${w.quizTimer} ${A<=10?w.quizTimerWarning:""}`,children:[l.jsx(E.NiceIcon,{name:"clock",size:14})," ",C(A)]}),p>0&&l.jsx("div",{className:w.quizPoints,children:_?j?`+${p} ${k}`:`0 ${k}`:`${p} ${k}`})]}),l.jsx("div",{className:w.quizAnswers,children:s.map($)}),!_&&!n&&b.length>0&&l.jsx("button",{className:w.quizSubmitBtn,onClick:X,style:{backgroundColor:o==null?void 0:o.primaryColor,fontFamily:o==null?void 0:o.fontFamily},children:r("interactive.quiz.submit","Submit answer")}),_&&u&&l.jsxs("div",{className:w.quizFeedback,children:[l.jsx("div",{className:`${w.quizFeedbackMessage} ${j?w.quizFeedbackCorrect:w.quizFeedbackIncorrect}`,children:j?y:v}),g&&l.jsxs("div",{className:w.quizExplanation,children:[l.jsx("strong",{children:r("interactive.quiz.explanation","Explanation:")})," ",g]})]})]})},ro=({content:e,onComplete:t,paused:n=!1,className:i,theme:o})=>{const{target:r,format:a="mm:ss",style:s="digital",showLabels:c=!0,onComplete:u,textColor:m,backgroundColor:p,warningThreshold:h=10,warningColor:f="var(--nice-danger, #ef4444)"}=e,[g,y]=d.useState(()=>{if(typeof r=="number")return r;const I=new Date(r),q=new Date;return Math.max(0,Math.floor((I.getTime()-q.getTime())/1e3))}),[v,k]=d.useState(!1),S=se()("countdown.timeUp"),_=S==="countdown.timeUp"?"Time's up!":S,R=d.useRef(null);d.useEffect(()=>{if(n||v){R.current&&(clearInterval(R.current),R.current=null);return}return R.current=setInterval(()=>{y(I=>I<=1?(clearInterval(R.current),k(!0),0):I-1)},1e3),()=>{R.current&&clearInterval(R.current)}},[n,v]),d.useEffect(()=>{v&&(t==null||t(u))},[v,t,u]);const j=d.useMemo(()=>{const I=Math.floor(g/3600),q=Math.floor(g%3600/60),F=g%60;return{hours:I,minutes:q,seconds:F}},[g]),Q=g<=h&&g>0,A=(I,q=2)=>I.toString().padStart(q,"0"),P=()=>{const{hours:I,minutes:q,seconds:F}=j;let W=[];return a==="hh:mm:ss"||I>0?W=[A(I),A(q),A(F)]:a==="mm:ss"?W=[A(q),A(F)]:W=[F.toString()],l.jsx("div",{className:w.countdownDigital,children:W.map((J,N)=>l.jsxs(d.Fragment,{children:[N>0&&l.jsx("span",{className:w.countdownSeparator,children:":"}),l.jsx("span",{className:w.countdownDigit,children:J})]},N))})},L=()=>{const{hours:I,minutes:q,seconds:F}=j,W=typeof r=="number"?r:g,J=W>0?g/W:0,N=2*Math.PI*45;return l.jsxs("div",{className:w.countdownCircular,children:[l.jsxs("svg",{viewBox:"0 0 100 100",className:w.countdownCircleSvg,children:[l.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"currentColor",strokeWidth:"8",opacity:"0.2"}),l.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:Q?f:m??(o==null?void 0:o.primaryColor)??"var(--nice-info, #6366f1)",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:N,strokeDashoffset:N*(1-J),transform:"rotate(-90 50 50)",className:w.countdownProgressRing})]}),l.jsx("div",{className:w.countdownCircleText,children:a!=="ss"?l.jsxs(l.Fragment,{children:[I>0&&l.jsxs("span",{children:[A(I),":"]}),l.jsxs("span",{children:[A(q),":"]}),l.jsx("span",{children:A(F)})]}):l.jsx("span",{className:w.countdownLargeSeconds,children:F})})]})},H=()=>{const{hours:I,minutes:q,seconds:F}=j,W=(J,N)=>l.jsxs("div",{className:w.flipCardContainer,children:[l.jsx("div",{className:w.flipCard,children:l.jsx("span",{children:J})}),c&&l.jsx("span",{className:w.flipLabel,children:N})]});return l.jsxs("div",{className:w.countdownFlip,children:[(a==="hh:mm:ss"||I>0)&&l.jsxs(l.Fragment,{children:[W(A(I),"godz."),l.jsx("span",{className:w.flipSeparator,children:":"})]}),a!=="ss"&&l.jsxs(l.Fragment,{children:[W(A(q),"min."),l.jsx("span",{className:w.flipSeparator,children:":"})]}),W(A(F),"sek.")]})},X=()=>{const{hours:I,minutes:q,seconds:F}=j;if(a==="ss")return l.jsxs("span",{className:w.countdownMinimal,children:[F,"s"]});let W="";return I>0&&(W+=`${I}h `),(q>0||I>0)&&(W+=`${q}m `),W+=`${F}s`,l.jsx("span",{className:w.countdownMinimal,children:W.trim()})},C={color:Q?f:m,backgroundColor:p,fontFamily:o==null?void 0:o.fontFamily},$=[w.interactiveCountdown,w[`countdownStyle_${s}`],Q?w.countdownWarning:"",v?w.countdownComplete:"",i??""].filter(Boolean).join(" ");return l.jsxs("div",{className:$,style:C,children:[s==="digital"&&P(),s==="circular"&&L(),s==="flip"&&H(),s==="minimal"&&X(),v&&l.jsxs("div",{className:w.countdownCompleteMessage,children:[l.jsx(E.NiceIcon,{name:"clock",size:18})," ",_]})]})},ao=({content:e,userName:t,onSubmitQuestion:n,onUpvote:i,onMarkAnswered:o,submissionClosed:r=!1,isModerator:a=!1,upvotedQuestions:s=[],className:c,theme:u})=>{const m=se(),p=Fe(),{placeholder:h,allowAnonymous:f=!0,moderated:g=!1,allowUpvote:y=!0,maxVisible:v=10,displayStyle:k="list",charLimit:b=500,questions:S=[]}=e,_=h??m("interactive.qna.placeholder","Ask a question..."),[R,j]=d.useState(S),[Q,A]=d.useState(""),[P,L]=d.useState(!1),[H,X]=d.useState(new Set(s)),C=d.useMemo(()=>[...R].filter(N=>!g||N.answered||a).sort((N,M)=>M.upvotes!==N.upvotes?M.upvotes-N.upvotes:new Date(M.timestamp).getTime()-new Date(N.timestamp).getTime()).slice(0,v),[R,g,a,v]),$=d.useCallback(N=>{N.preventDefault();const M=Q.trim();if(!M||r)return;const x={id:`q_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,text:M,author:P||!t?void 0:t,timestamp:new Date().toISOString(),upvotes:0,answered:!1};j(T=>[x,...T]),A(""),n==null||n({text:x.text,author:x.author,answered:!1})},[Q,r,P,t,n]),I=d.useCallback(N=>{!y||H.has(N)||(j(M=>M.map(x=>x.id===N?{...x,upvotes:x.upvotes+1}:x)),X(M=>new Set(M).add(N)),i==null||i(N))},[y,H,i]),q=d.useCallback(N=>{a&&(j(M=>M.map(x=>x.id===N?{...x,answered:!x.answered}:x)),o==null||o(N))},[a,o]),F=()=>l.jsxs("form",{className:w.qnaInputForm,onSubmit:$,children:[l.jsxs("div",{className:w.qnaInputWrapper,children:[l.jsx("textarea",{className:w.qnaInput,placeholder:_,value:Q,onChange:N=>A(N.target.value.slice(0,b)),disabled:r,rows:2,style:{fontFamily:u==null?void 0:u.fontFamily}}),l.jsxs("span",{className:w.qnaCharCount,children:[Q.length,"/",b]})]}),l.jsxs("div",{className:w.qnaInputActions,children:[f&&l.jsxs("label",{className:w.qnaAnonymousToggle,children:[l.jsx("input",{type:"checkbox",checked:P,onChange:N=>L(N.target.checked)}),l.jsx("span",{children:m("interactive.qna.anonymously","Anonymously")})]}),l.jsx("button",{type:"submit",className:w.qnaSubmitBtn,disabled:!Q.trim()||r,style:{backgroundColor:u==null?void 0:u.primaryColor,fontFamily:u==null?void 0:u.fontFamily},children:m("interactive.qna.submit","Submit question")})]})]}),W=N=>{const M=H.has(N.id);return l.jsxs("div",{className:`${w.qnaQuestion} ${N.answered?w.qnaQuestionAnswered:""}`,children:[l.jsxs("div",{className:w.qnaQuestionContent,children:[l.jsx("span",{className:w.qnaQuestionText,style:{fontFamily:u==null?void 0:u.fontFamily},children:N.text}),l.jsxs("div",{className:w.qnaQuestionMeta,children:[l.jsx("span",{className:w.qnaAuthor,children:N.author?`@${N.author}`:l.jsxs(l.Fragment,{children:[l.jsx(E.NiceIcon,{name:"user",size:14})," ",m("interactive.qna.anonymous","Anonymous")]})}),l.jsx("span",{className:w.qnaTimestamp,children:so(m,p,N.timestamp)})]})]}),l.jsxs("div",{className:w.qnaQuestionActions,children:[y&&l.jsxs("button",{className:`${w.qnaUpvoteBtn} ${M?w.qnaUpvoted:""}`,onClick:()=>I(N.id),disabled:M,title:M?m("interactive.qna.alreadyUpvoted","You already upvoted this"):m("interactive.qna.upvote","Upvote"),children:[l.jsx("span",{className:w.qnaUpvoteIcon,children:l.jsx(E.NiceIcon,{name:"arrow-up",size:14})}),l.jsx("span",{className:w.qnaUpvoteCount,children:N.upvotes})]}),a&&l.jsx("button",{className:`${w.qnaAnsweredBtn} ${N.answered?w.qnaMarkedAnswered:""}`,onClick:()=>q(N.id),title:N.answered?m("interactive.qna.markUnanswered","Mark as unanswered"):m("interactive.qna.markAnswered","Mark as answered"),"aria-label":N.answered?m("interactive.qna.markUnanswered","Mark as unanswered"):m("interactive.qna.markAnswered","Mark as answered"),children:l.jsx(E.NiceIcon,{name:N.answered?"check":"circle",size:16})})]})]},N.id)},J=[w.interactiveQnA,w[`qnaStyle_${k}`],c??""].filter(Boolean).join(" ");return l.jsxs("div",{className:J,children:[l.jsxs("div",{className:w.qnaHeader,children:[l.jsx("h3",{className:w.qnaTitle,style:{fontFamily:u==null?void 0:u.fontFamily},children:m("interactive.qna.title","Questions & answers")}),l.jsxs("span",{className:w.qnaCount,children:[R.length," ",R.length===1?m("interactive.qna.questionOne","question"):m("interactive.qna.questionMany","questions")]})]}),!r&&F(),r&&l.jsx("div",{className:w.qnaClosedMessage,children:m("interactive.qna.closed","Question submission is closed")}),l.jsx("div",{className:w.qnaQuestionsList,children:C.length===0?l.jsx("div",{className:w.qnaEmptyState,children:m("interactive.qna.empty","No questions yet. Be the first!")}):C.map(W)}),R.length>v&&l.jsxs("div",{className:w.qnaMoreQuestions,children:["+",R.length-v," ",m("interactive.qna.moreQuestions","more questions")]})]})};function so(e,t,n){const i=new Date(n),r=new Date().getTime()-i.getTime(),a=Math.floor(r/6e4);if(a<1)return e("interactive.qna.justNow","Just now");if(a<60)return e("interactive.qna.minutesAgo","{n} min ago").replace("{n}",String(a));const s=Math.floor(a/60);return s<24?e("interactive.qna.hoursAgo","{n}h ago").replace("{n}",String(s)):i.toLocaleDateString(t,{day:"numeric",month:"short"})}const Ke={id:"fade",name:"Fade",description:"Smooth fade between slides",outgoingStyles:{from:{opacity:1},to:{opacity:0}},incomingStyles:{from:{opacity:0},to:{opacity:1}},defaultDuration:500,defaultEasing:"ease-in-out",category:"basic"},Ye={id:"slide-left",name:"Slide Left",description:"Slide to the left",outgoingStyles:{from:{transform:"translateX(0%)"},to:{transform:"translateX(-100%)"}},incomingStyles:{from:{transform:"translateX(100%)"},to:{transform:"translateX(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Xe={id:"slide-right",name:"Slide Right",description:"Slide to the right",outgoingStyles:{from:{transform:"translateX(0%)"},to:{transform:"translateX(100%)"}},incomingStyles:{from:{transform:"translateX(-100%)"},to:{transform:"translateX(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Ge={id:"slide-up",name:"Slide Up",description:"Slide upward",outgoingStyles:{from:{transform:"translateY(0%)"},to:{transform:"translateY(-100%)"}},incomingStyles:{from:{transform:"translateY(100%)"},to:{transform:"translateY(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Je={id:"slide-down",name:"Slide Down",description:"Slide downward",outgoingStyles:{from:{transform:"translateY(0%)"},to:{transform:"translateY(100%)"}},incomingStyles:{from:{transform:"translateY(-100%)"},to:{transform:"translateY(0%)"}},defaultDuration:600,defaultEasing:"ease-in-out",supportsDirection:!0,category:"slide"},Ze={id:"zoom-in",name:"Zoom In",description:"Zoom in from center",outgoingStyles:{from:{transform:"scale(1)",opacity:1},to:{transform:"scale(1.2)",opacity:0}},incomingStyles:{from:{transform:"scale(0.8)",opacity:0},to:{transform:"scale(1)",opacity:1}},defaultDuration:500,defaultEasing:"ease-out",category:"zoom"},et={id:"zoom-out",name:"Zoom Out",description:"Zoom out to center",outgoingStyles:{from:{transform:"scale(1)",opacity:1},to:{transform:"scale(0.8)",opacity:0}},incomingStyles:{from:{transform:"scale(1.2)",opacity:0},to:{transform:"scale(1)",opacity:1}},defaultDuration:500,defaultEasing:"ease-out",category:"zoom"},tt={id:"flip-horizontal",name:"Flip Horizontal",description:"3D flip around vertical axis",outgoingStyles:{from:{transform:"perspective(1000px) rotateY(0deg)",opacity:1},to:{transform:"perspective(1000px) rotateY(-90deg)",opacity:0}},incomingStyles:{from:{transform:"perspective(1000px) rotateY(90deg)",opacity:0},to:{transform:"perspective(1000px) rotateY(0deg)",opacity:1}},defaultDuration:700,defaultEasing:"ease-in-out",category:"3d"},nt={id:"flip-vertical",name:"Flip Vertical",description:"3D flip around horizontal axis",outgoingStyles:{from:{transform:"perspective(1000px) rotateX(0deg)",opacity:1},to:{transform:"perspective(1000px) rotateX(90deg)",opacity:0}},incomingStyles:{from:{transform:"perspective(1000px) rotateX(-90deg)",opacity:0},to:{transform:"perspective(1000px) rotateX(0deg)",opacity:1}},defaultDuration:700,defaultEasing:"ease-in-out",category:"3d"},it={id:"cube-left",name:"Cube Left",description:"3D cube rotation to the left",outgoingStyles:{from:{transform:"perspective(1000px) translateZ(0) rotateY(0deg)"},to:{transform:"perspective(1000px) translateZ(-50%) rotateY(90deg)"}},incomingStyles:{from:{transform:"perspective(1000px) translateZ(-50%) rotateY(-90deg)"},to:{transform:"perspective(1000px) translateZ(0) rotateY(0deg)"}},defaultDuration:800,defaultEasing:"ease-in-out",category:"3d"},ot={id:"rotate-in",name:"Rotate In",description:"Rotate and fade in",outgoingStyles:{from:{transform:"rotate(0deg) scale(1)",opacity:1},to:{transform:"rotate(-15deg) scale(0.8)",opacity:0}},incomingStyles:{from:{transform:"rotate(15deg) scale(0.8)",opacity:0},to:{transform:"rotate(0deg) scale(1)",opacity:1}},defaultDuration:600,defaultEasing:"ease-out",category:"rotate"},rt={id:"blur-fade",name:"Blur Fade",description:"Fade with blur effect",outgoingStyles:{from:{filter:"blur(0px)",opacity:1},to:{filter:"blur(10px)",opacity:0}},incomingStyles:{from:{filter:"blur(10px)",opacity:0},to:{filter:"blur(0px)",opacity:1}},defaultDuration:600,defaultEasing:"ease-in-out",category:"blur"},at={id:"wipe-left",name:"Wipe Left",description:"Wipe from right to left",outgoingStyles:{from:{clipPath:"inset(0 0 0 0)"},to:{clipPath:"inset(0 100% 0 0)"}},incomingStyles:{from:{clipPath:"inset(0 0 0 100%)"},to:{clipPath:"inset(0 0 0 0)"}},defaultDuration:600,defaultEasing:"ease-in-out",category:"creative"},st={id:"wipe-right",name:"Wipe Right",description:"Wipe from left to right",outgoingStyles:{from:{clipPath:"inset(0 0 0 0)"},to:{clipPath:"inset(0 0 0 100%)"}},incomingStyles:{from:{clipPath:"inset(0 100% 0 0)"},to:{clipPath:"inset(0 0 0 0)"}},defaultDuration:600,defaultEasing:"ease-in-out",category:"creative"},ct={id:"circle-reveal",name:"Circle Reveal",description:"Reveal with expanding circle",outgoingStyles:{from:{clipPath:"circle(100% at 50% 50%)"},to:{clipPath:"circle(0% at 50% 50%)"}},incomingStyles:{from:{clipPath:"circle(0% at 50% 50%)"},to:{clipPath:"circle(100% at 50% 50%)"}},defaultDuration:700,defaultEasing:"ease-out",category:"creative"},lt={id:"glitch",name:"Glitch",description:"Digital glitch effect",outgoingStyles:{from:{transform:"translateX(0)",filter:"hue-rotate(0deg)"},keyframes:[{offset:.2,style:{transform:"translateX(-5px)",filter:"hue-rotate(90deg)"}},{offset:.4,style:{transform:"translateX(5px)",filter:"hue-rotate(180deg)"}},{offset:.6,style:{transform:"translateX(-3px)",filter:"hue-rotate(270deg)"}},{offset:.8,style:{transform:"translateX(3px)",filter:"hue-rotate(360deg)"}}],to:{transform:"translateX(0)",filter:"hue-rotate(0deg)",opacity:0}},incomingStyles:{from:{transform:"translateX(0)",filter:"hue-rotate(0deg)",opacity:0},keyframes:[{offset:.2,style:{transform:"translateX(5px)",filter:"hue-rotate(270deg)",opacity:.5}},{offset:.4,style:{transform:"translateX(-5px)",filter:"hue-rotate(180deg)",opacity:.7}},{offset:.6,style:{transform:"translateX(3px)",filter:"hue-rotate(90deg)",opacity:.9}},{offset:.8,style:{transform:"translateX(-3px)",filter:"hue-rotate(0deg)",opacity:1}}],to:{transform:"translateX(0)",filter:"hue-rotate(0deg)",opacity:1}},defaultDuration:500,defaultEasing:"linear",category:"creative"},dt={id:"morph",name:"Morph",description:"Smooth morphing effect",outgoingStyles:{from:{transform:"scale(1)",borderRadius:"0%",opacity:1},to:{transform:"scale(0.5)",borderRadius:"50%",opacity:0}},incomingStyles:{from:{transform:"scale(0.5)",borderRadius:"50%",opacity:0},to:{transform:"scale(1)",borderRadius:"0%",opacity:1}},defaultDuration:700,defaultEasing:"ease-in-out",category:"creative"},ut=[Ke,Ye,Xe,Ge,Je,Ze,et,tt,nt,it,ot,rt,at,st,ct,lt,dt];class co{constructor(){this.transitions=new Map,ut.forEach(t=>this.transitions.set(t.id,t))}get(t){return this.transitions.get(t)}register(t){this.transitions.has(t.id)&&console.warn(`Transition "${t.id}" already exists and will be overwritten.`),this.transitions.set(t.id,t)}unregister(t){this.transitions.delete(t)}getAll(){return Array.from(this.transitions.values())}getByCategory(t){return this.getAll().filter(n=>n.category===t)}}const pt=new co;function Ne(e,t,n,i){if(i&&i.length>0){const o=[{offset:0,style:e},...i,{offset:1,style:t}].sort((u,m)=>u.offset-m.offset);let r=o[0],a=o[o.length-1];for(let u=0;u<o.length-1;u++)if(n>=o[u].offset&&n<=o[u+1].offset){r=o[u],a=o[u+1];break}const s=a.offset-r.offset,c=s>0?(n-r.offset)/s:1;return Re(r.style,a.style,c)}return Re(e,t,n)}function Re(e,t,n){const i={};return new Set([...Object.keys(e),...Object.keys(t)]).forEach(r=>{const a=e[r],s=t[r];a===void 0?i[r]=s:s===void 0?i[r]=a:typeof a=="number"&&typeof s=="number"?i[r]=a+(s-a)*n:i[r]=n<.5?a:s}),i}function lo(e,t){const n=pt.get(e);if(!n)return{progress:t,outgoingStyle:{opacity:1-t},incomingStyle:{opacity:t},isComplete:t>=1};const{outgoingStyles:i,incomingStyles:o}=n;return{progress:t,outgoingStyle:Ne(i.from,i.to,t,i.keyframes),incomingStyle:Ne(o.from,o.to,t,o.keyframes),isComplete:t>=1}}function uo(e,t){return{none:"fade",fade:"fade",slide:t==="right"?"slide-right":t==="up"?"slide-up":t==="down"?"slide-down":"slide-left",zoom:"zoom-in",flip:"flip-horizontal",cube:"cube-left",wipe:t==="right"?"wipe-right":"wipe-left",dissolve:"blur-fade",push:t==="right"?"slide-right":"slide-left",cover:"slide-left"}[e]??"fade"}function po(e,t){switch(t){case"linear":return e;case"ease-in":return e*e;case"ease-out":return 1-Math.pow(1-e,2);case"ease-in-out":return e<.5?2*e*e:1-Math.pow(-2*e+2,2)/2;case"ease":default:return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}}function fo(e,t,n,i,o){return{id:e,name:t,outgoingStyles:n,incomingStyles:i,defaultDuration:(o==null?void 0:o.defaultDuration)??500,defaultEasing:(o==null?void 0:o.defaultEasing)??"ease-in-out",description:o==null?void 0:o.description,supportsDirection:o==null?void 0:o.supportsDirection,previewUrl:o==null?void 0:o.previewUrl,category:(o==null?void 0:o.category)??"custom"}}function mo(e,t){const n=t==="outgoing"?e.outgoingStyles:e.incomingStyles,i=[];return i.push({...n.from,offset:0}),n.keyframes&&n.keyframes.forEach(o=>{i.push({...o.style,offset:o.offset})}),i.push({...n.to,offset:1}),i}function fe(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function ge(e){return`${e>=0?"+":""}${e.toFixed(1)}%`}function xe(e){return e>=0?"#10b981":"#ef4444"}function ho(e){return{id:"slide-title",title:"Title",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1E3A8A",position:0},{color:"#3b82f6",position:100}],gradientDirection:135},elements:[{id:"title-main",type:"text",position:{x:10,y:35,width:80,height:15,unit:"percent"},content:{type:"text",text:`${e.quarter} ${e.year} Quarterly Report`,style:{fontFamily:"Inter, sans-serif",fontSize:56,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:800,delayMs:200}},{id:"title-company",type:"text",position:{x:10,y:52,width:80,height:8,unit:"percent"},content:{type:"text",text:e.companyName,style:{fontFamily:"Inter, sans-serif",fontSize:32,fontWeight:400,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:600}},{id:"title-date",type:"text",position:{x:10,y:85,width:80,height:5,unit:"percent"},content:{type:"text",text:e.reportDate||new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),style:{fontFamily:"Inter, sans-serif",fontSize:18,color:"#bfdbfe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}],notes:"Welcome stakeholders. This presentation covers our Q"+e.quarter[1]+" results.",durationMs:3e4}}function yo(e){const t=[{id:"kpi-revenue",type:"shape",position:{x:5,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:200}},{id:"kpi-revenue-icon",type:"text",position:{x:7,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"💰",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-revenue-label",type:"text",position:{x:7,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Revenue",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-revenue-value",type:"text",position:{x:7,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:fe(e.kpis.revenue.value),style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-revenue-change",type:"text",position:{x:7,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.revenue.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.revenue.change),textAlign:"center"}}},{id:"kpi-profit",type:"shape",position:{x:28,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:350}},{id:"kpi-profit-icon",type:"text",position:{x:30,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"📈",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-profit-label",type:"text",position:{x:30,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Profit",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-profit-value",type:"text",position:{x:30,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:fe(e.kpis.profit.value),style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-profit-change",type:"text",position:{x:30,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.profit.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.profit.change),textAlign:"center"}}},{id:"kpi-customers",type:"shape",position:{x:51,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:500}},{id:"kpi-customers-icon",type:"text",position:{x:53,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"👥",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-customers-label",type:"text",position:{x:53,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Customers",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-customers-value",type:"text",position:{x:53,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:e.kpis.customers.value.toLocaleString(),style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-customers-change",type:"text",position:{x:53,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.customers.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.customers.change),textAlign:"center"}}},{id:"kpi-satisfaction",type:"shape",position:{x:74,y:22,width:21,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e5e7eb",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:500,delayMs:650}},{id:"kpi-satisfaction-icon",type:"text",position:{x:76,y:25,width:17,height:6,unit:"percent"},content:{type:"text",text:"⭐",style:{fontSize:36,textAlign:"center"}}},{id:"kpi-satisfaction-label",type:"text",position:{x:76,y:32,width:17,height:4,unit:"percent"},content:{type:"text",text:"Satisfaction",style:{fontSize:14,color:"#6b7280",textAlign:"center",fontWeight:500}}},{id:"kpi-satisfaction-value",type:"text",position:{x:76,y:37,width:17,height:8,unit:"percent"},content:{type:"text",text:`${e.kpis.satisfaction.value}%`,style:{fontSize:28,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"kpi-satisfaction-change",type:"text",position:{x:76,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ge(e.kpis.satisfaction.change),style:{fontSize:16,fontWeight:600,color:xe(e.kpis.satisfaction.change),textAlign:"center"}}}];return{id:"slide-kpis",title:"Key Performance Indicators",layout:"titleContent",background:{type:"solid",color:"#f3f4f6"},elements:[{id:"kpis-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Key Performance Indicators",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...t],notes:"Review each KPI and highlight the most significant changes from last quarter.",durationMs:45e3}}function go(e){var n;const t={type:"chart",chartType:"bar",title:"Monthly Revenue",data:{labels:e.financials.revenueByMonth.map(i=>i.month),datasets:[{label:`${e.year}`,data:e.financials.revenueByMonth.map(i=>i.value),backgroundColor:"#3b82f6"},...((n=e.financials.revenueByMonth[0])==null?void 0:n.lastYear)!==void 0?[{label:`${e.year-1}`,data:e.financials.revenueByMonth.map(i=>i.lastYear||0),backgroundColor:"#93c5fd"}]:[]]},options:{showLegend:!0,showGridLines:!0,animation:!0}};return{id:"slide-revenue",title:"Revenue Analysis",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"revenue-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Revenue Analysis",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"revenue-chart",type:"chart",position:{x:5,y:18,width:90,height:75,unit:"percent"},content:t,animation:{effect:"fadeIn",durationMs:800,delayMs:400}}],notes:"Highlight the revenue trend and compare with last year if applicable.",durationMs:6e4}}function xo(e){const t={type:"chart",chartType:"pie",title:"Cost Breakdown",data:{labels:e.financials.costBreakdown.map(n=>n.category),datasets:[{label:"Cost Distribution",data:e.financials.costBreakdown.map(n=>n.value),backgroundColor:["#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#6366f1"]}]},options:{showLegend:!0,showDataLabels:!0,animation:!0}};return{id:"slide-costs",title:"Cost Analysis",layout:"twoColumn",background:{type:"solid",color:"#fff"},elements:[{id:"costs-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Cost Analysis",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"costs-chart",type:"chart",position:{x:5,y:18,width:45,height:70,unit:"percent"},content:t,animation:{effect:"zoomIn",durationMs:600,delayMs:400}},{id:"costs-table",type:"table",position:{x:52,y:18,width:43,height:70,unit:"percent"},content:{type:"table",headers:["Category","Amount","%"],rows:e.financials.costBreakdown.map(n=>[n.category,fe(n.value),`${n.percentage}%`]),style:{headerBackground:"#f3f4f6",headerColor:"#374151",cellPadding:12,fontSize:14,borderColor:"#e5e7eb"}},animation:{effect:"slideInRight",durationMs:600,delayMs:600}}],notes:"Discuss major cost categories and opportunities for optimization.",durationMs:6e4}}function bo(e){const t=e.pipeline.opportunities.map((i,o)=>({id:`pipeline-stage-${o}`,type:"shape",position:{x:5+o*2,y:25+o*12,width:90-o*4,height:10,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:`hsl(${220-o*15}, 70%, ${50+o*8}%)`,cornerRadius:6},animation:{effect:"slideInLeft",durationMs:400,delayMs:200+o*150}})),n=e.pipeline.opportunities.map((i,o)=>({id:`pipeline-label-${o}`,type:"text",position:{x:8+o*2,y:26.5+o*12,width:84-o*4,height:7,unit:"percent"},content:{type:"text",text:`${i.stage}: ${i.count} opportunities (${fe(i.value)})`,style:{fontSize:16,fontWeight:600,color:o<2?"#fff":"#1f2937",textAlign:"center"}}}));return{id:"slide-pipeline",title:"Sales Pipeline",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"pipeline-title",type:"text",position:{x:5,y:5,width:60,height:10,unit:"percent"},content:{type:"text",text:"Sales Pipeline",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"pipeline-total",type:"text",position:{x:65,y:5,width:30,height:10,unit:"percent"},content:{type:"text",text:`Total: ${fe(e.pipeline.totalValue)}`,style:{fontSize:28,fontWeight:700,color:"#3b82f6",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},...t,...n],notes:"Walk through the pipeline stages and highlight key deals approaching close.",durationMs:6e4}}function vo(e){const t={high:"#ef4444",medium:"#f59e0b",low:"#10b981"},n=e.risks.slice(0,5).flatMap((i,o)=>[{id:`risk-card-${o}`,type:"shape",position:{x:5,y:20+o*15,width:90,height:13,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:t[i.impact],strokeWidth:2,cornerRadius:8},animation:{effect:"slideInLeft",durationMs:400,delayMs:200+o*100}},{id:`risk-name-${o}`,type:"text",position:{x:7,y:21.5+o*15,width:50,height:5,unit:"percent"},content:{type:"text",text:i.name,style:{fontSize:16,fontWeight:600,color:"#1f2937"}}},{id:`risk-impact-${o}`,type:"text",position:{x:58,y:21.5+o*15,width:15,height:5,unit:"percent"},content:{type:"text",text:`Impact: ${i.impact.toUpperCase()}`,style:{fontSize:12,fontWeight:500,color:t[i.impact]}}},{id:`risk-prob-${o}`,type:"text",position:{x:75,y:21.5+o*15,width:18,height:5,unit:"percent"},content:{type:"text",text:`Prob: ${i.probability.toUpperCase()}`,style:{fontSize:12,fontWeight:500,color:"#6b7280"}}},{id:`risk-mitigation-${o}`,type:"text",position:{x:7,y:27+o*15,width:86,height:4,unit:"percent"},content:{type:"text",text:`Mitigation: ${i.mitigation}`,style:{fontSize:12,color:"#6b7280"}}}]);return{id:"slide-risks",title:"Risks & Mitigation",layout:"titleContent",background:{type:"solid",color:"#f9fafb"},elements:[{id:"risks-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Risks & Mitigation",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...n],notes:"Discuss each risk, its current status, and mitigation actions in progress.",durationMs:9e4}}function So(e){const t={"on-track":"#10b981","at-risk":"#f59e0b",completed:"#3b82f6","not-started":"#9ca3af"},n={"on-track":"✅","at-risk":"⚠️",completed:"🎉","not-started":"⏳"},i=e.plan.slice(0,6).flatMap((o,r)=>[{id:`plan-item-${r}`,type:"shape",position:{x:5,y:18+r*13,width:90,height:11,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:t[o.status],strokeWidth:2,cornerRadius:8},animation:{effect:"slideInRight",durationMs:400,delayMs:200+r*100}},{id:`plan-icon-${r}`,type:"text",position:{x:7,y:20+r*13,width:5,height:7,unit:"percent"},content:{type:"text",text:n[o.status],style:{fontSize:24}}},{id:`plan-goal-${r}`,type:"text",position:{x:13,y:20+r*13,width:60,height:7,unit:"percent"},content:{type:"text",text:o.goal,style:{fontSize:16,fontWeight:500,color:"#1f2937"}}},{id:`plan-status-${r}`,type:"text",position:{x:75,y:20+r*13,width:18,height:7,unit:"percent"},content:{type:"text",text:o.status.replace("-"," ").toUpperCase(),style:{fontSize:12,fontWeight:600,color:t[o.status],textAlign:"right"}}}]);return{id:"slide-plan",title:"Strategic Plan",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"plan-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Strategic Plan Status",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...i],notes:"Review progress on strategic initiatives and discuss any blockers.",durationMs:6e4}}function wo(e){const t=e.team||{headcount:0,newHires:0,departures:0,highlights:[]};return{id:"slide-team",title:"Team Updates",layout:"twoColumn",background:{type:"gradient",gradientStops:[{color:"#f0f9ff",position:0},{color:"#e0f2fe",position:100}],gradientDirection:180},elements:[{id:"team-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Team Updates",style:{fontFamily:"Inter, sans-serif",fontSize:40,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},{id:"team-headcount-card",type:"shape",position:{x:5,y:20,width:28,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#3b82f6",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:200}},{id:"team-headcount-icon",type:"text",position:{x:12,y:23,width:14,height:8,unit:"percent"},content:{type:"text",text:"👥",style:{fontSize:40,textAlign:"center"}}},{id:"team-headcount-value",type:"text",position:{x:7,y:32,width:24,height:8,unit:"percent"},content:{type:"text",text:t.headcount.toString(),style:{fontSize:36,fontWeight:700,color:"#1f2937",textAlign:"center"}}},{id:"team-headcount-label",type:"text",position:{x:7,y:40,width:24,height:4,unit:"percent"},content:{type:"text",text:"Total Headcount",style:{fontSize:12,color:"#6b7280",textAlign:"center"}}},{id:"team-new-card",type:"shape",position:{x:36,y:20,width:28,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#10b981",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:350}},{id:"team-new-icon",type:"text",position:{x:43,y:23,width:14,height:8,unit:"percent"},content:{type:"text",text:"🆕",style:{fontSize:40,textAlign:"center"}}},{id:"team-new-value",type:"text",position:{x:38,y:32,width:24,height:8,unit:"percent"},content:{type:"text",text:`+${t.newHires||0}`,style:{fontSize:36,fontWeight:700,color:"#10b981",textAlign:"center"}}},{id:"team-new-label",type:"text",position:{x:38,y:40,width:24,height:4,unit:"percent"},content:{type:"text",text:"New Hires",style:{fontSize:12,color:"#6b7280",textAlign:"center"}}},{id:"team-dept-card",type:"shape",position:{x:67,y:20,width:28,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#f59e0b",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:500}},{id:"team-dept-icon",type:"text",position:{x:74,y:23,width:14,height:8,unit:"percent"},content:{type:"text",text:"👋",style:{fontSize:40,textAlign:"center"}}},{id:"team-dept-value",type:"text",position:{x:69,y:32,width:24,height:8,unit:"percent"},content:{type:"text",text:`-${t.departures||0}`,style:{fontSize:36,fontWeight:700,color:"#f59e0b",textAlign:"center"}}},{id:"team-dept-label",type:"text",position:{x:69,y:40,width:24,height:4,unit:"percent"},content:{type:"text",text:"Departures",style:{fontSize:12,color:"#6b7280",textAlign:"center"}}},{id:"team-highlights-title",type:"text",position:{x:5,y:50,width:90,height:6,unit:"percent"},content:{type:"text",text:"Team Highlights",style:{fontSize:24,fontWeight:600,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:700}},...(t.highlights||[]).slice(0,4).map((n,i)=>({id:`team-highlight-${i}`,type:"text",position:{x:7,y:58+i*8,width:88,height:6,unit:"percent"},content:{type:"text",text:`• ${n}`,style:{fontSize:16,color:"#374151"}},animation:{effect:"slideInLeft",durationMs:300,delayMs:800+i*100}}))],notes:"Celebrate new team members and acknowledge departures. Highlight team achievements.",durationMs:45e3}}function ko(e){return{id:"slide-qa",title:"Q&A",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1E3A8A",position:0},{color:"#3b82f6",position:100}],gradientDirection:135},elements:[{id:"qa-title",type:"text",position:{x:10,y:35,width:80,height:20,unit:"percent"},content:{type:"text",text:"Questions?",style:{fontFamily:"Inter, sans-serif",fontSize:72,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:800,delayMs:200}},{id:"qa-subtitle",type:"text",position:{x:10,y:55,width:80,height:10,unit:"percent"},content:{type:"text",text:"Thank you for your attention",style:{fontFamily:"Inter, sans-serif",fontSize:28,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:800}},{id:"qa-contact",type:"text",position:{x:10,y:85,width:80,height:5,unit:"percent"},content:{type:"text",text:e.preparedBy?`Prepared by: ${e.preparedBy}`:e.companyName,style:{fontSize:16,color:"#bfdbfe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Open floor for questions. Have backup slides ready for detailed questions.",durationMs:3e5}}function Io(e){return{version:"1.0",id:`quarterly-report-${e.quarter}-${e.year}`,title:`${e.quarter} ${e.year} Quarterly Report - ${e.companyName}`,author:e.preparedBy,slideSize:{width:1920,height:1080,unit:"px"},slides:[ho(e),yo(e),go(e),xo(e),bo(e),vo(e),So(e),wo(e),ko(e)],theme:{colors:{primary:"#3b82f6",secondary:"#10b981",background:"#fff",text:"#1f2937",accent:"#f59e0b"},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"},spacing:{base:16}},speakerSettings:{showTimer:!0,showNotes:!0,showNextSlide:!0},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),tags:["quarterly-report",e.quarter,e.year.toString()],templateId:"quarterly-report-v1"}}}function Co(){return{quarter:"Q4",year:2024,companyName:"TechCorp Inc.",reportDate:"January 15, 2025",preparedBy:"Finance Team",kpis:{revenue:{value:125e5,change:15.3,target:12e6},profit:{value:28e5,change:8.7,target:25e5},customers:{value:1250,change:22.5,target:1e3},satisfaction:{value:92,change:3.2,target:90}},financials:{revenueByMonth:[{month:"Oct",value:38e5,lastYear:32e5},{month:"Nov",value:42e5,lastYear:35e5},{month:"Dec",value:45e5,lastYear:4e6}],costBreakdown:[{category:"Personnel",value:52e5,percentage:42},{category:"Infrastructure",value:23e5,percentage:18},{category:"Marketing",value:18e5,percentage:14},{category:"R&D",value:15e5,percentage:12},{category:"Operations",value:11e5,percentage:9},{category:"Other",value:6e5,percentage:5}],profitMargin:[{month:"Oct",margin:21},{month:"Nov",margin:22},{month:"Dec",margin:24}]},pipeline:{totalValue:185e5,opportunities:[{stage:"Qualified",count:45,value:85e5},{stage:"Proposal",count:28,value:52e5},{stage:"Negotiation",count:15,value:32e5},{stage:"Closing",count:8,value:16e5}]},risks:[{name:"Supply chain delays",impact:"high",probability:"medium",mitigation:"Diversifying suppliers and increasing inventory buffer",owner:"Operations"},{name:"Key talent retention",impact:"high",probability:"low",mitigation:"Competitive compensation review and career development programs",owner:"HR"},{name:"Market competition",impact:"medium",probability:"high",mitigation:"Accelerating product innovation and customer loyalty programs",owner:"Product"}],plan:[{goal:"Launch v2.0 platform",status:"on-track",dueDate:"Q1 2025",owner:"Engineering"},{goal:"Expand to EMEA market",status:"at-risk",dueDate:"Q2 2025",owner:"Sales"},{goal:"Achieve SOC2 certification",status:"completed",owner:"Security"},{goal:"Implement AI-powered support",status:"on-track",dueDate:"Q1 2025",owner:"Support"},{goal:"Reduce customer churn by 15%",status:"on-track",dueDate:"Q4 2024",owner:"Customer Success"}],team:{headcount:156,newHires:23,departures:8,highlights:["Promoted 12 team members to senior roles","Launched engineering mentorship program","Achieved 95% employee engagement score","Completed company-wide DEI training"]}}}function Mo(e){const t=e.problem.painPoints.slice(0,4).map((n,i)=>({id:`pain-${i}`,type:"text",position:{x:55,y:28+i*15,width:40,height:12,unit:"percent"},content:{type:"text",text:`❌ ${n}`,style:{fontSize:20,color:"#374151",lineHeight:1.5}},animation:{effect:"slideInRight",durationMs:400,delayMs:400+i*200}}));return{id:"slide-problem",title:"The Problem",layout:"twoColumn",background:{type:"solid",color:"#fef2f2"},elements:[{id:"problem-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:e.problem.headline,style:{fontSize:48,fontWeight:700,color:"#991b1b"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"problem-icon",type:"text",position:{x:10,y:30,width:35,height:40,unit:"percent"},content:{type:"text",text:"😫",style:{fontSize:150,textAlign:"center"}},animation:{effect:"zoomIn",durationMs:500,delayMs:200}},...t,...(e.problem.statistics||[]).slice(0,2).map((n,i)=>({id:`stat-${i}`,type:"shape",position:{x:5+i*47,y:80,width:43,height:15,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fee2e2",cornerRadius:8},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3+i*200}}))],notes:"Set up the problem. Make the audience feel the pain before presenting the solution.",durationMs:6e4}}function zo(e){const t=e.solution.keyBenefits.slice(0,3).flatMap((n,i)=>[{id:`benefit-card-${i}`,type:"shape",position:{x:5+i*32,y:45,width:29,height:45,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#10b981",strokeWidth:2,cornerRadius:12},animation:{effect:"slideInUp",durationMs:500,delayMs:400+i*200}},{id:`benefit-icon-${i}`,type:"text",position:{x:10+i*32,y:50,width:19,height:12,unit:"percent"},content:{type:"text",text:n.icon||"✅",style:{fontSize:48,textAlign:"center"}}},{id:`benefit-title-${i}`,type:"text",position:{x:7+i*32,y:64,width:25,height:8,unit:"percent"},content:{type:"text",text:n.title,style:{fontSize:20,fontWeight:600,color:"#1f2937",textAlign:"center"}}},{id:`benefit-desc-${i}`,type:"text",position:{x:7+i*32,y:73,width:25,height:14,unit:"percent"},content:{type:"text",text:n.description,style:{fontSize:14,color:"#6b7280",textAlign:"center",lineHeight:1.4}}}]);return{id:"slide-solution",title:"The Solution",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"#ecfdf5",position:0},{color:"#d1fae5",position:100}],gradientDirection:180},elements:[{id:"solution-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:e.solution.headline,style:{fontSize:48,fontWeight:700,color:"#047857"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"solution-desc",type:"text",position:{x:5,y:20,width:90,height:15,unit:"percent"},content:{type:"text",text:e.solution.description,style:{fontSize:24,color:"#374151",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:500,delayMs:300}},...t],notes:"Introduce your solution as the hero. Emphasize key benefits.",durationMs:6e4}}function Ao(e){var n,i;const t=(((n=e.demo)==null?void 0:n.features)||[]).slice(0,5).map((o,r)=>({id:`demo-feature-${r}`,type:"text",position:{x:55,y:25+r*12,width:40,height:10,unit:"percent"},content:{type:"text",text:`▸ ${o.name}`,style:{fontSize:18,color:"#374151",fontWeight:500}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+r*150}}));return{id:"slide-demo",title:"Product Demo",layout:"twoColumn",background:{type:"solid",color:"#fff"},elements:[{id:"demo-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:`See ${e.productName} in Action`,style:{fontSize:44,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"demo-screenshot",type:"shape",position:{x:5,y:22,width:45,height:70,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#f3f4f6",stroke:"#e5e7eb",strokeWidth:2,cornerRadius:12},animation:{effect:"slideInLeft",durationMs:600,delayMs:300}},{id:"demo-placeholder",type:"text",position:{x:15,y:50,width:25,height:10,unit:"percent"},content:{type:"text",text:(i=e.demo)!=null&&i.screenshotUrl?"":"📱 Demo Screenshot",style:{fontSize:20,color:"#9ca3af",textAlign:"center"}}},{id:"features-title",type:"text",position:{x:55,y:18,width:40,height:6,unit:"percent"},content:{type:"text",text:"Key Features",style:{fontSize:24,fontWeight:600,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},...t],notes:"This is where you do the live demo or show screenshots. Keep it focused.",durationMs:12e4}}function $o(e){const t=e.features.slice(0,6).flatMap((n,i)=>{const o=Math.floor(i/3),r=i%3,a=n.highlight;return[{id:`feature-card-${i}`,type:"shape",position:{x:5+r*32,y:22+o*38,width:29,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:a?"#3b82f6":"#fff",stroke:a?"#2563eb":"#e5e7eb",strokeWidth:a?3:1,cornerRadius:12},animation:{effect:"zoomIn",durationMs:400,delayMs:200+i*100}},{id:`feature-icon-${i}`,type:"text",position:{x:10+r*32,y:26+o*38,width:19,height:10,unit:"percent"},content:{type:"text",text:n.icon||"⚡",style:{fontSize:36,textAlign:"center"}}},{id:`feature-name-${i}`,type:"text",position:{x:7+r*32,y:37+o*38,width:25,height:6,unit:"percent"},content:{type:"text",text:n.name,style:{fontSize:18,fontWeight:600,color:a?"#fff":"#1f2937",textAlign:"center"}}},{id:`feature-desc-${i}`,type:"text",position:{x:7+r*32,y:44+o*38,width:25,height:10,unit:"percent"},content:{type:"text",text:n.description,style:{fontSize:12,color:a?"#dbeafe":"#6b7280",textAlign:"center",lineHeight:1.3}}}]});return{id:"slide-features",title:"Features",layout:"titleContent",background:{type:"solid",color:"#f9fafb"},elements:[{id:"features-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:"Powerful Features",style:{fontSize:44,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Highlight key features. Focus on benefits, not just functionality.",durationMs:6e4}}function _o(e){const t=e.pricing.plans.slice(0,3).flatMap((n,i)=>{const o=n.highlighted,r=o?18:22,a=o?72:65;return[{id:`pricing-card-${i}`,type:"shape",position:{x:5+i*32,y:r,width:29,height:a,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:o?"#3b82f6":"#fff",stroke:o?"#1d4ed8":"#e5e7eb",strokeWidth:o?3:1,cornerRadius:16},animation:{effect:"slideInUp",durationMs:500,delayMs:200+i*150}},...o?[{id:`pricing-badge-${i}`,type:"text",position:{x:10+i*32,y:r+2,width:19,height:4,unit:"percent"},content:{type:"text",text:"⭐ POPULAR",style:{fontSize:12,fontWeight:700,color:"#fcd34d",textAlign:"center"}}}]:[],{id:`pricing-name-${i}`,type:"text",position:{x:7+i*32,y:r+(o?8:5),width:25,height:6,unit:"percent"},content:{type:"text",text:n.name,style:{fontSize:24,fontWeight:600,color:o?"#fff":"#1f2937",textAlign:"center"}}},{id:`pricing-price-${i}`,type:"text",position:{x:7+i*32,y:r+(o?16:13),width:25,height:10,unit:"percent"},content:{type:"text",text:n.price==="custom"?"Custom":`${e.pricing.currency}${n.price}/${n.period==="month"?"mo":n.period==="year"?"yr":""}`,style:{fontSize:36,fontWeight:700,color:o?"#fff":"#3b82f6",textAlign:"center"}}},...n.features.slice(0,5).map((s,c)=>({id:`pricing-feature-${i}-${c}`,type:"text",position:{x:7+i*32,y:r+(o?28:25)+c*7,width:25,height:5,unit:"percent"},content:{type:"text",text:`✓ ${s}`,style:{fontSize:12,color:o?"#dbeafe":"#6b7280",textAlign:"center"}}})),{id:`pricing-cta-${i}`,type:"shape",position:{x:9+i*32,y:r+a-12,width:21,height:8,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:o?"#fff":"#3b82f6",cornerRadius:8}},{id:`pricing-cta-text-${i}`,type:"text",position:{x:9+i*32,y:r+a-10.5,width:21,height:5,unit:"percent"},content:{type:"text",text:n.cta||"Get Started",style:{fontSize:14,fontWeight:600,color:o?"#3b82f6":"#fff",textAlign:"center"}}}]});return{id:"slide-pricing",title:"Pricing",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"pricing-title",type:"text",position:{x:5,y:3,width:90,height:10,unit:"percent"},content:{type:"text",text:"Simple, Transparent Pricing",style:{fontSize:44,fontWeight:700,color:"#1f2937"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Present pricing clearly. Emphasize value, not just cost.",durationMs:6e4}}function To(e){return{id:"slide-cta",title:"Call to Action",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1e40af",position:0},{color:"#3b82f6",position:50},{color:"#60a5fa",position:100}],gradientDirection:135},elements:[{id:"cta-headline",type:"text",position:{x:10,y:25,width:80,height:20,unit:"percent"},content:{type:"text",text:e.cta.headline,style:{fontSize:56,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:700,delayMs:0}},...e.cta.subheadline?[{id:"cta-subheadline",type:"text",position:{x:15,y:48,width:70,height:10,unit:"percent"},content:{type:"text",text:e.cta.subheadline,style:{fontSize:24,color:"#bfdbfe",textAlign:"center",lineHeight:1.4}},animation:{effect:"fadeIn",durationMs:500,delayMs:500}}]:[],{id:"cta-button",type:"shape",position:{x:35,y:65,width:30,height:12,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",cornerRadius:30},animation:{effect:"slideInUp",durationMs:500,delayMs:800}},{id:"cta-button-text",type:"text",position:{x:35,y:68,width:30,height:6,unit:"percent"},content:{type:"text",text:e.cta.buttonText,style:{fontSize:24,fontWeight:700,color:"#1e40af",textAlign:"center"}}},...e.cta.contactEmail?[{id:"cta-contact",type:"text",position:{x:20,y:82,width:60,height:6,unit:"percent"},content:{type:"text",text:`📧 ${e.cta.contactEmail}`,style:{fontSize:18,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}]:[],...e.cta.websiteUrl?[{id:"cta-website",type:"text",position:{x:20,y:88,width:60,height:5,unit:"percent"},content:{type:"text",text:`🌐 ${e.cta.websiteUrl}`,style:{fontSize:16,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1100}}]:[]],notes:"Strong call to action. Make it easy for them to take the next step.",durationMs:6e4}}function Eo(e){return{id:"slide-title",title:"Title",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#0f172a",position:0},{color:"#1e293b",position:100}],gradientDirection:180},elements:[{id:"title-product",type:"text",position:{x:10,y:30,width:80,height:20,unit:"percent"},content:{type:"text",text:e.productName,style:{fontSize:72,fontWeight:800,color:"#fff",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:800,delayMs:200}},{id:"title-tagline",type:"text",position:{x:15,y:52,width:70,height:12,unit:"percent"},content:{type:"text",text:e.tagline,style:{fontSize:28,color:"#94a3b8",textAlign:"center",lineHeight:1.4}},animation:{effect:"fadeIn",durationMs:600,delayMs:800}},{id:"title-company",type:"text",position:{x:10,y:88,width:80,height:6,unit:"percent"},content:{type:"text",text:e.companyName,style:{fontSize:18,color:"#64748b",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Opening slide. Create intrigue and set the tone.",durationMs:15e3}}function No(e){return{version:"1.0",id:`product-pitch-${e.productName.toLowerCase().replace(/\s+/g,"-")}`,title:`${e.productName} - Product Pitch`,slideSize:{width:1920,height:1080,unit:"px"},slides:[Eo(e),Mo(e),zo(e),Ao(e),$o(e),_o(e),To(e)],theme:{colors:{primary:"#3b82f6",secondary:"#10b981",background:"#fff",text:"#1f2937",accent:"#f59e0b"},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"},spacing:{base:16}},speakerSettings:{showTimer:!0,showNotes:!0,showNextSlide:!0},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),tags:["product-pitch","sales"],templateId:"product-pitch-v1"}}}function Ro(){return{productName:"FlowSync",tagline:"Seamless workflow automation that actually works",companyName:"FlowSync Inc.",problem:{headline:"Manual processes are killing productivity",painPoints:["Teams waste 20+ hours/week on repetitive tasks","Data silos cause costly errors and delays","No visibility into process bottlenecks","Integration nightmares with existing tools"],statistics:[{stat:"60%",description:"of knowledge workers spend time on busy work"},{stat:"$1.8T",description:"lost annually to inefficient processes"}]},solution:{headline:"Automate in minutes, not months",description:"FlowSync connects your existing tools and automates workflows with AI-powered intelligence. No coding required.",keyBenefits:[{title:"Easy Setup",description:"Connect apps in seconds with 200+ integrations",icon:"🔌"},{title:"AI-Powered",description:"Smart automation that learns from your workflows",icon:"🧠"},{title:"Real-time Insights",description:"Dashboard with live metrics and bottleneck detection",icon:"📊"}]},demo:{features:[{name:"Visual Workflow Builder",description:"Drag-and-drop interface"},{name:"Smart Triggers",description:"Event-based automation"},{name:"Error Handling",description:"Automatic retry and alerts"},{name:"Version Control",description:"Track changes and rollback"},{name:"Team Collaboration",description:"Share and comment on flows"}]},features:[{name:"Visual Builder",description:"Intuitive drag-and-drop workflow design",icon:"🎨",highlight:!0},{name:"200+ Integrations",description:"Connect to popular apps instantly",icon:"🔗"},{name:"AI Suggestions",description:"Get smart automation recommendations",icon:"🤖"},{name:"Real-time Monitoring",description:"Track all workflows in one dashboard",icon:"📈"},{name:"Enterprise Security",description:"SOC2 compliant, encrypted data",icon:"🔒"},{name:"24/7 Support",description:"Expert help whenever you need it",icon:"💬"}],pricing:{currency:"$",plans:[{name:"Starter",price:29,period:"month",features:["5 workflows","1,000 runs/month","10 integrations","Email support"],cta:"Start Free"},{name:"Professional",price:99,period:"month",features:["Unlimited workflows","50,000 runs/month","All integrations","Priority support","AI suggestions"],highlighted:!0,cta:"Try 14 Days Free"},{name:"Enterprise",price:"custom",period:"month",features:["Everything in Pro","Unlimited runs","Dedicated support","Custom integrations","SLA guarantee"],cta:"Contact Sales"}]},cta:{headline:"Ready to automate your workflow?",subheadline:"Join 10,000+ teams already saving hours every week",buttonText:"Start Your Free Trial",contactEmail:"hello@flowsync.io",websiteUrl:"flowsync.io"}}}function Po(e){const t=Math.round(e.completed.totalPoints/e.completed.committedPoints*100);return{id:"slide-title",title:"Sprint Review",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#1E3A8A",position:0},{color:"#3b82f6",position:100}],gradientDirection:135},elements:[{id:"title-sprint",type:"text",position:{x:10,y:25,width:80,height:15,unit:"percent"},content:{type:"text",text:`Sprint ${e.sprint.number} Review`,style:{fontSize:64,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"title-name",type:"text",position:{x:15,y:42,width:70,height:8,unit:"percent"},content:{type:"text",text:e.sprint.name,style:{fontSize:32,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:500,delayMs:300}},{id:"title-team",type:"text",position:{x:30,y:55,width:40,height:5,unit:"percent"},content:{type:"text",text:`Team ${e.team.name}`,style:{fontSize:20,color:"#bfdbfe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"title-dates",type:"text",position:{x:25,y:62,width:50,height:5,unit:"percent"},content:{type:"text",text:`${e.sprint.startDate} - ${e.sprint.endDate}`,style:{fontSize:18,color:"#93c5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:600}},{id:"title-completion",type:"text",position:{x:35,y:75,width:30,height:10,unit:"percent"},content:{type:"text",text:`${t}% Complete`,style:{fontSize:36,fontWeight:700,color:t>=80?"#4ade80":t>=60?"#fbbf24":"#f87171",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:600,delayMs:800}}],notes:"Welcome stakeholders. Quick overview of sprint completion.",durationMs:3e4}}function qo(e){return{id:"slide-goal",title:"Sprint Goal",layout:"titleContent",background:{type:"solid",color:"#f0f9ff"},elements:[{id:"goal-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Sprint Goal",style:{fontSize:44,fontWeight:700,color:"#1E3A8A"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"goal-card",type:"shape",position:{x:10,y:25,width:80,height:30,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#3b82f6",strokeWidth:3,cornerRadius:16},animation:{effect:"slideInUp",durationMs:500,delayMs:200}},{id:"goal-icon",type:"text",position:{x:15,y:30,width:10,height:15,unit:"percent"},content:{type:"text",text:"🎯",style:{fontSize:64}}},{id:"goal-text",type:"text",position:{x:27,y:32,width:58,height:20,unit:"percent"},content:{type:"text",text:e.sprint.goal,style:{fontSize:28,color:"#1f2937",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"goal-status",type:"text",position:{x:10,y:60,width:80,height:8,unit:"percent"},content:{type:"text",text:e.completed.totalPoints>=e.completed.committedPoints*.8?"✅ Goal Achieved":"⚠️ Goal Partially Met",style:{fontSize:32,fontWeight:600,color:e.completed.totalPoints>=e.completed.committedPoints*.8?"#059669":"#d97706",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:500,delayMs:700}}],notes:"Review whether the sprint goal was achieved and why.",durationMs:45e3}}function Do(e){const t=e.completed.stories.slice(0,8).map((n,i)=>{const o=Math.floor(i/2),r=i%2,a=n.type==="feature"?"✨":n.type==="bug"?"🐛":n.type==="tech-debt"?"🔧":"🔬",s=n.type==="feature"?"#059669":n.type==="bug"?"#dc2626":n.type==="tech-debt"?"#7c3aed":"#0891b2";return{id:`story-${i}`,type:"text",position:{x:5+r*48,y:22+o*9,width:44,height:7,unit:"percent"},content:{type:"text",text:`${a} ${n.key}: ${n.title}`,style:{fontSize:16,color:s,fontWeight:n.demo?700:400}},animation:{effect:"slideInRight",durationMs:300,delayMs:300+i*100}}});return{id:"slide-completed",title:"Completed Work",layout:"titleContent",background:{type:"solid",color:"#f0fdf4"},elements:[{id:"completed-title",type:"text",position:{x:5,y:5,width:60,height:10,unit:"percent"},content:{type:"text",text:"Completed Work",style:{fontSize:44,fontWeight:700,color:"#166534"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"completed-points",type:"text",position:{x:70,y:5,width:25,height:12,unit:"percent"},content:{type:"text",text:`${e.completed.totalPoints} / ${e.completed.committedPoints} pts`,style:{fontSize:32,fontWeight:700,color:"#059669",textAlign:"right"}},animation:{effect:"zoomIn",durationMs:500,delayMs:200}},...t,{id:"legend",type:"text",position:{x:5,y:90,width:90,height:5,unit:"percent"},content:{type:"text",text:"✨ Feature | 🐛 Bug Fix | 🔧 Tech Debt | 🔬 Spike",style:{fontSize:14,color:"#6b7280",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Walk through completed items. Highlight any notable achievements.",durationMs:9e4}}function jo(e){const t=Math.max(...e.velocity.history.map(o=>o.points),e.velocity.current),n=e.velocity.history.slice(-5).map((o,r)=>{const a=o.points/t*45;return{id:`bar-${r}`,type:"shape",position:{x:10+r*16,y:75-a,width:12,height:a,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#93c5fd",cornerRadius:8},animation:{effect:"slideInUp",durationMs:500,delayMs:400+r*100}}}),i=e.velocity.current/t*45;return{id:"slide-velocity",title:"Velocity",layout:"titleContent",background:{type:"solid",color:"#fff"},elements:[{id:"velocity-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Sprint Velocity",style:{fontSize:44,fontWeight:700,color:"#1E3A8A"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...n,{id:"current-bar",type:"shape",position:{x:10+e.velocity.history.slice(-5).length*16,y:75-i,width:12,height:i,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#3b82f6",cornerRadius:8},animation:{effect:"slideInUp",durationMs:600,delayMs:900}},{id:"current-label",type:"text",position:{x:10+e.velocity.history.slice(-5).length*16,y:77,width:12,height:6,unit:"percent"},content:{type:"text",text:`S${e.sprint.number}`,style:{fontSize:14,color:"#1E3A8A",fontWeight:600,textAlign:"center"}}},{id:"current-value",type:"text",position:{x:10+e.velocity.history.slice(-5).length*16,y:70-i,width:12,height:5,unit:"percent"},content:{type:"text",text:`${e.velocity.current}`,style:{fontSize:18,color:"#3b82f6",fontWeight:700,textAlign:"center"}}},{id:"average-line",type:"text",position:{x:5,y:18,width:35,height:10,unit:"percent"},content:{type:"text",text:`Average: ${e.velocity.average} pts/sprint`,style:{fontSize:24,color:"#6b7280"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"trend",type:"text",position:{x:60,y:18,width:35,height:10,unit:"percent"},content:{type:"text",text:e.velocity.current>=e.velocity.average?"📈 On Track":"📉 Below Average",style:{fontSize:24,color:e.velocity.current>=e.velocity.average?"#059669":"#dc2626",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}],notes:"Review velocity trends. Discuss any significant changes.",durationMs:6e4}}function Oo(e){const t=(e.impediments||[]).slice(0,5).map((n,i)=>{const o=n.status==="resolved"?"✅":n.status==="ongoing"?"🔄":"🚨",r=n.status==="resolved"?"#059669":n.status==="ongoing"?"#d97706":"#dc2626";return{id:`impediment-${i}`,type:"text",position:{x:5,y:25+i*13,width:90,height:11,unit:"percent"},content:{type:"text",text:`${o} ${n.description}${n.owner?` (${n.owner})`:""}`,style:{fontSize:20,color:r,lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:400,delayMs:300+i*150}}});return{id:"slide-impediments",title:"Impediments",layout:"titleContent",background:{type:"solid",color:"#fef2f2"},elements:[{id:"impediments-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:"Impediments & Blockers",style:{fontSize:44,fontWeight:700,color:"#991b1b"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t,{id:"legend-impediments",type:"text",position:{x:5,y:90,width:90,height:5,unit:"percent"},content:{type:"text",text:"✅ Resolved | 🔄 Ongoing | 🚨 Escalated",style:{fontSize:14,color:"#6b7280",textAlign:"center"}}}],notes:"Discuss blockers and what help is needed from stakeholders.",durationMs:6e4}}function Fo(e){const t=e.nextSprint.topPriorities.slice(0,5).map((n,i)=>({id:`priority-${i}`,type:"text",position:{x:5,y:45+i*10,width:90,height:8,unit:"percent"},content:{type:"text",text:`${i+1}. ${n.key}: ${n.title}${n.points?` (${n.points} pts)`:""}`,style:{fontSize:20,color:"#374151",lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+i*100}}));return{id:"slide-next",title:"Next Sprint",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"#eef2ff",position:0},{color:"#e0e7ff",position:100}],gradientDirection:180},elements:[{id:"next-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:`Sprint ${e.sprint.number+1} Preview`,style:{fontSize:44,fontWeight:700,color:"#4338ca"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"next-goal-label",type:"text",position:{x:5,y:18,width:20,height:6,unit:"percent"},content:{type:"text",text:"Sprint Goal:",style:{fontSize:20,fontWeight:600,color:"#6366f1"}}},{id:"next-goal",type:"text",position:{x:5,y:25,width:90,height:12,unit:"percent"},content:{type:"text",text:e.nextSprint.goal,style:{fontSize:28,color:"#1f2937",lineHeight:1.4}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},{id:"priorities-label",type:"text",position:{x:5,y:40,width:30,height:5,unit:"percent"},content:{type:"text",text:"Top Priorities:",style:{fontSize:20,fontWeight:600,color:"#6366f1"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},...t,{id:"capacity",type:"text",position:{x:70,y:5,width:25,height:10,unit:"percent"},content:{type:"text",text:`Capacity: ${e.nextSprint.capacity} pts`,style:{fontSize:20,fontWeight:600,color:"#059669",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}}],notes:"Preview next sprint. Get stakeholder input on priorities.",durationMs:6e4}}function Lo(e){const t=[Po(e),qo(e),Do(e),jo(e)];return e.impediments&&e.impediments.length>0&&t.push(Oo(e)),t.push(Fo(e)),{version:"1.0",id:`sprint-review-${e.sprint.number}`,title:`Sprint ${e.sprint.number} Review - ${e.team.name}`,slideSize:{width:1920,height:1080,unit:"px"},slides:t,theme:{colors:{primary:"#3b82f6",secondary:"#10b981",background:"#fff",text:"#1f2937",accent:"#8b5cf6"},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"},spacing:{base:16}},speakerSettings:{showTimer:!0,showNotes:!0,showNextSlide:!0},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),tags:["sprint-review","agile","scrum"],templateId:"sprint-review-v1"}}}function Wo(){return{sprint:{number:24,name:"Phoenix Release",startDate:"2024-03-04",endDate:"2024-03-15",goal:"Complete user authentication flow and improve dashboard performance by 50%"},team:{name:"Alpha",members:[{name:"Sarah Chen",role:"Tech Lead"},{name:"Mike Johnson",role:"Senior Dev"},{name:"Emily Davis",role:"Frontend Dev"},{name:"Alex Kim",role:"QA Engineer"}]},completed:{stories:[{key:"AUTH-123",title:"OAuth2 integration",points:8,assignee:"Sarah",type:"feature",demo:!0},{key:"AUTH-124",title:"Password reset flow",points:5,assignee:"Mike",type:"feature",demo:!0},{key:"DASH-45",title:"Query optimization",points:8,assignee:"Sarah",type:"tech-debt"},{key:"DASH-46",title:"Caching layer",points:5,assignee:"Mike",type:"feature"},{key:"BUG-89",title:"Login timeout issue",points:3,assignee:"Emily",type:"bug"},{key:"BUG-90",title:"Memory leak in charts",points:5,assignee:"Emily",type:"bug"}],totalPoints:34,committedPoints:40},notCompleted:[{key:"AUTH-125",title:"MFA implementation",points:6,reason:"Blocked by security review"}],demos:[{title:"OAuth2 Login",description:"Full OAuth2 flow with Google and GitHub",presenter:"Sarah"},{title:"Password Reset",description:"Email-based password reset with security tokens",presenter:"Mike"}],velocity:{current:34,history:[{sprint:"S20",points:28},{sprint:"S21",points:32},{sprint:"S22",points:35},{sprint:"S23",points:30}],average:31},metrics:{bugsFixed:2,bugsCreated:1,testCoverage:78,deployments:3,cycleTime:4.2},impediments:[{description:"Security review delayed MFA implementation",status:"ongoing",owner:"Security Team"},{description:"CI pipeline slow - 45min builds",status:"resolved",owner:"DevOps"}],nextSprint:{goal:"Complete MFA implementation and launch beta user onboarding",topPriorities:[{key:"AUTH-125",title:"MFA implementation",points:6},{key:"ONBOARD-01",title:"Welcome wizard",points:8},{key:"ONBOARD-02",title:"User tutorial system",points:5},{key:"DASH-50",title:"Real-time notifications",points:5}],capacity:32}}}function Bo(e){return{id:"slide-title",title:"Architecture Overview",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#0f172a",position:0},{color:"#1e293b",position:100}],gradientDirection:135},elements:[{id:"title-main",type:"text",position:{x:10,y:28,width:80,height:15,unit:"percent"},content:{type:"text",text:e.project.name,style:{fontSize:64,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:0}},{id:"title-subtitle",type:"text",position:{x:15,y:45,width:70,height:8,unit:"percent"},content:{type:"text",text:"Architecture Overview",style:{fontSize:36,color:"#60a5fa",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:500,delayMs:300}},{id:"title-version",type:"text",position:{x:35,y:58,width:30,height:5,unit:"percent"},content:{type:"text",text:`v${e.project.version}`,style:{fontSize:20,color:"#94a3b8",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"title-desc",type:"text",position:{x:15,y:68,width:70,height:12,unit:"percent"},content:{type:"text",text:e.project.description,style:{fontSize:18,color:"#cbd5e1",textAlign:"center",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:700}},...e.project.team?[{id:"title-team",type:"text",position:{x:10,y:88,width:80,height:5,unit:"percent"},content:{type:"text",text:`Team: ${e.project.team}`,style:{fontSize:16,color:"#64748b",textAlign:"center"}}}]:[]],notes:"Introduction to the system architecture. Set context for the audience.",durationMs:3e4}}function Uo(e){const t=e.systemOverview.keyCharacteristics.slice(0,4).map((n,i)=>[{id:`char-card-${i}`,type:"shape",position:{x:5+i*24,y:65,width:22,height:28,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#1e293b",stroke:"#334155",strokeWidth:1,cornerRadius:12},animation:{effect:"slideInUp",durationMs:400,delayMs:600+i*100}},{id:`char-value-${i}`,type:"text",position:{x:7+i*24,y:70,width:18,height:10,unit:"percent"},content:{type:"text",text:n.value,style:{fontSize:32,fontWeight:700,color:"#60a5fa",textAlign:"center"}}},{id:`char-label-${i}`,type:"text",position:{x:7+i*24,y:82,width:18,height:8,unit:"percent"},content:{type:"text",text:n.label,style:{fontSize:14,color:"#94a3b8",textAlign:"center"}}}]).flat();return{id:"slide-overview",title:"System Overview",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"overview-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"System Overview",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"overview-summary",type:"text",position:{x:5,y:18,width:90,height:15,unit:"percent"},content:{type:"text",text:e.systemOverview.summary,style:{fontSize:22,color:"#cbd5e1",lineHeight:1.6}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},{id:"diagram-placeholder",type:"shape",position:{x:20,y:35,width:60,height:25,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#1e293b",stroke:"#334155",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:400}},{id:"diagram-label",type:"text",position:{x:35,y:45,width:30,height:6,unit:"percent"},content:{type:"text",text:"📊 System Diagram",style:{fontSize:18,color:"#64748b",textAlign:"center"}}},...t],notes:"High-level system overview. Explain the main purpose and characteristics.",durationMs:6e4}}function Ho(e){const t={frontend:"#3b82f6",backend:"#10b981",service:"#8b5cf6",database:"#f59e0b",cache:"#ec4899",queue:"#06b6d4",external:"#6b7280"},n={frontend:"🖥️",backend:"⚙️",service:"🔧",database:"🗄️",cache:"⚡",queue:"📬",external:"🔗"},i=e.components.slice(0,6).flatMap((o,r)=>{const a=Math.floor(r/3),s=r%3,c=t[o.type]||"#6b7280",u=n[o.type]||"📦";return[{id:`comp-card-${r}`,type:"shape",position:{x:5+s*32,y:22+a*38,width:29,height:35,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#1e293b",stroke:c,strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:400,delayMs:200+r*100}},{id:`comp-icon-${r}`,type:"text",position:{x:7+s*32,y:25+a*38,width:6,height:8,unit:"percent"},content:{type:"text",text:u,style:{fontSize:28}}},{id:`comp-name-${r}`,type:"text",position:{x:14+s*32,y:26+a*38,width:18,height:6,unit:"percent"},content:{type:"text",text:o.name,style:{fontSize:18,fontWeight:600,color:"#f8fafc"}}},{id:`comp-tech-${r}`,type:"text",position:{x:7+s*32,y:34+a*38,width:25,height:5,unit:"percent"},content:{type:"text",text:o.technology,style:{fontSize:12,color:c,fontWeight:500}}},{id:`comp-desc-${r}`,type:"text",position:{x:7+s*32,y:40+a*38,width:25,height:14,unit:"percent"},content:{type:"text",text:o.description,style:{fontSize:12,color:"#94a3b8",lineHeight:1.4}}}]});return{id:"slide-components",title:"Components",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"components-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"System Components",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...i],notes:"Walk through each component. Explain responsibilities and interactions.",durationMs:9e4}}function Vo(e){const n=[{key:"frontend",label:"Frontend",icon:"🖥️",color:"#3b82f6"},{key:"backend",label:"Backend",icon:"⚙️",color:"#10b981"},{key:"database",label:"Database",icon:"🗄️",color:"#f59e0b"},{key:"infrastructure",label:"Infrastructure",icon:"☁️",color:"#8b5cf6"}].flatMap((i,o)=>{const r=e.techStack[i.key];if(!r||r.length===0)return[];const a=o%2,s=Math.floor(o/2);return[{id:`tech-header-${i.key}`,type:"text",position:{x:5+a*48,y:20+s*40,width:44,height:6,unit:"percent"},content:{type:"text",text:`${i.icon} ${i.label}`,style:{fontSize:24,fontWeight:600,color:i.color}},animation:{effect:"fadeIn",durationMs:400,delayMs:200+o*100}},...r.slice(0,4).map((c,u)=>({id:`tech-item-${i.key}-${u}`,type:"text",position:{x:7+a*48,y:28+s*40+u*7,width:40,height:5,unit:"percent"},content:{type:"text",text:`• ${c.name}${c.version?` v${c.version}`:""} - ${c.purpose}`,style:{fontSize:14,color:"#cbd5e1",lineHeight:1.3}},animation:{effect:"slideInRight",durationMs:300,delayMs:400+o*100+u*50}}))]});return{id:"slide-techstack",title:"Tech Stack",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"techstack-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Technology Stack",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...n],notes:"Overview of technologies used. Explain key decisions.",durationMs:6e4}}function Qo(e){const t=e.infrastructure.services.slice(0,8).map((n,i)=>{const o=i%4,r=Math.floor(i/4);return{id:`infra-svc-${i}`,type:"text",position:{x:5+o*24,y:50+r*15,width:22,height:12,unit:"percent"},content:{type:"text",text:`${n.icon||"☁️"} ${n.name}
102
102
  ${n.purpose}`,style:{fontSize:14,color:"#cbd5e1",textAlign:"center",lineHeight:1.4}},animation:{effect:"zoomIn",durationMs:300,delayMs:400+i*80}}});return{id:"slide-infrastructure",title:"Infrastructure",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"#0f172a",position:0},{color:"#1E1B4B",position:100}],gradientDirection:180},elements:[{id:"infra-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Infrastructure",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"infra-provider",type:"text",position:{x:5,y:18,width:45,height:8,unit:"percent"},content:{type:"text",text:`☁️ Provider: ${e.infrastructure.provider}`,style:{fontSize:24,color:"#a78bfa"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},...e.infrastructure.regions?[{id:"infra-regions",type:"text",position:{x:55,y:18,width:40,height:8,unit:"percent"},content:{type:"text",text:`🌍 Regions: ${e.infrastructure.regions.join(", ")}`,style:{fontSize:18,color:"#94a3b8",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}}]:[],{id:"infra-diagram",type:"shape",position:{x:15,y:28,width:70,height:18,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#1e293b",stroke:"#8b5cf6",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:500,delayMs:350}},{id:"infra-diagram-text",type:"text",position:{x:35,y:35,width:30,height:5,unit:"percent"},content:{type:"text",text:"🏗️ Infrastructure Diagram",style:{fontSize:16,color:"#64748b",textAlign:"center"}}},...t],notes:"Explain infrastructure setup, scaling strategy, and deployment.",durationMs:6e4}}function Ko(e){if(!e.security)return{id:"slide-security",title:"Security",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"security-placeholder",type:"text",position:{x:30,y:45,width:40,height:10,unit:"percent"},content:{type:"text",text:"Security details to be added",style:{fontSize:24,color:"#64748b",textAlign:"center"}}}],durationMs:3e4};const t=e.security.practices.slice(0,6).map((n,i)=>({id:`practice-${i}`,type:"text",position:{x:5,y:55+i*7,width:90,height:5,unit:"percent"},content:{type:"text",text:`✓ ${n}`,style:{fontSize:18,color:"#4ade80"}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+i*100}}));return{id:"slide-security",title:"Security",layout:"titleContent",background:{type:"solid",color:"#0f172a"},elements:[{id:"security-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"🔒 Security",style:{fontSize:44,fontWeight:700,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"security-auth",type:"text",position:{x:5,y:20,width:45,height:10,unit:"percent"},content:{type:"text",text:`🔑 Auth: ${e.security.authMethod}`,style:{fontSize:22,color:"#60a5fa"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"security-encryption",type:"text",position:{x:5,y:30,width:45,height:10,unit:"percent"},content:{type:"text",text:`🔐 Encryption: ${e.security.encryption}`,style:{fontSize:22,color:"#60a5fa"}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},...e.security.compliance?[{id:"security-compliance",type:"text",position:{x:55,y:20,width:40,height:20,unit:"percent"},content:{type:"text",text:`📋 Compliance:
103
103
  ${e.security.compliance.join(`
104
104
  `)}`,style:{fontSize:18,color:"#94a3b8",lineHeight:1.6}},animation:{effect:"fadeIn",durationMs:400,delayMs:400}}]:[],{id:"practices-header",type:"text",position:{x:5,y:45,width:90,height:8,unit:"percent"},content:{type:"text",text:"Security Practices",style:{fontSize:24,fontWeight:600,color:"#f8fafc"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},...t],notes:"Cover security measures and compliance requirements.",durationMs:6e4}}function Yo(e){const t=[Bo(e),Uo(e),Ho(e),Vo(e),Qo(e)];return e.security&&t.push(Ko(e)),{version:"1.0",id:`architecture-${e.project.name.toLowerCase().replace(/\s+/g,"-")}`,title:`${e.project.name} - Architecture Overview`,slideSize:{width:1920,height:1080,unit:"px"},slides:t,theme:{colors:{primary:"#3b82f6",secondary:"#8b5cf6",background:"#0f172a",text:"#f8fafc",accent:"#10b981"},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"},spacing:{base:16}},speakerSettings:{showTimer:!0,showNotes:!0,showNextSlide:!0},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),tags:["architecture","technical","system-design"],templateId:"architecture-overview-v1"}}}function Xo(){return{project:{name:"E-Commerce Platform",version:"2.5.0",description:"Scalable microservices-based e-commerce platform serving 10M+ users",team:"Platform Engineering"},systemOverview:{summary:"A modern e-commerce platform built on microservices architecture, designed for high availability, horizontal scaling, and real-time inventory management. The system handles 50K+ concurrent users with sub-100ms response times.",keyCharacteristics:[{label:"Services",value:"12"},{label:"Availability",value:"99.9%"},{label:"Response Time",value:"<100ms"},{label:"Daily Orders",value:"500K+"}]},components:[{name:"Web App",type:"frontend",description:"React SPA with SSR support",technology:"Next.js 14"},{name:"Mobile BFF",type:"backend",description:"Backend for mobile apps",technology:"Node.js/Express"},{name:"Order Service",type:"service",description:"Order processing and management",technology:"Go"},{name:"Inventory Service",type:"service",description:"Real-time stock management",technology:"Rust"},{name:"PostgreSQL",type:"database",description:"Primary transactional database",technology:"PostgreSQL 15"},{name:"Redis Cluster",type:"cache",description:"Session and caching layer",technology:"Redis 7"}],dataFlow:{description:"Request flows from CDN through API Gateway to microservices",steps:[{from:"Client",to:"CDN",description:"Static assets",protocol:"HTTPS"},{from:"Client",to:"API Gateway",description:"API requests",protocol:"HTTPS"},{from:"API Gateway",to:"Services",description:"Routed requests",protocol:"gRPC"},{from:"Services",to:"Message Queue",description:"Async events",protocol:"AMQP"}]},techStack:{frontend:[{name:"Next.js",version:"14",purpose:"React framework with SSR"},{name:"TypeScript",version:"5.3",purpose:"Type safety"},{name:"Tailwind CSS",version:"3.4",purpose:"Styling"}],backend:[{name:"Go",version:"1.21",purpose:"High-performance services"},{name:"Node.js",version:"20",purpose:"BFF and tooling"},{name:"gRPC",purpose:"Service communication"}],database:[{name:"PostgreSQL",version:"15",purpose:"Primary OLTP"},{name:"Redis",version:"7",purpose:"Caching"},{name:"Elasticsearch",version:"8",purpose:"Search"}],infrastructure:[{name:"Kubernetes",purpose:"Container orchestration"},{name:"Terraform",purpose:"Infrastructure as Code"},{name:"ArgoCD",purpose:"GitOps deployments"}]},infrastructure:{provider:"AWS",regions:["us-east-1","eu-west-1","ap-southeast-1"],services:[{name:"EKS",purpose:"Kubernetes",icon:"⚙️"},{name:"RDS",purpose:"PostgreSQL",icon:"🗄️"},{name:"ElastiCache",purpose:"Redis",icon:"⚡"},{name:"S3",purpose:"Object Storage",icon:"📦"},{name:"CloudFront",purpose:"CDN",icon:"🌐"},{name:"Route 53",purpose:"DNS",icon:"🔗"},{name:"SQS/SNS",purpose:"Messaging",icon:"📬"},{name:"CloudWatch",purpose:"Monitoring",icon:"📊"}]},security:{authMethod:"OAuth 2.0 + JWT",encryption:"AES-256 at rest, TLS 1.3 in transit",compliance:["SOC 2 Type II","PCI DSS","GDPR"],practices:["Zero-trust network architecture","Secrets managed via HashiCorp Vault","Regular penetration testing","Automated vulnerability scanning","Role-based access control (RBAC)","Audit logging for all operations"]}}}function Go(e){return{id:"slide-welcome",title:"Welcome",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"#7c3aed",position:0},{color:"#a78bfa",position:50},{color:"#c4b5fd",position:100}],gradientDirection:135},elements:[{id:"welcome-title",type:"text",position:{x:10,y:20,width:80,height:15,unit:"percent"},content:{type:"text",text:`Welcome to ${e.company.name}! 🎉`,style:{fontSize:56,fontWeight:700,color:"#fff",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:700,delayMs:0}},{id:"welcome-name",type:"text",position:{x:15,y:42,width:70,height:12,unit:"percent"},content:{type:"text",text:e.newHire.name,style:{fontSize:48,fontWeight:600,color:"#fff",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:600,delayMs:400}},{id:"welcome-role",type:"text",position:{x:20,y:56,width:60,height:8,unit:"percent"},content:{type:"text",text:e.newHire.role,style:{fontSize:28,color:"#ede9fe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:500,delayMs:600}},{id:"welcome-team",type:"text",position:{x:25,y:66,width:50,height:6,unit:"percent"},content:{type:"text",text:`Team: ${e.newHire.team}`,style:{fontSize:22,color:"#ddd6fe",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:750}},{id:"welcome-date",type:"text",position:{x:30,y:75,width:40,height:5,unit:"percent"},content:{type:"text",text:`Start Date: ${e.newHire.startDate}`,style:{fontSize:18,color:"#c4b5fd",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:900}},...e.company.tagline?[{id:"welcome-tagline",type:"text",position:{x:15,y:88,width:70,height:5,unit:"percent"},content:{type:"text",text:`"${e.company.tagline}"`,style:{fontSize:18,fontStyle:"italic",color:"#ede9fe",textAlign:"center"}}}]:[]],notes:"Warm welcome! Make the new hire feel excited to join.",durationMs:3e4}}function Jo(e){const t=e.culture.values.slice(0,4).flatMap((n,i)=>{const o=i%2,r=Math.floor(i/2);return[{id:`value-card-${i}`,type:"shape",position:{x:5+o*48,y:45+r*27,width:44,height:24,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"#fff",stroke:"#e9d5ff",strokeWidth:2,cornerRadius:12},animation:{effect:"zoomIn",durationMs:400,delayMs:500+i*150}},{id:`value-icon-${i}`,type:"text",position:{x:8+o*48,y:48+r*27,width:8,height:10,unit:"percent"},content:{type:"text",text:n.icon||"✨",style:{fontSize:36}}},{id:`value-name-${i}`,type:"text",position:{x:17+o*48,y:49+r*27,width:30,height:6,unit:"percent"},content:{type:"text",text:n.name,style:{fontSize:20,fontWeight:600,color:"#6d28d9"}}},{id:`value-desc-${i}`,type:"text",position:{x:8+o*48,y:58+r*27,width:38,height:10,unit:"percent"},content:{type:"text",text:n.description,style:{fontSize:14,color:"#6b7280",lineHeight:1.4}}}]});return{id:"slide-culture",title:"Culture & Values",layout:"titleContent",background:{type:"solid",color:"#faf5ff"},elements:[{id:"culture-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Our Culture & Values",style:{fontSize:44,fontWeight:700,color:"#6d28d9"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"culture-mission-label",type:"text",position:{x:5,y:18,width:20,height:5,unit:"percent"},content:{type:"text",text:"🎯 Our Mission",style:{fontSize:18,fontWeight:600,color:"#7c3aed"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"culture-mission",type:"text",position:{x:5,y:25,width:90,height:15,unit:"percent"},content:{type:"text",text:e.culture.mission,style:{fontSize:24,color:"#374151",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:500,delayMs:350}},...t],notes:"Explain company culture and core values. Share real examples.",durationMs:9e4}}function Zo(e){const t=e.team.members.slice(0,8).map((n,i)=>{const o=i%4,r=Math.floor(i/4);return{id:`member-${i}`,type:"text",position:{x:5+o*24,y:40+r*25,width:22,height:22,unit:"percent"},content:{type:"text",text:`👤
@@ -130,7 +130,7 @@ SLA Violation`,style:{fontSize:18,color:e.impact.slaViolation?"#f87171":"#4ade80
130
130
  translate(-${e.anchor.x*100}%, -${e.anchor.y*100}%)
131
131
  scale(${i})
132
132
  rotate(${o}deg)
133
- `,opacity:r,transformOrigin:`${e.anchor.x*100}% ${e.anchor.y*100}%`};return e.type==="image"||e.type==="sprite"?d.createElement("img",{src:e.asset,style:{...a,width:e.width,height:e.height,pointerEvents:"none"},alt:e.name}):e.type==="vector"?d.createElement("div",{style:a,dangerouslySetInnerHTML:{__html:e.asset}}):e.type==="text"?d.createElement("div",{style:a},e.asset):d.createElement("div",{style:a})}function xt({text:e,speakerName:t,style:n={},targetPosition:i,visible:o,typewriterProgress:r=1}){if(!o)return null;const{position:a="bottom",backgroundColor:s="rgba(0, 0, 0, 0.85)",textColor:c="#fff",fontSize:u=18,maxWidth:m=600}=n,p=e.slice(0,Math.floor(e.length*r)),h={position:"absolute",maxWidth:m,padding:"16px 24px",backgroundColor:s,color:c,fontSize:u,borderRadius:12,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)",zIndex:1e3};switch(a){case"bottom":Object.assign(h,{bottom:20,left:"50%",transform:"translateX(-50%)",width:"90%"});break;case"top":Object.assign(h,{top:20,left:"50%",transform:"translateX(-50%)",width:"90%"});break;case"center":Object.assign(h,{top:"50%",left:"50%",transform:"translate(-50%, -50%)"});break;case"bubble":i&&Object.assign(h,{left:i.x,bottom:i.y+20,transform:"translateX(-50%)"});break}return d.createElement("div",{style:h},t&&d.createElement("div",{style:{fontWeight:"bold",marginBottom:8,color:"#60a5fa"}},t),d.createElement("div",null,p))}function Nr(e,t,n){const[i,o]=d.useState({offsetX:0,offsetY:0}),r=d.useRef(null);return d.useEffect(()=>{if(!n){o({offsetX:0,offsetY:0});return}r.current=performance.now();let a;const s=c=>{const u=c-r.current;if(u>=t){o({offsetX:0,offsetY:0});return}const p=1-u/t,h=(Math.random()-.5)*2*e*p,f=(Math.random()-.5)*2*e*p;o({offsetX:h,offsetY:f}),a=requestAnimationFrame(s)};return a=requestAnimationFrame(s),()=>{cancelAnimationFrame(a)}},[n,e,t]),i}const de={linear:e=>e,easeIn:e=>e*e,easeOut:e=>e*(2-e),easeInOut:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0||e===1?e:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI),easeOutElastic:e=>e===0||e===1?e:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1,easeInOutElastic:e=>e===0||e===1?e:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1),easeInBounce:e=>1-de.easeOutBounce(1-e),easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,easeInOutBounce:e=>e<.5?de.easeInBounce(e*2)*.5:de.easeOutBounce(e*2-1)*.5+.5,step:e=>Math.round(e)};function bt(e){return de[e]||de.linear}function re(e,t,n){return e+(t-e)*n}function Ie(e,t,n){return{x:re(e.x,t.x,n),y:re(e.y,t.y,n)}}class vt{constructor(t){this.currentTime=0,this.scene=t.scene,this.characterDefs=new Map(t.characterDefs.map(n=>[n.id,n])),this.typewriterSpeed=t.typewriterSpeed||30,this.onAudioCommand=t.onAudioCommand}evaluate(t){this.currentTime=t;const n=this.evaluateAllCharacters(t),i=this.evaluateCamera(t),o=this.evaluateDialogue(t),r=this.evaluateEffects(t),a=this.evaluateAudio(t);return{characterStates:n,camera:i,activeDialogue:o,activeEffects:r,audioCommands:a}}getDuration(){return this.scene.duration}findSurroundingKeyframes(t,n){const i=t.keyframes;if(i.length===0)return{prev:null,next:null,progress:0};let o=-1;for(let h=0;h<i.length&&i[h].time<=n;h++)o=h;if(o===-1)return{prev:null,next:i[0],progress:0};const r=i[o],a=i[o+1]||null;if(!a)return{prev:r,next:null,progress:1};const s=a.time-r.time,c=n-r.time,u=s>0?c/s:0,p=bt(r.easing||"linear")(Math.min(1,Math.max(0,u)));return{prev:r,next:a,progress:p}}evaluateAllCharacters(t){const n=new Map;for(const i of this.scene.cast){const o=this.evaluateCharacter(i.instanceId,t);n.set(i.instanceId,o)}return n}evaluateCharacter(t,n){var a;const i=this.scene.cast.find(s=>s.instanceId===t);if(!i)return this.createDefaultCharacterState();const o=this.characterDefs.get(i.characterId);let r={instanceId:t,characterId:i.characterId,position:{...i.position},scale:i.scale,rotation:i.rotation,opacity:i.opacity??1,flipX:i.flipX??!1,visible:!0,currentAnimation:i.initialAnimation||(((a=o==null?void 0:o.animations[0])==null?void 0:a.id)??""),animationFrame:0,animationStartTime:0,currentExpression:i.initialExpression??""};for(const s of this.scene.timeline)if(s.targetId===t)switch(s.type){case"animation":r=this.applyAnimationTrack(s,r,n);break;case"transform":r=this.applyTransformTrack(s,r,n);break;case"expression":r=this.applyExpressionTrack(s,r,n);break}if(o&&r.currentAnimation){const s=o.animations.find(c=>c.id===r.currentAnimation);if(s){const c=(n-r.animationStartTime)%(s.duration||s.frames.length/s.fps*1e3),u=Math.floor(c/1e3*s.fps)%s.frames.length;r.animationFrame=u}}return r}createDefaultCharacterState(){return{instanceId:"",characterId:"",position:{x:0,y:0},scale:1,rotation:0,opacity:1,flipX:!1,visible:!1,currentAnimation:"",animationFrame:0,animationStartTime:0,currentExpression:""}}applyAnimationTrack(t,n,i){const{prev:o}=this.findSurroundingKeyframes(t,i);if(o){const r=o.value;return{...n,currentAnimation:r.animationId,animationStartTime:o.time}}return n}applyTransformTrack(t,n,i){const{prev:o,next:r,progress:a}=this.findSurroundingKeyframes(t,i);if(!o)return n;const s=o.value,c=r?r.value:null;return c?{...n,position:s.position&&c.position?Ie(s.position,c.position,a):s.position??n.position,scale:s.scale!==void 0&&c.scale!==void 0?re(s.scale,c.scale,a):s.scale??n.scale,rotation:s.rotation!==void 0&&c.rotation!==void 0?re(s.rotation,c.rotation,a):s.rotation??n.rotation,opacity:s.opacity!==void 0&&c.opacity!==void 0?re(s.opacity,c.opacity,a):s.opacity??n.opacity}:{...n,position:s.position??n.position,scale:s.scale??n.scale,rotation:s.rotation??n.rotation,opacity:s.opacity??n.opacity}}applyExpressionTrack(t,n,i){const{prev:o}=this.findSurroundingKeyframes(t,i);if(o){const r=o.value;return{...n,currentExpression:r.expressionId}}return n}evaluateCamera(t){let n=this.scene.camera?{...this.scene.camera}:{position:{x:640,y:360},zoom:1,rotation:0};for(const i of this.scene.timeline){if(i.type!=="camera")continue;const{prev:o,next:r,progress:a}=this.findSurroundingKeyframes(i,t);if(!o)continue;const s=o.value,c=r?r.value:null;c?n={position:s.position&&c.position?Ie(s.position,c.position,a):s.position??n.position,zoom:s.zoom!==void 0&&c.zoom!==void 0?re(s.zoom,c.zoom,a):s.zoom??n.zoom,rotation:s.rotation!==void 0&&c.rotation!==void 0?re(s.rotation,c.rotation,a):s.rotation??n.rotation}:n={position:s.position??n.position,zoom:s.zoom??n.zoom,rotation:s.rotation??n.rotation}}return n}evaluateDialogue(t){for(const n of this.scene.timeline){if(n.type!=="dialogue")continue;const{prev:i}=this.findSurroundingKeyframes(n,t);if(i){const o=i.value,r=i.time+(i.duration??0);if(t>=i.time&&t<r){const a=t-i.time,s=o.text.length/this.typewriterSpeed*1e3,c=Math.min(1,a/s);return{text:o.text,speakerId:n.targetId,typewriterProgress:c}}}}return null}evaluateEffects(t){const n=[];for(const i of this.scene.timeline)if(i.type==="effect")for(const o of i.keyframes){const r=o.value,a=o.time+(o.duration??0);if(t>=o.time&&t<a){const s=o.duration?(t-o.time)/o.duration:1;n.push({effectId:i.id+"_"+o.time,type:r.effectType,params:r.params,startTime:o.time,duration:o.duration??0,progress:s})}}return n}evaluateAudio(t){const n=[];for(const i of this.scene.timeline)if(i.type==="audio")for(const o of i.keyframes){const r=o.value;Math.abs(t-o.time)<50&&n.push({trackId:i.targetId,command:r.action,time:t})}return n}}class Rr{constructor(t,n,i){this.track={id:i||`track_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:t,targetId:n,keyframes:[]}}addAnimationKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:(i==null?void 0:i.easing)??"linear",value:{type:"animation",animationId:n,speed:(i==null?void 0:i.speed)??1}}),this}addTransformKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:i??"easeInOut",value:{type:"transform",...n}}),this}addExpressionKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:(i==null?void 0:i.easing)??"easeOut",duration:(i==null?void 0:i.transition)??200,value:{type:"expression",expressionId:n}}),this}addDialogueKeyframe(t,n,i,o){return this.track.keyframes.push({time:t,duration:i,easing:(o==null?void 0:o.easing)??"linear",value:{type:"dialogue",text:n,audioClip:o==null?void 0:o.voiceOver,style:o==null?void 0:o.style}}),this}addCameraKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:i??"easeInOut",value:{type:"camera",...n}}),this}addEffectKeyframe(t,n,i,o,r){return this.track.keyframes.push({time:t,duration:i,easing:r??"linear",value:{type:"effect",effectType:n,params:o??{}}}),this}build(){return this.track.keyframes.sort((t,n)=>t.time-n.time),this.track}}class Pr{constructor(t,n,i){this.scene={id:t,title:n,duration:i,background:{type:"solid",color:"#000000"},cast:[],scenery:[],timeline:[],camera:{position:{x:640,y:360},zoom:1,rotation:0}}}setBackground(t){return this.scene.background=t,this}setCamera(t){return this.scene.camera=t,this}setTransition(t){return this.scene.transition=t,this}addCastMember(t,n,i){return this.scene.cast.push({instanceId:t,characterId:n,position:i.position??{x:640,y:360},scale:i.scale??1,rotation:i.rotation??0,zIndex:i.zIndex??this.scene.cast.length,initialAnimation:i.initialAnimation,initialExpression:i.initialExpression,opacity:i.opacity??1,flipX:i.flipX??!1}),this}addProp(t,n,i){return this.scene.scenery.push({instanceId:t,propId:n,position:i.position??{x:640,y:360},scale:i.scale??1,rotation:i.rotation??0,zIndex:i.zIndex??this.scene.scenery.length,opacity:i.opacity??1}),this}addTrack(t){return this.scene.timeline.push(t),this}addAudio(t){return this.scene.audio=t,this}build(){return this.scene}}function qr(e){return JSON.parse(JSON.stringify(e))}function St(e){if(e.keyframes.length===0)return 0;const t=e.keyframes[e.keyframes.length-1];return"duration"in t&&typeof t.duration=="number"?t.time+t.duration:t.time}function Dr(e){let t=0;for(const n of e.timeline){const i=St(n);i>t&&(t=i)}return Math.max(e.duration,t)}function jr(e,t){return Math.floor(e/1e3*t)}function Or(e,t){return e/t*1e3}function Fr(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),i=t%60,o=Math.floor(e%1e3/10);return`${n.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}.${o.toString().padStart(2,"0")}`}function Lr(e){const t=e.match(/^(\d+):(\d{2})(?:\.(\d{2}))?$/);if(!t)return 0;const n=parseInt(t[1],10),i=parseInt(t[2],10),o=t[3]?parseInt(t[3],10)*10:0;return(n*60+i)*1e3+o}const wt=d.createContext(null);function Wr(){const e=d.useContext(wt);if(!e)throw new Error("usePuppetPlayer must be used within PuppetPlayerProvider");return e}class Br{constructor(){this.audioElements=new Map,this.volume=1,this.muted=!1}preloadAudio(t,n){return new Promise((i,o)=>{const r=new Audio(n);r.preload="auto",r.volume=this.volume,r.muted=this.muted,r.addEventListener("canplaythrough",()=>i(),{once:!0}),r.addEventListener("error",o,{once:!0}),this.audioElements.set(t,r)})}play(t,n){const i=this.audioElements.get(t);i&&(n!==void 0&&(i.currentTime=n/1e3),i.play().catch(()=>{}))}pause(t){const n=this.audioElements.get(t);n&&n.pause()}stop(t){const n=this.audioElements.get(t);n&&(n.pause(),n.currentTime=0)}stopAll(){this.audioElements.forEach(t=>{t.pause(),t.currentTime=0})}setVolume(t){this.volume=Math.max(0,Math.min(1,t)),this.audioElements.forEach(n=>{n.volume=this.volume})}setMuted(t){this.muted=t,this.audioElements.forEach(n=>{n.muted=t})}dispose(){this.stopAll(),this.audioElements.clear()}}function kt(e){const{document:t,autoPlay:n=!1,loop:i=!1,initialVolume:o=1,initialSpeed:r=1}=e,[a,s]=d.useState({isPlaying:!1,isPaused:!1,currentSceneIndex:0,currentTime:0,totalDuration:0,playbackSpeed:r,volume:o,isMuted:!1,characterStates:new Map,activeEffects:[],loop:i}),[c,u]=d.useState(null),m=d.useRef(null),p=d.useRef(0),h=d.useRef(new Br),f=d.useRef(null),g=d.useRef(new $e),y=d.useMemo(()=>t.scenes.reduce((C,$)=>C+$.duration,0),[t.scenes]),v=d.useMemo(()=>t.scenes[a.currentSceneIndex]||null,[t.scenes,a.currentSceneIndex]);d.useEffect(()=>{v&&(f.current=new vt({scene:v,characterDefs:t.characters,onAudioCommand:(C,$,I)=>{const q=h.current;switch($){case"play":q.play(C,I);break;case"pause":q.pause(C);break;case"stop":q.stop(C);break}}}))},[v,t.characters]),d.useEffect(()=>{var $;const C=h.current;return($=t.audioTracks)==null||$.forEach(I=>{I.src&&C.preloadAudio(I.id,I.src).catch(()=>{})}),()=>{C.dispose()}},[t.audioTracks]);const k=d.useCallback(C=>{if(!f.current)return;const $=C-p.current;p.current=C,s(I=>{var W,J,N;if(!I.isPlaying||I.isPaused)return I;const q=I.currentTime+$*I.playbackSpeed,F=(v==null?void 0:v.duration)??0;if(q>=F){const M=I.currentSceneIndex+1;return M>=t.scenes.length?I.loop?((W=e.onSceneChange)==null||W.call(e,0,t.scenes[0]),{...I,currentSceneIndex:0,currentTime:0}):((J=e.onEnd)==null||J.call(e),{...I,isPlaying:!1,isPaused:!1,currentTime:F}):((N=e.onSceneChange)==null||N.call(e,M,t.scenes[M]),{...I,currentSceneIndex:M,currentTime:0})}return{...I,currentTime:q}}),m.current=requestAnimationFrame(k)},[v,t.scenes,e]);d.useEffect(()=>(a.isPlaying&&!a.isPaused?(p.current=performance.now(),m.current=requestAnimationFrame(k)):m.current&&cancelAnimationFrame(m.current),()=>{m.current&&cancelAnimationFrame(m.current)}),[a.isPlaying,a.isPaused,k]),d.useEffect(()=>{if(f.current){const C=f.current.evaluate(a.currentTime);u(C),C.audioCommands.forEach($=>{const I=h.current;switch($.command){case"play":I.play($.trackId);break;case"pause":I.pause($.trackId);break;case"stop":I.stop($.trackId);break}}),s($=>({...$,characterStates:C.characterStates,activeEffects:C.activeEffects}))}},[a.currentTime]),d.useEffect(()=>{n&&s(C=>({...C,isPlaying:!0}))},[n]);const b=d.useCallback(()=>{s(C=>({...C,isPlaying:!0,isPaused:!1}))},[]),S=d.useCallback(()=>{s(C=>({...C,isPaused:!0})),h.current.stopAll()},[]),_=d.useCallback(()=>{s(C=>({...C,isPlaying:!1,isPaused:!1,currentTime:0,currentSceneIndex:0})),h.current.stopAll()},[]),R=d.useCallback(C=>{s($=>({...$,currentTime:Math.max(0,Math.min(C,(v==null?void 0:v.duration)??0))}))},[v]),j=d.useCallback(C=>{var $;C>=0&&C<t.scenes.length&&(h.current.stopAll(),s(I=>({...I,currentSceneIndex:C,currentTime:0})),($=e.onSceneChange)==null||$.call(e,C,t.scenes[C]))},[t.scenes,e]),Q=d.useCallback(C=>{s($=>({...$,playbackSpeed:Math.max(.25,Math.min(4,C))}))},[]),A=d.useCallback(C=>{const $=Math.max(0,Math.min(1,C));h.current.setVolume($),s(I=>({...I,volume:$}))},[]),P=d.useCallback(()=>{s(C=>{const $=!C.isMuted;return h.current.setMuted($),{...C,isMuted:$}})},[]),L=d.useCallback(()=>{j(a.currentSceneIndex+1)},[a.currentSceneIndex,j]),H=d.useCallback(()=>{j(a.currentSceneIndex-1)},[a.currentSceneIndex,j]),X=d.useCallback(C=>{s($=>({...$,loop:C}))},[]);return{playerState:{...a,totalDuration:y},timelineState:c,characterRegistry:g.current,play:b,pause:S,stop:_,seek:R,seekToScene:j,setPlaybackSpeed:Q,setVolume:A,toggleMute:P,nextScene:L,previousScene:H,setLoop:X}}function It({document:e,autoPlay:t=!1,loop:n=!1,showControls:i=!0,className:o,style:r,onSceneChange:a,onEnd:s}){var Q;const{playerState:c,timelineState:u,characterRegistry:m,play:p,pause:h,stop:f,seek:g,seekToScene:y,setPlaybackSpeed:v,setVolume:k,toggleMute:b,nextScene:S,previousScene:_,setLoop:R}=kt({document:e,autoPlay:t,loop:n,onSceneChange:a,onEnd:s}),j=e.scenes[c.currentSceneIndex];return j?d.createElement(wt.Provider,{value:{document:e,playerState:c,play:p,pause:h,stop:f,seek:g,seekToScene:y,setPlaybackSpeed:v,setVolume:k,toggleMute:b,nextScene:S,previousScene:_,setLoop:R}},d.createElement("div",{className:o,style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",backgroundColor:"#000",...r}},d.createElement("div",{style:{flex:1,position:"relative"}},d.createElement(gt,{document:e,scene:j,characterStates:c.characterStates,camera:(u==null?void 0:u.camera)??j.camera??{position:{x:640,y:360},zoom:1,rotation:0},activeEffects:c.activeEffects,characterRegistry:m}),(u==null?void 0:u.activeDialogue)&&d.createElement(xt,{text:u.activeDialogue.text,speakerName:(Q=e.characters.find(A=>{var P;return A.id===((P=u.activeDialogue)==null?void 0:P.speakerId)}))==null?void 0:Q.name,visible:!0,typewriterProgress:u.activeDialogue.typewriterProgress})),i&&d.createElement(Ur,{playerState:c,currentScene:j,totalScenes:e.scenes.length,onPlay:p,onPause:h,onStop:f,onSeek:g,onPreviousScene:_,onNextScene:S,onSpeedChange:v,onVolumeChange:k,onToggleMute:b,onToggleLoop:()=>R(!c.loop)}))):d.createElement("div",{className:o,style:r},"No scenes")}function Ur({playerState:e,currentScene:t,totalScenes:n,onPlay:i,onPause:o,onStop:r,onSeek:a,onPreviousScene:s,onNextScene:c,onSpeedChange:u,onVolumeChange:m,onToggleMute:p,onToggleLoop:h}){const f=b=>{const S=Math.floor(b/1e3),_=Math.floor(S/60),R=S%60;return`${_}:${R.toString().padStart(2,"0")}`},g=t.duration>0?e.currentTime/t.duration*100:0,y={display:"flex",alignItems:"center",gap:8,padding:"12px 16px",backgroundColor:"var(--nice-overlay-90, rgba(0, 0, 0, 0.9))",color:"var(--nice-text-on-primary, #fff)"},v={background:"none",border:"none",color:"#fff",cursor:"pointer",padding:"8px",fontSize:16,opacity:.9},k={flex:1,height:4,backgroundColor:"var(--nice-border-color, #444)",borderRadius:2,cursor:"pointer"};return d.createElement("div",{style:y},d.createElement("button",{style:v,onClick:e.isPlaying&&!e.isPaused?o:i,title:e.isPlaying&&!e.isPaused?"Pause":"Play"},d.createElement(E.NiceIcon,{name:e.isPlaying&&!e.isPaused?"pause":"play",size:16})),d.createElement("button",{style:v,onClick:r,title:"Stop","aria-label":"Stop"},d.createElement(E.NiceIcon,{name:"stop",size:16})),d.createElement("button",{style:{...v,opacity:e.currentSceneIndex>0?.9:.3},onClick:s,disabled:e.currentSceneIndex<=0,title:"Previous Scene","aria-label":"Previous Scene"},d.createElement(E.NiceIcon,{name:"skip-back",size:16})),d.createElement("button",{style:{...v,opacity:e.currentSceneIndex<n-1?.9:.3},onClick:c,disabled:e.currentSceneIndex>=n-1,title:"Next Scene","aria-label":"Next Scene"},d.createElement(E.NiceIcon,{name:"skip-forward",size:16})),d.createElement("span",{style:{fontSize:12,fontFamily:"monospace"}},`${f(e.currentTime)} / ${f(t.duration)}`),d.createElement("div",{style:k,onClick:b=>{const S=b.currentTarget.getBoundingClientRect(),R=(b.clientX-S.left)/S.width;a(R*t.duration)}},d.createElement("div",{style:{width:`${g}%`,height:"100%",backgroundColor:"var(--nice-primary-light, #60a5fa)",borderRadius:2}})),d.createElement("select",{value:e.playbackSpeed,onChange:b=>u(parseFloat(b.target.value)),style:{background:"var(--nice-text, #333)",color:"var(--nice-text-inverse, #fff)",border:"none",padding:"4px 8px",borderRadius:4,fontSize:12}},d.createElement("option",{value:.25},"0.25x"),d.createElement("option",{value:.5},"0.5x"),d.createElement("option",{value:1},"1x"),d.createElement("option",{value:1.5},"1.5x"),d.createElement("option",{value:2},"2x")),d.createElement("button",{style:v,onClick:p,title:e.isMuted?"Unmute":"Mute"},d.createElement(E.NiceIcon,{name:e.isMuted?"volume-off":"volume",size:16})),d.createElement("input",{type:"range",min:0,max:1,step:.1,value:e.volume,onChange:b=>m(parseFloat(b.target.value)),style:{width:60}}),d.createElement("button",{style:{...v,color:e.loop?"var(--nice-primary-light, #60a5fa)":"#fff"},onClick:h,title:"Loop","aria-label":"Loop","aria-pressed":e.loop},d.createElement(E.NiceIcon,{name:"refresh",size:16})),d.createElement("span",{style:{fontSize:12}},`Scene ${e.currentSceneIndex+1}/${n}`))}function Hr({document:e,width:t=320,height:n=240,autoPlay:i=!1,className:o,style:r}){return d.createElement(It,{document:e,autoPlay:i,showControls:!1,className:o,style:{width:t,height:n,borderRadius:8,overflow:"hidden",...r}})}function Ct(e,t,n){var a,s,c,u;const i=t.assets.find(m=>m.id===e.assetId),o=[];if(e.animations)for(const[m,p]of Object.entries(e.animations)){const h=p.frames.map((f,g)=>({frameId:`${m}_frame_${g}`,duration:f.duration||1e3/p.fps,offset:{x:0,y:0}}));o.push({id:`anim_${m}`,name:m,category:$t(m),frames:h,fps:p.fps,loop:p.loop,duration:h.reduce((f,g)=>f+(g.duration??0),0)})}const r={};if(e.animations)for(const[m,p]of Object.entries(e.animations))p.frames.forEach((h,f)=>{r[`${m}_frame_${f}`]={frame:{x:h.srcRect.x,y:h.srcRect.y,w:h.srcRect.width,h:h.srcRect.height},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:h.srcRect.width,h:h.srcRect.height},sourceSize:{w:h.srcRect.width,h:h.srcRect.height}}});return{id:`char_${e.id}`,name:e.name,type:"sprite",visual:{type:"sprite",spriteSheet:(i==null?void 0:i.path)||"",atlas:{frames:r,meta:{image:(i==null?void 0:i.path)||"",size:{w:((a=i==null?void 0:i.metadata)==null?void 0:a.width)||e.width,h:((s=i==null?void 0:i.metadata)==null?void 0:s.height)||e.height},scale:1}},width:((c=i==null?void 0:i.metadata)==null?void 0:c.width)||e.width||100,height:((u=i==null?void 0:i.metadata)==null?void 0:u.height)||e.height||100},anchor:e.anchor||{x:.5,y:1},animations:o,expressions:[],defaultScale:1}}function Mt(e,t,n){var u,m,p,h;const{sprite:i,animator:o,transform:r}=e.components;if(!i)return null;const a=t.assets.find(f=>f.id===i.assetId),s=[];if(o!=null&&o.animations)for(const[f,g]of Object.entries(o.animations)){const y=g.frames.map((v,k)=>({frameId:`${f}_frame_${k}`,duration:v.duration||1e3/g.fps,offset:{x:0,y:0}}));s.push({id:`anim_${f}`,name:f,category:$t(f),frames:y,fps:g.fps,loop:g.loop,duration:y.reduce((v,k)=>v+(k.duration??0),0)})}const c={};if(o!=null&&o.animations)for(const[f,g]of Object.entries(o.animations))g.frames.forEach((y,v)=>{c[`${f}_frame_${v}`]={frame:{x:y.srcRect.x,y:y.srcRect.y,w:y.srcRect.width,h:y.srcRect.height},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:y.srcRect.width,h:y.srcRect.height},sourceSize:{w:y.srcRect.width,h:y.srcRect.height}}});return{id:`char_${e.id}`,name:e.name,type:"sprite",visual:{type:"sprite",spriteSheet:(a==null?void 0:a.path)||"",atlas:{frames:c,meta:{image:(a==null?void 0:a.path)||"",size:{w:((u=a==null?void 0:a.metadata)==null?void 0:u.width)||i.width,h:((m=a==null?void 0:a.metadata)==null?void 0:m.height)||i.height},scale:1}},width:((p=a==null?void 0:a.metadata)==null?void 0:p.width)||i.width||100,height:((h=a==null?void 0:a.metadata)==null?void 0:h.height)||i.height||100},anchor:i.anchor||{x:.5,y:1},animations:s,expressions:[],defaultScale:1}}function zt(e,t){var n,i;return e.type!=="image"&&e.type!=="spritesheet"?null:{id:`prop_${e.id}`,name:e.name,type:"image",asset:e.path,width:((n=e.metadata)==null?void 0:n.width)||100,height:((i=e.metadata)==null?void 0:i.height)||100,anchor:{x:.5,y:.5}}}function Vr(e,t){const n=[];for(const i of e.sprites)n.push(Ct(i,e));for(const i of e.entities){const o=Mt(i,e);o&&n.push(o)}return n}function Qr(e,t){const n=[];for(const i of e.assets){const o=zt(i);o&&n.push(o)}return n}function At(e){const t={};for(const o of e.animations){const r=[];if(e.visual.atlas)for(const a of o.frames){const s=e.visual.atlas.frames[a.frameId];s&&r.push({assetId:e.id+"_sheet",srcRect:{x:s.frame.x,y:s.frame.y,width:s.frame.w,height:s.frame.h},duration:a.duration})}t[o.name]={frames:r,fps:o.fps,loop:o.loop}}let n=64,i=64;if(e.visual.atlas){const o=Object.keys(e.visual.atlas.frames)[0];if(o){const r=e.visual.atlas.frames[o];n=r.frame.w,i=r.frame.h}}return{id:e.id,name:e.name,assetId:e.id+"_sheet",width:n,height:i,anchor:e.anchor,animations:t}}function Kr(e,t){var i;const n=At(e);return{id:e.id,name:e.name,components:{sprite:{assetId:n.assetId,width:n.width,height:n.height,anchor:n.anchor,visible:!0},animator:{currentAnimation:((i=e.animations[0])==null?void 0:i.name)||"",animations:n.animations||{},frame:0,elapsed:0,playing:!0,loop:!0},transform:{position:t||{x:0,y:0},rotation:0,scale:{x:1,y:1}}}}}function $t(e){const t=e.toLowerCase();return t.includes("idle")||t.includes("stand")?"idle":t.includes("walk")?"walk":t.includes("run")||t.includes("sprint")?"run":t.includes("jump")||t.includes("fall")||t.includes("attack")||t.includes("hit")||t.includes("shoot")?"action":t.includes("hurt")||t.includes("damage")||t.includes("die")?"emotion":(t.includes("special")||t.includes("skill"),"custom")}function Yr(e,t){const n=(t==null?void 0:t.columns)||Math.ceil(Math.sqrt(e.length)),i=(t==null?void 0:t.padding)||0;if(e.length===0)return{image:"",atlas:{frames:{},meta:{image:"",size:{w:0,h:0},scale:1}}};const o=e[0].width,r=e[0].height,a=Math.ceil(e.length/n),s=n*(o+i)-i,c=a*(r+i)-i,u={};return e.forEach((m,p)=>{const h=p%n,f=Math.floor(p/n);u[m.id]={frame:{x:h*(o+i),y:f*(r+i),w:o,h:r},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:o,h:r},sourceSize:{w:o,h:r}}}),{image:"",atlas:{frames:u,meta:{image:"",size:{w:s,h:c},scale:1}}}}function Xr(e,t,n,i,o){const r=o||Math.ceil(Math.sqrt(i)),a={};for(let c=0;c<i;c++){const u=c%r,m=Math.floor(c/r);a[`frame_${c}`]={frame:{x:u*t,y:m*n,w:t,h:n},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:t,h:n},sourceSize:{w:t,h:n}}}const s=Math.ceil(i/r);return{frames:a,meta:{image:e,size:{w:r*t,h:s*n},scale:1}}}function Gr(e){const t=[],n=[];e.id||t.push("Project is missing an ID"),(!e.assets||e.assets.length===0)&&n.push("Project has no assets"),!e.sprites&&!e.entities&&t.push("Project has no sprites or entities to import");for(const i of e.sprites||[])e.assets.find(r=>r.id===i.assetId)||n.push(`Sprite "${i.name}" references missing asset: ${i.assetId}`);for(const i of e.sprites||[])(!i.animations||Object.keys(i.animations).length===0)&&n.push(`Sprite "${i.name}" has no animations`);return{valid:t.length===0,errors:t,warnings:n}}function Jr(e,t){var s,c,u;const{flattenScenes:n=!1,includeCharacterSprites:i=!0,includeDialogue:o=!0,slideDuration:r=5e3}=t||{},a=[];if(n)for(const m of e.scenes){const p=Zr(m);for(let h=0;h<p.length;h++){const f=p[h],g=p[h+1]??m.duration,y=ea(e,m,f,g-f,i,o);a.push(y)}}else for(const m of e.scenes){const p=ta(e,m,i,o);a.push(p)}return{version:"1.0.0",id:e.id+"_presentation",title:e.title,description:(s=e.metadata)==null?void 0:s.description,author:(c=e.metadata)==null?void 0:c.author,createdAt:((u=e.metadata)==null?void 0:u.createdAt)||new Date().toISOString(),updatedAt:new Date().toISOString(),layout:{width:e.stageSize.width,height:e.stageSize.height,aspectRatio:`${e.stageSize.width}:${e.stageSize.height}`},slides:a,metadata:{sourcePuppetShow:e.id,convertedAt:new Date().toISOString()}}}function Zr(e){const t=new Set([0]);for(const n of e.timeline)for(const i of n.keyframes)t.add(i.time),"duration"in i&&typeof i.duration=="number"&&t.add(i.time+i.duration);return Array.from(t).sort((n,i)=>n-i)}function ea(e,t,n,i,o,r){var s,c;const a=[];if(o)for(const u of t.cast){const m=e.characters.find(f=>f.id===u.characterId);if(!m)continue;const p=na(t,u.instanceId,n)||u.position,h=ia(t,u.instanceId,n);a.push({id:`char_${u.instanceId}_${n}`,type:"image",position:{x:p.x,y:p.y,rotation:(h==null?void 0:h.rotation)??u.rotation},size:{width:((s=m.visual.atlas)==null?void 0:s.meta.size.w)??100,height:((c=m.visual.atlas)==null?void 0:c.meta.size.h)??100},content:{src:m.visual.spriteSheet,alt:m.name},style:{opacity:(h==null?void 0:h.opacity)??u.opacity??1,transform:(h==null?void 0:h.scale)!==void 0?`scale(${u.flipX?-h.scale:h.scale}, ${h.scale})`:void 0},zIndex:u.zIndex})}if(r){const u=oa(t,n);if(u){const m=e.characters.find(p=>{const h=t.timeline.find(f=>f.type==="dialogue");return(h==null?void 0:h.targetId)===p.id});a.push({id:`dialogue_${n}`,type:"text",position:{x:e.stageSize.width/2,y:e.stageSize.height-100},size:{width:e.stageSize.width*.9,height:80},content:{text:m?`${m.name}: ${u.text}`:u.text},style:{backgroundColor:"rgba(0, 0, 0, 0.85)",borderRadius:12},zIndex:1e3})}}return{id:`slide_${t.id}_${n}`,title:t.title,elements:a,background:_t(t.background),transition:t.transition?{type:t.transition.type,duration:t.transition.duration}:void 0,duration:i}}function ta(e,t,n,i){var r,a;const o=[];if(n)for(const s of t.cast){const c=e.characters.find(u=>u.id===s.characterId);c&&o.push({id:`char_${s.instanceId}`,type:"image",position:{x:s.position.x,y:s.position.y,rotation:s.rotation},size:{width:((r=c.visual.atlas)==null?void 0:r.meta.size.w)??100,height:((a=c.visual.atlas)==null?void 0:a.meta.size.h)??100},content:{src:c.visual.spriteSheet,alt:c.name},style:{opacity:s.opacity??1},animation:aa(t,s.instanceId),zIndex:s.zIndex})}for(const s of t.scenery){const c=e.props.find(u=>u.id===s.propId);c&&o.push({id:`prop_${s.instanceId}`,type:"image",position:{x:s.position.x,y:s.position.y,rotation:s.rotation},size:{width:c.width,height:c.height},content:{src:c.asset,alt:c.name},style:{opacity:s.opacity??1},zIndex:s.zIndex})}return i&&ra(t).forEach((c,u)=>{const m=e.characters.find(p=>p.id===c.speakerId);o.push({id:`dialogue_${u}`,type:"text",position:{x:e.stageSize.width/2,y:e.stageSize.height-100},size:{width:e.stageSize.width*.9,height:80},content:{text:m?`${m.name}: ${c.text}`:c.text},style:{backgroundColor:"rgba(0, 0, 0, 0.85)",borderRadius:12},animation:{enter:{type:"fadeIn",duration:300,delay:c.time},exit:{type:"fadeOut",duration:300,delay:c.time+c.duration-300}},zIndex:1e3+u})}),{id:`slide_${t.id}`,title:t.title,elements:o,background:_t(t.background),transition:t.transition?{type:t.transition.type,duration:t.transition.duration}:void 0,duration:t.duration,notes:`Converted from Puppet Show scene: ${t.title}`}}function na(e,t,n){const i=e.timeline.find(a=>a.type==="transform"&&a.targetId===t);if(!i)return null;const o=i.keyframes;let r=null;for(const a of o){const s=a.value;a.time<=n&&s.position&&(r=s)}return(r==null?void 0:r.position)??null}function ia(e,t,n){const i=e.timeline.find(a=>a.type==="transform"&&a.targetId===t);if(!i)return null;const o=i.keyframes;let r=null;for(const a of o)a.time<=n&&(r=a.value);return r?{scale:r.scale,rotation:r.rotation,opacity:r.opacity}:null}function oa(e,t){for(const n of e.timeline)if(n.type==="dialogue")for(const i of n.keyframes){const o=i.value;if(t>=i.time&&t<i.time+(i.duration??0))return{text:o.text,speakerId:n.targetId}}return null}function ra(e){const t=[];for(const n of e.timeline)if(n.type==="dialogue")for(const i of n.keyframes){const o=i.value;t.push({text:o.text,speakerId:n.targetId,time:i.time,duration:i.duration??0})}return t.sort((n,i)=>n.time-i.time)}function _t(e){var t,n;switch(e.type){case"solid":return{type:"solid",color:e.color};case"gradient":return e.gradient?{type:"gradient",gradient:e.gradient}:{type:"solid",color:"#000000"};case"image":return{type:"image",image:e.image};case"video":return{type:"video",video:e.video};case"parallax":return{type:"image",image:(n=(t=e.parallaxLayers)==null?void 0:t[0])==null?void 0:n.image};default:return{type:"solid",color:"#000000"}}}function aa(e,t){const n=e.timeline.find(o=>o.type==="transform"&&o.targetId===t);return!n||n.keyframes.length===0?void 0:{timeline:n.keyframes.map(o=>{var a,s;const r=o.value;return{time:o.time,properties:{x:(a=r.position)==null?void 0:a.x,y:(s=r.position)==null?void 0:s.y,scale:r.scale,rotation:r.rotation,opacity:r.opacity},easing:o.easing}})}}function sa(e,t){const n=[],i=[],o=[],r=new Map;for(const a of e.slides)for(const s of a.elements)s.type==="image"&&s.content.src&&(r.has(s.content.src)||r.set(s.content.src,new Set),r.get(s.content.src).add(s));if(t!=null&&t.createCharacterFromImages){for(const[a,s]of r)if(s.size>=2){const c=Array.from(s)[0],u=`char_${n.length}`;n.push({id:u,name:c.content.alt||`Character ${n.length+1}`,type:"sprite",visual:{type:"sprite",spriteSheet:a,atlas:{frames:{default:{frame:{x:0,y:0,w:c.size.width,h:c.size.height},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:c.size.width,h:c.size.height},sourceSize:{w:c.size.width,h:c.size.height}}},meta:{image:a,size:{w:c.size.width,h:c.size.height},scale:1}},width:c.size.width,height:c.size.height},anchor:{x:.5,y:1},animations:[{id:"idle",name:"Idle",category:"idle",frames:[{frameId:"default",duration:1e3,offset:{x:0,y:0}}],fps:1,loop:!0,duration:1e3}],expressions:[],defaultScale:1})}}for(const[a,s]of r)if(s.size<2||!(t!=null&&t.createCharacterFromImages)){const c=Array.from(s)[0];i.push({id:`prop_${i.length}`,name:c.content.alt||`Prop ${i.length+1}`,type:"image",asset:a,width:c.size.width,height:c.size.height,anchor:{x:.5,y:.5}})}for(const a of e.slides){const s=ca(a,e,n,i);o.push(s)}return{version:"1.0",id:e.id+"_puppetshow",title:e.title,stageSize:{width:e.layout.width,height:e.layout.height},scenes:o,characters:n,props:i,audioTracks:[],settings:{defaultFps:24,allowSpeedControl:!0,allowSeek:!0,autoPlay:!1,showControls:!0,loop:!1},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),duration:e.slides.reduce((a,s)=>a+(s.duration??5e3),0),sceneCount:o.length,characterCount:n.length,sourcePresentation:e.id,convertedAt:new Date().toISOString()}}}function ca(e,t,n,i){var u,m,p,h;const o=[],r=[],a=[];let s=0,c=0;for(const f of e.elements)if(f.type==="image"&&f.content.src){const g=n.find(y=>y.visual.spriteSheet===f.content.src);if(g){const y=`${g.id}_instance_${s++}`;if(o.push({instanceId:y,characterId:g.id,position:{x:f.position.x,y:f.position.y},scale:1,rotation:f.position.rotation??0,zIndex:f.zIndex??s,opacity:((u=f.style)==null?void 0:u.opacity)??1,flipX:!1}),(m=f.animation)!=null&&m.timeline&&f.animation.timeline.length>1){const v={id:`transform_${y}`,type:"transform",targetId:y,keyframes:f.animation.timeline.map(k=>{const b=k.properties;return{time:k.time,easing:k.easing??"easeInOut",value:{type:"transform",position:b.x!==void 0?{x:b.x,y:b.y??0}:void 0,scale:b.scale,rotation:b.rotation,opacity:b.opacity}}})};a.push(v)}}else{const y=i.find(v=>v.asset===f.content.src);y&&r.push({instanceId:`${y.id}_instance_${c++}`,propId:y.id,position:{x:f.position.x,y:f.position.y},scale:1,rotation:f.position.rotation??0,zIndex:f.zIndex??c,opacity:((p=f.style)==null?void 0:p.opacity)??1})}}else if(f.type==="text"&&f.content.text&&f.position.y>t.layout.height*.7){const y=((h=o[0])==null?void 0:h.characterId)??"narrator",v=a.find(b=>b.type==="dialogue"&&b.targetId===y),k={time:0,duration:e.duration??3e3,easing:"linear",value:{type:"dialogue",text:f.content.text}};v?v.keyframes.push(k):a.push({id:`dialogue_${y}`,type:"dialogue",targetId:y,keyframes:[k]})}return{id:e.id,title:e.title||"Untitled Scene",duration:e.duration??5e3,background:e.background?{type:e.background.type,color:e.background.color,gradient:e.background.gradient,image:e.background.image,video:e.background.video}:{type:"solid",color:"#000000"},cast:o,scenery:r,timeline:a,camera:{position:{x:t.layout.width/2,y:t.layout.height/2},zoom:1,rotation:0},transition:e.transition?{type:(()=>{const f=e.transition.type;return f==="fade"?"fade":f==="zoom"?"zoom":f==="slide"?"slideLeft":"cut"})(),duration:e.transition.duration??500}:void 0}}function la(e){const t=[],n=[];e.id||t.push("Document missing id"),e.title||n.push("Document missing title"),e.version||n.push("Document missing version"),e.stageSize||t.push("Document missing stageSize"),(!e.scenes||e.scenes.length===0)&&t.push("Document has no scenes");const i=new Set(e.characters.map(r=>r.id));for(const r of e.scenes)for(const a of r.cast)i.has(a.characterId)||t.push(`Scene "${r.id}" references unknown character: ${a.characterId}`);const o=new Set(e.props.map(r=>r.id));for(const r of e.scenes)for(const a of r.scenery)o.has(a.propId)||t.push(`Scene "${r.id}" references unknown prop: ${a.propId}`);return{valid:t.length===0,errors:t,warnings:n}}function da(e,t){if(e.length===0)throw new Error("Cannot merge empty array of puppet shows");const n={version:"1.0",id:`merged_${Date.now()}`,title:e.map(r=>r.title).join(" + "),stageSize:e[0].stageSize,scenes:[],characters:[],props:[],audioTracks:[],settings:e[0].settings,metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),duration:e.reduce((r,a)=>{var s;return r+(((s=a.metadata)==null?void 0:s.duration)??0)},0),sceneCount:0,characterCount:0,mergedFrom:e.map(r=>r.id),mergedAt:new Date().toISOString()}},i=new Map,o=new Map;for(const r of e){for(const a of r.characters){if(t!=null&&t.deduplicateCharacters){const c=n.characters.find(u=>u.name===a.name);if(c){i.set(a.id,c.id);continue}}const s=`${r.id}_${a.id}`;i.set(a.id,s),n.characters.push({...a,id:s})}for(const a of r.props){const s=`${r.id}_${a.id}`;o.set(a.id,s),n.props.push({...a,id:s})}for(const a of r.scenes){const s={...a,id:`${r.id}_${a.id}`,cast:a.cast.map(c=>({...c,instanceId:`${r.id}_${c.instanceId}`,characterId:i.get(c.characterId)||c.characterId})),scenery:a.scenery.map(c=>({...c,instanceId:`${r.id}_${c.instanceId}`,propId:o.get(c.propId)||c.propId})),timeline:a.timeline.map(c=>({...c,id:`${r.id}_${c.id}`,targetId:i.get(c.targetId)||o.get(c.targetId)||`${r.id}_${c.targetId}`}))};n.scenes.push(s)}for(const a of r.audioTracks||[])n.audioTracks.push({...a,id:`${r.id}_${a.id}`})}return n}const Tt={good:"#4caf50",warning:"#ff9800",critical:"#f44336",info:"#2196f3",neutral:"#9e9e9e",background:"#fff",text:"#212121",textMuted:"#757575"};function ua(e){const t={...Tt,...e.colorScheme};return{id:e.id,title:e.title,type:"dashboard",layout:{columns:e.columns,rows:e.rows,gap:e.gap??16,padding:e.padding??24},widgets:e.widgets.map(n=>({...n,colSpan:n.colSpan??1,rowSpan:n.rowSpan??1,colors:{...t,...n.colors},animation:{countUp:!0,countUpDuration:1e3,entrance:"fadeIn",entranceDelay:0,...n.animation}})),dataSources:e.dataSources??[],refreshInterval:e.refreshInterval??3e4,colorScheme:t,background:e.background??t.background,showLastUpdated:e.showLastUpdated??!0,autoCycle:e.autoCycle??!1,autoCycleInterval:e.autoCycleInterval??5e3,lastUpdated:new Date().toISOString()}}function pa(e,t,n=!0){var o;if(!t||t.length===0)return"neutral";const i=[...t].sort((r,a)=>n?a.value-r.value:r.value-a.value);for(const r of i)if(n){if(e>=r.value)return r.status}else if(e<=r.value)return r.status;return((o=i[i.length-1])==null?void 0:o.status)??"neutral"}function fa(e,t){return t==null?"unknown":e>t?"up":e<t?"down":"flat"}function ma(e,t){if(typeof e=="string")return e;const{unit:n="",precision:i=0,compact:o=!1,locale:r="en-US"}=t??{};let a;return o&&Math.abs(e)>=1e3?a=new Intl.NumberFormat(r,{notation:"compact",maximumFractionDigits:1}).format(e):a=e.toLocaleString(r,{minimumFractionDigits:i,maximumFractionDigits:i}),n?`${a}${n}`:a}function Et(e){return{id:"revenue",title:"Revenue",type:"number-tile",column:1,row:1,unit:"$",precision:0,icon:"dollar-sign",thresholds:[{value:1e6,status:"good"},{value:5e5,status:"warning"},{value:0,status:"critical"}],...e}}function Nt(e){return{id:"customers",title:"Customers",type:"number-tile",column:2,row:1,icon:"users",thresholds:[{value:1e4,status:"good"},{value:5e3,status:"warning"},{value:0,status:"critical"}],...e}}function ha(e){return{id:"percentage-gauge",title:"Completion",type:"gauge",column:1,row:1,unit:"%",precision:1,gaugeConfig:{min:0,max:100,style:"semicircle",showNeedle:!0,showTicks:!0,tickCount:5,thickness:20},thresholds:[{value:80,status:"good"},{value:50,status:"warning"},{value:0,status:"critical"}],...e}}function ya(e){return{id:"sparkline-trend",title:"Weekly Trend",type:"sparkline",column:1,row:1,sparklineData:[],...e}}function ga(e){return{id:"traffic-light",title:"System Status",type:"traffic-light",column:1,row:1,...e}}function xa(e){return{id:"comparison",title:"Budget vs Actual",type:"comparison",column:1,row:1,targetValue:1e5,value:85e3,unit:"$",...e}}function ba(){return{id:"executive-dashboard",title:"Executive Summary",columns:4,rows:3,widgets:[Et({column:1,row:1,colSpan:1}),Nt({column:2,row:1,colSpan:1}),{id:"orders",title:"Orders",type:"number-tile",column:3,row:1,icon:"shopping-cart"},{id:"satisfaction",title:"CSAT Score",type:"gauge",column:4,row:1,unit:"%",gaugeConfig:{min:0,max:100,style:"semicircle"}},{id:"revenue-trend",title:"Revenue Trend",type:"sparkline",column:1,row:2,colSpan:2},{id:"top-products",title:"Top Products",type:"mini-bar",column:3,row:2,colSpan:2,chartData:[{label:"Product A",value:45e3},{label:"Product B",value:38e3},{label:"Product C",value:32e3},{label:"Product D",value:28e3},{label:"Product E",value:22e3}]},{id:"regional-breakdown",title:"Regional Sales",type:"mini-pie",column:1,row:3,colSpan:2,chartData:[{label:"North",value:35},{label:"South",value:25},{label:"East",value:22},{label:"West",value:18}]},{id:"budget-status",title:"Budget Status",type:"bullet-chart",column:3,row:3,colSpan:2,value:72e3,targetValue:1e5,unit:"$"}]}}function va(){return{id:"operational-dashboard",title:"Operational Metrics",columns:3,rows:2,widgets:[{id:"uptime",title:"System Uptime",type:"gauge",column:1,row:1,value:99.9,unit:"%",gaugeConfig:{min:0,max:100,style:"full-circle"},thresholds:[{value:99.5,status:"good"},{value:99,status:"warning"},{value:0,status:"critical"}]},{id:"response-time",title:"Avg Response Time",type:"number-tile",column:2,row:1,value:145,unit:"ms",icon:"clock",thresholds:[{value:0,status:"good"},{value:200,status:"warning"},{value:500,status:"critical"}]},{id:"error-rate",title:"Error Rate",type:"traffic-light",column:3,row:1,value:.5,unit:"%"},{id:"throughput",title:"Requests/sec",type:"sparkline",column:1,row:2,colSpan:2,sparklineData:[120,135,128,145,152,148,160,155,170,165]},{id:"incidents",title:"Open Incidents",type:"number-tile",column:3,row:2,value:3,icon:"alert-triangle",thresholds:[{value:0,status:"good"},{value:5,status:"warning"},{value:10,status:"critical"}]}]}}function Sa(e){var t,n,i;return{id:e.id,type:"datagrid",title:e.title,subtitle:e.subtitle,config:{...e,columns:e.columns.map(o=>({width:"auto",align:"left",dataType:"string",sortable:!0,filterable:!1,...o})),interactiveSort:e.interactiveSort??!0,interactiveFilter:e.interactiveFilter??!1,enableSelection:e.enableSelection??!0,showRowNumbers:e.showRowNumbers??!1,showColumnBorders:e.showColumnBorders??!1,stripedRows:e.stripedRows??!0,pageSize:e.pageSize??10,animation:{rowEntrance:"fadeIn",staggerDelay:50,duration:300,progressiveReveal:!1,revealBatchSize:5,...e.animation},style:{headerBackground:"#f5f5f5",headerColor:"#212121",rowBackground:"#fff",rowBackgroundAlt:"#fafafa",cellColor:"#424242",borderColor:"#e0e0e0",fontSize:14,headerFontSize:14,rowHeight:48,cellPadding:12,borderRadius:8,...e.style}},state:{currentSort:e.defaultSort??[],currentFilters:e.defaultFilters??[],selectedCells:[],currentPage:0,revealedRowCount:(t=e.animation)!=null&&t.progressiveReveal?e.animation.revealBatchSize??5:((n=e.data)==null?void 0:n.length)??0,isFullyRevealed:!((i=e.animation)!=null&&i.progressiveReveal),lastUpdated:new Date().toISOString()}}}function wa(e,t){return t.length===0?e:[...e].sort((n,i)=>{for(const o of t){const r=n[o.field],a=i[o.field];let s=0;if(r==null&&a==null?s=0:r==null?s=1:a==null?s=-1:typeof r=="number"&&typeof a=="number"?s=r-a:s=String(r).localeCompare(String(a)),s!==0)return o.direction==="desc"?-s:s}return 0})}function ka(e,t){return t.length===0?e:e.filter(n=>t.every(i=>{const o=n[i.field],r=i.value;switch(i.operator){case"equals":return o===r;case"notEquals":return o!==r;case"contains":return String(o).toLowerCase().includes(String(r).toLowerCase());case"startsWith":return String(o).toLowerCase().startsWith(String(r).toLowerCase());case"endsWith":return String(o).toLowerCase().endsWith(String(r).toLowerCase());case"greaterThan":return Number(o)>Number(r);case"lessThan":return Number(o)<Number(r);case"between":return Number(o)>=Number(r)&&Number(o)<=Number(i.valueTo);case"in":return Array.isArray(r)&&r.includes(o);default:return!0}}))}function Ia(e,t){const n={};for(const i of t.columns){const o=e.map(r=>r[i.columnId]).filter(r=>r!=null);switch(i.aggregation){case"sum":n[i.columnId]=o.reduce((r,a)=>r+Number(a),0);break;case"avg":n[i.columnId]=o.length>0?o.reduce((r,a)=>r+Number(a),0)/o.length:0;break;case"min":n[i.columnId]=Math.min(...o.map(Number));break;case"max":n[i.columnId]=Math.max(...o.map(Number));break;case"count":n[i.columnId]=o.length;break;case"custom":n[i.columnId]=i.customValue??"";break}}return n}function Ca(e,t,n="en-US"){if(e==null)return"";switch(t.dataType){case"number":return Number(e).toLocaleString(n,{minimumFractionDigits:t.precision??0,maximumFractionDigits:t.precision??0});case"currency":return Number(e).toLocaleString(n,{style:"currency",currency:t.currency??"USD"});case"percent":return Number(e).toLocaleString(n,{style:"percent",minimumFractionDigits:t.precision??0});case"date":return new Date(String(e)).toLocaleDateString(n);case"boolean":return e?"✓":"✗";default:return String(e)}}function Ma(e,t){if(!t)return null;for(const n of t){const{operator:i,value:o,valueTo:r}=n.condition;let a=!1;switch(i){case"equals":a=e===o;break;case"notEquals":a=e!==o;break;case"greaterThan":a=Number(e)>Number(o);break;case"lessThan":a=Number(e)<Number(o);break;case"between":a=Number(e)>=Number(o)&&Number(e)<=Number(r);break;case"contains":a=String(e).toLowerCase().includes(String(o).toLowerCase());break;case"isEmpty":a=e==null||e==="";break}if(a)return n.style}return null}function za(e){return{id:"sales-grid",title:"Sales Report",subtitle:"Q4 2025 Performance",columns:[{id:"region",header:"Region",field:"region",width:150},{id:"product",header:"Product",field:"product",width:200},{id:"units",header:"Units Sold",field:"units",dataType:"number",align:"right"},{id:"revenue",header:"Revenue",field:"revenue",dataType:"currency",align:"right",conditionalFormat:[{condition:{operator:"greaterThan",value:1e5},style:{backgroundColor:"#e8f5e9",color:"#2e7d32"}},{condition:{operator:"lessThan",value:5e4},style:{backgroundColor:"#ffebee",color:"#c62828"}}]},{id:"growth",header:"Growth %",field:"growth",dataType:"percent",align:"right",precision:1}],data:e??[{region:"North",product:"Widget Pro",units:1250,revenue:125e3,growth:.15},{region:"South",product:"Widget Pro",units:980,revenue:98e3,growth:.08},{region:"East",product:"Gadget Plus",units:1500,revenue:18e4,growth:.22},{region:"West",product:"Gadget Plus",units:1100,revenue:132e3,growth:.12}],summaryRow:{enabled:!0,columns:[{columnId:"units",aggregation:"sum",label:"Total"},{columnId:"revenue",aggregation:"sum"},{columnId:"growth",aggregation:"avg"}]},animation:{rowEntrance:"slideInLeft",staggerDelay:100}}}function Aa(e){return{id:"employee-grid",title:"Team Directory",columns:[{id:"name",header:"Name",field:"name",width:180},{id:"role",header:"Role",field:"role",width:150},{id:"department",header:"Department",field:"department",width:120,filterable:!0},{id:"email",header:"Email",field:"email",width:200},{id:"status",header:"Status",field:"status",cellRenderer:"badge",width:100}],data:e??[],showRowNumbers:!0,interactiveFilter:!0}}function $a(e){var n;const t={};return(n=e.parameters)==null||n.forEach(i=>{i.defaultValue!==void 0&&(t[i.name]=i.defaultValue)}),{id:e.id,type:"query",title:e.title,subtitle:e.subtitle,config:{...e,autoExecute:e.autoExecute??!1,showQueryEditor:e.showQueryEditor??!0,allowQueryEdit:e.allowQueryEdit??!1,showExecutionStats:e.showExecutionStats??!0,cacheDuration:e.cacheDuration??0,style:{editorTheme:"dark",editorFontSize:14,resultBackground:"#fff",accentColor:"#1976d2",borderRadius:8,...e.style}},state:{currentQuery:e.query,currentParameters:t,result:null,isExecuting:!1,lastExecutedAt:null,error:null,visualizationMode:e.visualization.mode,history:[]}}}function _a(e,t){const n=[];switch(t){case"sql":{const i=e.matchAll(/[@:](\w+)/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}case"odata":{const i=e.matchAll(/\{(\w+)\}/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}case"graphql":{const i=e.matchAll(/\$(\w+)/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}case"kql":{const i=e.matchAll(/\{(\w+)\}/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}}return n}function Ta(e,t,n){let i=e;for(const[o,r]of Object.entries(n)){const a=Ea(r);switch(t){case"sql":i=i.replace(new RegExp(`@${o}\\b`,"g"),a),i=i.replace(new RegExp(`:${o}\\b`,"g"),a);break;case"odata":case"kql":i=i.replace(new RegExp(`\\{${o}\\}`,"g"),a);break}}return i}function Ea(e){return e==null?"NULL":typeof e=="number"?String(e):typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?`'${e.toISOString()}'`:`'${String(e).replace(/'/g,"''")}'`}function Na(e,t){const n={};for(const i of e){const o=t[i.name];if(i.required&&(o==null||o==="")){n[i.name]=`${i.label} is required`;continue}if(o!=null&&i.validation){if(i.type==="number"){const r=Number(o);i.validation.min!==void 0&&r<i.validation.min&&(n[i.name]=i.validation.message??`Minimum value is ${i.validation.min}`),i.validation.max!==void 0&&r>i.validation.max&&(n[i.name]=i.validation.message??`Maximum value is ${i.validation.max}`)}i.type==="string"&&i.validation.pattern&&(new RegExp(i.validation.pattern).test(String(o))||(n[i.name]=i.validation.message??"Invalid format"))}}return{valid:Object.keys(n).length===0,errors:n}}function Ra(e){if(!e.success||e.rowCount===0)return"table";const t=e.columns.filter(i=>i.type==="number"),n=e.columns.filter(i=>i.type==="date");return e.rowCount===1&&t.length>=3?"metrics":n.length===1&&t.length>=1&&e.rowCount>3?"line-chart":t.length===1&&e.rowCount<=15?"bar-chart":t.length===1&&e.rowCount<=8?"pie-chart":"table"}function Pa(e,t){var s,c,u;if(!e.success||e.columns.length===0)return;const n=e.columns.filter(m=>m.type==="number"),i=e.columns.filter(m=>m.type!=="number"),r=((s=e.columns.filter(m=>m.type==="date")[0])==null?void 0:s.name)??((c=i[0])==null?void 0:c.name)??e.columns[0].name,a=n.length>0?n.length===1?n[0].name:n.slice(0,3).map(m=>m.name):(u=e.columns[1])==null?void 0:u.name;return{xAxis:r,yAxis:a,showLegend:Array.isArray(a)&&a.length>1,showGrid:!0,colorScheme:["#1976d2","#43a047","#fb8c00","#e53935","#8e24aa"]}}function qa(){return{id:"sales-query",title:"Sales Analysis",subtitle:"Query live sales data",language:"sql",query:`SELECT
133
+ `,opacity:r,transformOrigin:`${e.anchor.x*100}% ${e.anchor.y*100}%`};return e.type==="image"||e.type==="sprite"?d.createElement("img",{src:e.asset,style:{...a,width:e.width,height:e.height,pointerEvents:"none"},alt:e.name}):e.type==="vector"?d.createElement("div",{style:a,dangerouslySetInnerHTML:{__html:e.asset}}):e.type==="text"?d.createElement("div",{style:a},e.asset):d.createElement("div",{style:a})}function xt({text:e,speakerName:t,style:n={},targetPosition:i,visible:o,typewriterProgress:r=1}){if(!o)return null;const{position:a="bottom",backgroundColor:s="rgba(0, 0, 0, 0.85)",textColor:c="#fff",fontSize:u=18,maxWidth:m=600}=n,p=e.slice(0,Math.floor(e.length*r)),h={position:"absolute",maxWidth:m,padding:"16px 24px",backgroundColor:s,color:c,fontSize:u,borderRadius:12,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.3)",zIndex:1e3};switch(a){case"bottom":Object.assign(h,{bottom:20,left:"50%",transform:"translateX(-50%)",width:"90%"});break;case"top":Object.assign(h,{top:20,left:"50%",transform:"translateX(-50%)",width:"90%"});break;case"center":Object.assign(h,{top:"50%",left:"50%",transform:"translate(-50%, -50%)"});break;case"bubble":i&&Object.assign(h,{left:i.x,bottom:i.y+20,transform:"translateX(-50%)"});break}return d.createElement("div",{style:h},t&&d.createElement("div",{style:{fontWeight:"bold",marginBottom:8,color:"#60a5fa"}},t),d.createElement("div",null,p))}function Nr(e,t,n){const[i,o]=d.useState({offsetX:0,offsetY:0}),r=d.useRef(null);return d.useEffect(()=>{if(!n){o({offsetX:0,offsetY:0});return}r.current=performance.now();let a;const s=c=>{const u=c-r.current;if(u>=t){o({offsetX:0,offsetY:0});return}const p=1-u/t,h=(Math.random()-.5)*2*e*p,f=(Math.random()-.5)*2*e*p;o({offsetX:h,offsetY:f}),a=requestAnimationFrame(s)};return a=requestAnimationFrame(s),()=>{cancelAnimationFrame(a)}},[n,e,t]),i}const de={linear:e=>e,easeIn:e=>e*e,easeOut:e=>e*(2-e),easeInOut:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:-1+(4-2*e)*e,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInElastic:e=>e===0||e===1?e:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI),easeOutElastic:e=>e===0||e===1?e:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1,easeInOutElastic:e=>e===0||e===1?e:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1),easeInBounce:e=>1-de.easeOutBounce(1-e),easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,easeInOutBounce:e=>e<.5?de.easeInBounce(e*2)*.5:de.easeOutBounce(e*2-1)*.5+.5,step:e=>Math.round(e)};function bt(e){return de[e]||de.linear}function re(e,t,n){return e+(t-e)*n}function Ie(e,t,n){return{x:re(e.x,t.x,n),y:re(e.y,t.y,n)}}class vt{constructor(t){this.currentTime=0,this.scene=t.scene,this.characterDefs=new Map(t.characterDefs.map(n=>[n.id,n])),this.typewriterSpeed=t.typewriterSpeed||30,this.onAudioCommand=t.onAudioCommand}evaluate(t){this.currentTime=t;const n=this.evaluateAllCharacters(t),i=this.evaluateCamera(t),o=this.evaluateDialogue(t),r=this.evaluateEffects(t),a=this.evaluateAudio(t);return{characterStates:n,camera:i,activeDialogue:o,activeEffects:r,audioCommands:a}}getDuration(){return this.scene.duration}findSurroundingKeyframes(t,n){const i=t.keyframes;if(i.length===0)return{prev:null,next:null,progress:0};let o=-1;for(let h=0;h<i.length&&i[h].time<=n;h++)o=h;if(o===-1)return{prev:null,next:i[0],progress:0};const r=i[o],a=i[o+1]||null;if(!a)return{prev:r,next:null,progress:1};const s=a.time-r.time,c=n-r.time,u=s>0?c/s:0,p=bt(r.easing||"linear")(Math.min(1,Math.max(0,u)));return{prev:r,next:a,progress:p}}evaluateAllCharacters(t){const n=new Map;for(const i of this.scene.cast){const o=this.evaluateCharacter(i.instanceId,t);n.set(i.instanceId,o)}return n}evaluateCharacter(t,n){var a;const i=this.scene.cast.find(s=>s.instanceId===t);if(!i)return this.createDefaultCharacterState();const o=this.characterDefs.get(i.characterId);let r={instanceId:t,characterId:i.characterId,position:{...i.position},scale:i.scale,rotation:i.rotation,opacity:i.opacity??1,flipX:i.flipX??!1,visible:!0,currentAnimation:i.initialAnimation||(((a=o==null?void 0:o.animations[0])==null?void 0:a.id)??""),animationFrame:0,animationStartTime:0,currentExpression:i.initialExpression??""};for(const s of this.scene.timeline)if(s.targetId===t)switch(s.type){case"animation":r=this.applyAnimationTrack(s,r,n);break;case"transform":r=this.applyTransformTrack(s,r,n);break;case"expression":r=this.applyExpressionTrack(s,r,n);break}if(o&&r.currentAnimation){const s=o.animations.find(c=>c.id===r.currentAnimation);if(s){const c=(n-r.animationStartTime)%(s.duration||s.frames.length/s.fps*1e3),u=Math.floor(c/1e3*s.fps)%s.frames.length;r.animationFrame=u}}return r}createDefaultCharacterState(){return{instanceId:"",characterId:"",position:{x:0,y:0},scale:1,rotation:0,opacity:1,flipX:!1,visible:!1,currentAnimation:"",animationFrame:0,animationStartTime:0,currentExpression:""}}applyAnimationTrack(t,n,i){const{prev:o}=this.findSurroundingKeyframes(t,i);if(o){const r=o.value;return{...n,currentAnimation:r.animationId,animationStartTime:o.time}}return n}applyTransformTrack(t,n,i){const{prev:o,next:r,progress:a}=this.findSurroundingKeyframes(t,i);if(!o)return n;const s=o.value,c=r?r.value:null;return c?{...n,position:s.position&&c.position?Ie(s.position,c.position,a):s.position??n.position,scale:s.scale!==void 0&&c.scale!==void 0?re(s.scale,c.scale,a):s.scale??n.scale,rotation:s.rotation!==void 0&&c.rotation!==void 0?re(s.rotation,c.rotation,a):s.rotation??n.rotation,opacity:s.opacity!==void 0&&c.opacity!==void 0?re(s.opacity,c.opacity,a):s.opacity??n.opacity}:{...n,position:s.position??n.position,scale:s.scale??n.scale,rotation:s.rotation??n.rotation,opacity:s.opacity??n.opacity}}applyExpressionTrack(t,n,i){const{prev:o}=this.findSurroundingKeyframes(t,i);if(o){const r=o.value;return{...n,currentExpression:r.expressionId}}return n}evaluateCamera(t){let n=this.scene.camera?{...this.scene.camera}:{position:{x:640,y:360},zoom:1,rotation:0};for(const i of this.scene.timeline){if(i.type!=="camera")continue;const{prev:o,next:r,progress:a}=this.findSurroundingKeyframes(i,t);if(!o)continue;const s=o.value,c=r?r.value:null;c?n={position:s.position&&c.position?Ie(s.position,c.position,a):s.position??n.position,zoom:s.zoom!==void 0&&c.zoom!==void 0?re(s.zoom,c.zoom,a):s.zoom??n.zoom,rotation:s.rotation!==void 0&&c.rotation!==void 0?re(s.rotation,c.rotation,a):s.rotation??n.rotation}:n={position:s.position??n.position,zoom:s.zoom??n.zoom,rotation:s.rotation??n.rotation}}return n}evaluateDialogue(t){for(const n of this.scene.timeline){if(n.type!=="dialogue")continue;const{prev:i}=this.findSurroundingKeyframes(n,t);if(i){const o=i.value,r=i.time+(i.duration??0);if(t>=i.time&&t<r){const a=t-i.time,s=o.text.length/this.typewriterSpeed*1e3,c=Math.min(1,a/s);return{text:o.text,speakerId:n.targetId,typewriterProgress:c}}}}return null}evaluateEffects(t){const n=[];for(const i of this.scene.timeline)if(i.type==="effect")for(const o of i.keyframes){const r=o.value,a=o.time+(o.duration??0);if(t>=o.time&&t<a){const s=o.duration?(t-o.time)/o.duration:1;n.push({effectId:i.id+"_"+o.time,type:r.effectType,params:r.params,startTime:o.time,duration:o.duration??0,progress:s})}}return n}evaluateAudio(t){const n=[];for(const i of this.scene.timeline)if(i.type==="audio")for(const o of i.keyframes){const r=o.value;Math.abs(t-o.time)<50&&n.push({trackId:i.targetId,command:r.action,time:t})}return n}}class Rr{constructor(t,n,i){this.track={id:i||`track_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,type:t,targetId:n,keyframes:[]}}addAnimationKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:(i==null?void 0:i.easing)??"linear",value:{type:"animation",animationId:n,speed:(i==null?void 0:i.speed)??1}}),this}addTransformKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:i??"easeInOut",value:{type:"transform",...n}}),this}addExpressionKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:(i==null?void 0:i.easing)??"easeOut",duration:(i==null?void 0:i.transition)??200,value:{type:"expression",expressionId:n}}),this}addDialogueKeyframe(t,n,i,o){return this.track.keyframes.push({time:t,duration:i,easing:(o==null?void 0:o.easing)??"linear",value:{type:"dialogue",text:n,audioClip:o==null?void 0:o.voiceOver,style:o==null?void 0:o.style}}),this}addCameraKeyframe(t,n,i){return this.track.keyframes.push({time:t,easing:i??"easeInOut",value:{type:"camera",...n}}),this}addEffectKeyframe(t,n,i,o,r){return this.track.keyframes.push({time:t,duration:i,easing:r??"linear",value:{type:"effect",effectType:n,params:o??{}}}),this}build(){return this.track.keyframes.sort((t,n)=>t.time-n.time),this.track}}class Pr{constructor(t,n,i){this.scene={id:t,title:n,duration:i,background:{type:"solid",color:"#000000"},cast:[],scenery:[],timeline:[],camera:{position:{x:640,y:360},zoom:1,rotation:0}}}setBackground(t){return this.scene.background=t,this}setCamera(t){return this.scene.camera=t,this}setTransition(t){return this.scene.transition=t,this}addCastMember(t,n,i){return this.scene.cast.push({instanceId:t,characterId:n,position:i.position??{x:640,y:360},scale:i.scale??1,rotation:i.rotation??0,zIndex:i.zIndex??this.scene.cast.length,initialAnimation:i.initialAnimation,initialExpression:i.initialExpression,opacity:i.opacity??1,flipX:i.flipX??!1}),this}addProp(t,n,i){return this.scene.scenery.push({instanceId:t,propId:n,position:i.position??{x:640,y:360},scale:i.scale??1,rotation:i.rotation??0,zIndex:i.zIndex??this.scene.scenery.length,opacity:i.opacity??1}),this}addTrack(t){return this.scene.timeline.push(t),this}addAudio(t){return this.scene.audio=t,this}build(){return this.scene}}function qr(e){return JSON.parse(JSON.stringify(e))}function St(e){if(e.keyframes.length===0)return 0;const t=e.keyframes[e.keyframes.length-1];return"duration"in t&&typeof t.duration=="number"?t.time+t.duration:t.time}function Dr(e){let t=0;for(const n of e.timeline){const i=St(n);i>t&&(t=i)}return Math.max(e.duration,t)}function jr(e,t){return Math.floor(e/1e3*t)}function Or(e,t){return e/t*1e3}function Fr(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),i=t%60,o=Math.floor(e%1e3/10);return`${n.toString().padStart(2,"0")}:${i.toString().padStart(2,"0")}.${o.toString().padStart(2,"0")}`}function Lr(e){const t=e.match(/^(\d+):(\d{2})(?:\.(\d{2}))?$/);if(!t)return 0;const n=parseInt(t[1],10),i=parseInt(t[2],10),o=t[3]?parseInt(t[3],10)*10:0;return(n*60+i)*1e3+o}const wt=d.createContext(null);function Wr(){const e=d.useContext(wt);if(!e)throw new Error("usePuppetPlayer must be used within PuppetPlayerProvider");return e}class Br{constructor(){this.audioElements=new Map,this.volume=1,this.muted=!1}preloadAudio(t,n){return new Promise((i,o)=>{const r=new Audio(n);r.preload="auto",r.volume=this.volume,r.muted=this.muted,r.addEventListener("canplaythrough",()=>i(),{once:!0}),r.addEventListener("error",o,{once:!0}),this.audioElements.set(t,r)})}play(t,n){const i=this.audioElements.get(t);i&&(n!==void 0&&(i.currentTime=n/1e3),i.play().catch(()=>{}))}pause(t){const n=this.audioElements.get(t);n&&n.pause()}stop(t){const n=this.audioElements.get(t);n&&(n.pause(),n.currentTime=0)}stopAll(){this.audioElements.forEach(t=>{t.pause(),t.currentTime=0})}setVolume(t){this.volume=Math.max(0,Math.min(1,t)),this.audioElements.forEach(n=>{n.volume=this.volume})}setMuted(t){this.muted=t,this.audioElements.forEach(n=>{n.muted=t})}dispose(){this.stopAll(),this.audioElements.clear()}}function kt(e){const{document:t,autoPlay:n=!1,loop:i=!1,initialVolume:o=1,initialSpeed:r=1}=e,[a,s]=d.useState({isPlaying:!1,isPaused:!1,currentSceneIndex:0,currentTime:0,totalDuration:0,playbackSpeed:r,volume:o,isMuted:!1,characterStates:new Map,activeEffects:[],loop:i}),[c,u]=d.useState(null),m=d.useRef(null),p=d.useRef(0),h=d.useRef(new Br),f=d.useRef(null),g=d.useRef(new $e),y=d.useMemo(()=>t.scenes.reduce((C,$)=>C+$.duration,0),[t.scenes]),v=d.useMemo(()=>t.scenes[a.currentSceneIndex]||null,[t.scenes,a.currentSceneIndex]);d.useEffect(()=>{v&&(f.current=new vt({scene:v,characterDefs:t.characters,onAudioCommand:(C,$,I)=>{const q=h.current;switch($){case"play":q.play(C,I);break;case"pause":q.pause(C);break;case"stop":q.stop(C);break}}}))},[v,t.characters]),d.useEffect(()=>{var $;const C=h.current;return($=t.audioTracks)==null||$.forEach(I=>{I.src&&C.preloadAudio(I.id,I.src).catch(()=>{})}),()=>{C.dispose()}},[t.audioTracks]);const k=d.useCallback(C=>{if(!f.current)return;const $=C-p.current;p.current=C,s(I=>{var W,J,N;if(!I.isPlaying||I.isPaused)return I;const q=I.currentTime+$*I.playbackSpeed,F=(v==null?void 0:v.duration)??0;if(q>=F){const M=I.currentSceneIndex+1;return M>=t.scenes.length?I.loop?((W=e.onSceneChange)==null||W.call(e,0,t.scenes[0]),{...I,currentSceneIndex:0,currentTime:0}):((J=e.onEnd)==null||J.call(e),{...I,isPlaying:!1,isPaused:!1,currentTime:F}):((N=e.onSceneChange)==null||N.call(e,M,t.scenes[M]),{...I,currentSceneIndex:M,currentTime:0})}return{...I,currentTime:q}}),m.current=requestAnimationFrame(k)},[v,t.scenes,e]);d.useEffect(()=>(a.isPlaying&&!a.isPaused?(p.current=performance.now(),m.current=requestAnimationFrame(k)):m.current&&cancelAnimationFrame(m.current),()=>{m.current&&cancelAnimationFrame(m.current)}),[a.isPlaying,a.isPaused,k]),d.useEffect(()=>{if(f.current){const C=f.current.evaluate(a.currentTime);u(C),C.audioCommands.forEach($=>{const I=h.current;switch($.command){case"play":I.play($.trackId);break;case"pause":I.pause($.trackId);break;case"stop":I.stop($.trackId);break}}),s($=>({...$,characterStates:C.characterStates,activeEffects:C.activeEffects}))}},[a.currentTime]),d.useEffect(()=>{n&&s(C=>({...C,isPlaying:!0}))},[n]);const b=d.useCallback(()=>{s(C=>({...C,isPlaying:!0,isPaused:!1}))},[]),S=d.useCallback(()=>{s(C=>({...C,isPaused:!0})),h.current.stopAll()},[]),_=d.useCallback(()=>{s(C=>({...C,isPlaying:!1,isPaused:!1,currentTime:0,currentSceneIndex:0})),h.current.stopAll()},[]),R=d.useCallback(C=>{s($=>({...$,currentTime:Math.max(0,Math.min(C,(v==null?void 0:v.duration)??0))}))},[v]),j=d.useCallback(C=>{var $;C>=0&&C<t.scenes.length&&(h.current.stopAll(),s(I=>({...I,currentSceneIndex:C,currentTime:0})),($=e.onSceneChange)==null||$.call(e,C,t.scenes[C]))},[t.scenes,e]),Q=d.useCallback(C=>{s($=>({...$,playbackSpeed:Math.max(.25,Math.min(4,C))}))},[]),A=d.useCallback(C=>{const $=Math.max(0,Math.min(1,C));h.current.setVolume($),s(I=>({...I,volume:$}))},[]),P=d.useCallback(()=>{s(C=>{const $=!C.isMuted;return h.current.setMuted($),{...C,isMuted:$}})},[]),L=d.useCallback(()=>{j(a.currentSceneIndex+1)},[a.currentSceneIndex,j]),H=d.useCallback(()=>{j(a.currentSceneIndex-1)},[a.currentSceneIndex,j]),X=d.useCallback(C=>{s($=>({...$,loop:C}))},[]);return{playerState:{...a,totalDuration:y},timelineState:c,characterRegistry:g.current,play:b,pause:S,stop:_,seek:R,seekToScene:j,setPlaybackSpeed:Q,setVolume:A,toggleMute:P,nextScene:L,previousScene:H,setLoop:X}}function It({document:e,autoPlay:t=!1,loop:n=!1,showControls:i=!0,className:o,style:r,onSceneChange:a,onEnd:s}){var Q;const{playerState:c,timelineState:u,characterRegistry:m,play:p,pause:h,stop:f,seek:g,seekToScene:y,setPlaybackSpeed:v,setVolume:k,toggleMute:b,nextScene:S,previousScene:_,setLoop:R}=kt({document:e,autoPlay:t,loop:n,onSceneChange:a,onEnd:s}),j=e.scenes[c.currentSceneIndex];return j?d.createElement(wt.Provider,{value:{document:e,playerState:c,play:p,pause:h,stop:f,seek:g,seekToScene:y,setPlaybackSpeed:v,setVolume:k,toggleMute:b,nextScene:S,previousScene:_,setLoop:R}},d.createElement("div",{className:o,style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",backgroundColor:"#000",...r}},d.createElement("div",{style:{flex:1,position:"relative"}},d.createElement(gt,{document:e,scene:j,characterStates:c.characterStates,camera:(u==null?void 0:u.camera)??j.camera??{position:{x:640,y:360},zoom:1,rotation:0},activeEffects:c.activeEffects,characterRegistry:m}),(u==null?void 0:u.activeDialogue)&&d.createElement(xt,{text:u.activeDialogue.text,speakerName:(Q=e.characters.find(A=>{var P;return A.id===((P=u.activeDialogue)==null?void 0:P.speakerId)}))==null?void 0:Q.name,visible:!0,typewriterProgress:u.activeDialogue.typewriterProgress})),i&&d.createElement(Ur,{playerState:c,currentScene:j,totalScenes:e.scenes.length,onPlay:p,onPause:h,onStop:f,onSeek:g,onPreviousScene:_,onNextScene:S,onSpeedChange:v,onVolumeChange:k,onToggleMute:b,onToggleLoop:()=>R(!c.loop)}))):d.createElement("div",{className:o,style:r},"No scenes")}function Ur({playerState:e,currentScene:t,totalScenes:n,onPlay:i,onPause:o,onStop:r,onSeek:a,onPreviousScene:s,onNextScene:c,onSpeedChange:u,onVolumeChange:m,onToggleMute:p,onToggleLoop:h}){const f=b=>{const S=Math.floor(b/1e3),_=Math.floor(S/60),R=S%60;return`${_}:${R.toString().padStart(2,"0")}`},g=t.duration>0?e.currentTime/t.duration*100:0,y={display:"flex",alignItems:"center",gap:8,padding:"12px 16px",backgroundColor:"var(--nice-overlay-90, rgba(0, 0, 0, 0.9))",color:"var(--nice-color-white, #fff)"},v={background:"none",border:"none",color:"#fff",cursor:"pointer",padding:"8px",fontSize:16,opacity:.9},k={flex:1,height:4,backgroundColor:"var(--nice-border-color, #444)",borderRadius:2,cursor:"pointer"};return d.createElement("div",{style:y},d.createElement("button",{style:v,onClick:e.isPlaying&&!e.isPaused?o:i,title:e.isPlaying&&!e.isPaused?"Pause":"Play"},d.createElement(E.NiceIcon,{name:e.isPlaying&&!e.isPaused?"pause":"play",size:16})),d.createElement("button",{style:v,onClick:r,title:"Stop","aria-label":"Stop"},d.createElement(E.NiceIcon,{name:"stop",size:16})),d.createElement("button",{style:{...v,opacity:e.currentSceneIndex>0?.9:.3},onClick:s,disabled:e.currentSceneIndex<=0,title:"Previous Scene","aria-label":"Previous Scene"},d.createElement(E.NiceIcon,{name:"skip-back",size:16})),d.createElement("button",{style:{...v,opacity:e.currentSceneIndex<n-1?.9:.3},onClick:c,disabled:e.currentSceneIndex>=n-1,title:"Next Scene","aria-label":"Next Scene"},d.createElement(E.NiceIcon,{name:"skip-forward",size:16})),d.createElement("span",{style:{fontSize:12,fontFamily:"monospace"}},`${f(e.currentTime)} / ${f(t.duration)}`),d.createElement("div",{style:k,onClick:b=>{const S=b.currentTarget.getBoundingClientRect(),R=(b.clientX-S.left)/S.width;a(R*t.duration)}},d.createElement("div",{style:{width:`${g}%`,height:"100%",backgroundColor:"var(--nice-primary-light, #60a5fa)",borderRadius:2}})),d.createElement("select",{value:e.playbackSpeed,onChange:b=>u(parseFloat(b.target.value)),style:{background:"var(--nice-text, #333)",color:"var(--nice-text-inverse, #fff)",border:"none",padding:"4px 8px",borderRadius:4,fontSize:12}},d.createElement("option",{value:.25},"0.25x"),d.createElement("option",{value:.5},"0.5x"),d.createElement("option",{value:1},"1x"),d.createElement("option",{value:1.5},"1.5x"),d.createElement("option",{value:2},"2x")),d.createElement("button",{style:v,onClick:p,title:e.isMuted?"Unmute":"Mute"},d.createElement(E.NiceIcon,{name:e.isMuted?"volume-off":"volume",size:16})),d.createElement("input",{type:"range",min:0,max:1,step:.1,value:e.volume,onChange:b=>m(parseFloat(b.target.value)),style:{width:60}}),d.createElement("button",{style:{...v,color:e.loop?"var(--nice-primary-light, #60a5fa)":"#fff"},onClick:h,title:"Loop","aria-label":"Loop","aria-pressed":e.loop},d.createElement(E.NiceIcon,{name:"refresh",size:16})),d.createElement("span",{style:{fontSize:12}},`Scene ${e.currentSceneIndex+1}/${n}`))}function Hr({document:e,width:t=320,height:n=240,autoPlay:i=!1,className:o,style:r}){return d.createElement(It,{document:e,autoPlay:i,showControls:!1,className:o,style:{width:t,height:n,borderRadius:8,overflow:"hidden",...r}})}function Ct(e,t,n){var a,s,c,u;const i=t.assets.find(m=>m.id===e.assetId),o=[];if(e.animations)for(const[m,p]of Object.entries(e.animations)){const h=p.frames.map((f,g)=>({frameId:`${m}_frame_${g}`,duration:f.duration||1e3/p.fps,offset:{x:0,y:0}}));o.push({id:`anim_${m}`,name:m,category:$t(m),frames:h,fps:p.fps,loop:p.loop,duration:h.reduce((f,g)=>f+(g.duration??0),0)})}const r={};if(e.animations)for(const[m,p]of Object.entries(e.animations))p.frames.forEach((h,f)=>{r[`${m}_frame_${f}`]={frame:{x:h.srcRect.x,y:h.srcRect.y,w:h.srcRect.width,h:h.srcRect.height},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:h.srcRect.width,h:h.srcRect.height},sourceSize:{w:h.srcRect.width,h:h.srcRect.height}}});return{id:`char_${e.id}`,name:e.name,type:"sprite",visual:{type:"sprite",spriteSheet:(i==null?void 0:i.path)||"",atlas:{frames:r,meta:{image:(i==null?void 0:i.path)||"",size:{w:((a=i==null?void 0:i.metadata)==null?void 0:a.width)||e.width,h:((s=i==null?void 0:i.metadata)==null?void 0:s.height)||e.height},scale:1}},width:((c=i==null?void 0:i.metadata)==null?void 0:c.width)||e.width||100,height:((u=i==null?void 0:i.metadata)==null?void 0:u.height)||e.height||100},anchor:e.anchor||{x:.5,y:1},animations:o,expressions:[],defaultScale:1}}function Mt(e,t,n){var u,m,p,h;const{sprite:i,animator:o,transform:r}=e.components;if(!i)return null;const a=t.assets.find(f=>f.id===i.assetId),s=[];if(o!=null&&o.animations)for(const[f,g]of Object.entries(o.animations)){const y=g.frames.map((v,k)=>({frameId:`${f}_frame_${k}`,duration:v.duration||1e3/g.fps,offset:{x:0,y:0}}));s.push({id:`anim_${f}`,name:f,category:$t(f),frames:y,fps:g.fps,loop:g.loop,duration:y.reduce((v,k)=>v+(k.duration??0),0)})}const c={};if(o!=null&&o.animations)for(const[f,g]of Object.entries(o.animations))g.frames.forEach((y,v)=>{c[`${f}_frame_${v}`]={frame:{x:y.srcRect.x,y:y.srcRect.y,w:y.srcRect.width,h:y.srcRect.height},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:y.srcRect.width,h:y.srcRect.height},sourceSize:{w:y.srcRect.width,h:y.srcRect.height}}});return{id:`char_${e.id}`,name:e.name,type:"sprite",visual:{type:"sprite",spriteSheet:(a==null?void 0:a.path)||"",atlas:{frames:c,meta:{image:(a==null?void 0:a.path)||"",size:{w:((u=a==null?void 0:a.metadata)==null?void 0:u.width)||i.width,h:((m=a==null?void 0:a.metadata)==null?void 0:m.height)||i.height},scale:1}},width:((p=a==null?void 0:a.metadata)==null?void 0:p.width)||i.width||100,height:((h=a==null?void 0:a.metadata)==null?void 0:h.height)||i.height||100},anchor:i.anchor||{x:.5,y:1},animations:s,expressions:[],defaultScale:1}}function zt(e,t){var n,i;return e.type!=="image"&&e.type!=="spritesheet"?null:{id:`prop_${e.id}`,name:e.name,type:"image",asset:e.path,width:((n=e.metadata)==null?void 0:n.width)||100,height:((i=e.metadata)==null?void 0:i.height)||100,anchor:{x:.5,y:.5}}}function Vr(e,t){const n=[];for(const i of e.sprites)n.push(Ct(i,e));for(const i of e.entities){const o=Mt(i,e);o&&n.push(o)}return n}function Qr(e,t){const n=[];for(const i of e.assets){const o=zt(i);o&&n.push(o)}return n}function At(e){const t={};for(const o of e.animations){const r=[];if(e.visual.atlas)for(const a of o.frames){const s=e.visual.atlas.frames[a.frameId];s&&r.push({assetId:e.id+"_sheet",srcRect:{x:s.frame.x,y:s.frame.y,width:s.frame.w,height:s.frame.h},duration:a.duration})}t[o.name]={frames:r,fps:o.fps,loop:o.loop}}let n=64,i=64;if(e.visual.atlas){const o=Object.keys(e.visual.atlas.frames)[0];if(o){const r=e.visual.atlas.frames[o];n=r.frame.w,i=r.frame.h}}return{id:e.id,name:e.name,assetId:e.id+"_sheet",width:n,height:i,anchor:e.anchor,animations:t}}function Kr(e,t){var i;const n=At(e);return{id:e.id,name:e.name,components:{sprite:{assetId:n.assetId,width:n.width,height:n.height,anchor:n.anchor,visible:!0},animator:{currentAnimation:((i=e.animations[0])==null?void 0:i.name)||"",animations:n.animations||{},frame:0,elapsed:0,playing:!0,loop:!0},transform:{position:t||{x:0,y:0},rotation:0,scale:{x:1,y:1}}}}}function $t(e){const t=e.toLowerCase();return t.includes("idle")||t.includes("stand")?"idle":t.includes("walk")?"walk":t.includes("run")||t.includes("sprint")?"run":t.includes("jump")||t.includes("fall")||t.includes("attack")||t.includes("hit")||t.includes("shoot")?"action":t.includes("hurt")||t.includes("damage")||t.includes("die")?"emotion":(t.includes("special")||t.includes("skill"),"custom")}function Yr(e,t){const n=(t==null?void 0:t.columns)||Math.ceil(Math.sqrt(e.length)),i=(t==null?void 0:t.padding)||0;if(e.length===0)return{image:"",atlas:{frames:{},meta:{image:"",size:{w:0,h:0},scale:1}}};const o=e[0].width,r=e[0].height,a=Math.ceil(e.length/n),s=n*(o+i)-i,c=a*(r+i)-i,u={};return e.forEach((m,p)=>{const h=p%n,f=Math.floor(p/n);u[m.id]={frame:{x:h*(o+i),y:f*(r+i),w:o,h:r},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:o,h:r},sourceSize:{w:o,h:r}}}),{image:"",atlas:{frames:u,meta:{image:"",size:{w:s,h:c},scale:1}}}}function Xr(e,t,n,i,o){const r=o||Math.ceil(Math.sqrt(i)),a={};for(let c=0;c<i;c++){const u=c%r,m=Math.floor(c/r);a[`frame_${c}`]={frame:{x:u*t,y:m*n,w:t,h:n},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:t,h:n},sourceSize:{w:t,h:n}}}const s=Math.ceil(i/r);return{frames:a,meta:{image:e,size:{w:r*t,h:s*n},scale:1}}}function Gr(e){const t=[],n=[];e.id||t.push("Project is missing an ID"),(!e.assets||e.assets.length===0)&&n.push("Project has no assets"),!e.sprites&&!e.entities&&t.push("Project has no sprites or entities to import");for(const i of e.sprites||[])e.assets.find(r=>r.id===i.assetId)||n.push(`Sprite "${i.name}" references missing asset: ${i.assetId}`);for(const i of e.sprites||[])(!i.animations||Object.keys(i.animations).length===0)&&n.push(`Sprite "${i.name}" has no animations`);return{valid:t.length===0,errors:t,warnings:n}}function Jr(e,t){var s,c,u;const{flattenScenes:n=!1,includeCharacterSprites:i=!0,includeDialogue:o=!0,slideDuration:r=5e3}=t||{},a=[];if(n)for(const m of e.scenes){const p=Zr(m);for(let h=0;h<p.length;h++){const f=p[h],g=p[h+1]??m.duration,y=ea(e,m,f,g-f,i,o);a.push(y)}}else for(const m of e.scenes){const p=ta(e,m,i,o);a.push(p)}return{version:"1.0.0",id:e.id+"_presentation",title:e.title,description:(s=e.metadata)==null?void 0:s.description,author:(c=e.metadata)==null?void 0:c.author,createdAt:((u=e.metadata)==null?void 0:u.createdAt)||new Date().toISOString(),updatedAt:new Date().toISOString(),layout:{width:e.stageSize.width,height:e.stageSize.height,aspectRatio:`${e.stageSize.width}:${e.stageSize.height}`},slides:a,metadata:{sourcePuppetShow:e.id,convertedAt:new Date().toISOString()}}}function Zr(e){const t=new Set([0]);for(const n of e.timeline)for(const i of n.keyframes)t.add(i.time),"duration"in i&&typeof i.duration=="number"&&t.add(i.time+i.duration);return Array.from(t).sort((n,i)=>n-i)}function ea(e,t,n,i,o,r){var s,c;const a=[];if(o)for(const u of t.cast){const m=e.characters.find(f=>f.id===u.characterId);if(!m)continue;const p=na(t,u.instanceId,n)||u.position,h=ia(t,u.instanceId,n);a.push({id:`char_${u.instanceId}_${n}`,type:"image",position:{x:p.x,y:p.y,rotation:(h==null?void 0:h.rotation)??u.rotation},size:{width:((s=m.visual.atlas)==null?void 0:s.meta.size.w)??100,height:((c=m.visual.atlas)==null?void 0:c.meta.size.h)??100},content:{src:m.visual.spriteSheet,alt:m.name},style:{opacity:(h==null?void 0:h.opacity)??u.opacity??1,transform:(h==null?void 0:h.scale)!==void 0?`scale(${u.flipX?-h.scale:h.scale}, ${h.scale})`:void 0},zIndex:u.zIndex})}if(r){const u=oa(t,n);if(u){const m=e.characters.find(p=>{const h=t.timeline.find(f=>f.type==="dialogue");return(h==null?void 0:h.targetId)===p.id});a.push({id:`dialogue_${n}`,type:"text",position:{x:e.stageSize.width/2,y:e.stageSize.height-100},size:{width:e.stageSize.width*.9,height:80},content:{text:m?`${m.name}: ${u.text}`:u.text},style:{backgroundColor:"rgba(0, 0, 0, 0.85)",borderRadius:12},zIndex:1e3})}}return{id:`slide_${t.id}_${n}`,title:t.title,elements:a,background:_t(t.background),transition:t.transition?{type:t.transition.type,duration:t.transition.duration}:void 0,duration:i}}function ta(e,t,n,i){var r,a;const o=[];if(n)for(const s of t.cast){const c=e.characters.find(u=>u.id===s.characterId);c&&o.push({id:`char_${s.instanceId}`,type:"image",position:{x:s.position.x,y:s.position.y,rotation:s.rotation},size:{width:((r=c.visual.atlas)==null?void 0:r.meta.size.w)??100,height:((a=c.visual.atlas)==null?void 0:a.meta.size.h)??100},content:{src:c.visual.spriteSheet,alt:c.name},style:{opacity:s.opacity??1},animation:aa(t,s.instanceId),zIndex:s.zIndex})}for(const s of t.scenery){const c=e.props.find(u=>u.id===s.propId);c&&o.push({id:`prop_${s.instanceId}`,type:"image",position:{x:s.position.x,y:s.position.y,rotation:s.rotation},size:{width:c.width,height:c.height},content:{src:c.asset,alt:c.name},style:{opacity:s.opacity??1},zIndex:s.zIndex})}return i&&ra(t).forEach((c,u)=>{const m=e.characters.find(p=>p.id===c.speakerId);o.push({id:`dialogue_${u}`,type:"text",position:{x:e.stageSize.width/2,y:e.stageSize.height-100},size:{width:e.stageSize.width*.9,height:80},content:{text:m?`${m.name}: ${c.text}`:c.text},style:{backgroundColor:"rgba(0, 0, 0, 0.85)",borderRadius:12},animation:{enter:{type:"fadeIn",duration:300,delay:c.time},exit:{type:"fadeOut",duration:300,delay:c.time+c.duration-300}},zIndex:1e3+u})}),{id:`slide_${t.id}`,title:t.title,elements:o,background:_t(t.background),transition:t.transition?{type:t.transition.type,duration:t.transition.duration}:void 0,duration:t.duration,notes:`Converted from Puppet Show scene: ${t.title}`}}function na(e,t,n){const i=e.timeline.find(a=>a.type==="transform"&&a.targetId===t);if(!i)return null;const o=i.keyframes;let r=null;for(const a of o){const s=a.value;a.time<=n&&s.position&&(r=s)}return(r==null?void 0:r.position)??null}function ia(e,t,n){const i=e.timeline.find(a=>a.type==="transform"&&a.targetId===t);if(!i)return null;const o=i.keyframes;let r=null;for(const a of o)a.time<=n&&(r=a.value);return r?{scale:r.scale,rotation:r.rotation,opacity:r.opacity}:null}function oa(e,t){for(const n of e.timeline)if(n.type==="dialogue")for(const i of n.keyframes){const o=i.value;if(t>=i.time&&t<i.time+(i.duration??0))return{text:o.text,speakerId:n.targetId}}return null}function ra(e){const t=[];for(const n of e.timeline)if(n.type==="dialogue")for(const i of n.keyframes){const o=i.value;t.push({text:o.text,speakerId:n.targetId,time:i.time,duration:i.duration??0})}return t.sort((n,i)=>n.time-i.time)}function _t(e){var t,n;switch(e.type){case"solid":return{type:"solid",color:e.color};case"gradient":return e.gradient?{type:"gradient",gradient:e.gradient}:{type:"solid",color:"#000000"};case"image":return{type:"image",image:e.image};case"video":return{type:"video",video:e.video};case"parallax":return{type:"image",image:(n=(t=e.parallaxLayers)==null?void 0:t[0])==null?void 0:n.image};default:return{type:"solid",color:"#000000"}}}function aa(e,t){const n=e.timeline.find(o=>o.type==="transform"&&o.targetId===t);return!n||n.keyframes.length===0?void 0:{timeline:n.keyframes.map(o=>{var a,s;const r=o.value;return{time:o.time,properties:{x:(a=r.position)==null?void 0:a.x,y:(s=r.position)==null?void 0:s.y,scale:r.scale,rotation:r.rotation,opacity:r.opacity},easing:o.easing}})}}function sa(e,t){const n=[],i=[],o=[],r=new Map;for(const a of e.slides)for(const s of a.elements)s.type==="image"&&s.content.src&&(r.has(s.content.src)||r.set(s.content.src,new Set),r.get(s.content.src).add(s));if(t!=null&&t.createCharacterFromImages){for(const[a,s]of r)if(s.size>=2){const c=Array.from(s)[0],u=`char_${n.length}`;n.push({id:u,name:c.content.alt||`Character ${n.length+1}`,type:"sprite",visual:{type:"sprite",spriteSheet:a,atlas:{frames:{default:{frame:{x:0,y:0,w:c.size.width,h:c.size.height},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:c.size.width,h:c.size.height},sourceSize:{w:c.size.width,h:c.size.height}}},meta:{image:a,size:{w:c.size.width,h:c.size.height},scale:1}},width:c.size.width,height:c.size.height},anchor:{x:.5,y:1},animations:[{id:"idle",name:"Idle",category:"idle",frames:[{frameId:"default",duration:1e3,offset:{x:0,y:0}}],fps:1,loop:!0,duration:1e3}],expressions:[],defaultScale:1})}}for(const[a,s]of r)if(s.size<2||!(t!=null&&t.createCharacterFromImages)){const c=Array.from(s)[0];i.push({id:`prop_${i.length}`,name:c.content.alt||`Prop ${i.length+1}`,type:"image",asset:a,width:c.size.width,height:c.size.height,anchor:{x:.5,y:.5}})}for(const a of e.slides){const s=ca(a,e,n,i);o.push(s)}return{version:"1.0",id:e.id+"_puppetshow",title:e.title,stageSize:{width:e.layout.width,height:e.layout.height},scenes:o,characters:n,props:i,audioTracks:[],settings:{defaultFps:24,allowSpeedControl:!0,allowSeek:!0,autoPlay:!1,showControls:!0,loop:!1},metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),duration:e.slides.reduce((a,s)=>a+(s.duration??5e3),0),sceneCount:o.length,characterCount:n.length,sourcePresentation:e.id,convertedAt:new Date().toISOString()}}}function ca(e,t,n,i){var u,m,p,h;const o=[],r=[],a=[];let s=0,c=0;for(const f of e.elements)if(f.type==="image"&&f.content.src){const g=n.find(y=>y.visual.spriteSheet===f.content.src);if(g){const y=`${g.id}_instance_${s++}`;if(o.push({instanceId:y,characterId:g.id,position:{x:f.position.x,y:f.position.y},scale:1,rotation:f.position.rotation??0,zIndex:f.zIndex??s,opacity:((u=f.style)==null?void 0:u.opacity)??1,flipX:!1}),(m=f.animation)!=null&&m.timeline&&f.animation.timeline.length>1){const v={id:`transform_${y}`,type:"transform",targetId:y,keyframes:f.animation.timeline.map(k=>{const b=k.properties;return{time:k.time,easing:k.easing??"easeInOut",value:{type:"transform",position:b.x!==void 0?{x:b.x,y:b.y??0}:void 0,scale:b.scale,rotation:b.rotation,opacity:b.opacity}}})};a.push(v)}}else{const y=i.find(v=>v.asset===f.content.src);y&&r.push({instanceId:`${y.id}_instance_${c++}`,propId:y.id,position:{x:f.position.x,y:f.position.y},scale:1,rotation:f.position.rotation??0,zIndex:f.zIndex??c,opacity:((p=f.style)==null?void 0:p.opacity)??1})}}else if(f.type==="text"&&f.content.text&&f.position.y>t.layout.height*.7){const y=((h=o[0])==null?void 0:h.characterId)??"narrator",v=a.find(b=>b.type==="dialogue"&&b.targetId===y),k={time:0,duration:e.duration??3e3,easing:"linear",value:{type:"dialogue",text:f.content.text}};v?v.keyframes.push(k):a.push({id:`dialogue_${y}`,type:"dialogue",targetId:y,keyframes:[k]})}return{id:e.id,title:e.title||"Untitled Scene",duration:e.duration??5e3,background:e.background?{type:e.background.type,color:e.background.color,gradient:e.background.gradient,image:e.background.image,video:e.background.video}:{type:"solid",color:"#000000"},cast:o,scenery:r,timeline:a,camera:{position:{x:t.layout.width/2,y:t.layout.height/2},zoom:1,rotation:0},transition:e.transition?{type:(()=>{const f=e.transition.type;return f==="fade"?"fade":f==="zoom"?"zoom":f==="slide"?"slideLeft":"cut"})(),duration:e.transition.duration??500}:void 0}}function la(e){const t=[],n=[];e.id||t.push("Document missing id"),e.title||n.push("Document missing title"),e.version||n.push("Document missing version"),e.stageSize||t.push("Document missing stageSize"),(!e.scenes||e.scenes.length===0)&&t.push("Document has no scenes");const i=new Set(e.characters.map(r=>r.id));for(const r of e.scenes)for(const a of r.cast)i.has(a.characterId)||t.push(`Scene "${r.id}" references unknown character: ${a.characterId}`);const o=new Set(e.props.map(r=>r.id));for(const r of e.scenes)for(const a of r.scenery)o.has(a.propId)||t.push(`Scene "${r.id}" references unknown prop: ${a.propId}`);return{valid:t.length===0,errors:t,warnings:n}}function da(e,t){if(e.length===0)throw new Error("Cannot merge empty array of puppet shows");const n={version:"1.0",id:`merged_${Date.now()}`,title:e.map(r=>r.title).join(" + "),stageSize:e[0].stageSize,scenes:[],characters:[],props:[],audioTracks:[],settings:e[0].settings,metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),duration:e.reduce((r,a)=>{var s;return r+(((s=a.metadata)==null?void 0:s.duration)??0)},0),sceneCount:0,characterCount:0,mergedFrom:e.map(r=>r.id),mergedAt:new Date().toISOString()}},i=new Map,o=new Map;for(const r of e){for(const a of r.characters){if(t!=null&&t.deduplicateCharacters){const c=n.characters.find(u=>u.name===a.name);if(c){i.set(a.id,c.id);continue}}const s=`${r.id}_${a.id}`;i.set(a.id,s),n.characters.push({...a,id:s})}for(const a of r.props){const s=`${r.id}_${a.id}`;o.set(a.id,s),n.props.push({...a,id:s})}for(const a of r.scenes){const s={...a,id:`${r.id}_${a.id}`,cast:a.cast.map(c=>({...c,instanceId:`${r.id}_${c.instanceId}`,characterId:i.get(c.characterId)||c.characterId})),scenery:a.scenery.map(c=>({...c,instanceId:`${r.id}_${c.instanceId}`,propId:o.get(c.propId)||c.propId})),timeline:a.timeline.map(c=>({...c,id:`${r.id}_${c.id}`,targetId:i.get(c.targetId)||o.get(c.targetId)||`${r.id}_${c.targetId}`}))};n.scenes.push(s)}for(const a of r.audioTracks||[])n.audioTracks.push({...a,id:`${r.id}_${a.id}`})}return n}const Tt={good:"#4caf50",warning:"#ff9800",critical:"#f44336",info:"#2196f3",neutral:"#9e9e9e",background:"#fff",text:"#212121",textMuted:"#757575"};function ua(e){const t={...Tt,...e.colorScheme};return{id:e.id,title:e.title,type:"dashboard",layout:{columns:e.columns,rows:e.rows,gap:e.gap??16,padding:e.padding??24},widgets:e.widgets.map(n=>({...n,colSpan:n.colSpan??1,rowSpan:n.rowSpan??1,colors:{...t,...n.colors},animation:{countUp:!0,countUpDuration:1e3,entrance:"fadeIn",entranceDelay:0,...n.animation}})),dataSources:e.dataSources??[],refreshInterval:e.refreshInterval??3e4,colorScheme:t,background:e.background??t.background,showLastUpdated:e.showLastUpdated??!0,autoCycle:e.autoCycle??!1,autoCycleInterval:e.autoCycleInterval??5e3,lastUpdated:new Date().toISOString()}}function pa(e,t,n=!0){var o;if(!t||t.length===0)return"neutral";const i=[...t].sort((r,a)=>n?a.value-r.value:r.value-a.value);for(const r of i)if(n){if(e>=r.value)return r.status}else if(e<=r.value)return r.status;return((o=i[i.length-1])==null?void 0:o.status)??"neutral"}function fa(e,t){return t==null?"unknown":e>t?"up":e<t?"down":"flat"}function ma(e,t){if(typeof e=="string")return e;const{unit:n="",precision:i=0,compact:o=!1,locale:r="en-US"}=t??{};let a;return o&&Math.abs(e)>=1e3?a=new Intl.NumberFormat(r,{notation:"compact",maximumFractionDigits:1}).format(e):a=e.toLocaleString(r,{minimumFractionDigits:i,maximumFractionDigits:i}),n?`${a}${n}`:a}function Et(e){return{id:"revenue",title:"Revenue",type:"number-tile",column:1,row:1,unit:"$",precision:0,icon:"dollar-sign",thresholds:[{value:1e6,status:"good"},{value:5e5,status:"warning"},{value:0,status:"critical"}],...e}}function Nt(e){return{id:"customers",title:"Customers",type:"number-tile",column:2,row:1,icon:"users",thresholds:[{value:1e4,status:"good"},{value:5e3,status:"warning"},{value:0,status:"critical"}],...e}}function ha(e){return{id:"percentage-gauge",title:"Completion",type:"gauge",column:1,row:1,unit:"%",precision:1,gaugeConfig:{min:0,max:100,style:"semicircle",showNeedle:!0,showTicks:!0,tickCount:5,thickness:20},thresholds:[{value:80,status:"good"},{value:50,status:"warning"},{value:0,status:"critical"}],...e}}function ya(e){return{id:"sparkline-trend",title:"Weekly Trend",type:"sparkline",column:1,row:1,sparklineData:[],...e}}function ga(e){return{id:"traffic-light",title:"System Status",type:"traffic-light",column:1,row:1,...e}}function xa(e){return{id:"comparison",title:"Budget vs Actual",type:"comparison",column:1,row:1,targetValue:1e5,value:85e3,unit:"$",...e}}function ba(){return{id:"executive-dashboard",title:"Executive Summary",columns:4,rows:3,widgets:[Et({column:1,row:1,colSpan:1}),Nt({column:2,row:1,colSpan:1}),{id:"orders",title:"Orders",type:"number-tile",column:3,row:1,icon:"shopping-cart"},{id:"satisfaction",title:"CSAT Score",type:"gauge",column:4,row:1,unit:"%",gaugeConfig:{min:0,max:100,style:"semicircle"}},{id:"revenue-trend",title:"Revenue Trend",type:"sparkline",column:1,row:2,colSpan:2},{id:"top-products",title:"Top Products",type:"mini-bar",column:3,row:2,colSpan:2,chartData:[{label:"Product A",value:45e3},{label:"Product B",value:38e3},{label:"Product C",value:32e3},{label:"Product D",value:28e3},{label:"Product E",value:22e3}]},{id:"regional-breakdown",title:"Regional Sales",type:"mini-pie",column:1,row:3,colSpan:2,chartData:[{label:"North",value:35},{label:"South",value:25},{label:"East",value:22},{label:"West",value:18}]},{id:"budget-status",title:"Budget Status",type:"bullet-chart",column:3,row:3,colSpan:2,value:72e3,targetValue:1e5,unit:"$"}]}}function va(){return{id:"operational-dashboard",title:"Operational Metrics",columns:3,rows:2,widgets:[{id:"uptime",title:"System Uptime",type:"gauge",column:1,row:1,value:99.9,unit:"%",gaugeConfig:{min:0,max:100,style:"full-circle"},thresholds:[{value:99.5,status:"good"},{value:99,status:"warning"},{value:0,status:"critical"}]},{id:"response-time",title:"Avg Response Time",type:"number-tile",column:2,row:1,value:145,unit:"ms",icon:"clock",thresholds:[{value:0,status:"good"},{value:200,status:"warning"},{value:500,status:"critical"}]},{id:"error-rate",title:"Error Rate",type:"traffic-light",column:3,row:1,value:.5,unit:"%"},{id:"throughput",title:"Requests/sec",type:"sparkline",column:1,row:2,colSpan:2,sparklineData:[120,135,128,145,152,148,160,155,170,165]},{id:"incidents",title:"Open Incidents",type:"number-tile",column:3,row:2,value:3,icon:"alert-triangle",thresholds:[{value:0,status:"good"},{value:5,status:"warning"},{value:10,status:"critical"}]}]}}function Sa(e){var t,n,i;return{id:e.id,type:"datagrid",title:e.title,subtitle:e.subtitle,config:{...e,columns:e.columns.map(o=>({width:"auto",align:"left",dataType:"string",sortable:!0,filterable:!1,...o})),interactiveSort:e.interactiveSort??!0,interactiveFilter:e.interactiveFilter??!1,enableSelection:e.enableSelection??!0,showRowNumbers:e.showRowNumbers??!1,showColumnBorders:e.showColumnBorders??!1,stripedRows:e.stripedRows??!0,pageSize:e.pageSize??10,animation:{rowEntrance:"fadeIn",staggerDelay:50,duration:300,progressiveReveal:!1,revealBatchSize:5,...e.animation},style:{headerBackground:"#f5f5f5",headerColor:"#212121",rowBackground:"#fff",rowBackgroundAlt:"#fafafa",cellColor:"#424242",borderColor:"#e0e0e0",fontSize:14,headerFontSize:14,rowHeight:48,cellPadding:12,borderRadius:8,...e.style}},state:{currentSort:e.defaultSort??[],currentFilters:e.defaultFilters??[],selectedCells:[],currentPage:0,revealedRowCount:(t=e.animation)!=null&&t.progressiveReveal?e.animation.revealBatchSize??5:((n=e.data)==null?void 0:n.length)??0,isFullyRevealed:!((i=e.animation)!=null&&i.progressiveReveal),lastUpdated:new Date().toISOString()}}}function wa(e,t){return t.length===0?e:[...e].sort((n,i)=>{for(const o of t){const r=n[o.field],a=i[o.field];let s=0;if(r==null&&a==null?s=0:r==null?s=1:a==null?s=-1:typeof r=="number"&&typeof a=="number"?s=r-a:s=String(r).localeCompare(String(a)),s!==0)return o.direction==="desc"?-s:s}return 0})}function ka(e,t){return t.length===0?e:e.filter(n=>t.every(i=>{const o=n[i.field],r=i.value;switch(i.operator){case"equals":return o===r;case"notEquals":return o!==r;case"contains":return String(o).toLowerCase().includes(String(r).toLowerCase());case"startsWith":return String(o).toLowerCase().startsWith(String(r).toLowerCase());case"endsWith":return String(o).toLowerCase().endsWith(String(r).toLowerCase());case"greaterThan":return Number(o)>Number(r);case"lessThan":return Number(o)<Number(r);case"between":return Number(o)>=Number(r)&&Number(o)<=Number(i.valueTo);case"in":return Array.isArray(r)&&r.includes(o);default:return!0}}))}function Ia(e,t){const n={};for(const i of t.columns){const o=e.map(r=>r[i.columnId]).filter(r=>r!=null);switch(i.aggregation){case"sum":n[i.columnId]=o.reduce((r,a)=>r+Number(a),0);break;case"avg":n[i.columnId]=o.length>0?o.reduce((r,a)=>r+Number(a),0)/o.length:0;break;case"min":n[i.columnId]=Math.min(...o.map(Number));break;case"max":n[i.columnId]=Math.max(...o.map(Number));break;case"count":n[i.columnId]=o.length;break;case"custom":n[i.columnId]=i.customValue??"";break}}return n}function Ca(e,t,n="en-US"){if(e==null)return"";switch(t.dataType){case"number":return Number(e).toLocaleString(n,{minimumFractionDigits:t.precision??0,maximumFractionDigits:t.precision??0});case"currency":return Number(e).toLocaleString(n,{style:"currency",currency:t.currency??"USD"});case"percent":return Number(e).toLocaleString(n,{style:"percent",minimumFractionDigits:t.precision??0});case"date":return new Date(String(e)).toLocaleDateString(n);case"boolean":return e?"✓":"✗";default:return String(e)}}function Ma(e,t){if(!t)return null;for(const n of t){const{operator:i,value:o,valueTo:r}=n.condition;let a=!1;switch(i){case"equals":a=e===o;break;case"notEquals":a=e!==o;break;case"greaterThan":a=Number(e)>Number(o);break;case"lessThan":a=Number(e)<Number(o);break;case"between":a=Number(e)>=Number(o)&&Number(e)<=Number(r);break;case"contains":a=String(e).toLowerCase().includes(String(o).toLowerCase());break;case"isEmpty":a=e==null||e==="";break}if(a)return n.style}return null}function za(e){return{id:"sales-grid",title:"Sales Report",subtitle:"Q4 2025 Performance",columns:[{id:"region",header:"Region",field:"region",width:150},{id:"product",header:"Product",field:"product",width:200},{id:"units",header:"Units Sold",field:"units",dataType:"number",align:"right"},{id:"revenue",header:"Revenue",field:"revenue",dataType:"currency",align:"right",conditionalFormat:[{condition:{operator:"greaterThan",value:1e5},style:{backgroundColor:"#e8f5e9",color:"#2e7d32"}},{condition:{operator:"lessThan",value:5e4},style:{backgroundColor:"#ffebee",color:"#c62828"}}]},{id:"growth",header:"Growth %",field:"growth",dataType:"percent",align:"right",precision:1}],data:e??[{region:"North",product:"Widget Pro",units:1250,revenue:125e3,growth:.15},{region:"South",product:"Widget Pro",units:980,revenue:98e3,growth:.08},{region:"East",product:"Gadget Plus",units:1500,revenue:18e4,growth:.22},{region:"West",product:"Gadget Plus",units:1100,revenue:132e3,growth:.12}],summaryRow:{enabled:!0,columns:[{columnId:"units",aggregation:"sum",label:"Total"},{columnId:"revenue",aggregation:"sum"},{columnId:"growth",aggregation:"avg"}]},animation:{rowEntrance:"slideInLeft",staggerDelay:100}}}function Aa(e){return{id:"employee-grid",title:"Team Directory",columns:[{id:"name",header:"Name",field:"name",width:180},{id:"role",header:"Role",field:"role",width:150},{id:"department",header:"Department",field:"department",width:120,filterable:!0},{id:"email",header:"Email",field:"email",width:200},{id:"status",header:"Status",field:"status",cellRenderer:"badge",width:100}],data:e??[],showRowNumbers:!0,interactiveFilter:!0}}function $a(e){var n;const t={};return(n=e.parameters)==null||n.forEach(i=>{i.defaultValue!==void 0&&(t[i.name]=i.defaultValue)}),{id:e.id,type:"query",title:e.title,subtitle:e.subtitle,config:{...e,autoExecute:e.autoExecute??!1,showQueryEditor:e.showQueryEditor??!0,allowQueryEdit:e.allowQueryEdit??!1,showExecutionStats:e.showExecutionStats??!0,cacheDuration:e.cacheDuration??0,style:{editorTheme:"dark",editorFontSize:14,resultBackground:"#fff",accentColor:"#1976d2",borderRadius:8,...e.style}},state:{currentQuery:e.query,currentParameters:t,result:null,isExecuting:!1,lastExecutedAt:null,error:null,visualizationMode:e.visualization.mode,history:[]}}}function _a(e,t){const n=[];switch(t){case"sql":{const i=e.matchAll(/[@:](\w+)/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}case"odata":{const i=e.matchAll(/\{(\w+)\}/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}case"graphql":{const i=e.matchAll(/\$(\w+)/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}case"kql":{const i=e.matchAll(/\{(\w+)\}/g);for(const o of i)n.includes(o[1])||n.push(o[1]);break}}return n}function Ta(e,t,n){let i=e;for(const[o,r]of Object.entries(n)){const a=Ea(r);switch(t){case"sql":i=i.replace(new RegExp(`@${o}\\b`,"g"),a),i=i.replace(new RegExp(`:${o}\\b`,"g"),a);break;case"odata":case"kql":i=i.replace(new RegExp(`\\{${o}\\}`,"g"),a);break}}return i}function Ea(e){return e==null?"NULL":typeof e=="number"?String(e):typeof e=="boolean"?e?"TRUE":"FALSE":e instanceof Date?`'${e.toISOString()}'`:`'${String(e).replace(/'/g,"''")}'`}function Na(e,t){const n={};for(const i of e){const o=t[i.name];if(i.required&&(o==null||o==="")){n[i.name]=`${i.label} is required`;continue}if(o!=null&&i.validation){if(i.type==="number"){const r=Number(o);i.validation.min!==void 0&&r<i.validation.min&&(n[i.name]=i.validation.message??`Minimum value is ${i.validation.min}`),i.validation.max!==void 0&&r>i.validation.max&&(n[i.name]=i.validation.message??`Maximum value is ${i.validation.max}`)}i.type==="string"&&i.validation.pattern&&(new RegExp(i.validation.pattern).test(String(o))||(n[i.name]=i.validation.message??"Invalid format"))}}return{valid:Object.keys(n).length===0,errors:n}}function Ra(e){if(!e.success||e.rowCount===0)return"table";const t=e.columns.filter(i=>i.type==="number"),n=e.columns.filter(i=>i.type==="date");return e.rowCount===1&&t.length>=3?"metrics":n.length===1&&t.length>=1&&e.rowCount>3?"line-chart":t.length===1&&e.rowCount<=15?"bar-chart":t.length===1&&e.rowCount<=8?"pie-chart":"table"}function Pa(e,t){var s,c,u;if(!e.success||e.columns.length===0)return;const n=e.columns.filter(m=>m.type==="number"),i=e.columns.filter(m=>m.type!=="number"),r=((s=e.columns.filter(m=>m.type==="date")[0])==null?void 0:s.name)??((c=i[0])==null?void 0:c.name)??e.columns[0].name,a=n.length>0?n.length===1?n[0].name:n.slice(0,3).map(m=>m.name):(u=e.columns[1])==null?void 0:u.name;return{xAxis:r,yAxis:a,showLegend:Array.isArray(a)&&a.length>1,showGrid:!0,colorScheme:["#1976d2","#43a047","#fb8c00","#e53935","#8e24aa"]}}function qa(){return{id:"sales-query",title:"Sales Analysis",subtitle:"Query live sales data",language:"sql",query:`SELECT
134
134
  Region,
135
135
  ProductCategory,
136
136
  SUM(Revenue) as TotalRevenue,