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AE,eAAgB,KAAK,OAAO,KACtD,EAAS,IAAI,EAAS,QACxB,CAEA,SAAS,SAAS,GAChB,IACI,GADQ,EAAQ,QAAQ,OAAS,IACnB,QAAQ,SAAU,IAAI,MAAM,KAC1C,EAAe,EAAM,GACrB,EAAa,EAAM,GACvB,OAAO,GAAgB,CACzB,CAEA,SAAS,gBAAgB,EAAS,EAAU,GAC1C,IAAI,EAAQ,EAAQ,QAAQ,MACxB,EAAQ,EAAQ,OAChB,EAAQ,EAAM,QAAQ,SAAU,IAAI,MAAM,KAC1C,EAAe,EAAM,GACrB,EAAa,EAAM,GAEnB,EAAQ,SAAS,EAAc,IAC/B,EAAM,EAAa,SAAS,EAAY,IAAM,EAC9C,EAAa,EAAM,EACvB,EAAS,UAAU,IAAK,CACtB,gBAAiB,SAAW,EAAQ,IAAM,EAAM,IAAM,EACtD,gBAAiB,QACjB,iBAAkB,IAEpB,EAAS,IAAI,EAAQ,MAAM,EAAO,GACpC,CAEA,SAAS,MAAM,GACb,MAAO,YAAwB,EAAO,YACxC,CAEA,SAAS,yBAAyB,GACP,CAAC,SAAU,WACjB,SAAQ,SAAU,GACnC,QAAQ,GAAG,GAAQ,WACjB,EAAO,QACP,QAAQ,MACV,GACF,GACF,CAEA,OAAO,QAAU","file":"/npm/rollup-plugin-dev-server@0.4.3/dist/index.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/rollup-plugin-dev-server@0.4.3/dist/index.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nfunction _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }\n\nvar fs = require('fs');\nvar https = require('https');\nvar http = require('http');\nvar path = require('path');\nvar mime = _interopDefault(require('mime'));\nvar opener = _interopDefault(require('opener'));\n\nfunction serve(options) {\n  if ( options === void 0 ) options = { contentBase: '' };\n\n  if (Array.isArray(options) || typeof options === 'string') {\n    options = { contentBase: options };\n  }\n  options.contentBase = Array.isArray(options.contentBase) ? options.contentBase : [options.contentBase];\n  options.host = options.host || 'localhost';\n  options.port = options.port || 10001;\n  options.headers = options.headers || {};\n  options.https = options.https || false;\n  mime.default_type = 'text/plain';\n\n  var requestListener = function (request, response) {\n    // Remove querystring\n    var urlPath = decodeURI(request.url.split('?')[0]);\n\n    Object.keys(options.headers).forEach(function (key) {\n      response.setHeader(key, options.headers[key]);\n    });\n\n    // support cors request\n    if (options.allowCrossOrigin) {\n      response.setHeader('Access-Control-Allow-Origin', '*');\n      response.setHeader('Access-Control-Request-Method', '*');\n      response.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');\n      response.setHeader('Access-Control-Allow-Headers', '*');\n\n      if (request.method === 'OPTIONS' ) {\n        response.writeHead(200);\n        response.end();\n        return;\n      }\n    }\n\n    readFileFromContentBase(options.contentBase, urlPath, function (error, content, filePath) {\n      if (!error) {\n        if (hasRange(request)) {\n          return serveWithRanges(request, response, content)\n        }\n        return found(response, filePath, content)\n      }\n      if (error.code !== 'ENOENT') {\n        response.writeHead(500);\n        response.end('500 Internal Server Error' +\n          '\\n\\n' + filePath +\n          '\\n\\n' + Object.keys(error).map(function (k) {\n            return error[k]\n          }).join('\\n') +\n          '\\n\\n(rollup-plugin-serve)', 'utf-8');\n        return\n      }\n      if (request.url === '/favicon.ico') {\n        filePath = path.resolve(__dirname, '../dist/favicon.ico');\n        fs.readFile(filePath, function (error, content) {\n          if (error) {\n            notFound(response, filePath);\n          } else {\n            found(response, filePath, content);\n          }\n        });\n      } else if (options.historyApiFallback) {\n        readFileFromContentBase(options.contentBase, '/index.html', function (error, content, filePath) {\n          if (error) {\n            notFound(response, filePath);\n          } else {\n            found(response, filePath, content);\n          }\n        });\n      } else {\n        notFound(response, filePath);\n      }\n    });\n  };\n\n  // If HTTPS options are available, create an HTTPS server\n  var server;\n  if (options.https) {\n    server = https.createServer(options.https, requestListener).listen(options.port);\n  } else {\n    server = http.createServer(requestListener).listen(options.port);\n  }\n\n  closeServerOnTermination(server);\n\n  var running = options.verbose === false;\n\n  return {\n    name: 'serve',\n    ongenerate: function ongenerate() {\n      if (!running) {\n        running = true;\n\n        // Log which url to visit\n        var url = (options.https ? 'https' : 'http') + '://' + options.host + ':' + options.port;\n        options.contentBase.forEach(function (base) {\n          console.log(green(url) + ' -> ' + path.resolve(base));\n        });\n\n        // Open browser\n        if (options.open) {\n          opener(url);\n        }\n      }\n    }\n  }\n}\n\nfunction readFileFromContentBase(contentBase, urlPath, callback) {\n  var filePath = path.resolve(contentBase[0] || '.', '.' + urlPath);\n\n  // Load index.html in directories\n  if (urlPath.endsWith('/')) {\n    filePath = path.resolve(filePath, 'index.html');\n  }\n\n  fs.readFile(filePath, function (error, content) {\n    if (error && contentBase.length > 1) {\n      // Try to read from next contentBase\n      readFileFromContentBase(contentBase.slice(1), urlPath, callback);\n    } else {\n      // We know enough\n      callback(error, content, filePath);\n    }\n  });\n}\n\nfunction notFound(response, filePath) {\n  response.writeHead(404);\n  response.end('404 Not Found' +\n    '\\n\\n' + filePath +\n    '\\n\\n(rollup-plugin-serve)', 'utf-8');\n}\n\nfunction found(response, filePath, content) {\n  response.writeHead(200, { 'Content-Type': mime.lookup(filePath) });\n  response.end(content, 'utf-8');\n}\n\nfunction hasRange(request) {\n  var range = request.headers.range || '';\n  var parts = range.replace(/bytes=/, \"\").split(\"-\");\n  var partialstart = parts[0];\n  var partialend = parts[1];\n  return partialstart && partialend\n}\n\nfunction serveWithRanges(request, response, content) {\n  var range = request.headers.range;\n  var total = content.length;\n  var parts = range.replace(/bytes=/, \"\").split(\"-\");\n  var partialstart = parts[0];\n  var partialend = parts[1];\n\n  var start = parseInt(partialstart, 10);\n  var end = partialend ? parseInt(partialend, 10) : total;\n  var chunksize = (end - start);\n  response.writeHead(206, {\n    \"Content-Range\": \"bytes \" + start + \"-\" + end + \"/\" + total,\n    \"Accept-Ranges\": \"bytes\",\n    \"Content-Length\": chunksize\n  });\n  response.end(content.slice(start, end));\n}\n\nfunction green(text) {\n  return '\\u001b[1m\\u001b[32m' + text + '\\u001b[39m\\u001b[22m'\n}\n\nfunction closeServerOnTermination(server) {\n  var terminationSignals = ['SIGINT', 'SIGTERM'];\n  terminationSignals.forEach(function (signal) {\n    process.on(signal, function () {\n      server.close();\n      process.exit();\n    });\n  });\n}\n\nmodule.exports = serve;\n"]}