var t = require; var e = module; var i = exports; Object.defineProperty(i, "__esModule", {value: !0}), (i.RedPointMgr = void 0); class s { constructor() { (this.types = {}), (this._observerList = {}), (this._observerGroupMap = new Map()), (this.types = s.types); } next(e, ...i) { if (this._observerList[e]) { this._observerList[e].args = i; var s = this._observerList[e].funcs.length; for (let t = 0; t < s; t++) this._observerList[e].funcs[t].apply(this._observerList[e].targets[t], i); } else this._observerList[e] = {targets: [], funcs: [], args: i}; } subscribeGroup(t, e, i) { this._observerGroupMap.has(i); let s = 0, o = () => { s = 0; for (const e of t) if (this._observerList[e] && this._observerList[e].args) { const t = this._observerList[e].args[0]; "number" == typeof t ? (s += t) : (s = t || s); } e.call(i, s); }; for (const a of t) this.subscribe(a, o, null, !1); this._observerGroupMap.set(i, {types: t, func: o}), o.call(i, !1); } unsubscribeGroup(t) { var e = this._observerGroupMap.get(t); if (e) { this._observerGroupMap.delete(t); var i = e.types.length; for (let t = 0; t < i; t++) this.unsubscribe(e.types[t], e.func, null); } } subscribe(t, e, i, s = !0) { this._observerList[t] ? (-1 < this._observerList[t].funcs.indexOf(e) && -1 < this._observerList[t].targets.indexOf(i)) || (this._observerList[t].funcs.push(e), this._observerList[t].targets.push(i), s && this._observerList[t].args && this._observerList[t].args.length && e.apply(i, this._observerList[t].args)) : (this._observerList[t] = {args: null, targets: [i], funcs: [e]}); } unsubscribe(e, i, s) { if (this._observerList[e]) { var o = this._observerList[e], a = o.funcs.length; for (let t = 0; t < a; t++) if (o.targets[t] === s && o.funcs[t] === i) { this._observerList[e].funcs.splice(t, 1), this._observerList[e].targets.splice(t, 1); break; } } } } (i.RedPointMgr = s).types = {};