class t{constructor(t,s){this.size=0,this.map=new Map,t&&(this.map=t,this.size=t.size),"function"==typeof s&&(this.onMutate=s)}has(t){return this.map.has(t)}keys(){return this.map.keys()}set(t,s){return this.withMutation((e=>{e.set(t,s)}))}get(t){return this.map.get(t)}values(){return this.map.values()}delete(t){return this.withMutation((s=>{s.delete(t)}))}clear(t=!0){return t?this.withMutation((t=>{t.clear()})):(Array.from(this.keys()).forEach((t=>{this.map.delete(t)})),this.size=0,this)}onMutate(t){}withMutation(s){const e=new Map(this.map);s(e);const i=new t(e,this.onMutate);return this.onMutate(i),i}}export{t as I}