@tscircuit/3d-viewer 0.0.581 → 0.0.583

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 (2) hide show
  1. package/dist/index.js +647 -514
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -14432,12 +14432,12 @@ var require_browser = __commonJS({
14432
14432
  });
14433
14433
 
14434
14434
  // src/CadViewer.tsx
14435
- import { useCallback as useCallback24, useEffect as useEffect47, useRef as useRef29, useState as useState39 } from "react";
14436
- import * as THREE45 from "three";
14435
+ import { useCallback as useCallback24, useEffect as useEffect48, useRef as useRef29, useState as useState39 } from "react";
14436
+ import * as THREE46 from "three";
14437
14437
 
14438
14438
  // src/CadViewerJscad.tsx
14439
14439
  import { su as su11 } from "@tscircuit/circuit-json-util";
14440
- import { forwardRef as forwardRef3, useMemo as useMemo20 } from "react";
14440
+ import { forwardRef as forwardRef3, useMemo as useMemo21 } from "react";
14441
14441
 
14442
14442
  // src/AnyCadComponent.tsx
14443
14443
  import { su as su2 } from "@tscircuit/circuit-json-util";
@@ -32704,13 +32704,13 @@ var AnyCadComponent = ({
32704
32704
  };
32705
32705
 
32706
32706
  // src/CadViewerContainer.tsx
32707
- import { forwardRef as forwardRef2, useEffect as useEffect18, useMemo as useMemo14, useState as useState11 } from "react";
32708
- import * as THREE20 from "three";
32707
+ import { forwardRef as forwardRef2, useEffect as useEffect19, useMemo as useMemo15, useState as useState11 } from "react";
32708
+ import * as THREE21 from "three";
32709
32709
 
32710
32710
  // package.json
32711
32711
  var package_default = {
32712
32712
  name: "@tscircuit/3d-viewer",
32713
- version: "0.0.580",
32713
+ version: "0.0.582",
32714
32714
  main: "./dist/index.js",
32715
32715
  module: "./dist/index.js",
32716
32716
  type: "module",
@@ -32740,7 +32740,7 @@ var package_default = {
32740
32740
  "@jscad/regl-renderer": "^2.6.12",
32741
32741
  "@jscad/stl-serializer": "^2.1.20",
32742
32742
  "circuit-json": "^0.0.446",
32743
- "circuit-to-canvas": "^0.0.111",
32743
+ "circuit-to-canvas": "^0.0.118",
32744
32744
  "react-hot-toast": "^2.6.0",
32745
32745
  three: "^0.165.0",
32746
32746
  "three-stdlib": "^2.36.0",
@@ -32801,6 +32801,7 @@ var AppearanceProvider = ({
32801
32801
  children
32802
32802
  }) => {
32803
32803
  const [darkBackgroundEnabled, setDarkBackgroundEnabled] = useState8(false);
32804
+ const [gridEnabled, setGridEnabled] = useState8(false);
32804
32805
  const [lightingEnabled, setLightingEnabled] = useState8(
32805
32806
  readStoredLightingEnabled
32806
32807
  );
@@ -32814,10 +32815,12 @@ var AppearanceProvider = ({
32814
32815
  () => ({
32815
32816
  darkBackgroundEnabled,
32816
32817
  setDarkBackgroundEnabled,
32818
+ gridEnabled,
32819
+ setGridEnabled,
32817
32820
  lightingEnabled,
32818
32821
  setLightingEnabled
32819
32822
  }),
32820
- [darkBackgroundEnabled, lightingEnabled]
32823
+ [darkBackgroundEnabled, gridEnabled, lightingEnabled]
32821
32824
  );
32822
32825
  return /* @__PURE__ */ jsx11(AppearanceContext.Provider, { value, children });
32823
32826
  };
@@ -33385,9 +33388,101 @@ var Canvas = forwardRef(
33385
33388
  }
33386
33389
  );
33387
33390
 
33388
- // src/react-three/Lights.tsx
33391
+ // src/react-three/Grid.tsx
33389
33392
  import { useEffect as useEffect15, useMemo as useMemo12 } from "react";
33390
33393
  import * as THREE17 from "three";
33394
+ var vertexShader = `
33395
+ varying vec3 worldPosition;
33396
+ void main() {
33397
+ worldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
33398
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
33399
+ }
33400
+ `;
33401
+ var fragmentShader = `
33402
+ varying vec3 worldPosition;
33403
+ uniform float cellSize;
33404
+ uniform float sectionSize;
33405
+ uniform vec3 gridColor;
33406
+ uniform vec3 sectionColor;
33407
+ uniform float fadeDistance;
33408
+ uniform float fadeStrength;
33409
+
33410
+ float getGrid(float size) {
33411
+ vec2 r = worldPosition.xy / size;
33412
+ vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);
33413
+ float line = min(grid.x, grid.y);
33414
+ return 1.0 - min(line * 1.5, 1.0);
33415
+ }
33416
+
33417
+ void main() {
33418
+ float g1 = getGrid(cellSize);
33419
+ float g2 = getGrid(sectionSize);
33420
+
33421
+ float d = distance(worldPosition.xy, cameraPosition.xy);
33422
+ float a = 1.0 - smoothstep(fadeDistance, fadeDistance * fadeStrength, d);
33423
+
33424
+ vec3 color = mix(gridColor, sectionColor, g2);
33425
+
33426
+ gl_FragColor = vec4(color, max(g1, g2) * a);
33427
+ if (gl_FragColor.a <= 0.0) discard;
33428
+ }
33429
+ `;
33430
+ var Grid = ({
33431
+ rotation,
33432
+ infiniteGrid,
33433
+ cellSize = 1,
33434
+ sectionSize = 10
33435
+ }) => {
33436
+ const { scene, camera } = useThree();
33437
+ const size4 = 1e3;
33438
+ const gridMesh = useMemo12(() => {
33439
+ const geometry = new THREE17.PlaneGeometry(size4, size4);
33440
+ geometry.rotateX(-Math.PI / 2);
33441
+ const material = new THREE17.ShaderMaterial({
33442
+ vertexShader,
33443
+ fragmentShader,
33444
+ uniforms: {
33445
+ cellSize: { value: cellSize },
33446
+ sectionSize: { value: sectionSize },
33447
+ gridColor: { value: new THREE17.Color(15658734) },
33448
+ sectionColor: { value: new THREE17.Color(13421823) },
33449
+ fadeDistance: { value: 100 },
33450
+ // Fade out based on sectionSize
33451
+ fadeStrength: { value: 1.5 }
33452
+ },
33453
+ transparent: true,
33454
+ side: THREE17.DoubleSide
33455
+ });
33456
+ const mesh = new THREE17.Mesh(geometry, material);
33457
+ if (rotation) {
33458
+ mesh.rotation.fromArray(rotation);
33459
+ }
33460
+ return mesh;
33461
+ }, [size4, cellSize, sectionSize, rotation]);
33462
+ useFrame(() => {
33463
+ if (infiniteGrid) {
33464
+ gridMesh.position.set(camera.position.x, camera.position.y, 0);
33465
+ }
33466
+ });
33467
+ useEffect15(() => {
33468
+ if (!scene || !gridMesh) return;
33469
+ scene.add(gridMesh);
33470
+ return () => {
33471
+ scene.remove(gridMesh);
33472
+ gridMesh.geometry.dispose();
33473
+ if (Array.isArray(gridMesh.material)) {
33474
+ gridMesh.material.forEach((m) => m.dispose());
33475
+ } else {
33476
+ gridMesh.material.dispose();
33477
+ }
33478
+ };
33479
+ }, [scene, gridMesh]);
33480
+ return null;
33481
+ };
33482
+
33483
+ // src/react-three/Lights.tsx
33484
+ import { useEffect as useEffect16, useMemo as useMemo13 } from "react";
33485
+ import * as THREE18 from "three";
33391
33486
  var UNDERSIDE_LIGHT_FACTOR = 0.75;
33392
33487
  var Lights = ({
33393
33488
  boardDimensions,
@@ -33396,8 +33491,8 @@ var Lights = ({
33396
33491
  shadowsEnabled = false
33397
33492
  }) => {
33398
33493
  const { scene } = useThree();
33399
- const lightRig = useMemo12(() => {
33400
- const rig = new THREE17.Group();
33494
+ const lightRig = useMemo13(() => {
33495
+ const rig = new THREE18.Group();
33401
33496
  rig.name = "cad-viewer-light-rig";
33402
33497
  const centerX = boardCenter?.x ?? 0;
33403
33498
  const centerY = boardCenter?.y ?? 0;
@@ -33409,14 +33504,14 @@ var Lights = ({
33409
33504
  const shadowHalfSize = largestBoardDimension * 0.8;
33410
33505
  const lightDistance = largestBoardDimension;
33411
33506
  const keyLightDistance = largestBoardDimension * 1.7;
33412
- const ambientLight = new THREE17.AmbientLight(16186360, 0.22);
33507
+ const ambientLight = new THREE18.AmbientLight(16186360, 0.22);
33413
33508
  ambientLight.name = "cad-viewer-soft-ambient";
33414
33509
  rig.add(ambientLight);
33415
- const hemisphereLight = new THREE17.HemisphereLight(15004141, 1581597, 0.2);
33510
+ const hemisphereLight = new THREE18.HemisphereLight(15004141, 1581597, 0.2);
33416
33511
  hemisphereLight.name = "cad-viewer-hemisphere";
33417
33512
  rig.add(hemisphereLight);
33418
33513
  const addDirectionalLight = (name, color, intensity, position, castShadow = false) => {
33419
- const light = new THREE17.DirectionalLight(color, intensity);
33514
+ const light = new THREE18.DirectionalLight(color, intensity);
33420
33515
  light.name = name;
33421
33516
  light.position.set(
33422
33517
  centerX + position[0],
@@ -33490,17 +33585,17 @@ var Lights = ({
33490
33585
  );
33491
33586
  return rig;
33492
33587
  }, [boardCenter, boardDimensions, shadowsEnabled]);
33493
- useEffect15(() => {
33588
+ useEffect16(() => {
33494
33589
  const previousBackground = scene.background;
33495
33590
  const previousEnvironment = scene.environment;
33496
- scene.background = darkBackgroundEnabled ? new THREE17.Color(1053456) : null;
33591
+ scene.background = darkBackgroundEnabled ? new THREE18.Color(1053456) : null;
33497
33592
  scene.environment = null;
33498
33593
  return () => {
33499
33594
  scene.background = previousBackground;
33500
33595
  scene.environment = previousEnvironment;
33501
33596
  };
33502
33597
  }, [darkBackgroundEnabled, scene]);
33503
- useEffect15(() => {
33598
+ useEffect16(() => {
33504
33599
  if (!scene) return;
33505
33600
  scene.add(lightRig);
33506
33601
  return () => {
@@ -33511,8 +33606,8 @@ var Lights = ({
33511
33606
  };
33512
33607
 
33513
33608
  // src/react-three/OrbitControls.tsx
33514
- import { useEffect as useEffect16, useMemo as useMemo13 } from "react";
33515
- import * as THREE18 from "three";
33609
+ import { useEffect as useEffect17, useMemo as useMemo14 } from "react";
33610
+ import * as THREE19 from "three";
33516
33611
  import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls.js";
33517
33612
  var OrbitControls = ({
33518
33613
  autoRotate,
@@ -33527,15 +33622,15 @@ var OrbitControls = ({
33527
33622
  onControlsChange
33528
33623
  }) => {
33529
33624
  const { camera, renderer } = useThree();
33530
- const controls = useMemo13(() => {
33625
+ const controls = useMemo14(() => {
33531
33626
  if (!camera || !renderer) return null;
33532
33627
  return new ThreeOrbitControls(camera, renderer.domElement);
33533
33628
  }, [camera, renderer]);
33534
- useEffect16(() => {
33629
+ useEffect17(() => {
33535
33630
  onControlsChange?.(controls ?? null);
33536
33631
  return () => onControlsChange?.(null);
33537
33632
  }, [controls, onControlsChange]);
33538
- useEffect16(() => {
33633
+ useEffect17(() => {
33539
33634
  if (!controls) return;
33540
33635
  const handleChange = () => {
33541
33636
  onControlsChange?.(controls);
@@ -33545,7 +33640,7 @@ var OrbitControls = ({
33545
33640
  controls.removeEventListener("change", handleChange);
33546
33641
  };
33547
33642
  }, [controls, onControlsChange]);
33548
- useEffect16(() => {
33643
+ useEffect17(() => {
33549
33644
  if (!controls) return;
33550
33645
  controls.autoRotate = autoRotate || false;
33551
33646
  controls.autoRotateSpeed = autoRotateSpeed || 1;
@@ -33556,9 +33651,9 @@ var OrbitControls = ({
33556
33651
  if (dampingFactor !== void 0) controls.dampingFactor = dampingFactor;
33557
33652
  controls.zoomToCursor = true;
33558
33653
  controls.mouseButtons = {
33559
- LEFT: THREE18.MOUSE.ROTATE,
33654
+ LEFT: THREE19.MOUSE.ROTATE,
33560
33655
  // Left click to rotate
33561
- MIDDLE: THREE18.MOUSE.PAN,
33656
+ MIDDLE: THREE19.MOUSE.PAN,
33562
33657
  // Middle click to pan
33563
33658
  RIGHT: null
33564
33659
  // Right-click always disabled - only context menu
@@ -33578,14 +33673,14 @@ var OrbitControls = ({
33578
33673
  dampingFactor,
33579
33674
  target
33580
33675
  ]);
33581
- useEffect16(() => {
33676
+ useEffect17(() => {
33582
33677
  if (!controls || !onStart) return;
33583
33678
  controls.addEventListener("start", onStart);
33584
33679
  return () => {
33585
33680
  controls.removeEventListener("start", onStart);
33586
33681
  };
33587
33682
  }, [controls, onStart]);
33588
- useEffect16(() => {
33683
+ useEffect17(() => {
33589
33684
  if (!controls) return;
33590
33685
  return () => {
33591
33686
  controls.dispose();
@@ -33598,15 +33693,15 @@ var OrbitControls = ({
33598
33693
  };
33599
33694
 
33600
33695
  // src/three-components/OrientationCubeCanvas.tsx
33601
- import { useEffect as useEffect17, useRef as useRef7 } from "react";
33602
- import * as THREE19 from "three";
33696
+ import { useEffect as useEffect18, useRef as useRef7 } from "react";
33697
+ import * as THREE20 from "three";
33603
33698
  import { Text as TroikaText } from "troika-three-text";
33604
33699
  import { jsx as jsx14 } from "react/jsx-runtime";
33605
33700
  function computePointInFront(rotationVector, distance5) {
33606
- const quaternion = new THREE19.Quaternion().setFromEuler(
33607
- new THREE19.Euler(rotationVector.x, rotationVector.y, rotationVector.z)
33701
+ const quaternion = new THREE20.Quaternion().setFromEuler(
33702
+ new THREE20.Euler(rotationVector.x, rotationVector.y, rotationVector.z)
33608
33703
  );
33609
- const forwardVector = new THREE19.Vector3(0, 0, 1);
33704
+ const forwardVector = new THREE20.Vector3(0, 0, 1);
33610
33705
  forwardVector.applyQuaternion(quaternion);
33611
33706
  const result = forwardVector.multiplyScalar(distance5);
33612
33707
  return result;
@@ -33614,36 +33709,36 @@ function computePointInFront(rotationVector, distance5) {
33614
33709
  var OrientationCubeCanvas = () => {
33615
33710
  const { mainCameraRef } = useCameraController();
33616
33711
  const containerRef = useRef7(null);
33617
- useEffect17(() => {
33712
+ useEffect18(() => {
33618
33713
  if (!containerRef.current) return;
33619
33714
  const container = containerRef.current;
33620
33715
  const canvas = document.createElement("canvas");
33621
33716
  container.appendChild(canvas);
33622
- const renderer = new THREE19.WebGLRenderer({
33717
+ const renderer = new THREE20.WebGLRenderer({
33623
33718
  canvas,
33624
33719
  antialias: true,
33625
33720
  alpha: true
33626
33721
  });
33627
33722
  renderer.setSize(120, 120);
33628
33723
  renderer.setPixelRatio(window.devicePixelRatio);
33629
- const scene = new THREE19.Scene();
33630
- const camera = new THREE19.PerspectiveCamera(75, 1, 0.1, 1e3);
33724
+ const scene = new THREE20.Scene();
33725
+ const camera = new THREE20.PerspectiveCamera(75, 1, 0.1, 1e3);
33631
33726
  camera.up.set(0, 0, 1);
33632
- const ambientLight = new THREE19.AmbientLight(16777215, Math.PI / 2);
33727
+ const ambientLight = new THREE20.AmbientLight(16777215, Math.PI / 2);
33633
33728
  scene.add(ambientLight);
33634
- const group = new THREE19.Group();
33729
+ const group = new THREE20.Group();
33635
33730
  group.rotation.fromArray([Math.PI / 2, 0, 0]);
33636
33731
  const cubeSize = 1;
33637
- const box = new THREE19.Mesh(
33638
- new THREE19.BoxGeometry(cubeSize, cubeSize, cubeSize),
33639
- new THREE19.MeshStandardMaterial({ color: "white" })
33732
+ const box = new THREE20.Mesh(
33733
+ new THREE20.BoxGeometry(cubeSize, cubeSize, cubeSize),
33734
+ new THREE20.MeshStandardMaterial({ color: "white" })
33640
33735
  );
33641
33736
  group.add(box);
33642
- const edges = new THREE19.LineSegments(
33643
- new THREE19.EdgesGeometry(
33644
- new THREE19.BoxGeometry(cubeSize, cubeSize, cubeSize)
33737
+ const edges = new THREE20.LineSegments(
33738
+ new THREE20.EdgesGeometry(
33739
+ new THREE20.BoxGeometry(cubeSize, cubeSize, cubeSize)
33645
33740
  ),
33646
- new THREE19.LineBasicMaterial({ color: 0, linewidth: 2 })
33741
+ new THREE20.LineBasicMaterial({ color: 0, linewidth: 2 })
33647
33742
  );
33648
33743
  group.add(edges);
33649
33744
  scene.add(group);
@@ -33698,7 +33793,7 @@ var OrientationCubeCanvas = () => {
33698
33793
  const animate = () => {
33699
33794
  if (mainCameraRef.current) {
33700
33795
  const cameraPosition = computePointInFront(
33701
- mainCameraRef.current.rotation ?? new THREE19.Euler(0, 0, 0),
33796
+ mainCameraRef.current.rotation ?? new THREE20.Euler(0, 0, 0),
33702
33797
  2
33703
33798
  );
33704
33799
  if (!cameraPosition.equals(camera.position)) {
@@ -33773,17 +33868,23 @@ var CadViewerContainer = forwardRef2(
33773
33868
  !clickToInteractEnabled
33774
33869
  );
33775
33870
  const { mainCameraRef, handleControlsChange, controller } = useCameraController();
33776
- const { darkBackgroundEnabled, lightingEnabled } = useAppearance();
33871
+ const { darkBackgroundEnabled, gridEnabled, lightingEnabled } = useAppearance();
33777
33872
  const {
33778
33873
  handleCameraCreated,
33779
33874
  handleControlsChange: handleSessionControlsChange
33780
33875
  } = useCameraSession();
33781
- useEffect18(() => {
33876
+ useEffect19(() => {
33782
33877
  if (onCameraControllerReady) {
33783
33878
  onCameraControllerReady(controller);
33784
33879
  }
33785
33880
  }, [controller, onCameraControllerReady]);
33786
- const orbitTarget = useMemo14(() => {
33881
+ const gridSectionSize = useMemo15(() => {
33882
+ if (!boardDimensions) return 10;
33883
+ const width10 = boardDimensions.width ?? 0;
33884
+ const height10 = boardDimensions.height ?? 0;
33885
+ return Math.max(Math.max(width10, height10) * 1.5, 10);
33886
+ }, [boardDimensions]);
33887
+ const orbitTarget = useMemo15(() => {
33787
33888
  if (!boardCenter) return void 0;
33788
33889
  return [boardCenter.x, boardCenter.y, 0];
33789
33890
  }, [boardCenter]);
@@ -33793,7 +33894,7 @@ var CadViewerContainer = forwardRef2(
33793
33894
  Canvas,
33794
33895
  {
33795
33896
  ref,
33796
- scene: { up: new THREE20.Vector3(0, 0, 1) },
33897
+ scene: { up: new THREE21.Vector3(0, 0, 1) },
33797
33898
  camera: { up: [0, 0, 1], position: initialCameraPosition },
33798
33899
  onCreated: ({ camera }) => {
33799
33900
  mainCameraRef.current = camera;
@@ -33829,6 +33930,15 @@ var CadViewerContainer = forwardRef2(
33829
33930
  shadowsEnabled: lightingEnabled
33830
33931
  }
33831
33932
  ),
33933
+ gridEnabled && /* @__PURE__ */ jsx15(
33934
+ Grid,
33935
+ {
33936
+ rotation: [Math.PI / 2, 0, 0],
33937
+ infiniteGrid: true,
33938
+ cellSize: 3,
33939
+ sectionSize: gridSectionSize
33940
+ }
33941
+ ),
33832
33942
  children
33833
33943
  ]
33834
33944
  }
@@ -33893,9 +34003,9 @@ var CadViewerContainer = forwardRef2(
33893
34003
 
33894
34004
  // src/hooks/use-convert-children-to-soup.ts
33895
34005
  import { Circuit } from "@tscircuit/core";
33896
- import { useMemo as useMemo15 } from "react";
34006
+ import { useMemo as useMemo16 } from "react";
33897
34007
  var useConvertChildrenToCircuitJson = (children) => {
33898
- return useMemo15(() => {
34008
+ return useMemo16(() => {
33899
34009
  if (!children) return [];
33900
34010
  const circuit = new Circuit();
33901
34011
  circuit.add(children);
@@ -33905,12 +34015,12 @@ var useConvertChildrenToCircuitJson = (children) => {
33905
34015
  };
33906
34016
 
33907
34017
  // src/hooks/use-stls-from-geom.ts
33908
- import { useState as useState12, useEffect as useEffect19 } from "react";
34018
+ import { useState as useState12, useEffect as useEffect20 } from "react";
33909
34019
  import stlSerializer from "@jscad/stl-serializer";
33910
34020
  var useStlsFromGeom = (geom) => {
33911
34021
  const [stls, setStls] = useState12([]);
33912
34022
  const [loading, setLoading] = useState12(true);
33913
- useEffect19(() => {
34023
+ useEffect20(() => {
33914
34024
  if (!geom) return;
33915
34025
  const generateStls = async () => {
33916
34026
  setLoading(true);
@@ -33939,7 +34049,7 @@ var useStlsFromGeom = (geom) => {
33939
34049
  };
33940
34050
 
33941
34051
  // src/hooks/useBoardGeomBuilder.ts
33942
- import { useState as useState13, useEffect as useEffect20, useRef as useRef8 } from "react";
34052
+ import { useState as useState13, useEffect as useEffect21, useRef as useRef8 } from "react";
33943
34053
 
33944
34054
  // src/soup-to-3d/index.ts
33945
34055
  var import_primitives2 = __toESM(require_primitives(), 1);
@@ -35253,7 +35363,7 @@ var BoardGeomBuilder = class {
35253
35363
  var useBoardGeomBuilder = (circuitJson) => {
35254
35364
  const [boardGeom, setBoardGeom] = useState13(null);
35255
35365
  const isProcessingRef = useRef8(false);
35256
- useEffect20(() => {
35366
+ useEffect21(() => {
35257
35367
  let isCancelled = false;
35258
35368
  if (!circuitJson) {
35259
35369
  setBoardGeom(null);
@@ -35299,10 +35409,10 @@ var useBoardGeomBuilder = (circuitJson) => {
35299
35409
  };
35300
35410
 
35301
35411
  // src/three-components/Error3d.tsx
35302
- import { useState as useState14, useCallback as useCallback8, useEffect as useEffect22, useMemo as useMemo17 } from "react";
35412
+ import { useState as useState14, useCallback as useCallback8, useEffect as useEffect23, useMemo as useMemo18 } from "react";
35303
35413
 
35304
35414
  // src/react-three/Text.tsx
35305
- import { useEffect as useEffect21, useMemo as useMemo16 } from "react";
35415
+ import { useEffect as useEffect22, useMemo as useMemo17 } from "react";
35306
35416
  import { Text as TroikaText2 } from "troika-three-text";
35307
35417
  var Text = ({
35308
35418
  children,
@@ -35317,7 +35427,7 @@ var Text = ({
35317
35427
  depthOffset
35318
35428
  }) => {
35319
35429
  const { rootObject } = useThree();
35320
- const mesh = useMemo16(() => {
35430
+ const mesh = useMemo17(() => {
35321
35431
  const textMesh = new TroikaText2();
35322
35432
  textMesh.text = children;
35323
35433
  if (position) textMesh.position.fromArray(position);
@@ -35342,7 +35452,7 @@ var Text = ({
35342
35452
  anchorY,
35343
35453
  depthOffset
35344
35454
  ]);
35345
- useEffect21(() => {
35455
+ useEffect22(() => {
35346
35456
  const parentObject = parent || rootObject;
35347
35457
  if (!parentObject || !mesh) return;
35348
35458
  parentObject.add(mesh);
@@ -35355,7 +35465,7 @@ var Text = ({
35355
35465
  };
35356
35466
 
35357
35467
  // src/three-components/Error3d.tsx
35358
- import * as THREE21 from "three";
35468
+ import * as THREE22 from "three";
35359
35469
  import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
35360
35470
  var Error3d = ({
35361
35471
  error,
@@ -35377,7 +35487,7 @@ var Error3d = ({
35377
35487
  setIsHovered(false);
35378
35488
  setHoverPosition(null);
35379
35489
  }, []);
35380
- const position = useMemo17(() => {
35490
+ const position = useMemo18(() => {
35381
35491
  if (cad_component?.position) {
35382
35492
  const p = [
35383
35493
  cad_component.position.x,
@@ -35388,12 +35498,12 @@ var Error3d = ({
35388
35498
  }
35389
35499
  return [0, 0, 0];
35390
35500
  }, [cad_component]);
35391
- const group = useMemo17(() => {
35392
- const g = new THREE21.Group();
35501
+ const group = useMemo18(() => {
35502
+ const g = new THREE22.Group();
35393
35503
  g.position.fromArray(position);
35394
35504
  return g;
35395
35505
  }, [position]);
35396
- useEffect22(() => {
35506
+ useEffect23(() => {
35397
35507
  if (!rootObject) return;
35398
35508
  rootObject.add(group);
35399
35509
  return () => {
@@ -35448,10 +35558,10 @@ var Error3d = ({
35448
35558
  ] });
35449
35559
  };
35450
35560
  var ErrorBox = ({ parent }) => {
35451
- const mesh = useMemo17(() => {
35452
- const m = new THREE21.Mesh(
35453
- new THREE21.BoxGeometry(0.5, 0.5, 0.5),
35454
- new THREE21.MeshStandardMaterial({
35561
+ const mesh = useMemo18(() => {
35562
+ const m = new THREE22.Mesh(
35563
+ new THREE22.BoxGeometry(0.5, 0.5, 0.5),
35564
+ new THREE22.MeshStandardMaterial({
35455
35565
  depthTest: false,
35456
35566
  transparent: true,
35457
35567
  color: "red",
@@ -35462,7 +35572,7 @@ var ErrorBox = ({ parent }) => {
35462
35572
  m.rotation.fromArray([Math.PI / 4, Math.PI / 4, 0]);
35463
35573
  return m;
35464
35574
  }, []);
35465
- useEffect22(() => {
35575
+ useEffect23(() => {
35466
35576
  parent.add(mesh);
35467
35577
  return () => {
35468
35578
  parent.remove(mesh);
@@ -35472,8 +35582,8 @@ var ErrorBox = ({ parent }) => {
35472
35582
  };
35473
35583
 
35474
35584
  // src/three-components/STLModel.tsx
35475
- import { useState as useState15, useEffect as useEffect23, useMemo as useMemo18 } from "react";
35476
- import * as THREE22 from "three";
35585
+ import { useState as useState15, useEffect as useEffect24, useMemo as useMemo19 } from "react";
35586
+ import * as THREE23 from "three";
35477
35587
  import { STLLoader } from "three-stdlib";
35478
35588
  function STLModel({
35479
35589
  stlUrl,
@@ -35485,7 +35595,7 @@ function STLModel({
35485
35595
  }) {
35486
35596
  const { rootObject } = useThree();
35487
35597
  const [geom, setGeom] = useState15(null);
35488
- useEffect23(() => {
35598
+ useEffect24(() => {
35489
35599
  const loader = new STLLoader();
35490
35600
  if (stlData) {
35491
35601
  try {
@@ -35503,18 +35613,18 @@ function STLModel({
35503
35613
  });
35504
35614
  }
35505
35615
  }, [stlUrl, stlData]);
35506
- const mesh = useMemo18(() => {
35616
+ const mesh = useMemo19(() => {
35507
35617
  if (!geom) return null;
35508
35618
  const isBoardLayer = layerType === "board";
35509
- const material = new THREE22.MeshStandardMaterial({
35510
- color: Array.isArray(color) ? new THREE22.Color(color[0], color[1], color[2]) : color,
35619
+ const material = new THREE23.MeshStandardMaterial({
35620
+ color: Array.isArray(color) ? new THREE23.Color(color[0], color[1], color[2]) : color,
35511
35621
  transparent: opacity !== 1,
35512
35622
  opacity,
35513
35623
  polygonOffset: isBoardLayer,
35514
35624
  polygonOffsetFactor: isBoardLayer ? 6 : 0,
35515
35625
  polygonOffsetUnits: isBoardLayer ? 6 : 0
35516
35626
  });
35517
- const createdMesh = new THREE22.Mesh(geom, material);
35627
+ const createdMesh = new THREE23.Mesh(geom, material);
35518
35628
  createdMesh.renderOrder = isBoardLayer ? -1 : 1;
35519
35629
  configureObjectShadows(createdMesh, {
35520
35630
  castShadow: !isBoardLayer && opacity === 1,
@@ -35522,7 +35632,7 @@ function STLModel({
35522
35632
  });
35523
35633
  return createdMesh;
35524
35634
  }, [geom, color, opacity, layerType]);
35525
- useEffect23(() => {
35635
+ useEffect24(() => {
35526
35636
  if (!rootObject || !mesh) return;
35527
35637
  rootObject.add(mesh);
35528
35638
  return () => {
@@ -35575,10 +35685,10 @@ function VisibleSTLModel({
35575
35685
 
35576
35686
  // src/three-components/JscadBoardTextures.tsx
35577
35687
  import { su as su8 } from "@tscircuit/circuit-json-util";
35578
- import { useEffect as useEffect24, useMemo as useMemo19 } from "react";
35688
+ import { useEffect as useEffect25, useMemo as useMemo20 } from "react";
35579
35689
 
35580
35690
  // src/textures/create-combined-board-textures.ts
35581
- import * as THREE34 from "three";
35691
+ import * as THREE35 from "three";
35582
35692
 
35583
35693
  // node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
35584
35694
  var getBoundsFromPoints = (points) => {
@@ -35633,7 +35743,7 @@ function calculateOutlineBounds(boardData) {
35633
35743
  // src/utils/pad-texture.ts
35634
35744
  import { su as su5 } from "@tscircuit/circuit-json-util";
35635
35745
  import { CircuitToCanvasDrawer } from "circuit-to-canvas";
35636
- import * as THREE23 from "three";
35746
+ import * as THREE24 from "three";
35637
35747
  function createPadTextureForLayer({
35638
35748
  layer,
35639
35749
  circuitJson,
@@ -35711,10 +35821,10 @@ function createPadTextureForLayer({
35711
35821
  drawSoldermaskTop: false,
35712
35822
  drawSoldermaskBottom: false
35713
35823
  });
35714
- const texture = new THREE23.CanvasTexture(canvas);
35824
+ const texture = new THREE24.CanvasTexture(canvas);
35715
35825
  texture.generateMipmaps = true;
35716
- texture.minFilter = THREE23.LinearMipmapLinearFilter;
35717
- texture.magFilter = THREE23.LinearFilter;
35826
+ texture.minFilter = THREE24.LinearMipmapLinearFilter;
35827
+ texture.magFilter = THREE24.LinearFilter;
35718
35828
  texture.anisotropy = 16;
35719
35829
  texture.needsUpdate = true;
35720
35830
  return texture;
@@ -35722,7 +35832,7 @@ function createPadTextureForLayer({
35722
35832
 
35723
35833
  // src/utils/panel-outline-texture.ts
35724
35834
  import { su as su6 } from "@tscircuit/circuit-json-util";
35725
- import * as THREE24 from "three";
35835
+ import * as THREE25 from "three";
35726
35836
  var resolvePanelIdForTexture = (circuitJson) => {
35727
35837
  const panels = circuitJson.filter(
35728
35838
  (e) => e.type === "pcb_panel"
@@ -35790,17 +35900,17 @@ function createPanelOutlineTextureForLayer({
35790
35900
  );
35791
35901
  }
35792
35902
  });
35793
- const texture = new THREE24.CanvasTexture(canvas);
35903
+ const texture = new THREE25.CanvasTexture(canvas);
35794
35904
  texture.generateMipmaps = true;
35795
- texture.minFilter = THREE24.LinearMipmapLinearFilter;
35796
- texture.magFilter = THREE24.LinearFilter;
35905
+ texture.minFilter = THREE25.LinearMipmapLinearFilter;
35906
+ texture.magFilter = THREE25.LinearFilter;
35797
35907
  texture.anisotropy = 16;
35798
35908
  texture.needsUpdate = true;
35799
35909
  return texture;
35800
35910
  }
35801
35911
 
35802
35912
  // src/utils/trace-texture.ts
35803
- import * as THREE25 from "three";
35913
+ import * as THREE26 from "three";
35804
35914
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer2 } from "circuit-to-canvas";
35805
35915
  import { getElementRenderLayers, su as su7 } from "@tscircuit/circuit-json-util";
35806
35916
 
@@ -35913,14 +36023,15 @@ function createTraceTextureForLayer({
35913
36023
  });
35914
36024
  drawer.drawElements(elementsToDraw, {
35915
36025
  layers: [pcbRenderLayer],
36026
+ clipContextElements: circuitJson,
35916
36027
  drawSoldermask: false,
35917
36028
  drawSoldermaskTop: false,
35918
36029
  drawSoldermaskBottom: false
35919
36030
  });
35920
- const texture = new THREE25.CanvasTexture(canvas);
36031
+ const texture = new THREE26.CanvasTexture(canvas);
35921
36032
  texture.generateMipmaps = true;
35922
- texture.minFilter = THREE25.LinearMipmapLinearFilter;
35923
- texture.magFilter = THREE25.LinearFilter;
36033
+ texture.minFilter = THREE26.LinearMipmapLinearFilter;
36034
+ texture.magFilter = THREE26.LinearFilter;
35924
36035
  texture.anisotropy = 16;
35925
36036
  texture.needsUpdate = true;
35926
36037
  return texture;
@@ -35928,7 +36039,7 @@ function createTraceTextureForLayer({
35928
36039
 
35929
36040
  // src/textures/create-copper-pour-texture-for-layer.ts
35930
36041
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer3 } from "circuit-to-canvas";
35931
- import * as THREE26 from "three";
36042
+ import * as THREE27 from "three";
35932
36043
  var toRgb = (colorArr) => {
35933
36044
  const [r = 0, g = 0, b = 0] = colorArr;
35934
36045
  return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
@@ -36050,17 +36161,17 @@ function createCopperPourTextureForLayer({
36050
36161
  if (!onlyCoveredBySoldermask) {
36051
36162
  setColorAndDraw(uncoveredPours, uncoveredColor);
36052
36163
  }
36053
- const texture = new THREE26.CanvasTexture(canvas);
36164
+ const texture = new THREE27.CanvasTexture(canvas);
36054
36165
  texture.generateMipmaps = true;
36055
- texture.minFilter = THREE26.LinearMipmapLinearFilter;
36056
- texture.magFilter = THREE26.LinearFilter;
36166
+ texture.minFilter = THREE27.LinearMipmapLinearFilter;
36167
+ texture.magFilter = THREE27.LinearFilter;
36057
36168
  texture.anisotropy = 16;
36058
36169
  texture.needsUpdate = true;
36059
36170
  return texture;
36060
36171
  }
36061
36172
 
36062
36173
  // src/textures/create-copper-text-texture-for-layer.ts
36063
- import * as THREE27 from "three";
36174
+ import * as THREE28 from "three";
36064
36175
 
36065
36176
  // src/textures/copper-text/copper-text-drawing.ts
36066
36177
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
@@ -36171,17 +36282,17 @@ function createCopperTextTextureForLayer({
36171
36282
  elements,
36172
36283
  copperColor
36173
36284
  });
36174
- const texture = new THREE27.CanvasTexture(canvas);
36285
+ const texture = new THREE28.CanvasTexture(canvas);
36175
36286
  texture.generateMipmaps = true;
36176
- texture.minFilter = THREE27.LinearMipmapLinearFilter;
36177
- texture.magFilter = THREE27.LinearFilter;
36287
+ texture.minFilter = THREE28.LinearMipmapLinearFilter;
36288
+ texture.magFilter = THREE28.LinearFilter;
36178
36289
  texture.anisotropy = 16;
36179
36290
  texture.needsUpdate = true;
36180
36291
  return texture;
36181
36292
  }
36182
36293
 
36183
36294
  // src/textures/create-fabrication-note-texture-for-layer.ts
36184
- import * as THREE28 from "three";
36295
+ import * as THREE29 from "three";
36185
36296
 
36186
36297
  // src/textures/fabrication-note/fabrication-note-drawing.ts
36187
36298
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
@@ -36409,17 +36520,17 @@ function createFabricationNoteTextureForLayer({
36409
36520
  bounds,
36410
36521
  elements
36411
36522
  });
36412
- const texture = new THREE28.CanvasTexture(canvas);
36523
+ const texture = new THREE29.CanvasTexture(canvas);
36413
36524
  texture.generateMipmaps = true;
36414
- texture.minFilter = THREE28.LinearMipmapLinearFilter;
36415
- texture.magFilter = THREE28.LinearFilter;
36525
+ texture.minFilter = THREE29.LinearMipmapLinearFilter;
36526
+ texture.magFilter = THREE29.LinearFilter;
36416
36527
  texture.anisotropy = 16;
36417
36528
  texture.needsUpdate = true;
36418
36529
  return texture;
36419
36530
  }
36420
36531
 
36421
36532
  // src/textures/create-keepout-texture-for-layer.ts
36422
- import * as THREE29 from "three";
36533
+ import * as THREE30 from "three";
36423
36534
 
36424
36535
  // src/textures/keepout/keepout-drawing.ts
36425
36536
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
@@ -36494,17 +36605,17 @@ function createKeepoutTextureForLayer({
36494
36605
  elements,
36495
36606
  keepoutColor
36496
36607
  });
36497
- const texture = new THREE29.CanvasTexture(canvas);
36608
+ const texture = new THREE30.CanvasTexture(canvas);
36498
36609
  texture.generateMipmaps = true;
36499
- texture.minFilter = THREE29.LinearMipmapLinearFilter;
36500
- texture.magFilter = THREE29.LinearFilter;
36610
+ texture.minFilter = THREE30.LinearMipmapLinearFilter;
36611
+ texture.magFilter = THREE30.LinearFilter;
36501
36612
  texture.anisotropy = 16;
36502
36613
  texture.needsUpdate = true;
36503
36614
  return texture;
36504
36615
  }
36505
36616
 
36506
36617
  // src/textures/create-pcb-note-texture-for-layer.ts
36507
- import * as THREE30 from "three";
36618
+ import * as THREE31 from "three";
36508
36619
 
36509
36620
  // src/textures/pcb-note/pcb-note-drawing.ts
36510
36621
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer7 } from "circuit-to-canvas";
@@ -36655,17 +36766,17 @@ function createPcbNoteTextureForLayer({
36655
36766
  bounds,
36656
36767
  elements
36657
36768
  });
36658
- const texture = new THREE30.CanvasTexture(canvas);
36769
+ const texture = new THREE31.CanvasTexture(canvas);
36659
36770
  texture.generateMipmaps = true;
36660
- texture.minFilter = THREE30.LinearMipmapLinearFilter;
36661
- texture.magFilter = THREE30.LinearFilter;
36771
+ texture.minFilter = THREE31.LinearMipmapLinearFilter;
36772
+ texture.magFilter = THREE31.LinearFilter;
36662
36773
  texture.anisotropy = 16;
36663
36774
  texture.needsUpdate = true;
36664
36775
  return texture;
36665
36776
  }
36666
36777
 
36667
36778
  // src/textures/create-silkscreen-texture-for-layer.ts
36668
- import * as THREE31 from "three";
36779
+ import * as THREE32 from "three";
36669
36780
 
36670
36781
  // src/textures/silkscreen/silkscreen-drawing.ts
36671
36782
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer8 } from "circuit-to-canvas";
@@ -36774,17 +36885,17 @@ function createSilkscreenTextureForLayer({
36774
36885
  elements,
36775
36886
  silkscreenColor
36776
36887
  });
36777
- const texture = new THREE31.CanvasTexture(canvas);
36888
+ const texture = new THREE32.CanvasTexture(canvas);
36778
36889
  texture.generateMipmaps = true;
36779
- texture.minFilter = THREE31.LinearMipmapLinearFilter;
36780
- texture.magFilter = THREE31.LinearFilter;
36890
+ texture.minFilter = THREE32.LinearMipmapLinearFilter;
36891
+ texture.magFilter = THREE32.LinearFilter;
36781
36892
  texture.anisotropy = 16;
36782
36893
  texture.needsUpdate = true;
36783
36894
  return texture;
36784
36895
  }
36785
36896
 
36786
36897
  // src/textures/create-soldermask-texture-for-layer.ts
36787
- import * as THREE32 from "three";
36898
+ import * as THREE33 from "three";
36788
36899
 
36789
36900
  // src/textures/soldermask/soldermask-drawing.ts
36790
36901
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer9 } from "circuit-to-canvas";
@@ -36919,17 +37030,17 @@ function createSoldermaskTextureForLayer({
36919
37030
  elements,
36920
37031
  boardMaterial: boardData.material
36921
37032
  });
36922
- const texture = new THREE32.CanvasTexture(canvas);
37033
+ const texture = new THREE33.CanvasTexture(canvas);
36923
37034
  texture.generateMipmaps = true;
36924
- texture.minFilter = THREE32.LinearMipmapLinearFilter;
36925
- texture.magFilter = THREE32.LinearFilter;
37035
+ texture.minFilter = THREE33.LinearMipmapLinearFilter;
37036
+ texture.magFilter = THREE33.LinearFilter;
36926
37037
  texture.anisotropy = 16;
36927
37038
  texture.needsUpdate = true;
36928
37039
  return texture;
36929
37040
  }
36930
37041
 
36931
37042
  // src/textures/create-through-hole-texture-for-layer.ts
36932
- import * as THREE33 from "three";
37043
+ import * as THREE34 from "three";
36933
37044
 
36934
37045
  // src/textures/through-hole/through-hole-drawing.ts
36935
37046
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer10 } from "circuit-to-canvas";
@@ -37022,10 +37133,10 @@ function createThroughHoleTextureForLayer({
37022
37133
  elements,
37023
37134
  copperColor
37024
37135
  });
37025
- const texture = new THREE33.CanvasTexture(canvas);
37136
+ const texture = new THREE34.CanvasTexture(canvas);
37026
37137
  texture.generateMipmaps = true;
37027
- texture.minFilter = THREE33.LinearMipmapLinearFilter;
37028
- texture.magFilter = THREE33.LinearFilter;
37138
+ texture.minFilter = THREE34.LinearMipmapLinearFilter;
37139
+ texture.magFilter = THREE34.LinearFilter;
37029
37140
  texture.anisotropy = 16;
37030
37141
  texture.needsUpdate = true;
37031
37142
  return texture;
@@ -37113,10 +37224,10 @@ var createCombinedTexture = ({
37113
37224
  applySoldermaskSurfaceFilter(ctx, canvasWidth, canvasHeight, {
37114
37225
  includeReflection: layer === "top"
37115
37226
  });
37116
- const combinedTexture = new THREE34.CanvasTexture(canvas);
37227
+ const combinedTexture = new THREE35.CanvasTexture(canvas);
37117
37228
  combinedTexture.generateMipmaps = false;
37118
- combinedTexture.minFilter = THREE34.LinearFilter;
37119
- combinedTexture.magFilter = THREE34.LinearFilter;
37229
+ combinedTexture.minFilter = THREE35.LinearFilter;
37230
+ combinedTexture.magFilter = THREE35.LinearFilter;
37120
37231
  combinedTexture.premultiplyAlpha = true;
37121
37232
  combinedTexture.anisotropy = 16;
37122
37233
  combinedTexture.needsUpdate = true;
@@ -37141,11 +37252,11 @@ var createMaskedCopperMask = ({
37141
37252
  if (!texture?.image) continue;
37142
37253
  ctx.drawImage(texture.image, 0, 0, width10, height10);
37143
37254
  }
37144
- const maskTexture = new THREE34.CanvasTexture(canvas);
37145
- maskTexture.colorSpace = THREE34.NoColorSpace;
37255
+ const maskTexture = new THREE35.CanvasTexture(canvas);
37256
+ maskTexture.colorSpace = THREE35.NoColorSpace;
37146
37257
  maskTexture.generateMipmaps = false;
37147
- maskTexture.minFilter = THREE34.LinearFilter;
37148
- maskTexture.magFilter = THREE34.LinearFilter;
37258
+ maskTexture.minFilter = THREE35.LinearFilter;
37259
+ maskTexture.magFilter = THREE35.LinearFilter;
37149
37260
  maskTexture.premultiplyAlpha = false;
37150
37261
  maskTexture.needsUpdate = true;
37151
37262
  return maskTexture;
@@ -37283,7 +37394,7 @@ function createCombinedBoardTextures({
37283
37394
  }
37284
37395
 
37285
37396
  // src/textures/create-three-texture-meshes.ts
37286
- import * as THREE36 from "three";
37397
+ import * as THREE37 from "three";
37287
37398
 
37288
37399
  // src/board-surface-textures.ts
37289
37400
  var REALISTIC_BOARD_SURFACE_MATERIAL = {
@@ -37306,7 +37417,7 @@ var PAD_COPPER_TEXTURE_MATERIAL = {
37306
37417
  };
37307
37418
 
37308
37419
  // src/utils/create-board-relief-textures.ts
37309
- import * as THREE35 from "three";
37420
+ import * as THREE36 from "three";
37310
37421
  var PLAIN_SOLDERMASK_HEIGHT = 0.22;
37311
37422
  var MASKED_COPPER_HEIGHT = 0.7;
37312
37423
  var EXPOSED_COPPER_HEIGHT = 0.86;
@@ -37395,13 +37506,13 @@ var getBoardSurfaceProfile = (r, g, b, hasMaskedCopper) => {
37395
37506
  };
37396
37507
  };
37397
37508
  var createDataTexture = (canvas) => {
37398
- const texture = new THREE35.CanvasTexture(canvas);
37399
- texture.colorSpace = THREE35.NoColorSpace;
37509
+ const texture = new THREE36.CanvasTexture(canvas);
37510
+ texture.colorSpace = THREE36.NoColorSpace;
37400
37511
  texture.generateMipmaps = false;
37401
- texture.minFilter = THREE35.LinearFilter;
37402
- texture.magFilter = THREE35.LinearFilter;
37403
- texture.wrapS = THREE35.ClampToEdgeWrapping;
37404
- texture.wrapT = THREE35.ClampToEdgeWrapping;
37512
+ texture.minFilter = THREE36.LinearFilter;
37513
+ texture.magFilter = THREE36.LinearFilter;
37514
+ texture.wrapS = THREE36.ClampToEdgeWrapping;
37515
+ texture.wrapT = THREE36.ClampToEdgeWrapping;
37405
37516
  texture.needsUpdate = true;
37406
37517
  return texture;
37407
37518
  };
@@ -37508,7 +37619,7 @@ var createBoardReliefTextures = (texture, maskedCopperMask) => {
37508
37619
  for (let x = 0; x < sourceCanvas.width; x++) {
37509
37620
  const dx = (getHeight4(x + 1, y) - getHeight4(x - 1, y)) * 4;
37510
37621
  const dy = (getHeight4(x, y + 1) - getHeight4(x, y - 1)) * 4;
37511
- const normal = new THREE35.Vector3(-dx, -dy, 1).normalize();
37622
+ const normal = new THREE36.Vector3(-dx, -dy, 1).normalize();
37512
37623
  const i = (y * sourceCanvas.width + x) * 4;
37513
37624
  normalData[i] = (normal.x * 0.5 + 0.5) * 255;
37514
37625
  normalData[i + 1] = (normal.y * 0.5 + 0.5) * 255;
@@ -37538,16 +37649,16 @@ function createTexturePlane(config, boardData) {
37538
37649
  } = config;
37539
37650
  if (!texture) return null;
37540
37651
  const boardOutlineBounds = calculateOutlineBounds(boardData);
37541
- const planeGeom = new THREE36.PlaneGeometry(
37652
+ const planeGeom = new THREE37.PlaneGeometry(
37542
37653
  boardOutlineBounds.width,
37543
37654
  boardOutlineBounds.height
37544
37655
  );
37545
- texture.colorSpace = THREE36.SRGBColorSpace;
37656
+ texture.colorSpace = THREE37.SRGBColorSpace;
37546
37657
  const sharedMaterialOptions = {
37547
37658
  map: texture,
37548
37659
  transparent: true,
37549
37660
  alphaTest: 0.08,
37550
- side: THREE36.FrontSide,
37661
+ side: THREE37.FrontSide,
37551
37662
  depthWrite: true,
37552
37663
  polygonOffset: usePolygonOffset,
37553
37664
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
@@ -37556,12 +37667,12 @@ function createTexturePlane(config, boardData) {
37556
37667
  opacity: isFaux ? FAUX_BOARD_OPACITY : 1
37557
37668
  };
37558
37669
  const reliefTextures = createBoardReliefTextures(texture, maskedCopperMask);
37559
- const material = new THREE36.MeshPhysicalMaterial({
37670
+ const material = new THREE37.MeshPhysicalMaterial({
37560
37671
  ...sharedMaterialOptions,
37561
37672
  bumpMap: reliefTextures?.bumpMap ?? null,
37562
37673
  bumpScale: REALISTIC_BOARD_SURFACE_MATERIAL.bumpScale,
37563
37674
  normalMap: reliefTextures?.normalMap ?? null,
37564
- normalScale: new THREE36.Vector2(
37675
+ normalScale: new THREE37.Vector2(
37565
37676
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale,
37566
37677
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale
37567
37678
  ),
@@ -37575,7 +37686,7 @@ function createTexturePlane(config, boardData) {
37575
37686
  clearcoatRoughness: REALISTIC_BOARD_SURFACE_MATERIAL.clearcoatRoughness,
37576
37687
  envMapIntensity: 0.18
37577
37688
  });
37578
- const mesh = new THREE36.Mesh(planeGeom, material);
37689
+ const mesh = new THREE37.Mesh(planeGeom, material);
37579
37690
  mesh.position.set(
37580
37691
  boardOutlineBounds.centerX,
37581
37692
  boardOutlineBounds.centerY,
@@ -37623,7 +37734,7 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
37623
37734
  }
37624
37735
 
37625
37736
  // src/three-components/JscadBoardTextures.tsx
37626
- import * as THREE37 from "three";
37737
+ import * as THREE38 from "three";
37627
37738
 
37628
37739
  // src/utils/layer-texture-resolution.ts
37629
37740
  var DEFAULT_MAX_TEXTURE_PIXELS = 4e6;
@@ -37660,7 +37771,7 @@ function JscadBoardTextures({
37660
37771
  }) {
37661
37772
  const { rootObject } = useThree();
37662
37773
  const { visibility } = useLayerVisibility();
37663
- const boardData = useMemo19(() => {
37774
+ const boardData = useMemo20(() => {
37664
37775
  const panels = circuitJson.filter(
37665
37776
  (e) => e.type === "pcb_panel"
37666
37777
  );
@@ -37686,11 +37797,11 @@ function JscadBoardTextures({
37686
37797
  );
37687
37798
  return boardsNotInPanel.length > 0 ? boardsNotInPanel[0] : null;
37688
37799
  }, [circuitJson]);
37689
- const traceTextureResolution = useMemo19(() => {
37800
+ const traceTextureResolution = useMemo20(() => {
37690
37801
  if (!boardData) return TRACE_TEXTURE_RESOLUTION;
37691
37802
  return getLayerTextureResolution(boardData, TRACE_TEXTURE_RESOLUTION);
37692
37803
  }, [boardData]);
37693
- const textures = useMemo19(() => {
37804
+ const textures = useMemo20(() => {
37694
37805
  if (!boardData?.width || !boardData.height) return null;
37695
37806
  return createCombinedBoardTextures({
37696
37807
  circuitJson,
@@ -37699,7 +37810,7 @@ function JscadBoardTextures({
37699
37810
  visibility
37700
37811
  });
37701
37812
  }, [circuitJson, boardData, traceTextureResolution, visibility]);
37702
- useEffect24(() => {
37813
+ useEffect25(() => {
37703
37814
  if (!rootObject || !boardData || !textures) return;
37704
37815
  const meshes = [];
37705
37816
  const disposeTextureMaterial = (material) => {
@@ -37719,7 +37830,7 @@ function JscadBoardTextures({
37719
37830
  const typedMaterial = material;
37720
37831
  for (const prop of textureProps) {
37721
37832
  const texture = typedMaterial[prop];
37722
- if (texture && texture instanceof THREE37.Texture) {
37833
+ if (texture && texture instanceof THREE38.Texture) {
37723
37834
  texture.dispose();
37724
37835
  typedMaterial[prop] = null;
37725
37836
  }
@@ -37738,16 +37849,16 @@ function JscadBoardTextures({
37738
37849
  }) => {
37739
37850
  if (!texture) return null;
37740
37851
  const boardOutlineBounds = calculateOutlineBounds(boardData);
37741
- const planeGeom = new THREE37.PlaneGeometry(
37852
+ const planeGeom = new THREE38.PlaneGeometry(
37742
37853
  boardOutlineBounds.width,
37743
37854
  boardOutlineBounds.height
37744
37855
  );
37745
- texture.colorSpace = THREE37.SRGBColorSpace;
37856
+ texture.colorSpace = THREE38.SRGBColorSpace;
37746
37857
  const sharedMaterialOptions = {
37747
37858
  map: texture,
37748
37859
  transparent: true,
37749
37860
  alphaTest: 0.08,
37750
- side: THREE37.FrontSide,
37861
+ side: THREE38.FrontSide,
37751
37862
  depthWrite,
37752
37863
  polygonOffset: usePolygonOffset,
37753
37864
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
@@ -37758,12 +37869,12 @@ function JscadBoardTextures({
37758
37869
  texture,
37759
37870
  maskedCopperMask
37760
37871
  );
37761
- const material = new THREE37.MeshPhysicalMaterial({
37872
+ const material = new THREE38.MeshPhysicalMaterial({
37762
37873
  ...sharedMaterialOptions,
37763
37874
  bumpMap: reliefTextures?.bumpMap ?? null,
37764
37875
  bumpScale: REALISTIC_BOARD_SURFACE_MATERIAL.bumpScale,
37765
37876
  normalMap: reliefTextures?.normalMap ?? null,
37766
- normalScale: new THREE37.Vector2(
37877
+ normalScale: new THREE38.Vector2(
37767
37878
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale,
37768
37879
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale
37769
37880
  ),
@@ -37775,7 +37886,7 @@ function JscadBoardTextures({
37775
37886
  clearcoatRoughness: REALISTIC_BOARD_SURFACE_MATERIAL.clearcoatRoughness,
37776
37887
  envMapIntensity: 0.18
37777
37888
  });
37778
- const mesh = new THREE37.Mesh(planeGeom, material);
37889
+ const mesh = new THREE38.Mesh(planeGeom, material);
37779
37890
  mesh.position.set(
37780
37891
  boardOutlineBounds.centerX,
37781
37892
  boardOutlineBounds.centerY,
@@ -37825,7 +37936,7 @@ function JscadBoardTextures({
37825
37936
  for (const material of mesh.material) {
37826
37937
  disposeTextureMaterial(material);
37827
37938
  }
37828
- } else if (mesh.material instanceof THREE37.Material) {
37939
+ } else if (mesh.material instanceof THREE38.Material) {
37829
37940
  disposeTextureMaterial(mesh.material);
37830
37941
  }
37831
37942
  }
@@ -37937,13 +38048,13 @@ var CadViewerJscad = forwardRef3(
37937
38048
  resolveStaticAsset
37938
38049
  }, ref) => {
37939
38050
  const childrenSoup = useConvertChildrenToCircuitJson(children);
37940
- const internalCircuitJson = useMemo20(() => {
38051
+ const internalCircuitJson = useMemo21(() => {
37941
38052
  return addFauxBoardIfNeeded(
37942
38053
  circuitJson ?? childrenSoup
37943
38054
  );
37944
38055
  }, [circuitJson, childrenSoup]);
37945
38056
  const boardGeom = useBoardGeomBuilder(internalCircuitJson);
37946
- const initialCameraPosition = useMemo20(() => {
38057
+ const initialCameraPosition = useMemo21(() => {
37947
38058
  if (!internalCircuitJson) return [5, -5, 5];
37948
38059
  try {
37949
38060
  const board = su11(internalCircuitJson).pcb_board.list()[0];
@@ -37969,7 +38080,7 @@ var CadViewerJscad = forwardRef3(
37969
38080
  return [5, -5, 5];
37970
38081
  }
37971
38082
  }, [internalCircuitJson]);
37972
- const isFauxBoard = useMemo20(() => {
38083
+ const isFauxBoard = useMemo21(() => {
37973
38084
  if (!internalCircuitJson) return false;
37974
38085
  try {
37975
38086
  const board = su11(internalCircuitJson).pcb_board.list()[0];
@@ -37978,7 +38089,7 @@ var CadViewerJscad = forwardRef3(
37978
38089
  return false;
37979
38090
  }
37980
38091
  }, [internalCircuitJson]);
37981
- const boardDimensions = useMemo20(() => {
38092
+ const boardDimensions = useMemo21(() => {
37982
38093
  if (!internalCircuitJson) return void 0;
37983
38094
  try {
37984
38095
  const board = su11(internalCircuitJson).pcb_board.list()[0];
@@ -37989,7 +38100,7 @@ var CadViewerJscad = forwardRef3(
37989
38100
  return void 0;
37990
38101
  }
37991
38102
  }, [internalCircuitJson]);
37992
- const boardCenter = useMemo20(() => {
38103
+ const boardCenter = useMemo21(() => {
37993
38104
  if (!internalCircuitJson) return void 0;
37994
38105
  try {
37995
38106
  const board = su11(internalCircuitJson).pcb_board.list()[0];
@@ -38057,13 +38168,13 @@ var CadViewerJscad = forwardRef3(
38057
38168
 
38058
38169
  // src/CadViewerManifold.tsx
38059
38170
  import { su as su17 } from "@tscircuit/circuit-json-util";
38060
- import { useEffect as useEffect26, useMemo as useMemo22, useState as useState17 } from "react";
38061
- import * as THREE44 from "three";
38171
+ import { useEffect as useEffect27, useMemo as useMemo23, useState as useState17 } from "react";
38172
+ import * as THREE45 from "three";
38062
38173
 
38063
38174
  // src/hooks/useManifoldBoardBuilder.ts
38064
38175
  import { su as su16 } from "@tscircuit/circuit-json-util";
38065
- import { useEffect as useEffect25, useMemo as useMemo21, useRef as useRef9, useState as useState16 } from "react";
38066
- import * as THREE41 from "three";
38176
+ import { useEffect as useEffect26, useMemo as useMemo22, useRef as useRef9, useState as useState16 } from "react";
38177
+ import * as THREE42 from "three";
38067
38178
 
38068
38179
  // src/utils/manifold/create-manifold-board.ts
38069
38180
  var arePointsClockwise2 = (points) => {
@@ -38412,17 +38523,17 @@ function processNonPlatedHolesForManifold(Manifold, CrossSection, circuitJson, p
38412
38523
 
38413
38524
  // src/utils/manifold/process-plated-holes.ts
38414
38525
  import { su as su14 } from "@tscircuit/circuit-json-util";
38415
- import * as THREE39 from "three";
38526
+ import * as THREE40 from "three";
38416
38527
 
38417
38528
  // src/utils/manifold-mesh-to-three-geometry.ts
38418
- import * as THREE38 from "three";
38529
+ import * as THREE39 from "three";
38419
38530
  function manifoldMeshToThreeGeometry(manifoldMesh) {
38420
- const geometry = new THREE38.BufferGeometry();
38531
+ const geometry = new THREE39.BufferGeometry();
38421
38532
  geometry.setAttribute(
38422
38533
  "position",
38423
- new THREE38.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
38534
+ new THREE39.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
38424
38535
  );
38425
- geometry.setIndex(new THREE38.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
38536
+ geometry.setIndex(new THREE39.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
38426
38537
  if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
38427
38538
  for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
38428
38539
  const start = manifoldMesh.runIndex[i];
@@ -38456,7 +38567,7 @@ var createEllipsePoints = (width10, height10, segments) => {
38456
38567
  }
38457
38568
  return points;
38458
38569
  };
38459
- var COPPER_COLOR = new THREE39.Color(...colors.copper);
38570
+ var COPPER_COLOR = new THREE40.Color(...colors.copper);
38460
38571
  var PLATED_HOLE_LIP_HEIGHT = 0.05;
38461
38572
  var PLATED_HOLE_PAD_THICKNESS = 3e-3;
38462
38573
  var PLATED_HOLE_SURFACE_CLEARANCE = 5e-4;
@@ -39087,7 +39198,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
39087
39198
 
39088
39199
  // src/utils/manifold/process-vias.ts
39089
39200
  import { su as su15 } from "@tscircuit/circuit-json-util";
39090
- import * as THREE40 from "three";
39201
+ import * as THREE41 from "three";
39091
39202
 
39092
39203
  // src/utils/via-geoms.ts
39093
39204
  function createViaCopper2({
@@ -39125,7 +39236,7 @@ function createViaCopper2({
39125
39236
  }
39126
39237
 
39127
39238
  // src/utils/manifold/process-vias.ts
39128
- var COPPER_COLOR2 = new THREE40.Color(...colors.copper);
39239
+ var COPPER_COLOR2 = new THREE41.Color(...colors.copper);
39129
39240
  function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, boardClipVolume) {
39130
39241
  const viaBoardDrills = [];
39131
39242
  const pcbVias = su15(circuitJson).pcb_via.list();
@@ -39183,7 +39294,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
39183
39294
  const [error, setError] = useState16(null);
39184
39295
  const [isLoading, setIsLoading] = useState16(true);
39185
39296
  const manifoldInstancesForCleanup = useRef9([]);
39186
- const boardData = useMemo21(() => {
39297
+ const boardData = useMemo22(() => {
39187
39298
  const panels = circuitJson.filter(
39188
39299
  (e) => e.type === "pcb_panel"
39189
39300
  );
@@ -39207,15 +39318,15 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
39207
39318
  const boardsNotInPanel = boards.filter((b) => !b.pcb_panel_id);
39208
39319
  return boardsNotInPanel.length > 0 ? boardsNotInPanel[0] : null;
39209
39320
  }, [circuitJson]);
39210
- const isFauxBoard = useMemo21(() => {
39321
+ const isFauxBoard = useMemo22(() => {
39211
39322
  const boards = su16(circuitJson).pcb_board.list();
39212
39323
  return boards.length > 0 && boards[0].pcb_board_id === "faux-board";
39213
39324
  }, [circuitJson]);
39214
- const traceTextureResolution = useMemo21(() => {
39325
+ const traceTextureResolution = useMemo22(() => {
39215
39326
  if (!boardData) return TRACE_TEXTURE_RESOLUTION;
39216
39327
  return getLayerTextureResolution(boardData, TRACE_TEXTURE_RESOLUTION);
39217
39328
  }, [boardData]);
39218
- useEffect25(() => {
39329
+ useEffect26(() => {
39219
39330
  if (!manifoldJSModule || !boardData) {
39220
39331
  setGeoms(null);
39221
39332
  setPcbThickness(null);
@@ -39345,7 +39456,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
39345
39456
  {
39346
39457
  key: "plated-holes-union",
39347
39458
  geometry: cutPlatedGeom,
39348
- color: new THREE41.Color(
39459
+ color: new THREE42.Color(
39349
39460
  colors.copper[0],
39350
39461
  colors.copper[1],
39351
39462
  colors.copper[2]
@@ -39375,7 +39486,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
39375
39486
  const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Tan;
39376
39487
  currentGeoms.board = {
39377
39488
  geometry: finalBoardGeom,
39378
- color: new THREE41.Color(
39489
+ color: new THREE42.Color(
39379
39490
  matColorArray[0],
39380
39491
  matColorArray[1],
39381
39492
  matColorArray[2]
@@ -39399,7 +39510,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
39399
39510
  manifoldInstancesForCleanup.current = [];
39400
39511
  };
39401
39512
  }, [manifoldJSModule, circuitJson, boardData]);
39402
- const textures = useMemo21(() => {
39513
+ const textures = useMemo22(() => {
39403
39514
  if (!boardData || !traceTextureResolution) return null;
39404
39515
  return createCombinedBoardTextures({
39405
39516
  circuitJson,
@@ -39420,11 +39531,11 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
39420
39531
  };
39421
39532
 
39422
39533
  // src/utils/manifold/create-three-geometry-meshes.ts
39423
- import * as THREE43 from "three";
39534
+ import * as THREE44 from "three";
39424
39535
 
39425
39536
  // src/utils/create-board-material.ts
39426
- import * as THREE42 from "three";
39427
- var DEFAULT_SIDE = THREE42.DoubleSide;
39537
+ import * as THREE43 from "three";
39538
+ var DEFAULT_SIDE = THREE43.DoubleSide;
39428
39539
  var createBoardMaterial = ({
39429
39540
  material,
39430
39541
  color,
@@ -39432,7 +39543,7 @@ var createBoardMaterial = ({
39432
39543
  isFaux = false
39433
39544
  }) => {
39434
39545
  if (material === "fr4") {
39435
- return new THREE42.MeshPhysicalMaterial({
39546
+ return new THREE43.MeshPhysicalMaterial({
39436
39547
  // A dark edge lets the green solder mask read as a finished PCB rather
39437
39548
  // than a tan substrate with a decal placed on top.
39438
39549
  color: 1063462,
@@ -39452,7 +39563,7 @@ var createBoardMaterial = ({
39452
39563
  polygonOffsetUnits: 1
39453
39564
  });
39454
39565
  }
39455
- return new THREE42.MeshStandardMaterial({
39566
+ return new THREE43.MeshStandardMaterial({
39456
39567
  color,
39457
39568
  side,
39458
39569
  flatShading: true,
@@ -39471,12 +39582,12 @@ function createGeometryMeshes(geoms) {
39471
39582
  const meshes = [];
39472
39583
  if (!geoms) return meshes;
39473
39584
  if (geoms.board?.geometry) {
39474
- const mesh = new THREE43.Mesh(
39585
+ const mesh = new THREE44.Mesh(
39475
39586
  geoms.board.geometry,
39476
39587
  createBoardMaterial({
39477
39588
  material: geoms.board.material,
39478
39589
  color: geoms.board.color,
39479
- side: THREE43.DoubleSide,
39590
+ side: THREE44.DoubleSide,
39480
39591
  isFaux: geoms.board.isFaux
39481
39592
  })
39482
39593
  );
@@ -39487,11 +39598,11 @@ function createGeometryMeshes(geoms) {
39487
39598
  const createMeshesFromArray = (geomArray) => {
39488
39599
  if (geomArray) {
39489
39600
  for (const comp of geomArray) {
39490
- const mesh = new THREE43.Mesh(
39601
+ const mesh = new THREE44.Mesh(
39491
39602
  comp.geometry,
39492
- new THREE43.MeshStandardMaterial({
39603
+ new THREE44.MeshStandardMaterial({
39493
39604
  color: comp.color,
39494
- side: THREE43.DoubleSide,
39605
+ side: THREE44.DoubleSide,
39495
39606
  flatShading: true
39496
39607
  // Consistent with board
39497
39608
  })
@@ -39536,14 +39647,14 @@ var BoardMeshes = ({
39536
39647
  const typedMaterial = material;
39537
39648
  for (const prop of textureProps) {
39538
39649
  const texture = typedMaterial[prop];
39539
- if (texture && texture instanceof THREE44.Texture) {
39650
+ if (texture && texture instanceof THREE45.Texture) {
39540
39651
  texture.dispose();
39541
39652
  }
39542
39653
  }
39543
39654
  material.dispose();
39544
39655
  }
39545
39656
  };
39546
- useEffect26(() => {
39657
+ useEffect27(() => {
39547
39658
  if (!rootObject) return;
39548
39659
  for (const mesh of geometryMeshes) {
39549
39660
  let shouldShow = true;
@@ -39565,7 +39676,7 @@ var BoardMeshes = ({
39565
39676
  }
39566
39677
  };
39567
39678
  }, [rootObject, geometryMeshes, visibility]);
39568
- useEffect26(() => {
39679
+ useEffect27(() => {
39569
39680
  if (!rootObject) return;
39570
39681
  for (const mesh of textureMeshes) {
39571
39682
  rootObject.add(mesh);
@@ -39592,14 +39703,14 @@ var CadViewerManifold = ({
39592
39703
  resolveStaticAsset
39593
39704
  }) => {
39594
39705
  const childrenCircuitJson = useConvertChildrenToCircuitJson(children);
39595
- const circuitJson = useMemo22(() => {
39706
+ const circuitJson = useMemo23(() => {
39596
39707
  const rawCircuitJson = circuitJsonProp ?? childrenCircuitJson;
39597
39708
  return addFauxBoardIfNeeded(rawCircuitJson);
39598
39709
  }, [circuitJsonProp, childrenCircuitJson]);
39599
39710
  const [manifoldJSModule, setManifoldJSModule] = useState17(null);
39600
39711
  const [manifoldLoadingError, setManifoldLoadingError] = useState17(null);
39601
39712
  const { visibility } = useLayerVisibility();
39602
- useEffect26(() => {
39713
+ useEffect27(() => {
39603
39714
  if (window.ManifoldModule && typeof window.ManifoldModule === "object" && window.ManifoldModule.setup) {
39604
39715
  setManifoldJSModule(window.ManifoldModule);
39605
39716
  return;
@@ -39670,27 +39781,27 @@ try {
39670
39781
  boardData,
39671
39782
  isFauxBoard
39672
39783
  } = useManifoldBoardBuilder(manifoldJSModule, circuitJson, visibility);
39673
- const geometryMeshes = useMemo22(() => createGeometryMeshes(geoms), [geoms]);
39674
- const textureMeshes = useMemo22(
39784
+ const geometryMeshes = useMemo23(() => createGeometryMeshes(geoms), [geoms]);
39785
+ const textureMeshes = useMemo23(
39675
39786
  () => createTextureMeshes(textures, boardData, pcbThickness, isFauxBoard),
39676
39787
  [textures, boardData, pcbThickness, isFauxBoard]
39677
39788
  );
39678
- const cadComponents = useMemo22(
39789
+ const cadComponents = useMemo23(
39679
39790
  () => su17(circuitJson).cad_component.list(),
39680
39791
  [circuitJson]
39681
39792
  );
39682
- const boardDimensions = useMemo22(() => {
39793
+ const boardDimensions = useMemo23(() => {
39683
39794
  if (!boardData) return void 0;
39684
39795
  const { width: width10 = 0, height: height10 = 0 } = boardData;
39685
39796
  return { width: width10, height: height10 };
39686
39797
  }, [boardData]);
39687
- const boardCenter = useMemo22(() => {
39798
+ const boardCenter = useMemo23(() => {
39688
39799
  if (!boardData) return void 0;
39689
39800
  const { center } = boardData;
39690
39801
  if (!center) return void 0;
39691
39802
  return { x: center.x, y: center.y };
39692
39803
  }, [boardData]);
39693
- const initialCameraPosition = useMemo22(() => {
39804
+ const initialCameraPosition = useMemo23(() => {
39694
39805
  if (!boardData) return [5, -5, 5];
39695
39806
  const { width: width10 = 0, height: height10 = 0 } = boardData;
39696
39807
  const safeWidth = Math.max(width10, 1);
@@ -39788,7 +39899,7 @@ var CadViewerManifold_default = CadViewerManifold;
39788
39899
  import { useState as useState35 } from "react";
39789
39900
 
39790
39901
  // node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
39791
- import * as React41 from "react";
39902
+ import * as React42 from "react";
39792
39903
 
39793
39904
  // node_modules/@radix-ui/primitive/dist/index.mjs
39794
39905
  var __defProp3 = Object.defineProperty;
@@ -39843,7 +39954,7 @@ function isFrame(element) {
39843
39954
  __name(isFrame, "isFrame");
39844
39955
 
39845
39956
  // node_modules/@radix-ui/react-compose-refs/dist/index.mjs
39846
- import * as React10 from "react";
39957
+ import * as React11 from "react";
39847
39958
  var __defProp4 = Object.defineProperty;
39848
39959
  var __name2 = (target, value) => __defProp4(target, "name", { value, configurable: true });
39849
39960
  function setRef(ref, value) {
@@ -39880,28 +39991,28 @@ function composeRefs(...refs) {
39880
39991
  }
39881
39992
  __name2(composeRefs, "composeRefs");
39882
39993
  function useComposedRefs(...refs) {
39883
- return React10.useCallback(composeRefs(...refs), refs);
39994
+ return React11.useCallback(composeRefs(...refs), refs);
39884
39995
  }
39885
39996
  __name2(useComposedRefs, "useComposedRefs");
39886
39997
 
39887
39998
  // node_modules/@radix-ui/react-context/dist/index.mjs
39888
- import * as React11 from "react";
39999
+ import * as React12 from "react";
39889
40000
  import { jsx as jsx20 } from "react/jsx-runtime";
39890
40001
  var __defProp5 = Object.defineProperty;
39891
40002
  var __name3 = (target, value) => __defProp5(target, "name", { value, configurable: true });
39892
40003
  // @__NO_SIDE_EFFECTS__
39893
40004
  function createContext22(rootComponentName, defaultContext) {
39894
- const Context = React11.createContext(defaultContext);
40005
+ const Context = React12.createContext(defaultContext);
39895
40006
  Context.displayName = rootComponentName + "Context";
39896
40007
  const Provider = /* @__PURE__ */ __name3((props) => {
39897
40008
  const { children, ...context } = props;
39898
- const value = React11.useMemo(() => context, Object.values(context));
40009
+ const value = React12.useMemo(() => context, Object.values(context));
39899
40010
  return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
39900
40011
  }, "Provider");
39901
40012
  Provider.displayName = rootComponentName + "Provider";
39902
40013
  function useContext22(consumerName, options = {}) {
39903
40014
  const { optional = false } = options;
39904
- const context = React11.useContext(Context);
40015
+ const context = React12.useContext(Context);
39905
40016
  if (context) return context;
39906
40017
  if (defaultContext !== void 0) return defaultContext;
39907
40018
  if (optional) return void 0;
@@ -39915,21 +40026,21 @@ __name3(createContext22, "createContext");
39915
40026
  function createContextScope(scopeName, createContextScopeDeps = []) {
39916
40027
  let defaultContexts = [];
39917
40028
  function createContext32(rootComponentName, defaultContext) {
39918
- const BaseContext = React11.createContext(defaultContext);
40029
+ const BaseContext = React12.createContext(defaultContext);
39919
40030
  BaseContext.displayName = rootComponentName + "Context";
39920
40031
  const index2 = defaultContexts.length;
39921
40032
  defaultContexts = [...defaultContexts, defaultContext];
39922
40033
  const Provider = /* @__PURE__ */ __name3((props) => {
39923
40034
  const { scope, children, ...context } = props;
39924
40035
  const Context = scope?.[scopeName]?.[index2] || BaseContext;
39925
- const value = React11.useMemo(() => context, Object.values(context));
40036
+ const value = React12.useMemo(() => context, Object.values(context));
39926
40037
  return /* @__PURE__ */ jsx20(Context.Provider, { value, children });
39927
40038
  }, "Provider");
39928
40039
  Provider.displayName = rootComponentName + "Provider";
39929
40040
  function useContext22(consumerName, scope, options = {}) {
39930
40041
  const { optional = false } = options;
39931
40042
  const Context = scope?.[scopeName]?.[index2] || BaseContext;
39932
- const context = React11.useContext(Context);
40043
+ const context = React12.useContext(Context);
39933
40044
  if (context) return context;
39934
40045
  if (defaultContext !== void 0) return defaultContext;
39935
40046
  if (optional) return void 0;
@@ -39941,11 +40052,11 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
39941
40052
  __name3(createContext32, "createContext");
39942
40053
  const createScope = /* @__PURE__ */ __name3(() => {
39943
40054
  const scopeContexts = defaultContexts.map((defaultContext) => {
39944
- return React11.createContext(defaultContext);
40055
+ return React12.createContext(defaultContext);
39945
40056
  });
39946
40057
  return /* @__PURE__ */ __name3(function useScope(scope) {
39947
40058
  const contexts = scope?.[scopeName] || scopeContexts;
39948
- return React11.useMemo(
40059
+ return React12.useMemo(
39949
40060
  () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
39950
40061
  [scope, contexts]
39951
40062
  );
@@ -39969,7 +40080,7 @@ function composeContextScopes(...scopes) {
39969
40080
  const currentScope = scopeProps[`__scope${scopeName}`];
39970
40081
  return { ...nextScopes2, ...currentScope };
39971
40082
  }, {});
39972
- return React11.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
40083
+ return React12.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
39973
40084
  }, "useComposedScopes");
39974
40085
  }, "createScope");
39975
40086
  createScope.scopeName = baseScope.scopeName;
@@ -39978,30 +40089,30 @@ function composeContextScopes(...scopes) {
39978
40089
  __name3(composeContextScopes, "composeContextScopes");
39979
40090
 
39980
40091
  // node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
39981
- import * as React14 from "react";
40092
+ import * as React15 from "react";
39982
40093
 
39983
40094
  // node_modules/@radix-ui/primitive/dist/internal/is-development.false.mjs
39984
40095
  var IS_DEVELOPMENT = false;
39985
40096
 
39986
40097
  // node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
39987
- import * as React12 from "react";
39988
- var useLayoutEffect2 = globalThis?.document ? React12.useLayoutEffect : () => {
40098
+ import * as React13 from "react";
40099
+ var useLayoutEffect2 = globalThis?.document ? React13.useLayoutEffect : () => {
39989
40100
  };
39990
40101
 
39991
40102
  // node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
39992
40103
  import * as React22 from "react";
39993
40104
 
39994
40105
  // node_modules/@radix-ui/react-use-effect-event/dist/index.mjs
39995
- import * as React13 from "react";
40106
+ import * as React14 from "react";
39996
40107
  var __defProp6 = Object.defineProperty;
39997
40108
  var __name4 = (target, value) => __defProp6(target, "name", { value, configurable: true });
39998
- var useReactEffectEvent = React13[" useEffectEvent ".trim().toString()];
39999
- var useReactInsertionEffect = React13[" useInsertionEffect ".trim().toString()];
40109
+ var useReactEffectEvent = React14[" useEffectEvent ".trim().toString()];
40110
+ var useReactInsertionEffect = React14[" useInsertionEffect ".trim().toString()];
40000
40111
  function useEffectEvent(callback) {
40001
40112
  if (typeof useReactEffectEvent === "function") {
40002
40113
  return useReactEffectEvent(callback);
40003
40114
  }
40004
- const ref = React13.useRef(() => {
40115
+ const ref = React14.useRef(() => {
40005
40116
  throw new Error("Cannot call an event handler while rendering.");
40006
40117
  });
40007
40118
  if (typeof useReactInsertionEffect === "function") {
@@ -40013,14 +40124,14 @@ function useEffectEvent(callback) {
40013
40124
  ref.current = callback;
40014
40125
  });
40015
40126
  }
40016
- return React13.useMemo(() => ((...args) => ref.current?.(...args)), []);
40127
+ return React14.useMemo(() => ((...args) => ref.current?.(...args)), []);
40017
40128
  }
40018
40129
  __name4(useEffectEvent, "useEffectEvent");
40019
40130
 
40020
40131
  // node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
40021
40132
  var __defProp7 = Object.defineProperty;
40022
40133
  var __name5 = (target, value) => __defProp7(target, "name", { value, configurable: true });
40023
- var useInsertionEffect = React14[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
40134
+ var useInsertionEffect = React15[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
40024
40135
  function useControllableState({
40025
40136
  prop,
40026
40137
  defaultProp,
@@ -40035,8 +40146,8 @@ function useControllableState({
40035
40146
  const isControlled = prop !== void 0;
40036
40147
  const value = isControlled ? prop : uncontrolledProp;
40037
40148
  if (IS_DEVELOPMENT) {
40038
- const isControlledRef = React14.useRef(prop !== void 0);
40039
- React14.useEffect(() => {
40149
+ const isControlledRef = React15.useRef(prop !== void 0);
40150
+ React15.useEffect(() => {
40040
40151
  const wasControlled = isControlledRef.current;
40041
40152
  if (wasControlled !== isControlled) {
40042
40153
  const from = wasControlled ? "controlled" : "uncontrolled";
@@ -40048,7 +40159,7 @@ function useControllableState({
40048
40159
  isControlledRef.current = isControlled;
40049
40160
  }, [isControlled, caller]);
40050
40161
  }
40051
- const setValue = React14.useCallback(
40162
+ const setValue = React15.useCallback(
40052
40163
  (nextValue) => {
40053
40164
  if (isControlled) {
40054
40165
  const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
@@ -40068,13 +40179,13 @@ function useUncontrolledState({
40068
40179
  defaultProp,
40069
40180
  onChange
40070
40181
  }) {
40071
- const [value, setValue] = React14.useState(defaultProp);
40072
- const prevValueRef = React14.useRef(value);
40073
- const onChangeRef = React14.useRef(onChange);
40182
+ const [value, setValue] = React15.useState(defaultProp);
40183
+ const prevValueRef = React15.useRef(value);
40184
+ const onChangeRef = React15.useRef(onChange);
40074
40185
  useInsertionEffect(() => {
40075
40186
  onChangeRef.current = onChange;
40076
40187
  }, [onChange]);
40077
- React14.useEffect(() => {
40188
+ React15.useEffect(() => {
40078
40189
  if (prevValueRef.current !== value) {
40079
40190
  onChangeRef.current?.(value);
40080
40191
  prevValueRef.current = value;
@@ -40150,16 +40261,16 @@ function useControllableStateReducer(reducer, userArgs, initialArg, init) {
40150
40261
  __name5(useControllableStateReducer, "useControllableStateReducer");
40151
40262
 
40152
40263
  // node_modules/@radix-ui/react-primitive/dist/index.mjs
40153
- import * as React16 from "react";
40264
+ import * as React17 from "react";
40154
40265
  import * as ReactDOM2 from "react-dom";
40155
40266
 
40156
40267
  // node_modules/@radix-ui/react-slot/dist/index.mjs
40157
- import * as React15 from "react";
40268
+ import * as React16 from "react";
40158
40269
  var __defProp8 = Object.defineProperty;
40159
40270
  var __name6 = (target, value) => __defProp8(target, "name", { value, configurable: true });
40160
40271
  // @__NO_SIDE_EFFECTS__
40161
40272
  function createSlot(ownerName) {
40162
- const Slot2 = React15.forwardRef((props, forwardedRef) => {
40273
+ const Slot2 = React16.forwardRef((props, forwardedRef) => {
40163
40274
  let { children, ...slotProps } = props;
40164
40275
  let slottableElement = null;
40165
40276
  let hasSlottable = false;
@@ -40167,7 +40278,7 @@ function createSlot(ownerName) {
40167
40278
  if (isLazyComponent(children) && typeof use === "function") {
40168
40279
  children = use(children._payload);
40169
40280
  }
40170
- React15.Children.forEach(children, (maybeSlottable) => {
40281
+ React16.Children.forEach(children, (maybeSlottable) => {
40171
40282
  if (isSlottable(maybeSlottable)) {
40172
40283
  hasSlottable = true;
40173
40284
  const slottable = maybeSlottable;
@@ -40182,13 +40293,13 @@ function createSlot(ownerName) {
40182
40293
  }
40183
40294
  });
40184
40295
  if (slottableElement) {
40185
- slottableElement = React15.cloneElement(slottableElement, void 0, newChildren);
40296
+ slottableElement = React16.cloneElement(slottableElement, void 0, newChildren);
40186
40297
  } else if (
40187
40298
  // A `Slottable` was found but it didn't resolve to a single element (e.g.
40188
40299
  // it wrapped multiple elements, text, or a render-prop `child` that
40189
40300
  // wasn't an element). Don't fall back to treating the `Slottable` wrapper
40190
40301
  // itself as the slot target — throw a descriptive error below instead.
40191
- !hasSlottable && React15.Children.count(children) === 1 && React15.isValidElement(children)
40302
+ !hasSlottable && React16.Children.count(children) === 1 && React16.isValidElement(children)
40192
40303
  ) {
40193
40304
  slottableElement = children;
40194
40305
  }
@@ -40203,10 +40314,10 @@ function createSlot(ownerName) {
40203
40314
  return children;
40204
40315
  }
40205
40316
  const mergedProps = mergeProps(slotProps, slottableElement.props ?? {});
40206
- if (slottableElement.type !== React15.Fragment) {
40317
+ if (slottableElement.type !== React16.Fragment) {
40207
40318
  mergedProps.ref = forwardedRef ? composedRef : slottableElementRef;
40208
40319
  }
40209
- return React15.cloneElement(slottableElement, mergedProps);
40320
+ return React16.cloneElement(slottableElement, mergedProps);
40210
40321
  });
40211
40322
  Slot2.displayName = `${ownerName}.Slot`;
40212
40323
  return Slot2;
@@ -40224,10 +40335,10 @@ __name6(createSlottable, "createSlottable");
40224
40335
  var getSlottableElementFromSlottable = /* @__PURE__ */ __name6((slottable, child) => {
40225
40336
  if ("child" in slottable.props) {
40226
40337
  const child2 = slottable.props.child;
40227
- if (!React15.isValidElement(child2)) return null;
40228
- return React15.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
40338
+ if (!React16.isValidElement(child2)) return null;
40339
+ return React16.cloneElement(child2, void 0, slottable.props.children(child2.props.children));
40229
40340
  }
40230
- return React15.isValidElement(child) ? child : null;
40341
+ return React16.isValidElement(child) ? child : null;
40231
40342
  }, "getSlottableElementFromSlottable");
40232
40343
  function mergeProps(slotProps, childProps) {
40233
40344
  const overrideProps = { ...childProps };
@@ -40269,7 +40380,7 @@ function getElementRef(element) {
40269
40380
  }
40270
40381
  __name6(getElementRef, "getElementRef");
40271
40382
  function isSlottable(child) {
40272
- return React15.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
40383
+ return React16.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
40273
40384
  }
40274
40385
  __name6(isSlottable, "isSlottable");
40275
40386
  var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
@@ -40287,7 +40398,7 @@ var createSlotError = /* @__PURE__ */ __name6((ownerName) => {
40287
40398
  var createSlottableError = /* @__PURE__ */ __name6((ownerName) => {
40288
40399
  return `${ownerName} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`;
40289
40400
  }, "createSlottableError");
40290
- var use = React15[" use ".trim().toString()];
40401
+ var use = React16[" use ".trim().toString()];
40291
40402
 
40292
40403
  // node_modules/@radix-ui/react-primitive/dist/index.mjs
40293
40404
  import { jsx as jsx21 } from "react/jsx-runtime";
@@ -40314,7 +40425,7 @@ var NODES = [
40314
40425
  ];
40315
40426
  var Primitive = NODES.reduce((primitive, node) => {
40316
40427
  const Slot2 = createSlot(`Primitive.${node}`);
40317
- const Node2 = React16.forwardRef((props, forwardedRef) => {
40428
+ const Node2 = React17.forwardRef((props, forwardedRef) => {
40318
40429
  const { asChild, ...primitiveProps } = props;
40319
40430
  const Comp = asChild ? Slot2 : node;
40320
40431
  if (typeof window !== "undefined") {
@@ -40331,10 +40442,10 @@ function dispatchDiscreteCustomEvent(target, event) {
40331
40442
  __name7(dispatchDiscreteCustomEvent, "dispatchDiscreteCustomEvent");
40332
40443
 
40333
40444
  // node_modules/@radix-ui/react-menu/dist/index.mjs
40334
- import * as React40 from "react";
40445
+ import * as React41 from "react";
40335
40446
 
40336
40447
  // node_modules/@radix-ui/react-collection/dist/index.mjs
40337
- import * as React17 from "react";
40448
+ import * as React18 from "react";
40338
40449
  import { jsx as jsx22 } from "react/jsx-runtime";
40339
40450
  import * as React23 from "react";
40340
40451
  import { jsx as jsx23 } from "react/jsx-runtime";
@@ -40350,14 +40461,14 @@ function createCollection(name) {
40350
40461
  );
40351
40462
  const CollectionProvider = /* @__PURE__ */ __name8((props) => {
40352
40463
  const { scope, children } = props;
40353
- const ref = React17.useRef(null);
40354
- const itemMap = React17.useRef(/* @__PURE__ */ new Map()).current;
40464
+ const ref = React18.useRef(null);
40465
+ const itemMap = React18.useRef(/* @__PURE__ */ new Map()).current;
40355
40466
  return /* @__PURE__ */ jsx22(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
40356
40467
  }, "CollectionProvider");
40357
40468
  CollectionProvider.displayName = PROVIDER_NAME;
40358
40469
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
40359
40470
  const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
40360
- const CollectionSlot = React17.forwardRef(
40471
+ const CollectionSlot = React18.forwardRef(
40361
40472
  (props, forwardedRef) => {
40362
40473
  const { scope, children } = props;
40363
40474
  const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
@@ -40369,13 +40480,13 @@ function createCollection(name) {
40369
40480
  const ITEM_SLOT_NAME = name + "CollectionItemSlot";
40370
40481
  const ITEM_DATA_ATTR = "data-radix-collection-item";
40371
40482
  const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
40372
- const CollectionItemSlot = React17.forwardRef(
40483
+ const CollectionItemSlot = React18.forwardRef(
40373
40484
  (props, forwardedRef) => {
40374
40485
  const { scope, children, ...itemData } = props;
40375
- const ref = React17.useRef(null);
40486
+ const ref = React18.useRef(null);
40376
40487
  const composedRefs = useComposedRefs(forwardedRef, ref);
40377
40488
  const context = useCollectionContext(ITEM_SLOT_NAME, scope);
40378
- React17.useEffect(() => {
40489
+ React18.useEffect(() => {
40379
40490
  context.itemMap.set(ref, { ref, ...itemData });
40380
40491
  return () => void context.itemMap.delete(ref);
40381
40492
  });
@@ -40385,7 +40496,7 @@ function createCollection(name) {
40385
40496
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
40386
40497
  function useCollection3(scope) {
40387
40498
  const context = useCollectionContext(name + "CollectionConsumer", scope);
40388
- const getItems = React17.useCallback(() => {
40499
+ const getItems = React18.useCallback(() => {
40389
40500
  const collectionNode = context.collectionRef.current;
40390
40501
  if (!collectionNode) return [];
40391
40502
  const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
@@ -40880,30 +40991,30 @@ function getChildListObserver(callback) {
40880
40991
  __name8(getChildListObserver, "getChildListObserver");
40881
40992
 
40882
40993
  // node_modules/@radix-ui/react-direction/dist/index.mjs
40883
- import * as React18 from "react";
40994
+ import * as React19 from "react";
40884
40995
  import { jsx as jsx24 } from "react/jsx-runtime";
40885
40996
  var __defProp11 = Object.defineProperty;
40886
40997
  var __name9 = (target, value) => __defProp11(target, "name", { value, configurable: true });
40887
- var DirectionContext = React18.createContext(void 0);
40998
+ var DirectionContext = React19.createContext(void 0);
40888
40999
  function useDirection(localDir) {
40889
- const globalDir = React18.useContext(DirectionContext);
41000
+ const globalDir = React19.useContext(DirectionContext);
40890
41001
  return localDir || globalDir || "ltr";
40891
41002
  }
40892
41003
  __name9(useDirection, "useDirection");
40893
41004
 
40894
41005
  // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
40895
- import * as React20 from "react";
41006
+ import * as React21 from "react";
40896
41007
 
40897
41008
  // node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
40898
- import * as React19 from "react";
41009
+ import * as React20 from "react";
40899
41010
  var __defProp12 = Object.defineProperty;
40900
41011
  var __name10 = (target, value) => __defProp12(target, "name", { value, configurable: true });
40901
41012
  function useCallbackRef(callback) {
40902
- const callbackRef = React19.useRef(callback);
40903
- React19.useEffect(() => {
41013
+ const callbackRef = React20.useRef(callback);
41014
+ React20.useEffect(() => {
40904
41015
  callbackRef.current = callback;
40905
41016
  });
40906
- return React19.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
41017
+ return React20.useMemo(() => ((...args) => callbackRef.current?.(...args)), []);
40907
41018
  }
40908
41019
  __name10(useCallbackRef, "useCallbackRef");
40909
41020
 
@@ -40915,7 +41026,7 @@ var CONTEXT_UPDATE = "dismissableLayer.update";
40915
41026
  var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
40916
41027
  var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
40917
41028
  var originalBodyPointerEvents;
40918
- var DismissableLayerContext = React20.createContext({
41029
+ var DismissableLayerContext = React21.createContext({
40919
41030
  layers: /* @__PURE__ */ new Set(),
40920
41031
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
40921
41032
  branches: /* @__PURE__ */ new Set(),
@@ -40926,7 +41037,7 @@ var DismissableLayerContext = React20.createContext({
40926
41037
  // See https://github.com/radix-ui/primitives/issues/3346
40927
41038
  dismissableSurfaces: /* @__PURE__ */ new Set()
40928
41039
  });
40929
- var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
41040
+ var DismissableLayer = /* @__PURE__ */ React21.forwardRef(
40930
41041
  // blank line to reduce diff noise
40931
41042
  /* @__PURE__ */ __name11(function DismissableLayer2(props, forwardedRef) {
40932
41043
  const {
@@ -40939,10 +41050,10 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
40939
41050
  onDismiss,
40940
41051
  ...layerProps
40941
41052
  } = props;
40942
- const context = React20.useContext(DismissableLayerContext);
40943
- const [node, setNode] = React20.useState(null);
41053
+ const context = React21.useContext(DismissableLayerContext);
41054
+ const [node, setNode] = React21.useState(null);
40944
41055
  const ownerDocument = node?.ownerDocument ?? globalThis?.document;
40945
- const [, force] = React20.useState({});
41056
+ const [, force] = React21.useState({});
40946
41057
  const composedRefs = useComposedRefs(forwardedRef, setNode);
40947
41058
  const layers = Array.from(context.layers);
40948
41059
  const [highestLayerWithOutsidePointerEventsDisabled] = [
@@ -40952,7 +41063,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
40952
41063
  const index2 = node ? layers.indexOf(node) : -1;
40953
41064
  const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
40954
41065
  const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
40955
- const isDeferredPointerDownOutsideRef = React20.useRef(false);
41066
+ const isDeferredPointerDownOutsideRef = React21.useRef(false);
40956
41067
  const pointerDownOutside = usePointerDownOutside(
40957
41068
  (event) => {
40958
41069
  onPointerDownOutside?.(event);
@@ -40964,7 +41075,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
40964
41075
  deferPointerDownOutside,
40965
41076
  isDeferredPointerDownOutsideRef,
40966
41077
  dismissableSurfaces: context.dismissableSurfaces,
40967
- shouldHandlePointerDownOutside: React20.useCallback(
41078
+ shouldHandlePointerDownOutside: React21.useCallback(
40968
41079
  (target) => {
40969
41080
  if (!(target instanceof Node)) {
40970
41081
  return false;
@@ -41000,14 +41111,14 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
41000
41111
  onDismiss();
41001
41112
  }
41002
41113
  });
41003
- React20.useEffect(() => {
41114
+ React21.useEffect(() => {
41004
41115
  if (!isHighestLayer) {
41005
41116
  return;
41006
41117
  }
41007
41118
  ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
41008
41119
  return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
41009
41120
  }, [ownerDocument, isHighestLayer, handleKeyDown]);
41010
- React20.useEffect(() => {
41121
+ React21.useEffect(() => {
41011
41122
  if (!node) return;
41012
41123
  if (disableOutsidePointerEvents) {
41013
41124
  if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
@@ -41027,7 +41138,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
41027
41138
  }
41028
41139
  };
41029
41140
  }, [node, ownerDocument, disableOutsidePointerEvents, context]);
41030
- React20.useEffect(() => {
41141
+ React21.useEffect(() => {
41031
41142
  return () => {
41032
41143
  if (!node) return;
41033
41144
  context.layers.delete(node);
@@ -41035,7 +41146,7 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
41035
41146
  dispatchUpdate();
41036
41147
  };
41037
41148
  }, [node, context]);
41038
- React20.useEffect(() => {
41149
+ React21.useEffect(() => {
41039
41150
  const handleUpdate = /* @__PURE__ */ __name11(() => force({}), "handleUpdate");
41040
41151
  document.addEventListener(CONTEXT_UPDATE, handleUpdate);
41041
41152
  return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
@@ -41060,9 +41171,9 @@ var DismissableLayer = /* @__PURE__ */ React20.forwardRef(
41060
41171
  }, "DismissableLayer")
41061
41172
  );
41062
41173
  function useDismissableLayerSurface() {
41063
- const context = React20.useContext(DismissableLayerContext);
41064
- const [node, setNode] = React20.useState(null);
41065
- React20.useEffect(() => {
41174
+ const context = React21.useContext(DismissableLayerContext);
41175
+ const [node, setNode] = React21.useState(null);
41176
+ React21.useEffect(() => {
41066
41177
  if (!node) {
41067
41178
  return;
41068
41179
  }
@@ -41084,12 +41195,12 @@ function usePointerDownOutside(onPointerDownOutside, args) {
41084
41195
  shouldHandlePointerDownOutside = IS_TRUE
41085
41196
  } = args;
41086
41197
  const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
41087
- const isPointerInsideReactTreeRef = React20.useRef(false);
41088
- const isPointerDownOutsideRef = React20.useRef(false);
41089
- const interceptedOutsideInteractionEventsRef = React20.useRef(/* @__PURE__ */ new Map());
41090
- const handleClickRef = React20.useRef(() => {
41198
+ const isPointerInsideReactTreeRef = React21.useRef(false);
41199
+ const isPointerDownOutsideRef = React21.useRef(false);
41200
+ const interceptedOutsideInteractionEventsRef = React21.useRef(/* @__PURE__ */ new Map());
41201
+ const handleClickRef = React21.useRef(() => {
41091
41202
  });
41092
- React20.useEffect(() => {
41203
+ React21.useEffect(() => {
41093
41204
  function resetOutsideInteraction() {
41094
41205
  isPointerDownOutsideRef.current = false;
41095
41206
  isDeferredPointerDownOutsideRef.current = false;
@@ -41204,8 +41315,8 @@ function usePointerDownOutside(onPointerDownOutside, args) {
41204
41315
  __name11(usePointerDownOutside, "usePointerDownOutside");
41205
41316
  function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
41206
41317
  const handleFocusOutside = useCallbackRef(onFocusOutside);
41207
- const isFocusInsideReactTreeRef = React20.useRef(false);
41208
- React20.useEffect(() => {
41318
+ const isFocusInsideReactTreeRef = React21.useRef(false);
41319
+ React21.useEffect(() => {
41209
41320
  const handleFocus = /* @__PURE__ */ __name11((event) => {
41210
41321
  if (event.target && !isFocusInsideReactTreeRef.current) {
41211
41322
  const eventDetail = { originalEvent: event };
@@ -41241,7 +41352,7 @@ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
41241
41352
  __name11(handleAndDispatchCustomEvent, "handleAndDispatchCustomEvent");
41242
41353
 
41243
41354
  // node_modules/@radix-ui/react-focus-guards/dist/index.mjs
41244
- import * as React21 from "react";
41355
+ import * as React24 from "react";
41245
41356
  var __defProp14 = Object.defineProperty;
41246
41357
  var __name12 = (target, value) => __defProp14(target, "name", { value, configurable: true });
41247
41358
  var count = 0;
@@ -41252,7 +41363,7 @@ function FocusGuards(props) {
41252
41363
  }
41253
41364
  __name12(FocusGuards, "FocusGuards");
41254
41365
  function useFocusGuards() {
41255
- React21.useEffect(() => {
41366
+ React24.useEffect(() => {
41256
41367
  if (!guards) {
41257
41368
  guards = { start: createFocusGuard(), end: createFocusGuard() };
41258
41369
  }
@@ -41288,14 +41399,14 @@ function createFocusGuard() {
41288
41399
  __name12(createFocusGuard, "createFocusGuard");
41289
41400
 
41290
41401
  // node_modules/@radix-ui/react-focus-scope/dist/index.mjs
41291
- import * as React24 from "react";
41402
+ import * as React25 from "react";
41292
41403
  import { jsx as jsx26 } from "react/jsx-runtime";
41293
41404
  var __defProp15 = Object.defineProperty;
41294
41405
  var __name13 = (target, value) => __defProp15(target, "name", { value, configurable: true });
41295
41406
  var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
41296
41407
  var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
41297
41408
  var EVENT_OPTIONS = { bubbles: false, cancelable: true };
41298
- var FocusScope = /* @__PURE__ */ React24.forwardRef(
41409
+ var FocusScope = /* @__PURE__ */ React25.forwardRef(
41299
41410
  /* @__PURE__ */ __name13(function FocusScope2(props, forwardedRef) {
41300
41411
  const {
41301
41412
  loop = false,
@@ -41304,12 +41415,12 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
41304
41415
  onUnmountAutoFocus: onUnmountAutoFocusProp,
41305
41416
  ...scopeProps
41306
41417
  } = props;
41307
- const [container, setContainer] = React24.useState(null);
41418
+ const [container, setContainer] = React25.useState(null);
41308
41419
  const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
41309
41420
  const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
41310
- const lastFocusedElementRef = React24.useRef(null);
41421
+ const lastFocusedElementRef = React25.useRef(null);
41311
41422
  const composedRefs = useComposedRefs(forwardedRef, setContainer);
41312
- const focusScope = React24.useRef({
41423
+ const focusScope = React25.useRef({
41313
41424
  paused: false,
41314
41425
  pause() {
41315
41426
  this.paused = true;
@@ -41318,7 +41429,7 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
41318
41429
  this.paused = false;
41319
41430
  }
41320
41431
  }).current;
41321
- React24.useEffect(() => {
41432
+ React25.useEffect(() => {
41322
41433
  if (trapped) {
41323
41434
  let handleFocusIn2 = function(event) {
41324
41435
  if (focusScope.paused || !container) return;
@@ -41357,7 +41468,7 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
41357
41468
  };
41358
41469
  }
41359
41470
  }, [trapped, container, focusScope.paused]);
41360
- React24.useEffect(() => {
41471
+ React25.useEffect(() => {
41361
41472
  if (container) {
41362
41473
  focusScopesStack.add(focusScope);
41363
41474
  const previouslyFocusedElement = document.activeElement;
@@ -41388,7 +41499,7 @@ var FocusScope = /* @__PURE__ */ React24.forwardRef(
41388
41499
  };
41389
41500
  }
41390
41501
  }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
41391
- const handleKeyDown = React24.useCallback(
41502
+ const handleKeyDown = React25.useCallback(
41392
41503
  (event) => {
41393
41504
  if (!loop && !trapped) return;
41394
41505
  if (focusScope.paused) return;
@@ -41511,13 +41622,13 @@ function removeLinks(items) {
41511
41622
  __name13(removeLinks, "removeLinks");
41512
41623
 
41513
41624
  // node_modules/@radix-ui/react-id/dist/index.mjs
41514
- import * as React25 from "react";
41625
+ import * as React26 from "react";
41515
41626
  var __defProp16 = Object.defineProperty;
41516
41627
  var __name14 = (target, value) => __defProp16(target, "name", { value, configurable: true });
41517
- var useReactId = React25[" useId ".trim().toString()] || (() => void 0);
41628
+ var useReactId = React26[" useId ".trim().toString()] || (() => void 0);
41518
41629
  var count2 = 0;
41519
41630
  function useId(deterministicId) {
41520
- const [id, setId] = React25.useState(useReactId());
41631
+ const [id, setId] = React26.useState(useReactId());
41521
41632
  useLayoutEffect2(() => {
41522
41633
  if (!deterministicId) setId((reactId) => reactId ?? String(count2++));
41523
41634
  }, [deterministicId]);
@@ -41526,7 +41637,7 @@ function useId(deterministicId) {
41526
41637
  __name14(useId, "useId");
41527
41638
 
41528
41639
  // node_modules/@radix-ui/react-popper/dist/index.mjs
41529
- import * as React28 from "react";
41640
+ import * as React29 from "react";
41530
41641
 
41531
41642
  // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
41532
41643
  var sides = ["top", "right", "bottom", "left"];
@@ -43121,7 +43232,7 @@ var computePosition2 = (reference, floating, options) => {
43121
43232
  };
43122
43233
 
43123
43234
  // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs
43124
- import * as React26 from "react";
43235
+ import * as React27 from "react";
43125
43236
  import { useLayoutEffect as useLayoutEffect3 } from "react";
43126
43237
  import * as ReactDOM3 from "react-dom";
43127
43238
  var isClient = typeof document !== "undefined";
@@ -43187,7 +43298,7 @@ function roundByDPR(element, value) {
43187
43298
  return Math.round(value * dpr) / dpr;
43188
43299
  }
43189
43300
  function useLatestRef(value) {
43190
- const ref = React26.useRef(value);
43301
+ const ref = React27.useRef(value);
43191
43302
  index(() => {
43192
43303
  ref.current = value;
43193
43304
  });
@@ -43210,7 +43321,7 @@ function useFloating(options) {
43210
43321
  whileElementsMounted,
43211
43322
  open
43212
43323
  } = options;
43213
- const [data, setData] = React26.useState({
43324
+ const [data, setData] = React27.useState({
43214
43325
  x: 0,
43215
43326
  y: 0,
43216
43327
  strategy,
@@ -43218,19 +43329,19 @@ function useFloating(options) {
43218
43329
  middlewareData: {},
43219
43330
  isPositioned: false
43220
43331
  });
43221
- const [latestMiddleware, setLatestMiddleware] = React26.useState(middleware);
43332
+ const [latestMiddleware, setLatestMiddleware] = React27.useState(middleware);
43222
43333
  if (!deepEqual(latestMiddleware, middleware)) {
43223
43334
  setLatestMiddleware(middleware);
43224
43335
  }
43225
- const [_reference, _setReference] = React26.useState(null);
43226
- const [_floating, _setFloating] = React26.useState(null);
43227
- const setReference = React26.useCallback((node) => {
43336
+ const [_reference, _setReference] = React27.useState(null);
43337
+ const [_floating, _setFloating] = React27.useState(null);
43338
+ const setReference = React27.useCallback((node) => {
43228
43339
  if (node !== referenceRef.current) {
43229
43340
  referenceRef.current = node;
43230
43341
  _setReference(node);
43231
43342
  }
43232
43343
  }, []);
43233
- const setFloating = React26.useCallback((node) => {
43344
+ const setFloating = React27.useCallback((node) => {
43234
43345
  if (node !== floatingRef.current) {
43235
43346
  floatingRef.current = node;
43236
43347
  _setFloating(node);
@@ -43238,14 +43349,14 @@ function useFloating(options) {
43238
43349
  }, []);
43239
43350
  const referenceEl = externalReference || _reference;
43240
43351
  const floatingEl = externalFloating || _floating;
43241
- const referenceRef = React26.useRef(null);
43242
- const floatingRef = React26.useRef(null);
43243
- const dataRef = React26.useRef(data);
43352
+ const referenceRef = React27.useRef(null);
43353
+ const floatingRef = React27.useRef(null);
43354
+ const dataRef = React27.useRef(data);
43244
43355
  const hasWhileElementsMounted = whileElementsMounted != null;
43245
43356
  const whileElementsMountedRef = useLatestRef(whileElementsMounted);
43246
43357
  const platformRef = useLatestRef(platform2);
43247
43358
  const openRef = useLatestRef(open);
43248
- const update = React26.useCallback(() => {
43359
+ const update = React27.useCallback(() => {
43249
43360
  if (!referenceRef.current || !floatingRef.current) {
43250
43361
  return;
43251
43362
  }
@@ -43283,7 +43394,7 @@ function useFloating(options) {
43283
43394
  }));
43284
43395
  }
43285
43396
  }, [open]);
43286
- const isMountedRef = React26.useRef(false);
43397
+ const isMountedRef = React27.useRef(false);
43287
43398
  index(() => {
43288
43399
  isMountedRef.current = true;
43289
43400
  return () => {
@@ -43300,17 +43411,17 @@ function useFloating(options) {
43300
43411
  update();
43301
43412
  }
43302
43413
  }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
43303
- const refs = React26.useMemo(() => ({
43414
+ const refs = React27.useMemo(() => ({
43304
43415
  reference: referenceRef,
43305
43416
  floating: floatingRef,
43306
43417
  setReference,
43307
43418
  setFloating
43308
43419
  }), [setReference, setFloating]);
43309
- const elements = React26.useMemo(() => ({
43420
+ const elements = React27.useMemo(() => ({
43310
43421
  reference: referenceEl,
43311
43422
  floating: floatingEl
43312
43423
  }), [referenceEl, floatingEl]);
43313
- const floatingStyles = React26.useMemo(() => {
43424
+ const floatingStyles = React27.useMemo(() => {
43314
43425
  const initialStyles = {
43315
43426
  position: strategy,
43316
43427
  left: 0,
@@ -43336,7 +43447,7 @@ function useFloating(options) {
43336
43447
  top: y
43337
43448
  };
43338
43449
  }, [strategy, transform, elements.floating, data.x, data.y]);
43339
- return React26.useMemo(() => ({
43450
+ return React27.useMemo(() => ({
43340
43451
  ...data,
43341
43452
  update,
43342
43453
  refs,
@@ -43432,11 +43543,11 @@ var arrow3 = (options, deps) => {
43432
43543
  };
43433
43544
 
43434
43545
  // node_modules/@radix-ui/react-use-size/dist/index.mjs
43435
- import * as React27 from "react";
43546
+ import * as React28 from "react";
43436
43547
  var __defProp17 = Object.defineProperty;
43437
43548
  var __name15 = (target, value) => __defProp17(target, "name", { value, configurable: true });
43438
43549
  function useSize(element) {
43439
- const [size4, setSize] = React27.useState(void 0);
43550
+ const [size4, setSize] = React28.useState(void 0);
43440
43551
  useLayoutEffect2(() => {
43441
43552
  if (element) {
43442
43553
  setSize({ width: element.offsetWidth, height: element.offsetHeight });
@@ -43480,8 +43591,8 @@ var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
43480
43591
  var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
43481
43592
  var Popper = /* @__PURE__ */ __name16((props) => {
43482
43593
  const { __scopePopper, children } = props;
43483
- const [anchor, setAnchor] = React28.useState(null);
43484
- const [placementState, setPlacementState] = React28.useState(void 0);
43594
+ const [anchor, setAnchor] = React29.useState(null);
43595
+ const [placementState, setPlacementState] = React29.useState(void 0);
43485
43596
  return /* @__PURE__ */ jsx27(
43486
43597
  PopperProvider,
43487
43598
  {
@@ -43495,13 +43606,13 @@ var Popper = /* @__PURE__ */ __name16((props) => {
43495
43606
  );
43496
43607
  }, "Popper");
43497
43608
  var ANCHOR_NAME = "PopperAnchor";
43498
- var PopperAnchor = /* @__PURE__ */ React28.forwardRef(
43609
+ var PopperAnchor = /* @__PURE__ */ React29.forwardRef(
43499
43610
  /* @__PURE__ */ __name16(function PopperAnchor2(props, forwardedRef) {
43500
43611
  const { __scopePopper, virtualRef, ...anchorProps } = props;
43501
43612
  const context = usePopperContext(ANCHOR_NAME, __scopePopper);
43502
- const ref = React28.useRef(null);
43613
+ const ref = React29.useRef(null);
43503
43614
  const onAnchorChange = context.onAnchorChange;
43504
- const callbackRef = React28.useCallback(
43615
+ const callbackRef = React29.useCallback(
43505
43616
  (node) => {
43506
43617
  ref.current = node;
43507
43618
  if (node) {
@@ -43511,8 +43622,8 @@ var PopperAnchor = /* @__PURE__ */ React28.forwardRef(
43511
43622
  [onAnchorChange]
43512
43623
  );
43513
43624
  const composedRefs = useComposedRefs(forwardedRef, callbackRef);
43514
- const anchorRef = React28.useRef(null);
43515
- React28.useEffect(() => {
43625
+ const anchorRef = React29.useRef(null);
43626
+ React29.useEffect(() => {
43516
43627
  if (!virtualRef) {
43517
43628
  return;
43518
43629
  }
@@ -43538,7 +43649,7 @@ var PopperAnchor = /* @__PURE__ */ React28.forwardRef(
43538
43649
  );
43539
43650
  var CONTENT_NAME = "PopperContent";
43540
43651
  var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
43541
- var PopperContent = /* @__PURE__ */ React28.forwardRef(
43652
+ var PopperContent = /* @__PURE__ */ React29.forwardRef(
43542
43653
  /* @__PURE__ */ __name16(function PopperContent2(props, forwardedRef) {
43543
43654
  const {
43544
43655
  __scopePopper,
@@ -43557,9 +43668,9 @@ var PopperContent = /* @__PURE__ */ React28.forwardRef(
43557
43668
  ...contentProps
43558
43669
  } = props;
43559
43670
  const context = usePopperContext(CONTENT_NAME, __scopePopper);
43560
- const [content, setContent] = React28.useState(null);
43671
+ const [content, setContent] = React29.useState(null);
43561
43672
  const composedRefs = useComposedRefs(forwardedRef, setContent);
43562
- const [arrow4, setArrow] = React28.useState(null);
43673
+ const [arrow4, setArrow] = React29.useState(null);
43563
43674
  const arrowSize = useSize(arrow4);
43564
43675
  const arrowWidth = arrowSize?.width ?? 0;
43565
43676
  const arrowHeight = arrowSize?.height ?? 0;
@@ -43639,7 +43750,7 @@ var PopperContent = /* @__PURE__ */ React28.forwardRef(
43639
43750
  const arrowX = middlewareData.arrow?.x;
43640
43751
  const arrowY = middlewareData.arrow?.y;
43641
43752
  const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
43642
- const [contentZIndex, setContentZIndex] = React28.useState();
43753
+ const [contentZIndex, setContentZIndex] = React29.useState();
43643
43754
  useLayoutEffect2(() => {
43644
43755
  if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
43645
43756
  }, [content]);
@@ -43744,15 +43855,15 @@ var Anchor = PopperAnchor;
43744
43855
  var Content = PopperContent;
43745
43856
 
43746
43857
  // node_modules/@radix-ui/react-portal/dist/index.mjs
43747
- import * as React29 from "react";
43858
+ import * as React30 from "react";
43748
43859
  import * as ReactDOM4 from "react-dom";
43749
43860
  import { jsx as jsx28 } from "react/jsx-runtime";
43750
43861
  var __defProp19 = Object.defineProperty;
43751
43862
  var __name17 = (target, value) => __defProp19(target, "name", { value, configurable: true });
43752
- var Portal = /* @__PURE__ */ React29.forwardRef(
43863
+ var Portal = /* @__PURE__ */ React30.forwardRef(
43753
43864
  /* @__PURE__ */ __name17(function Portal2(props, forwardedRef) {
43754
43865
  const { container: containerProp, ...portalProps } = props;
43755
- const [mounted, setMounted] = React29.useState(false);
43866
+ const [mounted, setMounted] = React30.useState(false);
43756
43867
  useLayoutEffect2(() => setMounted(true), []);
43757
43868
  const container = containerProp || mounted && globalThis?.document?.body;
43758
43869
  return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx28(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
@@ -43761,11 +43872,11 @@ var Portal = /* @__PURE__ */ React29.forwardRef(
43761
43872
 
43762
43873
  // node_modules/@radix-ui/react-presence/dist/index.mjs
43763
43874
  import * as React210 from "react";
43764
- import * as React30 from "react";
43875
+ import * as React31 from "react";
43765
43876
  var __defProp20 = Object.defineProperty;
43766
43877
  var __name18 = (target, value) => __defProp20(target, "name", { value, configurable: true });
43767
43878
  function useStateMachine(initialState, machine) {
43768
- return React30.useReducer((state, event) => {
43879
+ return React31.useReducer((state, event) => {
43769
43880
  const nextState = machine[state][event];
43770
43881
  return nextState ?? state;
43771
43882
  }, initialState);
@@ -43939,17 +44050,17 @@ function getElementRef2(element) {
43939
44050
  __name18(getElementRef2, "getElementRef");
43940
44051
 
43941
44052
  // node_modules/@radix-ui/react-roving-focus/dist/index.mjs
43942
- import * as React32 from "react";
44053
+ import * as React33 from "react";
43943
44054
 
43944
44055
  // node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs
43945
44056
  import * as React211 from "react";
43946
- import * as React31 from "react";
44057
+ import * as React32 from "react";
43947
44058
  var __defProp21 = Object.defineProperty;
43948
44059
  var __name19 = (target, value) => __defProp21(target, "name", { value, configurable: true });
43949
44060
  var _isHydrated = false;
43950
44061
  function useIsHydrated() {
43951
- const [isHydrated, setIsHydrated] = React31.useState(_isHydrated);
43952
- React31.useEffect(() => {
44062
+ const [isHydrated, setIsHydrated] = React32.useState(_isHydrated);
44063
+ React32.useEffect(() => {
43953
44064
  if (!_isHydrated) {
43954
44065
  _isHydrated = true;
43955
44066
  setIsHydrated(true);
@@ -43987,13 +44098,13 @@ var [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContext
43987
44098
  [createCollectionScope]
43988
44099
  );
43989
44100
  var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME);
43990
- var RovingFocusGroup = /* @__PURE__ */ React32.forwardRef(
44101
+ var RovingFocusGroup = /* @__PURE__ */ React33.forwardRef(
43991
44102
  // blank line to reduce diff noise
43992
44103
  /* @__PURE__ */ __name20(function RovingFocusGroup2(props, forwardedRef) {
43993
44104
  return /* @__PURE__ */ jsx29(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx29(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx29(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
43994
44105
  }, "RovingFocusGroup")
43995
44106
  );
43996
- var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __name20(function RovingFocusGroupImpl2(props, forwardedRef) {
44107
+ var RovingFocusGroupImpl = /* @__PURE__ */ React33.forwardRef(/* @__PURE__ */ __name20(function RovingFocusGroupImpl2(props, forwardedRef) {
43997
44108
  const {
43998
44109
  __scopeRovingFocusGroup,
43999
44110
  orientation: orientation2,
@@ -44006,7 +44117,7 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
44006
44117
  preventScrollOnEntryFocus = false,
44007
44118
  ...groupProps
44008
44119
  } = props;
44009
- const ref = React32.useRef(null);
44120
+ const ref = React33.useRef(null);
44010
44121
  const composedRefs = useComposedRefs(forwardedRef, ref);
44011
44122
  const direction = useDirection(dir);
44012
44123
  const [currentTabStopId, setCurrentTabStopId] = useControllableState({
@@ -44015,12 +44126,12 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
44015
44126
  onChange: onCurrentTabStopIdChange,
44016
44127
  caller: GROUP_NAME
44017
44128
  });
44018
- const [isTabbingBackOut, setIsTabbingBackOut] = React32.useState(false);
44129
+ const [isTabbingBackOut, setIsTabbingBackOut] = React33.useState(false);
44019
44130
  const handleEntryFocus = useCallbackRef(onEntryFocus);
44020
44131
  const getItems = useCollection(__scopeRovingFocusGroup);
44021
- const isClickFocusRef = React32.useRef(false);
44022
- const [focusableItemsCount, setFocusableItemsCount] = React32.useState(0);
44023
- React32.useEffect(() => {
44132
+ const isClickFocusRef = React33.useRef(false);
44133
+ const [focusableItemsCount, setFocusableItemsCount] = React33.useState(0);
44134
+ React33.useEffect(() => {
44024
44135
  const node = ref.current;
44025
44136
  if (node) {
44026
44137
  node.addEventListener(ENTRY_FOCUS, handleEntryFocus);
@@ -44035,16 +44146,16 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
44035
44146
  dir: direction,
44036
44147
  loop,
44037
44148
  currentTabStopId,
44038
- onItemFocus: React32.useCallback(
44149
+ onItemFocus: React33.useCallback(
44039
44150
  (tabStopId) => setCurrentTabStopId(tabStopId),
44040
44151
  [setCurrentTabStopId]
44041
44152
  ),
44042
- onItemShiftTab: React32.useCallback(() => setIsTabbingBackOut(true), []),
44043
- onFocusableItemAdd: React32.useCallback(
44153
+ onItemShiftTab: React33.useCallback(() => setIsTabbingBackOut(true), []),
44154
+ onFocusableItemAdd: React33.useCallback(
44044
44155
  () => setFocusableItemsCount((prevCount) => prevCount + 1),
44045
44156
  []
44046
44157
  ),
44047
- onFocusableItemRemove: React32.useCallback(
44158
+ onFocusableItemRemove: React33.useCallback(
44048
44159
  () => setFocusableItemsCount((prevCount) => prevCount - 1),
44049
44160
  []
44050
44161
  ),
@@ -44084,7 +44195,7 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React32.forwardRef(/* @__PURE__ */ __
44084
44195
  );
44085
44196
  }, "RovingFocusGroupImpl"));
44086
44197
  var ITEM_NAME = "RovingFocusGroupItem";
44087
- var RovingFocusGroupItem = /* @__PURE__ */ React32.forwardRef(
44198
+ var RovingFocusGroupItem = /* @__PURE__ */ React33.forwardRef(
44088
44199
  // blank line to reduce diff noise
44089
44200
  /* @__PURE__ */ __name20(function RovingFocusGroupItem2(props, forwardedRef) {
44090
44201
  const {
@@ -44109,7 +44220,7 @@ var RovingFocusGroupItem = /* @__PURE__ */ React32.forwardRef(
44109
44220
  onFocusableItemAdd();
44110
44221
  return () => onFocusableItemRemove();
44111
44222
  }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
44112
- React32.useEffect(() => {
44223
+ React33.useEffect(() => {
44113
44224
  if (isHydrated || !focusable) {
44114
44225
  return;
44115
44226
  }
@@ -44355,10 +44466,10 @@ function __spreadArray(to, from, pack) {
44355
44466
  }
44356
44467
 
44357
44468
  // node_modules/react-remove-scroll/dist/es2015/Combination.js
44358
- import * as React39 from "react";
44469
+ import * as React40 from "react";
44359
44470
 
44360
44471
  // node_modules/react-remove-scroll/dist/es2015/UI.js
44361
- import * as React35 from "react";
44472
+ import * as React36 from "react";
44362
44473
 
44363
44474
  // node_modules/react-remove-scroll-bar/dist/es2015/constants.js
44364
44475
  var zeroRightClassName = "right-scroll-bar-position";
@@ -44405,8 +44516,8 @@ function useCallbackRef2(initialValue, callback) {
44405
44516
  }
44406
44517
 
44407
44518
  // node_modules/use-callback-ref/dist/es2015/useMergeRef.js
44408
- import * as React33 from "react";
44409
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React33.useLayoutEffect : React33.useEffect;
44519
+ import * as React34 from "react";
44520
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React34.useLayoutEffect : React34.useEffect;
44410
44521
  var currentValues = /* @__PURE__ */ new WeakMap();
44411
44522
  function useMergeRefs(refs, defaultValue) {
44412
44523
  var callbackRef = useCallbackRef2(defaultValue || null, function(newValue) {
@@ -44523,7 +44634,7 @@ function createSidecarMedium(options) {
44523
44634
  }
44524
44635
 
44525
44636
  // node_modules/use-sidecar/dist/es2015/exports.js
44526
- import * as React34 from "react";
44637
+ import * as React35 from "react";
44527
44638
  var SideCar = function(_a) {
44528
44639
  var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
44529
44640
  if (!sideCar) {
@@ -44533,7 +44644,7 @@ var SideCar = function(_a) {
44533
44644
  if (!Target) {
44534
44645
  throw new Error("Sidecar medium not found");
44535
44646
  }
44536
- return React34.createElement(Target, __assign({}, rest));
44647
+ return React35.createElement(Target, __assign({}, rest));
44537
44648
  };
44538
44649
  SideCar.isSideCarExport = true;
44539
44650
  function exportSidecar(medium, exported) {
@@ -44548,9 +44659,9 @@ var effectCar = createSidecarMedium();
44548
44659
  var nothing = function() {
44549
44660
  return;
44550
44661
  };
44551
- var RemoveScroll = React35.forwardRef(function(props, parentRef) {
44552
- var ref = React35.useRef(null);
44553
- var _a = React35.useState({
44662
+ var RemoveScroll = React36.forwardRef(function(props, parentRef) {
44663
+ var ref = React36.useRef(null);
44664
+ var _a = React36.useState({
44554
44665
  onScrollCapture: nothing,
44555
44666
  onWheelCapture: nothing,
44556
44667
  onTouchMoveCapture: nothing
@@ -44559,11 +44670,11 @@ var RemoveScroll = React35.forwardRef(function(props, parentRef) {
44559
44670
  var SideCar2 = sideCar;
44560
44671
  var containerRef = useMergeRefs([ref, parentRef]);
44561
44672
  var containerProps = __assign(__assign({}, rest), callbacks);
44562
- return React35.createElement(
44563
- React35.Fragment,
44673
+ return React36.createElement(
44674
+ React36.Fragment,
44564
44675
  null,
44565
- enabled && React35.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
44566
- forwardProps ? React35.cloneElement(React35.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React35.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
44676
+ enabled && React36.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
44677
+ forwardProps ? React36.cloneElement(React36.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React36.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
44567
44678
  );
44568
44679
  });
44569
44680
  RemoveScroll.defaultProps = {
@@ -44577,13 +44688,13 @@ RemoveScroll.classNames = {
44577
44688
  };
44578
44689
 
44579
44690
  // node_modules/react-remove-scroll/dist/es2015/SideEffect.js
44580
- import * as React38 from "react";
44691
+ import * as React39 from "react";
44581
44692
 
44582
44693
  // node_modules/react-remove-scroll-bar/dist/es2015/component.js
44583
- import * as React37 from "react";
44694
+ import * as React38 from "react";
44584
44695
 
44585
44696
  // node_modules/react-style-singleton/dist/es2015/hook.js
44586
- import * as React36 from "react";
44697
+ import * as React37 from "react";
44587
44698
 
44588
44699
  // node_modules/get-nonce/dist/es2015/index.js
44589
44700
  var currentNonce;
@@ -44647,7 +44758,7 @@ var stylesheetSingleton = function() {
44647
44758
  var styleHookSingleton = function() {
44648
44759
  var sheet = stylesheetSingleton();
44649
44760
  return function(styles, isDynamic) {
44650
- React36.useEffect(function() {
44761
+ React37.useEffect(function() {
44651
44762
  sheet.add(styles);
44652
44763
  return function() {
44653
44764
  sheet.remove();
@@ -44721,7 +44832,7 @@ var getCurrentUseCounter = function() {
44721
44832
  return isFinite(counter) ? counter : 0;
44722
44833
  };
44723
44834
  var useLockAttribute = function() {
44724
- React37.useEffect(function() {
44835
+ React38.useEffect(function() {
44725
44836
  document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
44726
44837
  return function() {
44727
44838
  var newCounter = getCurrentUseCounter() - 1;
@@ -44736,10 +44847,10 @@ var useLockAttribute = function() {
44736
44847
  var RemoveScrollBar = function(_a) {
44737
44848
  var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
44738
44849
  useLockAttribute();
44739
- var gap = React37.useMemo(function() {
44850
+ var gap = React38.useMemo(function() {
44740
44851
  return getGapWidth(gapMode);
44741
44852
  }, [gapMode]);
44742
- return React37.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
44853
+ return React38.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
44743
44854
  };
44744
44855
 
44745
44856
  // node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
@@ -44880,16 +44991,16 @@ var generateStyle = function(id) {
44880
44991
  var idCounter = 0;
44881
44992
  var lockStack = [];
44882
44993
  function RemoveScrollSideCar(props) {
44883
- var shouldPreventQueue = React38.useRef([]);
44884
- var touchStartRef = React38.useRef([0, 0]);
44885
- var activeAxis = React38.useRef();
44886
- var id = React38.useState(idCounter++)[0];
44887
- var Style2 = React38.useState(styleSingleton)[0];
44888
- var lastProps = React38.useRef(props);
44889
- React38.useEffect(function() {
44994
+ var shouldPreventQueue = React39.useRef([]);
44995
+ var touchStartRef = React39.useRef([0, 0]);
44996
+ var activeAxis = React39.useRef();
44997
+ var id = React39.useState(idCounter++)[0];
44998
+ var Style2 = React39.useState(styleSingleton)[0];
44999
+ var lastProps = React39.useRef(props);
45000
+ React39.useEffect(function() {
44890
45001
  lastProps.current = props;
44891
45002
  }, [props]);
44892
- React38.useEffect(function() {
45003
+ React39.useEffect(function() {
44893
45004
  if (props.inert) {
44894
45005
  document.body.classList.add("block-interactivity-".concat(id));
44895
45006
  var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
@@ -44905,7 +45016,7 @@ function RemoveScrollSideCar(props) {
44905
45016
  }
44906
45017
  return;
44907
45018
  }, [props.inert, props.lockRef.current, props.shards]);
44908
- var shouldCancelEvent = React38.useCallback(function(event, parent) {
45019
+ var shouldCancelEvent = React39.useCallback(function(event, parent) {
44909
45020
  if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
44910
45021
  return !lastProps.current.allowPinchZoom;
44911
45022
  }
@@ -44947,7 +45058,7 @@ function RemoveScrollSideCar(props) {
44947
45058
  var cancelingAxis = activeAxis.current || currentAxis;
44948
45059
  return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
44949
45060
  }, []);
44950
- var shouldPrevent = React38.useCallback(function(_event) {
45061
+ var shouldPrevent = React39.useCallback(function(_event) {
44951
45062
  var event = _event;
44952
45063
  if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
44953
45064
  return;
@@ -44974,7 +45085,7 @@ function RemoveScrollSideCar(props) {
44974
45085
  }
44975
45086
  }
44976
45087
  }, []);
44977
- var shouldCancel = React38.useCallback(function(name, delta, target, should) {
45088
+ var shouldCancel = React39.useCallback(function(name, delta, target, should) {
44978
45089
  var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
44979
45090
  shouldPreventQueue.current.push(event);
44980
45091
  setTimeout(function() {
@@ -44983,17 +45094,17 @@ function RemoveScrollSideCar(props) {
44983
45094
  });
44984
45095
  }, 1);
44985
45096
  }, []);
44986
- var scrollTouchStart = React38.useCallback(function(event) {
45097
+ var scrollTouchStart = React39.useCallback(function(event) {
44987
45098
  touchStartRef.current = getTouchXY(event);
44988
45099
  activeAxis.current = void 0;
44989
45100
  }, []);
44990
- var scrollWheel = React38.useCallback(function(event) {
45101
+ var scrollWheel = React39.useCallback(function(event) {
44991
45102
  shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
44992
45103
  }, []);
44993
- var scrollTouchMove = React38.useCallback(function(event) {
45104
+ var scrollTouchMove = React39.useCallback(function(event) {
44994
45105
  shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
44995
45106
  }, []);
44996
- React38.useEffect(function() {
45107
+ React39.useEffect(function() {
44997
45108
  lockStack.push(Style2);
44998
45109
  props.setCallbacks({
44999
45110
  onScrollCapture: scrollWheel,
@@ -45013,11 +45124,11 @@ function RemoveScrollSideCar(props) {
45013
45124
  };
45014
45125
  }, []);
45015
45126
  var removeScrollBar = props.removeScrollBar, inert = props.inert;
45016
- return React38.createElement(
45017
- React38.Fragment,
45127
+ return React39.createElement(
45128
+ React39.Fragment,
45018
45129
  null,
45019
- inert ? React38.createElement(Style2, { styles: generateStyle(id) }) : null,
45020
- removeScrollBar ? React38.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
45130
+ inert ? React39.createElement(Style2, { styles: generateStyle(id) }) : null,
45131
+ removeScrollBar ? React39.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
45021
45132
  );
45022
45133
  }
45023
45134
  function getOutermostShadowParent(node) {
@@ -45036,8 +45147,8 @@ function getOutermostShadowParent(node) {
45036
45147
  var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
45037
45148
 
45038
45149
  // node_modules/react-remove-scroll/dist/es2015/Combination.js
45039
- var ReactRemoveScroll = React39.forwardRef(function(props, ref) {
45040
- return React39.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
45150
+ var ReactRemoveScroll = React40.forwardRef(function(props, ref) {
45151
+ return React40.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
45041
45152
  });
45042
45153
  ReactRemoveScroll.classNames = RemoveScroll.classNames;
45043
45154
  var Combination_default = ReactRemoveScroll;
@@ -45072,11 +45183,11 @@ var [MenuRootProvider, useMenuRootContext] = createMenuContext(MENU_NAME);
45072
45183
  var Menu = /* @__PURE__ */ __name21((props) => {
45073
45184
  const { __scopeMenu, open = false, children, dir, onOpenChange, modal = true } = props;
45074
45185
  const popperScope = usePopperScope(__scopeMenu);
45075
- const [content, setContent] = React40.useState(null);
45076
- const isUsingKeyboardRef = React40.useRef(false);
45186
+ const [content, setContent] = React41.useState(null);
45187
+ const isUsingKeyboardRef = React41.useRef(false);
45077
45188
  const handleOpenChange = useCallbackRef(onOpenChange);
45078
45189
  const direction = useDirection(dir);
45079
- React40.useEffect(() => {
45190
+ React41.useEffect(() => {
45080
45191
  const handleKeyDown = /* @__PURE__ */ __name21(() => {
45081
45192
  isUsingKeyboardRef.current = true;
45082
45193
  document.addEventListener("pointerdown", handlePointer, { capture: true, once: true });
@@ -45090,7 +45201,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
45090
45201
  document.removeEventListener("pointermove", handlePointer, { capture: true });
45091
45202
  };
45092
45203
  }, []);
45093
- React40.useEffect(() => {
45204
+ React41.useEffect(() => {
45094
45205
  if (!open) {
45095
45206
  return;
45096
45207
  }
@@ -45110,7 +45221,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
45110
45221
  MenuRootProvider,
45111
45222
  {
45112
45223
  scope: __scopeMenu,
45113
- onClose: React40.useCallback(() => handleOpenChange(false), [handleOpenChange]),
45224
+ onClose: React41.useCallback(() => handleOpenChange(false), [handleOpenChange]),
45114
45225
  isUsingKeyboardRef,
45115
45226
  dir: direction,
45116
45227
  modal,
@@ -45120,7 +45231,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
45120
45231
  }
45121
45232
  ) });
45122
45233
  }, "Menu");
45123
- var MenuAnchor = /* @__PURE__ */ React40.forwardRef(
45234
+ var MenuAnchor = /* @__PURE__ */ React41.forwardRef(
45124
45235
  /* @__PURE__ */ __name21(function MenuAnchor2(props, forwardedRef) {
45125
45236
  const { __scopeMenu, ...anchorProps } = props;
45126
45237
  const popperScope = usePopperScope(__scopeMenu);
@@ -45138,7 +45249,7 @@ var MenuPortal = /* @__PURE__ */ __name21((props) => {
45138
45249
  }, "MenuPortal");
45139
45250
  var CONTENT_NAME2 = "MenuContent";
45140
45251
  var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME2);
45141
- var MenuContent = /* @__PURE__ */ React40.forwardRef(
45252
+ var MenuContent = /* @__PURE__ */ React41.forwardRef(
45142
45253
  /* @__PURE__ */ __name21(function MenuContent2(props, forwardedRef) {
45143
45254
  const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeMenu);
45144
45255
  const { forceMount = portalContext.forceMount, ...contentProps } = props;
@@ -45147,13 +45258,13 @@ var MenuContent = /* @__PURE__ */ React40.forwardRef(
45147
45258
  return /* @__PURE__ */ jsx30(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx30(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx30(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx30(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx30(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
45148
45259
  }, "MenuContent")
45149
45260
  );
45150
- var MenuRootContentModal = /* @__PURE__ */ React40.forwardRef(
45261
+ var MenuRootContentModal = /* @__PURE__ */ React41.forwardRef(
45151
45262
  // blank line to reduce diff noise
45152
45263
  /* @__PURE__ */ __name21(function MenuRootContentModal2(props, forwardedRef) {
45153
45264
  const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
45154
- const ref = React40.useRef(null);
45265
+ const ref = React41.useRef(null);
45155
45266
  const composedRefs = useComposedRefs(forwardedRef, ref);
45156
- React40.useEffect(() => {
45267
+ React41.useEffect(() => {
45157
45268
  const content = ref.current;
45158
45269
  if (content) return hideOthers(content);
45159
45270
  }, []);
@@ -45175,7 +45286,7 @@ var MenuRootContentModal = /* @__PURE__ */ React40.forwardRef(
45175
45286
  );
45176
45287
  }, "MenuRootContentModal")
45177
45288
  );
45178
- var MenuRootContentNonModal = /* @__PURE__ */ React40.forwardRef(/* @__PURE__ */ __name21(function MenuRootContentNonModal2(props, forwardedRef) {
45289
+ var MenuRootContentNonModal = /* @__PURE__ */ React41.forwardRef(/* @__PURE__ */ __name21(function MenuRootContentNonModal2(props, forwardedRef) {
45179
45290
  const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
45180
45291
  return /* @__PURE__ */ jsx30(
45181
45292
  MenuContentImpl,
@@ -45190,7 +45301,7 @@ var MenuRootContentNonModal = /* @__PURE__ */ React40.forwardRef(/* @__PURE__ */
45190
45301
  );
45191
45302
  }, "MenuRootContentNonModal"));
45192
45303
  var Slot = createSlot("MenuContent.ScrollLock");
45193
- var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
45304
+ var MenuContentImpl = /* @__PURE__ */ React41.forwardRef(
45194
45305
  // blank line to reduce diff noise
45195
45306
  /* @__PURE__ */ __name21(function MenuContentImpl2(props, forwardedRef) {
45196
45307
  const {
@@ -45214,16 +45325,16 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
45214
45325
  const popperScope = usePopperScope(__scopeMenu);
45215
45326
  const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
45216
45327
  const getItems = useCollection2(__scopeMenu);
45217
- const [currentItemId, setCurrentItemId] = React40.useState(null);
45218
- const contentRef = React40.useRef(null);
45328
+ const [currentItemId, setCurrentItemId] = React41.useState(null);
45329
+ const contentRef = React41.useRef(null);
45219
45330
  const composedRefs = useComposedRefs(forwardedRef, contentRef, context.onContentChange);
45220
- const timerRef = React40.useRef(0);
45221
- const searchRef = React40.useRef("");
45222
- const pointerGraceTimerRef = React40.useRef(0);
45223
- const pointerGraceIntentRef = React40.useRef(null);
45224
- const pointerDirRef = React40.useRef("right");
45225
- const lastPointerXRef = React40.useRef(0);
45226
- const ScrollLockWrapper = disableOutsideScroll ? Combination_default : React40.Fragment;
45331
+ const timerRef = React41.useRef(0);
45332
+ const searchRef = React41.useRef("");
45333
+ const pointerGraceTimerRef = React41.useRef(0);
45334
+ const pointerGraceIntentRef = React41.useRef(null);
45335
+ const pointerDirRef = React41.useRef("right");
45336
+ const lastPointerXRef = React41.useRef(0);
45337
+ const ScrollLockWrapper = disableOutsideScroll ? Combination_default : React41.Fragment;
45227
45338
  const scrollLockWrapperProps = disableOutsideScroll ? { as: Slot, allowPinchZoom: true } : void 0;
45228
45339
  const handleTypeaheadSearch = /* @__PURE__ */ __name21((key) => {
45229
45340
  const search = searchRef.current + key;
@@ -45242,11 +45353,11 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
45242
45353
  setTimeout(() => newItem.focus());
45243
45354
  }
45244
45355
  }, "handleTypeaheadSearch");
45245
- React40.useEffect(() => {
45356
+ React41.useEffect(() => {
45246
45357
  return () => window.clearTimeout(timerRef.current);
45247
45358
  }, []);
45248
45359
  useFocusGuards();
45249
- const isPointerMovingToSubmenu = React40.useCallback((event) => {
45360
+ const isPointerMovingToSubmenu = React41.useCallback((event) => {
45250
45361
  const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
45251
45362
  return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
45252
45363
  }, []);
@@ -45255,13 +45366,13 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
45255
45366
  {
45256
45367
  scope: __scopeMenu,
45257
45368
  searchRef,
45258
- onItemEnter: React40.useCallback(
45369
+ onItemEnter: React41.useCallback(
45259
45370
  (event) => {
45260
45371
  if (isPointerMovingToSubmenu(event)) event.preventDefault();
45261
45372
  },
45262
45373
  [isPointerMovingToSubmenu]
45263
45374
  ),
45264
- onItemLeave: React40.useCallback(
45375
+ onItemLeave: React41.useCallback(
45265
45376
  (event) => {
45266
45377
  if (isPointerMovingToSubmenu(event)) return;
45267
45378
  contentRef.current?.focus();
@@ -45269,14 +45380,14 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
45269
45380
  },
45270
45381
  [isPointerMovingToSubmenu]
45271
45382
  ),
45272
- onTriggerLeave: React40.useCallback(
45383
+ onTriggerLeave: React41.useCallback(
45273
45384
  (event) => {
45274
45385
  if (isPointerMovingToSubmenu(event)) event.preventDefault();
45275
45386
  },
45276
45387
  [isPointerMovingToSubmenu]
45277
45388
  ),
45278
45389
  pointerGraceTimerRef,
45279
- onPointerGraceIntentChange: React40.useCallback((intent) => {
45390
+ onPointerGraceIntentChange: React41.useCallback((intent) => {
45280
45391
  pointerGraceIntentRef.current = intent;
45281
45392
  }, []),
45282
45393
  children: /* @__PURE__ */ jsx30(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx30(
@@ -45375,15 +45486,15 @@ var MenuContentImpl = /* @__PURE__ */ React40.forwardRef(
45375
45486
  );
45376
45487
  var ITEM_NAME2 = "MenuItem";
45377
45488
  var ITEM_SELECT = "menu.itemSelect";
45378
- var MenuItem = /* @__PURE__ */ React40.forwardRef(
45489
+ var MenuItem = /* @__PURE__ */ React41.forwardRef(
45379
45490
  // blank line to reduce diff noise
45380
45491
  /* @__PURE__ */ __name21(function MenuItem2(props, forwardedRef) {
45381
45492
  const { disabled = false, onSelect, ...itemProps } = props;
45382
- const ref = React40.useRef(null);
45493
+ const ref = React41.useRef(null);
45383
45494
  const rootContext = useMenuRootContext(ITEM_NAME2, props.__scopeMenu);
45384
45495
  const contentContext = useMenuContentContext(ITEM_NAME2, props.__scopeMenu);
45385
45496
  const composedRefs = useComposedRefs(forwardedRef, ref);
45386
- const isPointerDownRef = React40.useRef(false);
45497
+ const isPointerDownRef = React41.useRef(false);
45387
45498
  const handleSelect = /* @__PURE__ */ __name21(() => {
45388
45499
  const menuItem = ref.current;
45389
45500
  if (!disabled && menuItem) {
@@ -45428,16 +45539,16 @@ var MenuItem = /* @__PURE__ */ React40.forwardRef(
45428
45539
  );
45429
45540
  }, "MenuItem")
45430
45541
  );
45431
- var MenuItemImpl = /* @__PURE__ */ React40.forwardRef(
45542
+ var MenuItemImpl = /* @__PURE__ */ React41.forwardRef(
45432
45543
  /* @__PURE__ */ __name21(function MenuItemImpl2(props, forwardedRef) {
45433
45544
  const { __scopeMenu, disabled = false, textValue, ...itemProps } = props;
45434
45545
  const contentContext = useMenuContentContext(ITEM_NAME2, __scopeMenu);
45435
45546
  const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeMenu);
45436
- const ref = React40.useRef(null);
45547
+ const ref = React41.useRef(null);
45437
45548
  const composedRefs = useComposedRefs(forwardedRef, ref);
45438
- const [isFocused, setIsFocused] = React40.useState(false);
45439
- const [textContent, setTextContent] = React40.useState("");
45440
- React40.useEffect(() => {
45549
+ const [isFocused, setIsFocused] = React41.useState(false);
45550
+ const [textContent, setTextContent] = React41.useState("");
45551
+ React41.useEffect(() => {
45441
45552
  const menuItem = ref.current;
45442
45553
  if (menuItem) {
45443
45554
  setTextContent((menuItem.textContent ?? "").trim());
@@ -45495,7 +45606,7 @@ var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(
45495
45606
  ITEM_INDICATOR_NAME,
45496
45607
  { checked: false }
45497
45608
  );
45498
- var MenuSeparator = /* @__PURE__ */ React40.forwardRef(
45609
+ var MenuSeparator = /* @__PURE__ */ React41.forwardRef(
45499
45610
  /* @__PURE__ */ __name21(function MenuSeparator2(props, forwardedRef) {
45500
45611
  const { __scopeMenu, ...separatorProps } = props;
45501
45612
  return /* @__PURE__ */ jsx30(
@@ -45515,10 +45626,10 @@ var MenuSub = /* @__PURE__ */ __name21((props) => {
45515
45626
  const { __scopeMenu, children, open = false, onOpenChange } = props;
45516
45627
  const parentMenuContext = useMenuContext(SUB_NAME, __scopeMenu);
45517
45628
  const popperScope = usePopperScope(__scopeMenu);
45518
- const [trigger, setTrigger] = React40.useState(null);
45519
- const [content, setContent] = React40.useState(null);
45629
+ const [trigger, setTrigger] = React41.useState(null);
45630
+ const [content, setContent] = React41.useState(null);
45520
45631
  const handleOpenChange = useCallbackRef(onOpenChange);
45521
- React40.useEffect(() => {
45632
+ React41.useEffect(() => {
45522
45633
  if (parentMenuContext.open === false) handleOpenChange(false);
45523
45634
  return () => handleOpenChange(false);
45524
45635
  }, [parentMenuContext.open, handleOpenChange]);
@@ -45545,21 +45656,21 @@ var MenuSub = /* @__PURE__ */ __name21((props) => {
45545
45656
  ) });
45546
45657
  }, "MenuSub");
45547
45658
  var SUB_TRIGGER_NAME = "MenuSubTrigger";
45548
- var MenuSubTrigger = /* @__PURE__ */ React40.forwardRef(
45659
+ var MenuSubTrigger = /* @__PURE__ */ React41.forwardRef(
45549
45660
  /* @__PURE__ */ __name21(function MenuSubTrigger2(props, forwardedRef) {
45550
45661
  const context = useMenuContext(SUB_TRIGGER_NAME, props.__scopeMenu);
45551
45662
  const rootContext = useMenuRootContext(SUB_TRIGGER_NAME, props.__scopeMenu);
45552
45663
  const subContext = useMenuSubContext(SUB_TRIGGER_NAME, props.__scopeMenu);
45553
45664
  const contentContext = useMenuContentContext(SUB_TRIGGER_NAME, props.__scopeMenu);
45554
- const openTimerRef = React40.useRef(null);
45665
+ const openTimerRef = React41.useRef(null);
45555
45666
  const { pointerGraceTimerRef, onPointerGraceIntentChange } = contentContext;
45556
45667
  const scope = { __scopeMenu: props.__scopeMenu };
45557
- const clearOpenTimer = React40.useCallback(() => {
45668
+ const clearOpenTimer = React41.useCallback(() => {
45558
45669
  if (openTimerRef.current) window.clearTimeout(openTimerRef.current);
45559
45670
  openTimerRef.current = null;
45560
45671
  }, []);
45561
- React40.useEffect(() => clearOpenTimer, [clearOpenTimer]);
45562
- React40.useEffect(() => {
45672
+ React41.useEffect(() => clearOpenTimer, [clearOpenTimer]);
45673
+ React41.useEffect(() => {
45563
45674
  const pointerGraceTimer = pointerGraceTimerRef.current;
45564
45675
  return () => {
45565
45676
  window.clearTimeout(pointerGraceTimer);
@@ -45651,14 +45762,14 @@ var MenuSubTrigger = /* @__PURE__ */ React40.forwardRef(
45651
45762
  }, "MenuSubTrigger")
45652
45763
  );
45653
45764
  var SUB_CONTENT_NAME = "MenuSubContent";
45654
- var MenuSubContent = /* @__PURE__ */ React40.forwardRef(
45765
+ var MenuSubContent = /* @__PURE__ */ React41.forwardRef(
45655
45766
  /* @__PURE__ */ __name21(function MenuSubContent2(props, forwardedRef) {
45656
45767
  const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeMenu);
45657
45768
  const { forceMount = portalContext.forceMount, align = "start", ...subContentProps } = props;
45658
45769
  const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
45659
45770
  const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
45660
45771
  const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
45661
- const ref = React40.useRef(null);
45772
+ const ref = React41.useRef(null);
45662
45773
  const composedRefs = useComposedRefs(forwardedRef, ref);
45663
45774
  return /* @__PURE__ */ jsx30(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx30(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx30(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx30(
45664
45775
  MenuContentImpl,
@@ -45793,7 +45904,7 @@ var DropdownMenu = /* @__PURE__ */ __name22((props) => {
45793
45904
  modal = true
45794
45905
  } = props;
45795
45906
  const menuScope = useMenuScope(__scopeDropdownMenu);
45796
- const triggerRef = React41.useRef(null);
45907
+ const triggerRef = React42.useRef(null);
45797
45908
  const [open, setOpen] = useControllableState({
45798
45909
  prop: openProp,
45799
45910
  defaultProp: defaultOpen ?? false,
@@ -45809,14 +45920,14 @@ var DropdownMenu = /* @__PURE__ */ __name22((props) => {
45809
45920
  contentId: useId(),
45810
45921
  open,
45811
45922
  onOpenChange: setOpen,
45812
- onOpenToggle: React41.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
45923
+ onOpenToggle: React42.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
45813
45924
  modal,
45814
45925
  children: /* @__PURE__ */ jsx31(Root3, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
45815
45926
  }
45816
45927
  );
45817
45928
  }, "DropdownMenu");
45818
45929
  var TRIGGER_NAME = "DropdownMenuTrigger";
45819
- var DropdownMenuTrigger = /* @__PURE__ */ React41.forwardRef(
45930
+ var DropdownMenuTrigger = /* @__PURE__ */ React42.forwardRef(
45820
45931
  // blank line to reduce diff noise
45821
45932
  /* @__PURE__ */ __name22(function DropdownMenuTrigger2(props, forwardedRef) {
45822
45933
  const { __scopeDropdownMenu, disabled = false, ...triggerProps } = props;
@@ -45858,13 +45969,13 @@ var DropdownMenuPortal = /* @__PURE__ */ __name22((props) => {
45858
45969
  return /* @__PURE__ */ jsx31(Portal3, { ...menuScope, ...portalProps });
45859
45970
  }, "DropdownMenuPortal");
45860
45971
  var CONTENT_NAME3 = "DropdownMenuContent";
45861
- var DropdownMenuContent = /* @__PURE__ */ React41.forwardRef(
45972
+ var DropdownMenuContent = /* @__PURE__ */ React42.forwardRef(
45862
45973
  // blank line to reduce diff noise
45863
45974
  /* @__PURE__ */ __name22(function DropdownMenuContent2(props, forwardedRef) {
45864
45975
  const { __scopeDropdownMenu, ...contentProps } = props;
45865
45976
  const context = useDropdownMenuContext(CONTENT_NAME3, __scopeDropdownMenu);
45866
45977
  const menuScope = useMenuScope(__scopeDropdownMenu);
45867
- const hasInteractedOutsideRef = React41.useRef(false);
45978
+ const hasInteractedOutsideRef = React42.useRef(false);
45868
45979
  return /* @__PURE__ */ jsx31(
45869
45980
  Content2,
45870
45981
  {
@@ -45899,7 +46010,7 @@ var DropdownMenuContent = /* @__PURE__ */ React41.forwardRef(
45899
46010
  );
45900
46011
  }, "DropdownMenuContent")
45901
46012
  );
45902
- var DropdownMenuItem = /* @__PURE__ */ React41.forwardRef(
46013
+ var DropdownMenuItem = /* @__PURE__ */ React42.forwardRef(
45903
46014
  // blank line to reduce diff noise
45904
46015
  /* @__PURE__ */ __name22(function DropdownMenuItem2(props, forwardedRef) {
45905
46016
  const { __scopeDropdownMenu, ...itemProps } = props;
@@ -45907,7 +46018,7 @@ var DropdownMenuItem = /* @__PURE__ */ React41.forwardRef(
45907
46018
  return /* @__PURE__ */ jsx31(Item2, { ...menuScope, ...itemProps, ref: forwardedRef });
45908
46019
  }, "DropdownMenuItem")
45909
46020
  );
45910
- var DropdownMenuSeparator = /* @__PURE__ */ React41.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSeparator2(props, forwardedRef) {
46021
+ var DropdownMenuSeparator = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSeparator2(props, forwardedRef) {
45911
46022
  const { __scopeDropdownMenu, ...separatorProps } = props;
45912
46023
  const menuScope = useMenuScope(__scopeDropdownMenu);
45913
46024
  return /* @__PURE__ */ jsx31(Separator, { ...menuScope, ...separatorProps, ref: forwardedRef });
@@ -45923,12 +46034,12 @@ var DropdownMenuSub = /* @__PURE__ */ __name22((props) => {
45923
46034
  });
45924
46035
  return /* @__PURE__ */ jsx31(Sub, { ...menuScope, open, onOpenChange: setOpen, children });
45925
46036
  }, "DropdownMenuSub");
45926
- var DropdownMenuSubTrigger = /* @__PURE__ */ React41.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubTrigger2(props, forwardedRef) {
46037
+ var DropdownMenuSubTrigger = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubTrigger2(props, forwardedRef) {
45927
46038
  const { __scopeDropdownMenu, ...subTriggerProps } = props;
45928
46039
  const menuScope = useMenuScope(__scopeDropdownMenu);
45929
46040
  return /* @__PURE__ */ jsx31(SubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
45930
46041
  }, "DropdownMenuSubTrigger"));
45931
- var DropdownMenuSubContent = /* @__PURE__ */ React41.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubContent2(props, forwardedRef) {
46042
+ var DropdownMenuSubContent = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubContent2(props, forwardedRef) {
45932
46043
  const { __scopeDropdownMenu, ...subContentProps } = props;
45933
46044
  const menuScope = useMenuScope(__scopeDropdownMenu);
45934
46045
  return /* @__PURE__ */ jsx31(
@@ -46484,6 +46595,7 @@ var ContextMenu = ({
46484
46595
  onOpenKeyboardShortcuts
46485
46596
  }) => {
46486
46597
  const { cameraType, setCameraType } = useCameraController();
46598
+ const { gridEnabled, setGridEnabled } = useAppearance();
46487
46599
  const [cameraSubOpen, setCameraSubOpen] = useState35(false);
46488
46600
  const [hoveredItem, setHoveredItem] = useState35(null);
46489
46601
  return /* @__PURE__ */ jsx34(
@@ -46621,6 +46733,27 @@ var ContextMenu = ({
46621
46733
  ]
46622
46734
  }
46623
46735
  ),
46736
+ /* @__PURE__ */ jsxs8(
46737
+ Item22,
46738
+ {
46739
+ style: {
46740
+ ...itemStyles2,
46741
+ backgroundColor: hoveredItem === "grid" ? "#404040" : "transparent"
46742
+ },
46743
+ onSelect: (e) => e.preventDefault(),
46744
+ onPointerDown: (e) => {
46745
+ e.preventDefault();
46746
+ setGridEnabled(!gridEnabled);
46747
+ },
46748
+ onMouseEnter: () => setHoveredItem("grid"),
46749
+ onMouseLeave: () => setHoveredItem(null),
46750
+ onTouchStart: () => setHoveredItem("grid"),
46751
+ children: [
46752
+ /* @__PURE__ */ jsx34("span", { style: iconContainerStyles2, children: gridEnabled && /* @__PURE__ */ jsx34(CheckIcon, {}) }),
46753
+ /* @__PURE__ */ jsx34("span", { style: { display: "flex", alignItems: "center" }, children: "Show Grid" })
46754
+ ]
46755
+ }
46756
+ ),
46624
46757
  /* @__PURE__ */ jsx34(AppearanceMenu, {}),
46625
46758
  /* @__PURE__ */ jsx34(Separator2, { style: separatorStyles2 }),
46626
46759
  /* @__PURE__ */ jsx34(
@@ -46743,10 +46876,10 @@ var ContextMenu = ({
46743
46876
  };
46744
46877
 
46745
46878
  // src/components/KeyboardShortcutsDialog.tsx
46746
- import { useEffect as useEffect45, useMemo as useMemo30, useRef as useRef27, useState as useState37 } from "react";
46879
+ import { useEffect as useEffect46, useMemo as useMemo31, useRef as useRef27, useState as useState37 } from "react";
46747
46880
 
46748
46881
  // src/hooks/useRegisteredHotkey.ts
46749
- import { useEffect as useEffect44, useMemo as useMemo29, useRef as useRef26, useState as useState36 } from "react";
46882
+ import { useEffect as useEffect45, useMemo as useMemo30, useRef as useRef26, useState as useState36 } from "react";
46750
46883
  var hotkeyRegistry = /* @__PURE__ */ new Map();
46751
46884
  var subscribers = /* @__PURE__ */ new Set();
46752
46885
  var isListenerAttached = false;
@@ -46870,14 +47003,14 @@ var subscribeToRegistry = (subscriber) => {
46870
47003
  var useRegisteredHotkey = (id, handler, metadata) => {
46871
47004
  const handlerRef = useRef26(handler);
46872
47005
  handlerRef.current = handler;
46873
- const normalizedMetadata = useMemo29(
47006
+ const normalizedMetadata = useMemo30(
46874
47007
  () => ({
46875
47008
  shortcut: metadata.shortcut,
46876
47009
  description: metadata.description
46877
47010
  }),
46878
47011
  [metadata.shortcut, metadata.description]
46879
47012
  );
46880
- useEffect44(() => {
47013
+ useEffect45(() => {
46881
47014
  const registration = {
46882
47015
  id,
46883
47016
  ...normalizedMetadata,
@@ -46893,7 +47026,7 @@ var useHotkeyRegistry = () => {
46893
47026
  const [entries, setEntries] = useState36(
46894
47027
  () => Array.from(hotkeyRegistry.values())
46895
47028
  );
46896
- useEffect44(() => subscribeToRegistry(setEntries), []);
47029
+ useEffect45(() => subscribeToRegistry(setEntries), []);
46897
47030
  return entries;
46898
47031
  };
46899
47032
  var registerHotkeyViewer = (element) => {
@@ -46910,7 +47043,7 @@ var KeyboardShortcutsDialog = ({
46910
47043
  const [query, setQuery] = useState37("");
46911
47044
  const inputRef = useRef27(null);
46912
47045
  const hotkeys = useHotkeyRegistry();
46913
- useEffect45(() => {
47046
+ useEffect46(() => {
46914
47047
  if (!open) return void 0;
46915
47048
  const handleKeyDown = (event) => {
46916
47049
  if (event.key === "Escape") {
@@ -46921,14 +47054,14 @@ var KeyboardShortcutsDialog = ({
46921
47054
  window.addEventListener("keydown", handleKeyDown);
46922
47055
  return () => window.removeEventListener("keydown", handleKeyDown);
46923
47056
  }, [open, onClose]);
46924
- useEffect45(() => {
47057
+ useEffect46(() => {
46925
47058
  if (open) {
46926
47059
  setTimeout(() => {
46927
47060
  inputRef.current?.focus();
46928
47061
  }, 0);
46929
47062
  }
46930
47063
  }, [open]);
46931
- const filteredHotkeys = useMemo30(() => {
47064
+ const filteredHotkeys = useMemo31(() => {
46932
47065
  const normalizedQuery = query.trim().toLowerCase();
46933
47066
  if (!normalizedQuery) {
46934
47067
  return hotkeys;
@@ -47150,7 +47283,7 @@ function useCameraPreset({
47150
47283
  }
47151
47284
 
47152
47285
  // src/hooks/useContextMenu.ts
47153
- import { useState as useState38, useCallback as useCallback22, useRef as useRef28, useEffect as useEffect46 } from "react";
47286
+ import { useState as useState38, useCallback as useCallback22, useRef as useRef28, useEffect as useEffect47 } from "react";
47154
47287
  var useContextMenu = ({ containerRef }) => {
47155
47288
  const [menuVisible, setMenuVisible] = useState38(false);
47156
47289
  const [menuPos, setMenuPos] = useState38({
@@ -47265,7 +47398,7 @@ var useContextMenu = ({ containerRef }) => {
47265
47398
  }
47266
47399
  setMenuVisible(false);
47267
47400
  }, []);
47268
- useEffect46(() => {
47401
+ useEffect47(() => {
47269
47402
  if (menuVisible) {
47270
47403
  document.addEventListener("mousedown", handleClickAway);
47271
47404
  document.addEventListener("touchstart", handleClickAway);
@@ -47329,7 +47462,7 @@ var useGlobalDownloadGltf = () => {
47329
47462
 
47330
47463
  // src/CadViewer.tsx
47331
47464
  import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
47332
- var DEFAULT_TARGET = new THREE45.Vector3(0, 0, 0);
47465
+ var DEFAULT_TARGET = new THREE46.Vector3(0, 0, 0);
47333
47466
  var INITIAL_CAMERA_POSITION = [5, -5, 5];
47334
47467
  var readStoredCameraType = () => {
47335
47468
  if (typeof window === "undefined") return void 0;
@@ -47462,24 +47595,24 @@ var CadViewerInner = (props) => {
47462
47595
  description: "Toggle translucent components"
47463
47596
  }
47464
47597
  );
47465
- useEffect47(() => {
47598
+ useEffect48(() => {
47466
47599
  if (containerRef.current) {
47467
47600
  registerHotkeyViewer(containerRef.current);
47468
47601
  }
47469
47602
  }, []);
47470
- useEffect47(() => {
47603
+ useEffect48(() => {
47471
47604
  window.localStorage.setItem("cadViewerEngine", engine);
47472
47605
  }, [engine]);
47473
- useEffect47(() => {
47606
+ useEffect48(() => {
47474
47607
  window.localStorage.setItem("cadViewerAutoRotate", String(autoRotate));
47475
47608
  }, [autoRotate]);
47476
- useEffect47(() => {
47609
+ useEffect48(() => {
47477
47610
  window.localStorage.setItem(
47478
47611
  "cadViewerAutoRotateUserToggled",
47479
47612
  String(autoRotateUserToggled)
47480
47613
  );
47481
47614
  }, [autoRotateUserToggled]);
47482
- useEffect47(() => {
47615
+ useEffect48(() => {
47483
47616
  window.localStorage.setItem("cadViewerCameraType", cameraType);
47484
47617
  }, [cameraType]);
47485
47618
  const viewerKey = props.circuitJson ? JSON.stringify(props.circuitJson) : void 0;
@@ -47593,11 +47726,11 @@ var CadViewer = (props) => {
47593
47726
  // src/convert-circuit-json-to-3d-svg.ts
47594
47727
  var import_debug = __toESM(require_browser(), 1);
47595
47728
  import { su as su18 } from "@tscircuit/circuit-json-util";
47596
- import * as THREE49 from "three";
47729
+ import * as THREE50 from "three";
47597
47730
  import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
47598
47731
 
47599
47732
  // src/utils/create-geometry-from-polygons.ts
47600
- import * as THREE46 from "three";
47733
+ import * as THREE47 from "three";
47601
47734
  import { BufferGeometry as BufferGeometry4, Float32BufferAttribute as Float32BufferAttribute3 } from "three";
47602
47735
  function createGeometryFromPolygons(polygons) {
47603
47736
  const geometry = new BufferGeometry4();
@@ -47611,12 +47744,12 @@ function createGeometryFromPolygons(polygons) {
47611
47744
  ...polygon2.vertices[i + 1]
47612
47745
  // Third vertex
47613
47746
  );
47614
- const v1 = new THREE46.Vector3(...polygon2.vertices[0]);
47615
- const v2 = new THREE46.Vector3(...polygon2.vertices[i]);
47616
- const v3 = new THREE46.Vector3(...polygon2.vertices[i + 1]);
47617
- const normal = new THREE46.Vector3().crossVectors(
47618
- new THREE46.Vector3().subVectors(v2, v1),
47619
- new THREE46.Vector3().subVectors(v3, v1)
47747
+ const v1 = new THREE47.Vector3(...polygon2.vertices[0]);
47748
+ const v2 = new THREE47.Vector3(...polygon2.vertices[i]);
47749
+ const v3 = new THREE47.Vector3(...polygon2.vertices[i + 1]);
47750
+ const normal = new THREE47.Vector3().crossVectors(
47751
+ new THREE47.Vector3().subVectors(v2, v1),
47752
+ new THREE47.Vector3().subVectors(v3, v1)
47620
47753
  ).normalize();
47621
47754
  normals.push(
47622
47755
  normal.x,
@@ -47640,10 +47773,10 @@ function createGeometryFromPolygons(polygons) {
47640
47773
  var import_modeling2 = __toESM(require_src(), 1);
47641
47774
  var import_jscad_planner2 = __toESM(require_dist(), 1);
47642
47775
  var jscadModeling2 = __toESM(require_src(), 1);
47643
- import * as THREE48 from "three";
47776
+ import * as THREE49 from "three";
47644
47777
 
47645
47778
  // src/utils/load-model.ts
47646
- import * as THREE47 from "three";
47779
+ import * as THREE48 from "three";
47647
47780
  import { GLTFLoader as GLTFLoader2 } from "three/examples/jsm/loaders/GLTFLoader.js";
47648
47781
  import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
47649
47782
  import { STLLoader as STLLoader2 } from "three/examples/jsm/loaders/STLLoader.js";
@@ -47651,12 +47784,12 @@ async function load3DModel(url) {
47651
47784
  if (url.endsWith(".stl")) {
47652
47785
  const loader = new STLLoader2();
47653
47786
  const geometry = await loader.loadAsync(url);
47654
- const material = new THREE47.MeshStandardMaterial({
47787
+ const material = new THREE48.MeshStandardMaterial({
47655
47788
  color: 8947848,
47656
47789
  metalness: 0.5,
47657
47790
  roughness: 0.5
47658
47791
  });
47659
- return new THREE47.Mesh(geometry, material);
47792
+ return new THREE48.Mesh(geometry, material);
47660
47793
  }
47661
47794
  if (url.endsWith(".obj")) {
47662
47795
  const loader = new OBJLoader2();
@@ -47689,9 +47822,9 @@ async function renderComponent(component, scene) {
47689
47822
  }
47690
47823
  if (component.rotation) {
47691
47824
  model.rotation.set(
47692
- THREE48.MathUtils.degToRad(component.rotation.x ?? 0),
47693
- THREE48.MathUtils.degToRad(component.rotation.y ?? 0),
47694
- THREE48.MathUtils.degToRad(component.rotation.z ?? 0)
47825
+ THREE49.MathUtils.degToRad(component.rotation.x ?? 0),
47826
+ THREE49.MathUtils.degToRad(component.rotation.y ?? 0),
47827
+ THREE49.MathUtils.degToRad(component.rotation.z ?? 0)
47695
47828
  );
47696
47829
  }
47697
47830
  scene.add(model);
@@ -47705,13 +47838,13 @@ async function renderComponent(component, scene) {
47705
47838
  );
47706
47839
  if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
47707
47840
  const threeGeom = convertCSGToThreeGeom(jscadObject);
47708
- const material2 = new THREE48.MeshStandardMaterial({
47841
+ const material2 = new THREE49.MeshStandardMaterial({
47709
47842
  color: 8947848,
47710
47843
  metalness: 0.5,
47711
47844
  roughness: 0.5,
47712
- side: THREE48.DoubleSide
47845
+ side: THREE49.DoubleSide
47713
47846
  });
47714
- const mesh2 = new THREE48.Mesh(threeGeom, material2);
47847
+ const mesh2 = new THREE49.Mesh(threeGeom, material2);
47715
47848
  if (component.position) {
47716
47849
  mesh2.position.set(
47717
47850
  component.position.x ?? 0,
@@ -47721,9 +47854,9 @@ async function renderComponent(component, scene) {
47721
47854
  }
47722
47855
  if (component.rotation) {
47723
47856
  mesh2.rotation.set(
47724
- THREE48.MathUtils.degToRad(component.rotation.x ?? 0),
47725
- THREE48.MathUtils.degToRad(component.rotation.y ?? 0),
47726
- THREE48.MathUtils.degToRad(component.rotation.z ?? 0)
47857
+ THREE49.MathUtils.degToRad(component.rotation.x ?? 0),
47858
+ THREE49.MathUtils.degToRad(component.rotation.y ?? 0),
47859
+ THREE49.MathUtils.degToRad(component.rotation.z ?? 0)
47727
47860
  );
47728
47861
  }
47729
47862
  scene.add(mesh2);
@@ -47740,17 +47873,17 @@ async function renderComponent(component, scene) {
47740
47873
  if (!geom || !geom.polygons && !geom.sides) {
47741
47874
  continue;
47742
47875
  }
47743
- const color = new THREE48.Color(geomInfo.color);
47876
+ const color = new THREE49.Color(geomInfo.color);
47744
47877
  color.convertLinearToSRGB();
47745
47878
  const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
47746
47879
  const threeGeom = convertCSGToThreeGeom(geomWithColor);
47747
- const material2 = new THREE48.MeshStandardMaterial({
47880
+ const material2 = new THREE49.MeshStandardMaterial({
47748
47881
  vertexColors: true,
47749
47882
  metalness: 0.2,
47750
47883
  roughness: 0.8,
47751
- side: THREE48.DoubleSide
47884
+ side: THREE49.DoubleSide
47752
47885
  });
47753
- const mesh2 = new THREE48.Mesh(threeGeom, material2);
47886
+ const mesh2 = new THREE49.Mesh(threeGeom, material2);
47754
47887
  if (component.position) {
47755
47888
  mesh2.position.set(
47756
47889
  component.position.x ?? 0,
@@ -47760,22 +47893,22 @@ async function renderComponent(component, scene) {
47760
47893
  }
47761
47894
  if (component.rotation) {
47762
47895
  mesh2.rotation.set(
47763
- THREE48.MathUtils.degToRad(component.rotation.x ?? 0),
47764
- THREE48.MathUtils.degToRad(component.rotation.y ?? 0),
47765
- THREE48.MathUtils.degToRad(component.rotation.z ?? 0)
47896
+ THREE49.MathUtils.degToRad(component.rotation.x ?? 0),
47897
+ THREE49.MathUtils.degToRad(component.rotation.y ?? 0),
47898
+ THREE49.MathUtils.degToRad(component.rotation.z ?? 0)
47766
47899
  );
47767
47900
  }
47768
47901
  scene.add(mesh2);
47769
47902
  }
47770
47903
  return;
47771
47904
  }
47772
- const geometry = new THREE48.BoxGeometry(0.5, 0.5, 0.5);
47773
- const material = new THREE48.MeshStandardMaterial({
47905
+ const geometry = new THREE49.BoxGeometry(0.5, 0.5, 0.5);
47906
+ const material = new THREE49.MeshStandardMaterial({
47774
47907
  color: 16711680,
47775
47908
  transparent: true,
47776
47909
  opacity: 0.25
47777
47910
  });
47778
- const mesh = new THREE48.Mesh(geometry, material);
47911
+ const mesh = new THREE49.Mesh(geometry, material);
47779
47912
  if (component.position) {
47780
47913
  mesh.position.set(
47781
47914
  component.position.x ?? 0,
@@ -47796,11 +47929,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
47796
47929
  padding = 20,
47797
47930
  zoom = 1.5
47798
47931
  } = options;
47799
- const scene = new THREE49.Scene();
47932
+ const scene = new THREE50.Scene();
47800
47933
  const renderer = new SVGRenderer();
47801
47934
  renderer.setSize(width10, height10);
47802
- renderer.setClearColor(new THREE49.Color(backgroundColor), 1);
47803
- const camera = new THREE49.OrthographicCamera();
47935
+ renderer.setClearColor(new THREE50.Color(backgroundColor), 1);
47936
+ const camera = new THREE50.OrthographicCamera();
47804
47937
  const aspect = width10 / height10;
47805
47938
  const frustumSize = 100;
47806
47939
  const halfFrustumSize = frustumSize / 2 / zoom;
@@ -47814,11 +47947,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
47814
47947
  camera.position.set(position.x, position.y, position.z);
47815
47948
  camera.up.set(0, 1, 0);
47816
47949
  const lookAt = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
47817
- camera.lookAt(new THREE49.Vector3(lookAt.x, lookAt.y, lookAt.z));
47950
+ camera.lookAt(new THREE50.Vector3(lookAt.x, lookAt.y, lookAt.z));
47818
47951
  camera.updateProjectionMatrix();
47819
- const ambientLight = new THREE49.AmbientLight(16777215, Math.PI / 2);
47952
+ const ambientLight = new THREE50.AmbientLight(16777215, Math.PI / 2);
47820
47953
  scene.add(ambientLight);
47821
- const pointLight = new THREE49.PointLight(16777215, Math.PI / 4);
47954
+ const pointLight = new THREE50.PointLight(16777215, Math.PI / 4);
47822
47955
  pointLight.position.set(-10, -10, 10);
47823
47956
  scene.add(pointLight);
47824
47957
  const components = su18(circuitJson).cad_component.list();
@@ -47829,7 +47962,7 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
47829
47962
  const boardGeom = createSimplifiedBoardGeom(circuitJson);
47830
47963
  if (boardGeom) {
47831
47964
  const solderMaskColor = colors.fr4SolderMaskGreen;
47832
- const baseColor = new THREE49.Color(
47965
+ const baseColor = new THREE50.Color(
47833
47966
  solderMaskColor[0],
47834
47967
  solderMaskColor[1],
47835
47968
  solderMaskColor[2]
@@ -47841,28 +47974,28 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
47841
47974
  const material = createBoardMaterial({
47842
47975
  material: boardData?.material,
47843
47976
  color: baseColor,
47844
- side: THREE49.DoubleSide
47977
+ side: THREE50.DoubleSide
47845
47978
  });
47846
- const mesh = new THREE49.Mesh(geometry, material);
47979
+ const mesh = new THREE50.Mesh(geometry, material);
47847
47980
  scene.add(mesh);
47848
47981
  }
47849
47982
  }
47850
- const gridColor = new THREE49.Color(8947848);
47851
- const gridHelper = new THREE49.GridHelper(100, 100, gridColor, gridColor);
47983
+ const gridColor = new THREE50.Color(8947848);
47984
+ const gridHelper = new THREE50.GridHelper(100, 100, gridColor, gridColor);
47852
47985
  gridHelper.rotation.x = Math.PI / 2;
47853
47986
  const materials = Array.isArray(gridHelper.material) ? gridHelper.material : [gridHelper.material];
47854
47987
  for (const mat of materials) {
47855
47988
  mat.transparent = true;
47856
47989
  mat.opacity = 0.3;
47857
- if (mat instanceof THREE49.LineBasicMaterial) {
47990
+ if (mat instanceof THREE50.LineBasicMaterial) {
47858
47991
  mat.color = gridColor;
47859
47992
  mat.vertexColors = false;
47860
47993
  }
47861
47994
  }
47862
47995
  scene.add(gridHelper);
47863
- const box = new THREE49.Box3().setFromObject(scene);
47864
- const center = box.getCenter(new THREE49.Vector3());
47865
- const size4 = box.getSize(new THREE49.Vector3());
47996
+ const box = new THREE50.Box3().setFromObject(scene);
47997
+ const center = box.getCenter(new THREE50.Vector3());
47998
+ const size4 = box.getSize(new THREE50.Vector3());
47866
47999
  scene.position.sub(center);
47867
48000
  const maxDim = Math.max(size4.x, size4.y, size4.z);
47868
48001
  if (maxDim > 0) {
@@ -47880,10 +48013,10 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
47880
48013
 
47881
48014
  // src/hooks/exporter/gltf.ts
47882
48015
  import { GLTFExporter as GLTFExporter3 } from "three-stdlib";
47883
- import { useEffect as useEffect48, useState as useState40, useMemo as useMemo31, useCallback as useCallback25 } from "react";
48016
+ import { useEffect as useEffect49, useState as useState40, useMemo as useMemo32, useCallback as useCallback25 } from "react";
47884
48017
  function useSaveGltfAs(options = {}) {
47885
48018
  const parse2 = useParser(options);
47886
- const link = useMemo31(() => document.createElement("a"), []);
48019
+ const link = useMemo32(() => document.createElement("a"), []);
47887
48020
  const saveAs = async (filename) => {
47888
48021
  const name = filename ?? options.filename ?? "";
47889
48022
  if (options.binary == null) options.binary = name.endsWith(".glb");
@@ -47893,7 +48026,7 @@ function useSaveGltfAs(options = {}) {
47893
48026
  link.dispatchEvent(new MouseEvent("click"));
47894
48027
  URL.revokeObjectURL(url);
47895
48028
  };
47896
- useEffect48(
48029
+ useEffect49(
47897
48030
  () => () => {
47898
48031
  link.remove();
47899
48032
  instance = null;
@@ -47914,11 +48047,11 @@ function useExportGltfUrl(options = {}) {
47914
48047
  (instance) => parse2(instance).then(setUrl).catch(setError),
47915
48048
  []
47916
48049
  );
47917
- useEffect48(() => () => URL.revokeObjectURL(url), [url]);
48050
+ useEffect49(() => () => URL.revokeObjectURL(url), [url]);
47918
48051
  return [ref, url, error];
47919
48052
  }
47920
48053
  function useParser(options = {}) {
47921
- const exporter = useMemo31(() => new GLTFExporter3(), []);
48054
+ const exporter = useMemo32(() => new GLTFExporter3(), []);
47922
48055
  return (instance) => {
47923
48056
  const { promise, resolve, reject } = Promise.withResolvers();
47924
48057
  exporter.parse(