shop-components 0.4.21 → 0.4.22

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.
@@ -15,8 +15,8 @@ export default class JFA {
15
15
  target?: Object3D;
16
16
  private readonly selectionLayer;
17
17
  maskMaterial: MeshBasicMaterial;
18
- targets: WebGLRenderTarget<import("three").Texture>[];
19
- masks: WebGLRenderTarget<import("three").Texture>[];
18
+ targets: WebGLRenderTarget<import("three").Texture<unknown>>[];
19
+ masks: WebGLRenderTarget<import("three").Texture<unknown>>[];
20
20
  seedMaterial: SeedMaterial;
21
21
  effectQuad: FullScreenQuad;
22
22
  jfaQuad: FullScreenQuad;
@@ -57,8 +57,8 @@ export interface SceneProps {
57
57
  export declare class Scene3D {
58
58
  props: SceneProps;
59
59
  stats: Stats;
60
- scene: Scene;
61
- overlayScene: Scene;
60
+ scene: Scene<import("three").Object3DEventMap>;
61
+ overlayScene: Scene<import("three").Object3DEventMap>;
62
62
  renderer: WebGLRenderer;
63
63
  private css2dRenderer;
64
64
  pathTracer: WebGLPathTracer;
@@ -3678,7 +3678,7 @@ bool bvhIntersectFogVolumeHit(
3678
3678
  rayDirection.x *= flipEnvMap;
3679
3679
  gl_FragColor = textureCube( envMap, rayDirection );
3680
3680
 
3681
- }`}),this.depthWrite=!1,this.depthTest=!1}}class Gs{constructor(e){this._renderer=e,this._quad=new ut.FullScreenQuad(new Jo)}generate(e,t=null,i=null){if(!e.isCubeTexture)throw new Error("CubeToEquirectMaterial: Source can only be cube textures.");const s=e.images[0],a=this._renderer,n=this._quad;t===null&&(t=4*s.height),i===null&&(i=2*s.height);const c=new d.WebGLRenderTarget(t,i,{type:d.FloatType,colorSpace:s.colorSpace}),h=s.height,f=Math.log2(h)-2,p=1/h,r=1/(3*Math.max(Math.pow(2,f),7*16));n.material.defines.CUBEUV_MAX_MIP=`${f}.0`,n.material.defines.CUBEUV_TEXEL_WIDTH=r,n.material.defines.CUBEUV_TEXEL_HEIGHT=p,n.material.uniforms.envMap.value=e,n.material.uniforms.flipEnvMap.value=e.isRenderTargetTexture?1:-1,n.material.needsUpdate=!0;const l=a.getRenderTarget(),u=a.autoClear;a.autoClear=!0,a.setRenderTarget(c),n.render(a),a.setRenderTarget(l),a.autoClear=u;const g=new Uint16Array(t*i*4),y=new Float32Array(t*i*4);a.readRenderTargetPixels(c,0,0,t,i,y),c.dispose();for(let v=0,_=y.length;v<_;v++)g[v]=d.DataUtils.toHalfFloat(y[v]);const m=new d.DataTexture(g,t,i,d.RGBAFormat,d.HalfFloatType);return m.minFilter=d.LinearMipMapLinearFilter,m.magFilter=d.LinearFilter,m.wrapS=d.RepeatWrapping,m.wrapT=d.RepeatWrapping,m.mapping=d.EquirectangularReflectionMapping,m.needsUpdate=!0,m}dispose(){this._quad.dispose()}}function $o(o){return o.extensions.get("EXT_float_blend")}const je=new d.Vector2;class ea{get multipleImportanceSampling(){return!!this._pathTracer.material.defines.FEATURE_MIS}set multipleImportanceSampling(e){this._pathTracer.material.setDefine("FEATURE_MIS",e?1:0)}get transmissiveBounces(){return this._pathTracer.material.transmissiveBounces}set transmissiveBounces(e){this._pathTracer.material.transmissiveBounces=e}get bounces(){return this._pathTracer.material.bounces}set bounces(e){this._pathTracer.material.bounces=e}get filterGlossyFactor(){return this._pathTracer.material.filterGlossyFactor}set filterGlossyFactor(e){this._pathTracer.material.filterGlossyFactor=e}get samples(){return this._pathTracer.samples}get target(){return this._pathTracer.target}get tiles(){return this._pathTracer.tiles}get stableNoise(){return this._pathTracer.stableNoise}set stableNoise(e){this._pathTracer.stableNoise=e}get isCompiling(){return!!this._pathTracer.isCompiling}constructor(e){this._renderer=e,this._generator=new Bn,this._pathTracer=new Us(e),this._queueReset=!1,this._clock=new d.Clock,this._compilePromise=null,this._lowResPathTracer=new Us(e),this._lowResPathTracer.tiles.set(1,1),this._quad=new ut.FullScreenQuad(new Zo({map:null,transparent:!0,blending:d.NoBlending,premultipliedAlpha:e.getContextAttributes().premultipliedAlpha})),this._materials=null,this._previousEnvironment=null,this._previousBackground=null,this._internalBackground=null,this.renderDelay=100,this.minSamples=5,this.fadeDuration=500,this.enablePathTracing=!0,this.pausePathTracing=!1,this.dynamicLowRes=!1,this.lowResScale=.25,this.renderScale=1,this.synchronizeRenderSize=!0,this.rasterizeScene=!0,this.renderToCanvas=!0,this.textureSize=new d.Vector2(1024,1024),this.rasterizeSceneCallback=(t,i)=>{this._renderer.render(t,i)},this.renderToCanvasCallback=(t,i,s)=>{const a=i.autoClear;i.autoClear=!1,s.render(i),i.autoClear=a},this.setScene(new d.Scene,new d.PerspectiveCamera)}setBVHWorker(e){this._generator.setBVHWorker(e)}setScene(e,t,i={}){e.updateMatrixWorld(!0),t.updateMatrixWorld();const s=this._generator;if(s.setObjects(e),this._buildAsync)return s.generateAsync(i.onProgress).then(a=>this._updateFromResults(e,t,a));{const a=s.generate();return this._updateFromResults(e,t,a)}}setSceneAsync(...e){this._buildAsync=!0;const t=this.setScene(...e);return this._buildAsync=!1,t}setCamera(e){this.camera=e,this.updateCamera()}updateCamera(){const e=this.camera;e.updateMatrixWorld(),this._pathTracer.setCamera(e),this._lowResPathTracer.setCamera(e),this.reset()}updateMaterials(){const e=this._pathTracer.material,t=this._renderer,i=this._materials,s=this.textureSize,a=so(i);e.textures.setTextures(t,a,s.x,s.y),e.materials.updateFrom(i,a),this.reset()}updateLights(){const e=this.scene,t=this._renderer,i=this._pathTracer.material,s=ro(e),a=io(s);i.lights.updateFrom(s,a),i.iesProfiles.setTextures(t,a),this.reset()}updateEnvironment(){const e=this.scene,t=this._pathTracer.material;if(this._internalBackground&&(this._internalBackground.dispose(),this._internalBackground=null),t.backgroundBlur=e.backgroundBlurriness,t.backgroundIntensity=e.backgroundIntensity??1,t.backgroundRotation.makeRotationFromEuler(e.backgroundRotation).invert(),e.background===null)t.backgroundMap=null,t.backgroundAlpha=0;else if(e.background.isColor){this._colorBackground=this._colorBackground||new Xo(16);const i=this._colorBackground;i.topColor.equals(e.background)||(i.topColor.set(e.background),i.bottomColor.set(e.background),i.update()),t.backgroundMap=i,t.backgroundAlpha=1}else if(e.background.isCubeTexture){if(e.background!==this._previousBackground){const i=new Gs(this._renderer).generate(e.background);this._internalBackground=i,t.backgroundMap=i,t.backgroundAlpha=1}}else t.backgroundMap=e.background,t.backgroundAlpha=1;if(t.environmentIntensity=e.environmentIntensity??1,t.environmentRotation.makeRotationFromEuler(e.environmentRotation).invert(),this._previousEnvironment!==e.environment)if(e.environment!==null)if(e.environment.isCubeTexture){const i=new Gs(this._renderer).generate(e.environment);t.envMapInfo.updateFrom(i)}else t.envMapInfo.updateFrom(e.environment);else t.environmentIntensity=0;this._previousEnvironment=e.environment,this._previousBackground=e.background,this.reset()}_updateFromResults(e,t,i){const{materials:s,geometry:a,bvh:n,bvhChanged:c}=i;this._materials=s;const f=this._pathTracer.material;return c&&(f.bvh.updateFrom(n),f.attributesArray.updateFrom(a.attributes.normal,a.attributes.tangent,a.attributes.uv,a.attributes.color),f.materialIndexAttribute.updateFrom(a.attributes.materialIndex)),this._previousScene=e,this.scene=e,this.camera=t,this.updateCamera(),this.updateMaterials(),this.updateEnvironment(),this.updateLights(),i}renderSample(){const e=this._lowResPathTracer,t=this._pathTracer,i=this._renderer,s=this._clock,a=this._quad;this._updateScale(),this._queueReset&&(t.reset(),e.reset(),this._queueReset=!1,a.material.opacity=0,s.start());const n=s.getDelta()*1e3,c=s.getElapsedTime()*1e3;if(!this.pausePathTracing&&this.enablePathTracing&&this.renderDelay<=c&&!this.isCompiling&&t.update(),t.alpha=t.material.backgroundAlpha!==1||!$o(i),e.alpha=t.alpha,this.renderToCanvas){const h=this._renderer,f=this.minSamples;if(c>=this.renderDelay&&this.samples>=this.minSamples&&(this.fadeDuration!==0?a.material.opacity=Math.min(a.material.opacity+n/this.fadeDuration,1):a.material.opacity=1),!this.enablePathTracing||this.samples<f||a.material.opacity<1){if(this.dynamicLowRes&&!this.isCompiling){e.samples<1&&(e.material=t.material,e.update());const p=a.material.opacity;a.material.opacity=1-a.material.opacity,a.material.map=e.target.texture,a.render(h),a.material.opacity=p}(!this.dynamicLowRes&&this.rasterizeScene||this.dynamicLowRes&&this.isCompiling)&&this.rasterizeSceneCallback(this.scene,this.camera)}this.enablePathTracing&&a.material.opacity>0&&(a.material.opacity<1&&(a.material.blending=this.dynamicLowRes?d.AdditiveBlending:d.NormalBlending),a.material.map=t.target.texture,this.renderToCanvasCallback(t.target,h,a),a.material.blending=d.NoBlending)}}reset(){this._queueReset=!0,this._pathTracer.samples=0}dispose(){this._renderQuad.dispose(),this._renderQuad.material.dispose(),this._pathTracer.dispose()}_updateScale(){if(this.synchronizeRenderSize){this._renderer.getDrawingBufferSize(je);const e=Math.floor(this.renderScale*je.x),t=Math.floor(this.renderScale*je.y);if(this._pathTracer.getSize(je),je.x!==e||je.y!==t){const i=this.lowResScale;this._pathTracer.setSize(e,t),this._lowResPathTracer.setSize(Math.floor(e*i),Math.floor(t*i))}}}}const ta="";globalThis.GLTF_PROGRESSIVE_VERSION=ta;console.debug("[gltf-progressive] version -");let br="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",ia="https://cdn.needle.tools/static/three/0.179.1/basis2/";const sa=new URL(br+"draco_decoder.js");sa.searchParams.append("range","true");const ra=()=>({dracoDecoderPath:br,ktx2TranscoderPath:ia});function Ar(o){return{dracoLoader:Sr,meshoptDecoder:Mr}}function Tr(o){o.dracoLoader||o.setDRACOLoader(Sr),o.meshoptDecoder||o.setMeshoptDecoder(Mr)}let Sr,Mr;const Hi=new WeakMap;function Cr(o,e){let t=Hi.get(o);t?t=Object.assign(t,e):t=e,Hi.set(o,t)}const Ai=os.GLTFLoader.prototype.load;function na(...o){const e=Hi.get(this);let t=o[0];const i=new URL(t,window.location.href);if(i.hostname.endsWith("needle.tools")){const a=(e==null?void 0:e.progressive)!==void 0?e.progressive:!0,n=e!=null&&e.usecase?e.usecase:"default";a?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${n}`:this.requestHeader.Accept=`*/*;usecase=${n}`,t=i.toString()}return o[0]=t,Ai==null?void 0:Ai.call(this,...o)}os.GLTFLoader.prototype.load=na;He("debugprogressive");function He(o){if(typeof window>"u")return!1;const t=new URL(window.location.href).searchParams.get(o);return t==null||t==="0"||t==="false"?!1:t===""?!0:t}function oa(o,e){if(e===void 0||o===void 0||e.startsWith("./")||e.startsWith("http")||e.startsWith("data:")||e.startsWith("blob:"))return e;const t=o.lastIndexOf("/");if(t>=0){const i=o.substring(0,t+1);for(;i.endsWith("/")&&e.startsWith("/");)e=e.substring(1);return i+e}return e}function Rr(){return gt!==void 0||(gt=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),He("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",gt)),gt}let gt;function Ns(){if(typeof window>"u")return!1;const o=new URL(window.location.href),e=o.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(o.hostname);return o.hostname==="127.0.0.1"||e}class aa{constructor(e=100,t={}){F(this,"_running",new Map);F(this,"_queue",[]);F(this,"debug",!1);F(this,"tick",()=>{this.internalUpdate(),setTimeout(this.tick,10)});this.maxConcurrent=e,this.debug=t.debug??!1,window.requestAnimationFrame(this.tick)}slot(e){return this.debug&&console.debug(`[PromiseQueue]: Requesting slot for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`),new Promise(t=>{this._queue.push({key:e,resolve:t})})}add(e,t){this._running.has(e)||(this._running.set(e,t),t.finally(()=>{this._running.delete(e),this.debug&&console.debug(`[PromiseQueue]: Promise finished now running: ${this._running.size}, waiting: ${this._queue.length}. (finished ${e})`)}),this.debug&&console.debug(`[PromiseQueue]: Added new promise, now running: ${this._running.size}, waiting: ${this._queue.length}. (added ${e})`))}internalUpdate(){const e=this.maxConcurrent-this._running.size;for(let t=0;t<e&&this._queue.length>0;t++){this.debug&&console.debug(`[PromiseQueue]: Running ${this._running.size} promises, waiting for ${this._queue.length} more.`);const{key:i,resolve:s}=this._queue.shift();s({use:a=>this.add(i,a)})}}}const la=typeof window>"u"&&typeof document>"u",Gi=Symbol("needle:raycast-mesh");function Bt(o){return(o==null?void 0:o[Gi])instanceof d.BufferGeometry?o[Gi]:null}function ca(o,e){if((o.type==="Mesh"||o.type==="SkinnedMesh")&&!Bt(o)){const i=ua(e);i.userData={isRaycastMesh:!0},o[Gi]=i}}function ha(o=!0){if(o){if(vt)return;const e=vt=d.Mesh.prototype.raycast;d.Mesh.prototype.raycast=function(t,i){const s=this,a=Bt(s);let n;a&&s.isMesh&&(n=s.geometry,s.geometry=a),e.call(this,t,i),n&&(s.geometry=n)}}else{if(!vt)return;d.Mesh.prototype.raycast=vt,vt=null}}let vt=null;function ua(o){const e=new d.BufferGeometry;for(const t in o.attributes)e.setAttribute(t,o.getAttribute(t));return e.setIndex(o.getIndex()),e}const Re=new Array,z=He("debugprogressive");let It,Ve=-1;if(z){let o=function(){Ve+=1,Ve>=e&&(Ve=-1),console.log(`Toggle LOD level [${Ve}]`)},e=6;window.addEventListener("keyup",t=>{t.key==="p"&&o(),t.key==="w"&&(It=!It,console.log(`Toggle wireframe [${It}]`));const i=parseInt(t.key);!isNaN(i)&&i>=0&&(Ve=i,console.log(`Set LOD level to [${Ve}]`))})}function Lr(o){if(z&&It!==void 0)if(Array.isArray(o))for(const e of o)Lr(e);else o&&"wireframe"in o&&(o.wireframe=It===!0)}const _t=new Array;let fa=0;const da=Rr()?2:10;function pa(o){if(_t.length<da){const i=_t.length;z&&console.warn(`[Worker] Creating new worker #${i}`);const s=hs.createWorker(o||{});return _t.push(s),s}const e=fa++%_t.length;return _t[e]}class hs{constructor(e,t){F(this,"_running",[]);F(this,"_webglRenderer",null);F(this,"_debug",!1);this.worker=e,this._debug=t.debug??!1,e.onmessage=i=>{const s=i.data;switch(this._debug&&console.log("[Worker] EVENT",s),s.type){case"loaded-gltf":for(const a of this._running)if(a.url===s.result.url){ma(s.result),a.resolve(s.result);const n=a.url;n.startsWith("blob:")&&URL.revokeObjectURL(n)}}},e.onerror=i=>{console.error("[Worker] Error in gltf-progressive worker:",i)},e.postMessage({type:"init"})}static async createWorker(e){const t=new Worker(new URL(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/loader.worker-fysOIq2s.js").href:new URL("assets/loader.worker-fysOIq2s.js",document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"?require("url").pathToFileURL(__filename).href:ft&&ft.src||new URL("shop-components.cjs",document.baseURI).href),{type:"module"});return new hs(t,e)}async load(e,t){const i=ra();let s=t==null?void 0:t.renderer;s||(this._webglRenderer??(this._webglRenderer=(async()=>{const{WebGLRenderer:f}=await import("three");return new f})()),s=await this._webglRenderer);const c=Ar().ktx2Loader.workerConfig;e instanceof URL?e=e.toString():e.startsWith("file:")?e=URL.createObjectURL(new Blob([e])):!e.startsWith("blob:")&&!e.startsWith("http:")&&!e.startsWith("https:")&&(e=new URL(e,window.location.href).toString());const h={type:"load",url:e,dracoDecoderPath:i.dracoDecoderPath,ktx2TranscoderPath:i.ktx2TranscoderPath,ktx2LoaderConfig:c};return this._debug&&console.debug("[Worker] Sending load request",h),this.worker.postMessage(h),new Promise(f=>{this._running.push({url:e.toString(),resolve:f})})}}function ma(o){var e,t,i,s,a,n,c,h,f,p,r,l,u,g,y,m;for(const v of o.geometries){const _=v.geometry,x=new d.BufferGeometry;if(x.name=_.name||"",_.index){const w=_.index;x.setIndex(Ti(w))}for(const w in _.attributes){const b=_.attributes[w],T=Ti(b);x.setAttribute(w,T)}if(_.morphAttributes)for(const w in _.morphAttributes){const T=_.morphAttributes[w].map(S=>Ti(S));x.morphAttributes[w]=T}if(x.morphTargetsRelative=_.morphTargetsRelative??!1,x.boundingBox=new d.Box3,x.boundingBox.min=new d.Vector3((e=_.boundingBox)==null?void 0:e.min.x,(t=_.boundingBox)==null?void 0:t.min.y,(i=_.boundingBox)==null?void 0:i.min.z),x.boundingBox.max=new d.Vector3((s=_.boundingBox)==null?void 0:s.max.x,(a=_.boundingBox)==null?void 0:a.max.y,(n=_.boundingBox)==null?void 0:n.max.z),x.boundingSphere=new d.Sphere(new d.Vector3((c=_.boundingSphere)==null?void 0:c.center.x,(h=_.boundingSphere)==null?void 0:h.center.y,(f=_.boundingSphere)==null?void 0:f.center.z),(p=_.boundingSphere)==null?void 0:p.radius),_.groups)for(const w of _.groups)x.addGroup(w.start,w.count,w.materialIndex);_.userData&&(x.userData=_.userData),v.geometry=x}for(const v of o.textures){const _=v.texture;let x=null;if(_.isCompressedTexture){const w=_.mipmaps,b=((r=_.image)==null?void 0:r.width)||((u=(l=_.source)==null?void 0:l.data)==null?void 0:u.width)||-1,T=((g=_.image)==null?void 0:g.height)||((m=(y=_.source)==null?void 0:y.data)==null?void 0:m.height)||-1;x=new d.CompressedTexture(w,b,T,_.format,_.type,_.mapping,_.wrapS,_.wrapT,_.magFilter,_.minFilter,_.anisotropy,_.colorSpace)}else x=new d.Texture(_.image,_.mapping,_.wrapS,_.wrapT,_.magFilter,_.minFilter,_.format,_.type,_.anisotropy,_.colorSpace),x.mipmaps=_.mipmaps,x.channel=_.channel,x.source.data=_.source.data,x.flipY=_.flipY,x.premultiplyAlpha=_.premultiplyAlpha,x.unpackAlignment=_.unpackAlignment,x.matrix=new d.Matrix3(..._.matrix.elements);if(!x){console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");continue}v.texture=x}return o}function Ti(o){let e=o;if("isInterleavedBufferAttribute"in o&&o.isInterleavedBufferAttribute){const t=o.data,i=t.array,s=new d.InterleavedBuffer(i,t.stride);e=new d.InterleavedBufferAttribute(s,o.itemSize,i.byteOffset,o.normalized),e.offset=o.offset}else"isBufferAttribute"in o&&o.isBufferAttribute&&(e=new d.BufferAttribute(o.array,o.itemSize,o.normalized),e.usage=o.usage,e.gpuType=o.gpuType,e.updateRanges=o.updateRanges);return e}const ga=He("gltf-progressive-worker"),va=He("gltf-progressive-reduce-mipmaps"),Si=Symbol("needle-progressive-texture"),ye="NEEDLE_progressive",O=class O{constructor(e){F(this,"parser");F(this,"url");F(this,"_isLoadingMesh");F(this,"loadMesh",e=>{var i,s;if(this._isLoadingMesh)return null;const t=(s=(i=this.parser.json.meshes[e])==null?void 0:i.extensions)==null?void 0:s[ye];return t?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",e).then(a=>{var n;return this._isLoadingMesh=!1,a&&O.registerMesh(this.url,t.guid,a,(n=t.lods)==null?void 0:n.length,0,t),a})):null});const t=e.options.path;z&&console.log("Progressive extension registered for",t),this.parser=e,this.url=t}get name(){return ye}static getMeshLODExtension(e){const t=this.getAssignedLODInformation(e);return t!=null&&t.key?this.lodInfos.get(t.key):null}static getPrimitiveIndex(e){var i;const t=(i=this.getAssignedLODInformation(e))==null?void 0:i.index;return t??-1}static getMaterialMinMaxLODsCount(e,t){const i=this,s="LODS:minmax",a=e[s];if(a!=null)return a;if(t||(t={min_count:1/0,max_count:0,lods:[]}),Array.isArray(e)){for(const c of e)this.getMaterialMinMaxLODsCount(c,t);return e[s]=t,t}if(z==="verbose"&&console.log("getMaterialMinMaxLODsCount",e),e.type==="ShaderMaterial"||e.type==="RawShaderMaterial"){const c=e;for(const h of Object.keys(c.uniforms)){const f=c.uniforms[h].value;(f==null?void 0:f.isTexture)===!0&&n(f,t)}}else if(e.isMaterial)for(const c of Object.keys(e)){const h=e[c];(h==null?void 0:h.isTexture)===!0&&n(h,t)}else z&&console.warn(`[getMaterialMinMaxLODsCount] Unsupported material type: ${e.type}`);return e[s]=t,t;function n(c,h){const f=i.getAssignedLODInformation(c);if(f){const p=i.lodInfos.get(f.key);if(p&&p.lods){h.min_count=Math.min(h.min_count,p.lods.length),h.max_count=Math.max(h.max_count,p.lods.length);for(let r=0;r<p.lods.length;r++){const l=p.lods[r];l.width&&(h.lods[r]=h.lods[r]||{min_height:1/0,max_height:0},h.lods[r].min_height=Math.min(h.lods[r].min_height,l.height),h.lods[r].max_height=Math.max(h.lods[r].max_height,l.height))}}}}}static hasLODLevelAvailable(e,t){var a;if(Array.isArray(e)){for(const n of e)if(this.hasLODLevelAvailable(n,t))return!0;return!1}if(e.isMaterial===!0){for(const n of Object.keys(e)){const c=e[n];if(c&&c.isTexture&&this.hasLODLevelAvailable(c,t))return!0}return!1}else if(e.isGroup===!0){for(const n of e.children)if(n.isMesh===!0&&this.hasLODLevelAvailable(n,t))return!0}let i,s;if(e.isMesh?i=e.geometry:(e.isBufferGeometry||e.isTexture)&&(i=e),i&&(a=i==null?void 0:i.userData)!=null&&a.LODS){const n=i.userData.LODS;if(s=this.lodInfos.get(n.key),t===void 0)return s!=null;if(s)return Array.isArray(s.lods)?t<s.lods.length:t===0}return!1}static assignMeshLOD(e,t){var i;if(!e)return Promise.resolve(null);if(e instanceof d.Mesh||e.isMesh===!0){const s=e.geometry,a=this.getAssignedLODInformation(s);if(!a)return Promise.resolve(null);for(const n of Re)(i=n.onBeforeGetLODMesh)==null||i.call(n,e,t);return e["LOD:requested level"]=t,O.getOrLoadLOD(s,t).then(n=>{if(Array.isArray(n)){const c=a.index||0;n=n[c]}return e["LOD:requested level"]===t&&(delete e["LOD:requested level"],n&&s!=n&&((n==null?void 0:n.isBufferGeometry)?e.geometry=n:z&&console.error("Invalid LOD geometry",n))),n}).catch(n=>(console.error("Error loading mesh LOD",e,n),null))}else z&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",e);return Promise.resolve(null)}static assignTextureLOD(e,t=0){if(!e)return Promise.resolve(null);if(e.isMesh===!0){const i=e;if(Array.isArray(i.material)){const s=new Array;for(const a of i.material){const n=this.assignTextureLOD(a,t);s.push(n)}return Promise.all(s).then(a=>{const n=new Array;for(const c of a)Array.isArray(c)&&n.push(...c);return n})}else return this.assignTextureLOD(i.material,t)}if(e.isMaterial===!0){const i=e,s=[],a=new Array;if(i.uniforms&&(i.isRawShaderMaterial||i.isShaderMaterial===!0)){const n=i;for(const c of Object.keys(n.uniforms)){const h=n.uniforms[c].value;if((h==null?void 0:h.isTexture)===!0){const f=this.assignTextureLODForSlot(h,t,i,c).then(p=>(p&&n.uniforms[c].value!=p&&(n.uniforms[c].value=p,n.uniformsNeedUpdate=!0),p));s.push(f),a.push(c)}}}else for(const n of Object.keys(i)){const c=i[n];if((c==null?void 0:c.isTexture)===!0){const h=this.assignTextureLODForSlot(c,t,i,n);s.push(h),a.push(n)}}return Promise.all(s).then(n=>{const c=new Array;for(let h=0;h<n.length;h++){const f=n[h],p=a[h];f&&f.isTexture===!0?c.push({material:i,slot:p,texture:f,level:t}):c.push({material:i,slot:p,texture:null,level:t})}return c})}if(e instanceof d.Texture||e.isTexture===!0){const i=e;return this.assignTextureLODForSlot(i,t,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(e,t,i,s){return(e==null?void 0:e.isTexture)!==!0?Promise.resolve(null):s==="glyphMap"?Promise.resolve(e):O.getOrLoadLOD(e,t).then(a=>{var n,c;if(Array.isArray(a))return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."),null;if((a==null?void 0:a.isTexture)===!0){if(a!=e&&i&&s){const h=i[s];if(h&&!z){const f=this.getAssignedLODInformation(h);if(f&&(f==null?void 0:f.level)<t)return z==="verbose"&&console.warn("Assigned texture level is already higher: ",f.level,t,i,h,a),null}if(va&&a.mipmaps){const f=a.mipmaps.length;a.mipmaps.length=Math.min(a.mipmaps.length,3),f!==a.mipmaps.length&&z&&console.debug(`Reduced mipmap count from ${f} to ${a.mipmaps.length} for ${a.uuid}: ${(n=a.image)==null?void 0:n.width}x${(c=a.image)==null?void 0:c.height}.`)}i[s]=a}return a}else z=="verbose"&&console.warn("No LOD found for",e,t);return null}).catch(a=>(console.error("Error loading LOD",e,a),null))}afterRoot(e){var t,i;return z&&console.log("AFTER",this.url,e),(t=this.parser.json.textures)==null||t.forEach((s,a)=>{var n;if(s!=null&&s.extensions){const c=s==null?void 0:s.extensions[ye];if(c){if(!c.lods){z&&console.warn("Texture has no LODs",c);return}let h=!1;for(const f of this.parser.associations.keys())if(f.isTexture===!0){const p=this.parser.associations.get(f);(p==null?void 0:p.textures)===a&&(h=!0,O.registerTexture(this.url,f,(n=c.lods)==null?void 0:n.length,a,c))}h||this.parser.getDependency("texture",a).then(f=>{var p;f&&O.registerTexture(this.url,f,(p=c.lods)==null?void 0:p.length,a,c)})}}}),(i=this.parser.json.meshes)==null||i.forEach((s,a)=>{if(s!=null&&s.extensions){const n=s==null?void 0:s.extensions[ye];if(n&&n.lods){for(const c of this.parser.associations.keys())if(c.isMesh){const h=this.parser.associations.get(c);(h==null?void 0:h.meshes)===a&&O.registerMesh(this.url,n.guid,c,n.lods.length,h.primitives,n)}}}}),null}static async getOrLoadLOD(e,t){var h,f,p,r;const i=z=="verbose",s=this.getAssignedLODInformation(e);if(!s)return z&&console.warn(`[gltf-progressive] No LOD information found: ${e.name}, uuid: ${e.uuid}, type: ${e.type}`,e),null;const a=s==null?void 0:s.key;let n;if(e.isTexture===!0){const l=e;l.source&&l.source[Si]&&(n=l.source[Si])}if(n||(n=O.lodInfos.get(a)),!n)z&&console.warn(`Can not load LOD ${t}: no LOD info found for "${a}" ${e.name}`,e.type,O.lodInfos);else{if(t>0){let g=!1;const y=Array.isArray(n.lods);if(y&&t>=n.lods.length?g=!0:y||(g=!0),g)return this.lowresCache.get(a)}const l=Array.isArray(n.lods)?(h=n.lods[t])==null?void 0:h.path:n.lods;if(!l)return z&&!n["missing:uri"]&&(n["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+t,n)),null;const u=oa(s.url,l);if(u.endsWith(".glb")||u.endsWith(".gltf")){if(!n.guid)return console.warn("missing pointer for glb/gltf texture",n),null;const g=u+"_"+n.guid,y=await this.queue.slot(u),m=this.previouslyLoaded.get(g);if(m!==void 0){i&&console.log(`LOD ${t} was already loading/loaded: ${g}`);let w=await m.catch(T=>(console.error(`Error loading LOD ${t} from ${u}
3681
+ }`}),this.depthWrite=!1,this.depthTest=!1}}class Gs{constructor(e){this._renderer=e,this._quad=new ut.FullScreenQuad(new Jo)}generate(e,t=null,i=null){if(!e.isCubeTexture)throw new Error("CubeToEquirectMaterial: Source can only be cube textures.");const s=e.images[0],a=this._renderer,n=this._quad;t===null&&(t=4*s.height),i===null&&(i=2*s.height);const c=new d.WebGLRenderTarget(t,i,{type:d.FloatType,colorSpace:s.colorSpace}),h=s.height,f=Math.log2(h)-2,p=1/h,r=1/(3*Math.max(Math.pow(2,f),7*16));n.material.defines.CUBEUV_MAX_MIP=`${f}.0`,n.material.defines.CUBEUV_TEXEL_WIDTH=r,n.material.defines.CUBEUV_TEXEL_HEIGHT=p,n.material.uniforms.envMap.value=e,n.material.uniforms.flipEnvMap.value=e.isRenderTargetTexture?1:-1,n.material.needsUpdate=!0;const l=a.getRenderTarget(),u=a.autoClear;a.autoClear=!0,a.setRenderTarget(c),n.render(a),a.setRenderTarget(l),a.autoClear=u;const g=new Uint16Array(t*i*4),y=new Float32Array(t*i*4);a.readRenderTargetPixels(c,0,0,t,i,y),c.dispose();for(let v=0,_=y.length;v<_;v++)g[v]=d.DataUtils.toHalfFloat(y[v]);const m=new d.DataTexture(g,t,i,d.RGBAFormat,d.HalfFloatType);return m.minFilter=d.LinearMipMapLinearFilter,m.magFilter=d.LinearFilter,m.wrapS=d.RepeatWrapping,m.wrapT=d.RepeatWrapping,m.mapping=d.EquirectangularReflectionMapping,m.needsUpdate=!0,m}dispose(){this._quad.dispose()}}function $o(o){return o.extensions.get("EXT_float_blend")}const je=new d.Vector2;class ea{get multipleImportanceSampling(){return!!this._pathTracer.material.defines.FEATURE_MIS}set multipleImportanceSampling(e){this._pathTracer.material.setDefine("FEATURE_MIS",e?1:0)}get transmissiveBounces(){return this._pathTracer.material.transmissiveBounces}set transmissiveBounces(e){this._pathTracer.material.transmissiveBounces=e}get bounces(){return this._pathTracer.material.bounces}set bounces(e){this._pathTracer.material.bounces=e}get filterGlossyFactor(){return this._pathTracer.material.filterGlossyFactor}set filterGlossyFactor(e){this._pathTracer.material.filterGlossyFactor=e}get samples(){return this._pathTracer.samples}get target(){return this._pathTracer.target}get tiles(){return this._pathTracer.tiles}get stableNoise(){return this._pathTracer.stableNoise}set stableNoise(e){this._pathTracer.stableNoise=e}get isCompiling(){return!!this._pathTracer.isCompiling}constructor(e){this._renderer=e,this._generator=new Bn,this._pathTracer=new Us(e),this._queueReset=!1,this._clock=new d.Clock,this._compilePromise=null,this._lowResPathTracer=new Us(e),this._lowResPathTracer.tiles.set(1,1),this._quad=new ut.FullScreenQuad(new Zo({map:null,transparent:!0,blending:d.NoBlending,premultipliedAlpha:e.getContextAttributes().premultipliedAlpha})),this._materials=null,this._previousEnvironment=null,this._previousBackground=null,this._internalBackground=null,this.renderDelay=100,this.minSamples=5,this.fadeDuration=500,this.enablePathTracing=!0,this.pausePathTracing=!1,this.dynamicLowRes=!1,this.lowResScale=.25,this.renderScale=1,this.synchronizeRenderSize=!0,this.rasterizeScene=!0,this.renderToCanvas=!0,this.textureSize=new d.Vector2(1024,1024),this.rasterizeSceneCallback=(t,i)=>{this._renderer.render(t,i)},this.renderToCanvasCallback=(t,i,s)=>{const a=i.autoClear;i.autoClear=!1,s.render(i),i.autoClear=a},this.setScene(new d.Scene,new d.PerspectiveCamera)}setBVHWorker(e){this._generator.setBVHWorker(e)}setScene(e,t,i={}){e.updateMatrixWorld(!0),t.updateMatrixWorld();const s=this._generator;if(s.setObjects(e),this._buildAsync)return s.generateAsync(i.onProgress).then(a=>this._updateFromResults(e,t,a));{const a=s.generate();return this._updateFromResults(e,t,a)}}setSceneAsync(...e){this._buildAsync=!0;const t=this.setScene(...e);return this._buildAsync=!1,t}setCamera(e){this.camera=e,this.updateCamera()}updateCamera(){const e=this.camera;e.updateMatrixWorld(),this._pathTracer.setCamera(e),this._lowResPathTracer.setCamera(e),this.reset()}updateMaterials(){const e=this._pathTracer.material,t=this._renderer,i=this._materials,s=this.textureSize,a=so(i);e.textures.setTextures(t,a,s.x,s.y),e.materials.updateFrom(i,a),this.reset()}updateLights(){const e=this.scene,t=this._renderer,i=this._pathTracer.material,s=ro(e),a=io(s);i.lights.updateFrom(s,a),i.iesProfiles.setTextures(t,a),this.reset()}updateEnvironment(){const e=this.scene,t=this._pathTracer.material;if(this._internalBackground&&(this._internalBackground.dispose(),this._internalBackground=null),t.backgroundBlur=e.backgroundBlurriness,t.backgroundIntensity=e.backgroundIntensity??1,t.backgroundRotation.makeRotationFromEuler(e.backgroundRotation).invert(),e.background===null)t.backgroundMap=null,t.backgroundAlpha=0;else if(e.background.isColor){this._colorBackground=this._colorBackground||new Xo(16);const i=this._colorBackground;i.topColor.equals(e.background)||(i.topColor.set(e.background),i.bottomColor.set(e.background),i.update()),t.backgroundMap=i,t.backgroundAlpha=1}else if(e.background.isCubeTexture){if(e.background!==this._previousBackground){const i=new Gs(this._renderer).generate(e.background);this._internalBackground=i,t.backgroundMap=i,t.backgroundAlpha=1}}else t.backgroundMap=e.background,t.backgroundAlpha=1;if(t.environmentIntensity=e.environmentIntensity??1,t.environmentRotation.makeRotationFromEuler(e.environmentRotation).invert(),this._previousEnvironment!==e.environment)if(e.environment!==null)if(e.environment.isCubeTexture){const i=new Gs(this._renderer).generate(e.environment);t.envMapInfo.updateFrom(i)}else t.envMapInfo.updateFrom(e.environment);else t.environmentIntensity=0;this._previousEnvironment=e.environment,this._previousBackground=e.background,this.reset()}_updateFromResults(e,t,i){const{materials:s,geometry:a,bvh:n,bvhChanged:c}=i;this._materials=s;const f=this._pathTracer.material;return c&&(f.bvh.updateFrom(n),f.attributesArray.updateFrom(a.attributes.normal,a.attributes.tangent,a.attributes.uv,a.attributes.color),f.materialIndexAttribute.updateFrom(a.attributes.materialIndex)),this._previousScene=e,this.scene=e,this.camera=t,this.updateCamera(),this.updateMaterials(),this.updateEnvironment(),this.updateLights(),i}renderSample(){const e=this._lowResPathTracer,t=this._pathTracer,i=this._renderer,s=this._clock,a=this._quad;this._updateScale(),this._queueReset&&(t.reset(),e.reset(),this._queueReset=!1,a.material.opacity=0,s.start());const n=s.getDelta()*1e3,c=s.getElapsedTime()*1e3;if(!this.pausePathTracing&&this.enablePathTracing&&this.renderDelay<=c&&!this.isCompiling&&t.update(),t.alpha=t.material.backgroundAlpha!==1||!$o(i),e.alpha=t.alpha,this.renderToCanvas){const h=this._renderer,f=this.minSamples;if(c>=this.renderDelay&&this.samples>=this.minSamples&&(this.fadeDuration!==0?a.material.opacity=Math.min(a.material.opacity+n/this.fadeDuration,1):a.material.opacity=1),!this.enablePathTracing||this.samples<f||a.material.opacity<1){if(this.dynamicLowRes&&!this.isCompiling){e.samples<1&&(e.material=t.material,e.update());const p=a.material.opacity;a.material.opacity=1-a.material.opacity,a.material.map=e.target.texture,a.render(h),a.material.opacity=p}(!this.dynamicLowRes&&this.rasterizeScene||this.dynamicLowRes&&this.isCompiling)&&this.rasterizeSceneCallback(this.scene,this.camera)}this.enablePathTracing&&a.material.opacity>0&&(a.material.opacity<1&&(a.material.blending=this.dynamicLowRes?d.AdditiveBlending:d.NormalBlending),a.material.map=t.target.texture,this.renderToCanvasCallback(t.target,h,a),a.material.blending=d.NoBlending)}}reset(){this._queueReset=!0,this._pathTracer.samples=0}dispose(){this._renderQuad.dispose(),this._renderQuad.material.dispose(),this._pathTracer.dispose()}_updateScale(){if(this.synchronizeRenderSize){this._renderer.getDrawingBufferSize(je);const e=Math.floor(this.renderScale*je.x),t=Math.floor(this.renderScale*je.y);if(this._pathTracer.getSize(je),je.x!==e||je.y!==t){const i=this.lowResScale;this._pathTracer.setSize(e,t),this._lowResPathTracer.setSize(Math.floor(e*i),Math.floor(t*i))}}}}const ta="";globalThis.GLTF_PROGRESSIVE_VERSION=ta;console.debug("[gltf-progressive] version -");let br="https://www.gstatic.com/draco/versioned/decoders/1.5.7/",ia="https://cdn.needle.tools/static/three/0.179.1/basis2/";const sa=new URL(br+"draco_decoder.js");sa.searchParams.append("range","true");const ra=()=>({dracoDecoderPath:br,ktx2TranscoderPath:ia});function Ar(o){return{dracoLoader:Sr,meshoptDecoder:Mr}}function Tr(o){o.dracoLoader||o.setDRACOLoader(Sr),o.meshoptDecoder||o.setMeshoptDecoder(Mr)}let Sr,Mr;const Hi=new WeakMap;function Cr(o,e){let t=Hi.get(o);t?t=Object.assign(t,e):t=e,Hi.set(o,t)}const Ai=os.GLTFLoader.prototype.load;function na(...o){const e=Hi.get(this);let t=o[0];const i=new URL(t,window.location.href);if(i.hostname.endsWith("needle.tools")){const a=(e==null?void 0:e.progressive)!==void 0?e.progressive:!0,n=e!=null&&e.usecase?e.usecase:"default";a?this.requestHeader.Accept=`*/*;progressive=allowed;usecase=${n}`:this.requestHeader.Accept=`*/*;usecase=${n}`,t=i.toString()}return o[0]=t,Ai==null?void 0:Ai.call(this,...o)}os.GLTFLoader.prototype.load=na;He("debugprogressive");function He(o){if(typeof window>"u")return!1;const t=new URL(window.location.href).searchParams.get(o);return t==null||t==="0"||t==="false"?!1:t===""?!0:t}function oa(o,e){if(e===void 0||o===void 0||e.startsWith("./")||e.startsWith("http")||e.startsWith("data:")||e.startsWith("blob:"))return e;const t=o.lastIndexOf("/");if(t>=0){const i=o.substring(0,t+1);for(;i.endsWith("/")&&e.startsWith("/");)e=e.substring(1);return i+e}return e}function Rr(){return gt!==void 0||(gt=/iPhone|iPad|iPod|Android|IEMobile/i.test(navigator.userAgent),He("debugprogressive")&&console.log("[glTF Progressive]: isMobileDevice",gt)),gt}let gt;function Ns(){if(typeof window>"u")return!1;const o=new URL(window.location.href),e=o.hostname==="localhost"||/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(o.hostname);return o.hostname==="127.0.0.1"||e}class aa{constructor(e=100,t={}){F(this,"_running",new Map);F(this,"_queue",[]);F(this,"debug",!1);F(this,"tick",()=>{this.internalUpdate(),setTimeout(this.tick,10)});this.maxConcurrent=e,this.debug=t.debug??!1,window.requestAnimationFrame(this.tick)}slot(e){return this.debug&&console.debug(`[PromiseQueue]: Requesting slot for key ${e}, running: ${this._running.size}, waiting: ${this._queue.length}`),new Promise(t=>{this._queue.push({key:e,resolve:t})})}add(e,t){this._running.has(e)||(this._running.set(e,t),t.finally(()=>{this._running.delete(e),this.debug&&console.debug(`[PromiseQueue]: Promise finished now running: ${this._running.size}, waiting: ${this._queue.length}. (finished ${e})`)}),this.debug&&console.debug(`[PromiseQueue]: Added new promise, now running: ${this._running.size}, waiting: ${this._queue.length}. (added ${e})`))}internalUpdate(){const e=this.maxConcurrent-this._running.size;for(let t=0;t<e&&this._queue.length>0;t++){this.debug&&console.debug(`[PromiseQueue]: Running ${this._running.size} promises, waiting for ${this._queue.length} more.`);const{key:i,resolve:s}=this._queue.shift();s({use:a=>this.add(i,a)})}}}const la=typeof window>"u"&&typeof document>"u",Gi=Symbol("needle:raycast-mesh");function Bt(o){return(o==null?void 0:o[Gi])instanceof d.BufferGeometry?o[Gi]:null}function ca(o,e){if((o.type==="Mesh"||o.type==="SkinnedMesh")&&!Bt(o)){const i=ua(e);i.userData={isRaycastMesh:!0},o[Gi]=i}}function ha(o=!0){if(o){if(vt)return;const e=vt=d.Mesh.prototype.raycast;d.Mesh.prototype.raycast=function(t,i){const s=this,a=Bt(s);let n;a&&s.isMesh&&(n=s.geometry,s.geometry=a),e.call(this,t,i),n&&(s.geometry=n)}}else{if(!vt)return;d.Mesh.prototype.raycast=vt,vt=null}}let vt=null;function ua(o){const e=new d.BufferGeometry;for(const t in o.attributes)e.setAttribute(t,o.getAttribute(t));return e.setIndex(o.getIndex()),e}const Re=new Array,z=He("debugprogressive");let It,Ve=-1;if(z){let o=function(){Ve+=1,Ve>=e&&(Ve=-1),console.log(`Toggle LOD level [${Ve}]`)},e=6;window.addEventListener("keyup",t=>{t.key==="p"&&o(),t.key==="w"&&(It=!It,console.log(`Toggle wireframe [${It}]`));const i=parseInt(t.key);!isNaN(i)&&i>=0&&(Ve=i,console.log(`Set LOD level to [${Ve}]`))})}function Lr(o){if(z&&It!==void 0)if(Array.isArray(o))for(const e of o)Lr(e);else o&&"wireframe"in o&&(o.wireframe=It===!0)}const _t=new Array;let fa=0;const da=Rr()?2:10;function pa(o){if(_t.length<da){const i=_t.length;z&&console.warn(`[Worker] Creating new worker #${i}`);const s=hs.createWorker(o||{});return _t.push(s),s}const e=fa++%_t.length;return _t[e]}class hs{constructor(e,t){F(this,"_running",[]);F(this,"_webglRenderer",null);F(this,"_debug",!1);this.worker=e,this._debug=t.debug??!1,e.onmessage=i=>{const s=i.data;switch(this._debug&&console.log("[Worker] EVENT",s),s.type){case"loaded-gltf":for(const a of this._running)if(a.url===s.result.url){ma(s.result),a.resolve(s.result);const n=a.url;n.startsWith("blob:")&&URL.revokeObjectURL(n)}}},e.onerror=i=>{console.error("[Worker] Error in gltf-progressive worker:",i)},e.postMessage({type:"init"})}static async createWorker(e){const t=new Worker(new URL(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/loader.worker-46d0lFWx.js").href:new URL("assets/loader.worker-46d0lFWx.js",document.currentScript&&document.currentScript.src||document.baseURI).href),typeof document>"u"?require("url").pathToFileURL(__filename).href:ft&&ft.src||new URL("shop-components.cjs",document.baseURI).href),{type:"module"});return new hs(t,e)}async load(e,t){const i=ra();let s=t==null?void 0:t.renderer;s||(this._webglRenderer??(this._webglRenderer=(async()=>{const{WebGLRenderer:f}=await import("three");return new f})()),s=await this._webglRenderer);const c=Ar().ktx2Loader.workerConfig;e instanceof URL?e=e.toString():e.startsWith("file:")?e=URL.createObjectURL(new Blob([e])):!e.startsWith("blob:")&&!e.startsWith("http:")&&!e.startsWith("https:")&&(e=new URL(e,window.location.href).toString());const h={type:"load",url:e,dracoDecoderPath:i.dracoDecoderPath,ktx2TranscoderPath:i.ktx2TranscoderPath,ktx2LoaderConfig:c};return this._debug&&console.debug("[Worker] Sending load request",h),this.worker.postMessage(h),new Promise(f=>{this._running.push({url:e.toString(),resolve:f})})}}function ma(o){var e,t,i,s,a,n,c,h,f,p,r,l,u,g,y,m;for(const v of o.geometries){const _=v.geometry,x=new d.BufferGeometry;if(x.name=_.name||"",_.index){const w=_.index;x.setIndex(Ti(w))}for(const w in _.attributes){const b=_.attributes[w],T=Ti(b);x.setAttribute(w,T)}if(_.morphAttributes)for(const w in _.morphAttributes){const T=_.morphAttributes[w].map(S=>Ti(S));x.morphAttributes[w]=T}if(x.morphTargetsRelative=_.morphTargetsRelative??!1,x.boundingBox=new d.Box3,x.boundingBox.min=new d.Vector3((e=_.boundingBox)==null?void 0:e.min.x,(t=_.boundingBox)==null?void 0:t.min.y,(i=_.boundingBox)==null?void 0:i.min.z),x.boundingBox.max=new d.Vector3((s=_.boundingBox)==null?void 0:s.max.x,(a=_.boundingBox)==null?void 0:a.max.y,(n=_.boundingBox)==null?void 0:n.max.z),x.boundingSphere=new d.Sphere(new d.Vector3((c=_.boundingSphere)==null?void 0:c.center.x,(h=_.boundingSphere)==null?void 0:h.center.y,(f=_.boundingSphere)==null?void 0:f.center.z),(p=_.boundingSphere)==null?void 0:p.radius),_.groups)for(const w of _.groups)x.addGroup(w.start,w.count,w.materialIndex);_.userData&&(x.userData=_.userData),v.geometry=x}for(const v of o.textures){const _=v.texture;let x=null;if(_.isCompressedTexture){const w=_.mipmaps,b=((r=_.image)==null?void 0:r.width)||((u=(l=_.source)==null?void 0:l.data)==null?void 0:u.width)||-1,T=((g=_.image)==null?void 0:g.height)||((m=(y=_.source)==null?void 0:y.data)==null?void 0:m.height)||-1;x=new d.CompressedTexture(w,b,T,_.format,_.type,_.mapping,_.wrapS,_.wrapT,_.magFilter,_.minFilter,_.anisotropy,_.colorSpace)}else x=new d.Texture(_.image,_.mapping,_.wrapS,_.wrapT,_.magFilter,_.minFilter,_.format,_.type,_.anisotropy,_.colorSpace),x.mipmaps=_.mipmaps,x.channel=_.channel,x.source.data=_.source.data,x.flipY=_.flipY,x.premultiplyAlpha=_.premultiplyAlpha,x.unpackAlignment=_.unpackAlignment,x.matrix=new d.Matrix3(..._.matrix.elements);if(!x){console.error("[Worker] Failed to create new texture from received data. Texture is not a CompressedTexture or Texture.");continue}v.texture=x}return o}function Ti(o){let e=o;if("isInterleavedBufferAttribute"in o&&o.isInterleavedBufferAttribute){const t=o.data,i=t.array,s=new d.InterleavedBuffer(i,t.stride);e=new d.InterleavedBufferAttribute(s,o.itemSize,i.byteOffset,o.normalized),e.offset=o.offset}else"isBufferAttribute"in o&&o.isBufferAttribute&&(e=new d.BufferAttribute(o.array,o.itemSize,o.normalized),e.usage=o.usage,e.gpuType=o.gpuType,e.updateRanges=o.updateRanges);return e}const ga=He("gltf-progressive-worker"),va=He("gltf-progressive-reduce-mipmaps"),Si=Symbol("needle-progressive-texture"),ye="NEEDLE_progressive",O=class O{constructor(e){F(this,"parser");F(this,"url");F(this,"_isLoadingMesh");F(this,"loadMesh",e=>{var i,s;if(this._isLoadingMesh)return null;const t=(s=(i=this.parser.json.meshes[e])==null?void 0:i.extensions)==null?void 0:s[ye];return t?(this._isLoadingMesh=!0,this.parser.getDependency("mesh",e).then(a=>{var n;return this._isLoadingMesh=!1,a&&O.registerMesh(this.url,t.guid,a,(n=t.lods)==null?void 0:n.length,0,t),a})):null});const t=e.options.path;z&&console.log("Progressive extension registered for",t),this.parser=e,this.url=t}get name(){return ye}static getMeshLODExtension(e){const t=this.getAssignedLODInformation(e);return t!=null&&t.key?this.lodInfos.get(t.key):null}static getPrimitiveIndex(e){var i;const t=(i=this.getAssignedLODInformation(e))==null?void 0:i.index;return t??-1}static getMaterialMinMaxLODsCount(e,t){const i=this,s="LODS:minmax",a=e[s];if(a!=null)return a;if(t||(t={min_count:1/0,max_count:0,lods:[]}),Array.isArray(e)){for(const c of e)this.getMaterialMinMaxLODsCount(c,t);return e[s]=t,t}if(z==="verbose"&&console.log("getMaterialMinMaxLODsCount",e),e.type==="ShaderMaterial"||e.type==="RawShaderMaterial"){const c=e;for(const h of Object.keys(c.uniforms)){const f=c.uniforms[h].value;(f==null?void 0:f.isTexture)===!0&&n(f,t)}}else if(e.isMaterial)for(const c of Object.keys(e)){const h=e[c];(h==null?void 0:h.isTexture)===!0&&n(h,t)}else z&&console.warn(`[getMaterialMinMaxLODsCount] Unsupported material type: ${e.type}`);return e[s]=t,t;function n(c,h){const f=i.getAssignedLODInformation(c);if(f){const p=i.lodInfos.get(f.key);if(p&&p.lods){h.min_count=Math.min(h.min_count,p.lods.length),h.max_count=Math.max(h.max_count,p.lods.length);for(let r=0;r<p.lods.length;r++){const l=p.lods[r];l.width&&(h.lods[r]=h.lods[r]||{min_height:1/0,max_height:0},h.lods[r].min_height=Math.min(h.lods[r].min_height,l.height),h.lods[r].max_height=Math.max(h.lods[r].max_height,l.height))}}}}}static hasLODLevelAvailable(e,t){var a;if(Array.isArray(e)){for(const n of e)if(this.hasLODLevelAvailable(n,t))return!0;return!1}if(e.isMaterial===!0){for(const n of Object.keys(e)){const c=e[n];if(c&&c.isTexture&&this.hasLODLevelAvailable(c,t))return!0}return!1}else if(e.isGroup===!0){for(const n of e.children)if(n.isMesh===!0&&this.hasLODLevelAvailable(n,t))return!0}let i,s;if(e.isMesh?i=e.geometry:(e.isBufferGeometry||e.isTexture)&&(i=e),i&&(a=i==null?void 0:i.userData)!=null&&a.LODS){const n=i.userData.LODS;if(s=this.lodInfos.get(n.key),t===void 0)return s!=null;if(s)return Array.isArray(s.lods)?t<s.lods.length:t===0}return!1}static assignMeshLOD(e,t){var i;if(!e)return Promise.resolve(null);if(e instanceof d.Mesh||e.isMesh===!0){const s=e.geometry,a=this.getAssignedLODInformation(s);if(!a)return Promise.resolve(null);for(const n of Re)(i=n.onBeforeGetLODMesh)==null||i.call(n,e,t);return e["LOD:requested level"]=t,O.getOrLoadLOD(s,t).then(n=>{if(Array.isArray(n)){const c=a.index||0;n=n[c]}return e["LOD:requested level"]===t&&(delete e["LOD:requested level"],n&&s!=n&&((n==null?void 0:n.isBufferGeometry)?e.geometry=n:z&&console.error("Invalid LOD geometry",n))),n}).catch(n=>(console.error("Error loading mesh LOD",e,n),null))}else z&&console.error("Invalid call to assignMeshLOD: Request mesh LOD but the object is not a mesh",e);return Promise.resolve(null)}static assignTextureLOD(e,t=0){if(!e)return Promise.resolve(null);if(e.isMesh===!0){const i=e;if(Array.isArray(i.material)){const s=new Array;for(const a of i.material){const n=this.assignTextureLOD(a,t);s.push(n)}return Promise.all(s).then(a=>{const n=new Array;for(const c of a)Array.isArray(c)&&n.push(...c);return n})}else return this.assignTextureLOD(i.material,t)}if(e.isMaterial===!0){const i=e,s=[],a=new Array;if(i.uniforms&&(i.isRawShaderMaterial||i.isShaderMaterial===!0)){const n=i;for(const c of Object.keys(n.uniforms)){const h=n.uniforms[c].value;if((h==null?void 0:h.isTexture)===!0){const f=this.assignTextureLODForSlot(h,t,i,c).then(p=>(p&&n.uniforms[c].value!=p&&(n.uniforms[c].value=p,n.uniformsNeedUpdate=!0),p));s.push(f),a.push(c)}}}else for(const n of Object.keys(i)){const c=i[n];if((c==null?void 0:c.isTexture)===!0){const h=this.assignTextureLODForSlot(c,t,i,n);s.push(h),a.push(n)}}return Promise.all(s).then(n=>{const c=new Array;for(let h=0;h<n.length;h++){const f=n[h],p=a[h];f&&f.isTexture===!0?c.push({material:i,slot:p,texture:f,level:t}):c.push({material:i,slot:p,texture:null,level:t})}return c})}if(e instanceof d.Texture||e.isTexture===!0){const i=e;return this.assignTextureLODForSlot(i,t,null,null)}return Promise.resolve(null)}static assignTextureLODForSlot(e,t,i,s){return(e==null?void 0:e.isTexture)!==!0?Promise.resolve(null):s==="glyphMap"?Promise.resolve(e):O.getOrLoadLOD(e,t).then(a=>{var n,c;if(Array.isArray(a))return console.warn("Progressive: Got an array of textures for a texture slot, this should not happen..."),null;if((a==null?void 0:a.isTexture)===!0){if(a!=e&&i&&s){const h=i[s];if(h&&!z){const f=this.getAssignedLODInformation(h);if(f&&(f==null?void 0:f.level)<t)return z==="verbose"&&console.warn("Assigned texture level is already higher: ",f.level,t,i,h,a),null}if(va&&a.mipmaps){const f=a.mipmaps.length;a.mipmaps.length=Math.min(a.mipmaps.length,3),f!==a.mipmaps.length&&z&&console.debug(`Reduced mipmap count from ${f} to ${a.mipmaps.length} for ${a.uuid}: ${(n=a.image)==null?void 0:n.width}x${(c=a.image)==null?void 0:c.height}.`)}i[s]=a}return a}else z=="verbose"&&console.warn("No LOD found for",e,t);return null}).catch(a=>(console.error("Error loading LOD",e,a),null))}afterRoot(e){var t,i;return z&&console.log("AFTER",this.url,e),(t=this.parser.json.textures)==null||t.forEach((s,a)=>{var n;if(s!=null&&s.extensions){const c=s==null?void 0:s.extensions[ye];if(c){if(!c.lods){z&&console.warn("Texture has no LODs",c);return}let h=!1;for(const f of this.parser.associations.keys())if(f.isTexture===!0){const p=this.parser.associations.get(f);(p==null?void 0:p.textures)===a&&(h=!0,O.registerTexture(this.url,f,(n=c.lods)==null?void 0:n.length,a,c))}h||this.parser.getDependency("texture",a).then(f=>{var p;f&&O.registerTexture(this.url,f,(p=c.lods)==null?void 0:p.length,a,c)})}}}),(i=this.parser.json.meshes)==null||i.forEach((s,a)=>{if(s!=null&&s.extensions){const n=s==null?void 0:s.extensions[ye];if(n&&n.lods){for(const c of this.parser.associations.keys())if(c.isMesh){const h=this.parser.associations.get(c);(h==null?void 0:h.meshes)===a&&O.registerMesh(this.url,n.guid,c,n.lods.length,h.primitives,n)}}}}),null}static async getOrLoadLOD(e,t){var h,f,p,r;const i=z=="verbose",s=this.getAssignedLODInformation(e);if(!s)return z&&console.warn(`[gltf-progressive] No LOD information found: ${e.name}, uuid: ${e.uuid}, type: ${e.type}`,e),null;const a=s==null?void 0:s.key;let n;if(e.isTexture===!0){const l=e;l.source&&l.source[Si]&&(n=l.source[Si])}if(n||(n=O.lodInfos.get(a)),!n)z&&console.warn(`Can not load LOD ${t}: no LOD info found for "${a}" ${e.name}`,e.type,O.lodInfos);else{if(t>0){let g=!1;const y=Array.isArray(n.lods);if(y&&t>=n.lods.length?g=!0:y||(g=!0),g)return this.lowresCache.get(a)}const l=Array.isArray(n.lods)?(h=n.lods[t])==null?void 0:h.path:n.lods;if(!l)return z&&!n["missing:uri"]&&(n["missing:uri"]=!0,console.warn("Missing uri for progressive asset for LOD "+t,n)),null;const u=oa(s.url,l);if(u.endsWith(".glb")||u.endsWith(".gltf")){if(!n.guid)return console.warn("missing pointer for glb/gltf texture",n),null;const g=u+"_"+n.guid,y=await this.queue.slot(u),m=this.previouslyLoaded.get(g);if(m!==void 0){i&&console.log(`LOD ${t} was already loading/loaded: ${g}`);let w=await m.catch(T=>(console.error(`Error loading LOD ${t} from ${u}
3682
3682
  `,T),null)),b=!1;if(w==null||(w instanceof d.Texture&&e instanceof d.Texture?(f=w.image)!=null&&f.data||(p=w.source)!=null&&p.data?w=this.copySettings(e,w):(b=!0,this.previouslyLoaded.delete(g)):w instanceof d.BufferGeometry&&e instanceof d.BufferGeometry&&((r=w.attributes.position)!=null&&r.array||(b=!0,this.previouslyLoaded.delete(g)))),!b)return w}if(!y.use)return z&&console.log(`LOD ${t} was aborted: ${u}`),null;const v=n,_=new Promise(async(w,b)=>{if(ga){const A=await(await pa({})).load(u);if(A.textures.length>0)for(const M of A.textures){let I=M.texture;return O.assignLODInformation(s.url,I,a,t,void 0),e instanceof d.Texture&&(I=this.copySettings(e,I)),I&&(I.guid=v.guid),w(I)}if(A.geometries.length>0){const M=new Array;for(const I of A.geometries){const P=I.geometry;O.assignLODInformation(s.url,P,a,t,I.primitiveIndex),M.push(P)}return w(M)}return w(null)}const T=new os.GLTFLoader;Tr(T),z&&(await new Promise(R=>setTimeout(R,1e3)),i&&console.warn("Start loading (delayed) "+u,v.guid));let S=u;if(v&&Array.isArray(v.lods)){const R=v.lods[t];R.hash&&(S+="?v="+R.hash)}const L=await T.loadAsync(S).catch(R=>(console.error(`Error loading LOD ${t} from ${u}
3683
3683
  `,R),w(null)));if(!L)return w(null);const C=L.parser;i&&console.log("Loading finished "+u,v.guid);let D=0;if(L.parser.json.textures){let R=!1;for(const A of L.parser.json.textures){if(A!=null&&A.extensions){const M=A==null?void 0:A.extensions[ye];if(M!=null&&M.guid&&M.guid===v.guid){R=!0;break}}D++}if(R){let A=await C.getDependency("texture",D);return A&&O.assignLODInformation(s.url,A,a,t,void 0),i&&console.log('change "'+e.name+'" → "'+A.name+'"',u,D,A,g),e instanceof d.Texture&&(A=this.copySettings(e,A)),A&&(A.guid=v.guid),w(A)}else z&&console.warn("Could not find texture with guid",v.guid,L.parser.json)}if(D=0,L.parser.json.meshes){let R=!1;for(const A of L.parser.json.meshes){if(A!=null&&A.extensions){const M=A==null?void 0:A.extensions[ye];if(M!=null&&M.guid&&M.guid===v.guid){R=!0;break}}D++}if(R){const A=await C.getDependency("mesh",D);if(i&&console.log(`Loaded Mesh "${A.name}"`,u,D,A,g),A.isMesh===!0){const M=A.geometry;return O.assignLODInformation(s.url,M,a,t,0),w(M)}else{const M=new Array;for(let I=0;I<A.children.length;I++){const P=A.children[I];if(P.isMesh===!0){const E=P.geometry;O.assignLODInformation(s.url,E,a,t,I),M.push(E)}}return w(M)}}else z&&console.warn("Could not find mesh with guid",v.guid,L.parser.json)}return w(null)});return this.previouslyLoaded.set(g,_),y.use(_),await _}else if(e instanceof d.Texture){i&&console.log("Load texture from uri: "+u);const y=await new d.TextureLoader().loadAsync(u);return y?(y.guid=n.guid,y.flipY=!1,y.needsUpdate=!0,y.colorSpace=e.colorSpace,i&&console.log(n,y)):z&&console.warn("failed loading",u),y}}return null}static assignLODInformation(e,t,i,s,a){if(!t)return;t.userData||(t.userData={});const n=new _a(e,i,s,a);t.userData.LODS=n,"source"in t&&typeof t.source=="object"&&(t.source.LODS=n)}static getAssignedLODInformation(e){var t,i;return e?(t=e.userData)!=null&&t.LODS?e.userData.LODS:"source"in e&&((i=e.source)!=null&&i.LODS)?e.source.LODS:null:null}static copySettings(e,t){return t?(z==="verbose"&&console.debug(`Copy texture settings
3684
3684
  `,e.uuid,`
@@ -3944,4 +3944,4 @@ vec3 texelOld = texture2D(previousShadowMap, vUv).rgb;
3944
3944
  [data-css2d-root="1"] [data-ui-type="mechanism"] {
3945
3945
  z-index: 2147483647 !important;
3946
3946
  }
3947
- `,document.head.append(t),this._css2dUiStyleInjected=!0}updatePosition(){}removeFromParent(){var t;const e=this.renderer.domElement.parentElement;e&&((t=this._resizeObserver)==null||t.unobserve(e),e.removeChild(this.renderer.domElement))}clean(){this.amr.clean(),this._progressShadow.clear()}destroy(){var t,i,s,a,n,c;this._destroyed=!0,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._clock.stop(),(t=this._controlsGizmo)==null||t.destroy(),this.amr.destroy(),this.amr.removeFromParent(),this._progressShadow.destroy(),(i=this._sciFiGrid)==null||i.removeFromParent(),(s=this._sciFiGrid)==null||s.geometry.dispose(),(a=this._sciFiGrid.material)==null||a.dispose(),Pe.removeAll(),this.stats.dom.remove(),this._emitter.removeAllListeners(),(n=this._fitAnimation)==null||n.stop(),window.removeEventListener("drag",this._drag),document.removeEventListener("wheel",this._detectTrackpad),window.removeEventListener("pointermove",this._pointermove),this.renderer.domElement.removeEventListener("pointerdown",this._pointerdown);const e=this.renderer.domElement.parentElement;e&&((c=this._resizeObserver)==null||c.unobserve(e)),this.controls.dispose(),this.renderer.domElement.remove(),this.renderer.dispose(),be(this.scene),this.scene.clear()}}class Xr{constructor(e){this.deps=e,this.canvas=null,this.pixelBuffer=null,this.orthoCamera=new d.OrthographicCamera(-1,1,1,-1,.1,1e3),this.orthoCamera.position.set(0,0,5),this.perspectiveCamera=new d.PerspectiveCamera(45,1,.1,2e3)}async capture(e){var g,y,m,v,_,x;const t=this.deps.renderer,i=(e==null?void 0:e.subject)??this.deps.subject;if(!i)throw new Error("TriViewCapture: subject is required.");const s=new d.Vector2;t.getSize(s);const a=((g=e==null?void 0:e.size)==null?void 0:g.width)??Math.round(s.x),n=((y=e==null?void 0:e.size)==null?void 0:y.height)??Math.round(s.y),c=(e==null?void 0:e.margin)??.15,h=(e==null?void 0:e.includeOverlay)??!1,f=a/n||1,p=this.resolveViews(e==null?void 0:e.views),r=new d.WebGLRenderTarget(a,n,{format:d.RGBAFormat,type:d.UnsignedByteType});r.texture.colorSpace=d.SRGBColorSpace,r.texture.generateMipmaps=!1,r.depthBuffer=!0;const l=this.storeRendererState(t),u={};try{(v=(m=this.deps).onBeforeCapture)==null||v.call(m);const w=this.computeBounds(i);this.applyRendererState(t,a,n,e==null?void 0:e.backgroundColor);for(const b of p){const T=this.configureCamera(w,b,f,c,a,n);t.setRenderTarget(r),t.clear(!0,!0,!0),t.render(this.deps.scene,T),h&&this.deps.overlayScene&&(t.clearDepth(),t.render(this.deps.overlayScene,T));const S=this.readPixels(t,r,a,n);u[b.key]=S}}finally{r.dispose(),this.restoreRendererState(t,l),(x=(_=this.deps).onAfterCapture)==null||x.call(_)}return u}resolveViews(e){return e&&e.length?e.map(t=>({key:t.key,direction:t.direction.clone(),up:t.up.clone(),plane:t.plane})):[{key:"top",direction:new d.Vector3(0,0,1),up:new d.Vector3(0,1,0),plane:{width:"x",height:"y",depth:"z"}},{key:"front",direction:new d.Vector3(0,-1,0),up:new d.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"}},{key:"side",direction:new d.Vector3(1,0,0),up:new d.Vector3(0,0,1),plane:{width:"y",height:"z",depth:"x"}},{key:"perspective",direction:new d.Vector3(1,1,1),up:new d.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"},mode:"perspective",fov:39.6}]}computeBounds(e){const t=new d.Box3,i=new d.Box3,s=new d.Vector3,a=new d.Vector3,n=new d.Sphere;return e.updateMatrixWorld(!0),e.traverse(c=>{if(!c.visible)return;const f=c.geometry;if(!f)return;f.boundingBox||f.computeBoundingBox();const p=f.boundingBox;p&&(i.copy(p).applyMatrix4(c.matrixWorld),t.union(i))}),t.isEmpty()?(t.setFromCenterAndSize(s,new d.Vector3(.001,.001,.001)),a.set(.001,.001,.001),n.center.copy(s),n.radius=.001):(t.getCenter(s),t.getSize(a),t.getBoundingSphere(n)),(!Number.isFinite(n.radius)||n.radius<=0)&&(n.radius=Math.max(a.length()*.5,.001)),{box:t,center:s,size:a,sphere:n}}configureCamera(e,t,i,s,a,n){const c=t.direction.clone().normalize();c.lengthSq()===0&&c.set(0,0,1);const h=t.up.clone().normalize();if(Math.abs(h.dot(c))>.999&&(h.set(0,0,1),Math.abs(h.dot(c))>.999&&h.set(0,1,0)),(t.mode??"orthographic")==="perspective"){const w=this.perspectiveCamera,b=t.fov??45,T=d.MathUtils.degToRad(b),S=Math.max(Math.tan(T/2),1e-4),L=Math.max(S*(i||1),1e-4),C=this.getPerspectiveDirection(t,e.size).normalize(),D=new d.Vector3().crossVectors(C,h).normalize();D.lengthSq()<1e-6&&D.set(1,0,0);const R=new d.Vector3().crossVectors(D,C).normalize(),A=Math.max(e.size.x*.5,1e-4),M=Math.max(e.size.y*.5,1e-4),I=Math.max(e.size.z*.5,1e-4),P=[new d.Vector3(-A,-M,-I),new d.Vector3(-A,-M,I),new d.Vector3(-A,M,-I),new d.Vector3(-A,M,I),new d.Vector3(A,-M,-I),new d.Vector3(A,-M,I),new d.Vector3(A,M,-I),new d.Vector3(A,M,I)];let E=0,B=-1/0;for(const H of P){const j=D.dot(H),U=R.dot(H),Q=C.dot(H);B=Math.max(B,Q);const re=Q+Math.abs(j)/L,te=Q+Math.abs(U)/S;E=Math.max(E,re,te)}E=Math.max(E,B+.1);const V=E*(1+s);let G=1/0;for(const H of P){const j=C.dot(H),U=V-j;U>.001&&(G=Math.min(G,U))}return w.fov=b,w.aspect=i||a/Math.max(n,1),w.near=Math.max(.1,Number.isFinite(G)?G*.5:V*.1),w.far=Math.max(w.near+1,V+e.sphere.radius*3),w.position.copy(e.center).add(C.clone().multiplyScalar(V)),w.up.copy(R),w.lookAt(e.center),w.updateProjectionMatrix(),w.updateMatrixWorld(!0),w}const p=this.orthoCamera,r=e.size,l=e.center,u=Math.max(r[t.plane.width]*.5,.01),g=Math.max(r[t.plane.height]*.5,.01),y=Math.max(r[t.plane.depth]*.5,.01);let m=u*(1+s),v=g*(1+s);m/i>v?v=m/i:m=v*i;const _=y*(1+s)+Math.max(m,v),x=l.clone().add(c.multiplyScalar(_));return p.left=-m,p.right=m,p.top=v,p.bottom=-v,p.near=.1,p.far=_*4,p.zoom=1,p.position.copy(x),p.up.copy(h),p.lookAt(l),p.updateProjectionMatrix(),p.updateMatrixWorld(!0),p}getPerspectiveDirection(e,t){const i=e.direction.clone();i.lengthSq()===0&&i.set(1,1,1);const s=new d.Vector3(Math.abs(i.x)||1,Math.abs(i.y)||1,Math.abs(i.z)||1),a=new d.Vector3(Math.sign(i.x||1),Math.sign(i.y||1),Math.sign(i.z||1)),n=.25,c=new d.Vector3(Math.max(n,s.x)*Math.max(t.x,.001),Math.max(n,s.y)*Math.max(t.y,.001),0),h=Math.max((t.x+t.y)*.5,.001),f=Math.max(t.z,.001),p=Math.max(n,s.z),r=f*.5+h*.5;return c.z=p*r,c.multiply(a),c}storeRendererState(e){const t=new d.Vector2;e.getSize(t);const i=new d.Vector4;e.getViewport(i);const s=new d.Vector4;e.getScissor(s);const a=e.getClearColor(new d.Color),n=e.getClearAlpha();return{size:t,pixelRatio:e.getPixelRatio(),viewport:i,scissor:s,scissorTest:e.getScissorTest(),autoClear:e.autoClear,target:e.getRenderTarget(),clearColor:a,clearAlpha:n}}applyRendererState(e,t,i,s){if(e.setPixelRatio(1),e.setSize(t,i,!1),e.setViewport(0,0,t,i),e.setScissor(0,0,t,i),e.setScissorTest(!1),e.autoClear=!0,s!==void 0)if(s===null){const a=e.getClearColor(new d.Color);e.setClearColor(a,0)}else s instanceof d.Color?e.setClearColor(s,1):e.setClearColor(new d.Color(s),1);else{const a=e.getClearColor(new d.Color);e.setClearColor(a,0)}}restoreRendererState(e,t){e.setPixelRatio(t.pixelRatio),e.setSize(t.size.x,t.size.y,!1),e.setViewport(t.viewport.x,t.viewport.y,t.viewport.z,t.viewport.w),e.setScissor(t.scissor.x,t.scissor.y,t.scissor.z,t.scissor.w),e.setScissorTest(t.scissorTest),e.autoClear=t.autoClear,e.setRenderTarget(t.target),e.setClearColor(t.clearColor,t.clearAlpha)}readPixels(e,t,i,s){const a=i*s*4;(!this.pixelBuffer||this.pixelBuffer.length!==a)&&(this.pixelBuffer=new Uint8Array(a)),e.readRenderTargetPixels(t,0,0,i,s,this.pixelBuffer);const n=this.ensureCanvas(i,s),c=n.getContext("2d");if(!c)throw new Error("TriViewCapture: failed to get 2D context.");const h=c.createImageData(i,s),f=h.data,p=this.pixelBuffer;for(let r=0;r<s;r+=1){const u=(s-r-1)*i*4,g=r*i*4;f.set(p.subarray(u,u+i*4),g)}return c.putImageData(h,0,0),n.toDataURL("image/png")}ensureCanvas(e,t){if(typeof document>"u")throw new Error("TriViewCapture: document is not available in this environment.");return this.canvas||(this.canvas=document.createElement("canvas")),(this.canvas.width!==e||this.canvas.height!==t)&&(this.canvas.width=e,this.canvas.height=t),this.canvas}}const Mc="shop-components",Cc="0.4.21",Rc="Shop components",Lc="dist/shop-components.umd.js",Ic="dist/shop-components.mjs",Dc="dist/main.d.ts",Pc={dts:"tsc --emitDeclarationOnly & tsc & storybook build -o dist",dev:"vite dev",build:"vite build","build:web":"BUILD_WEB=1 vite build --outDir dist/web --emptyOutDir",v:"auto-changelog -p && git add CHANGELOG.md"},Fc=["dist","package.json"],Ec=[],Bc="machengda<machengda@seer-group.com>",kc="ISC",Oc={"@needle-tools/gltf-progressive":"^3.3.5","auto-changelog":"^2.4.0",vite:"5.1.6","vite-plugin-dts":"^3.7.3"},zc={"string-width":"4.2.3"},Vc={"@nodetoy/three-nodetoy":"^0.1.36","@tweakpane/core":"^2.0.3","@tweenjs/tween.js":"^23.1.2","@types/bezier-js":"^4.1.1","@types/howler":"^2.2.11","@types/three":"0.182.0","bezier-js":"^6.1.4",eventemitter3:"^5.0.1",howler:"^2.2.4","stats-fps.js":"0.0.6",stylus:"^0.63.0",terser:"^5.44.0",three:"0.182.0","three-gpu-pathtracer":"^0.0.23","three-mesh-bvh":"^0.7.5","troika-three-text":"^0.49.1",tweakpane:"^4.0.3"},Uc={name:Mc,version:Cc,description:Rc,main:Lc,module:Ic,types:Dc,scripts:Pc,files:Fc,keywords:Ec,author:Bc,license:kc,devDependencies:Oc,resolutions:zc,dependencies:Vc};function dr(){const o="Nebula Engin",e=Uc.version,t=`%c ${o} %c v${e} `;console.log(t,"background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;","background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;")}const pr="__SHOP_COMPONENTS_BANNER_PRINTED__";try{const o=globalThis;o[pr]||(o[pr]=!0,dr())}catch{dr()}exports.Amr=Wr;exports.Logo=Yi;exports.SGLBLoader=Et;exports.SLOT_EVENTS=X;exports.Scene3D=Sc;exports.Skin=rs;exports.Slot=Qi;exports.SlotState=Kr;exports.TriViewCapture=Xr;exports.arrayBufferToUrl=qi;exports.calculateArrayAverage=Br;exports.calculateFocalLength=Ea;exports.createSGLBFile=ja;exports.downloadBlob=Fa;exports.dracoExporter=qa;exports.font=bc;exports.gltfExporter=zr;exports.gltfLoader=We;exports.imageBitmapToUrl=ji;exports.isAppleDevice=kr;exports.textureLoader=ds;
3947
+ `,document.head.append(t),this._css2dUiStyleInjected=!0}updatePosition(){}removeFromParent(){var t;const e=this.renderer.domElement.parentElement;e&&((t=this._resizeObserver)==null||t.unobserve(e),e.removeChild(this.renderer.domElement))}clean(){this.amr.clean(),this._progressShadow.clear()}destroy(){var t,i,s,a,n,c;this._destroyed=!0,this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._clock.stop(),(t=this._controlsGizmo)==null||t.destroy(),this.amr.destroy(),this.amr.removeFromParent(),this._progressShadow.destroy(),(i=this._sciFiGrid)==null||i.removeFromParent(),(s=this._sciFiGrid)==null||s.geometry.dispose(),(a=this._sciFiGrid.material)==null||a.dispose(),Pe.removeAll(),this.stats.dom.remove(),this._emitter.removeAllListeners(),(n=this._fitAnimation)==null||n.stop(),window.removeEventListener("drag",this._drag),document.removeEventListener("wheel",this._detectTrackpad),window.removeEventListener("pointermove",this._pointermove),this.renderer.domElement.removeEventListener("pointerdown",this._pointerdown);const e=this.renderer.domElement.parentElement;e&&((c=this._resizeObserver)==null||c.unobserve(e)),this.controls.dispose(),this.renderer.domElement.remove(),this.renderer.dispose(),be(this.scene),this.scene.clear()}}class Xr{constructor(e){this.deps=e,this.canvas=null,this.pixelBuffer=null,this.orthoCamera=new d.OrthographicCamera(-1,1,1,-1,.1,1e3),this.orthoCamera.position.set(0,0,5),this.perspectiveCamera=new d.PerspectiveCamera(45,1,.1,2e3)}async capture(e){var g,y,m,v,_,x;const t=this.deps.renderer,i=(e==null?void 0:e.subject)??this.deps.subject;if(!i)throw new Error("TriViewCapture: subject is required.");const s=new d.Vector2;t.getSize(s);const a=((g=e==null?void 0:e.size)==null?void 0:g.width)??Math.round(s.x),n=((y=e==null?void 0:e.size)==null?void 0:y.height)??Math.round(s.y),c=(e==null?void 0:e.margin)??.15,h=(e==null?void 0:e.includeOverlay)??!1,f=a/n||1,p=this.resolveViews(e==null?void 0:e.views),r=new d.WebGLRenderTarget(a,n,{format:d.RGBAFormat,type:d.UnsignedByteType});r.texture.colorSpace=d.SRGBColorSpace,r.texture.generateMipmaps=!1,r.depthBuffer=!0;const l=this.storeRendererState(t),u={};try{(v=(m=this.deps).onBeforeCapture)==null||v.call(m);const w=this.computeBounds(i);this.applyRendererState(t,a,n,e==null?void 0:e.backgroundColor);for(const b of p){const T=this.configureCamera(w,b,f,c,a,n);t.setRenderTarget(r),t.clear(!0,!0,!0),t.render(this.deps.scene,T),h&&this.deps.overlayScene&&(t.clearDepth(),t.render(this.deps.overlayScene,T));const S=this.readPixels(t,r,a,n);u[b.key]=S}}finally{r.dispose(),this.restoreRendererState(t,l),(x=(_=this.deps).onAfterCapture)==null||x.call(_)}return u}resolveViews(e){return e&&e.length?e.map(t=>({key:t.key,direction:t.direction.clone(),up:t.up.clone(),plane:t.plane})):[{key:"top",direction:new d.Vector3(0,0,1),up:new d.Vector3(0,1,0),plane:{width:"x",height:"y",depth:"z"}},{key:"front",direction:new d.Vector3(0,-1,0),up:new d.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"}},{key:"side",direction:new d.Vector3(1,0,0),up:new d.Vector3(0,0,1),plane:{width:"y",height:"z",depth:"x"}},{key:"perspective",direction:new d.Vector3(1,1,1),up:new d.Vector3(0,0,1),plane:{width:"x",height:"z",depth:"y"},mode:"perspective",fov:39.6}]}computeBounds(e){const t=new d.Box3,i=new d.Box3,s=new d.Vector3,a=new d.Vector3,n=new d.Sphere;return e.updateMatrixWorld(!0),e.traverse(c=>{if(!c.visible)return;const f=c.geometry;if(!f)return;f.boundingBox||f.computeBoundingBox();const p=f.boundingBox;p&&(i.copy(p).applyMatrix4(c.matrixWorld),t.union(i))}),t.isEmpty()?(t.setFromCenterAndSize(s,new d.Vector3(.001,.001,.001)),a.set(.001,.001,.001),n.center.copy(s),n.radius=.001):(t.getCenter(s),t.getSize(a),t.getBoundingSphere(n)),(!Number.isFinite(n.radius)||n.radius<=0)&&(n.radius=Math.max(a.length()*.5,.001)),{box:t,center:s,size:a,sphere:n}}configureCamera(e,t,i,s,a,n){const c=t.direction.clone().normalize();c.lengthSq()===0&&c.set(0,0,1);const h=t.up.clone().normalize();if(Math.abs(h.dot(c))>.999&&(h.set(0,0,1),Math.abs(h.dot(c))>.999&&h.set(0,1,0)),(t.mode??"orthographic")==="perspective"){const w=this.perspectiveCamera,b=t.fov??45,T=d.MathUtils.degToRad(b),S=Math.max(Math.tan(T/2),1e-4),L=Math.max(S*(i||1),1e-4),C=this.getPerspectiveDirection(t,e.size).normalize(),D=new d.Vector3().crossVectors(C,h).normalize();D.lengthSq()<1e-6&&D.set(1,0,0);const R=new d.Vector3().crossVectors(D,C).normalize(),A=Math.max(e.size.x*.5,1e-4),M=Math.max(e.size.y*.5,1e-4),I=Math.max(e.size.z*.5,1e-4),P=[new d.Vector3(-A,-M,-I),new d.Vector3(-A,-M,I),new d.Vector3(-A,M,-I),new d.Vector3(-A,M,I),new d.Vector3(A,-M,-I),new d.Vector3(A,-M,I),new d.Vector3(A,M,-I),new d.Vector3(A,M,I)];let E=0,B=-1/0;for(const H of P){const j=D.dot(H),U=R.dot(H),Q=C.dot(H);B=Math.max(B,Q);const re=Q+Math.abs(j)/L,te=Q+Math.abs(U)/S;E=Math.max(E,re,te)}E=Math.max(E,B+.1);const V=E*(1+s);let G=1/0;for(const H of P){const j=C.dot(H),U=V-j;U>.001&&(G=Math.min(G,U))}return w.fov=b,w.aspect=i||a/Math.max(n,1),w.near=Math.max(.1,Number.isFinite(G)?G*.5:V*.1),w.far=Math.max(w.near+1,V+e.sphere.radius*3),w.position.copy(e.center).add(C.clone().multiplyScalar(V)),w.up.copy(R),w.lookAt(e.center),w.updateProjectionMatrix(),w.updateMatrixWorld(!0),w}const p=this.orthoCamera,r=e.size,l=e.center,u=Math.max(r[t.plane.width]*.5,.01),g=Math.max(r[t.plane.height]*.5,.01),y=Math.max(r[t.plane.depth]*.5,.01);let m=u*(1+s),v=g*(1+s);m/i>v?v=m/i:m=v*i;const _=y*(1+s)+Math.max(m,v),x=l.clone().add(c.multiplyScalar(_));return p.left=-m,p.right=m,p.top=v,p.bottom=-v,p.near=.1,p.far=_*4,p.zoom=1,p.position.copy(x),p.up.copy(h),p.lookAt(l),p.updateProjectionMatrix(),p.updateMatrixWorld(!0),p}getPerspectiveDirection(e,t){const i=e.direction.clone();i.lengthSq()===0&&i.set(1,1,1);const s=new d.Vector3(Math.abs(i.x)||1,Math.abs(i.y)||1,Math.abs(i.z)||1),a=new d.Vector3(Math.sign(i.x||1),Math.sign(i.y||1),Math.sign(i.z||1)),n=.25,c=new d.Vector3(Math.max(n,s.x)*Math.max(t.x,.001),Math.max(n,s.y)*Math.max(t.y,.001),0),h=Math.max((t.x+t.y)*.5,.001),f=Math.max(t.z,.001),p=Math.max(n,s.z),r=f*.5+h*.5;return c.z=p*r,c.multiply(a),c}storeRendererState(e){const t=new d.Vector2;e.getSize(t);const i=new d.Vector4;e.getViewport(i);const s=new d.Vector4;e.getScissor(s);const a=e.getClearColor(new d.Color),n=e.getClearAlpha();return{size:t,pixelRatio:e.getPixelRatio(),viewport:i,scissor:s,scissorTest:e.getScissorTest(),autoClear:e.autoClear,target:e.getRenderTarget(),clearColor:a,clearAlpha:n}}applyRendererState(e,t,i,s){if(e.setPixelRatio(1),e.setSize(t,i,!1),e.setViewport(0,0,t,i),e.setScissor(0,0,t,i),e.setScissorTest(!1),e.autoClear=!0,s!==void 0)if(s===null){const a=e.getClearColor(new d.Color);e.setClearColor(a,0)}else s instanceof d.Color?e.setClearColor(s,1):e.setClearColor(new d.Color(s),1);else{const a=e.getClearColor(new d.Color);e.setClearColor(a,0)}}restoreRendererState(e,t){e.setPixelRatio(t.pixelRatio),e.setSize(t.size.x,t.size.y,!1),e.setViewport(t.viewport.x,t.viewport.y,t.viewport.z,t.viewport.w),e.setScissor(t.scissor.x,t.scissor.y,t.scissor.z,t.scissor.w),e.setScissorTest(t.scissorTest),e.autoClear=t.autoClear,e.setRenderTarget(t.target),e.setClearColor(t.clearColor,t.clearAlpha)}readPixels(e,t,i,s){const a=i*s*4;(!this.pixelBuffer||this.pixelBuffer.length!==a)&&(this.pixelBuffer=new Uint8Array(a)),e.readRenderTargetPixels(t,0,0,i,s,this.pixelBuffer);const n=this.ensureCanvas(i,s),c=n.getContext("2d");if(!c)throw new Error("TriViewCapture: failed to get 2D context.");const h=c.createImageData(i,s),f=h.data,p=this.pixelBuffer;for(let r=0;r<s;r+=1){const u=(s-r-1)*i*4,g=r*i*4;f.set(p.subarray(u,u+i*4),g)}return c.putImageData(h,0,0),n.toDataURL("image/png")}ensureCanvas(e,t){if(typeof document>"u")throw new Error("TriViewCapture: document is not available in this environment.");return this.canvas||(this.canvas=document.createElement("canvas")),(this.canvas.width!==e||this.canvas.height!==t)&&(this.canvas.width=e,this.canvas.height=t),this.canvas}}const Mc="shop-components",Cc="0.4.22",Rc="Shop components",Lc="dist/shop-components.umd.js",Ic="dist/shop-components.mjs",Dc="dist/main.d.ts",Pc={dts:"tsc --emitDeclarationOnly & tsc & storybook build -o dist",dev:"vite dev",build:"vite build","build:web":"BUILD_WEB=1 vite build --outDir dist/web --emptyOutDir",v:"auto-changelog -p && git add CHANGELOG.md"},Fc=["dist","package.json"],Ec=[],Bc="machengda<machengda@seer-group.com>",kc="ISC",Oc={"@needle-tools/gltf-progressive":"^3.3.5","auto-changelog":"^2.4.0",vite:"5.1.6","vite-plugin-dts":"^3.7.3",tweakpane:"^4.0.3","@tweakpane/core":"^2.0.3",stylus:"^0.63.0"},zc={"string-width":"4.2.3"},Vc={three:"0.182.0"},Uc={"@tweenjs/tween.js":"^23.1.2","@types/howler":"^2.2.11","@types/three":"0.182.0",eventemitter3:"^5.0.1",howler:"^2.2.4","stats-fps.js":"0.0.6","three-gpu-pathtracer":"^0.0.23","three-mesh-bvh":"^0.7.5","troika-three-text":"^0.49.1"},Wc={name:Mc,version:Cc,description:Rc,main:Lc,module:Ic,types:Dc,scripts:Pc,files:Fc,keywords:Ec,author:Bc,license:kc,devDependencies:Oc,resolutions:zc,peerDependencies:Vc,dependencies:Uc};function dr(){const o="Nebula Engin",e=Wc.version,t=`%c ${o} %c v${e} `;console.log(t,"background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;","background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;")}const pr="__SHOP_COMPONENTS_BANNER_PRINTED__";try{const o=globalThis;o[pr]||(o[pr]=!0,dr())}catch{dr()}exports.Amr=Wr;exports.Logo=Yi;exports.SGLBLoader=Et;exports.SLOT_EVENTS=X;exports.Scene3D=Sc;exports.Skin=rs;exports.Slot=Qi;exports.SlotState=Kr;exports.TriViewCapture=Xr;exports.arrayBufferToUrl=qi;exports.calculateArrayAverage=Br;exports.calculateFocalLength=Ea;exports.createSGLBFile=ja;exports.downloadBlob=Fa;exports.dracoExporter=qa;exports.font=bc;exports.gltfExporter=zr;exports.gltfLoader=We;exports.imageBitmapToUrl=ji;exports.isAppleDevice=kr;exports.textureLoader=ds;
@@ -5656,7 +5656,7 @@ class js {
5656
5656
  });
5657
5657
  }
5658
5658
  static async createWorker(e) {
5659
- const t = new Worker(new URL("" + new URL("assets/loader.worker-fysOIq2s.js", import.meta.url).href, import.meta.url), {
5659
+ const t = new Worker(new URL("" + new URL("assets/loader.worker-46d0lFWx.js", import.meta.url).href, import.meta.url), {
5660
5660
  type: "module"
5661
5661
  });
5662
5662
  return new js(t, e);
@@ -7466,7 +7466,7 @@ $t.Panel = function(o, e, t) {
7466
7466
  }
7467
7467
  };
7468
7468
  };
7469
- function bu(o, e) {
7469
+ function Au(o, e) {
7470
7470
  const t = URL.createObjectURL(o), i = document.createElement("a");
7471
7471
  i.href = t, i.download = e, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
7472
7472
  }
@@ -7485,7 +7485,7 @@ function Fr(o) {
7485
7485
  const t = e.getContext("2d");
7486
7486
  return e.width = o.width, e.height = o.height, t ? (t.drawImage(o, 0, 0), e.toDataURL("image/png", 0.75)) : void 0;
7487
7487
  }
7488
- function Au(o, e = 43) {
7488
+ function Tu(o, e = 43) {
7489
7489
  const t = o * Math.PI / 180;
7490
7490
  return e / (2 * Math.tan(t / 2));
7491
7491
  }
@@ -8869,8 +8869,8 @@ ji.setDecoderConfig({ type: "wasm" });
8869
8869
  ji.setDecoderPath(Rt.endsWith("/") ? Rt : `${Rt}/`);
8870
8870
  ji.preload();
8871
8871
  Et.setDRACOLoader(ji);
8872
- const Su = new bo(), Br = [115, 103, 108, 98];
8873
- function Mu(o, e, t) {
8872
+ const Mu = new bo(), Br = [115, 103, 108, 98];
8873
+ function Cu(o, e, t) {
8874
8874
  const i = JSON.stringify(e), s = new TextEncoder().encode(i), a = new Uint8Array([115, 103, 108, 98]), n = new Uint8Array(2);
8875
8875
  n[0] = t >> 8, n[1] = t & 255;
8876
8876
  const c = new Uint8Array(4);
@@ -13557,7 +13557,7 @@ class Ph extends Z {
13557
13557
  super(s, a), this.position.z = -0.02;
13558
13558
  }
13559
13559
  }
13560
- const Eh = "https://cdn2.seer-group.com/libs/hdr/aristea_wreck_512.hdr", Fh = "https://cdn2.seer-group.com/libs/hdr/lightroom_14b_512.hdr", kh = "https://cdn2.seer-group.com/libs/fonts.type.json", Cu = new yo(kh);
13560
+ const Eh = "https://cdn2.seer-group.com/libs/hdr/aristea_wreck_512.hdr", Fh = "https://cdn2.seer-group.com/libs/hdr/lightroom_14b_512.hdr", kh = "https://cdn2.seer-group.com/libs/fonts.type.json", Iu = new yo(kh);
13561
13561
  class tn {
13562
13562
  constructor(e) {
13563
13563
  var i;
@@ -13599,7 +13599,7 @@ let St, ki = 0, Us = 0;
13599
13599
  const Oh = () => {
13600
13600
  St = void 0, ki = 0, Us = 0;
13601
13601
  }, zh = new ri({ colorWrite: !1 });
13602
- class Iu {
13602
+ class Ru {
13603
13603
  constructor(e) {
13604
13604
  this.props = e, this.stats = new $t(), this.scene = new ws(), this.overlayScene = new ws(), this.renderer = new uo({
13605
13605
  antialias: !0,
@@ -14324,7 +14324,7 @@ class Uh {
14324
14324
  return this.canvas || (this.canvas = document.createElement("canvas")), (this.canvas.width !== e || this.canvas.height !== t) && (this.canvas.width = e, this.canvas.height = t), this.canvas;
14325
14325
  }
14326
14326
  }
14327
- const Hh = "shop-components", Wh = "0.4.21", Vh = "Shop components", Nh = "dist/shop-components.umd.js", Gh = "dist/shop-components.mjs", qh = "dist/main.d.ts", jh = {
14327
+ const Hh = "shop-components", Wh = "0.4.22", Vh = "Shop components", Nh = "dist/shop-components.umd.js", Gh = "dist/shop-components.mjs", qh = "dist/main.d.ts", jh = {
14328
14328
  dts: "tsc --emitDeclarationOnly & tsc & storybook build -o dist",
14329
14329
  dev: "vite dev",
14330
14330
  build: "vite build",
@@ -14337,28 +14337,25 @@ const Hh = "shop-components", Wh = "0.4.21", Vh = "Shop components", Nh = "dist/
14337
14337
  "@needle-tools/gltf-progressive": "^3.3.5",
14338
14338
  "auto-changelog": "^2.4.0",
14339
14339
  vite: "5.1.6",
14340
- "vite-plugin-dts": "^3.7.3"
14340
+ "vite-plugin-dts": "^3.7.3",
14341
+ tweakpane: "^4.0.3",
14342
+ "@tweakpane/core": "^2.0.3",
14343
+ stylus: "^0.63.0"
14341
14344
  }, Jh = {
14342
14345
  "string-width": "4.2.3"
14343
14346
  }, $h = {
14344
- "@nodetoy/three-nodetoy": "^0.1.36",
14345
- "@tweakpane/core": "^2.0.3",
14347
+ three: "0.182.0"
14348
+ }, eu = {
14346
14349
  "@tweenjs/tween.js": "^23.1.2",
14347
- "@types/bezier-js": "^4.1.1",
14348
14350
  "@types/howler": "^2.2.11",
14349
14351
  "@types/three": "0.182.0",
14350
- "bezier-js": "^6.1.4",
14351
14352
  eventemitter3: "^5.0.1",
14352
14353
  howler: "^2.2.4",
14353
14354
  "stats-fps.js": "0.0.6",
14354
- stylus: "^0.63.0",
14355
- terser: "^5.44.0",
14356
- three: "0.182.0",
14357
14355
  "three-gpu-pathtracer": "^0.0.23",
14358
14356
  "three-mesh-bvh": "^0.7.5",
14359
- "troika-three-text": "^0.49.1",
14360
- tweakpane: "^4.0.3"
14361
- }, eu = {
14357
+ "troika-three-text": "^0.49.1"
14358
+ }, tu = {
14362
14359
  name: Hh,
14363
14360
  version: Wh,
14364
14361
  description: Vh,
@@ -14372,10 +14369,11 @@ const Hh = "shop-components", Wh = "0.4.21", Vh = "Shop components", Nh = "dist/
14372
14369
  license: Xh,
14373
14370
  devDependencies: Zh,
14374
14371
  resolutions: Jh,
14375
- dependencies: $h
14372
+ peerDependencies: $h,
14373
+ dependencies: eu
14376
14374
  };
14377
14375
  function rn() {
14378
- const o = "Nebula Engin", e = eu.version, t = `%c ${o} %c v${e} `;
14376
+ const o = "Nebula Engin", e = tu.version, t = `%c ${o} %c v${e} `;
14379
14377
  console.log(t, "background:#111827;color:#ffffff;padding:4px 10px;border-radius:4px 0 0 4px;font-weight:700;", "background:#10B981;color:#ffffff;padding:4px 10px;border-radius:0 4px 4px 0;font-weight:700;");
14380
14378
  }
14381
14379
  const nn = "__SHOP_COMPONENTS_BANNER_PRINTED__";
@@ -14390,18 +14388,18 @@ export {
14390
14388
  Vr as Logo,
14391
14389
  Ui as SGLBLoader,
14392
14390
  ie as SLOT_EVENTS,
14393
- Iu as Scene3D,
14391
+ Ru as Scene3D,
14394
14392
  tn as Skin,
14395
14393
  Ur as Slot,
14396
14394
  Bh as SlotState,
14397
14395
  Uh as TriViewCapture,
14398
14396
  Er as arrayBufferToUrl,
14399
14397
  Ql as calculateArrayAverage,
14400
- Au as calculateFocalLength,
14401
- Mu as createSGLBFile,
14402
- bu as downloadBlob,
14403
- Su as dracoExporter,
14404
- Cu as font,
14398
+ Tu as calculateFocalLength,
14399
+ Cu as createSGLBFile,
14400
+ Au as downloadBlob,
14401
+ Mu as dracoExporter,
14402
+ Iu as font,
14405
14403
  nc as gltfExporter,
14406
14404
  Et as gltfLoader,
14407
14405
  Fr as imageBitmapToUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shop-components",
3
- "version": "0.4.21",
3
+ "version": "0.4.22",
4
4
  "description": "Shop components",
5
5
  "main": "dist/shop-components.umd.js",
6
6
  "module": "dist/shop-components.mjs",
@@ -23,28 +23,26 @@
23
23
  "@needle-tools/gltf-progressive": "^3.3.5",
24
24
  "auto-changelog": "^2.4.0",
25
25
  "vite": "5.1.6",
26
- "vite-plugin-dts": "^3.7.3"
26
+ "vite-plugin-dts": "^3.7.3",
27
+ "tweakpane": "^4.0.3",
28
+ "@tweakpane/core": "^2.0.3",
29
+ "stylus": "^0.63.0"
27
30
  },
28
31
  "resolutions": {
29
32
  "string-width": "4.2.3"
30
33
  },
34
+ "peerDependencies": {
35
+ "three": "0.182.0"
36
+ },
31
37
  "dependencies": {
32
- "@nodetoy/three-nodetoy": "^0.1.36",
33
- "@tweakpane/core": "^2.0.3",
34
38
  "@tweenjs/tween.js": "^23.1.2",
35
- "@types/bezier-js": "^4.1.1",
36
39
  "@types/howler": "^2.2.11",
37
40
  "@types/three": "0.182.0",
38
- "bezier-js": "^6.1.4",
39
41
  "eventemitter3": "^5.0.1",
40
42
  "howler": "^2.2.4",
41
43
  "stats-fps.js": "0.0.6",
42
- "stylus": "^0.63.0",
43
- "terser": "^5.44.0",
44
- "three": "0.182.0",
45
44
  "three-gpu-pathtracer": "^0.0.23",
46
45
  "three-mesh-bvh": "^0.7.5",
47
- "troika-three-text": "^0.49.1",
48
- "tweakpane": "^4.0.3"
46
+ "troika-three-text": "^0.49.1"
49
47
  }
50
48
  }