<script lang="ts">
  import { onDestroy, onMount } from 'svelte';
  import '../app.css';
  let { children } = $props();

  let mounted = $state(false);
  onMount(async () => {
    (globalThis as any).browser = (
      await import('webextension-polyfill')
    ).default;
    mounted = true;
  });
  onDestroy(() => (mounted = false));
</script>

{#if mounted}
  {@render children()}
{:else}
  <p>Waiting on Mount</p>
{/if}
