{"version":3,"sources":["jsdelivr-header.js","/npm/file-reader-promise@1.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,cAAgB,CAEpB,gBAAgB,GAEZ,OAAS,OAAO,OAAO,eAE7B,SAAS,mBAAoB,GAC3B,OAAO,SAAU,GACf,MAAM,EAAiB,UACjB,EAAiB,OAAO,eAE9B,OAAO,IAAI,SAAQ,SAAU,EAAS,GACpC,MAAM,EAAS,IAAI,WAEnB,EAAO,UAAY,SAAU,GAC3B,MAAM,EAAS,EAAiB,EAAM,OAAO,OAAS,EAEtD,EAAQ,EACV,EACA,EAAO,QAAU,SAAU,GACzB,EAAO,EACT,EAEA,EAAO,GAAM,MAAM,EAAQ,EAC7B,GACF,CACF,CAEA,MAAM,kBAAoB,CACxB,GAAA,CAAK,GACH,OAAO,OAAO,OAAQ,EACxB,GAGF,SAAS,WAAY,GACnB,MAAwB,mBAAV,CAChB,CAEA,SAAS,aACP,MAAM,EAAS,IAAI,WAGnB,IAAK,IAAI,KAAQ,GACV,EAAO,eAAe,IAAS,WAAW,EAAO,MACpD,kBAAkB,GAAQ,mBAAmB,GAGnD,CAG0B,mBAAf,YACT,aAMF,OAAO,QAAU","file":"/npm/file-reader-promise@1.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/file-reader-promise@1.0.1/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 defaultConfig = {\r\n  // FileReaderPromise readAsText return event.target.result or event\r\n  enableSimplify: true,\r\n}\r\nconst config = Object.assign(defaultConfig)\r\n\r\nfunction getPromisifyReadFn (name) {\r\n  return function (blob) {\r\n    const argumentsOuter = arguments\r\n    const enableSimplify = config.enableSimplify\r\n\r\n    return new Promise(function (resolve, reject) {\r\n      const reader = new FileReader()\r\n\r\n      reader.onloadend = function (event) {\r\n        const result = enableSimplify ? event.target.result : event\r\n        // console.log(result)\r\n        resolve(result)\r\n      }\r\n      reader.onerror = function (error) {\r\n        reject(error)\r\n      }\r\n\r\n      reader[name].apply(reader, argumentsOuter)\r\n    })\r\n  }\r\n}\r\n\r\nconst FileReaderPromise = {\r\n  set (newConfig) {\r\n    Object.assign(config, newConfig)\r\n  },\r\n}\r\n\r\nfunction isFunction (value) {\r\n  return typeof value === 'function'\r\n}\r\n\r\nfunction addMethods () {\r\n  const reader = new FileReader()\r\n\r\n  // readAsArrayBuffer()/readAsText()/...\r\n  for (let prop in reader) {\r\n    if (!reader.hasOwnProperty(prop) && isFunction(reader[prop])) {\r\n      FileReaderPromise[prop] = getPromisifyReadFn(prop)\r\n    }\r\n  }\r\n}\r\n\r\n// suppoted SSR for next.js/nuxt.js\r\nif (typeof FileReader === 'function') {\r\n  addMethods()\r\n}\r\n\r\n// ES2015 export (it has problems with babel and webpack)\r\n// export default FileReaderPromise\r\n// commonjs export\r\nmodule.exports = FileReaderPromise\r\n"]}