(async()=>{ const assert=(ok,msg)=>{if(!ok)throw Error(msg)},delay=ms=>new Promise(r=>setTimeout(r,ms)); const wait=async fn=>{for(let n=0;n<300;n++){if(fn())return;await delay(25)}throw Error('Timeout '+fn)}; const ready=()=>document.querySelector('.slides-frame[data-ready=true]'); await wait(()=>window.PagesSlides); const e=window.PagesEditor; if(e){await wait(()=>document.querySelector('[data-editor-action=slides]')&&e.preview);e.paused=true;document.querySelector('[data-editor-action=slides]').click();} await wait(ready); const frame=ready(),source=e?.text(),historyLength=history.length; assert(frame.dataset.count==='2','Wrong slide count'); assert(frame.sandbox.contains('allow-scripts')&&!frame.sandbox.contains('allow-same-origin'),'Isolation missing'); let isolated=false;try{isolated=!frame.contentDocument}catch{isolated=true}assert(isolated,'Frame can access parent origin'); assert(frame.getBoundingClientRect().height>=240,'Slide frame collapsed'); assert(frame.getBoundingClientRect().width<=innerWidth,'Mobile slide overflow'); const playback=frame.parentElement.querySelector('.slides-playback'),play=playback.querySelector('button'),seconds=playback.querySelector('input[type=number]'),loop=playback.querySelector('input[type=checkbox]'); assert(play.disabled===false&&play.getAttribute('aria-pressed')==='false','Slideshow should start paused'); seconds.value='0';seconds.dispatchEvent(new Event('change'));assert(frame.parentElement.dataset.slidePlaying!=='true','Invalid interval started slideshow'); seconds.value='1';seconds.dispatchEvent(new Event('change'));play.click(); await wait(()=>frame.parentElement.dataset.slideIndex==='1'); await wait(()=>play.getAttribute('aria-pressed')==='false'); assert(frame.parentElement.dataset.slideIndex==='1','Non-loop slideshow did not stop at final slide'); loop.checked=true;loop.dispatchEvent(new Event('change'));play.click(); await wait(()=>frame.parentElement.dataset.slideIndex==='0'); await wait(()=>frame.parentElement.dataset.slideIndex==='1'); play.click();await wait(()=>play.getAttribute('aria-pressed')==='false'); const stoppedIndex=frame.parentElement.dataset.slideIndex;await delay(1150);assert(frame.parentElement.dataset.slideIndex===stoppedIndex,'Paused slideshow advanced'); window.postMessage({type:'slides-playback',playing:true,token:'invalid'},'*');await delay(30);assert(play.getAttribute('aria-pressed')==='false','Untrusted playback message accepted'); if(e&&innerWidth<=700){assert(getComputedStyle(document.querySelector('.editor-pane')).display==='none','Mobile preview not full width');setEditorPreviewVisible(false);assert(getComputedStyle(document.querySelector('.editor-pane')).display!=='none','Mobile source inaccessible');setEditorPreviewVisible(true);} const host=frame.parentElement; host.dataset.slideIndex='0'; // Verify the defensive DOM boundary independently of server sanitization. PagesSlides.render(host,'

Safe