@liveroom-tech/react-immersive 5.1.0 → 5.2.0

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.
Files changed (44) hide show
  1. package/README.md +486 -57
  2. package/dist/binding-builder.css +1 -1
  3. package/dist/binding-builder.js +17 -13
  4. package/dist/binding-builder.mjs +1 -1
  5. package/dist/chunk-4NLJSD3S.mjs +1 -0
  6. package/dist/chunk-B7REIGDG.mjs +1 -0
  7. package/dist/{chunk-WN6GMMHF.mjs → chunk-HYFJ5DYJ.mjs} +1 -1
  8. package/dist/chunk-QC3NT76G.mjs +3 -0
  9. package/dist/chunk-T3M3BQ7H.mjs +32 -0
  10. package/dist/chunk-ZPK67UG7.mjs +1 -0
  11. package/dist/hosted.css +1 -1
  12. package/dist/hosted.d.mts +4 -3
  13. package/dist/hosted.d.ts +4 -3
  14. package/dist/hosted.js +16 -12
  15. package/dist/hosted.mjs +1 -1
  16. package/dist/index.css +1 -1
  17. package/dist/index.d.mts +39 -8
  18. package/dist/index.d.ts +39 -8
  19. package/dist/index.js +14 -10
  20. package/dist/index.mjs +1 -1
  21. package/dist/materialVariants-DnZe9eMC.d.mts +309 -0
  22. package/dist/materialVariants-DnZe9eMC.d.ts +309 -0
  23. package/dist/modelInfo-BYebMPdZ.d.mts +43 -0
  24. package/dist/modelInfo-XfUQO7C_.d.ts +43 -0
  25. package/dist/{ModelViewer-Bj-KjiDL.d.mts → modelViewerProps-CIZ2R_Fv.d.ts} +82 -10
  26. package/dist/{ModelViewer-BkQ73y6N.d.ts → modelViewerProps-DoRiTZMn.d.mts} +82 -10
  27. package/dist/{objectCatalog-BIeXURoq.d.ts → rendererBackend-QwMzISTn.d.mts} +32 -4
  28. package/dist/{objectCatalog-BIeXURoq.d.mts → rendererBackend-QwMzISTn.d.ts} +32 -4
  29. package/dist/simple-model-viewer.css +1 -1
  30. package/dist/simple-model-viewer.d.mts +32 -4
  31. package/dist/simple-model-viewer.d.ts +32 -4
  32. package/dist/simple-model-viewer.js +3 -3
  33. package/dist/simple-model-viewer.mjs +1 -1
  34. package/dist/utils.d.mts +5 -4
  35. package/dist/utils.d.ts +5 -4
  36. package/dist/utils.js +1 -1
  37. package/dist/utils.mjs +1 -1
  38. package/package.json +2 -1
  39. package/dist/chunk-32WCLPTZ.mjs +0 -1
  40. package/dist/chunk-CSGNL4XU.mjs +0 -3
  41. package/dist/chunk-F2ILTIPG.mjs +0 -28
  42. package/dist/chunk-V6GALFL5.mjs +0 -1
  43. package/dist/modelInfo-DnkmTGMd.d.mts +0 -23
  44. package/dist/modelInfo-DnkmTGMd.d.ts +0 -23
@@ -1 +0,0 @@
1
- import{Box3 as de,BufferAttribute as fe,Mesh as me}from"three";import{acceleratedRaycast as Me,computeBoundsTree as he,disposeBoundsTree as be,MeshBVH as ge}from"three-mesh-bvh";var O=!1,m=new WeakMap,M=new WeakMap;function ye(){O||(me.prototype.raycast=Me,O=!0)}function ve(e){let t=new Set;return e.traverse(r=>{let n=r.geometry;!n||!n.attributes?.position||t.add(n)}),[...t]}function U(e){let t=0;for(let r of e){let n=r.index?r.index.count:r.attributes.position.count;t+=n/3}return t}var F=12e6;function Rt(e){return xe(e)>F}function xe(e){let t=new Set;return e.traverse(r=>{let n=r.geometry;n?.attributes?.position&&t.add(n)}),U([...t])}function Se(e,t){return new Promise((r,n)=>{let s=l=>{let p=l.data;if(!p||!p.error&&!p.serialized)return;if(e.removeEventListener("message",s),e.removeEventListener("error",a),p.error){n(new Error(String(p.error)));return}let{serialized:d}=p,k=ge.deserialize(d,t,{setIndex:!1});d.index&&(t.index?t.index.array=d.index:t.setIndex(new fe(d.index,1,!1))),t.boundingBox=k.getBoundingBox(new de),r(k)},a=l=>{e.removeEventListener("message",s),e.removeEventListener("error",a),n(new Error(l.message||"BVH worker error"))};e.addEventListener("message",s),e.addEventListener("error",a);let i=t.index?t.index.array.slice():null,o=t.attributes.position.array.slice(),u=[o,...i?[i]:[]].map(l=>l.buffer);e.postMessage({index:i,position:o,options:{groups:[...t.groups]}},u)})}async function we(){if(typeof window>"u"||typeof Worker>"u")return null;try{let{bvhWorkerCode:e}=await import("./bvhWorkerCode-6366A3UC.mjs"),t=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(t),n=new Worker(r);return{worker:n,dispose:()=>{n.terminate(),URL.revokeObjectURL(r)}}}catch{return null}}async function Te(e,t){if(t)try{return await Se(t,e)}catch{}let r=he.call(e);return e.boundsTree=void 0,await new Promise(n=>setTimeout(n,0)),r}async function De(e,t,r){if(e.boundsTree)return;if(t.buildPromise)return t.buildPromise;let n=(async()=>{let s=await r();t.references>0&&!e.boundsTree&&(e.boundsTree=s,t.ownedTree=s)})();return t.buildPromise=n.finally(()=>{t.buildPromise=void 0,t.references===0&&m.delete(e)}),t.buildPromise}async function Lt(e,t){if(t?.aborted)return;let r=M.get(e);if(!r){if(r=ve(e),U(r)>F){M.set(e,[]);return}M.set(e,r);for(let s of r){let a=m.get(s)??{references:0};a.references+=1,m.set(s,a)}}if(r.length===0)return;ye();let n=await we();if(t?.aborted){n?.dispose();return}try{for(let s of r){if(t?.aborted)return;let a=m.get(s);a&&await De(s,a,()=>Te(s,n?.worker))}}finally{n?.dispose()}}function Pt(e){let t=M.get(e);if(t){M.delete(e);for(let r of t){let n=m.get(r);n&&(n.references=Math.max(0,n.references-1),!(n.references>0)&&(n.ownedTree&&r.boundsTree===n.ownedTree&&(be.call(r),r.boundsTree=void 0),n.ownedTree=void 0,n.buildPromise||m.delete(r)))}}}import{strFromU8 as Re,strToU8 as Le,unzip as Pe}from"fflate";var G;function z(e){G=e}function h(e){G?.(e)}var Be=[".glb",".gltf",".obj",".fbx",".usdz",".zip"],Ae=["model/gltf-binary","model/gltf+json","model/vnd.usdz+zip","application/vnd.usdz+zip","application/zip","application/x-zip-compressed"],b=1024*1024,I=128*b,j=1024,_=128*b,N=256*b,W=200,Ee=b,c=new Map,kt=".glb,.gltf,.obj,.fbx,.usdz,.zip,model/gltf-binary,model/gltf+json,model/vnd.usdz+zip,application/vnd.usdz+zip,application/zip";function T(e){let t=e.split(/[?#]/,1)[0].toLowerCase();return t.endsWith(".obj")?"obj":t.endsWith(".fbx")?"fbx":t.endsWith(".usdz")?"usdz":t.endsWith(".gltf")?"gltf":"glb"}function K(e){return c.get(e)??{format:T(e)}}function Ce(e){let t=e.name.toLowerCase();return Be.some(r=>t.endsWith(r))||Ae.includes(e.type)}async function Ot(e){if(!Ce(e))throw new Error("Unsupported model file. Please upload a .glb, .gltf, .obj, .fbx, .usdz, or .zip asset.");let t=e.name.toLowerCase();if(t.endsWith(".usdz")||e.type==="model/vnd.usdz+zip"||e.type==="application/vnd.usdz+zip")return V(e,"usdz");if(t.endsWith(".zip")||ke(e.type))return Oe(e);if(t.endsWith(".gltf")||e.type==="model/gltf+json")return $(e);let r=T(e.name);return r==="gltf"?$(e):V(e,r)}function V(e,t){let r=URL.createObjectURL(e);return c.set(r,{format:t,entryPath:e.name}),{url:r,name:e.name,format:t,cleanup:()=>{h(r),c.delete(r),URL.revokeObjectURL(r)}}}function ke(e){return e==="application/zip"||e==="application/x-zip-compressed"}async function $(e){let t=await e.text(),r=Z(t,e.name);for(let s of X(r))if(!D(s))throw new Error(`${e.name} references external assets. Upload a .zip containing the .gltf file and its dependencies.`);let n=URL.createObjectURL(e);return c.set(n,{format:"gltf",entryPath:e.name}),{url:n,name:e.name,format:"gltf",cleanup:()=>{h(n),c.delete(n),URL.revokeObjectURL(n)}}}async function Oe(e){if(e.size>I)throw new Error(`Model zip is too large. The compressed archive must be ${w(I)} or smaller.`);let t=await Ue(new Uint8Array(await e.arrayBuffer())),r=new Map;for(let[i,o]of Object.entries(t)){let u=R(i);!u||Y(u)||r.set(u,o)}let n=[...r.keys()].filter(i=>/\.(gltf|obj|fbx)$/i.test(i));if(n.length===0)throw new Error("Invalid model zip: no .gltf, .obj, or .fbx file found.");if(n.length>1)throw new Error("Invalid model zip: multiple model entry files found.");let s=n[0],a=T(s);if(a==="gltf")return Ge(e,s,r);if(a==="obj"||a==="fbx")return Fe(e,s,a,r);throw new Error(`Unsupported model entry ${s}.`)}function Ue(e){return new Promise((t,r)=>{let n=0,s=0,a=null,i=u=>(a??(a=new Error(`Invalid model zip: ${u}`)),!1);Pe(e,{filter:u=>{if(a)return!1;if(n+=1,n>j)return i(`archive contains more than ${j.toLocaleString()} entries.`);if(u.originalSize>_)return i(`${u.name} expands beyond the ${w(_)} per-file limit.`);if(s+=u.originalSize,s>N)return i(`expanded contents exceed ${w(N)}.`);if(u.originalSize>=Ee&&(u.size===0||u.originalSize/u.size>W))return i(`${u.name} exceeds the ${W}:1 compression-ratio limit.`);let l=R(u.name);return!!l&&!Y(l)}},(u,l)=>{a?r(a):u?r(new Error(`Invalid model zip: ${u.message}`)):t(l)})})}function w(e){return`${e/b} MiB`}function Fe(e,t,r,n){let s=[],a={};for(let[o,u]of n){let l=URL.createObjectURL(new Blob([u],{type:J(o)}));s.push(l),a[o]=l}let i=a[t];if(!i)throw s.forEach(o=>URL.revokeObjectURL(o)),new Error(`Invalid model zip: could not read ${t}.`);return c.set(i,{format:r,entryPath:t,resourceUrls:a}),{url:i,name:e.name,format:r,cleanup:()=>{h(i),c.delete(i),s.forEach(o=>URL.revokeObjectURL(o))}}}function Ge(e,t,r){let n=r.get(t);if(!n)throw new Error("Invalid GLTF zip: no .gltf found.");let s=Z(Re(n),t);ze(s,t);let a=Ie(t),i=[];try{H(s.buffers,a,r,i),H(s.images,a,r,i);let o=new Blob([Le(JSON.stringify(s))],{type:"model/gltf+json"}),u=URL.createObjectURL(o);return i.push(u),c.set(u,{format:"gltf",entryPath:t}),{url:u,name:e.name,format:"gltf",cleanup:()=>{h(u),c.delete(u),i.forEach(l=>URL.revokeObjectURL(l))}}}catch(o){throw i.forEach(u=>URL.revokeObjectURL(u)),o}}function H(e,t,r,n){for(let s of e??[]){if(typeof s.uri!="string"||D(s.uri))continue;let a=je(t,s.uri),i=r.get(a);if(!i)throw new Error(`Invalid GLTF zip: missing referenced asset ${s.uri}.`);let o=URL.createObjectURL(new Blob([i],{type:J(a)}));n.push(o),s.uri=o}}function Z(e,t){try{return JSON.parse(e)}catch{throw new Error(`${t} is not a valid .gltf JSON file.`)}}function X(e){return[...e.buffers??[],...e.images??[]].map(t=>t.uri).filter(t=>typeof t=="string"&&t.length>0)}function ze(e,t){for(let r of X(e)){if(D(r))continue;let n=/^[a-z][a-z0-9+.-]*:/i.test(r),s=r.startsWith("/")||r.startsWith("\\");if(n||s)throw new Error(`${t} references external assets. Include every dependency inside the uploaded .zip.`)}}function D(e){return e.startsWith("data:")}function R(e){let t=[];for(let r of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(n=>n&&n!==".")){if(r===".."){t.pop();continue}t.push(r)}return t.join("/")}function Y(e){let t=e.split("/");return e.endsWith("/")||t.includes("__MACOSX")||t.some(r=>r===".DS_Store"||r.startsWith("._"))}function Ie(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function je(e,t){let r=t.split(/[?#]/)[0],n=_e(r);return R(e?`${e}/${n}`:n)}function _e(e){try{return decodeURI(e)}catch{return e}}function J(e){let t=e.toLowerCase();return t.endsWith(".obj")||t.endsWith(".mtl")?"text/plain":t.endsWith(".fbx")?"application/octet-stream":t.endsWith(".usdz")?"model/vnd.usdz+zip":t.endsWith(".bin")?"application/octet-stream":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".webp")?"image/webp":t.endsWith(".avif")?"image/avif":t.endsWith(".ktx2")?"image/ktx2":"application/octet-stream"}import{AdditiveBlending as Ne,BackSide as We,DoubleSide as Ve,FrontSide as $e,NoColorSpace as He,NormalBlending as Ke,SRGBColorSpace as Ze,Vector2 as q}from"three";function Q(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function ee(e){return!!(e&&typeof e=="object"&&"isMeshPhysicalMaterial"in e&&e.isMeshPhysicalMaterial)}function Vt(e){return!!(e&&"isMesh"in e&&e.isMesh)}var $t=["texture","metalnessMap","roughnessMap","emissiveMap","alphaMap","normalMap","bumpMap","aoMap","displacementMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","anisotropyMap","transmissionMap","thicknessMap","sheenColorMap","sheenRoughnessMap","specularIntensityMap","specularColorMap"],Ht={texture:"map",metalnessMap:"metalnessMap",roughnessMap:"roughnessMap",emissiveMap:"emissiveMap",alphaMap:"alphaMap",normalMap:"normalMap",bumpMap:"bumpMap",aoMap:"aoMap",displacementMap:"displacementMap",clearcoatMap:"clearcoatMap",clearcoatRoughnessMap:"clearcoatRoughnessMap",clearcoatNormalMap:"clearcoatNormalMap",anisotropyMap:"anisotropyMap",transmissionMap:"transmissionMap",thicknessMap:"thicknessMap",sheenColorMap:"sheenColorMap",sheenRoughnessMap:"sheenRoughnessMap",specularIntensityMap:"specularIntensityMap",specularColorMap:"specularColorMap"},Xe=new Set(["texture","emissiveMap","sheenColorMap","specularColorMap"]);function Kt(e){return Xe.has(e)?Ze:He}function Zt(e,t){return e?.[t]?.path}function Xt(e,t){let r=e?.[t]?.offset;if(!r)return;let[n,s]=r;if(!(!Number.isFinite(n)||!Number.isFinite(s)))return n===0&&s===0?void 0:[n,s]}function Yt(e,t){let r=e?.[t]?.scale;if(!(!Number.isFinite(r)||!r))return r===1?void 0:r}function Jt(e,t){let r=e?.[t]?.rotation;if(!(!Number.isFinite(r)||!r))return r}function qt(e){return e==="back"?We:e==="double"?Ve:$e}function Qt(e){return e==="additive"?Ne:Ke}function g(e,t=1,r=t){if(e&&typeof e=="object"){let n=e;if(typeof n.x=="number"&&Number.isFinite(n.x)&&typeof n.y=="number"&&Number.isFinite(n.y))return new q(n.x,n.y)}return new q(t,r)}function er(e){return Number.isFinite(e)&&e>0?e:1}function tr(e,t){return e?.animations.clips.find(r=>r.sourceName===t)}function rr(e){return e?.loopMode??"repeat"}var te="KHR_materials_variants",re="riMaterialVariants";function f(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ye(e){if(!f(e)||!f(e.extensions))return[];let t=e.extensions[te];if(!f(t)||!Array.isArray(t.variants))return[];let r=new Set;return t.variants.map((n,s)=>{let a=f(n)&&typeof n.name=="string"&&n.name?n.name:`Variant ${s+1}`,i=a;for(let o=2;r.has(i);o+=1)i=`${a} (${o})`;return r.add(i),i})}function sr(e){let t=e.userData?.gltfExtensions;if(!f(t))return[];let r=t[te];return!f(r)||!Array.isArray(r.mappings)?[]:r.mappings.filter(n=>f(n)&&Number.isInteger(n.material)&&Array.isArray(n.variants)&&n.variants.every(Number.isInteger))}function ar(e,t){if(t<0)return null;let r=e.find(n=>n.variants.includes(t));return r?r.material:null}function ne(e){let t=e.parser,r=Ye(t?.json);if(!(!t||r.length===0))return e.scene.userData[re]=r,{names:r,resolveMaterial:async(n,s)=>{let a={geometry:s.geometry,material:await t.getDependency("material",n),isPoints:s.isPoints,isLine:s.isLine};return t.assignFinalMaterial(a),a.material}}}function se(e){let t=e.userData?.[re];return Array.isArray(t)&&t.every(r=>typeof r=="string")?t:[]}import{useLoader as oe,useThree as st}from"@react-three/fiber";import{FileLoader as at,Loader as it,LoadingManager as ot}from"three";import{FBXLoader as ut,GLTFLoader as lt,MTLLoader as pt,OBJLoader as ct}from"three-stdlib";import{USDLoader as dt}from"three/examples/jsm/loaders/USDLoader.js";import{useGLTF as ur}from"@react-three/drei";import{useThree as pr}from"@react-three/fiber";import{useMemo as dr}from"react";import{SRGBColorSpace as Je}from"three";import{DRACOLoader as qe,KTX2Loader as Qe,MeshoptDecoder as et}from"three-stdlib";function tt(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let r=e.json.materials??[],n=new Map;if(r.forEach(a=>{let i=!!a?.extensions?.KHR_materials_unlit,o=!!a?.pbrMetallicRoughness?.baseColorTexture;i&&!o&&a?.emissiveTexture&&a.name&&n.set(a.name,a.emissiveTexture.index)}),n.size===0||!t.scene)return;let s=new Map;await Promise.all([...n].map(async([a,i])=>{let o=await e.getDependency("texture",i);o&&(o.colorSpace=Je,s.set(a,o))})),t.scene.traverse(a=>{let i=Array.isArray(a.material)?a.material:a.material?[a.material]:[];for(let o of i){let u=o.name?s.get(o.name):void 0;u&&!o.map&&(o.map=u,o.needsUpdate=!0)}})}}}var rt="https://assets.react-immersive.liveroom.dev/three-r184/draco/",nt="https://assets.react-immersive.liveroom.dev/three-r184/basis/";function ae(e,t={},r){let{dracoDecoderPath:n=rt,ktx2TranscoderPath:s=nt,meshopt:a=!0}=t;if(n){let i=new qe;i.setDecoderPath(n),e.setDRACOLoader(i)}if(a&&e.setMeshoptDecoder(et),s&&r){let i=new Qe().setTranscoderPath(s).detectSupport(r);e.setKTX2Loader(i)}e.register((i=>tt(i)))}var y=class extends it{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(r){return this.options=r,this}load(r,n,s,a){this.loadAsset(r,s).then(n).catch(a)}async loadAsset(r,n){let s=mt(this.options.source),{format:a}=this.options.source;if(a==="obj")return ft(r,s,this.options.source,n);if(a==="fbx"){let u=L(this,new ut(s)),l=bt(r,this.options.source);l&&u.setResourcePath(l);let p=await u.loadAsync(r,n);return P(p,"FBXMesh",!1),{scene:p,animations:p.animations??[]}}if(a==="usdz"){let l=await L(this,new dt(s)).loadAsync(r,n);return P(l,"USDZMesh",!1),{scene:l,animations:l.animations??[]}}let i=L(this,new lt(s));ae(i,this.options.decoderConfig,this.options.renderer);let o=await i.loadAsync(r,n);return{scene:o.scene,animations:o.animations??[],materialVariants:ne(o)}}};z(e=>{oe.clear(y,e)});function Tr(e,t={},r,n){let s=st(o=>o.gl),a=K(e),i=r?{...a,format:r}:a;return oe(y,e,o=>{o.configure({source:i,decoderConfig:t,renderer:s})},n)}async function ft(e,t,r,n){let s=await ie(e,t,n),a=new ct(t),i=Mt(s);if(i){let u=ht(i,e,r);if(u)try{let l=await ie(u.url,t),d=new pt(t).parse(l,u.basePath);d.preload(),a.setMaterials(d)}catch(l){console.warn(`[react-immersive] Could not load OBJ material ${i}; rendering geometry with fallback materials.`,l)}}let o=a.parse(s);return P(o,"OBJMesh",!0),{scene:o,animations:[]}}function P(e,t,r){let n=new Set,s=0;e.traverse(a=>{if(!("isMesh"in a&&a.isMesh===!0)){a.name&&n.add(a.name);return}let o=a.name||`${t}_${++s}`;if(!r&&a.name){n.add(a.name);return}let u=o,l=2;for(;n.has(u);)u=`${o}_${l++}`;a.name=u,n.add(u)})}function ie(e,t,r){let n=new at(t);return n.setResponseType("text"),n.loadAsync(e,r)}function L(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function mt(e){let t=new ot,r=e.resourceUrls;return r&&t.setURLModifier(n=>{if(/^(?:blob:|data:)/i.test(n))return n;let s=x(le(n).split(/[?#]/)[0]),a=r[s];if(a)return a;let i=v(e.entryPath??""),o=x(i?`${i}/${s}`:s);return r[o]??n}),t}function Mt(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function ht(e,t,r){if(r.resourceUrls&&r.entryPath){let n=x(`${v(r.entryPath)}/${le(e)}`),s=r.resourceUrls[n];if(!s)return null;let a=v(n);return{url:s,basePath:a?`${a}/`:""}}try{let n=new URL(e,t).href;return{url:n,basePath:ue(n)}}catch{return null}}function bt(e,t){if(t.resourceUrls&&t.entryPath){let r=v(t.entryPath);return r?`${r}/`:""}return ue(e)}function ue(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function v(e){let t=x(e),r=t.lastIndexOf("/");return r===-1?"":t.slice(0,r)}function x(e){let t=[];for(let r of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(n=>n&&n!=="."))r===".."?t.pop():t.push(r);return t.join("/")}function le(e){try{return decodeURI(e)}catch{return e}}import{Color as B,MeshPhysicalMaterial as gt,MeshStandardMaterial as yt,Texture as A}from"three";function Pr(e){if(Q(e))return e;if(!e||typeof e!="object")return null;let t=e,r=new yt;typeof t.name=="string"&&(r.name=t.name),r.metalness=0,r.roughness=1,t.type==="MeshBasicMaterial"||t.isMeshBasicMaterial===!0?(r.color.set(0),r.emissiveIntensity=1,t.map instanceof A?(r.emissiveMap=t.map,r.emissive.set(16777215)):t.color instanceof B&&r.emissive.copy(t.color)):(t.color instanceof B&&r.color.copy(t.color),t.map instanceof A&&(r.map=t.map),t.emissive instanceof B&&r.emissive.copy(t.emissive),t.emissiveMap instanceof A&&(r.emissiveMap=t.emissiveMap));let s=["aoMap","aoMapIntensity","lightMap","lightMapIntensity","alphaMap","opacity","transparent","alphaTest","side","vertexColors","wireframe","depthTest","depthWrite","visible","toneMapped","fog"];for(let a of s)t[a]!==void 0&&(r[a]=t[a]);return r.needsUpdate=!0,r}function Br(e){if(ee(e))return e.clone();let t=new gt;return t.name=e.name,t.color.copy(e.color),t.map=e.map,t.lightMap=e.lightMap,t.lightMapIntensity=e.lightMapIntensity,t.aoMap=e.aoMap,t.aoMapIntensity=e.aoMapIntensity,t.emissive.copy(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.emissiveMap=e.emissiveMap,t.bumpMap=e.bumpMap,t.bumpScale=e.bumpScale,t.normalMap=e.normalMap,t.normalMapType=e.normalMapType,t.normalScale.copy(g(e.normalScale)),t.displacementMap=e.displacementMap,t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias,t.roughness=e.roughness,t.roughnessMap=e.roughnessMap,t.metalness=e.metalness,t.metalnessMap=e.metalnessMap,t.alphaMap=e.alphaMap,t.envMap=e.envMap,t.envMapRotation.copy(e.envMapRotation),t.envMapIntensity=e.envMapIntensity,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.flatShading=e.flatShading,t.fog=e.fog,t.opacity=e.opacity,t.transparent=e.transparent,t.alphaHash=e.alphaHash,t.blendSrc=e.blendSrc,t.blendDst=e.blendDst,t.blendEquation=e.blendEquation,t.blendSrcAlpha=e.blendSrcAlpha,t.blendDstAlpha=e.blendDstAlpha,t.blendEquationAlpha=e.blendEquationAlpha,t.blending=e.blending,t.premultipliedAlpha=e.premultipliedAlpha,t.dithering=e.dithering,t.alphaTest=e.alphaTest,t.depthTest=e.depthTest,t.depthWrite=e.depthWrite,t.colorWrite=e.colorWrite,t.stencilWrite=e.stencilWrite,t.stencilWriteMask=e.stencilWriteMask,t.stencilFunc=e.stencilFunc,t.stencilRef=e.stencilRef,t.stencilFuncMask=e.stencilFuncMask,t.stencilFail=e.stencilFail,t.stencilZFail=e.stencilZFail,t.stencilZPass=e.stencilZPass,t.side=e.side,t.shadowSide=e.shadowSide,t.toneMapped=e.toneMapped,t.vertexColors=e.vertexColors,t.visible=e.visible,t.clippingPlanes=e.clippingPlanes,t.clipIntersection=e.clipIntersection,t.clipShadows=e.clipShadows,t.forceSinglePass=e.forceSinglePass,t.polygonOffset=e.polygonOffset,t.polygonOffsetFactor=e.polygonOffsetFactor,t.polygonOffsetUnits=e.polygonOffsetUnits,t}function Ar(e){e.userData.baseColor=e.color.clone(),e.userData.baseMap=e.map??null,e.userData.baseMetalness=e.metalness,e.userData.baseMetalnessMap=e.metalnessMap??null,e.userData.baseRoughness=e.roughness,e.userData.baseRoughnessMap=e.roughnessMap??null,e.userData.baseEmissive=e.emissive.clone(),e.userData.baseEmissiveIntensity=e.emissiveIntensity,e.userData.baseEmissiveMap=e.emissiveMap??null,e.userData.baseOpacity=e.opacity,e.userData.baseTransparent=e.transparent,e.userData.baseAlphaMap=e.alphaMap??null,e.userData.baseAlphaTest=e.alphaTest,e.userData.baseAlphaHash=e.alphaHash,e.userData.baseDithering=e.dithering,e.userData.baseBlending=e.blending,e.userData.baseDepthWrite=e.depthWrite,e.userData.baseSide=e.side,e.userData.baseNormalMap=e.normalMap??null,e.userData.baseNormalScale=g(e.normalScale),e.userData.baseBumpMap=e.bumpMap??null,e.userData.baseBumpScale=e.bumpScale,e.userData.baseAoMap=e.aoMap??null,e.userData.baseAoMapIntensity=e.aoMapIntensity,e.userData.baseDisplacementMap=e.displacementMap??null,e.userData.baseDisplacementScale=e.displacementScale,e.userData.baseDisplacementBias=e.displacementBias,e.userData.baseClearcoat=e.clearcoat,e.userData.baseClearcoatMap=e.clearcoatMap??null,e.userData.baseClearcoatRoughness=e.clearcoatRoughness,e.userData.baseClearcoatRoughnessMap=e.clearcoatRoughnessMap??null,e.userData.baseClearcoatNormalMap=e.clearcoatNormalMap??null,e.userData.baseClearcoatNormalScale=g(e.clearcoatNormalScale),e.userData.baseSheen=e.sheen,e.userData.baseSheenColor=e.sheenColor.clone(),e.userData.baseSheenColorMap=e.sheenColorMap??null,e.userData.baseSheenRoughness=e.sheenRoughness,e.userData.baseSheenRoughnessMap=e.sheenRoughnessMap??null,e.userData.baseAnisotropy=e.anisotropy,e.userData.baseAnisotropyRotation=e.anisotropyRotation,e.userData.baseAnisotropyMap=e.anisotropyMap??null,e.userData.baseTransmission=e.transmission,e.userData.baseTransmissionMap=e.transmissionMap??null,e.userData.baseThickness=e.thickness,e.userData.baseThicknessMap=e.thicknessMap??null,e.userData.baseAttenuationColor=e.attenuationColor.clone(),e.userData.baseAttenuationDistance=e.attenuationDistance,e.userData.baseReflectivity=e.reflectivity,e.userData.baseSpecularIntensity=e.specularIntensity,e.userData.baseSpecularIntensityMap=e.specularIntensityMap??null,e.userData.baseSpecularColor=e.specularColor.clone(),e.userData.baseSpecularColorMap=e.specularColorMap??null,e.userData.baseFlatShading=e.flatShading,e.userData.baseEnvMapIntensity=e.envMapIntensity}function Cr(e){e.updateMatrixWorld(!0),e.traverse(t=>{let r=t;r.isSkinnedMesh&&(r.skeleton?.update(),r.computeBoundingBox?.(),r.computeBoundingSphere?.())})}import{useCallback as pe,useEffect as vt,useRef as xt}from"react";import{useThree as St}from"@react-three/fiber";function Fr(){let e=St(s=>s.gl.domElement),t=xt(void 0),r=pe(s=>{t.current===void 0&&(t.current=e.style.cursor),e.style.cursor=s},[e]),n=pe(()=>{let s=t.current;s!==void 0&&(e.style.cursor=s,t.current=void 0)},[e]);return vt(()=>()=>{n()},[n]),{setCanvasCursor:r,restoreCanvasCursor:n}}import{Box3 as wt,Vector3 as ce}from"three";function S(e){return[e.x,e.y,e.z]}function jr(e){let t=new wt().setFromObject(e),r=0;return e.traverse(n=>{n.isMesh&&(r+=1)}),{bounds:{min:S(t.min),max:S(t.max),center:S(t.getCenter(new ce)),size:S(t.getSize(new ce))},objectCount:r,materialVariants:se(e)}}import{jsx as E,jsxs as C}from"react/jsx-runtime";function $r({visible:e,message:t,tone:r="default",progress:n}){if(!e)return null;let s=typeof n=="number"&&Number.isFinite(n),a=s?Math.min(Math.max(n,0),100):0,i=Math.round(a);return C("div",{className:"bb-loadingOverlay",role:"status","aria-live":"polite",children:[s&&C("div",{className:"bb-loadingProgressRow",children:[E("div",{className:"bb-loadingProgress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":i,children:E("div",{className:"bb-loadingProgress__bar",style:{width:`${i}%`}})}),C("span",{className:"bb-loadingProgress__label",children:[i,"%"]})]}),E("span",{className:`bb-loadingMessage bb-status--${r}`,children:t})]})}export{F as a,Rt as b,xe as c,Lt as d,Pt as e,kt as f,T as g,Ot as h,Vt as i,$t as j,Ht as k,Kt as l,Zt as m,Xt as n,Yt as o,Jt as p,qt as q,Qt as r,g as s,er as t,tr as u,rr as v,rt as w,nt as x,sr as y,ar as z,se as A,Tr as B,Pr as C,Br as D,Ar as E,Cr as F,Fr as G,jr as H,$r as I};
@@ -1,23 +0,0 @@
1
- type ModelFormat = "glb" | "gltf" | "obj" | "fbx" | "usdz";
2
-
3
- type ViewerModelBounds = {
4
- min: [number, number, number];
5
- max: [number, number, number];
6
- center: [number, number, number];
7
- size: [number, number, number];
8
- };
9
- /** What `onModelLoaded` reports about a model that finished loading. */
10
- type ViewerModelInfo = {
11
- /** Bounds in world space, where the viewer placed the model. */
12
- bounds: ViewerModelBounds;
13
- /** Number of meshes in the loaded scene. */
14
- objectCount: number;
15
- /**
16
- * Names of the glTF material variants (KHR_materials_variants) the model
17
- * offers, in file order; empty when it has none. Show one by setting
18
- * `sceneConfig.model.materialVariant`.
19
- */
20
- materialVariants: string[];
21
- };
22
-
23
- export type { ModelFormat as M, ViewerModelBounds as V, ViewerModelInfo as a };
@@ -1,23 +0,0 @@
1
- type ModelFormat = "glb" | "gltf" | "obj" | "fbx" | "usdz";
2
-
3
- type ViewerModelBounds = {
4
- min: [number, number, number];
5
- max: [number, number, number];
6
- center: [number, number, number];
7
- size: [number, number, number];
8
- };
9
- /** What `onModelLoaded` reports about a model that finished loading. */
10
- type ViewerModelInfo = {
11
- /** Bounds in world space, where the viewer placed the model. */
12
- bounds: ViewerModelBounds;
13
- /** Number of meshes in the loaded scene. */
14
- objectCount: number;
15
- /**
16
- * Names of the glTF material variants (KHR_materials_variants) the model
17
- * offers, in file order; empty when it has none. Show one by setting
18
- * `sceneConfig.model.materialVariant`.
19
- */
20
- materialVariants: string[];
21
- };
22
-
23
- export type { ModelFormat as M, ViewerModelBounds as V, ViewerModelInfo as a };