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