var vt=Object.defineProperty,Lt=Object.defineProperties;var It=Object.getOwnPropertyDescriptors;var He=Object.getOwnPropertySymbols;var Nt=Object.prototype.hasOwnProperty,Ot=Object.prototype.propertyIsEnumerable;var De=(f,t,e)=>t in f?vt(f,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):f[t]=e,J=(f,t)=>{for(var e in t||(t={}))Nt.call(t,e)&&De(f,e,t[e]);if(He)for(var e of He(t))Ot.call(t,e)&&De(f,e,t[e]);return f},ue=(f,t)=>Lt(f,It(t));var ee=(f,t,e)=>new Promise((s,n)=>{var r=o=>{try{a(e.next(o))}catch(c){n(c)}},i=o=>{try{a(e.throw(o))}catch(c){n(c)}},a=o=>o.done?s(o.value):Promise.resolve(o.value).then(r,i);a((e=e.apply(f,t)).next())});import{f as K,o as Ct,j as Pt,ar as te,as as ne,au as L,ag as Be,aB as Ge,av as G,at as Ft,G as q}from"./vue-vendor-C7Zq48Yl.js";import{BufferAttribute as ge,BufferGeometry as kt,InstancedBufferAttribute as Ht,InterleavedBuffer as Dt,InterleavedBufferAttribute as Bt,TrianglesDrawMode as Gt,TriangleFanDrawMode as Me,TriangleStripDrawMode as tt,Vector3 as U,Float32BufferAttribute as ws,Quaternion as nt,Matrix4 as he,AnimationMixer as Es,VectorKeyframeTrack as Ue,QuaternionKeyframeTrack as ze,AnimationClip as Ut,SkeletonHelper as ys,Loader as zt,LoaderUtils as ie,FileLoader as st,Color as X,LinearSRGBColorSpace as z,SpotLight as Kt,PointLight as jt,DirectionalLight as rt,MeshBasicMaterial as re,SRGBColorSpace as ae,MeshPhysicalMaterial as B,Vector2 as ve,InstancedMesh as Vt,Object3D as it,Interpolant as Xt,LinearMipmapLinearFilter as ot,NearestMipmapLinearFilter as Wt,LinearMipmapNearestFilter as qt,NearestMipmapNearestFilter as Yt,LinearFilter as be,NearestFilter as at,RepeatWrapping as Re,MirroredRepeatWrapping as Zt,ClampToEdgeWrapping as Qt,InterpolateDiscrete as $t,InterpolateLinear as ct,MeshStandardMaterial as oe,FrontSide as Jt,TextureLoader as en,ImageBitmapLoader as tn,Texture as Ke,PointsMaterial as nn,Material as Te,LineBasicMaterial as sn,DoubleSide as rn,PropertyBinding as on,SkinnedMesh as an,Mesh as de,LineSegments as cn,Line as ln,LineLoop as un,Points as fn,Group as xe,PerspectiveCamera as lt,MathUtils as dn,OrthographicCamera as hn,Skeleton as pn,Bone as mn,NumberKeyframeTrack as je,Box3 as gn,Sphere as Tn,ColorManagement as xn,Scene as An,WebGLRenderer as wn,MOUSE as Ae,AmbientLight as En,PlaneGeometry as yn,GridHelper as Mn,BoxGeometry as Ve,Raycaster as bn}from"./three.module-C62V74CF.js";import{O as Rn}from"./OrbitControls-CJGLS2vR.js";import{d as Sn}from"./index-BI6CMai0.js";import"./antd-vue-vendor-BPnV8VqP.js";import"./vxe-table-vendor-B88kchpX.js";function Xe(f,t){if(t===Gt)return f;if(t===Me||t===tt){let e=f.getIndex();if(e===null){const i=[],a=f.getAttribute("position");if(a!==void 0){for(let o=0;o=2.0 are supported."));return}const c=new os(r,{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 l=0;l=0&&a[u]}}c.setExtensions(i),c.setPlugins(a),c.parse(s,n)}parseAsync(t,e){const s=this;return new Promise(function(n,r){s.parse(t,e,n,r)})}}function Ln(){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={}}}}function N(f,t,e){const s=f.json.materials[t];return s.extensions&&s.extensions[e]?s.extensions[e]:null}const y={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",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class In{constructor(t){this.parser=t,this.name=y.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let s=0,n=e.length;s=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,i)}}class jn{constructor(t){this.parser=t,this.name=y.EXT_TEXTURE_WEBP}loadTexture(t){const e=this.name,s=this.parser,n=s.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const i=r.extensions[e],a=n.images[i.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(t,i.source,o)}}class Vn{constructor(t){this.parser=t,this.name=y.EXT_TEXTURE_AVIF}loadTexture(t){const e=this.name,s=this.parser,n=s.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const i=r.extensions[e],a=n.images[i.source];let o=s.textureLoader;if(a.uri){const c=s.options.manager.getHandler(a.uri);c!==null&&(o=c)}return s.loadTextureImage(t,i.source,o)}}class We{constructor(t,e){this.name=e,this.parser=t}loadBufferView(t){const e=this.parser.json,s=e.bufferViews[t];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.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 r.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,l=n.count,u=n.byteStride,d=new Uint8Array(a,o,c);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(l,u,d,n.mode,n.filter).then(function(h){return h.buffer}):i.ready.then(function(){const h=new ArrayBuffer(l*u);return i.decodeGltfBuffer(new Uint8Array(h),l,u,d,n.mode,n.filter),h})})}else return null}}class Xn{constructor(t){this.name=y.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,s=e.nodes[t];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=e.meshes[s.mesh];for(const c of n.primitives)if(c.mode!==k.TRIANGLES&&c.mode!==k.TRIANGLE_STRIP&&c.mode!==k.TRIANGLE_FAN&&c.mode!==void 0)return null;const i=s.extensions[this.name].attributes,a=[],o={};for(const c in i)a.push(this.parser.getDependency("accessor",i[c]).then(l=>(o[c]=l,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const l=c.pop(),u=l.isGroup?l.children:[l],d=c[0].count,h=[];for(const g of u){const M=new he,T=new U,A=new nt,_=new U(1,1,1),v=new Vt(g.geometry,g.material,d);for(let R=0;R0||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 is=new he;class os{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Ln,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 s=!1,n=-1,r=!1,i=-1;if(typeof navigator!="undefined"&&typeof navigator.userAgent!="undefined"){const a=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=s&&o?parseInt(o[1],10):-1,r=a.indexOf("Firefox")>-1,i=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap=="undefined"||s&&n<17||r&&i<98?this.textureLoader=new en(this.options.manager):this.textureLoader=new tn(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new st(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 s=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(i){const a={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:s,userData:{}};return W(r,a,n),D(a,n),Promise.all(s._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||[],s=this.json.meshes||[];for(let n=0,r=e.length;n{const o=this.associations.get(i);o!=null&&this.associations.set(a,o);for(const[c,l]of i.children.entries())r(l,a.children[c])};return r(s,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let s=0;s=2&&T.setY(S,P[O*o+1]),o>=3&&T.setZ(S,P[O*o+2]),o>=4&&T.setW(S,P[O*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,s=this.options,r=e.textures[t].source,i=e.images[r];let a=this.textureLoader;if(i.uri){const o=s.manager.getHandler(i.uri);o!==null&&(a=o)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,s){const n=this,r=this.json,i=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,s).then(function(l){l.flipY=!1,l.name=i.name||a.name||"",l.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(l.name=a.uri);const d=(r.samplers||{})[i.sampler]||{};return l.magFilter=Ye[d.magFilter]||be,l.minFilter=Ye[d.minFilter]||ot,l.wrapS=Ze[d.wrapS]||Re,l.wrapT=Ze[d.wrapT]||Re,l.generateMipmaps=!l.isCompressedTexture&&l.minFilter!==at&&l.minFilter!==be,n.associations.set(l,{textures:t}),l}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const s=this,n=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());const i=n.images[t],a=self.URL||self.webkitURL;let o=i.uri||"",c=!1;if(i.bufferView!==void 0)o=s.getDependency("bufferView",i.bufferView).then(function(u){c=!0;const d=new Blob([u],{type:i.mimeType});return o=a.createObjectURL(d),o});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(o).then(function(u){return new Promise(function(d,h){let g=d;e.isImageBitmapLoader===!0&&(g=function(M){const T=new Ke(M);T.needsUpdate=!0,d(T)}),e.load(ie.resolveURL(u,r.path),g,void 0,h)})}).then(function(u){return c===!0&&a.revokeObjectURL(o),D(u,i),u.userData.mimeType=i.mimeType||rs(i.uri),u}).catch(function(u){throw u});return this.sourceCache[t]=l,l}assignTexture(t,e,s,n){const r=this;return this.getDependency("texture",s.index).then(function(i){if(!i)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(i=i.clone(),i.channel=s.texCoord),r.extensions[y.KHR_TEXTURE_TRANSFORM]){const a=s.extensions!==void 0?s.extensions[y.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(i);i=r.extensions[y.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),r.associations.set(i,o)}}return n!==void 0&&(i.colorSpace=n),t[e]=i,i})}assignFinalMaterial(t){const e=t.geometry;let s=t.material;const n=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,i=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new nn,Te.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,o.sizeAttenuation=!1,this.cache.add(a,o)),s=o}else if(t.isLine){const a="LineBasicMaterial:"+s.uuid;let o=this.cache.get(a);o||(o=new sn,Te.prototype.copy.call(o,s),o.color.copy(s.color),o.map=s.map,this.cache.add(a,o)),s=o}if(n||r||i){let a="ClonedMaterial:"+s.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=s.clone(),r&&(o.vertexColors=!0),i&&(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(s))),s=o}t.material=s}getMaterialType(){return oe}loadMaterial(t){const e=this,s=this.json,n=this.extensions,r=s.materials[t];let i;const a={},o=r.extensions||{},c=[];if(o[y.KHR_MATERIALS_UNLIT]){const u=n[y.KHR_MATERIALS_UNLIT];i=u.getMaterialType(),c.push(u.extendParams(a,r,e))}else{const u=r.pbrMetallicRoughness||{};if(a.color=new X(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],z),a.opacity=d[3]}u.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",u.baseColorTexture,ae)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),i=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=rn);const l=r.alphaMode||Ee.OPAQUE;if(l===Ee.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===Ee.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&i!==re&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new ve(1,1),r.normalTexture.scale!==void 0)){const u=r.normalTexture.scale;a.normalScale.set(u,u)}if(r.occlusionTexture!==void 0&&i!==re&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&i!==re){const u=r.emissiveFactor;a.emissive=new X().setRGB(u[0],u[1],u[2],z)}return r.emissiveTexture!==void 0&&i!==re&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,ae)),Promise.all(c).then(function(){const u=new i(a);return r.name&&(u.name=r.name),D(u,r),e.associations.set(u,{materials:t}),r.extensions&&W(n,u,r),u})}createUniqueName(t){const e=on.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,s=this.extensions,n=this.primitiveCache;function r(a){return s[y.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return Qe(o,a,e)})}const i=[];for(let a=0,o=t.length;a0&&ns(A,r),A.name=e.createUniqueName(r.name||"mesh_"+t),D(A,r),T.extensions&&W(n,A,T),e.assignFinalMaterial(A),u.push(A)}for(let h=0,g=u.length;h0){const h=l.userData.pivot,g=u[0];l.pivot=new U().fromArray(h),l.position.x-=h[0],l.position.y-=h[1],l.position.z-=h[2],g.position.set(0,0,0),delete l.userData.pivot}return l})}_loadNodeShallow(t){const e=this.json,s=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const r=e.nodes[t],i=r.name?n.createUniqueName(r.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),r.camera!==void 0&&a.push(n.getDependency("camera",r.camera).then(function(c){return n._getNodeRef(n.cameraCache,r.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 l;if(r.isBone===!0?l=new mn:c.length>1?l=new xe:c.length===1?l=c[0]:l=new it,l!==c[0])for(let u=0,d=c.length;u1){const u=n.associations.get(l);n.associations.set(l,J({},u))}return n.associations.get(l).nodes=t,l}),this.nodeCache[t]}loadScene(t){const e=this.extensions,s=this.json.scenes[t],n=this,r=new xe;s.name&&(r.name=n.createUniqueName(s.name)),D(r,s),s.extensions&&W(e,r,s);const i=s.nodes||[],a=[];for(let o=0,c=i.length;o{const u=new Map;for(const[d,h]of n.associations)(d instanceof Te||d instanceof Ke)&&u.set(d,h);return l.traverse(d=>{const h=n.associations.get(d);h!=null&&u.set(d,h)}),u};return n.associations=c(r),r})}_createAnimationTracks(t,e,s,n,r){const i=[],a=t.name?t.name:t.uuid,o=[];j[r.path]===j.weights?t.traverse(function(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}):o.push(a);let c;switch(j[r.path]){case j.weights:c=je;break;case j.rotation:c=ze;break;case j.translation:case j.scale:c=Ue;break;default:switch(s.itemSize){case 1:c=je;break;case 2:case 3:default:c=Ue;break}break}const l=n.interpolation!==void 0?Jn[n.interpolation]:ct,u=this._getArrayFromAccessor(s);for(let d=0,h=o.length;d{Q(),ht(),mt(),Fe(),window.addEventListener("resize",Ie)}),Pt(()=>{cancelAnimationFrame(h),window.removeEventListener("resize",Ie),window.removeEventListener("click",Le),pe(),d.dispose(),u.dispose(),c.clear()});function Q(){c=new An,c.background=new X(15790837),l=new lt(75,t.value.clientWidth/t.value.clientHeight,.1,1e3),l.position.set(8,8,8),l.lookAt(0,0,0),u=new wn({antialias:!0}),u.setSize(t.value.clientWidth,t.value.clientHeight),u.shadowMap.enabled=!0,t.value.appendChild(u.domElement),d=new Rn(l,u.domElement),d.enableDamping=!0,d.dampingFactor=.05,d.mouseButtons={LEFT:Ae.ROTATE,MIDDLE:Ae.PAN,RIGHT:Ae.PAN};const p=new En(16777215,.6);c.add(p);const m=new rt(16777215,.8);m.position.set(10,10,5),m.castShadow=!0,c.add(m);const w=new yn(20,20),x=new oe({color:13421772}),E=new de(w,x);E.rotation.x=-Math.PI/2,E.receiveShadow=!0,c.add(E);const b=new Mn(20,20,8947848,14540253);c.add(b)}function ht(){const p=[{x:-4,y:1,z:-4},{x:4,y:1,z:-4},{x:0,y:1,z:0},{x:-4,y:1,z:4},{x:4,y:1,z:4}];Z.forEach((m,w)=>{if(w===2)pt(p[w],m);else{const x=new Ve(1.5,1.5,1.5),E=new oe({color:m.color,metalness:.3,roughness:.4}),b=new de(x,E);b.position.set(p[w].x,p[w].y,p[w].z),b.castShadow=!0,b.receiveShadow=!0,b.userData=ue(J({},m),{position:p[w],originalColor:m.color}),c.add(b),g.push(b)}})}function pt(p,m){new vn().load("/models/robot.glb",x=>{A=x.scene,A.position.set(p.x,p.y,p.z),A.scale.set(2,2,2),A.traverse(E=>{E.isMesh&&(E.castShadow=!0,E.receiveShadow=!0)}),A.userData=ue(J({},m),{position:p,originalColor:m.color,isModel:!0}),c.add(A),g.push(A)},x=>{},x=>{const E=new Ve(1.5,1.5,1.5),b=new oe({color:m.color,metalness:.3,roughness:.4}),C=new de(E,b);C.position.set(p.x,p.y,p.z),C.castShadow=!0,C.receiveShadow=!0,C.userData=ue(J({},m),{position:p,originalColor:m.color}),c.add(C),g.push(C)})}function mt(){M=new bn,T=new ve,window.addEventListener("click",Le)}function Le(p){const m=t.value.getBoundingClientRect();T.x=(p.clientX-m.left)/m.width*2-1,T.y=-((p.clientY-m.top)/m.height)*2+1,M.setFromCamera(T,l);const w=M.intersectObjects(g,!0);if(g.forEach(x=>{x.material?(x.material.color.setHex(x.userData.originalColor),x.material.emissive.setHex(0)):x.userData.isModel&&x.traverse(E=>{E.isMesh&&E.material&&E.material.emissive.setHex(0)})}),w.length>0){let E=w[0].object;for(;E.parent&&!g.includes(E);)E=E.parent;E.material?E.material.emissive.setHex(5592405):E.userData.isModel&&E.traverse(b=>{b.isMesh&&b.material&&b.material.emissive.setHex(5592405)}),e.value=E.userData}else e.value=null}function Ie(){l.aspect=t.value.clientWidth/t.value.clientHeight,l.updateProjectionMatrix(),u.setSize(t.value.clientWidth,t.value.clientHeight)}function Ne(){return ee(this,null,function*(){r.value?pe():yield Tt()})}function gt(){return ee(this,null,function*(){return new Promise((p,m)=>{if(window.tf&&window.handpose){p();return}const w=document.createElement("script");w.src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@3.11.0/dist/tf.min.js",w.onload=()=>{const x=document.createElement("script");x.src="https://cdn.jsdelivr.net/npm/@tensorflow-models/handpose@0.0.7/dist/handpose.min.js",x.onload=()=>p(),x.onerror=()=>m(new Error("HandPose 加载失败")),document.head.appendChild(x)},w.onerror=()=>m(new Error("TensorFlow.js 加载失败")),document.head.appendChild(w)})})}function Tt(){return ee(this,null,function*(){try{i.value="正在加载 TensorFlow.js...",yield gt(),i.value="正在加载手势识别模型...",R=yield window.handpose.load(),i.value="正在启动摄像头...",_=yield navigator.mediaDevices.getUserMedia({video:{width:640,height:480,facingMode:"user"}}),s.value.srcObject=_,r.value=!0,yield new Promise(p=>{s.value.onloadedmetadata=p}),n.value.width=s.value.videoWidth,n.value.height=s.value.videoHeight,i.value="手势控制已启用",Oe()}catch(p){i.value="启动失败: "+p.message,pe(),alert("手势控制启动失败: "+p.message)}})}function pe(){_&&(_.getTracks().forEach(p=>p.stop()),_=null),v&&(cancelAnimationFrame(v),v=null),r.value=!1,I=null,P=!1,O=!1,F=null,S={x:0,y:0}}function Oe(){return ee(this,null,function*(){if(!(!r.value||!R)){try{const p=yield R.estimateHands(s.value),m=n.value.getContext("2d");m.clearRect(0,0,n.value.width,n.value.height),m.drawImage(s.value,0,0,n.value.width,n.value.height),p.length>0?(p.forEach(w=>Mt(m,w.landmarks)),p.length>=2?At(p):Pe(p[0].landmarks)):(i.value="未检测到手部",Ce())}catch(p){}v=requestAnimationFrame(Oe)}})}function Ce(){I=null,P=!1,O=!1,F=null,S={x:0,y:0}}function me(p){const m=p[4],w=p[8];return Math.sqrt(Math.pow(m[0]-w[0],2)+Math.pow(m[1]-w[1],2)){const C=Math.sqrt(Math.pow(b[0]-m[0],2)+Math.pow(b[1]-m[1],2));x+=C}),x/w.length>ms}function Pe(p){const m=me(p),w=xt(p);if(m){const x=p[4],E=p[8],b=[(x[0]+E[0])/2,(x[1]+E[1])/2],C=b[0]/n.value.width*window.innerWidth,H=b[1]/n.value.height*window.innerHeight;if(o.value={x:C,y:H},a.value=!0,P&&I){let ce=(b[0]-I[0])/n.value.width,le=(b[1]-I[1])/n.value.height;S.x=S.x*(1-V)+ce*V,S.y=S.y*(1-V)+le*V,Math.abs(S.x)=et?(yt(),i.value="视角已重置",F=null):i.value=`保持手掌张开 ${((et-x)/1e3).toFixed(1)}s 重置视角`}P=!1,I=null}else a.value=!1,Ce(),i.value="等待手势..."}function At(p){const m=p[0].landmarks,w=p[1].landmarks,x=me(m),E=me(w);if(x&&E){const b=m[4],C=m[8],H=w[4],ce=w[8],le=[(b[0]+C[0])/2,(b[1]+C[1])/2],ke=[(H[0]+ce[0])/2,(H[1]+ce[1])/2],$=[(le[0]+ke[0])/2,(le[1]+ke[1])/2],bt=$[0]/n.value.width*window.innerWidth,Rt=$[1]/n.value.height*window.innerHeight;if(o.value={x:bt,y:Rt},a.value=!0,O&&I){let St=($[0]-I[0])/n.value.width,_t=($[1]-I[1])/n.value.height;S.x=S.x*(1-V)+St*V,S.y=S.y*(1-V)+_t*V,Math.abs(S.x){p.beginPath(),p.arc(x[0],x[1],5,0,2*Math.PI),p.fill()});const w=[[0,1],[1,2],[2,3],[3,4],[0,5],[5,6],[6,7],[7,8],[0,9],[9,10],[10,11],[11,12],[0,13],[13,14],[14,15],[15,16],[0,17],[17,18],[18,19],[19,20],[5,9],[9,13],[13,17]];p.strokeStyle="#00ff00",p.lineWidth=2,w.forEach(([x,E])=>{p.beginPath(),p.moveTo(m[x][0],m[x][1]),p.lineTo(m[E][0],m[E][1]),p.stroke()})}function Fe(){h=requestAnimationFrame(Fe),g.forEach((p,m)=>{p.userData.isModel||(p.rotation.y+=.005*(m%2===0?1:-1))}),d.update(),u.render(c,l)}return(p,m)=>(ne(),te("div",cs,[L("div",{ref_key:"container",ref:t,class:"three-container"},null,512),a.value?(ne(),te("div",{key:0,class:"virtual-cursor",style:Ge({left:o.value.x+"px",top:o.value.y+"px"})},[...m[1]||(m[1]=[L("div",{class:"cursor-dot"},null,-1),L("div",{class:"cursor-ring"},null,-1)])],4)):Be("",!0),L("div",ls,[r.value?(ne(),te("div",us,[L("span",null,G(i.value),1),L("button",{onClick:Ne,class:"toggle-btn"},"关闭")])):(ne(),te("button",{key:0,onClick:Ne,class:"gesture-toggle-btn"}," 🎥 启用手势控制 "))]),L("div",{class:Ft(["camera-preview",{hidden:!r.value}])},[L("video",{ref_key:"videoElement",ref:s,autoplay:"",playsinline:""},null,512),L("canvas",{ref_key:"canvasElement",ref:n},null,512)],2),e.value?(ne(),te("div",fs,[L("div",ds,[m[2]||(m[2]=L("h3",null,"设备信息",-1)),L("button",{onClick:m[0]||(m[0]=w=>e.value=null),class:"close-btn"},"×")]),L("div",hs,[L("p",null,[m[3]||(m[3]=L("strong",null,"设备名称:",-1)),q(" "+G(e.value.name),1)]),L("p",null,[m[4]||(m[4]=L("strong",null,"设备ID:",-1)),q(" "+G(e.value.id),1)]),L("p",null,[m[5]||(m[5]=L("strong",null,"状态:",-1)),m[6]||(m[6]=q()),L("span",{style:Ge({color:e.value.statusColor})},G(e.value.status),5)]),L("p",null,[m[7]||(m[7]=L("strong",null,"位置:",-1)),q(" X: "+G(e.value.position.x.toFixed(2))+", Y: "+G(e.value.position.y.toFixed(2))+", Z: "+G(e.value.position.z.toFixed(2)),1)]),L("p",null,[m[8]||(m[8]=L("strong",null,"温度:",-1)),q(" "+G(e.value.temperature)+"°C",1)]),L("p",null,[m[9]||(m[9]=L("strong",null,"运行时长:",-1)),q(" "+G(e.value.runtime)+"小时",1)])])])):Be("",!0)]))}},_s=Sn(gs,[["__scopeId","data-v-c59c8626"]]);export{_s as default};