import {
  renderTable
} 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 "./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";

// filter/tvs.samplelst.js
var handler = {
  term_name_gen,
  get_pill_label,
  fillMenu,
  getSelectRemovePos,
  getNegateText(self) {
    return self.tvs.isnot ? "NOT IN" : "IN";
  }
};
async function fillMenu(self, div, tvs) {
  tvs = JSON.parse(JSON.stringify(tvs));
  div.selectAll("*").remove();
  div = div.append("div");
  div.style("font-size", "0.8em");
  for (const field in tvs.term.values) {
    if (tvs.term.values[field].in === false) continue;
    addTable(div, tvs, field);
  }
  div.append("div").append("div").style("display", "inline-block").style("float", "right").style("padding", "6px 20px").append("button").attr("class", "sjpp_apply_btn sja_filter_tag_btn").text("Apply").on("click", () => {
    let firstGroup;
    for (const field in tvs.term.values) {
      const value = tvs.term.values[field];
      value.list = value.list.filter((s) => !("checked" in s) || s.checked);
    }
    self.opts.callback(tvs);
  });
}
function addTable(div, tvs, field) {
  div.style("padding", "6px").append("div").style("margin", "10px").style("font-size", "0.8rem").html(`<b> ${field}</b>.`);
  const value = tvs.term.values[field];
  const rows = [];
  for (const sample of value.list) rows.push([{ value: sample.sample }]);
  const columns = [{ label: "Sample" }];
  renderTable({
    rows,
    columns,
    div,
    maxWidth: "30vw",
    maxHeight: "40vh",
    noButtonCallback: (index, node) => {
      value.list[index].checked = node.checked;
    },
    striped: false,
    showHeader: false,
    selectAll: true
  });
}
function getSelectRemovePos(j) {
  return j;
}
function term_name_gen() {
  return "Samples";
}
function get_pill_label(tvs) {
  return { txt: getGroupLabel(tvs.term) };
}
function getGroupLabel(term) {
  let n = 0;
  for (const item in term.values) {
    if (term.values[item].in === false) continue;
    n += term.values[item].list.length;
  }
  return `${term.name} n=${n}`;
}
export {
  addTable,
  handler
};
//# sourceMappingURL=tvs.samplelst-LCXSU5MG.js.map
