// filter/rehydrateFilter.js
function rehydrateFilter(filter, vocabApi, proms = []) {
  if (Object.isFrozen(filter)) throw "filter obj is frozen, unable to rehydrate and modify";
  if (filter.type == "tvslst") {
    for (const f of filter.lst) rehydrateFilter(f, vocabApi, proms);
  } else if (filter.type == "tvs") {
    if (typeof filter.tvs?.term != "object") throw "a tvs lacks structure of .tvs.term{}";
    if (filter.tvs.term.id && !filter.tvs.term.name) {
      proms.push(
        vocabApi.getterm(filter.tvs.term.id).then((term) => {
          filter.tvs.term = term;
        })
      );
    }
  } else {
    throw `cannot rehydrate filter.type='${filter.type}'`;
  }
  return proms;
}

export {
  rehydrateFilter
};
//# sourceMappingURL=chunk-SKMFMGCD.js.map
