import { SHJDatasourceV2 as m } from "../index.mjs";
import { DataSourceUtils as n } from "../utils/utils.mjs";
const l = (e, t, c) => new Promise(function(a, u) {
  if (!e.source.storage) {
    a(n.noneData(t));
    return;
  }
  const { getType: o, getField: r } = e.source.storage;
  if (o === 0) {
    a(n.noneData(t));
    return;
  }
  if (!r) {
    a(n.noneData(t));
    return;
  }
  let s = null;
  o === 1 && (s = localStorage.getItem("Local_" + r)), o === 2 && (s = sessionStorage.getItem("Session_" + r));
  const { filter: i, mapping: g, isUserdata: p } = e.source;
  m.processData(i, s, g, t, e.source.dynamicMapping, c, p).then((f) => {
    a(f);
  }).catch(() => {
    a(n.noneData(t));
  });
});
export {
  l as parseStorage
};
