@tscircuit/3d-viewer 0.0.638 → 0.0.639

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19214,11 +19214,16 @@ function resolveFoldPcbs(circuitJson, foldPcbs) {
19214
19214
  );
19215
19215
  }
19216
19216
 
19217
- // src/utils/pick-cad-component.ts
19218
- var pickCadComponent = (scene, position, circuitJson) => {
19217
+ // src/utils/pick-scene-object.ts
19218
+ var getBoardName = (id, circuitJson) => circuitJson.some((e) => e.type === "pcb_panel" && e.pcb_panel_id === id) ? "Panel" : "Board";
19219
+ var pickSceneObject = (scene, position, circuitJson) => {
19219
19220
  let object = pickVisibleMesh(scene, position) ?? null;
19220
19221
  while (object) {
19221
- const cadComponentId = object.userData.cad_component_id;
19222
+ const {
19223
+ cad_component_id: cadComponentId,
19224
+ pcb_board_id: pcbBoardId,
19225
+ cad_cable_id: cadCableId
19226
+ } = object.userData;
19222
19227
  if (cadComponentId) {
19223
19228
  const cad = circuitJson.find(
19224
19229
  (e) => e.type === "cad_component" && e.cad_component_id === cadComponentId
@@ -19227,8 +19232,8 @@ var pickCadComponent = (scene, position, circuitJson) => {
19227
19232
  const metadata = getGlbComponentMetadata(object);
19228
19233
  if (metadata && metadata.cad_component_id === cadComponentId)
19229
19234
  return {
19230
- cad_component_id: cadComponentId,
19231
- componentName: metadata.componentName ?? cadComponentId
19235
+ objectId: cadComponentId,
19236
+ name: metadata.componentName ?? cadComponentId
19232
19237
  };
19233
19238
  return;
19234
19239
  }
@@ -19236,39 +19241,64 @@ var pickCadComponent = (scene, position, circuitJson) => {
19236
19241
  (e) => e.type === "source_component" && e.source_component_id === cad.source_component_id
19237
19242
  );
19238
19243
  return {
19239
- cad_component_id: cad.cad_component_id,
19240
- componentName: source?.type === "source_component" ? source.name : cad.cad_component_id
19244
+ objectId: cad.cad_component_id,
19245
+ name: source?.type === "source_component" ? source.name : cad.cad_component_id
19241
19246
  };
19242
19247
  }
19248
+ if (pcbBoardId)
19249
+ return {
19250
+ objectId: pcbBoardId,
19251
+ name: getBoardName(pcbBoardId, circuitJson)
19252
+ };
19253
+ if (cadCableId)
19254
+ return { objectId: cadCableId, name: object.userData.name ?? cadCableId };
19243
19255
  object = object.parent;
19244
19256
  }
19245
19257
  };
19246
19258
 
19247
- // src/hooks/useHiddenCadComponents.ts
19259
+ // src/hooks/useObjectVisibility.ts
19248
19260
  import { useState as useState2 } from "react";
19249
- var NO_HIDDEN_COMPONENTS = /* @__PURE__ */ new Set();
19250
- var useHiddenCadComponents = (circuitKey) => {
19261
+
19262
+ // src/utils/object-visibility.ts
19263
+ var ALL_OBJECTS_VISIBLE = { hiddenIds: /* @__PURE__ */ new Set() };
19264
+ var isObjectHidden = (visibility, id) => {
19265
+ if (!visibility) return false;
19266
+ if (id !== void 0 && visibility.hiddenIds.has(id)) return true;
19267
+ return visibility.isolatedId !== void 0 && visibility.isolatedId !== id;
19268
+ };
19269
+ var hasHiddenObjects = (visibility) => visibility.hiddenIds.size > 0 || visibility.isolatedId !== void 0;
19270
+
19271
+ // src/hooks/useObjectVisibility.ts
19272
+ var useObjectVisibility = (circuitKey) => {
19251
19273
  const [state, setState] = useState2({
19252
19274
  circuitKey,
19253
- ids: NO_HIDDEN_COMPONENTS
19275
+ visibility: ALL_OBJECTS_VISIBLE
19254
19276
  });
19255
- const hiddenCadComponentIds = state.circuitKey === circuitKey ? state.ids : NO_HIDDEN_COMPONENTS;
19277
+ const objectVisibility = state.circuitKey === circuitKey ? state.visibility : ALL_OBJECTS_VISIBLE;
19256
19278
  if (state.circuitKey !== circuitKey) {
19257
- setState({ circuitKey, ids: NO_HIDDEN_COMPONENTS });
19279
+ setState({ circuitKey, visibility: ALL_OBJECTS_VISIBLE });
19258
19280
  }
19281
+ const update = (next) => {
19282
+ setState((current) => ({
19283
+ circuitKey,
19284
+ visibility: next(
19285
+ current.circuitKey === circuitKey ? current.visibility : ALL_OBJECTS_VISIBLE
19286
+ )
19287
+ }));
19288
+ };
19259
19289
  return {
19260
- hiddenCadComponentIds,
19261
- hideComponent: (id) => {
19262
- setState((current) => ({
19263
- circuitKey,
19264
- ids: /* @__PURE__ */ new Set([
19265
- ...current.circuitKey === circuitKey ? current.ids : [],
19266
- id
19267
- ])
19290
+ objectVisibility,
19291
+ hideObject: (id) => {
19292
+ update((current) => ({
19293
+ ...current,
19294
+ hiddenIds: /* @__PURE__ */ new Set([...current.hiddenIds, id])
19268
19295
  }));
19269
19296
  },
19270
- unhideAllComponents: () => {
19271
- setState({ circuitKey, ids: NO_HIDDEN_COMPONENTS });
19297
+ isolateObject: (id) => {
19298
+ update((current) => ({ ...current, isolatedId: id }));
19299
+ },
19300
+ unhideAllObjects: () => {
19301
+ update(() => ALL_OBJECTS_VISIBLE);
19272
19302
  }
19273
19303
  };
19274
19304
  };
@@ -19309,8 +19339,8 @@ function configureRuntimeFont() {
19309
19339
  }
19310
19340
 
19311
19341
  // src/CadViewer.tsx
19312
- import { useCallback as useCallback25, useContext as useContext13, useEffect as useEffect56, useRef as useRef30, useState as useState46 } from "react";
19313
- import * as THREE63 from "three";
19342
+ import { useCallback as useCallback25, useContext as useContext13, useEffect as useEffect57, useRef as useRef30, useState as useState46 } from "react";
19343
+ import * as THREE64 from "three";
19314
19344
 
19315
19345
  // src/assembly-explosion/use-assembly-explosion.ts
19316
19346
  import {
@@ -19564,7 +19594,7 @@ function AssemblyExplosionControl({
19564
19594
 
19565
19595
  // src/CadViewerJscad.tsx
19566
19596
  import { su as su12 } from "@tscircuit/circuit-json-util";
19567
- import { forwardRef as forwardRef3, useMemo as useMemo26 } from "react";
19597
+ import { forwardRef as forwardRef3, useMemo as useMemo27 } from "react";
19568
19598
 
19569
19599
  // src/utils/get-cad-pcb-context.ts
19570
19600
  var getCadPcbContext = (cad, circuitJson) => {
@@ -22303,7 +22333,7 @@ import * as THREE31 from "three";
22303
22333
  // package.json
22304
22334
  var package_default = {
22305
22335
  name: "@tscircuit/3d-viewer",
22306
- version: "0.0.637",
22336
+ version: "0.0.638",
22307
22337
  repository: {
22308
22338
  type: "git",
22309
22339
  url: "https://github.com/tscircuit/3d-viewer"
@@ -25775,9 +25805,36 @@ var ErrorBox = ({ parent }) => {
25775
25805
  return null;
25776
25806
  };
25777
25807
 
25808
+ // src/three-components/BoardGroup.tsx
25809
+ import { useEffect as useEffect30, useMemo as useMemo22 } from "react";
25810
+ import * as THREE35 from "three";
25811
+ import { jsx as jsx20 } from "react/jsx-runtime";
25812
+ var BoardGroup = ({
25813
+ pcbBoardId,
25814
+ hidden = false,
25815
+ children
25816
+ }) => {
25817
+ const scene = useThree();
25818
+ const group = useMemo22(() => new THREE35.Group(), []);
25819
+ group.name = "board";
25820
+ group.userData.pcb_board_id = pcbBoardId;
25821
+ group.visible = !hidden;
25822
+ useEffect30(() => {
25823
+ scene.rootObject.add(group);
25824
+ return () => {
25825
+ scene.rootObject.remove(group);
25826
+ };
25827
+ }, [scene.rootObject, group]);
25828
+ const context = useMemo22(
25829
+ () => ({ ...scene, rootObject: group }),
25830
+ [scene, group]
25831
+ );
25832
+ return /* @__PURE__ */ jsx20(ThreeContext.Provider, { value: context, children });
25833
+ };
25834
+
25778
25835
  // src/three-components/JscadBoardTextures.tsx
25779
25836
  import { su as su9 } from "@tscircuit/circuit-json-util";
25780
- import { useEffect as useEffect30, useMemo as useMemo23 } from "react";
25837
+ import { useEffect as useEffect31, useMemo as useMemo24 } from "react";
25781
25838
 
25782
25839
  // src/textures/open-via-holes-at-pads.ts
25783
25840
  import { CircuitToCanvasDrawer } from "circuit-to-canvas";
@@ -25933,12 +25990,12 @@ function clearViaHolesFromSurface({
25933
25990
 
25934
25991
  // src/textures/create-combined-board-textures.ts
25935
25992
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer12 } from "circuit-to-canvas";
25936
- import * as THREE47 from "three";
25993
+ import * as THREE48 from "three";
25937
25994
 
25938
25995
  // src/utils/pad-texture.ts
25939
25996
  import { su as su6 } from "@tscircuit/circuit-json-util";
25940
25997
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer2 } from "circuit-to-canvas";
25941
- import * as THREE35 from "three";
25998
+ import * as THREE36 from "three";
25942
25999
  function createPadTextureForLayer({
25943
26000
  layer,
25944
26001
  circuitJson,
@@ -26018,10 +26075,10 @@ function createPadTextureForLayer({
26018
26075
  drawSoldermaskTop: false,
26019
26076
  drawSoldermaskBottom: false
26020
26077
  });
26021
- const texture = new THREE35.CanvasTexture(canvas);
26078
+ const texture = new THREE36.CanvasTexture(canvas);
26022
26079
  texture.generateMipmaps = true;
26023
- texture.minFilter = THREE35.LinearMipmapLinearFilter;
26024
- texture.magFilter = THREE35.LinearFilter;
26080
+ texture.minFilter = THREE36.LinearMipmapLinearFilter;
26081
+ texture.magFilter = THREE36.LinearFilter;
26025
26082
  texture.anisotropy = 16;
26026
26083
  texture.needsUpdate = true;
26027
26084
  return texture;
@@ -26029,7 +26086,7 @@ function createPadTextureForLayer({
26029
26086
 
26030
26087
  // src/utils/panel-outline-texture.ts
26031
26088
  import { su as su7 } from "@tscircuit/circuit-json-util";
26032
- import * as THREE36 from "three";
26089
+ import * as THREE37 from "three";
26033
26090
  var resolvePanelIdForTexture = (circuitJson) => {
26034
26091
  const panels = circuitJson.filter(
26035
26092
  (e) => e.type === "pcb_panel"
@@ -26097,17 +26154,17 @@ function createPanelOutlineTextureForLayer({
26097
26154
  );
26098
26155
  }
26099
26156
  });
26100
- const texture = new THREE36.CanvasTexture(canvas);
26157
+ const texture = new THREE37.CanvasTexture(canvas);
26101
26158
  texture.generateMipmaps = true;
26102
- texture.minFilter = THREE36.LinearMipmapLinearFilter;
26103
- texture.magFilter = THREE36.LinearFilter;
26159
+ texture.minFilter = THREE37.LinearMipmapLinearFilter;
26160
+ texture.magFilter = THREE37.LinearFilter;
26104
26161
  texture.anisotropy = 16;
26105
26162
  texture.needsUpdate = true;
26106
26163
  return texture;
26107
26164
  }
26108
26165
 
26109
26166
  // src/utils/trace-texture.ts
26110
- import * as THREE37 from "three";
26167
+ import * as THREE38 from "three";
26111
26168
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer3 } from "circuit-to-canvas";
26112
26169
  import { getElementRenderLayers, su as su8 } from "@tscircuit/circuit-json-util";
26113
26170
  function createTraceTextureForLayer({
@@ -26193,10 +26250,10 @@ function createTraceTextureForLayer({
26193
26250
  drawSoldermaskTop: false,
26194
26251
  drawSoldermaskBottom: false
26195
26252
  });
26196
- const texture = new THREE37.CanvasTexture(canvas);
26253
+ const texture = new THREE38.CanvasTexture(canvas);
26197
26254
  texture.generateMipmaps = true;
26198
- texture.minFilter = THREE37.LinearMipmapLinearFilter;
26199
- texture.magFilter = THREE37.LinearFilter;
26255
+ texture.minFilter = THREE38.LinearMipmapLinearFilter;
26256
+ texture.magFilter = THREE38.LinearFilter;
26200
26257
  texture.anisotropy = 16;
26201
26258
  texture.needsUpdate = true;
26202
26259
  return texture;
@@ -26204,7 +26261,7 @@ function createTraceTextureForLayer({
26204
26261
 
26205
26262
  // src/textures/create-copper-pour-texture-for-layer.ts
26206
26263
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer4 } from "circuit-to-canvas";
26207
- import * as THREE38 from "three";
26264
+ import * as THREE39 from "three";
26208
26265
  var toRgb = (colorArr) => {
26209
26266
  const [r = 0, g = 0, b = 0] = colorArr;
26210
26267
  return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
@@ -26320,17 +26377,17 @@ function createCopperPourTextureForLayer({
26320
26377
  if (!onlyCoveredBySoldermask) {
26321
26378
  setColorAndDraw(uncoveredPours, uncoveredColor);
26322
26379
  }
26323
- const texture = new THREE38.CanvasTexture(canvas);
26380
+ const texture = new THREE39.CanvasTexture(canvas);
26324
26381
  texture.generateMipmaps = true;
26325
- texture.minFilter = THREE38.LinearMipmapLinearFilter;
26326
- texture.magFilter = THREE38.LinearFilter;
26382
+ texture.minFilter = THREE39.LinearMipmapLinearFilter;
26383
+ texture.magFilter = THREE39.LinearFilter;
26327
26384
  texture.anisotropy = 16;
26328
26385
  texture.needsUpdate = true;
26329
26386
  return texture;
26330
26387
  }
26331
26388
 
26332
26389
  // src/textures/create-copper-text-texture-for-layer.ts
26333
- import * as THREE39 from "three";
26390
+ import * as THREE40 from "three";
26334
26391
 
26335
26392
  // src/textures/copper-text/copper-text-drawing.ts
26336
26393
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer5 } from "circuit-to-canvas";
@@ -26445,17 +26502,17 @@ function createCopperTextTextureForLayer({
26445
26502
  elements,
26446
26503
  copperColor
26447
26504
  });
26448
- const texture = new THREE39.CanvasTexture(canvas);
26505
+ const texture = new THREE40.CanvasTexture(canvas);
26449
26506
  texture.generateMipmaps = true;
26450
- texture.minFilter = THREE39.LinearMipmapLinearFilter;
26451
- texture.magFilter = THREE39.LinearFilter;
26507
+ texture.minFilter = THREE40.LinearMipmapLinearFilter;
26508
+ texture.magFilter = THREE40.LinearFilter;
26452
26509
  texture.anisotropy = 16;
26453
26510
  texture.needsUpdate = true;
26454
26511
  return texture;
26455
26512
  }
26456
26513
 
26457
26514
  // src/textures/create-fabrication-note-texture-for-layer.ts
26458
- import * as THREE40 from "three";
26515
+ import * as THREE41 from "three";
26459
26516
 
26460
26517
  // src/textures/fabrication-note/fabrication-note-drawing.ts
26461
26518
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer6 } from "circuit-to-canvas";
@@ -26685,17 +26742,17 @@ function createFabricationNoteTextureForLayer({
26685
26742
  bounds,
26686
26743
  elements
26687
26744
  });
26688
- const texture = new THREE40.CanvasTexture(canvas);
26745
+ const texture = new THREE41.CanvasTexture(canvas);
26689
26746
  texture.generateMipmaps = true;
26690
- texture.minFilter = THREE40.LinearMipmapLinearFilter;
26691
- texture.magFilter = THREE40.LinearFilter;
26747
+ texture.minFilter = THREE41.LinearMipmapLinearFilter;
26748
+ texture.magFilter = THREE41.LinearFilter;
26692
26749
  texture.anisotropy = 16;
26693
26750
  texture.needsUpdate = true;
26694
26751
  return texture;
26695
26752
  }
26696
26753
 
26697
26754
  // src/textures/create-keepout-texture-for-layer.ts
26698
- import * as THREE41 from "three";
26755
+ import * as THREE42 from "three";
26699
26756
 
26700
26757
  // src/textures/keepout/keepout-drawing.ts
26701
26758
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer7 } from "circuit-to-canvas";
@@ -26770,17 +26827,17 @@ function createKeepoutTextureForLayer({
26770
26827
  elements,
26771
26828
  keepoutColor
26772
26829
  });
26773
- const texture = new THREE41.CanvasTexture(canvas);
26830
+ const texture = new THREE42.CanvasTexture(canvas);
26774
26831
  texture.generateMipmaps = true;
26775
- texture.minFilter = THREE41.LinearMipmapLinearFilter;
26776
- texture.magFilter = THREE41.LinearFilter;
26832
+ texture.minFilter = THREE42.LinearMipmapLinearFilter;
26833
+ texture.magFilter = THREE42.LinearFilter;
26777
26834
  texture.anisotropy = 16;
26778
26835
  texture.needsUpdate = true;
26779
26836
  return texture;
26780
26837
  }
26781
26838
 
26782
26839
  // src/textures/create-pcb-note-texture-for-layer.ts
26783
- import * as THREE42 from "three";
26840
+ import * as THREE43 from "three";
26784
26841
 
26785
26842
  // src/textures/pcb-note/pcb-note-drawing.ts
26786
26843
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer8 } from "circuit-to-canvas";
@@ -26934,17 +26991,17 @@ function createPcbNoteTextureForLayer({
26934
26991
  bounds,
26935
26992
  elements
26936
26993
  });
26937
- const texture = new THREE42.CanvasTexture(canvas);
26994
+ const texture = new THREE43.CanvasTexture(canvas);
26938
26995
  texture.generateMipmaps = true;
26939
- texture.minFilter = THREE42.LinearMipmapLinearFilter;
26940
- texture.magFilter = THREE42.LinearFilter;
26996
+ texture.minFilter = THREE43.LinearMipmapLinearFilter;
26997
+ texture.magFilter = THREE43.LinearFilter;
26941
26998
  texture.anisotropy = 16;
26942
26999
  texture.needsUpdate = true;
26943
27000
  return texture;
26944
27001
  }
26945
27002
 
26946
27003
  // src/textures/create-silkscreen-texture-for-layer.ts
26947
- import * as THREE43 from "three";
27004
+ import * as THREE44 from "three";
26948
27005
 
26949
27006
  // src/textures/silkscreen/silkscreen-drawing.ts
26950
27007
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer9 } from "circuit-to-canvas";
@@ -27095,21 +27152,21 @@ function createSilkscreenTextureForLayer({
27095
27152
  silkscreenColor,
27096
27153
  soldermaskVisible
27097
27154
  });
27098
- const texture = new THREE43.CanvasTexture(canvas);
27155
+ const texture = new THREE44.CanvasTexture(canvas);
27099
27156
  texture.generateMipmaps = true;
27100
- texture.minFilter = THREE43.LinearMipmapLinearFilter;
27101
- texture.magFilter = THREE43.LinearFilter;
27157
+ texture.minFilter = THREE44.LinearMipmapLinearFilter;
27158
+ texture.magFilter = THREE44.LinearFilter;
27102
27159
  texture.anisotropy = 16;
27103
27160
  texture.needsUpdate = true;
27104
27161
  return texture;
27105
27162
  }
27106
27163
 
27107
27164
  // src/textures/create-soldermask-texture-for-layer.ts
27108
- import * as THREE45 from "three";
27165
+ import * as THREE46 from "three";
27109
27166
 
27110
27167
  // src/textures/soldermask/soldermask-drawing.ts
27111
27168
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer10 } from "circuit-to-canvas";
27112
- import * as THREE44 from "three";
27169
+ import * as THREE45 from "three";
27113
27170
  var toRgb2 = (colorArr) => {
27114
27171
  const [r = 0, g = 0, b = 0] = colorArr;
27115
27172
  return `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(
@@ -27121,7 +27178,7 @@ var getSoldermaskPalette = (boardData) => {
27121
27178
  soldermaskColors[boardData.material] ?? colors.fr4SolderMaskGreen
27122
27179
  );
27123
27180
  const legacySoldermaskOverCopper = boardData.material === "fr1" ? toRgb2(colors.fr1TracesWithMaskCopper) : toRgb2(colors.fr4TracesWithMaskGreen);
27124
- const requestedSoldermaskColor = resolveSoldermaskColor(boardData.solder_mask_color) ?? (boardData.material === "flex" ? new THREE44.Color(toRgb2(colors.flexAmber)) : null);
27181
+ const requestedSoldermaskColor = resolveSoldermaskColor(boardData.solder_mask_color) ?? (boardData.material === "flex" ? new THREE45.Color(toRgb2(colors.flexAmber)) : null);
27125
27182
  if (!requestedSoldermaskColor) {
27126
27183
  return {
27127
27184
  soldermask: legacySoldermask,
@@ -27130,11 +27187,11 @@ var getSoldermaskPalette = (boardData) => {
27130
27187
  transparent: "rgba(0,0,0,0)"
27131
27188
  };
27132
27189
  }
27133
- const copperColor = new THREE44.Color().setRGB(
27190
+ const copperColor = new THREE45.Color().setRGB(
27134
27191
  colors.copper[0],
27135
27192
  colors.copper[1],
27136
27193
  colors.copper[2],
27137
- THREE44.SRGBColorSpace
27194
+ THREE45.SRGBColorSpace
27138
27195
  );
27139
27196
  return {
27140
27197
  soldermask: soldermaskColorToCss(requestedSoldermaskColor),
@@ -27269,17 +27326,17 @@ function createSoldermaskTextureForLayer({
27269
27326
  elements,
27270
27327
  boardData
27271
27328
  });
27272
- const texture = new THREE45.CanvasTexture(canvas);
27329
+ const texture = new THREE46.CanvasTexture(canvas);
27273
27330
  texture.generateMipmaps = true;
27274
- texture.minFilter = THREE45.LinearMipmapLinearFilter;
27275
- texture.magFilter = THREE45.LinearFilter;
27331
+ texture.minFilter = THREE46.LinearMipmapLinearFilter;
27332
+ texture.magFilter = THREE46.LinearFilter;
27276
27333
  texture.anisotropy = 16;
27277
27334
  texture.needsUpdate = true;
27278
27335
  return texture;
27279
27336
  }
27280
27337
 
27281
27338
  // src/textures/create-through-hole-texture-for-layer.ts
27282
- import * as THREE46 from "three";
27339
+ import * as THREE47 from "three";
27283
27340
 
27284
27341
  // src/textures/through-hole/through-hole-drawing.ts
27285
27342
  import { CircuitToCanvasDrawer as CircuitToCanvasDrawer11 } from "circuit-to-canvas";
@@ -27374,10 +27431,10 @@ function createThroughHoleTextureForLayer({
27374
27431
  elements,
27375
27432
  copperColor
27376
27433
  });
27377
- const texture = new THREE46.CanvasTexture(canvas);
27434
+ const texture = new THREE47.CanvasTexture(canvas);
27378
27435
  texture.generateMipmaps = true;
27379
- texture.minFilter = THREE46.LinearMipmapLinearFilter;
27380
- texture.magFilter = THREE46.LinearFilter;
27436
+ texture.minFilter = THREE47.LinearMipmapLinearFilter;
27437
+ texture.magFilter = THREE47.LinearFilter;
27381
27438
  texture.anisotropy = 16;
27382
27439
  texture.needsUpdate = true;
27383
27440
  return texture;
@@ -27499,10 +27556,10 @@ var createCombinedTexture = ({
27499
27556
  applySoldermaskSurfaceFilter(ctx, canvasWidth, canvasHeight, {
27500
27557
  includeReflection: layer === "top"
27501
27558
  });
27502
- const combinedTexture = new THREE47.CanvasTexture(canvas);
27559
+ const combinedTexture = new THREE48.CanvasTexture(canvas);
27503
27560
  combinedTexture.generateMipmaps = false;
27504
- combinedTexture.minFilter = THREE47.LinearFilter;
27505
- combinedTexture.magFilter = THREE47.LinearFilter;
27561
+ combinedTexture.minFilter = THREE48.LinearFilter;
27562
+ combinedTexture.magFilter = THREE48.LinearFilter;
27506
27563
  combinedTexture.premultiplyAlpha = true;
27507
27564
  combinedTexture.anisotropy = 16;
27508
27565
  combinedTexture.needsUpdate = true;
@@ -27538,11 +27595,11 @@ var createMaskedCopperMask = ({
27538
27595
  height
27539
27596
  );
27540
27597
  ctx.globalCompositeOperation = "source-over";
27541
- const maskTexture = new THREE47.CanvasTexture(canvas);
27542
- maskTexture.colorSpace = THREE47.NoColorSpace;
27598
+ const maskTexture = new THREE48.CanvasTexture(canvas);
27599
+ maskTexture.colorSpace = THREE48.NoColorSpace;
27543
27600
  maskTexture.generateMipmaps = false;
27544
- maskTexture.minFilter = THREE47.LinearFilter;
27545
- maskTexture.magFilter = THREE47.LinearFilter;
27601
+ maskTexture.minFilter = THREE48.LinearFilter;
27602
+ maskTexture.magFilter = THREE48.LinearFilter;
27546
27603
  maskTexture.premultiplyAlpha = false;
27547
27604
  maskTexture.needsUpdate = true;
27548
27605
  return maskTexture;
@@ -27692,7 +27749,7 @@ function createCombinedBoardTextures({
27692
27749
  }
27693
27750
 
27694
27751
  // src/textures/create-three-texture-meshes.ts
27695
- import * as THREE49 from "three";
27752
+ import * as THREE50 from "three";
27696
27753
 
27697
27754
  // src/board-surface-textures.ts
27698
27755
  var REALISTIC_BOARD_SURFACE_MATERIAL = {
@@ -27715,7 +27772,7 @@ var PAD_COPPER_TEXTURE_MATERIAL = {
27715
27772
  };
27716
27773
 
27717
27774
  // src/utils/create-board-relief-textures.ts
27718
- import * as THREE48 from "three";
27775
+ import * as THREE49 from "three";
27719
27776
  var PLAIN_SOLDERMASK_HEIGHT = 0.22;
27720
27777
  var MASKED_COPPER_HEIGHT = 0.7;
27721
27778
  var EXPOSED_COPPER_HEIGHT = 0.86;
@@ -27810,13 +27867,13 @@ var getBoardSurfaceProfile = (r, g, b, hasMaskedCopper) => {
27810
27867
  return PLAIN_SOLDERMASK_PROFILE;
27811
27868
  };
27812
27869
  var createDataTexture = (canvas) => {
27813
- const texture = new THREE48.CanvasTexture(canvas);
27814
- texture.colorSpace = THREE48.NoColorSpace;
27870
+ const texture = new THREE49.CanvasTexture(canvas);
27871
+ texture.colorSpace = THREE49.NoColorSpace;
27815
27872
  texture.generateMipmaps = false;
27816
- texture.minFilter = THREE48.LinearFilter;
27817
- texture.magFilter = THREE48.LinearFilter;
27818
- texture.wrapS = THREE48.ClampToEdgeWrapping;
27819
- texture.wrapT = THREE48.ClampToEdgeWrapping;
27873
+ texture.minFilter = THREE49.LinearFilter;
27874
+ texture.magFilter = THREE49.LinearFilter;
27875
+ texture.wrapS = THREE49.ClampToEdgeWrapping;
27876
+ texture.wrapT = THREE49.ClampToEdgeWrapping;
27820
27877
  texture.needsUpdate = true;
27821
27878
  return texture;
27822
27879
  };
@@ -27940,16 +27997,16 @@ function createTexturePlane(config, boardData) {
27940
27997
  } = config;
27941
27998
  if (!texture) return null;
27942
27999
  const boardOutlineBounds = calculateOutlineBounds(boardData);
27943
- const planeGeom = new THREE49.PlaneGeometry(
28000
+ const planeGeom = new THREE50.PlaneGeometry(
27944
28001
  boardOutlineBounds.width,
27945
28002
  boardOutlineBounds.height
27946
28003
  );
27947
- texture.colorSpace = THREE49.SRGBColorSpace;
28004
+ texture.colorSpace = THREE50.SRGBColorSpace;
27948
28005
  const sharedMaterialOptions = {
27949
28006
  map: texture,
27950
28007
  transparent: true,
27951
28008
  alphaTest: 0.08,
27952
- side: THREE49.FrontSide,
28009
+ side: THREE50.FrontSide,
27953
28010
  depthWrite: true,
27954
28011
  polygonOffset: usePolygonOffset,
27955
28012
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
@@ -27958,12 +28015,12 @@ function createTexturePlane(config, boardData) {
27958
28015
  opacity: isFaux ? FAUX_BOARD_OPACITY : 1
27959
28016
  };
27960
28017
  const reliefTextures = createBoardReliefTextures(texture, maskedCopperMask);
27961
- const material = new THREE49.MeshPhysicalMaterial({
28018
+ const material = new THREE50.MeshPhysicalMaterial({
27962
28019
  ...sharedMaterialOptions,
27963
28020
  bumpMap: reliefTextures?.bumpMap ?? null,
27964
28021
  bumpScale: REALISTIC_BOARD_SURFACE_MATERIAL.bumpScale,
27965
28022
  normalMap: reliefTextures?.normalMap ?? null,
27966
- normalScale: new THREE49.Vector2(
28023
+ normalScale: new THREE50.Vector2(
27967
28024
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale,
27968
28025
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale
27969
28026
  ),
@@ -27977,7 +28034,7 @@ function createTexturePlane(config, boardData) {
27977
28034
  clearcoatRoughness: REALISTIC_BOARD_SURFACE_MATERIAL.clearcoatRoughness,
27978
28035
  envMapIntensity: 0.18
27979
28036
  });
27980
- const mesh = new THREE49.Mesh(planeGeom, material);
28037
+ const mesh = new THREE50.Mesh(planeGeom, material);
27981
28038
  mesh.position.set(
27982
28039
  boardOutlineBounds.centerX,
27983
28040
  boardOutlineBounds.centerY,
@@ -28025,10 +28082,10 @@ function createTextureMeshes(textures, boardData, pcbThickness, isFaux = false)
28025
28082
  }
28026
28083
 
28027
28084
  // src/three-components/JscadBoardTextures.tsx
28028
- import * as THREE50 from "three";
28085
+ import * as THREE51 from "three";
28029
28086
 
28030
28087
  // src/hooks/useBoardTextureVisibility.ts
28031
- import { useMemo as useMemo22 } from "react";
28088
+ import { useMemo as useMemo23 } from "react";
28032
28089
  var useBoardTextureVisibility = (visibility) => {
28033
28090
  const {
28034
28091
  boardBody,
@@ -28041,7 +28098,7 @@ var useBoardTextureVisibility = (visibility) => {
28041
28098
  keepout,
28042
28099
  pcbNotes
28043
28100
  } = visibility;
28044
- return useMemo22(
28101
+ return useMemo23(
28045
28102
  () => ({
28046
28103
  boardBody,
28047
28104
  topCopper,
@@ -28103,7 +28160,7 @@ function JscadBoardTextures({
28103
28160
  const { rootObject } = useThree();
28104
28161
  const { visibility } = useLayerVisibility();
28105
28162
  const textureVisibility = useBoardTextureVisibility(visibility);
28106
- const boardData = useMemo23(() => {
28163
+ const boardData = useMemo24(() => {
28107
28164
  const panels = circuitJson.filter(
28108
28165
  (e) => e.type === "pcb_panel"
28109
28166
  );
@@ -28130,11 +28187,11 @@ function JscadBoardTextures({
28130
28187
  );
28131
28188
  return boardsNotInPanel.length > 0 ? boardsNotInPanel[0] : null;
28132
28189
  }, [circuitJson]);
28133
- const traceTextureResolution = useMemo23(() => {
28190
+ const traceTextureResolution = useMemo24(() => {
28134
28191
  if (!boardData) return TRACE_TEXTURE_RESOLUTION;
28135
28192
  return getLayerTextureResolution(boardData, TRACE_TEXTURE_RESOLUTION);
28136
28193
  }, [boardData]);
28137
- const textures = useMemo23(() => {
28194
+ const textures = useMemo24(() => {
28138
28195
  if (!boardData?.width || !boardData.height) return null;
28139
28196
  return createCombinedBoardTextures({
28140
28197
  circuitJson,
@@ -28143,7 +28200,7 @@ function JscadBoardTextures({
28143
28200
  visibility: textureVisibility
28144
28201
  });
28145
28202
  }, [circuitJson, boardData, traceTextureResolution, textureVisibility]);
28146
- useEffect30(() => {
28203
+ useEffect31(() => {
28147
28204
  if (!rootObject || !boardData || !textures) return;
28148
28205
  const meshes = [];
28149
28206
  const disposeTextureMaterial = (material) => {
@@ -28163,7 +28220,7 @@ function JscadBoardTextures({
28163
28220
  const typedMaterial = material;
28164
28221
  for (const prop of textureProps) {
28165
28222
  const texture = typedMaterial[prop];
28166
- if (texture && texture instanceof THREE50.Texture) {
28223
+ if (texture && texture instanceof THREE51.Texture) {
28167
28224
  texture.dispose();
28168
28225
  typedMaterial[prop] = null;
28169
28226
  }
@@ -28182,16 +28239,16 @@ function JscadBoardTextures({
28182
28239
  }) => {
28183
28240
  if (!texture) return null;
28184
28241
  const boardOutlineBounds = calculateOutlineBounds(boardData);
28185
- const planeGeom = new THREE50.PlaneGeometry(
28242
+ const planeGeom = new THREE51.PlaneGeometry(
28186
28243
  boardOutlineBounds.width,
28187
28244
  boardOutlineBounds.height
28188
28245
  );
28189
- texture.colorSpace = THREE50.SRGBColorSpace;
28246
+ texture.colorSpace = THREE51.SRGBColorSpace;
28190
28247
  const sharedMaterialOptions = {
28191
28248
  map: texture,
28192
28249
  transparent: true,
28193
28250
  alphaTest: 0.08,
28194
- side: THREE50.FrontSide,
28251
+ side: THREE51.FrontSide,
28195
28252
  depthWrite,
28196
28253
  polygonOffset: usePolygonOffset,
28197
28254
  polygonOffsetFactor: usePolygonOffset ? -4 : 0,
@@ -28202,12 +28259,12 @@ function JscadBoardTextures({
28202
28259
  texture,
28203
28260
  maskedCopperMask
28204
28261
  );
28205
- const material = new THREE50.MeshPhysicalMaterial({
28262
+ const material = new THREE51.MeshPhysicalMaterial({
28206
28263
  ...sharedMaterialOptions,
28207
28264
  bumpMap: reliefTextures?.bumpMap ?? null,
28208
28265
  bumpScale: REALISTIC_BOARD_SURFACE_MATERIAL.bumpScale,
28209
28266
  normalMap: reliefTextures?.normalMap ?? null,
28210
- normalScale: new THREE50.Vector2(
28267
+ normalScale: new THREE51.Vector2(
28211
28268
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale,
28212
28269
  REALISTIC_BOARD_SURFACE_MATERIAL.normalScale
28213
28270
  ),
@@ -28219,7 +28276,7 @@ function JscadBoardTextures({
28219
28276
  clearcoatRoughness: REALISTIC_BOARD_SURFACE_MATERIAL.clearcoatRoughness,
28220
28277
  envMapIntensity: 0.18
28221
28278
  });
28222
- const mesh = new THREE50.Mesh(planeGeom, material);
28279
+ const mesh = new THREE51.Mesh(planeGeom, material);
28223
28280
  mesh.position.set(
28224
28281
  boardOutlineBounds.centerX,
28225
28282
  boardOutlineBounds.centerY,
@@ -28269,7 +28326,7 @@ function JscadBoardTextures({
28269
28326
  for (const material of mesh.material) {
28270
28327
  disposeTextureMaterial(material);
28271
28328
  }
28272
- } else if (mesh.material instanceof THREE50.Material) {
28329
+ } else if (mesh.material instanceof THREE51.Material) {
28273
28330
  disposeTextureMaterial(mesh.material);
28274
28331
  }
28275
28332
  }
@@ -28281,8 +28338,8 @@ function JscadBoardTextures({
28281
28338
  }
28282
28339
 
28283
28340
  // src/three-components/STLModel.tsx
28284
- import { useState as useState19, useEffect as useEffect31, useMemo as useMemo24 } from "react";
28285
- import * as THREE51 from "three";
28341
+ import { useState as useState19, useEffect as useEffect32, useMemo as useMemo25 } from "react";
28342
+ import * as THREE52 from "three";
28286
28343
  import { STLLoader as STLLoader2 } from "three-stdlib";
28287
28344
  function STLModel({
28288
28345
  stlUrl,
@@ -28294,7 +28351,7 @@ function STLModel({
28294
28351
  }) {
28295
28352
  const { rootObject } = useThree();
28296
28353
  const [geom, setGeom] = useState19(null);
28297
- useEffect31(() => {
28354
+ useEffect32(() => {
28298
28355
  const loader = new STLLoader2();
28299
28356
  if (stlData) {
28300
28357
  try {
@@ -28312,18 +28369,18 @@ function STLModel({
28312
28369
  });
28313
28370
  }
28314
28371
  }, [stlUrl, stlData]);
28315
- const mesh = useMemo24(() => {
28372
+ const mesh = useMemo25(() => {
28316
28373
  if (!geom) return null;
28317
28374
  const isBoardLayer = layerType === "board";
28318
- const material = new THREE51.MeshStandardMaterial({
28319
- color: Array.isArray(color) ? new THREE51.Color(color[0], color[1], color[2]) : color,
28375
+ const material = new THREE52.MeshStandardMaterial({
28376
+ color: Array.isArray(color) ? new THREE52.Color(color[0], color[1], color[2]) : color,
28320
28377
  transparent: opacity !== 1,
28321
28378
  opacity,
28322
28379
  polygonOffset: isBoardLayer,
28323
28380
  polygonOffsetFactor: isBoardLayer ? 6 : 0,
28324
28381
  polygonOffsetUnits: isBoardLayer ? 6 : 0
28325
28382
  });
28326
- const createdMesh = new THREE51.Mesh(geom, material);
28383
+ const createdMesh = new THREE52.Mesh(geom, material);
28327
28384
  createdMesh.renderOrder = isBoardLayer ? -1 : 1;
28328
28385
  configureObjectShadows(createdMesh, {
28329
28386
  castShadow: !isBoardLayer && opacity === 1,
@@ -28331,7 +28388,7 @@ function STLModel({
28331
28388
  });
28332
28389
  return createdMesh;
28333
28390
  }, [geom, color, opacity, layerType]);
28334
- useEffect31(() => {
28391
+ useEffect32(() => {
28335
28392
  if (!rootObject || !mesh) return;
28336
28393
  rootObject.add(mesh);
28337
28394
  return () => {
@@ -28348,7 +28405,7 @@ function STLModel({
28348
28405
  }
28349
28406
 
28350
28407
  // src/three-components/VisibleSTLModel.tsx
28351
- import { jsx as jsx20 } from "react/jsx-runtime";
28408
+ import { jsx as jsx21 } from "react/jsx-runtime";
28352
28409
  function VisibleSTLModel({
28353
28410
  stlData,
28354
28411
  color,
@@ -28371,7 +28428,7 @@ function VisibleSTLModel({
28371
28428
  if (!shouldShow) {
28372
28429
  return null;
28373
28430
  }
28374
- return /* @__PURE__ */ jsx20(
28431
+ return /* @__PURE__ */ jsx21(
28375
28432
  STLModel,
28376
28433
  {
28377
28434
  stlData,
@@ -28385,8 +28442,8 @@ function VisibleSTLModel({
28385
28442
  // src/three-components/CadCable.tsx
28386
28443
  import { parseCableString } from "@tscircuit/cableprinter";
28387
28444
  import { createCableMeshes } from "jscad-electronics/cables";
28388
- import { useEffect as useEffect32, useMemo as useMemo25 } from "react";
28389
- import * as THREE52 from "three";
28445
+ import { useEffect as useEffect33, useMemo as useMemo26 } from "react";
28446
+ import * as THREE53 from "three";
28390
28447
  var isCadCableElement = (element) => {
28391
28448
  if (!element || typeof element !== "object") return false;
28392
28449
  const candidate = element;
@@ -28403,14 +28460,14 @@ var getConnectorPin1Side = ({
28403
28460
  const endpoint = end === "start" ? path[0] : path[path.length - 1];
28404
28461
  const adjacent = end === "start" ? path[1] : path[path.length - 2];
28405
28462
  if (!endpoint || !adjacent) return void 0;
28406
- const cableAxis = new THREE52.Vector3(
28463
+ const cableAxis = new THREE53.Vector3(
28407
28464
  adjacent.x - endpoint.x,
28408
28465
  adjacent.y - endpoint.y,
28409
28466
  adjacent.z - endpoint.z
28410
28467
  );
28411
28468
  if (cableAxis.lengthSq() < 1e-12) return void 0;
28412
28469
  cableAxis.normalize();
28413
- const pin1Side = new THREE52.Vector3(
28470
+ const pin1Side = new THREE53.Vector3(
28414
28471
  pin1Position.x - endpoint.x,
28415
28472
  pin1Position.y - endpoint.y,
28416
28473
  pin1Position.z - endpoint.z
@@ -28436,28 +28493,28 @@ var createCadCableObject = (cable) => {
28436
28493
  end: "end"
28437
28494
  })
28438
28495
  });
28439
- const group = new THREE52.Group();
28496
+ const group = new THREE53.Group();
28440
28497
  group.name = `cad-cable-${cable.cad_cable_id}`;
28441
- group.userData = { cadCableId: cable.cad_cable_id, name: cable.name };
28498
+ group.userData = { cad_cable_id: cable.cad_cable_id, name: cable.name };
28442
28499
  for (const cableMesh of cableMeshes) {
28443
- let geometry = new THREE52.BufferGeometry();
28500
+ let geometry = new THREE53.BufferGeometry();
28444
28501
  geometry.setAttribute(
28445
28502
  "position",
28446
- new THREE52.Float32BufferAttribute(cableMesh.positions, 3)
28503
+ new THREE53.Float32BufferAttribute(cableMesh.positions, 3)
28447
28504
  );
28448
28505
  geometry.setIndex(cableMesh.indices);
28449
28506
  if (!cableMesh.smooth) geometry = geometry.toNonIndexed();
28450
28507
  geometry.computeVertexNormals();
28451
28508
  const [red, green, blue, alpha] = cableMesh.color;
28452
- const material = new THREE52.MeshStandardMaterial({
28453
- color: new THREE52.Color(red, green, blue),
28509
+ const material = new THREE53.MeshStandardMaterial({
28510
+ color: new THREE53.Color(red, green, blue),
28454
28511
  metalness: cableMesh.material?.metalness ?? 0,
28455
28512
  roughness: cableMesh.material?.roughness ?? 0.7,
28456
28513
  opacity: alpha,
28457
28514
  transparent: alpha < 1,
28458
- side: THREE52.DoubleSide
28515
+ side: THREE53.DoubleSide
28459
28516
  });
28460
- const mesh = new THREE52.Mesh(geometry, material);
28517
+ const mesh = new THREE53.Mesh(geometry, material);
28461
28518
  mesh.name = `${group.name}:${cableMesh.name}`;
28462
28519
  configureObjectShadows(mesh, { castShadow: true, receiveShadow: true });
28463
28520
  group.add(mesh);
@@ -28466,7 +28523,7 @@ var createCadCableObject = (cable) => {
28466
28523
  };
28467
28524
  var disposeCadCableObject = (group) => {
28468
28525
  group.traverse((object) => {
28469
- if (!(object instanceof THREE52.Mesh)) return;
28526
+ if (!(object instanceof THREE53.Mesh)) return;
28470
28527
  object.geometry.dispose();
28471
28528
  const materials2 = Array.isArray(object.material) ? object.material : [object.material];
28472
28529
  for (const material of materials2) material.dispose();
@@ -28474,7 +28531,7 @@ var disposeCadCableObject = (group) => {
28474
28531
  };
28475
28532
  var CadCable = ({ cable }) => {
28476
28533
  const { rootObject } = useThree();
28477
- const cableObject = useMemo25(() => {
28534
+ const cableObject = useMemo26(() => {
28478
28535
  try {
28479
28536
  return createCadCableObject(cable);
28480
28537
  } catch (error) {
@@ -28482,7 +28539,7 @@ var CadCable = ({ cable }) => {
28482
28539
  return null;
28483
28540
  }
28484
28541
  }, [cable]);
28485
- useEffect32(() => {
28542
+ useEffect33(() => {
28486
28543
  if (!cableObject) return;
28487
28544
  rootObject.add(cableObject);
28488
28545
  return () => {
@@ -28598,7 +28655,7 @@ function addFauxBoardIfNeeded(circuitJson) {
28598
28655
  }
28599
28656
 
28600
28657
  // src/CadViewerJscad.tsx
28601
- import { jsx as jsx21, jsxs as jsxs6 } from "react/jsx-runtime";
28658
+ import { jsx as jsx22, jsxs as jsxs6 } from "react/jsx-runtime";
28602
28659
  var CadViewerJscad = forwardRef3(
28603
28660
  ({
28604
28661
  circuitJson,
@@ -28609,16 +28666,16 @@ var CadViewerJscad = forwardRef3(
28609
28666
  onCameraControllerReady,
28610
28667
  resolveStaticAsset,
28611
28668
  referenceObject,
28612
- hiddenCadComponentIds
28669
+ objectVisibility
28613
28670
  }, ref) => {
28614
28671
  const childrenSoup = useConvertChildrenToCircuitJson(children);
28615
- const internalCircuitJson = useMemo26(() => {
28672
+ const internalCircuitJson = useMemo27(() => {
28616
28673
  return addFauxBoardIfNeeded(
28617
28674
  circuitJson ?? childrenSoup
28618
28675
  );
28619
28676
  }, [circuitJson, childrenSoup]);
28620
28677
  const boardGeom = useBoardGeomBuilder(internalCircuitJson);
28621
- const isFauxBoard = useMemo26(() => {
28678
+ const isFauxBoard = useMemo27(() => {
28622
28679
  if (!internalCircuitJson) return false;
28623
28680
  try {
28624
28681
  const board = su12(internalCircuitJson).pcb_board.list()[0];
@@ -28627,7 +28684,7 @@ var CadViewerJscad = forwardRef3(
28627
28684
  return false;
28628
28685
  }
28629
28686
  }, [internalCircuitJson]);
28630
- const boardDimensions = useMemo26(() => {
28687
+ const boardDimensions = useMemo27(() => {
28631
28688
  if (!internalCircuitJson) return void 0;
28632
28689
  try {
28633
28690
  const board = su12(internalCircuitJson).pcb_board.list()[0];
@@ -28639,7 +28696,7 @@ var CadViewerJscad = forwardRef3(
28639
28696
  return void 0;
28640
28697
  }
28641
28698
  }, [internalCircuitJson]);
28642
- const boardCenter = useMemo26(() => {
28699
+ const boardCenter = useMemo27(() => {
28643
28700
  if (!internalCircuitJson) return void 0;
28644
28701
  try {
28645
28702
  const board = su12(internalCircuitJson).pcb_board.list()[0];
@@ -28651,7 +28708,7 @@ var CadViewerJscad = forwardRef3(
28651
28708
  return void 0;
28652
28709
  }
28653
28710
  }, [internalCircuitJson]);
28654
- const cameraSessionScope = useMemo26(() => {
28711
+ const cameraSessionScope = useMemo27(() => {
28655
28712
  if (!internalCircuitJson) return void 0;
28656
28713
  const board = su12(internalCircuitJson).pcb_board.list()[0];
28657
28714
  if (!board) return void 0;
@@ -28661,13 +28718,20 @@ var CadViewerJscad = forwardRef3(
28661
28718
  dimensions: boardDimensions
28662
28719
  });
28663
28720
  }, [internalCircuitJson, boardCenter, boardDimensions]);
28664
- const initialCameraPosition = useMemo26(() => {
28721
+ const initialCameraPosition = useMemo27(() => {
28665
28722
  return getInitialCameraPosition({ boardDimensions, boardCenter });
28666
28723
  }, [boardDimensions, boardCenter]);
28667
28724
  const pcbThickness = usePcbThickness(internalCircuitJson);
28668
28725
  const { stls: boardStls, loading } = useStlsFromGeom(boardGeom);
28669
- const cad_components = su12(internalCircuitJson).cad_component.list().filter((cad) => !hiddenCadComponentIds?.has(cad.cad_component_id));
28670
- const cadCables = getCadCables(internalCircuitJson);
28726
+ const renderedBoardId = useMemo27(() => {
28727
+ const panel = internalCircuitJson.find((e) => e.type === "pcb_panel");
28728
+ if (panel?.type === "pcb_panel") return panel.pcb_panel_id;
28729
+ return su12(internalCircuitJson).pcb_board.list().find((board) => !board.pcb_panel_id)?.pcb_board_id;
28730
+ }, [internalCircuitJson]);
28731
+ const cad_components = su12(internalCircuitJson).cad_component.list().filter((cad) => !isObjectHidden(objectVisibility, cad.cad_component_id));
28732
+ const cadCables = getCadCables(internalCircuitJson).filter(
28733
+ (cable) => !isObjectHidden(objectVisibility, cable.cad_cable_id)
28734
+ );
28671
28735
  return /* @__PURE__ */ jsxs6(
28672
28736
  CadViewerContainer,
28673
28737
  {
@@ -28682,29 +28746,38 @@ var CadViewerJscad = forwardRef3(
28682
28746
  onUserInteraction,
28683
28747
  onCameraControllerReady,
28684
28748
  children: [
28685
- boardStls.map(({ stlData, color, layerType }, index2) => /* @__PURE__ */ jsx21(
28686
- VisibleSTLModel,
28687
- {
28688
- stlData,
28689
- color,
28690
- opacity: index2 === 0 ? isFauxBoard ? 0.8 : 0.95 : 1,
28691
- layerType
28692
- },
28693
- `board-${index2}`
28694
- )),
28695
- /* @__PURE__ */ jsx21(
28696
- JscadBoardTextures,
28749
+ /* @__PURE__ */ jsxs6(
28750
+ BoardGroup,
28697
28751
  {
28698
- circuitJson: internalCircuitJson,
28699
- pcbThickness,
28700
- isFaux: isFauxBoard
28752
+ pcbBoardId: renderedBoardId,
28753
+ hidden: isObjectHidden(objectVisibility, renderedBoardId),
28754
+ children: [
28755
+ boardStls.map(({ stlData, color, layerType }, index2) => /* @__PURE__ */ jsx22(
28756
+ VisibleSTLModel,
28757
+ {
28758
+ stlData,
28759
+ color,
28760
+ opacity: index2 === 0 ? isFauxBoard ? 0.8 : 0.95 : 1,
28761
+ layerType
28762
+ },
28763
+ `board-${index2}`
28764
+ )),
28765
+ /* @__PURE__ */ jsx22(
28766
+ JscadBoardTextures,
28767
+ {
28768
+ circuitJson: internalCircuitJson,
28769
+ pcbThickness,
28770
+ isFaux: isFauxBoard
28771
+ }
28772
+ )
28773
+ ]
28701
28774
  }
28702
28775
  ),
28703
- cad_components.map((cad_component) => /* @__PURE__ */ jsx21(
28776
+ cad_components.map((cad_component) => /* @__PURE__ */ jsx22(
28704
28777
  ThreeErrorBoundary,
28705
28778
  {
28706
- fallback: ({ error }) => /* @__PURE__ */ jsx21(Error3d, { cad_component, error }),
28707
- children: /* @__PURE__ */ jsx21(
28779
+ fallback: ({ error }) => /* @__PURE__ */ jsx22(Error3d, { cad_component, error }),
28780
+ children: /* @__PURE__ */ jsx22(
28708
28781
  AnyCadComponent,
28709
28782
  {
28710
28783
  cad_component,
@@ -28716,7 +28789,7 @@ var CadViewerJscad = forwardRef3(
28716
28789
  },
28717
28790
  cad_component.cad_component_id
28718
28791
  )),
28719
- cadCables.map((cable) => /* @__PURE__ */ jsx21(CadCable, { cable }, cable.cad_cable_id))
28792
+ cadCables.map((cable) => /* @__PURE__ */ jsx22(CadCable, { cable }, cable.cad_cable_id))
28720
28793
  ]
28721
28794
  }
28722
28795
  );
@@ -29977,13 +30050,13 @@ function createStiffenerMesh({
29977
30050
  }
29978
30051
 
29979
30052
  // src/CadViewerManifold.tsx
29980
- import { useEffect as useEffect34, useMemo as useMemo28, useState as useState21 } from "react";
29981
- import * as THREE60 from "three";
30053
+ import { useEffect as useEffect35, useMemo as useMemo29, useState as useState21 } from "react";
30054
+ import * as THREE61 from "three";
29982
30055
 
29983
30056
  // src/hooks/useManifoldBoardBuilder.ts
29984
30057
  import { su as su16 } from "@tscircuit/circuit-json-util";
29985
- import { useEffect as useEffect33, useMemo as useMemo27, useRef as useRef10, useState as useState20 } from "react";
29986
- import * as THREE56 from "three";
30058
+ import { useEffect as useEffect34, useMemo as useMemo28, useRef as useRef10, useState as useState20 } from "react";
30059
+ import * as THREE57 from "three";
29987
30060
 
29988
30061
  // src/utils/manifold/create-manifold-board.ts
29989
30062
  var arePointsClockwise2 = (points) => {
@@ -30332,17 +30405,17 @@ function processNonPlatedHolesForManifold(Manifold, CrossSection, circuitJson, p
30332
30405
 
30333
30406
  // src/utils/manifold/process-plated-holes.ts
30334
30407
  import { su as su15 } from "@tscircuit/circuit-json-util";
30335
- import * as THREE54 from "three";
30408
+ import * as THREE55 from "three";
30336
30409
 
30337
30410
  // src/utils/manifold-mesh-to-three-geometry.ts
30338
- import * as THREE53 from "three";
30411
+ import * as THREE54 from "three";
30339
30412
  function manifoldMeshToThreeGeometry(manifoldMesh) {
30340
- const geometry = new THREE53.BufferGeometry();
30413
+ const geometry = new THREE54.BufferGeometry();
30341
30414
  geometry.setAttribute(
30342
30415
  "position",
30343
- new THREE53.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
30416
+ new THREE54.Float32BufferAttribute(manifoldMesh.vertProperties, 3)
30344
30417
  );
30345
- geometry.setIndex(new THREE53.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
30418
+ geometry.setIndex(new THREE54.Uint32BufferAttribute(manifoldMesh.triVerts, 1));
30346
30419
  if (manifoldMesh.runIndex && manifoldMesh.runIndex.length > 1 && manifoldMesh.runOriginalID) {
30347
30420
  for (let i = 0; i < manifoldMesh.runIndex.length - 1; i++) {
30348
30421
  const start = manifoldMesh.runIndex[i];
@@ -30376,7 +30449,7 @@ var createEllipsePoints = (width, height, segments) => {
30376
30449
  }
30377
30450
  return points;
30378
30451
  };
30379
- var COPPER_COLOR = new THREE54.Color(...colors.copper);
30452
+ var COPPER_COLOR = new THREE55.Color(...colors.copper);
30380
30453
  var PLATED_HOLE_LIP_HEIGHT = 0.05;
30381
30454
  var PLATED_HOLE_PAD_THICKNESS = 3e-3;
30382
30455
  var PLATED_HOLE_SURFACE_CLEARANCE = 5e-4;
@@ -31016,7 +31089,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
31016
31089
  }
31017
31090
 
31018
31091
  // src/utils/manifold/process-vias.ts
31019
- import * as THREE55 from "three";
31092
+ import * as THREE56 from "three";
31020
31093
 
31021
31094
  // src/utils/via-geoms.ts
31022
31095
  function createViaCopper2({
@@ -31054,7 +31127,7 @@ function createViaCopper2({
31054
31127
  }
31055
31128
 
31056
31129
  // src/utils/manifold/process-vias.ts
31057
- var COPPER_COLOR2 = new THREE55.Color(...colors.copper);
31130
+ var COPPER_COLOR2 = new THREE56.Color(...colors.copper);
31058
31131
  function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, boardClipVolume, otherHoleDrills = []) {
31059
31132
  const viaBoardDrills = [];
31060
31133
  const pcbVias = getPcbVias(circuitJson);
@@ -31138,7 +31211,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
31138
31211
  const [error, setError] = useState20(null);
31139
31212
  const [isLoading, setIsLoading] = useState20(true);
31140
31213
  const manifoldInstancesForCleanup = useRef10([]);
31141
- const boardData = useMemo27(() => {
31214
+ const boardData = useMemo28(() => {
31142
31215
  const panels = circuitJson.filter(
31143
31216
  (e) => e.type === "pcb_panel"
31144
31217
  );
@@ -31163,15 +31236,15 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
31163
31236
  const boardsNotInPanel = boards.filter((b) => !b.pcb_panel_id);
31164
31237
  return boardsNotInPanel.length > 0 ? boardsNotInPanel[0] : null;
31165
31238
  }, [circuitJson]);
31166
- const isFauxBoard = useMemo27(() => {
31239
+ const isFauxBoard = useMemo28(() => {
31167
31240
  const boards = su16(circuitJson).pcb_board.list();
31168
31241
  return boards.length > 0 && boards[0].pcb_board_id === "faux-board";
31169
31242
  }, [circuitJson]);
31170
- const traceTextureResolution = useMemo27(() => {
31243
+ const traceTextureResolution = useMemo28(() => {
31171
31244
  if (!boardData) return TRACE_TEXTURE_RESOLUTION;
31172
31245
  return getLayerTextureResolution(boardData, TRACE_TEXTURE_RESOLUTION);
31173
31246
  }, [boardData]);
31174
- useEffect33(() => {
31247
+ useEffect34(() => {
31175
31248
  if (!manifoldJSModule || !boardData) {
31176
31249
  setGeoms(null);
31177
31250
  setPcbThickness(null);
@@ -31302,7 +31375,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
31302
31375
  {
31303
31376
  key: "plated-holes-union",
31304
31377
  geometry: cutPlatedGeom,
31305
- color: new THREE56.Color(
31378
+ color: new THREE57.Color(
31306
31379
  colors.copper[0],
31307
31380
  colors.copper[1],
31308
31381
  colors.copper[2]
@@ -31351,7 +31424,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
31351
31424
  manifoldInstancesForCleanup.current = [];
31352
31425
  };
31353
31426
  }, [manifoldJSModule, circuitJson, boardData]);
31354
- const textures = useMemo27(() => {
31427
+ const textures = useMemo28(() => {
31355
31428
  if (!boardData || !traceTextureResolution) return null;
31356
31429
  return createCombinedBoardTextures({
31357
31430
  circuitJson,
@@ -31372,7 +31445,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson, visibility) => {
31372
31445
  };
31373
31446
 
31374
31447
  // src/utils/flex-meshes.ts
31375
- import * as THREE57 from "three";
31448
+ import * as THREE58 from "three";
31376
31449
  function restoreOutlinePrecision(point, outline, tolerance) {
31377
31450
  let distanceSquared = tolerance * tolerance;
31378
31451
  let closest;
@@ -31407,7 +31480,7 @@ function meshToSurface(mesh, center, outline) {
31407
31480
  const triangles = [];
31408
31481
  for (let i = 0; i < position.count; i += 3) {
31409
31482
  const vertices = [0, 1, 2].map((j) => {
31410
- const v = new THREE57.Vector3().fromBufferAttribute(position, i + j);
31483
+ const v = new THREE58.Vector3().fromBufferAttribute(position, i + j);
31411
31484
  const localMagnitude = Math.max(
31412
31485
  1,
31413
31486
  Math.abs(v.x),
@@ -31430,7 +31503,7 @@ function meshToSurface(mesh, center, outline) {
31430
31503
  return { x: v.x - center.x, y: v.y - center.y, z: v.z };
31431
31504
  });
31432
31505
  const [a, b, c] = vertices;
31433
- const n = new THREE57.Vector3(b.x - a.x, b.y - a.y, b.z - a.z).cross(new THREE57.Vector3(c.x - a.x, c.y - a.y, c.z - a.z)).normalize();
31506
+ const n = new THREE58.Vector3(b.x - a.x, b.y - a.y, b.z - a.z).cross(new THREE58.Vector3(c.x - a.x, c.y - a.y, c.z - a.z)).normalize();
31434
31507
  triangles.push({
31435
31508
  vertices,
31436
31509
  normal: { x: n.x, y: n.y, z: n.z },
@@ -31453,13 +31526,13 @@ function surfaceToGeometry(surface, center) {
31453
31526
  normals.push(triangle.normal.x, triangle.normal.y, triangle.normal.z);
31454
31527
  uvs.push(triangle.uvs?.[i]?.u ?? 0, triangle.uvs?.[i]?.v ?? 0);
31455
31528
  });
31456
- const geometry = new THREE57.BufferGeometry();
31529
+ const geometry = new THREE58.BufferGeometry();
31457
31530
  geometry.setAttribute(
31458
31531
  "position",
31459
- new THREE57.Float32BufferAttribute(positions, 3)
31532
+ new THREE58.Float32BufferAttribute(positions, 3)
31460
31533
  );
31461
- geometry.setAttribute("normal", new THREE57.Float32BufferAttribute(normals, 3));
31462
- geometry.setAttribute("uv", new THREE57.Float32BufferAttribute(uvs, 2));
31534
+ geometry.setAttribute("normal", new THREE58.Float32BufferAttribute(normals, 3));
31535
+ geometry.setAttribute("uv", new THREE58.Float32BufferAttribute(uvs, 2));
31463
31536
  geometry.computeBoundingBox();
31464
31537
  geometry.computeBoundingSphere();
31465
31538
  return geometry;
@@ -31512,7 +31585,7 @@ function createFlexMeshes(geometryMeshes, textureMeshes, json, foldPcbs) {
31512
31585
  z: mesh.position.z
31513
31586
  }));
31514
31587
  const uvs = vertices.map((p) => {
31515
- const local = new THREE57.Vector3(
31588
+ const local = new THREE58.Vector3(
31516
31589
  p.x + board.center.x,
31517
31590
  p.y + board.center.y,
31518
31591
  p.z
@@ -31536,7 +31609,7 @@ function createFlexMeshes(geometryMeshes, textureMeshes, json, foldPcbs) {
31536
31609
  return result;
31537
31610
  }) : textureMeshes;
31538
31611
  for (const stiffener of stiffeners) {
31539
- const mesh = new THREE57.Mesh(
31612
+ const mesh = new THREE58.Mesh(
31540
31613
  surfaceToGeometry(
31541
31614
  createStiffenerMesh({
31542
31615
  stiffener,
@@ -31545,16 +31618,16 @@ function createFlexMeshes(geometryMeshes, textureMeshes, json, foldPcbs) {
31545
31618
  }),
31546
31619
  board.center
31547
31620
  ),
31548
- new THREE57.MeshStandardMaterial({
31621
+ new THREE58.MeshStandardMaterial({
31549
31622
  color: stiffener.material === "fr4" ? "#879568" : stiffener.material === "polyimide" ? "#bd7f27" : "#b8bdc4",
31550
- side: THREE57.DoubleSide
31623
+ side: THREE58.DoubleSide
31551
31624
  })
31552
31625
  );
31553
31626
  mesh.name = "board-stiffener";
31554
31627
  configureObjectShadows(mesh);
31555
31628
  geometry.push(mesh);
31556
31629
  }
31557
- const bounds = new THREE57.Box3();
31630
+ const bounds = new THREE58.Box3();
31558
31631
  for (const mesh of [...geometry, ...textures]) bounds.expandByObject(mesh);
31559
31632
  return {
31560
31633
  geometryMeshes: geometry,
@@ -31571,11 +31644,11 @@ function createFlexMeshes(geometryMeshes, textureMeshes, json, foldPcbs) {
31571
31644
  }
31572
31645
 
31573
31646
  // src/utils/manifold/create-three-geometry-meshes.ts
31574
- import * as THREE59 from "three";
31647
+ import * as THREE60 from "three";
31575
31648
 
31576
31649
  // src/utils/create-board-material.ts
31577
- import * as THREE58 from "three";
31578
- var DEFAULT_SIDE = THREE58.DoubleSide;
31650
+ import * as THREE59 from "three";
31651
+ var DEFAULT_SIDE = THREE59.DoubleSide;
31579
31652
  var createBoardMaterial = ({
31580
31653
  material,
31581
31654
  color,
@@ -31583,7 +31656,7 @@ var createBoardMaterial = ({
31583
31656
  isFaux = false
31584
31657
  }) => {
31585
31658
  if (material === "fr4") {
31586
- return new THREE58.MeshPhysicalMaterial({
31659
+ return new THREE59.MeshPhysicalMaterial({
31587
31660
  color,
31588
31661
  side,
31589
31662
  metalness: 0,
@@ -31601,7 +31674,7 @@ var createBoardMaterial = ({
31601
31674
  polygonOffsetUnits: 1
31602
31675
  });
31603
31676
  }
31604
- return new THREE58.MeshStandardMaterial({
31677
+ return new THREE59.MeshStandardMaterial({
31605
31678
  color,
31606
31679
  side,
31607
31680
  flatShading: true,
@@ -31620,12 +31693,12 @@ function createGeometryMeshes(geoms) {
31620
31693
  const meshes = [];
31621
31694
  if (!geoms) return meshes;
31622
31695
  if (geoms.board?.geometry) {
31623
- const mesh = new THREE59.Mesh(
31696
+ const mesh = new THREE60.Mesh(
31624
31697
  geoms.board.geometry,
31625
31698
  createBoardMaterial({
31626
31699
  material: geoms.board.material,
31627
31700
  color: geoms.board.color,
31628
- side: THREE59.DoubleSide,
31701
+ side: THREE60.DoubleSide,
31629
31702
  isFaux: geoms.board.isFaux
31630
31703
  })
31631
31704
  );
@@ -31636,11 +31709,11 @@ function createGeometryMeshes(geoms) {
31636
31709
  const createMeshesFromArray = (geomArray) => {
31637
31710
  if (geomArray) {
31638
31711
  for (const comp of geomArray) {
31639
- const mesh = new THREE59.Mesh(
31712
+ const mesh = new THREE60.Mesh(
31640
31713
  comp.geometry,
31641
- new THREE59.MeshStandardMaterial({
31714
+ new THREE60.MeshStandardMaterial({
31642
31715
  color: comp.color,
31643
- side: THREE59.DoubleSide,
31716
+ side: THREE60.DoubleSide,
31644
31717
  flatShading: true
31645
31718
  // Consistent with board
31646
31719
  })
@@ -31684,7 +31757,7 @@ function loadManifold() {
31684
31757
  }
31685
31758
 
31686
31759
  // src/CadViewerManifold.tsx
31687
- import { jsx as jsx22, jsxs as jsxs7 } from "react/jsx-runtime";
31760
+ import { jsx as jsx23, jsxs as jsxs7 } from "react/jsx-runtime";
31688
31761
  var BoardMeshes = ({
31689
31762
  geometryMeshes,
31690
31763
  textureMeshes
@@ -31712,14 +31785,14 @@ var BoardMeshes = ({
31712
31785
  const typedMaterial = material;
31713
31786
  for (const prop of textureProps) {
31714
31787
  const texture = typedMaterial[prop];
31715
- if (texture && texture instanceof THREE60.Texture) {
31788
+ if (texture && texture instanceof THREE61.Texture) {
31716
31789
  texture.dispose();
31717
31790
  }
31718
31791
  }
31719
31792
  material.dispose();
31720
31793
  }
31721
31794
  };
31722
- useEffect34(() => {
31795
+ useEffect35(() => {
31723
31796
  if (!rootObject) return;
31724
31797
  for (const mesh of geometryMeshes) {
31725
31798
  let shouldShow = true;
@@ -31741,7 +31814,7 @@ var BoardMeshes = ({
31741
31814
  }
31742
31815
  };
31743
31816
  }, [rootObject, geometryMeshes, visibility]);
31744
- useEffect34(() => {
31817
+ useEffect35(() => {
31745
31818
  if (!rootObject) return;
31746
31819
  for (const mesh of textureMeshes) {
31747
31820
  rootObject.add(mesh);
@@ -31767,17 +31840,17 @@ var CadViewerManifold = ({
31767
31840
  onCameraControllerReady,
31768
31841
  resolveStaticAsset,
31769
31842
  referenceObject,
31770
- hiddenCadComponentIds
31843
+ objectVisibility
31771
31844
  }) => {
31772
31845
  const childrenCircuitJson = useConvertChildrenToCircuitJson(children);
31773
- const circuitJson = useMemo28(() => {
31846
+ const circuitJson = useMemo29(() => {
31774
31847
  const rawCircuitJson = circuitJsonProp ?? childrenCircuitJson;
31775
31848
  return addFauxBoardIfNeeded(rawCircuitJson);
31776
31849
  }, [circuitJsonProp, childrenCircuitJson]);
31777
31850
  const [manifoldJSModule, setManifoldJSModule] = useState21(null);
31778
31851
  const [manifoldLoadingError, setManifoldLoadingError] = useState21(null);
31779
31852
  const { visibility } = useLayerVisibility();
31780
- useEffect34(() => {
31853
+ useEffect35(() => {
31781
31854
  let isActive = true;
31782
31855
  loadManifold().then((module) => {
31783
31856
  if (isActive) setManifoldJSModule(module);
@@ -31801,7 +31874,7 @@ var CadViewerManifold = ({
31801
31874
  boardData,
31802
31875
  isFauxBoard
31803
31876
  } = useManifoldBoardBuilder(manifoldJSModule, circuitJson, visibility);
31804
- const flex = useMemo28(() => {
31877
+ const flex = useMemo29(() => {
31805
31878
  try {
31806
31879
  const resolvedFoldPcbs = resolveFoldPcbs(circuitJson, foldPcbs);
31807
31880
  const posedJson = transformCircuitJsonCadComponents(circuitJson, {
@@ -31832,28 +31905,32 @@ var CadViewerManifold = ({
31832
31905
  circuitJson,
31833
31906
  foldPcbs
31834
31907
  ]);
31835
- const cadComponents = useMemo28(
31836
- () => su17(flex.posedJson).cad_component.list().filter((cad) => !hiddenCadComponentIds?.has(cad.cad_component_id)),
31837
- [flex.posedJson, hiddenCadComponentIds]
31908
+ const cadComponents = useMemo29(
31909
+ () => su17(flex.posedJson).cad_component.list().filter(
31910
+ (cad) => !isObjectHidden(objectVisibility, cad.cad_component_id)
31911
+ ),
31912
+ [flex.posedJson, objectVisibility]
31838
31913
  );
31839
- const cadCables = useMemo28(
31840
- () => getCadCables(flex.posedJson),
31841
- [flex.posedJson]
31914
+ const cadCables = useMemo29(
31915
+ () => getCadCables(flex.posedJson).filter(
31916
+ (cable) => !isObjectHidden(objectVisibility, cable.cad_cable_id)
31917
+ ),
31918
+ [flex.posedJson, objectVisibility]
31842
31919
  );
31843
- const boardDimensions = useMemo28(() => {
31920
+ const boardDimensions = useMemo29(() => {
31844
31921
  if (!boardData) return void 0;
31845
31922
  const bounds = calculateOutlineBounds(boardData);
31846
31923
  return { width: bounds.width, height: bounds.height };
31847
31924
  }, [boardData]);
31848
- const boardCenter = useMemo28(() => {
31925
+ const boardCenter = useMemo29(() => {
31849
31926
  if (!boardData) return void 0;
31850
31927
  const bounds = calculateOutlineBounds(boardData);
31851
31928
  return { x: bounds.centerX, y: bounds.centerY };
31852
31929
  }, [boardData]);
31853
- const initialCameraPosition = useMemo28(() => {
31930
+ const initialCameraPosition = useMemo29(() => {
31854
31931
  return getInitialCameraPosition({ boardDimensions, boardCenter });
31855
31932
  }, [boardDimensions, boardCenter]);
31856
- const cameraSessionScope = useMemo28(() => {
31933
+ const cameraSessionScope = useMemo29(() => {
31857
31934
  if (!boardData) return void 0;
31858
31935
  return JSON.stringify({
31859
31936
  pcbBoardId: boardData.pcb_board_id,
@@ -31879,7 +31956,7 @@ var CadViewerManifold = ({
31879
31956
  );
31880
31957
  }
31881
31958
  if (!manifoldJSModule) {
31882
- return /* @__PURE__ */ jsx22("div", { style: { padding: "1em" }, children: "Loading Manifold module..." });
31959
+ return /* @__PURE__ */ jsx23("div", { style: { padding: "1em" }, children: "Loading Manifold module..." });
31883
31960
  }
31884
31961
  if (builderError || flex.error) {
31885
31962
  return /* @__PURE__ */ jsxs7(
@@ -31900,7 +31977,7 @@ var CadViewerManifold = ({
31900
31977
  );
31901
31978
  }
31902
31979
  if (builderIsLoading) {
31903
- return /* @__PURE__ */ jsx22("div", { style: { padding: "1em" }, children: "Processing board geometry..." });
31980
+ return /* @__PURE__ */ jsx23("div", { style: { padding: "1em" }, children: "Processing board geometry..." });
31904
31981
  }
31905
31982
  return /* @__PURE__ */ jsxs7(
31906
31983
  CadViewerContainer,
@@ -31915,19 +31992,26 @@ var CadViewerManifold = ({
31915
31992
  onUserInteraction,
31916
31993
  onCameraControllerReady,
31917
31994
  children: [
31918
- /* @__PURE__ */ jsx22(
31919
- BoardMeshes,
31995
+ /* @__PURE__ */ jsx23(
31996
+ BoardGroup,
31920
31997
  {
31921
- geometryMeshes: flex.geometryMeshes,
31922
- textureMeshes: flex.textureMeshes
31998
+ pcbBoardId: boardData?.pcb_board_id,
31999
+ hidden: isObjectHidden(objectVisibility, boardData?.pcb_board_id),
32000
+ children: /* @__PURE__ */ jsx23(
32001
+ BoardMeshes,
32002
+ {
32003
+ geometryMeshes: flex.geometryMeshes,
32004
+ textureMeshes: flex.textureMeshes
32005
+ }
32006
+ )
31923
32007
  }
31924
32008
  ),
31925
- flex.bounds && /* @__PURE__ */ jsx22(FitCameraToComparison, { bounds: flex.bounds }),
31926
- cadComponents.map((cad_component) => /* @__PURE__ */ jsx22(
32009
+ flex.bounds && /* @__PURE__ */ jsx23(FitCameraToComparison, { bounds: flex.bounds }),
32010
+ cadComponents.map((cad_component) => /* @__PURE__ */ jsx23(
31927
32011
  ThreeErrorBoundary,
31928
32012
  {
31929
- fallback: ({ error }) => /* @__PURE__ */ jsx22(Error3d, { cad_component, error }),
31930
- children: /* @__PURE__ */ jsx22(
32013
+ fallback: ({ error }) => /* @__PURE__ */ jsx23(Error3d, { cad_component, error }),
32014
+ children: /* @__PURE__ */ jsx23(
31931
32015
  AnyCadComponent,
31932
32016
  {
31933
32017
  cad_component,
@@ -31938,7 +32022,7 @@ var CadViewerManifold = ({
31938
32022
  },
31939
32023
  cad_component.cad_component_id
31940
32024
  )),
31941
- cadCables.map((cable) => /* @__PURE__ */ jsx22(CadCable, { cable }, cable.cad_cable_id))
32025
+ cadCables.map((cable) => /* @__PURE__ */ jsx23(CadCable, { cable }, cable.cad_cable_id))
31942
32026
  ]
31943
32027
  }
31944
32028
  );
@@ -31946,14 +32030,14 @@ var CadViewerManifold = ({
31946
32030
  var CadViewerManifold_default = CadViewerManifold;
31947
32031
 
31948
32032
  // src/CadViewerGlb.tsx
31949
- import { useEffect as useEffect36, useMemo as useMemo30, useState as useState23 } from "react";
32033
+ import { useEffect as useEffect37, useMemo as useMemo31, useState as useState23 } from "react";
31950
32034
 
31951
32035
  // src/hooks/useGlbModel.ts
31952
- import { useEffect as useEffect35, useMemo as useMemo29, useState as useState22 } from "react";
32036
+ import { useEffect as useEffect36, useMemo as useMemo30, useState as useState22 } from "react";
31953
32037
  function useGlbModel(source) {
31954
- const request = useMemo29(() => ({ source }), [source]);
32038
+ const request = useMemo30(() => ({ source }), [source]);
31955
32039
  const [result, setResult] = useState22();
31956
- useEffect35(() => {
32040
+ useEffect36(() => {
31957
32041
  const controller = new AbortController();
31958
32042
  let model;
31959
32043
  loadGlbScene(request.source, controller.signal).then((loaded) => {
@@ -31976,17 +32060,17 @@ function useGlbModel(source) {
31976
32060
  }
31977
32061
 
31978
32062
  // src/CadViewerGlb.tsx
31979
- import * as THREE61 from "three";
31980
- import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs8 } from "react/jsx-runtime";
32063
+ import * as THREE62 from "three";
32064
+ import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs8 } from "react/jsx-runtime";
31981
32065
  function GlbScene({
31982
32066
  model,
31983
- hiddenCadComponentIds
32067
+ objectVisibility
31984
32068
  }) {
31985
32069
  const { rootObject } = useThree();
31986
32070
  const { addHoverable, removeHoverable } = useHover();
31987
32071
  const [hover, setHover] = useState23();
31988
- const bounds = useMemo30(() => {
31989
- const box = new THREE61.Box3().setFromObject(model);
32072
+ const bounds = useMemo31(() => {
32073
+ const box = new THREE62.Box3().setFromObject(model);
31990
32074
  if (box.isEmpty()) return;
31991
32075
  return {
31992
32076
  minX: box.min.x,
@@ -31997,24 +32081,29 @@ function GlbScene({
31997
32081
  maxZ: box.max.z
31998
32082
  };
31999
32083
  }, [model]);
32000
- useEffect36(() => {
32084
+ useEffect37(() => {
32001
32085
  rootObject.add(model);
32002
32086
  return () => {
32003
32087
  rootObject.remove(model);
32004
32088
  };
32005
32089
  }, [rootObject, model]);
32006
- useEffect36(() => {
32090
+ useEffect37(() => {
32007
32091
  setHover(void 0);
32008
- model.traverse((object) => {
32092
+ const applyVisibility = (object, inComponent) => {
32009
32093
  const id = object.userData.cad_component_id;
32010
32094
  if (typeof id === "string")
32011
- object.visible = !hiddenCadComponentIds?.has(id);
32012
- });
32013
- }, [model, hiddenCadComponentIds]);
32014
- useEffect36(() => {
32095
+ object.visible = !isObjectHidden(objectVisibility, id);
32096
+ else if (!inComponent && object instanceof THREE62.Mesh)
32097
+ object.visible = !isObjectHidden(objectVisibility, void 0);
32098
+ for (const child of object.children)
32099
+ applyVisibility(child, inComponent || typeof id === "string");
32100
+ };
32101
+ applyVisibility(model, false);
32102
+ }, [model, objectVisibility]);
32103
+ useEffect37(() => {
32015
32104
  const meshes = [];
32016
32105
  model.traverse((mesh) => {
32017
- if (!(mesh instanceof THREE61.Mesh)) return;
32106
+ if (!(mesh instanceof THREE62.Mesh)) return;
32018
32107
  let ancestor = mesh;
32019
32108
  while (ancestor) {
32020
32109
  if (!ancestor.visible) return;
@@ -32042,10 +32131,10 @@ function GlbScene({
32042
32131
  return () => {
32043
32132
  for (const mesh of meshes) removeHoverable(mesh);
32044
32133
  };
32045
- }, [model, hiddenCadComponentIds, addHoverable, removeHoverable]);
32134
+ }, [model, objectVisibility, addHoverable, removeHoverable]);
32046
32135
  return /* @__PURE__ */ jsxs8(Fragment5, { children: [
32047
- bounds && /* @__PURE__ */ jsx23(FitCameraToComparison, { bounds }),
32048
- hover && /* @__PURE__ */ jsx23(
32136
+ bounds && /* @__PURE__ */ jsx24(FitCameraToComparison, { bounds }),
32137
+ hover && /* @__PURE__ */ jsx24(
32049
32138
  Html,
32050
32139
  {
32051
32140
  position: hover.position,
@@ -32064,13 +32153,13 @@ function GlbScene({
32064
32153
  }
32065
32154
  function CadViewerGlb({
32066
32155
  source,
32067
- hiddenCadComponentIds,
32156
+ objectVisibility,
32068
32157
  ...containerProps
32069
32158
  }) {
32070
32159
  const result = useGlbModel(source);
32071
- const framing = useMemo30(() => {
32160
+ const framing = useMemo31(() => {
32072
32161
  if (!result?.model) return void 0;
32073
- const bounds = new THREE61.Box3().setFromObject(result.model);
32162
+ const bounds = new THREE62.Box3().setFromObject(result.model);
32074
32163
  if (bounds.isEmpty()) return void 0;
32075
32164
  return {
32076
32165
  boardDimensions: {
@@ -32083,20 +32172,14 @@ function CadViewerGlb({
32083
32172
  }
32084
32173
  };
32085
32174
  }, [result, source]);
32086
- if (!result) return /* @__PURE__ */ jsx23("div", { role: "status", children: "Loading 3D view..." });
32175
+ if (!result) return /* @__PURE__ */ jsx24("div", { role: "status", children: "Loading 3D view..." });
32087
32176
  if (result.error)
32088
32177
  return /* @__PURE__ */ jsxs8("div", { role: "alert", children: [
32089
32178
  "Unable to load 3D view: ",
32090
32179
  result.error
32091
32180
  ] });
32092
32181
  if (!result.model) return null;
32093
- return /* @__PURE__ */ jsx23(CadViewerContainer, { ...containerProps, ...framing, children: /* @__PURE__ */ jsx23(
32094
- GlbScene,
32095
- {
32096
- model: result.model,
32097
- hiddenCadComponentIds
32098
- }
32099
- ) });
32182
+ return /* @__PURE__ */ jsx24(CadViewerContainer, { ...containerProps, ...framing, children: /* @__PURE__ */ jsx24(GlbScene, { model: result.model, objectVisibility }) });
32100
32183
  }
32101
32184
 
32102
32185
  // node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
@@ -32198,7 +32281,7 @@ __name2(useComposedRefs, "useComposedRefs");
32198
32281
 
32199
32282
  // node_modules/@radix-ui/react-context/dist/index.mjs
32200
32283
  import * as React12 from "react";
32201
- import { jsx as jsx24 } from "react/jsx-runtime";
32284
+ import { jsx as jsx25 } from "react/jsx-runtime";
32202
32285
  var __defProp4 = Object.defineProperty;
32203
32286
  var __name3 = (target, value) => __defProp4(target, "name", { value, configurable: true });
32204
32287
  // @__NO_SIDE_EFFECTS__
@@ -32208,7 +32291,7 @@ function createContext22(rootComponentName, defaultContext) {
32208
32291
  const Provider = /* @__PURE__ */ __name3((props) => {
32209
32292
  const { children, ...context } = props;
32210
32293
  const value = React12.useMemo(() => context, Object.values(context));
32211
- return /* @__PURE__ */ jsx24(Context.Provider, { value, children });
32294
+ return /* @__PURE__ */ jsx25(Context.Provider, { value, children });
32212
32295
  }, "Provider");
32213
32296
  Provider.displayName = rootComponentName + "Provider";
32214
32297
  function useContext22(consumerName, options = {}) {
@@ -32235,7 +32318,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
32235
32318
  const { scope, children, ...context } = props;
32236
32319
  const Context = scope?.[scopeName]?.[index2] || BaseContext;
32237
32320
  const value = React12.useMemo(() => context, Object.values(context));
32238
- return /* @__PURE__ */ jsx24(Context.Provider, { value, children });
32321
+ return /* @__PURE__ */ jsx25(Context.Provider, { value, children });
32239
32322
  }, "Provider");
32240
32323
  Provider.displayName = rootComponentName + "Provider";
32241
32324
  function useContext22(consumerName, scope, options = {}) {
@@ -32620,7 +32703,7 @@ var createSlottableError = /* @__PURE__ */ __name6((ownerName) => {
32620
32703
  var use = React16[" use ".trim().toString()];
32621
32704
 
32622
32705
  // node_modules/@radix-ui/react-primitive/dist/index.mjs
32623
- import { jsx as jsx25 } from "react/jsx-runtime";
32706
+ import { jsx as jsx26 } from "react/jsx-runtime";
32624
32707
  var __defProp8 = Object.defineProperty;
32625
32708
  var __name7 = (target, value) => __defProp8(target, "name", { value, configurable: true });
32626
32709
  var NODES = [
@@ -32650,7 +32733,7 @@ var Primitive = NODES.reduce((primitive, node) => {
32650
32733
  if (typeof window !== "undefined") {
32651
32734
  window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
32652
32735
  }
32653
- return /* @__PURE__ */ jsx25(Comp, { ...primitiveProps, ref: forwardedRef });
32736
+ return /* @__PURE__ */ jsx26(Comp, { ...primitiveProps, ref: forwardedRef });
32654
32737
  });
32655
32738
  Node2.displayName = `Primitive.${node}`;
32656
32739
  return { ...primitive, [node]: Node2 };
@@ -32665,9 +32748,9 @@ import * as React41 from "react";
32665
32748
 
32666
32749
  // node_modules/@radix-ui/react-collection/dist/index.mjs
32667
32750
  import * as React18 from "react";
32668
- import { jsx as jsx26 } from "react/jsx-runtime";
32669
- import * as React23 from "react";
32670
32751
  import { jsx as jsx27 } from "react/jsx-runtime";
32752
+ import * as React23 from "react";
32753
+ import { jsx as jsx28 } from "react/jsx-runtime";
32671
32754
  var __defProp9 = Object.defineProperty;
32672
32755
  var __name8 = (target, value) => __defProp9(target, "name", { value, configurable: true });
32673
32756
  // @__NO_SIDE_EFFECTS__
@@ -32682,7 +32765,7 @@ function createCollection(name) {
32682
32765
  const { scope, children } = props;
32683
32766
  const ref = React18.useRef(null);
32684
32767
  const itemMap = React18.useRef(/* @__PURE__ */ new Map()).current;
32685
- return /* @__PURE__ */ jsx26(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
32768
+ return /* @__PURE__ */ jsx27(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
32686
32769
  }, "CollectionProvider");
32687
32770
  CollectionProvider.displayName = PROVIDER_NAME;
32688
32771
  const COLLECTION_SLOT_NAME = name + "CollectionSlot";
@@ -32692,7 +32775,7 @@ function createCollection(name) {
32692
32775
  const { scope, children } = props;
32693
32776
  const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
32694
32777
  const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
32695
- return /* @__PURE__ */ jsx26(CollectionSlotImpl, { ref: composedRefs, children });
32778
+ return /* @__PURE__ */ jsx27(CollectionSlotImpl, { ref: composedRefs, children });
32696
32779
  }
32697
32780
  );
32698
32781
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
@@ -32709,7 +32792,7 @@ function createCollection(name) {
32709
32792
  context.itemMap.set(ref, { ref, ...itemData });
32710
32793
  return () => void context.itemMap.delete(ref);
32711
32794
  });
32712
- return /* @__PURE__ */ jsx26(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
32795
+ return /* @__PURE__ */ jsx27(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
32713
32796
  }
32714
32797
  );
32715
32798
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
@@ -33065,12 +33148,12 @@ function createCollection2(name) {
33065
33148
  const [CollectionStatefulContextProvider, useStatefulCollectionContext] = createCollectionContext(PROVIDER_NAME);
33066
33149
  CollectionStatefulContextProvider.displayName = name + "CollectionStatefulContextProvider";
33067
33150
  const CollectionProvider = /* @__PURE__ */ __name8(({ state, ...props }) => {
33068
- return state ? /* @__PURE__ */ jsx27(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx27(CollectionInit, { ...props });
33151
+ return state ? /* @__PURE__ */ jsx28(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx28(CollectionInit, { ...props });
33069
33152
  }, "CollectionProvider");
33070
33153
  CollectionProvider.displayName = PROVIDER_NAME;
33071
33154
  const CollectionInit = /* @__PURE__ */ __name8((props) => {
33072
33155
  const state = useInitCollection();
33073
- return /* @__PURE__ */ jsx27(CollectionProviderImpl, { ...props, state });
33156
+ return /* @__PURE__ */ jsx28(CollectionProviderImpl, { ...props, state });
33074
33157
  }, "CollectionInit");
33075
33158
  CollectionInit.displayName = name + "CollectionInit";
33076
33159
  const CollectionProviderImpl = /* @__PURE__ */ __name8((props) => {
@@ -33110,7 +33193,7 @@ function createCollection2(name) {
33110
33193
  observer.disconnect();
33111
33194
  };
33112
33195
  }, [collectionElement, setCollection]);
33113
- return /* @__PURE__ */ jsx27(
33196
+ return /* @__PURE__ */ jsx28(
33114
33197
  CollectionStableContextProvider,
33115
33198
  {
33116
33199
  scope,
@@ -33119,7 +33202,7 @@ function createCollection2(name) {
33119
33202
  getCollection,
33120
33203
  setCollection,
33121
33204
  registryRef,
33122
- children: /* @__PURE__ */ jsx27(
33205
+ children: /* @__PURE__ */ jsx28(
33123
33206
  CollectionStatefulContextProvider,
33124
33207
  {
33125
33208
  scope,
@@ -33139,7 +33222,7 @@ function createCollection2(name) {
33139
33222
  const { scope, children } = props;
33140
33223
  const context = useStableCollectionContext(COLLECTION_SLOT_NAME, scope);
33141
33224
  const composedRefs = useComposedRefs(forwardedRef, context.collectionElementRef);
33142
- return /* @__PURE__ */ jsx27(CollectionSlotImpl, { ref: composedRefs, children });
33225
+ return /* @__PURE__ */ jsx28(CollectionSlotImpl, { ref: composedRefs, children });
33143
33226
  }
33144
33227
  );
33145
33228
  CollectionSlot.displayName = COLLECTION_SLOT_NAME;
@@ -33215,7 +33298,7 @@ function createCollection2(name) {
33215
33298
  });
33216
33299
  };
33217
33300
  }, [setCollection]);
33218
- return /* @__PURE__ */ jsx27(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
33301
+ return /* @__PURE__ */ jsx28(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
33219
33302
  }
33220
33303
  );
33221
33304
  CollectionItemSlot.displayName = ITEM_SLOT_NAME;
@@ -33296,7 +33379,7 @@ __name8(getChildListObserver, "getChildListObserver");
33296
33379
 
33297
33380
  // node_modules/@radix-ui/react-direction/dist/index.mjs
33298
33381
  import * as React19 from "react";
33299
- import { jsx as jsx28 } from "react/jsx-runtime";
33382
+ import { jsx as jsx29 } from "react/jsx-runtime";
33300
33383
  var __defProp10 = Object.defineProperty;
33301
33384
  var __name9 = (target, value) => __defProp10(target, "name", { value, configurable: true });
33302
33385
  var Direction = {
@@ -33334,7 +33417,7 @@ function useCallbackRef(callback) {
33334
33417
  __name10(useCallbackRef, "useCallbackRef");
33335
33418
 
33336
33419
  // node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
33337
- import { jsx as jsx29 } from "react/jsx-runtime";
33420
+ import { jsx as jsx30 } from "react/jsx-runtime";
33338
33421
  var __defProp12 = Object.defineProperty;
33339
33422
  var __name11 = (target, value) => __defProp12(target, "name", { value, configurable: true });
33340
33423
  var CONTEXT_UPDATE = "dismissableLayer.update";
@@ -33466,7 +33549,7 @@ var DismissableLayer = /* @__PURE__ */ React21.forwardRef(
33466
33549
  document.addEventListener(CONTEXT_UPDATE, handleUpdate);
33467
33550
  return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
33468
33551
  }, []);
33469
- return /* @__PURE__ */ jsx29(
33552
+ return /* @__PURE__ */ jsx30(
33470
33553
  Primitive.div,
33471
33554
  {
33472
33555
  ...layerProps,
@@ -33715,7 +33798,7 @@ __name12(createFocusGuard, "createFocusGuard");
33715
33798
 
33716
33799
  // node_modules/@radix-ui/react-focus-scope/dist/index.mjs
33717
33800
  import * as React25 from "react";
33718
- import { jsx as jsx30 } from "react/jsx-runtime";
33801
+ import { jsx as jsx31 } from "react/jsx-runtime";
33719
33802
  var __defProp14 = Object.defineProperty;
33720
33803
  var __name13 = (target, value) => __defProp14(target, "name", { value, configurable: true });
33721
33804
  var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
@@ -33854,7 +33937,7 @@ var FocusScope = /* @__PURE__ */ React25.forwardRef(
33854
33937
  },
33855
33938
  [loop, trapped, focusScope.paused]
33856
33939
  );
33857
- return /* @__PURE__ */ jsx30(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
33940
+ return /* @__PURE__ */ jsx31(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
33858
33941
  }, "FocusScope")
33859
33942
  );
33860
33943
  var FocusScopeBranchContext = React25.createContext(null);
@@ -33862,7 +33945,7 @@ function FocusScopeBranchProvider({ registry, children }) {
33862
33945
  if (!registry) {
33863
33946
  return children;
33864
33947
  }
33865
- return /* @__PURE__ */ jsx30(FocusScopeBranchContext.Provider, { value: registry, children });
33948
+ return /* @__PURE__ */ jsx31(FocusScopeBranchContext.Provider, { value: registry, children });
33866
33949
  }
33867
33950
  __name13(FocusScopeBranchProvider, "FocusScopeBranchProvider");
33868
33951
  function useFocusScopeBranchRegistry() {
@@ -35955,7 +36038,7 @@ function useSize(element) {
35955
36038
  __name15(useSize, "useSize");
35956
36039
 
35957
36040
  // node_modules/@radix-ui/react-popper/dist/index.mjs
35958
- import { jsx as jsx31 } from "react/jsx-runtime";
36041
+ import { jsx as jsx32 } from "react/jsx-runtime";
35959
36042
  var __defProp17 = Object.defineProperty;
35960
36043
  var __name16 = (target, value) => __defProp17(target, "name", { value, configurable: true });
35961
36044
  var Sticky = {
@@ -35973,7 +36056,7 @@ var Popper = /* @__PURE__ */ __name16((props) => {
35973
36056
  const { __scopePopper, children } = props;
35974
36057
  const [anchor, setAnchor] = React29.useState(null);
35975
36058
  const [placementState, setPlacementState] = React29.useState(void 0);
35976
- return /* @__PURE__ */ jsx31(
36059
+ return /* @__PURE__ */ jsx32(
35977
36060
  PopperProvider,
35978
36061
  {
35979
36062
  scope: __scopePopper,
@@ -36016,7 +36099,7 @@ var PopperAnchor = /* @__PURE__ */ React29.forwardRef(
36016
36099
  const sideAndAlign = context.placementState && getSideAndAlignFromPlacement(context.placementState);
36017
36100
  const placedSide = sideAndAlign?.[0];
36018
36101
  const placedAlign = sideAndAlign?.[1];
36019
- return virtualRef ? null : /* @__PURE__ */ jsx31(
36102
+ return virtualRef ? null : /* @__PURE__ */ jsx32(
36020
36103
  Primitive.div,
36021
36104
  {
36022
36105
  "data-radix-popper-side": placedSide,
@@ -36140,7 +36223,7 @@ var PopperContent = /* @__PURE__ */ React29.forwardRef(
36140
36223
  useLayoutEffect2(() => {
36141
36224
  if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
36142
36225
  }, [content]);
36143
- return /* @__PURE__ */ jsx31(
36226
+ return /* @__PURE__ */ jsx32(
36144
36227
  "div",
36145
36228
  {
36146
36229
  ref: refs.setFloating,
@@ -36164,7 +36247,7 @@ var PopperContent = /* @__PURE__ */ React29.forwardRef(
36164
36247
  }
36165
36248
  },
36166
36249
  dir: props.dir,
36167
- children: /* @__PURE__ */ jsx31(
36250
+ children: /* @__PURE__ */ jsx32(
36168
36251
  PopperContentProvider,
36169
36252
  {
36170
36253
  scope: __scopePopper,
@@ -36174,7 +36257,7 @@ var PopperContent = /* @__PURE__ */ React29.forwardRef(
36174
36257
  arrowX,
36175
36258
  arrowY,
36176
36259
  shouldHideArrow: cannotCenterArrow,
36177
- children: /* @__PURE__ */ jsx31(
36260
+ children: /* @__PURE__ */ jsx32(
36178
36261
  Primitive.div,
36179
36262
  {
36180
36263
  "data-side": placedSide,
@@ -36240,7 +36323,7 @@ __name16(getSideAndAlignFromPlacement, "getSideAndAlignFromPlacement");
36240
36323
  // node_modules/@radix-ui/react-portal/dist/index.mjs
36241
36324
  import * as React30 from "react";
36242
36325
  import * as ReactDOM4 from "react-dom";
36243
- import { jsx as jsx32 } from "react/jsx-runtime";
36326
+ import { jsx as jsx33 } from "react/jsx-runtime";
36244
36327
  var __defProp18 = Object.defineProperty;
36245
36328
  var __name17 = (target, value) => __defProp18(target, "name", { value, configurable: true });
36246
36329
  var Portal = /* @__PURE__ */ React30.forwardRef(
@@ -36249,7 +36332,7 @@ var Portal = /* @__PURE__ */ React30.forwardRef(
36249
36332
  const [mounted, setMounted] = React30.useState(false);
36250
36333
  useLayoutEffect2(() => setMounted(true), []);
36251
36334
  const container = containerProp || mounted && globalThis?.document?.body;
36252
- return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx32(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
36335
+ return container ? ReactDOM4.createPortal(/* @__PURE__ */ jsx33(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
36253
36336
  }, "Portal")
36254
36337
  );
36255
36338
 
@@ -36469,7 +36552,7 @@ __name19(useIsHydratedModern, "useIsHydratedModern");
36469
36552
  var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
36470
36553
 
36471
36554
  // node_modules/@radix-ui/react-roving-focus/dist/index.mjs
36472
- import { jsx as jsx33 } from "react/jsx-runtime";
36555
+ import { jsx as jsx34 } from "react/jsx-runtime";
36473
36556
  var __defProp21 = Object.defineProperty;
36474
36557
  var __name20 = (target, value) => __defProp21(target, "name", { value, configurable: true });
36475
36558
  var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
@@ -36492,7 +36575,7 @@ var [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext
36492
36575
  var RovingFocusGroup = /* @__PURE__ */ React33.forwardRef(
36493
36576
  // blank line to reduce diff noise
36494
36577
  /* @__PURE__ */ __name20(function RovingFocusGroup2(props, forwardedRef) {
36495
- return /* @__PURE__ */ jsx33(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx33(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx33(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
36578
+ return /* @__PURE__ */ jsx34(Collection.Provider, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx34(Collection.Slot, { scope: props.__scopeRovingFocusGroup, children: /* @__PURE__ */ jsx34(RovingFocusGroupImpl, { ...props, ref: forwardedRef }) }) });
36496
36579
  }, "RovingFocusGroup")
36497
36580
  );
36498
36581
  var RovingFocusGroupImpl = /* @__PURE__ */ React33.forwardRef(/* @__PURE__ */ __name20(function RovingFocusGroupImpl2(props, forwardedRef) {
@@ -36529,7 +36612,7 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React33.forwardRef(/* @__PURE__ */ __
36529
36612
  return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus);
36530
36613
  }
36531
36614
  }, [handleEntryFocus]);
36532
- return /* @__PURE__ */ jsx33(
36615
+ return /* @__PURE__ */ jsx34(
36533
36616
  RovingFocusProvider,
36534
36617
  {
36535
36618
  scope: __scopeRovingFocusGroup,
@@ -36550,7 +36633,7 @@ var RovingFocusGroupImpl = /* @__PURE__ */ React33.forwardRef(/* @__PURE__ */ __
36550
36633
  () => setFocusableItemsCount((prevCount) => prevCount - 1),
36551
36634
  []
36552
36635
  ),
36553
- children: /* @__PURE__ */ jsx33(
36636
+ children: /* @__PURE__ */ jsx34(
36554
36637
  Primitive.div,
36555
36638
  {
36556
36639
  tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0,
@@ -36618,14 +36701,14 @@ var RovingFocusGroupItem = /* @__PURE__ */ React33.forwardRef(
36618
36701
  onFocusableItemAdd();
36619
36702
  return () => onFocusableItemRemove();
36620
36703
  }, [isHydrated, focusable, onFocusableItemAdd, onFocusableItemRemove]);
36621
- return /* @__PURE__ */ jsx33(
36704
+ return /* @__PURE__ */ jsx34(
36622
36705
  Collection.ItemSlot,
36623
36706
  {
36624
36707
  scope: __scopeRovingFocusGroup,
36625
36708
  id,
36626
36709
  focusable,
36627
36710
  active,
36628
- children: /* @__PURE__ */ jsx33(
36711
+ children: /* @__PURE__ */ jsx34(
36629
36712
  Primitive.span,
36630
36713
  {
36631
36714
  tabIndex: isCurrentTabStop ? 0 : -1,
@@ -37547,7 +37630,7 @@ ReactRemoveScroll.classNames = RemoveScroll.classNames;
37547
37630
  var Combination_default = ReactRemoveScroll;
37548
37631
 
37549
37632
  // node_modules/@radix-ui/react-menu/dist/index.mjs
37550
- import { jsx as jsx34 } from "react/jsx-runtime";
37633
+ import { jsx as jsx35 } from "react/jsx-runtime";
37551
37634
  var __defProp22 = Object.defineProperty;
37552
37635
  var __name21 = (target, value) => __defProp22(target, "name", { value, configurable: true });
37553
37636
  var Direction3 = {
@@ -37606,7 +37689,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
37606
37689
  window.addEventListener("blur", handleBlur);
37607
37690
  return () => window.removeEventListener("blur", handleBlur);
37608
37691
  }, [open, handleOpenChange]);
37609
- return /* @__PURE__ */ jsx34(Popper, { ...popperScope, children: /* @__PURE__ */ jsx34(
37692
+ return /* @__PURE__ */ jsx35(Popper, { ...popperScope, children: /* @__PURE__ */ jsx35(
37610
37693
  MenuProvider,
37611
37694
  {
37612
37695
  scope: __scopeMenu,
@@ -37614,7 +37697,7 @@ var Menu = /* @__PURE__ */ __name21((props) => {
37614
37697
  onOpenChange: handleOpenChange,
37615
37698
  content,
37616
37699
  onContentChange: setContent,
37617
- children: /* @__PURE__ */ jsx34(
37700
+ children: /* @__PURE__ */ jsx35(
37618
37701
  MenuRootProvider,
37619
37702
  {
37620
37703
  scope: __scopeMenu,
@@ -37632,7 +37715,7 @@ var MenuAnchor = /* @__PURE__ */ React41.forwardRef(
37632
37715
  /* @__PURE__ */ __name21(function MenuAnchor2(props, forwardedRef) {
37633
37716
  const { __scopeMenu, ...anchorProps } = props;
37634
37717
  const popperScope = usePopperScope(__scopeMenu);
37635
- return /* @__PURE__ */ jsx34(PopperAnchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
37718
+ return /* @__PURE__ */ jsx35(PopperAnchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
37636
37719
  }, "MenuAnchor")
37637
37720
  );
37638
37721
  var PORTAL_NAME = "MenuPortal";
@@ -37642,7 +37725,7 @@ var [PortalProvider, usePortalContext] = createMenuContext(PORTAL_NAME, {
37642
37725
  var MenuPortal = /* @__PURE__ */ __name21((props) => {
37643
37726
  const { __scopeMenu, forceMount, children, container } = props;
37644
37727
  const context = useMenuContext(PORTAL_NAME, __scopeMenu);
37645
- return /* @__PURE__ */ jsx34(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx34(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx34(Portal, { asChild: true, container, children }) }) });
37728
+ return /* @__PURE__ */ jsx35(PortalProvider, { scope: __scopeMenu, forceMount, children: /* @__PURE__ */ jsx35(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx35(Portal, { asChild: true, container, children }) }) });
37646
37729
  }, "MenuPortal");
37647
37730
  var CONTENT_NAME2 = "MenuContent";
37648
37731
  var [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME2);
@@ -37652,7 +37735,7 @@ var MenuContent = /* @__PURE__ */ React41.forwardRef(
37652
37735
  const { forceMount = portalContext.forceMount, ...contentProps } = props;
37653
37736
  const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
37654
37737
  const rootContext = useMenuRootContext(CONTENT_NAME2, props.__scopeMenu);
37655
- return /* @__PURE__ */ jsx34(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx34(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx34(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx34(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx34(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
37738
+ return /* @__PURE__ */ jsx35(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx35(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx35(Collection2.Slot, { scope: props.__scopeMenu, children: rootContext.modal ? /* @__PURE__ */ jsx35(MenuRootContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx35(MenuRootContentNonModal, { ...contentProps, ref: forwardedRef }) }) }) });
37656
37739
  }, "MenuContent")
37657
37740
  );
37658
37741
  var MenuRootContentModal = /* @__PURE__ */ React41.forwardRef(
@@ -37665,7 +37748,7 @@ var MenuRootContentModal = /* @__PURE__ */ React41.forwardRef(
37665
37748
  const content = ref.current;
37666
37749
  if (content) return hideOthers(content);
37667
37750
  }, []);
37668
- return /* @__PURE__ */ jsx34(
37751
+ return /* @__PURE__ */ jsx35(
37669
37752
  MenuContentImpl,
37670
37753
  {
37671
37754
  ...props,
@@ -37685,7 +37768,7 @@ var MenuRootContentModal = /* @__PURE__ */ React41.forwardRef(
37685
37768
  );
37686
37769
  var MenuRootContentNonModal = /* @__PURE__ */ React41.forwardRef(/* @__PURE__ */ __name21(function MenuRootContentNonModal2(props, forwardedRef) {
37687
37770
  const context = useMenuContext(CONTENT_NAME2, props.__scopeMenu);
37688
- return /* @__PURE__ */ jsx34(
37771
+ return /* @__PURE__ */ jsx35(
37689
37772
  MenuContentImpl,
37690
37773
  {
37691
37774
  ...props,
@@ -37777,7 +37860,7 @@ var MenuContentImpl = /* @__PURE__ */ React41.forwardRef(
37777
37860
  const isMovingTowards = pointerDirRef.current === pointerGraceIntentRef.current?.side;
37778
37861
  return isMovingTowards && isPointerInGraceArea(event, pointerGraceIntentRef.current?.area);
37779
37862
  }, []);
37780
- return /* @__PURE__ */ jsx34(
37863
+ return /* @__PURE__ */ jsx35(
37781
37864
  MenuContentProvider,
37782
37865
  {
37783
37866
  scope: __scopeMenu,
@@ -37806,7 +37889,7 @@ var MenuContentImpl = /* @__PURE__ */ React41.forwardRef(
37806
37889
  onPointerGraceIntentChange: React41.useCallback((intent) => {
37807
37890
  pointerGraceIntentRef.current = intent;
37808
37891
  }, []),
37809
- children: /* @__PURE__ */ jsx34(FocusScopeBranchProvider, { registry: isModal ? branchRegistry : null, children: /* @__PURE__ */ jsx34(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx34(
37892
+ children: /* @__PURE__ */ jsx35(FocusScopeBranchProvider, { registry: isModal ? branchRegistry : null, children: /* @__PURE__ */ jsx35(ScrollLockWrapper, { ...scrollLockWrapperProps, children: /* @__PURE__ */ jsx35(
37810
37893
  FocusScope,
37811
37894
  {
37812
37895
  asChild: true,
@@ -37817,7 +37900,7 @@ var MenuContentImpl = /* @__PURE__ */ React41.forwardRef(
37817
37900
  contentRef.current?.focus({ preventScroll: true });
37818
37901
  }),
37819
37902
  onUnmountAutoFocus: onCloseAutoFocus,
37820
- children: /* @__PURE__ */ jsx34(
37903
+ children: /* @__PURE__ */ jsx35(
37821
37904
  DismissableLayer,
37822
37905
  {
37823
37906
  asChild: true,
@@ -37827,7 +37910,7 @@ var MenuContentImpl = /* @__PURE__ */ React41.forwardRef(
37827
37910
  onFocusOutside,
37828
37911
  onInteractOutside,
37829
37912
  onDismiss,
37830
- children: /* @__PURE__ */ jsx34(
37913
+ children: /* @__PURE__ */ jsx35(
37831
37914
  RovingFocusGroup,
37832
37915
  {
37833
37916
  asChild: true,
@@ -37841,7 +37924,7 @@ var MenuContentImpl = /* @__PURE__ */ React41.forwardRef(
37841
37924
  if (!rootContext.isUsingKeyboardRef.current) event.preventDefault();
37842
37925
  }),
37843
37926
  preventScrollOnEntryFocus: true,
37844
- children: /* @__PURE__ */ jsx34(
37927
+ children: /* @__PURE__ */ jsx35(
37845
37928
  PopperContent,
37846
37929
  {
37847
37930
  role: "menu",
@@ -37925,7 +38008,7 @@ var MenuItem = /* @__PURE__ */ React41.forwardRef(
37925
38008
  }
37926
38009
  }
37927
38010
  }, "handleSelect");
37928
- return /* @__PURE__ */ jsx34(
38011
+ return /* @__PURE__ */ jsx35(
37929
38012
  MenuItemImpl,
37930
38013
  {
37931
38014
  ...itemProps,
@@ -37971,13 +38054,13 @@ var MenuItemImpl = /* @__PURE__ */ React41.forwardRef(
37971
38054
  setTextContent((menuItem.textContent ?? "").trim());
37972
38055
  }
37973
38056
  }, [itemProps.children]);
37974
- return /* @__PURE__ */ jsx34(
38057
+ return /* @__PURE__ */ jsx35(
37975
38058
  Collection2.ItemSlot,
37976
38059
  {
37977
38060
  scope: __scopeMenu,
37978
38061
  disabled,
37979
38062
  textValue: textValue ?? textContent,
37980
- children: /* @__PURE__ */ jsx34(RovingFocusGroupItem, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx34(
38063
+ children: /* @__PURE__ */ jsx35(RovingFocusGroupItem, { asChild: true, ...rovingFocusGroupScope, focusable: !disabled, children: /* @__PURE__ */ jsx35(
37981
38064
  Primitive.div,
37982
38065
  {
37983
38066
  role: "menuitem",
@@ -38016,7 +38099,7 @@ var MenuCheckboxItem = /* @__PURE__ */ React41.forwardRef(
38016
38099
  // blank line to reduce diff noise
38017
38100
  /* @__PURE__ */ __name21(function MenuCheckboxItem2(props, forwardedRef) {
38018
38101
  const { checked = false, onCheckedChange, ...checkboxItemProps } = props;
38019
- return /* @__PURE__ */ jsx34(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx34(
38102
+ return /* @__PURE__ */ jsx35(ItemIndicatorProvider, { scope: props.__scopeMenu, checked, children: /* @__PURE__ */ jsx35(
38020
38103
  MenuItem,
38021
38104
  {
38022
38105
  role: "menuitemcheckbox",
@@ -38047,7 +38130,7 @@ var [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(
38047
38130
  var MenuSeparator = /* @__PURE__ */ React41.forwardRef(
38048
38131
  /* @__PURE__ */ __name21(function MenuSeparator2(props, forwardedRef) {
38049
38132
  const { __scopeMenu, ...separatorProps } = props;
38050
- return /* @__PURE__ */ jsx34(
38133
+ return /* @__PURE__ */ jsx35(
38051
38134
  Primitive.div,
38052
38135
  {
38053
38136
  role: "separator",
@@ -38071,7 +38154,7 @@ var MenuSub = /* @__PURE__ */ __name21((props) => {
38071
38154
  if (parentMenuContext.open === false) handleOpenChange(false);
38072
38155
  return () => handleOpenChange(false);
38073
38156
  }, [parentMenuContext.open, handleOpenChange]);
38074
- return /* @__PURE__ */ jsx34(Popper, { ...popperScope, children: /* @__PURE__ */ jsx34(
38157
+ return /* @__PURE__ */ jsx35(Popper, { ...popperScope, children: /* @__PURE__ */ jsx35(
38075
38158
  MenuProvider,
38076
38159
  {
38077
38160
  scope: __scopeMenu,
@@ -38079,7 +38162,7 @@ var MenuSub = /* @__PURE__ */ __name21((props) => {
38079
38162
  onOpenChange: handleOpenChange,
38080
38163
  content,
38081
38164
  onContentChange: setContent,
38082
- children: /* @__PURE__ */ jsx34(
38165
+ children: /* @__PURE__ */ jsx35(
38083
38166
  MenuSubProvider,
38084
38167
  {
38085
38168
  scope: __scopeMenu,
@@ -38116,7 +38199,7 @@ var MenuSubTrigger = /* @__PURE__ */ React41.forwardRef(
38116
38199
  };
38117
38200
  }, [pointerGraceTimerRef, onPointerGraceIntentChange]);
38118
38201
  const composedRefs = useComposedRefs(forwardedRef, subContext.onTriggerChange);
38119
- return /* @__PURE__ */ jsx34(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx34(
38202
+ return /* @__PURE__ */ jsx35(MenuAnchor, { asChild: true, ...scope, children: /* @__PURE__ */ jsx35(
38120
38203
  MenuItemImpl,
38121
38204
  {
38122
38205
  id: subContext.triggerId,
@@ -38209,7 +38292,7 @@ var MenuSubContent = /* @__PURE__ */ React41.forwardRef(
38209
38292
  const subContext = useMenuSubContext(SUB_CONTENT_NAME, props.__scopeMenu);
38210
38293
  const ref = React41.useRef(null);
38211
38294
  const composedRefs = useComposedRefs(forwardedRef, ref);
38212
- return /* @__PURE__ */ jsx34(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx34(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx34(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx34(
38295
+ return /* @__PURE__ */ jsx35(Collection2.Provider, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx35(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx35(Collection2.Slot, { scope: props.__scopeMenu, children: /* @__PURE__ */ jsx35(
38213
38296
  MenuContentImpl,
38214
38297
  {
38215
38298
  id: subContext.contentId,
@@ -38312,7 +38395,7 @@ function whenMouse(handler) {
38312
38395
  __name21(whenMouse, "whenMouse");
38313
38396
 
38314
38397
  // node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs
38315
- import { jsx as jsx35 } from "react/jsx-runtime";
38398
+ import { jsx as jsx36 } from "react/jsx-runtime";
38316
38399
  var __defProp23 = Object.defineProperty;
38317
38400
  var __name22 = (target, value) => __defProp23(target, "name", { value, configurable: true });
38318
38401
  var DROPDOWN_MENU_NAME = "DropdownMenu";
@@ -38340,7 +38423,7 @@ var DropdownMenu = /* @__PURE__ */ __name22((props) => {
38340
38423
  onChange: onOpenChange,
38341
38424
  caller: DROPDOWN_MENU_NAME
38342
38425
  });
38343
- return /* @__PURE__ */ jsx35(
38426
+ return /* @__PURE__ */ jsx36(
38344
38427
  DropdownMenuProvider,
38345
38428
  {
38346
38429
  scope: __scopeDropdownMenu,
@@ -38351,7 +38434,7 @@ var DropdownMenu = /* @__PURE__ */ __name22((props) => {
38351
38434
  onOpenChange: setOpen,
38352
38435
  onOpenToggle: React42.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
38353
38436
  modal,
38354
- children: /* @__PURE__ */ jsx35(Menu, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
38437
+ children: /* @__PURE__ */ jsx36(Menu, { ...menuScope, open, onOpenChange: setOpen, dir, modal, children })
38355
38438
  }
38356
38439
  );
38357
38440
  }, "DropdownMenu");
@@ -38363,7 +38446,7 @@ var DropdownMenuTrigger = /* @__PURE__ */ React42.forwardRef(
38363
38446
  const context = useDropdownMenuContext(TRIGGER_NAME, __scopeDropdownMenu);
38364
38447
  const menuScope = useMenuScope(__scopeDropdownMenu);
38365
38448
  const composedRefs = useComposedRefs(forwardedRef, context.triggerRef);
38366
- return /* @__PURE__ */ jsx35(MenuAnchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx35(
38449
+ return /* @__PURE__ */ jsx36(MenuAnchor, { asChild: true, ...menuScope, children: /* @__PURE__ */ jsx36(
38367
38450
  Primitive.button,
38368
38451
  {
38369
38452
  type: "button",
@@ -38395,7 +38478,7 @@ var DropdownMenuTrigger = /* @__PURE__ */ React42.forwardRef(
38395
38478
  var DropdownMenuPortal = /* @__PURE__ */ __name22((props) => {
38396
38479
  const { __scopeDropdownMenu, ...portalProps } = props;
38397
38480
  const menuScope = useMenuScope(__scopeDropdownMenu);
38398
- return /* @__PURE__ */ jsx35(MenuPortal, { ...menuScope, ...portalProps });
38481
+ return /* @__PURE__ */ jsx36(MenuPortal, { ...menuScope, ...portalProps });
38399
38482
  }, "DropdownMenuPortal");
38400
38483
  var CONTENT_NAME3 = "DropdownMenuContent";
38401
38484
  var DropdownMenuContent = /* @__PURE__ */ React42.forwardRef(
@@ -38405,7 +38488,7 @@ var DropdownMenuContent = /* @__PURE__ */ React42.forwardRef(
38405
38488
  const context = useDropdownMenuContext(CONTENT_NAME3, __scopeDropdownMenu);
38406
38489
  const menuScope = useMenuScope(__scopeDropdownMenu);
38407
38490
  const hasInteractedOutsideRef = React42.useRef(false);
38408
- return /* @__PURE__ */ jsx35(
38491
+ return /* @__PURE__ */ jsx36(
38409
38492
  MenuContent,
38410
38493
  {
38411
38494
  id: context.contentId,
@@ -38444,18 +38527,18 @@ var DropdownMenuItem = /* @__PURE__ */ React42.forwardRef(
38444
38527
  /* @__PURE__ */ __name22(function DropdownMenuItem2(props, forwardedRef) {
38445
38528
  const { __scopeDropdownMenu, ...itemProps } = props;
38446
38529
  const menuScope = useMenuScope(__scopeDropdownMenu);
38447
- return /* @__PURE__ */ jsx35(MenuItem, { ...menuScope, ...itemProps, ref: forwardedRef });
38530
+ return /* @__PURE__ */ jsx36(MenuItem, { ...menuScope, ...itemProps, ref: forwardedRef });
38448
38531
  }, "DropdownMenuItem")
38449
38532
  );
38450
38533
  var DropdownMenuCheckboxItem = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuCheckboxItem2(props, forwardedRef) {
38451
38534
  const { __scopeDropdownMenu, ...checkboxItemProps } = props;
38452
38535
  const menuScope = useMenuScope(__scopeDropdownMenu);
38453
- return /* @__PURE__ */ jsx35(MenuCheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
38536
+ return /* @__PURE__ */ jsx36(MenuCheckboxItem, { ...menuScope, ...checkboxItemProps, ref: forwardedRef });
38454
38537
  }, "DropdownMenuCheckboxItem"));
38455
38538
  var DropdownMenuSeparator = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSeparator2(props, forwardedRef) {
38456
38539
  const { __scopeDropdownMenu, ...separatorProps } = props;
38457
38540
  const menuScope = useMenuScope(__scopeDropdownMenu);
38458
- return /* @__PURE__ */ jsx35(MenuSeparator, { ...menuScope, ...separatorProps, ref: forwardedRef });
38541
+ return /* @__PURE__ */ jsx36(MenuSeparator, { ...menuScope, ...separatorProps, ref: forwardedRef });
38459
38542
  }, "DropdownMenuSeparator"));
38460
38543
  var DropdownMenuSub = /* @__PURE__ */ __name22((props) => {
38461
38544
  const { __scopeDropdownMenu, children, open: openProp, onOpenChange, defaultOpen } = props;
@@ -38466,17 +38549,17 @@ var DropdownMenuSub = /* @__PURE__ */ __name22((props) => {
38466
38549
  onChange: onOpenChange,
38467
38550
  caller: "DropdownMenuSub"
38468
38551
  });
38469
- return /* @__PURE__ */ jsx35(MenuSub, { ...menuScope, open, onOpenChange: setOpen, children });
38552
+ return /* @__PURE__ */ jsx36(MenuSub, { ...menuScope, open, onOpenChange: setOpen, children });
38470
38553
  }, "DropdownMenuSub");
38471
38554
  var DropdownMenuSubTrigger = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubTrigger2(props, forwardedRef) {
38472
38555
  const { __scopeDropdownMenu, ...subTriggerProps } = props;
38473
38556
  const menuScope = useMenuScope(__scopeDropdownMenu);
38474
- return /* @__PURE__ */ jsx35(MenuSubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
38557
+ return /* @__PURE__ */ jsx36(MenuSubTrigger, { ...menuScope, ...subTriggerProps, ref: forwardedRef });
38475
38558
  }, "DropdownMenuSubTrigger"));
38476
38559
  var DropdownMenuSubContent = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */ __name22(function DropdownMenuSubContent2(props, forwardedRef) {
38477
38560
  const { __scopeDropdownMenu, ...subContentProps } = props;
38478
38561
  const menuScope = useMenuScope(__scopeDropdownMenu);
38479
- return /* @__PURE__ */ jsx35(
38562
+ return /* @__PURE__ */ jsx36(
38480
38563
  MenuSubContent,
38481
38564
  {
38482
38565
  ...menuScope,
@@ -38499,7 +38582,7 @@ var DropdownMenuSubContent = /* @__PURE__ */ React42.forwardRef(/* @__PURE__ */
38499
38582
 
38500
38583
  // src/components/ViewportSubContent.tsx
38501
38584
  import { useLayoutEffect as useLayoutEffect5, useState as useState40 } from "react";
38502
- import { jsx as jsx36 } from "react/jsx-runtime";
38585
+ import { jsx as jsx37 } from "react/jsx-runtime";
38503
38586
  var ViewportSubContent = (props) => {
38504
38587
  const [content, setContent] = useState40(null);
38505
38588
  const [overlapWidth, setOverlapWidth] = useState40();
@@ -38530,7 +38613,7 @@ var ViewportSubContent = (props) => {
38530
38613
  window.removeEventListener("resize", update);
38531
38614
  };
38532
38615
  }, [content]);
38533
- return /* @__PURE__ */ jsx36(
38616
+ return /* @__PURE__ */ jsx37(
38534
38617
  DropdownMenuSubContent,
38535
38618
  {
38536
38619
  ...props,
@@ -38563,8 +38646,8 @@ import { useState as useState42 } from "react";
38563
38646
  import { useState as useState41 } from "react";
38564
38647
 
38565
38648
  // src/components/Icons.tsx
38566
- import { jsx as jsx37 } from "react/jsx-runtime";
38567
- var CheckIcon = () => /* @__PURE__ */ jsx37(
38649
+ import { jsx as jsx38 } from "react/jsx-runtime";
38650
+ var CheckIcon = () => /* @__PURE__ */ jsx38(
38568
38651
  "svg",
38569
38652
  {
38570
38653
  xmlns: "http://www.w3.org/2000/svg",
@@ -38576,10 +38659,10 @@ var CheckIcon = () => /* @__PURE__ */ jsx37(
38576
38659
  strokeWidth: "2",
38577
38660
  strokeLinecap: "round",
38578
38661
  strokeLinejoin: "round",
38579
- children: /* @__PURE__ */ jsx37("path", { d: "M20 6 9 17l-5-5" })
38662
+ children: /* @__PURE__ */ jsx38("path", { d: "M20 6 9 17l-5-5" })
38580
38663
  }
38581
38664
  );
38582
- var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx37(
38665
+ var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx38(
38583
38666
  "svg",
38584
38667
  {
38585
38668
  xmlns: "http://www.w3.org/2000/svg",
@@ -38596,10 +38679,10 @@ var ChevronRightIcon = ({ isOpen }) => /* @__PURE__ */ jsx37(
38596
38679
  transform: isOpen ? "rotate(90deg)" : "rotate(0deg)",
38597
38680
  opacity: 0.6
38598
38681
  },
38599
- children: /* @__PURE__ */ jsx37("path", { d: "m9 18 6-6-6-6" })
38682
+ children: /* @__PURE__ */ jsx38("path", { d: "m9 18 6-6-6-6" })
38600
38683
  }
38601
38684
  );
38602
- var CheckMinusIcon = () => /* @__PURE__ */ jsx37(
38685
+ var CheckMinusIcon = () => /* @__PURE__ */ jsx38(
38603
38686
  "svg",
38604
38687
  {
38605
38688
  xmlns: "http://www.w3.org/2000/svg",
@@ -38611,10 +38694,10 @@ var CheckMinusIcon = () => /* @__PURE__ */ jsx37(
38611
38694
  strokeWidth: "2",
38612
38695
  strokeLinecap: "round",
38613
38696
  strokeLinejoin: "round",
38614
- children: /* @__PURE__ */ jsx37("path", { d: "M5 12h14" })
38697
+ children: /* @__PURE__ */ jsx38("path", { d: "M5 12h14" })
38615
38698
  }
38616
38699
  );
38617
- var DotIcon = () => /* @__PURE__ */ jsx37(
38700
+ var DotIcon = () => /* @__PURE__ */ jsx38(
38618
38701
  "svg",
38619
38702
  {
38620
38703
  xmlns: "http://www.w3.org/2000/svg",
@@ -38627,12 +38710,12 @@ var DotIcon = () => /* @__PURE__ */ jsx37(
38627
38710
  strokeLinecap: "round",
38628
38711
  strokeLinejoin: "round",
38629
38712
  className: "lucide lucide-dot-icon lucide-dot",
38630
- children: /* @__PURE__ */ jsx37("circle", { cx: "12.1", cy: "12.1", r: "4.5", fill: "white" })
38713
+ children: /* @__PURE__ */ jsx38("circle", { cx: "12.1", cy: "12.1", r: "4.5", fill: "white" })
38631
38714
  }
38632
38715
  );
38633
38716
 
38634
38717
  // src/components/AppearanceMenu.tsx
38635
- import { Fragment as Fragment10, jsx as jsx38, jsxs as jsxs9 } from "react/jsx-runtime";
38718
+ import { Fragment as Fragment10, jsx as jsx39, jsxs as jsxs9 } from "react/jsx-runtime";
38636
38719
  var itemStyles = {
38637
38720
  padding: "6px 8px",
38638
38721
  borderRadius: 6,
@@ -38695,7 +38778,7 @@ var AppearanceMenu = ({
38695
38778
  const assemblyStyles = { ...itemStyles };
38696
38779
  if (hoveredItem === "assembly") assemblyStyles.backgroundColor = "#404040";
38697
38780
  return /* @__PURE__ */ jsxs9(Fragment10, { children: [
38698
- /* @__PURE__ */ jsx38(DropdownMenuSeparator, { style: separatorStyles }),
38781
+ /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles }),
38699
38782
  /* @__PURE__ */ jsxs9(DropdownMenuSub, { onOpenChange: setAppearanceSubOpen, children: [
38700
38783
  /* @__PURE__ */ jsxs9(
38701
38784
  DropdownMenuSubTrigger,
@@ -38709,8 +38792,8 @@ var AppearanceMenu = ({
38709
38792
  onMouseLeave: () => setHoveredItem(null),
38710
38793
  onTouchStart: () => setHoveredItem("appearance"),
38711
38794
  children: [
38712
- /* @__PURE__ */ jsx38("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Appearance" }),
38713
- /* @__PURE__ */ jsx38(
38795
+ /* @__PURE__ */ jsx39("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Appearance" }),
38796
+ /* @__PURE__ */ jsx39(
38714
38797
  "div",
38715
38798
  {
38716
38799
  style: {
@@ -38719,13 +38802,13 @@ var AppearanceMenu = ({
38719
38802
  alignItems: "flex-end",
38720
38803
  marginBottom: "-5px"
38721
38804
  },
38722
- children: /* @__PURE__ */ jsx38(ChevronRightIcon, { isOpen: appearanceSubOpen })
38805
+ children: /* @__PURE__ */ jsx39(ChevronRightIcon, { isOpen: appearanceSubOpen })
38723
38806
  }
38724
38807
  )
38725
38808
  ]
38726
38809
  }
38727
38810
  ),
38728
- /* @__PURE__ */ jsx38(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs9(
38811
+ /* @__PURE__ */ jsx39(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs9(
38729
38812
  ViewportSubContent,
38730
38813
  {
38731
38814
  style: { ...contentStyles, marginLeft: -2 },
@@ -38748,8 +38831,8 @@ var AppearanceMenu = ({
38748
38831
  onMouseLeave: () => setHoveredItem(null),
38749
38832
  onTouchStart: () => setHoveredItem("darkBackground"),
38750
38833
  children: [
38751
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: darkBackgroundEnabled && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38752
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Dark Background" })
38834
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: darkBackgroundEnabled && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38835
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Dark Background" })
38753
38836
  ]
38754
38837
  }
38755
38838
  ),
@@ -38769,13 +38852,13 @@ var AppearanceMenu = ({
38769
38852
  onMouseLeave: () => setHoveredItem(null),
38770
38853
  onTouchStart: () => setHoveredItem("lighting"),
38771
38854
  children: [
38772
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: lightingEnabled && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38773
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Lighting" })
38855
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: lightingEnabled && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38856
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Lighting" })
38774
38857
  ]
38775
38858
  }
38776
38859
  ),
38777
38860
  showLayerControls && /* @__PURE__ */ jsxs9(Fragment10, { children: [
38778
- /* @__PURE__ */ jsx38(DropdownMenuSeparator, { style: separatorStyles }),
38861
+ /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles }),
38779
38862
  /* @__PURE__ */ jsxs9(
38780
38863
  DropdownMenuItem,
38781
38864
  {
@@ -38792,8 +38875,8 @@ var AppearanceMenu = ({
38792
38875
  onMouseLeave: () => setHoveredItem(null),
38793
38876
  onTouchStart: () => setHoveredItem("boardBody"),
38794
38877
  children: [
38795
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.boardBody && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38796
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Board Body" })
38878
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.boardBody && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38879
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Board Body" })
38797
38880
  ]
38798
38881
  }
38799
38882
  ),
@@ -38813,8 +38896,8 @@ var AppearanceMenu = ({
38813
38896
  onMouseLeave: () => setHoveredItem(null),
38814
38897
  onTouchStart: () => setHoveredItem("topCopper"),
38815
38898
  children: [
38816
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.topCopper && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38817
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Top Copper" })
38899
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.topCopper && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38900
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Top Copper" })
38818
38901
  ]
38819
38902
  }
38820
38903
  ),
@@ -38834,8 +38917,8 @@ var AppearanceMenu = ({
38834
38917
  onMouseLeave: () => setHoveredItem(null),
38835
38918
  onTouchStart: () => setHoveredItem("bottomCopper"),
38836
38919
  children: [
38837
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.bottomCopper && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38838
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Copper" })
38920
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.bottomCopper && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38921
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Copper" })
38839
38922
  ]
38840
38923
  }
38841
38924
  ),
@@ -38855,8 +38938,8 @@ var AppearanceMenu = ({
38855
38938
  onMouseLeave: () => setHoveredItem(null),
38856
38939
  onTouchStart: () => setHoveredItem("keepout"),
38857
38940
  children: [
38858
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.keepout && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38859
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Keepout" })
38941
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.keepout && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38942
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Keepout" })
38860
38943
  ]
38861
38944
  }
38862
38945
  ),
@@ -38879,8 +38962,8 @@ var AppearanceMenu = ({
38879
38962
  onMouseLeave: () => setHoveredItem(null),
38880
38963
  onTouchStart: () => setHoveredItem("topSilkscreen"),
38881
38964
  children: [
38882
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.topSilkscreen && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38883
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Top Silkscreen" })
38965
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.topSilkscreen && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38966
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Top Silkscreen" })
38884
38967
  ]
38885
38968
  }
38886
38969
  ),
@@ -38903,8 +38986,8 @@ var AppearanceMenu = ({
38903
38986
  onMouseLeave: () => setHoveredItem(null),
38904
38987
  onTouchStart: () => setHoveredItem("bottomSilkscreen"),
38905
38988
  children: [
38906
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.bottomSilkscreen && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38907
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Silkscreen" })
38989
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.bottomSilkscreen && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
38990
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Silkscreen" })
38908
38991
  ]
38909
38992
  }
38910
38993
  ),
@@ -38924,8 +39007,8 @@ var AppearanceMenu = ({
38924
39007
  onMouseLeave: () => setHoveredItem(null),
38925
39008
  onTouchStart: () => setHoveredItem("topMask"),
38926
39009
  children: [
38927
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.topMask && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38928
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Top Soldermask" })
39010
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.topMask && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39011
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Top Soldermask" })
38929
39012
  ]
38930
39013
  }
38931
39014
  ),
@@ -38945,8 +39028,8 @@ var AppearanceMenu = ({
38945
39028
  onMouseLeave: () => setHoveredItem(null),
38946
39029
  onTouchStart: () => setHoveredItem("bottomMask"),
38947
39030
  children: [
38948
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.bottomMask && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38949
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Soldermask" })
39031
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.bottomMask && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39032
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Bottom Soldermask" })
38950
39033
  ]
38951
39034
  }
38952
39035
  ),
@@ -38966,8 +39049,8 @@ var AppearanceMenu = ({
38966
39049
  onMouseLeave: () => setHoveredItem(null),
38967
39050
  onTouchStart: () => setHoveredItem("pcbNotes"),
38968
39051
  children: [
38969
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.pcbNotes && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38970
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "PCB Notes" })
39052
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.pcbNotes && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39053
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "PCB Notes" })
38971
39054
  ]
38972
39055
  }
38973
39056
  ),
@@ -38987,8 +39070,8 @@ var AppearanceMenu = ({
38987
39070
  onMouseLeave: () => setHoveredItem(null),
38988
39071
  onTouchStart: () => setHoveredItem("smtModels"),
38989
39072
  children: [
38990
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.smtModels && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
38991
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Surface Mount Components" })
39073
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.smtModels && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39074
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Surface Mount Components" })
38992
39075
  ]
38993
39076
  }
38994
39077
  ),
@@ -39011,12 +39094,12 @@ var AppearanceMenu = ({
39011
39094
  onMouseLeave: () => setHoveredItem(null),
39012
39095
  onTouchStart: () => setHoveredItem("throughHoleModels"),
39013
39096
  children: [
39014
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.throughHoleModels && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
39015
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Through-Hole Components" })
39097
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.throughHoleModels && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39098
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Through-Hole Components" })
39016
39099
  ]
39017
39100
  }
39018
39101
  ),
39019
- /* @__PURE__ */ jsx38(DropdownMenuSeparator, { style: separatorStyles }),
39102
+ /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles }),
39020
39103
  /* @__PURE__ */ jsxs9(
39021
39104
  DropdownMenuItem,
39022
39105
  {
@@ -39038,10 +39121,10 @@ var AppearanceMenu = ({
39038
39121
  title: `Enclosure: ${visibility.enclosure}`,
39039
39122
  children: [
39040
39123
  /* @__PURE__ */ jsxs9("span", { style: iconContainerStyles, children: [
39041
- visibility.enclosure === "opaque" && /* @__PURE__ */ jsx38(CheckIcon, {}),
39042
- visibility.enclosure === "translucent" && /* @__PURE__ */ jsx38(CheckMinusIcon, {})
39124
+ visibility.enclosure === "opaque" && /* @__PURE__ */ jsx39(CheckIcon, {}),
39125
+ visibility.enclosure === "translucent" && /* @__PURE__ */ jsx39(CheckMinusIcon, {})
39043
39126
  ] }),
39044
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Enclosure" })
39127
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Enclosure" })
39045
39128
  ]
39046
39129
  }
39047
39130
  ),
@@ -39058,8 +39141,8 @@ var AppearanceMenu = ({
39058
39141
  onMouseLeave: () => setHoveredItem(null),
39059
39142
  onTouchStart: () => setHoveredItem("assembly"),
39060
39143
  children: [
39061
- /* @__PURE__ */ jsx38("span", { style: iconContainerStyles, children: visibility.assembly && /* @__PURE__ */ jsx38(CheckIcon, {}) }),
39062
- /* @__PURE__ */ jsx38("span", { style: { display: "flex", alignItems: "center" }, children: "Assembly" })
39144
+ /* @__PURE__ */ jsx39("span", { style: iconContainerStyles, children: visibility.assembly && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39145
+ /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Assembly" })
39063
39146
  ]
39064
39147
  }
39065
39148
  )
@@ -39072,7 +39155,7 @@ var AppearanceMenu = ({
39072
39155
  };
39073
39156
 
39074
39157
  // src/components/ContextMenu.tsx
39075
- import { Fragment as Fragment11, jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
39158
+ import { Fragment as Fragment11, jsx as jsx40, jsxs as jsxs10 } from "react/jsx-runtime";
39076
39159
  var cameraOptions = [
39077
39160
  "Custom",
39078
39161
  "Top Center Angled",
@@ -39159,9 +39242,10 @@ var ContextMenu = ({
39159
39242
  onReferenceObjectSelect = () => {
39160
39243
  },
39161
39244
  onViewSchematicComponent,
39162
- componentName,
39163
- onHideComponent,
39164
- onUnhideAllComponents,
39245
+ objectName,
39246
+ onHideObject,
39247
+ onIsolateObject,
39248
+ onUnhideAll,
39165
39249
  onSectionView,
39166
39250
  onExplosionView,
39167
39251
  explosionAvailable = false,
@@ -39174,7 +39258,7 @@ var ContextMenu = ({
39174
39258
  const [advancedSubOpen, setAdvancedSubOpen] = useState42(false);
39175
39259
  const [referenceObjectSubOpen, setReferenceObjectSubOpen] = useState42(false);
39176
39260
  const [hoveredItem, setHoveredItem] = useState42(null);
39177
- return /* @__PURE__ */ jsx39(
39261
+ return /* @__PURE__ */ jsx40(
39178
39262
  "div",
39179
39263
  {
39180
39264
  ref: menuRef,
@@ -39186,8 +39270,8 @@ var ContextMenu = ({
39186
39270
  height: 0
39187
39271
  },
39188
39272
  children: /* @__PURE__ */ jsxs10(DropdownMenu, { open: true, modal: false, children: [
39189
- /* @__PURE__ */ jsx39(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx39("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
39190
- /* @__PURE__ */ jsx39(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(
39273
+ /* @__PURE__ */ jsx40(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx40("div", { style: { position: "absolute", width: 1, height: 1 } }) }),
39274
+ /* @__PURE__ */ jsx40(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(
39191
39275
  DropdownMenuContent,
39192
39276
  {
39193
39277
  style: contentStyles2,
@@ -39196,7 +39280,7 @@ var ContextMenu = ({
39196
39280
  sideOffset: 0,
39197
39281
  align: "start",
39198
39282
  children: [
39199
- onHideComponent && /* @__PURE__ */ jsx39(
39283
+ onHideObject && /* @__PURE__ */ jsx40(
39200
39284
  DropdownMenuItem,
39201
39285
  {
39202
39286
  style: {
@@ -39204,13 +39288,27 @@ var ContextMenu = ({
39204
39288
  ...itemPaddingStyles2,
39205
39289
  backgroundColor: hoveredItem === "hide" ? "#404040" : "transparent"
39206
39290
  },
39207
- onSelect: onHideComponent,
39291
+ onSelect: onHideObject,
39208
39292
  onMouseEnter: () => setHoveredItem("hide"),
39209
39293
  onMouseLeave: () => setHoveredItem(null),
39210
- children: `Hide "${componentName}"`
39294
+ children: `Hide "${objectName}"`
39295
+ }
39296
+ ),
39297
+ onIsolateObject && /* @__PURE__ */ jsx40(
39298
+ DropdownMenuItem,
39299
+ {
39300
+ style: {
39301
+ ...itemStyles2,
39302
+ ...itemPaddingStyles2,
39303
+ backgroundColor: hoveredItem === "isolate" ? "#404040" : "transparent"
39304
+ },
39305
+ onSelect: onIsolateObject,
39306
+ onMouseEnter: () => setHoveredItem("isolate"),
39307
+ onMouseLeave: () => setHoveredItem(null),
39308
+ children: `Isolate "${objectName}"`
39211
39309
  }
39212
39310
  ),
39213
- onViewSchematicComponent && /* @__PURE__ */ jsx39(Fragment11, { children: /* @__PURE__ */ jsx39(
39311
+ onViewSchematicComponent && /* @__PURE__ */ jsx40(Fragment11, { children: /* @__PURE__ */ jsx40(
39214
39312
  DropdownMenuItem,
39215
39313
  {
39216
39314
  style: {
@@ -39224,7 +39322,7 @@ var ContextMenu = ({
39224
39322
  children: "Show on schematic"
39225
39323
  }
39226
39324
  ) }),
39227
- onUnhideAllComponents && /* @__PURE__ */ jsx39(
39325
+ onUnhideAll && /* @__PURE__ */ jsx40(
39228
39326
  DropdownMenuItem,
39229
39327
  {
39230
39328
  style: {
@@ -39232,13 +39330,13 @@ var ContextMenu = ({
39232
39330
  ...itemPaddingStyles2,
39233
39331
  backgroundColor: hoveredItem === "unhide" ? "#404040" : "transparent"
39234
39332
  },
39235
- onSelect: onUnhideAllComponents,
39333
+ onSelect: onUnhideAll,
39236
39334
  onMouseEnter: () => setHoveredItem("unhide"),
39237
39335
  onMouseLeave: () => setHoveredItem(null),
39238
- children: "Unhide All Components"
39336
+ children: "Unhide All"
39239
39337
  }
39240
39338
  ),
39241
- (onViewSchematicComponent || onHideComponent || onUnhideAllComponents) && /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles2 }),
39339
+ (onViewSchematicComponent || onHideObject || onIsolateObject || onUnhideAll) && /* @__PURE__ */ jsx40(DropdownMenuSeparator, { style: separatorStyles2 }),
39242
39340
  /* @__PURE__ */ jsxs10(DropdownMenuSub, { onOpenChange: setCameraSubOpen, children: [
39243
39341
  /* @__PURE__ */ jsxs10(
39244
39342
  DropdownMenuSubTrigger,
@@ -39252,7 +39350,7 @@ var ContextMenu = ({
39252
39350
  onMouseLeave: () => setHoveredItem(null),
39253
39351
  onTouchStart: () => setHoveredItem("camera"),
39254
39352
  children: [
39255
- /* @__PURE__ */ jsx39(
39353
+ /* @__PURE__ */ jsx40(
39256
39354
  "span",
39257
39355
  {
39258
39356
  style: { flex: 1, display: "flex", alignItems: "center" },
@@ -39269,15 +39367,15 @@ var ContextMenu = ({
39269
39367
  marginLeft: "auto"
39270
39368
  },
39271
39369
  children: [
39272
- /* @__PURE__ */ jsx39("span", { style: { opacity: 0.55, fontSize: 13 }, children: cameraPreset }),
39273
- /* @__PURE__ */ jsx39(ChevronRightIcon, { isOpen: cameraSubOpen })
39370
+ /* @__PURE__ */ jsx40("span", { style: { opacity: 0.55, fontSize: 13 }, children: cameraPreset }),
39371
+ /* @__PURE__ */ jsx40(ChevronRightIcon, { isOpen: cameraSubOpen })
39274
39372
  ]
39275
39373
  }
39276
39374
  )
39277
39375
  ]
39278
39376
  }
39279
39377
  ),
39280
- /* @__PURE__ */ jsx39(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(
39378
+ /* @__PURE__ */ jsx40(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(
39281
39379
  ViewportSubContent,
39282
39380
  {
39283
39381
  style: { ...contentStyles2, marginLeft: -2 },
@@ -39296,13 +39394,13 @@ var ContextMenu = ({
39296
39394
  onMouseLeave: () => setHoveredItem(null),
39297
39395
  onTouchStart: () => setHoveredItem(option),
39298
39396
  children: [
39299
- /* @__PURE__ */ jsx39("span", { style: iconContainerStyles2, children: cameraPreset === option && /* @__PURE__ */ jsx39(DotIcon, {}) }),
39300
- /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: option })
39397
+ /* @__PURE__ */ jsx40("span", { style: iconContainerStyles2, children: cameraPreset === option && /* @__PURE__ */ jsx40(DotIcon, {}) }),
39398
+ /* @__PURE__ */ jsx40("span", { style: { display: "flex", alignItems: "center" }, children: option })
39301
39399
  ]
39302
39400
  },
39303
39401
  option
39304
39402
  )),
39305
- /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles2 }),
39403
+ /* @__PURE__ */ jsx40(DropdownMenuSeparator, { style: separatorStyles2 }),
39306
39404
  /* @__PURE__ */ jsxs10(
39307
39405
  DropdownMenuItem,
39308
39406
  {
@@ -39315,8 +39413,8 @@ var ContextMenu = ({
39315
39413
  onMouseLeave: () => setHoveredItem(null),
39316
39414
  onTouchStart: () => setHoveredItem("autorotate"),
39317
39415
  children: [
39318
- /* @__PURE__ */ jsx39("span", { style: iconContainerStyles2, children: autoRotate && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39319
- /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Auto rotate" })
39416
+ /* @__PURE__ */ jsx40("span", { style: iconContainerStyles2, children: autoRotate && /* @__PURE__ */ jsx40(CheckIcon, {}) }),
39417
+ /* @__PURE__ */ jsx40("span", { style: { display: "flex", alignItems: "center" }, children: "Auto rotate" })
39320
39418
  ]
39321
39419
  }
39322
39420
  ),
@@ -39337,8 +39435,8 @@ var ContextMenu = ({
39337
39435
  onMouseLeave: () => setHoveredItem(null),
39338
39436
  onTouchStart: () => setHoveredItem("cameratype"),
39339
39437
  children: [
39340
- /* @__PURE__ */ jsx39("span", { style: iconContainerStyles2, children: cameraType === "orthographic" && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39341
- /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Orthographic Camera" })
39438
+ /* @__PURE__ */ jsx40("span", { style: iconContainerStyles2, children: cameraType === "orthographic" && /* @__PURE__ */ jsx40(CheckIcon, {}) }),
39439
+ /* @__PURE__ */ jsx40("span", { style: { display: "flex", alignItems: "center" }, children: "Orthographic Camera" })
39342
39440
  ]
39343
39441
  }
39344
39442
  )
@@ -39359,14 +39457,14 @@ var ContextMenu = ({
39359
39457
  onMouseLeave: () => setHoveredItem(null),
39360
39458
  onTouchStart: () => setHoveredItem("reference-object"),
39361
39459
  children: [
39362
- /* @__PURE__ */ jsx39(
39460
+ /* @__PURE__ */ jsx40(
39363
39461
  "span",
39364
39462
  {
39365
39463
  style: { flex: 1, display: "flex", alignItems: "center" },
39366
39464
  children: "Show Reference Object"
39367
39465
  }
39368
39466
  ),
39369
- /* @__PURE__ */ jsx39(
39467
+ /* @__PURE__ */ jsx40(
39370
39468
  "div",
39371
39469
  {
39372
39470
  style: {
@@ -39375,13 +39473,13 @@ var ContextMenu = ({
39375
39473
  gap: 6,
39376
39474
  marginLeft: "auto"
39377
39475
  },
39378
- children: /* @__PURE__ */ jsx39(ChevronRightIcon, { isOpen: referenceObjectSubOpen })
39476
+ children: /* @__PURE__ */ jsx40(ChevronRightIcon, { isOpen: referenceObjectSubOpen })
39379
39477
  }
39380
39478
  )
39381
39479
  ]
39382
39480
  }
39383
39481
  ),
39384
- /* @__PURE__ */ jsx39(DropdownMenuPortal, { children: /* @__PURE__ */ jsx39(
39482
+ /* @__PURE__ */ jsx40(DropdownMenuPortal, { children: /* @__PURE__ */ jsx40(
39385
39483
  ViewportSubContent,
39386
39484
  {
39387
39485
  style: { ...contentStyles2, marginLeft: -2 },
@@ -39405,8 +39503,8 @@ var ContextMenu = ({
39405
39503
  onMouseLeave: () => setHoveredItem(null),
39406
39504
  onTouchStart: () => setHoveredItem(optionKey),
39407
39505
  children: [
39408
- /* @__PURE__ */ jsx39("span", { style: iconContainerStyles2, children: referenceObject === option.type && /* @__PURE__ */ jsx39(DotIcon, {}) }),
39409
- /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: option.label })
39506
+ /* @__PURE__ */ jsx40("span", { style: iconContainerStyles2, children: referenceObject === option.type && /* @__PURE__ */ jsx40(DotIcon, {}) }),
39507
+ /* @__PURE__ */ jsx40("span", { style: { display: "flex", alignItems: "center" }, children: option.label })
39410
39508
  ]
39411
39509
  },
39412
39510
  optionKey
@@ -39427,8 +39525,8 @@ var ContextMenu = ({
39427
39525
  onMouseEnter: () => setHoveredItem("fold"),
39428
39526
  onMouseLeave: () => setHoveredItem(null),
39429
39527
  children: [
39430
- /* @__PURE__ */ jsx39("span", { style: iconContainerStyles2, children: foldPcbs && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39431
- /* @__PURE__ */ jsx39("span", { children: "Fold PCBs" })
39528
+ /* @__PURE__ */ jsx40("span", { style: iconContainerStyles2, children: foldPcbs && /* @__PURE__ */ jsx40(CheckIcon, {}) }),
39529
+ /* @__PURE__ */ jsx40("span", { children: "Fold PCBs" })
39432
39530
  ]
39433
39531
  }
39434
39532
  ),
@@ -39448,20 +39546,20 @@ var ContextMenu = ({
39448
39546
  onMouseLeave: () => setHoveredItem(null),
39449
39547
  onTouchStart: () => setHoveredItem("grid"),
39450
39548
  children: [
39451
- /* @__PURE__ */ jsx39("span", { style: iconContainerStyles2, children: gridEnabled && /* @__PURE__ */ jsx39(CheckIcon, {}) }),
39452
- /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Show Grid" })
39549
+ /* @__PURE__ */ jsx40("span", { style: iconContainerStyles2, children: gridEnabled && /* @__PURE__ */ jsx40(CheckIcon, {}) }),
39550
+ /* @__PURE__ */ jsx40("span", { style: { display: "flex", alignItems: "center" }, children: "Show Grid" })
39453
39551
  ]
39454
39552
  }
39455
39553
  ),
39456
- /* @__PURE__ */ jsx39(
39554
+ /* @__PURE__ */ jsx40(
39457
39555
  AppearanceMenu,
39458
39556
  {
39459
39557
  hasAssembly,
39460
39558
  showLayerControls: !preRendered
39461
39559
  }
39462
39560
  ),
39463
- /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles2 }),
39464
- /* @__PURE__ */ jsx39(
39561
+ /* @__PURE__ */ jsx40(DropdownMenuSeparator, { style: separatorStyles2 }),
39562
+ /* @__PURE__ */ jsx40(
39465
39563
  DropdownMenuItem,
39466
39564
  {
39467
39565
  style: {
@@ -39473,10 +39571,10 @@ var ContextMenu = ({
39473
39571
  onMouseEnter: () => setHoveredItem("download"),
39474
39572
  onMouseLeave: () => setHoveredItem(null),
39475
39573
  onTouchStart: () => setHoveredItem("download"),
39476
- children: /* @__PURE__ */ jsx39("span", { style: { display: "flex", alignItems: "center" }, children: "Download GLTF" })
39574
+ children: /* @__PURE__ */ jsx40("span", { style: { display: "flex", alignItems: "center" }, children: "Download GLTF" })
39477
39575
  }
39478
39576
  ),
39479
- /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles2 }),
39577
+ /* @__PURE__ */ jsx40(DropdownMenuSeparator, { style: separatorStyles2 }),
39480
39578
  (onSectionView || onExplosionView || !flexScene && !preRendered) && /* @__PURE__ */ jsxs10(Fragment11, { children: [
39481
39579
  /* @__PURE__ */ jsxs10(DropdownMenuSub, { onOpenChange: setAdvancedSubOpen, children: [
39482
39580
  /* @__PURE__ */ jsxs10(
@@ -39491,12 +39589,12 @@ var ContextMenu = ({
39491
39589
  onMouseLeave: () => setHoveredItem(null),
39492
39590
  onTouchStart: () => setHoveredItem("advanced"),
39493
39591
  children: [
39494
- /* @__PURE__ */ jsx39("span", { style: { flex: 1 }, children: "Advanced" }),
39495
- /* @__PURE__ */ jsx39(ChevronRightIcon, { isOpen: advancedSubOpen })
39592
+ /* @__PURE__ */ jsx40("span", { style: { flex: 1 }, children: "Advanced" }),
39593
+ /* @__PURE__ */ jsx40(ChevronRightIcon, { isOpen: advancedSubOpen })
39496
39594
  ]
39497
39595
  }
39498
39596
  ),
39499
- /* @__PURE__ */ jsx39(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(
39597
+ /* @__PURE__ */ jsx40(DropdownMenuPortal, { children: /* @__PURE__ */ jsxs10(
39500
39598
  ViewportSubContent,
39501
39599
  {
39502
39600
  style: { ...contentStyles2, marginLeft: -2 },
@@ -39524,7 +39622,7 @@ var ContextMenu = ({
39524
39622
  ]
39525
39623
  }
39526
39624
  ),
39527
- onExplosionView && /* @__PURE__ */ jsx39(
39625
+ onExplosionView && /* @__PURE__ */ jsx40(
39528
39626
  DropdownMenuItem,
39529
39627
  {
39530
39628
  disabled: !explosionAvailable,
@@ -39540,7 +39638,7 @@ var ContextMenu = ({
39540
39638
  children: "Exploded view\u2026"
39541
39639
  }
39542
39640
  ),
39543
- onSectionView && /* @__PURE__ */ jsx39(
39641
+ onSectionView && /* @__PURE__ */ jsx40(
39544
39642
  DropdownMenuItem,
39545
39643
  {
39546
39644
  style: {
@@ -39558,7 +39656,7 @@ var ContextMenu = ({
39558
39656
  }
39559
39657
  ) })
39560
39658
  ] }),
39561
- /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles2 })
39659
+ /* @__PURE__ */ jsx40(DropdownMenuSeparator, { style: separatorStyles2 })
39562
39660
  ] }),
39563
39661
  /* @__PURE__ */ jsxs10(
39564
39662
  DropdownMenuItem,
@@ -39573,8 +39671,8 @@ var ContextMenu = ({
39573
39671
  onMouseLeave: () => setHoveredItem(null),
39574
39672
  onTouchStart: () => setHoveredItem("shortcuts"),
39575
39673
  children: [
39576
- /* @__PURE__ */ jsx39("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Keyboard Shortcuts" }),
39577
- /* @__PURE__ */ jsx39(
39674
+ /* @__PURE__ */ jsx40("span", { style: { flex: 1, display: "flex", alignItems: "center" }, children: "Keyboard Shortcuts" }),
39675
+ /* @__PURE__ */ jsx40(
39578
39676
  "div",
39579
39677
  {
39580
39678
  style: {
@@ -39588,8 +39686,8 @@ var ContextMenu = ({
39588
39686
  ]
39589
39687
  }
39590
39688
  ),
39591
- /* @__PURE__ */ jsx39(DropdownMenuSeparator, { style: separatorStyles2 }),
39592
- /* @__PURE__ */ jsx39(
39689
+ /* @__PURE__ */ jsx40(DropdownMenuSeparator, { style: separatorStyles2 }),
39690
+ /* @__PURE__ */ jsx40(
39593
39691
  "div",
39594
39692
  {
39595
39693
  style: {
@@ -39627,10 +39725,10 @@ var ContextMenu = ({
39627
39725
  };
39628
39726
 
39629
39727
  // src/components/KeyboardShortcutsDialog.tsx
39630
- import { useEffect as useEffect54, useMemo as useMemo40, useRef as useRef28, useState as useState44 } from "react";
39728
+ import { useEffect as useEffect55, useMemo as useMemo41, useRef as useRef28, useState as useState44 } from "react";
39631
39729
 
39632
39730
  // src/hooks/useRegisteredHotkey.ts
39633
- import { useEffect as useEffect53, useMemo as useMemo39, useRef as useRef27, useState as useState43 } from "react";
39731
+ import { useEffect as useEffect54, useMemo as useMemo40, useRef as useRef27, useState as useState43 } from "react";
39634
39732
  var hotkeyRegistry = /* @__PURE__ */ new Map();
39635
39733
  var subscribers = /* @__PURE__ */ new Set();
39636
39734
  var isListenerAttached = false;
@@ -39754,14 +39852,14 @@ var subscribeToRegistry = (subscriber) => {
39754
39852
  var useRegisteredHotkey = (id, handler, metadata) => {
39755
39853
  const handlerRef = useRef27(handler);
39756
39854
  handlerRef.current = handler;
39757
- const normalizedMetadata = useMemo39(
39855
+ const normalizedMetadata = useMemo40(
39758
39856
  () => ({
39759
39857
  shortcut: metadata.shortcut,
39760
39858
  description: metadata.description
39761
39859
  }),
39762
39860
  [metadata.shortcut, metadata.description]
39763
39861
  );
39764
- useEffect53(() => {
39862
+ useEffect54(() => {
39765
39863
  const registration = {
39766
39864
  id,
39767
39865
  ...normalizedMetadata,
@@ -39777,7 +39875,7 @@ var useHotkeyRegistry = () => {
39777
39875
  const [entries, setEntries] = useState43(
39778
39876
  () => Array.from(hotkeyRegistry.values())
39779
39877
  );
39780
- useEffect53(() => subscribeToRegistry(setEntries), []);
39878
+ useEffect54(() => subscribeToRegistry(setEntries), []);
39781
39879
  return entries;
39782
39880
  };
39783
39881
  var registerHotkeyViewer = (element) => {
@@ -39786,7 +39884,7 @@ var registerHotkeyViewer = (element) => {
39786
39884
  };
39787
39885
 
39788
39886
  // src/components/KeyboardShortcutsDialog.tsx
39789
- import { jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
39887
+ import { jsx as jsx41, jsxs as jsxs11 } from "react/jsx-runtime";
39790
39888
  var KeyboardShortcutsDialog = ({
39791
39889
  open,
39792
39890
  onClose
@@ -39794,7 +39892,7 @@ var KeyboardShortcutsDialog = ({
39794
39892
  const [query, setQuery] = useState44("");
39795
39893
  const inputRef = useRef28(null);
39796
39894
  const hotkeys = useHotkeyRegistry();
39797
- useEffect54(() => {
39895
+ useEffect55(() => {
39798
39896
  if (!open) return void 0;
39799
39897
  const handleKeyDown = (event) => {
39800
39898
  if (event.key === "Escape") {
@@ -39805,14 +39903,14 @@ var KeyboardShortcutsDialog = ({
39805
39903
  window.addEventListener("keydown", handleKeyDown);
39806
39904
  return () => window.removeEventListener("keydown", handleKeyDown);
39807
39905
  }, [open, onClose]);
39808
- useEffect54(() => {
39906
+ useEffect55(() => {
39809
39907
  if (open) {
39810
39908
  setTimeout(() => {
39811
39909
  inputRef.current?.focus();
39812
39910
  }, 0);
39813
39911
  }
39814
39912
  }, [open]);
39815
- const filteredHotkeys = useMemo40(() => {
39913
+ const filteredHotkeys = useMemo41(() => {
39816
39914
  const normalizedQuery = query.trim().toLowerCase();
39817
39915
  if (!normalizedQuery) {
39818
39916
  return hotkeys;
@@ -39825,7 +39923,7 @@ var KeyboardShortcutsDialog = ({
39825
39923
  if (!open) {
39826
39924
  return null;
39827
39925
  }
39828
- return /* @__PURE__ */ jsx40(
39926
+ return /* @__PURE__ */ jsx41(
39829
39927
  "div",
39830
39928
  {
39831
39929
  role: "dialog",
@@ -39865,7 +39963,7 @@ var KeyboardShortcutsDialog = ({
39865
39963
  },
39866
39964
  children: [
39867
39965
  /* @__PURE__ */ jsxs11("div", { style: { display: "flex", justifyContent: "space-between" }, children: [
39868
- /* @__PURE__ */ jsx40(
39966
+ /* @__PURE__ */ jsx41(
39869
39967
  "h2",
39870
39968
  {
39871
39969
  style: {
@@ -39877,7 +39975,7 @@ var KeyboardShortcutsDialog = ({
39877
39975
  children: "Keyboard Shortcuts"
39878
39976
  }
39879
39977
  ),
39880
- /* @__PURE__ */ jsx40(
39978
+ /* @__PURE__ */ jsx41(
39881
39979
  "button",
39882
39980
  {
39883
39981
  type: "button",
@@ -39893,7 +39991,7 @@ var KeyboardShortcutsDialog = ({
39893
39991
  }
39894
39992
  )
39895
39993
  ] }),
39896
- /* @__PURE__ */ jsx40(
39994
+ /* @__PURE__ */ jsx41(
39897
39995
  "input",
39898
39996
  {
39899
39997
  ref: inputRef,
@@ -39916,7 +40014,7 @@ var KeyboardShortcutsDialog = ({
39916
40014
  ]
39917
40015
  }
39918
40016
  ),
39919
- /* @__PURE__ */ jsx40("div", { style: { overflowY: "auto" }, children: /* @__PURE__ */ jsxs11(
40017
+ /* @__PURE__ */ jsx41("div", { style: { overflowY: "auto" }, children: /* @__PURE__ */ jsxs11(
39920
40018
  "table",
39921
40019
  {
39922
40020
  style: {
@@ -39925,11 +40023,11 @@ var KeyboardShortcutsDialog = ({
39925
40023
  fontSize: "0.95rem"
39926
40024
  },
39927
40025
  children: [
39928
- /* @__PURE__ */ jsx40("thead", { children: /* @__PURE__ */ jsxs11("tr", { style: { textAlign: "left", color: "#a1a1b5" }, children: [
39929
- /* @__PURE__ */ jsx40("th", { style: { padding: "12px 24px", width: "25%" }, children: "Key" }),
39930
- /* @__PURE__ */ jsx40("th", { style: { padding: "12px 24px" }, children: "Description" })
40026
+ /* @__PURE__ */ jsx41("thead", { children: /* @__PURE__ */ jsxs11("tr", { style: { textAlign: "left", color: "#a1a1b5" }, children: [
40027
+ /* @__PURE__ */ jsx41("th", { style: { padding: "12px 24px", width: "25%" }, children: "Key" }),
40028
+ /* @__PURE__ */ jsx41("th", { style: { padding: "12px 24px" }, children: "Description" })
39931
40029
  ] }) }),
39932
- /* @__PURE__ */ jsx40("tbody", { children: filteredHotkeys.length === 0 ? /* @__PURE__ */ jsx40("tr", { children: /* @__PURE__ */ jsx40(
40030
+ /* @__PURE__ */ jsx41("tbody", { children: filteredHotkeys.length === 0 ? /* @__PURE__ */ jsx41("tr", { children: /* @__PURE__ */ jsx41(
39933
40031
  "td",
39934
40032
  {
39935
40033
  colSpan: 2,
@@ -39941,7 +40039,7 @@ var KeyboardShortcutsDialog = ({
39941
40039
  {
39942
40040
  style: { borderTop: "1px solid rgba(255, 255, 255, 0.05)" },
39943
40041
  children: [
39944
- /* @__PURE__ */ jsx40("td", { style: { padding: "12px 24px" }, children: /* @__PURE__ */ jsx40(
40042
+ /* @__PURE__ */ jsx41("td", { style: { padding: "12px 24px" }, children: /* @__PURE__ */ jsx41(
39945
40043
  "span",
39946
40044
  {
39947
40045
  style: {
@@ -39959,7 +40057,7 @@ var KeyboardShortcutsDialog = ({
39959
40057
  children: hotkey.shortcut
39960
40058
  }
39961
40059
  ) }),
39962
- /* @__PURE__ */ jsx40("td", { style: { padding: "12px 24px" }, children: hotkey.description })
40060
+ /* @__PURE__ */ jsx41("td", { style: { padding: "12px 24px" }, children: hotkey.description })
39963
40061
  ]
39964
40062
  },
39965
40063
  hotkey.id
@@ -39976,7 +40074,7 @@ var KeyboardShortcutsDialog = ({
39976
40074
 
39977
40075
  // src/contexts/ToastContext.tsx
39978
40076
  import { Toaster, toast as hotToast } from "react-hot-toast";
39979
- import { Fragment as Fragment12, jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
40077
+ import { Fragment as Fragment12, jsx as jsx42, jsxs as jsxs12 } from "react/jsx-runtime";
39980
40078
  var useToast = () => {
39981
40079
  return {
39982
40080
  showToast: (message, duration = 2e3) => {
@@ -39989,7 +40087,7 @@ var ToastProvider = ({
39989
40087
  }) => {
39990
40088
  return /* @__PURE__ */ jsxs12(Fragment12, { children: [
39991
40089
  children,
39992
- /* @__PURE__ */ jsx41(Toaster, { position: "bottom-right" })
40090
+ /* @__PURE__ */ jsx42(Toaster, { position: "bottom-right" })
39993
40091
  ] });
39994
40092
  };
39995
40093
 
@@ -40034,7 +40132,7 @@ function useCameraPreset({
40034
40132
  }
40035
40133
 
40036
40134
  // src/hooks/useContextMenu.ts
40037
- import { useState as useState45, useCallback as useCallback23, useRef as useRef29, useEffect as useEffect55 } from "react";
40135
+ import { useState as useState45, useCallback as useCallback23, useRef as useRef29, useEffect as useEffect56 } from "react";
40038
40136
  var useContextMenu = ({ containerRef, onOpen }) => {
40039
40137
  const [menuVisible, setMenuVisible] = useState45(false);
40040
40138
  const [menuPos, setMenuPos] = useState45({
@@ -40151,7 +40249,7 @@ var useContextMenu = ({ containerRef, onOpen }) => {
40151
40249
  }
40152
40250
  setMenuVisible(false);
40153
40251
  }, []);
40154
- useEffect55(() => {
40252
+ useEffect56(() => {
40155
40253
  if (menuVisible) {
40156
40254
  document.addEventListener("mousedown", handleClickAway);
40157
40255
  document.addEventListener("touchstart", handleClickAway);
@@ -40185,33 +40283,33 @@ var useContextMenu = ({ containerRef, onOpen }) => {
40185
40283
  };
40186
40284
 
40187
40285
  // src/sections/section-export.ts
40188
- import * as THREE62 from "three";
40286
+ import * as THREE63 from "three";
40189
40287
  function createSectionExport(root, spec) {
40190
40288
  root.updateWorldMatrix(true, true);
40191
40289
  const output = root.clone(true);
40192
40290
  output.updateWorldMatrix(true, true);
40193
40291
  const plane = sectionPlane(spec);
40194
40292
  const hatch = createSectionHatch();
40195
- const capMaterial = new THREE62.MeshBasicMaterial({
40293
+ const capMaterial = new THREE63.MeshBasicMaterial({
40196
40294
  map: hatch,
40197
- side: THREE62.DoubleSide
40295
+ side: THREE63.DoubleSide
40198
40296
  });
40199
40297
  const ownedGeometries = [];
40200
40298
  const ownedMaterials = [capMaterial];
40201
40299
  output.traverse((object) => {
40202
- if (!(object instanceof THREE62.Mesh)) return;
40300
+ if (!(object instanceof THREE63.Mesh)) return;
40203
40301
  const indexed = Boolean(object.geometry.index);
40204
40302
  const source = object.geometry.index ? object.geometry.toNonIndexed() : object.geometry;
40205
40303
  const p = source.getAttribute("position");
40206
40304
  if (!p) return;
40207
40305
  const worldPositions = new Float32Array(p.count * 3);
40208
- const world = new THREE62.Vector3();
40306
+ const world = new THREE63.Vector3();
40209
40307
  for (let i = 0; i < p.count; i++)
40210
40308
  world.fromBufferAttribute(p, i).applyMatrix4(object.matrixWorld).toArray(worldPositions, i * 3);
40211
40309
  const attributes = Object.entries(source.attributes);
40212
40310
  const values = new Map(attributes.map(([name]) => [name, []]));
40213
- const geometry = new THREE62.BufferGeometry();
40214
- const point = (i) => new THREE62.Vector3().fromArray(worldPositions, i * 3);
40311
+ const geometry = new THREE63.BufferGeometry();
40312
+ const point = (i) => new THREE63.Vector3().fromArray(worldPositions, i * 3);
40215
40313
  for (let i = 0; i < p.count; i += 3) {
40216
40314
  let polygon2 = [
40217
40315
  [1, 0, 0],
@@ -40260,7 +40358,7 @@ function createSectionExport(root, spec) {
40260
40358
  for (const [name, attribute] of attributes)
40261
40359
  geometry.setAttribute(
40262
40360
  name,
40263
- new THREE62.Float32BufferAttribute(values.get(name), attribute.itemSize)
40361
+ new THREE63.Float32BufferAttribute(values.get(name), attribute.itemSize)
40264
40362
  );
40265
40363
  if (geometry.getAttribute("normal")) geometry.normalizeNormals();
40266
40364
  ownedGeometries.push(geometry);
@@ -40274,18 +40372,18 @@ function createSectionExport(root, spec) {
40274
40372
  object.material = Array.isArray(object.material) ? object.material.map(cloneMaterial) : cloneMaterial(object.material);
40275
40373
  const { loops } = findSectionLoops({ positions: worldPositions, ...spec });
40276
40374
  const cap = buildSectionCap(loops, spec);
40277
- cap.applyMatrix4(new THREE62.Matrix4().copy(object.matrixWorld).invert());
40375
+ cap.applyMatrix4(new THREE63.Matrix4().copy(object.matrixWorld).invert());
40278
40376
  ownedGeometries.push(cap);
40279
40377
  object.userData.sectionExportCap = cap;
40280
40378
  if (indexed) source.dispose();
40281
40379
  });
40282
40380
  const pending = [];
40283
40381
  output.traverse((object) => {
40284
- if (object instanceof THREE62.Mesh && object.userData.sectionExportCap)
40382
+ if (object instanceof THREE63.Mesh && object.userData.sectionExportCap)
40285
40383
  pending.push(object);
40286
40384
  });
40287
40385
  for (const mesh of pending) {
40288
- mesh.add(new THREE62.Mesh(mesh.userData.sectionExportCap, capMaterial));
40386
+ mesh.add(new THREE63.Mesh(mesh.userData.sectionExportCap, capMaterial));
40289
40387
  delete mesh.userData.sectionExportCap;
40290
40388
  }
40291
40389
  delete output.userData.sectionView;
@@ -40333,8 +40431,8 @@ var useGlobalDownloadGltf = () => {
40333
40431
  };
40334
40432
 
40335
40433
  // src/CadViewer.tsx
40336
- import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
40337
- var DEFAULT_TARGET = new THREE63.Vector3(0, 0, 0);
40434
+ import { jsx as jsx43, jsxs as jsxs13 } from "react/jsx-runtime";
40435
+ var DEFAULT_TARGET = new THREE64.Vector3(0, 0, 0);
40338
40436
  var INITIAL_CAMERA_POSITION = [5, -5, 5];
40339
40437
  var readStoredCameraType = () => {
40340
40438
  if (typeof window === "undefined") return void 0;
@@ -40364,12 +40462,12 @@ var CadViewerInner = (props) => {
40364
40462
  const resolvedFoldPcbs = resolveFoldPcbs(circuitJson, foldPcbs);
40365
40463
  const circuitJsonKey = glbSource === void 0 ? JSON.stringify(circuitJson) : void 0;
40366
40464
  const circuitKey = glbSource ?? circuitJsonKey;
40367
- const { hiddenCadComponentIds, hideComponent, unhideAllComponents } = useHiddenCadComponents(circuitKey);
40465
+ const { objectVisibility, hideObject, isolateObject, unhideAllObjects } = useObjectVisibility(circuitKey);
40368
40466
  const resolvedProps = {
40369
40467
  ...props,
40370
40468
  circuitJson,
40371
40469
  children: void 0,
40372
- hiddenCadComponentIds
40470
+ objectVisibility
40373
40471
  };
40374
40472
  const [engine, setEngine] = useState46(() => {
40375
40473
  const stored = window.localStorage.getItem("cadViewerEngine");
@@ -40394,11 +40492,11 @@ var CadViewerInner = (props) => {
40394
40492
  const externalCameraControllerReady = props.onCameraControllerReady;
40395
40493
  const sceneRef = useContext13(SchematicNavigationContext);
40396
40494
  const [selectedComponent, setSelectedComponent] = useState46();
40397
- const [selectedCadComponent, setSelectedCadComponent] = useState46();
40495
+ const [selectedObject, setSelectedObject] = useState46();
40398
40496
  const handleMenuOpen = useCallback25(
40399
40497
  (position) => {
40400
- setSelectedCadComponent(
40401
- pickCadComponent(sceneRef.current, position, circuitJson)
40498
+ setSelectedObject(
40499
+ pickSceneObject(sceneRef.current, position, circuitJson)
40402
40500
  );
40403
40501
  setSelectedComponent(
40404
40502
  props.onViewSchematicComponent ? pickSchematicComponent(sceneRef.current, position, circuitJson) : void 0
@@ -40511,28 +40609,28 @@ var CadViewerInner = (props) => {
40511
40609
  description: "Toggle translucent components"
40512
40610
  }
40513
40611
  );
40514
- useEffect56(() => {
40612
+ useEffect57(() => {
40515
40613
  if (containerRef.current) {
40516
40614
  registerHotkeyViewer(containerRef.current);
40517
40615
  }
40518
40616
  }, []);
40519
- useEffect56(() => {
40617
+ useEffect57(() => {
40520
40618
  window.localStorage.setItem("cadViewerEngine", engine);
40521
40619
  }, [engine]);
40522
- useEffect56(() => {
40620
+ useEffect57(() => {
40523
40621
  window.localStorage.setItem("cadViewerAutoRotate", String(autoRotate));
40524
40622
  }, [autoRotate]);
40525
- useEffect56(() => {
40623
+ useEffect57(() => {
40526
40624
  window.localStorage.setItem(
40527
40625
  "cadViewerAutoRotateUserToggled",
40528
40626
  String(autoRotateUserToggled)
40529
40627
  );
40530
40628
  }, [autoRotateUserToggled]);
40531
- useEffect56(() => {
40629
+ useEffect57(() => {
40532
40630
  window.localStorage.setItem("cadViewerCameraType", cameraType);
40533
40631
  }, [cameraType]);
40534
40632
  const viewerKey = props.circuitJson ? circuitJsonKey : void 0;
40535
- return /* @__PURE__ */ jsx42(AssemblyExplosionContext.Provider, { value: explosion, children: /* @__PURE__ */ jsxs13(
40633
+ return /* @__PURE__ */ jsx43(AssemblyExplosionContext.Provider, { value: explosion, children: /* @__PURE__ */ jsxs13(
40536
40634
  "div",
40537
40635
  {
40538
40636
  ref: containerRef,
@@ -40548,7 +40646,7 @@ var CadViewerInner = (props) => {
40548
40646
  },
40549
40647
  ...contextMenuEventHandlers,
40550
40648
  children: [
40551
- explosionPanelOpen && /* @__PURE__ */ jsx42(
40649
+ explosionPanelOpen && /* @__PURE__ */ jsx43(
40552
40650
  AssemblyExplosionControl,
40553
40651
  {
40554
40652
  stages: explosion.stages,
@@ -40561,18 +40659,18 @@ var CadViewerInner = (props) => {
40561
40659
  }
40562
40660
  }
40563
40661
  ),
40564
- glbSource !== void 0 ? /* @__PURE__ */ jsx42(
40662
+ glbSource !== void 0 ? /* @__PURE__ */ jsx43(
40565
40663
  CadViewerGlb,
40566
40664
  {
40567
40665
  source: glbSource,
40568
- hiddenCadComponentIds,
40666
+ objectVisibility,
40569
40667
  autoRotateDisabled: props.autoRotateDisabled || !autoRotate,
40570
40668
  clickToInteractEnabled: props.clickToInteractEnabled,
40571
40669
  onUserInteraction: handleUserInteraction,
40572
40670
  onCameraControllerReady: handleCameraControllerReady,
40573
40671
  referenceObject
40574
40672
  }
40575
- ) : hasFlexGeometry ? /* @__PURE__ */ jsx42(
40673
+ ) : hasFlexGeometry ? /* @__PURE__ */ jsx43(
40576
40674
  CadViewerManifold_default,
40577
40675
  {
40578
40676
  ...resolvedProps,
@@ -40582,7 +40680,7 @@ var CadViewerInner = (props) => {
40582
40680
  onCameraControllerReady: handleCameraControllerReady,
40583
40681
  referenceObject
40584
40682
  }
40585
- ) : engine === "jscad" ? /* @__PURE__ */ jsx42(
40683
+ ) : engine === "jscad" ? /* @__PURE__ */ jsx43(
40586
40684
  CadViewerJscad,
40587
40685
  {
40588
40686
  ...resolvedProps,
@@ -40592,7 +40690,7 @@ var CadViewerInner = (props) => {
40592
40690
  onCameraControllerReady: handleCameraControllerReady,
40593
40691
  referenceObject
40594
40692
  }
40595
- ) : /* @__PURE__ */ jsx42(
40693
+ ) : /* @__PURE__ */ jsx43(
40596
40694
  CadViewerManifold_default,
40597
40695
  {
40598
40696
  ...resolvedProps,
@@ -40603,18 +40701,22 @@ var CadViewerInner = (props) => {
40603
40701
  referenceObject
40604
40702
  }
40605
40703
  ),
40606
- /* @__PURE__ */ jsx42(SectionPanel, {}),
40607
- menuVisible && /* @__PURE__ */ jsx42(
40704
+ /* @__PURE__ */ jsx43(SectionPanel, {}),
40705
+ menuVisible && /* @__PURE__ */ jsx43(
40608
40706
  ContextMenu,
40609
40707
  {
40610
40708
  hasAssembly,
40611
- componentName: selectedCadComponent?.componentName,
40612
- onHideComponent: selectedCadComponent ? () => {
40613
- hideComponent(selectedCadComponent.cad_component_id);
40709
+ objectName: selectedObject?.name,
40710
+ onHideObject: selectedObject ? () => {
40711
+ hideObject(selectedObject.objectId);
40614
40712
  closeMenu();
40615
40713
  } : void 0,
40616
- onUnhideAllComponents: hiddenCadComponentIds.size > 0 ? () => {
40617
- unhideAllComponents();
40714
+ onIsolateObject: selectedObject && objectVisibility.isolatedId !== selectedObject.objectId ? () => {
40715
+ isolateObject(selectedObject.objectId);
40716
+ closeMenu();
40717
+ } : void 0,
40718
+ onUnhideAll: hasHiddenObjects(objectVisibility) ? () => {
40719
+ unhideAllObjects();
40618
40720
  closeMenu();
40619
40721
  } : void 0,
40620
40722
  onViewSchematicComponent: selectedComponent && props.onViewSchematicComponent ? () => {
@@ -40683,7 +40785,7 @@ var CadViewerInner = (props) => {
40683
40785
  }
40684
40786
  }
40685
40787
  ),
40686
- /* @__PURE__ */ jsx42(
40788
+ /* @__PURE__ */ jsx43(
40687
40789
  KeyboardShortcutsDialog,
40688
40790
  {
40689
40791
  open: isKeyboardShortcutsDialogOpen,
@@ -40698,13 +40800,13 @@ var CadViewerInner = (props) => {
40698
40800
  var CadViewer = (props) => {
40699
40801
  configureRuntimeFont();
40700
40802
  const sceneRef = useRef30(null);
40701
- return /* @__PURE__ */ jsx42(SchematicNavigationContext.Provider, { value: sceneRef, children: /* @__PURE__ */ jsx42(
40803
+ return /* @__PURE__ */ jsx43(SchematicNavigationContext.Provider, { value: sceneRef, children: /* @__PURE__ */ jsx43(
40702
40804
  CameraControllerProvider,
40703
40805
  {
40704
40806
  defaultTarget: DEFAULT_TARGET,
40705
40807
  initialCameraPosition: INITIAL_CAMERA_POSITION,
40706
40808
  initialCameraType: readStoredCameraType(),
40707
- children: /* @__PURE__ */ jsx42(LayerVisibilityProvider, { children: /* @__PURE__ */ jsx42(AppearanceProvider, { children: /* @__PURE__ */ jsx42(ToastProvider, { children: /* @__PURE__ */ jsx42(SectionProvider, { children: /* @__PURE__ */ jsx42(CadViewerInner, { ...props }) }) }) }) })
40809
+ children: /* @__PURE__ */ jsx43(LayerVisibilityProvider, { children: /* @__PURE__ */ jsx43(AppearanceProvider, { children: /* @__PURE__ */ jsx43(ToastProvider, { children: /* @__PURE__ */ jsx43(SectionProvider, { children: /* @__PURE__ */ jsx43(CadViewerInner, { ...props }) }) }) }) })
40708
40810
  }
40709
40811
  ) });
40710
40812
  };
@@ -40712,11 +40814,11 @@ var CadViewer = (props) => {
40712
40814
  // src/convert-circuit-json-to-3d-svg.ts
40713
40815
  var import_debug = __toESM(require_browser(), 1);
40714
40816
  import { su as su18 } from "@tscircuit/circuit-json-util";
40715
- import * as THREE67 from "three";
40817
+ import * as THREE68 from "three";
40716
40818
  import { SVGRenderer } from "three/examples/jsm/renderers/SVGRenderer.js";
40717
40819
 
40718
40820
  // src/utils/create-geometry-from-polygons.ts
40719
- import * as THREE64 from "three";
40821
+ import * as THREE65 from "three";
40720
40822
  import { BufferGeometry as BufferGeometry9, Float32BufferAttribute as Float32BufferAttribute8 } from "three";
40721
40823
  function createGeometryFromPolygons(polygons) {
40722
40824
  const geometry = new BufferGeometry9();
@@ -40730,12 +40832,12 @@ function createGeometryFromPolygons(polygons) {
40730
40832
  ...polygon2.vertices[i + 1]
40731
40833
  // Third vertex
40732
40834
  );
40733
- const v1 = new THREE64.Vector3(...polygon2.vertices[0]);
40734
- const v2 = new THREE64.Vector3(...polygon2.vertices[i]);
40735
- const v3 = new THREE64.Vector3(...polygon2.vertices[i + 1]);
40736
- const normal = new THREE64.Vector3().crossVectors(
40737
- new THREE64.Vector3().subVectors(v2, v1),
40738
- new THREE64.Vector3().subVectors(v3, v1)
40835
+ const v1 = new THREE65.Vector3(...polygon2.vertices[0]);
40836
+ const v2 = new THREE65.Vector3(...polygon2.vertices[i]);
40837
+ const v3 = new THREE65.Vector3(...polygon2.vertices[i + 1]);
40838
+ const normal = new THREE65.Vector3().crossVectors(
40839
+ new THREE65.Vector3().subVectors(v2, v1),
40840
+ new THREE65.Vector3().subVectors(v3, v1)
40739
40841
  ).normalize();
40740
40842
  normals.push(
40741
40843
  normal.x,
@@ -40763,10 +40865,10 @@ import {
40763
40865
  convertCSGToThreeGeom as convertCSGToThreeGeom3,
40764
40866
  getJscadModelForFootprint as getJscadModelForFootprint2
40765
40867
  } from "jscad-electronics/vanilla";
40766
- import * as THREE66 from "three";
40868
+ import * as THREE67 from "three";
40767
40869
 
40768
40870
  // src/utils/load-model.ts
40769
- import * as THREE65 from "three";
40871
+ import * as THREE66 from "three";
40770
40872
  import { GLTFLoader as GLTFLoader3 } from "three/examples/jsm/loaders/GLTFLoader.js";
40771
40873
  import { OBJLoader as OBJLoader2 } from "three/examples/jsm/loaders/OBJLoader.js";
40772
40874
  import { STLLoader as STLLoader3 } from "three/examples/jsm/loaders/STLLoader.js";
@@ -40774,12 +40876,12 @@ async function load3DModel(url) {
40774
40876
  if (url.endsWith(".stl")) {
40775
40877
  const loader = new STLLoader3();
40776
40878
  const geometry = await loader.loadAsync(url);
40777
- const material = new THREE65.MeshStandardMaterial({
40879
+ const material = new THREE66.MeshStandardMaterial({
40778
40880
  color: 8947848,
40779
40881
  metalness: 0.5,
40780
40882
  roughness: 0.5
40781
40883
  });
40782
- return new THREE65.Mesh(geometry, material);
40884
+ return new THREE66.Mesh(geometry, material);
40783
40885
  }
40784
40886
  if (url.endsWith(".obj")) {
40785
40887
  const loader = new OBJLoader2();
@@ -40812,9 +40914,9 @@ async function renderComponent(component, scene) {
40812
40914
  }
40813
40915
  if (component.rotation) {
40814
40916
  model.rotation.set(
40815
- THREE66.MathUtils.degToRad(component.rotation.x ?? 0),
40816
- THREE66.MathUtils.degToRad(component.rotation.y ?? 0),
40817
- THREE66.MathUtils.degToRad(component.rotation.z ?? 0)
40917
+ THREE67.MathUtils.degToRad(component.rotation.x ?? 0),
40918
+ THREE67.MathUtils.degToRad(component.rotation.y ?? 0),
40919
+ THREE67.MathUtils.degToRad(component.rotation.z ?? 0)
40818
40920
  );
40819
40921
  }
40820
40922
  scene.add(model);
@@ -40828,13 +40930,13 @@ async function renderComponent(component, scene) {
40828
40930
  );
40829
40931
  if (jscadObject && (jscadObject.polygons || jscadObject.sides)) {
40830
40932
  const threeGeom = convertCSGToThreeGeom3(jscadObject);
40831
- const material2 = new THREE66.MeshStandardMaterial({
40933
+ const material2 = new THREE67.MeshStandardMaterial({
40832
40934
  color: 8947848,
40833
40935
  metalness: 0.5,
40834
40936
  roughness: 0.5,
40835
- side: THREE66.DoubleSide
40937
+ side: THREE67.DoubleSide
40836
40938
  });
40837
- const mesh2 = new THREE66.Mesh(threeGeom, material2);
40939
+ const mesh2 = new THREE67.Mesh(threeGeom, material2);
40838
40940
  if (component.position) {
40839
40941
  mesh2.position.set(
40840
40942
  component.position.x ?? 0,
@@ -40844,9 +40946,9 @@ async function renderComponent(component, scene) {
40844
40946
  }
40845
40947
  if (component.rotation) {
40846
40948
  mesh2.rotation.set(
40847
- THREE66.MathUtils.degToRad(component.rotation.x ?? 0),
40848
- THREE66.MathUtils.degToRad(component.rotation.y ?? 0),
40849
- THREE66.MathUtils.degToRad(component.rotation.z ?? 0)
40949
+ THREE67.MathUtils.degToRad(component.rotation.x ?? 0),
40950
+ THREE67.MathUtils.degToRad(component.rotation.y ?? 0),
40951
+ THREE67.MathUtils.degToRad(component.rotation.z ?? 0)
40850
40952
  );
40851
40953
  }
40852
40954
  scene.add(mesh2);
@@ -40863,17 +40965,17 @@ async function renderComponent(component, scene) {
40863
40965
  if (!geom || !geom.polygons && !geom.sides) {
40864
40966
  continue;
40865
40967
  }
40866
- const color = new THREE66.Color(geomInfo.color);
40968
+ const color = new THREE67.Color(geomInfo.color);
40867
40969
  color.convertLinearToSRGB();
40868
40970
  const geomWithColor = { ...geom, color: [color.r, color.g, color.b] };
40869
40971
  const threeGeom = convertCSGToThreeGeom3(geomWithColor);
40870
- const material2 = new THREE66.MeshStandardMaterial({
40972
+ const material2 = new THREE67.MeshStandardMaterial({
40871
40973
  vertexColors: true,
40872
40974
  metalness: 0.2,
40873
40975
  roughness: 0.8,
40874
- side: THREE66.DoubleSide
40976
+ side: THREE67.DoubleSide
40875
40977
  });
40876
- const mesh2 = new THREE66.Mesh(threeGeom, material2);
40978
+ const mesh2 = new THREE67.Mesh(threeGeom, material2);
40877
40979
  if (component.position) {
40878
40980
  mesh2.position.set(
40879
40981
  component.position.x ?? 0,
@@ -40883,22 +40985,22 @@ async function renderComponent(component, scene) {
40883
40985
  }
40884
40986
  if (component.rotation) {
40885
40987
  mesh2.rotation.set(
40886
- THREE66.MathUtils.degToRad(component.rotation.x ?? 0),
40887
- THREE66.MathUtils.degToRad(component.rotation.y ?? 0),
40888
- THREE66.MathUtils.degToRad(component.rotation.z ?? 0)
40988
+ THREE67.MathUtils.degToRad(component.rotation.x ?? 0),
40989
+ THREE67.MathUtils.degToRad(component.rotation.y ?? 0),
40990
+ THREE67.MathUtils.degToRad(component.rotation.z ?? 0)
40889
40991
  );
40890
40992
  }
40891
40993
  scene.add(mesh2);
40892
40994
  }
40893
40995
  return;
40894
40996
  }
40895
- const geometry = new THREE66.BoxGeometry(0.5, 0.5, 0.5);
40896
- const material = new THREE66.MeshStandardMaterial({
40997
+ const geometry = new THREE67.BoxGeometry(0.5, 0.5, 0.5);
40998
+ const material = new THREE67.MeshStandardMaterial({
40897
40999
  color: 16711680,
40898
41000
  transparent: true,
40899
41001
  opacity: 0.25
40900
41002
  });
40901
- const mesh = new THREE66.Mesh(geometry, material);
41003
+ const mesh = new THREE67.Mesh(geometry, material);
40902
41004
  if (component.position) {
40903
41005
  mesh.position.set(
40904
41006
  component.position.x ?? 0,
@@ -40919,11 +41021,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
40919
41021
  padding = 20,
40920
41022
  zoom = 1.5
40921
41023
  } = options;
40922
- const scene = new THREE67.Scene();
41024
+ const scene = new THREE68.Scene();
40923
41025
  const renderer = new SVGRenderer();
40924
41026
  renderer.setSize(width, height);
40925
- renderer.setClearColor(new THREE67.Color(backgroundColor), 1);
40926
- const camera = new THREE67.OrthographicCamera();
41027
+ renderer.setClearColor(new THREE68.Color(backgroundColor), 1);
41028
+ const camera = new THREE68.OrthographicCamera();
40927
41029
  const aspect = width / height;
40928
41030
  const frustumSize = 100;
40929
41031
  const halfFrustumSize = frustumSize / 2 / zoom;
@@ -40937,11 +41039,11 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
40937
41039
  camera.position.set(position.x, position.y, position.z);
40938
41040
  camera.up.set(0, 1, 0);
40939
41041
  const lookAt2 = options.camera?.lookAt ?? { x: 0, y: 0, z: 0 };
40940
- camera.lookAt(new THREE67.Vector3(lookAt2.x, lookAt2.y, lookAt2.z));
41042
+ camera.lookAt(new THREE68.Vector3(lookAt2.x, lookAt2.y, lookAt2.z));
40941
41043
  camera.updateProjectionMatrix();
40942
- const ambientLight = new THREE67.AmbientLight(16777215, Math.PI / 2);
41044
+ const ambientLight = new THREE68.AmbientLight(16777215, Math.PI / 2);
40943
41045
  scene.add(ambientLight);
40944
- const pointLight = new THREE67.PointLight(16777215, Math.PI / 4);
41046
+ const pointLight = new THREE68.PointLight(16777215, Math.PI / 4);
40945
41047
  pointLight.position.set(-10, -10, 10);
40946
41048
  scene.add(pointLight);
40947
41049
  const components = su18(circuitJson).cad_component.list();
@@ -40973,28 +41075,28 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
40973
41075
  const material = createBoardMaterial({
40974
41076
  material: boardData?.material,
40975
41077
  color: edgeColor,
40976
- side: THREE67.DoubleSide
41078
+ side: THREE68.DoubleSide
40977
41079
  });
40978
- const mesh = new THREE67.Mesh(geometry, material);
41080
+ const mesh = new THREE68.Mesh(geometry, material);
40979
41081
  scene.add(mesh);
40980
41082
  }
40981
41083
  }
40982
- const gridColor = new THREE67.Color(8947848);
40983
- const gridHelper = new THREE67.GridHelper(100, 100, gridColor, gridColor);
41084
+ const gridColor = new THREE68.Color(8947848);
41085
+ const gridHelper = new THREE68.GridHelper(100, 100, gridColor, gridColor);
40984
41086
  gridHelper.rotation.x = Math.PI / 2;
40985
41087
  const materials2 = Array.isArray(gridHelper.material) ? gridHelper.material : [gridHelper.material];
40986
41088
  for (const mat of materials2) {
40987
41089
  mat.transparent = true;
40988
41090
  mat.opacity = 0.3;
40989
- if (mat instanceof THREE67.LineBasicMaterial) {
41091
+ if (mat instanceof THREE68.LineBasicMaterial) {
40990
41092
  mat.color = gridColor;
40991
41093
  mat.vertexColors = false;
40992
41094
  }
40993
41095
  }
40994
41096
  scene.add(gridHelper);
40995
- const box = new THREE67.Box3().setFromObject(scene);
40996
- const center = box.getCenter(new THREE67.Vector3());
40997
- const size4 = box.getSize(new THREE67.Vector3());
41097
+ const box = new THREE68.Box3().setFromObject(scene);
41098
+ const center = box.getCenter(new THREE68.Vector3());
41099
+ const size4 = box.getSize(new THREE68.Vector3());
40998
41100
  scene.position.sub(center);
40999
41101
  const maxDim = Math.max(size4.x, size4.y, size4.z);
41000
41102
  if (maxDim > 0) {
@@ -41014,10 +41116,10 @@ async function convertCircuitJsonTo3dSvg(circuitJson, options = {}) {
41014
41116
  import {
41015
41117
  GLTFExporter as GLTFExporter3
41016
41118
  } from "three/examples/jsm/exporters/GLTFExporter.js";
41017
- import { useEffect as useEffect57, useState as useState47, useMemo as useMemo41, useCallback as useCallback26 } from "react";
41119
+ import { useEffect as useEffect58, useState as useState47, useMemo as useMemo42, useCallback as useCallback26 } from "react";
41018
41120
  function useSaveGltfAs(options = {}) {
41019
41121
  const parse2 = useParser(options);
41020
- const link = useMemo41(() => document.createElement("a"), []);
41122
+ const link = useMemo42(() => document.createElement("a"), []);
41021
41123
  const saveAs = async (filename) => {
41022
41124
  const name = filename ?? options.filename ?? "";
41023
41125
  if (options.binary == null) options.binary = name.endsWith(".glb");
@@ -41027,7 +41129,7 @@ function useSaveGltfAs(options = {}) {
41027
41129
  link.dispatchEvent(new MouseEvent("click"));
41028
41130
  URL.revokeObjectURL(url);
41029
41131
  };
41030
- useEffect57(
41132
+ useEffect58(
41031
41133
  () => () => {
41032
41134
  link.remove();
41033
41135
  instance = null;
@@ -41048,11 +41150,11 @@ function useExportGltfUrl(options = {}) {
41048
41150
  (instance) => parse2(instance).then(setUrl).catch(setError),
41049
41151
  []
41050
41152
  );
41051
- useEffect57(() => () => URL.revokeObjectURL(url), [url]);
41153
+ useEffect58(() => () => URL.revokeObjectURL(url), [url]);
41052
41154
  return [ref, url, error];
41053
41155
  }
41054
41156
  function useParser(options = {}) {
41055
- const exporter = useMemo41(() => new GLTFExporter3(), []);
41157
+ const exporter = useMemo42(() => new GLTFExporter3(), []);
41056
41158
  return (instance) => {
41057
41159
  const { promise, resolve, reject } = Promise.withResolvers();
41058
41160
  exporter.parse(