Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/images

Package Overview
Dependencies
Maintainers
10
Versions
329
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/images - npm Package Compare versions

Comparing version 2.0.0-beta.2 to 2.0.0-beta.3

2

dist/dist.min.js

@@ -1,1 +0,1 @@

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return o}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document},a=i.global||i.self||i.window,o="object"!=typeof r||"[object process]"!==String(r)||r.browser,u=void 0!==r&&r.version&&r.version.match(/v([0-9]*)/);u&&parseFloat(u[1])}).call(this,n(1),n(3))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){const r=n(4),i="undefined"==typeof window?t:window;i.loaders=i.loaders||{},e.exports=Object.assign(i.loaders,r)}).call(this,n(1))},function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,s=[],f=!1,g=-1;function d(){f&&c&&(f=!1,c.length?s=c.concat(s):g=-1,s.length&&m())}function m(){if(!f){var e=u(d);f=!0;for(var t=s.length;t;){for(c=s,s=[];++g<t;)c&&c[g].run();g=-1,t=s.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function l(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new l(e,t)),1!==s.length||f||u(m)},l.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";function r(e,t){if(!e)throw new Error(t)}n.r(t);var i=n(0);const a="undefined"!=typeof ImageBitmap,o=void 0!==typeof Image,u=Boolean(i.a._parseImageNode);function c(e){switch(e){case"imagebitmap":return a;case"html":return o;case"ndarray":return u;default:throw new Error(`Unknown image format ${e}`)}}function s(){if(c("ndarray"))return"ndarray";if(c("html"))return"html";if(c("imagebitmap"))return"imagebitmap";if(!i.b)throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js");return r(!1)}const f=!1,g=!0,d=new Map([["image/png",{test:m,getSize:function(e){return{width:e.getUint32(16,f),height:e.getUint32(20,f)}}}],["image/jpeg",{test:w,getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,f))return null;const{tableMarkers:t,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r<e.byteLength;){const i=e.getUint16(r,f);if(n.has(i))return{height:e.getUint16(r+5,f),width:e.getUint16(r+7,f)};if(!t.has(i))return null;r+=2,r+=e.getUint16(r,f)}return null}}],["image/gif",{test:l,getSize:function(e){return{width:e.getUint16(6,g),height:e.getUint16(8,g)}}}],["image/bmp",{test:p,getSize:function(e){return{width:e.getUint32(18,g),height:e.getUint32(22,g)}}}]]);function m(e){return e.byteLength>=24&&2303741511===e.getUint32(0,f)}function l(e){return e.byteLength>=10&&1195984440===e.getUint32(0,f)}function p(e){return e.byteLength>=2&&16973===e.getUint16(0,f)}function w(e){return e.byteLength>=3&&65496===e.getUint16(0,f)&&255===e.getUint8(2,f)}const h=`Invalid MIME type. Supported MIME types are: ${Array.from(d.keys()).join(", ")}`;function y(e,t){if(t){const{test:n}=I(t);return n(x(e))}return Boolean(b(e))}function b(e){const t=x(e);for(const[e,{test:n}]of d.entries())if(n(t))return e;return null}function v(e,t=null){t=t||b(e);const{getSize:n}=I(t),r=n(x(e));if(!r)throw new Error(`invalid image data for type: ${t}`);return r}function I(e){const t=d.get(e);if(!t)throw new Error(h);return t}function x(e){if((e=e.buffer||e)instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}async function T(e,t){const n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((t,r)=>{try{n.onload=()=>t(n),n.onerror=t=>r(new Error(`Could not load image ${e}: ${t}`))}catch(e){r(e)}})}async function j(e,t){const n=(new TextDecoder).decode(e),r=`data:image/svg+xml;base64,${btoa(n)}`;return await T(r,t)}async function L(e,t,n){"image"in t&&(t={...t,image:{}});const{url:a}=n||{};if(a&&/\.svg((\?|#).*)?$/.test(a))return console.warn("@loaders.gl/images: SVG parsing needs to be fixed for 2.0"),await j(e,t);switch(function(e={}){const t=(e.image||{}).type||"auto";switch(t){case"imagebitmap":case"html":case"ndarray":if(!c(t))throw new Error(`Requested image type ${t} not available in current environment`);return t;case"auto":return s();default:throw new Error(`Unknown image format ${t}`)}}(t)){case"imagebitmap":return await function(e,t){const n=new Blob([new Uint8Array(e)]),r=t&&t.imagebitmap;return r?createImageBitmap(n):createImageBitmap(n,r)}(e,t);case"html":return await async function(e,t){const n=new Blob([e],{type:"image/jpeg"}),r=self.URL||self.webkitURL,i=r.createObjectURL(n);try{return await T(i,t)}finally{r.revokeObjectURL(i)}}(e,t);case"ndarray":return await function(e,t){r(i.a._parseImageNode);const n=b(e);return i.a._parseImageNode(e,n,t)}(e,t);default:return r(!1)}}var U={name:"Images",version:"2.0.0-beta.2",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vndmicrosofticon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:L,test:e=>{const t=new DataView(e);return w(t)||p(t)||l(t)||m(t)},options:{images:{format:"auto",decodeHTML:!0}}};var E={name:"Images",extensions:["jpeg"],encode:function(e,t){if(i.a._encodeImageNode)return i.a._encodeImageNode(e,t);if(e instanceof HTMLCanvasElement){return e.toDataURL(t)}r(e instanceof Image,"getImageData accepts image or canvas");const n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0);const a=n.toDataURL(t||"png").replace(/^data:image\/(png|jpg);base64,/,"");return Promise.resolve(a)},DEFAULT_OPTIONS:{type:"png"}};function M(e){return Boolean(_(e))}function S(e){const t=_(e);if(!t)throw new Error("Not an image");return t}function B(e){switch(S(e)){case"imagebitmap":case"ndarray":return{width:e.width,height:e.height};case"html":return{width:e.naturalWidth,height:e.naturalHeight};default:return r(!1)}}function P(e){switch(S(e)){case"imagebitmap":case"html":const t=document.createElement("canvas").getContext("2d");return t.drawImage(e,0,0),t.getImageData(0,0,e.width,e.height).data;case"ndarray":return e.data;default:return r(!1)}}function _(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"html":e&&"object"==typeof e&&e.data&&e.width&&e.height?"ndarray":Array.isArray(e)?"ndarray":null}function D(e,t,n){let i=e;"function"==typeof e&&(i=e({...t,...n})),r("string"==typeof i);const{baseUrl:a}=t;return a&&(i="/"===a[a.length-1]?`${a}${i}`:`${a}/${i}`),i}const O=e=>e&&"object"==typeof e;async function $(e,t,n){if(Array.isArray(e))return await async function(e,t,n={}){const r=e.map(e=>$(e,t,n));return await Promise.all(r)}(e,t,n);if(O(e))return await async function(e,t,n){const r=[],i={};for(const a in e){const o=$(e[a],t,n).then(e=>{i[a]=e});r.push(o)}return await Promise.all(r),i}(e,t,n);const r=e;return await t(r,n)}async function k(e,t,n){return await async function(e,t,n={}){return await $(e,t,n)}(e,e=>A(e,t,n))}async function A(e,t,n){const r=await fetch(e,n.fetch),i=await r.arrayBuffer();return await t(i,n)}async function V(e,t={}){const n=await N(e,t);return await k(n,L,t)}async function N(e,t,n={}){const i=t&&t.image&&t.image.mipLevels||0;return 0!==i?await async function(e,t,n,i){const a=[];if("auto"===t){const r=D(e,n,{...i,lod:0}),o=await A(r,L,n),{width:u,height:c}=B(o);t=function({width:e,height:t}){return 1+Math.floor(Math.log2(Math.max(e,t)))}({width:u,height:c}),a.push(r)}r(t>0);for(let r=a.length;r<t;++r){const t=D(e,n,{...i,lod:r});a.push(t)}return a}(e,i,t,n):D(e,t,n)}async function z(e,t,n={}){const r=await async function(e,t,n={}){const r=[];for(let i=0;i<e;i++){const e=N(t,n,{index:i});r.push(e)}return await Promise.all(r)}(e,t,n);return await k(r,L,n)}const G=[{face:34069,direction:"right",axis:"x",sign:"positive"},{face:34070,direction:"left",axis:"x",sign:"negative"},{face:34071,direction:"top",axis:"y",sign:"positive"},{face:34072,direction:"bottom",axis:"y",sign:"negative"},{face:34073,direction:"front",axis:"z",sign:"positive"},{face:34074,direction:"back",axis:"z",sign:"negative"}];async function R(e,t={}){const n=await async function(e,t){const n={},r=[];let i=0;for(const a in G){const o=N(e,t,{...G[i],index:i++}).then(e=>{n[a]=e});r.push(o)}return await Promise.all(r),n}(e,t);return await k(n,L,t)}const C={id:"jpeg",category:"image",name:"JPEG",version:"2.0.0-beta.2",extensions:["jpg","jpeg"],mimeType:"image/jpeg",test:e=>w(new DataView(e)),parse:L,options:{}},F={id:"png",category:"image",name:"PNG",version:"2.0.0-beta.2",extensions:["png"],mimeType:"image/png",test:e=>m(new DataView(e)),parse:L,options:{}},H={id:"gif",category:"image",name:"GIF",version:"2.0.0-beta.2",extensions:["gif"],mimeType:"image/gif",test:e=>l(new DataView(e)),parse:L,options:{}},J={id:"bmp",category:"image",name:"BMP",version:"2.0.0-beta.2",extensions:["gif"],mimeType:"image/gif",test:e=>p(new DataView(e)),parse:L,options:{}},W={id:"svg",name:"SVG",version:"2.0.0-beta.2",extensions:["svg"],mimeType:"image/svg+xml",parse:j},q=[C,F,H,J,W];n.d(t,"ImageLoader",(function(){return U})),n.d(t,"ImageWriter",(function(){return E})),n.d(t,"isImageTypeSupported",(function(){return c})),n.d(t,"getSupportedImageType",(function(){return s})),n.d(t,"isImage",(function(){return M})),n.d(t,"getImageType",(function(){return S})),n.d(t,"getImageSize",(function(){return B})),n.d(t,"getImageData",(function(){return P})),n.d(t,"isBinaryImage",(function(){return y})),n.d(t,"getBinaryImageMIMEType",(function(){return b})),n.d(t,"getBinaryImageSize",(function(){return v})),n.d(t,"loadImage",(function(){return V})),n.d(t,"loadImageArray",(function(){return z})),n.d(t,"loadImageCube",(function(){return R})),n.d(t,"_JPEGLoader",(function(){return C})),n.d(t,"_PNGLoader",(function(){return F})),n.d(t,"_GIFLoader",(function(){return H})),n.d(t,"_BMPLoader",(function(){return J})),n.d(t,"_SVGLoader",(function(){return W})),n.d(t,"_ImageLoaders",(function(){return q})),n.d(t,"HTMLImageLoader",(function(){return U}))}])}));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";(function(e,r){n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return o}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==e&&e,document:"undefined"!=typeof document&&document},a=i.global||i.self||i.window,o="object"!=typeof r||"[object process]"!==String(r)||r.browser,u=void 0!==r&&r.version&&r.version.match(/v([0-9]*)/);u&&parseFloat(u[1])}).call(this,n(1),n(3))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){const r=n(4),i="undefined"==typeof window?t:window;i.loaders=i.loaders||{},e.exports=Object.assign(i.loaders,r)}).call(this,n(1))},function(e,t){var n,r,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(e){n=a}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,s=[],f=!1,g=-1;function d(){f&&c&&(f=!1,c.length?s=c.concat(s):g=-1,s.length&&m())}function m(){if(!f){var e=u(d);f=!0;for(var t=s.length;t;){for(c=s,s=[];++g<t;)c&&c[g].run();g=-1,t=s.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function l(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new l(e,t)),1!==s.length||f||u(m)},l.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";function r(e,t){if(!e)throw new Error(t)}n.r(t);var i=n(0);const a="undefined"!=typeof ImageBitmap,o=void 0!==typeof Image,u=Boolean(i.a._parseImageNode);function c(e){switch(e){case"imagebitmap":return a;case"html":return o;case"ndarray":return u;default:throw new Error(`Unknown image format ${e}`)}}function s(){if(c("ndarray"))return"ndarray";if(c("html"))return"html";if(c("imagebitmap"))return"imagebitmap";if(!i.b)throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js");return r(!1)}const f=!1,g=!0,d=new Map([["image/png",{test:m,getSize:function(e){return{width:e.getUint32(16,f),height:e.getUint32(20,f)}}}],["image/jpeg",{test:w,getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,f))return null;const{tableMarkers:t,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r<e.byteLength;){const i=e.getUint16(r,f);if(n.has(i))return{height:e.getUint16(r+5,f),width:e.getUint16(r+7,f)};if(!t.has(i))return null;r+=2,r+=e.getUint16(r,f)}return null}}],["image/gif",{test:l,getSize:function(e){return{width:e.getUint16(6,g),height:e.getUint16(8,g)}}}],["image/bmp",{test:p,getSize:function(e){return{width:e.getUint32(18,g),height:e.getUint32(22,g)}}}]]);function m(e){return e.byteLength>=24&&2303741511===e.getUint32(0,f)}function l(e){return e.byteLength>=10&&1195984440===e.getUint32(0,f)}function p(e){return e.byteLength>=2&&16973===e.getUint16(0,f)}function w(e){return e.byteLength>=3&&65496===e.getUint16(0,f)&&255===e.getUint8(2,f)}const h=`Invalid MIME type. Supported MIME types are: ${Array.from(d.keys()).join(", ")}`;function y(e,t){if(t){const{test:n}=I(t);return n(x(e))}return Boolean(b(e))}function b(e){const t=x(e);for(const[e,{test:n}]of d.entries())if(n(t))return e;return null}function v(e,t=null){t=t||b(e);const{getSize:n}=I(t),r=n(x(e));if(!r)throw new Error(`invalid image data for type: ${t}`);return r}function I(e){const t=d.get(e);if(!t)throw new Error(h);return t}function x(e){if((e=e.buffer||e)instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}async function T(e,t){const n=new Image;return n.src=e,t.image&&t.image.decode&&n.decode?(await n.decode(),n):await new Promise((t,r)=>{try{n.onload=()=>t(n),n.onerror=t=>r(new Error(`Could not load image ${e}: ${t}`))}catch(e){r(e)}})}async function j(e,t){const n=(new TextDecoder).decode(e),r=`data:image/svg+xml;base64,${btoa(n)}`;return await T(r,t)}async function L(e,t,n){"image"in t&&(t={...t,image:{}});const{url:a}=n||{};if(a&&/\.svg((\?|#).*)?$/.test(a))return console.warn("@loaders.gl/images: SVG parsing needs to be fixed for 2.0"),await j(e,t);switch(function(e={}){const t=(e.image||{}).type||"auto";switch(t){case"imagebitmap":case"html":case"ndarray":if(!c(t))throw new Error(`Requested image type ${t} not available in current environment`);return t;case"auto":return s();default:throw new Error(`Unknown image format ${t}`)}}(t)){case"imagebitmap":return await function(e,t){const n=new Blob([new Uint8Array(e)]),r=t&&t.imagebitmap;return r?createImageBitmap(n):createImageBitmap(n,r)}(e,t);case"html":return await async function(e,t){const n=new Blob([e],{type:"image/jpeg"}),r=self.URL||self.webkitURL,i=r.createObjectURL(n);try{return await T(i,t)}finally{r.revokeObjectURL(i)}}(e,t);case"ndarray":return await function(e,t){r(i.a._parseImageNode);const n=b(e);return i.a._parseImageNode(e,n,t)}(e,t);default:return r(!1)}}var U={name:"Images",version:"2.0.0-beta.3",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vndmicrosofticon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:L,test:e=>{const t=new DataView(e);return w(t)||p(t)||l(t)||m(t)},options:{images:{format:"auto",decodeHTML:!0}}};var E={name:"Images",extensions:["jpeg"],encode:function(e,t){if(i.a._encodeImageNode)return i.a._encodeImageNode(e,t);if(e instanceof HTMLCanvasElement){return e.toDataURL(t)}r(e instanceof Image,"getImageData accepts image or canvas");const n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0);const a=n.toDataURL(t||"png").replace(/^data:image\/(png|jpg);base64,/,"");return Promise.resolve(a)},DEFAULT_OPTIONS:{type:"png"}};function M(e){return Boolean(_(e))}function S(e){const t=_(e);if(!t)throw new Error("Not an image");return t}function B(e){switch(S(e)){case"imagebitmap":case"ndarray":return{width:e.width,height:e.height};case"html":return{width:e.naturalWidth,height:e.naturalHeight};default:return r(!1)}}function P(e){switch(S(e)){case"imagebitmap":case"html":const t=document.createElement("canvas").getContext("2d");return t.drawImage(e,0,0),t.getImageData(0,0,e.width,e.height).data;case"ndarray":return e.data;default:return r(!1)}}function _(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&e instanceof Image?"html":e&&"object"==typeof e&&e.data&&e.width&&e.height?"ndarray":Array.isArray(e)?"ndarray":null}function D(e,t,n){let i=e;"function"==typeof e&&(i=e({...t,...n})),r("string"==typeof i);const{baseUrl:a}=t;return a&&(i="/"===a[a.length-1]?`${a}${i}`:`${a}/${i}`),i}const O=e=>e&&"object"==typeof e;async function $(e,t,n){if(Array.isArray(e))return await async function(e,t,n={}){const r=e.map(e=>$(e,t,n));return await Promise.all(r)}(e,t,n);if(O(e))return await async function(e,t,n){const r=[],i={};for(const a in e){const o=$(e[a],t,n).then(e=>{i[a]=e});r.push(o)}return await Promise.all(r),i}(e,t,n);const r=e;return await t(r,n)}async function k(e,t,n){return await async function(e,t,n={}){return await $(e,t,n)}(e,e=>A(e,t,n))}async function A(e,t,n){const r=await fetch(e,n.fetch),i=await r.arrayBuffer();return await t(i,n)}async function V(e,t={}){const n=await N(e,t);return await k(n,L,t)}async function N(e,t,n={}){const i=t&&t.image&&t.image.mipLevels||0;return 0!==i?await async function(e,t,n,i){const a=[];if("auto"===t){const r=D(e,n,{...i,lod:0}),o=await A(r,L,n),{width:u,height:c}=B(o);t=function({width:e,height:t}){return 1+Math.floor(Math.log2(Math.max(e,t)))}({width:u,height:c}),a.push(r)}r(t>0);for(let r=a.length;r<t;++r){const t=D(e,n,{...i,lod:r});a.push(t)}return a}(e,i,t,n):D(e,t,n)}async function z(e,t,n={}){const r=await async function(e,t,n={}){const r=[];for(let i=0;i<e;i++){const e=N(t,n,{index:i});r.push(e)}return await Promise.all(r)}(e,t,n);return await k(r,L,n)}const G=[{face:34069,direction:"right",axis:"x",sign:"positive"},{face:34070,direction:"left",axis:"x",sign:"negative"},{face:34071,direction:"top",axis:"y",sign:"positive"},{face:34072,direction:"bottom",axis:"y",sign:"negative"},{face:34073,direction:"front",axis:"z",sign:"positive"},{face:34074,direction:"back",axis:"z",sign:"negative"}];async function R(e,t={}){const n=await async function(e,t){const n={},r=[];let i=0;for(const a in G){const o=N(e,t,{...G[i],index:i++}).then(e=>{n[a]=e});r.push(o)}return await Promise.all(r),n}(e,t);return await k(n,L,t)}const C={id:"jpeg",category:"image",name:"JPEG",version:"2.0.0-beta.3",extensions:["jpg","jpeg"],mimeType:"image/jpeg",test:e=>w(new DataView(e)),parse:L,options:{}},F={id:"png",category:"image",name:"PNG",version:"2.0.0-beta.3",extensions:["png"],mimeType:"image/png",test:e=>m(new DataView(e)),parse:L,options:{}},H={id:"gif",category:"image",name:"GIF",version:"2.0.0-beta.3",extensions:["gif"],mimeType:"image/gif",test:e=>l(new DataView(e)),parse:L,options:{}},J={id:"bmp",category:"image",name:"BMP",version:"2.0.0-beta.3",extensions:["gif"],mimeType:"image/gif",test:e=>p(new DataView(e)),parse:L,options:{}},W={id:"svg",name:"SVG",version:"2.0.0-beta.3",extensions:["svg"],mimeType:"image/svg+xml",parse:j},q=[C,F,H,J,W];n.d(t,"ImageLoader",(function(){return U})),n.d(t,"ImageWriter",(function(){return E})),n.d(t,"isImageTypeSupported",(function(){return c})),n.d(t,"getSupportedImageType",(function(){return s})),n.d(t,"isImage",(function(){return M})),n.d(t,"getImageType",(function(){return S})),n.d(t,"getImageSize",(function(){return B})),n.d(t,"getImageData",(function(){return P})),n.d(t,"isBinaryImage",(function(){return y})),n.d(t,"getBinaryImageMIMEType",(function(){return b})),n.d(t,"getBinaryImageSize",(function(){return v})),n.d(t,"loadImage",(function(){return V})),n.d(t,"loadImageArray",(function(){return z})),n.d(t,"loadImageCube",(function(){return R})),n.d(t,"_JPEGLoader",(function(){return C})),n.d(t,"_PNGLoader",(function(){return F})),n.d(t,"_GIFLoader",(function(){return H})),n.d(t,"_BMPLoader",(function(){return J})),n.d(t,"_SVGLoader",(function(){return W})),n.d(t,"_ImageLoaders",(function(){return q})),n.d(t,"HTMLImageLoader",(function(){return U}))}])}));

@@ -14,3 +14,3 @@ "use strict";

var VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest';
var VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest';
var EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'svg'];

@@ -17,0 +17,0 @@ var MIME_TYPES = ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/bmp', 'image/vndmicrosofticon', 'image/svg+xml'];

@@ -16,3 +16,3 @@ "use strict";

var VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest';
var VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest';
var JPEGLoader = {

@@ -19,0 +19,0 @@ id: 'jpeg',

@@ -14,4 +14,2 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _assert = _interopRequireDefault(require("../utils/assert"));

@@ -31,75 +29,68 @@

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function parseImage(_x, _x2, _x3) {
return _parseImage.apply(this, arguments);
}
function parseImage(arrayBuffer, options, context) {
var _ref, url, format;
function _parseImage() {
_parseImage = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(arrayBuffer, options, context) {
var _ref, url, format;
return _regenerator["default"].async(function parseImage$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if ('image' in options) {
options = _objectSpread({}, options, {
image: {}
});
}
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if ('image' in options) {
options = _objectSpread({}, options, {
image: {}
});
}
_ref = context || {}, url = _ref.url;
_ref = context || {}, url = _ref.url;
if (!(url && /\.svg((\?|#).*)?$/.test(url))) {
_context.next = 7;
break;
}
if (!(url && /\.svg((\?|#).*)?$/.test(url))) {
_context.next = 7;
break;
}
console.warn('@loaders.gl/images: SVG parsing needs to be fixed for 2.0');
_context.next = 6;
return _regenerator["default"].awrap((0, _parseSvg["default"])(arrayBuffer, options));
console.warn('@loaders.gl/images: SVG parsing needs to be fixed for 2.0');
_context.next = 6;
return (0, _parseSvg["default"])(arrayBuffer, options);
case 6:
return _context.abrupt("return", _context.sent);
case 6:
return _context.abrupt("return", _context.sent);
case 7:
format = (0, _getImageOutputFormat["default"])(options);
_context.t0 = format;
_context.next = _context.t0 === 'imagebitmap' ? 11 : _context.t0 === 'html' ? 14 : _context.t0 === 'ndarray' ? 17 : 20;
break;
case 7:
format = (0, _getImageOutputFormat["default"])(options);
_context.t0 = format;
_context.next = _context.t0 === 'imagebitmap' ? 11 : _context.t0 === 'html' ? 14 : _context.t0 === 'ndarray' ? 17 : 20;
break;
case 11:
_context.next = 13;
return _regenerator["default"].awrap((0, _parseToImageBitmap["default"])(arrayBuffer, options));
case 11:
_context.next = 13;
return (0, _parseToImageBitmap["default"])(arrayBuffer, options);
case 13:
return _context.abrupt("return", _context.sent);
case 13:
return _context.abrupt("return", _context.sent);
case 14:
_context.next = 16;
return _regenerator["default"].awrap((0, _parseToHtmlImage["default"])(arrayBuffer, options));
case 14:
_context.next = 16;
return (0, _parseToHtmlImage["default"])(arrayBuffer, options);
case 16:
return _context.abrupt("return", _context.sent);
case 16:
return _context.abrupt("return", _context.sent);
case 17:
_context.next = 19;
return _regenerator["default"].awrap((0, _parseToNodeImage["default"])(arrayBuffer, options));
case 17:
_context.next = 19;
return (0, _parseToNodeImage["default"])(arrayBuffer, options);
case 19:
return _context.abrupt("return", _context.sent);
case 19:
return _context.abrupt("return", _context.sent);
case 20:
return _context.abrupt("return", (0, _assert["default"])(false));
case 20:
return _context.abrupt("return", (0, _assert["default"])(false));
case 21:
case "end":
return _context.stop();
}
case 21:
case "end":
return _context.stop();
}
}, _callee);
}));
return _parseImage.apply(this, arguments);
}
});
}
//# sourceMappingURL=parse-image.js.map

@@ -12,35 +12,26 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _parseToHtmlImage = require("./parse-to-html-image");
function parseSVG(_x, _x2) {
return _parseSVG.apply(this, arguments);
}
function parseSVG(arrayBuffer, options) {
var textDecoder, xmlText, src;
return _regenerator["default"].async(function parseSVG$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
textDecoder = new TextDecoder();
xmlText = textDecoder.decode(arrayBuffer);
src = "data:image/svg+xml;base64,".concat(btoa(xmlText));
_context.next = 5;
return _regenerator["default"].awrap((0, _parseToHtmlImage.loadToHTMLImage)(src, options));
function _parseSVG() {
_parseSVG = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(arrayBuffer, options) {
var textDecoder, xmlText, src;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
textDecoder = new TextDecoder();
xmlText = textDecoder.decode(arrayBuffer);
src = "data:image/svg+xml;base64,".concat(btoa(xmlText));
_context.next = 5;
return (0, _parseToHtmlImage.loadToHTMLImage)(src, options);
case 5:
return _context.abrupt("return", _context.sent);
case 5:
return _context.abrupt("return", _context.sent);
case 6:
case "end":
return _context.stop();
}
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return _parseSVG.apply(this, arguments);
}
});
}
//# sourceMappingURL=parse-svg.js.map

@@ -13,96 +13,80 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
function parseToHTMLImage(arrayBuffer, options) {
var mimeType, blob, URL, objectUrl;
return _regenerator["default"].async(function parseToHTMLImage$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
mimeType = 'image/jpeg';
blob = new Blob([arrayBuffer], {
type: mimeType
});
URL = self.URL || self.webkitURL;
objectUrl = URL.createObjectURL(blob);
_context.prev = 4;
_context.next = 7;
return _regenerator["default"].awrap(loadToHTMLImage(objectUrl, options));
function parseToHTMLImage(_x, _x2) {
return _parseToHTMLImage.apply(this, arguments);
}
case 7:
return _context.abrupt("return", _context.sent);
function _parseToHTMLImage() {
_parseToHTMLImage = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(arrayBuffer, options) {
var mimeType, blob, URL, objectUrl;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
mimeType = 'image/jpeg';
blob = new Blob([arrayBuffer], {
type: mimeType
});
URL = self.URL || self.webkitURL;
objectUrl = URL.createObjectURL(blob);
_context.prev = 4;
_context.next = 7;
return loadToHTMLImage(objectUrl, options);
case 8:
_context.prev = 8;
URL.revokeObjectURL(objectUrl);
return _context.finish(8);
case 7:
return _context.abrupt("return", _context.sent);
case 8:
_context.prev = 8;
URL.revokeObjectURL(objectUrl);
return _context.finish(8);
case 11:
case "end":
return _context.stop();
}
case 11:
case "end":
return _context.stop();
}
}, _callee, null, [[4,, 8, 11]]);
}));
return _parseToHTMLImage.apply(this, arguments);
}
}, null, null, [[4,, 8, 11]]);
}
function loadToHTMLImage(_x3, _x4) {
return _loadToHTMLImage.apply(this, arguments);
}
function loadToHTMLImage(url, options) {
var image;
return _regenerator["default"].async(function loadToHTMLImage$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
image = new Image();
image.src = url;
function _loadToHTMLImage() {
_loadToHTMLImage = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(url, options) {
var image;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
image = new Image();
image.src = url;
if (!(options.image && options.image.decode && image.decode)) {
_context2.next = 6;
break;
}
if (!(options.image && options.image.decode && image.decode)) {
_context2.next = 6;
break;
}
_context2.next = 5;
return _regenerator["default"].awrap(image.decode());
_context2.next = 5;
return image.decode();
case 5:
return _context2.abrupt("return", image);
case 5:
return _context2.abrupt("return", image);
case 6:
_context2.next = 8;
return _regenerator["default"].awrap(new Promise(function (resolve, reject) {
try {
image.onload = function () {
return resolve(image);
};
case 6:
_context2.next = 8;
return new Promise(function (resolve, reject) {
try {
image.onload = function () {
return resolve(image);
};
image.onerror = function (err) {
return reject(new Error("Could not load image ".concat(url, ": ").concat(err)));
};
} catch (error) {
reject(error);
}
}));
image.onerror = function (err) {
return reject(new Error("Could not load image ".concat(url, ": ").concat(err)));
};
} catch (error) {
reject(error);
}
});
case 8:
return _context2.abrupt("return", _context2.sent);
case 8:
return _context2.abrupt("return", _context2.sent);
case 9:
case "end":
return _context2.stop();
}
case 9:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _loadToHTMLImage.apply(this, arguments);
}
});
}
//# sourceMappingURL=parse-to-html-image.js.map

@@ -13,4 +13,2 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));

@@ -22,158 +20,130 @@

function asyncDeepMap(_x, _x2) {
return _asyncDeepMap.apply(this, arguments);
}
function asyncDeepMap(tree, func) {
var options,
_args = arguments;
return _regenerator["default"].async(function asyncDeepMap$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return _regenerator["default"].awrap(mapSubtree(tree, func, options));
function _asyncDeepMap() {
_asyncDeepMap = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(tree, func) {
var options,
_args = arguments;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return mapSubtree(tree, func, options);
case 3:
return _context.abrupt("return", _context.sent);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _asyncDeepMap.apply(this, arguments);
}
});
}
function mapSubtree(_x3, _x4, _x5) {
return _mapSubtree.apply(this, arguments);
}
function mapSubtree(object, func, options) {
var url;
return _regenerator["default"].async(function mapSubtree$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!Array.isArray(object)) {
_context2.next = 4;
break;
}
function _mapSubtree() {
_mapSubtree = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(object, func, options) {
var url;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!Array.isArray(object)) {
_context2.next = 4;
break;
}
_context2.next = 3;
return _regenerator["default"].awrap(mapArray(object, func, options));
_context2.next = 3;
return mapArray(object, func, options);
case 3:
return _context2.abrupt("return", _context2.sent);
case 3:
return _context2.abrupt("return", _context2.sent);
case 4:
if (!isObject(object)) {
_context2.next = 8;
break;
}
case 4:
if (!isObject(object)) {
_context2.next = 8;
break;
}
_context2.next = 7;
return _regenerator["default"].awrap(mapObject(object, func, options));
_context2.next = 7;
return mapObject(object, func, options);
case 7:
return _context2.abrupt("return", _context2.sent);
case 7:
return _context2.abrupt("return", _context2.sent);
case 8:
url = object;
_context2.next = 11;
return _regenerator["default"].awrap(func(url, options));
case 8:
url = object;
_context2.next = 11;
return func(url, options);
case 11:
return _context2.abrupt("return", _context2.sent);
case 11:
return _context2.abrupt("return", _context2.sent);
case 12:
case "end":
return _context2.stop();
}
case 12:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _mapSubtree.apply(this, arguments);
}
});
}
function mapObject(_x6, _x7, _x8) {
return _mapObject.apply(this, arguments);
}
function mapObject(object, func, options) {
var promises, values, _loop, key;
function _mapObject() {
_mapObject = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(object, func, options) {
var promises, values, _loop, key;
return _regenerator["default"].async(function mapObject$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
promises = [];
values = {};
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
promises = [];
values = {};
_loop = function _loop(key) {
var url = object[key];
var promise = mapSubtree(url, func, options).then(function (value) {
values[key] = value;
});
promises.push(promise);
};
_loop = function _loop(key) {
var url = object[key];
var promise = mapSubtree(url, func, options).then(function (value) {
values[key] = value;
});
promises.push(promise);
};
for (key in object) {
_loop(key);
}
for (key in object) {
_loop(key);
}
_context3.next = 6;
return _regenerator["default"].awrap(Promise.all(promises));
_context3.next = 6;
return Promise.all(promises);
case 6:
return _context3.abrupt("return", values);
case 6:
return _context3.abrupt("return", values);
case 7:
case "end":
return _context3.stop();
}
case 7:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _mapObject.apply(this, arguments);
}
});
}
function mapArray(_x9, _x10) {
return _mapArray.apply(this, arguments);
}
function mapArray(urlArray, func) {
var options,
promises,
_args4 = arguments;
return _regenerator["default"].async(function mapArray$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
promises = urlArray.map(function (url) {
return mapSubtree(url, func, options);
});
_context4.next = 4;
return _regenerator["default"].awrap(Promise.all(promises));
function _mapArray() {
_mapArray = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee4(urlArray, func) {
var options,
promises,
_args4 = arguments;
return _regenerator["default"].wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
promises = urlArray.map(function (url) {
return mapSubtree(url, func, options);
});
_context4.next = 4;
return Promise.all(promises);
case 4:
return _context4.abrupt("return", _context4.sent);
case 4:
return _context4.abrupt("return", _context4.sent);
case 5:
case "end":
return _context4.stop();
}
case 5:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _mapArray.apply(this, arguments);
}
});
}
//# sourceMappingURL=async-deep-map.js.map

@@ -13,70 +13,54 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _asyncDeepMap = require("./async-deep-map");
function deepLoad(_x, _x2, _x3) {
return _deepLoad.apply(this, arguments);
}
function deepLoad(urlTree, load, options) {
return _regenerator["default"].async(function deepLoad$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _regenerator["default"].awrap((0, _asyncDeepMap.asyncDeepMap)(urlTree, function (url) {
return shallowLoad(url, load, options);
}));
function _deepLoad() {
_deepLoad = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(urlTree, load, options) {
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return (0, _asyncDeepMap.asyncDeepMap)(urlTree, function (url) {
return shallowLoad(url, load, options);
});
case 2:
return _context.abrupt("return", _context.sent);
case 2:
return _context.abrupt("return", _context.sent);
case 3:
case "end":
return _context.stop();
}
case 3:
case "end":
return _context.stop();
}
}, _callee);
}));
return _deepLoad.apply(this, arguments);
}
});
}
function shallowLoad(_x4, _x5, _x6) {
return _shallowLoad.apply(this, arguments);
}
function shallowLoad(url, load, options) {
var response, arrayBuffer;
return _regenerator["default"].async(function shallowLoad$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _regenerator["default"].awrap(fetch(url, options.fetch));
function _shallowLoad() {
_shallowLoad = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(url, load, options) {
var response, arrayBuffer;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return fetch(url, options.fetch);
case 2:
response = _context2.sent;
_context2.next = 5;
return _regenerator["default"].awrap(response.arrayBuffer());
case 2:
response = _context2.sent;
_context2.next = 5;
return response.arrayBuffer();
case 5:
arrayBuffer = _context2.sent;
_context2.next = 8;
return _regenerator["default"].awrap(load(arrayBuffer, options));
case 5:
arrayBuffer = _context2.sent;
_context2.next = 8;
return load(arrayBuffer, options);
case 8:
return _context2.abrupt("return", _context2.sent);
case 8:
return _context2.abrupt("return", _context2.sent);
case 9:
case "end":
return _context2.stop();
}
case 9:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _shallowLoad.apply(this, arguments);
}
});
}
//# sourceMappingURL=deep-load.js.map

@@ -16,3 +16,3 @@ "use strict";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -19,0 +19,0 @@ function generateUrl(getUrl, options, urlOptions) {

@@ -13,4 +13,2 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _parseImage = _interopRequireDefault(require("../parsers/parse-image"));

@@ -22,77 +20,63 @@

function loadImageArray(_x, _x2) {
return _loadImageArray.apply(this, arguments);
}
function loadImageArray(count, getUrl) {
var options,
imageUrls,
_args = arguments;
return _regenerator["default"].async(function loadImageArray$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return _regenerator["default"].awrap(getImageArrayUrls(count, getUrl, options));
function _loadImageArray() {
_loadImageArray = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(count, getUrl) {
var options,
imageUrls,
_args = arguments;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return getImageArrayUrls(count, getUrl, options);
case 3:
imageUrls = _context.sent;
_context.next = 6;
return _regenerator["default"].awrap((0, _deepLoad.deepLoad)(imageUrls, _parseImage["default"], options));
case 3:
imageUrls = _context.sent;
_context.next = 6;
return (0, _deepLoad.deepLoad)(imageUrls, _parseImage["default"], options);
case 6:
return _context.abrupt("return", _context.sent);
case 6:
return _context.abrupt("return", _context.sent);
case 7:
case "end":
return _context.stop();
}
case 7:
case "end":
return _context.stop();
}
}, _callee);
}));
return _loadImageArray.apply(this, arguments);
}
});
}
function getImageArrayUrls(_x3, _x4) {
return _getImageArrayUrls.apply(this, arguments);
}
function getImageArrayUrls(count, getUrl) {
var options,
promises,
index,
promise,
_args2 = arguments;
return _regenerator["default"].async(function getImageArrayUrls$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
promises = [];
function _getImageArrayUrls() {
_getImageArrayUrls = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(count, getUrl) {
var options,
promises,
index,
promise,
_args2 = arguments;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
promises = [];
for (index = 0; index < count; index++) {
promise = (0, _loadImage.getImageUrls)(getUrl, options, {
index: index
});
promises.push(promise);
}
for (index = 0; index < count; index++) {
promise = (0, _loadImage.getImageUrls)(getUrl, options, {
index: index
});
promises.push(promise);
}
_context2.next = 5;
return _regenerator["default"].awrap(Promise.all(promises));
_context2.next = 5;
return Promise.all(promises);
case 5:
return _context2.abrupt("return", _context2.sent);
case 5:
return _context2.abrupt("return", _context2.sent);
case 6:
case "end":
return _context2.stop();
}
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _getImageArrayUrls.apply(this, arguments);
}
});
}
//# sourceMappingURL=load-image-array.js.map

@@ -15,4 +15,2 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _parseImage = _interopRequireDefault(require("../parsers/parse-image"));

@@ -26,3 +24,3 @@

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -67,82 +65,68 @@ var GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;

function getImageCubeUrls(_x, _x2) {
return _getImageCubeUrls.apply(this, arguments);
}
function getImageCubeUrls(getUrl, options) {
var urls, promises, index, _loop, face;
function _getImageCubeUrls() {
_getImageCubeUrls = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(getUrl, options) {
var urls, promises, index, _loop, face;
return _regenerator["default"].async(function getImageCubeUrls$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
urls = {};
promises = [];
index = 0;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
urls = {};
promises = [];
index = 0;
_loop = function _loop(face) {
var faceValues = CUBE_FACES[index];
var promise = (0, _loadImage.getImageUrls)(getUrl, options, _objectSpread({}, faceValues, {
index: index++
})).then(function (url) {
urls[face] = url;
});
promises.push(promise);
};
_loop = function _loop(face) {
var faceValues = CUBE_FACES[index];
var promise = (0, _loadImage.getImageUrls)(getUrl, options, _objectSpread({}, faceValues, {
index: index++
})).then(function (url) {
urls[face] = url;
});
promises.push(promise);
};
for (face in CUBE_FACES) {
_loop(face);
}
for (face in CUBE_FACES) {
_loop(face);
}
_context.next = 7;
return _regenerator["default"].awrap(Promise.all(promises));
_context.next = 7;
return Promise.all(promises);
case 7:
return _context.abrupt("return", urls);
case 7:
return _context.abrupt("return", urls);
case 8:
case "end":
return _context.stop();
}
case 8:
case "end":
return _context.stop();
}
}, _callee);
}));
return _getImageCubeUrls.apply(this, arguments);
}
});
}
function loadImageCube(_x3) {
return _loadImageCube.apply(this, arguments);
}
function loadImageCube(getUrl) {
var options,
urls,
_args2 = arguments;
return _regenerator["default"].async(function loadImageCube$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
_context2.next = 3;
return _regenerator["default"].awrap(getImageCubeUrls(getUrl, options));
function _loadImageCube() {
_loadImageCube = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(getUrl) {
var options,
urls,
_args2 = arguments;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
_context2.next = 3;
return getImageCubeUrls(getUrl, options);
case 3:
urls = _context2.sent;
_context2.next = 6;
return _regenerator["default"].awrap((0, _deepLoad.deepLoad)(urls, _parseImage["default"], options));
case 3:
urls = _context2.sent;
_context2.next = 6;
return (0, _deepLoad.deepLoad)(urls, _parseImage["default"], options);
case 6:
return _context2.abrupt("return", _context2.sent);
case 6:
return _context2.abrupt("return", _context2.sent);
case 7:
case "end":
return _context2.stop();
}
case 7:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _loadImageCube.apply(this, arguments);
}
});
}
//# sourceMappingURL=load-image-cube.js.map

@@ -16,4 +16,2 @@ "use strict";

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _assert = _interopRequireDefault(require("../utils/assert"));

@@ -31,138 +29,117 @@

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function loadImage(_x) {
return _loadImage.apply(this, arguments);
}
function loadImage(getUrl) {
var options,
imageUrls,
_args = arguments;
return _regenerator["default"].async(function loadImage$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
_context.next = 3;
return _regenerator["default"].awrap(getImageUrls(getUrl, options));
function _loadImage() {
_loadImage = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(getUrl) {
var options,
imageUrls,
_args = arguments;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
_context.next = 3;
return getImageUrls(getUrl, options);
case 3:
imageUrls = _context.sent;
_context.next = 6;
return _regenerator["default"].awrap((0, _deepLoad.deepLoad)(imageUrls, _parseImage["default"], options));
case 3:
imageUrls = _context.sent;
_context.next = 6;
return (0, _deepLoad.deepLoad)(imageUrls, _parseImage["default"], options);
case 6:
return _context.abrupt("return", _context.sent);
case 6:
return _context.abrupt("return", _context.sent);
case 7:
case "end":
return _context.stop();
}
case 7:
case "end":
return _context.stop();
}
}, _callee);
}));
return _loadImage.apply(this, arguments);
}
});
}
function getImageUrls(_x2, _x3) {
return _getImageUrls.apply(this, arguments);
}
function getImageUrls(getUrl, options) {
var urlOptions,
mipLevels,
_args2 = arguments;
return _regenerator["default"].async(function getImageUrls$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
urlOptions = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
mipLevels = options && options.image && options.image.mipLevels || 0;
function _getImageUrls() {
_getImageUrls = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(getUrl, options) {
var urlOptions,
mipLevels,
_args2 = arguments;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
urlOptions = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
mipLevels = options && options.image && options.image.mipLevels || 0;
if (!(mipLevels !== 0)) {
_context2.next = 8;
break;
}
if (!(mipLevels !== 0)) {
_context2.next = 8;
break;
}
_context2.next = 5;
return _regenerator["default"].awrap(getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions));
_context2.next = 5;
return getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions);
case 5:
_context2.t0 = _context2.sent;
_context2.next = 9;
break;
case 5:
_context2.t0 = _context2.sent;
_context2.next = 9;
break;
case 8:
_context2.t0 = (0, _generateUrl.generateUrl)(getUrl, options, urlOptions);
case 8:
_context2.t0 = (0, _generateUrl.generateUrl)(getUrl, options, urlOptions);
case 9:
return _context2.abrupt("return", _context2.t0);
case 9:
return _context2.abrupt("return", _context2.t0);
case 10:
case "end":
return _context2.stop();
}
case 10:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _getImageUrls.apply(this, arguments);
}
});
}
function getMipmappedImageUrls(_x4, _x5, _x6, _x7) {
return _getMipmappedImageUrls.apply(this, arguments);
}
function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) {
var urls, url, image, _getImageSize, width, height, mipLevel, _url;
function _getMipmappedImageUrls() {
_getMipmappedImageUrls = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(getUrl, mipLevels, options, urlOptions) {
var urls, url, image, _getImageSize, width, height, mipLevel, _url;
return _regenerator["default"].async(function getMipmappedImageUrls$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
urls = [];
return _regenerator["default"].wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
urls = [];
if (!(mipLevels === 'auto')) {
_context3.next = 9;
break;
}
if (!(mipLevels === 'auto')) {
_context3.next = 9;
break;
}
url = (0, _generateUrl.generateUrl)(getUrl, options, _objectSpread({}, urlOptions, {
lod: 0
}));
_context3.next = 5;
return _regenerator["default"].awrap((0, _deepLoad.shallowLoad)(url, _parseImage["default"], options));
url = (0, _generateUrl.generateUrl)(getUrl, options, _objectSpread({}, urlOptions, {
lod: 0
}));
_context3.next = 5;
return (0, _deepLoad.shallowLoad)(url, _parseImage["default"], options);
case 5:
image = _context3.sent;
_getImageSize = (0, _parsedImageApi.getImageSize)(image), width = _getImageSize.width, height = _getImageSize.height;
mipLevels = getMipLevels({
width: width,
height: height
});
urls.push(url);
case 5:
image = _context3.sent;
_getImageSize = (0, _parsedImageApi.getImageSize)(image), width = _getImageSize.width, height = _getImageSize.height;
mipLevels = getMipLevels({
width: width,
height: height
});
urls.push(url);
case 9:
(0, _assert["default"])(mipLevels > 0);
case 9:
(0, _assert["default"])(mipLevels > 0);
for (mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
_url = (0, _generateUrl.generateUrl)(getUrl, options, _objectSpread({}, urlOptions, {
lod: mipLevel
}));
urls.push(_url);
}
for (mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
_url = (0, _generateUrl.generateUrl)(getUrl, options, _objectSpread({}, urlOptions, {
lod: mipLevel
}));
urls.push(_url);
}
return _context3.abrupt("return", urls);
return _context3.abrupt("return", urls);
case 12:
case "end":
return _context3.stop();
}
case 12:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _getMipmappedImageUrls.apply(this, arguments);
}
});
}

@@ -169,0 +146,0 @@

import parseImage from './lib/parsers/parse-image';
import { isPng, isGif, isBmp, isJpeg } from './lib/binary-image-api/binary-image-parsers';
const VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest';
const VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest';
const EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'svg'];

@@ -5,0 +5,0 @@ const MIME_TYPES = ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/bmp', 'image/vndmicrosofticon', 'image/svg+xml'];

import parseImage from './lib/parsers/parse-image';
import parseSVG from './lib/parsers/parse-svg';
import { isPng, isGif, isBmp, isJpeg } from './lib/binary-image-api/binary-image-parsers';
const VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest';
const VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest';
export const JPEGLoader = {

@@ -6,0 +6,0 @@ id: 'jpeg',

@@ -5,3 +5,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -8,0 +8,0 @@ import assert from '../utils/assert';

@@ -5,3 +5,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -8,0 +8,0 @@ import assert from '../utils/assert';

@@ -5,3 +5,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -8,0 +8,0 @@ import parseImage from '../parsers/parse-image';

@@ -5,3 +5,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -8,0 +8,0 @@ import assert from '../utils/assert';

import parseImage from './lib/parsers/parse-image';
import { isPng, isGif, isBmp, isJpeg } from './lib/binary-image-api/binary-image-parsers';
var VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest';
var VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest';
var EXTENSIONS = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'ico', 'svg'];

@@ -5,0 +5,0 @@ var MIME_TYPES = ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/bmp', 'image/vndmicrosofticon', 'image/svg+xml'];

import parseImage from './lib/parsers/parse-image';
import parseSVG from './lib/parsers/parse-svg';
import { isPng, isGif, isBmp, isJpeg } from './lib/binary-image-api/binary-image-parsers';
var VERSION = typeof "2.0.0-beta.2" !== 'undefined' ? "2.0.0-beta.2" : 'latest';
var VERSION = typeof "2.0.0-beta.3" !== 'undefined' ? "2.0.0-beta.3" : 'latest';
export var JPEGLoader = {

@@ -6,0 +6,0 @@ id: 'jpeg',

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -15,73 +14,66 @@ import assert from '../utils/assert';

import parseSVG from './parse-svg';
export default function parseImage(_x, _x2, _x3) {
return _parseImage.apply(this, arguments);
}
export default function parseImage(arrayBuffer, options, context) {
var _ref, url, format;
function _parseImage() {
_parseImage = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(arrayBuffer, options, context) {
var _ref, url, format;
return _regeneratorRuntime.async(function parseImage$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if ('image' in options) {
options = _objectSpread({}, options, {
image: {}
});
}
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if ('image' in options) {
options = _objectSpread({}, options, {
image: {}
});
}
_ref = context || {}, url = _ref.url;
_ref = context || {}, url = _ref.url;
if (!(url && /\.svg((\?|#).*)?$/.test(url))) {
_context.next = 7;
break;
}
if (!(url && /\.svg((\?|#).*)?$/.test(url))) {
_context.next = 7;
break;
}
console.warn('@loaders.gl/images: SVG parsing needs to be fixed for 2.0');
_context.next = 6;
return _regeneratorRuntime.awrap(parseSVG(arrayBuffer, options));
console.warn('@loaders.gl/images: SVG parsing needs to be fixed for 2.0');
_context.next = 6;
return parseSVG(arrayBuffer, options);
case 6:
return _context.abrupt("return", _context.sent);
case 6:
return _context.abrupt("return", _context.sent);
case 7:
format = getImageOutputFormat(options);
_context.t0 = format;
_context.next = _context.t0 === 'imagebitmap' ? 11 : _context.t0 === 'html' ? 14 : _context.t0 === 'ndarray' ? 17 : 20;
break;
case 7:
format = getImageOutputFormat(options);
_context.t0 = format;
_context.next = _context.t0 === 'imagebitmap' ? 11 : _context.t0 === 'html' ? 14 : _context.t0 === 'ndarray' ? 17 : 20;
break;
case 11:
_context.next = 13;
return _regeneratorRuntime.awrap(parseToImageBitmap(arrayBuffer, options));
case 11:
_context.next = 13;
return parseToImageBitmap(arrayBuffer, options);
case 13:
return _context.abrupt("return", _context.sent);
case 13:
return _context.abrupt("return", _context.sent);
case 14:
_context.next = 16;
return _regeneratorRuntime.awrap(parseToHTMLImage(arrayBuffer, options));
case 14:
_context.next = 16;
return parseToHTMLImage(arrayBuffer, options);
case 16:
return _context.abrupt("return", _context.sent);
case 16:
return _context.abrupt("return", _context.sent);
case 17:
_context.next = 19;
return _regeneratorRuntime.awrap(parseToNodeImage(arrayBuffer, options));
case 17:
_context.next = 19;
return parseToNodeImage(arrayBuffer, options);
case 19:
return _context.abrupt("return", _context.sent);
case 19:
return _context.abrupt("return", _context.sent);
case 20:
return _context.abrupt("return", assert(false));
case 20:
return _context.abrupt("return", assert(false));
case 21:
case "end":
return _context.stop();
}
case 21:
case "end":
return _context.stop();
}
}, _callee);
}));
return _parseImage.apply(this, arguments);
}
});
}
//# sourceMappingURL=parse-image.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { loadToHTMLImage } from './parse-to-html-image';
export default function parseSVG(_x, _x2) {
return _parseSVG.apply(this, arguments);
}
export default function parseSVG(arrayBuffer, options) {
var textDecoder, xmlText, src;
return _regeneratorRuntime.async(function parseSVG$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
textDecoder = new TextDecoder();
xmlText = textDecoder.decode(arrayBuffer);
src = "data:image/svg+xml;base64,".concat(btoa(xmlText));
_context.next = 5;
return _regeneratorRuntime.awrap(loadToHTMLImage(src, options));
function _parseSVG() {
_parseSVG = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(arrayBuffer, options) {
var textDecoder, xmlText, src;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
textDecoder = new TextDecoder();
xmlText = textDecoder.decode(arrayBuffer);
src = "data:image/svg+xml;base64,".concat(btoa(xmlText));
_context.next = 5;
return loadToHTMLImage(src, options);
case 5:
return _context.abrupt("return", _context.sent);
case 5:
return _context.abrupt("return", _context.sent);
case 6:
case "end":
return _context.stop();
}
case 6:
case "end":
return _context.stop();
}
}, _callee);
}));
return _parseSVG.apply(this, arguments);
}
});
}
//# sourceMappingURL=parse-svg.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
export default function parseToHTMLImage(_x, _x2) {
return _parseToHTMLImage.apply(this, arguments);
}
export default function parseToHTMLImage(arrayBuffer, options) {
var mimeType, blob, URL, objectUrl;
return _regeneratorRuntime.async(function parseToHTMLImage$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
mimeType = 'image/jpeg';
blob = new Blob([arrayBuffer], {
type: mimeType
});
URL = self.URL || self.webkitURL;
objectUrl = URL.createObjectURL(blob);
_context.prev = 4;
_context.next = 7;
return _regeneratorRuntime.awrap(loadToHTMLImage(objectUrl, options));
function _parseToHTMLImage() {
_parseToHTMLImage = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(arrayBuffer, options) {
var mimeType, blob, URL, objectUrl;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
mimeType = 'image/jpeg';
blob = new Blob([arrayBuffer], {
type: mimeType
});
URL = self.URL || self.webkitURL;
objectUrl = URL.createObjectURL(blob);
_context.prev = 4;
_context.next = 7;
return loadToHTMLImage(objectUrl, options);
case 7:
return _context.abrupt("return", _context.sent);
case 7:
return _context.abrupt("return", _context.sent);
case 8:
_context.prev = 8;
URL.revokeObjectURL(objectUrl);
return _context.finish(8);
case 8:
_context.prev = 8;
URL.revokeObjectURL(objectUrl);
return _context.finish(8);
case 11:
case "end":
return _context.stop();
}
case 11:
case "end":
return _context.stop();
}
}, _callee, null, [[4,, 8, 11]]);
}));
return _parseToHTMLImage.apply(this, arguments);
}
}, null, null, [[4,, 8, 11]]);
}
export function loadToHTMLImage(url, options) {
var image;
return _regeneratorRuntime.async(function loadToHTMLImage$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
image = new Image();
image.src = url;
export function loadToHTMLImage(_x3, _x4) {
return _loadToHTMLImage.apply(this, arguments);
}
if (!(options.image && options.image.decode && image.decode)) {
_context2.next = 6;
break;
}
function _loadToHTMLImage() {
_loadToHTMLImage = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(url, options) {
var image;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
image = new Image();
image.src = url;
_context2.next = 5;
return _regeneratorRuntime.awrap(image.decode());
if (!(options.image && options.image.decode && image.decode)) {
_context2.next = 6;
break;
}
case 5:
return _context2.abrupt("return", image);
_context2.next = 5;
return image.decode();
case 6:
_context2.next = 8;
return _regeneratorRuntime.awrap(new Promise(function (resolve, reject) {
try {
image.onload = function () {
return resolve(image);
};
case 5:
return _context2.abrupt("return", image);
image.onerror = function (err) {
return reject(new Error("Could not load image ".concat(url, ": ").concat(err)));
};
} catch (error) {
reject(error);
}
}));
case 6:
_context2.next = 8;
return new Promise(function (resolve, reject) {
try {
image.onload = function () {
return resolve(image);
};
case 8:
return _context2.abrupt("return", _context2.sent);
image.onerror = function (err) {
return reject(new Error("Could not load image ".concat(url, ": ").concat(err)));
};
} catch (error) {
reject(error);
}
});
case 8:
return _context2.abrupt("return", _context2.sent);
case 9:
case "end":
return _context2.stop();
}
case 9:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _loadToHTMLImage.apply(this, arguments);
}
});
}
//# sourceMappingURL=parse-to-html-image.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import _typeof from "@babel/runtime/helpers/esm/typeof";

@@ -9,158 +8,129 @@

export function asyncDeepMap(_x, _x2) {
return _asyncDeepMap.apply(this, arguments);
}
export function asyncDeepMap(tree, func) {
var options,
_args = arguments;
return _regeneratorRuntime.async(function asyncDeepMap$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return _regeneratorRuntime.awrap(mapSubtree(tree, func, options));
function _asyncDeepMap() {
_asyncDeepMap = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(tree, func) {
var options,
_args = arguments;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return mapSubtree(tree, func, options);
case 3:
return _context.abrupt("return", _context.sent);
case 3:
return _context.abrupt("return", _context.sent);
case 4:
case "end":
return _context.stop();
}
case 4:
case "end":
return _context.stop();
}
}, _callee);
}));
return _asyncDeepMap.apply(this, arguments);
}
});
}
export function mapSubtree(object, func, options) {
var url;
return _regeneratorRuntime.async(function mapSubtree$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!Array.isArray(object)) {
_context2.next = 4;
break;
}
export function mapSubtree(_x3, _x4, _x5) {
return _mapSubtree.apply(this, arguments);
}
_context2.next = 3;
return _regeneratorRuntime.awrap(mapArray(object, func, options));
function _mapSubtree() {
_mapSubtree = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(object, func, options) {
var url;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!Array.isArray(object)) {
_context2.next = 4;
break;
}
case 3:
return _context2.abrupt("return", _context2.sent);
_context2.next = 3;
return mapArray(object, func, options);
case 4:
if (!isObject(object)) {
_context2.next = 8;
break;
}
case 3:
return _context2.abrupt("return", _context2.sent);
_context2.next = 7;
return _regeneratorRuntime.awrap(mapObject(object, func, options));
case 4:
if (!isObject(object)) {
_context2.next = 8;
break;
}
case 7:
return _context2.abrupt("return", _context2.sent);
_context2.next = 7;
return mapObject(object, func, options);
case 8:
url = object;
_context2.next = 11;
return _regeneratorRuntime.awrap(func(url, options));
case 7:
return _context2.abrupt("return", _context2.sent);
case 11:
return _context2.abrupt("return", _context2.sent);
case 8:
url = object;
_context2.next = 11;
return func(url, options);
case 11:
return _context2.abrupt("return", _context2.sent);
case 12:
case "end":
return _context2.stop();
}
case 12:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _mapSubtree.apply(this, arguments);
}
});
}
function mapObject(_x6, _x7, _x8) {
return _mapObject.apply(this, arguments);
}
function mapObject(object, func, options) {
var promises, values, _loop, key;
function _mapObject() {
_mapObject = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(object, func, options) {
var promises, values, _loop, key;
return _regeneratorRuntime.async(function mapObject$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
promises = [];
values = {};
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
promises = [];
values = {};
_loop = function _loop(key) {
var url = object[key];
var promise = mapSubtree(url, func, options).then(function (value) {
values[key] = value;
});
promises.push(promise);
};
_loop = function _loop(key) {
var url = object[key];
var promise = mapSubtree(url, func, options).then(function (value) {
values[key] = value;
});
promises.push(promise);
};
for (key in object) {
_loop(key);
}
for (key in object) {
_loop(key);
}
_context3.next = 6;
return _regeneratorRuntime.awrap(Promise.all(promises));
_context3.next = 6;
return Promise.all(promises);
case 6:
return _context3.abrupt("return", values);
case 6:
return _context3.abrupt("return", values);
case 7:
case "end":
return _context3.stop();
}
case 7:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _mapObject.apply(this, arguments);
}
});
}
function mapArray(_x9, _x10) {
return _mapArray.apply(this, arguments);
}
function mapArray(urlArray, func) {
var options,
promises,
_args4 = arguments;
return _regeneratorRuntime.async(function mapArray$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
promises = urlArray.map(function (url) {
return mapSubtree(url, func, options);
});
_context4.next = 4;
return _regeneratorRuntime.awrap(Promise.all(promises));
function _mapArray() {
_mapArray = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(urlArray, func) {
var options,
promises,
_args4 = arguments;
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
options = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : {};
promises = urlArray.map(function (url) {
return mapSubtree(url, func, options);
});
_context4.next = 4;
return Promise.all(promises);
case 4:
return _context4.abrupt("return", _context4.sent);
case 4:
return _context4.abrupt("return", _context4.sent);
case 5:
case "end":
return _context4.stop();
}
case 5:
case "end":
return _context4.stop();
}
}, _callee4);
}));
return _mapArray.apply(this, arguments);
}
});
}
//# sourceMappingURL=async-deep-map.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { asyncDeepMap } from './async-deep-map';
export function deepLoad(_x, _x2, _x3) {
return _deepLoad.apply(this, arguments);
}
export function deepLoad(urlTree, load, options) {
return _regeneratorRuntime.async(function deepLoad$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return _regeneratorRuntime.awrap(asyncDeepMap(urlTree, function (url) {
return shallowLoad(url, load, options);
}));
function _deepLoad() {
_deepLoad = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(urlTree, load, options) {
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return asyncDeepMap(urlTree, function (url) {
return shallowLoad(url, load, options);
});
case 2:
return _context.abrupt("return", _context.sent);
case 2:
return _context.abrupt("return", _context.sent);
case 3:
case "end":
return _context.stop();
}
case 3:
case "end":
return _context.stop();
}
}, _callee);
}));
return _deepLoad.apply(this, arguments);
}
});
}
export function shallowLoad(url, load, options) {
var response, arrayBuffer;
return _regeneratorRuntime.async(function shallowLoad$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return _regeneratorRuntime.awrap(fetch(url, options.fetch));
export function shallowLoad(_x4, _x5, _x6) {
return _shallowLoad.apply(this, arguments);
}
case 2:
response = _context2.sent;
_context2.next = 5;
return _regeneratorRuntime.awrap(response.arrayBuffer());
function _shallowLoad() {
_shallowLoad = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(url, load, options) {
var response, arrayBuffer;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return fetch(url, options.fetch);
case 5:
arrayBuffer = _context2.sent;
_context2.next = 8;
return _regeneratorRuntime.awrap(load(arrayBuffer, options));
case 2:
response = _context2.sent;
_context2.next = 5;
return response.arrayBuffer();
case 8:
return _context2.abrupt("return", _context2.sent);
case 5:
arrayBuffer = _context2.sent;
_context2.next = 8;
return load(arrayBuffer, options);
case 8:
return _context2.abrupt("return", _context2.sent);
case 9:
case "end":
return _context2.stop();
}
case 9:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _shallowLoad.apply(this, arguments);
}
});
}
//# sourceMappingURL=deep-load.js.map

@@ -5,3 +5,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -8,0 +8,0 @@ import assert from '../utils/assert';

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import parseImage from '../parsers/parse-image';
import { getImageUrls } from './load-image';
import { deepLoad } from './deep-load';
export function loadImageArray(_x, _x2) {
return _loadImageArray.apply(this, arguments);
}
export function loadImageArray(count, getUrl) {
var options,
imageUrls,
_args = arguments;
return _regeneratorRuntime.async(function loadImageArray$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return _regeneratorRuntime.awrap(getImageArrayUrls(count, getUrl, options));
function _loadImageArray() {
_loadImageArray = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(count, getUrl) {
var options,
imageUrls,
_args = arguments;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
_context.next = 3;
return getImageArrayUrls(count, getUrl, options);
case 3:
imageUrls = _context.sent;
_context.next = 6;
return _regeneratorRuntime.awrap(deepLoad(imageUrls, parseImage, options));
case 3:
imageUrls = _context.sent;
_context.next = 6;
return deepLoad(imageUrls, parseImage, options);
case 6:
return _context.abrupt("return", _context.sent);
case 6:
return _context.abrupt("return", _context.sent);
case 7:
case "end":
return _context.stop();
}
case 7:
case "end":
return _context.stop();
}
}, _callee);
}));
return _loadImageArray.apply(this, arguments);
}
});
}
export function getImageArrayUrls(count, getUrl) {
var options,
promises,
index,
promise,
_args2 = arguments;
return _regeneratorRuntime.async(function getImageArrayUrls$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
promises = [];
export function getImageArrayUrls(_x3, _x4) {
return _getImageArrayUrls.apply(this, arguments);
}
for (index = 0; index < count; index++) {
promise = getImageUrls(getUrl, options, {
index: index
});
promises.push(promise);
}
function _getImageArrayUrls() {
_getImageArrayUrls = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(count, getUrl) {
var options,
promises,
index,
promise,
_args2 = arguments;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
promises = [];
_context2.next = 5;
return _regeneratorRuntime.awrap(Promise.all(promises));
for (index = 0; index < count; index++) {
promise = getImageUrls(getUrl, options, {
index: index
});
promises.push(promise);
}
case 5:
return _context2.abrupt("return", _context2.sent);
_context2.next = 5;
return Promise.all(promises);
case 5:
return _context2.abrupt("return", _context2.sent);
case 6:
case "end":
return _context2.stop();
}
case 6:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _getImageArrayUrls.apply(this, arguments);
}
});
}
//# sourceMappingURL=load-image-array.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -49,82 +48,67 @@ import parseImage from '../parsers/parse-image';

}];
export function getImageCubeUrls(_x, _x2) {
return _getImageCubeUrls.apply(this, arguments);
}
export function getImageCubeUrls(getUrl, options) {
var urls, promises, index, _loop, face;
function _getImageCubeUrls() {
_getImageCubeUrls = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(getUrl, options) {
var urls, promises, index, _loop, face;
return _regeneratorRuntime.async(function getImageCubeUrls$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
urls = {};
promises = [];
index = 0;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
urls = {};
promises = [];
index = 0;
_loop = function _loop(face) {
var faceValues = CUBE_FACES[index];
var promise = getImageUrls(getUrl, options, _objectSpread({}, faceValues, {
index: index++
})).then(function (url) {
urls[face] = url;
});
promises.push(promise);
};
_loop = function _loop(face) {
var faceValues = CUBE_FACES[index];
var promise = getImageUrls(getUrl, options, _objectSpread({}, faceValues, {
index: index++
})).then(function (url) {
urls[face] = url;
});
promises.push(promise);
};
for (face in CUBE_FACES) {
_loop(face);
}
for (face in CUBE_FACES) {
_loop(face);
}
_context.next = 7;
return _regeneratorRuntime.awrap(Promise.all(promises));
_context.next = 7;
return Promise.all(promises);
case 7:
return _context.abrupt("return", urls);
case 7:
return _context.abrupt("return", urls);
case 8:
case "end":
return _context.stop();
}
case 8:
case "end":
return _context.stop();
}
}, _callee);
}));
return _getImageCubeUrls.apply(this, arguments);
}
});
}
export function loadImageCube(getUrl) {
var options,
urls,
_args2 = arguments;
return _regeneratorRuntime.async(function loadImageCube$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
_context2.next = 3;
return _regeneratorRuntime.awrap(getImageCubeUrls(getUrl, options));
export function loadImageCube(_x3) {
return _loadImageCube.apply(this, arguments);
}
case 3:
urls = _context2.sent;
_context2.next = 6;
return _regeneratorRuntime.awrap(deepLoad(urls, parseImage, options));
function _loadImageCube() {
_loadImageCube = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(getUrl) {
var options,
urls,
_args2 = arguments;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
_context2.next = 3;
return getImageCubeUrls(getUrl, options);
case 6:
return _context2.abrupt("return", _context2.sent);
case 3:
urls = _context2.sent;
_context2.next = 6;
return deepLoad(urls, parseImage, options);
case 6:
return _context2.abrupt("return", _context2.sent);
case 7:
case "end":
return _context2.stop();
}
case 7:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _loadImageCube.apply(this, arguments);
}
});
}
//# sourceMappingURL=load-image-cube.js.map
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

@@ -14,136 +13,114 @@ import assert from '../utils/assert';

import { deepLoad, shallowLoad } from './deep-load';
export function loadImage(_x) {
return _loadImage.apply(this, arguments);
}
export function loadImage(getUrl) {
var options,
imageUrls,
_args = arguments;
return _regeneratorRuntime.async(function loadImage$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
_context.next = 3;
return _regeneratorRuntime.awrap(getImageUrls(getUrl, options));
function _loadImage() {
_loadImage = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(getUrl) {
var options,
imageUrls,
_args = arguments;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
_context.next = 3;
return getImageUrls(getUrl, options);
case 3:
imageUrls = _context.sent;
_context.next = 6;
return _regeneratorRuntime.awrap(deepLoad(imageUrls, parseImage, options));
case 3:
imageUrls = _context.sent;
_context.next = 6;
return deepLoad(imageUrls, parseImage, options);
case 6:
return _context.abrupt("return", _context.sent);
case 6:
return _context.abrupt("return", _context.sent);
case 7:
case "end":
return _context.stop();
}
case 7:
case "end":
return _context.stop();
}
}, _callee);
}));
return _loadImage.apply(this, arguments);
}
});
}
export function getImageUrls(getUrl, options) {
var urlOptions,
mipLevels,
_args2 = arguments;
return _regeneratorRuntime.async(function getImageUrls$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
urlOptions = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
mipLevels = options && options.image && options.image.mipLevels || 0;
export function getImageUrls(_x2, _x3) {
return _getImageUrls.apply(this, arguments);
}
if (!(mipLevels !== 0)) {
_context2.next = 8;
break;
}
function _getImageUrls() {
_getImageUrls = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(getUrl, options) {
var urlOptions,
mipLevels,
_args2 = arguments;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
urlOptions = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
mipLevels = options && options.image && options.image.mipLevels || 0;
_context2.next = 5;
return _regeneratorRuntime.awrap(getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions));
if (!(mipLevels !== 0)) {
_context2.next = 8;
break;
}
case 5:
_context2.t0 = _context2.sent;
_context2.next = 9;
break;
_context2.next = 5;
return getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions);
case 8:
_context2.t0 = generateUrl(getUrl, options, urlOptions);
case 5:
_context2.t0 = _context2.sent;
_context2.next = 9;
break;
case 9:
return _context2.abrupt("return", _context2.t0);
case 8:
_context2.t0 = generateUrl(getUrl, options, urlOptions);
case 9:
return _context2.abrupt("return", _context2.t0);
case 10:
case "end":
return _context2.stop();
}
case 10:
case "end":
return _context2.stop();
}
}, _callee2);
}));
return _getImageUrls.apply(this, arguments);
}
});
}
function getMipmappedImageUrls(_x4, _x5, _x6, _x7) {
return _getMipmappedImageUrls.apply(this, arguments);
}
function getMipmappedImageUrls(getUrl, mipLevels, options, urlOptions) {
var urls, url, image, _getImageSize, width, height, mipLevel, _url;
function _getMipmappedImageUrls() {
_getMipmappedImageUrls = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(getUrl, mipLevels, options, urlOptions) {
var urls, url, image, _getImageSize, width, height, mipLevel, _url;
return _regeneratorRuntime.async(function getMipmappedImageUrls$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
urls = [];
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
urls = [];
if (!(mipLevels === 'auto')) {
_context3.next = 9;
break;
}
if (!(mipLevels === 'auto')) {
_context3.next = 9;
break;
}
url = generateUrl(getUrl, options, _objectSpread({}, urlOptions, {
lod: 0
}));
_context3.next = 5;
return _regeneratorRuntime.awrap(shallowLoad(url, parseImage, options));
url = generateUrl(getUrl, options, _objectSpread({}, urlOptions, {
lod: 0
}));
_context3.next = 5;
return shallowLoad(url, parseImage, options);
case 5:
image = _context3.sent;
_getImageSize = getImageSize(image), width = _getImageSize.width, height = _getImageSize.height;
mipLevels = getMipLevels({
width: width,
height: height
});
urls.push(url);
case 5:
image = _context3.sent;
_getImageSize = getImageSize(image), width = _getImageSize.width, height = _getImageSize.height;
mipLevels = getMipLevels({
width: width,
height: height
});
urls.push(url);
case 9:
assert(mipLevels > 0);
case 9:
assert(mipLevels > 0);
for (mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
_url = generateUrl(getUrl, options, _objectSpread({}, urlOptions, {
lod: mipLevel
}));
urls.push(_url);
}
for (mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
_url = generateUrl(getUrl, options, _objectSpread({}, urlOptions, {
lod: mipLevel
}));
urls.push(_url);
}
return _context3.abrupt("return", urls);
return _context3.abrupt("return", urls);
case 12:
case "end":
return _context3.stop();
}
case 12:
case "end":
return _context3.stop();
}
}, _callee3);
}));
return _getMipmappedImageUrls.apply(this, arguments);
}
});
}

@@ -150,0 +127,0 @@

{
"name": "@loaders.gl/images",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.3",
"description": "Framework-independent loaders and writers for images (PNG, JPG, ...)",

@@ -35,3 +35,3 @@ "license": "MIT",

},
"gitHead": "d6dcb340fb885a48d968029d53d521fa7aeb036e"
"gitHead": "94e3a75727664a5dfd8c4f151d613c6a12679922"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc