diff --git a/.babelrc b/.babelrc index 46dbece..b5eb413 100644 --- a/.babelrc +++ b/.babelrc @@ -1,8 +1,10 @@ { "presets": [ ["@babel/preset-env", { + "useBuiltIns": "usage", + "corejs": "3", "targets": { - "browsers": ["> 0.25%", "not dead"] + "browsers": ["> 5%", "ie 10-11", "not dead"] } }] ], diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index e9aa945..0000000 --- a/.eslintrc +++ /dev/null @@ -1,10 +0,0 @@ -{ - "parser": "babel-eslint", - "extends": "eslint:recommended", - "env": { - "es6": true, - "browser": true, - "node": true, - "mocha": true - } -} \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..b9e417e --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,16 @@ +module.exports = { + env: { + browser: true, + }, + extends: [ + 'airbnb-base', + ], + parserOptions: { + ecmaVersion: 12, + sourceType: 'module', + }, + rules: { + 'max-len': ['warn', { code: 150 }], + }, + ignorePatterns: ['dist'], +}; diff --git a/CHANGELOG.md b/CHANGELOG.md index aa22a2f..bb3bff3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v1.0.15 (12 Aug 2021) +* fixed: Fixed black Images and type error by considering Canvas maximum size supported by different browsers [#84](https://github.com/Donaldcwl/browser-image-compression/issues/84), [#36](https://github.com/Donaldcwl/browser-image-compression/issues/36) +* fixed: IE compatibility, include polyfill with core-js@3 e.g, globalThis, Promise [#108](https://github.com/Donaldcwl/browser-image-compression/issues/108), [#110](https://github.com/Donaldcwl/browser-image-compression/issues/110) +* fixed: Test suites in few projects may have error, added extra checking on whether File and FileReader exist in the Window object [#92](https://github.com/Donaldcwl/browser-image-compression/issues/92) +* fixed: issue with export causing compile error in typescript project [#63](https://github.com/Donaldcwl/browser-image-compression/issues/63) + ## v1.0.14 (6 Jan 2021) * updated: use UZIP to compress PNG image instead of Canvas * fixed: PNG transparent background become black after compression [#84](https://github.com/Donaldcwl/browser-image-compression/issues/84), [#76](https://github.com/Donaldcwl/browser-image-compression/issues/76) @@ -8,7 +14,7 @@ * fixed: options object being altered by the compress func [#71](https://github.com/Donaldcwl/browser-image-compression/pull/71) * fixed: issue with output size of png compression [#57](https://github.com/Donaldcwl/browser-image-compression/issues/57) -## v1.0.12 (4 June 2020) +## v1.0.12 (4 Jun 2020) * fixed: issue with SSR [#58](https://github.com/Donaldcwl/browser-image-compression/issues/58) ## v1.0.11 (8 May 2020) @@ -37,10 +43,10 @@ * fixed: issue in IE browser * fixed: other issues -## v1.0.6 (5 July 2019) +## v1.0.6 (5 Jul 2019) * fixed: exif orientation do not work in some situations -## v1.0.5 (1 June 2019) +## v1.0.5 (1 Jun 2019) * added: support for cordova project that uses cordova-plugin-file * optimized: follow image exif orientation even though image do not required to compress or resize * fixed: error may throw on iPhone Safari because of OffscreenCanvas cannot get 2d context diff --git a/README.md b/README.md index f06ea00..837eed6 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ yarn add browser-image-compression ``` or use a CDN like [delivrjs]: ``` -https://cdn.jsdelivr.net/npm/browser-image-compression@1.0.14/dist/browser-image-compression.js +https://cdn.jsdelivr.net/npm/browser-image-compression@1.0.15/dist/browser-image-compression.js or https://cdn.jsdelivr.net/npm/browser-image-compression@latest/dist/browser-image-compression.js ``` @@ -42,7 +42,7 @@ or #### In html file #### ```html - + ``` ## API ## @@ -153,16 +153,6 @@ or check the "[example]" folder in this repo ## Remarks for compression to work in Web Worker The browser need to support "OffscreenCanvas" API in order to take advantage of non-blocking compression. If browser do not support "OffscreenCanvas" API, main thread is used instead. See https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas#browser_compatibility for browser compatibility of "OffscreenCanvas" API. -## IE support ## -Promise API is being used in this library. If you need to support browser that do not support Promise like IE. You can include the Promise polyfill in your project. - -See: https://github.com/taylorhakes/promise-polyfill - -You can include the following script to load the Promise polyfill: -```html - -``` - ## Typescript type definitions ## Typescript definitions are included in the package & referenced in the `types` section of the `package.json` @@ -174,7 +164,7 @@ Typescript definitions are included in the package & referenced in the `types` s 5. add/update test in test/ folder 6. `npm run test` 7. push to your forked repo on github -8. make a pull request to this repo +8. make a pull request to dev branch of this repo [dist]: https://github.com/Donaldcwl/browser-image-compression/tree/master/dist [example]: https://github.com/Donaldcwl/browser-image-compression/tree/master/example diff --git a/coverage/badge.svg b/coverage/badge.svg index b6ab2b7..cbfab8c 100644 --- a/coverage/badge.svg +++ b/coverage/badge.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/coverage/coverage-final.json b/coverage/coverage-final.json index 75bfdcf..4c10238 100644 --- a/coverage/coverage-final.json +++ b/coverage/coverage-final.json @@ -1,4 +1,6 @@ -{"D:\\Projects\\browser-image-compression\\lib\\image-compression.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\image-compression.js","statementMap":{"0":{"start":{"line":29,"column":17},"end":{"line":29,"column":33}},"1":{"start":{"line":32,"column":4},"end":{"line":32,"column":19}},"2":{"start":{"line":33,"column":4},"end":{"line":33,"column":47}},"3":{"start":{"line":37,"column":4},"end":{"line":37,"column":51}},"4":{"start":{"line":38,"column":4},"end":{"line":38,"column":32}},"5":{"start":{"line":41,"column":24},"end":{"line":41,"column":50}},"6":{"start":{"line":43,"column":22},"end":{"line":43,"column":53}},"7":{"start":{"line":45,"column":2},"end":{"line":45,"column":15}},"8":{"start":{"line":48,"column":26},"end":{"line":48,"column":54}},"9":{"start":{"line":50,"column":2},"end":{"line":50,"column":15}},"10":{"start":{"line":53,"column":38},"end":{"line":53,"column":81}},"11":{"start":{"line":55,"column":2},"end":{"line":55,"column":15}},"12":{"start":{"line":58,"column":26},"end":{"line":58,"column":83}},"13":{"start":{"line":59,"column":2},"end":{"line":59,"column":15}},"14":{"start":{"line":60,"column":33},"end":{"line":60,"column":169}},"15":{"start":{"line":61,"column":2},"end":{"line":61,"column":15}},"16":{"start":{"line":63,"column":16},"end":{"line":63,"column":45}},"17":{"start":{"line":65,"column":25},"end":{"line":65,"column":54}},"18":{"start":{"line":67,"column":17},"end":{"line":67,"column":114}},"19":{"start":{"line":68,"column":2},"end":{"line":68,"column":15}},"20":{"start":{"line":70,"column":28},"end":{"line":70,"column":55}},"21":{"start":{"line":71,"column":27},"end":{"line":71,"column":52}},"22":{"start":{"line":76,"column":2},"end":{"line":80,"column":3}},"23":{"start":{"line":78,"column":4},"end":{"line":78,"column":20}},"24":{"start":{"line":79,"column":4},"end":{"line":79,"column":19}},"25":{"start":{"line":82,"column":21},"end":{"line":82,"column":30}},"26":{"start":{"line":83,"column":23},"end":{"line":83,"column":36}},"27":{"start":{"line":84,"column":20},"end":{"line":84,"column":32}},"28":{"start":{"line":87,"column":15},"end":{"line":87,"column":37}},"29":{"start":{"line":88,"column":2},"end":{"line":107,"column":3}},"30":{"start":{"line":89,"column":21},"end":{"line":89,"column":75}},"31":{"start":{"line":90,"column":22},"end":{"line":90,"column":78}},"32":{"start":{"line":93,"column":4},"end":{"line":93,"column":62}},"33":{"start":{"line":95,"column":4},"end":{"line":95,"column":52}},"34":{"start":{"line":97,"column":4},"end":{"line":97,"column":19}},"35":{"start":{"line":98,"column":4},"end":{"line":98,"column":105}},"36":{"start":{"line":100,"column":4},"end":{"line":100,"column":31}},"37":{"start":{"line":102,"column":4},"end":{"line":102,"column":22}},"38":{"start":{"line":104,"column":4},"end":{"line":104,"column":37}},"39":{"start":{"line":106,"column":4},"end":{"line":106,"column":108}},"40":{"start":{"line":109,"column":2},"end":{"line":109,"column":29}},"41":{"start":{"line":110,"column":2},"end":{"line":110,"column":32}},"42":{"start":{"line":111,"column":2},"end":{"line":111,"column":50}},"43":{"start":{"line":112,"column":2},"end":{"line":112,"column":45}},"44":{"start":{"line":113,"column":2},"end":{"line":113,"column":33}},"45":{"start":{"line":115,"column":2},"end":{"line":115,"column":18}},"46":{"start":{"line":116,"column":2},"end":{"line":116,"column":23}}},"fnMap":{"0":{"name":"compress","decl":{"start":{"line":28,"column":30},"end":{"line":28,"column":38}},"loc":{"start":{"line":28,"column":77},"end":{"line":117,"column":1}},"line":28},"1":{"name":"incProgress","decl":{"start":{"line":31,"column":11},"end":{"line":31,"column":22}},"loc":{"start":{"line":31,"column":33},"end":{"line":34,"column":3}},"line":31},"2":{"name":"setProgress","decl":{"start":{"line":36,"column":11},"end":{"line":36,"column":22}},"loc":{"start":{"line":36,"column":27},"end":{"line":39,"column":3}},"line":36}},"branchMap":{"0":{"loc":{"start":{"line":28,"column":55},"end":{"line":28,"column":75}},"type":"default-arg","locations":[{"start":{"line":28,"column":74},"end":{"line":28,"column":75}}],"line":28},"1":{"loc":{"start":{"line":31,"column":24},"end":{"line":31,"column":31}},"type":"default-arg","locations":[{"start":{"line":31,"column":30},"end":{"line":31,"column":31}}],"line":31},"2":{"loc":{"start":{"line":41,"column":24},"end":{"line":41,"column":50}},"type":"binary-expr","locations":[{"start":{"line":41,"column":24},"end":{"line":41,"column":44}},{"start":{"line":41,"column":48},"end":{"line":41,"column":50}}],"line":41},"3":{"loc":{"start":{"line":58,"column":26},"end":{"line":58,"column":83}},"type":"binary-expr","locations":[{"start":{"line":58,"column":26},"end":{"line":58,"column":49}},{"start":{"line":58,"column":53},"end":{"line":58,"column":83}}],"line":58},"4":{"loc":{"start":{"line":60,"column":33},"end":{"line":60,"column":169}},"type":"cond-expr","locations":[{"start":{"line":60,"column":72},"end":{"line":60,"column":99}},{"start":{"line":60,"column":102},"end":{"line":60,"column":169}}],"line":60},"5":{"loc":{"start":{"line":63,"column":16},"end":{"line":63,"column":45}},"type":"binary-expr","locations":[{"start":{"line":63,"column":16},"end":{"line":63,"column":38}},{"start":{"line":63,"column":42},"end":{"line":63,"column":45}}],"line":63},"6":{"loc":{"start":{"line":65,"column":25},"end":{"line":65,"column":54}},"type":"binary-expr","locations":[{"start":{"line":65,"column":25},"end":{"line":65,"column":41}},{"start":{"line":65,"column":45},"end":{"line":65,"column":54}}],"line":65},"7":{"loc":{"start":{"line":76,"column":2},"end":{"line":80,"column":3}},"type":"if","locations":[{"start":{"line":76,"column":2},"end":{"line":80,"column":3}},{"start":{"line":76,"column":2},"end":{"line":80,"column":3}}],"line":76},"8":{"loc":{"start":{"line":76,"column":6},"end":{"line":76,"column":45}},"type":"binary-expr","locations":[{"start":{"line":76,"column":6},"end":{"line":76,"column":24}},{"start":{"line":76,"column":28},"end":{"line":76,"column":45}}],"line":76},"9":{"loc":{"start":{"line":88,"column":9},"end":{"line":88,"column":85}},"type":"binary-expr","locations":[{"start":{"line":88,"column":9},"end":{"line":88,"column":26}},{"start":{"line":88,"column":31},"end":{"line":88,"column":56}},{"start":{"line":88,"column":60},"end":{"line":88,"column":84}}],"line":88},"10":{"loc":{"start":{"line":89,"column":21},"end":{"line":89,"column":75}},"type":"cond-expr","locations":[{"start":{"line":89,"column":41},"end":{"line":89,"column":60}},{"start":{"line":89,"column":63},"end":{"line":89,"column":75}}],"line":89},"11":{"loc":{"start":{"line":90,"column":22},"end":{"line":90,"column":78}},"type":"cond-expr","locations":[{"start":{"line":90,"column":42},"end":{"line":90,"column":62}},{"start":{"line":90,"column":65},"end":{"line":90,"column":78}}],"line":90}},"s":{"0":6,"1":36,"2":36,"3":8,"4":8,"5":6,"6":6,"7":6,"8":6,"9":6,"10":6,"11":6,"12":6,"13":6,"14":6,"15":6,"16":6,"17":6,"18":6,"19":6,"20":6,"21":6,"22":6,"23":5,"24":5,"25":1,"26":1,"27":1,"28":1,"29":1,"30":2,"31":2,"32":2,"33":2,"34":2,"35":2,"36":2,"37":2,"38":2,"39":2,"40":1,"41":1,"42":1,"43":1,"44":1,"45":1,"46":1},"f":{"0":6,"1":36,"2":8},"b":{"0":[6],"1":[36],"2":[6,6],"3":[6,0],"4":[0,6],"5":[6,6],"6":[6,6],"7":[5,1],"8":[6,5],"9":[3,3,1],"10":[2,0],"11":[2,0]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"a0e8b1cd43b4a5912a802eab993baa314ad5494b","contentHash":"577419880913c52e0f27e5a0f5f7309d5b01aaffa95bd4fedd607203ab50e0f8"} -,"D:\\Projects\\browser-image-compression\\lib\\index.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\index.js","statementMap":{"0":{"start":{"line":35,"column":17},"end":{"line":35,"column":18}},"1":{"start":{"line":38,"column":2},"end":{"line":38,"column":67}},"2":{"start":{"line":39,"column":23},"end":{"line":39,"column":94}},"3":{"start":{"line":40,"column":2},"end":{"line":40,"column":29}},"4":{"start":{"line":41,"column":2},"end":{"line":41,"column":33}},"5":{"start":{"line":42,"column":2},"end":{"line":47,"column":3}},"6":{"start":{"line":43,"column":4},"end":{"line":43,"column":24}},"7":{"start":{"line":44,"column":4},"end":{"line":46,"column":5}},"8":{"start":{"line":45,"column":6},"end":{"line":45,"column":26}},"9":{"start":{"line":49,"column":2},"end":{"line":53,"column":3}},"10":{"start":{"line":50,"column":4},"end":{"line":50,"column":72}},"11":{"start":{"line":51,"column":9},"end":{"line":53,"column":3}},"12":{"start":{"line":52,"column":4},"end":{"line":52,"column":53}},"13":{"start":{"line":56,"column":22},"end":{"line":56,"column":99}},"14":{"start":{"line":64,"column":2},"end":{"line":77,"column":3}},"15":{"start":{"line":65,"column":4},"end":{"line":73,"column":5}},"16":{"start":{"line":68,"column":6},"end":{"line":68,"column":63}},"17":{"start":{"line":72,"column":6},"end":{"line":72,"column":52}},"18":{"start":{"line":76,"column":4},"end":{"line":76,"column":50}},"19":{"start":{"line":79,"column":2},"end":{"line":82,"column":16}},"20":{"start":{"line":80,"column":4},"end":{"line":80,"column":35}},"21":{"start":{"line":81,"column":4},"end":{"line":81,"column":51}},"22":{"start":{"line":84,"column":2},"end":{"line":84,"column":23}},"23":{"start":{"line":87,"column":0},"end":{"line":87,"column":56}},"24":{"start":{"line":88,"column":0},"end":{"line":88,"column":56}},"25":{"start":{"line":89,"column":0},"end":{"line":89,"column":38}},"26":{"start":{"line":90,"column":0},"end":{"line":90,"column":54}},"27":{"start":{"line":91,"column":0},"end":{"line":91,"column":52}},"28":{"start":{"line":92,"column":0},"end":{"line":92,"column":44}},"29":{"start":{"line":93,"column":0},"end":{"line":93,"column":56}},"30":{"start":{"line":95,"column":0},"end":{"line":95,"column":64}},"31":{"start":{"line":96,"column":0},"end":{"line":96,"column":62}},"32":{"start":{"line":97,"column":0},"end":{"line":97,"column":58}},"33":{"start":{"line":98,"column":0},"end":{"line":98,"column":72}},"34":{"start":{"line":99,"column":0},"end":{"line":99,"column":35}}},"fnMap":{"0":{"name":"imageCompression","decl":{"start":{"line":32,"column":15},"end":{"line":32,"column":31}},"loc":{"start":{"line":32,"column":48},"end":{"line":85,"column":1}},"line":32},"1":{"name":"(anonymous_1)","decl":{"start":{"line":42,"column":23},"end":{"line":42,"column":24}},"loc":{"start":{"line":42,"column":38},"end":{"line":47,"column":3}},"line":42}},"branchMap":{"0":{"loc":{"start":{"line":38,"column":22},"end":{"line":38,"column":67}},"type":"binary-expr","locations":[{"start":{"line":38,"column":22},"end":{"line":38,"column":39}},{"start":{"line":38,"column":43},"end":{"line":38,"column":67}}],"line":38},"1":{"loc":{"start":{"line":39,"column":23},"end":{"line":39,"column":94}},"type":"cond-expr","locations":[{"start":{"line":39,"column":67},"end":{"line":39,"column":87}},{"start":{"line":39,"column":90},"end":{"line":39,"column":94}}],"line":39},"2":{"loc":{"start":{"line":44,"column":4},"end":{"line":46,"column":5}},"type":"if","locations":[{"start":{"line":44,"column":4},"end":{"line":46,"column":5}},{"start":{"line":44,"column":4},"end":{"line":46,"column":5}}],"line":44},"3":{"loc":{"start":{"line":49,"column":2},"end":{"line":53,"column":3}},"type":"if","locations":[{"start":{"line":49,"column":2},"end":{"line":53,"column":3}},{"start":{"line":49,"column":2},"end":{"line":53,"column":3}}],"line":49},"4":{"loc":{"start":{"line":49,"column":8},"end":{"line":49,"column":58}},"type":"binary-expr","locations":[{"start":{"line":49,"column":8},"end":{"line":49,"column":28}},{"start":{"line":49,"column":32},"end":{"line":49,"column":58}}],"line":49},"5":{"loc":{"start":{"line":51,"column":9},"end":{"line":53,"column":3}},"type":"if","locations":[{"start":{"line":51,"column":9},"end":{"line":53,"column":3}},{"start":{"line":51,"column":9},"end":{"line":53,"column":3}}],"line":51},"6":{"loc":{"start":{"line":56,"column":22},"end":{"line":56,"column":99}},"type":"binary-expr","locations":[{"start":{"line":56,"column":22},"end":{"line":56,"column":62}},{"start":{"line":56,"column":66},"end":{"line":56,"column":99}}],"line":56},"7":{"loc":{"start":{"line":64,"column":2},"end":{"line":77,"column":3}},"type":"if","locations":[{"start":{"line":64,"column":2},"end":{"line":77,"column":3}},{"start":{"line":64,"column":2},"end":{"line":77,"column":3}}],"line":64},"8":{"loc":{"start":{"line":64,"column":6},"end":{"line":64,"column":66}},"type":"binary-expr","locations":[{"start":{"line":64,"column":6},"end":{"line":64,"column":18}},{"start":{"line":64,"column":22},"end":{"line":64,"column":50}},{"start":{"line":64,"column":54},"end":{"line":64,"column":66}}],"line":64}},"s":{"0":9,"1":9,"2":9,"3":9,"4":9,"5":9,"6":44,"7":44,"8":0,"9":9,"10":2,"11":7,"12":1,"13":6,"14":6,"15":0,"16":0,"17":0,"18":6,"19":6,"20":6,"21":6,"22":6,"23":1,"24":1,"25":1,"26":1,"27":1,"28":1,"29":1,"30":1,"31":1,"32":1,"33":1,"34":1},"f":{"0":9,"1":44},"b":{"0":[9,2],"1":[9,0],"2":[0,44],"3":[2,7],"4":[9,2],"5":[1,6],"6":[6,0],"7":[0,6],"8":[6,0,0]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"0e768961535b127ec5a2cdd0a2cf2218261a426d","contentHash":"6cedfa92008856f5e598730f1a8573bb5f4726e9830c239e274f7c769bd7893d"} -,"D:\\Projects\\browser-image-compression\\lib\\utils.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\utils.js","statementMap":{"0":{"start":{"line":3,"column":18},"end":{"line":3,"column":47}},"1":{"start":{"line":6,"column":21},"end":{"line":6,"column":124}},"2":{"start":{"line":7,"column":26},"end":{"line":7,"column":113}},"3":{"start":{"line":8,"column":32},"end":{"line":8,"column":131}},"4":{"start":{"line":13,"column":2},"end":{"line":14,"column":44}},"5":{"start":{"line":14,"column":4},"end":{"line":14,"column":44}},"6":{"start":{"line":19,"column":4},"end":{"line":24,"column":63}},"7":{"start":{"line":25,"column":24},"end":{"line":25,"column":86}},"8":{"start":{"line":27,"column":26},"end":{"line":27,"column":68}},"9":{"start":{"line":28,"column":25},"end":{"line":28,"column":128}},"10":{"start":{"line":29,"column":2},"end":{"line":29,"column":38}},"11":{"start":{"line":30,"column":14},"end":{"line":30,"column":57}},"12":{"start":{"line":33,"column":2},"end":{"line":33,"column":73}},"13":{"start":{"line":34,"column":2},"end":{"line":34,"column":42}},"14":{"start":{"line":44,"column":2},"end":{"line":49,"column":4}},"15":{"start":{"line":45,"column":19},"end":{"line":45,"column":41}},"16":{"start":{"line":46,"column":4},"end":{"line":46,"column":48}},"17":{"start":{"line":46,"column":26},"end":{"line":46,"column":48}},"18":{"start":{"line":47,"column":4},"end":{"line":47,"column":37}},"19":{"start":{"line":47,"column":28},"end":{"line":47,"column":37}},"20":{"start":{"line":48,"column":4},"end":{"line":48,"column":30}},"21":{"start":{"line":61,"column":2},"end":{"line":87,"column":4}},"22":{"start":{"line":62,"column":16},"end":{"line":62,"column":34}},"23":{"start":{"line":63,"column":17},"end":{"line":63,"column":43}},"24":{"start":{"line":64,"column":17},"end":{"line":64,"column":40}},"25":{"start":{"line":65,"column":12},"end":{"line":65,"column":23}},"26":{"start":{"line":66,"column":18},"end":{"line":66,"column":35}},"27":{"start":{"line":67,"column":4},"end":{"line":69,"column":5}},"28":{"start":{"line":68,"column":6},"end":{"line":68,"column":35}},"29":{"start":{"line":70,"column":17},"end":{"line":70,"column":50}},"30":{"start":{"line":71,"column":4},"end":{"line":71,"column":24}},"31":{"start":{"line":72,"column":4},"end":{"line":72,"column":36}},"32":{"start":{"line":73,"column":4},"end":{"line":73,"column":17}},"33":{"start":{"line":97,"column":2},"end":{"line":102,"column":4}},"34":{"start":{"line":98,"column":16},"end":{"line":98,"column":27}},"35":{"start":{"line":99,"column":4},"end":{"line":99,"column":35}},"36":{"start":{"line":99,"column":23},"end":{"line":99,"column":35}},"37":{"start":{"line":100,"column":4},"end":{"line":100,"column":34}},"38":{"start":{"line":100,"column":25},"end":{"line":100,"column":34}},"39":{"start":{"line":101,"column":4},"end":{"line":101,"column":17}},"40":{"start":{"line":112,"column":24},"end":{"line":112,"column":65}},"41":{"start":{"line":113,"column":2},"end":{"line":113,"column":55}},"42":{"start":{"line":114,"column":2},"end":{"line":114,"column":15}},"43":{"start":{"line":125,"column":2},"end":{"line":130,"column":3}},"44":{"start":{"line":126,"column":4},"end":{"line":126,"column":39}},"45":{"start":{"line":128,"column":20},"end":{"line":128,"column":50}},"46":{"start":{"line":129,"column":4},"end":{"line":129,"column":34}},"47":{"start":{"line":131,"column":17},"end":{"line":131,"column":39}},"48":{"start":{"line":132,"column":2},"end":{"line":132,"column":22}},"49":{"start":{"line":147,"column":2},"end":{"line":164,"column":3}},"50":{"start":{"line":148,"column":16},"end":{"line":148,"column":39}},"51":{"start":{"line":149,"column":17},"end":{"line":149,"column":73}},"52":{"start":{"line":150,"column":16},"end":{"line":150,"column":79}},"53":{"start":{"line":151,"column":4},"end":{"line":151,"column":46}},"54":{"start":{"line":152,"column":4},"end":{"line":152,"column":24}},"55":{"start":{"line":153,"column":4},"end":{"line":153,"column":40}},"56":{"start":{"line":154,"column":9},"end":{"line":164,"column":3}},"57":{"start":{"line":155,"column":4},"end":{"line":155,"column":66}},"58":{"start":{"line":156,"column":4},"end":{"line":156,"column":24}},"59":{"start":{"line":157,"column":4},"end":{"line":157,"column":40}},"60":{"start":{"line":162,"column":20},"end":{"line":162,"column":55}},"61":{"start":{"line":163,"column":4},"end":{"line":163,"column":72}},"62":{"start":{"line":165,"column":2},"end":{"line":165,"column":13}},"63":{"start":{"line":177,"column":2},"end":{"line":214,"column":4}},"64":{"start":{"line":178,"column":19},"end":{"line":178,"column":41}},"65":{"start":{"line":179,"column":4},"end":{"line":211,"column":5}},"66":{"start":{"line":180,"column":19},"end":{"line":180,"column":48}},"67":{"start":{"line":181,"column":6},"end":{"line":183,"column":7}},"68":{"start":{"line":182,"column":8},"end":{"line":182,"column":26}},"69":{"start":{"line":184,"column":21},"end":{"line":184,"column":36}},"70":{"start":{"line":185,"column":19},"end":{"line":185,"column":20}},"71":{"start":{"line":186,"column":6},"end":{"line":209,"column":7}},"72":{"start":{"line":187,"column":8},"end":{"line":187,"column":70}},"73":{"start":{"line":187,"column":52},"end":{"line":187,"column":70}},"74":{"start":{"line":188,"column":23},"end":{"line":188,"column":52}},"75":{"start":{"line":189,"column":8},"end":{"line":189,"column":19}},"76":{"start":{"line":190,"column":8},"end":{"line":208,"column":9}},"77":{"start":{"line":191,"column":10},"end":{"line":193,"column":11}},"78":{"start":{"line":192,"column":12},"end":{"line":192,"column":30}},"79":{"start":{"line":195,"column":23},"end":{"line":195,"column":67}},"80":{"start":{"line":196,"column":10},"end":{"line":196,"column":54}},"81":{"start":{"line":197,"column":21},"end":{"line":197,"column":51}},"82":{"start":{"line":198,"column":10},"end":{"line":198,"column":21}},"83":{"start":{"line":199,"column":10},"end":{"line":203,"column":11}},"84":{"start":{"line":199,"column":23},"end":{"line":199,"column":24}},"85":{"start":{"line":200,"column":12},"end":{"line":202,"column":13}},"86":{"start":{"line":201,"column":14},"end":{"line":201,"column":75}},"87":{"start":{"line":204,"column":15},"end":{"line":208,"column":9}},"88":{"start":{"line":205,"column":10},"end":{"line":205,"column":15}},"89":{"start":{"line":207,"column":10},"end":{"line":207,"column":49}},"90":{"start":{"line":210,"column":6},"end":{"line":210,"column":24}},"91":{"start":{"line":212,"column":4},"end":{"line":212,"column":37}},"92":{"start":{"line":212,"column":28},"end":{"line":212,"column":37}},"93":{"start":{"line":213,"column":4},"end":{"line":213,"column":34}},"94":{"start":{"line":224,"column":16},"end":{"line":224,"column":28}},"95":{"start":{"line":225,"column":17},"end":{"line":225,"column":30}},"96":{"start":{"line":226,"column":27},"end":{"line":226,"column":51}},"97":{"start":{"line":228,"column":23},"end":{"line":228,"column":108}},"98":{"start":{"line":230,"column":18},"end":{"line":230,"column":24}},"99":{"start":{"line":233,"column":2},"end":{"line":245,"column":3}},"100":{"start":{"line":234,"column":4},"end":{"line":234,"column":56}},"101":{"start":{"line":235,"column":4},"end":{"line":241,"column":5}},"102":{"start":{"line":236,"column":6},"end":{"line":236,"column":40}},"103":{"start":{"line":237,"column":6},"end":{"line":237,"column":60}},"104":{"start":{"line":239,"column":6},"end":{"line":239,"column":59}},"105":{"start":{"line":240,"column":6},"end":{"line":240,"column":41}},"106":{"start":{"line":242,"column":4},"end":{"line":242,"column":66}},"107":{"start":{"line":244,"column":4},"end":{"line":244,"column":31}},"108":{"start":{"line":247,"column":2},"end":{"line":247,"column":18}},"109":{"start":{"line":259,"column":16},"end":{"line":259,"column":28}},"110":{"start":{"line":260,"column":17},"end":{"line":260,"column":30}},"111":{"start":{"line":262,"column":27},"end":{"line":262,"column":60}},"112":{"start":{"line":265,"column":2},"end":{"line":271,"column":3}},"113":{"start":{"line":266,"column":4},"end":{"line":266,"column":28}},"114":{"start":{"line":267,"column":4},"end":{"line":267,"column":28}},"115":{"start":{"line":269,"column":4},"end":{"line":269,"column":27}},"116":{"start":{"line":270,"column":4},"end":{"line":270,"column":29}},"117":{"start":{"line":274,"column":2},"end":{"line":298,"column":3}},"118":{"start":{"line":276,"column":6},"end":{"line":276,"column":42}},"119":{"start":{"line":277,"column":6},"end":{"line":277,"column":11}},"120":{"start":{"line":279,"column":6},"end":{"line":279,"column":48}},"121":{"start":{"line":280,"column":6},"end":{"line":280,"column":11}},"122":{"start":{"line":282,"column":6},"end":{"line":282,"column":43}},"123":{"start":{"line":283,"column":6},"end":{"line":283,"column":11}},"124":{"start":{"line":285,"column":6},"end":{"line":285,"column":37}},"125":{"start":{"line":286,"column":6},"end":{"line":286,"column":11}},"126":{"start":{"line":288,"column":6},"end":{"line":288,"column":43}},"127":{"start":{"line":289,"column":6},"end":{"line":289,"column":11}},"128":{"start":{"line":291,"column":6},"end":{"line":291,"column":48}},"129":{"start":{"line":292,"column":6},"end":{"line":292,"column":11}},"130":{"start":{"line":294,"column":6},"end":{"line":294,"column":42}},"131":{"start":{"line":295,"column":6},"end":{"line":295,"column":11}},"132":{"start":{"line":297,"column":6},"end":{"line":297,"column":11}},"133":{"start":{"line":300,"column":2},"end":{"line":300,"column":44}},"134":{"start":{"line":302,"column":2},"end":{"line":302,"column":29}},"135":{"start":{"line":304,"column":2},"end":{"line":304,"column":18}},"136":{"start":{"line":316,"column":2},"end":{"line":325,"column":3}},"137":{"start":{"line":317,"column":4},"end":{"line":317,"column":47}},"138":{"start":{"line":318,"column":4},"end":{"line":318,"column":33}},"139":{"start":{"line":319,"column":4},"end":{"line":321,"column":5}},"140":{"start":{"line":320,"column":6},"end":{"line":320,"column":67}},"141":{"start":{"line":323,"column":4},"end":{"line":323,"column":45}},"142":{"start":{"line":324,"column":4},"end":{"line":324,"column":33}},"143":{"start":{"line":326,"column":2},"end":{"line":326,"column":22}},"144":{"start":{"line":327,"column":2},"end":{"line":327,"column":24}},"145":{"start":{"line":330,"column":2},"end":{"line":330,"column":22}},"146":{"start":{"line":341,"column":2},"end":{"line":341,"column":18}},"147":{"start":{"line":342,"column":2},"end":{"line":342,"column":19}},"148":{"start":{"line":345,"column":0},"end":{"line":352,"column":1}},"149":{"start":{"line":347,"column":2},"end":{"line":351,"column":3}},"150":{"start":{"line":348,"column":4},"end":{"line":350,"column":33}}},"fnMap":{"0":{"name":"isAutoOrientationInBrowser","decl":{"start":{"line":12,"column":22},"end":{"line":12,"column":48}},"loc":{"start":{"line":12,"column":51},"end":{"line":35,"column":1}},"line":12},"1":{"name":"getDataUrlFromFile","decl":{"start":{"line":43,"column":16},"end":{"line":43,"column":34}},"loc":{"start":{"line":43,"column":42},"end":{"line":50,"column":1}},"line":43},"2":{"name":"(anonymous_2)","decl":{"start":{"line":44,"column":21},"end":{"line":44,"column":22}},"loc":{"start":{"line":44,"column":42},"end":{"line":49,"column":3}},"line":44},"3":{"name":"(anonymous_3)","decl":{"start":{"line":46,"column":20},"end":{"line":46,"column":21}},"loc":{"start":{"line":46,"column":26},"end":{"line":46,"column":48}},"line":46},"4":{"name":"(anonymous_4)","decl":{"start":{"line":47,"column":21},"end":{"line":47,"column":22}},"loc":{"start":{"line":47,"column":28},"end":{"line":47,"column":37}},"line":47},"5":{"name":"getFilefromDataUrl","decl":{"start":{"line":60,"column":16},"end":{"line":60,"column":34}},"loc":{"start":{"line":60,"column":82},"end":{"line":88,"column":1}},"line":60},"6":{"name":"(anonymous_6)","decl":{"start":{"line":61,"column":21},"end":{"line":61,"column":22}},"loc":{"start":{"line":61,"column":34},"end":{"line":87,"column":3}},"line":61},"7":{"name":"loadImage","decl":{"start":{"line":96,"column":16},"end":{"line":96,"column":25}},"loc":{"start":{"line":96,"column":32},"end":{"line":103,"column":1}},"line":96},"8":{"name":"(anonymous_8)","decl":{"start":{"line":97,"column":21},"end":{"line":97,"column":22}},"loc":{"start":{"line":97,"column":42},"end":{"line":102,"column":3}},"line":97},"9":{"name":"(anonymous_9)","decl":{"start":{"line":99,"column":17},"end":{"line":99,"column":18}},"loc":{"start":{"line":99,"column":23},"end":{"line":99,"column":35}},"line":99},"10":{"name":"(anonymous_10)","decl":{"start":{"line":100,"column":18},"end":{"line":100,"column":19}},"loc":{"start":{"line":100,"column":25},"end":{"line":100,"column":34}},"line":100},"11":{"name":"drawImageInCanvas","decl":{"start":{"line":111,"column":16},"end":{"line":111,"column":33}},"loc":{"start":{"line":111,"column":40},"end":{"line":115,"column":1}},"line":111},"12":{"name":"drawFileInCanvas","decl":{"start":{"line":123,"column":22},"end":{"line":123,"column":38}},"loc":{"start":{"line":123,"column":46},"end":{"line":133,"column":1}},"line":123},"13":{"name":"canvasToFile","decl":{"start":{"line":145,"column":22},"end":{"line":145,"column":34}},"loc":{"start":{"line":145,"column":95},"end":{"line":166,"column":1}},"line":145},"14":{"name":"getExifOrientation","decl":{"start":{"line":176,"column":16},"end":{"line":176,"column":34}},"loc":{"start":{"line":176,"column":42},"end":{"line":215,"column":1}},"line":176},"15":{"name":"(anonymous_15)","decl":{"start":{"line":177,"column":21},"end":{"line":177,"column":22}},"loc":{"start":{"line":177,"column":42},"end":{"line":214,"column":3}},"line":177},"16":{"name":"(anonymous_16)","decl":{"start":{"line":179,"column":20},"end":{"line":179,"column":21}},"loc":{"start":{"line":179,"column":27},"end":{"line":211,"column":5}},"line":179},"17":{"name":"(anonymous_17)","decl":{"start":{"line":212,"column":21},"end":{"line":212,"column":22}},"loc":{"start":{"line":212,"column":28},"end":{"line":212,"column":37}},"line":212},"18":{"name":"handleMaxWidthOrHeight","decl":{"start":{"line":223,"column":16},"end":{"line":223,"column":38}},"loc":{"start":{"line":223,"column":57},"end":{"line":248,"column":1}},"line":223},"19":{"name":"followExifOrientation","decl":{"start":{"line":258,"column":16},"end":{"line":258,"column":37}},"loc":{"start":{"line":258,"column":64},"end":{"line":305,"column":1}},"line":258},"20":{"name":"getNewCanvasAndCtx","decl":{"start":{"line":313,"column":16},"end":{"line":313,"column":34}},"loc":{"start":{"line":313,"column":51},"end":{"line":331,"column":1}},"line":313},"21":{"name":"cleanupCanvasMemory","decl":{"start":{"line":338,"column":16},"end":{"line":338,"column":35}},"loc":{"start":{"line":338,"column":45},"end":{"line":343,"column":1}},"line":338},"22":{"name":"(anonymous_22)","decl":{"start":{"line":347,"column":41},"end":{"line":347,"column":42}},"loc":{"start":{"line":347,"column":58},"end":{"line":351,"column":3}},"line":347}},"branchMap":{"0":{"loc":{"start":{"line":6,"column":21},"end":{"line":6,"column":124}},"type":"binary-expr","locations":[{"start":{"line":6,"column":21},"end":{"line":6,"column":30}},{"start":{"line":6,"column":34},"end":{"line":6,"column":48}},{"start":{"line":6,"column":52},"end":{"line":6,"column":74}},{"start":{"line":6,"column":78},"end":{"line":6,"column":124}}],"line":6},"1":{"loc":{"start":{"line":7,"column":26},"end":{"line":7,"column":113}},"type":"binary-expr","locations":[{"start":{"line":7,"column":26},"end":{"line":7,"column":35}},{"start":{"line":7,"column":41},"end":{"line":7,"column":53}},{"start":{"line":7,"column":57},"end":{"line":7,"column":103}},{"start":{"line":7,"column":108},"end":{"line":7,"column":112}}],"line":7},"2":{"loc":{"start":{"line":8,"column":32},"end":{"line":8,"column":131}},"type":"binary-expr","locations":[{"start":{"line":8,"column":32},"end":{"line":8,"column":41}},{"start":{"line":8,"column":47},"end":{"line":8,"column":59}},{"start":{"line":8,"column":63},"end":{"line":8,"column":115}},{"start":{"line":8,"column":120},"end":{"line":8,"column":130}}],"line":8},"3":{"loc":{"start":{"line":13,"column":2},"end":{"line":14,"column":44}},"type":"if","locations":[{"start":{"line":13,"column":2},"end":{"line":14,"column":44}},{"start":{"line":13,"column":2},"end":{"line":14,"column":44}}],"line":13},"4":{"loc":{"start":{"line":33,"column":38},"end":{"line":33,"column":73}},"type":"binary-expr","locations":[{"start":{"line":33,"column":38},"end":{"line":33,"column":53}},{"start":{"line":33,"column":57},"end":{"line":33,"column":73}}],"line":33},"5":{"loc":{"start":{"line":60,"column":55},"end":{"line":60,"column":80}},"type":"default-arg","locations":[{"start":{"line":60,"column":70},"end":{"line":60,"column":80}}],"line":60},"6":{"loc":{"start":{"line":145,"column":82},"end":{"line":145,"column":93}},"type":"default-arg","locations":[{"start":{"line":145,"column":92},"end":{"line":145,"column":93}}],"line":145},"7":{"loc":{"start":{"line":147,"column":2},"end":{"line":164,"column":3}},"type":"if","locations":[{"start":{"line":147,"column":2},"end":{"line":164,"column":3}},{"start":{"line":147,"column":2},"end":{"line":164,"column":3}}],"line":147},"8":{"loc":{"start":{"line":154,"column":9},"end":{"line":164,"column":3}},"type":"if","locations":[{"start":{"line":154,"column":9},"end":{"line":164,"column":3}},{"start":{"line":154,"column":9},"end":{"line":164,"column":3}}],"line":154},"9":{"loc":{"start":{"line":154,"column":13},"end":{"line":154,"column":87}},"type":"binary-expr","locations":[{"start":{"line":154,"column":13},"end":{"line":154,"column":50}},{"start":{"line":154,"column":54},"end":{"line":154,"column":87}}],"line":154},"10":{"loc":{"start":{"line":181,"column":6},"end":{"line":183,"column":7}},"type":"if","locations":[{"start":{"line":181,"column":6},"end":{"line":183,"column":7}},{"start":{"line":181,"column":6},"end":{"line":183,"column":7}}],"line":181},"11":{"loc":{"start":{"line":187,"column":8},"end":{"line":187,"column":70}},"type":"if","locations":[{"start":{"line":187,"column":8},"end":{"line":187,"column":70}},{"start":{"line":187,"column":8},"end":{"line":187,"column":70}}],"line":187},"12":{"loc":{"start":{"line":190,"column":8},"end":{"line":208,"column":9}},"type":"if","locations":[{"start":{"line":190,"column":8},"end":{"line":208,"column":9}},{"start":{"line":190,"column":8},"end":{"line":208,"column":9}}],"line":190},"13":{"loc":{"start":{"line":191,"column":10},"end":{"line":193,"column":11}},"type":"if","locations":[{"start":{"line":191,"column":10},"end":{"line":193,"column":11}},{"start":{"line":191,"column":10},"end":{"line":193,"column":11}}],"line":191},"14":{"loc":{"start":{"line":200,"column":12},"end":{"line":202,"column":13}},"type":"if","locations":[{"start":{"line":200,"column":12},"end":{"line":202,"column":13}},{"start":{"line":200,"column":12},"end":{"line":202,"column":13}}],"line":200},"15":{"loc":{"start":{"line":204,"column":15},"end":{"line":208,"column":9}},"type":"if","locations":[{"start":{"line":204,"column":15},"end":{"line":208,"column":9}},{"start":{"line":204,"column":15},"end":{"line":208,"column":9}}],"line":204},"16":{"loc":{"start":{"line":228,"column":23},"end":{"line":228,"column":108}},"type":"binary-expr","locations":[{"start":{"line":228,"column":23},"end":{"line":228,"column":49}},{"start":{"line":228,"column":54},"end":{"line":228,"column":78}},{"start":{"line":228,"column":82},"end":{"line":228,"column":107}}],"line":228},"17":{"loc":{"start":{"line":233,"column":2},"end":{"line":245,"column":3}},"type":"if","locations":[{"start":{"line":233,"column":2},"end":{"line":245,"column":3}},{"start":{"line":233,"column":2},"end":{"line":245,"column":3}}],"line":233},"18":{"loc":{"start":{"line":235,"column":4},"end":{"line":241,"column":5}},"type":"if","locations":[{"start":{"line":235,"column":4},"end":{"line":241,"column":5}},{"start":{"line":235,"column":4},"end":{"line":241,"column":5}}],"line":235},"19":{"loc":{"start":{"line":265,"column":2},"end":{"line":271,"column":3}},"type":"if","locations":[{"start":{"line":265,"column":2},"end":{"line":271,"column":3}},{"start":{"line":265,"column":2},"end":{"line":271,"column":3}}],"line":265},"20":{"loc":{"start":{"line":265,"column":6},"end":{"line":265,"column":48}},"type":"binary-expr","locations":[{"start":{"line":265,"column":6},"end":{"line":265,"column":25}},{"start":{"line":265,"column":29},"end":{"line":265,"column":48}}],"line":265},"21":{"loc":{"start":{"line":274,"column":2},"end":{"line":298,"column":3}},"type":"switch","locations":[{"start":{"line":275,"column":4},"end":{"line":277,"column":11}},{"start":{"line":278,"column":4},"end":{"line":280,"column":11}},{"start":{"line":281,"column":4},"end":{"line":283,"column":11}},{"start":{"line":284,"column":4},"end":{"line":286,"column":11}},{"start":{"line":287,"column":4},"end":{"line":289,"column":11}},{"start":{"line":290,"column":4},"end":{"line":292,"column":11}},{"start":{"line":293,"column":4},"end":{"line":295,"column":11}},{"start":{"line":296,"column":4},"end":{"line":297,"column":11}}],"line":274},"22":{"loc":{"start":{"line":319,"column":4},"end":{"line":321,"column":5}},"type":"if","locations":[{"start":{"line":319,"column":4},"end":{"line":321,"column":5}},{"start":{"line":319,"column":4},"end":{"line":321,"column":5}}],"line":319},"23":{"loc":{"start":{"line":345,"column":0},"end":{"line":352,"column":1}},"type":"if","locations":[{"start":{"line":345,"column":0},"end":{"line":352,"column":1}},{"start":{"line":345,"column":0},"end":{"line":352,"column":1}}],"line":345},"24":{"loc":{"start":{"line":347,"column":21},"end":{"line":351,"column":3}},"type":"binary-expr","locations":[{"start":{"line":347,"column":21},"end":{"line":347,"column":37}},{"start":{"line":347,"column":41},"end":{"line":351,"column":3}}],"line":347},"25":{"loc":{"start":{"line":348,"column":11},"end":{"line":350,"column":33}},"type":"binary-expr","locations":[{"start":{"line":348,"column":11},"end":{"line":348,"column":36}},{"start":{"line":349,"column":6},"end":{"line":349,"column":21}},{"start":{"line":350,"column":6},"end":{"line":350,"column":33}}],"line":348}},"s":{"0":1,"1":1,"2":1,"3":1,"4":6,"5":5,"6":1,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":15,"15":15,"16":15,"17":15,"18":15,"19":0,"20":15,"21":9,"22":9,"23":9,"24":9,"25":9,"26":9,"27":9,"28":11249118,"29":9,"30":9,"31":9,"32":9,"33":15,"34":15,"35":15,"36":15,"37":15,"38":0,"39":15,"40":14,"41":14,"42":14,"43":13,"44":13,"45":13,"46":13,"47":13,"48":13,"49":9,"50":3,"51":3,"52":3,"53":3,"54":3,"55":3,"56":6,"57":0,"58":0,"59":0,"60":6,"61":6,"62":9,"63":1,"64":1,"65":1,"66":1,"67":1,"68":1,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":1,"92":0,"93":1,"94":6,"95":6,"96":6,"97":6,"98":6,"99":6,"100":4,"101":4,"102":2,"103":2,"104":2,"105":2,"106":4,"107":4,"108":6,"109":6,"110":6,"111":6,"112":6,"113":0,"114":0,"115":6,"116":6,"117":6,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":6,"133":6,"134":6,"135":6,"136":26,"137":26,"138":0,"139":0,"140":0,"141":26,"142":26,"143":26,"144":26,"145":26,"146":18,"147":18,"148":1,"149":1,"150":0},"f":{"0":6,"1":15,"2":15,"3":15,"4":0,"5":9,"6":9,"7":15,"8":15,"9":15,"10":0,"11":14,"12":13,"13":9,"14":1,"15":1,"16":1,"17":0,"18":6,"19":6,"20":26,"21":18,"22":0},"b":{"0":[1,1,0,0],"1":[1,1,0,1],"2":[1,1,0,1],"3":[5,1],"4":[1,0],"5":[2],"6":[1],"7":[3,6],"8":[0,6],"9":[6,0],"10":[1,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[6,4,0],"17":[4,2],"18":[2,2],"19":[0,6],"20":[6,0],"21":[0,0,0,0,0,0,0,6],"22":[0,0],"23":[1,0],"24":[1,0],"25":[0,0,0]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"3cf308ec0fb37d1bd9933ad4d4604b361dabcf0d","contentHash":"2d33143e4ce5fd245e4fdd1a613bc688346c8a83ba681297c098462282394cf7"} +{"D:\\Projects\\browser-image-compression\\lib\\image-compression.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\image-compression.js","statementMap":{"0":{"start":{"line":29,"column":17},"end":{"line":29,"column":33}},"1":{"start":{"line":32,"column":4},"end":{"line":32,"column":20}},"2":{"start":{"line":33,"column":4},"end":{"line":33,"column":48}},"3":{"start":{"line":37,"column":4},"end":{"line":37,"column":52}},"4":{"start":{"line":38,"column":4},"end":{"line":38,"column":33}},"5":{"start":{"line":41,"column":24},"end":{"line":41,"column":50}},"6":{"start":{"line":43,"column":22},"end":{"line":43,"column":53}},"7":{"start":{"line":45,"column":2},"end":{"line":45,"column":16}},"8":{"start":{"line":48,"column":25},"end":{"line":48,"column":53}},"9":{"start":{"line":50,"column":2},"end":{"line":50,"column":16}},"10":{"start":{"line":53,"column":38},"end":{"line":53,"column":81}},"11":{"start":{"line":55,"column":2},"end":{"line":55,"column":16}},"12":{"start":{"line":58,"column":26},"end":{"line":58,"column":83}},"13":{"start":{"line":59,"column":2},"end":{"line":59,"column":16}},"14":{"start":{"line":60,"column":33},"end":{"line":60,"column":169}},"15":{"start":{"line":61,"column":2},"end":{"line":61,"column":16}},"16":{"start":{"line":63,"column":16},"end":{"line":63,"column":45}},"17":{"start":{"line":65,"column":25},"end":{"line":65,"column":54}},"18":{"start":{"line":67,"column":19},"end":{"line":67,"column":116}},"19":{"start":{"line":68,"column":2},"end":{"line":68,"column":16}},"20":{"start":{"line":70,"column":28},"end":{"line":70,"column":55}},"21":{"start":{"line":71,"column":27},"end":{"line":71,"column":52}},"22":{"start":{"line":76,"column":2},"end":{"line":80,"column":3}},"23":{"start":{"line":78,"column":4},"end":{"line":78,"column":21}},"24":{"start":{"line":79,"column":4},"end":{"line":79,"column":20}},"25":{"start":{"line":82,"column":21},"end":{"line":82,"column":30}},"26":{"start":{"line":83,"column":23},"end":{"line":83,"column":36}},"27":{"start":{"line":84,"column":20},"end":{"line":84,"column":32}},"28":{"start":{"line":88,"column":15},"end":{"line":88,"column":37}},"29":{"start":{"line":89,"column":2},"end":{"line":109,"column":3}},"30":{"start":{"line":90,"column":21},"end":{"line":90,"column":75}},"31":{"start":{"line":91,"column":22},"end":{"line":91,"column":78}},"32":{"start":{"line":94,"column":4},"end":{"line":94,"column":63}},"33":{"start":{"line":96,"column":4},"end":{"line":96,"column":53}},"34":{"start":{"line":98,"column":4},"end":{"line":98,"column":20}},"35":{"start":{"line":100,"column":4},"end":{"line":100,"column":106}},"36":{"start":{"line":102,"column":4},"end":{"line":102,"column":32}},"37":{"start":{"line":104,"column":4},"end":{"line":104,"column":23}},"38":{"start":{"line":106,"column":4},"end":{"line":106,"column":38}},"39":{"start":{"line":108,"column":4},"end":{"line":108,"column":111}},"40":{"start":{"line":111,"column":2},"end":{"line":111,"column":30}},"41":{"start":{"line":112,"column":2},"end":{"line":112,"column":33}},"42":{"start":{"line":113,"column":2},"end":{"line":113,"column":51}},"43":{"start":{"line":114,"column":2},"end":{"line":114,"column":46}},"44":{"start":{"line":115,"column":2},"end":{"line":115,"column":34}},"45":{"start":{"line":117,"column":2},"end":{"line":117,"column":19}},"46":{"start":{"line":118,"column":2},"end":{"line":118,"column":24}}},"fnMap":{"0":{"name":"compress","decl":{"start":{"line":28,"column":30},"end":{"line":28,"column":38}},"loc":{"start":{"line":28,"column":76},"end":{"line":119,"column":1}},"line":28},"1":{"name":"incProgress","decl":{"start":{"line":31,"column":11},"end":{"line":31,"column":22}},"loc":{"start":{"line":31,"column":32},"end":{"line":34,"column":3}},"line":31},"2":{"name":"setProgress","decl":{"start":{"line":36,"column":11},"end":{"line":36,"column":22}},"loc":{"start":{"line":36,"column":26},"end":{"line":39,"column":3}},"line":36}},"branchMap":{"0":{"loc":{"start":{"line":28,"column":54},"end":{"line":28,"column":74}},"type":"default-arg","locations":[{"start":{"line":28,"column":73},"end":{"line":28,"column":74}}],"line":28},"1":{"loc":{"start":{"line":31,"column":23},"end":{"line":31,"column":30}},"type":"default-arg","locations":[{"start":{"line":31,"column":29},"end":{"line":31,"column":30}}],"line":31},"2":{"loc":{"start":{"line":41,"column":24},"end":{"line":41,"column":50}},"type":"binary-expr","locations":[{"start":{"line":41,"column":24},"end":{"line":41,"column":44}},{"start":{"line":41,"column":48},"end":{"line":41,"column":50}}],"line":41},"3":{"loc":{"start":{"line":58,"column":26},"end":{"line":58,"column":83}},"type":"binary-expr","locations":[{"start":{"line":58,"column":26},"end":{"line":58,"column":49}},{"start":{"line":58,"column":53},"end":{"line":58,"column":83}}],"line":58},"4":{"loc":{"start":{"line":60,"column":33},"end":{"line":60,"column":169}},"type":"cond-expr","locations":[{"start":{"line":60,"column":72},"end":{"line":60,"column":99}},{"start":{"line":60,"column":102},"end":{"line":60,"column":169}}],"line":60},"5":{"loc":{"start":{"line":63,"column":16},"end":{"line":63,"column":45}},"type":"binary-expr","locations":[{"start":{"line":63,"column":16},"end":{"line":63,"column":38}},{"start":{"line":63,"column":42},"end":{"line":63,"column":45}}],"line":63},"6":{"loc":{"start":{"line":65,"column":25},"end":{"line":65,"column":54}},"type":"binary-expr","locations":[{"start":{"line":65,"column":25},"end":{"line":65,"column":41}},{"start":{"line":65,"column":45},"end":{"line":65,"column":54}}],"line":65},"7":{"loc":{"start":{"line":76,"column":2},"end":{"line":80,"column":3}},"type":"if","locations":[{"start":{"line":76,"column":2},"end":{"line":80,"column":3}},{"start":{"line":76,"column":2},"end":{"line":80,"column":3}}],"line":76},"8":{"loc":{"start":{"line":76,"column":6},"end":{"line":76,"column":45}},"type":"binary-expr","locations":[{"start":{"line":76,"column":6},"end":{"line":76,"column":24}},{"start":{"line":76,"column":28},"end":{"line":76,"column":45}}],"line":76},"9":{"loc":{"start":{"line":89,"column":9},"end":{"line":89,"column":85}},"type":"binary-expr","locations":[{"start":{"line":89,"column":9},"end":{"line":89,"column":26}},{"start":{"line":89,"column":31},"end":{"line":89,"column":56}},{"start":{"line":89,"column":60},"end":{"line":89,"column":84}}],"line":89},"10":{"loc":{"start":{"line":90,"column":21},"end":{"line":90,"column":75}},"type":"cond-expr","locations":[{"start":{"line":90,"column":41},"end":{"line":90,"column":60}},{"start":{"line":90,"column":63},"end":{"line":90,"column":75}}],"line":90},"11":{"loc":{"start":{"line":91,"column":22},"end":{"line":91,"column":78}},"type":"cond-expr","locations":[{"start":{"line":91,"column":42},"end":{"line":91,"column":62}},{"start":{"line":91,"column":65},"end":{"line":91,"column":78}}],"line":91}},"s":{"0":6,"1":36,"2":36,"3":8,"4":8,"5":6,"6":6,"7":6,"8":6,"9":6,"10":6,"11":6,"12":6,"13":6,"14":6,"15":6,"16":6,"17":6,"18":6,"19":6,"20":6,"21":6,"22":6,"23":5,"24":5,"25":1,"26":1,"27":1,"28":1,"29":1,"30":2,"31":2,"32":2,"33":2,"34":2,"35":2,"36":2,"37":2,"38":2,"39":2,"40":1,"41":1,"42":1,"43":1,"44":1,"45":1,"46":1},"f":{"0":6,"1":36,"2":8},"b":{"0":[6],"1":[36],"2":[6,6],"3":[6,0],"4":[0,6],"5":[6,6],"6":[6,6],"7":[5,1],"8":[6,5],"9":[3,3,1],"10":[2,0],"11":[2,0]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"a1392aaafac18f8a642b9c2acc0a14226071ff38","contentHash":"bcff49e84e51c75d60b369064fced01917b550f3b0b2c6b227747b885b47e07b"} +,"D:\\Projects\\browser-image-compression\\lib\\index.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\index.js","statementMap":{"0":{"start":{"line":38,"column":15},"end":{"line":38,"column":29}},"1":{"start":{"line":41,"column":17},"end":{"line":41,"column":18}},"2":{"start":{"line":42,"column":25},"end":{"line":42,"column":29}},"3":{"start":{"line":44,"column":2},"end":{"line":44,"column":62}},"4":{"start":{"line":45,"column":23},"end":{"line":45,"column":88}},"5":{"start":{"line":46,"column":2},"end":{"line":46,"column":27}},"6":{"start":{"line":47,"column":2},"end":{"line":52,"column":4}},"7":{"start":{"line":48,"column":4},"end":{"line":48,"column":25}},"8":{"start":{"line":49,"column":4},"end":{"line":51,"column":5}},"9":{"start":{"line":50,"column":6},"end":{"line":50,"column":27}},"10":{"start":{"line":54,"column":2},"end":{"line":58,"column":3}},"11":{"start":{"line":55,"column":4},"end":{"line":55,"column":73}},"12":{"start":{"line":56,"column":9},"end":{"line":58,"column":3}},"13":{"start":{"line":57,"column":4},"end":{"line":57,"column":54}},"14":{"start":{"line":62,"column":22},"end":{"line":62,"column":99}},"15":{"start":{"line":70,"column":2},"end":{"line":80,"column":3}},"16":{"start":{"line":71,"column":4},"end":{"line":77,"column":5}},"17":{"start":{"line":73,"column":6},"end":{"line":73,"column":61}},"18":{"start":{"line":76,"column":6},"end":{"line":76,"column":50}},"19":{"start":{"line":79,"column":4},"end":{"line":79,"column":48}},"20":{"start":{"line":82,"column":2},"end":{"line":86,"column":16}},"21":{"start":{"line":83,"column":4},"end":{"line":83,"column":36}},"22":{"start":{"line":84,"column":4},"end":{"line":84,"column":52}},"23":{"start":{"line":88,"column":2},"end":{"line":88,"column":24}},"24":{"start":{"line":91,"column":0},"end":{"line":91,"column":57}},"25":{"start":{"line":92,"column":0},"end":{"line":92,"column":57}},"26":{"start":{"line":93,"column":0},"end":{"line":93,"column":39}},"27":{"start":{"line":94,"column":0},"end":{"line":94,"column":55}},"28":{"start":{"line":95,"column":0},"end":{"line":95,"column":53}},"29":{"start":{"line":96,"column":0},"end":{"line":96,"column":45}},"30":{"start":{"line":97,"column":0},"end":{"line":97,"column":57}},"31":{"start":{"line":99,"column":0},"end":{"line":99,"column":65}},"32":{"start":{"line":100,"column":0},"end":{"line":100,"column":63}},"33":{"start":{"line":101,"column":0},"end":{"line":101,"column":59}},"34":{"start":{"line":102,"column":0},"end":{"line":102,"column":73}},"35":{"start":{"line":103,"column":0},"end":{"line":103,"column":105}},"36":{"start":{"line":104,"column":0},"end":{"line":104,"column":49}},"37":{"start":{"line":105,"column":0},"end":{"line":105,"column":36}}},"fnMap":{"0":{"name":"imageCompression","decl":{"start":{"line":37,"column":15},"end":{"line":37,"column":31}},"loc":{"start":{"line":37,"column":47},"end":{"line":89,"column":1}},"line":37},"1":{"name":"(anonymous_1)","decl":{"start":{"line":47,"column":20},"end":{"line":47,"column":21}},"loc":{"start":{"line":47,"column":35},"end":{"line":52,"column":3}},"line":47}},"branchMap":{"0":{"loc":{"start":{"line":44,"column":19},"end":{"line":44,"column":61}},"type":"binary-expr","locations":[{"start":{"line":44,"column":19},"end":{"line":44,"column":33}},{"start":{"line":44,"column":37},"end":{"line":44,"column":61}}],"line":44},"1":{"loc":{"start":{"line":45,"column":23},"end":{"line":45,"column":88}},"type":"cond-expr","locations":[{"start":{"line":45,"column":64},"end":{"line":45,"column":81}},{"start":{"line":45,"column":84},"end":{"line":45,"column":88}}],"line":45},"2":{"loc":{"start":{"line":49,"column":4},"end":{"line":51,"column":5}},"type":"if","locations":[{"start":{"line":49,"column":4},"end":{"line":51,"column":5}},{"start":{"line":49,"column":4},"end":{"line":51,"column":5}}],"line":49},"3":{"loc":{"start":{"line":54,"column":2},"end":{"line":58,"column":3}},"type":"if","locations":[{"start":{"line":54,"column":2},"end":{"line":58,"column":3}},{"start":{"line":54,"column":2},"end":{"line":58,"column":3}}],"line":54},"4":{"loc":{"start":{"line":54,"column":8},"end":{"line":54,"column":58}},"type":"binary-expr","locations":[{"start":{"line":54,"column":8},"end":{"line":54,"column":28}},{"start":{"line":54,"column":32},"end":{"line":54,"column":58}}],"line":54},"5":{"loc":{"start":{"line":56,"column":9},"end":{"line":58,"column":3}},"type":"if","locations":[{"start":{"line":56,"column":9},"end":{"line":58,"column":3}},{"start":{"line":56,"column":9},"end":{"line":58,"column":3}}],"line":56},"6":{"loc":{"start":{"line":62,"column":22},"end":{"line":62,"column":99}},"type":"binary-expr","locations":[{"start":{"line":62,"column":22},"end":{"line":62,"column":62}},{"start":{"line":62,"column":66},"end":{"line":62,"column":99}}],"line":62},"7":{"loc":{"start":{"line":70,"column":2},"end":{"line":80,"column":3}},"type":"if","locations":[{"start":{"line":70,"column":2},"end":{"line":80,"column":3}},{"start":{"line":70,"column":2},"end":{"line":80,"column":3}}],"line":70},"8":{"loc":{"start":{"line":70,"column":6},"end":{"line":70,"column":66}},"type":"binary-expr","locations":[{"start":{"line":70,"column":6},"end":{"line":70,"column":18}},{"start":{"line":70,"column":22},"end":{"line":70,"column":50}},{"start":{"line":70,"column":54},"end":{"line":70,"column":66}}],"line":70}},"s":{"0":9,"1":9,"2":9,"3":9,"4":9,"5":9,"6":9,"7":44,"8":44,"9":0,"10":9,"11":2,"12":7,"13":1,"14":6,"15":6,"16":0,"17":0,"18":0,"19":6,"20":6,"21":6,"22":6,"23":6,"24":1,"25":1,"26":1,"27":1,"28":1,"29":1,"30":1,"31":1,"32":1,"33":1,"34":1,"35":1,"36":1,"37":1},"f":{"0":9,"1":44},"b":{"0":[9,2],"1":[9,0],"2":[0,44],"3":[2,7],"4":[9,2],"5":[1,6],"6":[6,0],"7":[0,6],"8":[6,0,0]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"301b8b93b11906487323dc201af153d2a366678e","contentHash":"0a36de5ea753f4621658c7eb9ba4cb380f6546be0420ec76978ce242654a4551"} +,"D:\\Projects\\browser-image-compression\\lib\\polyfill.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\polyfill.js","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"429e9ae55e921fbb055dbd07a45c33747b0258ad","contentHash":"7eddf6e9aeec4e202e5de464152cb8bbe5b3b10f68fc9d434b70f9b921e3eb1e"} +,"D:\\Projects\\browser-image-compression\\lib\\utils.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\utils.js","statementMap":{"0":{"start":{"line":4,"column":18},"end":{"line":4,"column":47}},"1":{"start":{"line":7,"column":21},"end":{"line":7,"column":124}},"2":{"start":{"line":8,"column":26},"end":{"line":8,"column":153}},"3":{"start":{"line":9,"column":32},"end":{"line":9,"column":177}},"4":{"start":{"line":20,"column":2},"end":{"line":46,"column":5}},"5":{"start":{"line":21,"column":16},"end":{"line":21,"column":34}},"6":{"start":{"line":22,"column":17},"end":{"line":22,"column":43}},"7":{"start":{"line":23,"column":17},"end":{"line":23,"column":40}},"8":{"start":{"line":24,"column":12},"end":{"line":24,"column":23}},"9":{"start":{"line":25,"column":18},"end":{"line":25,"column":35}},"10":{"start":{"line":26,"column":4},"end":{"line":28,"column":5}},"11":{"start":{"line":27,"column":6},"end":{"line":27,"column":36}},"12":{"start":{"line":29,"column":17},"end":{"line":29,"column":50}},"13":{"start":{"line":30,"column":4},"end":{"line":30,"column":25}},"14":{"start":{"line":31,"column":4},"end":{"line":31,"column":37}},"15":{"start":{"line":32,"column":4},"end":{"line":32,"column":18}},"16":{"start":{"line":56,"column":2},"end":{"line":61,"column":5}},"17":{"start":{"line":57,"column":19},"end":{"line":57,"column":41}},"18":{"start":{"line":58,"column":4},"end":{"line":58,"column":49}},"19":{"start":{"line":58,"column":26},"end":{"line":58,"column":48}},"20":{"start":{"line":59,"column":4},"end":{"line":59,"column":38}},"21":{"start":{"line":59,"column":28},"end":{"line":59,"column":37}},"22":{"start":{"line":60,"column":4},"end":{"line":60,"column":31}},"23":{"start":{"line":71,"column":2},"end":{"line":76,"column":5}},"24":{"start":{"line":72,"column":16},"end":{"line":72,"column":27}},"25":{"start":{"line":73,"column":4},"end":{"line":73,"column":36}},"26":{"start":{"line":73,"column":23},"end":{"line":73,"column":35}},"27":{"start":{"line":74,"column":4},"end":{"line":74,"column":35}},"28":{"start":{"line":74,"column":25},"end":{"line":74,"column":34}},"29":{"start":{"line":75,"column":4},"end":{"line":75,"column":18}},"30":{"start":{"line":89,"column":20},"end":{"line":89,"column":25}},"31":{"start":{"line":90,"column":2},"end":{"line":92,"column":3}},"32":{"start":{"line":91,"column":4},"end":{"line":91,"column":27}},"33":{"start":{"line":92,"column":4},"end":{"line":98,"column":3}},"34":{"start":{"line":93,"column":4},"end":{"line":93,"column":27}},"35":{"start":{"line":94,"column":9},"end":{"line":98,"column":3}},"36":{"start":{"line":95,"column":4},"end":{"line":95,"column":28}},"37":{"start":{"line":96,"column":9},"end":{"line":98,"column":3}},"38":{"start":{"line":97,"column":4},"end":{"line":97,"column":38}},"39":{"start":{"line":99,"column":2},"end":{"line":99,"column":21}},"40":{"start":{"line":114,"column":22},"end":{"line":114,"column":38}},"41":{"start":{"line":115,"column":28},"end":{"line":115,"column":54}},"42":{"start":{"line":117,"column":14},"end":{"line":117,"column":23}},"43":{"start":{"line":118,"column":15},"end":{"line":118,"column":25}},"44":{"start":{"line":119,"column":13},"end":{"line":119,"column":27}},"45":{"start":{"line":120,"column":16},"end":{"line":120,"column":64}},"46":{"start":{"line":122,"column":2},"end":{"line":134,"column":3}},"47":{"start":{"line":123,"column":26},"end":{"line":123,"column":57}},"48":{"start":{"line":124,"column":27},"end":{"line":124,"column":59}},"49":{"start":{"line":125,"column":4},"end":{"line":131,"column":5}},"50":{"start":{"line":126,"column":6},"end":{"line":126,"column":30}},"51":{"start":{"line":127,"column":6},"end":{"line":127,"column":37}},"52":{"start":{"line":129,"column":6},"end":{"line":129,"column":37}},"53":{"start":{"line":130,"column":6},"end":{"line":130,"column":28}},"54":{"start":{"line":133,"column":4},"end":{"line":133,"column":26}},"55":{"start":{"line":136,"column":2},"end":{"line":138,"column":4}},"56":{"start":{"line":150,"column":2},"end":{"line":159,"column":3}},"57":{"start":{"line":151,"column":4},"end":{"line":151,"column":48}},"58":{"start":{"line":152,"column":4},"end":{"line":152,"column":34}},"59":{"start":{"line":153,"column":4},"end":{"line":155,"column":5}},"60":{"start":{"line":154,"column":6},"end":{"line":154,"column":68}},"61":{"start":{"line":157,"column":4},"end":{"line":157,"column":46}},"62":{"start":{"line":158,"column":4},"end":{"line":158,"column":34}},"63":{"start":{"line":160,"column":2},"end":{"line":160,"column":23}},"64":{"start":{"line":161,"column":2},"end":{"line":161,"column":25}},"65":{"start":{"line":164,"column":2},"end":{"line":164,"column":23}},"66":{"start":{"line":174,"column":28},"end":{"line":174,"column":93}},"67":{"start":{"line":175,"column":24},"end":{"line":175,"column":57}},"68":{"start":{"line":176,"column":2},"end":{"line":176,"column":56}},"69":{"start":{"line":177,"column":2},"end":{"line":177,"column":16}},"70":{"start":{"line":188,"column":2},"end":{"line":193,"column":3}},"71":{"start":{"line":189,"column":4},"end":{"line":189,"column":40}},"72":{"start":{"line":191,"column":20},"end":{"line":191,"column":50}},"73":{"start":{"line":192,"column":4},"end":{"line":192,"column":35}},"74":{"start":{"line":194,"column":17},"end":{"line":194,"column":39}},"75":{"start":{"line":195,"column":2},"end":{"line":195,"column":23}},"76":{"start":{"line":210,"column":2},"end":{"line":227,"column":3}},"77":{"start":{"line":211,"column":16},"end":{"line":211,"column":39}},"78":{"start":{"line":212,"column":21},"end":{"line":212,"column":72}},"79":{"start":{"line":213,"column":16},"end":{"line":213,"column":79}},"80":{"start":{"line":214,"column":4},"end":{"line":214,"column":47}},"81":{"start":{"line":215,"column":4},"end":{"line":215,"column":25}},"82":{"start":{"line":216,"column":4},"end":{"line":216,"column":41}},"83":{"start":{"line":217,"column":9},"end":{"line":227,"column":3}},"84":{"start":{"line":218,"column":4},"end":{"line":218,"column":67}},"85":{"start":{"line":219,"column":4},"end":{"line":219,"column":25}},"86":{"start":{"line":220,"column":4},"end":{"line":220,"column":41}},"87":{"start":{"line":225,"column":20},"end":{"line":225,"column":55}},"88":{"start":{"line":226,"column":4},"end":{"line":226,"column":73}},"89":{"start":{"line":228,"column":2},"end":{"line":228,"column":14}},"90":{"start":{"line":240,"column":2},"end":{"line":240,"column":19}},"91":{"start":{"line":242,"column":2},"end":{"line":242,"column":20}},"92":{"start":{"line":248,"column":2},"end":{"line":248,"column":96}},"93":{"start":{"line":248,"column":55},"end":{"line":248,"column":96}},"94":{"start":{"line":252,"column":23},"end":{"line":257,"column":65}},"95":{"start":{"line":258,"column":24},"end":{"line":258,"column":86}},"96":{"start":{"line":260,"column":26},"end":{"line":260,"column":68}},"97":{"start":{"line":261,"column":25},"end":{"line":261,"column":128}},"98":{"start":{"line":262,"column":2},"end":{"line":262,"column":39}},"99":{"start":{"line":263,"column":14},"end":{"line":263,"column":57}},"100":{"start":{"line":266,"column":2},"end":{"line":266,"column":74}},"101":{"start":{"line":267,"column":2},"end":{"line":267,"column":43}},"102":{"start":{"line":279,"column":2},"end":{"line":316,"column":5}},"103":{"start":{"line":280,"column":19},"end":{"line":280,"column":41}},"104":{"start":{"line":281,"column":4},"end":{"line":313,"column":6}},"105":{"start":{"line":282,"column":19},"end":{"line":282,"column":48}},"106":{"start":{"line":283,"column":6},"end":{"line":285,"column":7}},"107":{"start":{"line":284,"column":8},"end":{"line":284,"column":27}},"108":{"start":{"line":286,"column":21},"end":{"line":286,"column":36}},"109":{"start":{"line":287,"column":19},"end":{"line":287,"column":20}},"110":{"start":{"line":288,"column":6},"end":{"line":311,"column":7}},"111":{"start":{"line":289,"column":8},"end":{"line":289,"column":71}},"112":{"start":{"line":289,"column":52},"end":{"line":289,"column":71}},"113":{"start":{"line":290,"column":23},"end":{"line":290,"column":52}},"114":{"start":{"line":291,"column":8},"end":{"line":291,"column":20}},"115":{"start":{"line":292,"column":8},"end":{"line":310,"column":9}},"116":{"start":{"line":293,"column":10},"end":{"line":295,"column":11}},"117":{"start":{"line":294,"column":12},"end":{"line":294,"column":31}},"118":{"start":{"line":297,"column":25},"end":{"line":297,"column":69}},"119":{"start":{"line":298,"column":10},"end":{"line":298,"column":55}},"120":{"start":{"line":299,"column":23},"end":{"line":299,"column":53}},"121":{"start":{"line":300,"column":10},"end":{"line":300,"column":22}},"122":{"start":{"line":301,"column":10},"end":{"line":305,"column":11}},"123":{"start":{"line":301,"column":23},"end":{"line":301,"column":24}},"124":{"start":{"line":302,"column":12},"end":{"line":304,"column":13}},"125":{"start":{"line":303,"column":14},"end":{"line":303,"column":76}},"126":{"start":{"line":306,"column":15},"end":{"line":310,"column":9}},"127":{"start":{"line":307,"column":10},"end":{"line":307,"column":16}},"128":{"start":{"line":309,"column":10},"end":{"line":309,"column":50}},"129":{"start":{"line":312,"column":6},"end":{"line":312,"column":25}},"130":{"start":{"line":314,"column":4},"end":{"line":314,"column":38}},"131":{"start":{"line":314,"column":28},"end":{"line":314,"column":37}},"132":{"start":{"line":315,"column":4},"end":{"line":315,"column":35}},"133":{"start":{"line":326,"column":20},"end":{"line":326,"column":26}},"134":{"start":{"line":327,"column":21},"end":{"line":327,"column":27}},"135":{"start":{"line":328,"column":31},"end":{"line":328,"column":38}},"136":{"start":{"line":330,"column":23},"end":{"line":330,"column":108}},"137":{"start":{"line":332,"column":18},"end":{"line":332,"column":24}},"138":{"start":{"line":335,"column":2},"end":{"line":347,"column":3}},"139":{"start":{"line":336,"column":4},"end":{"line":336,"column":57}},"140":{"start":{"line":337,"column":4},"end":{"line":343,"column":5}},"141":{"start":{"line":338,"column":6},"end":{"line":338,"column":41}},"142":{"start":{"line":339,"column":6},"end":{"line":339,"column":61}},"143":{"start":{"line":341,"column":6},"end":{"line":341,"column":60}},"144":{"start":{"line":342,"column":6},"end":{"line":342,"column":42}},"145":{"start":{"line":344,"column":4},"end":{"line":344,"column":67}},"146":{"start":{"line":346,"column":4},"end":{"line":346,"column":32}},"147":{"start":{"line":349,"column":2},"end":{"line":349,"column":19}},"148":{"start":{"line":361,"column":20},"end":{"line":361,"column":26}},"149":{"start":{"line":362,"column":21},"end":{"line":362,"column":27}},"150":{"start":{"line":364,"column":27},"end":{"line":364,"column":60}},"151":{"start":{"line":367,"column":2},"end":{"line":373,"column":3}},"152":{"start":{"line":368,"column":4},"end":{"line":368,"column":29}},"153":{"start":{"line":369,"column":4},"end":{"line":369,"column":29}},"154":{"start":{"line":371,"column":4},"end":{"line":371,"column":28}},"155":{"start":{"line":372,"column":4},"end":{"line":372,"column":30}},"156":{"start":{"line":376,"column":2},"end":{"line":400,"column":3}},"157":{"start":{"line":378,"column":6},"end":{"line":378,"column":43}},"158":{"start":{"line":379,"column":6},"end":{"line":379,"column":12}},"159":{"start":{"line":381,"column":6},"end":{"line":381,"column":49}},"160":{"start":{"line":382,"column":6},"end":{"line":382,"column":12}},"161":{"start":{"line":384,"column":6},"end":{"line":384,"column":44}},"162":{"start":{"line":385,"column":6},"end":{"line":385,"column":12}},"163":{"start":{"line":387,"column":6},"end":{"line":387,"column":38}},"164":{"start":{"line":388,"column":6},"end":{"line":388,"column":12}},"165":{"start":{"line":390,"column":6},"end":{"line":390,"column":44}},"166":{"start":{"line":391,"column":6},"end":{"line":391,"column":12}},"167":{"start":{"line":393,"column":6},"end":{"line":393,"column":49}},"168":{"start":{"line":394,"column":6},"end":{"line":394,"column":12}},"169":{"start":{"line":396,"column":6},"end":{"line":396,"column":43}},"170":{"start":{"line":397,"column":6},"end":{"line":397,"column":12}},"171":{"start":{"line":399,"column":6},"end":{"line":399,"column":12}},"172":{"start":{"line":402,"column":2},"end":{"line":402,"column":45}},"173":{"start":{"line":404,"column":2},"end":{"line":404,"column":30}},"174":{"start":{"line":406,"column":2},"end":{"line":406,"column":19}}},"fnMap":{"0":{"name":"getFilefromDataUrl","decl":{"start":{"line":19,"column":16},"end":{"line":19,"column":34}},"loc":{"start":{"line":19,"column":81},"end":{"line":47,"column":1}},"line":19},"1":{"name":"(anonymous_1)","decl":{"start":{"line":20,"column":21},"end":{"line":20,"column":22}},"loc":{"start":{"line":20,"column":34},"end":{"line":46,"column":3}},"line":20},"2":{"name":"getDataUrlFromFile","decl":{"start":{"line":55,"column":16},"end":{"line":55,"column":34}},"loc":{"start":{"line":55,"column":41},"end":{"line":62,"column":1}},"line":55},"3":{"name":"(anonymous_3)","decl":{"start":{"line":56,"column":21},"end":{"line":56,"column":22}},"loc":{"start":{"line":56,"column":42},"end":{"line":61,"column":3}},"line":56},"4":{"name":"(anonymous_4)","decl":{"start":{"line":58,"column":20},"end":{"line":58,"column":21}},"loc":{"start":{"line":58,"column":26},"end":{"line":58,"column":48}},"line":58},"5":{"name":"(anonymous_5)","decl":{"start":{"line":59,"column":21},"end":{"line":59,"column":22}},"loc":{"start":{"line":59,"column":28},"end":{"line":59,"column":37}},"line":59},"6":{"name":"loadImage","decl":{"start":{"line":70,"column":16},"end":{"line":70,"column":25}},"loc":{"start":{"line":70,"column":31},"end":{"line":77,"column":1}},"line":70},"7":{"name":"(anonymous_7)","decl":{"start":{"line":71,"column":21},"end":{"line":71,"column":22}},"loc":{"start":{"line":71,"column":42},"end":{"line":76,"column":3}},"line":71},"8":{"name":"(anonymous_8)","decl":{"start":{"line":73,"column":17},"end":{"line":73,"column":18}},"loc":{"start":{"line":73,"column":23},"end":{"line":73,"column":35}},"line":73},"9":{"name":"(anonymous_9)","decl":{"start":{"line":74,"column":18},"end":{"line":74,"column":19}},"loc":{"start":{"line":74,"column":25},"end":{"line":74,"column":34}},"line":74},"10":{"name":"getBrowserName","decl":{"start":{"line":88,"column":16},"end":{"line":88,"column":30}},"loc":{"start":{"line":88,"column":33},"end":{"line":100,"column":1}},"line":88},"11":{"name":"approximateBelowMaximumCanvasSizeOfBrowser","decl":{"start":{"line":113,"column":16},"end":{"line":113,"column":58}},"loc":{"start":{"line":113,"column":82},"end":{"line":139,"column":1}},"line":113},"12":{"name":"getNewCanvasAndCtx","decl":{"start":{"line":147,"column":16},"end":{"line":147,"column":34}},"loc":{"start":{"line":147,"column":50},"end":{"line":165,"column":1}},"line":147},"13":{"name":"drawImageInCanvas","decl":{"start":{"line":173,"column":16},"end":{"line":173,"column":33}},"loc":{"start":{"line":173,"column":39},"end":{"line":178,"column":1}},"line":173},"14":{"name":"drawFileInCanvas","decl":{"start":{"line":186,"column":22},"end":{"line":186,"column":38}},"loc":{"start":{"line":186,"column":45},"end":{"line":196,"column":1}},"line":186},"15":{"name":"canvasToFile","decl":{"start":{"line":208,"column":22},"end":{"line":208,"column":34}},"loc":{"start":{"line":208,"column":94},"end":{"line":229,"column":1}},"line":208},"16":{"name":"cleanupCanvasMemory","decl":{"start":{"line":236,"column":16},"end":{"line":236,"column":35}},"loc":{"start":{"line":236,"column":44},"end":{"line":243,"column":1}},"line":236},"17":{"name":"isAutoOrientationInBrowser","decl":{"start":{"line":247,"column":22},"end":{"line":247,"column":48}},"loc":{"start":{"line":247,"column":51},"end":{"line":268,"column":1}},"line":247},"18":{"name":"getExifOrientation","decl":{"start":{"line":278,"column":16},"end":{"line":278,"column":34}},"loc":{"start":{"line":278,"column":41},"end":{"line":317,"column":1}},"line":278},"19":{"name":"(anonymous_19)","decl":{"start":{"line":279,"column":21},"end":{"line":279,"column":22}},"loc":{"start":{"line":279,"column":42},"end":{"line":316,"column":3}},"line":279},"20":{"name":"(anonymous_20)","decl":{"start":{"line":281,"column":20},"end":{"line":281,"column":21}},"loc":{"start":{"line":281,"column":27},"end":{"line":313,"column":5}},"line":281},"21":{"name":"(anonymous_21)","decl":{"start":{"line":314,"column":21},"end":{"line":314,"column":22}},"loc":{"start":{"line":314,"column":28},"end":{"line":314,"column":37}},"line":314},"22":{"name":"handleMaxWidthOrHeight","decl":{"start":{"line":325,"column":16},"end":{"line":325,"column":38}},"loc":{"start":{"line":325,"column":56},"end":{"line":350,"column":1}},"line":325},"23":{"name":"followExifOrientation","decl":{"start":{"line":360,"column":16},"end":{"line":360,"column":37}},"loc":{"start":{"line":360,"column":63},"end":{"line":407,"column":1}},"line":360}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":21},"end":{"line":7,"column":124}},"type":"binary-expr","locations":[{"start":{"line":7,"column":21},"end":{"line":7,"column":30}},{"start":{"line":7,"column":34},"end":{"line":7,"column":48}},{"start":{"line":7,"column":52},"end":{"line":7,"column":74}},{"start":{"line":7,"column":78},"end":{"line":7,"column":124}}],"line":7},"1":{"loc":{"start":{"line":8,"column":26},"end":{"line":8,"column":153}},"type":"binary-expr","locations":[{"start":{"line":8,"column":26},"end":{"line":8,"column":35}},{"start":{"line":8,"column":41},"end":{"line":8,"column":53}},{"start":{"line":8,"column":57},"end":{"line":8,"column":103}},{"start":{"line":8,"column":109},"end":{"line":8,"column":143}},{"start":{"line":8,"column":147},"end":{"line":8,"column":151}}],"line":8},"2":{"loc":{"start":{"line":9,"column":32},"end":{"line":9,"column":177}},"type":"binary-expr","locations":[{"start":{"line":9,"column":32},"end":{"line":9,"column":41}},{"start":{"line":9,"column":47},"end":{"line":9,"column":59}},{"start":{"line":9,"column":63},"end":{"line":9,"column":115}},{"start":{"line":9,"column":121},"end":{"line":9,"column":161}},{"start":{"line":9,"column":165},"end":{"line":9,"column":175}}],"line":9},"3":{"loc":{"start":{"line":19,"column":54},"end":{"line":19,"column":79}},"type":"default-arg","locations":[{"start":{"line":19,"column":69},"end":{"line":19,"column":79}}],"line":19},"4":{"loc":{"start":{"line":90,"column":2},"end":{"line":92,"column":3}},"type":"if","locations":[{"start":{"line":90,"column":2},"end":{"line":92,"column":3}},{"start":{"line":90,"column":2},"end":{"line":92,"column":3}}],"line":90},"5":{"loc":{"start":{"line":90,"column":6},"end":{"line":90,"column":100}},"type":"binary-expr","locations":[{"start":{"line":90,"column":6},"end":{"line":90,"column":50}},{"start":{"line":90,"column":54},"end":{"line":90,"column":100}}],"line":90},"6":{"loc":{"start":{"line":92,"column":4},"end":{"line":98,"column":3}},"type":"if","locations":[{"start":{"line":92,"column":4},"end":{"line":98,"column":3}},{"start":{"line":92,"column":4},"end":{"line":98,"column":3}}],"line":92},"7":{"loc":{"start":{"line":94,"column":9},"end":{"line":98,"column":3}},"type":"if","locations":[{"start":{"line":94,"column":9},"end":{"line":98,"column":3}},{"start":{"line":94,"column":9},"end":{"line":98,"column":3}}],"line":94},"8":{"loc":{"start":{"line":96,"column":9},"end":{"line":98,"column":3}},"type":"if","locations":[{"start":{"line":96,"column":9},"end":{"line":98,"column":3}},{"start":{"line":96,"column":9},"end":{"line":98,"column":3}}],"line":96},"9":{"loc":{"start":{"line":96,"column":13},"end":{"line":96,"column":95}},"type":"binary-expr","locations":[{"start":{"line":96,"column":14},"end":{"line":96,"column":56}},{"start":{"line":96,"column":62},"end":{"line":96,"column":94}}],"line":96},"10":{"loc":{"start":{"line":120,"column":16},"end":{"line":120,"column":64}},"type":"cond-expr","locations":[{"start":{"line":120,"column":33},"end":{"line":120,"column":47}},{"start":{"line":120,"column":50},"end":{"line":120,"column":64}}],"line":120},"11":{"loc":{"start":{"line":125,"column":4},"end":{"line":131,"column":5}},"type":"if","locations":[{"start":{"line":125,"column":4},"end":{"line":131,"column":5}},{"start":{"line":125,"column":4},"end":{"line":131,"column":5}}],"line":125},"12":{"loc":{"start":{"line":153,"column":4},"end":{"line":155,"column":5}},"type":"if","locations":[{"start":{"line":153,"column":4},"end":{"line":155,"column":5}},{"start":{"line":153,"column":4},"end":{"line":155,"column":5}}],"line":153},"13":{"loc":{"start":{"line":208,"column":81},"end":{"line":208,"column":92}},"type":"default-arg","locations":[{"start":{"line":208,"column":91},"end":{"line":208,"column":92}}],"line":208},"14":{"loc":{"start":{"line":210,"column":2},"end":{"line":227,"column":3}},"type":"if","locations":[{"start":{"line":210,"column":2},"end":{"line":227,"column":3}},{"start":{"line":210,"column":2},"end":{"line":227,"column":3}}],"line":210},"15":{"loc":{"start":{"line":217,"column":9},"end":{"line":227,"column":3}},"type":"if","locations":[{"start":{"line":217,"column":9},"end":{"line":227,"column":3}},{"start":{"line":217,"column":9},"end":{"line":227,"column":3}}],"line":217},"16":{"loc":{"start":{"line":217,"column":13},"end":{"line":217,"column":87}},"type":"binary-expr","locations":[{"start":{"line":217,"column":13},"end":{"line":217,"column":50}},{"start":{"line":217,"column":54},"end":{"line":217,"column":87}}],"line":217},"17":{"loc":{"start":{"line":248,"column":2},"end":{"line":248,"column":96}},"type":"if","locations":[{"start":{"line":248,"column":2},"end":{"line":248,"column":96}},{"start":{"line":248,"column":2},"end":{"line":248,"column":96}}],"line":248},"18":{"loc":{"start":{"line":266,"column":38},"end":{"line":266,"column":73}},"type":"binary-expr","locations":[{"start":{"line":266,"column":38},"end":{"line":266,"column":53}},{"start":{"line":266,"column":57},"end":{"line":266,"column":73}}],"line":266},"19":{"loc":{"start":{"line":283,"column":6},"end":{"line":285,"column":7}},"type":"if","locations":[{"start":{"line":283,"column":6},"end":{"line":285,"column":7}},{"start":{"line":283,"column":6},"end":{"line":285,"column":7}}],"line":283},"20":{"loc":{"start":{"line":289,"column":8},"end":{"line":289,"column":71}},"type":"if","locations":[{"start":{"line":289,"column":8},"end":{"line":289,"column":71}},{"start":{"line":289,"column":8},"end":{"line":289,"column":71}}],"line":289},"21":{"loc":{"start":{"line":292,"column":8},"end":{"line":310,"column":9}},"type":"if","locations":[{"start":{"line":292,"column":8},"end":{"line":310,"column":9}},{"start":{"line":292,"column":8},"end":{"line":310,"column":9}}],"line":292},"22":{"loc":{"start":{"line":293,"column":10},"end":{"line":295,"column":11}},"type":"if","locations":[{"start":{"line":293,"column":10},"end":{"line":295,"column":11}},{"start":{"line":293,"column":10},"end":{"line":295,"column":11}}],"line":293},"23":{"loc":{"start":{"line":302,"column":12},"end":{"line":304,"column":13}},"type":"if","locations":[{"start":{"line":302,"column":12},"end":{"line":304,"column":13}},{"start":{"line":302,"column":12},"end":{"line":304,"column":13}}],"line":302},"24":{"loc":{"start":{"line":306,"column":15},"end":{"line":310,"column":9}},"type":"if","locations":[{"start":{"line":306,"column":15},"end":{"line":310,"column":9}},{"start":{"line":306,"column":15},"end":{"line":310,"column":9}}],"line":306},"25":{"loc":{"start":{"line":330,"column":23},"end":{"line":330,"column":108}},"type":"binary-expr","locations":[{"start":{"line":330,"column":23},"end":{"line":330,"column":49}},{"start":{"line":330,"column":54},"end":{"line":330,"column":78}},{"start":{"line":330,"column":82},"end":{"line":330,"column":107}}],"line":330},"26":{"loc":{"start":{"line":335,"column":2},"end":{"line":347,"column":3}},"type":"if","locations":[{"start":{"line":335,"column":2},"end":{"line":347,"column":3}},{"start":{"line":335,"column":2},"end":{"line":347,"column":3}}],"line":335},"27":{"loc":{"start":{"line":337,"column":4},"end":{"line":343,"column":5}},"type":"if","locations":[{"start":{"line":337,"column":4},"end":{"line":343,"column":5}},{"start":{"line":337,"column":4},"end":{"line":343,"column":5}}],"line":337},"28":{"loc":{"start":{"line":367,"column":2},"end":{"line":373,"column":3}},"type":"if","locations":[{"start":{"line":367,"column":2},"end":{"line":373,"column":3}},{"start":{"line":367,"column":2},"end":{"line":373,"column":3}}],"line":367},"29":{"loc":{"start":{"line":367,"column":6},"end":{"line":367,"column":48}},"type":"binary-expr","locations":[{"start":{"line":367,"column":6},"end":{"line":367,"column":25}},{"start":{"line":367,"column":29},"end":{"line":367,"column":48}}],"line":367},"30":{"loc":{"start":{"line":376,"column":2},"end":{"line":400,"column":3}},"type":"switch","locations":[{"start":{"line":377,"column":4},"end":{"line":379,"column":12}},{"start":{"line":380,"column":4},"end":{"line":382,"column":12}},{"start":{"line":383,"column":4},"end":{"line":385,"column":12}},{"start":{"line":386,"column":4},"end":{"line":388,"column":12}},{"start":{"line":389,"column":4},"end":{"line":391,"column":12}},{"start":{"line":392,"column":4},"end":{"line":394,"column":12}},{"start":{"line":395,"column":4},"end":{"line":397,"column":12}},{"start":{"line":398,"column":4},"end":{"line":399,"column":12}}],"line":376}},"s":{"0":1,"1":1,"2":1,"3":1,"4":9,"5":9,"6":9,"7":9,"8":9,"9":9,"10":9,"11":11249118,"12":9,"13":9,"14":9,"15":9,"16":15,"17":15,"18":15,"19":15,"20":15,"21":0,"22":15,"23":15,"24":15,"25":15,"26":15,"27":15,"28":0,"29":15,"30":14,"31":14,"32":0,"33":14,"34":0,"35":14,"36":0,"37":14,"38":0,"39":14,"40":14,"41":14,"42":14,"43":14,"44":14,"45":14,"46":14,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":14,"56":26,"57":26,"58":0,"59":0,"60":0,"61":26,"62":26,"63":26,"64":26,"65":26,"66":14,"67":14,"68":14,"69":14,"70":13,"71":13,"72":13,"73":13,"74":13,"75":13,"76":9,"77":3,"78":3,"79":3,"80":3,"81":3,"82":3,"83":6,"84":0,"85":0,"86":0,"87":6,"88":6,"89":9,"90":18,"91":18,"92":6,"93":5,"94":1,"95":1,"96":1,"97":1,"98":1,"99":1,"100":1,"101":1,"102":1,"103":1,"104":1,"105":1,"106":1,"107":1,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":1,"131":0,"132":1,"133":6,"134":6,"135":6,"136":6,"137":6,"138":6,"139":4,"140":4,"141":2,"142":2,"143":2,"144":2,"145":4,"146":4,"147":6,"148":6,"149":6,"150":6,"151":6,"152":0,"153":0,"154":6,"155":6,"156":6,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":6,"172":6,"173":6,"174":6},"f":{"0":9,"1":9,"2":15,"3":15,"4":15,"5":0,"6":15,"7":15,"8":15,"9":0,"10":14,"11":14,"12":26,"13":14,"14":13,"15":9,"16":18,"17":6,"18":1,"19":1,"20":1,"21":0,"22":6,"23":6},"b":{"0":[1,1,0,0],"1":[1,1,0,1,1],"2":[1,1,0,1,1],"3":[2],"4":[0,14],"5":[14,14],"6":[0,14],"7":[0,14],"8":[0,14],"9":[14,14],"10":[9,5],"11":[0,0],"12":[0,0],"13":[1],"14":[3,6],"15":[0,6],"16":[6,0],"17":[5,1],"18":[1,0],"19":[1,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[6,4,0],"26":[4,2],"27":[2,2],"28":[0,6],"29":[6,0],"30":[0,0,0,0,0,0,0,6]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"78de4c4aced513d0aafb9a2fe6803db968fec929","contentHash":"f44307d295f3e6b0e072ab555a7e41c6fefe4bfbda85561a2b1d7baa50a6f53a"} +,"D:\\Projects\\browser-image-compression\\lib\\config\\max-canvas-size.js": {"path":"D:\\Projects\\browser-image-compression\\lib\\config\\max-canvas-size.js","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"0951626fe107b8fcc2e342a45b0b5c806ef949a9","contentHash":"68446f582c34a08db1879323eba2f52146de8ed909256cb724fca2a450163ac4"} } diff --git a/coverage/coverage-summary.json b/coverage/coverage-summary.json index 8a390b9..14573c1 100644 --- a/coverage/coverage-summary.json +++ b/coverage/coverage-summary.json @@ -1,5 +1,7 @@ -{"total": {"lines":{"total":226,"covered":179,"skipped":0,"pct":79.2},"statements":{"total":233,"covered":181,"skipped":0,"pct":77.68},"functions":{"total":28,"covered":24,"skipped":0,"pct":85.71},"branches":{"total":106,"covered":61,"skipped":0,"pct":57.55}} +{"total": {"lines":{"total":252,"covered":194,"skipped":0,"pct":76.98},"statements":{"total":260,"covered":197,"skipped":0,"pct":75.77},"functions":{"total":29,"covered":26,"skipped":0,"pct":89.66},"branches":{"total":117,"covered":71,"skipped":0,"pct":60.68}} ,"D:\\Projects\\browser-image-compression\\lib\\image-compression.js": {"lines":{"total":47,"covered":47,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":47,"covered":47,"skipped":0,"pct":100},"branches":{"total":23,"covered":19,"skipped":0,"pct":82.61}} -,"D:\\Projects\\browser-image-compression\\lib\\index.js": {"lines":{"total":35,"covered":31,"skipped":0,"pct":88.57},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":35,"covered":31,"skipped":0,"pct":88.57},"branches":{"total":19,"covered":13,"skipped":0,"pct":68.42}} -,"D:\\Projects\\browser-image-compression\\lib\\utils.js": {"lines":{"total":144,"covered":101,"skipped":0,"pct":70.14},"functions":{"total":23,"covered":19,"skipped":0,"pct":82.61},"statements":{"total":151,"covered":103,"skipped":0,"pct":68.21},"branches":{"total":64,"covered":29,"skipped":0,"pct":45.31}} +,"D:\\Projects\\browser-image-compression\\lib\\index.js": {"lines":{"total":38,"covered":34,"skipped":0,"pct":89.47},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":38,"covered":34,"skipped":0,"pct":89.47},"branches":{"total":19,"covered":13,"skipped":0,"pct":68.42}} +,"D:\\Projects\\browser-image-compression\\lib\\polyfill.js": {"lines":{"total":0,"covered":0,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":0,"covered":0,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} +,"D:\\Projects\\browser-image-compression\\lib\\utils.js": {"lines":{"total":167,"covered":113,"skipped":0,"pct":67.66},"functions":{"total":24,"covered":21,"skipped":0,"pct":87.5},"statements":{"total":175,"covered":116,"skipped":0,"pct":66.29},"branches":{"total":75,"covered":39,"skipped":0,"pct":52}} +,"D:\\Projects\\browser-image-compression\\lib\\config\\max-canvas-size.js": {"lines":{"total":0,"covered":0,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":0,"covered":0,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}} } diff --git a/coverage/image-compression.js.html b/coverage/image-compression.js.html deleted file mode 100644 index 57db6e0..0000000 --- a/coverage/image-compression.js.html +++ /dev/null @@ -1,431 +0,0 @@ - - - - -
-- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 | - - - - - - - - - - - - - - - - - - - - - - - - - - - -6x - - -36x -36x - - - -8x -8x - - -6x - -6x - -6x - - -6x - -6x - - -6x - -6x - - -6x -6x -6x -6x - -6x - -6x - -6x -6x - -6x -6x - - - - -6x - -5x -5x - - -1x -1x -1x - - -1x -1x -2x -2x - - -2x - -2x - -2x -2x - -2x - -2x - -2x - -2x - - -1x -1x -1x -1x -1x - -1x -1x - - | import { - canvasToFile, - cleanupCanvasMemory, - drawFileInCanvas, - followExifOrientation, - getExifOrientation, - getNewCanvasAndCtx, - handleMaxWidthOrHeight, - isAutoOrientationInBrowser -} from './utils' - -/** - * Compress an image file. - * - * @param {File} file - * @param {Object} options - * @param {number} [options.maxSizeMB=Number.POSITIVE_INFINITY] - * @param {number} [options.maxWidthOrHeight=undefined] - * @param {boolean} [options.useWebWorker=false] - * @param {number} [options.maxIteration=10] - * @param {number} [options.exifOrientation] - default to be the exif orientation from the image file - * @param {Function} [options.onProgress] - a function takes one progress argument (progress from 0 to 100) - * @param {string} [options.fileType] - default to be the original mime type from the image file - * @param {number} [options.initialQuality=1.0] - * @param {number} previousProgress - for internal try catch rerunning start from previous progress - * @returns {Promise<File | Blob>} - */ -export default async function compress (file, options, previousProgress = 0) { - let progress = previousProgress - - function incProgress (inc = 5) { - progress += inc - options.onProgress(Math.min(progress, 100)) - } - - function setProgress (p) { - progress = Math.min(Math.max(p, progress), 100) - options.onProgress(progress) - } - - let remainingTrials = options.maxIteration || 10 - - const maxSizeByte = options.maxSizeMB * 1024 * 1024 - - incProgress() - - // drawFileInCanvas - let [img, origCanvas] = await drawFileInCanvas(file) - - incProgress() - - // handleMaxWidthOrHeight - const maxWidthOrHeightFixedCanvas = handleMaxWidthOrHeight(origCanvas, options) - - incProgress() - - // exifOrientation - const exifOrientation = options.exifOrientation || await getExifOrientation(file) - incProgress() - const orientationFixedCanvas = (await isAutoOrientationInBrowser()) ? maxWidthOrHeightFixedCanvas : followExifOrientation(maxWidthOrHeightFixedCanvas, exifOrientation) - incProgress() - - let quality = options.initialQuality || 1.0 - - const outputFileType = options.fileType || file.type - - let tempFile = await canvasToFile(orientationFixedCanvas, outputFileType, file.name, file.lastModified, quality) - incProgress() - - const origExceedMaxSize = tempFile.size > maxSizeByte - const sizeBecomeLarger = tempFile.size > file.size - // console.log('original file size', file.size) - // console.log('current file size', tempFile.size) - - // check if we need to compress or resize - if (!origExceedMaxSize && !sizeBecomeLarger) { - // no need to compress - setProgress(100) - return tempFile - } - - const sourceSize = file.size - const renderedSize = tempFile.size - let currentSize = renderedSize - let compressedFile - let newCanvas, ctx - let canvas = orientationFixedCanvas - while (remainingTrials-- && (currentSize > maxSizeByte || currentSize > sourceSize)) { - const newWidth = origExceedMaxSize ? canvas.width * 0.95 : canvas.width - const newHeight = origExceedMaxSize ? canvas.height * 0.95 : canvas.height; - // console.log('current width', newWidth); - // console.log('current height', newHeight); - [newCanvas, ctx] = getNewCanvasAndCtx(newWidth, newHeight) - - ctx.drawImage(canvas, 0, 0, newWidth, newHeight) - - quality *= 0.95 - compressedFile = await canvasToFile(newCanvas, outputFileType, file.name, file.lastModified, quality) - - cleanupCanvasMemory(canvas) - - canvas = newCanvas - - currentSize = compressedFile.size - // console.log('currentSize', currentSize) - setProgress(Math.min(99, Math.floor((renderedSize - currentSize) / (renderedSize - maxSizeByte) * 100))) - } - - cleanupCanvasMemory(canvas) - cleanupCanvasMemory(newCanvas) - cleanupCanvasMemory(maxWidthOrHeightFixedCanvas) - cleanupCanvasMemory(orientationFixedCanvas) - cleanupCanvasMemory(origCanvas) - - setProgress(100) - return compressedFile -} - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -9x - - -9x -9x -9x -9x -9x -44x -44x - - - - -9x -2x -7x -1x - - - -6x - - - - - - - -6x - - - - - - - - - - - -6x - - -6x -6x -6x - - -6x - - -1x -1x -1x -1x -1x -1x -1x - -1x -1x -1x -1x -1x - - - | import compress from './image-compression' -import { - canvasToFile, - drawFileInCanvas, - drawImageInCanvas, - getDataUrlFromFile, - getFilefromDataUrl, - loadImage, - getExifOrientation, - handleMaxWidthOrHeight, - followExifOrientation, - CustomFile, - cleanupCanvasMemory, - isAutoOrientationInBrowser -} from './utils' -import { compressOnWebWorker } from './web-worker' - -/** - * Compress an image file. - * - * @param {File} file - * @param {Object} options - { maxSizeMB=Number.POSITIVE_INFINITY, maxWidthOrHeight, useWebWorker=false, maxIteration = 10, exifOrientation, fileType } - * @param {number} [options.maxSizeMB=Number.POSITIVE_INFINITY] - * @param {number} [options.maxWidthOrHeight=undefined] - * @param {boolean} [options.useWebWorker=false] - * @param {number} [options.maxIteration=10] - * @param {number} [options.exifOrientation] - default to be the exif orientation from the image file - * @param {Function} [options.onProgress] - a function takes one progress argument (progress from 0 to 100) - * @param {string} [options.fileType] - default to be the original mime type from the image file - * @returns {Promise<File | Blob>} - */ -async function imageCompression (file, options) { - - let compressedFile - let progress = 0 - let onProgress - - options.maxSizeMB = options.maxSizeMB || Number.POSITIVE_INFINITY - const useWebWorker = typeof options.useWebWorker === 'boolean' ? options.useWebWorker : true - delete options.useWebWorker - onProgress = options.onProgress - options.onProgress = (aProgress) => { - progress = aProgress - Iif (typeof onProgress === 'function') { - onProgress(progress) - } - } - - if (!(file instanceof Blob || file instanceof CustomFile)) { - throw new Error('The file given is not an instance of Blob or File') - } else if (!/^image/.test(file.type)) { - throw new Error('The file given is not an image') - } - - // try run in web worker, fall back to run in main thread - const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope - - // if ((useWebWorker && typeof Worker === 'function') || inWebWorker) { - // console.log('run compression in web worker') - // } else { - // console.log('run compression in main thread') - // } - - Iif (useWebWorker && typeof Worker === 'function' && !inWebWorker) { - try { - // console.log(1) - // "compressOnWebWorker" is kind of like a recursion to call "imageCompression" again inside web worker - compressedFile = await compressOnWebWorker(file, options) - } catch (e) { - // console.warn('Run compression in web worker failed:', e, ', fall back to main thread') - // console.log(1.5) - compressedFile = await compress(file, options) - } - } else { - // console.log(2) - compressedFile = await compress(file, options) - } - - try { - compressedFile.name = file.name - compressedFile.lastModified = file.lastModified - } catch (e) {} - - return compressedFile -} - -imageCompression.getDataUrlFromFile = getDataUrlFromFile -imageCompression.getFilefromDataUrl = getFilefromDataUrl -imageCompression.loadImage = loadImage -imageCompression.drawImageInCanvas = drawImageInCanvas -imageCompression.drawFileInCanvas = drawFileInCanvas -imageCompression.canvasToFile = canvasToFile -imageCompression.getExifOrientation = getExifOrientation - -imageCompression.handleMaxWidthOrHeight = handleMaxWidthOrHeight -imageCompression.followExifOrientation = followExifOrientation -imageCompression.cleanupCanvasMemory = cleanupCanvasMemory -imageCompression.isAutoOrientationInBrowser = isAutoOrientationInBrowser -imageCompression.version = '1.0.14' - -export default imageCompression - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 | - - - - - - - - - - - - - - - - - - - - - - - - - - - -6x - - -36x -36x - - - -8x -8x - - -6x - -6x - -6x - - -6x - -6x - - -6x - -6x - - -6x -6x -6x -6x - -6x - -6x - -6x -6x - -6x -6x - - - - -6x - -5x -5x - - -1x -1x -1x - - -1x -1x -2x -2x - - -2x - -2x - -2x -2x - -2x - -2x - -2x - -2x - - -1x -1x -1x -1x -1x - -1x -1x - - | import { - canvasToFile, - cleanupCanvasMemory, - drawFileInCanvas, - followExifOrientation, - getExifOrientation, - getNewCanvasAndCtx, - handleMaxWidthOrHeight, - isAutoOrientationInBrowser -} from './utils' - -/** - * Compress an image file. - * - * @param {File} file - * @param {Object} options - * @param {number} [options.maxSizeMB=Number.POSITIVE_INFINITY] - * @param {number} [options.maxWidthOrHeight=undefined] - * @param {boolean} [options.useWebWorker=false] - * @param {number} [options.maxIteration=10] - * @param {number} [options.exifOrientation] - default to be the exif orientation from the image file - * @param {Function} [options.onProgress] - a function takes one progress argument (progress from 0 to 100) - * @param {string} [options.fileType] - default to be the original mime type from the image file - * @param {number} [options.initialQuality=1.0] - * @param {number} previousProgress - for internal try catch rerunning start from previous progress - * @returns {Promise<File | Blob>} - */ -export default async function compress (file, options, previousProgress = 0) { - let progress = previousProgress - - function incProgress (inc = 5) { - progress += inc - options.onProgress(Math.min(progress, 100)) - } - - function setProgress (p) { - progress = Math.min(Math.max(p, progress), 100) - options.onProgress(progress) - } - - let remainingTrials = options.maxIteration || 10 - - const maxSizeByte = options.maxSizeMB * 1024 * 1024 - - incProgress() - - // drawFileInCanvas - let [img, origCanvas] = await drawFileInCanvas(file) - - incProgress() - - // handleMaxWidthOrHeight - const maxWidthOrHeightFixedCanvas = handleMaxWidthOrHeight(origCanvas, options) - - incProgress() - - // exifOrientation - const exifOrientation = options.exifOrientation || await getExifOrientation(file) - incProgress() - const orientationFixedCanvas = (await isAutoOrientationInBrowser()) ? maxWidthOrHeightFixedCanvas : followExifOrientation(maxWidthOrHeightFixedCanvas, exifOrientation) - incProgress() - - let quality = options.initialQuality || 1.0 - - const outputFileType = options.fileType || file.type - - let tempFile = await canvasToFile(orientationFixedCanvas, outputFileType, file.name, file.lastModified, quality) - incProgress() - - const origExceedMaxSize = tempFile.size > maxSizeByte - const sizeBecomeLarger = tempFile.size > file.size - // console.log('original file size', file.size) - // console.log('current file size', tempFile.size) - - // check if we need to compress or resize - if (!origExceedMaxSize && !sizeBecomeLarger) { - // no need to compress - setProgress(100) - return tempFile - } - - const sourceSize = file.size - const renderedSize = tempFile.size - let currentSize = renderedSize - let compressedFile - let newCanvas, ctx - let canvas = orientationFixedCanvas - while (remainingTrials-- && (currentSize > maxSizeByte || currentSize > sourceSize)) { - const newWidth = origExceedMaxSize ? canvas.width * 0.95 : canvas.width - const newHeight = origExceedMaxSize ? canvas.height * 0.95 : canvas.height; - // console.log('current width', newWidth); - // console.log('current height', newHeight); - [newCanvas, ctx] = getNewCanvasAndCtx(newWidth, newHeight) - - ctx.drawImage(canvas, 0, 0, newWidth, newHeight) - - quality *= 0.95 - compressedFile = await canvasToFile(newCanvas, outputFileType, file.name, file.lastModified, quality) - - cleanupCanvasMemory(canvas) - - canvas = newCanvas - - currentSize = compressedFile.size - // console.log('currentSize', currentSize) - setProgress(Math.min(99, Math.floor((renderedSize - currentSize) / (renderedSize - maxSizeByte) * 100))) - } - - cleanupCanvasMemory(canvas) - cleanupCanvasMemory(newCanvas) - cleanupCanvasMemory(maxWidthOrHeightFixedCanvas) - cleanupCanvasMemory(orientationFixedCanvas) - cleanupCanvasMemory(origCanvas) - - setProgress(100) - return compressedFile -} - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -9x - - -9x -9x -9x -9x -9x -44x -44x - - - - -9x -2x -7x -1x - - - -6x - - - - - - - -6x - - - - - - - - - - - -6x - - -6x -6x -6x - - -6x - - -1x -1x -1x -1x -1x -1x -1x - -1x -1x -1x -1x -1x - - - | import compress from './image-compression' -import { - canvasToFile, - drawFileInCanvas, - drawImageInCanvas, - getDataUrlFromFile, - getFilefromDataUrl, - loadImage, - getExifOrientation, - handleMaxWidthOrHeight, - followExifOrientation, - CustomFile, - cleanupCanvasMemory, - isAutoOrientationInBrowser -} from './utils' -import { compressOnWebWorker } from './web-worker' - -/** - * Compress an image file. - * - * @param {File} file - * @param {Object} options - { maxSizeMB=Number.POSITIVE_INFINITY, maxWidthOrHeight, useWebWorker=false, maxIteration = 10, exifOrientation, fileType } - * @param {number} [options.maxSizeMB=Number.POSITIVE_INFINITY] - * @param {number} [options.maxWidthOrHeight=undefined] - * @param {boolean} [options.useWebWorker=false] - * @param {number} [options.maxIteration=10] - * @param {number} [options.exifOrientation] - default to be the exif orientation from the image file - * @param {Function} [options.onProgress] - a function takes one progress argument (progress from 0 to 100) - * @param {string} [options.fileType] - default to be the original mime type from the image file - * @returns {Promise<File | Blob>} - */ -async function imageCompression (file, options) { - - let compressedFile - let progress = 0 - let onProgress - - options.maxSizeMB = options.maxSizeMB || Number.POSITIVE_INFINITY - const useWebWorker = typeof options.useWebWorker === 'boolean' ? options.useWebWorker : true - delete options.useWebWorker - onProgress = options.onProgress - options.onProgress = (aProgress) => { - progress = aProgress - Iif (typeof onProgress === 'function') { - onProgress(progress) - } - } - - if (!(file instanceof Blob || file instanceof CustomFile)) { - throw new Error('The file given is not an instance of Blob or File') - } else if (!/^image/.test(file.type)) { - throw new Error('The file given is not an image') - } - - // try run in web worker, fall back to run in main thread - const inWebWorker = typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope - - // if ((useWebWorker && typeof Worker === 'function') || inWebWorker) { - // console.log('run compression in web worker') - // } else { - // console.log('run compression in main thread') - // } - - Iif (useWebWorker && typeof Worker === 'function' && !inWebWorker) { - try { - // console.log(1) - // "compressOnWebWorker" is kind of like a recursion to call "imageCompression" again inside web worker - compressedFile = await compressOnWebWorker(file, options) - } catch (e) { - // console.warn('Run compression in web worker failed:', e, ', fall back to main thread') - // console.log(1.5) - compressedFile = await compress(file, options) - } - } else { - // console.log(2) - compressedFile = await compress(file, options) - } - - try { - compressedFile.name = file.name - compressedFile.lastModified = file.lastModified - } catch (e) {} - - return compressedFile -} - -imageCompression.getDataUrlFromFile = getDataUrlFromFile -imageCompression.getFilefromDataUrl = getFilefromDataUrl -imageCompression.loadImage = loadImage -imageCompression.drawImageInCanvas = drawImageInCanvas -imageCompression.drawFileInCanvas = drawFileInCanvas -imageCompression.canvasToFile = canvasToFile -imageCompression.getExifOrientation = getExifOrientation - -imageCompression.handleMaxWidthOrHeight = handleMaxWidthOrHeight -imageCompression.followExifOrientation = followExifOrientation -imageCompression.cleanupCanvasMemory = cleanupCanvasMemory -imageCompression.isAutoOrientationInBrowser = isAutoOrientationInBrowser -imageCompression.version = '1.0.14' - -export default imageCompression - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 | - -1x - - -1x -1x -1x - - - - -6x -5x - - - - -1x - - - - - -1x - -1x -1x -1x -1x - - -1x -1x - - - - - - - - - -15x -15x -15x -15x -15x - - - - - - - - - - - - -9x -9x -9x -9x -9x -9x -9x -11249118x - -9x -9x -9x -9x - - - - - - - - - - - - - - - - - - - - - - - -15x -15x -15x -15x -15x - - - - - - - - - - -14x -14x -14x - - - - - - - - - - -13x -13x - -13x -13x - -13x -13x - - - - - - - - - - - - - - -9x -3x -3x -3x -3x -3x -3x -6x - - - - - - - -6x -6x - -9x - - - - - - - - - - - -1x -1x -1x -1x -1x -1x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1x -1x - - - - - - - - - - -6x -6x -6x - -6x - -6x - - -6x -4x -4x -2x -2x - -2x -2x - -4x - -4x - - -6x - - - - - - - - - - - -6x -6x - -6x - - -6x - - - -6x -6x - - - -6x - - - - - - - - - - - - - - - - - - - - - - -6x - - -6x - -6x - -6x - - - - - - - - - - - -26x -26x - - - - - -26x -26x - -26x -26x - - -26x - - - - - - - - - - -18x -18x - - -1x - -1x - - - - - - | import UPNG from './UPNG' - -const isBrowser = typeof window !== 'undefined' // change browser environment to support SSR - -// add support for cordova-plugin-file -const moduleMapper = isBrowser && window.cordova && window.cordova.require && window.cordova.require('cordova/modulemapper') -export const CustomFile = isBrowser && ((moduleMapper && moduleMapper.getOriginalSymbol(window, 'File')) || File) -export const CustomFileReader = isBrowser && ((moduleMapper && moduleMapper.getOriginalSymbol(window, 'FileReader')) || FileReader) - -// Check if browser supports automatic image orientation -// see https://github.com/blueimp/JavaScript-Load-Image/blob/1e4df707821a0afcc11ea0720ee403b8759f3881/js/load-image-orientation.js#L37-L53 -export async function isAutoOrientationInBrowser() { - if (isAutoOrientationInBrowser.result !== undefined) - return isAutoOrientationInBrowser.result - - // black 2x1 JPEG, with the following meta information set: - // EXIF Orientation: 6 (Rotated 90° CCW) - const testImageURL = - 'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' + - 'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' + - 'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' + - 'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/x' + - 'ABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAA' + - 'AAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==' - const testImageFile = await getFilefromDataUrl(testImageURL, 'test.jpg', Date.now()) - - const testImageCanvas = (await drawFileInCanvas(testImageFile))[1] - const testImageFile2 = await canvasToFile(testImageCanvas, testImageFile.type, testImageFile.name, testImageFile.lastModified) - cleanupCanvasMemory(testImageCanvas) - const img = (await drawFileInCanvas(testImageFile2))[0] - // console.log('img', img.width, img.height) - - isAutoOrientationInBrowser.result = img.width === 1 && img.height === 2 - return isAutoOrientationInBrowser.result -} - -/** - * getDataUrlFromFile - * - * @param {File | Blob} file - * @returns {Promise<string>} - */ -export function getDataUrlFromFile (file) { - return new Promise((resolve, reject) => { - const reader = new CustomFileReader() - reader.onload = () => resolve(reader.result) - reader.onerror = (e) => reject(e) - reader.readAsDataURL(file) - }) -} - -/** - * getFilefromDataUrl - * - * @param {string} dataUrl - * @param {string} filename - * @param {number} [lastModified=Date.now()] - * @returns {Promise<File | Blob>} - */ -export function getFilefromDataUrl (dataUrl, filename, lastModified = Date.now()) { - return new Promise((resolve) => { - const arr = dataUrl.split(',') - const mime = arr[0].match(/:(.*?);/)[1] - const bstr = globalThis.atob(arr[1]) - let n = bstr.length - const u8arr = new Uint8Array(n) - while (n--) { - u8arr[n] = bstr.charCodeAt(n) - } - const file = new Blob([u8arr], { type: mime }) - file.name = filename - file.lastModified = lastModified - resolve(file) - - // Safari has issue with File constructor not being able to POST in FormData - // https://github.com/Donaldcwl/browser-image-compression/issues/8 - // https://bugs.webkit.org/show_bug.cgi?id=165081 - // let file - // try { - // file = new File([u8arr], filename, { type: mime }) // Edge do not support File constructor - // } catch (e) { - // file = new Blob([u8arr], { type: mime }) - // file.name = filename - // file.lastModified = lastModified - // } - // resolve(file) - }) -} - -/** - * loadImage - * - * @param {string} src - * @returns {Promise<HTMLImageElement>} - */ -export function loadImage (src) { - return new Promise((resolve, reject) => { - const img = new Image() - img.onload = () => resolve(img) - img.onerror = (e) => reject(e) - img.src = src - }) -} - -/** - * drawImageInCanvas - * - * @param {HTMLImageElement} img - * @returns {HTMLCanvasElement | OffscreenCanvas} - */ -export function drawImageInCanvas (img) { - const [canvas, ctx] = getNewCanvasAndCtx(img.width, img.height) - ctx.drawImage(img, 0, 0, canvas.width, canvas.height) - return canvas -} - -/** - * drawFileInCanvas - * - * @param {File | Blob} file - * @returns {Promise<[ImageBitmap | HTMLImageElement, HTMLCanvasElement | OffscreenCanvas]>} - */ -export async function drawFileInCanvas (file) { - let img - try { - img = await createImageBitmap(file) - } catch (e) { - const dataUrl = await getDataUrlFromFile(file) - img = await loadImage(dataUrl) - } - const canvas = drawImageInCanvas(img) - return [img, canvas] -} - -/** - * canvasToFile - * - * @param {HTMLCanvasElement | OffscreenCanvas} canvas - * @param {string} fileType - * @param {string} fileName - * @param {number} fileLastModified - * @param {number} [quality] - * @returns {Promise<File | Blob>} - */ -export async function canvasToFile (canvas, fileType, fileName, fileLastModified, quality = 1) { - let file - if (fileType === 'image/png') { - const ctx = canvas.getContext('2d') - const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data - const png = UPNG.encode([data], canvas.width, canvas.height, 256 * quality) - file = new Blob([png], { type: fileType }) - file.name = fileName - file.lastModified = fileLastModified - } else Iif (typeof OffscreenCanvas === 'function' && canvas instanceof OffscreenCanvas) { // checked on Win Chrome 83, MacOS Chrome 83 - file = await canvas.convertToBlob({ type: fileType, quality }) - file.name = fileName - file.lastModified = fileLastModified - // some browser do not support quality parameter, see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob - // } else if (typeof canvas.toBlob === 'function') { - // file = await new Promise(resolve => canvas.toBlob(resolve, fileType, quality)) - } else { // checked on Win Edge 44, Win IE 11, Win Firefox 76, MacOS Firefox 77, MacOS Safari 13.1 - const dataUrl = canvas.toDataURL(fileType, quality) - file = await getFilefromDataUrl(dataUrl, fileName, fileLastModified) - } - return file -} - -/** - * getExifOrientation - * get image exif orientation info - * source: https://stackoverflow.com/a/32490603/10395024 - * - * @param {File | Blob} file - * @returns {Promise<number>} - orientation id, see https://i.stack.imgur.com/VGsAj.gif - */ -export function getExifOrientation (file) { - return new Promise((resolve, reject) => { - const reader = new CustomFileReader() - reader.onload = (e) => { - const view = new DataView(e.target.result) - Eif (view.getUint16(0, false) != 0xFFD8) { - return resolve(-2) - } - const length = view.byteLength - let offset = 2 - while (offset < length) { - if (view.getUint16(offset + 2, false) <= 8) return resolve(-1) - const marker = view.getUint16(offset, false) - offset += 2 - if (marker == 0xFFE1) { - if (view.getUint32(offset += 2, false) != 0x45786966) { - return resolve(-1) - } - - var little = view.getUint16(offset += 6, false) == 0x4949 - offset += view.getUint32(offset + 4, little) - var tags = view.getUint16(offset, little) - offset += 2 - for (var i = 0; i < tags; i++) { - if (view.getUint16(offset + (i * 12), little) == 0x0112) { - return resolve(view.getUint16(offset + (i * 12) + 8, little)) - } - } - } else if ((marker & 0xFF00) != 0xFF00) { - break - } else { - offset += view.getUint16(offset, false) - } - } - return resolve(-1) - } - reader.onerror = (e) => reject(e) - reader.readAsArrayBuffer(file) - }) -} - -/** - * - * @param {HTMLCanvasElement | OffscreenCanvas} canvas - * @param options - * @returns {HTMLCanvasElement | OffscreenCanvas} - */ -export function handleMaxWidthOrHeight (canvas, options) { - const width = canvas.width - const height = canvas.height - const maxWidthOrHeight = options.maxWidthOrHeight - - const needToHandle = isFinite(maxWidthOrHeight) && (width > maxWidthOrHeight || height > maxWidthOrHeight) - - let newCanvas = canvas - let ctx - - if (needToHandle) { - [newCanvas, ctx] = getNewCanvasAndCtx(width, height) - if (width > height) { - newCanvas.width = maxWidthOrHeight - newCanvas.height = (height / width) * maxWidthOrHeight - } else { - newCanvas.width = (width / height) * maxWidthOrHeight - newCanvas.height = maxWidthOrHeight - } - ctx.drawImage(canvas, 0, 0, newCanvas.width, newCanvas.height) - - cleanupCanvasMemory(canvas) - } - - return newCanvas -} - -/** - * followExifOrientation - * source: https://stackoverflow.com/a/40867559/10395024 - * - * @param {HTMLCanvasElement | OffscreenCanvas} canvas - * @param {number} exifOrientation - * @returns {HTMLCanvasElement | OffscreenCanvas} canvas - */ -export function followExifOrientation (canvas, exifOrientation) { - const width = canvas.width - const height = canvas.height - - const [newCanvas, ctx] = getNewCanvasAndCtx(width, height) - - // set proper canvas dimensions before transform & export - Iif (4 < exifOrientation && exifOrientation < 9) { - newCanvas.width = height - newCanvas.height = width - } else { - newCanvas.width = width - newCanvas.height = height - } - - // transform context before drawing image - switch (exifOrientation) { - case 2: - ctx.transform(-1, 0, 0, 1, width, 0) - break - case 3: - ctx.transform(-1, 0, 0, -1, width, height) - break - case 4: - ctx.transform(1, 0, 0, -1, 0, height) - break - case 5: - ctx.transform(0, 1, 1, 0, 0, 0) - break - case 6: - ctx.transform(0, 1, -1, 0, height, 0) - break - case 7: - ctx.transform(0, -1, -1, 0, height, width) - break - case 8: - ctx.transform(0, -1, 1, 0, 0, width) - break - default: - break - } - - ctx.drawImage(canvas, 0, 0, width, height) - - cleanupCanvasMemory(canvas) - - return newCanvas -} - -/** - * get new Canvas and it's context - * @param width - * @param height - * @returns {[HTMLCanvasElement | OffscreenCanvas, CanvasRenderingContext2D]} - */ -export function getNewCanvasAndCtx (width, height) { - let canvas - let ctx - try { - canvas = new OffscreenCanvas(width, height) - ctx = canvas.getContext('2d') - if (ctx === null) { - throw new Error('getContext of OffscreenCanvas returns null') - } - } catch (e) { - canvas = document.createElement('canvas') - ctx = canvas.getContext('2d') - } - canvas.width = width - canvas.height = height - // ctx.fillStyle = '#fff' - // ctx.fillRect(0, 0, width, height) - return [canvas, ctx] -} - -/** - * clear Canvas memory - * @param canvas - * @returns null - */ -export function cleanupCanvasMemory (canvas) { - // garbage clean canvas for safari - // ref: https://bugs.webkit.org/show_bug.cgi?id=195325 - canvas.width = 0 - canvas.height = 0 -} - -Eif (isBrowser) { -// Polyfill for Number.isInteger - Number.isInteger = Number.isInteger || function (value) { - return typeof value === 'number' && - isFinite(value) && - Math.floor(value) === value - } -} - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 | - - -1x - - - -1x - - -1x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | import imageCompression from './index' -import compress from './image-compression' - -let cnt = 0 -let imageCompressionLibUrl - -function createWorker (f) { - return new Worker(URL.createObjectURL(new Blob([`(${f})()`]))) -} - -const worker = createWorker(() => { - self.addEventListener('message', async (e) => { - const { file, id, imageCompressionLibUrl, options } = e.data - try { - // console.log('[worker] importScripts', imageCompressionLibUrl) - importScripts(imageCompressionLibUrl) - // console.log('[worker] self', self) - const compressedFile = await imageCompression(file, options) - self.postMessage({ file: compressedFile, id }) - } catch (e) { - // console.error('[worker] error', e) - self.postMessage({ error: e.message, id }) - } - }) -}) - -function createSourceObject (str) { - return URL.createObjectURL(new Blob([str], { type: 'application/javascript' })) -} - -export function compressOnWebWorker (file, options) { - return new Promise(async (resolve, reject) => { - if (!imageCompressionLibUrl) { - imageCompressionLibUrl = createSourceObject(` - function imageCompression (){return (${imageCompression}).apply(null, arguments)} - - imageCompression.getDataUrlFromFile = ${imageCompression.getDataUrlFromFile} - imageCompression.getFilefromDataUrl = ${imageCompression.getFilefromDataUrl} - imageCompression.loadImage = ${imageCompression.loadImage} - imageCompression.drawImageInCanvas = ${imageCompression.drawImageInCanvas} - imageCompression.drawFileInCanvas = ${imageCompression.drawFileInCanvas} - imageCompression.canvasToFile = ${imageCompression.canvasToFile} - imageCompression.getExifOrientation = ${imageCompression.getExifOrientation} - imageCompression.handleMaxWidthOrHeight = ${imageCompression.handleMaxWidthOrHeight} - imageCompression.followExifOrientation = ${imageCompression.followExifOrientation} - - getDataUrlFromFile = imageCompression.getDataUrlFromFile - getFilefromDataUrl = imageCompression.getFilefromDataUrl - loadImage = imageCompression.loadImage - drawImageInCanvas = imageCompression.drawImageInCanvas - drawFileInCanvas = imageCompression.drawFileInCanvas - canvasToFile = imageCompression.canvasToFile - getExifOrientation = imageCompression.getExifOrientation - handleMaxWidthOrHeight = imageCompression.handleMaxWidthOrHeight - followExifOrientation = imageCompression.followExifOrientation - - function compress (){return (${compress}).apply(null, arguments)} - `) - // imageCompressionLibUrl = new URL('../dist/browser-image-compression.js', window.location.href).href - } - let id = cnt++ - - function handler (e) { - if (e.data.id === id) { - worker.removeEventListener('message', handler) - if (e.data.error) { - reject(e.data.error) - } - resolve(e.data.file) - } - } - - worker.addEventListener('message', handler) - worker.postMessage({ file, id, imageCompressionLibUrl, options }) - }) -} |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 | - -1x - - -1x -1x -1x - - - - -6x -5x - - - - -1x - - - - - -1x - -1x -1x -1x -1x - - -1x -1x - - - - - - - - - -15x -15x -15x -15x -15x - - - - - - - - - - - - -9x -9x -9x -9x -9x -9x -9x -11249118x - -9x -9x -9x -9x - - - - - - - - - - - - - - - - - - - - - - - -15x -15x -15x -15x -15x - - - - - - - - - - -14x -14x -14x - - - - - - - - - - -13x -13x - -13x -13x - -13x -13x - - - - - - - - - - - - - - -9x -3x -3x -3x -3x -3x -3x -6x - - - - - - - -6x -6x - -9x - - - - - - - - - - - -1x -1x -1x -1x -1x -1x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -1x -1x - - - - - - - - - - -6x -6x -6x - -6x - -6x - - -6x -4x -4x -2x -2x - -2x -2x - -4x - -4x - - -6x - - - - - - - - - - - -6x -6x - -6x - - -6x - - - -6x -6x - - - -6x - - - - - - - - - - - - - - - - - - - - - - -6x - - -6x - -6x - -6x - - - - - - - - - - - -26x -26x - - - - - -26x -26x - -26x -26x - - -26x - - - - - - - - - - -18x -18x - - -1x - -1x - - - - - - | import UPNG from './UPNG' - -const isBrowser = typeof window !== 'undefined' // change browser environment to support SSR - -// add support for cordova-plugin-file -const moduleMapper = isBrowser && window.cordova && window.cordova.require && window.cordova.require('cordova/modulemapper') -export const CustomFile = isBrowser && ((moduleMapper && moduleMapper.getOriginalSymbol(window, 'File')) || File) -export const CustomFileReader = isBrowser && ((moduleMapper && moduleMapper.getOriginalSymbol(window, 'FileReader')) || FileReader) - -// Check if browser supports automatic image orientation -// see https://github.com/blueimp/JavaScript-Load-Image/blob/1e4df707821a0afcc11ea0720ee403b8759f3881/js/load-image-orientation.js#L37-L53 -export async function isAutoOrientationInBrowser() { - if (isAutoOrientationInBrowser.result !== undefined) - return isAutoOrientationInBrowser.result - - // black 2x1 JPEG, with the following meta information set: - // EXIF Orientation: 6 (Rotated 90° CCW) - const testImageURL = - 'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' + - 'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' + - 'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' + - 'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/x' + - 'ABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAA' + - 'AAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==' - const testImageFile = await getFilefromDataUrl(testImageURL, 'test.jpg', Date.now()) - - const testImageCanvas = (await drawFileInCanvas(testImageFile))[1] - const testImageFile2 = await canvasToFile(testImageCanvas, testImageFile.type, testImageFile.name, testImageFile.lastModified) - cleanupCanvasMemory(testImageCanvas) - const img = (await drawFileInCanvas(testImageFile2))[0] - // console.log('img', img.width, img.height) - - isAutoOrientationInBrowser.result = img.width === 1 && img.height === 2 - return isAutoOrientationInBrowser.result -} - -/** - * getDataUrlFromFile - * - * @param {File | Blob} file - * @returns {Promise<string>} - */ -export function getDataUrlFromFile (file) { - return new Promise((resolve, reject) => { - const reader = new CustomFileReader() - reader.onload = () => resolve(reader.result) - reader.onerror = (e) => reject(e) - reader.readAsDataURL(file) - }) -} - -/** - * getFilefromDataUrl - * - * @param {string} dataUrl - * @param {string} filename - * @param {number} [lastModified=Date.now()] - * @returns {Promise<File | Blob>} - */ -export function getFilefromDataUrl (dataUrl, filename, lastModified = Date.now()) { - return new Promise((resolve) => { - const arr = dataUrl.split(',') - const mime = arr[0].match(/:(.*?);/)[1] - const bstr = globalThis.atob(arr[1]) - let n = bstr.length - const u8arr = new Uint8Array(n) - while (n--) { - u8arr[n] = bstr.charCodeAt(n) - } - const file = new Blob([u8arr], { type: mime }) - file.name = filename - file.lastModified = lastModified - resolve(file) - - // Safari has issue with File constructor not being able to POST in FormData - // https://github.com/Donaldcwl/browser-image-compression/issues/8 - // https://bugs.webkit.org/show_bug.cgi?id=165081 - // let file - // try { - // file = new File([u8arr], filename, { type: mime }) // Edge do not support File constructor - // } catch (e) { - // file = new Blob([u8arr], { type: mime }) - // file.name = filename - // file.lastModified = lastModified - // } - // resolve(file) - }) -} - -/** - * loadImage - * - * @param {string} src - * @returns {Promise<HTMLImageElement>} - */ -export function loadImage (src) { - return new Promise((resolve, reject) => { - const img = new Image() - img.onload = () => resolve(img) - img.onerror = (e) => reject(e) - img.src = src - }) -} - -/** - * drawImageInCanvas - * - * @param {HTMLImageElement} img - * @returns {HTMLCanvasElement | OffscreenCanvas} - */ -export function drawImageInCanvas (img) { - const [canvas, ctx] = getNewCanvasAndCtx(img.width, img.height) - ctx.drawImage(img, 0, 0, canvas.width, canvas.height) - return canvas -} - -/** - * drawFileInCanvas - * - * @param {File | Blob} file - * @returns {Promise<[ImageBitmap | HTMLImageElement, HTMLCanvasElement | OffscreenCanvas]>} - */ -export async function drawFileInCanvas (file) { - let img - try { - img = await createImageBitmap(file) - } catch (e) { - const dataUrl = await getDataUrlFromFile(file) - img = await loadImage(dataUrl) - } - const canvas = drawImageInCanvas(img) - return [img, canvas] -} - -/** - * canvasToFile - * - * @param {HTMLCanvasElement | OffscreenCanvas} canvas - * @param {string} fileType - * @param {string} fileName - * @param {number} fileLastModified - * @param {number} [quality] - * @returns {Promise<File | Blob>} - */ -export async function canvasToFile (canvas, fileType, fileName, fileLastModified, quality = 1) { - let file - if (fileType === 'image/png') { - const ctx = canvas.getContext('2d') - const data = ctx.getImageData(0, 0, canvas.width, canvas.height).data - const png = UPNG.encode([data], canvas.width, canvas.height, 256 * quality) - file = new Blob([png], { type: fileType }) - file.name = fileName - file.lastModified = fileLastModified - } else Iif (typeof OffscreenCanvas === 'function' && canvas instanceof OffscreenCanvas) { // checked on Win Chrome 83, MacOS Chrome 83 - file = await canvas.convertToBlob({ type: fileType, quality }) - file.name = fileName - file.lastModified = fileLastModified - // some browser do not support quality parameter, see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob - // } else if (typeof canvas.toBlob === 'function') { - // file = await new Promise(resolve => canvas.toBlob(resolve, fileType, quality)) - } else { // checked on Win Edge 44, Win IE 11, Win Firefox 76, MacOS Firefox 77, MacOS Safari 13.1 - const dataUrl = canvas.toDataURL(fileType, quality) - file = await getFilefromDataUrl(dataUrl, fileName, fileLastModified) - } - return file -} - -/** - * getExifOrientation - * get image exif orientation info - * source: https://stackoverflow.com/a/32490603/10395024 - * - * @param {File | Blob} file - * @returns {Promise<number>} - orientation id, see https://i.stack.imgur.com/VGsAj.gif - */ -export function getExifOrientation (file) { - return new Promise((resolve, reject) => { - const reader = new CustomFileReader() - reader.onload = (e) => { - const view = new DataView(e.target.result) - Eif (view.getUint16(0, false) != 0xFFD8) { - return resolve(-2) - } - const length = view.byteLength - let offset = 2 - while (offset < length) { - if (view.getUint16(offset + 2, false) <= 8) return resolve(-1) - const marker = view.getUint16(offset, false) - offset += 2 - if (marker == 0xFFE1) { - if (view.getUint32(offset += 2, false) != 0x45786966) { - return resolve(-1) - } - - var little = view.getUint16(offset += 6, false) == 0x4949 - offset += view.getUint32(offset + 4, little) - var tags = view.getUint16(offset, little) - offset += 2 - for (var i = 0; i < tags; i++) { - if (view.getUint16(offset + (i * 12), little) == 0x0112) { - return resolve(view.getUint16(offset + (i * 12) + 8, little)) - } - } - } else if ((marker & 0xFF00) != 0xFF00) { - break - } else { - offset += view.getUint16(offset, false) - } - } - return resolve(-1) - } - reader.onerror = (e) => reject(e) - reader.readAsArrayBuffer(file) - }) -} - -/** - * - * @param {HTMLCanvasElement | OffscreenCanvas} canvas - * @param options - * @returns {HTMLCanvasElement | OffscreenCanvas} - */ -export function handleMaxWidthOrHeight (canvas, options) { - const width = canvas.width - const height = canvas.height - const maxWidthOrHeight = options.maxWidthOrHeight - - const needToHandle = isFinite(maxWidthOrHeight) && (width > maxWidthOrHeight || height > maxWidthOrHeight) - - let newCanvas = canvas - let ctx - - if (needToHandle) { - [newCanvas, ctx] = getNewCanvasAndCtx(width, height) - if (width > height) { - newCanvas.width = maxWidthOrHeight - newCanvas.height = (height / width) * maxWidthOrHeight - } else { - newCanvas.width = (width / height) * maxWidthOrHeight - newCanvas.height = maxWidthOrHeight - } - ctx.drawImage(canvas, 0, 0, newCanvas.width, newCanvas.height) - - cleanupCanvasMemory(canvas) - } - - return newCanvas -} - -/** - * followExifOrientation - * source: https://stackoverflow.com/a/40867559/10395024 - * - * @param {HTMLCanvasElement | OffscreenCanvas} canvas - * @param {number} exifOrientation - * @returns {HTMLCanvasElement | OffscreenCanvas} canvas - */ -export function followExifOrientation (canvas, exifOrientation) { - const width = canvas.width - const height = canvas.height - - const [newCanvas, ctx] = getNewCanvasAndCtx(width, height) - - // set proper canvas dimensions before transform & export - Iif (4 < exifOrientation && exifOrientation < 9) { - newCanvas.width = height - newCanvas.height = width - } else { - newCanvas.width = width - newCanvas.height = height - } - - // transform context before drawing image - switch (exifOrientation) { - case 2: - ctx.transform(-1, 0, 0, 1, width, 0) - break - case 3: - ctx.transform(-1, 0, 0, -1, width, height) - break - case 4: - ctx.transform(1, 0, 0, -1, 0, height) - break - case 5: - ctx.transform(0, 1, 1, 0, 0, 0) - break - case 6: - ctx.transform(0, 1, -1, 0, height, 0) - break - case 7: - ctx.transform(0, -1, -1, 0, height, width) - break - case 8: - ctx.transform(0, -1, 1, 0, 0, width) - break - default: - break - } - - ctx.drawImage(canvas, 0, 0, width, height) - - cleanupCanvasMemory(canvas) - - return newCanvas -} - -/** - * get new Canvas and it's context - * @param width - * @param height - * @returns {[HTMLCanvasElement | OffscreenCanvas, CanvasRenderingContext2D]} - */ -export function getNewCanvasAndCtx (width, height) { - let canvas - let ctx - try { - canvas = new OffscreenCanvas(width, height) - ctx = canvas.getContext('2d') - if (ctx === null) { - throw new Error('getContext of OffscreenCanvas returns null') - } - } catch (e) { - canvas = document.createElement('canvas') - ctx = canvas.getContext('2d') - } - canvas.width = width - canvas.height = height - // ctx.fillStyle = '#fff' - // ctx.fillRect(0, 0, width, height) - return [canvas, ctx] -} - -/** - * clear Canvas memory - * @param canvas - * @returns null - */ -export function cleanupCanvasMemory (canvas) { - // garbage clean canvas for safari - // ref: https://bugs.webkit.org/show_bug.cgi?id=195325 - canvas.width = 0 - canvas.height = 0 -} - -Eif (isBrowser) { -// Polyfill for Number.isInteger - Number.isInteger = Number.isInteger || function (value) { - return typeof value === 'number' && - isFinite(value) && - Math.floor(value) === value - } -} - |
- Press n or j to go to the next uncovered block, b, p or k for the previous block. -
-1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 | - - -1x - - - -1x - - -1x - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | import imageCompression from './index' -import compress from './image-compression' - -let cnt = 0 -let imageCompressionLibUrl - -function createWorker (f) { - return new Worker(URL.createObjectURL(new Blob([`(${f})()`]))) -} - -const worker = createWorker(() => { - self.addEventListener('message', async (e) => { - const { file, id, imageCompressionLibUrl, options } = e.data - try { - // console.log('[worker] importScripts', imageCompressionLibUrl) - importScripts(imageCompressionLibUrl) - // console.log('[worker] self', self) - const compressedFile = await imageCompression(file, options) - self.postMessage({ file: compressedFile, id }) - } catch (e) { - // console.error('[worker] error', e) - self.postMessage({ error: e.message, id }) - } - }) -}) - -function createSourceObject (str) { - return URL.createObjectURL(new Blob([str], { type: 'application/javascript' })) -} - -export function compressOnWebWorker (file, options) { - return new Promise(async (resolve, reject) => { - if (!imageCompressionLibUrl) { - imageCompressionLibUrl = createSourceObject(` - function imageCompression (){return (${imageCompression}).apply(null, arguments)} - - imageCompression.getDataUrlFromFile = ${imageCompression.getDataUrlFromFile} - imageCompression.getFilefromDataUrl = ${imageCompression.getFilefromDataUrl} - imageCompression.loadImage = ${imageCompression.loadImage} - imageCompression.drawImageInCanvas = ${imageCompression.drawImageInCanvas} - imageCompression.drawFileInCanvas = ${imageCompression.drawFileInCanvas} - imageCompression.canvasToFile = ${imageCompression.canvasToFile} - imageCompression.getExifOrientation = ${imageCompression.getExifOrientation} - imageCompression.handleMaxWidthOrHeight = ${imageCompression.handleMaxWidthOrHeight} - imageCompression.followExifOrientation = ${imageCompression.followExifOrientation} - - getDataUrlFromFile = imageCompression.getDataUrlFromFile - getFilefromDataUrl = imageCompression.getFilefromDataUrl - loadImage = imageCompression.loadImage - drawImageInCanvas = imageCompression.drawImageInCanvas - drawFileInCanvas = imageCompression.drawFileInCanvas - canvasToFile = imageCompression.canvasToFile - getExifOrientation = imageCompression.getExifOrientation - handleMaxWidthOrHeight = imageCompression.handleMaxWidthOrHeight - followExifOrientation = imageCompression.followExifOrientation - - function compress (){return (${compress}).apply(null, arguments)} - `) - // imageCompressionLibUrl = new URL('../dist/browser-image-compression.js', window.location.href).href - } - let id = cnt++ - - function handler (e) { - if (e.data.id === id) { - worker.removeEventListener('message', handler) - if (e.data.error) { - reject(e.data.error) - } - resolve(e.data.file) - } - } - - worker.addEventListener('message', handler) - worker.postMessage({ file, id, imageCompressionLibUrl, options }) - }) -} |
>16,O=T>>8&255,V=255&T;b(s,l=UZIP.F._writeLit(257+O,C,s,l),R-w.of0[O]),l+=w.exb[O],P(s,l=UZIP.F._writeLit(V,E,s,l),D-w.df0[V]),l+=w.dxb[V],Z+=R}}l=UZIP.F._writeLit(256,C,s,l)}return l},UZIP.F._copyExact=function(e,r,t,a,i){var f=i>>>3;return a[f]=t,a[f+1]=t>>>8,a[f+2]=255-a[f],a[f+3]=255-a[f+1],f+=4,a.set(new Uint8Array(e.buffer,r,t),f),i+(t+4<<3)},UZIP.F.getTrees=function(){for(var e=UZIP.F.U,r=UZIP.F._hufTree(e.lhst,e.ltree,15),t=UZIP.F._hufTree(e.dhst,e.dtree,15),a=[],i=UZIP.F._lenCodes(e.ltree,a),f=[],c=UZIP.F._lenCodes(e.dtree,f),s=0;s4&&0==e.itree[1+(e.ordr[u-1]<<1)];)u--;return[r,t,l,i,c,u,a,f]},UZIP.F.getSecond=function(e){for(var r=[],t=0;t >1)+",");return r},UZIP.F.contSize=function(e,r){for(var t=0,a=0;a 15&&(UZIP.F._putsE(t,a,c,s),a+=s)}return a},UZIP.F._lenCodes=function(e,r){for(var t=e.length;2!=t&&0==e[t-1];)t-=2;for(var a=0;a >>1,138))<11?r.push(17,u-3):r.push(18,u-11),a+=2*u-2}else if(i==s&&f==i&&c==i){for(l=a+5;l+2 >>1,6);r.push(16,u-3),a+=2*u-2}else r.push(i,0)}return t>>>1},UZIP.F._hufTree=function(e,r,t){var a=[],i=e.length,f=r.length,c=0;for(c=0;c t&&(UZIP.F.restrictDepth(l,t,U),U=t),c=0;c r;a++){var c=e[a].d;e[a].d=r,f+=i-(1<>>=t-r;f>0;){(c=e[a].d) =0;a--)e[a].d==r&&f<0&&(e[a].d--,f++);0!=f&&console.log("debt left")},UZIP.F._goodIndex=function(e,r){var t=0;return r[16|t]<=e&&(t|=16),r[8|t]<=e&&(t|=8),r[4|t]<=e&&(t|=4),r[2|t]<=e&&(t|=2),r[1|t]<=e&&(t|=1),t},UZIP.F._writeLit=function(e,r,t,a){return UZIP.F._putsF(t,a,r[e<<1]),a+r[1+(e<<1)]},UZIP.F.inflate=function(e,r){var t=Uint8Array;if(3==e[0]&&0==e[1])return r||new t(0);var a=UZIP.F,i=a._bitsF,f=a._bitsE,c=a._decodeTiny,s=a.makeCodes,l=a.codes2map,u=a._get17,d=a.U,h=null==r;h&&(r=new t(e.length>>>2<<3));for(var A,v,p=0,U=0,g=0,m=0,w=0,P=0,b=0,_=0,y=0;0==p;)if(p=i(e,y,1),U=i(e,y+1,2),y+=3,0!=U){if(h&&(r=UZIP.F._check(r,_+(1<<17))),1==U&&(A=d.flmap,v=d.fdmap,P=511,b=31),2==U){g=f(e,y,5)+257,m=f(e,y+5,5)+1,w=f(e,y+10,4)+4,y+=14;for(var I=0;I<38;I+=2)d.itree[I]=0,d.itree[I+1]=0;var F=1;for(I=0;I F&&(F=G)}y+=3*w,s(d.itree,F),l(d.itree,F,d.imap),A=d.lmap,v=d.dmap,y=c(d.imap,(1< >>4;if(Z>>>8==0)r[_++]=Z;else{if(256==Z)break;var x=_+Z-254;if(Z>264){var M=d.ldef[Z-257];x=_+(M>>>3)+f(e,y,7&M),y+=7&M}var R=v[u(e,y)&b];y+=15&R;var Q=R>>>4,T=d.ddef[Q],D=(T>>>4)+i(e,y,15&T);for(y+=15&T,h&&(r=UZIP.F._check(r,_+(1<<17)));_ >>3),V=e[O-4]|e[O-3]<<8;h&&(r=UZIP.F._check(r,_+V)),r.set(new t(e.buffer,e.byteOffset+O,V),_),y=O+V<<3,_+=V}return r.length==_?r:r.slice(0,_)},UZIP.F._check=function(e,r){var t=e.length;if(r<=t)return e;var a=new Uint8Array(Math.max(t<<1,r));return a.set(e,0),a},UZIP.F._decodeTiny=function(e,r,t,a,i,f){for(var c=UZIP.F._bitsE,s=UZIP.F._get17,l=0;l >>4;if(d<=15)f[l]=d,l++;else{var h=0,A=0;16==d?(A=3+c(a,i,2),i+=2,h=f[l-1]):17==d?(A=3+c(a,i,3),i+=3):18==d&&(A=11+c(a,i,7),i+=7);for(var v=l+A;l >>1;f i&&(i=s),f++}for(;f >1,s=e[f+1],l=c<<4|s,u=r-s,d=e[f]<>>15-r]=l,d++}},UZIP.F.revCodes=function(e,r){for(var t=UZIP.F.U.rev15,a=15-r,i=0;i >>a}},UZIP.F._putsE=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8},UZIP.F._putsF=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8,e[a+2]|=t>>>16},UZIP.F._bitsE=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},UZIP.F._get25=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},UZIP.F.U=(r=Uint16Array,t=Uint32Array,{next_code:new r(16),bl_count:new r(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new r(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new r(512),fltree:[],fdmap:new r(32),fdtree:[],lmap:new r(32768),ltree:[],ttree:[],dmap:new r(32768),dtree:[],imap:new r(512),itree:[],rev15:new r(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new r(65536),prev:new r(32768)}),function(){for(var e=UZIP.F.U,r=0;r<32768;r++){var t=r;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,e.rev15[r]=(t>>>16|t<<16)>>>17}function pushV(e,r,t){for(;0!=r--;)e.push(0,t)}for(r=0;r<32;r++)e.ldef[r]=e.of0[r]<<3|e.exb[r],e.ddef[r]=e.df0[r]<<4|e.dxb[r];pushV(e.fltree,144,8),pushV(e.fltree,112,9),pushV(e.fltree,24,7),pushV(e.fltree,8,8),UZIP.F.makeCodes(e.fltree,9),UZIP.F.codes2map(e.fltree,9,e.flmap),UZIP.F.revCodes(e.fltree,9),pushV(e.fdtree,32,5),UZIP.F.makeCodes(e.fdtree,5),UZIP.F.codes2map(e.fdtree,5,e.fdmap),UZIP.F.revCodes(e.fdtree,5),pushV(e.itree,19,0),pushV(e.ltree,286,0),pushV(e.dtree,30,0),pushV(e.ttree,320,0)}()})),UZIP=Object.freeze(Object.assign(Object.create(null),UZIP_1,{default:UZIP_1})),UPNG={},N,W,H;UPNG.toRGBA8=function(e){var r=e.width,t=e.height;if(null==e.tabs.acTL)return[UPNG.toRGBA8.decodeImage(e.data,r,t,e).buffer];var a=[];null==e.frames[0].data&&(e.frames[0].data=e.data);for(var i=r*t*4,f=new Uint8Array(i),c=new Uint8Array(i),s=new Uint8Array(i),l=0;l >3)]>>7-((7&v)<<0)&1);s[P]=b[C],s[P+1]=b[C+1],s[P+2]=b[C+2],s[P+3]=E >2)]>>6-((3&v)<<1)&3);s[P]=b[C],s[P+1]=b[C+1],s[P+2]=b[C+2],s[P+3]=E >1)]>>4-((1&v)<<2)&15);s[P]=b[C],s[P+1]=b[C+1],s[P+2]=b[C+2],s[P+3]=E >>3)]>>>7-(7&R)&1))==255*g?0:255;l[M+R]=Q<<24|B<<16|B<<8|B}else if(2==d)for(R=0;R >>2)]>>>6-((3&R)<<1)&3))==85*g?0:255;l[M+R]=Q<<24|B<<16|B<<8|B}else if(4==d)for(R=0;R >>1)]>>>4-((1&R)<<2)&15))==17*g?0:255;l[M+R]=Q<<24|B<<16|B<<8|B}else if(8==d)for(R=0;R >>2<<5));0==f;)if(f=U(e,v,1),c=U(e,v+1,2),v+=3,0!=c){if(y&&(r=H.H.W(r,A+(1<<17))),1==c&&(t=_.J,a=_.h,d=511,h=31),2==c){s=g(e,v,5)+257,l=g(e,v+5,5)+1,u=g(e,v+10,4)+4,v+=14;for(var I=1,F=0;F<38;F+=2)_.Q[F]=0,_.Q[F+1]=0;for(F=0;FI&&(I=G)}v+=3*u,w(_.Q,I),P(_.Q,I,_.u),t=_.w,a=_.d,v=m(_.u,(1<>>4;if(Z>>>8==0)r[A++]=Z;else{if(256==Z)break;var x=A+Z-254;if(Z>264){var M=_.q[Z-257];x=A+(M>>>3)+g(e,v,7&M),v+=7&M}var R=a[b(e,v)&h];v+=15&R;var Q=R>>>4,T=_.c[Q],D=(T>>>4)+U(e,v,15&T);for(v+=15&T;A >>3),V=e[O-4]|e[O-3]<<8;y&&(r=H.H.W(r,A+V)),r.set(new i(e.buffer,e.byteOffset+O,V),A),v=O+V<<3,A+=V}return r.length==A?r:r.slice(0,A)},H.H.W=function(e,r){var t=e.length;if(r<=t)return e;var a=new Uint8Array(t<<1);return a.set(e,0),a},H.H.R=function(e,r,t,a,i,f){for(var c=H.H.e,s=H.H.Z,l=0;l >>4;if(d<=15)f[l]=d,l++;else{var h=0,A=0;16==d?(A=3+c(a,i,2),i+=2,h=f[l-1]):17==d?(A=3+c(a,i,3),i+=3):18==d&&(A=11+c(a,i,7),i+=7);for(var v=l+A;l >>1;f i&&(i=s),f++}for(;f >1,s=e[f+1],l=c<<4|s,u=r-s,d=e[f]<>>15-r]=l,d++},H.H.l=function(e,r){for(var t=H.H.m.r,a=15-r,i=0;i >>a}},H.H.M=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8},H.H.I=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8,e[a+2]|=t>>>16},H.H.e=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},H.H.i=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},H.H.m=(N=Uint16Array,W=Uint32Array,{K:new N(16),j:new N(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new N(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new W(32),J:new N(512),_:[],h:new N(32),$:[],w:new N(32768),C:[],v:[],d:new N(32768),D:[],u:new N(512),Q:[],r:new N(32768),s:new W(286),Y:new W(30),a:new W(19),t:new W(15e3),k:new N(65536),g:new N(32768)}),function(){for(var e=H.H.m,r=0;r<32768;r++){var t=r;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,e.r[r]=(t>>>16|t<<16)>>>17}function n(e,r,t){for(;0!=r--;)e.push(0,t)}for(r=0;r<32;r++)e.q[r]=e.S[r]<<3|e.T[r],e.c[r]=e.p[r]<<4|e.z[r];n(e._,144,8),n(e._,112,9),n(e._,24,7),n(e._,8,8),H.H.n(e._,9),H.H.A(e._,9,e.J),H.H.l(e._,9),n(e.$,32,5),H.H.n(e.$,5),H.H.A(e.$,5,e.h),H.H.l(e.$,5),n(e.Q,19,0),n(e.C,286,0),n(e.D,30,0),n(e.v,320,0)}(),H.H.N),UPNG.decode._readInterlace=function(e,r){for(var t=r.width,a=r.height,i=UPNG.decode._getBPP(r),f=i>>3,c=Math.ceil(t*i/8),s=new Uint8Array(a*c),l=0,u=[0,0,4,0,2,0,1],d=[0,4,0,2,0,1,0],h=[8,8,8,4,4,2,2],A=[8,8,4,4,2,2,1],v=0;v<7;){for(var p=h[v],U=A[v],g=0,m=0,w=u[v];w>3])>>7-(7&F)&1,s[y*c+(I>>3)]|=G<<7-((7&I)<<0);if(2==i)G=(G=e[F>>3])>>6-(7&F)&3,s[y*c+(I>>2)]|=G<<6-((3&I)<<1);if(4==i)G=(G=e[F>>3])>>4-(7&F)&15,s[y*c+(I>>1)]|=G<<4-((1&I)<<2);if(i>=8)for(var C=y*c+I*f,E=0;E >3)+E];F+=i,I+=U}_++,y+=p}g*m!=0&&(l+=m*(1+b)),v+=1}return s},UPNG.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},UPNG.decode._filterZero=function(e,r,t,a,i){var f=UPNG.decode._getBPP(r),c=Math.ceil(a*f/8),s=UPNG.decode._paeth;f=Math.ceil(f/8);var l=0,u=1,d=e[t],h=0;if(d>1&&(e[t]=[0,0,1][d-2]),3==d)for(h=f;h >>1)&255;for(var A=0;A>>1);for(;h >>1)}else{for(;h >8&255,e[r+1]=255&t},readUint:function readUint(e,r){return 16777216*e[r]+(e[r+1]<<16|e[r+2]<<8|e[r+3])},writeUint:function writeUint(e,r,t){e[r]=t>>24&255,e[r+1]=t>>16&255,e[r+2]=t>>8&255,e[r+3]=255&t},readASCII:function readASCII(e,r,t){for(var a="",i=0;i =0&&s>=0?(h=v*r+p<<2,A=(s+v)*i+c+p<<2):(h=(-s+v)*r-c+p<<2,A=v*i+p<<2),0==l)a[A]=e[h],a[A+1]=e[h+1],a[A+2]=e[h+2],a[A+3]=e[h+3];else if(1==l){var U=e[h+3]*(1/255),g=e[h]*U,m=e[h+1]*U,w=e[h+2]*U,P=a[A+3]*(1/255),b=a[A]*P,_=a[A+1]*P,y=a[A+2]*P,I=1-U,F=U+P*I,G=0==F?0:1/F;a[A+3]=255*F,a[A+0]=(g+b*I)*G,a[A+1]=(m+_*I)*G,a[A+2]=(w+y*I)*G}else if(2==l){U=e[h+3],g=e[h],m=e[h+1],w=e[h+2],P=a[A+3],b=a[A],_=a[A+1],y=a[A+2];U==P&&g==b&&m==_&&w==y?(a[A]=0,a[A+1]=0,a[A+2]=0,a[A+3]=0):(a[A]=g,a[A+1]=m,a[A+2]=w,a[A+3]=U)}else if(3==l){U=e[h+3],g=e[h],m=e[h+1],w=e[h+2],P=a[A+3],b=a[A],_=a[A+1],y=a[A+2];if(U==P&&g==b&&m==_&&w==y)continue;if(U<220&&P>20)return!1}return!0},UPNG.encode=function(e,r,t,a,i,f,c){null==a&&(a=0),null==c&&(c=!1);var s=UPNG.encode.compress(e,r,t,a,[!1,!1,!1,0,c]);return UPNG.encode.compressPNG(s,-1),UPNG.encode._main(s,r,t,i,f)},UPNG.encodeLL=function(e,r,t,a,i,f,c,s){for(var l={ctype:0+(1==a?0:2)+(0==i?0:4),depth:f,frames:[]},u=(a+i)*f,d=u*r,h=0;h 1,h=!1,A=33+(d?20:0);if(null!=i.sRGB&&(A+=13),null!=i.pHYs&&(A+=21),3==e.ctype){for(var v=e.plte.length,p=0;p >>24!=255&&(h=!0);A+=8+3*v+4+(h?8+1*v+4:0)}for(var U=0;U >>8&255,y=P>>>16&255;g[u+w+0]=b,g[u+w+1]=_,g[u+w+2]=y}if(c(g,u+=3*v,f(g,u-3*v-4,3*v+4)),u+=4,h){c(g,u,v),l(g,u+=4,"tRNS"),u+=4;for(p=0;p >>24&255;c(g,u+=v,f(g,u-v-4,v+4)),u+=4}}var I=0;for(U=0;U >2,E>>2));for(v=0;v x&&R==Z[g-x])M[g]=M[g-x];else{var Q=P[R];if(null==Q&&(P[R]=Q=b.length,b.push(R),b.length>=300))break;M[g]=Q}}}var T=b.length;T<=256&&0==u&&(h=T<=2?1:T<=4?2:T<=16?4:8,h=Math.max(h,l));for(v=0;v >1)]|=L[q+j]<<4-4*(1&j);else if(2==h)for(j=0;j >2)]|=L[q+j]<<6-2*(3&j);else if(1==h)for(j=0;j >3)]|=L[q+j]<<7-1*(7&j)}O=k,d=3,z=1}else if(0==m&&1==w.length){k=new Uint8Array(x*D*3);var $=x*D;for(g=0;g<$;g++){var K,J=4*g;k[K=3*g]=O[J],k[K+1]=O[J+1],k[K+2]=O[J+2]}O=k,d=2,z=3,V=3*x}B.img=O,B.bpl=V,B.bpp=z}return{ctype:d,depth:h,plte:b,frames:w}},UPNG.encode.framize=function(e,r,t,a,i,f){for(var c=[],s=0;s F&&(F=E),CG&&(G=C))}-1==F&&(y=I=F=G=0),i&&(1==(1&y)&&y--,1==(1&I)&&I--);var B=(F-y+1)*(G-I+1);B g&&(g=b),_m&&(m=_))}-1==g&&(p=U=g=m=0),c&&(1==(1&p)&&p--,1==(1&U)&&U--),f={x:p,y:U,width:g-p+1,height:m-U+1};var F=a[i];F.rect=f,F.blend=1,F.img=new Uint8Array(f.width*f.height*4),0==a[i-1].dispose?(UPNG._copyTile(u,r,t,F.img,f.width,f.height,-f.x,-f.y,0),UPNG.encode._prepareDiff(A,r,t,F.img,f)):UPNG._copyTile(A,r,t,F.img,f.width,f.height,-f.x,-f.y,0)},UPNG.encode._prepareDiff=function(e,r,t,a,i){UPNG._copyTile(e,r,t,a,i.width,i.height,-i.x,-i.y,2)},UPNG.encode._filterZero=function(e,r,t,a,i,f,c){var s,l=[],u=[0,1,2,3,4];-1!=f?u=[f]:(r*a>5e5||1==t)&&(u=[0]),c&&(s={level:0});for(var d=UZIP,h=0;h >1)+256&255;if(4==f)for(u=i;u>1)&255;for(u=i;u>1)&255}if(4==f){for(u=0;u>>1:t>>>=1;e[r]=t}return e}(),update:function update(e,r,t,a){for(var i=0;i>>8;return e},crc:function crc(e,r,t){return 4294967295^UPNG.crc.update(4294967295,e,r,t)}},UPNG.quantize=function(e,r){var t,a=new Uint8Array(e),i=a.slice(0),f=new Uint32Array(i.buffer),c=UPNG.quantize.getKDtree(i,r),s=c[0],l=c[1],u=UPNG.quantize.planeDst,d=a,h=f,A=d.length,v=new Uint8Array(a.length>>2);if(a.length<2e7)for(var p=0;p>2]=t.ind,h[p>>2]=t.est.rgba}else for(p=0;p>2]=t.ind,h[p>>2]=t.est.rgba}return{abuf:i.buffer,inds:v,plte:l}},UPNG.quantize.getKDtree=function(e,r,t){null==t&&(t=1e-4);var a=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=UPNG.quantize.stats(e,i.i0,i.i1),i.est=UPNG.quantize.estats(i.bst);for(var f=[i];f.length c&&(c=f[l].est.L,s=l);if(c =d||u.i1<=d)u.est.L=0;else{var h={i0:u.i0,i1:d,bst:null,est:null,tdst:0,left:null,right:null};h.bst=UPNG.quantize.stats(e,h.i0,h.i1),h.est=UPNG.quantize.estats(h.bst);var A={i0:d,i1:u.i1,bst:null,est:null,tdst:0,left:null,right:null};A.bst={R:[],m:[],N:u.bst.N-h.bst.N};for(l=0;l<16;l++)A.bst.R[l]=u.bst.R[l]-h.bst.R[l];for(l=0;l<4;l++)A.bst.m[l]=u.bst.m[l]-h.bst.m[l];A.est=UPNG.quantize.estats(A.bst),u.left=h,u.right=A,f[s]=h,f.push(A)}}f.sort((function(e,r){return r.bst.N-e.bst.N}));for(l=0;l 0&&(c=e.right,s=e.left);var l=UPNG.quantize.getNearest(c,r,t,a,i);if(l.tdst<=f*f)return l;var u=UPNG.quantize.getNearest(s,r,t,a,i);return u.tdst f;)a-=4;if(t>=a)break;var s=r[t>>2];r[t>>2]=r[a>>2],r[a>>2]=s,t+=4,a-=4}for(;c(e,t,i)>f;)t-=4;return t+4},UPNG.quantize.vecDot=function(e,r,t){return e[r]*t[0]+e[r+1]*t[1]+e[r+2]*t[2]+e[r+3]*t[3]},UPNG.quantize.stats=function(e,r,t){for(var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],f=t-r>>2,c=r;c >>0}},UPNG.M4={multVec:function multVec(e,r){return[e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]*r[3],e[4]*r[0]+e[5]*r[1]+e[6]*r[2]+e[7]*r[3],e[8]*r[0]+e[9]*r[1]+e[10]*r[2]+e[11]*r[3],e[12]*r[0]+e[13]*r[1]+e[14]*r[2]+e[15]*r[3]]},dot:function dot(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]*r[3]},sml:function sml(e,r){return[e*r[0],e*r[1],e*r[2],e*r[3]]}},UPNG.encode.concatRGBA=function(e){for(var r=0,t=0;t 2&&void 0!==arguments[2]?arguments[2]:Date.now();return new Promise((function(a){for(var i=e.split(","),f=i[0].match(/:(.*?);/)[1],c=globalThis.atob(i[1]),s=c.length,l=new Uint8Array(s);s--;)l[s]=c.charCodeAt(s);var u=new Blob([l],{type:f});u.name=r,u.lastModified=t,a(u)}))}function loadImage(e){return new Promise((function(r,t){var a=new Image;a.onload=function(){return r(a)},a.onerror=function(e){return t(e)},a.src=e}))}function drawImageInCanvas(e){var r=_slicedToArray(getNewCanvasAndCtx(e.width,e.height),2),t=r[0];return r[1].drawImage(e,0,0,t.width,t.height),t}function drawFileInCanvas(e){return new Promise((function(r,t){var a,i,f=function $Try_1_Post(){try{return i=drawImageInCanvas(a),r([a,i])}catch(e){return t(e)}},c=function $Try_1_Catch(r){try{return getDataUrlFromFile(e).then((function(e){try{return loadImage(e).then((function(e){try{return a=e,f()}catch(e){return t(e)}}),t)}catch(e){return t(e)}}),t)}catch(e){return t(e)}};try{return createImageBitmap(e).then((function(e){try{return a=e,f()}catch(e){return c()}}),c)}catch(e){c()}}))}function canvasToFile(e,r,t,a){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;return new Promise((function(f,c){var s,l,u;if("image/png"===r)return l=e.getContext("2d").getImageData(0,0,e.width,e.height).data,u=UPNG.encode([l],e.width,e.height,256*i),(s=new Blob([u],{type:r})).name=t,s.lastModified=a,$If_4.call(this);{return"function"==typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e.convertToBlob({type:r,quality:i}).then(function(e){try{return(s=e).name=t,s.lastModified=a,$If_5.call(this)}catch(e){return c(e)}}.bind(this),c):getFilefromDataUrl(e.toDataURL(r,i),t,a).then(function(e){try{return s=e,$If_5.call(this)}catch(e){return c(e)}}.bind(this),c);function $If_5(){return $If_4.call(this)}}function $If_4(){return f(s)}}))}function getExifOrientation(e){return new Promise((function(r,t){var a=new CustomFileReader;a.onload=function(e){var t=new DataView(e.target.result);if(65496!=t.getUint16(0,!1))return r(-2);for(var a=t.byteLength,i=2;if||i>f)){var s=_slicedToArray(getNewCanvasAndCtx(a,i),2);c=s[0],t=s[1],a>i?(c.width=f,c.height=i/a*f):(c.width=a/i*f,c.height=f),t.drawImage(e,0,0,c.width,c.height),cleanupCanvasMemory(e)}return c}function followExifOrientation(e,r){var t=e.width,a=e.height,i=_slicedToArray(getNewCanvasAndCtx(t,a),2),f=i[0],c=i[1];switch(4 2&&void 0!==arguments[2]?arguments[2]:0;return new Promise((function(a,i){var f,c,s,l,u,d,h,A,v,p,U,g,m,w,P,b,_,y;function incProgress(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;f+=e,r.onProgress(Math.min(f,100))}function setProgress(e){f=Math.min(Math.max(e,f),100),r.onProgress(f)}return f=t,c=r.maxIteration||10,s=1024*r.maxSizeMB*1024,incProgress(),drawFileInCanvas(e).then(function(t){try{var f=_slicedToArray(t,2);return f[0],l=f[1],incProgress(),u=handleMaxWidthOrHeight(l,r),incProgress(),new Promise((function(t,a){var i;if(!(i=r.exifOrientation))return getExifOrientation(e).then(function(e){try{return i=e,$If_2.call(this)}catch(e){return a(e)}}.bind(this),a);function $If_2(){return t(i)}return $If_2.call(this)})).then(function(t){try{return d=t,incProgress(),isAutoOrientationInBrowser().then(function(t){try{return h=t?u:followExifOrientation(u,d),incProgress(),A=r.initialQuality||1,v=r.fileType||e.type,canvasToFile(h,v,e.name,e.lastModified,A).then(function(r){try{{if(p=r,incProgress(),U=p.size>s,g=p.size>e.size,!U&&!g)return setProgress(100),a(p);var t;function $Loop_3(){if(c--&&(P>s||P>m)){var r,t,a=_slicedToArray(getNewCanvasAndCtx(r=U?.95*y.width:y.width,t=U?.95*y.height:y.height),2);return _=a[0],a[1].drawImage(y,0,0,r,t),A*=.95,canvasToFile(_,v,e.name,e.lastModified,A).then((function(e){try{return b=e,cleanupCanvasMemory(y),y=_,P=b.size,setProgress(Math.min(99,Math.floor((w-P)/(w-s)*100))),$Loop_3}catch(e){return i(e)}}),i)}return[1]}return m=e.size,w=p.size,P=w,y=h,(t=function(e){for(;e;){if(e.then)return void e.then(t,i);try{if(e.pop){if(e.length)return e.pop()?$Loop_3_exit.call(this):e;e=$Loop_3}else e=e.call(this)}catch(e){return i(e)}}}.bind(this))($Loop_3);function $Loop_3_exit(){return cleanupCanvasMemory(y),cleanupCanvasMemory(_),cleanupCanvasMemory(u),cleanupCanvasMemory(h),cleanupCanvasMemory(l),setProgress(100),a(b)}}}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}))}isBrowser&&(Number.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e});var cnt=0,imageCompressionLibUrl,worker;function createWorker(e){return"function"==typeof e&&(e="(".concat(f,")()")),new Worker(URL.createObjectURL(new Blob([e])))}function createSourceObject(e){return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}function stringify(e){return JSON.stringify(e,(function(e,r){return"function"==typeof r?"BIC_FN:::(() => ".concat(r.toString(),")()"):r}))}function parse(o){if("string"==typeof o)return o;var result={};return Object.entries(o).forEach((function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];if("string"==typeof value&&value.startsWith("BIC_FN:::"))try{result[key]=eval(value.replace(/^BIC_FN:::/,""))}catch(e){throw console.log(key,e),e}else result[key]=parse(value)})),result}function generateLib(){return createSourceObject("\n // reconstruct library\n function imageCompression (){return (".concat(imageCompression,").apply(null, arguments)}\n\n imageCompression.getDataUrlFromFile = ").concat(imageCompression.getDataUrlFromFile,"\n imageCompression.getFilefromDataUrl = ").concat(imageCompression.getFilefromDataUrl,"\n imageCompression.loadImage = ").concat(imageCompression.loadImage,"\n imageCompression.drawImageInCanvas = ").concat(imageCompression.drawImageInCanvas,"\n imageCompression.drawFileInCanvas = ").concat(imageCompression.drawFileInCanvas,"\n imageCompression.canvasToFile = ").concat(imageCompression.canvasToFile,"\n imageCompression.getExifOrientation = ").concat(imageCompression.getExifOrientation,"\n imageCompression.handleMaxWidthOrHeight = ").concat(imageCompression.handleMaxWidthOrHeight,"\n imageCompression.followExifOrientation = ").concat(imageCompression.followExifOrientation,"\n imageCompression.cleanupCanvasMemory = ").concat(imageCompression.cleanupCanvasMemory,"\n imageCompression.isAutoOrientationInBrowser = ").concat(imageCompression.isAutoOrientationInBrowser,"\n\n // functions / objects\n getDataUrlFromFile = imageCompression.getDataUrlFromFile\n getFilefromDataUrl = imageCompression.getFilefromDataUrl\n loadImage = imageCompression.loadImage\n drawImageInCanvas = imageCompression.drawImageInCanvas\n drawFileInCanvas = imageCompression.drawFileInCanvas\n canvasToFile = imageCompression.canvasToFile\n getExifOrientation = imageCompression.getExifOrientation\n handleMaxWidthOrHeight = imageCompression.handleMaxWidthOrHeight\n followExifOrientation = imageCompression.followExifOrientation\n cleanupCanvasMemory = imageCompression.cleanupCanvasMemory\n isAutoOrientationInBrowser = imageCompression.isAutoOrientationInBrowser\n \n getNewCanvasAndCtx = ").concat(getNewCanvasAndCtx,"\n CustomFileReader = FileReader\n CustomFile = File\n function _slicedToArray(arr, n) { return arr }\n function _typeof(a) { return typeof a }\n function compress (){return (").concat(compress,").apply(null, arguments)}\n\n // Libraries\n const parse = ").concat(parse,"\n const UPNG = {}\n UPNG.toRGBA8 = ").concat(UPNG.toRGBA8,"\n UPNG.toRGBA8.decodeImage = ").concat(UPNG.toRGBA8.decodeImage,"\n UPNG.decode = ").concat(UPNG.decode,"\n UPNG.decode._decompress = ").concat(UPNG.decode._decompress,"\n UPNG.decode._inflate = ").concat(UPNG.decode._inflate,"\n UPNG.decode._readInterlace = ").concat(UPNG.decode._readInterlace,"\n UPNG.decode._getBPP = ").concat(UPNG.decode._getBPP," \n UPNG.decode._filterZero = ").concat(UPNG.decode._filterZero,"\n UPNG.decode._paeth = ").concat(UPNG.decode._paeth,"\n UPNG.decode._IHDR = ").concat(UPNG.decode._IHDR,"\n UPNG._bin = parse(").concat(stringify(UPNG._bin),")\n UPNG._copyTile = ").concat(UPNG._copyTile,"\n UPNG.encode = ").concat(UPNG.encode,"\n UPNG.encodeLL = ").concat(UPNG.encodeLL," \n UPNG.encode._main = ").concat(UPNG.encode._main,"\n UPNG.encode.compressPNG = ").concat(UPNG.encode.compressPNG," \n UPNG.encode.compress = ").concat(UPNG.encode.compress,"\n UPNG.encode.framize = ").concat(UPNG.encode.framize," \n UPNG.encode._updateFrame = ").concat(UPNG.encode._updateFrame," \n UPNG.encode._prepareDiff = ").concat(UPNG.encode._prepareDiff," \n UPNG.encode._filterZero = ").concat(UPNG.encode._filterZero," \n UPNG.encode._filterLine = ").concat(UPNG.encode._filterLine,"\n UPNG.encode.concatRGBA = ").concat(UPNG.encode.concatRGBA,"\n UPNG.crc = parse(").concat(stringify(UPNG.crc),")\n UPNG.crc.table = ( function() {\n var tab = new Uint32Array(256);\n for (var n=0; n<256; n++) {\n var c = n;\n for (var k=0; k<8; k++) {\n if (c & 1) c = 0xedb88320 ^ (c >>> 1);\n else c = c >>> 1;\n }\n tab[n] = c; }\n return tab; })()\n UPNG.quantize = ").concat(UPNG.quantize," \n UPNG.quantize.getKDtree = ").concat(UPNG.quantize.getKDtree," \n UPNG.quantize.getNearest = ").concat(UPNG.quantize.getNearest," \n UPNG.quantize.planeDst = ").concat(UPNG.quantize.planeDst," \n UPNG.quantize.dist = ").concat(UPNG.quantize.dist," \n UPNG.quantize.splitPixels = ").concat(UPNG.quantize.splitPixels," \n UPNG.quantize.vecDot = ").concat(UPNG.quantize.vecDot," \n UPNG.quantize.stats = ").concat(UPNG.quantize.stats," \n UPNG.quantize.estats = ").concat(UPNG.quantize.estats,"\n UPNG.M4 = parse(").concat(stringify(UPNG.M4),")\n UPNG.encode.concatRGBA = ").concat(UPNG.encode.concatRGBA,'\n UPNG.inflateRaw=function(){\n var H={};H.H={};H.H.N=function(N,W){var R=Uint8Array,i=0,m=0,J=0,h=0,Q=0,X=0,u=0,w=0,d=0,v,C;\n if(N[0]==3&&N[1]==0)return W?W:new R(0);var V=H.H,n=V.b,A=V.e,l=V.R,M=V.n,I=V.A,e=V.Z,b=V.m,Z=W==null;\n if(Z)W=new R(N.length>>>2<<5);while(i==0){i=n(N,d,1);m=n(N,d+1,2);d+=3;if(m==0){if((d&7)!=0)d+=8-(d&7);\n var D=(d>>>3)+4,q=N[D-4]|N[D-3]<<8;if(Z)W=H.H.W(W,w+q);W.set(new R(N.buffer,N.byteOffset+D,q),w);d=D+q<<3;\n w+=q;continue}if(Z)W=H.H.W(W,w+(1<<17));if(m==1){v=b.J;C=b.h;X=(1<<9)-1;u=(1<<5)-1}if(m==2){J=A(N,d,5)+257;\n h=A(N,d+5,5)+1;Q=A(N,d+10,4)+4;d+=14;var E=d,j=1;for(var c=0;c<38;c+=2){b.Q[c]=0;b.Q[c+1]=0}for(var c=0;\n c j)j=K}d+=3*Q;M(b.Q,j);I(b.Q,j,b.u);v=b.w;C=b.d;\n d=l(b.u,(1<>>4;if(p>>>8==0){W[w++]=p}else if(p==256){break}else{var z=w+p-254;\n if(p>264){var _=b.q[p-257];z=w+(_>>>3)+A(N,d,_&7);d+=_&7}var $=C[e(N,d)&u];d+=$&15;var s=$>>>4,Y=b.c[s],a=(Y>>>4)+n(N,d,Y&15);\n d+=Y&15;while(w >>4;\n if(b<=15){A[I]=b;I++}else{var Z=0,m=0;if(b==16){m=3+l(V,n,2);n+=2;Z=A[I-1]}else if(b==17){m=3+l(V,n,3);\n n+=3}else if(b==18){m=11+l(V,n,7);n+=7}var J=I+m;while(I >>1;\n while(A n)n=M;A++}while(A >1,I=N[l+1],e=M<<4|I,b=W-I,Z=N[l]<>>15-W;R[J]=e;Z++}}};H.H.l=function(N,W){var R=H.H.m.r,V=15-W;for(var n=0;n >>V}};H.H.M=function(N,W,R){R=R<<(W&7);var V=W>>>3;N[V]|=R;N[V+1]|=R>>>8};\n H.H.I=function(N,W,R){R=R<<(W&7);var V=W>>>3;N[V]|=R;N[V+1]|=R>>>8;N[V+2]|=R>>>16};H.H.e=function(N,W,R){return(N[W>>>3]|N[(W>>>3)+1]<<8)>>>(W&7)&(1< >>3]|N[(W>>>3)+1]<<8|N[(W>>>3)+2]<<16)>>>(W&7)&(1< >>3]|N[(W>>>3)+1]<<8|N[(W>>>3)+2]<<16)>>>(W&7)};\n H.H.i=function(N,W){return(N[W>>>3]|N[(W>>>3)+1]<<8|N[(W>>>3)+2]<<16|N[(W>>>3)+3]<<24)>>>(W&7)};H.H.m=function(){var N=Uint16Array,W=Uint32Array;\n return{K:new N(16),j:new N(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new N(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new W(32),J:new N(512),_:[],h:new N(32),$:[],w:new N(32768),C:[],v:[],d:new N(32768),D:[],u:new N(512),Q:[],r:new N(1<<15),s:new W(286),Y:new W(30),a:new W(19),t:new W(15e3),k:new N(1<<16),g:new N(1<<15)}}();\n (function(){var N=H.H.m,W=1<<15;for(var R=0;R >>1|(V&1431655765)<<1;\n V=(V&3435973836)>>>2|(V&858993459)<<2;V=(V&4042322160)>>>4|(V&252645135)<<4;V=(V&4278255360)>>>8|(V&16711935)<<8;\n N.r[R]=(V>>>16|V<<16)>>>17}function n(A,l,M){while(l--!=0)A.push(0,M)}for(var R=0;R<32;R++){N.q[R]=N.S[R]<<3|N.T[R];\n N.c[R]=N.p[R]<<4|N.z[R]}n(N._,144,8);n(N._,255-143,9);n(N._,279-255,7);n(N._,287-279,8);H.H.n(N._,9);\n H.H.A(N._,9,N.J);H.H.l(N._,9);n(N.$,32,5);H.H.n(N.$,5);H.H.A(N.$,5,N.h);H.H.l(N.$,5);n(N.Q,19,0);n(N.C,286,0);\n n(N.D,30,0);n(N.v,320,0)}());return H.H.N}()\n \n const UZIP = {}\n UZIP["parse"] = ').concat(UZIP_1.parse,"\n UZIP._readLocal = ").concat(UZIP_1._readLocal,"\n UZIP.inflateRaw = ").concat(UZIP_1.inflateRaw,"\n UZIP.inflate = ").concat(UZIP_1.inflate,"\n UZIP.deflate = ").concat(UZIP_1.deflate,"\n UZIP.deflateRaw = ").concat(UZIP_1.deflateRaw,"\n UZIP.encode = ").concat(UZIP_1.encode,"\n UZIP._noNeed = ").concat(UZIP_1._noNeed,"\n UZIP._writeHeader = ").concat(UZIP_1._writeHeader,"\n UZIP.crc = parse(").concat(stringify(UZIP_1.crc),")\n UZIP.crc.table = ( function() {\n var tab = new Uint32Array(256);\n for (var n=0; n<256; n++) {\n var c = n;\n for (var k=0; k<8; k++) {\n if (c & 1) c = 0xedb88320 ^ (c >>> 1);\n else c = c >>> 1;\n }\n tab[n] = c; }\n return tab; })()\n \n UZIP.adler = ").concat(UZIP_1.adler,"\n UZIP.bin = parse(").concat(stringify(UZIP_1.bin),")\n UZIP.F = {}\n UZIP.F.deflateRaw = ").concat(UZIP_1.F.deflateRaw,"\n UZIP.F._bestMatch = ").concat(UZIP_1.F._bestMatch,"\n UZIP.F._howLong = ").concat(UZIP_1.F._howLong,"\n UZIP.F._hash = ").concat(UZIP_1.F._hash,"\n UZIP.saved = ").concat(UZIP_1.saved,"\n UZIP.F._writeBlock = ").concat(UZIP_1.F._writeBlock,"\n UZIP.F._copyExact = ").concat(UZIP_1.F._copyExact,"\n UZIP.F.getTrees = ").concat(UZIP_1.F.getTrees,"\n UZIP.F.getSecond = ").concat(UZIP_1.F.getSecond,"\n UZIP.F.nonZero = ").concat(UZIP_1.F.nonZero,"\n UZIP.F.contSize = ").concat(UZIP_1.F.contSize,"\n UZIP.F._codeTiny = ").concat(UZIP_1.F._codeTiny," \n UZIP.F._lenCodes = ").concat(UZIP_1.F._lenCodes," \n UZIP.F._hufTree = ").concat(UZIP_1.F._hufTree," \n UZIP.F.setDepth = ").concat(UZIP_1.F.setDepth," \n UZIP.F.restrictDepth = ").concat(UZIP_1.F.restrictDepth,"\n UZIP.F._goodIndex = ").concat(UZIP_1.F._goodIndex," \n UZIP.F._writeLit = ").concat(UZIP_1.F._writeLit," \n UZIP.F.inflate = ").concat(UZIP_1.F.inflate," \n UZIP.F._check = ").concat(UZIP_1.F._check," \n UZIP.F._decodeTiny = ").concat(UZIP_1.F._decodeTiny," \n UZIP.F._copyOut = ").concat(UZIP_1.F._copyOut," \n UZIP.F.makeCodes = ").concat(UZIP_1.F.makeCodes," \n UZIP.F.codes2map = ").concat(UZIP_1.F.codes2map," \n UZIP.F.revCodes = ").concat(UZIP_1.F.revCodes," \n\n // used only in deflate\n UZIP.F._putsE = ").concat(UZIP_1.F._putsE,"\n UZIP.F._putsF = ").concat(UZIP_1.F._putsF,"\n \n UZIP.F._bitsE = ").concat(UZIP_1.F._bitsE,"\n UZIP.F._bitsF = ").concat(UZIP_1.F._bitsF,"\n\n UZIP.F._get17 = ").concat(UZIP_1.F._get17,"\n UZIP.F._get25 = ").concat(UZIP_1.F._get25,"\n UZIP.F.U = function(){\n var u16=Uint16Array, u32=Uint32Array;\n return {\n next_code : new u16(16),\n bl_count : new u16(16),\n ordr : [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ],\n of0 : [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],\n exb : [0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0],\n ldef : new u16(32),\n df0 : [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 65535, 65535],\n dxb : [0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0],\n ddef : new u32(32),\n flmap: new u16( 512), fltree: [],\n fdmap: new u16( 32), fdtree: [],\n lmap : new u16(32768), ltree : [], ttree:[],\n dmap : new u16(32768), dtree : [],\n imap : new u16( 512), itree : [],\n //rev9 : new u16( 512)\n rev15: new u16(1<<15),\n lhst : new u32(286), dhst : new u32( 30), ihst : new u32(19),\n lits : new u32(15000),\n strt : new u16(1<<16),\n prev : new u16(1<<15)\n };\n } ();\n\n (function(){\n var U = UZIP.F.U;\n var len = 1<<15;\n for(var i=0; i >> 1) | ((x & 0x55555555) << 1));\n x = (((x & 0xcccccccc) >>> 2) | ((x & 0x33333333) << 2));\n x = (((x & 0xf0f0f0f0) >>> 4) | ((x & 0x0f0f0f0f) << 4));\n x = (((x & 0xff00ff00) >>> 8) | ((x & 0x00ff00ff) << 8));\n U.rev15[i] = (((x >>> 16) | (x << 16)))>>>17;\n }\n \n function pushV(tgt, n, sv) { while(n--!=0) tgt.push(0,sv); }\n \n for(var i=0; i<32; i++) { U.ldef[i]=(U.of0[i]<<3)|U.exb[i]; U.ddef[i]=(U.df0[i]<<4)|U.dxb[i]; }\n \n pushV(U.fltree, 144, 8); pushV(U.fltree, 255-143, 9); pushV(U.fltree, 279-255, 7); pushV(U.fltree,287-279,8);\n /*\n var i = 0;\n for(; i<=143; i++) U.fltree.push(0,8);\n for(; i<=255; i++) U.fltree.push(0,9);\n for(; i<=279; i++) U.fltree.push(0,7);\n for(; i<=287; i++) U.fltree.push(0,8);\n */\n UZIP.F.makeCodes(U.fltree, 9);\n UZIP.F.codes2map(U.fltree, 9, U.flmap);\n UZIP.F.revCodes (U.fltree, 9)\n \n pushV(U.fdtree,32,5);\n //for(i=0;i<32; i++) U.fdtree.push(0,5);\n UZIP.F.makeCodes(U.fdtree, 5);\n UZIP.F.codes2map(U.fdtree, 5, U.fdmap);\n UZIP.F.revCodes (U.fdtree, 5)\n \n pushV(U.itree,19,0); pushV(U.ltree,286,0); pushV(U.dtree,30,0); pushV(U.ttree,320,0);\n /*\n for(var i=0; i< 19; i++) U.itree.push(0,0);\n for(var i=0; i<286; i++) U.ltree.push(0,0);\n for(var i=0; i< 30; i++) U.dtree.push(0,0);\n for(var i=0; i<320; i++) U.ttree.push(0,0);\n */\n })()\n "))}function generateWorkerScript(){return createWorker("\n let scriptImported = false\n self.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n })\n ")}function compressOnWebWorker(e,r){return new Promise((function(t,a){return new Promise((function(i,f){var c=cnt++;return imageCompressionLibUrl||(imageCompressionLibUrl=generateLib()),worker||(worker=generateWorkerScript()),worker.addEventListener("message",(function handler(e){if(e.data.id===c){if(void 0!==e.data.progress)return void r.onProgress(e.data.progress);worker.removeEventListener("message",handler),e.data.error&&a(new Error(e.data.error)),t(e.data.file)}})),worker.addEventListener("error",a),worker.postMessage({file:e,id:c,imageCompressionLibUrl:imageCompressionLibUrl,options:_objectSpread2(_objectSpread2({},r),{},{onProgress:void 0})}),i()}))}))}function imageCompression(e,r){return new Promise((function(t,a){var i,f,c,s,l;if(f=0,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,s="boolean"!=typeof r.useWebWorker||r.useWebWorker,delete r.useWebWorker,c=r.onProgress,r.onProgress=function(e){f=e,"function"==typeof c&&c(f)},!(e instanceof Blob||e instanceof CustomFile))return a(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return a(new Error("The file given is not an image"));if(l="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,!s||"function"!=typeof Worker||l)return compress(e,r).then(function(e){try{return i=e,$If_3.call(this)}catch(e){return a(e)}}.bind(this),a);var u=function(){try{return $If_3.call(this)}catch(e){return a(e)}}.bind(this),d=function $Try_1_Catch(t){try{return compress(e,r).then((function(e){try{return i=e,u()}catch(e){return a(e)}}),a)}catch(e){return a(e)}};try{return compressOnWebWorker(e,r).then((function(e){try{return i=e,u()}catch(e){return d()}}),d)}catch(e){d()}function $If_3(){try{i.name=e.name,i.lastModified=e.lastModified}catch(e){}return t(i)}}))}return imageCompression.getDataUrlFromFile=getDataUrlFromFile,imageCompression.getFilefromDataUrl=getFilefromDataUrl,imageCompression.loadImage=loadImage,imageCompression.drawImageInCanvas=drawImageInCanvas,imageCompression.drawFileInCanvas=drawFileInCanvas,imageCompression.canvasToFile=canvasToFile,imageCompression.getExifOrientation=getExifOrientation,imageCompression.handleMaxWidthOrHeight=handleMaxWidthOrHeight,imageCompression.followExifOrientation=followExifOrientation,imageCompression.cleanupCanvasMemory=cleanupCanvasMemory,imageCompression.isAutoOrientationInBrowser=isAutoOrientationInBrowser,imageCompression.version="1.0.14",imageCompression})); +!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).imageCompression=r()}(this,(function(){"use strict";function ownKeys$1(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function _objectSpread2(e){for(var r=1;r e.length)&&(r=e.length);for(var t=0,a=new Array(r);t =74)&&(match=engineUserAgent.match(/Chrome\/(\d+)/),match&&(version=match[1])));var engineV8Version=version&&+version,fails=function(e){try{return!!e()}catch(e){return!0}},nativeSymbol=!!Object.getOwnPropertySymbols&&!fails((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&engineV8Version&&engineV8Version<41})),useSymbolAsUid=nativeSymbol&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,WellKnownSymbolsStore=shared("wks"),Symbol$1=global$1.Symbol,createWellKnownSymbol=useSymbolAsUid?Symbol$1:Symbol$1&&Symbol$1.withoutSetter||uid,wellKnownSymbol=function(e){return has$1(WellKnownSymbolsStore,e)&&(nativeSymbol||"string"==typeof WellKnownSymbolsStore[e])||(nativeSymbol&&has$1(Symbol$1,e)?WellKnownSymbolsStore[e]=Symbol$1[e]:WellKnownSymbolsStore[e]=createWellKnownSymbol("Symbol."+e)),WellKnownSymbolsStore[e]},TO_STRING_TAG$4=wellKnownSymbol("toStringTag"),test$1={};test$1[TO_STRING_TAG$4]="z";var toStringTagSupport="[object z]"===String(test$1),descriptors=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),isObject=function(e){return"object"==typeof e?null!==e:"function"==typeof e},document$3=global$1.document,EXISTS=isObject(document$3)&&isObject(document$3.createElement),documentCreateElement=function(e){return EXISTS?document$3.createElement(e):{}},ie8DomDefine=!descriptors&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),anObject=function(e){if(!isObject(e))throw TypeError(String(e)+" is not an object");return e},isSymbol=useSymbolAsUid?function(e){return"symbol"==typeof e}:function(e){var r=getBuiltIn("Symbol");return"function"==typeof r&&Object(e)instanceof r},ordinaryToPrimitive=function(e,r){var t,a;if("string"===r&&"function"==typeof(t=e.toString)&&!isObject(a=t.call(e)))return a;if("function"==typeof(t=e.valueOf)&&!isObject(a=t.call(e)))return a;if("string"!==r&&"function"==typeof(t=e.toString)&&!isObject(a=t.call(e)))return a;throw TypeError("Can't convert object to primitive value")},TO_PRIMITIVE=wellKnownSymbol("toPrimitive"),toPrimitive=function(e,r){if(!isObject(e)||isSymbol(e))return e;var t,a=e[TO_PRIMITIVE];if(void 0!==a){if(void 0===r&&(r="default"),t=a.call(e,r),!isObject(t)||isSymbol(t))return t;throw TypeError("Can't convert object to primitive value")}return void 0===r&&(r="number"),ordinaryToPrimitive(e,r)},toPropertyKey=function(e){var r=toPrimitive(e,"string");return isSymbol(r)?r:String(r)},$defineProperty=Object.defineProperty,f$5=descriptors?$defineProperty:function defineProperty(e,r,t){if(anObject(e),r=toPropertyKey(r),anObject(t),ie8DomDefine)try{return $defineProperty(e,r,t)}catch(e){}if("get"in t||"set"in t)throw TypeError("Accessors not supported");return"value"in t&&(e[r]=t.value),e},objectDefineProperty={f:f$5},createPropertyDescriptor=function(e,r){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:r}},createNonEnumerableProperty=descriptors?function(e,r,t){return objectDefineProperty.f(e,r,createPropertyDescriptor(1,t))}:function(e,r,t){return e[r]=t,e},functionToString=Function.toString;"function"!=typeof sharedStore.inspectSource&&(sharedStore.inspectSource=function(e){return functionToString.call(e)});var inspectSource=sharedStore.inspectSource,WeakMap$1=global$1.WeakMap,nativeWeakMap="function"==typeof WeakMap$1&&/native code/.test(inspectSource(WeakMap$1)),keys$2=shared("keys"),sharedKey=function(e){return keys$2[e]||(keys$2[e]=uid(e))},hiddenKeys$1={},OBJECT_ALREADY_INITIALIZED="Object already initialized",WeakMap=global$1.WeakMap,set$2,get$1,has,enforce=function(e){return has(e)?get$1(e):set$2(e,{})},getterFor=function(e){return function(r){var t;if(!isObject(r)||(t=get$1(r)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return t}};if(nativeWeakMap||sharedStore.state){var store=sharedStore.state||(sharedStore.state=new WeakMap),wmget=store.get,wmhas=store.has,wmset=store.set;set$2=function(e,r){if(wmhas.call(store,e))throw new TypeError(OBJECT_ALREADY_INITIALIZED);return r.facade=e,wmset.call(store,e,r),r},get$1=function(e){return wmget.call(store,e)||{}},has=function(e){return wmhas.call(store,e)}}else{var STATE=sharedKey("state");hiddenKeys$1[STATE]=!0,set$2=function(e,r){if(has$1(e,STATE))throw new TypeError(OBJECT_ALREADY_INITIALIZED);return r.facade=e,createNonEnumerableProperty(e,STATE,r),r},get$1=function(e){return has$1(e,STATE)?e[STATE]:{}},has=function(e){return has$1(e,STATE)}}var internalState={set:set$2,get:get$1,has:has,enforce:enforce,getterFor:getterFor},redefine=createCommonjsModule((function(e){var r=internalState.get,t=internalState.enforce,a=String(String).split("String");(e.exports=function(e,r,i,s){var c,l=!!s&&!!s.unsafe,u=!!s&&!!s.enumerable,p=!!s&&!!s.noTargetGet;"function"==typeof i&&("string"!=typeof r||has$1(i,"name")||createNonEnumerableProperty(i,"name",r),(c=t(i)).source||(c.source=a.join("string"==typeof r?r:""))),e!==global$1?(l?!p&&e[r]&&(u=!0):delete e[r],u?e[r]=i:createNonEnumerableProperty(e,r,i)):u?e[r]=i:setGlobal(r,i)})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&r(this).source||inspectSource(this)}))})),toString$1={}.toString,classofRaw=function(e){return toString$1.call(e).slice(8,-1)},TO_STRING_TAG$3=wellKnownSymbol("toStringTag"),CORRECT_ARGUMENTS="Arguments"==classofRaw(function(){return arguments}()),tryGet=function(e,r){try{return e[r]}catch(e){}},classof=toStringTagSupport?classofRaw:function(e){var r,t,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(t=tryGet(r=Object(e),TO_STRING_TAG$3))?t:CORRECT_ARGUMENTS?classofRaw(r):"Object"==(a=classofRaw(r))&&"function"==typeof r.callee?"Arguments":a},objectToString=toStringTagSupport?{}.toString:function toString(){return"[object "+classof(this)+"]"};toStringTagSupport||redefine(Object.prototype,"toString",objectToString,{unsafe:!0});var $propertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor$4=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor$4&&!$propertyIsEnumerable.call({1:2},1),f$4=NASHORN_BUG?function propertyIsEnumerable(e){var r=getOwnPropertyDescriptor$4(this,e);return!!r&&r.enumerable}:$propertyIsEnumerable,objectPropertyIsEnumerable={f:f$4},split="".split,indexedObject=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==classofRaw(e)?split.call(e,""):Object(e)}:Object,toIndexedObject=function(e){return indexedObject(requireObjectCoercible(e))},$getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,f$3=descriptors?$getOwnPropertyDescriptor:function getOwnPropertyDescriptor(e,r){if(e=toIndexedObject(e),r=toPropertyKey(r),ie8DomDefine)try{return $getOwnPropertyDescriptor(e,r)}catch(e){}if(has$1(e,r))return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(e,r),e[r])},objectGetOwnPropertyDescriptor={f:f$3},ceil=Math.ceil,floor$7=Math.floor,toInteger=function(e){return isNaN(e=+e)?0:(e>0?floor$7:ceil)(e)},min$6=Math.min,toLength=function(e){return e>0?min$6(toInteger(e),9007199254740991):0},max$2=Math.max,min$5=Math.min,toAbsoluteIndex=function(e,r){var t=toInteger(e);return t<0?max$2(t+r,0):min$5(t,r)},createMethod$5=function(e){return function(r,t,a){var i,s=toIndexedObject(r),c=toLength(s.length),l=toAbsoluteIndex(a,c);if(e&&t!=t){for(;c>l;)if((i=s[l++])!=i)return!0}else for(;c>l;l++)if((e||l in s)&&s[l]===t)return e||l||0;return!e&&-1}},arrayIncludes={includes:createMethod$5(!0),indexOf:createMethod$5(!1)},indexOf=arrayIncludes.indexOf,objectKeysInternal=function(e,r){var t,a=toIndexedObject(e),i=0,s=[];for(t in a)!has$1(hiddenKeys$1,t)&&has$1(a,t)&&s.push(t);for(;r.length>i;)has$1(a,t=r[i++])&&(~indexOf(s,t)||s.push(t));return s},enumBugKeys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],hiddenKeys=enumBugKeys.concat("length","prototype"),f$2=Object.getOwnPropertyNames||function getOwnPropertyNames(e){return objectKeysInternal(e,hiddenKeys)},objectGetOwnPropertyNames={f:f$2},f$1=Object.getOwnPropertySymbols,objectGetOwnPropertySymbols={f:f$1},ownKeys=getBuiltIn("Reflect","ownKeys")||function ownKeys(e){var r=objectGetOwnPropertyNames.f(anObject(e)),t=objectGetOwnPropertySymbols.f;return t?r.concat(t(e)):r},copyConstructorProperties=function(e,r){for(var t=ownKeys(r),a=objectDefineProperty.f,i=objectGetOwnPropertyDescriptor.f,s=0;s s;s++)if((l=callFn(e[s]))&&l instanceof Result)return l;return new Result(!1)}a=i.call(e)}for(u=a.next;!(p=u.call(a)).done;){try{l=callFn(p.value)}catch(e){throw iteratorClose(a),e}if("object"==typeof l&&l&&l instanceof Result)return l}return new Result(!1)},ITERATOR$6=wellKnownSymbol("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$6]=function(){return this},Array.from(iteratorWithReturn,(function(){throw 2}))}catch(e){}var checkCorrectnessOfIteration=function(e,r){if(!r&&!SAFE_CLOSING)return!1;var t=!1;try{var a={};a[ITERATOR$6]=function(){return{next:function(){return{done:t=!0}}}},e(a)}catch(e){}return t},SPECIES$5=wellKnownSymbol("species"),speciesConstructor=function(e,r){var t,a=anObject(e).constructor;return void 0===a||null==(t=anObject(a)[SPECIES$5])?r:aFunction(t)},html=getBuiltIn("document","documentElement"),engineIsIos=/(?:iphone|ipod|ipad).*applewebkit/i.test(engineUserAgent),engineIsNode="process"==classofRaw(global$1.process),set$1=global$1.setImmediate,clear=global$1.clearImmediate,process$2=global$1.process,MessageChannel=global$1.MessageChannel,Dispatch=global$1.Dispatch,counter=0,queue={},ONREADYSTATECHANGE="onreadystatechange",location,defer,channel,port;try{location=global$1.location}catch(e){}var run=function(e){if(queue.hasOwnProperty(e)){var r=queue[e];delete queue[e],r()}},runner=function(e){return function(){run(e)}},listener=function(e){run(e.data)},post=function(e){global$1.postMessage(String(e),location.protocol+"//"+location.host)};set$1&&clear||(set$1=function setImmediate(e){for(var r=[],t=arguments.length,a=1;t>a;)r.push(arguments[a++]);return queue[++counter]=function(){("function"==typeof e?e:Function(e)).apply(void 0,r)},defer(counter),counter},clear=function clearImmediate(e){delete queue[e]},engineIsNode?defer=function(e){process$2.nextTick(runner(e))}:Dispatch&&Dispatch.now?defer=function(e){Dispatch.now(runner(e))}:MessageChannel&&!engineIsIos?(channel=new MessageChannel,port=channel.port2,channel.port1.onmessage=listener,defer=functionBindContext(port.postMessage,port,1)):global$1.addEventListener&&"function"==typeof postMessage&&!global$1.importScripts&&location&&"file:"!==location.protocol&&!fails(post)?(defer=post,global$1.addEventListener("message",listener,!1)):defer=ONREADYSTATECHANGE in documentCreateElement("script")?function(e){html.appendChild(documentCreateElement("script"))[ONREADYSTATECHANGE]=function(){html.removeChild(this),run(e)}}:function(e){setTimeout(runner(e),0)});var task$1={set:set$1,clear:clear},engineIsIosPebble=/iphone|ipod|ipad/i.test(engineUserAgent)&&void 0!==global$1.Pebble,engineIsWebosWebkit=/web0s(?!.*chrome)/i.test(engineUserAgent),getOwnPropertyDescriptor$2=objectGetOwnPropertyDescriptor.f,macrotask=task$1.set,MutationObserver=global$1.MutationObserver||global$1.WebKitMutationObserver,document$2=global$1.document,process$1=global$1.process,Promise$1=global$1.Promise,queueMicrotaskDescriptor=getOwnPropertyDescriptor$2(global$1,"queueMicrotask"),queueMicrotask=queueMicrotaskDescriptor&&queueMicrotaskDescriptor.value,flush,head,last,notify$1,toggle,node,promise,then;queueMicrotask||(flush=function(){var e,r;for(engineIsNode&&(e=process$1.domain)&&e.exit();head;){r=head.fn,head=head.next;try{r()}catch(e){throw head?notify$1():last=void 0,e}}last=void 0,e&&e.enter()},engineIsIos||engineIsNode||engineIsWebosWebkit||!MutationObserver||!document$2?!engineIsIosPebble&&Promise$1&&Promise$1.resolve?(promise=Promise$1.resolve(void 0),promise.constructor=Promise$1,then=promise.then,notify$1=function(){then.call(promise,flush)}):notify$1=engineIsNode?function(){process$1.nextTick(flush)}:function(){macrotask.call(global$1,flush)}:(toggle=!0,node=document$2.createTextNode(""),new MutationObserver(flush).observe(node,{characterData:!0}),notify$1=function(){node.data=toggle=!toggle}));var microtask=queueMicrotask||function(e){var r={fn:e,next:void 0};last&&(last.next=r),head||(head=r,notify$1()),last=r},PromiseCapability=function(e){var r,t;this.promise=new e((function(e,a){if(void 0!==r||void 0!==t)throw TypeError("Bad Promise constructor");r=e,t=a})),this.resolve=aFunction(r),this.reject=aFunction(t)},f=function(e){return new PromiseCapability(e)},newPromiseCapability$1={f:f},promiseResolve=function(e,r){if(anObject(e),isObject(r)&&r.constructor===e)return r;var t=newPromiseCapability$1.f(e);return(0,t.resolve)(r),t.promise},hostReportErrors=function(e,r){var t=global$1.console;t&&t.error&&(1===arguments.length?t.error(e):t.error(e,r))},perform=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},engineIsBrowser="object"==typeof window,task=task$1.set,SPECIES$4=wellKnownSymbol("species"),PROMISE="Promise",getInternalState$4=internalState.get,setInternalState$5=internalState.set,getInternalPromiseState=internalState.getterFor(PROMISE),NativePromisePrototype=nativePromiseConstructor&&nativePromiseConstructor.prototype,PromiseConstructor=nativePromiseConstructor,PromiseConstructorPrototype=NativePromisePrototype,TypeError$1=global$1.TypeError,document$1=global$1.document,process=global$1.process,newPromiseCapability=newPromiseCapability$1.f,newGenericPromiseCapability=newPromiseCapability,DISPATCH_EVENT=!!(document$1&&document$1.createEvent&&global$1.dispatchEvent),NATIVE_REJECTION_EVENT="function"==typeof PromiseRejectionEvent,UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,SUBCLASSING=!1,Internal,OwnPromiseCapability,PromiseWrapper,nativeThen,FORCED$6=isForced_1(PROMISE,(function(){var e=inspectSource(PromiseConstructor),r=e!==String(PromiseConstructor);if(!r&&66===engineV8Version)return!0;if(engineV8Version>=51&&/native code/.test(e))return!1;var t=new PromiseConstructor((function(e){e(1)})),FakePromise=function(e){e((function(){}),(function(){}))};return(t.constructor={})[SPECIES$4]=FakePromise,!(SUBCLASSING=t.then((function(){}))instanceof FakePromise)||!r&&engineIsBrowser&&!NATIVE_REJECTION_EVENT})),INCORRECT_ITERATION=FORCED$6||!checkCorrectnessOfIteration((function(e){PromiseConstructor.all(e).catch((function(){}))})),isThenable=function(e){var r;return!(!isObject(e)||"function"!=typeof(r=e.then))&&r},notify=function(e,r){if(!e.notified){e.notified=!0;var t=e.reactions;microtask((function(){for(var a=e.value,i=e.state==FULFILLED,s=0;t.length>s;){var c,l,u,p=t[s++],d=i?p.ok:p.fail,y=p.resolve,h=p.reject,A=p.domain;try{d?(i||(e.rejection===UNHANDLED&&onHandleUnhandled(e),e.rejection=HANDLED),!0===d?c=a:(A&&A.enter(),c=d(a),A&&(A.exit(),u=!0)),c===p.promise?h(TypeError$1("Promise-chain cycle")):(l=isThenable(c))?l.call(c,y,h):y(c)):h(a)}catch(e){A&&!u&&A.exit(),h(e)}}e.reactions=[],e.notified=!1,r&&!e.rejection&&onUnhandled(e)}))}},dispatchEvent=function(e,r,t){var a,i;DISPATCH_EVENT?((a=document$1.createEvent("Event")).promise=r,a.reason=t,a.initEvent(e,!1,!0),global$1.dispatchEvent(a)):a={promise:r,reason:t},!NATIVE_REJECTION_EVENT&&(i=global$1["on"+e])?i(a):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",t)},onUnhandled=function(e){task.call(global$1,(function(){var r,t=e.facade,a=e.value;if(isUnhandled(e)&&(r=perform((function(){engineIsNode?process.emit("unhandledRejection",a,t):dispatchEvent(UNHANDLED_REJECTION,t,a)})),e.rejection=engineIsNode||isUnhandled(e)?UNHANDLED:HANDLED,r.error))throw r.value}))},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e){task.call(global$1,(function(){var r=e.facade;engineIsNode?process.emit("rejectionHandled",r):dispatchEvent(REJECTION_HANDLED,r,e.value)}))},bind=function(e,r,t){return function(a){e(r,a,t)}},internalReject=function(e,r,t){e.done||(e.done=!0,t&&(e=t),e.value=r,e.state=REJECTED,notify(e,!0))},internalResolve=function(e,r,t){if(!e.done){e.done=!0,t&&(e=t);try{if(e.facade===r)throw TypeError$1("Promise can't be resolved itself");var a=isThenable(r);a?microtask((function(){var t={done:!1};try{a.call(r,bind(internalResolve,t,e),bind(internalReject,t,e))}catch(r){internalReject(t,r,e)}})):(e.value=r,e.state=FULFILLED,notify(e,!1))}catch(r){internalReject({done:!1},r,e)}}};if(FORCED$6&&(PromiseConstructor=function Promise(e){anInstance(this,PromiseConstructor,PROMISE),aFunction(e),Internal.call(this);var r=getInternalState$4(this);try{e(bind(internalResolve,r),bind(internalReject,r))}catch(e){internalReject(r,e)}},PromiseConstructorPrototype=PromiseConstructor.prototype,Internal=function Promise(e){setInternalState$5(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:PENDING,value:void 0})},Internal.prototype=redefineAll(PromiseConstructorPrototype,{then:function then(e,r){var t=getInternalPromiseState(this),a=newPromiseCapability(speciesConstructor(this,PromiseConstructor));return a.ok="function"!=typeof e||e,a.fail="function"==typeof r&&r,a.domain=engineIsNode?process.domain:void 0,t.parent=!0,t.reactions.push(a),t.state!=PENDING&¬ify(t,!1),a.promise},catch:function(e){return this.then(void 0,e)}}),OwnPromiseCapability=function(){var e=new Internal,r=getInternalState$4(e);this.promise=e,this.resolve=bind(internalResolve,r),this.reject=bind(internalReject,r)},newPromiseCapability$1.f=newPromiseCapability=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)},"function"==typeof nativePromiseConstructor&&NativePromisePrototype!==Object.prototype)){nativeThen=NativePromisePrototype.then,SUBCLASSING||(redefine(NativePromisePrototype,"then",(function then(e,r){var t=this;return new PromiseConstructor((function(e,r){nativeThen.call(t,e,r)})).then(e,r)}),{unsafe:!0}),redefine(NativePromisePrototype,"catch",PromiseConstructorPrototype.catch,{unsafe:!0}));try{delete NativePromisePrototype.constructor}catch(e){}objectSetPrototypeOf&&objectSetPrototypeOf(NativePromisePrototype,PromiseConstructorPrototype)}_export({global:!0,wrap:!0,forced:FORCED$6},{Promise:PromiseConstructor}),setToStringTag(PromiseConstructor,PROMISE,!1),setSpecies(PROMISE),PromiseWrapper=getBuiltIn(PROMISE),_export({target:PROMISE,stat:!0,forced:FORCED$6},{reject:function reject(e){var r=newPromiseCapability(this);return r.reject.call(void 0,e),r.promise}}),_export({target:PROMISE,stat:!0,forced:FORCED$6},{resolve:function resolve(e){return promiseResolve(this,e)}}),_export({target:PROMISE,stat:!0,forced:INCORRECT_ITERATION},{all:function all(e){var r=this,t=newPromiseCapability(r),a=t.resolve,i=t.reject,s=perform((function(){var t=aFunction(r.resolve),s=[],c=0,l=1;iterate(e,(function(e){var u=c++,p=!1;s.push(void 0),l++,t.call(r,e).then((function(e){p||(p=!0,s[u]=e,--l||a(s))}),i)})),--l||a(s)}));return s.error&&i(s.value),t.promise},race:function race(e){var r=this,t=newPromiseCapability(r),a=t.reject,i=perform((function(){var i=aFunction(r.resolve);iterate(e,(function(e){i.call(r,e).then(t.resolve,a)}))}));return i.error&&a(i.value),t.promise}});var inheritIfRequired=function(e,r,t){var a,i;return objectSetPrototypeOf&&"function"==typeof(a=r.constructor)&&a!==t&&isObject(i=a.prototype)&&i!==t.prototype&&objectSetPrototypeOf(e,i),e},objectKeys=Object.keys||function keys(e){return objectKeysInternal(e,enumBugKeys)},objectDefineProperties=descriptors?Object.defineProperties:function defineProperties(e,r){anObject(e);for(var t,a=objectKeys(r),i=a.length,s=0;i>s;)objectDefineProperty.f(e,t=a[s++],r[t]);return e},GT=">",LT="<",PROTOTYPE$1="prototype",SCRIPT="script",IE_PROTO$1=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return LT+SCRIPT+GT+e+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var r=e.parentWindow.Object;return e=null,r},NullProtoObjectViaIFrame=function(){var e,r=documentCreateElement("iframe"),t="java"+SCRIPT+":";if(r.style)return r.style.display="none",html.appendChild(r),r.src=String(t),(e=r.contentWindow.document).open(),e.write(scriptTag("document.F=Object")),e.close(),e.F},activeXDocument,NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject=document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame()||NullProtoObjectViaActiveX(activeXDocument);for(var e=enumBugKeys.length;e--;)delete NullProtoObject[PROTOTYPE$1][enumBugKeys[e]];return NullProtoObject()};hiddenKeys$1[IE_PROTO$1]=!0;var objectCreate=Object.create||function create(e,r){var t;return null!==e?(EmptyConstructor[PROTOTYPE$1]=anObject(e),t=new EmptyConstructor,EmptyConstructor[PROTOTYPE$1]=null,t[IE_PROTO$1]=e):t=NullProtoObject(),void 0===r?t:objectDefineProperties(t,r)},toString=function(e){if(isSymbol(e))throw TypeError("Cannot convert a Symbol value to a string");return String(e)},whitespaces="\t\n\v\f\r \u2028\u2029\ufeff",whitespace="["+whitespaces+"]",ltrim=RegExp("^"+whitespace+whitespace+"*"),rtrim=RegExp(whitespace+whitespace+"*$"),createMethod$4=function(e){return function(r){var t=toString(requireObjectCoercible(r));return 1&e&&(t=t.replace(ltrim,"")),2&e&&(t=t.replace(rtrim,"")),t}},stringTrim={start:createMethod$4(1),end:createMethod$4(2),trim:createMethod$4(3)},getOwnPropertyNames$1=objectGetOwnPropertyNames.f,getOwnPropertyDescriptor$1=objectGetOwnPropertyDescriptor.f,defineProperty$4=objectDefineProperty.f,trim=stringTrim.trim,NUMBER="Number",NativeNumber=global$1[NUMBER],NumberPrototype=NativeNumber.prototype,BROKEN_CLASSOF=classofRaw(objectCreate(NumberPrototype))==NUMBER,toNumber=function(e){if(isSymbol(e))throw TypeError("Cannot convert a Symbol value to a number");var r,t,a,i,s,c,l,u,p=toPrimitive(e,"number");if("string"==typeof p&&p.length>2)if(43===(r=(p=trim(p)).charCodeAt(0))||45===r){if(88===(t=p.charCodeAt(2))||120===t)return NaN}else if(48===r){switch(p.charCodeAt(1)){case 66:case 98:a=2,i=49;break;case 79:case 111:a=8,i=55;break;default:return+p}for(c=(s=p.slice(2)).length,l=0;l i)return NaN;return parseInt(s,a)}return+p};if(isForced_1(NUMBER,!NativeNumber(" 0o1")||!NativeNumber("0b1")||NativeNumber("+0x1"))){for(var NumberWrapper=function Number(e){var r=arguments.length<1?0:e,t=this;return t instanceof NumberWrapper&&(BROKEN_CLASSOF?fails((function(){NumberPrototype.valueOf.call(t)})):classofRaw(t)!=NUMBER)?inheritIfRequired(new NativeNumber(toNumber(r)),t,NumberWrapper):toNumber(r)},keys$1=descriptors?getOwnPropertyNames$1(NativeNumber):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),j$1=0,key$1;keys$1.length>j$1;j$1++)has$1(NativeNumber,key$1=keys$1[j$1])&&!has$1(NumberWrapper,key$1)&&defineProperty$4(NumberWrapper,key$1,getOwnPropertyDescriptor$1(NativeNumber,key$1));NumberWrapper.prototype=NumberPrototype,NumberPrototype.constructor=NumberWrapper,redefine(global$1,NUMBER,NumberWrapper)}var defineProperty$3=objectDefineProperty.f,FunctionPrototype=Function.prototype,FunctionPrototypeToString=FunctionPrototype.toString,nameRE=/^\s*function ([^ (]*)/,NAME$1="name";descriptors&&!(NAME$1 in FunctionPrototype)&&defineProperty$3(FunctionPrototype,NAME$1,{configurable:!0,get:function(){try{return FunctionPrototypeToString.call(this).match(nameRE)[1]}catch(e){return""}}}),_export({global:!0},{globalThis:global$1});var $assign=Object.assign,defineProperty$2=Object.defineProperty,objectAssign=!$assign||fails((function(){if(descriptors&&1!==$assign({b:1},$assign(defineProperty$2({},"a",{enumerable:!0,get:function(){defineProperty$2(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},r={},t=Symbol();return e[t]=7,"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),7!=$assign({},e)[t]||"abcdefghijklmnopqrst"!=objectKeys($assign({},r)).join("")}))?function assign(e,r){for(var t=toObject(e),a=arguments.length,i=1,s=objectGetOwnPropertySymbols.f,c=objectPropertyIsEnumerable.f;a>i;)for(var l,u=indexedObject(arguments[i++]),p=s?objectKeys(u).concat(s(u)):objectKeys(u),d=p.length,y=0;d>y;)l=p[y++],descriptors&&!c.call(u,l)||(t[l]=u[l]);return t}:$assign;_export({target:"Object",stat:!0,forced:Object.assign!==objectAssign},{assign:objectAssign});var path=global$1;path.Object.assign;var regexpFlags=function(){var e=anObject(this),r="";return e.global&&(r+="g"),e.ignoreCase&&(r+="i"),e.multiline&&(r+="m"),e.dotAll&&(r+="s"),e.unicode&&(r+="u"),e.sticky&&(r+="y"),r},RE=function(e,r){return RegExp(e,r)},UNSUPPORTED_Y$2=fails((function(){var e=RE("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),BROKEN_CARET=fails((function(){var e=RE("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),regexpStickyHelpers={UNSUPPORTED_Y:UNSUPPORTED_Y$2,BROKEN_CARET:BROKEN_CARET},regexpUnsupportedDotAll=fails((function(){var e=RegExp(".","string".charAt(0));return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),regexpUnsupportedNcg=fails((function(){var e=RegExp("(?b)","string".charAt(5));return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$c")})),getInternalState$3=internalState.get,nativeExec=RegExp.prototype.exec,nativeReplace=shared("native-string-replace",String.prototype.replace),patchedExec=nativeExec,UPDATES_LAST_INDEX_WRONG=(re1=/a/,re2=/b*/g,nativeExec.call(re1,"a"),nativeExec.call(re2,"a"),0!==re1.lastIndex||0!==re2.lastIndex),re1,re2,UNSUPPORTED_Y$1=regexpStickyHelpers.UNSUPPORTED_Y||regexpStickyHelpers.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y$1||regexpUnsupportedDotAll||regexpUnsupportedNcg;PATCH&&(patchedExec=function exec(e){var r,t,a,i,s,c,l,u=this,p=getInternalState$3(u),d=toString(e),y=p.raw;if(y)return y.lastIndex=u.lastIndex,r=patchedExec.call(y,d),u.lastIndex=y.lastIndex,r;var h=p.groups,A=UNSUPPORTED_Y$1&&u.sticky,g=regexpFlags.call(u),v=u.source,m=0,E=d;if(A&&(-1===(g=g.replace("y","")).indexOf("g")&&(g+="g"),E=d.slice(u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==d.charAt(u.lastIndex-1))&&(v="(?: "+v+")",E=" "+E,m++),t=new RegExp("^(?:"+v+")",g)),NPCG_INCLUDED&&(t=new RegExp("^"+v+"$(?!\\s)",g)),UPDATES_LAST_INDEX_WRONG&&(a=u.lastIndex),i=nativeExec.call(A?t:u,E),A?i?(i.input=i.input.slice(m),i[0]=i[0].slice(m),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&i&&(u.lastIndex=u.global?i.index+i[0].length:a),NPCG_INCLUDED&&i&&i.length>1&&nativeReplace.call(i[0],t,(function(){for(s=1;s =l?e?"":void 0:(a=s.charCodeAt(c))<55296||a>56319||c+1===l||(i=s.charCodeAt(c+1))<56320||i>57343?e?s.charAt(c):a:e?s.slice(c,c+2):i-56320+(a-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$3(!1),charAt:createMethod$3(!0)},charAt$1=stringMultibyte.charAt,advanceStringIndex=function(e,r,t){return r+(t?charAt$1(e,r).length:1)},regexpExecAbstract=function(e,r){var t=e.exec;if("function"==typeof t){var a=t.call(e,r);if("object"!=typeof a)throw TypeError("RegExp exec method returned something other than an Object or null");return a}if("RegExp"!==classofRaw(e))throw TypeError("RegExp#exec called on incompatible receiver");return regexpExec.call(e,r)},UNSUPPORTED_Y=regexpStickyHelpers.UNSUPPORTED_Y,arrayPush=[].push,min$4=Math.min,MAX_UINT32=4294967295,SPLIT_WORKS_WITH_OVERWRITTEN_EXEC=!fails((function(){var e=/(?:)/,r=e.exec;e.exec=function(){return r.apply(this,arguments)};var t="ab".split(e);return 2!==t.length||"a"!==t[0]||"b"!==t[1]}));fixRegexpWellKnownSymbolLogic("split",(function(e,r,t){var a;return a="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,t){var a=toString(requireObjectCoercible(this)),i=void 0===t?MAX_UINT32:t>>>0;if(0===i)return[];if(void 0===e)return[a];if(!isRegexp(e))return r.call(a,e,i);for(var s,c,l,u=[],p=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,y=new RegExp(e.source,p+"g");(s=regexpExec.call(y,a))&&!((c=y.lastIndex)>d&&(u.push(a.slice(d,s.index)),s.length>1&&s.index =i));)y.lastIndex===s.index&&y.lastIndex++;return d===a.length?!l&&y.test("")||u.push(""):u.push(a.slice(d)),u.length>i?u.slice(0,i):u}:"0".split(void 0,0).length?function(e,t){return void 0===e&&0===t?[]:r.call(this,e,t)}:r,[function split(r,t){var i=requireObjectCoercible(this),s=null==r?void 0:r[e];return void 0!==s?s.call(r,i,t):a.call(toString(i),r,t)},function(e,i){var s=anObject(this),c=toString(e),l=t(a,s,c,i,a!==r);if(l.done)return l.value;var u=speciesConstructor(s,RegExp),p=s.unicode,d=(s.ignoreCase?"i":"")+(s.multiline?"m":"")+(s.unicode?"u":"")+(UNSUPPORTED_Y?"g":"y"),y=new u(UNSUPPORTED_Y?"^(?:"+s.source+")":s,d),h=void 0===i?MAX_UINT32:i>>>0;if(0===h)return[];if(0===c.length)return null===regexpExecAbstract(y,c)?[c]:[];for(var A=0,g=0,v=[];g =r.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==t?{value:a,done:!1}:"values"==t?{value:r[a],done:!1}:{value:[a,r[a]],done:!1}}),"values");iterators.Arguments=iterators.Array,addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries");var arrayBufferNative="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,defineProperty$1=objectDefineProperty.f,Int8Array$3=global$1.Int8Array,Int8ArrayPrototype=Int8Array$3&&Int8Array$3.prototype,Uint8ClampedArray=global$1.Uint8ClampedArray,Uint8ClampedArrayPrototype=Uint8ClampedArray&&Uint8ClampedArray.prototype,TypedArray=Int8Array$3&&objectGetPrototypeOf(Int8Array$3),TypedArrayPrototype=Int8ArrayPrototype&&objectGetPrototypeOf(Int8ArrayPrototype),ObjectPrototype$1=Object.prototype,isPrototypeOf=ObjectPrototype$1.isPrototypeOf,TO_STRING_TAG$1=wellKnownSymbol("toStringTag"),TYPED_ARRAY_TAG=uid("TYPED_ARRAY_TAG"),TYPED_ARRAY_CONSTRUCTOR$1=uid("TYPED_ARRAY_CONSTRUCTOR"),NATIVE_ARRAY_BUFFER_VIEWS$1=arrayBufferNative&&!!objectSetPrototypeOf&&"Opera"!==classof(global$1.opera),TYPED_ARRAY_TAG_REQIRED=!1,NAME,Constructor,Prototype,TypedArrayConstructorsList={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},BigIntArrayConstructorsList={BigInt64Array:8,BigUint64Array:8},isView=function isView(e){if(!isObject(e))return!1;var r=classof(e);return"DataView"===r||has$1(TypedArrayConstructorsList,r)||has$1(BigIntArrayConstructorsList,r)},isTypedArray=function(e){if(!isObject(e))return!1;var r=classof(e);return has$1(TypedArrayConstructorsList,r)||has$1(BigIntArrayConstructorsList,r)},aTypedArray$m=function(e){if(isTypedArray(e))return e;throw TypeError("Target is not a typed array")},aTypedArrayConstructor$2=function(e){if(objectSetPrototypeOf&&!isPrototypeOf.call(TypedArray,e))throw TypeError("Target is not a typed array constructor");return e},exportTypedArrayMethod$n=function(e,r,t){if(descriptors){if(t)for(var a in TypedArrayConstructorsList){var i=global$1[a];if(i&&has$1(i.prototype,e))try{delete i.prototype[e]}catch(e){}}TypedArrayPrototype[e]&&!t||redefine(TypedArrayPrototype,e,t?r:NATIVE_ARRAY_BUFFER_VIEWS$1&&Int8ArrayPrototype[e]||r)}},exportTypedArrayStaticMethod=function(e,r,t){var a,i;if(descriptors){if(objectSetPrototypeOf){if(t)for(a in TypedArrayConstructorsList)if((i=global$1[a])&&has$1(i,e))try{delete i[e]}catch(e){}if(TypedArray[e]&&!t)return;try{return redefine(TypedArray,e,t?r:NATIVE_ARRAY_BUFFER_VIEWS$1&&TypedArray[e]||r)}catch(e){}}for(a in TypedArrayConstructorsList)!(i=global$1[a])||i[e]&&!t||redefine(i,e,r)}};for(NAME in TypedArrayConstructorsList)Constructor=global$1[NAME],Prototype=Constructor&&Constructor.prototype,Prototype?createNonEnumerableProperty(Prototype,TYPED_ARRAY_CONSTRUCTOR$1,Constructor):NATIVE_ARRAY_BUFFER_VIEWS$1=!1;for(NAME in BigIntArrayConstructorsList)Constructor=global$1[NAME],Prototype=Constructor&&Constructor.prototype,Prototype&&createNonEnumerableProperty(Prototype,TYPED_ARRAY_CONSTRUCTOR$1,Constructor);if((!NATIVE_ARRAY_BUFFER_VIEWS$1||"function"!=typeof TypedArray||TypedArray===Function.prototype)&&(TypedArray=function TypedArray(){throw TypeError("Incorrect invocation")},NATIVE_ARRAY_BUFFER_VIEWS$1))for(NAME in TypedArrayConstructorsList)global$1[NAME]&&objectSetPrototypeOf(global$1[NAME],TypedArray);if((!NATIVE_ARRAY_BUFFER_VIEWS$1||!TypedArrayPrototype||TypedArrayPrototype===ObjectPrototype$1)&&(TypedArrayPrototype=TypedArray.prototype,NATIVE_ARRAY_BUFFER_VIEWS$1))for(NAME in TypedArrayConstructorsList)global$1[NAME]&&objectSetPrototypeOf(global$1[NAME].prototype,TypedArrayPrototype);if(NATIVE_ARRAY_BUFFER_VIEWS$1&&objectGetPrototypeOf(Uint8ClampedArrayPrototype)!==TypedArrayPrototype&&objectSetPrototypeOf(Uint8ClampedArrayPrototype,TypedArrayPrototype),descriptors&&!has$1(TypedArrayPrototype,TO_STRING_TAG$1))for(NAME in TYPED_ARRAY_TAG_REQIRED=!0,defineProperty$1(TypedArrayPrototype,TO_STRING_TAG$1,{get:function(){return isObject(this)?this[TYPED_ARRAY_TAG]:void 0}}),TypedArrayConstructorsList)global$1[NAME]&&createNonEnumerableProperty(global$1[NAME],TYPED_ARRAY_TAG,NAME);var arrayBufferViewCore={NATIVE_ARRAY_BUFFER_VIEWS:NATIVE_ARRAY_BUFFER_VIEWS$1,TYPED_ARRAY_CONSTRUCTOR:TYPED_ARRAY_CONSTRUCTOR$1,TYPED_ARRAY_TAG:TYPED_ARRAY_TAG_REQIRED&&TYPED_ARRAY_TAG,aTypedArray:aTypedArray$m,aTypedArrayConstructor:aTypedArrayConstructor$2,exportTypedArrayMethod:exportTypedArrayMethod$n,exportTypedArrayStaticMethod:exportTypedArrayStaticMethod,isView:isView,isTypedArray:isTypedArray,TypedArray:TypedArray,TypedArrayPrototype:TypedArrayPrototype},NATIVE_ARRAY_BUFFER_VIEWS=arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS,ArrayBuffer$1=global$1.ArrayBuffer,Int8Array$2=global$1.Int8Array,typedArrayConstructorsRequireWrappers=!NATIVE_ARRAY_BUFFER_VIEWS||!fails((function(){Int8Array$2(1)}))||!fails((function(){new Int8Array$2(-1)}))||!checkCorrectnessOfIteration((function(e){new Int8Array$2,new Int8Array$2(null),new Int8Array$2(1.5),new Int8Array$2(e)}),!0)||fails((function(){return 1!==new Int8Array$2(new ArrayBuffer$1(2),1,void 0).length})),toIndex=function(e){if(void 0===e)return 0;var r=toInteger(e),t=toLength(r);if(r!==t)throw RangeError("Wrong length or index");return t},abs=Math.abs,pow$1=Math.pow,floor$6=Math.floor,log=Math.log,LN2=Math.LN2,pack=function(e,r,t){var a,i,s,c=new Array(t),l=8*t-r-1,u=(1< >1,d=23===r?pow$1(2,-24)-pow$1(2,-77):0,y=e<0||0===e&&1/e<0?1:0,h=0;for((e=abs(e))!=e||e===1/0?(i=e!=e?1:0,a=u):(a=floor$6(log(e)/LN2),e*(s=pow$1(2,-a))<1&&(a--,s*=2),(e+=a+p>=1?d/s:d*pow$1(2,1-p))*s>=2&&(a++,s/=2),a+p>=u?(i=0,a=u):a+p>=1?(i=(e*s-1)*pow$1(2,r),a+=p):(i=e*pow$1(2,p-1)*pow$1(2,r),a=0));r>=8;c[h++]=255&i,i/=256,r-=8);for(a=a< 0;c[h++]=255&a,a/=256,l-=8);return c[--h]|=128*y,c},unpack=function(e,r){var t,a=e.length,i=8*a-r-1,s=(1<>1,l=i-7,u=a-1,p=e[u--],d=127&p;for(p>>=7;l>0;d=256*d+e[u],u--,l-=8);for(t=d&(1<<-l)-1,d>>=-l,l+=r;l>0;t=256*t+e[u],u--,l-=8);if(0===d)d=1-c;else{if(d===s)return t?NaN:p?-1/0:1/0;t+=pow$1(2,r),d-=c}return(p?-1:1)*t*pow$1(2,d-r)},ieee754={pack:pack,unpack:unpack},arrayFill=function fill(e){for(var r=toObject(this),t=toLength(r.length),a=arguments.length,i=toAbsoluteIndex(a>1?arguments[1]:void 0,t),s=a>2?arguments[2]:void 0,c=void 0===s?t:toAbsoluteIndex(s,t);c>i;)r[i++]=e;return r},getOwnPropertyNames=objectGetOwnPropertyNames.f,defineProperty=objectDefineProperty.f,getInternalState$1=internalState.get,setInternalState$3=internalState.set,ARRAY_BUFFER="ArrayBuffer",DATA_VIEW="DataView",PROTOTYPE="prototype",WRONG_LENGTH="Wrong length",WRONG_INDEX="Wrong index",NativeArrayBuffer=global$1[ARRAY_BUFFER],$ArrayBuffer=NativeArrayBuffer,$DataView=global$1[DATA_VIEW],$DataViewPrototype=$DataView&&$DataView[PROTOTYPE],ObjectPrototype=Object.prototype,RangeError$1=global$1.RangeError,packIEEE754=ieee754.pack,unpackIEEE754=ieee754.unpack,packInt8=function(e){return[255&e]},packInt16=function(e){return[255&e,e>>8&255]},packInt32=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},unpackInt32=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},packFloat32=function(e){return packIEEE754(e,23,4)},packFloat64=function(e){return packIEEE754(e,52,8)},addGetter=function(e,r){defineProperty(e[PROTOTYPE],r,{get:function(){return getInternalState$1(this)[r]}})},get=function(e,r,t,a){var i=toIndex(t),s=getInternalState$1(e);if(i+r>s.byteLength)throw RangeError$1(WRONG_INDEX);var c=getInternalState$1(s.buffer).bytes,l=i+s.byteOffset,u=c.slice(l,l+r);return a?u:u.reverse()},set=function(e,r,t,a,i,s){var c=toIndex(t),l=getInternalState$1(e);if(c+r>l.byteLength)throw RangeError$1(WRONG_INDEX);for(var u=getInternalState$1(l.buffer).bytes,p=c+l.byteOffset,d=a(+i),y=0;y j;)(key=keys[j++])in $ArrayBuffer||createNonEnumerableProperty($ArrayBuffer,key,NativeArrayBuffer[key]);ArrayBufferPrototype.constructor=$ArrayBuffer}objectSetPrototypeOf&&objectGetPrototypeOf($DataViewPrototype)!==ObjectPrototype&&objectSetPrototypeOf($DataViewPrototype,ObjectPrototype);var testView=new $DataView(new $ArrayBuffer(2)),$setInt8=$DataViewPrototype.setInt8;testView.setInt8(0,2147483648),testView.setInt8(1,2147483649),!testView.getInt8(0)&&testView.getInt8(1)||redefineAll($DataViewPrototype,{setInt8:function setInt8(e,r){$setInt8.call(this,e,r<<24>>24)},setUint8:function setUint8(e,r){$setInt8.call(this,e,r<<24>>24)}},{unsafe:!0})}else $ArrayBuffer=function ArrayBuffer(e){anInstance(this,$ArrayBuffer,ARRAY_BUFFER);var r=toIndex(e);setInternalState$3(this,{bytes:arrayFill.call(new Array(r),0),byteLength:r}),descriptors||(this.byteLength=r)},$DataView=function DataView(e,r,t){anInstance(this,$DataView,DATA_VIEW),anInstance(e,$ArrayBuffer,DATA_VIEW);var a=getInternalState$1(e).byteLength,i=toInteger(r);if(i<0||i>a)throw RangeError$1("Wrong offset");if(i+(t=void 0===t?a-i:toLength(t))>a)throw RangeError$1(WRONG_LENGTH);setInternalState$3(this,{buffer:e,byteLength:t,byteOffset:i}),descriptors||(this.buffer=e,this.byteLength=t,this.byteOffset=i)},descriptors&&(addGetter($ArrayBuffer,"byteLength"),addGetter($DataView,"buffer"),addGetter($DataView,"byteLength"),addGetter($DataView,"byteOffset")),redefineAll($DataView[PROTOTYPE],{getInt8:function getInt8(e){return get(this,1,e)[0]<<24>>24},getUint8:function getUint8(e){return get(this,1,e)[0]},getInt16:function getInt16(e){var r=get(this,2,e,arguments.length>1?arguments[1]:void 0);return(r[1]<<8|r[0])<<16>>16},getUint16:function getUint16(e){var r=get(this,2,e,arguments.length>1?arguments[1]:void 0);return r[1]<<8|r[0]},getInt32:function getInt32(e){return unpackInt32(get(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function getUint32(e){return unpackInt32(get(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function getFloat32(e){return unpackIEEE754(get(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function getFloat64(e){return unpackIEEE754(get(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function setInt8(e,r){set(this,1,e,packInt8,r)},setUint8:function setUint8(e,r){set(this,1,e,packInt8,r)},setInt16:function setInt16(e,r){set(this,2,e,packInt16,r,arguments.length>2?arguments[2]:void 0)},setUint16:function setUint16(e,r){set(this,2,e,packInt16,r,arguments.length>2?arguments[2]:void 0)},setInt32:function setInt32(e,r){set(this,4,e,packInt32,r,arguments.length>2?arguments[2]:void 0)},setUint32:function setUint32(e,r){set(this,4,e,packInt32,r,arguments.length>2?arguments[2]:void 0)},setFloat32:function setFloat32(e,r){set(this,4,e,packFloat32,r,arguments.length>2?arguments[2]:void 0)},setFloat64:function setFloat64(e,r){set(this,8,e,packFloat64,r,arguments.length>2?arguments[2]:void 0)}});setToStringTag($ArrayBuffer,ARRAY_BUFFER),setToStringTag($DataView,DATA_VIEW);var arrayBuffer={ArrayBuffer:$ArrayBuffer,DataView:$DataView},floor$5=Math.floor,isInteger=function isInteger(e){return!isObject(e)&&isFinite(e)&&floor$5(e)===e},toPositiveInteger=function(e){var r=toInteger(e);if(r<0)throw RangeError("The argument can't be less than 0");return r},toOffset=function(e,r){var t=toPositiveInteger(e);if(t%r)throw RangeError("Wrong offset");return t},aTypedArrayConstructor$1=arrayBufferViewCore.aTypedArrayConstructor,typedArrayFrom=function from(e){var r,t,a,i,s,c,l=toObject(e),u=arguments.length,p=u>1?arguments[1]:void 0,d=void 0!==p,y=getIteratorMethod(l);if(null!=y&&!isArrayIteratorMethod(y))for(c=(s=y.call(l)).next,l=[];!(i=c.call(s)).done;)l.push(i.value);for(d&&u>2&&(p=functionBindContext(p,arguments[2],2)),t=toLength(l.length),a=new(aTypedArrayConstructor$1(this))(t),r=0;t>r;r++)a[r]=d?p(l[r],r):l[r];return a},isArray=Array.isArray||function isArray(e){return"Array"==classofRaw(e)},SPECIES$2=wellKnownSymbol("species"),arraySpeciesConstructor=function(e){var r;return isArray(e)&&("function"!=typeof(r=e.constructor)||r!==Array&&!isArray(r.prototype)?isObject(r)&&null===(r=r[SPECIES$2])&&(r=void 0):r=void 0),void 0===r?Array:r},arraySpeciesCreate=function(e,r){return new(arraySpeciesConstructor(e))(0===r?0:r)},push=[].push,createMethod$2=function(e){var r=1==e,t=2==e,a=3==e,i=4==e,s=6==e,c=7==e,l=5==e||s;return function(u,p,d,y){for(var h,A,g=toObject(u),v=indexedObject(g),m=functionBindContext(p,d,3),E=toLength(v.length),I=0,P=y||arraySpeciesCreate,T=r?P(u,E):t||c?P(u,0):void 0;E>I;I++)if((l||I in v)&&(A=m(h=v[I],I,g),e))if(r)T[I]=A;else if(A)switch(e){case 3:return!0;case 5:return h;case 6:return I;case 2:push.call(T,h)}else switch(e){case 4:return!1;case 7:push.call(T,h)}return s?-1:a||i?i:T}},arrayIteration={forEach:createMethod$2(0),map:createMethod$2(1),filter:createMethod$2(2),some:createMethod$2(3),every:createMethod$2(4),find:createMethod$2(5),findIndex:createMethod$2(6),filterReject:createMethod$2(7)},typedArrayConstructor=createCommonjsModule((function(e){var r=objectGetOwnPropertyNames.f,t=arrayIteration.forEach,a=internalState.get,i=internalState.set,s=objectDefineProperty.f,c=objectGetOwnPropertyDescriptor.f,l=Math.round,u=global$1.RangeError,p=arrayBuffer.ArrayBuffer,d=arrayBuffer.DataView,y=arrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS,h=arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR,A=arrayBufferViewCore.TYPED_ARRAY_TAG,g=arrayBufferViewCore.TypedArray,v=arrayBufferViewCore.TypedArrayPrototype,m=arrayBufferViewCore.aTypedArrayConstructor,E=arrayBufferViewCore.isTypedArray,fromList=function(e,r){for(var t=0,a=r.length,i=new(m(e))(a);a>t;)i[t]=r[t++];return i},addGetter=function(e,r){s(e,r,{get:function(){return a(this)[r]}})},isArrayBuffer=function(e){var r;return e instanceof p||"ArrayBuffer"==(r=classof(e))||"SharedArrayBuffer"==r},isTypedArrayIndex=function(e,r){return E(e)&&!isSymbol(r)&&r in e&&isInteger(+r)&&r>=0},I=function getOwnPropertyDescriptor(e,r){return r=toPropertyKey(r),isTypedArrayIndex(e,r)?createPropertyDescriptor(2,e[r]):c(e,r)},P=function defineProperty(e,r,t){return r=toPropertyKey(r),!(isTypedArrayIndex(e,r)&&isObject(t)&&has$1(t,"value"))||has$1(t,"get")||has$1(t,"set")||t.configurable||has$1(t,"writable")&&!t.writable||has$1(t,"enumerable")&&!t.enumerable?s(e,r,t):(e[r]=t.value,e)};descriptors?(y||(objectGetOwnPropertyDescriptor.f=I,objectDefineProperty.f=P,addGetter(v,"buffer"),addGetter(v,"byteOffset"),addGetter(v,"byteLength"),addGetter(v,"length")),_export({target:"Object",stat:!0,forced:!y},{getOwnPropertyDescriptor:I,defineProperty:P}),e.exports=function(e,c,m){var I=e.match(/\d+$/)[0]/8,P=e+(m?"Clamped":"")+"Array",T="get"+e,b="set"+e,S=global$1[P],R=S,_=R&&R.prototype,w={},addElement=function(e,r){s(e,r,{get:function(){return function(e,r){var t=a(e);return t.view[T](r*I+t.byteOffset,!0)}(this,r)},set:function(e){return function(e,r,t){var i=a(e);m&&(t=(t=l(t))<0?0:t>255?255:255&t),i.view[b](r*I+i.byteOffset,t,!0)}(this,r,e)},enumerable:!0})};y?typedArrayConstructorsRequireWrappers&&(R=c((function(e,r,t,a){return anInstance(e,R,P),inheritIfRequired(isObject(r)?isArrayBuffer(r)?void 0!==a?new S(r,toOffset(t,I),a):void 0!==t?new S(r,toOffset(t,I)):new S(r):E(r)?fromList(R,r):typedArrayFrom.call(R,r):new S(toIndex(r)),e,R)})),objectSetPrototypeOf&&objectSetPrototypeOf(R,g),t(r(S),(function(e){e in R||createNonEnumerableProperty(R,e,S[e])})),R.prototype=_):(R=c((function(e,r,t,a){anInstance(e,R,P);var s,c,l,y=0,h=0;if(isObject(r)){if(!isArrayBuffer(r))return E(r)?fromList(R,r):typedArrayFrom.call(R,r);s=r,h=toOffset(t,I);var A=r.byteLength;if(void 0===a){if(A%I)throw u("Wrong length");if((c=A-h)<0)throw u("Wrong length")}else if((c=toLength(a)*I)+h>A)throw u("Wrong length");l=c/I}else l=toIndex(r),s=new p(c=l*I);for(i(e,{buffer:s,byteOffset:h,byteLength:c,length:l,view:new d(s)});y 2?arguments[2]:void 0,l=min$3((void 0===c?a:toAbsoluteIndex(c,a))-s,a-i),u=1;for(s0;)s in t?t[i]=t[s]:delete t[i],i+=u,s+=u;return t},aTypedArray$l=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$m=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$m("copyWithin",(function copyWithin(e,r){return arrayCopyWithin.call(aTypedArray$l(this),e,r,arguments.length>2?arguments[2]:void 0)}));var $every=arrayIteration.every,aTypedArray$k=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$l=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$l("every",(function every(e){return $every(aTypedArray$k(this),e,arguments.length>1?arguments[1]:void 0)}));var aTypedArray$j=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$k=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$k("fill",(function fill(e){return arrayFill.apply(aTypedArray$j(this),arguments)}));var arrayFromConstructorAndList=function(e,r){for(var t=0,a=r.length,i=new e(a);a>t;)i[t]=r[t++];return i},TYPED_ARRAY_CONSTRUCTOR=arrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR,aTypedArrayConstructor=arrayBufferViewCore.aTypedArrayConstructor,typedArraySpeciesConstructor=function(e){return aTypedArrayConstructor(speciesConstructor(e,e[TYPED_ARRAY_CONSTRUCTOR]))},typedArrayFromSpeciesAndList=function(e,r){return arrayFromConstructorAndList(typedArraySpeciesConstructor(e),r)},$filter$1=arrayIteration.filter,aTypedArray$i=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$j=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$j("filter",(function filter(e){var r=$filter$1(aTypedArray$i(this),e,arguments.length>1?arguments[1]:void 0);return typedArrayFromSpeciesAndList(this,r)}));var $find=arrayIteration.find,aTypedArray$h=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$i=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$i("find",(function find(e){return $find(aTypedArray$h(this),e,arguments.length>1?arguments[1]:void 0)}));var $findIndex=arrayIteration.findIndex,aTypedArray$g=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$h=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$h("findIndex",(function findIndex(e){return $findIndex(aTypedArray$g(this),e,arguments.length>1?arguments[1]:void 0)}));var $forEach$1=arrayIteration.forEach,aTypedArray$f=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$g=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$g("forEach",(function forEach(e){$forEach$1(aTypedArray$f(this),e,arguments.length>1?arguments[1]:void 0)}));var $includes=arrayIncludes.includes,aTypedArray$e=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$f=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$f("includes",(function includes(e){return $includes(aTypedArray$e(this),e,arguments.length>1?arguments[1]:void 0)}));var $indexOf=arrayIncludes.indexOf,aTypedArray$d=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$e=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$e("indexOf",(function indexOf(e){return $indexOf(aTypedArray$d(this),e,arguments.length>1?arguments[1]:void 0)}));var ITERATOR$3=wellKnownSymbol("iterator"),Uint8Array$2=global$1.Uint8Array,arrayValues=es_array_iterator.values,arrayKeys=es_array_iterator.keys,arrayEntries=es_array_iterator.entries,aTypedArray$c=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$d=arrayBufferViewCore.exportTypedArrayMethod,nativeTypedArrayIterator=Uint8Array$2&&Uint8Array$2.prototype[ITERATOR$3],CORRECT_ITER_NAME=!!nativeTypedArrayIterator&&("values"==nativeTypedArrayIterator.name||null==nativeTypedArrayIterator.name),typedArrayValues=function values(){return arrayValues.call(aTypedArray$c(this))};exportTypedArrayMethod$d("entries",(function entries(){return arrayEntries.call(aTypedArray$c(this))})),exportTypedArrayMethod$d("keys",(function keys(){return arrayKeys.call(aTypedArray$c(this))})),exportTypedArrayMethod$d("values",typedArrayValues,!CORRECT_ITER_NAME),exportTypedArrayMethod$d(ITERATOR$3,typedArrayValues,!CORRECT_ITER_NAME);var aTypedArray$b=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$c=arrayBufferViewCore.exportTypedArrayMethod,$join=[].join;exportTypedArrayMethod$c("join",(function join(e){return $join.apply(aTypedArray$b(this),arguments)}));var arrayMethodIsStrict=function(e,r){var t=[][e];return!!t&&fails((function(){t.call(null,r||function(){throw 1},1)}))},min$2=Math.min,$lastIndexOf=[].lastIndexOf,NEGATIVE_ZERO=!!$lastIndexOf&&1/[1].lastIndexOf(1,-0)<0,STRICT_METHOD$2=arrayMethodIsStrict("lastIndexOf"),FORCED$5=NEGATIVE_ZERO||!STRICT_METHOD$2,arrayLastIndexOf=FORCED$5?function lastIndexOf(e){if(NEGATIVE_ZERO)return $lastIndexOf.apply(this,arguments)||0;var r=toIndexedObject(this),t=toLength(r.length),a=t-1;for(arguments.length>1&&(a=min$2(a,toInteger(arguments[1]))),a<0&&(a=t+a);a>=0;a--)if(a in r&&r[a]===e)return a||0;return-1}:$lastIndexOf,aTypedArray$a=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$b=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$b("lastIndexOf",(function lastIndexOf(e){return arrayLastIndexOf.apply(aTypedArray$a(this),arguments)}));var $map=arrayIteration.map,aTypedArray$9=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$a=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$a("map",(function map(e){return $map(aTypedArray$9(this),e,arguments.length>1?arguments[1]:void 0,(function(e,r){return new(typedArraySpeciesConstructor(e))(r)}))}));var createMethod$1=function(e){return function(r,t,a,i){aFunction(t);var s=toObject(r),c=indexedObject(s),l=toLength(s.length),u=e?l-1:0,p=e?-1:1;if(a<2)for(;;){if(u in c){i=c[u],u+=p;break}if(u+=p,e?u<0:l<=u)throw TypeError("Reduce of empty array with no initial value")}for(;e?u>=0:l>u;u+=p)u in c&&(i=t(i,c[u],u,s));return i}},arrayReduce={left:createMethod$1(!1),right:createMethod$1(!0)},$reduce=arrayReduce.left,aTypedArray$8=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$9=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$9("reduce",(function reduce(e){return $reduce(aTypedArray$8(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var $reduceRight=arrayReduce.right,aTypedArray$7=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$8=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$8("reduceRight",(function reduceRight(e){return $reduceRight(aTypedArray$7(this),e,arguments.length,arguments.length>1?arguments[1]:void 0)}));var aTypedArray$6=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$7=arrayBufferViewCore.exportTypedArrayMethod,floor$4=Math.floor;exportTypedArrayMethod$7("reverse",(function reverse(){for(var e,r=aTypedArray$6(this).length,t=floor$4(r/2),a=0;a 1?arguments[1]:void 0,1),t=this.length,a=toObject(e),i=toLength(a.length),s=0;if(i+r>t)throw RangeError("Wrong length");for(;si;)c[i]=t[i++];return c}),FORCED$3);var $some=arrayIteration.some,aTypedArray$3=arrayBufferViewCore.aTypedArray,exportTypedArrayMethod$4=arrayBufferViewCore.exportTypedArrayMethod;exportTypedArrayMethod$4("some",(function some(e){return $some(aTypedArray$3(this),e,arguments.length>1?arguments[1]:void 0)}));var floor$3=Math.floor,mergeSort=function(e,r){var t=e.length,a=floor$3(t/2);return t<8?insertionSort(e,r):merge(mergeSort(e.slice(0,a),r),mergeSort(e.slice(a),r),r)},insertionSort=function(e,r){for(var t,a,i=e.length,s=1;s0;)e[a]=e[--a];a!==s++&&(e[a]=t)}return e},merge=function(e,r,t){for(var a=e.length,i=r.length,s=0,c=0,l=[];s0&&1/t<0?1:-1:r>t}};exportTypedArrayMethod$3("sort",(function sort(e){if(void 0!==e&&aFunction(e),STABLE_SORT$1)return nativeSort$1.call(this,e);aTypedArray$2(this);var r,t=toLength(this.length),a=Array(t);for(r=0;r =51||!fails((function(){var r=[];return(r.constructor={})[SPECIES$1]=function(){return{foo:1}},1!==r[e](Boolean).foo}))},HAS_SPECIES_SUPPORT$1=arrayMethodHasSpeciesSupport("slice"),SPECIES=wellKnownSymbol("species"),nativeSlice=[].slice,max$1=Math.max;_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$1},{slice:function slice(e,r){var t,a,i,s=toIndexedObject(this),c=toLength(s.length),l=toAbsoluteIndex(e,c),u=toAbsoluteIndex(void 0===r?c:r,c);if(isArray(s)&&("function"!=typeof(t=s.constructor)||t!==Array&&!isArray(t.prototype)?isObject(t)&&null===(t=t[SPECIES])&&(t=void 0):t=void 0,t===Array||void 0===t))return nativeSlice.call(s,l,u);for(a=new(void 0===t?Array:t)(max$1(u-l,0)),i=0;l1?arguments[1]:void 0)}});var TO_STRING="toString",RegExpPrototype=RegExp.prototype,nativeToString=RegExpPrototype[TO_STRING],NOT_GENERIC=fails((function(){return"/a/b"!=nativeToString.call({source:"a",flags:"b"})})),INCORRECT_NAME=nativeToString.name!=TO_STRING;(NOT_GENERIC||INCORRECT_NAME)&&redefine(RegExp.prototype,TO_STRING,(function toString$1(){var e=anObject(this),r=toString(e.source),t=e.flags;return"/"+r+"/"+toString(void 0===t&&e instanceof RegExp&&!("flags"in RegExpPrototype)?regexpFlags.call(e):t)}),{unsafe:!0});var test=[],nativeSort=test.sort,FAILS_ON_UNDEFINED=fails((function(){test.sort(void 0)})),FAILS_ON_NULL=fails((function(){test.sort(null)})),STRICT_METHOD$1=arrayMethodIsStrict("sort"),STABLE_SORT=!fails((function(){if(engineV8Version)return engineV8Version<70;if(!(engineFfVersion&&engineFfVersion>3)){if(engineIsIeOrEdge)return!0;if(engineWebkitVersion)return engineWebkitVersion<603;var e,r,t,a,i="";for(e=65;e<76;e++){switch(r=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:t=3;break;case 68:case 71:t=4;break;default:t=2}for(a=0;a<47;a++)test.push({k:r+a,v:t})}for(test.sort((function(e,r){return r.v-e.v})),a=0;a toString(t)?1:-1}};_export({target:"Array",proto:!0,forced:FORCED$1},{sort:function sort(e){void 0!==e&&aFunction(e);var r=toObject(this);if(STABLE_SORT)return void 0===e?nativeSort.call(r):nativeSort.call(r,e);var t,a,i=[],s=toLength(r.length);for(a=0;a >>24&255,a[t+1]=i>>>16&255,a[t+2]=i>>>8&255,a[t+3]=i>>>0&255,new Uint8Array(a.buffer,0,t+4)},UZIP.deflateRaw=function(e,r){null==r&&(r={level:6});var t=new Uint8Array(50+Math.floor(1.1*e.length)),a=UZIP.F.deflateRaw(e,t,a,r.level);return new Uint8Array(t.buffer,0,a)},UZIP.encode=function(e,r){null==r&&(r=!1);var t=0,a=UZIP.bin.writeUint,i=UZIP.bin.writeUshort,s={};for(var c in e){var l=!UZIP._noNeed(c)&&!r,u=e[c],p=UZIP.crc.crc(u,0,u.length);s[c]={cpr:l,usize:u.length,crc:p,file:l?UZIP.deflateRaw(u):u}}for(var c in s)t+=s[c].file.length+30+46+2*UZIP.bin.sizeUTF8(c);t+=22;var d=new Uint8Array(t),y=0,h=[];for(var c in s){var A=s[c];h.push(y),y=UZIP._writeHeader(d,y,c,A,0)}var g=0,v=y;for(var c in s){A=s[c];h.push(y),y=UZIP._writeHeader(d,y,c,A,1,h[g++])}var m=y-v;return a(d,y,101010256),y+=4,i(d,y+=4,g),i(d,y+=2,g),a(d,y+=2,m),a(d,y+=4,v),y+=4,y+=2,d.buffer},UZIP._noNeed=function(e){var r=e.split(".").pop().toLowerCase();return-1!="png,jpg,jpeg,zip".indexOf(r)},UZIP._writeHeader=function(e,r,t,a,i,s){var c=UZIP.bin.writeUint,l=UZIP.bin.writeUshort,u=a.file;return c(e,r,0==i?67324752:33639248),r+=4,1==i&&(r+=2),l(e,r,20),l(e,r+=2,0),l(e,r+=2,a.cpr?8:0),c(e,r+=2,0),c(e,r+=4,a.crc),c(e,r+=4,u.length),c(e,r+=4,a.usize),l(e,r+=4,UZIP.bin.sizeUTF8(t)),l(e,r+=2,0),r+=2,1==i&&(r+=2,r+=2,c(e,r+=6,s),r+=4),r+=UZIP.bin.writeUTF8(e,r,t),0==i&&(e.set(u,r),r+=u.length),r},UZIP.crc={table:function(){for(var e=new Uint32Array(256),r=0;r<256;r++){for(var t=r,a=0;a<8;a++)1&t?t=3988292384^t>>>1:t>>>=1;e[r]=t}return e}(),update:function(e,r,t,a){for(var i=0;i>>8;return e},crc:function(e,r,t){return 4294967295^UZIP.crc.update(4294967295,e,r,t)}},UZIP.adler=function(e,r,t){for(var a=1,i=0,s=r,c=r+t;s>8&255},readUint:function(e,r){return 16777216*e[r+3]+(e[r+2]<<16|e[r+1]<<8|e[r])},writeUint:function(e,r,t){e[r]=255&t,e[r+1]=t>>8&255,e[r+2]=t>>16&255,e[r+3]=t>>24&255},readASCII:function(e,r,t){for(var a="",i=0;i >6,e[r+i+1]=128|c>>0&63,i+=2;else if(0==(4294901760&c))e[r+i]=224|c>>12,e[r+i+1]=128|c>>6&63,e[r+i+2]=128|c>>0&63,i+=3;else{if(0!=(4292870144&c))throw"e";e[r+i]=240|c>>18,e[r+i+1]=128|c>>12&63,e[r+i+2]=128|c>>6&63,e[r+i+3]=128|c>>0&63,i+=4}}return i},sizeUTF8:function(e){for(var r=e.length,t=0,a=0;a >>3}var h=s.lits,A=s.strt,g=s.prev,v=0,m=0,E=0,I=0,P=0,T=0;for(y>2&&(A[T=UZIP.F._hash(e,0)]=0),u=0;u 14e3||m>26697)&&y-u>100&&(d>>16,_=65535&S;if(0!=S){_=65535&S;var w=c(R=S>>>16,s.of0);s.lhst[257+w]++;var U=c(_,s.df0);s.dhst[U]++,I+=s.exb[w]+s.dxb[U],h[v]=R<<23|u-d,h[v+1]=_<<16|w<<8|U,v+=2,d=u+R}else s.lhst[e[u]]++;m++}}for(E==u&&0!=e.length||(d>>3},UZIP.F._bestMatch=function(e,r,t,a,i,s){var c=32767&r,l=t[c],u=c-l+32768&32767;if(l==c||a!=UZIP.F._hash(e,r-u))return 0;for(var p=0,d=0,y=Math.min(32767,r);u<=y&&0!=--s&&l!=c;){if(0==p||e[r+p]==e[r+p-u]){var h=UZIP.F._howLong(e,r,u);if(h>p){if(d=u,(p=h)>=i)break;u+2 A&&(A=m,l=v)}}}u+=(c=l)-(l=t[c])+32768&32767}return p<<16|d},UZIP.F._howLong=function(e,r,t){if(e[r]!=e[r-t]||e[r+1]!=e[r+1-t]||e[r+2]!=e[r+2-t])return 0;var a=r,i=Math.min(e.length,r+258);for(r+=3;r>>23,B=$+(8388607&x);$>16,V=D>>8&255,k=255&D;T(l,u=UZIP.F._writeLit(257+V,U,l,u),M-I.of0[V]),u+=I.exb[V],P(l,u=UZIP.F._writeLit(k,O,l,u),G-I.df0[k]),u+=I.dxb[k],$+=M}}u=UZIP.F._writeLit(256,U,l,u)}return u},UZIP.F._copyExact=function(e,r,t,a,i){var s=i>>>3;return a[s]=t,a[s+1]=t>>>8,a[s+2]=255-a[s],a[s+3]=255-a[s+1],s+=4,a.set(new Uint8Array(e.buffer,r,t),s),i+(t+4<<3)},UZIP.F.getTrees=function(){for(var e=UZIP.F.U,r=UZIP.F._hufTree(e.lhst,e.ltree,15),t=UZIP.F._hufTree(e.dhst,e.dtree,15),a=[],i=UZIP.F._lenCodes(e.ltree,a),s=[],c=UZIP.F._lenCodes(e.dtree,s),l=0;l 4&&0==e.itree[1+(e.ordr[p-1]<<1)];)p--;return[r,t,u,i,c,p,a,s]},UZIP.F.getSecond=function(e){for(var r=[],t=0;t >1)+",");return r},UZIP.F.contSize=function(e,r){for(var t=0,a=0;a 15&&(UZIP.F._putsE(t,a,c,l),a+=l)}return a},UZIP.F._lenCodes=function(e,r){for(var t=e.length;2!=t&&0==e[t-1];)t-=2;for(var a=0;a >>1,138))<11?r.push(17,p-3):r.push(18,p-11),a+=2*p-2}else if(i==l&&s==i&&c==i){for(u=a+5;u+2 >>1,6);r.push(16,p-3),a+=2*p-2}else r.push(i,0)}return t>>>1},UZIP.F._hufTree=function(e,r,t){var a=[],i=e.length,s=r.length,c=0;for(c=0;c t&&(UZIP.F.restrictDepth(u,t,v),v=t),c=0;cr;a++){var c=e[a].d;e[a].d=r,s+=i-(1< >>=t-r;s>0;){(c=e[a].d) =0;a--)e[a].d==r&&s<0&&(e[a].d--,s++);0!=s&&console.log("debt left")},UZIP.F._goodIndex=function(e,r){var t=0;return r[16|t]<=e&&(t|=16),r[8|t]<=e&&(t|=8),r[4|t]<=e&&(t|=4),r[2|t]<=e&&(t|=2),r[1|t]<=e&&(t|=1),t},UZIP.F._writeLit=function(e,r,t,a){return UZIP.F._putsF(t,a,r[e<<1]),a+r[1+(e<<1)]},UZIP.F.inflate=function(e,r){var t=Uint8Array;if(3==e[0]&&0==e[1])return r||new t(0);var a=UZIP.F,i=a._bitsF,s=a._bitsE,c=a._decodeTiny,l=a.makeCodes,u=a.codes2map,p=a._get17,d=a.U,y=null==r;y&&(r=new t(e.length>>>2<<3));for(var h,A,g=0,v=0,m=0,E=0,I=0,P=0,T=0,b=0,S=0;0==g;)if(g=i(e,S,1),v=i(e,S+1,2),S+=3,0!=v){if(y&&(r=UZIP.F._check(r,b+(1<<17))),1==v&&(h=d.flmap,A=d.fdmap,P=511,T=31),2==v){m=s(e,S,5)+257,E=s(e,S+5,5)+1,I=s(e,S+10,4)+4,S+=14;for(var R=0;R<38;R+=2)d.itree[R]=0,d.itree[R+1]=0;var _=1;for(R=0;R_&&(_=w)}S+=3*I,l(d.itree,_),u(d.itree,_,d.imap),h=d.lmap,A=d.dmap,S=c(d.imap,(1<<_)-1,m+E,e,S,d.ttree);var U=a._copyOut(d.ttree,0,m,d.ltree);P=(1<>>4;if($>>>8==0)r[b++]=$;else{if(256==$)break;var L=b+$-254;if($>264){var x=d.ldef[$-257];L=b+(x>>>3)+s(e,S,7&x),S+=7&x}var M=A[p(e,S)&T];S+=15&M;var B=M>>>4,D=d.ddef[B],G=(D>>>4)+i(e,S,15&D);for(S+=15&D,y&&(r=UZIP.F._check(r,b+(1<<17)));b >>3),k=e[V-4]|e[V-3]<<8;y&&(r=UZIP.F._check(r,b+k)),r.set(new t(e.buffer,e.byteOffset+V,k),b),S=V+k<<3,b+=k}return r.length==b?r:r.slice(0,b)},UZIP.F._check=function(e,r){var t=e.length;if(r<=t)return e;var a=new Uint8Array(Math.max(t<<1,r));return a.set(e,0),a},UZIP.F._decodeTiny=function(e,r,t,a,i,s){for(var c=UZIP.F._bitsE,l=UZIP.F._get17,u=0;u >>4;if(d<=15)s[u]=d,u++;else{var y=0,h=0;16==d?(h=3+c(a,i,2),i+=2,y=s[u-1]):17==d?(h=3+c(a,i,3),i+=3):18==d&&(h=11+c(a,i,7),i+=7);for(var A=u+h;u>>1;s i&&(i=l),s++}for(;s >1,l=e[s+1],u=c<<4|l,p=r-l,d=e[s]< >>15-r]=u,d++}},UZIP.F.revCodes=function(e,r){for(var t=UZIP.F.U.rev15,a=15-r,i=0;i
>>a}},UZIP.F._putsE=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8},UZIP.F._putsF=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8,e[a+2]|=t>>>16},UZIP.F._bitsE=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},UZIP.F._get25=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},UZIP.F.U=(r=Uint16Array,t=Uint32Array,{next_code:new r(16),bl_count:new r(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new r(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new t(32),flmap:new r(512),fltree:[],fdmap:new r(32),fdtree:[],lmap:new r(32768),ltree:[],ttree:[],dmap:new r(32768),dtree:[],imap:new r(512),itree:[],rev15:new r(32768),lhst:new t(286),dhst:new t(30),ihst:new t(19),lits:new t(15e3),strt:new r(65536),prev:new r(32768)}),function(){for(var e=UZIP.F.U,r=0;r<32768;r++){var t=r;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,e.rev15[r]=(t>>>16|t<<16)>>>17}function pushV(e,r,t){for(;0!=r--;)e.push(0,t)}for(r=0;r<32;r++)e.ldef[r]=e.of0[r]<<3|e.exb[r],e.ddef[r]=e.df0[r]<<4|e.dxb[r];pushV(e.fltree,144,8),pushV(e.fltree,112,9),pushV(e.fltree,24,7),pushV(e.fltree,8,8),UZIP.F.makeCodes(e.fltree,9),UZIP.F.codes2map(e.fltree,9,e.flmap),UZIP.F.revCodes(e.fltree,9),pushV(e.fdtree,32,5),UZIP.F.makeCodes(e.fdtree,5),UZIP.F.codes2map(e.fdtree,5,e.fdmap),UZIP.F.revCodes(e.fdtree,5),pushV(e.itree,19,0),pushV(e.ltree,286,0),pushV(e.dtree,30,0),pushV(e.ttree,320,0)}()})),UZIP=Object.freeze(Object.assign(Object.create(null),UZIP_1,{default:UZIP_1})),UPNG={},N,W,H;UPNG.toRGBA8=function(e){var r=e.width,t=e.height;if(null==e.tabs.acTL)return[UPNG.toRGBA8.decodeImage(e.data,r,t,e).buffer];var a=[];null==e.frames[0].data&&(e.frames[0].data=e.data);for(var i=r*t*4,s=new Uint8Array(i),c=new Uint8Array(i),l=new Uint8Array(i),u=0;u >3)]>>7-((7&A)<<0)&1);l[P]=T[U],l[P+1]=T[U+1],l[P+2]=T[U+2],l[P+3]=O >2)]>>6-((3&A)<<1)&3);l[P]=T[U],l[P+1]=T[U+1],l[P+2]=T[U+2],l[P+3]=O>1)]>>4-((1&A)<<2)&15);l[P]=T[U],l[P+1]=T[U+1],l[P+2]=T[U+2],l[P+3]=O>>3)]>>>7-(7&M)&1))==255*m?0:255;u[x+M]=B<<24|C<<16|C<<8|C}else if(2==d)for(M=0;M>>2)]>>>6-((3&M)<<1)&3))==85*m?0:255;u[x+M]=B<<24|C<<16|C<<8|C}else if(4==d)for(M=0;M >>1)]>>>4-((1&M)<<2)&15))==17*m?0:255;u[x+M]=B<<24|C<<16|C<<8|C}else if(8==d)for(M=0;M >>2<<5));0==s;)if(s=v(e,A,1),c=v(e,A+1,2),A+=3,0!=c){if(S&&(r=H.H.W(r,h+(1<<17))),1==c&&(t=b.J,a=b.h,d=511,y=31),2==c){l=m(e,A,5)+257,u=m(e,A+5,5)+1,p=m(e,A+10,4)+4,A+=14;for(var R=1,_=0;_<38;_+=2)b.Q[_]=0,b.Q[_+1]=0;for(_=0;_ R&&(R=w)}A+=3*p,I(b.Q,R),P(b.Q,R,b.u),t=b.w,a=b.d,A=E(b.u,(1<
>>4;if($>>>8==0)r[h++]=$;else{if(256==$)break;var L=h+$-254;if($>264){var x=b.q[$-257];L=h+(x>>>3)+m(e,A,7&x),A+=7&x}var M=a[T(e,A)&y];A+=15&M;var B=M>>>4,D=b.c[B],G=(D>>>4)+v(e,A,15&D);for(A+=15&D;h >>3),k=e[V-4]|e[V-3]<<8;S&&(r=H.H.W(r,h+k)),r.set(new i(e.buffer,e.byteOffset+V,k),h),A=V+k<<3,h+=k}return r.length==h?r:r.slice(0,h)},H.H.W=function(e,r){var t=e.length;if(r<=t)return e;var a=new Uint8Array(t<<1);return a.set(e,0),a},H.H.R=function(e,r,t,a,i,s){for(var c=H.H.e,l=H.H.Z,u=0;u >>4;if(d<=15)s[u]=d,u++;else{var y=0,h=0;16==d?(h=3+c(a,i,2),i+=2,y=s[u-1]):17==d?(h=3+c(a,i,3),i+=3):18==d&&(h=11+c(a,i,7),i+=7);for(var A=u+h;u>>1;s i&&(i=l),s++}for(;s >1,l=e[s+1],u=c<<4|l,p=r-l,d=e[s]< >>15-r]=u,d++},H.H.l=function(e,r){for(var t=H.H.m.r,a=15-r,i=0;i
>>a}},H.H.M=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8},H.H.I=function(e,r,t){t<<=7&r;var a=r>>>3;e[a]|=t,e[a+1]|=t>>>8,e[a+2]|=t>>>16},H.H.e=function(e,r,t){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1< >>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},H.H.i=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},H.H.m=(N=Uint16Array,W=Uint32Array,{K:new N(16),j:new N(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new N(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new W(32),J:new N(512),_:[],h:new N(32),$:[],w:new N(32768),C:[],v:[],d:new N(32768),D:[],u:new N(512),Q:[],r:new N(32768),s:new W(286),Y:new W(30),a:new W(19),t:new W(15e3),k:new N(65536),g:new N(32768)}),function(){for(var e=H.H.m,r=0;r<32768;r++){var t=r;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,e.r[r]=(t>>>16|t<<16)>>>17}function n(e,r,t){for(;0!=r--;)e.push(0,t)}for(r=0;r<32;r++)e.q[r]=e.S[r]<<3|e.T[r],e.c[r]=e.p[r]<<4|e.z[r];n(e._,144,8),n(e._,112,9),n(e._,24,7),n(e._,8,8),H.H.n(e._,9),H.H.A(e._,9,e.J),H.H.l(e._,9),n(e.$,32,5),H.H.n(e.$,5),H.H.A(e.$,5,e.h),H.H.l(e.$,5),n(e.Q,19,0),n(e.C,286,0),n(e.D,30,0),n(e.v,320,0)}(),H.H.N),UPNG.decode._readInterlace=function(e,r){for(var t=r.width,a=r.height,i=UPNG.decode._getBPP(r),s=i>>3,c=Math.ceil(t*i/8),l=new Uint8Array(a*c),u=0,p=[0,0,4,0,2,0,1],d=[0,4,0,2,0,1,0],y=[8,8,8,4,4,2,2],h=[8,8,4,4,2,2,1],A=0;A<7;){for(var g=y[A],v=h[A],m=0,E=0,I=p[A];I>3])>>7-(7&_)&1,l[S*c+(R>>3)]|=w<<7-((7&R)<<0);if(2==i)w=(w=e[_>>3])>>6-(7&_)&3,l[S*c+(R>>2)]|=w<<6-((3&R)<<1);if(4==i)w=(w=e[_>>3])>>4-(7&_)&15,l[S*c+(R>>1)]|=w<<4-((1&R)<<2);if(i>=8)for(var U=S*c+R*s,O=0;O >3)+O];_+=i,R+=v}b++,S+=g}m*E!=0&&(u+=E*(1+T)),A+=1}return l},UPNG.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},UPNG.decode._filterZero=function(e,r,t,a,i){var s=UPNG.decode._getBPP(r),c=Math.ceil(a*s/8),l=UPNG.decode._paeth;s=Math.ceil(s/8);var u=0,p=1,d=e[t],y=0;if(d>1&&(e[t]=[0,0,1][d-2]),3==d)for(y=s;y>>1)&255;for(var h=0;h>>1);for(;y >>1)}else{for(;y >8&255,e[r+1]=255&t},readUint:function readUint(e,r){return 16777216*e[r]+(e[r+1]<<16|e[r+2]<<8|e[r+3])},writeUint:function writeUint(e,r,t){e[r]=t>>24&255,e[r+1]=t>>16&255,e[r+2]=t>>8&255,e[r+3]=255&t},readASCII:function readASCII(e,r,t){for(var a="",i=0;i=0&&l>=0?(y=A*r+g<<2,h=(l+A)*i+c+g<<2):(y=(-l+A)*r-c+g<<2,h=A*i+g<<2),0==u)a[h]=e[y],a[h+1]=e[y+1],a[h+2]=e[y+2],a[h+3]=e[y+3];else if(1==u){var v=e[y+3]*(1/255),m=e[y]*v,E=e[y+1]*v,I=e[y+2]*v,P=a[h+3]*(1/255),T=a[h]*P,b=a[h+1]*P,S=a[h+2]*P,R=1-v,_=v+P*R,w=0==_?0:1/_;a[h+3]=255*_,a[h+0]=(m+T*R)*w,a[h+1]=(E+b*R)*w,a[h+2]=(I+S*R)*w}else if(2==u){v=e[y+3],m=e[y],E=e[y+1],I=e[y+2],P=a[h+3],T=a[h],b=a[h+1],S=a[h+2];v==P&&m==T&&E==b&&I==S?(a[h]=0,a[h+1]=0,a[h+2]=0,a[h+3]=0):(a[h]=m,a[h+1]=E,a[h+2]=I,a[h+3]=v)}else if(3==u){v=e[y+3],m=e[y],E=e[y+1],I=e[y+2],P=a[h+3],T=a[h],b=a[h+1],S=a[h+2];if(v==P&&m==T&&E==b&&I==S)continue;if(v<220&&P>20)return!1}return!0},UPNG.encode=function(e,r,t,a,i,s,c){null==a&&(a=0),null==c&&(c=!1);var l=UPNG.encode.compress(e,r,t,a,[!1,!1,!1,0,c]);return UPNG.encode.compressPNG(l,-1),UPNG.encode._main(l,r,t,i,s)},UPNG.encodeLL=function(e,r,t,a,i,s,c,l){for(var u={ctype:0+(1==a?0:2)+(0==i?0:4),depth:s,frames:[]},p=(a+i)*s,d=p*r,y=0;y 1,y=!1,h=33+(d?20:0);if(null!=i.sRGB&&(h+=13),null!=i.pHYs&&(h+=21),3==e.ctype){for(var A=e.plte.length,g=0;g>>24!=255&&(y=!0);h+=8+3*A+4+(y?8+1*A+4:0)}for(var v=0;v >>8&255,S=P>>>16&255;m[p+I+0]=T,m[p+I+1]=b,m[p+I+2]=S}if(c(m,p+=3*A,s(m,p-3*A-4,3*A+4)),p+=4,y){c(m,p,A),u(m,p+=4,"tRNS"),p+=4;for(g=0;g>>24&255;c(m,p+=A,s(m,p-A-4,A+4)),p+=4}}var R=0;for(v=0;v >2,O>>2));for(A=0;A L&&M==$[m-L])x[m]=x[m-L];else{var B=P[M];if(null==B&&(P[M]=B=T.length,T.push(M),T.length>=300))break;x[m]=B}}}var D=T.length;D<=256&&0==p&&(y=D<=2?1:D<=4?2:D<=16?4:8,y=Math.max(y,u));for(A=0;A >1)]|=q[z+K]<<4-4*(1&K);else if(2==y)for(K=0;K >2)]|=q[z+K]<<6-2*(3&K);else if(1==y)for(K=0;K >3)]|=q[z+K]<<7-1*(7&K)}V=Z,d=3,Y=1}else if(0==E&&1==I.length){Z=new Uint8Array(L*G*3);var X=L*G;for(m=0;m _&&(_=O),U w&&(w=U))}-1==_&&(S=R=_=w=0),i&&(1==(1&S)&&S--,1==(1&R)&&R--);var C=(_-S+1)*(w-R+1);Cm&&(m=T),b E&&(E=b))}-1==m&&(g=v=m=E=0),c&&(1==(1&g)&&g--,1==(1&v)&&v--),s={x:g,y:v,width:m-g+1,height:E-v+1};var _=a[i];_.rect=s,_.blend=1,_.img=new Uint8Array(s.width*s.height*4),0==a[i-1].dispose?(UPNG._copyTile(p,r,t,_.img,s.width,s.height,-s.x,-s.y,0),UPNG.encode._prepareDiff(h,r,t,_.img,s)):UPNG._copyTile(h,r,t,_.img,s.width,s.height,-s.x,-s.y,0)},UPNG.encode._prepareDiff=function(e,r,t,a,i){UPNG._copyTile(e,r,t,a,i.width,i.height,-i.x,-i.y,2)},UPNG.encode._filterZero=function(e,r,t,a,i,s,c){var l,u=[],p=[0,1,2,3,4];-1!=s?p=[s]:(r*a>5e5||1==t)&&(p=[0]),c&&(l={level:0});for(var d,y=UZIP,h=0;h >1)+256&255;if(4==s)for(p=i;p>1)&255;for(p=i;p>1)&255}if(4==s){for(p=0;p>>1:t>>>=1;e[r]=t}return e}(),update:function update(e,r,t,a){for(var i=0;i>>8;return e},crc:function crc(e,r,t){return 4294967295^UPNG.crc.update(4294967295,e,r,t)}},UPNG.quantize=function(e,r){var t,a=new Uint8Array(e),i=a.slice(0),s=new Uint32Array(i.buffer),c=UPNG.quantize.getKDtree(i,r),l=c[0],u=c[1],p=UPNG.quantize.planeDst,d=a,y=s,h=d.length,A=new Uint8Array(a.length>>2);if(a.length<2e7)for(var g=0;g >2]=t.ind,y[g>>2]=t.est.rgba}else for(g=0;g >2]=t.ind,y[g>>2]=t.est.rgba}return{abuf:i.buffer,inds:A,plte:u}},UPNG.quantize.getKDtree=function(e,r,t){null==t&&(t=1e-4);var a=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=UPNG.quantize.stats(e,i.i0,i.i1),i.est=UPNG.quantize.estats(i.bst);for(var s=[i];s.length c&&(c=s[u].est.L,l=u);if(c =d||p.i1<=d)p.est.L=0;else{var y={i0:p.i0,i1:d,bst:null,est:null,tdst:0,left:null,right:null};y.bst=UPNG.quantize.stats(e,y.i0,y.i1),y.est=UPNG.quantize.estats(y.bst);var h={i0:d,i1:p.i1,bst:null,est:null,tdst:0,left:null,right:null};h.bst={R:[],m:[],N:p.bst.N-y.bst.N};for(u=0;u<16;u++)h.bst.R[u]=p.bst.R[u]-y.bst.R[u];for(u=0;u<4;u++)h.bst.m[u]=p.bst.m[u]-y.bst.m[u];h.est=UPNG.quantize.estats(h.bst),p.left=y,p.right=h,s[l]=y,s.push(h)}}s.sort((function(e,r){return r.bst.N-e.bst.N}));for(u=0;u 0&&(c=e.right,l=e.left);var u=UPNG.quantize.getNearest(c,r,t,a,i);if(u.tdst<=s*s)return u;var p=UPNG.quantize.getNearest(l,r,t,a,i);return p.tdst s;)a-=4;if(t>=a)break;var l=r[t>>2];r[t>>2]=r[a>>2],r[a>>2]=l,t+=4,a-=4}for(;c(e,t,i)>s;)t-=4;return t+4},UPNG.quantize.vecDot=function(e,r,t){return e[r]*t[0]+e[r+1]*t[1]+e[r+2]*t[2]+e[r+3]*t[3]},UPNG.quantize.stats=function(e,r,t){for(var a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],s=t-r>>2,c=r;c >>0}},UPNG.M4={multVec:function multVec(e,r){return[e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]*r[3],e[4]*r[0]+e[5]*r[1]+e[6]*r[2]+e[7]*r[3],e[8]*r[0]+e[9]*r[1]+e[10]*r[2]+e[11]*r[3],e[12]*r[0]+e[13]*r[1]+e[14]*r[2]+e[15]*r[3]]},dot:function dot(e,r){return e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]*r[3]},sml:function sml(e,r){return[e*r[0],e*r[1],e*r[2],e*r[3]]}},UPNG.encode.concatRGBA=function(e){for(var r=0,t=0;t 2&&void 0!==arguments[2]?arguments[2]:Date.now();return new Promise((function(a){for(var i=e.split(","),s=i[0].match(/:(.*?);/)[1],c=globalThis.atob(i[1]),l=c.length,u=new Uint8Array(l);l--;)u[l]=c.charCodeAt(l);var p=new Blob([u],{type:s});p.name=r,p.lastModified=t,a(p)}))}function getDataUrlFromFile(e){return new Promise((function(r,t){var a=new CustomFileReader;a.onload=function(){return r(a.result)},a.onerror=function(e){return t(e)},a.readAsDataURL(e)}))}function loadImage(e){return new Promise((function(r,t){var a=new Image;a.onload=function(){return r(a)},a.onerror=function(e){return t(e)},a.src=e}))}function getBrowserName(){var e="etc";return-1===navigator.userAgent.indexOf("Chrome")&&-1===navigator.userAgent.indexOf("Chromium")||(e="chrome"),-1!==navigator.userAgent.indexOf("Safari")?e="safari":-1!==navigator.userAgent.indexOf("Firefox")?e="firefox":-1===navigator.userAgent.indexOf("MSIE")&&!0!=!!document.documentMode||(e="internet explorer"),e}function approximateBelowMaximumCanvasSizeOfBrowser(e,r){for(var t=getBrowserName(),a=MaxCanvasSize[t],i=e,s=r,c=i*s,l=i>s?s/i:i/s;c>a*a;){var u=(a+i)/2,p=(a+s)/2;u 4&&void 0!==arguments[4]?arguments[4]:1;return new Promise((function(s,c){var l,u,p;if("image/png"===r)return u=e.getContext("2d").getImageData(0,0,e.width,e.height).data,p=UPNG.encode([u],e.width,e.height,256*i),(l=new Blob([p],{type:r})).name=t,l.lastModified=a,$If_4.call(this);{return"function"==typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e.convertToBlob({type:r,quality:i}).then(function(e){try{return(l=e).name=t,l.lastModified=a,$If_5.call(this)}catch(e){return c(e)}}.bind(this),c):getFilefromDataUrl(e.toDataURL(r,i),t,a).then(function(e){try{return l=e,$If_5.call(this)}catch(e){return c(e)}}.bind(this),c);function $If_5(){return $If_4.call(this)}}function $If_4(){return s(l)}}))}function cleanupCanvasMemory(e){e.width=0,e.height=0}function isAutoOrientationInBrowser(){return new Promise((function(e,r){var t,a,i,s;return void 0!==isAutoOrientationInBrowser.result?e(isAutoOrientationInBrowser.result):("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==",getFilefromDataUrl("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(c){try{return drawFileInCanvas(t=c).then((function(c){try{return canvasToFile(a=c[1],t.type,t.name,t.lastModified).then((function(t){try{return i=t,cleanupCanvasMemory(a),drawFileInCanvas(i).then((function(t){try{return s=t[0],isAutoOrientationInBrowser.result=1===s.width&&2===s.height,e(isAutoOrientationInBrowser.result)}catch(e){return r(e)}}),r)}catch(e){return r(e)}}),r)}catch(e){return r(e)}}),r)}catch(e){return r(e)}}),r))}))}function getExifOrientation(e){return new Promise((function(r,t){var a=new CustomFileReader;a.onload=function(e){var t=new DataView(e.target.result);if(65496!=t.getUint16(0,!1))return r(-2);for(var a=t.byteLength,i=2;is||i>s)){var l=_slicedToArray(getNewCanvasAndCtx(a,i),2);c=l[0],t=l[1],a>i?(c.width=s,c.height=i/a*s):(c.width=a/i*s,c.height=s),t.drawImage(e,0,0,c.width,c.height),cleanupCanvasMemory(e)}return c}function followExifOrientation(e,r){var t=e.width,a=e.height,i=_slicedToArray(getNewCanvasAndCtx(t,a),2),s=i[0],c=i[1];switch(r>4&&r<9?(s.width=a,s.height=t):(s.width=t,s.height=a),r){case 2:c.transform(-1,0,0,1,t,0);break;case 3:c.transform(-1,0,0,-1,t,a);break;case 4:c.transform(1,0,0,-1,0,a);break;case 5:c.transform(0,1,1,0,0,0);break;case 6:c.transform(0,1,-1,0,a,0);break;case 7:c.transform(0,-1,-1,0,a,t);break;case 8:c.transform(0,-1,1,0,0,t)}return c.drawImage(e,0,0,t,a),cleanupCanvasMemory(e),s}function compress(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return new Promise((function(a,i){var s,c,l,u,p,d,y,h,A,g,v,m,E,I,P,T,b,S;function incProgress(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;s+=e,r.onProgress(Math.min(s,100))}function setProgress(e){s=Math.min(Math.max(e,s),100),r.onProgress(s)}return s=t,c=r.maxIteration||10,l=1024*r.maxSizeMB*1024,incProgress(),drawFileInCanvas(e).then(function(t){try{var s=_slicedToArray(t,2);return u=s[1],incProgress(),p=handleMaxWidthOrHeight(u,r),incProgress(),new Promise((function(t,a){var i;if(!(i=r.exifOrientation))return getExifOrientation(e).then(function(e){try{return i=e,$If_2.call(this)}catch(e){return a(e)}}.bind(this),a);function $If_2(){return t(i)}return $If_2.call(this)})).then(function(t){try{return d=t,incProgress(),isAutoOrientationInBrowser().then(function(t){try{return y=t?p:followExifOrientation(p,d),incProgress(),h=r.initialQuality||1,A=r.fileType||e.type,canvasToFile(y,A,e.name,e.lastModified,h).then(function(r){try{{if(g=r,incProgress(),v=g.size>l,m=g.size>e.size,!v&&!m)return setProgress(100),a(g);var t;function $Loop_3(){if(c--&&(P>l||P>E)){var r,t,a=_slicedToArray(getNewCanvasAndCtx(r=v?.95*S.width:S.width,t=v?.95*S.height:S.height),2);return b=a[0],a[1].drawImage(S,0,0,r,t),h*=.95,canvasToFile(b,A,e.name,e.lastModified,h).then((function(e){try{return T=e,cleanupCanvasMemory(S),S=b,P=T.size,setProgress(Math.min(99,Math.floor((I-P)/(I-l)*100))),$Loop_3}catch(e){return i(e)}}),i)}return[1]}return E=e.size,I=g.size,P=I,S=y,(t=function(e){for(;e;){if(e.then)return void e.then(t,i);try{if(e.pop){if(e.length)return e.pop()?$Loop_3_exit.call(this):e;e=$Loop_3}else e=e.call(this)}catch(e){return i(e)}}}.bind(this))($Loop_3);function $Loop_3_exit(){return cleanupCanvasMemory(S),cleanupCanvasMemory(b),cleanupCanvasMemory(p),cleanupCanvasMemory(y),cleanupCanvasMemory(u),setProgress(100),a(T)}}}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}catch(e){return i(e)}}.bind(this),i)}))}var charAt=stringMultibyte.charAt,STRING_ITERATOR="String Iterator",setInternalState$2=internalState.set,getInternalState=internalState.getterFor(STRING_ITERATOR);defineIterator(String,"String",(function(e){setInternalState$2(this,{type:STRING_ITERATOR,string:toString(e),index:0})}),(function next(){var e,r=getInternalState(this),t=r.string,a=r.index;return a>=t.length?{value:void 0,done:!0}:(e=charAt(t,a),r.index+=e.length,{value:e,done:!1})}));var domIterables={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},ITERATOR$2=wellKnownSymbol("iterator"),TO_STRING_TAG=wellKnownSymbol("toStringTag"),ArrayValues=es_array_iterator.values;for(var COLLECTION_NAME$1 in domIterables){var Collection$1=global$1[COLLECTION_NAME$1],CollectionPrototype$1=Collection$1&&Collection$1.prototype;if(CollectionPrototype$1){if(CollectionPrototype$1[ITERATOR$2]!==ArrayValues)try{createNonEnumerableProperty(CollectionPrototype$1,ITERATOR$2,ArrayValues)}catch(e){CollectionPrototype$1[ITERATOR$2]=ArrayValues}if(CollectionPrototype$1[TO_STRING_TAG]||createNonEnumerableProperty(CollectionPrototype$1,TO_STRING_TAG,COLLECTION_NAME$1),domIterables[COLLECTION_NAME$1])for(var METHOD_NAME in es_array_iterator)if(CollectionPrototype$1[METHOD_NAME]!==es_array_iterator[METHOD_NAME])try{createNonEnumerableProperty(CollectionPrototype$1,METHOD_NAME,es_array_iterator[METHOD_NAME])}catch(e){CollectionPrototype$1[METHOD_NAME]=es_array_iterator[METHOD_NAME]}}}var ITERATOR$1=wellKnownSymbol("iterator"),nativeUrl=!fails((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),r=e.searchParams,t="";return e.pathname="c%20d",r.forEach((function(e,a){r.delete("b"),t+=a+e})),isPure&&!e.toJSON||!r.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==r.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!r[ITERATOR$1]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==t||"x"!==new URL("http://x",void 0).host})),callWithSafeIterationClosing=function(e,r,t,a){try{return a?r(anObject(t)[0],t[1]):r(t)}catch(r){throw iteratorClose(e),r}},arrayFrom=function from(e){var r,t,a,i,s,c,l=toObject(e),u="function"==typeof this?this:Array,p=arguments.length,d=p>1?arguments[1]:void 0,y=void 0!==d,h=getIteratorMethod(l),A=0;if(y&&(d=functionBindContext(d,p>2?arguments[2]:void 0,2)),null==h||u==Array&&isArrayIteratorMethod(h))for(t=new u(r=toLength(l.length));r>A;A++)c=y?d(l[A],A):l[A],createProperty(t,A,c);else for(s=(i=h.call(l)).next,t=new u;!(a=s.call(i)).done;A++)c=y?callWithSafeIterationClosing(i,d,[a.value,A],!0):a.value,createProperty(t,A,c);return t.length=A,t},maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexNonASCII=/[^\0-\u007E]/,regexSeparators=/[.\u3002\uFF0E\uFF61]/g,OVERFLOW_ERROR="Overflow: input needs wider integers to process",baseMinusTMin=base-tMin,floor$2=Math.floor,stringFromCharCode=String.fromCharCode,ucs2decode=function(e){for(var r=[],t=0,a=e.length;t=55296&&i<=56319&&t>1,e+=floor$2(e/r);e>baseMinusTMin*tMax>>1;a+=base)e=floor$2(e/baseMinusTMin);return floor$2(a+(baseMinusTMin+1)*e/(e+skew))},encode=function(e){var r,t,a=[],i=(e=ucs2decode(e)).length,s=initialN,c=0,l=initialBias;for(r=0;r
=s&&t floor$2((maxInt-c)/y))throw RangeError(OVERFLOW_ERROR);for(c+=(d-s)*y,s=d,r=0;r maxInt)throw RangeError(OVERFLOW_ERROR);if(t==s){for(var h=c,A=base;;A+=base){var g=A<=l?tMin:A>=l+tMax?tMax:A-l;if(h 0?arguments[0]:void 0,d=this,y=[];if(setInternalState$1(d,{type:URL_SEARCH_PARAMS,entries:y,updateURL:function(){},updateSearchParams:updateSearchParams}),void 0!==p)if(isObject(p))if("function"==typeof(e=getIteratorMethod(p)))for(t=(r=e.call(p)).next;!(a=t.call(r)).done;){if((c=(s=(i=getIterator(anObject(a.value))).next).call(i)).done||(l=s.call(i)).done||!s.call(i).done)throw TypeError("Expected sequence with length 2");y.push({key:toString(c.value),value:toString(l.value)})}else for(u in p)has$1(p,u)&&y.push({key:u,value:toString(p[u])});else parseSearchParams(y,"string"==typeof p?"?"===p.charAt(0)?p.slice(1):p:toString(p))},URLSearchParamsPrototype=URLSearchParamsConstructor.prototype;if(redefineAll(URLSearchParamsPrototype,{append:function append(e,r){validateArgumentsLength(arguments.length,2);var t=getInternalParamsState(this);t.entries.push({key:toString(e),value:toString(r)}),t.updateURL()},delete:function(e){validateArgumentsLength(arguments.length,1);for(var r=getInternalParamsState(this),t=r.entries,a=toString(e),i=0;i e.key){i.splice(r,0,e);break}r===t&&i.push(e)}a.updateURL()},forEach:function forEach(e){for(var r,t=getInternalParamsState(this).entries,a=functionBindContext(e,arguments.length>1?arguments[1]:void 0,3),i=0;i 1?wrapRequestOptions(arguments[1]):{})}}),"function"==typeof NativeRequest){var RequestConstructor=function Request(e){return anInstance(this,RequestConstructor,"Request"),new NativeRequest(e,arguments.length>1?wrapRequestOptions(arguments[1]):{})};RequestPrototype.constructor=RequestConstructor,RequestConstructor.prototype=RequestPrototype,_export({global:!0,forced:!0},{Request:RequestConstructor})}}var web_urlSearchParams={URLSearchParams:URLSearchParamsConstructor,getState:getInternalParamsState},codeAt=stringMultibyte.codeAt,NativeURL=global$1.URL,URLSearchParams$1=web_urlSearchParams.URLSearchParams,getInternalSearchParamsState=web_urlSearchParams.getState,setInternalState=internalState.set,getInternalURLState=internalState.getterFor("URL"),floor$1=Math.floor,pow=Math.pow,INVALID_AUTHORITY="Invalid authority",INVALID_SCHEME="Invalid scheme",INVALID_HOST="Invalid host",INVALID_PORT="Invalid port",ALPHA=/[A-Za-z]/,ALPHANUMERIC=/[\d+-.A-Za-z]/,DIGIT=/\d/,HEX_START=/^0x/i,OCT=/^[0-7]+$/,DEC=/^\d+$/,HEX=/^[\dA-Fa-f]+$/,FORBIDDEN_HOST_CODE_POINT=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT=/[\0\t\n\r #/:<>?@[\\\]^|]/,LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,TAB_AND_NEW_LINE=/[\t\n\r]/g,EOF,parseHost=function(e,r){var t,a,i;if("["==r.charAt(0)){if("]"!=r.charAt(r.length-1))return INVALID_HOST;if(!(t=parseIPv6(r.slice(1,-1))))return INVALID_HOST;e.host=t}else if(isSpecial(e)){if(r=stringPunycodeToAscii(r),FORBIDDEN_HOST_CODE_POINT.test(r))return INVALID_HOST;if(null===(t=parseIPv4(r)))return INVALID_HOST;e.host=t}else{if(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(r))return INVALID_HOST;for(t="",a=arrayFrom(r),i=0;i 4)return e;for(t=[],a=0;a 1&&"0"==i.charAt(0)&&(s=HEX_START.test(i)?16:8,i=i.slice(8==s?1:2)),""===i)c=0;else{if(!(10==s?DEC:8==s?OCT:HEX).test(i))return e;c=parseInt(i,s)}t.push(c)}for(a=0;a =pow(256,5-r))return null}else if(c>255)return null;for(l=t.pop(),a=0;a 6)return;for(a=0;char();){if(i=null,a>0){if(!("."==char()&&a<4))return;y++}if(!DIGIT.test(char()))return;for(;DIGIT.test(char());){if(s=parseInt(char(),10),null===i)i=s;else{if(0==i)return;i=10*i+s}if(i>255)return;y++}u[p]=256*u[p]+i,2!=++a&&4!=a||p++}if(4!=a)return;break}if(":"==char()){if(y++,!char())return}else if(char())return;u[p++]=r}else{if(null!==d)return;y++,d=++p}}if(null!==d)for(c=p-d,p=7;0!=p&&c>0;)l=u[p],u[p--]=u[d+c-1],u[d+--c]=l;else if(8!=p)return;return u},findLongestZeroSequence=function(e){for(var r=null,t=1,a=null,i=0,s=0;s<8;s++)0!==e[s]?(i>t&&(r=a,t=i),a=null,i=0):(null===a&&(a=s),++i);return i>t&&(r=a,t=i),r},serializeHost=function(e){var r,t,a,i;if("number"==typeof e){for(r=[],t=0;t<4;t++)r.unshift(e%256),e=floor$1(e/256);return r.join(".")}if("object"==typeof e){for(r="",a=findLongestZeroSequence(e),t=0;t<8;t++)i&&0===e[t]||(i&&(i=!1),a===t?(r+=t?":":"::",i=!0):(r+=e[t].toString(16),t<7&&(r+=":")));return"["+r+"]"}return e},C0ControlPercentEncodeSet={},fragmentPercentEncodeSet=objectAssign({},C0ControlPercentEncodeSet,{" ":1,'"':1,"<":1,">":1,"`":1}),pathPercentEncodeSet=objectAssign({},fragmentPercentEncodeSet,{"#":1,"?":1,"{":1,"}":1}),userinfoPercentEncodeSet=objectAssign({},pathPercentEncodeSet,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),percentEncode=function(e,r){var t=codeAt(e,0);return t>32&&t<127&&!has$1(r,e)?e:encodeURIComponent(e)},specialSchemes={ftp:21,file:null,http:80,https:443,ws:80,wss:443},isSpecial=function(e){return has$1(specialSchemes,e.scheme)},includesCredentials=function(e){return""!=e.username||""!=e.password},cannotHaveUsernamePasswordPort=function(e){return!e.host||e.cannotBeABaseURL||"file"==e.scheme},isWindowsDriveLetter=function(e,r){var t;return 2==e.length&&ALPHA.test(e.charAt(0))&&(":"==(t=e.charAt(1))||!r&&"|"==t)},startsWithWindowsDriveLetter=function(e){var r;return e.length>1&&isWindowsDriveLetter(e.slice(0,2))&&(2==e.length||"/"===(r=e.charAt(2))||"\\"===r||"?"===r||"#"===r)},shortenURLsPath=function(e){var r=e.path,t=r.length;!t||"file"==e.scheme&&1==t&&isWindowsDriveLetter(r[0],!0)||r.pop()},isSingleDot=function(e){return"."===e||"%2e"===e.toLowerCase()},isDoubleDot=function(e){return".."===(e=e.toLowerCase())||"%2e."===e||".%2e"===e||"%2e%2e"===e},SCHEME_START={},SCHEME={},NO_SCHEME={},SPECIAL_RELATIVE_OR_AUTHORITY={},PATH_OR_AUTHORITY={},RELATIVE={},RELATIVE_SLASH={},SPECIAL_AUTHORITY_SLASHES={},SPECIAL_AUTHORITY_IGNORE_SLASHES={},AUTHORITY={},HOST={},HOSTNAME={},PORT={},FILE={},FILE_SLASH={},FILE_HOST={},PATH_START={},PATH={},CANNOT_BE_A_BASE_URL_PATH={},QUERY={},FRAGMENT={},parseURL=function(e,r,t,a){var i,s,c,l,u=t||SCHEME_START,p=0,d="",y=!1,h=!1,A=!1;for(t||(e.scheme="",e.username="",e.password="",e.host=null,e.port=null,e.path=[],e.query=null,e.fragment=null,e.cannotBeABaseURL=!1,r=r.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE,"")),r=r.replace(TAB_AND_NEW_LINE,""),i=arrayFrom(r);p<=i.length;){switch(s=i[p],u){case SCHEME_START:if(!s||!ALPHA.test(s)){if(t)return INVALID_SCHEME;u=NO_SCHEME;continue}d+=s.toLowerCase(),u=SCHEME;break;case SCHEME:if(s&&(ALPHANUMERIC.test(s)||"+"==s||"-"==s||"."==s))d+=s.toLowerCase();else{if(":"!=s){if(t)return INVALID_SCHEME;d="",u=NO_SCHEME,p=0;continue}if(t&&(isSpecial(e)!=has$1(specialSchemes,d)||"file"==d&&(includesCredentials(e)||null!==e.port)||"file"==e.scheme&&!e.host))return;if(e.scheme=d,t)return void(isSpecial(e)&&specialSchemes[e.scheme]==e.port&&(e.port=null));d="","file"==e.scheme?u=FILE:isSpecial(e)&&a&&a.scheme==e.scheme?u=SPECIAL_RELATIVE_OR_AUTHORITY:isSpecial(e)?u=SPECIAL_AUTHORITY_SLASHES:"/"==i[p+1]?(u=PATH_OR_AUTHORITY,p++):(e.cannotBeABaseURL=!0,e.path.push(""),u=CANNOT_BE_A_BASE_URL_PATH)}break;case NO_SCHEME:if(!a||a.cannotBeABaseURL&&"#"!=s)return INVALID_SCHEME;if(a.cannotBeABaseURL&&"#"==s){e.scheme=a.scheme,e.path=a.path.slice(),e.query=a.query,e.fragment="",e.cannotBeABaseURL=!0,u=FRAGMENT;break}u="file"==a.scheme?FILE:RELATIVE;continue;case SPECIAL_RELATIVE_OR_AUTHORITY:if("/"!=s||"/"!=i[p+1]){u=RELATIVE;continue}u=SPECIAL_AUTHORITY_IGNORE_SLASHES,p++;break;case PATH_OR_AUTHORITY:if("/"==s){u=AUTHORITY;break}u=PATH;continue;case RELATIVE:if(e.scheme=a.scheme,s==EOF)e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.query=a.query;else if("/"==s||"\\"==s&&isSpecial(e))u=RELATIVE_SLASH;else if("?"==s)e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.query="",u=QUERY;else{if("#"!=s){e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.path.pop(),u=PATH;continue}e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,e.path=a.path.slice(),e.query=a.query,e.fragment="",u=FRAGMENT}break;case RELATIVE_SLASH:if(!isSpecial(e)||"/"!=s&&"\\"!=s){if("/"!=s){e.username=a.username,e.password=a.password,e.host=a.host,e.port=a.port,u=PATH;continue}u=AUTHORITY}else u=SPECIAL_AUTHORITY_IGNORE_SLASHES;break;case SPECIAL_AUTHORITY_SLASHES:if(u=SPECIAL_AUTHORITY_IGNORE_SLASHES,"/"!=s||"/"!=d.charAt(p+1))continue;p++;break;case SPECIAL_AUTHORITY_IGNORE_SLASHES:if("/"!=s&&"\\"!=s){u=AUTHORITY;continue}break;case AUTHORITY:if("@"==s){y&&(d="%40"+d),y=!0,c=arrayFrom(d);for(var g=0;g 65535)return INVALID_PORT;e.port=isSpecial(e)&&E===specialSchemes[e.scheme]?null:E,d=""}if(t)return;u=PATH_START;continue}return INVALID_PORT}d+=s;break;case FILE:if(e.scheme="file","/"==s||"\\"==s)u=FILE_SLASH;else{if(!a||"file"!=a.scheme){u=PATH;continue}if(s==EOF)e.host=a.host,e.path=a.path.slice(),e.query=a.query;else if("?"==s)e.host=a.host,e.path=a.path.slice(),e.query="",u=QUERY;else{if("#"!=s){startsWithWindowsDriveLetter(i.slice(p).join(""))||(e.host=a.host,e.path=a.path.slice(),shortenURLsPath(e)),u=PATH;continue}e.host=a.host,e.path=a.path.slice(),e.query=a.query,e.fragment="",u=FRAGMENT}}break;case FILE_SLASH:if("/"==s||"\\"==s){u=FILE_HOST;break}a&&"file"==a.scheme&&!startsWithWindowsDriveLetter(i.slice(p).join(""))&&(isWindowsDriveLetter(a.path[0],!0)?e.path.push(a.path[0]):e.host=a.host),u=PATH;continue;case FILE_HOST:if(s==EOF||"/"==s||"\\"==s||"?"==s||"#"==s){if(!t&&isWindowsDriveLetter(d))u=PATH;else if(""==d){if(e.host="",t)return;u=PATH_START}else{if(l=parseHost(e,d))return l;if("localhost"==e.host&&(e.host=""),t)return;d="",u=PATH_START}continue}d+=s;break;case PATH_START:if(isSpecial(e)){if(u=PATH,"/"!=s&&"\\"!=s)continue}else if(t||"?"!=s)if(t||"#"!=s){if(s!=EOF&&(u=PATH,"/"!=s))continue}else e.fragment="",u=FRAGMENT;else e.query="",u=QUERY;break;case PATH:if(s==EOF||"/"==s||"\\"==s&&isSpecial(e)||!t&&("?"==s||"#"==s)){if(isDoubleDot(d)?(shortenURLsPath(e),"/"==s||"\\"==s&&isSpecial(e)||e.path.push("")):isSingleDot(d)?"/"==s||"\\"==s&&isSpecial(e)||e.path.push(""):("file"==e.scheme&&!e.path.length&&isWindowsDriveLetter(d)&&(e.host&&(e.host=""),d=d.charAt(0)+":"),e.path.push(d)),d="","file"==e.scheme&&(s==EOF||"?"==s||"#"==s))for(;e.path.length>1&&""===e.path[0];)e.path.shift();"?"==s?(e.query="",u=QUERY):"#"==s&&(e.fragment="",u=FRAGMENT)}else d+=percentEncode(s,pathPercentEncodeSet);break;case CANNOT_BE_A_BASE_URL_PATH:"?"==s?(e.query="",u=QUERY):"#"==s?(e.fragment="",u=FRAGMENT):s!=EOF&&(e.path[0]+=percentEncode(s,C0ControlPercentEncodeSet));break;case QUERY:t||"#"!=s?s!=EOF&&("'"==s&&isSpecial(e)?e.query+="%27":e.query+="#"==s?"%23":percentEncode(s,C0ControlPercentEncodeSet)):(e.fragment="",u=FRAGMENT);break;case FRAGMENT:s!=EOF&&(e.fragment+=percentEncode(s,fragmentPercentEncodeSet))}p++}},URLConstructor=function URL(e){var r,t,a=anInstance(this,URLConstructor,"URL"),i=arguments.length>1?arguments[1]:void 0,s=toString(e),c=setInternalState(a,{type:"URL"});if(void 0!==i)if(i instanceof URLConstructor)r=getInternalURLState(i);else if(t=parseURL(r={},toString(i)))throw TypeError(t);if(t=parseURL(c,s,null,r))throw TypeError(t);var l=c.searchParams=new URLSearchParams$1,u=getInternalSearchParamsState(l);u.updateSearchParams(c.query),u.updateURL=function(){c.query=String(l)||null},descriptors||(a.href=serializeURL.call(a),a.origin=getOrigin.call(a),a.protocol=getProtocol.call(a),a.username=getUsername.call(a),a.password=getPassword.call(a),a.host=getHost.call(a),a.hostname=getHostname.call(a),a.port=getPort.call(a),a.pathname=getPathname.call(a),a.search=getSearch.call(a),a.searchParams=getSearchParams.call(a),a.hash=getHash.call(a))},URLPrototype=URLConstructor.prototype,serializeURL=function(){var e=getInternalURLState(this),r=e.scheme,t=e.username,a=e.password,i=e.host,s=e.port,c=e.path,l=e.query,u=e.fragment,p=r+":";return null!==i?(p+="//",includesCredentials(e)&&(p+=t+(a?":"+a:"")+"@"),p+=serializeHost(i),null!==s&&(p+=":"+s)):"file"==r&&(p+="//"),p+=e.cannotBeABaseURL?c[0]:c.length?"/"+c.join("/"):"",null!==l&&(p+="?"+l),null!==u&&(p+="#"+u),p},getOrigin=function(){var e=getInternalURLState(this),r=e.scheme,t=e.port;if("blob"==r)try{return new URLConstructor(r.path[0]).origin}catch(e){return"null"}return"file"!=r&&isSpecial(e)?r+"://"+serializeHost(e.host)+(null!==t?":"+t:""):"null"},getProtocol=function(){return getInternalURLState(this).scheme+":"},getUsername=function(){return getInternalURLState(this).username},getPassword=function(){return getInternalURLState(this).password},getHost=function(){var e=getInternalURLState(this),r=e.host,t=e.port;return null===r?"":null===t?serializeHost(r):serializeHost(r)+":"+t},getHostname=function(){var e=getInternalURLState(this).host;return null===e?"":serializeHost(e)},getPort=function(){var e=getInternalURLState(this).port;return null===e?"":String(e)},getPathname=function(){var e=getInternalURLState(this),r=e.path;return e.cannotBeABaseURL?r[0]:r.length?"/"+r.join("/"):""},getSearch=function(){var e=getInternalURLState(this).query;return e?"?"+e:""},getSearchParams=function(){return getInternalURLState(this).searchParams},getHash=function(){var e=getInternalURLState(this).fragment;return e?"#"+e:""},accessorDescriptor=function(e,r){return{get:e,set:r,configurable:!0,enumerable:!0}};if(descriptors&&objectDefineProperties(URLPrototype,{href:accessorDescriptor(serializeURL,(function(e){var r=getInternalURLState(this),t=toString(e),a=parseURL(r,t);if(a)throw TypeError(a);getInternalSearchParamsState(r.searchParams).updateSearchParams(r.query)})),origin:accessorDescriptor(getOrigin),protocol:accessorDescriptor(getProtocol,(function(e){var r=getInternalURLState(this);parseURL(r,toString(e)+":",SCHEME_START)})),username:accessorDescriptor(getUsername,(function(e){var r=getInternalURLState(this),t=arrayFrom(toString(e));if(!cannotHaveUsernamePasswordPort(r)){r.username="";for(var a=0;a 1?arguments[1]:void 0)};for(var COLLECTION_NAME in domIterables){var Collection=global$1[COLLECTION_NAME],CollectionPrototype=Collection&&Collection.prototype;if(CollectionPrototype&&CollectionPrototype.forEach!==arrayForEach)try{createNonEnumerableProperty(CollectionPrototype,"forEach",arrayForEach)}catch(e){CollectionPrototype.forEach=arrayForEach}}var propertyIsEnumerable=objectPropertyIsEnumerable.f,createMethod=function(e){return function(r){for(var t,a=toIndexedObject(r),i=objectKeys(a),s=i.length,c=0,l=[];s>c;)t=i[c++],descriptors&&!propertyIsEnumerable.call(a,t)||l.push(e?[t,a[t]]:a[t]);return l}},objectToArray={entries:createMethod(!0),values:createMethod(!1)},$entries=objectToArray.entries;_export({target:"Object",stat:!0},{entries:function entries(e){return $entries(e)}});var notARegexp=function(e){if(isRegexp(e))throw TypeError("The method doesn't accept regular expressions");return e},MATCH=wellKnownSymbol("match"),correctIsRegexpLogic=function(e){var r=/./;try{"/./"[e](r)}catch(t){try{return r[MATCH]=!1,"/./"[e](r)}catch(e){}}return!1},getOwnPropertyDescriptor=objectGetOwnPropertyDescriptor.f,$startsWith="".startsWith,min$1=Math.min,CORRECT_IS_REGEXP_LOGIC=correctIsRegexpLogic("startsWith"),MDN_POLYFILL_BUG=!(CORRECT_IS_REGEXP_LOGIC||(descriptor=getOwnPropertyDescriptor(String.prototype,"startsWith"),!descriptor||descriptor.writable)),descriptor;_export({target:"String",proto:!0,forced:!MDN_POLYFILL_BUG&&!CORRECT_IS_REGEXP_LOGIC},{startsWith:function startsWith(e){var r=toString(requireObjectCoercible(this));notARegexp(e);var t=toLength(min$1(arguments.length>1?arguments[1]:void 0,r.length)),a=toString(e);return $startsWith?$startsWith.call(r,a,t):r.slice(t,t+a.length)===a}});var floor=Math.floor,replace="".replace,SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d{1,2})/g,getSubstitution=function(e,r,t,a,i,s){var c=t+e.length,l=a.length,u=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==i&&(i=toObject(i),u=SUBSTITUTION_SYMBOLS),replace.call(s,u,(function(s,u){var p;switch(u.charAt(0)){case"$":return"$";case"&":return e;case"`":return r.slice(0,t);case"'":return r.slice(c);case"<":p=i[u.slice(1,-1)];break;default:var d=+u;if(0===d)return s;if(d>l){var y=floor(d/10);return 0===y?s:y<=l?void 0===a[y-1]?u.charAt(1):a[y-1]+u.charAt(1):s}p=a[d-1]}return void 0===p?"":p}))},REPLACE=wellKnownSymbol("replace"),max=Math.max,min=Math.min,maybeToString=function(e){return void 0===e?e:String(e)},REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE=!!/./[REPLACE]&&""===/./[REPLACE]("a","$0"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}));fixRegexpWellKnownSymbolLogic("replace",(function(e,r,t){var a=REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE?"$":"$0";return[function replace(e,t){var a=requireObjectCoercible(this),i=null==e?void 0:e[REPLACE];return void 0!==i?i.call(e,a,t):r.call(toString(a),e,t)},function(e,i){var s=anObject(this),c=toString(e);if("string"==typeof i&&-1===i.indexOf(a)&&-1===i.indexOf("$<")){var l=t(r,s,c,i);if(l.done)return l.value}var u="function"==typeof i;u||(i=toString(i));var p=s.global;if(p){var d=s.unicode;s.lastIndex=0}for(var y=[];;){var h=regexpExecAbstract(s,c);if(null===h)break;if(y.push(h),!p)break;""===toString(h[0])&&(s.lastIndex=advanceStringIndex(c,toLength(s.lastIndex),d))}for(var A="",g=0,v=0;v =g&&(A+=c.slice(g,E)+S,g=E+m.length)}return A+c.slice(g)}]}),!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0||REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);var IS_CONCAT_SPREADABLE=wellKnownSymbol("isConcatSpreadable"),MAX_SAFE_INTEGER=9007199254740991,MAXIMUM_ALLOWED_INDEX_EXCEEDED="Maximum allowed index exceeded",IS_CONCAT_SPREADABLE_SUPPORT=engineV8Version>=51||!fails((function(){var e=[];return e[IS_CONCAT_SPREADABLE]=!1,e.concat()[0]!==e})),SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(e){if(!isObject(e))return!1;var r=e[IS_CONCAT_SPREADABLE];return void 0!==r?!!r:isArray(e)},FORCED=!IS_CONCAT_SPREADABLE_SUPPORT||!SPECIES_SUPPORT;_export({target:"Array",proto:!0,forced:FORCED},{concat:function concat(e){var r,t,a,i,s,c=toObject(this),l=arraySpeciesCreate(c,0),u=0;for(r=-1,a=arguments.length;rMAX_SAFE_INTEGER)throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);for(t=0;t=MAX_SAFE_INTEGER)throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);createProperty(l,u++,s)}return l.length=u,l}});var cnt=0,imageCompressionLibUrl,worker;function createWorker(e){return"function"==typeof e&&(e="(".concat(e,")()")),new Worker(URL.createObjectURL(new Blob([e])))}function createSourceObject(e){return URL.createObjectURL(new Blob([e],{type:"application/javascript"}))}function stringify(e){return JSON.stringify(e,(function(e,r){return"function"==typeof r?"BIC_FN:::(function () { return ".concat(r.toString()," })()"):r}))}function parse(o){if("string"==typeof o)return o;var result={};return Object.entries(o).forEach((function(_ref){var _ref2=_slicedToArray(_ref,2),key=_ref2[0],value=_ref2[1];if("string"==typeof value&&value.startsWith("BIC_FN:::"))try{result[key]=eval(value.replace(/^BIC_FN:::/,""))}catch(e){throw e}else result[key]=parse(value)})),result}function generateLib(){return createSourceObject("\n // reconstruct library\n function imageCompression (){return (".concat(imageCompression,").apply(null, arguments)}\n\n imageCompression.getDataUrlFromFile = ").concat(imageCompression.getDataUrlFromFile,"\n imageCompression.getFilefromDataUrl = ").concat(imageCompression.getFilefromDataUrl,"\n imageCompression.loadImage = ").concat(imageCompression.loadImage,"\n imageCompression.drawImageInCanvas = ").concat(imageCompression.drawImageInCanvas,"\n imageCompression.drawFileInCanvas = ").concat(imageCompression.drawFileInCanvas,"\n imageCompression.canvasToFile = ").concat(imageCompression.canvasToFile,"\n imageCompression.getExifOrientation = ").concat(imageCompression.getExifOrientation,"\n imageCompression.handleMaxWidthOrHeight = ").concat(imageCompression.handleMaxWidthOrHeight,"\n imageCompression.followExifOrientation = ").concat(imageCompression.followExifOrientation,"\n imageCompression.cleanupCanvasMemory = ").concat(imageCompression.cleanupCanvasMemory,"\n imageCompression.isAutoOrientationInBrowser = ").concat(imageCompression.isAutoOrientationInBrowser,"\n imageCompression.approximateBelowMaximumCanvasSizeOfBrowser = ").concat(imageCompression.approximateBelowMaximumCanvasSizeOfBrowser,"\n imageCompression.getBrowserName = ").concat(imageCompression.getBrowserName,"\n\n // functions / objects\n getDataUrlFromFile = imageCompression.getDataUrlFromFile\n getFilefromDataUrl = imageCompression.getFilefromDataUrl\n loadImage = imageCompression.loadImage\n drawImageInCanvas = imageCompression.drawImageInCanvas\n drawFileInCanvas = imageCompression.drawFileInCanvas\n canvasToFile = imageCompression.canvasToFile\n getExifOrientation = imageCompression.getExifOrientation\n handleMaxWidthOrHeight = imageCompression.handleMaxWidthOrHeight\n followExifOrientation = imageCompression.followExifOrientation\n cleanupCanvasMemory = imageCompression.cleanupCanvasMemory\n isAutoOrientationInBrowser = imageCompression.isAutoOrientationInBrowser\n approximateBelowMaximumCanvasSizeOfBrowser = imageCompression.approximateBelowMaximumCanvasSizeOfBrowser\n getBrowserName = imageCompression.getBrowserName\n \n getNewCanvasAndCtx = ").concat(getNewCanvasAndCtx,"\n CustomFileReader = FileReader\n CustomFile = File\n MaxCanvasSize = ").concat(JSON.stringify(MaxCanvasSize),"\n function compress (){return (").concat(compress,").apply(null, arguments)}\n\n // core-js\n function _slicedToArray(arr, n) { return arr }\n function _typeof(a) { return typeof a }\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n \n Object.assign(target, source)\n }\n \n return target;\n }\n\n // Libraries\n const parse = ").concat(parse,"\n const UPNG = {}\n UPNG.toRGBA8 = ").concat(UPNG.toRGBA8,"\n UPNG.toRGBA8.decodeImage = ").concat(UPNG.toRGBA8.decodeImage,"\n UPNG.decode = ").concat(UPNG.decode,"\n UPNG.decode._decompress = ").concat(UPNG.decode._decompress,"\n UPNG.decode._inflate = ").concat(UPNG.decode._inflate,"\n UPNG.decode._readInterlace = ").concat(UPNG.decode._readInterlace,"\n UPNG.decode._getBPP = ").concat(UPNG.decode._getBPP," \n UPNG.decode._filterZero = ").concat(UPNG.decode._filterZero,"\n UPNG.decode._paeth = ").concat(UPNG.decode._paeth,"\n UPNG.decode._IHDR = ").concat(UPNG.decode._IHDR,"\n UPNG._bin = parse(").concat(stringify(UPNG._bin),")\n UPNG._copyTile = ").concat(UPNG._copyTile,"\n UPNG.encode = ").concat(UPNG.encode,"\n UPNG.encodeLL = ").concat(UPNG.encodeLL," \n UPNG.encode._main = ").concat(UPNG.encode._main,"\n UPNG.encode.compressPNG = ").concat(UPNG.encode.compressPNG," \n UPNG.encode.compress = ").concat(UPNG.encode.compress,"\n UPNG.encode.framize = ").concat(UPNG.encode.framize," \n UPNG.encode._updateFrame = ").concat(UPNG.encode._updateFrame," \n UPNG.encode._prepareDiff = ").concat(UPNG.encode._prepareDiff," \n UPNG.encode._filterZero = ").concat(UPNG.encode._filterZero," \n UPNG.encode._filterLine = ").concat(UPNG.encode._filterLine,"\n UPNG.encode.concatRGBA = ").concat(UPNG.encode.concatRGBA,"\n UPNG.crc = parse(").concat(stringify(UPNG.crc),")\n UPNG.crc.table = ( function() {\n var tab = new Uint32Array(256);\n for (var n=0; n<256; n++) {\n var c = n;\n for (var k=0; k<8; k++) {\n if (c & 1) c = 0xedb88320 ^ (c >>> 1);\n else c = c >>> 1;\n }\n tab[n] = c; }\n return tab; })()\n UPNG.quantize = ").concat(UPNG.quantize," \n UPNG.quantize.getKDtree = ").concat(UPNG.quantize.getKDtree," \n UPNG.quantize.getNearest = ").concat(UPNG.quantize.getNearest," \n UPNG.quantize.planeDst = ").concat(UPNG.quantize.planeDst," \n UPNG.quantize.dist = ").concat(UPNG.quantize.dist," \n UPNG.quantize.splitPixels = ").concat(UPNG.quantize.splitPixels," \n UPNG.quantize.vecDot = ").concat(UPNG.quantize.vecDot," \n UPNG.quantize.stats = ").concat(UPNG.quantize.stats," \n UPNG.quantize.estats = ").concat(UPNG.quantize.estats,"\n UPNG.M4 = parse(").concat(stringify(UPNG.M4),")\n UPNG.encode.concatRGBA = ").concat(UPNG.encode.concatRGBA,'\n UPNG.inflateRaw=function(){\n var H={};H.H={};H.H.N=function(N,W){var R=Uint8Array,i=0,m=0,J=0,h=0,Q=0,X=0,u=0,w=0,d=0,v,C;\n if(N[0]==3&&N[1]==0)return W?W:new R(0);var V=H.H,n=V.b,A=V.e,l=V.R,M=V.n,I=V.A,e=V.Z,b=V.m,Z=W==null;\n if(Z)W=new R(N.length>>>2<<5);while(i==0){i=n(N,d,1);m=n(N,d+1,2);d+=3;if(m==0){if((d&7)!=0)d+=8-(d&7);\n var D=(d>>>3)+4,q=N[D-4]|N[D-3]<<8;if(Z)W=H.H.W(W,w+q);W.set(new R(N.buffer,N.byteOffset+D,q),w);d=D+q<<3;\n w+=q;continue}if(Z)W=H.H.W(W,w+(1<<17));if(m==1){v=b.J;C=b.h;X=(1<<9)-1;u=(1<<5)-1}if(m==2){J=A(N,d,5)+257;\n h=A(N,d+5,5)+1;Q=A(N,d+10,4)+4;d+=14;var E=d,j=1;for(var c=0;c<38;c+=2){b.Q[c]=0;b.Q[c+1]=0}for(var c=0;\n c j)j=K}d+=3*Q;M(b.Q,j);I(b.Q,j,b.u);v=b.w;C=b.d;\n d=l(b.u,(1<>>4;if(p>>>8==0){W[w++]=p}else if(p==256){break}else{var z=w+p-254;\n if(p>264){var _=b.q[p-257];z=w+(_>>>3)+A(N,d,_&7);d+=_&7}var $=C[e(N,d)&u];d+=$&15;var s=$>>>4,Y=b.c[s],a=(Y>>>4)+n(N,d,Y&15);\n d+=Y&15;while(w >>4;\n if(b<=15){A[I]=b;I++}else{var Z=0,m=0;if(b==16){m=3+l(V,n,2);n+=2;Z=A[I-1]}else if(b==17){m=3+l(V,n,3);\n n+=3}else if(b==18){m=11+l(V,n,7);n+=7}var J=I+m;while(I >>1;\n while(A n)n=M;A++}while(A >1,I=N[l+1],e=M<<4|I,b=W-I,Z=N[l]<>>15-W;R[J]=e;Z++}}};H.H.l=function(N,W){var R=H.H.m.r,V=15-W;for(var n=0;n >>V}};H.H.M=function(N,W,R){R=R<<(W&7);var V=W>>>3;N[V]|=R;N[V+1]|=R>>>8};\n H.H.I=function(N,W,R){R=R<<(W&7);var V=W>>>3;N[V]|=R;N[V+1]|=R>>>8;N[V+2]|=R>>>16};H.H.e=function(N,W,R){return(N[W>>>3]|N[(W>>>3)+1]<<8)>>>(W&7)&(1< >>3]|N[(W>>>3)+1]<<8|N[(W>>>3)+2]<<16)>>>(W&7)&(1< >>3]|N[(W>>>3)+1]<<8|N[(W>>>3)+2]<<16)>>>(W&7)};\n H.H.i=function(N,W){return(N[W>>>3]|N[(W>>>3)+1]<<8|N[(W>>>3)+2]<<16|N[(W>>>3)+3]<<24)>>>(W&7)};H.H.m=function(){var N=Uint16Array,W=Uint32Array;\n return{K:new N(16),j:new N(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new N(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new W(32),J:new N(512),_:[],h:new N(32),$:[],w:new N(32768),C:[],v:[],d:new N(32768),D:[],u:new N(512),Q:[],r:new N(1<<15),s:new W(286),Y:new W(30),a:new W(19),t:new W(15e3),k:new N(1<<16),g:new N(1<<15)}}();\n (function(){var N=H.H.m,W=1<<15;for(var R=0;R >>1|(V&1431655765)<<1;\n V=(V&3435973836)>>>2|(V&858993459)<<2;V=(V&4042322160)>>>4|(V&252645135)<<4;V=(V&4278255360)>>>8|(V&16711935)<<8;\n N.r[R]=(V>>>16|V<<16)>>>17}function n(A,l,M){while(l--!=0)A.push(0,M)}for(var R=0;R<32;R++){N.q[R]=N.S[R]<<3|N.T[R];\n N.c[R]=N.p[R]<<4|N.z[R]}n(N._,144,8);n(N._,255-143,9);n(N._,279-255,7);n(N._,287-279,8);H.H.n(N._,9);\n H.H.A(N._,9,N.J);H.H.l(N._,9);n(N.$,32,5);H.H.n(N.$,5);H.H.A(N.$,5,N.h);H.H.l(N.$,5);n(N.Q,19,0);n(N.C,286,0);\n n(N.D,30,0);n(N.v,320,0)}());return H.H.N}()\n \n const UZIP = {}\n UZIP["parse"] = ').concat(UZIP_1.parse,"\n UZIP._readLocal = ").concat(UZIP_1._readLocal,"\n UZIP.inflateRaw = ").concat(UZIP_1.inflateRaw,"\n UZIP.inflate = ").concat(UZIP_1.inflate,"\n UZIP.deflate = ").concat(UZIP_1.deflate,"\n UZIP.deflateRaw = ").concat(UZIP_1.deflateRaw,"\n UZIP.encode = ").concat(UZIP_1.encode,"\n UZIP._noNeed = ").concat(UZIP_1._noNeed,"\n UZIP._writeHeader = ").concat(UZIP_1._writeHeader,"\n UZIP.crc = parse(").concat(stringify(UZIP_1.crc),")\n UZIP.crc.table = ( function() {\n var tab = new Uint32Array(256);\n for (var n=0; n<256; n++) {\n var c = n;\n for (var k=0; k<8; k++) {\n if (c & 1) c = 0xedb88320 ^ (c >>> 1);\n else c = c >>> 1;\n }\n tab[n] = c; }\n return tab; })()\n \n UZIP.adler = ").concat(UZIP_1.adler,"\n UZIP.bin = parse(").concat(stringify(UZIP_1.bin),")\n UZIP.F = {}\n UZIP.F.deflateRaw = ").concat(UZIP_1.F.deflateRaw,"\n UZIP.F._bestMatch = ").concat(UZIP_1.F._bestMatch,"\n UZIP.F._howLong = ").concat(UZIP_1.F._howLong,"\n UZIP.F._hash = ").concat(UZIP_1.F._hash,"\n UZIP.saved = ").concat(UZIP_1.saved,"\n UZIP.F._writeBlock = ").concat(UZIP_1.F._writeBlock,"\n UZIP.F._copyExact = ").concat(UZIP_1.F._copyExact,"\n UZIP.F.getTrees = ").concat(UZIP_1.F.getTrees,"\n UZIP.F.getSecond = ").concat(UZIP_1.F.getSecond,"\n UZIP.F.nonZero = ").concat(UZIP_1.F.nonZero,"\n UZIP.F.contSize = ").concat(UZIP_1.F.contSize,"\n UZIP.F._codeTiny = ").concat(UZIP_1.F._codeTiny," \n UZIP.F._lenCodes = ").concat(UZIP_1.F._lenCodes," \n UZIP.F._hufTree = ").concat(UZIP_1.F._hufTree," \n UZIP.F.setDepth = ").concat(UZIP_1.F.setDepth," \n UZIP.F.restrictDepth = ").concat(UZIP_1.F.restrictDepth,"\n UZIP.F._goodIndex = ").concat(UZIP_1.F._goodIndex," \n UZIP.F._writeLit = ").concat(UZIP_1.F._writeLit," \n UZIP.F.inflate = ").concat(UZIP_1.F.inflate," \n UZIP.F._check = ").concat(UZIP_1.F._check," \n UZIP.F._decodeTiny = ").concat(UZIP_1.F._decodeTiny," \n UZIP.F._copyOut = ").concat(UZIP_1.F._copyOut," \n UZIP.F.makeCodes = ").concat(UZIP_1.F.makeCodes," \n UZIP.F.codes2map = ").concat(UZIP_1.F.codes2map," \n UZIP.F.revCodes = ").concat(UZIP_1.F.revCodes," \n\n // used only in deflate\n UZIP.F._putsE = ").concat(UZIP_1.F._putsE,"\n UZIP.F._putsF = ").concat(UZIP_1.F._putsF,"\n \n UZIP.F._bitsE = ").concat(UZIP_1.F._bitsE,"\n UZIP.F._bitsF = ").concat(UZIP_1.F._bitsF,"\n\n UZIP.F._get17 = ").concat(UZIP_1.F._get17,"\n UZIP.F._get25 = ").concat(UZIP_1.F._get25,"\n UZIP.F.U = function(){\n var u16=Uint16Array, u32=Uint32Array;\n return {\n next_code : new u16(16),\n bl_count : new u16(16),\n ordr : [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ],\n of0 : [3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],\n exb : [0,0,0,0,0,0,0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0],\n ldef : new u16(32),\n df0 : [1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577, 65535, 65535],\n dxb : [0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 0, 0],\n ddef : new u32(32),\n flmap: new u16( 512), fltree: [],\n fdmap: new u16( 32), fdtree: [],\n lmap : new u16(32768), ltree : [], ttree:[],\n dmap : new u16(32768), dtree : [],\n imap : new u16( 512), itree : [],\n //rev9 : new u16( 512)\n rev15: new u16(1<<15),\n lhst : new u32(286), dhst : new u32( 30), ihst : new u32(19),\n lits : new u32(15000),\n strt : new u16(1<<16),\n prev : new u16(1<<15)\n };\n } ();\n\n (function(){\n var U = UZIP.F.U;\n var len = 1<<15;\n for(var i=0; i >> 1) | ((x & 0x55555555) << 1));\n x = (((x & 0xcccccccc) >>> 2) | ((x & 0x33333333) << 2));\n x = (((x & 0xf0f0f0f0) >>> 4) | ((x & 0x0f0f0f0f) << 4));\n x = (((x & 0xff00ff00) >>> 8) | ((x & 0x00ff00ff) << 8));\n U.rev15[i] = (((x >>> 16) | (x << 16)))>>>17;\n }\n \n function pushV(tgt, n, sv) { while(n--!=0) tgt.push(0,sv); }\n \n for(var i=0; i<32; i++) { U.ldef[i]=(U.of0[i]<<3)|U.exb[i]; U.ddef[i]=(U.df0[i]<<4)|U.dxb[i]; }\n \n pushV(U.fltree, 144, 8); pushV(U.fltree, 255-143, 9); pushV(U.fltree, 279-255, 7); pushV(U.fltree,287-279,8);\n /*\n var i = 0;\n for(; i<=143; i++) U.fltree.push(0,8);\n for(; i<=255; i++) U.fltree.push(0,9);\n for(; i<=279; i++) U.fltree.push(0,7);\n for(; i<=287; i++) U.fltree.push(0,8);\n */\n UZIP.F.makeCodes(U.fltree, 9);\n UZIP.F.codes2map(U.fltree, 9, U.flmap);\n UZIP.F.revCodes (U.fltree, 9)\n \n pushV(U.fdtree,32,5);\n //for(i=0;i<32; i++) U.fdtree.push(0,5);\n UZIP.F.makeCodes(U.fdtree, 5);\n UZIP.F.codes2map(U.fdtree, 5, U.fdmap);\n UZIP.F.revCodes (U.fdtree, 5)\n \n pushV(U.itree,19,0); pushV(U.ltree,286,0); pushV(U.dtree,30,0); pushV(U.ttree,320,0);\n /*\n for(var i=0; i< 19; i++) U.itree.push(0,0);\n for(var i=0; i<286; i++) U.ltree.push(0,0);\n for(var i=0; i< 30; i++) U.dtree.push(0,0);\n for(var i=0; i<320; i++) U.ttree.push(0,0);\n */\n })()\n "))}function generateWorkerScript(){return createWorker("\n let scriptImported = false\n self.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n })\n ")}function compressOnWebWorker(e,r){return new Promise((function(t,a){return new Promise((function(i,s){var c=cnt++;return imageCompressionLibUrl||(imageCompressionLibUrl=generateLib()),worker||(worker=generateWorkerScript()),worker.addEventListener("message",(function handler(e){if(e.data.id===c){if(void 0!==e.data.progress)return void r.onProgress(e.data.progress);worker.removeEventListener("message",handler),e.data.error&&a(new Error(e.data.error)),t(e.data.file)}})),worker.addEventListener("error",a),worker.postMessage({file:e,id:c,imageCompressionLibUrl:imageCompressionLibUrl,options:_objectSpread2(_objectSpread2({},r),{},{onProgress:void 0})}),i()}))}))}function imageCompression(e,r){return new Promise((function(t,a){var i,s,c,l,u,p;if(i=_objectSpread2({},r),c=0,l=i.onProgress,i.maxSizeMB=i.maxSizeMB||Number.POSITIVE_INFINITY,u="boolean"!=typeof i.useWebWorker||i.useWebWorker,delete i.useWebWorker,i.onProgress=function(e){c=e,"function"==typeof l&&l(c)},!(e instanceof Blob||e instanceof CustomFile))return a(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return a(new Error("The file given is not an image"));if(p="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,!u||"function"!=typeof Worker||p)return compress(e,i).then(function(e){try{return s=e,$If_3.call(this)}catch(e){return a(e)}}.bind(this),a);var d=function(){try{return $If_3.call(this)}catch(e){return a(e)}}.bind(this),y=function $Try_1_Catch(r){try{return compress(e,i).then((function(e){try{return s=e,d()}catch(e){return a(e)}}),a)}catch(e){return a(e)}};try{return compressOnWebWorker(e,i).then((function(e){try{return s=e,d()}catch(e){return y()}}),y)}catch(e){y()}function $If_3(){try{s.name=e.name,s.lastModified=e.lastModified}catch(e){}return t(s)}}))}return imageCompression.getDataUrlFromFile=getDataUrlFromFile,imageCompression.getFilefromDataUrl=getFilefromDataUrl,imageCompression.loadImage=loadImage,imageCompression.drawImageInCanvas=drawImageInCanvas,imageCompression.drawFileInCanvas=drawFileInCanvas,imageCompression.canvasToFile=canvasToFile,imageCompression.getExifOrientation=getExifOrientation,imageCompression.handleMaxWidthOrHeight=handleMaxWidthOrHeight,imageCompression.followExifOrientation=followExifOrientation,imageCompression.cleanupCanvasMemory=cleanupCanvasMemory,imageCompression.isAutoOrientationInBrowser=isAutoOrientationInBrowser,imageCompression.approximateBelowMaximumCanvasSizeOfBrowser=approximateBelowMaximumCanvasSizeOfBrowser,imageCompression.getBrowserName=getBrowserName,imageCompression.version="1.0.15",imageCompression})); //# sourceMappingURL=browser-image-compression.js.map diff --git a/dist/browser-image-compression.js.map b/dist/browser-image-compression.js.map index f138778..6ed8500 100644 --- a/dist/browser-image-compression.js.map +++ b/dist/browser-image-compression.js.map @@ -1 +1 @@ -{"version":3,"file":"browser-image-compression.js","sources":["../node_modules/uzip/UZIP.js","../lib/UPNG.js","../lib/utils.js","../lib/image-compression.js","../lib/web-worker.js","../lib/index.js"],"sourcesContent":["\r\n\r\nvar UZIP = {};\r\nif(typeof module == \"object\") module.exports = UZIP;\r\n\r\n\r\nUZIP[\"parse\"] = function(buf, onlyNames)\t// ArrayBuffer\r\n{\r\n\tvar rUs = UZIP.bin.readUshort, rUi = UZIP.bin.readUint, o = 0, out = {};\r\n\tvar data = new Uint8Array(buf);\r\n\tvar eocd = data.length-4;\r\n\t\r\n\twhile(rUi(data, eocd)!=0x06054b50) eocd--;\r\n\t\r\n\tvar o = eocd;\r\n\to+=4;\t// sign = 0x06054b50\r\n\to+=4; // disks = 0;\r\n\tvar cnu = rUs(data, o); o+=2;\r\n\tvar cnt = rUs(data, o); o+=2;\r\n\t\t\t\r\n\tvar csize = rUi(data, o); o+=4;\r\n\tvar coffs = rUi(data, o); o+=4;\r\n\t\r\n\to = coffs;\r\n\tfor(var i=0; i 8514000) {\r\n\t\t\t//console.log(PUtils.readASCII(buf , 8514500, 500));\r\n\t\t\t//console.log(PUtils.readASCII(nbuf, 8514500, 500));\r\n\t\t}\r\n\t\tfor(var i=0; i >>4);\r\n\t//console.log(CM, CINFO,CMF,FLG);\r\n\treturn UZIP.inflateRaw(new Uint8Array(file.buffer, file.byteOffset+2, file.length-6), buf); \r\n}\r\nUZIP.deflate = function(data, opts/*, buf, off*/) {\r\n\tif(opts==null) opts={level:6};\r\n\tvar off=0, buf=new Uint8Array(50+Math.floor(data.length*1.1));\r\n\tbuf[off]=120; buf[off+1]=156; off+=2;\r\n\toff = UZIP.F.deflateRaw(data, buf, off, opts.level);\r\n\tvar crc = UZIP.adler(data, 0, data.length);\r\n\tbuf[off+0]=((crc>>>24)&255); \r\n\tbuf[off+1]=((crc>>>16)&255); \r\n\tbuf[off+2]=((crc>>> 8)&255); \r\n\tbuf[off+3]=((crc>>> 0)&255); \t\r\n\treturn new Uint8Array(buf.buffer, 0, off+4);\r\n}\r\nUZIP.deflateRaw = function(data, opts) {\r\n\tif(opts==null) opts={level:6};\r\n\tvar buf=new Uint8Array(50+Math.floor(data.length*1.1));\r\n\tvar off = UZIP.F.deflateRaw(data, buf, off, opts.level);\r\n\treturn new Uint8Array(buf.buffer, 0, off);\r\n}\r\n\r\n\r\nUZIP.encode = function(obj, noCmpr) {\r\n\tif(noCmpr==null) noCmpr=false;\r\n\tvar tot = 0, wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort;\r\n\tvar zpd = {};\r\n\tfor(var p in obj) { var cpr = !UZIP._noNeed(p) && !noCmpr, buf = obj[p], crc = UZIP.crc.crc(buf,0,buf.length); \r\n\t\tzpd[p] = { cpr:cpr, usize:buf.length, crc:crc, file: (cpr ? UZIP.deflateRaw(buf) : buf) }; }\r\n\t\r\n\tfor(var p in zpd) tot += zpd[p].file.length + 30 + 46 + 2*UZIP.bin.sizeUTF8(p);\r\n\ttot += 22;\r\n\t\r\n\tvar data = new Uint8Array(tot), o = 0;\r\n\tvar fof = []\r\n\t\r\n\tfor(var p in zpd) {\r\n\t\tvar file = zpd[p]; fof.push(o);\r\n\t\to = UZIP._writeHeader(data, o, p, file, 0);\r\n\t}\r\n\tvar i=0, ioff = o;\r\n\tfor(var p in zpd) {\r\n\t\tvar file = zpd[p]; fof.push(o);\r\n\t\to = UZIP._writeHeader(data, o, p, file, 1, fof[i++]);\t\t\r\n\t}\r\n\tvar csize = o-ioff;\r\n\t\r\n\twUi(data, o, 0x06054b50); o+=4;\r\n\to += 4; // disks\r\n\twUs(data, o, i); o += 2;\r\n\twUs(data, o, i); o += 2;\t// number of c d records\r\n\twUi(data, o, csize); o += 4;\r\n\twUi(data, o, ioff ); o += 4;\r\n\to += 2;\r\n\treturn data.buffer;\r\n}\r\n// no need to compress .PNG, .ZIP, .JPEG ....\r\nUZIP._noNeed = function(fn) { var ext = fn.split(\".\").pop().toLowerCase(); return \"png,jpg,jpeg,zip\".indexOf(ext)!=-1; }\r\n\r\nUZIP._writeHeader = function(data, o, p, obj, t, roff)\r\n{\r\n\tvar wUi = UZIP.bin.writeUint, wUs = UZIP.bin.writeUshort;\r\n\tvar file = obj.file;\r\n\t\r\n\twUi(data, o, t==0 ? 0x04034b50 : 0x02014b50); o+=4; // sign\r\n\tif(t==1) o+=2; // ver made by\r\n\twUs(data, o, 20); o+=2;\t// ver\r\n\twUs(data, o, 0); o+=2; // gflip\r\n\twUs(data, o, obj.cpr?8:0); o+=2;\t// cmpr\r\n\t\t\r\n\twUi(data, o, 0); o+=4;\t// time\t\t\r\n\twUi(data, o, obj.crc); o+=4;\t// crc32\r\n\twUi(data, o, file.length); o+=4;\t// csize\r\n\twUi(data, o, obj.usize); o+=4;\t// usize\r\n\t\t\r\n\twUs(data, o, UZIP.bin.sizeUTF8(p)); o+=2;\t// nlen\r\n\twUs(data, o, 0); o+=2;\t// elen\r\n\t\r\n\tif(t==1) {\r\n\t\to += 2; // comment length\r\n\t\to += 2; // disk number\r\n\t\to += 6; // attributes\r\n\t\twUi(data, o, roff); o+=4;\t// usize\r\n\t}\r\n\tvar nlen = UZIP.bin.writeUTF8(data, o, p); o+= nlen;\t\r\n\tif(t==0) { data.set(file, o); o += file.length; }\r\n\treturn o;\r\n}\r\n\r\n\r\n\r\n\r\n\r\nUZIP.crc = {\r\n\ttable : ( function() {\r\n\t var tab = new Uint32Array(256);\r\n\t for (var n=0; n<256; n++) {\r\n\t\t\tvar c = n;\r\n\t\t\tfor (var k=0; k<8; k++) {\r\n\t\t\t\tif (c & 1) c = 0xedb88320 ^ (c >>> 1);\r\n\t\t\t\telse c = c >>> 1;\r\n\t\t\t}\r\n\t\t\ttab[n] = c; } \r\n\t\treturn tab; })(),\r\n\tupdate : function(c, buf, off, len) {\r\n\t\tfor (var i=0; i >> 8);\r\n\t\treturn c;\r\n\t},\r\n\tcrc : function(b,o,l) { return UZIP.crc.update(0xffffffff,b,o,l) ^ 0xffffffff; }\r\n}\r\nUZIP.adler = function(data,o,len) {\r\n\tvar a = 1, b = 0;\r\n\tvar off = o, end=o+len;\r\n\twhile(off >8)&255; },\r\n\treadUint : function(buff,p) { return (buff[p+3]*(256*256*256)) + ((buff[p+2]<<16) | (buff[p+1]<< 8) | buff[p]); },\r\n\twriteUint : function(buff,p,n){ buff[p]=n&255; buff[p+1]=(n>>8)&255; buff[p+2]=(n>>16)&255; buff[p+3]=(n>>24)&255; },\r\n\treadASCII : function(buff,p,l){ var s = \"\"; for(var i=0; i > 6)); buff[p+i+1] = (128|((code>> 0)&63)); i+=2; }\r\n\t\t\telse if((code&(0xffffffff-(1<<16)+1))==0) { buff[p+i] = (224|(code>>12)); buff[p+i+1] = (128|((code>> 6)&63)); buff[p+i+2] = (128|((code>>0)&63)); i+=3; }\r\n\t\t\telse if((code&(0xffffffff-(1<<21)+1))==0) { buff[p+i] = (240|(code>>18)); buff[p+i+1] = (128|((code>>12)&63)); buff[p+i+2] = (128|((code>>6)&63)); buff[p+i+3] = (128|((code>>0)&63)); i+=4; }\r\n\t\t\telse throw \"e\";\r\n\t\t}\r\n\t\treturn i;\r\n\t},\r\n\tsizeUTF8 : function(str) {\r\n\t\tvar strl = str.length, i=0;\r\n\t\tfor(var ci=0; ci >>3;\r\n\t}\r\n\r\n\tvar lits = U.lits, strt=U.strt, prev=U.prev, li=0, lc=0, bs=0, ebits=0, c=0, nc=0; // last_item, literal_count, block_start\r\n\tif(dlen>2) { nc=UZIP.F._hash(data,0); strt[nc]=0; }\r\n\tvar nmch=0,nmci=0;\r\n\t\r\n\tfor(i=0; i 14000 || lc>26697) && (dlen-i)>100) {\r\n\t\t\t\tif(cvrd>>16) >>16)>(mch>>>16)) mch=0;\r\n\t\t\t}//*/\r\n\t\t\tvar len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw \"e\";\r\n\t\t\tif(mch!=0) { \r\n\t\t\t\tvar len = mch>>>16, dst = mch&0xffff; //if(i-dst<0) throw \"e\";\r\n\t\t\t\tvar lgi = goodIndex(len, U.of0); U.lhst[257+lgi]++; \r\n\t\t\t\tvar dgi = goodIndex(dst, U.df0); U.dhst[ dgi]++; ebits += U.exb[lgi] + U.dxb[dgi]; \r\n\t\t\t\tlits[li] = (len<<23)|(i-cvrd); lits[li+1] = (dst<<16)|(lgi<<8)|dgi; li+=2;\r\n\t\t\t\tcvrd = i + len; \r\n\t\t\t}\r\n\t\t\telse {\tU.lhst[data[i]]++; }\r\n\t\t\tlc++;\r\n\t\t}\r\n\t}\r\n\tif(bs!=i || data.length==0) {\r\n\t\tif(cvrd>>3;\r\n}\r\nUZIP.F._bestMatch = function(data, i, prev, c, nice, chain) {\r\n\tvar ci = (i&0x7fff), pi=prev[ci]; \r\n\t//console.log(\"----\", i);\r\n\tvar dif = ((ci-pi + (1<<15)) & 0x7fff); if(pi==ci || c!=UZIP.F._hash(data,i-dif)) return 0;\r\n\tvar tl=0, td=0; // top length, top distance\r\n\tvar dlim = Math.min(0x7fff, i);\r\n\twhile(dif<=dlim && --chain!=0 && pi!=ci /*&& c==UZIP.F._hash(data,i-dif)*/) {\r\n\t\tif(tl==0 || (data[i+tl]==data[i+tl-dif])) {\r\n\t\t\tvar cl = UZIP.F._howLong(data, i, dif);\r\n\t\t\tif(cl>tl) { \r\n\t\t\t\ttl=cl; td=dif; if(tl>=nice) break; //* \r\n\t\t\t\tif(dif+2 maxd) { maxd=curd; pi = ei; }\r\n\t\t\t\t} //*/\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tci=pi; pi = prev[ci];\r\n\t\tdif += ((ci-pi + (1<<15)) & 0x7fff);\r\n\t}\r\n\treturn (tl<<16)|td;\r\n}\r\nUZIP.F._howLong = function(data, i, dif) {\r\n\tif(data[i]!=data[i-dif] || data[i+1]!=data[i+1-dif] || data[i+2]!=data[i+2-dif]) return 0;\r\n\tvar oi=i, l = Math.min(data.length, i+258); i+=3;\r\n\t//while(i+4 >>23), end = off+(qb&((1<<23)-1));\r\n\t\t\twhile(off >16), lgi=(qc>>8)&255, dgi=(qc&255);\r\n\t\t\t\tpos = UZIP.F._writeLit(257+lgi, ltree, out, pos);\r\n\t\t\t\tputsE(out, pos, len-U.of0[lgi]); pos+=U.exb[lgi];\r\n\t\t\t\t\r\n\t\t\t\tpos = UZIP.F._writeLit(dgi, dtree, out, pos);\r\n\t\t\t\tputsF(out, pos, dst-U.df0[dgi]); pos+=U.dxb[dgi]; off+=len;\r\n\t\t\t}\r\n\t\t}\r\n\t\tpos = UZIP.F._writeLit(256, ltree, out, pos);\r\n\t}\r\n\t//console.log(pos-opos, fxdSize, dynSize, cstSize);\r\n\treturn pos;\r\n}\r\nUZIP.F._copyExact = function(data,off,len,out,pos) {\r\n\tvar p8 = (pos>>>3);\r\n\tout[p8]=(len); out[p8+1]=(len>>>8); out[p8+2]=255-out[p8]; out[p8+3]=255-out[p8+1]; p8+=4;\r\n\tout.set(new Uint8Array(data.buffer, off, len), p8);\r\n\t//for(var i=0; i 4 && U.itree[(U.ordr[numh-1]<<1)+1]==0) numh--;\r\n\treturn [ML, MD, MH, numl, numd, numh, lset, dset];\r\n}\r\nUZIP.F.getSecond= function(a) { var b=[]; for(var i=0; i >1)+\",\"; return b; }\r\nUZIP.F.contSize = function(tree, hst) { var s=0; for(var i=0; i 15) { UZIP.F._putsE(out, pos, rst, rsl); pos+=rsl; }\r\n\t}\r\n\treturn pos;\r\n}\r\nUZIP.F._lenCodes = function(tree, set) {\r\n\tvar len=tree.length; while(len!=2 && tree[len-1]==0) len-=2; // when no distances, keep one code with length 0\r\n\tfor(var i=0; i >>1, 138);\r\n\t\t\tif(zc<11) set.push(17, zc-3);\r\n\t\t\telse set.push(18, zc-11);\r\n\t\t\ti += zc*2-2;\r\n\t\t}\r\n\t\telse if(l==prv && nxt==l && nnxt==l) {\r\n\t\t\tvar lz = i+5;\r\n\t\t\twhile(lz+2 >>1, 6);\r\n\t\t\tset.push(16, zc-3);\r\n\t\t\ti += zc*2-2;\r\n\t\t}\r\n\t\telse set.push(l, 0);\r\n\t}\r\n\treturn len>>>1;\r\n}\r\nUZIP.F._hufTree = function(hst, tree, MAXL) {\r\n\tvar list=[], hl = hst.length, tl=tree.length, i=0;\r\n\tfor(i=0; i MAXL) { UZIP.F.restrictDepth(l2, MAXL, maxl); maxl = MAXL; }\r\n\tfor(i=0; i MD) { var od=dps[i].d; dps[i].d=MD; dbt+=bCost-(1<<(maxl-od)); } else break;\r\n\tdbt = dbt>>>(maxl-MD);\r\n\twhile(dbt>0) { var od=dps[i].d; if(od =0; i--) if(dps[i].d==MD && dbt<0) { dps[i].d--; dbt++; } if(dbt!=0) console.log(\"debt left\");\r\n}\r\n\r\nUZIP.F._goodIndex = function(v, arr) {\r\n\tvar i=0; if(arr[i|16]<=v) i|=16; if(arr[i|8]<=v) i|=8; if(arr[i|4]<=v) i|=4; if(arr[i|2]<=v) i|=2; if(arr[i|1]<=v) i|=1; return i;\r\n}\r\nUZIP.F._writeLit = function(ch, ltree, out, pos) {\r\n\tUZIP.F._putsF(out, pos, ltree[ch<<1]);\r\n\treturn pos+ltree[(ch<<1)+1];\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nUZIP.F.inflate = function(data, buf) {\r\n\tvar u8=Uint8Array;\r\n\tif(data[0]==3 && data[1]==0) return (buf ? buf : new u8(0));\r\n\tvar F=UZIP.F, bitsF = F._bitsF, bitsE = F._bitsE, decodeTiny = F._decodeTiny, makeCodes = F.makeCodes, codes2map=F.codes2map, get17 = F._get17;\r\n\tvar U = F.U;\r\n\t\r\n\tvar noBuf = (buf==null);\r\n\tif(noBuf) buf = new u8((data.length>>>2)<<3);\r\n\t\r\n\tvar BFINAL=0, BTYPE=0, HLIT=0, HDIST=0, HCLEN=0, ML=0, MD=0; \t\r\n\tvar off = 0, pos = 0;\r\n\tvar lmap, dmap;\r\n\t\r\n\twhile(BFINAL==0) {\t\t\r\n\t\tBFINAL = bitsF(data, pos , 1);\r\n\t\tBTYPE = bitsF(data, pos+1, 2); pos+=3;\r\n\t\t//console.log(BFINAL, BTYPE);\r\n\t\t\r\n\t\tif(BTYPE==0) {\r\n\t\t\tif((pos&7)!=0) pos+=8-(pos&7);\r\n\t\t\tvar p8 = (pos>>>3)+4, len = data[p8-4]|(data[p8-3]<<8); //console.log(len);//bitsF(data, pos, 16), \r\n\t\t\tif(noBuf) buf=UZIP.F._check(buf, off+len);\r\n\t\t\tbuf.set(new u8(data.buffer, data.byteOffset+p8, len), off);\r\n\t\t\t//for(var i=0; i tl)tl=l; } pos+=3*HCLEN; //console.log(itree);\r\n\t\t\tmakeCodes(U.itree, tl);\r\n\t\t\tcodes2map(U.itree, tl, U.imap);\r\n\t\t\t\r\n\t\t\tlmap = U.lmap; dmap = U.dmap;\r\n\t\t\t\r\n\t\t\tpos = decodeTiny(U.imap, (1< >>24))-1; pos+=(ml&0xffffff);\r\n\t\t\tmakeCodes(U.ltree, mx0);\r\n\t\t\tcodes2map(U.ltree, mx0, lmap);\r\n\t\t\t\r\n\t\t\t//var md = decodeTiny(U.imap, (1< >>24))-1; pos+=(md&0xffffff);\r\n\t\t\tmakeCodes(U.dtree, mx1);\r\n\t\t\tcodes2map(U.dtree, mx1, dmap);\r\n\t\t}\r\n\t\t//var ooff=off, opos=pos;\r\n\t\twhile(true) {\r\n\t\t\tvar code = lmap[get17(data, pos) & ML]; pos += code&15;\r\n\t\t\tvar lit = code>>>4; //U.lhst[lit]++; \r\n\t\t\tif((lit>>>8)==0) { buf[off++] = lit; }\r\n\t\t\telse if(lit==256) { break; }\r\n\t\t\telse {\r\n\t\t\t\tvar end = off+lit-254;\r\n\t\t\t\tif(lit>264) { var ebs = U.ldef[lit-257]; end = off + (ebs>>>3) + bitsE(data, pos, ebs&7); pos += ebs&7; }\r\n\t\t\t\t//UZIP.F.dst[end-off]++;\r\n\t\t\t\t\r\n\t\t\t\tvar dcode = dmap[get17(data, pos) & MD]; pos += dcode&15;\r\n\t\t\t\tvar dlit = dcode>>>4;\r\n\t\t\t\tvar dbs = U.ddef[dlit], dst = (dbs>>>4) + bitsF(data, pos, dbs&15); pos += dbs&15;\r\n\t\t\t\t\r\n\t\t\t\t//var o0 = off-dst, stp = Math.min(end-off, dst);\r\n\t\t\t\t//if(stp>20) while(off >>3);\r\n\t}\r\n\t//console.log(UZIP.F.dst);\r\n\t//console.log(tlen, dlen, off-tlen+tcnt);\r\n\treturn buf.length==off ? buf : buf.slice(0,off);\r\n}\r\nUZIP.F._check=function(buf, len) {\r\n\tvar bl=buf.length; if(len<=bl) return buf;\r\n\tvar nbuf = new Uint8Array(Math.max(bl<<1,len)); nbuf.set(buf,0);\r\n\t//for(var i=0; i >>4; \r\n\t\tif(lit<=15) { tree[i]=lit; i++; }\r\n\t\telse {\r\n\t\t\tvar ll = 0, n = 0;\r\n\t\t\tif(lit==16) {\r\n\t\t\t\tn = (3 + bitsE(data, pos, 2)); pos += 2; ll = tree[i-1];\r\n\t\t\t}\r\n\t\t\telse if(lit==17) {\r\n\t\t\t\tn = (3 + bitsE(data, pos, 3)); pos += 3;\r\n\t\t\t}\r\n\t\t\telse if(lit==18) {\r\n\t\t\t\tn = (11 + bitsE(data, pos, 7)); pos += 7;\r\n\t\t\t}\r\n\t\t\tvar ni = i+n;\r\n\t\t\twhile(i >>1;\r\n\twhile(i mx)mx=v; i++; }\r\n\twhile(i