(function () {
// Apply the layout the parent tells us to, regardless of what this iframe
// thinks its own width is.
window.addEventListener('message', function (e) {
if (!e.data || e.data.type !== 'ria-layout') return;
var wrapper = document.querySelector('.component-wrapper');
if (wrapper) wrapper.classList.toggle('is-mobile', !!e.data.isMobile);
});
// Announce we're listening so the parent replies with the current state —
// covers the case where the parent's first message fired before we loaded.
if (window.parent && window.parent !== window) {
window.parent.postMessage({ type: 'ria-ready' }, '*');
}
})();