/* App root — resilient mount: one failing section can never blank the whole page */
function Safe(name) {
  var Comp = window[name];
  if (typeof Comp !== 'function') return null;
  class B extends React.Component {
    constructor(p) { super(p); this.state = { e: false }; }
    componentDidCatch() { this.setState({ e: true }); }
    static getDerivedStateFromError() { return { e: true }; }
    render() { return this.state.e ? null : React.createElement(Comp); }
  }
  return React.createElement(B);
}

function App() {
  return (
    <>
      {Safe('Navigation')}
      <main>
        {Safe('Hero')}
        {Safe('ProductShowcase')}
        {Safe('About')}
        {Safe('BestSellers')}
        {Safe('Collections')}
        {Safe('DomsStrap')}
        {Safe('StarsSpeak')}
        {Safe('QuoteSection')}
        {Safe('Footer')}
      </main>
      {Safe('RocketJourney')}
    </>
  );
}

(function () {
  function mount() {
    try {
      ReactDOM.createRoot(document.getElementById('root')).render(<App />);
    } catch (err) {
      // last-ditch: surface something rather than a white page
      var r = document.getElementById('root');
      if (r && !r.childElementCount) r.innerHTML = '<div style="padding:80px 20px;text-align:center;font-family:sans-serif;color:#02528A">Loading DOMS…</div>';
      console.error(err);
    }
  }
  mount();
})();
