@makefully/notefully 0.1.38 → 0.1.40
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 +1 -1
- package/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +35 -28
- package/dist/notefully.js +382 -367
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -5,8 +5,8 @@ function Xe(t, e) {
|
|
|
5
5
|
return window.location.protocol + t;
|
|
6
6
|
if (t.match(/^[a-z]+:/i))
|
|
7
7
|
return t;
|
|
8
|
-
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"),
|
|
9
|
-
return n.head.appendChild(r), n.body.appendChild(
|
|
8
|
+
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), a = n.createElement("a");
|
|
9
|
+
return n.head.appendChild(r), n.body.appendChild(a), e && (r.href = e), a.href = t, a.href;
|
|
10
10
|
}
|
|
11
11
|
const Ye = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
@@ -69,8 +69,8 @@ async function tn(t) {
|
|
|
69
69
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
70
70
|
}
|
|
71
71
|
async function en(t, e, n) {
|
|
72
|
-
const r = "http://www.w3.org/2000/svg",
|
|
73
|
-
return
|
|
72
|
+
const r = "http://www.w3.org/2000/svg", a = document.createElementNS(r, "svg"), i = document.createElementNS(r, "foreignObject");
|
|
73
|
+
return a.setAttribute("width", `${e}`), a.setAttribute("height", `${n}`), a.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), a.appendChild(i), i.appendChild(t), tn(a);
|
|
74
74
|
}
|
|
75
75
|
const x = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
@@ -84,17 +84,17 @@ function nn(t) {
|
|
|
84
84
|
}
|
|
85
85
|
function rn(t, e) {
|
|
86
86
|
return fe(e).map((n) => {
|
|
87
|
-
const r = t.getPropertyValue(n),
|
|
88
|
-
return `${n}: ${r}${
|
|
87
|
+
const r = t.getPropertyValue(n), a = t.getPropertyPriority(n);
|
|
88
|
+
return `${n}: ${r}${a ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
91
|
function an(t, e, n, r) {
|
|
92
|
-
const
|
|
93
|
-
return document.createTextNode(`${
|
|
92
|
+
const a = `.${t}:${e}`, i = n.cssText ? nn(n) : rn(n, r);
|
|
93
|
+
return document.createTextNode(`${a}{${i}}`);
|
|
94
94
|
}
|
|
95
95
|
function zt(t, e, n, r) {
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
96
|
+
const a = window.getComputedStyle(t, n), i = a.getPropertyValue("content");
|
|
97
|
+
if (i === "" || i === "none")
|
|
98
98
|
return;
|
|
99
99
|
const o = Ye();
|
|
100
100
|
try {
|
|
@@ -103,7 +103,7 @@ function zt(t, e, n, r) {
|
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
const c = document.createElement("style");
|
|
106
|
-
c.appendChild(an(o, n,
|
|
106
|
+
c.appendChild(an(o, n, a, r)), e.appendChild(c);
|
|
107
107
|
}
|
|
108
108
|
function on(t, e, n) {
|
|
109
109
|
zt(t, e, ":before", n), zt(t, e, ":after", n);
|
|
@@ -142,38 +142,38 @@ async function pe(t, e, n) {
|
|
|
142
142
|
const r = await fetch(t, e);
|
|
143
143
|
if (r.status === 404)
|
|
144
144
|
throw new Error(`Resource "${r.url}" not found`);
|
|
145
|
-
const
|
|
146
|
-
return new Promise((
|
|
145
|
+
const a = await r.blob();
|
|
146
|
+
return new Promise((i, o) => {
|
|
147
147
|
const c = new FileReader();
|
|
148
148
|
c.onerror = o, c.onloadend = () => {
|
|
149
149
|
try {
|
|
150
|
-
|
|
150
|
+
i(n({ res: r, result: c.result }));
|
|
151
151
|
} catch (l) {
|
|
152
152
|
o(l);
|
|
153
153
|
}
|
|
154
|
-
}, c.readAsDataURL(
|
|
154
|
+
}, c.readAsDataURL(a);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
const
|
|
157
|
+
const bt = {};
|
|
158
158
|
function dn(t, e, n) {
|
|
159
159
|
let r = t.replace(/\?.*/, "");
|
|
160
160
|
return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
|
|
161
161
|
}
|
|
162
162
|
async function Ht(t, e, n) {
|
|
163
163
|
const r = dn(t, e, n.includeQueryParams);
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
164
|
+
if (bt[r] != null)
|
|
165
|
+
return bt[r];
|
|
166
166
|
n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
|
-
let
|
|
167
|
+
let a;
|
|
168
168
|
try {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
} catch (
|
|
172
|
-
|
|
169
|
+
const i = await pe(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), ln(c)));
|
|
170
|
+
a = un(i, e);
|
|
171
|
+
} catch (i) {
|
|
172
|
+
a = n.imagePlaceholder || "";
|
|
173
173
|
let o = `Failed to fetch resource: ${t}`;
|
|
174
|
-
|
|
174
|
+
i && (o = typeof i == "string" ? i : i.message), o && console.warn(o);
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return bt[r] = a, a;
|
|
177
177
|
}
|
|
178
178
|
async function fn(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
@@ -181,13 +181,13 @@ async function fn(t) {
|
|
|
181
181
|
}
|
|
182
182
|
async function hn(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
const c =
|
|
184
|
+
const i = document.createElement("canvas"), o = i.getContext("2d");
|
|
185
|
+
i.width = t.clientWidth, i.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, i.width, i.height);
|
|
186
|
+
const c = i.toDataURL();
|
|
187
187
|
return ct(c);
|
|
188
188
|
}
|
|
189
|
-
const n = t.poster, r = Ot(n),
|
|
190
|
-
return ct(
|
|
189
|
+
const n = t.poster, r = Ot(n), a = await Ht(n, r, e);
|
|
190
|
+
return ct(a);
|
|
191
191
|
}
|
|
192
192
|
async function pn(t, e) {
|
|
193
193
|
var n;
|
|
@@ -203,11 +203,11 @@ async function mn(t, e) {
|
|
|
203
203
|
}
|
|
204
204
|
const yn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", me = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
205
|
async function gn(t, e, n) {
|
|
206
|
-
var r,
|
|
206
|
+
var r, a;
|
|
207
207
|
if (me(e))
|
|
208
208
|
return e;
|
|
209
|
-
let
|
|
210
|
-
return yn(t) && t.assignedNodes ?
|
|
209
|
+
let i = [];
|
|
210
|
+
return yn(t) && t.assignedNodes ? i = F(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = F(t.contentDocument.body.childNodes) : i = F(((a = t.shadowRoot) !== null && a !== void 0 ? a : t).childNodes), i.length === 0 || x(t, HTMLVideoElement) || await i.reduce((o, c) => o.then(() => mt(c, n)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
@@ -215,44 +215,44 @@ function wn(t, e, n) {
|
|
|
215
215
|
const r = e.style;
|
|
216
216
|
if (!r)
|
|
217
217
|
return;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
let o =
|
|
221
|
-
|
|
218
|
+
const a = window.getComputedStyle(t);
|
|
219
|
+
a.cssText ? (r.cssText = a.cssText, r.transformOrigin = a.transformOrigin) : fe(n).forEach((i) => {
|
|
220
|
+
let o = a.getPropertyValue(i);
|
|
221
|
+
i === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && i === "display" && o === "inline" && (o = "block"), i === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(i, o, a.getPropertyPriority(i));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function vn(t, e) {
|
|
225
225
|
x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function bn(t, e) {
|
|
228
228
|
if (x(t, HTMLSelectElement)) {
|
|
229
|
-
const r = Array.from(e.children).find((
|
|
229
|
+
const r = Array.from(e.children).find((a) => t.value === a.getAttribute("value"));
|
|
230
230
|
r && r.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
function Sn(t, e, n) {
|
|
234
|
-
return x(e, Element) && (wn(t, e, n), on(t, e, n),
|
|
234
|
+
return x(e, Element) && (wn(t, e, n), on(t, e, n), vn(t, e), bn(t, e)), e;
|
|
235
235
|
}
|
|
236
236
|
async function xn(t, e) {
|
|
237
237
|
const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (n.length === 0)
|
|
239
239
|
return t;
|
|
240
240
|
const r = {};
|
|
241
|
-
for (let
|
|
242
|
-
const c = n[
|
|
241
|
+
for (let i = 0; i < n.length; i++) {
|
|
242
|
+
const c = n[i].getAttribute("xlink:href");
|
|
243
243
|
if (c) {
|
|
244
244
|
const l = t.querySelector(c), u = document.querySelector(c);
|
|
245
245
|
!l && u && !r[c] && (r[c] = await mt(u, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
o.setAttribute("xmlns",
|
|
252
|
-
const c = document.createElementNS(
|
|
248
|
+
const a = Object.values(r);
|
|
249
|
+
if (a.length) {
|
|
250
|
+
const i = "http://www.w3.org/1999/xhtml", o = document.createElementNS(i, "svg");
|
|
251
|
+
o.setAttribute("xmlns", i), o.style.position = "absolute", o.style.width = "0", o.style.height = "0", o.style.overflow = "hidden", o.style.display = "none";
|
|
252
|
+
const c = document.createElementNS(i, "defs");
|
|
253
253
|
o.appendChild(c);
|
|
254
|
-
for (let l = 0; l <
|
|
255
|
-
c.appendChild(
|
|
254
|
+
for (let l = 0; l < a.length; l++)
|
|
255
|
+
c.appendChild(a[l]);
|
|
256
256
|
t.appendChild(o);
|
|
257
257
|
}
|
|
258
258
|
return t;
|
|
@@ -267,24 +267,24 @@ function Mn(t) {
|
|
|
267
267
|
}
|
|
268
268
|
function An(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(ye, (n, r,
|
|
270
|
+
return t.replace(ye, (n, r, a) => (e.push(a), n)), e.filter((n) => !At(n));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function $n(t, e, n, r, a) {
|
|
273
273
|
try {
|
|
274
|
-
const
|
|
274
|
+
const i = n ? Xe(e, n) : e, o = Ot(e);
|
|
275
275
|
let c;
|
|
276
|
-
return
|
|
276
|
+
return a || (c = await Ht(i, o, r)), t.replace(Mn(e), `$1${c}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Ln(t, { preferredFontFormat: e }) {
|
|
282
282
|
return e ? t.replace(Cn, (n) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [r, ,
|
|
285
|
-
if (!
|
|
284
|
+
const [r, , a] = En.exec(n) || [];
|
|
285
|
+
if (!a)
|
|
286
286
|
return "";
|
|
287
|
-
if (
|
|
287
|
+
if (a === e)
|
|
288
288
|
return `src: ${r};`;
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
@@ -295,51 +295,51 @@ function ge(t) {
|
|
|
295
295
|
async function we(t, e, n) {
|
|
296
296
|
if (!ge(t))
|
|
297
297
|
return t;
|
|
298
|
-
const r =
|
|
299
|
-
return An(r).reduce((
|
|
298
|
+
const r = Ln(t, n);
|
|
299
|
+
return An(r).reduce((i, o) => i.then((c) => $n(c, o, e, n)), Promise.resolve(r));
|
|
300
300
|
}
|
|
301
301
|
async function J(t, e, n) {
|
|
302
302
|
var r;
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
const
|
|
306
|
-
return e.style.setProperty(t,
|
|
303
|
+
const a = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
|
|
304
|
+
if (a) {
|
|
305
|
+
const i = await we(a, null, n);
|
|
306
|
+
return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
310
|
+
async function Rn(t, e) {
|
|
311
311
|
await J("background", t, e) || await J("background-image", t, e), await J("mask", t, e) || await J("-webkit-mask", t, e) || await J("mask-image", t, e) || await J("-webkit-mask-image", t, e);
|
|
312
312
|
}
|
|
313
313
|
async function kn(t, e) {
|
|
314
314
|
const n = x(t, HTMLImageElement);
|
|
315
315
|
if (!(n && !At(t.src)) && !(x(t, SVGImageElement) && !At(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const r = n ? t.src : t.href.baseVal,
|
|
318
|
-
await new Promise((
|
|
319
|
-
t.onload =
|
|
317
|
+
const r = n ? t.src : t.href.baseVal, a = await Ht(r, Ot(r), e);
|
|
318
|
+
await new Promise((i, o) => {
|
|
319
|
+
t.onload = i, t.onerror = e.onImageErrorHandler ? (...l) => {
|
|
320
320
|
try {
|
|
321
|
-
|
|
321
|
+
i(e.onImageErrorHandler(...l));
|
|
322
322
|
} catch (u) {
|
|
323
323
|
o(u);
|
|
324
324
|
}
|
|
325
325
|
} : o;
|
|
326
326
|
const c = t;
|
|
327
|
-
c.decode && (c.decode =
|
|
327
|
+
c.decode && (c.decode = i), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = a) : t.href.baseVal = a;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
async function Tn(t, e) {
|
|
331
|
-
const r = F(t.childNodes).map((
|
|
331
|
+
const r = F(t.childNodes).map((a) => ve(a, e));
|
|
332
332
|
await Promise.all(r).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
x(t, Element) && (await
|
|
334
|
+
async function ve(t, e) {
|
|
335
|
+
x(t, Element) && (await Rn(t, e), await kn(t, e), await Tn(t, e));
|
|
336
336
|
}
|
|
337
337
|
function Pn(t, e) {
|
|
338
338
|
const { style: n } = t;
|
|
339
339
|
e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
|
|
340
340
|
const r = e.style;
|
|
341
|
-
return r != null && Object.keys(r).forEach((
|
|
342
|
-
n[
|
|
341
|
+
return r != null && Object.keys(r).forEach((a) => {
|
|
342
|
+
n[a] = r[a];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
345
|
const Xt = {};
|
|
@@ -352,49 +352,49 @@ async function Yt(t) {
|
|
|
352
352
|
}
|
|
353
353
|
async function Gt(t, e) {
|
|
354
354
|
let n = t.cssText;
|
|
355
|
-
const r = /url\(["']?([^"')]+)["']?\)/g,
|
|
355
|
+
const r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
356
356
|
let c = o.replace(r, "$1");
|
|
357
357
|
return c.startsWith("https://") || (c = new URL(c, t.url).href), pe(c, e.fetchRequestInit, ({ result: l }) => (n = n.replace(o, `url(${l})`), [o, l]));
|
|
358
358
|
});
|
|
359
|
-
return Promise.all(
|
|
359
|
+
return Promise.all(i).then(() => n);
|
|
360
360
|
}
|
|
361
361
|
function Jt(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
|
|
365
365
|
let r = t.replace(n, "");
|
|
366
|
-
const
|
|
366
|
+
const a = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
367
367
|
for (; ; ) {
|
|
368
|
-
const l =
|
|
368
|
+
const l = a.exec(r);
|
|
369
369
|
if (l === null)
|
|
370
370
|
break;
|
|
371
371
|
e.push(l[0]);
|
|
372
372
|
}
|
|
373
|
-
r = r.replace(
|
|
374
|
-
const
|
|
373
|
+
r = r.replace(a, "");
|
|
374
|
+
const i = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, o = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", c = new RegExp(o, "gi");
|
|
375
375
|
for (; ; ) {
|
|
376
|
-
let l =
|
|
376
|
+
let l = i.exec(r);
|
|
377
377
|
if (l === null) {
|
|
378
378
|
if (l = c.exec(r), l === null)
|
|
379
379
|
break;
|
|
380
|
-
|
|
380
|
+
i.lastIndex = c.lastIndex;
|
|
381
381
|
} else
|
|
382
|
-
c.lastIndex =
|
|
382
|
+
c.lastIndex = i.lastIndex;
|
|
383
383
|
e.push(l[0]);
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
387
|
async function In(t, e) {
|
|
388
388
|
const n = [], r = [];
|
|
389
|
-
return t.forEach((
|
|
390
|
-
if ("cssRules" in
|
|
389
|
+
return t.forEach((a) => {
|
|
390
|
+
if ("cssRules" in a)
|
|
391
391
|
try {
|
|
392
|
-
F(
|
|
393
|
-
if (
|
|
392
|
+
F(a.cssRules || []).forEach((i, o) => {
|
|
393
|
+
if (i.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let c = o + 1;
|
|
395
|
-
const l =
|
|
395
|
+
const l = i.href, u = Yt(l).then((f) => Gt(f, e)).then((f) => Jt(f).forEach((m) => {
|
|
396
396
|
try {
|
|
397
|
-
|
|
397
|
+
a.insertRule(m, m.startsWith("@import") ? c += 1 : a.cssRules.length);
|
|
398
398
|
} catch (g) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
400
|
rule: m,
|
|
@@ -407,22 +407,22 @@ async function In(t, e) {
|
|
|
407
407
|
r.push(u);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
} catch (
|
|
410
|
+
} catch (i) {
|
|
411
411
|
const o = t.find((c) => c.href == null) || document.styleSheets[0];
|
|
412
|
-
|
|
412
|
+
a.href != null && r.push(Yt(a.href).then((c) => Gt(c, e)).then((c) => Jt(c).forEach((l) => {
|
|
413
413
|
o.insertRule(l, o.cssRules.length);
|
|
414
414
|
})).catch((c) => {
|
|
415
415
|
console.error("Error loading remote stylesheet", c);
|
|
416
|
-
})), console.error("Error inlining remote css file",
|
|
416
|
+
})), console.error("Error inlining remote css file", i);
|
|
417
417
|
}
|
|
418
|
-
}), Promise.all(r).then(() => (t.forEach((
|
|
419
|
-
if ("cssRules" in
|
|
418
|
+
}), Promise.all(r).then(() => (t.forEach((a) => {
|
|
419
|
+
if ("cssRules" in a)
|
|
420
420
|
try {
|
|
421
|
-
F(
|
|
422
|
-
n.push(
|
|
421
|
+
F(a.cssRules || []).forEach((i) => {
|
|
422
|
+
n.push(i);
|
|
423
423
|
});
|
|
424
|
-
} catch (
|
|
425
|
-
console.error(`Error while reading CSS rules from ${
|
|
424
|
+
} catch (i) {
|
|
425
|
+
console.error(`Error while reading CSS rules from ${a.href}`, i);
|
|
426
426
|
}
|
|
427
427
|
}), n));
|
|
428
428
|
}
|
|
@@ -435,42 +435,42 @@ async function Hn(t, e) {
|
|
|
435
435
|
const n = F(t.ownerDocument.styleSheets), r = await In(n, e);
|
|
436
436
|
return On(r);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function be(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
441
|
function Dn(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function n(r) {
|
|
444
|
-
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((
|
|
445
|
-
e.add(
|
|
446
|
-
}), Array.from(r.children).forEach((
|
|
447
|
-
|
|
444
|
+
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((i) => {
|
|
445
|
+
e.add(be(i));
|
|
446
|
+
}), Array.from(r.children).forEach((i) => {
|
|
447
|
+
i instanceof HTMLElement && n(i);
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
return n(t), e;
|
|
451
451
|
}
|
|
452
452
|
async function Bn(t, e) {
|
|
453
453
|
const n = await Hn(t, e), r = Dn(t);
|
|
454
|
-
return (await Promise.all(n.filter((
|
|
455
|
-
const o =
|
|
456
|
-
return we(
|
|
454
|
+
return (await Promise.all(n.filter((i) => r.has(be(i.style.fontFamily))).map((i) => {
|
|
455
|
+
const o = i.parentStyleSheet ? i.parentStyleSheet.href : null;
|
|
456
|
+
return we(i.cssText, o, e);
|
|
457
457
|
}))).join(`
|
|
458
458
|
`);
|
|
459
459
|
}
|
|
460
460
|
async function Fn(t, e) {
|
|
461
461
|
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Bn(t, e);
|
|
462
462
|
if (n) {
|
|
463
|
-
const r = document.createElement("style"),
|
|
464
|
-
r.appendChild(
|
|
463
|
+
const r = document.createElement("style"), a = document.createTextNode(n);
|
|
464
|
+
r.appendChild(a), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
async function Un(t, e = {}) {
|
|
468
|
-
const { width: n, height: r } = he(t, e),
|
|
469
|
-
return await Fn(
|
|
468
|
+
const { width: n, height: r } = he(t, e), a = await mt(t, e, !0);
|
|
469
|
+
return await Fn(a, e), await ve(a, e), Pn(a, e), await en(a, n, r);
|
|
470
470
|
}
|
|
471
471
|
async function Nn(t, e = {}) {
|
|
472
|
-
const { width: n, height: r } = he(t, e),
|
|
473
|
-
return o.width = u * l, o.height = f * l, e.skipAutoScale || Ze(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(
|
|
472
|
+
const { width: n, height: r } = he(t, e), a = await Un(t, e), i = await ct(a), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || Qe(), u = e.canvasWidth || n, f = e.canvasHeight || r;
|
|
473
|
+
return o.width = u * l, o.height = f * l, e.skipAutoScale || Ze(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(i, 0, 0, o.width, o.height), o;
|
|
474
474
|
}
|
|
475
475
|
async function Qt(t, e = {}) {
|
|
476
476
|
return (await Nn(t, e)).toDataURL();
|
|
@@ -506,8 +506,8 @@ function Vn() {
|
|
|
506
506
|
function Wn() {
|
|
507
507
|
const t = [];
|
|
508
508
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
|
|
509
|
-
const r = n.getBoundingClientRect(),
|
|
510
|
-
|
|
509
|
+
const r = n.getBoundingClientRect(), a = document.createElement("div");
|
|
510
|
+
a.setAttribute("data-nf-mask-cover", "1"), a.style.cssText = [
|
|
511
511
|
"position:fixed",
|
|
512
512
|
`left:${r.left}px`,
|
|
513
513
|
`top:${r.top}px`,
|
|
@@ -516,7 +516,7 @@ function Wn() {
|
|
|
516
516
|
"background:#111",
|
|
517
517
|
"z-index:2147483646",
|
|
518
518
|
"pointer-events:none"
|
|
519
|
-
].join(";"), document.body.appendChild(
|
|
519
|
+
].join(";"), document.body.appendChild(a), t.push(a);
|
|
520
520
|
}), () => t.forEach((n) => n.remove());
|
|
521
521
|
}
|
|
522
522
|
function zn() {
|
|
@@ -529,7 +529,7 @@ function zn() {
|
|
|
529
529
|
function qn() {
|
|
530
530
|
document.querySelectorAll(`[${lt}]`).forEach((t) => t.remove());
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function $t() {
|
|
533
533
|
return new Promise((t) => {
|
|
534
534
|
requestAnimationFrame(() => requestAnimationFrame(t));
|
|
535
535
|
});
|
|
@@ -569,8 +569,8 @@ async function Xn() {
|
|
|
569
569
|
}
|
|
570
570
|
if (!r || r === "data:,")
|
|
571
571
|
continue;
|
|
572
|
-
const
|
|
573
|
-
|
|
572
|
+
const a = document.createElement("img"), i = getComputedStyle(n);
|
|
573
|
+
a.setAttribute(jn, "1"), a.alt = "", a.src = r, a.className = n.className, a.style.cssText = n.style.cssText, a.style.width = i.width, a.style.height = i.height, a.style.maxWidth = i.maxWidth, a.style.maxHeight = i.maxHeight, a.style.objectFit = "fill", a.style.display = i.display === "inline" ? "inline-block" : i.display, n.replaceWith(a), t.push({ canvas: n, img: a });
|
|
574
574
|
}
|
|
575
575
|
return await Promise.all(t.map(({ img: n }) => {
|
|
576
576
|
if (!n.complete)
|
|
@@ -606,9 +606,9 @@ async function Yn(t) {
|
|
|
606
606
|
}
|
|
607
607
|
async function Gn(t) {
|
|
608
608
|
if (typeof FileReader == "function")
|
|
609
|
-
return new Promise((r,
|
|
610
|
-
const
|
|
611
|
-
|
|
609
|
+
return new Promise((r, a) => {
|
|
610
|
+
const i = new FileReader();
|
|
611
|
+
i.onload = () => r(String(i.result || "")), i.onerror = () => a(i.error || new Error("Could not read capture blob")), i.readAsDataURL(t);
|
|
612
612
|
});
|
|
613
613
|
const e = Buffer.from(await t.arrayBuffer());
|
|
614
614
|
return `data:${t.type || "application/octet-stream"};base64,${e.toString("base64")}`;
|
|
@@ -627,10 +627,10 @@ async function Jn() {
|
|
|
627
627
|
const n = document.createElement("video");
|
|
628
628
|
n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((c) => {
|
|
629
629
|
n.onloadedmetadata = () => c();
|
|
630
|
-
}), await
|
|
631
|
-
const r = n.videoWidth || 1,
|
|
632
|
-
|
|
633
|
-
const o =
|
|
630
|
+
}), await $t();
|
|
631
|
+
const r = n.videoWidth || 1, a = n.videoHeight || 1, i = document.createElement("canvas");
|
|
632
|
+
i.width = r, i.height = a, i.getContext("2d").drawImage(n, 0, 0, r, a);
|
|
633
|
+
const o = i.toDataURL("image/png");
|
|
634
634
|
if (!U(o))
|
|
635
635
|
throw new Error("Screen capture produced an empty image.");
|
|
636
636
|
return o;
|
|
@@ -639,18 +639,18 @@ async function Jn() {
|
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
async function xe(t = {}) {
|
|
642
|
-
const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = zn(),
|
|
643
|
-
let
|
|
642
|
+
const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = zn(), a = Vn();
|
|
643
|
+
let i = () => {
|
|
644
644
|
};
|
|
645
645
|
e && (e.style.display = "none");
|
|
646
646
|
const o = Wn();
|
|
647
647
|
try {
|
|
648
|
-
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await
|
|
648
|
+
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await $t(), typeof t.capture == "function") {
|
|
649
649
|
const m = await Yn(await t.capture());
|
|
650
650
|
if (m)
|
|
651
651
|
return m;
|
|
652
652
|
}
|
|
653
|
-
|
|
653
|
+
i = await Xn(), await $t();
|
|
654
654
|
const { width: c, height: l } = Kn(), u = {
|
|
655
655
|
cacheBust: !0,
|
|
656
656
|
width: c,
|
|
@@ -673,10 +673,10 @@ async function xe(t = {}) {
|
|
|
673
673
|
return f;
|
|
674
674
|
} finally {
|
|
675
675
|
try {
|
|
676
|
-
|
|
676
|
+
i();
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
o(),
|
|
679
|
+
o(), a(), r.remove(), qn(), e && (e.style.display = n);
|
|
680
680
|
}
|
|
681
681
|
}
|
|
682
682
|
function Qn(t = "") {
|
|
@@ -736,31 +736,31 @@ const Zt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), te = {
|
|
|
736
736
|
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
|
|
737
737
|
};
|
|
738
738
|
function er(t = {}, e = {}) {
|
|
739
|
-
const n = e.warn || Ee, r = t && typeof t == "object" ? t : {},
|
|
739
|
+
const n = e.warn || Ee, r = t && typeof t == "object" ? t : {}, a = {}, i = [];
|
|
740
740
|
for (const o of Zt)
|
|
741
|
-
Object.prototype.hasOwnProperty.call(r, o) && (
|
|
741
|
+
Object.prototype.hasOwnProperty.call(r, o) && (a[o] = r[o]);
|
|
742
742
|
for (const [o, c] of Object.entries(te))
|
|
743
|
-
Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(
|
|
743
|
+
Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(a, c) || (a[c] = r[o]));
|
|
744
744
|
for (const o of Object.keys(r))
|
|
745
|
-
Zt.has(o) || Object.prototype.hasOwnProperty.call(te, o) ||
|
|
746
|
-
if (
|
|
747
|
-
const o =
|
|
745
|
+
Zt.has(o) || Object.prototype.hasOwnProperty.call(te, o) || i.push(o);
|
|
746
|
+
if (i.length) {
|
|
747
|
+
const o = i.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
|
|
748
748
|
n(
|
|
749
|
-
`Notefully.identify: ignoring unknown key(s): ${
|
|
749
|
+
`Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` + o
|
|
750
750
|
);
|
|
751
751
|
}
|
|
752
|
-
return
|
|
752
|
+
return a;
|
|
753
753
|
}
|
|
754
754
|
function nr(t = {}, e = {}) {
|
|
755
|
-
const n = e.warn || Ee, r = t && typeof t == "object" ? t : {},
|
|
756
|
-
if (
|
|
757
|
-
for (const
|
|
758
|
-
if (ne[
|
|
759
|
-
n(`Notefully.init: ignoring "${
|
|
755
|
+
const n = e.warn || Ee, r = t && typeof t == "object" ? t : {}, a = Object.keys(r).filter((i) => !ee.has(i));
|
|
756
|
+
if (a.length)
|
|
757
|
+
for (const i of a) {
|
|
758
|
+
if (ne[i]) {
|
|
759
|
+
n(`Notefully.init: ignoring "${i}". ${ne[i]}`);
|
|
760
760
|
continue;
|
|
761
761
|
}
|
|
762
762
|
n(
|
|
763
|
-
`Notefully.init: ignoring unknown key "${
|
|
763
|
+
`Notefully.init: ignoring unknown key "${i}". Supported: ${[...ee].join(", ")}.`
|
|
764
764
|
);
|
|
765
765
|
}
|
|
766
766
|
}
|
|
@@ -771,7 +771,7 @@ const rr = 80;
|
|
|
771
771
|
function ir() {
|
|
772
772
|
const t = [], e = {};
|
|
773
773
|
let n = !1;
|
|
774
|
-
const r = (
|
|
774
|
+
const r = (i, o) => {
|
|
775
775
|
let c = "";
|
|
776
776
|
try {
|
|
777
777
|
c = o.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
|
|
@@ -779,21 +779,21 @@ function ir() {
|
|
|
779
779
|
c = String(o[0]);
|
|
780
780
|
}
|
|
781
781
|
t.push({
|
|
782
|
-
level:
|
|
782
|
+
level: i,
|
|
783
783
|
text: c.slice(0, 2e3),
|
|
784
784
|
at: Date.now()
|
|
785
785
|
}), t.length > rr && t.shift();
|
|
786
786
|
};
|
|
787
787
|
return {
|
|
788
788
|
hook: () => {
|
|
789
|
-
n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((
|
|
790
|
-
e[
|
|
791
|
-
r(
|
|
789
|
+
n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((i) => {
|
|
790
|
+
e[i] = console[i].bind(console), console[i] = (...o) => {
|
|
791
|
+
r(i, o), e[i](...o);
|
|
792
792
|
};
|
|
793
|
-
}), window.addEventListener("error", (
|
|
794
|
-
r("error", [
|
|
795
|
-
}), window.addEventListener("unhandledrejection", (
|
|
796
|
-
r("error", [
|
|
793
|
+
}), window.addEventListener("error", (i) => {
|
|
794
|
+
r("error", [i.message || "window.error"]);
|
|
795
|
+
}), window.addEventListener("unhandledrejection", (i) => {
|
|
796
|
+
r("error", [i.reason || "unhandledrejection"]);
|
|
797
797
|
}));
|
|
798
798
|
},
|
|
799
799
|
snapshot() {
|
|
@@ -804,7 +804,7 @@ function ir() {
|
|
|
804
804
|
function ar(t) {
|
|
805
805
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
806
806
|
let n = null, r = !1;
|
|
807
|
-
const
|
|
807
|
+
const a = () => {
|
|
808
808
|
if (r = !1, n)
|
|
809
809
|
try {
|
|
810
810
|
n.stop();
|
|
@@ -815,7 +815,7 @@ function ar(t) {
|
|
|
815
815
|
start: () => {
|
|
816
816
|
if (!e)
|
|
817
817
|
throw new Error("Speech recognition is not supported in this browser.");
|
|
818
|
-
return r ? (
|
|
818
|
+
return r ? (a(), !1) : (n = new e(), n.continuous = !0, n.interimResults = !0, n.lang = navigator.language || "en-US", n.onresult = (o) => {
|
|
819
819
|
let c = "";
|
|
820
820
|
for (let l = o.resultIndex; l < o.results.length; l += 1)
|
|
821
821
|
o.results[l].isFinal && (c += o.results[l][0].transcript);
|
|
@@ -826,24 +826,24 @@ function ar(t) {
|
|
|
826
826
|
r = !1;
|
|
827
827
|
}, n.start(), r = !0, !0);
|
|
828
828
|
},
|
|
829
|
-
stop:
|
|
829
|
+
stop: a,
|
|
830
830
|
isSupported: () => !!e,
|
|
831
831
|
isActive: () => r
|
|
832
832
|
};
|
|
833
833
|
}
|
|
834
834
|
const or = 60 * 1e3;
|
|
835
835
|
function sr({ onStart: t, onStop: e, onError: n }) {
|
|
836
|
-
let r = null,
|
|
836
|
+
let r = null, a = null, i = [], o = null;
|
|
837
837
|
const c = () => {
|
|
838
|
-
if (o && (clearTimeout(o), o = null),
|
|
838
|
+
if (o && (clearTimeout(o), o = null), a && a.state !== "inactive")
|
|
839
839
|
try {
|
|
840
|
-
|
|
840
|
+
a.stop();
|
|
841
841
|
} catch {
|
|
842
842
|
}
|
|
843
843
|
r && (r.getTracks().forEach((f) => f.stop()), r = null);
|
|
844
844
|
}, l = () => {
|
|
845
|
-
if (
|
|
846
|
-
|
|
845
|
+
if (a && a.state === "recording") {
|
|
846
|
+
a.stop();
|
|
847
847
|
return;
|
|
848
848
|
}
|
|
849
849
|
c(), e(null);
|
|
@@ -857,14 +857,14 @@ function sr({ onStart: t, onStop: e, onError: n }) {
|
|
|
857
857
|
audio: !1,
|
|
858
858
|
preferCurrentTab: !0,
|
|
859
859
|
selfBrowserSurface: "include"
|
|
860
|
-
}),
|
|
860
|
+
}), i = [], a = new MediaRecorder(r, {
|
|
861
861
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
862
|
-
}),
|
|
863
|
-
g.data && g.data.size &&
|
|
864
|
-
},
|
|
865
|
-
const g =
|
|
862
|
+
}), a.ondataavailable = (g) => {
|
|
863
|
+
g.data && g.data.size && i.push(g.data);
|
|
864
|
+
}, a.onstop = () => {
|
|
865
|
+
const g = i.length ? new Blob(i, { type: a.mimeType || "video/webm" }) : null;
|
|
866
866
|
c(), e(g);
|
|
867
|
-
}, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()),
|
|
867
|
+
}, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), a.start(), o = setTimeout(l, or);
|
|
868
868
|
}, stop: l };
|
|
869
869
|
}
|
|
870
870
|
function cr() {
|
|
@@ -890,11 +890,11 @@ function Dt() {
|
|
|
890
890
|
const t = cr();
|
|
891
891
|
let e = [], n = { ...St }, r = 1;
|
|
892
892
|
return {
|
|
893
|
-
list: () => e.filter((
|
|
893
|
+
list: () => e.filter((i) => ur(i, n)),
|
|
894
894
|
all: () => e.slice(),
|
|
895
895
|
crop: () => ({ ...n }),
|
|
896
|
-
setCrop(
|
|
897
|
-
return n = lr(
|
|
896
|
+
setCrop(i) {
|
|
897
|
+
return n = lr(i), n;
|
|
898
898
|
},
|
|
899
899
|
resetCrop() {
|
|
900
900
|
return n = { ...St }, n;
|
|
@@ -902,27 +902,27 @@ function Dt() {
|
|
|
902
902
|
isCropped() {
|
|
903
903
|
return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
|
|
904
904
|
},
|
|
905
|
-
add(
|
|
905
|
+
add(i, o) {
|
|
906
906
|
const c = {
|
|
907
907
|
id: `s${r++}`,
|
|
908
|
-
type:
|
|
908
|
+
type: i,
|
|
909
909
|
number: t.alloc(),
|
|
910
910
|
x: 0.2,
|
|
911
911
|
y: 0.2,
|
|
912
|
-
w:
|
|
913
|
-
h:
|
|
912
|
+
w: i === "arrow" ? 0.2 : 0.22,
|
|
913
|
+
h: i === "arrow" ? 0.05 : 0.16,
|
|
914
914
|
x2: 0.4,
|
|
915
915
|
y2: 0.28,
|
|
916
916
|
...o
|
|
917
917
|
};
|
|
918
918
|
return e.push(c), c;
|
|
919
919
|
},
|
|
920
|
-
update(
|
|
921
|
-
const c = e.find((l) => l.id ===
|
|
920
|
+
update(i, o) {
|
|
921
|
+
const c = e.find((l) => l.id === i);
|
|
922
922
|
return c ? (Object.assign(c, o), c) : null;
|
|
923
923
|
},
|
|
924
|
-
remove(
|
|
925
|
-
const o = e.findIndex((l) => l.id ===
|
|
924
|
+
remove(i) {
|
|
925
|
+
const o = e.findIndex((l) => l.id === i);
|
|
926
926
|
if (o < 0)
|
|
927
927
|
return null;
|
|
928
928
|
const [c] = e.splice(o, 1);
|
|
@@ -935,8 +935,8 @@ function Dt() {
|
|
|
935
935
|
};
|
|
936
936
|
}
|
|
937
937
|
function lr(t) {
|
|
938
|
-
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e),
|
|
939
|
-
return { x: e, y: n, w: r, h:
|
|
938
|
+
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e), a = Math.min(Math.max(t.h, 0.05), 1 - n);
|
|
939
|
+
return { x: e, y: n, w: r, h: a };
|
|
940
940
|
}
|
|
941
941
|
function ur(t, e) {
|
|
942
942
|
const n = t.type === "arrow" ? (t.x + (t.x2 ?? t.x)) / 2 : t.x + (t.w || 0) / 2, r = t.type === "arrow" ? (t.y + (t.y2 ?? t.y)) / 2 : t.y + (t.h || 0) / 2;
|
|
@@ -956,12 +956,12 @@ function dr(t, {
|
|
|
956
956
|
stickers: e = [],
|
|
957
957
|
crop: n = { x: 0, y: 0, w: 1, h: 1 },
|
|
958
958
|
width: r,
|
|
959
|
-
height:
|
|
960
|
-
colors:
|
|
959
|
+
height: a,
|
|
960
|
+
colors: i = {}
|
|
961
961
|
}) {
|
|
962
|
-
const o =
|
|
962
|
+
const o = i.mark || "#fdd341", c = i.markText || "#2a2140", l = Bt(r);
|
|
963
963
|
t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = o, t.fillStyle = o, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
|
|
964
|
-
const f =
|
|
964
|
+
const f = Lt(u.x, n, r), m = Rt(u.y, n, a), g = u.w / n.w * r, S = u.h / n.h * a, L = l.stroke / 2;
|
|
965
965
|
if (u.type === "rect")
|
|
966
966
|
t.strokeRect(
|
|
967
967
|
f + L,
|
|
@@ -980,50 +980,50 @@ function dr(t, {
|
|
|
980
980
|
Math.PI * 2
|
|
981
981
|
), t.stroke();
|
|
982
982
|
else if (u.type === "arrow") {
|
|
983
|
-
const K =
|
|
983
|
+
const K = Lt(u.x2 ?? u.x + u.w, n, r), X = Rt(u.y2 ?? u.y, n, a);
|
|
984
984
|
hr(t, f, m, K, X, l);
|
|
985
985
|
}
|
|
986
986
|
if (u.number == null || u.number === "")
|
|
987
987
|
return;
|
|
988
|
-
const H = fr(u, n, r,
|
|
988
|
+
const H = fr(u, n, r, a, f, m, g), Z = String(u.number);
|
|
989
989
|
t.beginPath(), t.arc(H.x, H.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Z, H.x, H.y + 0.5), t.fillStyle = o;
|
|
990
990
|
}), t.restore();
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function Lt(t, e, n) {
|
|
993
993
|
return (t - e.x) / e.w * n;
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function Rt(t, e, n) {
|
|
996
996
|
return (t - e.y) / e.h * n;
|
|
997
997
|
}
|
|
998
|
-
function fr(t, e, n, r,
|
|
998
|
+
function fr(t, e, n, r, a, i, o) {
|
|
999
999
|
if (t.type === "arrow") {
|
|
1000
|
-
const c =
|
|
1000
|
+
const c = Lt(t.x2 ?? t.x + t.w, e, n), l = Rt(t.y2 ?? t.y, e, r);
|
|
1001
1001
|
return {
|
|
1002
|
-
x: (
|
|
1003
|
-
y: (
|
|
1002
|
+
x: (a + c) / 2,
|
|
1003
|
+
y: (i + l) / 2
|
|
1004
1004
|
};
|
|
1005
1005
|
}
|
|
1006
|
-
return { x:
|
|
1006
|
+
return { x: a + o / 2, y: i };
|
|
1007
1007
|
}
|
|
1008
|
-
function Ce(t, e, n, r,
|
|
1009
|
-
const
|
|
1010
|
-
x: l - o * Math.cos(
|
|
1011
|
-
y: u - o * Math.sin(
|
|
1008
|
+
function Ce(t, e, n, r, a) {
|
|
1009
|
+
const i = Math.atan2(r - e, n - t), o = a.arrowHead, c = Math.min(a.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(i) * o, m = r - Math.sin(i) * o, g = {
|
|
1010
|
+
x: l - o * Math.cos(i - a.arrowHeadAngle),
|
|
1011
|
+
y: u - o * Math.sin(i - a.arrowHeadAngle)
|
|
1012
1012
|
}, S = {
|
|
1013
|
-
x: l - o * Math.cos(
|
|
1014
|
-
y: u - o * Math.sin(
|
|
1013
|
+
x: l - o * Math.cos(i + a.arrowHeadAngle),
|
|
1014
|
+
y: u - o * Math.sin(i + a.arrowHeadAngle)
|
|
1015
1015
|
}, L = {
|
|
1016
|
-
x: n - Math.cos(
|
|
1017
|
-
y: r - Math.sin(
|
|
1016
|
+
x: n - Math.cos(i) * c,
|
|
1017
|
+
y: r - Math.sin(i) * c
|
|
1018
1018
|
};
|
|
1019
|
-
return { angle:
|
|
1019
|
+
return { angle: i, tipX: l, tipY: u, baseX: f, baseY: m, left: g, right: S, shaftEnd: L };
|
|
1020
1020
|
}
|
|
1021
|
-
function hr(t, e, n, r,
|
|
1022
|
-
const o = Ce(e, n, r,
|
|
1021
|
+
function hr(t, e, n, r, a, i) {
|
|
1022
|
+
const o = Ce(e, n, r, a, i);
|
|
1023
1023
|
t.beginPath(), t.moveTo(e, n), t.lineTo(o.shaftEnd.x, o.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(o.tipX, o.tipY), t.lineTo(o.left.x, o.left.y), t.lineTo(o.right.x, o.right.y), t.closePath(), t.fill();
|
|
1024
1024
|
}
|
|
1025
1025
|
function pr(t, e, n, r = {}) {
|
|
1026
|
-
return new Promise((
|
|
1026
|
+
return new Promise((a, i) => {
|
|
1027
1027
|
const o = new Image();
|
|
1028
1028
|
o.onload = () => {
|
|
1029
1029
|
const c = Math.round(e.x * o.width), l = Math.round(e.y * o.height), u = Math.max(1, Math.round(e.w * o.width)), f = Math.max(1, Math.round(e.h * o.height)), m = document.createElement("canvas");
|
|
@@ -1037,12 +1037,12 @@ function pr(t, e, n, r = {}) {
|
|
|
1037
1037
|
colors: r
|
|
1038
1038
|
}), m.toBlob((S) => {
|
|
1039
1039
|
if (!S) {
|
|
1040
|
-
|
|
1040
|
+
i(new Error("Could not encode screenshot"));
|
|
1041
1041
|
return;
|
|
1042
1042
|
}
|
|
1043
|
-
|
|
1043
|
+
a(S);
|
|
1044
1044
|
}, "image/png");
|
|
1045
|
-
}, o.onerror = () =>
|
|
1045
|
+
}, o.onerror = () => i(new Error("Could not load screenshot")), o.src = t;
|
|
1046
1046
|
});
|
|
1047
1047
|
}
|
|
1048
1048
|
const mr = [
|
|
@@ -1081,7 +1081,7 @@ function wr(t = []) {
|
|
|
1081
1081
|
redacted: !1
|
|
1082
1082
|
}));
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1084
|
+
function vr(t = []) {
|
|
1085
1085
|
if (!t.length)
|
|
1086
1086
|
return { checked: !1, indeterminate: !1 };
|
|
1087
1087
|
const e = t.filter((n) => n.redacted).length;
|
|
@@ -1092,9 +1092,9 @@ function re(t, e) {
|
|
|
1092
1092
|
n.redacted = !!e;
|
|
1093
1093
|
});
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1096
|
-
const e = t.diagnostics || [], n = t.logs || [], r = e.some((
|
|
1097
|
-
return r &&
|
|
1095
|
+
function br(t = {}) {
|
|
1096
|
+
const e = t.diagnostics || [], n = t.logs || [], r = e.some((i) => !i.redacted), a = n.length > 0 && n.some((i) => !i.redacted);
|
|
1097
|
+
return r && a ? "Also sending logs and diagnostic information" : r ? "Also sending diagnostic information" : a ? "Also sending logs" : "";
|
|
1098
1098
|
}
|
|
1099
1099
|
function Sr(t) {
|
|
1100
1100
|
if (t == null)
|
|
@@ -1136,8 +1136,8 @@ function Er(t) {
|
|
|
1136
1136
|
return W.map((r) => ({ ...r }));
|
|
1137
1137
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
1138
1138
|
for (const r of t) {
|
|
1139
|
-
let
|
|
1140
|
-
typeof r == "string" || typeof r == "number" ? (
|
|
1139
|
+
let a = "", i = "";
|
|
1140
|
+
typeof r == "string" || typeof r == "number" ? (a = ie(r), i = xt(a)) : r && typeof r == "object" && (a = ie(r.id ?? r.value ?? r.kind), i = String(r.label || r.name || xt(a)).trim() || xt(a)), !(!a || e.has(a)) && (e.add(a), n.push({ id: a, label: i }));
|
|
1141
1141
|
}
|
|
1142
1142
|
return n.length ? n : W.map((r) => ({ ...r }));
|
|
1143
1143
|
}
|
|
@@ -1155,7 +1155,7 @@ const Cr = ["maker", "all-business", "brighter-day", "quiet-night"], Me = "maker
|
|
|
1155
1155
|
function R(t) {
|
|
1156
1156
|
return `<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`;
|
|
1157
1157
|
}
|
|
1158
|
-
const
|
|
1158
|
+
const A = {
|
|
1159
1159
|
crop: R('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
|
|
1160
1160
|
resetCrop: R('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
|
|
1161
1161
|
arrow: R('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
|
|
@@ -1168,7 +1168,7 @@ const M = {
|
|
|
1168
1168
|
video: R('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
1169
1169
|
}, Ae = ir();
|
|
1170
1170
|
Ae.hook();
|
|
1171
|
-
const
|
|
1171
|
+
const $e = 10, $r = 80, Le = "notefully.author", Tt = "Anonymous";
|
|
1172
1172
|
let d = {
|
|
1173
1173
|
endpoint: "",
|
|
1174
1174
|
projectKey: "",
|
|
@@ -1178,25 +1178,25 @@ let d = {
|
|
|
1178
1178
|
hideLauncher: !1,
|
|
1179
1179
|
theme: Me,
|
|
1180
1180
|
video: !1,
|
|
1181
|
-
consoleLogLimit:
|
|
1181
|
+
consoleLogLimit: $e,
|
|
1182
1182
|
kinds: W.map((t) => ({ ...t })),
|
|
1183
1183
|
capture: null,
|
|
1184
1184
|
onBeforeCapture: null
|
|
1185
|
-
}, Et = !1,
|
|
1185
|
+
}, Et = !1, k = {}, h = null, s = {}, y = Dt(), P = "", Q = "", T = null, z = yt(W), B = null, $ = null, v = null, w = null, ot = null, V = null, tt = null, I = { w: 0, h: 0 }, Ct = !1, Ft = !1, N = [], O = [], _ = !1;
|
|
1186
1186
|
function p(t) {
|
|
1187
1187
|
return h.querySelector(t);
|
|
1188
1188
|
}
|
|
1189
|
-
function
|
|
1189
|
+
function Re(t) {
|
|
1190
1190
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
1191
1191
|
return Cr.includes(e) ? e : Me;
|
|
1192
1192
|
}
|
|
1193
1193
|
function oe(t, e) {
|
|
1194
1194
|
return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
|
|
1195
1195
|
}
|
|
1196
|
-
async function
|
|
1196
|
+
async function Lr(t) {
|
|
1197
1197
|
return (await fetch(t)).blob();
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1199
|
+
function b(t, e = !1) {
|
|
1200
1200
|
s.status && (s.status.textContent = t || "", ot && (clearTimeout(ot), ot = null), t && !e && (ot = setTimeout(() => {
|
|
1201
1201
|
s.status.textContent = "";
|
|
1202
1202
|
}, 4e3)));
|
|
@@ -1209,33 +1209,35 @@ function Ut() {
|
|
|
1209
1209
|
<div class="nf-panel-body">
|
|
1210
1210
|
<div class="nf-stage" hidden>
|
|
1211
1211
|
<div class="nf-palette">
|
|
1212
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${
|
|
1213
|
-
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${
|
|
1214
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${
|
|
1215
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${
|
|
1216
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${
|
|
1217
|
-
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${
|
|
1218
|
-
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${
|
|
1212
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${A.crop}</button>
|
|
1213
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${A.resetCrop}</button>
|
|
1214
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${A.arrow}</button>
|
|
1215
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${A.rect}</button>
|
|
1216
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${A.circle}</button>
|
|
1217
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${A.discard}</button>
|
|
1218
|
+
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${A.recapture}</button>
|
|
1219
1219
|
</div>
|
|
1220
1220
|
<div class="nf-canvas"></div>
|
|
1221
1221
|
</div>
|
|
1222
1222
|
<textarea class="nf-text" placeholder="Describe the bug or the change you want…"></textarea>
|
|
1223
1223
|
<input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
|
|
1224
|
-
<div class="nf-kind"
|
|
1225
|
-
|
|
1224
|
+
<div class="nf-kind-row">
|
|
1225
|
+
<div class="nf-kind"></div>
|
|
1226
1226
|
<div class="nf-privacy-summary">
|
|
1227
1227
|
<span class="nf-privacy-text"></span>
|
|
1228
|
-
<button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${
|
|
1228
|
+
<button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${A.privacy}</button>
|
|
1229
1229
|
</div>
|
|
1230
|
+
</div>
|
|
1231
|
+
<div class="nf-privacy">
|
|
1230
1232
|
<div class="nf-privacy-panel" hidden>
|
|
1231
1233
|
<div class="nf-privacy-scroll"></div>
|
|
1232
1234
|
<button class="nf-privacy-done" type="button">Done</button>
|
|
1233
1235
|
</div>
|
|
1234
1236
|
</div>
|
|
1235
1237
|
<div class="nf-actions">
|
|
1236
|
-
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${
|
|
1237
|
-
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${
|
|
1238
|
-
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${
|
|
1238
|
+
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${A.resetCrop}</button>
|
|
1239
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${A.audio}</button>
|
|
1240
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${A.video}</button>
|
|
1239
1241
|
<button class="nf-submit" type="button">Submit</button>
|
|
1240
1242
|
</div>
|
|
1241
1243
|
<div class="nf-status"></div>
|
|
@@ -1255,6 +1257,7 @@ function Ut() {
|
|
|
1255
1257
|
canvas: p(".nf-canvas"),
|
|
1256
1258
|
text: p(".nf-text"),
|
|
1257
1259
|
author: p(".nf-author"),
|
|
1260
|
+
kindRow: p(".nf-kind-row"),
|
|
1258
1261
|
kind: p(".nf-kind"),
|
|
1259
1262
|
privacy: p(".nf-privacy"),
|
|
1260
1263
|
privacySummary: p(".nf-privacy-summary"),
|
|
@@ -1274,16 +1277,16 @@ function Ut() {
|
|
|
1274
1277
|
resetCrop: p(".nf-reset-crop"),
|
|
1275
1278
|
submit: p(".nf-submit"),
|
|
1276
1279
|
shot: null
|
|
1277
|
-
},
|
|
1280
|
+
}, Rr(), nt()), h;
|
|
1278
1281
|
}
|
|
1279
1282
|
function nt() {
|
|
1280
1283
|
var t;
|
|
1281
|
-
h && (h.dataset.theme =
|
|
1284
|
+
h && (h.dataset.theme = Re(d.theme), d.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), ke(), (t = s.dialog) != null && t.hidden && ut());
|
|
1282
1285
|
}
|
|
1283
1286
|
function ut() {
|
|
1284
1287
|
s.launcher && (s.launcher.hidden = !!d.hideLauncher);
|
|
1285
1288
|
}
|
|
1286
|
-
function
|
|
1289
|
+
function Rr() {
|
|
1287
1290
|
s.launcher.addEventListener("click", () => ze()), p(".nf-dialog").addEventListener("click", (e) => {
|
|
1288
1291
|
Ft || e.target === s.dialog && at();
|
|
1289
1292
|
}), h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
@@ -1294,12 +1297,12 @@ function $r() {
|
|
|
1294
1297
|
const n = e.target.closest("[data-kind]");
|
|
1295
1298
|
n && Nt(n.dataset.kind);
|
|
1296
1299
|
}), s.discard.addEventListener("click", Br), s.recapture.addEventListener("click", () => {
|
|
1297
|
-
Ur().catch((e) =>
|
|
1300
|
+
Ur().catch((e) => b(e.message || "Recapture failed."));
|
|
1298
1301
|
}), s.restore.addEventListener("click", Fr), s.audio.addEventListener("click", Nr), s.video.addEventListener("click", jr), s.stop.addEventListener("click", () => tt == null ? void 0 : tt.stop()), s.privacyChange.addEventListener("click", () => pt(!_)), s.privacyDone.addEventListener("click", () => pt(!1)), s.privacyScroll.addEventListener("change", Jr), p(".nf-submit").addEventListener("click", () => {
|
|
1299
|
-
Ke().catch((e) =>
|
|
1302
|
+
Ke().catch((e) => b(e.message || "Submit failed."));
|
|
1300
1303
|
}), ke(), et(null);
|
|
1301
1304
|
}
|
|
1302
|
-
function
|
|
1305
|
+
function C(t) {
|
|
1303
1306
|
return String(t || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1304
1307
|
}
|
|
1305
1308
|
function ke() {
|
|
@@ -1307,8 +1310,8 @@ function ke() {
|
|
|
1307
1310
|
if (!t)
|
|
1308
1311
|
return;
|
|
1309
1312
|
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : W;
|
|
1310
|
-
t.innerHTML = e.map((
|
|
1311
|
-
const r = e.map((
|
|
1313
|
+
t.innerHTML = e.map((a) => `<button type="button" data-kind="${C(a.id)}">${C(a.label)}</button>`).join("");
|
|
1314
|
+
const r = e.map((a) => a.id).includes(z) ? z : yt(e);
|
|
1312
1315
|
Nt(r);
|
|
1313
1316
|
}
|
|
1314
1317
|
function Nt(t) {
|
|
@@ -1317,9 +1320,9 @@ function Nt(t) {
|
|
|
1317
1320
|
});
|
|
1318
1321
|
}
|
|
1319
1322
|
function et(t) {
|
|
1320
|
-
B = Mr.has(t) ? t : null,
|
|
1323
|
+
B = Mr.has(t) ? t : null, $ = null, h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1321
1324
|
e.dataset.active = String(e.dataset.tool === B);
|
|
1322
|
-
}), s.canvas && (s.canvas.dataset.draw = B ? "true" : "false"), j() &&
|
|
1325
|
+
}), s.canvas && (s.canvas.dataset.draw = B ? "true" : "false"), j() && M();
|
|
1323
1326
|
}
|
|
1324
1327
|
function se(t) {
|
|
1325
1328
|
return Math.min(1, Math.max(0, t));
|
|
@@ -1373,33 +1376,33 @@ function Tr(t) {
|
|
|
1373
1376
|
if (t.button !== 0 || !j())
|
|
1374
1377
|
return;
|
|
1375
1378
|
if (!t.target.closest(".nf-sticker") && !kr(t)) {
|
|
1376
|
-
|
|
1379
|
+
$ = null, M();
|
|
1377
1380
|
return;
|
|
1378
1381
|
}
|
|
1379
1382
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1380
1383
|
if (n && n.dataset.preview !== "true") {
|
|
1381
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1384
|
+
t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, Mt(t), Pr({
|
|
1382
1385
|
kind: "sticker",
|
|
1383
|
-
id:
|
|
1386
|
+
id: $,
|
|
1384
1387
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
1385
|
-
}, t),
|
|
1388
|
+
}, t), M();
|
|
1386
1389
|
return;
|
|
1387
1390
|
}
|
|
1388
|
-
if (
|
|
1389
|
-
t.preventDefault(), Mt(t),
|
|
1391
|
+
if ($ = null, B === "crop") {
|
|
1392
|
+
t.preventDefault(), Mt(t), v = { kind: "crop", start: dt(t), current: dt(t) }, Pt(), M();
|
|
1390
1393
|
return;
|
|
1391
1394
|
}
|
|
1392
1395
|
if (B === "arrow" || B === "rect" || B === "circle") {
|
|
1393
1396
|
t.preventDefault(), Mt(t);
|
|
1394
1397
|
const r = Te(t);
|
|
1395
|
-
|
|
1398
|
+
v = { kind: "sticker", type: B, start: r, current: r }, Pt(), M();
|
|
1396
1399
|
return;
|
|
1397
1400
|
}
|
|
1398
|
-
|
|
1401
|
+
M();
|
|
1399
1402
|
}
|
|
1400
1403
|
function Pr(t, e) {
|
|
1401
1404
|
e.preventDefault(), e.stopPropagation();
|
|
1402
|
-
const n = rt().getBoundingClientRect(), r = y.list().find((
|
|
1405
|
+
const n = rt().getBoundingClientRect(), r = y.list().find((a) => a.id === t.id);
|
|
1403
1406
|
w = {
|
|
1404
1407
|
...t,
|
|
1405
1408
|
startX: e.clientX,
|
|
@@ -1410,8 +1413,8 @@ function Pr(t, e) {
|
|
|
1410
1413
|
}, jt(t.dir === "move" || t.dir === "start" || t.dir === "end"), Pt();
|
|
1411
1414
|
}
|
|
1412
1415
|
function Ie(t) {
|
|
1413
|
-
if (
|
|
1414
|
-
|
|
1416
|
+
if (v) {
|
|
1417
|
+
v.current = v.kind === "crop" ? dt(t) : Te(t), M();
|
|
1415
1418
|
return;
|
|
1416
1419
|
}
|
|
1417
1420
|
if (!w)
|
|
@@ -1436,56 +1439,56 @@ function Ie(t) {
|
|
|
1436
1439
|
y2: (r.y2 || r.y) + n
|
|
1437
1440
|
});
|
|
1438
1441
|
else {
|
|
1439
|
-
const
|
|
1440
|
-
Ir(
|
|
1442
|
+
const a = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1443
|
+
Ir(a, w.dir, e, n), y.update(r.id, a);
|
|
1441
1444
|
}
|
|
1442
|
-
|
|
1445
|
+
M();
|
|
1443
1446
|
}
|
|
1444
1447
|
}
|
|
1445
1448
|
function Ir(t, e, n, r) {
|
|
1446
1449
|
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")) {
|
|
1447
|
-
const
|
|
1448
|
-
t.x += t.w -
|
|
1450
|
+
const a = Math.max(0.04, t.w - n);
|
|
1451
|
+
t.x += t.w - a, t.w = a;
|
|
1449
1452
|
}
|
|
1450
1453
|
if (e.includes("n")) {
|
|
1451
|
-
const
|
|
1452
|
-
t.y += t.h -
|
|
1454
|
+
const a = Math.max(0.04, t.h - r);
|
|
1455
|
+
t.y += t.h - a, t.h = a;
|
|
1453
1456
|
}
|
|
1454
1457
|
}
|
|
1455
1458
|
function ft(t) {
|
|
1456
|
-
if (Pe(), jt(!1),
|
|
1459
|
+
if (Pe(), jt(!1), v) {
|
|
1457
1460
|
Or();
|
|
1458
1461
|
return;
|
|
1459
1462
|
}
|
|
1460
1463
|
if (w) {
|
|
1461
1464
|
if (w.kind === "sticker") {
|
|
1462
1465
|
const e = s.canvas.getBoundingClientRect();
|
|
1463
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (y.remove(w.id),
|
|
1466
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (y.remove(w.id), $ = null);
|
|
1464
1467
|
}
|
|
1465
|
-
w = null,
|
|
1468
|
+
w = null, M();
|
|
1466
1469
|
}
|
|
1467
1470
|
}
|
|
1468
1471
|
function Or() {
|
|
1469
|
-
const t =
|
|
1470
|
-
if (
|
|
1472
|
+
const t = v;
|
|
1473
|
+
if (v = null, !t)
|
|
1471
1474
|
return;
|
|
1472
1475
|
if (t.kind === "crop") {
|
|
1473
1476
|
const n = gt(t.start, t.current);
|
|
1474
1477
|
if (Math.abs(t.current.x - t.start.x) < ae || Math.abs(t.current.y - t.start.y) < ae) {
|
|
1475
|
-
|
|
1478
|
+
M();
|
|
1476
1479
|
return;
|
|
1477
1480
|
}
|
|
1478
|
-
const
|
|
1481
|
+
const a = y.crop();
|
|
1479
1482
|
y.setCrop({
|
|
1480
|
-
x:
|
|
1481
|
-
y:
|
|
1482
|
-
w: n.w *
|
|
1483
|
-
h: n.h *
|
|
1483
|
+
x: a.x + n.x * a.w,
|
|
1484
|
+
y: a.y + n.y * a.h,
|
|
1485
|
+
w: n.w * a.w,
|
|
1486
|
+
h: n.h * a.h
|
|
1484
1487
|
}), q();
|
|
1485
1488
|
return;
|
|
1486
1489
|
}
|
|
1487
1490
|
const e = Hr(t);
|
|
1488
|
-
e && (
|
|
1491
|
+
e && ($ = e.id), M();
|
|
1489
1492
|
}
|
|
1490
1493
|
function Hr(t) {
|
|
1491
1494
|
if (t.type === "arrow") {
|
|
@@ -1509,7 +1512,7 @@ function Hr(t) {
|
|
|
1509
1512
|
return y.add(t.type, gt(t.start, t.current));
|
|
1510
1513
|
}
|
|
1511
1514
|
function Dr() {
|
|
1512
|
-
y.resetCrop(),
|
|
1515
|
+
y.resetCrop(), $ = null, q();
|
|
1513
1516
|
}
|
|
1514
1517
|
function ht() {
|
|
1515
1518
|
s.resetCrop && (s.resetCrop.hidden = !y.isCropped());
|
|
@@ -1521,19 +1524,19 @@ function _t(t) {
|
|
|
1521
1524
|
s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
|
|
1522
1525
|
}
|
|
1523
1526
|
function j() {
|
|
1524
|
-
return U(
|
|
1527
|
+
return U(P);
|
|
1525
1528
|
}
|
|
1526
1529
|
function it() {
|
|
1527
1530
|
if (!s.stage || !s.palette || !s.actions || !s.recapture)
|
|
1528
1531
|
return;
|
|
1529
1532
|
const t = j();
|
|
1530
|
-
s.stage.hidden = !t && !
|
|
1533
|
+
s.stage.hidden = !t && !T, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !Q), t ? (s.palette.appendChild(s.discard), s.palette.appendChild(s.recapture)) : s.audio ? s.audio.after(s.recapture) : s.actions.insertBefore(s.recapture, s.submit || null), s.recapture.hidden = !1;
|
|
1531
1534
|
}
|
|
1532
1535
|
function Br() {
|
|
1533
|
-
j() && (Q =
|
|
1536
|
+
j() && (Q = P), P = "", et(null), it(), q();
|
|
1534
1537
|
}
|
|
1535
1538
|
function Fr() {
|
|
1536
|
-
U(Q) && (
|
|
1539
|
+
U(Q) && (P = Q, it(), q());
|
|
1537
1540
|
}
|
|
1538
1541
|
function Oe() {
|
|
1539
1542
|
return {
|
|
@@ -1544,11 +1547,11 @@ function Oe() {
|
|
|
1544
1547
|
function He(t) {
|
|
1545
1548
|
if (!U(t))
|
|
1546
1549
|
throw new Error("Screenshot failed; you can still send text.");
|
|
1547
|
-
|
|
1550
|
+
P = t, Q = t, y = Dt(), I = { w: 0, h: 0 }, $ = null, v = null, w = null, et(null);
|
|
1548
1551
|
}
|
|
1549
1552
|
async function Ur() {
|
|
1550
1553
|
if (!(Et || !s.dialog || s.dialog.hidden)) {
|
|
1551
|
-
Et = !0, s.recapture.disabled = !0,
|
|
1554
|
+
Et = !0, s.recapture.disabled = !0, b("Capturing…", !0), s.dialog.hidden = !0;
|
|
1552
1555
|
try {
|
|
1553
1556
|
let t = "";
|
|
1554
1557
|
try {
|
|
@@ -1556,9 +1559,9 @@ async function Ur() {
|
|
|
1556
1559
|
} catch {
|
|
1557
1560
|
t = await xe(Oe());
|
|
1558
1561
|
}
|
|
1559
|
-
He(t),
|
|
1562
|
+
He(t), b("");
|
|
1560
1563
|
} catch (t) {
|
|
1561
|
-
|
|
1564
|
+
b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1562
1565
|
} finally {
|
|
1563
1566
|
s.dialog.hidden = !1, s.recapture.disabled = !1, Et = !1, it(), q();
|
|
1564
1567
|
}
|
|
@@ -1570,54 +1573,54 @@ function Nr() {
|
|
|
1570
1573
|
const n = s.text.value.trim();
|
|
1571
1574
|
s.text.value = n ? `${n} ${e}` : e;
|
|
1572
1575
|
})), !V.isSupported()) {
|
|
1573
|
-
|
|
1576
|
+
b("Audio-to-text is not supported in this browser.");
|
|
1574
1577
|
return;
|
|
1575
1578
|
}
|
|
1576
1579
|
const t = V.start();
|
|
1577
|
-
_t(t),
|
|
1580
|
+
_t(t), b(t ? "Listening…" : "");
|
|
1578
1581
|
} catch (t) {
|
|
1579
|
-
|
|
1582
|
+
b(t.message);
|
|
1580
1583
|
}
|
|
1581
1584
|
}
|
|
1582
1585
|
async function jr() {
|
|
1583
1586
|
if (!d.video) {
|
|
1584
|
-
|
|
1587
|
+
b("Video is disabled on this host.");
|
|
1585
1588
|
return;
|
|
1586
1589
|
}
|
|
1587
1590
|
s.dialog.hidden = !0, s.stop.hidden = !1, nt(), s.launcher.hidden = !0, tt = sr({
|
|
1588
1591
|
onStart() {
|
|
1589
1592
|
},
|
|
1590
1593
|
onStop(t) {
|
|
1591
|
-
|
|
1594
|
+
T = t, s.stop.hidden = !0, ut(), s.dialog.hidden = !1, it(), q(), b(t ? "Video attached." : "Recording cancelled.");
|
|
1592
1595
|
},
|
|
1593
1596
|
onError(t) {
|
|
1594
|
-
|
|
1597
|
+
b(t.message);
|
|
1595
1598
|
}
|
|
1596
1599
|
});
|
|
1597
1600
|
try {
|
|
1598
1601
|
await tt.start();
|
|
1599
1602
|
} catch (t) {
|
|
1600
|
-
s.stop.hidden = !0, ut(), s.dialog.hidden = !1,
|
|
1603
|
+
s.stop.hidden = !0, ut(), s.dialog.hidden = !1, b(t.message);
|
|
1601
1604
|
}
|
|
1602
1605
|
}
|
|
1603
1606
|
function q() {
|
|
1604
1607
|
if (s.shot = null, !j()) {
|
|
1605
|
-
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML =
|
|
1608
|
+
s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = T ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(T)}"></video>` : "", ht();
|
|
1606
1609
|
return;
|
|
1607
1610
|
}
|
|
1608
|
-
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${
|
|
1611
|
+
s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${P}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
|
|
1609
1612
|
const t = s.shot.querySelector("img");
|
|
1610
1613
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1611
1614
|
const e = () => {
|
|
1612
|
-
_r(t),
|
|
1615
|
+
_r(t), M();
|
|
1613
1616
|
};
|
|
1614
1617
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e(), ht();
|
|
1615
1618
|
}
|
|
1616
1619
|
function _r(t) {
|
|
1617
|
-
const e = t.naturalWidth ||
|
|
1618
|
-
if (e && n && (
|
|
1620
|
+
const e = t.naturalWidth || I.w, n = t.naturalHeight || I.h;
|
|
1621
|
+
if (e && n && (I = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !I.w || !I.h)
|
|
1619
1622
|
return;
|
|
1620
|
-
const r = y.crop(),
|
|
1623
|
+
const r = y.crop(), a = I.w / I.h, i = r.w / r.h * a, o = Math.min(1, i / a), c = Math.min(1, a / i);
|
|
1621
1624
|
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}%`;
|
|
1622
1625
|
}
|
|
1623
1626
|
function Vr(t) {
|
|
@@ -1638,37 +1641,37 @@ function Vr(t) {
|
|
|
1638
1641
|
...gt(t.start, t.current)
|
|
1639
1642
|
};
|
|
1640
1643
|
}
|
|
1641
|
-
function
|
|
1642
|
-
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((
|
|
1644
|
+
function M() {
|
|
1645
|
+
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((i) => i.remove()), !j() || !s.shot) {
|
|
1643
1646
|
ht();
|
|
1644
1647
|
return;
|
|
1645
1648
|
}
|
|
1646
1649
|
const e = y.crop(), n = rt(), r = Bt(n.clientWidth || 400);
|
|
1647
|
-
if (s.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), s.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), s.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), s.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (
|
|
1648
|
-
const
|
|
1649
|
-
|
|
1650
|
+
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`), (v == null ? void 0 : v.kind) === "crop") {
|
|
1651
|
+
const i = document.createElement("div");
|
|
1652
|
+
i.className = "nf-crop", ce(i, gt(v.start, v.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(i);
|
|
1650
1653
|
}
|
|
1651
|
-
const
|
|
1652
|
-
if ((
|
|
1653
|
-
const o =
|
|
1654
|
-
if (l.className = `nf-sticker nf-${
|
|
1654
|
+
const a = y.list().slice();
|
|
1655
|
+
if ((v == null ? void 0 : v.kind) === "sticker" && a.push(Vr(v)), a.forEach((i) => {
|
|
1656
|
+
const o = i.id === "preview", c = !o && i.id === $, l = document.createElement("div");
|
|
1657
|
+
if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), i.type === "arrow" ? Wr(l, i, e, c, r) : (ce(l, i, e), c && ["nw", "ne", "sw", "se"].forEach((u) => It(l, u))), !o && i.number) {
|
|
1655
1658
|
const u = document.createElement("span");
|
|
1656
|
-
u.className = "nf-badge", u.textContent = String(
|
|
1659
|
+
u.className = "nf-badge", u.textContent = String(i.number), l.appendChild(u);
|
|
1657
1660
|
}
|
|
1658
1661
|
s.shot.appendChild(l);
|
|
1659
|
-
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1662
|
+
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((i) => i.remove()), T) {
|
|
1663
|
+
const i = document.createElement("video");
|
|
1664
|
+
i.className = "nf-recording-preview", i.controls = !0, i.src = URL.createObjectURL(T), i.style.position = "absolute", i.style.right = "8px", i.style.bottom = "8px", i.style.width = "160px", s.canvas.appendChild(i);
|
|
1662
1665
|
}
|
|
1663
1666
|
ht();
|
|
1664
1667
|
}
|
|
1665
|
-
function Wr(t, e, n, r,
|
|
1666
|
-
const
|
|
1668
|
+
function Wr(t, e, n, r, a = Bt(400)) {
|
|
1669
|
+
const i = rt(), o = i.clientWidth, c = i.clientHeight, l = (e.x - n.x) / n.w * o, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * o, m = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, a.arrowHead + a.stroke * 2), S = Math.min(l, f) - g, L = Math.min(u, m) - g, H = Math.max(2, Math.abs(f - l)) + g * 2, Z = Math.max(2, Math.abs(m - u)) + g * 2, K = l - S, X = u - L, wt = f - S, vt = m - L, D = Ce(K, X, wt, vt, a), Y = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1667
1670
|
t.style.left = `${S}px`, t.style.top = `${L}px`, t.style.width = `${H}px`, t.style.height = `${Z}px`, Y.setAttribute("class", "nf-arrow-svg"), Y.setAttribute("viewBox", `0 0 ${H} ${Z}`), Y.setAttribute("width", String(H)), Y.setAttribute("height", String(Z)), Y.innerHTML = `
|
|
1668
|
-
<line class="nf-arrow-hit" x1="${K}" y1="${X}" x2="${wt}" y2="${
|
|
1671
|
+
<line class="nf-arrow-hit" x1="${K}" y1="${X}" x2="${wt}" y2="${vt}" />
|
|
1669
1672
|
<line class="nf-arrow-shaft" x1="${K}" y1="${X}" x2="${D.shaftEnd.x}" y2="${D.shaftEnd.y}" />
|
|
1670
1673
|
<polygon class="nf-arrow-head" points="${D.tipX},${D.tipY} ${D.left.x},${D.left.y} ${D.right.x},${D.right.y}" />
|
|
1671
|
-
`, t.appendChild(Y), r && (It(t, "start", { left: K - 5, top: X - 5 }), It(t, "end", { left: wt - 5, top:
|
|
1674
|
+
`, t.appendChild(Y), r && (It(t, "start", { left: K - 5, top: X - 5 }), It(t, "end", { left: wt - 5, top: vt - 5 }));
|
|
1672
1675
|
}
|
|
1673
1676
|
function It(t, e, n) {
|
|
1674
1677
|
const r = document.createElement("span");
|
|
@@ -1679,7 +1682,7 @@ function ce(t, e, n) {
|
|
|
1679
1682
|
}
|
|
1680
1683
|
function De() {
|
|
1681
1684
|
try {
|
|
1682
|
-
return String(localStorage.getItem(
|
|
1685
|
+
return String(localStorage.getItem(Le) || "").trim();
|
|
1683
1686
|
} catch {
|
|
1684
1687
|
return "";
|
|
1685
1688
|
}
|
|
@@ -1688,16 +1691,16 @@ function zr(t) {
|
|
|
1688
1691
|
const e = String(t || "").trim();
|
|
1689
1692
|
if (!(!e || e === Tt))
|
|
1690
1693
|
try {
|
|
1691
|
-
localStorage.setItem(
|
|
1694
|
+
localStorage.setItem(Le, e);
|
|
1692
1695
|
} catch {
|
|
1693
1696
|
}
|
|
1694
1697
|
}
|
|
1695
1698
|
function Be() {
|
|
1696
|
-
return !!(String(
|
|
1699
|
+
return !!(String(k.userId || "").trim() || String(k.email || "").trim() || String(k.displayName || "").trim());
|
|
1697
1700
|
}
|
|
1698
1701
|
function Fe() {
|
|
1699
1702
|
return String(
|
|
1700
|
-
|
|
1703
|
+
k.displayName || k.email || k.userId || ""
|
|
1701
1704
|
).trim();
|
|
1702
1705
|
}
|
|
1703
1706
|
function qr() {
|
|
@@ -1717,9 +1720,9 @@ function Ue() {
|
|
|
1717
1720
|
}
|
|
1718
1721
|
s.author.value = De();
|
|
1719
1722
|
}
|
|
1720
|
-
function Ne(t, e =
|
|
1723
|
+
function Ne(t, e = $e) {
|
|
1721
1724
|
const n = Number(t);
|
|
1722
|
-
return Number.isFinite(n) ? Math.min(
|
|
1725
|
+
return Number.isFinite(n) ? Math.min($r, Math.max(0, Math.floor(n))) : e;
|
|
1723
1726
|
}
|
|
1724
1727
|
function je(t = {}) {
|
|
1725
1728
|
nr(t);
|
|
@@ -1732,7 +1735,7 @@ function je(t = {}) {
|
|
|
1732
1735
|
name: t.name == null ? d.name : String(t.name || ""),
|
|
1733
1736
|
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1734
1737
|
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1735
|
-
theme:
|
|
1738
|
+
theme: Re(t.theme ?? d.theme),
|
|
1736
1739
|
video: t.video == null ? d.video : !!t.video,
|
|
1737
1740
|
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : Ne(t.consoleLogLimit, d.consoleLogLimit),
|
|
1738
1741
|
kinds: e ? Er(t.kinds) : d.kinds,
|
|
@@ -1755,8 +1758,8 @@ function Yr(t) {
|
|
|
1755
1758
|
}
|
|
1756
1759
|
function Gr() {
|
|
1757
1760
|
const t = Fe() || De() || void 0, e = tr({
|
|
1758
|
-
|
|
1759
|
-
displayName:
|
|
1761
|
+
...k,
|
|
1762
|
+
displayName: k.displayName || t
|
|
1760
1763
|
});
|
|
1761
1764
|
N = gr(e), O = wr(
|
|
1762
1765
|
Ae.snapshot().slice(-Ne(d.consoleLogLimit))
|
|
@@ -1768,37 +1771,49 @@ function pt(t) {
|
|
|
1768
1771
|
function _e() {
|
|
1769
1772
|
if (!s.privacy || !s.privacyText || !s.privacyChange)
|
|
1770
1773
|
return;
|
|
1771
|
-
const t =
|
|
1774
|
+
const t = br({
|
|
1772
1775
|
diagnostics: N,
|
|
1773
1776
|
logs: O
|
|
1774
1777
|
});
|
|
1775
|
-
s.privacyText.textContent = t, s.privacyText.hidden = !t
|
|
1778
|
+
s.privacyText.textContent = t, s.privacyText.hidden = !t;
|
|
1779
|
+
const e = N.length === 0 && O.length === 0;
|
|
1780
|
+
s.privacySummary && (s.privacySummary.hidden = e), s.privacy.hidden = e, s.privacyChange.hidden = !1;
|
|
1776
1781
|
}
|
|
1777
1782
|
function Ve(t, e, n) {
|
|
1778
1783
|
return `<label class="nf-privacy-toggle">
|
|
1779
1784
|
<span class="nf-privacy-toggle-label">Redact</span>
|
|
1780
|
-
<input type="checkbox" ${t ? "checked" : ""} ${e ? 'data-indeterminate="true"' : ""} aria-label="${
|
|
1785
|
+
<input type="checkbox" ${t ? "checked" : ""} ${e ? 'data-indeterminate="true"' : ""} aria-label="${C(n)}">
|
|
1781
1786
|
</label>`;
|
|
1782
1787
|
}
|
|
1783
|
-
function le(t, e, n, r,
|
|
1784
|
-
|
|
1788
|
+
function le(t, e, n, r, a) {
|
|
1789
|
+
const i = Ve(a, !1, `Redact ${n}`);
|
|
1790
|
+
if (a) {
|
|
1791
|
+
const o = r ? `${n}: ${r}` : n;
|
|
1792
|
+
return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}" data-redacted="true">
|
|
1793
|
+
<div class="nf-privacy-row-text">
|
|
1794
|
+
<div class="nf-privacy-row-summary" title="${C(o)}">${C(o)}</div>
|
|
1795
|
+
</div>
|
|
1796
|
+
${i}
|
|
1797
|
+
</div>`;
|
|
1798
|
+
}
|
|
1799
|
+
return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}">
|
|
1785
1800
|
<div class="nf-privacy-row-text">
|
|
1786
|
-
<div class="nf-privacy-row-title">${
|
|
1787
|
-
<div class="nf-privacy-row-detail">${
|
|
1801
|
+
<div class="nf-privacy-row-title">${C(n)}</div>
|
|
1802
|
+
<div class="nf-privacy-row-detail">${C(r)}</div>
|
|
1788
1803
|
</div>
|
|
1789
|
-
${
|
|
1804
|
+
${i}
|
|
1790
1805
|
</div>`;
|
|
1791
1806
|
}
|
|
1792
1807
|
function ue(t, e, n, r) {
|
|
1793
1808
|
if (!n.length)
|
|
1794
1809
|
return "";
|
|
1795
|
-
const
|
|
1796
|
-
return `<section class="nf-privacy-section" data-section="${
|
|
1810
|
+
const a = vr(n), i = a.checked && !a.indeterminate;
|
|
1811
|
+
return `<section class="nf-privacy-section" data-section="${C(t)}"${i ? ' data-redacted="true"' : ""}>
|
|
1797
1812
|
<div class="nf-privacy-section-head">
|
|
1798
|
-
<h3 class="nf-privacy-section-title">${
|
|
1799
|
-
${Ve(
|
|
1813
|
+
<h3 class="nf-privacy-section-title">${C(e)}</h3>
|
|
1814
|
+
${Ve(a.checked, a.indeterminate, `Redact all ${e.toLowerCase()}`)}
|
|
1800
1815
|
</div>
|
|
1801
|
-
<div class="nf-privacy-rows">${r}</div>
|
|
1816
|
+
<div class="nf-privacy-rows"${i ? " hidden" : ""}>${r}</div>
|
|
1802
1817
|
</section>`;
|
|
1803
1818
|
}
|
|
1804
1819
|
function We() {
|
|
@@ -1828,46 +1843,46 @@ function Jr(t) {
|
|
|
1828
1843
|
const e = t.target;
|
|
1829
1844
|
if (!(e instanceof HTMLInputElement) || e.type !== "checkbox")
|
|
1830
1845
|
return;
|
|
1831
|
-
const n = e.closest("[data-section]"), r = e.closest(".nf-privacy-row"),
|
|
1846
|
+
const n = e.closest("[data-section]"), r = e.closest(".nf-privacy-row"), a = e.checked;
|
|
1832
1847
|
if (r) {
|
|
1833
|
-
const
|
|
1834
|
-
if (
|
|
1848
|
+
const i = r.dataset.kind, o = r.dataset.id;
|
|
1849
|
+
if (i === "diagnostic") {
|
|
1835
1850
|
const c = N.find((l) => l.key === o);
|
|
1836
|
-
c && (c.redacted =
|
|
1837
|
-
} else if (
|
|
1851
|
+
c && (c.redacted = a);
|
|
1852
|
+
} else if (i === "log") {
|
|
1838
1853
|
const c = O.find((l) => l.id === o);
|
|
1839
|
-
c && (c.redacted =
|
|
1854
|
+
c && (c.redacted = a);
|
|
1840
1855
|
}
|
|
1841
1856
|
} else if (n) {
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1857
|
+
const i = n.dataset.section;
|
|
1858
|
+
i === "diagnostics" ? re(N, a) : i === "logs" && re(O, a);
|
|
1844
1859
|
} else
|
|
1845
1860
|
return;
|
|
1846
1861
|
We();
|
|
1847
1862
|
}
|
|
1848
1863
|
async function ze() {
|
|
1849
|
-
Ut(), qe(), nt(), s.launcher.hidden = !0, y = Dt(),
|
|
1864
|
+
Ut(), qe(), nt(), s.launcher.hidden = !0, y = Dt(), I = { w: 0, h: 0 }, T = null, P = "", Q = "", $ = null, v = null, w = null, z = yt(d.kinds), Nt(z), et(null), _t(!1), s.text.value = "", Ue(), b(""), Gr();
|
|
1850
1865
|
try {
|
|
1851
|
-
He(await xe(Oe())),
|
|
1866
|
+
He(await xe(Oe())), b("");
|
|
1852
1867
|
} catch (t) {
|
|
1853
|
-
|
|
1868
|
+
P = "", b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
|
|
1854
1869
|
}
|
|
1855
1870
|
it(), pt(!1), _e(), s.dialog.hidden = !1, q(), s.text.focus();
|
|
1856
1871
|
}
|
|
1857
1872
|
function at() {
|
|
1858
|
-
h && (V == null || V.stop(), _t(!1), Pe(),
|
|
1873
|
+
h && (V == null || V.stop(), _t(!1), Pe(), v = null, w = null, jt(!1), qe(), pt(!1), s.dialog.hidden = !0, s.stop.hidden = !0, ut());
|
|
1859
1874
|
}
|
|
1860
1875
|
function Qr() {
|
|
1861
1876
|
const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
|
|
1862
1877
|
if (!t || !e || !n || !r)
|
|
1863
1878
|
return Promise.resolve();
|
|
1864
|
-
Ft = !0,
|
|
1865
|
-
const
|
|
1866
|
-
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1",
|
|
1879
|
+
Ft = !0, b("");
|
|
1880
|
+
const a = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, i = e.getBoundingClientRect();
|
|
1881
|
+
if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", a)
|
|
1867
1882
|
return new Promise((u) => {
|
|
1868
1883
|
window.setTimeout(() => u(), 1e3);
|
|
1869
1884
|
});
|
|
1870
|
-
const o = e.getBoundingClientRect(), c = o.width > 0 ?
|
|
1885
|
+
const o = e.getBoundingClientRect(), c = o.width > 0 ? i.width / o.width : 1, l = o.height > 0 ? i.height / o.height : 1;
|
|
1871
1886
|
return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${c}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
|
|
1872
1887
|
let f = !1;
|
|
1873
1888
|
const m = () => {
|
|
@@ -1886,17 +1901,17 @@ function qe() {
|
|
|
1886
1901
|
Ft = !1, s.dialog && (s.dialog.classList.remove("nf-success"), s.dialog.style.opacity = "", s.dialog.style.transition = "", s.panel && (s.panel.style.transform = "", s.panel.style.transition = "", s.panel.style.transformOrigin = ""), s.panelBody && (s.panelBody.hidden = !1), s.successMsg && (s.successMsg.hidden = !0));
|
|
1887
1902
|
}
|
|
1888
1903
|
function Zr(t = {}) {
|
|
1889
|
-
|
|
1904
|
+
k = { ...k, ...er(t) }, Ue();
|
|
1890
1905
|
}
|
|
1891
1906
|
async function Ke() {
|
|
1892
1907
|
if (Ut(), Ct)
|
|
1893
1908
|
return null;
|
|
1894
1909
|
const t = s.text.value.trim();
|
|
1895
|
-
if (!t && !j() && !
|
|
1896
|
-
return
|
|
1910
|
+
if (!t && !j() && !T)
|
|
1911
|
+
return b("Add a note, screenshot, or video first."), null;
|
|
1897
1912
|
if (!d.endpoint || !d.projectKey)
|
|
1898
|
-
return
|
|
1899
|
-
Ct = !0, de(!0),
|
|
1913
|
+
return b("Notefully is missing endpoint or projectKey."), null;
|
|
1914
|
+
Ct = !0, de(!0), b("Submitting…", !0);
|
|
1900
1915
|
try {
|
|
1901
1916
|
const e = qr(), n = new FormData();
|
|
1902
1917
|
if (n.append("message", t), n.append("kind", z), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify(xr({
|
|
@@ -1904,10 +1919,10 @@ async function Ke() {
|
|
|
1904
1919
|
diagnostics: N,
|
|
1905
1920
|
logs: O
|
|
1906
1921
|
}))), n.append("annotations", JSON.stringify(y.list())), n.append("crop", JSON.stringify(y.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), j()) {
|
|
1907
|
-
const
|
|
1908
|
-
if (n.append("screenshot",
|
|
1922
|
+
const i = await Lr(P);
|
|
1923
|
+
if (n.append("screenshot", i, "screenshot.png"), y.list().length || y.isCropped()) {
|
|
1909
1924
|
const o = await pr(
|
|
1910
|
-
|
|
1925
|
+
P,
|
|
1911
1926
|
y.crop(),
|
|
1912
1927
|
y.list(),
|
|
1913
1928
|
{
|
|
@@ -1918,7 +1933,7 @@ async function Ke() {
|
|
|
1918
1933
|
n.append("screenshotBaked", o, "screenshot.baked.png");
|
|
1919
1934
|
}
|
|
1920
1935
|
}
|
|
1921
|
-
|
|
1936
|
+
T && n.append("recording", T, "recording.webm");
|
|
1922
1937
|
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1923
1938
|
method: "POST",
|
|
1924
1939
|
headers: {
|
|
@@ -1926,15 +1941,15 @@ async function Ke() {
|
|
|
1926
1941
|
},
|
|
1927
1942
|
body: n
|
|
1928
1943
|
});
|
|
1929
|
-
let
|
|
1944
|
+
let a = null;
|
|
1930
1945
|
try {
|
|
1931
|
-
|
|
1946
|
+
a = await r.json();
|
|
1932
1947
|
} catch {
|
|
1933
|
-
|
|
1948
|
+
a = null;
|
|
1934
1949
|
}
|
|
1935
1950
|
if (!r.ok)
|
|
1936
|
-
throw
|
|
1937
|
-
return await Qr(), at(),
|
|
1951
|
+
throw b((a == null ? void 0 : a.error) || "Submit failed."), new Error((a == null ? void 0 : a.error) || `Submit failed (${r.status})`);
|
|
1952
|
+
return await Qr(), at(), a;
|
|
1938
1953
|
} finally {
|
|
1939
1954
|
Ct = !1, de(!1);
|
|
1940
1955
|
}
|