@monogrid/gainmap-js 3.7.1 → 3.7.3

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 (47) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +6 -0
  3. package/dist/{GainMapNode-Dl8yqSVg.js → GainMapNode-BIE27hYG.js} +1 -1
  4. package/dist/{GainMapNode-Cz4_NIGH.js → GainMapNode-DW8LUMdP.js} +1 -1
  5. package/dist/{Loader-DcZ7MyM7.js → Loader-DaVmW-sG.js} +2 -2
  6. package/dist/{Loader-BNe3xn0l.js → Loader-MfNS_T9s.js} +2 -2
  7. package/dist/{QuadRenderer-BOS9Aas1.js → QuadRenderer-C99kwfFS.js} +1 -1
  8. package/dist/{QuadRenderer-BqD-oQ7D.js → QuadRenderer-CM7qiSAI.js} +1 -1
  9. package/dist/{_commonjsHelpers-DrNnMDE-.js → _commonjsHelpers-DIhdSoQr.js} +1 -1
  10. package/dist/{_commonjsHelpers-pGJUN9hi.js → _commonjsHelpers-oyWUzYEt.js} +1 -1
  11. package/dist/{compress-DA31yhmz.js → compress-CSavQQ88.js} +1 -1
  12. package/dist/{compress-goZ8TdVo.js → compress-ChfVEpLY.js} +1 -1
  13. package/dist/decode.js +5 -5
  14. package/dist/decode.min.js +2 -2
  15. package/dist/decode.umd.cjs +1 -1
  16. package/dist/decode.umd.min.cjs +1 -1
  17. package/dist/decode.webgpu.js +6 -6
  18. package/dist/decode.webgpu.min.js +2 -2
  19. package/dist/decode.webgpu.umd.cjs +1 -1
  20. package/dist/decode.webgpu.umd.min.cjs +1 -1
  21. package/dist/encode/webgpu/GainMapEncoder.d.ts +19 -0
  22. package/dist/encode/webgpu/nodes/GainMapEncoderNode.d.ts +5 -0
  23. package/dist/encode.js +4 -4
  24. package/dist/encode.min.js +2 -2
  25. package/dist/encode.umd.cjs +1 -1
  26. package/dist/encode.umd.min.cjs +1 -1
  27. package/dist/encode.webgpu.js +47 -9
  28. package/dist/encode.webgpu.min.js +2 -2
  29. package/dist/encode.webgpu.umd.cjs +44 -6
  30. package/dist/encode.webgpu.umd.min.cjs +2 -2
  31. package/dist/{get-data-texture-Dlg6zKSG.js → get-data-texture-CtrXqvaR.js} +1 -1
  32. package/dist/{get-data-texture-CpszSMzv.js → get-data-texture-GGd_q2_x.js} +1 -1
  33. package/dist/{iso-gainmap-metadata-BwLnWVQ-.js → iso-gainmap-metadata-BnRsn_xQ.js} +1 -1
  34. package/dist/{iso-gainmap-metadata-CuDCCi9d.js → iso-gainmap-metadata-CwcJfksX.js} +1 -1
  35. package/dist/libultrahdr.js +8 -6
  36. package/dist/libultrahdr.min.js +2 -2
  37. package/dist/libultrahdr.umd.cjs +7 -5
  38. package/dist/libultrahdr.umd.min.cjs +2 -2
  39. package/dist/worker-interface.js +2 -2
  40. package/dist/worker-interface.min.js +2 -2
  41. package/dist/worker-interface.umd.cjs +1 -1
  42. package/dist/worker-interface.umd.min.cjs +1 -1
  43. package/dist/worker.js +3 -3
  44. package/dist/worker.min.js +2 -2
  45. package/dist/worker.umd.cjs +1 -1
  46. package/dist/worker.umd.min.cjs +1 -1
  47. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
- import{I as t,e,a as n}from"./iso-gainmap-metadata-CuDCCi9d.js";const a=216,r=225,s=226,i=218,p={SIGNATURE:new Uint8Array([77,80,70,0]),BIG_ENDIAN:new Uint8Array([77,77]),TIFF_MAGIC:42,NUM_PICTURES:2,TAG_COUNT:3,TAG_SIZE:12,MP_ENTRY_SIZE:16},o=45056,h=45057,g=45058,m=7,c=4,d=0,u=536870912,f=new Uint8Array([48,49,48,48]);function l(){return p.SIGNATURE.length+2+2+4+2+p.TAG_COUNT*p.TAG_SIZE+4+p.NUM_PICTURES*p.MP_ENTRY_SIZE}const M="Primary",U="GainMap",x="image/jpeg";function y(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function w(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function T(t,e,n,a){const r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(r.setUint8(e++,255),r.setUint8(e++,n),a&&a.length>0){const n=a.length+2;r.setUint16(e,n,!1),e+=2,t.set(a,e),e+=a.length}return e}function I(I){const{sdr:A,gainMap:E,metadata:C,exif:S,icc:R}=I;if("image/jpeg"!==A.mimeType)throw new Error("SDR image must be JPEG format");if("image/jpeg"!==E.mimeType)throw new Error("Gain map image must be JPEG format");const b=function(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(255!==e.getUint8(0)||e.getUint8(1)!==a)return null;let n=2;const s="Exif\0\0";for(;n<t.length-1&&255===e.getUint8(n);){const a=e.getUint8(n+1);if(a===i)break;if(a===r){const a=e.getUint16(n+2,!1),r=n+4;let i=!0;for(let e=0;e<6;e++)if(r+e>=t.length||t[r+e]!==s.charCodeAt(e)){i=!1;break}if(i){const e=a-2;return{data:t.slice(r,r+e),pos:n,size:a+2}}}n+=2+e.getUint16(n+2,!1)}return null}(A.data);if(b&&S)throw new Error("Primary image already contains EXIF data, cannot add external EXIF");let G=A.data,D=S;b&&(G=function(t,e,n){const a=t.length-n,r=new Uint8Array(a);return r.set(t.subarray(0,e),0),r.set(t.subarray(e+n),e),r}(A.data,b.pos,b.size),D=b.data);const N=function(t){const e=[],n=t.hdrCapacityMin,a=t.hdrCapacityMax,r=t=>Array.isArray(t)?t.reduce((t,e)=>t+e,0)/t.length:t,s=r(t.gainMapMin),i=r(t.gainMapMax),p=r(t.gamma),o=r(t.offsetSdr),h=r(t.offsetHdr);return e.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),e.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),e.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),e.push(" <rdf:Description"),e.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),e.push(` hdrgm:Version="${y(t.version)}"`),e.push(` hdrgm:GainMapMin="${y(s)}"`),e.push(` hdrgm:GainMapMax="${y(i)}"`),e.push(` hdrgm:Gamma="${y(p)}"`),e.push(` hdrgm:OffsetSDR="${y(o)}"`),e.push(` hdrgm:OffsetHDR="${y(h)}"`),e.push(` hdrgm:HDRCapacityMin="${y(n)}"`),e.push(` hdrgm:HDRCapacityMax="${y(a)}"`),e.push(' hdrgm:BaseRenditionIsHDR="False"'),e.push(' rdf:about=""/>'),e.push(" </rdf:RDF>"),e.push("</x:xmpmeta>"),e.push('<?xpacket end="w"?>'),e.join("\n")}(C),_=(new TextEncoder).encode(N),$=(new TextEncoder).encode("http://ns.adobe.com/xap/1.0/\0"),P=new Uint8Array($.length+_.length);P.set($,0),P.set(_,$.length);const F=(new TextEncoder).encode(t),j=w(F,n),k=w(F,e(C)),H=6+P.length+2+2+k.length+(E.data.length-2),z=function(t,e){const n=[];return n.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),n.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),n.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),n.push(" <rdf:Description"),n.push(' xmlns:Container="http://ns.google.com/photos/1.0/container/"'),n.push(' xmlns:Item="http://ns.google.com/photos/1.0/container/item/"'),n.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),n.push(` hdrgm:Version="${y(e.version)}"`),n.push(' rdf:about="">'),n.push(" <Container:Directory>"),n.push(" <rdf:Seq>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${M}"`),n.push(` Item:Mime="${x}"/>`),n.push(" </rdf:li>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${U}"`),n.push(` Item:Mime="${x}"`),n.push(` Item:Length="${t}"/>`),n.push(" </rdf:li>"),n.push(" </rdf:Seq>"),n.push(" </Container:Directory>"),n.push(" </rdf:Description>"),n.push(" </rdf:RDF>"),n.push("</x:xmpmeta>"),n.push('<?xpacket end="w"?>'),n.join("\n")}(H,C),O=(new TextEncoder).encode(z),B=new Uint8Array($.length+O.length);B.set($,0),B.set(O,$.length);const V=l();let Z=2;D&&(Z+=4+D.length),Z+=4+B.length,R&&(Z+=4+R.length),Z+=4+j.length,Z+=4+V,Z+=G.length-2,Z+=H;const X=Z-H,q=function(t,e,n,a){const r=l(),s=new ArrayBuffer(r),i=new DataView(s),M=new Uint8Array(s);let U=0;M.set(p.SIGNATURE,U),U+=p.SIGNATURE.length,M.set(p.BIG_ENDIAN,U);const x=!1;U+=2,i.setUint16(U,p.TIFF_MAGIC,x),U+=2,i.setUint32(U,8,x),U+=4,i.setUint16(U,p.TAG_COUNT,x),U+=2,i.setUint16(U,o,x),U+=2,i.setUint16(U,m,x),U+=2,i.setUint32(U,f.length,x),U+=4,M.set(f,U),U+=4,i.setUint16(U,h,x),U+=2,i.setUint16(U,c,x),U+=2,i.setUint32(U,1,x),U+=4,i.setUint32(U,p.NUM_PICTURES,x),U+=4,i.setUint16(U,g,x),U+=2,i.setUint16(U,m,x),U+=2,i.setUint32(U,p.MP_ENTRY_SIZE*p.NUM_PICTURES,x),U+=4;const y=U-p.SIGNATURE.length+4+4;return i.setUint32(U,y,x),U+=4,i.setUint32(U,0,x),U+=4,i.setUint32(U,d|u,x),U+=4,i.setUint32(U,t,x),U+=4,i.setUint32(U,e,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),U+=2,i.setUint32(U,d,x),U+=4,i.setUint32(U,n,x),U+=4,i.setUint32(U,a,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),M}(X,0,H,X-(2+(D?4+D.length:0)+2+2+B.length+(R?4+R.length:0)+2+2+j.length+2+2+4)),v=new Uint8Array(Z);let L=0;return L=T(v,L,a),D&&(L=T(v,L,r,D)),L=T(v,L,r,B),R&&(L=T(v,L,s,R)),L=T(v,L,s,j),L=T(v,L,s,q),v.set(G.subarray(2),L),L+=G.length-2,L=T(v,L,a),L=T(v,L,r,P),L=T(v,L,s,k),v.set(E.data.subarray(2),L),v}const A=t=>{if("image/jpeg"!==t.sdr.mimeType)throw new Error("This function expects an SDR image compressed in jpeg");if("image/jpeg"!==t.gainMap.mimeType)throw new Error("This function expects a GainMap image compressed in jpeg");const e={version:"1.0",gainMapMin:t.gainMapMin,gainMapMax:t.gainMapMax,gamma:t.gamma,offsetSdr:t.offsetSdr,offsetHdr:t.offsetHdr,hdrCapacityMin:t.hdrCapacityMin,hdrCapacityMax:t.hdrCapacityMax,minContentBoost:Array.isArray(t.gainMapMin)?Math.pow(2,t.gainMapMin.reduce((t,e)=>t+e,0)/t.gainMapMin.length):Math.pow(2,t.gainMapMin),maxContentBoost:Array.isArray(t.gainMapMax)?Math.pow(2,t.gainMapMax.reduce((t,e)=>t+e,0)/t.gainMapMax.length):Math.pow(2,t.gainMapMax)};return I({sdr:t.sdr,gainMap:t.gainMap,metadata:e})};export{A as encodeJPEGMetadata};
5
+ import{I as t,e,a as n}from"./iso-gainmap-metadata-CwcJfksX.js";const a=216,r=225,s=226,i=218,p={SIGNATURE:new Uint8Array([77,80,70,0]),BIG_ENDIAN:new Uint8Array([77,77]),TIFF_MAGIC:42,NUM_PICTURES:2,TAG_COUNT:3,TAG_SIZE:12,MP_ENTRY_SIZE:16},o=45056,h=45057,g=45058,m=7,c=4,d=0,u=196608,f=new Uint8Array([48,49,48,48]);function l(){return p.SIGNATURE.length+2+2+4+2+p.TAG_COUNT*p.TAG_SIZE+4+p.NUM_PICTURES*p.MP_ENTRY_SIZE}const M="Primary",U="GainMap",x="image/jpeg";function y(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function w(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function T(t,e,n,a){const r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(r.setUint8(e++,255),r.setUint8(e++,n),a&&a.length>0){const n=a.length+2;r.setUint16(e,n,!1),e+=2,t.set(a,e),e+=a.length}return e}function I(I){const{sdr:A,gainMap:E,metadata:C,exif:S,icc:R}=I;if("image/jpeg"!==A.mimeType)throw new Error("SDR image must be JPEG format");if("image/jpeg"!==E.mimeType)throw new Error("Gain map image must be JPEG format");const b=function(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(255!==e.getUint8(0)||e.getUint8(1)!==a)return null;let n=2;const s="Exif\0\0";for(;n<t.length-1&&255===e.getUint8(n);){const a=e.getUint8(n+1);if(a===i)break;if(a===r){const a=e.getUint16(n+2,!1),r=n+4;let i=!0;for(let e=0;e<6;e++)if(r+e>=t.length||t[r+e]!==s.charCodeAt(e)){i=!1;break}if(i){const e=a-2;return{data:t.slice(r,r+e),pos:n,size:a+2}}}n+=2+e.getUint16(n+2,!1)}return null}(A.data);if(b&&S)throw new Error("Primary image already contains EXIF data, cannot add external EXIF");let G=A.data,D=S;b&&(G=function(t,e,n){const a=t.length-n,r=new Uint8Array(a);return r.set(t.subarray(0,e),0),r.set(t.subarray(e+n),e),r}(A.data,b.pos,b.size),D=b.data);const N=function(t){const e=[],n=t.hdrCapacityMin,a=t.hdrCapacityMax,r=t=>Array.isArray(t)?t.reduce((t,e)=>t+e,0)/t.length:t,s=r(t.gainMapMin),i=r(t.gainMapMax),p=r(t.gamma),o=r(t.offsetSdr),h=r(t.offsetHdr);return e.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),e.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),e.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),e.push(" <rdf:Description"),e.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),e.push(` hdrgm:Version="${y(t.version)}"`),e.push(` hdrgm:GainMapMin="${y(s)}"`),e.push(` hdrgm:GainMapMax="${y(i)}"`),e.push(` hdrgm:Gamma="${y(p)}"`),e.push(` hdrgm:OffsetSDR="${y(o)}"`),e.push(` hdrgm:OffsetHDR="${y(h)}"`),e.push(` hdrgm:HDRCapacityMin="${y(n)}"`),e.push(` hdrgm:HDRCapacityMax="${y(a)}"`),e.push(' hdrgm:BaseRenditionIsHDR="False"'),e.push(' rdf:about=""/>'),e.push(" </rdf:RDF>"),e.push("</x:xmpmeta>"),e.push('<?xpacket end="w"?>'),e.join("\n")}(C),_=(new TextEncoder).encode(N),$=(new TextEncoder).encode("http://ns.adobe.com/xap/1.0/\0"),P=new Uint8Array($.length+_.length);P.set($,0),P.set(_,$.length);const F=(new TextEncoder).encode(t),j=w(F,n),k=w(F,e(C)),H=6+P.length+2+2+k.length+(E.data.length-2),z=function(t,e){const n=[];return n.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),n.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),n.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),n.push(" <rdf:Description"),n.push(' xmlns:Container="http://ns.google.com/photos/1.0/container/"'),n.push(' xmlns:Item="http://ns.google.com/photos/1.0/container/item/"'),n.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),n.push(` hdrgm:Version="${y(e.version)}"`),n.push(' rdf:about="">'),n.push(" <Container:Directory>"),n.push(" <rdf:Seq>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${M}"`),n.push(` Item:Mime="${x}"/>`),n.push(" </rdf:li>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${U}"`),n.push(` Item:Mime="${x}"`),n.push(` Item:Length="${t}"/>`),n.push(" </rdf:li>"),n.push(" </rdf:Seq>"),n.push(" </Container:Directory>"),n.push(" </rdf:Description>"),n.push(" </rdf:RDF>"),n.push("</x:xmpmeta>"),n.push('<?xpacket end="w"?>'),n.join("\n")}(H,C),O=(new TextEncoder).encode(z),B=new Uint8Array($.length+O.length);B.set($,0),B.set(O,$.length);const V=l();let Z=2;D&&(Z+=4+D.length),Z+=4+B.length,R&&(Z+=4+R.length),Z+=4+j.length,Z+=4+V,Z+=G.length-2,Z+=H;const X=Z-H,q=function(t,e,n,a){const r=l(),s=new ArrayBuffer(r),i=new DataView(s),M=new Uint8Array(s);let U=0;M.set(p.SIGNATURE,U),U+=p.SIGNATURE.length,M.set(p.BIG_ENDIAN,U);const x=!1;U+=2,i.setUint16(U,p.TIFF_MAGIC,x),U+=2,i.setUint32(U,8,x),U+=4,i.setUint16(U,p.TAG_COUNT,x),U+=2,i.setUint16(U,o,x),U+=2,i.setUint16(U,m,x),U+=2,i.setUint32(U,f.length,x),U+=4,M.set(f,U),U+=4,i.setUint16(U,h,x),U+=2,i.setUint16(U,c,x),U+=2,i.setUint32(U,1,x),U+=4,i.setUint32(U,p.NUM_PICTURES,x),U+=4,i.setUint16(U,g,x),U+=2,i.setUint16(U,m,x),U+=2,i.setUint32(U,p.MP_ENTRY_SIZE*p.NUM_PICTURES,x),U+=4;const y=U-p.SIGNATURE.length+4+4;return i.setUint32(U,y,x),U+=4,i.setUint32(U,0,x),U+=4,i.setUint32(U,d|u,x),U+=4,i.setUint32(U,t,x),U+=4,i.setUint32(U,e,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),U+=2,i.setUint32(U,d,x),U+=4,i.setUint32(U,n,x),U+=4,i.setUint32(U,a,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),M}(X,0,H,X-(2+(D?4+D.length:0)+2+2+B.length+(R?4+R.length:0)+2+2+j.length+2+2+4)),v=new Uint8Array(Z);let L=0;return L=T(v,L,a),D&&(L=T(v,L,r,D)),L=T(v,L,r,B),R&&(L=T(v,L,s,R)),L=T(v,L,s,j),L=T(v,L,s,q),v.set(G.subarray(2),L),L+=G.length-2,L=T(v,L,a),L=T(v,L,r,P),L=T(v,L,s,k),v.set(E.data.subarray(2),L),v}const A=t=>{if("image/jpeg"!==t.sdr.mimeType)throw new Error("This function expects an SDR image compressed in jpeg");if("image/jpeg"!==t.gainMap.mimeType)throw new Error("This function expects a GainMap image compressed in jpeg");const e={version:"1.0",gainMapMin:t.gainMapMin,gainMapMax:t.gainMapMax,gamma:t.gamma,offsetSdr:t.offsetSdr,offsetHdr:t.offsetHdr,hdrCapacityMin:t.hdrCapacityMin,hdrCapacityMax:t.hdrCapacityMax,minContentBoost:Array.isArray(t.gainMapMin)?Math.pow(2,t.gainMapMin.reduce((t,e)=>t+e,0)/t.gainMapMin.length):Math.pow(2,t.gainMapMin),maxContentBoost:Array.isArray(t.gainMapMax)?Math.pow(2,t.gainMapMax.reduce((t,e)=>t+e,0)/t.gainMapMax.length):Math.pow(2,t.gainMapMax)};return I({sdr:t.sdr,gainMap:t.gainMap,metadata:e})};export{A as encodeJPEGMetadata};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
@@ -156,13 +156,15 @@
156
156
  ULONG: 4
157
157
  };
158
158
  /**
159
- * MP entry attributes
159
+ * MP entry individual image attributes (CIPA DC-007 5.2.3.3.1)
160
+ *
161
+ * bits 31-27: flags, bits 26-24: image data format, bits 23-0: MP type code
160
162
  */
161
163
  const MP_ENTRY_ATTRIBUTES = {
162
164
  /** JPEG format */
163
165
  FORMAT_JPEG: 0x00000000,
164
- /** Primary image type */
165
- TYPE_PRIMARY: 0x20000000
166
+ /** Baseline MP Primary Image type code, matches libultrahdr kMPEntryAttributeTypePrimary */
167
+ TYPE_PRIMARY: 0x030000
166
168
  };
167
169
  /**
168
170
  * MPF version string
@@ -252,7 +254,7 @@
252
254
  view.setUint32(pos, 0, bigEndian);
253
255
  pos += 4;
254
256
  // Write MP entries for primary image
255
- // Attribute format: JPEG (0x00000000) | Type: Primary (0x20000000)
257
+ // Attribute format: JPEG (0x00000000) | Type: Baseline MP Primary Image (0x030000)
256
258
  view.setUint32(pos, MP_ENTRY_ATTRIBUTES.FORMAT_JPEG | MP_ENTRY_ATTRIBUTES.TYPE_PRIMARY, bigEndian);
257
259
  pos += 4;
258
260
  view.setUint32(pos, primaryImageSize, bigEndian);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).libultrahdr={})}(this,function(t){"use strict";const e=4294967295,n=new Uint8Array(4),a=t=>{const n=[0,1,2].map(e=>[t.gainMapMin[e],t.gainMapMax[e],t.gamma[e],t.offsetSdr[e],t.offsetHdr[e]]),a=n.some(t=>t.some((t,e)=>t!==n[0][e])),r=a?3:1,s=new Uint8Array(21+40*r),i=new DataView(s.buffer);let o=4;i.setUint8(o++,64|(a?128:0));const p=(t,n)=>{const[a,r]=((t,n)=>{const a=n?2147483647:e;if(!Number.isFinite(t)||!n&&t<0||Math.abs(t)>a)throw new Error(`Cannot represent ${t} as an ${n?"signed":"unsigned"} ISO 21496-1 fraction`);const r=Math.min(e,Math.floor(a/Math.max(1,Math.abs(t))));return[Math.round(t*r),r]})(t,n);n?i.setInt32(o,a):i.setUint32(o,a),i.setUint32(o+4,r),o+=8};p(t.hdrCapacityMin,!1),p(t.hdrCapacityMax,!1);for(let t=0;t<r;t++){const[e,a,r,s,i]=n[t];p(e,!0),p(a,!0),p(r,!1),p(s,!0),p(i,!0)}return s},r=216,s=225,i=226,o=218,p={SIGNATURE:new Uint8Array([77,80,70,0]),BIG_ENDIAN:new Uint8Array([77,77]),TIFF_MAGIC:42,NUM_PICTURES:2,TAG_COUNT:3,TAG_SIZE:12,MP_ENTRY_SIZE:16},h=45056,g=45057,d=45058,c=7,u=4,m=0,f=536870912,l=new Uint8Array([48,49,48,48]);function M(){return p.SIGNATURE.length+2+2+4+2+p.TAG_COUNT*p.TAG_SIZE+4+p.NUM_PICTURES*p.MP_ENTRY_SIZE}const U="Primary",x="GainMap",y="image/jpeg";function w(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function T(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function A(t,e,n,a){const r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(r.setUint8(e++,255),r.setUint8(e++,n),a&&a.length>0){const n=a.length+2;r.setUint16(e,n,!1),e+=2,t.set(a,e),e+=a.length}return e}function E(t){const{sdr:e,gainMap:E,metadata:I,exif:b,icc:C}=t;if("image/jpeg"!==e.mimeType)throw new Error("SDR image must be JPEG format");if("image/jpeg"!==E.mimeType)throw new Error("Gain map image must be JPEG format");const S=function(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(255!==e.getUint8(0)||e.getUint8(1)!==r)return null;let n=2;const a="Exif\0\0";for(;n<t.length-1&&255===e.getUint8(n);){const r=e.getUint8(n+1);if(r===o)break;if(r===s){const r=e.getUint16(n+2,!1),s=n+4;let i=!0;for(let e=0;e<6;e++)if(s+e>=t.length||t[s+e]!==a.charCodeAt(e)){i=!1;break}if(i){const e=r-2;return{data:t.slice(s,s+e),pos:n,size:r+2}}}n+=2+e.getUint16(n+2,!1)}return null}(e.data);if(S&&b)throw new Error("Primary image already contains EXIF data, cannot add external EXIF");let R=e.data,G=b;S&&(R=function(t,e,n){const a=t.length-n,r=new Uint8Array(a);return r.set(t.subarray(0,e),0),r.set(t.subarray(e+n),e),r}(e.data,S.pos,S.size),G=S.data);const D=function(t){const e=[],n=t.hdrCapacityMin,a=t.hdrCapacityMax,r=t=>Array.isArray(t)?t.reduce((t,e)=>t+e,0)/t.length:t,s=r(t.gainMapMin),i=r(t.gainMapMax),o=r(t.gamma),p=r(t.offsetSdr),h=r(t.offsetHdr);return e.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),e.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),e.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),e.push(" <rdf:Description"),e.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),e.push(` hdrgm:Version="${w(t.version)}"`),e.push(` hdrgm:GainMapMin="${w(s)}"`),e.push(` hdrgm:GainMapMax="${w(i)}"`),e.push(` hdrgm:Gamma="${w(o)}"`),e.push(` hdrgm:OffsetSDR="${w(p)}"`),e.push(` hdrgm:OffsetHDR="${w(h)}"`),e.push(` hdrgm:HDRCapacityMin="${w(n)}"`),e.push(` hdrgm:HDRCapacityMax="${w(a)}"`),e.push(' hdrgm:BaseRenditionIsHDR="False"'),e.push(' rdf:about=""/>'),e.push(" </rdf:RDF>"),e.push("</x:xmpmeta>"),e.push('<?xpacket end="w"?>'),e.join("\n")}(I),N=(new TextEncoder).encode(D),_=(new TextEncoder).encode("http://ns.adobe.com/xap/1.0/\0"),$=new Uint8Array(_.length+N.length);$.set(_,0),$.set(N,_.length);const P=(new TextEncoder).encode("urn:iso:std:iso:ts:21496:-1\0"),F=T(P,n),j=T(P,a(I)),k=6+$.length+2+2+j.length+(E.data.length-2),H=function(t,e){const n=[];return n.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),n.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),n.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),n.push(" <rdf:Description"),n.push(' xmlns:Container="http://ns.google.com/photos/1.0/container/"'),n.push(' xmlns:Item="http://ns.google.com/photos/1.0/container/item/"'),n.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),n.push(` hdrgm:Version="${w(e.version)}"`),n.push(' rdf:about="">'),n.push(" <Container:Directory>"),n.push(" <rdf:Seq>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${U}"`),n.push(` Item:Mime="${y}"/>`),n.push(" </rdf:li>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${x}"`),n.push(` Item:Mime="${y}"`),n.push(` Item:Length="${t}"/>`),n.push(" </rdf:li>"),n.push(" </rdf:Seq>"),n.push(" </Container:Directory>"),n.push(" </rdf:Description>"),n.push(" </rdf:RDF>"),n.push("</x:xmpmeta>"),n.push('<?xpacket end="w"?>'),n.join("\n")}(k,I),z=(new TextEncoder).encode(H),O=new Uint8Array(_.length+z.length);O.set(_,0),O.set(z,_.length);const B=M();let V=2;G&&(V+=4+G.length),V+=4+O.length,C&&(V+=4+C.length),V+=4+F.length,V+=4+B,V+=R.length-2,V+=k;const Z=V-k,X=function(t,e,n,a){const r=M(),s=new ArrayBuffer(r),i=new DataView(s),o=new Uint8Array(s);let U=0;o.set(p.SIGNATURE,U),U+=p.SIGNATURE.length,o.set(p.BIG_ENDIAN,U);const x=!1;U+=2,i.setUint16(U,p.TIFF_MAGIC,x),U+=2,i.setUint32(U,8,x),U+=4,i.setUint16(U,p.TAG_COUNT,x),U+=2,i.setUint16(U,h,x),U+=2,i.setUint16(U,c,x),U+=2,i.setUint32(U,l.length,x),U+=4,o.set(l,U),U+=4,i.setUint16(U,g,x),U+=2,i.setUint16(U,u,x),U+=2,i.setUint32(U,1,x),U+=4,i.setUint32(U,p.NUM_PICTURES,x),U+=4,i.setUint16(U,d,x),U+=2,i.setUint16(U,c,x),U+=2,i.setUint32(U,p.MP_ENTRY_SIZE*p.NUM_PICTURES,x),U+=4;const y=U-p.SIGNATURE.length+4+4;return i.setUint32(U,y,x),U+=4,i.setUint32(U,0,x),U+=4,i.setUint32(U,m|f,x),U+=4,i.setUint32(U,t,x),U+=4,i.setUint32(U,e,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),U+=2,i.setUint32(U,m,x),U+=4,i.setUint32(U,n,x),U+=4,i.setUint32(U,a,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),o}(Z,0,k,Z-(2+(G?4+G.length:0)+2+2+O.length+(C?4+C.length:0)+2+2+F.length+2+2+4)),q=new Uint8Array(V);let v=0;return v=A(q,v,r),G&&(v=A(q,v,s,G)),v=A(q,v,s,O),C&&(v=A(q,v,i,C)),v=A(q,v,i,F),v=A(q,v,i,X),q.set(R.subarray(2),v),v+=R.length-2,v=A(q,v,r),v=A(q,v,s,$),v=A(q,v,i,j),q.set(E.data.subarray(2),v),q}t.encodeJPEGMetadata=t=>{if("image/jpeg"!==t.sdr.mimeType)throw new Error("This function expects an SDR image compressed in jpeg");if("image/jpeg"!==t.gainMap.mimeType)throw new Error("This function expects a GainMap image compressed in jpeg");const e={version:"1.0",gainMapMin:t.gainMapMin,gainMapMax:t.gainMapMax,gamma:t.gamma,offsetSdr:t.offsetSdr,offsetHdr:t.offsetHdr,hdrCapacityMin:t.hdrCapacityMin,hdrCapacityMax:t.hdrCapacityMax,minContentBoost:Array.isArray(t.gainMapMin)?Math.pow(2,t.gainMapMin.reduce((t,e)=>t+e,0)/t.gainMapMin.length):Math.pow(2,t.gainMapMin),maxContentBoost:Array.isArray(t.gainMapMax)?Math.pow(2,t.gainMapMax.reduce((t,e)=>t+e,0)/t.gainMapMax.length):Math.pow(2,t.gainMapMax)};return E({sdr:t.sdr,gainMap:t.gainMap,metadata:e})}});
5
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).libultrahdr={})}(this,function(t){"use strict";const e=4294967295,n=new Uint8Array(4),a=t=>{const n=[0,1,2].map(e=>[t.gainMapMin[e],t.gainMapMax[e],t.gamma[e],t.offsetSdr[e],t.offsetHdr[e]]),a=n.some(t=>t.some((t,e)=>t!==n[0][e])),r=a?3:1,s=new Uint8Array(21+40*r),i=new DataView(s.buffer);let o=4;i.setUint8(o++,64|(a?128:0));const p=(t,n)=>{const[a,r]=((t,n)=>{const a=n?2147483647:e;if(!Number.isFinite(t)||!n&&t<0||Math.abs(t)>a)throw new Error(`Cannot represent ${t} as an ${n?"signed":"unsigned"} ISO 21496-1 fraction`);const r=Math.min(e,Math.floor(a/Math.max(1,Math.abs(t))));return[Math.round(t*r),r]})(t,n);n?i.setInt32(o,a):i.setUint32(o,a),i.setUint32(o+4,r),o+=8};p(t.hdrCapacityMin,!1),p(t.hdrCapacityMax,!1);for(let t=0;t<r;t++){const[e,a,r,s,i]=n[t];p(e,!0),p(a,!0),p(r,!1),p(s,!0),p(i,!0)}return s},r=216,s=225,i=226,o=218,p={SIGNATURE:new Uint8Array([77,80,70,0]),BIG_ENDIAN:new Uint8Array([77,77]),TIFF_MAGIC:42,NUM_PICTURES:2,TAG_COUNT:3,TAG_SIZE:12,MP_ENTRY_SIZE:16},h=45056,g=45057,d=45058,c=7,u=4,m=0,f=196608,l=new Uint8Array([48,49,48,48]);function M(){return p.SIGNATURE.length+2+2+4+2+p.TAG_COUNT*p.TAG_SIZE+4+p.NUM_PICTURES*p.MP_ENTRY_SIZE}const U="Primary",x="GainMap",y="image/jpeg";function w(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function T(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t,0),n.set(e,t.length),n}function A(t,e,n,a){const r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(r.setUint8(e++,255),r.setUint8(e++,n),a&&a.length>0){const n=a.length+2;r.setUint16(e,n,!1),e+=2,t.set(a,e),e+=a.length}return e}function E(t){const{sdr:e,gainMap:E,metadata:I,exif:b,icc:C}=t;if("image/jpeg"!==e.mimeType)throw new Error("SDR image must be JPEG format");if("image/jpeg"!==E.mimeType)throw new Error("Gain map image must be JPEG format");const S=function(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(255!==e.getUint8(0)||e.getUint8(1)!==r)return null;let n=2;const a="Exif\0\0";for(;n<t.length-1&&255===e.getUint8(n);){const r=e.getUint8(n+1);if(r===o)break;if(r===s){const r=e.getUint16(n+2,!1),s=n+4;let i=!0;for(let e=0;e<6;e++)if(s+e>=t.length||t[s+e]!==a.charCodeAt(e)){i=!1;break}if(i){const e=r-2;return{data:t.slice(s,s+e),pos:n,size:r+2}}}n+=2+e.getUint16(n+2,!1)}return null}(e.data);if(S&&b)throw new Error("Primary image already contains EXIF data, cannot add external EXIF");let R=e.data,G=b;S&&(R=function(t,e,n){const a=t.length-n,r=new Uint8Array(a);return r.set(t.subarray(0,e),0),r.set(t.subarray(e+n),e),r}(e.data,S.pos,S.size),G=S.data);const D=function(t){const e=[],n=t.hdrCapacityMin,a=t.hdrCapacityMax,r=t=>Array.isArray(t)?t.reduce((t,e)=>t+e,0)/t.length:t,s=r(t.gainMapMin),i=r(t.gainMapMax),o=r(t.gamma),p=r(t.offsetSdr),h=r(t.offsetHdr);return e.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),e.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),e.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),e.push(" <rdf:Description"),e.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),e.push(` hdrgm:Version="${w(t.version)}"`),e.push(` hdrgm:GainMapMin="${w(s)}"`),e.push(` hdrgm:GainMapMax="${w(i)}"`),e.push(` hdrgm:Gamma="${w(o)}"`),e.push(` hdrgm:OffsetSDR="${w(p)}"`),e.push(` hdrgm:OffsetHDR="${w(h)}"`),e.push(` hdrgm:HDRCapacityMin="${w(n)}"`),e.push(` hdrgm:HDRCapacityMax="${w(a)}"`),e.push(' hdrgm:BaseRenditionIsHDR="False"'),e.push(' rdf:about=""/>'),e.push(" </rdf:RDF>"),e.push("</x:xmpmeta>"),e.push('<?xpacket end="w"?>'),e.join("\n")}(I),N=(new TextEncoder).encode(D),_=(new TextEncoder).encode("http://ns.adobe.com/xap/1.0/\0"),$=new Uint8Array(_.length+N.length);$.set(_,0),$.set(N,_.length);const P=(new TextEncoder).encode("urn:iso:std:iso:ts:21496:-1\0"),F=T(P,n),j=T(P,a(I)),k=6+$.length+2+2+j.length+(E.data.length-2),H=function(t,e){const n=[];return n.push('<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?>'),n.push('<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.2">'),n.push(' <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'),n.push(" <rdf:Description"),n.push(' xmlns:Container="http://ns.google.com/photos/1.0/container/"'),n.push(' xmlns:Item="http://ns.google.com/photos/1.0/container/item/"'),n.push(' xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/"'),n.push(` hdrgm:Version="${w(e.version)}"`),n.push(' rdf:about="">'),n.push(" <Container:Directory>"),n.push(" <rdf:Seq>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${U}"`),n.push(` Item:Mime="${y}"/>`),n.push(" </rdf:li>"),n.push(' <rdf:li rdf:parseType="Resource">'),n.push(" <Container:Item"),n.push(` Item:Semantic="${x}"`),n.push(` Item:Mime="${y}"`),n.push(` Item:Length="${t}"/>`),n.push(" </rdf:li>"),n.push(" </rdf:Seq>"),n.push(" </Container:Directory>"),n.push(" </rdf:Description>"),n.push(" </rdf:RDF>"),n.push("</x:xmpmeta>"),n.push('<?xpacket end="w"?>'),n.join("\n")}(k,I),z=(new TextEncoder).encode(H),O=new Uint8Array(_.length+z.length);O.set(_,0),O.set(z,_.length);const B=M();let V=2;G&&(V+=4+G.length),V+=4+O.length,C&&(V+=4+C.length),V+=4+F.length,V+=4+B,V+=R.length-2,V+=k;const Z=V-k,X=function(t,e,n,a){const r=M(),s=new ArrayBuffer(r),i=new DataView(s),o=new Uint8Array(s);let U=0;o.set(p.SIGNATURE,U),U+=p.SIGNATURE.length,o.set(p.BIG_ENDIAN,U);const x=!1;U+=2,i.setUint16(U,p.TIFF_MAGIC,x),U+=2,i.setUint32(U,8,x),U+=4,i.setUint16(U,p.TAG_COUNT,x),U+=2,i.setUint16(U,h,x),U+=2,i.setUint16(U,c,x),U+=2,i.setUint32(U,l.length,x),U+=4,o.set(l,U),U+=4,i.setUint16(U,g,x),U+=2,i.setUint16(U,u,x),U+=2,i.setUint32(U,1,x),U+=4,i.setUint32(U,p.NUM_PICTURES,x),U+=4,i.setUint16(U,d,x),U+=2,i.setUint16(U,c,x),U+=2,i.setUint32(U,p.MP_ENTRY_SIZE*p.NUM_PICTURES,x),U+=4;const y=U-p.SIGNATURE.length+4+4;return i.setUint32(U,y,x),U+=4,i.setUint32(U,0,x),U+=4,i.setUint32(U,m|f,x),U+=4,i.setUint32(U,t,x),U+=4,i.setUint32(U,e,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),U+=2,i.setUint32(U,m,x),U+=4,i.setUint32(U,n,x),U+=4,i.setUint32(U,a,x),U+=4,i.setUint16(U,0,x),U+=2,i.setUint16(U,0,x),o}(Z,0,k,Z-(2+(G?4+G.length:0)+2+2+O.length+(C?4+C.length:0)+2+2+F.length+2+2+4)),q=new Uint8Array(V);let v=0;return v=A(q,v,r),G&&(v=A(q,v,s,G)),v=A(q,v,s,O),C&&(v=A(q,v,i,C)),v=A(q,v,i,F),v=A(q,v,i,X),q.set(R.subarray(2),v),v+=R.length-2,v=A(q,v,r),v=A(q,v,s,$),v=A(q,v,i,j),q.set(E.data.subarray(2),v),q}t.encodeJPEGMetadata=t=>{if("image/jpeg"!==t.sdr.mimeType)throw new Error("This function expects an SDR image compressed in jpeg");if("image/jpeg"!==t.gainMap.mimeType)throw new Error("This function expects a GainMap image compressed in jpeg");const e={version:"1.0",gainMapMin:t.gainMapMin,gainMapMax:t.gainMapMax,gamma:t.gamma,offsetSdr:t.offsetSdr,offsetHdr:t.offsetHdr,hdrCapacityMin:t.hdrCapacityMin,hdrCapacityMax:t.hdrCapacityMax,minContentBoost:Array.isArray(t.gainMapMin)?Math.pow(2,t.gainMapMin.reduce((t,e)=>t+e,0)/t.gainMapMin.length):Math.pow(2,t.gainMapMin),maxContentBoost:Array.isArray(t.gainMapMax)?Math.pow(2,t.gainMapMax.reduce((t,e)=>t+e,0)/t.gainMapMax.length):Math.pow(2,t.gainMapMax)};return E({sdr:t.sdr,gainMap:t.gainMap,metadata:e})}});
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
6
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-pGJUN9hi.js';
6
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-oyWUzYEt.js';
7
7
 
8
8
  var lib$1;
9
9
  var hasRequiredLib$1;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
- import{c as e,g as t}from"./_commonjsHelpers-DrNnMDE-.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-DIhdSoQr.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.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
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.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
6
- import { g as getDefaultExportFromCjs } from './_commonjsHelpers-pGJUN9hi.js';
7
- import { c as compress } from './compress-DA31yhmz.js';
6
+ import { g as getDefaultExportFromCjs } from './_commonjsHelpers-oyWUzYEt.js';
7
+ import { c as compress } from './compress-CSavQQ88.js';
8
8
 
9
9
  var isPromise = {exports: {}};
10
10
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
- import{g as e}from"./_commonjsHelpers-DrNnMDE-.js";import{c as r}from"./compress-goZ8TdVo.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-DIhdSoQr.js";import{c as r}from"./compress-ChfVEpLY.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.7.1
2
+ * @monogrid/gainmap-js v3.7.3
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.7.1
2
+ * @monogrid/gainmap-js v3.7.3
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.7.1",
3
+ "version": "3.7.3",
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",
@@ -136,7 +136,7 @@
136
136
  "@semantic-release/npm": "^13.2.0",
137
137
  "@semantic-release/release-notes-generator": "^14.1.1",
138
138
  "@types/node": "^26.6.5",
139
- "@types/three": "^0.186.0",
139
+ "@types/three": "^0.187.0",
140
140
  "concurrently": "^10.0.6",
141
141
  "conventional-changelog-conventionalcommits": "^10.4.1",
142
142
  "cz-conventional-changelog": "^3.3.0",
@@ -156,7 +156,7 @@
156
156
  "semantic-release": "^25.0.9",
157
157
  "servez": "^2.4.1",
158
158
  "sharp": "^0.35.5",
159
- "three": "^0.186.1",
159
+ "three": "^0.187.0",
160
160
  "typedoc": "^0.28.20",
161
161
  "typedoc-github-wiki-theme": "^2.1.1",
162
162
  "typedoc-plugin-markdown": "^4.14.0",