import { safeJsonStringify as e } from "./serialize.utils.mjs";
import { networkRegistry as t } from "../../constants/chains.constants.mjs";
import "idb-keyval";
//#region libs/shared/common/src/functions/utils/cacheFunctions.ts
var n = {
	encryptedOutputs: [],
	lastOutput: ""
}, r = (e, t) => ({
	shortPublicKey: e.substring(0, 25),
	shortHinkalAddress: t.substring(0, 25)
}), i = (e, t, n) => `hinkalCache-${e}-${t}-${n}`, a = (a, o, s) => {
	let { hinkalAddress: c } = t[o].contractData;
	if (!o || !s || !c) throw Error("GetHinkalCache: incorrect arguments");
	let { shortPublicKey: l, shortHinkalAddress: u } = r(s, c);
	return JSON.parse(a.cacheDevice.get(i(o, l, u)) ?? e(n));
}, o = (n, a, o, s) => {
	let { hinkalAddress: c } = t[o].contractData;
	if (!o || !s || !c) throw Error("SetHinkalCache: incorrect arguments");
	let { shortPublicKey: l, shortHinkalAddress: u } = r(s, c);
	a.cacheDevice.set(i(o, l, u), e(n));
}, s = (e, t, r) => {
	o(n, e, t, r);
};
//#endregion
export { i as getFilePath, a as getHinkalCache, s as resetCache, o as setHinkalCache };
