{"version":3,"sources":["jsdelivr-header.js","/npm/slim-lang-loader@0.0.9/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,WAAa,QAAQ,gBAAgB,WACrC,SAAW,QAAQ,iBAAiB,SACpC,GAAK,QAAQ,MACb,KAAO,QAAQ,QACf,SAAW,QAAQ,mBAGvB,SAAS,iBAAiB,GACzB,OAAO,OAAO,QAAQ,GAAa,KAAI,SAAS,GAG/C,MAAO,OAAU,EAAkB,KAAK,KAAO,GAChD,IAAG,KAAK,IACT,CAEA,SAAS,cAAc,EAAQ,GAC9B,IAAI,EAAsB,iBAAiB,GAC3C,OAAO,SAAS,UAAU,IAAuB,CAAE,MAAO,GAC3D,CAEA,OAAO,QAAU,SAAS,GACzB,IAAI,EAAS,KAEb,EAAO,WAAa,EAAO,YAE3B,IAGI,EAHA,EAAS,SAAS,CAAC,EAAG,WAAW,GAAS,CAC7C,YAAa,CAAC,IAGf,IACC,EAAS,cAAc,EAAQ,EAAoB,YACpD,CAAE,MAAO,GACR,IAAI,EAAM,GACV,GAAkB,MAAd,EAAE,UAA+C,MAA3B,EAAE,SAAS,cAAiD,MAAzB,EAAE,SAAS,WACvE,GAAO,+FAAiG,EAAI,SACtG,CACN,IAAI,EAAW,EAAO,MAAM,MAAM,EAAE,SAAS,YACzC,EAAsB,EAAE,SAAS,aAAe,EAAS,OAAU,EAAS,EAAE,SAAS,cAAgB,GAC3G,GAAO,EAAI,KAEX,GAAO,QAAU,EAAE,SAAS,WAAa,KAAO,EAAS,UAAU,EAAG,EAAE,SAAS,cAAgB,EAAqB,EAAS,UAAU,EAAE,SAAS,aAAe,GAAK,KACxK,GAAO,YAAe,IAAI,MAAM,EAAE,SAAS,aAAe,GAAG,KAAK,KAAQ,KAC3E,CACA,MAAM,IAAI,MAAM,EACjB,CACA,KAAK,SAAS,KAAM,EACrB","file":"/npm/slim-lang-loader@0.0.9/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/slim-lang-loader@0.0.9/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","var getOptions = require('loader-utils').getOptions;\nvar execSync = require('child_process').execSync\nvar fs = require(\"fs\")\nvar path = require(\"path\")\nvar defaults = require('lodash.defaults')\n\n\nfunction prepareArguments(slimOptions) {\n\treturn Object.entries(slimOptions).map(function(option_with_value) {\n\t\t// Appends options like:\n\t\t// -o \"foo=bar\" -o \"baz=blah\"\n\t\treturn \"-o \\\"\" + option_with_value.join(\"=\") + \"\\\"\";\n\t}).join(\" \");\n}\n\nfunction compileToSlim(source, slimOptions) {\n\tvar additionalArguments = prepareArguments(slimOptions);\n\treturn execSync(`slimrb ${additionalArguments}`, { input: source })\n}\n\nmodule.exports = function(source) {\n\tvar loader = this;\n\n\tloader.cacheable && loader.cacheable();\n\n\tvar config = defaults({}, getOptions(loader), {\n\t\tslimOptions: {}\n\t});\n\tvar result;\n\ttry {\n\t\tresult = compileToSlim(source, config['slimOptions']);\n\t} catch (e) {\n\t\tvar err = \"\";\n\t\tif (e.location == null || e.location.first_column == null || e.location.first_line == null) {\n\t\t\terr += \"Got an unexpected exception from the slim-lang-script compiler. The original exception was: \" + e + \"\\n\";\n\t\t} else {\n\t\t\tvar codeLine = source.split(\"\\n\")[e.location.first_line];\n\t\t\tvar offendingCharacter = (e.location.first_column < codeLine.length) ? codeLine[e.location.first_column] : \"\";\n\t\t\terr += e + \"\\n\";\n\t\t\t// log erroneous line and highlight offending character\n\t\t\terr += \"    L\" + e.location.first_line + \": \" + codeLine.substring(0, e.location.first_column) + offendingCharacter + codeLine.substring(e.location.first_column + 1) + \"\\n\";\n\t\t\terr += \"         \" + (new Array(e.location.first_column + 1).join(\" \")) + \"^\\n\";\n\t\t}\n\t\tthrow new Error(err);\n\t}\n\tthis.callback(null, result);\n}\n"]}