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AO,OAGtC,OAFA,wBAAwB,GAAK,wBAAwB,IAAM,QAC3D,wBAAwB,GAAG,KAAK,EAGpC,CACF,IAEA,MAAM,MAAQ,wBAAwB,QAAO,SAAU,EAAK,GAC1D,MAAO,IAAI,KAAQ,EACrB,GAAG,IAEG,OAAS,MAAM,KAAI,SAAU,GACjC,MAAM,EAAe,KAAK,KAAK,EAAQ,GAAI,EAAQ,MACnD,MAAO,CACL,MAAO,EAAQ,KACf,IAAK,EACL,SAAU,EACV,IAAK,EACL,aAAc,EAAQ,KACtB,KAAM,OAEV,IAEA,OAAO,OAAO","file":"/npm/arvis-open-in-vscode@0.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/arvis-open-in-vscode@0.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * @since 2019-08-14 02:43\n * @author vivaxy\n */\nconst path = require('path');\nconst arvish = require('arvish');\nconst glob = require('fast-glob');\n\nconst wds = process.env.wds.split(',');\n\nasync function updateProjectsCache() {\n  const projects = (\n    await Promise.all(\n      wds.map(async function (wd) {\n        const names = await glob('*', {\n          cwd: wd,\n          onlyDirectories: true,\n          dot: true,\n        });\n        return {\n          wd,\n          names,\n        };\n      }),\n    )\n  ).reduce(function (all, wdProject) {\n    return [\n      ...all,\n      ...wdProject.names.map(function (name) {\n        return {\n          name,\n          wd: wdProject.wd,\n        };\n      }),\n    ];\n  }, []);\n  arvish.cache.set('projects', JSON.stringify(projects));\n}\n\nfunction getProjects() {\n  const projectsCache = arvish.cache.get('projects');\n  if (projectsCache) {\n    return JSON.parse(projectsCache);\n  }\n  return [];\n}\n\nconst searchStrategies = {\n  matchFromStart(value, input) {\n    function format(v) {\n      return v.toLowerCase().replace(/[^a-z0-9]/g, '');\n    }\n    return format(value).startsWith(format(input));\n  },\n  matchIncludes(value, input) {\n    function format(v) {\n      return v.toLowerCase().replace(/[^a-z0-9]/g, '');\n    }\n    return format(value).includes(format(input));\n  },\n  keywordIncludes(value, input) {\n    const keywords = input\n      .replace(/[^a-z0-9]/g, ' ')\n      .split(' ')\n      .filter(function (v) {\n        return !!v;\n      });\n    return keywords.every((keyword) => {\n      return searchStrategies.matchIncludes(value, keyword);\n    });\n  },\n};\n\nupdateProjectsCache();\nconst projects = getProjects();\nconst searchResultsByStrategy = [];\nconst searchStrategyNames = [\n  'matchFromStart',\n  'matchIncludes',\n  'keywordIncludes',\n];\n\nprojects.forEach(function (project) {\n  for (let i = 0; i < searchStrategyNames.length; i++) {\n    const searchStrategy = searchStrategies[searchStrategyNames[i]];\n    if (searchStrategy(project.name, arvish.input)) {\n      searchResultsByStrategy[i] = searchResultsByStrategy[i] || [];\n      searchResultsByStrategy[i].push(project);\n      return;\n    }\n  }\n});\n\nconst items = searchResultsByStrategy.reduce(function (all, searchResults) {\n  return [...all, ...searchResults];\n}, []);\n\nconst output = items.map(function (project) {\n  const absolutePath = path.join(project.wd, project.name);\n  return {\n    title: project.name,\n    uid: absolutePath,\n    subtitle: absolutePath,\n    arg: absolutePath,\n    autocomplete: project.name,\n    type: 'file',\n  };\n});\n\narvish.output(output);\n"]}