@selvajs/compute 3.1.0-beta.10 → 3.1.0-beta.12
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.
- package/LICENSE +21 -0
- package/dist/chunk-3SEQKFGD.js +2 -0
- package/dist/chunk-3SEQKFGD.js.map +1 -0
- package/dist/chunk-44HGB4C4.cjs +2 -0
- package/dist/chunk-44HGB4C4.cjs.map +1 -0
- package/dist/chunk-H3FZW6OX.cjs +4 -0
- package/dist/chunk-H3FZW6OX.cjs.map +1 -0
- package/dist/chunk-INP5HVA2.js +62 -0
- package/dist/chunk-INP5HVA2.js.map +1 -0
- package/dist/chunk-KTKY5M5S.cjs +62 -0
- package/dist/chunk-KTKY5M5S.cjs.map +1 -0
- package/dist/chunk-Y3M7P3BW.js +4 -0
- package/dist/chunk-Y3M7P3BW.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +22 -1
- package/dist/core.d.ts +22 -1
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +20 -0
- package/dist/grasshopper.d.ts +20 -0
- package/dist/grasshopper.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{visualization-MOYO6MDN.js → visualization-5RH6RSLV.js} +2 -2
- package/dist/visualization-KRP5OPYW.cjs +2 -0
- package/dist/visualization-KRP5OPYW.cjs.map +1 -0
- package/dist/visualization.cjs +1 -1
- package/dist/visualization.cjs.map +1 -1
- package/dist/visualization.d.cts +35 -4
- package/dist/visualization.d.ts +35 -4
- package/dist/visualization.js +1 -1
- package/package.json +51 -30
- package/dist/chunk-2KQHHQZW.js +0 -2
- package/dist/chunk-2KQHHQZW.js.map +0 -1
- package/dist/chunk-7XMD5YXP.cjs +0 -62
- package/dist/chunk-7XMD5YXP.cjs.map +0 -1
- package/dist/chunk-CUQQ3ZBV.cjs +0 -4
- package/dist/chunk-CUQQ3ZBV.cjs.map +0 -1
- package/dist/chunk-HOWV4A5D.cjs +0 -2
- package/dist/chunk-HOWV4A5D.cjs.map +0 -1
- package/dist/chunk-PX2YTSHJ.js +0 -62
- package/dist/chunk-PX2YTSHJ.js.map +0 -1
- package/dist/chunk-WPB2LKCD.js +0 -4
- package/dist/chunk-WPB2LKCD.js.map +0 -1
- package/dist/visualization-4RSUYQG2.cjs +0 -2
- package/dist/visualization-4RSUYQG2.cjs.map +0 -1
- /package/dist/{visualization-MOYO6MDN.js.map → visualization-5RH6RSLV.js.map} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkH3FZW6OXcjs = require('./chunk-H3FZW6OX.cjs');var St={};_chunkH3FZW6OXcjs.a.call(void 0, St,{CONCRETE_MATERIAL:()=>Fe,EMISSIVE_MATERIAL:()=>De,GLASS_MATERIAL:()=>Be,METAL_MATERIAL:()=>Pe,PLASTIC_MATERIAL:()=>Ve,RUBBER_MATERIAL:()=>ke,SHARED_MATERIALS:()=>ye,WOOD_MATERIAL:()=>Ue});var _three = require('three'); var D = _interopRequireWildcard(_three); var U = _interopRequireWildcard(_three); var _ = _interopRequireWildcard(_three); var B = _interopRequireWildcard(_three); var $ = _interopRequireWildcard(_three); var N = _interopRequireWildcard(_three); var Ze = _interopRequireWildcard(_three); var O = _interopRequireWildcard(_three); var Ee = _interopRequireWildcard(_three); var h = _interopRequireWildcard(_three); var se = _interopRequireWildcard(_three); var Y = _interopRequireWildcard(_three); var F = _interopRequireWildcard(_three);var De=new D.MeshPhysicalMaterial({color:0,emissive:new D.Color(16777215),emissiveIntensity:5,metalness:0,roughness:.2,clearcoat:.3,clearcoatRoughness:.2,depthWrite:!0,depthTest:!0,transparent:!1,alphaTest:0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,side:D.FrontSide,dithering:!0}),Pe=new D.MeshPhysicalMaterial({color:new D.Color(0),metalness:.9,roughness:.3,envMapIntensity:1.2,clearcoat:.3,clearcoatRoughness:.2,reflectivity:1,ior:2.5,thickness:1,depthWrite:!0,transparent:!1,alphaTest:0,depthTest:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,side:D.FrontSide,dithering:!0}),Fe=new D.MeshPhysicalMaterial({color:new D.Color(13421772),metalness:0,roughness:.92,envMapIntensity:.15,clearcoat:.05,clearcoatRoughness:.9,reflectivity:.15,transmission:0,ior:1.45,thickness:0,depthWrite:!0,transparent:!1,alphaTest:0,depthTest:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,side:D.FrontSide,dithering:!0}),Ve=new D.MeshPhysicalMaterial({color:new D.Color(16777215),metalness:0,roughness:.3,envMapIntensity:.5,clearcoat:.5,clearcoatRoughness:.1,reflectivity:.5,ior:1.4,transmission:0,transparent:!1,depthWrite:!0,side:D.FrontSide,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),Be=new D.MeshPhysicalMaterial({color:new D.Color(16777215),metalness:0,roughness:0,transmission:.95,transparent:!0,depthWrite:!1,envMapIntensity:1,clearcoat:1,clearcoatRoughness:0,ior:1.52,reflectivity:.9,thickness:1,side:D.DoubleSide,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),ke=new D.MeshPhysicalMaterial({color:new D.Color(1710618),metalness:0,roughness:.9,envMapIntensity:.2,clearcoat:.1,clearcoatRoughness:.8,reflectivity:.2,ior:1.3,transmission:0,depthWrite:!0,side:D.FrontSide,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),Ue=new D.MeshPhysicalMaterial({color:new D.Color(8934707),metalness:0,roughness:.7,envMapIntensity:.3,clearcoat:.3,clearcoatRoughness:.4,reflectivity:.3,ior:1.3,transmission:0,depthWrite:!0,side:D.FrontSide,dithering:!0,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1}),ye=new Set([De,Pe,Fe,Ve,Be,ke,Ue]);var Z={HUGE_THRESHOLD:1e4,LARGE_THRESHOLD:1e3,SCALE_RATIO_THRESHOLD:100,NEAR_PLANE_FACTOR:{TINY:1e-4,SMALL:.001,NORMAL:.01},FAR_PLANE_FACTOR:{HUGE:100,LARGE:50,NORMAL:20},INITIAL_DISTANCE_MULTIPLIER:4};function no(e,r,t,n,a){if(Dt(e),r.length===0)return;r.forEach(u=>{e.add(u)});let o=be(r),i=o.getCenter(new U.Vector3),s=o.getSize(new U.Vector3),l=Math.max(s.x,s.y,s.z);if(l/Math.min(s.x||1,s.y||1,s.z||1)>Z.SCALE_RATIO_THRESHOLD||l>Z.HUGE_THRESHOLD?(t.near=l*Z.NEAR_PLANE_FACTOR.TINY,t.far=l*Z.FAR_PLANE_FACTOR.HUGE):l>Z.LARGE_THRESHOLD?(t.near=l*Z.NEAR_PLANE_FACTOR.SMALL,t.far=l*Z.FAR_PLANE_FACTOR.LARGE):(t.near=Math.max(.01,l*Z.NEAR_PLANE_FACTOR.NORMAL),t.far=Math.max(2e3,l*Z.FAR_PLANE_FACTOR.NORMAL)),t.updateProjectionMatrix(),!a){let u=l*Z.INITIAL_DISTANCE_MULTIPLIER;t.position.set(i.x+u*.8,i.y+u,i.z+u*1.2),n.target.copy(i),n.update()}}function _e(e){if(!e||typeof e!="string")return _chunkH3FZW6OXcjs.e.call(void 0, ).warn(`Invalid color input: ${e}, using white`),new U.Color(16777215);let r=e.trim();if(/^#?[0-9A-Fa-f]{6}$/.test(r))try{let n=r.startsWith("#")?r:`#${r}`;return new U.Color(n)}catch (e2){return _chunkH3FZW6OXcjs.e.call(void 0, ).warn(`Invalid hex color: ${e}, using white`),new U.Color(16777215)}if(r.includes(",")){let n=r.split(",").map(a=>parseInt(a.trim(),10));if(n.length===3&&n.every(a=>!isNaN(a)&&a>=0&&a<=255))return new U.Color(n[0]/255,n[1]/255,n[2]/255)}let t=r.toLowerCase();return t in U.Color.NAMES?new U.Color(U.Color.NAMES[t]):(_chunkH3FZW6OXcjs.e.call(void 0, ).warn(`Invalid color string: ${e}, using white`),new U.Color(16777215))}function ze(e,r,t="z"){e.forEach(n=>{n.position[t]-=r})}function be(e){let r=new U.Box3;return e.length===0||e.forEach(t=>{t.updateMatrixWorld(!0);let n=new U.Box3().setFromObject(t);r.union(n)}),r}var Lt=new Set(["grid","floor","label-layer","measure"]);function It(e){let r=e;for(;r;){if(typeof r.userData.id=="string"&&Lt.has(r.userData.id))return!0;r=r.parent}return!1}function ee(e){e.updateMatrixWorld(!0);let r=new U.Box3;return e.traverse(t=>{let n=t;t.visible&&!It(t)&&n.geometry&&r.expandByObject(t)}),r}var Ot=new Set(["floor","grid","label-layer"]);function Dt(e){[...e.children].forEach(t=>{Ot.has(t.userData.id)||t.userData.source!=="user"&&(t.traverse(n=>{let a=n;if(!a.geometry&&!a.material)return;_optionalChain([a, 'access', _2 => _2.geometry, 'optionalAccess', _3 => _3.dispose, 'call', _4 => _4()]);let o=a.material;if(!o)return;(Array.isArray(o)?o:[o]).forEach(s=>{if(!ye.has(s)){for(let l of Object.values(s))l instanceof U.Texture&&l.dispose();s.dispose()}})}),t.removeFromParent())})}function Pt(e){let r=e.clone().normalize(),t=new _.Vector3(0,0,1),n=new _.Vector3(0,1,0),a=Math.abs(r.dot(t))>.9?n:t,o=new _.Vector3().crossVectors(r,a).normalize(),i=new _.Vector3().crossVectors(o,r).normalize();return{top:r.clone(),bottom:r.clone().negate(),front:i.clone(),back:i.clone().negate(),right:o.clone(),left:o.clone().negate(),iso:i.clone().multiplyScalar(1.2).add(o.clone()).add(r.clone()).normalize()}}function Ne(e){let{scene:r,perspective:t,controls:n,onActiveCameraChange:a}=e,o=(_nullishCoalesce(e.up, () => (t.up))).clone().normalize(),i=Pt(o),s=new _.OrthographicCamera(-1,1,1,-1,t.near,t.far);s.up.copy(o);let l="perspective",c=t.aspect,u=()=>l==="perspective"?t:s,d=null,m=()=>{_optionalChain([d, 'optionalAccess', _5 => _5.cancel, 'call', _6 => _6()]),d=null},E=()=>{let R=(l==="orthographic"?s:t).position.distanceTo(n.target)*Math.tan(t.fov*Math.PI/360),v=R*c;s.left=-v,s.right=v,s.top=R,s.bottom=-R,s.near=t.near,s.far=t.far,s.updateProjectionMatrix()},T=p=>{if(p!==l){if(m(),p==="orthographic")s.position.copy(t.position),s.up.copy(t.up),s.lookAt(n.target),s.zoom=1,E();else{let R=(s.top-s.bottom)/(2*s.zoom)/Math.tan(t.fov*Math.PI/360),v=s.position.clone().sub(n.target);v.lengthSq()<1e-12&&v.copy(o),v.normalize(),t.position.copy(n.target).add(v.multiplyScalar(R))}l=p,n.object=u(),n.update(),a(u())}},f=(p,b,R,v)=>{let S=t.fov*(Math.PI/180),V=b/(2*Math.tan(S/2))*1.5,G=Ft(R,o),k=p.clone().add(G.clone().multiplyScalar(V)),X=u();l==="orthographic"&&(s.zoom=1),m(),v?d=Bt(X,n,k,p,()=>{l==="orthographic"&&E()}):(X.position.copy(k),n.target.copy(p),l==="orthographic"&&E(),n.update())},x=(p,b=!0)=>{let R=ee(r),v=R.isEmpty()?n.target.clone():R.getCenter(new _.Vector3),S=R.isEmpty()?new _.Vector3(1,1,1):R.getSize(new _.Vector3),V=Math.max(S.x,S.y,S.z)||1;f(v,V,p,b)};return{getActiveCamera:u,getProjection:()=>l,setProjection:T,toggleProjection:()=>(T(l==="perspective"?"orthographic":"perspective"),l),setView:(p,b=!0)=>{x(i[p],b)},setViewDirection:x,frameBounds:(p,b=!0)=>{if(p.isEmpty())return;let R=p.getCenter(new _.Vector3),v=p.getSize(new _.Vector3),S=Math.max(v.x,v.y,v.z)||1,V=u().position.clone().sub(n.target);V.lengthSq()<1e-12&&V.copy(i.iso),f(R,S,V.normalize(),b)},setRotateEnabled:p=>{n.enableRotate=p},isRotateEnabled:()=>n.enableRotate,updateAspect:(p,b)=>{c=b===0?c:p/b,l==="orthographic"&&E()},dispose:m}}function Ft(e,r){let t=r.clone().normalize(),n=e.clone().normalize();if(Math.abs(n.dot(t))<.9999)return e;let a=Math.abs(t.dot(new _.Vector3(0,0,1)))>.9?new _.Vector3(0,1,0):new _.Vector3(0,0,1),o=new _.Vector3().crossVectors(t,a).normalize(),i=.5*Math.PI/180;return n.multiplyScalar(Math.cos(i)).add(o.multiplyScalar(Math.sin(i))).normalize()}var Vt=e=>1-Math.pow(1-e,3);function Bt(e,r,t,n,a,o=250){let i=e.position.clone(),s=r.target.clone(),l=performance.now(),c=null,u=()=>{c=null;let d=Vt(Math.min((performance.now()-l)/o,1));e.position.lerpVectors(i,t,d),r.target.lerpVectors(s,n,d),a(),r.update(),d<1&&(c=requestAnimationFrame(u))};return c=requestAnimationFrame(u),{cancel:()=>{c!==null&&(cancelAnimationFrame(c),c=null)}}}function kt(e){if(!(e>0)||!Number.isFinite(e))return 1;let r=Math.floor(Math.log10(e)),t=Math.pow(10,r),n=e/t;return(n>=5?5:n>=2?2:1)*t}var Ut=`
|
|
2
|
+
varying vec3 vWorldPos;
|
|
3
|
+
void main() {
|
|
4
|
+
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
5
|
+
vWorldPos = world.xyz;
|
|
6
|
+
gl_Position = projectionMatrix * viewMatrix * world;
|
|
7
|
+
}
|
|
8
|
+
`,_t=`
|
|
9
|
+
precision highp float;
|
|
10
|
+
varying vec3 vWorldPos;
|
|
11
|
+
|
|
12
|
+
uniform vec2 uAxes; // indices (0=x,1=y,2=z) of the two in-plane world axes
|
|
13
|
+
uniform float uCell;
|
|
14
|
+
uniform float uMajor;
|
|
15
|
+
uniform vec3 uCellColor;
|
|
16
|
+
uniform vec3 uMajorColor;
|
|
17
|
+
uniform vec3 uCenter; // fade center (camera position), projected onto plane
|
|
18
|
+
uniform float uFade;
|
|
19
|
+
|
|
20
|
+
// Antialiased grid line intensity for a given spacing, using screen-space derivatives so lines
|
|
21
|
+
// stay ~1px regardless of zoom (the standard "pristine grid" technique).
|
|
22
|
+
float gridLine(vec2 coord, float spacing) {
|
|
23
|
+
vec2 c = coord / spacing;
|
|
24
|
+
vec2 d = fwidth(c);
|
|
25
|
+
vec2 g = abs(fract(c - 0.5) - 0.5) / max(d, 1e-6);
|
|
26
|
+
float line = min(g.x, g.y);
|
|
27
|
+
return 1.0 - clamp(line, 0.0, 1.0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Index a vec3 by a float axis id (0/1/2) without dynamic indexing (WebGL1-safe).
|
|
31
|
+
float axis(vec3 v, float i) {
|
|
32
|
+
return i < 0.5 ? v.x : (i < 1.5 ? v.y : v.z);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void main() {
|
|
36
|
+
// Pick the two in-plane world coordinates.
|
|
37
|
+
vec2 coord = vec2(axis(vWorldPos, uAxes.x), axis(vWorldPos, uAxes.y));
|
|
38
|
+
|
|
39
|
+
float minor = gridLine(coord, uCell);
|
|
40
|
+
float major = gridLine(coord, uCell * uMajor);
|
|
41
|
+
|
|
42
|
+
vec3 color = mix(uCellColor, uMajorColor, major);
|
|
43
|
+
float alpha = max(minor, major);
|
|
44
|
+
|
|
45
|
+
// Radial fade from the camera-projected center.
|
|
46
|
+
float dist = distance(vWorldPos, uCenter);
|
|
47
|
+
float fade = 1.0 - clamp(dist / uFade, 0.0, 1.0);
|
|
48
|
+
alpha *= fade * fade;
|
|
49
|
+
|
|
50
|
+
if (alpha < 0.001) discard;
|
|
51
|
+
gl_FragColor = vec4(color, alpha);
|
|
52
|
+
}
|
|
53
|
+
`;function Ge(e={}){let{cellSize:r=1,majorEvery:t=10,cellColor:n=8947848,majorColor:a=4473924,fadeDistance:o=100,plane:i="y"}=e,s=i==="y"?new B.Vector2(0,2):i==="z"?new B.Vector2(0,1):new B.Vector2(1,2),l=2.5,c=new B.PlaneGeometry(1,1);i==="y"?c.rotateX(-Math.PI/2):i==="x"&&c.rotateY(Math.PI/2);let u=new B.ShaderMaterial({vertexShader:Ut,fragmentShader:_t,transparent:!0,depthWrite:!1,side:B.DoubleSide,uniforms:{uAxes:{value:s},uCell:{value:r},uMajor:{value:t},uCellColor:{value:new B.Color(n)},uMajorColor:{value:new B.Color(a)},uCenter:{value:new B.Vector3},uFade:{value:o}}}),d=new B.Mesh(c,u);d.name="grid",d.userData.id="grid",d.renderOrder=-1;let m=o,E=o*l,T=new B.Vector3;return{object:d,update:f=>{i==="y"?(d.position.set(f.x,0,f.z),T.set(f.x,0,f.z)):i==="z"?(d.position.set(f.x,f.y,0),T.set(f.x,f.y,0)):(d.position.set(0,f.y,f.z),T.set(0,f.y,f.z)),u.uniforms.uCenter.value.copy(T),d.scale.setScalar(E)},fitToContent:f=>{if(f.isEmpty())return;let x=f.getSize(new B.Vector3),H=(w,p)=>p===0?w.x:p===1?w.y:w.z,g=Math.max(H(x,s.x),H(x,s.y));if(!(g>0)||!Number.isFinite(g))return;let C=20;u.uniforms.uCell.value=kt(g/C),m=g*2,u.uniforms.uFade.value=m,E=m*l},setVisible:f=>{d.visible=f},dispose:()=>{d.removeFromParent(),c.dispose(),u.dispose()}}}var _ViewHelperjs = require('three/addons/helpers/ViewHelper.js');function je(e){let{camera:r,domElement:t,controller:n}=e,a=new (0, _ViewHelperjs.ViewHelper)(r,t);a.setLabels("X","Y","Z");let o=!0,i=128,s=new $.Raycaster,l=new $.OrthographicCamera(-2,2,2,-2,0,4);l.position.set(0,0,2),l.updateMatrixWorld();let c={posX:new $.Vector3(1,0,0),negX:new $.Vector3(-1,0,0),posY:new $.Vector3(0,1,0),negY:new $.Vector3(0,-1,0),posZ:new $.Vector3(0,0,1),negZ:new $.Vector3(0,0,-1)},u=m=>{let E=t.getBoundingClientRect(),T=E.left+t.offsetWidth-i-a.location.right,f=E.top+t.offsetHeight-i-a.location.bottom,x=new $.Vector2((m.clientX-T)/i*2-1,-((m.clientY-f)/i)*2+1);if(Math.abs(x.x)>1||Math.abs(x.y)>1)return null;a.quaternion.copy(r.quaternion).invert(),a.updateMatrixWorld(),s.setFromCamera(x,l);let H=s.intersectObjects(a.children,!1);for(let g of H){let C=_optionalChain([g, 'access', _7 => _7.object, 'access', _8 => _8.userData, 'optionalAccess', _9 => _9.type]);if(typeof C=="string"&&C in c)return C}return null};return{render:m=>{if(!o)return;let E=m.autoClear;m.autoClear=!1,a.render(m),m.autoClear=E},update:()=>{},handleClick:m=>{if(!o)return!1;let E=u(m);return E?(n.getProjection()==="orthographic"&&n.setProjection("perspective"),n.setViewDirection(c[E],!1),!0):!1},isAnimating:!1,setVisible:m=>{o=m},isVisible:()=>o,dispose:()=>a.dispose()}}var _LineSegmentsGeometryjs = require('three/addons/lines/LineSegmentsGeometry.js');var _LineSegments2js = require('three/addons/lines/LineSegments2.js');var _LineMaterialjs = require('three/addons/lines/LineMaterial.js');var de="edge-overlay",jt=2236962,Wt=1.5,$t=44,Yt=.75,Xt=80,We=20,qt=1,Zt=2;function Ye(e,r){let t=Array.isArray(e.material)?e.material:[e.material];for(let n of t)n&&(n.polygonOffset=r,n.polygonOffsetFactor=r?qt:0,n.polygonOffsetUnits=r?Zt:0)}var Te=new WeakMap;function Xe(e,r={}){let t=r.color!=null?new N.Color(r.color):null,n=N.MathUtils.clamp(_nullishCoalesce(r.darken, () => (Yt)),0,1),a=_nullishCoalesce(r.width, () => (Wt)),o=_nullishCoalesce(r.thresholdAngle, () => ($t)),i=_nullishCoalesce(r.distanceFade, () => (!0)),s=new Map,l=u=>{let d=_nullishCoalesce(t, () => (Kt(u,n))),m=d.getHex(),E=s.get(m);return E||(E=en(d,a,i),s.set(m,E)),E},c=[];return e.traverse(u=>{if(!(u instanceof N.Mesh)||u.userData.id==="floor"||u.userData.id==="grid"||u.userData.kind===de||u.children.some(m=>_optionalChain([m, 'access', _10 => _10.userData, 'optionalAccess', _11 => _11.kind])===de)||!u.geometry)return;let d=tn(u.geometry,l(u),o,i);u.add(d),Ye(u,!0),c.push(d)}),c.length===0&&s.forEach(u=>u.dispose()),c}function Kt(e,r){let n=_optionalChain([(Array.isArray(e.material)?e.material[0]:e.material), 'optionalAccess', _12 => _12.color]);return n?n.clone().multiplyScalar(1-r):new N.Color(jt)}function Jt(e,r){let t=Te.get(e);t||(t=new Map,Te.set(e,t));let n=t.get(r);if(!n){let a=new N.EdgesGeometry(e,r),o=new _LineSegmentsGeometryjs.LineSegmentsGeometry;o.setPositions(a.attributes.position.array),a.dispose(),n={geometry:o,refCount:0},t.set(r,n)}return n.refCount+=1,n.geometry}function Qt(e){let r=e.userData,t=r.edgeSource&&Te.get(r.edgeSource),n=r.edgeThresholdAngle!=null?_optionalChain([t, 'optionalAccess', _13 => _13.get, 'call', _14 => _14(r.edgeThresholdAngle)]):void 0;if(!n||n.geometry!==e.geometry){e.geometry.dispose();return}n.refCount-=1,n.refCount<=0&&(n.geometry.dispose(),t.delete(r.edgeThresholdAngle))}function en(e,r,t){let n=new (0, _LineMaterialjs.LineMaterial)({color:e});return n.linewidth=r,t&&(n.transparent=!0),n}function tn(e,r,t,n){let a=Jt(e,t),o=new (0, _LineSegments2js.LineSegments2)(a,r);return o.userData.kind=de,o.userData.edgeSource=e,o.userData.edgeThresholdAngle=t,o.raycast=()=>{},n&&on(o),o}var $e=new N.Vector3,nn=new N.Vector3;function rn(e,r,t){e.geometry.boundingSphere||e.geometry.computeBoundingSphere();let n=e.geometry.boundingSphere;if(!n||n.radius<=0)return 1/0;let a=n.radius*e.matrixWorld.getMaxScaleOnAxis();if($e.copy(n.center).applyMatrix4(e.matrixWorld),r.isPerspectiveCamera){let o=r,i=nn.setFromMatrixPosition(r.matrixWorld).distanceTo($e);if(i<=a)return 1/0;let s=Math.tan(N.MathUtils.degToRad(o.fov)*.5);return a/(i*s)*t}if(r.isOrthographicCamera){let o=r,i=(o.top-o.bottom)/o.zoom;return i>0?2*a/i*t:1/0}return 1/0}function on(e){e.onBeforeRender=(r,t,n)=>{_LineSegments2js.LineSegments2.prototype.onBeforeRender.call(e,r);let a=e.material,o=rn(e,n,a.resolution.y);a.opacity=N.MathUtils.clamp((o-We)/(Xt-We),0,1)}}function an(e){return _optionalChain([e, 'access', _15 => _15.userData, 'optionalAccess', _16 => _16.kind])===de}function po(e){let r=[];e.traverse(n=>{n instanceof _LineSegments2js.LineSegments2&&an(n)&&r.push(n)});let t=new Set;for(let n of r)Qt(n),t.add(n.material),n.parent instanceof N.Mesh&&Ye(n.parent,!1),n.removeFromParent();return t.forEach(n=>n.dispose()),r.length}var _EffectComposerjs = require('three/addons/postprocessing/EffectComposer.js');var _RenderPassjs = require('three/addons/postprocessing/RenderPass.js');var _GTAOPassjs = require('three/addons/postprocessing/GTAOPass.js');var _SMAAPassjs = require('three/addons/postprocessing/SMAAPass.js');var _OutputPassjs = require('three/addons/postprocessing/OutputPass.js');function qe(e,r,t,n,a,o){let i=new (0, _EffectComposerjs.EffectComposer)(e),s=new (0, _RenderPassjs.RenderPass)(r,t);i.addPass(s);let l=new (0, _GTAOPassjs.GTAOPass)(r,t,n,a);l.blendIntensity=_nullishCoalesce(o.aoIntensity, () => (1)),l.updateGtaoMaterial({screenSpaceRadius:!0}),i.addPass(l);let c=new _SMAAPassjs.SMAAPass;i.addPass(c);let u=new _OutputPassjs.OutputPass;i.addPass(u),e.toneMapping=o.toneMapping,e.toneMappingExposure=o.toneMappingExposure;let d=_nullishCoalesce(o.aoPixelRatio, () => (1));return i.setSize(n,a),{render:m=>i.render(m),setSize:(m,E,T)=>{i.setPixelRatio(Math.min(T,d)),i.setSize(m,E)},setCamera:m=>{s.camera=m,l.camera=m;let E=m.isPerspectiveCamera?1:0;l.gtaoMaterial.defines.PERSPECTIVE_CAMERA!==E&&(l.gtaoMaterial.defines.PERSPECTIVE_CAMERA=E,l.gtaoMaterial.needsUpdate=!0)},dispose:()=>{i.dispose(),l.dispose(),c.dispose(),u.dispose()}}}var _CSS2DRendererjs = require('three/addons/renderers/CSS2DRenderer.js');function Ke(e,r){let t=new _CSS2DRendererjs.CSS2DRenderer,n=t.domElement;n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.overflow="hidden",n.style.pointerEvents="none",n.style.zIndex="30",getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.appendChild(n);let a={width:e.clientWidth||1,height:e.clientHeight||1};t.setSize(a.width,a.height);let o=new Ze.Group;o.name="label-layer",o.userData.id="label-layer",r.add(o);let i=new Set;return{addLabel:(l,c,u)=>{let d=document.createElement("div");d.textContent=l,u?d.className=u:Object.assign(d.style,{padding:"2px 6px",borderRadius:"4px",background:"rgba(20, 20, 20, 0.78)",color:"#fff",font:"12px/1.3 system-ui, sans-serif",whiteSpace:"pre",textAlign:"center",userSelect:"none"}),d.style.pointerEvents="none";let m=new (0, _CSS2DRendererjs.CSS2DObject)(d);return m.position.copy(c),o.add(m),i.add(m),{object:m,setPosition:E=>m.position.copy(E),setText:E=>{d.textContent=E},remove:()=>{m.removeFromParent(),d.remove(),i.delete(m)}}},render:(l,c)=>t.render(l,c),setSize:(l,c)=>t.setSize(l,c),dispose:()=>{i.forEach(l=>{l.removeFromParent(),l.element.remove()}),i.clear(),o.removeFromParent(),n.remove()}}}var _Line2js = require('three/addons/lines/Line2.js');var _LineGeometryjs = require('three/addons/lines/LineGeometry.js');var gn=12,yn=16763904,Je=.015,Qe={Millimeters:{metersPerUnit:1/1e3,suffix:"mm"},Centimeters:{metersPerUnit:1/100,suffix:"cm"},Meters:{metersPerUnit:1,suffix:"m"},Inches:{metersPerUnit:1/39.37,suffix:"in"},Feet:{metersPerUnit:1/3.28084,suffix:"ft"}};function bn(e){let r=e&&Qe[e]||Qe.Meters;return t=>`${(t/r.metersPerUnit).toPrecision(3)} ${r.suffix}`}function Tn(e,r){if(e.isOrthographicCamera){let n=e;return Math.abs(n.top-n.bottom)/(n.zoom||1)*Je}return((r?e.position.distanceTo(r):e.position.length())||1)*Je}function Rn(e){let r=e.object;if(r instanceof O.Mesh)return e.face?[e.face.a,e.face.b,e.face.c]:null;if(r instanceof O.Points)return e.index!=null?[e.index]:null;if(r instanceof O.Line){if(e.index==null)return null;let t=r.geometry.index;return t?e.index+1>=t.count?null:[t.getX(e.index),t.getX(e.index+1)]:[e.index,e.index+1]}return null}function Hn(e,r,t,n){let a=e.point.clone(),o=e.object,i=Rn(e);if(!i||!o.geometry)return a;let s=o.geometry.attributes.position;if(!s)return a;let l=m=>{let E=m.clone().project(r);return new O.Vector2((E.x+1)/2*t.width,(1-E.y)/2*t.height)},c=l(a),u=a,d=n;for(let m of i){if(m>=s.count)continue;let T=new O.Vector3().fromBufferAttribute(s,m).applyMatrix4(o.matrixWorld),f=l(T).distanceTo(c);f<d&&(d=f,u=T)}return u}function et(e){let{canvas:r,scene:t,getActiveCamera:n,getViewTarget:a,labelLayer:o,options:i={}}=e,s=_nullishCoalesce(i.snapPixels, () => (gn)),l=new O.Color(_nullishCoalesce(i.color, () => (yn))),c=bn(i.displayUnit),u=(L,M)=>`${c(L)}
|
|
54
|
+
\u0394x ${c(M.x)} \u0394y ${c(M.y)} \u0394z ${c(M.z)}`,d=_nullishCoalesce(i.format, () => (u)),m=new O.Raycaster,E=new O.Vector2,T=!1,f=[],x=[],H=null,g=null,C=new O.PointsMaterial({color:l,size:8,sizeAttenuation:!1,depthTest:!1}),w=new O.PointsMaterial({color:l,size:11,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.5}),p=null,b=L=>{if(!L){p&&(p.visible=!1);return}if(!p){let M=new O.BufferGeometry;M.setAttribute("position",new O.Float32BufferAttribute([0,0,0],3)),p=new O.Points(M,w),p.renderOrder=1e3,p.userData.id="measure",p.raycast=()=>{},t.add(p)}p.position.copy(L),p.visible=!0},R=L=>{let M=new O.BufferGeometry;M.setAttribute("position",new O.Float32BufferAttribute([L.x,L.y,L.z],3));let P=new O.Points(M,C);return P.renderOrder=999,P.userData.id="measure",P.raycast=()=>{},t.add(P),P},v=()=>{f.length=0,x.forEach(L=>{L.geometry.dispose(),L.removeFromParent()}),x.length=0,H&&(H.geometry.dispose(),H.material.dispose(),H.removeFromParent(),H=null),_optionalChain([g, 'optionalAccess', _17 => _17.remove, 'call', _18 => _18()]),g=null},S=()=>{if(f.length!==2)return;let[L,M]=f,P=new _LineGeometryjs.LineGeometry;P.setPositions([L.x,L.y,L.z,M.x,M.y,M.z]);let Q=new (0, _LineMaterialjs.LineMaterial)({color:l});Q.linewidth=2,Q.depthTest=!1,H=new (0, _Line2js.Line2)(P,Q),H.renderOrder=998,H.userData.id="measure",H.raycast=()=>{},t.add(H);let j=L.clone().add(M).multiplyScalar(.5),te=new O.Vector3(Math.abs(M.x-L.x),Math.abs(M.y-L.y),Math.abs(M.z-L.z));g=o.addLabel(d(L.distanceTo(M),te),j,i.labelClassName)},V=L=>{let M=r.getBoundingClientRect();E.x=(L.clientX-M.left)/M.width*2-1,E.y=-((L.clientY-M.top)/M.height)*2+1;let P=n();m.setFromCamera(E,P);let Q=Tn(P,_optionalChain([a, 'optionalCall', _19 => _19()]));m.params.Line.threshold=Q,m.params.Points.threshold=Q;let j=m.intersectObjects(t.children,!0).filter(te=>te.object.userData.id!=="measure"&&te.object.userData.id!=="grid");return j.length===0?null:Hn(j[0],P,{width:M.width,height:M.height},s)},G=null,k=0,X=()=>{k&&(cancelAnimationFrame(k),k=0),G=null};return{setEnabled:L=>{T=L,L||(X(),v(),b(null))},isEnabled:()=>T,handleClick:L=>{if(!T)return!1;f.length===2&&v();let M=V(L);return M===null||(f.push(M),x.push(R(M)),f.length===2&&S()),!0},handleMove:L=>{T&&(G=L,!k&&(k=requestAnimationFrame(()=>{k=0;let M=G;G=null,!(!T||!M)&&b(V(M))})))},clear:v,dispose:()=>{X(),v(),p&&(p.geometry.dispose(),p.removeFromParent(),p=null),C.dispose(),w.dispose()}}}var xn=64,vn=256,q=new Map,ie=new Map,me=0,fe=class extends Error{constructor(r){super(`Texture load for ${r} resolved after clearTextureCache(); texture disposed.`),this.name="StaleTextureLoadError"}},pe=1;function tt(e){pe=Math.max(1,e);for(let r of q.values())r.anisotropy!==pe&&(r.anisotropy=pe,r.needsUpdate=!0)}function nt(e,r){let t=Cn(r),n=q.get(t);if(n){q.delete(t),q.set(t,n),e.map=n,e.needsUpdate=!0;return}typeof document>"u"||An(r,t).then(a=>{e.map=a,e.needsUpdate=!0}).catch(a=>{a instanceof fe||_chunkH3FZW6OXcjs.e.call(void 0, ).warn(`Failed to load material texture ${r}:`,a)})}function Ao(){me++;for(let e of q.values())e.dispose();q.clear(),ie.clear()}function Cn(e){return e.length<=vn?e:`data-uri:${wn(e).toString(16)}:${e.length}`}function wn(e){let r=2166136261;for(let t=0;t<e.length;t++)r^=e.charCodeAt(t),r=Math.imul(r,16777619);return r>>>0}function Mn(e,r){for(q.set(e,r);q.size>xn;){let t=q.keys().next().value,n=q.get(t);q.delete(t),n.dispose()}}function An(e,r){let t=ie.get(r);if(!t){let n=me;t=new Promise((a,o)=>{new Ee.TextureLoader().load(e,i=>{if(n!==me){i.dispose(),o(new fe(e));return}i.colorSpace=Ee.SRGBColorSpace,i.anisotropy=pe,Mn(r,i),ie.delete(r),a(i)},void 0,i=>{n===me&&ie.delete(r),o(i)})}),ie.set(r,t)}return t}var _OrbitControlsjs = require('three/addons/controls/OrbitControls.js');var _HDRLoaderjs = require('three/addons/loaders/HDRLoader.js');var Sn=.5,Ln=.01,In=.05;function rt({camera:e,scene:r,groundNormals:t=[]}){let n=e.near,a=e.near,o=new se.Vector3,i=new se.Vector3;return{update:()=>{e.near!==a&&(n=e.near);let l=ee(r),c=n;if(!l.isEmpty()){let u=l.getSize(i).length()*.5,d=e.position.distanceTo(l.getCenter(o))-u;for(let m of t)d=Math.min(d,Math.abs(e.position.dot(m)));c=se.MathUtils.clamp(d*Sn,n,e.far*Ln)}Math.abs(c-a)>a*In&&(e.near=c,e.updateProjectionMatrix(),a=c)}}}var ae=new h.Vector3(0,0,1),Pn="technical",He={studio:{toneMapping:h.ACESFilmicToneMapping,toneMappingExposure:1,envMapIntensity:1,environmentIntensity:1,hemisphereIntensity:.75,ambientIntensity:.4,cullBackfaces:!1,ambientOcclusion:!1},technical:{toneMapping:h.NeutralToneMapping,toneMappingExposure:1,envMapIntensity:.9,environmentIntensity:1,hemisphereIntensity:.35,ambientIntensity:.25,cullBackfaces:!1,ambientOcclusion:!1},showcase:{toneMapping:h.ACESFilmicToneMapping,toneMappingExposure:1.15,envMapIntensity:1.4,environmentIntensity:1.25,hemisphereIntensity:.35,ambientIntensity:.15,cullBackfaces:!1,ambientOcclusion:!1}};function Fn(e){let r=He[e];return{envMapIntensity:r.envMapIntensity,cullBackfaces:r.cullBackfaces}}function Vn(e){let r=Math.abs(e.x),t=Math.abs(e.y),n=Math.abs(e.z);return n>=r&&n>=t?"z":t>=r&&t>=n?"y":"x"}var Wo=function(e,r){let t=Bn(r||{}),n=_optionalChain([t, 'access', _20 => _20.environment, 'optionalAccess', _21 => _21.sceneUp])||ae,a=_nullishCoalesce(t.render.pixelRatio, () => (Math.min(window.devicePixelRatio,2))),o=Un(t),i=jn(t,e);i.up.copy(n);let s=Wn(e,t,a);tt(s.capabilities.getMaxAnisotropy());let l=Yn(i,e,t),c=Ne({scene:o,perspective:i,controls:l,onActiveCameraChange:()=>{},up:n}),u=()=>c.getActiveCamera(),d=!1;zn(o,s,t,()=>d);let m=Nn(o,t),E=m.sun,T=()=>{E&&kn(E,ee(o))};_optionalChain([t, 'access', _22 => _22.floor, 'optionalAccess', _23 => _23.enabled])&&Gn(o,t);let f=t.grid.enabled?Ge({cellSize:t.grid.cellSize,majorEvery:t.grid.majorEvery,cellColor:t.grid.cellColor,majorColor:t.grid.majorColor,fadeDistance:t.grid.fadeDistance,plane:t.grid.plane}):null;f&&o.add(f.object);let x=()=>{f&&f.fitToContent(ee(o))},H=t.gizmo.enabled?je({camera:i,domElement:e,controller:c}):null,g=[];if(f){let y=_nullishCoalesce(t.grid.plane, () => ("z"));g.push(new h.Vector3(y==="x"?1:0,y==="y"?1:0,y==="z"?1:0))}t.floor.enabled&&g.push(n.clone().normalize());let C=t.camera.dynamicNear?rt({camera:i,scene:o,groundNormals:g}):null,w=_nullishCoalesce(e.parentElement, () => (e)),p=t.measure.enabled?Ke(w,o):null,b=t.measure.enabled&&p?et({canvas:e,scene:o,getActiveCamera:u,labelLayer:p,options:{snapPixels:t.measure.snapPixels,color:t.measure.color,labelClassName:t.measure.labelClassName,displayUnit:t.measure.displayUnit,format:t.measure.format}}):null,R=t.events.enableEventHandlers!==!1?$n(e,o,c,t):{dispose:()=>{},fitToView:()=>{},clearSelection:()=>{}},v=5,S=0,V=0,G=y=>{S=y.clientX,V=y.clientY},k=y=>Math.hypot(y.clientX-S,y.clientY-V)>v,X=y=>{if(!k(y)){if(_optionalChain([b, 'optionalAccess', _24 => _24.handleClick, 'call', _25 => _25(y)])){y.stopImmediatePropagation();return}_optionalChain([H, 'optionalAccess', _26 => _26.handleClick, 'call', _27 => _27(y)])&&y.stopImmediatePropagation()}};(H||b)&&(e.addEventListener("mousedown",G,{capture:!0}),e.addEventListener("click",X,{capture:!0}));let ne=y=>_optionalChain([b, 'optionalAccess', _28 => _28.handleMove, 'call', _29 => _29(y)]);b&&e.addEventListener("mousemove",ne,{passive:!0});let J=y=>{Xe(y,{color:t.edges.color,darken:t.edges.darken,width:t.edges.width,thresholdAngle:t.edges.thresholdAngle,distanceFade:t.edges.distanceFade})},L=e.parentElement,M=()=>L?{width:L.clientWidth,height:L.clientHeight}:{width:window.innerWidth,height:window.innerHeight},P=null,Q=()=>{let{width:y,height:I}=M(),W=qe(s,o,u(),Math.max(1,y),Math.max(1,I),{toneMapping:_nullishCoalesce(t.render.toneMapping, () => (h.NeutralToneMapping)),toneMappingExposure:_nullishCoalesce(t.render.toneMappingExposure, () => (1)),aoIntensity:t.render.aoIntensity,aoPixelRatio:t.render.aoPixelRatio});return W.setSize(Math.max(1,y),Math.max(1,I),a),W},j=y=>{y&&!P?P=Q():!y&&P&&(P.dispose(),P=null)};t.render.ambientOcclusion&&(P=Q());let te=y=>{y.ambientIntensity!==void 0&&(m.ambient.intensity=y.ambientIntensity),y.hemisphereIntensity!==void 0&&!m.hemisphere&&y.hemisphereIntensity>0&&(m.hemisphere=new h.HemisphereLight(_nullishCoalesce(y.hemisphereSkyColor, () => (t.lighting.hemisphereSkyColor)),_nullishCoalesce(y.hemisphereGroundColor, () => (t.lighting.hemisphereGroundColor)),y.hemisphereIntensity),m.hemisphere.position.copy(_nullishCoalesce(t.environment.sceneUp, () => (ae))),o.add(m.hemisphere)),m.hemisphere&&(y.hemisphereIntensity!==void 0&&(m.hemisphere.intensity=y.hemisphereIntensity),y.hemisphereSkyColor!==void 0&&m.hemisphere.color.set(y.hemisphereSkyColor),y.hemisphereGroundColor!==void 0&&m.hemisphere.groundColor.set(y.hemisphereGroundColor))},Ae=y=>{t.environment.environmentIntensity=y,o.environmentIntensity=y},yt=y=>{t.render.toneMappingExposure=y,s.toneMappingExposure=y,P&&(j(!1),j(!0))},bt=y=>{t.render.aoIntensity=y,P&&(j(!1),j(!0))},Tt=y=>{let I=He[y];Se=y,s.toneMapping=I.toneMapping,s.toneMappingExposure=I.toneMappingExposure,t.render.toneMapping=I.toneMapping,t.render.toneMappingExposure=I.toneMappingExposure,te({hemisphereIntensity:I.hemisphereIntensity,ambientIntensity:I.ambientIntensity}),Ae(I.environmentIntensity),P&&j(!1),j(I.ambientOcclusion),o.traverse(W=>{if(W.userData.source!=="compute")return;let ue=W,Mt=Array.isArray(ue.material)?ue.material:ue.material?[ue.material]:[];for(let Ie of Mt)"envMapIntensity"in Ie&&(Ie.envMapIntensity=I.envMapIntensity)})},Se=t.look,Rt=()=>Fn(Se),{animate:Ht,dispose:xt}=_n(s,o,i,u,c,l,M,a,t.events.onFrame,f,H,()=>P,p,C);Ht(),o.up.set(n.x,n.y,n.z),T(),x();let Le=y=>{y.traverse(I=>{let W=I;!W.geometry&&!W.material||(_optionalChain([W, 'access', _30 => _30.geometry, 'optionalAccess', _31 => _31.dispose, 'call', _32 => _32()]),Array.isArray(W.material)?W.material.forEach(he):W.material&&he(W.material))})},vt=y=>{y.userData.source="user",o.add(y)},Ct=y=>{y.removeFromParent(),Le(y)},wt=()=>{o.children.filter(I=>I.userData.source==="user").forEach(I=>{I.removeFromParent(),Le(I)})};return{scene:o,camera:i,controls:l,renderer:s,cameraController:c,grid:f,gizmo:H,measureTool:b,applyEdges:J,setAmbientOcclusion:j,setLook:Tt,setFillLights:te,setEnvironmentIntensity:Ae,setToneMappingExposure:yt,setAoIntensity:bt,getMaterialAppearance:Rt,updateShadowBounds:T,updateGridScale:x,dispose:()=>{d||(d=!0,xt(),R.dispose(),(H||b)&&(e.removeEventListener("mousedown",G,{capture:!0}),e.removeEventListener("click",X,{capture:!0})),b&&e.removeEventListener("mousemove",ne),_optionalChain([b, 'optionalAccess', _33 => _33.dispose, 'call', _34 => _34()]),_optionalChain([p, 'optionalAccess', _35 => _35.dispose, 'call', _36 => _36()]),_optionalChain([H, 'optionalAccess', _37 => _37.dispose, 'call', _38 => _38()]),_optionalChain([f, 'optionalAccess', _39 => _39.dispose, 'call', _40 => _40()]),_optionalChain([P, 'optionalAccess', _41 => _41.dispose, 'call', _42 => _42()]),c.dispose(),l.dispose(),s.dispose(),s.forceContextLoss(),o.traverse(y=>{let I=y;!I.geometry&&!I.material||(_optionalChain([I, 'access', _43 => _43.geometry, 'optionalAccess', _44 => _44.dispose, 'call', _45 => _45()]),Array.isArray(I.material)?I.material.forEach(he):I.material&&he(I.material))}),_optionalChain([o, 'access', _46 => _46.environment, 'optionalAccess', _47 => _47.dispose, 'call', _48 => _48()]),o.background instanceof h.Texture&&o.background.dispose())},fitToView:R.fitToView,clearSelection:R.clearSelection,addUserGeometry:vt,removeUserGeometry:Ct,clearUserGeometry:wt}};function Bn(e){let r=e.sceneScale||"m",n={mm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:10,lightHeight:20,minDistance:.1,shadowSize:100,scaleFactor:1e3},cm:{cameraDistance:20,near:.1,far:2e3,floorSize:100,lightDistance:25,lightHeight:50,minDistance:.1,shadowSize:100,scaleFactor:100},m:{cameraDistance:10,near:.01,far:2e3,floorSize:50,lightDistance:25,lightHeight:50,minDistance:.001,shadowSize:100,scaleFactor:1},inches:{cameraDistance:15,near:.1,far:2e3,floorSize:80,lightDistance:20,lightHeight:40,minDistance:.1,shadowSize:80,scaleFactor:39.37},feet:{cameraDistance:8,near:.1,far:2e3,floorSize:40,lightDistance:15,lightHeight:30,minDistance:.1,shadowSize:60,scaleFactor:3.28084}}[r],a=_nullishCoalesce(e.look, () => (Pn)),o=He[a];return{sceneScale:r,look:a,camera:{position:_optionalChain([e, 'access', _49 => _49.camera, 'optionalAccess', _50 => _50.position])||new h.Vector3(-n.cameraDistance,-n.cameraDistance,n.cameraDistance),fov:_optionalChain([e, 'access', _51 => _51.camera, 'optionalAccess', _52 => _52.fov])||20,near:_optionalChain([e, 'access', _53 => _53.camera, 'optionalAccess', _54 => _54.near])||n.near,far:_optionalChain([e, 'access', _55 => _55.camera, 'optionalAccess', _56 => _56.far])||n.far,target:_optionalChain([e, 'access', _57 => _57.camera, 'optionalAccess', _58 => _58.target])||new h.Vector3(0,0,0),dynamicNear:_nullishCoalesce(_optionalChain([e, 'access', _59 => _59.camera, 'optionalAccess', _60 => _60.dynamicNear]), () => (!0))},lighting:{enableSunlight:_nullishCoalesce(_optionalChain([e, 'access', _61 => _61.lighting, 'optionalAccess', _62 => _62.enableSunlight]), () => (!0)),sunlightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _63 => _63.lighting, 'optionalAccess', _64 => _64.sunlightIntensity]), () => (1)),sunlightPosition:_optionalChain([e, 'access', _65 => _65.lighting, 'optionalAccess', _66 => _66.sunlightPosition])||new h.Vector3(n.lightDistance,n.lightDistance,n.lightHeight),ambientLightColor:_optionalChain([e, 'access', _67 => _67.lighting, 'optionalAccess', _68 => _68.ambientLightColor])||new h.Color(4210752),ambientLightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _69 => _69.lighting, 'optionalAccess', _70 => _70.ambientLightIntensity]), () => (o.ambientIntensity)),sunlightColor:_optionalChain([e, 'access', _71 => _71.lighting, 'optionalAccess', _72 => _72.sunlightColor])||16777215,enableHemisphereLight:_nullishCoalesce(_optionalChain([e, 'access', _73 => _73.lighting, 'optionalAccess', _74 => _74.enableHemisphereLight]), () => (o.hemisphereIntensity>0)),hemisphereSkyColor:_nullishCoalesce(_optionalChain([e, 'access', _75 => _75.lighting, 'optionalAccess', _76 => _76.hemisphereSkyColor]), () => (14673663)),hemisphereGroundColor:_nullishCoalesce(_optionalChain([e, 'access', _77 => _77.lighting, 'optionalAccess', _78 => _78.hemisphereGroundColor]), () => (7036754)),hemisphereIntensity:_nullishCoalesce(_optionalChain([e, 'access', _79 => _79.lighting, 'optionalAccess', _80 => _80.hemisphereIntensity]), () => (o.hemisphereIntensity))},environment:{hdrPath:_optionalChain([e, 'access', _81 => _81.environment, 'optionalAccess', _82 => _82.hdrPath])||"/baseHDR.hdr",backgroundColor:_optionalChain([e, 'access', _83 => _83.environment, 'optionalAccess', _84 => _84.backgroundColor])||new h.Color(15790320),enableEnvironmentLighting:_nullishCoalesce(_optionalChain([e, 'access', _85 => _85.environment, 'optionalAccess', _86 => _86.enableEnvironmentLighting]), () => (!0)),sceneUp:_optionalChain([e, 'access', _87 => _87.environment, 'optionalAccess', _88 => _88.sceneUp])||ae,showEnvironment:_nullishCoalesce(_optionalChain([e, 'access', _89 => _89.environment, 'optionalAccess', _90 => _90.showEnvironment]), () => (!1)),environmentIntensity:_nullishCoalesce(_optionalChain([e, 'access', _91 => _91.environment, 'optionalAccess', _92 => _92.environmentIntensity]), () => (o.environmentIntensity))},floor:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _93 => _93.floor, 'optionalAccess', _94 => _94.enabled]), () => (!1)),size:_optionalChain([e, 'access', _95 => _95.floor, 'optionalAccess', _96 => _96.size])||n.floorSize,color:_optionalChain([e, 'access', _97 => _97.floor, 'optionalAccess', _98 => _98.color])||new h.Color(8421504),roughness:_nullishCoalesce(_optionalChain([e, 'access', _99 => _99.floor, 'optionalAccess', _100 => _100.roughness]), () => (.7)),metalness:_nullishCoalesce(_optionalChain([e, 'access', _101 => _101.floor, 'optionalAccess', _102 => _102.metalness]), () => (0)),receiveShadow:_nullishCoalesce(_optionalChain([e, 'access', _103 => _103.floor, 'optionalAccess', _104 => _104.receiveShadow]), () => (!0))},render:{enableShadows:_nullishCoalesce(_optionalChain([e, 'access', _105 => _105.render, 'optionalAccess', _106 => _106.enableShadows]), () => (!0)),shadowMapSize:_optionalChain([e, 'access', _107 => _107.render, 'optionalAccess', _108 => _108.shadowMapSize])||2048,antialias:_nullishCoalesce(_optionalChain([e, 'access', _109 => _109.render, 'optionalAccess', _110 => _110.antialias]), () => (!0)),pixelRatio:_optionalChain([e, 'access', _111 => _111.render, 'optionalAccess', _112 => _112.pixelRatio])||Math.min(window.devicePixelRatio,2),toneMapping:_nullishCoalesce(_optionalChain([e, 'access', _113 => _113.render, 'optionalAccess', _114 => _114.toneMapping]), () => (o.toneMapping)),toneMappingExposure:_nullishCoalesce(_optionalChain([e, 'access', _115 => _115.render, 'optionalAccess', _116 => _116.toneMappingExposure]), () => (o.toneMappingExposure)),preserveDrawingBuffer:_nullishCoalesce(_optionalChain([e, 'access', _117 => _117.render, 'optionalAccess', _118 => _118.preserveDrawingBuffer]), () => (!1)),ambientOcclusion:_nullishCoalesce(_optionalChain([e, 'access', _119 => _119.render, 'optionalAccess', _120 => _120.ambientOcclusion]), () => (o.ambientOcclusion)),aoIntensity:_nullishCoalesce(_optionalChain([e, 'access', _121 => _121.render, 'optionalAccess', _122 => _122.aoIntensity]), () => (1)),aoPixelRatio:_nullishCoalesce(_optionalChain([e, 'access', _123 => _123.render, 'optionalAccess', _124 => _124.aoPixelRatio]), () => (1))},controls:{enableDamping:_nullishCoalesce(_optionalChain([e, 'access', _125 => _125.controls, 'optionalAccess', _126 => _126.enableDamping]), () => (!1)),dampingFactor:_optionalChain([e, 'access', _127 => _127.controls, 'optionalAccess', _128 => _128.dampingFactor])||.05,autoRotate:_nullishCoalesce(_optionalChain([e, 'access', _129 => _129.controls, 'optionalAccess', _130 => _130.autoRotate]), () => (!1)),autoRotateSpeed:_optionalChain([e, 'access', _131 => _131.controls, 'optionalAccess', _132 => _132.autoRotateSpeed])||.5,enableZoom:_nullishCoalesce(_optionalChain([e, 'access', _133 => _133.controls, 'optionalAccess', _134 => _134.enableZoom]), () => (!0)),enablePan:_nullishCoalesce(_optionalChain([e, 'access', _135 => _135.controls, 'optionalAccess', _136 => _136.enablePan]), () => (!0)),minDistance:_optionalChain([e, 'access', _137 => _137.controls, 'optionalAccess', _138 => _138.minDistance])||n.minDistance,maxDistance:_optionalChain([e, 'access', _139 => _139.controls, 'optionalAccess', _140 => _140.maxDistance])||1/0},grid:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _141 => _141.grid, 'optionalAccess', _142 => _142.enabled]), () => (!1)),cellSize:_nullishCoalesce(_optionalChain([e, 'access', _143 => _143.grid, 'optionalAccess', _144 => _144.cellSize]), () => (1)),majorEvery:_nullishCoalesce(_optionalChain([e, 'access', _145 => _145.grid, 'optionalAccess', _146 => _146.majorEvery]), () => (10)),cellColor:_nullishCoalesce(_optionalChain([e, 'access', _147 => _147.grid, 'optionalAccess', _148 => _148.cellColor]), () => (8947848)),majorColor:_nullishCoalesce(_optionalChain([e, 'access', _149 => _149.grid, 'optionalAccess', _150 => _150.majorColor]), () => (4473924)),fadeDistance:_nullishCoalesce(_optionalChain([e, 'access', _151 => _151.grid, 'optionalAccess', _152 => _152.fadeDistance]), () => (100)),plane:_nullishCoalesce(_optionalChain([e, 'access', _153 => _153.grid, 'optionalAccess', _154 => _154.plane]), () => (Vn(_nullishCoalesce(_optionalChain([e, 'access', _155 => _155.environment, 'optionalAccess', _156 => _156.sceneUp]), () => (ae)))))},gizmo:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _157 => _157.gizmo, 'optionalAccess', _158 => _158.enabled]), () => (!1))},edges:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _159 => _159.edges, 'optionalAccess', _160 => _160.enabled]), () => (!1)),color:_optionalChain([e, 'access', _161 => _161.edges, 'optionalAccess', _162 => _162.color]),darken:_optionalChain([e, 'access', _163 => _163.edges, 'optionalAccess', _164 => _164.darken]),width:_nullishCoalesce(_optionalChain([e, 'access', _165 => _165.edges, 'optionalAccess', _166 => _166.width]), () => (1.5)),thresholdAngle:_nullishCoalesce(_optionalChain([e, 'access', _167 => _167.edges, 'optionalAccess', _168 => _168.thresholdAngle]), () => (44)),distanceFade:_nullishCoalesce(_optionalChain([e, 'access', _169 => _169.edges, 'optionalAccess', _170 => _170.distanceFade]), () => (!0))},measure:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _171 => _171.measure, 'optionalAccess', _172 => _172.enabled]), () => (!1)),snapPixels:_optionalChain([e, 'access', _173 => _173.measure, 'optionalAccess', _174 => _174.snapPixels]),color:_optionalChain([e, 'access', _175 => _175.measure, 'optionalAccess', _176 => _176.color]),labelClassName:_optionalChain([e, 'access', _177 => _177.measure, 'optionalAccess', _178 => _178.labelClassName]),displayUnit:_optionalChain([e, 'access', _179 => _179.measure, 'optionalAccess', _180 => _180.displayUnit]),format:_optionalChain([e, 'access', _181 => _181.measure, 'optionalAccess', _182 => _182.format])},events:{onBackgroundClicked:_optionalChain([e, 'access', _183 => _183.events, 'optionalAccess', _184 => _184.onBackgroundClicked]),onObjectSelected:_optionalChain([e, 'access', _185 => _185.events, 'optionalAccess', _186 => _186.onObjectSelected]),onMeshMetadataClicked:_optionalChain([e, 'access', _187 => _187.events, 'optionalAccess', _188 => _188.onMeshMetadataClicked]),onMeshDoubleClicked:_optionalChain([e, 'access', _189 => _189.events, 'optionalAccess', _190 => _190.onMeshDoubleClicked]),selectionColor:_optionalChain([e, 'access', _191 => _191.events, 'optionalAccess', _192 => _192.selectionColor])||"#ff0000",enableEventHandlers:_nullishCoalesce(_optionalChain([e, 'access', _193 => _193.events, 'optionalAccess', _194 => _194.enableEventHandlers]), () => (!0)),enableKeyboardControls:_nullishCoalesce(_optionalChain([e, 'access', _195 => _195.events, 'optionalAccess', _196 => _196.enableKeyboardControls]), () => (!0)),enableClickToFocus:_nullishCoalesce(_optionalChain([e, 'access', _197 => _197.events, 'optionalAccess', _198 => _198.enableClickToFocus]), () => (!0)),enableDoubleClickZoom:_nullishCoalesce(_optionalChain([e, 'access', _199 => _199.events, 'optionalAccess', _200 => _200.enableDoubleClickZoom]), () => (!0)),onReady:_optionalChain([e, 'access', _201 => _201.events, 'optionalAccess', _202 => _202.onReady]),onFrame:_optionalChain([e, 'access', _203 => _203.events, 'optionalAccess', _204 => _204.onFrame])}}}function he(e){for(let r of Object.values(e))r instanceof h.Texture&&r.dispose();e.dispose()}function kn(e,r){if(r.isEmpty())return;let t=r.getCenter(new h.Vector3),n=r.getSize(new h.Vector3).length()*.5*1.2,a=e.shadow.camera;a.left=-n,a.right=n,a.top=n,a.bottom=-n,e.target.position.copy(t),e.target.updateMatrixWorld();let o=e.position.distanceTo(t);a.near=Math.max(n*.01,o-n),a.far=o+n,a.updateProjectionMatrix()}function Un(e){let r=new h.Scene,t=typeof e.environment.backgroundColor=="string"?new h.Color(e.environment.backgroundColor):e.environment.backgroundColor;return r.background=t||null,r}function _n(e,r,t,n,a,o,i,s,l,c,u,d,m,E){let T=null,f=performance.now(),x=()=>{let{width:C,height:w}=i();if(C===0||w===0)return;let p=Math.floor(C*s),b=Math.floor(w*s);(e.domElement.width!==p||e.domElement.height!==b)&&(e.setPixelRatio(s),e.setSize(C,w,!1),t.aspect=C/w,t.updateProjectionMatrix(),a.updateAspect(C,w),_optionalChain([d, 'optionalCall', _205 => _205(), 'optionalAccess', _206 => _206.setSize, 'call', _207 => _207(C,w,s)]),_optionalChain([m, 'optionalAccess', _208 => _208.setSize, 'call', _209 => _209(C,w)]))},H=function(){T=requestAnimationFrame(H);let C=performance.now(),w=(C-f)/1e3;f=C,x(),(o.enableDamping||o.autoRotate)&&o.update(),c&&c.update(n().position),u&&u.update(w),E&&E.update(),_optionalChain([l, 'optionalCall', _210 => _210(w)]);let p=n(),b=_optionalChain([d, 'optionalCall', _211 => _211()]);b?(b.setCamera(p),b.render(w)):e.render(r,p),m&&m.render(r,p),u&&u.render(e)};return{animate:H,dispose:()=>{T!==null&&(cancelAnimationFrame(T),T=null)}}}function zn(e,r,t,n){t.environment.enableEnvironmentLighting?new (0, _HDRLoaderjs.HDRLoader)().load(t.environment.hdrPath||"/baseHDR.hdr",function(a){if(n()){a.dispose();return}if(!_optionalChain([a, 'optionalAccess', _212 => _212.image])){_chunkH3FZW6OXcjs.e.call(void 0, ).warn("HDR loaded without image data; skipping environment map."),_optionalChain([a, 'optionalAccess', _213 => _213.dispose, 'call', _214 => _214()]),_optionalChain([t, 'access', _215 => _215.events, 'access', _216 => _216.onReady, 'optionalCall', _217 => _217()]);return}a.mapping=h.EquirectangularReflectionMapping;let o=new h.PMREMGenerator(r);o.compileEquirectangularShader();let i=o.fromEquirectangular(a).texture;o.dispose(),e.environment=i,e.environmentIntensity=_nullishCoalesce(t.environment.environmentIntensity, () => (1)),t.environment.showEnvironment?e.background=a:a.dispose(),_optionalChain([t, 'access', _218 => _218.events, 'access', _219 => _219.onReady, 'optionalCall', _220 => _220()])},void 0,function(a){n()||(_chunkH3FZW6OXcjs.e.call(void 0, ).warn("HDR texture could not be loaded, falling back to basic lighting:",a),_optionalChain([t, 'access', _221 => _221.events, 'access', _222 => _222.onReady, 'optionalCall', _223 => _223()]))}):_optionalChain([t, 'access', _224 => _224.events, 'access', _225 => _225.onReady, 'optionalCall', _226 => _226()])}function Nn(e,r){let t=new h.AmbientLight(r.lighting.ambientLightColor,r.lighting.ambientLightIntensity);e.add(t);let n=null;if(r.lighting.enableHemisphereLight){n=new h.HemisphereLight(r.lighting.hemisphereSkyColor,r.lighting.hemisphereGroundColor,r.lighting.hemisphereIntensity);let i=_nullishCoalesce(r.environment.sceneUp, () => (ae));n.position.copy(i),e.add(n)}if(!r.lighting.enableSunlight)return{ambient:t,hemisphere:n,sun:null};let a=new h.DirectionalLight(_nullishCoalesce(r.lighting.sunlightColor, () => (16777215)),r.lighting.sunlightIntensity),o=r.lighting.sunlightPosition;return o&&a.position.set(o.x,o.y,o.z),r.render.enableShadows?(a.castShadow=!0,a.shadow.mapSize.width=r.render.shadowMapSize||2048,a.shadow.mapSize.height=r.render.shadowMapSize||2048,a.shadow.bias=-1e-4,a.shadow.normalBias=.02,a.shadow.radius=4,e.add(a),e.add(a.target),{ambient:t,hemisphere:n,sun:a}):(e.add(a),{ambient:t,hemisphere:n,sun:null})}function Gn(e,r){let t=r.floor.size,n=new h.PlaneGeometry(t,t),a=typeof r.floor.color=="string"?new h.Color(r.floor.color):r.floor.color,o=new h.MeshStandardMaterial({color:a,roughness:r.floor.roughness,metalness:r.floor.metalness,side:h.DoubleSide}),i=new h.Mesh(n,o);i.userData.id="floor",i.name="floor";let s=(_optionalChain([r, 'access', _227 => _227.environment, 'optionalAccess', _228 => _228.sceneUp])||ae).clone().normalize();i.quaternion.setFromUnitVectors(new h.Vector3(0,0,1),s),i.position.set(0,0,0),r.floor.receiveShadow&&r.render.enableShadows&&(i.receiveShadow=!0),e.add(i)}function jn(e,r){let t=r.parentElement,n=t?t.clientWidth:window.innerWidth,a=t?t.clientHeight:window.innerHeight,o=new h.PerspectiveCamera(e.camera.fov,n/a,e.camera.near,e.camera.far),i=e.camera.position;return i&&o.position.set(i.x,i.y,i.z),o}function Wn(e,r,t){let n=new h.WebGLRenderer({antialias:r.render.antialias,canvas:e,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:r.render.preserveDrawingBuffer,logarithmicDepthBuffer:!1}),a=e.parentElement,o=a?a.clientWidth:window.innerWidth,i=a?a.clientHeight:window.innerHeight;return a&&(e.style.width="100%",e.style.height="100%",e.style.display="block"),n.setSize(o,i,!1),n.setPixelRatio(t),r.render.enableShadows&&(n.shadowMap.enabled=!0,n.shadowMap.type=h.VSMShadowMap),n.toneMapping=r.render.toneMapping,n.toneMappingExposure=_nullishCoalesce(r.render.toneMappingExposure, () => (1)),n.outputColorSpace=h.SRGBColorSpace,n.sortObjects=!0,n}function $n(e,r,t,n){let a=new Set,o=new Map,i=new h.Raycaster,s=new h.Vector2,l=new h.Vector2,c=()=>t.getActiveCamera(),u=p=>{let b=p;for(;b;){if(!b.visible)return!1;b=b.parent}return!0},d=()=>{let p=ee(r);if(p.isEmpty()){_chunkH3FZW6OXcjs.e.call(void 0, ).warn("No objects to fit to view");return}t.frameBounds(p,!1)},m=typeof n.events.selectionColor=="string"?new h.Color(n.events.selectionColor):n.events.selectionColor instanceof h.Color?n.events.selectionColor:new h.Color("#ff0000"),E=()=>{a.forEach(p=>{let b=p;if(o.has(p)){let R=o.get(p),v=b.material;v instanceof h.Material?v.dispose():Array.isArray(v)&&v.forEach(V=>V.dispose()),b.material=R,o.delete(p);let S=p;for(;S.parent;)S=S.parent;S!==r&&(R instanceof h.Material?R.dispose():R.forEach(V=>V.dispose()))}}),a.clear()},T=p=>{let b=p;if(!(b.material instanceof h.Material))return!1;o.set(p,b.material);let R=b.material.clone();return p instanceof h.Mesh&&"emissive"in R?R.emissive=m.clone():"color"in R&&(R.color=m.clone()),b.material=R,!0},f=()=>{let p=ee(r),b=p.isEmpty()?1:p.getSize(new h.Vector3).length();i.params.Points.threshold=b*.01},x=p=>{l.set(p.clientX,p.clientY)},H=p=>{let b=new h.Vector2(p.clientX,p.clientY);if(l.distanceTo(b)>5)return;let R=e.getBoundingClientRect();s.x=(p.clientX-R.left)/R.width*2-1,s.y=-((p.clientY-R.top)/R.height)*2+1,f(),i.setFromCamera(s,c());let v=i.intersectObjects(r.children,!0).filter(S=>u(S.object));if(v.length>0){let S=v[0].object;a.has(S)||(E(),a.add(S),T(S),_optionalChain([n, 'access', _229 => _229.events, 'optionalAccess', _230 => _230.onObjectSelected, 'optionalCall', _231 => _231(S)]),S instanceof h.Mesh&&Object.keys(S.userData).length>0&&_optionalChain([n, 'access', _232 => _232.events, 'optionalAccess', _233 => _233.onMeshMetadataClicked, 'optionalCall', _234 => _234(S.userData)]))}else E(),_optionalChain([n, 'access', _235 => _235.events, 'optionalAccess', _236 => _236.onBackgroundClicked, 'optionalCall', _237 => _237({x:s.x,y:s.y})])},g=p=>{let b=e.getBoundingClientRect();s.x=(p.clientX-b.left)/b.width*2-1,s.y=-((p.clientY-b.top)/b.height)*2+1,f(),i.setFromCamera(s,c());let R=i.intersectObjects(r.children,!0).filter(V=>u(V.object));if(R.length===0)return;let v=R[0].object;if(_optionalChain([n, 'access', _238 => _238.events, 'optionalAccess', _239 => _239.onMeshDoubleClicked, 'optionalCall', _240 => _240(v)]),!_optionalChain([n, 'access', _241 => _241.events, 'optionalAccess', _242 => _242.enableDoubleClickZoom]))return;let S=new h.Box3().setFromObject(v);S.isEmpty()||t.frameBounds(S,!0)},C=p=>{if(_optionalChain([n, 'access', _243 => _243.events, 'optionalAccess', _244 => _244.enableKeyboardControls]))switch(p.key.toLowerCase()){case"f":p.preventDefault(),d();break;case"escape":p.preventDefault(),E();break;case" ":p.preventDefault(),d();break}};return _optionalChain([n, 'access', _245 => _245.events, 'optionalAccess', _246 => _246.enableClickToFocus])&&(e.addEventListener("mousedown",x),e.addEventListener("click",H),e.addEventListener("dblclick",g)),_optionalChain([n, 'access', _247 => _247.events, 'optionalAccess', _248 => _248.enableKeyboardControls])&&(e.setAttribute("tabindex","0"),e.addEventListener("keydown",C)),{dispose:()=>{e.removeEventListener("mousedown",x),e.removeEventListener("click",H),e.removeEventListener("dblclick",g),e.removeEventListener("keydown",C),E()},fitToView:d,clearSelection:E}}function Yn(e,r,t){let n=new (0, _OrbitControlsjs.OrbitControls)(e,r),a=t.camera.target;return a&&n.target.set(a.x,a.y,a.z),n.enableDamping=t.controls.enableDamping||!1,n.dampingFactor=t.controls.dampingFactor||.05,n.autoRotate=t.controls.autoRotate||!1,n.autoRotateSpeed=t.controls.autoRotateSpeed||.5,n.enableZoom=_nullishCoalesce(t.controls.enableZoom, () => (!0)),n.enablePan=_nullishCoalesce(t.controls.enablePan, () => (!0)),n.minDistance=t.controls.minDistance||.001,n.maxDistance=t.controls.maxDistance||1/0,n.screenSpacePanning=!1,n.maxPolarAngle=Math.PI,n.update(),n}var Yo=["technical","studio","showcase"];function ge(e,r,t,n=!0){return{x:e,y:r,z:t}}var Kn="#ffffff",ot=12,Jn=4e-4,Qn=12,er=.05;function at(e,r={}){if(!e||e.length===0)return[];let{rhino:t,applyTransforms:n=!0}=r,a=[];for(let o of e)switch(o.kind){case"curve":{let i=nr(o,t,n);i&&a.push(i);break}case"point":{let i=rr(o,n);i&&a.push(i);break}default:{let s=o;_chunkH3FZW6OXcjs.e.call(void 0, ).warn(`Skipping unknown display item kind: ${String(s.kind)}`);break}}return a}var tr=2;function nr(e,r,t){if(!r)return _chunkH3FZW6OXcjs.e.call(void 0, ).warn("No rhino3dm instance provided; skipping curve display item."),null;let n=or(e.json,r);if(!n)return null;let a;try{a=ar(n,t)}catch(d){return _chunkH3FZW6OXcjs.e.call(void 0, ).warn("Failed to tessellate curve display item; skipping.",d),null}finally{le(n)}if(a.length<2)return null;let o=[];for(let d of a)o.push(d.x,d.y,d.z);let i=new _LineGeometryjs.LineGeometry;i.setPositions(o);let s=it(e.color,e.opacity),l=new (0, _LineMaterialjs.LineMaterial)({color:s.color}),c=l;c.linewidth=_nullishCoalesce(e.width, () => (tr)),c.transparent=s.transparent,c.opacity=s.opacity;let u=new (0, _Line2js.Line2)(i,l);return u.computeLineDistances(),u.name=e.name,u.userData={source:"compute",id:e.id,layer:e.layer,kind:"curve",metadata:e.metadata},u}function rr(e,r){let{position:t}=e;if(!t||typeof t.X!="number"||!Number.isFinite(t.X)||typeof t.Y!="number"||!Number.isFinite(t.Y)||typeof t.Z!="number"||!Number.isFinite(t.Z))return _chunkH3FZW6OXcjs.e.call(void 0, ).warn(`Skipping point display item with missing or non-finite position (id: ${String(e.id)}).`),null;let{x:n,y:a,z:o}=ge(t.X,t.Y,t.Z,r),i=new Y.BufferGeometry;i.setAttribute("position",new Y.Float32BufferAttribute([n,a,o],3));let s=new Y.PointsMaterial({...it(e.color,e.opacity),size:6,sizeAttenuation:!1}),l=new Y.Points(i,s);return l.name=e.name,l.userData={source:"compute",id:e.id,layer:e.layer,kind:"point",metadata:e.metadata},l}function le(e){_optionalChain([e, 'optionalAccess', _249 => _249.delete, 'optionalCall', _250 => _250()])}function or(e,r){try{let t=JSON.parse(e),n=r.CommonObject.decode(t);return n&&typeof n.pointAt=="function"?n:(le(n),_chunkH3FZW6OXcjs.e.call(void 0, ).warn("Decoded display-item JSON is not a curve; skipping."),null)}catch(t){return _chunkH3FZW6OXcjs.e.call(void 0, ).warn("Failed to decode curve display item JSON:",t),null}}function ar(e,r){let t=ir(e,r);return t||sr(e,r)}function ir(e,r){if(!e.isPolyline())return null;let t=e.tryGetPolyline(),n=Array.isArray(t)?t[1]:t;if(!n||typeof n.count!="number"||n.count<2)return le(n),null;let a=[];for(let o=0;o<n.count;o++){let i=n.get(o),{x:s,y:l,z:c}=ge(i[0],i[1],i[2],r);a.push(new Y.Vector3(s,l,c))}return le(n),a}function sr(e,r){let t=e.domain,n=t[0],o=t[1]-n,i=d=>{let m=e.pointAt(d),{x:E,y:T,z:f}=ge(m[0],m[1],m[2],r);return new Y.Vector3(E,T,f)},s=lr(e),l=n,c=i(n),u=[c];for(let d=0;d<ot;d++){let m=n+o*(d+1)/ot,E=i(m);xe(l,c,m,E,i,s,Qn,u),u.push(E),l=m,c=E}return u}function xe(e,r,t,n,a,o,i,s){if(i<=0)return;let l=(e+t)/2,c=a(l),u=ur(c,r,n),d=cr(r,c,n);u<=o&&d<=er||(xe(e,r,l,c,a,o,i-1,s),s.push(c),xe(l,c,t,n,a,o,i-1,s))}function lr(e){let r=e.getBoundingBox(),t=r.min,n=r.max;le(r);let a=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]);return Math.max(a*Jn,1e-6)}function cr(e,r,t){let n=r.x-e.x,a=r.y-e.y,o=r.z-e.z,i=t.x-r.x,s=t.y-r.y,l=t.z-r.z,c=Math.sqrt(n*n+a*a+o*o),u=Math.sqrt(i*i+s*s+l*l);if(c===0||u===0)return 0;let d=n*i+a*s+o*l,m=Math.max(-1,Math.min(1,d/(c*u)));return Math.acos(m)}function ur(e,r,t){let n=t.x-r.x,a=t.y-r.y,o=t.z-r.z,i=n*n+a*a+o*o;if(i===0)return e.distanceTo(r);let s=e.x-r.x,l=e.y-r.y,c=e.z-r.z,u=Math.max(0,Math.min(1,(s*n+l*a+c*o)/i)),d=s-n*u,m=l-a*u,E=c-o*u;return Math.sqrt(d*d+m*m+E*E)}function it(e,r){let t=_nullishCoalesce(r, () => (1));return{color:new Y.Color(_nullishCoalesce(e, () => (Kn))),transparent:t<1,opacity:t}}var _fflate = require('fflate');var st=1096174675,mr= exports.y =1515605075,lt= exports.z =3,ct= exports.A =1,Ce= exports.B =1,pr= exports.C =2,fr= exports.D =4,Er= exports.E =8,hr= exports.F =16,aa= exports.G =0,gr= exports.H =1,ut=12,dt=56,yr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function we(e){if(!yr)throw new (0, _chunkH3FZW6OXcjs.d)("SLVA parsing requires a little-endian host: the zero-copy geometry readers view the wire bytes in host byte order.",_chunkH3FZW6OXcjs.c.ENVIRONMENT_ERROR);let r=Hr(Rr(e)),t=new DataView(r.buffer,r.byteOffset,r.byteLength);if(r.byteLength<ut)throw z("Blob too small to contain SLVA header.",{expectedBytes:ut,availableBytes:r.byteLength});let n=0,a=t.getUint32(n,!0);if(n+=4,a!==st)throw z(`Invalid SLVA magic: 0x${a.toString(16)}`,{expectedMagic:`0x${st.toString(16)}`,actualMagic:`0x${a.toString(16)}`});let o=t.getUint32(n,!0);if(n+=4,o<ct||o>lt)throw z(`Unsupported SLVA version: ${o}`,{minSupportedVersion:ct,maxSupportedVersion:lt,actualVersion:o});let i=t.getUint32(n,!0);if(n+=4,n+i>r.byteLength)throw z("Insufficient data to read metadata JSON.",{expectedBytes:i,availableBytes:r.byteLength-n,offset:n});let s=r.subarray(n,n+i);n+=i;let l;try{l=JSON.parse(xr(s))}catch(J){throw z(`Failed to parse metadata JSON: ${J instanceof Error?J.message:String(J)}`,{metadataLen:i})}if(n+dt>r.byteLength)throw z("Insufficient data to read geometry header.",{expectedBytes:dt,availableBytes:r.byteLength-n,offset:n});let c=t.getUint32(n,!0);n+=4;let u=t.getFloat64(n,!0);n+=8;let d=t.getFloat64(n,!0);n+=8;let m=t.getFloat64(n,!0);n+=8;let E=t.getFloat64(n,!0);n+=8;let T=t.getFloat64(n,!0);n+=8;let f=t.getFloat64(n,!0);n+=8;let x=t.getUint32(n,!0);n+=4;let H=(c&Ce)!==0,g=(c&fr)!==0,C=x*3,p=C*(H?4:2);if(n+p>r.byteLength)throw z("Insufficient data to read vertices.",{expectedBytes:p,availableBytes:r.byteLength-n,offset:n,useFloat32:H,vertexCount:x});let b=r.byteOffset+n,R;if(H?R=pt(r.buffer,b,C):g?R=Mr(ve(r.buffer,b,C)):R=vr(r.buffer,b,C),n+=p,n+4>r.byteLength)throw z("Insufficient data to read index count.",{expectedBytes:4,availableBytes:r.byteLength-n,offset:n});let v=t.getUint32(n,!0);n+=4;let S=(c&pr)!==0,G=v*(S?2:4);if(n+G>r.byteLength)throw z("Insufficient data to read indices.",{expectedBytes:G,availableBytes:r.byteLength-n,offset:n,indexCount:v,useUint16Indices:S});let k=S?ve(r.buffer,r.byteOffset+n,v):Cr(r.buffer,r.byteOffset+n,v);g&&(k=k instanceof Uint16Array?Ar(k):Sr(k)),wr(k,x),n+=G;let X=null;if((c&Er)!==0){let J=br(r,t,n,x,g);X=J.uvs,n=J.offset}let ne=null;return(c&hr)!==0&&(ne=Tr(r,n,x,g)),{metadata:l,flags:c,vertices:R,indices:k,origin:[u,d,m],scale:[E,T,f],uvs:X,colors:ne}}var mt=36;function br(e,r,t,n,a){if(t+mt>e.byteLength)throw z("Insufficient data to read UV chunk header.",{expectedBytes:mt,availableBytes:e.byteLength-t,offset:t});let o=r.getUint32(t,!0);t+=4;let i=r.getFloat64(t,!0);t+=8;let s=r.getFloat64(t,!0);t+=8;let l=r.getFloat64(t,!0);t+=8;let c=r.getFloat64(t,!0);t+=8;let u=n*2,d=o===gr,m=u*(d?4:2);if(t+m>e.byteLength)throw z("Insufficient data to read UV chunk.",{expectedBytes:m,availableBytes:e.byteLength-t,offset:t,uvFormat:o,vertexCount:n});let E=e.byteOffset+t,T;if(d)T=pt(e.buffer,E,u).slice();else{let f=ve(e.buffer,E,u);T=new Float32Array(u);let x=0,H=0;for(let g=0;g<u;g+=2)a?(x=x+K(f[g])&65535,H=H+K(f[g+1])&65535):(x=f[g],H=f[g+1]),T[g]=i+x*l,T[g+1]=s+H*c}return{uvs:T,offset:t+m}}function Tr(e,r,t,n){let a=t*3;if(r+a>e.byteLength)throw z("Insufficient data to read vertex-color chunk.",{expectedBytes:a,availableBytes:e.byteLength-r,offset:r,vertexCount:t});let o=e.subarray(r,r+a);if(!n)return o.slice();let i=new Uint8Array(a),s=0,l=0,c=0;for(let u=0;u<a;u+=3)s=s+K(o[u])&255,l=l+K(o[u+1])&255,c=c+K(o[u+2])&255,i[u]=s,i[u+1]=l,i[u+2]=c;return i}function Rr(e){return typeof e=="string"?_chunkH3FZW6OXcjs.j.call(void 0, e):e instanceof Uint8Array?e:new Uint8Array(e)}function Hr(e){if(e.byteLength<8)return e;let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(r.getUint32(0,!0)!==mr)return e;let t=r.getUint32(4,!0),n=e.subarray(8),a=Math.max(n.byteLength*1032+1024,1<<20);if(t>a)throw z("SLVZ header declares an implausible uncompressed length",{uncompressedLen:t,deflatedBytes:n.byteLength,maxPlausibleLen:a});let o;try{o=_fflate.inflateSync.call(void 0, n,{out:new Uint8Array(t+1)})}catch(i){throw z(`Failed to inflate SLVZ blob: ${i instanceof Error?i.message:String(i)}`,{uncompressedLen:t,deflatedBytes:n.byteLength})}if(o.byteLength!==t)throw z("SLVZ payload inflated to a different size than the header declares.",{declaredLen:t,actualLen:o.byteLength,deflatedBytes:n.byteLength});return o}function xr(e){if(typeof TextDecoder<"u")return new TextDecoder("utf-8").decode(e);if(typeof globalThis.Buffer<"u")return globalThis.Buffer.from(e).toString("utf-8");throw new (0, _chunkH3FZW6OXcjs.d)("No UTF-8 decoder available in this environment.",_chunkH3FZW6OXcjs.c.INVALID_STATE)}function vr(e,r,t){if(t===0)return new Int16Array(0);if(r%2===0)return new Int16Array(e,r,t);let n=new Uint8Array(t*2);return n.set(new Uint8Array(e,r,t*2)),new Int16Array(n.buffer)}function pt(e,r,t){if(t===0)return new Float32Array(0);if(r%4===0)return new Float32Array(e,r,t);let n=new Uint8Array(t*4);return n.set(new Uint8Array(e,r,t*4)),new Float32Array(n.buffer)}function ve(e,r,t){if(t===0)return new Uint16Array(0);if(r%2===0)return new Uint16Array(e,r,t);let n=new Uint8Array(t*2);return n.set(new Uint8Array(e,r,t*2)),new Uint16Array(n.buffer)}function Cr(e,r,t){if(t===0)return new Uint32Array(0);if(r%4===0)return new Uint32Array(e,r,t);let n=new Uint8Array(t*4);return n.set(new Uint8Array(e,r,t*4)),new Uint32Array(n.buffer)}function wr(e,r){if(e.length!==0&&!(e instanceof Uint16Array&&r>65535)){for(let t=0;t<e.length;t++)if(e[t]>=r)throw z("Index out of range of vertexCount.",{indexPosition:t,indexValue:e[t],vertexCount:r})}}function K(e){return e>>>1^-(e&1)}function Mr(e){let r=new Int16Array(e.length),t=0,n=0,a=0;for(let o=0;o<e.length;o+=3)t=t+K(e[o])<<16>>16,n=n+K(e[o+1])<<16>>16,a=a+K(e[o+2])<<16>>16,r[o]=t,r[o+1]=n,r[o+2]=a;return r}function Ar(e){let r=new Uint16Array(e.length),t=0;for(let n=0;n<e.length;n++)t=t+K(e[n])&65535,r[n]=t;return r}function Sr(e){let r=new Uint32Array(e.length),t=0;for(let n=0;n<e.length;n++)t=t+K(e[n])>>>0,r[n]=t;return r}function z(e,r){return new (0, _chunkH3FZW6OXcjs.d)(e,_chunkH3FZW6OXcjs.c.VALIDATION_ERROR,{context:r})}async function ma(e,r){let{debug:t=!1}=_nullishCoalesce(r, () => ({})),n=t?performance.now():0,a,o=performance.now();try{a=JSON.parse(e)}catch(s){return _chunkH3FZW6OXcjs.e.call(void 0, ).error("Error parsing mesh batch envelope JSON:",s),[]}let i=performance.now()-o;return await Me(a,r,{parseTime:i,perfStart:n})}async function Me(e,r,t){let{mergeByMaterial:n=!0,applyTransforms:a=!0,debug:o=!1,material:i}=_nullishCoalesce(r, () => ({})),{parseTime:s=0,perfStart:l=o?performance.now():0}=_nullishCoalesce(t, () => ({}));if(!e.compressedData)return[];let c=performance.now(),u=we(e.compressedData),d=performance.now()-c,m=o?_r(e.compressedData):0;return ft(u,{mergeByMaterial:n,applyTransforms:a,debug:o,material:i,parseTime:s,decodeTime:d,perfStart:l,blobBytes:m,fallback:{materials:e.materials,groups:e.groups,sourceComponentId:e.sourceComponentId}})}async function pa(e,r){let{mergeByMaterial:t=!0,applyTransforms:n=!0,debug:a=!1,material:o}=_nullishCoalesce(r, () => ({})),i=a?performance.now():0,s=performance.now(),l=we(e),c=performance.now()-s,u=e.byteLength;return ft(l,{mergeByMaterial:t,applyTransforms:n,debug:a,material:o,parseTime:0,decodeTime:c,perfStart:i,blobBytes:u})}function ft(e,r){let{mergeByMaterial:t,applyTransforms:n,debug:a,material:o,parseTime:i,decodeTime:s,perfStart:l,blobBytes:c,fallback:u}=r,d=_nullishCoalesce(_nullishCoalesce(e.metadata.materials, () => (_optionalChain([u, 'optionalAccess', _251 => _251.materials]))), () => ([])),m=_nullishCoalesce(_nullishCoalesce(e.metadata.groups, () => (_optionalChain([u, 'optionalAccess', _252 => _252.groups]))), () => ([])),E=_nullishCoalesce(_optionalChain([u, 'optionalAccess', _253 => _253.sourceComponentId]), () => (e.metadata.sourceComponentId)),T=(e.flags&Ce)!==0;Lr(m,d.length,e.vertices.length/3,e.indices.length);let f=T?Or(e.vertices,n):Ir(e.vertices,e.origin,e.scale,n);if(a){let w=e.vertices.byteLength+e.indices.byteLength;_chunkH3FZW6OXcjs.e.call(void 0, ).debug("Mesh Batch Stats:"),_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Materials: ${d.length} | Groups: ${m.length}`),_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Vertices: ${e.vertices.length/3} | Indices: ${e.indices.length}`),_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Format: ${T?"float32":"int16 quantized"}`),_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Blob: ${(c/1024/1024).toFixed(2)} MB | Geometry on wire: ${(w/1024/1024).toFixed(2)} MB`)}let x=performance.now(),H=d.map(w=>Vr(w,{vertexColors:e.colors!=null,appearance:o})),g=[];for(let w of m)if(t&&w.meshes.length>1){let p=kr(w,f,e.indices,H,e.uvs,e.colors);p.userData.sourceComponentId=_nullishCoalesce(E, () => (null)),g.push(p)}else{let p=Ur(w,f,e.indices,H,e.uvs,e.colors);for(let b of p)b.userData.sourceComponentId=_nullishCoalesce(E, () => (null));g.push(...p)}let C=performance.now()-x;if(a){let w=performance.now()-l;_chunkH3FZW6OXcjs.e.call(void 0, ).debug("Performance:"),i>0&&_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Parse JSON: ${i.toFixed(2)}ms`),_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Decode binary: ${s.toFixed(2)}ms`),_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Create Meshes: ${C.toFixed(2)}ms`),_chunkH3FZW6OXcjs.e.call(void 0, ).debug(` Total: ${w.toFixed(2)}ms`)}return Promise.resolve(g)}function ce(e,r){return new (0, _chunkH3FZW6OXcjs.d)(e,_chunkH3FZW6OXcjs.c.VALIDATION_ERROR,{context:r})}function Lr(e,r,t,n){for(let a of e){if(!Number.isInteger(a.materialId)||a.materialId<0||a.materialId>=r)throw ce("Group materialId out of range of the materials array.",{materialId:a.materialId,materialCount:r});for(let o of a.meshes){let i={vertexStart:o.vertexStart,vertexCount:o.vertexCount,indexStart:o.indexStart,indexCount:o.indexCount};for(let[s,l]of Object.entries(i))if(!Number.isInteger(l)||l<0)throw ce(`Mesh metadata field "${s}" must be a non-negative integer.`,{meshName:o.name,field:s,value:l});if(o.vertexStart+o.vertexCount>t)throw ce("Mesh vertex window exceeds the batch vertex buffer.",{meshName:o.name,vertexStart:o.vertexStart,vertexCount:o.vertexCount,totalVertexCount:t});if(o.indexStart+o.indexCount>n)throw ce("Mesh index window exceeds the batch index buffer.",{meshName:o.name,indexStart:o.indexStart,indexCount:o.indexCount,totalIndexCount:n})}}}function Et(e,r){if(e<r.vertexStart||e>=r.vertexStart+r.vertexCount)throw ce("Index references a vertex outside its mesh's vertex window.",{meshName:r.name,indexValue:e,vertexStart:r.vertexStart,vertexCount:r.vertexCount})}function Ir(e,r,t,n){let a=new Float32Array(e.length),o=r[0],i=r[1],s=r[2],l=t[0],c=t[1],u=t[2];for(let d=0;d<e.length;d+=3)a[d]=o+(e[d]+32767)*l,a[d+1]=i+(e[d+1]+32767)*c,a[d+2]=s+(e[d+2]+32767)*u;return a}function Or(e,r){return e}var Dr=.5,Pr=.5,Fr=.3;function Vr(e,r){let t=_e(e.color),n=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _254 => _254.vertexColors]), () => (!1)),a=_optionalChain([r, 'optionalAccess', _255 => _255.appearance]),o=new F.MeshPhysicalMaterial({color:t,metalness:e.metalness,roughness:e.roughness,opacity:e.opacity,transparent:e.transparent,vertexColors:n,side:_optionalChain([a, 'optionalAccess', _256 => _256.cullBackfaces])?F.FrontSide:F.DoubleSide,polygonOffset:!0,polygonOffsetFactor:.5,polygonOffsetUnits:.5,depthWrite:!0,depthTest:!0});return _optionalChain([a, 'optionalAccess', _257 => _257.envMapIntensity])!=null&&(o.envMapIntensity=a.envMapIntensity),e.metalness>Dr&&(o.clearcoat=Pr,o.clearcoatRoughness=Fr),n&&Br(o),e.map&&nt(o,e.map),o}function Br(e){e.onBeforeCompile=r=>{r.vertexShader=r.vertexShader.replace("#include <color_vertex>",`#include <color_vertex>
|
|
55
|
+
#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
|
|
56
|
+
vColor.rgb = mix(
|
|
57
|
+
vColor.rgb / 12.92,
|
|
58
|
+
pow( ( vColor.rgb + 0.055 ) / 1.055, vec3( 2.4 ) ),
|
|
59
|
+
step( vec3( 0.04045 ), vColor.rgb )
|
|
60
|
+
);
|
|
61
|
+
#endif`)}}function kr(e,r,t,n,a=null,o=null){let i=0,s=0;for(let g of e.meshes)i+=g.vertexCount,s+=g.indexCount;let l=new Float32Array(i*3),c=new Uint32Array(s),u=a?new Float32Array(i*2):null,d=o?new Uint8Array(i*3):null,m=0,E=0;for(let g of e.meshes){let C=g.vertexStart*3,w=g.vertexCount*3;if(l.set(r.subarray(C,C+w),m*3),u&&a){let R=g.vertexStart*2;u.set(a.subarray(R,R+g.vertexCount*2),m*2)}d&&o&&d.set(o.subarray(C,C+w),m*3);let p=t.subarray(g.indexStart,g.indexStart+g.indexCount),b=m-g.vertexStart;for(let R=0;R<p.length;R++){let v=p[R];Et(v,g),c[E+R]=v+b}m+=g.vertexCount,E+=g.indexCount}let T=new F.BufferGeometry;T.setAttribute("position",new F.BufferAttribute(l,3)),T.setIndex(new F.BufferAttribute(c,1)),u&&T.setAttribute("uv",new F.BufferAttribute(u,2)),d&&T.setAttribute("color",new F.BufferAttribute(d,3,!0)),T.computeVertexNormals();let f=new F.Mesh(T,n[e.materialId]),x=e.meshes[0],H=e.meshes.map(g=>g.name).filter(g=>g&&g.length>0);return f.name=H.length>0?H[0]:`merged_material_${e.materialId}`,f.castShadow=!0,f.receiveShadow=!0,f.userData={source:"compute",name:f.name,layer:_nullishCoalesce(_optionalChain([x, 'optionalAccess', _258 => _258.layer]), () => ("")),originalIndex:_nullishCoalesce(_optionalChain([x, 'optionalAccess', _259 => _259.originalIndex]), () => (0)),metadata:_nullishCoalesce(_optionalChain([x, 'optionalAccess', _260 => _260.metadata]), () => ({})),mergedFrom:e.meshes.slice(1).map(g=>({name:g.name,layer:g.layer,originalIndex:g.originalIndex}))},f}function Ur(e,r,t,n,a=null,o=null){let i=[];for(let s of e.meshes){let l=s.vertexStart*3,c=s.vertexCount*3,u=r.slice(l,l+c),d=t.subarray(s.indexStart,s.indexStart+s.indexCount),m=new Uint32Array(d.length),E=s.vertexStart;for(let x=0;x<d.length;x++){let H=d[x];Et(H,s),m[x]=H-E}let T=new F.BufferGeometry;if(T.setAttribute("position",new F.BufferAttribute(u,3)),T.setIndex(new F.BufferAttribute(m,1)),a){let x=s.vertexStart*2,H=a.slice(x,x+s.vertexCount*2);T.setAttribute("uv",new F.BufferAttribute(H,2))}if(o){let x=o.slice(l,l+c);T.setAttribute("color",new F.BufferAttribute(x,3,!0))}T.computeVertexNormals();let f=new F.Mesh(T,n[e.materialId]);f.name=s.name,f.userData={source:"compute",name:s.name,layer:_nullishCoalesce(s.layer, () => ("")),originalIndex:s.originalIndex,metadata:_nullishCoalesce(s.metadata, () => ({}))},f.castShadow=!0,f.receiveShadow=!0,i.push(f)}return i}function _r(e){return Math.floor(e.length*3/4)}var ht={Angstroms:1e-10,Nanometers:1e-9,Microns:1e-6,Millimeters:.001,Centimeters:.01,Decimeters:.1,Meters:1,Dekameters:10,Hectometers:100,Kilometers:1e3,Megameters:1e6,Gigameters:1e9,Microinches:254e-10,Mils:254e-7,Inches:.0254,Feet:.3048,Yards:.9144,Miles:1609.344,NauticalMiles:1852},zr="Display",Nr="DisplayBatch";function Gr(e){let r=e.split(".");return r.includes(zr)||r.includes(Nr)}var gt=new Set;async function ba(e,r){let t=performance.now(),n=[],{allowScaling:a=!0,allowAutoPosition:o=!0,rhino:i,debug:s=!1,parsing:l={}}=_nullishCoalesce(r, () => ({}));try{let c=a?jr(e.modelunits):1;return await Wr(e,n,c,l,i,s),o&&qr(n),n}catch(c){throw Zr(c,n),c}finally{s&&Jr(t)}}function jr(e){let r=ht[e];return r!==void 0?r:(gt.has(e)||(gt.add(e),_chunkH3FZW6OXcjs.e.call(void 0, ).warn(`Unknown Rhino model unit "${e}" \u2014 geometry will not be scaled (factor 1). Known units: ${Object.keys(ht).join(", ")}.`)),1)}async function Wr(e,r,t,n,a,o){for(let i of e.values){let s=i.InnerTree;for(let l in s){let c=s[l];c&&await $r(c,r,t,n,a,o)}}}async function $r(e,r,t,n,a,o){for(let i of e){if(!Gr(i.type))continue;let s={mergeByMaterial:!0,applyTransforms:!0,debug:!1,...n},l=Yr(i.data);if(!l){_chunkH3FZW6OXcjs.e.call(void 0, ).error("Error parsing display batch envelope: invalid JSON");continue}let c=await Me(l,s),u=at(l.items,{rhino:a,applyTransforms:s.applyTransforms}),d=[...c,...u];if(t!==1)for(let m of d)m.scale.set(t,t,t);r.push(...d),o&&_chunkH3FZW6OXcjs.e.call(void 0, ).debug(`Extracted ${c.length} meshes and ${u.length} items from batch`)}}function Yr(e){return typeof e=="string"?Xr(e):e}function Xr(e){try{return JSON.parse(e)}catch (e3){return}}function qr(e){if(e.length===0)return;let r=be(e);ze(e,r.min.z,"z")}function Zr(e,r){_chunkH3FZW6OXcjs.e.call(void 0, ).error("An unexpected error occurred:",e),Kr(r)}function Kr(e){for(let r of e){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>n.dispose()):t.material.dispose())}}function Jr(e){let r=performance.now()-e;_chunkH3FZW6OXcjs.e.call(void 0, ).info("Time to process meshes:",`${r.toFixed(2)}ms`)}exports.a = St; exports.b = no; exports.c = _e; exports.d = ze; exports.e = be; exports.f = Ne; exports.g = Ge; exports.h = je; exports.i = de; exports.j = Xe; exports.k = an; exports.l = po; exports.m = qe; exports.n = Ke; exports.o = Hn; exports.p = et; exports.q = xn; exports.r = tt; exports.s = Ao; exports.t = Fn; exports.u = Wo; exports.v = Yo; exports.w = at; exports.x = st; exports.y = mr; exports.z = lt; exports.A = ct; exports.B = Ce; exports.C = pr; exports.D = fr; exports.E = Er; exports.F = hr; exports.G = aa; exports.H = gr; exports.I = we; exports.J = ma; exports.K = Me; exports.L = pa; exports.M = ht; exports.N = ba;
|
|
62
|
+
//# sourceMappingURL=chunk-KTKY5M5S.cjs.map
|