@loaders.gl/textures
Advanced tools
Comparing version 4.3.0-beta.2 to 4.3.0-beta.3
@@ -24,3 +24,3 @@ "use strict"; | ||
} else { | ||
globalThis._loadersgl_.version = "4.3.0-beta.1"; | ||
globalThis._loadersgl_.version = "4.3.0-beta.2"; | ||
} | ||
@@ -345,3 +345,3 @@ } | ||
// src/lib/utils/version.ts | ||
var VERSION2 = true ? "4.3.0-beta.1" : "latest"; | ||
var VERSION2 = true ? "4.3.0-beta.2" : "latest"; | ||
@@ -348,0 +348,0 @@ // src/lib/parsers/basis-module-loader.ts |
@@ -31,3 +31,3 @@ "use strict"; | ||
} else { | ||
globalThis._loadersgl_.version = "4.3.0-beta.1"; | ||
globalThis._loadersgl_.version = "4.3.0-beta.2"; | ||
} | ||
@@ -352,3 +352,3 @@ } | ||
// src/lib/utils/version.ts | ||
var VERSION2 = true ? "4.3.0-beta.1" : "latest"; | ||
var VERSION2 = true ? "4.3.0-beta.2" : "latest"; | ||
@@ -355,0 +355,0 @@ // ../../node_modules/ktx-parse/dist/ktx-parse.modern.js |
@@ -31,3 +31,3 @@ "use strict"; | ||
} else { | ||
globalThis._loadersgl_.version = "4.3.0-beta.1"; | ||
globalThis._loadersgl_.version = "4.3.0-beta.2"; | ||
} | ||
@@ -352,3 +352,3 @@ } | ||
// src/lib/utils/version.ts | ||
var VERSION2 = true ? "4.3.0-beta.1" : "latest"; | ||
var VERSION2 = true ? "4.3.0-beta.2" : "latest"; | ||
@@ -355,0 +355,0 @@ // src/crunch-loader.ts |
@@ -7,5 +7,5 @@ (function webpackUniversalModuleDefinition(root, 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.0-beta.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.0-beta.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<t;)s++,this._offset++;return s<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}};var gn=new Uint8Array([0]),l=[171,75,84,88,32,50,48,187,13,10,26,10];function Qe(e){return new TextDecoder().decode(e)}function et(e){let t=new Uint8Array(e.buffer,e.byteOffset,l.length);if(t[0]!==l[0]||t[1]!==l[1]||t[2]!==l[2]||t[3]!==l[3]||t[4]!==l[4]||t[5]!==l[5]||t[6]!==l[6]||t[7]!==l[7]||t[8]!==l[8]||t[9]!==l[9]||t[10]!==l[10]||t[11]!==l[11])throw new Error("Missing KTX 2.0 identifier.");let o=new Te,r=17*Uint32Array.BYTES_PER_ELEMENT,s=new g(e,l.length,r,!0);o.vkFormat=s._nextUint32(),o.typeSize=s._nextUint32(),o.pixelWidth=s._nextUint32(),o.pixelHeight=s._nextUint32(),o.pixelDepth=s._nextUint32(),o.layerCount=s._nextUint32(),o.faceCount=s._nextUint32();let _=s._nextUint32();o.supercompressionScheme=s._nextUint32();let a=s._nextUint32(),i=s._nextUint32(),c=s._nextUint32(),S=s._nextUint32(),A=s._nextUint64(),x=s._nextUint64(),yt=_*3*8,re=new g(e,l.length+r,yt,!0);for(let T=0;T<_;T++)o.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+re._nextUint64(),re._nextUint64()),uncompressedByteLength:re._nextUint64()});let R=new g(e,a,i,!0),ne={vendorId:R._skip(4)._nextUint16(),descriptorType:R._nextUint16(),versionNumber:R._nextUint16(),descriptorBlockSize:R._nextUint16(),colorModel:R._nextUint8(),colorPrimaries:R._nextUint8(),transferFunction:R._nextUint8(),flags:R._nextUint8(),texelBlockDimension:[R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8()],bytesPlane:[R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8()],samples:[]},wt=6,bt=4,Ht=(ne.descriptorBlockSize/4-wt)/bt;for(let T=0;T<Ht;T++){let B={bitOffset:R._nextUint16(),bitLength:R._nextUint8(),channelType:R._nextUint8(),samplePosition:[R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};B.channelType&64?(B.sampleLower=R._nextInt32(),B.sampleUpper=R._nextInt32()):(B.sampleLower=R._nextUint32(),B.sampleUpper=R._nextUint32()),ne.samples[T]=B}o.dataFormatDescriptor.length=0,o.dataFormatDescriptor.push(ne);let I=new g(e,c,S,!0);for(;I._offset<S;){let T=I._nextUint32(),B=I._scan(T),X=Qe(B);if(o.keyValue[X]=I._nextUint8Array(T-B.byteLength-1),X.match(/^ktx/i)){let ye=Qe(o.keyValue[X]);o.keyValue[X]=ye.substring(0,ye.lastIndexOf("\0"))}let jt=T%4?4-T%4:0;I._skip(jt)}if(x<=0)return o;let m=new g(e,A,x,!0),Vt=m._nextUint16(),Xt=m._nextUint16(),Ke=m._nextUint32(),Fe=m._nextUint32(),Ge=m._nextUint32(),vt=m._nextUint32(),Le=[];for(let T=0;T<_;T++)Le.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});let Ie=A+m._offset,Ue=Ie+Ke,Ne=Ue+Fe,kt=Ne+Ge,Wt=new Uint8Array(e.buffer,e.byteOffset+Ie,Ke),zt=new Uint8Array(e.buffer,e.byteOffset+Ue,Fe),$t=new Uint8Array(e.buffer,e.byteOffset+Ne,Ge),Yt=new Uint8Array(e.buffer,e.byteOffset+kt,vt);return o.globalData={endpointCount:Vt,selectorCount:Xt,imageDescs:Le,endpointsData:Wt,selectorsData:zt,tablesData:$t,extendedData:Yt},o}function G(e,t){let o=new Array(t.mipMapLevels),r=t.width,s=t.height,_=0;for(let a=0;a<t.mipMapLevels;++a){let i=Co(t,r,s,e,a),c=po(e,a,_,i);o[a]={compressed:!0,format:t.internalFormat,data:c,width:r,height:s,levelSize:i},r=Math.max(1,r>>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.byteLength<E.length||t[0]!==E[0]||t[1]!==E[1]||t[2]!==E[2]||t[3]!==E[3]||t[4]!==E[4]||t[5]!==E[5]||t[6]!==E[6]||t[7]!==E[7]||t[8]!==E[8]||t[9]!==E[9]||t[10]!==E[10]||t[11]!==E[11])}function ot(e){let t=new Uint8Array(e),o=et(t),r=Math.max(1,o.levels.length),s=o.pixelWidth,_=o.pixelHeight,a=tt(o.vkFormat);return G(o.levels,{mipMapLevels:r,width:s,height:_,sizeFunction:i=>i.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<s;a++){let i=r.getNumLevels(a),c=[];for(let S=0;S<i;S++)c.push(Bo(r,a,S,o));_.push(c)}return _}finally{r.close(),r.delete()}}function Bo(e,t,o,r){let s=e.getImageWidth(t,o),_=e.getImageHeight(t,o),a=e.getHasAlpha(),{compressed:i,format:c,basisFormat:S}=nt(r,a),A=e.getImageTranscodedSizeInBytes(t,o,S),x=new Uint8Array(A);if(!e.transcodeImage(x,t,o,S,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:_,data:x,compressed:i,format:c,hasAlpha:a}}function rt(e,t,o){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),_=[];for(let a=0;a<s;a++)_.push(Do(r,a,o));return[_]}finally{r.close(),r.delete()}}function Do(e,t,o){let{alphaFlag:r,height:s,width:_}=e.getImageLevelInfo(t,0,0),{compressed:a,format:i,basisFormat:c}=nt(o,r),S=e.getImageTranscodedSizeInBytes(t,0,0,c),A=new Uint8Array(S);if(!e.transcodeImage(A,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:_,height:s,data:A,compressed:a,levelSize:S,hasAlpha:r,format:i}}function nt(e,t){let o=e&&e.basis&&e.basis.format;return o==="auto"&&(o=Ee()),typeof o=="object"&&(o=t?o.alpha:o.noAlpha),o=o.toLowerCase(),xo[o]}function Ee(){let e=Y();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var ue={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:f,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},st={...ue,parse:J};var u={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},go={DXT1:n.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:n.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:n.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":n.COMPRESSED_RGB_ATC_WEBGL,ATCA:n.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:n.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},Po=it,ho=Z,Ko=Z,Fo={DXT1:it,DXT3:Z,DXT5:Z,"ATC ":Po,ATCA:ho,ATCI:Ko};function _t(e){return new Uint32Array(e,0,u.HEADER_LENGTH)[u.MAGIC_NUMBER_INDEX]===u.MAGIC_NUMBER}function at(e){let t=new Int32Array(e,0,u.HEADER_LENGTH),o=t[u.HEADER_PF_FOURCC_INDEX];p(Boolean(t[u.HEADER_PF_FLAGS_INDEX]&u.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let r=Go(o),s=go[r],_=Fo[r];p(s&&_,`DDS: Unknown pixel format ${o}`);let a=1;t[u.HEADER_FLAGS_INDEX]&u.DDSD_MIPMAPCOUNT&&(a=Math.max(1,t[u.MIPMAPCOUNT_INDEX]));let i=t[u.HEADER_WIDTH_INDEX],c=t[u.HEADER_HEIGHT_INDEX],S=t[u.HEADER_SIZE_INDEX]+4,A=new Uint8Array(e,S);return G(A,{mipMapLevels:a,width:i,height:c,sizeFunction:_,internalFormat:s})}function it(e,t){return(e+3>>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<s+c)throw new Error("Buffer overflow");let S=new a(e.slice(s,s+c));if(_[0]===">"&&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.0-beta.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<r.length;++s)if(r[s]!==e[s+o])return!1;return!0}var M=!1,w=!0;function te(e){let t=b(e);return Ar(t)||Er(t)||Tr(t)||fr(t)||lr(t)}function lr(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),o=ht(t);return o?{mimeType:o.mimeType,width:0,height:0}:null}function Ar(e){let t=b(e);return t.byteLength>=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(;_+9<t.byteLength;){let a=t.getUint16(_,M);if(s.has(a))return{mimeType:"image/jpeg",height:t.getUint16(_+5,M),width:t.getUint16(_+7,M)};if(!r.has(a))return null;_+=2,_+=t.getUint16(_,M)}return null}function ur(){let e=new Set([65499,65476,65484,65501,65534]);for(let o=65504;o<65520;++o)e.add(o);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function b(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function Kt(e,t){let{mimeType:o}=te(e)||{},r=globalThis.loaders?.parseImageNode;return p(r),await r(e,o)}async function Ft(e,t,o){t=t||{};let s=(t.image||{}).type||"auto",{url:_}=o||{},a=mr(s),i;switch(a){case"imagebitmap":i=await Pt(e,t,_);break;case"image":i=await ee(e,t,_);break;case"data":i=await Kt(e,t);break;default:p(!1)}return s==="data"&&(i=q(i)),i}function mr(e){switch(e){case"auto":case"data":return xt();default:return Mt(e),e}}var Or=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],pr=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Cr={image:{type:"auto",decode:!0}},D={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:dt,mimeTypes:pr,extensions:Or,parse:Ft,tests:[e=>Boolean(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;_<t;++_){let a=oe(e,o,{...r,lod:_});s.push(a)}return s}function Dr(e){return 1+Math.floor(Math.log2(Math.max(e.width,e.height)))}async function It(e,t,o={}){let r=await gr(e,t,o);return await L(r,D.parse,o)}async function gr(e,t,o={}){let r=[];for(let s=0;s<e;s++){let _=H(t,o,{index:s});r.push(_)}return await Promise.all(r)}var Pr=34069,hr=34070,Kr=34071,Fr=34072,Gr=34073,Lr=34074,Ut=[{face:Pr,direction:"right",axis:"x",sign:"positive"},{face:hr,direction:"left",axis:"x",sign:"negative"},{face:Kr,direction:"top",axis:"y",sign:"positive"},{face:Fr,direction:"bottom",axis:"y",sign:"negative"},{face:Gr,direction:"front",axis:"z",sign:"positive"},{face:Lr,direction:"back",axis:"z",sign:"negative"}];async function Ir(e,t){let o={},r=[],s=0;for(let _=0;_<Ut.length;++_){let a=Ut[s],i=H(e,t,{...a,index:s++}).then(c=>{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);})(); | ||
"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.0-beta.2";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.0-beta.2"),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<t;)s++,this._offset++;return s<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}};var gn=new Uint8Array([0]),l=[171,75,84,88,32,50,48,187,13,10,26,10];function Qe(e){return new TextDecoder().decode(e)}function et(e){let t=new Uint8Array(e.buffer,e.byteOffset,l.length);if(t[0]!==l[0]||t[1]!==l[1]||t[2]!==l[2]||t[3]!==l[3]||t[4]!==l[4]||t[5]!==l[5]||t[6]!==l[6]||t[7]!==l[7]||t[8]!==l[8]||t[9]!==l[9]||t[10]!==l[10]||t[11]!==l[11])throw new Error("Missing KTX 2.0 identifier.");let o=new Te,r=17*Uint32Array.BYTES_PER_ELEMENT,s=new g(e,l.length,r,!0);o.vkFormat=s._nextUint32(),o.typeSize=s._nextUint32(),o.pixelWidth=s._nextUint32(),o.pixelHeight=s._nextUint32(),o.pixelDepth=s._nextUint32(),o.layerCount=s._nextUint32(),o.faceCount=s._nextUint32();let _=s._nextUint32();o.supercompressionScheme=s._nextUint32();let a=s._nextUint32(),i=s._nextUint32(),c=s._nextUint32(),S=s._nextUint32(),A=s._nextUint64(),x=s._nextUint64(),yt=_*3*8,re=new g(e,l.length+r,yt,!0);for(let T=0;T<_;T++)o.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+re._nextUint64(),re._nextUint64()),uncompressedByteLength:re._nextUint64()});let R=new g(e,a,i,!0),ne={vendorId:R._skip(4)._nextUint16(),descriptorType:R._nextUint16(),versionNumber:R._nextUint16(),descriptorBlockSize:R._nextUint16(),colorModel:R._nextUint8(),colorPrimaries:R._nextUint8(),transferFunction:R._nextUint8(),flags:R._nextUint8(),texelBlockDimension:[R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8()],bytesPlane:[R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8()],samples:[]},wt=6,bt=4,Ht=(ne.descriptorBlockSize/4-wt)/bt;for(let T=0;T<Ht;T++){let B={bitOffset:R._nextUint16(),bitLength:R._nextUint8(),channelType:R._nextUint8(),samplePosition:[R._nextUint8(),R._nextUint8(),R._nextUint8(),R._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};B.channelType&64?(B.sampleLower=R._nextInt32(),B.sampleUpper=R._nextInt32()):(B.sampleLower=R._nextUint32(),B.sampleUpper=R._nextUint32()),ne.samples[T]=B}o.dataFormatDescriptor.length=0,o.dataFormatDescriptor.push(ne);let I=new g(e,c,S,!0);for(;I._offset<S;){let T=I._nextUint32(),B=I._scan(T),X=Qe(B);if(o.keyValue[X]=I._nextUint8Array(T-B.byteLength-1),X.match(/^ktx/i)){let ye=Qe(o.keyValue[X]);o.keyValue[X]=ye.substring(0,ye.lastIndexOf("\0"))}let jt=T%4?4-T%4:0;I._skip(jt)}if(x<=0)return o;let m=new g(e,A,x,!0),Vt=m._nextUint16(),Xt=m._nextUint16(),Ke=m._nextUint32(),Fe=m._nextUint32(),Ge=m._nextUint32(),vt=m._nextUint32(),Le=[];for(let T=0;T<_;T++)Le.push({imageFlags:m._nextUint32(),rgbSliceByteOffset:m._nextUint32(),rgbSliceByteLength:m._nextUint32(),alphaSliceByteOffset:m._nextUint32(),alphaSliceByteLength:m._nextUint32()});let Ie=A+m._offset,Ue=Ie+Ke,Ne=Ue+Fe,kt=Ne+Ge,Wt=new Uint8Array(e.buffer,e.byteOffset+Ie,Ke),zt=new Uint8Array(e.buffer,e.byteOffset+Ue,Fe),$t=new Uint8Array(e.buffer,e.byteOffset+Ne,Ge),Yt=new Uint8Array(e.buffer,e.byteOffset+kt,vt);return o.globalData={endpointCount:Vt,selectorCount:Xt,imageDescs:Le,endpointsData:Wt,selectorsData:zt,tablesData:$t,extendedData:Yt},o}function G(e,t){let o=new Array(t.mipMapLevels),r=t.width,s=t.height,_=0;for(let a=0;a<t.mipMapLevels;++a){let i=Co(t,r,s,e,a),c=po(e,a,_,i);o[a]={compressed:!0,format:t.internalFormat,data:c,width:r,height:s,levelSize:i},r=Math.max(1,r>>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.byteLength<E.length||t[0]!==E[0]||t[1]!==E[1]||t[2]!==E[2]||t[3]!==E[3]||t[4]!==E[4]||t[5]!==E[5]||t[6]!==E[6]||t[7]!==E[7]||t[8]!==E[8]||t[9]!==E[9]||t[10]!==E[10]||t[11]!==E[11])}function ot(e){let t=new Uint8Array(e),o=et(t),r=Math.max(1,o.levels.length),s=o.pixelWidth,_=o.pixelHeight,a=tt(o.vkFormat);return G(o.levels,{mipMapLevels:r,width:s,height:_,sizeFunction:i=>i.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<s;a++){let i=r.getNumLevels(a),c=[];for(let S=0;S<i;S++)c.push(Bo(r,a,S,o));_.push(c)}return _}finally{r.close(),r.delete()}}function Bo(e,t,o,r){let s=e.getImageWidth(t,o),_=e.getImageHeight(t,o),a=e.getHasAlpha(),{compressed:i,format:c,basisFormat:S}=nt(r,a),A=e.getImageTranscodedSizeInBytes(t,o,S),x=new Uint8Array(A);if(!e.transcodeImage(x,t,o,S,0,0))throw new Error("failed to start Basis transcoding");return{width:s,height:_,data:x,compressed:i,format:c,hasAlpha:a}}function rt(e,t,o){let r=new e(new Uint8Array(t));try{if(!r.startTranscoding())throw new Error("failed to start KTX2 transcoding");let s=r.getLevels(),_=[];for(let a=0;a<s;a++)_.push(Do(r,a,o));return[_]}finally{r.close(),r.delete()}}function Do(e,t,o){let{alphaFlag:r,height:s,width:_}=e.getImageLevelInfo(t,0,0),{compressed:a,format:i,basisFormat:c}=nt(o,r),S=e.getImageTranscodedSizeInBytes(t,0,0,c),A=new Uint8Array(S);if(!e.transcodeImage(A,t,0,0,c,0,-1,-1))throw new Error("Failed to transcode KTX2 image");return{width:_,height:s,data:A,compressed:a,levelSize:S,hasAlpha:r,format:i}}function nt(e,t){let o=e&&e.basis&&e.basis.format;return o==="auto"&&(o=Ee()),typeof o=="object"&&(o=t?o.alpha:o.noAlpha),o=o.toLowerCase(),xo[o]}function Ee(){let e=Y();return e.has("astc")?"astc-4x4":e.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:e.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:e.has("etc1")?"etc1":e.has("etc2")?"etc2":"rgb565"}var ue={dataType:null,batchType:null,name:"Basis",id:"basis",module:"textures",version:f,worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},st={...ue,parse:J};var u={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4},go={DXT1:n.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:n.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:n.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":n.COMPRESSED_RGB_ATC_WEBGL,ATCA:n.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:n.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},Po=it,ho=Z,Ko=Z,Fo={DXT1:it,DXT3:Z,DXT5:Z,"ATC ":Po,ATCA:ho,ATCI:Ko};function _t(e){return new Uint32Array(e,0,u.HEADER_LENGTH)[u.MAGIC_NUMBER_INDEX]===u.MAGIC_NUMBER}function at(e){let t=new Int32Array(e,0,u.HEADER_LENGTH),o=t[u.HEADER_PF_FOURCC_INDEX];p(Boolean(t[u.HEADER_PF_FLAGS_INDEX]&u.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");let r=Go(o),s=go[r],_=Fo[r];p(s&&_,`DDS: Unknown pixel format ${o}`);let a=1;t[u.HEADER_FLAGS_INDEX]&u.DDSD_MIPMAPCOUNT&&(a=Math.max(1,t[u.MIPMAPCOUNT_INDEX]));let i=t[u.HEADER_WIDTH_INDEX],c=t[u.HEADER_HEIGHT_INDEX],S=t[u.HEADER_SIZE_INDEX]+4,A=new Uint8Array(e,S);return G(A,{mipMapLevels:a,width:i,height:c,sizeFunction:_,internalFormat:s})}function it(e,t){return(e+3>>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<s+c)throw new Error("Buffer overflow");let S=new a(e.slice(s,s+c));if(_[0]===">"&&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.0-beta.2";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<r.length;++s)if(r[s]!==e[s+o])return!1;return!0}var M=!1,w=!0;function te(e){let t=b(e);return Ar(t)||Er(t)||Tr(t)||fr(t)||lr(t)}function lr(e){let t=new Uint8Array(e instanceof DataView?e.buffer:e),o=ht(t);return o?{mimeType:o.mimeType,width:0,height:0}:null}function Ar(e){let t=b(e);return t.byteLength>=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(;_+9<t.byteLength;){let a=t.getUint16(_,M);if(s.has(a))return{mimeType:"image/jpeg",height:t.getUint16(_+5,M),width:t.getUint16(_+7,M)};if(!r.has(a))return null;_+=2,_+=t.getUint16(_,M)}return null}function ur(){let e=new Set([65499,65476,65484,65501,65534]);for(let o=65504;o<65520;++o)e.add(o);return{tableMarkers:e,sofMarkers:new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502])}}function b(e){if(e instanceof DataView)return e;if(ArrayBuffer.isView(e))return new DataView(e.buffer);if(e instanceof ArrayBuffer)return new DataView(e);throw new Error("toDataView")}async function Kt(e,t){let{mimeType:o}=te(e)||{},r=globalThis.loaders?.parseImageNode;return p(r),await r(e,o)}async function Ft(e,t,o){t=t||{};let s=(t.image||{}).type||"auto",{url:_}=o||{},a=mr(s),i;switch(a){case"imagebitmap":i=await Pt(e,t,_);break;case"image":i=await ee(e,t,_);break;case"data":i=await Kt(e,t);break;default:p(!1)}return s==="data"&&(i=q(i)),i}function mr(e){switch(e){case"auto":case"data":return xt();default:return Mt(e),e}}var Or=["png","jpg","jpeg","gif","webp","bmp","ico","svg","avif"],pr=["image/png","image/jpeg","image/gif","image/webp","image/avif","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],Cr={image:{type:"auto",decode:!0}},D={dataType:null,batchType:null,id:"image",module:"images",name:"Images",version:dt,mimeTypes:pr,extensions:Or,parse:Ft,tests:[e=>Boolean(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;_<t;++_){let a=oe(e,o,{...r,lod:_});s.push(a)}return s}function Dr(e){return 1+Math.floor(Math.log2(Math.max(e.width,e.height)))}async function It(e,t,o={}){let r=await gr(e,t,o);return await L(r,D.parse,o)}async function gr(e,t,o={}){let r=[];for(let s=0;s<e;s++){let _=H(t,o,{index:s});r.push(_)}return await Promise.all(r)}var Pr=34069,hr=34070,Kr=34071,Fr=34072,Gr=34073,Lr=34074,Ut=[{face:Pr,direction:"right",axis:"x",sign:"positive"},{face:hr,direction:"left",axis:"x",sign:"negative"},{face:Kr,direction:"top",axis:"y",sign:"positive"},{face:Fr,direction:"bottom",axis:"y",sign:"negative"},{face:Gr,direction:"front",axis:"z",sign:"positive"},{face:Lr,direction:"back",axis:"z",sign:"negative"}];async function Ir(e,t){let o={},r=[],s=0;for(let _=0;_<Ut.length;++_){let a=Ut[s],i=H(e,t,{...a,index:s++}).then(c=>{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__; | ||
}); |
@@ -13,3 +13,3 @@ "use strict"; | ||
} else { | ||
globalThis._loadersgl_.version = "4.3.0-beta.1"; | ||
globalThis._loadersgl_.version = "4.3.0-beta.2"; | ||
} | ||
@@ -253,3 +253,3 @@ } | ||
// src/lib/utils/version.ts | ||
var VERSION2 = true ? "4.3.0-beta.1" : "latest"; | ||
var VERSION2 = true ? "4.3.0-beta.2" : "latest"; | ||
@@ -256,0 +256,0 @@ // src/lib/parsers/basis-module-loader.ts |
@@ -7,2 +7,2 @@ // loaders.gl | ||
// @ts-ignore TS2304: Cannot find name '__VERSION__'. | ||
export const VERSION = typeof "4.3.0-beta.1" !== 'undefined' ? "4.3.0-beta.1" : 'latest'; | ||
export const VERSION = typeof "4.3.0-beta.2" !== 'undefined' ? "4.3.0-beta.2" : 'latest'; |
"use strict"; | ||
(() => { | ||
// src/lib/utils/version.ts | ||
var VERSION = true ? "4.3.0-beta.1" : "latest"; | ||
var VERSION = true ? "4.3.0-beta.2" : "latest"; | ||
@@ -6,0 +6,0 @@ // src/lib/parsers/parse-npy.ts |
{ | ||
"name": "@loaders.gl/textures", | ||
"version": "4.3.0-beta.2", | ||
"version": "4.3.0-beta.3", | ||
"description": "Framework-independent loaders for compressed and super compressed (basis) textures ", | ||
@@ -57,6 +57,6 @@ "license": "MIT", | ||
"dependencies": { | ||
"@loaders.gl/images": "4.3.0-beta.2", | ||
"@loaders.gl/loader-utils": "4.3.0-beta.2", | ||
"@loaders.gl/schema": "4.3.0-beta.2", | ||
"@loaders.gl/worker-utils": "4.3.0-beta.2", | ||
"@loaders.gl/images": "4.3.0-beta.3", | ||
"@loaders.gl/loader-utils": "4.3.0-beta.3", | ||
"@loaders.gl/schema": "4.3.0-beta.3", | ||
"@loaders.gl/worker-utils": "4.3.0-beta.3", | ||
"@math.gl/types": "^4.1.0", | ||
@@ -69,3 +69,3 @@ "ktx-parse": "^0.7.0", | ||
}, | ||
"gitHead": "a61003f2bb56acbdaef07a03bc39d4c7830afdcc" | ||
"gitHead": "a63e72f3f325450a883bb2f29d1a8179543ef68c" | ||
} |
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 too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
+ Added@loaders.gl/images@4.3.0-beta.3(transitive)
+ Added@loaders.gl/loader-utils@4.3.0-beta.3(transitive)
+ Added@loaders.gl/schema@4.3.0-beta.3(transitive)
+ Added@loaders.gl/worker-utils@4.3.0-beta.3(transitive)
- Removed@loaders.gl/images@4.3.0-beta.2(transitive)
- Removed@loaders.gl/loader-utils@4.3.0-beta.2(transitive)
- Removed@loaders.gl/schema@4.3.0-beta.2(transitive)
- Removed@loaders.gl/worker-utils@4.3.0-beta.2(transitive)