/*! © 2026 Yahoo, Inc. UDS Tailwind and Purger v0.0.0-development */
require("../_virtual/_rolldown/runtime.cjs");
const require_purgeFromCode = require("../purger/optimized/purgeFromCode.cjs");
let node_worker_threads = require("node:worker_threads");
//#region src/css/purgeWorker.ts
let sharedConfig = null;
node_worker_threads.parentPort?.on("message", async (msg) => {
	if (msg.type === "init") {
		sharedConfig = msg.config;
		node_worker_threads.parentPort?.postMessage({ type: "ready" });
		return;
	}
	if (msg.type === "task") {
		if (!sharedConfig) {
			node_worker_threads.parentPort?.postMessage({
				type: "error",
				id: msg.id,
				error: "Worker not initialized"
			});
			return;
		}
		try {
			const result = await require_purgeFromCode.purgeFromCodeOptimized(msg.code, {
				...sharedConfig,
				colorModes: msg.colorModes,
				variantDefaults: msg.variantDefaults,
				runtimeConfigValues: msg.runtimeConfigValues,
				includeAllClassNamePrimitives: msg.includeAllClassNamePrimitives,
				filePath: msg.filePath
			});
			node_worker_threads.parentPort?.postMessage({
				type: "result",
				id: msg.id,
				result
			});
		} catch (error) {
			node_worker_threads.parentPort?.postMessage({
				type: "error",
				id: msg.id,
				error: error instanceof Error ? error.message : String(error)
			});
		}
		return;
	}
	if (msg.type === "done") process.exit(0);
});
//#endregion
