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