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OAAO,MAAQ,EAAG,KAAM,WAAa,EAAI,IACvE,KAKK,IAAM,EAAO,QAAQ,SAEtB,EADE,EAAS,OACF,mBAAqB,EAAS,EAAS,OAAS,kCAEhD,mBAAqB,EAAS,kCAErC,EAAS,SACX,EAAS,EAAO,QAAQ,OAAQ,+CAAiD,EAAS,OAAS,SAEvG,MAAM,GAAQ,eAAe,EAAS,EAAQ,EAAS,SAEhD,MAAM,GAEf,GAiBK,4BAA8B,SAAS,GAC1C,OAAO,MAAM,EAAI,QAAQ,MAAO,IAClC,EA0BA,MAAM,QAAQ","file":"/npm/compilers@2.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/compilers@2.0.0/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\n  compilers.js\n  Copyright 2016 Brandon Carl\n  MIT Licensed\n\n*/\n\n\n//\n//  Dependencies\n//\n\nvar desires = require(\"desires\"),\n    specs   = require(\"./specifications\"),\n    byName  = {},\n    byExt   = {},\n    cache   = {},\n    root;\n\n\n/**\n\n  Loads a processor (templating, transpiler, minification), and standardizes\n  callback to be fn(err, compiled). Defaults to `npm install` packages if they\n  are missing. To disable, set `options.fetch` to `false`;\n\n  Most packages are referenced by their npm name, common exceptions include:\n  javascript, html, css, es2015, and react.\n\n  Note that the callback is node style (err, compiled).\n\n  @param {String} name Name of module (npm install name).\n  @param {Object} options Options include {fetch} and {dir} (install directory).\n  @returns {Function} Processor of format `fn(str, options, next)`\n\n  @example\n  compilers(\"typescript\")\n  // => fn(str, options, next) for typescript\n\n**/\n\nroot = module.exports = function(name, options) {\n\n  // Return cache if available\n  if (cache[name]) return cache[name];\n\n  var pipeline = byName[name],\n      syntax = pipeline.syntax,\n      modules;\n\n  // Set default options\n  options = options || {};\n\n  // Optionally fetch modules using `npm install`\n  if (options.fetch || \"undefined\" === typeof options.fetch)\n    modules = pipeline.modules.map(function(x) { return desires(x, { dir : options.dir }); });\n  else\n    modules = pipeline.modules.map(function(x) { return require(x); });\n\n  // If blank, return\n  if (\"\" === syntax) {\n    cache[name] = function(str, options, next) { return next(null, str); };\n    return cache[name];\n  }\n\n  // Add core module to beginning (with dot property unless brackets)\n  if (-1 === syntax.indexOf(\"$0\"))\n    syntax = \"$0\" + ((\"(\" === syntax[0] || \"[\" === syntax[0]) ? \"\" : \".\") + syntax;\n\n  // Reinsert modules\n  modules.forEach(function(mod, i) {\n    syntax = syntax.replace(new RegExp(\"\\\\$\" + i, \"g\"), \"modules[\" + i + \"]\");\n  });\n\n  // While using \"eval\" is typically considered to be bad form, when calling another function the\n  // performance does not appear suffer in V8. See http://jsperf.com/eval-function-call.\n  // We find that \"eval\" is slightly faster\n  if (-1 === syntax.indexOf(\"next)\"))\n    if (pipeline.suffix)\n      syntax = \"try { next(null,\" + syntax + pipeline.suffix + \"); } catch (err) { next(err); }\"\n    else\n      syntax = \"try { next(null,\" + syntax + \"); } catch (err) { next(err); }\"\n  else\n    if (pipeline.suffix)\n      syntax = syntax.replace(\"next\", \"function(err, compiled) { next(err, compiled\" + pipeline.suffix + \"); }\")\n\n  cache[name] = createFunction(modules, syntax, pipeline.options);\n\n  return cache[name];\n\n};\n\n\n\n/**\n\n  Returns the default pipeline for an extension. Leading \".\" is removed.\n\n  @param {String} ext The file extension.\n  @returns {String} Name of the default pipeline.\n\n  @example\n  compilers.defaultCompilerForExtension(\"ts\");\n  // => \"typescript\"\n\n**/\n\nroot.defaultCompilerForExtension = function(ext) {\n  return byExt[ext.replace(/^\\./, \"\")];\n};\n\n\n\n\n//\n//  Helpers\n//\n\n// Wraps function to ensure proper polymorphism. We could use a library\n// like \"reorg\", but we code manually given simplicity and desire for performance.\n// `context` refers to local variables while `options` referes to compiler options\nfunction createFunction(modules, syntax, options) {\n  var fn = new Function(\"modules\", \"str\", \"context\", \"options\", \"next\", syntax);\n  options = options || {};\n  return function(str, context, next) {\n    if (\"function\" === typeof context) {\n      next = context;\n      context = {};\n    }\n    fn(modules, str, context, options, next);\n  };\n}\n\n\n// Ensure our configurations are properly formatted\nspecs.forEach(parseSpecification);\n\n// Creates byName and byExt dictionaries, and ensures that specification is\n// in the correct format.\nfunction parseSpecification(spec) {\n\n  // Create dictionary by name\n  byName[spec.name] = spec;\n\n  // Insert modules if missing\n  spec.modules = spec.modules || [];\n\n  // Expand extensions\n  if (!Array.isArray(spec.ext)) spec.ext = [spec.ext];\n\n  // Create dictionary by extension\n  spec.ext.forEach(function(ext) {\n    if (!byExt[ext]) byExt[ext] = spec.name;\n  });\n\n}\n"]}