Comparing version 0.16.1 to 0.17.0
/*! | ||
* icojs v0.16.1 | ||
* icojs v0.17.0 | ||
* (c) egy186 | ||
* https://github.com/egy186/icojs/blob/master/LICENSE | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self,function(){var r=t.ICO,n=t.ICO=e();n.noConflict=function(){return t.ICO=r,n}}())}(this,(function(){"use strict";var t="image/png",e=t,r=function(t){for(var e=atob(t.replace(/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+,/,"")),r=new Uint8Array(e.length),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r.buffer},n={decode:function(t){return new Promise((function(e){var r=URL.createObjectURL(new Blob([t])),n=document.createElement("img");n.src=r,n.onload=function(){var t=n.naturalHeight,r=n.naturalWidth,i=document.createElement("canvas");i.width=r,i.height=t;var o=i.getContext("2d");o.drawImage(n,0,0);var a=o.getImageData(0,0,r,t).data;e({data:a,height:t,width:r})}}))},encode:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new Promise((function(e){var i=t.data,o=t.height,a=t.width,f=document.createElement("canvas");f.width=a,f.height=o;for(var u=f.getContext("2d"),h=u.createImageData(a,o),c=h.data,s=0;s<c.length;s++)c[s]=i[s];u.putImageData(h,0,0),e(r(f.toDataURL(n)))}))}},i=function(t){if(t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray)return new DataView(t.buffer,t.byteOffset,t.byteLength);if(t instanceof ArrayBuffer)return new DataView(t);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")},o=function(t){var e=i(t);return 0===e.getUint16(0,!0)&&1===e.getUint16(2,!0)};function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){h(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var g=new WeakMap,d=new WeakMap,l=function t(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];if(f(this,t),arguments.length<2)throw new TypeError("Failed to construct 'ImageData': 2 arguments required, but only ".concat(arguments.length," present."));if("object"===a(e)){if(!(e instanceof Uint8ClampedArray))throw new TypeError("Failed to construct 'ImageData': parameter 1 is not of type 'Uint8ClampedArray'.");if("number"!=typeof r||0===r)throw new Error("Failed to construct 'ImageData': The source width is zero or not a number.");if(4*(r>>>=0)>e.length)throw new Error("Failed to construct 'ImageData': The requested image size exceeds the supported range.");if(e.length%4!=0)throw new Error("Failed to construct 'ImageData': The input data length is not a multiple of 4.");if(e.length%(4*r)!=0)throw new Error("Failed to construct 'ImageData': The input data length is not a multiple of (4 * width).");if(void 0!==i[0]){if("number"!=typeof i[0]||0===i[0])throw new Error("Failed to construct 'ImageData': The source height is zero or not a number.");if(i[0]=i[0]>>>0,e.length%(4*r*i[0])!=0)throw new Error("Failed to construct 'ImageData': The input data length is not equal to (4 * width * height).")}g.set(this,r),d.set(this,void 0!==i[0]?i[0]:e.byteLength/r/4),Object.defineProperty(this,"data",{configurable:!0,enumerable:!0,value:e,writable:!1})}else{if("number"!=typeof e||0===e)throw new Error("Failed to construct 'ImageData': The source width is zero or not a number.");if(e>>>=0,"number"!=typeof r||0===r)throw new Error("Failed to construct 'ImageData': The source height is zero or not a number.");if(e*(r>>>=0)>=1<<30)throw new Error("Failed to construct 'ImageData': The requested image size exceeds the supported range.");g.set(this,e),d.set(this,r),Object.defineProperty(this,"data",{configurable:!0,enumerable:!0,value:new Uint8ClampedArray(e*r*4),writable:!1})}};Object.defineProperty(l.prototype,"width",{enumerable:!0,configurable:!0,get:function(){return g.get(this)}}),Object.defineProperty(l.prototype,"height",{enumerable:!0,configurable:!0,get:function(){return d.get(this)}});var p=l;var w=function(){function t(e,r,n){var i,o,a=n.width,u=n.height,h=n.colorDepth,c=n.format;if(f(this,t),this.format=c,this.offset=r,this.depth=h,this.stride=(i=a*this.depth/8,(o=i%4)?i+4-o:i),this.size=this.stride*u,this.data=e.slice(this.offset,this.offset+this.size),this.size!==this.data.byteLength)throw new Error("Truncated bitmap data")}var e,r,n;return e=t,(r=[{key:"get",value:function(t,e,r){var n=this.format.indexOf(r);return 1===this.depth?(this.data[e*this.stride+(t/8|0)]&1<<7-t%8*1)>>7-t%8*1:2===this.depth?(this.data[e*this.stride+(t/4|0)]&3<<6-t%4*2)>>>6-t%4*2:4===this.depth?(this.data[e*this.stride+(t/2|0)]&15<<4-t%2*4)>>>4-t%2*4:this.data[e*this.stride+t*(this.depth/8)+n]}}])&&u(e.prototype,r),n&&u(e,n),t}();function y(t,e){var r=e.width,n=e.height,i=e.colorDepth,o=e.icon;if(32!==i&&24!==i)throw new Error("A color depth of ".concat(i," is not supported"));for(var a=new w(t,0,{width:r,height:n,colorDepth:i,format:"BGRA"}),f=24===i&&o?new w(t,a.offset+a.size,{width:r,height:n,colorDepth:1,format:"A"}):null,u=new Uint8Array(r*n*4),h=0,c=0;c<n;c++)for(var s=0;s<r;s++)u[h++]=a.get(s,n-c-1,"R"),u[h++]=a.get(s,n-c-1,"G"),u[h++]=a.get(s,n-c-1,"B"),u[h++]=32===i?a.get(s,n-c-1,"A"):f&&f.get(s,n-c-1,"A")?0:255;return new Uint8ClampedArray(u.buffer,u.byteOffset,u.byteLength)}function b(t,e){var r=e.width,n=e.height,i=e.colorDepth,o=e.colorCount,a=e.icon;if(8!==i&&4!==i&&2!==i&&1!==i)throw new Error("A color depth of ".concat(i," is not supported"));for(var f=new w(t,0,{width:o,height:1,colorDepth:32,format:"BGRA"}),u=new w(t,f.offset+f.size,{width:r,height:n,colorDepth:i,format:"C"}),h=a?new w(t,u.offset+u.size,{width:r,height:n,colorDepth:1,format:"A"}):null,c=new Uint8Array(r*n*4),s=0,g=0;g<n;g++)for(var d=0;d<r;d++){var l=u.get(d,n-g-1,"C");c[s++]=f.get(l,0,"R"),c[s++]=f.get(l,0,"G"),c[s++]=f.get(l,0,"B"),c[s++]=h&&h.get(d,n-g-1,"A")?0:255}return new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength)}function m(t){if(19778!==t)throw new Error("Invalid magic byte 0x".concat(t.toString(16)))}function v(t,e){var r=t.getUint8(e+24),n=t.getUint8(e+25);if(0===n)return 1*r;if(2===n)return 3*r;if(3===n)return 1*r;if(4===n)return 2*r;if(6===n)return 4*r;throw new Error("Invalid PNG colorType")}function D(t,e){return t.getUint32(e+16,!1)}function U(t,e){return t.getUint32(e+20,!1)}var O=function(t){var e=i(t);if(e.byteLength<6)throw new Error("Truncated header");if(0!==e.getUint16(0,!0))throw new Error("Invalid magic bytes");var r=e.getUint16(2,!0);if(1!==r&&2!==r)throw new Error("Invalid image type");var n=e.getUint16(4,!0);if(e.byteLength<6+16*n)throw new Error("Truncated image list");return Array.from({length:n},(function(t,n){var o=e.getUint8(6+16*n+0),a=e.getUint8(6+16*n+1),f=e.getUint32(6+16*n+8,!0),u=e.getUint32(6+16*n+12,!0),h=2!==r?null:{x:e.getUint16(6+16*n+4,!0),y:e.getUint16(6+16*n+6,!0)};if(function(t,e){return 2303741511===t.getUint32(e+0)&&218765834===t.getUint32(e+4)}(e,u))return{bpp:v(e,u),data:new Uint8Array(e.buffer,e.byteOffset+u,f),height:U(e,u),hotspot:h,type:"png",width:D(e,u)};var c=function(t){var e,r,n,o,a,f=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=f.width,h=void 0===u?0:u,c=f.height,s=void 0===c?0:c,g=f.icon,d=void 0!==g&&g,l=i(t);d?(e=l.getUint32(0,!0),r=l.getUint32(4,!0)/1|0,n=l.getUint32(8,!0)/2|0,o=l.getUint16(14,!0),a=l.getUint32(32,!0)):(m(l.getUint16(0,!0)),e=14+l.getUint32(14,!0),r=l.getUint32(18,!0),n=l.getUint32(22,!0),o=l.getUint16(28,!0),a=l.getUint32(46,!0)),0===a&&o<=8&&(a=1<<o);var w=0===r?h:r,v=0===n?s:n,D=new Uint8Array(l.buffer,l.byteOffset+e,l.byteLength-e),U=a?b(D,{width:w,height:v,colorDepth:o,colorCount:a,icon:d}):y(D,{width:w,height:v,colorDepth:o,icon:d});return Object.assign(new p(U,w,v),{colorDepth:o})}(new Uint8Array(e.buffer,e.byteOffset+u,f),{width:o,height:a,icon:!0}),s={bpp:c.colorDepth,hotspot:h,type:"bmp"};return Object.assign(new p(c.data,c.width,c.height),s)}))};function A(t,e,r){return r?e?e(t):t:(t&&t.then||(t=Promise.resolve(t)),e?t.then(e):t)}function F(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{return Promise.resolve(t.apply(this,e))}catch(t){return Promise.reject(t)}}}var E=t,j=F((function(t,e,r){var n=O(t),i=F((function(t){return e===E&&"png"===t.type?s(s({},t),{},{buffer:t.data.buffer.slice(t.data.byteOffset,t.data.byteOffset+t.data.byteLength)}):(n=function(){return A(r.encode(t,e),(function(r){return Object.assign(t,{buffer:r,type:e.replace("image/","")})}))},(i=function(){if("png"===t.type)return A(r.decode(t.data),(function(e){Object.assign(t,{data:e.data,type:"bmp"})}))}())&&i.then?i.then(n):n(i));var n,i}));return Promise.all(n.map(i))})),I=t;return{isICO:o,parse:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:I;return j(t,e,n)}}})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self,function(){var r=t.ICO,n=t.ICO=e();n.noConflict=function(){return t.ICO=r,n}}())}(this,(function(){"use strict";var t="image/png",e=t,r=function(t){for(var e=atob(t.replace(/(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+,/,"")),r=new Uint8Array(e.length),n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r.buffer},n={decode:function(t){return new Promise((function(e){var r=URL.createObjectURL(new Blob([t])),n=document.createElement("img");n.src=r,n.onload=function(){var t=n.naturalHeight,r=n.naturalWidth,i=document.createElement("canvas");i.width=r,i.height=t;var o=i.getContext("2d");o.drawImage(n,0,0);var a=o.getImageData(0,0,r,t).data;e({data:a,height:t,width:r})}}))},encode:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new Promise((function(e){var i=t.data,o=t.height,a=t.width,f=document.createElement("canvas");f.width=a,f.height=o;for(var u=f.getContext("2d"),h=u.createImageData(a,o),c=h.data,s=0;s<c.length;s++)c[s]=i[s];u.putImageData(h,0,0),e(r(f.toDataURL(n)))}))}},i=n,o=function(t){if(t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray)return new DataView(t.buffer,t.byteOffset,t.byteLength);if(t instanceof ArrayBuffer)return new DataView(t);throw new TypeError("Expected `data` to be an ArrayBuffer, Buffer, Int8Array, Uint8Array or Uint8ClampedArray")},a=o,f=function(t){var e=a(t);return 0===e.getUint16(0,!0)&&1===e.getUint16(2,!0)};function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function h(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){l(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function d(t,e,r){return e&&g(t.prototype,e),r&&g(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var p=new WeakMap,w=new WeakMap,y=d((function t(e,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];if(s(this,t),arguments.length<2)throw new TypeError("Failed to construct 'ImageData': 2 arguments required, but only ".concat(arguments.length," present."));if("object"===c(e)){if(!(e instanceof Uint8ClampedArray))throw new TypeError("Failed to construct 'ImageData': parameter 1 is not of type 'Uint8ClampedArray'.");if("number"!=typeof r||0===r)throw new Error("Failed to construct 'ImageData': The source width is zero or not a number.");if(4*(r>>>=0)>e.length)throw new Error("Failed to construct 'ImageData': The requested image size exceeds the supported range.");if(e.length%4!=0)throw new Error("Failed to construct 'ImageData': The input data length is not a multiple of 4.");if(e.length%(4*r)!=0)throw new Error("Failed to construct 'ImageData': The input data length is not a multiple of (4 * width).");if(void 0!==i[0]){if("number"!=typeof i[0]||0===i[0])throw new Error("Failed to construct 'ImageData': The source height is zero or not a number.");if(i[0]=i[0]>>>0,e.length%(4*r*i[0])!=0)throw new Error("Failed to construct 'ImageData': The input data length is not equal to (4 * width * height).")}p.set(this,r),w.set(this,void 0!==i[0]?i[0]:e.byteLength/r/4),Object.defineProperty(this,"data",{configurable:!0,enumerable:!0,value:e,writable:!1})}else{if("number"!=typeof e||0===e)throw new Error("Failed to construct 'ImageData': The source width is zero or not a number.");if(e>>>=0,"number"!=typeof r||0===r)throw new Error("Failed to construct 'ImageData': The source height is zero or not a number.");if(e*(r>>>=0)>=1<<30)throw new Error("Failed to construct 'ImageData': The requested image size exceeds the supported range.");p.set(this,e),w.set(this,r),Object.defineProperty(this,"data",{configurable:!0,enumerable:!0,value:new Uint8ClampedArray(e*r*4),writable:!1})}}));Object.defineProperty(y.prototype,"width",{enumerable:!0,configurable:!0,get:function(){return p.get(this)}}),Object.defineProperty(y.prototype,"height",{enumerable:!0,configurable:!0,get:function(){return w.get(this)}});var b=y,m=o,v=b;var D=function(){function t(e,r,n){var i,o,a=n.width,f=n.height,u=n.colorDepth,h=n.format;if(s(this,t),this.format=h,this.offset=r,this.depth=u,this.stride=(i=a*this.depth/8,(o=i%4)?i+4-o:i),this.size=this.stride*f,this.data=e.slice(this.offset,this.offset+this.size),this.size!==this.data.byteLength)throw new Error("Truncated bitmap data")}return d(t,[{key:"get",value:function(t,e,r){var n=this.format.indexOf(r);return 1===this.depth?(this.data[e*this.stride+(t/8|0)]&1<<7-t%8*1)>>7-t%8*1:2===this.depth?(this.data[e*this.stride+(t/4|0)]&3<<6-t%4*2)>>>6-t%4*2:4===this.depth?(this.data[e*this.stride+(t/2|0)]&15<<4-t%2*4)>>>4-t%2*4:this.data[e*this.stride+t*(this.depth/8)+n]}}]),t}();function U(t,e){var r=e.width,n=e.height,i=e.colorDepth,o=e.icon;if(32!==i&&24!==i)throw new Error("A color depth of ".concat(i," is not supported"));for(var a=new D(t,0,{width:r,height:n,colorDepth:i,format:"BGRA"}),f=24===i&&o?new D(t,a.offset+a.size,{width:r,height:n,colorDepth:1,format:"A"}):null,u=new Uint8Array(r*n*4),h=0,c=0;c<n;c++)for(var s=0;s<r;s++)u[h++]=a.get(s,n-c-1,"R"),u[h++]=a.get(s,n-c-1,"G"),u[h++]=a.get(s,n-c-1,"B"),u[h++]=32===i?a.get(s,n-c-1,"A"):f&&f.get(s,n-c-1,"A")?0:255;return new Uint8ClampedArray(u.buffer,u.byteOffset,u.byteLength)}function O(t,e){var r=e.width,n=e.height,i=e.colorDepth,o=e.colorCount,a=e.icon;if(8!==i&&4!==i&&2!==i&&1!==i)throw new Error("A color depth of ".concat(i," is not supported"));for(var f=new D(t,0,{width:o,height:1,colorDepth:32,format:"BGRA"}),u=new D(t,f.offset+f.size,{width:r,height:n,colorDepth:i,format:"C"}),h=a?new D(t,u.offset+u.size,{width:r,height:n,colorDepth:1,format:"A"}):null,c=new Uint8Array(r*n*4),s=0,g=0;g<n;g++)for(var d=0;d<r;d++){var l=u.get(d,n-g-1,"C");c[s++]=f.get(l,0,"R"),c[s++]=f.get(l,0,"G"),c[s++]=f.get(l,0,"B"),c[s++]=h&&h.get(d,n-g-1,"A")?0:255}return new Uint8ClampedArray(c.buffer,c.byteOffset,c.byteLength)}function A(t){if(19778!==t)throw new Error("Invalid magic byte 0x".concat(t.toString(16)))}var F=o,E=function(t){var e,r,n,i,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f=a.width,u=void 0===f?0:f,h=a.height,c=void 0===h?0:h,s=a.icon,g=void 0!==s&&s,d=m(t);g?(e=d.getUint32(0,!0),r=d.getUint32(4,!0)/1|0,n=d.getUint32(8,!0)/2|0,i=d.getUint16(14,!0),o=d.getUint32(32,!0)):(A(d.getUint16(0,!0)),e=14+d.getUint32(14,!0),r=d.getUint32(18,!0),n=d.getUint32(22,!0),i=d.getUint16(28,!0),o=d.getUint32(46,!0)),0===o&&i<=8&&(o=1<<i);var l=0===r?u:r,p=0===n?c:n,w=new Uint8Array(d.buffer,d.byteOffset+e,d.byteLength-e),y=o?O(w,{width:l,height:p,colorDepth:i,colorCount:o,icon:g}):U(w,{width:l,height:p,colorDepth:i,icon:g});return Object.assign(new v(y,l,p),{colorDepth:i})},j=b;function I(t,e){var r=t.getUint8(e+24),n=t.getUint8(e+25);if(0===n)return 1*r;if(2===n)return 3*r;if(3===n)return 1*r;if(4===n)return 2*r;if(6===n)return 4*r;throw new Error("Invalid PNG colorType")}function C(t,e){return t.getUint32(e+16,!1)}function P(t,e){return t.getUint32(e+20,!1)}function T(t,e,r){return r?e?e(t):t:(t&&t.then||(t=Promise.resolve(t)),e?t.then(e):t)}function x(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];try{return Promise.resolve(t.apply(this,e))}catch(t){return Promise.reject(t)}}}var z=function(t){var e=F(t);if(e.byteLength<6)throw new Error("Truncated header");if(0!==e.getUint16(0,!0))throw new Error("Invalid magic bytes");var r=e.getUint16(2,!0);if(1!==r&&2!==r)throw new Error("Invalid image type");var n=e.getUint16(4,!0);if(e.byteLength<6+16*n)throw new Error("Truncated image list");return Array.from({length:n},(function(t,n){var i=e.getUint8(6+16*n+0),o=e.getUint8(6+16*n+1),a=e.getUint32(6+16*n+8,!0),f=e.getUint32(6+16*n+12,!0),u=2!==r?null:{x:e.getUint16(6+16*n+4,!0),y:e.getUint16(6+16*n+6,!0)};if(function(t,e){return 2303741511===t.getUint32(e+0)&&218765834===t.getUint32(e+4)}(e,f))return{bpp:I(e,f),data:new Uint8Array(e.buffer,e.byteOffset+f,a),height:P(e,f),hotspot:u,type:"png",width:C(e,f)};var h=new Uint8Array(e.buffer,e.byteOffset+f,a),c=E(h,{width:i,height:o,icon:!0}),s={bpp:c.colorDepth,hotspot:u,type:"bmp"};return Object.assign(new j(c.data,c.width,c.height),s)}))},B=t,L=x((function(t,e,r){var n=z(t),i=x((function(t){return e===B&&"png"===t.type?h(h({},t),{},{buffer:t.data.buffer.slice(t.data.byteOffset,t.data.byteOffset+t.data.byteLength)}):(n=function(){return T(r.encode(t,e),(function(r){return Object.assign(t,{buffer:r,type:e.replace("image/","")})}))},(i=function(){if("png"===t.type)return T(r.decode(t.data),(function(e){Object.assign(t,{data:e.data,type:"bmp"})}))}())&&i.then?i.then(n):n(i));var n,i}));return Promise.all(n.map(i))})),S=i,R=L,k=t,G={isICO:f,parse:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:k;return R(t,e,S)}};return G})); | ||
//# sourceMappingURL=ico.js.map |
{ | ||
"name": "icojs", | ||
"description": "parse ico file", | ||
"version": "0.16.1", | ||
"version": "0.17.0", | ||
"author": "egy186", | ||
@@ -15,34 +15,35 @@ "browser": "browser.js", | ||
"jpeg-js": "^0.4.3", | ||
"pngjs": "^5.0.0", | ||
"pngjs": "^6.0.0", | ||
"to-data-view": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.13.8", | ||
"@babel/preset-env": "^7.13.9", | ||
"@egy186/eslint-config": "~0.43.0", | ||
"@rollup/plugin-commonjs": "^17.1.0", | ||
"@rollup/plugin-node-resolve": "^11.2.0", | ||
"babel-plugin-transform-async-to-promises": "^0.8.15", | ||
"chai": "^4.3.1", | ||
"@babel/core": "^7.17.9", | ||
"@babel/preset-env": "^7.16.11", | ||
"@egy186/eslint-config": "^0.72.0", | ||
"@playwright/test": "^1.21.0", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^21.1.0", | ||
"@rollup/plugin-node-resolve": "^13.2.1", | ||
"babel-plugin-transform-async-to-promises": "^0.8.18", | ||
"chai": "^4.3.4", | ||
"chai-as-promised": "^7.0.0", | ||
"concat": "^1.0.3", | ||
"data-uri-to-buffer": "^3.0.0", | ||
"eslint": "~6.8.0", | ||
"inline-source": "^7.1.0", | ||
"jsdoc-to-markdown": "^6.0.1", | ||
"ejs": "^3.1.7", | ||
"eslint": "^8.13.0", | ||
"eslint-plugin-jsdoc": "^39.2.2", | ||
"eslint-plugin-node": "~11.1.0", | ||
"file-url": "^3.0.0", | ||
"jsdoc-to-markdown": "^7.1.1", | ||
"jsonfile": "^6.1.0", | ||
"jstransformer-markdown-it": "^2.1.0", | ||
"mocha": "^8.3.0", | ||
"npm-run-all": "^4.1.5", | ||
"marked": "^4.0.12", | ||
"mocha": "^9.2.2", | ||
"nyc": "^15.0.0", | ||
"pixelmatch": "^5.1.0", | ||
"pug-cli": "^1.0.0-alpha6", | ||
"puppeteer": "^8.0.0", | ||
"pixelmatch": "^5.2.1", | ||
"playwright": "^1.21.0", | ||
"rimraf": "^3.0.0", | ||
"rollup": "^2.40.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup": "^2.70.2", | ||
"rollup-plugin-terser": "^7.0.2" | ||
}, | ||
"engines": { | ||
"node": ">=10.18.0" | ||
"node": ">=14.19.1" | ||
}, | ||
@@ -69,13 +70,14 @@ "files": [ | ||
"scripts": { | ||
"build": "npm-run-all jsdoc --parallel build:*", | ||
"build:dist": "rollup --config rollup.config.js", | ||
"build:docs": "pug templates/index.pug --obj package.json --out docs", | ||
"build:readme": "cd templates && concat --output ../README.md head.md install.md example.md demo.md api.md foot.md", | ||
"build": "rollup --config rollup.config.js", | ||
"clean": "rimraf coverage dist docs/index.html templates/api.md README.md", | ||
"docs": "node scripts/docs.js", | ||
"jsdoc": "jsdoc2md --files \"src/**/*.js\" --heading-depth 3 --template templates/api.hbs > templates/api.md", | ||
"lint": "eslint .", | ||
"pretest": "npm run build:dist", | ||
"test": "nyc --reporter lcov --reporter text-summary --report-dir coverage mocha \"test/**/*.spec.js\"", | ||
"version": "npm run build && git add docs/index.html README.md" | ||
"predocs": "npm run jsdoc", | ||
"pretest": "npm run build", | ||
"test": "npm run test:node && npm run test:browser", | ||
"test:browser": "playwright test", | ||
"test:node": "nyc --reporter lcov --reporter text-summary --report-dir coverage mocha \"test/node/*.spec.js\"", | ||
"version": "npm run docs && git add docs/index.html README.md" | ||
} | ||
} |
@@ -18,5 +18,5 @@ 'use strict'; | ||
* | ||
* @access private | ||
* @param {ArrayBuffer} arrayBuffer - Image buffer. | ||
* @returns {ImageData} ImageData. | ||
* @access private | ||
*/ | ||
@@ -47,3 +47,2 @@ decode (arrayBuffer) { | ||
* | ||
* @access private | ||
* @param {object} image - Data. | ||
@@ -55,2 +54,3 @@ * @param {number} image.width - Image width. | ||
* @returns {ArrayBuffer} Image. | ||
* @access private | ||
*/ | ||
@@ -57,0 +57,0 @@ encode (image, mime = MIME_PNG) { |
@@ -8,5 +8,5 @@ 'use strict'; | ||
* | ||
* @access private | ||
* @param {ArrayBuffer|Buffer} source - ArrayBuffer or Buffer object. | ||
* @returns {boolean} Arg is CUR or not. | ||
* @access private | ||
*/ | ||
@@ -13,0 +13,0 @@ const isCUR = source => { |
@@ -8,5 +8,5 @@ 'use strict'; | ||
* | ||
* @access private | ||
* @param {ArrayBuffer|Buffer} source - ArrayBuffer or Buffer object. | ||
* @returns {boolean} Arg is PNG or not. | ||
* @access private | ||
*/ | ||
@@ -13,0 +13,0 @@ const isPNG = source => { |
@@ -25,5 +25,6 @@ 'use strict'; | ||
* | ||
* @access private | ||
* @param {ArrayBuffer} arrayBuffer - Image buffer. | ||
* @returns {Promise<ImageData>} Resolves to ImageData. | ||
* @throws {Error} | ||
* @access private | ||
*/ | ||
@@ -47,3 +48,2 @@ async decode (arrayBuffer) { | ||
* | ||
* @access private | ||
* @param {object} image - Data. | ||
@@ -55,2 +55,3 @@ * @param {number} image.width - Image width. | ||
* @returns {Promise<ArrayBuffer>} Resolves to image. | ||
* @access private | ||
*/ | ||
@@ -57,0 +58,0 @@ // eslint-disable-next-line require-await |
@@ -17,3 +17,2 @@ 'use strict'; | ||
* | ||
* @access private | ||
* @param {ArrayBuffer|Buffer} data - ICO file data. | ||
@@ -23,2 +22,3 @@ * @param {string} mime - MIME type for output. | ||
* @returns {Promise<ParsedImage[]>} Resolves to an array of {@link ParsedImage}. | ||
* @access private | ||
*/ | ||
@@ -25,0 +25,0 @@ const parse = async (data, mime, Image) => { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52538
329
26
+ Addedpngjs@6.0.0(transitive)
- Removedpngjs@5.0.0(transitive)
Updatedpngjs@^6.0.0