import { execPipeline } from "../../pipeline/index.js";
import { Builder } from "./builder.js";
import { intl } from "../../i18n/index.js";
const buildAdvanced = (builder)=>{
    const start = 'undefined' != typeof performance ? performance.now() : Date.now();
    const { chartType } = builder.vseed;
    if (!chartType) throw new Error('chartType is nil in buildAdvanced');
    const pipeline = Builder.getAdvancedPipeline(chartType);
    if (!pipeline) throw new Error(`please invoke registerAll or register ${chartType} before build, no advanced pipeline for chartType ${chartType}`);
    const context = {
        vseed: builder.vseed,
        customTheme: Builder.getThemeMap()
    };
    if (builder.locale) intl.setLocale(builder.locale);
    try {
        const advancedVSeed = execPipeline(pipeline, context);
        builder.advancedVSeed = advancedVSeed;
        return advancedVSeed;
    } catch (e) {
        throw new Error(`buildAdvanced error: ${e.message}`);
    } finally{
        const end = 'undefined' != typeof performance ? performance.now() : Date.now();
        builder.performance['buildAdvanced'] = `${(end - start).toFixed(4)}ms`;
    }
};
export { buildAdvanced };

//# sourceMappingURL=buildAdvanced.js.map