function g(e,t){if(void 0===t&&(t={}),!e)return M;if("string"==typeof e||m(e)){var n=c(e,t);if(n===k)return M;var o=function(e,t){return!!n(e,t)};return n.allBasenames&&(o.allBasenames=n.allBasenames),
n.allPaths&&(o.allPaths=n.allPaths),o}return function(e,t){var n=v(Object.getOwnPropertyNames(e).map(function(i){return function(e,t,i){if(!1===t)return k;var n=c(e,i);if(n===k)return k;if("boolean"==typeof t)return n;if(t){var o=t.when;if("string"==typeof o){var r=function(t,i,r,s){if(!s||!n(t,i))return null;var l=o.replace("$(basename)",r),u=s(l);return a.isThenable(u)?u.then(function(t){return t?e:null}):u?e:null};return r.requiresSiblings=!0,r}}return n}(i,e[i],t)}).filter(function(e){return e!==k})),o=n.length;if(!o)return k;if(!n.some(function(e){return!!e.requiresSiblings})){if(1===o)return n[0];var s=function(e,t){for(var i=0,o=n.length;i<o;i++){var r=n[i](e,t);if(r)return r}return null},l=i.first(n,function(e){return!!e.allBasenames});l&&(s.allBasenames=l.allBasenames);var u=n.reduce(function(e,t){return t.allPaths?e.concat(t.allPaths):e},[]);return u.length&&(s.allPaths=u),s}var d=function(e,t,i){for(var o=void 0,s=0,a=n.length;s<a;s++){var l=n[s];l.requiresSiblings&&i&&(t||(t=r.basename(e)),
o||(o=t.substr(0,t.length-r.extname(e).length)));var u=l(e,t,o,i);if(u)return u}return null},h=i.first(n,function(e){return!!e.allBasenames});h&&(d.allBasenames=h.allBasenames);var p=n.reduce(function(e,t){return t.allPaths?e.concat(t.allPaths):e},[]);p.length&&(d.allPaths=p);return d}(e,t)}
")?e.substr(0,e.length-2):e}function f(e,t,i){var o=r.sep!==r.posix.sep?e.replace(S,r.sep):e,s=r.sep+o,a=i?function(e,i){return"string"!=typeof e||e!==o&&!n.endsWith(e,s)?null:t}:function(e,i){return"string"==typeof e&&e===o?t:null};return a.allPaths=[(i?"