System.register(["cc"], function (_export, _context) {
  "use strict";

  var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, _dec, _class, _class2, _crd, ccclass, property, eventEmitter;

  return {
    setters: [function (_cc) {
      _cclegacy = _cc.cclegacy;
      __checkObsolete__ = _cc.__checkObsolete__;
      __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
      _decorator = _cc._decorator;
      Component = _cc.Component;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "d4352QE+FZC6aizeUpNJKdK", "eventEmitter", undefined);

      __checkObsolete__(['_decorator', 'Component', 'Node']);

      ({
        ccclass,
        property
      } = _decorator);

      _export("eventEmitter", eventEmitter = (_dec = ccclass("eventEmitter"), _dec(_class = (_class2 = class eventEmitter extends Component {
        static on(eventName, cb, target) {
          if (!this.handle[eventName]) {
            this.handle[eventName] = [];
          }

          const data = {
            func: cb,
            target
          };
          this.handle[eventName].push(data);
        }

        static off(eventName, cb, target) {
          const list = this.handle[eventName];

          if (!list || list.length <= 0) {
            return;
          }

          for (let i = 0; i < list.length; i++) {
            const event = list[i];

            if (event.func === cb && (!target || target === event.target)) {
              list.splice(i, 1);
              break;
            }
          }
        }

        static emit(eventName, ...args) {
          const list = this.handle[eventName];

          if (!list || list.length <= 0) {
            return;
          }

          for (let i = 0; i < list.length; i++) {
            const event = list[i];
            event.func.apply(event.target, args);
          }
        }

      }, _class2.handle = {}, _class2)) || _class));

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=23100424a8e9ce5ba050e345590c67b06271f9ae.js.map