import { n as useTranslation } from "../i18n-DoP1NB7u.js";
import { _ as y, v as u } from "../vendor-preact-DThS2ZQ_.js";
import { c as useManager, o as useModuleTerminalCallbacks } from "../hooks-Da_yP_Dr.js";
import { t as IncodeComponent } from "../incodeComponent-CCP7GTMj.js";
import { t as LoadingIcon } from "../loadingIcon-B0ysgiNq.js";
import { t as SuccessIcon } from "../successIcon-B5mGvdx1.js";
import { t as registerIncodeModuleElement } from "../incodeModule-M8DszCee.js";
import { t as StatusPage } from "../statusPage-BUm5gtQY.js";
import { createWatchlistManager } from "@incodetech/core/watchlist";
//#region src/modules/watchlist/watchlist.tsx
var WatchlistContent = ({ onFinish }) => {
	const { t } = useTranslation();
	const [state, manager] = useManager(() => createWatchlistManager());
	y(() => {
		manager.load();
	}, [manager]);
	useModuleTerminalCallbacks({
		status: state.status === "finished" ? "finished" : "loading",
		onFinish
	});
	if (state.status === "success") return /* @__PURE__ */ u(StatusPage, {
		variant: "success",
		icon: /* @__PURE__ */ u(SuccessIcon, { size: 64 }),
		title: t("watchList.complete")
	});
	return /* @__PURE__ */ u(StatusPage, {
		variant: "loading",
		icon: /* @__PURE__ */ u(LoadingIcon, { size: 64 }),
		title: t("watchList.processing"),
		subtitle: t("watchList.wontTake")
	});
};
var Watchlist = ({ onFinish }) => /* @__PURE__ */ u(IncodeComponent, { children: /* @__PURE__ */ u(WatchlistContent, { onFinish }) });
registerIncodeModuleElement(Watchlist, "incode-watchlist");
//#endregion
export { Watchlist };
