@makefully/notefully 0.1.35 → 0.1.37
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/README.md +8 -1
- package/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +20 -19
- package/dist/notefully.js +830 -653
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function
|
|
1
|
+
function He(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
5
5
|
return window.location.protocol + t;
|
|
6
6
|
if (t.match(/^[a-z]+:/i))
|
|
7
7
|
return t;
|
|
8
|
-
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"),
|
|
9
|
-
return n.head.appendChild(r), n.body.appendChild(
|
|
8
|
+
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), a = n.createElement("a");
|
|
9
|
+
return n.head.appendChild(r), n.body.appendChild(a), e && (r.href = e), a.href = t, a.href;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const De = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -16,33 +16,33 @@ const Re = /* @__PURE__ */ (() => {
|
|
|
16
16
|
);
|
|
17
17
|
return () => (t += 1, `u${e()}${t}`);
|
|
18
18
|
})();
|
|
19
|
-
function
|
|
19
|
+
function H(t) {
|
|
20
20
|
const e = [];
|
|
21
21
|
for (let n = 0, r = t.length; n < r; n++)
|
|
22
22
|
e.push(t[n]);
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
|
-
let
|
|
26
|
-
function
|
|
27
|
-
return
|
|
25
|
+
let q = null;
|
|
26
|
+
function ae(t = {}) {
|
|
27
|
+
return q || (t.includeStyleProperties ? (q = t.includeStyleProperties, q) : (q = H(window.getComputedStyle(document.documentElement)), q));
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function rt(t, e) {
|
|
30
30
|
const r = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
|
|
31
31
|
return r ? parseFloat(r.replace("px", "")) : 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const e =
|
|
33
|
+
function Fe(t) {
|
|
34
|
+
const e = rt(t, "border-left-width"), n = rt(t, "border-right-width");
|
|
35
35
|
return t.clientWidth + e + n;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const e =
|
|
37
|
+
function Ue(t) {
|
|
38
|
+
const e = rt(t, "border-top-width"), n = rt(t, "border-bottom-width");
|
|
39
39
|
return t.clientHeight + e + n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const n = e.width ||
|
|
41
|
+
function oe(t, e = {}) {
|
|
42
|
+
const n = e.width || Fe(t), r = e.height || Ue(t);
|
|
43
43
|
return { width: n, height: r };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Ne() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -51,11 +51,11 @@ function ke() {
|
|
|
51
51
|
const n = e && e.env ? e.env.devicePixelRatio : null;
|
|
52
52
|
return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
function
|
|
56
|
-
(t.width >
|
|
54
|
+
const E = 16384;
|
|
55
|
+
function je(t) {
|
|
56
|
+
(t.width > E || t.height > E) && (t.width > E && t.height > E ? t.width > t.height ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E) : t.width > E ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E));
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function it(t) {
|
|
59
59
|
return new Promise((e, n) => {
|
|
60
60
|
const r = new Image();
|
|
61
61
|
r.onload = () => {
|
|
@@ -65,175 +65,175 @@ function tt(t) {
|
|
|
65
65
|
}, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
68
|
+
async function _e(t) {
|
|
69
69
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
70
70
|
}
|
|
71
|
-
async function
|
|
72
|
-
const r = "http://www.w3.org/2000/svg",
|
|
73
|
-
return
|
|
71
|
+
async function Ve(t, e, n) {
|
|
72
|
+
const r = "http://www.w3.org/2000/svg", a = document.createElementNS(r, "svg"), i = document.createElementNS(r, "foreignObject");
|
|
73
|
+
return a.setAttribute("width", `${e}`), a.setAttribute("height", `${n}`), a.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), a.appendChild(i), i.appendChild(t), _e(a);
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const x = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
77
77
|
return !0;
|
|
78
78
|
const n = Object.getPrototypeOf(t);
|
|
79
|
-
return n === null ? !1 : n.constructor.name === e.name ||
|
|
79
|
+
return n === null ? !1 : n.constructor.name === e.name || x(n, e);
|
|
80
80
|
};
|
|
81
|
-
function
|
|
81
|
+
function We(t) {
|
|
82
82
|
const e = t.getPropertyValue("content");
|
|
83
83
|
return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
87
|
-
const r = t.getPropertyValue(n),
|
|
88
|
-
return `${n}: ${r}${
|
|
85
|
+
function ze(t, e) {
|
|
86
|
+
return ae(e).map((n) => {
|
|
87
|
+
const r = t.getPropertyValue(n), a = t.getPropertyPriority(n);
|
|
88
|
+
return `${n}: ${r}${a ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
return document.createTextNode(`${
|
|
91
|
+
function qe(t, e, n, r) {
|
|
92
|
+
const a = `.${t}:${e}`, i = n.cssText ? We(n) : ze(n, r);
|
|
93
|
+
return document.createTextNode(`${a}{${i}}`);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
95
|
+
function Nt(t, e, n, r) {
|
|
96
|
+
const a = window.getComputedStyle(t, n), i = a.getPropertyValue("content");
|
|
97
97
|
if (i === "" || i === "none")
|
|
98
98
|
return;
|
|
99
|
-
const
|
|
99
|
+
const o = De();
|
|
100
100
|
try {
|
|
101
|
-
e.className = `${e.className} ${
|
|
101
|
+
e.className = `${e.className} ${o}`;
|
|
102
102
|
} catch {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
const c = document.createElement("style");
|
|
106
|
-
c.appendChild(
|
|
106
|
+
c.appendChild(qe(o, n, a, r)), e.appendChild(c);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function Ke(t, e, n) {
|
|
109
|
+
Nt(t, e, ":before", n), Nt(t, e, ":after", n);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
woff:
|
|
113
|
-
woff2:
|
|
111
|
+
const jt = "application/font-woff", _t = "image/jpeg", Xe = {
|
|
112
|
+
woff: jt,
|
|
113
|
+
woff2: jt,
|
|
114
114
|
ttf: "application/font-truetype",
|
|
115
115
|
eot: "application/vnd.ms-fontobject",
|
|
116
116
|
png: "image/png",
|
|
117
|
-
jpg:
|
|
118
|
-
jpeg:
|
|
117
|
+
jpg: _t,
|
|
118
|
+
jpeg: _t,
|
|
119
119
|
gif: "image/gif",
|
|
120
120
|
tiff: "image/tiff",
|
|
121
121
|
svg: "image/svg+xml",
|
|
122
122
|
webp: "image/webp"
|
|
123
123
|
};
|
|
124
|
-
function
|
|
124
|
+
function Ye(t) {
|
|
125
125
|
const e = /\.([^./]*?)$/g.exec(t);
|
|
126
126
|
return e ? e[1] : "";
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
const e =
|
|
130
|
-
return
|
|
128
|
+
function $t(t) {
|
|
129
|
+
const e = Ye(t).toLowerCase();
|
|
130
|
+
return Xe[e] || "";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Ge(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function vt(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Je(t, e) {
|
|
139
139
|
return `data:${e};base64,${t}`;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function se(t, e, n) {
|
|
142
142
|
const r = await fetch(t, e);
|
|
143
143
|
if (r.status === 404)
|
|
144
144
|
throw new Error(`Resource "${r.url}" not found`);
|
|
145
|
-
const
|
|
146
|
-
return new Promise((i,
|
|
145
|
+
const a = await r.blob();
|
|
146
|
+
return new Promise((i, o) => {
|
|
147
147
|
const c = new FileReader();
|
|
148
|
-
c.onerror =
|
|
148
|
+
c.onerror = o, c.onloadend = () => {
|
|
149
149
|
try {
|
|
150
150
|
i(n({ res: r, result: c.result }));
|
|
151
151
|
} catch (l) {
|
|
152
|
-
|
|
152
|
+
o(l);
|
|
153
153
|
}
|
|
154
|
-
}, c.readAsDataURL(
|
|
154
|
+
}, c.readAsDataURL(a);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
function
|
|
157
|
+
const mt = {};
|
|
158
|
+
function Qe(t, e, n) {
|
|
159
159
|
let r = t.replace(/\?.*/, "");
|
|
160
160
|
return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
|
|
161
161
|
}
|
|
162
|
-
async function
|
|
163
|
-
const r =
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
162
|
+
async function Tt(t, e, n) {
|
|
163
|
+
const r = Qe(t, e, n.includeQueryParams);
|
|
164
|
+
if (mt[r] != null)
|
|
165
|
+
return mt[r];
|
|
166
166
|
n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
|
-
let
|
|
167
|
+
let a;
|
|
168
168
|
try {
|
|
169
|
-
const i = await
|
|
170
|
-
|
|
169
|
+
const i = await se(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), Ge(c)));
|
|
170
|
+
a = Je(i, e);
|
|
171
171
|
} catch (i) {
|
|
172
|
-
|
|
173
|
-
let
|
|
174
|
-
i && (
|
|
172
|
+
a = n.imagePlaceholder || "";
|
|
173
|
+
let o = `Failed to fetch resource: ${t}`;
|
|
174
|
+
i && (o = typeof i == "string" ? i : i.message), o && console.warn(o);
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return mt[r] = a, a;
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function Ze(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
180
|
-
return e === "data:," ? t.cloneNode(!1) :
|
|
180
|
+
return e === "data:," ? t.cloneNode(!1) : it(e);
|
|
181
181
|
}
|
|
182
|
-
async function
|
|
182
|
+
async function tn(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
|
-
const i = document.createElement("canvas"),
|
|
185
|
-
i.width = t.clientWidth, i.height = t.clientHeight,
|
|
184
|
+
const i = document.createElement("canvas"), o = i.getContext("2d");
|
|
185
|
+
i.width = t.clientWidth, i.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, i.width, i.height);
|
|
186
186
|
const c = i.toDataURL();
|
|
187
|
-
return
|
|
187
|
+
return it(c);
|
|
188
188
|
}
|
|
189
|
-
const n = t.poster, r =
|
|
190
|
-
return
|
|
189
|
+
const n = t.poster, r = $t(n), a = await Tt(n, r, e);
|
|
190
|
+
return it(a);
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function en(t, e) {
|
|
193
193
|
var n;
|
|
194
194
|
try {
|
|
195
195
|
if (!((n = t == null ? void 0 : t.contentDocument) === null || n === void 0) && n.body)
|
|
196
|
-
return await
|
|
196
|
+
return await ut(t.contentDocument.body, e, !0);
|
|
197
197
|
} catch {
|
|
198
198
|
}
|
|
199
199
|
return t.cloneNode(!1);
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
return
|
|
201
|
+
async function nn(t, e) {
|
|
202
|
+
return x(t, HTMLCanvasElement) ? Ze(t) : x(t, HTMLVideoElement) ? tn(t, e) : x(t, HTMLIFrameElement) ? en(t, e) : t.cloneNode(ce(t));
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
async function
|
|
206
|
-
var r,
|
|
207
|
-
if (
|
|
204
|
+
const rn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ce = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
|
+
async function an(t, e, n) {
|
|
206
|
+
var r, a;
|
|
207
|
+
if (ce(e))
|
|
208
208
|
return e;
|
|
209
209
|
let i = [];
|
|
210
|
-
return
|
|
210
|
+
return rn(t) && t.assignedNodes ? i = H(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = H(t.contentDocument.body.childNodes) : i = H(((a = t.shadowRoot) !== null && a !== void 0 ? a : t).childNodes), i.length === 0 || x(t, HTMLVideoElement) || await i.reduce((o, c) => o.then(() => ut(c, n)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function on(t, e, n) {
|
|
215
215
|
const r = e.style;
|
|
216
216
|
if (!r)
|
|
217
217
|
return;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
let
|
|
221
|
-
i === "font-size" &&
|
|
218
|
+
const a = window.getComputedStyle(t);
|
|
219
|
+
a.cssText ? (r.cssText = a.cssText, r.transformOrigin = a.transformOrigin) : ae(n).forEach((i) => {
|
|
220
|
+
let o = a.getPropertyValue(i);
|
|
221
|
+
i === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && i === "display" && o === "inline" && (o = "block"), i === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(i, o, a.getPropertyPriority(i));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
224
|
+
function sn(t, e) {
|
|
225
|
+
x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
if (
|
|
229
|
-
const r = Array.from(e.children).find((
|
|
227
|
+
function cn(t, e) {
|
|
228
|
+
if (x(t, HTMLSelectElement)) {
|
|
229
|
+
const r = Array.from(e.children).find((a) => t.value === a.getAttribute("value"));
|
|
230
230
|
r && r.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return
|
|
233
|
+
function ln(t, e, n) {
|
|
234
|
+
return x(e, Element) && (on(t, e, n), Ke(t, e, n), sn(t, e), cn(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function un(t, e) {
|
|
237
237
|
const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (n.length === 0)
|
|
239
239
|
return t;
|
|
@@ -242,136 +242,136 @@ async function tn(t, e) {
|
|
|
242
242
|
const c = n[i].getAttribute("xlink:href");
|
|
243
243
|
if (c) {
|
|
244
244
|
const l = t.querySelector(c), u = document.querySelector(c);
|
|
245
|
-
!l && u && !r[c] && (r[c] = await
|
|
245
|
+
!l && u && !r[c] && (r[c] = await ut(u, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
const i = "http://www.w3.org/1999/xhtml",
|
|
251
|
-
|
|
248
|
+
const a = Object.values(r);
|
|
249
|
+
if (a.length) {
|
|
250
|
+
const i = "http://www.w3.org/1999/xhtml", o = document.createElementNS(i, "svg");
|
|
251
|
+
o.setAttribute("xmlns", i), o.style.position = "absolute", o.style.width = "0", o.style.height = "0", o.style.overflow = "hidden", o.style.display = "none";
|
|
252
252
|
const c = document.createElementNS(i, "defs");
|
|
253
|
-
|
|
254
|
-
for (let l = 0; l <
|
|
255
|
-
c.appendChild(
|
|
256
|
-
t.appendChild(
|
|
253
|
+
o.appendChild(c);
|
|
254
|
+
for (let l = 0; l < a.length; l++)
|
|
255
|
+
c.appendChild(a[l]);
|
|
256
|
+
t.appendChild(o);
|
|
257
257
|
}
|
|
258
258
|
return t;
|
|
259
259
|
}
|
|
260
|
-
async function
|
|
261
|
-
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) =>
|
|
260
|
+
async function ut(t, e, n) {
|
|
261
|
+
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => nn(r, e)).then((r) => an(t, r, e)).then((r) => ln(t, r, e)).then((r) => un(r, e));
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
263
|
+
const le = /url\((['"]?)([^'"]+?)\1\)/g, dn = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, fn = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
|
+
function hn(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function pn(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(
|
|
270
|
+
return t.replace(le, (n, r, a) => (e.push(a), n)), e.filter((n) => !vt(n));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function mn(t, e, n, r, a) {
|
|
273
273
|
try {
|
|
274
|
-
const i = n ?
|
|
274
|
+
const i = n ? He(e, n) : e, o = $t(e);
|
|
275
275
|
let c;
|
|
276
|
-
return
|
|
276
|
+
return a || (c = await Tt(i, o, r)), t.replace(hn(e), `$1${c}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return e ? t.replace(
|
|
281
|
+
function yn(t, { preferredFontFormat: e }) {
|
|
282
|
+
return e ? t.replace(fn, (n) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [r, ,
|
|
285
|
-
if (!
|
|
284
|
+
const [r, , a] = dn.exec(n) || [];
|
|
285
|
+
if (!a)
|
|
286
286
|
return "";
|
|
287
|
-
if (
|
|
287
|
+
if (a === e)
|
|
288
288
|
return `src: ${r};`;
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return t.search(
|
|
292
|
+
function ue(t) {
|
|
293
|
+
return t.search(le) !== -1;
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
if (!
|
|
295
|
+
async function de(t, e, n) {
|
|
296
|
+
if (!ue(t))
|
|
297
297
|
return t;
|
|
298
|
-
const r =
|
|
299
|
-
return
|
|
298
|
+
const r = yn(t, n);
|
|
299
|
+
return pn(r).reduce((i, o) => i.then((c) => mn(c, o, e, n)), Promise.resolve(r));
|
|
300
300
|
}
|
|
301
|
-
async function
|
|
301
|
+
async function K(t, e, n) {
|
|
302
302
|
var r;
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
const i = await
|
|
303
|
+
const a = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
|
|
304
|
+
if (a) {
|
|
305
|
+
const i = await de(a, null, n);
|
|
306
306
|
return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
311
|
-
await
|
|
310
|
+
async function gn(t, e) {
|
|
311
|
+
await K("background", t, e) || await K("background-image", t, e), await K("mask", t, e) || await K("-webkit-mask", t, e) || await K("mask-image", t, e) || await K("-webkit-mask-image", t, e);
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
314
|
-
const n =
|
|
315
|
-
if (!(n && !
|
|
313
|
+
async function wn(t, e) {
|
|
314
|
+
const n = x(t, HTMLImageElement);
|
|
315
|
+
if (!(n && !vt(t.src)) && !(x(t, SVGImageElement) && !vt(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const r = n ? t.src : t.href.baseVal,
|
|
318
|
-
await new Promise((i,
|
|
317
|
+
const r = n ? t.src : t.href.baseVal, a = await Tt(r, $t(r), e);
|
|
318
|
+
await new Promise((i, o) => {
|
|
319
319
|
t.onload = i, t.onerror = e.onImageErrorHandler ? (...l) => {
|
|
320
320
|
try {
|
|
321
321
|
i(e.onImageErrorHandler(...l));
|
|
322
322
|
} catch (u) {
|
|
323
|
-
|
|
323
|
+
o(u);
|
|
324
324
|
}
|
|
325
|
-
} :
|
|
325
|
+
} : o;
|
|
326
326
|
const c = t;
|
|
327
|
-
c.decode && (c.decode = i), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src =
|
|
327
|
+
c.decode && (c.decode = i), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = a) : t.href.baseVal = a;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
const r =
|
|
330
|
+
async function bn(t, e) {
|
|
331
|
+
const r = H(t.childNodes).map((a) => fe(a, e));
|
|
332
332
|
await Promise.all(r).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
|
|
334
|
+
async function fe(t, e) {
|
|
335
|
+
x(t, Element) && (await gn(t, e), await wn(t, e), await bn(t, e));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function Sn(t, e) {
|
|
338
338
|
const { style: n } = t;
|
|
339
339
|
e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
|
|
340
340
|
const r = e.style;
|
|
341
|
-
return r != null && Object.keys(r).forEach((
|
|
342
|
-
n[
|
|
341
|
+
return r != null && Object.keys(r).forEach((a) => {
|
|
342
|
+
n[a] = r[a];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
async function
|
|
347
|
-
let e =
|
|
345
|
+
const Vt = {};
|
|
346
|
+
async function Wt(t) {
|
|
347
|
+
let e = Vt[t];
|
|
348
348
|
if (e != null)
|
|
349
349
|
return e;
|
|
350
350
|
const r = await (await fetch(t)).text();
|
|
351
|
-
return e = { url: t, cssText: r },
|
|
351
|
+
return e = { url: t, cssText: r }, Vt[t] = e, e;
|
|
352
352
|
}
|
|
353
|
-
async function
|
|
353
|
+
async function zt(t, e) {
|
|
354
354
|
let n = t.cssText;
|
|
355
|
-
const r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (
|
|
356
|
-
let c =
|
|
357
|
-
return c.startsWith("https://") || (c = new URL(c, t.url).href),
|
|
355
|
+
const r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
356
|
+
let c = o.replace(r, "$1");
|
|
357
|
+
return c.startsWith("https://") || (c = new URL(c, t.url).href), se(c, e.fetchRequestInit, ({ result: l }) => (n = n.replace(o, `url(${l})`), [o, l]));
|
|
358
358
|
});
|
|
359
359
|
return Promise.all(i).then(() => n);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function qt(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
|
|
365
365
|
let r = t.replace(n, "");
|
|
366
|
-
const
|
|
366
|
+
const a = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
367
367
|
for (; ; ) {
|
|
368
|
-
const l =
|
|
368
|
+
const l = a.exec(r);
|
|
369
369
|
if (l === null)
|
|
370
370
|
break;
|
|
371
371
|
e.push(l[0]);
|
|
372
372
|
}
|
|
373
|
-
r = r.replace(
|
|
374
|
-
const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,
|
|
373
|
+
r = r.replace(a, "");
|
|
374
|
+
const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, o = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", c = new RegExp(o, "gi");
|
|
375
375
|
for (; ; ) {
|
|
376
376
|
let l = i.exec(r);
|
|
377
377
|
if (l === null) {
|
|
@@ -384,21 +384,21 @@ function jt(t) {
|
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function vn(t, e) {
|
|
388
388
|
const n = [], r = [];
|
|
389
|
-
return t.forEach((
|
|
390
|
-
if ("cssRules" in
|
|
389
|
+
return t.forEach((a) => {
|
|
390
|
+
if ("cssRules" in a)
|
|
391
391
|
try {
|
|
392
|
-
|
|
392
|
+
H(a.cssRules || []).forEach((i, o) => {
|
|
393
393
|
if (i.type === CSSRule.IMPORT_RULE) {
|
|
394
|
-
let c =
|
|
395
|
-
const l = i.href, u =
|
|
394
|
+
let c = o + 1;
|
|
395
|
+
const l = i.href, u = Wt(l).then((f) => zt(f, e)).then((f) => qt(f).forEach((p) => {
|
|
396
396
|
try {
|
|
397
|
-
|
|
398
|
-
} catch (
|
|
397
|
+
a.insertRule(p, p.startsWith("@import") ? c += 1 : a.cssRules.length);
|
|
398
|
+
} catch (y) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
400
|
rule: p,
|
|
401
|
-
error:
|
|
401
|
+
error: y
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
404
|
})).catch((f) => {
|
|
@@ -408,78 +408,78 @@ async function fn(t, e) {
|
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
410
|
} catch (i) {
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
const o = t.find((c) => c.href == null) || document.styleSheets[0];
|
|
412
|
+
a.href != null && r.push(Wt(a.href).then((c) => zt(c, e)).then((c) => qt(c).forEach((l) => {
|
|
413
|
+
o.insertRule(l, o.cssRules.length);
|
|
414
414
|
})).catch((c) => {
|
|
415
415
|
console.error("Error loading remote stylesheet", c);
|
|
416
416
|
})), console.error("Error inlining remote css file", i);
|
|
417
417
|
}
|
|
418
|
-
}), Promise.all(r).then(() => (t.forEach((
|
|
419
|
-
if ("cssRules" in
|
|
418
|
+
}), Promise.all(r).then(() => (t.forEach((a) => {
|
|
419
|
+
if ("cssRules" in a)
|
|
420
420
|
try {
|
|
421
|
-
|
|
421
|
+
H(a.cssRules || []).forEach((i) => {
|
|
422
422
|
n.push(i);
|
|
423
423
|
});
|
|
424
424
|
} catch (i) {
|
|
425
|
-
console.error(`Error while reading CSS rules from ${
|
|
425
|
+
console.error(`Error while reading CSS rules from ${a.href}`, i);
|
|
426
426
|
}
|
|
427
427
|
}), n));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
429
|
+
function xn(t) {
|
|
430
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ue(e.style.getPropertyValue("src")));
|
|
431
431
|
}
|
|
432
|
-
async function
|
|
432
|
+
async function En(t, e) {
|
|
433
433
|
if (t.ownerDocument == null)
|
|
434
434
|
throw new Error("Provided element is not within a Document");
|
|
435
|
-
const n =
|
|
436
|
-
return
|
|
435
|
+
const n = H(t.ownerDocument.styleSheets), r = await vn(n, e);
|
|
436
|
+
return xn(r);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function he(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Cn(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function n(r) {
|
|
444
444
|
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((i) => {
|
|
445
|
-
e.add(
|
|
445
|
+
e.add(he(i));
|
|
446
446
|
}), Array.from(r.children).forEach((i) => {
|
|
447
447
|
i instanceof HTMLElement && n(i);
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
return n(t), e;
|
|
451
451
|
}
|
|
452
|
-
async function
|
|
453
|
-
const n = await
|
|
454
|
-
return (await Promise.all(n.filter((i) => r.has(
|
|
455
|
-
const
|
|
456
|
-
return
|
|
452
|
+
async function Mn(t, e) {
|
|
453
|
+
const n = await En(t, e), r = Cn(t);
|
|
454
|
+
return (await Promise.all(n.filter((i) => r.has(he(i.style.fontFamily))).map((i) => {
|
|
455
|
+
const o = i.parentStyleSheet ? i.parentStyleSheet.href : null;
|
|
456
|
+
return de(i.cssText, o, e);
|
|
457
457
|
}))).join(`
|
|
458
458
|
`);
|
|
459
459
|
}
|
|
460
|
-
async function
|
|
461
|
-
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await
|
|
460
|
+
async function An(t, e) {
|
|
461
|
+
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Mn(t, e);
|
|
462
462
|
if (n) {
|
|
463
|
-
const r = document.createElement("style"),
|
|
464
|
-
r.appendChild(
|
|
463
|
+
const r = document.createElement("style"), a = document.createTextNode(n);
|
|
464
|
+
r.appendChild(a), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
async function
|
|
468
|
-
const { width: n, height: r } =
|
|
469
|
-
return await
|
|
467
|
+
async function Ln(t, e = {}) {
|
|
468
|
+
const { width: n, height: r } = oe(t, e), a = await ut(t, e, !0);
|
|
469
|
+
return await An(a, e), await fe(a, e), Sn(a, e), await Ve(a, n, r);
|
|
470
470
|
}
|
|
471
|
-
async function
|
|
472
|
-
const { width: n, height: r } =
|
|
473
|
-
return
|
|
471
|
+
async function Rn(t, e = {}) {
|
|
472
|
+
const { width: n, height: r } = oe(t, e), a = await Ln(t, e), i = await it(a), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || Ne(), u = e.canvasWidth || n, f = e.canvasHeight || r;
|
|
473
|
+
return o.width = u * l, o.height = f * l, e.skipAutoScale || je(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(i, 0, 0, o.width, o.height), o;
|
|
474
474
|
}
|
|
475
|
-
async function
|
|
476
|
-
return (await
|
|
475
|
+
async function Kt(t, e = {}) {
|
|
476
|
+
return (await Rn(t, e)).toDataURL();
|
|
477
477
|
}
|
|
478
|
-
const
|
|
479
|
-
function
|
|
480
|
-
return t instanceof Element && (t.hasAttribute(
|
|
478
|
+
const at = "data-nf-capture-chrome", $n = "data-nf-canvas-snap", Tn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
|
|
479
|
+
function pe(t) {
|
|
480
|
+
return t instanceof Element && (t.hasAttribute(at) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function Pn() {
|
|
483
483
|
const t = [];
|
|
484
484
|
return Array.from(document.styleSheets).forEach((e) => {
|
|
485
485
|
try {
|
|
@@ -503,11 +503,11 @@ function xn() {
|
|
|
503
503
|
});
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function kn() {
|
|
507
507
|
const t = [];
|
|
508
508
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
|
|
509
|
-
const r = n.getBoundingClientRect(),
|
|
510
|
-
|
|
509
|
+
const r = n.getBoundingClientRect(), a = document.createElement("div");
|
|
510
|
+
a.setAttribute("data-nf-mask-cover", "1"), a.style.cssText = [
|
|
511
511
|
"position:fixed",
|
|
512
512
|
`left:${r.left}px`,
|
|
513
513
|
`top:${r.top}px`,
|
|
@@ -516,59 +516,185 @@ function En() {
|
|
|
516
516
|
"background:#111",
|
|
517
517
|
"z-index:2147483646",
|
|
518
518
|
"pointer-events:none"
|
|
519
|
-
].join(";"), document.body.appendChild(
|
|
519
|
+
].join(";"), document.body.appendChild(a), t.push(a);
|
|
520
520
|
}), () => t.forEach((n) => n.remove());
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
const t = document.querySelector(`[${
|
|
522
|
+
function In() {
|
|
523
|
+
const t = document.querySelector(`[${at}]`);
|
|
524
524
|
if (t)
|
|
525
525
|
return t;
|
|
526
526
|
const e = document.createElement("div");
|
|
527
|
-
return e.setAttribute(
|
|
528
|
-
}
|
|
529
|
-
function
|
|
530
|
-
document.querySelectorAll(`[${
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
527
|
+
return e.setAttribute(at, "1"), e.className = "nf-capture-chrome", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.innerHTML = '<span class="nf-capture-chrome-pill">Capturing…</span>', document.body.appendChild(e), e;
|
|
528
|
+
}
|
|
529
|
+
function On() {
|
|
530
|
+
document.querySelectorAll(`[${at}]`).forEach((t) => t.remove());
|
|
531
|
+
}
|
|
532
|
+
function xt() {
|
|
533
|
+
return new Promise((t) => {
|
|
534
|
+
requestAnimationFrame(() => requestAnimationFrame(t));
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
function D(t) {
|
|
538
|
+
if (typeof t != "string" || !t.startsWith("data:image/"))
|
|
539
|
+
return !1;
|
|
540
|
+
const e = t.indexOf(",");
|
|
541
|
+
return e > 0 && e < t.length - 1;
|
|
542
|
+
}
|
|
543
|
+
function Bn() {
|
|
544
|
+
const t = document.documentElement, e = document.body, n = Math.max(
|
|
545
|
+
window.innerWidth || 0,
|
|
546
|
+
(t == null ? void 0 : t.clientWidth) || 0,
|
|
547
|
+
(t == null ? void 0 : t.scrollWidth) || 0,
|
|
548
|
+
(e == null ? void 0 : e.scrollWidth) || 0,
|
|
549
|
+
1
|
|
550
|
+
), r = Math.max(
|
|
551
|
+
window.innerHeight || 0,
|
|
552
|
+
(t == null ? void 0 : t.clientHeight) || 0,
|
|
553
|
+
(t == null ? void 0 : t.scrollHeight) || 0,
|
|
554
|
+
(e == null ? void 0 : e.scrollHeight) || 0,
|
|
555
|
+
1
|
|
556
|
+
);
|
|
557
|
+
return { width: n, height: r };
|
|
558
|
+
}
|
|
559
|
+
async function Hn() {
|
|
560
|
+
const t = [], e = Array.from(document.querySelectorAll("canvas"));
|
|
561
|
+
for (const n of e) {
|
|
562
|
+
if (n.closest("#notefully") || pe(n))
|
|
563
|
+
continue;
|
|
564
|
+
let r = "";
|
|
565
|
+
try {
|
|
566
|
+
r = n.toDataURL("image/png");
|
|
567
|
+
} catch {
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
if (!r || r === "data:,")
|
|
571
|
+
continue;
|
|
572
|
+
const a = document.createElement("img"), i = getComputedStyle(n);
|
|
573
|
+
a.setAttribute($n, "1"), a.alt = "", a.src = r, a.className = n.className, a.style.cssText = n.style.cssText, a.style.width = i.width, a.style.height = i.height, a.style.maxWidth = i.maxWidth, a.style.maxHeight = i.maxHeight, a.style.objectFit = "fill", a.style.display = i.display === "inline" ? "inline-block" : i.display, n.replaceWith(a), t.push({ canvas: n, img: a });
|
|
574
|
+
}
|
|
575
|
+
return await Promise.all(t.map(({ img: n }) => {
|
|
576
|
+
if (!n.complete)
|
|
577
|
+
return new Promise((r) => {
|
|
578
|
+
n.onload = () => r(), n.onerror = () => r();
|
|
579
|
+
});
|
|
580
|
+
})), () => {
|
|
581
|
+
t.forEach(({ canvas: n, img: r }) => {
|
|
582
|
+
try {
|
|
583
|
+
r.parentNode && r.replaceWith(n);
|
|
584
|
+
} catch {
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
async function Dn(t) {
|
|
590
|
+
if (!t)
|
|
591
|
+
return null;
|
|
592
|
+
if (typeof t == "string")
|
|
593
|
+
return D(t) ? t : null;
|
|
594
|
+
if (typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement)
|
|
595
|
+
try {
|
|
596
|
+
const e = t.toDataURL("image/png");
|
|
597
|
+
return D(e) ? e : null;
|
|
598
|
+
} catch {
|
|
599
|
+
return null;
|
|
544
600
|
}
|
|
601
|
+
if (typeof Blob < "u" && t instanceof Blob) {
|
|
602
|
+
const e = await Fn(t);
|
|
603
|
+
return D(e) ? e : null;
|
|
604
|
+
}
|
|
605
|
+
return null;
|
|
606
|
+
}
|
|
607
|
+
async function Fn(t) {
|
|
608
|
+
if (typeof FileReader == "function")
|
|
609
|
+
return new Promise((r, a) => {
|
|
610
|
+
const i = new FileReader();
|
|
611
|
+
i.onload = () => r(String(i.result || "")), i.onerror = () => a(i.error || new Error("Could not read capture blob")), i.readAsDataURL(t);
|
|
612
|
+
});
|
|
613
|
+
const e = Buffer.from(await t.arrayBuffer());
|
|
614
|
+
return `data:${t.type || "application/octet-stream"};base64,${e.toString("base64")}`;
|
|
615
|
+
}
|
|
616
|
+
async function Un() {
|
|
617
|
+
var e;
|
|
618
|
+
if (!((e = navigator.mediaDevices) != null && e.getDisplayMedia))
|
|
619
|
+
throw new Error("Screen capture is not supported in this browser.");
|
|
620
|
+
const t = await navigator.mediaDevices.getDisplayMedia({
|
|
621
|
+
video: { displaySurface: "browser" },
|
|
622
|
+
audio: !1,
|
|
623
|
+
preferCurrentTab: !0,
|
|
624
|
+
selfBrowserSurface: "include"
|
|
625
|
+
});
|
|
626
|
+
try {
|
|
627
|
+
const n = document.createElement("video");
|
|
628
|
+
n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((c) => {
|
|
629
|
+
n.onloadedmetadata = () => c();
|
|
630
|
+
}), await xt();
|
|
631
|
+
const r = n.videoWidth || 1, a = n.videoHeight || 1, i = document.createElement("canvas");
|
|
632
|
+
i.width = r, i.height = a, i.getContext("2d").drawImage(n, 0, 0, r, a);
|
|
633
|
+
const o = i.toDataURL("image/png");
|
|
634
|
+
if (!D(o))
|
|
635
|
+
throw new Error("Screen capture produced an empty image.");
|
|
636
|
+
return o;
|
|
637
|
+
} finally {
|
|
638
|
+
t.getTracks().forEach((n) => n.stop());
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
async function me(t = {}) {
|
|
642
|
+
const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = In(), a = Pn();
|
|
643
|
+
let i = () => {
|
|
545
644
|
};
|
|
645
|
+
e && (e.style.display = "none");
|
|
646
|
+
const o = kn();
|
|
546
647
|
try {
|
|
648
|
+
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await xt(), typeof t.capture == "function") {
|
|
649
|
+
const p = await Dn(await t.capture());
|
|
650
|
+
if (p)
|
|
651
|
+
return p;
|
|
652
|
+
}
|
|
653
|
+
i = await Hn(), await xt();
|
|
654
|
+
const { width: c, height: l } = Bn(), u = {
|
|
655
|
+
cacheBust: !0,
|
|
656
|
+
width: c,
|
|
657
|
+
height: l,
|
|
658
|
+
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
659
|
+
filter: (p) => !pe(p),
|
|
660
|
+
// 404 / CORS images must not abort the whole capture.
|
|
661
|
+
imagePlaceholder: Tn,
|
|
662
|
+
onImageErrorHandler: () => {
|
|
663
|
+
}
|
|
664
|
+
};
|
|
665
|
+
let f = "";
|
|
547
666
|
try {
|
|
548
|
-
|
|
667
|
+
f = await Kt(document.body, u);
|
|
549
668
|
} catch {
|
|
550
|
-
|
|
669
|
+
f = await Kt(document.body, { ...u, skipFonts: !0 });
|
|
551
670
|
}
|
|
671
|
+
if (!D(f))
|
|
672
|
+
throw new Error("Screenshot capture produced an empty image.");
|
|
673
|
+
return f;
|
|
552
674
|
} finally {
|
|
553
|
-
|
|
675
|
+
try {
|
|
676
|
+
i();
|
|
677
|
+
} catch {
|
|
678
|
+
}
|
|
679
|
+
o(), a(), r.remove(), On(), e && (e.style.display = n);
|
|
554
680
|
}
|
|
555
681
|
}
|
|
556
|
-
function
|
|
682
|
+
function Nn(t = "") {
|
|
557
683
|
const e = String(t || "");
|
|
558
684
|
return e ? /Windows NT/i.test(e) ? "Windows" : /iPhone|iPad|iPod/i.test(e) ? "iOS" : /Mac OS X|Macintosh/i.test(e) ? "macOS" : /Android/i.test(e) ? "Android" : /CrOS/i.test(e) ? "ChromeOS" : /Linux/i.test(e) ? "Linux" : "Other" : "";
|
|
559
685
|
}
|
|
560
|
-
function
|
|
686
|
+
function jn(t = "") {
|
|
561
687
|
const e = String(t || "");
|
|
562
688
|
return e ? /Edg\//i.test(e) ? "Edge" : /OPR\/|Opera/i.test(e) ? "Opera" : /Firefox\//i.test(e) ? "Firefox" : /Chrome\//i.test(e) || /CriOS\//i.test(e) ? "Chrome" : /Safari\//i.test(e) ? "Safari" : "Other" : "";
|
|
563
689
|
}
|
|
564
|
-
function
|
|
690
|
+
function _n(t = {}) {
|
|
565
691
|
const e = navigator.userAgent;
|
|
566
692
|
return {
|
|
567
693
|
url: location.href,
|
|
568
694
|
title: document.title,
|
|
569
695
|
userAgent: e,
|
|
570
|
-
os:
|
|
571
|
-
browser:
|
|
696
|
+
os: Nn(e),
|
|
697
|
+
browser: jn(e),
|
|
572
698
|
language: navigator.language,
|
|
573
699
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
574
700
|
viewport: {
|
|
@@ -583,11 +709,11 @@ function $n(t = {}) {
|
|
|
583
709
|
}
|
|
584
710
|
};
|
|
585
711
|
}
|
|
586
|
-
const
|
|
712
|
+
const Xt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Yt = {
|
|
587
713
|
id: "userId",
|
|
588
714
|
username: "displayName",
|
|
589
715
|
name: "displayName"
|
|
590
|
-
},
|
|
716
|
+
}, Gt = /* @__PURE__ */ new Set([
|
|
591
717
|
"endpoint",
|
|
592
718
|
"projectKey",
|
|
593
719
|
"version",
|
|
@@ -597,8 +723,10 @@ const _t = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Vt = {
|
|
|
597
723
|
"theme",
|
|
598
724
|
"video",
|
|
599
725
|
"consoleLogLimit",
|
|
600
|
-
"kinds"
|
|
601
|
-
|
|
726
|
+
"kinds",
|
|
727
|
+
"capture",
|
|
728
|
+
"onBeforeCapture"
|
|
729
|
+
]), Jt = {
|
|
602
730
|
slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
|
|
603
731
|
projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
|
|
604
732
|
project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
|
|
@@ -607,60 +735,60 @@ const _t = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Vt = {
|
|
|
607
735
|
email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
608
736
|
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
|
|
609
737
|
};
|
|
610
|
-
function
|
|
611
|
-
const n = e.warn ||
|
|
612
|
-
for (const
|
|
613
|
-
Object.prototype.hasOwnProperty.call(r,
|
|
614
|
-
for (const [
|
|
615
|
-
Object.prototype.hasOwnProperty.call(r,
|
|
616
|
-
for (const
|
|
617
|
-
|
|
738
|
+
function Vn(t = {}, e = {}) {
|
|
739
|
+
const n = e.warn || ye, r = t && typeof t == "object" ? t : {}, a = {}, i = [];
|
|
740
|
+
for (const o of Xt)
|
|
741
|
+
Object.prototype.hasOwnProperty.call(r, o) && (a[o] = r[o]);
|
|
742
|
+
for (const [o, c] of Object.entries(Yt))
|
|
743
|
+
Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(a, c) || (a[c] = r[o]));
|
|
744
|
+
for (const o of Object.keys(r))
|
|
745
|
+
Xt.has(o) || Object.prototype.hasOwnProperty.call(Yt, o) || i.push(o);
|
|
618
746
|
if (i.length) {
|
|
619
|
-
const
|
|
747
|
+
const o = i.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
|
|
620
748
|
n(
|
|
621
|
-
`Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` +
|
|
749
|
+
`Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` + o
|
|
622
750
|
);
|
|
623
751
|
}
|
|
624
|
-
return
|
|
625
|
-
}
|
|
626
|
-
function
|
|
627
|
-
const n = e.warn ||
|
|
628
|
-
if (
|
|
629
|
-
for (const i of
|
|
630
|
-
if (
|
|
631
|
-
n(`Notefully.init: ignoring "${i}". ${
|
|
752
|
+
return a;
|
|
753
|
+
}
|
|
754
|
+
function Wn(t = {}, e = {}) {
|
|
755
|
+
const n = e.warn || ye, r = t && typeof t == "object" ? t : {}, a = Object.keys(r).filter((i) => !Gt.has(i));
|
|
756
|
+
if (a.length)
|
|
757
|
+
for (const i of a) {
|
|
758
|
+
if (Jt[i]) {
|
|
759
|
+
n(`Notefully.init: ignoring "${i}". ${Jt[i]}`);
|
|
632
760
|
continue;
|
|
633
761
|
}
|
|
634
762
|
n(
|
|
635
|
-
`Notefully.init: ignoring unknown key "${i}". Supported: ${[...
|
|
763
|
+
`Notefully.init: ignoring unknown key "${i}". Supported: ${[...Gt].join(", ")}.`
|
|
636
764
|
);
|
|
637
765
|
}
|
|
638
766
|
}
|
|
639
|
-
function
|
|
767
|
+
function ye(t) {
|
|
640
768
|
typeof console < "u" && typeof console.warn == "function" && console.warn(t);
|
|
641
769
|
}
|
|
642
|
-
const
|
|
643
|
-
function
|
|
770
|
+
const zn = 80;
|
|
771
|
+
function qn() {
|
|
644
772
|
const t = [], e = {};
|
|
645
773
|
let n = !1;
|
|
646
|
-
const r = (i,
|
|
774
|
+
const r = (i, o) => {
|
|
647
775
|
let c = "";
|
|
648
776
|
try {
|
|
649
|
-
c =
|
|
777
|
+
c = o.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
|
|
650
778
|
} catch {
|
|
651
|
-
c = String(
|
|
779
|
+
c = String(o[0]);
|
|
652
780
|
}
|
|
653
781
|
t.push({
|
|
654
782
|
level: i,
|
|
655
783
|
text: c.slice(0, 2e3),
|
|
656
784
|
at: Date.now()
|
|
657
|
-
}), t.length >
|
|
785
|
+
}), t.length > zn && t.shift();
|
|
658
786
|
};
|
|
659
787
|
return {
|
|
660
788
|
hook: () => {
|
|
661
789
|
n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((i) => {
|
|
662
|
-
e[i] = console[i].bind(console), console[i] = (...
|
|
663
|
-
r(i,
|
|
790
|
+
e[i] = console[i].bind(console), console[i] = (...o) => {
|
|
791
|
+
r(i, o), e[i](...o);
|
|
664
792
|
};
|
|
665
793
|
}), window.addEventListener("error", (i) => {
|
|
666
794
|
r("error", [i.message || "window.error"]);
|
|
@@ -673,10 +801,10 @@ function In() {
|
|
|
673
801
|
}
|
|
674
802
|
};
|
|
675
803
|
}
|
|
676
|
-
function
|
|
804
|
+
function Kn(t) {
|
|
677
805
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
678
806
|
let n = null, r = !1;
|
|
679
|
-
const
|
|
807
|
+
const a = () => {
|
|
680
808
|
if (r = !1, n)
|
|
681
809
|
try {
|
|
682
810
|
n.stop();
|
|
@@ -687,10 +815,10 @@ function On(t) {
|
|
|
687
815
|
start: () => {
|
|
688
816
|
if (!e)
|
|
689
817
|
throw new Error("Speech recognition is not supported in this browser.");
|
|
690
|
-
return r ? (
|
|
818
|
+
return r ? (a(), !1) : (n = new e(), n.continuous = !0, n.interimResults = !0, n.lang = navigator.language || "en-US", n.onresult = (o) => {
|
|
691
819
|
let c = "";
|
|
692
|
-
for (let l =
|
|
693
|
-
|
|
820
|
+
for (let l = o.resultIndex; l < o.results.length; l += 1)
|
|
821
|
+
o.results[l].isFinal && (c += o.results[l][0].transcript);
|
|
694
822
|
c && t(c);
|
|
695
823
|
}, n.onerror = () => {
|
|
696
824
|
r = !1;
|
|
@@ -698,24 +826,24 @@ function On(t) {
|
|
|
698
826
|
r = !1;
|
|
699
827
|
}, n.start(), r = !0, !0);
|
|
700
828
|
},
|
|
701
|
-
stop:
|
|
829
|
+
stop: a,
|
|
702
830
|
isSupported: () => !!e,
|
|
703
831
|
isActive: () => r
|
|
704
832
|
};
|
|
705
833
|
}
|
|
706
|
-
const
|
|
707
|
-
function
|
|
708
|
-
let r = null,
|
|
834
|
+
const Xn = 60 * 1e3;
|
|
835
|
+
function Yn({ onStart: t, onStop: e, onError: n }) {
|
|
836
|
+
let r = null, a = null, i = [], o = null;
|
|
709
837
|
const c = () => {
|
|
710
|
-
if (
|
|
838
|
+
if (o && (clearTimeout(o), o = null), a && a.state !== "inactive")
|
|
711
839
|
try {
|
|
712
|
-
|
|
840
|
+
a.stop();
|
|
713
841
|
} catch {
|
|
714
842
|
}
|
|
715
843
|
r && (r.getTracks().forEach((f) => f.stop()), r = null);
|
|
716
844
|
}, l = () => {
|
|
717
|
-
if (
|
|
718
|
-
|
|
845
|
+
if (a && a.state === "recording") {
|
|
846
|
+
a.stop();
|
|
719
847
|
return;
|
|
720
848
|
}
|
|
721
849
|
c(), e(null);
|
|
@@ -729,17 +857,17 @@ function Fn({ onStart: t, onStop: e, onError: n }) {
|
|
|
729
857
|
audio: !1,
|
|
730
858
|
preferCurrentTab: !0,
|
|
731
859
|
selfBrowserSurface: "include"
|
|
732
|
-
}), i = [],
|
|
860
|
+
}), i = [], a = new MediaRecorder(r, {
|
|
733
861
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
734
|
-
}),
|
|
735
|
-
|
|
736
|
-
},
|
|
737
|
-
const
|
|
738
|
-
c(), e(
|
|
739
|
-
}, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()),
|
|
862
|
+
}), a.ondataavailable = (y) => {
|
|
863
|
+
y.data && y.data.size && i.push(y.data);
|
|
864
|
+
}, a.onstop = () => {
|
|
865
|
+
const y = i.length ? new Blob(i, { type: a.mimeType || "video/webm" }) : null;
|
|
866
|
+
c(), e(y);
|
|
867
|
+
}, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), a.start(), o = setTimeout(l, Xn);
|
|
740
868
|
}, stop: l };
|
|
741
869
|
}
|
|
742
|
-
function
|
|
870
|
+
function Gn() {
|
|
743
871
|
const t = /* @__PURE__ */ new Set();
|
|
744
872
|
return {
|
|
745
873
|
alloc() {
|
|
@@ -757,24 +885,24 @@ function Dn() {
|
|
|
757
885
|
}
|
|
758
886
|
};
|
|
759
887
|
}
|
|
760
|
-
const
|
|
761
|
-
function
|
|
762
|
-
const t =
|
|
763
|
-
let e = [], n = { ...
|
|
888
|
+
const yt = { x: 0, y: 0, w: 1, h: 1 };
|
|
889
|
+
function Pt() {
|
|
890
|
+
const t = Gn();
|
|
891
|
+
let e = [], n = { ...yt }, r = 1;
|
|
764
892
|
return {
|
|
765
|
-
list: () => e.filter((i) =>
|
|
893
|
+
list: () => e.filter((i) => Qn(i, n)),
|
|
766
894
|
all: () => e.slice(),
|
|
767
895
|
crop: () => ({ ...n }),
|
|
768
896
|
setCrop(i) {
|
|
769
|
-
return n =
|
|
897
|
+
return n = Jn(i), n;
|
|
770
898
|
},
|
|
771
899
|
resetCrop() {
|
|
772
|
-
return n = { ...
|
|
900
|
+
return n = { ...yt }, n;
|
|
773
901
|
},
|
|
774
902
|
isCropped() {
|
|
775
903
|
return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
|
|
776
904
|
},
|
|
777
|
-
add(i,
|
|
905
|
+
add(i, o) {
|
|
778
906
|
const c = {
|
|
779
907
|
id: `s${r++}`,
|
|
780
908
|
type: i,
|
|
@@ -785,36 +913,36 @@ function le() {
|
|
|
785
913
|
h: i === "arrow" ? 0.05 : 0.16,
|
|
786
914
|
x2: 0.4,
|
|
787
915
|
y2: 0.28,
|
|
788
|
-
...
|
|
916
|
+
...o
|
|
789
917
|
};
|
|
790
918
|
return e.push(c), c;
|
|
791
919
|
},
|
|
792
|
-
update(i,
|
|
920
|
+
update(i, o) {
|
|
793
921
|
const c = e.find((l) => l.id === i);
|
|
794
|
-
return c ? (Object.assign(c,
|
|
922
|
+
return c ? (Object.assign(c, o), c) : null;
|
|
795
923
|
},
|
|
796
924
|
remove(i) {
|
|
797
|
-
const
|
|
798
|
-
if (
|
|
925
|
+
const o = e.findIndex((l) => l.id === i);
|
|
926
|
+
if (o < 0)
|
|
799
927
|
return null;
|
|
800
|
-
const [c] = e.splice(
|
|
928
|
+
const [c] = e.splice(o, 1);
|
|
801
929
|
return t.free(c.number), c;
|
|
802
930
|
},
|
|
803
931
|
reset() {
|
|
804
|
-
for (e = [], n = { ...
|
|
932
|
+
for (e = [], n = { ...yt }, r = 1; t.peekUsed().length; )
|
|
805
933
|
t.free(t.peekUsed()[0]);
|
|
806
934
|
}
|
|
807
935
|
};
|
|
808
936
|
}
|
|
809
|
-
function
|
|
810
|
-
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e),
|
|
811
|
-
return { x: e, y: n, w: r, h:
|
|
937
|
+
function Jn(t) {
|
|
938
|
+
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e), a = Math.min(Math.max(t.h, 0.05), 1 - n);
|
|
939
|
+
return { x: e, y: n, w: r, h: a };
|
|
812
940
|
}
|
|
813
|
-
function
|
|
941
|
+
function Qn(t, e) {
|
|
814
942
|
const n = t.type === "arrow" ? (t.x + (t.x2 ?? t.x)) / 2 : t.x + (t.w || 0) / 2, r = t.type === "arrow" ? (t.y + (t.y2 ?? t.y)) / 2 : t.y + (t.h || 0) / 2;
|
|
815
943
|
return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
|
|
816
944
|
}
|
|
817
|
-
function
|
|
945
|
+
function kt(t) {
|
|
818
946
|
const e = Math.max(1, Number(t) || 1);
|
|
819
947
|
return {
|
|
820
948
|
stroke: Math.max(2, e * 75e-4),
|
|
@@ -824,147 +952,148 @@ function At(t) {
|
|
|
824
952
|
arrowHeadAngle: 0.4
|
|
825
953
|
};
|
|
826
954
|
}
|
|
827
|
-
function
|
|
955
|
+
function Zn(t, {
|
|
828
956
|
stickers: e = [],
|
|
829
957
|
crop: n = { x: 0, y: 0, w: 1, h: 1 },
|
|
830
958
|
width: r,
|
|
831
|
-
height:
|
|
959
|
+
height: a,
|
|
832
960
|
colors: i = {}
|
|
833
961
|
}) {
|
|
834
|
-
const
|
|
835
|
-
t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle =
|
|
836
|
-
const f =
|
|
962
|
+
const o = i.mark || "#fdd341", c = i.markText || "#2a2140", l = kt(r);
|
|
963
|
+
t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = o, t.fillStyle = o, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
|
|
964
|
+
const f = Et(u.x, n, r), p = Ct(u.y, n, a), y = u.w / n.w * r, v = u.h / n.h * a, A = l.stroke / 2;
|
|
837
965
|
if (u.type === "rect")
|
|
838
966
|
t.strokeRect(
|
|
839
967
|
f + A,
|
|
840
968
|
p + A,
|
|
841
|
-
Math.max(0,
|
|
842
|
-
Math.max(0,
|
|
969
|
+
Math.max(0, y - l.stroke),
|
|
970
|
+
Math.max(0, v - l.stroke)
|
|
843
971
|
);
|
|
844
972
|
else if (u.type === "circle")
|
|
845
973
|
t.beginPath(), t.ellipse(
|
|
846
|
-
f +
|
|
847
|
-
p +
|
|
848
|
-
Math.max(0.5,
|
|
849
|
-
Math.max(0.5,
|
|
974
|
+
f + y / 2,
|
|
975
|
+
p + v / 2,
|
|
976
|
+
Math.max(0.5, y / 2 - A),
|
|
977
|
+
Math.max(0.5, v / 2 - A),
|
|
850
978
|
0,
|
|
851
979
|
0,
|
|
852
980
|
Math.PI * 2
|
|
853
981
|
), t.stroke();
|
|
854
982
|
else if (u.type === "arrow") {
|
|
855
|
-
const
|
|
856
|
-
|
|
983
|
+
const V = Et(u.x2 ?? u.x + u.w, n, r), W = Ct(u.y2 ?? u.y, n, a);
|
|
984
|
+
er(t, f, p, V, W, l);
|
|
857
985
|
}
|
|
858
986
|
if (u.number == null || u.number === "")
|
|
859
987
|
return;
|
|
860
|
-
const
|
|
861
|
-
t.beginPath(), t.arc(
|
|
988
|
+
const I = tr(u, n, r, a, f, p, y), Y = String(u.number);
|
|
989
|
+
t.beginPath(), t.arc(I.x, I.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Y, I.x, I.y + 0.5), t.fillStyle = o;
|
|
862
990
|
}), t.restore();
|
|
863
991
|
}
|
|
864
|
-
function
|
|
992
|
+
function Et(t, e, n) {
|
|
865
993
|
return (t - e.x) / e.w * n;
|
|
866
994
|
}
|
|
867
|
-
function
|
|
995
|
+
function Ct(t, e, n) {
|
|
868
996
|
return (t - e.y) / e.h * n;
|
|
869
997
|
}
|
|
870
|
-
function
|
|
998
|
+
function tr(t, e, n, r, a, i, o) {
|
|
871
999
|
if (t.type === "arrow") {
|
|
872
|
-
const c =
|
|
1000
|
+
const c = Et(t.x2 ?? t.x + t.w, e, n), l = Ct(t.y2 ?? t.y, e, r);
|
|
873
1001
|
return {
|
|
874
|
-
x: (
|
|
1002
|
+
x: (a + c) / 2,
|
|
875
1003
|
y: (i + l) / 2
|
|
876
1004
|
};
|
|
877
1005
|
}
|
|
878
|
-
return { x:
|
|
879
|
-
}
|
|
880
|
-
function
|
|
881
|
-
const i = Math.atan2(r - e, n - t),
|
|
882
|
-
x: l -
|
|
883
|
-
y: u -
|
|
884
|
-
},
|
|
885
|
-
x: l -
|
|
886
|
-
y: u -
|
|
1006
|
+
return { x: a + o / 2, y: i };
|
|
1007
|
+
}
|
|
1008
|
+
function ge(t, e, n, r, a) {
|
|
1009
|
+
const i = Math.atan2(r - e, n - t), o = a.arrowHead, c = Math.min(a.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(i) * o, p = r - Math.sin(i) * o, y = {
|
|
1010
|
+
x: l - o * Math.cos(i - a.arrowHeadAngle),
|
|
1011
|
+
y: u - o * Math.sin(i - a.arrowHeadAngle)
|
|
1012
|
+
}, v = {
|
|
1013
|
+
x: l - o * Math.cos(i + a.arrowHeadAngle),
|
|
1014
|
+
y: u - o * Math.sin(i + a.arrowHeadAngle)
|
|
887
1015
|
}, A = {
|
|
888
1016
|
x: n - Math.cos(i) * c,
|
|
889
1017
|
y: r - Math.sin(i) * c
|
|
890
1018
|
};
|
|
891
|
-
return { angle: i, tipX: l, tipY: u, baseX: f, baseY: p, left:
|
|
1019
|
+
return { angle: i, tipX: l, tipY: u, baseX: f, baseY: p, left: y, right: v, shaftEnd: A };
|
|
892
1020
|
}
|
|
893
|
-
function
|
|
894
|
-
const
|
|
895
|
-
t.beginPath(), t.moveTo(e, n), t.lineTo(
|
|
1021
|
+
function er(t, e, n, r, a, i) {
|
|
1022
|
+
const o = ge(e, n, r, a, i);
|
|
1023
|
+
t.beginPath(), t.moveTo(e, n), t.lineTo(o.shaftEnd.x, o.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(o.tipX, o.tipY), t.lineTo(o.left.x, o.left.y), t.lineTo(o.right.x, o.right.y), t.closePath(), t.fill();
|
|
896
1024
|
}
|
|
897
|
-
function
|
|
898
|
-
return new Promise((
|
|
899
|
-
const
|
|
900
|
-
|
|
901
|
-
const c = Math.round(e.x *
|
|
1025
|
+
function nr(t, e, n, r = {}) {
|
|
1026
|
+
return new Promise((a, i) => {
|
|
1027
|
+
const o = new Image();
|
|
1028
|
+
o.onload = () => {
|
|
1029
|
+
const c = Math.round(e.x * o.width), l = Math.round(e.y * o.height), u = Math.max(1, Math.round(e.w * o.width)), f = Math.max(1, Math.round(e.h * o.height)), p = document.createElement("canvas");
|
|
902
1030
|
p.width = u, p.height = f;
|
|
903
|
-
const
|
|
904
|
-
|
|
1031
|
+
const y = p.getContext("2d");
|
|
1032
|
+
y.drawImage(o, c, l, u, f, 0, 0, u, f), Zn(y, {
|
|
905
1033
|
stickers: n,
|
|
906
1034
|
crop: e,
|
|
907
1035
|
width: u,
|
|
908
1036
|
height: f,
|
|
909
1037
|
colors: r
|
|
910
|
-
}), p.toBlob((
|
|
911
|
-
if (!
|
|
1038
|
+
}), p.toBlob((v) => {
|
|
1039
|
+
if (!v) {
|
|
912
1040
|
i(new Error("Could not encode screenshot"));
|
|
913
1041
|
return;
|
|
914
1042
|
}
|
|
915
|
-
|
|
1043
|
+
a(v);
|
|
916
1044
|
}, "image/png");
|
|
917
|
-
},
|
|
1045
|
+
}, o.onerror = () => i(new Error("Could not load screenshot")), o.src = t;
|
|
918
1046
|
});
|
|
919
1047
|
}
|
|
920
|
-
const
|
|
1048
|
+
const N = [
|
|
921
1049
|
{ id: "bug", label: "Bug" },
|
|
922
1050
|
{ id: "idea", label: "Idea" },
|
|
923
1051
|
{ id: "other", label: "Other" }
|
|
924
1052
|
];
|
|
925
|
-
function
|
|
1053
|
+
function Qt(t) {
|
|
926
1054
|
return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
|
|
927
1055
|
}
|
|
928
|
-
function
|
|
1056
|
+
function gt(t) {
|
|
929
1057
|
const e = String(t || "").trim();
|
|
930
1058
|
return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
|
|
931
1059
|
}
|
|
932
|
-
function
|
|
1060
|
+
function rr(t) {
|
|
933
1061
|
if (!Array.isArray(t) || !t.length)
|
|
934
|
-
return
|
|
1062
|
+
return N.map((r) => ({ ...r }));
|
|
935
1063
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
936
1064
|
for (const r of t) {
|
|
937
|
-
let
|
|
938
|
-
typeof r == "string" || typeof r == "number" ? (
|
|
1065
|
+
let a = "", i = "";
|
|
1066
|
+
typeof r == "string" || typeof r == "number" ? (a = Qt(r), i = gt(a)) : r && typeof r == "object" && (a = Qt(r.id ?? r.value ?? r.kind), i = String(r.label || r.name || gt(a)).trim() || gt(a)), !(!a || e.has(a)) && (e.add(a), n.push({ id: a, label: i }));
|
|
939
1067
|
}
|
|
940
|
-
return n.length ? n :
|
|
1068
|
+
return n.length ? n : N.map((r) => ({ ...r }));
|
|
941
1069
|
}
|
|
942
|
-
function
|
|
1070
|
+
function dt(t) {
|
|
943
1071
|
var n;
|
|
944
|
-
const e = Array.isArray(t) && t.length ? t :
|
|
1072
|
+
const e = Array.isArray(t) && t.length ? t : N;
|
|
945
1073
|
return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
|
|
946
1074
|
}
|
|
947
|
-
const
|
|
1075
|
+
const ir = ["maker", "all-business", "brighter-day", "quiet-night"], we = "maker", ar = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), Mt = 0.02, Zt = 0.05, or = `
|
|
948
1076
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
949
1077
|
<path fill="currentColor" d="M5.2 2.8h9.1A2.7 2.7 0 0 1 17 5.5v8.2c0 .4-.3.7-.7.7h-.1a.7.7 0 0 1-.7-.7V5.5c0-.7-.6-1.3-1.3-1.3H5.2c-.7 0-1.3.6-1.3 1.3v12.2c0 .7.6 1.3 1.3 1.3h6.4a.7.7 0 0 1 0 1.4H5.2A2.7 2.7 0 0 1 2.5 17.7V5.5A2.7 2.7 0 0 1 5.2 2.8zm1.6 4.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h3.6a.7.7 0 0 0 0-1.4H6.8z"/>
|
|
950
1078
|
<path fill="currentColor" d="M14.7 13.05 20.2 7.55a1.55 1.55 0 0 1 2.2 2.2l-5.5 5.5-.45 1.9a.6.6 0 0 1-.72.45l-1.9-.45.87-1.9z"/>
|
|
951
1079
|
</svg>
|
|
952
1080
|
`;
|
|
953
|
-
function
|
|
1081
|
+
function P(t) {
|
|
954
1082
|
return `<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`;
|
|
955
1083
|
}
|
|
956
|
-
const
|
|
957
|
-
crop:
|
|
958
|
-
resetCrop:
|
|
959
|
-
arrow:
|
|
960
|
-
rect:
|
|
961
|
-
circle:
|
|
962
|
-
discard:
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1084
|
+
const L = {
|
|
1085
|
+
crop: P('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
|
|
1086
|
+
resetCrop: P('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
|
|
1087
|
+
arrow: P('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
|
|
1088
|
+
rect: P('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
|
|
1089
|
+
circle: P('<circle cx="12" cy="12" r="8"/>'),
|
|
1090
|
+
discard: P('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
1091
|
+
recapture: P('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
|
|
1092
|
+
audio: P('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),
|
|
1093
|
+
video: P('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
1094
|
+
}, be = qn();
|
|
1095
|
+
be.hook();
|
|
1096
|
+
const Se = 10, sr = 80, ve = "notefully.author", At = "Anonymous";
|
|
968
1097
|
let d = {
|
|
969
1098
|
endpoint: "",
|
|
970
1099
|
projectKey: "",
|
|
@@ -972,43 +1101,46 @@ let d = {
|
|
|
972
1101
|
name: "",
|
|
973
1102
|
targets: null,
|
|
974
1103
|
hideLauncher: !1,
|
|
975
|
-
theme:
|
|
1104
|
+
theme: we,
|
|
976
1105
|
video: !1,
|
|
977
|
-
consoleLogLimit:
|
|
978
|
-
kinds:
|
|
979
|
-
|
|
1106
|
+
consoleLogLimit: Se,
|
|
1107
|
+
kinds: N.map((t) => ({ ...t })),
|
|
1108
|
+
capture: null,
|
|
1109
|
+
onBeforeCapture: null
|
|
1110
|
+
}, wt = !1, R = {}, h = null, s = {}, m = Pt(), T = "", X = "", $ = null, j = dt(N), B = null, M = null, b = null, w = null, nt = null, U = null, G = null, k = { w: 0, h: 0 }, bt = !1, It = !1;
|
|
980
1111
|
function g(t) {
|
|
981
1112
|
return h.querySelector(t);
|
|
982
1113
|
}
|
|
983
|
-
function
|
|
1114
|
+
function xe(t) {
|
|
984
1115
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
985
|
-
return
|
|
1116
|
+
return ir.includes(e) ? e : we;
|
|
986
1117
|
}
|
|
987
|
-
function
|
|
1118
|
+
function te(t, e) {
|
|
988
1119
|
return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
|
|
989
1120
|
}
|
|
990
|
-
async function
|
|
1121
|
+
async function cr(t) {
|
|
991
1122
|
return (await fetch(t)).blob();
|
|
992
1123
|
}
|
|
993
|
-
function
|
|
994
|
-
s.status && (s.status.textContent = t || "",
|
|
1124
|
+
function S(t, e = !1) {
|
|
1125
|
+
s.status && (s.status.textContent = t || "", nt && (clearTimeout(nt), nt = null), t && !e && (nt = setTimeout(() => {
|
|
995
1126
|
s.status.textContent = "";
|
|
996
1127
|
}, 4e3)));
|
|
997
1128
|
}
|
|
998
|
-
function
|
|
1129
|
+
function Ot() {
|
|
999
1130
|
return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
|
|
1000
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
1131
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${or}</button>
|
|
1001
1132
|
<div class="nf-dialog" hidden>
|
|
1002
1133
|
<div class="nf-panel">
|
|
1003
1134
|
<div class="nf-panel-body">
|
|
1004
|
-
<div class="nf-stage">
|
|
1135
|
+
<div class="nf-stage" hidden>
|
|
1005
1136
|
<div class="nf-palette">
|
|
1006
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${
|
|
1007
|
-
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${
|
|
1008
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${
|
|
1009
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${
|
|
1010
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${
|
|
1011
|
-
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${
|
|
1137
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${L.crop}</button>
|
|
1138
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${L.resetCrop}</button>
|
|
1139
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${L.arrow}</button>
|
|
1140
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${L.rect}</button>
|
|
1141
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${L.circle}</button>
|
|
1142
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${L.discard}</button>
|
|
1143
|
+
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${L.recapture}</button>
|
|
1012
1144
|
</div>
|
|
1013
1145
|
<div class="nf-canvas"></div>
|
|
1014
1146
|
</div>
|
|
@@ -1016,9 +1148,9 @@ function Rt() {
|
|
|
1016
1148
|
<input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
|
|
1017
1149
|
<div class="nf-kind"></div>
|
|
1018
1150
|
<div class="nf-actions">
|
|
1019
|
-
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${
|
|
1020
|
-
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${
|
|
1021
|
-
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${
|
|
1151
|
+
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${L.resetCrop}</button>
|
|
1152
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${L.audio}</button>
|
|
1153
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${L.video}</button>
|
|
1022
1154
|
<button class="nf-submit" type="button">Submit</button>
|
|
1023
1155
|
</div>
|
|
1024
1156
|
<div class="nf-status"></div>
|
|
@@ -1034,154 +1166,159 @@ function Rt() {
|
|
|
1034
1166
|
panelBody: g(".nf-panel-body"),
|
|
1035
1167
|
successMsg: g(".nf-success-msg"),
|
|
1036
1168
|
stage: g(".nf-stage"),
|
|
1169
|
+
palette: g(".nf-palette"),
|
|
1037
1170
|
canvas: g(".nf-canvas"),
|
|
1038
1171
|
text: g(".nf-text"),
|
|
1039
1172
|
author: g(".nf-author"),
|
|
1173
|
+
actions: g(".nf-actions"),
|
|
1040
1174
|
restore: g(".nf-restore"),
|
|
1041
1175
|
status: g(".nf-status"),
|
|
1042
1176
|
audio: g(".nf-audio"),
|
|
1043
1177
|
video: g(".nf-video"),
|
|
1044
1178
|
discard: g(".nf-discard-shot"),
|
|
1179
|
+
recapture: g(".nf-recapture"),
|
|
1045
1180
|
stop: g(".nf-stop-video"),
|
|
1046
1181
|
resetCrop: g(".nf-reset-crop"),
|
|
1047
1182
|
submit: g(".nf-submit"),
|
|
1048
1183
|
shot: null
|
|
1049
|
-
},
|
|
1184
|
+
}, lr(), Q()), h;
|
|
1050
1185
|
}
|
|
1051
|
-
function
|
|
1186
|
+
function Q() {
|
|
1052
1187
|
var t;
|
|
1053
|
-
h && (h.dataset.theme =
|
|
1188
|
+
h && (h.dataset.theme = xe(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), Ee(), (t = s.dialog) != null && t.hidden && ot());
|
|
1054
1189
|
}
|
|
1055
|
-
function
|
|
1190
|
+
function ot() {
|
|
1056
1191
|
s.launcher && (s.launcher.hidden = !!d.hideLauncher);
|
|
1057
1192
|
}
|
|
1058
|
-
function
|
|
1059
|
-
s.launcher.addEventListener("click", () =>
|
|
1060
|
-
|
|
1193
|
+
function lr() {
|
|
1194
|
+
s.launcher.addEventListener("click", () => Ie()), g(".nf-dialog").addEventListener("click", (e) => {
|
|
1195
|
+
It || e.target === s.dialog && et();
|
|
1061
1196
|
}), h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1062
|
-
e.addEventListener("click", () =>
|
|
1063
|
-
}), s.resetCrop.addEventListener("click",
|
|
1197
|
+
e.addEventListener("click", () => J(e.dataset.tool));
|
|
1198
|
+
}), s.resetCrop.addEventListener("click", yr), s.canvas.addEventListener("pointerdown", dr), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
|
|
1064
1199
|
const t = g(".nf-kind");
|
|
1065
1200
|
t && t.addEventListener("click", (e) => {
|
|
1066
1201
|
const n = e.target.closest("[data-kind]");
|
|
1067
|
-
n &&
|
|
1068
|
-
}), s.discard.addEventListener("click",
|
|
1069
|
-
|
|
1070
|
-
}),
|
|
1071
|
-
|
|
1072
|
-
|
|
1202
|
+
n && Bt(n.dataset.kind);
|
|
1203
|
+
}), s.discard.addEventListener("click", gr), s.recapture.addEventListener("click", () => {
|
|
1204
|
+
br().catch((e) => S(e.message || "Recapture failed."));
|
|
1205
|
+
}), s.restore.addEventListener("click", wr), s.audio.addEventListener("click", Sr), s.video.addEventListener("click", vr), s.stop.addEventListener("click", () => G == null ? void 0 : G.stop()), g(".nf-submit").addEventListener("click", () => {
|
|
1206
|
+
Be().catch((e) => S(e.message || "Submit failed."));
|
|
1207
|
+
}), Ee(), J(null);
|
|
1208
|
+
}
|
|
1209
|
+
function ee(t) {
|
|
1073
1210
|
return String(t || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1074
1211
|
}
|
|
1075
|
-
function
|
|
1212
|
+
function Ee() {
|
|
1076
1213
|
const t = h == null ? void 0 : h.querySelector(".nf-kind");
|
|
1077
1214
|
if (!t)
|
|
1078
1215
|
return;
|
|
1079
|
-
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds :
|
|
1080
|
-
t.innerHTML = e.map((
|
|
1081
|
-
const r = e.map((
|
|
1082
|
-
|
|
1083
|
-
}
|
|
1084
|
-
function
|
|
1085
|
-
|
|
1086
|
-
n.dataset.active = String(n.dataset.kind ===
|
|
1216
|
+
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : N;
|
|
1217
|
+
t.innerHTML = e.map((a) => `<button type="button" data-kind="${ee(a.id)}">${ee(a.label)}</button>`).join("");
|
|
1218
|
+
const r = e.map((a) => a.id).includes(j) ? j : dt(e);
|
|
1219
|
+
Bt(r);
|
|
1220
|
+
}
|
|
1221
|
+
function Bt(t) {
|
|
1222
|
+
j = (d.kinds || N).map((n) => n.id).includes(t) ? t : dt(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
|
|
1223
|
+
n.dataset.active = String(n.dataset.kind === j);
|
|
1087
1224
|
});
|
|
1088
1225
|
}
|
|
1089
|
-
function
|
|
1090
|
-
|
|
1091
|
-
e.dataset.active = String(e.dataset.tool ===
|
|
1092
|
-
}), s.canvas && (s.canvas.dataset.draw =
|
|
1226
|
+
function J(t) {
|
|
1227
|
+
B = ar.has(t) ? t : null, M = null, h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1228
|
+
e.dataset.active = String(e.dataset.tool === B);
|
|
1229
|
+
}), s.canvas && (s.canvas.dataset.draw = B ? "true" : "false"), F() && C();
|
|
1093
1230
|
}
|
|
1094
|
-
function
|
|
1231
|
+
function ne(t) {
|
|
1095
1232
|
return Math.min(1, Math.max(0, t));
|
|
1096
1233
|
}
|
|
1097
|
-
function
|
|
1234
|
+
function Z() {
|
|
1098
1235
|
return s.shot || s.canvas;
|
|
1099
1236
|
}
|
|
1100
|
-
function
|
|
1101
|
-
const e =
|
|
1237
|
+
function st(t) {
|
|
1238
|
+
const e = Z().getBoundingClientRect();
|
|
1102
1239
|
return {
|
|
1103
|
-
x:
|
|
1104
|
-
y:
|
|
1240
|
+
x: ne((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
1241
|
+
y: ne((t.clientY - e.top) / Math.max(e.height, 1))
|
|
1105
1242
|
};
|
|
1106
1243
|
}
|
|
1107
|
-
function
|
|
1108
|
-
const e =
|
|
1244
|
+
function ur(t) {
|
|
1245
|
+
const e = Z().getBoundingClientRect();
|
|
1109
1246
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
1110
1247
|
}
|
|
1111
|
-
function
|
|
1112
|
-
const e =
|
|
1248
|
+
function Ce(t) {
|
|
1249
|
+
const e = st(t), n = m.crop();
|
|
1113
1250
|
return {
|
|
1114
1251
|
x: n.x + e.x * n.w,
|
|
1115
1252
|
y: n.y + e.y * n.h
|
|
1116
1253
|
};
|
|
1117
1254
|
}
|
|
1118
|
-
function
|
|
1255
|
+
function ft(t, e) {
|
|
1119
1256
|
const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
|
|
1120
1257
|
return {
|
|
1121
1258
|
x: n,
|
|
1122
1259
|
y: r,
|
|
1123
|
-
w: Math.max(
|
|
1124
|
-
h: Math.max(
|
|
1260
|
+
w: Math.max(Mt, Math.abs(e.x - t.x)),
|
|
1261
|
+
h: Math.max(Mt, Math.abs(e.y - t.y))
|
|
1125
1262
|
};
|
|
1126
1263
|
}
|
|
1127
|
-
function
|
|
1264
|
+
function Ht(t) {
|
|
1128
1265
|
h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
|
|
1129
1266
|
}
|
|
1130
|
-
function
|
|
1267
|
+
function St(t) {
|
|
1131
1268
|
try {
|
|
1132
1269
|
s.canvas.setPointerCapture(t.pointerId);
|
|
1133
1270
|
} catch {
|
|
1134
1271
|
}
|
|
1135
1272
|
}
|
|
1136
|
-
function
|
|
1137
|
-
window.addEventListener("pointermove",
|
|
1273
|
+
function Lt() {
|
|
1274
|
+
window.addEventListener("pointermove", Ae), window.addEventListener("pointerup", ct), window.addEventListener("pointercancel", ct);
|
|
1138
1275
|
}
|
|
1139
|
-
function
|
|
1140
|
-
window.removeEventListener("pointermove",
|
|
1276
|
+
function Me() {
|
|
1277
|
+
window.removeEventListener("pointermove", Ae), window.removeEventListener("pointerup", ct), window.removeEventListener("pointercancel", ct);
|
|
1141
1278
|
}
|
|
1142
|
-
function
|
|
1143
|
-
if (t.button !== 0 || !
|
|
1279
|
+
function dr(t) {
|
|
1280
|
+
if (t.button !== 0 || !F())
|
|
1144
1281
|
return;
|
|
1145
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
1146
|
-
|
|
1282
|
+
if (!t.target.closest(".nf-sticker") && !ur(t)) {
|
|
1283
|
+
M = null, C();
|
|
1147
1284
|
return;
|
|
1148
1285
|
}
|
|
1149
1286
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1150
1287
|
if (n && n.dataset.preview !== "true") {
|
|
1151
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1288
|
+
t.preventDefault(), t.stopPropagation(), M = n.dataset.id, St(t), fr({
|
|
1152
1289
|
kind: "sticker",
|
|
1153
|
-
id:
|
|
1290
|
+
id: M,
|
|
1154
1291
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
1155
|
-
}, t),
|
|
1292
|
+
}, t), C();
|
|
1156
1293
|
return;
|
|
1157
1294
|
}
|
|
1158
|
-
if (
|
|
1159
|
-
t.preventDefault(),
|
|
1295
|
+
if (M = null, B === "crop") {
|
|
1296
|
+
t.preventDefault(), St(t), b = { kind: "crop", start: st(t), current: st(t) }, Lt(), C();
|
|
1160
1297
|
return;
|
|
1161
1298
|
}
|
|
1162
|
-
if (
|
|
1163
|
-
t.preventDefault(),
|
|
1164
|
-
const r =
|
|
1165
|
-
b = { kind: "sticker", type:
|
|
1299
|
+
if (B === "arrow" || B === "rect" || B === "circle") {
|
|
1300
|
+
t.preventDefault(), St(t);
|
|
1301
|
+
const r = Ce(t);
|
|
1302
|
+
b = { kind: "sticker", type: B, start: r, current: r }, Lt(), C();
|
|
1166
1303
|
return;
|
|
1167
1304
|
}
|
|
1168
|
-
|
|
1305
|
+
C();
|
|
1169
1306
|
}
|
|
1170
|
-
function
|
|
1307
|
+
function fr(t, e) {
|
|
1171
1308
|
e.preventDefault(), e.stopPropagation();
|
|
1172
|
-
const n =
|
|
1309
|
+
const n = Z().getBoundingClientRect(), r = m.list().find((a) => a.id === t.id);
|
|
1173
1310
|
w = {
|
|
1174
1311
|
...t,
|
|
1175
1312
|
startX: e.clientX,
|
|
1176
1313
|
startY: e.clientY,
|
|
1177
|
-
crop:
|
|
1314
|
+
crop: m.crop(),
|
|
1178
1315
|
sticker: r ? { ...r } : null,
|
|
1179
1316
|
rect: n
|
|
1180
|
-
},
|
|
1317
|
+
}, Ht(t.dir === "move" || t.dir === "start" || t.dir === "end"), Lt();
|
|
1181
1318
|
}
|
|
1182
|
-
function
|
|
1319
|
+
function Ae(t) {
|
|
1183
1320
|
if (b) {
|
|
1184
|
-
b.current = b.kind === "crop" ?
|
|
1321
|
+
b.current = b.kind === "crop" ? st(t) : Ce(t), C();
|
|
1185
1322
|
return;
|
|
1186
1323
|
}
|
|
1187
1324
|
if (!w)
|
|
@@ -1189,85 +1326,85 @@ function be(t) {
|
|
|
1189
1326
|
const e = (t.clientX - w.startX) / w.rect.width * w.crop.w, n = (t.clientY - w.startY) / w.rect.height * w.crop.h, r = w.sticker;
|
|
1190
1327
|
if (r) {
|
|
1191
1328
|
if (w.dir === "end")
|
|
1192
|
-
|
|
1329
|
+
m.update(r.id, {
|
|
1193
1330
|
x2: r.x2 + e,
|
|
1194
1331
|
y2: r.y2 + n
|
|
1195
1332
|
});
|
|
1196
1333
|
else if (w.dir === "start")
|
|
1197
|
-
|
|
1334
|
+
m.update(r.id, {
|
|
1198
1335
|
x: r.x + e,
|
|
1199
1336
|
y: r.y + n
|
|
1200
1337
|
});
|
|
1201
1338
|
else if (w.dir === "move")
|
|
1202
|
-
|
|
1339
|
+
m.update(r.id, {
|
|
1203
1340
|
x: r.x + e,
|
|
1204
1341
|
y: r.y + n,
|
|
1205
1342
|
x2: (r.x2 || r.x) + e,
|
|
1206
1343
|
y2: (r.y2 || r.y) + n
|
|
1207
1344
|
});
|
|
1208
1345
|
else {
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1346
|
+
const a = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1347
|
+
hr(a, w.dir, e, n), m.update(r.id, a);
|
|
1211
1348
|
}
|
|
1212
|
-
|
|
1349
|
+
C();
|
|
1213
1350
|
}
|
|
1214
1351
|
}
|
|
1215
|
-
function
|
|
1352
|
+
function hr(t, e, n, r) {
|
|
1216
1353
|
if (e.includes("e") && (t.w = Math.max(0.04, t.w + n)), e.includes("s") && (t.h = Math.max(0.04, t.h + r)), e.includes("w")) {
|
|
1217
|
-
const
|
|
1218
|
-
t.x += t.w -
|
|
1354
|
+
const a = Math.max(0.04, t.w - n);
|
|
1355
|
+
t.x += t.w - a, t.w = a;
|
|
1219
1356
|
}
|
|
1220
1357
|
if (e.includes("n")) {
|
|
1221
|
-
const
|
|
1222
|
-
t.y += t.h -
|
|
1358
|
+
const a = Math.max(0.04, t.h - r);
|
|
1359
|
+
t.y += t.h - a, t.h = a;
|
|
1223
1360
|
}
|
|
1224
1361
|
}
|
|
1225
|
-
function
|
|
1226
|
-
if (
|
|
1227
|
-
|
|
1362
|
+
function ct(t) {
|
|
1363
|
+
if (Me(), Ht(!1), b) {
|
|
1364
|
+
pr();
|
|
1228
1365
|
return;
|
|
1229
1366
|
}
|
|
1230
1367
|
if (w) {
|
|
1231
1368
|
if (w.kind === "sticker") {
|
|
1232
1369
|
const e = s.canvas.getBoundingClientRect();
|
|
1233
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (
|
|
1370
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (m.remove(w.id), M = null);
|
|
1234
1371
|
}
|
|
1235
|
-
w = null,
|
|
1372
|
+
w = null, C();
|
|
1236
1373
|
}
|
|
1237
1374
|
}
|
|
1238
|
-
function
|
|
1375
|
+
function pr() {
|
|
1239
1376
|
const t = b;
|
|
1240
1377
|
if (b = null, !t)
|
|
1241
1378
|
return;
|
|
1242
1379
|
if (t.kind === "crop") {
|
|
1243
|
-
const n =
|
|
1244
|
-
if (Math.abs(t.current.x - t.start.x) <
|
|
1245
|
-
|
|
1380
|
+
const n = ft(t.start, t.current);
|
|
1381
|
+
if (Math.abs(t.current.x - t.start.x) < Zt || Math.abs(t.current.y - t.start.y) < Zt) {
|
|
1382
|
+
C();
|
|
1246
1383
|
return;
|
|
1247
1384
|
}
|
|
1248
|
-
const
|
|
1249
|
-
|
|
1250
|
-
x:
|
|
1251
|
-
y:
|
|
1252
|
-
w: n.w *
|
|
1253
|
-
h: n.h *
|
|
1254
|
-
}),
|
|
1385
|
+
const a = m.crop();
|
|
1386
|
+
m.setCrop({
|
|
1387
|
+
x: a.x + n.x * a.w,
|
|
1388
|
+
y: a.y + n.y * a.h,
|
|
1389
|
+
w: n.w * a.w,
|
|
1390
|
+
h: n.h * a.h
|
|
1391
|
+
}), _();
|
|
1255
1392
|
return;
|
|
1256
1393
|
}
|
|
1257
|
-
const e =
|
|
1258
|
-
e && (
|
|
1394
|
+
const e = mr(t);
|
|
1395
|
+
e && (M = e.id), C();
|
|
1259
1396
|
}
|
|
1260
|
-
function
|
|
1397
|
+
function mr(t) {
|
|
1261
1398
|
if (t.type === "arrow") {
|
|
1262
1399
|
const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
|
|
1263
|
-
return Math.hypot(e, n) <
|
|
1400
|
+
return Math.hypot(e, n) < Mt ? m.add("arrow", {
|
|
1264
1401
|
x: t.start.x,
|
|
1265
1402
|
y: t.start.y,
|
|
1266
1403
|
x2: t.start.x + 0.12,
|
|
1267
1404
|
y2: t.start.y,
|
|
1268
1405
|
w: 0.12,
|
|
1269
1406
|
h: 0.02
|
|
1270
|
-
}) :
|
|
1407
|
+
}) : m.add("arrow", {
|
|
1271
1408
|
x: t.start.x,
|
|
1272
1409
|
y: t.start.y,
|
|
1273
1410
|
x2: t.current.x,
|
|
@@ -1276,83 +1413,121 @@ function nr(t) {
|
|
|
1276
1413
|
h: Math.abs(n)
|
|
1277
1414
|
});
|
|
1278
1415
|
}
|
|
1279
|
-
return
|
|
1416
|
+
return m.add(t.type, ft(t.start, t.current));
|
|
1280
1417
|
}
|
|
1281
|
-
function
|
|
1282
|
-
|
|
1418
|
+
function yr() {
|
|
1419
|
+
m.resetCrop(), M = null, _();
|
|
1283
1420
|
}
|
|
1284
|
-
function
|
|
1285
|
-
s.resetCrop && (s.resetCrop.hidden = !
|
|
1421
|
+
function lt() {
|
|
1422
|
+
s.resetCrop && (s.resetCrop.hidden = !m.isCropped());
|
|
1286
1423
|
}
|
|
1287
|
-
function
|
|
1424
|
+
function Dt(t) {
|
|
1288
1425
|
if (!s.audio)
|
|
1289
1426
|
return;
|
|
1290
1427
|
const e = t ? "Stop audio" : "Record audio";
|
|
1291
1428
|
s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
|
|
1292
1429
|
}
|
|
1293
|
-
function
|
|
1294
|
-
|
|
1430
|
+
function F() {
|
|
1431
|
+
return D(T);
|
|
1295
1432
|
}
|
|
1296
|
-
function
|
|
1297
|
-
|
|
1433
|
+
function tt() {
|
|
1434
|
+
if (!s.stage || !s.palette || !s.actions || !s.recapture)
|
|
1435
|
+
return;
|
|
1436
|
+
const t = F();
|
|
1437
|
+
s.stage.hidden = !t && !$, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !X), t ? (s.palette.appendChild(s.discard), s.palette.appendChild(s.recapture)) : s.audio ? s.audio.after(s.recapture) : s.actions.insertBefore(s.recapture, s.submit || null), s.recapture.hidden = !1;
|
|
1298
1438
|
}
|
|
1299
|
-
function
|
|
1439
|
+
function gr() {
|
|
1440
|
+
F() && (X = T), T = "", J(null), tt(), _();
|
|
1441
|
+
}
|
|
1442
|
+
function wr() {
|
|
1443
|
+
D(X) && (T = X, tt(), _());
|
|
1444
|
+
}
|
|
1445
|
+
function Le() {
|
|
1446
|
+
return {
|
|
1447
|
+
capture: typeof d.capture == "function" ? d.capture : void 0,
|
|
1448
|
+
onBeforeCapture: typeof d.onBeforeCapture == "function" ? d.onBeforeCapture : void 0
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
function Re(t) {
|
|
1452
|
+
if (!D(t))
|
|
1453
|
+
throw new Error("Screenshot failed; you can still send text.");
|
|
1454
|
+
T = t, X = t, m = Pt(), k = { w: 0, h: 0 }, M = null, b = null, w = null, J(null);
|
|
1455
|
+
}
|
|
1456
|
+
async function br() {
|
|
1457
|
+
if (!(wt || !s.dialog || s.dialog.hidden)) {
|
|
1458
|
+
wt = !0, s.recapture.disabled = !0, S("Capturing…", !0), s.dialog.hidden = !0;
|
|
1459
|
+
try {
|
|
1460
|
+
let t = "";
|
|
1461
|
+
try {
|
|
1462
|
+
t = await Un();
|
|
1463
|
+
} catch {
|
|
1464
|
+
t = await me(Le());
|
|
1465
|
+
}
|
|
1466
|
+
Re(t), S("");
|
|
1467
|
+
} catch (t) {
|
|
1468
|
+
S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1469
|
+
} finally {
|
|
1470
|
+
s.dialog.hidden = !1, s.recapture.disabled = !1, wt = !1, tt(), _();
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
function Sr() {
|
|
1300
1475
|
try {
|
|
1301
|
-
if (
|
|
1476
|
+
if (U || (U = Kn((e) => {
|
|
1302
1477
|
const n = s.text.value.trim();
|
|
1303
1478
|
s.text.value = n ? `${n} ${e}` : e;
|
|
1304
|
-
})), !
|
|
1305
|
-
|
|
1479
|
+
})), !U.isSupported()) {
|
|
1480
|
+
S("Audio-to-text is not supported in this browser.");
|
|
1306
1481
|
return;
|
|
1307
1482
|
}
|
|
1308
|
-
const t =
|
|
1309
|
-
|
|
1483
|
+
const t = U.start();
|
|
1484
|
+
Dt(t), S(t ? "Listening…" : "");
|
|
1310
1485
|
} catch (t) {
|
|
1311
|
-
|
|
1486
|
+
S(t.message);
|
|
1312
1487
|
}
|
|
1313
1488
|
}
|
|
1314
|
-
async function
|
|
1489
|
+
async function vr() {
|
|
1315
1490
|
if (!d.video) {
|
|
1316
|
-
|
|
1491
|
+
S("Video is disabled on this host.");
|
|
1317
1492
|
return;
|
|
1318
1493
|
}
|
|
1319
|
-
s.dialog.hidden = !0, s.stop.hidden = !1,
|
|
1494
|
+
s.dialog.hidden = !0, s.stop.hidden = !1, Q(), s.launcher.hidden = !0, G = Yn({
|
|
1320
1495
|
onStart() {
|
|
1321
1496
|
},
|
|
1322
1497
|
onStop(t) {
|
|
1323
|
-
|
|
1498
|
+
$ = t, s.stop.hidden = !0, ot(), s.dialog.hidden = !1, tt(), _(), S(t ? "Video attached." : "Recording cancelled.");
|
|
1324
1499
|
},
|
|
1325
1500
|
onError(t) {
|
|
1326
|
-
|
|
1501
|
+
S(t.message);
|
|
1327
1502
|
}
|
|
1328
1503
|
});
|
|
1329
1504
|
try {
|
|
1330
|
-
await
|
|
1505
|
+
await G.start();
|
|
1331
1506
|
} catch (t) {
|
|
1332
|
-
s.stop.hidden = !0,
|
|
1507
|
+
s.stop.hidden = !0, ot(), s.dialog.hidden = !1, S(t.message);
|
|
1333
1508
|
}
|
|
1334
1509
|
}
|
|
1335
|
-
function
|
|
1336
|
-
if (s.shot = null, !
|
|
1337
|
-
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML =
|
|
1510
|
+
function _() {
|
|
1511
|
+
if (s.shot = null, !F()) {
|
|
1512
|
+
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = $ ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL($)}"></video>` : "", lt();
|
|
1338
1513
|
return;
|
|
1339
1514
|
}
|
|
1340
|
-
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${
|
|
1515
|
+
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${T}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
|
|
1341
1516
|
const t = s.shot.querySelector("img");
|
|
1342
1517
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1343
1518
|
const e = () => {
|
|
1344
|
-
|
|
1519
|
+
xr(t), C();
|
|
1345
1520
|
};
|
|
1346
|
-
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1521
|
+
t.addEventListener("load", e), t.complete && t.naturalWidth && e(), lt();
|
|
1347
1522
|
}
|
|
1348
|
-
function
|
|
1349
|
-
const e = t.naturalWidth ||
|
|
1350
|
-
if (e && n && (
|
|
1523
|
+
function xr(t) {
|
|
1524
|
+
const e = t.naturalWidth || k.w, n = t.naturalHeight || k.h;
|
|
1525
|
+
if (e && n && (k = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !k.w || !k.h)
|
|
1351
1526
|
return;
|
|
1352
|
-
const r =
|
|
1353
|
-
s.shot.style.left = `${(1 -
|
|
1527
|
+
const r = m.crop(), a = k.w / k.h, i = r.w / r.h * a, o = Math.min(1, i / a), c = Math.min(1, a / i);
|
|
1528
|
+
s.shot.style.left = `${(1 - o) / 2 * 100}%`, s.shot.style.top = `${(1 - c) / 2 * 100}%`, s.shot.style.width = `${o * 100}%`, s.shot.style.height = `${c * 100}%`, t.style.width = `${100 / r.w}%`, t.style.height = `${100 / r.h}%`, t.style.left = `${-r.x / r.w * 100}%`, t.style.top = `${-r.y / r.h * 100}%`;
|
|
1354
1529
|
}
|
|
1355
|
-
function
|
|
1530
|
+
function Er(t) {
|
|
1356
1531
|
return t.type === "arrow" ? {
|
|
1357
1532
|
id: "preview",
|
|
1358
1533
|
type: "arrow",
|
|
@@ -1367,94 +1542,94 @@ function lr(t) {
|
|
|
1367
1542
|
id: "preview",
|
|
1368
1543
|
type: t.type,
|
|
1369
1544
|
number: "",
|
|
1370
|
-
...
|
|
1545
|
+
...ft(t.start, t.current)
|
|
1371
1546
|
};
|
|
1372
1547
|
}
|
|
1373
|
-
function
|
|
1374
|
-
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !
|
|
1375
|
-
|
|
1548
|
+
function C() {
|
|
1549
|
+
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !F() || !s.shot) {
|
|
1550
|
+
lt();
|
|
1376
1551
|
return;
|
|
1377
1552
|
}
|
|
1378
|
-
const e =
|
|
1553
|
+
const e = m.crop(), n = Z(), r = kt(n.clientWidth || 400);
|
|
1379
1554
|
if (s.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), s.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), s.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), s.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (b == null ? void 0 : b.kind) === "crop") {
|
|
1380
1555
|
const i = document.createElement("div");
|
|
1381
|
-
i.className = "nf-crop",
|
|
1556
|
+
i.className = "nf-crop", re(i, ft(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(i);
|
|
1382
1557
|
}
|
|
1383
|
-
const
|
|
1384
|
-
if ((b == null ? void 0 : b.kind) === "sticker" &&
|
|
1385
|
-
const
|
|
1386
|
-
if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, c && (l.dataset.selected = "true"),
|
|
1558
|
+
const a = m.list().slice();
|
|
1559
|
+
if ((b == null ? void 0 : b.kind) === "sticker" && a.push(Er(b)), a.forEach((i) => {
|
|
1560
|
+
const o = i.id === "preview", c = !o && i.id === M, l = document.createElement("div");
|
|
1561
|
+
if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), i.type === "arrow" ? Cr(l, i, e, c, r) : (re(l, i, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Rt(l, u))), !o && i.number) {
|
|
1387
1562
|
const u = document.createElement("span");
|
|
1388
1563
|
u.className = "nf-badge", u.textContent = String(i.number), l.appendChild(u);
|
|
1389
1564
|
}
|
|
1390
1565
|
s.shot.appendChild(l);
|
|
1391
|
-
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()),
|
|
1566
|
+
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()), $) {
|
|
1392
1567
|
const i = document.createElement("video");
|
|
1393
|
-
i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL(
|
|
1568
|
+
i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL($), i.style.position = "absolute", i.style.right = "8px", i.style.bottom = "8px", i.style.width = "160px", s.canvas.appendChild(i);
|
|
1394
1569
|
}
|
|
1395
|
-
|
|
1570
|
+
lt();
|
|
1396
1571
|
}
|
|
1397
|
-
function
|
|
1398
|
-
const i =
|
|
1399
|
-
t.style.left = `${
|
|
1400
|
-
<line class="nf-arrow-hit" x1="${
|
|
1401
|
-
<line class="nf-arrow-shaft" x1="${
|
|
1402
|
-
<polygon class="nf-arrow-head" points="${
|
|
1403
|
-
`, t.appendChild(
|
|
1572
|
+
function Cr(t, e, n, r, a = kt(400)) {
|
|
1573
|
+
const i = Z(), o = i.clientWidth, c = i.clientHeight, l = (e.x - n.x) / n.w * o, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * o, p = ((e.y2 ?? e.y) - n.y) / n.h * c, y = Math.max(18, a.arrowHead + a.stroke * 2), v = Math.min(l, f) - y, A = Math.min(u, p) - y, I = Math.max(2, Math.abs(f - l)) + y * 2, Y = Math.max(2, Math.abs(p - u)) + y * 2, V = l - v, W = u - A, ht = f - v, pt = p - A, O = ge(V, W, ht, pt, a), z = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1574
|
+
t.style.left = `${v}px`, t.style.top = `${A}px`, t.style.width = `${I}px`, t.style.height = `${Y}px`, z.setAttribute("class", "nf-arrow-svg"), z.setAttribute("viewBox", `0 0 ${I} ${Y}`), z.setAttribute("width", String(I)), z.setAttribute("height", String(Y)), z.innerHTML = `
|
|
1575
|
+
<line class="nf-arrow-hit" x1="${V}" y1="${W}" x2="${ht}" y2="${pt}" />
|
|
1576
|
+
<line class="nf-arrow-shaft" x1="${V}" y1="${W}" x2="${O.shaftEnd.x}" y2="${O.shaftEnd.y}" />
|
|
1577
|
+
<polygon class="nf-arrow-head" points="${O.tipX},${O.tipY} ${O.left.x},${O.left.y} ${O.right.x},${O.right.y}" />
|
|
1578
|
+
`, t.appendChild(z), r && (Rt(t, "start", { left: V - 5, top: W - 5 }), Rt(t, "end", { left: ht - 5, top: pt - 5 }));
|
|
1404
1579
|
}
|
|
1405
|
-
function
|
|
1580
|
+
function Rt(t, e, n) {
|
|
1406
1581
|
const r = document.createElement("span");
|
|
1407
1582
|
r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
|
|
1408
1583
|
}
|
|
1409
|
-
function
|
|
1584
|
+
function re(t, e, n) {
|
|
1410
1585
|
t.style.left = `${(e.x - n.x) / n.w * 100}%`, t.style.top = `${(e.y - n.y) / n.h * 100}%`, t.style.width = `${e.w / n.w * 100}%`, t.style.height = `${e.h / n.h * 100}%`;
|
|
1411
1586
|
}
|
|
1412
|
-
function
|
|
1587
|
+
function Mr() {
|
|
1413
1588
|
try {
|
|
1414
|
-
return String(localStorage.getItem(
|
|
1589
|
+
return String(localStorage.getItem(ve) || "").trim();
|
|
1415
1590
|
} catch {
|
|
1416
1591
|
return "";
|
|
1417
1592
|
}
|
|
1418
1593
|
}
|
|
1419
|
-
function
|
|
1594
|
+
function Ar(t) {
|
|
1420
1595
|
const e = String(t || "").trim();
|
|
1421
|
-
if (!(!e || e ===
|
|
1596
|
+
if (!(!e || e === At))
|
|
1422
1597
|
try {
|
|
1423
|
-
localStorage.setItem(
|
|
1598
|
+
localStorage.setItem(ve, e);
|
|
1424
1599
|
} catch {
|
|
1425
1600
|
}
|
|
1426
1601
|
}
|
|
1427
|
-
function
|
|
1602
|
+
function $e() {
|
|
1428
1603
|
return !!(String(R.userId || "").trim() || String(R.email || "").trim() || String(R.displayName || "").trim());
|
|
1429
1604
|
}
|
|
1430
|
-
function
|
|
1605
|
+
function Lr() {
|
|
1431
1606
|
return String(
|
|
1432
1607
|
R.displayName || R.email || R.userId || ""
|
|
1433
1608
|
).trim();
|
|
1434
1609
|
}
|
|
1435
|
-
function
|
|
1610
|
+
function Rr() {
|
|
1436
1611
|
var e;
|
|
1437
|
-
if (
|
|
1438
|
-
return
|
|
1612
|
+
if ($e())
|
|
1613
|
+
return Lr() || At;
|
|
1439
1614
|
const t = String(((e = s.author) == null ? void 0 : e.value) || "").trim();
|
|
1440
|
-
return t ? (
|
|
1615
|
+
return t ? (Ar(t), t) : At;
|
|
1441
1616
|
}
|
|
1442
|
-
function
|
|
1617
|
+
function Te() {
|
|
1443
1618
|
if (!s.author)
|
|
1444
1619
|
return;
|
|
1445
|
-
const t =
|
|
1620
|
+
const t = $e();
|
|
1446
1621
|
if (s.author.hidden = t, t) {
|
|
1447
1622
|
s.author.value = "";
|
|
1448
1623
|
return;
|
|
1449
1624
|
}
|
|
1450
|
-
s.author.value =
|
|
1625
|
+
s.author.value = Mr();
|
|
1451
1626
|
}
|
|
1452
|
-
function
|
|
1627
|
+
function Pe(t, e = Se) {
|
|
1453
1628
|
const n = Number(t);
|
|
1454
|
-
return Number.isFinite(n) ? Math.min(
|
|
1629
|
+
return Number.isFinite(n) ? Math.min(sr, Math.max(0, Math.floor(n))) : e;
|
|
1455
1630
|
}
|
|
1456
|
-
function
|
|
1457
|
-
|
|
1631
|
+
function ke(t = {}) {
|
|
1632
|
+
Wn(t);
|
|
1458
1633
|
const e = Object.prototype.hasOwnProperty.call(t, "kinds");
|
|
1459
1634
|
d = {
|
|
1460
1635
|
...d,
|
|
@@ -1464,102 +1639,104 @@ function Ee(t = {}) {
|
|
|
1464
1639
|
name: t.name == null ? d.name : String(t.name || ""),
|
|
1465
1640
|
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1466
1641
|
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1467
|
-
theme:
|
|
1642
|
+
theme: xe(t.theme ?? d.theme),
|
|
1468
1643
|
video: t.video == null ? d.video : !!t.video,
|
|
1469
|
-
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit :
|
|
1470
|
-
kinds: e ?
|
|
1644
|
+
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : Pe(t.consoleLogLimit, d.consoleLogLimit),
|
|
1645
|
+
kinds: e ? rr(t.kinds) : d.kinds,
|
|
1646
|
+
capture: t.capture === void 0 ? d.capture : t.capture,
|
|
1647
|
+
onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture
|
|
1471
1648
|
};
|
|
1472
1649
|
}
|
|
1473
|
-
function
|
|
1474
|
-
return
|
|
1650
|
+
function Ft(t = {}) {
|
|
1651
|
+
return ke(t), h && Q(), Ut;
|
|
1475
1652
|
}
|
|
1476
|
-
function
|
|
1477
|
-
return
|
|
1653
|
+
function $r(t = {}) {
|
|
1654
|
+
return ke(t), Ot(), Q(), Ut;
|
|
1478
1655
|
}
|
|
1479
|
-
function
|
|
1480
|
-
return
|
|
1656
|
+
function Tr(t) {
|
|
1657
|
+
return Ft({ theme: t });
|
|
1481
1658
|
}
|
|
1482
|
-
function
|
|
1659
|
+
function Pr(t) {
|
|
1483
1660
|
const e = !!t;
|
|
1484
|
-
return !e && h && s.dialog && !s.dialog.hidden &&
|
|
1661
|
+
return !e && h && s.dialog && !s.dialog.hidden && et(), Ft({ hideLauncher: !e });
|
|
1485
1662
|
}
|
|
1486
|
-
async function
|
|
1487
|
-
|
|
1663
|
+
async function Ie() {
|
|
1664
|
+
Ot(), Oe(), Q(), s.launcher.hidden = !0, m = Pt(), k = { w: 0, h: 0 }, $ = null, T = "", X = "", M = null, b = null, w = null, j = dt(d.kinds), Bt(j), J(null), Dt(!1), s.text.value = "", Te(), S("");
|
|
1488
1665
|
try {
|
|
1489
|
-
|
|
1490
|
-
} catch {
|
|
1491
|
-
|
|
1666
|
+
Re(await me(Le())), S("");
|
|
1667
|
+
} catch (t) {
|
|
1668
|
+
T = "", S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1492
1669
|
}
|
|
1493
|
-
s.dialog.hidden = !1,
|
|
1670
|
+
tt(), s.dialog.hidden = !1, _(), s.text.focus();
|
|
1494
1671
|
}
|
|
1495
|
-
function
|
|
1496
|
-
h && (
|
|
1672
|
+
function et() {
|
|
1673
|
+
h && (U == null || U.stop(), Dt(!1), Me(), b = null, w = null, Ht(!1), Oe(), s.dialog.hidden = !0, s.stop.hidden = !0, ot());
|
|
1497
1674
|
}
|
|
1498
|
-
function
|
|
1675
|
+
function kr() {
|
|
1499
1676
|
const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
|
|
1500
1677
|
if (!t || !e || !n || !r)
|
|
1501
1678
|
return Promise.resolve();
|
|
1502
|
-
|
|
1503
|
-
const
|
|
1504
|
-
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1",
|
|
1679
|
+
It = !0, S("");
|
|
1680
|
+
const a = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, i = e.getBoundingClientRect();
|
|
1681
|
+
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", a)
|
|
1505
1682
|
return new Promise((u) => {
|
|
1506
1683
|
window.setTimeout(() => u(), 1e3);
|
|
1507
1684
|
});
|
|
1508
|
-
const
|
|
1685
|
+
const o = e.getBoundingClientRect(), c = o.width > 0 ? i.width / o.width : 1, l = o.height > 0 ? i.height / o.height : 1;
|
|
1509
1686
|
return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${c}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
|
|
1510
1687
|
let f = !1;
|
|
1511
1688
|
const p = () => {
|
|
1512
|
-
f || (f = !0, e.removeEventListener("transitionend",
|
|
1689
|
+
f || (f = !0, e.removeEventListener("transitionend", y), window.setTimeout(() => {
|
|
1513
1690
|
t.style.transition = "opacity 0.28s ease", t.style.opacity = "0", window.setTimeout(() => u(), 280);
|
|
1514
1691
|
}, 1e3));
|
|
1515
|
-
},
|
|
1516
|
-
|
|
1692
|
+
}, y = (v) => {
|
|
1693
|
+
v.target !== e || v.propertyName !== "transform" || p();
|
|
1517
1694
|
};
|
|
1518
|
-
e.addEventListener("transitionend",
|
|
1695
|
+
e.addEventListener("transitionend", y), requestAnimationFrame(() => {
|
|
1519
1696
|
e.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", e.style.transform = "scale(1)";
|
|
1520
1697
|
}), window.setTimeout(p, 700);
|
|
1521
1698
|
});
|
|
1522
1699
|
}
|
|
1523
|
-
function
|
|
1524
|
-
|
|
1700
|
+
function Oe() {
|
|
1701
|
+
It = !1, s.dialog && (s.dialog.classList.remove("nf-success"), s.dialog.style.opacity = "", s.dialog.style.transition = "", s.panel && (s.panel.style.transform = "", s.panel.style.transition = "", s.panel.style.transformOrigin = ""), s.panelBody && (s.panelBody.hidden = !1), s.successMsg && (s.successMsg.hidden = !0));
|
|
1525
1702
|
}
|
|
1526
|
-
function
|
|
1527
|
-
R = { ...R, ...
|
|
1703
|
+
function Ir(t = {}) {
|
|
1704
|
+
R = { ...R, ...Vn(t) }, Te();
|
|
1528
1705
|
}
|
|
1529
|
-
async function
|
|
1530
|
-
if (
|
|
1706
|
+
async function Be() {
|
|
1707
|
+
if (Ot(), bt)
|
|
1531
1708
|
return null;
|
|
1532
1709
|
const t = s.text.value.trim();
|
|
1533
|
-
if (!t && !
|
|
1534
|
-
return
|
|
1710
|
+
if (!t && !F() && !$)
|
|
1711
|
+
return S("Add a note, screenshot, or video first."), null;
|
|
1535
1712
|
if (!d.endpoint || !d.projectKey)
|
|
1536
|
-
return
|
|
1537
|
-
|
|
1713
|
+
return S("Notefully is missing endpoint or projectKey."), null;
|
|
1714
|
+
bt = !0, ie(!0), S("Submitting…", !0);
|
|
1538
1715
|
try {
|
|
1539
|
-
const e =
|
|
1540
|
-
if (n.append("message", t), n.append("kind",
|
|
1541
|
-
|
|
1716
|
+
const e = Rr(), n = new FormData();
|
|
1717
|
+
if (n.append("message", t), n.append("kind", j), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify({
|
|
1718
|
+
..._n({
|
|
1542
1719
|
...R,
|
|
1543
1720
|
displayName: R.displayName || e
|
|
1544
1721
|
}),
|
|
1545
1722
|
author: e,
|
|
1546
|
-
console:
|
|
1547
|
-
})), n.append("annotations", JSON.stringify(
|
|
1548
|
-
const i = await
|
|
1549
|
-
if (n.append("screenshot", i, "screenshot.png"),
|
|
1550
|
-
const
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1723
|
+
console: be.snapshot().slice(-Pe(d.consoleLogLimit))
|
|
1724
|
+
})), n.append("annotations", JSON.stringify(m.list())), n.append("crop", JSON.stringify(m.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), F()) {
|
|
1725
|
+
const i = await cr(T);
|
|
1726
|
+
if (n.append("screenshot", i, "screenshot.png"), m.list().length || m.isCropped()) {
|
|
1727
|
+
const o = await nr(
|
|
1728
|
+
T,
|
|
1729
|
+
m.crop(),
|
|
1730
|
+
m.list(),
|
|
1554
1731
|
{
|
|
1555
|
-
mark:
|
|
1556
|
-
markText:
|
|
1732
|
+
mark: te("--nf-mark", "#fdd341"),
|
|
1733
|
+
markText: te("--nf-mark-text", "#2a2140")
|
|
1557
1734
|
}
|
|
1558
1735
|
);
|
|
1559
|
-
n.append("screenshotBaked",
|
|
1736
|
+
n.append("screenshotBaked", o, "screenshot.baked.png");
|
|
1560
1737
|
}
|
|
1561
1738
|
}
|
|
1562
|
-
|
|
1739
|
+
$ && n.append("recording", $, "recording.webm");
|
|
1563
1740
|
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1564
1741
|
method: "POST",
|
|
1565
1742
|
headers: {
|
|
@@ -1567,36 +1744,36 @@ async function Ae() {
|
|
|
1567
1744
|
},
|
|
1568
1745
|
body: n
|
|
1569
1746
|
});
|
|
1570
|
-
let
|
|
1747
|
+
let a = null;
|
|
1571
1748
|
try {
|
|
1572
|
-
|
|
1749
|
+
a = await r.json();
|
|
1573
1750
|
} catch {
|
|
1574
|
-
|
|
1751
|
+
a = null;
|
|
1575
1752
|
}
|
|
1576
1753
|
if (!r.ok)
|
|
1577
|
-
throw
|
|
1578
|
-
return await
|
|
1754
|
+
throw S((a == null ? void 0 : a.error) || "Submit failed."), new Error((a == null ? void 0 : a.error) || `Submit failed (${r.status})`);
|
|
1755
|
+
return await kr(), et(), a;
|
|
1579
1756
|
} finally {
|
|
1580
|
-
|
|
1757
|
+
bt = !1, ie(!1);
|
|
1581
1758
|
}
|
|
1582
1759
|
}
|
|
1583
|
-
function
|
|
1760
|
+
function ie(t) {
|
|
1584
1761
|
s.submit && (s.submit.disabled = !!t, s.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1585
1762
|
}
|
|
1586
|
-
function
|
|
1587
|
-
|
|
1763
|
+
function Or() {
|
|
1764
|
+
et(), h == null || h.remove(), h = null, s = {};
|
|
1588
1765
|
}
|
|
1589
|
-
const
|
|
1590
|
-
typeof window < "u" && (window.Notefully =
|
|
1766
|
+
const Ut = { init: $r, configure: Ft, setTheme: Tr, setVisible: Pr, open: Ie, close: et, identify: Ir, submit: Be, destroy: Or };
|
|
1767
|
+
typeof window < "u" && (window.Notefully = Ut);
|
|
1591
1768
|
export {
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1769
|
+
et as close,
|
|
1770
|
+
Ft as configure,
|
|
1771
|
+
Ut as default,
|
|
1772
|
+
Or as destroy,
|
|
1773
|
+
Ir as identify,
|
|
1774
|
+
$r as init,
|
|
1775
|
+
Ie as open,
|
|
1776
|
+
Tr as setTheme,
|
|
1777
|
+
Pr as setVisible,
|
|
1778
|
+
Be as submit
|
|
1602
1779
|
};
|