@vctrl/hooks 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -4
- package/index.cjs.js +1 -1
- package/index.d.ts +1 -0
- package/index.es.js +4 -2
- package/model-context-CjwVhPEC.cjs +9 -0
- package/model-context-DJcsllu0.js +3377 -0
- package/package.json +1 -1
- package/three.module-C5-FOeun.cjs +3841 -0
- package/three.module-MSVrkZDe.js +16071 -0
- package/use-load-model/event-system.d.ts +3 -3
- package/use-load-model/model-context.d.ts +23 -7
- package/use-load-model/types.d.ts +12 -10
- package/use-load-model/use-load-model.d.ts +13 -6
- package/use-load-model.cjs.js +1 -1
- package/use-load-model.es.js +1 -1
- package/use-optimize-model/index.d.ts +1 -0
- package/use-optimize-model/use-optimize-model.d.ts +9 -0
- package/use-optimize-model-D1qG_kQN.js +11218 -0
- package/use-optimize-model-D7TsYCC3.cjs +37 -0
- package/use-optimize-model.cjs.js +1 -0
- package/use-optimize-model.es.js +4 -0
- package/model-context-ClI5AGc8.js +0 -19136
- package/model-context-mPTTbSMx.cjs +0 -3849
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";const _r=require("react"),O=require("./three.module-C5-FOeun.cjs");let At,zt,Ye,mt;function qt(s,e=1/0,t=null){zt||(zt=new O.PlaneGeometry(2,2,1,1)),Ye||(Ye=new O.ShaderMaterial({uniforms:{blitTexture:new O.Uniform(s)},vertexShader:`
|
|
2
|
+
varying vec2 vUv;
|
|
3
|
+
void main(){
|
|
4
|
+
vUv = uv;
|
|
5
|
+
gl_Position = vec4(position.xy * 1.0,0.,.999999);
|
|
6
|
+
}`,fragmentShader:`
|
|
7
|
+
uniform sampler2D blitTexture;
|
|
8
|
+
varying vec2 vUv;
|
|
9
|
+
|
|
10
|
+
void main(){
|
|
11
|
+
gl_FragColor = vec4(vUv.xy, 0, 1);
|
|
12
|
+
|
|
13
|
+
#ifdef IS_SRGB
|
|
14
|
+
gl_FragColor = sRGBTransferOETF( texture2D( blitTexture, vUv) );
|
|
15
|
+
#else
|
|
16
|
+
gl_FragColor = texture2D( blitTexture, vUv);
|
|
17
|
+
#endif
|
|
18
|
+
}`})),Ye.uniforms.blitTexture.value=s,Ye.defines.IS_SRGB=s.colorSpace==O.SRGBColorSpace,Ye.needsUpdate=!0,mt||(mt=new O.Mesh(zt,Ye),mt.frustumCulled=!1);const r=new O.PerspectiveCamera,n=new O.Scene;n.add(mt),t===null&&(t=At=new O.WebGLRenderer({antialias:!1}));const i=Math.min(s.image.width,e),o=Math.min(s.image.height,e);t.setSize(i,o),t.clear(),t.render(n,r);const a=document.createElement("canvas"),c=a.getContext("2d");a.width=i,a.height=o,c.drawImage(t.domElement,0,0,i,o);const u=new O.CanvasTexture(a);return u.minFilter=s.minFilter,u.magFilter=s.magFilter,u.wrapS=s.wrapS,u.wrapT=s.wrapT,u.name=s.name,At&&(At.forceContextLoss(),At.dispose(),At=null),u}const Xs={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class Ts{constructor(){this.pluginCallbacks=[],this.register(function(e){return new Yr(e)}),this.register(function(e){return new zr(e)}),this.register(function(e){return new $r(e)}),this.register(function(e){return new ei(e)}),this.register(function(e){return new ti(e)}),this.register(function(e){return new si(e)}),this.register(function(e){return new qr(e)}),this.register(function(e){return new Qr(e)}),this.register(function(e){return new Zr(e)}),this.register(function(e){return new ni(e)}),this.register(function(e){return new ri(e)}),this.register(function(e){return new ii(e)}),this.register(function(e){return new oi(e)}),this.register(function(e){return new ai(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,n){const i=new Wr,o=[];for(let a=0,c=this.pluginCallbacks.length;a<c;a++)o.push(this.pluginCallbacks[a](i));i.setPlugins(o),i.write(e,t,n).catch(r)}parseAsync(e,t){const r=this;return new Promise(function(n,i){r.parse(e,n,i,t)})}}const P={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},Qt="KHR_mesh_quantization",re={};re[O.NearestFilter]=P.NEAREST;re[O.NearestMipmapNearestFilter]=P.NEAREST_MIPMAP_NEAREST;re[O.NearestMipmapLinearFilter]=P.NEAREST_MIPMAP_LINEAR;re[O.LinearFilter]=P.LINEAR;re[O.LinearMipmapNearestFilter]=P.LINEAR_MIPMAP_NEAREST;re[O.LinearMipmapLinearFilter]=P.LINEAR_MIPMAP_LINEAR;re[O.ClampToEdgeWrapping]=P.CLAMP_TO_EDGE;re[O.RepeatWrapping]=P.REPEAT;re[O.MirroredRepeatWrapping]=P.MIRRORED_REPEAT;const Ws={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},vr=new O.Color,Ys=12,Ur=1179937895,Kr=2,zs=8,Jr=1313821514,Vr=5130562;function lt(s,e){return s.length===e.length&&s.every(function(t,r){return t===e[r]})}function kr(s){return new TextEncoder().encode(s).buffer}function jr(s){return lt(s.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Xr(s,e,t){const r={min:new Array(s.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(s.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let n=e;n<e+t;n++)for(let i=0;i<s.itemSize;i++){let o;s.itemSize>4?o=s.array[n*s.itemSize+i]:(i===0?o=s.getX(n):i===1?o=s.getY(n):i===2?o=s.getZ(n):i===3&&(o=s.getW(n)),s.normalized===!0&&(o=O.MathUtils.normalize(o,s.array))),r.min[i]=Math.min(r.min[i],o),r.max[i]=Math.max(r.max[i],o)}return r}function _n(s){return Math.ceil(s/4)*4}function Zt(s,e=0){const t=_n(s.byteLength);if(t!==s.byteLength){const r=new Uint8Array(t);if(r.set(new Uint8Array(s)),e!==0)for(let n=s.byteLength;n<t;n++)r[n]=e;return r.buffer}return s}function qs(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function Qs(s,e){if(s.toBlob!==void 0)return new Promise(r=>s.toBlob(r,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),s.convertToBlob({type:e,quality:t})}let Wr=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+O.REVISION}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const n=this,i=n.buffers,o=n.json;r=n.options;const a=n.extensionsUsed,c=n.extensionsRequired,u=new Blob(i,{type:"application/octet-stream"}),f=Object.keys(a),B=Object.keys(c);if(f.length>0&&(o.extensionsUsed=f),B.length>0&&(o.extensionsRequired=B),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=u.size),r.binary===!0){const A=new FileReader;A.readAsArrayBuffer(u),A.onloadend=function(){const l=Zt(A.result),h=new DataView(new ArrayBuffer(zs));h.setUint32(0,l.byteLength,!0),h.setUint32(4,Vr,!0);const g=Zt(kr(JSON.stringify(o)),32),d=new DataView(new ArrayBuffer(zs));d.setUint32(0,g.byteLength,!0),d.setUint32(4,Jr,!0);const p=new ArrayBuffer(Ys),y=new DataView(p);y.setUint32(0,Ur,!0),y.setUint32(4,Kr,!0);const T=Ys+d.byteLength+g.byteLength+h.byteLength+l.byteLength;y.setUint32(8,T,!0);const I=new Blob([p,d,g,h,l],{type:"application/octet-stream"}),E=new FileReader;E.readAsArrayBuffer(I),E.onloadend=function(){t(E.result)}}}else if(o.buffers&&o.buffers.length>0){const A=new FileReader;A.readAsDataURL(u),A.onloadend=function(){const l=A.result;o.buffers[0].uri=l,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const r=this.options,n=this.extensionsUsed;try{const i=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&i.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in i.gltfExtensions)t.extensions[o]=i.gltfExtensions[o],n[o]=!0;delete i.gltfExtensions}Object.keys(i).length>0&&(t.extras=i)}catch(i){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+i.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const n=new Map;n.set(!0,this.uid++),n.set(!1,this.uid++),this.uids.set(e,n)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new O.Vector3;for(let n=0,i=e.count;n<i;n++)if(Math.abs(r.fromBufferAttribute(e,n).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),n=new O.Vector3;for(let i=0,o=r.count;i<o;i++)n.fromBufferAttribute(r,i),n.x===0&&n.y===0&&n.z===0?n.setX(1):n.normalize(),r.setXYZ(i,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1;const n={};(t.offset.x!==0||t.offset.y!==0)&&(n.offset=t.offset.toArray(),r=!0),t.rotation!==0&&(n.rotation=t.rotation,r=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function r(l){return l.colorSpace===O.SRGBColorSpace?function(g){return g<.04045?g*.0773993808:Math.pow(g*.9478672986+.0521327014,2.4)}:function(g){return g}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof O.CompressedTexture&&(e=qt(e)),t instanceof O.CompressedTexture&&(t=qt(t));const n=e?e.image:null,i=t?t.image:null,o=Math.max(n?n.width:0,i?i.width:0),a=Math.max(n?n.height:0,i?i.height:0),c=qs();c.width=o,c.height=a;const u=c.getContext("2d",{willReadFrequently:!0});u.fillStyle="#00ffff",u.fillRect(0,0,o,a);const f=u.getImageData(0,0,o,a);if(n){u.drawImage(n,0,0,o,a);const l=r(e),h=u.getImageData(0,0,o,a).data;for(let g=2;g<h.length;g+=4)f.data[g]=l(h[g]/256)*256}if(i){u.drawImage(i,0,0,o,a);const l=r(t),h=u.getImageData(0,0,o,a).data;for(let g=1;g<h.length;g+=4)f.data[g]=l(h[g]/256)*256}u.putImageData(f,0,0);const A=(e||t).clone();return A.source=new O.Source(c),A.colorSpace=O.NoColorSpace,A.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),A}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,n,i){const o=this.json;o.bufferViews||(o.bufferViews=[]);let a;switch(t){case P.BYTE:case P.UNSIGNED_BYTE:a=1;break;case P.SHORT:case P.UNSIGNED_SHORT:a=2;break;default:a=4}let c=e.itemSize*a;i===P.ARRAY_BUFFER&&(c=Math.ceil(c/4)*4);const u=_n(n*c),f=new DataView(new ArrayBuffer(u));let B=0;for(let h=r;h<r+n;h++){for(let g=0;g<e.itemSize;g++){let d;e.itemSize>4?d=e.array[h*e.itemSize+g]:(g===0?d=e.getX(h):g===1?d=e.getY(h):g===2?d=e.getZ(h):g===3&&(d=e.getW(h)),e.normalized===!0&&(d=O.MathUtils.normalize(d,e.array))),t===P.FLOAT?f.setFloat32(B,d,!0):t===P.INT?f.setInt32(B,d,!0):t===P.UNSIGNED_INT?f.setUint32(B,d,!0):t===P.SHORT?f.setInt16(B,d,!0):t===P.UNSIGNED_SHORT?f.setUint16(B,d,!0):t===P.BYTE?f.setInt8(B,d):t===P.UNSIGNED_BYTE&&f.setUint8(B,d),B+=a}B%c!==0&&(B+=c-B%c)}const A={buffer:this.processBuffer(f.buffer),byteOffset:this.byteOffset,byteLength:u};return i!==void 0&&(A.target=i),i===P.ARRAY_BUFFER&&(A.byteStride=c),this.byteOffset+=u,o.bufferViews.push(A),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(n){const i=new FileReader;i.readAsArrayBuffer(e),i.onloadend=function(){const o=Zt(i.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,n(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,n){const i=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=P.FLOAT;else if(e.array.constructor===Int32Array)a=P.INT;else if(e.array.constructor===Uint32Array)a=P.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=P.SHORT;else if(e.array.constructor===Uint16Array)a=P.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=P.BYTE;else if(e.array.constructor===Uint8Array)a=P.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),(n===void 0||n===1/0)&&(n=e.count),n===0)return null;const c=Xr(e,r,n);let u;t!==void 0&&(u=e===t.index?P.ELEMENT_ARRAY_BUFFER:P.ARRAY_BUFFER);const f=this.processBufferView(e,a,r,n,u),B={bufferView:f.id,byteOffset:f.byteOffset,componentType:a,count:n,max:c.max,min:c.min,type:o[e.itemSize]};return e.normalized===!0&&(B.normalized=!0),i.accessors||(i.accessors=[]),i.accessors.push(B)-1}processImage(e,t,r,n="image/png"){if(e!==null){const i=this,o=i.cache,a=i.json,c=i.options,u=i.pending;o.images.has(e)||o.images.set(e,{});const f=o.images.get(e),B=n+":flipY/"+r.toString();if(f[B]!==void 0)return f[B];a.images||(a.images=[]);const A={mimeType:n},l=qs();l.width=Math.min(e.width,c.maxTextureSize),l.height=Math.min(e.height,c.maxTextureSize);const h=l.getContext("2d",{willReadFrequently:!0});if(r===!0&&(h.translate(0,l.height),h.scale(1,-1)),e.data!==void 0){t!==O.RGBAFormat&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const d=new Uint8ClampedArray(e.height*e.width*4);for(let p=0;p<d.length;p+=4)d[p+0]=e.data[p+0],d[p+1]=e.data[p+1],d[p+2]=e.data[p+2],d[p+3]=e.data[p+3];h.putImageData(new ImageData(d,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)h.drawImage(e,0,0,l.width,l.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");c.binary===!0?u.push(Qs(l,n).then(d=>i.processBufferViewImage(d)).then(d=>{A.bufferView=d})):l.toDataURL!==void 0?A.uri=l.toDataURL(n):u.push(Qs(l,n).then(d=>new FileReader().readAsDataURL(d)).then(d=>{A.uri=d}));const g=a.images.push(A)-1;return f[B]=g,g}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:re[e.magFilter],minFilter:re[e.minFilter],wrapS:re[e.wrapS],wrapT:re[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const r=this.options,n=this.cache,i=this.json;if(n.textures.has(e))return n.textures.get(e);i.textures||(i.textures=[]),e instanceof O.CompressedTexture&&(e=qt(e,r.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(u){u.writeTexture&&u.writeTexture(e,a)});const c=i.textures.push(a)-1;return n.textures.set(e,c),c}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const n={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const i=e.color.toArray().concat([e.opacity]);if(lt(i,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=i),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),c={index:this.processTexture(a),channel:a.channel};this.applyTextureTransform(c,a),n.pbrMetallicRoughness.metallicRoughnessTexture=c}if(e.map){const a={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const u={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(u,e.emissiveMap),n.emissiveTexture=u}}if(e.normalMap){const a={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),n.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a}e.transparent?n.alphaMode="BLEND":e.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===O.DoubleSide&&(n.doubleSided=!0),e.name!==""&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,n)});const o=r.materials.push(n)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(let I=0,E=e.material.length;I<E;I++)n.push(e.material[I].uuid);else n.push(e.material.uuid);const i=n.join(":");if(t.meshes.has(i))return t.meshes.get(i);const o=e.geometry;let a;e.isLineSegments?a=P.LINES:e.isLineLoop?a=P.LINE_LOOP:e.isLine?a=P.LINE_STRIP:e.isPoints?a=P.POINTS:a=e.material.wireframe?P.LINES:P.TRIANGLES;const c={},u={},f=[],B=[],A={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},l=o.getAttribute("normal");l!==void 0&&!this.isNormalizedNormalAttribute(l)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(l)));let h=null;for(let I in o.attributes){if(I.slice(0,5)==="morph")continue;const E=o.attributes[I];if(I=A[I]||I.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(I)||(I="_"+I),t.attributes.has(this.getUID(E))){u[I]=t.attributes.get(this.getUID(E));continue}h=null;const C=E.array;I==="JOINTS_0"&&!(C instanceof Uint16Array)&&!(C instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),h=new O.BufferAttribute(new Uint16Array(C),E.itemSize,E.normalized));const x=this.processAccessor(h||E,o);x!==null&&(I.startsWith("_")||this.detectMeshQuantization(I,E),u[I]=x,t.attributes.set(this.getUID(E),x))}if(l!==void 0&&o.setAttribute("normal",l),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const I=[],E=[],m={};if(e.morphTargetDictionary!==void 0)for(const C in e.morphTargetDictionary)m[e.morphTargetDictionary[C]]=C;for(let C=0;C<e.morphTargetInfluences.length;++C){const x={};let F=!1;for(const M in o.morphAttributes){if(M!=="position"&&M!=="normal"){F||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),F=!0);continue}const R=o.morphAttributes[M][C],b=M.toUpperCase(),N=o.attributes[M];if(t.attributes.has(this.getUID(R,!0))){x[b]=t.attributes.get(this.getUID(R,!0));continue}const w=R.clone();if(!o.morphTargetsRelative)for(let L=0,_=R.count;L<_;L++)for(let U=0;U<R.itemSize;U++)U===0&&w.setX(L,R.getX(L)-N.getX(L)),U===1&&w.setY(L,R.getY(L)-N.getY(L)),U===2&&w.setZ(L,R.getZ(L)-N.getZ(L)),U===3&&w.setW(L,R.getW(L)-N.getW(L));x[b]=this.processAccessor(w,o),t.attributes.set(this.getUID(N,!0),x[b])}B.push(x),I.push(e.morphTargetInfluences[C]),e.morphTargetDictionary!==void 0&&E.push(m[C])}c.weights=I,E.length>0&&(c.extras={},c.extras.targetNames=E)}const g=Array.isArray(e.material);if(g&&o.groups.length===0)return null;let d=!1;if(g&&o.index===null){const I=[];for(let E=0,m=o.attributes.position.count;E<m;E++)I[E]=E;o.setIndex(I),d=!0}const p=g?e.material:[e.material],y=g?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let I=0,E=y.length;I<E;I++){const m={mode:a,attributes:u};if(this.serializeUserData(o,m),B.length>0&&(m.targets=B),o.index!==null){let x=this.getUID(o.index);(y[I].start!==void 0||y[I].count!==void 0)&&(x+=":"+y[I].start+":"+y[I].count),t.attributes.has(x)?m.indices=t.attributes.get(x):(m.indices=this.processAccessor(o.index,o,y[I].start,y[I].count),t.attributes.set(x,m.indices)),m.indices===null&&delete m.indices}const C=this.processMaterial(p[y[I].materialIndex]);C!==null&&(m.material=C),f.push(m)}d===!0&&o.setIndex(null),c.primitives=f,r.meshes||(r.meshes=[]),this._invokeAll(function(I){I.writeMesh&&I.writeMesh(e,c)});const T=r.meshes.push(c)-1;return t.meshes.set(i,T),T}detectMeshQuantization(e,t){if(this.extensionsUsed[Qt])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const n=e.split("_",1)[0];Xs[n]&&Xs[n].includes(r)&&(this.extensionsUsed[Qt]=!0,this.extensionsRequired[Qt]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:O.MathUtils.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(n.name=e.type),t.cameras.push(n)-1}processAnimation(e,t){const r=this.json,n=this.nodeMap;r.animations||(r.animations=[]),e=Ts.Utils.mergeMorphTargetTracks(e.clone(),t);const i=e.tracks,o=[],a=[];for(let c=0;c<i.length;++c){const u=i[c],f=O.PropertyBinding.parseTrackName(u.name);let B=O.PropertyBinding.findNode(t,f.nodeName);const A=Ws[f.propertyName];if(f.objectName==="bones"&&(B.isSkinnedMesh===!0?B=B.skeleton.getBoneByName(f.objectIndex):B=void 0),!B||!A){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name);continue}const l=1;let h=u.values.length/u.times.length;A===Ws.morphTargetInfluences&&(h/=B.morphTargetInfluences.length);let g;u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(g="CUBICSPLINE",h/=3):u.getInterpolation()===O.InterpolateDiscrete?g="STEP":g="LINEAR",a.push({input:this.processAccessor(new O.BufferAttribute(u.times,l)),output:this.processAccessor(new O.BufferAttribute(u.values,h)),interpolation:g}),o.push({sampler:a.length-1,target:{node:n.get(B),path:A}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:a,channels:o}),r.animations.length-1}processSkin(e){const t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],i=e.skeleton;if(i===void 0)return null;const o=e.skeleton.bones[0];if(o===void 0)return null;const a=[],c=new Float32Array(i.bones.length*16),u=new O.Matrix4;for(let B=0;B<i.bones.length;++B)a.push(r.get(i.bones[B])),u.copy(i.boneInverses[B]),u.multiply(e.bindMatrix).toArray(c,B*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new O.BufferAttribute(c,16)),joints:a,skeleton:r.get(o)}),n.skin=t.skins.length-1}processNode(e){const t=this.json,r=this.options,n=this.nodeMap;t.nodes||(t.nodes=[]);const i={};if(r.trs){const a=e.quaternion.toArray(),c=e.position.toArray(),u=e.scale.toArray();lt(a,[0,0,0,1])||(i.rotation=a),lt(c,[0,0,0])||(i.translation=c),lt(u,[1,1,1])||(i.scale=u)}else e.matrixAutoUpdate&&e.updateMatrix(),jr(e.matrix)===!1&&(i.matrix=e.matrix.elements);if(e.name!==""&&(i.name=String(e.name)),this.serializeUserData(e,i),e.isMesh||e.isLine||e.isPoints){const a=this.processMesh(e);a!==null&&(i.mesh=a)}else e.isCamera&&(i.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const a=[];for(let c=0,u=e.children.length;c<u;c++){const f=e.children[c];if(f.visible||r.onlyVisible===!1){const B=this.processNode(f);B!==null&&a.push(B)}}a.length>0&&(i.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,i)});const o=t.nodes.push(i)-1;return n.set(e,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const n={};e.name!==""&&(n.name=e.name),t.scenes.push(n);const i=[];for(let o=0,a=e.children.length;o<a;o++){const c=e.children[o];if(c.visible||r.onlyVisible===!1){const u=this.processNode(c);u!==null&&i.push(u)}}i.length>0&&(n.nodes=i),this.serializeUserData(e,n)}processObjects(e){const t=new O.Scene;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(n){n.beforeParse&&n.beforeParse(e)});const r=[];for(let n=0;n<e.length;n++)e[n]instanceof O.Scene?this.processScene(e[n]):r.push(e[n]);r.length>0&&this.processObjects(r);for(let n=0;n<this.skins.length;++n)this.processSkin(this.skins[n]);for(let n=0;n<t.animations.length;++n)this.processAnimation(t.animations[n],e[0]);this._invokeAll(function(n){n.afterParse&&n.afterParse(e)})}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}};class Yr{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const r=this.writer,n=r.json,i=r.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),i[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},i[this.name]=!0);const a=n.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class zr{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const n=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},n[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class qr{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const r=this.writer,n=r.extensionsUsed,i={};if(i.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(o,e.clearcoatMap),i.clearcoatTexture=o}if(i.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(o,e.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),r.applyTextureTransform(o,e.clearcoatNormalMap),i.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class Qr{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const n=this.writer.extensionsUsed,i={};i.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class Zr{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const r=this.writer,n=r.extensionsUsed,i={};if(i.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(o,e.iridescenceMap),i.iridescenceTexture=o}if(i.iridescenceIor=e.iridescenceIOR,i.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(o,e.iridescenceThicknessMap),i.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class $r{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,n=r.extensionsUsed,i={};if(i.transmissionFactor=e.transmission,e.transmissionMap){const o={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(o,e.transmissionMap),i.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class ei{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,n=r.extensionsUsed,i={};if(i.thicknessFactor=e.thickness,e.thicknessMap){const o={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(o,e.thicknessMap),i.thicknessTexture=o}i.attenuationDistance=e.attenuationDistance,i.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class ti{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const n=this.writer.extensionsUsed,i={};i.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class si{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(vr)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,n=r.extensionsUsed,i={};if(e.specularIntensityMap){const o={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(o,e.specularIntensityMap),i.specularTexture=o}if(e.specularColorMap){const o={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(o,e.specularColorMap),i.specularColorTexture=o}i.specularFactor=e.specularIntensity,i.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class ni{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const r=this.writer,n=r.extensionsUsed,i={};if(e.sheenRoughnessMap){const o={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(o,e.sheenRoughnessMap),i.sheenRoughnessTexture=o}if(e.sheenColorMap){const o={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(o,e.sheenColorMap),i.sheenColorTexture=o}i.sheenRoughnessFactor=e.sheenRoughness,i.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class ri{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const r=this.writer,n=r.extensionsUsed,i={};if(e.anisotropyMap){const o={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(o,e.anisotropyMap),i.anisotropyTexture=o}i.anisotropyStrength=e.anisotropy,i.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class ii{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const n=this.writer.extensionsUsed,i={};i.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class oi{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const r=this.writer,n=r.extensionsUsed,i={};if(e.bumpMap){const o={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(o,e.bumpMap),i.bumpTexture=o}i.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=i,n[this.name]=!0}}class ai{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,n=e,i=new Float32Array(n.count*3),o=new Float32Array(n.count*4),a=new Float32Array(n.count*3),c=new O.Matrix4,u=new O.Vector3,f=new O.Quaternion,B=new O.Vector3;for(let l=0;l<n.count;l++)n.getMatrixAt(l,c),c.decompose(u,f,B),u.toArray(i,l*3),f.toArray(o,l*4),B.toArray(a,l*3);const A={TRANSLATION:r.processAccessor(new O.BufferAttribute(i,3)),ROTATION:r.processAccessor(new O.BufferAttribute(o,4)),SCALE:r.processAccessor(new O.BufferAttribute(a,3))};n.instanceColor&&(A._COLOR_0=r.processAccessor(n.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:A},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}}Ts.Utils={insertKeyframe:function(s,e){const r=s.getValueSize(),n=new s.TimeBufferType(s.times.length+1),i=new s.ValueBufferType(s.values.length+r),o=s.createInterpolant(new s.ValueBufferType(r));let a;if(s.times.length===0){n[0]=e;for(let c=0;c<r;c++)i[c]=0;a=0}else if(e<s.times[0]){if(Math.abs(s.times[0]-e)<.001)return 0;n[0]=e,n.set(s.times,1),i.set(o.evaluate(e),0),i.set(s.values,r),a=0}else if(e>s.times[s.times.length-1]){if(Math.abs(s.times[s.times.length-1]-e)<.001)return s.times.length-1;n[n.length-1]=e,n.set(s.times,0),i.set(s.values,0),i.set(o.evaluate(e),s.values.length),a=n.length-1}else for(let c=0;c<s.times.length;c++){if(Math.abs(s.times[c]-e)<.001)return c;if(s.times[c]<e&&s.times[c+1]>e){n.set(s.times.slice(0,c+1),0),n[c+1]=e,n.set(s.times.slice(c+1),c+2),i.set(s.values.slice(0,(c+1)*r),0),i.set(o.evaluate(e),(c+1)*r),i.set(s.values.slice((c+1)*r),(c+2)*r),a=c+1;break}}return s.times=n,s.values=i,a},mergeMorphTargetTracks:function(s,e){const t=[],r={},n=s.tracks;for(let i=0;i<n.length;++i){let o=n[i];const a=O.PropertyBinding.parseTrackName(o.name),c=O.PropertyBinding.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(O.InterpolateLinear)}const u=c.morphTargetInfluences.length,f=c.morphTargetDictionary[a.propertyIndex];if(f===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let B;if(r[c.uuid]===void 0){B=o.clone();const l=new B.ValueBufferType(u*B.times.length);for(let h=0;h<B.times.length;h++)l[h*u+f]=B.values[h];B.name=(a.nodeName||"")+".morphTargetInfluences",B.values=l,r[c.uuid]=B,t.push(B);continue}const A=o.createInterpolant(new o.ValueBufferType(1));B=r[c.uuid];for(let l=0;l<B.times.length;l++)B.values[l*u+f]=A.evaluate(B.times[l]);for(let l=0;l<o.times.length;l++){const h=this.insertKeyframe(B,o.times[l]);B.values[h*u+f]=o.values[l]}}return s.tracks=t,s}};class ms{constructor(){this._listeners={}}addEventListener(e,t){const r=this._listeners;return r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t),this}removeEventListener(e,t){if(this._listeners===void 0)return this;const n=this._listeners[e];if(n!==void 0){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}return this}dispatchEvent(e){if(this._listeners===void 0)return this;const r=this._listeners[e.type];if(r!==void 0){const n=r.slice(0);for(let i=0,o=n.length;i<o;i++)n[i].call(this,e)}return this}dispose(){for(const e in this._listeners)delete this._listeners[e]}}class qe extends ms{constructor(e,t,r,n={}){if(super(),this._name=void 0,this._parent=void 0,this._child=void 0,this._attributes=void 0,this._disposed=!1,this._name=e,this._parent=t,this._child=r,this._attributes=n,!t.isOnGraph(r))throw new Error("Cannot connect disconnected graphs.")}getName(){return this._name}getParent(){return this._parent}getChild(){return this._child}setChild(e){return this._child=e,this}getAttributes(){return this._attributes}dispose(){this._disposed||(this._disposed=!0,this.dispatchEvent({type:"dispose",target:this}),super.dispose())}isDisposed(){return this._disposed}}class ci extends ms{constructor(...e){super(...e),this._emptySet=new Set,this._edges=new Set,this._parentEdges=new Map,this._childEdges=new Map}listEdges(){return Array.from(this._edges)}listParentEdges(e){return Array.from(this._childEdges.get(e)||this._emptySet)}listParents(e){return this.listParentEdges(e).map(t=>t.getParent())}listChildEdges(e){return Array.from(this._parentEdges.get(e)||this._emptySet)}listChildren(e){return this.listChildEdges(e).map(t=>t.getChild())}disconnectParents(e,t){let r=this.listParentEdges(e);return t&&(r=r.filter(n=>t(n.getParent()))),r.forEach(n=>n.dispose()),this}createEdge(e,t,r,n){return this._registerEdge(new qe(e,t,r,n))}_registerEdge(e){this._edges.add(e);const t=e.getParent();this._parentEdges.has(t)||this._parentEdges.set(t,new Set),this._parentEdges.get(t).add(e);const r=e.getChild();return this._childEdges.has(r)||this._childEdges.set(r,new Set),this._childEdges.get(r).add(e),e.addEventListener("dispose",()=>this._removeEdge(e)),e}_removeEdge(e){return this._edges.delete(e),this._parentEdges.get(e.getParent()).delete(e),this._childEdges.get(e.getChild()).delete(e),this}}function gt(){return gt=Object.assign||function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},gt.apply(this,arguments)}class Ke{constructor(e){if(this.list=[],e)for(const t of e)this.list.push(t)}add(e){this.list.push(e)}remove(e){const t=this.list.indexOf(e);t>=0&&this.list.splice(t,1)}removeChild(e){const t=[];for(const r of this.list)r.getChild()===e&&t.push(r);for(const r of t)this.remove(r);return t}listRefsByChild(e){const t=[];for(const r of this.list)r.getChild()===e&&t.push(r);return t}values(){return this.list}}class K{constructor(e){if(this.set=new Set,this.map=new Map,e)for(const t of e)this.add(t)}add(e){const t=e.getChild();this.removeChild(t),this.set.add(e),this.map.set(t,e)}remove(e){this.set.delete(e),this.map.delete(e.getChild())}removeChild(e){const t=this.map.get(e)||null;return t&&this.remove(t),t}getRefByChild(e){return this.map.get(e)||null}values(){return Array.from(this.set)}}class he{constructor(e){this.map={},e&&Object.assign(this.map,e)}set(e,t){this.map[e]=t}delete(e){delete this.map[e]}get(e){return this.map[e]||null}keys(){return Object.keys(this.map)}values(){return Object.values(this.map)}}const V=Symbol("attributes"),Qe=Symbol("immutableKeys");class xs extends ms{constructor(e){super(),this._disposed=!1,this.graph=void 0,this[V]=void 0,this[Qe]=void 0,this.graph=e,this[Qe]=new Set,this[V]=this._createAttributes()}getDefaults(){return{}}_createAttributes(){const e=this.getDefaults(),t={};for(const r in e){const n=e[r];if(n instanceof xs){const i=this.graph.createEdge(r,this,n);i.addEventListener("dispose",()=>n.dispose()),this[Qe].add(r),t[r]=i}else t[r]=n}return t}isOnGraph(e){return this.graph===e.graph}isDisposed(){return this._disposed}dispose(){this._disposed||(this.graph.listChildEdges(this).forEach(e=>e.dispose()),this.graph.disconnectParents(this),this._disposed=!0,this.dispatchEvent({type:"dispose"}))}detach(){return this.graph.disconnectParents(this),this}swap(e,t){for(const r in this[V]){const n=this[V][r];if(n instanceof qe){const i=n;i.getChild()===e&&this.setRef(r,t,i.getAttributes())}else if(n instanceof Ke)for(const i of n.listRefsByChild(e)){const o=i.getAttributes();this.removeRef(r,e),this.addRef(r,t,o)}else if(n instanceof K){const i=n.getRefByChild(e);if(i){const o=i.getAttributes();this.removeRef(r,e),this.addRef(r,t,o)}}else if(n instanceof he)for(const i of n.keys()){const o=n.get(i);o.getChild()===e&&this.setRefMap(r,i,t,o.getAttributes())}}return this}get(e){return this[V][e]}set(e,t){return this[V][e]=t,this.dispatchEvent({type:"change",attribute:e})}getRef(e){const t=this[V][e];return t?t.getChild():null}setRef(e,t,r){if(this[Qe].has(e))throw new Error(`Cannot overwrite immutable attribute, "${e}".`);const n=this[V][e];if(n&&n.dispose(),!t)return this;const i=this.graph.createEdge(e,this,t,r);return i.addEventListener("dispose",()=>{delete this[V][e],this.dispatchEvent({type:"change",attribute:e})}),this[V][e]=i,this.dispatchEvent({type:"change",attribute:e})}listRefs(e){return this.assertRefList(e).values().map(r=>r.getChild())}addRef(e,t,r){const n=this.graph.createEdge(e,this,t,r),i=this.assertRefList(e);return i.add(n),n.addEventListener("dispose",()=>{i.remove(n),this.dispatchEvent({type:"change",attribute:e})}),this.dispatchEvent({type:"change",attribute:e})}removeRef(e,t){const r=this.assertRefList(e);if(r instanceof Ke)for(const n of r.removeChild(t))n.dispose();else{const n=r.removeChild(t);n&&n.dispose()}return this}assertRefList(e){const t=this[V][e];if(t instanceof Ke||t instanceof K)return t;throw new Error(`Expected RefList or RefSet for attribute "${e}"`)}listRefMapKeys(e){return this.assertRefMap(e).keys()}listRefMapValues(e){return this.assertRefMap(e).values().map(t=>t.getChild())}getRefMap(e,t){const n=this.assertRefMap(e).get(t);return n?n.getChild():null}setRefMap(e,t,r,n){const i=this.assertRefMap(e),o=i.get(t);if(o&&o.dispose(),!r)return this;n=Object.assign(n||{},{key:t});const a=this.graph.createEdge(e,this,r,gt({},n,{key:t}));return a.addEventListener("dispose",()=>{i.delete(t),this.dispatchEvent({type:"change",attribute:e,key:t})}),i.set(t,a),this.dispatchEvent({type:"change",attribute:e,key:t})}assertRefMap(e){const t=this[V][e];if(t instanceof he)return t;throw new Error(`Expected RefMap for attribute "${e}"`)}dispatchEvent(e){return super.dispatchEvent(gt({},e,{target:this})),this.graph.dispatchEvent(gt({},e,{target:this,type:`node:${e.type}`})),this}}const vn="v4.0.8",et="@glb.bin";var D;(function(s){s.ACCESSOR="Accessor",s.ANIMATION="Animation",s.ANIMATION_CHANNEL="AnimationChannel",s.ANIMATION_SAMPLER="AnimationSampler",s.BUFFER="Buffer",s.CAMERA="Camera",s.MATERIAL="Material",s.MESH="Mesh",s.PRIMITIVE="Primitive",s.PRIMITIVE_TARGET="PrimitiveTarget",s.NODE="Node",s.ROOT="Root",s.SCENE="Scene",s.SKIN="Skin",s.TEXTURE="Texture",s.TEXTURE_INFO="TextureInfo"})(D||(D={}));var bt;(function(s){s.INTERLEAVED="interleaved",s.SEPARATE="separate"})(bt||(bt={}));var ie;(function(s){s.ARRAY_BUFFER="ARRAY_BUFFER",s.ELEMENT_ARRAY_BUFFER="ELEMENT_ARRAY_BUFFER",s.INVERSE_BIND_MATRICES="INVERSE_BIND_MATRICES",s.OTHER="OTHER",s.SPARSE="SPARSE"})(ie||(ie={}));var ue;(function(s){s[s.R=4096]="R",s[s.G=256]="G",s[s.B=16]="B",s[s.A=1]="A"})(ue||(ue={}));var ke;(function(s){s.GLTF="GLTF",s.GLB="GLB"})(ke||(ke={}));const Tt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};var is=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var s=0,e=arguments.length;e--;)s+=arguments[e]*arguments[e];return Math.sqrt(s)});function Ai(){var s=new is(3);return is!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s}function $t(s){var e=s[0],t=s[1],r=s[2];return Math.hypot(e,t,r)}function ui(s,e,t){var r=e[0],n=e[1],i=e[2],o=t[3]*r+t[7]*n+t[11]*i+t[15];return o=o||1,s[0]=(t[0]*r+t[4]*n+t[8]*i+t[12])/o,s[1]=(t[1]*r+t[5]*n+t[9]*i+t[13])/o,s[2]=(t[2]*r+t[6]*n+t[10]*i+t[14])/o,s}(function(){var s=Ai();return function(e,t,r,n,i,o){var a,c;for(t||(t=3),r||(r=0),n?c=Math.min(n*t+r,e.length):c=e.length,a=r;a<c;a+=t)s[0]=e[a],s[1]=e[a+1],s[2]=e[a+2],i(s,s,o),e[a]=s[0],e[a+1]=s[1],e[a+2]=s[2];return e}})();function fi(s){const e=Un(),t=s.propertyType===D.NODE?[s]:s.listChildren();for(const r of t)r.traverse(n=>{const i=n.getMesh();if(!i)return;const o=li(i,n.getWorldMatrix());o.min.every(isFinite)&&o.max.every(isFinite)&&(os(o.min,e),os(o.max,e))});return e}function li(s,e){const t=Un();for(const r of s.listPrimitives()){const n=r.getAttribute("POSITION"),i=r.getIndices();if(!n)continue;let o=[0,0,0],a=[0,0,0];for(let c=0,u=i?i.getCount():n.getCount();c<u;c++){const f=i?i.getScalar(c):c;o=n.getElement(f,o),a=ui(a,o,e),os(a,t)}}return t}function os(s,e){for(let t=0;t<3;t++)e.min[t]=Math.min(s[t],e.min[t]),e.max[t]=Math.max(s[t],e.max[t])}function Un(){return{min:[1/0,1/0,1/0],max:[-1/0,-1/0,-1/0]}}class G{static createBufferFromDataURI(e){if(typeof Buffer>"u"){const t=atob(e.split(",")[1]),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}else{const t=e.split(",")[1],r=e.indexOf("base64")>=0;return Buffer.from(t,r?"base64":"utf8")}}static encodeText(e){return typeof TextEncoder<"u"?new TextEncoder().encode(e):Buffer.from(e)}static decodeText(e){return typeof TextDecoder<"u"?new TextDecoder().decode(e):Buffer.from(e).toString("utf8")}static concat(e){let t=0;for(const i of e)t+=i.byteLength;const r=new Uint8Array(t);let n=0;for(const i of e)r.set(i,n),n+=i.byteLength;return r}static pad(e,t=0){const r=this.padNumber(e.byteLength);if(r===e.byteLength)return e;const n=new Uint8Array(r);if(n.set(e),t!==0)for(let i=e.byteLength;i<r;i++)n[i]=t;return n}static padNumber(e){return Math.ceil(e/4)*4}static equals(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;let r=e.byteLength;for(;r--;)if(e[r]!==t[r])return!1;return!0}static toView(e,t=0,r=1/0){return new Uint8Array(e.buffer,e.byteOffset+t,Math.min(e.byteLength,r))}static assertView(e){if(e&&!ArrayBuffer.isView(e))throw new Error(`Method requires Uint8Array parameter; received "${typeof e}".`);return e}}class Bi{static hexToFactor(e,t){e=Math.floor(e);const r=t;return r[0]=(e>>16&255)/255,r[1]=(e>>8&255)/255,r[2]=(e&255)/255,this.convertSRGBToLinear(t,t)}static factorToHex(e){const t=[...e],[r,n,i]=this.convertLinearToSRGB(e,t);return r*255<<16^n*255<<8^i*255<<0}static convertSRGBToLinear(e,t){const r=e,n=t;for(let i=0;i<3;i++)n[i]=r[i]<.04045?r[i]*.0773993808:Math.pow(r[i]*.9478672986+.0521327014,2.4);return t}static convertLinearToSRGB(e,t){const r=e,n=t;for(let i=0;i<3;i++)n[i]=r[i]<.0031308?r[i]*12.92:1.055*Math.pow(r[i],.41666)-.055;return t}}class hi{match(e){return e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255}getSize(e){let t=new DataView(e.buffer,e.byteOffset+4),r,n;for(;t.byteLength;){if(r=t.getUint16(0,!1),pi(t,r),n=t.getUint8(r+1),n===192||n===193||n===194)return[t.getUint16(r+7,!1),t.getUint16(r+5,!1)];t=new DataView(e.buffer,t.byteOffset+r+2)}throw new TypeError("Invalid JPG, no size found")}getChannels(e){return 3}}class Kt{match(e){return e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71&&e[4]===13&&e[5]===10&&e[6]===26&&e[7]===10}getSize(e){const t=new DataView(e.buffer,e.byteOffset);return G.decodeText(e.slice(12,16))===Kt.PNG_FRIED_CHUNK_NAME?[t.getUint32(32,!1),t.getUint32(36,!1)]:[t.getUint32(16,!1),t.getUint32(20,!1)]}getChannels(e){return 4}}Kt.PNG_FRIED_CHUNK_NAME="CgBI";class pe{static registerFormat(e,t){this.impls[e]=t}static getMimeType(e){for(const t in this.impls)if(this.impls[t].match(e))return t;return null}static getSize(e,t){return this.impls[t]?this.impls[t].getSize(e):null}static getChannels(e,t){return this.impls[t]?this.impls[t].getChannels(e):null}static getVRAMByteLength(e,t){if(!this.impls[t])return null;if(this.impls[t].getVRAMByteLength)return this.impls[t].getVRAMByteLength(e);let r=0;const n=4,i=this.getSize(e,t);if(!i)return null;for(;i[0]>1||i[1]>1;)r+=i[0]*i[1]*n,i[0]=Math.max(Math.floor(i[0]/2),1),i[1]=Math.max(Math.floor(i[1]/2),1);return r+=1*1*n,r}static mimeTypeToExtension(e){return e==="image/jpeg"?"jpg":e.split("/").pop()}static extensionToMimeType(e){return e==="jpg"?"image/jpeg":e?`image/${e}`:""}}pe.impls={"image/jpeg":new hi,"image/png":new Kt};function pi(s,e){if(e>s.byteLength)throw new TypeError("Corrupt JPG, exceeded buffer limits");if(s.getUint8(e)!==255)throw new TypeError("Invalid JPG, marker table corrupted");return s}class tt{static basename(e){const t=e.split(/[\\/]/).pop();return t.substring(0,t.lastIndexOf("."))}static extension(e){if(e.startsWith("data:image/")){const t=e.match(/data:(image\/\w+)/)[1];return pe.mimeTypeToExtension(t)}else{if(e.startsWith("data:model/gltf+json"))return"gltf";if(e.startsWith("data:model/gltf-binary"))return"glb";if(e.startsWith("data:application/"))return"bin"}return e.split(/[\\/]/).pop().split(/[.]/).pop()}}function Zs(s){return Object.prototype.toString.call(s)==="[object Object]"}function Je(s){if(Zs(s)===!1)return!1;const e=s.constructor;if(e===void 0)return!0;const t=e.prototype;return!(Zs(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}var as,cs;(function(s){s[s.SILENT=4]="SILENT",s[s.ERROR=3]="ERROR",s[s.WARN=2]="WARN",s[s.INFO=1]="INFO",s[s.DEBUG=0]="DEBUG"})(cs||(cs={}));class Ae{constructor(e){this.verbosity=void 0,this.verbosity=e}debug(e){this.verbosity<=Ae.Verbosity.DEBUG&&console.debug(e)}info(e){this.verbosity<=Ae.Verbosity.INFO&&console.info(e)}warn(e){this.verbosity<=Ae.Verbosity.WARN&&console.warn(e)}error(e){this.verbosity<=Ae.Verbosity.ERROR&&console.error(e)}}as=Ae;Ae.Verbosity=cs;Ae.DEFAULT_INSTANCE=new as(as.Verbosity.INFO);function gi(s){var e=s[0],t=s[1],r=s[2],n=s[3],i=s[4],o=s[5],a=s[6],c=s[7],u=s[8],f=s[9],B=s[10],A=s[11],l=s[12],h=s[13],g=s[14],d=s[15],p=e*o-t*i,y=e*a-r*i,T=e*c-n*i,I=t*a-r*o,E=t*c-n*o,m=r*c-n*a,C=u*h-f*l,x=u*g-B*l,F=u*d-A*l,M=f*g-B*h,R=f*d-A*h,b=B*d-A*g;return p*b-y*R+T*M+I*F-E*x+m*C}function di(s,e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],f=e[7],B=e[8],A=e[9],l=e[10],h=e[11],g=e[12],d=e[13],p=e[14],y=e[15],T=t[0],I=t[1],E=t[2],m=t[3];return s[0]=T*r+I*a+E*B+m*g,s[1]=T*n+I*c+E*A+m*d,s[2]=T*i+I*u+E*l+m*p,s[3]=T*o+I*f+E*h+m*y,T=t[4],I=t[5],E=t[6],m=t[7],s[4]=T*r+I*a+E*B+m*g,s[5]=T*n+I*c+E*A+m*d,s[6]=T*i+I*u+E*l+m*p,s[7]=T*o+I*f+E*h+m*y,T=t[8],I=t[9],E=t[10],m=t[11],s[8]=T*r+I*a+E*B+m*g,s[9]=T*n+I*c+E*A+m*d,s[10]=T*i+I*u+E*l+m*p,s[11]=T*o+I*f+E*h+m*y,T=t[12],I=t[13],E=t[14],m=t[15],s[12]=T*r+I*a+E*B+m*g,s[13]=T*n+I*c+E*A+m*d,s[14]=T*i+I*u+E*l+m*p,s[15]=T*o+I*f+E*h+m*y,s}function Ci(s,e){var t=e[0],r=e[1],n=e[2],i=e[4],o=e[5],a=e[6],c=e[8],u=e[9],f=e[10];return s[0]=Math.hypot(t,r,n),s[1]=Math.hypot(i,o,a),s[2]=Math.hypot(c,u,f),s}function Ei(s,e){var t=new is(3);Ci(t,e);var r=1/t[0],n=1/t[1],i=1/t[2],o=e[0]*r,a=e[1]*n,c=e[2]*i,u=e[4]*r,f=e[5]*n,B=e[6]*i,A=e[8]*r,l=e[9]*n,h=e[10]*i,g=o+f+h,d=0;return g>0?(d=Math.sqrt(g+1)*2,s[3]=.25*d,s[0]=(B-l)/d,s[1]=(A-c)/d,s[2]=(a-u)/d):o>f&&o>h?(d=Math.sqrt(1+o-f-h)*2,s[3]=(B-l)/d,s[0]=.25*d,s[1]=(a+u)/d,s[2]=(A+c)/d):f>h?(d=Math.sqrt(1+f-o-h)*2,s[3]=(A-c)/d,s[0]=(a+u)/d,s[1]=.25*d,s[2]=(B+l)/d):(d=Math.sqrt(1+h-o-f)*2,s[3]=(a-u)/d,s[0]=(A+c)/d,s[1]=(B+l)/d,s[2]=.25*d),s}class H{static identity(e){return e}static eq(e,t,r=1e-5){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}static clamp(e,t,r){return e<t?t:e>r?r:e}static decodeNormalizedInt(e,t){switch(t){case 5126:return e;case 5123:return e/65535;case 5121:return e/255;case 5122:return Math.max(e/32767,-1);case 5120:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}static encodeNormalizedInt(e,t){switch(t){case 5126:return e;case 5123:return Math.round(H.clamp(e,0,1)*65535);case 5121:return Math.round(H.clamp(e,0,1)*255);case 5122:return Math.round(H.clamp(e,-1,1)*32767);case 5120:return Math.round(H.clamp(e,-1,1)*127);default:throw new Error("Invalid component type.")}}static decompose(e,t,r,n){let i=$t([e[0],e[1],e[2]]);const o=$t([e[4],e[5],e[6]]),a=$t([e[8],e[9],e[10]]);gi(e)<0&&(i=-i),t[0]=e[12],t[1]=e[13],t[2]=e[14];const u=e.slice(),f=1/i,B=1/o,A=1/a;u[0]*=f,u[1]*=f,u[2]*=f,u[4]*=B,u[5]*=B,u[6]*=B,u[8]*=A,u[9]*=A,u[10]*=A,Ei(r,u),n[0]=i,n[1]=o,n[2]=a}static compose(e,t,r,n){const i=n,o=t[0],a=t[1],c=t[2],u=t[3],f=o+o,B=a+a,A=c+c,l=o*f,h=o*B,g=o*A,d=a*B,p=a*A,y=c*A,T=u*f,I=u*B,E=u*A,m=r[0],C=r[1],x=r[2];return i[0]=(1-(d+y))*m,i[1]=(h+E)*m,i[2]=(g-I)*m,i[3]=0,i[4]=(h-E)*C,i[5]=(1-(l+y))*C,i[6]=(p+T)*C,i[7]=0,i[8]=(g+I)*x,i[9]=(p-T)*x,i[10]=(1-(l+d))*x,i[11]=0,i[12]=e[0],i[13]=e[1],i[14]=e[2],i[15]=1,i}}function Di(s,e){if(!!s!=!!e)return!1;const t=s.getChild(),r=e.getChild();return t===r||t.equals(r)}function Ii(s,e){if(!!s!=!!e)return!1;const t=s.values(),r=e.values();if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++){const i=t[n],o=r[n];if(i.getChild()!==o.getChild()&&!i.getChild().equals(o.getChild()))return!1}return!0}function Ti(s,e){if(!!s!=!!e)return!1;const t=s.keys(),r=e.keys();if(t.length!==r.length)return!1;for(const n of t){const i=s.get(n),o=e.get(n);if(!!i!=!!o)return!1;const a=i.getChild(),c=o.getChild();if(a!==c&&!a.equals(c))return!1}return!0}function Kn(s,e){if(s===e)return!0;if(!!s!=!!e||!s||!e||s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function Jn(s,e){if(s===e)return!0;if(!!s!=!!e)return!1;if(!Je(s)||!Je(e))return s===e;const t=s,r=e;let n=0,i=0,o;for(o in t)n++;for(o in r)i++;if(n!==i)return!1;for(o in t){const a=t[o],c=r[o];if(Lt(a)&&Lt(c)){if(!Kn(a,c))return!1}else if(Je(a)&&Je(c)){if(!Jn(a,c))return!1}else if(a!==c)return!1}return!0}function Lt(s){return Array.isArray(s)||ArrayBuffer.isView(s)}const $s="23456789abdegjkmnpqrvwxyzABDEGJKMNPQRVWXYZ",mi=999,xi=6,en=new Set,yi=function(){let e="";for(let t=0;t<xi;t++)e+=$s.charAt(Math.floor(Math.random()*$s.length));return e},Fi=function(){for(let e=0;e<mi;e++){const t=yi();if(!en.has(t))return en.add(t),t}return""},tn="https://null.example";class dt{static dirname(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substring(0,t+1)}static basename(e){return tt.basename(new URL(e,tn).pathname)}static extension(e){return tt.extension(new URL(e,tn).pathname)}static resolve(e,t){if(!this.isRelativePath(t))return t;const r=e.split("/"),n=t.split("/");r.pop();for(let i=0;i<n.length;i++)n[i]!=="."&&(n[i]===".."?r.pop():r.push(n[i]));return r.join("/")}static isAbsoluteURL(e){return this.PROTOCOL_REGEXP.test(e)}static isRelativePath(e){return!/^(?:[a-zA-Z]+:)?\//.test(e)}}dt.DEFAULT_INIT={};dt.PROTOCOL_REGEXP=/^[a-zA-Z]+:\/\//;const Fe=s=>s,Mi=new Set;class ys extends xs{constructor(e,t=""){super(e),this[V].name=t,this.init(),this.dispatchEvent({type:"create"})}getGraph(){return this.graph}getDefaults(){return Object.assign(super.getDefaults(),{name:"",extras:{}})}set(e,t){return Array.isArray(t)&&(t=t.slice()),super.set(e,t)}getName(){return this.get("name")}setName(e){return this.set("name",e)}getExtras(){return this.get("extras")}setExtras(e){return this.set("extras",e)}clone(){const e=this.constructor;return new e(this.graph).copy(this,Fe)}copy(e,t=Fe){for(const r in this[V]){const n=this[V][r];if(n instanceof qe)this[Qe].has(r)||n.dispose();else if(n instanceof Ke||n instanceof K)for(const i of n.values())i.dispose();else if(n instanceof he)for(const i of n.values())i.dispose()}for(const r in e[V]){const n=this[V][r],i=e[V][r];if(i instanceof qe)this[Qe].has(r)?n.getChild().copy(t(i.getChild()),t):this.setRef(r,t(i.getChild()),i.getAttributes());else if(i instanceof K||i instanceof Ke)for(const o of i.values())this.addRef(r,t(o.getChild()),o.getAttributes());else if(i instanceof he)for(const o of i.keys()){const a=i.get(o);this.setRefMap(r,o,t(a.getChild()),a.getAttributes())}else Je(i)?this[V][r]=JSON.parse(JSON.stringify(i)):Array.isArray(i)||i instanceof ArrayBuffer||ArrayBuffer.isView(i)?this[V][r]=i.slice():this[V][r]=i}return this}equals(e,t=Mi){if(this===e)return!0;if(this.propertyType!==e.propertyType)return!1;for(const r in this[V]){if(t.has(r))continue;const n=this[V][r],i=e[V][r];if(n instanceof qe||i instanceof qe){if(!Di(n,i))return!1}else if(n instanceof K||i instanceof K||n instanceof Ke||i instanceof Ke){if(!Ii(n,i))return!1}else if(n instanceof he||i instanceof he){if(!Ti(n,i))return!1}else if(Je(n)||Je(i)){if(!Jn(n,i))return!1}else if(Lt(n)||Lt(i)){if(!Kn(n,i))return!1}else if(n!==i)return!1}return!0}detach(){return this.graph.disconnectParents(this,e=>e.propertyType!=="Root"),this}listParents(){return this.graph.listParents(this)}}class te extends ys{getDefaults(){return Object.assign(super.getDefaults(),{extensions:new he})}getExtension(e){return this.getRefMap("extensions",e)}setExtension(e,t){return t&&t._validateParent(this),this.setRefMap("extensions",e,t)}listExtensions(){return this.listRefMapValues("extensions")}}class S extends te{init(){this.propertyType=D.ACCESSOR}getDefaults(){return Object.assign(super.getDefaults(),{array:null,type:S.Type.SCALAR,componentType:S.ComponentType.FLOAT,normalized:!1,sparse:!1,buffer:null})}static getElementSize(e){switch(e){case S.Type.SCALAR:return 1;case S.Type.VEC2:return 2;case S.Type.VEC3:return 3;case S.Type.VEC4:return 4;case S.Type.MAT2:return 4;case S.Type.MAT3:return 9;case S.Type.MAT4:return 16;default:throw new Error("Unexpected type: "+e)}}static getComponentSize(e){switch(e){case S.ComponentType.BYTE:return 1;case S.ComponentType.UNSIGNED_BYTE:return 1;case S.ComponentType.SHORT:return 2;case S.ComponentType.UNSIGNED_SHORT:return 2;case S.ComponentType.UNSIGNED_INT:return 4;case S.ComponentType.FLOAT:return 4;default:throw new Error("Unexpected component type: "+e)}}getMinNormalized(e){const t=this.getNormalized(),r=this.getElementSize(),n=this.getComponentType();if(this.getMin(e),t)for(let i=0;i<r;i++)e[i]=H.decodeNormalizedInt(e[i],n);return e}getMin(e){const t=this.getArray(),r=this.getCount(),n=this.getElementSize();for(let i=0;i<n;i++)e[i]=1/0;for(let i=0;i<r*n;i+=n)for(let o=0;o<n;o++){const a=t[i+o];Number.isFinite(a)&&(e[o]=Math.min(e[o],a))}return e}getMaxNormalized(e){const t=this.getNormalized(),r=this.getElementSize(),n=this.getComponentType();if(this.getMax(e),t)for(let i=0;i<r;i++)e[i]=H.decodeNormalizedInt(e[i],n);return e}getMax(e){const t=this.get("array"),r=this.getCount(),n=this.getElementSize();for(let i=0;i<n;i++)e[i]=-1/0;for(let i=0;i<r*n;i+=n)for(let o=0;o<n;o++){const a=t[i+o];Number.isFinite(a)&&(e[o]=Math.max(e[o],a))}return e}getCount(){const e=this.get("array");return e?e.length/this.getElementSize():0}getType(){return this.get("type")}setType(e){return this.set("type",e)}getElementSize(){return S.getElementSize(this.get("type"))}getComponentSize(){return this.get("array").BYTES_PER_ELEMENT}getComponentType(){return this.get("componentType")}getNormalized(){return this.get("normalized")}setNormalized(e){return this.set("normalized",e)}getScalar(e){const t=this.getElementSize(),r=this.getComponentType(),n=this.getArray();return this.getNormalized()?H.decodeNormalizedInt(n[e*t],r):n[e*t]}setScalar(e,t){const r=this.getElementSize(),n=this.getComponentType(),i=this.getArray();return this.getNormalized()?i[e*r]=H.encodeNormalizedInt(t,n):i[e*r]=t,this}getElement(e,t){const r=this.getNormalized(),n=this.getElementSize(),i=this.getComponentType(),o=this.getArray();for(let a=0;a<n;a++)r?t[a]=H.decodeNormalizedInt(o[e*n+a],i):t[a]=o[e*n+a];return t}setElement(e,t){const r=this.getNormalized(),n=this.getElementSize(),i=this.getComponentType(),o=this.getArray();for(let a=0;a<n;a++)r?o[e*n+a]=H.encodeNormalizedInt(t[a],i):o[e*n+a]=t[a];return this}getSparse(){return this.get("sparse")}setSparse(e){return this.set("sparse",e)}getBuffer(){return this.getRef("buffer")}setBuffer(e){return this.setRef("buffer",e)}getArray(){return this.get("array")}setArray(e){return this.set("componentType",e?Ri(e):S.ComponentType.FLOAT),this.set("array",e),this}getByteLength(){const e=this.get("array");return e?e.byteLength:0}}S.Type={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};S.ComponentType={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:5126};function Ri(s){switch(s.constructor){case Float32Array:return S.ComponentType.FLOAT;case Uint32Array:return S.ComponentType.UNSIGNED_INT;case Uint16Array:return S.ComponentType.UNSIGNED_SHORT;case Uint8Array:return S.ComponentType.UNSIGNED_BYTE;case Int16Array:return S.ComponentType.SHORT;case Int8Array:return S.ComponentType.BYTE;default:throw new Error("Unknown accessor componentType.")}}class Vn extends te{init(){this.propertyType=D.ANIMATION}getDefaults(){return Object.assign(super.getDefaults(),{channels:new K,samplers:new K})}addChannel(e){return this.addRef("channels",e)}removeChannel(e){return this.removeRef("channels",e)}listChannels(){return this.listRefs("channels")}addSampler(e){return this.addRef("samplers",e)}removeSampler(e){return this.removeRef("samplers",e)}listSamplers(){return this.listRefs("samplers")}}class rt extends te{init(){this.propertyType=D.ANIMATION_CHANNEL}getDefaults(){return Object.assign(super.getDefaults(),{targetPath:null,targetNode:null,sampler:null})}getTargetPath(){return this.get("targetPath")}setTargetPath(e){return this.set("targetPath",e)}getTargetNode(){return this.getRef("targetNode")}setTargetNode(e){return this.setRef("targetNode",e)}getSampler(){return this.getRef("sampler")}setSampler(e){return this.setRef("sampler",e)}}rt.TargetPath={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};class it extends te{init(){this.propertyType=D.ANIMATION_SAMPLER}getDefaultAttributes(){return Object.assign(super.getDefaults(),{interpolation:it.Interpolation.LINEAR,input:null,output:null})}getInterpolation(){return this.get("interpolation")}setInterpolation(e){return this.set("interpolation",e)}getInput(){return this.getRef("input")}setInput(e){return this.setRef("input",e,{usage:ie.OTHER})}getOutput(){return this.getRef("output")}setOutput(e){return this.setRef("output",e,{usage:ie.OTHER})}}it.Interpolation={LINEAR:"LINEAR",STEP:"STEP",CUBICSPLINE:"CUBICSPLINE"};class kn extends te{init(){this.propertyType=D.BUFFER}getDefaults(){return Object.assign(super.getDefaults(),{uri:""})}getURI(){return this.get("uri")}setURI(e){return this.set("uri",e)}}class Xe extends te{init(){this.propertyType=D.CAMERA}getDefaults(){return Object.assign(super.getDefaults(),{type:Xe.Type.PERSPECTIVE,znear:.1,zfar:100,aspectRatio:null,yfov:Math.PI*2*50/360,xmag:1,ymag:1})}getType(){return this.get("type")}setType(e){return this.set("type",e)}getZNear(){return this.get("znear")}setZNear(e){return this.set("znear",e)}getZFar(){return this.get("zfar")}setZFar(e){return this.set("zfar",e)}getAspectRatio(){return this.get("aspectRatio")}setAspectRatio(e){return this.set("aspectRatio",e)}getYFov(){return this.get("yfov")}setYFov(e){return this.set("yfov",e)}getXMag(){return this.get("xmag")}setXMag(e){return this.set("xmag",e)}getYMag(){return this.get("ymag")}setYMag(e){return this.set("ymag",e)}}Xe.Type={PERSPECTIVE:"perspective",ORTHOGRAPHIC:"orthographic"};class k extends ys{_validateParent(e){if(!this.parentTypes.includes(e.propertyType))throw new Error(`Parent "${e.propertyType}" invalid for child "${this.propertyType}".`)}}k.EXTENSION_NAME=void 0;class v extends te{init(){this.propertyType=D.TEXTURE_INFO}getDefaults(){return Object.assign(super.getDefaults(),{texCoord:0,magFilter:null,minFilter:null,wrapS:v.WrapMode.REPEAT,wrapT:v.WrapMode.REPEAT})}getTexCoord(){return this.get("texCoord")}setTexCoord(e){return this.set("texCoord",e)}getMagFilter(){return this.get("magFilter")}setMagFilter(e){return this.set("magFilter",e)}getMinFilter(){return this.get("minFilter")}setMinFilter(e){return this.set("minFilter",e)}getWrapS(){return this.get("wrapS")}setWrapS(e){return this.set("wrapS",e)}getWrapT(){return this.get("wrapT")}setWrapT(e){return this.set("wrapT",e)}}v.WrapMode={CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497};v.MagFilter={NEAREST:9728,LINEAR:9729};v.MinFilter={NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987};const{R:xt,G:yt,B:Ft,A:Ni}=ue;class De extends te{init(){this.propertyType=D.MATERIAL}getDefaults(){return Object.assign(super.getDefaults(),{alphaMode:De.AlphaMode.OPAQUE,alphaCutoff:.5,doubleSided:!1,baseColorFactor:[1,1,1,1],baseColorTexture:null,baseColorTextureInfo:new v(this.graph,"baseColorTextureInfo"),emissiveFactor:[0,0,0],emissiveTexture:null,emissiveTextureInfo:new v(this.graph,"emissiveTextureInfo"),normalScale:1,normalTexture:null,normalTextureInfo:new v(this.graph,"normalTextureInfo"),occlusionStrength:1,occlusionTexture:null,occlusionTextureInfo:new v(this.graph,"occlusionTextureInfo"),roughnessFactor:1,metallicFactor:1,metallicRoughnessTexture:null,metallicRoughnessTextureInfo:new v(this.graph,"metallicRoughnessTextureInfo")})}getDoubleSided(){return this.get("doubleSided")}setDoubleSided(e){return this.set("doubleSided",e)}getAlpha(){return this.get("baseColorFactor")[3]}setAlpha(e){const t=this.get("baseColorFactor").slice();return t[3]=e,this.set("baseColorFactor",t)}getAlphaMode(){return this.get("alphaMode")}setAlphaMode(e){return this.set("alphaMode",e)}getAlphaCutoff(){return this.get("alphaCutoff")}setAlphaCutoff(e){return this.set("alphaCutoff",e)}getBaseColorFactor(){return this.get("baseColorFactor")}setBaseColorFactor(e){return this.set("baseColorFactor",e)}getBaseColorTexture(){return this.getRef("baseColorTexture")}getBaseColorTextureInfo(){return this.getRef("baseColorTexture")?this.getRef("baseColorTextureInfo"):null}setBaseColorTexture(e){return this.setRef("baseColorTexture",e,{channels:xt|yt|Ft|Ni,isColor:!0})}getEmissiveFactor(){return this.get("emissiveFactor")}setEmissiveFactor(e){return this.set("emissiveFactor",e)}getEmissiveTexture(){return this.getRef("emissiveTexture")}getEmissiveTextureInfo(){return this.getRef("emissiveTexture")?this.getRef("emissiveTextureInfo"):null}setEmissiveTexture(e){return this.setRef("emissiveTexture",e,{channels:xt|yt|Ft,isColor:!0})}getNormalScale(){return this.get("normalScale")}setNormalScale(e){return this.set("normalScale",e)}getNormalTexture(){return this.getRef("normalTexture")}getNormalTextureInfo(){return this.getRef("normalTexture")?this.getRef("normalTextureInfo"):null}setNormalTexture(e){return this.setRef("normalTexture",e,{channels:xt|yt|Ft})}getOcclusionStrength(){return this.get("occlusionStrength")}setOcclusionStrength(e){return this.set("occlusionStrength",e)}getOcclusionTexture(){return this.getRef("occlusionTexture")}getOcclusionTextureInfo(){return this.getRef("occlusionTexture")?this.getRef("occlusionTextureInfo"):null}setOcclusionTexture(e){return this.setRef("occlusionTexture",e,{channels:xt})}getRoughnessFactor(){return this.get("roughnessFactor")}setRoughnessFactor(e){return this.set("roughnessFactor",e)}getMetallicFactor(){return this.get("metallicFactor")}setMetallicFactor(e){return this.set("metallicFactor",e)}getMetallicRoughnessTexture(){return this.getRef("metallicRoughnessTexture")}getMetallicRoughnessTextureInfo(){return this.getRef("metallicRoughnessTexture")?this.getRef("metallicRoughnessTextureInfo"):null}setMetallicRoughnessTexture(e){return this.setRef("metallicRoughnessTexture",e,{channels:yt|Ft})}}De.AlphaMode={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};class jn extends te{init(){this.propertyType=D.MESH}getDefaults(){return Object.assign(super.getDefaults(),{weights:[],primitives:new K})}addPrimitive(e){return this.addRef("primitives",e)}removePrimitive(e){return this.removeRef("primitives",e)}listPrimitives(){return this.listRefs("primitives")}getWeights(){return this.get("weights")}setWeights(e){return this.set("weights",e)}}class Fs extends te{init(){this.propertyType=D.NODE}getDefaults(){return Object.assign(super.getDefaults(),{translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1],weights:[],camera:null,mesh:null,skin:null,children:new K})}copy(e,t=Fe){if(t===Fe)throw new Error("Node cannot be copied.");return super.copy(e,t)}getTranslation(){return this.get("translation")}getRotation(){return this.get("rotation")}getScale(){return this.get("scale")}setTranslation(e){return this.set("translation",e)}setRotation(e){return this.set("rotation",e)}setScale(e){return this.set("scale",e)}getMatrix(){return H.compose(this.get("translation"),this.get("rotation"),this.get("scale"),[])}setMatrix(e){const t=this.get("translation").slice(),r=this.get("rotation").slice(),n=this.get("scale").slice();return H.decompose(e,t,r,n),this.set("translation",t).set("rotation",r).set("scale",n)}getWorldTranslation(){const e=[0,0,0];return H.decompose(this.getWorldMatrix(),e,[0,0,0,1],[1,1,1]),e}getWorldRotation(){const e=[0,0,0,1];return H.decompose(this.getWorldMatrix(),[0,0,0],e,[1,1,1]),e}getWorldScale(){const e=[1,1,1];return H.decompose(this.getWorldMatrix(),[0,0,0],[0,0,0,1],e),e}getWorldMatrix(){const e=[];for(let n=this;n!=null;n=n.getParentNode())e.push(n);let t;const r=e.pop().getMatrix();for(;t=e.pop();)di(r,r,t.getMatrix());return r}addChild(e){const t=e.getParentNode();t&&t.removeChild(e);for(const r of e.listParents())r.propertyType===D.SCENE&&r.removeChild(e);return this.addRef("children",e)}removeChild(e){return this.removeRef("children",e)}listChildren(){return this.listRefs("children")}getParentNode(){for(const e of this.listParents())if(e.propertyType===D.NODE)return e;return null}getMesh(){return this.getRef("mesh")}setMesh(e){return this.setRef("mesh",e)}getCamera(){return this.getRef("camera")}setCamera(e){return this.setRef("camera",e)}getSkin(){return this.getRef("skin")}setSkin(e){return this.setRef("skin",e)}getWeights(){return this.get("weights")}setWeights(e){return this.set("weights",e)}traverse(e){e(this);for(const t of this.listChildren())t.traverse(e);return this}}class j extends te{init(){this.propertyType=D.PRIMITIVE}getDefaults(){return Object.assign(super.getDefaults(),{mode:j.Mode.TRIANGLES,material:null,indices:null,attributes:new he,targets:new K})}getIndices(){return this.getRef("indices")}setIndices(e){return this.setRef("indices",e,{usage:ie.ELEMENT_ARRAY_BUFFER})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:ie.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}getMaterial(){return this.getRef("material")}setMaterial(e){return this.setRef("material",e)}getMode(){return this.get("mode")}setMode(e){return this.set("mode",e)}listTargets(){return this.listRefs("targets")}addTarget(e){return this.addRef("targets",e)}removeTarget(e){return this.removeRef("targets",e)}}j.Mode={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6};class Xn extends ys{init(){this.propertyType=D.PRIMITIVE_TARGET}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new he})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:ie.ARRAY_BUFFER})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}function ee(){return ee=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},ee.apply(this,arguments)}class Jt extends te{init(){this.propertyType=D.SCENE}getDefaults(){return Object.assign(super.getDefaults(),{children:new K})}copy(e,t=Fe){if(t===Fe)throw new Error("Scene cannot be copied.");return super.copy(e,t)}addChild(e){const t=e.getParentNode();return t&&t.removeChild(e),this.addRef("children",e)}removeChild(e){return this.removeRef("children",e)}listChildren(){return this.listRefs("children")}traverse(e){for(const t of this.listChildren())t.traverse(e);return this}}class Wn extends te{init(){this.propertyType=D.SKIN}getDefaults(){return Object.assign(super.getDefaults(),{skeleton:null,inverseBindMatrices:null,joints:new K})}getSkeleton(){return this.getRef("skeleton")}setSkeleton(e){return this.setRef("skeleton",e)}getInverseBindMatrices(){return this.getRef("inverseBindMatrices")}setInverseBindMatrices(e){return this.setRef("inverseBindMatrices",e,{usage:ie.INVERSE_BIND_MATRICES})}addJoint(e){return this.addRef("joints",e)}removeJoint(e){return this.removeRef("joints",e)}listJoints(){return this.listRefs("joints")}}class Ct extends te{init(){this.propertyType=D.TEXTURE}getDefaults(){return Object.assign(super.getDefaults(),{image:null,mimeType:"",uri:""})}getMimeType(){return this.get("mimeType")||pe.extensionToMimeType(tt.extension(this.get("uri")))}setMimeType(e){return this.set("mimeType",e)}getURI(){return this.get("uri")}setURI(e){this.set("uri",e);const t=pe.extensionToMimeType(tt.extension(e));return t&&this.set("mimeType",t),this}getImage(){return this.get("image")}setImage(e){return this.set("image",G.assertView(e))}getSize(){const e=this.get("image");return e?pe.getSize(e,this.getMimeType()):null}}class ot extends te{init(){this.propertyType=D.ROOT}getDefaults(){return Object.assign(super.getDefaults(),{asset:{generator:`glTF-Transform ${vn}`,version:"2.0"},defaultScene:null,accessors:new K,animations:new K,buffers:new K,cameras:new K,materials:new K,meshes:new K,nodes:new K,scenes:new K,skins:new K,textures:new K})}constructor(e){super(e),this._extensions=new Set,e.addEventListener("node:create",t=>{this._addChildOfRoot(t.target)})}clone(){throw new Error("Root cannot be cloned.")}copy(e,t=Fe){if(t===Fe)throw new Error("Root cannot be copied.");this.set("asset",ee({},e.get("asset"))),this.setName(e.getName()),this.setExtras(ee({},e.getExtras())),this.setDefaultScene(e.getDefaultScene()?t(e.getDefaultScene()):null);for(const r of e.listRefMapKeys("extensions")){const n=e.getExtension(r);this.setExtension(r,t(n))}return this}_addChildOfRoot(e){return e instanceof Jt?this.addRef("scenes",e):e instanceof Fs?this.addRef("nodes",e):e instanceof Xe?this.addRef("cameras",e):e instanceof Wn?this.addRef("skins",e):e instanceof jn?this.addRef("meshes",e):e instanceof De?this.addRef("materials",e):e instanceof Ct?this.addRef("textures",e):e instanceof Vn?this.addRef("animations",e):e instanceof S?this.addRef("accessors",e):e instanceof kn&&this.addRef("buffers",e),this}getAsset(){return this.get("asset")}listExtensionsUsed(){return Array.from(this._extensions)}listExtensionsRequired(){return this.listExtensionsUsed().filter(e=>e.isRequired())}_enableExtension(e){return this._extensions.add(e),this}_disableExtension(e){return this._extensions.delete(e),this}listScenes(){return this.listRefs("scenes")}setDefaultScene(e){return this.setRef("defaultScene",e)}getDefaultScene(){return this.getRef("defaultScene")}listNodes(){return this.listRefs("nodes")}listCameras(){return this.listRefs("cameras")}listSkins(){return this.listRefs("skins")}listMeshes(){return this.listRefs("meshes")}listMaterials(){return this.listRefs("materials")}listTextures(){return this.listRefs("textures")}listAnimations(){return this.listRefs("animations")}listAccessors(){return this.listRefs("accessors")}listBuffers(){return this.listRefs("buffers")}}class fe{static fromGraph(e){return fe._GRAPH_DOCUMENTS.get(e)||null}constructor(){this._graph=new ci,this._root=new ot(this._graph),this._logger=Ae.DEFAULT_INSTANCE,fe._GRAPH_DOCUMENTS.set(this._graph,this)}getRoot(){return this._root}getGraph(){return this._graph}getLogger(){return this._logger}setLogger(e){return this._logger=e,this}clone(){throw new Error("Use 'cloneDocument(source)' from '@gltf-transform/functions'.")}merge(e){throw new Error("Use 'mergeDocuments(target, source)' from '@gltf-transform/functions'.")}async transform(...e){const t=e.map(r=>r.name);for(const r of e)await r(this,{stack:t});return this}createExtension(e){const t=e.EXTENSION_NAME;return this.getRoot().listExtensionsUsed().find(n=>n.extensionName===t)||new e(this)}createScene(e=""){return new Jt(this._graph,e)}createNode(e=""){return new Fs(this._graph,e)}createCamera(e=""){return new Xe(this._graph,e)}createSkin(e=""){return new Wn(this._graph,e)}createMesh(e=""){return new jn(this._graph,e)}createPrimitive(){return new j(this._graph)}createPrimitiveTarget(e=""){return new Xn(this._graph,e)}createMaterial(e=""){return new De(this._graph,e)}createTexture(e=""){return new Ct(this._graph,e)}createAnimation(e=""){return new Vn(this._graph,e)}createAnimationChannel(e=""){return new rt(this._graph,e)}createAnimationSampler(e=""){return new it(this._graph,e)}createAccessor(e="",t=null){return t||(t=this.getRoot().listBuffers()[0]),new S(this._graph,e).setBuffer(t)}createBuffer(e=""){return new kn(this._graph,e)}}fe._GRAPH_DOCUMENTS=new WeakMap;class J{constructor(e){this.extensionName="",this.prereadTypes=[],this.prewriteTypes=[],this.readDependencies=[],this.writeDependencies=[],this.document=void 0,this.required=!1,this.properties=new Set,this._listener=void 0,this.document=e,e.getRoot()._enableExtension(this),this._listener=r=>{const n=r,i=n.target;i instanceof k&&i.extensionName===this.extensionName&&(n.type==="node:create"&&this._addExtensionProperty(i),n.type==="node:dispose"&&this._removeExtensionProperty(i))};const t=e.getGraph();t.addEventListener("node:create",this._listener),t.addEventListener("node:dispose",this._listener)}dispose(){this.document.getRoot()._disableExtension(this);const e=this.document.getGraph();e.removeEventListener("node:create",this._listener),e.removeEventListener("node:dispose",this._listener);for(const t of this.properties)t.dispose()}static register(){}isRequired(){return this.required}setRequired(e){return this.required=e,this}listProperties(){return Array.from(this.properties)}_addExtensionProperty(e){return this.properties.add(e),this}_removeExtensionProperty(e){return this.properties.delete(e),this}install(e,t){return this}preread(e,t){return this}prewrite(e,t){return this}}J.EXTENSION_NAME=void 0;class Si{constructor(e){this.jsonDoc=void 0,this.buffers=[],this.bufferViews=[],this.bufferViewBuffers=[],this.accessors=[],this.textures=[],this.textureInfos=new Map,this.materials=[],this.meshes=[],this.cameras=[],this.nodes=[],this.skins=[],this.animations=[],this.scenes=[],this.jsonDoc=e}setTextureInfo(e,t){this.textureInfos.set(e,t),t.texCoord!==void 0&&e.setTexCoord(t.texCoord),t.extras!==void 0&&e.setExtras(t.extras);const r=this.jsonDoc.json.textures[t.index];if(r.sampler===void 0)return;const n=this.jsonDoc.json.samplers[r.sampler];n.magFilter!==void 0&&e.setMagFilter(n.magFilter),n.minFilter!==void 0&&e.setMinFilter(n.minFilter),n.wrapS!==void 0&&e.setWrapS(n.wrapS),n.wrapT!==void 0&&e.setWrapT(n.wrapT)}}const sn={logger:Ae.DEFAULT_INSTANCE,extensions:[],dependencies:{}},bi=new Set([D.BUFFER,D.TEXTURE,D.MATERIAL,D.MESH,D.PRIMITIVE,D.NODE,D.SCENE]);class Li{static read(e,t=sn){const r=ee({},sn,t),{json:n}=e,i=new fe().setLogger(r.logger);this.validate(e,r);const o=new Si(e),a=n.asset,c=i.getRoot().getAsset();a.copyright&&(c.copyright=a.copyright),a.extras&&(c.extras=a.extras),n.extras!==void 0&&i.getRoot().setExtras(ee({},n.extras));const u=n.extensionsUsed||[],f=n.extensionsRequired||[];r.extensions.sort((C,x)=>C.EXTENSION_NAME>x.EXTENSION_NAME?1:-1);for(const C of r.extensions)if(u.includes(C.EXTENSION_NAME)){const x=i.createExtension(C).setRequired(f.includes(C.EXTENSION_NAME)),F=x.prereadTypes.filter(M=>!bi.has(M));F.length&&r.logger.warn(`Preread hooks for some types (${F.join()}), requested by extension ${x.extensionName}, are unsupported. Please file an issue or a PR.`);for(const M of x.readDependencies)x.install(M,r.dependencies[M])}const B=n.buffers||[];i.getRoot().listExtensionsUsed().filter(C=>C.prereadTypes.includes(D.BUFFER)).forEach(C=>C.preread(o,D.BUFFER)),o.buffers=B.map(C=>{const x=i.createBuffer(C.name);return C.extras&&x.setExtras(C.extras),C.uri&&C.uri.indexOf("__")!==0&&x.setURI(C.uri),x});const A=n.bufferViews||[];o.bufferViewBuffers=A.map((C,x)=>{if(!o.bufferViews[x]){const F=e.json.buffers[C.buffer],M=F.uri?e.resources[F.uri]:e.resources[et],R=C.byteOffset||0;o.bufferViews[x]=G.toView(M,R,C.byteLength)}return o.buffers[C.buffer]});const l=n.accessors||[];o.accessors=l.map(C=>{const x=o.bufferViewBuffers[C.bufferView],F=i.createAccessor(C.name,x).setType(C.type);return C.extras&&F.setExtras(C.extras),C.normalized!==void 0&&F.setNormalized(C.normalized),C.bufferView===void 0||F.setArray(Nt(C,o)),F});const h=n.images||[],g=n.textures||[];i.getRoot().listExtensionsUsed().filter(C=>C.prereadTypes.includes(D.TEXTURE)).forEach(C=>C.preread(o,D.TEXTURE)),o.textures=h.map(C=>{const x=i.createTexture(C.name);if(C.extras&&x.setExtras(C.extras),C.bufferView!==void 0){const F=n.bufferViews[C.bufferView],M=e.json.buffers[F.buffer],R=M.uri?e.resources[M.uri]:e.resources[et],b=F.byteOffset||0,N=F.byteLength,w=R.slice(b,b+N);x.setImage(w)}else C.uri!==void 0&&(x.setImage(e.resources[C.uri]),C.uri.indexOf("__")!==0&&x.setURI(C.uri));if(C.mimeType!==void 0)x.setMimeType(C.mimeType);else if(C.uri){const F=tt.extension(C.uri);x.setMimeType(pe.extensionToMimeType(F))}return x}),i.getRoot().listExtensionsUsed().filter(C=>C.prereadTypes.includes(D.MATERIAL)).forEach(C=>C.preread(o,D.MATERIAL));const d=n.materials||[];o.materials=d.map(C=>{const x=i.createMaterial(C.name);C.extras&&x.setExtras(C.extras),C.alphaMode!==void 0&&x.setAlphaMode(C.alphaMode),C.alphaCutoff!==void 0&&x.setAlphaCutoff(C.alphaCutoff),C.doubleSided!==void 0&&x.setDoubleSided(C.doubleSided);const F=C.pbrMetallicRoughness||{};if(F.baseColorFactor!==void 0&&x.setBaseColorFactor(F.baseColorFactor),C.emissiveFactor!==void 0&&x.setEmissiveFactor(C.emissiveFactor),F.metallicFactor!==void 0&&x.setMetallicFactor(F.metallicFactor),F.roughnessFactor!==void 0&&x.setRoughnessFactor(F.roughnessFactor),F.baseColorTexture!==void 0){const M=F.baseColorTexture,R=o.textures[g[M.index].source];x.setBaseColorTexture(R),o.setTextureInfo(x.getBaseColorTextureInfo(),M)}if(C.emissiveTexture!==void 0){const M=C.emissiveTexture,R=o.textures[g[M.index].source];x.setEmissiveTexture(R),o.setTextureInfo(x.getEmissiveTextureInfo(),M)}if(C.normalTexture!==void 0){const M=C.normalTexture,R=o.textures[g[M.index].source];x.setNormalTexture(R),o.setTextureInfo(x.getNormalTextureInfo(),M),C.normalTexture.scale!==void 0&&x.setNormalScale(C.normalTexture.scale)}if(C.occlusionTexture!==void 0){const M=C.occlusionTexture,R=o.textures[g[M.index].source];x.setOcclusionTexture(R),o.setTextureInfo(x.getOcclusionTextureInfo(),M),C.occlusionTexture.strength!==void 0&&x.setOcclusionStrength(C.occlusionTexture.strength)}if(F.metallicRoughnessTexture!==void 0){const M=F.metallicRoughnessTexture,R=o.textures[g[M.index].source];x.setMetallicRoughnessTexture(R),o.setTextureInfo(x.getMetallicRoughnessTextureInfo(),M)}return x}),i.getRoot().listExtensionsUsed().filter(C=>C.prereadTypes.includes(D.MESH)).forEach(C=>C.preread(o,D.MESH));const p=n.meshes||[];i.getRoot().listExtensionsUsed().filter(C=>C.prereadTypes.includes(D.PRIMITIVE)).forEach(C=>C.preread(o,D.PRIMITIVE)),o.meshes=p.map(C=>{const x=i.createMesh(C.name);return C.extras&&x.setExtras(C.extras),C.weights!==void 0&&x.setWeights(C.weights),(C.primitives||[]).forEach(M=>{const R=i.createPrimitive();M.extras&&R.setExtras(M.extras),M.material!==void 0&&R.setMaterial(o.materials[M.material]),M.mode!==void 0&&R.setMode(M.mode);for(const[w,L]of Object.entries(M.attributes||{}))R.setAttribute(w,o.accessors[L]);M.indices!==void 0&&R.setIndices(o.accessors[M.indices]);const b=C.extras&&C.extras.targetNames||[];(M.targets||[]).forEach((w,L)=>{const _=b[L]||L.toString(),U=i.createPrimitiveTarget(_);for(const[se,Q]of Object.entries(w))U.setAttribute(se,o.accessors[Q]);R.addTarget(U)}),x.addPrimitive(R)}),x});const y=n.cameras||[];o.cameras=y.map(C=>{const x=i.createCamera(C.name).setType(C.type);if(C.extras&&x.setExtras(C.extras),C.type===Xe.Type.PERSPECTIVE){const F=C.perspective;x.setYFov(F.yfov),x.setZNear(F.znear),F.zfar!==void 0&&x.setZFar(F.zfar),F.aspectRatio!==void 0&&x.setAspectRatio(F.aspectRatio)}else{const F=C.orthographic;x.setZNear(F.znear).setZFar(F.zfar).setXMag(F.xmag).setYMag(F.ymag)}return x});const T=n.nodes||[];i.getRoot().listExtensionsUsed().filter(C=>C.prereadTypes.includes(D.NODE)).forEach(C=>C.preread(o,D.NODE)),o.nodes=T.map(C=>{const x=i.createNode(C.name);if(C.extras&&x.setExtras(C.extras),C.translation!==void 0&&x.setTranslation(C.translation),C.rotation!==void 0&&x.setRotation(C.rotation),C.scale!==void 0&&x.setScale(C.scale),C.matrix!==void 0){const F=[0,0,0],M=[0,0,0,1],R=[1,1,1];H.decompose(C.matrix,F,M,R),x.setTranslation(F),x.setRotation(M),x.setScale(R)}return C.weights!==void 0&&x.setWeights(C.weights),x});const I=n.skins||[];o.skins=I.map(C=>{const x=i.createSkin(C.name);C.extras&&x.setExtras(C.extras),C.inverseBindMatrices!==void 0&&x.setInverseBindMatrices(o.accessors[C.inverseBindMatrices]),C.skeleton!==void 0&&x.setSkeleton(o.nodes[C.skeleton]);for(const F of C.joints)x.addJoint(o.nodes[F]);return x}),T.map((C,x)=>{const F=o.nodes[x];(C.children||[]).forEach(R=>F.addChild(o.nodes[R])),C.mesh!==void 0&&F.setMesh(o.meshes[C.mesh]),C.camera!==void 0&&F.setCamera(o.cameras[C.camera]),C.skin!==void 0&&F.setSkin(o.skins[C.skin])});const E=n.animations||[];o.animations=E.map(C=>{const x=i.createAnimation(C.name);C.extras&&x.setExtras(C.extras);const M=(C.samplers||[]).map(b=>{const N=i.createAnimationSampler().setInput(o.accessors[b.input]).setOutput(o.accessors[b.output]).setInterpolation(b.interpolation||it.Interpolation.LINEAR);return b.extras&&N.setExtras(b.extras),x.addSampler(N),N});return(C.channels||[]).forEach(b=>{const N=i.createAnimationChannel().setSampler(M[b.sampler]).setTargetPath(b.target.path);b.target.node!==void 0&&N.setTargetNode(o.nodes[b.target.node]),b.extras&&N.setExtras(b.extras),x.addChannel(N)}),x});const m=n.scenes||[];return i.getRoot().listExtensionsUsed().filter(C=>C.prereadTypes.includes(D.SCENE)).forEach(C=>C.preread(o,D.SCENE)),o.scenes=m.map(C=>{const x=i.createScene(C.name);return C.extras&&x.setExtras(C.extras),(C.nodes||[]).map(M=>o.nodes[M]).forEach(M=>x.addChild(M)),x}),n.scene!==void 0&&i.getRoot().setDefaultScene(o.scenes[n.scene]),i.getRoot().listExtensionsUsed().forEach(C=>C.read(o)),l.forEach((C,x)=>{const F=o.accessors[x],M=!!C.sparse,R=!C.bufferView&&!F.getArray();(M||R)&&F.setSparse(!0).setArray(Oi(C,o))}),i}static validate(e,t){const r=e.json;if(r.asset.version!=="2.0")throw new Error(`Unsupported glTF version, "${r.asset.version}".`);if(r.extensionsRequired){for(const n of r.extensionsRequired)if(!t.extensions.find(i=>i.EXTENSION_NAME===n))throw new Error(`Missing required extension, "${n}".`)}if(r.extensionsUsed)for(const n of r.extensionsUsed)t.extensions.find(i=>i.EXTENSION_NAME===n)||t.logger.warn(`Missing optional extension, "${n}".`)}}function wi(s,e){const t=e.jsonDoc,r=e.bufferViews[s.bufferView],n=t.json.bufferViews[s.bufferView],i=Tt[s.componentType],o=S.getElementSize(s.type),a=i.BYTES_PER_ELEMENT,c=s.byteOffset||0,u=new i(s.count*o),f=new DataView(r.buffer,r.byteOffset,r.byteLength),B=n.byteStride;for(let A=0;A<s.count;A++)for(let l=0;l<o;l++){const h=c+A*B+l*a;let g;switch(s.componentType){case S.ComponentType.FLOAT:g=f.getFloat32(h,!0);break;case S.ComponentType.UNSIGNED_INT:g=f.getUint32(h,!0);break;case S.ComponentType.UNSIGNED_SHORT:g=f.getUint16(h,!0);break;case S.ComponentType.UNSIGNED_BYTE:g=f.getUint8(h);break;case S.ComponentType.SHORT:g=f.getInt16(h,!0);break;case S.ComponentType.BYTE:g=f.getInt8(h);break;default:throw new Error(`Unexpected componentType "${s.componentType}".`)}u[A*o+l]=g}return u}function Nt(s,e){const t=e.jsonDoc,r=e.bufferViews[s.bufferView],n=t.json.bufferViews[s.bufferView],i=Tt[s.componentType],o=S.getElementSize(s.type),a=i.BYTES_PER_ELEMENT,c=o*a;if(n.byteStride!==void 0&&n.byteStride!==c)return wi(s,e);const u=r.byteOffset+(s.byteOffset||0),f=s.count*o*a;return new i(r.buffer.slice(u,u+f))}function Oi(s,e){const t=Tt[s.componentType],r=S.getElementSize(s.type);let n;s.bufferView!==void 0?n=Nt(s,e):n=new t(s.count*r);const i=s.sparse;if(!i)return n;const o=i.count,a=ee({},s,i.indices,{count:o,type:"SCALAR"}),c=ee({},s,i.values,{count:o}),u=Nt(a,e),f=Nt(c,e);for(let B=0;B<a.count;B++)for(let A=0;A<r;A++)n[u[B]*r+A]=f[B*r+A];return n}var Et;(function(s){s[s.ARRAY_BUFFER=34962]="ARRAY_BUFFER",s[s.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER"})(Et||(Et={}));class ge{constructor(e,t,r){this._doc=void 0,this.jsonDoc=void 0,this.options=void 0,this.accessorIndexMap=new Map,this.animationIndexMap=new Map,this.bufferIndexMap=new Map,this.cameraIndexMap=new Map,this.skinIndexMap=new Map,this.materialIndexMap=new Map,this.meshIndexMap=new Map,this.nodeIndexMap=new Map,this.imageIndexMap=new Map,this.textureDefIndexMap=new Map,this.textureInfoDefMap=new Map,this.samplerDefIndexMap=new Map,this.sceneIndexMap=new Map,this.imageBufferViews=[],this.otherBufferViews=new Map,this.otherBufferViewsIndexMap=new Map,this.extensionData={},this.bufferURIGenerator=void 0,this.imageURIGenerator=void 0,this.logger=void 0,this._accessorUsageMap=new Map,this.accessorUsageGroupedByParent=new Set(["ARRAY_BUFFER"]),this.accessorParents=new Map,this._doc=e,this.jsonDoc=t,this.options=r;const n=e.getRoot(),i=n.listBuffers().length,o=n.listTextures().length;this.bufferURIGenerator=new nn(i>1,()=>r.basename||"buffer"),this.imageURIGenerator=new nn(o>1,a=>Gi(e,a)||r.basename||"texture"),this.logger=e.getLogger()}createTextureInfoDef(e,t){const r={magFilter:t.getMagFilter()||void 0,minFilter:t.getMinFilter()||void 0,wrapS:t.getWrapS(),wrapT:t.getWrapT()},n=JSON.stringify(r);this.samplerDefIndexMap.has(n)||(this.samplerDefIndexMap.set(n,this.jsonDoc.json.samplers.length),this.jsonDoc.json.samplers.push(r));const i={source:this.imageIndexMap.get(e),sampler:this.samplerDefIndexMap.get(n)},o=JSON.stringify(i);this.textureDefIndexMap.has(o)||(this.textureDefIndexMap.set(o,this.jsonDoc.json.textures.length),this.jsonDoc.json.textures.push(i));const a={index:this.textureDefIndexMap.get(o)};return t.getTexCoord()!==0&&(a.texCoord=t.getTexCoord()),Object.keys(t.getExtras()).length>0&&(a.extras=t.getExtras()),this.textureInfoDefMap.set(t,a),a}createPropertyDef(e){const t={};return e.getName()&&(t.name=e.getName()),Object.keys(e.getExtras()).length>0&&(t.extras=e.getExtras()),t}createAccessorDef(e){const t=this.createPropertyDef(e);return t.type=e.getType(),t.componentType=e.getComponentType(),t.count=e.getCount(),this._doc.getGraph().listParentEdges(e).some(n=>n.getName()==="attributes"&&n.getAttributes().key==="POSITION"||n.getName()==="input")&&(t.max=e.getMax([]).map(Math.fround),t.min=e.getMin([]).map(Math.fround)),e.getNormalized()&&(t.normalized=e.getNormalized()),t}createImageData(e,t,r){if(this.options.format===ke.GLB)this.imageBufferViews.push(t),e.bufferView=this.jsonDoc.json.bufferViews.length,this.jsonDoc.json.bufferViews.push({buffer:0,byteOffset:-1,byteLength:t.byteLength});else{const n=pe.mimeTypeToExtension(r.getMimeType());e.uri=this.imageURIGenerator.createURI(r,n),this.jsonDoc.resources[e.uri]=t}}getAccessorUsage(e){const t=this._accessorUsageMap.get(e);if(t)return t;if(e.getSparse())return ie.SPARSE;for(const r of this._doc.getGraph().listParentEdges(e)){const{usage:n}=r.getAttributes();if(n)return n;r.getParent().propertyType!==D.ROOT&&this.logger.warn(`Missing attribute ".usage" on edge, "${r.getName()}".`)}return ie.OTHER}addAccessorToUsageGroup(e,t){const r=this._accessorUsageMap.get(e);if(r&&r!==t)throw new Error(`Accessor with usage "${r}" cannot be reused as "${t}".`);return this._accessorUsageMap.set(e,t),this}}ge.BufferViewTarget=Et;ge.BufferViewUsage=ie;ge.USAGE_TO_TARGET={[ie.ARRAY_BUFFER]:Et.ARRAY_BUFFER,[ie.ELEMENT_ARRAY_BUFFER]:Et.ELEMENT_ARRAY_BUFFER};class nn{constructor(e,t){this.multiple=void 0,this.basename=void 0,this.counter={},this.multiple=e,this.basename=t}createURI(e,t){if(e.getURI())return e.getURI();if(this.multiple){const r=this.basename(e);return this.counter[r]=this.counter[r]||1,`${r}_${this.counter[r]++}.${t}`}else return`${this.basename(e)}.${t}`}}function Gi(s,e){const t=s.getGraph().listParentEdges(e).find(r=>r.getParent()!==s.getRoot());return t?t.getName().replace(/texture$/i,""):""}const{BufferViewUsage:Mt}=ge,{UNSIGNED_INT:Hi,UNSIGNED_SHORT:Pi,UNSIGNED_BYTE:_i}=S.ComponentType,vi=new Set([D.ACCESSOR,D.BUFFER,D.MATERIAL,D.MESH]);class Ui{static write(e,t){const r=e.getGraph(),n=e.getRoot(),i={asset:ee({generator:`glTF-Transform ${vn}`},n.getAsset()),extras:ee({},n.getExtras())},o={json:i,resources:{}},a=new ge(e,o,t),c=t.logger||Ae.DEFAULT_INSTANCE,u=new Set(t.extensions.map(p=>p.EXTENSION_NAME)),f=e.getRoot().listExtensionsUsed().filter(p=>u.has(p.extensionName)).sort((p,y)=>p.extensionName>y.extensionName?1:-1),B=e.getRoot().listExtensionsRequired().filter(p=>u.has(p.extensionName)).sort((p,y)=>p.extensionName>y.extensionName?1:-1);f.length<e.getRoot().listExtensionsUsed().length&&c.warn("Some extensions were not registered for I/O, and will not be written.");for(const p of f){const y=p.prewriteTypes.filter(T=>!vi.has(T));y.length&&c.warn(`Prewrite hooks for some types (${y.join()}), requested by extension ${p.extensionName}, are unsupported. Please file an issue or a PR.`);for(const T of p.writeDependencies)p.install(T,t.dependencies[T])}function A(p,y,T,I){const E=[];let m=0;for(const F of p){const M=a.createAccessorDef(F);M.bufferView=i.bufferViews.length;const R=F.getArray(),b=G.pad(G.toView(R));M.byteOffset=m,m+=b.byteLength,E.push(b),a.accessorIndexMap.set(F,i.accessors.length),i.accessors.push(M)}const C=G.concat(E),x={buffer:y,byteOffset:T,byteLength:C.byteLength};return I&&(x.target=I),i.bufferViews.push(x),{buffers:E,byteLength:m}}function l(p,y,T){const I=p[0].getCount();let E=0;for(const M of p){const R=a.createAccessorDef(M);R.bufferView=i.bufferViews.length,R.byteOffset=E;const b=M.getElementSize(),N=M.getComponentSize();E+=G.padNumber(b*N),a.accessorIndexMap.set(M,i.accessors.length),i.accessors.push(R)}const m=I*E,C=new ArrayBuffer(m),x=new DataView(C);for(let M=0;M<I;M++){let R=0;for(const b of p){const N=b.getElementSize(),w=b.getComponentSize(),L=b.getComponentType(),_=b.getArray();for(let U=0;U<N;U++){const se=M*E+R+U*w,Q=_[M*N+U];switch(L){case S.ComponentType.FLOAT:x.setFloat32(se,Q,!0);break;case S.ComponentType.BYTE:x.setInt8(se,Q);break;case S.ComponentType.SHORT:x.setInt16(se,Q,!0);break;case S.ComponentType.UNSIGNED_BYTE:x.setUint8(se,Q);break;case S.ComponentType.UNSIGNED_SHORT:x.setUint16(se,Q,!0);break;case S.ComponentType.UNSIGNED_INT:x.setUint32(se,Q,!0);break;default:throw new Error("Unexpected component type: "+L)}}R+=G.padNumber(N*w)}}const F={buffer:y,byteOffset:T,byteLength:m,byteStride:E,target:ge.BufferViewTarget.ARRAY_BUFFER};return i.bufferViews.push(F),{byteLength:m,buffers:[new Uint8Array(C)]}}function h(p,y,T){const I=[];let E=0;const m=new Map;let C=-1/0,x=!1;for(const L of p){const _=a.createAccessorDef(L);i.accessors.push(_),a.accessorIndexMap.set(L,i.accessors.length-1);const U=[],se=[],Q=[],q=new Array(L.getElementSize()).fill(0);for(let Te=0,Pr=L.getCount();Te<Pr;Te++)if(L.getElement(Te,Q),!H.eq(Q,q,0)){C=Math.max(Te,C),U.push(Te);for(let Yt=0;Yt<Q.length;Yt++)se.push(Q[Yt])}const ne=U.length,Ie={accessorDef:_,count:ne};if(m.set(L,Ie),ne===0)continue;ne>L.getCount()/2&&(x=!0);const Wt=Tt[L.getComponentType()];Ie.indices=U,Ie.values=new Wt(se)}if(!Number.isFinite(C))return{buffers:I,byteLength:E};x&&c.warn("Some sparse accessors have >50% non-zero elements, which may increase file size.");const F=C<255?Uint8Array:C<65535?Uint16Array:Uint32Array,M=C<255?_i:C<65535?Pi:Hi,R={buffer:y,byteOffset:T+E,byteLength:0};for(const L of p){const _=m.get(L);if(_.count===0)continue;_.indicesByteOffset=R.byteLength;const U=G.pad(G.toView(new F(_.indices)));I.push(U),E+=U.byteLength,R.byteLength+=U.byteLength}i.bufferViews.push(R);const b=i.bufferViews.length-1,N={buffer:y,byteOffset:T+E,byteLength:0};for(const L of p){const _=m.get(L);if(_.count===0)continue;_.valuesByteOffset=N.byteLength;const U=G.pad(G.toView(_.values));I.push(U),E+=U.byteLength,N.byteLength+=U.byteLength}i.bufferViews.push(N);const w=i.bufferViews.length-1;for(const L of p){const _=m.get(L);_.count!==0&&(_.accessorDef.sparse={count:_.count,indices:{bufferView:b,byteOffset:_.indicesByteOffset,componentType:M},values:{bufferView:w,byteOffset:_.valuesByteOffset}})}return{buffers:I,byteLength:E}}if(i.accessors=[],i.bufferViews=[],i.samplers=[],i.textures=[],i.images=n.listTextures().map((p,y)=>{const T=a.createPropertyDef(p);p.getMimeType()&&(T.mimeType=p.getMimeType());const I=p.getImage();return I&&a.createImageData(T,I,p),a.imageIndexMap.set(p,y),T}),f.filter(p=>p.prewriteTypes.includes(D.ACCESSOR)).forEach(p=>p.prewrite(a,D.ACCESSOR)),n.listAccessors().forEach(p=>{const y=a.accessorUsageGroupedByParent,T=a.accessorParents;if(a.accessorIndexMap.has(p))return;const I=a.getAccessorUsage(p);if(a.addAccessorToUsageGroup(p,I),y.has(I)){const E=r.listParents(p).find(m=>m.propertyType!==D.ROOT);T.set(p,E)}}),f.filter(p=>p.prewriteTypes.includes(D.BUFFER)).forEach(p=>p.prewrite(a,D.BUFFER)),(n.listAccessors().length>0||n.listTextures().length>0||a.otherBufferViews.size>0)&&n.listBuffers().length===0)throw new Error("Buffer required for Document resources, but none was found.");i.buffers=[],n.listBuffers().forEach((p,y)=>{const T=a.createPropertyDef(p),I=a.accessorUsageGroupedByParent,E=p.listParents().filter(N=>N instanceof S),m=new Set(E.map(N=>a.accessorParents.get(N))),C=new Map(Array.from(m).map((N,w)=>[N,w])),x={};for(const N of E){var F;if(a.accessorIndexMap.has(N))continue;const w=a.getAccessorUsage(N);let L=w;if(I.has(w)){const _=a.accessorParents.get(N);L+=`:${C.get(_)}`}x[F=L]||(x[F]={usage:w,accessors:[]}),x[L].accessors.push(N)}const M=[],R=i.buffers.length;let b=0;for(const{usage:N,accessors:w}of Object.values(x))if(N===Mt.ARRAY_BUFFER&&t.vertexLayout===bt.INTERLEAVED){const L=l(w,R,b);b+=L.byteLength,M.push(...L.buffers)}else if(N===Mt.ARRAY_BUFFER)for(const L of w){const _=l([L],R,b);b+=_.byteLength,M.push(..._.buffers)}else if(N===Mt.SPARSE){const L=h(w,R,b);b+=L.byteLength,M.push(...L.buffers)}else if(N===Mt.ELEMENT_ARRAY_BUFFER){const L=ge.BufferViewTarget.ELEMENT_ARRAY_BUFFER,_=A(w,R,b,L);b+=_.byteLength,M.push(..._.buffers)}else{const L=A(w,R,b);b+=L.byteLength,M.push(...L.buffers)}if(a.imageBufferViews.length&&y===0){for(let N=0;N<a.imageBufferViews.length;N++)if(i.bufferViews[i.images[N].bufferView].byteOffset=b,b+=a.imageBufferViews[N].byteLength,M.push(a.imageBufferViews[N]),b%8){const w=8-b%8;b+=w,M.push(new Uint8Array(w))}}if(a.otherBufferViews.has(p))for(const N of a.otherBufferViews.get(p))i.bufferViews.push({buffer:R,byteOffset:b,byteLength:N.byteLength}),a.otherBufferViewsIndexMap.set(N,i.bufferViews.length-1),b+=N.byteLength,M.push(N);if(b){let N;t.format===ke.GLB?N=et:(N=a.bufferURIGenerator.createURI(p,"bin"),T.uri=N),T.byteLength=b,o.resources[N]=G.concat(M)}i.buffers.push(T),a.bufferIndexMap.set(p,y)}),n.listAccessors().find(p=>!p.getBuffer())&&c.warn("Skipped writing one or more Accessors: no Buffer assigned."),f.filter(p=>p.prewriteTypes.includes(D.MATERIAL)).forEach(p=>p.prewrite(a,D.MATERIAL)),i.materials=n.listMaterials().map((p,y)=>{const T=a.createPropertyDef(p);if(p.getAlphaMode()!==De.AlphaMode.OPAQUE&&(T.alphaMode=p.getAlphaMode()),p.getAlphaMode()===De.AlphaMode.MASK&&(T.alphaCutoff=p.getAlphaCutoff()),p.getDoubleSided()&&(T.doubleSided=!0),T.pbrMetallicRoughness={},H.eq(p.getBaseColorFactor(),[1,1,1,1])||(T.pbrMetallicRoughness.baseColorFactor=p.getBaseColorFactor()),H.eq(p.getEmissiveFactor(),[0,0,0])||(T.emissiveFactor=p.getEmissiveFactor()),p.getRoughnessFactor()!==1&&(T.pbrMetallicRoughness.roughnessFactor=p.getRoughnessFactor()),p.getMetallicFactor()!==1&&(T.pbrMetallicRoughness.metallicFactor=p.getMetallicFactor()),p.getBaseColorTexture()){const I=p.getBaseColorTexture(),E=p.getBaseColorTextureInfo();T.pbrMetallicRoughness.baseColorTexture=a.createTextureInfoDef(I,E)}if(p.getEmissiveTexture()){const I=p.getEmissiveTexture(),E=p.getEmissiveTextureInfo();T.emissiveTexture=a.createTextureInfoDef(I,E)}if(p.getNormalTexture()){const I=p.getNormalTexture(),E=p.getNormalTextureInfo(),m=a.createTextureInfoDef(I,E);p.getNormalScale()!==1&&(m.scale=p.getNormalScale()),T.normalTexture=m}if(p.getOcclusionTexture()){const I=p.getOcclusionTexture(),E=p.getOcclusionTextureInfo(),m=a.createTextureInfoDef(I,E);p.getOcclusionStrength()!==1&&(m.strength=p.getOcclusionStrength()),T.occlusionTexture=m}if(p.getMetallicRoughnessTexture()){const I=p.getMetallicRoughnessTexture(),E=p.getMetallicRoughnessTextureInfo();T.pbrMetallicRoughness.metallicRoughnessTexture=a.createTextureInfoDef(I,E)}return a.materialIndexMap.set(p,y),T}),f.filter(p=>p.prewriteTypes.includes(D.MESH)).forEach(p=>p.prewrite(a,D.MESH)),i.meshes=n.listMeshes().map((p,y)=>{const T=a.createPropertyDef(p);let I=null;return T.primitives=p.listPrimitives().map(E=>{const m={attributes:{}};m.mode=E.getMode();const C=E.getMaterial();C&&(m.material=a.materialIndexMap.get(C)),Object.keys(E.getExtras()).length&&(m.extras=E.getExtras());const x=E.getIndices();x&&(m.indices=a.accessorIndexMap.get(x));for(const F of E.listSemantics())m.attributes[F]=a.accessorIndexMap.get(E.getAttribute(F));for(const F of E.listTargets()){const M={};for(const R of F.listSemantics())M[R]=a.accessorIndexMap.get(F.getAttribute(R));m.targets=m.targets||[],m.targets.push(M)}return E.listTargets().length&&!I&&(I=E.listTargets().map(F=>F.getName())),m}),p.getWeights().length&&(T.weights=p.getWeights()),I&&(T.extras=T.extras||{},T.extras.targetNames=I),a.meshIndexMap.set(p,y),T}),i.cameras=n.listCameras().map((p,y)=>{const T=a.createPropertyDef(p);if(T.type=p.getType(),T.type===Xe.Type.PERSPECTIVE){T.perspective={znear:p.getZNear(),zfar:p.getZFar(),yfov:p.getYFov()};const I=p.getAspectRatio();I!==null&&(T.perspective.aspectRatio=I)}else T.orthographic={znear:p.getZNear(),zfar:p.getZFar(),xmag:p.getXMag(),ymag:p.getYMag()};return a.cameraIndexMap.set(p,y),T}),i.nodes=n.listNodes().map((p,y)=>{const T=a.createPropertyDef(p);return H.eq(p.getTranslation(),[0,0,0])||(T.translation=p.getTranslation()),H.eq(p.getRotation(),[0,0,0,1])||(T.rotation=p.getRotation()),H.eq(p.getScale(),[1,1,1])||(T.scale=p.getScale()),p.getWeights().length&&(T.weights=p.getWeights()),a.nodeIndexMap.set(p,y),T}),i.skins=n.listSkins().map((p,y)=>{const T=a.createPropertyDef(p),I=p.getInverseBindMatrices();I&&(T.inverseBindMatrices=a.accessorIndexMap.get(I));const E=p.getSkeleton();return E&&(T.skeleton=a.nodeIndexMap.get(E)),T.joints=p.listJoints().map(m=>a.nodeIndexMap.get(m)),a.skinIndexMap.set(p,y),T}),n.listNodes().forEach((p,y)=>{const T=i.nodes[y],I=p.getMesh();I&&(T.mesh=a.meshIndexMap.get(I));const E=p.getCamera();E&&(T.camera=a.cameraIndexMap.get(E));const m=p.getSkin();m&&(T.skin=a.skinIndexMap.get(m)),p.listChildren().length>0&&(T.children=p.listChildren().map(C=>a.nodeIndexMap.get(C)))}),i.animations=n.listAnimations().map((p,y)=>{const T=a.createPropertyDef(p),I=new Map;return T.samplers=p.listSamplers().map((E,m)=>{const C=a.createPropertyDef(E);return C.input=a.accessorIndexMap.get(E.getInput()),C.output=a.accessorIndexMap.get(E.getOutput()),C.interpolation=E.getInterpolation(),I.set(E,m),C}),T.channels=p.listChannels().map(E=>{const m=a.createPropertyDef(E);return m.sampler=I.get(E.getSampler()),m.target={node:a.nodeIndexMap.get(E.getTargetNode()),path:E.getTargetPath()},m}),a.animationIndexMap.set(p,y),T}),i.scenes=n.listScenes().map((p,y)=>{const T=a.createPropertyDef(p);return T.nodes=p.listChildren().map(I=>a.nodeIndexMap.get(I)),a.sceneIndexMap.set(p,y),T});const d=n.getDefaultScene();return d&&(i.scene=n.listScenes().indexOf(d)),i.extensionsUsed=f.map(p=>p.extensionName),i.extensionsRequired=B.map(p=>p.extensionName),f.forEach(p=>p.write(a)),Ki(i),o}}function Ki(s){const e=[];for(const t in s){const r=s[t];(Array.isArray(r)&&r.length===0||r===null||r===""||r&&typeof r=="object"&&Object.keys(r).length===0)&&e.push(t)}for(const t of e)delete s[t]}var wt;(function(s){s[s.JSON=1313821514]="JSON",s[s.BIN=5130562]="BIN"})(wt||(wt={}));class Ji{constructor(){this._logger=Ae.DEFAULT_INSTANCE,this._extensions=new Set,this._dependencies={},this._vertexLayout=bt.INTERLEAVED,this.lastReadBytes=0,this.lastWriteBytes=0}setLogger(e){return this._logger=e,this}registerExtensions(e){for(const t of e)this._extensions.add(t),t.register();return this}registerDependencies(e){return Object.assign(this._dependencies,e),this}setVertexLayout(e){return this._vertexLayout=e,this}async read(e){return await this.readJSON(await this.readAsJSON(e))}async readAsJSON(e){const t=await this.readURI(e,"view");this.lastReadBytes=t.byteLength;const r=rn(t)?this._binaryToJSON(t):{json:JSON.parse(G.decodeText(t)),resources:{}};return await this._readResourcesExternal(r,this.dirname(e)),this._readResourcesInternal(r),r}async readJSON(e){return e=this._copyJSON(e),this._readResourcesInternal(e),Li.read(e,{extensions:Array.from(this._extensions),dependencies:this._dependencies,logger:this._logger})}async binaryToJSON(e){const t=this._binaryToJSON(G.assertView(e));this._readResourcesInternal(t);const r=t.json;if(r.buffers&&r.buffers.some(n=>Vi(t,n)))throw new Error("Cannot resolve external buffers with binaryToJSON().");if(r.images&&r.images.some(n=>ki(t,n)))throw new Error("Cannot resolve external images with binaryToJSON().");return t}async readBinary(e){return this.readJSON(await this.binaryToJSON(G.assertView(e)))}async writeJSON(e,t={}){if(t.format===ke.GLB&&e.getRoot().listBuffers().length>1)throw new Error("GLB must have 0–1 buffers.");return Ui.write(e,{format:t.format||ke.GLTF,basename:t.basename||"",logger:this._logger,vertexLayout:this._vertexLayout,dependencies:ee({},this._dependencies),extensions:Array.from(this._extensions)})}async writeBinary(e){const{json:t,resources:r}=await this.writeJSON(e,{format:ke.GLB}),n=new Uint32Array([1179937895,2,12]),i=JSON.stringify(t),o=G.pad(G.encodeText(i),32),a=G.toView(new Uint32Array([o.byteLength,1313821514])),c=G.concat([a,o]);n[n.length-1]+=c.byteLength;const u=Object.values(r)[0];if(!u||!u.byteLength)return G.concat([G.toView(n),c]);const f=G.pad(u,0),B=G.toView(new Uint32Array([f.byteLength,5130562])),A=G.concat([B,f]);return n[n.length-1]+=A.byteLength,G.concat([G.toView(n),c,A])}async _readResourcesExternal(e,t){var r=this;const n=e.json.images||[],i=e.json.buffers||[],o=[...n,...i].map(async function(a){const c=a.uri;if(!c||c.match(/data:/))return Promise.resolve();e.resources[c]=await r.readURI(r.resolve(t,c),"view"),r.lastReadBytes+=e.resources[c].byteLength});await Promise.all(o)}_readResourcesInternal(e){function t(i){if(i.uri){if(i.uri in e.resources){G.assertView(e.resources[i.uri]);return}if(i.uri.match(/data:/)){const o=`__${Fi()}.${tt.extension(i.uri)}`;e.resources[o]=G.createBufferFromDataURI(i.uri),i.uri=o}}}(e.json.images||[]).forEach(i=>{if(i.bufferView===void 0&&i.uri===void 0)throw new Error("Missing resource URI or buffer view.");t(i)}),(e.json.buffers||[]).forEach(t)}_copyJSON(e){const{images:t,buffers:r}=e.json;return e={json:ee({},e.json),resources:ee({},e.resources)},t&&(e.json.images=t.map(n=>ee({},n))),r&&(e.json.buffers=r.map(n=>ee({},n))),e}_binaryToJSON(e){if(!rn(e))throw new Error("Invalid glTF 2.0 binary.");const t=new Uint32Array(e.buffer,e.byteOffset+12,2);if(t[1]!==wt.JSON)throw new Error("Missing required GLB JSON chunk.");const r=20,n=t[0],i=G.decodeText(G.toView(e,r,n)),o=JSON.parse(i),a=r+n;if(e.byteLength<=a)return{json:o,resources:{}};const c=new Uint32Array(e.buffer,e.byteOffset+a,2);if(c[1]!==wt.BIN)return{json:o,resources:{}};const u=c[0],f=G.toView(e,a+8,u);return{json:o,resources:{[et]:f}}}}function Vi(s,e){return e.uri!==void 0&&!(e.uri in s.resources)}function ki(s,e){return e.uri!==void 0&&!(e.uri in s.resources)&&e.bufferView===void 0}function rn(s){if(s.byteLength<3*Uint32Array.BYTES_PER_ELEMENT)return!1;const e=new Uint32Array(s.buffer,s.byteOffset,3);return e[0]===1179937895&&e[1]===2}class ji extends Ji{constructor(e=dt.DEFAULT_INIT){super(),this._fetchConfig=void 0,this._fetchConfig=e}async readURI(e,t){const r=await fetch(e,this._fetchConfig);switch(t){case"view":return new Uint8Array(await r.arrayBuffer());case"text":return r.text()}}resolve(e,t){return dt.resolve(e,t)}dirname(e){return dt.dirname(e)}}function Xi(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Wi(s){for(var e=new Array(s),t=0;t<s;++t)e[t]=t;return e}var Yi=Wi;/*!
|
|
19
|
+
* Determine if an object is a Buffer
|
|
20
|
+
*
|
|
21
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
22
|
+
* @license MIT
|
|
23
|
+
*/var zi=function(s){return s!=null&&(Yn(s)||qi(s)||!!s._isBuffer)};function Yn(s){return!!s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function qi(s){return typeof s.readFloatLE=="function"&&typeof s.slice=="function"&&Yn(s.slice(0,0))}var Qi=Yi,Zi=zi,$i=typeof Float64Array<"u";function eo(s,e){return s[0]-e[0]}function to(){var s=this.stride,e=new Array(s.length),t;for(t=0;t<e.length;++t)e[t]=[Math.abs(s[t]),t];e.sort(eo);var r=new Array(e.length);for(t=0;t<r.length;++t)r[t]=e[t][1];return r}function so(s,e){var t=["View",e,"d",s].join("");e<0&&(t="View_Nil"+s);var r=s==="generic";if(e===-1){var n="function "+t+"(a){this.data=a;};var proto="+t+".prototype;proto.dtype='"+s+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+t+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+t+"(a){return new "+t+"(a);}",g=new Function(n);return g()}else if(e===0){var n="function "+t+"(a,d) {this.data = a;this.offset = d};var proto="+t+".prototype;proto.dtype='"+s+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+t+"_copy() {return new "+t+"(this.data,this.offset)};proto.pick=function "+t+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+t+"_get(){return "+(r?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+t+"_set(v){return "+(r?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+t+"(a,b,c,d){return new "+t+"(a,d)}",g=new Function("TrivialArray",n);return g(Ot[s][0])}var n=["'use strict'"],i=Qi(e),o=i.map(function(d){return"i"+d}),a="this.offset+"+i.map(function(d){return"this.stride["+d+"]*i"+d}).join("+"),c=i.map(function(d){return"b"+d}).join(","),u=i.map(function(d){return"c"+d}).join(",");n.push("function "+t+"(a,"+c+","+u+",d){this.data=a","this.shape=["+c+"]","this.stride=["+u+"]","this.offset=d|0}","var proto="+t+".prototype","proto.dtype='"+s+"'","proto.dimension="+e),n.push("Object.defineProperty(proto,'size',{get:function "+t+"_size(){return "+i.map(function(d){return"this.shape["+d+"]"}).join("*"),"}})"),e===1?n.push("proto.order=[0]"):(n.push("Object.defineProperty(proto,'order',{get:"),e<4?(n.push("function "+t+"_order(){"),e===2?n.push("return (Math.abs(this.stride[0])>Math.abs(this.stride[1]))?[1,0]:[0,1]}})"):e===3&&n.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):n.push("ORDER})")),n.push("proto.set=function "+t+"_set("+o.join(",")+",v){"),r?n.push("return this.data.set("+a+",v)}"):n.push("return this.data["+a+"]=v}"),n.push("proto.get=function "+t+"_get("+o.join(",")+"){"),r?n.push("return this.data.get("+a+")}"):n.push("return this.data["+a+"]}"),n.push("proto.index=function "+t+"_index(",o.join(),"){return "+a+"}"),n.push("proto.hi=function "+t+"_hi("+o.join(",")+"){return new "+t+"(this.data,"+i.map(function(d){return["(typeof i",d,"!=='number'||i",d,"<0)?this.shape[",d,"]:i",d,"|0"].join("")}).join(",")+","+i.map(function(d){return"this.stride["+d+"]"}).join(",")+",this.offset)}");var f=i.map(function(d){return"a"+d+"=this.shape["+d+"]"}),B=i.map(function(d){return"c"+d+"=this.stride["+d+"]"});n.push("proto.lo=function "+t+"_lo("+o.join(",")+"){var b=this.offset,d=0,"+f.join(",")+","+B.join(","));for(var A=0;A<e;++A)n.push("if(typeof i"+A+"==='number'&&i"+A+">=0){d=i"+A+"|0;b+=c"+A+"*d;a"+A+"-=d}");n.push("return new "+t+"(this.data,"+i.map(function(d){return"a"+d}).join(",")+","+i.map(function(d){return"c"+d}).join(",")+",b)}"),n.push("proto.step=function "+t+"_step("+o.join(",")+"){var "+i.map(function(d){return"a"+d+"=this.shape["+d+"]"}).join(",")+","+i.map(function(d){return"b"+d+"=this.stride["+d+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(var A=0;A<e;++A)n.push("if(typeof i"+A+"==='number'){d=i"+A+"|0;if(d<0){c+=b"+A+"*(a"+A+"-1);a"+A+"=ceil(-a"+A+"/d)}else{a"+A+"=ceil(a"+A+"/d)}b"+A+"*=d}");n.push("return new "+t+"(this.data,"+i.map(function(d){return"a"+d}).join(",")+","+i.map(function(d){return"b"+d}).join(",")+",c)}");for(var l=new Array(e),h=new Array(e),A=0;A<e;++A)l[A]="a[i"+A+"]",h[A]="b[i"+A+"]";n.push("proto.transpose=function "+t+"_transpose("+o+"){"+o.map(function(d,p){return d+"=("+d+"===undefined?"+p+":"+d+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+t+"(this.data,"+l.join(",")+","+h.join(",")+",this.offset)}"),n.push("proto.pick=function "+t+"_pick("+o+"){var a=[],b=[],c=this.offset");for(var A=0;A<e;++A)n.push("if(typeof i"+A+"==='number'&&i"+A+">=0){c=(c+this.stride["+A+"]*i"+A+")|0}else{a.push(this.shape["+A+"]);b.push(this.stride["+A+"])}");n.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),n.push("return function construct_"+t+"(data,shape,stride,offset){return new "+t+"(data,"+i.map(function(d){return"shape["+d+"]"}).join(",")+","+i.map(function(d){return"stride["+d+"]"}).join(",")+",offset)}");var g=new Function("CTOR_LIST","ORDER",n.join(`
|
|
24
|
+
`));return g(Ot[s],to)}function no(s){if(Zi(s))return"buffer";if($i)switch(Object.prototype.toString.call(s)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped";case"[object BigInt64Array]":return"bigint64";case"[object BigUint64Array]":return"biguint64"}return Array.isArray(s)?"array":"generic"}var Ot={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],bigint64:[],biguint64:[],buffer:[],generic:[]};function ro(s,e,t,r){if(s===void 0){var u=Ot.array[0];return u([])}else typeof s=="number"&&(s=[s]);e===void 0&&(e=[s.length]);var n=e.length;if(t===void 0){t=new Array(n);for(var i=n-1,o=1;i>=0;--i)t[i]=o,o*=e[i]}if(r===void 0){r=0;for(var i=0;i<n;++i)t[i]<0&&(r-=(e[i]-1)*t[i])}for(var a=no(s),c=Ot[a];c.length<=n+1;)c.push(so(a,c.length-1));var u=c[n+1];return u(s,e,t,r)}var io=ro;const oo=Xi(io);var ao={};function co(s,e){for(var t=1,r=s.length,n=s[0],i=s[0],o=1;o<r;++o)if(i=n,n=s[o],e(n,i)){if(o===t){t++;continue}s[t++]=n}return s.length=t,s}function Ao(s){for(var e=1,t=s.length,r=s[0],n=s[0],i=1;i<t;++i,n=r)if(n=r,r=s[i],r!==n){if(i===e){e++;continue}s[e++]=r}return s.length=e,s}function uo(s,e,t){return s.length===0?s:e?(t||s.sort(e),co(s,e)):(t||s.sort(),Ao(s))}var fo=uo,lo=fo;function zn(s,e,t){var r=s.length,n=e.arrayArgs.length,i=e.indexArgs.length>0,o=[],a=[],c=0,u=0,f,B;for(f=0;f<r;++f)a.push(["i",f,"=0"].join(""));for(B=0;B<n;++B)for(f=0;f<r;++f)u=c,c=s[f],f===0?a.push(["d",B,"s",f,"=t",B,"p",c].join("")):a.push(["d",B,"s",f,"=(t",B,"p",c,"-s",u,"*t",B,"p",u,")"].join(""));for(a.length>0&&o.push("var "+a.join(",")),f=r-1;f>=0;--f)c=s[f],o.push(["for(i",f,"=0;i",f,"<s",c,";++i",f,"){"].join(""));for(o.push(t),f=0;f<r;++f){for(u=c,c=s[f],B=0;B<n;++B)o.push(["p",B,"+=d",B,"s",f].join(""));i&&(f>0&&o.push(["index[",u,"]-=s",u].join("")),o.push(["++index[",c,"]"].join(""))),o.push("}")}return o.join(`
|
|
25
|
+
`)}function Bo(s,e,t,r){for(var n=e.length,i=t.arrayArgs.length,o=t.blockSize,a=t.indexArgs.length>0,c=[],u=0;u<i;++u)c.push(["var offset",u,"=p",u].join(""));for(var u=s;u<n;++u)c.push(["for(var j"+u+"=SS[",e[u],"]|0;j",u,">0;){"].join("")),c.push(["if(j",u,"<",o,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",o].join("")),c.push(["j",u,"-=",o,"}"].join("")),a&&c.push(["index[",e[u],"]=j",u].join(""));for(var u=0;u<i;++u){for(var f=["offset"+u],B=s;B<n;++B)f.push(["j",B,"*t",u,"p",e[B]].join(""));c.push(["p",u,"=(",f.join("+"),")"].join(""))}c.push(zn(e,t,r));for(var u=s;u<n;++u)c.push("}");return c.join(`
|
|
26
|
+
`)}function ho(s){for(var e=0,t=s[0].length;e<t;){for(var r=1;r<s.length;++r)if(s[r][e]!==s[0][e])return e;++e}return e}function es(s,e,t){for(var r=s.body,n=[],i=[],o=0;o<s.args.length;++o){var a=s.args[o];if(!(a.count<=0)){var c=new RegExp(a.name,"g"),u="",f=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var B=e.offsetArgIndex.indexOf(o),A=e.offsetArgs[B];f=A.array,u="+q"+B;case"array":u="p"+f+u;var l="l"+o,h="a"+f;if(e.arrayBlockIndices[f]===0)a.count===1?t[f]==="generic"?a.lvalue?(n.push(["var ",l,"=",h,".get(",u,")"].join("")),r=r.replace(c,l),i.push([h,".set(",u,",",l,")"].join(""))):r=r.replace(c,[h,".get(",u,")"].join("")):r=r.replace(c,[h,"[",u,"]"].join("")):t[f]==="generic"?(n.push(["var ",l,"=",h,".get(",u,")"].join("")),r=r.replace(c,l),a.lvalue&&i.push([h,".set(",u,",",l,")"].join(""))):(n.push(["var ",l,"=",h,"[",u,"]"].join("")),r=r.replace(c,l),a.lvalue&&i.push([h,"[",u,"]=",l].join("")));else{for(var g=[a.name],d=[u],p=0;p<Math.abs(e.arrayBlockIndices[f]);p++)g.push("\\s*\\[([^\\]]+)\\]"),d.push("$"+(p+1)+"*t"+f+"b"+p);if(c=new RegExp(g.join(""),"g"),u=d.join("+"),t[f]==="generic")throw new Error("cwise: Generic arrays not supported in combination with blocks!");r=r.replace(c,[h,"[",u,"]"].join(""))}break;case"scalar":r=r.replace(c,"Y"+e.scalarArgs.indexOf(o));break;case"index":r=r.replace(c,"index");break;case"shape":r=r.replace(c,"shape");break}}}return[n.join(`
|
|
27
|
+
`),r,i.join(`
|
|
28
|
+
`)].join(`
|
|
29
|
+
`).trim()}function po(s){for(var e=new Array(s.length),t=!0,r=0;r<s.length;++r){var n=s[r],i=n.match(/\d+/);i?i=i[0]:i="",n.charAt(0)===0?e[r]="u"+n.charAt(1)+i:e[r]=n.charAt(0)+i,r>0&&(t=t&&e[r]===e[r-1])}return t?e[0]:e.join("")}function go(s,e){for(var t=e[1].length-Math.abs(s.arrayBlockIndices[0])|0,r=new Array(s.arrayArgs.length),n=new Array(s.arrayArgs.length),i=0;i<s.arrayArgs.length;++i)n[i]=e[2*i],r[i]=e[2*i+1];for(var o=[],a=[],c=[],u=[],f=[],i=0;i<s.arrayArgs.length;++i){s.arrayBlockIndices[i]<0?(c.push(0),u.push(t),o.push(t),a.push(t+s.arrayBlockIndices[i])):(c.push(s.arrayBlockIndices[i]),u.push(s.arrayBlockIndices[i]+t),o.push(0),a.push(s.arrayBlockIndices[i]));for(var B=[],A=0;A<r[i].length;A++)c[i]<=r[i][A]&&r[i][A]<u[i]&&B.push(r[i][A]-c[i]);f.push(B)}for(var l=["SS"],h=["'use strict'"],g=[],A=0;A<t;++A)g.push(["s",A,"=SS[",A,"]"].join(""));for(var i=0;i<s.arrayArgs.length;++i){l.push("a"+i),l.push("t"+i),l.push("p"+i);for(var A=0;A<t;++A)g.push(["t",i,"p",A,"=t",i,"[",c[i]+A,"]"].join(""));for(var A=0;A<Math.abs(s.arrayBlockIndices[i]);++A)g.push(["t",i,"b",A,"=t",i,"[",o[i]+A,"]"].join(""))}for(var i=0;i<s.scalarArgs.length;++i)l.push("Y"+i);if(s.shapeArgs.length>0&&g.push("shape=SS.slice(0)"),s.indexArgs.length>0){for(var d=new Array(t),i=0;i<t;++i)d[i]="0";g.push(["index=[",d.join(","),"]"].join(""))}for(var i=0;i<s.offsetArgs.length;++i){for(var p=s.offsetArgs[i],y=[],A=0;A<p.offset.length;++A)p.offset[A]!==0&&(p.offset[A]===1?y.push(["t",p.array,"p",A].join("")):y.push([p.offset[A],"*t",p.array,"p",A].join("")));y.length===0?g.push("q"+i+"=0"):g.push(["q",i,"=",y.join("+")].join(""))}var T=lo([].concat(s.pre.thisVars).concat(s.body.thisVars).concat(s.post.thisVars));g=g.concat(T),g.length>0&&h.push("var "+g.join(","));for(var i=0;i<s.arrayArgs.length;++i)h.push("p"+i+"|=0");s.pre.body.length>3&&h.push(es(s.pre,s,n));var I=es(s.body,s,n),E=ho(f);E<t?h.push(Bo(E,f[0],s,I)):h.push(zn(f[0],s,I)),s.post.body.length>3&&h.push(es(s.post,s,n)),s.debug&&console.log("-----Generated cwise routine for ",e,`:
|
|
30
|
+
`+h.join(`
|
|
31
|
+
`)+`
|
|
32
|
+
----------`);var m=[s.funcName||"unnamed","_cwise_loop_",r[0].join("s"),"m",E,po(n)].join(""),C=new Function(["function ",m,"(",l.join(","),"){",h.join(`
|
|
33
|
+
`),"} return ",m].join(""));return C()}var Co=go,Eo=Co;function Do(s){var e=["'use strict'","var CACHED={}"],t=[],r=s.funcName+"_cwise_thunk";e.push(["return function ",r,"(",s.shimArgs.join(","),"){"].join(""));for(var n=[],i=[],o=[["array",s.arrayArgs[0],".shape.slice(",Math.max(0,s.arrayBlockIndices[0]),s.arrayBlockIndices[0]<0?","+s.arrayBlockIndices[0]+")":")"].join("")],a=[],c=[],u=0;u<s.arrayArgs.length;++u){var f=s.arrayArgs[u];t.push(["t",f,"=array",f,".dtype,","r",f,"=array",f,".order"].join("")),n.push("t"+f),n.push("r"+f),i.push("t"+f),i.push("r"+f+".join()"),o.push("array"+f+".data"),o.push("array"+f+".stride"),o.push("array"+f+".offset|0"),u>0&&(a.push("array"+s.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(s.arrayBlockIndices[0])-Math.abs(s.arrayBlockIndices[u]))),c.push("array"+s.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,s.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,s.arrayBlockIndices[u])+"]"))}s.arrayArgs.length>1&&(e.push("if (!("+a.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+s.arrayArgs[0]+".shape.length-"+Math.abs(s.arrayBlockIndices[0])+"; shapeIndex-->0;) {"),e.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}"));for(var u=0;u<s.scalarArgs.length;++u)o.push("scalar"+s.scalarArgs[u]);t.push(["type=[",i.join(","),"].join()"].join("")),t.push("proc=CACHED[type]"),e.push("var "+t.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",n.join(","),"])}","return proc(",o.join(","),")}"].join("")),s.debug&&console.log(`-----Generated thunk:
|
|
34
|
+
`+e.join(`
|
|
35
|
+
`)+`
|
|
36
|
+
----------`);var B=new Function("compile",e.join(`
|
|
37
|
+
`));return B(Eo.bind(void 0,s))}var Io=Do,To=Io;function mo(){this.argTypes=[],this.shimArgs=[],this.arrayArgs=[],this.arrayBlockIndices=[],this.scalarArgs=[],this.offsetArgs=[],this.offsetArgIndex=[],this.indexArgs=[],this.shapeArgs=[],this.funcName="",this.pre=null,this.body=null,this.post=null,this.debug=!1}function xo(s){var e=new mo;e.pre=s.pre,e.body=s.body,e.post=s.post;var t=s.args.slice(0);e.argTypes=t;for(var r=0;r<t.length;++r){var n=t[r];if(n==="array"||typeof n=="object"&&n.blockIndices){if(e.argTypes[r]="array",e.arrayArgs.push(r),e.arrayBlockIndices.push(n.blockIndices?n.blockIndices:0),e.shimArgs.push("array"+r),r<e.pre.args.length&&e.pre.args[r].count>0)throw new Error("cwise: pre() block may not reference array args");if(r<e.post.args.length&&e.post.args[r].count>0)throw new Error("cwise: post() block may not reference array args")}else if(n==="scalar")e.scalarArgs.push(r),e.shimArgs.push("scalar"+r);else if(n==="index"){if(e.indexArgs.push(r),r<e.pre.args.length&&e.pre.args[r].count>0)throw new Error("cwise: pre() block may not reference array index");if(r<e.body.args.length&&e.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array index");if(r<e.post.args.length&&e.post.args[r].count>0)throw new Error("cwise: post() block may not reference array index")}else if(n==="shape"){if(e.shapeArgs.push(r),r<e.pre.args.length&&e.pre.args[r].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(r<e.body.args.length&&e.body.args[r].lvalue)throw new Error("cwise: body() block may not write to array shape");if(r<e.post.args.length&&e.post.args[r].lvalue)throw new Error("cwise: post() block may not write to array shape")}else if(typeof n=="object"&&n.offset)e.argTypes[r]="offset",e.offsetArgs.push({array:n.array,offset:n.offset}),e.offsetArgIndex.push(r);else throw new Error("cwise: Unknown argument type "+t[r])}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>t.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>t.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>t.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!s.printCode||!!s.debug,e.funcName=s.funcName||"cwise",e.blockSize=s.blockSize||64,To(e)}var yo=xo;(function(s){var e=yo,t={body:"",args:[],thisVars:[],localVars:[]};function r(A){if(!A)return t;for(var l=0;l<A.args.length;++l){var h=A.args[l];l===0?A.args[l]={name:h,lvalue:!0,rvalue:!!A.rvalue,count:A.count||1}:A.args[l]={name:h,lvalue:!1,rvalue:!0,count:1}}return A.thisVars||(A.thisVars=[]),A.localVars||(A.localVars=[]),A}function n(A){return e({args:A.args,pre:r(A.pre),body:r(A.body),post:r(A.proc),funcName:A.funcName})}function i(A){for(var l=[],h=0;h<A.args.length;++h)l.push("a"+h);var g=new Function("P",["return function ",A.funcName,"_ndarrayops(",l.join(","),") {P(",l.join(","),");return a0}"].join(""));return g(n(A))}var o={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};(function(){for(var A in o){var l=o[A];s[A]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+l+"c"},funcName:A}),s[A+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+l+"=b"},rvalue:!0,funcName:A+"eq"}),s[A+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+l+"s"},funcName:A+"s"}),s[A+"seq"]=i({args:["array","scalar"],body:{args:["a","s"],body:"a"+l+"=s"},rvalue:!0,funcName:A+"seq"})}})();var a={not:"!",bnot:"~",neg:"-",recip:"1.0/"};(function(){for(var A in a){var l=a[A];s[A]=i({args:["array","array"],body:{args:["a","b"],body:"a="+l+"b"},funcName:A}),s[A+"eq"]=i({args:["array"],body:{args:["a"],body:"a="+l+"a"},rvalue:!0,count:2,funcName:A+"eq"})}})();var c={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};(function(){for(var A in c){var l=c[A];s[A]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+l+"c"},funcName:A}),s[A+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+l+"s"},funcName:A+"s"}),s[A+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+l+"b"},rvalue:!0,count:2,funcName:A+"eq"}),s[A+"seq"]=i({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+l+"s"},rvalue:!0,count:2,funcName:A+"seq"})}})();var u=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];(function(){for(var A=0;A<u.length;++A){var l=u[A];s[l]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:l}),s[l+"eq"]=i({args:["array"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:l+"eq"})}})();var f=["max","min","atan2","pow"];(function(){for(var A=0;A<f.length;++A){var l=f[A];s[l]=i({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:l}),s[l+"s"]=i({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:l+"s"}),s[l+"eq"]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:l+"eq"}),s[l+"seq"]=i({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:l+"seq"})}})();var B=["atan2","pow"];(function(){for(var A=0;A<B.length;++A){var l=B[A];s[l+"op"]=i({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:l+"op"}),s[l+"ops"]=i({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:l+"ops"}),s[l+"opeq"]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:l+"opeq"}),s[l+"opseq"]=i({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+l,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:l+"opseq"})}})(),s.any=e({args:["array"],pre:t,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),s.all=e({args:["array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),s.sum=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),s.prod=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),s.norm2squared=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),s.norm2=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),s.norminf=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),s.norm1=e({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:3}],body:"this_s+=a<0?-a:a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm1"}),s.sup=e({args:["array"],pre:{body:"this_h=-Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_>this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),s.inf=e({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_<this_h)this_h=_inline_1_arg0_",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_h"],localVars:[]},post:{body:"return this_h",args:[],thisVars:["this_h"],localVars:[]}}),s.argmin=e({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),s.argmax=e({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),s.random=i({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),s.assign=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),s.assigns=i({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),s.equals=e({args:["array","array"],pre:t,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1},{name:"y",lvalue:!1,rvalue:!0,count:1}],body:"if(x!==y){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"equals"})})(ao);function Fo(s,e){if(!(s instanceof Uint8Array))throw new Error("[ndarray-pixels] Input must be Uint8Array or Buffer.");const t=new Blob([s],{type:e}),r=URL.createObjectURL(t);return new Promise((n,i)=>{const o=new Image;o.crossOrigin="anonymous",o.onload=function(){URL.revokeObjectURL(r);const c=new OffscreenCanvas(o.width,o.height).getContext("2d");c.drawImage(o,0,0);const u=c.getImageData(0,0,o.width,o.height);n(oo(new Uint8Array(u.data),[o.width,o.height,4],[4,4*o.width,1],0))},o.onerror=a=>{URL.revokeObjectURL(r),i(a)},o.src=r})}async function Mo(s,e){return Fo(s,e)}const Ro=0,No=0,So=0,bo=2,Lo=0,wo=163,Oo=166,Go=0,Ho=2,Po=1,_o=64,vo=0;class Uo{constructor(){this.vkFormat=vo,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=Ro,this.levels=[],this.dataFormatDescriptor=[{vendorId:So,descriptorType:No,descriptorBlockSize:0,versionNumber:bo,colorModel:Lo,colorPrimaries:Po,transferFunction:Ho,flags:Go,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class ut{constructor(e,t,r,n){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian),t=this._dataView.getUint32(this._offset+4,this._littleEndian),r=e+2**32*t;return this._offset+=8,r}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}const Z=[171,75,84,88,32,50,48,187,13,10,26,10];function on(s){return new TextDecoder().decode(s)}function ts(s){const e=new Uint8Array(s.buffer,s.byteOffset,Z.length);if(e[0]!==Z[0]||e[1]!==Z[1]||e[2]!==Z[2]||e[3]!==Z[3]||e[4]!==Z[4]||e[5]!==Z[5]||e[6]!==Z[6]||e[7]!==Z[7]||e[8]!==Z[8]||e[9]!==Z[9]||e[10]!==Z[10]||e[11]!==Z[11])throw new Error("Missing KTX 2.0 identifier.");const t=new Uo,r=17*Uint32Array.BYTES_PER_ELEMENT,n=new ut(s,Z.length,r,!0);t.vkFormat=n._nextUint32(),t.typeSize=n._nextUint32(),t.pixelWidth=n._nextUint32(),t.pixelHeight=n._nextUint32(),t.pixelDepth=n._nextUint32(),t.layerCount=n._nextUint32(),t.faceCount=n._nextUint32();const i=n._nextUint32();t.supercompressionScheme=n._nextUint32();const o=n._nextUint32(),a=n._nextUint32(),c=n._nextUint32(),u=n._nextUint32(),f=n._nextUint64(),B=n._nextUint64(),A=i*3*8,l=new ut(s,Z.length+r,A,!0);for(let q=0;q<i;q++)t.levels.push({levelData:new Uint8Array(s.buffer,s.byteOffset+l._nextUint64(),l._nextUint64()),uncompressedByteLength:l._nextUint64()});const h=new ut(s,o,a,!0),g={vendorId:h._skip(4)._nextUint16(),descriptorType:h._nextUint16(),versionNumber:h._nextUint16(),descriptorBlockSize:h._nextUint16(),colorModel:h._nextUint8(),colorPrimaries:h._nextUint8(),transferFunction:h._nextUint8(),flags:h._nextUint8(),texelBlockDimension:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],bytesPlane:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],samples:[]},y=(g.descriptorBlockSize/4-6)/4;for(let q=0;q<y;q++){const ne={bitOffset:h._nextUint16(),bitLength:h._nextUint8(),channelType:h._nextUint8(),samplePosition:[h._nextUint8(),h._nextUint8(),h._nextUint8(),h._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};ne.channelType&_o?(ne.sampleLower=h._nextInt32(),ne.sampleUpper=h._nextInt32()):(ne.sampleLower=h._nextUint32(),ne.sampleUpper=h._nextUint32()),g.samples[q]=ne}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(g);const T=new ut(s,c,u,!0);for(;T._offset<u;){const q=T._nextUint32(),ne=T._scan(q),Ie=on(ne);if(t.keyValue[Ie]=T._nextUint8Array(q-ne.byteLength-1),Ie.match(/^ktx/i)){const Te=on(t.keyValue[Ie]);t.keyValue[Ie]=Te.substring(0,Te.lastIndexOf("\0"))}const Wt=q%4?4-q%4:0;T._skip(Wt)}if(B<=0)return t;const I=new ut(s,f,B,!0),E=I._nextUint16(),m=I._nextUint16(),C=I._nextUint32(),x=I._nextUint32(),F=I._nextUint32(),M=I._nextUint32(),R=[];for(let q=0;q<i;q++)R.push({imageFlags:I._nextUint32(),rgbSliceByteOffset:I._nextUint32(),rgbSliceByteLength:I._nextUint32(),alphaSliceByteOffset:I._nextUint32(),alphaSliceByteLength:I._nextUint32()});const b=f+I._offset,N=b+C,w=N+x,L=w+F,_=new Uint8Array(s.buffer,s.byteOffset+b,C),U=new Uint8Array(s.buffer,s.byteOffset+N,x),se=new Uint8Array(s.buffer,s.byteOffset+w,F),Q=new Uint8Array(s.buffer,s.byteOffset+L,M);return t.globalData={endpointCount:E,selectorCount:m,imageDescs:R,endpointsData:_,selectorsData:U,tablesData:se,extendedData:Q},t}const Ms="EXT_mesh_gpu_instancing",As="EXT_meshopt_compression",Ko="EXT_texture_webp",Jo="EXT_texture_avif",qn="KHR_draco_mesh_compression",Rs="KHR_lights_punctual",Ns="KHR_materials_anisotropy",Ss="KHR_materials_clearcoat",bs="KHR_materials_diffuse_transmission",Ls="KHR_materials_dispersion",ws="KHR_materials_emissive_strength",Os="KHR_materials_ior",Gs="KHR_materials_iridescence",Hs="KHR_materials_pbrSpecularGlossiness",Ps="KHR_materials_sheen",_s="KHR_materials_specular",vs="KHR_materials_transmission",Us="KHR_materials_unlit",Ks="KHR_materials_volume",We="KHR_materials_variants",Vo="KHR_mesh_quantization",ko="KHR_texture_basisu",Js="KHR_texture_transform",Gt="KHR_xmp_json_ld",us="INSTANCE_ATTRIBUTE";class Qn extends k{init(){this.extensionName=Ms,this.propertyType="InstancedMesh",this.parentTypes=[D.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{attributes:new he})}getAttribute(e){return this.getRefMap("attributes",e)}setAttribute(e,t){return this.setRefMap("attributes",e,t,{usage:us})}listAttributes(){return this.listRefMapValues("attributes")}listSemantics(){return this.listRefMapKeys("attributes")}}Qn.EXTENSION_NAME=Ms;const Me=Ms;class jo extends J{constructor(...e){super(...e),this.extensionName=Me,this.provideTypes=[D.NODE],this.prewriteTypes=[D.ACCESSOR]}createInstancedMesh(){return new Qn(this.document.getGraph())}read(e){return(e.jsonDoc.json.nodes||[]).forEach((n,i)=>{if(!n.extensions||!n.extensions[Me])return;const o=n.extensions[Me],a=this.createInstancedMesh();for(const c in o.attributes)a.setAttribute(c,e.accessors[o.attributes[c]]);e.nodes[i].setExtension(Me,a)}),this}prewrite(e){e.accessorUsageGroupedByParent.add(us);for(const t of this.properties)for(const r of t.listAttributes())e.addAccessorToUsageGroup(r,us);return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listNodes().forEach(r=>{const n=r.getExtension(Me);if(n){const i=e.nodeIndexMap.get(r),o=t.json.nodes[i],a={attributes:{}};n.listSemantics().forEach(c=>{const u=n.getAttribute(c);a.attributes[c]=e.accessorIndexMap.get(u)}),o.extensions=o.extensions||{},o.extensions[Me]=a}}),this}}jo.EXTENSION_NAME=Me;function Ee(){return Ee=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},Ee.apply(this,arguments)}var Dt;(function(s){s.QUANTIZE="quantize",s.FILTER="filter"})(Dt||(Dt={}));var $e;(function(s){s.ATTRIBUTES="ATTRIBUTES",s.TRIANGLES="TRIANGLES",s.INDICES="INDICES"})($e||($e={}));var X;(function(s){s.NONE="NONE",s.OCTAHEDRAL="OCTAHEDRAL",s.QUATERNION="QUATERNION",s.EXPONENTIAL="EXPONENTIAL"})(X||(X={}));const{BYTE:Xo,SHORT:an,FLOAT:Wo}=S.ComponentType,{encodeNormalizedInt:cn,decodeNormalizedInt:fs}=H;function Yo(s,e,t,r){const{filter:n,bits:i}=r,o={array:s.getArray(),byteStride:s.getElementSize()*s.getComponentSize(),componentType:s.getComponentType(),normalized:s.getNormalized()};if(t!==$e.ATTRIBUTES)return o;if(n!==X.NONE){let a=s.getNormalized()?zo(s):new Float32Array(o.array);switch(n){case X.EXPONENTIAL:o.byteStride=s.getElementSize()*4,o.componentType=Wo,o.normalized=!1,o.array=e.encodeFilterExp(a,s.getCount(),o.byteStride,i);break;case X.OCTAHEDRAL:o.byteStride=i>8?8:4,o.componentType=i>8?an:Xo,o.normalized=!0,a=s.getElementSize()===3?Qo(a):a,o.array=e.encodeFilterOct(a,s.getCount(),o.byteStride,i);break;case X.QUATERNION:o.byteStride=8,o.componentType=an,o.normalized=!0,o.array=e.encodeFilterQuat(a,s.getCount(),o.byteStride,i);break;default:throw new Error("Invalid filter.")}o.min=s.getMin([]),o.max=s.getMax([]),s.getNormalized()&&(o.min=o.min.map(c=>fs(c,s.getComponentType())),o.max=o.max.map(c=>fs(c,s.getComponentType()))),o.normalized&&(o.min=o.min.map(c=>cn(c,o.componentType)),o.max=o.max.map(c=>cn(c,o.componentType)))}else o.byteStride%4&&(o.array=qo(o.array,s.getElementSize()),o.byteStride=o.array.byteLength/s.getCount());return o}function zo(s){const e=s.getComponentType(),t=s.getArray(),r=new Float32Array(t.length);for(let n=0;n<t.length;n++)r[n]=fs(t[n],e);return r}function qo(s,e){const r=G.padNumber(s.BYTES_PER_ELEMENT*e)/s.BYTES_PER_ELEMENT,n=s.length/e,i=new s.constructor(n*r);for(let o=0;o*e<s.length;o++)for(let a=0;a<e;a++)i[o*r+a]=s[o*e+a];return i}function Qo(s){const e=new Float32Array(s.length*4/3);for(let t=0,r=s.length/3;t<r;t++)e[t*4]=s[t*3],e[t*4+1]=s[t*3+1],e[t*4+2]=s[t*3+2];return e}function Zo(s,e){return e===ge.BufferViewUsage.ELEMENT_ARRAY_BUFFER?s.listParents().some(r=>r instanceof j&&r.getMode()===j.Mode.TRIANGLES)?$e.TRIANGLES:$e.INDICES:$e.ATTRIBUTES}function $o(s,e){const t=e.getGraph().listParentEdges(s).filter(r=>!(r.getParent()instanceof ot));for(const r of t){const n=r.getName(),i=r.getAttributes().key||"",o=r.getParent().propertyType===D.PRIMITIVE_TARGET;if(n==="indices")return{filter:X.NONE};if(n==="attributes"){if(i==="POSITION")return{filter:X.NONE};if(i==="TEXCOORD_0")return{filter:X.NONE};if(i.startsWith("JOINTS_"))return{filter:X.NONE};if(i.startsWith("WEIGHTS_"))return{filter:X.NONE};if(i==="NORMAL"||i==="TANGENT")return o?{filter:X.NONE}:{filter:X.OCTAHEDRAL,bits:8}}if(n==="output"){const a=Zn(s);return a==="rotation"?{filter:X.QUATERNION,bits:16}:a==="translation"?{filter:X.EXPONENTIAL,bits:12}:a==="scale"?{filter:X.EXPONENTIAL,bits:12}:{filter:X.NONE}}if(n==="input")return{filter:X.NONE};if(n==="inverseBindMatrices")return{filter:X.NONE}}return{filter:X.NONE}}function Zn(s){for(const e of s.listParents())if(e instanceof it){for(const t of e.listParents())if(t instanceof rt)return t.getTargetPath()}return null}function ea(s){return!s.extensions||!s.extensions[As]?!1:!!s.extensions[As].fallback}const $=As,An={method:Dt.QUANTIZE};class $n extends J{constructor(...e){super(...e),this.extensionName=$,this.prereadTypes=[D.BUFFER,D.PRIMITIVE],this.prewriteTypes=[D.BUFFER,D.ACCESSOR],this.readDependencies=["meshopt.decoder"],this.writeDependencies=["meshopt.encoder"],this._decoder=null,this._decoderFallbackBufferMap=new Map,this._encoder=null,this._encoderOptions=An,this._encoderFallbackBuffer=null,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={}}install(e,t){return e==="meshopt.decoder"&&(this._decoder=t),e==="meshopt.encoder"&&(this._encoder=t),this}setEncoderOptions(e){return this._encoderOptions=Ee({},An,e),this}preread(e,t){if(!this._decoder){if(!this.isRequired())return this;throw new Error(`[${$}] Please install extension dependency, "meshopt.decoder".`)}if(!this._decoder.supported){if(!this.isRequired())return this;throw new Error(`[${$}]: Missing WASM support.`)}return t===D.BUFFER?this._prereadBuffers(e):t===D.PRIMITIVE&&this._prereadPrimitives(e),this}_prereadBuffers(e){const t=e.jsonDoc;(t.json.bufferViews||[]).forEach((n,i)=>{if(!n.extensions||!n.extensions[$])return;const o=n.extensions[$],a=o.byteOffset||0,c=o.byteLength||0,u=o.count,f=o.byteStride,B=new Uint8Array(u*f),A=t.json.buffers[o.buffer],l=A.uri?t.resources[A.uri]:t.resources[et],h=G.toView(l,a,c);this._decoder.decodeGltfBuffer(B,u,f,h,o.mode,o.filter),e.bufferViews[i]=B})}_prereadPrimitives(e){const t=e.jsonDoc;(t.json.bufferViews||[]).forEach(n=>{if(!n.extensions||!n.extensions[$])return;const i=n.extensions[$],o=e.buffers[i.buffer],a=e.buffers[n.buffer],c=t.json.buffers[n.buffer];ea(c)&&this._decoderFallbackBufferMap.set(a,o)})}read(e){if(!this.isRequired())return this;for(const[t,r]of this._decoderFallbackBufferMap){for(const n of t.listParents())n instanceof S&&n.swap(t,r);t.dispose()}return this}prewrite(e,t){return t===D.ACCESSOR?this._prewriteAccessors(e):t===D.BUFFER&&this._prewriteBuffers(e),this}_prewriteAccessors(e){const t=e.jsonDoc.json,r=this._encoder,n=this._encoderOptions,i=this.document.getGraph(),o=this.document.createBuffer(),a=this.document.getRoot().listBuffers().indexOf(o);let c=1;const u=new Map,f=B=>{for(const A of i.listParents(B)){if(A.propertyType===D.ROOT)continue;let l=u.get(B);return l===void 0&&u.set(B,l=c++),l}return-1};this._encoderFallbackBuffer=o,this._encoderBufferViews={},this._encoderBufferViewData={},this._encoderBufferViewAccessors={};for(const B of this.document.getRoot().listAccessors()){if(Zn(B)==="weights"||B.getSparse())continue;const A=e.getAccessorUsage(B),l=e.accessorUsageGroupedByParent.has(A)?f(B):null,h=Zo(B,A),g=n.method===Dt.FILTER?$o(B,this.document):{filter:X.NONE},d=Yo(B,r,h,g),{array:p,byteStride:y}=d,T=B.getBuffer();if(!T)throw new Error(`${$}: Missing buffer for accessor.`);const I=this.document.getRoot().listBuffers().indexOf(T),E=[A,l,h,g.filter,y,I].join(":");let m=this._encoderBufferViews[E],C=this._encoderBufferViewData[E],x=this._encoderBufferViewAccessors[E];(!m||!C)&&(x=this._encoderBufferViewAccessors[E]=[],C=this._encoderBufferViewData[E]=[],m=this._encoderBufferViews[E]={buffer:a,target:ge.USAGE_TO_TARGET[A],byteOffset:0,byteLength:0,byteStride:A===ge.BufferViewUsage.ARRAY_BUFFER?y:void 0,extensions:{[$]:{buffer:I,byteOffset:0,byteLength:0,mode:h,filter:g.filter!==X.NONE?g.filter:void 0,byteStride:y,count:0}}});const F=e.createAccessorDef(B);F.componentType=d.componentType,F.normalized=d.normalized,F.byteOffset=m.byteLength,F.min&&d.min&&(F.min=d.min),F.max&&d.max&&(F.max=d.max),e.accessorIndexMap.set(B,t.accessors.length),t.accessors.push(F),x.push(F),C.push(new Uint8Array(p.buffer,p.byteOffset,p.byteLength)),m.byteLength+=p.byteLength,m.extensions.EXT_meshopt_compression.count+=B.getCount()}}_prewriteBuffers(e){const t=this._encoder;for(const r in this._encoderBufferViews){const n=this._encoderBufferViews[r],i=this._encoderBufferViewData[r],o=this.document.getRoot().listBuffers()[n.extensions[$].buffer],a=e.otherBufferViews.get(o)||[],{count:c,byteStride:u,mode:f}=n.extensions[$],B=G.concat(i),A=t.encodeGltfBuffer(B,c,u,f),l=G.pad(A);n.extensions[$].byteLength=A.byteLength,i.length=0,i.push(l),a.push(l),e.otherBufferViews.set(o,a)}}write(e){let t=0;for(const o in this._encoderBufferViews){const a=this._encoderBufferViews[o],c=this._encoderBufferViewData[o][0],u=e.otherBufferViewsIndexMap.get(c),f=this._encoderBufferViewAccessors[o];for(const h of f)h.bufferView=u;const B=e.jsonDoc.json.bufferViews[u],A=B.byteOffset||0;Object.assign(B,a),B.byteOffset=t;const l=B.extensions[$];l.byteOffset=A,t+=G.padNumber(a.byteLength)}const r=this._encoderFallbackBuffer,n=e.bufferIndexMap.get(r),i=e.jsonDoc.json.buffers[n];return i.byteLength=t,i.extensions={[$]:{fallback:!0}},r.dispose(),this}}$n.EXTENSION_NAME=$;$n.EncoderMethod=Dt;const Bt=Jo;class ta{match(e){return e.length>=12&&G.decodeText(e.slice(4,12))==="ftypavif"}getSize(e){if(!this.match(e))return null;const t=new DataView(e.buffer,e.byteOffset,e.byteLength);let r=un(t,0);if(!r)return null;let n=r.end;for(;r=un(t,n);)if(r.type==="meta")n=r.start+4;else if(r.type==="iprp"||r.type==="ipco")n=r.start;else{if(r.type==="ispe")return[t.getUint32(r.start+4),t.getUint32(r.start+8)];if(r.type==="mdat")break;n=r.end}return null}getChannels(e){return 4}}class sa extends J{constructor(...e){super(...e),this.extensionName=Bt,this.prereadTypes=[D.TEXTURE]}static register(){pe.registerFormat("image/avif",new ta)}preread(e){return(e.jsonDoc.json.textures||[]).forEach(r=>{r.extensions&&r.extensions[Bt]&&(r.source=r.extensions[Bt].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/avif"){const n=e.imageIndexMap.get(r);(t.json.textures||[]).forEach(o=>{o.source===n&&(o.extensions=o.extensions||{},o.extensions[Bt]={source:o.source},delete o.source)})}}),this}}sa.EXTENSION_NAME=Bt;function un(s,e){if(s.byteLength<4+e)return null;const t=s.getUint32(e);return s.byteLength<t+e||t<8?null:{type:G.decodeText(new Uint8Array(s.buffer,s.byteOffset+e+4,4)),start:e+8,end:e+t}}const ht=Ko;class na{match(e){return e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80}getSize(e){const t=G.decodeText(e.slice(0,4)),r=G.decodeText(e.slice(8,12));if(t!=="RIFF"||r!=="WEBP")return null;const n=new DataView(e.buffer,e.byteOffset);let i=12;for(;i<n.byteLength;){const o=G.decodeText(new Uint8Array([n.getUint8(i),n.getUint8(i+1),n.getUint8(i+2),n.getUint8(i+3)])),a=n.getUint32(i+4,!0);if(o==="VP8 "){const c=n.getInt16(i+14,!0)&16383,u=n.getInt16(i+16,!0)&16383;return[c,u]}else if(o==="VP8L"){const c=n.getUint8(i+9),u=n.getUint8(i+10),f=n.getUint8(i+11),B=n.getUint8(i+12),A=1+((u&63)<<8|c),l=1+((B&15)<<10|f<<2|(u&192)>>6);return[A,l]}i+=8+a+a%2}return null}getChannels(e){return 4}}class ra extends J{constructor(...e){super(...e),this.extensionName=ht,this.prereadTypes=[D.TEXTURE]}static register(){pe.registerFormat("image/webp",new na)}preread(e){return(e.jsonDoc.json.textures||[]).forEach(r=>{r.extensions&&r.extensions[ht]&&(r.source=r.extensions[ht].source)}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/webp"){const n=e.imageIndexMap.get(r);(t.json.textures||[]).forEach(o=>{o.source===n&&(o.extensions=o.extensions||{},o.extensions[ht]={source:o.source},delete o.source)})}}),this}}ra.EXTENSION_NAME=ht;const fn=qn;let Y,er,tr;function ia(s,e){const t=new Y.DecoderBuffer;try{if(t.Init(e,e.length),s.GetEncodedGeometryType(t)!==Y.TRIANGULAR_MESH)throw new Error(`[${fn}] Unknown geometry type.`);const n=new Y.Mesh;if(!s.DecodeBufferToMesh(t,n).ok()||n.ptr===0)throw new Error(`[${fn}] Decoding failure.`);return n}finally{Y.destroy(t)}}function oa(s,e){const r=e.num_faces()*3;let n,i;if(e.num_points()<=65534){const o=r*Uint16Array.BYTES_PER_ELEMENT;n=Y._malloc(o),s.GetTrianglesUInt16Array(e,o,n),i=new Uint16Array(Y.HEAPU16.buffer,n,r).slice()}else{const o=r*Uint32Array.BYTES_PER_ELEMENT;n=Y._malloc(o),s.GetTrianglesUInt32Array(e,o,n),i=new Uint32Array(Y.HEAPU32.buffer,n,r).slice()}return Y._free(n),i}function aa(s,e,t,r){const n=tr[r.componentType],i=er[r.componentType],o=t.num_components(),c=e.num_points()*o,u=c*i.BYTES_PER_ELEMENT,f=Y._malloc(u);s.GetAttributeDataArrayForAllPoints(e,t,n,u,f);const B=new i(Y.HEAPF32.buffer,f,c).slice();return Y._free(f),B}function ca(s){Y=s,er={[S.ComponentType.FLOAT]:Float32Array,[S.ComponentType.UNSIGNED_INT]:Uint32Array,[S.ComponentType.UNSIGNED_SHORT]:Uint16Array,[S.ComponentType.UNSIGNED_BYTE]:Uint8Array,[S.ComponentType.SHORT]:Int16Array,[S.ComponentType.BYTE]:Int8Array},tr={[S.ComponentType.FLOAT]:Y.DT_FLOAT32,[S.ComponentType.UNSIGNED_INT]:Y.DT_UINT32,[S.ComponentType.UNSIGNED_SHORT]:Y.DT_UINT16,[S.ComponentType.UNSIGNED_BYTE]:Y.DT_UINT8,[S.ComponentType.SHORT]:Y.DT_INT16,[S.ComponentType.BYTE]:Y.DT_INT8}}let oe;var It;(function(s){s[s.EDGEBREAKER=1]="EDGEBREAKER",s[s.SEQUENTIAL=0]="SEQUENTIAL"})(It||(It={}));var ce;(function(s){s.POSITION="POSITION",s.NORMAL="NORMAL",s.COLOR="COLOR",s.TEX_COORD="TEX_COORD",s.GENERIC="GENERIC"})(ce||(ce={}));const sr={[ce.POSITION]:14,[ce.NORMAL]:10,[ce.COLOR]:8,[ce.TEX_COORD]:12,[ce.GENERIC]:12},ln={decodeSpeed:5,encodeSpeed:5,method:It.EDGEBREAKER,quantizationBits:sr,quantizationVolume:"mesh"};function Aa(s){oe=s}function ua(s,e=ln){const t=Ee({},ln,e);t.quantizationBits=Ee({},sr,e.quantizationBits);const r=new oe.MeshBuilder,n=new oe.Mesh,i=new oe.ExpertEncoder(n),o={},a=new oe.DracoInt8Array,c=s.listTargets().length>0;let u=!1;for(const g of s.listSemantics()){const d=s.getAttribute(g);if(d.getSparse()){u=!0;continue}const p=fa(g),y=la(r,d.getComponentType(),n,oe[p],d.getCount(),d.getElementSize(),d.getArray());if(y===-1)throw new Error(`Error compressing "${g}" attribute.`);if(o[g]=y,t.quantizationVolume==="mesh"||g!=="POSITION")i.SetAttributeQuantization(y,t.quantizationBits[p]);else if(typeof t.quantizationVolume=="object"){const{quantizationVolume:T}=t,I=Math.max(T.max[0]-T.min[0],T.max[1]-T.min[1],T.max[2]-T.min[2]);i.SetAttributeExplicitQuantization(y,t.quantizationBits[p],d.getElementSize(),T.min,I)}else throw new Error("Invalid quantization volume state.")}const f=s.getIndices();if(!f)throw new ls("Primitive must have indices.");r.AddFacesToMesh(n,f.getCount()/3,f.getArray()),i.SetSpeedOptions(t.encodeSpeed,t.decodeSpeed),i.SetTrackEncodedProperties(!0),t.method===It.SEQUENTIAL||c||u?i.SetEncodingMethod(oe.MESH_SEQUENTIAL_ENCODING):i.SetEncodingMethod(oe.MESH_EDGEBREAKER_ENCODING);const B=i.EncodeToDracoBuffer(!(c||u),a);if(B<=0)throw new ls("Error applying Draco compression.");const A=new Uint8Array(B);for(let g=0;g<B;++g)A[g]=a.GetValue(g);const l=i.GetNumberOfEncodedPoints(),h=i.GetNumberOfEncodedFaces()*3;return oe.destroy(a),oe.destroy(n),oe.destroy(r),oe.destroy(i),{numVertices:l,numIndices:h,data:A,attributeIDs:o}}function fa(s){return s==="POSITION"?ce.POSITION:s==="NORMAL"?ce.NORMAL:s.startsWith("COLOR_")?ce.COLOR:s.startsWith("TEXCOORD_")?ce.TEX_COORD:ce.GENERIC}function la(s,e,t,r,n,i,o){switch(e){case S.ComponentType.UNSIGNED_BYTE:return s.AddUInt8Attribute(t,r,n,i,o);case S.ComponentType.BYTE:return s.AddInt8Attribute(t,r,n,i,o);case S.ComponentType.UNSIGNED_SHORT:return s.AddUInt16Attribute(t,r,n,i,o);case S.ComponentType.SHORT:return s.AddInt16Attribute(t,r,n,i,o);case S.ComponentType.UNSIGNED_INT:return s.AddUInt32Attribute(t,r,n,i,o);case S.ComponentType.FLOAT:return s.AddFloatAttribute(t,r,n,i,o);default:throw new Error(`Unexpected component type, "${e}".`)}}class ls extends Error{}const W=qn;class nr extends J{constructor(...e){super(...e),this.extensionName=W,this.prereadTypes=[D.PRIMITIVE],this.prewriteTypes=[D.ACCESSOR],this.readDependencies=["draco3d.decoder"],this.writeDependencies=["draco3d.encoder"],this._decoderModule=null,this._encoderModule=null,this._encoderOptions={}}install(e,t){return e==="draco3d.decoder"&&(this._decoderModule=t,ca(this._decoderModule)),e==="draco3d.encoder"&&(this._encoderModule=t,Aa(this._encoderModule)),this}setEncoderOptions(e){return this._encoderOptions=e,this}preread(e){if(!this._decoderModule)throw new Error(`[${W}] Please install extension dependency, "draco3d.decoder".`);const t=this.document.getLogger(),r=e.jsonDoc,n=new Map;try{const i=r.json.meshes||[];for(const o of i)for(const a of o.primitives){if(!a.extensions||!a.extensions[W])continue;const c=a.extensions[W];let[u,f]=n.get(c.bufferView)||[];if(!f||!u){const B=r.json.bufferViews[c.bufferView],A=r.json.buffers[B.buffer],l=A.uri?r.resources[A.uri]:r.resources[et],h=B.byteOffset||0,g=B.byteLength,d=G.toView(l,h,g);u=new this._decoderModule.Decoder,f=ia(u,d),n.set(c.bufferView,[u,f]),t.debug(`[${W}] Decompressed ${d.byteLength} bytes.`)}for(const B in a.attributes){const A=e.jsonDoc.json.accessors[a.attributes[B]],l=u.GetAttributeByUniqueId(f,c.attributes[B]),h=aa(u,f,l,A);e.accessors[a.attributes[B]].setArray(h)}a.indices!==void 0&&e.accessors[a.indices].setArray(oa(u,f))}}finally{for(const[i,o]of Array.from(n.values()))this._decoderModule.destroy(i),this._decoderModule.destroy(o)}return this}read(e){return this}prewrite(e,t){if(!this._encoderModule)throw new Error(`[${W}] Please install extension dependency, "draco3d.encoder".`);const r=this.document.getLogger();r.debug(`[${W}] Compression options: ${JSON.stringify(this._encoderOptions)}`);const n=Ba(this.document),i=new Map;let o="mesh";this._encoderOptions.quantizationVolume==="scene"&&(this.document.getRoot().listScenes().length!==1?r.warn(`[${W}]: quantizationVolume=scene requires exactly 1 scene.`):o=fi(this.document.getRoot().listScenes().pop()));for(const a of Array.from(n.keys())){const c=n.get(a);if(!c)throw new Error("Unexpected primitive.");if(i.has(c)){i.set(c,i.get(c));continue}const u=a.getIndices(),f=e.jsonDoc.json.accessors;let B;try{B=ua(a,Ee({},this._encoderOptions,{quantizationVolume:o}))}catch(h){if(h instanceof ls){r.warn(`[${W}]: ${h.message} Skipping primitive compression.`);continue}throw h}i.set(c,B);const A=e.createAccessorDef(u);A.count=B.numIndices,e.accessorIndexMap.set(u,f.length),f.push(A),B.numVertices>65534&&A.componentType!==S.ComponentType.UNSIGNED_INT&&(A.componentType=S.ComponentType.UNSIGNED_INT);for(const h of a.listSemantics()){const g=a.getAttribute(h);if(B.attributeIDs[h]===void 0)continue;const d=e.createAccessorDef(g);d.count=B.numVertices,e.accessorIndexMap.set(g,f.length),f.push(d)}const l=a.getAttribute("POSITION").getBuffer()||this.document.getRoot().listBuffers()[0];e.otherBufferViews.has(l)||e.otherBufferViews.set(l,[]),e.otherBufferViews.get(l).push(B.data)}return r.debug(`[${W}] Compressed ${n.size} primitives.`),e.extensionData[W]={primitiveHashMap:n,primitiveEncodingMap:i},this}write(e){const t=e.extensionData[W];for(const r of this.document.getRoot().listMeshes()){const n=e.jsonDoc.json.meshes[e.meshIndexMap.get(r)];for(let i=0;i<r.listPrimitives().length;i++){const o=r.listPrimitives()[i],a=n.primitives[i],c=t.primitiveHashMap.get(o);if(!c)continue;const u=t.primitiveEncodingMap.get(c);u&&(a.extensions=a.extensions||{},a.extensions[W]={bufferView:e.otherBufferViewsIndexMap.get(u.data),attributes:u.attributeIDs})}}if(!t.primitiveHashMap.size){const r=e.jsonDoc.json;r.extensionsUsed=(r.extensionsUsed||[]).filter(n=>n!==W),r.extensionsRequired=(r.extensionsRequired||[]).filter(n=>n!==W)}return this}}nr.EXTENSION_NAME=W;nr.EncoderMethod=It;function Ba(s){const e=s.getLogger(),t=new Set,r=new Set;let n=0,i=0;for(const B of s.getRoot().listMeshes())for(const A of B.listPrimitives())A.getIndices()?A.getMode()!==j.Mode.TRIANGLES?(r.add(A),i++):t.add(A):(r.add(A),n++);n>0&&e.warn(`[${W}] Skipping Draco compression of ${n} non-indexed primitives.`),i>0&&e.warn(`[${W}] Skipping Draco compression of ${i} non-TRIANGLES primitives.`);const o=s.getRoot().listAccessors(),a=new Map;for(let B=0;B<o.length;B++)a.set(o[B],B);const c=new Map,u=new Set,f=new Map;for(const B of Array.from(t)){let A=Bn(B,a);if(u.has(A)){f.set(B,A);continue}if(c.has(B.getIndices())){const l=B.getIndices(),h=l.clone();a.set(h,s.getRoot().listAccessors().length-1),B.swap(l,h)}for(const l of B.listAttributes())if(c.has(l)){const h=l.clone();a.set(h,s.getRoot().listAccessors().length-1),B.swap(l,h)}A=Bn(B,a),u.add(A),f.set(B,A),c.set(B.getIndices(),A);for(const l of B.listAttributes())c.set(l,A)}for(const B of Array.from(c.keys())){const A=new Set(B.listParents().map(l=>l.propertyType));if(A.size!==2||!A.has(D.PRIMITIVE)||!A.has(D.ROOT))throw new Error(`[${W}] Compressed accessors must only be used as indices or vertex attributes.`)}for(const B of Array.from(t)){const A=f.get(B),l=B.getIndices();if(c.get(l)!==A||B.listAttributes().some(h=>c.get(h)!==A))throw new Error(`[${W}] Draco primitives must share all, or no, accessors.`)}for(const B of Array.from(r)){const A=B.getIndices();if(c.has(A)||B.listAttributes().some(l=>c.has(l)))throw new Error(`[${W}] Accessor cannot be shared by compressed and uncompressed primitives.`)}return f}function Bn(s,e){const t=[],r=s.getIndices();t.push(e.get(r));for(const n of s.listAttributes())t.push(e.get(n));return t.sort().join("|")}class st extends k{init(){this.extensionName=Rs,this.propertyType="Light",this.parentTypes=[D.NODE]}getDefaults(){return Object.assign(super.getDefaults(),{color:[1,1,1],intensity:1,type:st.Type.POINT,range:null,innerConeAngle:0,outerConeAngle:Math.PI/4})}getColor(){return this.get("color")}setColor(e){return this.set("color",e)}getIntensity(){return this.get("intensity")}setIntensity(e){return this.set("intensity",e)}getType(){return this.get("type")}setType(e){return this.set("type",e)}getRange(){return this.get("range")}setRange(e){return this.set("range",e)}getInnerConeAngle(){return this.get("innerConeAngle")}setInnerConeAngle(e){return this.set("innerConeAngle",e)}getOuterConeAngle(){return this.get("outerConeAngle")}setOuterConeAngle(e){return this.set("outerConeAngle",e)}}st.EXTENSION_NAME=Rs;st.Type={POINT:"point",SPOT:"spot",DIRECTIONAL:"directional"};const le=Rs;class ha extends J{constructor(...e){super(...e),this.extensionName=le}createLight(e=""){return new st(this.document.getGraph(),e)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[le])return this;const i=(t.json.extensions[le].lights||[]).map(o=>{var a,c;const u=this.createLight().setName(o.name||"").setType(o.type);return o.color!==void 0&&u.setColor(o.color),o.intensity!==void 0&&u.setIntensity(o.intensity),o.range!==void 0&&u.setRange(o.range),((a=o.spot)==null?void 0:a.innerConeAngle)!==void 0&&u.setInnerConeAngle(o.spot.innerConeAngle),((c=o.spot)==null?void 0:c.outerConeAngle)!==void 0&&u.setOuterConeAngle(o.spot.outerConeAngle),u});return t.json.nodes.forEach((o,a)=>{if(!o.extensions||!o.extensions[le])return;const c=o.extensions[le];e.nodes[a].setExtension(le,i[c.light])}),this}write(e){const t=e.jsonDoc;if(this.properties.size===0)return this;const r=[],n=new Map;for(const i of this.properties){const o=i,a={type:o.getType()};H.eq(o.getColor(),[1,1,1])||(a.color=o.getColor()),o.getIntensity()!==1&&(a.intensity=o.getIntensity()),o.getRange()!=null&&(a.range=o.getRange()),o.getName()&&(a.name=o.getName()),o.getType()===st.Type.SPOT&&(a.spot={innerConeAngle:o.getInnerConeAngle(),outerConeAngle:o.getOuterConeAngle()}),r.push(a),n.set(o,r.length-1)}return this.document.getRoot().listNodes().forEach(i=>{const o=i.getExtension(le);if(o){const a=e.nodeIndexMap.get(i),c=t.json.nodes[a];c.extensions=c.extensions||{},c.extensions[le]={light:n.get(o)}}}),t.json.extensions=t.json.extensions||{},t.json.extensions[le]={lights:r},this}}ha.EXTENSION_NAME=le;const{R:pa,G:ga,B:da}=ue;class rr extends k{init(){this.extensionName=Ns,this.propertyType="Anisotropy",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{anisotropyStrength:0,anisotropyRotation:0,anisotropyTexture:null,anisotropyTextureInfo:new v(this.graph,"anisotropyTextureInfo")})}getAnisotropyStrength(){return this.get("anisotropyStrength")}setAnisotropyStrength(e){return this.set("anisotropyStrength",e)}getAnisotropyRotation(){return this.get("anisotropyRotation")}setAnisotropyRotation(e){return this.set("anisotropyRotation",e)}getAnisotropyTexture(){return this.getRef("anisotropyTexture")}getAnisotropyTextureInfo(){return this.getRef("anisotropyTexture")?this.getRef("anisotropyTextureInfo"):null}setAnisotropyTexture(e){return this.setRef("anisotropyTexture",e,{channels:pa|ga|da})}}rr.EXTENSION_NAME=Ns;const Re=Ns;class Ca extends J{constructor(...e){super(...e),this.extensionName=Re,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createAnisotropy(){return new rr(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Re]){const a=this.createAnisotropy();e.materials[o].setExtension(Re,a);const c=i.extensions[Re];if(c.anisotropyStrength!==void 0&&a.setAnisotropyStrength(c.anisotropyStrength),c.anisotropyRotation!==void 0&&a.setAnisotropyRotation(c.anisotropyRotation),c.anisotropyTexture!==void 0){const u=c.anisotropyTexture,f=e.textures[n[u.index].source];a.setAnisotropyTexture(f),e.setTextureInfo(a.getAnisotropyTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Re);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Re]={};if(n.getAnisotropyStrength()>0&&(a.anisotropyStrength=n.getAnisotropyStrength()),n.getAnisotropyRotation()!==0&&(a.anisotropyRotation=n.getAnisotropyRotation()),n.getAnisotropyTexture()){const c=n.getAnisotropyTexture(),u=n.getAnisotropyTextureInfo();a.anisotropyTexture=e.createTextureInfoDef(c,u)}}}),this}}Ca.EXTENSION_NAME=Re;const{R:hn,G:pn,B:Ea}=ue;class ir extends k{init(){this.extensionName=Ss,this.propertyType="Clearcoat",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{clearcoatFactor:0,clearcoatTexture:null,clearcoatTextureInfo:new v(this.graph,"clearcoatTextureInfo"),clearcoatRoughnessFactor:0,clearcoatRoughnessTexture:null,clearcoatRoughnessTextureInfo:new v(this.graph,"clearcoatRoughnessTextureInfo"),clearcoatNormalScale:1,clearcoatNormalTexture:null,clearcoatNormalTextureInfo:new v(this.graph,"clearcoatNormalTextureInfo")})}getClearcoatFactor(){return this.get("clearcoatFactor")}setClearcoatFactor(e){return this.set("clearcoatFactor",e)}getClearcoatTexture(){return this.getRef("clearcoatTexture")}getClearcoatTextureInfo(){return this.getRef("clearcoatTexture")?this.getRef("clearcoatTextureInfo"):null}setClearcoatTexture(e){return this.setRef("clearcoatTexture",e,{channels:hn})}getClearcoatRoughnessFactor(){return this.get("clearcoatRoughnessFactor")}setClearcoatRoughnessFactor(e){return this.set("clearcoatRoughnessFactor",e)}getClearcoatRoughnessTexture(){return this.getRef("clearcoatRoughnessTexture")}getClearcoatRoughnessTextureInfo(){return this.getRef("clearcoatRoughnessTexture")?this.getRef("clearcoatRoughnessTextureInfo"):null}setClearcoatRoughnessTexture(e){return this.setRef("clearcoatRoughnessTexture",e,{channels:pn})}getClearcoatNormalScale(){return this.get("clearcoatNormalScale")}setClearcoatNormalScale(e){return this.set("clearcoatNormalScale",e)}getClearcoatNormalTexture(){return this.getRef("clearcoatNormalTexture")}getClearcoatNormalTextureInfo(){return this.getRef("clearcoatNormalTexture")?this.getRef("clearcoatNormalTextureInfo"):null}setClearcoatNormalTexture(e){return this.setRef("clearcoatNormalTexture",e,{channels:hn|pn|Ea})}}ir.EXTENSION_NAME=Ss;const Ne=Ss;class Da extends J{constructor(...e){super(...e),this.extensionName=Ne,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createClearcoat(){return new ir(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Ne]){const a=this.createClearcoat();e.materials[o].setExtension(Ne,a);const c=i.extensions[Ne];if(c.clearcoatFactor!==void 0&&a.setClearcoatFactor(c.clearcoatFactor),c.clearcoatRoughnessFactor!==void 0&&a.setClearcoatRoughnessFactor(c.clearcoatRoughnessFactor),c.clearcoatTexture!==void 0){const u=c.clearcoatTexture,f=e.textures[n[u.index].source];a.setClearcoatTexture(f),e.setTextureInfo(a.getClearcoatTextureInfo(),u)}if(c.clearcoatRoughnessTexture!==void 0){const u=c.clearcoatRoughnessTexture,f=e.textures[n[u.index].source];a.setClearcoatRoughnessTexture(f),e.setTextureInfo(a.getClearcoatRoughnessTextureInfo(),u)}if(c.clearcoatNormalTexture!==void 0){const u=c.clearcoatNormalTexture,f=e.textures[n[u.index].source];a.setClearcoatNormalTexture(f),e.setTextureInfo(a.getClearcoatNormalTextureInfo(),u),u.scale!==void 0&&a.setClearcoatNormalScale(u.scale)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Ne);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Ne]={clearcoatFactor:n.getClearcoatFactor(),clearcoatRoughnessFactor:n.getClearcoatRoughnessFactor()};if(n.getClearcoatTexture()){const c=n.getClearcoatTexture(),u=n.getClearcoatTextureInfo();a.clearcoatTexture=e.createTextureInfoDef(c,u)}if(n.getClearcoatRoughnessTexture()){const c=n.getClearcoatRoughnessTexture(),u=n.getClearcoatRoughnessTextureInfo();a.clearcoatRoughnessTexture=e.createTextureInfoDef(c,u)}if(n.getClearcoatNormalTexture()){const c=n.getClearcoatNormalTexture(),u=n.getClearcoatNormalTextureInfo();a.clearcoatNormalTexture=e.createTextureInfoDef(c,u),n.getClearcoatNormalScale()!==1&&(a.clearcoatNormalTexture.scale=n.getClearcoatNormalScale())}}}),this}}Da.EXTENSION_NAME=Ne;const{R:Ia,G:Ta,B:ma,A:xa}=ue;class or extends k{init(){this.extensionName=bs,this.propertyType="DiffuseTransmission",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseTransmissionFactor:0,diffuseTransmissionTexture:null,diffuseTransmissionTextureInfo:new v(this.graph,"diffuseTransmissionTextureInfo"),diffuseTransmissionColorFactor:[1,1,1],diffuseTransmissionColorTexture:null,diffuseTransmissionColorTextureInfo:new v(this.graph,"diffuseTransmissionColorTextureInfo")})}getDiffuseTransmissionFactor(){return this.get("diffuseTransmissionFactor")}setDiffuseTransmissionFactor(e){return this.set("diffuseTransmissionFactor",e)}getDiffuseTransmissionTexture(){return this.getRef("diffuseTransmissionTexture")}getDiffuseTransmissionTextureInfo(){return this.getRef("diffuseTransmissionTexture")?this.getRef("diffuseTransmissionTextureInfo"):null}setDiffuseTransmissionTexture(e){return this.setRef("diffuseTransmissionTexture",e,{channels:xa})}getDiffuseTransmissionColorFactor(){return this.get("diffuseTransmissionColorFactor")}setDiffuseTransmissionColorFactor(e){return this.set("diffuseTransmissionColorFactor",e)}getDiffuseTransmissionColorTexture(){return this.getRef("diffuseTransmissionColorTexture")}getDiffuseTransmissionColorTextureInfo(){return this.getRef("diffuseTransmissionColorTexture")?this.getRef("diffuseTransmissionColorTextureInfo"):null}setDiffuseTransmissionColorTexture(e){return this.setRef("diffuseTransmissionColorTexture",e,{channels:Ia|Ta|ma})}}or.EXTENSION_NAME=bs;const Se=bs;class ya extends J{constructor(...e){super(...e),this.extensionName=Se}createDiffuseTransmission(){return new or(this.document.getGraph())}read(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Se]){const a=this.createDiffuseTransmission();e.materials[o].setExtension(Se,a);const c=i.extensions[Se];if(c.diffuseTransmissionFactor!==void 0&&a.setDiffuseTransmissionFactor(c.diffuseTransmissionFactor),c.diffuseTransmissionColorFactor!==void 0&&a.setDiffuseTransmissionColorFactor(c.diffuseTransmissionColorFactor),c.diffuseTransmissionTexture!==void 0){const u=c.diffuseTransmissionTexture,f=e.textures[n[u.index].source];a.setDiffuseTransmissionTexture(f),e.setTextureInfo(a.getDiffuseTransmissionTextureInfo(),u)}if(c.diffuseTransmissionColorTexture!==void 0){const u=c.diffuseTransmissionColorTexture,f=e.textures[n[u.index].source];a.setDiffuseTransmissionColorTexture(f),e.setTextureInfo(a.getDiffuseTransmissionColorTextureInfo(),u)}}}),this}write(e){const t=e.jsonDoc;for(const r of this.document.getRoot().listMaterials()){const n=r.getExtension(Se);if(!n)continue;const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Se]={diffuseTransmissionFactor:n.getDiffuseTransmissionFactor(),diffuseTransmissionColorFactor:n.getDiffuseTransmissionColorFactor()};if(n.getDiffuseTransmissionTexture()){const c=n.getDiffuseTransmissionTexture(),u=n.getDiffuseTransmissionTextureInfo();a.diffuseTransmissionTexture=e.createTextureInfoDef(c,u)}if(n.getDiffuseTransmissionColorTexture()){const c=n.getDiffuseTransmissionColorTexture(),u=n.getDiffuseTransmissionColorTextureInfo();a.diffuseTransmissionColorTexture=e.createTextureInfoDef(c,u)}}return this}}ya.EXTENSION_NAME=Se;class ar extends k{init(){this.extensionName=Ls,this.propertyType="Dispersion",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{dispersion:0})}getDispersion(){return this.get("dispersion")}setDispersion(e){return this.set("dispersion",e)}}ar.EXTENSION_NAME=Ls;const be=Ls;class Fa extends J{constructor(...e){super(...e),this.extensionName=be,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createDispersion(){return new ar(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((n,i)=>{if(n.extensions&&n.extensions[be]){const o=this.createDispersion();e.materials[i].setExtension(be,o);const a=n.extensions[be];a.dispersion!==void 0&&o.setDispersion(a.dispersion)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(be);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{},o.extensions[be]={dispersion:n.getDispersion()}}}),this}}Fa.EXTENSION_NAME=be;class cr extends k{init(){this.extensionName=ws,this.propertyType="EmissiveStrength",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{emissiveStrength:1})}getEmissiveStrength(){return this.get("emissiveStrength")}setEmissiveStrength(e){return this.set("emissiveStrength",e)}}cr.EXTENSION_NAME=ws;const Le=ws;class Ma extends J{constructor(...e){super(...e),this.extensionName=Le,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createEmissiveStrength(){return new cr(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((n,i)=>{if(n.extensions&&n.extensions[Le]){const o=this.createEmissiveStrength();e.materials[i].setExtension(Le,o);const a=n.extensions[Le];a.emissiveStrength!==void 0&&o.setEmissiveStrength(a.emissiveStrength)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Le);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{},o.extensions[Le]={emissiveStrength:n.getEmissiveStrength()}}}),this}}Ma.EXTENSION_NAME=Le;class Ar extends k{init(){this.extensionName=Os,this.propertyType="IOR",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{ior:1.5})}getIOR(){return this.get("ior")}setIOR(e){return this.set("ior",e)}}Ar.EXTENSION_NAME=Os;const we=Os;class Ra extends J{constructor(...e){super(...e),this.extensionName=we,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createIOR(){return new Ar(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((n,i)=>{if(n.extensions&&n.extensions[we]){const o=this.createIOR();e.materials[i].setExtension(we,o);const a=n.extensions[we];a.ior!==void 0&&o.setIOR(a.ior)}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(we);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{},o.extensions[we]={ior:n.getIOR()}}}),this}}Ra.EXTENSION_NAME=we;const{R:Na,G:Sa}=ue;class ur extends k{init(){this.extensionName=Gs,this.propertyType="Iridescence",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{iridescenceFactor:0,iridescenceTexture:null,iridescenceTextureInfo:new v(this.graph,"iridescenceTextureInfo"),iridescenceIOR:1.3,iridescenceThicknessMinimum:100,iridescenceThicknessMaximum:400,iridescenceThicknessTexture:null,iridescenceThicknessTextureInfo:new v(this.graph,"iridescenceThicknessTextureInfo")})}getIridescenceFactor(){return this.get("iridescenceFactor")}setIridescenceFactor(e){return this.set("iridescenceFactor",e)}getIridescenceTexture(){return this.getRef("iridescenceTexture")}getIridescenceTextureInfo(){return this.getRef("iridescenceTexture")?this.getRef("iridescenceTextureInfo"):null}setIridescenceTexture(e){return this.setRef("iridescenceTexture",e,{channels:Na})}getIridescenceIOR(){return this.get("iridescenceIOR")}setIridescenceIOR(e){return this.set("iridescenceIOR",e)}getIridescenceThicknessMinimum(){return this.get("iridescenceThicknessMinimum")}setIridescenceThicknessMinimum(e){return this.set("iridescenceThicknessMinimum",e)}getIridescenceThicknessMaximum(){return this.get("iridescenceThicknessMaximum")}setIridescenceThicknessMaximum(e){return this.set("iridescenceThicknessMaximum",e)}getIridescenceThicknessTexture(){return this.getRef("iridescenceThicknessTexture")}getIridescenceThicknessTextureInfo(){return this.getRef("iridescenceThicknessTexture")?this.getRef("iridescenceThicknessTextureInfo"):null}setIridescenceThicknessTexture(e){return this.setRef("iridescenceThicknessTexture",e,{channels:Sa})}}ur.EXTENSION_NAME=Gs;const Oe=Gs;class ba extends J{constructor(...e){super(...e),this.extensionName=Oe,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createIridescence(){return new ur(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Oe]){const a=this.createIridescence();e.materials[o].setExtension(Oe,a);const c=i.extensions[Oe];if(c.iridescenceFactor!==void 0&&a.setIridescenceFactor(c.iridescenceFactor),c.iridescenceIor!==void 0&&a.setIridescenceIOR(c.iridescenceIor),c.iridescenceThicknessMinimum!==void 0&&a.setIridescenceThicknessMinimum(c.iridescenceThicknessMinimum),c.iridescenceThicknessMaximum!==void 0&&a.setIridescenceThicknessMaximum(c.iridescenceThicknessMaximum),c.iridescenceTexture!==void 0){const u=c.iridescenceTexture,f=e.textures[n[u.index].source];a.setIridescenceTexture(f),e.setTextureInfo(a.getIridescenceTextureInfo(),u)}if(c.iridescenceThicknessTexture!==void 0){const u=c.iridescenceThicknessTexture,f=e.textures[n[u.index].source];a.setIridescenceThicknessTexture(f),e.setTextureInfo(a.getIridescenceThicknessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Oe);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Oe]={};if(n.getIridescenceFactor()>0&&(a.iridescenceFactor=n.getIridescenceFactor()),n.getIridescenceIOR()!==1.3&&(a.iridescenceIor=n.getIridescenceIOR()),n.getIridescenceThicknessMinimum()!==100&&(a.iridescenceThicknessMinimum=n.getIridescenceThicknessMinimum()),n.getIridescenceThicknessMaximum()!==400&&(a.iridescenceThicknessMaximum=n.getIridescenceThicknessMaximum()),n.getIridescenceTexture()){const c=n.getIridescenceTexture(),u=n.getIridescenceTextureInfo();a.iridescenceTexture=e.createTextureInfoDef(c,u)}if(n.getIridescenceThicknessTexture()){const c=n.getIridescenceThicknessTexture(),u=n.getIridescenceThicknessTextureInfo();a.iridescenceThicknessTexture=e.createTextureInfoDef(c,u)}}}),this}}ba.EXTENSION_NAME=Oe;const{R:gn,G:dn,B:Cn,A:En}=ue;class fr extends k{init(){this.extensionName=Hs,this.propertyType="PBRSpecularGlossiness",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{diffuseFactor:[1,1,1,1],diffuseTexture:null,diffuseTextureInfo:new v(this.graph,"diffuseTextureInfo"),specularFactor:[1,1,1],glossinessFactor:1,specularGlossinessTexture:null,specularGlossinessTextureInfo:new v(this.graph,"specularGlossinessTextureInfo")})}getDiffuseFactor(){return this.get("diffuseFactor")}setDiffuseFactor(e){return this.set("diffuseFactor",e)}getDiffuseTexture(){return this.getRef("diffuseTexture")}getDiffuseTextureInfo(){return this.getRef("diffuseTexture")?this.getRef("diffuseTextureInfo"):null}setDiffuseTexture(e){return this.setRef("diffuseTexture",e,{channels:gn|dn|Cn|En,isColor:!0})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(e){return this.set("specularFactor",e)}getGlossinessFactor(){return this.get("glossinessFactor")}setGlossinessFactor(e){return this.set("glossinessFactor",e)}getSpecularGlossinessTexture(){return this.getRef("specularGlossinessTexture")}getSpecularGlossinessTextureInfo(){return this.getRef("specularGlossinessTexture")?this.getRef("specularGlossinessTextureInfo"):null}setSpecularGlossinessTexture(e){return this.setRef("specularGlossinessTexture",e,{channels:gn|dn|Cn|En})}}fr.EXTENSION_NAME=Hs;const Ge=Hs;class La extends J{constructor(...e){super(...e),this.extensionName=Ge,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createPBRSpecularGlossiness(){return new fr(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Ge]){const a=this.createPBRSpecularGlossiness();e.materials[o].setExtension(Ge,a);const c=i.extensions[Ge];if(c.diffuseFactor!==void 0&&a.setDiffuseFactor(c.diffuseFactor),c.specularFactor!==void 0&&a.setSpecularFactor(c.specularFactor),c.glossinessFactor!==void 0&&a.setGlossinessFactor(c.glossinessFactor),c.diffuseTexture!==void 0){const u=c.diffuseTexture,f=e.textures[n[u.index].source];a.setDiffuseTexture(f),e.setTextureInfo(a.getDiffuseTextureInfo(),u)}if(c.specularGlossinessTexture!==void 0){const u=c.specularGlossinessTexture,f=e.textures[n[u.index].source];a.setSpecularGlossinessTexture(f),e.setTextureInfo(a.getSpecularGlossinessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Ge);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Ge]={diffuseFactor:n.getDiffuseFactor(),specularFactor:n.getSpecularFactor(),glossinessFactor:n.getGlossinessFactor()};if(n.getDiffuseTexture()){const c=n.getDiffuseTexture(),u=n.getDiffuseTextureInfo();a.diffuseTexture=e.createTextureInfoDef(c,u)}if(n.getSpecularGlossinessTexture()){const c=n.getSpecularGlossinessTexture(),u=n.getSpecularGlossinessTextureInfo();a.specularGlossinessTexture=e.createTextureInfoDef(c,u)}}}),this}}La.EXTENSION_NAME=Ge;const{R:wa,G:Oa,B:Ga,A:Ha}=ue;class lr extends k{init(){this.extensionName=Ps,this.propertyType="Sheen",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{sheenColorFactor:[0,0,0],sheenColorTexture:null,sheenColorTextureInfo:new v(this.graph,"sheenColorTextureInfo"),sheenRoughnessFactor:0,sheenRoughnessTexture:null,sheenRoughnessTextureInfo:new v(this.graph,"sheenRoughnessTextureInfo")})}getSheenColorFactor(){return this.get("sheenColorFactor")}setSheenColorFactor(e){return this.set("sheenColorFactor",e)}getSheenColorTexture(){return this.getRef("sheenColorTexture")}getSheenColorTextureInfo(){return this.getRef("sheenColorTexture")?this.getRef("sheenColorTextureInfo"):null}setSheenColorTexture(e){return this.setRef("sheenColorTexture",e,{channels:wa|Oa|Ga,isColor:!0})}getSheenRoughnessFactor(){return this.get("sheenRoughnessFactor")}setSheenRoughnessFactor(e){return this.set("sheenRoughnessFactor",e)}getSheenRoughnessTexture(){return this.getRef("sheenRoughnessTexture")}getSheenRoughnessTextureInfo(){return this.getRef("sheenRoughnessTexture")?this.getRef("sheenRoughnessTextureInfo"):null}setSheenRoughnessTexture(e){return this.setRef("sheenRoughnessTexture",e,{channels:Ha})}}lr.EXTENSION_NAME=Ps;const He=Ps;class Pa extends J{constructor(...e){super(...e),this.extensionName=He,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createSheen(){return new lr(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[He]){const a=this.createSheen();e.materials[o].setExtension(He,a);const c=i.extensions[He];if(c.sheenColorFactor!==void 0&&a.setSheenColorFactor(c.sheenColorFactor),c.sheenRoughnessFactor!==void 0&&a.setSheenRoughnessFactor(c.sheenRoughnessFactor),c.sheenColorTexture!==void 0){const u=c.sheenColorTexture,f=e.textures[n[u.index].source];a.setSheenColorTexture(f),e.setTextureInfo(a.getSheenColorTextureInfo(),u)}if(c.sheenRoughnessTexture!==void 0){const u=c.sheenRoughnessTexture,f=e.textures[n[u.index].source];a.setSheenRoughnessTexture(f),e.setTextureInfo(a.getSheenRoughnessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(He);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[He]={sheenColorFactor:n.getSheenColorFactor(),sheenRoughnessFactor:n.getSheenRoughnessFactor()};if(n.getSheenColorTexture()){const c=n.getSheenColorTexture(),u=n.getSheenColorTextureInfo();a.sheenColorTexture=e.createTextureInfoDef(c,u)}if(n.getSheenRoughnessTexture()){const c=n.getSheenRoughnessTexture(),u=n.getSheenRoughnessTextureInfo();a.sheenRoughnessTexture=e.createTextureInfoDef(c,u)}}}),this}}Pa.EXTENSION_NAME=He;const{R:_a,G:va,B:Ua,A:Ka}=ue;class Br extends k{init(){this.extensionName=_s,this.propertyType="Specular",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{specularFactor:1,specularTexture:null,specularTextureInfo:new v(this.graph,"specularTextureInfo"),specularColorFactor:[1,1,1],specularColorTexture:null,specularColorTextureInfo:new v(this.graph,"specularColorTextureInfo")})}getSpecularFactor(){return this.get("specularFactor")}setSpecularFactor(e){return this.set("specularFactor",e)}getSpecularColorFactor(){return this.get("specularColorFactor")}setSpecularColorFactor(e){return this.set("specularColorFactor",e)}getSpecularTexture(){return this.getRef("specularTexture")}getSpecularTextureInfo(){return this.getRef("specularTexture")?this.getRef("specularTextureInfo"):null}setSpecularTexture(e){return this.setRef("specularTexture",e,{channels:Ka})}getSpecularColorTexture(){return this.getRef("specularColorTexture")}getSpecularColorTextureInfo(){return this.getRef("specularColorTexture")?this.getRef("specularColorTextureInfo"):null}setSpecularColorTexture(e){return this.setRef("specularColorTexture",e,{channels:_a|va|Ua,isColor:!0})}}Br.EXTENSION_NAME=_s;const Pe=_s;class Ja extends J{constructor(...e){super(...e),this.extensionName=Pe,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createSpecular(){return new Br(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[Pe]){const a=this.createSpecular();e.materials[o].setExtension(Pe,a);const c=i.extensions[Pe];if(c.specularFactor!==void 0&&a.setSpecularFactor(c.specularFactor),c.specularColorFactor!==void 0&&a.setSpecularColorFactor(c.specularColorFactor),c.specularTexture!==void 0){const u=c.specularTexture,f=e.textures[n[u.index].source];a.setSpecularTexture(f),e.setTextureInfo(a.getSpecularTextureInfo(),u)}if(c.specularColorTexture!==void 0){const u=c.specularColorTexture,f=e.textures[n[u.index].source];a.setSpecularColorTexture(f),e.setTextureInfo(a.getSpecularColorTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(Pe);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[Pe]={};if(n.getSpecularFactor()!==1&&(a.specularFactor=n.getSpecularFactor()),H.eq(n.getSpecularColorFactor(),[1,1,1])||(a.specularColorFactor=n.getSpecularColorFactor()),n.getSpecularTexture()){const c=n.getSpecularTexture(),u=n.getSpecularTextureInfo();a.specularTexture=e.createTextureInfoDef(c,u)}if(n.getSpecularColorTexture()){const c=n.getSpecularColorTexture(),u=n.getSpecularColorTextureInfo();a.specularColorTexture=e.createTextureInfoDef(c,u)}}}),this}}Ja.EXTENSION_NAME=Pe;const{R:Va}=ue;class hr extends k{init(){this.extensionName=vs,this.propertyType="Transmission",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{transmissionFactor:0,transmissionTexture:null,transmissionTextureInfo:new v(this.graph,"transmissionTextureInfo")})}getTransmissionFactor(){return this.get("transmissionFactor")}setTransmissionFactor(e){return this.set("transmissionFactor",e)}getTransmissionTexture(){return this.getRef("transmissionTexture")}getTransmissionTextureInfo(){return this.getRef("transmissionTexture")?this.getRef("transmissionTextureInfo"):null}setTransmissionTexture(e){return this.setRef("transmissionTexture",e,{channels:Va})}}hr.EXTENSION_NAME=vs;const _e=vs;class ka extends J{constructor(...e){super(...e),this.extensionName=_e,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createTransmission(){return new hr(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[_e]){const a=this.createTransmission();e.materials[o].setExtension(_e,a);const c=i.extensions[_e];if(c.transmissionFactor!==void 0&&a.setTransmissionFactor(c.transmissionFactor),c.transmissionTexture!==void 0){const u=c.transmissionTexture,f=e.textures[n[u.index].source];a.setTransmissionTexture(f),e.setTextureInfo(a.getTransmissionTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(_e);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[_e]={transmissionFactor:n.getTransmissionFactor()};if(n.getTransmissionTexture()){const c=n.getTransmissionTexture(),u=n.getTransmissionTextureInfo();a.transmissionTexture=e.createTextureInfoDef(c,u)}}}),this}}ka.EXTENSION_NAME=_e;class pr extends k{init(){this.extensionName=Us,this.propertyType="Unlit",this.parentTypes=[D.MATERIAL]}}pr.EXTENSION_NAME=Us;const ze=Us;class ja extends J{constructor(...e){super(...e),this.extensionName=ze,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createUnlit(){return new pr(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){return(e.jsonDoc.json.materials||[]).forEach((r,n)=>{r.extensions&&r.extensions[ze]&&e.materials[n].setExtension(ze,this.createUnlit())}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{if(r.getExtension(ze)){const n=e.materialIndexMap.get(r),i=t.json.materials[n];i.extensions=i.extensions||{},i.extensions[ze]={}}}),this}}ja.EXTENSION_NAME=ze;class gr extends k{init(){this.extensionName=We,this.propertyType="Mapping",this.parentTypes=["MappingList"]}getDefaults(){return Object.assign(super.getDefaults(),{material:null,variants:new K})}getMaterial(){return this.getRef("material")}setMaterial(e){return this.setRef("material",e)}addVariant(e){return this.addRef("variants",e)}removeVariant(e){return this.removeRef("variants",e)}listVariants(){return this.listRefs("variants")}}gr.EXTENSION_NAME=We;class dr extends k{init(){this.extensionName=We,this.propertyType="MappingList",this.parentTypes=[D.PRIMITIVE]}getDefaults(){return Object.assign(super.getDefaults(),{mappings:new K})}addMapping(e){return this.addRef("mappings",e)}removeMapping(e){return this.removeRef("mappings",e)}listMappings(){return this.listRefs("mappings")}}dr.EXTENSION_NAME=We;class Bs extends k{init(){this.extensionName=We,this.propertyType="Variant",this.parentTypes=["MappingList"]}}Bs.EXTENSION_NAME=We;const Be=We;class Xa extends J{constructor(...e){super(...e),this.extensionName=Be}createMappingList(){return new dr(this.document.getGraph())}createVariant(e=""){return new Bs(this.document.getGraph(),e)}createMapping(){return new gr(this.document.getGraph())}listVariants(){return Array.from(this.properties).filter(e=>e instanceof Bs)}read(e){const t=e.jsonDoc;if(!t.json.extensions||!t.json.extensions[Be])return this;const i=(t.json.extensions[Be].variants||[]).map(a=>this.createVariant().setName(a.name||""));return(t.json.meshes||[]).forEach((a,c)=>{const u=e.meshes[c];(a.primitives||[]).forEach((B,A)=>{if(!B.extensions||!B.extensions[Be])return;const l=this.createMappingList(),h=B.extensions[Be];for(const g of h.mappings){const d=this.createMapping();g.material!==void 0&&d.setMaterial(e.materials[g.material]);for(const p of g.variants||[])d.addVariant(i[p]);l.addMapping(d)}u.listPrimitives()[A].setExtension(Be,l)})}),this}write(e){const t=e.jsonDoc,r=this.listVariants();if(!r.length)return this;const n=[],i=new Map;for(const o of r)i.set(o,n.length),n.push(e.createPropertyDef(o));for(const o of this.document.getRoot().listMeshes()){const a=e.meshIndexMap.get(o);o.listPrimitives().forEach((c,u)=>{const f=c.getExtension(Be);if(!f)return;const B=e.jsonDoc.json.meshes[a].primitives[u],A=f.listMappings().map(l=>{const h=e.createPropertyDef(l),g=l.getMaterial();return g&&(h.material=e.materialIndexMap.get(g)),h.variants=l.listVariants().map(d=>i.get(d)),h});B.extensions=B.extensions||{},B.extensions[Be]={mappings:A}})}return t.json.extensions=t.json.extensions||{},t.json.extensions[Be]={variants:n},this}}Xa.EXTENSION_NAME=Be;const{G:Wa}=ue;class Cr extends k{init(){this.extensionName=Ks,this.propertyType="Volume",this.parentTypes=[D.MATERIAL]}getDefaults(){return Object.assign(super.getDefaults(),{thicknessFactor:0,thicknessTexture:null,thicknessTextureInfo:new v(this.graph,"thicknessTexture"),attenuationDistance:1/0,attenuationColor:[1,1,1]})}getThicknessFactor(){return this.get("thicknessFactor")}setThicknessFactor(e){return this.set("thicknessFactor",e)}getThicknessTexture(){return this.getRef("thicknessTexture")}getThicknessTextureInfo(){return this.getRef("thicknessTexture")?this.getRef("thicknessTextureInfo"):null}setThicknessTexture(e){return this.setRef("thicknessTexture",e,{channels:Wa})}getAttenuationDistance(){return this.get("attenuationDistance")}setAttenuationDistance(e){return this.set("attenuationDistance",e)}getAttenuationColor(){return this.get("attenuationColor")}setAttenuationColor(e){return this.set("attenuationColor",e)}}Cr.EXTENSION_NAME=Ks;const ve=Ks;class Ya extends J{constructor(...e){super(...e),this.extensionName=ve,this.prereadTypes=[D.MESH],this.prewriteTypes=[D.MESH]}createVolume(){return new Cr(this.document.getGraph())}read(e){return this}write(e){return this}preread(e){const t=e.jsonDoc,r=t.json.materials||[],n=t.json.textures||[];return r.forEach((i,o)=>{if(i.extensions&&i.extensions[ve]){const a=this.createVolume();e.materials[o].setExtension(ve,a);const c=i.extensions[ve];if(c.thicknessFactor!==void 0&&a.setThicknessFactor(c.thicknessFactor),c.attenuationDistance!==void 0&&a.setAttenuationDistance(c.attenuationDistance),c.attenuationColor!==void 0&&a.setAttenuationColor(c.attenuationColor),c.thicknessTexture!==void 0){const u=c.thicknessTexture,f=e.textures[n[u.index].source];a.setThicknessTexture(f),e.setTextureInfo(a.getThicknessTextureInfo(),u)}}}),this}prewrite(e){const t=e.jsonDoc;return this.document.getRoot().listMaterials().forEach(r=>{const n=r.getExtension(ve);if(n){const i=e.materialIndexMap.get(r),o=t.json.materials[i];o.extensions=o.extensions||{};const a=o.extensions[ve]={};if(n.getThicknessFactor()>0&&(a.thicknessFactor=n.getThicknessFactor()),Number.isFinite(n.getAttenuationDistance())&&(a.attenuationDistance=n.getAttenuationDistance()),H.eq(n.getAttenuationColor(),[1,1,1])||(a.attenuationColor=n.getAttenuationColor()),n.getThicknessTexture()){const c=n.getThicknessTexture(),u=n.getThicknessTextureInfo();a.thicknessTexture=e.createTextureInfoDef(c,u)}}}),this}}Ya.EXTENSION_NAME=ve;const Er=Vo;class Vs extends J{constructor(...e){super(...e),this.extensionName=Er}read(e){return this}write(e){return this}}Vs.EXTENSION_NAME=Er;const pt=ko;class za{match(e){return e[0]===171&&e[1]===75&&e[2]===84&&e[3]===88&&e[4]===32&&e[5]===50&&e[6]===48&&e[7]===187&&e[8]===13&&e[9]===10&&e[10]===26&&e[11]===10}getSize(e){const t=ts(e);return[t.pixelWidth,t.pixelHeight]}getChannels(e){const r=ts(e).dataFormatDescriptor[0];if(r.colorModel===wo)return r.samples.length===2&&(r.samples[1].channelType&15)===15?4:3;if(r.colorModel===Oo)return(r.samples[0].channelType&15)===3?4:3;throw new Error(`Unexpected KTX2 colorModel, "${r.colorModel}".`)}getVRAMByteLength(e){const t=ts(e),r=this.getChannels(e)>3;let n=0;for(let i=0;i<t.levels.length;i++){const o=t.levels[i];if(o.uncompressedByteLength)n+=o.uncompressedByteLength;else{const a=Math.max(1,Math.floor(t.pixelWidth/Math.pow(2,i))),c=Math.max(1,Math.floor(t.pixelHeight/Math.pow(2,i))),u=r?16:8;n+=a/4*(c/4)*u}}return n}}class qa extends J{constructor(...e){super(...e),this.extensionName=pt,this.prereadTypes=[D.TEXTURE]}static register(){pe.registerFormat("image/ktx2",new za)}preread(e){return e.jsonDoc.json.textures.forEach(t=>{if(t.extensions&&t.extensions[pt]){const r=t.extensions[pt];t.source=r.source}}),this}read(e){return this}write(e){const t=e.jsonDoc;return this.document.getRoot().listTextures().forEach(r=>{if(r.getMimeType()==="image/ktx2"){const n=e.imageIndexMap.get(r);t.json.textures.forEach(i=>{i.source===n&&(i.extensions=i.extensions||{},i.extensions[pt]={source:i.source},delete i.source)})}}),this}}qa.EXTENSION_NAME=pt;class Dr extends k{init(){this.extensionName=Js,this.propertyType="Transform",this.parentTypes=[D.TEXTURE_INFO]}getDefaults(){return Object.assign(super.getDefaults(),{offset:[0,0],rotation:0,scale:[1,1],texCoord:null})}getOffset(){return this.get("offset")}setOffset(e){return this.set("offset",e)}getRotation(){return this.get("rotation")}setRotation(e){return this.set("rotation",e)}getScale(){return this.get("scale")}setScale(e){return this.set("scale",e)}getTexCoord(){return this.get("texCoord")}setTexCoord(e){return this.set("texCoord",e)}}Dr.EXTENSION_NAME=Js;const Ue=Js;class Qa extends J{constructor(...e){super(...e),this.extensionName=Ue}createTransform(){return new Dr(this.document.getGraph())}read(e){for(const[t,r]of Array.from(e.textureInfos.entries())){if(!r.extensions||!r.extensions[Ue])continue;const n=this.createTransform(),i=r.extensions[Ue];i.offset!==void 0&&n.setOffset(i.offset),i.rotation!==void 0&&n.setRotation(i.rotation),i.scale!==void 0&&n.setScale(i.scale),i.texCoord!==void 0&&n.setTexCoord(i.texCoord),t.setExtension(Ue,n)}return this}write(e){const t=Array.from(e.textureInfoDefMap.entries());for(const[r,n]of t){const i=r.getExtension(Ue);if(!i)continue;n.extensions=n.extensions||{};const o={},a=H.eq;a(i.getOffset(),[0,0])||(o.offset=i.getOffset()),i.getRotation()!==0&&(o.rotation=i.getRotation()),a(i.getScale(),[1,1])||(o.scale=i.getScale()),i.getTexCoord()!=null&&(o.texCoord=i.getTexCoord()),n.extensions[Ue]=o}return this}}Qa.EXTENSION_NAME=Ue;const Za=[D.ROOT,D.SCENE,D.NODE,D.MESH,D.MATERIAL,D.TEXTURE,D.ANIMATION];class Ir extends k{init(){this.extensionName=Gt,this.propertyType="Packet",this.parentTypes=Za}getDefaults(){return Object.assign(super.getDefaults(),{context:{},properties:{}})}getContext(){return this.get("context")}setContext(e){return this.set("context",Ee({},e))}listProperties(){return Object.keys(this.get("properties"))}getProperty(e){const t=this.get("properties");return e in t?t[e]:null}setProperty(e,t){this._assertContext(e);const r=Ee({},this.get("properties"));return t?r[e]=t:delete r[e],this.set("properties",r)}toJSONLD(){const e=ss(this.get("context")),t=ss(this.get("properties"));return Ee({"@context":e},t)}fromJSONLD(e){e=ss(e);const t=e["@context"];return t&&this.set("context",t),delete e["@context"],this.set("properties",e)}_assertContext(e){if(!(e.split(":")[0]in this.get("context")))throw new Error(`${Gt}: Missing context for term, "${e}".`)}}Ir.EXTENSION_NAME=Gt;function ss(s){return JSON.parse(JSON.stringify(s))}const Ce=Gt;class $a extends J{constructor(...e){super(...e),this.extensionName=Ce}createPacket(){return new Ir(this.document.getGraph())}listPackets(){return Array.from(this.properties)}read(e){var t;const r=(t=e.jsonDoc.json.extensions)==null?void 0:t[Ce];if(!r||!r.packets)return this;const n=e.jsonDoc.json,i=this.document.getRoot(),o=r.packets.map(u=>this.createPacket().fromJSONLD(u)),a=[[n.asset],n.scenes,n.nodes,n.meshes,n.materials,n.images,n.animations],c=[[i],i.listScenes(),i.listNodes(),i.listMeshes(),i.listMaterials(),i.listTextures(),i.listAnimations()];for(let u=0;u<a.length;u++){const f=a[u]||[];for(let B=0;B<f.length;B++){const A=f[B];if(A.extensions&&A.extensions[Ce]){const l=A.extensions[Ce];c[u][B].setExtension(Ce,o[l.packet])}}}return this}write(e){const{json:t}=e.jsonDoc,r=[];for(const n of this.properties){r.push(n.toJSONLD());for(const i of n.listParents()){let o;switch(i.propertyType){case D.ROOT:o=t.asset;break;case D.SCENE:o=t.scenes[e.sceneIndexMap.get(i)];break;case D.NODE:o=t.nodes[e.nodeIndexMap.get(i)];break;case D.MESH:o=t.meshes[e.meshIndexMap.get(i)];break;case D.MATERIAL:o=t.materials[e.materialIndexMap.get(i)];break;case D.TEXTURE:o=t.images[e.imageIndexMap.get(i)];break;case D.ANIMATION:o=t.animations[e.animationIndexMap.get(i)];break;default:o=null,this.document.getLogger().warn(`[${Ce}]: Unsupported parent property, "${i.propertyType}"`);break}o&&(o.extensions=o.extensions||{},o.extensions[Ce]={packet:r.length-1})}}return r.length>0&&(t.extensions=t.extensions||{},t.extensions[Ce]={packets:r}),this}}$a.EXTENSION_NAME=Ce;function je(){return je=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(s[r]=t[r])}return s},je.apply(this,arguments)}j.Mode;function at(s,e){return Object.defineProperty(e,"name",{value:s}),e}function ct(s,e){const t=je({},s);for(const r in e)e[r]!==void 0&&(t[r]=e[r]);return t}function ec(s){const e=s.getIndices(),t=s.getAttribute("POSITION");switch(s.getMode()){case j.Mode.POINTS:return e?e.getCount():t.getCount();case j.Mode.LINES:return e?e.getCount()/2:t.getCount()/2;case j.Mode.LINE_LOOP:return e?e.getCount():t.getCount();case j.Mode.LINE_STRIP:return e?e.getCount()-1:t.getCount()-1;case j.Mode.TRIANGLES:return e?e.getCount()/3:t.getCount()/3;case j.Mode.TRIANGLE_STRIP:case j.Mode.TRIANGLE_FAN:return e?e.getCount()-2:t.getCount()-2;default:throw new Error("Unexpected mode: "+s.getMode())}}function Dn(s){return s.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")}function tc(s,e,t=2){return(s>e?"–":"+")+(Math.abs(s-e)/s*100).toFixed(t)+"%"}function Vt(s,e){return`${Dn(s)} → ${Dn(e)} (${tc(s,e)})`}function ks(s){const e=[];for(const t of s.listAttributes())e.push(t);for(const t of s.listTargets())for(const r of t.listAttributes())e.push(r);return Array.from(new Set(e))}function sc(s,e,t){s.swap(e,t);for(const r of s.listTargets())r.swap(e,t)}function nc(s,e){if(s==null&&e==null)return!0;if(s==null||e==null||s.length!==e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!==e[t])return!1;return!0}function nt(s,e){return s.createAccessor(e.getName()).setArray(e.getArray()).setType(e.getType()).setBuffer(e.getBuffer()).setNormalized(e.getNormalized()).setSparse(e.getSparse())}function rc(s,e=s){const t=Tr(s,e);for(let r=0;r<t.length;r++)t[r]=r;return t}function Tr(s,e=s){return e<=65534?new Uint16Array(s):new Uint32Array(s)}function mr(s){for(const e in s)return!1;return!0}function ic(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function oc(s){const e=new Set;let t=s,r;for(;r=t.getParentNode();){if(e.has(r))throw new Error("Circular dependency in scene graph.");e.add(r),t=r}return t.listParents().filter(n=>n instanceof Jt)}function ac(s){const e=oc(s),t=s.getParentNode();if(!t)return s;s.setMatrix(s.getWorldMatrix()),t.removeChild(s);for(const r of e)r.addChild(s);return s}var Ht=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var s=0,e=arguments.length;e--;)s+=arguments[e]*arguments[e];return Math.sqrt(s)});function cc(s,e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],f=e[8],B=e[9],A=e[10],l=e[11],h=e[12],g=e[13],d=e[14],p=e[15],y=t*a-r*o,T=t*c-n*o,I=t*u-i*o,E=r*c-n*a,m=r*u-i*a,C=n*u-i*c,x=f*g-B*h,F=f*d-A*h,M=f*p-l*h,R=B*d-A*g,b=B*p-l*g,N=A*p-l*d,w=y*N-T*b+I*R+E*M-m*F+C*x;return w?(w=1/w,s[0]=(a*N-c*b+u*R)*w,s[1]=(n*b-r*N-i*R)*w,s[2]=(g*C-d*m+p*E)*w,s[3]=(A*m-B*C-l*E)*w,s[4]=(c*M-o*N-u*F)*w,s[5]=(t*N-n*M+i*F)*w,s[6]=(d*I-h*C-p*T)*w,s[7]=(f*C-A*I+l*T)*w,s[8]=(o*b-a*M+u*x)*w,s[9]=(r*M-t*b-i*x)*w,s[10]=(h*m-g*I+p*y)*w,s[11]=(B*I-f*m-l*y)*w,s[12]=(a*F-o*R-c*x)*w,s[13]=(t*R-r*F+n*x)*w,s[14]=(g*T-h*E-d*y)*w,s[15]=(f*E-B*T+A*y)*w,s):null}function js(s,e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],f=e[7],B=e[8],A=e[9],l=e[10],h=e[11],g=e[12],d=e[13],p=e[14],y=e[15],T=t[0],I=t[1],E=t[2],m=t[3];return s[0]=T*r+I*a+E*B+m*g,s[1]=T*n+I*c+E*A+m*d,s[2]=T*i+I*u+E*l+m*p,s[3]=T*o+I*f+E*h+m*y,T=t[4],I=t[5],E=t[6],m=t[7],s[4]=T*r+I*a+E*B+m*g,s[5]=T*n+I*c+E*A+m*d,s[6]=T*i+I*u+E*l+m*p,s[7]=T*o+I*f+E*h+m*y,T=t[8],I=t[9],E=t[10],m=t[11],s[8]=T*r+I*a+E*B+m*g,s[9]=T*n+I*c+E*A+m*d,s[10]=T*i+I*u+E*l+m*p,s[11]=T*o+I*f+E*h+m*y,T=t[12],I=t[13],E=t[14],m=t[15],s[12]=T*r+I*a+E*B+m*g,s[13]=T*n+I*c+E*A+m*d,s[14]=T*i+I*u+E*l+m*p,s[15]=T*o+I*f+E*h+m*y,s}function Ac(s,e){return s[0]=e[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=e[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=e[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s}function uc(s,e,t,r){var n=e[0],i=e[1],o=e[2],a=e[3],c=n+n,u=i+i,f=o+o,B=n*c,A=n*u,l=n*f,h=i*u,g=i*f,d=o*f,p=a*c,y=a*u,T=a*f,I=r[0],E=r[1],m=r[2];return s[0]=(1-(h+d))*I,s[1]=(A+T)*I,s[2]=(l-y)*I,s[3]=0,s[4]=(A-T)*E,s[5]=(1-(B+d))*E,s[6]=(g+p)*E,s[7]=0,s[8]=(l+y)*m,s[9]=(g-p)*m,s[10]=(1-(B+h))*m,s[11]=0,s[12]=t[0],s[13]=t[1],s[14]=t[2],s[15]=1,s}function fc(){var s=new Ht(3);return Ht!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0),s}function lc(s,e,t){return s[0]=e[0]*t[0],s[1]=e[1]*t[1],s[2]=e[2]*t[2],s}function hs(s,e,t){return s[0]=Math.min(e[0],t[0]),s[1]=Math.min(e[1],t[1]),s[2]=Math.min(e[2],t[2]),s}function ps(s,e,t){return s[0]=Math.max(e[0],t[0]),s[1]=Math.max(e[1],t[1]),s[2]=Math.max(e[2],t[2]),s}function In(s,e,t){return s[0]=e[0]*t,s[1]=e[1]*t,s[2]=e[2]*t,s}function Bc(s,e,t){var r=e[0],n=e[1],i=e[2],o=t[3]*r+t[7]*n+t[11]*i+t[15];return o=o||1,s[0]=(t[0]*r+t[4]*n+t[8]*i+t[12])/o,s[1]=(t[1]*r+t[5]*n+t[9]*i+t[13])/o,s[2]=(t[2]*r+t[6]*n+t[10]*i+t[14])/o,s}var hc=lc;(function(){var s=fc();return function(e,t,r,n,i,o){var a,c;for(t||(t=3),r||(r=0),n?c=Math.min(n*t+r,e.length):c=e.length,a=r;a<c;a+=t)s[0]=e[a],s[1]=e[a+1],s[2]=e[a+2],i(s,s,o),e[a]=s[0],e[a+1]=s[1],e[a+2]=s[2];return e}})();const ye="dedup",ns={keepUniqueNames:!1,propertyTypes:[D.ACCESSOR,D.MESH,D.TEXTURE,D.MATERIAL,D.SKIN]};function kt(s=ns){const e=ct(ns,s),t=new Set(e.propertyTypes);for(const r of e.propertyTypes)if(!ns.propertyTypes.includes(r))throw new Error(`${ye}: Unsupported deduplication on type "${r}".`);return at(ye,r=>{const n=r.getLogger();t.has(D.ACCESSOR)&&pc(r),t.has(D.TEXTURE)&&dc(r,e),t.has(D.MATERIAL)&&Cc(r,e),t.has(D.MESH)&&gc(r,e),t.has(D.SKIN)&&Ec(r,e),n.debug(`${ye}: Complete.`)})}function pc(s){const e=s.getLogger(),t=new Map,r=new Map,n=new Map,i=new Map,o=s.getRoot().listMeshes();o.forEach(B=>{B.listPrimitives().forEach(A=>{A.listAttributes().forEach(l=>a(l,r)),a(A.getIndices(),t)})});for(const B of s.getRoot().listAnimations())for(const A of B.listSamplers())a(A.getInput(),n),a(A.getOutput(),i);function a(B,A){if(!B)return;const l=[B.getCount(),B.getType(),B.getComponentType(),B.getNormalized(),B.getSparse()].join(":");let h=A.get(l);h||A.set(l,h=new Set),h.add(B)}function c(B,A){for(let l=0;l<B.length;l++){const h=B[l],g=G.toView(h.getArray());if(!A.has(h))for(let d=l+1;d<B.length;d++){const p=B[d];A.has(p)||G.equals(g,G.toView(p.getArray()))&&A.set(p,h)}}}let u=0;const f=new Map;for(const B of[r,t,n,i])for(const A of B.values())u+=A.size,c(Array.from(A),f);e.debug(`${ye}: Merged ${f.size} of ${u} accessors.`),o.forEach(B=>{B.listPrimitives().forEach(A=>{A.listAttributes().forEach(h=>{f.has(h)&&A.swap(h,f.get(h))});const l=A.getIndices();l&&f.has(l)&&A.swap(l,f.get(l))})});for(const B of s.getRoot().listAnimations())for(const A of B.listSamplers()){const l=A.getInput(),h=A.getOutput();l&&f.has(l)&&A.swap(l,f.get(l)),h&&f.has(h)&&A.swap(h,f.get(h))}Array.from(f.keys()).forEach(B=>B.dispose())}function gc(s,e){const t=s.getLogger(),r=s.getRoot(),n=new Map;r.listAccessors().forEach((a,c)=>n.set(a,c)),r.listMaterials().forEach((a,c)=>n.set(a,c));const i=r.listMeshes().length,o=new Map;for(const a of r.listMeshes()){const c=[];for(const f of a.listPrimitives())c.push(xr(f,n));let u="";if(e.keepUniqueNames&&(u+=a.getName()+";"),u+=c.join(";"),o.has(u)){const f=o.get(u);a.listParents().forEach(B=>{B.propertyType!==D.ROOT&&B.swap(a,f)}),a.dispose()}else o.set(u,a)}t.debug(`${ye}: Merged ${i-o.size} of ${i} meshes.`)}function dc(s,e){const t=s.getLogger(),r=s.getRoot(),n=r.listTextures(),i=new Map;for(let o=0;o<n.length;o++){const a=n[o],c=a.getImage();if(!i.has(a))for(let u=o+1;u<n.length;u++){const f=n[u],B=f.getImage();if(i.has(f)||a.getMimeType()!==f.getMimeType()||e.keepUniqueNames&&a.getName()!==f.getName())continue;const A=a.getSize(),l=f.getSize();!A||!l||A[0]===l[0]&&A[1]===l[1]&&(!c||!B||G.equals(c,B)&&i.set(f,a))}}t.debug(`${ye}: Merged ${i.size} of ${r.listTextures().length} textures.`),Array.from(i.entries()).forEach(([o,a])=>{o.listParents().forEach(c=>{c instanceof ot||c.swap(o,a)}),o.dispose()})}function Cc(s,e){const t=s.getLogger(),n=s.getRoot().listMaterials(),i=new Map,o=new Map,a=new Set;e.keepUniqueNames||a.add("name");for(let c=0;c<n.length;c++){const u=n[c];if(!i.has(u)&&!Tn(u,o))for(let f=c+1;f<n.length;f++){const B=n[f];i.has(B)||Tn(B,o)||u.equals(B,a)&&i.set(B,u)}}t.debug(`${ye}: Merged ${i.size} of ${n.length} materials.`),Array.from(i.entries()).forEach(([c,u])=>{c.listParents().forEach(f=>{f instanceof ot||f.swap(c,u)}),c.dispose()})}function Ec(s,e){const t=s.getLogger(),n=s.getRoot().listSkins(),i=new Map,o=new Set(["joints"]);e.keepUniqueNames||o.add("name");for(let a=0;a<n.length;a++){const c=n[a];if(!i.has(c))for(let u=a+1;u<n.length;u++){const f=n[u];i.has(f)||c.equals(f,o)&&nc(c.listJoints(),f.listJoints())&&i.set(f,c)}}t.debug(`${ye}: Merged ${i.size} of ${n.length} skins.`),Array.from(i.entries()).forEach(([a,c])=>{a.listParents().forEach(u=>{u instanceof ot||u.swap(a,c)}),a.dispose()})}function xr(s,e){const t=[];for(const r of s.listSemantics()){const n=s.getAttribute(r);t.push(r+":"+e.get(n))}if(s instanceof j){const r=s.getIndices();r&&t.push("indices:"+e.get(r));const n=s.getMaterial();n&&t.push("material:"+e.get(n)),t.push("mode:"+s.getMode());for(const i of s.listTargets())t.push("target:"+xr(i,e))}return t.join(",")}function Tn(s,e){if(e.has(s))return e.get(s);const t=s.getGraph(),r=new Set,n=t.listParentEdges(s);for(;n.length>0;){const i=n.pop();if(i.getAttributes().modifyChild===!0)return e.set(s,!0),!0;const o=i.getChild();if(!r.has(o))for(const a of t.listChildEdges(o))n.push(a)}return e.set(s,!1),!1}function yr(){var s=new Ht(4);return Ht!=Float32Array&&(s[0]=0,s[1]=0,s[2]=0,s[3]=0),s}function Dc(s,e,t){return s[0]=e[0]+t[0],s[1]=e[1]+t[1],s[2]=e[2]+t[2],s[3]=e[3]+t[3],s}function Ic(s,e,t){return s[0]=e[0]-t[0],s[1]=e[1]-t[1],s[2]=e[2]-t[2],s[3]=e[3]-t[3],s}function Tc(s,e,t){return s[0]=e[0]*t[0],s[1]=e[1]*t[1],s[2]=e[2]*t[2],s[3]=e[3]*t[3],s}function mc(s,e,t){return s[0]=e[0]*t,s[1]=e[1]*t,s[2]=e[2]*t,s[3]=e[3]*t,s}function xc(s){var e=s[0],t=s[1],r=s[2],n=s[3];return Math.hypot(e,t,r,n)}var Fr=Ic,yc=Tc,Mr=xc;(function(){var s=yr();return function(e,t,r,n,i,o){var a,c;for(t||(t=4),r||(r=0),n?c=Math.min(n*t+r,e.length):c=e.length,a=r;a<c;a+=t)s[0]=e[a],s[1]=e[a+1],s[2]=e[a+2],s[3]=e[a+3],i(s,s,o),e[a]=s[0],e[a+1]=s[1],e[a+2]=s[2],e[a+3]=s[3];return e}})();const Fc=/color|emissive|diffuse/i;function Mc(s){return s.getGraph().listParentEdges(s).some(n=>n.getAttributes().isColor||Fc.test(n.getName()))?"srgb":null}function Rc(s){const e=s.getGraph(),t=new Set,r=new Set;function n(i){const o=new Set;for(const a of e.listChildEdges(i))a.getChild()instanceof Ct&&o.add(a.getName()+"Info");for(const a of e.listChildEdges(i)){const c=a.getChild();t.has(c)||(t.add(c),c instanceof v&&o.has(a.getName())?r.add(c):c instanceof k&&n(c))}}return n(s),Array.from(r)}function Nc(s){const t=fe.fromGraph(s.getGraph()).getRoot(),r=s.getGraph().listParentEdges(s).filter(n=>n.getParent()!==t).map(n=>n.getName());return Array.from(new Set(r))}const Ze="prune",gs=3/255,mn={propertyTypes:[D.NODE,D.SKIN,D.MESH,D.CAMERA,D.PRIMITIVE,D.PRIMITIVE_TARGET,D.ANIMATION,D.MATERIAL,D.TEXTURE,D.ACCESSOR,D.BUFFER],keepLeaves:!1,keepAttributes:!1,keepIndices:!1,keepSolidTextures:!1,keepExtras:!1};function jt(s=mn){const e=ct(mn,s),t=new Set(e.propertyTypes),r=e.keepExtras;return at(Ze,async n=>{const i=n.getLogger(),o=n.getRoot(),a=n.getGraph(),c=new Sc,u=f=>c.dispose(f.target);if(a.addEventListener("node:dispose",u),t.has(D.MESH))for(const f of o.listMeshes())f.listPrimitives().length>0||f.dispose();if(t.has(D.NODE)){if(!e.keepLeaves)for(const f of o.listScenes())Rr(a,f,r);for(const f of o.listNodes())ae(f,r)}if(t.has(D.SKIN))for(const f of o.listSkins())ae(f,r);if(t.has(D.MESH))for(const f of o.listMeshes())ae(f,r);if(t.has(D.CAMERA))for(const f of o.listCameras())ae(f,r);if(t.has(D.PRIMITIVE)&&xn(a,D.PRIMITIVE,r),t.has(D.PRIMITIVE_TARGET)&&xn(a,D.PRIMITIVE_TARGET,r),!e.keepAttributes&&t.has(D.ACCESSOR)){const f=new Map;for(const B of o.listMeshes())for(const A of B.listPrimitives()){const l=A.getMaterial();if(!l)continue;const h=Nr(n,A,l),g=Lc(A,h);yn(A,g),A.listTargets().forEach(d=>yn(d,g)),f.has(l)?f.get(l).add(A):f.set(l,new Set([A]))}for(const[B,A]of f)wc(B,Array.from(A))}if(!e.keepIndices&&t.has(D.ACCESSOR))for(const f of o.listMeshes())for(const B of f.listPrimitives())bc(B);if(t.has(D.ANIMATION))for(const f of o.listAnimations()){for(const B of f.listChannels())B.getTargetNode()||B.dispose();if(f.listChannels().length)f.listSamplers().forEach(B=>ae(B,r));else{const B=f.listSamplers();ae(f,r),B.forEach(A=>ae(A,r))}}if(t.has(D.MATERIAL)&&o.listMaterials().forEach(f=>ae(f,r)),t.has(D.TEXTURE)&&(o.listTextures().forEach(f=>ae(f,r)),e.keepSolidTextures||await Oc(n)),t.has(D.ACCESSOR)&&o.listAccessors().forEach(f=>ae(f,r)),t.has(D.BUFFER)&&o.listBuffers().forEach(f=>ae(f,r)),a.removeEventListener("node:dispose",u),c.empty())i.debug(`${Ze}: No unused properties found.`);else{const f=c.entries().map(([B,A])=>`${B} (${A})`).join(", ");i.info(`${Ze}: Removed types... ${f}`)}i.debug(`${Ze}: Complete.`)})}class Sc{constructor(){this.disposed={}}empty(){for(const e in this.disposed)return!1;return!0}entries(){return Object.entries(this.disposed)}dispose(e){this.disposed[e.propertyType]=this.disposed[e.propertyType]||0,this.disposed[e.propertyType]++}}function ae(s,e){const t=s.listParents().filter(n=>!(n instanceof ot||n instanceof rt)),r=e&&!mr(s.getExtras());!t.length&&!r&&s.dispose()}function xn(s,e,t){for(const r of s.listEdges()){const n=r.getParent();n.propertyType===e&&ae(n,t)}}function Rr(s,e,t){if(e.listChildren().forEach(o=>Rr(s,o,t)),e instanceof Jt)return;const r=s.listParentEdges(e).some(o=>{const a=o.getParent().propertyType;return a!==D.ROOT&&a!==D.SCENE&&a!==D.NODE}),n=s.listChildren(e).length===0,i=t&&!mr(e.getExtras());n&&!r&&!i&&e.dispose()}function yn(s,e){for(const t of e)s.setAttribute(t,null)}function bc(s){const e=s.getIndices(),t=e&&e.getArray(),r=s.listAttributes()[0];if(!(!t||!r)&&e.getCount()===r.getCount()){for(let n=0,i=t.length;n<i;n++)if(n!==t[n])return;s.setIndices(null)}}function Lc(s,e){const t=[];for(const r of s.listSemantics())(r==="NORMAL"&&!e.has(r)||r==="TANGENT"&&!e.has(r)||r.startsWith("TEXCOORD_")&&!e.has(r)||r.startsWith("COLOR_")&&r!=="COLOR_0")&&t.push(r);return t}function Nr(s,e,t,r=new Set){const i=s.getGraph().listChildEdges(t),o=new Set;for(const u of i)u.getChild()instanceof Ct&&o.add(u.getName());for(const u of i){const f=u.getName(),B=u.getChild();B instanceof v&&o.has(f.replace(/Info$/,""))&&r.add(`TEXCOORD_${B.getTexCoord()}`),B instanceof Ct&&f.match(/normalTexture/i)&&r.add("TANGENT"),B instanceof k&&Nr(s,e,B,r)}const a=t instanceof De&&!t.getExtension("KHR_materials_unlit"),c=e.getMode()===j.Mode.POINTS;return a&&!c&&r.add("NORMAL"),r}function wc(s,e){const t=Rc(s),r=new Set(t.map(c=>c.getTexCoord())),n=Array.from(r).sort(),i=new Map(n.map((c,u)=>[c,u])),o=new Map(n.map((c,u)=>[`TEXCOORD_${c}`,`TEXCOORD_${u}`]));for(const c of t){const u=c.getTexCoord();c.setTexCoord(i.get(u))}for(const c of e){const u=c.listSemantics().filter(f=>f.startsWith("TEXCOORD_")).sort();a(c,u),c.listTargets().forEach(f=>a(f,u))}function a(c,u){for(const f of u){const B=c.getAttribute(f);if(!B)continue;const A=o.get(f);A!==f&&(c.setAttribute(A,B),c.setAttribute(f,null))}}}async function Oc(s){const e=s.getRoot(),t=s.getGraph(),r=s.getLogger(),i=e.listTextures().map(async o=>{var a;const c=await Hc(o);if(!c)return;Mc(o)==="srgb"&&Bi.convertSRGBToLinear(c,c);const u=o.getName()||o.getURI(),f=(a=o.getSize())==null?void 0:a.join("x"),B=Nc(o);for(const A of t.listParentEdges(o)){const l=A.getParent();l!==e&&Gc(l,c,A.getName(),r)&&A.dispose()}o.listParents().length===1&&(o.dispose(),r.debug(`${Ze}: Removed solid-color texture "${u}" (${f}px ${B.join(", ")})`))});await Promise.all(i)}function Gc(s,e,t,r){if(s instanceof De)switch(t){case"baseColorTexture":return s.setBaseColorFactor(yc(e,e,s.getBaseColorFactor())),!0;case"emissiveTexture":return s.setEmissiveFactor(hc([0,0,0],e.slice(0,3),s.getEmissiveFactor())),!0;case"occlusionTexture":return Math.abs(e[0]-1)<=gs;case"metallicRoughnessTexture":return s.setRoughnessFactor(e[1]*s.getRoughnessFactor()),s.setMetallicFactor(e[2]*s.getMetallicFactor()),!0;case"normalTexture":return Mr(Fr(yr(),e,[.5,.5,1,1]))<=gs}return r.warn(`${Ze}: Detected single-color ${t} texture. Pruning ${t} not yet supported.`),!1}async function Hc(s){const e=await Pc(s);if(!e)return null;const t=[1/0,1/0,1/0,1/0],r=[-1/0,-1/0,-1/0,-1/0],n=[0,0,0,0],[i,o]=e.shape;for(let a=0;a<i;a++){for(let c=0;c<o;c++)for(let u=0;u<4;u++)t[u]=Math.min(t[u],e.get(a,c,u)),r[u]=Math.max(r[u],e.get(a,c,u));if(Mr(Fr(n,r,t))/255>gs)return null}return mc(n,Dc(n,r,t),.5/255)}async function Pc(s){try{return await Mo(s.getImage(),s.getMimeType())}catch{return null}}const me=2**32-1;class _c{constructor(e){this.attributes=[],this.u8=void 0,this.u32=void 0;let t=0;for(const r of ks(e))t+=this._initAttribute(r);this.u8=new Uint8Array(t),this.u32=new Uint32Array(this.u8.buffer)}_initAttribute(e){const t=e.getArray(),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=e.getElementSize()*e.getComponentSize(),i=G.padNumber(n);return this.attributes.push({u8:r,byteStride:n,paddedByteStride:i}),i}hash(e){let t=0;for(const{u8:r,byteStride:n,paddedByteStride:i}of this.attributes){for(let o=0;o<i;o++)o<n?this.u8[t+o]=r[e*n+o]:this.u8[t+o]=0;t+=i}return vc(0,this.u32)}equal(e,t){for(const{u8:r,byteStride:n}of this.attributes)for(let i=0;i<n;i++)if(r[e*n+i]!==r[t*n+i])return!1;return!0}}function vc(s,e){for(let n=0,i=e.length;n<i;n++){let o=e[n];o=Math.imul(o,1540483477)>>>0,o=(o^o>>24)>>>0,o=Math.imul(o,1540483477)>>>0,s=Math.imul(s,1540483477)>>>0,s=(s^o)>>>0}return s}function Uc(s,e,t,r,n=me){const i=e-1;let a=t.hash(r)&i;for(let c=0;c<=i;c++){const u=s[a];if(u===n||t.equal(u,r))return a;a=a+c+1&i}throw new Error("Hash table full.")}var z;(function(s){s.RENDER="render",s.RENDER_CACHED="render-cached",s.UPLOAD="upload",s.UPLOAD_NAIVE="upload-naive",s.DISTINCT="distinct",s.DISTINCT_POSITION="distinct-position",s.UNUSED="unused"})(z||(z={}));function de(s,e){const t=s.getAttribute("POSITION"),r=s.getIndices();switch(e){case z.RENDER:return r?r.getCount():t.getCount();case z.RENDER_CACHED:return r?new Set(r.getArray()).size:t.getCount();case z.UPLOAD_NAIVE:case z.UPLOAD:return t.getCount();case z.DISTINCT:case z.DISTINCT_POSITION:return Kc(e);case z.UNUSED:return r?t.getCount()-new Set(r.getArray()).size:0;default:return Jc(e)}}function Kc(s){throw new Error(`Not implemented: ${s}`)}function Jc(s){throw new Error(`Unexpected value: ${s}`)}function Pt(s,e,t){const r=fe.fromGraph(s.getGraph());(!e||!t)&&([e,t]=Vc(s));const n=s.getIndices(),i=n?n.getArray():null,o=de(s,z.RENDER),a=r.createAccessor(),c=o,u=Tr(c,t);for(let B=0;B<c;B++)u[B]=e[i?i[B]:B];s.setIndices(a.setArray(u));const f=ks(s);for(const B of s.listAttributes()){const A=nt(r,B);ds(B,n,e,A,t),s.swap(B,A)}for(const B of s.listTargets())for(const A of B.listAttributes()){const l=nt(r,A);ds(A,n,e,l,t),B.swap(A,l)}n&&n.listParents().length===1&&n.dispose();for(const B of f)B.listParents().length===1&&B.dispose();return s}function ds(s,e,t,r,n){const i=s.getElementSize(),o=s.getArray(),a=e?e.getArray():null,c=e?e.getCount():s.getCount(),u=new o.constructor(n*i),f=new Uint8Array(n);for(let B=0;B<c;B++){const A=a?a[B]:B,l=t[A];if(!f[l]){for(let h=0;h<i;h++)u[l*i+h]=o[A*i+h];f[l]=1}}return r.setArray(u)}function Vc(s){const e=de(s,z.UPLOAD),t=s.getIndices(),r=t?t.getArray():null;if(!t||!r)return[rc(e,1e6),e];const n=new Uint32Array(e).fill(me);let i=0;for(let o=0;o<r.length;o++){const a=r[o];n[a]===me&&(n[a]=i++)}return[n,i]}const Cs="weld",_t={overwrite:!0,cleanup:!0};function Sr(s=_t){const e=ct(_t,s);return at(Cs,async t=>{const r=t.getLogger();for(const n of t.getRoot().listMeshes()){for(const i of n.listPrimitives())br(i,e),de(i,z.RENDER)===0&&i.dispose();n.listPrimitives().length===0&&n.dispose()}e.cleanup&&await t.transform(jt({propertyTypes:[D.ACCESSOR,D.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),kt({propertyTypes:[D.ACCESSOR]})),r.debug(`${Cs}: Complete.`)})}function br(s,e=_t){const t=s.getGraph(),n=fe.fromGraph(t).getLogger(),i=je({},_t,e);if(s.getIndices()&&!i.overwrite||s.getMode()===j.Mode.POINTS)return;const o=s.getAttribute("POSITION").getCount(),a=s.getIndices(),c=a==null?void 0:a.getArray(),u=a?a.getCount():o,f=new _c(s),B=ic(o+o/4),A=new Uint32Array(B).fill(me),l=new Uint32Array(o).fill(me);let h=0;for(let g=0;g<u;g++){const d=c?c[g]:g;if(l[d]!==me)continue;const p=Uc(A,B,f,d,me),y=A[p];y===me?(A[p]=d,l[d]=h++):l[d]=l[y]}n.debug(`${Cs}: ${Vt(o,h)} vertices.`),Pt(s,l,h)}S.ComponentType;const{LINES:bA,LINE_STRIP:LA,LINE_LOOP:wA,TRIANGLES:kc,TRIANGLE_STRIP:jc,TRIANGLE_FAN:Xc}=j.Mode;function Wc(s){const e=s.getGraph(),t=fe.fromGraph(e);s.getIndices()||br(s);const r=s.getIndices(),n=r.getArray(),i=ec(s),o=Tt[r.getComponentType()],a=new o(i*3),c=s.getMode();if(c===jc)for(let f=0,B=n.length;f<B-2;f++)f%2?(a[f*3]=n[f+1],a[f*3+1]=n[f],a[f*3+2]=n[f+2]):(a[f*3]=n[f],a[f*3+1]=n[f+1],a[f*3+2]=n[f+2]);else if(c===Xc)for(let f=0;f<i;f++)a[f*3]=n[0],a[f*3+1]=n[f+1],a[f*3+2]=n[f+2];else throw new Error("Only TRIANGLE_STRIP and TRIANGLE_FAN may be converted to TRIANGLES.");s.setMode(kc);const u=t.getRoot();r.listParents().some(f=>f!==u&&f!==s)?s.setIndices(nt(t,r).setArray(a)):r.setArray(a)}function Es(s,e,t){const r=new Float32Array(s.length);for(let n=0,i=s.length;n<i;n++)t?r[n]=H.decodeNormalizedInt(s[n],e):r[n]=s[n];return r}const rs="flatten",Fn={cleanup:!0};function Yc(s=Fn){const e=ct(Fn,s);return at(rs,async t=>{const r=t.getRoot(),n=t.getLogger(),i=new Set;for(const u of r.listSkins())for(const f of u.listJoints())i.add(f);const o=new Set;for(const u of r.listAnimations())for(const f of u.listChannels()){const B=f.getTargetNode();B&&f.getTargetPath()!=="weights"&&o.add(B)}const a=new Set,c=new Set;for(const u of r.listScenes())u.traverse(f=>{const B=f.getParentNode();B&&((i.has(B)||a.has(B))&&a.add(f),(o.has(B)||c.has(B))&&c.add(f))});for(const u of r.listScenes())u.traverse(f=>{o.has(f)||a.has(f)||c.has(f)||ac(f)});o.size&&n.debug(`${rs}: Flattening node hierarchies with TRS animation not yet supported.`),e.cleanup&&await t.transform(jt({propertyTypes:[D.NODE],keepLeaves:!1})),n.debug(`${rs}: Complete.`)})}j.Mode;function zc(s,e=1/0){if(Number.isFinite(e)&&e%4||e<=0)throw new Error("Limit must be positive multiple of four.");const t=s.getAttribute("POSITION").getCount(),r=s.listSemantics().filter(u=>u.startsWith("WEIGHTS_")).length,n=new Uint16Array(r*4),i=new Float32Array(r*4),o=new Float32Array(r*4),a=new Uint32Array(r*4),c=new Uint32Array(r*4);for(let u=0;u<t;u++){vt(s,u,"WEIGHTS",i),vt(s,u,"JOINTS",a);for(let f=0;f<r*4;f++)n[f]=f;n.sort((f,B)=>i[f]>i[B]?-1:1);for(let f=0;f<n.length;f++)o[f]=i[n[f]],c[f]=a[n[f]];Ut(s,u,"WEIGHTS",o),Ut(s,u,"JOINTS",c)}for(let u=r;u*4>e;u--){const f=s.getAttribute(`WEIGHTS_${u-1}`),B=s.getAttribute(`JOINTS_${u-1}`);s.setAttribute(`WEIGHTS_${u-1}`,null),s.setAttribute(`JOINTS_${u-1}`,null),f.listParents().length===1&&f.dispose(),B.listParents().length===1&&B.dispose()}qc(s)}function qc(s){if(!Qc(s))return;const e=s.getAttribute("POSITION").getCount(),t=s.listSemantics().filter(B=>B.startsWith("WEIGHTS_")).length,r=s.getAttribute("WEIGHTS_0"),n=r.getArray(),i=r.getComponentType(),o=r.getNormalized(),a=o?i:void 0,c=o?H.decodeNormalizedInt(1,i):Number.EPSILON,u=new Uint32Array(t*4).fill(0),f=n.slice(0,t*4).fill(0);for(let B=0;B<e;B++){vt(s,B,"JOINTS",u),vt(s,B,"WEIGHTS",f,a);let A=Mn(f,a);if(A!==0&&A!==1){if(Math.abs(1-A)>c)for(let l=0;l<f.length;l++)if(o){const h=H.decodeNormalizedInt(f[l],i);f[l]=H.encodeNormalizedInt(h/A,i)}else f[l]/=A;if(A=Mn(f,a),o&&A!==1){for(let l=f.length-1;l>=0;l--)if(f[l]>0){const h=1-A;f[l]+=Math.sign(h)*H.encodeNormalizedInt(Math.abs(h),i);break}}}for(let l=f.length-1;l>=0;l--)f[l]===0&&(u[l]=0);Ut(s,B,"JOINTS",u),Ut(s,B,"WEIGHTS",f,a)}}function vt(s,e,t,r,n){let i;const o=[0,0,0,0];for(let a=0;i=s.getAttribute(`${t}_${a}`);a++){i.getElement(e,o);for(let c=0;c<4;c++)n?r[a*4+c]=H.encodeNormalizedInt(o[c],n):r[a*4+c]=o[c]}return r}function Ut(s,e,t,r,n){let i;const o=[0,0,0,0];for(let a=0;i=s.getAttribute(`${t}_${a}`);a++){for(let c=0;c<4;c++)n?o[c]=H.decodeNormalizedInt(r[a*4+c],n):o[c]=r[a*4+c];i.setElement(e,o)}}function Mn(s,e){let t=0;for(let r=0;r<s.length;r++)e?t+=H.decodeNormalizedInt(s[r],e):t+=s[r];return t}function Qc(s){const e=s.listSemantics().filter(n=>n.startsWith("WEIGHTS_")).map(n=>s.getAttribute(n)),t=e.map(n=>n.getNormalized()),r=e.map(n=>n.getComponentType());return new Set(t).size===1&&new Set(r).size===1}const xe="quantize",Zc=[Int8Array,Int16Array,Int32Array],{TRANSLATION:$c,ROTATION:eA,SCALE:tA,WEIGHTS:sA}=rt.TargetPath,nA=[$c,eA,tA],St={pattern:/.*/,quantizationVolume:"mesh",quantizePosition:14,quantizeNormal:10,quantizeTexcoord:12,quantizeColor:8,quantizeWeight:8,quantizeGeneric:12,normalizeWeights:!0,cleanup:!0};function Rn(s=St){const e=ct(St,je({patternTargets:s.pattern||St.pattern},s));return at(xe,async t=>{const r=t.getLogger(),n=t.getRoot();let i;e.quantizationVolume==="scene"&&(i=Sn(fA(n.listMeshes().map(bn))));for(const a of t.getRoot().listMeshes()){e.quantizationVolume==="mesh"&&(i=Sn(bn(a))),i&&e.pattern.test("POSITION")&&(rA(t,a,i),aA(a,1/i.scale));for(const c of a.listPrimitives()){const u=de(c,z.RENDER),f=de(c,z.UPLOAD);u<f/2&&Pt(c),Nn(t,c,i,e);for(const B of c.listTargets())Nn(t,B,i,e)}}n.listMeshes().flatMap(a=>a.listPrimitives()).some(Lr)&&t.createExtension(Vs).setRequired(!0),e.cleanup&&await t.transform(jt({propertyTypes:[D.ACCESSOR,D.SKIN,D.MATERIAL],keepAttributes:!0,keepIndices:!0,keepLeaves:!0,keepSolidTextures:!0}),kt({propertyTypes:[D.ACCESSOR,D.MATERIAL,D.SKIN],keepUniqueNames:!0})),r.debug(`${xe}: Complete.`)})}function Nn(s,e,t,r){const n=e instanceof Xn,i=s.getLogger();for(const o of e.listSemantics()){if(!n&&!r.pattern.test(o)||n&&!r.patternTargets.test(o))continue;const a=e.getAttribute(o),{bits:c,ctor:u}=AA(o,a,i,r);if(!u)continue;if(c<8||c>16)throw new Error(`${xe}: Requires bits = 8–16.`);if(a.getComponentSize()<=c/8)continue;const f=a.clone();if(o==="POSITION"){const B=t.scale,A=[];e instanceof j?cc(A,Xt(t)):Ac(A,[1/B,1/B,1/B]);for(let l=0,h=[0,0,0],g=f.getCount();l<g;l++)f.getElement(l,h),f.setElement(l,Bc(h,h,A))}cA(f,u,c),e.setAttribute(o,f)}if(r.normalizeWeights&&e.getAttribute("WEIGHTS_0")&&zc(e,1/0),e instanceof j&&e.getIndices()&&e.listAttributes().length&&e.listAttributes()[0].getCount()<65535){const o=e.getIndices();o.setArray(new Uint16Array(o.getArray()))}}function Sn(s){const{min:e,max:t}=s,r=Math.max((t[0]-e[0])/2,(t[1]-e[1])/2,(t[2]-e[2])/2);return{offset:[e[0]+(t[0]-e[0])/2,e[1]+(t[1]-e[1])/2,e[2]+(t[2]-e[2])/2],scale:r}}function rA(s,e,t){const r=Xt(t);for(const n of e.listParents()){if(!(n instanceof Fs))continue;const i=n.listParents().filter(A=>A instanceof rt),o=i.some(A=>nA.includes(A.getTargetPath())),a=n.listChildren().length>0,c=n.getSkin();if(c){n.setSkin(iA(c,t));continue}const u=n.getExtension("EXT_mesh_gpu_instancing");if(u){n.setExtension("EXT_mesh_gpu_instancing",oA(u,t));continue}let f;a||o?(f=s.createNode("").setMesh(e),n.addChild(f).setMesh(null),i.filter(A=>A.getTargetPath()===sA).forEach(A=>A.setTargetNode(f))):f=n;const B=f.getMatrix();js(B,B,r),f.setMatrix(B)}}function iA(s,e){s=s.clone();const t=Xt(e),r=s.getInverseBindMatrices().clone(),n=[];for(let i=0,o=r.getCount();i<o;i++)r.getElement(i,n),js(n,n,t),r.setElement(i,n);return s.setInverseBindMatrices(r)}function oA(s,e){var t,r,n;if(!s.getAttribute("TRANSLATION")&&!s.getAttribute("ROTATION")&&!s.getAttribute("SCALE"))return s;s=s.clone();const i=(t=s.getAttribute("TRANSLATION"))==null?void 0:t.clone(),o=(r=s.getAttribute("ROTATION"))==null?void 0:r.clone(),a=(n=s.getAttribute("SCALE"))==null?void 0:n.clone(),c=i||o||a,u=[0,0,0],f=[0,0,0,1],B=[1,1,1],A=[0,0,0],l=[0,0,0,1],h=[1,1,1],g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],d=Xt(e);for(let p=0,y=c.getCount();p<y;p++)H.compose(i?i.getElement(p,A):u,o?o.getElement(p,l):f,a?a.getElement(p,h):B,g),js(g,g,d),H.decompose(g,A,l,h),i&&i.setElement(p,A),o&&o.setElement(p,l),a&&a.setElement(p,h);return i&&s.setAttribute("TRANSLATION",i),o&&s.setAttribute("ROTATION",o),a&&s.setAttribute("SCALE",a),s}function aA(s,e){for(const t of s.listPrimitives()){let r=t.getMaterial();if(!r)continue;let n=r.getExtension("KHR_materials_volume");!n||n.getThicknessFactor()<=0||(n=n.clone().setThicknessFactor(n.getThicknessFactor()*e),r=r.clone().setExtension("KHR_materials_volume",n),t.setMaterial(r))}}function cA(s,e,t){const r=new e(s.getArray().length),n=Zc.includes(e)?1:0,i=t-n,o=e.BYTES_PER_ELEMENT*8-n,a=Math.pow(2,i)-1,c=o-i,u=2*i-o,f=[n>0?-1:0,1];for(let B=0,A=0,l=[];B<s.getCount();B++){s.getElement(B,l);for(let h=0;h<l.length;h++){let g=lA(l[h],f);g=Math.round(Math.abs(g)*a),g=g<<c|g>>u,r[A++]=g*Math.sign(l[h])}}s.setArray(r).setNormalized(!0).setSparse(!1)}function AA(s,e,t,r){const n=e.getMinNormalized([]),i=e.getMaxNormalized([]);let o,a;if(s==="POSITION")o=r.quantizePosition,a=o<=8?Int8Array:Int16Array;else if(s==="NORMAL"||s==="TANGENT")o=r.quantizeNormal,a=o<=8?Int8Array:Int16Array;else if(s.startsWith("COLOR_"))o=r.quantizeColor,a=o<=8?Uint8Array:Uint16Array;else if(s.startsWith("TEXCOORD_")){if(n.some(c=>c<0)||i.some(c=>c>1))return t.warn(`${xe}: Skipping ${s}; out of [0,1] range.`),{bits:-1};o=r.quantizeTexcoord,a=o<=8?Uint8Array:Uint16Array}else{if(s.startsWith("JOINTS_"))return o=Math.max(...e.getMax([]))<=255?8:16,a=o<=8?Uint8Array:Uint16Array,e.getComponentSize()>o/8&&e.setArray(new a(e.getArray())),{bits:-1};if(s.startsWith("WEIGHTS_")){if(n.some(c=>c<0)||i.some(c=>c>1))return t.warn(`${xe}: Skipping ${s}; out of [0,1] range.`),{bits:-1};o=r.quantizeWeight,a=o<=8?Uint8Array:Uint16Array}else if(s.startsWith("_")){if(n.some(c=>c<-1)||i.some(c=>c>1))return t.warn(`${xe}: Skipping ${s}; out of [-1,1] range.`),{bits:-1};o=r.quantizeGeneric,a=n.some(c=>c<0)?a=o<=8?Int8Array:Int16Array:a=o<=8?Uint8Array:Uint16Array}else throw new Error(`${xe}: Unexpected semantic, "${s}".`)}return{bits:o,ctor:a}}function bn(s){const e=[],t=[];for(const n of s.listPrimitives()){const i=n.getAttribute("POSITION");i&&e.push(i);for(const o of n.listTargets()){const a=o.getAttribute("POSITION");a&&t.push(a)}}if(e.length===0)throw new Error(`${xe}: Missing "POSITION" attribute.`);const r=Ln(e,3);if(t.length>0){const{min:n,max:i}=Ln(t,3);hs(r.min,r.min,hs(n,In(n,n,2),[0,0,0])),ps(r.max,r.max,ps(i,In(i,i,2),[0,0,0]))}return r}function uA(s,e){const t=e.getComponentSize();if(s==="POSITION"||s==="NORMAL"||s==="TANGENT")return t<4;if(s.startsWith("TEXCOORD_")){const r=e.getComponentType(),n=e.getNormalized();return t<4&&!(n&&r===S.ComponentType.UNSIGNED_BYTE)&&!(n&&r===S.ComponentType.UNSIGNED_SHORT)}return!1}function Lr(s){for(const e of s.listSemantics()){const t=s.getAttribute("POSITION");if(uA(e,t))return!0}return s.propertyType===D.PRIMITIVE?s.listTargets().some(Lr):!1}function Ln(s,e){const t=new Array(e).fill(1/0),r=new Array(e).fill(-1/0),n=[],i=[];for(const o of s){o.getMinNormalized(n),o.getMaxNormalized(i);for(let a=0;a<e;a++)t[a]=Math.min(t[a],n[a]),r[a]=Math.max(r[a],i[a])}return{min:t,max:r}}function fA(s){const e=s[0];for(const t of s)hs(e.min,e.min,t.min),ps(e.max,e.max,t.max);return e}function Xt(s){return uc([],[0,0,0,1],s.offset,[s.scale,s.scale,s.scale])}function lA(s,e){return Math.min(Math.max(s,e[0]),e[1])}je({level:"high"},St);const BA="unweld";function hA(s,e=new Map){const t=s.getIndices();if(!t)return;const r=s.getGraph(),n=fe.fromGraph(r),i=n.getLogger(),o=s.getAttribute("POSITION").getCount();for(const c of s.listAttributes())s.swap(c,wn(n,c,t,e)),c.listParents().length===1&&c.dispose();for(const c of s.listTargets())for(const u of c.listAttributes())c.swap(u,wn(n,u,t,e)),u.listParents().length===1&&u.dispose();const a=s.getAttribute("POSITION").getCount();i.debug(`${BA}: ${Vt(o,a)} vertices.`),s.setIndices(null),t.listParents().length===1&&t.dispose()}function wn(s,e,t,r){if(r.has(e)&&r.get(e).has(t))return r.get(e).get(t);const n=e.getArray(),i=n.constructor,o=new i(t.getCount()*e.getElementSize()),a=t.getArray(),c=e.getElementSize();for(let f=0,B=t.getCount();f<B;f++)for(let A=0;A<c;A++)o[f*c+A]=n[a[f]*c+A];r.has(e)||r.set(e,new Map);const u=nt(s,e).setArray(o);return r.get(e).set(t,u),u}var On;(function(s){s[s.STEP=0]="STEP",s[s.LERP=1]="LERP",s[s.SLERP=2]="SLERP"})(On||(On={}));const pA=1e-6;function gA(s,e,t,r=1e-4){const n=e.length/s.length,i=new Array(n).fill(0),o=new Array(n).fill(0),a=new Array(n).fill(0),c=new Array(n).fill(0),u=s.length-1;let f=1;for(let B=1;B<u;++B){const A=s[f-1],l=s[B],h=s[B+1],g=(l-A)/(h-A);let d=!1;if(l!==h&&(B!==1||l!==s[0]))if(ft(e,f-1,c),ft(e,B,o),ft(e,B+1,a),t==="slerp"){const p=EA(i,c,a,g),y=Hn(c,o)+Hn(o,a);d=!Rt(o,p,r)||y+Number.EPSILON>=Math.PI}else if(t==="lerp"){const p=CA(i,c,a,g);d=!Rt(o,p,r)}else t==="step"&&(d=!Rt(o,c)||!Rt(o,a));d&&(B!==f&&(s[f]=s[B],Gn(e,f,ft(e,B,i))),f++)}return u>0&&(s[f]=s[u],Gn(e,f,ft(e,u,i)),f++),f}function ft(s,e,t){for(let r=0,n=t.length;r<n;r++)t[r]=s[e*n+r];return t}function Gn(s,e,t){for(let r=0,n=t.length;r<n;r++)s[e*n+r]=t[r]}function Rt(s,e,t=0){if(s.length!==e.length)return!1;for(let r=0;r<s.length;r++)if(Math.abs(s[r]-e[r])>t)return!1;return!0}function dA(s,e,t){return s*(1-t)+e*t}function CA(s,e,t,r){for(let n=0;n<e.length;n++)s[n]=dA(e[n],t[n],r);return s}function EA(s,e,t,r){let n=e[0],i=e[1],o=e[2],a=e[3],c=t[0],u=t[1],f=t[2],B=t[3],A,l,h,g,d;return l=n*c+i*u+o*f+a*B,l<0&&(l=-l,c=-c,u=-u,f=-f,B=-B),1-l>pA?(A=Math.acos(l),h=Math.sin(A),g=Math.sin((1-r)*A)/h,d=Math.sin(r*A)/h):(g=1-r,d=r),s[0]=g*n+d*c,s[1]=g*i+d*u,s[2]=g*o+d*f,s[3]=g*a+d*B,s}function Hn(s,e){const t=DA(s,e);return Math.acos(2*t*t-1)}function DA(s,e){return s[0]*e[0]+s[1]*e[1]+s[2]*e[2]+s[3]*e[3]}Promise.resolve();const Ve="simplify",{POINTS:wr,LINES:IA,LINE_STRIP:TA,LINE_LOOP:mA,TRIANGLES:xA,TRIANGLE_STRIP:Or,TRIANGLE_FAN:Gr}=j.Mode,Hr={ratio:0,error:1e-4,lockBorder:!1,cleanup:!0};function yA(s){const e=ct(Hr,s),t=e.simplifier;if(!t)throw new Error(`${Ve}: simplifier dependency required — install "meshoptimizer".`);return at(Ve,async r=>{const n=r.getLogger();await t.ready,await r.transform(Sr({overwrite:!1,cleanup:e.cleanup}));let i=0;for(const o of r.getRoot().listMeshes()){for(const a of o.listPrimitives()){const c=a.getMode();c===xA||c===Or||c===Gr||a.getMode()===wr&&t.simplifyPoints?(Pn(a,e),de(a,z.RENDER)===0&&a.dispose()):i++}o.listPrimitives().length===0&&o.dispose()}i>0&&n.warn(`${Ve}: Skipping simplification of ${i} primitives: Unsupported draw mode.`),e.cleanup&&await r.transform(jt({propertyTypes:[D.ACCESSOR,D.NODE],keepAttributes:!0,keepIndices:!0,keepLeaves:!1}),kt({propertyTypes:[D.ACCESSOR]})),n.debug(`${Ve}: Complete.`)})}function Pn(s,e){const t=je({},Hr,e),r=t.simplifier,n=s.getGraph(),i=fe.fromGraph(n),o=i.getLogger();switch(s.getMode()){case wr:return FA(i,s,t);case IA:case TA:case mA:return o.warn(`${Ve}: Skipping primitive simplification: Unsupported draw mode.`),s;case Or:case Gr:Wc(s);break}const a=de(s,z.UPLOAD),c=de(s,z.RENDER);c<a/2&&Pt(s);const u=s.getAttribute("POSITION"),f=s.getIndices();let B=u.getArray(),A=f.getArray();B instanceof Float32Array||(B=Es(B,u.getComponentType(),u.getNormalized())),A instanceof Uint32Array||(A=new Uint32Array(A));const l=Math.floor(t.ratio*c/3)*3,h=t.lockBorder?["LockBorder"]:[],[g,d]=r.simplify(A,B,3,l,t.error,h);s.setIndices(nt(i,f).setArray(g)),f.listParents().length===1&&f.dispose(),Pt(s);const p=de(s,z.UPLOAD);return p<=65534&&s.getIndices().setArray(new Uint16Array(s.getIndices().getArray())),o.debug(`${Ve}: ${Vt(a,p)} vertices, error: ${d.toFixed(4)}.`),s}function FA(s,e,t){const r=t.simplifier,n=s.getLogger();e.getIndices()&&hA(e);const o=e.getAttribute("POSITION"),a=e.getAttribute("COLOR_0"),c=o.getCount();let u=o.getArray(),f=a?a.getArray():void 0;const B=a?a.getComponentSize():void 0;u instanceof Float32Array||(u=Es(u,o.getComponentType(),o.getNormalized())),f&&!(f instanceof Float32Array)&&(f=Es(f,o.getComponentType(),o.getNormalized())),r.useExperimentalFeatures=!0;const A=Math.floor(t.ratio*c),l=r.simplifyPoints(u,3,A,f,B);r.useExperimentalFeatures=!1;const[h,g]=r.compactMesh(l);n.debug(`${Ve}: ${Vt(o.getCount(),g)} vertices.`);for(const d of ks(e)){const p=nt(s,d);ds(d,null,h,p,g),sc(e,d,p),d.listParents().length===1&&d.dispose()}return e}var Ds;(function(s){s.LANCZOS3="lanczos3",s.LANCZOS2="lanczos2"})(Ds||(Ds={}));Ds.LANCZOS3;(function(){var s="B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gVUUUUUB9gLUUUUB9gIUUUEU9gD99UE99I8ayDILEVLEVLOOOOORRVBWWBEdddLVE9wEIIVIEBEOWEUEC+g/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949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J9fnAEZ+XJJJBHBAEAEYDBCNFbDBABSKAEAICfEgC+CUFbDBADCfff+D94gCJJJ/4Iv++HBKABK+gEBDNDNAECJE9IMBABjBBBUnHBDNAECfE9PMBAEC+BUFHEXDKABjBBBUnHBAECPDAECPD6eC+C9+FHEXEKAEC+BU9KMBABjBBJXnHBDNAEC+b9+9NMBAEC/mBFHEXEKABjBBJXnHBAEC+299AEC+2990eC/MEFHEKABAEClTCJJJ/8IF++nKK+eDDBCJWK+EDB4+H9W9n94+p+Gw+J9o+YE9pBBBBBBEBBBDBBBEBBBDBBBBBBBDBBBBBBBEBBBBBBB+L29Hz/69+9Kz/n/76z/RG97z/Z/O9Xz8j/b85z/+/U9Yz/B/K9hz+2/z9dz9E+L9Mz59a8kz+R/t3z+a+Zyz79ohz/J4++8++y+d9v8+BBBB9S+49+z8r+Hbz9m9m/m8+l/Z/O8+/8+pg89Q/X+j878r+Hq8++m+b/E87BBBBBBJzBBJzBBJz+e/v/n8++y+dSz9I/h/68+XD/r8+/H0838+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC+EQKXEBBBDBBBAwBB",e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var t,r=WebAssembly.instantiate(n(s),{}).then(function(A){t=A.instance,t.exports.__wasm_call_ctors(),t.exports.meshopt_encodeVertexVersion(0),t.exports.meshopt_encodeIndexVersion(1)});function n(A){for(var l=new Uint8Array(A.length),h=0;h<A.length;++h){var g=A.charCodeAt(h);l[h]=g>96?g-71:g>64?g-65:g>47?g+4:g>46?63:62}for(var d=0,h=0;h<A.length;++h)l[d++]=l[h]<60?e[l[h]]:(l[h]-60)*64+l[++h];return l.buffer.slice(0,d)}function i(A){if(!A)throw new Error("Assertion failed")}function o(A){return new Uint8Array(A.buffer,A.byteOffset,A.byteLength)}function a(A,l,h){var g=t.exports.sbrk,d=g(A.length*4),p=g(l*4),y=new Uint8Array(t.exports.memory.buffer),T=o(A);y.set(T,d),h&&h(d,d,A.length,l);var I=t.exports.meshopt_optimizeVertexFetchRemap(p,d,A.length,l);y=new Uint8Array(t.exports.memory.buffer);var E=new Uint32Array(l);new Uint8Array(E.buffer).set(y.subarray(p,p+l*4)),T.set(y.subarray(d,d+A.length*4)),g(d-g(0));for(var m=0;m<A.length;++m)A[m]=E[A[m]];return[E,I]}function c(A,l,h,g,d){var p=t.exports.sbrk,y=p(l),T=p(g*d),I=new Uint8Array(t.exports.memory.buffer);I.set(o(h),T);var E=A(y,l,T,g,d),m=new Uint8Array(E);return m.set(I.subarray(y,y+E)),p(y-p(0)),m}function u(A){for(var l=0,h=0;h<A.length;++h){var g=A[h];l=l<g?g:l}return l}function f(A,l){if(i(l==2||l==4),l==4)return new Uint32Array(A.buffer,A.byteOffset,A.byteLength/4);var h=new Uint16Array(A.buffer,A.byteOffset,A.byteLength/2);return new Uint32Array(h)}function B(A,l,h,g,d,p){var y=t.exports.sbrk,T=y(h*g),I=y(h*p),E=new Uint8Array(t.exports.memory.buffer);E.set(o(l),I),A(T,h,g,d,I);var m=new Uint8Array(h*g);return m.set(E.subarray(T,T+h*g)),y(T-y(0)),m}return{ready:r,supported:!0,reorderMesh:function(A,l,h){var g=l?h?t.exports.meshopt_optimizeVertexCacheStrip:t.exports.meshopt_optimizeVertexCache:void 0;return a(A,u(A)+1,g)},encodeVertexBuffer:function(A,l,h){i(h>0&&h<=256),i(h%4==0);var g=t.exports.meshopt_encodeVertexBufferBound(l,h);return c(t.exports.meshopt_encodeVertexBuffer,g,A,l,h)},encodeIndexBuffer:function(A,l,h){i(h==2||h==4),i(l%3==0);var g=f(A,h),d=t.exports.meshopt_encodeIndexBufferBound(l,u(g)+1);return c(t.exports.meshopt_encodeIndexBuffer,d,g,l,4)},encodeIndexSequence:function(A,l,h){i(h==2||h==4);var g=f(A,h),d=t.exports.meshopt_encodeIndexSequenceBound(l,u(g)+1);return c(t.exports.meshopt_encodeIndexSequence,d,g,l,4)},encodeGltfBuffer:function(A,l,h,g){var d={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return i(d[g]),d[g](A,l,h)},encodeFilterOct:function(A,l,h,g){return i(h==4||h==8),i(g>=1&&g<=16),B(t.exports.meshopt_encodeFilterOct,A,l,h,g,16)},encodeFilterQuat:function(A,l,h,g){return i(h==8),i(g>=4&&g<=16),B(t.exports.meshopt_encodeFilterQuat,A,l,h,g,16)},encodeFilterExp:function(A,l,h,g){return i(h>0&&h%4==0),i(g>=1&&g<=24),B(t.exports.meshopt_encodeFilterExp,A,l,h,g,h)}}})();(function(){var s="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBEy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBDe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBIl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBLk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBOL79iv9rBRQ+p8yQDBK/3SEZU8jJJJJBCJ/EB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rADZ1JJJBHWCJ/ABAD9uHOAICEFHLDNADtMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAQAE9PMEAdAEAQ9rAQAdFAE6eGKCSFGOCL4CIFCD4HXDNDNDNDNAOC9wgGMtMBCBHpCEHSAWCJDFHZALHhINARAh9rAX6MIDNARAhAXFGL9rCk6MBCZHOINAWCJ/CBFAOGIFGOC9wFHoDNDNDNDNDNAhAIC9wFGaCO4FrBBAaCI4COg4CIgpLBEDIBKAo9CB83IBAoCWF9CB83IBXIKAoALrBLALrBBGaCO4GcAcCIsGce86BBAOCgFALCLFAcFGorBBAaCL4CIgGcAcCIsGce86BBAOCvFAoAcFGorBBAaCD4CIgGcAcCIsGce86BBAOC7FAoAcFGorBBAaCIgGaAaCIsGae86BBAOCTFAoAaFGarBBALrBEGoCO4GcAcCIsGce86BBAOC91FAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOC4FAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOC93FAaAcFGarBBAoCIgGoAoCIsGoe86BBAOC94FAaAoFGarBBALrBDGoCO4GcAcCIsGce86BBAOC95FAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOC96FAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOC97FAaAcFGarBBAoCIgGoAoCIsGoe86BBAOC98FAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOC99FAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOC9+FAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCUFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAoALrBWALrBBGaCL4GcAcCSsGce86BBAOCgFALCWFAcFGorBBAaCSgGaAaCSsGae86BBAOCvFAoAaFGorBBALrBEGaCL4GcAcCSsGce86BBAOC7FAoAcFGorBBAaCSgGaAaCSsGae86BBAOCTFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOC91FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC4FAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOC93FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC94FAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOC95FAoAcFGorBBAaCSgGaAaCSsG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BAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),r=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n=s;WebAssembly.validate(t)&&(n=e);var i,o=WebAssembly.instantiate(a(n),{}).then(function(B){i=B.instance,i.exports.__wasm_call_ctors()});function a(B){for(var A=new Uint8Array(B.length),l=0;l<B.length;++l){var h=B.charCodeAt(l);A[l]=h>96?h-71:h>64?h-65:h>47?h+4:h>46?63:62}for(var g=0,l=0;l<B.length;++l)A[g++]=A[l]<60?r[A[l]]:(A[l]-60)*64+A[++l];return A.buffer.slice(0,g)}function c(B,A,l,h,g,d){var p=i.exports.sbrk,y=l+3&-4,T=p(y*h),I=p(g.length),E=new Uint8Array(i.exports.memory.buffer);E.set(g,I);var m=B(T,l,h,I,g.length);if(m==0&&d&&d(T,y,h),A.set(E.subarray(T,T+l*h)),p(T-p(0)),m!=0)throw new Error("Malformed buffer data: "+m)}var u={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:o,supported:!0,decodeVertexBuffer:function(B,A,l,h,g){c(i.exports.meshopt_decodeVertexBuffer,B,A,l,h,i.exports[u[g]])},decodeIndexBuffer:function(B,A,l,h){c(i.exports.meshopt_decodeIndexBuffer,B,A,l,h)},decodeIndexSequence:function(B,A,l,h){c(i.exports.meshopt_decodeIndexSequence,B,A,l,h)},decodeGltfBuffer:function(B,A,l,h,g,d){c(i.exports[f[g]],B,A,l,h,i.exports[u[d]])}}})();var MA=function(){var s="B9h79tEBBBECd9gEUEU9gEUB9gBB9gQUUUUUUU99UUEU9gVUUUUUB9gLUUUUE999gIUUUE999gLUUUUEU9gIUUUEUIMXDILVORBWWBEWLVE9wEIIVIEBEOWEUECJ/JEKR7OO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BBZ9tw79o9v9wT9f79p9t9w29p9m95BEx9tw79o9v9wT9f79p9t9w29p9m959T9j9h2wBLA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBVL79iv9rBOdWEBCEKDdQQ+stXDBK/48yIkUp99hU8jJJJJBCJ/BB9rGQ8kJJJJBAQCkFCBC/kBZ1JJJB8aCUALCDTGKALCffffI0eGXCBYD/s1JJBhJJJJBBHMAQCkFAQYD94GpCDTFAMbDBAQAMbDWAQApCEFbD94AXCBYD/s1JJBhJJJJBBHSAQCkFAQYD94GpCDTFASbDBAQASbDXAQApCEFbD94CUADCITADCffffE0eCBYD/s1JJBhJJJJBBHZAQCkFAQYD94GpCDTFAZbDBAQAZbDZAQApCEFbD94AQCWFAEADALCBZ+CJJJBAXCBYD/s1JJBhJJJJBBHhAQCkFAQYD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FGdAQAdiDBGKAKAQ9deuDBAICLFGICX9HMBKAEARFHEAWCEFGWAD9HMBKKALiDBALiDZGK+TjBBBB+XGQALiDLALiDcGX+TGMAMAQ9deGQALiDWALiDkGM+TGpApAQ9deHpDNABtMBADtMBjBBBBjBBJzAp+VApjBBBB9beHQINABAQABiDBAK+TnuDBABCLFGIAQAIiDBAX+TnuDBABCWFGIAQAIiDBAM+TnuDBABCXFHBADCUFGDMBKKApK+qDIDUI99DUCBHI8jJJJJBCA9rGLCZFCWFCBYD11JJBbDBALCB8pDJ1JJB83IZALCWFCBYDn1JJBbDBALCB8pD+M1JJB83IBDNDNAEMBjBBJfHVjBBJfHOjBBJfHRXEKADCD4CDTHWINCBHDINALCZFADFGdABADFiDBGOAdiDBGRARAO9eeuDBALADFGdAOAdiDBGRARAO9deuDBADCLFGDCX9HMBKABAWFHBAICEFGIAE9HMBKALiDWALiDk+THRALiDLALiDc+THOALiDBALiDZ+THVKAVjBBBB+XGVAOAOAV9deGOARARAO9deK9dEEUABCfEAICDTZ1JJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/01JJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/01JJBFGDbD/01JJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKK6EIUCBHIDNADtMBDNINABrBBGLAErBBGV9HMEAECEFHEABCEFHBADCUFGDMBXDKKALAV9rHIKAIKK+CEDBCJWK9pffUUffUUffUUffUfffUfffUfBBBBBBBBEEEBEEBEBBEEEBEBBBBBEBEBBBBBEBBBDBBBBBBBBBBBBBBBEEEEEBEBBBBBEBBBBBEEBBBBBBC/sWKXEBBBDBBBJ9kBB",e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var t,r=WebAssembly.instantiate(n(s),{}).then(function(A){t=A.instance,t.exports.__wasm_call_ctors()});function n(A){for(var l=new Uint8Array(A.length),h=0;h<A.length;++h){var g=A.charCodeAt(h);l[h]=g>96?g-71:g>64?g-65:g>47?g+4:g>46?63:62}for(var d=0,h=0;h<A.length;++h)l[d++]=l[h]<60?e[l[h]]:(l[h]-60)*64+l[++h];return l.buffer.slice(0,d)}function i(A){if(!A)throw new Error("Assertion failed")}function o(A){return new Uint8Array(A.buffer,A.byteOffset,A.byteLength)}function a(A,l){var h=t.exports.sbrk,g=h(A.length*4),d=h(l*4),p=new Uint8Array(t.exports.memory.buffer),y=o(A);p.set(y,g);var T=t.exports.meshopt_optimizeVertexFetchRemap(d,g,A.length,l);p=new Uint8Array(t.exports.memory.buffer);var I=new Uint32Array(l);new Uint8Array(I.buffer).set(p.subarray(d,d+l*4)),y.set(p.subarray(g,g+A.length*4)),h(g-h(0));for(var E=0;E<A.length;++E)A[E]=I[A[E]];return[I,T]}function c(A){for(var l=0,h=0;h<A.length;++h){var g=A[h];l=l<g?g:l}return l}function u(A,l,h,g,d,p,y,T,I){var E=t.exports.sbrk,m=E(4),C=E(h*4),x=E(d*p),F=E(h*4),M=new Uint8Array(t.exports.memory.buffer);M.set(o(g),x),M.set(o(l),F);var R=A(C,F,h,x,d,p,y,T,I,m);M=new Uint8Array(t.exports.memory.buffer);var b=new Uint32Array(R);o(b).set(M.subarray(C,C+R*4));var N=new Float32Array(1);return o(N).set(M.subarray(m,m+4)),E(m-E(0)),[b,N[0]]}function f(A,l,h,g){var d=t.exports.sbrk,p=d(h*g),y=new Uint8Array(t.exports.memory.buffer);y.set(o(l),p);var T=A(p,h,g);return d(p-d(0)),T}var B={LockBorder:1};return{ready:r,supported:!0,compactMesh:function(A){i(A instanceof Uint32Array||A instanceof Int32Array||A instanceof Uint16Array||A instanceof Int16Array),i(A.length%3==0);var l=A.BYTES_PER_ELEMENT==4?A:new Uint32Array(A);return a(l,c(A)+1)},simplify:function(A,l,h,g,d,p){i(A instanceof Uint32Array||A instanceof Int32Array||A instanceof Uint16Array||A instanceof Int16Array),i(A.length%3==0),i(l instanceof Float32Array),i(l.length%h==0),i(h>=3),i(g%3==0);for(var y=0,T=0;T<(p?p.length:0);++T)y|=B[p[T]];var I=A.BYTES_PER_ELEMENT==4?A:new Uint32Array(A),E=u(t.exports.meshopt_simplify,I,A.length,l,l.length,h*4,g,d,y);return E[0]=A instanceof Uint32Array?E[0]:new A.constructor(E[0]),E},getScale:function(A,l){return i(A instanceof Float32Array),i(A.length%l==0),f(t.exports.meshopt_simplifyScale,A,A.length,l*4)}}}();const RA=new Ts,Is=new ji;Is.registerExtensions([Vs]);const NA=()=>{const s=_r.useRef(null);async function e(o){const a=await RA.parseAsync(o,{binary:!0});s.current=await Is.readBinary(new Uint8Array(a))}async function t(){if(!s.current)return;const o=await s.current.transform(Yc(),Rn(),Sr(),yA({simplifier:MA,ratio:.1,error:1e-4}));s.current=o}async function r(){if(!s.current)return;const o=await s.current.transform(kt({}));s.current=o}async function n(){if(!s.current)return;const o=await s.current.transform(Rn({}));s.current=o}async function i(){if(s.current)return console.log(s.current),await Is.writeBinary(s.current)}return{load:e,getModel:i,simplifyOptimization:t,dedupOptimization:r,quantizeOptimization:n}};exports.useOptimizeModel=NA;
|