import { render as diff, h } from './render.js';
import { options } from './options.js';

/**
 * @template {Element} T
 * @param {any} vnode
 * @param {DocumentFragment} [base]
 * @returns {T}
 */
const template = (
    vnode,
    base = !options.ssr && document.createElement("template").content
) =>
    //@ts-ignore
    base ? diff(h("host", null, vnode), base).children[0] : vnode;

export { template };
