"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../../../../../_virtual/ExplorerBase.js"),p=require("../../../../../../_virtual/___vite-browser-external.js"),_=require("./loaders.js"),g=require("./getPropertyByPath.js");var l;function x(){if(l)return a.__exports;l=1,Object.defineProperty(a.__exports,"__esModule",{value:!0}),a.__exports.getExtensionDescription=n,a.__exports.ExplorerBase=void 0;var s=h(p),c=_.__require(),u=g.__require();function h(t){return t&&t.__esModule?t:{default:t}}class d{constructor(e){e.cache===!0&&(this.loadCache=new Map,this.searchCache=new Map),this.config=e,this.validateConfig()}clearLoadCache(){this.loadCache&&this.loadCache.clear()}clearSearchCache(){this.searchCache&&this.searchCache.clear()}clearCaches(){this.clearLoadCache(),this.clearSearchCache()}validateConfig(){const e=this.config;e.searchPlaces.forEach(r=>{const o=s.default.extname(r)||"noExt",i=e.loaders[o];if(!i)throw new Error(`No loader specified for ${n(r)}, so searchPlaces item "${r}" is invalid`);if(typeof i!="function")throw new Error(`loader for ${n(r)} is not a function (type provided: "${typeof i}"), so searchPlaces item "${r}" is invalid`)})}shouldSearchStopWithResult(e){return!(e===null||e.isEmpty&&this.config.ignoreEmptySearchPlaces)}nextDirectoryToSearch(e,r){if(this.shouldSearchStopWithResult(r))return null;const o=f(e);return o===e||e===this.config.stopDir?null:o}loadPackageProp(e,r){const o=c.loaders.loadJson(e,r);return(0,u.getPropertyByPath)(o,this.config.packageProp)||null}getLoaderEntryForFile(e){if(s.default.basename(e)==="package.json")return this.loadPackageProp.bind(this);const r=s.default.extname(e)||"noExt",o=this.config.loaders[r];if(!o)throw new Error(`No loader specified for ${n(e)}`);return o}loadedContentToCosmiconfigResult(e,r){return r===null?null:r===void 0?{filepath:e,config:void 0,isEmpty:!0}:{config:r,filepath:e}}validateFilePath(e){if(!e)throw new Error("load must pass a non-empty string")}}a.__exports.ExplorerBase=d;function f(t){return s.default.dirname(t)}function n(t){const e=s.default.extname(t);return e?`extension "${e}"`:"files without extensions"}return a.__exports}exports.__require=x;
//# sourceMappingURL=ExplorerBase.js.map
