pdfjs-reader-core 0.1.4 → 0.1.5
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.cjs +634 -239
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +237 -8
- package/dist/index.d.ts +237 -8
- package/dist/index.js +595 -194
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1384,6 +1384,12 @@ function createSearchStore(initialOverrides = {}) {
|
|
|
1384
1384
|
set({ currentResultIndex: index });
|
|
1385
1385
|
}
|
|
1386
1386
|
},
|
|
1387
|
+
setCaseSensitive: (value) => {
|
|
1388
|
+
set({ caseSensitive: value });
|
|
1389
|
+
},
|
|
1390
|
+
setWholeWord: (value) => {
|
|
1391
|
+
set({ wholeWord: value });
|
|
1392
|
+
},
|
|
1387
1393
|
toggleCaseSensitive: () => {
|
|
1388
1394
|
set((state) => ({ caseSensitive: !state.caseSensitive }));
|
|
1389
1395
|
},
|
|
@@ -8780,6 +8786,141 @@ var init_DualPageContainer = __esm({
|
|
|
8780
8786
|
}
|
|
8781
8787
|
});
|
|
8782
8788
|
|
|
8789
|
+
// src/components/FloatingZoomControls/FloatingZoomControls.tsx
|
|
8790
|
+
var import_react39, import_jsx_runtime25, FloatingZoomControls;
|
|
8791
|
+
var init_FloatingZoomControls = __esm({
|
|
8792
|
+
"src/components/FloatingZoomControls/FloatingZoomControls.tsx"() {
|
|
8793
|
+
"use strict";
|
|
8794
|
+
import_react39 = require("react");
|
|
8795
|
+
init_hooks();
|
|
8796
|
+
init_utils();
|
|
8797
|
+
import_jsx_runtime25 = require("react/jsx-runtime");
|
|
8798
|
+
FloatingZoomControls = (0, import_react39.memo)(function FloatingZoomControls2({
|
|
8799
|
+
position = "bottom-right",
|
|
8800
|
+
className,
|
|
8801
|
+
showFitToWidth = true,
|
|
8802
|
+
showFitToPage = false,
|
|
8803
|
+
showZoomLevel = true
|
|
8804
|
+
}) {
|
|
8805
|
+
const { viewerStore } = usePDFViewerStores();
|
|
8806
|
+
const scale = useViewerStore((s) => s.scale);
|
|
8807
|
+
const document2 = useViewerStore((s) => s.document);
|
|
8808
|
+
const handleZoomIn = (0, import_react39.useCallback)(() => {
|
|
8809
|
+
viewerStore.getState().zoomIn();
|
|
8810
|
+
}, [viewerStore]);
|
|
8811
|
+
const handleZoomOut = (0, import_react39.useCallback)(() => {
|
|
8812
|
+
viewerStore.getState().zoomOut();
|
|
8813
|
+
}, [viewerStore]);
|
|
8814
|
+
const handleFitToWidth = (0, import_react39.useCallback)(() => {
|
|
8815
|
+
viewerStore.getState().setScale(1);
|
|
8816
|
+
}, [viewerStore]);
|
|
8817
|
+
const handleFitToPage = (0, import_react39.useCallback)(() => {
|
|
8818
|
+
viewerStore.getState().setScale(0.75);
|
|
8819
|
+
}, [viewerStore]);
|
|
8820
|
+
if (!document2) return null;
|
|
8821
|
+
const positionClasses = {
|
|
8822
|
+
"bottom-right": "bottom-4 right-4",
|
|
8823
|
+
"bottom-left": "bottom-4 left-4",
|
|
8824
|
+
"top-right": "top-4 right-4",
|
|
8825
|
+
"top-left": "top-4 left-4"
|
|
8826
|
+
};
|
|
8827
|
+
const zoomPercentage = Math.round(scale * 100);
|
|
8828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
8829
|
+
"div",
|
|
8830
|
+
{
|
|
8831
|
+
className: cn(
|
|
8832
|
+
"fixed z-50 flex items-center gap-1",
|
|
8833
|
+
"bg-white dark:bg-gray-800 rounded-lg shadow-lg",
|
|
8834
|
+
"border border-gray-200 dark:border-gray-700",
|
|
8835
|
+
"p-1",
|
|
8836
|
+
positionClasses[position],
|
|
8837
|
+
className
|
|
8838
|
+
),
|
|
8839
|
+
children: [
|
|
8840
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
8841
|
+
"button",
|
|
8842
|
+
{
|
|
8843
|
+
onClick: handleZoomOut,
|
|
8844
|
+
className: cn(
|
|
8845
|
+
"w-8 h-8 flex items-center justify-center rounded",
|
|
8846
|
+
"text-gray-700 dark:text-gray-300",
|
|
8847
|
+
"hover:bg-gray-100 dark:hover:bg-gray-700",
|
|
8848
|
+
"transition-colors",
|
|
8849
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
8850
|
+
),
|
|
8851
|
+
disabled: scale <= 0.25,
|
|
8852
|
+
title: "Zoom Out",
|
|
8853
|
+
"aria-label": "Zoom Out",
|
|
8854
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M20 12H4" }) })
|
|
8855
|
+
}
|
|
8856
|
+
),
|
|
8857
|
+
showZoomLevel && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "min-w-[48px] text-center text-sm font-medium text-gray-700 dark:text-gray-300", children: [
|
|
8858
|
+
zoomPercentage,
|
|
8859
|
+
"%"
|
|
8860
|
+
] }),
|
|
8861
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
8862
|
+
"button",
|
|
8863
|
+
{
|
|
8864
|
+
onClick: handleZoomIn,
|
|
8865
|
+
className: cn(
|
|
8866
|
+
"w-8 h-8 flex items-center justify-center rounded",
|
|
8867
|
+
"text-gray-700 dark:text-gray-300",
|
|
8868
|
+
"hover:bg-gray-100 dark:hover:bg-gray-700",
|
|
8869
|
+
"transition-colors",
|
|
8870
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
8871
|
+
),
|
|
8872
|
+
disabled: scale >= 4,
|
|
8873
|
+
title: "Zoom In",
|
|
8874
|
+
"aria-label": "Zoom In",
|
|
8875
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4v16m8-8H4" }) })
|
|
8876
|
+
}
|
|
8877
|
+
),
|
|
8878
|
+
(showFitToWidth || showFitToPage) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-px h-6 bg-gray-200 dark:bg-gray-700 mx-1" }),
|
|
8879
|
+
showFitToWidth && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
8880
|
+
"button",
|
|
8881
|
+
{
|
|
8882
|
+
onClick: handleFitToWidth,
|
|
8883
|
+
className: cn(
|
|
8884
|
+
"w-8 h-8 flex items-center justify-center rounded",
|
|
8885
|
+
"text-gray-700 dark:text-gray-300",
|
|
8886
|
+
"hover:bg-gray-100 dark:hover:bg-gray-700",
|
|
8887
|
+
"transition-colors"
|
|
8888
|
+
),
|
|
8889
|
+
title: "Fit to Width",
|
|
8890
|
+
"aria-label": "Fit to Width",
|
|
8891
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4" }) })
|
|
8892
|
+
}
|
|
8893
|
+
),
|
|
8894
|
+
showFitToPage && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
8895
|
+
"button",
|
|
8896
|
+
{
|
|
8897
|
+
onClick: handleFitToPage,
|
|
8898
|
+
className: cn(
|
|
8899
|
+
"w-8 h-8 flex items-center justify-center rounded",
|
|
8900
|
+
"text-gray-700 dark:text-gray-300",
|
|
8901
|
+
"hover:bg-gray-100 dark:hover:bg-gray-700",
|
|
8902
|
+
"transition-colors"
|
|
8903
|
+
),
|
|
8904
|
+
title: "Fit to Page",
|
|
8905
|
+
"aria-label": "Fit to Page",
|
|
8906
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) })
|
|
8907
|
+
}
|
|
8908
|
+
)
|
|
8909
|
+
]
|
|
8910
|
+
}
|
|
8911
|
+
);
|
|
8912
|
+
});
|
|
8913
|
+
}
|
|
8914
|
+
});
|
|
8915
|
+
|
|
8916
|
+
// src/components/FloatingZoomControls/index.ts
|
|
8917
|
+
var init_FloatingZoomControls2 = __esm({
|
|
8918
|
+
"src/components/FloatingZoomControls/index.ts"() {
|
|
8919
|
+
"use strict";
|
|
8920
|
+
init_FloatingZoomControls();
|
|
8921
|
+
}
|
|
8922
|
+
});
|
|
8923
|
+
|
|
8783
8924
|
// src/components/PDFViewer/PDFViewerClient.tsx
|
|
8784
8925
|
var PDFViewerClient_exports = {};
|
|
8785
8926
|
__export(PDFViewerClient_exports, {
|
|
@@ -8796,11 +8937,30 @@ function getSrcIdentifier(src) {
|
|
|
8796
8937
|
const last = Array.from(data.slice(-4)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
8797
8938
|
return `binary:${len}:${first}:${last}`;
|
|
8798
8939
|
}
|
|
8799
|
-
|
|
8940
|
+
function mergeRects2(rects) {
|
|
8941
|
+
if (rects.length === 0) return [];
|
|
8942
|
+
const sorted = [...rects].sort((a, b) => a.y - b.y || a.x - b.x);
|
|
8943
|
+
const merged = [];
|
|
8944
|
+
let current = { ...sorted[0] };
|
|
8945
|
+
for (let i = 1; i < sorted.length; i++) {
|
|
8946
|
+
const rect = sorted[i];
|
|
8947
|
+
if (Math.abs(rect.y - current.y) < 2 && rect.x <= current.x + current.width + 2) {
|
|
8948
|
+
const newRight = Math.max(current.x + current.width, rect.x + rect.width);
|
|
8949
|
+
current.width = newRight - current.x;
|
|
8950
|
+
current.height = Math.max(current.height, rect.height);
|
|
8951
|
+
} else {
|
|
8952
|
+
merged.push(current);
|
|
8953
|
+
current = { ...rect };
|
|
8954
|
+
}
|
|
8955
|
+
}
|
|
8956
|
+
merged.push(current);
|
|
8957
|
+
return merged;
|
|
8958
|
+
}
|
|
8959
|
+
var import_react40, import_jsx_runtime26, PDFViewerInner, PDFViewerInnerWithRef, PDFViewerClient;
|
|
8800
8960
|
var init_PDFViewerClient = __esm({
|
|
8801
8961
|
"src/components/PDFViewer/PDFViewerClient.tsx"() {
|
|
8802
8962
|
"use strict";
|
|
8803
|
-
|
|
8963
|
+
import_react40 = require("react");
|
|
8804
8964
|
init_hooks();
|
|
8805
8965
|
init_utils();
|
|
8806
8966
|
init_Toolbar2();
|
|
@@ -8809,35 +8969,40 @@ var init_PDFViewerClient = __esm({
|
|
|
8809
8969
|
init_DocumentContainer();
|
|
8810
8970
|
init_ContinuousScrollContainer();
|
|
8811
8971
|
init_DualPageContainer();
|
|
8972
|
+
init_FloatingZoomControls2();
|
|
8812
8973
|
init_utils();
|
|
8813
|
-
|
|
8814
|
-
PDFViewerInner = (0,
|
|
8974
|
+
import_jsx_runtime26 = require("react/jsx-runtime");
|
|
8975
|
+
PDFViewerInner = (0, import_react40.memo)(function PDFViewerInner2({
|
|
8815
8976
|
src,
|
|
8816
8977
|
initialPage = 1,
|
|
8817
|
-
initialScale =
|
|
8978
|
+
initialScale = "auto",
|
|
8818
8979
|
showToolbar = true,
|
|
8819
8980
|
showSidebar = true,
|
|
8820
8981
|
showAnnotationToolbar = false,
|
|
8982
|
+
showFloatingZoom = true,
|
|
8821
8983
|
viewMode = "single",
|
|
8822
8984
|
onDocumentLoad,
|
|
8823
8985
|
onPageChange,
|
|
8824
8986
|
onScaleChange,
|
|
8825
8987
|
onError,
|
|
8826
8988
|
workerSrc,
|
|
8827
|
-
className
|
|
8989
|
+
className,
|
|
8990
|
+
onReady
|
|
8828
8991
|
}) {
|
|
8829
|
-
const { viewerStore } = usePDFViewerStores();
|
|
8830
|
-
const mountedRef = (0,
|
|
8831
|
-
const [, setLoadState] = (0,
|
|
8832
|
-
const onDocumentLoadRef = (0,
|
|
8833
|
-
const onErrorRef = (0,
|
|
8834
|
-
const onPageChangeRef = (0,
|
|
8835
|
-
const onScaleChangeRef = (0,
|
|
8992
|
+
const { viewerStore, annotationStore, searchStore } = usePDFViewerStores();
|
|
8993
|
+
const mountedRef = (0, import_react40.useRef)(true);
|
|
8994
|
+
const [, setLoadState] = (0, import_react40.useState)("idle");
|
|
8995
|
+
const onDocumentLoadRef = (0, import_react40.useRef)(onDocumentLoad);
|
|
8996
|
+
const onErrorRef = (0, import_react40.useRef)(onError);
|
|
8997
|
+
const onPageChangeRef = (0, import_react40.useRef)(onPageChange);
|
|
8998
|
+
const onScaleChangeRef = (0, import_react40.useRef)(onScaleChange);
|
|
8999
|
+
const onReadyRef = (0, import_react40.useRef)(onReady);
|
|
8836
9000
|
onDocumentLoadRef.current = onDocumentLoad;
|
|
8837
9001
|
onErrorRef.current = onError;
|
|
8838
9002
|
onPageChangeRef.current = onPageChange;
|
|
8839
9003
|
onScaleChangeRef.current = onScaleChange;
|
|
8840
|
-
|
|
9004
|
+
onReadyRef.current = onReady;
|
|
9005
|
+
const srcIdRef = (0, import_react40.useRef)(null);
|
|
8841
9006
|
const currentPage = useViewerStore((s) => s.currentPage);
|
|
8842
9007
|
const scale = useViewerStore((s) => s.scale);
|
|
8843
9008
|
const theme = useViewerStore((s) => s.theme);
|
|
@@ -8845,18 +9010,222 @@ var init_PDFViewerClient = __esm({
|
|
|
8845
9010
|
const error = useViewerStore((s) => s.error);
|
|
8846
9011
|
const sidebarOpen = useViewerStore((s) => s.sidebarOpen);
|
|
8847
9012
|
const srcId = getSrcIdentifier(src);
|
|
8848
|
-
const
|
|
9013
|
+
const handleRef = (0, import_react40.useRef)(null);
|
|
9014
|
+
(0, import_react40.useEffect)(() => {
|
|
9015
|
+
const handle = {
|
|
9016
|
+
// ==================== Text Highlighting ====================
|
|
9017
|
+
highlightText: async (text, options) => {
|
|
9018
|
+
const doc = viewerStore.getState().document;
|
|
9019
|
+
if (!doc) return [];
|
|
9020
|
+
const color = options?.color ?? "yellow";
|
|
9021
|
+
const targetPage = options?.page;
|
|
9022
|
+
const caseSensitive = options?.caseSensitive ?? false;
|
|
9023
|
+
const scrollTo = options?.scrollTo ?? true;
|
|
9024
|
+
const highlightIds = [];
|
|
9025
|
+
const searchText = caseSensitive ? text : text.toLowerCase();
|
|
9026
|
+
const pagesToSearch = targetPage ? [targetPage] : Array.from({ length: doc.numPages }, (_, i) => i + 1);
|
|
9027
|
+
for (const pageNum of pagesToSearch) {
|
|
9028
|
+
try {
|
|
9029
|
+
const page = await doc.getPage(pageNum);
|
|
9030
|
+
const textContent = await page.getTextContent();
|
|
9031
|
+
const viewport = page.getViewport({ scale: 1 });
|
|
9032
|
+
let fullText = "";
|
|
9033
|
+
const charPositions = [];
|
|
9034
|
+
for (const item of textContent.items) {
|
|
9035
|
+
if ("str" in item && item.str) {
|
|
9036
|
+
const tx = item.transform;
|
|
9037
|
+
const x = tx[4];
|
|
9038
|
+
const y = viewport.height - tx[5];
|
|
9039
|
+
const width = item.width ?? 0;
|
|
9040
|
+
const height = item.height ?? 12;
|
|
9041
|
+
const charWidth = item.str.length > 0 ? width / item.str.length : width;
|
|
9042
|
+
for (let i = 0; i < item.str.length; i++) {
|
|
9043
|
+
charPositions.push({
|
|
9044
|
+
char: item.str[i],
|
|
9045
|
+
rect: {
|
|
9046
|
+
x: x + i * charWidth,
|
|
9047
|
+
y: y - height,
|
|
9048
|
+
width: charWidth,
|
|
9049
|
+
height
|
|
9050
|
+
}
|
|
9051
|
+
});
|
|
9052
|
+
}
|
|
9053
|
+
fullText += item.str;
|
|
9054
|
+
}
|
|
9055
|
+
}
|
|
9056
|
+
const textToSearch = caseSensitive ? fullText : fullText.toLowerCase();
|
|
9057
|
+
let startIndex = 0;
|
|
9058
|
+
while (true) {
|
|
9059
|
+
const matchIndex = textToSearch.indexOf(searchText, startIndex);
|
|
9060
|
+
if (matchIndex === -1) break;
|
|
9061
|
+
const matchRects = [];
|
|
9062
|
+
for (let i = matchIndex; i < matchIndex + text.length && i < charPositions.length; i++) {
|
|
9063
|
+
matchRects.push(charPositions[i].rect);
|
|
9064
|
+
}
|
|
9065
|
+
const mergedRects = mergeRects2(matchRects);
|
|
9066
|
+
const highlight = annotationStore.getState().addHighlight({
|
|
9067
|
+
pageNumber: pageNum,
|
|
9068
|
+
rects: mergedRects,
|
|
9069
|
+
color,
|
|
9070
|
+
text: fullText.substring(matchIndex, matchIndex + text.length)
|
|
9071
|
+
});
|
|
9072
|
+
highlightIds.push(highlight.id);
|
|
9073
|
+
startIndex = matchIndex + 1;
|
|
9074
|
+
}
|
|
9075
|
+
} catch {
|
|
9076
|
+
}
|
|
9077
|
+
}
|
|
9078
|
+
if (scrollTo && highlightIds.length > 0) {
|
|
9079
|
+
const firstHighlight = annotationStore.getState().highlights.find((h) => h.id === highlightIds[0]);
|
|
9080
|
+
if (firstHighlight) {
|
|
9081
|
+
viewerStore.getState().goToPage(firstHighlight.pageNumber);
|
|
9082
|
+
}
|
|
9083
|
+
}
|
|
9084
|
+
return highlightIds;
|
|
9085
|
+
},
|
|
9086
|
+
removeHighlight: (id) => {
|
|
9087
|
+
annotationStore.getState().removeHighlight(id);
|
|
9088
|
+
},
|
|
9089
|
+
clearHighlights: () => {
|
|
9090
|
+
const highlights = annotationStore.getState().highlights;
|
|
9091
|
+
for (const h of highlights) {
|
|
9092
|
+
annotationStore.getState().removeHighlight(h.id);
|
|
9093
|
+
}
|
|
9094
|
+
},
|
|
9095
|
+
// ==================== Annotations ====================
|
|
9096
|
+
drawRect: (options) => {
|
|
9097
|
+
const annotation = annotationStore.getState().addAnnotation({
|
|
9098
|
+
type: "shape",
|
|
9099
|
+
shapeType: "rect",
|
|
9100
|
+
pageNumber: options.page,
|
|
9101
|
+
x: options.x,
|
|
9102
|
+
y: options.y,
|
|
9103
|
+
width: options.width,
|
|
9104
|
+
height: options.height,
|
|
9105
|
+
color: options.color ?? "blue",
|
|
9106
|
+
strokeWidth: options.strokeWidth ?? 2
|
|
9107
|
+
});
|
|
9108
|
+
return annotation.id;
|
|
9109
|
+
},
|
|
9110
|
+
drawCircle: (options) => {
|
|
9111
|
+
const annotation = annotationStore.getState().addAnnotation({
|
|
9112
|
+
type: "shape",
|
|
9113
|
+
shapeType: "circle",
|
|
9114
|
+
pageNumber: options.page,
|
|
9115
|
+
x: options.x,
|
|
9116
|
+
y: options.y,
|
|
9117
|
+
width: options.radius * 2,
|
|
9118
|
+
height: options.radius * 2,
|
|
9119
|
+
color: options.color ?? "blue",
|
|
9120
|
+
strokeWidth: options.strokeWidth ?? 2
|
|
9121
|
+
});
|
|
9122
|
+
return annotation.id;
|
|
9123
|
+
},
|
|
9124
|
+
addNote: (options) => {
|
|
9125
|
+
const annotation = annotationStore.getState().addAnnotation({
|
|
9126
|
+
type: "note",
|
|
9127
|
+
pageNumber: options.page,
|
|
9128
|
+
x: options.x,
|
|
9129
|
+
y: options.y,
|
|
9130
|
+
content: options.content,
|
|
9131
|
+
color: options.color ?? "yellow"
|
|
9132
|
+
});
|
|
9133
|
+
return annotation.id;
|
|
9134
|
+
},
|
|
9135
|
+
removeAnnotation: (id) => {
|
|
9136
|
+
annotationStore.getState().removeAnnotation(id);
|
|
9137
|
+
},
|
|
9138
|
+
clearAnnotations: () => {
|
|
9139
|
+
const annotations = annotationStore.getState().annotations;
|
|
9140
|
+
for (const a of annotations) {
|
|
9141
|
+
annotationStore.getState().removeAnnotation(a.id);
|
|
9142
|
+
}
|
|
9143
|
+
},
|
|
9144
|
+
// ==================== Navigation ====================
|
|
9145
|
+
goToPage: (page) => {
|
|
9146
|
+
viewerStore.getState().goToPage(page);
|
|
9147
|
+
},
|
|
9148
|
+
nextPage: () => {
|
|
9149
|
+
viewerStore.getState().nextPage();
|
|
9150
|
+
},
|
|
9151
|
+
previousPage: () => {
|
|
9152
|
+
viewerStore.getState().previousPage();
|
|
9153
|
+
},
|
|
9154
|
+
getCurrentPage: () => {
|
|
9155
|
+
return viewerStore.getState().currentPage;
|
|
9156
|
+
},
|
|
9157
|
+
getNumPages: () => {
|
|
9158
|
+
return viewerStore.getState().numPages;
|
|
9159
|
+
},
|
|
9160
|
+
// ==================== Zoom ====================
|
|
9161
|
+
setZoom: (scale2) => {
|
|
9162
|
+
viewerStore.getState().setScale(scale2);
|
|
9163
|
+
},
|
|
9164
|
+
getZoom: () => {
|
|
9165
|
+
return viewerStore.getState().scale;
|
|
9166
|
+
},
|
|
9167
|
+
zoomIn: () => {
|
|
9168
|
+
viewerStore.getState().zoomIn();
|
|
9169
|
+
},
|
|
9170
|
+
zoomOut: () => {
|
|
9171
|
+
viewerStore.getState().zoomOut();
|
|
9172
|
+
},
|
|
9173
|
+
// ==================== Search ====================
|
|
9174
|
+
search: async (query, options) => {
|
|
9175
|
+
const doc = viewerStore.getState().document;
|
|
9176
|
+
if (!doc) return [];
|
|
9177
|
+
searchStore.getState().setQuery(query);
|
|
9178
|
+
if (options?.caseSensitive !== void 0) {
|
|
9179
|
+
searchStore.getState().setCaseSensitive(options.caseSensitive);
|
|
9180
|
+
}
|
|
9181
|
+
if (options?.wholeWord !== void 0) {
|
|
9182
|
+
searchStore.getState().setWholeWord(options.wholeWord);
|
|
9183
|
+
}
|
|
9184
|
+
await searchStore.getState().search(doc);
|
|
9185
|
+
return searchStore.getState().results;
|
|
9186
|
+
},
|
|
9187
|
+
nextSearchResult: () => {
|
|
9188
|
+
searchStore.getState().nextResult();
|
|
9189
|
+
const results = searchStore.getState().results;
|
|
9190
|
+
const index = searchStore.getState().currentResultIndex;
|
|
9191
|
+
if (results[index]) {
|
|
9192
|
+
viewerStore.getState().goToPage(results[index].pageNumber);
|
|
9193
|
+
}
|
|
9194
|
+
},
|
|
9195
|
+
previousSearchResult: () => {
|
|
9196
|
+
searchStore.getState().previousResult();
|
|
9197
|
+
const results = searchStore.getState().results;
|
|
9198
|
+
const index = searchStore.getState().currentResultIndex;
|
|
9199
|
+
if (results[index]) {
|
|
9200
|
+
viewerStore.getState().goToPage(results[index].pageNumber);
|
|
9201
|
+
}
|
|
9202
|
+
},
|
|
9203
|
+
clearSearch: () => {
|
|
9204
|
+
searchStore.getState().clearSearch();
|
|
9205
|
+
},
|
|
9206
|
+
// ==================== Document ====================
|
|
9207
|
+
getDocument: () => {
|
|
9208
|
+
return viewerStore.getState().document;
|
|
9209
|
+
},
|
|
9210
|
+
isLoaded: () => {
|
|
9211
|
+
return viewerStore.getState().document !== null;
|
|
9212
|
+
}
|
|
9213
|
+
};
|
|
9214
|
+
handleRef.current = handle;
|
|
9215
|
+
onReadyRef.current?.(handle);
|
|
9216
|
+
}, [viewerStore, annotationStore, searchStore]);
|
|
9217
|
+
const handleRetry = (0, import_react40.useCallback)(() => {
|
|
8849
9218
|
srcIdRef.current = null;
|
|
8850
9219
|
viewerStore.getState().setError(null);
|
|
8851
9220
|
setLoadState("idle");
|
|
8852
9221
|
}, [viewerStore]);
|
|
8853
|
-
(0,
|
|
9222
|
+
(0, import_react40.useEffect)(() => {
|
|
8854
9223
|
mountedRef.current = true;
|
|
8855
9224
|
return () => {
|
|
8856
9225
|
mountedRef.current = false;
|
|
8857
9226
|
};
|
|
8858
9227
|
}, []);
|
|
8859
|
-
(0,
|
|
9228
|
+
(0, import_react40.useEffect)(() => {
|
|
8860
9229
|
if (srcIdRef.current === srcId && viewerStore.getState().document) {
|
|
8861
9230
|
return;
|
|
8862
9231
|
}
|
|
@@ -8883,8 +9252,12 @@ var init_PDFViewerClient = __esm({
|
|
|
8883
9252
|
if (initialPage !== 1) {
|
|
8884
9253
|
viewerStore.getState().goToPage(initialPage);
|
|
8885
9254
|
}
|
|
8886
|
-
if (typeof initialScale === "number"
|
|
9255
|
+
if (typeof initialScale === "number") {
|
|
8887
9256
|
viewerStore.getState().setScale(initialScale);
|
|
9257
|
+
} else if (initialScale === "auto" || initialScale === "page-width") {
|
|
9258
|
+
viewerStore.getState().setScale(1);
|
|
9259
|
+
} else if (initialScale === "page-fit") {
|
|
9260
|
+
viewerStore.getState().setScale(0.75);
|
|
8888
9261
|
}
|
|
8889
9262
|
onDocumentLoadRef.current?.({ document: document2, numPages });
|
|
8890
9263
|
} else {
|
|
@@ -8904,15 +9277,15 @@ var init_PDFViewerClient = __esm({
|
|
|
8904
9277
|
return () => {
|
|
8905
9278
|
};
|
|
8906
9279
|
}, [srcId, src, workerSrc, initialPage, initialScale, viewerStore]);
|
|
8907
|
-
const prevPageRef = (0,
|
|
8908
|
-
(0,
|
|
9280
|
+
const prevPageRef = (0, import_react40.useRef)(currentPage);
|
|
9281
|
+
(0, import_react40.useEffect)(() => {
|
|
8909
9282
|
if (prevPageRef.current !== currentPage) {
|
|
8910
9283
|
prevPageRef.current = currentPage;
|
|
8911
9284
|
onPageChangeRef.current?.(currentPage);
|
|
8912
9285
|
}
|
|
8913
9286
|
}, [currentPage]);
|
|
8914
|
-
const prevScaleRef = (0,
|
|
8915
|
-
(0,
|
|
9287
|
+
const prevScaleRef = (0, import_react40.useRef)(scale);
|
|
9288
|
+
(0, import_react40.useEffect)(() => {
|
|
8916
9289
|
if (prevScaleRef.current !== scale) {
|
|
8917
9290
|
prevScaleRef.current = scale;
|
|
8918
9291
|
onScaleChangeRef.current?.(scale);
|
|
@@ -8920,7 +9293,7 @@ var init_PDFViewerClient = __esm({
|
|
|
8920
9293
|
}, [scale]);
|
|
8921
9294
|
const themeClass = theme === "dark" ? "dark" : "";
|
|
8922
9295
|
if (error) {
|
|
8923
|
-
return /* @__PURE__ */ (0,
|
|
9296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8924
9297
|
"div",
|
|
8925
9298
|
{
|
|
8926
9299
|
className: cn(
|
|
@@ -8930,10 +9303,10 @@ var init_PDFViewerClient = __esm({
|
|
|
8930
9303
|
themeClass,
|
|
8931
9304
|
className
|
|
8932
9305
|
),
|
|
8933
|
-
children: /* @__PURE__ */ (0,
|
|
8934
|
-
/* @__PURE__ */ (0,
|
|
8935
|
-
/* @__PURE__ */ (0,
|
|
8936
|
-
/* @__PURE__ */ (0,
|
|
9306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-center p-8", children: [
|
|
9307
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
|
|
9308
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-gray-500 text-sm", children: error.message }),
|
|
9309
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
8937
9310
|
"button",
|
|
8938
9311
|
{
|
|
8939
9312
|
onClick: handleRetry,
|
|
@@ -8948,68 +9321,85 @@ var init_PDFViewerClient = __esm({
|
|
|
8948
9321
|
const renderContainer = () => {
|
|
8949
9322
|
switch (viewMode) {
|
|
8950
9323
|
case "continuous":
|
|
8951
|
-
return /* @__PURE__ */ (0,
|
|
9324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ContinuousScrollContainer, {});
|
|
8952
9325
|
case "dual":
|
|
8953
|
-
return /* @__PURE__ */ (0,
|
|
9326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DualPageContainer, {});
|
|
8954
9327
|
case "single":
|
|
8955
9328
|
default:
|
|
8956
|
-
return /* @__PURE__ */ (0,
|
|
9329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DocumentContainer, {});
|
|
8957
9330
|
}
|
|
8958
9331
|
};
|
|
8959
|
-
return /* @__PURE__ */ (0,
|
|
9332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
8960
9333
|
"div",
|
|
8961
9334
|
{
|
|
8962
9335
|
className: cn(
|
|
8963
9336
|
"pdf-viewer",
|
|
8964
|
-
"flex flex-col h-full",
|
|
9337
|
+
"flex flex-col h-full relative",
|
|
8965
9338
|
"bg-white dark:bg-gray-900",
|
|
8966
9339
|
"text-gray-900 dark:text-gray-100",
|
|
8967
9340
|
themeClass,
|
|
8968
9341
|
className
|
|
8969
9342
|
),
|
|
8970
9343
|
children: [
|
|
8971
|
-
showToolbar && /* @__PURE__ */ (0,
|
|
8972
|
-
showAnnotationToolbar && /* @__PURE__ */ (0,
|
|
8973
|
-
/* @__PURE__ */ (0,
|
|
8974
|
-
showSidebar && sidebarOpen && /* @__PURE__ */ (0,
|
|
9344
|
+
showToolbar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Toolbar, {}),
|
|
9345
|
+
showAnnotationToolbar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AnnotationToolbar, {}),
|
|
9346
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-1 overflow-hidden", children: [
|
|
9347
|
+
showSidebar && sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Sidebar, {}),
|
|
8975
9348
|
renderContainer()
|
|
8976
9349
|
] }),
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
/* @__PURE__ */ (0,
|
|
9350
|
+
showFloatingZoom && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FloatingZoomControls, { position: "bottom-right" }),
|
|
9351
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-white/80 dark:bg-gray-900/80", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
9352
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
|
|
9353
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF..." })
|
|
8980
9354
|
] }) })
|
|
8981
9355
|
]
|
|
8982
9356
|
}
|
|
8983
9357
|
);
|
|
8984
9358
|
});
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
{
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
9359
|
+
PDFViewerInnerWithRef = (0, import_react40.forwardRef)(
|
|
9360
|
+
function PDFViewerInnerWithRef2(props, ref) {
|
|
9361
|
+
const handleRef = (0, import_react40.useRef)(null);
|
|
9362
|
+
const handleReady = (0, import_react40.useCallback)((handle) => {
|
|
9363
|
+
handleRef.current = handle;
|
|
9364
|
+
if (typeof ref === "function") {
|
|
9365
|
+
ref(handle);
|
|
9366
|
+
} else if (ref) {
|
|
9367
|
+
ref.current = handle;
|
|
9368
|
+
}
|
|
9369
|
+
}, [ref]);
|
|
9370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PDFViewerInner, { ...props, onReady: handleReady });
|
|
9371
|
+
}
|
|
9372
|
+
);
|
|
9373
|
+
PDFViewerClient = (0, import_react40.memo)(
|
|
9374
|
+
(0, import_react40.forwardRef)(function PDFViewerClient2(props, ref) {
|
|
9375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
9376
|
+
PDFViewerProvider,
|
|
9377
|
+
{
|
|
9378
|
+
theme: props.theme,
|
|
9379
|
+
defaultSidebarPanel: props.defaultSidebarPanel,
|
|
9380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PDFViewerInnerWithRef, { ref, ...props })
|
|
9381
|
+
}
|
|
9382
|
+
);
|
|
9383
|
+
})
|
|
9384
|
+
);
|
|
8995
9385
|
}
|
|
8996
9386
|
});
|
|
8997
9387
|
|
|
8998
9388
|
// src/components/PDFViewer/PDFViewer.tsx
|
|
8999
|
-
var
|
|
9389
|
+
var import_react41, import_jsx_runtime27, PDFViewerClient3, PDFViewerLoading, PDFViewer;
|
|
9000
9390
|
var init_PDFViewer = __esm({
|
|
9001
9391
|
"src/components/PDFViewer/PDFViewer.tsx"() {
|
|
9002
9392
|
"use strict";
|
|
9003
|
-
|
|
9393
|
+
import_react41 = require("react");
|
|
9004
9394
|
init_utils();
|
|
9005
|
-
|
|
9006
|
-
PDFViewerClient3 = (0,
|
|
9395
|
+
import_jsx_runtime27 = require("react/jsx-runtime");
|
|
9396
|
+
PDFViewerClient3 = (0, import_react41.lazy)(
|
|
9007
9397
|
() => Promise.resolve().then(() => (init_PDFViewerClient(), PDFViewerClient_exports)).then((mod) => ({ default: mod.PDFViewerClient }))
|
|
9008
9398
|
);
|
|
9009
|
-
PDFViewerLoading = (0,
|
|
9399
|
+
PDFViewerLoading = (0, import_react41.memo)(function PDFViewerLoading2({
|
|
9010
9400
|
className
|
|
9011
9401
|
}) {
|
|
9012
|
-
return /* @__PURE__ */ (0,
|
|
9402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9013
9403
|
"div",
|
|
9014
9404
|
{
|
|
9015
9405
|
className: cn(
|
|
@@ -9018,18 +9408,18 @@ var init_PDFViewer = __esm({
|
|
|
9018
9408
|
"bg-white dark:bg-gray-900",
|
|
9019
9409
|
className
|
|
9020
9410
|
),
|
|
9021
|
-
children: /* @__PURE__ */ (0,
|
|
9022
|
-
/* @__PURE__ */ (0,
|
|
9023
|
-
/* @__PURE__ */ (0,
|
|
9411
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col items-center", children: [
|
|
9412
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
|
|
9413
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
|
|
9024
9414
|
] }) })
|
|
9025
9415
|
}
|
|
9026
9416
|
);
|
|
9027
9417
|
});
|
|
9028
|
-
PDFViewer = (0,
|
|
9418
|
+
PDFViewer = (0, import_react41.memo)(function PDFViewer2(props) {
|
|
9029
9419
|
if (typeof window === "undefined") {
|
|
9030
|
-
return /* @__PURE__ */ (0,
|
|
9420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerLoading, { className: props.className });
|
|
9031
9421
|
}
|
|
9032
|
-
return /* @__PURE__ */ (0,
|
|
9422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react41.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerClient3, { ...props }) });
|
|
9033
9423
|
});
|
|
9034
9424
|
}
|
|
9035
9425
|
});
|
|
@@ -9060,6 +9450,7 @@ __export(index_exports, {
|
|
|
9060
9450
|
DocumentContainer: () => DocumentContainer,
|
|
9061
9451
|
DrawingCanvas: () => DrawingCanvas,
|
|
9062
9452
|
DualPageContainer: () => DualPageContainer,
|
|
9453
|
+
FloatingZoomControls: () => FloatingZoomControls,
|
|
9063
9454
|
FocusRegionLayer: () => FocusRegionLayer,
|
|
9064
9455
|
HighlightLayer: () => HighlightLayer,
|
|
9065
9456
|
HighlightPopover: () => HighlightPopover,
|
|
@@ -9160,9 +9551,9 @@ init_HighlightPopover2();
|
|
|
9160
9551
|
init_AnnotationToolbar2();
|
|
9161
9552
|
|
|
9162
9553
|
// src/components/Annotations/StickyNote.tsx
|
|
9163
|
-
var
|
|
9554
|
+
var import_react42 = require("react");
|
|
9164
9555
|
init_utils();
|
|
9165
|
-
var
|
|
9556
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
9166
9557
|
var NOTE_COLORS = [
|
|
9167
9558
|
"#fef08a",
|
|
9168
9559
|
// yellow
|
|
@@ -9175,7 +9566,7 @@ var NOTE_COLORS = [
|
|
|
9175
9566
|
"#fed7aa"
|
|
9176
9567
|
// orange
|
|
9177
9568
|
];
|
|
9178
|
-
var StickyNote = (0,
|
|
9569
|
+
var StickyNote = (0, import_react42.memo)(function StickyNote2({
|
|
9179
9570
|
note,
|
|
9180
9571
|
scale,
|
|
9181
9572
|
isSelected,
|
|
@@ -9188,37 +9579,37 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9188
9579
|
onDragStart,
|
|
9189
9580
|
className
|
|
9190
9581
|
}) {
|
|
9191
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
9192
|
-
const [localContent, setLocalContent] = (0,
|
|
9193
|
-
const textareaRef = (0,
|
|
9194
|
-
const noteRef = (0,
|
|
9195
|
-
(0,
|
|
9582
|
+
const [isExpanded, setIsExpanded] = (0, import_react42.useState)(false);
|
|
9583
|
+
const [localContent, setLocalContent] = (0, import_react42.useState)(note.content);
|
|
9584
|
+
const textareaRef = (0, import_react42.useRef)(null);
|
|
9585
|
+
const noteRef = (0, import_react42.useRef)(null);
|
|
9586
|
+
(0, import_react42.useEffect)(() => {
|
|
9196
9587
|
setLocalContent(note.content);
|
|
9197
9588
|
}, [note.content]);
|
|
9198
|
-
(0,
|
|
9589
|
+
(0, import_react42.useEffect)(() => {
|
|
9199
9590
|
if (isEditing && textareaRef.current) {
|
|
9200
9591
|
textareaRef.current.focus();
|
|
9201
9592
|
textareaRef.current.select();
|
|
9202
9593
|
}
|
|
9203
9594
|
}, [isEditing]);
|
|
9204
|
-
const handleClick = (0,
|
|
9595
|
+
const handleClick = (0, import_react42.useCallback)((e) => {
|
|
9205
9596
|
e.stopPropagation();
|
|
9206
9597
|
onSelect?.();
|
|
9207
9598
|
if (!isExpanded) {
|
|
9208
9599
|
setIsExpanded(true);
|
|
9209
9600
|
}
|
|
9210
9601
|
}, [isExpanded, onSelect]);
|
|
9211
|
-
const handleDoubleClick = (0,
|
|
9602
|
+
const handleDoubleClick = (0, import_react42.useCallback)((e) => {
|
|
9212
9603
|
e.stopPropagation();
|
|
9213
9604
|
onStartEdit?.();
|
|
9214
9605
|
}, [onStartEdit]);
|
|
9215
|
-
const handleBlur = (0,
|
|
9606
|
+
const handleBlur = (0, import_react42.useCallback)(() => {
|
|
9216
9607
|
if (isEditing && localContent !== note.content) {
|
|
9217
9608
|
onUpdate?.({ content: localContent });
|
|
9218
9609
|
}
|
|
9219
9610
|
onEndEdit?.();
|
|
9220
9611
|
}, [isEditing, localContent, note.content, onUpdate, onEndEdit]);
|
|
9221
|
-
const handleKeyDown = (0,
|
|
9612
|
+
const handleKeyDown = (0, import_react42.useCallback)((e) => {
|
|
9222
9613
|
if (e.key === "Escape") {
|
|
9223
9614
|
setLocalContent(note.content);
|
|
9224
9615
|
onEndEdit?.();
|
|
@@ -9226,16 +9617,16 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9226
9617
|
handleBlur();
|
|
9227
9618
|
}
|
|
9228
9619
|
}, [note.content, onEndEdit, handleBlur]);
|
|
9229
|
-
const handleColorChange = (0,
|
|
9620
|
+
const handleColorChange = (0, import_react42.useCallback)((color) => {
|
|
9230
9621
|
onUpdate?.({ color });
|
|
9231
9622
|
}, [onUpdate]);
|
|
9232
|
-
const handleCollapse = (0,
|
|
9623
|
+
const handleCollapse = (0, import_react42.useCallback)((e) => {
|
|
9233
9624
|
e.stopPropagation();
|
|
9234
9625
|
setIsExpanded(false);
|
|
9235
9626
|
onEndEdit?.();
|
|
9236
9627
|
}, [onEndEdit]);
|
|
9237
9628
|
if (!isExpanded) {
|
|
9238
|
-
return /* @__PURE__ */ (0,
|
|
9629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9239
9630
|
"div",
|
|
9240
9631
|
{
|
|
9241
9632
|
ref: noteRef,
|
|
@@ -9256,14 +9647,14 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9256
9647
|
onMouseDown: onDragStart,
|
|
9257
9648
|
onTouchStart: onDragStart,
|
|
9258
9649
|
title: note.content || "Empty note",
|
|
9259
|
-
children: /* @__PURE__ */ (0,
|
|
9650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9260
9651
|
"svg",
|
|
9261
9652
|
{
|
|
9262
9653
|
className: "w-4 h-4 opacity-70",
|
|
9263
9654
|
fill: "currentColor",
|
|
9264
9655
|
viewBox: "0 0 20 20",
|
|
9265
9656
|
style: { color: "#333" },
|
|
9266
|
-
children: /* @__PURE__ */ (0,
|
|
9657
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9267
9658
|
"path",
|
|
9268
9659
|
{
|
|
9269
9660
|
fillRule: "evenodd",
|
|
@@ -9276,7 +9667,7 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9276
9667
|
}
|
|
9277
9668
|
);
|
|
9278
9669
|
}
|
|
9279
|
-
return /* @__PURE__ */ (0,
|
|
9670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
9280
9671
|
"div",
|
|
9281
9672
|
{
|
|
9282
9673
|
ref: noteRef,
|
|
@@ -9294,14 +9685,14 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9294
9685
|
},
|
|
9295
9686
|
onClick: handleClick,
|
|
9296
9687
|
children: [
|
|
9297
|
-
/* @__PURE__ */ (0,
|
|
9688
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
9298
9689
|
"div",
|
|
9299
9690
|
{
|
|
9300
9691
|
className: "flex items-center justify-between px-2 py-1 border-b border-black/10 cursor-move",
|
|
9301
9692
|
onMouseDown: onDragStart,
|
|
9302
9693
|
onTouchStart: onDragStart,
|
|
9303
9694
|
children: [
|
|
9304
|
-
/* @__PURE__ */ (0,
|
|
9695
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9305
9696
|
"button",
|
|
9306
9697
|
{
|
|
9307
9698
|
className: cn(
|
|
@@ -9318,8 +9709,8 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9318
9709
|
},
|
|
9319
9710
|
color
|
|
9320
9711
|
)) }),
|
|
9321
|
-
/* @__PURE__ */ (0,
|
|
9322
|
-
/* @__PURE__ */ (0,
|
|
9712
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
|
|
9713
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9323
9714
|
"button",
|
|
9324
9715
|
{
|
|
9325
9716
|
className: "p-0.5 hover:bg-black/10 rounded",
|
|
@@ -9328,23 +9719,23 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9328
9719
|
onDelete?.();
|
|
9329
9720
|
},
|
|
9330
9721
|
title: "Delete note",
|
|
9331
|
-
children: /* @__PURE__ */ (0,
|
|
9722
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) })
|
|
9332
9723
|
}
|
|
9333
9724
|
),
|
|
9334
|
-
/* @__PURE__ */ (0,
|
|
9725
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9335
9726
|
"button",
|
|
9336
9727
|
{
|
|
9337
9728
|
className: "p-0.5 hover:bg-black/10 rounded",
|
|
9338
9729
|
onClick: handleCollapse,
|
|
9339
9730
|
title: "Collapse note",
|
|
9340
|
-
children: /* @__PURE__ */ (0,
|
|
9731
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
|
|
9341
9732
|
}
|
|
9342
9733
|
)
|
|
9343
9734
|
] })
|
|
9344
9735
|
]
|
|
9345
9736
|
}
|
|
9346
9737
|
),
|
|
9347
|
-
/* @__PURE__ */ (0,
|
|
9738
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9348
9739
|
"textarea",
|
|
9349
9740
|
{
|
|
9350
9741
|
ref: textareaRef,
|
|
@@ -9359,7 +9750,7 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9359
9750
|
onKeyDown: handleKeyDown,
|
|
9360
9751
|
placeholder: "Enter note..."
|
|
9361
9752
|
}
|
|
9362
|
-
) : /* @__PURE__ */ (0,
|
|
9753
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
9363
9754
|
"div",
|
|
9364
9755
|
{
|
|
9365
9756
|
className: cn(
|
|
@@ -9370,16 +9761,16 @@ var StickyNote = (0, import_react41.memo)(function StickyNote2({
|
|
|
9370
9761
|
children: note.content || "Double-click to edit..."
|
|
9371
9762
|
}
|
|
9372
9763
|
) }),
|
|
9373
|
-
/* @__PURE__ */ (0,
|
|
9764
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
|
|
9374
9765
|
]
|
|
9375
9766
|
}
|
|
9376
9767
|
);
|
|
9377
9768
|
});
|
|
9378
9769
|
|
|
9379
9770
|
// src/components/Annotations/DrawingCanvas.tsx
|
|
9380
|
-
var
|
|
9771
|
+
var import_react43 = require("react");
|
|
9381
9772
|
init_utils();
|
|
9382
|
-
var
|
|
9773
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
9383
9774
|
function pointsToSvgPath(points) {
|
|
9384
9775
|
if (points.length === 0) return "";
|
|
9385
9776
|
if (points.length === 1) {
|
|
@@ -9417,7 +9808,7 @@ function simplifyPath(points, tolerance = 1) {
|
|
|
9417
9808
|
result.push(points[points.length - 1]);
|
|
9418
9809
|
return result;
|
|
9419
9810
|
}
|
|
9420
|
-
var DrawingCanvas = (0,
|
|
9811
|
+
var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
|
|
9421
9812
|
width,
|
|
9422
9813
|
height,
|
|
9423
9814
|
scale,
|
|
@@ -9427,10 +9818,10 @@ var DrawingCanvas = (0, import_react42.memo)(function DrawingCanvas2({
|
|
|
9427
9818
|
onDrawingComplete,
|
|
9428
9819
|
className
|
|
9429
9820
|
}) {
|
|
9430
|
-
const svgRef = (0,
|
|
9431
|
-
const [isDrawing, setIsDrawing] = (0,
|
|
9432
|
-
const [currentPath, setCurrentPath] = (0,
|
|
9433
|
-
const getPoint = (0,
|
|
9821
|
+
const svgRef = (0, import_react43.useRef)(null);
|
|
9822
|
+
const [isDrawing, setIsDrawing] = (0, import_react43.useState)(false);
|
|
9823
|
+
const [currentPath, setCurrentPath] = (0, import_react43.useState)([]);
|
|
9824
|
+
const getPoint = (0, import_react43.useCallback)((e) => {
|
|
9434
9825
|
if (!svgRef.current) return null;
|
|
9435
9826
|
const svg = svgRef.current;
|
|
9436
9827
|
const rect = svg.getBoundingClientRect();
|
|
@@ -9450,7 +9841,7 @@ var DrawingCanvas = (0, import_react42.memo)(function DrawingCanvas2({
|
|
|
9450
9841
|
y: (clientY - rect.top) / scale
|
|
9451
9842
|
};
|
|
9452
9843
|
}, [scale]);
|
|
9453
|
-
const handleStart = (0,
|
|
9844
|
+
const handleStart = (0, import_react43.useCallback)((e) => {
|
|
9454
9845
|
if (!isActive) return;
|
|
9455
9846
|
const point = getPoint(e);
|
|
9456
9847
|
if (point) {
|
|
@@ -9458,14 +9849,14 @@ var DrawingCanvas = (0, import_react42.memo)(function DrawingCanvas2({
|
|
|
9458
9849
|
setCurrentPath([point]);
|
|
9459
9850
|
}
|
|
9460
9851
|
}, [isActive, getPoint]);
|
|
9461
|
-
const handleMove = (0,
|
|
9852
|
+
const handleMove = (0, import_react43.useCallback)((e) => {
|
|
9462
9853
|
if (!isDrawing || !isActive) return;
|
|
9463
9854
|
const point = getPoint(e);
|
|
9464
9855
|
if (point) {
|
|
9465
9856
|
setCurrentPath((prev) => [...prev, point]);
|
|
9466
9857
|
}
|
|
9467
9858
|
}, [isDrawing, isActive, getPoint]);
|
|
9468
|
-
const handleEnd = (0,
|
|
9859
|
+
const handleEnd = (0, import_react43.useCallback)(() => {
|
|
9469
9860
|
if (!isDrawing) return;
|
|
9470
9861
|
setIsDrawing(false);
|
|
9471
9862
|
if (currentPath.length >= 2) {
|
|
@@ -9474,7 +9865,7 @@ var DrawingCanvas = (0, import_react42.memo)(function DrawingCanvas2({
|
|
|
9474
9865
|
}
|
|
9475
9866
|
setCurrentPath([]);
|
|
9476
9867
|
}, [isDrawing, currentPath, onDrawingComplete]);
|
|
9477
|
-
return /* @__PURE__ */ (0,
|
|
9868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
9478
9869
|
"svg",
|
|
9479
9870
|
{
|
|
9480
9871
|
ref: svgRef,
|
|
@@ -9494,7 +9885,7 @@ var DrawingCanvas = (0, import_react42.memo)(function DrawingCanvas2({
|
|
|
9494
9885
|
onTouchStart: handleStart,
|
|
9495
9886
|
onTouchMove: handleMove,
|
|
9496
9887
|
onTouchEnd: handleEnd,
|
|
9497
|
-
children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0,
|
|
9888
|
+
children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
9498
9889
|
"path",
|
|
9499
9890
|
{
|
|
9500
9891
|
d: pointsToSvgPath(currentPath),
|
|
@@ -9511,10 +9902,10 @@ var DrawingCanvas = (0, import_react42.memo)(function DrawingCanvas2({
|
|
|
9511
9902
|
});
|
|
9512
9903
|
|
|
9513
9904
|
// src/components/Annotations/ShapeRenderer.tsx
|
|
9514
|
-
var
|
|
9905
|
+
var import_react44 = require("react");
|
|
9515
9906
|
init_utils();
|
|
9516
|
-
var
|
|
9517
|
-
var ShapeRenderer = (0,
|
|
9907
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
9908
|
+
var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
|
|
9518
9909
|
shape,
|
|
9519
9910
|
scale,
|
|
9520
9911
|
isSelected,
|
|
@@ -9524,18 +9915,18 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9524
9915
|
onDelete: _onDelete,
|
|
9525
9916
|
className
|
|
9526
9917
|
}) {
|
|
9527
|
-
const [_isDragging, setIsDragging] = (0,
|
|
9528
|
-
const [_isResizing, setIsResizing] = (0,
|
|
9529
|
-
const [activeHandle, setActiveHandle] = (0,
|
|
9530
|
-
const startPosRef = (0,
|
|
9531
|
-
const startShapeRef = (0,
|
|
9918
|
+
const [_isDragging, setIsDragging] = (0, import_react44.useState)(false);
|
|
9919
|
+
const [_isResizing, setIsResizing] = (0, import_react44.useState)(false);
|
|
9920
|
+
const [activeHandle, setActiveHandle] = (0, import_react44.useState)(null);
|
|
9921
|
+
const startPosRef = (0, import_react44.useRef)({ x: 0, y: 0 });
|
|
9922
|
+
const startShapeRef = (0, import_react44.useRef)({ x: 0, y: 0, width: 0, height: 0 });
|
|
9532
9923
|
const { shapeType, x, y, width, height, color, strokeWidth, id: _id } = shape;
|
|
9533
9924
|
const scaledX = x * scale;
|
|
9534
9925
|
const scaledY = y * scale;
|
|
9535
9926
|
const scaledWidth = width * scale;
|
|
9536
9927
|
const scaledHeight = height * scale;
|
|
9537
9928
|
const scaledStroke = strokeWidth * scale;
|
|
9538
|
-
const getResizeHandles = (0,
|
|
9929
|
+
const getResizeHandles = (0, import_react44.useCallback)(() => {
|
|
9539
9930
|
const handleSize = 8;
|
|
9540
9931
|
const half = handleSize / 2;
|
|
9541
9932
|
return [
|
|
@@ -9549,7 +9940,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9549
9940
|
{ position: "w", cursor: "ew-resize", x: scaledX - half, y: scaledY + scaledHeight / 2 - half }
|
|
9550
9941
|
];
|
|
9551
9942
|
}, [scaledX, scaledY, scaledWidth, scaledHeight]);
|
|
9552
|
-
const handleMouseDown = (0,
|
|
9943
|
+
const handleMouseDown = (0, import_react44.useCallback)((e, handle) => {
|
|
9553
9944
|
e.stopPropagation();
|
|
9554
9945
|
onSelect?.();
|
|
9555
9946
|
if (!isEditing) return;
|
|
@@ -9625,7 +10016,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9625
10016
|
document.addEventListener("mousemove", handleMouseMove);
|
|
9626
10017
|
document.addEventListener("mouseup", handleMouseUp);
|
|
9627
10018
|
}, [isEditing, x, y, width, height, scale, onSelect, onUpdate]);
|
|
9628
|
-
const renderShape2 = (0,
|
|
10019
|
+
const renderShape2 = (0, import_react44.useCallback)(() => {
|
|
9629
10020
|
const commonProps = {
|
|
9630
10021
|
stroke: color,
|
|
9631
10022
|
strokeWidth: scaledStroke,
|
|
@@ -9637,7 +10028,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9637
10028
|
};
|
|
9638
10029
|
switch (shapeType) {
|
|
9639
10030
|
case "rect":
|
|
9640
|
-
return /* @__PURE__ */ (0,
|
|
10031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9641
10032
|
"rect",
|
|
9642
10033
|
{
|
|
9643
10034
|
x: scaledX,
|
|
@@ -9648,7 +10039,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9648
10039
|
}
|
|
9649
10040
|
);
|
|
9650
10041
|
case "circle":
|
|
9651
|
-
return /* @__PURE__ */ (0,
|
|
10042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9652
10043
|
"ellipse",
|
|
9653
10044
|
{
|
|
9654
10045
|
cx: scaledX + scaledWidth / 2,
|
|
@@ -9659,7 +10050,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9659
10050
|
}
|
|
9660
10051
|
);
|
|
9661
10052
|
case "line":
|
|
9662
|
-
return /* @__PURE__ */ (0,
|
|
10053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9663
10054
|
"line",
|
|
9664
10055
|
{
|
|
9665
10056
|
x1: scaledX,
|
|
@@ -9679,22 +10070,22 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9679
10070
|
const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
|
|
9680
10071
|
const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
|
|
9681
10072
|
const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
|
|
9682
|
-
return /* @__PURE__ */ (0,
|
|
9683
|
-
/* @__PURE__ */ (0,
|
|
9684
|
-
/* @__PURE__ */ (0,
|
|
9685
|
-
/* @__PURE__ */ (0,
|
|
10073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
|
|
10074
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
|
|
10075
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
|
|
10076
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
|
|
9686
10077
|
] });
|
|
9687
10078
|
default:
|
|
9688
10079
|
return null;
|
|
9689
10080
|
}
|
|
9690
10081
|
}, [shapeType, scaledX, scaledY, scaledWidth, scaledHeight, color, scaledStroke, isSelected]);
|
|
9691
|
-
return /* @__PURE__ */ (0,
|
|
10082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
9692
10083
|
"g",
|
|
9693
10084
|
{
|
|
9694
10085
|
className: cn("shape-renderer", className),
|
|
9695
10086
|
onMouseDown: (e) => handleMouseDown(e),
|
|
9696
10087
|
children: [
|
|
9697
|
-
/* @__PURE__ */ (0,
|
|
10088
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9698
10089
|
"rect",
|
|
9699
10090
|
{
|
|
9700
10091
|
x: scaledX - 5,
|
|
@@ -9707,7 +10098,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9707
10098
|
}
|
|
9708
10099
|
),
|
|
9709
10100
|
renderShape2(),
|
|
9710
|
-
isSelected && /* @__PURE__ */ (0,
|
|
10101
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9711
10102
|
"rect",
|
|
9712
10103
|
{
|
|
9713
10104
|
x: scaledX - 2,
|
|
@@ -9720,7 +10111,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9720
10111
|
strokeDasharray: "4 2"
|
|
9721
10112
|
}
|
|
9722
10113
|
),
|
|
9723
|
-
isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0,
|
|
10114
|
+
isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9724
10115
|
"rect",
|
|
9725
10116
|
{
|
|
9726
10117
|
x: handle.x,
|
|
@@ -9740,7 +10131,7 @@ var ShapeRenderer = (0, import_react43.memo)(function ShapeRenderer2({
|
|
|
9740
10131
|
}
|
|
9741
10132
|
);
|
|
9742
10133
|
});
|
|
9743
|
-
var ShapePreview = (0,
|
|
10134
|
+
var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
|
|
9744
10135
|
shapeType,
|
|
9745
10136
|
startPoint,
|
|
9746
10137
|
endPoint,
|
|
@@ -9761,9 +10152,9 @@ var ShapePreview = (0, import_react43.memo)(function ShapePreview2({
|
|
|
9761
10152
|
};
|
|
9762
10153
|
switch (shapeType) {
|
|
9763
10154
|
case "rect":
|
|
9764
|
-
return /* @__PURE__ */ (0,
|
|
10155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("rect", { x, y, width, height, ...commonProps });
|
|
9765
10156
|
case "circle":
|
|
9766
|
-
return /* @__PURE__ */ (0,
|
|
10157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9767
10158
|
"ellipse",
|
|
9768
10159
|
{
|
|
9769
10160
|
cx: x + width / 2,
|
|
@@ -9774,7 +10165,7 @@ var ShapePreview = (0, import_react43.memo)(function ShapePreview2({
|
|
|
9774
10165
|
}
|
|
9775
10166
|
);
|
|
9776
10167
|
case "line":
|
|
9777
|
-
return /* @__PURE__ */ (0,
|
|
10168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9778
10169
|
"line",
|
|
9779
10170
|
{
|
|
9780
10171
|
x1: startPoint.x * scale,
|
|
@@ -9796,8 +10187,8 @@ var ShapePreview = (0, import_react43.memo)(function ShapePreview2({
|
|
|
9796
10187
|
const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
|
|
9797
10188
|
const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
|
|
9798
10189
|
const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
|
|
9799
|
-
return /* @__PURE__ */ (0,
|
|
9800
|
-
/* @__PURE__ */ (0,
|
|
10190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
|
|
10191
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
9801
10192
|
"line",
|
|
9802
10193
|
{
|
|
9803
10194
|
x1: startPoint.x * scale,
|
|
@@ -9807,8 +10198,8 @@ var ShapePreview = (0, import_react43.memo)(function ShapePreview2({
|
|
|
9807
10198
|
...commonProps
|
|
9808
10199
|
}
|
|
9809
10200
|
),
|
|
9810
|
-
/* @__PURE__ */ (0,
|
|
9811
|
-
/* @__PURE__ */ (0,
|
|
10201
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
|
|
10202
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
|
|
9812
10203
|
] });
|
|
9813
10204
|
default:
|
|
9814
10205
|
return null;
|
|
@@ -9816,10 +10207,10 @@ var ShapePreview = (0, import_react43.memo)(function ShapePreview2({
|
|
|
9816
10207
|
});
|
|
9817
10208
|
|
|
9818
10209
|
// src/components/Annotations/QuickNoteButton.tsx
|
|
9819
|
-
var
|
|
10210
|
+
var import_react45 = require("react");
|
|
9820
10211
|
init_utils();
|
|
9821
|
-
var
|
|
9822
|
-
var QuickNoteButton = (0,
|
|
10212
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
10213
|
+
var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
|
|
9823
10214
|
pageNumber,
|
|
9824
10215
|
scale,
|
|
9825
10216
|
position = "top-right",
|
|
@@ -9827,8 +10218,8 @@ var QuickNoteButton = (0, import_react44.memo)(function QuickNoteButton2({
|
|
|
9827
10218
|
className,
|
|
9828
10219
|
visible = true
|
|
9829
10220
|
}) {
|
|
9830
|
-
const [isHovered, setIsHovered] = (0,
|
|
9831
|
-
const handleClick = (0,
|
|
10221
|
+
const [isHovered, setIsHovered] = (0, import_react45.useState)(false);
|
|
10222
|
+
const handleClick = (0, import_react45.useCallback)(
|
|
9832
10223
|
(e) => {
|
|
9833
10224
|
e.stopPropagation();
|
|
9834
10225
|
const x = position === "top-right" ? 80 : 80;
|
|
@@ -9840,7 +10231,7 @@ var QuickNoteButton = (0, import_react44.memo)(function QuickNoteButton2({
|
|
|
9840
10231
|
if (!visible) {
|
|
9841
10232
|
return null;
|
|
9842
10233
|
}
|
|
9843
|
-
return /* @__PURE__ */ (0,
|
|
10234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
9844
10235
|
"button",
|
|
9845
10236
|
{
|
|
9846
10237
|
onClick: handleClick,
|
|
@@ -9862,7 +10253,7 @@ var QuickNoteButton = (0, import_react44.memo)(function QuickNoteButton2({
|
|
|
9862
10253
|
),
|
|
9863
10254
|
title: "Add quick note",
|
|
9864
10255
|
"aria-label": "Add quick note",
|
|
9865
|
-
children: /* @__PURE__ */ (0,
|
|
10256
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
9866
10257
|
"svg",
|
|
9867
10258
|
{
|
|
9868
10259
|
className: "w-4 h-4 text-yellow-900",
|
|
@@ -9870,7 +10261,7 @@ var QuickNoteButton = (0, import_react44.memo)(function QuickNoteButton2({
|
|
|
9870
10261
|
viewBox: "0 0 24 24",
|
|
9871
10262
|
stroke: "currentColor",
|
|
9872
10263
|
strokeWidth: 2,
|
|
9873
|
-
children: /* @__PURE__ */ (0,
|
|
10264
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
|
|
9874
10265
|
}
|
|
9875
10266
|
)
|
|
9876
10267
|
}
|
|
@@ -9878,10 +10269,10 @@ var QuickNoteButton = (0, import_react44.memo)(function QuickNoteButton2({
|
|
|
9878
10269
|
});
|
|
9879
10270
|
|
|
9880
10271
|
// src/components/Annotations/QuickNotePopover.tsx
|
|
9881
|
-
var
|
|
10272
|
+
var import_react46 = require("react");
|
|
9882
10273
|
init_utils();
|
|
9883
|
-
var
|
|
9884
|
-
var QuickNotePopover = (0,
|
|
10274
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
10275
|
+
var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
|
|
9885
10276
|
visible,
|
|
9886
10277
|
position,
|
|
9887
10278
|
initialContent = "",
|
|
@@ -9890,21 +10281,21 @@ var QuickNotePopover = (0, import_react45.memo)(function QuickNotePopover2({
|
|
|
9890
10281
|
onCancel,
|
|
9891
10282
|
className
|
|
9892
10283
|
}) {
|
|
9893
|
-
const [content, setContent] = (0,
|
|
9894
|
-
const textareaRef = (0,
|
|
9895
|
-
const popoverRef = (0,
|
|
9896
|
-
const [adjustedPosition, setAdjustedPosition] = (0,
|
|
9897
|
-
(0,
|
|
10284
|
+
const [content, setContent] = (0, import_react46.useState)(initialContent);
|
|
10285
|
+
const textareaRef = (0, import_react46.useRef)(null);
|
|
10286
|
+
const popoverRef = (0, import_react46.useRef)(null);
|
|
10287
|
+
const [adjustedPosition, setAdjustedPosition] = (0, import_react46.useState)(position);
|
|
10288
|
+
(0, import_react46.useEffect)(() => {
|
|
9898
10289
|
if (visible && textareaRef.current) {
|
|
9899
10290
|
textareaRef.current.focus();
|
|
9900
10291
|
}
|
|
9901
10292
|
}, [visible]);
|
|
9902
|
-
(0,
|
|
10293
|
+
(0, import_react46.useEffect)(() => {
|
|
9903
10294
|
if (visible) {
|
|
9904
10295
|
setContent(initialContent);
|
|
9905
10296
|
}
|
|
9906
10297
|
}, [visible, initialContent]);
|
|
9907
|
-
(0,
|
|
10298
|
+
(0, import_react46.useEffect)(() => {
|
|
9908
10299
|
if (!visible || !popoverRef.current) return;
|
|
9909
10300
|
const rect = popoverRef.current.getBoundingClientRect();
|
|
9910
10301
|
const padding = 10;
|
|
@@ -9923,14 +10314,14 @@ var QuickNotePopover = (0, import_react45.memo)(function QuickNotePopover2({
|
|
|
9923
10314
|
}
|
|
9924
10315
|
setAdjustedPosition({ x, y });
|
|
9925
10316
|
}, [position, visible]);
|
|
9926
|
-
const handleSave = (0,
|
|
10317
|
+
const handleSave = (0, import_react46.useCallback)(() => {
|
|
9927
10318
|
if (content.trim()) {
|
|
9928
10319
|
onSave(content.trim());
|
|
9929
10320
|
} else {
|
|
9930
10321
|
onCancel();
|
|
9931
10322
|
}
|
|
9932
10323
|
}, [content, onSave, onCancel]);
|
|
9933
|
-
const handleKeyDown = (0,
|
|
10324
|
+
const handleKeyDown = (0, import_react46.useCallback)(
|
|
9934
10325
|
(e) => {
|
|
9935
10326
|
if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
|
|
9936
10327
|
e.preventDefault();
|
|
@@ -9945,7 +10336,7 @@ var QuickNotePopover = (0, import_react45.memo)(function QuickNotePopover2({
|
|
|
9945
10336
|
if (!visible) {
|
|
9946
10337
|
return null;
|
|
9947
10338
|
}
|
|
9948
|
-
return /* @__PURE__ */ (0,
|
|
10339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
9949
10340
|
"div",
|
|
9950
10341
|
{
|
|
9951
10342
|
ref: popoverRef,
|
|
@@ -9964,15 +10355,15 @@ var QuickNotePopover = (0, import_react45.memo)(function QuickNotePopover2({
|
|
|
9964
10355
|
top: adjustedPosition.y
|
|
9965
10356
|
},
|
|
9966
10357
|
children: [
|
|
9967
|
-
agentLastStatement && /* @__PURE__ */ (0,
|
|
9968
|
-
/* @__PURE__ */ (0,
|
|
9969
|
-
/* @__PURE__ */ (0,
|
|
10358
|
+
agentLastStatement && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mb-2 p-2 bg-blue-50 dark:bg-blue-900/50 rounded text-xs text-blue-600 dark:text-blue-300 border border-blue-100 dark:border-blue-800", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-start gap-1", children: [
|
|
10359
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }),
|
|
10360
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "line-clamp-2", children: [
|
|
9970
10361
|
"AI discussed: \u201C",
|
|
9971
10362
|
agentLastStatement,
|
|
9972
10363
|
"\u201D"
|
|
9973
10364
|
] })
|
|
9974
10365
|
] }) }),
|
|
9975
|
-
/* @__PURE__ */ (0,
|
|
10366
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
9976
10367
|
"textarea",
|
|
9977
10368
|
{
|
|
9978
10369
|
ref: textareaRef,
|
|
@@ -9991,13 +10382,13 @@ var QuickNotePopover = (0, import_react45.memo)(function QuickNotePopover2({
|
|
|
9991
10382
|
)
|
|
9992
10383
|
}
|
|
9993
10384
|
),
|
|
9994
|
-
/* @__PURE__ */ (0,
|
|
9995
|
-
/* @__PURE__ */ (0,
|
|
10385
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between mt-2", children: [
|
|
10386
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
|
|
9996
10387
|
navigator.platform.includes("Mac") ? "\u2318" : "Ctrl",
|
|
9997
10388
|
"+Enter to save"
|
|
9998
10389
|
] }),
|
|
9999
|
-
/* @__PURE__ */ (0,
|
|
10000
|
-
/* @__PURE__ */ (0,
|
|
10390
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
|
|
10391
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
10001
10392
|
"button",
|
|
10002
10393
|
{
|
|
10003
10394
|
onClick: onCancel,
|
|
@@ -10010,7 +10401,7 @@ var QuickNotePopover = (0, import_react45.memo)(function QuickNotePopover2({
|
|
|
10010
10401
|
children: "Cancel"
|
|
10011
10402
|
}
|
|
10012
10403
|
),
|
|
10013
|
-
/* @__PURE__ */ (0,
|
|
10404
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
10014
10405
|
"button",
|
|
10015
10406
|
{
|
|
10016
10407
|
onClick: handleSave,
|
|
@@ -10033,10 +10424,10 @@ var QuickNotePopover = (0, import_react45.memo)(function QuickNotePopover2({
|
|
|
10033
10424
|
});
|
|
10034
10425
|
|
|
10035
10426
|
// src/components/AskAbout/AskAboutOverlay.tsx
|
|
10036
|
-
var
|
|
10427
|
+
var import_react47 = require("react");
|
|
10037
10428
|
init_utils();
|
|
10038
|
-
var
|
|
10039
|
-
var AskAboutOverlay = (0,
|
|
10429
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
10430
|
+
var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
|
|
10040
10431
|
visible,
|
|
10041
10432
|
progress,
|
|
10042
10433
|
position,
|
|
@@ -10050,7 +10441,7 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10050
10441
|
const radius = (size - strokeWidth) / 2;
|
|
10051
10442
|
const circumference = 2 * Math.PI * radius;
|
|
10052
10443
|
const strokeDashoffset = circumference * (1 - progress);
|
|
10053
|
-
return /* @__PURE__ */ (0,
|
|
10444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
10054
10445
|
"div",
|
|
10055
10446
|
{
|
|
10056
10447
|
className: cn(
|
|
@@ -10063,7 +10454,7 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10063
10454
|
top: position.y - size / 2
|
|
10064
10455
|
},
|
|
10065
10456
|
children: [
|
|
10066
|
-
/* @__PURE__ */ (0,
|
|
10457
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
10067
10458
|
"svg",
|
|
10068
10459
|
{
|
|
10069
10460
|
width: size,
|
|
@@ -10071,7 +10462,7 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10071
10462
|
viewBox: `0 0 ${size} ${size}`,
|
|
10072
10463
|
className: "transform -rotate-90",
|
|
10073
10464
|
children: [
|
|
10074
|
-
/* @__PURE__ */ (0,
|
|
10465
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10075
10466
|
"circle",
|
|
10076
10467
|
{
|
|
10077
10468
|
cx: size / 2,
|
|
@@ -10082,7 +10473,7 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10082
10473
|
strokeWidth
|
|
10083
10474
|
}
|
|
10084
10475
|
),
|
|
10085
|
-
/* @__PURE__ */ (0,
|
|
10476
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10086
10477
|
"circle",
|
|
10087
10478
|
{
|
|
10088
10479
|
cx: size / 2,
|
|
@@ -10100,12 +10491,12 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10100
10491
|
]
|
|
10101
10492
|
}
|
|
10102
10493
|
),
|
|
10103
|
-
/* @__PURE__ */ (0,
|
|
10494
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10104
10495
|
"div",
|
|
10105
10496
|
{
|
|
10106
10497
|
className: "absolute inset-0 flex items-center justify-center",
|
|
10107
10498
|
style: { color: progress >= 1 ? "#22c55e" : "white" },
|
|
10108
|
-
children: progress >= 1 ? /* @__PURE__ */ (0,
|
|
10499
|
+
children: progress >= 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
10109
10500
|
"svg",
|
|
10110
10501
|
{
|
|
10111
10502
|
width: "24",
|
|
@@ -10116,9 +10507,9 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10116
10507
|
strokeWidth: "2",
|
|
10117
10508
|
strokeLinecap: "round",
|
|
10118
10509
|
strokeLinejoin: "round",
|
|
10119
|
-
children: /* @__PURE__ */ (0,
|
|
10510
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polyline", { points: "20 6 9 17 4 12" })
|
|
10120
10511
|
}
|
|
10121
|
-
) : /* @__PURE__ */ (0,
|
|
10512
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
10122
10513
|
"svg",
|
|
10123
10514
|
{
|
|
10124
10515
|
width: "20",
|
|
@@ -10130,9 +10521,9 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10130
10521
|
strokeLinecap: "round",
|
|
10131
10522
|
strokeLinejoin: "round",
|
|
10132
10523
|
children: [
|
|
10133
|
-
/* @__PURE__ */ (0,
|
|
10134
|
-
/* @__PURE__ */ (0,
|
|
10135
|
-
/* @__PURE__ */ (0,
|
|
10524
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
10525
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
10526
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
10136
10527
|
]
|
|
10137
10528
|
}
|
|
10138
10529
|
)
|
|
@@ -10144,10 +10535,10 @@ var AskAboutOverlay = (0, import_react46.memo)(function AskAboutOverlay2({
|
|
|
10144
10535
|
});
|
|
10145
10536
|
|
|
10146
10537
|
// src/components/AskAbout/AskAboutTrigger.tsx
|
|
10147
|
-
var
|
|
10538
|
+
var import_react48 = require("react");
|
|
10148
10539
|
init_utils();
|
|
10149
|
-
var
|
|
10150
|
-
var AskAboutTrigger = (0,
|
|
10540
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
10541
|
+
var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
|
|
10151
10542
|
position,
|
|
10152
10543
|
onConfirm,
|
|
10153
10544
|
onCancel,
|
|
@@ -10155,9 +10546,9 @@ var AskAboutTrigger = (0, import_react47.memo)(function AskAboutTrigger2({
|
|
|
10155
10546
|
autoHideDelay = 5e3,
|
|
10156
10547
|
className
|
|
10157
10548
|
}) {
|
|
10158
|
-
const [adjustedPosition, setAdjustedPosition] = (0,
|
|
10159
|
-
const triggerRef = (0,
|
|
10160
|
-
(0,
|
|
10549
|
+
const [adjustedPosition, setAdjustedPosition] = (0, import_react48.useState)(position);
|
|
10550
|
+
const triggerRef = (0, import_react48.useRef)(null);
|
|
10551
|
+
(0, import_react48.useEffect)(() => {
|
|
10161
10552
|
if (!visible || !triggerRef.current) return;
|
|
10162
10553
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
10163
10554
|
const padding = 10;
|
|
@@ -10173,19 +10564,19 @@ var AskAboutTrigger = (0, import_react47.memo)(function AskAboutTrigger2({
|
|
|
10173
10564
|
}
|
|
10174
10565
|
setAdjustedPosition({ x, y });
|
|
10175
10566
|
}, [position, visible]);
|
|
10176
|
-
(0,
|
|
10567
|
+
(0, import_react48.useEffect)(() => {
|
|
10177
10568
|
if (!visible || autoHideDelay === 0) return;
|
|
10178
10569
|
const timer = setTimeout(onCancel, autoHideDelay);
|
|
10179
10570
|
return () => clearTimeout(timer);
|
|
10180
10571
|
}, [visible, autoHideDelay, onCancel]);
|
|
10181
|
-
const handleConfirm = (0,
|
|
10572
|
+
const handleConfirm = (0, import_react48.useCallback)(
|
|
10182
10573
|
(e) => {
|
|
10183
10574
|
e.stopPropagation();
|
|
10184
10575
|
onConfirm();
|
|
10185
10576
|
},
|
|
10186
10577
|
[onConfirm]
|
|
10187
10578
|
);
|
|
10188
|
-
const handleCancel = (0,
|
|
10579
|
+
const handleCancel = (0, import_react48.useCallback)(
|
|
10189
10580
|
(e) => {
|
|
10190
10581
|
e.stopPropagation();
|
|
10191
10582
|
onCancel();
|
|
@@ -10195,7 +10586,7 @@ var AskAboutTrigger = (0, import_react47.memo)(function AskAboutTrigger2({
|
|
|
10195
10586
|
if (!visible) {
|
|
10196
10587
|
return null;
|
|
10197
10588
|
}
|
|
10198
|
-
return /* @__PURE__ */ (0,
|
|
10589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
10199
10590
|
"div",
|
|
10200
10591
|
{
|
|
10201
10592
|
ref: triggerRef,
|
|
@@ -10214,8 +10605,8 @@ var AskAboutTrigger = (0, import_react47.memo)(function AskAboutTrigger2({
|
|
|
10214
10605
|
transform: "translate(-50%, 0)"
|
|
10215
10606
|
},
|
|
10216
10607
|
children: [
|
|
10217
|
-
/* @__PURE__ */ (0,
|
|
10218
|
-
/* @__PURE__ */ (0,
|
|
10608
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
|
|
10609
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
10219
10610
|
"button",
|
|
10220
10611
|
{
|
|
10221
10612
|
onClick: handleConfirm,
|
|
@@ -10228,7 +10619,7 @@ var AskAboutTrigger = (0, import_react47.memo)(function AskAboutTrigger2({
|
|
|
10228
10619
|
children: "Ask"
|
|
10229
10620
|
}
|
|
10230
10621
|
),
|
|
10231
|
-
/* @__PURE__ */ (0,
|
|
10622
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
10232
10623
|
"button",
|
|
10233
10624
|
{
|
|
10234
10625
|
onClick: handleCancel,
|
|
@@ -10248,11 +10639,11 @@ var AskAboutTrigger = (0, import_react47.memo)(function AskAboutTrigger2({
|
|
|
10248
10639
|
});
|
|
10249
10640
|
|
|
10250
10641
|
// src/components/Minimap/Minimap.tsx
|
|
10251
|
-
var
|
|
10642
|
+
var import_react49 = require("react");
|
|
10252
10643
|
init_hooks();
|
|
10253
10644
|
init_utils();
|
|
10254
|
-
var
|
|
10255
|
-
var PageIndicator = (0,
|
|
10645
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
10646
|
+
var PageIndicator = (0, import_react49.memo)(function PageIndicator2({
|
|
10256
10647
|
pageNumber,
|
|
10257
10648
|
status,
|
|
10258
10649
|
isBookmarked,
|
|
@@ -10266,7 +10657,7 @@ var PageIndicator = (0, import_react48.memo)(function PageIndicator2({
|
|
|
10266
10657
|
if (status === "visited") return "bg-green-400";
|
|
10267
10658
|
return "bg-gray-200 dark:bg-gray-700";
|
|
10268
10659
|
};
|
|
10269
|
-
return /* @__PURE__ */ (0,
|
|
10660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
10270
10661
|
"button",
|
|
10271
10662
|
{
|
|
10272
10663
|
onClick,
|
|
@@ -10282,13 +10673,13 @@ var PageIndicator = (0, import_react48.memo)(function PageIndicator2({
|
|
|
10282
10673
|
title: `Page ${pageNumber}${isBookmarked ? " (bookmarked)" : ""}`,
|
|
10283
10674
|
"aria-label": `Go to page ${pageNumber}`,
|
|
10284
10675
|
children: [
|
|
10285
|
-
isBookmarked && !compact && /* @__PURE__ */ (0,
|
|
10286
|
-
showNumber && !compact && /* @__PURE__ */ (0,
|
|
10676
|
+
isBookmarked && !compact && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
|
|
10677
|
+
showNumber && !compact && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
|
|
10287
10678
|
]
|
|
10288
10679
|
}
|
|
10289
10680
|
);
|
|
10290
10681
|
});
|
|
10291
|
-
var Minimap = (0,
|
|
10682
|
+
var Minimap = (0, import_react49.memo)(function Minimap2({
|
|
10292
10683
|
variant = "sidebar",
|
|
10293
10684
|
floatingPosition = "right",
|
|
10294
10685
|
maxHeight = 300,
|
|
@@ -10301,18 +10692,18 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10301
10692
|
const currentPage = useViewerStore((s) => s.currentPage);
|
|
10302
10693
|
const numPages = useViewerStore((s) => s.numPages);
|
|
10303
10694
|
const goToPage = useViewerStore((s) => s.goToPage);
|
|
10304
|
-
const bookmarkedPages = (0,
|
|
10695
|
+
const bookmarkedPages = (0, import_react49.useMemo)(() => {
|
|
10305
10696
|
return new Set(bookmarks.map((b) => b.pageNumber));
|
|
10306
10697
|
}, [bookmarks]);
|
|
10307
10698
|
const compact = numPages > 50;
|
|
10308
|
-
const handlePageClick = (0,
|
|
10699
|
+
const handlePageClick = (0, import_react49.useCallback)(
|
|
10309
10700
|
(pageNumber) => {
|
|
10310
10701
|
goToPage(pageNumber);
|
|
10311
10702
|
onPageClick?.(pageNumber);
|
|
10312
10703
|
},
|
|
10313
10704
|
[goToPage, onPageClick]
|
|
10314
10705
|
);
|
|
10315
|
-
const getPageStatus = (0,
|
|
10706
|
+
const getPageStatus = (0, import_react49.useCallback)(
|
|
10316
10707
|
(pageNumber) => {
|
|
10317
10708
|
if (pageNumber === currentPage) return "current";
|
|
10318
10709
|
if (bookmarkedPages.has(pageNumber)) return "bookmarked";
|
|
@@ -10321,11 +10712,11 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10321
10712
|
},
|
|
10322
10713
|
[currentPage, visitedPages, bookmarkedPages]
|
|
10323
10714
|
);
|
|
10324
|
-
const pageIndicators = (0,
|
|
10715
|
+
const pageIndicators = (0, import_react49.useMemo)(() => {
|
|
10325
10716
|
const pages = [];
|
|
10326
10717
|
for (let i = 1; i <= numPages; i++) {
|
|
10327
10718
|
pages.push(
|
|
10328
|
-
/* @__PURE__ */ (0,
|
|
10719
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10329
10720
|
PageIndicator,
|
|
10330
10721
|
{
|
|
10331
10722
|
pageNumber: i,
|
|
@@ -10346,16 +10737,16 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10346
10737
|
if (numPages === 0) {
|
|
10347
10738
|
return null;
|
|
10348
10739
|
}
|
|
10349
|
-
const content = /* @__PURE__ */ (0,
|
|
10350
|
-
/* @__PURE__ */ (0,
|
|
10351
|
-
/* @__PURE__ */ (0,
|
|
10352
|
-
/* @__PURE__ */ (0,
|
|
10353
|
-
/* @__PURE__ */ (0,
|
|
10740
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
|
|
10741
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mb-3", children: [
|
|
10742
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
|
|
10743
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Progress" }),
|
|
10744
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
|
|
10354
10745
|
progressPercentage,
|
|
10355
10746
|
"%"
|
|
10356
10747
|
] })
|
|
10357
10748
|
] }),
|
|
10358
|
-
/* @__PURE__ */ (0,
|
|
10749
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10359
10750
|
"div",
|
|
10360
10751
|
{
|
|
10361
10752
|
className: "h-full bg-green-500 rounded-full transition-all duration-300",
|
|
@@ -10363,7 +10754,7 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10363
10754
|
}
|
|
10364
10755
|
) })
|
|
10365
10756
|
] }),
|
|
10366
|
-
/* @__PURE__ */ (0,
|
|
10757
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10367
10758
|
"div",
|
|
10368
10759
|
{
|
|
10369
10760
|
className: cn(
|
|
@@ -10374,21 +10765,21 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10374
10765
|
children: pageIndicators
|
|
10375
10766
|
}
|
|
10376
10767
|
),
|
|
10377
|
-
/* @__PURE__ */ (0,
|
|
10378
|
-
/* @__PURE__ */ (0,
|
|
10379
|
-
/* @__PURE__ */ (0,
|
|
10380
|
-
/* @__PURE__ */ (0,
|
|
10768
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
|
|
10769
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
10770
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
|
|
10771
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Current" })
|
|
10381
10772
|
] }),
|
|
10382
|
-
/* @__PURE__ */ (0,
|
|
10383
|
-
/* @__PURE__ */ (0,
|
|
10384
|
-
/* @__PURE__ */ (0,
|
|
10773
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
10774
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
|
|
10775
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Visited" })
|
|
10385
10776
|
] }),
|
|
10386
|
-
/* @__PURE__ */ (0,
|
|
10387
|
-
/* @__PURE__ */ (0,
|
|
10388
|
-
/* @__PURE__ */ (0,
|
|
10777
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
10778
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
|
|
10779
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Bookmarked" })
|
|
10389
10780
|
] })
|
|
10390
10781
|
] }) }),
|
|
10391
|
-
/* @__PURE__ */ (0,
|
|
10782
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
|
|
10392
10783
|
visitedCount,
|
|
10393
10784
|
" of ",
|
|
10394
10785
|
numPages,
|
|
@@ -10396,7 +10787,7 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10396
10787
|
] })
|
|
10397
10788
|
] });
|
|
10398
10789
|
if (variant === "floating") {
|
|
10399
|
-
return /* @__PURE__ */ (0,
|
|
10790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
10400
10791
|
"div",
|
|
10401
10792
|
{
|
|
10402
10793
|
className: cn(
|
|
@@ -10412,13 +10803,13 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10412
10803
|
),
|
|
10413
10804
|
style: { maxHeight },
|
|
10414
10805
|
children: [
|
|
10415
|
-
/* @__PURE__ */ (0,
|
|
10806
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
|
|
10416
10807
|
content
|
|
10417
10808
|
]
|
|
10418
10809
|
}
|
|
10419
10810
|
);
|
|
10420
10811
|
}
|
|
10421
|
-
return /* @__PURE__ */ (0,
|
|
10812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
10422
10813
|
"div",
|
|
10423
10814
|
{
|
|
10424
10815
|
className: cn(
|
|
@@ -10432,11 +10823,14 @@ var Minimap = (0, import_react48.memo)(function Minimap2({
|
|
|
10432
10823
|
);
|
|
10433
10824
|
});
|
|
10434
10825
|
|
|
10826
|
+
// src/components/index.ts
|
|
10827
|
+
init_FloatingZoomControls2();
|
|
10828
|
+
|
|
10435
10829
|
// src/components/ErrorBoundary/PDFErrorBoundary.tsx
|
|
10436
|
-
var
|
|
10830
|
+
var import_react50 = require("react");
|
|
10437
10831
|
init_utils();
|
|
10438
|
-
var
|
|
10439
|
-
var PDFErrorBoundary = class extends
|
|
10832
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
10833
|
+
var PDFErrorBoundary = class extends import_react50.Component {
|
|
10440
10834
|
constructor(props) {
|
|
10441
10835
|
super(props);
|
|
10442
10836
|
this.handleReset = () => {
|
|
@@ -10463,7 +10857,7 @@ var PDFErrorBoundary = class extends import_react49.Component {
|
|
|
10463
10857
|
return fallback;
|
|
10464
10858
|
}
|
|
10465
10859
|
if (showDefaultUI) {
|
|
10466
|
-
return /* @__PURE__ */ (0,
|
|
10860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10467
10861
|
DefaultErrorUI,
|
|
10468
10862
|
{
|
|
10469
10863
|
error,
|
|
@@ -10482,7 +10876,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
10482
10876
|
const isNetworkError = error.message.includes("fetch") || error.message.includes("network") || error.message.includes("Failed to load");
|
|
10483
10877
|
let title = "Something went wrong";
|
|
10484
10878
|
let description = error.message;
|
|
10485
|
-
let icon = /* @__PURE__ */ (0,
|
|
10879
|
+
let icon = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10486
10880
|
"path",
|
|
10487
10881
|
{
|
|
10488
10882
|
strokeLinecap: "round",
|
|
@@ -10494,7 +10888,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
10494
10888
|
if (isPDFError) {
|
|
10495
10889
|
title = "Unable to load PDF";
|
|
10496
10890
|
description = "The PDF file could not be loaded. It may be corrupted or in an unsupported format.";
|
|
10497
|
-
icon = /* @__PURE__ */ (0,
|
|
10891
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10498
10892
|
"path",
|
|
10499
10893
|
{
|
|
10500
10894
|
strokeLinecap: "round",
|
|
@@ -10506,7 +10900,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
10506
10900
|
} else if (isNetworkError) {
|
|
10507
10901
|
title = "Network error";
|
|
10508
10902
|
description = "Unable to fetch the PDF file. Please check your internet connection and try again.";
|
|
10509
|
-
icon = /* @__PURE__ */ (0,
|
|
10903
|
+
icon = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10510
10904
|
"path",
|
|
10511
10905
|
{
|
|
10512
10906
|
strokeLinecap: "round",
|
|
@@ -10516,7 +10910,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
10516
10910
|
}
|
|
10517
10911
|
) });
|
|
10518
10912
|
}
|
|
10519
|
-
return /* @__PURE__ */ (0,
|
|
10913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
10520
10914
|
"div",
|
|
10521
10915
|
{
|
|
10522
10916
|
className: cn(
|
|
@@ -10529,14 +10923,14 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
10529
10923
|
),
|
|
10530
10924
|
children: [
|
|
10531
10925
|
icon,
|
|
10532
|
-
/* @__PURE__ */ (0,
|
|
10533
|
-
/* @__PURE__ */ (0,
|
|
10534
|
-
/* @__PURE__ */ (0,
|
|
10535
|
-
/* @__PURE__ */ (0,
|
|
10536
|
-
/* @__PURE__ */ (0,
|
|
10926
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
|
|
10927
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
|
|
10928
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("details", { className: "mt-4 text-left max-w-md w-full", children: [
|
|
10929
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("summary", { className: "cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: "Technical details" }),
|
|
10930
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
|
|
10537
10931
|
] }),
|
|
10538
|
-
/* @__PURE__ */ (0,
|
|
10539
|
-
/* @__PURE__ */ (0,
|
|
10932
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mt-6 flex gap-3", children: [
|
|
10933
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10540
10934
|
"button",
|
|
10541
10935
|
{
|
|
10542
10936
|
onClick: onReset,
|
|
@@ -10550,7 +10944,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
10550
10944
|
children: "Try again"
|
|
10551
10945
|
}
|
|
10552
10946
|
),
|
|
10553
|
-
/* @__PURE__ */ (0,
|
|
10947
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
10554
10948
|
"button",
|
|
10555
10949
|
{
|
|
10556
10950
|
onClick: () => window.location.reload(),
|
|
@@ -10570,7 +10964,7 @@ function DefaultErrorUI({ error, onReset, className }) {
|
|
|
10570
10964
|
);
|
|
10571
10965
|
}
|
|
10572
10966
|
function withErrorBoundary({ component, ...props }) {
|
|
10573
|
-
return /* @__PURE__ */ (0,
|
|
10967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PDFErrorBoundary, { ...props, children: component });
|
|
10574
10968
|
}
|
|
10575
10969
|
|
|
10576
10970
|
// src/index.ts
|
|
@@ -10594,6 +10988,7 @@ init_utils();
|
|
|
10594
10988
|
DocumentContainer,
|
|
10595
10989
|
DrawingCanvas,
|
|
10596
10990
|
DualPageContainer,
|
|
10991
|
+
FloatingZoomControls,
|
|
10597
10992
|
FocusRegionLayer,
|
|
10598
10993
|
HighlightLayer,
|
|
10599
10994
|
HighlightPopover,
|