import { AbstractMermaidTokenBuilder as e, CommonValueConverter as t, EmptyFileSystem as n, EventModelingGeneratedModule as r, MermaidGeneratedSharedModule as i, __name as a, createDefaultCoreModule as o, createDefaultSharedCoreModule as s, inject as c } from "./chunk-NNHCCRGN.js";
//#region ../../node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-N66VUXT2.mjs
var l = class extends e {
	static {
		a(this, "EventModelingTokenBuilder");
	}
	constructor() {
		super(["eventmodeling"]);
	}
}, u = /* @__PURE__ */ new Set(["cmd", "command"]), d = /* @__PURE__ */ new Set(["evt", "event"]), f = /* @__PURE__ */ new Set(["rmo", "readmodel"]), p = /* @__PURE__ */ new Set(["pcr", "processor"]), m = /* @__PURE__ */ new Set(["ui"]);
function h(e) {
	let t = e.validation.EventModelingValidator, n = e.validation.ValidationRegistry;
	if (n) {
		let e = {
			EmTimeFrame: t.checkSourceFrameTypes.bind(t),
			EmResetFrame: t.checkSourceFrameTypes.bind(t)
		};
		n.register(e, t);
	}
}
a(h, "registerValidationChecks");
var g = class {
	static {
		a(this, "EventModelingValidator");
	}
	checkSourceFrameTypes(e, t) {
		e.sourceFrames.length !== 0 && (u.has(e.modelEntityType) ? this.validateSources(e, /* @__PURE__ */ new Set([...m, ...p]), "command", "ui or processor", t) : d.has(e.modelEntityType) ? this.validateSources(e, u, "event", "command", t) : f.has(e.modelEntityType) ? this.validateSources(e, d, "read model", "event", t) : p.has(e.modelEntityType) ? this.validateSources(e, f, "processor", "read model", t) : m.has(e.modelEntityType) && this.validateSources(e, f, "ui", "read model", t));
	}
	validateSources(e, t, n, r, i) {
		for (let a of e.sourceFrames) {
			let o = a.ref;
			o !== void 0 && !t.has(o.modelEntityType) && i("error", `A ${n} can only receive input from a ${r}, not from '${o.modelEntityType}'.`, {
				node: e,
				property: "sourceFrames"
			});
		}
	}
}, _ = {
	parser: {
		TokenBuilder: /* @__PURE__ */ a(() => new l(), "TokenBuilder"),
		ValueConverter: /* @__PURE__ */ a(() => new t(), "ValueConverter")
	},
	validation: { EventModelingValidator: /* @__PURE__ */ a(() => new g(), "EventModelingValidator") }
};
function v(e = n) {
	let t = c(s(e), i), a = c(o({ shared: t }), r, _);
	return t.ServiceRegistry.register(a), h(a), {
		shared: t,
		EventModel: a
	};
}
a(v, "createEventModelingServices");
//#endregion
export { _ as EventModelingModule, v as createEventModelingServices };

//# sourceMappingURL=chunk-N66VUXT2.js.map