import pluginMain, { DEFAULT_TILE_SERVER } from "./lib/plugin_index.js";

export default async function(IMap) {
    return class MapImpl extends IMap {
        constructor(response, { map, $page }) {
            super();
            this.response = JSON.parse(new TextDecoder().decode(response));

            window.L.tileLayer(DEFAULT_TILE_SERVER, { maxZoom: 21 }).addTo(map);
            pluginMain({ map, $page });
        }

        async toGeoJSON() {
            return this.response;
        }
    }
}
