@monogrid/gainmap-js 3.4.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/Loader-BdKdEGSJ.js +5 -0
  3. package/dist/{Loader-Bi9FKrn4.js → Loader-CL7itwBq.js} +46 -6
  4. package/dist/{QuadRenderer-D1rYlVRa.js → QuadRenderer-DIHDdKl6.js} +1 -1
  5. package/dist/{QuadRenderer-Bl8ThfRL.js → QuadRenderer-DPiEee1I.js} +1 -1
  6. package/dist/{_commonjsHelpers-D4ntYHBT.js → _commonjsHelpers-DVRbpukU.js} +1 -1
  7. package/dist/{_commonjsHelpers-CHnLGTFq.js → _commonjsHelpers-S7tZmPW-.js} +1 -1
  8. package/dist/{compress-B5svUHuf.js → compress-5gFn7Y4a.js} +1 -1
  9. package/dist/{compress-DBGuVQfM.js → compress-CTBeaiI1.js} +1 -1
  10. package/dist/core/iso-gainmap-metadata.d.ts +40 -0
  11. package/dist/decode/shared/extract.d.ts +5 -3
  12. package/dist/decode/shared/index.d.ts +1 -0
  13. package/dist/decode/shared/utils/extractISO.d.ts +15 -0
  14. package/dist/decode.js +5 -4
  15. package/dist/decode.min.js +2 -2
  16. package/dist/decode.umd.cjs +122 -5
  17. package/dist/decode.umd.min.cjs +2 -2
  18. package/dist/decode.webgpu.js +4 -3
  19. package/dist/decode.webgpu.min.js +2 -2
  20. package/dist/decode.webgpu.umd.cjs +122 -5
  21. package/dist/decode.webgpu.umd.min.cjs +2 -2
  22. package/dist/encode.js +4 -4
  23. package/dist/encode.min.js +2 -2
  24. package/dist/encode.umd.cjs +1 -1
  25. package/dist/encode.umd.min.cjs +1 -1
  26. package/dist/iso-gainmap-metadata-DNTSE4Qp.js +5 -0
  27. package/dist/iso-gainmap-metadata-Dk2F4Eoz.js +141 -0
  28. package/dist/libultrahdr/jpeg-assembler.d.ts +2 -0
  29. package/dist/libultrahdr.js +30 -7
  30. package/dist/libultrahdr.min.js +2 -2
  31. package/dist/libultrahdr.umd.cjs +104 -7
  32. package/dist/libultrahdr.umd.min.cjs +2 -2
  33. package/dist/third-party.txt +69 -69
  34. package/dist/worker-interface.js +2 -2
  35. package/dist/worker-interface.min.js +2 -2
  36. package/dist/worker-interface.umd.cjs +1 -1
  37. package/dist/worker-interface.umd.min.cjs +1 -1
  38. package/dist/worker.js +3 -3
  39. package/dist/worker.min.js +2 -2
  40. package/dist/worker.umd.cjs +1 -1
  41. package/dist/worker.umd.min.cjs +1 -1
  42. package/package.json +5 -1
  43. package/dist/Loader-uEDs4JZg.js +0 -5
@@ -1,32 +1,56 @@
1
- Name: is-promise
2
- Version: 2.2.2
1
+ Name: immediate
2
+ Version: 3.0.6
3
3
  License: MIT
4
4
  Private: false
5
- Description: Test whether an object looks like a promises-a+ promise
6
- Repository: https://github.com/then/is-promise.git
7
- Author: ForbesLindesay
8
- License Copyright:
5
+ Description: A cross browser microtask library
6
+ Repository: git://github.com/calvinmetcalf/immediate.git
7
+ Contributors:
8
+ Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)
9
+ Donavon West <github@donavon.com> (http://donavon.com)
10
+ Yaffle
11
+ Calvin Metcalf <calvin.metcalf@gmail.com>
12
+ License Text:
9
13
  ===
10
14
 
11
- Copyright (c) 2014 Forbes Lindesay
15
+ Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, Domenic Denicola, Brian Cavalier
12
16
 
13
- Permission is hereby granted, free of charge, to any person obtaining a copy
14
- of this software and associated documentation files (the "Software"), to deal
15
- in the Software without restriction, including without limitation the rights
16
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- copies of the Software, and to permit persons to whom the Software is
18
- furnished to do so, subject to the following conditions:
17
+ Permission is hereby granted, free of charge, to any person obtaining
18
+ a copy of this software and associated documentation files (the
19
+ "Software"), to deal in the Software without restriction, including
20
+ without limitation the rights to use, copy, modify, merge, publish,
21
+ distribute, sublicense, and/or sell copies of the Software, and to
22
+ permit persons to whom the Software is furnished to do so, subject to
23
+ the following conditions:
19
24
 
20
- The above copyright notice and this permission notice shall be included in
21
- all copies or substantial portions of the Software.
25
+ The above copyright notice and this permission notice shall be
26
+ included in all copies or substantial portions of the Software.
22
27
 
23
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
- THE SOFTWARE.
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
+
36
+ ---
37
+
38
+ Name: lie
39
+ Version: 3.3.0
40
+ License: MIT
41
+ Private: false
42
+ Description: A basic but performant promise implementation
43
+ Repository: https://github.com/calvinmetcalf/lie.git
44
+ License Text:
45
+ ===
46
+
47
+ #Copyright (c) 2014-2018 Calvin Metcalf, Jordan Harband
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
52
+
53
+ **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
30
54
 
31
55
  ---
32
56
 
@@ -38,7 +62,7 @@ Description: Communicate with a Web Worker using Promises, allowing transferList
38
62
  Repository: git+https://github.com/terikon/promise-worker-transferable.git
39
63
  Homepage: https://github.com/terikon/promise-worker-transferable#readme
40
64
  Author: Roman Viskin <npm@terikon.com>
41
- License Copyright:
65
+ License Text:
42
66
  ===
43
67
 
44
68
 
@@ -246,56 +270,32 @@ License Copyright:
246
270
 
247
271
  ---
248
272
 
249
- Name: immediate
250
- Version: 3.0.6
251
- License: MIT
252
- Private: false
253
- Description: A cross browser microtask library
254
- Repository: git://github.com/calvinmetcalf/immediate.git
255
- Contributors:
256
- Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)
257
- Donavon West <github@donavon.com> (http://donavon.com)
258
- Yaffle
259
- Calvin Metcalf <calvin.metcalf@gmail.com>
260
- License Copyright:
261
- ===
262
-
263
- Copyright (c) 2012 Barnesandnoble.com, llc, Donavon West, Domenic Denicola, Brian Cavalier
264
-
265
- Permission is hereby granted, free of charge, to any person obtaining
266
- a copy of this software and associated documentation files (the
267
- "Software"), to deal in the Software without restriction, including
268
- without limitation the rights to use, copy, modify, merge, publish,
269
- distribute, sublicense, and/or sell copies of the Software, and to
270
- permit persons to whom the Software is furnished to do so, subject to
271
- the following conditions:
272
-
273
- The above copyright notice and this permission notice shall be
274
- included in all copies or substantial portions of the Software.
275
-
276
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
277
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
278
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
279
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
280
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
281
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
282
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
283
-
284
- ---
285
-
286
- Name: lie
287
- Version: 3.3.0
273
+ Name: is-promise
274
+ Version: 2.2.2
288
275
  License: MIT
289
276
  Private: false
290
- Description: A basic but performant promise implementation
291
- Repository: https://github.com/calvinmetcalf/lie.git
292
- License Copyright:
277
+ Description: Test whether an object looks like a promises-a+ promise
278
+ Repository: https://github.com/then/is-promise.git
279
+ Author: ForbesLindesay
280
+ License Text:
293
281
  ===
294
282
 
295
- #Copyright (c) 2014-2018 Calvin Metcalf, Jordan Harband
283
+ Copyright (c) 2014 Forbes Lindesay
296
284
 
297
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
285
+ Permission is hereby granted, free of charge, to any person obtaining a copy
286
+ of this software and associated documentation files (the "Software"), to deal
287
+ in the Software without restriction, including without limitation the rights
288
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
289
+ copies of the Software, and to permit persons to whom the Software is
290
+ furnished to do so, subject to the following conditions:
298
291
 
299
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
292
+ The above copyright notice and this permission notice shall be included in
293
+ all copies or substantial portions of the Software.
300
294
 
301
- **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
295
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
296
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
297
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
298
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
299
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
300
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
301
+ THE SOFTWARE.
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
6
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-CHnLGTFq.js';
6
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-S7tZmPW-.js';
7
7
 
8
8
  var lib$1;
9
9
  var hasRequiredLib$1;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
- import{c as e,g as t}from"./_commonjsHelpers-D4ntYHBT.js";var r,n,o,s,i,c;function u(){if(s)return o;s=1;var t=function(){if(n)return r;n=1;var t,o,s=e.MutationObserver||e.WebKitMutationObserver;if(process.browser)if(s){var i=0,c=new s(f),u=e.document.createTextNode("");c.observe(u,{characterData:!0}),t=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var a=new e.MessageChannel;a.port1.onmessage=f,t=function(){a.port2.postMessage(0)}}else t=function(){process.nextTick(f)};var l=[];function f(){var e,t;o=!0;for(var r=l.length;r;){for(t=l,l=[],e=-1;++e<r;)t[e]();r=l.length}o=!1}return r=function(e){1!==l.push(e)||o||t()}}();function i(){}var c={},u=["REJECTED"],a=["FULFILLED"],l=["PENDING"];if(!process.browser)var f=["UNHANDLED"];function h(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,process.browser||(this.handled=f),e!==i&&m(this,e)}function p(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function v(e,r,n){t(function(){var t;try{t=r(n)}catch(t){return c.reject(e,t)}t===e?c.reject(e,new TypeError("Cannot resolve promise with itself")):c.resolve(e,t)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function m(e,t){var r=!1;function n(t){r||(r=!0,c.reject(e,t))}function o(t){r||(r=!0,c.resolve(e,t))}var s=y(function(){t(o,n)});"error"===s.status&&n(s.value)}function y(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}return o=h,h.prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})})},h.prototype.catch=function(e){return this.then(null,e)},h.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===u)return this;var r=new this.constructor(i);(process.browser||this.handled===f&&(this.handled=null),this.state!==l)?v(r,this.state===a?e:t,this.outcome):this.queue.push(new p(r,e,t));return r},p.prototype.callFulfilled=function(e){c.resolve(this.promise,e)},p.prototype.otherCallFulfilled=function(e){v(this.promise,this.onFulfilled,e)},p.prototype.callRejected=function(e){c.reject(this.promise,e)},p.prototype.otherCallRejected=function(e){v(this.promise,this.onRejected,e)},c.resolve=function(e,t){var r=y(d,t);if("error"===r.status)return c.reject(e,r.value);var n=r.value;if(n)m(e,n);else{e.state=a,e.outcome=t;for(var o=-1,s=e.queue.length;++o<s;)e.queue[o].callFulfilled(t)}return e},c.reject=function(e,r){e.state=u,e.outcome=r,process.browser||e.handled===f&&t(function(){e.handled===f&&process.emit("unhandledRejection",r,e)});for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callRejected(r);return e},h.resolve=function(e){if(e instanceof this)return e;return c.resolve(new this(i),e)},h.reject=function(e){var t=new this(i);return c.reject(t,e)},h.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);var o=new Array(r),s=0,u=-1,a=new this(i);for(;++u<r;)l(e[u],u);return a;function l(e,i){t.resolve(e).then(function(e){o[i]=e,++s!==r||n||(n=!0,c.resolve(a,o))},function(e){n||(n=!0,c.reject(a,e))})}},h.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);var o=-1,s=new this(i);for(;++o<r;)u(e[o]);return s;function u(e){t.resolve(e).then(function(e){n||(n=!0,c.resolve(s,e))},function(e){n||(n=!0,c.reject(s,e))})}},o}var a=function(){if(c)return i;c=1;var e="undefined"!=typeof Promise?Promise:u(),t=0;function r(e,t){var r=t.data;if(Array.isArray(r)&&!(r.length<2)){var n=r[0],o=r[1],s=r[2],i=e._callbacks[n];i&&(delete e._callbacks[n],i(o,s))}}function n(e){var t=this;t._worker=e,t._callbacks={},e.addEventListener("message",function(e){r(t,e)})}return n.prototype.postMessage=function(n,o){var s=this,i=t++,c=[i,n];return new e(function(e,t){if(s._callbacks[i]=function(r,n){if(r)return t(new Error(r.message));e(n)},void 0!==s._worker.controller){var n=new MessageChannel;n.port1.onmessage=function(e){r(s,e)},s._worker.controller.postMessage(c,[n.port2].concat(o))}else s._worker.postMessage(c,o)})},n.prototype.terminate=function(){this._worker.terminate()},i=n}(),l=t(a);const f=e=>new l(e),h=e=>({compress:t=>e.postMessage({type:"compress",payload:t})});export{f as getPromiseWorker,h as getWorkerInterface};
5
+ import{c as e,g as t}from"./_commonjsHelpers-DVRbpukU.js";var r,n,o,s,i,c;function u(){if(s)return o;s=1;var t=function(){if(n)return r;n=1;var t,o,s=e.MutationObserver||e.WebKitMutationObserver;if(process.browser)if(s){var i=0,c=new s(f),u=e.document.createTextNode("");c.observe(u,{characterData:!0}),t=function(){u.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var a=new e.MessageChannel;a.port1.onmessage=f,t=function(){a.port2.postMessage(0)}}else t=function(){process.nextTick(f)};var l=[];function f(){var e,t;o=!0;for(var r=l.length;r;){for(t=l,l=[],e=-1;++e<r;)t[e]();r=l.length}o=!1}return r=function(e){1!==l.push(e)||o||t()}}();function i(){}var c={},u=["REJECTED"],a=["FULFILLED"],l=["PENDING"];if(!process.browser)var f=["UNHANDLED"];function h(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,process.browser||(this.handled=f),e!==i&&m(this,e)}function p(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function v(e,r,n){t(function(){var t;try{t=r(n)}catch(t){return c.reject(e,t)}t===e?c.reject(e,new TypeError("Cannot resolve promise with itself")):c.resolve(e,t)})}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function m(e,t){var r=!1;function n(t){r||(r=!0,c.reject(e,t))}function o(t){r||(r=!0,c.resolve(e,t))}var s=y(function(){t(o,n)});"error"===s.status&&n(s.value)}function y(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}return o=h,h.prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(r){return t.resolve(e()).then(function(){return r})},function(r){return t.resolve(e()).then(function(){throw r})})},h.prototype.catch=function(e){return this.then(null,e)},h.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===u)return this;var r=new this.constructor(i);(process.browser||this.handled===f&&(this.handled=null),this.state!==l)?v(r,this.state===a?e:t,this.outcome):this.queue.push(new p(r,e,t));return r},p.prototype.callFulfilled=function(e){c.resolve(this.promise,e)},p.prototype.otherCallFulfilled=function(e){v(this.promise,this.onFulfilled,e)},p.prototype.callRejected=function(e){c.reject(this.promise,e)},p.prototype.otherCallRejected=function(e){v(this.promise,this.onRejected,e)},c.resolve=function(e,t){var r=y(d,t);if("error"===r.status)return c.reject(e,r.value);var n=r.value;if(n)m(e,n);else{e.state=a,e.outcome=t;for(var o=-1,s=e.queue.length;++o<s;)e.queue[o].callFulfilled(t)}return e},c.reject=function(e,r){e.state=u,e.outcome=r,process.browser||e.handled===f&&t(function(){e.handled===f&&process.emit("unhandledRejection",r,e)});for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callRejected(r);return e},h.resolve=function(e){if(e instanceof this)return e;return c.resolve(new this(i),e)},h.reject=function(e){var t=new this(i);return c.reject(t,e)},h.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);var o=new Array(r),s=0,u=-1,a=new this(i);for(;++u<r;)l(e[u],u);return a;function l(e,i){t.resolve(e).then(function(e){o[i]=e,++s!==r||n||(n=!0,c.resolve(a,o))},function(e){n||(n=!0,c.reject(a,e))})}},h.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,n=!1;if(!r)return this.resolve([]);var o=-1,s=new this(i);for(;++o<r;)u(e[o]);return s;function u(e){t.resolve(e).then(function(e){n||(n=!0,c.resolve(s,e))},function(e){n||(n=!0,c.reject(s,e))})}},o}var a=function(){if(c)return i;c=1;var e="undefined"!=typeof Promise?Promise:u(),t=0;function r(e,t){var r=t.data;if(Array.isArray(r)&&!(r.length<2)){var n=r[0],o=r[1],s=r[2],i=e._callbacks[n];i&&(delete e._callbacks[n],i(o,s))}}function n(e){var t=this;t._worker=e,t._callbacks={},e.addEventListener("message",function(e){r(t,e)})}return n.prototype.postMessage=function(n,o){var s=this,i=t++,c=[i,n];return new e(function(e,t){if(s._callbacks[i]=function(r,n){if(r)return t(new Error(r.message));e(n)},void 0!==s._worker.controller){var n=new MessageChannel;n.port1.onmessage=function(e){r(s,e)},s._worker.controller.postMessage(c,[n.port2].concat(o))}else s._worker.postMessage(c,o)})},n.prototype.terminate=function(){this._worker.terminate()},i=n}(),l=t(a);const f=e=>new l(e),h=e=>({compress:t=>e.postMessage({type:"compress",payload:t})});export{f as getPromiseWorker,h as getWorkerInterface};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["worker-interface"]={})}(this,function(e){"use strict";var t,n,r,o,i,s,u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function a(){if(o)return r;o=1;var e=function(){if(n)return t;n=1;var e,r,o=u.MutationObserver||u.WebKitMutationObserver;if(process.browser)if(o){var i=0,s=new o(f),c=u.document.createTextNode("");s.observe(c,{characterData:!0}),e=function(){c.data=i=++i%2}}else if(u.setImmediate||void 0===u.MessageChannel)e="document"in u&&"onreadystatechange"in u.document.createElement("script")?function(){var e=u.document.createElement("script");e.onreadystatechange=function(){f(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},u.document.documentElement.appendChild(e)}:function(){setTimeout(f,0)};else{var a=new u.MessageChannel;a.port1.onmessage=f,e=function(){a.port2.postMessage(0)}}else e=function(){process.nextTick(f)};var l=[];function f(){var e,t;r=!0;for(var n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}r=!1}return t=function(t){1!==l.push(t)||r||e()}}();function i(){}var s={},c=["REJECTED"],a=["FULFILLED"],l=["PENDING"];if(!process.browser)var f=["UNHANDLED"];function h(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=l,this.queue=[],this.outcome=void 0,process.browser||(this.handled=f),e!==i&&y(this,e)}function p(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function d(t,n,r){e(function(){var e;try{e=n(r)}catch(e){return s.reject(t,e)}e===t?s.reject(t,new TypeError("Cannot resolve promise with itself")):s.resolve(t,e)})}function v(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function y(e,t){var n=!1;function r(t){n||(n=!0,s.reject(e,t))}function o(t){n||(n=!0,s.resolve(e,t))}var i=m(function(){t(o,r)});"error"===i.status&&r(i.value)}function m(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}return r=h,h.prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},h.prototype.catch=function(e){return this.then(null,e)},h.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===c)return this;var n=new this.constructor(i);(process.browser||this.handled===f&&(this.handled=null),this.state!==l)?d(n,this.state===a?e:t,this.outcome):this.queue.push(new p(n,e,t));return n},p.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},p.prototype.otherCallFulfilled=function(e){d(this.promise,this.onFulfilled,e)},p.prototype.callRejected=function(e){s.reject(this.promise,e)},p.prototype.otherCallRejected=function(e){d(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=m(v,t);if("error"===n.status)return s.reject(e,n.value);var r=n.value;if(r)y(e,r);else{e.state=a,e.outcome=t;for(var o=-1,i=e.queue.length;++o<i;)e.queue[o].callFulfilled(t)}return e},s.reject=function(t,n){t.state=c,t.outcome=n,process.browser||t.handled===f&&e(function(){t.handled===f&&process.emit("unhandledRejection",n,t)});for(var r=-1,o=t.queue.length;++r<o;)t.queue[r].callRejected(n);return t},h.resolve=function(e){if(e instanceof this)return e;return s.resolve(new this(i),e)},h.reject=function(e){var t=new this(i);return s.reject(t,e)},h.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);var o=new Array(n),u=0,c=-1,a=new this(i);for(;++c<n;)l(e[c],c);return a;function l(e,i){t.resolve(e).then(function(e){o[i]=e,++u!==n||r||(r=!0,s.resolve(a,o))},function(e){r||(r=!0,s.reject(a,e))})}},h.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);var o=-1,u=new this(i);for(;++o<n;)c(e[o]);return u;function c(e){t.resolve(e).then(function(e){r||(r=!0,s.resolve(u,e))},function(e){r||(r=!0,s.reject(u,e))})}},r}var l=function(){if(s)return i;s=1;var e="undefined"!=typeof Promise?Promise:a(),t=0;function n(e,t){var n=t.data;if(Array.isArray(n)&&!(n.length<2)){var r=n[0],o=n[1],i=n[2],s=e._callbacks[r];s&&(delete e._callbacks[r],s(o,i))}}function r(e){var t=this;t._worker=e,t._callbacks={},e.addEventListener("message",function(e){n(t,e)})}return r.prototype.postMessage=function(r,o){var i=this,s=t++,u=[s,r];return new e(function(e,t){if(i._callbacks[s]=function(n,r){if(n)return t(new Error(n.message));e(r)},void 0!==i._worker.controller){var r=new MessageChannel;r.port1.onmessage=function(e){n(i,e)},i._worker.controller.postMessage(u,[r.port2].concat(o))}else i._worker.postMessage(u,o)})},r.prototype.terminate=function(){this._worker.terminate()},i=r}(),f=c(l);e.getPromiseWorker=e=>new f(e),e.getWorkerInterface=e=>({compress:t=>e.postMessage({type:"compress",payload:t})})});
package/dist/worker.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
6
- import { g as getDefaultExportFromCjs } from './_commonjsHelpers-CHnLGTFq.js';
7
- import { c as compress } from './compress-DBGuVQfM.js';
6
+ import { g as getDefaultExportFromCjs } from './_commonjsHelpers-S7tZmPW-.js';
7
+ import { c as compress } from './compress-CTBeaiI1.js';
8
8
 
9
9
  var isPromise = {exports: {}};
10
10
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
- import{g as e}from"./_commonjsHelpers-D4ntYHBT.js";import{c as r}from"./compress-B5svUHuf.js";var n,t,o,s={exports:{}};function a(){if(n)return s.exports;function e(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}return n=1,s.exports=e,s.exports.default=e,s.exports}var f=function(){if(o)return t;o=1;var e=a();return t=function(r){function n(e,r,n,t){function o(r,n){"function"!=typeof self.postMessage?e.ports[0].postMessage(r,n):self.postMessage(r,n)}n?("undefined"!=typeof console&&"error"in console&&console.error("Worker caught an error:",n),o([r,{message:n.message}])):t instanceof s?o([r,null,t.message],t.transferList):o([r,null,t])}function t(e,r){return new s(e,r)}function o(r,o,s,a){var f=function(e,r){try{return{res:e(r,t)}}catch(e){return{err:e}}}(o,a);f.err?n(r,s,f.err):e(f.res)?f.res.then(function(e){n(r,s,null,e)},function(e){n(r,s,e)}):n(r,s,null,f.res)}function s(e,r){this.message=e,this.transferList=r}self.addEventListener("message",function(e){var t=e.data;if(Array.isArray(t)&&2===t.length){var s=t[0],a=t[1];"function"!=typeof r?n(e,s,new Error("Please pass a function into register().")):o(e,r,s,a)}})}}();e(f)(async(e,n)=>{if("compress"===e.type)return(async(e,n)=>{const t=await r(e.payload);return n({...t,source:e.payload.source instanceof ImageData?e.payload.source.data:new Uint8ClampedArray(e.payload.source)},[t.data.buffer,e.payload.source instanceof ImageData?e.payload.source.data.buffer:e.payload.source.buffer])})(e,n)});
5
+ import{g as e}from"./_commonjsHelpers-DVRbpukU.js";import{c as r}from"./compress-5gFn7Y4a.js";var n,t,o,s={exports:{}};function a(){if(n)return s.exports;function e(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}return n=1,s.exports=e,s.exports.default=e,s.exports}var f=function(){if(o)return t;o=1;var e=a();return t=function(r){function n(e,r,n,t){function o(r,n){"function"!=typeof self.postMessage?e.ports[0].postMessage(r,n):self.postMessage(r,n)}n?("undefined"!=typeof console&&"error"in console&&console.error("Worker caught an error:",n),o([r,{message:n.message}])):t instanceof s?o([r,null,t.message],t.transferList):o([r,null,t])}function t(e,r){return new s(e,r)}function o(r,o,s,a){var f=function(e,r){try{return{res:e(r,t)}}catch(e){return{err:e}}}(o,a);f.err?n(r,s,f.err):e(f.res)?f.res.then(function(e){n(r,s,null,e)},function(e){n(r,s,e)}):n(r,s,null,f.res)}function s(e,r){this.message=e,this.transferList=r}self.addEventListener("message",function(e){var t=e.data;if(Array.isArray(t)&&2===t.length){var s=t[0],a=t[1];"function"!=typeof r?n(e,s,new Error("Please pass a function into register().")):o(e,r,s,a)}})}}();e(f)(async(e,n)=>{if("compress"===e.type)return(async(e,n)=>{const t=await r(e.payload);return n({...t,source:e.payload.source instanceof ImageData?e.payload.source.data:new Uint8ClampedArray(e.payload.source)},[t.data.buffer,e.payload.source instanceof ImageData?e.payload.source.data.buffer:e.payload.source.buffer])})(e,n)});
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.4.1
2
+ * @monogrid/gainmap-js v3.5.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
  !function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n,r,a={exports:{}};function o(){if(t)return a.exports;function e(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}return t=1,a.exports=e,a.exports.default=e,a.exports}var s=function(){if(r)return n;r=1;var e=o();return n=function(t){function n(e,t,n,r){function a(t,n){"function"!=typeof self.postMessage?e.ports[0].postMessage(t,n):self.postMessage(t,n)}n?("undefined"!=typeof console&&"error"in console&&console.error("Worker caught an error:",n),a([t,{message:n.message}])):r instanceof o?a([t,null,r.message],r.transferList):a([t,null,r])}function r(e,t){return new o(e,t)}function a(t,a,o,s){var i=function(e,t){try{return{res:e(t,r)}}catch(e){return{err:e}}}(a,s);i.err?n(t,o,i.err):e(i.res)?i.res.then(function(e){n(t,o,null,e)},function(e){n(t,o,e)}):n(t,o,null,i.res)}function o(e,t){this.message=e,this.transferList=t}self.addEventListener("message",function(e){var r=e.data;if(Array.isArray(r)&&2===r.length){var o=r[0],s=r[1];"function"!=typeof t?n(e,o,new Error("Please pass a function into register().")):a(e,t,o,s)}})}}();const i=async e=>{if("undefined"==typeof createImageBitmap)throw new Error("createImageBitmap() not supported.");const{source:t,mimeType:n,quality:r,flipY:a}=e;let o;if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&"sourceMimeType"in e)o=new Blob([t],{type:e.sourceMimeType});else{if(!(t instanceof ImageData))throw new Error("Invalid source image");o=t}const s=await createImageBitmap(o),i=s.width,f=s.height;let c;"undefined"!=typeof OffscreenCanvas?c=new OffscreenCanvas(i,f):(c=document.createElement("canvas"),c.width=i,c.height=f);const u=c.getContext("2d");if(!u)throw new Error("Failed to create canvas Context");!0===a&&(u.translate(0,f),u.scale(1,-1)),u.drawImage(s,0,0,i,f);const l=await(async(e,t,n)=>{if("undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:n});if(e instanceof HTMLCanvasElement)return new Promise((r,a)=>{e.toBlob(e=>{e?r(e):a(new Error("Failed to convert canvas to blob"))},t,n)});throw new Error("Unsupported canvas element")})(c,n,r||.9);return{data:new Uint8Array(await l.arrayBuffer()),mimeType:n,width:i,height:f}};e(s)(async(e,t)=>{if("compress"===e.type)return(async(e,t)=>{const n=await i(e.payload);return t({...n,source:e.payload.source instanceof ImageData?e.payload.source.data:new Uint8ClampedArray(e.payload.source)},[n.data.buffer,e.payload.source instanceof ImageData?e.payload.source.data.buffer:e.payload.source.buffer])})(e,t)})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monogrid/gainmap-js",
3
- "version": "3.4.1",
3
+ "version": "3.5.0",
4
4
  "description": "A Javascript (TypeScript) Port of Adobe Gainmap Technology for storing HDR Images using an SDR Image + a gain map",
5
5
  "keywords": [
6
6
  "hdr",
@@ -163,5 +163,9 @@
163
163
  "publishConfig": {
164
164
  "access": "public",
165
165
  "registry": "https://registry.npmjs.org/"
166
+ },
167
+ "allowScripts": {
168
+ "sharp@0.34.5": true,
169
+ "unrs-resolver@1.11.1": true
166
170
  }
167
171
  }
@@ -1,5 +0,0 @@
1
- /**
2
- * @monogrid/gainmap-js v3.4.1
3
- * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
- */
5
- import{SRGBColorSpace as e,LinearSRGBColorSpace as t,HalfFloatType as a,Loader as r,LoadingManager as n,Texture as i,UVMapping as o,ClampToEdgeWrapping as s,LinearFilter as d,LinearMipMapLinearFilter as p,RGBAFormat as c,UnsignedByteType as l}from"three";function g(r){return n=>{const{sdr:i,gainMap:o,renderer:s}=n;i.colorSpace!==e&&(console.warn("SDR Colorspace needs to be *SRGBColorSpace*, setting it automatically"),i.colorSpace=e),i.needsUpdate=!0,o.colorSpace!==t&&(console.warn("Gainmap Colorspace needs to be *LinearSRGBColorSpace*, setting it automatically"),o.colorSpace=t),o.needsUpdate=!0;const d=r.createMaterial({...n,sdr:i,gainMap:o});return r.createQuadRenderer({width:i.image.width,height:i.image.height,type:a,colorSpace:t,material:d,renderer:s,renderTargetOptions:n.renderTargetOptions})}}class m extends Error{}class f extends Error{}const h=(e,t,a)=>{const r=new RegExp(`${t}="([^"]*)"`,"i").exec(e);if(r)return r[1];const n=new RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(n){const e=n[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):n[1].trim()}if(void 0!==a)return a;throw new Error(`Can't find ${t} in gainmap metadata`)},u=e=>{let t;t="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let a=t.indexOf("<x:xmpmeta");for(;-1!==a;){const e=t.indexOf("x:xmpmeta>",a),r=t.slice(a,e+10);try{const e=h(r,"hdrgm:GainMapMin","0"),t=h(r,"hdrgm:GainMapMax"),a=h(r,"hdrgm:Gamma","1"),n=h(r,"hdrgm:OffsetSDR","0.015625"),i=h(r,"hdrgm:OffsetHDR","0.015625"),o=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(r),s=o?o[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(r);if(!d)throw new Error("Incomplete gainmap metadata");const p=d[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],offsetSdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],offsetHdr:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],hdrCapacityMin:parseFloat(s),hdrCapacityMax:parseFloat(p)}}catch(e){}a=t.indexOf("<x:xmpmeta",e)}};class x{options;constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,a)=>{const r=this.options.debug,n=new DataView(e.buffer);if(65496!==n.getUint16(0))return void a(new Error("Not a valid jpeg"));const i=n.byteLength;let o,s=2,d=0;for(;s<i;){if(++d>250)return void a(new Error(`Found no marker after ${d} loops 😵`));if(255!==n.getUint8(s))return void a(new Error(`Not a valid marker at offset 0x${s.toString(16)}, found: 0x${n.getUint8(s).toString(16)}`));if(o=n.getUint8(s+1),r&&console.log(`Marker: ${o.toString(16)}`),226===o){r&&console.log("Found APP2 marker (0xffe2)");const e=s+4;if(1297106432===n.getUint32(e)){const r=e+4;let i;if(18761===n.getUint16(r))i=!1;else{if(19789!==n.getUint16(r))return void a(new Error("No valid endianness marker found in TIFF header"));i=!0}if(42!==n.getUint16(r+2,!i))return void a(new Error("Not valid TIFF data! (no 0x002A marker)"));const o=n.getUint32(r+4,!i);if(o<8)return void a(new Error("Not valid TIFF data! (First offset less than 8)"));const s=r+o,d=n.getUint16(s,!i),p=s+2;let c=0;for(let e=p;e<p+12*d;e+=12)45057===n.getUint16(e,!i)&&(c=n.getUint32(e+8,!i));const l=s+2+12*d+4,g=[];for(let e=l;e<l+16*c;e+=16){const t={MPType:n.getUint32(e,!i),size:n.getUint32(e+4,!i),dataOffset:n.getUint32(e+8,!i),dependantImages:n.getUint32(e+12,!i),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=r+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,g.push(t)}if(this.options.extractNonFII&&g.length){const e=new Blob([n]),a=[];for(const t of g){if(t.isFII&&!this.options.extractFII)continue;const r=e.slice(t.start,t.end+1,"image/jpeg");a.push(r)}t(a)}}}s+=2+n.getUint16(s+2)}})}}const w=async e=>{const t=u(e);if(!t)throw new f("Gain map XMP metadata not found");const a=new x({extractFII:!0,extractNonFII:!0}),r=await a.extract(e);if(2!==r.length)throw new m("Gain map recovery image not found");return{sdr:new Uint8Array(await r[0].arrayBuffer()),gainMap:new Uint8Array(await r[1].arrayBuffer()),metadata:t}},M=e=>new Promise((t,a)=>{const r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=e=>{a(e)},r.src=URL.createObjectURL(e)});class F extends r{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new n}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new i,sdr:new i});return this._config.createQuadRenderer({width:16,height:16,type:a,colorSpace:t,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,a){const r=t?new Blob([t],{type:"image/jpeg"}):void 0,n=new Blob([e],{type:"image/jpeg"});let i,o,s=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([r?M(r):Promise.resolve(void 0),M(n)]);o=e[0],i=e[1],s="flipY"===a}else{const e=await Promise.all([r?createImageBitmap(r,{imageOrientation:a||"flipY"}):Promise.resolve(void 0),createImageBitmap(n,{imageOrientation:a||"flipY"})]);o=e[0],i=e[1]}return{sdrImage:i,gainMapImage:o,needsFlip:s}}createTextures(a,r,n){const g=new i(r||new ImageData(2,2),o,s,s,d,p,c,l,1,t);g.flipY=n,g.needsUpdate=!0;const m=new i(a,o,s,s,d,p,c,l,1,e);return m.flipY=n,m.needsUpdate=!0,{gainMap:g,sdr:m}}updateQuadRenderer(e,t,a,r,n){e.width=t.width,e.height=t.height,e.material.gainMap=a,e.material.sdr=r,e.material.gainMapMin=n.gainMapMin,e.material.gainMapMax=n.gainMapMax,e.material.offsetHdr=n.offsetHdr,e.material.offsetSdr=n.offsetSdr,e.material.gamma=n.gamma,e.material.hdrCapacityMin=n.hdrCapacityMin,e.material.hdrCapacityMax=n.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,n.hdrCapacityMax),e.material.needsUpdate=!0}}export{m as G,F as L,x as M,f as X,u as a,g as c,w as e};