@nice2dev/ui-presentations 1.0.18 → 1.0.20

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
@@ -1 +1,150 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DtM3-JcR.cjs");exports.BRAND_KIT_CORPORATE=e.BRAND_KIT_CORPORATE;exports.BRAND_KIT_NICE2DEV=e.BRAND_KIT_NICE2DEV;exports.BRAND_KIT_STARTUP=e.BRAND_KIT_STARTUP;exports.BUILT_IN_TRANSITIONS=e.BUILT_IN_TRANSITIONS;exports.BackgroundRenderer=e.BackgroundRenderer;exports.CharacterRegistry=e.CharacterRegistry;exports.DEFAULT_KPI_COLORS=e.DEFAULT_KPI_COLORS;exports.DialogueBox=e.DialogueBox;exports.EffectRenderer=e.EffectRenderer;exports.InteractiveButton=e.InteractiveButton;exports.InteractiveCountdown=e.InteractiveCountdown;exports.InteractivePoll=e.InteractivePoll;exports.InteractiveQnA=e.InteractiveQnA;exports.InteractiveQuiz=e.InteractiveQuiz;exports.NiceI18nProvider=e.NiceI18nProvider;exports.NicePresentationEditor=e.NicePresentationEditor;exports.NicePresentationPlayer=e.NicePresentationPlayer;exports.NicePresentationToolbar=e.PresentationToolbar;exports.NiceSlideCanvas=e.SlideCanvas;exports.NiceSlidePropertyPanel=e.SlidePropertyPanel;exports.NiceSlideThumbnailList=e.SlideThumbnailList;exports.PresentationModel=e.PresentationModel;exports.PresentationToolbar=e.PresentationToolbar;exports.PresentationVersionManager=e.PresentationVersionManager;exports.PuppetAnimationController=e.PuppetAnimationController;exports.PuppetCharacter=e.PuppetCharacter;exports.PuppetSceneBuilder=e.PuppetSceneBuilder;exports.PuppetShowMiniPlayer=e.PuppetShowMiniPlayer;exports.PuppetShowPlayer=e.PuppetShowPlayer;exports.PuppetStage=e.PuppetStage;exports.SLIDE_16_9=e.SLIDE_16_9;exports.SLIDE_4_3=e.SLIDE_4_3;exports.SLIDE_WIDESCREEN=e.SLIDE_WIDESCREEN;exports.SlideCanvas=e.SlideCanvas;exports.SlideLibraryManager=e.SlideLibraryManager;exports.SlidePropertyPanel=e.SlidePropertyPanel;exports.SlideThumbnailList=e.SlideThumbnailList;exports.THEME_CORPORATE=e.THEME_CORPORATE;exports.THEME_MINIMAL=e.THEME_MINIMAL;exports.THEME_MODERN_DARK=e.THEME_MODERN_DARK;exports.THEME_NICE2DEV=e.THEME_NICE2DEV;exports.TRANSITION_BLUR_FADE=e.TRANSITION_BLUR_FADE;exports.TRANSITION_CIRCLE_REVEAL=e.TRANSITION_CIRCLE_REVEAL;exports.TRANSITION_CUBE_LEFT=e.TRANSITION_CUBE_LEFT;exports.TRANSITION_FADE=e.TRANSITION_FADE;exports.TRANSITION_FLIP_HORIZONTAL=e.TRANSITION_FLIP_HORIZONTAL;exports.TRANSITION_FLIP_VERTICAL=e.TRANSITION_FLIP_VERTICAL;exports.TRANSITION_GLITCH=e.TRANSITION_GLITCH;exports.TRANSITION_MORPH=e.TRANSITION_MORPH;exports.TRANSITION_ROTATE_IN=e.TRANSITION_ROTATE_IN;exports.TRANSITION_SLIDE_DOWN=e.TRANSITION_SLIDE_DOWN;exports.TRANSITION_SLIDE_LEFT=e.TRANSITION_SLIDE_LEFT;exports.TRANSITION_SLIDE_RIGHT=e.TRANSITION_SLIDE_RIGHT;exports.TRANSITION_SLIDE_UP=e.TRANSITION_SLIDE_UP;exports.TRANSITION_WIPE_LEFT=e.TRANSITION_WIPE_LEFT;exports.TRANSITION_WIPE_RIGHT=e.TRANSITION_WIPE_RIGHT;exports.TRANSITION_ZOOM_IN=e.TRANSITION_ZOOM_IN;exports.TRANSITION_ZOOM_OUT=e.TRANSITION_ZOOM_OUT;exports.TimelineEngine=e.TimelineEngine;exports.TimelineTrackBuilder=e.TimelineTrackBuilder;exports.addAnimationToCharacter=e.addAnimationToCharacter;exports.addExpressionToCharacter=e.addExpressionToCharacter;exports.applyBrandKit=e.applyBrandKit;exports.applyEasing=e.applyEasing;exports.applyFiltersToData=e.applyFiltersToData;exports.applySortToData=e.applySortToData;exports.brandKitToTheme=e.brandKitToTheme;exports.calculateSummaryRow=e.calculateSummaryRow;exports.cloneTimeline=e.cloneTimeline;exports.computeCustomTransitionState=e.computeCustomTransitionState;exports.computeElementState=e.computeElementState;exports.computeKPIStatus=e.computeKPIStatus;exports.computeTransitionState=e.computeTransitionState;exports.computeTrend=e.computeTrend;exports.createCharacterFromSpriteSheet=e.createCharacterFromSpriteSheet;exports.createComparisonWidget=e.createComparisonWidget;exports.createContactSlide=e.createContactSlide;exports.createCustomTransition=e.createCustomTransition;exports.createCustomerCountWidget=e.createCustomerCountWidget;exports.createDashboardSlide=e.createDashboardSlide;exports.createDataGridSlide=e.createDataGridSlide;exports.createEmployeeDataGrid=e.createEmployeeDataGrid;exports.createExecutiveDashboard=e.createExecutiveDashboard;exports.createFeedbackSlide=e.createFeedbackSlide;exports.createKQLQuerySlide=e.createKQLQuerySlide;exports.createMultiQRSlide=e.createMultiQRSlide;exports.createODataQuerySlide=e.createODataQuerySlide;exports.createOperationalDashboard=e.createOperationalDashboard;exports.createPercentageGauge=e.createPercentageGauge;exports.createPollSlide=e.createPollSlide;exports.createPresentationLinkSlide=e.createPresentationLinkSlide;exports.createQRCodeSlide=e.createQRCodeSlide;exports.createQuerySlide=e.createQuerySlide;exports.createRevenueWidget=e.createRevenueWidget;exports.createSalesDataGrid=e.createSalesDataGrid;exports.createSalesQuerySlide=e.createSalesQuerySlide;exports.createSampleArchitectureData=e.createSampleArchitectureData;exports.createSampleIncidentReportData=e.createSampleIncidentReportData;exports.createSampleOnboardingData=e.createSampleOnboardingData;exports.createSampleProductPitchData=e.createSampleProductPitchData;exports.createSampleQuarterlyReportData=e.createSampleQuarterlyReportData;exports.createSampleSprintReviewData=e.createSampleSprintReviewData;exports.createSparklineTrend=e.createSparklineTrend;exports.createSpriteSheetFromFrames=e.createSpriteSheetFromFrames;exports.createTrafficLight=e.createTrafficLight;exports.createWiFiSlide=e.createWiFiSlide;exports.detectBestVisualization=e.detectBestVisualization;exports.easingFunctions=e.easingFunctions;exports.encodeQRContent=e.encodeQRContent;exports.exportCharacterToEntity=e.exportCharacterToEntity;exports.exportCharacterToSprite=e.exportCharacterToSprite;exports.exportToHtml=e.exportToHtml;exports.extractQueryParameters=e.extractQueryParameters;exports.formatCellValue=e.formatCellValue;exports.formatKPIValue=e.formatKPIValue;exports.formatTime=e.formatTime;exports.framesToTime=e.framesToTime;exports.generateArchitectureOverview=e.generateArchitectureOverview;exports.generateChartConfig=e.generateChartConfig;exports.generateIncidentReport=e.generateIncidentReport;exports.generateOnboarding=e.generateOnboarding;exports.generateProductPitch=e.generateProductPitch;exports.generateQuarterlyReport=e.generateQuarterlyReport;exports.generateSprintReview=e.generateSprintReview;exports.getConditionalStyle=e.getConditionalStyle;exports.getEasingFunction=e.getEasingFunction;exports.getSceneDuration=e.getSceneDuration;exports.getTrackDuration=e.getTrackDuration;exports.importAssetAsProp=e.importAssetAsProp;exports.importEntityAsCharacter=e.importEntityAsCharacter;exports.importProjectCharacters=e.importProjectCharacters;exports.importProjectProps=e.importProjectProps;exports.importSpriteAsCharacter=e.importSpriteAsCharacter;exports.lerp=e.lerp;exports.lerpPosition=e.lerpPosition;exports.mapTransitionEffectToId=e.mapTransitionEffectToId;exports.mergePuppetShows=e.mergePuppetShows;exports.parseNdpJson=e.parseNdpJson;exports.parseSpriteSheetGrid=e.parseSpriteSheetGrid;exports.parseTime=e.parseTime;exports.presentationToPuppetShow=e.presentationToPuppetShow;exports.puppetShowToPresentation=e.puppetShowToPresentation;exports.removeBrandKit=e.removeBrandKit;exports.renderCharacterToCanvas=e.renderCharacterToCanvas;exports.renderChartSvg=e.renderChartSvg;exports.stringifyNdpJson=e.stringifyNdpJson;exports.substituteParameters=e.substituteParameters;exports.syncPresentationToYjs=e.syncPresentationToYjs;exports.syncYjsToPresentation=e.syncYjsToPresentation;exports.timeToFrames=e.timeToFrames;exports.transitionRegistry=e.transitionRegistry;exports.transitionToKeyframes=e.transitionToKeyframes;exports.useCameraShake=e.useCameraShake;exports.useCharacterRegistry=e.useCharacterRegistry;exports.useCollaborativePresentation=e.useCollaborativePresentation;exports.useNiceTranslation=e.useNiceTranslation;exports.usePresentationEditor=e.usePresentationEditor;exports.usePuppetAnimation=e.usePuppetAnimation;exports.usePuppetPlayer=e.usePuppetPlayer;exports.usePuppetShowPlayer=e.usePuppetShowPlayer;exports.usePuppetStage=e.usePuppetStage;exports.validateParameters=e.validateParameters;exports.validateProjectForImport=e.validateProjectForImport;exports.validatePuppetShowDocument=e.validatePuppetShowDocument;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),U=require("@nice2dev/ui"),l=require("react");function De(e){const{slideSize:t,theme:n,slides:i}=e,o=i.map((r,a)=>Pt(r,t,n,a)).join(`
2
+ `);return`<!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>${ue(e.title)}</title>
8
+ <style>
9
+ * { margin: 0; padding: 0; box-sizing: border-box; }
10
+ body { background: var(--nice-text, #000); overflow: hidden; font-family: ${n.fontFamily??"sans-serif"}; }
11
+ .ndp-slide {
12
+ position: absolute; top: 0; left: 0;
13
+ width: ${t.width}px; height: ${t.height}px;
14
+ transform-origin: top left;
15
+ display: none;
16
+ }
17
+ .ndp-slide.active { display: block; }
18
+ .ndp-element {
19
+ position: absolute;
20
+ }
21
+ .ndp-element-text { white-space: pre-wrap; }
22
+ .ndp-controls {
23
+ position: fixed; bottom: 20px; right: 20px; z-index: 1000;
24
+ display: flex; gap: var(--nice-space-2, 8px);
25
+ }
26
+ .ndp-controls button {
27
+ padding: var(--nice-space-2, 8px) var(--nice-space-4, 16px); border: none; border-radius: var(--nice-radius-sm, 4px);
28
+ background: var(--nice-overlay-light-20, rgba(255, 255, 255, 0.2)); color: var(--nice-bg, #FFF);
29
+ cursor: pointer; font-size: 14px;
30
+ }
31
+ .ndp-controls button:hover { background: var(--nice-overlay-light-35, rgba(255, 255, 255, 0.35)); }
32
+ .ndp-counter {
33
+ position: fixed; bottom: 20px; left: 20px; z-index: 1000;
34
+ color: var(--nice-overlay-light-50, rgba(255, 255, 255, 0.5)); font-size: 14px;
35
+ }
36
+ </style>
37
+ </head>
38
+ <body>
39
+ ${o}
40
+ <div class="ndp-controls">
41
+ <button onclick="prevSlide()">◀ Prev</button>
42
+ <button onclick="nextSlide()">Next ▶</button>
43
+ </div>
44
+ <div class="ndp-counter" id="counter"></div>
45
+ <script>
46
+ (function() {
47
+ var slides = document.querySelectorAll('.ndp-slide');
48
+ var current = 0;
49
+ var total = slides.length;
50
+ function show(idx) {
51
+ slides.forEach(function(s) { s.classList.remove('active'); });
52
+ slides[idx].classList.add('active');
53
+ document.getElementById('counter').textContent = (idx + 1) + ' / ' + total;
54
+ fitSlide();
55
+ }
56
+ function fitSlide() {
57
+ var sw = ${t.width}, sh = ${t.height};
58
+ var ww = window.innerWidth, wh = window.innerHeight;
59
+ var scale = Math.min(ww / sw, wh / sh);
60
+ var ox = (ww - sw * scale) / 2, oy = (wh - sh * scale) / 2;
61
+ slides.forEach(function(s) {
62
+ s.style.transform = 'translate(' + ox + 'px,' + oy + 'px) scale(' + scale + ')';
63
+ });
64
+ }
65
+ window.nextSlide = function() { if (current < total - 1) show(++current); };
66
+ window.prevSlide = function() { if (current > 0) show(--current); };
67
+ document.addEventListener('keydown', function(e) {
68
+ if (e.key === 'ArrowRight' || e.key === ' ') { e.preventDefault(); nextSlide(); }
69
+ if (e.key === 'ArrowLeft') { e.preventDefault(); prevSlide(); }
70
+ if (e.key === 'Escape' || e.key === 'f' || e.key === 'F') {
71
+ if (!document.fullscreenElement) document.documentElement.requestFullscreen();
72
+ else document.exitFullscreen();
73
+ }
74
+ });
75
+ window.addEventListener('resize', fitSlide);
76
+ show(0);
77
+ })();
78
+ <\/script>
79
+ </body>
80
+ </html>`}function Pt(e,t,n,i){const o=n.backgroundColor??"var(--nice-bg, #fff)",r=n.textColor??"var(--nice-text, #000000)";let a="";const s=e.background;if(s.type==="gradient"&&s.gradientStops){const d=s.gradientStops.map(p=>`${p.color} ${p.position*100}%`).join(", ");a=`background: linear-gradient(${s.gradientDirection??180}deg, ${d});`}else s.type==="image"&&s.imageUrl?a=`background: url('${s.imageUrl}') center/${s.imageFit??"cover"} no-repeat; background-color: ${s.color??o};`:a=`background: ${s.color??o};`;const c=e.elements.map(d=>Nt(d,t,n)).join(`
81
+ `);return`<div class="ndp-slide${i===0?" active":""}" style="${a} color: ${r};">
82
+ ${c}
83
+ </div>`}function Nt(e,t,n){const{position:i}=e,o=i.x/100*t.width,r=i.y/100*t.height,a=i.width/100*t.width,s=i.height/100*t.height,c=e.rotation?`transform: rotate(${e.rotation}deg);`:"",d=e.opacity!==void 0?`opacity: ${e.opacity};`:"",p=`position: absolute; left: ${o}px; top: ${r}px; width: ${a}px; height: ${s}px; ${c} ${d}`,m=e.content;switch(m.kind??m.type){case"text":{const f=m,x=f.fontSize??16,g=f.fontColor??n.textColor??"var(--nice-text, #000)",b=f.fontFamily??n.fontFamily??"sans-serif",S=f.fontWeight??"normal",h=f.textAlign??"left";return`<div class="ndp-element ndp-element-text" style="${p} font-size: ${x}px; color: ${g}; font-family: ${b}; font-weight: ${S}; text-align: ${h};">${ue(f.text)}</div>`}case"image":{const f=m;return`<div class="ndp-element" style="${p}"><img src="${ue(f.src)}" alt="${ue(f.alt??"")}" style="width:100%;height:100%;object-fit:${f.objectFit??"contain"};border-radius:${f.borderRadius??0}px;" /></div>`}case"code":{const f=m;return`<div class="ndp-element" style="${p} background: ${f.theme==="light"?"var(--nice-bg-secondary, #f5f5f5)":"var(--nice-bg, #1e1e1e)"}; color: ${f.theme==="light"?"var(--nice-text, #333)":"var(--nice-text, #d4d4d4)"}; padding: var(--nice-space-4, 16px); border-radius: var(--nice-radius-lg, 8px); overflow: auto; font-family: monospace; font-size: ${f.fontSize??14}px; white-space: pre;">${ue(f.code)}</div>`}case"shape":{const f=m,x=f.fill??"var(--nice-border, #ccc)";return`<div class="ndp-element" style="${p} background: ${x}; border-radius: ${f.shapeType==="ellipse"?"50%":"0"}; border: ${f.strokeWidth??0}px solid ${f.stroke??"transparent"};"></div>`}default:return`<div class="ndp-element" style="${p}"></div>`}}function ue(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const ze={en:{"toolbar.addSlide":"Add Slide","toolbar.deleteSlide":"Delete Slide","toolbar.duplicateSlide":"Duplicate","toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.present":"Present","toolbar.export":"Export","toolbar.theme":"Theme","element.text":"Text","element.image":"Image","element.shape":"Shape","element.chart":"Chart","element.table":"Table","element.code":"Code","element.diagram":"Diagram","element.video":"Video","element.icon":"Icon","element.addElement":"Add Element","panel.slideProperties":"Slide Properties","panel.elementProperties":"Element Properties","panel.noSelection":"Select a slide or element","panel.layout":"Layout","panel.background":"Background","panel.transition":"Transition","panel.notes":"Speaker Notes","player.play":"Play","player.pause":"Pause","player.fullscreen":"Fullscreen","player.exit":"Exit","player.slideOf":"of","layout.blank":"Blank","layout.titleSlide":"Title Slide","layout.titleContent":"Title + Content","layout.twoColumn":"Two Column","layout.titleOnly":"Title Only","layout.sectionHeader":"Section Header","layout.comparison":"Comparison","layout.custom":"Custom","export.html":"HTML Presentation","export.ndp":".ndp.json"},pl:{"toolbar.addSlide":"Dodaj slajd","toolbar.deleteSlide":"Usuń slajd","toolbar.duplicateSlide":"Duplikuj","toolbar.undo":"Cofnij","toolbar.redo":"Powtórz","toolbar.present":"Prezentuj","toolbar.export":"Eksport","toolbar.theme":"Motyw","element.text":"Tekst","element.image":"Obraz","element.shape":"Kształt","element.chart":"Wykres","element.table":"Tabela","element.code":"Kod","element.diagram":"Diagram","element.video":"Wideo","element.icon":"Ikona","element.addElement":"Dodaj element","panel.slideProperties":"Właściwości slajdu","panel.elementProperties":"Właściwości elementu","panel.noSelection":"Wybierz slajd lub element","panel.layout":"Układ","panel.background":"Tło","panel.transition":"Przejście","panel.notes":"Notatki prelegenta","player.play":"Odtwórz","player.pause":"Pauza","player.fullscreen":"Pełny ekran","player.exit":"Wyjdź","player.slideOf":"z","layout.blank":"Puste","layout.titleSlide":"Slajd tytułowy","layout.titleContent":"Tytuł + treść","layout.twoColumn":"Dwie kolumny","layout.titleOnly":"Tylko tytuł","layout.sectionHeader":"Nagłówek sekcji","layout.comparison":"Porównanie","layout.custom":"Niestandardowy","export.html":"Prezentacja HTML","export.ndp":".ndp.json"},de:{"toolbar.addSlide":"Folie hinzufügen","toolbar.deleteSlide":"Folie löschen","toolbar.duplicateSlide":"Duplizieren","toolbar.undo":"Rückgängig","toolbar.redo":"Wiederholen","toolbar.present":"Präsentieren","toolbar.export":"Exportieren","toolbar.theme":"Design","element.text":"Text","element.image":"Bild","element.shape":"Form","element.chart":"Diagramm","element.table":"Tabelle","element.code":"Code","element.diagram":"Diagramm","element.video":"Video","element.icon":"Symbol","element.addElement":"Element hinzufügen","panel.slideProperties":"Folieneigenschaften","panel.elementProperties":"Elementeigenschaften","panel.noSelection":"Wählen Sie eine Folie oder ein Element","panel.layout":"Layout","panel.background":"Hintergrund","panel.transition":"Übergang","panel.notes":"Sprechernotizen","player.play":"Abspielen","player.pause":"Pause","player.fullscreen":"Vollbild","player.exit":"Beenden","player.slideOf":"von","layout.blank":"Leer","layout.titleSlide":"Titelfolie","layout.titleContent":"Titel + Inhalt","layout.twoColumn":"Zwei Spalten","layout.titleOnly":"Nur Titel","layout.sectionHeader":"Abschnittskopf","layout.comparison":"Vergleich","layout.custom":"Benutzerdefiniert","export.html":"HTML-Präsentation","export.ndp":".ndp.json"},fr:{"toolbar.addSlide":"Ajouter une diapositive","toolbar.deleteSlide":"Supprimer la diapositive","toolbar.duplicateSlide":"Dupliquer","toolbar.undo":"Annuler","toolbar.redo":"Rétablir","toolbar.present":"Présenter","toolbar.export":"Exporter","toolbar.theme":"Thème","element.text":"Texte","element.image":"Image","element.shape":"Forme","element.chart":"Graphique","element.table":"Tableau","element.code":"Code","element.diagram":"Diagramme","element.video":"Vidéo","element.icon":"Icône","element.addElement":"Ajouter un élément","panel.slideProperties":"Propriétés de la diapositive","panel.elementProperties":"Propriétés de l'élément","panel.noSelection":"Sélectionnez une diapositive ou un élément","panel.layout":"Disposition","panel.background":"Arrière-plan","panel.transition":"Transition","panel.notes":"Notes du présentateur","player.play":"Lire","player.pause":"Pause","player.fullscreen":"Plein écran","player.exit":"Quitter","player.slideOf":"sur","layout.blank":"Vide","layout.titleSlide":"Diapositive de titre","layout.titleContent":"Titre + contenu","layout.twoColumn":"Deux colonnes","layout.titleOnly":"Titre seul","layout.sectionHeader":"En-tête de section","layout.comparison":"Comparaison","layout.custom":"Personnalisé","export.html":"Présentation HTML","export.ndp":".ndp.json"},es:{"toolbar.addSlide":"Añadir diapositiva","toolbar.deleteSlide":"Eliminar diapositiva","toolbar.duplicateSlide":"Duplicar","toolbar.undo":"Deshacer","toolbar.redo":"Rehacer","toolbar.present":"Presentar","toolbar.export":"Exportar","toolbar.theme":"Tema","element.text":"Texto","element.image":"Imagen","element.shape":"Forma","element.chart":"Gráfico","element.table":"Tabla","element.code":"Código","element.diagram":"Diagrama","element.video":"Vídeo","element.icon":"Icono","element.addElement":"Añadir elemento","panel.slideProperties":"Propiedades de la diapositiva","panel.elementProperties":"Propiedades del elemento","panel.noSelection":"Seleccione una diapositiva o un elemento","panel.layout":"Diseño","panel.background":"Fondo","panel.transition":"Transición","panel.notes":"Notas del presentador","player.play":"Reproducir","player.pause":"Pausa","player.fullscreen":"Pantalla completa","player.exit":"Salir","player.slideOf":"de","layout.blank":"En blanco","layout.titleSlide":"Diapositiva de título","layout.titleContent":"Título + contenido","layout.twoColumn":"Dos columnas","layout.titleOnly":"Solo título","layout.sectionHeader":"Encabezado de sección","layout.comparison":"Comparación","layout.custom":"Personalizado","export.html":"Presentación HTML","export.ndp":".ndp.json"}},Oe=l.createContext(e=>e),Fe=({lang:e="en",children:t})=>{const n=ze[e]??ze.en,i=o=>n[o]??o;return u.jsx(Oe.Provider,{value:i,children:t})};function xe(){return l.useContext(Oe)}function Dt(e){let t;try{t=JSON.parse(e)}catch{return{ok:!1,error:"Invalid JSON"}}if(typeof t!="object"||t===null)return{ok:!1,error:"Root must be an object"};const n=t;return n.version!=="1.0"?{ok:!1,error:`Unsupported version: ${String(n.version)}`}:!n.id||typeof n.id!="string"?{ok:!1,error:'Missing or invalid "id"'}:!n.title||typeof n.title!="string"?{ok:!1,error:'Missing or invalid "title"'}:Array.isArray(n.slides)?!n.theme||typeof n.theme!="object"?{ok:!1,error:'Missing "theme"'}:{ok:!0,document:t}:{ok:!1,error:'"slides" must be an array'}}function je(e,t=!1){return JSON.stringify(e,null,t?2:void 0)}class ve{constructor(t){this.undoStack=[],this.redoStack=[],this.listeners=new Set,this.maxHistory=100,this.doc=t??ve.createEmpty()}static createEmpty(t="Untitled Presentation"){const n=new Date().toISOString(),i={id:oe(),title:"Title Slide",layout:"titleSlide",background:{type:"solid",color:"var(--nice-bg, #fff)"},elements:[{id:oe(),type:"text",position:{x:10,y:30,width:80,height:20},content:{kind:"text",text:t,fontSize:48,fontWeight:"bold",textAlign:"center"}},{id:oe(),type:"text",position:{x:20,y:55,width:60,height:10},content:{kind:"text",text:"Subtitle",fontSize:24,textAlign:"center",fontColor:"var(--nice-text-secondary, #666666)"}}]};return{version:"1.0",id:oe(),title:t,slideSize:{width:1920,height:1080},slides:[i],theme:{name:"NiceToDev",backgroundColor:"var(--nice-bg-secondary, #f8f9fa)",primaryColor:"var(--nice-info, #6366f1)",secondaryColor:"var(--nice-accent, #8b5cf6)",accentColor:"var(--nice-info, #06b6d4)",textColor:"var(--nice-text, #334155)",headingColor:"var(--nice-text, #1e293b)",fontFamily:"Inter, sans-serif",headingFontFamily:'"Plus Jakarta Sans", Inter, sans-serif',codeFontFamily:'"Fira Code", monospace'},metadata:{createdAt:n,updatedAt:n}}}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){this.doc.metadata.updatedAt=new Date().toISOString(),this.listeners.forEach(t=>t())}pushUndo(t){this.undoStack.push({label:t,snapshot:JSON.stringify(this.doc)}),this.undoStack.length>this.maxHistory&&this.undoStack.shift(),this.redoStack.length=0}undo(){const t=this.undoStack.pop();t&&(this.redoStack.push({label:"redo",snapshot:JSON.stringify(this.doc)}),this.doc=JSON.parse(t.snapshot),this.notify())}redo(){const t=this.redoStack.pop();t&&(this.undoStack.push({label:"undo",snapshot:JSON.stringify(this.doc)}),this.doc=JSON.parse(t.snapshot),this.notify())}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}getDocument(){return this.doc}getSlides(){return this.doc.slides}getSlide(t){return this.doc.slides.find(n=>n.id===t)}getTheme(){return this.doc.theme}loadDocument(t){this.pushUndo("loadDocument"),this.doc=JSON.parse(JSON.stringify(t)),this.notify()}addSlide(t,n="titleContent"){this.pushUndo("addSlide");const i={id:oe(),title:`Slide ${this.doc.slides.length+1}`,layout:n,background:{type:"solid",color:this.doc.theme.backgroundColor},elements:[]},o=t!==void 0?t+1:this.doc.slides.length;return this.doc.slides.splice(o,0,i),this.notify(),i}removeSlide(t){this.pushUndo("removeSlide"),this.doc.slides=this.doc.slides.filter(n=>n.id!==t),this.notify()}moveSlide(t,n){const i=this.doc.slides.findIndex(r=>r.id===t);if(i===-1||i===n)return;this.pushUndo("moveSlide");const[o]=this.doc.slides.splice(i,1);this.doc.slides.splice(n,0,o),this.notify()}duplicateSlide(t){const n=this.getSlide(t);if(!n)return null;this.pushUndo("duplicateSlide");const i=JSON.parse(JSON.stringify(n));i.id=oe(),i.title=`${n.title} (copy)`,i.elements.forEach(r=>{r.id=oe()});const o=this.doc.slides.findIndex(r=>r.id===t);return this.doc.slides.splice(o+1,0,i),this.notify(),i}updateSlide(t,n){const i=this.doc.slides.find(o=>o.id===t);i&&(this.pushUndo("updateSlide"),Object.assign(i,n),this.notify())}addElement(t,n){const i=this.doc.slides.find(r=>r.id===t);if(!i)return null;this.pushUndo("addElement");const o={...n,id:oe()};return i.elements.push(o),this.notify(),o}updateElement(t,n,i){const o=this.doc.slides.find(a=>a.id===t);if(!o)return;const r=o.elements.find(a=>a.id===n);r&&(this.pushUndo("updateElement"),Object.assign(r,i),this.notify())}removeElement(t,n){const i=this.doc.slides.find(o=>o.id===t);i&&(this.pushUndo("removeElement"),i.elements=i.elements.filter(o=>o.id!==n),this.notify())}moveElement(t,n,i){this.updateElement(t,n,{position:i})}setTheme(t){this.pushUndo("setTheme"),this.doc.theme={...t},this.notify()}}function oe(){return`ndp_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function qe(e){const t=l.useRef(null);t.current||(t.current=new ve(e));const n=t.current,[,i]=l.useState(0),o=l.useCallback(()=>i(c=>c+1),[]),[r,a]=l.useState(0);l.useEffect(()=>n.subscribe(o),[n,o]);const s=n.getDocument();return l.useMemo(()=>({document:s,slides:s.slides,theme:s.theme,currentSlideIndex:r,currentSlide:s.slides[r],setCurrentSlideIndex:a,addSlide:(c,d)=>n.addSlide(c,d),removeSlide:c=>n.removeSlide(c),moveSlide:(c,d)=>n.moveSlide(c,d),duplicateSlide:c=>n.duplicateSlide(c),updateSlide:(c,d)=>n.updateSlide(c,d),addElement:(c,d)=>n.addElement(c,d),updateElement:(c,d,p)=>n.updateElement(c,d,p),removeElement:(c,d)=>n.removeElement(c,d),moveElement:(c,d,p)=>n.moveElement(c,d,p),setTheme:c=>n.setTheme(c),undo:()=>n.undo(),redo:()=>n.redo(),canUndo:n.canUndo(),canRedo:n.canRedo(),loadDocument:c=>n.loadDocument(c),model:n}),[s,n,r])}const Ot=["text","image","shape","chart","table","code","diagram","icon"],Ft=["blank","titleSlide","titleContent","twoColumn","titleOnly","sectionHeader","comparison"],be=({onAddElement:e,onAddSlide:t,onUndo:n,onRedo:i,canUndo:o=!1,canRedo:r=!1,onPresent:a,onExport:s,className:c})=>{const d=xe(),[p,m]=l.useState(!1),[y,f]=l.useState(!1),[x,g]=l.useState(!1),b=l.useCallback(h=>{e==null||e(h),m(!1)},[e]),S=l.useCallback(h=>{t==null||t(h),f(!1)},[t]);return u.jsxs("div",{className:`nice-pres-toolbar ${c??""}`,children:[u.jsxs("div",{className:"nice-pres-toolbar__group nice-pres-toolbar__group--relative",children:[u.jsxs(U.NiceButton,{className:"nice-pres-toolbar__btn",variant:"ghost",size:"sm",onClick:()=>f(h=>!h),children:["+ ",d("toolbar.addSlide")]}),y&&u.jsx("div",{className:"nice-pres-toolbar__dropdown",children:Ft.map(h=>u.jsx(U.NiceButton,{className:"nice-pres-toolbar__dropdown-item",variant:"ghost",size:"sm",onClick:()=>S(h),children:d(`layout.${h}`)},h))})]}),u.jsxs("div",{className:"nice-pres-toolbar__group nice-pres-toolbar__group--relative",children:[u.jsxs(U.NiceButton,{className:"nice-pres-toolbar__btn",variant:"ghost",size:"sm",onClick:()=>m(h=>!h),children:["+ ",d("element.addElement")]}),p&&u.jsx("div",{className:"nice-pres-toolbar__dropdown",children:Ot.map(h=>u.jsx(U.NiceButton,{className:"nice-pres-toolbar__dropdown-item",variant:"ghost",size:"sm",onClick:()=>b(h),children:d(`element.${h}`)},h))})]}),u.jsxs("div",{className:"nice-pres-toolbar__group",children:[u.jsx(U.NiceButton,{className:"nice-pres-toolbar__btn",variant:"ghost",size:"sm",onClick:n,disabled:!o,title:d("toolbar.undo"),children:"↩"}),u.jsx(U.NiceButton,{className:"nice-pres-toolbar__btn",variant:"ghost",size:"sm",onClick:i,disabled:!r,title:d("toolbar.redo"),children:"↪"})]}),u.jsx("div",{className:"nice-pres-toolbar__group",children:u.jsxs(U.NiceButton,{className:"nice-pres-toolbar__btn nice-pres-toolbar__btn--primary",variant:"primary",size:"sm",onClick:a,children:["▶ ",d("toolbar.present")]})}),u.jsxs("div",{className:"nice-pres-toolbar__group nice-pres-toolbar__group--relative",children:[u.jsxs(U.NiceButton,{className:"nice-pres-toolbar__btn",variant:"ghost",size:"sm",onClick:()=>g(h=>!h),children:["⤓ ",d("toolbar.export")]}),x&&u.jsxs("div",{className:"nice-pres-toolbar__dropdown",children:[u.jsx(U.NiceButton,{className:"nice-pres-toolbar__dropdown-item",variant:"ghost",size:"sm",onClick:()=>{s==null||s("ndp"),g(!1)},children:d("export.ndp")}),u.jsx(U.NiceButton,{className:"nice-pres-toolbar__dropdown-item",variant:"ghost",size:"sm",onClick:()=>{s==null||s("html"),g(!1)},children:d("export.html")})]})]})]})};be.displayName="PresentationToolbar";function Me(e){return e.series&&e.series.length>0?e.series:e.datasets&&e.datasets.length>0?e.datasets.map(t=>({name:t.label??"",values:t.data,color:t.color??t.backgroundColor})):[]}function Le(e,t,n){const i=e.data,o=e.options??{},r=o.colors??["var(--nice-info, #6366f1)","var(--nice-info, #06b6d4)","var(--nice-success, #10b981)","var(--nice-warning, #f59e0b)","var(--nice-danger, #ef4444)","var(--nice-accent, #8b5cf6)"];switch(e.chartType){case"bar":return Te(i,t,n,r,o);case"line":return jt(i,t,n,r);case"pie":case"doughnut":return qt(i,t,n,r,e.chartType==="doughnut");default:return Te(i,t,n,r,o)}}function Te(e,t,n,i,o){const r={top:20,right:20,bottom:40,left:50},a=t-r.left-r.right,s=n-r.top-r.bottom,c=Me(e),d=c.flatMap(I=>I.values),p=Math.max(...d,1),m=e.labels.length,y=c.length,f=a/m,x=f*.7/y,g=f*.15,b=[],S=[];for(let I=0;I<m;I++){const R=r.left+I*f;S.push(`<text x="${R+f/2}" y="${n-10}" text-anchor="middle" font-size="11" fill="var(--nice-text-secondary, #666)">${Ae(e.labels[I])}</text>`);for(let z=0;z<y;z++){const Q=(c[z].values[I]??0)/p*s,T=R+g+z*x,P=r.top+s-Q,q=c[z].color??i[z%i.length];b.push(`<rect x="${T}" y="${P}" width="${x}" height="${Q}" fill="${q}" rx="2" />`)}}const h=[];for(let I=0;I<=4;I++){const R=Math.round(p/4*I),z=r.top+s-I/4*s;h.push(`<text x="${r.left-8}" y="${z+4}" text-anchor="end" font-size="10" fill="var(--nice-text-muted, #999)">${R}</text>`),o.showGrid!==!1&&h.push(`<line x1="${r.left}" y1="${z}" x2="${r.left+a}" y2="${z}" stroke="var(--nice-border, #eee)" />`)}return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}">
84
+ ${h.join(`
85
+ `)}
86
+ ${b.join(`
87
+ `)}
88
+ ${S.join(`
89
+ `)}
90
+ </svg>`}function jt(e,t,n,i,o){const r={top:20,right:20,bottom:40,left:50},a=t-r.left-r.right,s=n-r.top-r.bottom,c=Me(e),d=c.flatMap(g=>g.values),p=Math.max(...d,1),m=e.labels.length,y=a/Math.max(m-1,1),f=[];for(let g=0;g<c.length;g++){const b=c[g].color??i[g%i.length],S=c[g].values.map((h,I)=>{const R=r.left+I*y,z=r.top+s-h/p*s;return`${R},${z}`});f.push(`<polyline points="${S.join(" ")}" fill="none" stroke="${b}" stroke-width="2" />`),c[g].values.forEach((h,I)=>{const R=r.left+I*y,z=r.top+s-h/p*s;f.push(`<circle cx="${R}" cy="${z}" r="3" fill="${b}" />`)})}const x=e.labels.map((g,b)=>`<text x="${r.left+b*y}" y="${n-10}" text-anchor="middle" font-size="11" fill="var(--nice-text-secondary, #666)">${Ae(g)}</text>`);return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}">
91
+ ${f.join(`
92
+ `)}
93
+ ${x.join(`
94
+ `)}
95
+ </svg>`}function qt(e,t,n,i,o){const r=Me(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((x,g)=>x+g,0)||1,c=t/2,d=n/2,p=Math.min(t,n)*.38,m=o?p*.55:0,y=[];let f=-Math.PI/2;return a.forEach((x,g)=>{const b=x/s*Math.PI*2,S=f+b,h=b>Math.PI?1:0,I=i[g%i.length],R=c+p*Math.cos(f),z=d+p*Math.sin(f),F=c+p*Math.cos(S),Q=d+p*Math.sin(S);if(o){const C=c+m*Math.cos(f),w=d+m*Math.sin(f),v=c+m*Math.cos(S),A=d+m*Math.sin(S);y.push(`<path d="M ${R} ${z} A ${p} ${p} 0 ${h} 1 ${F} ${Q} L ${v} ${A} A ${m} ${m} 0 ${h} 0 ${C} ${w} Z" fill="${I}" />`)}else y.push(`<path d="M ${c} ${d} L ${R} ${z} A ${p} ${p} 0 ${h} 1 ${F} ${Q} Z" fill="${I}" />`);const T=f+b/2,P=p*1.15,q=c+P*Math.cos(T),N=d+P*Math.sin(T);e.labels[g]&&y.push(`<text x="${q}" y="${N}" text-anchor="middle" font-size="11" fill="var(--nice-text, #444)">${Ae(e.labels[g])}</text>`),f=S}),`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}">
96
+ ${y.join(`
97
+ `)}
98
+ </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:d=!1,showGrid:p=!1,gridSnap:m=0,className:y})=>{const[f,x]=l.useState(null),[g,b]=l.useState(null),S=T=>m>0?Math.round(T/m)*m:T,h=l.useMemo(()=>{const T=e.background;if(T.type==="gradient"&&T.gradientStops){const P=T.gradientStops.map(q=>`${q.color} ${q.position*100}%`).join(", ");return{background:`linear-gradient(${T.gradientDirection??180}deg, ${P})`}}return T.type==="image"&&T.imageUrl?{backgroundImage:`url(${T.imageUrl})`,backgroundSize:T.imageFit??"cover",backgroundPosition:"center",backgroundColor:T.color??n.backgroundColor}:{backgroundColor:T.color??n.backgroundColor}},[e.background,n.backgroundColor]),I=l.useCallback((T,P)=>{!d||P.locked||(T.stopPropagation(),r==null||r(P.id),x({id:P.id,startX:T.clientX,startY:T.clientY,elStartX:P.position.x,elStartY:P.position.y}))},[d,r]),R=l.useCallback(T=>{if(f&&a){const P=(T.clientX-f.startX)/i,q=(T.clientY-f.startY)/i,N=S(f.elStartX+P/t.width*100),C=S(f.elStartY+q/t.height*100);a(f.id,N,C)}if(g&&s){const P=(T.clientX-g.startX)/i/t.width*100,q=(T.clientY-g.startY)/i/t.height*100,N=g.elPos;let{x:C,y:w,width:v,height:A}=N;const O=g.handle;O.includes("e")&&(v=S(Math.max(2,N.width+P))),O.includes("w")&&(v=S(Math.max(2,N.width-P)),C=S(N.x+(N.width-v))),O.includes("s")&&(A=S(Math.max(2,N.height+q))),O.includes("n")&&(A=S(Math.max(2,N.height-q)),w=S(N.y+(N.height-A))),s(g.id,v,A,C,w)}},[f,g,a,s,i,t,S]),z=l.useCallback(()=>{x(null),b(null)},[]),F=l.useCallback((T,P,q)=>{d&&(T.stopPropagation(),T.preventDefault(),b({id:P.id,handle:q,startX:T.clientX,startY:T.clientY,elPos:{...P.position}}))},[d]),Q=l.useCallback(T=>{T.target.classList.contains("nice-slide-canvas__surface")&&(r==null||r(null))},[r]);return u.jsxs("div",{className:`nice-slide-canvas ${y??""}`,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,...h,color:n.textColor,fontFamily:n.fontFamily},onMouseMove:R,onMouseUp:z,onMouseLeave:z,onClick:Q,children:[u.jsx("div",{className:"nice-slide-canvas__surface",style:{width:"100%",height:"100%",position:"absolute"}}),p&&u.jsx("svg",{style:{position:"absolute",inset:0,width:"100%",height:"100%",pointerEvents:"none",opacity:.15},children:Array.from({length:9},(T,P)=>{const q=(P+1)*10;return u.jsxs(l.Fragment,{children:[u.jsx("line",{x1:`${q}%`,y1:"0",x2:`${q}%`,y2:"100%",stroke:"var(--nice-text-secondary, #666)",strokeWidth:"0.5"}),u.jsx("line",{x1:"0",y1:`${q}%`,x2:"100%",y2:`${q}%`,stroke:"var(--nice-text-secondary, #666)",strokeWidth:"0.5"})]},P)})}),[...e.elements].sort((T,P)=>(T.zIndex??0)-(P.zIndex??0)).map(T=>u.jsx(Ht,{element:T,slideSize:t,scale:i,theme:n,isSelected:o===T.id,onMouseDown:P=>I(P,T),onResizeStart:(P,q)=>F(P,T,q),interactive:d},T.id))]})},Lt=["nw","n","ne","e","se","s","sw","w"],Wt={nw:"nwse-resize",n:"ns-resize",ne:"nesw-resize",e:"ew-resize",se:"nwse-resize",s:"ns-resize",sw:"nesw-resize",w:"ew-resize"},Bt={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}},Ht=({element:e,slideSize:t,scale:n,theme:i,isSelected:o,onMouseDown:r,onResizeStart:a,interactive:s})=>{const{position:c,content:d,rotation:p,opacity:m}=e,y=c.x/100*t.width*n,f=c.y/100*t.height*n,x=c.width/100*t.width*n,g=c.height/100*t.height*n,b={position:"absolute",left:y,top:f,width:x,height:g,opacity:m??1,transform:p?`rotate(${p}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 u.jsxs("div",{style:b,onMouseDown:r,children:[Vt(d,x,g,n,i),o&&s&&!e.locked&&Lt.map(S=>u.jsx("div",{style:{position:"absolute",width:8,height:8,background:"var(--nice-primary, #2196f3)",border:"1px solid var(--nice-bg, #FFF)",borderRadius:2,cursor:Wt[S],zIndex:10,...Bt[S]},onMouseDown:h=>a(h,S)},S))]})};function Vt(e,t,n,i,o){switch(e.kind){case"text":{const r=e;return u.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 u.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 u.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 u.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:u.jsx("code",{children:r.code})})}case"chart":{const a=Le(e,t,n);return u.jsx("div",{style:{width:"100%",height:"100%"},dangerouslySetInnerHTML:{__html:a}})}case"table":{const r=e;return u.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14*i},children:[u.jsx("thead",{children:u.jsx("tr",{children:r.headers.map((a,s)=>u.jsx("th",{style:{padding:`${6*i}px ${8*i}px`,backgroundColor:r.headerBg??o.primaryColor,color:r.headerColor??"var(--nice-bg, #fff)",textAlign:"left",borderBottom:`2px solid ${r.borderColor??"var(--nice-border, #ddd)"}`},children:a},s))})}),u.jsx("tbody",{children:r.rows.map((a,s)=>u.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,d)=>u.jsx("td",{style:{padding:`${4*i}px ${8*i}px`,borderBottom:`1px solid ${r.borderColor??"var(--nice-border, #eee)"}`},children:c},d))},s))})]})}default:return u.jsx("div",{style:{width:"100%",height:"100%",background:"var(--nice-bg-secondary, #f0f0f0)",borderRadius:4}})}}ae.displayName="SlideCanvas";const Ut=["blank","titleSlide","titleContent","twoColumn","titleOnly","sectionHeader","comparison","custom"],Se=({slide:e,selectedElement:t,onSlideChange:n,onElementChange:i,onRemoveElement:o,className:r})=>{const a=xe();return e?t&&e?u.jsxs("div",{className:`nice-pres-panel ${r??""}`,children:[u.jsx("h3",{className:"nice-pres-panel__title",children:a("panel.elementProperties")}),u.jsxs("div",{className:"nice-pres-panel__row",children:[u.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["X (%)",u.jsx(U.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"})]}),u.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["Y (%)",u.jsx(U.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"})]})]}),u.jsxs("div",{className:"nice-pres-panel__row",children:[u.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["W (%)",u.jsx(U.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"})]}),u.jsxs("label",{className:"nice-pres-panel__label nice-pres-panel__label--half",children:["H (%)",u.jsx(U.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"})]})]}),u.jsxs("label",{className:"nice-pres-panel__label",children:["Opacity",u.jsx(U.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"&&u.jsxs(u.Fragment,{children:[u.jsxs("label",{className:"nice-pres-panel__label",children:[a("element.text"),u.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})]}),u.jsxs("label",{className:"nice-pres-panel__label",children:["Font Size",u.jsx(U.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"})]})]}),u.jsx(U.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"})]}):u.jsxs("div",{className:`nice-pres-panel ${r??""}`,children:[u.jsx("h3",{className:"nice-pres-panel__title",children:a("panel.slideProperties")}),u.jsxs("label",{className:"nice-pres-panel__label",children:["Title",u.jsx(U.NiceTextInput,{value:e.title,onChange:s=>n==null?void 0:n(e.id,{title:s}),className:"nice-pres-panel__input"})]}),u.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.layout"),u.jsx(U.NiceSelect,{value:e.layout,onChange:s=>n==null?void 0:n(e.id,{layout:s}),options:Ut.map(s=>({value:s,label:a(`layout.${s}`)})),className:"nice-pres-panel__select"})]}),u.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.background"),u.jsx(U.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"})]}),u.jsxs("label",{className:"nice-pres-panel__label",children:[a("panel.notes"),u.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")})]})]}):u.jsx("div",{className:`nice-pres-panel nice-pres-panel--empty ${r??""}`,children:u.jsx("p",{style:{color:"var(--nice-text-muted, #999)",fontStyle:"italic",textAlign:"center",padding:16},children:a("panel.noSelection")})})};Se.displayName="SlidePropertyPanel";const Qt=180,we=({slides:e,slideSize:t,theme:n,currentIndex:i,onSelectSlide:o,onAddSlide:r,onDuplicateSlide:a,onRemoveSlide:s,className:c})=>{const d=xe(),p=Qt/t.width;return u.jsxs("div",{className:`nice-slide-thumbs ${c??""}`,style:{overflowY:"auto",padding:8},children:[e.map((m,y)=>u.jsxs("div",{className:`nice-slide-thumbs__item ${y===i?"nice-slide-thumbs__item--active":""}`,onClick:()=>o(y),style:{marginBottom:8,border:y===i?"2px solid var(--nice-primary, #2196f3)":"2px solid transparent",borderRadius:4,cursor:"pointer",position:"relative"},children:[u.jsx("div",{style:{pointerEvents:"none"},children:u.jsx(ae,{slide:m,slideSize:t,theme:n,scale:p})}),u.jsxs("div",{style:{fontSize:10,textAlign:"center",padding:"2px 0",color:"var(--nice-text-secondary, #666)"},children:[y+1,". ",m.title]}),(a||s)&&u.jsxs("div",{className:"nice-slide-thumbs__actions",style:{position:"absolute",top:2,right:2,display:"flex",gap:2},children:[a&&u.jsx(U.NiceButton,{className:"nice-slide-thumbs__action-btn",variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),a(m.id)},title:d("toolbar.duplicateSlide"),style:{fontSize:10,padding:"1px 4px"},children:"⧉"}),s&&e.length>1&&u.jsx(U.NiceButton,{className:"nice-slide-thumbs__action-btn",variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),s(m.id)},title:d("toolbar.deleteSlide"),style:{fontSize:10,padding:"1px 4px",color:"var(--nice-danger-dark, #d32f2f)"},children:"×"})]})]},m.id)),r&&u.jsxs(U.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:["+ ",d("toolbar.addSlide")]})]})};we.displayName="SlideThumbnailList";function Kt(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
99
+ 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 We=({initialDocument:e,onChange:t,onExport:n,onPresent:i,lang:o="en",showToolbar:r=!0,showThumbnails:a=!0,showPropertyPanel:s=!0,className:c,style:d})=>{const p=qe(e),[m,y]=l.useState(null),[f,x]=l.useState(!1),[g,b]=l.useState(5),S=l.useRef(p.document);p.document!==S.current&&(S.current=p.document,t==null||t(p.document));const h=p.currentSlide,I=l.useMemo(()=>m&&h?h.elements.find(v=>v.id===m)??null:null,[m,h]),R=l.useMemo(()=>Math.min(1,800/p.document.slideSize.width),[p.document.slideSize]),z=l.useCallback(v=>{if(!h)return;const{content:A,position:O}=Kt(v),$=p.addElement(h.id,{type:v,position:O,content:A});$&&y($.id)},[h,p]),F=l.useCallback(v=>{p.addSlide(p.currentSlideIndex,v),p.setCurrentSlideIndex(p.currentSlideIndex+1)},[p]),Q=l.useCallback(v=>{p.removeSlide(v),p.currentSlideIndex>=p.slides.length-1&&p.setCurrentSlideIndex(Math.max(0,p.slides.length-2))},[p]),T=l.useCallback((v,A,O)=>{if(!h)return;const $=h.elements.find(L=>L.id===v);$&&p.moveElement(h.id,v,{...$.position,x:A,y:O})},[h,p]),P=l.useCallback((v,A,O,$,L)=>{if(!h)return;const X=h.elements.find(Z=>Z.id===v);X&&p.moveElement(h.id,v,{...X.position,width:A,height:O,...$!=null?{x:$}:{},...L!=null?{y:L}:{}})},[h,p]),q=l.useCallback(()=>{if(!h||!m)return;const v=Math.max(0,...h.elements.map(A=>A.zIndex??0));p.updateElement(h.id,m,{zIndex:v+1})},[h,m,p]),N=l.useCallback(()=>{if(!h||!m)return;const v=Math.min(0,...h.elements.map(A=>A.zIndex??0));p.updateElement(h.id,m,{zIndex:v-1})},[h,m,p]),C=l.useCallback(v=>{const A=p.document;let O;switch(v){case"ndp":O=je(A,!0);break;case"html":O=De(A);break}n==null||n(v,O)},[p,n]),w=l.useCallback(()=>{i==null||i(p.document,p.currentSlideIndex)},[p,i]);return u.jsx(Fe,{lang:o,children:u.jsxs("div",{className:`nice-pres-editor ${c??""}`,style:{display:"flex",flexDirection:"column",height:"100%",maxWidth:"100%",overflow:"hidden",background:"var(--bg-primary, #fff)",color:"var(--text-primary, #111)",...d},children:[r&&u.jsx(be,{onAddElement:z,onAddSlide:F,onUndo:p.undo,onRedo:p.redo,canUndo:p.canUndo,canRedo:p.canRedo,onPresent:w,onExport:C}),r&&u.jsxs("div",{style:{display:"flex",gap:4,padding:"2px 8px",borderBottom:"1px solid var(--border-color, #eee)",alignItems:"center",fontSize:"0.85em",flexWrap:"wrap"},children:[u.jsx(U.NiceButton,{size:"sm",variant:f?"primary":"ghost",onClick:()=>x(v=>!v),children:"⊞ Grid"}),I&&u.jsxs(u.Fragment,{children:[u.jsx(U.NiceButton,{size:"sm",variant:"ghost",onClick:q,title:"Bring to front",children:"↑ Front"}),u.jsx(U.NiceButton,{size:"sm",variant:"ghost",onClick:N,title:"Send to back",children:"↓ Back"}),u.jsx(U.NiceButton,{size:"sm",variant:"ghost",onClick:()=>{if(h&&m){const v={...I,id:`el-${Date.now().toString(36)}`,position:{...I.position,x:I.position.x+3,y:I.position.y+3}};p.addElement(h.id,v)}},title:"Duplicate",children:"⧉ Duplicate"})]})]}),u.jsxs("div",{style:{display:"flex",flex:1,overflow:"hidden",minHeight:0,minWidth:0},children:[a&&u.jsx("div",{style:{width:200,flexShrink:0,borderRight:"1px solid var(--border-color, #ddd)",background:"var(--bg-secondary, #fafafa)",overflowY:"auto"},children:u.jsx(we,{slides:p.slides,slideSize:p.document.slideSize,theme:p.theme,currentIndex:p.currentSlideIndex,onSelectSlide:p.setCurrentSlideIndex,onAddSlide:()=>F(),onDuplicateSlide:v=>p.duplicateSlide(v),onRemoveSlide:Q})}),h&&u.jsxs("div",{style:{width:180,flexShrink:0,borderRight:"1px solid var(--border-color, #ddd)",background:"var(--bg-secondary, #fafafa)",overflowY:"auto",fontSize:"0.85em"},"aria-label":"Slide elements",children:[u.jsxs("div",{style:{padding:"8px 10px",fontWeight:600,borderBottom:"1px solid var(--border-color, #ddd)",position:"sticky",top:0,background:"var(--bg-secondary, #fafafa)"},children:["Elements (",h.elements.length,")"]}),h.elements.length===0?u.jsx("div",{style:{padding:10,color:"var(--text-secondary, #888)",fontStyle:"italic"},children:"No elements yet."}):u.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:h.elements.map((v,A)=>{var L;const O=v.id===m,$=v.content&&v.content.text?`“${v.content.text.slice(0,20)}”`:((L=v.content)==null?void 0:L.kind)||v.type;return u.jsx("li",{children:u.jsxs("button",{type:"button",onClick:()=>y(v.id),style:{width:"100%",textAlign:"left",padding:"6px 10px",background:O?"var(--color-primary, #6366f1)":"transparent",color:O?"var(--nice-bg, #fff)":"inherit",border:"none",borderBottom:"1px solid var(--border-color, #eee)",cursor:"pointer",display:"flex",justifyContent:"space-between",gap:6,font:"inherit"},children:[u.jsxs("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[A+1,". ",$]}),u.jsx("span",{style:{opacity:.7,fontSize:"0.75em"},children:v.type})]})},v.id)})})]}),u.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-tertiary, #e8e8e8)",overflow:"auto",padding:24,minWidth:0},children:h&&u.jsx(ae,{slide:h,slideSize:p.document.slideSize,theme:p.theme,scale:R,selectedElementId:m,onSelectElement:y,onElementDrag:T,onElementResize:P,showGrid:f,gridSnap:g,interactive:!0})}),s&&u.jsx("div",{style:{width:260,flexShrink:0,borderLeft:"1px solid var(--border-color, #ddd)",overflowY:"auto",background:"var(--bg-secondary, #fafafa)"},children:u.jsx(Se,{slide:h,selectedElement:I,onSlideChange:p.updateSlide,onElementChange:p.updateElement,onRemoveElement:p.removeElement})})]})]})})};We.displayName="NicePresentationEditor";const Re={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}},he={opacity:1,transform:"",filter:"",visible:!0};function Yt(e,t,n){if(!e)return{...he};const i=e.entrance;if(!i)return{...he};if((e.trigger==="onClick"||e.trigger==="afterPrevious")&&!n)return{...he,opacity:0,visible:!1};const o=i.delayMs??0,r=t-o;if(r<0)return{...he,opacity:0,visible:!1};const a=Math.min(r/i.durationMs,1),s=(Re[i.easing??"linear"]??Re.linear)(a);return Xt(i.effect,s)}function Xt(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 Be(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 Gt={width:1920,height:1080},Jt={width:1024,height:768},Zt={width:2560,height:1440},He={name:"Corporate",backgroundColor:"var(--nice-bg, #fff)",primaryColor:"var(--nice-primary-dark, #1a365d)",secondaryColor:"var(--nice-primary, #2b6cb0)",accentColor:"var(--nice-warning, #ed8936)",textColor:"var(--nice-bg-secondary, #2d3748)",headingColor:"var(--nice-primary-dark, #1a365d)",fontFamily:'"Segoe UI", Roboto, sans-serif',headingFontFamily:'"Segoe UI", Roboto, sans-serif',codeFontFamily:'"Cascadia Code", "Fira Code", monospace'},en={name:"Modern Dark",backgroundColor:"var(--nice-bg, #1a1a2e)",primaryColor:"var(--nice-danger, #e94560)",secondaryColor:"var(--nice-primary-dark, #0f3460)",accentColor:"var(--nice-bg, #16213e)",textColor:"var(--nice-border, #e0e0e0)",headingColor:"var(--nice-bg, #fff)",fontFamily:"Inter, sans-serif",headingFontFamily:"Inter, sans-serif",codeFontFamily:'"JetBrains Mono", monospace'},tn={name:"Minimal",backgroundColor:"var(--nice-bg-secondary, #fafafa)",primaryColor:"var(--nice-text, #333333)",secondaryColor:"var(--nice-text-secondary, #666666)",accentColor:"var(--nice-primary, #2196f3)",textColor:"var(--nice-text, #333333)",headingColor:"var(--nice-text, #111111)",fontFamily:'"Helvetica Neue", Arial, sans-serif',codeFontFamily:'"SF Mono", monospace'},nn={name:"NiceToDev",backgroundColor:"var(--nice-bg-secondary, #f8f9fa)",primaryColor:"var(--nice-info, #6366f1)",secondaryColor:"var(--nice-accent, #8b5cf6)",accentColor:"var(--nice-info, #06b6d4)",textColor:"var(--nice-text, #334155)",headingColor:"var(--nice-text, #1e293b)",fontFamily:"Inter, sans-serif",headingFontFamily:'"Plus Jakarta Sans", Inter, sans-serif',codeFontFamily:'"Fira Code", monospace'},on=500,Ve=({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:d=!1,className:p})=>{const[m,y]=l.useState(t),[f,x]=l.useState(0),[g,b]=l.useState(!1),[S,h]=l.useState(0),[I,R]=l.useState(null),[z,F]=l.useState(!1),[Q,T]=l.useState(0),P=l.useRef(null),q=l.useRef(0),N=l.useRef(null),C=l.useRef(null),w=e.slides,v=w[m]??null,A=I!==null?w[I]??null:null,O=e.theme??He,$=e.slideSize,L=w.length,X=l.useMemo(()=>{if(!v)return 0;const M=v.elements.filter(D=>{var V;return(V=D.animation)==null?void 0:V.entrance}).map(D=>{var V;return((V=D.animation)==null?void 0:V.buildOrder)??0});return M.length>0?Math.max(...M)+1:0},[v]),Z=l.useCallback(M=>{var se,ce;if(M<0||M>=L||M===m||g)return;const D=w[M];if((((se=D==null?void 0:D.transition)==null?void 0:se.effect)??"none")==="none"){R(null),y(M),x(0);return}R(m),y(M),x(0),b(!0);const W=((ce=D==null?void 0:D.transition)==null?void 0:ce.durationMs)??on,ee=performance.now(),ie=me=>{const _e=Math.min(1,(me-ee)/W);h(_e),_e<1?q.current=requestAnimationFrame(ie):(b(!1),R(null))};q.current=requestAnimationFrame(ie)},[m,L,g,w]),_=l.useCallback(()=>{if(f<X){x(M=>M+1);return}m<L-1&&Z(m+1)},[f,X,m,L,Z]),E=l.useCallback(()=>{if(f>0){x(M=>M-1);return}m>0&&Z(m-1)},[f,m,Z]);l.useEffect(()=>{const M=D=>{switch(D.key){case"ArrowRight":case"ArrowDown":case" ":case"Enter":D.preventDefault(),_();break;case"ArrowLeft":case"ArrowUp":case"Backspace":D.preventDefault(),E();break;case"Escape":D.preventDefault(),n==null||n();break;case"Home":D.preventDefault(),Z(0);break;case"End":D.preventDefault(),Z(L-1);break}};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[_,E,n,Z,L]);const j=l.useCallback(M=>{if(!c)return;const D=M.touches[0];N.current={x:D.clientX,y:D.clientY,time:Date.now()}},[c]),H=l.useCallback(M=>{if(!c||!N.current)return;const D=M.changedTouches[0],V=D.clientX-N.current.x,W=D.clientY-N.current.y,ee=Date.now()-N.current.time;if(N.current=null,ee>500||Math.abs(V)<30&&Math.abs(W)<30){_();return}Math.abs(V)>Math.abs(W)&&(V<-30?_():V>30&&E())},[c,_,E]);l.useEffect(()=>{if(s)return C.current=setInterval(()=>T(M=>M+1e3),1e3),()=>{C.current&&clearInterval(C.current)}},[s]);const Y=M=>{const D=Math.floor(M/1e3),V=Math.floor(D/60),W=Math.floor(V/60);return W>0?`${W}:${String(V%60).padStart(2,"0")}:${String(D%60).padStart(2,"0")}`:`${V}:${String(D%60).padStart(2,"0")}`};l.useEffect(()=>{const M=D=>{(D.key==="g"||D.key==="G")&&F(V=>!V)};return window.addEventListener("keydown",M),()=>window.removeEventListener("keydown",M)},[]),l.useEffect(()=>{if(i<=0||g)return;const M=setTimeout(_,i);return()=>clearTimeout(M)},[i,_,g,m,f]),l.useEffect(()=>{var D;const M=P.current;return d&&M&&!window.document.fullscreenElement&&((D=M.requestFullscreen)==null||D.call(M).catch(()=>{})),()=>{var V,W;d&&window.document.fullscreenElement&&((W=(V=window.document).exitFullscreen)==null||W.call(V).catch(()=>{})),q.current&&cancelAnimationFrame(q.current)}},[]);const K=l.useMemo(()=>v?v.elements.filter(M=>{var V;return(V=M.animation)!=null&&V.entrance?(M.animation.buildOrder??0)<=f:!0}):[],[v,f]),B=l.useMemo(()=>{if(!g||!v)return{outgoing:{},incoming:{}};const M=v.transition??{effect:"fade"};return Be(M.effect,S,M.direction)},[g,v,S]),[G,ne]=l.useState(1),[J,te]=l.useState(!1);l.useEffect(()=>{const M=()=>{const V=$.width,W=$.height,ee=!!window.document.fullscreenElement;te(ee);const ie=P.current;let se,ce;if(ee||d)se=window.innerWidth,ce=window.innerHeight;else if(ie){const me=ie.getBoundingClientRect();se=me.width||V,ce=me.height||W}else se=V,ce=W;ne(Math.min(se/V,ce/W))};M();const D=typeof ResizeObserver<"u"&&P.current?new ResizeObserver(M):null;return D&&P.current&&D.observe(P.current),window.addEventListener("resize",M),window.document.addEventListener("fullscreenchange",M),()=>{window.removeEventListener("resize",M),window.document.removeEventListener("fullscreenchange",M),D==null||D.disconnect()}},[$,d]);const de=l.useCallback(()=>{var D,V,W;const M=P.current;M&&(window.document.fullscreenElement?(V=(D=window.document).exitFullscreen)==null||V.call(D).catch(()=>{}):(W=M.requestFullscreen)==null||W.call(M).catch(()=>{}))},[]),fe=d||J;return u.jsxs("div",{ref:P,className:`nice-pres-player ${p??""}`,style:fe?{position:"fixed",inset:0,background:"var(--nice-text, #000)",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",cursor:"none",zIndex:9999}:{position:"relative",width:"100%",height:"100%",minHeight:240,background:"var(--nice-text, #000)",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},onClick:_,onContextMenu:M=>{M.preventDefault(),E()},onTouchStart:j,onTouchEnd:H,children:[z&&u.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:M=>M.stopPropagation(),children:w.map((M,D)=>u.jsxs("div",{style:{cursor:"pointer",border:D===m?"3px solid var(--nice-primary, #2196f3)":"2px solid transparent",borderRadius:4,overflow:"hidden"},onClick:()=>{Z(D),F(!1)},children:[u.jsx(ae,{slide:M,slideSize:$,theme:O,scale:240/$.width,interactive:!1}),u.jsxs("div",{style:{color:"var(--nice-bg, #fff)",fontSize:12,textAlign:"center",padding:4},children:[D+1,". ",M.title]})]},M.id))}),g&&A&&u.jsx("div",{style:{position:"absolute",...B.outgoing},children:u.jsx(ae,{slide:A,slideSize:$,theme:O,scale:G,interactive:!1})}),v&&u.jsx("div",{style:{position:"absolute",...g?B.incoming:{}},children:u.jsx(ae,{slide:{...v,elements:K},slideSize:$,theme:O,scale:G,interactive:!1})}),r&&u.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:[m+1," / ",L]}),o&&(v==null?void 0:v.notes)&&u.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-bg, #fff)",padding:"12px 24px",fontSize:14,fontFamily:"sans-serif",maxHeight:"20vh",overflowY:"auto",pointerEvents:"none"},children:v.notes}),a&&u.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:u.jsx("div",{style:{height:"100%",width:`${(m+1)/L*100}%`,background:"var(--nice-primary, #2196f3)",transition:"width 0.3s ease"}})}),s&&u.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:Y(Q)}),u.jsxs("div",{className:"nice-pres-player-controls",style:{position:"absolute",bottom:12,left:"50%",transform:"translateX(-50%)",display:"flex",gap:8,opacity:.3},onMouseEnter:M=>{M.currentTarget.style.opacity="0.9",M.currentTarget.style.cursor="pointer"},onMouseLeave:M=>{M.currentTarget.style.opacity="0.3"},children:[u.jsx(U.NiceButton,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),E()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-bg, #fff)",padding:"6px 14px",borderRadius:4,fontSize:16},title:"Previous",children:"◀"}),u.jsx(U.NiceButton,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),_()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-bg, #fff)",padding:"6px 14px",borderRadius:4,fontSize:16},title:"Next",children:"▶"}),u.jsx(U.NiceButton,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),n==null||n()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-bg, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:"Exit (Esc)",children:"✕"}),u.jsx(U.NiceButton,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),F(D=>!D)},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-bg, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:"Overview (G)",children:"⊞"}),u.jsx(U.NiceButton,{variant:"ghost",size:"sm",onClick:M=>{M.stopPropagation(),de()},style:{background:"var(--nice-overlay-light-15, rgba(255, 255, 255, 0.15))",color:"var(--nice-bg, #fff)",padding:"6px 14px",borderRadius:4,fontSize:14},title:J?"Exit fullscreen":"Fullscreen",children:J?"⤢":"⛶"})]})]})};Ve.displayName="NicePresentationPlayer";const rn="_interactiveElement_1hnm5_13",an="_interactiveButton_1hnm5_27",sn="_disabled_1hnm5_57",cn="_variant_primary_1hnm5_87",ln="_variant_secondary_1hnm5_97",dn="_variant_outline_1hnm5_107",un="_variant_ghost_1hnm5_119",pn="_size_small_1hnm5_139",fn="_size_medium_1hnm5_149",mn="_size_large_1hnm5_159",hn="_buttonIcon_1hnm5_169",yn="_buttonLabel_1hnm5_177",gn="_interactivePoll_1hnm5_189",xn="_pollQuestion_1hnm5_209",vn="_pollOptions_1hnm5_223",bn="_pollOption_1hnm5_223",Sn="_pollOptionDisabled_1hnm5_261",wn="_pollOptionSelected_1hnm5_271",kn="_pollOptionContent_1hnm5_289",In="_pollOptionIcon_1hnm5_305",Cn="_pollOptionText_1hnm5_313",Mn="_pollCheckbox_1hnm5_321",An="_pollResultBar_1hnm5_331",$n="_pollResultFill_1hnm5_353",_n="_pollResultPercent_1hnm5_365",zn="_pollResultCount_1hnm5_381",Tn="_pollSubmitBtn_1hnm5_395",Rn="_pollTotalVotes_1hnm5_431",En="_pollVotedMessage_1hnm5_443",Pn="_interactiveQuiz_1hnm5_485",Nn="_quizHeader_1hnm5_505",Dn="_quizQuestion_1hnm5_519",On="_quizTimer_1hnm5_537",Fn="_quizTimerWarning_1hnm5_555",jn="_timerPulse_1hnm5_1",qn="_quizPoints_1hnm5_577",Ln="_quizAnswers_1hnm5_595",Wn="_quizAnswer_1hnm5_595",Bn="_quizAnswerDisabled_1hnm5_633",Hn="_quizAnswerSelected_1hnm5_643",Vn="_quizAnswerCorrect_1hnm5_661",Un="_quizAnswerIncorrect_1hnm5_671",Qn="_quizAnswerMarker_1hnm5_681",Kn="_quizAnswerText_1hnm5_691",Yn="_quizCorrectMark_1hnm5_703",Xn="_quizIncorrectMark_1hnm5_715",Gn="_quizSubmitBtn_1hnm5_727",Jn="_quizFeedback_1hnm5_775",Zn="_quizFeedbackMessage_1hnm5_783",ei="_quizFeedbackCorrect_1hnm5_797",ti="_quizFeedbackIncorrect_1hnm5_807",ni="_quizExplanation_1hnm5_817",ii="_interactiveCountdown_1hnm5_841",oi="_countdownWarning_1hnm5_857",ri="_countdownPulse_1hnm5_1",ai="_countdownComplete_1hnm5_875",si="_countdownDigital_1hnm5_885",ci="_countdownSeparator_1hnm5_903",li="_countdownDigit_1hnm5_885",di="_countdownCircular_1hnm5_923",ui="_countdownCircleSvg_1hnm5_935",pi="_countdownProgressRing_1hnm5_947",fi="_countdownCircleText_1hnm5_955",mi="_countdownLargeSeconds_1hnm5_975",hi="_countdownFlip_1hnm5_985",yi="_flipCardContainer_1hnm5_997",gi="_flipCard_1hnm5_997",xi="_flipLabel_1hnm5_1033",vi="_flipSeparator_1hnm5_1047",bi="_countdownMinimal_1hnm5_1063",Si="_countdownCompleteMessage_1hnm5_1075",wi="_interactiveQnA_1hnm5_1093",ki="_qnaHeader_1hnm5_1117",Ii="_qnaTitle_1hnm5_1133",Ci="_qnaCount_1hnm5_1147",Mi="_qnaInputForm_1hnm5_1157",Ai="_qnaInputWrapper_1hnm5_1169",$i="_qnaInput_1hnm5_1157",_i="_qnaCharCount_1hnm5_1219",zi="_qnaInputActions_1hnm5_1235",Ti="_qnaAnonymousToggle_1hnm5_1249",Ri="_qnaSubmitBtn_1hnm5_1279",Ei="_qnaClosedMessage_1hnm5_1321",Pi="_qnaQuestionsList_1hnm5_1339",Ni="_qnaQuestion_1hnm5_1339",Di="_qnaQuestionAnswered_1hnm5_1381",Oi="_qnaQuestionContent_1hnm5_1391",Fi="_qnaQuestionText_1hnm5_1405",ji="_qnaQuestionMeta_1hnm5_1417",qi="_qnaAuthor_1hnm5_1431",Li="_qnaQuestionActions_1hnm5_1439",Wi="_qnaUpvoteBtn_1hnm5_1453",Bi="_qnaUpvoted_1hnm5_1489",Hi="_qnaUpvoteIcon_1hnm5_1509",Vi="_qnaUpvoteCount_1hnm5_1517",Ui="_qnaAnsweredBtn_1hnm5_1527",Qi="_qnaMarkedAnswered_1hnm5_1555",Ki="_qnaEmptyState_1hnm5_1567",Yi="_qnaMoreQuestions_1hnm5_1581",Xi="_qnaStyle_stack_1hnm5_1599",Gi="_qnaStyle_floating_1hnm5_1609",k={interactiveElement:rn,interactiveButton:an,disabled:sn,variant_primary:cn,variant_secondary:ln,variant_outline:dn,variant_ghost:un,size_small:pn,size_medium:fn,size_large:mn,buttonIcon:hn,buttonLabel:yn,interactivePoll:gn,pollQuestion:xn,pollOptions:vn,pollOption:bn,pollOptionDisabled:Sn,pollOptionSelected:wn,pollOptionContent:kn,pollOptionIcon:In,pollOptionText:Cn,pollCheckbox:Mn,pollResultBar:An,pollResultFill:$n,pollResultPercent:_n,pollResultCount:zn,pollSubmitBtn:Tn,pollTotalVotes:Rn,pollVotedMessage:En,"pollStyle_horizontal-bar":"_pollStyle_horizontal-bar_1hnm5_463",interactiveQuiz:Pn,quizHeader:Nn,quizQuestion:Dn,quizTimer:On,quizTimerWarning:Fn,timerPulse:jn,quizPoints:qn,quizAnswers:Ln,quizAnswer:Wn,quizAnswerDisabled:Bn,quizAnswerSelected:Hn,quizAnswerCorrect:Vn,quizAnswerIncorrect:Un,quizAnswerMarker:Qn,quizAnswerText:Kn,quizCorrectMark:Yn,quizIncorrectMark:Xn,quizSubmitBtn:Gn,quizFeedback:Jn,quizFeedbackMessage:Zn,quizFeedbackCorrect:ei,quizFeedbackIncorrect:ti,quizExplanation:ni,interactiveCountdown:ii,countdownWarning:oi,countdownPulse:ri,countdownComplete:ai,countdownDigital:si,countdownSeparator:ci,countdownDigit:li,countdownCircular:di,countdownCircleSvg:ui,countdownProgressRing:pi,countdownCircleText:fi,countdownLargeSeconds:mi,countdownFlip:hi,flipCardContainer:yi,flipCard:gi,flipLabel:xi,flipSeparator:vi,countdownMinimal:bi,countdownCompleteMessage:Si,interactiveQnA:wi,qnaHeader:ki,qnaTitle:Ii,qnaCount:Ci,qnaInputForm:Mi,qnaInputWrapper:Ai,qnaInput:$i,qnaCharCount:_i,qnaInputActions:zi,qnaAnonymousToggle:Ti,qnaSubmitBtn:Ri,qnaClosedMessage:Ei,qnaQuestionsList:Pi,qnaQuestion:Ni,qnaQuestionAnswered:Di,qnaQuestionContent:Oi,qnaQuestionText:Fi,qnaQuestionMeta:ji,qnaAuthor:qi,qnaQuestionActions:Li,qnaUpvoteBtn:Wi,qnaUpvoted:Bi,qnaUpvoteIcon:Hi,qnaUpvoteCount:Vi,qnaAnsweredBtn:Ui,qnaMarkedAnswered:Qi,qnaEmptyState:Ki,qnaMoreQuestions:Yi,qnaStyle_stack:Xi,qnaStyle_floating:Gi},Ji=({content:e,onAction:t,disabled:n=!1,className:i,theme:o})=>{const{label:r,action:a,variant:s="primary",size:c="medium",icon:d,iconPosition:p="left",backgroundColor:m,textColor:y,borderRadius:f}=e,x=l.useCallback(()=>{if(!n){if(a.type==="openUrl"){const{url:h,newTab:I=!0}=a;I?window.open(h,"_blank","noopener,noreferrer"):window.location.href=h}t==null||t(a)}},[a,n,t]),g={backgroundColor:m??(s==="primary"?o==null?void 0:o.primaryColor:void 0),color:y,borderRadius:f!==void 0?`${f}px`:void 0,fontFamily:o==null?void 0:o.fontFamily},b=[k.interactiveButton,k[`variant_${s}`],k[`size_${c}`],n?k.disabled:"",i??""].filter(Boolean).join(" "),S=()=>d?u.jsx("span",{className:k.buttonIcon,children:Zi(d)}):null;return u.jsxs("button",{className:b,style:g,onClick:x,disabled:n,type:"button",children:[p==="left"&&S(),u.jsx("span",{className:k.buttonLabel,children:r}),p==="right"&&S()]})};function Zi(e){return{"arrow-right":"→","arrow-left":"←",play:"▶",pause:"⏸",stop:"⏹",link:"🔗",external:"↗",check:"✓",close:"✕",info:"ℹ",question:"?",star:"★",heart:"♥",download:"⬇",upload:"⬆",share:"↗",copy:"📋",edit:"✏",delete:"🗑",refresh:"↻"}[e]??e}const eo=({content:e,onVote:t,onResultsUpdate:n,votingClosed:i=!1,userVote:o,className:r,theme:a})=>{const{question:s,options:c,multiSelect:d=!1,showResultsAfterVote:p=!0,liveResults:m=!1,displayStyle:y="buttons",resultColors:f,results:x={}}=e,[g,b]=l.useState(o??[]),[S,h]=l.useState(!!(o!=null&&o.length)),[I,R]=l.useState(x),z=l.useMemo(()=>Object.values(I).reduce((C,w)=>C+w,0),[I]),F=[(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)"],Q=f??F,T=l.useCallback(C=>{S||i||b(w=>d?w.includes(C)?w.filter(v=>v!==C):[...w,C]:[C])},[S,i,d]),P=l.useCallback(()=>{if(g.length===0||S)return;const C={...I};g.forEach(w=>{C[w]=(C[w]??0)+1}),R(C),h(!0),t==null||t(g),n==null||n(C)},[g,S,I,t,n]),q=m||p&&S,N=(C,w)=>{const v=g.includes(C.id),A=I[C.id]??0,O=z>0?A/z*100:0,$=C.color??Q[w%Q.length],L=[k.pollOption,k[`pollStyle_${y}`],v?k.pollOptionSelected:"",S||i?k.pollOptionDisabled:""].filter(Boolean).join(" ");return u.jsxs("button",{className:L,onClick:()=>T(C.id),disabled:S||i,type:"button",style:{"--poll-option-color":$,fontFamily:a==null?void 0:a.fontFamily},children:[u.jsxs("div",{className:k.pollOptionContent,children:[C.icon&&u.jsx("span",{className:k.pollOptionIcon,children:C.icon}),u.jsx("span",{className:k.pollOptionText,children:C.text}),d&&!S&&u.jsx("span",{className:k.pollCheckbox,children:v?"☑":"☐"})]}),q&&u.jsxs("div",{className:k.pollResultBar,children:[u.jsx("div",{className:k.pollResultFill,style:{width:`${O}%`,backgroundColor:$}}),u.jsxs("span",{className:k.pollResultPercent,children:[O.toFixed(0),"%"]}),u.jsxs("span",{className:k.pollResultCount,children:["(",A,")"]})]})]},C.id)};return u.jsxs("div",{className:`${k.interactivePoll} ${r??""}`,children:[u.jsx("h3",{className:k.pollQuestion,style:{fontFamily:a==null?void 0:a.fontFamily},children:s}),u.jsx("div",{className:k.pollOptions,children:c.map((C,w)=>N(C,w))}),!S&&!i&&g.length>0&&u.jsx("button",{className:k.pollSubmitBtn,onClick:P,style:{backgroundColor:a==null?void 0:a.primaryColor,fontFamily:a==null?void 0:a.fontFamily},children:"Oddaj głos"}),q&&z>0&&u.jsxs("div",{className:k.pollTotalVotes,children:["Łącznie głosów: ",z]}),S&&u.jsx("div",{className:k.pollVotedMessage,children:"✓ Dziękujemy za głos!"})]})},to=({content:e,onSubmit:t,locked:n=!1,className:i,theme:o})=>{const{question:r,answers:a,quizType:s="single",showCorrectAfterSubmit:c=!0,timeLimitSeconds:d=0,points:p=10,correctFeedback:m="Poprawna odpowiedź! 🎉",incorrectFeedback:y="Niestety, to nie jest poprawna odpowiedź.",explanation:f}=e,[x,g]=l.useState([]),[b,S]=l.useState(!1),[h,I]=l.useState(!1),[R,z]=l.useState(d),F=l.useRef(null);l.useEffect(()=>{if(d>0&&!b&&!n)return z(d),F.current=setInterval(()=>{z(N=>N<=1?(clearInterval(F.current),0):N-1)},1e3),()=>{F.current&&clearInterval(F.current)}},[d,b,n]),l.useEffect(()=>{R===0&&d>0&&!b&&T()},[R,d,b]);const Q=l.useCallback(N=>{b||n||g(C=>s==="single"||s==="true-false"?[N]:C.includes(N)?C.filter(w=>w!==N):[...C,N])},[b,n,s]),T=l.useCallback(()=>{if(b||x.length===0)return;F.current&&clearInterval(F.current);const N=a.filter(O=>O.isCorrect).map(O=>O.id),C=new Set(x),w=new Set(N),v=C.size===w.size&&[...C].every(O=>w.has(O));I(v),S(!0);const A=v?p:0;t==null||t(x,v,A)},[b,x,a,p,t]),P=N=>{const C=Math.floor(N/60),w=N%60;return C>0?`${C}:${w.toString().padStart(2,"0")}`:`${w}s`},q=N=>{const C=x.includes(N.id),w=b&&c,v=[k.quizAnswer,C?k.quizAnswerSelected:"",b?k.quizAnswerDisabled:"",w&&N.isCorrect?k.quizAnswerCorrect:"",w&&C&&!N.isCorrect?k.quizAnswerIncorrect:""].filter(Boolean).join(" ");return u.jsxs("button",{className:v,onClick:()=>Q(N.id),disabled:b||n,type:"button",style:{fontFamily:o==null?void 0:o.fontFamily},children:[u.jsxs("span",{className:k.quizAnswerMarker,children:[s==="multiple"&&(C?"☑":"☐"),(s==="single"||s==="true-false")&&(C?"●":"○")]}),u.jsx("span",{className:k.quizAnswerText,children:N.text}),w&&N.isCorrect&&u.jsx("span",{className:k.quizCorrectMark,children:"✓"}),w&&C&&!N.isCorrect&&u.jsx("span",{className:k.quizIncorrectMark,children:"✗"})]},N.id)};return u.jsxs("div",{className:`${k.interactiveQuiz} ${i??""}`,children:[u.jsxs("div",{className:k.quizHeader,children:[u.jsx("h3",{className:k.quizQuestion,style:{fontFamily:o==null?void 0:o.fontFamily},children:r}),d>0&&!b&&u.jsxs("div",{className:`${k.quizTimer} ${R<=10?k.quizTimerWarning:""}`,children:["⏱ ",P(R)]}),p>0&&u.jsx("div",{className:k.quizPoints,children:b?h?`+${p} pkt`:"0 pkt":`${p} pkt`})]}),u.jsx("div",{className:k.quizAnswers,children:a.map(q)}),!b&&!n&&x.length>0&&u.jsx("button",{className:k.quizSubmitBtn,onClick:T,style:{backgroundColor:o==null?void 0:o.primaryColor,fontFamily:o==null?void 0:o.fontFamily},children:"Zatwierdź odpowiedź"}),b&&c&&u.jsxs("div",{className:k.quizFeedback,children:[u.jsx("div",{className:`${k.quizFeedbackMessage} ${h?k.quizFeedbackCorrect:k.quizFeedbackIncorrect}`,children:h?m:y}),f&&u.jsxs("div",{className:k.quizExplanation,children:[u.jsx("strong",{children:"Wyjaśnienie:"})," ",f]})]})]})},no=({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:d,textColor:p,backgroundColor:m,warningThreshold:y=10,warningColor:f="var(--nice-danger, #ef4444)"}=e,[x,g]=l.useState(()=>{if(typeof r=="number")return r;const C=new Date(r),w=new Date;return Math.max(0,Math.floor((C.getTime()-w.getTime())/1e3))}),[b,S]=l.useState(!1),h=l.useRef(null);l.useEffect(()=>{if(n||b){h.current&&(clearInterval(h.current),h.current=null);return}return h.current=setInterval(()=>{g(C=>C<=1?(clearInterval(h.current),S(!0),0):C-1)},1e3),()=>{h.current&&clearInterval(h.current)}},[n,b]),l.useEffect(()=>{b&&(t==null||t(d))},[b,t,d]);const I=l.useMemo(()=>{const C=Math.floor(x/3600),w=Math.floor(x%3600/60),v=x%60;return{hours:C,minutes:w,seconds:v}},[x]),R=x<=y&&x>0,z=(C,w=2)=>C.toString().padStart(w,"0"),F=()=>{const{hours:C,minutes:w,seconds:v}=I;let A=[];return a==="hh:mm:ss"||C>0?A=[z(C),z(w),z(v)]:a==="mm:ss"?A=[z(w),z(v)]:A=[v.toString()],u.jsx("div",{className:k.countdownDigital,children:A.map((O,$)=>u.jsxs(l.Fragment,{children:[$>0&&u.jsx("span",{className:k.countdownSeparator,children:":"}),u.jsx("span",{className:k.countdownDigit,children:O})]},$))})},Q=()=>{const{hours:C,minutes:w,seconds:v}=I,A=typeof r=="number"?r:x,O=A>0?x/A:0,$=2*Math.PI*45;return u.jsxs("div",{className:k.countdownCircular,children:[u.jsxs("svg",{viewBox:"0 0 100 100",className:k.countdownCircleSvg,children:[u.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:"currentColor",strokeWidth:"8",opacity:"0.2"}),u.jsx("circle",{cx:"50",cy:"50",r:"45",fill:"none",stroke:R?f:p??(o==null?void 0:o.primaryColor)??"var(--nice-info, #6366f1)",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:$,strokeDashoffset:$*(1-O),transform:"rotate(-90 50 50)",className:k.countdownProgressRing})]}),u.jsx("div",{className:k.countdownCircleText,children:a!=="ss"?u.jsxs(u.Fragment,{children:[C>0&&u.jsxs("span",{children:[z(C),":"]}),u.jsxs("span",{children:[z(w),":"]}),u.jsx("span",{children:z(v)})]}):u.jsx("span",{className:k.countdownLargeSeconds,children:v})})]})},T=()=>{const{hours:C,minutes:w,seconds:v}=I,A=(O,$)=>u.jsxs("div",{className:k.flipCardContainer,children:[u.jsx("div",{className:k.flipCard,children:u.jsx("span",{children:O})}),c&&u.jsx("span",{className:k.flipLabel,children:$})]});return u.jsxs("div",{className:k.countdownFlip,children:[(a==="hh:mm:ss"||C>0)&&u.jsxs(u.Fragment,{children:[A(z(C),"godz."),u.jsx("span",{className:k.flipSeparator,children:":"})]}),a!=="ss"&&u.jsxs(u.Fragment,{children:[A(z(w),"min."),u.jsx("span",{className:k.flipSeparator,children:":"})]}),A(z(v),"sek.")]})},P=()=>{const{hours:C,minutes:w,seconds:v}=I;if(a==="ss")return u.jsxs("span",{className:k.countdownMinimal,children:[v,"s"]});let A="";return C>0&&(A+=`${C}h `),(w>0||C>0)&&(A+=`${w}m `),A+=`${v}s`,u.jsx("span",{className:k.countdownMinimal,children:A.trim()})},q={color:R?f:p,backgroundColor:m,fontFamily:o==null?void 0:o.fontFamily},N=[k.interactiveCountdown,k[`countdownStyle_${s}`],R?k.countdownWarning:"",b?k.countdownComplete:"",i??""].filter(Boolean).join(" ");return u.jsxs("div",{className:N,style:q,children:[s==="digital"&&F(),s==="circular"&&Q(),s==="flip"&&T(),s==="minimal"&&P(),b&&u.jsx("div",{className:k.countdownCompleteMessage,children:"⏰ Czas minął!"})]})},io=({content:e,userName:t,onSubmitQuestion:n,onUpvote:i,onMarkAnswered:o,submissionClosed:r=!1,isModerator:a=!1,upvotedQuestions:s=[],className:c,theme:d})=>{const{placeholder:p="Zadaj pytanie...",allowAnonymous:m=!0,moderated:y=!1,allowUpvote:f=!0,maxVisible:x=10,displayStyle:g="list",charLimit:b=500,questions:S=[]}=e,[h,I]=l.useState(S),[R,z]=l.useState(""),[F,Q]=l.useState(!1),[T,P]=l.useState(new Set(s)),q=l.useMemo(()=>[...h].filter($=>!y||$.answered||a).sort(($,L)=>L.upvotes!==$.upvotes?L.upvotes-$.upvotes:new Date(L.timestamp).getTime()-new Date($.timestamp).getTime()).slice(0,x),[h,y,a,x]),N=l.useCallback($=>{$.preventDefault();const L=R.trim();if(!L||r)return;const X={id:`q_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,text:L,author:F||!t?void 0:t,timestamp:new Date().toISOString(),upvotes:0,answered:!1};I(Z=>[X,...Z]),z(""),n==null||n({text:X.text,author:X.author,answered:!1})},[R,r,F,t,n]),C=l.useCallback($=>{!f||T.has($)||(I(L=>L.map(X=>X.id===$?{...X,upvotes:X.upvotes+1}:X)),P(L=>new Set(L).add($)),i==null||i($))},[f,T,i]),w=l.useCallback($=>{a&&(I(L=>L.map(X=>X.id===$?{...X,answered:!X.answered}:X)),o==null||o($))},[a,o]),v=()=>u.jsxs("form",{className:k.qnaInputForm,onSubmit:N,children:[u.jsxs("div",{className:k.qnaInputWrapper,children:[u.jsx("textarea",{className:k.qnaInput,placeholder:p,value:R,onChange:$=>z($.target.value.slice(0,b)),disabled:r,rows:2,style:{fontFamily:d==null?void 0:d.fontFamily}}),u.jsxs("span",{className:k.qnaCharCount,children:[R.length,"/",b]})]}),u.jsxs("div",{className:k.qnaInputActions,children:[m&&u.jsxs("label",{className:k.qnaAnonymousToggle,children:[u.jsx("input",{type:"checkbox",checked:F,onChange:$=>Q($.target.checked)}),u.jsx("span",{children:"Anonimowo"})]}),u.jsx("button",{type:"submit",className:k.qnaSubmitBtn,disabled:!R.trim()||r,style:{backgroundColor:d==null?void 0:d.primaryColor,fontFamily:d==null?void 0:d.fontFamily},children:"Wyślij pytanie"})]})]}),A=$=>{const L=T.has($.id);return u.jsxs("div",{className:`${k.qnaQuestion} ${$.answered?k.qnaQuestionAnswered:""}`,children:[u.jsxs("div",{className:k.qnaQuestionContent,children:[u.jsx("span",{className:k.qnaQuestionText,style:{fontFamily:d==null?void 0:d.fontFamily},children:$.text}),u.jsxs("div",{className:k.qnaQuestionMeta,children:[u.jsx("span",{className:k.qnaAuthor,children:$.author?`@${$.author}`:"👤 Anonim"}),u.jsx("span",{className:k.qnaTimestamp,children:oo($.timestamp)})]})]}),u.jsxs("div",{className:k.qnaQuestionActions,children:[f&&u.jsxs("button",{className:`${k.qnaUpvoteBtn} ${L?k.qnaUpvoted:""}`,onClick:()=>C($.id),disabled:L,title:L?"Już zagłosowałeś":"Zagłosuj",children:[u.jsx("span",{className:k.qnaUpvoteIcon,children:"▲"}),u.jsx("span",{className:k.qnaUpvoteCount,children:$.upvotes})]}),a&&u.jsx("button",{className:`${k.qnaAnsweredBtn} ${$.answered?k.qnaMarkedAnswered:""}`,onClick:()=>w($.id),title:$.answered?"Oznacz jako nieodpowiedziane":"Oznacz jako odpowiedziane",children:$.answered?"✓":"○"})]})]},$.id)},O=[k.interactiveQnA,k[`qnaStyle_${g}`],c??""].filter(Boolean).join(" ");return u.jsxs("div",{className:O,children:[u.jsxs("div",{className:k.qnaHeader,children:[u.jsx("h3",{className:k.qnaTitle,style:{fontFamily:d==null?void 0:d.fontFamily},children:"Pytania i odpowiedzi"}),u.jsxs("span",{className:k.qnaCount,children:[h.length," ",h.length===1?"pytanie":"pytań"]})]}),!r&&v(),r&&u.jsx("div",{className:k.qnaClosedMessage,children:"Zadawanie pytań zostało zamknięte"}),u.jsx("div",{className:k.qnaQuestionsList,children:q.length===0?u.jsx("div",{className:k.qnaEmptyState,children:"Brak pytań. Bądź pierwszy!"}):q.map(A)}),h.length>x&&u.jsxs("div",{className:k.qnaMoreQuestions,children:["+",h.length-x," więcej pytań"]})]})};function oo(e){const t=new Date(e),i=new Date().getTime()-t.getTime(),o=Math.floor(i/6e4);if(o<1)return"Teraz";if(o<60)return`${o} min temu`;const r=Math.floor(o/60);return r<24?`${r}h temu`:t.toLocaleDateString("pl-PL",{day:"numeric",month:"short"})}const Ue={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"},Qe={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"},Ke={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"},Ye={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"},Xe={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"},Ge={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"},Je={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"},Ze={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"},et={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"},tt={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"},nt={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"},it={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"},ot={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"},rt={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"},at={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"},st={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"},ct={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"},lt=[Ue,Qe,Ke,Ye,Xe,Ge,Je,Ze,et,tt,nt,it,ot,rt,at,st,ct];class ro{constructor(){this.transitions=new Map,lt.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 dt=new ro;function Ee(e,t,n,i){if(i&&i.length>0){const o=[{offset:0,style:e},...i,{offset:1,style:t}].sort((d,p)=>d.offset-p.offset);let r=o[0],a=o[o.length-1];for(let d=0;d<o.length-1;d++)if(n>=o[d].offset&&n<=o[d+1].offset){r=o[d],a=o[d+1];break}const s=a.offset-r.offset,c=s>0?(n-r.offset)/s:1;return Pe(r.style,a.style,c)}return Pe(e,t,n)}function Pe(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 ao(e,t){const n=dt.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:Ee(i.from,i.to,t,i.keyframes),incomingStyle:Ee(o.from,o.to,t,o.keyframes),isComplete:t>=1}}function so(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 co(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 lo(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 uo(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 pe(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function ye(e){return`${e>=0?"+":""}${e.toFixed(1)}%`}function ge(e){return e>=0?"var(--nice-success, #10b981)":"var(--nice-danger, #ef4444)"}function po(e){return{id:"slide-title",title:"Title",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"var(--nice-primary-dark, #1E3A8A)",position:0},{color:"var(--nice-primary, #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:"var(--nice-bg, #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:"var(--nice-primary-light, #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:"var(--nice-primary-bg, #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 fo(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:"var(--nice-bg, #fff)",stroke:"var(--nice-border, #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:"var(--nice-text-secondary, #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:pe(e.kpis.revenue.value),style:{fontSize:28,fontWeight:700,color:"var(--nice-text, #1f2937)",textAlign:"center"}}},{id:"kpi-revenue-change",type:"text",position:{x:7,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ye(e.kpis.revenue.change),style:{fontSize:16,fontWeight:600,color:ge(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:"var(--nice-bg, #fff)",stroke:"var(--nice-border, #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:"var(--nice-text-secondary, #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:pe(e.kpis.profit.value),style:{fontSize:28,fontWeight:700,color:"var(--nice-text, #1f2937)",textAlign:"center"}}},{id:"kpi-profit-change",type:"text",position:{x:30,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ye(e.kpis.profit.change),style:{fontSize:16,fontWeight:600,color:ge(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:"var(--nice-bg, #fff)",stroke:"var(--nice-border, #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:"var(--nice-text-secondary, #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:"var(--nice-text, #1f2937)",textAlign:"center"}}},{id:"kpi-customers-change",type:"text",position:{x:53,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ye(e.kpis.customers.change),style:{fontSize:16,fontWeight:600,color:ge(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:"var(--nice-bg, #fff)",stroke:"var(--nice-border, #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:"var(--nice-text-secondary, #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:"var(--nice-text, #1f2937)",textAlign:"center"}}},{id:"kpi-satisfaction-change",type:"text",position:{x:76,y:46,width:17,height:4,unit:"percent"},content:{type:"text",text:ye(e.kpis.satisfaction.change),style:{fontSize:16,fontWeight:600,color:ge(e.kpis.satisfaction.change),textAlign:"center"}}}];return{id:"slide-kpis",title:"Key Performance Indicators",layout:"titleContent",background:{type:"solid",color:"var(--nice-bg-secondary, #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:"var(--nice-text, #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 mo(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:"var(--nice-primary, #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:"var(--nice-primary-light, #93c5fd)"}]:[]]},options:{showLegend:!0,showGridLines:!0,animation:!0}};return{id:"slide-revenue",title:"Revenue Analysis",layout:"titleContent",background:{type:"solid",color:"var(--nice-bg, #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:"var(--nice-text, #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 ho(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:["var(--nice-primary, #3b82f6)","var(--nice-success, #10b981)","var(--nice-warning, #f59e0b)","var(--nice-danger, #ef4444)","var(--nice-accent, #8b5cf6)","var(--nice-accent-pink, #ec4899)","var(--nice-info, #14b8a6)","var(--nice-info, #6366f1)"]}]},options:{showLegend:!0,showDataLabels:!0,animation:!0}};return{id:"slide-costs",title:"Cost Analysis",layout:"twoColumn",background:{type:"solid",color:"var(--nice-bg, #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:"var(--nice-text, #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,pe(n.value),`${n.percentage}%`]),style:{headerBackground:"var(--nice-bg-secondary, #f3f4f6)",headerColor:"var(--nice-text, #374151)",cellPadding:12,fontSize:14,borderColor:"var(--nice-border, #e5e7eb)"}},animation:{effect:"slideInRight",durationMs:600,delayMs:600}}],notes:"Discuss major cost categories and opportunities for optimization.",durationMs:6e4}}function yo(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 (${pe(i.value)})`,style:{fontSize:16,fontWeight:600,color:o<2?"var(--nice-bg, #fff)":"var(--nice-text, #1f2937)",textAlign:"center"}}}));return{id:"slide-pipeline",title:"Sales Pipeline",layout:"titleContent",background:{type:"solid",color:"var(--nice-bg, #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:"var(--nice-text, #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: ${pe(e.pipeline.totalValue)}`,style:{fontSize:28,fontWeight:700,color:"var(--nice-primary, #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 go(e){const t={high:"var(--nice-danger, #ef4444)",medium:"var(--nice-warning, #f59e0b)",low:"var(--nice-success, #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:"var(--nice-bg, #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:"var(--nice-text, #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:"var(--nice-text-secondary, #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:"var(--nice-text-secondary, #6b7280)"}}}]);return{id:"slide-risks",title:"Risks & Mitigation",layout:"titleContent",background:{type:"solid",color:"var(--nice-bg-secondary, #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:"var(--nice-text, #1f2937)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...n],notes:"Discuss each risk, its current status, and mitigation actions in progress.",durationMs:9e4}}function xo(e){const t={"on-track":"var(--nice-success, #10b981)","at-risk":"var(--nice-warning, #f59e0b)",completed:"var(--nice-primary, #3b82f6)","not-started":"var(--nice-text-muted, #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:"var(--nice-bg, #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:"var(--nice-text, #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:"var(--nice-bg, #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:"var(--nice-text, #1f2937)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:0}},...i],notes:"Review progress on strategic initiatives and discuss any blockers.",durationMs:6e4}}function vo(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:"var(--nice-primary-bg, #f0f9ff)",position:0},{color:"var(--nice-primary-bg, #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:"var(--nice-text, #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:"var(--nice-bg, #fff)",stroke:"var(--nice-primary, #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:"var(--nice-text, #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:"var(--nice-text-secondary, #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:"var(--nice-bg, #fff)",stroke:"var(--nice-success, #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:"var(--nice-success, #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:"var(--nice-text-secondary, #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:"var(--nice-bg, #fff)",stroke:"var(--nice-warning, #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:"var(--nice-warning, #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:"var(--nice-text-secondary, #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:"var(--nice-text, #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:"var(--nice-text, #374151)"}},animation:{effect:"slideInLeft",durationMs:300,delayMs:800+i*100}}))],notes:"Celebrate new team members and acknowledge departures. Highlight team achievements.",durationMs:45e3}}function bo(e){return{id:"slide-qa",title:"Q&A",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"var(--nice-primary-dark, #1E3A8A)",position:0},{color:"var(--nice-primary, #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:"var(--nice-bg, #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:"var(--nice-primary-light, #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:"var(--nice-primary-bg, #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 So(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:[po(e),fo(e),mo(e),ho(e),yo(e),go(e),xo(e),vo(e),bo(e)],theme:{colors:{primary:"var(--nice-primary, #3b82f6)",secondary:"var(--nice-success, #10b981)",background:"var(--nice-bg, #fff)",text:"var(--nice-text, #1f2937)",accent:"var(--nice-warning, #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 wo(){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 ko(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:"var(--nice-text, #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:"var(--nice-danger-bg, #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:"var(--nice-danger-dark, #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:"var(--nice-danger-bg, #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 Io(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:"var(--nice-bg, #fff)",stroke:"var(--nice-success, #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:"var(--nice-text, #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:"var(--nice-text-secondary, #6b7280)",textAlign:"center",lineHeight:1.4}}}]);return{id:"slide-solution",title:"The Solution",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"var(--nice-success-bg, #ecfdf5)",position:0},{color:"var(--nice-success-bg, #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:"var(--nice-text, #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 Co(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:"var(--nice-text, #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:"var(--nice-bg, #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:"var(--nice-text, #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:"var(--nice-bg-secondary, #f3f4f6)",stroke:"var(--nice-border, #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:"var(--nice-text-muted, #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:"var(--nice-text, #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 Mo(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?"var(--nice-primary, #3b82f6)":"var(--nice-bg, #fff)",stroke:a?"var(--nice-primary-hover, #2563eb)":"var(--nice-border, #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?"var(--nice-bg, #fff)":"var(--nice-text, #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?"var(--nice-primary-bg, #dbeafe)":"var(--nice-text-secondary, #6b7280)",textAlign:"center",lineHeight:1.3}}}]});return{id:"slide-features",title:"Features",layout:"titleContent",background:{type:"solid",color:"var(--nice-bg-secondary, #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:"var(--nice-text, #1f2937)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Highlight key features. Focus on benefits, not just functionality.",durationMs:6e4}}function Ao(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?"var(--nice-primary, #3b82f6)":"var(--nice-bg, #fff)",stroke:o?"var(--nice-primary-dark, #1d4ed8)":"var(--nice-border, #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:"var(--nice-warning-light, #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?"var(--nice-bg, #fff)":"var(--nice-text, #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?"var(--nice-bg, #fff)":"var(--nice-primary, #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?"var(--nice-primary-bg, #dbeafe)":"var(--nice-text-secondary, #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?"var(--nice-bg, #fff)":"var(--nice-primary, #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?"var(--nice-primary, #3b82f6)":"var(--nice-bg, #fff)",textAlign:"center"}}}]});return{id:"slide-pricing",title:"Pricing",layout:"titleContent",background:{type:"solid",color:"var(--nice-bg, #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:"var(--nice-text, #1f2937)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Present pricing clearly. Emphasize value, not just cost.",durationMs:6e4}}function $o(e){return{id:"slide-cta",title:"Call to Action",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"var(--nice-primary-dark, #1e40af)",position:0},{color:"var(--nice-primary, #3b82f6)",position:50},{color:"var(--nice-primary-light, #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:"var(--nice-bg, #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:"var(--nice-primary-bg, #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:"var(--nice-bg, #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:"var(--nice-primary-dark, #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:"var(--nice-primary-light, #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:"var(--nice-primary-light, #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 _o(e){return{id:"slide-title",title:"Title",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"var(--nice-text, #0f172a)",position:0},{color:"var(--nice-text, #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:"var(--nice-bg, #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:"var(--nice-text-muted, #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:"var(--nice-text-secondary, #64748b)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Opening slide. Create intrigue and set the tone.",durationMs:15e3}}function zo(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:[_o(e),ko(e),Io(e),Co(e),Mo(e),Ao(e),$o(e)],theme:{colors:{primary:"var(--nice-primary, #3b82f6)",secondary:"var(--nice-success, #10b981)",background:"var(--nice-bg, #fff)",text:"var(--nice-text, #1f2937)",accent:"var(--nice-warning, #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 To(){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 Ro(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:"var(--nice-primary-dark, #1E3A8A)",position:0},{color:"var(--nice-primary, #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:"var(--nice-bg, #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:"var(--nice-primary-light, #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:"var(--nice-primary-bg, #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:"var(--nice-primary-light, #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?"var(--nice-success-light, #4ade80)":t>=60?"var(--nice-warning-light, #fbbf24)":"var(--nice-danger-light, #f87171)",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:600,delayMs:800}}],notes:"Welcome stakeholders. Quick overview of sprint completion.",durationMs:3e4}}function Eo(e){return{id:"slide-goal",title:"Sprint Goal",layout:"titleContent",background:{type:"solid",color:"var(--nice-primary-bg, #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:"var(--nice-primary-dark, #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:"var(--nice-bg, #fff)",stroke:"var(--nice-primary, #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:"var(--nice-text, #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?"var(--nice-success, #059669)":"var(--nice-warning-dark, #d97706)",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:500,delayMs:700}}],notes:"Review whether the sprint goal was achieved and why.",durationMs:45e3}}function Po(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"?"var(--nice-success, #059669)":n.type==="bug"?"var(--nice-danger-dark, #dc2626)":n.type==="tech-debt"?"var(--nice-accent, #7c3aed)":"var(--nice-info-dark, #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:"var(--nice-success-bg, #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:"var(--nice-success-dark, #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:"var(--nice-success, #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:"var(--nice-text-secondary, #6b7280)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1200}}],notes:"Walk through completed items. Highlight any notable achievements.",durationMs:9e4}}function No(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:"var(--nice-primary-light, #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:"var(--nice-bg, #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:"var(--nice-primary-dark, #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:"var(--nice-primary, #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:"var(--nice-primary-dark, #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:"var(--nice-primary, #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:"var(--nice-text-secondary, #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?"var(--nice-success, #059669)":"var(--nice-danger-dark, #dc2626)",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}],notes:"Review velocity trends. Discuss any significant changes.",durationMs:6e4}}function Do(e){const t=(e.impediments||[]).slice(0,5).map((n,i)=>{const o=n.status==="resolved"?"✅":n.status==="ongoing"?"🔄":"🚨",r=n.status==="resolved"?"var(--nice-success, #059669)":n.status==="ongoing"?"var(--nice-warning-dark, #d97706)":"var(--nice-danger-dark, #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:"var(--nice-danger-bg, #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:"var(--nice-danger-dark, #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:"var(--nice-text-secondary, #6b7280)",textAlign:"center"}}}],notes:"Discuss blockers and what help is needed from stakeholders.",durationMs:6e4}}function Oo(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:"var(--nice-text, #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:"var(--nice-primary-bg, #eef2ff)",position:0},{color:"var(--nice-primary-bg, #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:"var(--nice-primary-dark, #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:"var(--nice-info, #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:"var(--nice-text, #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:"var(--nice-info, #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:"var(--nice-success, #059669)",textAlign:"right"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}}],notes:"Preview next sprint. Get stakeholder input on priorities.",durationMs:6e4}}function Fo(e){const t=[Ro(e),Eo(e),Po(e),No(e)];return e.impediments&&e.impediments.length>0&&t.push(Do(e)),t.push(Oo(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:"var(--nice-primary, #3b82f6)",secondary:"var(--nice-success, #10b981)",background:"var(--nice-bg, #fff)",text:"var(--nice-text, #1f2937)",accent:"var(--nice-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 jo(){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 qo(e){return{id:"slide-title",title:"Architecture Overview",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"var(--nice-text, #0f172a)",position:0},{color:"var(--nice-text, #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:"var(--nice-bg, #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:"var(--nice-primary-light, #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:"var(--nice-text-muted, #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:"var(--nice-border, #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:"var(--nice-text-secondary, #64748b)",textAlign:"center"}}}]:[]],notes:"Introduction to the system architecture. Set context for the audience.",durationMs:3e4}}function Lo(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:"var(--nice-text, #1e293b)",stroke:"var(--nice-text, #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:"var(--nice-primary-light, #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:"var(--nice-text-muted, #94a3b8)",textAlign:"center"}}}]).flat();return{id:"slide-overview",title:"System Overview",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #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:"var(--nice-bg-secondary, #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:"var(--nice-border, #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:"var(--nice-text, #1e293b)",stroke:"var(--nice-text, #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:"var(--nice-text-secondary, #64748b)",textAlign:"center"}}},...t],notes:"High-level system overview. Explain the main purpose and characteristics.",durationMs:6e4}}function Wo(e){const t={frontend:"var(--nice-primary, #3b82f6)",backend:"var(--nice-success, #10b981)",service:"var(--nice-accent, #8b5cf6)",database:"var(--nice-warning, #f59e0b)",cache:"var(--nice-accent-pink, #ec4899)",queue:"var(--nice-info, #06b6d4)",external:"var(--nice-text-secondary, #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]||"var(--nice-text-secondary, #6b7280)",d=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:"var(--nice-text, #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:d,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:"var(--nice-bg-secondary, #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:"var(--nice-text-muted, #94a3b8)",lineHeight:1.4}}}]});return{id:"slide-components",title:"Components",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #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:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...i],notes:"Walk through each component. Explain responsibilities and interactions.",durationMs:9e4}}function Bo(e){const n=[{key:"frontend",label:"Frontend",icon:"🖥️",color:"var(--nice-primary, #3b82f6)"},{key:"backend",label:"Backend",icon:"⚙️",color:"var(--nice-success, #10b981)"},{key:"database",label:"Database",icon:"🗄️",color:"var(--nice-warning, #f59e0b)"},{key:"infrastructure",label:"Infrastructure",icon:"☁️",color:"var(--nice-accent, #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,d)=>({id:`tech-item-${i.key}-${d}`,type:"text",position:{x:7+a*48,y:28+s*40+d*7,width:40,height:5,unit:"percent"},content:{type:"text",text:`• ${c.name}${c.version?` v${c.version}`:""} - ${c.purpose}`,style:{fontSize:14,color:"var(--nice-border, #cbd5e1)",lineHeight:1.3}},animation:{effect:"slideInRight",durationMs:300,delayMs:400+o*100+d*50}}))]});return{id:"slide-techstack",title:"Tech Stack",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #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:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...n],notes:"Overview of technologies used. Explain key decisions.",durationMs:6e4}}function Ho(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
+ ${n.purpose}`,style:{fontSize:14,color:"var(--nice-border, #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:"var(--nice-text, #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:"var(--nice-bg-secondary, #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:"var(--nice-accent, #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:"var(--nice-text-muted, #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:"var(--nice-text, #1e293b)",stroke:"var(--nice-accent, #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:"var(--nice-text-secondary, #64748b)",textAlign:"center"}}},...t],notes:"Explain infrastructure setup, scaling strategy, and deployment.",durationMs:6e4}}function Vo(e){if(!e.security)return{id:"slide-security",title:"Security",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #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:"var(--nice-text-secondary, #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:"var(--nice-success-light, #4ade80)"}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+i*100}}));return{id:"slide-security",title:"Security",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #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:"var(--nice-bg-secondary, #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:"var(--nice-primary-light, #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:"var(--nice-primary-light, #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:
101
+ ${e.security.compliance.join(`
102
+ `)}`,style:{fontSize:18,color:"var(--nice-text-muted, #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:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},...t],notes:"Cover security measures and compliance requirements.",durationMs:6e4}}function Uo(e){const t=[qo(e),Lo(e),Wo(e),Bo(e),Ho(e)];return e.security&&t.push(Vo(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:"var(--nice-primary, #3b82f6)",secondary:"var(--nice-accent, #8b5cf6)",background:"var(--nice-text, #0f172a)",text:"var(--nice-bg-secondary, #f8fafc)",accent:"var(--nice-success, #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 Qo(){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 Ko(e){return{id:"slide-welcome",title:"Welcome",layout:"titleSlide",background:{type:"gradient",gradientStops:[{color:"var(--nice-accent, #7c3aed)",position:0},{color:"var(--nice-accent, #a78bfa)",position:50},{color:"var(--nice-accent, #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:"var(--nice-bg, #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:"var(--nice-bg, #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:"var(--nice-accent-bg, #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:"var(--nice-accent-bg, #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:"var(--nice-accent, #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:"var(--nice-accent-bg, #ede9fe)",textAlign:"center"}}}]:[]],notes:"Warm welcome! Make the new hire feel excited to join.",durationMs:3e4}}function Yo(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:"var(--nice-bg, #fff)",stroke:"var(--nice-accent-bg, #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:"var(--nice-accent-dark, #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:"var(--nice-text-secondary, #6b7280)",lineHeight:1.4}}}]});return{id:"slide-culture",title:"Culture & Values",layout:"titleContent",background:{type:"solid",color:"var(--nice-accent-bg, #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:"var(--nice-accent-dark, #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:"var(--nice-accent, #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:"var(--nice-text, #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 Xo(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:`👤
103
+ ${n.name}
104
+ ${n.role}`,style:{fontSize:14,color:"var(--nice-text, #374151)",textAlign:"center",lineHeight:1.6}},animation:{effect:"zoomIn",durationMs:300,delayMs:400+i*80}}});return{id:"slide-team",title:"Meet the Team",layout:"titleContent",background:{type:"solid",color:"var(--nice-success-bg, #f0fdf4)"},elements:[{id:"team-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:`Meet Team ${e.team.name} 👋`,style:{fontSize:44,fontWeight:700,color:"var(--nice-success-dark, #166534)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"team-desc",type:"text",position:{x:5,y:18,width:90,height:12,unit:"percent"},content:{type:"text",text:e.team.description,style:{fontSize:20,color:"var(--nice-text, #374151)",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},...e.newHire.manager?[{id:"team-manager",type:"text",position:{x:5,y:32,width:45,height:6,unit:"percent"},content:{type:"text",text:`📋 Manager: ${e.newHire.manager}`,style:{fontSize:18,color:"var(--nice-success, #059669)"}}}]:[],...e.newHire.buddy?[{id:"team-buddy",type:"text",position:{x:50,y:32,width:45,height:6,unit:"percent"},content:{type:"text",text:`🤝 Onboarding Buddy: ${e.newHire.buddy}`,style:{fontSize:18,color:"var(--nice-success, #059669)"}}}]:[],...t],notes:"Introduce team members. Share their roles and how to reach them.",durationMs:9e4}}function Go(e){const t=e.tools.filter(r=>r.priority==="essential"),n=e.tools.filter(r=>r.priority==="recommended"),i=t.slice(0,4).map((r,a)=>({id:`tool-essential-${a}`,type:"text",position:{x:5,y:28+a*10,width:44,height:8,unit:"percent"},content:{type:"text",text:`${r.icon||"🔧"} ${r.name} - ${r.purpose}`,style:{fontSize:16,color:"var(--nice-text, #374151)",lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:300,delayMs:400+a*100}})),o=n.slice(0,4).map((r,a)=>({id:`tool-recommended-${a}`,type:"text",position:{x:52,y:28+a*10,width:44,height:8,unit:"percent"},content:{type:"text",text:`${r.icon||"📦"} ${r.name} - ${r.purpose}`,style:{fontSize:16,color:"var(--nice-text-secondary, #6b7280)",lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+a*100}}));return{id:"slide-tools",title:"Tools & Access",layout:"twoColumn",background:{type:"solid",color:"var(--nice-primary-bg, #f0f9ff)"},elements:[{id:"tools-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"🛠️ Tools & Access",style:{fontSize:44,fontWeight:700,color:"var(--nice-primary-dark, #1e40af)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"tools-essential-header",type:"text",position:{x:5,y:18,width:44,height:8,unit:"percent"},content:{type:"text",text:"⭐ Essential (Day 1)",style:{fontSize:22,fontWeight:600,color:"var(--nice-primary-dark, #1d4ed8)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"tools-recommended-header",type:"text",position:{x:52,y:18,width:44,height:8,unit:"percent"},content:{type:"text",text:"📦 Recommended",style:{fontSize:22,fontWeight:600,color:"var(--nice-primary, #3b82f6)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},...i,...o,{id:"tools-note",type:"text",position:{x:5,y:85,width:90,height:8,unit:"percent"},content:{type:"text",text:"💡 IT will help set up your accounts. Contact IT Support if you have issues.",style:{fontSize:16,color:"var(--nice-text-secondary, #6b7280)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:1e3}}],notes:"Review all tools needed for day 1. Ensure access is set up.",durationMs:6e4}}function Jo(e){const t=e.firstTasks.slice(0,5).flatMap((n,i)=>[{id:`day-header-${i}`,type:"text",position:{x:5+i*19,y:22,width:17,height:8,unit:"percent"},content:{type:"text",text:`Day ${n.day}`,style:{fontSize:20,fontWeight:700,color:"var(--nice-accent-dark, #6d28d9)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200+i*100}},{id:`day-card-${i}`,type:"shape",position:{x:5+i*19,y:32,width:17,height:58,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:"var(--nice-bg, #fff)",stroke:"var(--nice-accent-bg, #e9d5ff)",strokeWidth:1,cornerRadius:8},animation:{effect:"slideInUp",durationMs:400,delayMs:300+i*100}},...n.tasks.slice(0,4).map((o,r)=>({id:`task-${i}-${r}`,type:"text",position:{x:6+i*19,y:35+r*12,width:15,height:10,unit:"percent"},content:{type:"text",text:`☐ ${o.task}`,style:{fontSize:11,color:"var(--nice-text, #374151)",lineHeight:1.3}}}))]);return{id:"slide-firstweek",title:"First Week",layout:"titleContent",background:{type:"solid",color:"var(--nice-accent-bg, #faf5ff)"},elements:[{id:"firstweek-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:"📅 Your First Week",style:{fontSize:44,fontWeight:700,color:"var(--nice-accent-dark, #6d28d9)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Walk through first week schedule. Be realistic about expectations.",durationMs:9e4}}function Zo(e){const t=[];let n=0;return e.contacts.hr&&(t.push({id:"contact-hr",type:"text",position:{x:5+n*32,y:45,width:29,height:25,unit:"percent"},content:{type:"text",text:`👥 HR
105
+ ${e.contacts.hr.name}
106
+ ${e.contacts.hr.email}`,style:{fontSize:18,color:"var(--nice-text, #374151)",textAlign:"center",lineHeight:1.8}},animation:{effect:"zoomIn",durationMs:400,delayMs:400}}),n++),e.contacts.it&&(t.push({id:"contact-it",type:"text",position:{x:5+n*32,y:45,width:29,height:25,unit:"percent"},content:{type:"text",text:`💻 IT Support
107
+ ${e.contacts.it.name}
108
+ ${e.contacts.it.email}`,style:{fontSize:18,color:"var(--nice-text, #374151)",textAlign:"center",lineHeight:1.8}},animation:{effect:"zoomIn",durationMs:400,delayMs:500}}),n++),e.contacts.facilities&&t.push({id:"contact-facilities",type:"text",position:{x:5+n*32,y:45,width:29,height:25,unit:"percent"},content:{type:"text",text:`🏢 Facilities
109
+ ${e.contacts.facilities.name}
110
+ ${e.contacts.facilities.email}`,style:{fontSize:18,color:"var(--nice-text, #374151)",textAlign:"center",lineHeight:1.8}},animation:{effect:"zoomIn",durationMs:400,delayMs:600}}),{id:"slide-contacts",title:"Key Contacts",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"var(--nice-accent, #7c3aed)",position:0},{color:"var(--nice-accent, #8b5cf6)",position:100}],gradientDirection:180},elements:[{id:"contacts-title",type:"text",position:{x:5,y:10,width:90,height:12,unit:"percent"},content:{type:"text",text:"📞 Key Contacts",style:{fontSize:44,fontWeight:700,color:"var(--nice-bg, #fff)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"contacts-subtitle",type:"text",position:{x:10,y:25,width:80,height:10,unit:"percent"},content:{type:"text",text:"Your go-to people for help",style:{fontSize:24,color:"var(--nice-accent-bg, #ddd6fe)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},...t,{id:"contacts-welcome",type:"text",position:{x:15,y:80,width:70,height:12,unit:"percent"},content:{type:"text",text:"We're excited to have you on the team! 🚀",style:{fontSize:28,fontWeight:600,color:"var(--nice-bg, #fff)",textAlign:"center"}},animation:{effect:"zoomIn",durationMs:600,delayMs:800}}],notes:"Share key contacts. Encourage asking questions.",durationMs:45e3}}function er(e){return{version:"1.0",id:`onboarding-${e.newHire.name.toLowerCase().replace(/\s+/g,"-")}`,title:`${e.newHire.name} - Welcome to ${e.company.name}`,slideSize:{width:1920,height:1080,unit:"px"},slides:[Ko(e),Yo(e),Xo(e),Go(e),Jo(e),Zo(e)],theme:{colors:{primary:"var(--nice-accent, #7c3aed)",secondary:"var(--nice-success, #10b981)",background:"var(--nice-bg, #fff)",text:"var(--nice-text, #1f2937)",accent:"var(--nice-warning, #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:["onboarding","new-hire","welcome"],templateId:"onboarding-v1"}}}function tr(){return{company:{name:"TechCorp",tagline:"Building the future, together",founded:"2015"},newHire:{name:"Alex Johnson",role:"Senior Software Engineer",team:"Platform",startDate:"March 20, 2024",manager:"Sarah Chen",buddy:"Mike Rodriguez"},culture:{mission:"To empower developers worldwide with tools that make their work more productive, enjoyable, and impactful.",values:[{name:"Innovation",description:"We embrace new ideas and technologies to solve problems in creative ways.",icon:"💡"},{name:"Collaboration",description:"Great things happen when we work together. We value every voice.",icon:"🤝"},{name:"Quality",description:"We take pride in our craft and deliver excellence in everything we do.",icon:"⭐"},{name:"Growth",description:"We invest in learning and support each other's professional development.",icon:"🌱"}]},team:{name:"Platform",description:"We build and maintain the core infrastructure that powers all TechCorp products. Our focus is on reliability, scalability, and developer experience.",members:[{name:"Sarah Chen",role:"Engineering Manager"},{name:"Mike Rodriguez",role:"Staff Engineer"},{name:"Emily Park",role:"Senior Engineer"},{name:"James Wilson",role:"Senior Engineer"},{name:"Priya Sharma",role:"Engineer II"},{name:"David Kim",role:"Engineer I"}],channels:[{name:"#platform-team",purpose:"Team discussions"},{name:"#platform-oncall",purpose:"On-call coordination"}]},tools:[{name:"Slack",purpose:"Team communication",icon:"💬",priority:"essential"},{name:"GitHub",purpose:"Code repository",icon:"🐙",priority:"essential"},{name:"Jira",purpose:"Project tracking",icon:"📋",priority:"essential"},{name:"Notion",purpose:"Documentation",icon:"📝",priority:"essential"},{name:"Figma",purpose:"Design collaboration",icon:"🎨",priority:"recommended"},{name:"1Password",purpose:"Password management",icon:"🔐",priority:"recommended"},{name:"Zoom",purpose:"Video meetings",icon:"📹",priority:"recommended"}],processes:[{name:"Daily Standup",description:"15min sync every morning at 9:30am",frequency:"Daily"},{name:"Sprint Planning",description:"Plan upcoming sprint work",frequency:"Bi-weekly"},{name:"Code Review",description:"All PRs require 2 approvals",frequency:"Per PR"},{name:"1:1 with Manager",description:"Regular check-in with your manager",frequency:"Weekly"}],firstTasks:[{day:1,tasks:[{task:"Complete HR paperwork"},{task:"Set up laptop"},{task:"Join Slack channels"},{task:"Meet your buddy"}]},{day:2,tasks:[{task:"Dev environment setup"},{task:"Read team docs"},{task:"Shadow code review"},{task:"Team lunch 🍕"}]},{day:3,tasks:[{task:"First small PR"},{task:"Attend standup"},{task:"Architecture overview"},{task:"1:1 with manager"}]},{day:4,tasks:[{task:"Deep-dive session"},{task:"Continue coding"},{task:"Ask questions!"}]},{day:5,tasks:[{task:"Week 1 retro"},{task:"Set goals for week 2"},{task:"Friday demo"}]}],resources:[{category:"Engineering",items:[{name:"Engineering Handbook",url:"notion.so/engineering",description:"Our engineering practices"},{name:"Architecture Docs",url:"notion.so/architecture",description:"System design docs"}]}],contacts:{hr:{name:"Lisa Thompson",email:"lisa.t@techcorp.com"},it:{name:"IT Help Desk",email:"it-support@techcorp.com"},facilities:{name:"Office Admin",email:"facilities@techcorp.com"}}}}function nr(e){return{P1:"var(--nice-danger-dark, #dc2626)",P2:"var(--nice-warning, #f59e0b)",P3:"var(--nice-primary, #3b82f6)",P4:"var(--nice-text-secondary, #6b7280)"}[e]||"var(--nice-text-secondary, #6b7280)"}function ir(e){return{P1:"Critical",P2:"High",P3:"Medium",P4:"Low"}[e]||"Unknown"}function or(e){const t=nr(e.incident.severity);return{id:"slide-title",title:"Incident Report",layout:"titleSlide",background:{type:"solid",color:"var(--nice-text, #0f172a)"},elements:[{id:"title-badge",type:"shape",position:{x:35,y:15,width:30,height:8,unit:"percent"},content:{type:"shape",shape:"roundedRect",fill:t,cornerRadius:20},animation:{effect:"zoomIn",durationMs:400,delayMs:0}},{id:"title-severity",type:"text",position:{x:35,y:16.5,width:30,height:5,unit:"percent"},content:{type:"text",text:`${e.incident.severity} - ${ir(e.incident.severity)}`,style:{fontSize:24,fontWeight:700,color:"var(--nice-bg, #fff)",textAlign:"center"}}},{id:"title-main",type:"text",position:{x:5,y:28,width:90,height:18,unit:"percent"},content:{type:"text",text:`Incident Report:
111
+ ${e.incident.title}`,style:{fontSize:44,fontWeight:700,color:"var(--nice-bg-secondary, #f8fafc)",textAlign:"center",lineHeight:1.3}},animation:{effect:"fadeIn",durationMs:600,delayMs:200}},{id:"title-id",type:"text",position:{x:35,y:50,width:30,height:5,unit:"percent"},content:{type:"text",text:`ID: ${e.incident.id}`,style:{fontSize:18,color:"var(--nice-text-muted, #94a3b8)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:400}},{id:"title-date",type:"text",position:{x:25,y:60,width:50,height:5,unit:"percent"},content:{type:"text",text:`Date: ${e.incident.date} | Duration: ${e.incident.duration}`,style:{fontSize:20,color:"var(--nice-border, #cbd5e1)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"title-status",type:"text",position:{x:35,y:70,width:30,height:5,unit:"percent"},content:{type:"text",text:`Status: ${e.incident.status.toUpperCase()}`,style:{fontSize:22,fontWeight:600,color:e.incident.status==="resolved"?"var(--nice-success-light, #4ade80)":"var(--nice-warning-light, #fbbf24)",textAlign:"center"}},animation:{effect:"fadeIn",durationMs:400,delayMs:600}},...e.incident.commander?[{id:"title-commander",type:"text",position:{x:30,y:80,width:40,height:5,unit:"percent"},content:{type:"text",text:`Incident Commander: ${e.incident.commander}`,style:{fontSize:16,color:"var(--nice-text-secondary, #64748b)",textAlign:"center"}}}]:[]],notes:"Set the context. State severity and basic facts.",durationMs:3e4}}function rr(e){return{id:"slide-summary",title:"Executive Summary",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #0f172a)"},elements:[{id:"summary-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"Executive Summary",style:{fontSize:44,fontWeight:700,color:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"summary-what-label",type:"text",position:{x:5,y:20,width:90,height:5,unit:"percent"},content:{type:"text",text:"❓ What Happened",style:{fontSize:22,fontWeight:600,color:"var(--nice-primary-light, #60a5fa)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"summary-what",type:"text",position:{x:5,y:27,width:90,height:15,unit:"percent"},content:{type:"text",text:e.summary.whatHappened,style:{fontSize:18,color:"var(--nice-border, #cbd5e1)",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},{id:"summary-impact-label",type:"text",position:{x:5,y:45,width:90,height:5,unit:"percent"},content:{type:"text",text:"💥 Impact",style:{fontSize:22,fontWeight:600,color:"var(--nice-danger-light, #f87171)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:400}},{id:"summary-impact",type:"text",position:{x:5,y:52,width:90,height:12,unit:"percent"},content:{type:"text",text:e.summary.impact,style:{fontSize:18,color:"var(--nice-border, #cbd5e1)",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"summary-resolution-label",type:"text",position:{x:5,y:68,width:90,height:5,unit:"percent"},content:{type:"text",text:"✅ Resolution",style:{fontSize:22,fontWeight:600,color:"var(--nice-success-light, #4ade80)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:600}},{id:"summary-resolution",type:"text",position:{x:5,y:75,width:90,height:15,unit:"percent"},content:{type:"text",text:e.summary.resolution,style:{fontSize:18,color:"var(--nice-border, #cbd5e1)",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:700}}],notes:"High-level summary for executives. Keep it brief and factual.",durationMs:6e4}}function ar(e){const t={detection:"var(--nice-warning, #f59e0b)",escalation:"var(--nice-danger, #ef4444)",action:"var(--nice-primary, #3b82f6)",resolution:"var(--nice-success, #10b981)",communication:"var(--nice-accent, #8b5cf6)"},n={detection:"🔍",escalation:"🚨",action:"⚡",resolution:"✅",communication:"📢"},i=e.timeline.slice(0,10).flatMap((o,r)=>{const a=22+r*7.5,s=t[o.type]||"var(--nice-text-secondary, #6b7280)",c=n[o.type]||"•";return[{id:`timeline-time-${r}`,type:"text",position:{x:5,y:a,width:12,height:6,unit:"percent"},content:{type:"text",text:o.time,style:{fontSize:14,fontWeight:600,color:"var(--nice-text-muted, #94a3b8)"}},animation:{effect:"fadeIn",durationMs:200,delayMs:300+r*100}},{id:`timeline-dot-${r}`,type:"text",position:{x:18,y:a,width:4,height:6,unit:"percent"},content:{type:"text",text:c,style:{fontSize:16}}},{id:`timeline-event-${r}`,type:"text",position:{x:23,y:a,width:72,height:6,unit:"percent"},content:{type:"text",text:o.event,style:{fontSize:15,color:s}},animation:{effect:"slideInRight",durationMs:300,delayMs:350+r*100}}]});return{id:"slide-timeline",title:"Timeline",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #0f172a)"},elements:[{id:"timeline-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"📅 Incident Timeline",style:{fontSize:44,fontWeight:700,color:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"timeline-line",type:"shape",position:{x:20,y:22,width:.5,height:70,unit:"percent"},content:{type:"shape",shape:"rect",fill:"var(--nice-text, #334155)"},animation:{effect:"fadeIn",durationMs:300,delayMs:200}},...i,{id:"timeline-legend",type:"text",position:{x:5,y:92,width:90,height:5,unit:"percent"},content:{type:"text",text:"🔍 Detection | 🚨 Escalation | ⚡ Action | ✅ Resolution | 📢 Communication",style:{fontSize:12,color:"var(--nice-text-secondary, #64748b)",textAlign:"center"}}}],notes:"Walk through the timeline. Identify key decision points.",durationMs:12e4}}function sr(e){const t=[];let n=0;e.impact.usersAffected&&(t.push({id:"impact-users",type:"text",position:{x:5+n*24,y:25,width:22,height:20,unit:"percent"},content:{type:"text",text:`👥
112
+ ${e.impact.usersAffected}
113
+ Users Affected`,style:{fontSize:18,color:"var(--nice-danger-light, #f87171)",textAlign:"center",lineHeight:1.8}},animation:{effect:"zoomIn",durationMs:400,delayMs:300+n*100}}),n++),e.impact.revenueImpact&&(t.push({id:"impact-revenue",type:"text",position:{x:5+n*24,y:25,width:22,height:20,unit:"percent"},content:{type:"text",text:`💰
114
+ ${e.impact.revenueImpact}
115
+ Revenue Impact`,style:{fontSize:18,color:"var(--nice-warning-light, #fbbf24)",textAlign:"center",lineHeight:1.8}},animation:{effect:"zoomIn",durationMs:400,delayMs:300+n*100}}),n++),e.impact.slaViolation!==void 0&&(t.push({id:"impact-sla",type:"text",position:{x:5+n*24,y:25,width:22,height:20,unit:"percent"},content:{type:"text",text:`📋
116
+ ${e.impact.slaViolation?"Yes":"No"}
117
+ SLA Violation`,style:{fontSize:18,color:e.impact.slaViolation?"var(--nice-danger-light, #f87171)":"var(--nice-success-light, #4ade80)",textAlign:"center",lineHeight:1.8}},animation:{effect:"zoomIn",durationMs:400,delayMs:300+n*100}}),n++);const i=e.impact.affectedServices.slice(0,6).map((o,r)=>({id:`impact-svc-${r}`,type:"text",position:{x:5+r%3*32,y:55+Math.floor(r/3)*10,width:30,height:8,unit:"percent"},content:{type:"text",text:`⚠️ ${o}`,style:{fontSize:16,color:"var(--nice-danger-light, #f87171)"}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+r*80}}));return{id:"slide-impact",title:"Impact Assessment",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #0f172a)"},elements:[{id:"impact-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"💥 Impact Assessment",style:{fontSize:44,fontWeight:700,color:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t,{id:"impact-services-label",type:"text",position:{x:5,y:48,width:90,height:6,unit:"percent"},content:{type:"text",text:"Affected Services",style:{fontSize:22,fontWeight:600,color:"var(--nice-text-muted, #94a3b8)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},...i,...e.impact.dataLoss?[{id:"impact-dataloss",type:"text",position:{x:5,y:80,width:90,height:10,unit:"percent"},content:{type:"text",text:`📊 Data Loss: ${e.impact.dataLoss}`,style:{fontSize:18,color:"var(--nice-danger-light, #f87171)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:900}}]:[]],notes:"Quantify the impact. Be specific about affected users and services.",durationMs:6e4}}function cr(e){const t=e.rootCause.contributing.slice(0,4).map((n,i)=>({id:`contributing-${i}`,type:"text",position:{x:5,y:68+i*7,width:90,height:6,unit:"percent"},content:{type:"text",text:`• ${n}`,style:{fontSize:16,color:"var(--nice-text-muted, #94a3b8)",lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:300,delayMs:800+i*100}}));return{id:"slide-rootcause",title:"Root Cause Analysis",layout:"titleContent",background:{type:"solid",color:"var(--nice-text, #0f172a)"},elements:[{id:"rootcause-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"🔍 Root Cause Analysis",style:{fontSize:44,fontWeight:700,color:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"rootcause-immediate-label",type:"text",position:{x:5,y:18,width:90,height:5,unit:"percent"},content:{type:"text",text:"⚡ Immediate Cause",style:{fontSize:20,fontWeight:600,color:"var(--nice-danger-light, #f87171)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"rootcause-immediate",type:"text",position:{x:5,y:25,width:90,height:12,unit:"percent"},content:{type:"text",text:e.rootCause.immediate,style:{fontSize:18,color:"var(--nice-border, #cbd5e1)",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:350}},{id:"rootcause-underlying-label",type:"text",position:{x:5,y:40,width:90,height:5,unit:"percent"},content:{type:"text",text:"🎯 Underlying Root Cause",style:{fontSize:20,fontWeight:600,color:"var(--nice-warning-light, #fbbf24)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:500}},{id:"rootcause-underlying",type:"text",position:{x:5,y:47,width:90,height:12,unit:"percent"},content:{type:"text",text:e.rootCause.underlying,style:{fontSize:18,color:"var(--nice-border, #cbd5e1)",lineHeight:1.5}},animation:{effect:"fadeIn",durationMs:400,delayMs:650}},{id:"rootcause-contributing-label",type:"text",position:{x:5,y:62,width:90,height:5,unit:"percent"},content:{type:"text",text:"📋 Contributing Factors",style:{fontSize:20,fontWeight:600,color:"var(--nice-primary-light, #60a5fa)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:750}},...t],notes:"Be blameless. Focus on systems and processes, not individuals.",durationMs:9e4}}function lr(e){const t=e.remediation.immediate.slice(0,4).map((i,o)=>{const r=i.status==="done"?"✅":i.status==="in-progress"?"🔄":"📋",a=i.status==="done"?"var(--nice-success-light, #4ade80)":i.status==="in-progress"?"var(--nice-warning-light, #fbbf24)":"var(--nice-text-muted, #94a3b8)";return{id:`remediation-immediate-${o}`,type:"text",position:{x:5,y:28+o*10,width:44,height:8,unit:"percent"},content:{type:"text",text:`${r} ${i.action}
118
+ Owner: ${i.owner}`,style:{fontSize:14,color:a,lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:300,delayMs:400+o*100}}}),n=e.remediation.longTerm.slice(0,4).map((i,o)=>{const r=i.priority==="high"?"🔴":i.priority==="medium"?"🟡":"🟢";return{id:`remediation-longterm-${o}`,type:"text",position:{x:52,y:28+o*10,width:44,height:8,unit:"percent"},content:{type:"text",text:`${r} ${i.action}
119
+ Owner: ${i.owner}`,style:{fontSize:14,color:"var(--nice-border, #cbd5e1)",lineHeight:1.4}},animation:{effect:"slideInRight",durationMs:300,delayMs:600+o*100}}});return{id:"slide-remediation",title:"Remediation",layout:"twoColumn",background:{type:"solid",color:"var(--nice-text, #0f172a)"},elements:[{id:"remediation-title",type:"text",position:{x:5,y:5,width:90,height:10,unit:"percent"},content:{type:"text",text:"🔧 Remediation Actions",style:{fontSize:44,fontWeight:700,color:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},{id:"remediation-immediate-header",type:"text",position:{x:5,y:18,width:44,height:8,unit:"percent"},content:{type:"text",text:"⚡ Immediate Actions",style:{fontSize:22,fontWeight:600,color:"var(--nice-danger-light, #f87171)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:200}},{id:"remediation-longterm-header",type:"text",position:{x:52,y:18,width:44,height:8,unit:"percent"},content:{type:"text",text:"📅 Long-term Actions",style:{fontSize:22,fontWeight:600,color:"var(--nice-primary-light, #60a5fa)"}},animation:{effect:"fadeIn",durationMs:400,delayMs:300}},...t,...n,{id:"remediation-legend",type:"text",position:{x:5,y:88,width:90,height:5,unit:"percent"},content:{type:"text",text:"✅ Done | 🔄 In Progress | 📋 Planned || 🔴 High | 🟡 Medium | 🟢 Low",style:{fontSize:12,color:"var(--nice-text-secondary, #64748b)",textAlign:"center"}}}],notes:"Track action items. Ensure clear ownership and deadlines.",durationMs:6e4}}function dr(e){const t=e.lessons.slice(0,6).map((n,i)=>({id:`lesson-${i}`,type:"text",position:{x:5,y:25+i*12,width:90,height:10,unit:"percent"},content:{type:"text",text:`${i+1}. ${n}`,style:{fontSize:20,color:"var(--nice-border, #cbd5e1)",lineHeight:1.5}},animation:{effect:"slideInRight",durationMs:400,delayMs:300+i*150}}));return{id:"slide-lessons",title:"Lessons Learned",layout:"titleContent",background:{type:"gradient",gradientStops:[{color:"var(--nice-text, #0f172a)",position:0},{color:"var(--nice-primary-dark, #1E3A8A)",position:100}],gradientDirection:180},elements:[{id:"lessons-title",type:"text",position:{x:5,y:5,width:90,height:12,unit:"percent"},content:{type:"text",text:"💡 Lessons Learned",style:{fontSize:44,fontWeight:700,color:"var(--nice-bg-secondary, #f8fafc)"}},animation:{effect:"fadeIn",durationMs:500,delayMs:0}},...t],notes:"Key takeaways. Focus on actionable improvements.",durationMs:9e4}}function ur(e){return{version:"1.0",id:`incident-${e.incident.id}`,title:`Incident Report - ${e.incident.id}: ${e.incident.title}`,slideSize:{width:1920,height:1080,unit:"px"},slides:[or(e),rr(e),ar(e),sr(e),cr(e),lr(e),dr(e)],theme:{colors:{primary:"var(--nice-primary, #3b82f6)",secondary:"var(--nice-danger-light, #f87171)",background:"var(--nice-text, #0f172a)",text:"var(--nice-bg-secondary, #f8fafc)",accent:"var(--nice-success-light, #4ade80)"},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:["incident","postmortem","PIR"],templateId:"incident-report-v1"}}}function pr(){return{incident:{id:"INC-2024-0342",title:"Payment Service Outage",severity:"P1",status:"resolved",date:"March 15, 2024",duration:"2h 34m",commander:"Emily Chen"},summary:{whatHappened:"The payment processing service became unresponsive due to a database connection pool exhaustion, preventing customers from completing purchases.",impact:"Approximately 15,000 users were unable to complete transactions, resulting in an estimated revenue loss of $127,000.",resolution:"Database connection pool limits were increased, and a connection leak in the payment service was identified and fixed."},timeline:[{time:"14:23",event:"Automated alert: Payment service error rate >5%",type:"detection"},{time:"14:25",event:"On-call engineer acknowledges alert",type:"action"},{time:"14:32",event:"Incident declared, Emily Chen as IC",type:"escalation"},{time:"14:35",event:"Status page updated",type:"communication"},{time:"14:45",event:"Database team joined",type:"escalation"},{time:"15:12",event:"Root cause identified: connection pool exhaustion",type:"action"},{time:"15:28",event:"Emergency fix deployed",type:"action"},{time:"16:15",event:"Service fully recovered",type:"resolution"},{time:"16:57",event:"Incident marked resolved",type:"resolution"}],impact:{usersAffected:"~15,000",revenueImpact:"$127,000",slaViolation:!0,affectedServices:["Payment Gateway","Checkout Flow","Order Service","Mobile App"],regions:["North America","Europe"]},rootCause:{immediate:"Database connection pool was exhausted due to connections not being properly released after use.",underlying:"A recent code change introduced a connection leak in the retry logic of the payment service.",contributing:["Insufficient connection pool monitoring alerts","Code review did not catch the connection leak","No automated testing for connection handling","Documentation for database client usage was outdated"]},response:{detectionTime:"2 minutes",responseTime:"9 minutes",resolutionTime:"2h 34m",whatWorked:["Automated alerting triggered quickly","Clear incident commander assignment","Good cross-team communication"],whatDidntWork:["Initial diagnosis took too long","Runbooks were outdated","No quick rollback option available"]},remediation:{immediate:[{action:"Increase connection pool size",owner:"Platform Team",status:"done"},{action:"Fix connection leak in payment service",owner:"Payments Team",status:"done"},{action:"Add connection pool metrics to dashboard",owner:"SRE Team",status:"in-progress"}],longTerm:[{action:"Implement automated connection leak detection",owner:"Platform Team",priority:"high",dueDate:"Q2 2024"},{action:"Update code review checklist",owner:"Engineering Leads",priority:"medium",dueDate:"April 2024"},{action:"Improve runbooks for database issues",owner:"SRE Team",priority:"medium",dueDate:"April 2024"},{action:"Add integration tests for connection handling",owner:"Payments Team",priority:"high",dueDate:"Q2 2024"}]},lessons:["Connection pool monitoring should be a standard metric for all services","Code changes affecting database connections need explicit review","Having a quick rollback plan is critical for payment systems","Runbooks must be tested and updated regularly","Cross-team communication during incidents was effective and should be maintained"],team:[{name:"Emily Chen",role:"Incident Commander"},{name:"Marcus Johnson",role:"On-call Engineer"},{name:"Priya Patel",role:"Database Expert"},{name:"Alex Kim",role:"Payments Team Lead"}]}}function ut(e){return{name:e.name,primaryColor:e.colors.primary,secondaryColor:e.colors.secondary,accentColor:e.colors.accent,backgroundColor:e.colors.background,textColor:e.colors.text,headingColor:e.colors.heading,fontFamily:e.fonts.body,headingFontFamily:e.fonts.heading,codeFontFamily:e.fonts.code??"monospace",colors:e.colors.palette}}function fr(e,t){const n=ut(t),i=e.slides.map(o=>{let r=[...o.elements];if(t.logo&&!r.some(s=>s.id===`brand-logo-${t.id}`)){const s=hr(t.logo);r=[...r,{id:`brand-logo-${t.id}`,type:"image",position:s,content:{type:"image",src:t.logo.url,alt:`${t.name} logo`,objectFit:"contain"},opacity:.9}]}return{...o,elements:r}});return{...e,theme:n,slides:i,metadata:{...e.metadata,updatedAt:new Date().toISOString()}}}function mr(e,t){const n=e.slides.map(i=>({...i,elements:i.elements.filter(o=>o.id!==`brand-logo-${t}`)}));return{...e,slides:n,metadata:{...e.metadata,updatedAt:new Date().toISOString()}}}function hr(e){const t=e.width??8,n=e.height??5,i=e.position??"bottom-right",o={"top-left":{x:2,y:2},"top-right":{x:90,y:2},"bottom-left":{x:2,y:93},"bottom-right":{x:90,y:93}},{x:r,y:a}=o[i];return{x:r,y:a,width:t,height:n,unit:"percent"}}const yr={id:"nice2dev",name:"NiceToDev",colors:{primary:"var(--nice-info, #6366f1)",secondary:"var(--nice-accent, #8b5cf6)",accent:"var(--nice-info, #06b6d4)",background:"var(--nice-text, #0f172a)",text:"var(--nice-border, #e2e8f0)",heading:"var(--nice-bg, #fff)",palette:["var(--nice-info, #6366f1)","var(--nice-accent, #8b5cf6)","var(--nice-info, #06b6d4)","var(--nice-success, #10b981)","var(--nice-warning, #f59e0b)"]},fonts:{heading:"Inter, sans-serif",body:"Inter, sans-serif",code:"JetBrains Mono, monospace"}},gr={id:"corporate",name:"Corporate Blue",colors:{primary:"var(--nice-primary-dark, #1a365d)",secondary:"var(--nice-primary, #2b6cb0)",accent:"var(--nice-warning, #ed8936)",background:"var(--nice-bg, #fff)",text:"var(--nice-bg-secondary, #2d3748)",heading:"var(--nice-primary-dark, #1a365d)",palette:["var(--nice-primary-dark, #1a365d)","var(--nice-primary, #2b6cb0)","#4299E1","var(--nice-warning, #ed8936)","#48BB78"]},fonts:{heading:"Georgia, serif",body:"Arial, sans-serif",code:"Consolas, monospace"}},xr={id:"startup",name:"Startup Fresh",colors:{primary:"var(--nice-accent, #7c3aed)",secondary:"var(--nice-accent-pink, #ec4899)",accent:"var(--nice-success-light, #34d399)",background:"var(--nice-bg-secondary, #fafafa)",text:"var(--nice-text, #374151)",heading:"var(--nice-text, #111827)",palette:["var(--nice-accent, #7c3aed)","var(--nice-accent-pink, #ec4899)","var(--nice-success-light, #34d399)","var(--nice-warning, #f59e0b)","var(--nice-primary, #3b82f6)"]},fonts:{heading:"Poppins, sans-serif",body:"Open Sans, sans-serif",code:"Fira Code, monospace"}};class pt{constructor(t,n={}){this.currentAnimation=null,this.frameIndex=0,this.elapsed=0,this.playing=!1,this.loop=!0,this.speed=1,this.onComplete=null,this.onEvent=null,this.character=t,this.onComplete=n.onAnimationComplete||null,this.onEvent=n.onFrameEvent||null}getCharacter(){return this.character}getCurrentAnimation(){return this.currentAnimation}getCurrentFrameIndex(){return this.frameIndex}isPlaying(){return this.playing}play(t,n={}){const i=this.character.animations.find(o=>o.id===t);if(!i){console.warn(`Animation "${t}" not found on character "${this.character.id}"`);return}this.currentAnimation=i,this.frameIndex=n.startFrame??0,this.elapsed=0,this.playing=!0,this.loop=n.loop??i.loop,this.speed=n.speed??1,this.checkFrameEvent()}stop(){this.playing=!1}pause(){this.playing=!1}resume(){this.currentAnimation&&(this.playing=!0)}setSpeed(t){this.speed=t}update(t){if(!this.playing||!this.currentAnimation)return;const n=this.currentAnimation,i=n.frames[this.frameIndex];if(!i)return;const o=1e3/n.fps,r=i.duration??o;for(this.elapsed+=t*this.speed;this.elapsed>=r&&this.playing;){if(this.elapsed-=r,this.frameIndex++,this.frameIndex>=n.frames.length)if(this.loop)this.frameIndex=0;else{this.frameIndex=n.frames.length-1,this.playing=!1,this.onComplete&&this.onComplete(n.id);return}this.checkFrameEvent()}}checkFrameEvent(){if(!this.currentAnimation||!this.onEvent)return;const t=this.currentAnimation.frames[this.frameIndex];t!=null&&t.event&&this.onEvent(this.currentAnimation.id,t.event)}getCurrentFrame(){return this.currentAnimation?this.currentAnimation.frames[this.frameIndex]??null:null}getSpriteRect(){const t=this.getCurrentFrame();if(!t||!this.character.visual.atlas)return null;const i=this.character.visual.atlas.frames[t.frameId];return i?i.frame:null}}function vr(e,t,n,i,o){if(!o.visible||o.opacity===0||!i.getCurrentFrame())return;const a=i.getSpriteRect();if(!a)return;const{position:s,scale:c,rotation:d,opacity:p,flipX:m}=o,{anchor:y}=t;e.save(),e.translate(s.x,s.y),e.scale(m?-c:c,c),e.rotate(d*Math.PI/180),e.globalAlpha=p;const f=-y.x*a.w,x=-y.y*a.h;e.drawImage(n,a.x,a.y,a.w,a.h,f,x,a.w,a.h),e.restore()}function br({character:e,state:t,spriteSheet:n,className:i,style:o}){const[r,a]=l.useState(null);if(l.useEffect(()=>{if(!e.visual.atlas)return;const g=e.animations.find(h=>h.id===t.currentAnimation);if(!g)return;const b=g.frames[t.animationFrame];if(!b)return;const S=e.visual.atlas.frames[b.frameId];a(S||null)},[e,t.currentAnimation,t.animationFrame]),!t.visible||!r)return null;const{position:s,scale:c,rotation:d,opacity:p,flipX:m}=t,{frame:y}=r,f={position:"absolute",left:s.x,top:s.y,transform:`
120
+ translate(-${e.anchor.x*100}%, -${e.anchor.y*100}%)
121
+ scale(${m?-c:c}, ${c})
122
+ rotate(${d}deg)
123
+ `,opacity:p,transformOrigin:`${e.anchor.x*100}% ${e.anchor.y*100}%`,pointerEvents:"none",...o},x={width:y.w,height:y.h,backgroundImage:n?`url(${n.src})`:`url(${e.visual.spriteSheet})`,backgroundPosition:`-${y.x}px -${y.y}px`,backgroundRepeat:"no-repeat"};return l.createElement("div",{className:i,style:f},l.createElement("div",{style:x}))}class $e{constructor(){this.characters=new Map,this.spriteSheets=new Map,this.loadingPromises=new Map}register(t){this.characters.set(t.id,t)}unregister(t){this.characters.delete(t),this.spriteSheets.delete(t)}get(t){return this.characters.get(t)}getAll(){return Array.from(this.characters.values())}async loadSpriteSheet(t){const n=this.spriteSheets.get(t);if(n)return n;const i=this.loadingPromises.get(t);if(i)return i;const o=this.characters.get(t);if(!(o!=null&&o.visual.spriteSheet))throw new Error(`Character ${t} has no sprite sheet`);const r=new Promise((a,s)=>{const c=new Image;c.onload=()=>{this.spriteSheets.set(t,c),this.loadingPromises.delete(t),a(c)},c.onerror=()=>{this.loadingPromises.delete(t),s(new Error(`Failed to load sprite sheet for ${t}`))},c.src=o.visual.spriteSheet});return this.loadingPromises.set(t,r),r}getSpriteSheet(t){return this.spriteSheets.get(t)}}function Sr(e,t={}){const n=l.useRef(null),[i,o]=l.useState(0),[r,a]=l.useState(!1),[s,c]=l.useState(null);n.current||(n.current=new pt(e,{...t,onAnimationComplete:f=>{var x;(x=t.onAnimationComplete)==null||x.call(t,f),a(!1)},onFrameEvent:t.onFrameEvent})),l.useEffect(()=>{let f,x=performance.now();const g=b=>{const S=b-x;x=b,n.current&&(n.current.update(S),o(n.current.getCurrentFrameIndex()),c(n.current.getCurrentFrame()),a(n.current.isPlaying())),f=requestAnimationFrame(g)};return f=requestAnimationFrame(g),()=>{cancelAnimationFrame(f)}},[]);const d=l.useCallback((f,x)=>{var g;(g=n.current)==null||g.play(f,x),a(!0)},[]),p=l.useCallback(()=>{var f;(f=n.current)==null||f.stop(),a(!1)},[]),m=l.useCallback(()=>{var f;(f=n.current)==null||f.pause(),a(!1)},[]),y=l.useCallback(()=>{var f;(f=n.current)==null||f.resume(),a(!0)},[]);return{controller:n.current,currentFrame:s,frameIndex:i,isPlaying:r,play:d,stop:p,pause:m,resume:y}}function wr(){const e=l.useRef(null);e.current||(e.current=new $e);const t=l.useCallback(o=>{var r;(r=e.current)==null||r.register(o)},[]),n=l.useCallback(o=>{var r;return(r=e.current)==null?void 0:r.get(o)},[]),i=l.useCallback(o=>e.current.loadSpriteSheet(o),[]);return{registry:e.current,register:t,get:n,loadSpriteSheet:i}}function kr(e,t,n,i,o,r,a){const s={};for(let c=0;c<r;c++){const d=c%a,p=Math.floor(c/a);s[`frame_${c}`]={frame:{x:d*i,y:p*o,w:i,h:o},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:i,h:o},sourceSize:{w:i,h:o}}}return{id:e,name:t,type:"sprite",visual:{type:"sprite",spriteSheet:n,atlas:{frames:s,meta:{image:n,size:{w:a*i,h:Math.ceil(r/a)*o},scale:1}},width:i,height:o},animations:[],expressions:[],defaultScale:1,anchor:{x:.5,y:1}}}function Ir(e,t,n,i,o,r,a="custom"){const s=i.map(p=>({frameId:p})),c=s.length/o*1e3,d={id:t,name:n,category:a,frames:s,fps:o,loop:r,duration:c};return{...e,animations:[...e.animations,d]}}function Cr(e,t,n,i,o,r){const a={id:t,name:n,emotion:i,frameId:o,overlay:r};return{...e,expressions:[...e.expressions,a]}}const Mr=l.createContext(null);function Ar(){const e=l.useContext(Mr);if(!e)throw new Error("usePuppetStage must be used within PuppetStageProvider");return e}function ft({background:e,width:t,height:n}){const i={position:"absolute",top:0,left:0,width:t,height:n,overflow:"hidden"};switch(e.type){case"solid":return l.createElement("div",{style:{...i,backgroundColor:e.color||"var(--nice-text, #000000)"}});case"gradient":{const o=e.gradient;if(!o)return l.createElement("div",{style:{...i,backgroundColor:"var(--nice-text, #000000)"}});const r=o.stops.map(s=>`${s.color} ${s.position*100}%`).join(", "),a=o.type==="radial"?`radial-gradient(circle, ${r})`:`linear-gradient(${o.angle||180}deg, ${r})`;return l.createElement("div",{style:{...i,background:a}})}case"image":return l.createElement("div",{style:{...i,backgroundImage:`url(${e.image})`,backgroundSize:"cover",backgroundPosition:"center"}});case"video":return l.createElement("div",{style:i},l.createElement("video",{src:e.video,autoPlay:!0,loop:!0,muted:!0,style:{width:"100%",height:"100%",objectFit:"cover"}}));case"parallax":{const o=e.parallaxLayers||[];return l.createElement("div",{style:i},o.map((r,a)=>{var s,c;return l.createElement("div",{key:a,style:{position:"absolute",top:((s=r.offset)==null?void 0:s.y)||0,left:((c=r.offset)==null?void 0:c.x)||0,width:"100%",height:"100%",backgroundImage:`url(${r.image})`,backgroundRepeat:r.repeat?"repeat-x":"no-repeat",backgroundSize:"auto 100%"}})}))}default:return l.createElement("div",{style:{...i,backgroundColor:"var(--nice-text, #000000)"}})}}function mt({effects:e,width:t,height:n}){return e.length===0?null:l.createElement(l.Fragment,null,e.map(i=>{const{effectId:o,type:r,params:a,progress:s}=i;switch(r){case"flash":return l.createElement("div",{key:o,style:{position:"absolute",top:0,left:0,width:t,height:n,backgroundColor:a.color||"var(--nice-bg, #fff)",opacity:1-s,pointerEvents:"none"}});case"vignette":return l.createElement("div",{key:o,style:{position:"absolute",top:0,left:0,width:t,height:n,background:`radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,${a.intensity||.5}) 100%)`,pointerEvents:"none"}});case"colorFilter":return l.createElement("div",{key:o,style:{position:"absolute",top:0,left:0,width:t,height:n,backgroundColor:a.color,opacity:a.intensity||.3,mixBlendMode:a.blendMode||"multiply",pointerEvents:"none"}});case"fog":return l.createElement("div",{key:o,style:{position:"absolute",top:0,left:0,width:t,height:n,background:`linear-gradient(to top, rgba(200,200,200,${a.density||.5}) 0%, transparent 70%)`,pointerEvents:"none"}});default:return null}}))}function ht({document:e,scene:t,characterStates:n,camera:i,activeEffects:o,characterRegistry:r,className:a,style:s,onCharacterClick:c}){const d=l.useRef(null),[p,m]=l.useState({width:0,height:0}),y=l.useMemo(()=>{if(p.width===0||p.height===0)return 1;const S=p.width/e.stageSize.width,h=p.height/e.stageSize.height;return Math.min(S,h)},[p,e.stageSize]);l.useEffect(()=>{const S=d.current;if(!S)return;const h=new ResizeObserver(I=>{const R=I[0];R&&m({width:R.contentRect.width,height:R.contentRect.height})});return h.observe(S),()=>h.disconnect()},[]);const f=e.stageSize.width,x=e.stageSize.height,g=l.useMemo(()=>{const{position:S,zoom:h,rotation:I}=i,R=f/2,z=x/2,F=R-S.x,Q=z-S.y;return`translate(${F}px, ${Q}px) scale(${h}) rotate(${I}deg)`},[i,f,x]),b=l.useMemo(()=>{const S=[];return t.cast.forEach(h=>{S.push({type:"character",data:h,zIndex:h.zIndex})}),t.scenery.forEach(h=>{S.push({type:"prop",data:h,zIndex:h.zIndex})}),S.sort((h,I)=>h.zIndex-I.zIndex)},[t.cast,t.scenery]);return l.createElement("div",{ref:d,className:a,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",backgroundColor:"var(--nice-text, #000000)",...s}},l.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",width:f,height:x,transform:`translate(-50%, -50%) scale(${y})`,transformOrigin:"center center"}},l.createElement("div",{style:{position:"absolute",top:0,left:0,width:f,height:x,transform:g,transformOrigin:"center center"}},l.createElement(ft,{background:t.background,width:f,height:x}),b.map(({type:S,data:h})=>{if(S==="character"){const I=h,R=n.get(I.instanceId);if(!R||!R.visible)return null;const z=e.characters.find(F=>F.id===I.characterId);return z?l.createElement($r,{key:I.instanceId,characterDef:z,state:R,onClick:c?()=>c(I.instanceId):void 0}):null}else{const I=h,R=e.props.find(z=>z.id===I.propId);return R?l.createElement(_r,{key:I.instanceId,propDef:R,state:I}):null}}),l.createElement(mt,{effects:o,width:f,height:x}))))}function $r({characterDef:e,state:t,onClick:n}){const{position:i,scale:o,rotation:r,opacity:a,flipX:s,currentAnimation:c,animationFrame:d}=t,p=l.useMemo(()=>{const x=e.animations.find(b=>b.id===c);if(!x)return null;const g=x.frames[d];return!g||!e.visual.atlas?null:e.visual.atlas.frames[g.frameId]},[e,c,d]);if(!p)return null;const{frame:m}=p,y={position:"absolute",left:i.x,top:i.y,transform:`
124
+ translate(-${e.anchor.x*100}%, -${e.anchor.y*100}%)
125
+ scale(${s?-o:o}, ${o})
126
+ rotate(${r}deg)
127
+ `,opacity:a,transformOrigin:`${e.anchor.x*100}% ${e.anchor.y*100}%`,cursor:n?"pointer":"default"},f={width:m.w,height:m.h,backgroundImage:`url(${e.visual.spriteSheet})`,backgroundPosition:`-${m.x}px -${m.y}px`,backgroundRepeat:"no-repeat"};return l.createElement("div",{style:y,onClick:n},l.createElement("div",{style:f}))}function _r({propDef:e,state:t}){const{position:n,scale:i,rotation:o,opacity:r}=t,a={position:"absolute",left:n.x,top:n.y,transform:`
128
+ translate(-${e.anchor.x*100}%, -${e.anchor.y*100}%)
129
+ scale(${i})
130
+ rotate(${o}deg)
131
+ `,opacity:r,transformOrigin:`${e.anchor.x*100}% ${e.anchor.y*100}%`};return e.type==="image"||e.type==="sprite"?l.createElement("img",{src:e.asset,style:{...a,width:e.width,height:e.height,pointerEvents:"none"},alt:e.name}):e.type==="vector"?l.createElement("div",{style:a,dangerouslySetInnerHTML:{__html:e.asset}}):e.type==="text"?l.createElement("div",{style:a},e.asset):l.createElement("div",{style:a})}function yt({text:e,speakerName:t,style:n={},targetPosition:i,visible:o,typewriterProgress:r=1}){if(!o)return null;const{position:a="bottom",backgroundColor:s="var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",textColor:c="var(--nice-bg, #fff)",fontSize:d=18,maxWidth:p=600}=n,m=e.slice(0,Math.floor(e.length*r)),y={position:"absolute",maxWidth:p,padding:"16px 24px",backgroundColor:s,color:c,fontSize:d,borderRadius:12,boxShadow:"0 4px 20px var(--nice-overlay-30, rgba(0, 0, 0, 0.3))",zIndex:1e3};switch(a){case"bottom":Object.assign(y,{bottom:20,left:"50%",transform:"translateX(-50%)",width:"90%"});break;case"top":Object.assign(y,{top:20,left:"50%",transform:"translateX(-50%)",width:"90%"});break;case"center":Object.assign(y,{top:"50%",left:"50%",transform:"translate(-50%, -50%)"});break;case"bubble":i&&Object.assign(y,{left:i.x,bottom:i.y+20,transform:"translateX(-50%)"});break}return l.createElement("div",{style:y},t&&l.createElement("div",{style:{fontWeight:"bold",marginBottom:8,color:"var(--nice-primary-light, #60a5fa)"}},t),l.createElement("div",null,m))}function zr(e,t,n){const[i,o]=l.useState({offsetX:0,offsetY:0}),r=l.useRef(null);return l.useEffect(()=>{if(!n){o({offsetX:0,offsetY:0});return}r.current=performance.now();let a;const s=c=>{const d=c-r.current;if(d>=t){o({offsetX:0,offsetY:0});return}const m=1-d/t,y=(Math.random()-.5)*2*e*m,f=(Math.random()-.5)*2*e*m;o({offsetX:y,offsetY:f}),a=requestAnimationFrame(s)};return a=requestAnimationFrame(s),()=>{cancelAnimationFrame(a)}},[n,e,t]),i}const le={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-le.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?le.easeInBounce(e*2)*.5:le.easeOutBounce(e*2-1)*.5+.5,step:e=>Math.round(e)};function gt(e){return le[e]||le.linear}function re(e,t,n){return e+(t-e)*n}function ke(e,t,n){return{x:re(e.x,t.x,n),y:re(e.y,t.y,n)}}class xt{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 y=0;y<i.length&&i[y].time<=n;y++)o=y;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,d=s>0?c/s:0,m=gt(r.easing||"linear")(Math.min(1,Math.max(0,d)));return{prev:r,next:a,progress:m}}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),d=Math.floor(c/1e3*s.fps)%s.frames.length;r.animationFrame=d}}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?ke(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?ke(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 Tr{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 Rr{constructor(t,n,i){this.scene={id:t,title:n,duration:i,background:{type:"solid",color:"var(--nice-text, #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 Er(e){return JSON.parse(JSON.stringify(e))}function vt(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 Pr(e){let t=0;for(const n of e.timeline){const i=vt(n);i>t&&(t=i)}return Math.max(e.duration,t)}function Nr(e,t){return Math.floor(e/1e3*t)}function Dr(e,t){return e/t*1e3}function Or(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 Fr(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 bt=l.createContext(null);function jr(){const e=l.useContext(bt);if(!e)throw new Error("usePuppetPlayer must be used within PuppetPlayerProvider");return e}class qr{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 St(e){const{document:t,autoPlay:n=!1,loop:i=!1,initialVolume:o=1,initialSpeed:r=1}=e,[a,s]=l.useState({isPlaying:!1,isPaused:!1,currentSceneIndex:0,currentTime:0,totalDuration:0,playbackSpeed:r,volume:o,isMuted:!1,characterStates:new Map,activeEffects:[],loop:i}),[c,d]=l.useState(null),p=l.useRef(null),m=l.useRef(0),y=l.useRef(new qr),f=l.useRef(null),x=l.useRef(new $e),g=l.useMemo(()=>t.scenes.reduce((w,v)=>w+v.duration,0),[t.scenes]),b=l.useMemo(()=>t.scenes[a.currentSceneIndex]||null,[t.scenes,a.currentSceneIndex]);l.useEffect(()=>{b&&(f.current=new xt({scene:b,characterDefs:t.characters,onAudioCommand:(w,v,A)=>{const O=y.current;switch(v){case"play":O.play(w,A);break;case"pause":O.pause(w);break;case"stop":O.stop(w);break}}}))},[b,t.characters]),l.useEffect(()=>{var v;const w=y.current;return(v=t.audioTracks)==null||v.forEach(A=>{A.src&&w.preloadAudio(A.id,A.src).catch(()=>{})}),()=>{w.dispose()}},[t.audioTracks]);const S=l.useCallback(w=>{if(!f.current)return;const v=w-m.current;m.current=w,s(A=>{var L,X,Z;if(!A.isPlaying||A.isPaused)return A;const O=A.currentTime+v*A.playbackSpeed,$=(b==null?void 0:b.duration)??0;if(O>=$){const _=A.currentSceneIndex+1;return _>=t.scenes.length?A.loop?((L=e.onSceneChange)==null||L.call(e,0,t.scenes[0]),{...A,currentSceneIndex:0,currentTime:0}):((X=e.onEnd)==null||X.call(e),{...A,isPlaying:!1,isPaused:!1,currentTime:$}):((Z=e.onSceneChange)==null||Z.call(e,_,t.scenes[_]),{...A,currentSceneIndex:_,currentTime:0})}return{...A,currentTime:O}}),p.current=requestAnimationFrame(S)},[b,t.scenes,e]);l.useEffect(()=>(a.isPlaying&&!a.isPaused?(m.current=performance.now(),p.current=requestAnimationFrame(S)):p.current&&cancelAnimationFrame(p.current),()=>{p.current&&cancelAnimationFrame(p.current)}),[a.isPlaying,a.isPaused,S]),l.useEffect(()=>{if(f.current){const w=f.current.evaluate(a.currentTime);d(w),w.audioCommands.forEach(v=>{const A=y.current;switch(v.command){case"play":A.play(v.trackId);break;case"pause":A.pause(v.trackId);break;case"stop":A.stop(v.trackId);break}}),s(v=>({...v,characterStates:w.characterStates,activeEffects:w.activeEffects}))}},[a.currentTime]),l.useEffect(()=>{n&&s(w=>({...w,isPlaying:!0}))},[n]);const h=l.useCallback(()=>{s(w=>({...w,isPlaying:!0,isPaused:!1}))},[]),I=l.useCallback(()=>{s(w=>({...w,isPaused:!0})),y.current.stopAll()},[]),R=l.useCallback(()=>{s(w=>({...w,isPlaying:!1,isPaused:!1,currentTime:0,currentSceneIndex:0})),y.current.stopAll()},[]),z=l.useCallback(w=>{s(v=>({...v,currentTime:Math.max(0,Math.min(w,(b==null?void 0:b.duration)??0))}))},[b]),F=l.useCallback(w=>{var v;w>=0&&w<t.scenes.length&&(y.current.stopAll(),s(A=>({...A,currentSceneIndex:w,currentTime:0})),(v=e.onSceneChange)==null||v.call(e,w,t.scenes[w]))},[t.scenes,e]),Q=l.useCallback(w=>{s(v=>({...v,playbackSpeed:Math.max(.25,Math.min(4,w))}))},[]),T=l.useCallback(w=>{const v=Math.max(0,Math.min(1,w));y.current.setVolume(v),s(A=>({...A,volume:v}))},[]),P=l.useCallback(()=>{s(w=>{const v=!w.isMuted;return y.current.setMuted(v),{...w,isMuted:v}})},[]),q=l.useCallback(()=>{F(a.currentSceneIndex+1)},[a.currentSceneIndex,F]),N=l.useCallback(()=>{F(a.currentSceneIndex-1)},[a.currentSceneIndex,F]),C=l.useCallback(w=>{s(v=>({...v,loop:w}))},[]);return{playerState:{...a,totalDuration:g},timelineState:c,characterRegistry:x.current,play:h,pause:I,stop:R,seek:z,seekToScene:F,setPlaybackSpeed:Q,setVolume:T,toggleMute:P,nextScene:q,previousScene:N,setLoop:C}}function wt({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:d,characterRegistry:p,play:m,pause:y,stop:f,seek:x,seekToScene:g,setPlaybackSpeed:b,setVolume:S,toggleMute:h,nextScene:I,previousScene:R,setLoop:z}=St({document:e,autoPlay:t,loop:n,onSceneChange:a,onEnd:s}),F=e.scenes[c.currentSceneIndex];return F?l.createElement(bt.Provider,{value:{document:e,playerState:c,play:m,pause:y,stop:f,seek:x,seekToScene:g,setPlaybackSpeed:b,setVolume:S,toggleMute:h,nextScene:I,previousScene:R,setLoop:z}},l.createElement("div",{className:o,style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",backgroundColor:"var(--nice-text, #000)",...r}},l.createElement("div",{style:{flex:1,position:"relative"}},l.createElement(ht,{document:e,scene:F,characterStates:c.characterStates,camera:(d==null?void 0:d.camera)??F.camera??{position:{x:640,y:360},zoom:1,rotation:0},activeEffects:c.activeEffects,characterRegistry:p}),(d==null?void 0:d.activeDialogue)&&l.createElement(yt,{text:d.activeDialogue.text,speakerName:(Q=e.characters.find(T=>{var P;return T.id===((P=d.activeDialogue)==null?void 0:P.speakerId)}))==null?void 0:Q.name,visible:!0,typewriterProgress:d.activeDialogue.typewriterProgress})),i&&l.createElement(Lr,{playerState:c,currentScene:F,totalScenes:e.scenes.length,onPlay:m,onPause:y,onStop:f,onSeek:x,onPreviousScene:R,onNextScene:I,onSpeedChange:b,onVolumeChange:S,onToggleMute:h,onToggleLoop:()=>z(!c.loop)}))):l.createElement("div",{className:o,style:r},"No scenes")}function Lr({playerState:e,currentScene:t,totalScenes:n,onPlay:i,onPause:o,onStop:r,onSeek:a,onPreviousScene:s,onNextScene:c,onSpeedChange:d,onVolumeChange:p,onToggleMute:m,onToggleLoop:y}){const f=h=>{const I=Math.floor(h/1e3),R=Math.floor(I/60),z=I%60;return`${R}:${z.toString().padStart(2,"0")}`},x=t.duration>0?e.currentTime/t.duration*100:0,g={display:"flex",alignItems:"center",gap:8,padding:"12px 16px",backgroundColor:"var(--nice-overlay-90, rgba(0, 0, 0, 0.9))",color:"var(--nice-bg, #fff)"},b={background:"none",border:"none",color:"var(--nice-bg, #fff)",cursor:"pointer",padding:"8px",fontSize:16,opacity:.9},S={flex:1,height:4,backgroundColor:"var(--nice-text, #444)",borderRadius:2,cursor:"pointer"};return l.createElement("div",{style:g},l.createElement("button",{style:b,onClick:e.isPlaying&&!e.isPaused?o:i,title:e.isPlaying&&!e.isPaused?"Pause":"Play"},e.isPlaying&&!e.isPaused?"⏸":"▶"),l.createElement("button",{style:b,onClick:r,title:"Stop"},"⏹"),l.createElement("button",{style:{...b,opacity:e.currentSceneIndex>0?.9:.3},onClick:s,disabled:e.currentSceneIndex<=0,title:"Previous Scene"},"⏮"),l.createElement("button",{style:{...b,opacity:e.currentSceneIndex<n-1?.9:.3},onClick:c,disabled:e.currentSceneIndex>=n-1,title:"Next Scene"},"⏭"),l.createElement("span",{style:{fontSize:12,fontFamily:"monospace"}},`${f(e.currentTime)} / ${f(t.duration)}`),l.createElement("div",{style:S,onClick:h=>{const I=h.currentTarget.getBoundingClientRect(),z=(h.clientX-I.left)/I.width;a(z*t.duration)}},l.createElement("div",{style:{width:`${x}%`,height:"100%",backgroundColor:"var(--nice-primary-light, #60a5fa)",borderRadius:2}})),l.createElement("select",{value:e.playbackSpeed,onChange:h=>d(parseFloat(h.target.value)),style:{background:"var(--nice-text, #333)",color:"var(--nice-bg, #fff)",border:"none",padding:"4px 8px",borderRadius:4,fontSize:12}},l.createElement("option",{value:.25},"0.25x"),l.createElement("option",{value:.5},"0.5x"),l.createElement("option",{value:1},"1x"),l.createElement("option",{value:1.5},"1.5x"),l.createElement("option",{value:2},"2x")),l.createElement("button",{style:b,onClick:m,title:e.isMuted?"Unmute":"Mute"},e.isMuted?"🔇":"🔊"),l.createElement("input",{type:"range",min:0,max:1,step:.1,value:e.volume,onChange:h=>p(parseFloat(h.target.value)),style:{width:60}}),l.createElement("button",{style:{...b,color:e.loop?"var(--nice-primary-light, #60a5fa)":"var(--nice-bg, #fff)"},onClick:y,title:"Loop"},"🔁"),l.createElement("span",{style:{fontSize:12}},`Scene ${e.currentSceneIndex+1}/${n}`))}function Wr({document:e,width:t=320,height:n=240,autoPlay:i=!1,className:o,style:r}){return l.createElement(wt,{document:e,autoPlay:i,showControls:!1,className:o,style:{width:t,height:n,borderRadius:8,overflow:"hidden",...r}})}function kt(e,t,n){var a,s,c,d;const i=t.assets.find(p=>p.id===e.assetId),o=[];if(e.animations)for(const[p,m]of Object.entries(e.animations)){const y=m.frames.map((f,x)=>({frameId:`${p}_frame_${x}`,duration:f.duration||1e3/m.fps,offset:{x:0,y:0}}));o.push({id:`anim_${p}`,name:p,category:At(p),frames:y,fps:m.fps,loop:m.loop,duration:y.reduce((f,x)=>f+(x.duration??0),0)})}const r={};if(e.animations)for(const[p,m]of Object.entries(e.animations))m.frames.forEach((y,f)=>{r[`${p}_frame_${f}`]={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:(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:((d=i==null?void 0:i.metadata)==null?void 0:d.height)||e.height||100},anchor:e.anchor||{x:.5,y:1},animations:o,expressions:[],defaultScale:1}}function It(e,t,n){var d,p,m,y;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,x]of Object.entries(o.animations)){const g=x.frames.map((b,S)=>({frameId:`${f}_frame_${S}`,duration:b.duration||1e3/x.fps,offset:{x:0,y:0}}));s.push({id:`anim_${f}`,name:f,category:At(f),frames:g,fps:x.fps,loop:x.loop,duration:g.reduce((b,S)=>b+(S.duration??0),0)})}const c={};if(o!=null&&o.animations)for(const[f,x]of Object.entries(o.animations))x.frames.forEach((g,b)=>{c[`${f}_frame_${b}`]={frame:{x:g.srcRect.x,y:g.srcRect.y,w:g.srcRect.width,h:g.srcRect.height},rotated:!1,trimmed:!1,spriteSourceSize:{x:0,y:0,w:g.srcRect.width,h:g.srcRect.height},sourceSize:{w:g.srcRect.width,h:g.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:((d=a==null?void 0:a.metadata)==null?void 0:d.width)||i.width,h:((p=a==null?void 0:a.metadata)==null?void 0:p.height)||i.height},scale:1}},width:((m=a==null?void 0:a.metadata)==null?void 0:m.width)||i.width||100,height:((y=a==null?void 0:a.metadata)==null?void 0:y.height)||i.height||100},anchor:i.anchor||{x:.5,y:1},animations:s,expressions:[],defaultScale:1}}function Ct(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 Br(e,t){const n=[];for(const i of e.sprites)n.push(kt(i,e));for(const i of e.entities){const o=It(i,e);o&&n.push(o)}return n}function Hr(e,t){const n=[];for(const i of e.assets){const o=Ct(i);o&&n.push(o)}return n}function Mt(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 Vr(e,t){var i;const n=Mt(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 At(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 Ur(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,d={};return e.forEach((p,m)=>{const y=m%n,f=Math.floor(m/n);d[p.id]={frame:{x:y*(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:d,meta:{image:"",size:{w:s,h:c},scale:1}}}}function Qr(e,t,n,i,o){const r=o||Math.ceil(Math.sqrt(i)),a={};for(let c=0;c<i;c++){const d=c%r,p=Math.floor(c/r);a[`frame_${c}`]={frame:{x:d*t,y:p*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 Kr(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 Yr(e,t){var s,c,d;const{flattenScenes:n=!1,includeCharacterSprites:i=!0,includeDialogue:o=!0,slideDuration:r=5e3}=t||{},a=[];if(n)for(const p of e.scenes){const m=Xr(p);for(let y=0;y<m.length;y++){const f=m[y],x=m[y+1]??p.duration,g=Gr(e,p,f,x-f,i,o);a.push(g)}}else for(const p of e.scenes){const m=Jr(e,p,i,o);a.push(m)}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:((d=e.metadata)==null?void 0:d.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 Xr(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 Gr(e,t,n,i,o,r){var s,c;const a=[];if(o)for(const d of t.cast){const p=e.characters.find(f=>f.id===d.characterId);if(!p)continue;const m=Zr(t,d.instanceId,n)||d.position,y=ea(t,d.instanceId,n);a.push({id:`char_${d.instanceId}_${n}`,type:"image",position:{x:m.x,y:m.y,rotation:(y==null?void 0:y.rotation)??d.rotation},size:{width:((s=p.visual.atlas)==null?void 0:s.meta.size.w)??100,height:((c=p.visual.atlas)==null?void 0:c.meta.size.h)??100},content:{src:p.visual.spriteSheet,alt:p.name},style:{opacity:(y==null?void 0:y.opacity)??d.opacity??1,transform:(y==null?void 0:y.scale)!==void 0?`scale(${d.flipX?-y.scale:y.scale}, ${y.scale})`:void 0},zIndex:d.zIndex})}if(r){const d=ta(t,n);if(d){const p=e.characters.find(m=>{const y=t.timeline.find(f=>f.type==="dialogue");return(y==null?void 0:y.targetId)===m.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:p?`${p.name}: ${d.text}`:d.text},style:{backgroundColor:"var(--nice-overlay-85, 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 Jr(e,t,n,i){var r,a;const o=[];if(n)for(const s of t.cast){const c=e.characters.find(d=>d.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:ia(t,s.instanceId),zIndex:s.zIndex})}for(const s of t.scenery){const c=e.props.find(d=>d.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&&na(t).forEach((c,d)=>{const p=e.characters.find(m=>m.id===c.speakerId);o.push({id:`dialogue_${d}`,type:"text",position:{x:e.stageSize.width/2,y:e.stageSize.height-100},size:{width:e.stageSize.width*.9,height:80},content:{text:p?`${p.name}: ${c.text}`:c.text},style:{backgroundColor:"var(--nice-overlay-85, 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+d})}),{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 Zr(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 ea(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 ta(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 na(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:"var(--nice-text, #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:"var(--nice-text, #000000)"}}}function ia(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 oa(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],d=`char_${n.length}`;n.push({id:d,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=ra(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 ra(e,t,n,i){var d,p,m,y;const o=[],r=[],a=[];let s=0,c=0;for(const f of e.elements)if(f.type==="image"&&f.content.src){const x=n.find(g=>g.visual.spriteSheet===f.content.src);if(x){const g=`${x.id}_instance_${s++}`;if(o.push({instanceId:g,characterId:x.id,position:{x:f.position.x,y:f.position.y},scale:1,rotation:f.position.rotation??0,zIndex:f.zIndex??s,opacity:((d=f.style)==null?void 0:d.opacity)??1,flipX:!1}),(p=f.animation)!=null&&p.timeline&&f.animation.timeline.length>1){const b={id:`transform_${g}`,type:"transform",targetId:g,keyframes:f.animation.timeline.map(S=>{const h=S.properties;return{time:S.time,easing:S.easing??"easeInOut",value:{type:"transform",position:h.x!==void 0?{x:h.x,y:h.y??0}:void 0,scale:h.scale,rotation:h.rotation,opacity:h.opacity}}})};a.push(b)}}else{const g=i.find(b=>b.asset===f.content.src);g&&r.push({instanceId:`${g.id}_instance_${c++}`,propId:g.id,position:{x:f.position.x,y:f.position.y},scale:1,rotation:f.position.rotation??0,zIndex:f.zIndex??c,opacity:((m=f.style)==null?void 0:m.opacity)??1})}}else if(f.type==="text"&&f.content.text&&f.position.y>t.layout.height*.7){const g=((y=o[0])==null?void 0:y.characterId)??"narrator",b=a.find(h=>h.type==="dialogue"&&h.targetId===g),S={time:0,duration:e.duration??3e3,easing:"linear",value:{type:"dialogue",text:f.content.text}};b?b.keyframes.push(S):a.push({id:`dialogue_${g}`,type:"dialogue",targetId:g,keyframes:[S]})}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:"var(--nice-text, #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 aa(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 sa(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(d=>d.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 _t={good:"var(--nice-success, #4caf50)",warning:"var(--nice-warning, #ff9800)",critical:"var(--nice-danger, #f44336)",info:"var(--nice-primary, #2196f3)",neutral:"var(--nice-text-secondary, #9e9e9e)",background:"var(--nice-bg, #fff)",text:"var(--nice-text, #212121)",textMuted:"var(--nice-text-secondary, #757575)"};function ca(e){const t={..._t,...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 la(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 da(e,t){return t==null?"unknown":e>t?"up":e<t?"down":"flat"}function ua(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 zt(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 Tt(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 pa(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 fa(e){return{id:"sparkline-trend",title:"Weekly Trend",type:"sparkline",column:1,row:1,sparklineData:[],...e}}function ma(e){return{id:"traffic-light",title:"System Status",type:"traffic-light",column:1,row:1,...e}}function ha(e){return{id:"comparison",title:"Budget vs Actual",type:"comparison",column:1,row:1,targetValue:1e5,value:85e3,unit:"$",...e}}function ya(){return{id:"executive-dashboard",title:"Executive Summary",columns:4,rows:3,widgets:[zt({column:1,row:1,colSpan:1}),Tt({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 ga(){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 xa(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:"var(--nice-bg-secondary, #f5f5f5)",headerColor:"var(--nice-text, #212121)",rowBackground:"var(--nice-bg, #fff)",rowBackgroundAlt:"var(--nice-bg-secondary, #fafafa)",cellColor:"var(--nice-text-secondary, #424242)",borderColor:"var(--nice-border, #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 va(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 ba(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 Sa(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 wa(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 ka(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 Ia(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:"var(--nice-success-bg, #e8f5e9)",color:"var(--nice-success-dark, #2e7d32)"}},{condition:{operator:"lessThan",value:5e4},style:{backgroundColor:"var(--nice-danger-bg, #ffebee)",color:"var(--nice-danger-dark, #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 Ca(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 Ma(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:"var(--nice-bg, #fff)",accentColor:"var(--nice-primary-hover, #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 Aa(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 $a(e,t,n){let i=e;for(const[o,r]of Object.entries(n)){const a=_a(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 _a(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 za(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 Ta(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 Ra(e,t){var s,c,d;if(!e.success||e.columns.length===0)return;const n=e.columns.filter(p=>p.type==="number"),i=e.columns.filter(p=>p.type!=="number"),r=((s=e.columns.filter(p=>p.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(p=>p.name):(d=e.columns[1])==null?void 0:d.name;return{xAxis:r,yAxis:a,showLegend:Array.isArray(a)&&a.length>1,showGrid:!0,colorScheme:["var(--nice-primary-hover, #1976d2)","var(--nice-success, #43a047)","var(--nice-warning-dark, #fb8c00)","var(--nice-danger, #e53935)","#8e24aa"]}}function Ea(){return{id:"sales-query",title:"Sales Analysis",subtitle:"Query live sales data",language:"sql",query:`SELECT
132
+ Region,
133
+ ProductCategory,
134
+ SUM(Revenue) as TotalRevenue,
135
+ COUNT(*) as OrderCount,
136
+ AVG(Revenue) as AvgOrderValue
137
+ FROM Sales
138
+ WHERE OrderDate >= @startDate AND OrderDate <= @endDate
139
+ GROUP BY Region, ProductCategory
140
+ ORDER BY TotalRevenue DESC`,parameters:[{name:"startDate",label:"Start Date",type:"date",required:!0,defaultValue:new Date(Date.now()-30*24*60*60*1e3).toISOString().split("T")[0]},{name:"endDate",label:"End Date",type:"date",required:!0,defaultValue:new Date().toISOString().split("T")[0]}],dataSource:{id:"sales-query-ds",name:"Sales Query Source",type:"rest-api",config:{type:"rest-api",url:"/api/query",method:"POST"},status:"idle"},visualization:{mode:"bar-chart",chartConfig:{xAxis:"Region",yAxis:"TotalRevenue",seriesField:"ProductCategory",showLegend:!0}},showQueryEditor:!0,showExecutionStats:!0}}function Pa(){return{id:"odata-query",title:"Product Catalog",subtitle:"OData Query Example",language:"odata",query:"Products?$filter=Category eq '{category}' and Price gt {minPrice}&$orderby=Price desc&$top=20&$select=Name,Category,Price,Stock",parameters:[{name:"category",label:"Category",type:"select",required:!0,defaultValue:"Electronics",options:[{value:"Electronics",label:"Electronics"},{value:"Clothing",label:"Clothing"},{value:"Books",label:"Books"}]},{name:"minPrice",label:"Minimum Price",type:"number",defaultValue:0,validation:{min:0}}],dataSource:{id:"odata-query-ds",name:"OData Query Source",type:"rest-api",config:{type:"rest-api",url:"https://api.example.com/odata",method:"GET"},status:"idle"},visualization:{mode:"table",tableConfig:{pageSize:10,sortable:!0}}}}function Na(){return{id:"kql-query",title:"Application Insights",subtitle:"Request Performance Analysis",language:"kql",query:`requests
141
+ | where timestamp > ago({timeRange})
142
+ | summarize
143
+ RequestCount = count(),
144
+ AvgDuration = avg(duration),
145
+ P95Duration = percentile(duration, 95),
146
+ FailureRate = countif(success == false) * 100.0 / count()
147
+ by bin(timestamp, 1h)
148
+ | order by timestamp asc`,parameters:[{name:"timeRange",label:"Time Range",type:"select",defaultValue:"24h",options:[{value:"1h",label:"Last Hour"},{value:"24h",label:"Last 24 Hours"},{value:"7d",label:"Last 7 Days"},{value:"30d",label:"Last 30 Days"}]}],dataSource:{id:"kql-query-ds",name:"KQL Query Source",type:"rest-api",config:{type:"rest-api",url:"https://api.applicationinsights.azure.com/v1/apps/{app-id}/query",method:"POST"},status:"idle"},visualization:{mode:"line-chart",chartConfig:{xAxis:"timestamp",yAxis:["AvgDuration","P95Duration"],showLegend:!0,showGrid:!0}},autoExecute:!0}}class Da{constructor(t,n,i){this.versions=new Map,this.branches=new Map,this.currentVersionId=null,this.currentBranch="main",this.autoSaveTimer=null,this.lastAutoSaveTime=0,this.presentationId=t,this.config={maxVersions:50,autoSaveInterval:6e4,autoSaveDebounce:5e3,preserveLabeledVersions:!0,enableBranching:!0,...n},this.onChange=i,this.branches.set("main",{name:"main",headVersionId:"",createdAt:new Date().toISOString(),createdBy:n.currentUser})}getVersionHistory(){return Array.from(this.versions.values()).filter(t=>!t.branchName||t.branchName===this.currentBranch).sort((t,n)=>n.versionNumber-t.versionNumber)}getVersion(t){return this.versions.get(t)}getCurrentVersion(){return this.currentVersionId?this.versions.get(this.currentVersionId):void 0}saveVersion(t,n={}){var d;const i=this.generateVersionId(),o=this.getCurrentVersion(),r=((o==null?void 0:o.versionNumber)??0)+1,a=o?this.calculateDiff(o.snapshot,t):void 0,s={versionId:i,versionNumber:r,snapshot:this.clonePresentation(t),createdAt:new Date().toISOString(),createdBy:this.config.currentUser,label:n.label,description:n.description??this.generateAutoDescription(a),tags:n.tags,isAutoSave:n.isAutoSave??!1,parentVersionId:this.currentVersionId??void 0,branchName:this.currentBranch,diff:a};this.versions.set(i,s),this.currentVersionId=i;const c=this.branches.get(this.currentBranch);return c&&(c.headVersionId=i),this.pruneVersions(),(d=this.onChange)==null||d.call(this,s),s}scheduleAutoSave(t){if(this.config.autoSaveInterval<=0)return;this.autoSaveTimer&&clearTimeout(this.autoSaveTimer);const i=Date.now()-this.lastAutoSaveTime,o=Math.max(this.config.autoSaveDebounce,this.config.autoSaveInterval-i);this.autoSaveTimer=setTimeout(()=>{this.saveVersion(t,{isAutoSave:!0}),this.lastAutoSaveTime=Date.now()},o)}cancelAutoSave(){this.autoSaveTimer&&(clearTimeout(this.autoSaveTimer),this.autoSaveTimer=null)}restoreVersion(t){const n=this.versions.get(t);if(!n)return null;const i=this.getCurrentVersion();return i&&this.saveVersion(i.snapshot,{label:`Before restore to v${n.versionNumber}`,description:`Auto-saved before restoring to version ${n.versionNumber}`}),this.saveVersion(n.snapshot,{description:`Restored from version ${n.versionNumber}`}).snapshot}previewVersion(t){const n=this.versions.get(t);return n?this.clonePresentation(n.snapshot):null}labelVersion(t,n){const i=this.versions.get(t);return i?(i.label=n,!0):!1}tagVersion(t,n){const i=this.versions.get(t);return i?(i.tags=[...new Set([...i.tags??[],...n])],!0):!1}createBranch(t,n){if(!this.config.enableBranching||this.branches.has(t))return null;const i={name:t,headVersionId:this.currentVersionId??"",createdAt:new Date().toISOString(),createdBy:this.config.currentUser,description:n};return this.branches.set(t,i),i}switchBranch(t){const n=this.branches.get(t);return n?(this.currentBranch=t,this.currentVersionId=n.headVersionId,!0):!1}getBranches(){return Array.from(this.branches.values())}getCurrentBranch(){return this.currentBranch}compareVersions(t,n){const i=this.versions.get(t),o=this.versions.get(n);return!i||!o?null:this.calculateDiff(i.snapshot,o.snapshot)}calculateDiff(t,n){const i=[],o=[],r=new Map(t.slides.map((x,g)=>[x.id,{slide:x,index:g}])),a=new Map(n.slides.map((x,g)=>[x.id,{slide:x,index:g}]));let s=0,c=0,d=0,p=0,m=0,y=0;for(const[x,{slide:g,index:b}]of a){const S=r.get(x);if(!S)s++,p+=g.elements.length,i.push({slideId:x,slideIndex:b,changeType:"added",slideTitle:this.getSlideTitle(g)});else{const h=this.calculateElementChanges(S.slide,g);if((h.length>0||S.index!==b)&&(S.index!==b&&i.push({slideId:x,slideIndex:b,changeType:"reordered",slideTitle:this.getSlideTitle(g),previousIndex:S.index}),h.length>0)){d++,i.push({slideId:x,slideIndex:b,changeType:"modified",slideTitle:this.getSlideTitle(g),elementChanges:h});for(const I of h)I.changeType==="added"?p++:I.changeType==="removed"?m++:y++}}}for(const[x,{slide:g,index:b}]of r)a.has(x)||(c++,m+=g.elements.length,i.push({slideId:x,slideIndex:b,changeType:"removed",slideTitle:this.getSlideTitle(g)}));const f=["title","author","theme"];for(const x of f)JSON.stringify(t[x])!==JSON.stringify(n[x])&&o.push({property:x,oldValue:t[x],newValue:n[x]});return{summary:{slidesAdded:s,slidesRemoved:c,slidesModified:d,elementsAdded:p,elementsRemoved:m,elementsModified:y,totalChanges:s+c+d+o.length},slideChanges:i,metadataChanges:o}}calculateElementChanges(t,n){const i=[],o=new Map(t.elements.map(a=>[a.id,a])),r=new Map(n.elements.map(a=>[a.id,a]));for(const[a,s]of r){const c=o.get(a);if(!c)i.push({elementId:a,elementType:s.type,changeType:"added"});else{const d=this.calculatePropertyChanges(c,s);d.length>0&&i.push({elementId:a,elementType:s.type,changeType:"modified",propertyChanges:d})}}for(const[a,s]of o)r.has(a)||i.push({elementId:a,elementType:s.type,changeType:"removed"});return i}calculatePropertyChanges(t,n){const i=[],o=t,r=n,a=new Set([...Object.keys(o),...Object.keys(r)]);for(const s of a)s!=="id"&&JSON.stringify(o[s])!==JSON.stringify(r[s])&&i.push({property:s,oldValue:o[s],newValue:r[s]});return i}getSlideTitle(t){const n=t.elements.find(i=>{var o;return i.type==="text"&&((o=i.content)==null?void 0:o.text)});if(n){const i=n.content.text;return i.substring(0,50)+(i.length>50?"...":"")}return`Slide ${t.id}`}generateAutoDescription(t){if(!t)return"Initial version";const n=[],{summary:i}=t;return i.slidesAdded>0&&n.push(`+${i.slidesAdded} slide(s)`),i.slidesRemoved>0&&n.push(`-${i.slidesRemoved} slide(s)`),i.slidesModified>0&&n.push(`~${i.slidesModified} slide(s) modified`),t.metadataChanges.length>0&&n.push("metadata updated"),n.length>0?n.join(", "):"No significant changes"}clonePresentation(t){return JSON.parse(JSON.stringify(t))}generateVersionId(){return`v_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}pruneVersions(){const t=Array.from(this.versions.values()).filter(o=>!o.branchName||o.branchName===this.currentBranch).sort((o,r)=>o.versionNumber-r.versionNumber),n=new Set;if(this.currentVersionId&&n.add(this.currentVersionId),this.config.preserveLabeledVersions)for(const o of t)o.label&&n.add(o.versionId);const i=t.slice(-this.config.maxVersions);for(const o of i)n.add(o.versionId);for(const o of t)n.has(o.versionId)||this.versions.delete(o.versionId)}exportHistory(){return JSON.stringify({presentationId:this.presentationId,currentVersionId:this.currentVersionId,currentBranch:this.currentBranch,versions:Array.from(this.versions.values()),branches:Array.from(this.branches.values())})}importHistory(t){const n=JSON.parse(t);this.presentationId=n.presentationId,this.currentVersionId=n.currentVersionId,this.currentBranch=n.currentBranch,this.versions=new Map(n.versions.map(i=>[i.versionId,i])),this.branches=new Map(n.branches.map(i=>[i.name,i]))}dispose(){this.cancelAutoSave()}}class Oa{constructor(t,n){this.slides=new Map,this.elements=new Map,this.templates=new Map,this.collections=new Map,this.linkedInstances=new Map,this.currentUser=t,this.onUpdate=n}addSlide(t,n){const i=this.generateId(),o=new Date().toISOString(),r={metadata:{id:i,type:"slide",name:n.name,description:n.description,tags:n.tags??[],collectionIds:n.collectionIds??[],createdBy:this.currentUser,createdAt:o,updatedAt:o,version:1,usageCount:0,visibility:n.visibility??"private"},slide:this.cloneSlide(t),placeholders:n.placeholders};return this.slides.set(i,r),this.updateCollectionCounts(),r}updateSlide(t,n){var o;const i=this.slides.get(t);return!i||i.metadata.createdBy.id!==this.currentUser.id?null:(n.slide&&(i.slide=this.cloneSlide(n.slide),i.metadata.version++),n.name!==void 0&&(i.metadata.name=n.name),n.description!==void 0&&(i.metadata.description=n.description),n.tags!==void 0&&(i.metadata.tags=n.tags),n.placeholders!==void 0&&(i.placeholders=n.placeholders),i.metadata.updatedAt=new Date().toISOString(),(o=this.onUpdate)==null||o.call(this,"slide",t),i)}removeSlide(t){const n=this.slides.get(t);return!n||n.metadata.createdBy.id!==this.currentUser.id?!1:(this.slides.delete(t),this.updateCollectionCounts(),!0)}getSlide(t){return this.slides.get(t)}useSlide(t,n){const i=this.slides.get(t);if(!i)return null;i.metadata.usageCount++;const o=this.cloneSlide(i.slide);if(o.id=this.generateId(),n!=null&&n.placeholderValues&&i.placeholders&&this.applyPlaceholderValues(o,i.placeholders,n.placeholderValues),n!=null&&n.elementOverrides)for(const r of o.elements){const a=n.elementOverrides[r.id];a&&Object.assign(r,a)}return n!=null&&n.backgroundOverride&&(o.background=n.backgroundOverride),o}linkSlide(t,n,i,o){const r=this.slides.get(t);if(!r)return null;const a=this.generateId(),s={instanceId:a,libraryItemId:t,presentationId:n,slideIndex:i,overrides:o,syncStatus:"synced",syncedVersion:r.metadata.version};return this.linkedInstances.set(a,s),r.metadata.usageCount++,s}syncLinkedSlide(t){const n=this.linkedInstances.get(t);if(!n)return null;const i=this.slides.get(n.libraryItemId);if(!i)return null;const o=this.useSlide(n.libraryItemId,n.overrides);return o&&(n.syncStatus="synced",n.syncedVersion=i.metadata.version),o}getOutdatedInstances(){const t=[];for(const n of this.linkedInstances.values()){const i=this.slides.get(n.libraryItemId);i&&i.metadata.version>n.syncedVersion&&(n.syncStatus="outdated",t.push(n))}return t}addElement(t,n){const i=this.generateId(),o=new Date().toISOString(),r={metadata:{id:i,type:"element",name:n.name,description:n.description,tags:n.tags??[],createdBy:this.currentUser,createdAt:o,updatedAt:o,version:1,usageCount:0,visibility:n.visibility??"private"},element:JSON.parse(JSON.stringify(t))};return this.elements.set(i,r),r}getElement(t){return this.elements.get(t)}useElement(t){const n=this.elements.get(t);if(!n)return null;n.metadata.usageCount++;const i=JSON.parse(JSON.stringify(n.element));return i.id=this.generateId(),i}addTemplate(t,n){const i=this.generateId(),o=new Date().toISOString(),r={metadata:{id:i,type:"template",name:n.name,description:n.description,tags:n.tags??[],createdBy:this.currentUser,createdAt:o,updatedAt:o,version:1,usageCount:0,visibility:n.visibility??"private"},slides:t.map(a=>this.cloneSlide(a)),variables:n.variables,useCases:n.useCases};return this.templates.set(i,r),r}getTemplate(t){return this.templates.get(t)}useTemplate(t,n){const i=this.templates.get(t);if(!i)return null;i.metadata.usageCount++;const o=i.slides.map(r=>{const a=this.cloneSlide(r);return a.id=this.generateId(),a});return n&&i.variables&&this.applyTemplateVariables(o,i.variables,n),o}createCollection(t){const n=this.generateId(),i={id:n,name:t.name,description:t.description,icon:t.icon,color:t.color,parentId:t.parentId,itemCount:0,createdBy:this.currentUser,createdAt:new Date().toISOString(),visibility:t.visibility??"private"};return this.collections.set(n,i),i}getCollections(){return Array.from(this.collections.values())}addToCollection(t,n){const i=this.slides.get(t),o=this.elements.get(t),r=this.templates.get(t),a=i??o??r;return!a||!this.collections.get(n)?!1:(a.metadata.collectionIds||(a.metadata.collectionIds=[]),a.metadata.collectionIds.includes(n)||(a.metadata.collectionIds.push(n),this.updateCollectionCounts()),!0)}search(t){let n=[];const i=t.types??["slide","element","template"];if(i.includes("slide")&&n.push(...Array.from(this.slides.values())),i.includes("element")&&n.push(...Array.from(this.elements.values())),i.includes("template")&&n.push(...Array.from(this.templates.values())),t.visibility&&(n=n.filter(d=>t.visibility.includes(d.metadata.visibility))),t.query){const d=t.query.toLowerCase();n=n.filter(p=>{var m,y;return p.metadata.name.toLowerCase().includes(d)||((m=p.metadata.description)==null?void 0:m.toLowerCase().includes(d))||((y=p.metadata.tags)==null?void 0:y.some(f=>f.toLowerCase().includes(d)))})}t.tags&&t.tags.length>0&&(n=n.filter(d=>t.tags.some(p=>{var m;return(m=d.metadata.tags)==null?void 0:m.includes(p)}))),t.collectionIds&&t.collectionIds.length>0&&(n=n.filter(d=>t.collectionIds.some(p=>{var m;return(m=d.metadata.collectionIds)==null?void 0:m.includes(p)}))),t.createdBy&&(n=n.filter(d=>d.metadata.createdBy.id===t.createdBy));const o=t.sortBy??"updatedAt",r=t.sortOrder??"desc";n.sort((d,p)=>{let m=0;switch(o){case"name":m=d.metadata.name.localeCompare(p.metadata.name);break;case"createdAt":m=d.metadata.createdAt.localeCompare(p.metadata.createdAt);break;case"updatedAt":m=d.metadata.updatedAt.localeCompare(p.metadata.updatedAt);break;case"usageCount":m=d.metadata.usageCount-p.metadata.usageCount;break}return r==="desc"?-m:m});const a=n.length,s=t.offset??0,c=t.limit??20;return n=n.slice(s,s+c),{items:n,totalCount:a,hasMore:s+n.length<a}}getRecent(t=10){return this.search({sortBy:"updatedAt",sortOrder:"desc",limit:t}).items}getFavorites(){return[...Array.from(this.slides.values()),...Array.from(this.elements.values()),...Array.from(this.templates.values())].filter(n=>n.metadata.isFavorite)}toggleFavorite(t){const n=this.slides.get(t)??this.elements.get(t)??this.templates.get(t);return n?(n.metadata.isFavorite=!n.metadata.isFavorite,!0):!1}generateId(){return`lib_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}cloneSlide(t){return JSON.parse(JSON.stringify(t))}applyPlaceholderValues(t,n,i){for(const o of n){const r=i[o.id];if(r===void 0)continue;const a=t.elements.find(s=>s.id===o.elementId);if(a)switch(o.type){case"text":a.type==="text"&&a.content&&(a.content.text=String(r));break;case"image":a.type==="image"&&a.content&&(a.content.src=String(r));break;case"chart-data":a.type==="chart"&&a.content&&(a.content.data=r);break;case"table-data":a.type==="table"&&a.content&&(a.content.rows=r);break}}}applyTemplateVariables(t,n,i){const o={};for(const r of n){const a=i[r.name]??r.defaultValue;a!==void 0&&(o[`{{${r.name}}}`]=String(a))}for(const r of t)for(const a of r.elements)if(a.type==="text"&&a.content){let s=a.content.text;for(const[c,d]of Object.entries(o))s=s.replace(new RegExp(c.replace(/[{}]/g,"\\$&"),"g"),d);a.content.text=s}}updateCollectionCounts(){for(const n of this.collections.values())n.itemCount=0;const t=[...Array.from(this.slides.values()),...Array.from(this.elements.values()),...Array.from(this.templates.values())];for(const n of t)for(const i of n.metadata.collectionIds??[]){const o=this.collections.get(i);o&&o.itemCount++}}exportLibrary(){return JSON.stringify({slides:Array.from(this.slides.values()),elements:Array.from(this.elements.values()),templates:Array.from(this.templates.values()),collections:Array.from(this.collections.values())})}importLibrary(t){const n=JSON.parse(t);this.slides=new Map(n.slides.map(i=>[i.metadata.id,i])),this.elements=new Map(n.elements.map(i=>[i.metadata.id,i])),this.templates=new Map(n.templates.map(i=>[i.metadata.id,i])),this.collections=new Map(n.collections.map(i=>[i.id,i]))}}function Rt(e){const t=e.data;if(typeof t=="string")return t;switch(t.type){case"url":return t.url;case"email":return`mailto:${t.to}${t.subject||t.body?"?":""}${t.subject?`subject=${encodeURIComponent(t.subject)}`:""}${t.subject&&t.body?"&":""}${t.body?`body=${encodeURIComponent(t.body)}`:""}`;case"phone":return`tel:${t.number}`;case"sms":return`sms:${t.number}${t.message?`?body=${encodeURIComponent(t.message)}`:""}`;case"vcard":return Fa(t);case"wifi":return`WIFI:T:${t.encryption};S:${t.ssid};P:${t.password??""};H:${t.hidden?"true":"false"};;`;case"geo":return`geo:${t.latitude},${t.longitude}${t.altitude?`,${t.altitude}`:""}${t.label?`?q=${encodeURIComponent(t.label)}`:""}`;case"calendar":return ja(t);case"presentation-link":return qa(t);case"feedback-form":return`${Ie()}/feedback/${t.formId}?p=${t.presentationId}`;case"poll":return`${Ie()}/poll/${t.pollId}`;default:return String(t)}}function Fa(e){const t=["BEGIN:VCARD","VERSION:3.0",`N:${e.lastName};${e.firstName};;;`,`FN:${e.firstName} ${e.lastName}`];if(e.organization&&t.push(`ORG:${e.organization}`),e.title&&t.push(`TITLE:${e.title}`),e.email&&t.push(`EMAIL:${e.email}`),e.phone&&t.push(`TEL;TYPE=WORK:${e.phone}`),e.mobile&&t.push(`TEL;TYPE=CELL:${e.mobile}`),e.website&&t.push(`URL:${e.website}`),e.note&&t.push(`NOTE:${e.note}`),e.address){const n=e.address;t.push(`ADR;TYPE=WORK:;;${n.street??""};${n.city??""};${n.state??""};${n.postalCode??""};${n.country??""}`)}return t.push("END:VCARD"),t.join(`
149
+ `)}function ja(e){const t=(i,o)=>{const r=new Date(i);return o?r.toISOString().replace(/[-:]/g,"").split("T")[0]:r.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,"")},n=["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT",`DTSTART${e.allDay?";VALUE=DATE":""}:${t(e.startDate,e.allDay)}`,`DTEND${e.allDay?";VALUE=DATE":""}:${t(e.endDate,e.allDay)}`,`SUMMARY:${e.title}`];return e.description&&n.push(`DESCRIPTION:${e.description}`),e.location&&n.push(`LOCATION:${e.location}`),n.push("END:VEVENT","END:VCALENDAR"),n.join(`
150
+ `)}function qa(e){const t=`${Ie()}/present/${e.presentationId}`,n=new URLSearchParams;e.slideIndex!==void 0&&n.set("slide",String(e.slideIndex)),e.accessCode&&n.set("code",e.accessCode),e.allowDownload&&n.set("download","1");const i=n.toString();return i?`${t}?${i}`:t}function Ie(){return typeof window<"u"?window.location.origin:"https://app.nice2dev.com"}function La(e){const t=e.qrCodes.map(n=>({id:n.id,dataUrl:"",rawData:Rt(n),size:n.size??256,config:{...n,errorCorrection:n.errorCorrection??"M",style:{foregroundColor:"var(--nice-text, #000000)",backgroundColor:"var(--nice-bg, #fff)",cornerSquareStyle:"square",dotStyle:"square",...n.style}}}));return{id:e.id,type:"qrcode",title:e.title,subtitle:e.subtitle,config:{...e,layout:e.layout??"single",showLabels:e.showLabels??!0,animate:e.animate??!0},qrCodes:t}}function Wa(e,t){return{id:"presentation-link-slide",title:(t==null?void 0:t.title)??"Join the Presentation",subtitle:"Scan to follow along on your device",layout:"single",qrCodes:[{id:"presentation-qr",type:"presentation-link",data:{type:"presentation-link",presentationId:e,accessCode:t==null?void 0:t.accessCode,expiresAt:t!=null&&t.expiresIn?new Date(Date.now()+t.expiresIn*60*60*1e3).toISOString():void 0},label:"Open Presentation",size:400,style:{cornerSquareStyle:"rounded",dotStyle:"rounded",frame:{style:"banner",text:"Scan Me",color:"var(--nice-primary-hover, #1976d2)",textColor:"var(--nice-bg, #fff)"}}}],callToAction:"Scan the QR code to view on your device",showLabels:!0,animate:!0}}function Ba(e,t){return{id:"feedback-slide",title:"We Value Your Feedback",subtitle:"Help us improve",layout:"single",qrCodes:[{id:"feedback-qr",type:"feedback-form",data:{type:"feedback-form",formId:`feedback_${Date.now()}`,presentationId:e,questions:t??[{id:"q1",type:"rating",question:"How would you rate this presentation?",required:!0},{id:"q2",type:"text",question:"What did you find most valuable?",required:!1},{id:"q3",type:"text",question:"Any suggestions for improvement?",required:!1}],anonymous:!0},label:"Share Feedback",size:350,style:{foregroundColor:"var(--nice-success-dark, #2e7d32)",cornerSquareStyle:"rounded",dotStyle:"classy-rounded"}}],callToAction:"Your feedback helps us improve!",instructions:"Scan the code and answer a few quick questions",showLabels:!0}}function Ha(e,t,n){const i=`poll_${Date.now()}`;return{id:"poll-slide",title:"Live Poll",subtitle:e,layout:"single",qrCodes:[{id:"poll-qr",type:"poll",data:{type:"poll",pollId:i,question:e,options:t,allowMultiple:(n==null?void 0:n.allowMultiple)??!1,showResults:(n==null?void 0:n.showResults)??!0,closesAt:n!=null&&n.closesIn?new Date(Date.now()+n.closesIn*60*1e3).toISOString():void 0},label:"Vote Now",size:350,style:{foregroundColor:"var(--nice-accent-dark, #7b1fa2)",cornerSquareStyle:"dot",dotStyle:"dots"}}],callToAction:"Cast your vote!",instructions:"Scan to participate in the poll",showLabels:!0,animate:!0}}function Va(e){return{id:"contact-slide",title:"Connect With Me",subtitle:`${e.firstName} ${e.lastName}`,layout:"single",qrCodes:[{id:"contact-qr",type:"vcard",data:{type:"vcard",...e},label:"Save Contact",size:350,style:{cornerSquareStyle:"rounded",dotStyle:"rounded",frame:{style:"rounded",text:"Add to Contacts",color:"var(--nice-text-secondary, #424242)",textColor:"var(--nice-bg, #fff)"}}}],callToAction:"Scan to save my contact information",showLabels:!0}}function Ua(e,t,n="WPA"){return{id:"wifi-slide",title:"WiFi Network",subtitle:e,layout:"single",qrCodes:[{id:"wifi-qr",type:"wifi",data:{type:"wifi",ssid:e,password:t,encryption:n},label:"Connect to WiFi",size:300,style:{foregroundColor:"#0288d1",cornerSquareStyle:"rounded",dotStyle:"rounded"}}],callToAction:"Scan to connect automatically",showLabels:!0}}function Qa(e){return{id:"multi-qr-slide",title:"Resources & Links",layout:e.length<=2?"side-by-side":"grid",qrCodes:e.map((t,n)=>({id:`qr-${n}`,type:"url",data:t.url,label:t.label,size:e.length<=2?250:180,style:{foregroundColor:t.color??"var(--nice-text, #000000)",cornerSquareStyle:"rounded",dotStyle:"rounded"}})),showLabels:!0,animate:!0}}const Ne=["var(--nice-danger, #ff6b6b)","var(--nice-info, #4ecdc4)","var(--nice-info, #45b7d1)","var(--nice-success-light, #96ceb4)","var(--nice-warning-bg, #ffeaa7)","var(--nice-accent, #dda0dd)","var(--nice-success-light, #98d8c8)","var(--nice-warning, #f7dc6f)","var(--nice-accent, #bb8fce)","var(--nice-primary-light, #85c1e9)"];function Ka(e){return Ne[e%Ne.length]}function Et(e,t){const n=e.toArray();return{version:"1.0",id:t.get("id")||Date.now().toString(),title:t.get("title")||"Untitled",author:t.get("author"),slideSize:t.get("slideSize")??{width:1920,height:1080},slides:n,theme:t.get("theme")??{backgroundColor:"var(--nice-bg, #1a1a2e)",textColor:"var(--nice-bg, #fff)",accentColor:"var(--nice-info, #4ecdc4)",fontHeading:"Inter",fontBody:"Inter"},speakerSettings:t.get("speakerSettings"),metadata:t.get("metadata")??{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}}}function Ce(e,t,n,i){i.transact(()=>{t.length>0&&t.delete(0,t.length),t.push(e.slides),n.set("id",e.id),n.set("version",e.version),n.set("title",e.title),n.set("author",e.author),n.set("slideSize",e.slideSize),n.set("theme",e.theme),n.set("speakerSettings",e.speakerSettings),n.set("metadata",{...e.metadata,updatedAt:new Date().toISOString()})})}function Ya(e){const{provider:t,user:n,initialDocument:i,onSync:o,onUserJoin:r,onUserLeave:a,onConnectionChange:s,createYDoc:c,createProvider:d,createUndoManager:p}=e,m=l.useRef(null),y=l.useRef(null),f=l.useRef(null),[x,g]=l.useState({document:i||null,collaborators:[],collaboratorSlides:new Map,collaboratorEditing:new Map,cursors:new Map,selections:new Map,isConnected:!1,isSynced:!1,localUser:n,undoManager:null});l.useEffect(()=>{var Y,K;if(!c)return;const _=c();m.current=_;const E=_.getArray("slides"),j=_.getMap("meta");if(i&&Ce(i,E,j,_),p){const B=p(_,[E,j]);f.current=B,g(G=>({...G,undoManager:B}))}const H=()=>{const B=Et(E,j);g(G=>({...G,document:B})),o==null||o(B)};if(_.on("update",H),t&&d){const B=d(_,t);y.current=B,B.on("sync",J=>{g(te=>({...te,isSynced:J})),J&&H()}),B.on("connection-error",()=>{g(J=>({...J,isConnected:!1})),s==null||s(!1)}),B.on("connection-close",()=>{g(J=>({...J,isConnected:!1})),s==null||s(!1)});const G=B.awareness;G.setLocalState({user:n,currentSlideId:(K=(Y=i==null?void 0:i.slides)==null?void 0:Y[0])==null?void 0:K.id});const ne=J=>{const te=G.getStates(),de=[],fe=new Map,M=new Map,D=new Map,V=new Map;te.forEach((W,ee)=>{if(ee===G.clientID||!(W!=null&&W.user))return;const ie={id:W.user.id,name:W.user.name,color:W.user.color||Ka(de.length),avatar:W.user.avatar};de.push(ie),W.currentSlideId&&fe.set(ie.id,W.currentSlideId),W.editingElementId!==void 0&&M.set(ie.id,W.editingElementId),W.cursor&&D.set(ie.id,{x:W.cursor.x,y:W.cursor.y}),W.selection&&V.set(ie.id,W.selection)}),g(W=>({...W,collaborators:de,collaboratorSlides:fe,collaboratorEditing:M,cursors:D,selections:V,isConnected:B.connected}));for(const W of J.added){const ee=te.get(W);ee!=null&&ee.user&&(r==null||r(ee.user))}for(const W of J.removed)a==null||a({id:String(W),name:"",color:""})};G.on("change",ne),B.connect(),g(J=>({...J,isConnected:B.connected})),s==null||s(B.connected)}return()=>{var B,G;_.off("update",H),(B=y.current)==null||B.destroy(),(G=m.current)==null||G.destroy(),f.current=null,m.current=null,y.current=null}},[]);const b=l.useCallback((_,E)=>{const j=m.current;if(!j)return;const H=j.getArray("slides");j.transact(()=>{E!==void 0&&E<H.length?H.insert(E,[_]):H.push([_])})},[]),S=l.useCallback((_,E)=>{const j=m.current;if(!j)return;const H=j.getArray("slides");j.transact(()=>{const Y=H.toArray(),K=Y.findIndex(G=>G.id===_);if(K===-1)return;const B={...Y[K],...E};H.delete(K,1),H.insert(K,[B])})},[]),h=l.useCallback(_=>{const E=m.current;if(!E)return;const j=E.getArray("slides");E.transact(()=>{const Y=j.toArray().findIndex(K=>K.id===_);Y!==-1&&j.delete(Y,1)})},[]),I=l.useCallback(_=>{const E=m.current;if(!E)return;const j=E.getArray("slides");E.transact(()=>{const H=j.toArray(),Y=_.map(K=>H.find(B=>B.id===K)).filter(Boolean);Y.length===H.length&&(j.delete(0,j.length),j.push(Y))})},[]),R=l.useCallback((_,E)=>{const j=m.current;if(!j)return;const H=j.getArray("slides");j.transact(()=>{const Y=H.toArray(),K=Y.findIndex(ne=>ne.id===_);if(K===-1)return;const B=Y[K],G={...B,elements:[...B.elements,E]};H.delete(K,1),H.insert(K,[G])})},[]),z=l.useCallback((_,E,j)=>{const H=m.current;if(!H)return;const Y=H.getArray("slides");H.transact(()=>{const K=Y.toArray(),B=K.findIndex(te=>te.id===_);if(B===-1)return;const G=K[B],ne=G.elements.map(te=>te.id===E?{...te,...j}:te),J={...G,elements:ne};Y.delete(B,1),Y.insert(B,[J])})},[]),F=l.useCallback((_,E)=>{const j=m.current;if(!j)return;const H=j.getArray("slides");j.transact(()=>{const Y=H.toArray(),K=Y.findIndex(ne=>ne.id===_);if(K===-1)return;const B=Y[K],G={...B,elements:B.elements.filter(ne=>ne.id!==E)};H.delete(K,1),H.insert(K,[G])})},[]),Q=l.useCallback(_=>{const E=m.current;if(!E)return;const j=E.getMap("meta");E.transact(()=>{const H=j.get("theme")||{};j.set("theme",{...H,..._})})},[]),T=l.useCallback(_=>{const E=m.current;if(!E)return;const j=E.getMap("meta");E.transact(()=>{const H=j.get("metadata")||{};j.set("metadata",{...H,..._,updatedAt:new Date().toISOString()})})},[]),P=l.useCallback(_=>{const E=m.current;if(!E)return;const j=E.getMap("meta");E.transact(()=>{j.set("title",_)})},[]),q=l.useCallback(_=>{var E;(E=y.current)==null||E.awareness.setLocalStateField("currentSlideId",_)},[]),N=l.useCallback(_=>{var E;(E=y.current)==null||E.awareness.setLocalStateField("editingElementId",_)},[]),C=l.useCallback(_=>{var E,j;_?(E=y.current)==null||E.awareness.setLocalStateField("cursor",{..._,timestamp:Date.now()}):(j=y.current)==null||j.awareness.setLocalStateField("cursor",null)},[]),w=l.useCallback(_=>{var E;(E=y.current)==null||E.awareness.setLocalStateField("selection",_)},[]),v=l.useCallback(()=>{var _;(_=f.current)==null||_.undo()},[]),A=l.useCallback(()=>{var _;(_=f.current)==null||_.redo()},[]),O=l.useCallback(()=>{var _;(_=y.current)==null||_.connect()},[]),$=l.useCallback(()=>{var _;(_=y.current)==null||_.disconnect()},[]),L=l.useCallback(_=>{const E=m.current;if(!E){g(Y=>({...Y,document:_}));return}const j=E.getArray("slides"),H=E.getMap("meta");Ce(_,j,H,E)},[]),X=l.useCallback(()=>x.document,[x.document]);return{state:x,actions:{addSlide:b,updateSlide:S,deleteSlide:h,reorderSlides:I,addElement:R,updateElement:z,deleteElement:F,updateTheme:Q,updateMetadata:T,setTitle:P,setCurrentSlide:q,setEditingElement:N,setCursor:C,setSelection:w,undo:v,redo:A,connect:O,disconnect:$,setDocument:L,getDocument:X}}}exports.BRAND_KIT_CORPORATE=gr;exports.BRAND_KIT_NICE2DEV=yr;exports.BRAND_KIT_STARTUP=xr;exports.BUILT_IN_TRANSITIONS=lt;exports.BackgroundRenderer=ft;exports.CharacterRegistry=$e;exports.DEFAULT_KPI_COLORS=_t;exports.DialogueBox=yt;exports.EffectRenderer=mt;exports.InteractiveButton=Ji;exports.InteractiveCountdown=no;exports.InteractivePoll=eo;exports.InteractiveQnA=io;exports.InteractiveQuiz=to;exports.NiceI18nProvider=Fe;exports.NicePresentationEditor=We;exports.NicePresentationPlayer=Ve;exports.NicePresentationToolbar=be;exports.NiceSlideCanvas=ae;exports.NiceSlidePropertyPanel=Se;exports.NiceSlideThumbnailList=we;exports.PresentationModel=ve;exports.PresentationToolbar=be;exports.PresentationVersionManager=Da;exports.PuppetAnimationController=pt;exports.PuppetCharacter=br;exports.PuppetSceneBuilder=Rr;exports.PuppetShowMiniPlayer=Wr;exports.PuppetShowPlayer=wt;exports.PuppetStage=ht;exports.SLIDE_16_9=Gt;exports.SLIDE_4_3=Jt;exports.SLIDE_WIDESCREEN=Zt;exports.SlideCanvas=ae;exports.SlideLibraryManager=Oa;exports.SlidePropertyPanel=Se;exports.SlideThumbnailList=we;exports.THEME_CORPORATE=He;exports.THEME_MINIMAL=tn;exports.THEME_MODERN_DARK=en;exports.THEME_NICE2DEV=nn;exports.TRANSITION_BLUR_FADE=it;exports.TRANSITION_CIRCLE_REVEAL=at;exports.TRANSITION_CUBE_LEFT=tt;exports.TRANSITION_FADE=Ue;exports.TRANSITION_FLIP_HORIZONTAL=Ze;exports.TRANSITION_FLIP_VERTICAL=et;exports.TRANSITION_GLITCH=st;exports.TRANSITION_MORPH=ct;exports.TRANSITION_ROTATE_IN=nt;exports.TRANSITION_SLIDE_DOWN=Xe;exports.TRANSITION_SLIDE_LEFT=Qe;exports.TRANSITION_SLIDE_RIGHT=Ke;exports.TRANSITION_SLIDE_UP=Ye;exports.TRANSITION_WIPE_LEFT=ot;exports.TRANSITION_WIPE_RIGHT=rt;exports.TRANSITION_ZOOM_IN=Ge;exports.TRANSITION_ZOOM_OUT=Je;exports.TimelineEngine=xt;exports.TimelineTrackBuilder=Tr;exports.addAnimationToCharacter=Ir;exports.addExpressionToCharacter=Cr;exports.applyBrandKit=fr;exports.applyEasing=co;exports.applyFiltersToData=ba;exports.applySortToData=va;exports.brandKitToTheme=ut;exports.calculateSummaryRow=Sa;exports.cloneTimeline=Er;exports.computeCustomTransitionState=ao;exports.computeElementState=Yt;exports.computeKPIStatus=la;exports.computeTransitionState=Be;exports.computeTrend=da;exports.createCharacterFromSpriteSheet=kr;exports.createComparisonWidget=ha;exports.createContactSlide=Va;exports.createCustomTransition=lo;exports.createCustomerCountWidget=Tt;exports.createDashboardSlide=ca;exports.createDataGridSlide=xa;exports.createEmployeeDataGrid=Ca;exports.createExecutiveDashboard=ya;exports.createFeedbackSlide=Ba;exports.createKQLQuerySlide=Na;exports.createMultiQRSlide=Qa;exports.createODataQuerySlide=Pa;exports.createOperationalDashboard=ga;exports.createPercentageGauge=pa;exports.createPollSlide=Ha;exports.createPresentationLinkSlide=Wa;exports.createQRCodeSlide=La;exports.createQuerySlide=Ma;exports.createRevenueWidget=zt;exports.createSalesDataGrid=Ia;exports.createSalesQuerySlide=Ea;exports.createSampleArchitectureData=Qo;exports.createSampleIncidentReportData=pr;exports.createSampleOnboardingData=tr;exports.createSampleProductPitchData=To;exports.createSampleQuarterlyReportData=wo;exports.createSampleSprintReviewData=jo;exports.createSparklineTrend=fa;exports.createSpriteSheetFromFrames=Ur;exports.createTrafficLight=ma;exports.createWiFiSlide=Ua;exports.detectBestVisualization=Ta;exports.easingFunctions=le;exports.encodeQRContent=Rt;exports.exportCharacterToEntity=Vr;exports.exportCharacterToSprite=Mt;exports.exportToHtml=De;exports.extractQueryParameters=Aa;exports.formatCellValue=wa;exports.formatKPIValue=ua;exports.formatTime=Or;exports.framesToTime=Dr;exports.generateArchitectureOverview=Uo;exports.generateChartConfig=Ra;exports.generateIncidentReport=ur;exports.generateOnboarding=er;exports.generateProductPitch=zo;exports.generateQuarterlyReport=So;exports.generateSprintReview=Fo;exports.getConditionalStyle=ka;exports.getEasingFunction=gt;exports.getSceneDuration=Pr;exports.getTrackDuration=vt;exports.importAssetAsProp=Ct;exports.importEntityAsCharacter=It;exports.importProjectCharacters=Br;exports.importProjectProps=Hr;exports.importSpriteAsCharacter=kt;exports.lerp=re;exports.lerpPosition=ke;exports.mapTransitionEffectToId=so;exports.mergePuppetShows=sa;exports.parseNdpJson=Dt;exports.parseSpriteSheetGrid=Qr;exports.parseTime=Fr;exports.presentationToPuppetShow=oa;exports.puppetShowToPresentation=Yr;exports.removeBrandKit=mr;exports.renderCharacterToCanvas=vr;exports.renderChartSvg=Le;exports.stringifyNdpJson=je;exports.substituteParameters=$a;exports.syncPresentationToYjs=Ce;exports.syncYjsToPresentation=Et;exports.timeToFrames=Nr;exports.transitionRegistry=dt;exports.transitionToKeyframes=uo;exports.useCameraShake=zr;exports.useCharacterRegistry=wr;exports.useCollaborativePresentation=Ya;exports.useNiceTranslation=xe;exports.usePresentationEditor=qe;exports.usePuppetAnimation=Sr;exports.usePuppetPlayer=jr;exports.usePuppetShowPlayer=St;exports.usePuppetStage=Ar;exports.validateParameters=za;exports.validateProjectForImport=Kr;exports.validatePuppetShowDocument=aa;