import { reactive as e } from "vue";
import { debounce as t } from "@milaboratories/helpers";
function n(n) {
	let r = e({
		isLoading: !1,
		result: void 0,
		error: void 0,
		async run(...e) {
			this.isLoading = !0, this.error = void 0;
			try {
				this.result = await n(...e);
			} catch (e) {
				this.error = e;
			} finally {
				this.isLoading = !1;
			}
		},
		debounce(e, n = 1e3) {
			return t(() => {
				let t = e();
				this.run(...t).catch(console.error);
			}, n);
		}
	});
	return r.run = r.run.bind(r), r;
}
export { n as useQuery };

//# sourceMappingURL=useQuery.js.map