!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){var e,n,r=require("fs"),i=require("path"),t=require("fmerge"),a=require("rimraf");function f(n,i){var t=r.statSync(n).mtime.getTime();return e>t+1e3*i}function o(e){return e&&"limit"in e}function u(e){return e&&"totalRemoved"in e}function c(e){return u(e)?e.totalRemoved:-2}function s(e){return c(e)>=function(e){return o(e)?e.limit:-1}(e)}function l(e){return e&&"maxLevel"in e}function d(e){return l(e)?e.maxLevel:-1}function v(e){return e&&e.age&&e.age.seconds?e.age.seconds:null}var m=module.exports=function(y,x,g){var A={};if(!s(x)&&r.existsSync(y)){var O=d(x),h=!1;o(x)&&(x.totalRemoved=u(x)?c(x):0),void 0===g?g=0:g++,g<1?(e=(new Date).getTime(),n=function(e){return!(!e||!("test"in e))&&e.test}(x)):h=function(e,n,r){var t=!1,a=n&&n.dir;if(a){var u=v(n),c=i.basename(e);Array.isArray(a)?t=-1!==a.indexOf("*")||-1!==a.indexOf(c):c!==a&&"*"!==a||(t=!0),t&&o(n)&&(t=!s(n)),t&&l(n)&&r>0&&(t=r<=d(n)),u&&t&&(t=f(e,u))}return t}(y,x,g),(-1===O||g<O)&&r.readdirSync(y).forEach(function(e){var a,c=i.join(y,e),l=!1;try{a=r.statSync(c)}catch(e){l=!0}if(l);else if(a.isDirectory()){var d=m(c,x,g);A=t(A,d),u(x)&&(x.totalRemoved+=Object.keys(d).length)}else if(function(e,n){void 0===n&&(n={});var r=!1,t=n.extensions?n.extensions:null,a=n.files?n.files:null,u=n.prefix?n.prefix:null,c=n&&n.ignore?n.ignore:null,l=i.basename(e);if(a&&(r=Array.isArray(a)?-1!==a.indexOf("*.*")||-1!==a.indexOf(l):"*.*"===a||l===a),!r&&t){var d=i.extname(e);r=Array.isArray(t)?-1!==t.indexOf(d):d===t}if(!r&&u&&(r=0===l.indexOf(u)),r&&o(n)&&(r=!s(n)),r&&c&&(r=Array.isArray(c)?!(-1!==c.indexOf(l)):!(l===c)),r){var m=v(n);m&&(r=f(e,m))}return r}(c,x)){var O;if(n)O=!0;else try{r.unlinkSync(c),O=!0}catch(e){}O&&(A[c]=!0,u(x)&&x.totalRemoved++)}}),h&&(n||a.sync(y),u(x)||(A[y]=!0))}return A}});
//# sourceMappingURL=find-remove.umd.js.map
