import{notifyChange as e,onWatch as t,watch as i}from"../support/observableUtils.js";import{ReadOnlyCollection as a}from"./ReadOnlyCollection.js";export class MapTransformCollection extends a{get _collection(){return this._originalCollection.map(this._callback)}_callback;_originalCollection;constructor(a,s){super(),this._callback=s,this._originalCollection=a,this._handles.add([a.on("change",(e=>{this.hasEventListener("change")&&this.emit("change",{added:e.added.map(this._callback),removed:e.removed.map(this._callback),moved:e.moved.map(this._callback)})})),a.on("before-add",(e=>{this.hasEventListener("before-add")&&this.emit("before-add",{...e,item:this._callback(e.item)})})),a.on("before-remove",(e=>{this.hasEventListener("before-remove")&&this.emit("before-remove",{...e,item:this._callback(e.item)})})),a.on("after-add",(e=>{this.hasEventListener("after-add")&&this.emit("after-add",{...e,item:this._callback(e.item)})})),a.on("after-remove",(e=>{this.hasEventListener("after-remove")&&this.emit("after-remove",{...e,item:this._callback(e.item)})})),a.on("after-changes",(e=>{this.hasEventListener("after-changes")&&this.emit("after-changes",{...e})})),t(this,"length",(()=>i(this._originalCollection,"length",(()=>e(this,"length")),{sync:!0})))])}}