New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@swim/collections

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swim/collections - npm Package Compare versions

Comparing version 4.0.0-dev.20210927.1 to 4.0.0-dev.20210927.2

2

dist/main/swim-collections.min.js

@@ -1,3 +0,3 @@

// swim-collections-4.0.0-dev.20210927.1; copyright 2015-2021 Swim Inc.
// swim-collections-4.0.0-dev.20210927.2; copyright 2015-2021 Swim Inc.
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@swim/util")):"function"==typeof define&&define.amd?define(["exports","@swim/util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).swim=t.swim||{},t.swim)}(this,(function(t,e){"use strict";var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}function i(t,e,r,o){var i,n=arguments.length,s=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,o);else for(var h=t.length-1;h>=0;h--)(i=t[h])&&(s=(n<3?i(s):n>3?i(e,r,s):i(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}var n=function(t){function e(e){var r=t.call(this)||this;return r.cursor=e,r}return o(e,t),e.prototype.isEmpty=function(){return this.cursor.isEmpty()},e.prototype.head=function(){return this.cursor.head()[0]},e.prototype.step=function(){this.cursor.step()},e.prototype.skip=function(t){this.cursor.skip(t)},e.prototype.hasNext=function(){return this.cursor.hasNext()},e.prototype.nextIndex=function(){return this.cursor.nextIndex()},e.prototype.next=function(){var t=this.cursor.next(),e=t.value,r=t.done;return{value:e&&e[0],done:r}},e.prototype.hasPrevious=function(){return this.cursor.hasPrevious()},e.prototype.previousIndex=function(){return this.cursor.previousIndex()},e.prototype.previous=function(){var t=this.cursor.previous(),e=t.value,r=t.done;return{value:e&&e[0],done:r}},e.prototype.delete=function(){this.cursor.delete()},e}(e.Cursor),s=function(t){function e(e){var r=t.call(this)||this;return r.cursor=e,r}return o(e,t),e.prototype.isEmpty=function(){return this.cursor.isEmpty()},e.prototype.head=function(){return this.cursor.head()[1]},e.prototype.step=function(){this.cursor.step()},e.prototype.skip=function(t){this.cursor.skip(t)},e.prototype.hasNext=function(){return this.cursor.hasNext()},e.prototype.nextIndex=function(){return this.cursor.nextIndex()},e.prototype.next=function(){var t=this.cursor.next(),e=t.value,r=t.done;return{value:e&&e[1],done:r}},e.prototype.hasPrevious=function(){return this.cursor.hasPrevious()},e.prototype.previousIndex=function(){return this.cursor.previousIndex()},e.prototype.previous=function(){var t=this.cursor.previous(),e=t.value,r=t.done;return{value:e&&e[1],done:r}},e.prototype.delete=function(){this.cursor.delete()},e}(e.Cursor),h=function(t){function e(e,r,o,i){var n=t.call(this)||this;return n.pages=e,n.index=r,n.childIndex=o,n.childCursor=i,n}return o(e,t),e.prototype.isEmpty=function(){for(;;)if(null!==this.childCursor){if(!this.childCursor.isEmpty())return!1;this.childCursor=null}else{if(!(this.childIndex<this.pages.length))return this.childIndex=this.pages.length,!0;this.childCursor=this.pageCursor(this.pages[this.childIndex]),this.childIndex+=1}},e.prototype.head=function(){for(;;)if(null!==this.childCursor){if(!this.childCursor.isEmpty())return this.childCursor.head();this.childCursor=null}else{if(!(this.childIndex<this.pages.length))throw this.childIndex=this.pages.length,new Error("empty");this.childCursor=this.pageCursor(this.pages[this.childIndex]),this.childIndex+=1}},e.prototype.step=function(){for(;;)if(null!==this.childCursor){if(!this.childCursor.isEmpty())return void(this.index+=1);this.childCursor=null}else{if(!(this.childIndex<this.pages.length))throw this.childIndex=this.pages.length,new Error("empty");this.childCursor=this.pageCursor(this.pages[this.childIndex]),this.childIndex+=1}},e.prototype.skip=function(t){for(;t>0;)if(null!==this.childCursor)this.childCursor.hasNext()?(this.index+=1,t-=1,this.childCursor.next()):this.childCursor=null;else{if(!(this.childIndex<this.pages.length))break;var e=this.pages[this.childIndex],r=this.pageSize(e);if(this.childIndex+=1,r<t){this.childCursor=this.pageCursor(e),t>0&&(this.index+=t,this.childCursor.skip(t),t=0);break}this.index+=r,t-=r}},e.prototype.hasNext=function(){for(;;)if(null!==this.childCursor){if(this.childCursor.hasNext())return!0;this.childCursor=null}else{if(!(this.childIndex<this.pages.length))return this.childIndex=this.pages.length,!1;this.childCursor=this.pageCursor(this.pages[this.childIndex]),this.childIndex+=1}},e.prototype.nextIndex=function(){return this.index},e.prototype.next=function(){for(;;)if(null!==this.childCursor){if(this.childCursor.hasNext())return this.index+=1,this.childCursor.next();this.childCursor=null}else{if(!(this.childIndex<this.pages.length))return this.childIndex=this.pages.length,{done:!0};this.childCursor=this.pageCursor(this.pages[this.childIndex]),this.childIndex+=1}},e.prototype.hasPrevious=function(){for(;;)if(null!==this.childCursor){if(this.childCursor.hasPrevious())return!0;this.childCursor=null}else{if(!(this.childIndex>0))return this.childIndex=0,!1;this.childCursor=this.reversePageCursor(this.pages[this.childIndex-1]),this.childIndex-=1}},e.prototype.previousIndex=function(){return this.index-1},e.prototype.previous=function(){for(;;)if(null!==this.childCursor){if(this.childCursor.hasPrevious())return this.index-=1,this.childCursor.previous();this.childCursor=null}else{if(!(this.childIndex>0))return this.childIndex=0,{done:!0};this.childCursor=this.reversePageCursor(this.pages[this.childIndex-1]),this.childIndex-=1}},e.prototype.set=function(t){this.childCursor.set(t)},e.prototype.delete=function(){this.childCursor.delete()},e}(e.Cursor),p=function(){function t(){this.pageSplitSize=32}return t.prototype.compare=function(t,r){return e.Values.compare(t,r)},t.prototype.pageShouldSplit=function(t){return t.arity>this.pageSplitSize},t.prototype.pageShouldMerge=function(t){return t.arity<this.pageSplitSize>>>1},t}(),u=function(t){function e(e){var r=t.call(this)||this;return void 0===e&&(e=a.empty()),r.root=e,r}return o(e,t),Object.defineProperty(e.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return this.root.isEmpty()},e.prototype.has=function(t){return this.root.has(t,this)},e.prototype.get=function(t){return this.root.get(t,this)},e.prototype.getEntry=function(t){return this.root.getEntry(t)},e.prototype.firstKey=function(){var t=this.root.firstEntry();return void 0!==t?t[0]:void 0},e.prototype.firstValue=function(){var t=this.root.firstEntry();return void 0!==t?t[1]:void 0},e.prototype.firstEntry=function(){return this.root.firstEntry()},e.prototype.lastKey=function(){var t=this.root.lastEntry();return void 0!==t?t[0]:void 0},e.prototype.lastValue=function(){var t=this.root.lastEntry();return void 0!==t?t[1]:void 0},e.prototype.lastEntry=function(){return this.root.lastEntry()},e.prototype.nextKey=function(t){var e=this.root.nextEntry(t,this);return void 0!==e?e[0]:void 0},e.prototype.nextValue=function(t){var e=this.root.nextEntry(t,this);return void 0!==e?e[1]:void 0},e.prototype.nextEntry=function(t){return this.root.nextEntry(t,this)},e.prototype.previousKey=function(t){var e=this.root.previousEntry(t,this);return void 0!==e?e[0]:void 0},e.prototype.previousValue=function(t){var e=this.root.previousEntry(t,this);return void 0!==e?e[1]:void 0},e.prototype.previousEntry=function(t){return this.root.previousEntry(t,this)},e.prototype.set=function(t,e){var r=this.root,o=this.root.updated(t,e,this);return r!==o&&(o.size>r.size&&(o=o.balanced(this)),this.root=o),this},e.prototype.delete=function(t){var e=this.root,r=this.root.removed(t,this);return e!==r&&(this.root=r,!0)},e.prototype.drop=function(t){return t>0&&this.root.size>0&&(t<this.root.size?this.root=this.root.drop(t,this):this.root=a.empty()),this},e.prototype.take=function(t){return t<this.root.size&&this.root.size>0&&(this.root=t>0?this.root.take(t,this):a.empty()),this},e.prototype.clear=function(){this.root=a.empty()},e.prototype.updated=function(t,e){var r=this.root,o=r.updated(t,e,this);return r!==o?(o.size>r.size&&(o=o.balanced(this)),this.copy(o)):this},e.prototype.removed=function(t){var e=this.root,r=e.removed(t,this);return e!==r?this.copy(r):this},e.prototype.cleared=function(){return this.root.isEmpty()?this:this.copy(a.empty())},e.prototype.reduced=function(t,e,r){var o=this.root,i=o.reduced(t,e,r);return o!==i&&(this.root=i),i.fold},e.prototype.forEach=function(t,e){return this.root.forEach(t,e)},e.prototype.forEachKey=function(t,e){return this.root.forEachKey(t,e)},e.prototype.forEachValue=function(t,e){return this.root.forEachValue(t,e)},e.prototype.keys=function(){return this.root.keys()},e.prototype.values=function(){return this.root.values()},e.prototype.entries=function(){return this.root.entries()},e.prototype.reverseKeys=function(){return this.root.reverseKeys()},e.prototype.reverseValues=function(){return this.root.reverseValues()},e.prototype.reverseEntries=function(){return this.root.reverseEntries()},e.prototype.clone=function(){return this.copy(this.root)},e.prototype.copy=function(t){var r=new e(t);return r.compare!==this.compare&&(r.compare=this.compare),r.pageSplitSize!==this.pageSplitSize&&(r.pageSplitSize=this.pageSplitSize),r},e}(p),a=function(){function t(){}return t.prototype.keys=function(){return new n(this.entries())},t.prototype.values=function(){return new s(this.entries())},t.prototype.reverseKeys=function(){return new n(this.reverseEntries())},t.prototype.reverseValues=function(){return new s(this.reverseEntries())},t.empty=function(){return new l([],void 0)},i([e.Lazy],t,"empty",null),t}(),l=function(t){function r(e,r){var o=t.call(this)||this;return o.slots=e,o.fold=r,o}return o(r,t),Object.defineProperty(r.prototype,"arity",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"size",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return 0===this.slots.length},r.prototype.minKey=function(){return this.slots[0][0]},r.prototype.maxKey=function(){return this.slots[this.slots.length-1][0]},r.prototype.has=function(t,e){return this.lookup(t,e)>=0},r.prototype.get=function(t,e){var r=this.lookup(t,e);return r>=0?this.slots[r][1]:void 0},r.prototype.getEntry=function(t){return this.slots[t]},r.prototype.firstEntry=function(){var t=this.slots;return 0!==t.length?t[0]:void 0},r.prototype.lastEntry=function(){var t=this.slots;return 0!==t.length?t[t.length-1]:void 0},r.prototype.nextEntry=function(t,e){var r=this.lookup(t,e);return r>=0?r+=1:r=-(r+1),this.slots[r]},r.prototype.previousEntry=function(t,e){var r=this.lookup(t,e);return r>=0?r-=1:r=-(r+2),this.slots[r]},r.prototype.updated=function(t,e,r){var o=this.lookup(t,r);return o>=0?this.updatedSlot(o,t,e):(o=-(o+1),this.insertedSlot(o,t,e))},r.prototype.updatedSlot=function(t,e,o){var i=this.slots;if(o!==i[t][1]){var n=i.slice(0);return n[t]=[e,o],new r(n,void 0)}return this},r.prototype.insertedSlot=function(t,e,o){for(var i=this.slots,n=i.length+1,s=new Array(n),h=0;h<t;h+=1)s[h]=i[h];s[t]=[e,o];for(h=t;h<n-1;h+=1)s[h+1]=i[h];return new r(s,void 0)},r.prototype.removed=function(t,e){var r=this.lookup(t,e);return r>=0?this.slots.length>1?this.removedSlot(r):a.empty():this},r.prototype.removedSlot=function(t){for(var e=this.slots,o=new Array(e.length-1),i=0;i<t;i+=1)o[i]=e[i];for(i=t;i<o.length;i+=1)o[i]=e[i+1];return new r(o,void 0)},r.prototype.drop=function(t,e){if(t>0){var o=this.slots;if(t<o.length){for(var i=o.length-t,n=new Array(i),s=0;s<i;s+=1)n[s]=o[s+t];return new r(n,void 0)}return a.empty()}return this},r.prototype.take=function(t,e){var o=this.slots;if(t<o.length){if(t>0){for(var i=new Array(t),n=0;n<t;n+=1)i[n]=o[n];return new r(i,void 0)}return a.empty()}return this},r.prototype.balanced=function(t){var e=this.slots.length;if(e>1&&t.pageShouldSplit(this)){var r=e>>>1;return this.split(r)}return this},r.prototype.split=function(t){var e=new Array(2),r=this.splitLeft(t),o=this.splitRight(t);e[0]=r,e[1]=o;var i=new Array(1);return i[0]=o.minKey(),new f(e,i,void 0,this.slots.length)},r.prototype.splitLeft=function(t){for(var e=this.slots,o=new Array(t),i=0;i<t;i+=1)o[i]=e[i];return new r(o,void 0)},r.prototype.splitRight=function(t){for(var e=this.slots,o=e.length-t,i=new Array(o),n=0;n<o;n+=1)i[n]=e[n+t];return new r(i,void 0)},r.prototype.reduced=function(t,e,o){if(void 0===this.fold){for(var i=this.slots,n=t,s=0,h=i.length;s<h;s+=1)n=e(n,i[s][1]);return new r(i,n)}return this},r.prototype.forEach=function(t,e){for(var r=this.slots,o=0,i=r.length;o<i;o+=1){var n=r[o],s=t.call(e,n[0],n[1]);if(void 0!==s)return s}},r.prototype.forEachKey=function(t,e){for(var r=this.slots,o=0,i=r.length;o<i;o+=1){var n=r[o],s=t.call(e,n[0]);if(void 0!==s)return s}},r.prototype.forEachValue=function(t,e){for(var r=this.slots,o=0,i=r.length;o<i;o+=1){var n=r[o],s=t.call(e,n[1]);if(void 0!==s)return s}},r.prototype.entries=function(){return e.Cursor.array(this.slots)},r.prototype.reverseEntries=function(){return e.Cursor.array(this.slots,this.slots.length)},r.prototype.lookup=function(t,e){for(var r=0,o=this.slots.length-1;r<=o;){var i=r+o>>>1,n=e.compare(t,this.slots[i][0]);if(n>0)r=i+1;else{if(!(n<0))return i;o=i-1}}return-(r+1)},r}(a),f=function(t){function e(e,r,o,i){var n=t.call(this)||this;return n.pages=e,n.knots=r,n.fold=o,n.size=i,n}return o(e,t),Object.defineProperty(e.prototype,"arity",{get:function(){return this.pages.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this.size},e.prototype.minKey=function(){return this.pages[0].minKey()},e.prototype.maxKey=function(){return this.pages[this.pages.length-1].maxKey()},e.prototype.has=function(t,e){var r=this.lookup(t,e);if(r>0)r+=1;else{if(!(r<0))return!0;r=-(r+1)}return this.pages[r].has(t,e)},e.prototype.get=function(t,e){var r=this.lookup(t,e);return r>=0?r+=1:r=-(r+1),this.pages[r].get(t,e)},e.prototype.getEntry=function(t){for(var e=this.pages,r=0,o=e.length;r<o;r+=1){var i=e[r];if(t<i.size)return i.getEntry(t);t-=i.size}},e.prototype.firstEntry=function(){var t=this.pages;return 0!==t.length?t[0].firstEntry():void 0},e.prototype.lastEntry=function(){var t=this.pages;return 0!==t.length?t[t.length-1].lastEntry():void 0},e.prototype.nextEntry=function(t,e){var r=this.lookup(t,e);r>=0?r+=1:r=-(r+1);var o=this.pages,i=o[r].nextEntry(t,e);return void 0===i&&r+1<o.length&&(i=o[r+1].nextEntry(t,e)),i},e.prototype.previousEntry=function(t,e){var r=this.lookup(t,e);r>=0?r+=1:r=-(r+1);var o=this.pages,i=o[r].previousEntry(t,e);return void 0===i&&r>0&&(i=o[r-1].previousEntry(t,e)),i},e.prototype.updated=function(t,e,r){var o=this.lookup(t,r);o>=0?o+=1:o=-(o+1);var i=this.pages[o],n=i.updated(t,e,r);return i!==n?i.size!==n.size&&r.pageShouldSplit(n)?this.updatedPageSplit(o,n,i):this.updatedPage(o,n,i):this},e.prototype.updatedPage=function(t,r,o){var i=this.pages.slice(0);i[t]=r;var n,s=this.knots;return s.length>0?(n=s.slice(0),t>0&&(n[t-1]=r.minKey())):n=[],new e(i,n,void 0,this.size-o.size+r.size)},e.prototype.updatedPageSplit=function(t,r,o){for(var i=this.pages,n=new Array(i.length+1),s=0;s<t;s+=1)n[s]=i[s];var h=r.splitLeft(r.arity>>>1),p=r.splitRight(r.arity>>>1);n[t]=h,n[t+1]=p;for(s=t+1;s<i.length;s+=1)n[s+1]=i[s];var u=this.knots,a=new Array(i.length);if(t>0){for(s=0;s<t-1;s+=1)a[s]=u[s];a[t-1]=h.minKey(),a[t]=p.minKey();for(s=t;s<u.length;s+=1)a[s+1]=u[s]}else{a[0]=p.minKey();for(s=0;s<u.length;s+=1)a[s+1]=u[s]}return new e(n,a,void 0,this.size-o.size+r.size)},e.prototype.updatedPageMerge=function(t,r,o){for(var i=this.pages,n=r.pages,s=new Array(i.length+n.length-1),h=0;h<t;h+=1)s[h]=i[h];for(h=0;h<n.length;h+=1)s[h+t]=n[h];for(h=t+1;h<i.length;h+=1)s[h+n.length-1]=i[h];var p=this.knots,u=r.knots,a=new Array(s.length-1);if(t>0){for(h=0;h<t-1;h+=1)a[h]=p[h];a[t-1]=n[0].minKey();for(h=0;h<u.length;h+=1)a[h+t]=u[h];for(h=t;h<p.length;h+=1)a[h+u.length]=p[h]}else{for(h=0;h<u.length;h+=1)a[h]=u[h];a[u.length]=i[1].minKey();for(h=1;h<p.length;h+=1)a[h+u.length]=p[h]}return new e(s,a,void 0,this.size-o.size+r.size)},e.prototype.removed=function(t,e){var r=this.lookup(t,e);r>=0?r+=1:r=-(r+1);var o=this.pages[r],i=o.removed(t,e);return o!==i?this.replacedPage(r,i,o,e):this},e.prototype.replacedPage=function(t,r,o,i){return r.isEmpty()?this.pages.length>2?this.removedPage(t,r,o):this.pages.length>1?0===t?this.pages[1]:this.pages[0]:a.empty():r instanceof e&&i.pageShouldMerge(r)?this.updatedPageMerge(t,r,o):this.updatedPage(t,r,o)},e.prototype.removedPage=function(t,r,o){for(var i=this.pages,n=new Array(i.length-1),s=0;s<t;s+=1)n[s]=i[s];for(s=t+1;s<i.length;s+=1)n[s-1]=i[s];var h=this.knots,p=new Array(h.length-1);if(t>0){for(s=0;s<t-1;s+=1)p[s]=h[s];for(s=t;s<h.length;s+=1)p[s-1]=h[s]}else for(s=1;s<h.length;s+=1)p[s-1]=h[s];return new e(n,p,void 0,this.size-o.size)},e.prototype.drop=function(t,r){if(t>0){var o=this.size;if(t<o){for(var i=this.pages,n=0;n<i.length;){var s=i[n].size;if(!(s<=t))break;o-=s,t-=s,n+=1}var h=i.length-n;if(h>1){var p=void 0;if(n>0){for(var u=new Array(h),l=0;l<h;l+=1)u[l]=i[l+n];var f=new Array(h-1);for(l=0;l<f.length;l+=1)f[l]=this.knots[l+n];p=new e(u,f,void 0,o)}else p=this;if(t>0){var c=i[n],y=c.drop(t,r);return p.replacedPage(0,y,c,r)}return p}return i[n].drop(t,r)}return a.empty()}return this},e.prototype.take=function(t,r){if(t<this.size){if(t>0){for(var o=this.pages,i=0,n=0;i<o.length&&t>0;){var s=o[i].size;if(n+=s,i+=1,!(s<=t))break;t-=s}var h=0===t?i:i+1;if(h>1){var p=void 0;if(i<o.length){for(var u=new Array(h),l=0;l<h;l+=1)u[l]=o[l];var f=new Array(h-1);for(l=0;l<f.length;l+=1)f[l]=this.knots[l];p=new e(u,f,void 0,n)}else p=this;if(t>0){var c=o[i-1],y=c.take(t,r);return p.replacedPage(i-1,y,c,r)}return p}return t>0?o[0].take(t,r):o[0]}return a.empty()}return this},e.prototype.balanced=function(t){if(this.pages.length>1&&t.pageShouldSplit(this)){var e=this.knots.length>>>1;return this.split(e)}return this},e.prototype.split=function(t){var r=new Array(2),o=this.splitLeft(t),i=this.splitRight(t);r[0]=o,r[1]=i;var n=new Array(1);return n[0]=i.minKey(),new e(r,n,void 0,this.size)},e.prototype.splitLeft=function(t){for(var r=this.pages,o=new Array(t+1),i=0;i<t+1;i+=1)o[i]=r[i];var n=this.knots,s=new Array(t);for(i=0;i<t;i+=1)s[i]=n[i];var h=0;for(i=0;i<=t;i+=1)h+=o[i].size;return new e(o,s,void 0,h)},e.prototype.splitRight=function(t){for(var r=this.pages,o=r.length-(t+1),i=new Array(o),n=0;n<o;n+=1)i[n]=r[n+(t+1)];var s=this.knots,h=new Array(o-1);for(n=0;n<h.length;n+=1)h[n]=s[n+(t+1)];var p=0;for(n=0;n<o;n+=1)p+=i[n].size;return new e(i,h,void 0,p)},e.prototype.reduced=function(t,r,o){if(void 0===this.fold){for(var i=this.pages,n=i.length,s=new Array(n),h=0;h<n;h+=1)s[h]=i[h].reduced(t,r,o);var p=s[0].fold;for(h=1;h<n;h+=1)p=o(p,s[h].fold);return new e(s,this.knots,p,this.size)}return this},e.prototype.forEach=function(t,e){for(var r=this.pages,o=0,i=r.length;o<i;o+=1){var n=r[o].forEach(t,e);if(void 0!==n)return n}},e.prototype.forEachKey=function(t,e){for(var r=this.pages,o=0,i=r.length;o<i;o+=1){var n=r[o].forEachKey(t,e);if(void 0!==n)return n}},e.prototype.forEachValue=function(t,e){for(var r=this.pages,o=0,i=r.length;o<i;o+=1){var n=r[o].forEachValue(t,e);if(void 0!==n)return n}},e.prototype.entries=function(){return new c(this.pages)},e.prototype.reverseEntries=function(){return new c(this.pages,this.size,this.pages.length)},e.prototype.lookup=function(t,e){for(var r=0,o=this.knots.length-1;r<=o;){var i=r+o>>>1,n=e.compare(t,this.knots[i]);if(n>0)r=i+1;else{if(!(n<0))return i;o=i-1}}return-(r+1)},e}(a),c=function(t){function e(e,r,o,i){return void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=null),t.call(this,e,r,o,i)||this}return o(e,t),e.prototype.pageSize=function(t){return t.size},e.prototype.pageCursor=function(t){return t.entries()},e.prototype.reversePageCursor=function(t){return t.reverseEntries()},e}(h),y=function(){function t(){this.pageSplitSize=32}return t.prototype.identify=function(t){var r=new Uint8Array(6);return e.Random.fillBytes(r),r},t.prototype.compare=function(t,r){return e.Values.compare(t,r)},t.prototype.pageShouldSplit=function(t){return t.arity>this.pageSplitSize},t.prototype.pageShouldMerge=function(t){return t.arity<this.pageSplitSize>>>1},t}(),d=function(t){function e(e){var r=t.call(this)||this;return void 0===e&&(e=v.empty()),r.root=e,r}return o(e,t),Object.defineProperty(e.prototype,"length",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return this.root.isEmpty()},e.prototype.get=function(t,e){if(!(void 0!==e&&(t=this.lookup(e,t))<0))return this.root.get(t)},e.prototype.getEntry=function(t,e){if(!(void 0!==e&&(t=this.lookup(e,t))<0))return this.root.getEntry(t)},e.prototype.set=function(t,e,r){if(void 0!==r&&(t=this.lookup(r,t))<0)throw new RangeError(""+r);var o=this.root;if(t<0||t>=o.size)throw new RangeError(""+t);return this.root=o.updated(t,e,this),this},e.prototype.insert=function(t,e,r){var o=this.root;if(t<0||t>o.size)throw new RangeError(""+t);return this.root=o.inserted(t,e,r,this).balanced(this),this},e.prototype.remove=function(t,e){if(void 0!==e&&(t=this.lookup(e,t))<0)throw new RangeError(""+e);var r=this.root;if(t<0||t>r.size)throw new RangeError(""+t);return this.root=r.removed(t,this),this},e.prototype.push=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=this.root,o=0;o<t.length;o+=1)r=r.inserted(r.size,t[o],void 0,this).balanced(this);return this.root=r,r.size},e.prototype.pop=function(){var t=this.root,e=t.size-1;if(e>=0){var r=t.get(e);return this.root=t.removed(e,this),r}},e.prototype.unshift=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=this.root,o=t.length-1;o>=0;o-=1)r=r.inserted(0,t[o],void 0,this).balanced(this);return this.root=r,r.size},e.prototype.shift=function(){var t=this.root;if(t.size>0){var e=t.get(0);return this.root=t.removed(0,this),e}},e.prototype.move=function(t,e,r){if(void 0!==r&&(t=this.lookup(r,t))<0)throw new RangeError(""+r);var o=this.root;if(t<0||t>=o.size)throw new RangeError(""+t);if(e<0||e>=o.size)throw new RangeError(""+e);if(t!==e){var i=o.getEntry(t);this.root=o.removed(t,this).inserted(e,i[1],i[0],this).balanced(this)}return this},e.prototype.splice=function(t,e){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];var i=this.root;t<0&&(t=i.size+t),t=Math.min(Math.max(0,t),i.size),void 0===e&&(e=i.size-t);for(var n=[],s=t,h=t+e;s<h;s+=1)n.push(i.get(t)),i=i.removed(t,this);for(s=0;s<r.length;s+=1)i=i.inserted(t+s,r[s],void 0,this).balanced(this);return this.root=i,n},e.prototype.drop=function(t){var e=this.root;return t>0&&e.size>0&&(t<e.size?this.root=e.drop(t,this):this.root=v.empty()),this},e.prototype.take=function(t){var e=this.root;return t<e.size&&e.size>0&&(this.root=t>0?e.take(t,this):v.empty()),this},e.prototype.clear=function(){this.root=v.empty()},e.prototype.forEach=function(t,e){return this.root.forEach(t,e,0)},e.prototype.keys=function(){return this.root.keys()},e.prototype.values=function(){return this.root.values()},e.prototype.entries=function(){return this.root.entries()},e.prototype.reverseKeys=function(){return this.root.reverseKeys()},e.prototype.reverseValues=function(){return this.root.reverseValues()},e.prototype.reverseEntries=function(){return this.root.reverseEntries()},e.prototype.clone=function(){return this.copy(this.root)},e.prototype.copy=function(t){var r=new e(t);return r.identify!==this.identify&&(r.identify=this.identify),r.compare!==this.compare&&(r.compare=this.compare),r.pageSplitSize!==this.pageSplitSize&&(r.pageSplitSize=this.pageSplitSize),r},e.prototype.lookup=function(t,e){void 0===e&&(e=0);var r=this.root,o=e=Math.min(Math.max(0,e),r.size-1);do{var i=r.getEntry(o);if(void 0!==i&&0===this.compare(i[0],t))return o;o=(o+1)%r.size}while(isFinite(o)&&o!==e);return-1},e}(y),v=function(){function t(){}return t.prototype.keys=function(){return new n(this.entries())},t.prototype.values=function(){return new s(this.entries())},t.prototype.reverseKeys=function(){return new n(this.reverseEntries())},t.prototype.reverseValues=function(){return new s(this.reverseEntries())},t.empty=function(){return new g([])},i([e.Lazy],t,"empty",null),t}(),g=function(t){function r(e){var r=t.call(this)||this;return r.slots=e,r}return o(r,t),Object.defineProperty(r.prototype,"arity",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"size",{get:function(){return this.slots.length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return 0===this.slots.length},r.prototype.get=function(t){var e=this.slots[t];return void 0!==e?e[1]:void 0},r.prototype.getEntry=function(t){return this.slots[t]},r.prototype.updated=function(t,e,r){if(t<0||t>=this.slots.length)throw new RangeError(""+t);return this.updatedItem(t,e)},r.prototype.updatedItem=function(t,e){var o=this.slots,i=o[t];if(void 0!==i&&e!==i[1]){var n=o.slice(0);return n[t]=[i[0],e],new r(n)}return this},r.prototype.inserted=function(t,e,r,o){if(t<0||t>this.slots.length)throw new RangeError(""+t);return this.insertedItem(t,e,r,o)},r.prototype.insertedItem=function(t,e,o,i){void 0===o&&(o=i.identify(e));for(var n=this.slots,s=new Array(n.length+1),h=0;h<t;h+=1)s[h]=n[h];s[t]=[o,e];for(h=t;h<n.length;h+=1)s[h+1]=n[h];return new r(s)},r.prototype.removed=function(t,e){if(t<0||t>=this.slots.length)throw new RangeError(""+t);return this.slots.length>1?this.removedSlot(t):v.empty()},r.prototype.removedSlot=function(t){for(var e=this.slots,o=new Array(e.length-1),i=0;i<t;i+=1)o[i]=e[i];for(i=t;i<o.length;i+=1)o[i]=e[i+1];return new r(o)},r.prototype.drop=function(t,e){var o=this.slots;if(t>0&&o.length>0){if(t<o.length){for(var i=o.length-t,n=new Array(i),s=0;s<i;s+=1)n[s]=o[s+t];return new r(n)}return v.empty()}return this},r.prototype.take=function(t,e){var o=this.slots;if(t<o.length&&o.length>0){if(t>0){for(var i=new Array(t),n=0;n<t;n+=1)i[n]=o[n];return new r(i)}return v.empty()}return this},r.prototype.balanced=function(t){var e=this.slots.length;return e>1&&t.pageShouldSplit(this)?this.split(e>>>1):this},r.prototype.split=function(t){var e=new Array(2),r=this.splitLeft(t),o=this.splitRight(t);e[0]=r,e[1]=o;var i=new Array(1);return i[0]=t,new w(e,i,this.slots.length)},r.prototype.splitLeft=function(t){for(var e=this.slots,o=new Array(t),i=0;i<t;i+=1)o[i]=e[i];return new r(o)},r.prototype.splitRight=function(t){for(var e=this.slots,o=e.length-t,i=new Array(o),n=0;n<o;n+=1)i[n]=e[n+t];return new r(i)},r.prototype.forEach=function(t,e,r){for(var o=0;o<this.slots.length;o+=1){var i=this.slots[o],n=t.call(e,i[1],r+o,i[0]);if(void 0!==n)return n}},r.prototype.entries=function(){return e.Cursor.array(this.slots)},r.prototype.reverseEntries=function(){return e.Cursor.array(this.slots,this.slots.length)},r}(v),w=function(t){function e(e,r,o){var i=t.call(this)||this;return i.pages=e,i.knots=r,i.size=o,i}return o(e,t),Object.defineProperty(e.prototype,"arity",{get:function(){return this.pages.length},enumerable:!1,configurable:!0}),e.prototype.isEmpty=function(){return 0===this.size},e.prototype.get=function(t){var e=this.lookup(t);e>=0?e+=1:e=-(e+1);var r=0===e?t:t-this.knots[e-1];return this.pages[e].get(r)},e.prototype.getEntry=function(t){var e=this.lookup(t);e>=0?e+=1:e=-(e+1);var r=0===e?t:t-this.knots[e-1];return this.pages[e].getEntry(r)},e.prototype.updated=function(t,e,r){var o=this.lookup(t);o>=0?o+=1:o=-(o+1);var i=0===o?t:t-this.knots[o-1],n=this.pages[o],s=n.updated(i,e,r);return n!==s?n.size!==s.size&&r.pageShouldSplit(s)?this.updatedPageSplit(o,s,n):this.updatedPage(o,s,n):this},e.prototype.updatedPage=function(t,r,o){var i=this.pages,n=i.slice(0);n[t]=r;var s,h,p=this.knots;if(i.length-1>0){s=p.slice(0),h=t>0?p[t-1]:0;for(var u=t;u<s.length;u+=1)h+=n[u].size,s[u]=h;h+=n[s.length].size}else s=[],h=0;return new e(n,s,h)},e.prototype.updatedPageSplit=function(t,r,o){for(var i=this.pages,n=new Array(i.length+1),s=0;s<t;s+=1)n[s]=i[s];var h=r.splitLeft(r.arity>>>1),p=r.splitRight(r.arity>>>1);n[t]=h,n[t+1]=p;for(s=t+1;s<i.length;s+=1)n[s+1]=i[s];return e.create(n)},e.prototype.updatedPageMerge=function(t,r,o){for(var i=this.pages,n=r.pages,s=new Array(i.length+n.length-1),h=0;h<t;h+=1)s[h]=i[h];for(h=0;h<n.length;h+=1)s[h+t]=n[h];for(h=t+1;h<i.length;h+=1)s[h+n.length-1]=i[h];return e.create(s)},e.prototype.inserted=function(t,e,r,o){var i=this.lookup(t);i>=0?i+=1:i=-(i+1);var n=0===i?t:t-this.knots[i-1],s=this.pages[i],h=s.inserted(n,e,r,o);return s!==h?o.pageShouldSplit(h)?this.updatedPageSplit(i,h,s):this.updatedPage(i,h,s):this},e.prototype.removed=function(t,e){var r=this.lookup(t);r>=0?r+=1:r=-(r+1);var o=0===r?t:t-this.knots[r-1],i=this.pages[r],n=i.removed(o,e);return i!==n?this.replacedPage(r,n,i,e):this},e.prototype.replacedPage=function(t,r,o,i){return r.isEmpty()?this.pages.length>2?this.removedPage(t,r,o):this.pages.length>1?0===t?this.pages[1]:this.pages[0]:v.empty():r instanceof e&&i.pageShouldMerge(r)?this.updatedPageMerge(t,r,o):this.updatedPage(t,r,o)},e.prototype.removedPage=function(t,r,o){for(var i=this.pages,n=new Array(i.length-1),s=0;s<t;s+=1)n[s]=i[s];for(s=t+1;s<i.length;s+=1)n[s-1]=i[s];var h,p=this.knots,u=new Array(p.length-1);if(t>0){for(s=0;s<t;s+=1)u[s]=p[s];h=p[t-1]}else h=0;for(s=t;s<u.length;s+=1)h+=n[s].size,u[s]=h;return new e(n,u,h+=n[u.length].size)},e.prototype.drop=function(t,r){if(t>0){if(t<this.size){var o=this.lookup(t);o>=0?o+=1:o=-(o+1),t=0===o?t:t-this.knots[o-1];var i=this.pages,n=i.length-o;if(n>1){var s=void 0;if(o>0){for(var h=new Array(n),p=0;p<n;p+=1)h[p]=i[p+o];s=e.create(h)}else s=this;if(t>0){var u=i[o],a=u.drop(t,r);return s.replacedPage(0,a,u,r)}return s}return i[o].drop(t,r)}return v.empty()}return this},e.prototype.take=function(t,r){if(t<this.size){if(t>0){var o=this.lookup(t);o>=0?o+=1:o=-(o+1),t=0===o?t:t-this.knots[o-1];var i=this.pages,n=0===t?o:o+1;if(n>1){var s=void 0;if(o<i.length){for(var h=new Array(n),p=0;p<n;p+=1)h[p]=i[p];var u=new Array(n-1);for(p=0;p<u.length;p+=1)u[p]=this.knots[p];s=new e(h,u,u[n-2]+h[n-1].size)}else s=this;if(t>0){var a=i[o],l=a.take(t,r);return s.replacedPage(o,l,a,r)}return s}return t>0?i[0].take(t,r):i[0]}return v.empty()}return this},e.prototype.balanced=function(t){if(this.pages.length>1&&t.pageShouldSplit(this)){var e=this.knots.length>>>1;return this.split(e)}return this},e.prototype.split=function(t){var r=new Array(2),o=this.splitLeft(t),i=this.splitRight(t);r[0]=o,r[1]=i;var n=new Array(1);return n[0]=o.size,new e(r,n,this.size)},e.prototype.splitLeft=function(t){for(var r=this.pages,o=new Array(t+1),i=0;i<t+1;i+=1)o[i]=r[i];var n=this.knots,s=new Array(t);for(i=0;i<t;i+=1)s[i]=n[i];var h=0;for(i=0;i<=t;i+=1)h+=o[i].size;return new e(o,s,h)},e.prototype.splitRight=function(t){for(var r=this.pages,o=r.length-(t+1),i=new Array(o),n=0;n<o;n+=1)i[n]=r[n+(t+1)];var s,h=new Array(o-1);if(o>0){s=i[0].size;for(n=1;n<o;n+=1)h[n-1]=s,s+=i[n].size}else s=0;return new e(i,h,s)},e.prototype.forEach=function(t,e,r){for(var o=0;o<this.pages.length;o+=1){var i=this.pages[o],n=i.forEach(t,e,r);if(void 0!==n)return n;r+=i.size}},e.prototype.entries=function(){return new m(this.pages)},e.prototype.reverseEntries=function(){return new m(this.pages,this.size,this.pages.length)},e.prototype.lookup=function(t){for(var e=0,r=this.knots.length-1;e<=r;){var o=e+r>>>1;if(t>this.knots[o])e=o+1;else{if(!(t<this.knots[o]))return o;r=o-1}}return-(e+1)},e.create=function(t){for(var r=new Array(t.length-1),o=0,i=0,n=r.length;i<n;i+=1)o+=t[i].size,r[i]=o;return new e(t,r,o+=t[r.length].size)},e}(v),m=function(t){function e(e,r,o,i){return void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=null),t.call(this,e,r,o,i)||this}return o(e,t),e.prototype.pageSize=function(t){return t.size},e.prototype.pageCursor=function(t){return t.entries()},e.prototype.reversePageCursor=function(t){return t.reverseEntries()},e}(h);t.BTree=u,t.BTreeContext=p,t.BTreeLeaf=l,t.BTreeNode=f,t.BTreeNodeCursor=c,t.BTreePage=a,t.KeysCursor=n,t.NodeCursor=h,t.STree=d,t.STreeContext=y,t.STreeLeaf=g,t.STreeNode=w,t.STreeNodeCursor=m,t.STreePage=v,t.ValuesCursor=s,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=swim-collections.min.js.map
{
"name": "@swim/collections",
"version": "4.0.0-dev.20210927.1",
"version": "4.0.0-dev.20210927.2",
"description": "Immutable, structure sharing collections, including B-trees and S-trees (sequence trees)",

@@ -19,5 +19,5 @@ "homepage": "https://github.com/swimos/swim/tree/main/swim-js/swim-runtime-js/swim-core-js/@swim/collections",

"dependencies": {
"@swim/util": "4.0.0-dev.20210927.1",
"@swim/codec": "4.0.0-dev.20210927.1"
"@swim/util": "4.0.0-dev.20210927.2",
"@swim/codec": "4.0.0-dev.20210927.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc