ss-component-new 1.2.4 → 1.2.6

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 (105) hide show
  1. package/dist/{animationData-CfT99nMO.cjs → animationData-B0K2ghu6.cjs} +1 -1
  2. package/dist/{animationData-9n1X4UvO.js → animationData-GqECkAbz.js} +4 -4
  3. package/dist/{array-pg68Qbs1.js → array-D65aMM6H.js} +1 -1
  4. package/dist/{array-BPHS7JFA.cjs → array-DMPAgNcb.cjs} +1 -1
  5. package/dist/config.js +1 -1
  6. package/dist/{index-bj8hK6Pe.js → index--rLSLEk3.js} +2 -2
  7. package/dist/{index-B8J_v2Ky.cjs → index-67QO-qDa.cjs} +1 -1
  8. package/dist/{index-DOlPMLvf.cjs → index-87kRWJv8.cjs} +1 -1
  9. package/dist/{index-CdPbJekh.js → index-8Dyi4QCI.js} +185 -186
  10. package/dist/{index-CK_O7QdV.cjs → index-8yRiF_z8.cjs} +1 -1
  11. package/dist/{index-B5srJr0o.js → index-9zEdW6xv.js} +2 -2
  12. package/dist/{index-CAHYTZ1Q.cjs → index-B14iwpkN.cjs} +1 -1
  13. package/dist/{index-DJ1PTHpx.cjs → index-B7hLDNQ6.cjs} +1 -1
  14. package/dist/{index-DBScQH7L.js → index-BEoEUXZe.js} +166 -166
  15. package/dist/{index-BOVdAFDH.cjs → index-BHJ-tVLT.cjs} +1 -1
  16. package/dist/{index-Dk8D9SRm.js → index-BMMYAqF1.js} +1 -1
  17. package/dist/{index-DFg-bhPI.js → index-BNOx3XL5.js} +1 -1
  18. package/dist/{index-CMlYJD5U.cjs → index-BNvpuVyw.cjs} +1 -1
  19. package/dist/{index-d6tSWKtY.cjs → index-BOJUyAaV.cjs} +2 -2
  20. package/dist/{index-B5vIeQUq.cjs → index-BYUPvuvs.cjs} +1 -1
  21. package/dist/{index-LXb5DfDE.cjs → index-BaRkv5oc.cjs} +1 -1
  22. package/dist/{index-Bx4qIiIa.cjs → index-BpR7F1Fp.cjs} +1 -1
  23. package/dist/{index-BjXcyVvp.js → index-Bs2K1FVH.js} +2 -2
  24. package/dist/{index-Bsdjuxq1.cjs → index-BsM9qdbC.cjs} +1 -1
  25. package/dist/{index-CyP2hcVu.js → index-BsfJJu0R.js} +6 -6
  26. package/dist/{index-BAj0dyBF.js → index-Bw_JtuzR.js} +3 -3
  27. package/dist/{index-BuKHInQb.js → index-C1FOuBuy.js} +1 -1
  28. package/dist/{index-NFCeQcv4.cjs → index-C5CKSB0e.cjs} +1 -1
  29. package/dist/{index-CCsSOTaB.js → index-C8UOMPgt.js} +2 -2
  30. package/dist/{index-CCIJ-P3X.cjs → index-CA-FC_OL.cjs} +1 -1
  31. package/dist/{index-CDXq3gs4.js → index-CArSUfnV.js} +19 -19
  32. package/dist/{index-8CcD03tl.js → index-CBuqdsPh.js} +6 -6
  33. package/dist/{index---6UATT0.js → index-CMCrQ36H.js} +3 -3
  34. package/dist/{index-CpE8hbs0.js → index-CRj9VM12.js} +6 -6
  35. package/dist/{index-C1lB8apW.js → index-CRrAiL5l.js} +4 -4
  36. package/dist/{index-BNNxPuEV.js → index-CShBWCYm.js} +1 -1
  37. package/dist/{index-FxX6NP0J.js → index-CTkF2kl_.js} +1 -1
  38. package/dist/{index-DCf7Tz40.cjs → index-CZaBF851.cjs} +1 -1
  39. package/dist/{index-Y7MUJdPv.js → index-CbA74tCL.js} +2 -2
  40. package/dist/{index-B5gNufYw.js → index-CbDu4gfZ.js} +2 -2
  41. package/dist/{index-zQVJFawn.cjs → index-CePZE-QA.cjs} +1 -1
  42. package/dist/{index-Bi7yv8jC.cjs → index-CedgKpsz.cjs} +1 -1
  43. package/dist/{index-C0HHmjrg.cjs → index-Cm3z0Vmi.cjs} +1 -1
  44. package/dist/{index-BEJOd_29.js → index-D-WcrLQv.js} +4 -4
  45. package/dist/{index-D-r_YKrq.cjs → index-D6mwkqWY.cjs} +2 -2
  46. package/dist/index-D8510-YQ.cjs +1 -0
  47. package/dist/{index-DPyzaxnq.cjs → index-D9oqICYV.cjs} +1 -1
  48. package/dist/{index-DSsZtYMz.js → index-DGepdvRW.js} +2 -2
  49. package/dist/{index-D0_4keB8.js → index-DGi-ANHr.js} +5 -5
  50. package/dist/{index-CLtFz5gE.js → index-DJGsDpDp.js} +3 -3
  51. package/dist/{index-B9nZeing.cjs → index-DPBmAgEA.cjs} +1 -1
  52. package/dist/{index-xHEf6hcO.js → index-DPWc4No_.js} +2 -2
  53. package/dist/{index-BrsIZVyD.cjs → index-DSchKIyh.cjs} +1 -1
  54. package/dist/{index-UN4JU0ly.js → index-DV_ZZQBO.js} +2 -2
  55. package/dist/{index-1DtctdYW.cjs → index-DVmoPvzr.cjs} +1 -1
  56. package/dist/{index-BKhDFqMM.cjs → index-DWs7-g1h.cjs} +1 -1
  57. package/dist/{index-DszzdQnM.cjs → index-DZ8a7BZ1.cjs} +1 -1
  58. package/dist/{index-nUEWiqy9.cjs → index-DcUUpSE1.cjs} +1 -1
  59. package/dist/{index-DsHRVZ0E.js → index-DvpVQvAe.js} +2 -2
  60. package/dist/{index-DPaTtF3h.cjs → index-FK1YYpjN.cjs} +1 -1
  61. package/dist/{index-DEwcUkb-.js → index-HvKjB6_P.js} +3 -3
  62. package/dist/{index-PIEkAjRf.js → index-LADv0t0E.js} +11 -11
  63. package/dist/{index-DS5z17Mc.js → index-_66uQhcl.js} +7 -7
  64. package/dist/{index-CxNBcsll.cjs → index-_uyv24Pt.cjs} +1 -1
  65. package/dist/{index-pLeOyTaj.js → index-g4qw0jRy.js} +6 -6
  66. package/dist/{index-C-AOuDkl.cjs → index-mtuIEfrj.cjs} +1 -1
  67. package/dist/{index-CmlXlH2b.cjs → index-tttYIzsn.cjs} +1 -1
  68. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-Cmc1oALS.cjs → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BSOYWm_U.cjs} +1 -1
  69. package/dist/{index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BTu7I4mn.js → index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-DIMJusrg.js} +2 -2
  70. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-C795GAHK.cjs → index.vue_vue_type_style_index_0_scoped_92477073_lang-D2VLEzGB.cjs} +1 -1
  71. package/dist/{index.vue_vue_type_style_index_0_scoped_92477073_lang-Bg_c-oAL.js → index.vue_vue_type_style_index_0_scoped_92477073_lang-D58IzjOR.js} +6 -6
  72. package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-Bn5qXF4J.cjs → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-BnNwKutS.cjs} +1 -1
  73. package/dist/{index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-9kDr7Iek.js → index.vue_vue_type_style_index_0_scoped_bcdf4fb0_lang-CJCvJvBM.js} +13 -13
  74. package/dist/{index.vue_vue_type_style_index_1_lang-Exyt6qTf.js → index.vue_vue_type_style_index_1_lang-D5Hjs-g0.js} +31 -25
  75. package/dist/{index.vue_vue_type_style_index_1_lang-Bn7P4fYM.cjs → index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs} +1 -1
  76. package/dist/{index.vue_vue_type_style_index_1_lang-zN5mc8b0.cjs → index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs} +2 -2
  77. package/dist/{index.vue_vue_type_style_index_1_lang-D1n_3_F6.js → index.vue_vue_type_style_index_1_lang-hBa3nAgx.js} +3 -3
  78. package/dist/{isString-BAN9KLwf.js → isString--ZVOCy4V.js} +1 -1
  79. package/dist/{isString-ChvWbctO.cjs → isString-CELwppr9.cjs} +1 -1
  80. package/dist/{main-BUEuCNq-.cjs → main-C6Iw-pcH.cjs} +1 -1
  81. package/dist/{main-Dk3BZDsa.js → main-CygliYyN.js} +5 -5
  82. package/dist/ss-component.cjs +1 -1
  83. package/dist/ss-component.css +1 -1
  84. package/dist/ss-component.js +11 -11
  85. package/dist/ss-component2.cjs +1 -1
  86. package/dist/ss-component2.js +12 -12
  87. package/dist/{threeLatheView-DfSxRY8B.cjs → threeLatheView-CdUoB0Te.cjs} +1 -1
  88. package/dist/{threeLatheView-DcuDjVv0.js → threeLatheView-DzpPpdDr.js} +2 -2
  89. package/dist/{threeModel-DjjtL0-a.cjs → threeModel-BUCLJlE5.cjs} +1 -1
  90. package/dist/{threeModel-YRFvkgXU.js → threeModel-BfMMeZCc.js} +3 -3
  91. package/dist/{threePreview-CyYfnbB6.js → threePreview-BEqzg370.js} +1 -1
  92. package/dist/{threePreview-ByUYJkts.cjs → threePreview-C-JW_pcY.cjs} +1 -1
  93. package/dist/threeSceneView-BTsG2QJg.cjs +5 -0
  94. package/dist/threeSceneView-DV5dsTZZ.js +1471 -0
  95. package/dist/{threeSceneViewForCPMPIP-axjwKt9X.js → threeSceneViewForCPMPIP-Bexwqkry.js} +7 -7
  96. package/dist/{threeSceneViewForCPMPIP-DA-twBdG.cjs → threeSceneViewForCPMPIP-DwLWGNUd.cjs} +1 -1
  97. package/dist/{threeViewerHost-B02OtfCk.cjs → threeViewerHost-CRqcYbJE.cjs} +1 -1
  98. package/dist/{threeViewerHost-D7L1FW__.js → threeViewerHost-CTjd2V1D.js} +4 -4
  99. package/dist/{useRayCaster-CAqupK7D.js → useRayCaster-D0_7oJan.js} +1 -1
  100. package/dist/{useRayCaster-ClcofJkf.cjs → useRayCaster-DN56HpNP.cjs} +1 -1
  101. package/package.json +1 -1
  102. package/public/config.js +1 -1
  103. package/dist/index-5hLZZ6t-.cjs +0 -1
  104. package/dist/threeSceneView-mhrcH0WG.cjs +0 -5
  105. package/dist/threeSceneView-zvyCHrp1.js +0 -1469
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),O=require("./iconfont-t5epssvu.cjs"),B=require("./STLLoader-RU7KqloS.cjs"),d=require("./three-viewport-gizmo-BV37JzRa.cjs"),X=require("./index-d6tSWKtY.cjs"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function q(f,t){if(t===d.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(t===d.TriangleFanDrawMode||t===d.TriangleStripDrawMode){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const i=e.count-2,n=[];if(t===d.TriangleFanDrawMode)for(let r=1;r<=i;r++)n.push(e.getX(0)),n.push(e.getX(r)),n.push(e.getX(r+1));else for(let r=0;r<i;r++)r%2===0?(n.push(e.getX(r)),n.push(e.getX(r+1)),n.push(e.getX(r+2))):(n.push(e.getX(r+2)),n.push(e.getX(r+1)),n.push(e.getX(r)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=f.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),f}class se extends d.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new ce(e)}),this.register(function(e){return new le(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new ae(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new ie(e)}),this.register(function(e){return new Me(e)}),this.register(function(e){return new Le(e)})}load(t,e,i,n){const s=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=d.LoaderUtils.extractUrlBase(t);r=d.LoaderUtils.resolveURL(c,this.path)}else r=d.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),s.manager.itemError(t),s.manager.itemEnd(t)},o=new d.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{s.parse(c,r,function(u){e(u),s.manager.itemEnd(t)},a)}catch(u){a(u)}},i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){let s;const r={},a={},o=new TextDecoder;if(typeof t=="string")s=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===Q){try{r[L.KHR_BINARY_GLTF]=new Ae(t)}catch(l){n&&n(l);return}s=JSON.parse(r[L.KHR_BINARY_GLTF].content)}else s=JSON.parse(o.decode(t));else s=t;if(s.asset===void 0||s.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Fe(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(s.extensionsUsed)for(let u=0;u<s.extensionsUsed.length;++u){const l=s.extensionsUsed[u],h=s.extensionsRequired||[];switch(l){case L.KHR_MATERIALS_UNLIT:r[l]=new oe;break;case L.KHR_DRACO_MESH_COMPRESSION:r[l]=new Se(s,this.dracoLoader);break;case L.KHR_TEXTURE_TRANSFORM:r[l]=new _e;break;case L.KHR_MESH_QUANTIZATION:r[l]=new ye;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,s){i.parse(t,e,n,s)})}}function re(){let f={};return{get:function(t){return f[t]},add:function(t,e){f[t]=e},remove:function(t){delete f[t]},removeAll:function(){f={}}}}const L={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ie{constructor(t){this.parser=t,this.name=L.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i<n;i++){const s=e[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(t){const e=this.parser,i="light:"+t;let n=e.cache.get(i);if(n)return n;const s=e.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t];let c;const u=new d.Color(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],d.LinearSRGBColorSpace);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new d.DirectionalLight(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new d.PointLight(u),c.distance=l;break;case"spot":c=new d.SpotLight(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),k(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+t),n=Promise.resolve(c),e.cache.add(i,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,i=this.parser,s=i.json.nodes[t],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return i._getNodeRef(e.cache,a,o)})}}class oe{constructor(){this.name=L.KHR_MATERIALS_UNLIT}getMaterialType(){return d.MeshBasicMaterial}extendParams(t,e,i){const n=[];t.color=new d.Color(1,1,1),t.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const r=s.baseColorFactor;t.color.setRGB(r[0],r[1],r[2],d.LinearSRGBColorSpace),t.opacity=r[3]}s.baseColorTexture!==void 0&&n.push(i.assignTexture(t,"map",s.baseColorTexture,d.SRGBColorSpace))}return Promise.all(n)}}class ae{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name].emissiveStrength;return s!==void 0&&(e.emissiveIntensity=s),Promise.resolve()}}class ce{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];if(r.clearcoatFactor!==void 0&&(e.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&s.push(i.assignTexture(e,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(e,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(e,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const a=r.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new d.Vector2(a,a)}return Promise.all(s)}}class le{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_DISPERSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class ue{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return r.iridescenceFactor!==void 0&&(e.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&s.push(i.assignTexture(e,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(e.iridescenceIOR=r.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(e,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(s)}}class de{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_SHEEN}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];e.sheenColor=new d.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const r=n.extensions[this.name];if(r.sheenColorFactor!==void 0){const a=r.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace)}return r.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&s.push(i.assignTexture(e,"sheenColorMap",r.sheenColorTexture,d.SRGBColorSpace)),r.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(e,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(s)}}class fe{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return r.transmissionFactor!==void 0&&(e.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&s.push(i.assignTexture(e,"transmissionMap",r.transmissionTexture)),Promise.all(s)}}class he{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_VOLUME}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];e.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&s.push(i.assignTexture(e,"thicknessMap",r.thicknessTexture)),e.attenuationDistance=r.attenuationDistance||1/0;const a=r.attenuationColor||[1,1,1];return e.attenuationColor=new d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),Promise.all(s)}}class pe{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_IOR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class me{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_SPECULAR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];e.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&s.push(i.assignTexture(e,"specularIntensityMap",r.specularTexture));const a=r.specularColorFactor||[1,1,1];return e.specularColor=new d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),r.specularColorTexture!==void 0&&s.push(i.assignTexture(e,"specularColorMap",r.specularColorTexture,d.SRGBColorSpace)),Promise.all(s)}}class ge{constructor(t){this.parser=t,this.name=L.EXT_MATERIALS_BUMP}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return e.bumpScale=r.bumpFactor!==void 0?r.bumpFactor:1,r.bumpTexture!==void 0&&s.push(i.assignTexture(e,"bumpMap",r.bumpTexture)),Promise.all(s)}}class Te{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return r.anisotropyStrength!==void 0&&(e.anisotropy=r.anisotropyStrength),r.anisotropyRotation!==void 0&&(e.anisotropyRotation=r.anisotropyRotation),r.anisotropyTexture!==void 0&&s.push(i.assignTexture(e,"anisotropyMap",r.anisotropyTexture)),Promise.all(s)}}class Re{constructor(t){this.parser=t,this.name=L.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,i=e.json,n=i.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const s=n.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,s.source,r)}}class xe{constructor(t){this.parser=t,this.name=L.EXT_TEXTURE_WEBP}loadTexture(t){const e=this.name,i=this.parser,n=i.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const r=s.extensions[e],a=n.images[r.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return i.loadTextureImage(t,r.source,o)}}class Ee{constructor(t){this.parser=t,this.name=L.EXT_TEXTURE_AVIF}loadTexture(t){const e=this.name,i=this.parser,n=i.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const r=s.extensions[e],a=n.images[r.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return i.loadTextureImage(t,r.source,o)}}class Me{constructor(t){this.name=L.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],s=this.parser.getDependency("buffer",n.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,u=n.count,l=n.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,n.mode,n.filter).then(function(m){return m.buffer}):r.ready.then(function(){const m=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(m),u,l,h,n.mode,n.filter),m})})}else return null}}class Le{constructor(t){this.name=L.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=e.meshes[i.mesh];for(const c of n.primitives)if(c.mode!==I.TRIANGLES&&c.mode!==I.TRIANGLE_STRIP&&c.mode!==I.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=i.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,m=[];for(const g of l){const M=new d.Matrix4,T=new d.Vector3,R=new d.Quaternion,A=new d.Vector3(1,1,1),_=new d.InstancedMesh(g.geometry,g.material,h);for(let x=0;x<h;x++)o.TRANSLATION&&T.fromBufferAttribute(o.TRANSLATION,x),o.ROTATION&&R.fromBufferAttribute(o.ROTATION,x),o.SCALE&&A.fromBufferAttribute(o.SCALE,x),_.setMatrixAt(x,M.compose(T,R,A));for(const x in o)if(x==="_COLOR_0"){const b=o[x];_.instanceColor=new d.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,o[x]);d.Object3D.prototype.copy.call(_,g),this.parser.assignFinalMaterial(_),m.push(_)}return u.isGroup?(u.clear(),u.add(...m),u):m[0]}))}}const Q="glTF",G=12,W={JSON:1313821514,BIN:5130562};class Ae{constructor(t){this.name=L.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,G),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Q)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-G,s=new DataView(t,G);let r=0;for(;r<n;){const a=s.getUint32(r,!0);r+=4;const o=s.getUint32(r,!0);if(r+=4,o===W.JSON){const c=new Uint8Array(t,G+r,a);this.content=i.decode(c)}else if(o===W.BIN){const c=G+r;this.body=t.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Se{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=L.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const i=this.json,n=this.dracoLoader,s=t.extensions[this.name].bufferView,r=t.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=K[u]||u.toLowerCase();a[l]=r[u]}for(const u in t.attributes){const l=K[u]||u.toLowerCase();if(r[u]!==void 0){const h=i.accessors[t.attributes[u]],m=H[h.componentType];c[l]=m.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",s).then(function(u){return new Promise(function(l,h){n.decodeDracoFile(u,function(m){for(const g in m.attributes){const M=m.attributes[g],T=o[g];T!==void 0&&(M.normalized=T)}l(m)},a,c,d.LinearSRGBColorSpace,h)})})}}class _e{constructor(){this.name=L.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class ye{constructor(){this.name=L.KHR_MESH_QUANTIZATION}}class Z extends d.Interpolant{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n*3+n;for(let r=0;r!==n;r++)e[r]=i[s+r];return e}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=n-e,l=(i-e)/u,h=l*l,m=h*l,g=t*c,M=g-c,T=-2*m+3*h,R=m-h,A=1-T,_=R-h+l;for(let x=0;x!==a;x++){const b=r[M+x+a],C=r[M+x+o]*u,S=r[g+x+a],v=r[g+x]*u;s[x]=A*b+_*C+T*S+R*v}return s}}const we=new d.Quaternion;class be extends Z{interpolate_(t,e,i,n){const s=super.interpolate_(t,e,i,n);return we.fromArray(s).normalize().toArray(s),s}}const I={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Y={9728:d.NearestFilter,9729:d.LinearFilter,9984:d.NearestMipmapNearestFilter,9985:d.LinearMipmapNearestFilter,9986:d.NearestMipmapLinearFilter,9987:d.LinearMipmapLinearFilter},$={33071:d.ClampToEdgeWrapping,33648:d.MirroredRepeatWrapping,10497:d.RepeatWrapping},U={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},K={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},F={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ne={CUBICSPLINE:void 0,LINEAR:d.InterpolateLinear,STEP:d.InterpolateDiscrete},V={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ce(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new d.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:d.FrontSide})),f.DefaultMaterial}function D(f,t,e){for(const i in e.extensions)f[i]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=e.extensions[i])}function k(f,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(f.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Ie(f,t,e){let i=!1,n=!1,s=!1;for(let c=0,u=t.length;c<u;c++){const l=t[c];if(l.POSITION!==void 0&&(i=!0),l.NORMAL!==void 0&&(n=!0),l.COLOR_0!==void 0&&(s=!0),i&&n&&s)break}if(!i&&!n&&!s)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=t.length;c<u;c++){const l=t[c];if(i){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(n){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(s){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return i&&(f.morphAttributes.position=u),n&&(f.morphAttributes.normal=l),s&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function ve(f,t){if(f.updateMorphTargets(),t.weights!==void 0)for(let e=0,i=t.weights.length;e<i;e++)f.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let i=0,n=e.length;i<n;i++)f.morphTargetDictionary[e[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Oe(f){let t;const e=f.extensions&&f.extensions[L.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+j(e.attributes):t=f.indices+":"+j(f.attributes)+":"+f.mode,f.targets!==void 0)for(let i=0,n=f.targets.length;i<n;i++)t+=":"+j(f.targets[i]);return t}function j(f){let t="";const e=Object.keys(f).sort();for(let i=0,n=e.length;i<n;i++)t+=e[i]+":"+f[e[i]]+";";return t}function z(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function ke(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Pe=new d.Matrix4;class Fe{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new re,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=-1,s=!1,r=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=i&&o?parseInt(o[1],10):-1,s=a.indexOf("Firefox")>-1,r=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&n<17||s&&r<98?this.textureLoader=new d.TextureLoader(this.options.manager):this.textureLoader=new d.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new d.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(r){const a={scene:r[0][n.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:n.asset,parser:i,userData:{}};return D(s,a,n),k(a,n),Promise.all(i._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let n=0,s=e.length;n<s;n++){const r=e[n].joints;for(let a=0,o=r.length;a<o;a++)t[r[a]].isBone=!0}for(let n=0,s=t.length;n<s;n++){const r=t[n];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(i[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,i){if(t.refs[e]<=1)return i;const n=i.clone(),s=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())s(u,a.children[c])};return s(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const n=t(e[i]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let n=0;n<e.length;n++){const s=t(e[n]);s&&i.push(s)}return i}getDependency(t,e){const i=t+":"+e;let n=this.cache.get(i);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":n=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(i,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const i=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(s,r){return i.getDependency(t,r)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],i=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[L.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(s,r){i.load(d.LoaderUtils.resolveURL(e.uri,n.path),s,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(i){const n=e.byteLength||0,s=e.byteOffset||0;return i.slice(s,s+n)})}loadAccessor(t){const e=this,i=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const r=U[n.type],a=H[n.componentType],o=n.normalized===!0,c=new a(n.count*r);return Promise.resolve(new d.BufferAttribute(c,r,o))}const s=[];return n.bufferView!==void 0?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),n.sparse!==void 0&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then(function(r){const a=r[0],o=U[n.type],c=H[n.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=n.byteOffset||0,m=n.bufferView!==void 0?i.bufferViews[n.bufferView].byteStride:void 0,g=n.normalized===!0;let M,T;if(m&&m!==l){const R=Math.floor(h/m),A="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+R+":"+n.count;let _=e.cache.get(A);_||(M=new c(a,R*m,n.count*m/u),_=new d.InterleavedBuffer(M,m/u),e.cache.add(A,_)),T=new d.InterleavedBufferAttribute(_,o,h%m/u,g)}else a===null?M=new c(n.count*o):M=new c(a,h,n.count*o),T=new d.BufferAttribute(M,o,g);if(n.sparse!==void 0){const R=U.SCALAR,A=H[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,b=new A(r[1],_,n.sparse.count*R),C=new c(r[2],x,n.sparse.count*o);a!==null&&(T=new d.BufferAttribute(T.array.slice(),T.itemSize,T.normalized)),T.normalized=!1;for(let S=0,v=b.length;S<v;S++){const y=b[S];if(T.setX(y,C[S*o]),o>=2&&T.setY(y,C[S*o+1]),o>=3&&T.setZ(y,C[S*o+2]),o>=4&&T.setW(y,C[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}T.normalized=g}return T})}loadTexture(t){const e=this.json,i=this.options,s=e.textures[t].source,r=e.images[s];let a=this.textureLoader;if(r.uri){const o=i.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(t,s,a)}loadTextureImage(t,e,i){const n=this,s=this.json,r=s.textures[t],a=s.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,i).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(s.samplers||{})[r.sampler]||{};return u.magFilter=Y[h.magFilter]||d.LinearFilter,u.minFilter=Y[h.minFilter]||d.LinearMipmapLinearFilter,u.wrapS=$[h.wrapS]||d.RepeatWrapping,u.wrapT=$[h.wrapT]||d.RepeatWrapping,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==d.NearestFilter&&u.minFilter!==d.LinearFilter,n.associations.set(u,{textures:t}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const i=this,n=this.json,s=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(l=>l.clone());const r=n.images[t],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=i.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,m){let g=h;e.isImageBitmapLoader===!0&&(g=function(M){const T=new d.Texture(M);T.needsUpdate=!0,h(T)}),e.load(d.LoaderUtils.resolveURL(l,s.path),g,void 0,m)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),k(l,r),l.userData.mimeType=r.mimeType||ke(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[t]=u,u}assignTexture(t,e,i,n){const s=this;return this.getDependency("texture",i.index).then(function(r){if(!r)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(r=r.clone(),r.channel=i.texCoord),s.extensions[L.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[L.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=s.associations.get(r);r=s.extensions[L.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),s.associations.set(r,o)}}return n!==void 0&&(r.colorSpace=n),t[e]=r,r})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new d.PointsMaterial,d.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,o.sizeAttenuation=!1,this.cache.add(a,o)),i=o}else if(t.isLine){const a="LineBasicMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new d.LineBasicMaterial,d.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,this.cache.add(a,o)),i=o}if(n||s||r){let a="ClonedMaterial:"+i.uuid+":";n&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=i.clone(),s&&(o.vertexColors=!0),r&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(i))),i=o}t.material=i}getMaterialType(){return d.MeshStandardMaterial}loadMaterial(t){const e=this,i=this.json,n=this.extensions,s=i.materials[t];let r;const a={},o=s.extensions||{},c=[];if(o[L.KHR_MATERIALS_UNLIT]){const l=n[L.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,s,e))}else{const l=s.pbrMetallicRoughness||{};if(a.color=new d.Color(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],d.LinearSRGBColorSpace),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,d.SRGBColorSpace)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(t,a)})))}s.doubleSided===!0&&(a.side=d.DoubleSide);const u=s.alphaMode||V.OPAQUE;if(u===V.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===V.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&r!==d.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new d.Vector2(1,1),s.normalTexture.scale!==void 0)){const l=s.normalTexture.scale;a.normalScale.set(l,l)}if(s.occlusionTexture!==void 0&&r!==d.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&r!==d.MeshBasicMaterial){const l=s.emissiveFactor;a.emissive=new d.Color().setRGB(l[0],l[1],l[2],d.LinearSRGBColorSpace)}return s.emissiveTexture!==void 0&&r!==d.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",s.emissiveTexture,d.SRGBColorSpace)),Promise.all(c).then(function(){const l=new r(a);return s.name&&(l.name=s.name),k(l,s),e.associations.set(l,{materials:t}),s.extensions&&D(n,l,s),l})}createUniqueName(t){const e=d.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function s(a){return i[L.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return J(o,a,e)})}const r=[];for(let a=0,o=t.length;a<o;a++){const c=t[a],u=Oe(c),l=n[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[L.KHR_DRACO_MESH_COMPRESSION]?h=s(c):h=J(new d.BufferGeometry,c,e),n[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(t){const e=this,i=this.json,n=this.extensions,s=i.meshes[t],r=s.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Ce(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let m=0,g=u.length;m<g;m++){const M=u[m],T=r[m];let R;const A=c[m];if(T.mode===I.TRIANGLES||T.mode===I.TRIANGLE_STRIP||T.mode===I.TRIANGLE_FAN||T.mode===void 0)R=s.isSkinnedMesh===!0?new d.SkinnedMesh(M,A):new d.Mesh(M,A),R.isSkinnedMesh===!0&&R.normalizeSkinWeights(),T.mode===I.TRIANGLE_STRIP?R.geometry=q(R.geometry,d.TriangleStripDrawMode):T.mode===I.TRIANGLE_FAN&&(R.geometry=q(R.geometry,d.TriangleFanDrawMode));else if(T.mode===I.LINES)R=new d.LineSegments(M,A);else if(T.mode===I.LINE_STRIP)R=new d.Line(M,A);else if(T.mode===I.LINE_LOOP)R=new d.LineLoop(M,A);else if(T.mode===I.POINTS)R=new d.Points(M,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+T.mode);Object.keys(R.geometry.morphAttributes).length>0&&ve(R,s),R.name=e.createUniqueName(s.name||"mesh_"+t),k(R,s),T.extensions&&D(n,R,T),e.assignFinalMaterial(R),l.push(R)}for(let m=0,g=l.length;m<g;m++)e.associations.set(l[m],{meshes:t,primitives:m});if(l.length===1)return s.extensions&&D(n,l[0],s),l[0];const h=new d.Group;s.extensions&&D(n,h,s),e.associations.set(h,{meshes:t});for(let m=0,g=l.length;m<g;m++)h.add(l[m]);return h})}loadCamera(t){let e;const i=this.json.cameras[t],n=i[i.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?e=new d.PerspectiveCamera(d.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):i.type==="orthographic"&&(e=new d.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),k(e,i),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],i=[];for(let n=0,s=e.joints.length;n<s;n++)i.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(n){const s=n.pop(),r=n,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new d.Matrix4;s!==null&&h.fromArray(s.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new d.Skeleton(a,o)})}loadAnimation(t){const e=this.json,i=this,n=e.animations[t],s=n.name?n.name:"animation_"+t,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=n.channels.length;l<h;l++){const m=n.channels[l],g=n.samplers[m.sampler],M=m.target,T=M.node,R=n.parameters!==void 0?n.parameters[g.input]:g.input,A=n.parameters!==void 0?n.parameters[g.output]:g.output;M.node!==void 0&&(r.push(this.getDependency("node",T)),a.push(this.getDependency("accessor",R)),o.push(this.getDependency("accessor",A)),c.push(g),u.push(M))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],m=l[1],g=l[2],M=l[3],T=l[4],R=[];for(let A=0,_=h.length;A<_;A++){const x=h[A],b=m[A],C=g[A],S=M[A],v=T[A];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const y=i._createAnimationTracks(x,b,C,S,v);if(y)for(let P=0;P<y.length;P++)R.push(y[P])}return new d.AnimationClip(s,void 0,R)})}createNodeMesh(t){const e=this.json,i=this,n=e.nodes[t];return n.mesh===void 0?null:i.getDependency("mesh",n.mesh).then(function(s){const r=i._getNodeRef(i.meshCache,n.mesh,s);return n.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),r})}loadNode(t){const e=this.json,i=this,n=e.nodes[t],s=i._loadNodeShallow(t),r=[],a=n.children||[];for(let c=0,u=a.length;c<u;c++)r.push(i.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([s,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(m){m.isSkinnedMesh&&m.bind(h,Pe)});for(let m=0,g=l.length;m<g;m++)u.add(l[m]);return u})}_loadNodeShallow(t){const e=this.json,i=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const s=e.nodes[t],r=s.name?n.createUniqueName(s.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),s.camera!==void 0&&a.push(n.getDependency("camera",s.camera).then(function(c){return n._getNodeRef(n.cameraCache,s.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new d.Bone:c.length>1?u=new d.Group:c.length===1?u=c[0]:u=new d.Object3D,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(s.name&&(u.userData.name=s.name,u.name=r),k(u,s),s.extensions&&D(i,u,s),s.matrix!==void 0){const l=new d.Matrix4;l.fromArray(s.matrix),u.applyMatrix4(l)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);if(!n.associations.has(u))n.associations.set(u,{});else if(s.mesh!==void 0&&n.meshCache.refs[s.mesh]>1){const l=n.associations.get(u);n.associations.set(u,{...l})}return n.associations.get(u).nodes=t,u}),this.nodeCache[t]}loadScene(t){const e=this.extensions,i=this.json.scenes[t],n=this,s=new d.Group;i.name&&(s.name=n.createUniqueName(i.name)),k(s,i),i.extensions&&D(e,s,i);const r=i.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(n.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++)s.add(o[u]);const c=u=>{const l=new Map;for(const[h,m]of n.associations)(h instanceof d.Material||h instanceof d.Texture)&&l.set(h,m);return u.traverse(h=>{const m=n.associations.get(h);m!=null&&l.set(h,m)}),l};return n.associations=c(s),s})}_createAnimationTracks(t,e,i,n,s){const r=[],a=t.name?t.name:t.uuid,o=[];F[s.path]===F.weights?t.traverse(function(h){h.morphTargetInfluences&&o.push(h.name?h.name:h.uuid)}):o.push(a);let c;switch(F[s.path]){case F.weights:c=d.NumberKeyframeTrack;break;case F.rotation:c=d.QuaternionKeyframeTrack;break;case F.translation:case F.scale:c=d.VectorKeyframeTrack;break;default:switch(i.itemSize){case 1:c=d.NumberKeyframeTrack;break;case 2:case 3:default:c=d.VectorKeyframeTrack;break}break}const u=n.interpolation!==void 0?Ne[n.interpolation]:d.InterpolateLinear,l=this._getArrayFromAccessor(i);for(let h=0,m=o.length;h<m;h++){const g=new c(o[h]+"."+F[s.path],e.array,l,u);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),r.push(g)}return r}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const i=z(e.constructor),n=new Float32Array(e.length);for(let s=0,r=e.length;s<r;s++)n[s]=e[s]*i;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(i){const n=this instanceof d.QuaternionKeyframeTrack?be:Z;return new n(this.times,this.values,this.getValueSize()/3,i)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function De(f,t,e){const i=t.attributes,n=new d.Box3;if(i.POSITION!==void 0){const a=e.json.accessors[i.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new d.Vector3(o[0],o[1],o[2]),new d.Vector3(c[0],c[1],c[2])),a.normalized){const u=z(H[a.componentType]);n.min.multiplyScalar(u),n.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=t.targets;if(s!==void 0){const a=new d.Vector3,o=new d.Vector3;for(let c=0,u=s.length;c<u;c++){const l=s[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],m=h.min,g=h.max;if(m!==void 0&&g!==void 0){if(o.setX(Math.max(Math.abs(m[0]),Math.abs(g[0]))),o.setY(Math.max(Math.abs(m[1]),Math.abs(g[1]))),o.setZ(Math.max(Math.abs(m[2]),Math.abs(g[2]))),h.normalized){const M=z(H[h.componentType]);o.multiplyScalar(M)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}f.boundingBox=n;const r=new d.Sphere;n.getCenter(r.center),r.radius=n.min.distanceTo(n.max)/2,f.boundingSphere=r}function J(f,t,e){const i=t.attributes,n=[];function s(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in i){const a=K[r]||r.toLowerCase();a in f.attributes||n.push(s(i[r],a))}if(t.indices!==void 0&&!f.index){const r=e.getDependency("accessor",t.indices).then(function(a){f.setIndex(a)});n.push(r)}return d.ColorManagement.workingColorSpace!==d.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${d.ColorManagement.workingColorSpace}" not supported.`),k(f,t),De(f,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Ie(f,t.targets,e):f})}function He(){const f=p.ref(!1),t=p.ref(""),e=p.shallowRef([]),i=p.ref(null),n=new B.MTLLoader,s=new B.OBJLoader,r=new B.STLLoader,a=new se;return{isLoading:f,loadingProgress:t,loadedModels:e,error:i,loadModelsFromBlobs:async c=>{var m;if(!c||c.length===0){console.warn("loadModelsFromBlobs 加载的文件数组为空!");return}f.value=!0,t.value="准备加载...",e.value=[],i.value=null;const u=new Map;c.forEach(g=>{g instanceof File&&u.set(g.name.toLowerCase(),g)});const l=[],h=[];try{for(const g of c){const M=g.name||"unknown_file",T=(m=M.split(".").pop())==null?void 0:m.toLowerCase();if(T==="mtl")continue;const R=URL.createObjectURL(g);l.push(R);let A=null;const _=x=>{const b=x.lengthComputable?x.loaded/x.total*100:0;t.value=`正在加载 ${M}... ${Math.round(b)}%`};switch(t.value=`正在加载 ${M}... 0%`,T){case"obj":const x=M.replace(/\.obj$/i,".mtl").toLowerCase();if(u.has(x)){const v=u.get(x),y=URL.createObjectURL(v);l.push(y);const P=await n.loadAsync(y);P.preload(),s.setMaterials(P)}else s.setMaterials(null);A=await s.loadAsync(R,_);break;case"stl":const b=await r.loadAsync(R,_),C=new d.MeshPhongMaterial({color:11184810,specular:1118481,shininess:200});A=new d.Mesh(b,C);break;case"gltf":case"glb":A=(await a.loadAsync(R,_)).scene;break;default:console.warn(`不支持的文件类型: .${T}`),t.value=`不支持的文件类型: ${M}`;continue}A&&(A.userData.boundingBox=new d.Box3().setFromObject(A),h.push(A))}e.value=h,t.value="加载完成!"}catch(g){throw console.error("加载模型时出错:",g),i.value=`加载失败: ${g.message||"未知错误"}`,t.value="加载失败!",e.value=[],g}finally{f.value=!1,l.forEach(g=>URL.revokeObjectURL(g))}}}}const Ge={class:"obj-viewer-container"},Be={class:"buttonGroup-topLeft"},Ue={class:"buttonGroup-left"},Ve={class:"left-panel"},je={class:"panel-header"},Ke={key:0,class:"clipping-content"},ze={class:"radio-group"},Xe={class:"radio-label"},qe={class:"radio-label"},We={class:"radio-label"},Ye={class:"radio-label"},$e={key:0,class:"loading-overlay"},Je=p.defineComponent({__name:"threePreview",props:{fileBlobs:{default:()=>[]}},setup(f){const t=f,e=p.ref(null),i=p.ref(!1),n=p.ref(""),{currentModels:s,resetView:r,initThreeJS:a,handleResize:o,getThreeJSObjects:c,cleanup:u,setModels:l,axesHelperVisible:h,toggleAxesVisibility:m}=O.useThreeJS(e),{isLoading:g,loadingProgress:M,loadedModels:T,error:R,loadModelsFromBlobs:A}=He(),{isAnimating:_,toggleAnimation:x,stopAnimation:b}=O.useAnimation(c,s),{isClipping:C,activeClippingAxis:S,toggleClipping:v,updateClippingPlanes:y}=O.useClipping(c,s),P=()=>{m()};p.watch(()=>t.fileBlobs,N=>{N&&N.length>0&&A(N).catch(E=>{console.error("加载错误:",E)})},{immediate:!0,deep:!0}),p.watch(T,N=>{N&&N.length>0&&l(N)}),p.watch(R,N=>{N&&X.ElMessage.error(`模型加载失败: ${N}`)});const ee=N=>{i.value=!0,n.value=N,C.value||v()};return p.onMounted(async()=>{await p.nextTick();try{a(),window.addEventListener("resize",o)}catch(N){console.error("Three.js 初始化失败:",N),X.ElMessage.error("渲染引擎初始化失败!")}}),p.onBeforeUnmount(()=>{n.value="",window.removeEventListener("resize",o),_.value&&b(),u()}),(N,E)=>{const te=p.resolveComponent("el-scrollbar");return p.openBlock(),p.createElementBlock("div",Ge,[p.createElementVNode("div",{ref_key:"threejsContainer",ref:e,class:"threejs-container"},null,512),E[15]||(E[15]=p.createElementVNode("div",{class:"buttonGroup-top"},null,-1)),p.createElementVNode("div",Be,[p.createVNode(O.SvgIcon,{name:"viewReset",size:"24",onClick:p.unref(r),title:"重置"},null,8,["onClick"]),p.createVNode(O.SvgIcon,{name:"fangda",size:"24",title:"放大"}),p.createVNode(O.SvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),p.createVNode(O.SvgIcon,{name:"lookAround",size:"24",onClick:p.unref(x),title:p.unref(_)?"停止动画":"动画视图"},null,8,["onClick","title"]),p.createVNode(O.SvgIcon,{name:"zuobiaoxi",size:"24",active:p.unref(h),onClick:P,title:"显隐坐标轴"},null,8,["active"])]),p.createElementVNode("div",Ue,[p.createVNode(O.SvgIcon,{name:"clipping",size:"24",onClick:E[0]||(E[0]=w=>ee("剖面视图")),active:i.value&&n.value==="剖面视图",title:"剖面视图"},null,8,["active"])]),E[16]||(E[16]=p.createElementVNode("div",{class:"buttonGroup-right"},null,-1)),E[17]||(E[17]=p.createElementVNode("div",{class:"buttonGroup-bottom"},null,-1)),p.withDirectives(p.createElementVNode("div",Ve,[p.createElementVNode("div",je,[p.createElementVNode("span",null,p.toDisplayString(n.value),1),p.createElementVNode("span",{class:"close",onClick:E[1]||(E[1]=w=>i.value=!1)}," X ")]),p.createVNode(te,{"max-height":"650px"},{default:p.withCtx(()=>[n.value==="剖面视图"?(p.openBlock(),p.createElementBlock("div",Ke,[p.createElementVNode("div",ze,[p.createElementVNode("label",Xe,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":E[2]||(E[2]=w=>p.isRef(S)?S.value=w:null),onChange:E[3]||(E[3]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[10]||(E[10]=p.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),p.createElementVNode("label",qe,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":E[4]||(E[4]=w=>p.isRef(S)?S.value=w:null),onChange:E[5]||(E[5]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[11]||(E[11]=p.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),p.createElementVNode("label",We,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":E[6]||(E[6]=w=>p.isRef(S)?S.value=w:null),onChange:E[7]||(E[7]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[12]||(E[12]=p.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),p.createElementVNode("label",Ye,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":E[8]||(E[8]=w=>p.isRef(S)?S.value=w:null),onChange:E[9]||(E[9]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[13]||(E[13]=p.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):p.createCommentVNode("",!0)]),_:1})],512),[[p.vShow,i.value]]),p.unref(g)?(p.openBlock(),p.createElementBlock("div",$e,[E[14]||(E[14]=p.createElementVNode("div",{class:"loading-spinner"},null,-1)),p.createElementVNode("p",null,p.toDisplayString(p.unref(M)),1)])):p.createCommentVNode("",!0)])}}}),Qe=ne._export_sfc(Je,[["__scopeId","data-v-cdd00cd0"]]);exports.default=Qe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vue"),O=require("./iconfont-t5epssvu.cjs"),B=require("./STLLoader-RU7KqloS.cjs"),d=require("./three-viewport-gizmo-BV37JzRa.cjs"),X=require("./index-BOJUyAaV.cjs"),ne=require("./_plugin-vue_export-helper-BHFhmbuH.cjs");function q(f,t){if(t===d.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),f;if(t===d.TriangleFanDrawMode||t===d.TriangleStripDrawMode){let e=f.getIndex();if(e===null){const r=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)r.push(o);f.setIndex(r),e=f.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),f}const i=e.count-2,n=[];if(t===d.TriangleFanDrawMode)for(let r=1;r<=i;r++)n.push(e.getX(0)),n.push(e.getX(r)),n.push(e.getX(r+1));else for(let r=0;r<i;r++)r%2===0?(n.push(e.getX(r)),n.push(e.getX(r+1)),n.push(e.getX(r+2))):(n.push(e.getX(r+2)),n.push(e.getX(r+1)),n.push(e.getX(r)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=f.clone();return s.setIndex(n),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),f}class se extends d.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new ce(e)}),this.register(function(e){return new le(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new de(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new pe(e)}),this.register(function(e){return new ae(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new ie(e)}),this.register(function(e){return new Me(e)}),this.register(function(e){return new Le(e)})}load(t,e,i,n){const s=this;let r;if(this.resourcePath!=="")r=this.resourcePath;else if(this.path!==""){const c=d.LoaderUtils.extractUrlBase(t);r=d.LoaderUtils.resolveURL(c,this.path)}else r=d.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),s.manager.itemError(t),s.manager.itemEnd(t)},o=new d.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{s.parse(c,r,function(u){e(u),s.manager.itemEnd(t)},a)}catch(u){a(u)}},i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){let s;const r={},a={},o=new TextDecoder;if(typeof t=="string")s=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===Q){try{r[L.KHR_BINARY_GLTF]=new Ae(t)}catch(l){n&&n(l);return}s=JSON.parse(r[L.KHR_BINARY_GLTF].content)}else s=JSON.parse(o.decode(t));else s=t;if(s.asset===void 0||s.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new Fe(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const l=this.pluginCallbacks[u](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,r[l.name]=!0}if(s.extensionsUsed)for(let u=0;u<s.extensionsUsed.length;++u){const l=s.extensionsUsed[u],h=s.extensionsRequired||[];switch(l){case L.KHR_MATERIALS_UNLIT:r[l]=new oe;break;case L.KHR_DRACO_MESH_COMPRESSION:r[l]=new Se(s,this.dracoLoader);break;case L.KHR_TEXTURE_TRANSFORM:r[l]=new _e;break;case L.KHR_MESH_QUANTIZATION:r[l]=new ye;break;default:h.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(r),c.setPlugins(a),c.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,s){i.parse(t,e,n,s)})}}function re(){let f={};return{get:function(t){return f[t]},add:function(t,e){f[t]=e},remove:function(t){delete f[t]},removeAll:function(){f={}}}}const L={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class ie{constructor(t){this.parser=t,this.name=L.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i<n;i++){const s=e[i];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(t){const e=this.parser,i="light:"+t;let n=e.cache.get(i);if(n)return n;const s=e.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t];let c;const u=new d.Color(16777215);o.color!==void 0&&u.setRGB(o.color[0],o.color[1],o.color[2],d.LinearSRGBColorSpace);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new d.DirectionalLight(u),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new d.PointLight(u),c.distance=l;break;case"spot":c=new d.SpotLight(u),c.distance=l,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),k(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+t),n=Promise.resolve(c),e.cache.add(i,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,i=this.parser,s=i.json.nodes[t],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return i._getNodeRef(e.cache,a,o)})}}class oe{constructor(){this.name=L.KHR_MATERIALS_UNLIT}getMaterialType(){return d.MeshBasicMaterial}extendParams(t,e,i){const n=[];t.color=new d.Color(1,1,1),t.opacity=1;const s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const r=s.baseColorFactor;t.color.setRGB(r[0],r[1],r[2],d.LinearSRGBColorSpace),t.opacity=r[3]}s.baseColorTexture!==void 0&&n.push(i.assignTexture(t,"map",s.baseColorTexture,d.SRGBColorSpace))}return Promise.all(n)}}class ae{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name].emissiveStrength;return s!==void 0&&(e.emissiveIntensity=s),Promise.resolve()}}class ce{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];if(r.clearcoatFactor!==void 0&&(e.clearcoat=r.clearcoatFactor),r.clearcoatTexture!==void 0&&s.push(i.assignTexture(e,"clearcoatMap",r.clearcoatTexture)),r.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=r.clearcoatRoughnessFactor),r.clearcoatRoughnessTexture!==void 0&&s.push(i.assignTexture(e,"clearcoatRoughnessMap",r.clearcoatRoughnessTexture)),r.clearcoatNormalTexture!==void 0&&(s.push(i.assignTexture(e,"clearcoatNormalMap",r.clearcoatNormalTexture)),r.clearcoatNormalTexture.scale!==void 0)){const a=r.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new d.Vector2(a,a)}return Promise.all(s)}}class le{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_DISPERSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.dispersion=s.dispersion!==void 0?s.dispersion:0,Promise.resolve()}}class ue{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return r.iridescenceFactor!==void 0&&(e.iridescence=r.iridescenceFactor),r.iridescenceTexture!==void 0&&s.push(i.assignTexture(e,"iridescenceMap",r.iridescenceTexture)),r.iridescenceIor!==void 0&&(e.iridescenceIOR=r.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),r.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=r.iridescenceThicknessMinimum),r.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=r.iridescenceThicknessMaximum),r.iridescenceThicknessTexture!==void 0&&s.push(i.assignTexture(e,"iridescenceThicknessMap",r.iridescenceThicknessTexture)),Promise.all(s)}}class de{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_SHEEN}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[];e.sheenColor=new d.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const r=n.extensions[this.name];if(r.sheenColorFactor!==void 0){const a=r.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace)}return r.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=r.sheenRoughnessFactor),r.sheenColorTexture!==void 0&&s.push(i.assignTexture(e,"sheenColorMap",r.sheenColorTexture,d.SRGBColorSpace)),r.sheenRoughnessTexture!==void 0&&s.push(i.assignTexture(e,"sheenRoughnessMap",r.sheenRoughnessTexture)),Promise.all(s)}}class fe{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return r.transmissionFactor!==void 0&&(e.transmission=r.transmissionFactor),r.transmissionTexture!==void 0&&s.push(i.assignTexture(e,"transmissionMap",r.transmissionTexture)),Promise.all(s)}}class he{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_VOLUME}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];e.thickness=r.thicknessFactor!==void 0?r.thicknessFactor:0,r.thicknessTexture!==void 0&&s.push(i.assignTexture(e,"thicknessMap",r.thicknessTexture)),e.attenuationDistance=r.attenuationDistance||1/0;const a=r.attenuationColor||[1,1,1];return e.attenuationColor=new d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),Promise.all(s)}}class pe{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_IOR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=n.extensions[this.name];return e.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}}class me{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_SPECULAR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];e.specularIntensity=r.specularFactor!==void 0?r.specularFactor:1,r.specularTexture!==void 0&&s.push(i.assignTexture(e,"specularIntensityMap",r.specularTexture));const a=r.specularColorFactor||[1,1,1];return e.specularColor=new d.Color().setRGB(a[0],a[1],a[2],d.LinearSRGBColorSpace),r.specularColorTexture!==void 0&&s.push(i.assignTexture(e,"specularColorMap",r.specularColorTexture,d.SRGBColorSpace)),Promise.all(s)}}class ge{constructor(t){this.parser=t,this.name=L.EXT_MATERIALS_BUMP}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return e.bumpScale=r.bumpFactor!==void 0?r.bumpFactor:1,r.bumpTexture!==void 0&&s.push(i.assignTexture(e,"bumpMap",r.bumpTexture)),Promise.all(s)}}class Te{constructor(t){this.parser=t,this.name=L.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:d.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const s=[],r=n.extensions[this.name];return r.anisotropyStrength!==void 0&&(e.anisotropy=r.anisotropyStrength),r.anisotropyRotation!==void 0&&(e.anisotropyRotation=r.anisotropyRotation),r.anisotropyTexture!==void 0&&s.push(i.assignTexture(e,"anisotropyMap",r.anisotropyTexture)),Promise.all(s)}}class Re{constructor(t){this.parser=t,this.name=L.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,i=e.json,n=i.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const s=n.extensions[this.name],r=e.options.ktx2Loader;if(!r){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,s.source,r)}}class xe{constructor(t){this.parser=t,this.name=L.EXT_TEXTURE_WEBP}loadTexture(t){const e=this.name,i=this.parser,n=i.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const r=s.extensions[e],a=n.images[r.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return i.loadTextureImage(t,r.source,o)}}class Ee{constructor(t){this.parser=t,this.name=L.EXT_TEXTURE_AVIF}loadTexture(t){const e=this.name,i=this.parser,n=i.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;const r=s.extensions[e],a=n.images[r.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return i.loadTextureImage(t,r.source,o)}}class Me{constructor(t){this.name=L.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],s=this.parser.getDependency("buffer",n.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,u=n.count,l=n.byteStride,h=new Uint8Array(a,o,c);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(u,l,h,n.mode,n.filter).then(function(m){return m.buffer}):r.ready.then(function(){const m=new ArrayBuffer(u*l);return r.decodeGltfBuffer(new Uint8Array(m),u,l,h,n.mode,n.filter),m})})}else return null}}class Le{constructor(t){this.name=L.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=e.meshes[i.mesh];for(const c of n.primitives)if(c.mode!==I.TRIANGLES&&c.mode!==I.TRIANGLE_STRIP&&c.mode!==I.TRIANGLE_FAN&&c.mode!==void 0)return null;const r=i.extensions[this.name].attributes,a=[],o={};for(const c in r)a.push(this.parser.getDependency("accessor",r[c]).then(u=>(o[c]=u,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const u=c.pop(),l=u.isGroup?u.children:[u],h=c[0].count,m=[];for(const g of l){const M=new d.Matrix4,T=new d.Vector3,R=new d.Quaternion,A=new d.Vector3(1,1,1),_=new d.InstancedMesh(g.geometry,g.material,h);for(let x=0;x<h;x++)o.TRANSLATION&&T.fromBufferAttribute(o.TRANSLATION,x),o.ROTATION&&R.fromBufferAttribute(o.ROTATION,x),o.SCALE&&A.fromBufferAttribute(o.SCALE,x),_.setMatrixAt(x,M.compose(T,R,A));for(const x in o)if(x==="_COLOR_0"){const b=o[x];_.instanceColor=new d.InstancedBufferAttribute(b.array,b.itemSize,b.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,o[x]);d.Object3D.prototype.copy.call(_,g),this.parser.assignFinalMaterial(_),m.push(_)}return u.isGroup?(u.clear(),u.add(...m),u):m[0]}))}}const Q="glTF",G=12,W={JSON:1313821514,BIN:5130562};class Ae{constructor(t){this.name=L.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,G),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Q)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-G,s=new DataView(t,G);let r=0;for(;r<n;){const a=s.getUint32(r,!0);r+=4;const o=s.getUint32(r,!0);if(r+=4,o===W.JSON){const c=new Uint8Array(t,G+r,a);this.content=i.decode(c)}else if(o===W.BIN){const c=G+r;this.body=t.slice(c,c+a)}r+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Se{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=L.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const i=this.json,n=this.dracoLoader,s=t.extensions[this.name].bufferView,r=t.extensions[this.name].attributes,a={},o={},c={};for(const u in r){const l=K[u]||u.toLowerCase();a[l]=r[u]}for(const u in t.attributes){const l=K[u]||u.toLowerCase();if(r[u]!==void 0){const h=i.accessors[t.attributes[u]],m=H[h.componentType];c[l]=m.name,o[l]=h.normalized===!0}}return e.getDependency("bufferView",s).then(function(u){return new Promise(function(l,h){n.decodeDracoFile(u,function(m){for(const g in m.attributes){const M=m.attributes[g],T=o[g];T!==void 0&&(M.normalized=T)}l(m)},a,c,d.LinearSRGBColorSpace,h)})})}}class _e{constructor(){this.name=L.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}}class ye{constructor(){this.name=L.KHR_MESH_QUANTIZATION}}class Z extends d.Interpolant{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n*3+n;for(let r=0;r!==n;r++)e[r]=i[s+r];return e}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,u=n-e,l=(i-e)/u,h=l*l,m=h*l,g=t*c,M=g-c,T=-2*m+3*h,R=m-h,A=1-T,_=R-h+l;for(let x=0;x!==a;x++){const b=r[M+x+a],C=r[M+x+o]*u,S=r[g+x+a],v=r[g+x]*u;s[x]=A*b+_*C+T*S+R*v}return s}}const we=new d.Quaternion;class be extends Z{interpolate_(t,e,i,n){const s=super.interpolate_(t,e,i,n);return we.fromArray(s).normalize().toArray(s),s}}const I={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},H={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Y={9728:d.NearestFilter,9729:d.LinearFilter,9984:d.NearestMipmapNearestFilter,9985:d.LinearMipmapNearestFilter,9986:d.NearestMipmapLinearFilter,9987:d.LinearMipmapLinearFilter},$={33071:d.ClampToEdgeWrapping,33648:d.MirroredRepeatWrapping,10497:d.RepeatWrapping},U={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},K={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},F={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ne={CUBICSPLINE:void 0,LINEAR:d.InterpolateLinear,STEP:d.InterpolateDiscrete},V={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Ce(f){return f.DefaultMaterial===void 0&&(f.DefaultMaterial=new d.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:d.FrontSide})),f.DefaultMaterial}function D(f,t,e){for(const i in e.extensions)f[i]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=e.extensions[i])}function k(f,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(f.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Ie(f,t,e){let i=!1,n=!1,s=!1;for(let c=0,u=t.length;c<u;c++){const l=t[c];if(l.POSITION!==void 0&&(i=!0),l.NORMAL!==void 0&&(n=!0),l.COLOR_0!==void 0&&(s=!0),i&&n&&s)break}if(!i&&!n&&!s)return Promise.resolve(f);const r=[],a=[],o=[];for(let c=0,u=t.length;c<u;c++){const l=t[c];if(i){const h=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):f.attributes.position;r.push(h)}if(n){const h=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):f.attributes.normal;a.push(h)}if(s){const h=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):f.attributes.color;o.push(h)}}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o)]).then(function(c){const u=c[0],l=c[1],h=c[2];return i&&(f.morphAttributes.position=u),n&&(f.morphAttributes.normal=l),s&&(f.morphAttributes.color=h),f.morphTargetsRelative=!0,f})}function ve(f,t){if(f.updateMorphTargets(),t.weights!==void 0)for(let e=0,i=t.weights.length;e<i;e++)f.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(f.morphTargetInfluences.length===e.length){f.morphTargetDictionary={};for(let i=0,n=e.length;i<n;i++)f.morphTargetDictionary[e[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Oe(f){let t;const e=f.extensions&&f.extensions[L.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+j(e.attributes):t=f.indices+":"+j(f.attributes)+":"+f.mode,f.targets!==void 0)for(let i=0,n=f.targets.length;i<n;i++)t+=":"+j(f.targets[i]);return t}function j(f){let t="";const e=Object.keys(f).sort();for(let i=0,n=e.length;i<n;i++)t+=e[i]+":"+f[e[i]]+";";return t}function z(f){switch(f){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function ke(f){return f.search(/\.jpe?g($|\?)/i)>0||f.search(/^data\:image\/jpeg/)===0?"image/jpeg":f.search(/\.webp($|\?)/i)>0||f.search(/^data\:image\/webp/)===0?"image/webp":f.search(/\.ktx2($|\?)/i)>0||f.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const Pe=new d.Matrix4;class Fe{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new re,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=-1,s=!1,r=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=i&&o?parseInt(o[1],10):-1,s=a.indexOf("Firefox")>-1,r=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&n<17||s&&r<98?this.textureLoader=new d.TextureLoader(this.options.manager):this.textureLoader=new d.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new d.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(r){const a={scene:r[0][n.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:n.asset,parser:i,userData:{}};return D(s,a,n),k(a,n),Promise.all(i._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let n=0,s=e.length;n<s;n++){const r=e[n].joints;for(let a=0,o=r.length;a<o;a++)t[r[a]].isBone=!0}for(let n=0,s=t.length;n<s;n++){const r=t[n];r.mesh!==void 0&&(this._addNodeRef(this.meshCache,r.mesh),r.skin!==void 0&&(i[r.mesh].isSkinnedMesh=!0)),r.camera!==void 0&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,i){if(t.refs[e]<=1)return i;const n=i.clone(),s=(r,a)=>{const o=this.associations.get(r);o!=null&&this.associations.set(a,o);for(const[c,u]of r.children.entries())s(u,a.children[c])};return s(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const n=t(e[i]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let n=0;n<e.length;n++){const s=t(e[n]);s&&i.push(s)}return i}getDependency(t,e){const i=t+":"+e;let n=this.cache.get(i);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":n=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(i,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const i=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(s,r){return i.getDependency(t,r)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],i=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[L.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(s,r){i.load(d.LoaderUtils.resolveURL(e.uri,n.path),s,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(i){const n=e.byteLength||0,s=e.byteOffset||0;return i.slice(s,s+n)})}loadAccessor(t){const e=this,i=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const r=U[n.type],a=H[n.componentType],o=n.normalized===!0,c=new a(n.count*r);return Promise.resolve(new d.BufferAttribute(c,r,o))}const s=[];return n.bufferView!==void 0?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),n.sparse!==void 0&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then(function(r){const a=r[0],o=U[n.type],c=H[n.componentType],u=c.BYTES_PER_ELEMENT,l=u*o,h=n.byteOffset||0,m=n.bufferView!==void 0?i.bufferViews[n.bufferView].byteStride:void 0,g=n.normalized===!0;let M,T;if(m&&m!==l){const R=Math.floor(h/m),A="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+R+":"+n.count;let _=e.cache.get(A);_||(M=new c(a,R*m,n.count*m/u),_=new d.InterleavedBuffer(M,m/u),e.cache.add(A,_)),T=new d.InterleavedBufferAttribute(_,o,h%m/u,g)}else a===null?M=new c(n.count*o):M=new c(a,h,n.count*o),T=new d.BufferAttribute(M,o,g);if(n.sparse!==void 0){const R=U.SCALAR,A=H[n.sparse.indices.componentType],_=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,b=new A(r[1],_,n.sparse.count*R),C=new c(r[2],x,n.sparse.count*o);a!==null&&(T=new d.BufferAttribute(T.array.slice(),T.itemSize,T.normalized)),T.normalized=!1;for(let S=0,v=b.length;S<v;S++){const y=b[S];if(T.setX(y,C[S*o]),o>=2&&T.setY(y,C[S*o+1]),o>=3&&T.setZ(y,C[S*o+2]),o>=4&&T.setW(y,C[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}T.normalized=g}return T})}loadTexture(t){const e=this.json,i=this.options,s=e.textures[t].source,r=e.images[s];let a=this.textureLoader;if(r.uri){const o=i.manager.getHandler(r.uri);o!==null&&(a=o)}return this.loadTextureImage(t,s,a)}loadTextureImage(t,e,i){const n=this,s=this.json,r=s.textures[t],a=s.images[e],o=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,i).then(function(u){u.flipY=!1,u.name=r.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(s.samplers||{})[r.sampler]||{};return u.magFilter=Y[h.magFilter]||d.LinearFilter,u.minFilter=Y[h.minFilter]||d.LinearMipmapLinearFilter,u.wrapS=$[h.wrapS]||d.RepeatWrapping,u.wrapT=$[h.wrapT]||d.RepeatWrapping,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==d.NearestFilter&&u.minFilter!==d.LinearFilter,n.associations.set(u,{textures:t}),u}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const i=this,n=this.json,s=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(l=>l.clone());const r=n.images[t],a=self.URL||self.webkitURL;let o=r.uri||"",c=!1;if(r.bufferView!==void 0)o=i.getDependency("bufferView",r.bufferView).then(function(l){c=!0;const h=new Blob([l],{type:r.mimeType});return o=a.createObjectURL(h),o});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(l){return new Promise(function(h,m){let g=h;e.isImageBitmapLoader===!0&&(g=function(M){const T=new d.Texture(M);T.needsUpdate=!0,h(T)}),e.load(d.LoaderUtils.resolveURL(l,s.path),g,void 0,m)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),k(l,r),l.userData.mimeType=r.mimeType||ke(r.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[t]=u,u}assignTexture(t,e,i,n){const s=this;return this.getDependency("texture",i.index).then(function(r){if(!r)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(r=r.clone(),r.channel=i.texCoord),s.extensions[L.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[L.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=s.associations.get(r);r=s.extensions[L.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),s.associations.set(r,o)}}return n!==void 0&&(r.colorSpace=n),t[e]=r,r})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,r=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new d.PointsMaterial,d.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,o.sizeAttenuation=!1,this.cache.add(a,o)),i=o}else if(t.isLine){const a="LineBasicMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new d.LineBasicMaterial,d.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,this.cache.add(a,o)),i=o}if(n||s||r){let a="ClonedMaterial:"+i.uuid+":";n&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=i.clone(),s&&(o.vertexColors=!0),r&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(i))),i=o}t.material=i}getMaterialType(){return d.MeshStandardMaterial}loadMaterial(t){const e=this,i=this.json,n=this.extensions,s=i.materials[t];let r;const a={},o=s.extensions||{},c=[];if(o[L.KHR_MATERIALS_UNLIT]){const l=n[L.KHR_MATERIALS_UNLIT];r=l.getMaterialType(),c.push(l.extendParams(a,s,e))}else{const l=s.pbrMetallicRoughness||{};if(a.color=new d.Color(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const h=l.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],d.LinearSRGBColorSpace),a.opacity=h[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,d.SRGBColorSpace)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),r=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(t,a)})))}s.doubleSided===!0&&(a.side=d.DoubleSide);const u=s.alphaMode||V.OPAQUE;if(u===V.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===V.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&r!==d.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new d.Vector2(1,1),s.normalTexture.scale!==void 0)){const l=s.normalTexture.scale;a.normalScale.set(l,l)}if(s.occlusionTexture!==void 0&&r!==d.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&r!==d.MeshBasicMaterial){const l=s.emissiveFactor;a.emissive=new d.Color().setRGB(l[0],l[1],l[2],d.LinearSRGBColorSpace)}return s.emissiveTexture!==void 0&&r!==d.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",s.emissiveTexture,d.SRGBColorSpace)),Promise.all(c).then(function(){const l=new r(a);return s.name&&(l.name=s.name),k(l,s),e.associations.set(l,{materials:t}),s.extensions&&D(n,l,s),l})}createUniqueName(t){const e=d.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function s(a){return i[L.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return J(o,a,e)})}const r=[];for(let a=0,o=t.length;a<o;a++){const c=t[a],u=Oe(c),l=n[u];if(l)r.push(l.promise);else{let h;c.extensions&&c.extensions[L.KHR_DRACO_MESH_COMPRESSION]?h=s(c):h=J(new d.BufferGeometry,c,e),n[u]={primitive:c,promise:h},r.push(h)}}return Promise.all(r)}loadMesh(t){const e=this,i=this.json,n=this.extensions,s=i.meshes[t],r=s.primitives,a=[];for(let o=0,c=r.length;o<c;o++){const u=r[o].material===void 0?Ce(this.cache):this.getDependency("material",r[o].material);a.push(u)}return a.push(e.loadGeometries(r)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),u=o[o.length-1],l=[];for(let m=0,g=u.length;m<g;m++){const M=u[m],T=r[m];let R;const A=c[m];if(T.mode===I.TRIANGLES||T.mode===I.TRIANGLE_STRIP||T.mode===I.TRIANGLE_FAN||T.mode===void 0)R=s.isSkinnedMesh===!0?new d.SkinnedMesh(M,A):new d.Mesh(M,A),R.isSkinnedMesh===!0&&R.normalizeSkinWeights(),T.mode===I.TRIANGLE_STRIP?R.geometry=q(R.geometry,d.TriangleStripDrawMode):T.mode===I.TRIANGLE_FAN&&(R.geometry=q(R.geometry,d.TriangleFanDrawMode));else if(T.mode===I.LINES)R=new d.LineSegments(M,A);else if(T.mode===I.LINE_STRIP)R=new d.Line(M,A);else if(T.mode===I.LINE_LOOP)R=new d.LineLoop(M,A);else if(T.mode===I.POINTS)R=new d.Points(M,A);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+T.mode);Object.keys(R.geometry.morphAttributes).length>0&&ve(R,s),R.name=e.createUniqueName(s.name||"mesh_"+t),k(R,s),T.extensions&&D(n,R,T),e.assignFinalMaterial(R),l.push(R)}for(let m=0,g=l.length;m<g;m++)e.associations.set(l[m],{meshes:t,primitives:m});if(l.length===1)return s.extensions&&D(n,l[0],s),l[0];const h=new d.Group;s.extensions&&D(n,h,s),e.associations.set(h,{meshes:t});for(let m=0,g=l.length;m<g;m++)h.add(l[m]);return h})}loadCamera(t){let e;const i=this.json.cameras[t],n=i[i.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?e=new d.PerspectiveCamera(d.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):i.type==="orthographic"&&(e=new d.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),k(e,i),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],i=[];for(let n=0,s=e.joints.length;n<s;n++)i.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(n){const s=n.pop(),r=n,a=[],o=[];for(let c=0,u=r.length;c<u;c++){const l=r[c];if(l){a.push(l);const h=new d.Matrix4;s!==null&&h.fromArray(s.array,c*16),o.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new d.Skeleton(a,o)})}loadAnimation(t){const e=this.json,i=this,n=e.animations[t],s=n.name?n.name:"animation_"+t,r=[],a=[],o=[],c=[],u=[];for(let l=0,h=n.channels.length;l<h;l++){const m=n.channels[l],g=n.samplers[m.sampler],M=m.target,T=M.node,R=n.parameters!==void 0?n.parameters[g.input]:g.input,A=n.parameters!==void 0?n.parameters[g.output]:g.output;M.node!==void 0&&(r.push(this.getDependency("node",T)),a.push(this.getDependency("accessor",R)),o.push(this.getDependency("accessor",A)),c.push(g),u.push(M))}return Promise.all([Promise.all(r),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(u)]).then(function(l){const h=l[0],m=l[1],g=l[2],M=l[3],T=l[4],R=[];for(let A=0,_=h.length;A<_;A++){const x=h[A],b=m[A],C=g[A],S=M[A],v=T[A];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const y=i._createAnimationTracks(x,b,C,S,v);if(y)for(let P=0;P<y.length;P++)R.push(y[P])}return new d.AnimationClip(s,void 0,R)})}createNodeMesh(t){const e=this.json,i=this,n=e.nodes[t];return n.mesh===void 0?null:i.getDependency("mesh",n.mesh).then(function(s){const r=i._getNodeRef(i.meshCache,n.mesh,s);return n.weights!==void 0&&r.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),r})}loadNode(t){const e=this.json,i=this,n=e.nodes[t],s=i._loadNodeShallow(t),r=[],a=n.children||[];for(let c=0,u=a.length;c<u;c++)r.push(i.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([s,Promise.all(r),o]).then(function(c){const u=c[0],l=c[1],h=c[2];h!==null&&u.traverse(function(m){m.isSkinnedMesh&&m.bind(h,Pe)});for(let m=0,g=l.length;m<g;m++)u.add(l[m]);return u})}_loadNodeShallow(t){const e=this.json,i=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const s=e.nodes[t],r=s.name?n.createUniqueName(s.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),s.camera!==void 0&&a.push(n.getDependency("camera",s.camera).then(function(c){return n._getNodeRef(n.cameraCache,s.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let u;if(s.isBone===!0?u=new d.Bone:c.length>1?u=new d.Group:c.length===1?u=c[0]:u=new d.Object3D,u!==c[0])for(let l=0,h=c.length;l<h;l++)u.add(c[l]);if(s.name&&(u.userData.name=s.name,u.name=r),k(u,s),s.extensions&&D(i,u,s),s.matrix!==void 0){const l=new d.Matrix4;l.fromArray(s.matrix),u.applyMatrix4(l)}else s.translation!==void 0&&u.position.fromArray(s.translation),s.rotation!==void 0&&u.quaternion.fromArray(s.rotation),s.scale!==void 0&&u.scale.fromArray(s.scale);if(!n.associations.has(u))n.associations.set(u,{});else if(s.mesh!==void 0&&n.meshCache.refs[s.mesh]>1){const l=n.associations.get(u);n.associations.set(u,{...l})}return n.associations.get(u).nodes=t,u}),this.nodeCache[t]}loadScene(t){const e=this.extensions,i=this.json.scenes[t],n=this,s=new d.Group;i.name&&(s.name=n.createUniqueName(i.name)),k(s,i),i.extensions&&D(e,s,i);const r=i.nodes||[],a=[];for(let o=0,c=r.length;o<c;o++)a.push(n.getDependency("node",r[o]));return Promise.all(a).then(function(o){for(let u=0,l=o.length;u<l;u++)s.add(o[u]);const c=u=>{const l=new Map;for(const[h,m]of n.associations)(h instanceof d.Material||h instanceof d.Texture)&&l.set(h,m);return u.traverse(h=>{const m=n.associations.get(h);m!=null&&l.set(h,m)}),l};return n.associations=c(s),s})}_createAnimationTracks(t,e,i,n,s){const r=[],a=t.name?t.name:t.uuid,o=[];F[s.path]===F.weights?t.traverse(function(h){h.morphTargetInfluences&&o.push(h.name?h.name:h.uuid)}):o.push(a);let c;switch(F[s.path]){case F.weights:c=d.NumberKeyframeTrack;break;case F.rotation:c=d.QuaternionKeyframeTrack;break;case F.translation:case F.scale:c=d.VectorKeyframeTrack;break;default:switch(i.itemSize){case 1:c=d.NumberKeyframeTrack;break;case 2:case 3:default:c=d.VectorKeyframeTrack;break}break}const u=n.interpolation!==void 0?Ne[n.interpolation]:d.InterpolateLinear,l=this._getArrayFromAccessor(i);for(let h=0,m=o.length;h<m;h++){const g=new c(o[h]+"."+F[s.path],e.array,l,u);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),r.push(g)}return r}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const i=z(e.constructor),n=new Float32Array(e.length);for(let s=0,r=e.length;s<r;s++)n[s]=e[s]*i;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(i){const n=this instanceof d.QuaternionKeyframeTrack?be:Z;return new n(this.times,this.values,this.getValueSize()/3,i)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function De(f,t,e){const i=t.attributes,n=new d.Box3;if(i.POSITION!==void 0){const a=e.json.accessors[i.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new d.Vector3(o[0],o[1],o[2]),new d.Vector3(c[0],c[1],c[2])),a.normalized){const u=z(H[a.componentType]);n.min.multiplyScalar(u),n.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=t.targets;if(s!==void 0){const a=new d.Vector3,o=new d.Vector3;for(let c=0,u=s.length;c<u;c++){const l=s[c];if(l.POSITION!==void 0){const h=e.json.accessors[l.POSITION],m=h.min,g=h.max;if(m!==void 0&&g!==void 0){if(o.setX(Math.max(Math.abs(m[0]),Math.abs(g[0]))),o.setY(Math.max(Math.abs(m[1]),Math.abs(g[1]))),o.setZ(Math.max(Math.abs(m[2]),Math.abs(g[2]))),h.normalized){const M=z(H[h.componentType]);o.multiplyScalar(M)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}f.boundingBox=n;const r=new d.Sphere;n.getCenter(r.center),r.radius=n.min.distanceTo(n.max)/2,f.boundingSphere=r}function J(f,t,e){const i=t.attributes,n=[];function s(r,a){return e.getDependency("accessor",r).then(function(o){f.setAttribute(a,o)})}for(const r in i){const a=K[r]||r.toLowerCase();a in f.attributes||n.push(s(i[r],a))}if(t.indices!==void 0&&!f.index){const r=e.getDependency("accessor",t.indices).then(function(a){f.setIndex(a)});n.push(r)}return d.ColorManagement.workingColorSpace!==d.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${d.ColorManagement.workingColorSpace}" not supported.`),k(f,t),De(f,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Ie(f,t.targets,e):f})}function He(){const f=p.ref(!1),t=p.ref(""),e=p.shallowRef([]),i=p.ref(null),n=new B.MTLLoader,s=new B.OBJLoader,r=new B.STLLoader,a=new se;return{isLoading:f,loadingProgress:t,loadedModels:e,error:i,loadModelsFromBlobs:async c=>{var m;if(!c||c.length===0){console.warn("loadModelsFromBlobs 加载的文件数组为空!");return}f.value=!0,t.value="准备加载...",e.value=[],i.value=null;const u=new Map;c.forEach(g=>{g instanceof File&&u.set(g.name.toLowerCase(),g)});const l=[],h=[];try{for(const g of c){const M=g.name||"unknown_file",T=(m=M.split(".").pop())==null?void 0:m.toLowerCase();if(T==="mtl")continue;const R=URL.createObjectURL(g);l.push(R);let A=null;const _=x=>{const b=x.lengthComputable?x.loaded/x.total*100:0;t.value=`正在加载 ${M}... ${Math.round(b)}%`};switch(t.value=`正在加载 ${M}... 0%`,T){case"obj":const x=M.replace(/\.obj$/i,".mtl").toLowerCase();if(u.has(x)){const v=u.get(x),y=URL.createObjectURL(v);l.push(y);const P=await n.loadAsync(y);P.preload(),s.setMaterials(P)}else s.setMaterials(null);A=await s.loadAsync(R,_);break;case"stl":const b=await r.loadAsync(R,_),C=new d.MeshPhongMaterial({color:11184810,specular:1118481,shininess:200});A=new d.Mesh(b,C);break;case"gltf":case"glb":A=(await a.loadAsync(R,_)).scene;break;default:console.warn(`不支持的文件类型: .${T}`),t.value=`不支持的文件类型: ${M}`;continue}A&&(A.userData.boundingBox=new d.Box3().setFromObject(A),h.push(A))}e.value=h,t.value="加载完成!"}catch(g){throw console.error("加载模型时出错:",g),i.value=`加载失败: ${g.message||"未知错误"}`,t.value="加载失败!",e.value=[],g}finally{f.value=!1,l.forEach(g=>URL.revokeObjectURL(g))}}}}const Ge={class:"obj-viewer-container"},Be={class:"buttonGroup-topLeft"},Ue={class:"buttonGroup-left"},Ve={class:"left-panel"},je={class:"panel-header"},Ke={key:0,class:"clipping-content"},ze={class:"radio-group"},Xe={class:"radio-label"},qe={class:"radio-label"},We={class:"radio-label"},Ye={class:"radio-label"},$e={key:0,class:"loading-overlay"},Je=p.defineComponent({__name:"threePreview",props:{fileBlobs:{default:()=>[]}},setup(f){const t=f,e=p.ref(null),i=p.ref(!1),n=p.ref(""),{currentModels:s,resetView:r,initThreeJS:a,handleResize:o,getThreeJSObjects:c,cleanup:u,setModels:l,axesHelperVisible:h,toggleAxesVisibility:m}=O.useThreeJS(e),{isLoading:g,loadingProgress:M,loadedModels:T,error:R,loadModelsFromBlobs:A}=He(),{isAnimating:_,toggleAnimation:x,stopAnimation:b}=O.useAnimation(c,s),{isClipping:C,activeClippingAxis:S,toggleClipping:v,updateClippingPlanes:y}=O.useClipping(c,s),P=()=>{m()};p.watch(()=>t.fileBlobs,N=>{N&&N.length>0&&A(N).catch(E=>{console.error("加载错误:",E)})},{immediate:!0,deep:!0}),p.watch(T,N=>{N&&N.length>0&&l(N)}),p.watch(R,N=>{N&&X.ElMessage.error(`模型加载失败: ${N}`)});const ee=N=>{i.value=!0,n.value=N,C.value||v()};return p.onMounted(async()=>{await p.nextTick();try{a(),window.addEventListener("resize",o)}catch(N){console.error("Three.js 初始化失败:",N),X.ElMessage.error("渲染引擎初始化失败!")}}),p.onBeforeUnmount(()=>{n.value="",window.removeEventListener("resize",o),_.value&&b(),u()}),(N,E)=>{const te=p.resolveComponent("el-scrollbar");return p.openBlock(),p.createElementBlock("div",Ge,[p.createElementVNode("div",{ref_key:"threejsContainer",ref:e,class:"threejs-container"},null,512),E[15]||(E[15]=p.createElementVNode("div",{class:"buttonGroup-top"},null,-1)),p.createElementVNode("div",Be,[p.createVNode(O.SvgIcon,{name:"viewReset",size:"24",onClick:p.unref(r),title:"重置"},null,8,["onClick"]),p.createVNode(O.SvgIcon,{name:"fangda",size:"24",title:"放大"}),p.createVNode(O.SvgIcon,{name:"suoxiao",size:"24",title:"缩小"}),p.createVNode(O.SvgIcon,{name:"lookAround",size:"24",onClick:p.unref(x),title:p.unref(_)?"停止动画":"动画视图"},null,8,["onClick","title"]),p.createVNode(O.SvgIcon,{name:"zuobiaoxi",size:"24",active:p.unref(h),onClick:P,title:"显隐坐标轴"},null,8,["active"])]),p.createElementVNode("div",Ue,[p.createVNode(O.SvgIcon,{name:"clipping",size:"24",onClick:E[0]||(E[0]=w=>ee("剖面视图")),active:i.value&&n.value==="剖面视图",title:"剖面视图"},null,8,["active"])]),E[16]||(E[16]=p.createElementVNode("div",{class:"buttonGroup-right"},null,-1)),E[17]||(E[17]=p.createElementVNode("div",{class:"buttonGroup-bottom"},null,-1)),p.withDirectives(p.createElementVNode("div",Ve,[p.createElementVNode("div",je,[p.createElementVNode("span",null,p.toDisplayString(n.value),1),p.createElementVNode("span",{class:"close",onClick:E[1]||(E[1]=w=>i.value=!1)}," X ")]),p.createVNode(te,{"max-height":"650px"},{default:p.withCtx(()=>[n.value==="剖面视图"?(p.openBlock(),p.createElementBlock("div",Ke,[p.createElementVNode("div",ze,[p.createElementVNode("label",Xe,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":E[2]||(E[2]=w=>p.isRef(S)?S.value=w:null),onChange:E[3]||(E[3]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[10]||(E[10]=p.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),p.createElementVNode("label",qe,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":E[4]||(E[4]=w=>p.isRef(S)?S.value=w:null),onChange:E[5]||(E[5]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[11]||(E[11]=p.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),p.createElementVNode("label",We,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":E[6]||(E[6]=w=>p.isRef(S)?S.value=w:null),onChange:E[7]||(E[7]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[12]||(E[12]=p.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),p.createElementVNode("label",Ye,[p.withDirectives(p.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":E[8]||(E[8]=w=>p.isRef(S)?S.value=w:null),onChange:E[9]||(E[9]=(...w)=>p.unref(y)&&p.unref(y)(...w))},null,544),[[p.vModelRadio,p.unref(S)]]),E[13]||(E[13]=p.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):p.createCommentVNode("",!0)]),_:1})],512),[[p.vShow,i.value]]),p.unref(g)?(p.openBlock(),p.createElementBlock("div",$e,[E[14]||(E[14]=p.createElementVNode("div",{class:"loading-spinner"},null,-1)),p.createElementVNode("p",null,p.toDisplayString(p.unref(M)),1)])):p.createCommentVNode("",!0)])}}}),Qe=ne._export_sfc(Je,[["__scopeId","data-v-cdd00cd0"]]);exports.default=Qe;
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Z=require("./useRayCaster-DN56HpNP.cjs"),T=require("./iconfont-t5epssvu.cjs");require("./index.vue_vue_type_style_index_0_scoped_0f027c8c_lang-BSOYWm_U.cjs");const Y=require("./index-BOJUyAaV.cjs");require("./index.vue_vue_type_style_index_1_lang-N-_9ZJEf.cjs");require("./index-BpPyaNFa.cjs");const H=require("./index-8yRiF_z8.cjs");require("./index.vue_vue_type_style_index_1_lang-H_pReDxj.cjs");const s=require("./three-viewport-gizmo-BV37JzRa.cjs");require("./index-B7hLDNQ6.cjs");const ye=require("./animationData-B0K2ghu6.cjs"),ge=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),be=require("./urdfTree-CCktg0FK.cjs"),J=.001,Q=s.MathUtils.degToRad,he=new s.MeshStandardMaterial({color:13421772,metalness:.3,roughness:.6,side:s.DoubleSide});function _e(C=.005,f=64){const _=new s.CatmullRomCurve3([new s.Vector3(0,0,0),new s.Vector3(0,0,0)]),r=new s.TubeGeometry(_,f,C,16,!1),w=he;return new s.Mesh(r,w)}const Ce=C=>C.reduce((f,_)=>{let r=0;const w=_.Y??0,M=_.C??0,v=_.R??0;return w>0&&(r+=w),M>0&&v>0&&(r+=v*Q(M)),f+r},0),Ne=C=>{const f=[],_=C.Y??0,r=C.B??0,w=C.C??0,M=C.R??0,v={pos:new s.Vector3(0,0,0),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};if(!_&&!w)return f;if(f.push(v.pos.clone()),r!==0){const x=new s.Matrix4().makeRotationAxis(v.localY,Q(r));v.localX.applyMatrix4(x),v.localZ.applyMatrix4(x)}if(_>0&&(v.pos.add(v.localY.clone().multiplyScalar(_*J)),f.push(v.pos.clone())),w>0&&M>0){const x=Q(w),k=M*J,d=v.pos.clone().add(v.localX.clone().multiplyScalar(-k)),c=Math.max(16,Math.ceil(w/5));for(let h=1;h<=c;h++){const n=x*h/c,V=new s.Matrix4().makeRotationAxis(v.localZ,n),y=v.localX.clone().multiplyScalar(k).applyMatrix4(V),g=d.clone().add(y);f.push(g)}}return f};function Ee(C,f){const _=new s.Group;_.name="CompletePipe";const r={pos:new s.Vector3(0,0,0),localX:new s.Vector3(1,0,0),localY:new s.Vector3(0,1,0),localZ:new s.Vector3(0,0,1)};let w=0,M=1;for(let v=0;v<C.length;v++){const x=C[v],k=x.Y??0,d=x.B??0,c=x.C??0,h=x.R??0;if(d!==0){const n=new s.Matrix4().makeRotationAxis(r.localY,Q(d));r.localX.applyMatrix4(n),r.localZ.applyMatrix4(n)}if(k>0){const n=r.pos.clone();r.pos.add(r.localY.clone().multiplyScalar(k*J));const V=r.pos.clone(),i=Me(n,V,f*J);i.userData={segmentType:"straight",segmentIndex:w,frameIndex:v,length:k,frame:{Y:k,B:d,C:c,R:h}},i.name=`直段_${w}`,_.add(i);const y=n.clone();xe(_,M,y,f*J),w++}if(c>0&&h>0){const n=Q(c),V=h*J,i=[];i.push(r.pos.clone());const y=r.pos.clone().add(r.localX.clone().multiplyScalar(-V)),g=Math.max(16,Math.ceil(c/5));for(let S=1;S<=g;S++){const L=n*S/g,P=new s.Matrix4().makeRotationAxis(r.localZ,L),U=r.localX.clone().multiplyScalar(V).applyMatrix4(P),K=y.clone().add(U);i.push(K)}const E=Se(i,f*J);E.userData={segmentType:"bend",segmentIndex:w,frameIndex:v,angle:c,radius:h,centerPoint:y.toArray(),frame:{Y:k,B:d,C:c,R:h}},E.name=`弯段_${w}`,_.add(E),Math.floor(i.length/2),i[0],r.pos=i[i.length-1].clone();const m=new s.Matrix4().makeRotationAxis(r.localZ,n);r.localY.applyMatrix4(m),r.localX.applyMatrix4(m),w++,M++}}return _}function xe(C,f,_,r){const w=new s.Vector3(0,r*2,r*5),M=_.clone().add(w),v=[_,M],x=new s.BufferGeometry().setFromPoints(v),k=new s.LineDashedMaterial({color:16711680,dashSize:r*.5,gapSize:r*.3,linewidth:1}),d=new s.Line(x,k);d.computeLineDistances(),C.add(d);const c=document.createElement("canvas"),h=c.getContext("2d");c.width=128,c.height=128,h.clearRect(0,0,128,128),h.fillStyle="#FF0000",h.font="bold 80px Arial",h.textAlign="center",h.textBaseline="middle",h.fillText(f.toString(),64,64);const n=new s.CanvasTexture(c),V=new s.SpriteMaterial({map:n,transparent:!0,depthTest:!1,depthWrite:!1}),i=new s.Sprite(V),y=r*3;i.scale.set(y,y,1),i.position.copy(M),i.name=`Label_${f}`,i.userData={labelNumber:f},C.add(i)}function Me(C,f,_){const r=new s.LineCurve3(C,f),w=new s.TubeGeometry(r,2,_,18,!1);return new s.Mesh(w,he)}function Se(C,f){const _=new s.CatmullRomCurve3(C,!1,"catmullrom",.01),r=new s.TubeGeometry(_,Math.max(16,C.length*2),f,18,!1);return new s.Mesh(r,he)}function de(C,f,_,r,w,M=0){let v=f.slice(0,w+1);const x=f[w+1];if(x&&M>0){const i={...x,B:(x.B??0)*M,C:(x.C??0)*M};v.push(i)}const k=Ce(v),d=Math.max(0,_-k),c=[];c.push(new s.Vector3(0,0,0));const h=new s.Vector3(0,d*J,0);d>0&&c.push(h);let n={pos:h.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const V=[];for(let i=v.length-1;i>=0;i--){const y=v[i],g=Ne(y);if(g.length>0){const E=g.map(P=>{const D=P.clone(),U=new s.Matrix4;return U.makeBasis(n.localX,n.localY,n.localZ),D.applyMatrix4(U),D.add(n.pos)});V.push(E);const m=E[E.length-1];n.pos=m.clone();const S=y.B??0,L=y.C??0;if(S!==0){const P=new s.Matrix4().makeRotationAxis(n.localY,Q(S));n.localX.applyMatrix4(P),n.localZ.applyMatrix4(P)}if(L>0){const P=Q(L),D=new s.Matrix4().makeRotationAxis(n.localZ,P);n.localY.applyMatrix4(D),n.localX.applyMatrix4(D)}}}for(const i of V)i.length>1&&c.push(...i.slice(1));c.length<2&&c.push(new s.Vector3(0,.001,0));try{const i=new s.CatmullRomCurve3(c,!1,"catmullrom",.01),y=new s.TubeGeometry(i,Math.max(2,c.length*4),r*J,18,!1);C.geometry.dispose(),C.geometry=y}catch(i){console.error("管件更新失败",i)}}function we(C,f,_,r=0){let w=C.slice(0,_+1);const M=C[_+1];if(M&&r>0){const n={...M,B:(M.B??0)*r,C:(M.C??0)*r};w.push(n)}const v=Ce(w),x=Math.max(0,f-v),k=[];k.push(new s.Vector3(0,0,0));const d=new s.Vector3(0,x*J,0);x>0&&k.push(d);let c={pos:d.clone(),localY:new s.Vector3(0,1,0),localX:new s.Vector3(1,0,0),localZ:new s.Vector3(0,0,1)};const h=[];for(let n=w.length-1;n>=0;n--){const V=w[n],i=Ne(V);if(i.length>0){const y=i.map(S=>{const L=S.clone(),P=new s.Matrix4;return P.makeBasis(c.localX,c.localY,c.localZ),L.applyMatrix4(P),L.add(c.pos)});h.push(y);const g=y[y.length-1];c.pos=g.clone();const E=V.B??0,m=V.C??0;if(E!==0){const S=new s.Matrix4().makeRotationAxis(c.localY,Q(E));c.localX.applyMatrix4(S),c.localZ.applyMatrix4(S)}if(m>0){const S=Q(m),L=new s.Matrix4().makeRotationAxis(c.localZ,S);c.localY.applyMatrix4(L),c.localX.applyMatrix4(L)}}}for(const n of h)n.length>1&&k.push(...n.slice(1));return k.length<2&&k.push(new s.Vector3(0,.001,0)),k}function re(C,f,_,r,w,M,v,x=0,k=0){const d=w-k,c=we(r,d,v,x);let n=we(_,k,v,x);n.forEach(i=>i.y=-i.y),n.reverse();const V=[...n,...c];try{const i=new s.CatmullRomCurve3(V,!1,"catmullrom",.01),y=new s.TubeGeometry(i,Math.max(2,V.length*4),M*J,18,!1);f.geometry.dispose(),C.geometry.dispose(),f.parent&&f.parent.remove(f),C.geometry=y}catch(i){console.error("管件更新失败",i)}}const ke={class:"panel-content"},Pe={class:"action-bar"},De={key:0,class:"animation-controls"},Re={class:"control-row"},Te={class:"control-row"},$e={class:"frame-info"},Be={class:"control-row"},Ae={class:"progress-bar"},ze={class:"dialog-footer"},Fe=e.defineComponent({__name:"animationPanel",props:{model:{},threeData:{}},emits:["getThreeData"],setup(C,{expose:f,emit:_}){const r=C,w=_,M=e.ref(),v=e.ref(),x=e.ref();e.watch(()=>r.threeData,l=>{const o=l==null?void 0:l.data;x.value=o==null?void 0:o.type},{immediate:!0});const k=async()=>{if(!sessionStorage.getItem("systemKey")){w("getThreeData");return}let o={};x.value===Z.robotMode.SINGLE&&(o=await ye.fetchSingleRobotAnimationData()),x.value===Z.robotMode.DOUBLE&&(o=await ye.fetchDoubleRobotAnimationData());const{initialPipeLength:u=0,pipeRadius:N=0,clampLength:p=0,animationData:a}=o;P.value=u,D.value=N,U.value=p,M.value=a;const t=Y.cloneDeep(M.value);d.value=(t==null?void 0:t["输出(动画数据)"])||[];let F=(t==null?void 0:t["输出(动画数据)Content"])??[];F&&(v.value=F)},d=e.ref([]),c=e.ref(!1),h=e.ref(""),n=e.ref(!1),V=e.ref(0),i=e.ref(0),y=e.ref(1e3),g=e.ref(null);let E=!1;const m=e.shallowRef(null),S=e.shallowRef(null),L=e.shallowRef(null),P=e.ref(1302),D=e.ref(12.5),U=e.ref(30),K=e.ref([]),z=e.ref(null),b=e.computed(()=>r.model?Object.values(r.model.joints).filter(l=>l.jointType!=="fixed").map(l=>l.name):[]),O=e.ref(["Y","B","C","R"]),j=e.computed(()=>[...b.value,...O.value]),X=e.computed(()=>j.value.length>0?`请按以下格式粘贴数据 (第一行为表头,使用 Tab 分隔):
2
+ ${j.value.join(" ")}
3
+ 0 0 0 ...
4
+ 1 2 3 ...`:"请先加载模型。"),q=(l,o)=>{if(!o)return null;const u=l.joints[o];if(!u)return console.warn(`在模型中未找到名为 '${o}' 的 Joint`),null;let N=null;return u.traverse(p=>{p instanceof s.Mesh&&!N&&(N=p)}),N||console.warn(`在 Joint '${o}' 中未找到可用的 Mesh 对象`),N},ee=(l,o)=>{if(!o)return null;const u=l.joints[o];return u||(console.warn(`在模型中未找到名为 '${o}' 的 Joint`),console.log("可用的链接:",Object.keys(l.links)),null)},W=()=>{L.value&&(L.value.visible=!0),m.value&&m.value.parent&&m.value.parent.remove(m.value),L.value=null,m.value=null,S.value=null};e.watch(j,(l,o)=>{if(JSON.stringify(l)!==JSON.stringify(o))if(l.length>0){const u=l.reduce((N,p)=>(N[p]="0",N),{});d.value=[u]}else d.value=[]},{immediate:!0});const G=e.ref(0),I=l=>{G.value=l},te=(l,o)=>{const u=ee(l,o),N=_e();N.visible=!1,u==null||u.add(N),I(G.value+1)};e.watch(()=>r.model,l=>{W(),l?(g.value=new Z.URDFRobotController(l),K.value=Object.keys(l.links),z.value="Pipe_Joint",te(l,z.value),ce()):(g.value=null,K.value=[],z.value=null)},{immediate:!0}),e.watch([z,U,G],([l,o])=>{if(W(),r.model&&l){const u=q(r.model,l);if(console.log(u,"meshToReplace"),u&&u.parent){L.value=u;const N=new s.Mesh(u.geometry.clone(),u.material);if(N.name="managed_pipe_clone",u.parent.add(N),N.position.copy(u.position),N.rotation.copy(u.rotation),N.scale.copy(u.scale),u.visible=!1,x.value===Z.robotMode.SINGLE&&(N.position.y-=o*.001),m.value=N,x.value===Z.robotMode.DOUBLE){const p=new s.Mesh(u.geometry.clone(),u.material);p.name="managed_oppsite_pipe_clone",p.position.copy(u.position),p.rotation.copy(u.rotation),p.scale.copy(u.scale),u.parent.add(p),S.value=p}m.value&&S.value&&re(m.value,S.value,[],[],P.value,D.value,0,0,U.value)}else l&&console.warn(`在 link '${l}' 中未找到可替换的网格或其没有父级。`)}});const $=()=>d.value.map(l=>({Y:parseFloat(l.Y)||0,B:parseFloat(l.B)||0,C:parseFloat(l.C)||0,R:parseFloat(l.R)||0})),le=()=>{const l=[],o=[];return d.value.forEach(u=>{const{Y1:N,B1:p,C1:a,R1:t,Y2:F,B2:B,C2:A,R2:R}=u;l.push({Y:parseFloat(N)||0,B:parseFloat(p)||0,C:parseFloat(a)||0,R:parseFloat(t)||0}),o.push({Y:parseFloat(F)||0,B:parseFloat(B)||0,C:parseFloat(A)||0,R:parseFloat(R)||0})}),{posPipeYbcr:l,negPipeYbcr:o}},se=l=>{if(l<0||l>=d.value.length){console.error(`帧索引 ${l} 超出范围`);return}const o=d.value[l];if(console.log(`应用第 ${l} 帧数据 ${o}`),V.value=l,g.value){const u={};b.value.forEach(N=>{const p=parseFloat(o[N]);isNaN(p)||(u[N]=p)}),g.value.setJointAngles(u)}if(m.value&&S.value){const u=le();console.log("ybcr数据:",u),re(m.value,S.value,u.posPipeYbcr,u.negPipeYbcr,P.value,D.value,l,0,U.value);return}if(m.value){const u=$();console.log("ybcr数据:",u),de(m.value,u,P.value,D.value,l,0);return}},ie=async()=>{if(d.value.length===0){Y.ElMessage.error("无法播放动画:无数据");return}n.value=!0,E=!1;const l=m.value?$():[];try{for(let o=V.value+1;o<d.value.length&&!E;o++){V.value=o;const u=d.value[o],N={};g.value&&b.value.forEach(p=>{const a=parseFloat(u[p]);isNaN(a)||(N[p]=a)}),g.value?await g.value.animateToState(N,y.value,p=>{if(i.value=(o+p)/d.value.length*100,m.value&&S.value){const a=le();console.log("ybcr数据:",l),re(m.value,S.value,a.posPipeYbcr,a.negPipeYbcr,P.value,D.value,o-1,p,U.value)}else m.value&&de(m.value,l,P.value,D.value,o-1,p)}):m.value&&S.value?await new Promise(p=>{const a=performance.now();let t;const F=B=>{if(E){cancelAnimationFrame(t),p();return}const A=B-a,R=Math.min(A/y.value,1);i.value=(o+R)/d.value.length*100;const Ve=le();re(m.value,S.value,Ve.posPipeYbcr,Ve.negPipeYbcr,P.value,D.value,o-1,R,U.value),R<1?t=requestAnimationFrame(F):p()};t=requestAnimationFrame(F)}):m.value?await new Promise(p=>{const a=performance.now();let t;const F=B=>{if(E){cancelAnimationFrame(t),p();return}const A=B-a,R=Math.min(A/y.value,1);i.value=(o+R)/d.value.length*100,de(m.value,l,P.value,D.value,o-1,R),R<1?t=requestAnimationFrame(F):p()};t=requestAnimationFrame(F)}):(await new Promise(p=>setTimeout(p,y.value)),i.value=(o+1)/d.value.length*100)}E||Y.ElMessage.success("动画播放完成")}catch(o){console.error("动画播放出错:",o),Y.ElMessage.error("动画播放出错")}finally{n.value=!1,i.value=0}},oe=()=>{E=!0,n.value=!1,i.value=0,Y.ElMessage.info("动画已停止")},ce=()=>{if(g.value&&g.value.resetToZero(),console.log("pipeMesh.value",m.value),m.value&&S.value){const l=le();re(m.value,S.value,l.posPipeYbcr,l.negPipeYbcr,P.value,D.value,-1,0,U.value)}else if(m.value){const l=$();de(m.value,l,P.value,D.value,-1,0)}V.value=0,Y.ElMessage.success("机器人和管件已重置")},pe=()=>{console.log("当前管件Mesh:",m.value)},me=l=>{n.value&&oe(),se(l)},ve=()=>{n.value&&oe(),!(V.value+1>=d.value.length)&&se(V.value+1)},fe=()=>{n.value&&oe(),V.value!==0&&se(V.value-1)},ue=async()=>{if(j.value.length===0){Y.ElMessage.warning("没有可导出的表头");return}const l=j.value.join(" ");try{await navigator.clipboard.writeText(l),Y.ElMessage.success("表头已成功复制到剪贴板!")}catch(o){console.error("复制失败:",o),Y.ElMessage.error("复制失败,请检查浏览器权限或手动复制。")}},ne=()=>{if(!h.value.trim()){Y.ElMessage.warning("导入内容不能为空");return}const l=h.value.trim().split(`
5
+ `).filter(a=>a.trim()!=="");if(l.length<2){Y.ElMessage.error("导入数据至少需要包含表头行和一行数据");return}const o=l[0].split(" ").map(a=>a.trim()),u={};if(o.forEach((a,t)=>{j.value.includes(a)&&(u[t]=a)}),Object.keys(u).length===0){Y.ElMessage.error("没有找到匹配的表头,请检查表头名称是否正确");return}const p=l.slice(1).map(a=>{const t=a.split(" "),F={};return j.value.forEach(B=>{F[B]="0"}),Object.entries(u).forEach(([B,A])=>{const R=t[parseInt(B)];R!==void 0&&R.trim()!==""&&(F[A]=R.trim())}),F});p.length>0?(d.value=p,Y.ElMessage.success(`成功导入 ${p.length} 行数据!`),c.value=!1,h.value=""):Y.ElMessage.error("未能解析到有效数据,请检查格式。")},ae=l=>`第 ${l+1} 帧`;return e.onUnmounted(()=>{W(),E=!0}),f({playAnimation:ie,stopAnimation:oe,forwardFrame:ve,backwardFrame:fe}),(l,o)=>{const u=e.resolveComponent("el-icon"),N=e.resolveComponent("el-input-number"),p=e.resolveComponent("el-form-item"),a=e.resolveComponent("el-form"),t=e.resolveComponent("el-slider"),F=e.resolveComponent("el-progress"),B=e.resolveComponent("el-input"),A=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",ke,[e.createElementVNode("div",Pe,[e.createVNode(H._sfc_main,{onClick:k,modelValue:"获取数据"}),e.createVNode(H._sfc_main,{onClick:ue,disabled:j.value.length===0,modelValue:"导出表头"},null,8,["disabled"]),e.createVNode(H._sfc_main,{modelValue:"播放",onClick:ie,disabled:d.value.length===0||n.value,buttonType:"primary"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createBlock(u,{key:0,class:"is-loading"},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.loading_default))]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["disabled"]),e.createVNode(H._sfc_main,{onClick:oe,modelValue:"停止",buttonType:"danger"}),e.createVNode(H._sfc_main,{onClick:ce,modelValue:"重置",buttonType:"primary"}),e.createVNode(H._sfc_main,{onClick:pe,modelValue:"测试功能",buttonType:"primary"})]),d.value.length>0?(e.openBlock(),e.createElementBlock("div",De,[e.createElementVNode("div",Re,[e.createVNode(a,{"label-width":"auto",style:{width:"100%"}},{default:e.withCtx(()=>[e.createVNode(p,{label:"帧间隔 (ms):",prop:"frameDuration"},{default:e.withCtx(()=>[e.createVNode(N,{modelValue:y.value,"onUpdate:modelValue":o[0]||(o[0]=R=>y.value=R),min:100,max:5e3,step:100,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),e.createVNode(p,{label:"管件总长 (mm):",prop:"initialPipeLength"},{default:e.withCtx(()=>[e.createVNode(N,{modelValue:P.value,"onUpdate:modelValue":o[1]||(o[1]=R=>P.value=R),min:0,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),e.createVNode(p,{label:"管件半径 (mm):",prop:"pipeRadius"},{default:e.withCtx(()=>[e.createVNode(N,{modelValue:D.value,"onUpdate:modelValue":o[2]||(o[2]=R=>D.value=R),min:0,style:{width:"100%"}},null,8,["modelValue"])]),_:1}),e.createVNode(p,{label:"夹持长度 (mm):",prop:"clampLength"},{default:e.withCtx(()=>[e.createVNode(N,{modelValue:U.value,"onUpdate:modelValue":o[3]||(o[3]=R=>U.value=R),min:0,style:{width:"100%"}},null,8,["modelValue"])]),_:1})]),_:1})]),o[10]||(o[10]=e.createElementVNode("div",{class:"control-row"},[e.createElementVNode("label",null,"管件 Mesh:")],-1)),e.createElementVNode("div",Te,[o[8]||(o[8]=e.createElementVNode("label",null,"当前帧:",-1)),e.createElementVNode("span",$e,e.toDisplayString(V.value+1)+" / "+e.toDisplayString(d.value.length),1)]),e.createElementVNode("div",Be,[o[9]||(o[9]=e.createElementVNode("label",null,"动画进度:",-1)),e.createVNode(t,{modelValue:V.value,"onUpdate:modelValue":o[4]||(o[4]=R=>V.value=R),min:0,max:d.value.length>0?d.value.length-1:0,step:1,"format-tooltip":ae,onInput:me,disabled:d.value.length===0,style:{"flex-grow":"1",margin:"0 10px"}},null,8,["modelValue","max","disabled"])]),e.createElementVNode("div",Ae,[e.createVNode(F,{percentage:i.value,"show-text":!1,"stroke-width":6},null,8,["percentage"])])])):e.createCommentVNode("",!0),e.createVNode(A,{modelValue:c.value,"onUpdate:modelValue":o[7]||(o[7]=R=>c.value=R),title:"导入数据",width:"500px"},{footer:e.withCtx(()=>[e.createElementVNode("span",ze,[e.createVNode(H._sfc_main,{modelValue:"取消",onClick:o[6]||(o[6]=R=>c.value=!1)}),e.createVNode(H._sfc_main,{modelValue:"确认导入",onClick:ne,type:"primary"})])]),default:e.withCtx(()=>[o[11]||(o[11]=e.createElementVNode("p",{class:"import-instructions"}," 请从Excel或csv中复制数据 (首行为表头, Tab分隔) ",-1)),e.createVNode(B,{modelValue:h.value,"onUpdate:modelValue":o[5]||(o[5]=R=>h.value=R),type:"textarea",rows:10,placeholder:X.value},null,8,["modelValue","placeholder"])]),_:1,__:[11]},8,["modelValue"])])}}}),Ye=ge._export_sfc(Fe,[["__scopeId","data-v-5c10c71a"]]),Ie="http://139.196.154.85:20018";function Le(C,f=!1){return console.log(C,"data"),Y.service({url:`${Ie}/api/pipeBendingTraditional/pipeAnsys/${f}`,method:"post",data:C})}const je={class:"pipe-analysis-dialog-header"},Ue={class:"header-right"},Oe={class:"pipe-analysis-dialog-body"},Xe={class:"panel-left"},Ge={class:"pipe-analysis-input"},qe={class:"input-params"},Ze={class:"step-label"},Je={class:"button-group"},He={class:"upload-content"},Ke={class:"file-item"},We={key:0},Qe={class:"pipe-analysis-output"},et={class:"ouput-params"},tt=e.defineComponent({__name:"pipeAnalysisPanel",emits:["nodeClick","visibleChange","updatePosition","updateRotation"],setup(C,{expose:f,emit:_}){const r=e.ref(null),w=e.shallowRef(null),{initThreeJS:M,handleResize:v,cleanup:x,clearAllModels:k,addModelAndFit:d}=T.useThreeJS(r),c=e.ref(null),h=e.ref({file:null}),n=e.ref(null),V=e.ref(!1),i=()=>{var z;(z=c.value)==null||z.click()},y=async z=>{var j;const O=(j=z.target.files)==null?void 0:j[0];O&&(n.value=O)};e.ref("ybcr");const g=e.ref({form:{},list:[],reverse:!1}),E=async()=>{var z;if(!n.value){Y.ElMessage.warning("请先选择文件");return}try{V.value=!0;const b=new FormData;b.set("file",n.value);let O=!1;((z=g.value)==null?void 0:z.reverse)==!0&&(O=!0);const{data:{data:j}={}}=await Le(b,O);m(j),Y.ElMessage.success("提交成功")}catch(b){Y.ElMessage.error("提交失败,请重试"),console.error("提交错误:",b)}finally{V.value=!1}},m=z=>{const{length:b,outerDiameter:O,innerDiameter:j,thickness:X,ybcrList:q}=z||{};g.value.form={length:b,outerDiameter:O,innerDiameter:j,thickness:X},g.value.list=q},S=()=>{const{form:z,list:b}=g.value,{outerDiameter:O}=z,j=O/2,X=b==null?void 0:b.map(ee=>{const{y:W,b:G,c:I,r:te}=ee;return{Y:W,B:G,C:I,R:te}});k();const q=Ee(X,j);d(q)},L=e.ref(!1),P=()=>{const z=L.value;L.value=!z},D=e.ref(!1),U=()=>{D.value=!1},K=()=>{D.value=!0};return e.watch(()=>g,()=>{S()},{deep:!0}),e.watch(()=>r,()=>{try{if(w.value)return;M(),window.addEventListener("resize",v)}catch(z){console.error("Three.js 初始化失败:",z),Y.ElMessage.error("渲染引擎初始化失败!")}},{deep:!0}),e.onBeforeUnmount(()=>{window.removeEventListener("resize",v),x()}),f({openDialog:K}),(z,b)=>{const O=e.resolveComponent("el-icon"),j=e.resolveComponent("el-button"),X=e.resolveComponent("el-form-item"),q=e.resolveComponent("el-form"),ee=e.resolveComponent("el-option"),W=e.resolveComponent("el-select"),G=e.resolveComponent("el-input"),I=e.resolveComponent("el-table-column"),te=e.resolveComponent("el-table");return e.openBlock(),e.createBlock(H.ssDialog,{class:"pipe-analysis-dialog",visible:D.value,onBeforeDestroy:z.onDestroy,showClose:!1,fullScreen:L.value},{header:e.withCtx(()=>[e.createElementVNode("div",je,[b[5]||(b[5]=e.createElementVNode("div",{class:"header-left",title:"管件解析"}," 管件解析 ",-1)),e.createElementVNode("div",Ue,[e.createVNode(O,null,{default:e.withCtx(()=>[e.createVNode(e.unref(Y.full_screen_default),{onClick:P})]),_:1}),e.createVNode(O,null,{default:e.withCtx(()=>[e.createVNode(e.unref(Y.close_default),{onClick:U})]),_:1})])])]),default:e.withCtx(()=>[e.createElementVNode("div",Oe,[e.createElementVNode("div",Xe,[e.createElementVNode("div",Ge,[b[8]||(b[8]=e.createElementVNode("span",{class:"item-view-group"},[e.createElementVNode("span",{class:"group-name-wrap"},"输入")],-1)),e.createElementVNode("div",qe,[e.createVNode(q,{model:h.value,"label-width":"auto","label-position":"top"},{default:e.withCtx(()=>[e.createVNode(X,{label:"step文件"},{label:e.withCtx(()=>[e.createElementVNode("div",Ze,[b[7]||(b[7]=e.createElementVNode("div",null," step文件 ",-1)),e.createElementVNode("div",Je,[e.createVNode(H._sfc_main,{emptyColor:!0,onClickTrigger:i,modelValue:"上传"}),e.createElementVNode("input",{type:"file",ref_key:"fileInput",ref:c,accept:".step,.csv",onChange:y,style:{display:"none"}},null,544),e.createVNode(j,{type:"primary",onClick:E,loading:V.value,disabled:!n.value},{default:e.withCtx(()=>b[6]||(b[6]=[e.createTextVNode(" 解析 ")])),_:1,__:[6]},8,["loading","disabled"])])])]),default:e.withCtx(()=>{var $;return[e.createElementVNode("div",He,[e.createElementVNode("div",Ke,[n.value?(e.openBlock(),e.createElementBlock("div",We,e.toDisplayString(($=n.value)==null?void 0:$.name),1)):e.createCommentVNode("",!0)])])]}),_:1})]),_:1},8,["model"])])]),e.createElementVNode("div",Qe,[e.createVNode(X,{label:"加工方向"},{default:e.withCtx(()=>[e.createVNode(W,{modelValue:g.value.reverse,"onUpdate:modelValue":b[0]||(b[0]=$=>g.value.reverse=$),placeholder:"请选择加工方向"},{default:e.withCtx(()=>[e.createVNode(ee,{label:"正向",value:!1}),e.createVNode(ee,{label:"反向",value:!0})]),_:1},8,["modelValue"])]),_:1}),b[9]||(b[9]=e.createElementVNode("span",{class:"item-view-group"},[e.createElementVNode("span",{class:"group-name-wrap"},"输出(弯管基础参数)")],-1)),e.createElementVNode("div",et,[e.createVNode(q,{model:g.value.form,"label-width":"auto","label-position":"top",inline:!0},{default:e.withCtx(()=>[e.createVNode(X,{label:"管长"},{default:e.withCtx(()=>[e.createVNode(G,{modelValue:g.value.form.length,"onUpdate:modelValue":b[1]||(b[1]=$=>g.value.form.length=$)},null,8,["modelValue"])]),_:1}),e.createVNode(X,{label:"外径"},{default:e.withCtx(()=>[e.createVNode(G,{modelValue:g.value.form.outerDiameter,"onUpdate:modelValue":b[2]||(b[2]=$=>g.value.form.outerDiameter=$)},null,8,["modelValue"])]),_:1}),e.createVNode(X,{label:"内径"},{default:e.withCtx(()=>[e.createVNode(G,{modelValue:g.value.form.innerDiameter,"onUpdate:modelValue":b[3]||(b[3]=$=>g.value.form.innerDiameter=$)},null,8,["modelValue"])]),_:1}),e.createVNode(X,{label:"壁厚"},{default:e.withCtx(()=>[e.createVNode(G,{modelValue:g.value.form.thickness,"onUpdate:modelValue":b[4]||(b[4]=$=>g.value.form.thickness=$)},null,8,["modelValue"])]),_:1})]),_:1},8,["model"]),e.createVNode(te,{ref:"singleTableRef",data:g.value.list,"highlight-current-rowstyle":"width: 100%"},{default:e.withCtx(()=>[e.createVNode(I,{type:"index",width:"50"}),e.createVNode(I,{property:"y",label:"Y"}),e.createVNode(I,{property:"b",label:"B"}),e.createVNode(I,{property:"c",label:"C"}),e.createVNode(I,{property:"r",label:"R"})]),_:1},8,["data"])])])]),e.createElementVNode("div",{class:"panel-right",ref_key:"threejsContainer",ref:r},null,512)])]),_:1},8,["visible","onBeforeDestroy","fullScreen"])}}}),ot=ge._export_sfc(tt,[["__scopeId","data-v-577e5f83"]]),lt={class:"obj-viewer-container"},nt={class:"pipe-comparison"},at={ref:"pipe1",class:"pipe-container"},st={ref:"pipe2",class:"pipe-container"},rt={class:"buttonGroup-top"},it={class:"buttonGroup-topLeft"},ct={class:"buttonGroup-left"},ut={class:"buttonGroup-right"},dt={class:"buttonGroup-bottom"},pt={class:"top-panel"},mt={class:"panel-header"},vt={class:"panel-body"},ft={class:"left-panel"},gt={class:"panel-header"},ht={class:"panel-body"},Vt={key:1,class:"clipping-content"},yt={class:"radio-group"},bt={class:"radio-label"},wt={class:"radio-label"},Ct={class:"radio-label"},Nt={class:"radio-label"},_t={class:"right-panel"},Et={class:"panel-header"},xt={class:"panel-body"},Mt={key:0,class:"loading-overlay"},St=e.defineComponent({__name:"threeSceneView",props:{fileBlobs:{default:()=>[]},animationData:{default:()=>({})},threeData:{}},emits:["getAnimationData","getThreeData"],setup(C,{emit:f}){const _=f,r=C,w=e.ref(Z.sceneType.ROBOT),M=e.ref(null),v=e.ref(),x=e.ref(!1),k=e.ref(""),d=e.ref(!1),c=e.ref(""),h=e.ref(!1),n=e.ref(""),V=e.ref(!1),i=e.ref(""),y=e.shallowRef(null),g=e.shallowRef(null),E=e.ref(),{currentModels:m,resetView:S,initThreeJS:L,handleResize:P,getThreeJSObjects:D,cleanup:U,setModels:K,axesHelperVisible:z,toggleAxesVisibility:b,zoomIn:O,zoomOut:j}=T.useThreeJS(M),{loadSceneFromFile:X}=Z.useUrdfLoader(D,m,x,k),{isAnimating:q,toggleAnimation:ee,stopAnimation:W}=T.useAnimation(D,m),{isClipping:G,activeClippingAxis:I,toggleClipping:te,updateClippingPlanes:$}=T.useClipping(D,m),{initRaycaster:le,selectedObject3D:se,setSelectedObjVisible:ie,updatePosition:oe,updateRotation:ce,dispose:pe}=Z.useRaycaster(M,D,m),me=()=>{b()},ve=e.computed(()=>w.value===Z.sceneType.ROBOT),fe=e.computed(()=>w.value===Z.sceneType.PIPECOMPARSION),ue=a=>{var t;i.value=a,i.value==="弯管解析"?(t=v.value)==null||t.openDialog():V.value=!0},ne=a=>{d.value=!0,c.value=a,a==="剖面视图"&&!G.value&&te()},ae=a=>{h.value=!0,n.value=a,a==="动画仿真"&&_("getAnimationData")},l=()=>{_("getThreeData")},o=()=>{var a;(a=E==null?void 0:E.value)==null||a.playAnimation()},u=()=>{var a;(a=E==null?void 0:E.value)==null||a.stopAnimation()},N=()=>{var a;(a=E==null?void 0:E.value)==null||a.forwardFrame()},p=()=>{var a;(a=E==null?void 0:E.value)==null||a.backwardFrame()};return e.watch(()=>r.fileBlobs,a=>{if(a&&a.length>0){const t=a[0];if(!t.name.toLowerCase().endsWith(".urdf"))return;X(t).then(F=>{y.value=F}).catch(F=>{console.error("加载URDF文件时发生错误:",F),Y.ElMessage.error("加载urdf模型失败"),y.value=null})}else y.value=null},{immediate:!0,deep:!0}),e.watch(y,a=>{K(a?[a]:[]),le()}),e.onMounted(async()=>{await e.nextTick();try{L(),window.addEventListener("resize",P);const a=D();g.value=a.scene}catch(a){console.error("Three.js 初始化失败:",a),Y.ElMessage.error("渲染引擎初始化失败!")}}),e.onBeforeUnmount(()=>{c.value="",n.value="",window.removeEventListener("resize",P),q.value&&W(),U(),pe()}),(a,t)=>{const F=e.resolveComponent("el-scrollbar");return e.openBlock(),e.createElementBlock("div",lt,[e.withDirectives(e.createElementVNode("div",{ref_key:"threejsContainer",ref:M,class:"threejs-container"},null,512),[[e.vShow,ve.value]]),e.withDirectives(e.createElementVNode("div",nt,[e.createElementVNode("div",at,null,512),e.createElementVNode("div",st,null,512)],512),[[e.vShow,fe.value]]),e.createElementVNode("div",rt,[e.renderSlot(a.$slots,"button-top",{switchTopPanel:ue},void 0,!0),e.createVNode(T.SvgIcon,{name:"guanjianjiexi",size:"34",onClick:t[0]||(t[0]=B=>ue("弯管解析"))}),e.createVNode(T.SvgIcon,{name:"guanjiekongzhi",size:"34"}),e.createVNode(T.SvgIcon,{name:"gongyishengcheng",size:"34"}),e.createVNode(T.SvgIcon,{name:"buchangshezhi",size:"34"}),e.createVNode(T.SvgIcon,{name:"shuchujiagongchengxu",size:"34"}),e.renderSlot(a.$slots,"logout",{},void 0,!0)]),e.createElementVNode("div",it,[e.createVNode(T.SvgIcon,{name:"viewReset",size:"24",onClick:e.unref(S),title:"重置"},null,8,["onClick"]),e.createVNode(T.SvgIcon,{name:"fangda",size:"24",title:"放大",onClick:e.unref(O)},null,8,["onClick"]),e.createVNode(T.SvgIcon,{name:"suoxiao",size:"24",title:"缩小",onClick:e.unref(j)},null,8,["onClick"]),e.createVNode(T.SvgIcon,{name:"lookAround",size:"24",onClick:e.unref(ee),title:e.unref(q)?"停止动画":"动画视图"},null,8,["onClick","title"]),e.createVNode(T.SvgIcon,{name:"zuobiaoxi",size:"24",active:e.unref(z),onClick:me,title:"显隐坐标轴"},null,8,["active"])]),e.createElementVNode("div",ct,[e.createVNode(T.SvgIcon,{name:"jiegoushu",size:"24",onClick:t[1]||(t[1]=B=>ne("场景树")),active:d.value&&c.value==="场景树",title:"场景树"},null,8,["active"]),e.createVNode(T.SvgIcon,{name:"clipping",size:"24",onClick:t[2]||(t[2]=B=>ne("剖面视图")),active:d.value&&c.value==="剖面视图",title:"剖面视图"},null,8,["active"]),e.createVNode(T.SvgIcon,{name:"zhaozi",size:"24",onClick:t[3]||(t[3]=B=>ne("工件树")),active:d.value&&c.value==="工件树",title:"工件 "},null,8,["active"]),e.createVNode(T.SvgIcon,{name:"donghuafangzhen",size:"24",onClick:t[4]||(t[4]=B=>ne("场景4"))})]),e.createElementVNode("div",ut,[e.renderSlot(a.$slots,"button-right",{switchRightPanel:ae},void 0,!0),e.createVNode(T.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(T.SvgIcon,{name:"donghuafangzhen",size:"24"}),e.createVNode(T.SvgIcon,{name:"guanjiekongzhi",size:"24",onClick:t[5]||(t[5]=B=>ae("关节控制")),active:h.value&&n.value==="关节控制",title:"关节控制"},null,8,["active"]),e.createVNode(T.SvgIcon,{name:"donghuafangzhen",size:"24",title:"动画仿真",onClick:t[6]||(t[6]=B=>ae("动画仿真")),active:h.value&&n.value==="动画仿真"},null,8,["active"]),e.createVNode(T.SvgIcon,{name:"donghuafangzhen",size:"24",title:"urdf动画",onClick:t[7]||(t[7]=B=>ae("urdf动画")),active:h.value&&n.value==="urdf动画"},null,8,["active"]),e.createVNode(T.SvgIcon,{name:"donghuafangzhen",size:"24"})]),e.createElementVNode("div",dt,[e.createVNode(T.SvgIcon,{name:"kuaitui",size:"24",backgroundColor:"#ffffff",title:"快退",onClick:p}),e.createVNode(T.SvgIcon,{name:"bofang",size:"24",backgroundColor:"#ffffff",title:"播放",onClick:o}),e.createVNode(T.SvgIcon,{name:"kuaijin",size:"24",backgroundColor:"#ffffff",title:"快进",onClick:N}),e.createVNode(T.SvgIcon,{name:"zanting",size:"24",backgroundColor:"#ffffff",title:"暂停",onClick:u})]),e.withDirectives(e.createElementVNode("div",pt,[e.createElementVNode("div",mt,[e.createElementVNode("span",null,e.toDisplayString(i.value),1),e.createElementVNode("span",{class:"close",onClick:t[8]||(t[8]=B=>V.value=!1)}," X ")]),e.createElementVNode("div",vt,[e.createVNode(F,{height:"100%"},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"top-panel",{topPanelType:i.value},void 0,!0)]),_:3})])],512),[[e.vShow,V.value]]),e.withDirectives(e.createElementVNode("div",ft,[e.createElementVNode("div",gt,[e.createElementVNode("span",null,e.toDisplayString(c.value),1),e.createElementVNode("span",{class:"close",onClick:t[9]||(t[9]=B=>d.value=!1)}," X ")]),e.createElementVNode("div",ht,[e.createVNode(F,{height:"100%"},{default:e.withCtx(()=>{var B;return[c.value==="场景树"?(e.openBlock(),e.createBlock(be.UrdfTree,{key:0,model:y.value},null,8,["model"])):e.createCommentVNode("",!0),c.value==="剖面视图"?(e.openBlock(),e.createElementBlock("div",Vt,[e.createElementVNode("div",yt,[e.createElementVNode("label",bt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"none","onUpdate:modelValue":t[10]||(t[10]=A=>e.isRef(I)?I.value=A:null),onChange:t[11]||(t[11]=(...A)=>e.unref($)&&e.unref($)(...A))},null,544),[[e.vModelRadio,e.unref(I)]]),t[19]||(t[19]=e.createElementVNode("span",{class:"radio-text"},"无切割",-1))]),e.createElementVNode("label",wt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"x","onUpdate:modelValue":t[12]||(t[12]=A=>e.isRef(I)?I.value=A:null),onChange:t[13]||(t[13]=(...A)=>e.unref($)&&e.unref($)(...A))},null,544),[[e.vModelRadio,e.unref(I)]]),t[20]||(t[20]=e.createElementVNode("span",{class:"radio-text"},"X轴切割",-1))]),e.createElementVNode("label",Ct,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"y","onUpdate:modelValue":t[14]||(t[14]=A=>e.isRef(I)?I.value=A:null),onChange:t[15]||(t[15]=(...A)=>e.unref($)&&e.unref($)(...A))},null,544),[[e.vModelRadio,e.unref(I)]]),t[21]||(t[21]=e.createElementVNode("span",{class:"radio-text"},"Y轴切割",-1))]),e.createElementVNode("label",Nt,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:"clipping-axis",value:"z","onUpdate:modelValue":t[16]||(t[16]=A=>e.isRef(I)?I.value=A:null),onChange:t[17]||(t[17]=(...A)=>e.unref($)&&e.unref($)(...A))},null,544),[[e.vModelRadio,e.unref(I)]]),t[22]||(t[22]=e.createElementVNode("span",{class:"radio-text"},"Z轴切割",-1))])])])):e.createCommentVNode("",!0),c.value==="工件树"?(e.openBlock(),e.createBlock(Z.WorkpieceTreePanel,{key:2,model:(B=e.unref(se))==null?void 0:B.obj,onVisibleChange:e.unref(ie),onUpdatePosition:e.unref(oe),onUpdateRotation:e.unref(ce)},null,8,["model","onVisibleChange","onUpdatePosition","onUpdateRotation"])):e.createCommentVNode("",!0)]}),_:1})])],512),[[e.vShow,d.value]]),e.withDirectives(e.createElementVNode("div",_t,[e.createElementVNode("div",Et,[e.createElementVNode("span",null,e.toDisplayString(n.value),1),e.createElementVNode("span",{class:"close",onClick:t[18]||(t[18]=B=>h.value=!1)}," X ")]),e.createElementVNode("div",xt,[e.createVNode(F,{height:"100%"},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(be.JointPanel,{model:y.value},null,8,["model"]),[[e.vShow,n.value==="关节控制"]]),e.withDirectives(e.createVNode(Ye,{ref_key:"animationPanelRef",ref:E,model:y.value,onGetThreeData:l,threeData:r.threeData},null,8,["model","threeData"]),[[e.vShow,n.value==="动画仿真"]]),e.renderSlot(a.$slots,"right-panel",{rightPanelType:n.value},void 0,!0)]),_:3})])],512),[[e.vShow,h.value]]),x.value?(e.openBlock(),e.createElementBlock("div",Mt,[t[23]||(t[23]=e.createElementVNode("div",{class:"loading-spinner"},null,-1)),e.createElementVNode("p",null,e.toDisplayString(k.value),1)])):e.createCommentVNode("",!0),e.createVNode(ot,{ref_key:"pipeAnalysisPanelRef",ref:v},null,512)])}}}),kt=ge._export_sfc(St,[["__scopeId","data-v-3bada747"]]);exports.default=kt;