# Entry point for the site's front end (MicroPython under PyScript, loaded by Base.astro).
# The HTML is complete without it: every module enhances markup Astro already rendered, and
# each mount() returns quietly when its component is not on the page.
from js import window
from w76 import origami, nav, letter, fold, contact

for module in (origami, nav, letter, fold, contact):   # origami first: the others call it
    try:
        module.mount()
    except Exception as e:
        # One broken component must not take the others down with it.
        print("w76:", module.__name__, "failed:", e)

# Base.astro holds any form submit that arrives before this point (instead of letting it
# fall through as a native GET); from here on the contact module owns submit.
window.__w76py = True
