(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 Jt=Object.create;var k=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var qt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,eo=Object.prototype.hasOwnProperty;var we=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),to=(e,t)=>{for(var o in t)k(e,o,{get:t[o],enumerable:!0})},v=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of qt(t))!eo.call(e,s)&&s!==o&&k(e,s,{get:()=>t[s],enumerable:!(r=Zt(t,s))||r.enumerable});return e},W=(e,t,o)=>(v(e,t,"default"),o&&v(o,t,"default")),se=(e,t,o)=>(o=e!=null?Jt(Qt(e)):{},v(t||!e||!e.__esModule?k(o,"default",{value:e,enumerable:!0}):o,e)),oo=e=>v(k({},"__esModule",{value:!0}),e);var He=we((yr,be)=>{be.exports=globalThis.loaders});var Re=we(()=>{});var V={};to(V,{BASIS_EXTERNAL_LIBRARIES:()=>F,BasisLoader:()=>st,BasisWorkerLoader:()=>ue,CRUNCH_EXTERNAL_LIBRARIES:()=>ut,CompressedTextureLoader:()=>Tt,CompressedTextureWorkerLoader:()=>me,CompressedTextureWriter:()=>Ot,CrunchLoader:()=>Oe,CrunchWorkerLoader:()=>Oe,GL_EXTENSIONS_CONSTANTS:()=>n,KTX2BasisWriter:()=>Ct,KTX2BasisWriterWorker:()=>Ur,NPYLoader:()=>Et,NPYWorkerLoader:()=>de,getSupportedGPUTextureFormats:()=>Y,loadImageTexture:()=>Lt,loadImageTextureArray:()=>It,loadImageTextureCube:()=>Nt,selectSupportedBasisFormat:()=>Ee});W(V,se(He(),1));var f="4.3.1";function p(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var C={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ro=C.self||C.window||C.global||{},no=C.window||C.self||C.global||{},so=C.global||C.self||C.window||{},_o=C.document||{};var _e=Boolean(typeof process!="object"||String(process)!=="[object process]"||process.browser);var Ve=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),ao=Ve&&parseFloat(Ve[1])||0;function ae(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function ie(e){return globalThis.loaders?.modules?.[e]||null}function io(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.3.1"),globalThis._loadersgl_.version}var Xe=io();function ve(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}var d={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},kr=d.self||d.window||d.global||{},Wr=d.window||d.self||d.global||{},zr=d.global||d.self||d.window||{},$r=d.document||{};var P=typeof process!="object"||String(process)!=="[object process]"||process.browser,z=typeof importScripts=="function",Yr=typeof window<"u"&&typeof window.orientation<"u",ke=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),jr=ke&&parseFloat(ke[1])||0;var ce={};async function h(e,t=null,o={},r=null){return t&&(e=We(e,t,o,r)),ce[e]=ce[e]||co(e),await ce[e]}function We(e,t,o={},r=null){if(!o.useLocalLibraries&&e.startsWith("http"))return e;r=r||e;let s=o.modules||{};return s[r]?s[r]:P?o.CDN?(ve(o.CDN.startsWith("http")),`${o.CDN}/${t}@${Xe}/dist/libs/${r}`):z?`../src/libs/${r}`:`modules/${t}/src/libs/${r}`:`modules/${t}/dist/libs/${r}`}async function co(e){if(e.endsWith("wasm"))return await So(e);if(!P)try{let{requireFromFile:o}=globalThis.loaders||{};return await o?.(e)}catch(o){return console.error(o),null}if(z)return importScripts(e);let t=await lo(e);return Ro(t,e)}function Ro(e,t){if(!P){let{requireFromString:r}=globalThis.loaders||{};return r?.(e,t)}if(z)return eval.call(globalThis,e),null;let o=document.createElement("script");o.id=t;try{o.appendChild(document.createTextNode(e))}catch{o.text=e}return document.body.appendChild(o),null}async function So(e){let{readFileAsArrayBuffer:t}=globalThis.loaders||{};return P||!t||e.startsWith("http")?await(await fetch(e)).arrayBuffer():await t(e)}async function lo(e){let{readFileAsText:t}=globalThis.loaders||{};return P||!t||e.startsWith("http")?await(await fetch(e)).text():await t(e)}var je=se(Re(),1);var ze=se(Re(),1);function $e(e=3e3){return new Promise(t=>{ze.default.exec("lsof -i -P -n | grep LISTEN",(o,r)=>{if(o){t(e);return}let s=[],_=/:(\d+) \(LISTEN\)/;r.split(` `).forEach(i=>{let c=_.exec(i);c&&s.push(Number(c[1]))});let a=e;for(;s.includes(a);)a++;t(a)})})}var Ye={command:"",arguments:[],port:5e3,autoPort:!0,wait:2e3,onSuccess:e=>{console.log(`Started ${e.props.command}`)}},K=class{id;props={...Ye};childProcess=null;port=0;successTimer;constructor({id:t="browser-driver"}={}){this.id=t}async start(t){t={...Ye,...t},this.props=t;let o=[...t.arguments];return this.port=Number(t.port),t.portArg&&(t.autoPort&&(this.port=await $e(t.port)),o.push(t.portArg,String(this.port))),await new Promise((r,s)=>{try{this._setTimeout(()=>{t.onSuccess&&t.onSuccess(this),r({})}),console.log(`Spawning ${t.command} ${t.arguments.join(" ")}`);let _=(void 0)(t.command,o,t.spawn);this.childProcess=_,_.stdout.on("data",a=>{console.log(a.toString())}),_.stderr.on("data",a=>{console.log(`Child process wrote to stderr: "${a}".`),t.ignoreStderr||(this._clearTimeout(),s(new Error(a)))}),_.on("error",a=>{console.log(`Child process errored with ${a}`),this._clearTimeout(),s(a)}),_.on("close",a=>{console.log(`Child process exited with ${a}`),this.childProcess=null,this._clearTimeout(),r({})})}catch(_){s(_)}})}async stop(){this.childProcess&&(this.childProcess.kill(),this.childProcess=null)}async exit(t=0){try{await this.stop(),process.exit(t)}catch(o){console.error(o.message||o),process.exit(1)}}_setTimeout(t){Number(this.props.wait)>0&&(this.successTimer=setTimeout(t,this.props.wait))}_clearTimeout(){this.successTimer&&clearTimeout(this.successTimer)}};var Ao="",Je={};function Se(e){for(let t in Je)if(e.startsWith(t)){let o=Je[t];e=e.replace(t,o)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${Ao}${e}`),e}var F={TRANSCODER:"basis_transcoder.js",TRANSCODER_WASM:"basis_transcoder.wasm",ENCODER:"basis_encoder.js",ENCODER_WASM:"basis_encoder.wasm"},Ze;async function Ae(e){ae(e.modules);let t=ie("basis");return t||(Ze||=To(e),await Ze)}async function To(e){let t=null,o=null;return[t,o]=await Promise.all([await h(F.TRANSCODER,"textures",e),await h(F.TRANSCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await fo(t,o)}function fo(e,t){let o={};return t&&(o.wasmBinary=t),new Promise(r=>{e(o).then(s=>{let{BasisFile:_,initializeBasis:a}=s;a(),r({BasisFile:_})})})}var le;async function U(e){let t=e.modules||{};return t.basisEncoder?t.basisEncoder:(le=le||Eo(e),await le)}async function Eo(e){let t=null,o=null;return[t,o]=await Promise.all([await h(F.ENCODER,"textures",e),await h(F.ENCODER_WASM,"textures",e)]),t=t||globalThis.BASIS,await uo(t,o)}function uo(e,t){let o={};return t&&(o.wasmBinary=t),new Promise(r=>{e(o).then(s=>{let{BasisFile:_,KTX2File:a,initializeBasis:i,BasisEncoder:c}=s;i(),r({BasisFile:_,KTX2File:a,BasisEncoder:c})})})}var n={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919};var mo=["","WEBKIT_","MOZ_"],qe={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"},$=null;function Y(e){if(!$){e=e||Oo()||void 0,$=new Set;for(let t of mo)for(let o in qe)if(e&&e.getExtension(`${t}${o}`)){let r=qe[o];$.add(r)}}return $}function Oo(){try{return document.createElement("canvas").getContext("webgl")}catch{return null}}var Te=class{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}},g=class{constructor(t,o,r,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+o,r),this._littleEndian=s,this._offset=0}_nextUint8(){let t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){let t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){let t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){let t=this._dataView.getUint32(this._offset,this._littleEndian),o=this._dataView.getUint32(this._offset+4,this._littleEndian),r=t+2**32*o;return this._offset+=8,r}_nextInt32(){let t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){let o=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,o}_skip(t){return this._offset+=t,this}_scan(t,o=0){let r=this._offset,s=0;for(;this._dataView.getUint8(this._offset)!==o&&s>1),s=Math.max(1,s>>1),_+=i}return o}function po(e,t,o,r){return Array.isArray(e)?e[t].levelData:new Uint8Array(e.buffer,e.byteOffset+o,r)}function Co(e,t,o,r,s){return Array.isArray(r)?e.sizeFunction(r[s]):e.sizeFunction(t,o)}var Mo={131:n.COMPRESSED_RGB_S3TC_DXT1_EXT,132:n.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:n.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:n.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:n.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:n.COMPRESSED_RED_RGTC1_EXT,140:n.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:n.COMPRESSED_RED_GREEN_RGTC2_EXT,142:n.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:n.COMPRESSED_RGB8_ETC2,148:n.COMPRESSED_SRGB8_ETC2,149:n.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:n.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:n.COMPRESSED_RGBA8_ETC2_EAC,152:n.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:n.COMPRESSED_R11_EAC,154:n.COMPRESSED_SIGNED_R11_EAC,155:n.COMPRESSED_RG11_EAC,156:n.COMPRESSED_SIGNED_RG11_EAC,157:n.COMPRESSED_RGBA_ASTC_4x4_KHR,158:n.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:n.COMPRESSED_RGBA_ASTC_5x4_KHR,160:n.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:n.COMPRESSED_RGBA_ASTC_5x5_KHR,162:n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:n.COMPRESSED_RGBA_ASTC_6x5_KHR,164:n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:n.COMPRESSED_RGBA_ASTC_6x6_KHR,166:n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:n.COMPRESSED_RGBA_ASTC_8x5_KHR,168:n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:n.COMPRESSED_RGBA_ASTC_8x6_KHR,170:n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:n.COMPRESSED_RGBA_ASTC_8x8_KHR,172:n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:n.COMPRESSED_RGBA_ASTC_10x5_KHR,174:n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:n.COMPRESSED_RGBA_ASTC_10x6_KHR,176:n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:n.COMPRESSED_RGBA_ASTC_10x8_KHR,178:n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:n.COMPRESSED_RGBA_ASTC_10x10_KHR,180:n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:n.COMPRESSED_RGBA_ASTC_12x10_KHR,182:n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:n.COMPRESSED_RGBA_ASTC_12x12_KHR,184:n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:n.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:n.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:n.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:n.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:n.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:n.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:n.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:n.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:n.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:n.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:n.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:n.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:n.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:n.COMPRESSED_RGBA_ASTC_12x12_KHR};function tt(e){return Mo[e]}var E=[171,75,84,88,32,50,48,187,13,10,26,10];function j(e){let t=new Uint8Array(e);return!(t.byteLengthi.uncompressedByteLength,internalFormat:a})}var xo={etc1:{basisFormat:0,compressed:!0,format:n.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:n.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:!0,format:n.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},"astc-4x4":{basisFormat:10,compressed:!0,format:n.COMPRESSED_RGBA_ASTC_4X4_KHR},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};async function J(e,t){if(t.basis.containerFormat==="auto"){if(j(e)){let r=await U(t);return rt(r.KTX2File,e,t)}let{BasisFile:o}=await Ae(t);return fe(o,e,t)}switch(t.basis.module){case"encoder":let o=await U(t);switch(t.basis.containerFormat){case"ktx2":return rt(o.KTX2File,e,t);case"basis":default:return fe(o.BasisFile,e,t)}case"transcoder":default:let{BasisFile:r}=await Ae(t);return fe(r,e,t)}}function fe(e,t,o){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("Failed to start basis transcoding");let s=r.getNumImages(),_=[];for(let a=0;a>2)*(t+3>>2)*8}function Z(e,t){return(e+3>>2)*(t+3>>2)*16}function Go(e){return String.fromCharCode(e&255,e>>8&255,e>>16&255,e>>24&255)}var O={MAGIC_NUMBER:55727696,MAGIC_NUMBER_EXTRA:1347834371,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,COLOUR_SPACE_INDEX:4,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12},Lo={0:[n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[n.COMPRESSED_RGB_ETC1_WEBGL],7:[n.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[n.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[n.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[n.COMPRESSED_RGB8_ETC2],23:[n.COMPRESSED_RGBA8_ETC2_EAC],24:[n.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[n.COMPRESSED_R11_EAC],26:[n.COMPRESSED_RG11_EAC],27:[n.COMPRESSED_RGBA_ASTC_4X4_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[n.COMPRESSED_RGBA_ASTC_5X4_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[n.COMPRESSED_RGBA_ASTC_5X5_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[n.COMPRESSED_RGBA_ASTC_6X5_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[n.COMPRESSED_RGBA_ASTC_6X6_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[n.COMPRESSED_RGBA_ASTC_8X5_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[n.COMPRESSED_RGBA_ASTC_8X6_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[n.COMPRESSED_RGBA_ASTC_8X8_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[n.COMPRESSED_RGBA_ASTC_10X5_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[n.COMPRESSED_RGBA_ASTC_10X6_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[n.COMPRESSED_RGBA_ASTC_10X8_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[n.COMPRESSED_RGBA_ASTC_10X10_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[n.COMPRESSED_RGBA_ASTC_12X10_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[n.COMPRESSED_RGBA_ASTC_12X12_KHR,n.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},Io={0:ct,1:ct,2:Rt,3:Rt,6:N,7:N,9:y,11:y,22:N,23:y,24:N,25:N,26:y,27:y,28:Uo,29:No,30:yo,31:wo,32:bo,33:Ho,34:Vo,35:Xo,36:vo,37:ko,38:Wo,39:zo,40:$o};function St(e){let o=new Uint32Array(e,0,O.HEADER_LENGTH)[O.MAGIC_NUMBER_INDEX];return o===O.MAGIC_NUMBER||o===O.MAGIC_NUMBER_EXTRA}function lt(e){let t=new Uint32Array(e,0,O.HEADER_LENGTH),o=t[O.PIXEL_FORMAT_INDEX],r=t[O.COLOUR_SPACE_INDEX],s=Lo[o]||[],_=s.length>1&&r?s[1]:s[0],a=Io[o],i=t[O.MIPMAPCOUNT_INDEX],c=t[O.WIDTH_INDEX],S=t[O.HEIGHT_INDEX],A=O.HEADER_SIZE+t[O.METADATA_SIZE_INDEX],x=new Uint8Array(e,A);return G(x,{mipMapLevels:i,width:c,height:S,sizeFunction:a,internalFormat:_})}function ct(e,t){return e=Math.max(e,16),t=Math.max(t,8),e*t/4}function Rt(e,t){return e=Math.max(e,8),t=Math.max(t,8),e*t/2}function N(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8}function y(e,t){return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16}function Uo(e,t){return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16}function No(e,t){return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16}function yo(e,t){return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16}function wo(e,t){return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16}function bo(e,t){return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16}function Ho(e,t){return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16}function Vo(e,t){return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16}function Xo(e,t){return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16}function vo(e,t){return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16}function ko(e,t){return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16}function Wo(e,t){return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16}function zo(e,t){return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16}function $o(e,t){return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16}function At(e){if(j(e))return ot(e);if(_t(e))return at(e);if(St(e))return lt(e);throw new Error("Texture container format not recognized")}var me={dataType:null,batchType:null,name:"Texture Containers",id:"compressed-texture",module:"textures",version:f,worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/",useBasis:!1}}},Tt={...me,parse:async(e,t)=>t?.["compressed-texture"]?.useBasis?(t.basis={format:{alpha:"BC3",noAlpha:"BC1"},...t.basis,containerFormat:"ktx2",module:"encoder"},(await J(e,t))[0]):At(e)};var Oe={dataType:null,batchType:null,id:"crunch",name:"Crunch",module:"textures",version:f,worker:!0,extensions:["crn"],mimeTypes:["image/crn","image/x-crn","application/octet-stream"],binary:!0,options:{crunch:{libraryPath:"libs/"}}};var pe=new Uint32Array([305419896]),Yo=new Uint8Array(pe.buffer,pe.byteOffset,pe.byteLength),jo=Yo[0]!==18,ft=jo,Jo={u1:Uint8Array,i1:Int8Array,u2:Uint16Array,i2:Int16Array,u4:Uint32Array,i4:Int32Array,f4:Float32Array,f8:Float64Array};function Ce(e,t){let o=new DataView(e),{header:r,headerEndOffset:s}=Zo(o),_=r.descr,a=Jo[_.slice(1,3)];if(!a)throw new Error(`Unimplemented type ${_}`);let c=r.shape?.reduce((A,x)=>A*x)*a.BYTES_PER_ELEMENT;if(e.byteLength"&&ft||_[0]==="<"&&!ft)throw new Error("Incorrect endianness");return{data:S,header:r}}function Zo(e){let t=e.getUint8(6),o=8,r;t>=2?(r=e.getUint32(o,!0),o+=4):(r=e.getUint16(o,!0),o+=2);let s=t<=2?"latin1":"utf-8",_=new TextDecoder(s),a=new Uint8Array(e.buffer,o,r),i=_.decode(a);return o+=r,{header:JSON.parse(i.replace(/'/g,'"').replace("False","false").replace("(","[").replace(/,*\),*/g,"]")),headerEndOffset:o}}var qo=new Uint8Array([147,78,85,77,80,89]),de={dataType:null,batchType:null,name:"NPY",id:"npy",module:"textures",version:f,worker:!0,extensions:["npy"],mimeTypes:[],tests:[qo.buffer],options:{npy:{}}},Et={...de,parseSync:Ce,parse:async(e,t)=>Ce(e,t)};var ut={DECODER:"crunch.js"};async function mt(e,t,o){let r=["texture-compressor","--type","s3tc","--compression","DXT1","--quality","normal","--input",e,"--output",t];return await new K().start({command:"npx",arguments:r,spawn:o}),t}var Ot={name:"DDS Texture Container",id:"dds",module:"textures",version:f,extensions:["dds"],options:{texture:{format:"auto",compression:"auto",quality:"auto",mipmap:!1,flipY:!1,toolFlags:""}},encodeURLtoURL:mt,encode(){throw new Error("Not implemented")}};async function pt(e,t={}){let{useSRGB:o=!1,qualityLevel:r=10,encodeUASTC:s=!1,mipmaps:_=!1}=t?.["ktx2-basis-writer"]||{},{BasisEncoder:a}=await U(t),i=new a;try{let c=new Uint8Array(e.width*e.height*4);i.setCreateKTX2File(!0),i.setKTX2UASTCSupercompression(!0),i.setKTX2SRGBTransferFunc(!0),i.setSliceSourceImage(0,e.data,e.width,e.height,!1),i.setPerceptual(o),i.setMipSRGB(o),i.setQualityLevel(r),i.setUASTC(s),i.setMipGen(_);let S=i.encode(c);return c.subarray(0,S).buffer}catch(c){throw console.error("Basis Universal Supercompressed GPU Texture encoder Error: ",c),c}finally{i.delete()}}var Ct={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:f,extensions:["ktx2"],options:{["ktx2-basis-writer"]:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}},encode:pt};var dt="4.3.1";var Qo=globalThis.loaders?.parseImageNode,Me=typeof Image<"u",xe=typeof ImageBitmap<"u",er=Boolean(Qo),Be=_e?!0:er;function Mt(e){switch(e){case"auto":return xe||Me||Be;case"imagebitmap":return xe;case"image":return Me;case"data":return Be;default:throw new Error(`@loaders.gl/images: image ${e} not supported in this environment`)}}function xt(){if(xe)return"imagebitmap";if(Me)return"image";if(Be)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}function Bt(e){let t=tr(e);if(!t)throw new Error("Not an image");return t}function De(e){return q(e)}function q(e){switch(Bt(e)){case"data":return e;case"image":case"imagebitmap":let t=document.createElement("canvas"),o=t.getContext("2d");if(!o)throw new Error("getImageData");return t.width=e.width,t.height=e.height,o.drawImage(e,0,0),o.getImageData(0,0,e.width,e.height);default:throw new Error("getImageData")}}function tr(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 or=/^data:image\/svg\+xml/,rr=/\.svg((\?|#).*)?$/;function Q(e){return e&&(or.test(e)||rr.test(e))}function Dt(e,t){if(Q(t)){let r=new TextDecoder().decode(e);try{typeof unescape=="function"&&typeof encodeURIComponent=="function"&&(r=unescape(encodeURIComponent(r)))}catch(_){throw new Error(_.message)}return`data:image/svg+xml;base64,${btoa(r)}`}return ge(e,t)}function ge(e,t){if(Q(t))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(e)])}async function ee(e,t,o){let r=Dt(e,o),s=self.URL||self.webkitURL,_=typeof r!="string"&&s.createObjectURL(r);try{return await nr(_||r,t)}finally{_&&s.revokeObjectURL(_)}}async function nr(e,t){let o=new Image;return o.src=e,t.image&&t.image.decode&&o.decode?(await o.decode(),o):await new Promise((r,s)=>{try{o.onload=()=>r(o),o.onerror=_=>{let a=_ instanceof Error?_.message:"error";s(new Error(a))}}catch(_){s(_)}})}var sr={},gt=!0;async function Pt(e,t,o){let r;Q(o)?r=await ee(e,t,o):r=ge(e,o);let s=t&&t.imagebitmap;return await _r(r,s)}async function _r(e,t=null){if((ar(t)||!gt)&&(t=null),t)try{return await createImageBitmap(e,t)}catch(o){console.warn(o),gt=!1}return await createImageBitmap(e)}function ar(e){for(let t in e||sr)return!1;return!0}function ht(e){return!Sr(e,"ftyp",4)||!(e[8]&96)?null:ir(e)}function ir(e){switch(cr(e,8,12).replace("\0"," ").trim()){case"avif":case"avis":return{extension:"avif",mimeType:"image/avif"};default:return null}}function cr(e,t,o){return String.fromCharCode(...e.slice(t,o))}function Rr(e){return[...e].map(t=>t.charCodeAt(0))}function Sr(e,t,o=0){let r=Rr(t);for(let s=0;s=24&&t.getUint32(0,M)===2303741511?{mimeType:"image/png",width:t.getUint32(16,M),height:t.getUint32(20,M)}:null}function Tr(e){let t=b(e);return t.byteLength>=10&&t.getUint32(0,M)===1195984440?{mimeType:"image/gif",width:t.getUint16(6,w),height:t.getUint16(8,w)}:null}function fr(e){let t=b(e);return t.byteLength>=14&&t.getUint16(0,M)===16973&&t.getUint32(2,w)===t.byteLength?{mimeType:"image/bmp",width:t.getUint32(18,w),height:t.getUint32(22,w)}:null}function Er(e){let t=b(e);if(!(t.byteLength>=3&&t.getUint16(0,M)===65496&&t.getUint8(2)===255))return null;let{tableMarkers:r,sofMarkers:s}=ur(),_=2;for(;_+9Boolean(te(new DataView(e)))],options:Cr};function oe(e,t,o){let r=typeof e=="function"?e({...t,...o}):e,s=t.baseUrl;return s&&(r=s[s.length-1]==="/"?`${s}${r}`:`${s}/${r}`),Se(r)}var dr=e=>e&&typeof e=="object";async function Gt(e,t,o={}){return await Pe(e,t,o)}async function Pe(e,t,o){return Array.isArray(e)?await xr(e,t,o):dr(e)?await Mr(e,t,o):await t(e,o)}async function Mr(e,t,o){let r=[],s={};for(let _ in e){let a=e[_],i=Pe(a,t,o).then(c=>{s[_]=c});r.push(i)}return await Promise.all(r),s}async function xr(e,t,o={}){let r=e.map(s=>Pe(s,t,o));return await Promise.all(r)}async function L(e,t,o){return await Gt(e,r=>he(r,t,o))}async function he(e,t,o){let s=await(await fetch(e,o.fetch)).arrayBuffer();return await t(s,o)}async function Lt(e,t={}){let o=await H(e,t);return await L(o,D.parse,t)}async function H(e,t,o={}){let r=t&&t.image&&t.image.mipLevels||0;return r!==0?await Br(e,r,t,o):oe(e,t,o)}async function Br(e,t,o,r){let s=[];if(t==="auto"){let _=oe(e,o,{...r,lod:0}),a=await he(_,D.parse,o),{width:i,height:c}=De(a);t=Dr({width:i,height:c}),s.push(_)}p(t>0);for(let _=s.length;_{o[a.face]=c});r.push(i)}return await Promise.all(r),o}async function Nt(e,t={}){let o=await Ir(e,t);return await L(o,D.parse,t)}var Ur={name:"Basis Universal Supercompressed GPU Texture",id:"ktx2-basis-writer",module:"textures",version:f,extensions:["ktx2"],worker:!0,options:{useSRGB:!1,qualityLevel:10,encodeUASTC:!1,mipmaps:!1}};return oo(V);})(); return __exports__; });