function o(n){this.content=n}o.prototype={constructor:o,find:function(n){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===n)return t;return-1},get:function(n){var t=this.find(n);return t==-1?void 0:this.content[t+1]},update:function(n,t,e){var c=e&&e!=n?this.remove(e):this,r=c.find(n),i=c.content.slice();return r==-1?i.push(e||n,t):(i[r+1]=t,e&&(i[r]=e)),new o(i)},remove:function(n){var t=this.find(n);if(t==-1)return this;var e=this.content.slice();return e.splice(t,2),new o(e)},addToStart:function(n,t){return new o([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new o(e)},addBefore:function(n,t,e){var c=this.remove(t),r=c.content.slice(),i=c.find(n);return r.splice(i==-1?r.length:i,0,t,e),new o(r)},forEach:function(n){for(var t=0;t<this.content.length;t+=2)n(this.content[t],this.content[t+1])},prepend:function(n){return n=o.from(n),n.size?new o(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=o.from(n),n.size?new o(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=o.from(n);for(var e=0;e<n.content.length;e+=2)t=t.remove(n.content[e]);return t},toObject:function(){var n={};return this.forEach(function(t,e){n[t]=e}),n},get size(){return this.content.length>>1}};o.from=function(n){if(n instanceof o)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new o(t)};export{o as e};
