//#region src/libs/event-bus.ts
/**
* Creates a ClientEvent with a payload of type P
*
* Modified from `@vueuse/core/useEventBus`
* @see https://github.com/vueuse/vueuse/tree/v10.10.0/packages/core/useEventBus
*/
function createEventBus() {
	const listeners = /* @__PURE__ */ new Set();
	function on(listener) {
		listeners.add(listener);
		const _off = () => off(listener);
		return _off;
	}
	function once(listener) {
		function _listener(...args) {
			off(_listener);
			listener(...args);
		}
		return on(_listener);
	}
	function off(listener) {
		listeners.delete(listener);
	}
	function reset() {
		listeners.clear();
	}
	function emit(payload) {
		listeners?.forEach((v) => v(payload));
	}
	return {
		on,
		once,
		off,
		emit,
		reset,
		listeners: () => Array.from(listeners)
	};
}
//#endregion
export { createEventBus };

//# sourceMappingURL=event-bus.js.map