let _listenerCallbackTuple;export class ObjectWrapper{constructor(){this._listeners}addEventListener(e,s,t){s||console.assert(!1),this._listeners||(this._listeners=new Map),this._listeners.has(e)||this._listeners.set(e,[]);const i=this._listeners.get(e);return i&&i.push({thisObject:t,listener:s,disposed:void 0}),{eventTarget:this,eventType:e,thisObject:t,listener:s}}once(e){return new Promise((s=>{const t=this.addEventListener(e,(i=>{this.removeEventListener(e,t.listener),s(i.data)}))}))}removeEventListener(e,s,t){if(console.assert(Boolean(s)),!this._listeners||!this._listeners.has(e))return;const i=this._listeners.get(e)||[];for(let n=0;n<i.length;++n)i[n].listener===s&&i[n].thisObject===t&&(i[n].disposed=!0,i.splice(n--,1));i.length||this._listeners.delete(e)}hasEventListeners(e){return Boolean(this._listeners&&this._listeners.has(e))}dispatchEventToListeners(e,s){if(!this._listeners||!this._listeners.has(e))return;const t={data:s},i=this._listeners.get(e).slice(0)||[];for(let n=0;n<i.length;++n)i[n].disposed||i[n].listener.call(i[n].thisObject,t)}}