text: !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("iteratez",[],r):"object"==typeof exports?exports.iteratez=r():t.iteratez=r()}(this,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=0)}([function(t,r,e){"use strict";var n;e.r(r),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP",t[t.REMOVE=2]="REMOVE",t[t.REPLACE=3]="REPLACE"}(n||(n={}));var o=function(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}},i=function(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,o,i=e.call(t),u=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)u.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return u},u=function(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(i(arguments[r]));return t},a=function(){function t(t,r){this.result=null,this.source=t,r&&(this.equality=r.equality,this.comparator=r.comparator)}return t.prototype.onReset=function(t){return this.handleReset=t,this},t.prototype.canReset=function(){return!!this.handleReset},t.prototype.reset=function(t,r){if(void 0===r&&(r=!0),this.handleReset)this.handleReset(t);else if(r)throw new Error("This iterator does not support reset.");return this},t.prototype.clone=function(){return new t(this.source,this)},t.prototype.act=function(t,r){return this.action=n.CONTINUE,this.replaceWith=null,this.callback(t,r,this),this.action},t.prototype.stop=function(t){return this.result=t,this.action=n.STOP,this},t.prototype.isStopped=function(){return this.action===n.STOP},t.prototype.replace=function(t){return this.replaceWith=t,this.action=n.REPLACE,this},t.prototype.remove=function(){return this.action=n.REMOVE,this},t.prototype.withEquality=function(t){return this.equality=t,this},t.prototype.withComparator=function(t){return this.comparator=t,this.equality||(this.equality=function(r,e){return 0===t(r,e)}),this},t.prototype.withLogic=function(t,r){return this.comparator=t,this.equality=r||function(r,e,n,o){return 0===t(r,e,n,o)},this},t.prototype.numbers=function(t,r){return void 0===t&&(t=!0),void 0===r&&(r=!1),this.withLogic(y(t,r))},t.prototype.strings=function(t,r,e){return void 0===t&&(t=!0),void 0===r&&(r=!0),void 0===e&&(e=!1),this.withLogic(d(t,r,e))},t.prototype.dates=function(t,r,e,n){return void 0===t&&(t=1),void 0===r&&(r=!0),void 0===e&&(e=!0),void 0===n&&(n=!1),this.withLogic(E(e,n),w(t,r))},t.prototype.desc=function(t){var r=t||this.comparator;return this.comparator=function(t,e,n,o){return r(e,t,o,n)},this},t.prototype.getEquality=function(t){return t||this.equality||function(t,r){return 0===v(t,r,!0)}},t.prototype.getComparator=function(t){return t||this.comparator||function(t,r){return v(t,r,!1)}},t.prototype.empty=function(t){var r=!this.each(function(t,r,e){return e.stop()}).isStopped();return t?(t(r),this):r},t.prototype.has=function(t){var r=this.each(function(t,r,e){return e.stop()}).isStopped();return t?(t(r),this):r},t.prototype.contains=function(t,r){var e=this.getEquality(),n=this.where(function(r,n){return e(r,t,n)}).has();return r?(r(n),this):n},t.prototype.count=function(t){var r=0;return this.each(function(){return r++}),t?(t(r),this):r},t.prototype.first=function(t){var r=this.each(function(t,r,e){return e.stop(t)}).result;return t?(t(r),this):r},t.prototype.last=function(t){var r=null;return this.each(function(t){return r=t}),t?(t(r),this):r},t.prototype.array=function(t,r){void 0===t&&(t=[]);var e=p(t)?[]:t,n=p(t)?t:r;return this.each(function(t){return e.push(t)}),n?(n(e),this):e},t.prototype.entries=function(t,r){void 0===t&&(t=[]);var e=p(t)?[]:t,n=p(t)?t:r;return this.each(function(t,r){return e.push([r,t])}),n?(n(e),this):e},t.prototype.object=function(t,r,e){void 0===r&&(r=Object.create(null));var n=p(r)?Object.create(null):r,o=p(r)?r:e;return this.each(function(r){return n[t(r)]=r}),o?(o(n),this):n},t.prototype.set=function(t,r){void 0===t&&(t=new Set);var e=p(t)?new Set:t,n=p(t)?t:r;return this.each(function(t){return e.add(t)}),n?(n(e),this):e},t.prototype.map=function(t,r){void 0===t&&(t=new Map);var e=p(t)?new Map:t,n=p(t)?t:r;return this.each(function(t,r){return e.set(r,t)}),n?(n(e),this):e},t.prototype.group=function(t,r,e){void 0===r&&(r=Object.create(null));var n=p(r)?Object.create(null):r,o=p(r)?r:e;return this.each(function(r){var e=t(r);e in n?n[e].push(r):n[e]=[r]}),o?(o(n),this):n},t.prototype.reduce=function(t,r,e){var n=t;return this.each(function(t){return n=r(t,n)}),e?(e(n),this):n},t.prototype.min=function(t){var r=this.getComparator(),e=this.reduce(null,function(t,e){return null===e||r(t,e)<0?t:e});return t?(t(e),this):e},t.prototype.max=function(t){var r=this.getComparator(),e=this.reduce(null,function(t,e){return null===e||r(t,e)>0?t:e});return t?(t(e),this):e},t.prototype.changes=function(t,r,e,u){var a,c,s=this;this.history||(this.history=new Map);var f=new Map(this.history);this.each(function(r,o,i){var a=u?u(r,o,i):r;s.history.has(a)?e(r,o,i):(t(r,o,i),i.result!==n.REMOVE&&s.history.set(a,[o,r])),f.delete(a)});try{for(var p=o(f.values()),h=p.next();!h.done;h=p.next()){var l=i(h.value,2),v=l[0];r(l[1],v,this)}}catch(t){a={error:t}}finally{try{h&&!h.done&&(c=p.return)&&c.call(p)}finally{if(a)throw a.error}}return this},t.prototype.delete=function(){return this.each(function(t,r,e){return e.remove()})},t.prototype.extract=function(r){var e=[];this.each(function(t,r,n){return e.push([r,t])&&n.remove()});var n=t.entries(e);return r?(r(n),this):n},t.prototype.overwrite=function(t){return this.each(function(r,e,n){return n.replace(t)})},t.prototype.update=function(t){return this.each(function(r,e,n){return n.replace(t(r,e))})},t.prototype.fork=function(t){return t(this),this},t.prototype.split=function(t,r){var e=this.where(t),n=this.not(t);return r?(r(e,n),this):{pass:e,fail:n}},t.prototype.unzip=function(t){var r=this.keys(),e=this.values();return t?(t(r,e),this):{keys:r,values:e}},t.prototype.keys=function(){var r=this;return new t(function(t){var e=0;r.each(function(r,o,i){switch(t.act(o,e++)){case n.STOP:i.stop();break;case n.REMOVE:i.remove();break;case n.REPLACE:}})}).onReset(this.handleReset)},t.prototype.values=function(){var r=this;return new t(function(t){r.each(function(r,e,o){var i=0;switch(t.act(r,i++)){case n.STOP:o.stop();break;case n.REMOVE:o.remove();break;case n.REPLACE:o.replace(t.replaceWith)}})},this).onReset(this.handleReset)},t.prototype.view=function(r,e,o,i){var u=this;return new t(function(t){var a=r();u.each(function(r,u,c){if(e(a,r,u)){switch(t.act(r,u)){case n.STOP:c.stop();break;case n.REMOVE:c.remove();break;case n.REPLACE:c.replace(t.replaceWith)}o&&o(a,r,u,c)}else i&&i(a,r,u,c)})},this).onReset(this.handleReset)},t.prototype.take=function(r){return r<=0?t.empty():this.view(function(){return{amount:r}},function(t){return t.amount>0},function(t){return t.amount--},function(t,r,e,n){return n.stop()})},t.prototype.skip=function(t){return this.view(function(){return{skipped:0}},function(r){return r.skipped>=t},function(t){return t.skipped++},function(t){return t.skipped++})},t.prototype.drop=function(t){return this.reverse().skip(t).reverse()},t.prototype.append=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return t.join.apply(t,u([this],r)).onReset(this.handleReset)},t.prototype.prepend=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return t.join.apply(t,u(r,[this])).onReset(this.handleReset)},t.prototype.where=function(t){return this.view(function(){return null},function(r,e,n){return t(e,n)})},t.prototype.not=function(t){return this.view(function(){return null},function(r,e,n){return!t(e,n)})},t.prototype.gt=function(t,r){var e=this;return this.view(function(){return e.getComparator(r)},function(r,e,n){return r(e,t,n)>0})},t.prototype.gte=function(t,r){var e=this;return this.view(function(){return e.getComparator(r)},function(r,e,n){return r(e,t,n)>=0})},t.prototype.lt=function(t,r){var e=this;return this.view(function(){return e.getComparator(r)},function(r,e,n){return r(e,t,n)<0})},t.prototype.lte=function(t,r){var e=this;return this.view(function(){return e.getComparator(r)},function(r,e,n){return r(e,t,n)<=0})},t.prototype.exclude=function(t,r){var e=this;return this.view(function(){return f(t).withEquality(e.getEquality(r))},function(t,r){return!t.contains(r)})},t.prototype.intersect=function(t,r){var e=this;return this.view(function(){return f(t).withEquality(e.getEquality(r))},function(t,r){return t.contains(r)})},t.prototype.unique=function(t){var r=this;return this.view(function(){return{existing:[],isEqual:r.getEquality(t)}},function(t,r,e){var n=t.existing,o=t.isEqual;return-1===n.findIndex(function(t){var n=i(t,2),u=n[0],a=n[1];return o(a,r,u,e)})},function(t,r,e){return t.existing.push([e,r])})},t.prototype.duplicates=function(t,r){var e=this;return void 0===t&&(t=!1),this.view(function(){return{existing:[],once:[],isEqual:e.getEquality(r)}},function(r,e,n){var o=r.existing,u=r.once,a=r.isEqual,c=o.findIndex(function(t){var r=i(t,2),o=r[0],u=r[1];return a(u,e,o,n)}),s=-1!==c;return s?(u[c]&&t&&(s=!1),u[c]=!0):o.push([n,e]),s})},t.prototype.readonly=function(){var r=this;return new t(function(t){r.each(function(r,e,o){t.act(r,e)===n.STOP&&o.stop()})},this).onReset(this.handleReset)},t.prototype.copy=function(){return t.entries(this.entries())},t.prototype.viewResolved=function(r){var e=this;return new t(function(t){var o=e.entries(),i=[],u=[],a=[],c=!1;if(r(o,function(r,e,o){var s=t.act(r,e);return s!==n.REPLACE&&s!==n.REMOVE||(c=!0,a[o]=r,i[o]=s,u[o]=t.replaceWith),s}),c){var s=0;e.each(function(t,r,e){switch(i[s]){case n.REMOVE:t===a[s]&&e.remove();break;case n.REPLACE:t===a[s]&&e.replace(u[s])}s++})}},this).onReset(this.handleReset)},t.prototype.sorted=function(t){var r=this;return this.viewResolved(function(e,u){var a,c,s=r.getComparator(t),f=e.map(function(t,r){var e=i(t,2);return{key:e[0],value:e[1],index:r}});f.sort(function(t,r){return s(t.value,r.value)});try{for(var p=o(f),h=p.next();!h.done;h=p.next()){var l=h.value,v=l.key;if(u(l.value,v,l.index)===n.STOP)return}}catch(t){a={error:t}}finally{try{h&&!h.done&&(c=p.return)&&c.call(p)}finally{if(a)throw a.error}}})},t.prototype.shuffle=function(t){void 0===t&&(t=1);var r=function(t,r,e){var n=t[r];t[r]=t[e],t[e]=n};return this.viewResolved(function(e,o){for(var u=[],a=e.length,c=0;c<a;c++)u.push(c);for(var s=0;s<t;s++)for(var f=0;f<a;f++){var p=Math.floor(Math.random()*a);r(e,p,f),r(u,p,f)}for(c=0;c<a;c++){var h=i(e[c],2),l=h[0];if(o(h[1],l,u[c])===n.STOP)return}})},t.prototype.reverse=function(){return this.viewResolved(function(t,r){for(var e=t.length-1;e>=0;e--){var o=i(t[e],2),u=o[0];if(r(o[1],u,e)===n.STOP)return}})},t.prototype.transform=function(r,e){var o=this;return void 0===e&&(e=null),new t(function(t){o.each(function(o,i,u){var a=r(o,i,u);if(void 0!==a)switch(t.act(a,i)){case n.STOP:u.stop();break;case n.REMOVE:u.remove();break;case n.REPLACE:e&&u.replace(e(t.replaceWith,a,o,i))}})}).onReset(this.handleReset)},t.prototype.each=function(t){return this.result=void 0,this.callback=t,this.action=n.CONTINUE,this.source(this),this.callback=null,this},t.prototype.withResult=function(t){return this.result&&t(this.result),this},t.prototype[Symbol.iterator]=function(){return this.array().values()},t.entries=function(r){return void 0===r&&(r=[]),new t(function(t){for(var e=0;e<r.length;e++){var o=i(r[e],2),u=o[0],a=o[1];switch(t.act(a,u)){case n.STOP:return;case n.REMOVE:r.splice(e,1),e--;break;case n.REPLACE:r.splice(e,1,[u,t.replaceWith])}}}).onReset(function(t){return r=t})},t.array=function(r){return void 0===r&&(r=[]),new t(function(t){for(var e=0;e<r.length;e++)switch(t.act(r[e],e)){case n.STOP:return;case n.REMOVE:r.splice(e,1),e--;break;case n.REPLACE:r.splice(e,1,t.replaceWith)}}).onReset(function(t){return r=t})},t.zip=function(r,e){var o=f(r),u=f(e);return new t(function(t){var r=o.array(),e=[],i=0;if(u.each(function(o,u,a){if(i>=r.length)a.stop();else switch(t.act(o,r[i])){case n.STOP:return;case n.REMOVE:a.remove(),e.push(i);break;case n.REPLACE:a.replace(t.replaceWith)}i++}),e.length>0){var a=0;o.each(function(t,r,n){a===e[0]?(n.remove(),e.shift()):0===e.length&&n.stop(),a++})}}).onReset(function(t){var r=i(t,2),e=r[0],n=r[1];o=f(e),u=f(n)})},t.hasEntries=function(r,e,o){return new t(function(t){for(var u=r.entries(),a=u.next();!a.done;a=u.next()){var c=i(a.value,2),s=c[0],f=c[1];switch(t.act(f,s)){case n.STOP:return;case n.REMOVE:e&&e(r,s,f);break;case n.REPLACE:o&&o(r,s,f,t.replaceWith)}}}).onReset(function(t){return r=t})},t.map=function(r){return void 0===r&&(r=new Map),t.hasEntries(r,function(t,r){return t.delete(r)},function(t,r,e,n){return t.set(r,n)})},t.set=function(r){return void 0===r&&(r=new Set),t.hasEntries(r,function(t,r){return t.delete(r)},function(t,e,n,o){return r.delete(n)&&r.add(o)})},t.iterable=function(r){return new t(function(t){for(var e=r[Symbol.iterator](),o=0,i=e.next();!i.done&&t.act(i.value,o)!==n.STOP;i=e.next(),o++);}).onReset(function(t){return r=t})},t.object=function(r,e){return void 0===e&&(e=!0),new t(function(t){for(var o in r)if(!e||r.hasOwnProperty(o))switch(t.act(r[o],o)){case n.STOP:return;case n.REMOVE:delete r[o];break;case n.REPLACE:r[o]=t.replaceWith}}).onReset(function(t){return r=t})},t.linked=function(r,e,o,i,u){return u||(u=function(t){return r(t)}),function(a,c){return void 0===c&&(c=!0),new t(function(t){for(var s=a,f=e(a);f&&f!==a;){var p=e(f),h=!1;switch(t.act(r(f),u(f))){case n.STOP:return;case n.REMOVE:if(o)o(f,s),h=!0;else if(c)throw new Error("remove is required for linked list iteration");break;case n.REPLACE:if(i)i(f,t.replaceWith);else if(c)throw new Error("replace is required for linked list iteration")}h||(s=f),f=p}}).onReset(function(t){return a=t})}},t.tree=function(r,e,o,i){i||(i=function(t){return r(t)});var u=t.empty(),a=function(r){var n=e(r);return n?Array.isArray(n)?t.array(n):n:u},c=function(t,e,u,a,c){switch(e.act(r(t),i(t))){case n.STOP:return c&&c.stop(),!1;case n.REPLACE:if(o)o(t,e.replaceWith);else if(u)throw new Error("replaceValue is required when replacing a value in a tree");break;case n.REMOVE:if(c)c.remove();else if(u&&a)throw new Error("remove is not supported for breadth-first iteration")}return!0},s=function(t,r,e,n){return!!c(t,r,e,!1,n)&&!a(t).each(function(t,n,o){return s(t,r,e,o)}).isStopped()};return function(r,e,n){return void 0===e&&(e=!0),void 0===n&&(n=!0),new t(function(t){return e?s(r,t,n):function(t,r,e){var n=[];for(n.push(t);n.length>0;){var o=n.shift();if(!c(o,r,e,!0))break;a(o).array(n)}}(r,t,n)}).onReset(function(t){return r=t})}},t.join=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return new t(function(t){var e,i,u=r.map(f);try{for(var a=o(u),c=a.next();!c.done;c=a.next()){var s=c.value;if(s.each(function(r,e,o){switch(t.act(r,e)){case n.REMOVE:o.remove();break;case n.STOP:o.stop();break;case n.REPLACE:o.replace(t.replaceWith)}}),s.action===n.STOP)return}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}})},t.empty=function(){return new t(function(t){})},t.func=function(t){return function(r){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var o,i=f(r);return t.apply(void 0,u([i,function(t){return o=t}],e)),o}},t}(),c=function(t){var r="function"==typeof Symbol&&t[Symbol.iterator],e=0;return r?r.call(t):{next:function(){return t&&e>=t.length&&(t=void 0),{value:t&&t[e++],done:!t}}}},s=[function(t){return t instanceof a&&t},function(t){return!!Array.isArray(t)&&a.array(t)},function(t){return t instanceof Set&&a.set(t)},function(t){return t instanceof Map&&a.map(t)},function(t){return!(!t||!t[Symbol.iterator])&&a.iterable(t)},function(t){return!(!t||!t.entries)&&a.hasEntries(t)},function(t){return null==t&&a.empty()},function(t){return"object"==typeof t&&a.object(t)},function(t){return a.array([t])}];function f(t){var r,e;try{for(var n=c(s),o=n.next();!o.done;o=n.next()){var i=(0,o.value)(t);if(!1!==i)return i}}catch(t){r={error:t}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(r)throw r.error}}}function p(t){return"function"==typeof t}function h(t,r,e,n,o,i){var u=!o(e),a=!o(n);return u!==a?(r?u:a)?-1:1:u?0:t?i(e,n):i(n,e)}function l(t,r,e,n){var o=!e(t);return o===!e(r)&&(!!o||n(t,r))}function v(t,r,e){void 0===e&&(e=!1);var n=null==t;if(n!==(null==r))return n?1:-1;if(n)return 0;var o=typeof t;if(o!==typeof r){if(e)return-1;throw new Error("You must implement your own comparator for unknown or mixed values.")}if("string"===o)return t.localeCompare(r);if("number"===o)return t-r;if("boolean"===o)return(t?1:0)-(r?1:0);if(t instanceof Date&&r instanceof Date)return t.getTime()-r.getTime();if(!e)throw new Error("You must implement your own comparator for unknown or mixed values.");if(t instanceof Array){if(0!==(a=t.length-r.length))return a;for(var i=0;i<t.length;i++)if(0!==(a=v(t[i],r[i],e)))return a;return 0}if("object"===o){for(var u in t)if(!(u in r))return-1;for(var u in r){if(!(u in t))return-1;var a;if(0!==(a=v(t[u],r[u],e)))return a}}return 0}function y(t,r){void 0===t&&(t=!0),void 0===r&&(r=!1);var e=function(t){return"number"==typeof t&&isFinite(t)},n=function(t,r){return t-r};return function(o,i){return h(t,r,o,i,e,n)}}function d(t,r,e){void 0===t&&(t=!0),void 0===r&&(r=!0),void 0===e&&(e=!1);var n=function(t){return"string"==typeof t},o=t?function(t,r){return t.localeCompare(r)}:function(t,r){return t.toLowerCase().localeCompare(r.toLowerCase())};return function(t,i){return h(r,e,t,i,n,o)}}function E(t,r){void 0===t&&(t=!0),void 0===r&&(r=!1);var e=function(t){return t instanceof Date},n=function(t,r){return t.getTime()-r.getTime()};return function(o,i){return h(t,r,o,i,e,n)}}function w(t,r){void 0===t&&(t=1),void 0===r&&(r=!0);var e=function(t){return t instanceof Date},n=r?function(t){return t.getTime()}:function(t){return t.getTime()+6e4*t.getTimezoneOffset()},o=function(r,e){return n(r)%t==n(e)%t};return function(t,r){return l(t,r,e,o)}}e.d(r,"Generators",function(){return s}),e.d(r,"iterate",function(){return f}),e.d(r,"isFunction",function(){return p}),e.d(r,"compare",function(){return h}),e.d(r,"equals",function(){return l}),e.d(r,"defaultCompare",function(){return v}),e.d(r,"getNumberComparator",function(){return y}),e.d(r,"getStringComparator",function(){return d}),e.d(r,"getDateComparator",function(){return E}),e.d(r,"getDateEquality",function(){return w}),e.d(r,"IterateAction",function(){return n}),e.d(r,"Iterate",function(){return a});r.default=f}])});
  //# sourceMappingURL=iteratez.js.map