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U,UAAY,SAAU,EAAK,GAC5C,IAAiB,EAAS,KAAK,OAAe,KAAK,KACnD,KAAK,UAEL,EAAO,IAAI,GAEX,EAAO,iBAAiB,MAAK,SAAU,GACrC,EAAG,KAAM,IAAI,OAAO,EAAM,UAC5B,GACF,EAEA,SAAS,UAAU,MAAQ,SAAU,GACnC,IAAI,EAAS,KAAK,OACA,mBAAP,IAAmB,EAAK,WAAa,GAC5C,EACF,EAAO,OAAO,KAAK,GACd,GACT,EAEA,SAAS,UAAU,MAAQ,SAAU,EAAK,GACxC,KAAK,OAAM,WACT,EAAG,EACL,GACF","file":"/npm/html2png@1.1.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/html2png@1.1.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","var phantomjs = require('phantomjs-bin'),\n    webdriver = require('selenium-webdriver'),\n    path = require('path');\n\nmodule.exports = Html2Png;\n\nvar URL_REGEX = /^(http|https|file)\\:/;\n\nfunction Html2Png(opts) {\n  if (!(this instanceof Html2Png)) {\n    return new Html2Png(opts);\n  }\n\n  if (typeof opts === 'undefined') opts = {};\n  opts.browser = opts.browser || 'phantomjs';\n  opts.width = opts.width || 640;\n  opts.height = opts.height || 480;\n  opts.chromeHeight = opts.chromeHeight || 72;\n  opts.scriptTimeout = opts.scriptTimeout || 30*1000;\n\n  this.opts = opts;\n\n  var driver = this.driver = new webdriver.Builder()\n  .withCapabilities({\n     browserName: opts.browser\n  })\n  .build();\n  driver.manage().timeouts().setScriptTimeout(opts.scriptTimeout);\n  driver.get('file:' + path.join(__dirname, 'empty.html'));\n\n  this.resized = false;\n}\n\nHtml2Png.prototype._resize = function () {\n  var driver = this.driver, opts = this.opts;\n  if (!this.resized) {\n    // remove the chrome 'chrome' from the window size\n    driver.manage().window().setSize(opts.width,\n      opts.height + (opts.browser === 'chrome' ? opts.chromeHeight : 0));\n    this.resized = true;\n  }\n};\n\nHtml2Png.prototype.render = function (html, cb) {\n  var self = this, driver = this.driver, opts = this.opts;\n  this._resize();\n\n  driver.executeAsyncScript(function(html, opts, cb) {\n    document.open('text/html');\n    document.onreadystatechange = function () {\n      if (document.readyState === 'complete') {\n        if (opts.browser === 'chrome') {\n          // HACK: Images still not loaded\n          setTimeout(cb, 1000);\n        } else cb();\n      }\n    };\n    document.write(html);\n    document.close();\n  }, html, opts);\n\n  driver.takeScreenshot().then(function (data) {\n    cb(null, new Buffer(data, 'base64'));\n  });\n};\n\nHtml2Png.prototype.renderUrl = function (url, cb) {\n  var self = this, driver = this.driver, opts = this.opts;\n  this._resize();\n\n  driver.get(url);\n\n  driver.takeScreenshot().then(function (data) {\n    cb(null, new Buffer(data, 'base64'));\n  });\n};\n\nHtml2Png.prototype.close = function (cb) {\n  var driver = this.driver;\n  if (typeof cb !== 'function') cb = function () {};\n  if (driver) {\n    driver.quit().then(cb);\n  } else cb();\n};\n\nHtml2Png.prototype.error = function (err, cb) {\n  this.close(function () {\n    cb(err);\n  });\n};\n\n"]}