-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstructs.min.js
More file actions
8 lines (8 loc) · 3.65 KB
/
structs.min.js
File metadata and controls
8 lines (8 loc) · 3.65 KB
1
2
3
4
5
6
7
8
(function(d){function g(b){if(!!b && "object"===typeof b){if("string"!==typeof b.u){var a="o"+q++;try{Object.defineProperty(b,"__structs_uid__",{value:a,enumerable:!1,writable:!1,configurable:!1})}catch(c){b.__structs_uid__=a}}return b.__structs_uid__}return"s"+b}var h=this&&this.t||function(b,a){function c(){this.constructor=b}for(var e in a)a.hasOwnProperty(e)&&(b[e]=a[e]);c.prototype=a.prototype;b.prototype=new c},q=0,m=function(){function b(a,c){this.c=0;this.a=a;this.m=c}b.prototype.next=function(){return{done:this.c>=
this.a.length,value:this.a[this.c]&&this.m(this.a[this.c++].h)}};return b}(),k=function(){function b(a){this.a={};this.length=this.o=0;this.e=[];this.f=[];if(a)for(var c=0;c<a.length;c++)this.set(a[c][0],a[c][1])}b.prototype.set=function(a,c){var b=this.has(a);this.a[g(a)]={h:this.i(a,c),j:this.o++};b||this.n();return this};b.prototype.get=function(a){if(this.has(a))return this.a[g(a)].h[1]};b.prototype["delete"]=function(a){return this.has(a)?(this.a[g(a)]=void 0,this.k(),!0):!1};b.prototype.has=
function(a){return!!this.a[g(a)]};b.prototype.k=function(){this.length--;for(var a=0;a<this.e.length;a++)this.e[a]()};b.prototype.n=function(){this.length++;for(var a=0;a<this.f.length;a++)this.f[a]()};b.prototype.i=function(a,c){return[,c]};b.prototype.q=function(a){this.e.push(a)};b.prototype.r=function(a){this.f.push(a)};return b}(),n=function(b){function a(){b.apply(this,arguments)}h(a,b);a.prototype.set=function(a,e){if("object"!==typeof a)throw TypeError("Invalid value used as weak map key");
b.prototype.set.call(this,a,e);return this};return a}(k),p=function(b){function a(a){b.call(this,a);this.g=[]}h(a,b);a.prototype.i=function(a,b){return[a,b]};a.prototype.b=function(){var a=[],b;for(b in this.a)if(this.a.hasOwnProperty(b)){var f=this.a[b];f&&a.push(f)}return a.sort(function(a,b){return a.j>b.j?1:-1})};a.prototype.l=function(a){for(var b=this.b(),f=0;f<b.length;f++)a(b[f].h)};a.prototype.forEach=function(a,b){var f=this;b=b||this;this.l(function(d){a.call(b,d[1],d[0],f)})};a.prototype.clear=
function(){this.a={};this.p()};a.prototype.entries=function(){return new m(this.b(),function(a){return a})};a.prototype.keys=function(){return new m(this.b(),function(a){return a[0]})};a.prototype.values=function(){return new m(this.b(),function(a){return a[1]})};a.prototype.s=function(a){this.g.push(a)};a.prototype.p=function(){for(var a=this.length=0;a<this.g.length;a++)this.g[a]()};return a}(k),l=function(){function b(a){var b=this;this.length=this.size=0;this.a=this.d();this.a.q(function(){b.length--;
b.size--});this.a.r(function(){b.length++;b.size++});if(a)for(var e=0;e<a.length;e++)this.add(a[e])}b.prototype.d=function(){};b.prototype.add=function(a){this.a.set(a,a);return this};b.prototype["delete"]=function(a){return this.a["delete"](a)};b.prototype.has=function(a){return this.a.has(a)};return b}(),k=function(b){function a(){b.apply(this,arguments)}h(a,b);a.prototype.d=function(){return new n};a.prototype.add=function(a){if("object"!==typeof a)throw TypeError("Invalid value used in weak set");
this.a.set(a,void 0);return this};return a}(l),l=function(b){function a(a){var e=this;b.call(this,a);this.a.s(function(){e.length=0;e.size=0})}h(a,b);a.prototype.d=function(){return new p};a.prototype.add=function(a){b.prototype.add.call(this,a);return this};a.prototype.clear=function(){this.a.clear()};a.prototype.entries=function(){return this.a.entries()};a.prototype.forEach=function(a,b){var d=this;b=b||this;this.a.forEach(function(g,h){a.call(b,g,h,d)})};a.prototype.keys=function(){return this.a.keys()};
a.prototype.values=function(){return this.a.values()};return a}(l);d.WeakMap||(d.WeakMap=n);d.Map||(d.Map=p);d.Set||(d.Set=l);d.WeakSet||(d.WeakSet=k)})(this);