import { EventType as e } from "../../../types/hinkal.types.mjs";
import "../../../types/index.mjs";
//#region libs/shared/common/src/functions/web3/events/balanceChangedHandler.ts
var t = /* @__PURE__ */ new Set(), n = (n) => {
	if (typeof document < "u") {
		let t = (e) => {
			e instanceof CustomEvent ? n(e.detail ?? {}) : n({});
		};
		return document.addEventListener(e.BalanceChange, t), () => document.removeEventListener(e.BalanceChange, t);
	}
	return t.add(n), () => {
		t.delete(n);
	};
}, r = (n) => {
	let r = e.BalanceChange, i = new CustomEvent(r, { detail: n });
	typeof document < "u" ? document.dispatchEvent(i) : t.forEach((e) => {
		e(n);
	});
};
//#endregion
export { r as balanceChangedHandler, n as subscribeToBalanceChange };
