import { buildAdvanced } from "./buildAdvanced.js";
import { buildSpec } from "./buildSpec.js";
import { build } from "./build.js";
import { prepare } from "./prepare.js";
import { intl } from "../../i18n/index.js";
import { getColorIdMap, getColorItems, getColorValueMap } from "./advanced/index.js";
class Builder {
    _vseed;
    _advancedVSeed = null;
    _spec = null;
    _performance = {};
    _locale;
    _isPrepared = false;
    constructor(vseed){
        this._vseed = vseed;
        this._locale = vseed.locale || intl.getLocale();
    }
    get locale() {
        return this._locale;
    }
    prepare = async ()=>prepare(this);
    build = ()=>build(this);
    buildSpec = (advanced)=>buildSpec(this, advanced);
    buildAdvanced = ()=>buildAdvanced(this);
    getColorItems = ()=>getColorItems(this);
    getColorIdMap = ()=>getColorIdMap(this);
    getColorValueMap = ()=>getColorValueMap(this);
    get vseed() {
        return this._vseed;
    }
    set vseed(value) {
        this._vseed = value;
        this._isPrepared = false;
    }
    get isPrepared() {
        return this._isPrepared;
    }
    set isPrepared(value) {
        this._isPrepared = value;
    }
    get advancedVSeed() {
        return this._advancedVSeed;
    }
    set advancedVSeed(value) {
        this._advancedVSeed = value;
    }
    get spec() {
        return this._spec;
    }
    set spec(value) {
        this._spec = value;
    }
    get performance() {
        return this._performance;
    }
    set performance(value) {
        this._performance = value;
    }
    static getAdvancedPipeline = (chartType)=>{
        const customPipe = Builder._customAdvancedPipe[chartType];
        const originalPipeline = Builder._advancedPipelineMap[chartType];
        if (!originalPipeline) return originalPipeline;
        const pipeline = [
            ...originalPipeline
        ];
        if (customPipe) pipeline.push(customPipe);
        return pipeline;
    };
    static getSpecPipeline = (chartType)=>{
        const customPipe = Builder._customSpecPipe[chartType];
        const originalPipeline = Builder._specPipelineMap[chartType];
        if (!originalPipeline) return originalPipeline;
        const pipeline = [
            ...originalPipeline
        ];
        if (customPipe) pipeline.push(customPipe);
        return pipeline;
    };
    static getTheme = (themeKey)=>Builder._themeMap[themeKey || 'light'];
    static getThemeMap = ()=>Builder._themeMap;
    static from = (vseed)=>new Builder(vseed);
    static registerAdvancedPipeline = (chartType, pipeline)=>{
        Builder._advancedPipelineMap[chartType] = pipeline;
    };
    static registerSpecPipeline = (chartType, pipeline)=>{
        Builder._specPipelineMap[chartType] = pipeline;
    };
    static updateAdvanced = (chartType, pipe)=>{
        Builder._customAdvancedPipe[chartType] = pipe;
    };
    static updateSpec = (chartType, pipe)=>{
        Builder._customSpecPipe[chartType] = pipe;
    };
    static registerTheme = (key, theme)=>{
        Builder._themeMap[key] = theme;
    };
    static _advancedPipelineMap = {};
    static _specPipelineMap = {};
    static _customAdvancedPipe = {};
    static _customSpecPipe = {};
    static _themeMap = {};
}
export { Builder };

//# sourceMappingURL=builder.js.map