import { GlobalStateService as e } from "../services/global.service.js";
import { defineElement as t, supportsScopedRegistry as n } from "../utils/dom.js";
//#region src/internal/decorators/scoped-registry.ts
var r = /* @__PURE__ */ new WeakSet();
function i(e, t) {
	return { importNode: (n, r = !1) => e.importNode(n, {
		customElementRegistry: t,
		selfOnly: !r
	}) };
}
function a(e, t) {
	if (r.has(e)) return;
	let n = e.prototype, a = n.createRenderRoot;
	a && (r.add(e), Object.defineProperty(n, "createRenderRoot", {
		configurable: !0,
		value() {
			let e = a.call(this);
			return e instanceof ShadowRoot && (this.renderOptions ??= {}, this.renderOptions.creationScope = i(e.ownerDocument, t)), e;
		}
	}));
}
function o() {
	return (r) => {
		let i = r;
		e.state.scopedRegistry ??= {};
		let o = e.state.scopedRegistry[i.metadata.version] ?? customElements;
		n && (Object.defineProperty(i, "shadowRootOptions", {
			configurable: !0,
			value: {
				...i.shadowRootOptions ?? { mode: "open" },
				customElementRegistry: o
			}
		}), a(i, o)), t(i, o);
	};
}
//#endregion
export { o as scopedRegistry };

//# sourceMappingURL=scoped-registry.js.map