{"version":3,"sources":["jsdelivr-header.js","/npm/riot-tag-loader@2.1.0/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,SAAW,QAAQ,kBACnB,WAAE,YAAe,QAAQ,gBACzB,iBAAmB,+BAOzB,SAAS,UAAU,GACjB,MAAO,qFAID,EAAK,KAAI,GAAO,gBAAgB,QAAS,KAAK,mBAGtD,CASA,SAAS,QAAQ,EAAQ,EAAM,GAC7B,MAAM,EAAO,IAAM,SAAS,QAAQ,EAAQ,EAAM,GAClD,OAAO,EAAK,UAAY,IAAS,CAAE,KAAM,IAAQ,KAAK,EACxD,CAEA,OAAO,QAAU,SAAS,GAExB,MAAM,EAAO,GAGP,EAAQ,WAAW,OAAS,CAAC,EAG7B,EAAO,OAAO,KAAK,GAAO,QAAO,SAAS,EAAK,GAEnD,OADA,EAAI,EAAI,QAAQ,IAAK,KAAO,EAAM,GAC3B,CACT,GAAG,CAAC,IAGE,KAAC,EAAI,IAAE,GAAO,QAClB,EACA,OAAO,OAAO,EAAM,CAClB,WAA8B,IAAnB,EAAK,WAAuB,KAAK,YAE9C,KAAK,cAIP,EAAK,QAAQ,kBAAkB,SAAS,EAAG,GACzC,EAAK,KAAK,EACZ,IAGA,MAAM,EAAS,yCAEX,UACA,EAAK,IAAM,UAAU,GAAQ,SASjC,OALI,KAAK,WAAW,KAAK,YAGrB,GAAK,KAAK,SAAS,KAAM,EAAQ,EAAI,UAElC,CACT","file":"/npm/riot-tag-loader@2.1.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.19.2.\n * Original file: /npm/riot-tag-loader@2.1.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","const compiler = require('riot-compiler')\nconst { getOptions } = require('loader-utils')\nconst TAGS_NAMES_REGEX = /riot.tag2\\(['|\"](.+?)['|\"],/g\n\n/**\n * Generate the hmr code depending on the tags generated by the compiler\n * @param   { Array } tags - array of strings\n * @returns { string } the code needed to handle the riot hot reload\n */\nfunction hotReload(tags) {\n  return `\n  if (module.hot) {\n    module.hot.accept()\n    if (module.hot.data) {\n      ${tags.map(tag => `riot.reload('${tag}')`).join('\\n')}\n    }\n  }`\n}\n\n/**\n * Compile using the riot compiler returning always an object with {map, code}\n * @param   { string } source - component source content\n * @param   { Object } opts   - compiler options\n * @param   { string } resourcePath - path to the component file\n * @returns { Object } result containing always the map and code keys\n */\nfunction compile(source, opts, resourcePath) {\n  const exec = () => compiler.compile(source, opts, resourcePath)\n  return opts.sourcemap ? exec() : { code: exec(), map: false }\n}\n\nmodule.exports = function(source) {\n  // tags collection\n  const tags = []\n\n  // parse the user query\n  const query = getOptions(this) || {}\n\n  // normalise the query object in case of question marks\n  const opts = Object.keys(query).reduce(function(acc, key) {\n    acc[key.replace('?', '')] = query[key]\n    return acc\n  }, {})\n\n  // compile and generate sourcemaps\n  const {code, map} = compile(\n    source,\n    Object.assign(opts, {\n      sourcemap: opts.sourcemap !== false && this.sourceMap\n    }),\n    this.resourcePath\n  )\n\n  // detect the tags names\n  code.replace(TAGS_NAMES_REGEX, function(_, match) {\n    tags.push(match)\n  })\n\n  // generate the output code\n  const output = `\n    var riot = require('riot')\n    ${code}\n    ${opts.hot ? hotReload(tags) : ''}\n  `\n\n  // cache this module\n  if (this.cacheable) this.cacheable()\n\n  // return code and sourcemap\n  if (map) this.callback(null, output, map.toJSON())\n\n  return output\n}\n"]}