@tscircuit/pcb-viewer 1.11.386 → 1.11.388

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
@@ -5112,10 +5112,10 @@ var require_src = __commonJS({
5112
5112
  var js_beautify = require_javascript();
5113
5113
  var css_beautify = require_css();
5114
5114
  var html_beautify = require_html();
5115
- function style_html(html_source, options, js, css4) {
5115
+ function style_html(html_source, options, js, css3) {
5116
5116
  js = js || js_beautify;
5117
- css4 = css4 || css_beautify;
5118
- return html_beautify(html_source, options, js, css4);
5117
+ css3 = css3 || css_beautify;
5118
+ return html_beautify(html_source, options, js, css3);
5119
5119
  }
5120
5120
  style_html.defaultOptions = html_beautify.defaultOptions;
5121
5121
  module.exports.js = js_beautify;
@@ -6667,9 +6667,7 @@ var createStore = (initialState = {}, disablePcbGroups = false) => createZustand
6667
6667
  pcb_viewer_id: `pcb_viewer_${Math.random().toString().slice(2, 10)}`,
6668
6668
  in_edit_mode: false,
6669
6669
  in_move_footprint_mode: false,
6670
- in_draw_trace_mode: false,
6671
6670
  is_moving_component: false,
6672
- is_drawing_trace: false,
6673
6671
  is_mouse_over_container: false,
6674
6672
  is_showing_multiple_traces_length: false,
6675
6673
  is_showing_rats_nest: false,
@@ -6715,13 +6713,10 @@ var createStore = (initialState = {}, disablePcbGroups = false) => createZustand
6715
6713
  setEditMode: (mode) => set({
6716
6714
  in_edit_mode: mode !== "off",
6717
6715
  in_move_footprint_mode: mode === "move_footprint",
6718
- in_draw_trace_mode: mode === "draw_trace",
6719
- is_moving_component: false,
6720
- is_drawing_trace: false
6716
+ is_moving_component: false
6721
6717
  }),
6722
6718
  setIsShowingRatsNest: (is_showing) => set({ is_showing_rats_nest: is_showing }),
6723
6719
  setIsMovingComponent: (is_moving) => set({ is_moving_component: is_moving }),
6724
- setIsDrawingTrace: (is_drawing) => set({ is_drawing_trace: is_drawing }),
6725
6720
  setIsMouseOverContainer: (is_focused) => set({ is_mouse_over_container: is_focused }),
6726
6721
  setIsShowingMultipleTracesLength: (is_showing) => set({ is_showing_multiple_traces_length: is_showing }),
6727
6722
  setIsShowingAutorouting: (is_showing) => set({ is_showing_autorouting: is_showing }),
@@ -6802,19 +6797,6 @@ import {
6802
6797
  } from "react-toastify";
6803
6798
  import { injectStyle } from "react-toastify/dist/inject-style";
6804
6799
  import { jsx as jsx2 } from "react/jsx-runtime";
6805
- var useToast = () => {
6806
- const pcb_viewer_id = useGlobalStore((s) => s.pcb_viewer_id);
6807
- const toast = (message, opts) => ogToast(message, {
6808
- containerId: pcb_viewer_id,
6809
- ...opts
6810
- });
6811
- toast.error = (message, opts) => ogToast.error(message, {
6812
- containerId: pcb_viewer_id,
6813
- ...opts
6814
- });
6815
- toast.promise = ogToast.promise;
6816
- return toast;
6817
- };
6818
6800
  var ToastContainer = () => {
6819
6801
  useEffect(() => {
6820
6802
  injectStyle();
@@ -6824,7 +6806,7 @@ var ToastContainer = () => {
6824
6806
  };
6825
6807
 
6826
6808
  // src/PCBViewer.tsx
6827
- import { useCallback as useCallback12, useEffect as useEffect20, useMemo as useMemo9, useRef as useRef16, useState as useState13 } from "react";
6809
+ import { useCallback as useCallback12, useEffect as useEffect18, useMemo as useMemo9, useRef as useRef15, useState as useState12 } from "react";
6828
6810
 
6829
6811
  // node_modules/react-use/esm/useMountedState.js
6830
6812
  import { useCallback as useCallback2, useEffect as useEffect2, useRef } from "react";
@@ -8621,7 +8603,7 @@ var animateTransform = ({
8621
8603
  };
8622
8604
 
8623
8605
  // src/components/CanvasElementsRenderer.tsx
8624
- import { useCallback as useCallback11, useEffect as useEffect19, useMemo as useMemo8, useRef as useRef15, useState as useState12 } from "react";
8606
+ import { useCallback as useCallback11, useEffect as useEffect17, useMemo as useMemo8, useRef as useRef14, useState as useState11 } from "react";
8625
8607
 
8626
8608
  // src/lib/Drawer.ts
8627
8609
  import colorParser from "color";
@@ -8884,7 +8866,6 @@ var scaleOnly = (mat, value = 1) => {
8884
8866
  var zIndexMap = {
8885
8867
  elementOverlay: 40,
8886
8868
  dimensionOverlay: 40,
8887
- editTraceHintOverlay: 40,
8888
8869
  errorOverlay: 40,
8889
8870
  pcbGroupOverlay: 35,
8890
8871
  ratsNestOverlay: 30,
@@ -12386,419 +12367,10 @@ var EditPlacementOverlay = ({
12386
12367
  );
12387
12368
  };
12388
12369
 
12389
- // src/components/EditTraceHintOverlay.tsx
12390
- import { Fragment as Fragment2, useEffect as useEffect10, useRef as useRef7, useState as useState6 } from "react";
12391
- import {
12392
- applyToPoint as applyToPoint9,
12393
- identity as identity5,
12394
- inverse as inverse4
12395
- } from "transformation-matrix";
12396
-
12397
- // src/components/HotkeyActionMenu.tsx
12398
- import { css } from "@emotion/css";
12399
- import { useEffect as useEffect9 } from "react";
12400
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
12401
- var HotkeyActionMenu = ({
12402
- hotkeys
12403
- }) => {
12404
- useEffect9(() => {
12405
- const handleKeyDown = (event) => {
12406
- hotkeys.forEach((hotkey) => {
12407
- if (event.key === hotkey.key) {
12408
- hotkey.onUse();
12409
- }
12410
- });
12411
- };
12412
- window.addEventListener("keydown", handleKeyDown);
12413
- return () => {
12414
- window.removeEventListener("keydown", handleKeyDown);
12415
- };
12416
- }, [hotkeys]);
12417
- return /* @__PURE__ */ jsx7(
12418
- "div",
12419
- {
12420
- className: css`
12421
- display: flex;
12422
- flex-direction: column;
12423
- font-family: sans-serif;
12424
- font-size: 12px;
12425
- margin: 8px;
12426
- `,
12427
- children: hotkeys.map((hotkey) => {
12428
- return /* @__PURE__ */ jsxs5(
12429
- "div",
12430
- {
12431
- className: css`
12432
- display: flex;
12433
- align-items: center;
12434
- margin: 2px;
12435
-
12436
- & .key {
12437
- padding: 1px;
12438
- margin: 2px;
12439
- color: rgba(255, 255, 255, 0.8);
12440
- font-size: 9px;
12441
- border-radius: 3px;
12442
- text-align: center;
12443
- width: 20px;
12444
- background-color: #444;
12445
- }
12446
-
12447
- & .name {
12448
- margin-left: 4px;
12449
- color: rgba(255, 255, 255, 0.8);
12450
- }
12451
- `,
12452
- children: [
12453
- /* @__PURE__ */ jsx7("div", { className: "key", children: hotkey.key }),
12454
- " ",
12455
- /* @__PURE__ */ jsx7("div", { className: "name", children: hotkey.name })
12456
- ]
12457
- },
12458
- hotkey.name
12459
- );
12460
- })
12461
- }
12462
- );
12463
- };
12464
-
12465
- // src/components/EditTraceHintOverlay.tsx
12466
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
12467
- var isInsideOfSmtpad = (elm, point, padding = 0) => {
12468
- if (elm.shape === "circle" || elm.shape === "polygon") {
12469
- return false;
12470
- }
12471
- const halfWidth = elm.width / 2;
12472
- const halfHeight = elm.height / 2;
12473
- const left = elm.x - halfWidth - padding;
12474
- const right = elm.x + halfWidth + padding;
12475
- const top = elm.y - halfHeight - padding;
12476
- const bottom = elm.y + halfHeight + padding;
12477
- return point.x > left && point.x < right && point.y > top && point.y < bottom;
12478
- };
12479
- var isInsideOfPlatedHole = (hole, point, padding = 0) => {
12480
- if (hole.shape === "circle") {
12481
- const distance3 = Math.sqrt(
12482
- (point.x - hole.x) ** 2 + (point.y - hole.y) ** 2
12483
- );
12484
- return distance3 <= hole.outer_diameter / 2 + padding;
12485
- } else if (hole.shape === "circular_hole_with_rect_pad") {
12486
- const dx = Math.abs(point.x - hole.x);
12487
- const dy = Math.abs(point.y - hole.y);
12488
- if (dx < hole.rect_pad_width / 2 + padding && dy < hole.rect_pad_height / 2 + padding) {
12489
- return true;
12490
- }
12491
- return false;
12492
- } else if (hole.shape === "oval" || hole.shape === "pill") {
12493
- const halfWidth = hole.hole_width / 2;
12494
- const halfHeight = hole.hole_height / 2;
12495
- const left = hole.x - halfWidth - padding;
12496
- const right = hole.x + halfWidth + padding;
12497
- const top = hole.y - halfHeight - padding;
12498
- const bottom = hole.y + halfHeight + padding;
12499
- return point.x > left && point.x < right && point.y > top && point.y < bottom;
12500
- }
12501
- return false;
12502
- };
12503
- var EditTraceHintOverlay = ({
12504
- children,
12505
- disabled: disabledProp,
12506
- transform,
12507
- soup,
12508
- cancelPanDrag,
12509
- onCreateEditEvent,
12510
- onModifyEditEvent
12511
- }) => {
12512
- if (!transform) transform = identity5();
12513
- const containerRef = useRef7(null);
12514
- const containerBounds = containerRef.current?.getBoundingClientRect();
12515
- const [selectedElement, setSelectedElement] = useState6(null);
12516
- const toast = useToast();
12517
- const [dragState, setDragState] = useState6(null);
12518
- const [shouldCreateAsVia, setShouldCreateAsVia] = useState6(false);
12519
- const isElementSelected = selectedElement !== null;
12520
- const in_edit_trace_mode = useGlobalStore((s) => s.in_draw_trace_mode);
12521
- const disabled = disabledProp || !in_edit_trace_mode;
12522
- let ogCenterScreen, dragEndScreen;
12523
- if (dragState?.originalCenter && dragState?.dragEnd) {
12524
- ogCenterScreen = applyToPoint9(transform, dragState?.originalCenter);
12525
- dragEndScreen = applyToPoint9(transform, dragState?.dragEnd);
12526
- }
12527
- useEffect10(() => {
12528
- if (!isElementSelected) return;
12529
- function keyDown(e) {
12530
- if (e.key === "Escape") {
12531
- setSelectedElement(null);
12532
- setDragState(null);
12533
- }
12534
- }
12535
- window.addEventListener("keydown", keyDown);
12536
- return () => window.removeEventListener("keydown", keyDown);
12537
- }, [isElementSelected]);
12538
- return /* @__PURE__ */ jsxs6(
12539
- "div",
12540
- {
12541
- ref: containerRef,
12542
- style: {
12543
- position: "relative",
12544
- overflow: "hidden"
12545
- },
12546
- onMouseDown: (e) => {
12547
- if (disabled) return;
12548
- const rect = e.currentTarget.getBoundingClientRect();
12549
- const x = e.clientX - rect.left;
12550
- const y = e.clientY - rect.top;
12551
- if (isNaN(x) || isNaN(y)) return;
12552
- const rwMousePoint = applyToPoint9(inverse4(transform), { x, y });
12553
- if (!isElementSelected) {
12554
- for (const e2 of soup) {
12555
- if (e2.type === "pcb_smtpad" && isInsideOfSmtpad(e2, rwMousePoint, 10 / transform.a) || e2.type === "pcb_plated_hole" && isInsideOfPlatedHole(e2, rwMousePoint, 10 / transform.a)) {
12556
- if (!e2.pcb_port_id) {
12557
- toast.error(`pcb_port_id is null on the selected "${e2.type}"`);
12558
- return;
12559
- }
12560
- const pcb_port = su(soup).pcb_port.get(e2.pcb_port_id);
12561
- if (!pcb_port) {
12562
- toast.error(
12563
- `Could not find associated pcb_port for "${e2.pcb_port_id}"`
12564
- );
12565
- return;
12566
- }
12567
- setSelectedElement(e2);
12568
- setShouldCreateAsVia(false);
12569
- setDragState({
12570
- dragStart: rwMousePoint,
12571
- originalCenter: { x: pcb_port.x, y: pcb_port.y },
12572
- dragEnd: rwMousePoint,
12573
- editEvent: {
12574
- pcb_edit_event_type: "edit_trace_hint",
12575
- pcb_port_id: e2.pcb_port_id,
12576
- pcb_trace_hint_id: Math.random().toString(),
12577
- route: [],
12578
- created_at: Date.now(),
12579
- edit_event_id: Math.random().toString(),
12580
- in_progress: true
12581
- },
12582
- shouldDrawRouteHint: false
12583
- });
12584
- cancelPanDrag();
12585
- break;
12586
- }
12587
- }
12588
- } else {
12589
- setDragState({
12590
- ...dragState,
12591
- dragStart: rwMousePoint,
12592
- shouldDrawRouteHint: true
12593
- });
12594
- }
12595
- },
12596
- onMouseMove: (e) => {
12597
- if (!isElementSelected || !dragState) return;
12598
- const rect = e.currentTarget.getBoundingClientRect();
12599
- const x = e.clientX - rect.left;
12600
- const y = e.clientY - rect.top;
12601
- if (isNaN(x) || isNaN(y)) return;
12602
- const rwMousePoint = applyToPoint9(inverse4(transform), { x, y });
12603
- setDragState({
12604
- ...dragState,
12605
- dragEnd: rwMousePoint
12606
- });
12607
- },
12608
- onMouseUp: (e) => {
12609
- if (!isElementSelected) return;
12610
- if (!dragState?.shouldDrawRouteHint) return;
12611
- const { dragStart, dragEnd } = dragState;
12612
- const rwDist = Math.sqrt(
12613
- (dragEnd.x - dragStart.x) ** 2 + (dragEnd.y - dragStart.y) ** 2
12614
- );
12615
- const screenDist = rwDist * transform.a;
12616
- if (screenDist > 20) return;
12617
- const rect = e.currentTarget.getBoundingClientRect();
12618
- const x = e.clientX - rect.left;
12619
- const y = e.clientY - rect.top;
12620
- if (isNaN(x) || isNaN(y)) return;
12621
- const rwMousePoint = applyToPoint9(inverse4(transform), { x, y });
12622
- if (dragState) {
12623
- cancelPanDrag();
12624
- const lastPointScreen = applyToPoint9(
12625
- transform,
12626
- dragState.editEvent.route.slice(-1)[0] ?? dragState.originalCenter
12627
- );
12628
- const distanceFromLastPoint = Math.sqrt(
12629
- (x - lastPointScreen.x) ** 2 + (y - lastPointScreen.y) ** 2
12630
- );
12631
- if (distanceFromLastPoint < 20) {
12632
- onCreateEditEvent({
12633
- ...dragState.editEvent,
12634
- in_progress: false
12635
- });
12636
- setDragState(null);
12637
- setSelectedElement(null);
12638
- return;
12639
- }
12640
- setDragState({
12641
- ...dragState,
12642
- editEvent: {
12643
- ...dragState.editEvent,
12644
- route: [
12645
- ...dragState.editEvent.route,
12646
- { ...rwMousePoint, via: shouldCreateAsVia }
12647
- ]
12648
- }
12649
- });
12650
- }
12651
- },
12652
- children: [
12653
- children,
12654
- in_edit_trace_mode && dragState?.editEvent && ogCenterScreen && dragEndScreen && /* @__PURE__ */ jsxs6(
12655
- "svg",
12656
- {
12657
- style: {
12658
- position: "absolute",
12659
- left: 0,
12660
- top: 0,
12661
- pointerEvents: "none",
12662
- mixBlendMode: "difference",
12663
- zIndex: zIndexMap.editTraceHintOverlay
12664
- },
12665
- width: containerBounds?.width,
12666
- height: containerBounds?.height,
12667
- children: [
12668
- /* @__PURE__ */ jsx8(
12669
- "path",
12670
- {
12671
- stroke: "red",
12672
- d: `M ${ogCenterScreen.x} ${ogCenterScreen.y} ${dragState?.editEvent.route.map((p) => applyToPoint9(transform, p)).map((p) => `L ${p.x} ${p.y}`).join(" ")} L ${dragEndScreen.x} ${dragEndScreen.y}`
12673
- }
12674
- ),
12675
- dragState?.editEvent.route.map((r, i) => {
12676
- const rScreen = applyToPoint9(transform, r);
12677
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
12678
- r.via && /* @__PURE__ */ jsx8("circle", { cx: rScreen.x, cy: rScreen.y, r: 16, stroke: "red" }),
12679
- /* @__PURE__ */ jsx8("circle", { cx: rScreen.x, cy: rScreen.y, r: 8, stroke: "red" })
12680
- ] }, `r-${i}`);
12681
- }),
12682
- shouldCreateAsVia && /* @__PURE__ */ jsx8(
12683
- "circle",
12684
- {
12685
- cx: dragEndScreen.x,
12686
- cy: dragEndScreen.y,
12687
- r: 16,
12688
- stroke: "red"
12689
- },
12690
- "via-outer-circle"
12691
- ),
12692
- /* @__PURE__ */ jsx8(
12693
- "circle",
12694
- {
12695
- cx: dragEndScreen.x,
12696
- cy: dragEndScreen.y,
12697
- r: 8,
12698
- stroke: "red"
12699
- }
12700
- )
12701
- ]
12702
- }
12703
- ),
12704
- !disabled && /* @__PURE__ */ jsx8(
12705
- "svg",
12706
- {
12707
- style: {
12708
- position: "absolute",
12709
- left: 0,
12710
- top: 0,
12711
- pointerEvents: "none",
12712
- mixBlendMode: "difference",
12713
- zIndex: zIndexMap.editTraceHintOverlay
12714
- },
12715
- width: containerBounds?.width,
12716
- height: containerBounds?.height,
12717
- children: soup.filter((e) => e.type === "pcb_trace_hint").map((e) => {
12718
- const { route } = e;
12719
- const pcb_port = su(soup).pcb_port.get(e.pcb_port_id);
12720
- const pcb_port_screen = applyToPoint9(transform, pcb_port);
12721
- return /* @__PURE__ */ jsxs6(Fragment2, { children: [
12722
- /* @__PURE__ */ jsx8(
12723
- "rect",
12724
- {
12725
- x: pcb_port_screen.x - 10,
12726
- y: pcb_port_screen.y - 10,
12727
- width: 20,
12728
- height: 20,
12729
- stroke: "red"
12730
- },
12731
- `rect-${e.pcb_port_id}`
12732
- ),
12733
- /* @__PURE__ */ jsx8(
12734
- "path",
12735
- {
12736
- stroke: "red",
12737
- d: `M ${pcb_port_screen.x} ${pcb_port_screen.y} ${route.map((r) => applyToPoint9(transform, r)).map((r) => `L ${r.x} ${r.y}`).join(" ")}`
12738
- },
12739
- `path-${e.pcb_port_id}`
12740
- ),
12741
- route.map((r) => ({ ...r, ...applyToPoint9(transform, r) })).map((r, i) => /* @__PURE__ */ jsxs6(Fragment2, { children: [
12742
- /* @__PURE__ */ jsx8("circle", { cx: r.x, cy: r.y, r: 8, stroke: "red" }),
12743
- r.via && /* @__PURE__ */ jsx8(
12744
- "circle",
12745
- {
12746
- cx: r.x,
12747
- cy: r.y,
12748
- r: 16,
12749
- stroke: "red",
12750
- fill: "transparent"
12751
- }
12752
- )
12753
- ] }, i))
12754
- ] }, e.pcb_trace_hint_id);
12755
- })
12756
- },
12757
- "pcb-trace-hints"
12758
- ),
12759
- /* @__PURE__ */ jsx8(
12760
- "div",
12761
- {
12762
- style: {
12763
- position: "absolute",
12764
- right: 0,
12765
- bottom: 0
12766
- },
12767
- children: isElementSelected && /* @__PURE__ */ jsx8(
12768
- HotkeyActionMenu,
12769
- {
12770
- hotkeys: [
12771
- {
12772
- key: "v",
12773
- name: "Toggle Via",
12774
- onUse: () => {
12775
- setShouldCreateAsVia(!shouldCreateAsVia);
12776
- }
12777
- }
12778
- // {
12779
- // key: "del",
12780
- // name: "Delete Node",
12781
- // onUse: () => {},
12782
- // },
12783
- // {
12784
- // key: "r",
12785
- // name: "Delete Route",
12786
- // onUse: () => {},
12787
- // },
12788
- ]
12789
- }
12790
- )
12791
- }
12792
- )
12793
- ]
12794
- }
12795
- );
12796
- };
12797
-
12798
12370
  // src/components/ErrorOverlay.tsx
12799
- import { useRef as useRef8, Fragment as Fragment3 } from "react";
12800
- import { css as css2 } from "@emotion/css";
12801
- import { applyToPoint as applyToPoint10, identity as identity6 } from "transformation-matrix";
12371
+ import { useRef as useRef7, Fragment as Fragment2 } from "react";
12372
+ import { css } from "@emotion/css";
12373
+ import { applyToPoint as applyToPoint9, identity as identity5 } from "transformation-matrix";
12802
12374
 
12803
12375
  // src/lib/util/getPopupPosition.ts
12804
12376
  var getPopupPosition = (errorCenter, containerRef) => {
@@ -12835,10 +12407,10 @@ var getPopupPosition = (errorCenter, containerRef) => {
12835
12407
  };
12836
12408
 
12837
12409
  // src/components/FocusMarkerSVG.tsx
12838
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
12410
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
12839
12411
  var FocusMarkerSVG = ({
12840
12412
  center
12841
- }) => /* @__PURE__ */ jsxs7(
12413
+ }) => /* @__PURE__ */ jsxs5(
12842
12414
  "svg",
12843
12415
  {
12844
12416
  style: {
@@ -12852,7 +12424,7 @@ var FocusMarkerSVG = ({
12852
12424
  width: "100%",
12853
12425
  height: "100%",
12854
12426
  children: [
12855
- /* @__PURE__ */ jsx9(
12427
+ /* @__PURE__ */ jsx7(
12856
12428
  "circle",
12857
12429
  {
12858
12430
  cx: center.x,
@@ -12864,8 +12436,8 @@ var FocusMarkerSVG = ({
12864
12436
  opacity: 0.95
12865
12437
  }
12866
12438
  ),
12867
- /* @__PURE__ */ jsx9("circle", { cx: center.x, cy: center.y, r: 4.5, fill: "#ff6b6b", opacity: 0.95 }),
12868
- /* @__PURE__ */ jsx9(
12439
+ /* @__PURE__ */ jsx7("circle", { cx: center.x, cy: center.y, r: 4.5, fill: "#ff6b6b", opacity: 0.95 }),
12440
+ /* @__PURE__ */ jsx7(
12869
12441
  "line",
12870
12442
  {
12871
12443
  x1: center.x - 18,
@@ -12876,7 +12448,7 @@ var FocusMarkerSVG = ({
12876
12448
  strokeWidth: 2
12877
12449
  }
12878
12450
  ),
12879
- /* @__PURE__ */ jsx9(
12451
+ /* @__PURE__ */ jsx7(
12880
12452
  "line",
12881
12453
  {
12882
12454
  x1: center.x + 8,
@@ -12887,7 +12459,7 @@ var FocusMarkerSVG = ({
12887
12459
  strokeWidth: 2
12888
12460
  }
12889
12461
  ),
12890
- /* @__PURE__ */ jsx9(
12462
+ /* @__PURE__ */ jsx7(
12891
12463
  "line",
12892
12464
  {
12893
12465
  x1: center.x,
@@ -12898,7 +12470,7 @@ var FocusMarkerSVG = ({
12898
12470
  strokeWidth: 2
12899
12471
  }
12900
12472
  ),
12901
- /* @__PURE__ */ jsx9(
12473
+ /* @__PURE__ */ jsx7(
12902
12474
  "line",
12903
12475
  {
12904
12476
  x1: center.x,
@@ -12914,11 +12486,11 @@ var FocusMarkerSVG = ({
12914
12486
  );
12915
12487
 
12916
12488
  // src/components/ErrorOverlay.tsx
12917
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
12489
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
12918
12490
  var ErrorMarkerSVG = ({
12919
12491
  errorCenter,
12920
12492
  isHighlighted = false
12921
- }) => /* @__PURE__ */ jsx10(
12493
+ }) => /* @__PURE__ */ jsx8(
12922
12494
  "svg",
12923
12495
  {
12924
12496
  style: {
@@ -12931,7 +12503,7 @@ var ErrorMarkerSVG = ({
12931
12503
  },
12932
12504
  width: "100%",
12933
12505
  height: "100%",
12934
- children: /* @__PURE__ */ jsx10(
12506
+ children: /* @__PURE__ */ jsx8(
12935
12507
  "rect",
12936
12508
  {
12937
12509
  x: errorCenter.x - 7,
@@ -12946,7 +12518,7 @@ var ErrorMarkerSVG = ({
12946
12518
  )
12947
12519
  }
12948
12520
  );
12949
- var errorMessageStyles = css2`
12521
+ var errorMessageStyles = css`
12950
12522
  opacity: 0;
12951
12523
  pointer-events: none;
12952
12524
  background-color: rgba(0, 0, 0, 0.8);
@@ -12962,10 +12534,10 @@ var errorMessageStyles = css2`
12962
12534
  `;
12963
12535
  var ErrorOverlay = ({
12964
12536
  children,
12965
- transform = identity6(),
12537
+ transform = identity5(),
12966
12538
  elements
12967
12539
  }) => {
12968
- const containerRef = useRef8(null);
12540
+ const containerRef = useRef7(null);
12969
12541
  const { isShowingDRCErrors, hoveredErrorId, focusedErrorId } = useGlobalStore(
12970
12542
  (state) => ({
12971
12543
  isShowingDRCErrors: state.is_showing_drc_errors,
@@ -12975,7 +12547,7 @@ var ErrorOverlay = ({
12975
12547
  );
12976
12548
  const activeErrorId = focusedErrorId ?? hoveredErrorId;
12977
12549
  if (!elements) {
12978
- return /* @__PURE__ */ jsx10("div", { style: { position: "relative" }, ref: containerRef, children });
12550
+ return /* @__PURE__ */ jsx8("div", { style: { position: "relative" }, ref: containerRef, children });
12979
12551
  }
12980
12552
  const traceErrors = elements.filter(
12981
12553
  (el) => el.type === "pcb_trace_error" && !el.message?.includes("Multiple components found with name")
@@ -12996,7 +12568,7 @@ var ErrorOverlay = ({
12996
12568
  if (!focusCenter || typeof focusCenter.x !== "number" || typeof focusCenter.y !== "number") {
12997
12569
  return null;
12998
12570
  }
12999
- const screenCenter = applyToPoint10(transform, focusCenter);
12571
+ const screenCenter = applyToPoint9(transform, focusCenter);
13000
12572
  if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y)) {
13001
12573
  return null;
13002
12574
  }
@@ -13008,7 +12580,7 @@ var ErrorOverlay = ({
13008
12580
  focusedErrorElement
13009
12581
  );
13010
12582
  }
13011
- return /* @__PURE__ */ jsxs8("div", { style: { position: "relative" }, ref: containerRef, children: [
12583
+ return /* @__PURE__ */ jsxs6("div", { style: { position: "relative" }, ref: containerRef, children: [
13012
12584
  children,
13013
12585
  traceErrors.map((el, index) => {
13014
12586
  const errorId = getErrorId(el, index);
@@ -13017,15 +12589,15 @@ var ErrorOverlay = ({
13017
12589
  const errorCenter = getScreenErrorCenter(el);
13018
12590
  if (!errorCenter) return null;
13019
12591
  const popupPosition = getPopupPosition(errorCenter, containerRef);
13020
- return /* @__PURE__ */ jsxs8(Fragment3, { children: [
13021
- /* @__PURE__ */ jsx10(
12592
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
12593
+ /* @__PURE__ */ jsx8(
13022
12594
  ErrorMarkerSVG,
13023
12595
  {
13024
12596
  errorCenter,
13025
12597
  isHighlighted
13026
12598
  }
13027
12599
  ),
13028
- /* @__PURE__ */ jsx10(
12600
+ /* @__PURE__ */ jsx8(
13029
12601
  "div",
13030
12602
  {
13031
12603
  style: {
@@ -13060,7 +12632,7 @@ var ErrorOverlay = ({
13060
12632
  }
13061
12633
  }
13062
12634
  ),
13063
- /* @__PURE__ */ jsx10(
12635
+ /* @__PURE__ */ jsx8(
13064
12636
  "div",
13065
12637
  {
13066
12638
  style: {
@@ -13078,7 +12650,7 @@ var ErrorOverlay = ({
13078
12650
  pointerEvents: "none",
13079
12651
  transform: popupPosition.transform
13080
12652
  },
13081
- children: /* @__PURE__ */ jsx10(
12653
+ children: /* @__PURE__ */ jsx8(
13082
12654
  "div",
13083
12655
  {
13084
12656
  className: `error-message ${errorMessageStyles}`,
@@ -13103,15 +12675,15 @@ var ErrorOverlay = ({
13103
12675
  { x: errorCenter.x, y: errorCenter.y },
13104
12676
  containerRef
13105
12677
  );
13106
- return /* @__PURE__ */ jsxs8(Fragment3, { children: [
13107
- /* @__PURE__ */ jsx10(
12678
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
12679
+ /* @__PURE__ */ jsx8(
13108
12680
  ErrorMarkerSVG,
13109
12681
  {
13110
12682
  errorCenter,
13111
12683
  isHighlighted
13112
12684
  }
13113
12685
  ),
13114
- /* @__PURE__ */ jsx10(
12686
+ /* @__PURE__ */ jsx8(
13115
12687
  "div",
13116
12688
  {
13117
12689
  style: {
@@ -13146,7 +12718,7 @@ var ErrorOverlay = ({
13146
12718
  }
13147
12719
  }
13148
12720
  ),
13149
- /* @__PURE__ */ jsx10(
12721
+ /* @__PURE__ */ jsx8(
13150
12722
  "div",
13151
12723
  {
13152
12724
  style: {
@@ -13164,7 +12736,7 @@ var ErrorOverlay = ({
13164
12736
  pointerEvents: "none",
13165
12737
  transform: popupPosition.transform
13166
12738
  },
13167
- children: /* @__PURE__ */ jsx10(
12739
+ children: /* @__PURE__ */ jsx8(
13168
12740
  "div",
13169
12741
  {
13170
12742
  className: `error-message ${errorMessageStyles}`,
@@ -13201,7 +12773,7 @@ var ErrorOverlay = ({
13201
12773
  if (pcbComp && pcbComp.type === "pcb_component")
13202
12774
  center = pcbComp.center || { x: 0, y: 0 };
13203
12775
  }
13204
- const screenCenter = applyToPoint10(transform, center);
12776
+ const screenCenter = applyToPoint9(transform, center);
13205
12777
  if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y))
13206
12778
  return null;
13207
12779
  const scale7 = Math.abs(transform.a);
@@ -13213,8 +12785,8 @@ var ErrorOverlay = ({
13213
12785
  Math.min(maxRadius, baseRadius * scale7)
13214
12786
  );
13215
12787
  const popupPosition = getPopupPosition(screenCenter, containerRef);
13216
- return /* @__PURE__ */ jsxs8(Fragment3, { children: [
13217
- /* @__PURE__ */ jsx10(
12788
+ return /* @__PURE__ */ jsxs6(Fragment2, { children: [
12789
+ /* @__PURE__ */ jsx8(
13218
12790
  "svg",
13219
12791
  {
13220
12792
  style: {
@@ -13227,13 +12799,13 @@ var ErrorOverlay = ({
13227
12799
  },
13228
12800
  width: "100%",
13229
12801
  height: "100%",
13230
- children: isHighlighted ? /* @__PURE__ */ jsx10(
12802
+ children: isHighlighted ? /* @__PURE__ */ jsx8(
13231
12803
  "polygon",
13232
12804
  {
13233
12805
  points: `${screenCenter.x},${screenCenter.y - scaledRadius * 1.25} ${screenCenter.x + scaledRadius},${screenCenter.y} ${screenCenter.x},${screenCenter.y + scaledRadius * 1.25} ${screenCenter.x - scaledRadius},${screenCenter.y}`,
13234
12806
  fill: "#ff4444"
13235
12807
  }
13236
- ) : /* @__PURE__ */ jsx10(
12808
+ ) : /* @__PURE__ */ jsx8(
13237
12809
  "circle",
13238
12810
  {
13239
12811
  cx: screenCenter.x,
@@ -13247,7 +12819,7 @@ var ErrorOverlay = ({
13247
12819
  )
13248
12820
  }
13249
12821
  ),
13250
- /* @__PURE__ */ jsx10(
12822
+ /* @__PURE__ */ jsx8(
13251
12823
  "div",
13252
12824
  {
13253
12825
  style: {
@@ -13282,7 +12854,7 @@ var ErrorOverlay = ({
13282
12854
  }
13283
12855
  }
13284
12856
  ),
13285
- /* @__PURE__ */ jsx10(
12857
+ /* @__PURE__ */ jsx8(
13286
12858
  "div",
13287
12859
  {
13288
12860
  style: {
@@ -13300,7 +12872,7 @@ var ErrorOverlay = ({
13300
12872
  pointerEvents: "none",
13301
12873
  transform: popupPosition.transform
13302
12874
  },
13303
- children: /* @__PURE__ */ jsx10(
12875
+ children: /* @__PURE__ */ jsx8(
13304
12876
  "div",
13305
12877
  {
13306
12878
  className: `error-message ${errorMessageStyles}`,
@@ -13316,7 +12888,7 @@ var ErrorOverlay = ({
13316
12888
  ] }, `${errorId}_${compIndex}`);
13317
12889
  });
13318
12890
  }),
13319
- focusScreenCenter && /* @__PURE__ */ jsx10(FocusMarkerSVG, { center: focusScreenCenter })
12891
+ focusScreenCenter && /* @__PURE__ */ jsx8(FocusMarkerSVG, { center: focusScreenCenter })
13320
12892
  ] });
13321
12893
  };
13322
12894
 
@@ -13331,8 +12903,8 @@ function ifSetsMatchExactly(set1, set2) {
13331
12903
  }
13332
12904
 
13333
12905
  // src/components/MouseElementTracker.tsx
13334
- import { useEffect as useEffect12, useMemo as useMemo5, useState as useState8 } from "react";
13335
- import { applyToPoint as applyToPoint13, inverse as inverse5 } from "transformation-matrix";
12906
+ import { useEffect as useEffect10, useMemo as useMemo5, useState as useState7 } from "react";
12907
+ import { applyToPoint as applyToPoint12, inverse as inverse4 } from "transformation-matrix";
13336
12908
 
13337
12909
  // src/components/AnchorOffsetOverlay/common/guards.ts
13338
12910
  var isPcbComponent = (element) => element?.type === "pcb_component";
@@ -13341,7 +12913,7 @@ var isPcbPanel = (element) => element?.type === "pcb_panel";
13341
12913
  var isPcbBoard = (element) => element?.type === "pcb_board";
13342
12914
 
13343
12915
  // src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
13344
- import { applyToPoint as applyToPoint11 } from "transformation-matrix";
12916
+ import { applyToPoint as applyToPoint10 } from "transformation-matrix";
13345
12917
 
13346
12918
  // src/components/AnchorOffsetOverlay/common/constants.ts
13347
12919
  var VISUAL_CONFIG = {
@@ -13367,7 +12939,7 @@ var COLORS = {
13367
12939
  };
13368
12940
 
13369
12941
  // src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
13370
- import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
12942
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
13371
12943
  var AnchorOffsetOverlay = ({
13372
12944
  targets,
13373
12945
  transform,
@@ -13386,11 +12958,11 @@ var AnchorOffsetOverlay = ({
13386
12958
  const anchorScreens = /* @__PURE__ */ new Map();
13387
12959
  targets.forEach((target) => {
13388
12960
  if (!anchorScreens.has(target.anchor_id)) {
13389
- const screenPoint = applyToPoint11(transform, target.anchor);
12961
+ const screenPoint = applyToPoint10(transform, target.anchor);
13390
12962
  anchorScreens.set(target.anchor_id, screenPoint);
13391
12963
  }
13392
12964
  });
13393
- return /* @__PURE__ */ jsx11(
12965
+ return /* @__PURE__ */ jsx9(
13394
12966
  "div",
13395
12967
  {
13396
12968
  style: {
@@ -13403,7 +12975,7 @@ var AnchorOffsetOverlay = ({
13403
12975
  pointerEvents: "none",
13404
12976
  zIndex: zIndexMap.dimensionOverlay
13405
12977
  },
13406
- children: /* @__PURE__ */ jsxs9(
12978
+ children: /* @__PURE__ */ jsxs7(
13407
12979
  "svg",
13408
12980
  {
13409
12981
  style: {
@@ -13420,7 +12992,7 @@ var AnchorOffsetOverlay = ({
13420
12992
  const anchorKey = target.anchor_id;
13421
12993
  const targetCenter = target.target;
13422
12994
  const anchorMarkerScreen = anchorScreens.get(anchorKey);
13423
- const targetScreen = applyToPoint11(transform, targetCenter);
12995
+ const targetScreen = applyToPoint10(transform, targetCenter);
13424
12996
  const offsetX = targetCenter.x - anchorPosition.x;
13425
12997
  const offsetY = targetCenter.y - anchorPosition.y;
13426
12998
  const xLineLength = Math.abs(targetScreen.x - anchorMarkerScreen.x);
@@ -13433,8 +13005,8 @@ var AnchorOffsetOverlay = ({
13433
13005
  const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
13434
13006
  const xLabelText = `${target.display_offset_x ?? offsetX.toFixed(2)}mm`;
13435
13007
  const yLabelText = `${target.display_offset_y ?? offsetY.toFixed(2)}mm`;
13436
- return /* @__PURE__ */ jsxs9("g", { children: [
13437
- /* @__PURE__ */ jsx11(
13008
+ return /* @__PURE__ */ jsxs7("g", { children: [
13009
+ /* @__PURE__ */ jsx9(
13438
13010
  "line",
13439
13011
  {
13440
13012
  x1: anchorMarkerScreen.x,
@@ -13446,7 +13018,7 @@ var AnchorOffsetOverlay = ({
13446
13018
  strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
13447
13019
  }
13448
13020
  ),
13449
- /* @__PURE__ */ jsx11(
13021
+ /* @__PURE__ */ jsx9(
13450
13022
  "line",
13451
13023
  {
13452
13024
  x1: targetScreen.x,
@@ -13458,7 +13030,7 @@ var AnchorOffsetOverlay = ({
13458
13030
  strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
13459
13031
  }
13460
13032
  ),
13461
- target.type === "component" || target.type === "board" ? /* @__PURE__ */ jsx11(
13033
+ target.type === "component" || target.type === "board" ? /* @__PURE__ */ jsx9(
13462
13034
  "circle",
13463
13035
  {
13464
13036
  cx: targetScreen.x,
@@ -13470,8 +13042,8 @@ var AnchorOffsetOverlay = ({
13470
13042
  }
13471
13043
  ) : (
13472
13044
  // assumes "group"
13473
- /* @__PURE__ */ jsxs9(Fragment4, { children: [
13474
- /* @__PURE__ */ jsx11(
13045
+ /* @__PURE__ */ jsxs7(Fragment3, { children: [
13046
+ /* @__PURE__ */ jsx9(
13475
13047
  "line",
13476
13048
  {
13477
13049
  x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
@@ -13482,7 +13054,7 @@ var AnchorOffsetOverlay = ({
13482
13054
  strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13483
13055
  }
13484
13056
  ),
13485
- /* @__PURE__ */ jsx11(
13057
+ /* @__PURE__ */ jsx9(
13486
13058
  "line",
13487
13059
  {
13488
13060
  x1: targetScreen.x,
@@ -13495,7 +13067,7 @@ var AnchorOffsetOverlay = ({
13495
13067
  )
13496
13068
  ] })
13497
13069
  ),
13498
- shouldShowXLabel && /* @__PURE__ */ jsx11(
13070
+ shouldShowXLabel && /* @__PURE__ */ jsx9(
13499
13071
  "foreignObject",
13500
13072
  {
13501
13073
  x: Math.min(anchorMarkerScreen.x, targetScreen.x),
@@ -13503,10 +13075,10 @@ var AnchorOffsetOverlay = ({
13503
13075
  width: Math.abs(targetScreen.x - anchorMarkerScreen.x),
13504
13076
  height: 20,
13505
13077
  style: { overflow: "visible" },
13506
- children: /* @__PURE__ */ jsx11("div", { style: { ...labelStyle, textAlign: "center" }, children: xLabelText })
13078
+ children: /* @__PURE__ */ jsx9("div", { style: { ...labelStyle, textAlign: "center" }, children: xLabelText })
13507
13079
  }
13508
13080
  ),
13509
- shouldShowYLabel && /* @__PURE__ */ jsx11(
13081
+ shouldShowYLabel && /* @__PURE__ */ jsx9(
13510
13082
  "foreignObject",
13511
13083
  {
13512
13084
  x: targetScreen.x + yLabelOffset,
@@ -13514,7 +13086,7 @@ var AnchorOffsetOverlay = ({
13514
13086
  width: VISUAL_CONFIG.Y_LABEL_MIN_WIDTH,
13515
13087
  height: Math.abs(targetScreen.y - anchorMarkerScreen.y),
13516
13088
  style: { overflow: "visible" },
13517
- children: /* @__PURE__ */ jsx11(
13089
+ children: /* @__PURE__ */ jsx9(
13518
13090
  "div",
13519
13091
  {
13520
13092
  style: {
@@ -13533,8 +13105,8 @@ var AnchorOffsetOverlay = ({
13533
13105
  )
13534
13106
  ] }, target.id);
13535
13107
  }),
13536
- Array.from(anchorScreens.entries()).map(([anchorId, anchorScreen]) => /* @__PURE__ */ jsxs9("g", { children: [
13537
- /* @__PURE__ */ jsx11(
13108
+ Array.from(anchorScreens.entries()).map(([anchorId, anchorScreen]) => /* @__PURE__ */ jsxs7("g", { children: [
13109
+ /* @__PURE__ */ jsx9(
13538
13110
  "line",
13539
13111
  {
13540
13112
  x1: anchorScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
@@ -13545,7 +13117,7 @@ var AnchorOffsetOverlay = ({
13545
13117
  strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13546
13118
  }
13547
13119
  ),
13548
- /* @__PURE__ */ jsx11(
13120
+ /* @__PURE__ */ jsx9(
13549
13121
  "line",
13550
13122
  {
13551
13123
  x1: anchorScreen.x,
@@ -13565,7 +13137,7 @@ var AnchorOffsetOverlay = ({
13565
13137
  };
13566
13138
 
13567
13139
  // src/components/AnchorOffsetOverlay/BoardAnchorOffsetOverlay.tsx
13568
- import { jsx as jsx12 } from "react/jsx-runtime";
13140
+ import { jsx as jsx10 } from "react/jsx-runtime";
13569
13141
  var BoardAnchorOffsetOverlay = ({
13570
13142
  elements,
13571
13143
  highlightedPrimitives,
@@ -13652,7 +13224,7 @@ var BoardAnchorOffsetOverlay = ({
13652
13224
  display_offset_y: target.group.display_offset_y
13653
13225
  };
13654
13226
  }).filter((t) => Boolean(t));
13655
- return /* @__PURE__ */ jsx12(
13227
+ return /* @__PURE__ */ jsx10(
13656
13228
  AnchorOffsetOverlay,
13657
13229
  {
13658
13230
  targets: sharedTargets,
@@ -13664,7 +13236,7 @@ var BoardAnchorOffsetOverlay = ({
13664
13236
  };
13665
13237
 
13666
13238
  // src/components/AnchorOffsetOverlay/GroupAnchorOffsetOverlay.tsx
13667
- import { jsx as jsx13 } from "react/jsx-runtime";
13239
+ import { jsx as jsx11 } from "react/jsx-runtime";
13668
13240
  var GroupAnchorOffsetOverlay = ({
13669
13241
  elements,
13670
13242
  highlightedPrimitives,
@@ -13780,7 +13352,7 @@ var GroupAnchorOffsetOverlay = ({
13780
13352
  display_offset_y: target.group.display_offset_y
13781
13353
  };
13782
13354
  }).filter((t) => Boolean(t));
13783
- return /* @__PURE__ */ jsx13(
13355
+ return /* @__PURE__ */ jsx11(
13784
13356
  AnchorOffsetOverlay,
13785
13357
  {
13786
13358
  targets: sharedTargets,
@@ -13792,8 +13364,8 @@ var GroupAnchorOffsetOverlay = ({
13792
13364
  };
13793
13365
 
13794
13366
  // src/components/AnchorOffsetOverlay/ComponentBoundingBoxOverlay.tsx
13795
- import { applyToPoint as applyToPoint12 } from "transformation-matrix";
13796
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
13367
+ import { applyToPoint as applyToPoint11 } from "transformation-matrix";
13368
+ import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
13797
13369
  var calculateComponentBoundingBox = (component, elements) => {
13798
13370
  const componentId = component.pcb_component_id;
13799
13371
  const padsAndHoles = elements.filter(
@@ -13836,7 +13408,7 @@ var ComponentBoundingBoxOverlay = ({
13836
13408
  renderData.push({ component, bbox, group });
13837
13409
  }
13838
13410
  if (renderData.length === 0) return null;
13839
- return /* @__PURE__ */ jsx14(
13411
+ return /* @__PURE__ */ jsx12(
13840
13412
  "div",
13841
13413
  {
13842
13414
  style: {
@@ -13849,18 +13421,18 @@ var ComponentBoundingBoxOverlay = ({
13849
13421
  pointerEvents: "none",
13850
13422
  zIndex: zIndexMap.dimensionOverlay
13851
13423
  },
13852
- children: /* @__PURE__ */ jsx14(
13424
+ children: /* @__PURE__ */ jsx12(
13853
13425
  "svg",
13854
13426
  {
13855
13427
  style: { position: "absolute", left: 0, top: 0, pointerEvents: "none" },
13856
13428
  width: containerWidth,
13857
13429
  height: containerHeight,
13858
13430
  children: renderData.map(({ component, bbox, group }) => {
13859
- const topLeft = applyToPoint12(transform, {
13431
+ const topLeft = applyToPoint11(transform, {
13860
13432
  x: bbox.minX,
13861
13433
  y: bbox.maxY
13862
13434
  });
13863
- const bottomRight = applyToPoint12(transform, {
13435
+ const bottomRight = applyToPoint11(transform, {
13864
13436
  x: bbox.maxX,
13865
13437
  y: bbox.minY
13866
13438
  });
@@ -13874,9 +13446,9 @@ var ComponentBoundingBoxOverlay = ({
13874
13446
  x: (bbox.minX + bbox.maxX) / 2,
13875
13447
  y: (bbox.minY + bbox.maxY) / 2
13876
13448
  };
13877
- const componentCenterScreen = applyToPoint12(transform, componentCenter);
13878
- return /* @__PURE__ */ jsxs10("g", { children: [
13879
- /* @__PURE__ */ jsx14(
13449
+ const componentCenterScreen = applyToPoint11(transform, componentCenter);
13450
+ return /* @__PURE__ */ jsxs8("g", { children: [
13451
+ /* @__PURE__ */ jsx12(
13880
13452
  "rect",
13881
13453
  {
13882
13454
  x: screenBbox.x,
@@ -13889,7 +13461,7 @@ var ComponentBoundingBoxOverlay = ({
13889
13461
  strokeDasharray: "4,4"
13890
13462
  }
13891
13463
  ),
13892
- /* @__PURE__ */ jsx14(
13464
+ /* @__PURE__ */ jsx12(
13893
13465
  "line",
13894
13466
  {
13895
13467
  x1: componentCenterScreen.x - 6,
@@ -13900,7 +13472,7 @@ var ComponentBoundingBoxOverlay = ({
13900
13472
  strokeWidth: 1.5
13901
13473
  }
13902
13474
  ),
13903
- /* @__PURE__ */ jsx14(
13475
+ /* @__PURE__ */ jsx12(
13904
13476
  "line",
13905
13477
  {
13906
13478
  x1: componentCenterScreen.x,
@@ -13911,7 +13483,7 @@ var ComponentBoundingBoxOverlay = ({
13911
13483
  strokeWidth: 1.5
13912
13484
  }
13913
13485
  ),
13914
- /* @__PURE__ */ jsx14(
13486
+ /* @__PURE__ */ jsx12(
13915
13487
  "circle",
13916
13488
  {
13917
13489
  cx: componentCenterScreen.x,
@@ -13931,7 +13503,7 @@ var ComponentBoundingBoxOverlay = ({
13931
13503
  };
13932
13504
 
13933
13505
  // src/components/AnchorOffsetOverlay/PanelAnchorOffsetOverlay.tsx
13934
- import { jsx as jsx15 } from "react/jsx-runtime";
13506
+ import { jsx as jsx13 } from "react/jsx-runtime";
13935
13507
  var PanelAnchorOffsetOverlay = ({
13936
13508
  elements,
13937
13509
  highlightedPrimitives,
@@ -13980,7 +13552,7 @@ var PanelAnchorOffsetOverlay = ({
13980
13552
  display_offset_y: target.board.display_offset_y
13981
13553
  };
13982
13554
  }).filter((t) => Boolean(t));
13983
- return /* @__PURE__ */ jsx15(
13555
+ return /* @__PURE__ */ jsx13(
13984
13556
  AnchorOffsetOverlay,
13985
13557
  {
13986
13558
  targets: sharedTargets,
@@ -14069,8 +13641,8 @@ function filterTracesIfMultiple(filterTraces) {
14069
13641
  }
14070
13642
 
14071
13643
  // src/components/ElementOverlayBox.tsx
14072
- import { useEffect as useEffect11, useState as useState7 } from "react";
14073
- import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
13644
+ import { useEffect as useEffect9, useState as useState6 } from "react";
13645
+ import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
14074
13646
  var containerStyle = {
14075
13647
  position: "absolute",
14076
13648
  left: 0,
@@ -14133,9 +13705,9 @@ var HighlightedPrimitiveBoxWithText = ({
14133
13705
  mousePos,
14134
13706
  elements
14135
13707
  }) => {
14136
- const [finalState, setFinalState] = useState7(false);
13708
+ const [finalState, setFinalState] = useState6(false);
14137
13709
  const primitiveElement = primitive._element;
14138
- useEffect11(() => {
13710
+ useEffect9(() => {
14139
13711
  setTimeout(() => {
14140
13712
  setFinalState(true);
14141
13713
  }, 100);
@@ -14161,7 +13733,7 @@ var HighlightedPrimitiveBoxWithText = ({
14161
13733
  const traceTextContext = { primitiveElement, elements };
14162
13734
  const overlayInfo = getTraceOverlayInfo(traceTextContext);
14163
13735
  if (!overlayInfo) return null;
14164
- return /* @__PURE__ */ jsx16(
13736
+ return /* @__PURE__ */ jsx14(
14165
13737
  "div",
14166
13738
  {
14167
13739
  style: {
@@ -14172,7 +13744,7 @@ var HighlightedPrimitiveBoxWithText = ({
14172
13744
  color: color7,
14173
13745
  pointerEvents: "none"
14174
13746
  },
14175
- children: /* @__PURE__ */ jsxs11(
13747
+ children: /* @__PURE__ */ jsxs9(
14176
13748
  "div",
14177
13749
  {
14178
13750
  style: {
@@ -14189,8 +13761,8 @@ var HighlightedPrimitiveBoxWithText = ({
14189
13761
  whiteSpace: "nowrap"
14190
13762
  },
14191
13763
  children: [
14192
- overlayInfo.text && /* @__PURE__ */ jsx16("div", { children: overlayInfo.text }),
14193
- overlayInfo.name && /* @__PURE__ */ jsx16(
13764
+ overlayInfo.text && /* @__PURE__ */ jsx14("div", { children: overlayInfo.text }),
13765
+ overlayInfo.name && /* @__PURE__ */ jsx14(
14194
13766
  "div",
14195
13767
  {
14196
13768
  style: {
@@ -14209,7 +13781,7 @@ var HighlightedPrimitiveBoxWithText = ({
14209
13781
  if (label.trim().length === 0) {
14210
13782
  return null;
14211
13783
  }
14212
- return /* @__PURE__ */ jsx16(
13784
+ return /* @__PURE__ */ jsx14(
14213
13785
  "div",
14214
13786
  {
14215
13787
  style: {
@@ -14223,7 +13795,7 @@ var HighlightedPrimitiveBoxWithText = ({
14223
13795
  transform: `rotate(${-rotation}deg)`,
14224
13796
  transformOrigin: "center center"
14225
13797
  },
14226
- children: /* @__PURE__ */ jsx16(
13798
+ children: /* @__PURE__ */ jsx14(
14227
13799
  "div",
14228
13800
  {
14229
13801
  style: {
@@ -14239,7 +13811,7 @@ var HighlightedPrimitiveBoxWithText = ({
14239
13811
  opacity: finalState ? 1 : si === 0 ? 1 : 0,
14240
13812
  transition: "width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"
14241
13813
  },
14242
- children: /* @__PURE__ */ jsx16(
13814
+ children: /* @__PURE__ */ jsx14(
14243
13815
  "div",
14244
13816
  {
14245
13817
  style: {
@@ -14287,7 +13859,7 @@ var ElementOverlayBox = ({
14287
13859
  is_showing_multiple_traces_length,
14288
13860
  elements
14289
13861
  });
14290
- return /* @__PURE__ */ jsx16("div", { style: containerStyle, children: !is_moving_component && primitives.map((primitive) => /* @__PURE__ */ jsx16(
13862
+ return /* @__PURE__ */ jsx14("div", { style: containerStyle, children: !is_moving_component && primitives.map((primitive) => /* @__PURE__ */ jsx14(
14291
13863
  HighlightedPrimitiveBoxWithText,
14292
13864
  {
14293
13865
  primitive,
@@ -14299,7 +13871,7 @@ var ElementOverlayBox = ({
14299
13871
  };
14300
13872
 
14301
13873
  // src/components/MouseElementTracker.tsx
14302
- import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
13874
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
14303
13875
  var getPolygonBoundingBox = (points) => {
14304
13876
  if (points.length === 0) return null;
14305
13877
  let minX = points[0].x;
@@ -14415,10 +13987,10 @@ var MouseElementTracker = ({
14415
13987
  selectedLayer,
14416
13988
  onMouseHoverOverPrimitives
14417
13989
  }) => {
14418
- const [mousedPrimitives, setMousedPrimitives] = useState8([]);
14419
- const [mousePos, setMousePos] = useState8({ x: 0, y: 0 });
13990
+ const [mousedPrimitives, setMousedPrimitives] = useState7([]);
13991
+ const [mousePos, setMousePos] = useState7({ x: 0, y: 0 });
14420
13992
  const [containerRef, { width, height }] = useMeasure_default();
14421
- useEffect12(() => {
13993
+ useEffect10(() => {
14422
13994
  setMousedPrimitives([]);
14423
13995
  onMouseHoverOverPrimitives([]);
14424
13996
  }, [selectedLayer, onMouseHoverOverPrimitives]);
@@ -14461,7 +14033,7 @@ var MouseElementTracker = ({
14461
14033
  h = "h" in primitive ? primitive.h : "r" in primitive ? primitive.r * 2 : "rX" in primitive && "rY" in primitive ? primitive.rY * 2 : 0;
14462
14034
  }
14463
14035
  if (!basePoint) continue;
14464
- const screenPos = applyToPoint13(transform, basePoint);
14036
+ const screenPos = applyToPoint12(transform, basePoint);
14465
14037
  const screenSize = {
14466
14038
  w: w * transform.a,
14467
14039
  h: h * transform.a
@@ -14486,7 +14058,7 @@ var MouseElementTracker = ({
14486
14058
  }, [mousedPrimitives, transform]);
14487
14059
  const handleInteraction = (x, y, transform2, primitives2) => {
14488
14060
  setMousePos({ x, y });
14489
- const rwPoint = applyToPoint13(inverse5(transform2), { x, y });
14061
+ const rwPoint = applyToPoint12(inverse4(transform2), { x, y });
14490
14062
  const newMousedPrimitives = getPrimitivesUnderPoint(
14491
14063
  primitives2,
14492
14064
  rwPoint,
@@ -14502,7 +14074,7 @@ var MouseElementTracker = ({
14502
14074
  setMousedPrimitives(newMousedPrimitives);
14503
14075
  onMouseHoverOverPrimitives(newMousedPrimitives);
14504
14076
  };
14505
- return /* @__PURE__ */ jsxs12(
14077
+ return /* @__PURE__ */ jsxs10(
14506
14078
  "div",
14507
14079
  {
14508
14080
  ref: containerRef,
@@ -14526,7 +14098,7 @@ var MouseElementTracker = ({
14526
14098
  },
14527
14099
  children: [
14528
14100
  children,
14529
- /* @__PURE__ */ jsx17(
14101
+ /* @__PURE__ */ jsx15(
14530
14102
  ElementOverlayBox,
14531
14103
  {
14532
14104
  elements,
@@ -14534,8 +14106,8 @@ var MouseElementTracker = ({
14534
14106
  highlightedPrimitives
14535
14107
  }
14536
14108
  ),
14537
- transform && /* @__PURE__ */ jsxs12(Fragment5, { children: [
14538
- /* @__PURE__ */ jsx17(
14109
+ transform && /* @__PURE__ */ jsxs10(Fragment4, { children: [
14110
+ /* @__PURE__ */ jsx15(
14539
14111
  BoardAnchorOffsetOverlay,
14540
14112
  {
14541
14113
  elements,
@@ -14545,7 +14117,7 @@ var MouseElementTracker = ({
14545
14117
  containerHeight: height
14546
14118
  }
14547
14119
  ),
14548
- /* @__PURE__ */ jsx17(
14120
+ /* @__PURE__ */ jsx15(
14549
14121
  GroupAnchorOffsetOverlay,
14550
14122
  {
14551
14123
  elements,
@@ -14555,7 +14127,7 @@ var MouseElementTracker = ({
14555
14127
  containerHeight: height
14556
14128
  }
14557
14129
  ),
14558
- /* @__PURE__ */ jsx17(
14130
+ /* @__PURE__ */ jsx15(
14559
14131
  ComponentBoundingBoxOverlay,
14560
14132
  {
14561
14133
  elements,
@@ -14565,7 +14137,7 @@ var MouseElementTracker = ({
14565
14137
  containerHeight: height
14566
14138
  }
14567
14139
  ),
14568
- /* @__PURE__ */ jsx17(
14140
+ /* @__PURE__ */ jsx15(
14569
14141
  PanelAnchorOffsetOverlay,
14570
14142
  {
14571
14143
  elements,
@@ -14582,10 +14154,10 @@ var MouseElementTracker = ({
14582
14154
  };
14583
14155
 
14584
14156
  // src/components/PcbGroupOverlay.tsx
14585
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
14586
- import { identity as identity7 } from "transformation-matrix";
14587
- import { useRef as useRef9, useEffect as useEffect13 } from "react";
14588
- import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
14157
+ import { applyToPoint as applyToPoint13 } from "transformation-matrix";
14158
+ import { identity as identity6 } from "transformation-matrix";
14159
+ import { useRef as useRef8, useEffect as useEffect11 } from "react";
14160
+ import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
14589
14161
  var GROUP_COLORS = [
14590
14162
  "rgb(255, 100, 100)",
14591
14163
  "rgb(100, 255, 100)",
@@ -14600,12 +14172,12 @@ var GROUP_COLORS = [
14600
14172
  ];
14601
14173
  var PcbGroupOverlay = ({
14602
14174
  children,
14603
- transform = identity7(),
14175
+ transform = identity6(),
14604
14176
  elements = [],
14605
14177
  hoveredComponentIds = []
14606
14178
  }) => {
14607
14179
  const [containerRef, { width, height }] = useMeasure_default();
14608
- const canvasRef = useRef9(null);
14180
+ const canvasRef = useRef8(null);
14609
14181
  const {
14610
14182
  is_showing_pcb_groups,
14611
14183
  pcb_group_view_mode,
@@ -14615,7 +14187,7 @@ var PcbGroupOverlay = ({
14615
14187
  pcb_group_view_mode: s.pcb_group_view_mode,
14616
14188
  is_showing_group_anchor_offsets: s.is_showing_group_anchor_offsets
14617
14189
  }));
14618
- useEffect13(() => {
14190
+ useEffect11(() => {
14619
14191
  const canvas = canvasRef.current;
14620
14192
  if (!canvas || !width || !height) return;
14621
14193
  canvas.width = width;
@@ -14743,10 +14315,10 @@ var PcbGroupOverlay = ({
14743
14315
  minY -= totalPadding;
14744
14316
  maxY += totalPadding;
14745
14317
  }
14746
- const topLeft = applyToPoint14(transform, { x: minX, y: maxY });
14747
- const topRight = applyToPoint14(transform, { x: maxX, y: maxY });
14748
- const bottomLeft = applyToPoint14(transform, { x: minX, y: minY });
14749
- const bottomRight = applyToPoint14(transform, { x: maxX, y: minY });
14318
+ const topLeft = applyToPoint13(transform, { x: minX, y: maxY });
14319
+ const topRight = applyToPoint13(transform, { x: maxX, y: maxY });
14320
+ const bottomLeft = applyToPoint13(transform, { x: minX, y: minY });
14321
+ const bottomRight = applyToPoint13(transform, { x: maxX, y: minY });
14750
14322
  const groupColor = GROUP_COLORS[groupIndex % GROUP_COLORS.length];
14751
14323
  ctx.strokeStyle = groupColor;
14752
14324
  ctx.lineWidth = 2;
@@ -14796,7 +14368,7 @@ var PcbGroupOverlay = ({
14796
14368
  x: group.anchor_position[0] ?? 0,
14797
14369
  y: group.anchor_position[1] ?? 0
14798
14370
  } : { x: group.anchor_position.x, y: group.anchor_position.y };
14799
- const anchorScreenPos = applyToPoint14(transform, anchorPositionValue);
14371
+ const anchorScreenPos = applyToPoint13(transform, anchorPositionValue);
14800
14372
  ctx.strokeStyle = "white";
14801
14373
  ctx.lineWidth = 1.5;
14802
14374
  ctx.setLineDash([]);
@@ -14821,14 +14393,14 @@ var PcbGroupOverlay = ({
14821
14393
  is_showing_group_anchor_offsets,
14822
14394
  hoveredComponentIds
14823
14395
  ]);
14824
- return /* @__PURE__ */ jsxs13(
14396
+ return /* @__PURE__ */ jsxs11(
14825
14397
  "div",
14826
14398
  {
14827
14399
  ref: containerRef,
14828
14400
  style: { position: "relative", width: "100%", height: "100%" },
14829
14401
  children: [
14830
14402
  children,
14831
- /* @__PURE__ */ jsx18(
14403
+ /* @__PURE__ */ jsx16(
14832
14404
  "canvas",
14833
14405
  {
14834
14406
  ref: canvasRef,
@@ -14848,9 +14420,9 @@ var PcbGroupOverlay = ({
14848
14420
  };
14849
14421
 
14850
14422
  // src/components/RatsNestOverlay.tsx
14851
- import { applyToPoint as applyToPoint15, identity as identity8 } from "transformation-matrix";
14423
+ import { applyToPoint as applyToPoint14, identity as identity7 } from "transformation-matrix";
14852
14424
  import { useMemo as useMemo6 } from "react";
14853
- import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
14425
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
14854
14426
  var RatsNestOverlay = ({ transform, soup, children }) => {
14855
14427
  const isShowingRatsNest = useGlobalStore((s) => s.is_showing_rats_nest);
14856
14428
  const { netMap, idToNetMap } = useMemo6(
@@ -14912,10 +14484,10 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
14912
14484
  return lines;
14913
14485
  }, [soup, netMap, idToNetMap, isShowingRatsNest]);
14914
14486
  if (!soup || !isShowingRatsNest) return children;
14915
- if (!transform) transform = identity8();
14916
- return /* @__PURE__ */ jsxs14("div", { style: { position: "relative" }, children: [
14487
+ if (!transform) transform = identity7();
14488
+ return /* @__PURE__ */ jsxs12("div", { style: { position: "relative" }, children: [
14917
14489
  children,
14918
- /* @__PURE__ */ jsx19(
14490
+ /* @__PURE__ */ jsx17(
14919
14491
  "svg",
14920
14492
  {
14921
14493
  style: {
@@ -14929,9 +14501,9 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
14929
14501
  zIndex: zIndexMap.ratsNestOverlay
14930
14502
  },
14931
14503
  children: ratsNestLines.map(({ key, startPoint, endPoint, isInNet }) => {
14932
- const transformedStart = applyToPoint15(transform, startPoint);
14933
- const transformedEnd = applyToPoint15(transform, endPoint);
14934
- return /* @__PURE__ */ jsx19(
14504
+ const transformedStart = applyToPoint14(transform, startPoint);
14505
+ const transformedEnd = applyToPoint14(transform, endPoint);
14506
+ return /* @__PURE__ */ jsx17(
14935
14507
  "line",
14936
14508
  {
14937
14509
  x1: transformedStart.x,
@@ -14952,18 +14524,18 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
14952
14524
 
14953
14525
  // src/components/ToolbarOverlay.tsx
14954
14526
  import {
14955
- useEffect as useEffect17,
14956
- useState as useState11,
14527
+ useEffect as useEffect15,
14528
+ useState as useState10,
14957
14529
  useCallback as useCallback10,
14958
- useRef as useRef13,
14530
+ useRef as useRef12,
14959
14531
  useLayoutEffect as useLayoutEffect2
14960
14532
  } from "react";
14961
- import { css as css3 } from "@emotion/css";
14533
+ import { css as css2 } from "@emotion/css";
14962
14534
 
14963
14535
  // package.json
14964
14536
  var package_default = {
14965
14537
  name: "@tscircuit/pcb-viewer",
14966
- version: "1.11.385",
14538
+ version: "1.11.387",
14967
14539
  main: "dist/index.js",
14968
14540
  type: "module",
14969
14541
  repository: "tscircuit/pcb-viewer",
@@ -15028,20 +14600,20 @@ var package_default = {
15028
14600
  };
15029
14601
 
15030
14602
  // src/hooks/useHotKey.ts
15031
- import { useEffect as useEffect14, useRef as useRef10 } from "react";
14603
+ import { useEffect as useEffect12, useRef as useRef9 } from "react";
15032
14604
  var useHotKey = (key, onUse, containerRef) => {
15033
14605
  const isMouseOverContainer = useGlobalStore(
15034
14606
  (s) => s.is_mouse_over_container
15035
14607
  );
15036
- const isMouseOverContainerRef = useRef10(isMouseOverContainer);
15037
- const onUseRef = useRef10(onUse);
15038
- useEffect14(() => {
14608
+ const isMouseOverContainerRef = useRef9(isMouseOverContainer);
14609
+ const onUseRef = useRef9(onUse);
14610
+ useEffect12(() => {
15039
14611
  isMouseOverContainerRef.current = isMouseOverContainer;
15040
14612
  }, [isMouseOverContainer]);
15041
- useEffect14(() => {
14613
+ useEffect12(() => {
15042
14614
  onUseRef.current = onUse;
15043
14615
  }, [onUse]);
15044
- useEffect14(() => {
14616
+ useEffect12(() => {
15045
14617
  if (!key) return;
15046
14618
  const handleKeyDown = (event) => {
15047
14619
  const target = event.target;
@@ -15069,10 +14641,10 @@ var useHotKey = (key, onUse, containerRef) => {
15069
14641
  };
15070
14642
 
15071
14643
  // src/hooks/useIsSmallScreen.ts
15072
- import { useEffect as useEffect15, useState as useState9 } from "react";
14644
+ import { useEffect as useEffect13, useState as useState8 } from "react";
15073
14645
  var useIsSmallScreen = () => {
15074
- const [isSmallScreen, setIsSmallScreen] = useState9(false);
15075
- useEffect15(() => {
14646
+ const [isSmallScreen, setIsSmallScreen] = useState8(false);
14647
+ useEffect13(() => {
15076
14648
  const checkIsMobile = () => {
15077
14649
  setIsSmallScreen(window.innerWidth <= 768);
15078
14650
  };
@@ -15086,10 +14658,10 @@ var useIsSmallScreen = () => {
15086
14658
  // src/hooks/useMobileTouch.ts
15087
14659
  import {
15088
14660
  useCallback as useCallback7,
15089
- useRef as useRef11
14661
+ useRef as useRef10
15090
14662
  } from "react";
15091
14663
  var useMobileTouch = (onClick, options = { stopPropagation: true }) => {
15092
- const lastInteractionRef = useRef11(0);
14664
+ const lastInteractionRef = useRef10(0);
15093
14665
  const handleInteraction = useCallback7(
15094
14666
  (e) => {
15095
14667
  if (options.stopPropagation) {
@@ -15118,7 +14690,7 @@ var useMobileTouch = (onClick, options = { stopPropagation: true }) => {
15118
14690
  };
15119
14691
 
15120
14692
  // src/components/ToolbarButton.tsx
15121
- import { jsx as jsx20 } from "react/jsx-runtime";
14693
+ import { jsx as jsx18 } from "react/jsx-runtime";
15122
14694
  var ToolbarButton = ({
15123
14695
  children,
15124
14696
  isSmallScreen,
@@ -15126,7 +14698,7 @@ var ToolbarButton = ({
15126
14698
  ...props
15127
14699
  }) => {
15128
14700
  const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
15129
- return /* @__PURE__ */ jsx20(
14701
+ return /* @__PURE__ */ jsx18(
15130
14702
  "div",
15131
14703
  {
15132
14704
  ...props,
@@ -15154,7 +14726,7 @@ var ToolbarButton = ({
15154
14726
  };
15155
14727
 
15156
14728
  // src/components/ToolbarErrorDropdown.tsx
15157
- import { useCallback as useCallback9, useMemo as useMemo7, useState as useState10 } from "react";
14729
+ import { useCallback as useCallback9, useMemo as useMemo7, useState as useState9 } from "react";
15158
14730
 
15159
14731
  // src/lib/util/group-errors-by-type.ts
15160
14732
  var groupErrorsByType = (errors) => {
@@ -15176,16 +14748,16 @@ var groupErrorsByType = (errors) => {
15176
14748
  };
15177
14749
 
15178
14750
  // src/components/useToolbarErrorFocus.ts
15179
- import { useCallback as useCallback8, useEffect as useEffect16, useRef as useRef12 } from "react";
14751
+ import { useCallback as useCallback8, useEffect as useEffect14, useRef as useRef11 } from "react";
15180
14752
  var useToolbarErrorFocus = ({
15181
14753
  onClose,
15182
14754
  setHoveredErrorId,
15183
14755
  setFocusedErrorId,
15184
14756
  highlightDurationMs = 3e3
15185
14757
  }) => {
15186
- const clearHighlightTimeoutRef = useRef12(null);
15187
- const focusRequestRef = useRef12(null);
15188
- const selectedErrorIdRef = useRef12(null);
14758
+ const clearHighlightTimeoutRef = useRef11(null);
14759
+ const focusRequestRef = useRef11(null);
14760
+ const selectedErrorIdRef = useRef11(null);
15189
14761
  const clearPendingSelection = useCallback8(() => {
15190
14762
  if (clearHighlightTimeoutRef.current !== null) {
15191
14763
  window.clearTimeout(clearHighlightTimeoutRef.current);
@@ -15196,7 +14768,7 @@ var useToolbarErrorFocus = ({
15196
14768
  focusRequestRef.current = null;
15197
14769
  }
15198
14770
  }, []);
15199
- useEffect16(() => clearPendingSelection, [clearPendingSelection]);
14771
+ useEffect14(() => clearPendingSelection, [clearPendingSelection]);
15200
14772
  const handleErrorSelect = useCallback8(
15201
14773
  (errorId) => {
15202
14774
  clearPendingSelection();
@@ -15234,7 +14806,7 @@ var useToolbarErrorFocus = ({
15234
14806
  };
15235
14807
 
15236
14808
  // src/components/ToolbarErrorDropdown.tsx
15237
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
14809
+ import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
15238
14810
  var CopyErrorButton = ({
15239
14811
  errorId,
15240
14812
  errorMessage,
@@ -15244,7 +14816,7 @@ var CopyErrorButton = ({
15244
14816
  const { style: touchStyle, ...touchHandlers } = useMobileTouch(
15245
14817
  () => onCopy(errorMessage, errorId)
15246
14818
  );
15247
- return /* @__PURE__ */ jsx21(
14819
+ return /* @__PURE__ */ jsx19(
15248
14820
  "button",
15249
14821
  {
15250
14822
  type: "button",
@@ -15264,7 +14836,7 @@ var CopyErrorButton = ({
15264
14836
  ...touchStyle
15265
14837
  },
15266
14838
  ...touchHandlers,
15267
- children: copiedErrorId === errorId ? /* @__PURE__ */ jsx21("span", { style: { color: "#4caf50", fontSize: 12 }, children: "Copied!" }) : /* @__PURE__ */ jsx21("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx21("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }) })
14839
+ children: copiedErrorId === errorId ? /* @__PURE__ */ jsx19("span", { style: { color: "#4caf50", fontSize: 12 }, children: "Copied!" }) : /* @__PURE__ */ jsx19("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx19("path", { d: "M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" }) })
15268
14840
  }
15269
14841
  );
15270
14842
  };
@@ -15277,11 +14849,11 @@ var ToolbarErrorDropdown = ({
15277
14849
  setHoveredErrorId,
15278
14850
  setFocusedErrorId
15279
14851
  }) => {
15280
- const [copiedErrorId, setCopiedErrorId] = useState10(null);
15281
- const [collapsedErrorGroups, setCollapsedErrorGroups] = useState10(
14852
+ const [copiedErrorId, setCopiedErrorId] = useState9(null);
14853
+ const [collapsedErrorGroups, setCollapsedErrorGroups] = useState9(
15282
14854
  /* @__PURE__ */ new Set()
15283
14855
  );
15284
- const [expandedErrorIds, setExpandedErrorIds] = useState10(
14856
+ const [expandedErrorIds, setExpandedErrorIds] = useState9(
15285
14857
  /* @__PURE__ */ new Set()
15286
14858
  );
15287
14859
  const [, copyToClipboard] = useCopyToClipboard_default();
@@ -15323,20 +14895,20 @@ var ToolbarErrorDropdown = ({
15323
14895
  return next;
15324
14896
  });
15325
14897
  }, []);
15326
- return /* @__PURE__ */ jsxs15("div", { style: { position: "relative" }, children: [
15327
- /* @__PURE__ */ jsx21(
14898
+ return /* @__PURE__ */ jsxs13("div", { style: { position: "relative" }, children: [
14899
+ /* @__PURE__ */ jsx19(
15328
14900
  ToolbarButton,
15329
14901
  {
15330
14902
  isSmallScreen,
15331
14903
  style: errorCount > 0 ? { color: "red" } : void 0,
15332
14904
  onClick: onToggle,
15333
- children: /* @__PURE__ */ jsxs15("div", { children: [
14905
+ children: /* @__PURE__ */ jsxs13("div", { children: [
15334
14906
  errorCount,
15335
14907
  " errors"
15336
14908
  ] })
15337
14909
  }
15338
14910
  ),
15339
- isOpen && errorCount > 0 && /* @__PURE__ */ jsx21(
14911
+ isOpen && errorCount > 0 && /* @__PURE__ */ jsx19(
15340
14912
  "div",
15341
14913
  {
15342
14914
  style: {
@@ -15356,14 +14928,14 @@ var ToolbarErrorDropdown = ({
15356
14928
  },
15357
14929
  children: groupedErrorElements.map(({ errorType, errors }, groupIndex) => {
15358
14930
  const isGroupCollapsed = collapsedErrorGroups.has(errorType);
15359
- return /* @__PURE__ */ jsxs15(
14931
+ return /* @__PURE__ */ jsxs13(
15360
14932
  "div",
15361
14933
  {
15362
14934
  style: {
15363
14935
  borderBottom: groupIndex < groupedErrorElements.length - 1 ? "1px solid #444" : "none"
15364
14936
  },
15365
14937
  children: [
15366
- /* @__PURE__ */ jsxs15(
14938
+ /* @__PURE__ */ jsxs13(
15367
14939
  "div",
15368
14940
  {
15369
14941
  style: {
@@ -15400,7 +14972,7 @@ var ToolbarErrorDropdown = ({
15400
14972
  toggleErrorGroup(errorType);
15401
14973
  },
15402
14974
  children: [
15403
- /* @__PURE__ */ jsxs15(
14975
+ /* @__PURE__ */ jsxs13(
15404
14976
  "div",
15405
14977
  {
15406
14978
  style: {
@@ -15410,7 +14982,7 @@ var ToolbarErrorDropdown = ({
15410
14982
  color: "#ff6b6b"
15411
14983
  },
15412
14984
  children: [
15413
- /* @__PURE__ */ jsx21(
14985
+ /* @__PURE__ */ jsx19(
15414
14986
  "div",
15415
14987
  {
15416
14988
  style: {
@@ -15423,7 +14995,7 @@ var ToolbarErrorDropdown = ({
15423
14995
  children: "\u203A"
15424
14996
  }
15425
14997
  ),
15426
- /* @__PURE__ */ jsx21(
14998
+ /* @__PURE__ */ jsx19(
15427
14999
  "div",
15428
15000
  {
15429
15001
  style: {
@@ -15436,7 +15008,7 @@ var ToolbarErrorDropdown = ({
15436
15008
  ]
15437
15009
  }
15438
15010
  ),
15439
- /* @__PURE__ */ jsx21(
15011
+ /* @__PURE__ */ jsx19(
15440
15012
  "div",
15441
15013
  {
15442
15014
  style: {
@@ -15454,14 +15026,14 @@ var ToolbarErrorDropdown = ({
15454
15026
  !isGroupCollapsed && errors.map(({ error, index, errorId }) => {
15455
15027
  const isExpanded = expandedErrorIds.has(errorId);
15456
15028
  const errorMessage = error.message ?? "No error message";
15457
- return /* @__PURE__ */ jsxs15(
15029
+ return /* @__PURE__ */ jsxs13(
15458
15030
  "div",
15459
15031
  {
15460
15032
  style: {
15461
15033
  borderTop: "1px solid #3a3a3a"
15462
15034
  },
15463
15035
  children: [
15464
- /* @__PURE__ */ jsxs15(
15036
+ /* @__PURE__ */ jsxs13(
15465
15037
  "div",
15466
15038
  {
15467
15039
  style: {
@@ -15500,7 +15072,7 @@ var ToolbarErrorDropdown = ({
15500
15072
  handleErrorSelect(errorId);
15501
15073
  },
15502
15074
  children: [
15503
- /* @__PURE__ */ jsx21(
15075
+ /* @__PURE__ */ jsx19(
15504
15076
  "div",
15505
15077
  {
15506
15078
  style: {
@@ -15516,7 +15088,7 @@ var ToolbarErrorDropdown = ({
15516
15088
  children: errorMessage
15517
15089
  }
15518
15090
  ),
15519
- /* @__PURE__ */ jsx21(
15091
+ /* @__PURE__ */ jsx19(
15520
15092
  "button",
15521
15093
  {
15522
15094
  type: "button",
@@ -15548,7 +15120,7 @@ var ToolbarErrorDropdown = ({
15548
15120
  ]
15549
15121
  }
15550
15122
  ),
15551
- isExpanded && /* @__PURE__ */ jsxs15(
15123
+ isExpanded && /* @__PURE__ */ jsxs13(
15552
15124
  "div",
15553
15125
  {
15554
15126
  "data-error-id": index,
@@ -15560,7 +15132,7 @@ var ToolbarErrorDropdown = ({
15560
15132
  position: "relative"
15561
15133
  },
15562
15134
  children: [
15563
- /* @__PURE__ */ jsx21(
15135
+ /* @__PURE__ */ jsx19(
15564
15136
  "div",
15565
15137
  {
15566
15138
  style: {
@@ -15578,7 +15150,7 @@ var ToolbarErrorDropdown = ({
15578
15150
  children: errorMessage
15579
15151
  }
15580
15152
  ),
15581
- /* @__PURE__ */ jsx21(
15153
+ /* @__PURE__ */ jsx19(
15582
15154
  CopyErrorButton,
15583
15155
  {
15584
15156
  errorId,
@@ -15610,13 +15182,13 @@ var ToolbarErrorDropdown = ({
15610
15182
  };
15611
15183
 
15612
15184
  // src/components/ToolbarOverlay.tsx
15613
- import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
15185
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
15614
15186
  var LayerButton = ({ name, selected, onClick }) => {
15615
15187
  const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
15616
- return /* @__PURE__ */ jsxs16(
15188
+ return /* @__PURE__ */ jsxs14(
15617
15189
  "div",
15618
15190
  {
15619
- className: css3`
15191
+ className: css2`
15620
15192
  margin-top: 2px;
15621
15193
  padding: 4px;
15622
15194
  padding-left: 8px;
@@ -15630,8 +15202,8 @@ var LayerButton = ({ name, selected, onClick }) => {
15630
15202
  ...touchHandlers,
15631
15203
  style: touchStyle,
15632
15204
  children: [
15633
- /* @__PURE__ */ jsx22("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
15634
- /* @__PURE__ */ jsx22(
15205
+ /* @__PURE__ */ jsx20("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
15206
+ /* @__PURE__ */ jsx20(
15635
15207
  "span",
15636
15208
  {
15637
15209
  style: {
@@ -15652,10 +15224,10 @@ var CheckboxMenuItem = ({
15652
15224
  onClick
15653
15225
  }) => {
15654
15226
  const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
15655
- return /* @__PURE__ */ jsxs16(
15227
+ return /* @__PURE__ */ jsxs14(
15656
15228
  "div",
15657
15229
  {
15658
- className: css3`
15230
+ className: css2`
15659
15231
  margin-top: 2px;
15660
15232
  padding: 4px;
15661
15233
  padding-left: 8px;
@@ -15672,19 +15244,19 @@ var CheckboxMenuItem = ({
15672
15244
  ...touchHandlers,
15673
15245
  style: touchStyle,
15674
15246
  children: [
15675
- /* @__PURE__ */ jsx22("input", { type: "checkbox", checked, onChange: () => {
15247
+ /* @__PURE__ */ jsx20("input", { type: "checkbox", checked, onChange: () => {
15676
15248
  }, readOnly: true }),
15677
- /* @__PURE__ */ jsx22("span", { style: { color: "#eee" }, children: label })
15249
+ /* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
15678
15250
  ]
15679
15251
  }
15680
15252
  );
15681
15253
  };
15682
15254
  var RadioMenuItem = ({ label, checked, onClick }) => {
15683
15255
  const { style: touchStyle, ...touchHandlers } = useMobileTouch(onClick);
15684
- return /* @__PURE__ */ jsxs16(
15256
+ return /* @__PURE__ */ jsxs14(
15685
15257
  "div",
15686
15258
  {
15687
- className: css3`
15259
+ className: css2`
15688
15260
  margin-top: 2px;
15689
15261
  padding: 4px;
15690
15262
  padding-left: 8px;
@@ -15701,9 +15273,9 @@ var RadioMenuItem = ({ label, checked, onClick }) => {
15701
15273
  ...touchHandlers,
15702
15274
  style: touchStyle,
15703
15275
  children: [
15704
- /* @__PURE__ */ jsx22("input", { type: "radio", checked, onChange: () => {
15276
+ /* @__PURE__ */ jsx20("input", { type: "radio", checked, onChange: () => {
15705
15277
  }, readOnly: true }),
15706
- /* @__PURE__ */ jsx22("span", { style: { color: "#eee" }, children: label })
15278
+ /* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
15707
15279
  ]
15708
15280
  }
15709
15281
  );
@@ -15715,9 +15287,7 @@ var ToolbarOverlay = ({ children, elements }) => {
15715
15287
  setIsMouseOverContainer,
15716
15288
  selectedLayer,
15717
15289
  selectLayer,
15718
- editModes,
15719
15290
  viewSettings,
15720
- setEditMode,
15721
15291
  setIsShowingRatsNest,
15722
15292
  setIsShowingMultipleTracesLength,
15723
15293
  setIsShowingAutorouting,
@@ -15738,10 +15308,6 @@ var ToolbarOverlay = ({ children, elements }) => {
15738
15308
  setIsMouseOverContainer: s.setIsMouseOverContainer,
15739
15309
  selectedLayer: s.selected_layer,
15740
15310
  selectLayer: s.selectLayer,
15741
- editModes: {
15742
- in_move_footprint_mode: s.in_move_footprint_mode,
15743
- in_draw_trace_mode: s.in_draw_trace_mode
15744
- },
15745
15311
  viewSettings: {
15746
15312
  is_showing_rats_nest: s.is_showing_rats_nest,
15747
15313
  is_showing_multiple_traces_length: s.is_showing_multiple_traces_length,
@@ -15757,7 +15323,6 @@ var ToolbarOverlay = ({ children, elements }) => {
15757
15323
  is_showing_pcb_notes: s.is_showing_pcb_notes,
15758
15324
  pcb_group_view_mode: s.pcb_group_view_mode
15759
15325
  },
15760
- setEditMode: s.setEditMode,
15761
15326
  setIsShowingRatsNest: s.setIsShowingRatsNest,
15762
15327
  setIsShowingMultipleTracesLength: s.setIsShowingMultipleTracesLength,
15763
15328
  setIsShowingAutorouting: s.setIsShowingAutorouting,
@@ -15774,12 +15339,12 @@ var ToolbarOverlay = ({ children, elements }) => {
15774
15339
  setHoveredErrorId: s.setHoveredErrorId,
15775
15340
  setFocusedErrorId: s.setFocusedErrorId
15776
15341
  }));
15777
- const [isViewMenuOpen, setViewMenuOpen] = useState11(false);
15778
- const [isLayerMenuOpen, setLayerMenuOpen] = useState11(false);
15779
- const [isErrorsOpen, setErrorsOpen] = useState11(false);
15780
- const [measureToolArmed, setMeasureToolArmed] = useState11(false);
15781
- const [boundsToolArmed, setBoundsToolArmed] = useState11(false);
15782
- useEffect17(() => {
15342
+ const [isViewMenuOpen, setViewMenuOpen] = useState10(false);
15343
+ const [isLayerMenuOpen, setLayerMenuOpen] = useState10(false);
15344
+ const [isErrorsOpen, setErrorsOpen] = useState10(false);
15345
+ const [measureToolArmed, setMeasureToolArmed] = useState10(false);
15346
+ const [boundsToolArmed, setBoundsToolArmed] = useState10(false);
15347
+ useEffect15(() => {
15783
15348
  const arm = () => setMeasureToolArmed(true);
15784
15349
  const disarm = () => setMeasureToolArmed(false);
15785
15350
  const armBounds = () => setBoundsToolArmed(true);
@@ -15797,8 +15362,8 @@ var ToolbarOverlay = ({ children, elements }) => {
15797
15362
  }, []);
15798
15363
  const availableLayers = getCopperLayerRefsFromElements(elements ?? []);
15799
15364
  const processedLayers = availableLayers;
15800
- const hasRunInitialMouseCheck = useRef13(false);
15801
- const hotkeyBoundaryRef = useRef13(null);
15365
+ const hasRunInitialMouseCheck = useRef12(false);
15366
+ const hotkeyBoundaryRef = useRef12(null);
15802
15367
  const hotKeyCallbacks = {
15803
15368
  "1": availableLayers[0] ? () => selectLayer(availableLayers[0]) : () => {
15804
15369
  },
@@ -15879,12 +15444,6 @@ var ToolbarOverlay = ({ children, elements }) => {
15879
15444
  const closeErrorsMenu = useCallback10(() => {
15880
15445
  setErrorsOpen(false);
15881
15446
  }, []);
15882
- const handleEditTraceToggle = useCallback10(() => {
15883
- setEditMode(editModes.in_draw_trace_mode ? "off" : "draw_trace");
15884
- }, [editModes.in_draw_trace_mode, setEditMode]);
15885
- const handleMoveComponentToggle = useCallback10(() => {
15886
- setEditMode(editModes.in_move_footprint_mode ? "off" : "move_footprint");
15887
- }, [editModes.in_move_footprint_mode, setEditMode]);
15888
15447
  const handleRatsNestToggle = useCallback10(() => {
15889
15448
  setIsShowingRatsNest(!viewSettings.is_showing_rats_nest);
15890
15449
  }, [viewSettings.is_showing_rats_nest, setIsShowingRatsNest]);
@@ -15911,7 +15470,7 @@ var ToolbarOverlay = ({ children, elements }) => {
15911
15470
  },
15912
15471
  []
15913
15472
  );
15914
- return /* @__PURE__ */ jsxs16(
15473
+ return /* @__PURE__ */ jsxs14(
15915
15474
  "div",
15916
15475
  {
15917
15476
  ref: hotkeyBoundaryRef,
@@ -15921,7 +15480,7 @@ var ToolbarOverlay = ({ children, elements }) => {
15921
15480
  onMouseMove: handleMouseMove,
15922
15481
  children: [
15923
15482
  children,
15924
- /* @__PURE__ */ jsxs16(
15483
+ /* @__PURE__ */ jsxs14(
15925
15484
  "div",
15926
15485
  {
15927
15486
  style: {
@@ -15942,7 +15501,7 @@ var ToolbarOverlay = ({ children, elements }) => {
15942
15501
  ]
15943
15502
  }
15944
15503
  ),
15945
- /* @__PURE__ */ jsxs16(
15504
+ /* @__PURE__ */ jsxs14(
15946
15505
  "div",
15947
15506
  {
15948
15507
  "data-toolbar-overlay": true,
@@ -15973,7 +15532,7 @@ var ToolbarOverlay = ({ children, elements }) => {
15973
15532
  fontFamily: "sans-serif"
15974
15533
  },
15975
15534
  children: [
15976
- /* @__PURE__ */ jsxs16(
15535
+ /* @__PURE__ */ jsxs14(
15977
15536
  ToolbarButton,
15978
15537
  {
15979
15538
  isSmallScreen,
@@ -15984,10 +15543,10 @@ var ToolbarOverlay = ({ children, elements }) => {
15984
15543
  }
15985
15544
  },
15986
15545
  children: [
15987
- /* @__PURE__ */ jsxs16("div", { children: [
15546
+ /* @__PURE__ */ jsxs14("div", { children: [
15988
15547
  "layer:",
15989
15548
  " ",
15990
- /* @__PURE__ */ jsx22(
15549
+ /* @__PURE__ */ jsx20(
15991
15550
  "span",
15992
15551
  {
15993
15552
  style: {
@@ -15999,7 +15558,7 @@ var ToolbarOverlay = ({ children, elements }) => {
15999
15558
  }
16000
15559
  )
16001
15560
  ] }),
16002
- isLayerMenuOpen && /* @__PURE__ */ jsx22("div", { style: { marginTop: 4, minWidth: 120 }, children: processedLayers.map((layer) => /* @__PURE__ */ jsx22(
15561
+ isLayerMenuOpen && /* @__PURE__ */ jsx20("div", { style: { marginTop: 4, minWidth: 120 }, children: processedLayers.map((layer) => /* @__PURE__ */ jsx20(
16003
15562
  LayerButton,
16004
15563
  {
16005
15564
  name: layer,
@@ -16013,7 +15572,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16013
15572
  ]
16014
15573
  }
16015
15574
  ),
16016
- /* @__PURE__ */ jsx22(
15575
+ /* @__PURE__ */ jsx20(
16017
15576
  ToolbarErrorDropdown,
16018
15577
  {
16019
15578
  elements,
@@ -16025,67 +15584,43 @@ var ToolbarOverlay = ({ children, elements }) => {
16025
15584
  setFocusedErrorId
16026
15585
  }
16027
15586
  ),
16028
- /* @__PURE__ */ jsx22(
16029
- ToolbarButton,
16030
- {
16031
- isSmallScreen,
16032
- style: {},
16033
- onClick: handleEditTraceToggle,
16034
- children: /* @__PURE__ */ jsxs16("div", { children: [
16035
- editModes.in_draw_trace_mode ? "\u2716 " : "",
16036
- "Edit Traces"
16037
- ] })
16038
- }
16039
- ),
16040
- /* @__PURE__ */ jsx22(
16041
- ToolbarButton,
16042
- {
16043
- isSmallScreen,
16044
- style: {},
16045
- onClick: handleMoveComponentToggle,
16046
- children: /* @__PURE__ */ jsxs16("div", { children: [
16047
- editModes.in_move_footprint_mode ? "\u2716 " : "",
16048
- "Move Components"
16049
- ] })
16050
- }
16051
- ),
16052
- /* @__PURE__ */ jsx22(
15587
+ /* @__PURE__ */ jsx20(
16053
15588
  ToolbarButton,
16054
15589
  {
16055
15590
  isSmallScreen,
16056
15591
  style: {},
16057
15592
  onClick: handleRatsNestToggle,
16058
- children: /* @__PURE__ */ jsxs16("div", { children: [
15593
+ children: /* @__PURE__ */ jsxs14("div", { children: [
16059
15594
  viewSettings.is_showing_rats_nest ? "\u2716 " : "",
16060
15595
  "Rats Nest"
16061
15596
  ] })
16062
15597
  }
16063
15598
  ),
16064
- /* @__PURE__ */ jsx22(
15599
+ /* @__PURE__ */ jsx20(
16065
15600
  ToolbarButton,
16066
15601
  {
16067
15602
  isSmallScreen,
16068
15603
  style: measureToolArmed ? { backgroundColor: "#444" } : {},
16069
15604
  onClick: handleMeasureToolClick,
16070
- children: /* @__PURE__ */ jsx22("div", { children: "\u{1F4CF}" })
15605
+ children: /* @__PURE__ */ jsx20("div", { children: "\u{1F4CF}" })
16071
15606
  }
16072
15607
  ),
16073
- /* @__PURE__ */ jsx22(
15608
+ /* @__PURE__ */ jsx20(
16074
15609
  ToolbarButton,
16075
15610
  {
16076
15611
  isSmallScreen,
16077
15612
  style: boundsToolArmed ? { backgroundColor: "#444" } : {},
16078
15613
  onClick: handleBoundsToolClick,
16079
- children: /* @__PURE__ */ jsx22("div", { children: "Bounds" })
15614
+ children: /* @__PURE__ */ jsx20("div", { children: "Bounds" })
16080
15615
  }
16081
15616
  ),
16082
- /* @__PURE__ */ jsx22(
15617
+ /* @__PURE__ */ jsx20(
16083
15618
  ToolbarButton,
16084
15619
  {
16085
15620
  isSmallScreen,
16086
15621
  onClick: handleViewMenuToggle,
16087
- children: /* @__PURE__ */ jsxs16("div", { children: [
16088
- /* @__PURE__ */ jsxs16(
15622
+ children: /* @__PURE__ */ jsxs14("div", { children: [
15623
+ /* @__PURE__ */ jsxs14(
16089
15624
  "div",
16090
15625
  {
16091
15626
  style: {
@@ -16095,7 +15630,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16095
15630
  },
16096
15631
  children: [
16097
15632
  "View",
16098
- /* @__PURE__ */ jsx22(
15633
+ /* @__PURE__ */ jsx20(
16099
15634
  "span",
16100
15635
  {
16101
15636
  style: {
@@ -16110,8 +15645,8 @@ var ToolbarOverlay = ({ children, elements }) => {
16110
15645
  ]
16111
15646
  }
16112
15647
  ),
16113
- isViewMenuOpen && /* @__PURE__ */ jsxs16("div", { style: { marginTop: 4, minWidth: 120 }, children: [
16114
- /* @__PURE__ */ jsx22(
15648
+ isViewMenuOpen && /* @__PURE__ */ jsxs14("div", { style: { marginTop: 4, minWidth: 120 }, children: [
15649
+ /* @__PURE__ */ jsx20(
16115
15650
  CheckboxMenuItem,
16116
15651
  {
16117
15652
  label: "Show All Trace Lengths",
@@ -16123,7 +15658,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16123
15658
  }
16124
15659
  }
16125
15660
  ),
16126
- /* @__PURE__ */ jsx22(
15661
+ /* @__PURE__ */ jsx20(
16127
15662
  CheckboxMenuItem,
16128
15663
  {
16129
15664
  label: "Show Autorouting Animation",
@@ -16135,7 +15670,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16135
15670
  }
16136
15671
  }
16137
15672
  ),
16138
- /* @__PURE__ */ jsx22(
15673
+ /* @__PURE__ */ jsx20(
16139
15674
  CheckboxMenuItem,
16140
15675
  {
16141
15676
  label: "Show DRC Errors",
@@ -16145,7 +15680,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16145
15680
  }
16146
15681
  }
16147
15682
  ),
16148
- /* @__PURE__ */ jsx22(
15683
+ /* @__PURE__ */ jsx20(
16149
15684
  CheckboxMenuItem,
16150
15685
  {
16151
15686
  label: "Show Copper Pours",
@@ -16157,7 +15692,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16157
15692
  }
16158
15693
  }
16159
15694
  ),
16160
- /* @__PURE__ */ jsx22(
15695
+ /* @__PURE__ */ jsx20(
16161
15696
  CheckboxMenuItem,
16162
15697
  {
16163
15698
  label: "Show Courtyards",
@@ -16167,7 +15702,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16167
15702
  }
16168
15703
  }
16169
15704
  ),
16170
- /* @__PURE__ */ jsx22(
15705
+ /* @__PURE__ */ jsx20(
16171
15706
  CheckboxMenuItem,
16172
15707
  {
16173
15708
  label: "Show Solder Mask",
@@ -16177,7 +15712,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16177
15712
  }
16178
15713
  }
16179
15714
  ),
16180
- /* @__PURE__ */ jsx22(
15715
+ /* @__PURE__ */ jsx20(
16181
15716
  CheckboxMenuItem,
16182
15717
  {
16183
15718
  label: "Show Silkscreen",
@@ -16187,7 +15722,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16187
15722
  }
16188
15723
  }
16189
15724
  ),
16190
- /* @__PURE__ */ jsx22(
15725
+ /* @__PURE__ */ jsx20(
16191
15726
  CheckboxMenuItem,
16192
15727
  {
16193
15728
  label: "Show Fabrication Notes",
@@ -16199,7 +15734,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16199
15734
  }
16200
15735
  }
16201
15736
  ),
16202
- /* @__PURE__ */ jsx22(
15737
+ /* @__PURE__ */ jsx20(
16203
15738
  CheckboxMenuItem,
16204
15739
  {
16205
15740
  label: "Show PCB Notes",
@@ -16209,7 +15744,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16209
15744
  }
16210
15745
  }
16211
15746
  ),
16212
- /* @__PURE__ */ jsx22(
15747
+ /* @__PURE__ */ jsx20(
16213
15748
  CheckboxMenuItem,
16214
15749
  {
16215
15750
  label: "Show Group Anchor Offsets",
@@ -16221,7 +15756,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16221
15756
  }
16222
15757
  }
16223
15758
  ),
16224
- /* @__PURE__ */ jsx22(
15759
+ /* @__PURE__ */ jsx20(
16225
15760
  CheckboxMenuItem,
16226
15761
  {
16227
15762
  label: "Show PCB Groups",
@@ -16231,8 +15766,8 @@ var ToolbarOverlay = ({ children, elements }) => {
16231
15766
  }
16232
15767
  }
16233
15768
  ),
16234
- viewSettings.is_showing_pcb_groups && /* @__PURE__ */ jsxs16("div", { style: { marginLeft: 16 }, children: [
16235
- /* @__PURE__ */ jsx22(
15769
+ viewSettings.is_showing_pcb_groups && /* @__PURE__ */ jsxs14("div", { style: { marginLeft: 16 }, children: [
15770
+ /* @__PURE__ */ jsx20(
16236
15771
  RadioMenuItem,
16237
15772
  {
16238
15773
  label: "Show All Groups",
@@ -16242,7 +15777,7 @@ var ToolbarOverlay = ({ children, elements }) => {
16242
15777
  }
16243
15778
  }
16244
15779
  ),
16245
- /* @__PURE__ */ jsx22(
15780
+ /* @__PURE__ */ jsx20(
16246
15781
  RadioMenuItem,
16247
15782
  {
16248
15783
  label: "Show Named Groups",
@@ -16266,17 +15801,17 @@ var ToolbarOverlay = ({ children, elements }) => {
16266
15801
  };
16267
15802
 
16268
15803
  // src/components/WarningGraphicsOverlay.tsx
16269
- import { useEffect as useEffect18, useRef as useRef14 } from "react";
16270
- import { applyToPoint as applyToPoint16, identity as identity9 } from "transformation-matrix";
16271
- import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
15804
+ import { useEffect as useEffect16, useRef as useRef13 } from "react";
15805
+ import { applyToPoint as applyToPoint15, identity as identity8 } from "transformation-matrix";
15806
+ import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
16272
15807
  var WarningGraphicsOverlay = ({
16273
15808
  children,
16274
- transform = identity9(),
15809
+ transform = identity8(),
16275
15810
  elements = []
16276
15811
  }) => {
16277
15812
  const [containerRef, { width, height }] = useMeasure_default();
16278
- const canvasRef = useRef14(null);
16279
- useEffect18(() => {
15813
+ const canvasRef = useRef13(null);
15814
+ useEffect16(() => {
16280
15815
  const canvas = canvasRef.current;
16281
15816
  if (!canvas || !width || !height) return;
16282
15817
  canvas.width = width;
@@ -16298,7 +15833,7 @@ var WarningGraphicsOverlay = ({
16298
15833
  );
16299
15834
  if (!component) return;
16300
15835
  const { width: width2, height: height2, center } = component;
16301
- const transformedCenter = applyToPoint16(transform, center);
15836
+ const transformedCenter = applyToPoint15(transform, center);
16302
15837
  const scaledWidth = width2 * Math.abs(transform.a);
16303
15838
  const scaledHeight = height2 * Math.abs(transform.d);
16304
15839
  const boxPadding = 0.1 * Math.abs(transform.a);
@@ -16328,14 +15863,14 @@ var WarningGraphicsOverlay = ({
16328
15863
  ctx.fillText(labelText, labelX + labelWidth / 2, labelY + labelHeight / 2);
16329
15864
  });
16330
15865
  }, [elements, transform, width, height]);
16331
- return /* @__PURE__ */ jsxs17(
15866
+ return /* @__PURE__ */ jsxs15(
16332
15867
  "div",
16333
15868
  {
16334
15869
  ref: containerRef,
16335
15870
  style: { position: "relative", width: "100%", height: "100%" },
16336
15871
  children: [
16337
15872
  children,
16338
- /* @__PURE__ */ jsx23(
15873
+ /* @__PURE__ */ jsx21(
16339
15874
  "canvas",
16340
15875
  {
16341
15876
  ref: canvasRef,
@@ -16354,7 +15889,7 @@ var WarningGraphicsOverlay = ({
16354
15889
  };
16355
15890
 
16356
15891
  // src/components/CanvasElementsRenderer.tsx
16357
- import { jsx as jsx24 } from "react/jsx-runtime";
15892
+ import { jsx as jsx22 } from "react/jsx-runtime";
16358
15893
  var CanvasElementsRenderer = (props) => {
16359
15894
  const { transform, elements } = props;
16360
15895
  const {
@@ -16382,13 +15917,13 @@ var CanvasElementsRenderer = (props) => {
16382
15917
  );
16383
15918
  return [primitivesWithoutInteractionMetadata2, connectivityMap2];
16384
15919
  }, [elementsToRender, props.elements]);
16385
- const [hoverState, setHoverState] = useState12({
15920
+ const [hoverState, setHoverState] = useState11({
16386
15921
  drawingObjectIdsWithMouseOver: /* @__PURE__ */ new Set(),
16387
15922
  primitiveIdsInMousedOverNet: []
16388
15923
  });
16389
- const [hoveredComponentIds, setHoveredComponentIds] = useState12([]);
16390
- const currentTransformRef = useRef15(transform ?? null);
16391
- const zoomAnimationFrameRef = useRef15(null);
15924
+ const [hoveredComponentIds, setHoveredComponentIds] = useState11([]);
15925
+ const currentTransformRef = useRef14(transform ?? null);
15926
+ const zoomAnimationFrameRef = useRef14(null);
16392
15927
  const elementIndexes = useMemo8(
16393
15928
  () => buildErrorPreviewElementIndexes(elements),
16394
15929
  [elements]
@@ -16404,17 +15939,17 @@ var CanvasElementsRenderer = (props) => {
16404
15939
  if (!activeError) return [];
16405
15940
  return getRelatedIdsForError(activeError);
16406
15941
  }, [activeErrorId, elements]);
16407
- useEffect19(() => {
15942
+ useEffect17(() => {
16408
15943
  if (transform) {
16409
15944
  currentTransformRef.current = transform;
16410
15945
  }
16411
15946
  }, [transform]);
16412
- useEffect19(() => {
15947
+ useEffect17(() => {
16413
15948
  return () => {
16414
15949
  cancelTransformAnimation(zoomAnimationFrameRef.current);
16415
15950
  };
16416
15951
  }, []);
16417
- useEffect19(() => {
15952
+ useEffect17(() => {
16418
15953
  if (!props.width || !props.height || !props.setTransform || !focusedErrorId)
16419
15954
  return;
16420
15955
  const focusedError = findErrorElementById(elements, focusedErrorId);
@@ -16496,7 +16031,7 @@ var CanvasElementsRenderer = (props) => {
16496
16031
  },
16497
16032
  [connectivityMap]
16498
16033
  );
16499
- return /* @__PURE__ */ jsx24(
16034
+ return /* @__PURE__ */ jsx22(
16500
16035
  MouseElementTracker,
16501
16036
  {
16502
16037
  elements: elementsToRender,
@@ -16504,7 +16039,7 @@ var CanvasElementsRenderer = (props) => {
16504
16039
  primitives: primitivesWithoutInteractionMetadata,
16505
16040
  selectedLayer,
16506
16041
  onMouseHoverOverPrimitives: onMouseOverPrimitives,
16507
- children: /* @__PURE__ */ jsx24(
16042
+ children: /* @__PURE__ */ jsx22(
16508
16043
  EditPlacementOverlay,
16509
16044
  {
16510
16045
  disabled: !props.allowEditing,
@@ -16513,58 +16048,47 @@ var CanvasElementsRenderer = (props) => {
16513
16048
  cancelPanDrag: props.cancelPanDrag,
16514
16049
  onCreateEditEvent: props.onCreateEditEvent,
16515
16050
  onModifyEditEvent: props.onModifyEditEvent,
16516
- children: /* @__PURE__ */ jsx24(
16517
- EditTraceHintOverlay,
16051
+ children: /* @__PURE__ */ jsx22(
16052
+ DimensionOverlay,
16518
16053
  {
16519
- disabled: !props.allowEditing,
16520
16054
  transform,
16521
- soup: elements,
16055
+ focusOnHover: props.focusOnHover,
16056
+ primitives: primitivesWithoutInteractionMetadata,
16057
+ onBoundsSelected: props.onBoundsSelected,
16522
16058
  cancelPanDrag: props.cancelPanDrag,
16523
- onCreateEditEvent: props.onCreateEditEvent,
16524
- onModifyEditEvent: props.onModifyEditEvent,
16525
- children: /* @__PURE__ */ jsx24(
16526
- DimensionOverlay,
16059
+ children: /* @__PURE__ */ jsx22(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx22(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx22(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx22(
16060
+ PcbGroupOverlay,
16527
16061
  {
16528
16062
  transform,
16529
- focusOnHover: props.focusOnHover,
16530
- primitives: primitivesWithoutInteractionMetadata,
16531
- onBoundsSelected: props.onBoundsSelected,
16532
- cancelPanDrag: props.cancelPanDrag,
16533
- children: /* @__PURE__ */ jsx24(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx24(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx24(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx24(
16534
- PcbGroupOverlay,
16063
+ elements,
16064
+ hoveredComponentIds,
16065
+ children: /* @__PURE__ */ jsx22(
16066
+ DebugGraphicsOverlay,
16535
16067
  {
16536
16068
  transform,
16537
- elements,
16538
- hoveredComponentIds,
16539
- children: /* @__PURE__ */ jsx24(
16540
- DebugGraphicsOverlay,
16069
+ debugGraphics: props.debugGraphics,
16070
+ children: /* @__PURE__ */ jsx22(
16071
+ WarningGraphicsOverlay,
16541
16072
  {
16542
16073
  transform,
16543
- debugGraphics: props.debugGraphics,
16544
- children: /* @__PURE__ */ jsx24(
16545
- WarningGraphicsOverlay,
16074
+ elements,
16075
+ children: /* @__PURE__ */ jsx22(
16076
+ CanvasPrimitiveRenderer,
16546
16077
  {
16547
16078
  transform,
16548
- elements,
16549
- children: /* @__PURE__ */ jsx24(
16550
- CanvasPrimitiveRenderer,
16551
- {
16552
- transform,
16553
- primitives,
16554
- elements: elementsToRender,
16555
- width: props.width,
16556
- height: props.height,
16557
- grid: props.grid
16558
- }
16559
- )
16079
+ primitives,
16080
+ elements: elementsToRender,
16081
+ width: props.width,
16082
+ height: props.height,
16083
+ grid: props.grid
16560
16084
  }
16561
16085
  )
16562
16086
  }
16563
16087
  )
16564
16088
  }
16565
- ) }) }) })
16089
+ )
16566
16090
  }
16567
- )
16091
+ ) }) }) })
16568
16092
  }
16569
16093
  )
16570
16094
  }
@@ -16628,7 +16152,7 @@ var calculateBoardSizeKey = (circuitJson) => {
16628
16152
  };
16629
16153
 
16630
16154
  // src/PCBViewer.tsx
16631
- import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
16155
+ import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
16632
16156
  var defaultTransform = compose8(translate12(400, 300), scale6(40, -40));
16633
16157
  var PCBViewer = ({
16634
16158
  circuitJson,
@@ -16643,11 +16167,11 @@ var PCBViewer = ({
16643
16167
  clickToInteractEnabled = false,
16644
16168
  disablePcbGroups = false
16645
16169
  }) => {
16646
- const [isInteractionEnabled, setIsInteractionEnabled] = useState13(
16170
+ const [isInteractionEnabled, setIsInteractionEnabled] = useState12(
16647
16171
  !clickToInteractEnabled
16648
16172
  );
16649
16173
  const [ref, refDimensions] = useMeasure_default();
16650
- const [transform, setTransformInternal] = useState13(defaultTransform);
16174
+ const [transform, setTransformInternal] = useState12(defaultTransform);
16651
16175
  const shouldAllowCanvasInteraction = useCallback12(
16652
16176
  (event) => {
16653
16177
  const target = event.target;
@@ -16666,10 +16190,10 @@ var PCBViewer = ({
16666
16190
  enabled: isInteractionEnabled,
16667
16191
  shouldDrag: shouldAllowCanvasInteraction
16668
16192
  });
16669
- let [editEvents, setEditEvents] = useState13([]);
16193
+ let [editEvents, setEditEvents] = useState12([]);
16670
16194
  editEvents = editEventsProp ?? editEvents;
16671
- const initialRenderCompleted = useRef16(false);
16672
- const touchStartRef = useRef16(null);
16195
+ const initialRenderCompleted = useRef15(false);
16196
+ const touchStartRef = useRef15(null);
16673
16197
  const circuitJsonKey = useMemo9(
16674
16198
  () => calculateCircuitJsonKey(circuitJson),
16675
16199
  [circuitJson]
@@ -16695,7 +16219,7 @@ var PCBViewer = ({
16695
16219
  setTransform(targetTransform);
16696
16220
  return;
16697
16221
  };
16698
- useEffect20(() => {
16222
+ useEffect18(() => {
16699
16223
  if (!refDimensions?.width) return;
16700
16224
  if (!circuitJson) return;
16701
16225
  if (circuitJson.length === 0) return;
@@ -16704,7 +16228,7 @@ var PCBViewer = ({
16704
16228
  initialRenderCompleted.current = true;
16705
16229
  }
16706
16230
  }, [circuitJson, refDimensions]);
16707
- useEffect20(() => {
16231
+ useEffect18(() => {
16708
16232
  if (initialRenderCompleted.current === true) {
16709
16233
  resetTransform();
16710
16234
  }
@@ -16738,20 +16262,20 @@ var PCBViewer = ({
16738
16262
  }),
16739
16263
  [initialState, disablePcbGroups]
16740
16264
  );
16741
- return /* @__PURE__ */ jsxs18(
16265
+ return /* @__PURE__ */ jsxs16(
16742
16266
  "div",
16743
16267
  {
16744
16268
  ref: transformRef,
16745
16269
  style: { position: "relative" },
16746
16270
  onContextMenu: (event) => event.preventDefault(),
16747
16271
  children: [
16748
- /* @__PURE__ */ jsx25("div", { ref, children: /* @__PURE__ */ jsxs18(
16272
+ /* @__PURE__ */ jsx23("div", { ref, children: /* @__PURE__ */ jsxs16(
16749
16273
  ContextProviders,
16750
16274
  {
16751
16275
  initialState: mergedInitialState,
16752
16276
  disablePcbGroups,
16753
16277
  children: [
16754
- /* @__PURE__ */ jsx25(
16278
+ /* @__PURE__ */ jsx23(
16755
16279
  CanvasElementsRenderer,
16756
16280
  {
16757
16281
  transform,
@@ -16778,11 +16302,11 @@ var PCBViewer = ({
16778
16302
  },
16779
16303
  refDimensions.width
16780
16304
  ),
16781
- /* @__PURE__ */ jsx25(ToastContainer, {})
16305
+ /* @__PURE__ */ jsx23(ToastContainer, {})
16782
16306
  ]
16783
16307
  }
16784
16308
  ) }),
16785
- clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx25(
16309
+ clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx23(
16786
16310
  "div",
16787
16311
  {
16788
16312
  onClick: () => {
@@ -16819,7 +16343,7 @@ var PCBViewer = ({
16819
16343
  justifyContent: "center",
16820
16344
  touchAction: "pan-x pan-y pinch-zoom"
16821
16345
  },
16822
- children: /* @__PURE__ */ jsx25(
16346
+ children: /* @__PURE__ */ jsx23(
16823
16347
  "div",
16824
16348
  {
16825
16349
  style: {