(function webpackUniversalModuleDefinition(root, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if (typeof define === 'function' && define.amd) define([], factory); else if (typeof exports === 'object') exports['loaders'] = factory(); else root['loaders'] = factory();})(globalThis, function () { "use strict";var __exports__=(()=>{var q=Object.create;var x=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty;var ae=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ne=(e,t)=>{for(var r in t)x(e,r,{get:t[r],enumerable:!0})},w=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of te(t))!oe.call(e,a)&&a!==r&&x(e,a,{get:()=>t[a],enumerable:!(o=ee(t,a))||o.enumerable});return e},I=(e,t,r)=>(w(e,t,"default"),r&&w(r,t,"default")),ie=(e,t,r)=>(r=e!=null?q(re(e)):{},w(t||!e||!e.__esModule?x(r,"default",{value:e,enumerable:!0}):r,e)),se=e=>w(x({},"__esModule",{value:!0}),e);var k=ae((Ye,V)=>{V.exports=globalThis.loaders});var l={};ne(l,{ImageLoader:()=>J,ImageWriter:()=>Z,getBinaryImageMetadata:()=>g,getDefaultImageType:()=>B,getImageData:()=>d,getImageSize:()=>b,getImageType:()=>F,getSupportedImageFormats:()=>z,isImage:()=>v,isImageFormatSupported:()=>H,isImageTypeSupported:()=>h,loadImage:()=>We});I(l,ie(k(),1));var y="4.3.1";function p(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var s={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},me=s.self||s.window||s.global||{},fe=s.window||s.self||s.global||{},ce=s.global||s.self||s.window||{},ge=s.document||{};var c=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var O=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),pe=O&&parseFloat(O[1])||0;var de=globalThis.loaders?.parseImageNode,E=typeof Image<"u",D=typeof ImageBitmap<"u",Ae=Boolean(de),U=c?!0:Ae;function h(e){switch(e){case"auto":return D||E||U;case"imagebitmap":return D;case"image":return E;case"data":return U;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function B(){if(D)return"imagebitmap";if(E)return"image";if(U)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function v(e){return Boolean(L(e))}function F(e){let t=L(e);if(!t)throw new Error("Not an image");return t}function b(e){return d(e)}function d(e){switch(F(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),r=t.getContext("2d");if(!r)throw new Error("getImageData");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0),r.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function L(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap?"imagebitmap":typeof Image<"u"&&e instanceof Image?"image":e&&typeof e=="object"&&e.data&&e.width&&e.height?"data":null}var ue=/^data:image\/svg\+xml/,le=/\.svg((\?|#).*)?$/;function T(e){return e&&(ue.test(e)||le.test(e))}function R(e,t){if(T(t)){let o=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(o=unescape(encodeURIComponent(o)))}catch(n){throw new Error(n.message)}return`data:image/svg+xml;base64,${btoa(o)}`}return M(e,t)}function M(e,t){if(T(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function S(e,t,r){let o=R(e,r),a=self.URL||self.webkitURL,n=typeof o!="string"&&a.createObjectURL(o);try{return await we(n||o,t)}finally{n&&a.revokeObjectURL(n)}}async function we(e,t){let r=new Image;return r.src=e,t.image&&t.image.decode&&r.decode?(await r.decode(),r):await new Promise((o,a)=>{try{r.onload=()=>o(r),r.onerror=n=>{let i=n instanceof Error?n.message:"error";a(new Error(i))}}catch(n){a(n)}})}var xe={},_=!0;async function G(e,t,r){let o;T(r)?o=await S(e,t,r):o=M(e,r);let a=t&&t.imagebitmap;return await Ie(o,a)}async function Ie(e,t=null){if((ye(t)||!_)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(r){console.warn(r),_=!1}return await createImageBitmap(e)}function ye(e){for(let t in e||xe)return!1;return!0}function j(e){return!Te(e,"ftyp",4)||!(e[8]&96)?null:he(e)}function he(e){switch(Be(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function Be(e,t,r){return String.fromCharCode(...e.slice(t,r))}function be(e){return[...e].map(t=>t.charCodeAt(0))}function Te(e,t,r=0){let o=be(t);for(let a=0;a=24&&t.getUint32(0,m)===2303741511?{mimeType:"image/png",width:t.getUint32(16,m),height:t.getUint32(20,m)}:null}function De(e){let t=u(e);return t.byteLength>=10&&t.getUint32(0,m)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,A),height:t.getUint16(8,A)}:null}function Ue(e){let t=u(e);return t.byteLength>=14&&t.getUint16(0,m)===16973&&t.getUint32(2,A)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,A),height:t.getUint32(22,A)}:null}function Fe(e){let t=u(e);if(!(t.byteLength>=3&&t.getUint16(0,m)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:o,sofMarkers:a}=Me(),n=2;for(;n+9Boolean(g(new DataView(e)))],options:ke};var Q=globalThis.loaders?.encodeImageNode;async function X(e,t){return t=t||{},t.image=t.image||{},Q?Q(e,{type:t.image.mimeType}):Oe(e,t)}var Y=!0;async function Oe(e,t){let{mimeType:r,jpegQuality:o}=t.image,{width:a,height:n}=b(e),i=document.createElement("canvas");i.width=a,i.height=n,ve(e,i);let f=await new Promise(P=>{if(o&&Y)try{i.toBlob(P,r,o);return}catch{Y=!1}i.toBlob(P,r)});if(!f)throw new Error("image encoding failed");return await f.arrayBuffer()}function ve(e,t,r=0,o=0){if(r===0&&o===0&&typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let n=t.getContext("bitmaprenderer");if(n)return n.transferFromImageBitmap(e),t}let a=t.getContext("2d");if(e.data){let n=new Uint8ClampedArray(e.data),i=new ImageData(n,e.width,e.height);return a.putImageData(i,0,0),t}return a.drawImage(e,0,0),t}var Z={name:"Images",id:"image",module:"images",version:y,extensions:["jpeg"],options:{image:{mimeType:"image/png",jpegQuality:null}},encode:X};var Le=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/tiff","image/svg","image/svg+xml","image/bmp","image/vnd.microsoft.icon"],$=null;async function z(){if($)return await $;let e=new Set;for(let t of Le)(c?await Ge(t):K(t))&&e.add(t);return e}var N={};function H(e){if(N[e]===void 0){let t=c?Re(e):K(e);N[e]=t}return N[e]}function K(e){let t=["image/png","image/jpeg","image/gif"],r=globalThis.loaders?.imageFormatsNode||t,o=globalThis.loaders?.parseImageNode;return Boolean(o)&&r.includes(e)}function Re(e){switch(e){case"image/avif":case"image/webp":return je(e);default:return!0}}var _e={"image/avif":"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=","image/webp":"data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"};async function Ge(e){let t=_e[e];return t?await Ce(t):!0}function je(e){try{return document.createElement("canvas").toDataURL(e).indexOf(`data:${e}`)===0}catch{return!1}}async function Ce(e){return new Promise(t=>{let r=new Image;r.src=e,r.onload=()=>t(r.height>0),r.onerror=()=>t(!1)})}function We(){throw new Error("loadImage has moved to @loaders.gl/textures")}return se(l);})(); return __exports__; });