import { jsx as _jsx } from "react/jsx-runtime";
import { useEffect } from "react";
var PACKAGE_NAME = "@wormhole-foundation/wormhole-connect";
var DEFAULT_VERSION = "0.0.12" || "latest";
function WormholeBridge(_a) {
    var config = _a.config, _b = _a.versionOrTag, versionOrTag = _b === void 0 ? DEFAULT_VERSION : _b;
    useEffect(function () {
        var script = document.createElement("script");
        script.src = "https://www.unpkg.com/".concat(PACKAGE_NAME, "@").concat(versionOrTag, "/dist/main.js");
        script.async = true;
        var link = document.createElement("link");
        link.href = "https://www.unpkg.com/".concat(PACKAGE_NAME, "@").concat(versionOrTag, "/dist/main.css");
        document.body.appendChild(script);
        document.body.appendChild(link);
        return function () {
            script.remove();
            link.remove();
        };
    }, [versionOrTag]);
    return (_jsx("div", { id: "wormhole-connect", 
        //@ts-ignore
        config: config ? JSON.stringify(config) : null }));
}
export * from "./theme";
export * from "./types";
export default WormholeBridge;
