@m3ui-vue/m3ui-vue 1.2.2 → 1.3.0
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/API.md +2776 -351
- package/dist/MButton-CuNzpoxm.js +172 -0
- package/dist/MButton-CuNzpoxm.js.map +1 -0
- package/dist/MDialog-HxEL-m58.js +173 -0
- package/dist/MDialog-HxEL-m58.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-DnPtv-hY.js +824 -0
- package/dist/MListItem-DnPtv-hY.js.map +1 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js.map +1 -0
- package/dist/MMenuItem-Bih0h4-n.js +604 -0
- package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
- package/dist/MProgressBar-BCoruxA-.js +184 -0
- package/dist/MProgressBar-BCoruxA-.js.map +1 -0
- package/dist/MSeekBar-LURE1Ah7.js +435 -0
- package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-_J4IS2_z.js +691 -0
- package/dist/MSlider-_J4IS2_z.js.map +1 -0
- package/dist/MSpinner-BhkMYKOM.js +65 -0
- package/dist/MSpinner-BhkMYKOM.js.map +1 -0
- package/dist/MTextField-CkzwNBWS.js +296 -0
- package/dist/MTextField-CkzwNBWS.js.map +1 -0
- package/dist/MTooltip-B67ZDSGp.js +756 -0
- package/dist/MTooltip-B67ZDSGp.js.map +1 -0
- package/dist/_storageKeys-CYXsUBwK.js +18 -0
- package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
- package/dist/_useEscapeStack-CjndQhqg.js +19 -0
- package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +115 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
- package/dist/components/MBox.vue.d.ts +1 -1
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MDialog.vue.d.ts +2 -2
- package/dist/components/MDivider.vue.d.ts +1 -1
- package/dist/components/MDragHandle.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +148 -0
- package/dist/components/MDrawLayers.vue.d.ts +3 -0
- package/dist/components/MDrawToolbar.vue.d.ts +34 -0
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +2 -2
- package/dist/components/MFixed.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +160 -0
- package/dist/components/MFlow.vue.d.ts +305 -0
- package/dist/components/MFlowControls.vue.d.ts +33 -0
- package/dist/components/MFlowHandle.vue.d.ts +16 -0
- package/dist/components/MFlowMinimap.vue.d.ts +22 -0
- package/dist/components/MFlowNode.vue.d.ts +35 -0
- package/dist/components/MGantt.vue.d.ts +141 -0
- package/dist/components/MGanttControls.vue.d.ts +32 -0
- package/dist/components/MIconButton.vue.d.ts +3 -1
- package/dist/components/MImageCropper.vue.d.ts +110 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MList.vue.d.ts +1 -1
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MMapSearch.vue.d.ts +1 -1
- package/dist/components/MMaskField.vue.d.ts +12 -1
- package/dist/components/MMenu.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +11 -2
- package/dist/components/MPdfViewer.vue.d.ts +174 -0
- package/dist/components/MPullToRefresh.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +149 -0
- package/dist/components/MScheduler.vue.d.ts +3 -3
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +2 -2
- package/dist/components/MSparkline.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +12 -1
- package/dist/components/MTextField.vue.d.ts +13 -2
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/MVideoPlayer.vue.d.ts +253 -0
- package/dist/components/MVirtualTable.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MFlowEdge.vue.d.ts +9 -0
- package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
- package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
- package/dist/components/_MPdfPage.vue.d.ts +76 -0
- package/dist/components/_MTimeBackground.vue.d.ts +14 -0
- package/dist/components/_MTimeHeader.vue.d.ts +20 -0
- package/dist/composables/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -0
- package/dist/composables/_useTimeAxis.d.ts +90 -0
- package/dist/composables/drawGeometry.d.ts +119 -0
- package/dist/composables/flowFormats.d.ts +79 -0
- package/dist/composables/flowLayout.d.ts +45 -0
- package/dist/composables/flowPaths.d.ts +53 -0
- package/dist/composables/ganttFormats.d.ts +52 -0
- package/dist/composables/ganttSchedule.d.ts +99 -0
- package/dist/composables/useDrawing.d.ts +44 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +163 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1700 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3542 -0
- package/dist/flow.js.map +1 -0
- package/dist/flowPaths-CUc6X373.js +161 -0
- package/dist/flowPaths-CUc6X373.js.map +1 -0
- package/dist/gantt.d.ts +12 -0
- package/dist/gantt.js +3575 -0
- package/dist/gantt.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/locales/index.js +1148 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7286 -7654
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +113 -108
- package/dist/map.js.map +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +1311 -0
- package/dist/media.js.map +1 -0
- package/dist/pdf.d.ts +4 -0
- package/dist/pdf.js +1871 -0
- package/dist/pdf.js.map +1 -0
- package/dist/rich-text-editor.js +28 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
- package/dist/useLocale-BpGxplLV.js.map +1 -0
- package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
- package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
- package/package.json +29 -5
- package/src/__tests__/MAudioPlayer.test.ts +75 -0
- package/src/__tests__/MDrawCanvas.test.ts +110 -0
- package/src/__tests__/MFloorPlan.test.ts +97 -0
- package/src/__tests__/MFlow.test.ts +575 -0
- package/src/__tests__/MGantt.test.ts +130 -0
- package/src/__tests__/MImageCropper.test.ts +89 -0
- package/src/__tests__/MPdfViewer.test.ts +235 -0
- package/src/__tests__/MResourceTimeline.test.ts +102 -0
- package/src/__tests__/MVideoPlayer.test.ts +201 -0
- package/src/__tests__/drawGeometry.test.ts +58 -0
- package/src/__tests__/fieldExpose.test.ts +30 -0
- package/src/__tests__/flowFormats.test.ts +185 -0
- package/src/__tests__/flowLayout.test.ts +113 -0
- package/src/__tests__/ganttFormats.test.ts +76 -0
- package/src/__tests__/ganttSchedule.test.ts +136 -0
- package/src/__tests__/pdfMock.ts +83 -0
- package/src/__tests__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +813 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MFloorPlan.vue +581 -0
- package/src/components/MFlow.vue +2049 -0
- package/src/components/MFlowControls.vue +110 -0
- package/src/components/MFlowHandle.vue +60 -0
- package/src/components/MFlowMinimap.vue +134 -0
- package/src/components/MFlowNode.vue +98 -0
- package/src/components/MGantt.vue +1609 -0
- package/src/components/MGanttControls.vue +77 -0
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MImageCropper.vue +507 -0
- package/src/components/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1269 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +16 -0
- package/src/components/MVideoPlayer.vue +839 -0
- package/src/components/_MFlowEdge.vue +100 -0
- package/src/components/_MFlowEdgeLabel.vue +56 -0
- package/src/components/_MFlowNodeShell.vue +111 -0
- package/src/components/_MPdfPage.vue +456 -0
- package/src/components/_MTimeBackground.vue +16 -0
- package/src/components/_MTimeHeader.vue +31 -0
- package/src/composables/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -0
- package/src/composables/_useTimeAxis.ts +224 -0
- package/src/composables/drawGeometry.ts +405 -0
- package/src/composables/flowFormats.ts +916 -0
- package/src/composables/flowLayout.ts +297 -0
- package/src/composables/flowPaths.ts +239 -0
- package/src/composables/ganttFormats.ts +366 -0
- package/src/composables/ganttSchedule.ts +403 -0
- package/src/composables/useDrawing.ts +53 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +328 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +4 -0
- package/src/locales/de.ts +163 -0
- package/src/locales/es.ts +163 -0
- package/src/locales/fr.ts +163 -0
- package/src/locales/ja.ts +163 -0
- package/src/locales/ko.ts +163 -0
- package/src/locales/pt.ts +163 -0
- package/src/locales/zh.ts +163 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/dist/MMenuItem-D4Gx_l3F.js +0 -929
- package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
- package/dist/MSlider-Dx_S3vJ9.js +0 -1506
- package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
- package/dist/MTextField-Bz8JIsnl.js +0 -633
- package/dist/MTextField-Bz8JIsnl.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
package/dist/pdf.js
ADDED
|
@@ -0,0 +1,1871 @@
|
|
|
1
|
+
import { i as e } from "./useLocale-BpGxplLV.js";
|
|
2
|
+
import { t } from "./MIconButton-DoNotQ9v.js";
|
|
3
|
+
import { t as n } from "./MIcon-Bxh9j135.js";
|
|
4
|
+
import { t as r } from "./MTextField-CkzwNBWS.js";
|
|
5
|
+
import { t as i } from "./MButton-CuNzpoxm.js";
|
|
6
|
+
import { n as a, t as o } from "./MMenuItem-Bih0h4-n.js";
|
|
7
|
+
import { t as s } from "./MLoadingIndicator-BQMNX6Dx.js";
|
|
8
|
+
import { t as c } from "./MProgressBar-BCoruxA-.js";
|
|
9
|
+
import { Fragment as l, Transition as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, createVNode as _, defineComponent as v, getCurrentScope as ee, mergeProps as te, nextTick as y, normalizeClass as b, normalizeStyle as x, onBeforeUnmount as ne, onMounted as re, onScopeDispose as S, openBlock as C, reactive as ie, ref as w, renderList as T, renderSlot as ae, resolveDynamicComponent as oe, shallowRef as E, toDisplayString as D, toValue as O, unref as k, vModelText as se, watch as A, withCtx as j, withDirectives as ce, withKeys as le, withModifiers as ue } from "vue";
|
|
10
|
+
//#region src/composables/usePdf.ts
|
|
11
|
+
var M;
|
|
12
|
+
function N(e) {
|
|
13
|
+
M = e;
|
|
14
|
+
}
|
|
15
|
+
var P = null;
|
|
16
|
+
function F(e) {
|
|
17
|
+
return P ??= (async () => {
|
|
18
|
+
let t = await import("pdfjs-dist"), n = e ?? M;
|
|
19
|
+
return n ? t.GlobalWorkerOptions.workerSrc = n : t.GlobalWorkerOptions.workerSrc || await import("pdfjs-dist/build/pdf.worker.min.mjs"), t;
|
|
20
|
+
})(), P;
|
|
21
|
+
}
|
|
22
|
+
function I(e, t) {
|
|
23
|
+
let n = "";
|
|
24
|
+
for (let r of e) {
|
|
25
|
+
let e = r.normalize("NFD").replace(/\p{M}/gu, ""), i = e.length === 1 ? e : r;
|
|
26
|
+
n += t ? i : i.toLowerCase();
|
|
27
|
+
}
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
function L(e, t) {
|
|
31
|
+
return typeof t == "string" ? e.PDFDateString.toDateObject(t) ?? void 0 : void 0;
|
|
32
|
+
}
|
|
33
|
+
function de(e, t = {}) {
|
|
34
|
+
let n = E(null), r = E(null), i = w(!1), a = w(0), o = E(null), s = w(!1), c = w(!1), l = E([]), u = E([]), f = E({}), p = d(() => n.value?.numPages ?? 0), m = null, h = null, g = 0, _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
35
|
+
function te() {
|
|
36
|
+
for (let e of v.values()) e.then((e) => URL.revokeObjectURL(e), () => {});
|
|
37
|
+
v.clear(), _.clear();
|
|
38
|
+
let e = m;
|
|
39
|
+
m = null, e?.destroy(), n.value = null, l.value = [], u.value = [], f.value = {}, s.value = !1, c.value = !1, h = null;
|
|
40
|
+
}
|
|
41
|
+
async function y(e) {
|
|
42
|
+
let u = ++g;
|
|
43
|
+
if (te(), o.value = null, a.value = 0, !e || typeof window > "u") {
|
|
44
|
+
i.value = !1;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
i.value = !0;
|
|
48
|
+
try {
|
|
49
|
+
let o = await F(t.workerSrc);
|
|
50
|
+
if (u !== g) return;
|
|
51
|
+
r.value = o;
|
|
52
|
+
let d, f;
|
|
53
|
+
if (typeof e == "string" || e instanceof URL ? f = String(e) : d = e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e instanceof ArrayBuffer ? e.slice(0) : e.slice()), u !== g) return;
|
|
54
|
+
m = o.getDocument({
|
|
55
|
+
url: f,
|
|
56
|
+
data: d,
|
|
57
|
+
password: O(t.password),
|
|
58
|
+
withCredentials: t.withCredentials
|
|
59
|
+
}), m.onProgress = ({ loaded: e, total: t }) => {
|
|
60
|
+
u === g && t && (a.value = Math.min(1, e / t));
|
|
61
|
+
}, m.onPassword = (e, t) => {
|
|
62
|
+
u === g && (h = e, c.value = t === o.PasswordResponses.INCORRECT_PASSWORD, s.value = !0);
|
|
63
|
+
};
|
|
64
|
+
let p = m, _ = await p.promise;
|
|
65
|
+
if (u !== g) {
|
|
66
|
+
p.destroy();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
s.value = !1, c.value = !1, a.value = 1;
|
|
70
|
+
let v = (await _.getPage(1)).getViewport({ scale: 1 });
|
|
71
|
+
l.value = Array.from({ length: _.numPages }, () => ({
|
|
72
|
+
width: v.width,
|
|
73
|
+
height: v.height
|
|
74
|
+
})), n.value = _, i.value = !1, b(_, u), ne(_, u), re(_, o, u);
|
|
75
|
+
} catch (e) {
|
|
76
|
+
if (u !== g) return;
|
|
77
|
+
o.value = e instanceof Error ? e : Error(String(e)), i.value = !1;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function b(e, t) {
|
|
81
|
+
let n = l.value.slice(), r = !1;
|
|
82
|
+
for (let i = 2; i <= e.numPages; i++) {
|
|
83
|
+
if (t !== g) return;
|
|
84
|
+
let a = (await e.getPage(i)).getViewport({ scale: 1 }), o = n[i - 1];
|
|
85
|
+
(o.width !== a.width || o.height !== a.height) && (n[i - 1] = {
|
|
86
|
+
width: a.width,
|
|
87
|
+
height: a.height
|
|
88
|
+
}, r = !0), r && (i % 25 == 0 || i === e.numPages) && (l.value = n.slice(), r = !1);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function x(e) {
|
|
92
|
+
let t = n.value;
|
|
93
|
+
if (!t || !e) return null;
|
|
94
|
+
try {
|
|
95
|
+
let n = typeof e == "string" ? await t.getDestination(e) : e;
|
|
96
|
+
if (!Array.isArray(n)) return null;
|
|
97
|
+
let r = n[0], i = typeof r == "number" ? r : await t.getPageIndex(r), a = n[1]?.name, o = a === "XYZ" ? n[3] : a === "FitH" || a === "FitBH" ? n[2] : null;
|
|
98
|
+
return {
|
|
99
|
+
page: i + 1,
|
|
100
|
+
top: typeof o == "number" ? o : void 0
|
|
101
|
+
};
|
|
102
|
+
} catch {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async function ne(e, t) {
|
|
107
|
+
let n = await e.getOutline().catch(() => null);
|
|
108
|
+
if (!n || t !== g) return;
|
|
109
|
+
let r = async (e) => Promise.all(e.map(async (e) => {
|
|
110
|
+
let t = e.dest ? await x(e.dest) : null;
|
|
111
|
+
return {
|
|
112
|
+
title: e.title,
|
|
113
|
+
page: t?.page,
|
|
114
|
+
top: t?.top,
|
|
115
|
+
url: e.url ?? void 0,
|
|
116
|
+
children: await r(e.items ?? [])
|
|
117
|
+
};
|
|
118
|
+
})), i = await r(n);
|
|
119
|
+
t === g && (u.value = i);
|
|
120
|
+
}
|
|
121
|
+
async function re(e, t, n) {
|
|
122
|
+
let r = await e.getMetadata().catch(() => null);
|
|
123
|
+
if (!r || n !== g) return;
|
|
124
|
+
let i = r.info, a = (e) => typeof e == "string" && e.trim() ? e : void 0;
|
|
125
|
+
f.value = {
|
|
126
|
+
title: a(r.metadata?.get("dc:title")) ?? a(i.Title),
|
|
127
|
+
author: a(r.metadata?.get("dc:creator")) ?? a(i.Author),
|
|
128
|
+
subject: a(i.Subject),
|
|
129
|
+
creator: a(i.Creator),
|
|
130
|
+
producer: a(i.Producer),
|
|
131
|
+
creationDate: L(t, i.CreationDate),
|
|
132
|
+
modificationDate: L(t, i.ModDate)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
async function C(e) {
|
|
136
|
+
let t = n.value;
|
|
137
|
+
if (!t) throw Error("No document loaded");
|
|
138
|
+
return t.getPage(e);
|
|
139
|
+
}
|
|
140
|
+
function ie(e) {
|
|
141
|
+
let t = _.get(e);
|
|
142
|
+
return t || (t = C(e).then(async (e) => {
|
|
143
|
+
let t = await e.getTextContent(), n = "", r = [];
|
|
144
|
+
for (let e of t.items) "str" in e && (r.push(n.length), n += e.str, e.hasEOL && (n += " "));
|
|
145
|
+
return {
|
|
146
|
+
text: n,
|
|
147
|
+
starts: r
|
|
148
|
+
};
|
|
149
|
+
}), _.set(e, t)), t;
|
|
150
|
+
}
|
|
151
|
+
async function T(e, t = {}) {
|
|
152
|
+
let r = I(e.trim(), !!t.caseSensitive), i = [];
|
|
153
|
+
if (!r || !n.value) return i;
|
|
154
|
+
for (let e = 1; e <= p.value && !t.signal?.aborted; e++) {
|
|
155
|
+
let { text: n } = await ie(e), a = I(n, !!t.caseSensitive), o = 0;
|
|
156
|
+
for (let t = a.indexOf(r); t >= 0; t = a.indexOf(r, t + r.length)) {
|
|
157
|
+
let a = Math.max(0, t - 40), s = Math.min(n.length, t + r.length + 40);
|
|
158
|
+
i.push({
|
|
159
|
+
page: e,
|
|
160
|
+
index: o++,
|
|
161
|
+
start: t,
|
|
162
|
+
end: t + r.length,
|
|
163
|
+
context: (a ? "…" : "") + n.slice(a, s).trim() + (s < n.length ? "…" : "")
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return i;
|
|
168
|
+
}
|
|
169
|
+
function ae(e, t = 160) {
|
|
170
|
+
let n = typeof window < "u" ? Math.min(2, window.devicePixelRatio || 1) : 1, r = `${e}@${t}`, i = v.get(r);
|
|
171
|
+
return i || (i = C(e).then(async (e) => {
|
|
172
|
+
let r = e.getViewport({ scale: 1 }), i = e.getViewport({ scale: t / r.width * n }), a = document.createElement("canvas");
|
|
173
|
+
a.width = Math.ceil(i.width), a.height = Math.ceil(i.height), await e.render({
|
|
174
|
+
canvas: a,
|
|
175
|
+
viewport: i
|
|
176
|
+
}).promise;
|
|
177
|
+
let o = await new Promise((e) => a.toBlob(e, "image/png"));
|
|
178
|
+
if (!o) throw Error("Thumbnail failed");
|
|
179
|
+
return URL.createObjectURL(o);
|
|
180
|
+
}), v.set(r, i)), i;
|
|
181
|
+
}
|
|
182
|
+
let oe = async () => {
|
|
183
|
+
let e = n.value;
|
|
184
|
+
if (!e) throw Error("No document loaded");
|
|
185
|
+
return e.getData();
|
|
186
|
+
};
|
|
187
|
+
async function D() {
|
|
188
|
+
let e = await oe();
|
|
189
|
+
return URL.createObjectURL(new Blob([e], { type: "application/pdf" }));
|
|
190
|
+
}
|
|
191
|
+
async function k(t) {
|
|
192
|
+
let n = await D(), r = O(e), i = typeof r == "string" ? decodeURIComponent(r.split(/[?#]/)[0].split("/").pop() ?? "") : "", a = document.createElement("a");
|
|
193
|
+
a.href = n, a.download = t ?? (r instanceof File ? r.name : i.toLowerCase().endsWith(".pdf") ? i : `${f.value.title ?? "document"}.pdf`), document.body.appendChild(a), a.click(), a.remove(), setTimeout(() => URL.revokeObjectURL(n), 3e4);
|
|
194
|
+
}
|
|
195
|
+
async function se() {
|
|
196
|
+
let e = await D(), t = document.createElement("iframe");
|
|
197
|
+
t.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden", t.src = e, t.onload = () => {
|
|
198
|
+
try {
|
|
199
|
+
t.contentWindow?.focus(), t.contentWindow?.print();
|
|
200
|
+
} catch {
|
|
201
|
+
window.open(e, "_blank");
|
|
202
|
+
}
|
|
203
|
+
setTimeout(() => {
|
|
204
|
+
t.remove(), URL.revokeObjectURL(e);
|
|
205
|
+
}, 6e4);
|
|
206
|
+
}, document.body.appendChild(t);
|
|
207
|
+
}
|
|
208
|
+
function j(e) {
|
|
209
|
+
let t = h;
|
|
210
|
+
t && (h = null, s.value = !1, t(e));
|
|
211
|
+
}
|
|
212
|
+
return A(() => O(e), (e) => {
|
|
213
|
+
y(e);
|
|
214
|
+
}, { immediate: !0 }), ee() && S(() => {
|
|
215
|
+
g++, te();
|
|
216
|
+
}), {
|
|
217
|
+
doc: n,
|
|
218
|
+
pdfjs: r,
|
|
219
|
+
loading: i,
|
|
220
|
+
progress: a,
|
|
221
|
+
error: o,
|
|
222
|
+
needsPassword: s,
|
|
223
|
+
wrongPassword: c,
|
|
224
|
+
submitPassword: j,
|
|
225
|
+
numPages: p,
|
|
226
|
+
pageSizes: l,
|
|
227
|
+
outline: u,
|
|
228
|
+
metadata: f,
|
|
229
|
+
getPage: C,
|
|
230
|
+
pageText: ie,
|
|
231
|
+
search: T,
|
|
232
|
+
thumbnail: ae,
|
|
233
|
+
resolveDest: x,
|
|
234
|
+
getData: oe,
|
|
235
|
+
download: k,
|
|
236
|
+
print: se
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/components/_MPdfPage.vue?vue&type=script&setup=true&lang.ts
|
|
241
|
+
var R = ["data-page"], fe = [
|
|
242
|
+
"href",
|
|
243
|
+
"target",
|
|
244
|
+
"rel",
|
|
245
|
+
"onClick"
|
|
246
|
+
], z = ["viewBox"], B = ["onClick"], V = [
|
|
247
|
+
"x",
|
|
248
|
+
"y",
|
|
249
|
+
"width",
|
|
250
|
+
"height",
|
|
251
|
+
"fill"
|
|
252
|
+
], pe = [
|
|
253
|
+
"d",
|
|
254
|
+
"stroke",
|
|
255
|
+
"stroke-width",
|
|
256
|
+
"onClick"
|
|
257
|
+
], me = ["cx", "cy"], he = [
|
|
258
|
+
"d",
|
|
259
|
+
"stroke",
|
|
260
|
+
"stroke-width"
|
|
261
|
+
], ge = ["aria-label", "onClick"], H = 16e6, _e = 12, U = /* @__PURE__ */ v({
|
|
262
|
+
__name: "_MPdfPage",
|
|
263
|
+
props: {
|
|
264
|
+
pdf: {},
|
|
265
|
+
page: {},
|
|
266
|
+
scale: {},
|
|
267
|
+
rotation: {},
|
|
268
|
+
active: { type: Boolean },
|
|
269
|
+
hits: {},
|
|
270
|
+
annotations: {},
|
|
271
|
+
tool: {},
|
|
272
|
+
color: {},
|
|
273
|
+
inkWidth: {},
|
|
274
|
+
selectedId: {}
|
|
275
|
+
},
|
|
276
|
+
emits: [
|
|
277
|
+
"link",
|
|
278
|
+
"add",
|
|
279
|
+
"select",
|
|
280
|
+
"erase",
|
|
281
|
+
"erase-start",
|
|
282
|
+
"erase-at",
|
|
283
|
+
"text-selection",
|
|
284
|
+
"rendered"
|
|
285
|
+
],
|
|
286
|
+
setup(e, { expose: t, emit: r }) {
|
|
287
|
+
let i = e, a = r, o = w(), s = w(), c = w(), u = E(null), f = E(null);
|
|
288
|
+
function g(e) {
|
|
289
|
+
return e.getViewport({
|
|
290
|
+
scale: i.scale,
|
|
291
|
+
rotation: (e.rotate + i.rotation) % 360
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
let v = null, ee = "";
|
|
295
|
+
async function te() {
|
|
296
|
+
if (!i.active) return;
|
|
297
|
+
let e = u.value ??= await i.pdf.getPage(i.page).catch(() => null);
|
|
298
|
+
if (!e || !i.active) return;
|
|
299
|
+
let t = g(e);
|
|
300
|
+
f.value = t;
|
|
301
|
+
let n = Math.min(2, window.devicePixelRatio || 1);
|
|
302
|
+
t.width * t.height * n * n > H && (n = Math.sqrt(H / (t.width * t.height)));
|
|
303
|
+
let r = `${i.scale}|${i.rotation}|${n}`;
|
|
304
|
+
if (r === ee) return;
|
|
305
|
+
v?.cancel();
|
|
306
|
+
let o = document.createElement("canvas");
|
|
307
|
+
o.width = Math.floor(t.width * n), o.height = Math.floor(t.height * n), o.className = "absolute inset-0 h-full w-full";
|
|
308
|
+
let c = e.render({
|
|
309
|
+
canvas: o,
|
|
310
|
+
viewport: t,
|
|
311
|
+
transform: n === 1 ? void 0 : [
|
|
312
|
+
n,
|
|
313
|
+
0,
|
|
314
|
+
0,
|
|
315
|
+
n,
|
|
316
|
+
0,
|
|
317
|
+
0
|
|
318
|
+
]
|
|
319
|
+
});
|
|
320
|
+
v = c;
|
|
321
|
+
try {
|
|
322
|
+
await c.promise;
|
|
323
|
+
} catch {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (v !== c) return;
|
|
327
|
+
v = null, ee = r;
|
|
328
|
+
let l = s.value;
|
|
329
|
+
l && (l.replaceChildren(o), a("rendered", i.page), ae(e, t), ce(e, t));
|
|
330
|
+
}
|
|
331
|
+
function y() {
|
|
332
|
+
v?.cancel(), v = null, ee = "";
|
|
333
|
+
let e = s.value?.querySelector("canvas");
|
|
334
|
+
e && (e.width = 0, e.height = 0), s.value?.replaceChildren(), S?.cancel(), S = null, c.value?.replaceChildren(), se.value = [], u.value?.cleanup();
|
|
335
|
+
}
|
|
336
|
+
let re, S = null, ie = null;
|
|
337
|
+
async function ae(e, t) {
|
|
338
|
+
let n = i.pdf.pdfjs.value, r = c.value;
|
|
339
|
+
if (!n || !r) return;
|
|
340
|
+
S?.cancel(), ie ??= await e.getTextContent();
|
|
341
|
+
let a = document.createElement("div");
|
|
342
|
+
a.className = "textLayer";
|
|
343
|
+
let o = new n.TextLayer({
|
|
344
|
+
textContentSource: ie,
|
|
345
|
+
container: a,
|
|
346
|
+
viewport: t
|
|
347
|
+
});
|
|
348
|
+
S = o;
|
|
349
|
+
try {
|
|
350
|
+
await o.render();
|
|
351
|
+
} catch {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
S === o && (r.replaceChildren(a), O());
|
|
355
|
+
}
|
|
356
|
+
let oe = [], D = (e) => e.replace(/[&<>"]/g, (e) => ({
|
|
357
|
+
"&": "&",
|
|
358
|
+
"<": "<",
|
|
359
|
+
">": ">",
|
|
360
|
+
"\"": """
|
|
361
|
+
})[e]);
|
|
362
|
+
async function O() {
|
|
363
|
+
let e = S;
|
|
364
|
+
if (!e) return;
|
|
365
|
+
for (let t of oe) e.textDivs[t] && (e.textDivs[t].textContent = e.textContentItemsStr[t] ?? "");
|
|
366
|
+
if (oe = [], !i.hits.length) return;
|
|
367
|
+
let { starts: t } = await i.pdf.pageText(i.page);
|
|
368
|
+
if (e !== S) return;
|
|
369
|
+
let n = /* @__PURE__ */ new Map();
|
|
370
|
+
for (let r of i.hits) for (let i = 0; i < t.length; i++) {
|
|
371
|
+
let a = t[i], o = e.textContentItemsStr[i] ?? "", s = Math.max(r.start, a), c = Math.min(r.end, a + o.length);
|
|
372
|
+
if (c > s) {
|
|
373
|
+
let e = n.get(i) ?? [];
|
|
374
|
+
e.push({
|
|
375
|
+
a: s - a,
|
|
376
|
+
b: c - a,
|
|
377
|
+
current: r.current
|
|
378
|
+
}), n.set(i, e);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
let r = null;
|
|
382
|
+
for (let [t, i] of n) {
|
|
383
|
+
let n = e.textDivs[t], a = e.textContentItemsStr[t] ?? "";
|
|
384
|
+
if (!n) continue;
|
|
385
|
+
i.sort((e, t) => e.a - t.a);
|
|
386
|
+
let o = "", s = 0;
|
|
387
|
+
for (let e of i) o += D(a.slice(s, e.a)) + `<span class="m3-pdf-hit${e.current ? " m3-pdf-hit-current" : ""}">${D(a.slice(e.a, e.b))}</span>`, s = e.b;
|
|
388
|
+
n.innerHTML = o + D(a.slice(s)), oe.push(t), i.some((e) => e.current) && (r ??= n.querySelector(".m3-pdf-hit-current"));
|
|
389
|
+
}
|
|
390
|
+
k.value = r;
|
|
391
|
+
}
|
|
392
|
+
let k = E(null);
|
|
393
|
+
A(() => i.hits, O);
|
|
394
|
+
let se = w([]), j = null;
|
|
395
|
+
async function ce(e, t) {
|
|
396
|
+
j ??= (await e.getAnnotations().catch(() => [])).filter((e) => e.subtype === "Link" && (e.url || e.dest)).map((e) => ({
|
|
397
|
+
rect: e.rect,
|
|
398
|
+
url: e.url,
|
|
399
|
+
dest: e.dest
|
|
400
|
+
})), se.value = j.map((e) => {
|
|
401
|
+
let [n, r] = t.convertToViewportPoint(e.rect[0], e.rect[1]), [i, a] = t.convertToViewportPoint(e.rect[2], e.rect[3]);
|
|
402
|
+
return {
|
|
403
|
+
left: Math.min(n, i),
|
|
404
|
+
top: Math.min(r, a),
|
|
405
|
+
width: Math.abs(i - n),
|
|
406
|
+
height: Math.abs(a - r),
|
|
407
|
+
url: e.url,
|
|
408
|
+
dest: e.dest
|
|
409
|
+
};
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
let le = d(() => f.value && ee ? i.scale / Number(ee.split("|")[0]) : 1), ue = (e, t) => f.value ? f.value.convertToViewportPoint(e, t) : [0, 0], M = (e, t) => f.value ? f.value.convertToPdfPoint(e, t) : [0, 0], N = d(() => (i.scale, i.rotation, i.annotations.map((e) => {
|
|
413
|
+
if (e.type === "highlight") return {
|
|
414
|
+
a: e,
|
|
415
|
+
rects: (e.rects ?? []).map(([e, t, n, r]) => {
|
|
416
|
+
let [i, a] = ue(e, t), [o, s] = ue(n, r);
|
|
417
|
+
return {
|
|
418
|
+
x: Math.min(i, o),
|
|
419
|
+
y: Math.min(a, s),
|
|
420
|
+
w: Math.abs(o - i),
|
|
421
|
+
h: Math.abs(s - a)
|
|
422
|
+
};
|
|
423
|
+
})
|
|
424
|
+
};
|
|
425
|
+
if (e.type === "ink") return {
|
|
426
|
+
a: e,
|
|
427
|
+
d: (e.paths ?? []).map((e) => e.map(([e, t], n) => {
|
|
428
|
+
let [r, i] = ue(e, t);
|
|
429
|
+
return `${n ? "L" : "M"}${r.toFixed(1)},${i.toFixed(1)}`;
|
|
430
|
+
}).join("")).join(""),
|
|
431
|
+
w: (e.width ?? 2) * i.scale
|
|
432
|
+
};
|
|
433
|
+
let [t, n] = ue(e.at?.[0] ?? 0, e.at?.[1] ?? 0);
|
|
434
|
+
return {
|
|
435
|
+
a: e,
|
|
436
|
+
x: t,
|
|
437
|
+
y: n
|
|
438
|
+
};
|
|
439
|
+
})));
|
|
440
|
+
function P(e, t) {
|
|
441
|
+
i.tool === "select" && (e.stopPropagation(), a("select", {
|
|
442
|
+
id: t.id,
|
|
443
|
+
anchor: e.currentTarget.getBoundingClientRect()
|
|
444
|
+
}));
|
|
445
|
+
}
|
|
446
|
+
let F = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `a${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`, I = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
447
|
+
function L(e) {
|
|
448
|
+
let t = o.value.getBoundingClientRect(), n = f.value;
|
|
449
|
+
return [(e.clientX - t.left) / (t.width || 1) * n.width, (e.clientY - t.top) / (t.height || 1) * n.height];
|
|
450
|
+
}
|
|
451
|
+
function de(e) {
|
|
452
|
+
if (i.tool !== "note" || !f.value) return;
|
|
453
|
+
let [t, n] = M(...L(e));
|
|
454
|
+
a("add", {
|
|
455
|
+
id: F(),
|
|
456
|
+
type: "note",
|
|
457
|
+
page: i.page,
|
|
458
|
+
color: i.color,
|
|
459
|
+
at: [t, n],
|
|
460
|
+
text: "",
|
|
461
|
+
createdAt: I()
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
let U = w(null), ve = w(!1), ye = w(null), be = -1, xe = (e) => e.pointerType === "pen" && (e.button === 5 || !!(e.buttons & 32));
|
|
465
|
+
function Se(e) {
|
|
466
|
+
let t = L(e);
|
|
467
|
+
ye.value = t;
|
|
468
|
+
let [n, r] = M(t[0], t[1]);
|
|
469
|
+
a("erase-at", {
|
|
470
|
+
x: n,
|
|
471
|
+
y: r,
|
|
472
|
+
r: _e / i.scale
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function Ce(e) {
|
|
476
|
+
let t = xe(e);
|
|
477
|
+
if (!(i.tool !== "ink" && i.tool !== "eraser" && !t || e.button !== 0 && !t || !f.value)) {
|
|
478
|
+
e.preventDefault(), be = e.pointerId;
|
|
479
|
+
try {
|
|
480
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
481
|
+
} catch {}
|
|
482
|
+
i.tool === "eraser" || t ? (ve.value = !0, a("erase-start"), Se(e)) : U.value = [L(e)];
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
function we(e) {
|
|
486
|
+
if (i.tool === "eraser" && !ve.value && e.pointerType !== "touch" && (ye.value = L(e)), e.pointerId !== be) return;
|
|
487
|
+
if (ve.value) return Se(e);
|
|
488
|
+
if (!U.value) return;
|
|
489
|
+
let t = L(e), n = U.value[U.value.length - 1];
|
|
490
|
+
Math.hypot(t[0] - n[0], t[1] - n[1]) >= 1.5 && (U.value = [...U.value, t]);
|
|
491
|
+
}
|
|
492
|
+
function Te(e) {
|
|
493
|
+
if (e.pointerId !== be) return;
|
|
494
|
+
if (be = -1, ve.value) {
|
|
495
|
+
ve.value = !1, e.pointerType === "touch" && (ye.value = null);
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
if (!U.value) return;
|
|
499
|
+
let t = U.value;
|
|
500
|
+
U.value = null, !(t.length < 2) && a("add", {
|
|
501
|
+
id: F(),
|
|
502
|
+
type: "ink",
|
|
503
|
+
page: i.page,
|
|
504
|
+
color: i.color,
|
|
505
|
+
width: i.inkWidth,
|
|
506
|
+
paths: [t.map(([e, t]) => M(e, t).map((e) => Math.round(e * 100) / 100))],
|
|
507
|
+
createdAt: I()
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
let Ee = d(() => (U.value ?? []).map(([e, t], n) => `${n ? "L" : "M"}${e.toFixed(1)},${t.toFixed(1)}`).join(""));
|
|
511
|
+
function De(e, t) {
|
|
512
|
+
let n = f.value;
|
|
513
|
+
if (!n || !o.value) return !1;
|
|
514
|
+
let r = o.value.getBoundingClientRect(), i = n.width / (r.width || 1), s = n.height / (r.height || 1), c = (e - r.left) * i, l = (t - r.top) * s;
|
|
515
|
+
for (let e of [...N.value].reverse()) {
|
|
516
|
+
if (!("rects" in e) || !e.rects) continue;
|
|
517
|
+
let t = e.rects.find((e) => c >= e.x - 2 && c <= e.x + e.w + 2 && l >= e.y - 2 && l <= e.y + e.h + 2);
|
|
518
|
+
if (t) return a("select", {
|
|
519
|
+
id: e.a.id,
|
|
520
|
+
anchor: new DOMRect(r.left + t.x / i, r.top + t.y / s, t.w / i, t.h / s)
|
|
521
|
+
}), !0;
|
|
522
|
+
}
|
|
523
|
+
return !1;
|
|
524
|
+
}
|
|
525
|
+
function Oe(e) {
|
|
526
|
+
let t = e ? {
|
|
527
|
+
x: e.clientX,
|
|
528
|
+
y: e.clientY
|
|
529
|
+
} : null;
|
|
530
|
+
setTimeout(() => {
|
|
531
|
+
let e = window.getSelection(), n = c.value;
|
|
532
|
+
if (!e || e.isCollapsed || !e.rangeCount || !n || !f.value) {
|
|
533
|
+
if (t && (i.tool === "select" || i.tool === "highlight") && De(t.x, t.y)) return;
|
|
534
|
+
i.tool === "select" && a("text-selection", null);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
let r = e.getRangeAt(0);
|
|
538
|
+
if (!n.contains(r.commonAncestorContainer)) return;
|
|
539
|
+
let s = o.value.getBoundingClientRect(), l = f.value, u = l.width / (s.width || 1), d = l.height / (s.height || 1), p = [];
|
|
540
|
+
for (let e of Array.from(r.getClientRects())) {
|
|
541
|
+
if (e.width < 1 || e.height < 1) continue;
|
|
542
|
+
let [t, n] = M((e.left - s.left) * u, (e.top - s.top) * d), [r, i] = M((e.right - s.left) * u, (e.bottom - s.top) * d);
|
|
543
|
+
p.push([
|
|
544
|
+
t,
|
|
545
|
+
n,
|
|
546
|
+
r,
|
|
547
|
+
i
|
|
548
|
+
].map((e) => Math.round(e * 100) / 100));
|
|
549
|
+
}
|
|
550
|
+
if (!p.length) return;
|
|
551
|
+
let m = e.toString().replace(/\s+/g, " ").trim();
|
|
552
|
+
i.tool === "highlight" ? (a("add", {
|
|
553
|
+
id: F(),
|
|
554
|
+
type: "highlight",
|
|
555
|
+
page: i.page,
|
|
556
|
+
color: i.color,
|
|
557
|
+
rects: p,
|
|
558
|
+
quote: m,
|
|
559
|
+
text: "",
|
|
560
|
+
createdAt: I()
|
|
561
|
+
}), e.removeAllRanges()) : a("text-selection", {
|
|
562
|
+
page: i.page,
|
|
563
|
+
rects: p,
|
|
564
|
+
quote: m,
|
|
565
|
+
anchor: r.getBoundingClientRect()
|
|
566
|
+
});
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
return A(() => i.active, (e) => e ? te() : y(), { immediate: !0 }), A(() => [i.scale, i.rotation], () => {
|
|
570
|
+
u.value && (f.value = g(u.value)), clearTimeout(re), re = setTimeout(te, 140);
|
|
571
|
+
}), ne(() => {
|
|
572
|
+
clearTimeout(re), y();
|
|
573
|
+
}), t({
|
|
574
|
+
root: o,
|
|
575
|
+
currentHit: k
|
|
576
|
+
}), (t, r) => (C(), m("div", {
|
|
577
|
+
ref_key: "root",
|
|
578
|
+
ref: o,
|
|
579
|
+
class: "m3-pdf-page relative bg-white shadow-elevation-1",
|
|
580
|
+
"data-page": e.page,
|
|
581
|
+
style: x({
|
|
582
|
+
"--scale-factor": e.scale,
|
|
583
|
+
"--total-scale-factor": e.scale,
|
|
584
|
+
"--user-unit": 1,
|
|
585
|
+
"--scale-round-x": "1px",
|
|
586
|
+
"--scale-round-y": "1px"
|
|
587
|
+
}),
|
|
588
|
+
onClick: de
|
|
589
|
+
}, [
|
|
590
|
+
h("div", {
|
|
591
|
+
ref_key: "canvasHost",
|
|
592
|
+
ref: s,
|
|
593
|
+
class: "absolute inset-0"
|
|
594
|
+
}, null, 512),
|
|
595
|
+
h("div", {
|
|
596
|
+
ref_key: "textHost",
|
|
597
|
+
ref: c,
|
|
598
|
+
class: b(["absolute inset-0 overflow-hidden", { "pointer-events-none": e.tool === "ink" || e.tool === "note" || e.tool === "eraser" }]),
|
|
599
|
+
onPointerup: Oe
|
|
600
|
+
}, null, 34),
|
|
601
|
+
(C(!0), m(l, null, T(se.value, (t, n) => (C(), m("a", {
|
|
602
|
+
key: n,
|
|
603
|
+
href: t.url ?? "#",
|
|
604
|
+
target: t.url ? "_blank" : void 0,
|
|
605
|
+
rel: t.url ? "noopener noreferrer" : void 0,
|
|
606
|
+
class: b(["absolute rounded-xs hover:bg-primary/12", { "pointer-events-none": e.tool !== "select" }]),
|
|
607
|
+
style: x({
|
|
608
|
+
left: `${t.left * le.value}px`,
|
|
609
|
+
top: `${t.top * le.value}px`,
|
|
610
|
+
width: `${t.width * le.value}px`,
|
|
611
|
+
height: `${t.height * le.value}px`
|
|
612
|
+
}),
|
|
613
|
+
onClick: (e) => {
|
|
614
|
+
t.url ? a("link", { url: t.url }) : (e.preventDefault(), a("link", { dest: t.dest }));
|
|
615
|
+
}
|
|
616
|
+
}, null, 14, fe))), 128)),
|
|
617
|
+
(C(), m("svg", {
|
|
618
|
+
class: b(["absolute inset-0 h-full w-full overflow-visible", e.tool === "ink" ? "cursor-crosshair touch-none" : e.tool === "eraser" ? "cursor-none touch-none" : "pointer-events-none"]),
|
|
619
|
+
viewBox: f.value ? `0 0 ${f.value.width} ${f.value.height}` : void 0,
|
|
620
|
+
preserveAspectRatio: "none",
|
|
621
|
+
onPointerdown: Ce,
|
|
622
|
+
onPointermove: we,
|
|
623
|
+
onPointerup: Te,
|
|
624
|
+
onPointercancel: Te,
|
|
625
|
+
onPointerleave: r[0] ||= (e) => ye.value = ve.value ? ye.value : null
|
|
626
|
+
}, [
|
|
627
|
+
(C(!0), m(l, null, T(N.value, (t) => (C(), m(l, { key: t.a.id }, ["rects" in t ? (C(), m("g", {
|
|
628
|
+
key: 0,
|
|
629
|
+
class: b(["m3-pdf-highlight", { "m3-pdf-selected": t.a.id === e.selectedId }]),
|
|
630
|
+
onClick: (e) => P(e, t.a)
|
|
631
|
+
}, [(C(!0), m(l, null, T(t.rects, (e, n) => (C(), m("rect", {
|
|
632
|
+
key: n,
|
|
633
|
+
x: e.x,
|
|
634
|
+
y: e.y,
|
|
635
|
+
width: e.w,
|
|
636
|
+
height: e.h,
|
|
637
|
+
rx: "2",
|
|
638
|
+
fill: t.a.color
|
|
639
|
+
}, null, 8, V))), 128))], 10, B)) : "d" in t ? (C(), m("path", {
|
|
640
|
+
key: 1,
|
|
641
|
+
d: t.d,
|
|
642
|
+
fill: "none",
|
|
643
|
+
stroke: t.a.color,
|
|
644
|
+
"stroke-width": t.w,
|
|
645
|
+
"stroke-linecap": "round",
|
|
646
|
+
"stroke-linejoin": "round",
|
|
647
|
+
class: b(["m3-pdf-ink", { "m3-pdf-selected": t.a.id === e.selectedId }]),
|
|
648
|
+
onClick: (e) => P(e, t.a)
|
|
649
|
+
}, null, 10, pe)) : p("", !0)], 64))), 128)),
|
|
650
|
+
ye.value && e.tool === "eraser" ? (C(), m("circle", {
|
|
651
|
+
key: 0,
|
|
652
|
+
cx: ye.value[0],
|
|
653
|
+
cy: ye.value[1],
|
|
654
|
+
r: _e,
|
|
655
|
+
class: "pointer-events-none fill-surface/40 stroke-on-surface",
|
|
656
|
+
"stroke-width": "1.5"
|
|
657
|
+
}, null, 8, me)) : p("", !0),
|
|
658
|
+
U.value ? (C(), m("path", {
|
|
659
|
+
key: 1,
|
|
660
|
+
d: Ee.value,
|
|
661
|
+
fill: "none",
|
|
662
|
+
stroke: e.color,
|
|
663
|
+
"stroke-width": e.inkWidth * e.scale,
|
|
664
|
+
"stroke-linecap": "round",
|
|
665
|
+
"stroke-linejoin": "round"
|
|
666
|
+
}, null, 8, he)) : p("", !0)
|
|
667
|
+
], 42, z)),
|
|
668
|
+
(C(!0), m(l, null, T(N.value, (t) => (C(), m(l, { key: `n-${t.a.id}` }, ["x" in t ? (C(), m("button", {
|
|
669
|
+
key: 0,
|
|
670
|
+
type: "button",
|
|
671
|
+
class: b(["m3-pdf-note absolute flex size-7 -translate-x-1/2 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full shadow-elevation-2 outline-none focus-visible:ring-2 focus-visible:ring-primary", { "ring-2 ring-primary": t.a.id === e.selectedId }]),
|
|
672
|
+
style: x({
|
|
673
|
+
left: `${t.x}px`,
|
|
674
|
+
top: `${t.y}px`,
|
|
675
|
+
backgroundColor: t.a.color
|
|
676
|
+
}),
|
|
677
|
+
"aria-label": t.a.text || "Note",
|
|
678
|
+
onClick: (n) => {
|
|
679
|
+
n.stopPropagation(), e.tool === "eraser" ? a("erase", t.a.id) : a("select", {
|
|
680
|
+
id: t.a.id,
|
|
681
|
+
anchor: n.currentTarget.getBoundingClientRect()
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
}, [_(n, {
|
|
685
|
+
name: "sticky_note_2",
|
|
686
|
+
size: 16,
|
|
687
|
+
filled: "",
|
|
688
|
+
class: "text-black/70"
|
|
689
|
+
})], 14, ge)) : p("", !0)], 64))), 128))
|
|
690
|
+
], 12, R));
|
|
691
|
+
}
|
|
692
|
+
}), ve = ["aria-label"], ye = {
|
|
693
|
+
key: 0,
|
|
694
|
+
class: "relative z-10 flex h-16 shrink-0 items-center gap-1 bg-surface-container px-1 sm:px-2"
|
|
695
|
+
}, be = { class: "min-w-0 flex-1 truncate px-1 text-title-medium" }, xe = {
|
|
696
|
+
key: 0,
|
|
697
|
+
class: "flex items-center gap-1 text-body-medium text-on-surface-variant"
|
|
698
|
+
}, Se = ["aria-label"], Ce = { class: "tabular-nums" }, we = {
|
|
699
|
+
key: 1,
|
|
700
|
+
class: "mx-1 flex items-center"
|
|
701
|
+
}, Te = ["aria-label"], Ee = {
|
|
702
|
+
key: 0,
|
|
703
|
+
class: "m3-pdf-search z-10 flex shrink-0 items-center gap-1 bg-surface-container px-2 pb-2"
|
|
704
|
+
}, De = { class: "flex h-12 min-w-0 flex-1 items-center gap-2 rounded-full bg-surface-container-highest pr-1 pl-4" }, Oe = ["placeholder", "aria-label"], ke = {
|
|
705
|
+
class: "shrink-0 text-label-medium whitespace-nowrap text-on-surface-variant tabular-nums",
|
|
706
|
+
"aria-live": "polite"
|
|
707
|
+
}, Ae = { class: "relative flex min-h-0 flex-1" }, je = { class: "flex shrink-0 gap-1 px-3 pt-1 pb-2" }, Me = ["disabled", "onClick"], Ne = { class: "flex flex-col items-center gap-3" }, Pe = [
|
|
708
|
+
"aria-label",
|
|
709
|
+
"aria-current",
|
|
710
|
+
"onClick"
|
|
711
|
+
], Fe = ["src"], Ie = ["aria-label"], Le = ["aria-label", "onClick"], Re = {
|
|
712
|
+
key: 1,
|
|
713
|
+
class: "w-8 shrink-0"
|
|
714
|
+
}, ze = { class: "min-w-0 flex-1 truncate" }, Be = {
|
|
715
|
+
key: 0,
|
|
716
|
+
class: "text-label-small text-on-surface-variant tabular-nums"
|
|
717
|
+
}, Ve = { class: "relative min-w-0 flex-1" }, He = {
|
|
718
|
+
key: 1,
|
|
719
|
+
class: "flex h-full items-center justify-center p-6"
|
|
720
|
+
}, Ue = { class: "text-title-medium" }, We = {
|
|
721
|
+
key: 2,
|
|
722
|
+
class: "flex h-full flex-col items-center justify-center gap-2 p-6 text-center text-on-surface-variant"
|
|
723
|
+
}, Ge = { class: "text-title-medium text-on-surface" }, Ke = { class: "text-body-medium" }, qe = {
|
|
724
|
+
key: 3,
|
|
725
|
+
class: "flex h-full items-center justify-center"
|
|
726
|
+
}, Je = {
|
|
727
|
+
key: 4,
|
|
728
|
+
class: "flex h-full items-center justify-center p-6"
|
|
729
|
+
}, Ye = {
|
|
730
|
+
key: 0,
|
|
731
|
+
class: "pointer-events-none absolute inset-y-0 right-0 w-full"
|
|
732
|
+
}, Xe = { class: "rounded-full bg-inverse-surface px-3 py-1 text-label-large text-inverse-on-surface tabular-nums shadow-elevation-1" }, Ze = {
|
|
733
|
+
key: 1,
|
|
734
|
+
class: "w-3"
|
|
735
|
+
}, Qe = ["aria-label"], $e = {
|
|
736
|
+
key: 0,
|
|
737
|
+
class: "absolute inset-x-0 bottom-4 z-10 flex justify-center px-2"
|
|
738
|
+
}, et = ["aria-label"], tt = [
|
|
739
|
+
"aria-label",
|
|
740
|
+
"aria-pressed",
|
|
741
|
+
"onClick"
|
|
742
|
+
], nt = [
|
|
743
|
+
"aria-label",
|
|
744
|
+
"aria-pressed",
|
|
745
|
+
"onClick"
|
|
746
|
+
], rt = { class: "flex items-center gap-1 rounded-full bg-surface-container-high p-1 shadow-elevation-2" }, it = { class: "flex flex-col gap-3 rounded-lg bg-surface-container-high p-3 shadow-elevation-2" }, at = { class: "flex items-center gap-1" }, ot = [
|
|
747
|
+
"aria-label",
|
|
748
|
+
"aria-pressed",
|
|
749
|
+
"onClick"
|
|
750
|
+
];
|
|
751
|
+
function st(e, t) {
|
|
752
|
+
let { x: n, y: r, r: i } = t;
|
|
753
|
+
if (e.type === "note") {
|
|
754
|
+
let [t, a] = e.at ?? [0, 0];
|
|
755
|
+
return Math.hypot(t - n, a - r) <= i + 10 ? null : e;
|
|
756
|
+
}
|
|
757
|
+
if (e.type === "highlight") return (e.rects ?? []).some(([e, t, a, o]) => n >= Math.min(e, a) - i && n <= Math.max(e, a) + i && r >= Math.min(t, o) - i && r <= Math.max(t, o) + i) ? null : e;
|
|
758
|
+
let a = i + (e.width ?? 2) / 2, o = (e, t) => {
|
|
759
|
+
let i = t[0] - e[0], o = t[1] - e[1], s = i * i + o * o, c = s ? Math.max(0, Math.min(1, ((n - e[0]) * i + (r - e[1]) * o) / s)) : 0;
|
|
760
|
+
return Math.hypot(e[0] + c * i - n, e[1] + c * o - r) <= a;
|
|
761
|
+
}, s = !1, c = [];
|
|
762
|
+
for (let t of e.paths ?? []) {
|
|
763
|
+
let e = [];
|
|
764
|
+
t.forEach((i, l) => {
|
|
765
|
+
let u = t[l - 1], d = Math.hypot(i[0] - n, i[1] - r) <= a, f = !!u && e.length > 0 && o(u, i);
|
|
766
|
+
d || f ? (s = !0, e.length > 1 && c.push(e), e = d ? [] : [i]) : e.push(i);
|
|
767
|
+
}), e.length > 1 && c.push(e);
|
|
768
|
+
}
|
|
769
|
+
return s ? c.length ? {
|
|
770
|
+
...e,
|
|
771
|
+
paths: c
|
|
772
|
+
} : null : e;
|
|
773
|
+
}
|
|
774
|
+
//#endregion
|
|
775
|
+
//#region src/components/MPdfViewer.vue
|
|
776
|
+
var W = /* @__PURE__ */ v({
|
|
777
|
+
inheritAttrs: !1,
|
|
778
|
+
__name: "MPdfViewer",
|
|
779
|
+
props: {
|
|
780
|
+
src: { default: null },
|
|
781
|
+
title: {},
|
|
782
|
+
page: { default: void 0 },
|
|
783
|
+
zoom: { default: "fit-width" },
|
|
784
|
+
rotation: { default: 0 },
|
|
785
|
+
annotations: { default: () => [] },
|
|
786
|
+
annotate: {
|
|
787
|
+
type: Boolean,
|
|
788
|
+
default: !1
|
|
789
|
+
},
|
|
790
|
+
tool: { default: "select" },
|
|
791
|
+
colors: { default: () => [
|
|
792
|
+
"#FFE14D",
|
|
793
|
+
"#7ED957",
|
|
794
|
+
"#5EB8FF",
|
|
795
|
+
"#FF7EB6",
|
|
796
|
+
"#B388FF",
|
|
797
|
+
"#1F1F1F"
|
|
798
|
+
] },
|
|
799
|
+
inkWidths: { default: () => [
|
|
800
|
+
1,
|
|
801
|
+
2,
|
|
802
|
+
4,
|
|
803
|
+
8
|
|
804
|
+
] },
|
|
805
|
+
author: {},
|
|
806
|
+
sidebar: { default: null },
|
|
807
|
+
toolbar: {
|
|
808
|
+
type: Boolean,
|
|
809
|
+
default: !0
|
|
810
|
+
},
|
|
811
|
+
downloadable: {
|
|
812
|
+
type: Boolean,
|
|
813
|
+
default: !0
|
|
814
|
+
},
|
|
815
|
+
fileName: {},
|
|
816
|
+
password: {},
|
|
817
|
+
workerSrc: {},
|
|
818
|
+
minZoom: { default: .25 },
|
|
819
|
+
maxZoom: { default: 8 }
|
|
820
|
+
},
|
|
821
|
+
emits: [
|
|
822
|
+
"update:page",
|
|
823
|
+
"update:zoom",
|
|
824
|
+
"update:rotation",
|
|
825
|
+
"update:annotations",
|
|
826
|
+
"update:tool",
|
|
827
|
+
"update:sidebar",
|
|
828
|
+
"loaded",
|
|
829
|
+
"error",
|
|
830
|
+
"link",
|
|
831
|
+
"annotation-click"
|
|
832
|
+
],
|
|
833
|
+
setup(v, { expose: ee, emit: S }) {
|
|
834
|
+
let O = v, M = S, N = e(), P = de(() => O.src, {
|
|
835
|
+
password: () => O.password,
|
|
836
|
+
workerSrc: O.workerSrc
|
|
837
|
+
});
|
|
838
|
+
A(P.doc, (e) => {
|
|
839
|
+
e && M("loaded", e);
|
|
840
|
+
}), A(P.error, (e) => {
|
|
841
|
+
e && M("error", e);
|
|
842
|
+
});
|
|
843
|
+
let F = w(), I = w(), L = w(800), R = w(600), fe = w(800), z = d(() => fe.value < 600), B = 96 / 72, V = w((O.rotation % 360 + 360) % 360);
|
|
844
|
+
A(() => O.rotation, (e) => {
|
|
845
|
+
V.value = (e % 360 + 360) % 360;
|
|
846
|
+
});
|
|
847
|
+
let pe = d(() => {
|
|
848
|
+
let e = V.value % 180 != 0;
|
|
849
|
+
return P.pageSizes.value.map((t) => e ? {
|
|
850
|
+
width: t.height,
|
|
851
|
+
height: t.width
|
|
852
|
+
} : t);
|
|
853
|
+
}), me = w(O.zoom);
|
|
854
|
+
A(() => O.zoom, (e) => {
|
|
855
|
+
e !== me.value && q(e);
|
|
856
|
+
});
|
|
857
|
+
let he = d(() => pe.value[Math.max(0, G.value - 1)] ?? pe.value[0] ?? {
|
|
858
|
+
width: 612,
|
|
859
|
+
height: 792
|
|
860
|
+
});
|
|
861
|
+
function ge(e) {
|
|
862
|
+
let t = (L.value - 2 * (z.value ? 8 : 16)) / he.value.width;
|
|
863
|
+
return e === "fit-width" ? t : Math.min(t, (R.value - 32) / he.value.height);
|
|
864
|
+
}
|
|
865
|
+
let H = d(() => {
|
|
866
|
+
let e = me.value, t = typeof e == "number" ? e * B : ge(e);
|
|
867
|
+
return Math.max(O.minZoom * B, Math.min(O.maxZoom * B, t || B));
|
|
868
|
+
}), _e = d(() => Math.round(H.value / B * 100)), W = d(() => {
|
|
869
|
+
let e = z.value ? 8 : 16, t = e, n = 0;
|
|
870
|
+
return {
|
|
871
|
+
boxes: pe.value.map((e) => {
|
|
872
|
+
let r = Math.floor(e.width * H.value), i = Math.floor(e.height * H.value), a = {
|
|
873
|
+
top: t,
|
|
874
|
+
width: r,
|
|
875
|
+
height: i
|
|
876
|
+
};
|
|
877
|
+
return t += i + 8, n = Math.max(n, r), a;
|
|
878
|
+
}),
|
|
879
|
+
height: t - 8 + e,
|
|
880
|
+
width: n + 2 * e,
|
|
881
|
+
pad: e
|
|
882
|
+
};
|
|
883
|
+
}), ct = w(0);
|
|
884
|
+
function lt(e) {
|
|
885
|
+
let t = W.value.boxes, n = 0, r = t.length - 1;
|
|
886
|
+
for (; n < r;) {
|
|
887
|
+
let i = n + r + 1 >> 1;
|
|
888
|
+
t[i].top <= e ? n = i : r = i - 1;
|
|
889
|
+
}
|
|
890
|
+
return n;
|
|
891
|
+
}
|
|
892
|
+
let G = w(1);
|
|
893
|
+
function ut() {
|
|
894
|
+
if (!W.value.boxes.length) return;
|
|
895
|
+
let e = lt(ct.value + R.value / 3) + 1;
|
|
896
|
+
e !== G.value && (G.value = e, M("update:page", e));
|
|
897
|
+
}
|
|
898
|
+
let dt = d(() => {
|
|
899
|
+
if (!W.value.boxes.length) return /* @__PURE__ */ new Set();
|
|
900
|
+
let e = lt(Math.max(0, ct.value - R.value)), t = lt(ct.value + R.value * 2), n = /* @__PURE__ */ new Set();
|
|
901
|
+
for (let r = e; r <= t; r++) n.add(r + 1);
|
|
902
|
+
return n;
|
|
903
|
+
}), ft, pt = w(!1), mt = null;
|
|
904
|
+
function ht() {
|
|
905
|
+
let e = I.value;
|
|
906
|
+
if (ct.value = e.scrollTop, ut(), mt !== null && Math.abs(e.scrollTop - mt) < 1) {
|
|
907
|
+
mt = null;
|
|
908
|
+
return;
|
|
909
|
+
}
|
|
910
|
+
mt = null, pt.value = !0, clearTimeout(ft), ft = setTimeout(() => pt.value = !1, 1200);
|
|
911
|
+
}
|
|
912
|
+
function K(e, t, n = !1) {
|
|
913
|
+
let r = I.value, i = W.value.boxes[e - 1];
|
|
914
|
+
if (!r || !i) return;
|
|
915
|
+
let a = pe.value[e - 1], o = t !== void 0 && V.value === 0 ? Math.max(0, (a.height - t) * H.value) : 0;
|
|
916
|
+
r.scrollTo({
|
|
917
|
+
top: i.top + o - (o ? 8 : W.value.pad),
|
|
918
|
+
behavior: n ? "smooth" : "auto"
|
|
919
|
+
}), G.value = e, M("update:page", e);
|
|
920
|
+
}
|
|
921
|
+
A(() => O.page, (e) => {
|
|
922
|
+
e && e !== G.value && K(e);
|
|
923
|
+
});
|
|
924
|
+
function q(e, t) {
|
|
925
|
+
let n = I.value, r = typeof e == "number" ? Math.max(O.minZoom, Math.min(O.maxZoom, e)) : e;
|
|
926
|
+
if (!n || !W.value.boxes.length) {
|
|
927
|
+
me.value = r, M("update:zoom", r);
|
|
928
|
+
return;
|
|
929
|
+
}
|
|
930
|
+
let i = n.getBoundingClientRect(), a = t ? t.x - i.left : n.clientWidth / 2, o = t ? t.y - i.top : n.clientHeight / 2, s = n.scrollTop + o, c = lt(s), l = W.value.boxes[c], u = (s - l.top) / l.height, d = (Math.max(W.value.width, n.clientWidth) - l.width) / 2, f = (n.scrollLeft + a - d) / l.width;
|
|
931
|
+
me.value = r, M("update:zoom", r), y(() => {
|
|
932
|
+
let e = W.value.boxes[c], t = Math.max(W.value.width, n.clientWidth);
|
|
933
|
+
n.scrollTop = e.top + u * e.height - o, n.scrollLeft = (t - e.width) / 2 + f * e.width - a, ht();
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
let gt = (e, t) => q(H.value / B * e, t), _t = [
|
|
937
|
+
.5,
|
|
938
|
+
.75,
|
|
939
|
+
1,
|
|
940
|
+
1.25,
|
|
941
|
+
1.5,
|
|
942
|
+
2,
|
|
943
|
+
3,
|
|
944
|
+
4
|
|
945
|
+
];
|
|
946
|
+
function vt(e) {
|
|
947
|
+
let t = H.value / B;
|
|
948
|
+
q(e > 0 ? _t.find((e) => e > t + .01) ?? O.maxZoom : [..._t].reverse().find((e) => e < t - .01) ?? O.minZoom);
|
|
949
|
+
}
|
|
950
|
+
function yt(e) {
|
|
951
|
+
(e.ctrlKey || e.metaKey) && (e.preventDefault(), gt(Math.exp(-e.deltaY * (e.deltaMode === 1 ? .05 : .0025)), {
|
|
952
|
+
x: e.clientX,
|
|
953
|
+
y: e.clientY
|
|
954
|
+
}));
|
|
955
|
+
}
|
|
956
|
+
function bt(e) {
|
|
957
|
+
if (O.tool !== "select" || e.target.closest("button, a, input, textarea")) return;
|
|
958
|
+
let t = ge("fit-width");
|
|
959
|
+
H.value > t * 1.05 ? q("fit-width", {
|
|
960
|
+
x: e.clientX,
|
|
961
|
+
y: e.clientY
|
|
962
|
+
}) : q(Math.min(O.maxZoom, t * 2 / B), {
|
|
963
|
+
x: e.clientX,
|
|
964
|
+
y: e.clientY
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
let xt = null, St = 0, Ct = 1, wt = {
|
|
968
|
+
x: 0,
|
|
969
|
+
y: 0
|
|
970
|
+
};
|
|
971
|
+
function Tt() {
|
|
972
|
+
let e = P.pdfjs.value, t = I.value;
|
|
973
|
+
e && t && !xt && (xt = new AbortController(), new e.TouchManager({
|
|
974
|
+
container: t,
|
|
975
|
+
isPinchingDisabled: () => O.tool === "ink",
|
|
976
|
+
onPinching: (e, t, n) => {
|
|
977
|
+
Ct *= n / (t || n), wt = {
|
|
978
|
+
x: e[0],
|
|
979
|
+
y: e[1]
|
|
980
|
+
}, St ||= requestAnimationFrame(() => {
|
|
981
|
+
St = 0;
|
|
982
|
+
let e = Ct;
|
|
983
|
+
Ct = 1, gt(e, wt);
|
|
984
|
+
});
|
|
985
|
+
},
|
|
986
|
+
signal: xt.signal
|
|
987
|
+
}));
|
|
988
|
+
}
|
|
989
|
+
A(() => P.pdfjs.value, Tt);
|
|
990
|
+
let Et;
|
|
991
|
+
A(P.doc, async (e) => {
|
|
992
|
+
if (!e) return;
|
|
993
|
+
await y();
|
|
994
|
+
let t = O.page && O.page <= e.numPages ? O.page : 1;
|
|
995
|
+
G.value = t, t > 1 ? K(t) : I.value && (I.value.scrollTop = 0), Tt();
|
|
996
|
+
});
|
|
997
|
+
function Dt() {
|
|
998
|
+
let e = G.value;
|
|
999
|
+
V.value = (V.value + 90) % 360, M("update:rotation", V.value), y(() => K(e));
|
|
1000
|
+
}
|
|
1001
|
+
let Ot = w(!1), kt = w(""), J = E([]), Y = w(-1), At = w(!1), jt = null, Mt;
|
|
1002
|
+
A(kt, (e) => {
|
|
1003
|
+
clearTimeout(Mt), Mt = setTimeout(() => Nt(e), 250);
|
|
1004
|
+
});
|
|
1005
|
+
async function Nt(e) {
|
|
1006
|
+
if (jt?.abort(), J.value = [], Y.value = -1, !e.trim() || !P.doc.value) return;
|
|
1007
|
+
let t = jt = new AbortController();
|
|
1008
|
+
At.value = !0;
|
|
1009
|
+
let n = await P.search(e, { signal: t.signal });
|
|
1010
|
+
if (t.signal.aborted) return;
|
|
1011
|
+
At.value = !1, J.value = n;
|
|
1012
|
+
let r = n.findIndex((e) => e.page >= G.value);
|
|
1013
|
+
n.length && Pt(r < 0 ? 0 : r);
|
|
1014
|
+
}
|
|
1015
|
+
function Pt(e) {
|
|
1016
|
+
let t = J.value.length;
|
|
1017
|
+
if (!t) return;
|
|
1018
|
+
Y.value = (e % t + t) % t;
|
|
1019
|
+
let n = J.value[Y.value];
|
|
1020
|
+
(!dt.value.has(n.page) || Math.abs(n.page - G.value) > 0) && K(n.page), Ft = !0;
|
|
1021
|
+
}
|
|
1022
|
+
let Ft = !1, It = d(() => {
|
|
1023
|
+
let e = /* @__PURE__ */ new Map();
|
|
1024
|
+
return J.value.forEach((t, n) => {
|
|
1025
|
+
let r = e.get(t.page) ?? [];
|
|
1026
|
+
r.push({
|
|
1027
|
+
start: t.start,
|
|
1028
|
+
end: t.end,
|
|
1029
|
+
current: n === Y.value
|
|
1030
|
+
}), e.set(t.page, r);
|
|
1031
|
+
}), e;
|
|
1032
|
+
}), Lt = [], Rt = ie(/* @__PURE__ */ new Map());
|
|
1033
|
+
function zt(e, t) {
|
|
1034
|
+
t ? Rt.set(e, t) : Rt.delete(e);
|
|
1035
|
+
}
|
|
1036
|
+
A(() => {
|
|
1037
|
+
let e = J.value[Y.value];
|
|
1038
|
+
return e ? Rt.get(e.page)?.currentHit : null;
|
|
1039
|
+
}, (e) => {
|
|
1040
|
+
if (!e || !Ft || !I.value) return;
|
|
1041
|
+
Ft = !1;
|
|
1042
|
+
let t = e.getBoundingClientRect(), n = I.value.getBoundingClientRect();
|
|
1043
|
+
I.value.scrollBy({
|
|
1044
|
+
top: t.top - n.top - n.height / 2,
|
|
1045
|
+
left: t.left < n.left || t.right > n.right ? t.left - n.left - n.width / 2 : 0
|
|
1046
|
+
});
|
|
1047
|
+
});
|
|
1048
|
+
function Bt() {
|
|
1049
|
+
Ot.value = !0, y(() => F.value?.querySelector(".m3-pdf-search input")?.focus());
|
|
1050
|
+
}
|
|
1051
|
+
function Vt() {
|
|
1052
|
+
Ot.value = !1, kt.value = "", jt?.abort(), J.value = [], Y.value = -1;
|
|
1053
|
+
}
|
|
1054
|
+
let Ht = d(() => kt.value.trim() ? At.value ? "…" : J.value.length ? N.pdfMatchCount.replace("{current}", String(Y.value + 1)).replace("{total}", String(J.value.length)) : N.pdfNoMatches : ""), X = w(O.sidebar);
|
|
1055
|
+
A(() => O.sidebar, (e) => {
|
|
1056
|
+
X.value = e;
|
|
1057
|
+
});
|
|
1058
|
+
function Ut(e) {
|
|
1059
|
+
X.value = e, M("update:sidebar", e);
|
|
1060
|
+
}
|
|
1061
|
+
let Wt = ie(/* @__PURE__ */ new Map()), Gt = w(), Kt = null;
|
|
1062
|
+
function qt(e, t) {
|
|
1063
|
+
e instanceof HTMLElement && (e.dataset.page = String(t), Kt?.observe(e));
|
|
1064
|
+
}
|
|
1065
|
+
A([X, P.doc], async ([e, t]) => {
|
|
1066
|
+
Kt?.disconnect(), Wt.clear(), !(e !== "thumbnails" || !t || typeof IntersectionObserver > "u") && (await y(), Kt = new IntersectionObserver((e) => {
|
|
1067
|
+
for (let t of e) {
|
|
1068
|
+
if (!t.isIntersecting) continue;
|
|
1069
|
+
let e = Number(t.target.dataset.page);
|
|
1070
|
+
Wt.has(e) || (Wt.set(e, ""), P.thumbnail(e, 120).then((t) => Wt.set(e, t), () => {}));
|
|
1071
|
+
}
|
|
1072
|
+
}, {
|
|
1073
|
+
root: Gt.value,
|
|
1074
|
+
rootMargin: "200px"
|
|
1075
|
+
}), Gt.value?.querySelectorAll("[data-page]").forEach((e) => Kt.observe(e)), Gt.value?.querySelector(`[data-page="${G.value}"]`)?.scrollIntoView({ block: "center" }));
|
|
1076
|
+
});
|
|
1077
|
+
function Jt(e, t) {
|
|
1078
|
+
K(e, t), z.value && Ut(null);
|
|
1079
|
+
}
|
|
1080
|
+
let Yt = ie(/* @__PURE__ */ new Set()), Xt = d(() => {
|
|
1081
|
+
let e = [], t = (n, r, i) => {
|
|
1082
|
+
n.forEach((n, a) => {
|
|
1083
|
+
let o = `${i}${a}`;
|
|
1084
|
+
e.push({
|
|
1085
|
+
key: o,
|
|
1086
|
+
title: n.title,
|
|
1087
|
+
page: n.page,
|
|
1088
|
+
top: n.top,
|
|
1089
|
+
url: n.url,
|
|
1090
|
+
depth: r,
|
|
1091
|
+
hasChildren: n.children.length > 0
|
|
1092
|
+
}), n.children.length && Yt.has(o) && t(n.children, r + 1, `${o}.`);
|
|
1093
|
+
});
|
|
1094
|
+
};
|
|
1095
|
+
return t(P.outline.value, 0, ""), e;
|
|
1096
|
+
});
|
|
1097
|
+
function Zt(e) {
|
|
1098
|
+
Yt.has(e) ? Yt.delete(e) : Yt.add(e);
|
|
1099
|
+
}
|
|
1100
|
+
async function Qt(e) {
|
|
1101
|
+
if (e.url) {
|
|
1102
|
+
M("link", { url: e.url });
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
let t = await P.resolveDest(e.dest);
|
|
1106
|
+
t && (K(t.page, t.top), M("link", { page: t.page }));
|
|
1107
|
+
}
|
|
1108
|
+
let $t = w(O.tool);
|
|
1109
|
+
A(() => O.tool, (e) => {
|
|
1110
|
+
$t.value = e;
|
|
1111
|
+
});
|
|
1112
|
+
function en(e) {
|
|
1113
|
+
$t.value = e, M("update:tool", e), $.value = null, Z.value = null;
|
|
1114
|
+
}
|
|
1115
|
+
let tn = w(O.colors[0]), nn = w(O.inkWidths[1] ?? O.inkWidths[0] ?? 2), rn = w(!1);
|
|
1116
|
+
A(() => O.annotate, (e) => {
|
|
1117
|
+
e || on();
|
|
1118
|
+
});
|
|
1119
|
+
function an() {
|
|
1120
|
+
rn.value = !0, en("highlight");
|
|
1121
|
+
}
|
|
1122
|
+
function on() {
|
|
1123
|
+
rn.value = !1, en("select");
|
|
1124
|
+
}
|
|
1125
|
+
let sn = d(() => {
|
|
1126
|
+
let e = /* @__PURE__ */ new Map();
|
|
1127
|
+
for (let t of O.annotations) {
|
|
1128
|
+
let n = e.get(t.page) ?? [];
|
|
1129
|
+
n.push(t), e.set(t.page, n);
|
|
1130
|
+
}
|
|
1131
|
+
return e;
|
|
1132
|
+
}), cn = [], ln = [];
|
|
1133
|
+
function un(e) {
|
|
1134
|
+
ln.push(O.annotations), ln.length > 50 && ln.shift(), dn.value = !0, M("update:annotations", e);
|
|
1135
|
+
}
|
|
1136
|
+
let dn = w(!1);
|
|
1137
|
+
function fn() {
|
|
1138
|
+
let e = ln.pop();
|
|
1139
|
+
dn.value = ln.length > 0, e && M("update:annotations", e), Z.value = null;
|
|
1140
|
+
}
|
|
1141
|
+
function pn(e) {
|
|
1142
|
+
O.author && (e.author = O.author), un([...O.annotations, e]), e.type === "note" && y(() => bn(e.id));
|
|
1143
|
+
}
|
|
1144
|
+
function mn(e) {
|
|
1145
|
+
un(O.annotations.filter((t) => t.id !== e)), Z.value?.id === e && (Z.value = null);
|
|
1146
|
+
}
|
|
1147
|
+
function hn() {
|
|
1148
|
+
ln.push(O.annotations), ln.length > 50 && ln.shift(), dn.value = !0;
|
|
1149
|
+
}
|
|
1150
|
+
function gn(e, t) {
|
|
1151
|
+
let n = !1, r = [];
|
|
1152
|
+
for (let i of O.annotations) {
|
|
1153
|
+
let a = i.page === e ? st(i, t) : i;
|
|
1154
|
+
a !== i && (n = !0), a && r.push(a);
|
|
1155
|
+
}
|
|
1156
|
+
n && (Z.value && !r.some((e) => e.id === Z.value.id) && (Z.value = null), M("update:annotations", r));
|
|
1157
|
+
}
|
|
1158
|
+
function _n(e, t) {
|
|
1159
|
+
M("update:annotations", O.annotations.map((n) => n.id === e ? {
|
|
1160
|
+
...n,
|
|
1161
|
+
...t
|
|
1162
|
+
} : n));
|
|
1163
|
+
}
|
|
1164
|
+
let Z = w(null), Q = d(() => O.annotations.find((e) => e.id === Z.value?.id) ?? null);
|
|
1165
|
+
function vn(e) {
|
|
1166
|
+
let t = F.value.getBoundingClientRect();
|
|
1167
|
+
return {
|
|
1168
|
+
x: Math.min(Math.max(8, e.left - t.left + e.width / 2), t.width - 8),
|
|
1169
|
+
y: e.bottom - t.top + 8
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
function yn(e) {
|
|
1173
|
+
if (!e) {
|
|
1174
|
+
Z.value = null;
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
$.value = null, Z.value = {
|
|
1178
|
+
id: e.id,
|
|
1179
|
+
...vn(e.anchor)
|
|
1180
|
+
};
|
|
1181
|
+
let t = O.annotations.find((t) => t.id === e.id);
|
|
1182
|
+
t && M("annotation-click", t);
|
|
1183
|
+
}
|
|
1184
|
+
function bn(e) {
|
|
1185
|
+
let t = F.value?.querySelector(".m3-pdf-note[aria-label]"), n = O.annotations.find((t) => t.id === e);
|
|
1186
|
+
if (!n) return;
|
|
1187
|
+
let r = [...(Rt.get(n.page)?.root)?.querySelectorAll(".m3-pdf-note") ?? []].pop() ?? t;
|
|
1188
|
+
r && (Z.value = {
|
|
1189
|
+
id: e,
|
|
1190
|
+
...vn(r.getBoundingClientRect())
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
let xn = d(() => {
|
|
1194
|
+
let e = Z.value ?? $.value;
|
|
1195
|
+
if (!e) return {};
|
|
1196
|
+
let t = Math.min(300, fe.value - 16);
|
|
1197
|
+
return {
|
|
1198
|
+
left: `${Math.min(Math.max(8, e.x - t / 2), fe.value - t - 8)}px`,
|
|
1199
|
+
top: `${e.y}px`,
|
|
1200
|
+
width: `${t}px`
|
|
1201
|
+
};
|
|
1202
|
+
}), $ = w(null);
|
|
1203
|
+
function Sn(e) {
|
|
1204
|
+
if (!e || !O.annotate) {
|
|
1205
|
+
$.value = null;
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
Z.value = null, $.value = {
|
|
1209
|
+
page: e.page,
|
|
1210
|
+
rects: e.rects,
|
|
1211
|
+
quote: e.quote,
|
|
1212
|
+
...vn(e.anchor)
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
function Cn() {
|
|
1216
|
+
let e = $.value;
|
|
1217
|
+
e && (pn({
|
|
1218
|
+
id: crypto.randomUUID?.() ?? String(Date.now()),
|
|
1219
|
+
type: "highlight",
|
|
1220
|
+
page: e.page,
|
|
1221
|
+
color: tn.value,
|
|
1222
|
+
rects: e.rects,
|
|
1223
|
+
quote: e.quote,
|
|
1224
|
+
text: "",
|
|
1225
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1226
|
+
}), window.getSelection()?.removeAllRanges(), $.value = null);
|
|
1227
|
+
}
|
|
1228
|
+
async function wn() {
|
|
1229
|
+
let e = $.value;
|
|
1230
|
+
e && await navigator.clipboard?.writeText(e.quote).catch(() => {}), window.getSelection()?.removeAllRanges(), $.value = null;
|
|
1231
|
+
}
|
|
1232
|
+
A(ct, () => {
|
|
1233
|
+
$.value = null, Q.value?.type !== "note" && (Z.value = null);
|
|
1234
|
+
});
|
|
1235
|
+
let Tn = typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches, En = d(() => {
|
|
1236
|
+
let e = I.value, t = W.value.height - R.value;
|
|
1237
|
+
return ct.value, e && t > 0 ? ct.value / t * (R.value - 48) : 0;
|
|
1238
|
+
}), Dn = w(!1);
|
|
1239
|
+
function On(e) {
|
|
1240
|
+
e.preventDefault(), Dn.value = !0, e.currentTarget.setPointerCapture(e.pointerId);
|
|
1241
|
+
let t = e.clientY, n = I.value.scrollTop, r = W.value.height - R.value, i = (e) => {
|
|
1242
|
+
I.value.scrollTop = n + (e.clientY - t) / Math.max(1, R.value - 48) * r;
|
|
1243
|
+
}, a = () => {
|
|
1244
|
+
Dn.value = !1, window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
|
|
1245
|
+
};
|
|
1246
|
+
window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
1247
|
+
}
|
|
1248
|
+
let kn = w(!1);
|
|
1249
|
+
async function An() {
|
|
1250
|
+
document.fullscreenElement ? await document.exitFullscreen().catch(() => {}) : await F.value?.requestFullscreen?.().catch(() => {});
|
|
1251
|
+
}
|
|
1252
|
+
let jn = () => {
|
|
1253
|
+
kn.value = document.fullscreenElement === F.value;
|
|
1254
|
+
};
|
|
1255
|
+
function Mn(e) {
|
|
1256
|
+
let t = !!e.target.closest("input, textarea, [contenteditable]"), n = e.ctrlKey || e.metaKey;
|
|
1257
|
+
if (n && e.key.toLowerCase() === "f") e.preventDefault(), Bt();
|
|
1258
|
+
else if (n && (e.key === "=" || e.key === "+")) e.preventDefault(), vt(1);
|
|
1259
|
+
else if (n && e.key === "-") e.preventDefault(), vt(-1);
|
|
1260
|
+
else if (n && e.key === "0") e.preventDefault(), q("fit-width");
|
|
1261
|
+
else if (n && e.key.toLowerCase() === "z" && !t && O.annotate) e.preventDefault(), fn();
|
|
1262
|
+
else if (e.key === "Escape") {
|
|
1263
|
+
if (Z.value || $.value) Z.value = null, $.value = null;
|
|
1264
|
+
else if (Ot.value) Vt();
|
|
1265
|
+
else if (rn.value) on();
|
|
1266
|
+
else return;
|
|
1267
|
+
e.stopPropagation();
|
|
1268
|
+
} else !t && (e.key === "Delete" || e.key === "Backspace") && Z.value ? mn(Z.value.id) : !t && !n && (e.key === "PageDown" || e.key === "PageUp") && (e.preventDefault(), K(Math.max(1, Math.min(P.numPages.value, G.value + (e.key === "PageDown" ? 1 : -1)))));
|
|
1269
|
+
}
|
|
1270
|
+
let Nn = w("");
|
|
1271
|
+
A(G, (e) => {
|
|
1272
|
+
Nn.value = String(e);
|
|
1273
|
+
}, { immediate: !0 });
|
|
1274
|
+
function Pn() {
|
|
1275
|
+
let e = Math.round(Number(Nn.value));
|
|
1276
|
+
e >= 1 && e <= P.numPages.value ? K(e) : Nn.value = String(G.value);
|
|
1277
|
+
}
|
|
1278
|
+
let Fn = w("");
|
|
1279
|
+
function In() {
|
|
1280
|
+
P.submitPassword(Fn.value), Fn.value = "";
|
|
1281
|
+
}
|
|
1282
|
+
let Ln = d(() => O.title ?? P.metadata.value.title ?? "");
|
|
1283
|
+
re(() => {
|
|
1284
|
+
let e = I.value;
|
|
1285
|
+
e.addEventListener("wheel", yt, { passive: !1 }), Et = new ResizeObserver(() => {
|
|
1286
|
+
let t = W.value.boxes, n = R.value / 3, r = t.length ? lt(e.scrollTop + n) : -1, i = r >= 0 ? (e.scrollTop + n - t[r].top) / t[r].height : 0;
|
|
1287
|
+
L.value = e.clientWidth, R.value = e.clientHeight, fe.value = F.value?.clientWidth ?? fe.value, !(r < 0) && y(() => {
|
|
1288
|
+
let t = W.value.boxes[r];
|
|
1289
|
+
if (!t) return;
|
|
1290
|
+
let a = Math.round(t.top + i * t.height - n);
|
|
1291
|
+
Math.abs(a - e.scrollTop) < 1 || (e.scrollTop = a, ct.value = e.scrollTop, ut(), mt = e.scrollTop);
|
|
1292
|
+
});
|
|
1293
|
+
}), Et.observe(e), Et.observe(F.value), L.value = e.clientWidth || L.value, R.value = e.clientHeight || R.value, fe.value = F.value.clientWidth || fe.value, document.addEventListener("fullscreenchange", jn);
|
|
1294
|
+
}), ne(() => {
|
|
1295
|
+
Et?.disconnect(), xt?.abort(), Kt?.disconnect(), jt?.abort(), cancelAnimationFrame(St), clearTimeout(ft), clearTimeout(Mt), document.removeEventListener("fullscreenchange", jn);
|
|
1296
|
+
}), ee({
|
|
1297
|
+
pdf: P,
|
|
1298
|
+
goToPage: (e) => K(e),
|
|
1299
|
+
setZoom: (e) => q(e),
|
|
1300
|
+
search: (e) => {
|
|
1301
|
+
Bt(), kt.value = e;
|
|
1302
|
+
},
|
|
1303
|
+
undo: fn
|
|
1304
|
+
});
|
|
1305
|
+
let Rn = d(() => [
|
|
1306
|
+
{
|
|
1307
|
+
id: "select",
|
|
1308
|
+
icon: "arrow_selector_tool",
|
|
1309
|
+
label: N.pdfSelect
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
id: "highlight",
|
|
1313
|
+
icon: "ink_highlighter",
|
|
1314
|
+
label: N.pdfHighlight
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
id: "note",
|
|
1318
|
+
icon: "sticky_note_2",
|
|
1319
|
+
label: N.pdfNote
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
id: "ink",
|
|
1323
|
+
icon: "draw",
|
|
1324
|
+
label: N.pdfDraw
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
id: "eraser",
|
|
1328
|
+
icon: "ink_eraser",
|
|
1329
|
+
label: N.pdfEraser
|
|
1330
|
+
}
|
|
1331
|
+
]);
|
|
1332
|
+
return (e, d) => (C(), m("div", te({
|
|
1333
|
+
ref_key: "root",
|
|
1334
|
+
ref: F
|
|
1335
|
+
}, e.$attrs, {
|
|
1336
|
+
role: "region",
|
|
1337
|
+
"aria-label": Ln.value || k(N).pdfViewer,
|
|
1338
|
+
class: "m3-pdf bg-surface-container text-on-surface",
|
|
1339
|
+
onKeydown: Mn
|
|
1340
|
+
}), [
|
|
1341
|
+
v.toolbar ? (C(), m("div", ye, [
|
|
1342
|
+
_(t, {
|
|
1343
|
+
icon: X.value ? "left_panel_close" : "left_panel_open",
|
|
1344
|
+
label: k(N).pdfThumbnails,
|
|
1345
|
+
disabled: !k(P).doc.value,
|
|
1346
|
+
onClick: d[0] ||= (e) => Ut(X.value ? null : "thumbnails")
|
|
1347
|
+
}, null, 8, [
|
|
1348
|
+
"icon",
|
|
1349
|
+
"label",
|
|
1350
|
+
"disabled"
|
|
1351
|
+
]),
|
|
1352
|
+
h("p", be, D(Ln.value), 1),
|
|
1353
|
+
k(P).doc.value ? (C(), m(l, { key: 0 }, [
|
|
1354
|
+
z.value ? p("", !0) : (C(), m("div", xe, [ce(h("input", {
|
|
1355
|
+
"onUpdate:modelValue": d[1] ||= (e) => Nn.value = e,
|
|
1356
|
+
inputmode: "numeric",
|
|
1357
|
+
class: "h-8 w-11 rounded-sm bg-surface-container-highest text-center text-body-medium text-on-surface tabular-nums outline-none focus:ring-2 focus:ring-primary",
|
|
1358
|
+
"aria-label": k(N).pdfPage,
|
|
1359
|
+
onKeydown: le(Pn, ["enter"]),
|
|
1360
|
+
onBlur: Pn
|
|
1361
|
+
}, null, 40, Se), [[se, Nn.value]]), h("span", Ce, "/ " + D(k(P).numPages.value), 1)])),
|
|
1362
|
+
z.value ? p("", !0) : (C(), m("div", we, [
|
|
1363
|
+
_(t, {
|
|
1364
|
+
icon: "remove",
|
|
1365
|
+
label: k(N).pdfZoomOut,
|
|
1366
|
+
size: "xs",
|
|
1367
|
+
onClick: d[2] ||= (e) => vt(-1)
|
|
1368
|
+
}, null, 8, ["label"]),
|
|
1369
|
+
_(a, { align: "right" }, {
|
|
1370
|
+
trigger: j(() => [h("button", {
|
|
1371
|
+
type: "button",
|
|
1372
|
+
class: "h-8 min-w-14 cursor-pointer rounded-full px-2 text-label-large tabular-nums hover:bg-on-surface/8",
|
|
1373
|
+
"aria-label": k(N).pdfZoom
|
|
1374
|
+
}, D(_e.value) + "%", 9, Te)]),
|
|
1375
|
+
default: j(() => [
|
|
1376
|
+
_(o, {
|
|
1377
|
+
icon: "fit_width",
|
|
1378
|
+
selected: me.value === "fit-width",
|
|
1379
|
+
onClick: d[3] ||= (e) => q("fit-width")
|
|
1380
|
+
}, {
|
|
1381
|
+
default: j(() => [g(D(k(N).pdfFitWidth), 1)]),
|
|
1382
|
+
_: 1
|
|
1383
|
+
}, 8, ["selected"]),
|
|
1384
|
+
_(o, {
|
|
1385
|
+
icon: "fit_page",
|
|
1386
|
+
selected: me.value === "fit-page",
|
|
1387
|
+
onClick: d[4] ||= (e) => q("fit-page")
|
|
1388
|
+
}, {
|
|
1389
|
+
default: j(() => [g(D(k(N).pdfFitPage), 1)]),
|
|
1390
|
+
_: 1
|
|
1391
|
+
}, 8, ["selected"]),
|
|
1392
|
+
(C(), m(l, null, T(_t, (e) => _(o, {
|
|
1393
|
+
key: e,
|
|
1394
|
+
selected: me.value === e,
|
|
1395
|
+
onClick: (t) => q(e)
|
|
1396
|
+
}, {
|
|
1397
|
+
default: j(() => [g(D(e * 100) + "%", 1)]),
|
|
1398
|
+
_: 2
|
|
1399
|
+
}, 1032, ["selected", "onClick"])), 64))
|
|
1400
|
+
]),
|
|
1401
|
+
_: 1
|
|
1402
|
+
}),
|
|
1403
|
+
_(t, {
|
|
1404
|
+
icon: "add",
|
|
1405
|
+
label: k(N).pdfZoomIn,
|
|
1406
|
+
size: "xs",
|
|
1407
|
+
onClick: d[5] ||= (e) => vt(1)
|
|
1408
|
+
}, null, 8, ["label"])
|
|
1409
|
+
])),
|
|
1410
|
+
_(t, {
|
|
1411
|
+
icon: "search",
|
|
1412
|
+
label: k(N).pdfSearch,
|
|
1413
|
+
checked: Ot.value,
|
|
1414
|
+
"onUpdate:checked": d[6] ||= (e) => e ? Bt() : Vt()
|
|
1415
|
+
}, null, 8, ["label", "checked"]),
|
|
1416
|
+
ae(e.$slots, "actions", { pdf: k(P) }),
|
|
1417
|
+
_(a, { align: "right" }, {
|
|
1418
|
+
trigger: j(() => [_(t, {
|
|
1419
|
+
icon: "more_vert",
|
|
1420
|
+
label: k(N).pdfMore
|
|
1421
|
+
}, null, 8, ["label"])]),
|
|
1422
|
+
default: j(() => [
|
|
1423
|
+
z.value ? (C(), m(l, { key: 0 }, [
|
|
1424
|
+
_(o, {
|
|
1425
|
+
icon: "zoom_in",
|
|
1426
|
+
onClick: d[7] ||= (e) => vt(1)
|
|
1427
|
+
}, {
|
|
1428
|
+
default: j(() => [g(D(k(N).pdfZoomIn), 1)]),
|
|
1429
|
+
_: 1
|
|
1430
|
+
}),
|
|
1431
|
+
_(o, {
|
|
1432
|
+
icon: "zoom_out",
|
|
1433
|
+
onClick: d[8] ||= (e) => vt(-1)
|
|
1434
|
+
}, {
|
|
1435
|
+
default: j(() => [g(D(k(N).pdfZoomOut), 1)]),
|
|
1436
|
+
_: 1
|
|
1437
|
+
}),
|
|
1438
|
+
_(o, {
|
|
1439
|
+
icon: "fit_width",
|
|
1440
|
+
onClick: d[9] ||= (e) => q("fit-width")
|
|
1441
|
+
}, {
|
|
1442
|
+
default: j(() => [g(D(k(N).pdfFitWidth), 1)]),
|
|
1443
|
+
_: 1
|
|
1444
|
+
})
|
|
1445
|
+
], 64)) : p("", !0),
|
|
1446
|
+
_(o, {
|
|
1447
|
+
icon: "list",
|
|
1448
|
+
disabled: !k(P).outline.value.length,
|
|
1449
|
+
onClick: d[10] ||= (e) => Ut("outline")
|
|
1450
|
+
}, {
|
|
1451
|
+
default: j(() => [g(D(k(N).pdfOutline), 1)]),
|
|
1452
|
+
_: 1
|
|
1453
|
+
}, 8, ["disabled"]),
|
|
1454
|
+
_(o, {
|
|
1455
|
+
icon: "rotate_right",
|
|
1456
|
+
onClick: Dt
|
|
1457
|
+
}, {
|
|
1458
|
+
default: j(() => [g(D(k(N).pdfRotate), 1)]),
|
|
1459
|
+
_: 1
|
|
1460
|
+
}),
|
|
1461
|
+
v.downloadable ? (C(), f(o, {
|
|
1462
|
+
key: 1,
|
|
1463
|
+
icon: "download",
|
|
1464
|
+
onClick: d[11] ||= (e) => k(P).download(v.fileName)
|
|
1465
|
+
}, {
|
|
1466
|
+
default: j(() => [g(D(k(N).pdfDownload), 1)]),
|
|
1467
|
+
_: 1
|
|
1468
|
+
})) : p("", !0),
|
|
1469
|
+
v.downloadable ? (C(), f(o, {
|
|
1470
|
+
key: 2,
|
|
1471
|
+
icon: "print",
|
|
1472
|
+
onClick: d[12] ||= (e) => k(P).print()
|
|
1473
|
+
}, {
|
|
1474
|
+
default: j(() => [g(D(k(N).pdfPrint), 1)]),
|
|
1475
|
+
_: 1
|
|
1476
|
+
})) : p("", !0),
|
|
1477
|
+
_(o, {
|
|
1478
|
+
icon: kn.value ? "fullscreen_exit" : "fullscreen",
|
|
1479
|
+
onClick: An
|
|
1480
|
+
}, {
|
|
1481
|
+
default: j(() => [g(D(kn.value ? k(N).pdfExitFullscreen : k(N).pdfFullscreen), 1)]),
|
|
1482
|
+
_: 1
|
|
1483
|
+
}, 8, ["icon"])
|
|
1484
|
+
]),
|
|
1485
|
+
_: 1
|
|
1486
|
+
})
|
|
1487
|
+
], 64)) : p("", !0),
|
|
1488
|
+
k(P).loading.value ? (C(), f(c, {
|
|
1489
|
+
key: 1,
|
|
1490
|
+
value: k(P).progress.value ? k(P).progress.value * 100 : void 0,
|
|
1491
|
+
indeterminate: !k(P).progress.value,
|
|
1492
|
+
class: "absolute inset-x-0 bottom-0"
|
|
1493
|
+
}, null, 8, ["value", "indeterminate"])) : p("", !0)
|
|
1494
|
+
])) : p("", !0),
|
|
1495
|
+
_(u, { name: "m3-pdf-drop" }, {
|
|
1496
|
+
default: j(() => [Ot.value ? (C(), m("div", Ee, [h("div", De, [
|
|
1497
|
+
_(n, {
|
|
1498
|
+
name: "search",
|
|
1499
|
+
size: 20,
|
|
1500
|
+
class: "text-on-surface-variant"
|
|
1501
|
+
}),
|
|
1502
|
+
ce(h("input", {
|
|
1503
|
+
"onUpdate:modelValue": d[13] ||= (e) => kt.value = e,
|
|
1504
|
+
type: "search",
|
|
1505
|
+
class: "min-w-0 flex-1 bg-transparent text-body-large outline-none placeholder:text-on-surface-variant",
|
|
1506
|
+
placeholder: k(N).pdfSearch,
|
|
1507
|
+
"aria-label": k(N).pdfSearch,
|
|
1508
|
+
onKeydown: d[14] ||= le(ue((e) => Pt(Y.value + (e.shiftKey ? -1 : 1)), ["prevent"]), ["enter"])
|
|
1509
|
+
}, null, 40, Oe), [[se, kt.value]]),
|
|
1510
|
+
h("span", ke, D(Ht.value), 1),
|
|
1511
|
+
_(t, {
|
|
1512
|
+
icon: "keyboard_arrow_up",
|
|
1513
|
+
label: k(N).pdfSearchPrevious,
|
|
1514
|
+
size: "xs",
|
|
1515
|
+
disabled: !J.value.length,
|
|
1516
|
+
onClick: d[15] ||= (e) => Pt(Y.value - 1)
|
|
1517
|
+
}, null, 8, ["label", "disabled"]),
|
|
1518
|
+
_(t, {
|
|
1519
|
+
icon: "keyboard_arrow_down",
|
|
1520
|
+
label: k(N).pdfSearchNext,
|
|
1521
|
+
size: "xs",
|
|
1522
|
+
disabled: !J.value.length,
|
|
1523
|
+
onClick: d[16] ||= (e) => Pt(Y.value + 1)
|
|
1524
|
+
}, null, 8, ["label", "disabled"])
|
|
1525
|
+
]), _(t, {
|
|
1526
|
+
icon: "close",
|
|
1527
|
+
label: k(N).close,
|
|
1528
|
+
onClick: Vt
|
|
1529
|
+
}, null, 8, ["label"])])) : p("", !0)]),
|
|
1530
|
+
_: 1
|
|
1531
|
+
}),
|
|
1532
|
+
h("div", Ae, [
|
|
1533
|
+
_(u, { name: "m3-pdf-fade" }, {
|
|
1534
|
+
default: j(() => [X.value && z.value ? (C(), m("div", {
|
|
1535
|
+
key: 0,
|
|
1536
|
+
class: "absolute inset-0 z-20 bg-scrim/32",
|
|
1537
|
+
onClick: d[17] ||= (e) => Ut(null)
|
|
1538
|
+
})) : p("", !0)]),
|
|
1539
|
+
_: 1
|
|
1540
|
+
}),
|
|
1541
|
+
_(u, { name: "m3-pdf-panel" }, {
|
|
1542
|
+
default: j(() => [X.value && k(P).doc.value ? (C(), m("aside", {
|
|
1543
|
+
key: 0,
|
|
1544
|
+
class: b(["flex w-56 shrink-0 flex-col bg-surface-container", z.value ? "absolute inset-y-0 left-0 z-30 rounded-r-lg shadow-elevation-2" : "relative"])
|
|
1545
|
+
}, [h("div", je, [(C(), m(l, null, T(["thumbnails", "outline"], (e) => h("button", {
|
|
1546
|
+
key: e,
|
|
1547
|
+
type: "button",
|
|
1548
|
+
class: b(["h-8 flex-1 cursor-pointer rounded-full text-label-large transition-colors", X.value === e ? "bg-secondary-container text-on-secondary-container" : "text-on-surface-variant hover:bg-on-surface/8"]),
|
|
1549
|
+
disabled: e === "outline" && !k(P).outline.value.length,
|
|
1550
|
+
onClick: (t) => Ut(e)
|
|
1551
|
+
}, D(e === "thumbnails" ? k(N).pdfThumbnails : k(N).pdfOutline), 11, Me)), 64))]), X.value === "thumbnails" ? (C(), m("div", {
|
|
1552
|
+
key: 0,
|
|
1553
|
+
ref_key: "thumbList",
|
|
1554
|
+
ref: Gt,
|
|
1555
|
+
class: "min-h-0 flex-1 overflow-y-auto px-3 pb-3"
|
|
1556
|
+
}, [h("div", Ne, [(C(!0), m(l, null, T(k(P).numPages.value, (e) => (C(), m("button", {
|
|
1557
|
+
key: e,
|
|
1558
|
+
ref_for: !0,
|
|
1559
|
+
ref: (t) => qt(t, e),
|
|
1560
|
+
type: "button",
|
|
1561
|
+
class: "group flex cursor-pointer flex-col items-center gap-1 outline-none",
|
|
1562
|
+
"aria-label": `${k(N).pdfPage} ${e}`,
|
|
1563
|
+
"aria-current": e === G.value ? "page" : void 0,
|
|
1564
|
+
onClick: (t) => Jt(e)
|
|
1565
|
+
}, [h("span", {
|
|
1566
|
+
class: b(["block w-30 overflow-hidden rounded-sm bg-white shadow-elevation-1 ring-offset-2 ring-offset-surface-container transition-shadow group-focus-visible:ring-2 group-focus-visible:ring-secondary", e === G.value && "ring-3 ring-primary"]),
|
|
1567
|
+
style: x({ aspectRatio: `${pe.value[e - 1]?.width ?? 3} / ${pe.value[e - 1]?.height ?? 4}` })
|
|
1568
|
+
}, [Wt.get(e) ? (C(), m("img", {
|
|
1569
|
+
key: 0,
|
|
1570
|
+
src: Wt.get(e),
|
|
1571
|
+
alt: "",
|
|
1572
|
+
class: "h-full w-full object-contain",
|
|
1573
|
+
style: x({ transform: V.value ? `rotate(${V.value}deg)` : void 0 })
|
|
1574
|
+
}, null, 12, Fe)) : p("", !0)], 6), h("span", { class: b(["text-label-medium tabular-nums", e === G.value ? "text-primary" : "text-on-surface-variant"]) }, D(e), 3)], 8, Pe))), 128))])], 512)) : (C(), m("nav", {
|
|
1575
|
+
key: 1,
|
|
1576
|
+
class: "min-h-0 flex-1 overflow-y-auto px-2 pb-3",
|
|
1577
|
+
"aria-label": k(N).pdfOutline
|
|
1578
|
+
}, [(C(!0), m(l, null, T(Xt.value, (e) => (C(), m("div", {
|
|
1579
|
+
key: e.key,
|
|
1580
|
+
class: "flex items-center",
|
|
1581
|
+
style: x({ paddingLeft: `${e.depth * 12}px` })
|
|
1582
|
+
}, [e.hasChildren ? (C(), m("button", {
|
|
1583
|
+
key: 0,
|
|
1584
|
+
type: "button",
|
|
1585
|
+
class: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full text-on-surface-variant hover:bg-on-surface/8",
|
|
1586
|
+
"aria-label": Yt.has(e.key) ? k(N).collapse : k(N).expand,
|
|
1587
|
+
onClick: (t) => Zt(e.key)
|
|
1588
|
+
}, [_(n, {
|
|
1589
|
+
name: Yt.has(e.key) ? "expand_more" : "chevron_right",
|
|
1590
|
+
size: 20
|
|
1591
|
+
}, null, 8, ["name"])], 8, Le)) : (C(), m("span", Re)), (C(), f(oe(e.url ? "a" : "button"), {
|
|
1592
|
+
href: e.url,
|
|
1593
|
+
target: e.url ? "_blank" : void 0,
|
|
1594
|
+
type: e.url ? void 0 : "button",
|
|
1595
|
+
class: "flex min-h-10 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-full px-3 text-left text-label-large hover:bg-on-surface/8",
|
|
1596
|
+
onClick: (t) => e.page && Jt(e.page, e.top)
|
|
1597
|
+
}, {
|
|
1598
|
+
default: j(() => [h("span", ze, D(e.title), 1), e.page ? (C(), m("span", Be, D(e.page), 1)) : p("", !0)]),
|
|
1599
|
+
_: 2
|
|
1600
|
+
}, 1032, [
|
|
1601
|
+
"href",
|
|
1602
|
+
"target",
|
|
1603
|
+
"type",
|
|
1604
|
+
"onClick"
|
|
1605
|
+
]))], 4))), 128))], 8, Ie))], 2)) : p("", !0)]),
|
|
1606
|
+
_: 1
|
|
1607
|
+
}),
|
|
1608
|
+
h("div", Ve, [
|
|
1609
|
+
h("div", {
|
|
1610
|
+
ref_key: "scroller",
|
|
1611
|
+
ref: I,
|
|
1612
|
+
class: b(["m3-pdf-scroller absolute inset-0 overflow-auto overscroll-contain bg-surface-container-highest outline-none", [$t.value === "select" ? "" : "m3-pdf-annotating", k(Tn) && "scrollbar-none"]]),
|
|
1613
|
+
tabindex: "0",
|
|
1614
|
+
onScroll: ht,
|
|
1615
|
+
onDblclick: bt
|
|
1616
|
+
}, [k(P).doc.value ? (C(), m("div", {
|
|
1617
|
+
key: 0,
|
|
1618
|
+
class: "relative mx-auto",
|
|
1619
|
+
style: x({
|
|
1620
|
+
width: `${W.value.width}px`,
|
|
1621
|
+
height: `${W.value.height}px`
|
|
1622
|
+
})
|
|
1623
|
+
}, [(C(!0), m(l, null, T(W.value.boxes, (e, t) => (C(), m("div", {
|
|
1624
|
+
key: t,
|
|
1625
|
+
class: "absolute left-1/2 -translate-x-1/2",
|
|
1626
|
+
style: x({
|
|
1627
|
+
top: `${e.top}px`,
|
|
1628
|
+
width: `${e.width}px`,
|
|
1629
|
+
height: `${e.height}px`
|
|
1630
|
+
})
|
|
1631
|
+
}, [_(U, {
|
|
1632
|
+
ref_for: !0,
|
|
1633
|
+
ref: (e) => zt(t + 1, e),
|
|
1634
|
+
pdf: k(P),
|
|
1635
|
+
page: t + 1,
|
|
1636
|
+
scale: H.value,
|
|
1637
|
+
rotation: V.value,
|
|
1638
|
+
active: dt.value.has(t + 1),
|
|
1639
|
+
hits: It.value.get(t + 1) ?? Lt,
|
|
1640
|
+
annotations: sn.value.get(t + 1) ?? cn,
|
|
1641
|
+
tool: $t.value,
|
|
1642
|
+
color: tn.value,
|
|
1643
|
+
"ink-width": nn.value,
|
|
1644
|
+
"selected-id": Z.value?.id ?? null,
|
|
1645
|
+
class: "h-full w-full",
|
|
1646
|
+
onLink: Qt,
|
|
1647
|
+
onAdd: pn,
|
|
1648
|
+
onErase: mn,
|
|
1649
|
+
onEraseStart: hn,
|
|
1650
|
+
onEraseAt: (e) => gn(t + 1, e),
|
|
1651
|
+
onSelect: yn,
|
|
1652
|
+
onTextSelection: Sn
|
|
1653
|
+
}, null, 8, [
|
|
1654
|
+
"pdf",
|
|
1655
|
+
"page",
|
|
1656
|
+
"scale",
|
|
1657
|
+
"rotation",
|
|
1658
|
+
"active",
|
|
1659
|
+
"hits",
|
|
1660
|
+
"annotations",
|
|
1661
|
+
"tool",
|
|
1662
|
+
"color",
|
|
1663
|
+
"ink-width",
|
|
1664
|
+
"selected-id",
|
|
1665
|
+
"onEraseAt"
|
|
1666
|
+
])], 4))), 128))], 4)) : k(P).needsPassword.value ? (C(), m("div", He, [h("form", {
|
|
1667
|
+
class: "flex w-full max-w-sm flex-col items-center gap-4 rounded-xl bg-surface-container-low p-6 text-center shadow-elevation-1",
|
|
1668
|
+
onSubmit: ue(In, ["prevent"])
|
|
1669
|
+
}, [
|
|
1670
|
+
_(n, {
|
|
1671
|
+
name: "lock",
|
|
1672
|
+
size: 32,
|
|
1673
|
+
class: "text-primary"
|
|
1674
|
+
}),
|
|
1675
|
+
h("p", Ue, D(k(N).pdfPassword), 1),
|
|
1676
|
+
_(r, {
|
|
1677
|
+
modelValue: Fn.value,
|
|
1678
|
+
"onUpdate:modelValue": d[18] ||= (e) => Fn.value = e,
|
|
1679
|
+
type: "password",
|
|
1680
|
+
label: k(N).pdfPasswordLabel,
|
|
1681
|
+
error: k(P).wrongPassword.value,
|
|
1682
|
+
"error-label": k(P).wrongPassword.value ? k(N).pdfWrongPassword : void 0,
|
|
1683
|
+
autocomplete: "off",
|
|
1684
|
+
class: "w-full"
|
|
1685
|
+
}, null, 8, [
|
|
1686
|
+
"modelValue",
|
|
1687
|
+
"label",
|
|
1688
|
+
"error",
|
|
1689
|
+
"error-label"
|
|
1690
|
+
]),
|
|
1691
|
+
_(i, {
|
|
1692
|
+
type: "submit",
|
|
1693
|
+
disabled: !Fn.value,
|
|
1694
|
+
class: "self-end"
|
|
1695
|
+
}, {
|
|
1696
|
+
default: j(() => [g(D(k(N).pdfOpen), 1)]),
|
|
1697
|
+
_: 1
|
|
1698
|
+
}, 8, ["disabled"])
|
|
1699
|
+
], 32)])) : k(P).error.value ? (C(), m("div", We, [
|
|
1700
|
+
_(n, {
|
|
1701
|
+
name: "error",
|
|
1702
|
+
size: 32,
|
|
1703
|
+
class: "text-error"
|
|
1704
|
+
}),
|
|
1705
|
+
h("p", Ge, D(k(N).pdfError), 1),
|
|
1706
|
+
h("p", Ke, D(k(P).error.value.message), 1)
|
|
1707
|
+
])) : k(P).loading.value ? (C(), m("div", qe, [_(s, { label: k(N).pdfLoading }, null, 8, ["label"])])) : (C(), m("div", Je, [ae(e.$slots, "empty")]))], 34),
|
|
1708
|
+
_(u, { name: "m3-pdf-fade" }, {
|
|
1709
|
+
default: j(() => [k(P).doc.value && (pt.value || Dn.value) && k(P).numPages.value > 1 ? (C(), m("div", Ye, [h("div", {
|
|
1710
|
+
class: "absolute right-1 flex items-center gap-2",
|
|
1711
|
+
style: x({ top: `${k(Tn) ? En.value : Math.min(R.value - 40, Math.max(8, En.value))}px` })
|
|
1712
|
+
}, [h("span", Xe, D(G.value) + " / " + D(k(P).numPages.value), 1), k(Tn) ? (C(), m("span", {
|
|
1713
|
+
key: 0,
|
|
1714
|
+
class: "pointer-events-auto flex h-12 w-6 touch-none items-center justify-center",
|
|
1715
|
+
onPointerdown: On
|
|
1716
|
+
}, [...d[23] ||= [h("span", { class: "h-12 w-1.5 rounded-full bg-on-surface-variant" }, null, -1)]], 32)) : (C(), m("span", Ze))], 4)])) : p("", !0)]),
|
|
1717
|
+
_: 1
|
|
1718
|
+
}),
|
|
1719
|
+
_(u, { name: "m3-pdf-fade" }, {
|
|
1720
|
+
default: j(() => [v.annotate && k(P).doc.value && !rn.value ? (C(), m("button", {
|
|
1721
|
+
key: 0,
|
|
1722
|
+
type: "button",
|
|
1723
|
+
class: "absolute right-4 bottom-4 flex size-14 cursor-pointer items-center justify-center rounded-lg bg-primary-container text-on-primary-container shadow-elevation-3 transition-shadow outline-none hover:shadow-elevation-4 focus-visible:ring-2 focus-visible:ring-primary",
|
|
1724
|
+
"aria-label": k(N).pdfAnnotate,
|
|
1725
|
+
onClick: an
|
|
1726
|
+
}, [_(n, {
|
|
1727
|
+
name: "edit",
|
|
1728
|
+
size: 24
|
|
1729
|
+
})], 8, Qe)) : p("", !0)]),
|
|
1730
|
+
_: 1
|
|
1731
|
+
}),
|
|
1732
|
+
_(u, { name: "m3-pdf-rise" }, {
|
|
1733
|
+
default: j(() => [v.annotate && rn.value ? (C(), m("div", $e, [h("div", {
|
|
1734
|
+
class: "flex max-w-full items-center gap-1 overflow-x-auto rounded-full bg-surface-container-high p-2 shadow-elevation-3 scrollbar-none",
|
|
1735
|
+
role: "toolbar",
|
|
1736
|
+
"aria-label": k(N).pdfAnnotate
|
|
1737
|
+
}, [
|
|
1738
|
+
(C(!0), m(l, null, T(Rn.value, (e) => (C(), f(t, {
|
|
1739
|
+
key: e.id,
|
|
1740
|
+
icon: e.icon,
|
|
1741
|
+
label: e.label,
|
|
1742
|
+
checked: $t.value === e.id,
|
|
1743
|
+
variant: "standard",
|
|
1744
|
+
"onUpdate:checked": (t) => en(e.id)
|
|
1745
|
+
}, null, 8, [
|
|
1746
|
+
"icon",
|
|
1747
|
+
"label",
|
|
1748
|
+
"checked",
|
|
1749
|
+
"onUpdate:checked"
|
|
1750
|
+
]))), 128)),
|
|
1751
|
+
d[25] ||= h("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
|
|
1752
|
+
(C(!0), m(l, null, T(v.colors, (e) => (C(), m("button", {
|
|
1753
|
+
key: e,
|
|
1754
|
+
type: "button",
|
|
1755
|
+
class: "flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
1756
|
+
"aria-label": `${k(N).pdfColor} ${e}`,
|
|
1757
|
+
"aria-pressed": tn.value === e,
|
|
1758
|
+
onClick: (t) => tn.value = e
|
|
1759
|
+
}, [h("span", {
|
|
1760
|
+
class: b(["size-6 rounded-full border border-outline-variant transition-transform", tn.value === e && "scale-125 ring-2 ring-on-surface ring-offset-2 ring-offset-surface-container-high"]),
|
|
1761
|
+
style: x({ backgroundColor: e })
|
|
1762
|
+
}, null, 6)], 8, tt))), 128)),
|
|
1763
|
+
$t.value === "ink" && v.inkWidths.length > 1 ? (C(), m(l, { key: 0 }, [d[24] ||= h("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1), (C(!0), m(l, null, T(v.inkWidths, (e) => (C(), m("button", {
|
|
1764
|
+
key: e,
|
|
1765
|
+
type: "button",
|
|
1766
|
+
class: b(["flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-primary", nn.value === e && "bg-secondary-container"]),
|
|
1767
|
+
"aria-label": k(N).pdfInkWidth.replace("{n}", String(e)),
|
|
1768
|
+
"aria-pressed": nn.value === e,
|
|
1769
|
+
onClick: (t) => nn.value = e
|
|
1770
|
+
}, [h("span", {
|
|
1771
|
+
class: "rounded-full",
|
|
1772
|
+
style: x({
|
|
1773
|
+
width: `${Math.min(22, 3 + e * 2)}px`,
|
|
1774
|
+
height: `${Math.min(22, 3 + e * 2)}px`,
|
|
1775
|
+
backgroundColor: tn.value
|
|
1776
|
+
})
|
|
1777
|
+
}, null, 4)], 10, nt))), 128))], 64)) : p("", !0),
|
|
1778
|
+
d[26] ||= h("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
|
|
1779
|
+
_(t, {
|
|
1780
|
+
icon: "undo",
|
|
1781
|
+
label: k(N).pdfUndo,
|
|
1782
|
+
disabled: !dn.value,
|
|
1783
|
+
onClick: fn
|
|
1784
|
+
}, null, 8, ["label", "disabled"]),
|
|
1785
|
+
_(t, {
|
|
1786
|
+
icon: "close",
|
|
1787
|
+
label: k(N).close,
|
|
1788
|
+
onClick: on
|
|
1789
|
+
}, null, 8, ["label"])
|
|
1790
|
+
], 8, et)])) : p("", !0)]),
|
|
1791
|
+
_: 1
|
|
1792
|
+
})
|
|
1793
|
+
])
|
|
1794
|
+
]),
|
|
1795
|
+
$.value ? (C(), m("div", {
|
|
1796
|
+
key: 1,
|
|
1797
|
+
class: "absolute z-40 flex justify-center",
|
|
1798
|
+
style: x(xn.value)
|
|
1799
|
+
}, [h("div", rt, [_(i, {
|
|
1800
|
+
variant: "text",
|
|
1801
|
+
icon: "content_copy",
|
|
1802
|
+
size: "sm",
|
|
1803
|
+
onClick: wn
|
|
1804
|
+
}, {
|
|
1805
|
+
default: j(() => [g(D(k(N).pdfCopy), 1)]),
|
|
1806
|
+
_: 1
|
|
1807
|
+
}), _(i, {
|
|
1808
|
+
variant: "text",
|
|
1809
|
+
icon: "ink_highlighter",
|
|
1810
|
+
size: "sm",
|
|
1811
|
+
onClick: Cn
|
|
1812
|
+
}, {
|
|
1813
|
+
default: j(() => [g(D(k(N).pdfHighlight), 1)]),
|
|
1814
|
+
_: 1
|
|
1815
|
+
})])], 4)) : p("", !0),
|
|
1816
|
+
Z.value && Q.value ? (C(), m("div", {
|
|
1817
|
+
key: 2,
|
|
1818
|
+
class: "absolute z-40",
|
|
1819
|
+
style: x(xn.value),
|
|
1820
|
+
onKeydown: d[22] ||= ue((e) => e.key === "Escape" && (Z.value = null), ["stop"])
|
|
1821
|
+
}, [h("div", it, [
|
|
1822
|
+
Q.value.quote ? (C(), m("p", {
|
|
1823
|
+
key: 0,
|
|
1824
|
+
class: "line-clamp-3 border-l-4 pl-2 text-body-medium text-on-surface-variant",
|
|
1825
|
+
style: x({ borderColor: Q.value.color })
|
|
1826
|
+
}, D(Q.value.quote), 5)) : p("", !0),
|
|
1827
|
+
_(r, {
|
|
1828
|
+
"model-value": Q.value.text ?? "",
|
|
1829
|
+
label: Q.value.type === "note" ? k(N).pdfNotePlaceholder : k(N).pdfAddComment,
|
|
1830
|
+
multiline: "",
|
|
1831
|
+
"auto-grow": "",
|
|
1832
|
+
rows: 2,
|
|
1833
|
+
"max-rows": 6,
|
|
1834
|
+
variant: "outlined",
|
|
1835
|
+
"field-bg": "var(--color-surface-container-high)",
|
|
1836
|
+
"onUpdate:modelValue": d[19] ||= (e) => _n(Q.value.id, { text: String(e) })
|
|
1837
|
+
}, null, 8, ["model-value", "label"]),
|
|
1838
|
+
h("div", at, [
|
|
1839
|
+
(C(!0), m(l, null, T(v.colors, (e) => (C(), m("button", {
|
|
1840
|
+
key: e,
|
|
1841
|
+
type: "button",
|
|
1842
|
+
class: "flex size-8 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
1843
|
+
"aria-label": `${k(N).pdfColor} ${e}`,
|
|
1844
|
+
"aria-pressed": Q.value.color === e,
|
|
1845
|
+
onClick: (t) => _n(Q.value.id, { color: e })
|
|
1846
|
+
}, [h("span", {
|
|
1847
|
+
class: b(["size-5 rounded-full border border-outline-variant", Q.value.color === e && "ring-2 ring-on-surface ring-offset-1 ring-offset-surface-container-high"]),
|
|
1848
|
+
style: x({ backgroundColor: e })
|
|
1849
|
+
}, null, 6)], 8, ot))), 128)),
|
|
1850
|
+
d[27] ||= h("span", { class: "flex-1" }, null, -1),
|
|
1851
|
+
_(t, {
|
|
1852
|
+
icon: "delete",
|
|
1853
|
+
label: k(N).pdfDelete,
|
|
1854
|
+
size: "xs",
|
|
1855
|
+
onClick: d[20] ||= (e) => mn(Q.value.id)
|
|
1856
|
+
}, null, 8, ["label"]),
|
|
1857
|
+
_(t, {
|
|
1858
|
+
icon: "check",
|
|
1859
|
+
label: k(N).close,
|
|
1860
|
+
size: "xs",
|
|
1861
|
+
onClick: d[21] ||= (e) => Z.value = null
|
|
1862
|
+
}, null, 8, ["label"])
|
|
1863
|
+
])
|
|
1864
|
+
])], 36)) : p("", !0)
|
|
1865
|
+
], 16, ve));
|
|
1866
|
+
}
|
|
1867
|
+
});
|
|
1868
|
+
//#endregion
|
|
1869
|
+
export { W as MPdfViewer, N as setPdfWorker, de as usePdf };
|
|
1870
|
+
|
|
1871
|
+
//# sourceMappingURL=pdf.js.map
|