endset_three_editor 0.2.5 → 0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.tree-node .tree-item[data-v-5ad9c842]{display:flex;align-items:center;padding:4px 10px;cursor:pointer;transition:background .15s}.tree-node .tree-item[data-v-5ad9c842]:hover{background:#2a4050}.tree-node .tree-item.selected[data-v-5ad9c842]{background:#3e5a6b}.tree-node .toggle-icon[data-v-5ad9c842]{cursor:pointer;width:20px;text-align:center;font-size:12px;-webkit-user-select:none;user-select:none}.tree-node .toggle-placeholder[data-v-5ad9c842]{width:20px;display:inline-block}.tree-node .tree-icon[data-v-5ad9c842]{margin-right:6px;font-size:14px}.tree-node .tree-name[data-v-5ad9c842]{flex:1;font-size:13px;-webkit-user-select:none;user-select:none}.tree-node .tree-delete[data-v-5ad9c842]{background:transparent;border:none;color:#e74c3c;font-size:16px;cursor:pointer;padding:0 4px;line-height:1}.tree-node .tree-delete[data-v-5ad9c842]:hover{color:#ff6b6b}.tree-children[data-v-5ad9c842]{padding-left:20px}.tabs[data-v-d75c643f]{display:flex;gap:0;border-bottom:2px solid #1a2a36;margin-bottom:16px}.tabs .tab-btn[data-v-d75c643f]{flex:1;padding:8px 12px;background:transparent;border:none;color:#95a5a6;font-size:13px;cursor:pointer;transition:color .2s,border-bottom .2s;border-bottom:2px solid transparent;margin-bottom:-2px}.tabs .tab-btn[data-v-d75c643f]:hover{color:#ecf0f1}.tabs .tab-btn.active[data-v-d75c643f]{color:#f1c40f;border-bottom-color:#f1c40f}.property-panel[data-v-d75c643f]{width:320px;height:100%;background:#2c3e50;color:#ecf0f1;padding:16px;box-sizing:border-box;border-left:1px solid #1a2a36;overflow-y:auto;font-size:14px}.property-panel h3[data-v-d75c643f]{margin-top:0;text-align:center}.property-panel .property-group[data-v-d75c643f]{margin-bottom:20px;border-bottom:1px solid #1a2a36;padding-bottom:12px}.property-panel .property-group label[data-v-d75c643f]{font-weight:700;display:block;margin-bottom:8px;color:#f1c40f}.property-panel .property-group .row[data-v-d75c643f]{display:flex;align-items:center;gap:8px;margin-bottom:6px}.property-panel .property-group .row span[data-v-d75c643f]{width:20px;text-align:right}.property-panel .property-group .row input[data-v-d75c643f]{background:#1e2a36;border:1px solid #3e5a6b;color:#ecf0f1;padding:4px 8px;border-radius:4px;width:48px}.property-panel .tab-content .material-group .slider-row[data-v-d75c643f]{display:flex;align-items:center;gap:8px;margin-bottom:6px}.property-panel .tab-content .material-group .slider-row .slider-label[data-v-d75c643f]{width:50px;font-size:12px;color:#95a5a6}.property-panel .tab-content .material-group .slider-row input[type=range][data-v-d75c643f]{flex:1;height:4px;-webkit-appearance:none;background:#1e2a36;border-radius:2px;outline:none}.property-panel .tab-content .material-group .slider-row input[type=range][data-v-d75c643f]::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;border-radius:50%;background:#f1c40f;cursor:pointer}.property-panel .tab-content .material-group .slider-row .slider-value[data-v-d75c643f]{width:36px;font-size:12px;text-align:center;color:#ecf0f1}.property-panel .tab-content .material-group .material-hint[data-v-d75c643f]{margin-top:6px;font-size:12px;color:#e67e22}.empty[data-v-d75c643f]{text-align:center;color:#95a5a6}.tree-group[data-v-d75c643f]{margin-top:10px}.tree-group .tree-container[data-v-d75c643f]{max-height:200px;overflow-y:auto;background:#1a2a36;border-radius:4px;padding:4px 0}.tree-empty[data-v-d75c643f]{padding:8px 10px;color:#95a5a6;font-style:italic}.top-bar[data-v-6bb4762f]{height:40px;background:#1a2a36;display:flex;align-items:center;justify-content:space-between;padding:0 16px;border-bottom:1px solid #2a4050;flex-shrink:0;-webkit-user-select:none;user-select:none}.top-bar .left-section[data-v-6bb4762f]{display:flex;gap:12px;align-items:center}.top-bar .left-section .dropdown-wrapper[data-v-6bb4762f]{position:relative;display:inline-block}.top-bar .left-section .dropdown-wrapper .menu-btn[data-v-6bb4762f]{background:transparent;border:none;color:#ecf0f1;padding:6px 12px;border-radius:4px;cursor:pointer;font-size:14px;transition:background .2s}.top-bar .left-section .dropdown-wrapper .menu-btn[data-v-6bb4762f]:hover{background:#2a4050}.top-bar .left-section .dropdown-wrapper .dropdown-menu[data-v-6bb4762f]{position:absolute;top:100%;left:0;background:#2c3e50;border:1px solid #3e5a6b;border-radius:4px;min-width:140px;padding:4px 0;z-index:100;box-shadow:0 4px 12px #0000004d}.top-bar .left-section .dropdown-wrapper .dropdown-menu .menu-item[data-v-6bb4762f]{padding:6px 16px;color:#ecf0f1;cursor:pointer;font-size:13px;transition:background .15s;white-space:nowrap}.top-bar .left-section .dropdown-wrapper .dropdown-menu .menu-item[data-v-6bb4762f]:hover{background:#3e5a6b}.top-bar .left-section .dropdown-wrapper .dropdown-menu .menu-item.sub-trigger[data-v-6bb4762f]{display:flex;justify-content:space-between;align-items:center;position:relative}.top-bar .left-section .dropdown-wrapper .sub-menu[data-v-6bb4762f]{position:absolute;left:100%;top:0;background:#2c3e50;border:1px solid #3e5a6b;border-radius:4px;min-width:140px;padding:4px 0;z-index:101;box-shadow:0 4px 12px #0000004d}.top-bar .right-section[data-v-6bb4762f]{display:flex;align-items:center}.top-bar .app-title[data-v-6bb4762f]{color:#8af;font-size:16px;font-weight:500;letter-spacing:.5px}.bottom-bar[data-v-3427bb27]{height:40px;background:#1a2a36;border-top:1px solid #2a4050;display:flex;align-items:center;justify-content:space-between;padding:0 16px;flex-shrink:0;color:#95a5a6;font-size:13px;-webkit-user-select:none;user-select:none}.bottom-bar .status-left[data-v-3427bb27],.bottom-bar .status-right[data-v-3427bb27]{display:flex;gap:16px}.app-layout[data-v-
|
|
1
|
+
.tree-node .tree-item[data-v-5ad9c842]{display:flex;align-items:center;padding:4px 10px;cursor:pointer;transition:background .15s}.tree-node .tree-item[data-v-5ad9c842]:hover{background:#2a4050}.tree-node .tree-item.selected[data-v-5ad9c842]{background:#3e5a6b}.tree-node .toggle-icon[data-v-5ad9c842]{cursor:pointer;width:20px;text-align:center;font-size:12px;-webkit-user-select:none;user-select:none}.tree-node .toggle-placeholder[data-v-5ad9c842]{width:20px;display:inline-block}.tree-node .tree-icon[data-v-5ad9c842]{margin-right:6px;font-size:14px}.tree-node .tree-name[data-v-5ad9c842]{flex:1;font-size:13px;-webkit-user-select:none;user-select:none}.tree-node .tree-delete[data-v-5ad9c842]{background:transparent;border:none;color:#e74c3c;font-size:16px;cursor:pointer;padding:0 4px;line-height:1}.tree-node .tree-delete[data-v-5ad9c842]:hover{color:#ff6b6b}.tree-children[data-v-5ad9c842]{padding-left:20px}.tabs[data-v-d75c643f]{display:flex;gap:0;border-bottom:2px solid #1a2a36;margin-bottom:16px}.tabs .tab-btn[data-v-d75c643f]{flex:1;padding:8px 12px;background:transparent;border:none;color:#95a5a6;font-size:13px;cursor:pointer;transition:color .2s,border-bottom .2s;border-bottom:2px solid transparent;margin-bottom:-2px}.tabs .tab-btn[data-v-d75c643f]:hover{color:#ecf0f1}.tabs .tab-btn.active[data-v-d75c643f]{color:#f1c40f;border-bottom-color:#f1c40f}.property-panel[data-v-d75c643f]{width:320px;height:100%;background:#2c3e50;color:#ecf0f1;padding:16px;box-sizing:border-box;border-left:1px solid #1a2a36;overflow-y:auto;font-size:14px}.property-panel h3[data-v-d75c643f]{margin-top:0;text-align:center}.property-panel .property-group[data-v-d75c643f]{margin-bottom:20px;border-bottom:1px solid #1a2a36;padding-bottom:12px}.property-panel .property-group label[data-v-d75c643f]{font-weight:700;display:block;margin-bottom:8px;color:#f1c40f}.property-panel .property-group .row[data-v-d75c643f]{display:flex;align-items:center;gap:8px;margin-bottom:6px}.property-panel .property-group .row span[data-v-d75c643f]{width:20px;text-align:right}.property-panel .property-group .row input[data-v-d75c643f]{background:#1e2a36;border:1px solid #3e5a6b;color:#ecf0f1;padding:4px 8px;border-radius:4px;width:48px}.property-panel .tab-content .material-group .slider-row[data-v-d75c643f]{display:flex;align-items:center;gap:8px;margin-bottom:6px}.property-panel .tab-content .material-group .slider-row .slider-label[data-v-d75c643f]{width:50px;font-size:12px;color:#95a5a6}.property-panel .tab-content .material-group .slider-row input[type=range][data-v-d75c643f]{flex:1;height:4px;-webkit-appearance:none;background:#1e2a36;border-radius:2px;outline:none}.property-panel .tab-content .material-group .slider-row input[type=range][data-v-d75c643f]::-webkit-slider-thumb{-webkit-appearance:none;width:12px;height:12px;border-radius:50%;background:#f1c40f;cursor:pointer}.property-panel .tab-content .material-group .slider-row .slider-value[data-v-d75c643f]{width:36px;font-size:12px;text-align:center;color:#ecf0f1}.property-panel .tab-content .material-group .material-hint[data-v-d75c643f]{margin-top:6px;font-size:12px;color:#e67e22}.empty[data-v-d75c643f]{text-align:center;color:#95a5a6}.tree-group[data-v-d75c643f]{margin-top:10px}.tree-group .tree-container[data-v-d75c643f]{max-height:200px;overflow-y:auto;background:#1a2a36;border-radius:4px;padding:4px 0}.tree-empty[data-v-d75c643f]{padding:8px 10px;color:#95a5a6;font-style:italic}.top-bar[data-v-6bb4762f]{height:40px;background:#1a2a36;display:flex;align-items:center;justify-content:space-between;padding:0 16px;border-bottom:1px solid #2a4050;flex-shrink:0;-webkit-user-select:none;user-select:none}.top-bar .left-section[data-v-6bb4762f]{display:flex;gap:12px;align-items:center}.top-bar .left-section .dropdown-wrapper[data-v-6bb4762f]{position:relative;display:inline-block}.top-bar .left-section .dropdown-wrapper .menu-btn[data-v-6bb4762f]{background:transparent;border:none;color:#ecf0f1;padding:6px 12px;border-radius:4px;cursor:pointer;font-size:14px;transition:background .2s}.top-bar .left-section .dropdown-wrapper .menu-btn[data-v-6bb4762f]:hover{background:#2a4050}.top-bar .left-section .dropdown-wrapper .dropdown-menu[data-v-6bb4762f]{position:absolute;top:100%;left:0;background:#2c3e50;border:1px solid #3e5a6b;border-radius:4px;min-width:140px;padding:4px 0;z-index:100;box-shadow:0 4px 12px #0000004d}.top-bar .left-section .dropdown-wrapper .dropdown-menu .menu-item[data-v-6bb4762f]{padding:6px 16px;color:#ecf0f1;cursor:pointer;font-size:13px;transition:background .15s;white-space:nowrap}.top-bar .left-section .dropdown-wrapper .dropdown-menu .menu-item[data-v-6bb4762f]:hover{background:#3e5a6b}.top-bar .left-section .dropdown-wrapper .dropdown-menu .menu-item.sub-trigger[data-v-6bb4762f]{display:flex;justify-content:space-between;align-items:center;position:relative}.top-bar .left-section .dropdown-wrapper .sub-menu[data-v-6bb4762f]{position:absolute;left:100%;top:0;background:#2c3e50;border:1px solid #3e5a6b;border-radius:4px;min-width:140px;padding:4px 0;z-index:101;box-shadow:0 4px 12px #0000004d}.top-bar .right-section[data-v-6bb4762f]{display:flex;align-items:center}.top-bar .app-title[data-v-6bb4762f]{color:#8af;font-size:16px;font-weight:500;letter-spacing:.5px}.bottom-bar[data-v-3427bb27]{height:40px;background:#1a2a36;border-top:1px solid #2a4050;display:flex;align-items:center;justify-content:space-between;padding:0 16px;flex-shrink:0;color:#95a5a6;font-size:13px;-webkit-user-select:none;user-select:none}.bottom-bar .status-left[data-v-3427bb27],.bottom-bar .status-right[data-v-3427bb27]{display:flex;gap:16px}.app-layout[data-v-a75eff69]{display:flex;flex-direction:column;height:100%;width:100%}.editor-container[data-v-a75eff69]{display:flex;width:100%}.editor-container-mode-edit[data-v-a75eff69]{height:calc(100% - 80px)}.editor-container-mode-run[data-v-a75eff69]{height:100%}.canvas[data-v-a75eff69]{height:100%;background-color:transparent;position:relative}.canvas-mode-edit[data-v-a75eff69]{width:calc(100% - 320px)}.canvas-mode-run[data-v-a75eff69]{width:100%}
|
package/dist/three-editor.cjs.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
`)!==-1&&(e=e.replace(/\r\n/g,`
|
|
3
3
|
`)),e.indexOf(`\\
|
|
4
4
|
`)!==-1&&(e=e.replace(/\\\n/g,""));const s=e.split(`
|
|
5
|
-
`);let n=[];for(let l=0,c=s.length;l<c;l++){const d=s[l].trimStart();if(d.length===0)continue;const p=d.charAt(0);if(p!=="#")if(p==="v"){const u=d.split(qe);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),u.length>=7?(we.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6]),r.SRGBColorSpace),t.colors.push(we.r,we.g,we.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]));break}}else if(p==="f"){const f=d.slice(1).trim().split(qe),y=[];for(let g=0,b=f.length;g<b;g++){const m=f[g];if(m.length>0){const _=m.split("/");y.push(_)}}const w=y[0];for(let g=1,b=y.length-1;g<b;g++){const m=y[g],_=y[g+1];t.addFace(w[0],m[0],_[0],w[1],m[1],_[1],w[2],m[2],_[2])}}else if(p==="l"){const u=d.substring(1).trim().split(" ");let f=[];const y=[];if(d.indexOf("/")===-1)f=u;else for(let w=0,g=u.length;w<g;w++){const b=u[w].split("/");b[0]!==""&&f.push(b[0]),b[1]!==""&&y.push(b[1])}t.addLineGeometry(f,y)}else if(p==="p"){const f=d.slice(1).trim().split(" ");t.addPointGeometry(f)}else if((n=yn.exec(d))!==null){const u=(" "+n[0].slice(1).trim()).slice(1);t.startObject(u)}else if(_n.test(d))t.object.startMaterial(d.substring(7).trim(),t.materialLibraries);else if(bn.test(d))t.materialLibraries.push(d.substring(7).trim());else if(wn.test(d))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(p==="s"){if(n=d.split(" "),n.length>1){const f=n[1].trim().toLowerCase();t.object.smooth=f!=="0"&&f!=="off"}else t.object.smooth=!0;const u=t.object.currentMaterial();u&&(u.smooth=t.object.smooth)}else{if(d==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+d+'"')}}t.finalize();const o=new r.Group;if(o.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let l=0,c=t.objects.length;l<c;l++){const d=t.objects[l],p=d.geometry,u=d.materials,f=p.type==="Line",y=p.type==="Points";let w=!1;if(p.vertices.length===0)continue;const g=new r.BufferGeometry;g.setAttribute("position",new r.Float32BufferAttribute(p.vertices,3)),p.normals.length>0&&g.setAttribute("normal",new r.Float32BufferAttribute(p.normals,3)),p.colors.length>0&&(w=!0,g.setAttribute("color",new r.Float32BufferAttribute(p.colors,3))),p.hasUVIndices===!0&&g.setAttribute("uv",new r.Float32BufferAttribute(p.uvs,2));const b=[];for(let _=0,M=u.length;_<M;_++){const S=u[_],R=S.name+"_"+S.smooth+"_"+w;let x=t.materials[R];if(this.materials!==null){if(x=this.materials.create(S.name),f&&x&&!(x instanceof r.LineBasicMaterial)){const L=new r.LineBasicMaterial;r.Material.prototype.copy.call(L,x),L.color.copy(x.color),x=L}else if(y&&x&&!(x instanceof r.PointsMaterial)){const L=new r.PointsMaterial({size:10,sizeAttenuation:!1});r.Material.prototype.copy.call(L,x),L.color.copy(x.color),L.map=x.map,x=L}}x===void 0&&(f?x=new r.LineBasicMaterial:y?x=new r.PointsMaterial({size:1,sizeAttenuation:!1}):x=new r.MeshPhongMaterial,x.name=S.name,x.flatShading=!S.smooth,x.vertexColors=w,t.materials[R]=x),b.push(x)}let m;if(b.length>1){for(let _=0,M=u.length;_<M;_++){const S=u[_];g.addGroup(S.groupStart,S.groupCount,_)}f?m=new r.LineSegments(g,b):y?m=new r.Points(g,b):m=new r.Mesh(g,b)}else f?m=new r.LineSegments(g,b[0]):y?m=new r.Points(g,b[0]):m=new r.Mesh(g,b[0]);m.name=d.name,o.add(m)}else if(t.vertices.length>0){const l=new r.PointsMaterial({size:1,sizeAttenuation:!1}),c=new r.BufferGeometry;c.setAttribute("position",new r.Float32BufferAttribute(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(c.setAttribute("color",new r.Float32BufferAttribute(t.colors,3)),l.vertexColors=!0);const d=new r.Points(c,l);o.add(d)}return o}}function et(a,e){if(e===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(e===r.TriangleFanDrawMode||e===r.TriangleStripDrawMode){let t=a.getIndex();if(t===null){const i=[],l=a.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)i.push(c);a.setIndex(i),t=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}const s=t.count-2,n=[];if(e===r.TriangleFanDrawMode)for(let i=1;i<=s;i++)n.push(t.getX(0)),n.push(t.getX(i)),n.push(t.getX(i+1));else for(let i=0;i<s;i++)i%2===0?(n.push(t.getX(i)),n.push(t.getX(i+1)),n.push(t.getX(i+2))):(n.push(t.getX(i+2)),n.push(t.getX(i+1)),n.push(t.getX(i)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=a.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),a}function Tn(a){const e=new Map,t=new Map,s=a.clone();return gt(a,s,function(n,o){e.set(o,n),t.set(n,o)}),s.traverse(function(n){if(!n.isSkinnedMesh)return;const o=n,i=e.get(n),l=i.skeleton.bones;o.skeleton=i.skeleton.clone(),o.bindMatrix.copy(i.bindMatrix),o.skeleton.bones=l.map(function(c){return t.get(c)}),o.bind(o.skeleton,o.bindMatrix)}),s}function gt(a,e,t){t(a,e);for(let s=0;s<a.children.length;s++)gt(a.children[s],e.children[s],t)}class xn extends r.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Pn(t)}),this.register(function(t){return new Ln(t)}),this.register(function(t){return new Fn(t)}),this.register(function(t){return new Hn(t)}),this.register(function(t){return new Bn(t)}),this.register(function(t){return new Cn(t)}),this.register(function(t){return new In(t)}),this.register(function(t){return new On(t)}),this.register(function(t){return new Dn(t)}),this.register(function(t){return new An(t)}),this.register(function(t){return new kn(t)}),this.register(function(t){return new Nn(t)}),this.register(function(t){return new jn(t)}),this.register(function(t){return new Vn(t)}),this.register(function(t){return new vn(t)}),this.register(function(t){return new tt(t,v.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new tt(t,v.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Gn(t)})}load(e,t,s,n){const o=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const d=r.LoaderUtils.extractUrlBase(e);i=r.LoaderUtils.resolveURL(d,this.path)}else i=r.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const l=function(d){n?n(d):console.error(d),o.manager.itemError(e),o.manager.itemEnd(e)},c=new r.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(d){try{o.parse(d,i,function(p){t(p),o.manager.itemEnd(e)},l)}catch(p){l(p)}},s,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let o;const i={},l={},c=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===yt){try{i[v.KHR_BINARY_GLTF]=new Un(e)}catch(u){n&&n(u);return}o=JSON.parse(i[v.KHR_BINARY_GLTF].content)}else o=JSON.parse(c.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const d=new ns(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let p=0;p<this.pluginCallbacks.length;p++){const u=this.pluginCallbacks[p](d);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[u.name]=u,i[u.name]=!0}if(o.extensionsUsed)for(let p=0;p<o.extensionsUsed.length;++p){const u=o.extensionsUsed[p],f=o.extensionsRequired||[];switch(u){case v.KHR_MATERIALS_UNLIT:i[u]=new Rn;break;case v.KHR_DRACO_MESH_COMPRESSION:i[u]=new zn(o,this.dracoLoader);break;case v.KHR_TEXTURE_TRANSFORM:i[u]=new Xn;break;case v.KHR_MESH_QUANTIZATION:i[u]=new Yn;break;default:f.indexOf(u)>=0&&l[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}d.setExtensions(i),d.setPlugins(l),d.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,o){s.parse(e,t,n,o)})}}function Sn(){let a={};return{get:function(e){return a[e]},add:function(e,t){a[e]=t},remove:function(e){delete a[e]},removeAll:function(){a={}}}}function C(a,e,t){const s=a.json.materials[e];return s.extensions&&s.extensions[t]?s.extensions[t]:null}const v={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 vn{constructor(e){this.parser=e,this.name=v.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const o=t[s];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const o=t.json,c=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let d;const p=new r.Color(16777215);c.color!==void 0&&p.setRGB(c.color[0],c.color[1],c.color[2],r.LinearSRGBColorSpace);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":d=new r.DirectionalLight(p),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new r.PointLight(p),d.distance=u;break;case"spot":d=new r.SpotLight(p),d.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,d.angle=c.spot.outerConeAngle,d.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return d.position.set(0,0,0),Y(d,c),c.intensity!==void 0&&(d.intensity=c.intensity),d.name=t.createUniqueName(c.name||"light_"+e),n=Promise.resolve(d),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,o=s.json.nodes[e],l=(o.extensions&&o.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(c){return s._getNodeRef(t.cache,l,c)})}}class Rn{constructor(){this.name=v.KHR_MATERIALS_UNLIT}getMaterialType(){return r.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new r.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const i=o.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],r.LinearSRGBColorSpace),e.opacity=i[3]}o.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",o.baseColorTexture,r.SRGBColorSpace))}return Promise.all(n)}}class An{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);return s===null||s.emissiveStrength!==void 0&&(t.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class Pn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&n.push(this.parser.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&n.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(n.push(this.parser.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const o=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(o,o)}return Promise.all(n)}}class Ln{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_DISPERSION}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);return s===null||(t.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class Nn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&n.push(this.parser.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&n.push(this.parser.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(n)}}class Cn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_SHEEN}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];if(t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,s.sheenColorFactor!==void 0){const o=s.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&n.push(this.parser.assignTexture(t,"sheenColorMap",s.sheenColorTexture,r.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&n.push(this.parser.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(n)}}class In{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&n.push(this.parser.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(n)}}class On{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_VOLUME}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&n.push(this.parser.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color().setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace),Promise.all(n)}}class Dn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_IOR}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);return s===null||(t.ior=s.ior!==void 0?s.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}}class kn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_SPECULAR}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&n.push(this.parser.assignTexture(t,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return t.specularColor=new r.Color().setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&n.push(this.parser.assignTexture(t,"specularColorMap",s.specularColorTexture,r.SRGBColorSpace)),Promise.all(n)}}class Vn{constructor(e){this.parser=e,this.name=v.EXT_MATERIALS_BUMP}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&n.push(this.parser.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(n)}}class jn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&n.push(this.parser.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(n)}}class Fn{constructor(e){this.parser=e,this.name=v.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const o=n.extensions[this.name],i=t.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,i)}}class Hn{constructor(e){this.parser=e,this.name=v.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,s=this.parser,n=s.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],l=n.images[i.source];let c=s.textureLoader;if(l.uri){const d=s.options.manager.getHandler(l.uri);d!==null&&(c=d)}return s.loadTextureImage(e,i.source,c)}}class Bn{constructor(e){this.parser=e,this.name=v.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,s=this.parser,n=s.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],l=n.images[i.source];let c=s.textureLoader;if(l.uri){const d=s.options.manager.getHandler(l.uri);d!==null&&(c=d)}return s.loadTextureImage(e,i.source,c)}}class tt{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],o=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(l){const c=n.byteOffset||0,d=n.byteLength||0,p=n.count,u=n.byteStride,f=new Uint8Array(l,c,d);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(p,u,f,n.mode,n.filter).then(function(y){return y.buffer}):i.ready.then(function(){const y=new ArrayBuffer(p*u);return i.decodeGltfBuffer(new Uint8Array(y),p,u,f,n.mode,n.filter),y})})}else return null}}class Gn{constructor(e){this.name=v.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const d of n.primitives)if(d.mode!==B.TRIANGLES&&d.mode!==B.TRIANGLE_STRIP&&d.mode!==B.TRIANGLE_FAN&&d.mode!==void 0)return null;const i=s.extensions[this.name].attributes,l=[],c={};for(const d in i)l.push(this.parser.getDependency("accessor",i[d]).then(p=>(c[d]=p,c[d])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(d=>{const p=d.pop(),u=p.isGroup?p.children:[p],f=d[0].count,y=[];for(const w of u){const g=new r.Matrix4,b=new r.Vector3,m=new r.Quaternion,_=new r.Vector3(1,1,1),M=new r.InstancedMesh(w.geometry,w.material,f);for(let S=0;S<f;S++)c.TRANSLATION&&b.fromBufferAttribute(c.TRANSLATION,S),c.ROTATION&&m.fromBufferAttribute(c.ROTATION,S),c.SCALE&&_.fromBufferAttribute(c.SCALE,S),M.setMatrixAt(S,g.compose(b,m,_));for(const S in c)if(S==="_COLOR_0"){const R=c[S];M.instanceColor=new r.InstancedBufferAttribute(R.array,R.itemSize,R.normalized)}else S!=="TRANSLATION"&&S!=="ROTATION"&&S!=="SCALE"&&w.geometry.setAttribute(S,c[S]);r.Object3D.prototype.copy.call(M,w),this.parser.assignFinalMaterial(M),y.push(M)}return p.isGroup?(p.clear(),p.add(...y),p):y[0]}))}}const yt="glTF",le=12,nt={JSON:1313821514,BIN:5130562};class Un{constructor(e){this.name=v.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,le),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==yt)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-le,o=new DataView(e,le);let i=0;for(;i<n;){const l=o.getUint32(i,!0);i+=4;const c=o.getUint32(i,!0);if(i+=4,c===nt.JSON){const d=new Uint8Array(e,le+i,l);this.content=s.decode(d)}else if(c===nt.BIN){const d=le+i;this.body=e.slice(d,d+l)}i+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class zn{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=v.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,o=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,l={},c={},d={};for(const p in i){const u=De[p]||p.toLowerCase();l[u]=i[p]}for(const p in e.attributes){const u=De[p]||p.toLowerCase();if(i[p]!==void 0){const f=s.accessors[e.attributes[p]],y=oe[f.componentType];d[u]=y.name,c[u]=f.normalized===!0}}return t.getDependency("bufferView",o).then(function(p){return new Promise(function(u,f){n.decodeDracoFile(p,function(y){for(const w in y.attributes){const g=y.attributes[w],b=c[w];b!==void 0&&(g.normalized=b)}u(y)},l,d,r.LinearSRGBColorSpace,f)})})}}class Xn{constructor(){this.name=v.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Yn{constructor(){this.name=v.KHR_MESH_QUANTIZATION}}class bt extends r.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,o=e*n*3+n;for(let i=0;i!==n;i++)t[i]=s[o+i];return t}interpolate_(e,t,s,n){const o=this.resultBuffer,i=this.sampleValues,l=this.valueSize,c=l*2,d=l*3,p=n-t,u=(s-t)/p,f=u*u,y=f*u,w=e*d,g=w-d,b=-2*y+3*f,m=y-f,_=1-b,M=m-f+u;for(let S=0;S!==l;S++){const R=i[g+S+l],x=i[g+S+c]*p,L=i[w+S+l],K=i[w+S]*p;o[S]=_*R+M*x+b*L+m*K}return o}}const Kn=new r.Quaternion;class Zn extends bt{interpolate_(e,t,s,n){const o=super.interpolate_(e,t,s,n);return Kn.fromArray(o).normalize().toArray(o),o}}const B={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},oe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},st={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},ot={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},Ne={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},De={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"},q={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Qn={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},Ce={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function qn(a){return a.DefaultMaterial===void 0&&(a.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),a.DefaultMaterial}function J(a,e,t){for(const s in t.extensions)a[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function Y(a,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(a.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Wn(a,e,t){let s=!1,n=!1,o=!1;for(let d=0,p=e.length;d<p;d++){const u=e[d];if(u.POSITION!==void 0&&(s=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(o=!0),s&&n&&o)break}if(!s&&!n&&!o)return Promise.resolve(a);const i=[],l=[],c=[];for(let d=0,p=e.length;d<p;d++){const u=e[d];if(s){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):a.attributes.position;i.push(f)}if(n){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):a.attributes.normal;l.push(f)}if(o){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):a.attributes.color;c.push(f)}}return Promise.all([Promise.all(i),Promise.all(l),Promise.all(c)]).then(function(d){const p=d[0],u=d[1],f=d[2];return s&&(a.morphAttributes.position=p),n&&(a.morphAttributes.normal=u),o&&(a.morphAttributes.color=f),a.morphTargetsRelative=!0,a})}function $n(a,e){if(a.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)a.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(a.morphTargetInfluences.length===t.length){a.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)a.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Jn(a){let e;const t=a.extensions&&a.extensions[v.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Ie(t.attributes):e=a.indices+":"+Ie(a.attributes)+":"+a.mode,a.targets!==void 0)for(let s=0,n=a.targets.length;s<n;s++)e+=":"+Ie(a.targets[s]);return e}function Ie(a){let e="";const t=Object.keys(a).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+a[t[s]]+";";return e}function ke(a){switch(a){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 es(a){return a.search(/\.jpe?g($|\?)/i)>0||a.search(/^data\:image\/jpeg/)===0?"image/jpeg":a.search(/\.webp($|\?)/i)>0||a.search(/^data\:image\/webp/)===0?"image/webp":a.search(/\.ktx2($|\?)/i)>0||a.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const ts=new r.Matrix4;class ns{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Sn,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,o=!1,i=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const l=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(l)===!0;const c=l.match(/Version\/(\d+)/);n=s&&c?parseInt(c[1],10):-1,o=l.indexOf("Firefox")>-1,i=o?l.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||o&&i<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,o=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 l={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:s,userData:{}};return J(o,l,n),Y(l,n),Promise.all(s._invokeAll(function(c){return c.afterRoot&&c.afterRoot(l)})).then(function(){for(const c of l.scenes)c.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,o=t.length;n<o;n++){const i=t[n].joints;for(let l=0,c=i.length;l<c;l++)e[i[l]].isBone=!0}for(let n=0,o=e.length;n<o;n++){const i=e[n];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(s[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),o=(i,l)=>{const c=this.associations.get(i);c!=null&&this.associations.set(l,c);for(const[d,p]of i.children.entries())o(p,l.children[d])};return o(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const o=e(t[n]);o&&s.push(o)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":n=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(o,i){return s.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[v.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(o,i){s.load(r.LoaderUtils.resolveURL(t.uri,n.path),o,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,o=t.byteOffset||0;return s.slice(o,o+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const i=Ne[n.type],l=oe[n.componentType],c=n.normalized===!0,d=new l(n.count*i);return Promise.resolve(new r.BufferAttribute(d,i,c))}const o=[];return n.bufferView!==void 0?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),n.sparse!==void 0&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then(function(i){const l=i[0],c=Ne[n.type],d=oe[n.componentType],p=d.BYTES_PER_ELEMENT,u=p*c,f=n.byteOffset||0,y=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,w=n.normalized===!0;let g,b;if(y&&y!==u){const m=Math.floor(f/y),_="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count;let M=t.cache.get(_);M||(g=new d(l,m*y,n.count*y/p),M=new r.InterleavedBuffer(g,y/p),t.cache.add(_,M)),b=new r.InterleavedBufferAttribute(M,c,f%y/p,w)}else l===null?g=new d(n.count*c):g=new d(l,f,n.count*c),b=new r.BufferAttribute(g,c,w);if(n.sparse!==void 0){const m=Ne.SCALAR,_=oe[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,S=n.sparse.values.byteOffset||0,R=new _(i[1],M,n.sparse.count*m),x=new d(i[2],S,n.sparse.count*c);l!==null&&(b=new r.BufferAttribute(b.array.slice(),b.itemSize,b.normalized)),b.normalized=!1;for(let L=0,K=R.length;L<K;L++){const z=R[L];if(b.setX(z,x[L*c]),c>=2&&b.setY(z,x[L*c+1]),c>=3&&b.setZ(z,x[L*c+2]),c>=4&&b.setW(z,x[L*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}b.normalized=w}return b})}loadTexture(e){const t=this.json,s=this.options,o=t.textures[e].source,i=t.images[o];let l=this.textureLoader;if(i.uri){const c=s.manager.getHandler(i.uri);c!==null&&(l=c)}return this.loadTextureImage(e,o,l)}loadTextureImage(e,t,s){const n=this,o=this.json,i=o.textures[e],l=o.images[t],c=(l.uri||l.bufferView)+":"+i.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,s).then(function(p){p.flipY=!1,p.name=i.name||l.name||"",p.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(p.name=l.uri);const f=(o.samplers||{})[i.sampler]||{};return p.magFilter=st[f.magFilter]||r.LinearFilter,p.minFilter=st[f.minFilter]||r.LinearMipmapLinearFilter,p.wrapS=ot[f.wrapS]||r.RepeatWrapping,p.wrapT=ot[f.wrapT]||r.RepeatWrapping,p.generateMipmaps=!p.isCompressedTexture&&p.minFilter!==r.NearestFilter&&p.minFilter!==r.LinearFilter,n.associations.set(p,{textures:e}),p}).catch(function(){return null});return this.textureCache[c]=d,d}loadImageSource(e,t){const s=this,n=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const i=n.images[e],l=self.URL||self.webkitURL;let c=i.uri||"",d=!1;if(i.bufferView!==void 0)c=s.getDependency("bufferView",i.bufferView).then(function(u){d=!0;const f=new Blob([u],{type:i.mimeType});return c=l.createObjectURL(f),c});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(c).then(function(u){return new Promise(function(f,y){let w=f;t.isImageBitmapLoader===!0&&(w=function(g){const b=new r.Texture(g);b.needsUpdate=!0,f(b)}),t.load(r.LoaderUtils.resolveURL(u,o.path),w,void 0,y)})}).then(function(u){return d===!0&&l.revokeObjectURL(c),Y(u,i),u.userData.mimeType=i.mimeType||es(i.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=p,p}assignTexture(e,t,s,n){const o=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),o.extensions[v.KHR_TEXTURE_TRANSFORM]){const l=s.extensions!==void 0?s.extensions[v.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const c=o.associations.get(i);i=o.extensions[v.KHR_TEXTURE_TRANSFORM].extendTexture(i,l),o.associations.set(i,c)}}return n!==void 0&&(i.colorSpace=n),e[t]=i,i})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,i=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+s.uuid;let c=this.cache.get(l);c||(c=new r.PointsMaterial,r.Material.prototype.copy.call(c,s),c.color.copy(s.color),c.map=s.map,c.sizeAttenuation=!1,this.cache.add(l,c)),s=c}else if(e.isLine){const l="LineBasicMaterial:"+s.uuid;let c=this.cache.get(l);c||(c=new r.LineBasicMaterial,r.Material.prototype.copy.call(c,s),c.color.copy(s.color),c.map=s.map,this.cache.add(l,c)),s=c}if(n||o||i){let l="ClonedMaterial:"+s.uuid+":";n&&(l+="derivative-tangents:"),o&&(l+="vertex-colors:"),i&&(l+="flat-shading:");let c=this.cache.get(l);c||(c=s.clone(),o&&(c.vertexColors=!0),i&&(c.flatShading=!0),n&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(l,c),this.associations.set(c,this.associations.get(s))),s=c}e.material=s}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,o=s.materials[e];let i;const l={},c=o.extensions||{},d=[];if(c[v.KHR_MATERIALS_UNLIT]){const u=n[v.KHR_MATERIALS_UNLIT];i=u.getMaterialType(),d.push(u.extendParams(l,o,t))}else{const u=o.pbrMetallicRoughness||{};if(l.color=new r.Color(1,1,1),l.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;l.color.setRGB(f[0],f[1],f[2],r.LinearSRGBColorSpace),l.opacity=f[3]}u.baseColorTexture!==void 0&&d.push(t.assignTexture(l,"map",u.baseColorTexture,r.SRGBColorSpace)),l.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,l.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(l,"metalnessMap",u.metallicRoughnessTexture)),d.push(t.assignTexture(l,"roughnessMap",u.metallicRoughnessTexture))),i=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,l)})))}o.doubleSided===!0&&(l.side=r.DoubleSide);const p=o.alphaMode||Ce.OPAQUE;if(p===Ce.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,p===Ce.MASK&&(l.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&i!==r.MeshBasicMaterial&&(d.push(t.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new r.Vector2(1,1),o.normalTexture.scale!==void 0)){const u=o.normalTexture.scale;l.normalScale.set(u,u)}if(o.occlusionTexture!==void 0&&i!==r.MeshBasicMaterial&&(d.push(t.assignTexture(l,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&i!==r.MeshBasicMaterial){const u=o.emissiveFactor;l.emissive=new r.Color().setRGB(u[0],u[1],u[2],r.LinearSRGBColorSpace)}return o.emissiveTexture!==void 0&&i!==r.MeshBasicMaterial&&d.push(t.assignTexture(l,"emissiveMap",o.emissiveTexture,r.SRGBColorSpace)),Promise.all(d).then(function(){const u=new i(l);return o.name&&(u.name=o.name),Y(u,o),t.associations.set(u,{materials:e}),o.extensions&&J(n,u,o),u})}createUniqueName(e){const t=r.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function o(l){return s[v.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(c){return it(c,l,t)})}const i=[];for(let l=0,c=e.length;l<c;l++){const d=e[l],p=Jn(d),u=n[p];if(u)i.push(u.promise);else{let f;d.extensions&&d.extensions[v.KHR_DRACO_MESH_COMPRESSION]?f=o(d):f=it(new r.BufferGeometry,d,t),n[p]={primitive:d,promise:f},i.push(f)}}return Promise.all(i)}loadMesh(e){const t=this,s=this.json,n=this.extensions,o=s.meshes[e],i=o.primitives,l=[];for(let c=0,d=i.length;c<d;c++){const p=i[c].material===void 0?qn(this.cache):this.getDependency("material",i[c].material);l.push(p)}return l.push(t.loadGeometries(i)),Promise.all(l).then(function(c){const d=c.slice(0,c.length-1),p=c[c.length-1],u=[];for(let y=0,w=p.length;y<w;y++){const g=p[y],b=i[y];let m;const _=d[y];if(b.mode===B.TRIANGLES||b.mode===B.TRIANGLE_STRIP||b.mode===B.TRIANGLE_FAN||b.mode===void 0)m=o.isSkinnedMesh===!0?new r.SkinnedMesh(g,_):new r.Mesh(g,_),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),b.mode===B.TRIANGLE_STRIP?m.geometry=et(m.geometry,r.TriangleStripDrawMode):b.mode===B.TRIANGLE_FAN&&(m.geometry=et(m.geometry,r.TriangleFanDrawMode));else if(b.mode===B.LINES)m=new r.LineSegments(g,_);else if(b.mode===B.LINE_STRIP)m=new r.Line(g,_);else if(b.mode===B.LINE_LOOP)m=new r.LineLoop(g,_);else if(b.mode===B.POINTS)m=new r.Points(g,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);Object.keys(m.geometry.morphAttributes).length>0&&$n(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),Y(m,o),b.extensions&&J(n,m,b),t.assignFinalMaterial(m),u.push(m)}for(let y=0,w=u.length;y<w;y++)t.associations.set(u[y],{meshes:e,primitives:y});if(u.length===1)return o.extensions&&J(n,u[0],o),u[0];const f=new r.Group;o.extensions&&J(n,f,o),t.associations.set(f,{meshes:e});for(let y=0,w=u.length;y<w;y++)f.add(u[y]);return f})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),Y(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,o=t.joints.length;n<o;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const o=n.pop(),i=n,l=[],c=[];for(let d=0,p=i.length;d<p;d++){const u=i[d];if(u){l.push(u);const f=new r.Matrix4;o!==null&&f.fromArray(o.array,d*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new r.Skeleton(l,c)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],o=n.name?n.name:"animation_"+e,i=[],l=[],c=[],d=[],p=[];for(let u=0,f=n.channels.length;u<f;u++){const y=n.channels[u],w=n.samplers[y.sampler],g=y.target,b=g.node,m=n.parameters!==void 0?n.parameters[w.input]:w.input,_=n.parameters!==void 0?n.parameters[w.output]:w.output;g.node!==void 0&&(i.push(this.getDependency("node",b)),l.push(this.getDependency("accessor",m)),c.push(this.getDependency("accessor",_)),d.push(w),p.push(g))}return Promise.all([Promise.all(i),Promise.all(l),Promise.all(c),Promise.all(d),Promise.all(p)]).then(function(u){const f=u[0],y=u[1],w=u[2],g=u[3],b=u[4],m=[];for(let M=0,S=f.length;M<S;M++){const R=f[M],x=y[M],L=w[M],K=g[M],z=b[M];if(R===void 0)continue;R.updateMatrix&&R.updateMatrix();const W=s._createAnimationTracks(R,x,L,K,z);if(W)for(let G=0;G<W.length;G++)m.push(W[G])}const _=new r.AnimationClip(o,void 0,m);return Y(_,n),_})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(o){const i=s._getNodeRef(s.meshCache,n.mesh,o);return n.weights!==void 0&&i.traverse(function(l){if(l.isMesh)for(let c=0,d=n.weights.length;c<d;c++)l.morphTargetInfluences[c]=n.weights[c]}),i})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],o=s._loadNodeShallow(e),i=[],l=n.children||[];for(let d=0,p=l.length;d<p;d++)i.push(s.getDependency("node",l[d]));const c=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([o,Promise.all(i),c]).then(function(d){const p=d[0],u=d[1],f=d[2];f!==null&&p.traverse(function(y){y.isSkinnedMesh&&y.bind(f,ts)});for(let y=0,w=u.length;y<w;y++)p.add(u[y]);if(p.userData.pivot!==void 0&&u.length>0){const y=p.userData.pivot,w=u[0];p.pivot=new r.Vector3().fromArray(y),p.position.x-=y[0],p.position.y-=y[1],p.position.z-=y[2],w.position.set(0,0,0),delete p.userData.pivot}return p})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],i=o.name?n.createUniqueName(o.name):"",l=[],c=n._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return c&&l.push(c),o.camera!==void 0&&l.push(n.getDependency("camera",o.camera).then(function(d){return n._getNodeRef(n.cameraCache,o.camera,d)})),n._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){l.push(d)}),this.nodeCache[e]=Promise.all(l).then(function(d){let p;if(o.isBone===!0?p=new r.Bone:d.length>1?p=new r.Group:d.length===1?p=d[0]:p=new r.Object3D,p!==d[0])for(let u=0,f=d.length;u<f;u++)p.add(d[u]);if(o.name&&(p.userData.name=o.name,p.name=i),Y(p,o),o.extensions&&J(s,p,o),o.matrix!==void 0){const u=new r.Matrix4;u.fromArray(o.matrix),p.applyMatrix4(u)}else o.translation!==void 0&&p.position.fromArray(o.translation),o.rotation!==void 0&&p.quaternion.fromArray(o.rotation),o.scale!==void 0&&p.scale.fromArray(o.scale);if(!n.associations.has(p))n.associations.set(p,{});else if(o.mesh!==void 0&&n.meshCache.refs[o.mesh]>1){const u=n.associations.get(p);n.associations.set(p,{...u})}return n.associations.get(p).nodes=e,p}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,o=new r.Group;s.name&&(o.name=n.createUniqueName(s.name)),Y(o,s),s.extensions&&J(t,o,s);const i=s.nodes||[],l=[];for(let c=0,d=i.length;c<d;c++)l.push(n.getDependency("node",i[c]));return Promise.all(l).then(function(c){for(let p=0,u=c.length;p<u;p++){const f=c[p];f.parent!==null?o.add(Tn(f)):o.add(f)}const d=p=>{const u=new Map;for(const[f,y]of n.associations)(f instanceof r.Material||f instanceof r.Texture)&&u.set(f,y);return p.traverse(f=>{const y=n.associations.get(f);y!=null&&u.set(f,y)}),u};return n.associations=d(o),o})}_createAnimationTracks(e,t,s,n,o){const i=[],l=e.name?e.name:e.uuid,c=[];function d(y){y.morphTargetInfluences&&c.push(y.name?y.name:y.uuid)}q[o.path]===q.weights?(d(e),e.isGroup&&e.children.forEach(d)):c.push(l);let p;switch(q[o.path]){case q.weights:p=r.NumberKeyframeTrack;break;case q.rotation:p=r.QuaternionKeyframeTrack;break;case q.translation:case q.scale:p=r.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:p=r.NumberKeyframeTrack;break;case 2:case 3:default:p=r.VectorKeyframeTrack;break}break}const u=n.interpolation!==void 0?Qn[n.interpolation]:r.InterpolateLinear,f=this._getArrayFromAccessor(s);for(let y=0,w=c.length;y<w;y++){const g=new p(c[y]+"."+q[o.path],t.array,f,u);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),i.push(g)}return i}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=ke(t.constructor),n=new Float32Array(t.length);for(let o=0,i=t.length;o<i;o++)n[o]=t[o]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof r.QuaternionKeyframeTrack?Zn:bt;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ss(a,e,t){const s=e.attributes,n=new r.Box3;if(s.POSITION!==void 0){const l=t.json.accessors[s.POSITION],c=l.min,d=l.max;if(c!==void 0&&d!==void 0){if(n.set(new r.Vector3(c[0],c[1],c[2]),new r.Vector3(d[0],d[1],d[2])),l.normalized){const p=ke(oe[l.componentType]);n.min.multiplyScalar(p),n.max.multiplyScalar(p)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const l=new r.Vector3,c=new r.Vector3;for(let d=0,p=o.length;d<p;d++){const u=o[d];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],y=f.min,w=f.max;if(y!==void 0&&w!==void 0){if(c.setX(Math.max(Math.abs(y[0]),Math.abs(w[0]))),c.setY(Math.max(Math.abs(y[1]),Math.abs(w[1]))),c.setZ(Math.max(Math.abs(y[2]),Math.abs(w[2]))),f.normalized){const g=ke(oe[f.componentType]);c.multiplyScalar(g)}l.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(l)}a.boundingBox=n;const i=new r.Sphere;n.getCenter(i.center),i.radius=n.min.distanceTo(n.max)/2,a.boundingSphere=i}function it(a,e,t){const s=e.attributes,n=[];function o(i,l){return t.getDependency("accessor",i).then(function(c){a.setAttribute(l,c)})}for(const i in s){const l=De[i]||i.toLowerCase();l in a.attributes||n.push(o(s[i],l))}if(e.indices!==void 0&&!a.index){const i=t.getDependency("accessor",e.indices).then(function(l){a.setIndex(l)});n.push(i)}return r.ColorManagement.workingColorSpace!==r.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${r.ColorManagement.workingColorSpace}" not supported.`),Y(a,e),ss(a,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Wn(a,e.targets,t):a})}function _t(){const a=new D.BoxGeometry(1,1,1),e=new D.MeshStandardMaterial({color:43775}),t=new D.Mesh(a,e);return t.position.y=.5,t.userData.isMovable=!0,t.name="正方体",xe(t,!0),t}function wt(){const a=new D.SphereGeometry(.6,32,32),e=new D.MeshStandardMaterial({color:16746496}),t=new D.Mesh(a,e);return t.position.y=.6,t.userData.isMovable=!0,t.name="球体",xe(t,!0),t}function Et(a){return new Promise((e,t)=>{var i;const s=(i=a.name.split(".").pop())==null?void 0:i.toLowerCase(),n=URL.createObjectURL(a);let o;if(s==="obj")o=new Mn;else if(s==="gltf"||s==="glb")o=new xn;else{t(new Error("不支持的文件格式,请使用 .obj, .gltf, .glb"));return}o.load(n,l=>{const c=s==="gltf"||s==="glb"?l.scene:l;c.traverse(u=>{var f;u.userData.isMovable=!0,u.name||(u.name=u.type),u.type==="Mesh"&&(u.frustumCulled=!0,(f=u.geometry)==null||f.computeVertexNormals())});const p=new D.Box3().setFromObject(c).getCenter(new D.Vector3);c.position.sub(p),xe(c,!0),e(c)},void 0,l=>t(l))})}function Mt(a){switch(a){case"box":_t();break;case"sphere":wt();break}}const os={key:1,class:"toggle-placeholder"},is={class:"tree-icon"},rs={class:"tree-name"},as={key:0,class:"tree-children"},ls=h.defineComponent({__name:"TreeItem",props:{node:{},selectedObject:{},version:{}},emits:["select","delete"],setup(a,{emit:e}){const t=a,s=e,n=h.ref(null),{expandedSet:o,toggleExpand:i}=h.inject("treeExpand"),l=h.computed(()=>o.value.has(t.node.uuid)),c=h.computed(()=>(t.version,t.node.children.some(g=>g.userData.isMovable===!0))),d=h.computed(()=>(t.version,t.node.children.filter(g=>g.userData.isMovable===!0))),p=h.computed(()=>{var g;return((g=t.selectedObject)==null?void 0:g.uuid)===t.node.uuid});h.watchEffect(()=>{p.value&&n.value&&n.value.scrollIntoView({block:"nearest",behavior:"smooth"})},{flush:"post"});const u=g=>{g.stopPropagation(),s("select",t.node)},f=g=>{g.stopPropagation(),s("delete",t.node)},y=g=>g.type==="Mesh"||g.type==="Sprite"?"🟦":g.type==="Light"?"💡":"📦",w=g=>g.name||`${g.type} (${g.id})`;return(g,b)=>{const m=h.resolveComponent("TreeItem",!0);return h.openBlock(),h.createElementBlock("div",{class:"tree-node",ref_key:"nodeRef",ref:n},[h.createElementVNode("div",{class:h.normalizeClass(["tree-item",{selected:p.value}]),onClick:u},[c.value?(h.openBlock(),h.createElementBlock("span",{key:0,class:"toggle-icon",onClick:b[0]||(b[0]=h.withModifiers(_=>h.unref(i)(a.node.uuid),["stop"]))},h.toDisplayString(l.value?"▼":"▶"),1)):(h.openBlock(),h.createElementBlock("span",os)),h.createElementVNode("span",is,h.toDisplayString(y(a.node)),1),h.createElementVNode("span",rs,h.toDisplayString(w(a.node)),1),h.createElementVNode("button",{class:"tree-delete",onClick:h.withModifiers(f,["stop"])},"×")],2),l.value&&c.value?(h.openBlock(),h.createElementBlock("div",as,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(d.value,_=>(h.openBlock(),h.createBlock(m,{key:_.uuid,node:_,"selected-object":a.selectedObject,version:a.version,onSelect:b[1]||(b[1]=M=>s("select",M)),onDelete:b[2]||(b[2]=M=>s("delete",M))},null,8,["node","selected-object","version"]))),128))])):h.createCommentVNode("",!0)],512)}}}),ue=(a,e)=>{const t=a.__vccOpts||a;for(const[s,n]of e)t[s]=n;return t},Tt=ue(ls,[["__scopeId","data-v-5ad9c842"]]);function xt(a){const e=h.ref(new Set),t=n=>{const o=new Set(e.value);o.has(n)?o.delete(n):o.add(n),e.value=o},s=n=>{if(!n)return;const o=new Set(e.value);let i=n.parent;for(;i&&i.type!=="Scene";)o.add(i.uuid),i=i.parent;e.value=o};return h.watch(a,n=>{n&&s(n)},{immediate:!0}),{expandedSet:e,toggleExpand:t}}const cs={key:0,class:"property-panel"},hs={class:"property-group tree-group"},us={class:"tree-container"},ds={key:0,class:"tree-empty"},ps={key:0,class:"tabs"},ms={key:1,class:"tab-content"},fs={class:"property-group"},gs={class:"row"},ys={class:"property-group"},bs={class:"row"},_s={class:"property-group"},ws={class:"row"},Es={key:0,class:"property-group material-group"},Ms={class:"slider-row"},Ts={class:"slider-value"},xs={class:"slider-row"},Ss={class:"slider-value"},vs={class:"slider-row"},Rs={class:"slider-value"},As={key:0,class:"material-hint"},Ps={key:1,class:"property-panel empty"},Ls=h.defineComponent({__name:"PropertyPanel",props:{transform:{},treeData:{},selectedObject:{}},emits:["propertyChange","treeSelect","treeDelete"],setup(a,{emit:e}){const t=a,s=e,n=()=>s("propertyChange"),o=h.ref("transform"),i=h.ref(0),l=h.toRef(t,"selectedObject"),{expandedSet:c,toggleExpand:d}=xt(l);h.provide("treeExpand",{expandedSet:c,toggleExpand:d});const p=b=>{i.value++,s("treeDelete",b)},u=h.reactive({metalness:0,roughness:.5,opacity:1}),f=h.ref(!1);function y(b){let m=null;return b.traverse(_=>{if(_.type==="Mesh"&&!m){const M=_,S=Array.isArray(M.material)?M.material:[M.material];for(const R of S)if(R&&(R.type==="MeshStandardMaterial"||R.type==="MeshPhongMaterial")){const x=R;m={metalness:x.metalness??0,roughness:x.roughness??.5,opacity:R.opacity??1};break}}}),m}function w(b,m){let _=!1;return b.traverse(M=>{if(M.type==="Mesh"){const S=M,R=Array.isArray(S.material)?S.material:[S.material];for(const x of R)x&&(x.type==="MeshStandardMaterial"||x.type==="MeshPhongMaterial")&&(m.metalness!==void 0&&(x.metalness=m.metalness),m.roughness!==void 0&&(x.roughness=m.roughness),m.opacity!==void 0&&(x.opacity=m.opacity,x.transparent=m.opacity<1),x.needsUpdate=!0,_=!0)}}),_}function g(){if(t.selectedObject){const b=w(t.selectedObject,{metalness:u.metalness,roughness:u.roughness,opacity:u.opacity});f.value=b}}return h.watch(()=>t.selectedObject,b=>{if(b){const m=y(b);m?(u.metalness=m.metalness,u.roughness=m.roughness,u.opacity=m.opacity,f.value=!0):(u.metalness=0,u.roughness=.5,u.opacity=1,f.value=!1)}else u.metalness=0,u.roughness=.5,u.opacity=1,f.value=!1},{immediate:!0}),(b,m)=>a.transform?(h.openBlock(),h.createElementBlock("div",cs,[m[32]||(m[32]=h.createElementVNode("h3",null,"属性面板",-1)),h.createElementVNode("div",hs,[m[15]||(m[15]=h.createElementVNode("label",null,"场景物体",-1)),h.createElementVNode("div",us,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(a.treeData,_=>(h.openBlock(),h.createBlock(Tt,{key:_.uuid,node:_,"selected-object":a.selectedObject,version:i.value,onSelect:m[0]||(m[0]=M=>s("treeSelect",M)),onDelete:p},null,8,["node","selected-object","version"]))),128)),a.treeData.length===0?(h.openBlock(),h.createElementBlock("div",ds,"暂无物体")):h.createCommentVNode("",!0)])]),m[33]||(m[33]=h.createElementVNode("div",{class:"property-group"},[h.createElementVNode("label",null,"全局属性"),h.createElementVNode("div",{class:"row"})],-1)),a.selectedObject?(h.openBlock(),h.createElementBlock("div",ps,[h.createElementVNode("button",{class:h.normalizeClass(["tab-btn",{active:o.value==="transform"}]),onClick:m[1]||(m[1]=_=>o.value="transform")}," 🔄 变换 ",2),h.createElementVNode("button",{class:h.normalizeClass(["tab-btn",{active:o.value==="info"}]),onClick:m[2]||(m[2]=_=>o.value="info")}," ℹ️ 信息 ",2)])):h.createCommentVNode("",!0),a.selectedObject?(h.openBlock(),h.createElementBlock("div",ms,[h.withDirectives(h.createElementVNode("div",null,[h.createElementVNode("div",fs,[m[19]||(m[19]=h.createElementVNode("label",null,"位置",-1)),h.createElementVNode("div",gs,[m[16]||(m[16]=h.createElementVNode("span",null,"X:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[3]||(m[3]=_=>a.transform.position.x=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.position.x,void 0,{number:!0}]]),m[17]||(m[17]=h.createElementVNode("span",null,"Y:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[4]||(m[4]=_=>a.transform.position.y=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.position.y,void 0,{number:!0}]]),m[18]||(m[18]=h.createElementVNode("span",null,"Z:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[5]||(m[5]=_=>a.transform.position.z=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.position.z,void 0,{number:!0}]])])]),h.createElementVNode("div",ys,[m[23]||(m[23]=h.createElementVNode("label",null,"旋转 (弧度)",-1)),h.createElementVNode("div",bs,[m[20]||(m[20]=h.createElementVNode("span",null,"X:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[6]||(m[6]=_=>a.transform.rotation.x=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.rotation.x,void 0,{number:!0}]]),m[21]||(m[21]=h.createElementVNode("span",null,"Y:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[7]||(m[7]=_=>a.transform.rotation.y=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.rotation.y,void 0,{number:!0}]]),m[22]||(m[22]=h.createElementVNode("span",null,"Z:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[8]||(m[8]=_=>a.transform.rotation.z=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.rotation.z,void 0,{number:!0}]])])]),h.createElementVNode("div",_s,[m[27]||(m[27]=h.createElementVNode("label",null,"缩放",-1)),h.createElementVNode("div",ws,[m[24]||(m[24]=h.createElementVNode("span",null,"X:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[9]||(m[9]=_=>a.transform.scale.x=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.scale.x,void 0,{number:!0}]]),m[25]||(m[25]=h.createElementVNode("span",null,"Y:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[10]||(m[10]=_=>a.transform.scale.y=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.scale.y,void 0,{number:!0}]]),m[26]||(m[26]=h.createElementVNode("span",null,"Z:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[11]||(m[11]=_=>a.transform.scale.z=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.scale.z,void 0,{number:!0}]])])]),a.selectedObject?(h.openBlock(),h.createElementBlock("div",Es,[m[31]||(m[31]=h.createElementVNode("label",null,"材质",-1)),h.createElementVNode("div",Ms,[m[28]||(m[28]=h.createElementVNode("span",{class:"slider-label"},"金属度",-1)),h.withDirectives(h.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01","onUpdate:modelValue":m[12]||(m[12]=_=>u.metalness=_),onInput:g},null,544),[[h.vModelText,u.metalness,void 0,{number:!0}]]),h.createElementVNode("span",Ts,h.toDisplayString(u.metalness.toFixed(2)),1)]),h.createElementVNode("div",xs,[m[29]||(m[29]=h.createElementVNode("span",{class:"slider-label"},"粗糙度",-1)),h.withDirectives(h.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01","onUpdate:modelValue":m[13]||(m[13]=_=>u.roughness=_),onInput:g},null,544),[[h.vModelText,u.roughness,void 0,{number:!0}]]),h.createElementVNode("span",Ss,h.toDisplayString(u.roughness.toFixed(2)),1)]),h.createElementVNode("div",vs,[m[30]||(m[30]=h.createElementVNode("span",{class:"slider-label"},"透明度",-1)),h.withDirectives(h.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01","onUpdate:modelValue":m[14]||(m[14]=_=>u.opacity=_),onInput:g},null,544),[[h.vModelText,u.opacity,void 0,{number:!0}]]),h.createElementVNode("span",Rs,h.toDisplayString(u.opacity.toFixed(2)),1)]),f.value?h.createCommentVNode("",!0):(h.openBlock(),h.createElementBlock("div",As," ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))])):h.createCommentVNode("",!0)],512),[[h.vShow,o.value==="transform"]])])):h.createCommentVNode("",!0)])):(h.openBlock(),h.createElementBlock("div",Ps,[...m[34]||(m[34]=[h.createElementVNode("p",null,"未选中任何模型",-1)])]))}}),St=ue(Ls,[["__scopeId","data-v-d75c643f"]]),Ns={class:"top-bar"},Cs={class:"left-section"},Is={class:"dropdown-menu"},Os={class:"dropdown-menu sub-menu"},Ds={class:"dropdown-menu"},ks={class:"dropdown-menu sub-menu"},Vs={class:"dropdown-menu"},js={class:"dropdown-menu"},Fs={class:"dropdown-menu"},Hs=h.defineComponent({__name:"TopBar",emits:["addModel","importModel"],setup(a,{emit:e}){const t=h.ref(!1),s=h.ref(!1),n=h.ref(!1),o=h.ref(!1),i=h.ref(!1),l=h.ref(!1),c=h.ref(!1),d=e,p=h.ref(null),u=()=>{var G;return(G=p.value)==null?void 0:G.click()},f=G=>{const T=G.target;T.files&&T.files.length>0&&(d("importModel",T.files[0]),T.value="")},y=()=>console.log("新建项目"),w=()=>console.log("保存场景"),g=()=>console.log("导出模型"),b=()=>console.log("撤销"),m=()=>console.log("重做"),_=()=>console.log("复制物体"),M=()=>console.log("删除物体"),S=()=>console.log("重置相机"),R=()=>console.log("切换网格"),x=()=>console.log("打开帮助"),L=()=>console.log("关于编辑器"),K=()=>console.log("打开项目"),z=()=>console.log("打开模型"),W=()=>console.log("打开场景");return(G,T)=>(h.openBlock(),h.createElementBlock("div",Ns,[h.createElementVNode("div",Cs,[h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[2]||(T[2]=O=>t.value=!0),onMouseleave:T[3]||(T[3]=O=>t.value=!1)},[T[17]||(T[17]=h.createElementVNode("button",{class:"menu-btn"},"文件",-1)),h.withDirectives(h.createElementVNode("div",Is,[h.createElementVNode("div",{class:"menu-item",onClick:y},"新建"),h.createElementVNode("div",{class:"menu-item dropdown-wrapper sub-trigger",onMouseenter:T[0]||(T[0]=O=>l.value=!0),onMouseleave:T[1]||(T[1]=O=>l.value=!1)},[T[16]||(T[16]=h.createElementVNode("span",null,"打开",-1)),h.withDirectives(h.createElementVNode("div",Os,[h.createElementVNode("div",{class:"menu-item",onClick:K},"打开项目"),h.createElementVNode("div",{class:"menu-item",onClick:z},"打开模型"),h.createElementVNode("div",{class:"menu-item",onClick:W},"打开场景")],512),[[h.vShow,l.value]])],32),h.createElementVNode("div",{class:"menu-item",onClick:w},"保存"),h.createElementVNode("div",{class:"menu-item",onClick:g},"导出")],512),[[h.vShow,t.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[8]||(T[8]=O=>i.value=!0),onMouseleave:T[9]||(T[9]=O=>i.value=!1)},[T[19]||(T[19]=h.createElementVNode("button",{class:"menu-btn"},"添加",-1)),h.withDirectives(h.createElementVNode("div",Ds,[h.createElementVNode("div",{class:"menu-item",onClick:b},"组"),h.createElementVNode("div",{class:"menu-item dropdown-wrapper sub-trigger",onMouseenter:T[6]||(T[6]=O=>c.value=!0),onMouseleave:T[7]||(T[7]=O=>c.value=!1)},[T[18]||(T[18]=h.createElementVNode("span",null,"网格",-1)),h.withDirectives(h.createElementVNode("div",ks,[h.createElementVNode("div",{class:"menu-item",onClick:T[4]||(T[4]=O=>d("addModel","box"))}," 正方体 "),h.createElementVNode("div",{class:"menu-item",onClick:T[5]||(T[5]=O=>d("addModel","sphere"))}," 球体 "),h.createElementVNode("div",{class:"menu-item",onClick:u},"导入")],512),[[h.vShow,c.value]])],32),h.createElementVNode("div",{class:"menu-item",onClick:_},"光源"),h.createElementVNode("div",{class:"menu-item",onClick:M},"摄像机")],512),[[h.vShow,i.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[10]||(T[10]=O=>s.value=!0),onMouseleave:T[11]||(T[11]=O=>s.value=!1)},[T[20]||(T[20]=h.createElementVNode("button",{class:"menu-btn"},"编辑",-1)),h.withDirectives(h.createElementVNode("div",Vs,[h.createElementVNode("div",{class:"menu-item",onClick:b},"撤销"),h.createElementVNode("div",{class:"menu-item",onClick:m},"重做"),h.createElementVNode("div",{class:"menu-item",onClick:_},"复制"),h.createElementVNode("div",{class:"menu-item",onClick:M},"删除")],512),[[h.vShow,s.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[12]||(T[12]=O=>n.value=!0),onMouseleave:T[13]||(T[13]=O=>n.value=!1)},[T[21]||(T[21]=h.createElementVNode("button",{class:"menu-btn"},"视图",-1)),h.withDirectives(h.createElementVNode("div",js,[h.createElementVNode("div",{class:"menu-item",onClick:S},"重置相机"),h.createElementVNode("div",{class:"menu-item",onClick:R},"显示网格")],512),[[h.vShow,n.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[14]||(T[14]=O=>o.value=!0),onMouseleave:T[15]||(T[15]=O=>o.value=!1)},[T[22]||(T[22]=h.createElementVNode("button",{class:"menu-btn"},"帮助",-1)),h.withDirectives(h.createElementVNode("div",Fs,[h.createElementVNode("div",{class:"menu-item",onClick:x},"使用帮助"),h.createElementVNode("div",{class:"menu-item",onClick:L},"关于")],512),[[h.vShow,o.value]])],32)]),T[23]||(T[23]=h.createElementVNode("div",{class:"right-section"},[h.createElementVNode("span",{class:"app-title"},"3D 模型编辑器")],-1)),h.createElementVNode("input",{type:"file",ref_key:"fileInput",ref:p,accept:".obj,.gltf,.glb",style:{display:"none"},onChange:f},null,544)]))}}),vt=ue(Hs,[["__scopeId","data-v-6bb4762f"]]),Bs={class:"bottom-bar"},Gs=h.defineComponent({__name:"BottomBar",setup(a){return(e,t)=>(h.openBlock(),h.createElementBlock("div",Bs,[...t[0]||(t[0]=[h.createElementVNode("div",{class:"status-left"},[h.createElementVNode("span",null,"就绪")],-1),h.createElementVNode("div",{class:"status-right"},[h.createElementVNode("span",null,"顶点: 0 | 面: 0")],-1)])]))}}),Rt=ue(Gs,[["__scopeId","data-v-3427bb27"]]),Us={class:"app-layout"},zs=h.defineComponent({__name:"DrawingBoard",props:{mode:{default:"edit"},sceneData:{default:null}},setup(a){const e=a,t=h.ref(null),s=h.reactive({position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1}}),n=g=>{s.position.x=Number(g.position.x.toFixed(3)),s.position.y=Number(g.position.y.toFixed(3)),s.position.z=Number(g.position.z.toFixed(3)),s.rotation.x=Number(g.rotation.x.toFixed(3)),s.rotation.y=Number(g.rotation.y.toFixed(3)),s.rotation.z=Number(g.rotation.z.toFixed(3)),s.scale.x=Number(g.scale.x.toFixed(3)),s.scale.y=Number(g.scale.y.toFixed(3)),s.scale.z=Number(g.scale.z.toFixed(3))},o=g=>{g.position.set(s.position.x,s.position.y,s.position.z),g.rotation.set(s.rotation.x,s.rotation.y,s.rotation.z),g.scale.set(s.scale.x,s.scale.y,s.scale.z)};ut(g=>{t.value=g,g&&n(g)}),dt(g=>{n(g)});const i=()=>{t.value&&o(t.value)},l=g=>Mt(g),c=async g=>{try{await Et(g)}catch(b){console.error("导入失败:",b),alert("导入失败:"+b.message)}},d=h.shallowRef([]);pt(g=>{d.value=g});const p=()=>{const g=mt();g&&(d.value=g)},u=g=>Te(g),f=g=>ht(g.uuid),y=h.ref(null),w=()=>{y.value&&at(y.value,e.mode,e.sceneData),p()};return h.onMounted(w),(g,b)=>(h.openBlock(),h.createElementBlock("div",Us,[a.mode==="edit"?(h.openBlock(),h.createBlock(vt,{key:0,onAddModel:l,onImportModel:c})):h.createCommentVNode("",!0),h.createElementVNode("div",{class:h.normalizeClass(`editor-container editor-container-mode-${a.mode}`)},[h.createElementVNode("div",{class:h.normalizeClass(`canvas canvas-mode-${a.mode}`),ref_key:"containerRef",ref:y},null,2),a.mode==="edit"?(h.openBlock(),h.createBlock(St,{key:0,transform:s,"tree-data":d.value,"selected-object":t.value,onPropertyChange:i,onTreeSelect:u,onTreeDelete:f},null,8,["transform","tree-data","selected-object"])):h.createCommentVNode("",!0)],2),a.mode==="edit"?(h.openBlock(),h.createBlock(Rt,{key:1})):h.createCommentVNode("",!0)]))}}),Xs=ue(zs,[["__scopeId","data-v-54071644"]]);exports.BottomBar=Rt;exports.DrawingBoard=Xs;exports.PropertyPanel=St;exports.TopBar=vt;exports.TreeItem=Tt;exports.addBox=_t;exports.addModel=xe;exports.addModelByType=Mt;exports.addSphere=wt;exports.exportSceneToJSON=gn;exports.getCamera=mn;exports.getRenderer=fn;exports.getScene=pn;exports.getSceneObjects=mt;exports.importModelFromFile=Et;exports.initEditor=at;exports.loadSceneFromJSON=ft;exports.onSceneObjectsChangeCallback=pt;exports.removeModel=ct;exports.removeModelById=ht;exports.selectObject=Te;exports.setSelectedObjectCallback=ut;exports.setTransformChangeCallback=dt;exports.useTreeExpand=xt;
|
|
5
|
+
`);let n=[];for(let l=0,c=s.length;l<c;l++){const d=s[l].trimStart();if(d.length===0)continue;const p=d.charAt(0);if(p!=="#")if(p==="v"){const u=d.split(qe);switch(u[0]){case"v":t.vertices.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3])),u.length>=7?(we.setRGB(parseFloat(u[4]),parseFloat(u[5]),parseFloat(u[6]),r.SRGBColorSpace),t.colors.push(we.r,we.g,we.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(u[1]),parseFloat(u[2]),parseFloat(u[3]));break;case"vt":t.uvs.push(parseFloat(u[1]),parseFloat(u[2]));break}}else if(p==="f"){const f=d.slice(1).trim().split(qe),y=[];for(let g=0,b=f.length;g<b;g++){const m=f[g];if(m.length>0){const _=m.split("/");y.push(_)}}const w=y[0];for(let g=1,b=y.length-1;g<b;g++){const m=y[g],_=y[g+1];t.addFace(w[0],m[0],_[0],w[1],m[1],_[1],w[2],m[2],_[2])}}else if(p==="l"){const u=d.substring(1).trim().split(" ");let f=[];const y=[];if(d.indexOf("/")===-1)f=u;else for(let w=0,g=u.length;w<g;w++){const b=u[w].split("/");b[0]!==""&&f.push(b[0]),b[1]!==""&&y.push(b[1])}t.addLineGeometry(f,y)}else if(p==="p"){const f=d.slice(1).trim().split(" ");t.addPointGeometry(f)}else if((n=yn.exec(d))!==null){const u=(" "+n[0].slice(1).trim()).slice(1);t.startObject(u)}else if(_n.test(d))t.object.startMaterial(d.substring(7).trim(),t.materialLibraries);else if(bn.test(d))t.materialLibraries.push(d.substring(7).trim());else if(wn.test(d))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(p==="s"){if(n=d.split(" "),n.length>1){const f=n[1].trim().toLowerCase();t.object.smooth=f!=="0"&&f!=="off"}else t.object.smooth=!0;const u=t.object.currentMaterial();u&&(u.smooth=t.object.smooth)}else{if(d==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+d+'"')}}t.finalize();const o=new r.Group;if(o.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0)===!0)for(let l=0,c=t.objects.length;l<c;l++){const d=t.objects[l],p=d.geometry,u=d.materials,f=p.type==="Line",y=p.type==="Points";let w=!1;if(p.vertices.length===0)continue;const g=new r.BufferGeometry;g.setAttribute("position",new r.Float32BufferAttribute(p.vertices,3)),p.normals.length>0&&g.setAttribute("normal",new r.Float32BufferAttribute(p.normals,3)),p.colors.length>0&&(w=!0,g.setAttribute("color",new r.Float32BufferAttribute(p.colors,3))),p.hasUVIndices===!0&&g.setAttribute("uv",new r.Float32BufferAttribute(p.uvs,2));const b=[];for(let _=0,M=u.length;_<M;_++){const S=u[_],R=S.name+"_"+S.smooth+"_"+w;let x=t.materials[R];if(this.materials!==null){if(x=this.materials.create(S.name),f&&x&&!(x instanceof r.LineBasicMaterial)){const L=new r.LineBasicMaterial;r.Material.prototype.copy.call(L,x),L.color.copy(x.color),x=L}else if(y&&x&&!(x instanceof r.PointsMaterial)){const L=new r.PointsMaterial({size:10,sizeAttenuation:!1});r.Material.prototype.copy.call(L,x),L.color.copy(x.color),L.map=x.map,x=L}}x===void 0&&(f?x=new r.LineBasicMaterial:y?x=new r.PointsMaterial({size:1,sizeAttenuation:!1}):x=new r.MeshPhongMaterial,x.name=S.name,x.flatShading=!S.smooth,x.vertexColors=w,t.materials[R]=x),b.push(x)}let m;if(b.length>1){for(let _=0,M=u.length;_<M;_++){const S=u[_];g.addGroup(S.groupStart,S.groupCount,_)}f?m=new r.LineSegments(g,b):y?m=new r.Points(g,b):m=new r.Mesh(g,b)}else f?m=new r.LineSegments(g,b[0]):y?m=new r.Points(g,b[0]):m=new r.Mesh(g,b[0]);m.name=d.name,o.add(m)}else if(t.vertices.length>0){const l=new r.PointsMaterial({size:1,sizeAttenuation:!1}),c=new r.BufferGeometry;c.setAttribute("position",new r.Float32BufferAttribute(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(c.setAttribute("color",new r.Float32BufferAttribute(t.colors,3)),l.vertexColors=!0);const d=new r.Points(c,l);o.add(d)}return o}}function et(a,e){if(e===r.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(e===r.TriangleFanDrawMode||e===r.TriangleStripDrawMode){let t=a.getIndex();if(t===null){const i=[],l=a.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)i.push(c);a.setIndex(i),t=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}const s=t.count-2,n=[];if(e===r.TriangleFanDrawMode)for(let i=1;i<=s;i++)n.push(t.getX(0)),n.push(t.getX(i)),n.push(t.getX(i+1));else for(let i=0;i<s;i++)i%2===0?(n.push(t.getX(i)),n.push(t.getX(i+1)),n.push(t.getX(i+2))):(n.push(t.getX(i+2)),n.push(t.getX(i+1)),n.push(t.getX(i)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=a.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),a}function Tn(a){const e=new Map,t=new Map,s=a.clone();return gt(a,s,function(n,o){e.set(o,n),t.set(n,o)}),s.traverse(function(n){if(!n.isSkinnedMesh)return;const o=n,i=e.get(n),l=i.skeleton.bones;o.skeleton=i.skeleton.clone(),o.bindMatrix.copy(i.bindMatrix),o.skeleton.bones=l.map(function(c){return t.get(c)}),o.bind(o.skeleton,o.bindMatrix)}),s}function gt(a,e,t){t(a,e);for(let s=0;s<a.children.length;s++)gt(a.children[s],e.children[s],t)}class xn extends r.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Pn(t)}),this.register(function(t){return new Ln(t)}),this.register(function(t){return new Fn(t)}),this.register(function(t){return new Hn(t)}),this.register(function(t){return new Bn(t)}),this.register(function(t){return new Cn(t)}),this.register(function(t){return new In(t)}),this.register(function(t){return new On(t)}),this.register(function(t){return new Dn(t)}),this.register(function(t){return new An(t)}),this.register(function(t){return new kn(t)}),this.register(function(t){return new Nn(t)}),this.register(function(t){return new jn(t)}),this.register(function(t){return new Vn(t)}),this.register(function(t){return new vn(t)}),this.register(function(t){return new tt(t,v.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new tt(t,v.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Gn(t)})}load(e,t,s,n){const o=this;let i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){const d=r.LoaderUtils.extractUrlBase(e);i=r.LoaderUtils.resolveURL(d,this.path)}else i=r.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);const l=function(d){n?n(d):console.error(d),o.manager.itemError(e),o.manager.itemEnd(e)},c=new r.FileLoader(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(d){try{o.parse(d,i,function(p){t(p),o.manager.itemEnd(e)},l)}catch(p){l(p)}},s,l)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let o;const i={},l={},c=new TextDecoder;if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===yt){try{i[v.KHR_BINARY_GLTF]=new Un(e)}catch(u){n&&n(u);return}o=JSON.parse(i[v.KHR_BINARY_GLTF].content)}else o=JSON.parse(c.decode(e));else o=e;if(o.asset===void 0||o.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const d=new ns(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let p=0;p<this.pluginCallbacks.length;p++){const u=this.pluginCallbacks[p](d);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[u.name]=u,i[u.name]=!0}if(o.extensionsUsed)for(let p=0;p<o.extensionsUsed.length;++p){const u=o.extensionsUsed[p],f=o.extensionsRequired||[];switch(u){case v.KHR_MATERIALS_UNLIT:i[u]=new Rn;break;case v.KHR_DRACO_MESH_COMPRESSION:i[u]=new zn(o,this.dracoLoader);break;case v.KHR_TEXTURE_TRANSFORM:i[u]=new Xn;break;case v.KHR_MESH_QUANTIZATION:i[u]=new Yn;break;default:f.indexOf(u)>=0&&l[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}d.setExtensions(i),d.setPlugins(l),d.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,o){s.parse(e,t,n,o)})}}function Sn(){let a={};return{get:function(e){return a[e]},add:function(e,t){a[e]=t},remove:function(e){delete a[e]},removeAll:function(){a={}}}}function C(a,e,t){const s=a.json.materials[e];return s.extensions&&s.extensions[t]?s.extensions[t]:null}const v={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 vn{constructor(e){this.parser=e,this.name=v.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const o=t[s];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const o=t.json,c=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let d;const p=new r.Color(16777215);c.color!==void 0&&p.setRGB(c.color[0],c.color[1],c.color[2],r.LinearSRGBColorSpace);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":d=new r.DirectionalLight(p),d.target.position.set(0,0,-1),d.add(d.target);break;case"point":d=new r.PointLight(p),d.distance=u;break;case"spot":d=new r.SpotLight(p),d.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,d.angle=c.spot.outerConeAngle,d.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,d.target.position.set(0,0,-1),d.add(d.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return d.position.set(0,0,0),Y(d,c),c.intensity!==void 0&&(d.intensity=c.intensity),d.name=t.createUniqueName(c.name||"light_"+e),n=Promise.resolve(d),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,o=s.json.nodes[e],l=(o.extensions&&o.extensions[this.name]||{}).light;return l===void 0?null:this._loadLight(l).then(function(c){return s._getNodeRef(t.cache,l,c)})}}class Rn{constructor(){this.name=v.KHR_MATERIALS_UNLIT}getMaterialType(){return r.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new r.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const i=o.baseColorFactor;e.color.setRGB(i[0],i[1],i[2],r.LinearSRGBColorSpace),e.opacity=i[3]}o.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",o.baseColorTexture,r.SRGBColorSpace))}return Promise.all(n)}}class An{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);return s===null||s.emissiveStrength!==void 0&&(t.emissiveIntensity=s.emissiveStrength),Promise.resolve()}}class Pn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&n.push(this.parser.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&n.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(n.push(this.parser.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const o=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new r.Vector2(o,o)}return Promise.all(n)}}class Ln{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_DISPERSION}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);return s===null||(t.dispersion=s.dispersion!==void 0?s.dispersion:0),Promise.resolve()}}class Nn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&n.push(this.parser.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&n.push(this.parser.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(n)}}class Cn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_SHEEN}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];if(t.sheenColor=new r.Color(0,0,0),t.sheenRoughness=0,t.sheen=1,s.sheenColorFactor!==void 0){const o=s.sheenColorFactor;t.sheenColor.setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&n.push(this.parser.assignTexture(t,"sheenColorMap",s.sheenColorTexture,r.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&n.push(this.parser.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(n)}}class In{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&n.push(this.parser.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(n)}}class On{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_VOLUME}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&n.push(this.parser.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return t.attenuationColor=new r.Color().setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace),Promise.all(n)}}class Dn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_IOR}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);return s===null||(t.ior=s.ior!==void 0?s.ior:1.5,t.ior===0&&(t.ior=1e3)),Promise.resolve()}}class kn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_SPECULAR}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&n.push(this.parser.assignTexture(t,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return t.specularColor=new r.Color().setRGB(o[0],o[1],o[2],r.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&n.push(this.parser.assignTexture(t,"specularColorMap",s.specularColorTexture,r.SRGBColorSpace)),Promise.all(n)}}class Vn{constructor(e){this.parser=e,this.name=v.EXT_MATERIALS_BUMP}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return t.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&n.push(this.parser.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(n)}}class jn{constructor(e){this.parser=e,this.name=v.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return C(this.parser,e,this.name)!==null?r.MeshPhysicalMaterial:null}extendMaterialParams(e,t){const s=C(this.parser,e,this.name);if(s===null)return Promise.resolve();const n=[];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&n.push(this.parser.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(n)}}class Fn{constructor(e){this.parser=e,this.name=v.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const o=n.extensions[this.name],i=t.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,i)}}class Hn{constructor(e){this.parser=e,this.name=v.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,s=this.parser,n=s.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],l=n.images[i.source];let c=s.textureLoader;if(l.uri){const d=s.options.manager.getHandler(l.uri);d!==null&&(c=d)}return s.loadTextureImage(e,i.source,c)}}class Bn{constructor(e){this.parser=e,this.name=v.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,s=this.parser,n=s.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],l=n.images[i.source];let c=s.textureLoader;if(l.uri){const d=s.options.manager.getHandler(l.uri);d!==null&&(c=d)}return s.loadTextureImage(e,i.source,c)}}class tt{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],o=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(l){const c=n.byteOffset||0,d=n.byteLength||0,p=n.count,u=n.byteStride,f=new Uint8Array(l,c,d);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(p,u,f,n.mode,n.filter).then(function(y){return y.buffer}):i.ready.then(function(){const y=new ArrayBuffer(p*u);return i.decodeGltfBuffer(new Uint8Array(y),p,u,f,n.mode,n.filter),y})})}else return null}}class Gn{constructor(e){this.name=v.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const d of n.primitives)if(d.mode!==B.TRIANGLES&&d.mode!==B.TRIANGLE_STRIP&&d.mode!==B.TRIANGLE_FAN&&d.mode!==void 0)return null;const i=s.extensions[this.name].attributes,l=[],c={};for(const d in i)l.push(this.parser.getDependency("accessor",i[d]).then(p=>(c[d]=p,c[d])));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then(d=>{const p=d.pop(),u=p.isGroup?p.children:[p],f=d[0].count,y=[];for(const w of u){const g=new r.Matrix4,b=new r.Vector3,m=new r.Quaternion,_=new r.Vector3(1,1,1),M=new r.InstancedMesh(w.geometry,w.material,f);for(let S=0;S<f;S++)c.TRANSLATION&&b.fromBufferAttribute(c.TRANSLATION,S),c.ROTATION&&m.fromBufferAttribute(c.ROTATION,S),c.SCALE&&_.fromBufferAttribute(c.SCALE,S),M.setMatrixAt(S,g.compose(b,m,_));for(const S in c)if(S==="_COLOR_0"){const R=c[S];M.instanceColor=new r.InstancedBufferAttribute(R.array,R.itemSize,R.normalized)}else S!=="TRANSLATION"&&S!=="ROTATION"&&S!=="SCALE"&&w.geometry.setAttribute(S,c[S]);r.Object3D.prototype.copy.call(M,w),this.parser.assignFinalMaterial(M),y.push(M)}return p.isGroup?(p.clear(),p.add(...y),p):y[0]}))}}const yt="glTF",le=12,nt={JSON:1313821514,BIN:5130562};class Un{constructor(e){this.name=v.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,le),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==yt)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-le,o=new DataView(e,le);let i=0;for(;i<n;){const l=o.getUint32(i,!0);i+=4;const c=o.getUint32(i,!0);if(i+=4,c===nt.JSON){const d=new Uint8Array(e,le+i,l);this.content=s.decode(d)}else if(c===nt.BIN){const d=le+i;this.body=e.slice(d,d+l)}i+=l}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class zn{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=v.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,o=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,l={},c={},d={};for(const p in i){const u=De[p]||p.toLowerCase();l[u]=i[p]}for(const p in e.attributes){const u=De[p]||p.toLowerCase();if(i[p]!==void 0){const f=s.accessors[e.attributes[p]],y=oe[f.componentType];d[u]=y.name,c[u]=f.normalized===!0}}return t.getDependency("bufferView",o).then(function(p){return new Promise(function(u,f){n.decodeDracoFile(p,function(y){for(const w in y.attributes){const g=y.attributes[w],b=c[w];b!==void 0&&(g.normalized=b)}u(y)},l,d,r.LinearSRGBColorSpace,f)})})}}class Xn{constructor(){this.name=v.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class Yn{constructor(){this.name=v.KHR_MESH_QUANTIZATION}}class bt extends r.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,o=e*n*3+n;for(let i=0;i!==n;i++)t[i]=s[o+i];return t}interpolate_(e,t,s,n){const o=this.resultBuffer,i=this.sampleValues,l=this.valueSize,c=l*2,d=l*3,p=n-t,u=(s-t)/p,f=u*u,y=f*u,w=e*d,g=w-d,b=-2*y+3*f,m=y-f,_=1-b,M=m-f+u;for(let S=0;S!==l;S++){const R=i[g+S+l],x=i[g+S+c]*p,L=i[w+S+l],K=i[w+S]*p;o[S]=_*R+M*x+b*L+m*K}return o}}const Kn=new r.Quaternion;class Zn extends bt{interpolate_(e,t,s,n){const o=super.interpolate_(e,t,s,n);return Kn.fromArray(o).normalize().toArray(o),o}}const B={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},oe={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},st={9728:r.NearestFilter,9729:r.LinearFilter,9984:r.NearestMipmapNearestFilter,9985:r.LinearMipmapNearestFilter,9986:r.NearestMipmapLinearFilter,9987:r.LinearMipmapLinearFilter},ot={33071:r.ClampToEdgeWrapping,33648:r.MirroredRepeatWrapping,10497:r.RepeatWrapping},Ne={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},De={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"},q={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Qn={CUBICSPLINE:void 0,LINEAR:r.InterpolateLinear,STEP:r.InterpolateDiscrete},Ce={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function qn(a){return a.DefaultMaterial===void 0&&(a.DefaultMaterial=new r.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:r.FrontSide})),a.DefaultMaterial}function J(a,e,t){for(const s in t.extensions)a[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function Y(a,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(a.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Wn(a,e,t){let s=!1,n=!1,o=!1;for(let d=0,p=e.length;d<p;d++){const u=e[d];if(u.POSITION!==void 0&&(s=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(o=!0),s&&n&&o)break}if(!s&&!n&&!o)return Promise.resolve(a);const i=[],l=[],c=[];for(let d=0,p=e.length;d<p;d++){const u=e[d];if(s){const f=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):a.attributes.position;i.push(f)}if(n){const f=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):a.attributes.normal;l.push(f)}if(o){const f=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):a.attributes.color;c.push(f)}}return Promise.all([Promise.all(i),Promise.all(l),Promise.all(c)]).then(function(d){const p=d[0],u=d[1],f=d[2];return s&&(a.morphAttributes.position=p),n&&(a.morphAttributes.normal=u),o&&(a.morphAttributes.color=f),a.morphTargetsRelative=!0,a})}function $n(a,e){if(a.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)a.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(a.morphTargetInfluences.length===t.length){a.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)a.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Jn(a){let e;const t=a.extensions&&a.extensions[v.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Ie(t.attributes):e=a.indices+":"+Ie(a.attributes)+":"+a.mode,a.targets!==void 0)for(let s=0,n=a.targets.length;s<n;s++)e+=":"+Ie(a.targets[s]);return e}function Ie(a){let e="";const t=Object.keys(a).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+a[t[s]]+";";return e}function ke(a){switch(a){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 es(a){return a.search(/\.jpe?g($|\?)/i)>0||a.search(/^data\:image\/jpeg/)===0?"image/jpeg":a.search(/\.webp($|\?)/i)>0||a.search(/^data\:image\/webp/)===0?"image/webp":a.search(/\.ktx2($|\?)/i)>0||a.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const ts=new r.Matrix4;class ns{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Sn,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,o=!1,i=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const l=navigator.userAgent;s=/^((?!chrome|android).)*safari/i.test(l)===!0;const c=l.match(/Version\/(\d+)/);n=s&&c?parseInt(c[1],10):-1,o=l.indexOf("Firefox")>-1,i=o?l.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||s&&n<17||o&&i<98?this.textureLoader=new r.TextureLoader(this.options.manager):this.textureLoader=new r.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new r.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,o=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 l={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:s,userData:{}};return J(o,l,n),Y(l,n),Promise.all(s._invokeAll(function(c){return c.afterRoot&&c.afterRoot(l)})).then(function(){for(const c of l.scenes)c.updateMatrixWorld();e(l)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,o=t.length;n<o;n++){const i=t[n].joints;for(let l=0,c=i.length;l<c;l++)e[i[l]].isBone=!0}for(let n=0,o=e.length;n<o;n++){const i=e[n];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(s[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),o=(i,l)=>{const c=this.associations.get(i);c!=null&&this.associations.set(l,c);for(const[d,p]of i.children.entries())o(p,l.children[d])};return o(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const o=e(t[n]);o&&s.push(o)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":n=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(o,i){return s.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[v.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(o,i){s.load(r.LoaderUtils.resolveURL(t.uri,n.path),o,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,o=t.byteOffset||0;return s.slice(o,o+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const i=Ne[n.type],l=oe[n.componentType],c=n.normalized===!0,d=new l(n.count*i);return Promise.resolve(new r.BufferAttribute(d,i,c))}const o=[];return n.bufferView!==void 0?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),n.sparse!==void 0&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then(function(i){const l=i[0],c=Ne[n.type],d=oe[n.componentType],p=d.BYTES_PER_ELEMENT,u=p*c,f=n.byteOffset||0,y=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,w=n.normalized===!0;let g,b;if(y&&y!==u){const m=Math.floor(f/y),_="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count;let M=t.cache.get(_);M||(g=new d(l,m*y,n.count*y/p),M=new r.InterleavedBuffer(g,y/p),t.cache.add(_,M)),b=new r.InterleavedBufferAttribute(M,c,f%y/p,w)}else l===null?g=new d(n.count*c):g=new d(l,f,n.count*c),b=new r.BufferAttribute(g,c,w);if(n.sparse!==void 0){const m=Ne.SCALAR,_=oe[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,S=n.sparse.values.byteOffset||0,R=new _(i[1],M,n.sparse.count*m),x=new d(i[2],S,n.sparse.count*c);l!==null&&(b=new r.BufferAttribute(b.array.slice(),b.itemSize,b.normalized)),b.normalized=!1;for(let L=0,K=R.length;L<K;L++){const z=R[L];if(b.setX(z,x[L*c]),c>=2&&b.setY(z,x[L*c+1]),c>=3&&b.setZ(z,x[L*c+2]),c>=4&&b.setW(z,x[L*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}b.normalized=w}return b})}loadTexture(e){const t=this.json,s=this.options,o=t.textures[e].source,i=t.images[o];let l=this.textureLoader;if(i.uri){const c=s.manager.getHandler(i.uri);c!==null&&(l=c)}return this.loadTextureImage(e,o,l)}loadTextureImage(e,t,s){const n=this,o=this.json,i=o.textures[e],l=o.images[t],c=(l.uri||l.bufferView)+":"+i.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,s).then(function(p){p.flipY=!1,p.name=i.name||l.name||"",p.name===""&&typeof l.uri=="string"&&l.uri.startsWith("data:image/")===!1&&(p.name=l.uri);const f=(o.samplers||{})[i.sampler]||{};return p.magFilter=st[f.magFilter]||r.LinearFilter,p.minFilter=st[f.minFilter]||r.LinearMipmapLinearFilter,p.wrapS=ot[f.wrapS]||r.RepeatWrapping,p.wrapT=ot[f.wrapT]||r.RepeatWrapping,p.generateMipmaps=!p.isCompressedTexture&&p.minFilter!==r.NearestFilter&&p.minFilter!==r.LinearFilter,n.associations.set(p,{textures:e}),p}).catch(function(){return null});return this.textureCache[c]=d,d}loadImageSource(e,t){const s=this,n=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const i=n.images[e],l=self.URL||self.webkitURL;let c=i.uri||"",d=!1;if(i.bufferView!==void 0)c=s.getDependency("bufferView",i.bufferView).then(function(u){d=!0;const f=new Blob([u],{type:i.mimeType});return c=l.createObjectURL(f),c});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(c).then(function(u){return new Promise(function(f,y){let w=f;t.isImageBitmapLoader===!0&&(w=function(g){const b=new r.Texture(g);b.needsUpdate=!0,f(b)}),t.load(r.LoaderUtils.resolveURL(u,o.path),w,void 0,y)})}).then(function(u){return d===!0&&l.revokeObjectURL(c),Y(u,i),u.userData.mimeType=i.mimeType||es(i.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=p,p}assignTexture(e,t,s,n){const o=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),o.extensions[v.KHR_TEXTURE_TRANSFORM]){const l=s.extensions!==void 0?s.extensions[v.KHR_TEXTURE_TRANSFORM]:void 0;if(l){const c=o.associations.get(i);i=o.extensions[v.KHR_TEXTURE_TRANSFORM].extendTexture(i,l),o.associations.set(i,c)}}return n!==void 0&&(i.colorSpace=n),e[t]=i,i})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,i=t.attributes.normal===void 0;if(e.isPoints){const l="PointsMaterial:"+s.uuid;let c=this.cache.get(l);c||(c=new r.PointsMaterial,r.Material.prototype.copy.call(c,s),c.color.copy(s.color),c.map=s.map,c.sizeAttenuation=!1,this.cache.add(l,c)),s=c}else if(e.isLine){const l="LineBasicMaterial:"+s.uuid;let c=this.cache.get(l);c||(c=new r.LineBasicMaterial,r.Material.prototype.copy.call(c,s),c.color.copy(s.color),c.map=s.map,this.cache.add(l,c)),s=c}if(n||o||i){let l="ClonedMaterial:"+s.uuid+":";n&&(l+="derivative-tangents:"),o&&(l+="vertex-colors:"),i&&(l+="flat-shading:");let c=this.cache.get(l);c||(c=s.clone(),o&&(c.vertexColors=!0),i&&(c.flatShading=!0),n&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(l,c),this.associations.set(c,this.associations.get(s))),s=c}e.material=s}getMaterialType(){return r.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,o=s.materials[e];let i;const l={},c=o.extensions||{},d=[];if(c[v.KHR_MATERIALS_UNLIT]){const u=n[v.KHR_MATERIALS_UNLIT];i=u.getMaterialType(),d.push(u.extendParams(l,o,t))}else{const u=o.pbrMetallicRoughness||{};if(l.color=new r.Color(1,1,1),l.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;l.color.setRGB(f[0],f[1],f[2],r.LinearSRGBColorSpace),l.opacity=f[3]}u.baseColorTexture!==void 0&&d.push(t.assignTexture(l,"map",u.baseColorTexture,r.SRGBColorSpace)),l.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,l.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(d.push(t.assignTexture(l,"metalnessMap",u.metallicRoughnessTexture)),d.push(t.assignTexture(l,"roughnessMap",u.metallicRoughnessTexture))),i=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),d.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,l)})))}o.doubleSided===!0&&(l.side=r.DoubleSide);const p=o.alphaMode||Ce.OPAQUE;if(p===Ce.BLEND?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,p===Ce.MASK&&(l.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&i!==r.MeshBasicMaterial&&(d.push(t.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new r.Vector2(1,1),o.normalTexture.scale!==void 0)){const u=o.normalTexture.scale;l.normalScale.set(u,u)}if(o.occlusionTexture!==void 0&&i!==r.MeshBasicMaterial&&(d.push(t.assignTexture(l,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(l.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&i!==r.MeshBasicMaterial){const u=o.emissiveFactor;l.emissive=new r.Color().setRGB(u[0],u[1],u[2],r.LinearSRGBColorSpace)}return o.emissiveTexture!==void 0&&i!==r.MeshBasicMaterial&&d.push(t.assignTexture(l,"emissiveMap",o.emissiveTexture,r.SRGBColorSpace)),Promise.all(d).then(function(){const u=new i(l);return o.name&&(u.name=o.name),Y(u,o),t.associations.set(u,{materials:e}),o.extensions&&J(n,u,o),u})}createUniqueName(e){const t=r.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function o(l){return s[v.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(l,t).then(function(c){return it(c,l,t)})}const i=[];for(let l=0,c=e.length;l<c;l++){const d=e[l],p=Jn(d),u=n[p];if(u)i.push(u.promise);else{let f;d.extensions&&d.extensions[v.KHR_DRACO_MESH_COMPRESSION]?f=o(d):f=it(new r.BufferGeometry,d,t),n[p]={primitive:d,promise:f},i.push(f)}}return Promise.all(i)}loadMesh(e){const t=this,s=this.json,n=this.extensions,o=s.meshes[e],i=o.primitives,l=[];for(let c=0,d=i.length;c<d;c++){const p=i[c].material===void 0?qn(this.cache):this.getDependency("material",i[c].material);l.push(p)}return l.push(t.loadGeometries(i)),Promise.all(l).then(function(c){const d=c.slice(0,c.length-1),p=c[c.length-1],u=[];for(let y=0,w=p.length;y<w;y++){const g=p[y],b=i[y];let m;const _=d[y];if(b.mode===B.TRIANGLES||b.mode===B.TRIANGLE_STRIP||b.mode===B.TRIANGLE_FAN||b.mode===void 0)m=o.isSkinnedMesh===!0?new r.SkinnedMesh(g,_):new r.Mesh(g,_),m.isSkinnedMesh===!0&&m.normalizeSkinWeights(),b.mode===B.TRIANGLE_STRIP?m.geometry=et(m.geometry,r.TriangleStripDrawMode):b.mode===B.TRIANGLE_FAN&&(m.geometry=et(m.geometry,r.TriangleFanDrawMode));else if(b.mode===B.LINES)m=new r.LineSegments(g,_);else if(b.mode===B.LINE_STRIP)m=new r.Line(g,_);else if(b.mode===B.LINE_LOOP)m=new r.LineLoop(g,_);else if(b.mode===B.POINTS)m=new r.Points(g,_);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+b.mode);Object.keys(m.geometry.morphAttributes).length>0&&$n(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),Y(m,o),b.extensions&&J(n,m,b),t.assignFinalMaterial(m),u.push(m)}for(let y=0,w=u.length;y<w;y++)t.associations.set(u[y],{meshes:e,primitives:y});if(u.length===1)return o.extensions&&J(n,u[0],o),u[0];const f=new r.Group;o.extensions&&J(n,f,o),t.associations.set(f,{meshes:e});for(let y=0,w=u.length;y<w;y++)f.add(u[y]);return f})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new r.PerspectiveCamera(r.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new r.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),Y(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,o=t.joints.length;n<o;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const o=n.pop(),i=n,l=[],c=[];for(let d=0,p=i.length;d<p;d++){const u=i[d];if(u){l.push(u);const f=new r.Matrix4;o!==null&&f.fromArray(o.array,d*16),c.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[d])}return new r.Skeleton(l,c)})}loadAnimation(e){const t=this.json,s=this,n=t.animations[e],o=n.name?n.name:"animation_"+e,i=[],l=[],c=[],d=[],p=[];for(let u=0,f=n.channels.length;u<f;u++){const y=n.channels[u],w=n.samplers[y.sampler],g=y.target,b=g.node,m=n.parameters!==void 0?n.parameters[w.input]:w.input,_=n.parameters!==void 0?n.parameters[w.output]:w.output;g.node!==void 0&&(i.push(this.getDependency("node",b)),l.push(this.getDependency("accessor",m)),c.push(this.getDependency("accessor",_)),d.push(w),p.push(g))}return Promise.all([Promise.all(i),Promise.all(l),Promise.all(c),Promise.all(d),Promise.all(p)]).then(function(u){const f=u[0],y=u[1],w=u[2],g=u[3],b=u[4],m=[];for(let M=0,S=f.length;M<S;M++){const R=f[M],x=y[M],L=w[M],K=g[M],z=b[M];if(R===void 0)continue;R.updateMatrix&&R.updateMatrix();const W=s._createAnimationTracks(R,x,L,K,z);if(W)for(let G=0;G<W.length;G++)m.push(W[G])}const _=new r.AnimationClip(o,void 0,m);return Y(_,n),_})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(o){const i=s._getNodeRef(s.meshCache,n.mesh,o);return n.weights!==void 0&&i.traverse(function(l){if(l.isMesh)for(let c=0,d=n.weights.length;c<d;c++)l.morphTargetInfluences[c]=n.weights[c]}),i})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],o=s._loadNodeShallow(e),i=[],l=n.children||[];for(let d=0,p=l.length;d<p;d++)i.push(s.getDependency("node",l[d]));const c=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([o,Promise.all(i),c]).then(function(d){const p=d[0],u=d[1],f=d[2];f!==null&&p.traverse(function(y){y.isSkinnedMesh&&y.bind(f,ts)});for(let y=0,w=u.length;y<w;y++)p.add(u[y]);if(p.userData.pivot!==void 0&&u.length>0){const y=p.userData.pivot,w=u[0];p.pivot=new r.Vector3().fromArray(y),p.position.x-=y[0],p.position.y-=y[1],p.position.z-=y[2],w.position.set(0,0,0),delete p.userData.pivot}return p})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],i=o.name?n.createUniqueName(o.name):"",l=[],c=n._invokeOne(function(d){return d.createNodeMesh&&d.createNodeMesh(e)});return c&&l.push(c),o.camera!==void 0&&l.push(n.getDependency("camera",o.camera).then(function(d){return n._getNodeRef(n.cameraCache,o.camera,d)})),n._invokeAll(function(d){return d.createNodeAttachment&&d.createNodeAttachment(e)}).forEach(function(d){l.push(d)}),this.nodeCache[e]=Promise.all(l).then(function(d){let p;if(o.isBone===!0?p=new r.Bone:d.length>1?p=new r.Group:d.length===1?p=d[0]:p=new r.Object3D,p!==d[0])for(let u=0,f=d.length;u<f;u++)p.add(d[u]);if(o.name&&(p.userData.name=o.name,p.name=i),Y(p,o),o.extensions&&J(s,p,o),o.matrix!==void 0){const u=new r.Matrix4;u.fromArray(o.matrix),p.applyMatrix4(u)}else o.translation!==void 0&&p.position.fromArray(o.translation),o.rotation!==void 0&&p.quaternion.fromArray(o.rotation),o.scale!==void 0&&p.scale.fromArray(o.scale);if(!n.associations.has(p))n.associations.set(p,{});else if(o.mesh!==void 0&&n.meshCache.refs[o.mesh]>1){const u=n.associations.get(p);n.associations.set(p,{...u})}return n.associations.get(p).nodes=e,p}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,o=new r.Group;s.name&&(o.name=n.createUniqueName(s.name)),Y(o,s),s.extensions&&J(t,o,s);const i=s.nodes||[],l=[];for(let c=0,d=i.length;c<d;c++)l.push(n.getDependency("node",i[c]));return Promise.all(l).then(function(c){for(let p=0,u=c.length;p<u;p++){const f=c[p];f.parent!==null?o.add(Tn(f)):o.add(f)}const d=p=>{const u=new Map;for(const[f,y]of n.associations)(f instanceof r.Material||f instanceof r.Texture)&&u.set(f,y);return p.traverse(f=>{const y=n.associations.get(f);y!=null&&u.set(f,y)}),u};return n.associations=d(o),o})}_createAnimationTracks(e,t,s,n,o){const i=[],l=e.name?e.name:e.uuid,c=[];function d(y){y.morphTargetInfluences&&c.push(y.name?y.name:y.uuid)}q[o.path]===q.weights?(d(e),e.isGroup&&e.children.forEach(d)):c.push(l);let p;switch(q[o.path]){case q.weights:p=r.NumberKeyframeTrack;break;case q.rotation:p=r.QuaternionKeyframeTrack;break;case q.translation:case q.scale:p=r.VectorKeyframeTrack;break;default:switch(s.itemSize){case 1:p=r.NumberKeyframeTrack;break;case 2:case 3:default:p=r.VectorKeyframeTrack;break}break}const u=n.interpolation!==void 0?Qn[n.interpolation]:r.InterpolateLinear,f=this._getArrayFromAccessor(s);for(let y=0,w=c.length;y<w;y++){const g=new p(c[y]+"."+q[o.path],t.array,f,u);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),i.push(g)}return i}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const s=ke(t.constructor),n=new Float32Array(t.length);for(let o=0,i=t.length;o<i;o++)n[o]=t[o]*s;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(s){const n=this instanceof r.QuaternionKeyframeTrack?Zn:bt;return new n(this.times,this.values,this.getValueSize()/3,s)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function ss(a,e,t){const s=e.attributes,n=new r.Box3;if(s.POSITION!==void 0){const l=t.json.accessors[s.POSITION],c=l.min,d=l.max;if(c!==void 0&&d!==void 0){if(n.set(new r.Vector3(c[0],c[1],c[2]),new r.Vector3(d[0],d[1],d[2])),l.normalized){const p=ke(oe[l.componentType]);n.min.multiplyScalar(p),n.max.multiplyScalar(p)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const l=new r.Vector3,c=new r.Vector3;for(let d=0,p=o.length;d<p;d++){const u=o[d];if(u.POSITION!==void 0){const f=t.json.accessors[u.POSITION],y=f.min,w=f.max;if(y!==void 0&&w!==void 0){if(c.setX(Math.max(Math.abs(y[0]),Math.abs(w[0]))),c.setY(Math.max(Math.abs(y[1]),Math.abs(w[1]))),c.setZ(Math.max(Math.abs(y[2]),Math.abs(w[2]))),f.normalized){const g=ke(oe[f.componentType]);c.multiplyScalar(g)}l.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(l)}a.boundingBox=n;const i=new r.Sphere;n.getCenter(i.center),i.radius=n.min.distanceTo(n.max)/2,a.boundingSphere=i}function it(a,e,t){const s=e.attributes,n=[];function o(i,l){return t.getDependency("accessor",i).then(function(c){a.setAttribute(l,c)})}for(const i in s){const l=De[i]||i.toLowerCase();l in a.attributes||n.push(o(s[i],l))}if(e.indices!==void 0&&!a.index){const i=t.getDependency("accessor",e.indices).then(function(l){a.setIndex(l)});n.push(i)}return r.ColorManagement.workingColorSpace!==r.LinearSRGBColorSpace&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${r.ColorManagement.workingColorSpace}" not supported.`),Y(a,e),ss(a,e,t),Promise.all(n).then(function(){return e.targets!==void 0?Wn(a,e.targets,t):a})}function _t(){const a=new D.BoxGeometry(1,1,1),e=new D.MeshStandardMaterial({color:43775}),t=new D.Mesh(a,e);return t.position.y=.5,t.userData.isMovable=!0,t.name="正方体",xe(t,!0),t}function wt(){const a=new D.SphereGeometry(.6,32,32),e=new D.MeshStandardMaterial({color:16746496}),t=new D.Mesh(a,e);return t.position.y=.6,t.userData.isMovable=!0,t.name="球体",xe(t,!0),t}function Et(a){return new Promise((e,t)=>{var i;const s=(i=a.name.split(".").pop())==null?void 0:i.toLowerCase(),n=URL.createObjectURL(a);let o;if(s==="obj")o=new Mn;else if(s==="gltf"||s==="glb")o=new xn;else{t(new Error("不支持的文件格式,请使用 .obj, .gltf, .glb"));return}o.load(n,l=>{const c=s==="gltf"||s==="glb"?l.scene:l;c.traverse(u=>{var f;u.userData.isMovable=!0,u.name||(u.name=u.type),u.type==="Mesh"&&(u.frustumCulled=!0,(f=u.geometry)==null||f.computeVertexNormals())});const p=new D.Box3().setFromObject(c).getCenter(new D.Vector3);c.position.sub(p),xe(c,!0),e(c)},void 0,l=>t(l))})}function Mt(a){switch(a){case"box":_t();break;case"sphere":wt();break}}const os={key:1,class:"toggle-placeholder"},is={class:"tree-icon"},rs={class:"tree-name"},as={key:0,class:"tree-children"},ls=h.defineComponent({__name:"TreeItem",props:{node:{},selectedObject:{},version:{}},emits:["select","delete"],setup(a,{emit:e}){const t=a,s=e,n=h.ref(null),{expandedSet:o,toggleExpand:i}=h.inject("treeExpand"),l=h.computed(()=>o.value.has(t.node.uuid)),c=h.computed(()=>(t.version,t.node.children.some(g=>g.userData.isMovable===!0))),d=h.computed(()=>(t.version,t.node.children.filter(g=>g.userData.isMovable===!0))),p=h.computed(()=>{var g;return((g=t.selectedObject)==null?void 0:g.uuid)===t.node.uuid});h.watchEffect(()=>{p.value&&n.value&&n.value.scrollIntoView({block:"nearest",behavior:"smooth"})},{flush:"post"});const u=g=>{g.stopPropagation(),s("select",t.node)},f=g=>{g.stopPropagation(),s("delete",t.node)},y=g=>g.type==="Mesh"||g.type==="Sprite"?"🟦":g.type==="Light"?"💡":"📦",w=g=>g.name||`${g.type} (${g.id})`;return(g,b)=>{const m=h.resolveComponent("TreeItem",!0);return h.openBlock(),h.createElementBlock("div",{class:"tree-node",ref_key:"nodeRef",ref:n},[h.createElementVNode("div",{class:h.normalizeClass(["tree-item",{selected:p.value}]),onClick:u},[c.value?(h.openBlock(),h.createElementBlock("span",{key:0,class:"toggle-icon",onClick:b[0]||(b[0]=h.withModifiers(_=>h.unref(i)(a.node.uuid),["stop"]))},h.toDisplayString(l.value?"▼":"▶"),1)):(h.openBlock(),h.createElementBlock("span",os)),h.createElementVNode("span",is,h.toDisplayString(y(a.node)),1),h.createElementVNode("span",rs,h.toDisplayString(w(a.node)),1),h.createElementVNode("button",{class:"tree-delete",onClick:h.withModifiers(f,["stop"])},"×")],2),l.value&&c.value?(h.openBlock(),h.createElementBlock("div",as,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(d.value,_=>(h.openBlock(),h.createBlock(m,{key:_.uuid,node:_,"selected-object":a.selectedObject,version:a.version,onSelect:b[1]||(b[1]=M=>s("select",M)),onDelete:b[2]||(b[2]=M=>s("delete",M))},null,8,["node","selected-object","version"]))),128))])):h.createCommentVNode("",!0)],512)}}}),ue=(a,e)=>{const t=a.__vccOpts||a;for(const[s,n]of e)t[s]=n;return t},Tt=ue(ls,[["__scopeId","data-v-5ad9c842"]]);function xt(a){const e=h.ref(new Set),t=n=>{const o=new Set(e.value);o.has(n)?o.delete(n):o.add(n),e.value=o},s=n=>{if(!n)return;const o=new Set(e.value);let i=n.parent;for(;i&&i.type!=="Scene";)o.add(i.uuid),i=i.parent;e.value=o};return h.watch(a,n=>{n&&s(n)},{immediate:!0}),{expandedSet:e,toggleExpand:t}}const cs={key:0,class:"property-panel"},hs={class:"property-group tree-group"},us={class:"tree-container"},ds={key:0,class:"tree-empty"},ps={key:0,class:"tabs"},ms={key:1,class:"tab-content"},fs={class:"property-group"},gs={class:"row"},ys={class:"property-group"},bs={class:"row"},_s={class:"property-group"},ws={class:"row"},Es={key:0,class:"property-group material-group"},Ms={class:"slider-row"},Ts={class:"slider-value"},xs={class:"slider-row"},Ss={class:"slider-value"},vs={class:"slider-row"},Rs={class:"slider-value"},As={key:0,class:"material-hint"},Ps={key:1,class:"property-panel empty"},Ls=h.defineComponent({__name:"PropertyPanel",props:{transform:{},treeData:{},selectedObject:{}},emits:["propertyChange","treeSelect","treeDelete"],setup(a,{emit:e}){const t=a,s=e,n=()=>s("propertyChange"),o=h.ref("transform"),i=h.ref(0),l=h.toRef(t,"selectedObject"),{expandedSet:c,toggleExpand:d}=xt(l);h.provide("treeExpand",{expandedSet:c,toggleExpand:d});const p=b=>{i.value++,s("treeDelete",b)},u=h.reactive({metalness:0,roughness:.5,opacity:1}),f=h.ref(!1);function y(b){let m=null;return b.traverse(_=>{if(_.type==="Mesh"&&!m){const M=_,S=Array.isArray(M.material)?M.material:[M.material];for(const R of S)if(R&&(R.type==="MeshStandardMaterial"||R.type==="MeshPhongMaterial")){const x=R;m={metalness:x.metalness??0,roughness:x.roughness??.5,opacity:R.opacity??1};break}}}),m}function w(b,m){let _=!1;return b.traverse(M=>{if(M.type==="Mesh"){const S=M,R=Array.isArray(S.material)?S.material:[S.material];for(const x of R)x&&(x.type==="MeshStandardMaterial"||x.type==="MeshPhongMaterial")&&(m.metalness!==void 0&&(x.metalness=m.metalness),m.roughness!==void 0&&(x.roughness=m.roughness),m.opacity!==void 0&&(x.opacity=m.opacity,x.transparent=m.opacity<1),x.needsUpdate=!0,_=!0)}}),_}function g(){if(t.selectedObject){const b=w(t.selectedObject,{metalness:u.metalness,roughness:u.roughness,opacity:u.opacity});f.value=b}}return h.watch(()=>t.selectedObject,b=>{if(b){const m=y(b);m?(u.metalness=m.metalness,u.roughness=m.roughness,u.opacity=m.opacity,f.value=!0):(u.metalness=0,u.roughness=.5,u.opacity=1,f.value=!1)}else u.metalness=0,u.roughness=.5,u.opacity=1,f.value=!1},{immediate:!0}),(b,m)=>a.transform?(h.openBlock(),h.createElementBlock("div",cs,[m[32]||(m[32]=h.createElementVNode("h3",null,"属性面板",-1)),h.createElementVNode("div",hs,[m[15]||(m[15]=h.createElementVNode("label",null,"场景物体",-1)),h.createElementVNode("div",us,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(a.treeData,_=>(h.openBlock(),h.createBlock(Tt,{key:_.uuid,node:_,"selected-object":a.selectedObject,version:i.value,onSelect:m[0]||(m[0]=M=>s("treeSelect",M)),onDelete:p},null,8,["node","selected-object","version"]))),128)),a.treeData.length===0?(h.openBlock(),h.createElementBlock("div",ds,"暂无物体")):h.createCommentVNode("",!0)])]),m[33]||(m[33]=h.createElementVNode("div",{class:"property-group"},[h.createElementVNode("label",null,"全局属性"),h.createElementVNode("div",{class:"row"})],-1)),a.selectedObject?(h.openBlock(),h.createElementBlock("div",ps,[h.createElementVNode("button",{class:h.normalizeClass(["tab-btn",{active:o.value==="transform"}]),onClick:m[1]||(m[1]=_=>o.value="transform")}," 🔄 变换 ",2),h.createElementVNode("button",{class:h.normalizeClass(["tab-btn",{active:o.value==="info"}]),onClick:m[2]||(m[2]=_=>o.value="info")}," ℹ️ 信息 ",2)])):h.createCommentVNode("",!0),a.selectedObject?(h.openBlock(),h.createElementBlock("div",ms,[h.withDirectives(h.createElementVNode("div",null,[h.createElementVNode("div",fs,[m[19]||(m[19]=h.createElementVNode("label",null,"位置",-1)),h.createElementVNode("div",gs,[m[16]||(m[16]=h.createElementVNode("span",null,"X:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[3]||(m[3]=_=>a.transform.position.x=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.position.x,void 0,{number:!0}]]),m[17]||(m[17]=h.createElementVNode("span",null,"Y:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[4]||(m[4]=_=>a.transform.position.y=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.position.y,void 0,{number:!0}]]),m[18]||(m[18]=h.createElementVNode("span",null,"Z:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[5]||(m[5]=_=>a.transform.position.z=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.position.z,void 0,{number:!0}]])])]),h.createElementVNode("div",ys,[m[23]||(m[23]=h.createElementVNode("label",null,"旋转 (弧度)",-1)),h.createElementVNode("div",bs,[m[20]||(m[20]=h.createElementVNode("span",null,"X:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[6]||(m[6]=_=>a.transform.rotation.x=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.rotation.x,void 0,{number:!0}]]),m[21]||(m[21]=h.createElementVNode("span",null,"Y:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[7]||(m[7]=_=>a.transform.rotation.y=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.rotation.y,void 0,{number:!0}]]),m[22]||(m[22]=h.createElementVNode("span",null,"Z:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[8]||(m[8]=_=>a.transform.rotation.z=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.rotation.z,void 0,{number:!0}]])])]),h.createElementVNode("div",_s,[m[27]||(m[27]=h.createElementVNode("label",null,"缩放",-1)),h.createElementVNode("div",ws,[m[24]||(m[24]=h.createElementVNode("span",null,"X:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[9]||(m[9]=_=>a.transform.scale.x=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.scale.x,void 0,{number:!0}]]),m[25]||(m[25]=h.createElementVNode("span",null,"Y:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[10]||(m[10]=_=>a.transform.scale.y=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.scale.y,void 0,{number:!0}]]),m[26]||(m[26]=h.createElementVNode("span",null,"Z:",-1)),h.withDirectives(h.createElementVNode("input",{type:"number","onUpdate:modelValue":m[11]||(m[11]=_=>a.transform.scale.z=_),step:"0.01",onInput:n},null,544),[[h.vModelText,a.transform.scale.z,void 0,{number:!0}]])])]),a.selectedObject?(h.openBlock(),h.createElementBlock("div",Es,[m[31]||(m[31]=h.createElementVNode("label",null,"材质",-1)),h.createElementVNode("div",Ms,[m[28]||(m[28]=h.createElementVNode("span",{class:"slider-label"},"金属度",-1)),h.withDirectives(h.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01","onUpdate:modelValue":m[12]||(m[12]=_=>u.metalness=_),onInput:g},null,544),[[h.vModelText,u.metalness,void 0,{number:!0}]]),h.createElementVNode("span",Ts,h.toDisplayString(u.metalness.toFixed(2)),1)]),h.createElementVNode("div",xs,[m[29]||(m[29]=h.createElementVNode("span",{class:"slider-label"},"粗糙度",-1)),h.withDirectives(h.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01","onUpdate:modelValue":m[13]||(m[13]=_=>u.roughness=_),onInput:g},null,544),[[h.vModelText,u.roughness,void 0,{number:!0}]]),h.createElementVNode("span",Ss,h.toDisplayString(u.roughness.toFixed(2)),1)]),h.createElementVNode("div",vs,[m[30]||(m[30]=h.createElementVNode("span",{class:"slider-label"},"透明度",-1)),h.withDirectives(h.createElementVNode("input",{type:"range",min:"0",max:"1",step:"0.01","onUpdate:modelValue":m[14]||(m[14]=_=>u.opacity=_),onInput:g},null,544),[[h.vModelText,u.opacity,void 0,{number:!0}]]),h.createElementVNode("span",Rs,h.toDisplayString(u.opacity.toFixed(2)),1)]),f.value?h.createCommentVNode("",!0):(h.openBlock(),h.createElementBlock("div",As," ⚠️ 当前材质不支持金属度/粗糙度(仅支持 Standard/Phong) "))])):h.createCommentVNode("",!0)],512),[[h.vShow,o.value==="transform"]])])):h.createCommentVNode("",!0)])):(h.openBlock(),h.createElementBlock("div",Ps,[...m[34]||(m[34]=[h.createElementVNode("p",null,"未选中任何模型",-1)])]))}}),St=ue(Ls,[["__scopeId","data-v-d75c643f"]]),Ns={class:"top-bar"},Cs={class:"left-section"},Is={class:"dropdown-menu"},Os={class:"dropdown-menu sub-menu"},Ds={class:"dropdown-menu"},ks={class:"dropdown-menu sub-menu"},Vs={class:"dropdown-menu"},js={class:"dropdown-menu"},Fs={class:"dropdown-menu"},Hs=h.defineComponent({__name:"TopBar",emits:["addModel","importModel"],setup(a,{emit:e}){const t=h.ref(!1),s=h.ref(!1),n=h.ref(!1),o=h.ref(!1),i=h.ref(!1),l=h.ref(!1),c=h.ref(!1),d=e,p=h.ref(null),u=()=>{var G;return(G=p.value)==null?void 0:G.click()},f=G=>{const T=G.target;T.files&&T.files.length>0&&(d("importModel",T.files[0]),T.value="")},y=()=>console.log("新建项目"),w=()=>console.log("保存场景"),g=()=>console.log("导出模型"),b=()=>console.log("撤销"),m=()=>console.log("重做"),_=()=>console.log("复制物体"),M=()=>console.log("删除物体"),S=()=>console.log("重置相机"),R=()=>console.log("切换网格"),x=()=>console.log("打开帮助"),L=()=>console.log("关于编辑器"),K=()=>console.log("打开项目"),z=()=>console.log("打开模型"),W=()=>console.log("打开场景");return(G,T)=>(h.openBlock(),h.createElementBlock("div",Ns,[h.createElementVNode("div",Cs,[h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[2]||(T[2]=O=>t.value=!0),onMouseleave:T[3]||(T[3]=O=>t.value=!1)},[T[17]||(T[17]=h.createElementVNode("button",{class:"menu-btn"},"文件",-1)),h.withDirectives(h.createElementVNode("div",Is,[h.createElementVNode("div",{class:"menu-item",onClick:y},"新建"),h.createElementVNode("div",{class:"menu-item dropdown-wrapper sub-trigger",onMouseenter:T[0]||(T[0]=O=>l.value=!0),onMouseleave:T[1]||(T[1]=O=>l.value=!1)},[T[16]||(T[16]=h.createElementVNode("span",null,"打开",-1)),h.withDirectives(h.createElementVNode("div",Os,[h.createElementVNode("div",{class:"menu-item",onClick:K},"打开项目"),h.createElementVNode("div",{class:"menu-item",onClick:z},"打开模型"),h.createElementVNode("div",{class:"menu-item",onClick:W},"打开场景")],512),[[h.vShow,l.value]])],32),h.createElementVNode("div",{class:"menu-item",onClick:w},"保存"),h.createElementVNode("div",{class:"menu-item",onClick:g},"导出")],512),[[h.vShow,t.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[8]||(T[8]=O=>i.value=!0),onMouseleave:T[9]||(T[9]=O=>i.value=!1)},[T[19]||(T[19]=h.createElementVNode("button",{class:"menu-btn"},"添加",-1)),h.withDirectives(h.createElementVNode("div",Ds,[h.createElementVNode("div",{class:"menu-item",onClick:b},"组"),h.createElementVNode("div",{class:"menu-item dropdown-wrapper sub-trigger",onMouseenter:T[6]||(T[6]=O=>c.value=!0),onMouseleave:T[7]||(T[7]=O=>c.value=!1)},[T[18]||(T[18]=h.createElementVNode("span",null,"网格",-1)),h.withDirectives(h.createElementVNode("div",ks,[h.createElementVNode("div",{class:"menu-item",onClick:T[4]||(T[4]=O=>d("addModel","box"))}," 正方体 "),h.createElementVNode("div",{class:"menu-item",onClick:T[5]||(T[5]=O=>d("addModel","sphere"))}," 球体 "),h.createElementVNode("div",{class:"menu-item",onClick:u},"导入")],512),[[h.vShow,c.value]])],32),h.createElementVNode("div",{class:"menu-item",onClick:_},"光源"),h.createElementVNode("div",{class:"menu-item",onClick:M},"摄像机")],512),[[h.vShow,i.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[10]||(T[10]=O=>s.value=!0),onMouseleave:T[11]||(T[11]=O=>s.value=!1)},[T[20]||(T[20]=h.createElementVNode("button",{class:"menu-btn"},"编辑",-1)),h.withDirectives(h.createElementVNode("div",Vs,[h.createElementVNode("div",{class:"menu-item",onClick:b},"撤销"),h.createElementVNode("div",{class:"menu-item",onClick:m},"重做"),h.createElementVNode("div",{class:"menu-item",onClick:_},"复制"),h.createElementVNode("div",{class:"menu-item",onClick:M},"删除")],512),[[h.vShow,s.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[12]||(T[12]=O=>n.value=!0),onMouseleave:T[13]||(T[13]=O=>n.value=!1)},[T[21]||(T[21]=h.createElementVNode("button",{class:"menu-btn"},"视图",-1)),h.withDirectives(h.createElementVNode("div",js,[h.createElementVNode("div",{class:"menu-item",onClick:S},"重置相机"),h.createElementVNode("div",{class:"menu-item",onClick:R},"显示网格")],512),[[h.vShow,n.value]])],32),h.createElementVNode("div",{class:"dropdown-wrapper",onMouseenter:T[14]||(T[14]=O=>o.value=!0),onMouseleave:T[15]||(T[15]=O=>o.value=!1)},[T[22]||(T[22]=h.createElementVNode("button",{class:"menu-btn"},"帮助",-1)),h.withDirectives(h.createElementVNode("div",Fs,[h.createElementVNode("div",{class:"menu-item",onClick:x},"使用帮助"),h.createElementVNode("div",{class:"menu-item",onClick:L},"关于")],512),[[h.vShow,o.value]])],32)]),T[23]||(T[23]=h.createElementVNode("div",{class:"right-section"},[h.createElementVNode("span",{class:"app-title"},"3D 模型编辑器")],-1)),h.createElementVNode("input",{type:"file",ref_key:"fileInput",ref:p,accept:".obj,.gltf,.glb",style:{display:"none"},onChange:f},null,544)]))}}),vt=ue(Hs,[["__scopeId","data-v-6bb4762f"]]),Bs={class:"bottom-bar"},Gs=h.defineComponent({__name:"BottomBar",setup(a){return(e,t)=>(h.openBlock(),h.createElementBlock("div",Bs,[...t[0]||(t[0]=[h.createElementVNode("div",{class:"status-left"},[h.createElementVNode("span",null,"就绪")],-1),h.createElementVNode("div",{class:"status-right"},[h.createElementVNode("span",null,"顶点: 0 | 面: 0")],-1)])]))}}),Rt=ue(Gs,[["__scopeId","data-v-3427bb27"]]),Us={class:"app-layout"},zs=h.defineComponent({__name:"DrawingBoard",props:{mode:{default:"edit"},sceneData:{default:null}},setup(a){const e=a,t=h.ref(null),s=h.reactive({position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1}}),n=g=>{s.position.x=Number(g.position.x.toFixed(3)),s.position.y=Number(g.position.y.toFixed(3)),s.position.z=Number(g.position.z.toFixed(3)),s.rotation.x=Number(g.rotation.x.toFixed(3)),s.rotation.y=Number(g.rotation.y.toFixed(3)),s.rotation.z=Number(g.rotation.z.toFixed(3)),s.scale.x=Number(g.scale.x.toFixed(3)),s.scale.y=Number(g.scale.y.toFixed(3)),s.scale.z=Number(g.scale.z.toFixed(3))},o=g=>{g.position.set(s.position.x,s.position.y,s.position.z),g.rotation.set(s.rotation.x,s.rotation.y,s.rotation.z),g.scale.set(s.scale.x,s.scale.y,s.scale.z)};ut(g=>{t.value=g,g&&n(g)}),dt(g=>{n(g)});const i=()=>{t.value&&o(t.value)},l=g=>Mt(g),c=async g=>{try{await Et(g)}catch(b){console.error("导入失败:",b),alert("导入失败:"+b.message)}},d=h.shallowRef([]);pt(g=>{d.value=g});const p=()=>{const g=mt();g&&(d.value=g)},u=g=>Te(g),f=g=>ht(g.uuid),y=h.ref(null),w=()=>{y.value&&at(y.value,e.mode,e.sceneData),p()};return h.onMounted(w),(g,b)=>(h.openBlock(),h.createElementBlock("div",Us,[a.mode==="edit"?(h.openBlock(),h.createBlock(vt,{key:0,onAddModel:l,onImportModel:c})):h.createCommentVNode("",!0),h.createElementVNode("div",{class:h.normalizeClass(`editor-container editor-container-mode-${a.mode}`)},[h.createElementVNode("div",{class:h.normalizeClass(`canvas canvas-mode-${a.mode}`),ref_key:"containerRef",ref:y},null,2),a.mode==="edit"?(h.openBlock(),h.createBlock(St,{key:0,transform:s,"tree-data":d.value,"selected-object":t.value,onPropertyChange:i,onTreeSelect:u,onTreeDelete:f},null,8,["transform","tree-data","selected-object"])):h.createCommentVNode("",!0)],2),a.mode==="edit"?(h.openBlock(),h.createBlock(Rt,{key:1})):h.createCommentVNode("",!0)]))}}),Xs=ue(zs,[["__scopeId","data-v-a75eff69"]]);exports.BottomBar=Rt;exports.DrawingBoard=Xs;exports.PropertyPanel=St;exports.TopBar=vt;exports.TreeItem=Tt;exports.addBox=_t;exports.addModel=xe;exports.addModelByType=Mt;exports.addSphere=wt;exports.exportSceneToJSON=gn;exports.getCamera=mn;exports.getRenderer=fn;exports.getScene=pn;exports.getSceneObjects=mt;exports.importModelFromFile=Et;exports.initEditor=at;exports.loadSceneFromJSON=ft;exports.onSceneObjectsChangeCallback=pt;exports.removeModel=ct;exports.removeModelById=ht;exports.selectObject=Te;exports.setSelectedObjectCallback=ut;exports.setTransformChangeCallback=dt;exports.useTreeExpand=xt;
|
|
6
6
|
//# sourceMappingURL=three-editor.cjs.js.map
|