import {
  appInit
} from "./chunk-SA7APTJR.js";
import "./chunk-HJ6L54YS.js";
import "./chunk-LSEFWW72.js";
import "./chunk-SKREEF3H.js";
import "./chunk-HYOEWQ5P.js";
import "./chunk-HBW42TDT.js";
import "./chunk-G6O3URDN.js";
import "./chunk-FN5XPUPH.js";
import "./chunk-IIT367QZ.js";
import "./chunk-RZGEKL77.js";
import "./chunk-UI7OCM2A.js";
import "./chunk-YZK37YCC.js";
import "./chunk-7EMWHCVW.js";
import "./chunk-7IYJZZQI.js";
import {
  copyMerge,
  getCompInit
} from "./chunk-M3J4MINX.js";
import "./chunk-PF4DSFDR.js";
import "./chunk-QH6W3NVF.js";
import "./chunk-NOEAT6CX.js";
import "./chunk-4UWS5Y3N.js";
import "./chunk-DD4R5P6W.js";
import "./chunk-JNITUVXP.js";
import "./chunk-KSGA62R2.js";
import "./chunk-LOZEKOES.js";
import "./chunk-TOU7EVFQ.js";
import "./chunk-OAWQ6LOO.js";
import "./chunk-TLT4YIG3.js";
import "./chunk-KYBIQBXE.js";
import "./chunk-I6Y4O3RR.js";
import "./chunk-OMR2DT66.js";
import "./chunk-DQC5FFGV.js";
import "./chunk-HFNDKYVF.js";

// plots/dictionary.js
var MassDict = class _MassDict {
  static type = "tree";
  constructor(opts) {
    this.type = _MassDict.type;
    this.dom = {
      holder: opts.holder.style("padding", "20px"),
      header: opts.header
    };
  }
  async init(appState) {
    const config = appState.plots.find((p) => p.id === this.id) || {};
    const opts = {
      vocabApi: this.app.vocabApi,
      holder: this.dom.holder,
      state: this.getState(appState),
      tree: {
        click_term: (_term) => {
          const term = _term.term || _term;
          const _config = Object.assign({}, config?.spawnConfig, {
            chartType: term.type == "survival" ? "survival" : "summary",
            term: _term.term ? _term : { term }
          });
          this.app.dispatch({
            type: "plot_create",
            config: _config
          });
          this.app.dispatch({
            type: "plot_delete",
            id: this.id
          });
        }
      }
    };
    if (config?.tree?.usecase) {
      opts.tree.usecase = config.tree.usecase;
    }
    this.tree = await appInit(opts);
  }
  getState(appState) {
    const config = appState.plots.find((p) => p.id === this.id) || {};
    const tree = { usecase: { target: "dictionary" } };
    if (config?.tree?.usecase?.specialCase) {
      tree.usecase.specialCase = config.tree.usecase.specialCase;
    }
    return {
      tree,
      vocab: appState.vocab,
      activeCohort: appState.activeCohort,
      termfilter: appState.termfilter,
      selectdTerms: appState.selectedTerms,
      customTerms: appState.customTerms
    };
  }
  main() {
    if (this.dom.header) this.dom.header.text("Data Variables");
    this.tree.dispatch({
      type: "app_refresh",
      state: this.state
    });
  }
};
var dictInit = getCompInit(MassDict);
var componentInit = dictInit;
function getPlotConfig(opts, app) {
  const config = { hidePlotFilter: true };
  return copyMerge(config, opts);
}
export {
  componentInit,
  dictInit,
  getPlotConfig
};
//# sourceMappingURL=dictionary-RYM4WP2W.js.map
