import { n as projectRemoteWidgetPackages } from "../build-widget-registry-CO8Mowhe.mjs";
import "../ScreenRenderer-BQz-1cCn.mjs";
import "../use-account-DR6HXMw_.mjs";
import "../use-optional-store-DpB_jK4Q.mjs";
import "../registry-context-l1jip-6W.mjs";
import "../WidgetInteractionContext-D8HZx_Gf.mjs";
import "../RepUserContext-CBe1s8qG.mjs";
import "../QuickLinksWidget-o7VeOJix.mjs";
import "../WidgetRenderStateContext-CksDoD6G.mjs";
import "../src-D-RDQG4A.mjs";
import "../use-share-link-Bmf5zcdA.mjs";
import "../translation-api-context-factory-oSEnOBmb.mjs";
import "../shell-translation-api-context-ghBBW7ju.mjs";
import "../error-state-BMPrAS3n.mjs";
import "../PointsWidget-7OpNqRDe.mjs";
import "../task-composer-form-DzVUCin2.mjs";
import "../LayoutWidget-ENLd1G__.mjs";
import { y as isPropertyFieldType } from "../registries-DXVOnKV2.mjs";
import "../fields-Cz7BkKd6.mjs";
import "../TextWidget-B-2RFD_g.mjs";
import "../AlertWidget-CdWJXZn1.mjs";
import "../BulletListWidget-DZrlNEa4.mjs";
import "../preview-context-DvXxVZ0z.mjs";
import "../CalendarWidget-BvXf1NlC.mjs";
import "../CardWidget-Bs0hqVjy.mjs";
import "../purify.es-CcYKK30Z.mjs";
import "../MediaRenderer-CLCBsSIU.mjs";
import "../CarouselWidget-BlS08Aru.mjs";
import "../CatchUpWidget-dROZKeGW.mjs";
import "../src-v1U7mjgR.mjs";
import "../ChartWidget-LcbtV1uD.mjs";
import "../ContainerWidget-bbzSrNUJ.mjs";
import "../EmbedWidget-DfhOZVCm.mjs";
import "../ImageWidget-B9gDlIyO.mjs";
import "../LinkWidget-BNZzqXbl.mjs";
import "../ListWidget-ChaESAly.mjs";
import "../MySiteWidget-CIFkSvEk.mjs";
import "../NestedWidget-CShcSb_k.mjs";
import "../QuickShareWidget-ujuaFstp.mjs";
import "../RecentActivityWidget-DUHVpA_j.mjs";
import "../SeparatorWidget-Cqzqs_G_.mjs";
import "../SpacerWidget-BJxZMWLm.mjs";
import "../TableWidget-CVN4Km00.mjs";
import "../ToDoWidget-DtM9JWAS.mjs";
import "../VideoWidget-Cv7ErMg9.mjs";
import "../ShopWidget-CwiD88Sr.mjs";
//#region src/utils/build-remote-widget-plugin-manifests.ts
/**
* Projects accepted canonical packages into builder manifests using the same
* package-atomic acceptance pass as the runtime registry.
*/
function buildRemoteWidgetPluginManifests(packages, hostOptions = {}) {
	const { warningSink, ...registryOptions } = hostOptions;
	return projectRemoteWidgetPackages({}, packages, registryOptions, warningSink ?? console.warn).acceptedWidgets.map(({ widget, component }) => toWidgetManifest(widget, component));
}
function toWidgetManifest(widget, component) {
	const resizable = toResizable(widget.resizable);
	return {
		manifestVersion: 1,
		type: widget.type,
		component,
		displayName: widget.displayName,
		description: widget.description,
		icon: widget.icon,
		category: widget.category,
		propertySchema: normalizePropertySchema(widget),
		defaultProps: { ...widget.defaultProps },
		minSdkVersion: widget.minSdkVersion,
		...resizable === void 0 ? {} : { resizable }
	};
}
function normalizePropertySchema(widget) {
	const fields = Array.isArray(widget.propertySchema.fields) ? widget.propertySchema.fields.filter(isPropertyField) : [];
	return {
		...widget.propertySchema,
		widgetType: widget.type,
		displayName: typeof widget.propertySchema.displayName === "string" ? widget.propertySchema.displayName : widget.displayName,
		fields
	};
}
function toResizable(resizable) {
	if (resizable === false) return void 0;
	if (resizable === true || resizable === "both") return {
		horizontal: true,
		vertical: true
	};
	return resizable === "horizontal" ? { horizontal: true } : { vertical: true };
}
function isPropertyField(value) {
	return typeof value === "object" && value !== null && "key" in value && typeof value.key === "string" && "label" in value && typeof value.label === "string" && "type" in value && typeof value.type === "string" && isPropertyFieldType(value.type);
}
//#endregion
export { buildRemoteWidgetPluginManifests };

//# sourceMappingURL=build-remote-widget-plugin-manifests.mjs.map