@selvajs/compute 3.1.0-beta.11 → 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.
Files changed (48) hide show
  1. package/dist/chunk-3SEQKFGD.js +2 -0
  2. package/dist/chunk-3SEQKFGD.js.map +1 -0
  3. package/dist/chunk-44HGB4C4.cjs +2 -0
  4. package/dist/chunk-44HGB4C4.cjs.map +1 -0
  5. package/dist/chunk-H3FZW6OX.cjs +4 -0
  6. package/dist/chunk-H3FZW6OX.cjs.map +1 -0
  7. package/dist/chunk-INP5HVA2.js +62 -0
  8. package/dist/chunk-INP5HVA2.js.map +1 -0
  9. package/dist/chunk-KTKY5M5S.cjs +62 -0
  10. package/dist/chunk-KTKY5M5S.cjs.map +1 -0
  11. package/dist/chunk-Y3M7P3BW.js +4 -0
  12. package/dist/chunk-Y3M7P3BW.js.map +1 -0
  13. package/dist/core.cjs +1 -1
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.d.cts +22 -1
  16. package/dist/core.d.ts +22 -1
  17. package/dist/core.js +1 -1
  18. package/dist/grasshopper.cjs +1 -1
  19. package/dist/grasshopper.d.cts +20 -0
  20. package/dist/grasshopper.d.ts +20 -0
  21. package/dist/grasshopper.js +1 -1
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +1 -1
  27. package/dist/{visualization-MOYO6MDN.js → visualization-5RH6RSLV.js} +2 -2
  28. package/dist/visualization-KRP5OPYW.cjs +2 -0
  29. package/dist/{visualization-4RSUYQG2.cjs.map → visualization-KRP5OPYW.cjs.map} +1 -1
  30. package/dist/visualization.cjs +1 -1
  31. package/dist/visualization.d.cts +35 -4
  32. package/dist/visualization.d.ts +35 -4
  33. package/dist/visualization.js +1 -1
  34. package/package.json +51 -30
  35. package/dist/chunk-7XMD5YXP.cjs +0 -62
  36. package/dist/chunk-7XMD5YXP.cjs.map +0 -1
  37. package/dist/chunk-C7P43VZF.js +0 -2
  38. package/dist/chunk-C7P43VZF.js.map +0 -1
  39. package/dist/chunk-CUQQ3ZBV.cjs +0 -4
  40. package/dist/chunk-CUQQ3ZBV.cjs.map +0 -1
  41. package/dist/chunk-PX2YTSHJ.js +0 -62
  42. package/dist/chunk-PX2YTSHJ.js.map +0 -1
  43. package/dist/chunk-QZECCPT3.cjs +0 -2
  44. package/dist/chunk-QZECCPT3.cjs.map +0 -1
  45. package/dist/chunk-WPB2LKCD.js +0 -4
  46. package/dist/chunk-WPB2LKCD.js.map +0 -1
  47. package/dist/visualization-4RSUYQG2.cjs +0 -2
  48. /package/dist/{visualization-MOYO6MDN.js.map → visualization-5RH6RSLV.js.map} +0 -0
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7XMD5YXPcjs = require('./chunk-7XMD5YXP.cjs');require('./chunk-CUQQ3ZBV.cjs');exports.EDGE_USERDATA_KIND = _chunk7XMD5YXPcjs.i; exports.LOOKS = _chunk7XMD5YXPcjs.v; exports.Materials = _chunk7XMD5YXPcjs.a; exports.SCALE_FACTORS = _chunk7XMD5YXPcjs.M; exports.addEdges = _chunk7XMD5YXPcjs.j; exports.applyOffset = _chunk7XMD5YXPcjs.d; exports.computeCombinedBoundingBox = _chunk7XMD5YXPcjs.e; exports.createCameraController = _chunk7XMD5YXPcjs.f; exports.createGrid = _chunk7XMD5YXPcjs.g; exports.createLabelLayer = _chunk7XMD5YXPcjs.n; exports.createMeasureTool = _chunk7XMD5YXPcjs.p; exports.createRenderPipeline = _chunk7XMD5YXPcjs.m; exports.createViewGizmo = _chunk7XMD5YXPcjs.h; exports.getThreeMeshesFromComputeResponse = _chunk7XMD5YXPcjs.N; exports.initThree = _chunk7XMD5YXPcjs.u; exports.isEdgeOverlay = _chunk7XMD5YXPcjs.k; exports.parseColor = _chunk7XMD5YXPcjs.c; exports.parseDisplayItems = _chunk7XMD5YXPcjs.w; exports.parseMeshBatchBlob = _chunk7XMD5YXPcjs.L; exports.parseMeshBatchObject = _chunk7XMD5YXPcjs.K; exports.removeEdges = _chunk7XMD5YXPcjs.l; exports.snapToVertex = _chunk7XMD5YXPcjs.o; exports.updateScene = _chunk7XMD5YXPcjs.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKTKY5M5Scjs = require('./chunk-KTKY5M5S.cjs');require('./chunk-H3FZW6OX.cjs');exports.EDGE_USERDATA_KIND = _chunkKTKY5M5Scjs.i; exports.LOOKS = _chunkKTKY5M5Scjs.v; exports.Materials = _chunkKTKY5M5Scjs.a; exports.SCALE_FACTORS = _chunkKTKY5M5Scjs.M; exports.addEdges = _chunkKTKY5M5Scjs.j; exports.applyOffset = _chunkKTKY5M5Scjs.d; exports.computeCombinedBoundingBox = _chunkKTKY5M5Scjs.e; exports.createCameraController = _chunkKTKY5M5Scjs.f; exports.createGrid = _chunkKTKY5M5Scjs.g; exports.createLabelLayer = _chunkKTKY5M5Scjs.n; exports.createMeasureTool = _chunkKTKY5M5Scjs.p; exports.createRenderPipeline = _chunkKTKY5M5Scjs.m; exports.createViewGizmo = _chunkKTKY5M5Scjs.h; exports.getThreeMeshesFromComputeResponse = _chunkKTKY5M5Scjs.N; exports.initThree = _chunkKTKY5M5Scjs.u; exports.isEdgeOverlay = _chunkKTKY5M5Scjs.k; exports.parseColor = _chunkKTKY5M5Scjs.c; exports.parseDisplayItems = _chunkKTKY5M5Scjs.w; exports.parseMeshBatchBlob = _chunkKTKY5M5Scjs.L; exports.parseMeshBatchObject = _chunkKTKY5M5Scjs.K; exports.removeEdges = _chunkKTKY5M5Scjs.l; exports.snapToVertex = _chunkKTKY5M5Scjs.o; exports.updateScene = _chunkKTKY5M5Scjs.b;
2
2
  //# sourceMappingURL=visualization.cjs.map
@@ -114,11 +114,19 @@ type Look = (typeof LOOKS)[number];
114
114
  type EdgesConfig = {
115
115
  /** Auto-attach edge overlays to meshes as they load. Default false (opt-in). */
116
116
  enabled?: boolean;
117
- /** Edge color. Default near-black. */
117
+ /**
118
+ * Force a single edge color for all meshes. Omit (the default) to derive each mesh's edge color
119
+ * from its own surface material, darkened by `darken` — so edges read as the object's own outline.
120
+ */
118
121
  color?: THREE.ColorRepresentation;
122
+ /**
123
+ * How far derived edge colors are darkened toward black, 0–1 (default 0.75). Ignored when `color`
124
+ * is set.
125
+ */
126
+ darken?: number;
119
127
  /** Edge thickness in CSS px. Default 1.5. */
120
128
  width?: number;
121
- /** Crease angle (degrees): keep edges where faces differ by more than this. Default 30. */
129
+ /** Crease angle (degrees): keep edges where faces differ by more than this. Default 44. */
122
130
  thresholdAngle?: number;
123
131
  /** Fade an overlay out as its mesh shrinks on screen, so far zoom-outs stay clean. Default true. */
124
132
  distanceFade?: boolean;
@@ -320,6 +328,13 @@ interface Grid {
320
328
  readonly object: THREE.Mesh;
321
329
  /** Keep the fade centered on the camera so the grid feels infinite as you move. Call per frame. */
322
330
  update(cameraPosition: THREE.Vector3): void;
331
+ /**
332
+ * Rescale the grid's cell spacing and fade radius to the loaded content's extent. Call after a
333
+ * geometry change (e.g. right after `updateScene`) so a part that is 3 units or 3000 units wide
334
+ * both get sensibly-sized cells and a fade that reaches past the model. No-op for empty/degenerate
335
+ * bounds — the grid keeps its last (or default) scale. See {@link Grid.fitToContent}'s impl notes.
336
+ */
337
+ fitToContent(bounds: THREE.Box3): void;
323
338
  setVisible(visible: boolean): void;
324
339
  dispose(): void;
325
340
  }
@@ -550,6 +565,12 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
550
565
  * loading or replacing geometry (e.g. after `updateScene`). No-op when sunlight/shadows are off.
551
566
  */
552
567
  updateShadowBounds: () => void;
568
+ /**
569
+ * Rescale the grid's cell spacing and fade radius to the current scene content, so parts of any
570
+ * size get readable cells and a fade that reaches past the model. Call after loading or replacing
571
+ * geometry (e.g. after `updateScene`). No-op when the grid is off or there's no content.
572
+ */
573
+ updateGridScale: () => void;
553
574
  dispose: () => void;
554
575
  fitToView: () => void;
555
576
  clearSelection: () => void;
@@ -622,13 +643,23 @@ declare namespace threeMaterials {
622
643
  * occlusion of hidden edges exact.
623
644
  */
624
645
  interface EdgeOptions {
625
- /** Edge color. Default near-black. */
646
+ /**
647
+ * Force a single edge color for every overlay. When omitted (the default), each overlay derives
648
+ * its color from its own mesh's material — a darkened tint of the surface — so edges read as the
649
+ * object's own outline rather than a uniform black frame. Meshes with no readable material color
650
+ * fall back to {@link DEFAULT_EDGE_COLOR}.
651
+ */
626
652
  color?: THREE.ColorRepresentation;
653
+ /**
654
+ * How far to darken the derived edge color toward black, 0–1 (default 0.75). Only applies when
655
+ * `color` is omitted. Higher = darker edges; 0 leaves edges the surface color, 1 makes them black.
656
+ */
657
+ darken?: number;
627
658
  /** Edge thickness in CSS px. Default 1.5. */
628
659
  width?: number;
629
660
  /**
630
661
  * Crease angle in degrees: an edge is kept only where its two faces differ by more than this.
631
- * Default 30. Higher = fewer edges (only sharp creases); lower = more (catches gentle bends).
662
+ * Default 44. Higher = fewer edges (only sharp creases); lower = more (catches gentle bends).
632
663
  */
633
664
  thresholdAngle?: number;
634
665
  /**
@@ -114,11 +114,19 @@ type Look = (typeof LOOKS)[number];
114
114
  type EdgesConfig = {
115
115
  /** Auto-attach edge overlays to meshes as they load. Default false (opt-in). */
116
116
  enabled?: boolean;
117
- /** Edge color. Default near-black. */
117
+ /**
118
+ * Force a single edge color for all meshes. Omit (the default) to derive each mesh's edge color
119
+ * from its own surface material, darkened by `darken` — so edges read as the object's own outline.
120
+ */
118
121
  color?: THREE.ColorRepresentation;
122
+ /**
123
+ * How far derived edge colors are darkened toward black, 0–1 (default 0.75). Ignored when `color`
124
+ * is set.
125
+ */
126
+ darken?: number;
119
127
  /** Edge thickness in CSS px. Default 1.5. */
120
128
  width?: number;
121
- /** Crease angle (degrees): keep edges where faces differ by more than this. Default 30. */
129
+ /** Crease angle (degrees): keep edges where faces differ by more than this. Default 44. */
122
130
  thresholdAngle?: number;
123
131
  /** Fade an overlay out as its mesh shrinks on screen, so far zoom-outs stay clean. Default true. */
124
132
  distanceFade?: boolean;
@@ -320,6 +328,13 @@ interface Grid {
320
328
  readonly object: THREE.Mesh;
321
329
  /** Keep the fade centered on the camera so the grid feels infinite as you move. Call per frame. */
322
330
  update(cameraPosition: THREE.Vector3): void;
331
+ /**
332
+ * Rescale the grid's cell spacing and fade radius to the loaded content's extent. Call after a
333
+ * geometry change (e.g. right after `updateScene`) so a part that is 3 units or 3000 units wide
334
+ * both get sensibly-sized cells and a fade that reaches past the model. No-op for empty/degenerate
335
+ * bounds — the grid keeps its last (or default) scale. See {@link Grid.fitToContent}'s impl notes.
336
+ */
337
+ fitToContent(bounds: THREE.Box3): void;
323
338
  setVisible(visible: boolean): void;
324
339
  dispose(): void;
325
340
  }
@@ -550,6 +565,12 @@ declare const initThree: (canvas: HTMLCanvasElement, options?: ThreeInitializerO
550
565
  * loading or replacing geometry (e.g. after `updateScene`). No-op when sunlight/shadows are off.
551
566
  */
552
567
  updateShadowBounds: () => void;
568
+ /**
569
+ * Rescale the grid's cell spacing and fade radius to the current scene content, so parts of any
570
+ * size get readable cells and a fade that reaches past the model. Call after loading or replacing
571
+ * geometry (e.g. after `updateScene`). No-op when the grid is off or there's no content.
572
+ */
573
+ updateGridScale: () => void;
553
574
  dispose: () => void;
554
575
  fitToView: () => void;
555
576
  clearSelection: () => void;
@@ -622,13 +643,23 @@ declare namespace threeMaterials {
622
643
  * occlusion of hidden edges exact.
623
644
  */
624
645
  interface EdgeOptions {
625
- /** Edge color. Default near-black. */
646
+ /**
647
+ * Force a single edge color for every overlay. When omitted (the default), each overlay derives
648
+ * its color from its own mesh's material — a darkened tint of the surface — so edges read as the
649
+ * object's own outline rather than a uniform black frame. Meshes with no readable material color
650
+ * fall back to {@link DEFAULT_EDGE_COLOR}.
651
+ */
626
652
  color?: THREE.ColorRepresentation;
653
+ /**
654
+ * How far to darken the derived edge color toward black, 0–1 (default 0.75). Only applies when
655
+ * `color` is omitted. Higher = darker edges; 0 leaves edges the surface color, 1 makes them black.
656
+ */
657
+ darken?: number;
627
658
  /** Edge thickness in CSS px. Default 1.5. */
628
659
  width?: number;
629
660
  /**
630
661
  * Crease angle in degrees: an edge is kept only where its two faces differ by more than this.
631
- * Default 30. Higher = fewer edges (only sharp creases); lower = more (catches gentle bends).
662
+ * Default 44. Higher = fewer edges (only sharp creases); lower = more (catches gentle bends).
632
663
  */
633
664
  thresholdAngle?: number;
634
665
  /**
@@ -1,2 +1,2 @@
1
- import{K as v,L as c,M as j,N as z,a as e,b as r,c as t,d as o,e as i,f as a,g as s,h as p,i as n,j as l,k as f,l as m,m as y,n as u,o as x,p as d,u as C,v as g,w as h}from"./chunk-PX2YTSHJ.js";import"./chunk-WPB2LKCD.js";export{n as EDGE_USERDATA_KIND,g as LOOKS,e as Materials,j as SCALE_FACTORS,l as addEdges,o as applyOffset,i as computeCombinedBoundingBox,a as createCameraController,s as createGrid,u as createLabelLayer,d as createMeasureTool,y as createRenderPipeline,p as createViewGizmo,z as getThreeMeshesFromComputeResponse,C as initThree,f as isEdgeOverlay,t as parseColor,h as parseDisplayItems,c as parseMeshBatchBlob,v as parseMeshBatchObject,m as removeEdges,x as snapToVertex,r as updateScene};
1
+ import{K as v,L as c,M as j,N as z,a as e,b as r,c as t,d as o,e as i,f as a,g as s,h as p,i as n,j as l,k as f,l as m,m as y,n as u,o as x,p as d,u as C,v as g,w as h}from"./chunk-INP5HVA2.js";import"./chunk-Y3M7P3BW.js";export{n as EDGE_USERDATA_KIND,g as LOOKS,e as Materials,j as SCALE_FACTORS,l as addEdges,o as applyOffset,i as computeCombinedBoundingBox,a as createCameraController,s as createGrid,u as createLabelLayer,d as createMeasureTool,y as createRenderPipeline,p as createViewGizmo,z as getThreeMeshesFromComputeResponse,C as initThree,f as isEdgeOverlay,t as parseColor,h as parseDisplayItems,c as parseMeshBatchBlob,v as parseMeshBatchObject,m as removeEdges,x as snapToVertex,r as updateScene};
2
2
  //# sourceMappingURL=visualization.js.map
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@selvajs/compute",
3
- "version": "3.1.0-beta.11",
3
+ "version": "3.1.0-beta.12",
4
4
  "description": "TypeScript library for Rhino Compute Server - Grasshopper and RhinoCommon",
5
5
  "author": "VektorNode",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/VektorNode/selva-compute.git"
9
+ "url": "git+https://github.com/VektorNode/selva.git",
10
+ "directory": "packages/compute"
10
11
  },
11
12
  "type": "module",
12
13
  "keywords": [
@@ -32,33 +33,53 @@
32
33
  "types": "./dist/index.d.ts",
33
34
  "exports": {
34
35
  ".": {
35
- "types": "./dist/index.d.ts",
36
- "import": "./dist/index.js",
37
- "require": "./dist/index.cjs"
36
+ "import": {
37
+ "types": "./dist/index.d.ts",
38
+ "default": "./dist/index.js"
39
+ },
40
+ "require": {
41
+ "types": "./dist/index.d.cts",
42
+ "default": "./dist/index.cjs"
43
+ }
38
44
  },
39
45
  "./grasshopper": {
40
- "types": "./dist/grasshopper.d.ts",
41
- "import": "./dist/grasshopper.js",
42
- "require": "./dist/grasshopper.cjs"
46
+ "import": {
47
+ "types": "./dist/grasshopper.d.ts",
48
+ "default": "./dist/grasshopper.js"
49
+ },
50
+ "require": {
51
+ "types": "./dist/grasshopper.d.cts",
52
+ "default": "./dist/grasshopper.cjs"
53
+ }
43
54
  },
44
55
  "./visualization": {
45
- "types": "./dist/visualization.d.ts",
46
- "import": "./dist/visualization.js",
47
- "require": "./dist/visualization.cjs"
56
+ "import": {
57
+ "types": "./dist/visualization.d.ts",
58
+ "default": "./dist/visualization.js"
59
+ },
60
+ "require": {
61
+ "types": "./dist/visualization.d.cts",
62
+ "default": "./dist/visualization.cjs"
63
+ }
48
64
  },
49
65
  "./core": {
50
- "types": "./dist/core.d.ts",
51
- "import": "./dist/core.js",
52
- "require": "./dist/core.cjs"
66
+ "import": {
67
+ "types": "./dist/core.d.ts",
68
+ "default": "./dist/core.js"
69
+ },
70
+ "require": {
71
+ "types": "./dist/core.d.cts",
72
+ "default": "./dist/core.cjs"
73
+ }
53
74
  }
54
75
  },
55
76
  "files": [
56
77
  "dist",
57
78
  "README.md",
58
- "LICENSE.md"
79
+ "LICENSE"
59
80
  ],
60
81
  "engines": {
61
- "node": ">=20.0.0"
82
+ "node": ">=22.0.0"
62
83
  },
63
84
  "publishConfig": {
64
85
  "access": "public",
@@ -84,28 +105,28 @@
84
105
  "devDependencies": {
85
106
  "@changesets/cli": "^2.30.0",
86
107
  "@eslint/js": "^10.0.1",
87
- "@types/node": "^26.1.0",
88
- "@types/three": "^0.184.1",
89
- "@vitest/coverage-v8": "^3.2.4",
90
- "eslint": "^10.4.1",
108
+ "@types/node": "^22.20.1",
109
+ "@types/three": "^0.184.0",
110
+ "@vitest/coverage-v8": "^3.2.6",
111
+ "eslint": "^10.7.0",
91
112
  "eslint-config-prettier": "^10.1.8",
92
- "eslint-plugin-svelte": "^3.15.0",
93
- "globals": "^17.4.0",
113
+ "eslint-plugin-svelte": "^3.20.0",
114
+ "globals": "^17.5.0",
94
115
  "husky": "^9.1.7",
95
116
  "lint-staged": "^17.0.7",
96
- "prettier": "^3.8.1",
97
- "prettier-plugin-svelte": "^4.1.0",
98
- "prettier-plugin-tailwindcss": "^0.8.0",
99
- "svelte": "^5.53.7",
100
- "three": "^0.185.1",
117
+ "prettier": "^3.8.3",
118
+ "prettier-plugin-svelte": "^3.5.1",
119
+ "prettier-plugin-tailwindcss": "^0.7.3",
120
+ "svelte": "5.56.4",
121
+ "three": "^0.184.0",
101
122
  "tsup": "^8.5.1",
102
123
  "typedoc": "^0.28.17",
103
124
  "typedoc-plugin-extras": "^4.0.1",
104
125
  "typedoc-plugin-missing-exports": "^4.1.2",
105
126
  "typescript": "^6.0.3",
106
- "typescript-eslint": "^8.56.1",
107
- "vite": "^8.0.8",
108
- "vitest": "^3.2.4"
127
+ "typescript-eslint": "^8.64.0",
128
+ "vite": "^8.1.4",
129
+ "vitest": "^3.2.7"
109
130
  },
110
131
  "scripts": {
111
132
  "build": " pnpm type-check && pnpm clean && tsup",
@@ -1,62 +0,0 @@
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 _chunkCUQQ3ZBVcjs = require('./chunk-CUQQ3ZBV.cjs');var At={};_chunkCUQQ3ZBVcjs.a.call(void 0, At,{CONCRETE_MATERIAL:()=>Pe,EMISSIVE_MATERIAL:()=>Oe,GLASS_MATERIAL:()=>Ve,METAL_MATERIAL:()=>De,PLASTIC_MATERIAL:()=>Fe,RUBBER_MATERIAL:()=>Be,SHARED_MATERIALS:()=>ye,WOOD_MATERIAL:()=>ke});var _three = require('three'); var D = _interopRequireWildcard(_three); var B = _interopRequireWildcard(_three); var U = _interopRequireWildcard(_three); var k = _interopRequireWildcard(_three); var G = _interopRequireWildcard(_three); var W = _interopRequireWildcard(_three); var qe = _interopRequireWildcard(_three); var O = _interopRequireWildcard(_three); var Ee = _interopRequireWildcard(_three); var E = _interopRequireWildcard(_three); var se = _interopRequireWildcard(_three); var $ = _interopRequireWildcard(_three); var P = _interopRequireWildcard(_three);var Oe=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}),De=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}),Pe=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}),Fe=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}),Ve=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}),Be=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}),ke=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([Oe,De,Pe,Fe,Ve,Be,ke]);var K={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 qr(e,r,t,n,i){if(Ot(e),r.length===0)return;r.forEach(u=>{e.add(u)});let o=be(r),a=o.getCenter(new B.Vector3),s=o.getSize(new B.Vector3),l=Math.max(s.x,s.y,s.z);if(l/Math.min(s.x||1,s.y||1,s.z||1)>K.SCALE_RATIO_THRESHOLD||l>K.HUGE_THRESHOLD?(t.near=l*K.NEAR_PLANE_FACTOR.TINY,t.far=l*K.FAR_PLANE_FACTOR.HUGE):l>K.LARGE_THRESHOLD?(t.near=l*K.NEAR_PLANE_FACTOR.SMALL,t.far=l*K.FAR_PLANE_FACTOR.LARGE):(t.near=Math.max(.01,l*K.NEAR_PLANE_FACTOR.NORMAL),t.far=Math.max(2e3,l*K.FAR_PLANE_FACTOR.NORMAL)),t.updateProjectionMatrix(),!i){let u=l*K.INITIAL_DISTANCE_MULTIPLIER;t.position.set(a.x+u*.8,a.y+u,a.z+u*1.2),n.target.copy(a),n.update()}}function Ue(e){if(!e||typeof e!="string")return _chunkCUQQ3ZBVcjs.e.call(void 0, ).warn(`Invalid color input: ${e}, using white`),new B.Color(16777215);let r=e.trim();if(/^#?[0-9A-Fa-f]{6}$/.test(r))try{let n=r.startsWith("#")?r:`#${r}`;return new B.Color(n)}catch (e2){return _chunkCUQQ3ZBVcjs.e.call(void 0, ).warn(`Invalid hex color: ${e}, using white`),new B.Color(16777215)}if(r.includes(",")){let n=r.split(",").map(i=>parseInt(i.trim(),10));if(n.length===3&&n.every(i=>!isNaN(i)&&i>=0&&i<=255))return new B.Color(n[0]/255,n[1]/255,n[2]/255)}let t=r.toLowerCase();return t in B.Color.NAMES?new B.Color(B.Color.NAMES[t]):(_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn(`Invalid color string: ${e}, using white`),new B.Color(16777215))}function ze(e,r,t="z"){e.forEach(n=>{n.position[t]-=r})}function be(e){let r=new B.Box3;return e.length===0||e.forEach(t=>{t.updateMatrixWorld(!0);let n=new B.Box3().setFromObject(t);r.union(n)}),r}var St=new Set(["grid","floor","label-layer","measure"]);function Lt(e){let r=e;for(;r;){if(typeof r.userData.id=="string"&&St.has(r.userData.id))return!0;r=r.parent}return!1}function Q(e){e.updateMatrixWorld(!0);let r=new B.Box3;return e.traverse(t=>{let n=t;t.visible&&!Lt(t)&&n.geometry&&r.expandByObject(t)}),r}var It=new Set(["floor","grid","label-layer"]);function Ot(e){[...e.children].forEach(t=>{It.has(t.userData.id)||t.userData.source!=="user"&&(t.traverse(n=>{let i=n;if(!i.geometry&&!i.material)return;_optionalChain([i, 'access', _2 => _2.geometry, 'optionalAccess', _3 => _3.dispose, 'call', _4 => _4()]);let o=i.material;if(!o)return;(Array.isArray(o)?o:[o]).forEach(s=>{if(!ye.has(s)){for(let l of Object.values(s))l instanceof B.Texture&&l.dispose();s.dispose()}})}),t.removeFromParent())})}function Dt(e){let r=e.clone().normalize(),t=new U.Vector3(0,0,1),n=new U.Vector3(0,1,0),i=Math.abs(r.dot(t))>.9?n:t,o=new U.Vector3().crossVectors(r,i).normalize(),a=new U.Vector3().crossVectors(o,r).normalize();return{top:r.clone(),bottom:r.clone().negate(),front:a.clone(),back:a.clone().negate(),right:o.clone(),left:o.clone().negate(),iso:a.clone().multiplyScalar(1.2).add(o.clone()).add(r.clone()).normalize()}}function _e(e){let{scene:r,perspective:t,controls:n,onActiveCameraChange:i}=e,o=(_nullishCoalesce(e.up, () => (t.up))).clone().normalize(),a=Dt(o),s=new U.OrthographicCamera(-1,1,1,-1,t.near,t.far);s.up.copy(o);let l="perspective",c=t.aspect,u=()=>l==="perspective"?t:s,m=null,d=()=>{_optionalChain([m, 'optionalAccess', _5 => _5.cancel, 'call', _6 => _6()]),m=null},f=()=>{let R=(l==="orthographic"?s:t).position.distanceTo(n.target)*Math.tan(t.fov*Math.PI/360),w=R*c;s.left=-w,s.right=w,s.top=R,s.bottom=-R,s.near=t.near,s.far=t.far,s.updateProjectionMatrix()},b=p=>{if(p!==l){if(d(),p==="orthographic")s.position.copy(t.position),s.up.copy(t.up),s.lookAt(n.target),s.zoom=1,f();else{let R=(s.top-s.bottom)/(2*s.zoom)/Math.tan(t.fov*Math.PI/360),w=s.position.clone().sub(n.target);w.lengthSq()<1e-12&&w.copy(o),w.normalize(),t.position.copy(n.target).add(w.multiplyScalar(R))}l=p,n.object=u(),n.update(),i(u())}},T=(p,g,R,w)=>{let S=t.fov*(Math.PI/180),F=g/(2*Math.tan(S/2))*1.5,Y=Pt(R,o),V=p.clone().add(Y.clone().multiplyScalar(F)),X=u();l==="orthographic"&&(s.zoom=1),d(),w?m=Vt(X,n,V,p,()=>{l==="orthographic"&&f()}):(X.position.copy(V),n.target.copy(p),l==="orthographic"&&f(),n.update())},H=(p,g=!0)=>{let R=Q(r),w=R.isEmpty()?n.target.clone():R.getCenter(new U.Vector3),S=R.isEmpty()?new U.Vector3(1,1,1):R.getSize(new U.Vector3),F=Math.max(S.x,S.y,S.z)||1;T(w,F,p,g)};return{getActiveCamera:u,getProjection:()=>l,setProjection:b,toggleProjection:()=>(b(l==="perspective"?"orthographic":"perspective"),l),setView:(p,g=!0)=>{H(a[p],g)},setViewDirection:H,frameBounds:(p,g=!0)=>{if(p.isEmpty())return;let R=p.getCenter(new U.Vector3),w=p.getSize(new U.Vector3),S=Math.max(w.x,w.y,w.z)||1,F=u().position.clone().sub(n.target);F.lengthSq()<1e-12&&F.copy(a.iso),T(R,S,F.normalize(),g)},setRotateEnabled:p=>{n.enableRotate=p},isRotateEnabled:()=>n.enableRotate,updateAspect:(p,g)=>{c=g===0?c:p/g,l==="orthographic"&&f()},dispose:d}}function Pt(e,r){let t=r.clone().normalize(),n=e.clone().normalize();if(Math.abs(n.dot(t))<.9999)return e;let i=Math.abs(t.dot(new U.Vector3(0,0,1)))>.9?new U.Vector3(0,1,0):new U.Vector3(0,0,1),o=new U.Vector3().crossVectors(t,i).normalize(),a=.5*Math.PI/180;return n.multiplyScalar(Math.cos(a)).add(o.multiplyScalar(Math.sin(a))).normalize()}var Ft=e=>1-Math.pow(1-e,3);function Vt(e,r,t,n,i,o=250){let a=e.position.clone(),s=r.target.clone(),l=performance.now(),c=null,u=()=>{c=null;let m=Ft(Math.min((performance.now()-l)/o,1));e.position.lerpVectors(a,t,m),r.target.lerpVectors(s,n,m),i(),r.update(),m<1&&(c=requestAnimationFrame(u))};return c=requestAnimationFrame(u),{cancel:()=>{c!==null&&(cancelAnimationFrame(c),c=null)}}}var Bt=`
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
- `,kt=`
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 je(e={}){let{cellSize:r=1,majorEvery:t=10,cellColor:n=8947848,majorColor:i=4473924,fadeDistance:o=100,plane:a="y"}=e,s=a==="y"?new k.Vector2(0,2):a==="z"?new k.Vector2(0,1):new k.Vector2(1,2),l=o*2.5,c=new k.PlaneGeometry(l,l);a==="y"?c.rotateX(-Math.PI/2):a==="x"&&c.rotateY(Math.PI/2);let u=new k.ShaderMaterial({vertexShader:Bt,fragmentShader:kt,transparent:!0,depthWrite:!1,side:k.DoubleSide,uniforms:{uAxes:{value:s},uCell:{value:r},uMajor:{value:t},uCellColor:{value:new k.Color(n)},uMajorColor:{value:new k.Color(i)},uCenter:{value:new k.Vector3},uFade:{value:o}}}),m=new k.Mesh(c,u);m.name="grid",m.userData.id="grid",m.renderOrder=-1;let d=new k.Vector3;return{object:m,update:f=>{a==="y"?(m.position.set(f.x,0,f.z),d.set(f.x,0,f.z)):a==="z"?(m.position.set(f.x,f.y,0),d.set(f.x,f.y,0)):(m.position.set(0,f.y,f.z),d.set(0,f.y,f.z)),u.uniforms.uCenter.value.copy(d)},setVisible:f=>{m.visible=f},dispose:()=>{m.removeFromParent(),c.dispose(),u.dispose()}}}var _ViewHelperjs = require('three/addons/helpers/ViewHelper.js');function Ne(e){let{camera:r,domElement:t,controller:n}=e,i=new (0, _ViewHelperjs.ViewHelper)(r,t);i.setLabels("X","Y","Z");let o=!0,a=128,s=new G.Raycaster,l=new G.OrthographicCamera(-2,2,2,-2,0,4);l.position.set(0,0,2),l.updateMatrixWorld();let c={posX:new G.Vector3(1,0,0),negX:new G.Vector3(-1,0,0),posY:new G.Vector3(0,1,0),negY:new G.Vector3(0,-1,0),posZ:new G.Vector3(0,0,1),negZ:new G.Vector3(0,0,-1)},u=d=>{let f=t.getBoundingClientRect(),b=f.left+t.offsetWidth-a-i.location.right,T=f.top+t.offsetHeight-a-i.location.bottom,H=new G.Vector2((d.clientX-b)/a*2-1,-((d.clientY-T)/a)*2+1);if(Math.abs(H.x)>1||Math.abs(H.y)>1)return null;i.quaternion.copy(r.quaternion).invert(),i.updateMatrixWorld(),s.setFromCamera(H,l);let x=s.intersectObjects(i.children,!1);for(let y of x){let C=_optionalChain([y, '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:d=>{if(!o)return;let f=d.autoClear;d.autoClear=!1,i.render(d),d.autoClear=f},update:()=>{},handleClick:d=>{if(!o)return!1;let f=u(d);return f?(n.getProjection()==="orthographic"&&n.setProjection("perspective"),n.setViewDirection(c[f],!1),!0):!1},isAnimating:!1,setVisible:d=>{o=d},isVisible:()=>o,dispose:()=>i.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,Nt=1.5,Gt=30,Wt=80,Ge=20,$t=1,Yt=2;function $e(e,r){let t=Array.isArray(e.material)?e.material:[e.material];for(let n of t)n&&(n.polygonOffset=r,n.polygonOffsetFactor=r?$t:0,n.polygonOffsetUnits=r?Yt:0)}var Te=new WeakMap;function Ye(e,r={}){let t=new W.Color(_nullishCoalesce(r.color, () => (jt))),n=_nullishCoalesce(r.width, () => (Nt)),i=_nullishCoalesce(r.thresholdAngle, () => (Gt)),o=_nullishCoalesce(r.distanceFade, () => (!0)),a=Zt(t,n,o),s=[];return e.traverse(l=>{if(!(l instanceof W.Mesh)||l.userData.id==="floor"||l.userData.id==="grid"||l.userData.kind===de||l.children.some(u=>_optionalChain([u, 'access', _10 => _10.userData, 'optionalAccess', _11 => _11.kind])===de)||!l.geometry)return;let c=Kt(l.geometry,a,i,o);l.add(c),$e(l,!0),s.push(c)}),s.length===0&&a.dispose(),s}function Xt(e,r){let t=Te.get(e);t||(t=new Map,Te.set(e,t));let n=t.get(r);if(!n){let i=new W.EdgesGeometry(e,r),o=new _LineSegmentsGeometryjs.LineSegmentsGeometry;o.setPositions(i.attributes.position.array),i.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', _12 => _12.get, 'call', _13 => _13(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 Zt(e,r,t){let n=new (0, _LineMaterialjs.LineMaterial)({color:e});return n.linewidth=r,t&&(n.transparent=!0),n}function Kt(e,r,t,n){let i=Xt(e,t),o=new (0, _LineSegments2js.LineSegments2)(i,r);return o.userData.kind=de,o.userData.edgeSource=e,o.userData.edgeThresholdAngle=t,o.raycast=()=>{},n&&en(o),o}var We=new W.Vector3,Jt=new W.Vector3;function Qt(e,r,t){e.geometry.boundingSphere||e.geometry.computeBoundingSphere();let n=e.geometry.boundingSphere;if(!n||n.radius<=0)return 1/0;let i=n.radius*e.matrixWorld.getMaxScaleOnAxis();if(We.copy(n.center).applyMatrix4(e.matrixWorld),r.isPerspectiveCamera){let o=r,a=Jt.setFromMatrixPosition(r.matrixWorld).distanceTo(We);if(a<=i)return 1/0;let s=Math.tan(W.MathUtils.degToRad(o.fov)*.5);return i/(a*s)*t}if(r.isOrthographicCamera){let o=r,a=(o.top-o.bottom)/o.zoom;return a>0?2*i/a*t:1/0}return 1/0}function en(e){e.onBeforeRender=(r,t,n)=>{_LineSegments2js.LineSegments2.prototype.onBeforeRender.call(e,r);let i=e.material,o=Qt(e,n,i.resolution.y);i.opacity=W.MathUtils.clamp((o-Ge)/(Wt-Ge),0,1)}}function tn(e){return _optionalChain([e, 'access', _14 => _14.userData, 'optionalAccess', _15 => _15.kind])===de}function io(e){let r=[];e.traverse(n=>{n instanceof _LineSegments2js.LineSegments2&&tn(n)&&r.push(n)});let t=new Set;for(let n of r)qt(n),t.add(n.material),n.parent instanceof W.Mesh&&$e(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 Xe(e,r,t,n,i,o){let a=new (0, _EffectComposerjs.EffectComposer)(e),s=new (0, _RenderPassjs.RenderPass)(r,t);a.addPass(s);let l=new (0, _GTAOPassjs.GTAOPass)(r,t,n,i);l.blendIntensity=_nullishCoalesce(o.aoIntensity, () => (1)),l.updateGtaoMaterial({screenSpaceRadius:!0}),a.addPass(l);let c=new _SMAAPassjs.SMAAPass;a.addPass(c);let u=new _OutputPassjs.OutputPass;a.addPass(u),e.toneMapping=o.toneMapping,e.toneMappingExposure=o.toneMappingExposure;let m=_nullishCoalesce(o.aoPixelRatio, () => (1));return a.setSize(n,i),{render:d=>a.render(d),setSize:(d,f,b)=>{a.setPixelRatio(Math.min(b,m)),a.setSize(d,f)},setCamera:d=>{s.camera=d,l.camera=d;let f=d.isPerspectiveCamera?1:0;l.gtaoMaterial.defines.PERSPECTIVE_CAMERA!==f&&(l.gtaoMaterial.defines.PERSPECTIVE_CAMERA=f,l.gtaoMaterial.needsUpdate=!0)},dispose:()=>{a.dispose(),l.dispose(),c.dispose(),u.dispose()}}}var _CSS2DRendererjs = require('three/addons/renderers/CSS2DRenderer.js');function Ze(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 i={width:e.clientWidth||1,height:e.clientHeight||1};t.setSize(i.width,i.height);let o=new qe.Group;o.name="label-layer",o.userData.id="label-layer",r.add(o);let a=new Set;return{addLabel:(l,c,u)=>{let m=document.createElement("div");m.textContent=l,u?m.className=u:Object.assign(m.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"}),m.style.pointerEvents="none";let d=new (0, _CSS2DRendererjs.CSS2DObject)(m);return d.position.copy(c),o.add(d),a.add(d),{object:d,setPosition:f=>d.position.copy(f),setText:f=>{m.textContent=f},remove:()=>{d.removeFromParent(),m.remove(),a.delete(d)}}},render:(l,c)=>t.render(l,c),setSize:(l,c)=>t.setSize(l,c),dispose:()=>{a.forEach(l=>{l.removeFromParent(),l.element.remove()}),a.clear(),o.removeFromParent(),n.remove()}}}var _Line2js = require('three/addons/lines/Line2.js');var _LineGeometryjs = require('three/addons/lines/LineGeometry.js');var pn=12,fn=16763904,Ke=.015,Je={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 En(e){let r=e&&Je[e]||Je.Meters;return t=>`${(t/r.metersPerUnit).toPrecision(3)} ${r.suffix}`}function hn(e,r){if(e.isOrthographicCamera){let n=e;return Math.abs(n.top-n.bottom)/(n.zoom||1)*Ke}return((r?e.position.distanceTo(r):e.position.length())||1)*Ke}function gn(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 yn(e,r,t,n){let i=e.point.clone(),o=e.object,a=gn(e);if(!a||!o.geometry)return i;let s=o.geometry.attributes.position;if(!s)return i;let l=d=>{let f=d.clone().project(r);return new O.Vector2((f.x+1)/2*t.width,(1-f.y)/2*t.height)},c=l(i),u=i,m=n;for(let d of a){if(d>=s.count)continue;let b=new O.Vector3().fromBufferAttribute(s,d).applyMatrix4(o.matrixWorld),T=l(b).distanceTo(c);T<m&&(m=T,u=b)}return u}function Qe(e){let{canvas:r,scene:t,getActiveCamera:n,getViewTarget:i,labelLayer:o,options:a={}}=e,s=_nullishCoalesce(a.snapPixels, () => (pn)),l=new O.Color(_nullishCoalesce(a.color, () => (fn))),c=En(a.displayUnit),u=(L,v)=>`${c(L)}
54
- \u0394x ${c(v.x)} \u0394y ${c(v.y)} \u0394z ${c(v.z)}`,m=_nullishCoalesce(a.format, () => (u)),d=new O.Raycaster,f=new O.Vector2,b=!1,T=[],H=[],x=null,y=null,C=new O.PointsMaterial({color:l,size:8,sizeAttenuation:!1,depthTest:!1}),M=new O.PointsMaterial({color:l,size:11,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.5}),p=null,g=L=>{if(!L){p&&(p.visible=!1);return}if(!p){let v=new O.BufferGeometry;v.setAttribute("position",new O.Float32BufferAttribute([0,0,0],3)),p=new O.Points(v,M),p.renderOrder=1e3,p.userData.id="measure",p.raycast=()=>{},t.add(p)}p.position.copy(L),p.visible=!0},R=L=>{let v=new O.BufferGeometry;v.setAttribute("position",new O.Float32BufferAttribute([L.x,L.y,L.z],3));let _=new O.Points(v,C);return _.renderOrder=999,_.userData.id="measure",_.raycast=()=>{},t.add(_),_},w=()=>{T.length=0,H.forEach(L=>{L.geometry.dispose(),L.removeFromParent()}),H.length=0,x&&(x.geometry.dispose(),x.material.dispose(),x.removeFromParent(),x=null),_optionalChain([y, 'optionalAccess', _16 => _16.remove, 'call', _17 => _17()]),y=null},S=()=>{if(T.length!==2)return;let[L,v]=T,_=new _LineGeometryjs.LineGeometry;_.setPositions([L.x,L.y,L.z,v.x,v.y,v.z]);let j=new (0, _LineMaterialjs.LineMaterial)({color:l});j.linewidth=2,j.depthTest=!1,x=new (0, _Line2js.Line2)(_,j),x.renderOrder=998,x.userData.id="measure",x.raycast=()=>{},t.add(x);let ee=L.clone().add(v).multiplyScalar(.5),te=new O.Vector3(Math.abs(v.x-L.x),Math.abs(v.y-L.y),Math.abs(v.z-L.z));y=o.addLabel(m(L.distanceTo(v),te),ee,a.labelClassName)},F=L=>{let v=r.getBoundingClientRect();f.x=(L.clientX-v.left)/v.width*2-1,f.y=-((L.clientY-v.top)/v.height)*2+1;let _=n();d.setFromCamera(f,_);let j=hn(_,_optionalChain([i, 'optionalCall', _18 => _18()]));d.params.Line.threshold=j,d.params.Points.threshold=j;let ee=d.intersectObjects(t.children,!0).filter(te=>te.object.userData.id!=="measure"&&te.object.userData.id!=="grid");return ee.length===0?null:yn(ee[0],_,{width:v.width,height:v.height},s)},Y=null,V=0,X=()=>{V&&(cancelAnimationFrame(V),V=0),Y=null};return{setEnabled:L=>{b=L,L||(X(),w(),g(null))},isEnabled:()=>b,handleClick:L=>{if(!b)return!1;T.length===2&&w();let v=F(L);return v===null||(T.push(v),H.push(R(v)),T.length===2&&S()),!0},handleMove:L=>{b&&(Y=L,!V&&(V=requestAnimationFrame(()=>{V=0;let v=Y;Y=null,!(!b||!v)&&g(F(v))})))},clear:w,dispose:()=>{X(),w(),p&&(p.geometry.dispose(),p.removeFromParent(),p=null),C.dispose(),M.dispose()}}}var bn=64,Tn=256,Z=new Map,ae=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 et(e){pe=Math.max(1,e);for(let r of Z.values())r.anisotropy!==pe&&(r.anisotropy=pe,r.needsUpdate=!0)}function tt(e,r){let t=Rn(r),n=Z.get(t);if(n){Z.delete(t),Z.set(t,n),e.map=n,e.needsUpdate=!0;return}typeof document>"u"||xn(r,t).then(i=>{e.map=i,e.needsUpdate=!0}).catch(i=>{i instanceof fe||_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn(`Failed to load material texture ${r}:`,i)})}function Ro(){me++;for(let e of Z.values())e.dispose();Z.clear(),ae.clear()}function Rn(e){return e.length<=Tn?e:`data-uri:${Hn(e).toString(16)}:${e.length}`}function Hn(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 vn(e,r){for(Z.set(e,r);Z.size>bn;){let t=Z.keys().next().value,n=Z.get(t);Z.delete(t),n.dispose()}}function xn(e,r){let t=ae.get(r);if(!t){let n=me;t=new Promise((i,o)=>{new Ee.TextureLoader().load(e,a=>{if(n!==me){a.dispose(),o(new fe(e));return}a.colorSpace=Ee.SRGBColorSpace,a.anisotropy=pe,vn(r,a),ae.delete(r),i(a)},void 0,a=>{n===me&&ae.delete(r),o(a)})}),ae.set(r,t)}return t}var _OrbitControlsjs = require('three/addons/controls/OrbitControls.js');var _HDRLoaderjs = require('three/addons/loaders/HDRLoader.js');var wn=.5,Cn=.01,Mn=.05;function nt({camera:e,scene:r,groundNormals:t=[]}){let n=e.near,i=e.near,o=new se.Vector3,a=new se.Vector3;return{update:()=>{e.near!==i&&(n=e.near);let l=Q(r),c=n;if(!l.isEmpty()){let u=l.getSize(a).length()*.5,m=e.position.distanceTo(l.getCenter(o))-u;for(let d of t)m=Math.min(m,Math.abs(e.position.dot(d)));c=se.MathUtils.clamp(m*wn,n,e.far*Cn)}Math.abs(c-i)>i*Mn&&(e.near=c,e.updateProjectionMatrix(),i=c)}}}var oe=new E.Vector3(0,0,1),Ln="technical",He={studio:{toneMapping:E.ACESFilmicToneMapping,toneMappingExposure:1,envMapIntensity:1,environmentIntensity:1,hemisphereIntensity:.75,ambientIntensity:.4,cullBackfaces:!1,ambientOcclusion:!1},technical:{toneMapping:E.NeutralToneMapping,toneMappingExposure:1,envMapIntensity:.5,environmentIntensity:1,hemisphereIntensity:0,ambientIntensity:1,cullBackfaces:!1,ambientOcclusion:!1},showcase:{toneMapping:E.ACESFilmicToneMapping,toneMappingExposure:1.15,envMapIntensity:1.4,environmentIntensity:1.25,hemisphereIntensity:.35,ambientIntensity:.15,cullBackfaces:!1,ambientOcclusion:!1}};function In(e){let r=He[e];return{envMapIntensity:r.envMapIntensity,cullBackfaces:r.cullBackfaces}}function On(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 ko=function(e,r){let t=Dn(r||{}),n=_optionalChain([t, 'access', _19 => _19.environment, 'optionalAccess', _20 => _20.sceneUp])||oe,i=_nullishCoalesce(t.render.pixelRatio, () => (Math.min(window.devicePixelRatio,2))),o=Fn(t),a=zn(t,e);a.up.copy(n);let s=_n(e,t,i);et(s.capabilities.getMaxAnisotropy());let l=Nn(a,e,t),c=_e({scene:o,perspective:a,controls:l,onActiveCameraChange:()=>{},up:n}),u=()=>c.getActiveCamera(),m=!1;Bn(o,t,()=>m);let d=kn(o,t),f=d.sun,b=()=>{f&&Pn(f,Q(o))};_optionalChain([t, 'access', _21 => _21.floor, 'optionalAccess', _22 => _22.enabled])&&Un(o,t);let T=t.grid.enabled?je({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;T&&o.add(T.object);let H=t.gizmo.enabled?Ne({camera:a,domElement:e,controller:c}):null,x=[];if(T){let h=_nullishCoalesce(t.grid.plane, () => ("z"));x.push(new E.Vector3(h==="x"?1:0,h==="y"?1:0,h==="z"?1:0))}t.floor.enabled&&x.push(n.clone().normalize());let y=t.camera.dynamicNear?nt({camera:a,scene:o,groundNormals:x}):null,C=_nullishCoalesce(e.parentElement, () => (e)),M=t.measure.enabled?Ze(C,o):null,p=t.measure.enabled&&M?Qe({canvas:e,scene:o,getActiveCamera:u,labelLayer:M,options:{snapPixels:t.measure.snapPixels,color:t.measure.color,labelClassName:t.measure.labelClassName,displayUnit:t.measure.displayUnit,format:t.measure.format}}):null,g=t.events.enableEventHandlers!==!1?jn(e,o,c,t):{dispose:()=>{},fitToView:()=>{},clearSelection:()=>{}},R=5,w=0,S=0,F=h=>{w=h.clientX,S=h.clientY},Y=h=>Math.hypot(h.clientX-w,h.clientY-S)>R,V=h=>{if(!Y(h)){if(_optionalChain([p, 'optionalAccess', _23 => _23.handleClick, 'call', _24 => _24(h)])){h.stopImmediatePropagation();return}_optionalChain([H, 'optionalAccess', _25 => _25.handleClick, 'call', _26 => _26(h)])&&h.stopImmediatePropagation()}};(H||p)&&(e.addEventListener("mousedown",F,{capture:!0}),e.addEventListener("click",V,{capture:!0}));let X=h=>_optionalChain([p, 'optionalAccess', _27 => _27.handleMove, 'call', _28 => _28(h)]);p&&e.addEventListener("mousemove",X,{passive:!0});let ie=h=>{Ye(h,{color:t.edges.color,width:t.edges.width,thresholdAngle:t.edges.thresholdAngle,distanceFade:t.edges.distanceFade})},q=e.parentElement,L=()=>q?{width:q.clientWidth,height:q.clientHeight}:{width:window.innerWidth,height:window.innerHeight},v=null,_=()=>{let{width:h,height:I}=L(),N=Xe(s,o,u(),Math.max(1,h),Math.max(1,I),{toneMapping:_nullishCoalesce(t.render.toneMapping, () => (E.NeutralToneMapping)),toneMappingExposure:_nullishCoalesce(t.render.toneMappingExposure, () => (1)),aoIntensity:t.render.aoIntensity,aoPixelRatio:t.render.aoPixelRatio});return N.setSize(Math.max(1,h),Math.max(1,I),i),N},j=h=>{h&&!v?v=_():!h&&v&&(v.dispose(),v=null)};t.render.ambientOcclusion&&(v=_());let ee=h=>{h.ambientIntensity!==void 0&&(d.ambient.intensity=h.ambientIntensity),h.hemisphereIntensity!==void 0&&!d.hemisphere&&h.hemisphereIntensity>0&&(d.hemisphere=new E.HemisphereLight(_nullishCoalesce(h.hemisphereSkyColor, () => (t.lighting.hemisphereSkyColor)),_nullishCoalesce(h.hemisphereGroundColor, () => (t.lighting.hemisphereGroundColor)),h.hemisphereIntensity),d.hemisphere.position.copy(_nullishCoalesce(t.environment.sceneUp, () => (oe))),o.add(d.hemisphere)),d.hemisphere&&(h.hemisphereIntensity!==void 0&&(d.hemisphere.intensity=h.hemisphereIntensity),h.hemisphereSkyColor!==void 0&&d.hemisphere.color.set(h.hemisphereSkyColor),h.hemisphereGroundColor!==void 0&&d.hemisphere.groundColor.set(h.hemisphereGroundColor))},te=h=>{t.environment.environmentIntensity=h,o.environmentIntensity=h},gt=h=>{t.render.toneMappingExposure=h,s.toneMappingExposure=h,v&&(j(!1),j(!0))},yt=h=>{t.render.aoIntensity=h,v&&(j(!1),j(!0))},bt=h=>{let I=He[h];Ae=h,s.toneMapping=I.toneMapping,s.toneMappingExposure=I.toneMappingExposure,t.render.toneMapping=I.toneMapping,t.render.toneMappingExposure=I.toneMappingExposure,ee({hemisphereIntensity:I.hemisphereIntensity,ambientIntensity:I.ambientIntensity}),te(I.environmentIntensity),v&&j(!1),j(I.ambientOcclusion),o.traverse(N=>{if(N.userData.source!=="compute")return;let ue=N,Ct=Array.isArray(ue.material)?ue.material:ue.material?[ue.material]:[];for(let Le of Ct)"envMapIntensity"in Le&&(Le.envMapIntensity=I.envMapIntensity)})},Ae=t.look,Tt=()=>In(Ae),{animate:Rt,dispose:Ht}=Vn(s,o,a,u,c,l,L,i,t.events.onFrame,T,H,()=>v,M,y);Rt(),o.up.set(n.x,n.y,n.z),b();let Se=h=>{h.traverse(I=>{let N=I;!N.geometry&&!N.material||(_optionalChain([N, 'access', _29 => _29.geometry, 'optionalAccess', _30 => _30.dispose, 'call', _31 => _31()]),Array.isArray(N.material)?N.material.forEach(he):N.material&&he(N.material))})},vt=h=>{h.userData.source="user",o.add(h)},xt=h=>{h.removeFromParent(),Se(h)},wt=()=>{o.children.filter(I=>I.userData.source==="user").forEach(I=>{I.removeFromParent(),Se(I)})};return{scene:o,camera:a,controls:l,renderer:s,cameraController:c,grid:T,gizmo:H,measureTool:p,applyEdges:ie,setAmbientOcclusion:j,setLook:bt,setFillLights:ee,setEnvironmentIntensity:te,setToneMappingExposure:gt,setAoIntensity:yt,getMaterialAppearance:Tt,updateShadowBounds:b,dispose:()=>{m||(m=!0,Ht(),g.dispose(),(H||p)&&(e.removeEventListener("mousedown",F,{capture:!0}),e.removeEventListener("click",V,{capture:!0})),p&&e.removeEventListener("mousemove",X),_optionalChain([p, 'optionalAccess', _32 => _32.dispose, 'call', _33 => _33()]),_optionalChain([M, 'optionalAccess', _34 => _34.dispose, 'call', _35 => _35()]),_optionalChain([H, 'optionalAccess', _36 => _36.dispose, 'call', _37 => _37()]),_optionalChain([T, 'optionalAccess', _38 => _38.dispose, 'call', _39 => _39()]),_optionalChain([v, 'optionalAccess', _40 => _40.dispose, 'call', _41 => _41()]),c.dispose(),l.dispose(),s.dispose(),s.forceContextLoss(),o.traverse(h=>{let I=h;!I.geometry&&!I.material||(_optionalChain([I, 'access', _42 => _42.geometry, 'optionalAccess', _43 => _43.dispose, 'call', _44 => _44()]),Array.isArray(I.material)?I.material.forEach(he):I.material&&he(I.material))}),_optionalChain([o, 'access', _45 => _45.environment, 'optionalAccess', _46 => _46.dispose, 'call', _47 => _47()]),o.background instanceof E.Texture&&o.background.dispose())},fitToView:g.fitToView,clearSelection:g.clearSelection,addUserGeometry:vt,removeUserGeometry:xt,clearUserGeometry:wt}};function Dn(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],i=_nullishCoalesce(e.look, () => (Ln)),o=He[i];return{sceneScale:r,look:i,camera:{position:_optionalChain([e, 'access', _48 => _48.camera, 'optionalAccess', _49 => _49.position])||new E.Vector3(-n.cameraDistance,-n.cameraDistance,n.cameraDistance),fov:_optionalChain([e, 'access', _50 => _50.camera, 'optionalAccess', _51 => _51.fov])||20,near:_optionalChain([e, 'access', _52 => _52.camera, 'optionalAccess', _53 => _53.near])||n.near,far:_optionalChain([e, 'access', _54 => _54.camera, 'optionalAccess', _55 => _55.far])||n.far,target:_optionalChain([e, 'access', _56 => _56.camera, 'optionalAccess', _57 => _57.target])||new E.Vector3(0,0,0),dynamicNear:_nullishCoalesce(_optionalChain([e, 'access', _58 => _58.camera, 'optionalAccess', _59 => _59.dynamicNear]), () => (!0))},lighting:{enableSunlight:_nullishCoalesce(_optionalChain([e, 'access', _60 => _60.lighting, 'optionalAccess', _61 => _61.enableSunlight]), () => (!0)),sunlightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _62 => _62.lighting, 'optionalAccess', _63 => _63.sunlightIntensity]), () => (1)),sunlightPosition:_optionalChain([e, 'access', _64 => _64.lighting, 'optionalAccess', _65 => _65.sunlightPosition])||new E.Vector3(n.lightDistance,n.lightDistance,n.lightHeight),ambientLightColor:_optionalChain([e, 'access', _66 => _66.lighting, 'optionalAccess', _67 => _67.ambientLightColor])||new E.Color(4210752),ambientLightIntensity:_nullishCoalesce(_optionalChain([e, 'access', _68 => _68.lighting, 'optionalAccess', _69 => _69.ambientLightIntensity]), () => (o.ambientIntensity)),sunlightColor:_optionalChain([e, 'access', _70 => _70.lighting, 'optionalAccess', _71 => _71.sunlightColor])||16777215,enableHemisphereLight:_nullishCoalesce(_optionalChain([e, 'access', _72 => _72.lighting, 'optionalAccess', _73 => _73.enableHemisphereLight]), () => (o.hemisphereIntensity>0)),hemisphereSkyColor:_nullishCoalesce(_optionalChain([e, 'access', _74 => _74.lighting, 'optionalAccess', _75 => _75.hemisphereSkyColor]), () => (14673663)),hemisphereGroundColor:_nullishCoalesce(_optionalChain([e, 'access', _76 => _76.lighting, 'optionalAccess', _77 => _77.hemisphereGroundColor]), () => (7036754)),hemisphereIntensity:_nullishCoalesce(_optionalChain([e, 'access', _78 => _78.lighting, 'optionalAccess', _79 => _79.hemisphereIntensity]), () => (o.hemisphereIntensity))},environment:{hdrPath:_optionalChain([e, 'access', _80 => _80.environment, 'optionalAccess', _81 => _81.hdrPath])||"/baseHDR.hdr",backgroundColor:_optionalChain([e, 'access', _82 => _82.environment, 'optionalAccess', _83 => _83.backgroundColor])||new E.Color(15790320),enableEnvironmentLighting:_nullishCoalesce(_optionalChain([e, 'access', _84 => _84.environment, 'optionalAccess', _85 => _85.enableEnvironmentLighting]), () => (!0)),sceneUp:_optionalChain([e, 'access', _86 => _86.environment, 'optionalAccess', _87 => _87.sceneUp])||oe,showEnvironment:_nullishCoalesce(_optionalChain([e, 'access', _88 => _88.environment, 'optionalAccess', _89 => _89.showEnvironment]), () => (!1)),environmentIntensity:_nullishCoalesce(_optionalChain([e, 'access', _90 => _90.environment, 'optionalAccess', _91 => _91.environmentIntensity]), () => (o.environmentIntensity))},floor:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _92 => _92.floor, 'optionalAccess', _93 => _93.enabled]), () => (!1)),size:_optionalChain([e, 'access', _94 => _94.floor, 'optionalAccess', _95 => _95.size])||n.floorSize,color:_optionalChain([e, 'access', _96 => _96.floor, 'optionalAccess', _97 => _97.color])||new E.Color(8421504),roughness:_nullishCoalesce(_optionalChain([e, 'access', _98 => _98.floor, 'optionalAccess', _99 => _99.roughness]), () => (.7)),metalness:_nullishCoalesce(_optionalChain([e, 'access', _100 => _100.floor, 'optionalAccess', _101 => _101.metalness]), () => (0)),receiveShadow:_nullishCoalesce(_optionalChain([e, 'access', _102 => _102.floor, 'optionalAccess', _103 => _103.receiveShadow]), () => (!0))},render:{enableShadows:_nullishCoalesce(_optionalChain([e, 'access', _104 => _104.render, 'optionalAccess', _105 => _105.enableShadows]), () => (!0)),shadowMapSize:_optionalChain([e, 'access', _106 => _106.render, 'optionalAccess', _107 => _107.shadowMapSize])||2048,antialias:_nullishCoalesce(_optionalChain([e, 'access', _108 => _108.render, 'optionalAccess', _109 => _109.antialias]), () => (!0)),pixelRatio:_optionalChain([e, 'access', _110 => _110.render, 'optionalAccess', _111 => _111.pixelRatio])||Math.min(window.devicePixelRatio,2),toneMapping:_nullishCoalesce(_optionalChain([e, 'access', _112 => _112.render, 'optionalAccess', _113 => _113.toneMapping]), () => (o.toneMapping)),toneMappingExposure:_nullishCoalesce(_optionalChain([e, 'access', _114 => _114.render, 'optionalAccess', _115 => _115.toneMappingExposure]), () => (o.toneMappingExposure)),preserveDrawingBuffer:_nullishCoalesce(_optionalChain([e, 'access', _116 => _116.render, 'optionalAccess', _117 => _117.preserveDrawingBuffer]), () => (!1)),ambientOcclusion:_nullishCoalesce(_optionalChain([e, 'access', _118 => _118.render, 'optionalAccess', _119 => _119.ambientOcclusion]), () => (o.ambientOcclusion)),aoIntensity:_nullishCoalesce(_optionalChain([e, 'access', _120 => _120.render, 'optionalAccess', _121 => _121.aoIntensity]), () => (1)),aoPixelRatio:_nullishCoalesce(_optionalChain([e, 'access', _122 => _122.render, 'optionalAccess', _123 => _123.aoPixelRatio]), () => (1))},controls:{enableDamping:_nullishCoalesce(_optionalChain([e, 'access', _124 => _124.controls, 'optionalAccess', _125 => _125.enableDamping]), () => (!1)),dampingFactor:_optionalChain([e, 'access', _126 => _126.controls, 'optionalAccess', _127 => _127.dampingFactor])||.05,autoRotate:_nullishCoalesce(_optionalChain([e, 'access', _128 => _128.controls, 'optionalAccess', _129 => _129.autoRotate]), () => (!1)),autoRotateSpeed:_optionalChain([e, 'access', _130 => _130.controls, 'optionalAccess', _131 => _131.autoRotateSpeed])||.5,enableZoom:_nullishCoalesce(_optionalChain([e, 'access', _132 => _132.controls, 'optionalAccess', _133 => _133.enableZoom]), () => (!0)),enablePan:_nullishCoalesce(_optionalChain([e, 'access', _134 => _134.controls, 'optionalAccess', _135 => _135.enablePan]), () => (!0)),minDistance:_optionalChain([e, 'access', _136 => _136.controls, 'optionalAccess', _137 => _137.minDistance])||n.minDistance,maxDistance:_optionalChain([e, 'access', _138 => _138.controls, 'optionalAccess', _139 => _139.maxDistance])||1/0},grid:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _140 => _140.grid, 'optionalAccess', _141 => _141.enabled]), () => (!1)),cellSize:_nullishCoalesce(_optionalChain([e, 'access', _142 => _142.grid, 'optionalAccess', _143 => _143.cellSize]), () => (1)),majorEvery:_nullishCoalesce(_optionalChain([e, 'access', _144 => _144.grid, 'optionalAccess', _145 => _145.majorEvery]), () => (10)),cellColor:_nullishCoalesce(_optionalChain([e, 'access', _146 => _146.grid, 'optionalAccess', _147 => _147.cellColor]), () => (8947848)),majorColor:_nullishCoalesce(_optionalChain([e, 'access', _148 => _148.grid, 'optionalAccess', _149 => _149.majorColor]), () => (4473924)),fadeDistance:_nullishCoalesce(_optionalChain([e, 'access', _150 => _150.grid, 'optionalAccess', _151 => _151.fadeDistance]), () => (100)),plane:_nullishCoalesce(_optionalChain([e, 'access', _152 => _152.grid, 'optionalAccess', _153 => _153.plane]), () => (On(_nullishCoalesce(_optionalChain([e, 'access', _154 => _154.environment, 'optionalAccess', _155 => _155.sceneUp]), () => (oe)))))},gizmo:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _156 => _156.gizmo, 'optionalAccess', _157 => _157.enabled]), () => (!1))},edges:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _158 => _158.edges, 'optionalAccess', _159 => _159.enabled]), () => (!1)),color:_nullishCoalesce(_optionalChain([e, 'access', _160 => _160.edges, 'optionalAccess', _161 => _161.color]), () => (2236962)),width:_nullishCoalesce(_optionalChain([e, 'access', _162 => _162.edges, 'optionalAccess', _163 => _163.width]), () => (1.5)),thresholdAngle:_nullishCoalesce(_optionalChain([e, 'access', _164 => _164.edges, 'optionalAccess', _165 => _165.thresholdAngle]), () => (30)),distanceFade:_nullishCoalesce(_optionalChain([e, 'access', _166 => _166.edges, 'optionalAccess', _167 => _167.distanceFade]), () => (!0))},measure:{enabled:_nullishCoalesce(_optionalChain([e, 'access', _168 => _168.measure, 'optionalAccess', _169 => _169.enabled]), () => (!1)),snapPixels:_optionalChain([e, 'access', _170 => _170.measure, 'optionalAccess', _171 => _171.snapPixels]),color:_optionalChain([e, 'access', _172 => _172.measure, 'optionalAccess', _173 => _173.color]),labelClassName:_optionalChain([e, 'access', _174 => _174.measure, 'optionalAccess', _175 => _175.labelClassName]),displayUnit:_optionalChain([e, 'access', _176 => _176.measure, 'optionalAccess', _177 => _177.displayUnit]),format:_optionalChain([e, 'access', _178 => _178.measure, 'optionalAccess', _179 => _179.format])},events:{onBackgroundClicked:_optionalChain([e, 'access', _180 => _180.events, 'optionalAccess', _181 => _181.onBackgroundClicked]),onObjectSelected:_optionalChain([e, 'access', _182 => _182.events, 'optionalAccess', _183 => _183.onObjectSelected]),onMeshMetadataClicked:_optionalChain([e, 'access', _184 => _184.events, 'optionalAccess', _185 => _185.onMeshMetadataClicked]),onMeshDoubleClicked:_optionalChain([e, 'access', _186 => _186.events, 'optionalAccess', _187 => _187.onMeshDoubleClicked]),selectionColor:_optionalChain([e, 'access', _188 => _188.events, 'optionalAccess', _189 => _189.selectionColor])||"#ff0000",enableEventHandlers:_nullishCoalesce(_optionalChain([e, 'access', _190 => _190.events, 'optionalAccess', _191 => _191.enableEventHandlers]), () => (!0)),enableKeyboardControls:_nullishCoalesce(_optionalChain([e, 'access', _192 => _192.events, 'optionalAccess', _193 => _193.enableKeyboardControls]), () => (!0)),enableClickToFocus:_nullishCoalesce(_optionalChain([e, 'access', _194 => _194.events, 'optionalAccess', _195 => _195.enableClickToFocus]), () => (!0)),enableDoubleClickZoom:_nullishCoalesce(_optionalChain([e, 'access', _196 => _196.events, 'optionalAccess', _197 => _197.enableDoubleClickZoom]), () => (!0)),onReady:_optionalChain([e, 'access', _198 => _198.events, 'optionalAccess', _199 => _199.onReady]),onFrame:_optionalChain([e, 'access', _200 => _200.events, 'optionalAccess', _201 => _201.onFrame])}}}function he(e){for(let r of Object.values(e))r instanceof E.Texture&&r.dispose();e.dispose()}function Pn(e,r){if(r.isEmpty())return;let t=r.getCenter(new E.Vector3),n=r.getSize(new E.Vector3).length()*.5*1.2,i=e.shadow.camera;i.left=-n,i.right=n,i.top=n,i.bottom=-n,e.target.position.copy(t),e.target.updateMatrixWorld();let o=e.position.distanceTo(t);i.near=Math.max(n*.01,o-n),i.far=o+n,i.updateProjectionMatrix()}function Fn(e){let r=new E.Scene,t=typeof e.environment.backgroundColor=="string"?new E.Color(e.environment.backgroundColor):e.environment.backgroundColor;return r.background=t||null,r}function Vn(e,r,t,n,i,o,a,s,l,c,u,m,d,f){let b=null,T=performance.now(),H=()=>{let{width:C,height:M}=a();if(C===0||M===0)return;let p=Math.floor(C*s),g=Math.floor(M*s);(e.domElement.width!==p||e.domElement.height!==g)&&(e.setPixelRatio(s),e.setSize(C,M,!1),t.aspect=C/M,t.updateProjectionMatrix(),i.updateAspect(C,M),_optionalChain([m, 'optionalCall', _202 => _202(), 'optionalAccess', _203 => _203.setSize, 'call', _204 => _204(C,M,s)]),_optionalChain([d, 'optionalAccess', _205 => _205.setSize, 'call', _206 => _206(C,M)]))},x=function(){b=requestAnimationFrame(x);let C=performance.now(),M=(C-T)/1e3;T=C,H(),(o.enableDamping||o.autoRotate)&&o.update(),c&&c.update(n().position),u&&u.update(M),f&&f.update(),_optionalChain([l, 'optionalCall', _207 => _207(M)]);let p=n(),g=_optionalChain([m, 'optionalCall', _208 => _208()]);g?(g.setCamera(p),g.render(M)):e.render(r,p),d&&d.render(r,p),u&&u.render(e)};return{animate:x,dispose:()=>{b!==null&&(cancelAnimationFrame(b),b=null)}}}function Bn(e,r,t){r.environment.enableEnvironmentLighting?new (0, _HDRLoaderjs.HDRLoader)().load(r.environment.hdrPath||"/baseHDR.hdr",function(n){if(t()){n.dispose();return}if(!_optionalChain([n, 'optionalAccess', _209 => _209.image])){_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn("HDR loaded without image data; skipping environment map."),_optionalChain([n, 'optionalAccess', _210 => _210.dispose, 'call', _211 => _211()]),_optionalChain([r, 'access', _212 => _212.events, 'access', _213 => _213.onReady, 'optionalCall', _214 => _214()]);return}n.mapping=E.EquirectangularReflectionMapping,e.environment=n,e.environmentIntensity=_nullishCoalesce(r.environment.environmentIntensity, () => (1)),r.environment.showEnvironment&&(e.background=n),_optionalChain([r, 'access', _215 => _215.events, 'access', _216 => _216.onReady, 'optionalCall', _217 => _217()])},void 0,function(n){t()||(_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn("HDR texture could not be loaded, falling back to basic lighting:",n),_optionalChain([r, 'access', _218 => _218.events, 'access', _219 => _219.onReady, 'optionalCall', _220 => _220()]))}):_optionalChain([r, 'access', _221 => _221.events, 'access', _222 => _222.onReady, 'optionalCall', _223 => _223()])}function kn(e,r){let t=new E.AmbientLight(r.lighting.ambientLightColor,r.lighting.ambientLightIntensity);e.add(t);let n=null;if(r.lighting.enableHemisphereLight){n=new E.HemisphereLight(r.lighting.hemisphereSkyColor,r.lighting.hemisphereGroundColor,r.lighting.hemisphereIntensity);let a=_nullishCoalesce(r.environment.sceneUp, () => (oe));n.position.copy(a),e.add(n)}if(!r.lighting.enableSunlight)return{ambient:t,hemisphere:n,sun:null};let i=new E.DirectionalLight(_nullishCoalesce(r.lighting.sunlightColor, () => (16777215)),r.lighting.sunlightIntensity),o=r.lighting.sunlightPosition;return o&&i.position.set(o.x,o.y,o.z),r.render.enableShadows?(i.castShadow=!0,i.shadow.mapSize.width=r.render.shadowMapSize||2048,i.shadow.mapSize.height=r.render.shadowMapSize||2048,i.shadow.bias=-1e-4,i.shadow.normalBias=.02,i.shadow.radius=4,e.add(i),e.add(i.target),{ambient:t,hemisphere:n,sun:i}):(e.add(i),{ambient:t,hemisphere:n,sun:null})}function Un(e,r){let t=r.floor.size,n=new E.PlaneGeometry(t,t),i=typeof r.floor.color=="string"?new E.Color(r.floor.color):r.floor.color,o=new E.MeshStandardMaterial({color:i,roughness:r.floor.roughness,metalness:r.floor.metalness,side:E.DoubleSide}),a=new E.Mesh(n,o);a.userData.id="floor",a.name="floor";let s=(_optionalChain([r, 'access', _224 => _224.environment, 'optionalAccess', _225 => _225.sceneUp])||oe).clone().normalize();a.quaternion.setFromUnitVectors(new E.Vector3(0,0,1),s),a.position.set(0,0,0),r.floor.receiveShadow&&r.render.enableShadows&&(a.receiveShadow=!0),e.add(a)}function zn(e,r){let t=r.parentElement,n=t?t.clientWidth:window.innerWidth,i=t?t.clientHeight:window.innerHeight,o=new E.PerspectiveCamera(e.camera.fov,n/i,e.camera.near,e.camera.far),a=e.camera.position;return a&&o.position.set(a.x,a.y,a.z),o}function _n(e,r,t){let n=new E.WebGLRenderer({antialias:r.render.antialias,canvas:e,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:r.render.preserveDrawingBuffer,logarithmicDepthBuffer:!1}),i=e.parentElement,o=i?i.clientWidth:window.innerWidth,a=i?i.clientHeight:window.innerHeight;return i&&(e.style.width="100%",e.style.height="100%",e.style.display="block"),n.setSize(o,a,!1),n.setPixelRatio(t),r.render.enableShadows&&(n.shadowMap.enabled=!0,n.shadowMap.type=E.VSMShadowMap),n.toneMapping=r.render.toneMapping,n.toneMappingExposure=_nullishCoalesce(r.render.toneMappingExposure, () => (1)),n.outputColorSpace=E.SRGBColorSpace,n.sortObjects=!0,n}function jn(e,r,t,n){let i=new Set,o=new Map,a=new E.Raycaster,s=new E.Vector2,l=new E.Vector2,c=()=>t.getActiveCamera(),u=p=>{let g=p;for(;g;){if(!g.visible)return!1;g=g.parent}return!0},m=()=>{let p=Q(r);if(p.isEmpty()){_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn("No objects to fit to view");return}t.frameBounds(p,!1)},d=typeof n.events.selectionColor=="string"?new E.Color(n.events.selectionColor):n.events.selectionColor instanceof E.Color?n.events.selectionColor:new E.Color("#ff0000"),f=()=>{i.forEach(p=>{let g=p;if(o.has(p)){let R=o.get(p),w=g.material;w instanceof E.Material?w.dispose():Array.isArray(w)&&w.forEach(F=>F.dispose()),g.material=R,o.delete(p);let S=p;for(;S.parent;)S=S.parent;S!==r&&(R instanceof E.Material?R.dispose():R.forEach(F=>F.dispose()))}}),i.clear()},b=p=>{let g=p;if(!(g.material instanceof E.Material))return!1;o.set(p,g.material);let R=g.material.clone();return p instanceof E.Mesh&&"emissive"in R?R.emissive=d.clone():"color"in R&&(R.color=d.clone()),g.material=R,!0},T=()=>{let p=Q(r),g=p.isEmpty()?1:p.getSize(new E.Vector3).length();a.params.Points.threshold=g*.01},H=p=>{l.set(p.clientX,p.clientY)},x=p=>{let g=new E.Vector2(p.clientX,p.clientY);if(l.distanceTo(g)>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,T(),a.setFromCamera(s,c());let w=a.intersectObjects(r.children,!0).filter(S=>u(S.object));if(w.length>0){let S=w[0].object;i.has(S)||(f(),i.add(S),b(S),_optionalChain([n, 'access', _226 => _226.events, 'optionalAccess', _227 => _227.onObjectSelected, 'optionalCall', _228 => _228(S)]),S instanceof E.Mesh&&Object.keys(S.userData).length>0&&_optionalChain([n, 'access', _229 => _229.events, 'optionalAccess', _230 => _230.onMeshMetadataClicked, 'optionalCall', _231 => _231(S.userData)]))}else f(),_optionalChain([n, 'access', _232 => _232.events, 'optionalAccess', _233 => _233.onBackgroundClicked, 'optionalCall', _234 => _234({x:s.x,y:s.y})])},y=p=>{let g=e.getBoundingClientRect();s.x=(p.clientX-g.left)/g.width*2-1,s.y=-((p.clientY-g.top)/g.height)*2+1,T(),a.setFromCamera(s,c());let R=a.intersectObjects(r.children,!0).filter(F=>u(F.object));if(R.length===0)return;let w=R[0].object;if(_optionalChain([n, 'access', _235 => _235.events, 'optionalAccess', _236 => _236.onMeshDoubleClicked, 'optionalCall', _237 => _237(w)]),!_optionalChain([n, 'access', _238 => _238.events, 'optionalAccess', _239 => _239.enableDoubleClickZoom]))return;let S=new E.Box3().setFromObject(w);S.isEmpty()||t.frameBounds(S,!0)},C=p=>{if(_optionalChain([n, 'access', _240 => _240.events, 'optionalAccess', _241 => _241.enableKeyboardControls]))switch(p.key.toLowerCase()){case"f":p.preventDefault(),m();break;case"escape":p.preventDefault(),f();break;case" ":p.preventDefault(),m();break}};return _optionalChain([n, 'access', _242 => _242.events, 'optionalAccess', _243 => _243.enableClickToFocus])&&(e.addEventListener("mousedown",H),e.addEventListener("click",x),e.addEventListener("dblclick",y)),_optionalChain([n, 'access', _244 => _244.events, 'optionalAccess', _245 => _245.enableKeyboardControls])&&(e.setAttribute("tabindex","0"),e.addEventListener("keydown",C)),{dispose:()=>{e.removeEventListener("mousedown",H),e.removeEventListener("click",x),e.removeEventListener("dblclick",y),e.removeEventListener("keydown",C),f()},fitToView:m,clearSelection:f}}function Nn(e,r,t){let n=new (0, _OrbitControlsjs.OrbitControls)(e,r),i=t.camera.target;return i&&n.target.set(i.x,i.y,i.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 zo=["technical","studio","showcase"];function ge(e,r,t,n=!0){return{x:e,y:r,z:t}}var Yn="#ffffff",rt=12,Xn=4e-4,qn=12,Zn=.05;function ot(e,r={}){if(!e||e.length===0)return[];let{rhino:t,applyTransforms:n=!0}=r,i=[];for(let o of e)switch(o.kind){case"curve":{let a=Jn(o,t,n);a&&i.push(a);break}case"point":{let a=Qn(o,n);a&&i.push(a);break}default:{let s=o;_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn(`Skipping unknown display item kind: ${String(s.kind)}`);break}}return i}var Kn=2;function Jn(e,r,t){if(!r)return _chunkCUQQ3ZBVcjs.e.call(void 0, ).warn("No rhino3dm instance provided; skipping curve display item."),null;let n=er(e.json,r);if(!n)return null;let i;try{i=tr(n,t)}catch(m){return _chunkCUQQ3ZBVcjs.e.call(void 0, ).warn("Failed to tessellate curve display item; skipping.",m),null}finally{le(n)}if(i.length<2)return null;let o=[];for(let m of i)o.push(m.x,m.y,m.z);let a=new _LineGeometryjs.LineGeometry;a.setPositions(o);let s=it(e.color,e.opacity),l=new (0, _LineMaterialjs.LineMaterial)({color:s.color}),c=l;c.linewidth=_nullishCoalesce(e.width, () => (Kn)),c.transparent=s.transparent,c.opacity=s.opacity;let u=new (0, _Line2js.Line2)(a,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 Qn(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 _chunkCUQQ3ZBVcjs.e.call(void 0, ).warn(`Skipping point display item with missing or non-finite position (id: ${String(e.id)}).`),null;let{x:n,y:i,z:o}=ge(t.X,t.Y,t.Z,r),a=new $.BufferGeometry;a.setAttribute("position",new $.Float32BufferAttribute([n,i,o],3));let s=new $.PointsMaterial({...it(e.color,e.opacity),size:6,sizeAttenuation:!1}),l=new $.Points(a,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', _246 => _246.delete, 'optionalCall', _247 => _247()])}function er(e,r){try{let t=JSON.parse(e),n=r.CommonObject.decode(t);return n&&typeof n.pointAt=="function"?n:(le(n),_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn("Decoded display-item JSON is not a curve; skipping."),null)}catch(t){return _chunkCUQQ3ZBVcjs.e.call(void 0, ).warn("Failed to decode curve display item JSON:",t),null}}function tr(e,r){let t=nr(e,r);return t||rr(e,r)}function nr(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 i=[];for(let o=0;o<n.count;o++){let a=n.get(o),{x:s,y:l,z:c}=ge(a[0],a[1],a[2],r);i.push(new $.Vector3(s,l,c))}return le(n),i}function rr(e,r){let t=e.domain,n=t[0],o=t[1]-n,a=m=>{let d=e.pointAt(m),{x:f,y:b,z:T}=ge(d[0],d[1],d[2],r);return new $.Vector3(f,b,T)},s=or(e),l=n,c=a(n),u=[c];for(let m=0;m<rt;m++){let d=n+o*(m+1)/rt,f=a(d);ve(l,c,d,f,a,s,qn,u),u.push(f),l=d,c=f}return u}function ve(e,r,t,n,i,o,a,s){if(a<=0)return;let l=(e+t)/2,c=i(l),u=ar(c,r,n),m=ir(r,c,n);u<=o&&m<=Zn||(ve(e,r,l,c,i,o,a-1,s),s.push(c),ve(l,c,t,n,i,o,a-1,s))}function or(e){let r=e.getBoundingBox(),t=r.min,n=r.max;le(r);let i=Math.hypot(n[0]-t[0],n[1]-t[1],n[2]-t[2]);return Math.max(i*Xn,1e-6)}function ir(e,r,t){let n=r.x-e.x,i=r.y-e.y,o=r.z-e.z,a=t.x-r.x,s=t.y-r.y,l=t.z-r.z,c=Math.sqrt(n*n+i*i+o*o),u=Math.sqrt(a*a+s*s+l*l);if(c===0||u===0)return 0;let m=n*a+i*s+o*l,d=Math.max(-1,Math.min(1,m/(c*u)));return Math.acos(d)}function ar(e,r,t){let n=t.x-r.x,i=t.y-r.y,o=t.z-r.z,a=n*n+i*i+o*o;if(a===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*i+c*o)/a)),m=s-n*u,d=l-i*u,f=c-o*u;return Math.sqrt(m*m+d*d+f*f)}function it(e,r){let t=_nullishCoalesce(r, () => (1));return{color:new $.Color(_nullishCoalesce(e, () => (Yn))),transparent:t<1,opacity:t}}var _fflate = require('fflate');var at=1096174675,lr= exports.y =1515605075,st= exports.z =3,lt= exports.A =1,we= exports.B =1,cr= exports.C =2,ur= exports.D =4,dr= exports.E =8,mr= exports.F =16,Jo= exports.G =0,pr= exports.H =1,ct=12,ut=56,fr=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;function Ce(e){if(!fr)throw new (0, _chunkCUQQ3ZBVcjs.d)("SLVA parsing requires a little-endian host: the zero-copy geometry readers view the wire bytes in host byte order.",_chunkCUQQ3ZBVcjs.c.ENVIRONMENT_ERROR);let r=yr(gr(e)),t=new DataView(r.buffer,r.byteOffset,r.byteLength);if(r.byteLength<ct)throw z("Blob too small to contain SLVA header.",{expectedBytes:ct,availableBytes:r.byteLength});let n=0,i=t.getUint32(n,!0);if(n+=4,i!==at)throw z(`Invalid SLVA magic: 0x${i.toString(16)}`,{expectedMagic:`0x${at.toString(16)}`,actualMagic:`0x${i.toString(16)}`});let o=t.getUint32(n,!0);if(n+=4,o<lt||o>st)throw z(`Unsupported SLVA version: ${o}`,{minSupportedVersion:lt,maxSupportedVersion:st,actualVersion:o});let a=t.getUint32(n,!0);if(n+=4,n+a>r.byteLength)throw z("Insufficient data to read metadata JSON.",{expectedBytes:a,availableBytes:r.byteLength-n,offset:n});let s=r.subarray(n,n+a);n+=a;let l;try{l=JSON.parse(br(s))}catch(q){throw z(`Failed to parse metadata JSON: ${q instanceof Error?q.message:String(q)}`,{metadataLen:a})}if(n+ut>r.byteLength)throw z("Insufficient data to read geometry header.",{expectedBytes:ut,availableBytes:r.byteLength-n,offset:n});let c=t.getUint32(n,!0);n+=4;let u=t.getFloat64(n,!0);n+=8;let m=t.getFloat64(n,!0);n+=8;let d=t.getFloat64(n,!0);n+=8;let f=t.getFloat64(n,!0);n+=8;let b=t.getFloat64(n,!0);n+=8;let T=t.getFloat64(n,!0);n+=8;let H=t.getUint32(n,!0);n+=4;let x=(c&we)!==0,y=(c&ur)!==0,C=H*3,p=C*(x?4:2);if(n+p>r.byteLength)throw z("Insufficient data to read vertices.",{expectedBytes:p,availableBytes:r.byteLength-n,offset:n,useFloat32:x,vertexCount:H});let g=r.byteOffset+n,R;if(x?R=mt(r.buffer,g,C):y?R=vr(xe(r.buffer,g,C)):R=Tr(r.buffer,g,C),n+=p,n+4>r.byteLength)throw z("Insufficient data to read index count.",{expectedBytes:4,availableBytes:r.byteLength-n,offset:n});let w=t.getUint32(n,!0);n+=4;let S=(c&cr)!==0,Y=w*(S?2:4);if(n+Y>r.byteLength)throw z("Insufficient data to read indices.",{expectedBytes:Y,availableBytes:r.byteLength-n,offset:n,indexCount:w,useUint16Indices:S});let V=S?xe(r.buffer,r.byteOffset+n,w):Rr(r.buffer,r.byteOffset+n,w);y&&(V=V instanceof Uint16Array?xr(V):wr(V)),Hr(V,H),n+=Y;let X=null;if((c&dr)!==0){let q=Er(r,t,n,H,y);X=q.uvs,n=q.offset}let ie=null;return(c&mr)!==0&&(ie=hr(r,n,H,y)),{metadata:l,flags:c,vertices:R,indices:V,origin:[u,m,d],scale:[f,b,T],uvs:X,colors:ie}}var dt=36;function Er(e,r,t,n,i){if(t+dt>e.byteLength)throw z("Insufficient data to read UV chunk header.",{expectedBytes:dt,availableBytes:e.byteLength-t,offset:t});let o=r.getUint32(t,!0);t+=4;let a=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,m=o===pr,d=u*(m?4:2);if(t+d>e.byteLength)throw z("Insufficient data to read UV chunk.",{expectedBytes:d,availableBytes:e.byteLength-t,offset:t,uvFormat:o,vertexCount:n});let f=e.byteOffset+t,b;if(m)b=mt(e.buffer,f,u).slice();else{let T=xe(e.buffer,f,u);b=new Float32Array(u);let H=0,x=0;for(let y=0;y<u;y+=2)i?(H=H+J(T[y])&65535,x=x+J(T[y+1])&65535):(H=T[y],x=T[y+1]),b[y]=a+H*l,b[y+1]=s+x*c}return{uvs:b,offset:t+d}}function hr(e,r,t,n){let i=t*3;if(r+i>e.byteLength)throw z("Insufficient data to read vertex-color chunk.",{expectedBytes:i,availableBytes:e.byteLength-r,offset:r,vertexCount:t});let o=e.subarray(r,r+i);if(!n)return o.slice();let a=new Uint8Array(i),s=0,l=0,c=0;for(let u=0;u<i;u+=3)s=s+J(o[u])&255,l=l+J(o[u+1])&255,c=c+J(o[u+2])&255,a[u]=s,a[u+1]=l,a[u+2]=c;return a}function gr(e){return typeof e=="string"?_chunkCUQQ3ZBVcjs.j.call(void 0, e):e instanceof Uint8Array?e:new Uint8Array(e)}function yr(e){if(e.byteLength<8)return e;let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(r.getUint32(0,!0)!==lr)return e;let t=r.getUint32(4,!0),n=e.subarray(8),i=Math.max(n.byteLength*1032+1024,1<<20);if(t>i)throw z("SLVZ header declares an implausible uncompressed length",{uncompressedLen:t,deflatedBytes:n.byteLength,maxPlausibleLen:i});let o;try{o=_fflate.inflateSync.call(void 0, n,{out:new Uint8Array(t+1)})}catch(a){throw z(`Failed to inflate SLVZ blob: ${a instanceof Error?a.message:String(a)}`,{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 br(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, _chunkCUQQ3ZBVcjs.d)("No UTF-8 decoder available in this environment.",_chunkCUQQ3ZBVcjs.c.INVALID_STATE)}function Tr(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 mt(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 xe(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 Rr(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 Hr(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 J(e){return e>>>1^-(e&1)}function vr(e){let r=new Int16Array(e.length),t=0,n=0,i=0;for(let o=0;o<e.length;o+=3)t=t+J(e[o])<<16>>16,n=n+J(e[o+1])<<16>>16,i=i+J(e[o+2])<<16>>16,r[o]=t,r[o+1]=n,r[o+2]=i;return r}function xr(e){let r=new Uint16Array(e.length),t=0;for(let n=0;n<e.length;n++)t=t+J(e[n])&65535,r[n]=t;return r}function wr(e){let r=new Uint32Array(e.length),t=0;for(let n=0;n<e.length;n++)t=t+J(e[n])>>>0,r[n]=t;return r}function z(e,r){return new (0, _chunkCUQQ3ZBVcjs.d)(e,_chunkCUQQ3ZBVcjs.c.VALIDATION_ERROR,{context:r})}async function ii(e,r){let{debug:t=!1}=_nullishCoalesce(r, () => ({})),n=t?performance.now():0,i,o=performance.now();try{i=JSON.parse(e)}catch(s){return _chunkCUQQ3ZBVcjs.e.call(void 0, ).error("Error parsing mesh batch envelope JSON:",s),[]}let a=performance.now()-o;return await Me(i,r,{parseTime:a,perfStart:n})}async function Me(e,r,t){let{mergeByMaterial:n=!0,applyTransforms:i=!0,debug:o=!1,material:a}=_nullishCoalesce(r, () => ({})),{parseTime:s=0,perfStart:l=o?performance.now():0}=_nullishCoalesce(t, () => ({}));if(!e.compressedData)return[];let c=performance.now(),u=Ce(e.compressedData),m=performance.now()-c,d=o?Dr(e.compressedData):0;return pt(u,{mergeByMaterial:n,applyTransforms:i,debug:o,material:a,parseTime:s,decodeTime:m,perfStart:l,blobBytes:d,fallback:{materials:e.materials,groups:e.groups,sourceComponentId:e.sourceComponentId}})}async function ai(e,r){let{mergeByMaterial:t=!0,applyTransforms:n=!0,debug:i=!1,material:o}=_nullishCoalesce(r, () => ({})),a=i?performance.now():0,s=performance.now(),l=Ce(e),c=performance.now()-s,u=e.byteLength;return pt(l,{mergeByMaterial:t,applyTransforms:n,debug:i,material:o,parseTime:0,decodeTime:c,perfStart:a,blobBytes:u})}function pt(e,r){let{mergeByMaterial:t,applyTransforms:n,debug:i,material:o,parseTime:a,decodeTime:s,perfStart:l,blobBytes:c,fallback:u}=r,m=_nullishCoalesce(_nullishCoalesce(e.metadata.materials, () => (_optionalChain([u, 'optionalAccess', _248 => _248.materials]))), () => ([])),d=_nullishCoalesce(_nullishCoalesce(e.metadata.groups, () => (_optionalChain([u, 'optionalAccess', _249 => _249.groups]))), () => ([])),f=_nullishCoalesce(_optionalChain([u, 'optionalAccess', _250 => _250.sourceComponentId]), () => (e.metadata.sourceComponentId)),b=(e.flags&we)!==0;Cr(d,m.length,e.vertices.length/3,e.indices.length);let T=b?Ar(e.vertices,n):Mr(e.vertices,e.origin,e.scale,n);if(i){let M=e.vertices.byteLength+e.indices.byteLength;_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug("Mesh Batch Stats:"),_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Materials: ${m.length} | Groups: ${d.length}`),_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Vertices: ${e.vertices.length/3} | Indices: ${e.indices.length}`),_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Format: ${b?"float32":"int16 quantized"}`),_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Blob: ${(c/1024/1024).toFixed(2)} MB | Geometry on wire: ${(M/1024/1024).toFixed(2)} MB`)}let H=performance.now(),x=m.map(M=>Sr(M,{vertexColors:e.colors!=null,appearance:o})),y=[];for(let M of d)if(t&&M.meshes.length>1){let p=Ir(M,T,e.indices,x,e.uvs,e.colors);p.userData.sourceComponentId=_nullishCoalesce(f, () => (null)),y.push(p)}else{let p=Or(M,T,e.indices,x,e.uvs,e.colors);for(let g of p)g.userData.sourceComponentId=_nullishCoalesce(f, () => (null));y.push(...p)}let C=performance.now()-H;if(i){let M=performance.now()-l;_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug("Performance:"),a>0&&_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Parse JSON: ${a.toFixed(2)}ms`),_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Decode binary: ${s.toFixed(2)}ms`),_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Create Meshes: ${C.toFixed(2)}ms`),_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(` Total: ${M.toFixed(2)}ms`)}return Promise.resolve(y)}function ce(e,r){return new (0, _chunkCUQQ3ZBVcjs.d)(e,_chunkCUQQ3ZBVcjs.c.VALIDATION_ERROR,{context:r})}function Cr(e,r,t,n){for(let i of e){if(!Number.isInteger(i.materialId)||i.materialId<0||i.materialId>=r)throw ce("Group materialId out of range of the materials array.",{materialId:i.materialId,materialCount:r});for(let o of i.meshes){let a={vertexStart:o.vertexStart,vertexCount:o.vertexCount,indexStart:o.indexStart,indexCount:o.indexCount};for(let[s,l]of Object.entries(a))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 ft(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 Mr(e,r,t,n){let i=new Float32Array(e.length),o=r[0],a=r[1],s=r[2],l=t[0],c=t[1],u=t[2];for(let m=0;m<e.length;m+=3)i[m]=o+(e[m]+32767)*l,i[m+1]=a+(e[m+1]+32767)*c,i[m+2]=s+(e[m+2]+32767)*u;return i}function Ar(e,r){return e}function Sr(e,r){let t=Ue(e.color),n=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _251 => _251.vertexColors]), () => (!1)),i=_optionalChain([r, 'optionalAccess', _252 => _252.appearance]),o=new P.MeshPhysicalMaterial({color:t,metalness:e.metalness,roughness:e.roughness,opacity:e.opacity,transparent:e.transparent,vertexColors:n,side:_optionalChain([i, 'optionalAccess', _253 => _253.cullBackfaces])?P.FrontSide:P.DoubleSide,polygonOffset:!0,polygonOffsetFactor:.5,polygonOffsetUnits:.5,depthWrite:!0,depthTest:!0});return _optionalChain([i, 'optionalAccess', _254 => _254.envMapIntensity])!=null&&(o.envMapIntensity=i.envMapIntensity),n&&Lr(o),e.map&&tt(o,e.map),o}function Lr(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 Ir(e,r,t,n,i=null,o=null){let a=0,s=0;for(let y of e.meshes)a+=y.vertexCount,s+=y.indexCount;let l=new Float32Array(a*3),c=new Uint32Array(s),u=i?new Float32Array(a*2):null,m=o?new Uint8Array(a*3):null,d=0,f=0;for(let y of e.meshes){let C=y.vertexStart*3,M=y.vertexCount*3;if(l.set(r.subarray(C,C+M),d*3),u&&i){let R=y.vertexStart*2;u.set(i.subarray(R,R+y.vertexCount*2),d*2)}m&&o&&m.set(o.subarray(C,C+M),d*3);let p=t.subarray(y.indexStart,y.indexStart+y.indexCount),g=d-y.vertexStart;for(let R=0;R<p.length;R++){let w=p[R];ft(w,y),c[f+R]=w+g}d+=y.vertexCount,f+=y.indexCount}let b=new P.BufferGeometry;b.setAttribute("position",new P.BufferAttribute(l,3)),b.setIndex(new P.BufferAttribute(c,1)),u&&b.setAttribute("uv",new P.BufferAttribute(u,2)),m&&b.setAttribute("color",new P.BufferAttribute(m,3,!0)),b.computeVertexNormals();let T=new P.Mesh(b,n[e.materialId]),H=e.meshes[0],x=e.meshes.map(y=>y.name).filter(y=>y&&y.length>0);return T.name=x.length>0?x[0]:`merged_material_${e.materialId}`,T.castShadow=!0,T.receiveShadow=!0,T.userData={source:"compute",name:T.name,layer:_nullishCoalesce(_optionalChain([H, 'optionalAccess', _255 => _255.layer]), () => ("")),originalIndex:_nullishCoalesce(_optionalChain([H, 'optionalAccess', _256 => _256.originalIndex]), () => (0)),metadata:_nullishCoalesce(_optionalChain([H, 'optionalAccess', _257 => _257.metadata]), () => ({})),mergedFrom:e.meshes.slice(1).map(y=>({name:y.name,layer:y.layer,originalIndex:y.originalIndex}))},T}function Or(e,r,t,n,i=null,o=null){let a=[];for(let s of e.meshes){let l=s.vertexStart*3,c=s.vertexCount*3,u=r.slice(l,l+c),m=t.subarray(s.indexStart,s.indexStart+s.indexCount),d=new Uint32Array(m.length),f=s.vertexStart;for(let H=0;H<m.length;H++){let x=m[H];ft(x,s),d[H]=x-f}let b=new P.BufferGeometry;if(b.setAttribute("position",new P.BufferAttribute(u,3)),b.setIndex(new P.BufferAttribute(d,1)),i){let H=s.vertexStart*2,x=i.slice(H,H+s.vertexCount*2);b.setAttribute("uv",new P.BufferAttribute(x,2))}if(o){let H=o.slice(l,l+c);b.setAttribute("color",new P.BufferAttribute(H,3,!0))}b.computeVertexNormals();let T=new P.Mesh(b,n[e.materialId]);T.name=s.name,T.userData={source:"compute",name:s.name,layer:_nullishCoalesce(s.layer, () => ("")),originalIndex:s.originalIndex,metadata:_nullishCoalesce(s.metadata, () => ({}))},T.castShadow=!0,T.receiveShadow=!0,a.push(T)}return a}function Dr(e){return Math.floor(e.length*3/4)}var Et={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},Pr="Display",Fr="DisplayBatch";function Vr(e){let r=e.split(".");return r.includes(Pr)||r.includes(Fr)}var ht=new Set;async function mi(e,r){let t=performance.now(),n=[],{allowScaling:i=!0,allowAutoPosition:o=!0,rhino:a,debug:s=!1,parsing:l={}}=_nullishCoalesce(r, () => ({}));try{let c=i?Br(e.modelunits):1;return await kr(e,n,c,l,a,s),o&&jr(n),n}catch(c){throw Nr(c,n),c}finally{s&&Wr(t)}}function Br(e){let r=Et[e];return r!==void 0?r:(ht.has(e)||(ht.add(e),_chunkCUQQ3ZBVcjs.e.call(void 0, ).warn(`Unknown Rhino model unit "${e}" \u2014 geometry will not be scaled (factor 1). Known units: ${Object.keys(Et).join(", ")}.`)),1)}async function kr(e,r,t,n,i,o){for(let a of e.values){let s=a.InnerTree;for(let l in s){let c=s[l];c&&await Ur(c,r,t,n,i,o)}}}async function Ur(e,r,t,n,i,o){for(let a of e){if(!Vr(a.type))continue;let s={mergeByMaterial:!0,applyTransforms:!0,debug:!1,...n},l=zr(a.data);if(!l){_chunkCUQQ3ZBVcjs.e.call(void 0, ).error("Error parsing display batch envelope: invalid JSON");continue}let c=await Me(l,s),u=ot(l.items,{rhino:i,applyTransforms:s.applyTransforms}),m=[...c,...u];if(t!==1)for(let d of m)d.scale.set(t,t,t);r.push(...m),o&&_chunkCUQQ3ZBVcjs.e.call(void 0, ).debug(`Extracted ${c.length} meshes and ${u.length} items from batch`)}}function zr(e){return typeof e=="string"?_r(e):e}function _r(e){try{return JSON.parse(e)}catch (e3){return}}function jr(e){if(e.length===0)return;let r=be(e);ze(e,r.min.z,"z")}function Nr(e,r){_chunkCUQQ3ZBVcjs.e.call(void 0, ).error("An unexpected error occurred:",e),Gr(r)}function Gr(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 Wr(e){let r=performance.now()-e;_chunkCUQQ3ZBVcjs.e.call(void 0, ).info("Time to process meshes:",`${r.toFixed(2)}ms`)}exports.a = At; exports.b = qr; exports.c = Ue; exports.d = ze; exports.e = be; exports.f = _e; exports.g = je; exports.h = Ne; exports.i = de; exports.j = Ye; exports.k = tn; exports.l = io; exports.m = Xe; exports.n = Ze; exports.o = yn; exports.p = Qe; exports.q = bn; exports.r = et; exports.s = Ro; exports.t = In; exports.u = ko; exports.v = zo; exports.w = ot; exports.x = at; exports.y = lr; exports.z = st; exports.A = lt; exports.B = we; exports.C = cr; exports.D = ur; exports.E = dr; exports.F = mr; exports.G = Jo; exports.H = pr; exports.I = Ce; exports.J = ii; exports.K = Me; exports.L = ai; exports.M = Et; exports.N = mi;
62
- //# sourceMappingURL=chunk-7XMD5YXP.cjs.map