@makefully/notefully 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +8 -8
- package/dist/notefully.js +382 -359
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function le(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
@@ -8,7 +8,7 @@ function oe(t, e) {
|
|
|
8
8
|
const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), i = r.createElement("a");
|
|
9
9
|
return r.head.appendChild(n), r.body.appendChild(i), e && (n.href = e), i.href = t, i.href;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const ue = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -23,26 +23,26 @@ function j(t) {
|
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
25
|
let _ = null;
|
|
26
|
-
function
|
|
26
|
+
function Vt(t = {}) {
|
|
27
27
|
return _ || (t.includeStyleProperties ? (_ = t.includeStyleProperties, _) : (_ = j(window.getComputedStyle(document.documentElement)), _));
|
|
28
28
|
}
|
|
29
29
|
function X(t, e) {
|
|
30
30
|
const n = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
|
|
31
31
|
return n ? parseFloat(n.replace("px", "")) : 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function de(t) {
|
|
34
34
|
const e = X(t, "border-left-width"), r = X(t, "border-right-width");
|
|
35
35
|
return t.clientWidth + e + r;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function fe(t) {
|
|
38
38
|
const e = X(t, "border-top-width"), r = X(t, "border-bottom-width");
|
|
39
39
|
return t.clientHeight + e + r;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const r = e.width ||
|
|
41
|
+
function _t(t, e = {}) {
|
|
42
|
+
const r = e.width || de(t), n = e.height || fe(t);
|
|
43
43
|
return { width: r, height: n };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function he() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -52,7 +52,7 @@ function ue() {
|
|
|
52
52
|
return r && (t = parseInt(r, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
54
|
const M = 16384;
|
|
55
|
-
function
|
|
55
|
+
function pe(t) {
|
|
56
56
|
(t.width > M || t.height > M) && (t.width > M && t.height > M ? t.width > t.height ? (t.height *= M / t.width, t.width = M) : (t.width *= M / t.height, t.height = M) : t.width > M ? (t.height *= M / t.width, t.width = M) : (t.width *= M / t.height, t.height = M));
|
|
57
57
|
}
|
|
58
58
|
function Y(t) {
|
|
@@ -65,12 +65,12 @@ function Y(t) {
|
|
|
65
65
|
}, n.onerror = r, n.crossOrigin = "anonymous", n.decoding = "async", n.src = t;
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
68
|
+
async function me(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 ye(t, e, r) {
|
|
72
72
|
const n = "http://www.w3.org/2000/svg", i = document.createElementNS(n, "svg"), a = document.createElementNS(n, "foreignObject");
|
|
73
|
-
return i.setAttribute("width", `${e}`), i.setAttribute("height", `${r}`), i.setAttribute("viewBox", `0 0 ${e} ${r}`), 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", `${r}`), i.setAttribute("viewBox", `0 0 ${e} ${r}`), 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), me(i);
|
|
74
74
|
}
|
|
75
75
|
const C = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
@@ -78,67 +78,67 @@ const C = (t, e) => {
|
|
|
78
78
|
const r = Object.getPrototypeOf(t);
|
|
79
79
|
return r === null ? !1 : r.constructor.name === e.name || C(r, e);
|
|
80
80
|
};
|
|
81
|
-
function
|
|
81
|
+
function ge(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 we(t, e) {
|
|
86
|
+
return Vt(e).map((r) => {
|
|
87
87
|
const n = t.getPropertyValue(r), i = t.getPropertyPriority(r);
|
|
88
88
|
return `${r}: ${n}${i ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const i = `.${t}:${e}`, a = r.cssText ?
|
|
91
|
+
function be(t, e, r, n) {
|
|
92
|
+
const i = `.${t}:${e}`, a = r.cssText ? ge(r) : we(r, n);
|
|
93
93
|
return document.createTextNode(`${i}{${a}}`);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Mt(t, e, r, n) {
|
|
96
96
|
const i = window.getComputedStyle(t, r), a = i.getPropertyValue("content");
|
|
97
97
|
if (a === "" || a === "none")
|
|
98
98
|
return;
|
|
99
|
-
const o =
|
|
99
|
+
const o = ue();
|
|
100
100
|
try {
|
|
101
101
|
e.className = `${e.className} ${o}`;
|
|
102
102
|
} catch {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
const s = document.createElement("style");
|
|
106
|
-
s.appendChild(
|
|
106
|
+
s.appendChild(be(o, r, i, n)), e.appendChild(s);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function ve(t, e, r) {
|
|
109
|
+
Mt(t, e, ":before", r), Mt(t, e, ":after", r);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
woff:
|
|
113
|
-
woff2:
|
|
111
|
+
const $t = "application/font-woff", Rt = "image/jpeg", xe = {
|
|
112
|
+
woff: $t,
|
|
113
|
+
woff2: $t,
|
|
114
114
|
ttf: "application/font-truetype",
|
|
115
115
|
eot: "application/vnd.ms-fontobject",
|
|
116
116
|
png: "image/png",
|
|
117
|
-
jpg:
|
|
118
|
-
jpeg:
|
|
117
|
+
jpg: Rt,
|
|
118
|
+
jpeg: Rt,
|
|
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 Se(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 vt(t) {
|
|
129
|
+
const e = Se(t).toLowerCase();
|
|
130
|
+
return xe[e] || "";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Ee(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function ut(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Ce(t, e) {
|
|
139
139
|
return `data:${e};base64,${t}`;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function Nt(t, e, r) {
|
|
142
142
|
const n = await fetch(t, e);
|
|
143
143
|
if (n.status === 404)
|
|
144
144
|
throw new Error(`Resource "${n.url}" not found`);
|
|
@@ -154,86 +154,86 @@ async function Vt(t, e, r) {
|
|
|
154
154
|
}, s.readAsDataURL(i);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
function
|
|
157
|
+
const ot = {};
|
|
158
|
+
function Me(t, e, r) {
|
|
159
159
|
let n = t.replace(/\?.*/, "");
|
|
160
160
|
return r && (n = t), /ttf|otf|eot|woff2?/i.test(n) && (n = n.replace(/.*\//, "")), e ? `[${e}]${n}` : n;
|
|
161
161
|
}
|
|
162
|
-
async function
|
|
163
|
-
const n =
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
162
|
+
async function xt(t, e, r) {
|
|
163
|
+
const n = Me(t, e, r.includeQueryParams);
|
|
164
|
+
if (ot[n] != null)
|
|
165
|
+
return ot[n];
|
|
166
166
|
r.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
167
|
let i;
|
|
168
168
|
try {
|
|
169
|
-
const a = await
|
|
170
|
-
i =
|
|
169
|
+
const a = await Nt(t, r.fetchRequestInit, ({ res: o, result: s }) => (e || (e = o.headers.get("Content-Type") || ""), Ee(s)));
|
|
170
|
+
i = Ce(a, e);
|
|
171
171
|
} catch (a) {
|
|
172
172
|
i = r.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 ot[n] = i, i;
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function $e(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
180
180
|
return e === "data:," ? t.cloneNode(!1) : Y(e);
|
|
181
181
|
}
|
|
182
|
-
async function
|
|
182
|
+
async function Re(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 s = a.toDataURL();
|
|
187
187
|
return Y(s);
|
|
188
188
|
}
|
|
189
|
-
const r = t.poster, n =
|
|
189
|
+
const r = t.poster, n = vt(r), i = await xt(r, n, e);
|
|
190
190
|
return Y(i);
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function Le(t, e) {
|
|
193
193
|
var r;
|
|
194
194
|
try {
|
|
195
195
|
if (!((r = t == null ? void 0 : t.contentDocument) === null || r === void 0) && r.body)
|
|
196
|
-
return await
|
|
196
|
+
return await et(t.contentDocument.body, e, !0);
|
|
197
197
|
} catch {
|
|
198
198
|
}
|
|
199
199
|
return t.cloneNode(!1);
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
return C(t, HTMLCanvasElement) ?
|
|
201
|
+
async function Pe(t, e) {
|
|
202
|
+
return C(t, HTMLCanvasElement) ? $e(t) : C(t, HTMLVideoElement) ? Re(t, e) : C(t, HTMLIFrameElement) ? Le(t, e) : t.cloneNode(Wt(t));
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
async function
|
|
204
|
+
const Te = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Wt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
|
+
async function ke(t, e, r) {
|
|
206
206
|
var n, i;
|
|
207
|
-
if (
|
|
207
|
+
if (Wt(e))
|
|
208
208
|
return e;
|
|
209
209
|
let a = [];
|
|
210
|
-
return
|
|
210
|
+
return Te(t) && t.assignedNodes ? a = j(t.assignedNodes()) : C(t, HTMLIFrameElement) && (!((n = t.contentDocument) === null || n === void 0) && n.body) ? a = j(t.contentDocument.body.childNodes) : a = j(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || C(t, HTMLVideoElement) || await a.reduce((o, s) => o.then(() => et(s, r)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Ae(t, e, r) {
|
|
215
215
|
const n = e.style;
|
|
216
216
|
if (!n)
|
|
217
217
|
return;
|
|
218
218
|
const i = window.getComputedStyle(t);
|
|
219
|
-
i.cssText ? (n.cssText = i.cssText, n.transformOrigin = i.transformOrigin) :
|
|
219
|
+
i.cssText ? (n.cssText = i.cssText, n.transformOrigin = i.transformOrigin) : Vt(r).forEach((a) => {
|
|
220
220
|
let o = i.getPropertyValue(a);
|
|
221
221
|
a === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), C(t, HTMLIFrameElement) && a === "display" && o === "inline" && (o = "block"), a === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), n.setProperty(a, o, i.getPropertyPriority(a));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function Ie(t, e) {
|
|
225
225
|
C(t, HTMLTextAreaElement) && (e.innerHTML = t.value), C(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function De(t, e) {
|
|
228
228
|
if (C(t, HTMLSelectElement)) {
|
|
229
229
|
const n = Array.from(e.children).find((i) => t.value === i.getAttribute("value"));
|
|
230
230
|
n && n.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return C(e, Element) && (
|
|
233
|
+
function Fe(t, e, r) {
|
|
234
|
+
return C(e, Element) && (Ae(t, e, r), ve(t, e, r), Ie(t, e), De(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function Oe(t, e) {
|
|
237
237
|
const r = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (r.length === 0)
|
|
239
239
|
return t;
|
|
@@ -242,7 +242,7 @@ async function Ie(t, e) {
|
|
|
242
242
|
const s = r[a].getAttribute("xlink:href");
|
|
243
243
|
if (s) {
|
|
244
244
|
const l = t.querySelector(s), v = document.querySelector(s);
|
|
245
|
-
!l && v && !n[s] && (n[s] = await
|
|
245
|
+
!l && v && !n[s] && (n[s] = await et(v, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
const i = Object.values(n);
|
|
@@ -257,31 +257,31 @@ async function Ie(t, e) {
|
|
|
257
257
|
}
|
|
258
258
|
return t;
|
|
259
259
|
}
|
|
260
|
-
async function
|
|
261
|
-
return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) =>
|
|
260
|
+
async function et(t, e, r) {
|
|
261
|
+
return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => Pe(n, e)).then((n) => ke(t, n, e)).then((n) => Fe(t, n, e)).then((n) => Oe(n, e));
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
263
|
+
const qt = /url\((['"]?)([^'"]+?)\1\)/g, He = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, je = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
|
+
function Ue(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function Be(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(
|
|
270
|
+
return t.replace(qt, (r, n, i) => (e.push(i), r)), e.filter((r) => !ut(r));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function Ve(t, e, r, n, i) {
|
|
273
273
|
try {
|
|
274
|
-
const a = r ?
|
|
274
|
+
const a = r ? le(e, r) : e, o = vt(e);
|
|
275
275
|
let s;
|
|
276
|
-
return i || (s = await
|
|
276
|
+
return i || (s = await xt(a, o, n)), t.replace(Ue(e), `$1${s}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return e ? t.replace(
|
|
281
|
+
function _e(t, { preferredFontFormat: e }) {
|
|
282
|
+
return e ? t.replace(je, (r) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [n, , i] =
|
|
284
|
+
const [n, , i] = He.exec(r) || [];
|
|
285
285
|
if (!i)
|
|
286
286
|
return "";
|
|
287
287
|
if (i === e)
|
|
@@ -289,32 +289,32 @@ function Ue(t, { preferredFontFormat: e }) {
|
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return t.search(
|
|
292
|
+
function zt(t) {
|
|
293
|
+
return t.search(qt) !== -1;
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
if (!
|
|
295
|
+
async function Kt(t, e, r) {
|
|
296
|
+
if (!zt(t))
|
|
297
297
|
return t;
|
|
298
|
-
const n =
|
|
299
|
-
return
|
|
298
|
+
const n = _e(t, r);
|
|
299
|
+
return Be(n).reduce((a, o) => a.then((s) => Ve(s, o, e, r)), Promise.resolve(n));
|
|
300
300
|
}
|
|
301
301
|
async function N(t, e, r) {
|
|
302
302
|
var n;
|
|
303
303
|
const i = (n = e.style) === null || n === void 0 ? void 0 : n.getPropertyValue(t);
|
|
304
304
|
if (i) {
|
|
305
|
-
const a = await
|
|
305
|
+
const a = await Kt(i, null, r);
|
|
306
306
|
return e.style.setProperty(t, a, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
310
|
+
async function Ne(t, e) {
|
|
311
311
|
await N("background", t, e) || await N("background-image", t, e), await N("mask", t, e) || await N("-webkit-mask", t, e) || await N("mask-image", t, e) || await N("-webkit-mask-image", t, e);
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
313
|
+
async function We(t, e) {
|
|
314
314
|
const r = C(t, HTMLImageElement);
|
|
315
|
-
if (!(r && !
|
|
315
|
+
if (!(r && !ut(t.src)) && !(C(t, SVGImageElement) && !ut(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const n = r ? t.src : t.href.baseVal, i = await
|
|
317
|
+
const n = r ? t.src : t.href.baseVal, i = await xt(n, vt(n), 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 Be(t, e) {
|
|
|
327
327
|
s.decode && (s.decode = a), s.loading === "lazy" && (s.loading = "eager"), r ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
const n = j(t.childNodes).map((i) =>
|
|
330
|
+
async function qe(t, e) {
|
|
331
|
+
const n = j(t.childNodes).map((i) => Xt(i, e));
|
|
332
332
|
await Promise.all(n).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
C(t, Element) && (await
|
|
334
|
+
async function Xt(t, e) {
|
|
335
|
+
C(t, Element) && (await Ne(t, e), await We(t, e), await qe(t, e));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function ze(t, e) {
|
|
338
338
|
const { style: r } = t;
|
|
339
339
|
e.backgroundColor && (r.backgroundColor = e.backgroundColor), e.width && (r.width = `${e.width}px`), e.height && (r.height = `${e.height}px`);
|
|
340
340
|
const n = e.style;
|
|
@@ -342,23 +342,23 @@ function Ne(t, e) {
|
|
|
342
342
|
r[i] = n[i];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
async function
|
|
347
|
-
let e =
|
|
345
|
+
const Lt = {};
|
|
346
|
+
async function Pt(t) {
|
|
347
|
+
let e = Lt[t];
|
|
348
348
|
if (e != null)
|
|
349
349
|
return e;
|
|
350
350
|
const n = await (await fetch(t)).text();
|
|
351
|
-
return e = { url: t, cssText: n },
|
|
351
|
+
return e = { url: t, cssText: n }, Lt[t] = e, e;
|
|
352
352
|
}
|
|
353
|
-
async function
|
|
353
|
+
async function Tt(t, e) {
|
|
354
354
|
let r = t.cssText;
|
|
355
355
|
const n = /url\(["']?([^"')]+)["']?\)/g, a = (r.match(/url\([^)]+\)/g) || []).map(async (o) => {
|
|
356
356
|
let s = o.replace(n, "$1");
|
|
357
|
-
return s.startsWith("https://") || (s = new URL(s, t.url).href),
|
|
357
|
+
return s.startsWith("https://") || (s = new URL(s, t.url).href), Nt(s, e.fetchRequestInit, ({ result: l }) => (r = r.replace(o, `url(${l})`), [o, l]));
|
|
358
358
|
});
|
|
359
359
|
return Promise.all(a).then(() => r);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function kt(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], r = /(\/\*[\s\S]*?\*\/)/gi;
|
|
@@ -384,7 +384,7 @@ function Pt(t) {
|
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function Ke(t, e) {
|
|
388
388
|
const r = [], n = [];
|
|
389
389
|
return t.forEach((i) => {
|
|
390
390
|
if ("cssRules" in i)
|
|
@@ -392,7 +392,7 @@ async function We(t, e) {
|
|
|
392
392
|
j(i.cssRules || []).forEach((a, o) => {
|
|
393
393
|
if (a.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let s = o + 1;
|
|
395
|
-
const l = a.href, v =
|
|
395
|
+
const l = a.href, v = Pt(l).then((y) => Tt(y, e)).then((y) => kt(y).forEach((p) => {
|
|
396
396
|
try {
|
|
397
397
|
i.insertRule(p, p.startsWith("@import") ? s += 1 : i.cssRules.length);
|
|
398
398
|
} catch (g) {
|
|
@@ -409,7 +409,7 @@ async function We(t, e) {
|
|
|
409
409
|
});
|
|
410
410
|
} catch (a) {
|
|
411
411
|
const o = t.find((s) => s.href == null) || document.styleSheets[0];
|
|
412
|
-
i.href != null && n.push(
|
|
412
|
+
i.href != null && n.push(Pt(i.href).then((s) => Tt(s, e)).then((s) => kt(s).forEach((l) => {
|
|
413
413
|
o.insertRule(l, o.cssRules.length);
|
|
414
414
|
})).catch((s) => {
|
|
415
415
|
console.error("Error loading remote stylesheet", s);
|
|
@@ -426,56 +426,60 @@ async function We(t, e) {
|
|
|
426
426
|
}
|
|
427
427
|
}), r));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
429
|
+
function Xe(t) {
|
|
430
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => zt(e.style.getPropertyValue("src")));
|
|
431
431
|
}
|
|
432
|
-
async function
|
|
432
|
+
async function Ye(t, e) {
|
|
433
433
|
if (t.ownerDocument == null)
|
|
434
434
|
throw new Error("Provided element is not within a Document");
|
|
435
|
-
const r = j(t.ownerDocument.styleSheets), n = await
|
|
436
|
-
return
|
|
435
|
+
const r = j(t.ownerDocument.styleSheets), n = await Ke(r, e);
|
|
436
|
+
return Xe(n);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function Yt(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Ge(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function r(n) {
|
|
444
444
|
(n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((a) => {
|
|
445
|
-
e.add(
|
|
445
|
+
e.add(Yt(a));
|
|
446
446
|
}), Array.from(n.children).forEach((a) => {
|
|
447
447
|
a instanceof HTMLElement && r(a);
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
return r(t), e;
|
|
451
451
|
}
|
|
452
|
-
async function
|
|
453
|
-
const r = await
|
|
454
|
-
return (await Promise.all(r.filter((a) => n.has(
|
|
452
|
+
async function Je(t, e) {
|
|
453
|
+
const r = await Ye(t, e), n = Ge(t);
|
|
454
|
+
return (await Promise.all(r.filter((a) => n.has(Yt(a.style.fontFamily))).map((a) => {
|
|
455
455
|
const o = a.parentStyleSheet ? a.parentStyleSheet.href : null;
|
|
456
|
-
return
|
|
456
|
+
return Kt(a.cssText, o, e);
|
|
457
457
|
}))).join(`
|
|
458
458
|
`);
|
|
459
459
|
}
|
|
460
|
-
async function
|
|
461
|
-
const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await
|
|
460
|
+
async function Ze(t, e) {
|
|
461
|
+
const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Je(t, e);
|
|
462
462
|
if (r) {
|
|
463
463
|
const n = document.createElement("style"), i = document.createTextNode(r);
|
|
464
464
|
n.appendChild(i), t.firstChild ? t.insertBefore(n, t.firstChild) : t.appendChild(n);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
async function
|
|
468
|
-
const { width: r, height: n } =
|
|
469
|
-
return await
|
|
467
|
+
async function Qe(t, e = {}) {
|
|
468
|
+
const { width: r, height: n } = _t(t, e), i = await et(t, e, !0);
|
|
469
|
+
return await Ze(i, e), await Xt(i, e), ze(i, e), await ye(i, r, n);
|
|
470
|
+
}
|
|
471
|
+
async function tn(t, e = {}) {
|
|
472
|
+
const { width: r, height: n } = _t(t, e), i = await Qe(t, e), a = await Y(i), o = document.createElement("canvas"), s = o.getContext("2d"), l = e.pixelRatio || he(), v = e.canvasWidth || r, y = e.canvasHeight || n;
|
|
473
|
+
return o.width = v * l, o.height = y * l, e.skipAutoScale || pe(o), o.style.width = `${v}`, o.style.height = `${y}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, o.width, o.height)), s.drawImage(a, 0, 0, o.width, o.height), o;
|
|
470
474
|
}
|
|
471
|
-
async function
|
|
472
|
-
|
|
473
|
-
return o.width = v * l, o.height = y * l, e.skipAutoScale || de(o), o.style.width = `${v}`, o.style.height = `${y}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, o.width, o.height)), s.drawImage(a, 0, 0, o.width, o.height), o;
|
|
475
|
+
async function en(t, e = {}) {
|
|
476
|
+
return (await tn(t, e)).toDataURL();
|
|
474
477
|
}
|
|
475
|
-
|
|
476
|
-
|
|
478
|
+
const G = "data-nf-capture-chrome";
|
|
479
|
+
function nn(t) {
|
|
480
|
+
return t instanceof Element && (t.hasAttribute(G) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
|
|
477
481
|
}
|
|
478
|
-
function
|
|
482
|
+
function rn() {
|
|
479
483
|
const t = [];
|
|
480
484
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((r) => {
|
|
481
485
|
const n = r.getBoundingClientRect(), i = document.createElement("div");
|
|
@@ -491,22 +495,32 @@ function Qe() {
|
|
|
491
495
|
].join(";"), document.body.appendChild(i), t.push(i);
|
|
492
496
|
}), () => t.forEach((r) => r.remove());
|
|
493
497
|
}
|
|
494
|
-
|
|
495
|
-
const t = document.
|
|
498
|
+
function an() {
|
|
499
|
+
const t = document.querySelector(`[${G}]`);
|
|
500
|
+
if (t)
|
|
501
|
+
return t;
|
|
502
|
+
const e = document.createElement("div");
|
|
503
|
+
return e.setAttribute(G, "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;
|
|
504
|
+
}
|
|
505
|
+
function on() {
|
|
506
|
+
document.querySelectorAll(`[${G}]`).forEach((t) => t.remove());
|
|
507
|
+
}
|
|
508
|
+
async function sn() {
|
|
509
|
+
const t = document.getElementById("notefully"), e = t ? t.style.display : "", r = an();
|
|
496
510
|
t && (t.style.display = "none");
|
|
497
|
-
const
|
|
498
|
-
await new Promise((
|
|
511
|
+
const n = rn();
|
|
512
|
+
await new Promise((i) => requestAnimationFrame(() => requestAnimationFrame(i)));
|
|
499
513
|
try {
|
|
500
|
-
return await
|
|
514
|
+
return await en(document.body, {
|
|
501
515
|
cacheBust: !0,
|
|
502
516
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
503
|
-
filter: (
|
|
517
|
+
filter: (i) => !nn(i)
|
|
504
518
|
});
|
|
505
519
|
} finally {
|
|
506
|
-
r(), t && (t.style.display = e);
|
|
520
|
+
n(), r.remove(), on(), t && (t.style.display = e);
|
|
507
521
|
}
|
|
508
522
|
}
|
|
509
|
-
function
|
|
523
|
+
function cn(t = {}) {
|
|
510
524
|
return {
|
|
511
525
|
url: location.href,
|
|
512
526
|
title: document.title,
|
|
@@ -525,11 +539,11 @@ function en(t = {}) {
|
|
|
525
539
|
}
|
|
526
540
|
};
|
|
527
541
|
}
|
|
528
|
-
const
|
|
542
|
+
const At = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), It = {
|
|
529
543
|
id: "userId",
|
|
530
544
|
username: "displayName",
|
|
531
545
|
name: "displayName"
|
|
532
|
-
},
|
|
546
|
+
}, Dt = /* @__PURE__ */ new Set([
|
|
533
547
|
"endpoint",
|
|
534
548
|
"projectKey",
|
|
535
549
|
"version",
|
|
@@ -538,7 +552,7 @@ const kt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Tt = {
|
|
|
538
552
|
"hideLauncher",
|
|
539
553
|
"theme",
|
|
540
554
|
"video"
|
|
541
|
-
]),
|
|
555
|
+
]), Ft = {
|
|
542
556
|
slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
|
|
543
557
|
projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
|
|
544
558
|
project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
|
|
@@ -547,14 +561,14 @@ const kt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Tt = {
|
|
|
547
561
|
email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
548
562
|
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
|
|
549
563
|
};
|
|
550
|
-
function
|
|
551
|
-
const r = e.warn ||
|
|
552
|
-
for (const o of
|
|
564
|
+
function ln(t = {}, e = {}) {
|
|
565
|
+
const r = e.warn || Gt, n = t && typeof t == "object" ? t : {}, i = {}, a = [];
|
|
566
|
+
for (const o of At)
|
|
553
567
|
Object.prototype.hasOwnProperty.call(n, o) && (i[o] = n[o]);
|
|
554
|
-
for (const [o, s] of Object.entries(
|
|
568
|
+
for (const [o, s] of Object.entries(It))
|
|
555
569
|
Object.prototype.hasOwnProperty.call(n, o) && (Object.prototype.hasOwnProperty.call(i, s) || (i[s] = n[o]));
|
|
556
570
|
for (const o of Object.keys(n))
|
|
557
|
-
|
|
571
|
+
At.has(o) || Object.prototype.hasOwnProperty.call(It, o) || a.push(o);
|
|
558
572
|
if (a.length) {
|
|
559
573
|
const o = a.some((s) => s === "name" || s === "slug" || s === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
|
|
560
574
|
r(
|
|
@@ -563,24 +577,24 @@ function nn(t = {}, e = {}) {
|
|
|
563
577
|
}
|
|
564
578
|
return i;
|
|
565
579
|
}
|
|
566
|
-
function
|
|
567
|
-
const r = e.warn ||
|
|
580
|
+
function un(t = {}, e = {}) {
|
|
581
|
+
const r = e.warn || Gt, n = t && typeof t == "object" ? t : {}, i = Object.keys(n).filter((a) => !Dt.has(a));
|
|
568
582
|
if (i.length)
|
|
569
583
|
for (const a of i) {
|
|
570
|
-
if (
|
|
571
|
-
r(`Notefully.init: ignoring "${a}". ${
|
|
584
|
+
if (Ft[a]) {
|
|
585
|
+
r(`Notefully.init: ignoring "${a}". ${Ft[a]}`);
|
|
572
586
|
continue;
|
|
573
587
|
}
|
|
574
588
|
r(
|
|
575
|
-
`Notefully.init: ignoring unknown key "${a}". Supported: ${[...
|
|
589
|
+
`Notefully.init: ignoring unknown key "${a}". Supported: ${[...Dt].join(", ")}.`
|
|
576
590
|
);
|
|
577
591
|
}
|
|
578
592
|
}
|
|
579
|
-
function
|
|
593
|
+
function Gt(t) {
|
|
580
594
|
typeof console < "u" && typeof console.warn == "function" && console.warn(t);
|
|
581
595
|
}
|
|
582
|
-
const
|
|
583
|
-
function
|
|
596
|
+
const dn = 80;
|
|
597
|
+
function fn() {
|
|
584
598
|
const t = [], e = {};
|
|
585
599
|
let r = !1;
|
|
586
600
|
const n = (a, o) => {
|
|
@@ -594,7 +608,7 @@ function on() {
|
|
|
594
608
|
level: a,
|
|
595
609
|
text: s.slice(0, 2e3),
|
|
596
610
|
at: Date.now()
|
|
597
|
-
}), t.length >
|
|
611
|
+
}), t.length > dn && t.shift();
|
|
598
612
|
};
|
|
599
613
|
return {
|
|
600
614
|
hook: () => {
|
|
@@ -613,7 +627,7 @@ function on() {
|
|
|
613
627
|
}
|
|
614
628
|
};
|
|
615
629
|
}
|
|
616
|
-
function
|
|
630
|
+
function hn(t) {
|
|
617
631
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
618
632
|
let r = null, n = !1;
|
|
619
633
|
const i = () => {
|
|
@@ -643,8 +657,8 @@ function sn(t) {
|
|
|
643
657
|
isActive: () => n
|
|
644
658
|
};
|
|
645
659
|
}
|
|
646
|
-
const
|
|
647
|
-
function
|
|
660
|
+
const pn = 60 * 1e3;
|
|
661
|
+
function mn({ onStart: t, onStop: e, onError: r }) {
|
|
648
662
|
let n = null, i = null, a = [], o = null;
|
|
649
663
|
const s = () => {
|
|
650
664
|
if (o && (clearTimeout(o), o = null), i && i.state !== "inactive")
|
|
@@ -676,10 +690,10 @@ function ln({ onStart: t, onStop: e, onError: r }) {
|
|
|
676
690
|
}, i.onstop = () => {
|
|
677
691
|
const g = a.length ? new Blob(a, { type: i.mimeType || "video/webm" }) : null;
|
|
678
692
|
s(), e(g);
|
|
679
|
-
}, (p = n.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), i.start(), o = setTimeout(l,
|
|
693
|
+
}, (p = n.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, pn);
|
|
680
694
|
}, stop: l };
|
|
681
695
|
}
|
|
682
|
-
function
|
|
696
|
+
function yn() {
|
|
683
697
|
const t = /* @__PURE__ */ new Set();
|
|
684
698
|
return {
|
|
685
699
|
alloc() {
|
|
@@ -697,19 +711,19 @@ function un() {
|
|
|
697
711
|
}
|
|
698
712
|
};
|
|
699
713
|
}
|
|
700
|
-
const
|
|
701
|
-
function
|
|
702
|
-
const t =
|
|
703
|
-
let e = [], r = { ...
|
|
714
|
+
const st = { x: 0, y: 0, w: 1, h: 1 };
|
|
715
|
+
function Jt() {
|
|
716
|
+
const t = yn();
|
|
717
|
+
let e = [], r = { ...st }, n = 1;
|
|
704
718
|
return {
|
|
705
|
-
list: () => e.filter((a) =>
|
|
719
|
+
list: () => e.filter((a) => wn(a, r)),
|
|
706
720
|
all: () => e.slice(),
|
|
707
721
|
crop: () => ({ ...r }),
|
|
708
722
|
setCrop(a) {
|
|
709
|
-
return r =
|
|
723
|
+
return r = gn(a), r;
|
|
710
724
|
},
|
|
711
725
|
resetCrop() {
|
|
712
|
-
return r = { ...
|
|
726
|
+
return r = { ...st }, r;
|
|
713
727
|
},
|
|
714
728
|
isCropped() {
|
|
715
729
|
return r.x > 1e-6 || r.y > 1e-6 || r.w < 1 - 1e-6 || r.h < 1 - 1e-6;
|
|
@@ -741,20 +755,20 @@ function Xt() {
|
|
|
741
755
|
return t.free(s.number), s;
|
|
742
756
|
},
|
|
743
757
|
reset() {
|
|
744
|
-
for (e = [], r = { ...
|
|
758
|
+
for (e = [], r = { ...st }, n = 1; t.peekUsed().length; )
|
|
745
759
|
t.free(t.peekUsed()[0]);
|
|
746
760
|
}
|
|
747
761
|
};
|
|
748
762
|
}
|
|
749
|
-
function
|
|
763
|
+
function gn(t) {
|
|
750
764
|
const e = Math.min(Math.max(t.x, 0), 0.95), r = Math.min(Math.max(t.y, 0), 0.95), n = Math.min(Math.max(t.w, 0.05), 1 - e), i = Math.min(Math.max(t.h, 0.05), 1 - r);
|
|
751
765
|
return { x: e, y: r, w: n, h: i };
|
|
752
766
|
}
|
|
753
|
-
function
|
|
767
|
+
function wn(t, e) {
|
|
754
768
|
const r = t.type === "arrow" ? (t.x + (t.x2 ?? t.x)) / 2 : t.x + (t.w || 0) / 2, n = t.type === "arrow" ? (t.y + (t.y2 ?? t.y)) / 2 : t.y + (t.h || 0) / 2;
|
|
755
769
|
return r >= e.x && n >= e.y && r <= e.x + e.w && n <= e.y + e.h;
|
|
756
770
|
}
|
|
757
|
-
function
|
|
771
|
+
function bn(t, e, r, n = {}) {
|
|
758
772
|
const i = n.mark || "#fdd341", a = n.markText || "#2a2140";
|
|
759
773
|
return new Promise((o, s) => {
|
|
760
774
|
const l = new Image();
|
|
@@ -763,17 +777,17 @@ function hn(t, e, r, n = {}) {
|
|
|
763
777
|
P.width = p, P.height = g;
|
|
764
778
|
const f = P.getContext("2d");
|
|
765
779
|
f.drawImage(l, v, y, p, g, 0, 0, p, g), f.lineWidth = Math.max(3, Math.round(p / 400)), f.strokeStyle = i, f.fillStyle = i, f.font = `700 ${Math.max(14, Math.round(p / 40))}px sans-serif`, r.forEach((m) => {
|
|
766
|
-
const
|
|
780
|
+
const T = dt(m.x, e, p), k = ft(m.y, e, g), A = m.w / e.w * p, U = m.h / e.h * g;
|
|
767
781
|
if (m.type === "rect")
|
|
768
|
-
f.strokeRect(
|
|
782
|
+
f.strokeRect(T, k, A, U);
|
|
769
783
|
else if (m.type === "circle")
|
|
770
|
-
f.beginPath(), f.ellipse(
|
|
784
|
+
f.beginPath(), f.ellipse(T + A / 2, k + U / 2, A / 2, U / 2, 0, 0, Math.PI * 2), f.stroke();
|
|
771
785
|
else if (m.type === "arrow") {
|
|
772
|
-
const
|
|
773
|
-
|
|
786
|
+
const se = dt(m.x2 ?? m.x + m.w, e, p), ce = ft(m.y2 ?? m.y, e, g);
|
|
787
|
+
xn(f, T, k, se, ce);
|
|
774
788
|
}
|
|
775
|
-
const
|
|
776
|
-
f.beginPath(), f.arc(
|
|
789
|
+
const B = vn(m, e, p, g, T, k, A), I = String(m.number);
|
|
790
|
+
f.beginPath(), f.arc(B.x, B.y, 11, 0, Math.PI * 2), f.fill(), f.fillStyle = a, f.textAlign = "center", f.textBaseline = "middle", f.fillText(I, B.x, B.y), f.fillStyle = i;
|
|
777
791
|
}), P.toBlob((m) => {
|
|
778
792
|
if (!m) {
|
|
779
793
|
s(new Error("Could not encode screenshot"));
|
|
@@ -784,15 +798,15 @@ function hn(t, e, r, n = {}) {
|
|
|
784
798
|
}, l.onerror = () => s(new Error("Could not load screenshot")), l.src = t;
|
|
785
799
|
});
|
|
786
800
|
}
|
|
787
|
-
function
|
|
801
|
+
function dt(t, e, r) {
|
|
788
802
|
return (t - e.x) / e.w * r;
|
|
789
803
|
}
|
|
790
|
-
function
|
|
804
|
+
function ft(t, e, r) {
|
|
791
805
|
return (t - e.y) / e.h * r;
|
|
792
806
|
}
|
|
793
|
-
function
|
|
807
|
+
function vn(t, e, r, n, i, a, o) {
|
|
794
808
|
if (t.type === "arrow") {
|
|
795
|
-
const s =
|
|
809
|
+
const s = dt(t.x2 ?? t.x + t.w, e, r), l = ft(t.y2 ?? t.y, e, n);
|
|
796
810
|
return {
|
|
797
811
|
x: (i + s) / 2,
|
|
798
812
|
y: (a + l) / 2
|
|
@@ -800,11 +814,11 @@ function pn(t, e, r, n, i, a, o) {
|
|
|
800
814
|
}
|
|
801
815
|
return { x: i + o / 2, y: a };
|
|
802
816
|
}
|
|
803
|
-
function
|
|
817
|
+
function xn(t, e, r, n, i) {
|
|
804
818
|
const a = Math.atan2(i - r, n - e), o = 14, s = 2, l = n - Math.cos(a) * s, v = i - Math.sin(a) * s;
|
|
805
819
|
t.beginPath(), t.moveTo(e, r), t.lineTo(l, v), t.stroke(), t.beginPath(), t.moveTo(n, i), t.lineTo(n - o * Math.cos(a - 0.4), i - o * Math.sin(a - 0.4)), t.lineTo(n - o * Math.cos(a + 0.4), i - o * Math.sin(a + 0.4)), t.closePath(), t.fill();
|
|
806
820
|
}
|
|
807
|
-
const
|
|
821
|
+
const Sn = ["bug", "idea", "other"], En = ["maker", "all-business", "brighter-day", "quiet-night"], Zt = "maker", Cn = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), ht = 0.02, Ot = 0.05, Mn = `
|
|
808
822
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
809
823
|
<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"/>
|
|
810
824
|
<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"/>
|
|
@@ -822,8 +836,8 @@ const F = {
|
|
|
822
836
|
discard: D('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
823
837
|
audio: D('<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"/>'),
|
|
824
838
|
video: D('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
825
|
-
},
|
|
826
|
-
|
|
839
|
+
}, Qt = fn();
|
|
840
|
+
Qt.hook();
|
|
827
841
|
let d = {
|
|
828
842
|
endpoint: "",
|
|
829
843
|
projectKey: "",
|
|
@@ -831,17 +845,17 @@ let d = {
|
|
|
831
845
|
name: "",
|
|
832
846
|
targets: null,
|
|
833
847
|
hideLauncher: !1,
|
|
834
|
-
theme:
|
|
848
|
+
theme: Zt,
|
|
835
849
|
video: !1
|
|
836
|
-
},
|
|
837
|
-
function
|
|
850
|
+
}, pt = {}, u = null, c = {}, h = Jt(), E = "", q = "", L = null, J = "bug", H = null, R = null, b = null, w = null, K = null, V = null, W = null, O = { w: 0, h: 0 }, ct = !1;
|
|
851
|
+
function S(t) {
|
|
838
852
|
return u.querySelector(t);
|
|
839
853
|
}
|
|
840
|
-
function
|
|
854
|
+
function te(t) {
|
|
841
855
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
842
|
-
return
|
|
856
|
+
return En.includes(e) ? e : Zt;
|
|
843
857
|
}
|
|
844
|
-
function
|
|
858
|
+
function Ht(t, e) {
|
|
845
859
|
return u && getComputedStyle(u).getPropertyValue(t).trim() || e;
|
|
846
860
|
}
|
|
847
861
|
function x(t, e = !1) {
|
|
@@ -849,9 +863,9 @@ function x(t, e = !1) {
|
|
|
849
863
|
c.status.textContent = "";
|
|
850
864
|
}, 4e3)));
|
|
851
865
|
}
|
|
852
|
-
function
|
|
866
|
+
function St() {
|
|
853
867
|
return u && document.body.contains(u) || (u = document.createElement("div"), u.id = "notefully", u.innerHTML = `
|
|
854
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
868
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Mn}</button>
|
|
855
869
|
<div class="nf-dialog" hidden>
|
|
856
870
|
<div class="nf-panel">
|
|
857
871
|
<div class="nf-stage">
|
|
@@ -882,107 +896,108 @@ function vt() {
|
|
|
882
896
|
</div>
|
|
883
897
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
884
898
|
`, document.body.appendChild(u), c = {
|
|
885
|
-
launcher:
|
|
886
|
-
dialog:
|
|
887
|
-
stage:
|
|
888
|
-
canvas:
|
|
889
|
-
text:
|
|
890
|
-
restore:
|
|
891
|
-
status:
|
|
892
|
-
audio:
|
|
893
|
-
video:
|
|
894
|
-
discard:
|
|
895
|
-
stop:
|
|
896
|
-
resetCrop:
|
|
899
|
+
launcher: S(".nf-launcher"),
|
|
900
|
+
dialog: S(".nf-dialog"),
|
|
901
|
+
stage: S(".nf-stage"),
|
|
902
|
+
canvas: S(".nf-canvas"),
|
|
903
|
+
text: S(".nf-text"),
|
|
904
|
+
restore: S(".nf-restore"),
|
|
905
|
+
status: S(".nf-status"),
|
|
906
|
+
audio: S(".nf-audio"),
|
|
907
|
+
video: S(".nf-video"),
|
|
908
|
+
discard: S(".nf-discard-shot"),
|
|
909
|
+
stop: S(".nf-stop-video"),
|
|
910
|
+
resetCrop: S(".nf-reset-crop"),
|
|
911
|
+
submit: S(".nf-submit"),
|
|
897
912
|
shot: null
|
|
898
|
-
},
|
|
913
|
+
}, $n(), nt()), u;
|
|
899
914
|
}
|
|
900
|
-
function
|
|
915
|
+
function nt() {
|
|
901
916
|
var t;
|
|
902
|
-
u && (u.dataset.theme =
|
|
917
|
+
u && (u.dataset.theme = te(d.theme), d.hideLauncher ? u.setAttribute("data-nf-hidden-launcher", "") : u.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !d.video), (t = c.dialog) != null && t.hidden && Z());
|
|
903
918
|
}
|
|
904
|
-
function
|
|
919
|
+
function Z() {
|
|
905
920
|
c.launcher && (c.launcher.hidden = !!d.hideLauncher);
|
|
906
921
|
}
|
|
907
|
-
function
|
|
908
|
-
c.launcher.addEventListener("click", () =>
|
|
909
|
-
t.target === c.dialog &&
|
|
922
|
+
function $n() {
|
|
923
|
+
c.launcher.addEventListener("click", () => ie()), S(".nf-dialog").addEventListener("click", (t) => {
|
|
924
|
+
t.target === c.dialog && at();
|
|
910
925
|
}), u.querySelectorAll(".nf-tool").forEach((t) => {
|
|
911
|
-
t.addEventListener("click", () =>
|
|
912
|
-
}), c.resetCrop.addEventListener("click",
|
|
913
|
-
t.addEventListener("click", () =>
|
|
914
|
-
}), c.discard.addEventListener("click",
|
|
915
|
-
|
|
916
|
-
}),
|
|
917
|
-
}
|
|
918
|
-
function
|
|
919
|
-
|
|
920
|
-
e.dataset.active = String(e.dataset.kind ===
|
|
926
|
+
t.addEventListener("click", () => yt(t.dataset.tool));
|
|
927
|
+
}), c.resetCrop.addEventListener("click", In), c.canvas.addEventListener("pointerdown", Ln), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), u.querySelectorAll("[data-kind]").forEach((t) => {
|
|
928
|
+
t.addEventListener("click", () => mt(t.dataset.kind));
|
|
929
|
+
}), c.discard.addEventListener("click", Dn), c.restore.addEventListener("click", Fn), c.audio.addEventListener("click", On), c.video.addEventListener("click", Hn), c.stop.addEventListener("click", () => W == null ? void 0 : W.stop()), S(".nf-submit").addEventListener("click", () => {
|
|
930
|
+
ae().catch((t) => x(t.message || "Submit failed."));
|
|
931
|
+
}), mt("bug"), yt(null);
|
|
932
|
+
}
|
|
933
|
+
function mt(t) {
|
|
934
|
+
J = Sn.includes(t) ? t : "bug", u.querySelectorAll("[data-kind]").forEach((e) => {
|
|
935
|
+
e.dataset.active = String(e.dataset.kind === J);
|
|
921
936
|
});
|
|
922
937
|
}
|
|
923
|
-
function
|
|
924
|
-
H =
|
|
938
|
+
function yt(t) {
|
|
939
|
+
H = Cn.has(t) ? t : null, R = null, u.querySelectorAll(".nf-tool").forEach((e) => {
|
|
925
940
|
e.dataset.active = String(e.dataset.tool === H);
|
|
926
|
-
}), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"),
|
|
941
|
+
}), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), E && $();
|
|
927
942
|
}
|
|
928
|
-
function
|
|
943
|
+
function jt(t) {
|
|
929
944
|
return Math.min(1, Math.max(0, t));
|
|
930
945
|
}
|
|
931
|
-
function
|
|
946
|
+
function rt() {
|
|
932
947
|
return c.shot || c.canvas;
|
|
933
948
|
}
|
|
934
|
-
function
|
|
935
|
-
const e =
|
|
949
|
+
function Q(t) {
|
|
950
|
+
const e = rt().getBoundingClientRect();
|
|
936
951
|
return {
|
|
937
|
-
x:
|
|
938
|
-
y:
|
|
952
|
+
x: jt((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
953
|
+
y: jt((t.clientY - e.top) / Math.max(e.height, 1))
|
|
939
954
|
};
|
|
940
955
|
}
|
|
941
|
-
function
|
|
942
|
-
const e =
|
|
956
|
+
function Rn(t) {
|
|
957
|
+
const e = rt().getBoundingClientRect();
|
|
943
958
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
944
959
|
}
|
|
945
|
-
function
|
|
946
|
-
const e =
|
|
960
|
+
function ee(t) {
|
|
961
|
+
const e = Q(t), r = h.crop();
|
|
947
962
|
return {
|
|
948
963
|
x: r.x + e.x * r.w,
|
|
949
964
|
y: r.y + e.y * r.h
|
|
950
965
|
};
|
|
951
966
|
}
|
|
952
|
-
function
|
|
967
|
+
function it(t, e) {
|
|
953
968
|
const r = Math.min(t.x, e.x), n = Math.min(t.y, e.y);
|
|
954
969
|
return {
|
|
955
970
|
x: r,
|
|
956
971
|
y: n,
|
|
957
|
-
w: Math.max(
|
|
958
|
-
h: Math.max(
|
|
972
|
+
w: Math.max(ht, Math.abs(e.x - t.x)),
|
|
973
|
+
h: Math.max(ht, Math.abs(e.y - t.y))
|
|
959
974
|
};
|
|
960
975
|
}
|
|
961
|
-
function
|
|
976
|
+
function Et(t) {
|
|
962
977
|
u && (t ? u.dataset.grabbing = "true" : delete u.dataset.grabbing);
|
|
963
978
|
}
|
|
964
|
-
function
|
|
979
|
+
function lt(t) {
|
|
965
980
|
try {
|
|
966
981
|
c.canvas.setPointerCapture(t.pointerId);
|
|
967
982
|
} catch {
|
|
968
983
|
}
|
|
969
984
|
}
|
|
970
|
-
function
|
|
971
|
-
window.addEventListener("pointermove",
|
|
985
|
+
function gt() {
|
|
986
|
+
window.addEventListener("pointermove", re), window.addEventListener("pointerup", tt), window.addEventListener("pointercancel", tt);
|
|
972
987
|
}
|
|
973
|
-
function
|
|
974
|
-
window.removeEventListener("pointermove",
|
|
988
|
+
function ne() {
|
|
989
|
+
window.removeEventListener("pointermove", re), window.removeEventListener("pointerup", tt), window.removeEventListener("pointercancel", tt);
|
|
975
990
|
}
|
|
976
|
-
function
|
|
977
|
-
if (t.button !== 0 || !
|
|
991
|
+
function Ln(t) {
|
|
992
|
+
if (t.button !== 0 || !E)
|
|
978
993
|
return;
|
|
979
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
994
|
+
if (!t.target.closest(".nf-sticker") && !Rn(t)) {
|
|
980
995
|
R = null, $();
|
|
981
996
|
return;
|
|
982
997
|
}
|
|
983
998
|
const e = t.target.closest(".nf-handle"), r = t.target.closest(".nf-sticker");
|
|
984
999
|
if (r && r.dataset.preview !== "true") {
|
|
985
|
-
t.preventDefault(), t.stopPropagation(), R = r.dataset.id,
|
|
1000
|
+
t.preventDefault(), t.stopPropagation(), R = r.dataset.id, lt(t), Pn({
|
|
986
1001
|
kind: "sticker",
|
|
987
1002
|
id: R,
|
|
988
1003
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
@@ -990,20 +1005,20 @@ function Sn(t) {
|
|
|
990
1005
|
return;
|
|
991
1006
|
}
|
|
992
1007
|
if (R = null, H === "crop") {
|
|
993
|
-
t.preventDefault(),
|
|
1008
|
+
t.preventDefault(), lt(t), b = { kind: "crop", start: Q(t), current: Q(t) }, gt(), $();
|
|
994
1009
|
return;
|
|
995
1010
|
}
|
|
996
1011
|
if (H === "arrow" || H === "rect" || H === "circle") {
|
|
997
|
-
t.preventDefault(),
|
|
998
|
-
const n =
|
|
999
|
-
b = { kind: "sticker", type: H, start: n, current: n },
|
|
1012
|
+
t.preventDefault(), lt(t);
|
|
1013
|
+
const n = ee(t);
|
|
1014
|
+
b = { kind: "sticker", type: H, start: n, current: n }, gt(), $();
|
|
1000
1015
|
return;
|
|
1001
1016
|
}
|
|
1002
1017
|
$();
|
|
1003
1018
|
}
|
|
1004
|
-
function
|
|
1019
|
+
function Pn(t, e) {
|
|
1005
1020
|
e.preventDefault(), e.stopPropagation();
|
|
1006
|
-
const r =
|
|
1021
|
+
const r = rt().getBoundingClientRect(), n = h.list().find((i) => i.id === t.id);
|
|
1007
1022
|
w = {
|
|
1008
1023
|
...t,
|
|
1009
1024
|
startX: e.clientX,
|
|
@@ -1011,11 +1026,11 @@ function En(t, e) {
|
|
|
1011
1026
|
crop: h.crop(),
|
|
1012
1027
|
sticker: n ? { ...n } : null,
|
|
1013
1028
|
rect: r
|
|
1014
|
-
},
|
|
1029
|
+
}, Et(t.dir === "move" || t.dir === "start" || t.dir === "end"), gt();
|
|
1015
1030
|
}
|
|
1016
|
-
function
|
|
1031
|
+
function re(t) {
|
|
1017
1032
|
if (b) {
|
|
1018
|
-
b.current = b.kind === "crop" ?
|
|
1033
|
+
b.current = b.kind === "crop" ? Q(t) : ee(t), $();
|
|
1019
1034
|
return;
|
|
1020
1035
|
}
|
|
1021
1036
|
if (!w)
|
|
@@ -1041,12 +1056,12 @@ function te(t) {
|
|
|
1041
1056
|
});
|
|
1042
1057
|
else {
|
|
1043
1058
|
const i = { x: n.x, y: n.y, w: n.w, h: n.h };
|
|
1044
|
-
|
|
1059
|
+
Tn(i, w.dir, e, r), h.update(n.id, i);
|
|
1045
1060
|
}
|
|
1046
1061
|
$();
|
|
1047
1062
|
}
|
|
1048
1063
|
}
|
|
1049
|
-
function
|
|
1064
|
+
function Tn(t, e, r, n) {
|
|
1050
1065
|
if (e.includes("e") && (t.w = Math.max(0.04, t.w + r)), e.includes("s") && (t.h = Math.max(0.04, t.h + n)), e.includes("w")) {
|
|
1051
1066
|
const i = Math.max(0.04, t.w - r);
|
|
1052
1067
|
t.x += t.w - i, t.w = i;
|
|
@@ -1056,9 +1071,9 @@ function Cn(t, e, r, n) {
|
|
|
1056
1071
|
t.y += t.h - i, t.h = i;
|
|
1057
1072
|
}
|
|
1058
1073
|
}
|
|
1059
|
-
function
|
|
1060
|
-
if (
|
|
1061
|
-
|
|
1074
|
+
function tt(t) {
|
|
1075
|
+
if (ne(), Et(!1), b) {
|
|
1076
|
+
kn();
|
|
1062
1077
|
return;
|
|
1063
1078
|
}
|
|
1064
1079
|
if (w) {
|
|
@@ -1069,13 +1084,13 @@ function Q(t) {
|
|
|
1069
1084
|
w = null, $();
|
|
1070
1085
|
}
|
|
1071
1086
|
}
|
|
1072
|
-
function
|
|
1087
|
+
function kn() {
|
|
1073
1088
|
const t = b;
|
|
1074
1089
|
if (b = null, !t)
|
|
1075
1090
|
return;
|
|
1076
1091
|
if (t.kind === "crop") {
|
|
1077
|
-
const r =
|
|
1078
|
-
if (Math.abs(t.current.x - t.start.x) <
|
|
1092
|
+
const r = it(t.start, t.current);
|
|
1093
|
+
if (Math.abs(t.current.x - t.start.x) < Ot || Math.abs(t.current.y - t.start.y) < Ot) {
|
|
1079
1094
|
$();
|
|
1080
1095
|
return;
|
|
1081
1096
|
}
|
|
@@ -1088,13 +1103,13 @@ function Mn() {
|
|
|
1088
1103
|
}), z();
|
|
1089
1104
|
return;
|
|
1090
1105
|
}
|
|
1091
|
-
const e =
|
|
1106
|
+
const e = An(t);
|
|
1092
1107
|
e && (R = e.id), $();
|
|
1093
1108
|
}
|
|
1094
|
-
function
|
|
1109
|
+
function An(t) {
|
|
1095
1110
|
if (t.type === "arrow") {
|
|
1096
1111
|
const e = t.current.x - t.start.x, r = t.current.y - t.start.y;
|
|
1097
|
-
return Math.hypot(e, r) <
|
|
1112
|
+
return Math.hypot(e, r) < ht ? h.add("arrow", {
|
|
1098
1113
|
x: t.start.x,
|
|
1099
1114
|
y: t.start.y,
|
|
1100
1115
|
x2: t.start.x + 0.12,
|
|
@@ -1110,51 +1125,51 @@ function $n(t) {
|
|
|
1110
1125
|
h: Math.abs(r)
|
|
1111
1126
|
});
|
|
1112
1127
|
}
|
|
1113
|
-
return h.add(t.type,
|
|
1128
|
+
return h.add(t.type, it(t.start, t.current));
|
|
1114
1129
|
}
|
|
1115
|
-
function
|
|
1130
|
+
function In() {
|
|
1116
1131
|
h.resetCrop(), R = null, z();
|
|
1117
1132
|
}
|
|
1118
|
-
function
|
|
1133
|
+
function wt() {
|
|
1119
1134
|
c.resetCrop && (c.resetCrop.hidden = !h.isCropped());
|
|
1120
1135
|
}
|
|
1121
|
-
function
|
|
1136
|
+
function Ct(t) {
|
|
1122
1137
|
if (!c.audio)
|
|
1123
1138
|
return;
|
|
1124
1139
|
const e = t ? "Stop audio" : "Record audio";
|
|
1125
1140
|
c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
|
|
1126
1141
|
}
|
|
1127
|
-
function
|
|
1128
|
-
|
|
1142
|
+
function Dn() {
|
|
1143
|
+
E && (q = E), E = "", c.stage.hidden = !0, c.restore.hidden = !q;
|
|
1129
1144
|
}
|
|
1130
|
-
function
|
|
1131
|
-
q && (
|
|
1145
|
+
function Fn() {
|
|
1146
|
+
q && (E = q, c.stage.hidden = !1, c.restore.hidden = !0, z());
|
|
1132
1147
|
}
|
|
1133
|
-
function
|
|
1148
|
+
function On() {
|
|
1134
1149
|
try {
|
|
1135
|
-
if (
|
|
1150
|
+
if (V || (V = hn((e) => {
|
|
1136
1151
|
const r = c.text.value.trim();
|
|
1137
1152
|
c.text.value = r ? `${r} ${e}` : e;
|
|
1138
|
-
})), !
|
|
1153
|
+
})), !V.isSupported()) {
|
|
1139
1154
|
x("Audio-to-text is not supported in this browser.");
|
|
1140
1155
|
return;
|
|
1141
1156
|
}
|
|
1142
|
-
const t =
|
|
1143
|
-
|
|
1157
|
+
const t = V.start();
|
|
1158
|
+
Ct(t), x(t ? "Listening…" : "");
|
|
1144
1159
|
} catch (t) {
|
|
1145
1160
|
x(t.message);
|
|
1146
1161
|
}
|
|
1147
1162
|
}
|
|
1148
|
-
async function
|
|
1163
|
+
async function Hn() {
|
|
1149
1164
|
if (!d.video) {
|
|
1150
1165
|
x("Video is disabled on this host.");
|
|
1151
1166
|
return;
|
|
1152
1167
|
}
|
|
1153
|
-
c.dialog.hidden = !0, c.stop.hidden = !1,
|
|
1168
|
+
c.dialog.hidden = !0, c.stop.hidden = !1, nt(), c.launcher.hidden = !0, W = mn({
|
|
1154
1169
|
onStart() {
|
|
1155
1170
|
},
|
|
1156
1171
|
onStop(t) {
|
|
1157
|
-
L = t, c.stop.hidden = !0,
|
|
1172
|
+
L = t, c.stop.hidden = !0, Z(), c.dialog.hidden = !1, z(), x(t ? "Video attached." : "Recording cancelled.");
|
|
1158
1173
|
},
|
|
1159
1174
|
onError(t) {
|
|
1160
1175
|
x(t.message);
|
|
@@ -1163,30 +1178,30 @@ async function Tn() {
|
|
|
1163
1178
|
try {
|
|
1164
1179
|
await W.start();
|
|
1165
1180
|
} catch (t) {
|
|
1166
|
-
c.stop.hidden = !0,
|
|
1181
|
+
c.stop.hidden = !0, Z(), c.dialog.hidden = !1, x(t.message);
|
|
1167
1182
|
}
|
|
1168
1183
|
}
|
|
1169
1184
|
function z() {
|
|
1170
|
-
if (c.shot = null, !
|
|
1171
|
-
c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = L ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(L)}"></video>` : "",
|
|
1185
|
+
if (c.shot = null, !E) {
|
|
1186
|
+
c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = L ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(L)}"></video>` : "", wt();
|
|
1172
1187
|
return;
|
|
1173
1188
|
}
|
|
1174
|
-
c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${
|
|
1189
|
+
c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${E}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
|
|
1175
1190
|
const t = c.shot.querySelector("img");
|
|
1176
1191
|
t.draggable = !1, t.addEventListener("dragstart", (r) => r.preventDefault());
|
|
1177
1192
|
const e = () => {
|
|
1178
|
-
|
|
1193
|
+
jn(t), $();
|
|
1179
1194
|
};
|
|
1180
1195
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1181
1196
|
}
|
|
1182
|
-
function
|
|
1197
|
+
function jn(t) {
|
|
1183
1198
|
const e = t.naturalWidth || O.w, r = t.naturalHeight || O.h;
|
|
1184
1199
|
if (e && r && (O = { w: e, h: r }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / r)), c.canvas.style.aspectRatio = `${e} / ${r}`), !c.shot || !O.w || !O.h)
|
|
1185
1200
|
return;
|
|
1186
1201
|
const n = h.crop(), i = O.w / O.h, a = n.w / n.h * i, o = Math.min(1, a / i), s = Math.min(1, i / a);
|
|
1187
1202
|
c.shot.style.left = `${(1 - o) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${o * 100}%`, c.shot.style.height = `${s * 100}%`, t.style.width = `${100 / n.w}%`, t.style.height = `${100 / n.h}%`, t.style.left = `${-n.x / n.w * 100}%`, t.style.top = `${-n.y / n.h * 100}%`;
|
|
1188
1203
|
}
|
|
1189
|
-
function
|
|
1204
|
+
function Un(t) {
|
|
1190
1205
|
return t.type === "arrow" ? {
|
|
1191
1206
|
id: "preview",
|
|
1192
1207
|
type: "arrow",
|
|
@@ -1201,23 +1216,23 @@ function In(t) {
|
|
|
1201
1216
|
id: "preview",
|
|
1202
1217
|
type: t.type,
|
|
1203
1218
|
number: "",
|
|
1204
|
-
...
|
|
1219
|
+
...it(t.start, t.current)
|
|
1205
1220
|
};
|
|
1206
1221
|
}
|
|
1207
1222
|
function $() {
|
|
1208
|
-
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((n) => n.remove()), !
|
|
1209
|
-
|
|
1223
|
+
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((n) => n.remove()), !E || !c.shot) {
|
|
1224
|
+
wt();
|
|
1210
1225
|
return;
|
|
1211
1226
|
}
|
|
1212
1227
|
const e = h.crop();
|
|
1213
1228
|
if ((b == null ? void 0 : b.kind) === "crop") {
|
|
1214
1229
|
const n = document.createElement("div");
|
|
1215
|
-
n.className = "nf-crop",
|
|
1230
|
+
n.className = "nf-crop", Ut(n, it(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(n);
|
|
1216
1231
|
}
|
|
1217
1232
|
const r = h.list().slice();
|
|
1218
|
-
if ((b == null ? void 0 : b.kind) === "sticker" && r.push(
|
|
1233
|
+
if ((b == null ? void 0 : b.kind) === "sticker" && r.push(Un(b)), r.forEach((n) => {
|
|
1219
1234
|
const i = n.id === "preview", a = !i && n.id === R, o = document.createElement("div");
|
|
1220
|
-
if (o.className = `nf-sticker nf-${n.type}`, o.dataset.id = n.id, a && (o.dataset.selected = "true"), i && (o.dataset.preview = "true"), n.type === "arrow" ?
|
|
1235
|
+
if (o.className = `nf-sticker nf-${n.type}`, o.dataset.id = n.id, a && (o.dataset.selected = "true"), i && (o.dataset.preview = "true"), n.type === "arrow" ? Bn(o, n, e, a) : (Ut(o, n, e), a && ["nw", "ne", "sw", "se"].forEach((s) => bt(o, s))), !i && n.number) {
|
|
1221
1236
|
const s = document.createElement("span");
|
|
1222
1237
|
s.className = "nf-badge", s.textContent = String(n.number), o.appendChild(s);
|
|
1223
1238
|
}
|
|
@@ -1226,29 +1241,29 @@ function $() {
|
|
|
1226
1241
|
const n = document.createElement("video");
|
|
1227
1242
|
n.className = "nf-recording-preview", n.controls = !0, n.src = URL.createObjectURL(L), n.style.position = "absolute", n.style.right = "8px", n.style.bottom = "8px", n.style.width = "160px", c.canvas.appendChild(n);
|
|
1228
1243
|
}
|
|
1229
|
-
|
|
1244
|
+
wt();
|
|
1230
1245
|
}
|
|
1231
|
-
function
|
|
1232
|
-
const i =
|
|
1246
|
+
function Bn(t, e, r, n) {
|
|
1247
|
+
const i = rt(), a = i.clientWidth, o = i.clientHeight, s = (e.x - r.x) / r.w * a, l = (e.y - r.y) / r.h * o, v = ((e.x2 ?? e.x + e.w) - r.x) / r.w * a, y = ((e.y2 ?? e.y) - r.y) / r.h * o, p = 18, g = Math.min(s, v) - p, P = Math.min(l, y) - p, f = Math.max(2, Math.abs(v - s)) + p * 2, m = Math.max(2, Math.abs(y - l)) + p * 2, T = s - g, k = l - P, A = v - g, U = y - P, B = `nf-ah-${e.id}`, I = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1233
1248
|
t.style.left = `${g}px`, t.style.top = `${P}px`, t.style.width = `${f}px`, t.style.height = `${m}px`, I.setAttribute("class", "nf-arrow-svg"), I.setAttribute("viewBox", `0 0 ${f} ${m}`), I.setAttribute("width", String(f)), I.setAttribute("height", String(m)), I.innerHTML = `
|
|
1234
1249
|
<defs>
|
|
1235
|
-
<marker id="${
|
|
1250
|
+
<marker id="${B}" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
|
|
1236
1251
|
<path d="M0,0 L10,5 L0,10 Z" fill="currentColor" />
|
|
1237
1252
|
</marker>
|
|
1238
1253
|
</defs>
|
|
1239
|
-
<line class="nf-arrow-hit" x1="${
|
|
1240
|
-
<line class="nf-arrow-shaft" x1="${
|
|
1241
|
-
`, t.appendChild(I), n && (
|
|
1254
|
+
<line class="nf-arrow-hit" x1="${T}" y1="${k}" x2="${A}" y2="${U}" />
|
|
1255
|
+
<line class="nf-arrow-shaft" x1="${T}" y1="${k}" x2="${A}" y2="${U}" marker-end="url(#${B})" />
|
|
1256
|
+
`, t.appendChild(I), n && (bt(t, "start", { left: T - 5, top: k - 5 }), bt(t, "end", { left: A - 5, top: U - 5 }));
|
|
1242
1257
|
}
|
|
1243
|
-
function
|
|
1258
|
+
function bt(t, e, r) {
|
|
1244
1259
|
const n = document.createElement("span");
|
|
1245
1260
|
n.className = "nf-handle", n.dataset.dir = e, r && (n.style.left = `${r.left}px`, n.style.top = `${r.top}px`), t.appendChild(n);
|
|
1246
1261
|
}
|
|
1247
|
-
function
|
|
1262
|
+
function Ut(t, e, r) {
|
|
1248
1263
|
t.style.left = `${(e.x - r.x) / r.w * 100}%`, t.style.top = `${(e.y - r.y) / r.h * 100}%`, t.style.width = `${e.w / r.w * 100}%`, t.style.height = `${e.h / r.h * 100}%`;
|
|
1249
1264
|
}
|
|
1250
|
-
function
|
|
1251
|
-
return
|
|
1265
|
+
function Vn(t = {}) {
|
|
1266
|
+
return un(t), d = {
|
|
1252
1267
|
...d,
|
|
1253
1268
|
endpoint: String(t.endpoint || d.endpoint || "").replace(/\/$/, ""),
|
|
1254
1269
|
projectKey: t.projectKey == null ? d.projectKey : String(t.projectKey),
|
|
@@ -1256,78 +1271,86 @@ function Fn(t = {}) {
|
|
|
1256
1271
|
name: t.name == null ? d.name : String(t.name || ""),
|
|
1257
1272
|
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1258
1273
|
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1259
|
-
theme:
|
|
1274
|
+
theme: te(t.theme ?? d.theme),
|
|
1260
1275
|
video: t.video == null ? d.video : !!t.video
|
|
1261
|
-
},
|
|
1276
|
+
}, St(), nt(), oe;
|
|
1262
1277
|
}
|
|
1263
|
-
async function
|
|
1264
|
-
|
|
1278
|
+
async function ie() {
|
|
1279
|
+
St(), nt(), c.launcher.hidden = !0, h = Jt(), O = { w: 0, h: 0 }, L = null, R = null, b = null, w = null, J = "bug", mt("bug"), yt(null), Ct(!1), c.text.value = "", x("");
|
|
1265
1280
|
try {
|
|
1266
|
-
|
|
1281
|
+
E = await sn(), q = E, c.stage.hidden = !1, c.restore.hidden = !0, x("");
|
|
1267
1282
|
} catch {
|
|
1268
|
-
|
|
1283
|
+
E = "", x("Screenshot failed; you can still send text.");
|
|
1269
1284
|
}
|
|
1270
1285
|
c.dialog.hidden = !1, z(), c.text.focus();
|
|
1271
1286
|
}
|
|
1272
|
-
function
|
|
1273
|
-
u && (
|
|
1287
|
+
function at() {
|
|
1288
|
+
u && (V == null || V.stop(), Ct(!1), ne(), b = null, w = null, Et(!1), c.dialog.hidden = !0, c.stop.hidden = !0, Z());
|
|
1274
1289
|
}
|
|
1275
|
-
function
|
|
1276
|
-
|
|
1290
|
+
function _n(t = {}) {
|
|
1291
|
+
pt = { ...pt, ...ln(t) };
|
|
1277
1292
|
}
|
|
1278
|
-
async function
|
|
1279
|
-
|
|
1293
|
+
async function ae() {
|
|
1294
|
+
if (St(), ct)
|
|
1295
|
+
return null;
|
|
1280
1296
|
const t = c.text.value.trim();
|
|
1281
|
-
if (!t && !
|
|
1297
|
+
if (!t && !E && !L)
|
|
1282
1298
|
return x("Add a note, screenshot, or video first."), null;
|
|
1283
1299
|
if (!d.endpoint || !d.projectKey)
|
|
1284
1300
|
return x("Notefully is missing endpoint or projectKey."), null;
|
|
1285
|
-
x("Submitting…", !0);
|
|
1286
|
-
const e = new FormData();
|
|
1287
|
-
if (e.append("message", t), e.append("kind", G), e.append("version", d.version || "0.0.0"), d.name && e.append("name", d.name), e.append("context", JSON.stringify({
|
|
1288
|
-
...en(ft),
|
|
1289
|
-
console: Gt.snapshot()
|
|
1290
|
-
})), e.append("annotations", JSON.stringify(h.list())), Array.isArray(d.targets) && e.append("targets", JSON.stringify(d.targets)), S) {
|
|
1291
|
-
const i = await hn(
|
|
1292
|
-
S,
|
|
1293
|
-
h.crop(),
|
|
1294
|
-
h.list(),
|
|
1295
|
-
{
|
|
1296
|
-
mark: Ft("--nf-mark", "#fdd341"),
|
|
1297
|
-
markText: Ft("--nf-mark-text", "#2a2140")
|
|
1298
|
-
}
|
|
1299
|
-
);
|
|
1300
|
-
e.append("screenshot", i, "screenshot.png");
|
|
1301
|
-
}
|
|
1302
|
-
L && e.append("recording", L, "recording.webm");
|
|
1303
|
-
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1304
|
-
method: "POST",
|
|
1305
|
-
headers: {
|
|
1306
|
-
"X-Notefully-Key": d.projectKey
|
|
1307
|
-
},
|
|
1308
|
-
body: e
|
|
1309
|
-
});
|
|
1310
|
-
let n = null;
|
|
1301
|
+
ct = !0, Bt(!0), x("Submitting…", !0);
|
|
1311
1302
|
try {
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1303
|
+
const e = new FormData();
|
|
1304
|
+
if (e.append("message", t), e.append("kind", J), e.append("version", d.version || "0.0.0"), d.name && e.append("name", d.name), e.append("context", JSON.stringify({
|
|
1305
|
+
...cn(pt),
|
|
1306
|
+
console: Qt.snapshot()
|
|
1307
|
+
})), e.append("annotations", JSON.stringify(h.list())), Array.isArray(d.targets) && e.append("targets", JSON.stringify(d.targets)), E) {
|
|
1308
|
+
const i = await bn(
|
|
1309
|
+
E,
|
|
1310
|
+
h.crop(),
|
|
1311
|
+
h.list(),
|
|
1312
|
+
{
|
|
1313
|
+
mark: Ht("--nf-mark", "#fdd341"),
|
|
1314
|
+
markText: Ht("--nf-mark-text", "#2a2140")
|
|
1315
|
+
}
|
|
1316
|
+
);
|
|
1317
|
+
e.append("screenshot", i, "screenshot.png");
|
|
1318
|
+
}
|
|
1319
|
+
L && e.append("recording", L, "recording.webm");
|
|
1320
|
+
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1321
|
+
method: "POST",
|
|
1322
|
+
headers: {
|
|
1323
|
+
"X-Notefully-Key": d.projectKey
|
|
1324
|
+
},
|
|
1325
|
+
body: e
|
|
1326
|
+
});
|
|
1327
|
+
let n = null;
|
|
1328
|
+
try {
|
|
1329
|
+
n = await r.json();
|
|
1330
|
+
} catch {
|
|
1331
|
+
n = null;
|
|
1332
|
+
}
|
|
1333
|
+
if (!r.ok)
|
|
1334
|
+
throw x((n == null ? void 0 : n.error) || "Submit failed."), new Error((n == null ? void 0 : n.error) || `Submit failed (${r.status})`);
|
|
1335
|
+
return x("Sent. Thank you."), at(), n;
|
|
1336
|
+
} finally {
|
|
1337
|
+
ct = !1, Bt(!1);
|
|
1315
1338
|
}
|
|
1316
|
-
if (!r.ok)
|
|
1317
|
-
throw x((n == null ? void 0 : n.error) || "Submit failed."), new Error((n == null ? void 0 : n.error) || `Submit failed (${r.status})`);
|
|
1318
|
-
return x("Sent. Thank you."), it(), n;
|
|
1319
1339
|
}
|
|
1320
|
-
function
|
|
1321
|
-
|
|
1340
|
+
function Bt(t) {
|
|
1341
|
+
c.submit && (c.submit.disabled = !!t, c.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1342
|
+
}
|
|
1343
|
+
function Nn() {
|
|
1344
|
+
at(), u == null || u.remove(), u = null, c = {};
|
|
1322
1345
|
}
|
|
1323
|
-
const
|
|
1324
|
-
typeof window < "u" && (window.Notefully =
|
|
1346
|
+
const oe = { init: Vn, open: ie, close: at, identify: _n, submit: ae, destroy: Nn };
|
|
1347
|
+
typeof window < "u" && (window.Notefully = oe);
|
|
1325
1348
|
export {
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1349
|
+
at as close,
|
|
1350
|
+
oe as default,
|
|
1351
|
+
Nn as destroy,
|
|
1352
|
+
_n as identify,
|
|
1353
|
+
Vn as init,
|
|
1354
|
+
ie as open,
|
|
1355
|
+
ae as submit
|
|
1333
1356
|
};
|