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

@loaders.gl/gltf

Package Overview
Dependencies
Maintainers
9
Versions
342
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/gltf - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

src/.DS_Store

2

dist/dist.min.js

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

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(window,function(){return function(e){var t={};function r(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,s){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(r.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(s,n,function(t){return e[t]}.bind(null,n));return s},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=14)}([function(e,t,r){"use strict";(function(e,s){r.d(t,"b",function(){return n}),r.d(t,"a",function(){return o}),r.d(t,"c",function(){return a});const n="object"!=typeof e||"[object process]"!==String(e)||e.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==s&&s,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window,u=void 0!==e&&e.version&&e.version.match(/v([0-9]*)/),a=u&&parseFloat(u[1])||0}).call(this,r(15),r(9))},,,,function(e,t){},,,,,function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},,,,,function(e,t,r){(function(t){const s=r(16),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,s)}).call(this,r(9))},function(e,t){var r,s,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(e){s=o}}();var a,f=[],c=!1,h=-1;function l(){c&&a&&(c=!1,a.length?f=a.concat(f):h=-1,f.length&&g())}function g(){if(!c){var e=u(l);c=!0;for(var t=f.length;t;){for(a=f,f=[];++h<t;)a&&a[h].run();h=-1,t=f.length}a=null,c=!1,function(e){if(s===clearTimeout)return clearTimeout(e);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new d(e,t)),1!==f.length||c||u(g)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=y,n.addListener=y,n.once=y,n.off=y,n.removeListener=y,n.removeAllListeners=y,n.emit=y,n.prependListener=y,n.prependOnceListener=y,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){"use strict";r.r(t);const s="KHR_draco_mesh_compression",n="UBER_draco_point_cloud_compression",i="KHR_lights_punctual";function o(e,t){if(!e)throw new Error(t||"gltf/glb assertion failed.")}const u=["SCALAR","VEC2","VEC3","VEC4"],a=new Map([[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126]]),f={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},c={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},h={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function l(e){return u[e-1]||u[0]}function g(e){const t=a.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function d(e,t){const r=h[e.componentType],s=f[e.type],n=c[e.componentType],i=e.count*s,u=e.count*s*n;return o(u>=0&&u<=t.byteLength),{ArrayType:r,length:i,byteLength:u}}function y(e,t){return e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:")?e:t.substr(0,t.lastIndexOf("/")+1)+e}const m=!1,b=!0,p=new Map([["image/png",{test:function(e){return e.byteLength>=24&&2303741511===e.getUint32(0,m)},getSize:function(e){return{width:e.getUint32(16,m),height:e.getUint32(20,m)}}}],["image/jpeg",{test:function(e){return e.byteLength>=3&&65496===e.getUint16(0,m)&&255===e.getUint8(2,m)},getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,m))return null;const{tableMarkers:t,sofMarkers:r}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let s=2;for(;s<e.byteLength;){const n=e.getUint16(s,m);if(r.has(n))return{height:e.getUint16(s+5,m),width:e.getUint16(s+7,m)};if(!t.has(n))return null;s+=2,s+=e.getUint16(s,m)}return null}}],["image/gif",{test:function(e){return e.byteLength>=10&&1195984440===e.getUint32(0,m)},getSize:function(e){return{width:e.getUint16(6,b),height:e.getUint16(8,b)}}}],["image/bmp",{test:function(e){return e.byteLength>=2&&16973===e.getUint16(0,m)},getSize:function(e){return{width:e.getUint32(18,b),height:e.getUint32(22,b)}}}]]);const w=`Invalid MIME type. Supported MIME types are: ${Array.from(p.keys()).join(", ")}`;function x(e){const t=A(e);for(const[e,{test:r}]of p.entries())if(r(t))return e;return null}function _(e,t=null){const r=function(e,t=null){t=t||x(e);const{getSize:r}=T(t),s=r(A(e));if(!s)throw new Error(`invalid image data for type: ${t}`);return s}(e,t=t||x(e));return r.mimeType=t,r}function T(e){const t=p.get(e);if(!t)throw new Error(w);return t}function A(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}function j(e){return e+3&-4}function E(e,t,r){let s;if(e instanceof ArrayBuffer)s=new Uint8Array(e);else{const t=e.byteOffset,r=e.byteLength;s=new Uint8Array(e.buffer,t,r)}return t.set(s,r),r+j(s.byteLength)}class v{constructor(e){if(e instanceof v)return e;e||(e={json:{version:2,buffers:[]},buffers:[]}),this.gltf=e,o(this.gltf.json)}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getCamera(e){return null}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];if(!r)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return r}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,r=this.gltf.buffers[t];o(r);const s=e.byteOffset||0+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),r=this.getBuffer(t.buffer).data,{ArrayType:s,length:n}=d(e,t);return new s(r,t.byteOffset+e.byteOffset,n)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),r=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(r,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addExtension(e,t){return o(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),this}addRequiredExtension(e,t){return o(t),this.addExtension(e,t),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setObjectExtension(e,t,r){(e.extensions||{})[t]=r}addMesh(e,t,r=4){const s={primitives:[{attributes:this._addAttributes(e),indices:t,mode:r}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){t=t||x(e);const r={bufferView:this.addBufferView(e),mimeType:t};return this.json.images=this.json.images||[],this.json.images.push(r),this.json.images.length-1}addBufferView(e){const t=e.byteLength;o(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=j(t),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(e,t){const r={bufferView:e,type:l(t.size),componentType:t.componentType,count:t.count};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const r=this.addBufferView(e),s={size:t.size,componentType:g(e),count:Math.round(e.length/t.size)};return this.addAccessor(r,Object.assign(s,t))}createBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),r=new Uint8Array(t);let s=0;for(let e=0;e<this.sourceBuffers.length;e++){s=E(this.sourceBuffers[e],r,s)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_removeStringFromArray(e,t){let r=!0;for(;r;){const s=e.indexOf(t);s>-1?e.splice(s,1):r=!1}}}function B(e){const t={};for(const r in e){const s=e[r];if("indices"!==r){const e=R(s);t[r]=e}}return t}function R(e,t){const{buffer:r,size:s,count:n}=function(e,t){let r=e,s=1,n=0;e&&e.value&&(r=e.value,s=e.size||1);r&&(ArrayBuffer.isView(r)||(r=function(e,t,r=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(r&&!(e instanceof t))return new t(e);return e}(r,Float32Array)),n=r.length/s);return{buffer:r,size:s,count:n}}(e);return{value:r,size:s,bufferView:null,byteOffset:0,count:n,type:l(s),componentType:g(r)}}function L(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function U(e){if(!e)return!1;return Array.isArray(e)&&(e=e[0]),e.parseTextSync||e.parseSync||e.parse||e.loadAndParse||e.parseStream||e.parseInBatches||e.worker}function O(e){let t;return L(U(e)),Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),e.extension&&(e.extensions=e.extensions||e.extension,delete e.extension),Array.isArray(e.extensions)||(e.extensions=[e.extensions]),L(e.extensions&&e.extensions.length>0&&e.extensions[0]),e.parseTextSync&&(e.text=!0),e.text||(e.binary=!0),e}class V{log(){}info(){}warn(){}error(){}}function S(e,t){return null===(e=Object.assign({},t&&t.DEFAULT_OPTIONS,t&&t.defaultOptions,t&&t.options,e,{dataType:"arraybuffer"})).log&&(e.log=new V),"log"in e||(e.log=console),e}const k=e=>"undefined"!=typeof Response&&e instanceof Response||e.arrayBuffer&&e.text&&e.json,C=e=>(e=>"undefined"!=typeof File&&e instanceof File)(e)||(e=>"undefined"!=typeof Blob&&e instanceof Blob)(e);var P=r(0);class M{constructor(e){this._fileOrBlob=e,this.bodyUsed=!1}get headers(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}get ok(){return!0}get status(){return 200}url(){return this._fileOrBlob.name||""}async arrayBuffer(){const{reader:e,promise:t}=this._getFileReader();return e.readAsArrayBuffer(this._fileOrBlob),t}async text(){const{reader:e,promise:t}=this._getFileReader();return e.readAsText(this._fileOrBlob),t}async json(){const e=await this.text();return JSON.parse(e)}_getFileReader(){let e;L(!this.bodyUsed),this.bodyUsed=!0;const t=new Promise((t,r)=>{try{(e=new FileReader).onerror=e=>r(new Error(e)),e.onabort=()=>r(new Error("Read aborted.")),e.onload=()=>t(e.result)}catch(e){r(e)}});return{reader:e,promise:t}}}function I(e,t){return Promise.resolve(new M(e,t))}const D="Cannot convert supplied data type";function F(e,t){if(t.text&&"string"==typeof e)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){const r=e.buffer||e;if(t.text&&!t.binary){return new TextDecoder("utf8").decode(r)}return r}throw new Error(D)}async function $(e,t){const r=(e=await e)instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||r)return F(e,t);if(C(e)&&(e=await I(e)),k(e))return await async function(e){if(!e.ok){let t=`fetch failed ${e.status} `;try{t+=await e.text()}catch(e){}throw new Error(t)}}(e),t.binary?await e.arrayBuffer():await e.text();throw new Error(D)}function N(e,t){return{fetch:"undefined"!=typeof window&&window.fetch,...e}}var W=r(4);function q(e){if(W.toArrayBuffer&&(e=Object(W.toArrayBuffer)(e)),e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}return L(!1)}function G(e,t=!0,r=[]){if(e){if(e instanceof ArrayBuffer)r.push(e);else if(e.buffer&&e.buffer instanceof ArrayBuffer)r.push(e.buffer);else if(t&&"object"==typeof e)for(const s in e)G(e[s],t,r)}else;return r}const X=new Map;let z=0;function J({data:e,resolve:t}){t(e)}class H{constructor({source:e,name:t=`web-worker-${z++}`,onMessage:r}){const s=function(e){if(L("string"==typeof e,"worker source"),e.startsWith("url(")&&e.endsWith(")"))return e.match(/^url\((.*)\)$/)[1];let t=X.get(e);if(!t){const r=new Blob([e],{type:"application/javascript"});t=URL.createObjectURL(r),X.set(e,t)}return t}(e);this.worker=new Worker(s,{name:t}),this.name=t,this.onMessage=r||J}async process(e){return new Promise((t,r)=>{this.worker.onmessage=e=>this.onMessage({worker:this.worker,data:e.data,resolve:t,reject:r}),this.worker.onerror=e=>r(e);const s=G(e);this.worker.postMessage(e,s)})}destroy(){this.worker.terminate(),this.worker=null}}class K{constructor({source:e,name:t="unnamed",maxConcurrency:r=1,onMessage:s,onDebug:n=(()=>{})}){this.source=e,this.name=t,this.maxConcurrency=r,this.onMessage=s,this.onDebug=n,this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}async process(e,t){return new Promise((r,s)=>{this.jobQueue.push({data:e,jobName:t,resolve:r,reject:s}),this._startQueuedJob()})}_startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();this.onDebug({message:"processing",worker:e.name,job:t.jobName,backlog:this.jobQueue.length}),e.process(t.data).then(e=>t.resolve(e)).catch(e=>t.reject(e)).then(()=>this._onWorkerDone(e))}_onWorkerDone(e){this.isDestroyed?e.destroy():(this.idleQueue.push(e),this._startQueuedJob())}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift();if(this.count<this.maxConcurrency){this.count++;const e=`${this.name.toLowerCase()}-worker-${this.count}-of-${this.maxConcurrency}`;return new H({source:this.source,onMessage:this.onMessage,name:e})}return null}}const Q=5;class Y{constructor({maxConcurrency:e=Q,onMessage:t,onDebug:r=(()=>{})}){this.maxConcurrency=e,this.onMessage=t,this.onDebug=r,this.workerPools=new Map}setProps(e){"maxConcurrency"in e&&(this.maxConcurrency=e.maxConcurrency),"onDebug"in e&&(this.onDebug=e.onDebug)}destroy(){this.workerPools.forEach(e=>e.destroy())}async process(e,t,r){return this._getWorkerPool(e,t).process(r)}_getWorkerPool(e,t){let r=this.workerPools.get(t);return r||(r=new K({source:e,name:t,onMessage:this.onMessage,maxConcurrency:this.maxConcurrency,onDebug:this.onDebug}),this.workerPools.set(t,r)),r}}let Z=null;async function ee({worker:e,data:t,resolve:r,reject:s}){switch(t.type){case"done":r(t.result);break;case"process":try{const r=await ue(t.arraybuffer,t.options,t.url);e.postMessage({type:"process-done",id:t.id,result:r},G(r))}catch(r){e.postMessage({type:"process-error",id:t.id,message:r.message})}break;case"error":s(t.message)}}function te(e,t,r,s={},n={}){const i=function(e={}){const t={};return e.maxConcurrency&&(t.maxConcurrency=e.maxConcurrency),e.onDebug&&(t.onDebug=e.onDebug),Z||(Z=new Y({onMessage:ee})),Z.setProps(t),Z}(s);return s=JSON.parse(JSON.stringify(s)),i.process(e,`loaders.gl-${t}`,{arraybuffer:q(r),options:s,source:"loaders.gl",type:"process"})}let re={};const se=/[^.]+$/;function ne(e,t="",r=null,{nothrow:s=!1}={}){if(t=t||"",e&&!Array.isArray(e)){const t=e;return O(t),t}(function(e){for(const t of e)O(t)})(e=e||Object.values(re)),t=t.replace(/\?.*/,"");let n=null;if(!(n=(n=n||function(e,t){const r=t.match(se),s=r&&r[0];return s&&function(e,t){t=t.toLowerCase();for(const r of e)for(const e of r.extensions)if(e.toLowerCase()===t)return r;return null}(e,s)}(e,t))||function(e,t){if(!t)return null;for(const r of e)if("string"==typeof t){if(ie(t,r))return r}else if(ArrayBuffer.isView(t)){if(oe(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer){if(oe(t,0,r))return r}return null}(e,r))){if(s)return null;throw new Error(`No valid loader found for ${t}`)}return n}function ie(e,t){return t.testText&&t.testText(e)}function oe(e,t,r){switch(Array.isArray(r.test)?"array":typeof r.test){case"function":return r.test(e,r);case"string":case"array":return(Array.isArray(r.test)?r.test:[r.test]).some(r=>{return r===function(e,t,r){if(e.byteLength<=t+r)return"";const s=new DataView(e);let n="";for(let e=0;e<r;e++)n+=String.fromCharCode(s.getUint8(t+e));return n}(e,t,r.length)});default:return!1}}async function ue(e,t,r,s){!t||Array.isArray(t)||U(t)||(s=r,r=t,t=null),r=r||{};const n=function(e,t){return k(e)?t=t||e.url:C(t)&&(t=t.name),"string"==typeof t?t.replace(/\?.*/,""):t}(e,s),i=ne(t,n,e);r=S(r,i);const o=N({url:n,parse:ue});return await async function(e,t,r,s){if(t=await $(t,e),e.parseTextSync&&"string"==typeof t)return r.dataType="text",e.parseTextSync(t,r,s,e);if(e.parse)return await e.parse(t,r,s,e);if(e.parseSync)return e.parseSync(t,r,s,e);if(e.worker)return await te(e.worker,e.name,t,r,s);return L(!1)}(i,e,r,o)}async function ae(e,t,r){const n=t.getObjectExtension(e,s),i=t.getTypedArrayForBufferView(n.bufferView),o=new Uint8Array(i.buffer).subarray(i.byteOffset),u=new Uint8Array(o),a=await ue(u);e.attributes=B(a.attributes),a.indices&&(e.indices=R(a.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("Empty glTF primitive detected: Draco decompression failure?")}(e)}function fe(e,t,r=4,n={}){if(!n.DracoWriter||!n.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");const i=n.DracoWriter.encodeSync({attributes:e}),o=n.DracoLoader.parseSync({attributes:e}),u=n._addFauxAttributes(o.attributes),a=n.addBufferView(i);return{primitives:[{attributes:u,mode:r,extensions:{[s]:{bufferView:a,attributes:u}}}]}}const ce={KHR_draco_mesh_compression:class{static get name(){return s}static async decode(e,t={}){if(!t.decompress)return;const r=new v(e),n=[];for(const e of function*(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}(r))r.getObjectExtension(e,s)&&n.push(ae(e,r,t));await Promise.all(n),r.removeExtension(s)}static decodeSync(e,t){if(!t.decompress)return;if(new v(e).getRequiredExtension(s))throw new Error("Cannot synchronously decode Draco")}static encode(e,t={}){const r=new v(e);for(const e of r.json.meshes||[])fe(e,t),r.addRequiredExtension(s)}},KHR_lights_punctual:class{static get name(){return i}static decode(e,t){const r=new v(e),s=r.getExtension(i);s&&(r.json.lights=s.lights,r.removeExtension(i));for(const e of r.nodes||[]){const t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.light=r._get("lights",t.light),delete e.extensions.KHR_lights_punctual)}}static encode(e,t){const r=new v(e),{json:s}=r;if(s.lights){const e=r.addExtensions(i);o(!e.lights),e.lights=s.lights,delete s.lights}if(r.json.lights){for(const e of r.json.lights){const t=e.node;r.addObjectExtension(t,i,e)}delete r.json.lights}}}};function he(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const le=1735152710,ge=12,de=8,ye=1313821514,me=5130562,be=!0;function pe(e,t=0,r={}){const s=new DataView(e),{magic:n=le}=r,i=s.getUint32(t,!1);return i===n||i===le}function we(e,t,r=0,s={}){const n=new DataView(t);e.type=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(n,r+0),e.version=n.getUint32(r+4,be);const i=n.getUint32(r+8,be);return e.header={byteOffset:r,byteLength:i},"glTF"!==e.type&&console.warn(`Invalid GLB magic string ${e.type}`),he(2===e.version,`Invalid GLB version ${e.version}. Only .glb v2 supported`),he(e.header.byteLength>ge+de),e.json={},e.hasBinChunk=!1,e.binChunks=[],function(e,t,r,s){for(;r+8<=e.header.byteLength;){const n=t.getUint32(r+0,be),i=t.getUint32(r+4,be);switch(r+=de,i){case ye:xe(e,t,r,n,s);break;case me:_e(e,t,r,n,s)}switch(i){case 0:s.strict||xe(e,t,r,n,s);break;case 1:s.strict||_e(e,t,r,n,s)}r+=j(n)}}(e,n,r+12,s),function(e){e.byteOffset=e.header.byteOffset,e.magic=e.header.magic,e.version=e.header.version,e.byteLength=e.header.byteLength,e.hasBinChunk=e.binChunks.length>=1,e.binChunkByteOffset=e.header.hasBinChunk?e.binChunks[0].byteOffset:0,e.binChunkLength=e.header.hasBinChunk?e.binChunks[0].byteLength:0}(e),r+e.header.byteLength}function xe(e,t,r,s,n){const i=new Uint8Array(t.buffer,r,s),o=new TextDecoder("utf8").decode(i);e.json=JSON.parse(o)}function _e(e,t,r,s,n){e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:s,arrayBuffer:t.buffer})}const Te={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ae={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},je={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},Ee={magFilter:je.TEXTURE_MAG_FILTER,minFilter:je.TEXTURE_MIN_FILTER,wrapS:je.TEXTURE_WRAP_S,wrapT:je.TEXTURE_WRAP_T},ve={[je.TEXTURE_MAG_FILTER]:je.LINEAR,[je.TEXTURE_MIN_FILTER]:je.NEAREST_MIPMAP_LINEAR,[je.TEXTURE_WRAP_S]:je.REPEAT,[je.TEXTURE_WRAP_]:je.REPEAT};class Be{postProcess(e,t={}){const{json:r,buffers:s=[],images:n=[],baseUri:i=""}=e;return o(r),this.baseUri=i,this.json=r,this.buffers=s,this.images=n,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,r)=>this._resolveImage(e,r,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){return e.id=e.id||`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||`node-${t}`,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||`mesh-${t}`,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const r in t)e.attributes[r]=this.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||`material-${t}`,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var r,s;return e.id=e.id||`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(r=e.componentType,Ae[r]),e.components=(s=e.type,Te[s]),e.bytesPerElement=e.bytesPerComponent*e.components,e}_resolveTexture(e,t){return e.id=e.id||`texture-${t}`,e.sampler="sampler"in e?this.getSampler(e.sampler):ve,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||`sampler-${t}`,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}return e}_enumSamplerParameter(e){return Ee[e]}_resolveImage(e,t,r){if(e.id=e.id||`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),"uri"in e){const s=this.images[t];s&&s.image&&(e.image=s.image,delete e.uri);const n=r.uri||this.baseUri;if(n){const t=e.uri;e.uri=y(e.uri,n),e.originalUri=t,e.baseUri=n,e.fullUri=e.uri}}return e.getImageAsync=()=>e.bufferView?new Promise(t=>{const r=this.getBufferView(e.bufferView),s=e.mimeType||"image/jpeg",n=new Blob([r.data],{type:s}),i=(self.URL||self.webkitURL).createObjectURL(n),o=new Image;o.onload=()=>t(o),o.src=i}):e.uri?new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>t(r),r.src=e.fullUri||e.uri}):null,e}_resolveBufferView(e,t){e.id=e.id||`bufferView-${t}`;const r=e.buffer;e.buffer=this.getBuffer(r);const s=this.buffers[r].arrayBuffer;let n=this.buffers[r].byteOffset||0;return"byteOffset"in e&&(n+=e.byteOffset),e.data=new Uint8Array(s,n,e.byteLength),e}_resolveCamera(e,t){return e.id=e.id||`camera-${t}`,e.perspective,e.orthographic,e}}function Re(e,t){return(new Be).postProcess(e,t)}const Le={fetchLinkedResources:!0,fetchImages:!1,createImages:!1,decompress:!1,postProcess:!1,log:console};async function Ue(e,t,r=0,s,n){Ve(e,t,r,s={...Le,...s.gltf});const i=[];if(s.fetchImages){const t=async function(e,t,r){const s=e.json.images||[],n=[];for(let r=0;r<s.length;++r){const i=s[r];"uri"in i&&n.push(Se(e,i,r,t))}return await Promise.all(n)}(e,s);i.push(t)}s.fetchLinkedResources&&await async function(e,t,r){for(let s=0;s<e.json.buffers.length;++s){const n=e.json.buffers[s];if(n.uri){if(!t.uri)return void console.warn("options.uri must be set to decode embedded glTF buffers");const{fetch:i}=r;o(i);const u=y(n.uri,t.uri),a=await i(u),f=await a.arrayBuffer();e.buffers[s]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete n.uri}}}(e,s,n);const u=async function(e,t){for(const r in ce){if(!(r in t&&!t[r])){const s=ce[r];await s.decode(e,t)}}}(e,s);return i.push(u),await Promise.all(i),s.postProcess?Re(e,s):e}function Oe(e,t,r=0,s,n){return Ve(e,t,r,s={...Le,...s}),s.fetchLinkedResources&&function(e,t){for(const t of e.json.buffers||[])if(t.uri)throw new Error("parseGLTFSync: Cannot decode uri buffers")}(e),s.decodeExtensions&&function(e,t){for(const r in ce){if(!(r in t&&!t[r])){ce[r].decodeSync(e,t)}}}(e,s),s.postProcess?Re(e,s):e}function Ve(e,t,r,s){if(s.uri&&(e.baseUri=s.uri),t instanceof ArrayBuffer&&!pe(t,r,s)){t=(new TextDecoder).decode(t)}"string"==typeof t?e.json=JSON.parse(t):t instanceof ArrayBuffer?(e._glb={},r=we(e._glb,t,r,s),e.json=e._glb.json):e.json=t;const n=e.json.buffers||[];e.buffers=new Array(n.length).fill({}),e._glb&&e._glb.hasBinChunk&&(e.buffers[0]={arrayBuffer:e._glb.binChunks[0].arrayBuffer,byteOffset:e._glb.binChunks[0].byteOffset,byteLength:e._glb.binChunks[0].byteLength},e.json.buffers[0].data=e.buffers[0].arrayBuffer,e.json.buffers[0].byteOffset=e.buffers[0].byteOffset);const i=e.json.images||[];e.images=new Array(i.length).fill({})}async function Se(e,t,r,s,n){const i=y(t.uri,s.uri);e.images[r]=await new Promise((e,t)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>e(r),r.onerror=e=>t(e),r.src=i})}let ke="";const Ce={};function Pe(e){for(const t in Ce)if(e.startsWith(t)){const r=Ce[t];return e.replace(t,r)}return e+=ke}async function Me(e,t){return C(e)?I(e,t):(e=Pe(e),fetch(e,t))}P.a.TextEncoder;const Ie=P.a.TextDecoder;function De(e,t,r={}){return function e(t,r,s,n={}){const i=t;const o=function(e,t){const r=function(e){if("string"==typeof e){if(0===e.indexOf("##/"))return e.slice(1);let t=e.match(/#\/([a-z]+)\/([0-9]+)/);if(t){const e=parseInt(t[2],10);return[t[1],e]}if(t=e.match(/\$\$\$([0-9]+)/)){return["accessors",parseInt(t[1],10)]}}return null}(e);if(r){const[s,n]=r,i=t[s]&&t[s][n];if(i)return i;console.error(`Invalid JSON pointer ${e}: #/${s}/${n}`)}return null}(i,s);if(o)return o;if(Array.isArray(i))return i.map(t=>e(t,r,s,n));if(null!==i&&"object"==typeof i){const t={};for(const o in i)t[o]=e(i[o],r,s,n);return t}return i}(e,e,t,r)}function Fe(e,t,r){r&&(e=function(e,t){const r=e.byteLength-t,s=new ArrayBuffer(r),n=new Uint8Array(e),i=new Uint8Array(s);for(let e=0;e<r;e++)i[e]=n[t+e];return s}(e,r));const s=t.bufferViews||[];for(let e=0;e<s.length;++e){o(s[e].byteLength>=0)}return{accessors:$e(e,s,t),images:Ne(e,s,t)}}function $e(e,t,r){const s=r.accessors||[],n=[];for(let r=0;r<s.length;++r){const i=s[r];o(i);const u=t[i.bufferView];if(u){const{ArrayType:t,length:r}=d(i,u),s=new t(e,u.byteOffset,r);s.accessor=i,n.push(s)}}return n}function Ne(e,t,r){const s=r.images||[],n=[];for(let r=0;r<s.length;++r){const i=s[r];o(i);const u=t[i.bufferView];o(u);const a=new Uint8Array(e,u.byteOffset,u.byteLength);a.imate=i,n.push(a)}return n}class We{static isGLB(e,t={}){return pe(e,0)}parse(e,t={}){return this.parseSync(e,t)}parseSync(e,t={}){if(this.glbArrayBuffer=e,this.binaryByteOffset=null,this.packedJson=null,this.json=null,null===this.json&&null===this.binaryByteOffset){const e=0;we(this,this.glbArrayBuffer,e,t),this.binaryByteOffset=this.binChunkByteOffset,this.packedJson=this.json;const r=Fe(this.glbArrayBuffer,this.json,this.binaryByteOffset);this.json=De(this.json,r),this.unpackedBuffers=r}return this}getApplicationData(e){return this.json[e]}getJSON(){return this.json}getArrayBuffer(){return this.glbArrayBuffer}getBinaryByteOffset(){return this.binaryByteOffset}getBufferView(e){const t=(e.byteOffset||0)+this.binaryByteOffset;return new Uint8Array(this.glbArrayBuffer,t,e.byteLength)}getBuffer(e){const t=h[e.componentType],r=f[e.type],s=c[e.componentType],n=e.count*r,i=e.count*r*s,u=this.json.bufferViews[e.bufferView];o(i>=0&&e.byteOffset+i<=u.byteLength);const a=u.byteOffset+this.binaryByteOffset+e.byteOffset;return new t(this.glbArrayBuffer,a,n)}getImageData(e){return{typedArray:this.getBufferView(e.bufferView),mimeType:e.mimeType||"image/jpeg"}}getImage(e){const t=this.getBufferView(e.bufferView),r=e.mimeType||"image/jpeg",s=new Blob([t],{type:r}),n=(self.URL||self.webkitURL).createObjectURL(s),i=new Image;return i.src=n,i}getImageAsync(e){return new Promise(t=>{const r=this.getBufferView(e.bufferView),s=e.mimeType||"image/jpeg",n=new Blob([r],{type:s}),i=(self.URL||self.webkitURL).createObjectURL(n),o=new Image;o.onload=()=>t(o),o.src=i})}}const qe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ge={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Xe={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},ze={magFilter:Xe.TEXTURE_MAG_FILTER,minFilter:Xe.TEXTURE_MIN_FILTER,wrapS:Xe.TEXTURE_WRAP_S,wrapT:Xe.TEXTURE_WRAP_T},Je={[Xe.TEXTURE_MAG_FILTER]:Xe.LINEAR,[Xe.TEXTURE_MIN_FILTER]:Xe.NEAREST_MIPMAP_LINEAR,[Xe.TEXTURE_WRAP_S]:Xe.REPEAT,[Xe.TEXTURE_WRAP_]:Xe.REPEAT};class He{postProcess(e,t,r={}){return this.gltf=e,this.glbParser=t,this._resolveToTree(r),this.gltf}_resolveToTree(e={}){const{gltf:t}=this;return(t.bufferViews||[]).forEach((e,t)=>this._resolveBufferView(e,t)),(t.images||[]).forEach((t,r)=>this._resolveImage(t,r,e)),(t.samplers||[]).forEach((e,t)=>this._resolveSampler(e,t)),(t.textures||[]).forEach((e,t)=>this._resolveTexture(e,t)),(t.accessors||[]).forEach((e,t)=>this._resolveAccessor(e,t)),(t.materials||[]).forEach((e,t)=>this._resolveMaterial(e,t)),(t.meshes||[]).forEach((e,t)=>this._resolveMesh(e,t)),(t.nodes||[]).forEach((e,t)=>this._resolveNode(e,t)),(t.skins||[]).forEach((e,t)=>this._resolveSkin(e,t)),(t.scenes||[]).forEach((e,t)=>this._resolveScene(e,t)),void 0!==t.scene&&(t.scene=t.scenes[this.gltf.scene]),this._process_extension_KHR_lights_punctual(),t}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.gltf[e]&&this.gltf[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){e.id=`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e))}_resolveNode(e,t){e.id=`node-${t}`,e.children=(e.children||[]).map(e=>this.getNode(e)),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin))}_resolveSkin(e,t){e.id=`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices)}_resolveMesh(e,t){e.id=`mesh-${t}`;for(const t of e.primitives){for(const e in t.attributes)t.attributes[e]=this.getAccessor(t.attributes[e]);void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material))}}_resolveMaterial(e,t){if(e.id=`material-${t}`,e.normalTexture&&(e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}}_resolveAccessor(e,t){e.id=`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=Ge[e],e.components=qe[e],e.bytesPerElement=e.bytesPerComponent*e.components}_resolveTexture(e,t){e.id=`texture-${t}`,e.sampler="sampler"in e?this.getSampler(e.sampler):Je,e.source=this.getImage(e.source)}_resolveSampler(e,t){e.id=`sampler-${t}`,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}}_enumSamplerParameter(e){return ze[e]}_resolveImage(e,t,r){e.id=`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const{createImages:s=!0}=r;s?e.image=this.glbParser.getImage(e):e.getImageAsync=()=>this.glbParser?this.glbParser.getImageAsync(e):e.uri?new Promise(t=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>t(s),s.src=y(e.uri,r.uri)}):null}_resolveBufferView(e,t){if(e.id=`bufferView-${t}`,e.buffer=this.getBuffer(e.buffer),this.glbParser)e.data=this.glbParser.getBufferView(e);else{const t=e.byteOffset||0;e.data=new Uint8Array(e.buffer.data,t,e.byteLength)}}_resolveCamera(e){e.perspective,e.orthographic}_process_extension_KHR_lights_punctual(){const{gltf:e}=this,t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.lights=t.lights),this._removeExtension("KHR_lights_punctual");for(const t of e.nodes||[]){const e=t.extensions&&t.extensions.KHR_lights_punctual;e&&(t.light=this._get("lights",e.light),delete t.extensions.KHR_lights_punctual)}delete e.lights}_removeExtension(e){this.gltf.extensionsRequired&&this._removeStringFromArray(this.gltf.extensionsRequired,e),this.gltf.extensionsUsed&&this._removeStringFromArray(this.gltf.extensionsUsed,e),this.gltf.extensions&&delete this.gltf.extensions[e]}_removeStringFromArray(e,t){let r=!0;for(;r;){const s=e.indexOf(t);s>-1?e.splice(s,1):r=!1}}}const Ke={fetchLinkedResources:!0,fetch:Me,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console};class Qe{async parse(e,t={}){if(t=Object.assign({},Ke,t),this.parseSync(e,{...t,postProcess:!1,decompress:!1}),t.fetchLinkedResources&&await this._loadLinkedAssets(t),t.decompress&&this._decompressMeshes(t),t.postProcess){(new He).postProcess(this.gltf,this.glbParser,t)}return this.gltf}parseSync(e,t={}){if(t=Object.assign({},Ke,t),e instanceof ArrayBuffer&&!We.isGLB(e,t)){e=(new Ie).decode(e)}if("string"==typeof e&&(e=JSON.parse(e)),e instanceof ArrayBuffer?(this.glbParser=new We,this.gltf=this.glbParser.parseSync(e).json,this.json=this.gltf):(this.glbParser=null,this.gltf=e,this.json=e),t.decompress&&this._decompressMeshes(t),t.postProcess){(new He).postProcess(this.gltf,this.glbParser,t)}return this.gltf}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.gltf[e]&&this.gltf[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}async _loadLinkedAssets(e){return await Promise.all(this.gltf.buffers.map(t=>this._loadBuffer(t,e)))}async _loadBuffer(e,t){if(e.uri&&t.uri){const r=t.fetch||window.fetch,s=y(e.uri,t.uri),n=await r(s),i=await n.arrayBuffer();e.data=i,e.uri=null}}_decompressMeshes(e){if(e.DracoLoader&&e.decompress){for(const t of this.gltf.meshes||[])for(const r of t.primitives)if(this._decompressKhronosDracoPrimitive(r,e),this._decompressUberDracoPrimitive(r,e),!r.attributes||0===Object.keys(r.attributes).length)throw new Error("Empty glTF primitive: decompression failure?");this._removeExtension(s),this._removeExtension(n)}}_decompressKhronosDracoPrimitive(e,t){const r=e.extensions&&e.extensions[s];if(!r)return;delete e.extensions[s];const n=this._getBufferViewArray(r.bufferView),i=t.DracoLoader.parseSync(n);e.attributes=B(i.attributes),i.indices&&(e.indices=R(i.indices))}_decompressUberDracoPrimitive(e,t){const r=e.extensions&&e.extensions[n];if(!r)return;if(0!==e.mode)throw new Error(n);delete e.extensions[n];const s=this._getBufferViewArray(r.bufferView),i=t.DracoLoader.parseSync(s);e.attributes=i.attributes}_getBufferViewArray(e){const t=this.gltf.bufferViews[e];if(this.glbParser)return this.glbParser.getBufferView(t);const r=this.gltf.buffers[t.buffer].data,s=t.byteOffset||0;return new Uint8Array(r,s,t.byteLength)}_removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}_removeStringFromArray(e,t){let r=!0;for(;r;){const s=e.indexOf(t);s>-1?e.splice(s,1):r=!1}}}const Ye={gltf:{parserVersion:1},uri:""};var Ze={name:"glTF",extensions:["gltf","glb"],mimeType:"model/gltf+json",text:!0,binary:!0,test:"glTF",parse:async function(e,t={},r){if(2!==(t={...Ye,...t}).gltf.parserVersion&&!1!==t.useGLTFParser){return(new Qe).parse(e,t)}const{byteOffset:s=0}=t;return await Ue({},e,s,t,r)},parseSync:function(e,t={},r){if(2!==(t={...Ye,...t}).gltf.parserVersion&&!1!==t.useGLTFParser)return(new Qe).parseSync(e,t);const{byteOffset:s=0}=t;return Oe({},e,s,t)},defaultOptions:Ye};function et(e,t,r,s){const n=j(r.byteLength),i=n-r.byteLength;if(e){const s=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),n=new Uint8Array(r);s.set(n);for(let s=0;s<i;++s)e.setUint8(t+r.byteLength+s,32)}return t+=n}const tt=1179937895,rt=1313821514,st=5130562,nt=!0;function it(e,t,r=0,s={}){const{magic:n=tt,version:i=2,json:o={},binary:u}=e,a=r;t&&(t.setUint32(r+0,n,nt),t.setUint32(r+4,i,nt),t.setUint32(r+8,0,nt));const f=r+8,c=r+=12;if(t&&(t.setUint32(r+0,0,nt),t.setUint32(r+4,rt,nt)),r=function(e,t,r,s){return t=et(e,t,(new TextEncoder).encode(r))}(t,r+=8,JSON.stringify(o)),t){const e=r-c-8;t.setUint32(c+0,e,nt)}if(u){const e=r;if(t&&(t.setUint32(r+0,0,nt),t.setUint32(r+4,st,nt)),r=et(t,r+=8,u),t){const s=r-e-8;t.setUint32(e+0,s,nt)}}if(t){const e=r-a;t.setUint32(f,e,nt)}return r}function ot(e,t,r,s){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),it(e,t,r,s)}var ut={name:"glTF",extensions:["glb"],mimeType:"model/gltf+json",encodeSync:function(e,t={}){const{byteOffset:r=0}=t,s=ot(e,null,r,t),n=new ArrayBuffer(s),i=new DataView(n);return ot(e,i,r,t),n},binary:!0,defaultOptions:{useGLTFBuilder:!0}};var at={name:"GLB",extensions:["glb"],mimeType:"model/gltf-binary",binary:!0,parse:async(e,t)=>ft(e,t),parseSync:ft,defaultOptions:{strict:!1}};function ft(e,t){const{byteOffset:r=0}=t,s={};return we(s,e,r,t),s}var ct={name:"GLB",extensions:["glb"],mimeType:"model/gltf-binary",encodeSync:function(e,t){const{byteOffset:r=0}=t,s=it(e,null,r,t),n=new ArrayBuffer(s),i=new DataView(n);return it(e,i,r,t),n},binary:!0};function ht(e,t=Float32Array){if(0===e.length)return new Float32Array(0);if(!function e(t,r=Number.isFinite){let s=-1;for(;++s<t.length;){const n=t[s];if(Array.isArray(n)||ArrayBuffer.isView(n)){if(!e(n,r))return!1}else if(!r(n))return!1}return!0}(e))return null;const r=new t(function e(t,r=3){let s=0;let n=0;let i=-1;for(;++i<t.length;){const r=t[i];Array.isArray(r)||ArrayBuffer.isView(r)?s+=e(r):n++}return s+(0===s&&n<r?r:n)}(e));return function(e,t,r=3){(function e(t,r,s,n){let i=-1;let o=0;for(;++i<t.length;){const u=t[i];Array.isArray(u)||ArrayBuffer.isView(u)?n=e(u,r,s,n):o<s&&(r[n++]=u,o++)}o>0&&o<s&&(r[n++]=0);return n})(e,t,r,0)}(e,r),r}function lt(e,t,r={}){const{flattenArrays:s=!1}=r;let n=e;if("string"==typeof n&&0===n.indexOf("#/"))return`#${n}`;if(Array.isArray(n)){const e=s&&ht(n);if(!e)return n.map(e=>lt(e,t,r));n=e}if(ArrayBuffer.isView(n)&&t){if(t.isImage(n)){return`#/images/${t.addImage(n)}`}return`#/accessors/${t.addBuffer(n)}`}if(null!==n&&"object"==typeof n){const e={};for(const s in n)e[s]=lt(n[s],t,r);return e}return n}class gt{constructor(e={}){this.byteLength=0,this.json={buffers:[{byteLength:0}],bufferViews:[],accessors:[],images:[],meshes:[]},this.sourceBuffers=[],this.log=e.log||console}getByteLength(){return this.byteLength}isImage(e){return function(e,t){if(t){const{test:r}=T(t);return r(A(e))}return Boolean(x(e))}(e)}encodeSync(e={}){return this.encodeAsGLB(e)}encodeAsGLB(e={}){this._packBinaryChunk(),e.magic&&console.warn("Custom glTF magic number no longer supported");const t={version:2,json:this.json,binary:this.arrayBuffer},r=it(t,null,0,e),s=new ArrayBuffer(r);return it(t,new DataView(s),0,e),s}addApplicationData(e,t,r={}){const s=r.packTypedArrays?lt(t,this,r):t;return this.json[e]=s,this}addBuffer(e,t={size:3}){const r=this.addBufferView(e),s={size:t.size,componentType:g(e),count:Math.round(e.length/t.size)};return this.addAccessor(r,Object.assign(s,t))}addBufferView(e){const t=e.byteLength||e.length;return this.json.bufferViews.push({buffer:0,byteOffset:this.byteLength,byteLength:t}),this.byteLength+=j(t),this.sourceBuffers.push(e),this.json.bufferViews.length-1}addAccessor(e,t){return this.json.accessors.push({bufferView:e,type:l(t.size),componentType:t.componentType,count:t.count}),this.json.accessors.length-1}_pack(){return this._packBinaryChunk(),{arrayBuffer:this.arrayBuffer,json:this.json}}_packBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),r=new Uint8Array(t);let s=0;for(let e=0;e<this.sourceBuffers.length;e++){s=E(this.sourceBuffers[e],r,s)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_getInternalCounts(){return{buffers:this.json.buffers.length,bufferViews:this.json.bufferViews.length,accessors:this.json.accessors.length,images:this.json.images.length}}}class dt extends gt{constructor(e={}){super(e),this.DracoWriter=e.DracoWriter,this.DracoLoader=e.DracoLoader}addApplicationData(e,t,r={}){const s=r.packTypedArrays?lt(t,this,r):t;return this.json[e]=s,this}addExtraData(e,t,r={}){const s=r.packedTypedArrays?lt(t,this,r):t;return this.json.extras=this.json.extras||{},this.json.extras[e]=s,this}addExtension(e,t,r={}){o(t);const s=r.packTypedArrays?lt(t,this,r):t;return this.json.extensions=this.json.extensions||{},this.json.extensions[e]=s,this.registerUsedExtension(e),this}addRequiredExtension(e,t,r={}){o(t);const s=r.packTypedArrays?lt(t,this,r):t;return this.addExtension(e,s),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}addMesh(e,t,r=4){const s={primitives:[{attributes:this._addAttributes(e),indices:t,mode:r}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addCompressedMesh(e,t,r=4){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");this.registerRequiredExtension(s);const n=this.DracoWriter.encodeSync({attributes:e}),i=this.DracoLoader.parseSync({attributes:e}),o=this._addFauxAttributes(i.attributes),u=this.addBufferView(n),a={primitives:[{attributes:o,mode:r,extensions:{[s]:{bufferView:u,attributes:o}}}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addCompressedPointCloud(e){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");e.mode=0;const t=this.DracoWriter.encodeSync(e,{pointcloud:!0}),r=this.addBufferView(t),s={primitives:[{attributes:{},mode:0,extensions:{[n]:{bufferView:r}}}]};return this.registerRequiredExtension(n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addImage(e){const t=this.addBufferView(e),r=_(e)||{};if(r){const{mimeType:e,width:s,height:n}=r;this.json.images.push({bufferView:t,mimeType:e,width:s,height:n})}else this.json.images.push({bufferView:t});return this.json.images.length-1}}r.d(t,"KHR_DRACO_MESH_COMPRESSION",function(){return s}),r.d(t,"UBER_POINT_CLOUD_EXTENSION",function(){return n}),r.d(t,"GLTFLoader",function(){return Ze}),r.d(t,"GLTFWriter",function(){return ut}),r.d(t,"GLBLoader",function(){return at}),r.d(t,"GLBWriter",function(){return ct}),r.d(t,"GLTFScenegraph",function(){return v}),r.d(t,"postProcessGLTF",function(){return Re}),r.d(t,"parseGLTFSync",function(){return Oe}),r.d(t,"encodeGLTFSync",function(){return ot}),r.d(t,"packBinaryJson",function(){return lt}),r.d(t,"unpackBinaryJson",function(){return De}),r.d(t,"GLBParser",function(){return We}),r.d(t,"GLBBuilder",function(){return gt}),r.d(t,"GLTFParser",function(){return Qe}),r.d(t,"GLTFBuilder",function(){return dt})}])});
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(window,function(){return function(e){var t={};function r(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,s){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(r.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(s,n,function(t){return e[t]}.bind(null,n));return s},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=14)}([function(e,t,r){"use strict";(function(e,s){r.d(t,"b",function(){return n}),r.d(t,"a",function(){return o}),r.d(t,"c",function(){return a});const n="object"!=typeof e||"[object process]"!==String(e)||e.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==s&&s,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window,u=void 0!==e&&e.version&&e.version.match(/v([0-9]*)/),a=u&&parseFloat(u[1])||0}).call(this,r(15),r(9))},,,,function(e,t){},,,,,function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},,,,,function(e,t,r){(function(t){const s=r(16),n="undefined"==typeof window?t:window;n.loaders=n.loaders||{},e.exports=Object.assign(n.loaders,s)}).call(this,r(9))},function(e,t){var r,s,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{s="function"==typeof clearTimeout?clearTimeout:o}catch(e){s=o}}();var a,f=[],c=!1,h=-1;function l(){c&&a&&(c=!1,a.length?f=a.concat(f):h=-1,f.length&&g())}function g(){if(!c){var e=u(l);c=!0;for(var t=f.length;t;){for(a=f,f=[];++h<t;)a&&a[h].run();h=-1,t=f.length}a=null,c=!1,function(e){if(s===clearTimeout)return clearTimeout(e);if((s===o||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function y(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new d(e,t)),1!==f.length||c||u(g)},d.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=y,n.addListener=y,n.once=y,n.off=y,n.removeListener=y,n.removeAllListeners=y,n.emit=y,n.prependListener=y,n.prependOnceListener=y,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){"use strict";r.r(t);const s="KHR_draco_mesh_compression",n="UBER_draco_point_cloud_compression",i="KHR_lights_punctual";function o(e,t){if(!e)throw new Error(t||"gltf/glb assertion failed.")}const u=["SCALAR","VEC2","VEC3","VEC4"],a=new Map([[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126]]),f={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},c={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},h={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function l(e){return u[e-1]||u[0]}function g(e){const t=a.get(e.constructor);if(!t)throw new Error("Illegal typed array");return t}function d(e,t){const r=h[e.componentType],s=f[e.type],n=c[e.componentType],i=e.count*s,u=e.count*s*n;return o(u>=0&&u<=t.byteLength),{ArrayType:r,length:i,byteLength:u}}function y(e,t){return e.startsWith("data:")||e.startsWith("http:")||e.startsWith("https:")?e:t.substr(0,t.lastIndexOf("/")+1)+e}const m=!1,b=!0,p=new Map([["image/png",{test:function(e){return e.byteLength>=24&&2303741511===e.getUint32(0,m)},getSize:function(e){return{width:e.getUint32(16,m),height:e.getUint32(20,m)}}}],["image/jpeg",{test:function(e){return e.byteLength>=3&&65496===e.getUint16(0,m)&&255===e.getUint8(2,m)},getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,m))return null;const{tableMarkers:t,sofMarkers:r}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let s=2;for(;s<e.byteLength;){const n=e.getUint16(s,m);if(r.has(n))return{height:e.getUint16(s+5,m),width:e.getUint16(s+7,m)};if(!t.has(n))return null;s+=2,s+=e.getUint16(s,m)}return null}}],["image/gif",{test:function(e){return e.byteLength>=10&&1195984440===e.getUint32(0,m)},getSize:function(e){return{width:e.getUint16(6,b),height:e.getUint16(8,b)}}}],["image/bmp",{test:function(e){return e.byteLength>=2&&16973===e.getUint16(0,m)},getSize:function(e){return{width:e.getUint32(18,b),height:e.getUint32(22,b)}}}]]);const w=`Invalid MIME type. Supported MIME types are: ${Array.from(p.keys()).join(", ")}`;function x(e){const t=A(e);for(const[e,{test:r}]of p.entries())if(r(t))return e;return null}function _(e,t=null){const r=function(e,t=null){t=t||x(e);const{getSize:r}=T(t),s=r(A(e));if(!s)throw new Error(`invalid image data for type: ${t}`);return s}(e,t=t||x(e));return r.mimeType=t,r}function T(e){const t=p.get(e);if(!t)throw new Error(w);return t}function A(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}function j(e){return e+3&-4}function E(e,t,r){let s;if(e instanceof ArrayBuffer)s=new Uint8Array(e);else{const t=e.byteOffset,r=e.byteLength;s=new Uint8Array(e.buffer,t,r)}return t.set(s,r),r+j(s.byteLength)}class v{constructor(e){if(e instanceof v)return e;e||(e={json:{version:2,buffers:[]},buffers:[]}),this.gltf=e,o(this.gltf.json)}get json(){return this.gltf.json}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(e,t){return(e.extensions||{})[t]}getScene(e){return this.getObject("scenes",e)}getNode(e){return this.getObject("nodes",e)}getSkin(e){return this.getObject("skins",e)}getMesh(e){return this.getObject("meshes",e)}getMaterial(e){return this.getObject("materials",e)}getAccessor(e){return this.getObject("accessors",e)}getCamera(e){return null}getTexture(e){return this.getObject("textures",e)}getSampler(e){return this.getObject("samplers",e)}getImage(e){return this.getObject("images",e)}getBufferView(e){return this.getObject("bufferViews",e)}getBuffer(e){return this.getObject("buffers",e)}getObject(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];if(!r)throw new Error(`glTF file error: Could not find ${e}[${t}]`);return r}getTypedArrayForBufferView(e){const t=(e=this.getBufferView(e)).buffer,r=this.gltf.buffers[t];o(r);const s=e.byteOffset||0+r.byteOffset;return new Uint8Array(r.arrayBuffer,s,e.byteLength)}getTypedArrayForAccessor(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),r=this.getBuffer(t.buffer).data,{ArrayType:s,length:n}=d(e,t);return new s(r,t.byteOffset+e.byteOffset,n)}getTypedArrayForImageData(e){e=this.getAccessor(e);const t=this.getBuffer(e.bufferView),r=this.getBuffer(t.buffer).data,s=t.byteOffset||0;return new Uint8Array(r,s,t.byteLength)}addApplicationData(e,t){return this.json[e]=t,this}addExtraData(e,t){return this.json.extras=this.json.extras||{},this.json.extras[e]=t,this}addExtension(e,t){return o(t),this.json.extensions=this.json.extensions||{},this.json.extensions[e]=t,this.registerUsedExtension(e),this}addRequiredExtension(e,t){return o(t),this.addExtension(e,t),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}setObjectExtension(e,t,r){(e.extensions||{})[t]=r}addMesh(e,t,r=4){const s={primitives:[{attributes:this._addAttributes(e),indices:t,mode:r}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addImage(e,t){t=t||x(e);const r={bufferView:this.addBufferView(e),mimeType:t};return this.json.images=this.json.images||[],this.json.images.push(r),this.json.images.length-1}addBufferView(e){const t=e.byteLength;o(Number.isFinite(t)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(e);const r={buffer:0,byteOffset:this.byteLength,byteLength:t};return this.byteLength+=j(t),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(e,t){const r={bufferView:e,type:l(t.size),componentType:t.componentType,count:t.count};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(e,t={size:3}){const r=this.addBufferView(e),s={size:t.size,componentType:g(e),count:Math.round(e.length/t.size)};return this.addAccessor(r,Object.assign(s,t))}createBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),r=new Uint8Array(t);let s=0;for(let e=0;e<this.sourceBuffers.length;e++){s=E(this.sourceBuffers[e],r,s)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_removeStringFromArray(e,t){let r=!0;for(;r;){const s=e.indexOf(t);s>-1?e.splice(s,1):r=!1}}}function B(e){const t={};for(const r in e){const s=e[r];if("indices"!==r){const e=R(s);t[r]=e}}return t}function R(e,t){const{buffer:r,size:s,count:n}=function(e,t){let r=e,s=1,n=0;e&&e.value&&(r=e.value,s=e.size||1);r&&(ArrayBuffer.isView(r)||(r=function(e,t,r=!1){if(!e)return null;if(Array.isArray(e))return new t(e);if(r&&!(e instanceof t))return new t(e);return e}(r,Float32Array)),n=r.length/s);return{buffer:r,size:s,count:n}}(e);return{value:r,size:s,bufferView:null,byteOffset:0,count:n,type:l(s),componentType:g(r)}}function L(e,t){if(!e)throw new Error(t||"loader assertion failed.")}function U(e){if(!e)return!1;return Array.isArray(e)&&(e=e[0]),e.parseTextSync||e.parseSync||e.parse||e.loadAndParse||e.parseStream||e.parseInBatches||e.worker}function O(e){let t;return L(U(e)),Array.isArray(e)&&(t=e[1],e=e[0],e={...e,options:{...e.options,...t}}),e.extension&&(e.extensions=e.extensions||e.extension,delete e.extension),Array.isArray(e.extensions)||(e.extensions=[e.extensions]),L(e.extensions&&e.extensions.length>0&&e.extensions[0]),e.parseTextSync&&(e.text=!0),e.text||(e.binary=!0),e}class V{log(){}info(){}warn(){}error(){}}function S(e,t){return null===(e=Object.assign({},t&&t.DEFAULT_OPTIONS,t&&t.defaultOptions,t&&t.options,e,{dataType:"arraybuffer"})).log&&(e.log=new V),"log"in e||(e.log=console),e}const k=e=>"undefined"!=typeof Response&&e instanceof Response||e.arrayBuffer&&e.text&&e.json,C=e=>(e=>"undefined"!=typeof File&&e instanceof File)(e)||(e=>"undefined"!=typeof Blob&&e instanceof Blob)(e);var P=r(0);class M{constructor(e){this._fileOrBlob=e,this.bodyUsed=!1}get headers(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}get ok(){return!0}get status(){return 200}url(){return this._fileOrBlob.name||""}async arrayBuffer(){const{reader:e,promise:t}=this._getFileReader();return e.readAsArrayBuffer(this._fileOrBlob),t}async text(){const{reader:e,promise:t}=this._getFileReader();return e.readAsText(this._fileOrBlob),t}async json(){const e=await this.text();return JSON.parse(e)}_getFileReader(){let e;L(!this.bodyUsed),this.bodyUsed=!0;const t=new Promise((t,r)=>{try{(e=new FileReader).onerror=e=>r(new Error(e)),e.onabort=()=>r(new Error("Read aborted.")),e.onload=()=>t(e.result)}catch(e){r(e)}});return{reader:e,promise:t}}}function I(e,t){return Promise.resolve(new M(e,t))}const D="Cannot convert supplied data type";function F(e,t){if(t.text&&"string"==typeof e)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){const r=e.buffer||e;if(t.text&&!t.binary){return new TextDecoder("utf8").decode(r)}return r}throw new Error(D)}async function $(e,t){const r=(e=await e)instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||r)return F(e,t);if(C(e)&&(e=await I(e)),k(e))return await async function(e){if(!e.ok){let t=`fetch failed ${e.status} `;try{t+=await e.text()}catch(e){}throw new Error(t)}}(e),t.binary?await e.arrayBuffer():await e.text();throw new Error(D)}function N(e,t){return{fetch:"undefined"!=typeof window&&window.fetch,...e}}var W=r(4);function q(e){if(W.toArrayBuffer&&(e=Object(W.toArrayBuffer)(e)),e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const t=e;return(new TextEncoder).encode(t).buffer}return L(!1)}function G(e,t=!0,r=[]){if(e){if(e instanceof ArrayBuffer)r.push(e);else if(e.buffer&&e.buffer instanceof ArrayBuffer)r.push(e.buffer);else if(t&&"object"==typeof e)for(const s in e)G(e[s],t,r)}else;return r}const X=new Map;let z=0;function J({data:e,resolve:t}){t(e)}class H{constructor({source:e,name:t=`web-worker-${z++}`,onMessage:r}){const s=function(e){if(L("string"==typeof e,"worker source"),e.startsWith("url(")&&e.endsWith(")"))return e.match(/^url\((.*)\)$/)[1];let t=X.get(e);if(!t){const r=new Blob([e],{type:"application/javascript"});t=URL.createObjectURL(r),X.set(e,t)}return t}(e);this.worker=new Worker(s,{name:t}),this.name=t,this.onMessage=r||J}async process(e){return new Promise((t,r)=>{this.worker.onmessage=e=>this.onMessage({worker:this.worker,data:e.data,resolve:t,reject:r}),this.worker.onerror=e=>r(e);const s=G(e);this.worker.postMessage(e,s)})}destroy(){this.worker.terminate(),this.worker=null}}class K{constructor({source:e,name:t="unnamed",maxConcurrency:r=1,onMessage:s,onDebug:n=(()=>{})}){this.source=e,this.name=t,this.maxConcurrency=r,this.onMessage=s,this.onDebug=n,this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}async process(e,t){return new Promise((r,s)=>{this.jobQueue.push({data:e,jobName:t,resolve:r,reject:s}),this._startQueuedJob()})}_startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const t=this.jobQueue.shift();this.onDebug({message:"processing",worker:e.name,job:t.jobName,backlog:this.jobQueue.length}),e.process(t.data).then(e=>t.resolve(e)).catch(e=>t.reject(e)).then(()=>this._onWorkerDone(e))}_onWorkerDone(e){this.isDestroyed?e.destroy():(this.idleQueue.push(e),this._startQueuedJob())}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift();if(this.count<this.maxConcurrency){this.count++;const e=`${this.name.toLowerCase()}-worker-${this.count}-of-${this.maxConcurrency}`;return new H({source:this.source,onMessage:this.onMessage,name:e})}return null}}const Q=5;class Y{constructor({maxConcurrency:e=Q,onMessage:t,onDebug:r=(()=>{})}){this.maxConcurrency=e,this.onMessage=t,this.onDebug=r,this.workerPools=new Map}setProps(e){"maxConcurrency"in e&&(this.maxConcurrency=e.maxConcurrency),"onDebug"in e&&(this.onDebug=e.onDebug)}destroy(){this.workerPools.forEach(e=>e.destroy())}async process(e,t,r){return this._getWorkerPool(e,t).process(r)}_getWorkerPool(e,t){let r=this.workerPools.get(t);return r||(r=new K({source:e,name:t,onMessage:this.onMessage,maxConcurrency:this.maxConcurrency,onDebug:this.onDebug}),this.workerPools.set(t,r)),r}}let Z=null;async function ee({worker:e,data:t,resolve:r,reject:s}){switch(t.type){case"done":r(t.result);break;case"process":try{const r=await ue(t.arraybuffer,t.options,t.url);e.postMessage({type:"process-done",id:t.id,result:r},G(r))}catch(r){e.postMessage({type:"process-error",id:t.id,message:r.message})}break;case"error":s(t.message)}}function te(e,t,r,s={},n={}){const i=function(e={}){const t={};return e.maxConcurrency&&(t.maxConcurrency=e.maxConcurrency),e.onDebug&&(t.onDebug=e.onDebug),Z||(Z=new Y({onMessage:ee})),Z.setProps(t),Z}(s);return s=JSON.parse(JSON.stringify(s)),i.process(e,`loaders.gl-${t}`,{arraybuffer:q(r),options:s,source:"loaders.gl",type:"process"})}let re=[];const se=/[^.]+$/;function ne(e,t="",r=null,{nothrow:s=!1}={}){if(t=t||"",e&&!Array.isArray(e)){const t=e;return O(t),t}(function(e){for(const t of e)O(t)})(e=e||re),t=t.replace(/\?.*/,"");let n=null;if(!(n=(n=n||function(e,t){const r=t.match(se),s=r&&r[0];return s&&function(e,t){t=t.toLowerCase();for(const r of e)for(const e of r.extensions)if(e.toLowerCase()===t)return r;return null}(e,s)}(e,t))||function(e,t){if(!t)return null;for(const r of e)if("string"==typeof t){if(ie(t,r))return r}else if(ArrayBuffer.isView(t)){if(oe(t.buffer,t.byteOffset,r))return r}else if(t instanceof ArrayBuffer){if(oe(t,0,r))return r}return null}(e,r))){if(s)return null;throw new Error(`No valid loader found for ${t}`)}return n}function ie(e,t){return t.testText&&t.testText(e)}function oe(e,t,r){switch(Array.isArray(r.test)?"array":typeof r.test){case"function":return r.test(e,r);case"string":case"array":return(Array.isArray(r.test)?r.test:[r.test]).some(r=>{return r===function(e,t,r){if(e.byteLength<=t+r)return"";const s=new DataView(e);let n="";for(let e=0;e<r;e++)n+=String.fromCharCode(s.getUint8(t+e));return n}(e,t,r.length)});default:return!1}}async function ue(e,t,r,s){!t||Array.isArray(t)||U(t)||(s=r,r=t,t=null),r=r||{};const n=function(e,t){return k(e)?t=t||e.url:C(t)&&(t=t.name),"string"==typeof t?t.replace(/\?.*/,""):t}(e,s),i=ne(t,n,e);r=S(r,i);const o=N({url:n,parse:ue});return await async function(e,t,r,s){if(t=await $(t,e),e.parseTextSync&&"string"==typeof t)return r.dataType="text",e.parseTextSync(t,r,s,e);if(e.parse)return await e.parse(t,r,s,e);if(e.parseSync)return e.parseSync(t,r,s,e);if(e.worker)return await te(e.worker,e.name,t,r,s);return L(!1)}(i,e,r,o)}async function ae(e,t,r){const n=t.getObjectExtension(e,s),i=t.getTypedArrayForBufferView(n.bufferView),o=new Uint8Array(i.buffer).subarray(i.byteOffset),u=new Uint8Array(o),a=await ue(u);e.attributes=B(a.attributes),a.indices&&(e.indices=R(a.indices)),function(e){if(!e.attributes&&Object.keys(e.attributes).length>0)throw new Error("Empty glTF primitive detected: Draco decompression failure?")}(e)}function fe(e,t,r=4,n={}){if(!n.DracoWriter||!n.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");const i=n.DracoWriter.encodeSync({attributes:e}),o=n.DracoLoader.parseSync({attributes:e}),u=n._addFauxAttributes(o.attributes),a=n.addBufferView(i);return{primitives:[{attributes:u,mode:r,extensions:{[s]:{bufferView:a,attributes:u}}}]}}const ce={KHR_draco_mesh_compression:class{static get name(){return s}static async decode(e,t={}){if(!t.decompress)return;const r=new v(e),n=[];for(const e of function*(e){for(const t of e.json.meshes||[])for(const e of t.primitives)yield e}(r))r.getObjectExtension(e,s)&&n.push(ae(e,r,t));await Promise.all(n),r.removeExtension(s)}static decodeSync(e,t){if(!t.decompress)return;if(new v(e).getRequiredExtension(s))throw new Error("Cannot synchronously decode Draco")}static encode(e,t={}){const r=new v(e);for(const e of r.json.meshes||[])fe(e,t),r.addRequiredExtension(s)}},KHR_lights_punctual:class{static get name(){return i}static decode(e,t){const r=new v(e),s=r.getExtension(i);s&&(r.json.lights=s.lights,r.removeExtension(i));for(const e of r.nodes||[]){const t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.light=r._get("lights",t.light),delete e.extensions.KHR_lights_punctual)}}static encode(e,t){const r=new v(e),{json:s}=r;if(s.lights){const e=r.addExtensions(i);o(!e.lights),e.lights=s.lights,delete s.lights}if(r.json.lights){for(const e of r.json.lights){const t=e.node;r.addObjectExtension(t,i,e)}delete r.json.lights}}}};function he(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const le=1735152710,ge=12,de=8,ye=1313821514,me=5130562,be=!0;function pe(e,t=0,r={}){const s=new DataView(e),{magic:n=le}=r,i=s.getUint32(t,!1);return i===n||i===le}function we(e,t,r=0,s={}){const n=new DataView(t);e.type=function(e,t=0){return`${String.fromCharCode(e.getUint8(t+0))}${String.fromCharCode(e.getUint8(t+1))}${String.fromCharCode(e.getUint8(t+2))}${String.fromCharCode(e.getUint8(t+3))}`}(n,r+0),e.version=n.getUint32(r+4,be);const i=n.getUint32(r+8,be);return e.header={byteOffset:r,byteLength:i},"glTF"!==e.type&&console.warn(`Invalid GLB magic string ${e.type}`),he(2===e.version,`Invalid GLB version ${e.version}. Only .glb v2 supported`),he(e.header.byteLength>ge+de),e.json={},e.hasBinChunk=!1,e.binChunks=[],function(e,t,r,s){for(;r+8<=e.header.byteLength;){const n=t.getUint32(r+0,be),i=t.getUint32(r+4,be);switch(r+=de,i){case ye:xe(e,t,r,n,s);break;case me:_e(e,t,r,n,s)}switch(i){case 0:s.strict||xe(e,t,r,n,s);break;case 1:s.strict||_e(e,t,r,n,s)}r+=j(n)}}(e,n,r+12,s),function(e){e.byteOffset=e.header.byteOffset,e.magic=e.header.magic,e.version=e.header.version,e.byteLength=e.header.byteLength,e.hasBinChunk=e.binChunks.length>=1,e.binChunkByteOffset=e.header.hasBinChunk?e.binChunks[0].byteOffset:0,e.binChunkLength=e.header.hasBinChunk?e.binChunks[0].byteLength:0}(e),r+e.header.byteLength}function xe(e,t,r,s,n){const i=new Uint8Array(t.buffer,r,s),o=new TextDecoder("utf8").decode(i);e.json=JSON.parse(o)}function _e(e,t,r,s,n){e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:r,byteLength:s,arrayBuffer:t.buffer})}const Te={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ae={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},je={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},Ee={magFilter:je.TEXTURE_MAG_FILTER,minFilter:je.TEXTURE_MIN_FILTER,wrapS:je.TEXTURE_WRAP_S,wrapT:je.TEXTURE_WRAP_T},ve={[je.TEXTURE_MAG_FILTER]:je.LINEAR,[je.TEXTURE_MIN_FILTER]:je.NEAREST_MIPMAP_LINEAR,[je.TEXTURE_WRAP_S]:je.REPEAT,[je.TEXTURE_WRAP_]:je.REPEAT};class Be{postProcess(e,t={}){const{json:r,buffers:s=[],images:n=[],baseUri:i=""}=e;return o(r),this.baseUri=i,this.json=r,this.buffers=s,this.images=n,this._resolveTree(this.json,t),this.json}_resolveTree(e,t={}){e.bufferViews&&(e.bufferViews=e.bufferViews.map((e,t)=>this._resolveBufferView(e,t))),e.images&&(e.images=e.images.map((e,r)=>this._resolveImage(e,r,t))),e.samplers&&(e.samplers=e.samplers.map((e,t)=>this._resolveSampler(e,t))),e.textures&&(e.textures=e.textures.map((e,t)=>this._resolveTexture(e,t))),e.accessors&&(e.accessors=e.accessors.map((e,t)=>this._resolveAccessor(e,t))),e.materials&&(e.materials=e.materials.map((e,t)=>this._resolveMaterial(e,t))),e.meshes&&(e.meshes=e.meshes.map((e,t)=>this._resolveMesh(e,t))),e.nodes&&(e.nodes=e.nodes.map((e,t)=>this._resolveNode(e,t))),e.skins&&(e.skins=e.skins.map((e,t)=>this._resolveSkin(e,t))),e.scenes&&(e.scenes=e.scenes.map((e,t)=>this._resolveScene(e,t))),void 0!==e.scene&&(e.scene=e.scenes[this.json.scene])}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.json[e]&&this.json[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){return e.id=e.id||`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e)),e}_resolveNode(e,t){return e.id=e.id||`node-${t}`,e.children&&(e.children=e.children.map(e=>this.getNode(e))),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin)),e}_resolveSkin(e,t){return e.id=e.id||`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices),e}_resolveMesh(e,t){return e.id=e.id||`mesh-${t}`,e.primitives&&(e.primitives=e.primitives.map(e=>{const t=(e={...e}).attributes;e.attributes={};for(const r in t)e.attributes[r]=this.getAccessor(t[r]);return void 0!==e.indices&&(e.indices=this.getAccessor(e.indices)),void 0!==e.material&&(e.material=this.getMaterial(e.material)),e})),e}_resolveMaterial(e,t){if(e.id=e.id||`material-${t}`,e.normalTexture&&(e.normalTexture={...e.normalTexture},e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlustionTexture={...e.occlustionTexture},e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emmisiveTexture={...e.emmisiveTexture},e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){e.pbrMetallicRoughness={...e.pbrMetallicRoughness};const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture={...t.baseColorTexture},t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture={...t.metallicRoughnessTexture},t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}return e}_resolveAccessor(e,t){var r,s;return e.id=e.id||`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=(r=e.componentType,Ae[r]),e.components=(s=e.type,Te[s]),e.bytesPerElement=e.bytesPerComponent*e.components,e}_resolveTexture(e,t){return e.id=e.id||`texture-${t}`,e.sampler="sampler"in e?this.getSampler(e.sampler):ve,e.source=this.getImage(e.source),e}_resolveSampler(e,t){e.id=e.id||`sampler-${t}`,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}return e}_enumSamplerParameter(e){return Ee[e]}_resolveImage(e,t,r){if(e.id=e.id||`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),"uri"in e){const s=this.images[t];s&&s.image&&(e.image=s.image,delete e.uri);const n=r.uri||this.baseUri;if(n){const t=e.uri;e.uri=y(e.uri,n),e.originalUri=t,e.baseUri=n,e.fullUri=e.uri}}return e.getImageAsync=()=>e.bufferView?new Promise(t=>{const r=this.getBufferView(e.bufferView),s=e.mimeType||"image/jpeg",n=new Blob([r.data],{type:s}),i=(self.URL||self.webkitURL).createObjectURL(n),o=new Image;o.onload=()=>t(o),o.src=i}):e.uri?new Promise(t=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>t(r),r.src=e.fullUri||e.uri}):null,e}_resolveBufferView(e,t){e.id=e.id||`bufferView-${t}`;const r=e.buffer;e.buffer=this.getBuffer(r);const s=this.buffers[r].arrayBuffer;let n=this.buffers[r].byteOffset||0;return"byteOffset"in e&&(n+=e.byteOffset),e.data=new Uint8Array(s,n,e.byteLength),e}_resolveCamera(e,t){return e.id=e.id||`camera-${t}`,e.perspective,e.orthographic,e}}function Re(e,t){return(new Be).postProcess(e,t)}const Le={fetchLinkedResources:!0,fetchImages:!1,createImages:!1,decompress:!1,postProcess:!1,log:console};async function Ue(e,t,r=0,s,n){Ve(e,t,r,s={...Le,...s.gltf});const i=[];if(s.fetchImages){const t=async function(e,t,r){const s=e.json.images||[],n=[];for(let r=0;r<s.length;++r){const i=s[r];"uri"in i&&n.push(Se(e,i,r,t))}return await Promise.all(n)}(e,s);i.push(t)}s.fetchLinkedResources&&await async function(e,t,r){for(let s=0;s<e.json.buffers.length;++s){const n=e.json.buffers[s];if(n.uri){if(!t.uri)return void console.warn("options.uri must be set to decode embedded glTF buffers");const{fetch:i}=r;o(i);const u=y(n.uri,t.uri),a=await i(u),f=await a.arrayBuffer();e.buffers[s]={arrayBuffer:f,byteOffset:0,byteLength:f.byteLength},delete n.uri}}}(e,s,n);const u=async function(e,t){for(const r in ce){if(!(r in t&&!t[r])){const s=ce[r];await s.decode(e,t)}}}(e,s);return i.push(u),await Promise.all(i),s.postProcess?Re(e,s):e}function Oe(e,t,r=0,s,n){return Ve(e,t,r,s={...Le,...s}),s.fetchLinkedResources&&function(e,t){for(const t of e.json.buffers||[])if(t.uri)throw new Error("parseGLTFSync: Cannot decode uri buffers")}(e),s.decodeExtensions&&function(e,t){for(const r in ce){if(!(r in t&&!t[r])){ce[r].decodeSync(e,t)}}}(e,s),s.postProcess?Re(e,s):e}function Ve(e,t,r,s){if(s.uri&&(e.baseUri=s.uri),t instanceof ArrayBuffer&&!pe(t,r,s)){t=(new TextDecoder).decode(t)}"string"==typeof t?e.json=JSON.parse(t):t instanceof ArrayBuffer?(e._glb={},r=we(e._glb,t,r,s),e.json=e._glb.json):e.json=t;const n=e.json.buffers||[];e.buffers=new Array(n.length).fill({}),e._glb&&e._glb.hasBinChunk&&(e.buffers[0]={arrayBuffer:e._glb.binChunks[0].arrayBuffer,byteOffset:e._glb.binChunks[0].byteOffset,byteLength:e._glb.binChunks[0].byteLength},e.json.buffers[0].data=e.buffers[0].arrayBuffer,e.json.buffers[0].byteOffset=e.buffers[0].byteOffset);const i=e.json.images||[];e.images=new Array(i.length).fill({})}async function Se(e,t,r,s,n){const i=y(t.uri,s.uri);e.images[r]=await new Promise((e,t)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>e(r),r.onerror=e=>t(e),r.src=i})}let ke="";const Ce={};function Pe(e){for(const t in Ce)if(e.startsWith(t)){const r=Ce[t];return e.replace(t,r)}return e+=ke}async function Me(e,t){return C(e)?I(e,t):(e=Pe(e),fetch(e,t))}P.a.TextEncoder;const Ie=P.a.TextDecoder;function De(e,t,r={}){return function e(t,r,s,n={}){const i=t;const o=function(e,t){const r=function(e){if("string"==typeof e){if(0===e.indexOf("##/"))return e.slice(1);let t=e.match(/#\/([a-z]+)\/([0-9]+)/);if(t){const e=parseInt(t[2],10);return[t[1],e]}if(t=e.match(/\$\$\$([0-9]+)/)){return["accessors",parseInt(t[1],10)]}}return null}(e);if(r){const[s,n]=r,i=t[s]&&t[s][n];if(i)return i;console.error(`Invalid JSON pointer ${e}: #/${s}/${n}`)}return null}(i,s);if(o)return o;if(Array.isArray(i))return i.map(t=>e(t,r,s,n));if(null!==i&&"object"==typeof i){const t={};for(const o in i)t[o]=e(i[o],r,s,n);return t}return i}(e,e,t,r)}function Fe(e,t,r){r&&(e=function(e,t){const r=e.byteLength-t,s=new ArrayBuffer(r),n=new Uint8Array(e),i=new Uint8Array(s);for(let e=0;e<r;e++)i[e]=n[t+e];return s}(e,r));const s=t.bufferViews||[];for(let e=0;e<s.length;++e){o(s[e].byteLength>=0)}return{accessors:$e(e,s,t),images:Ne(e,s,t)}}function $e(e,t,r){const s=r.accessors||[],n=[];for(let r=0;r<s.length;++r){const i=s[r];o(i);const u=t[i.bufferView];if(u){const{ArrayType:t,length:r}=d(i,u),s=new t(e,u.byteOffset,r);s.accessor=i,n.push(s)}}return n}function Ne(e,t,r){const s=r.images||[],n=[];for(let r=0;r<s.length;++r){const i=s[r];o(i);const u=t[i.bufferView];o(u);const a=new Uint8Array(e,u.byteOffset,u.byteLength);a.imate=i,n.push(a)}return n}class We{static isGLB(e,t={}){return pe(e,0)}parse(e,t={}){return this.parseSync(e,t)}parseSync(e,t={}){if(this.glbArrayBuffer=e,this.binaryByteOffset=null,this.packedJson=null,this.json=null,null===this.json&&null===this.binaryByteOffset){const e=0;we(this,this.glbArrayBuffer,e,t),this.binaryByteOffset=this.binChunkByteOffset,this.packedJson=this.json;const r=Fe(this.glbArrayBuffer,this.json,this.binaryByteOffset);this.json=De(this.json,r),this.unpackedBuffers=r}return this}getApplicationData(e){return this.json[e]}getJSON(){return this.json}getArrayBuffer(){return this.glbArrayBuffer}getBinaryByteOffset(){return this.binaryByteOffset}getBufferView(e){const t=(e.byteOffset||0)+this.binaryByteOffset;return new Uint8Array(this.glbArrayBuffer,t,e.byteLength)}getBuffer(e){const t=h[e.componentType],r=f[e.type],s=c[e.componentType],n=e.count*r,i=e.count*r*s,u=this.json.bufferViews[e.bufferView];o(i>=0&&e.byteOffset+i<=u.byteLength);const a=u.byteOffset+this.binaryByteOffset+e.byteOffset;return new t(this.glbArrayBuffer,a,n)}getImageData(e){return{typedArray:this.getBufferView(e.bufferView),mimeType:e.mimeType||"image/jpeg"}}getImage(e){const t=this.getBufferView(e.bufferView),r=e.mimeType||"image/jpeg",s=new Blob([t],{type:r}),n=(self.URL||self.webkitURL).createObjectURL(s),i=new Image;return i.src=n,i}getImageAsync(e){return new Promise(t=>{const r=this.getBufferView(e.bufferView),s=e.mimeType||"image/jpeg",n=new Blob([r],{type:s}),i=(self.URL||self.webkitURL).createObjectURL(n),o=new Image;o.onload=()=>t(o),o.src=i})}}const qe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ge={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Xe={TEXTURE_MAG_FILTER:10240,TEXTURE_MIN_FILTER:10241,TEXTURE_WRAP_S:10242,TEXTURE_WRAP_T:10243,REPEAT:10497,LINEAR:9729,NEAREST_MIPMAP_LINEAR:9986},ze={magFilter:Xe.TEXTURE_MAG_FILTER,minFilter:Xe.TEXTURE_MIN_FILTER,wrapS:Xe.TEXTURE_WRAP_S,wrapT:Xe.TEXTURE_WRAP_T},Je={[Xe.TEXTURE_MAG_FILTER]:Xe.LINEAR,[Xe.TEXTURE_MIN_FILTER]:Xe.NEAREST_MIPMAP_LINEAR,[Xe.TEXTURE_WRAP_S]:Xe.REPEAT,[Xe.TEXTURE_WRAP_]:Xe.REPEAT};class He{postProcess(e,t,r={}){return this.gltf=e,this.glbParser=t,this._resolveToTree(r),this.gltf}_resolveToTree(e={}){const{gltf:t}=this;return(t.bufferViews||[]).forEach((e,t)=>this._resolveBufferView(e,t)),(t.images||[]).forEach((t,r)=>this._resolveImage(t,r,e)),(t.samplers||[]).forEach((e,t)=>this._resolveSampler(e,t)),(t.textures||[]).forEach((e,t)=>this._resolveTexture(e,t)),(t.accessors||[]).forEach((e,t)=>this._resolveAccessor(e,t)),(t.materials||[]).forEach((e,t)=>this._resolveMaterial(e,t)),(t.meshes||[]).forEach((e,t)=>this._resolveMesh(e,t)),(t.nodes||[]).forEach((e,t)=>this._resolveNode(e,t)),(t.skins||[]).forEach((e,t)=>this._resolveSkin(e,t)),(t.scenes||[]).forEach((e,t)=>this._resolveScene(e,t)),void 0!==t.scene&&(t.scene=t.scenes[this.gltf.scene]),this._process_extension_KHR_lights_punctual(),t}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.gltf[e]&&this.gltf[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}_resolveScene(e,t){e.id=`scene-${t}`,e.nodes=(e.nodes||[]).map(e=>this.getNode(e))}_resolveNode(e,t){e.id=`node-${t}`,e.children=(e.children||[]).map(e=>this.getNode(e)),void 0!==e.mesh&&(e.mesh=this.getMesh(e.mesh)),void 0!==e.camera&&(e.camera=this.getCamera(e.camera)),void 0!==e.skin&&(e.skin=this.getSkin(e.skin))}_resolveSkin(e,t){e.id=`skin-${t}`,e.inverseBindMatrices=this.getAccessor(e.inverseBindMatrices)}_resolveMesh(e,t){e.id=`mesh-${t}`;for(const t of e.primitives){for(const e in t.attributes)t.attributes[e]=this.getAccessor(t.attributes[e]);void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material))}}_resolveMaterial(e,t){if(e.id=`material-${t}`,e.normalTexture&&(e.normalTexture.texture=this.getTexture(e.normalTexture.index)),e.occlusionTexture&&(e.occlusionTexture.texture=this.getTexture(e.occlusionTexture.index)),e.emissiveTexture&&(e.emissiveTexture.texture=this.getTexture(e.emissiveTexture.index)),e.pbrMetallicRoughness){const t=e.pbrMetallicRoughness;t.baseColorTexture&&(t.baseColorTexture.texture=this.getTexture(t.baseColorTexture.index)),t.metallicRoughnessTexture&&(t.metallicRoughnessTexture.texture=this.getTexture(t.metallicRoughnessTexture.index))}}_resolveAccessor(e,t){e.id=`accessor-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView)),e.bytesPerComponent=Ge[e],e.components=qe[e],e.bytesPerElement=e.bytesPerComponent*e.components}_resolveTexture(e,t){e.id=`texture-${t}`,e.sampler="sampler"in e?this.getSampler(e.sampler):Je,e.source=this.getImage(e.source)}_resolveSampler(e,t){e.id=`sampler-${t}`,e.parameters={};for(const t in e){const r=this._enumSamplerParameter(t);void 0!==r&&(e.parameters[r]=e[t])}}_enumSamplerParameter(e){return ze[e]}_resolveImage(e,t,r){e.id=`image-${t}`,void 0!==e.bufferView&&(e.bufferView=this.getBufferView(e.bufferView));const{createImages:s=!0}=r;s?e.image=this.glbParser.getImage(e):e.getImageAsync=()=>this.glbParser?this.glbParser.getImageAsync(e):e.uri?new Promise(t=>{const s=new Image;s.crossOrigin="anonymous",s.onload=()=>t(s),s.src=y(e.uri,r.uri)}):null}_resolveBufferView(e,t){if(e.id=`bufferView-${t}`,e.buffer=this.getBuffer(e.buffer),this.glbParser)e.data=this.glbParser.getBufferView(e);else{const t=e.byteOffset||0;e.data=new Uint8Array(e.buffer.data,t,e.byteLength)}}_resolveCamera(e){e.perspective,e.orthographic}_process_extension_KHR_lights_punctual(){const{gltf:e}=this,t=e.extensions&&e.extensions.KHR_lights_punctual;t&&(e.lights=t.lights),this._removeExtension("KHR_lights_punctual");for(const t of e.nodes||[]){const e=t.extensions&&t.extensions.KHR_lights_punctual;e&&(t.light=this._get("lights",e.light),delete t.extensions.KHR_lights_punctual)}delete e.lights}_removeExtension(e){this.gltf.extensionsRequired&&this._removeStringFromArray(this.gltf.extensionsRequired,e),this.gltf.extensionsUsed&&this._removeStringFromArray(this.gltf.extensionsUsed,e),this.gltf.extensions&&delete this.gltf.extensions[e]}_removeStringFromArray(e,t){let r=!0;for(;r;){const s=e.indexOf(t);s>-1?e.splice(s,1):r=!1}}}const Ke={fetchLinkedResources:!0,fetch:Me,decompress:!1,DracoLoader:null,postProcess:!0,createImages:!1,log:console};class Qe{async parse(e,t={}){if(t=Object.assign({},Ke,t),this.parseSync(e,{...t,postProcess:!1,decompress:!1}),t.fetchLinkedResources&&await this._loadLinkedAssets(t),t.decompress&&this._decompressMeshes(t),t.postProcess){(new He).postProcess(this.gltf,this.glbParser,t)}return this.gltf}parseSync(e,t={}){if(t=Object.assign({},Ke,t),e instanceof ArrayBuffer&&!We.isGLB(e,t)){e=(new Ie).decode(e)}if("string"==typeof e&&(e=JSON.parse(e)),e instanceof ArrayBuffer?(this.glbParser=new We,this.gltf=this.glbParser.parseSync(e).json,this.json=this.gltf):(this.glbParser=null,this.gltf=e,this.json=e),t.decompress&&this._decompressMeshes(t),t.postProcess){(new He).postProcess(this.gltf,this.glbParser,t)}return this.gltf}getApplicationData(e){return this.json[e]}getExtraData(e){return(this.json.extras||{})[e]}getExtension(e){const t=this.getUsedExtensions().find(t=>t===e),r=this.json.extensions||{};return t?r[e]||!0:null}getRequiredExtension(e){return this.getRequiredExtensions().find(t=>t===e)?this.getExtension(e):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getScene(e){return this._get("scenes",e)}getNode(e){return this._get("nodes",e)}getSkin(e){return this._get("skins",e)}getMesh(e){return this._get("meshes",e)}getMaterial(e){return this._get("materials",e)}getAccessor(e){return this._get("accessors",e)}getCamera(e){return null}getTexture(e){return this._get("textures",e)}getSampler(e){return this._get("samplers",e)}getImage(e){return this._get("images",e)}getBufferView(e){return this._get("bufferViews",e)}getBuffer(e){return this._get("buffers",e)}_get(e,t){if("object"==typeof t)return t;const r=this.gltf[e]&&this.gltf[e][t];return r||console.warn(`glTF file error: Could not find ${e}[${t}]`),r}async _loadLinkedAssets(e){return await Promise.all(this.gltf.buffers.map(t=>this._loadBuffer(t,e)))}async _loadBuffer(e,t){if(e.uri&&t.uri){const r=t.fetch||window.fetch,s=y(e.uri,t.uri),n=await r(s),i=await n.arrayBuffer();e.data=i,e.uri=null}}_decompressMeshes(e){if(e.DracoLoader&&e.decompress){for(const t of this.gltf.meshes||[])for(const r of t.primitives)if(this._decompressKhronosDracoPrimitive(r,e),this._decompressUberDracoPrimitive(r,e),!r.attributes||0===Object.keys(r.attributes).length)throw new Error("Empty glTF primitive: decompression failure?");this._removeExtension(s),this._removeExtension(n)}}_decompressKhronosDracoPrimitive(e,t){const r=e.extensions&&e.extensions[s];if(!r)return;delete e.extensions[s];const n=this._getBufferViewArray(r.bufferView),i=t.DracoLoader.parseSync(n);e.attributes=B(i.attributes),i.indices&&(e.indices=R(i.indices))}_decompressUberDracoPrimitive(e,t){const r=e.extensions&&e.extensions[n];if(!r)return;if(0!==e.mode)throw new Error(n);delete e.extensions[n];const s=this._getBufferViewArray(r.bufferView),i=t.DracoLoader.parseSync(s);e.attributes=i.attributes}_getBufferViewArray(e){const t=this.gltf.bufferViews[e];if(this.glbParser)return this.glbParser.getBufferView(t);const r=this.gltf.buffers[t.buffer].data,s=t.byteOffset||0;return new Uint8Array(r,s,t.byteLength)}_removeExtension(e){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,e),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,e),this.json.extensions&&delete this.json.extensions[e]}_removeStringFromArray(e,t){let r=!0;for(;r;){const s=e.indexOf(t);s>-1?e.splice(s,1):r=!1}}}const Ye={gltf:{parserVersion:1},uri:""};var Ze={name:"glTF",extensions:["gltf","glb"],mimeType:"model/gltf+json",text:!0,binary:!0,test:"glTF",parse:async function(e,t={},r){if(2!==(t={...Ye,...t}).gltf.parserVersion&&!1!==t.useGLTFParser){return(new Qe).parse(e,t)}const{byteOffset:s=0}=t;return await Ue({},e,s,t,r)},parseSync:function(e,t={},r){if(2!==(t={...Ye,...t}).gltf.parserVersion&&!1!==t.useGLTFParser)return(new Qe).parseSync(e,t);const{byteOffset:s=0}=t;return Oe({},e,s,t)},defaultOptions:Ye};function et(e,t,r,s){const n=j(r.byteLength),i=n-r.byteLength;if(e){const s=new Uint8Array(e.buffer,e.byteOffset+t,r.byteLength),n=new Uint8Array(r);s.set(n);for(let s=0;s<i;++s)e.setUint8(t+r.byteLength+s,32)}return t+=n}const tt=1179937895,rt=1313821514,st=5130562,nt=!0;function it(e,t,r=0,s={}){const{magic:n=tt,version:i=2,json:o={},binary:u}=e,a=r;t&&(t.setUint32(r+0,n,nt),t.setUint32(r+4,i,nt),t.setUint32(r+8,0,nt));const f=r+8,c=r+=12;if(t&&(t.setUint32(r+0,0,nt),t.setUint32(r+4,rt,nt)),r=function(e,t,r,s){return t=et(e,t,(new TextEncoder).encode(r))}(t,r+=8,JSON.stringify(o)),t){const e=r-c-8;t.setUint32(c+0,e,nt)}if(u){const e=r;if(t&&(t.setUint32(r+0,0,nt),t.setUint32(r+4,st,nt)),r=et(t,r+=8,u),t){const s=r-e-8;t.setUint32(e+0,s,nt)}}if(t){const e=r-a;t.setUint32(f,e,nt)}return r}function ot(e,t,r,s){return function(e,{firstBuffer:t=0}={}){if(e.buffers&&e.buffers.length>t)throw new Error("encodeGLTF: multiple buffers not yet implemented")}(e),it(e,t,r,s)}var ut={name:"glTF",extensions:["glb"],mimeType:"model/gltf+json",encodeSync:function(e,t={}){const{byteOffset:r=0}=t,s=ot(e,null,r,t),n=new ArrayBuffer(s),i=new DataView(n);return ot(e,i,r,t),n},binary:!0,defaultOptions:{useGLTFBuilder:!0}};var at={name:"GLB",extensions:["glb"],mimeType:"model/gltf-binary",binary:!0,parse:async(e,t)=>ft(e,t),parseSync:ft,defaultOptions:{strict:!1}};function ft(e,t){const{byteOffset:r=0}=t,s={};return we(s,e,r,t),s}var ct={name:"GLB",extensions:["glb"],mimeType:"model/gltf-binary",encodeSync:function(e,t){const{byteOffset:r=0}=t,s=it(e,null,r,t),n=new ArrayBuffer(s),i=new DataView(n);return it(e,i,r,t),n},binary:!0};function ht(e,t=Float32Array){if(0===e.length)return new Float32Array(0);if(!function e(t,r=Number.isFinite){let s=-1;for(;++s<t.length;){const n=t[s];if(Array.isArray(n)||ArrayBuffer.isView(n)){if(!e(n,r))return!1}else if(!r(n))return!1}return!0}(e))return null;const r=new t(function e(t,r=3){let s=0;let n=0;let i=-1;for(;++i<t.length;){const r=t[i];Array.isArray(r)||ArrayBuffer.isView(r)?s+=e(r):n++}return s+(0===s&&n<r?r:n)}(e));return function(e,t,r=3){(function e(t,r,s,n){let i=-1;let o=0;for(;++i<t.length;){const u=t[i];Array.isArray(u)||ArrayBuffer.isView(u)?n=e(u,r,s,n):o<s&&(r[n++]=u,o++)}o>0&&o<s&&(r[n++]=0);return n})(e,t,r,0)}(e,r),r}function lt(e,t,r={}){const{flattenArrays:s=!1}=r;let n=e;if("string"==typeof n&&0===n.indexOf("#/"))return`#${n}`;if(Array.isArray(n)){const e=s&&ht(n);if(!e)return n.map(e=>lt(e,t,r));n=e}if(ArrayBuffer.isView(n)&&t){if(t.isImage(n)){return`#/images/${t.addImage(n)}`}return`#/accessors/${t.addBuffer(n)}`}if(null!==n&&"object"==typeof n){const e={};for(const s in n)e[s]=lt(n[s],t,r);return e}return n}class gt{constructor(e={}){this.byteLength=0,this.json={buffers:[{byteLength:0}],bufferViews:[],accessors:[],images:[],meshes:[]},this.sourceBuffers=[],this.log=e.log||console}getByteLength(){return this.byteLength}isImage(e){return function(e,t){if(t){const{test:r}=T(t);return r(A(e))}return Boolean(x(e))}(e)}encodeSync(e={}){return this.encodeAsGLB(e)}encodeAsGLB(e={}){this._packBinaryChunk(),e.magic&&console.warn("Custom glTF magic number no longer supported");const t={version:2,json:this.json,binary:this.arrayBuffer},r=it(t,null,0,e),s=new ArrayBuffer(r);return it(t,new DataView(s),0,e),s}addApplicationData(e,t,r={}){const s=r.packTypedArrays?lt(t,this,r):t;return this.json[e]=s,this}addBuffer(e,t={size:3}){const r=this.addBufferView(e),s={size:t.size,componentType:g(e),count:Math.round(e.length/t.size)};return this.addAccessor(r,Object.assign(s,t))}addBufferView(e){const t=e.byteLength||e.length;return this.json.bufferViews.push({buffer:0,byteOffset:this.byteLength,byteLength:t}),this.byteLength+=j(t),this.sourceBuffers.push(e),this.json.bufferViews.length-1}addAccessor(e,t){return this.json.accessors.push({bufferView:e,type:l(t.size),componentType:t.componentType,count:t.count}),this.json.accessors.length-1}_pack(){return this._packBinaryChunk(),{arrayBuffer:this.arrayBuffer,json:this.json}}_packBinaryChunk(){if(this.arrayBuffer)return;const e=this.byteLength,t=new ArrayBuffer(e),r=new Uint8Array(t);let s=0;for(let e=0;e<this.sourceBuffers.length;e++){s=E(this.sourceBuffers[e],r,s)}this.json.buffers[0].byteLength=e,this.arrayBuffer=t,this.sourceBuffers=[]}_getInternalCounts(){return{buffers:this.json.buffers.length,bufferViews:this.json.bufferViews.length,accessors:this.json.accessors.length,images:this.json.images.length}}}class dt extends gt{constructor(e={}){super(e),this.DracoWriter=e.DracoWriter,this.DracoLoader=e.DracoLoader}addApplicationData(e,t,r={}){const s=r.packTypedArrays?lt(t,this,r):t;return this.json[e]=s,this}addExtraData(e,t,r={}){const s=r.packedTypedArrays?lt(t,this,r):t;return this.json.extras=this.json.extras||{},this.json.extras[e]=s,this}addExtension(e,t,r={}){o(t);const s=r.packTypedArrays?lt(t,this,r):t;return this.json.extensions=this.json.extensions||{},this.json.extensions[e]=s,this.registerUsedExtension(e),this}addRequiredExtension(e,t,r={}){o(t);const s=r.packTypedArrays?lt(t,this,r):t;return this.addExtension(e,s),this.registerRequiredExtension(e),this}registerUsedExtension(e){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find(t=>t===e)||this.json.extensionsUsed.push(e)}registerRequiredExtension(e){this.registerUsedExtension(e),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find(t=>t===e)||this.json.extensionsRequired.push(e)}addMesh(e,t,r=4){const s={primitives:[{attributes:this._addAttributes(e),indices:t,mode:r}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addPointCloud(e){const t={primitives:[{attributes:this._addAttributes(e),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(t),this.json.meshes.length-1}addCompressedMesh(e,t,r=4){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");this.registerRequiredExtension(s);const n=this.DracoWriter.encodeSync({attributes:e}),i=this.DracoLoader.parseSync({attributes:e}),o=this._addFauxAttributes(i.attributes),u=this.addBufferView(n),a={primitives:[{attributes:o,mode:r,extensions:{[s]:{bufferView:u,attributes:o}}}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(a),this.json.meshes.length-1}addCompressedPointCloud(e){if(!this.DracoWriter||!this.DracoLoader)throw new Error("DracoWriter/DracoLoader not available");e.mode=0;const t=this.DracoWriter.encodeSync(e,{pointcloud:!0}),r=this.addBufferView(t),s={primitives:[{attributes:{},mode:0,extensions:{[n]:{bufferView:r}}}]};return this.registerRequiredExtension(n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(s),this.json.meshes.length-1}addImage(e){const t=this.addBufferView(e),r=_(e)||{};if(r){const{mimeType:e,width:s,height:n}=r;this.json.images.push({bufferView:t,mimeType:e,width:s,height:n})}else this.json.images.push({bufferView:t});return this.json.images.length-1}}r.d(t,"KHR_DRACO_MESH_COMPRESSION",function(){return s}),r.d(t,"UBER_POINT_CLOUD_EXTENSION",function(){return n}),r.d(t,"GLTFLoader",function(){return Ze}),r.d(t,"GLTFWriter",function(){return ut}),r.d(t,"GLBLoader",function(){return at}),r.d(t,"GLBWriter",function(){return ct}),r.d(t,"GLTFScenegraph",function(){return v}),r.d(t,"postProcessGLTF",function(){return Re}),r.d(t,"parseGLTFSync",function(){return Oe}),r.d(t,"encodeGLTFSync",function(){return ot}),r.d(t,"packBinaryJson",function(){return lt}),r.d(t,"unpackBinaryJson",function(){return De}),r.d(t,"GLBParser",function(){return We}),r.d(t,"GLBBuilder",function(){return gt}),r.d(t,"GLTFParser",function(){return Qe}),r.d(t,"GLTFBuilder",function(){return dt})}])});
{
"name": "@loaders.gl/gltf",
"version": "1.3.1",
"version": "1.3.2",
"description": "Framework-independent loader for the glTF format",

@@ -41,7 +41,7 @@ "license": "MIT",

"dependencies": {
"@loaders.gl/core": "1.3.1",
"@loaders.gl/images": "1.3.1",
"@loaders.gl/loader-utils": "1.3.1"
"@loaders.gl/core": "1.3.2",
"@loaders.gl/images": "1.3.2",
"@loaders.gl/loader-utils": "1.3.2"
},
"gitHead": "d1e0103b82f81c574f7acba46b645ab9d74e3f06"
"gitHead": "752b1c06ebdfdb1daf4bc54a5bfb6c2b8c877065"
}

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc