var l=200,p=function(){};p.prototype.append=function(t){return t.length?(t=p.from(t),!this.length&&t||t.length=r?p.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,r))};p.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};p.prototype.forEach=function(t,r,e){r===void 0&&(r=0),e===void 0&&(e=this.length),r<=e?this.forEachInner(t,r,e,0):this.forEachInvertedInner(t,r,e,0)};p.prototype.map=function(t,r,e){r===void 0&&(r=0),e===void 0&&(e=this.length);var n=[];return this.forEach(function(i,s){return n.push(t(i,s))},r,e),n};p.from=function(t){return t instanceof p?t:t&&t.length?new o(t):p.empty};var o=(function(h){function t(e){h.call(this),this.values=e}h&&(t.__proto__=h),t.prototype=Object.create(h&&h.prototype),t.prototype.constructor=t;var r={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(n,i){return n==0&&i==this.length?this:new t(this.values.slice(n,i))},t.prototype.getInner=function(n){return this.values[n]},t.prototype.forEachInner=function(n,i,s,f){for(var a=i;a=s;a--)if(n(this.values[a],f+a)===!1)return!1},t.prototype.leafAppend=function(n){if(this.length+n.length<=l)return new t(this.values.concat(n.flatten()))},t.prototype.leafPrepend=function(n){if(this.length+n.length<=l)return new t(n.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(t.prototype,r),t})(p);p.empty=new o([]);var u=(function(h){function t(r,e){h.call(this),this.left=r,this.right=e,this.length=r.length+e.length,this.depth=Math.max(r.depth,e.depth)+1}return h&&(t.__proto__=h),t.prototype=Object.create(h&&h.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return ef&&this.right.forEachInner(e,Math.max(n-f,0),Math.min(this.length,i)-f,s+f)===!1)return!1},t.prototype.forEachInvertedInner=function(e,n,i,s){var f=this.left.length;if(n>f&&this.right.forEachInvertedInner(e,n-f,Math.max(i,f)-f,s+f)===!1||i=i?this.right.slice(e-i,n-i):this.left.slice(e,i).append(this.right.slice(0,n-i))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t})(p);export{p as R};