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