@makefully/notefully 0.1.1 → 0.1.3
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 +49 -16
- package/dist/notefully.iife.js +17 -17
- package/dist/notefully.js +562 -499
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function
|
|
1
|
+
function oe(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
5
5
|
return window.location.protocol + t;
|
|
6
6
|
if (t.match(/^[a-z]+:/i))
|
|
7
7
|
return t;
|
|
8
|
-
const r = document.implementation.createHTMLDocument(), n = r.createElement("base"),
|
|
9
|
-
return r.head.appendChild(n), r.body.appendChild(
|
|
8
|
+
const r = document.implementation.createHTMLDocument(), n = r.createElement("base"), i = r.createElement("a");
|
|
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 se = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -16,33 +16,33 @@ const ee = /* @__PURE__ */ (() => {
|
|
|
16
16
|
);
|
|
17
17
|
return () => (t += 1, `u${e()}${t}`);
|
|
18
18
|
})();
|
|
19
|
-
function
|
|
19
|
+
function j(t) {
|
|
20
20
|
const e = [];
|
|
21
21
|
for (let r = 0, n = t.length; r < n; r++)
|
|
22
22
|
e.push(t[r]);
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
25
|
let _ = null;
|
|
26
|
-
function
|
|
27
|
-
return _ || (t.includeStyleProperties ? (_ = t.includeStyleProperties, _) : (_ =
|
|
26
|
+
function jt(t = {}) {
|
|
27
|
+
return _ || (t.includeStyleProperties ? (_ = t.includeStyleProperties, _) : (_ = j(window.getComputedStyle(document.documentElement)), _));
|
|
28
28
|
}
|
|
29
|
-
function
|
|
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
|
|
34
|
-
const e =
|
|
33
|
+
function ce(t) {
|
|
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
|
|
38
|
-
const e =
|
|
37
|
+
function le(t) {
|
|
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 Ut(t, e = {}) {
|
|
42
|
+
const r = e.width || ce(t), n = e.height || le(t);
|
|
43
43
|
return { width: r, height: n };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function ue() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -52,10 +52,10 @@ function ae() {
|
|
|
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 de(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
|
-
function
|
|
58
|
+
function Y(t) {
|
|
59
59
|
return new Promise((e, r) => {
|
|
60
60
|
const n = new Image();
|
|
61
61
|
n.onload = () => {
|
|
@@ -65,12 +65,12 @@ function K(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 fe(t) {
|
|
69
69
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
70
70
|
}
|
|
71
|
-
async function
|
|
72
|
-
const n = "http://www.w3.org/2000/svg",
|
|
73
|
-
return
|
|
71
|
+
async function he(t, e, r) {
|
|
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), fe(i);
|
|
74
74
|
}
|
|
75
75
|
const C = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
@@ -78,408 +78,408 @@ 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 pe(t) {
|
|
82
82
|
const e = t.getPropertyValue("content");
|
|
83
83
|
return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
87
|
-
const n = t.getPropertyValue(r),
|
|
88
|
-
return `${r}: ${n}${
|
|
85
|
+
function me(t, e) {
|
|
86
|
+
return jt(e).map((r) => {
|
|
87
|
+
const n = t.getPropertyValue(r), i = t.getPropertyPriority(r);
|
|
88
|
+
return `${r}: ${n}${i ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
return document.createTextNode(`${
|
|
91
|
+
function ye(t, e, r, n) {
|
|
92
|
+
const i = `.${t}:${e}`, a = r.cssText ? pe(r) : me(r, n);
|
|
93
|
+
return document.createTextNode(`${i}{${a}}`);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
95
|
+
function Et(t, e, r, n) {
|
|
96
|
+
const i = window.getComputedStyle(t, r), a = i.getPropertyValue("content");
|
|
97
|
+
if (a === "" || a === "none")
|
|
98
98
|
return;
|
|
99
|
-
const o =
|
|
99
|
+
const o = se();
|
|
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(ye(o, r, i, n)), e.appendChild(s);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function ge(t, e, r) {
|
|
109
|
+
Et(t, e, ":before", r), Et(t, e, ":after", r);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
woff:
|
|
113
|
-
woff2:
|
|
111
|
+
const Ct = "application/font-woff", Mt = "image/jpeg", we = {
|
|
112
|
+
woff: Ct,
|
|
113
|
+
woff2: Ct,
|
|
114
114
|
ttf: "application/font-truetype",
|
|
115
115
|
eot: "application/vnd.ms-fontobject",
|
|
116
116
|
png: "image/png",
|
|
117
|
-
jpg:
|
|
118
|
-
jpeg:
|
|
117
|
+
jpg: Mt,
|
|
118
|
+
jpeg: Mt,
|
|
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 be(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 wt(t) {
|
|
129
|
+
const e = be(t).toLowerCase();
|
|
130
|
+
return we[e] || "";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function ve(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function ct(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function xe(t, e) {
|
|
139
139
|
return `data:${e};base64,${t}`;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function Vt(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`);
|
|
145
|
-
const
|
|
146
|
-
return new Promise((
|
|
145
|
+
const i = await n.blob();
|
|
146
|
+
return new Promise((a, o) => {
|
|
147
147
|
const s = new FileReader();
|
|
148
148
|
s.onerror = o, s.onloadend = () => {
|
|
149
149
|
try {
|
|
150
|
-
|
|
150
|
+
a(r({ res: n, result: s.result }));
|
|
151
151
|
} catch (l) {
|
|
152
152
|
o(l);
|
|
153
153
|
}
|
|
154
|
-
}, s.readAsDataURL(
|
|
154
|
+
}, s.readAsDataURL(i);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
const at = {};
|
|
158
|
-
function
|
|
158
|
+
function Se(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 =
|
|
162
|
+
async function bt(t, e, r) {
|
|
163
|
+
const n = Se(t, e, r.includeQueryParams);
|
|
164
164
|
if (at[n] != null)
|
|
165
165
|
return at[n];
|
|
166
166
|
r.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
|
-
let
|
|
167
|
+
let i;
|
|
168
168
|
try {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
} catch (
|
|
172
|
-
|
|
169
|
+
const a = await Vt(t, r.fetchRequestInit, ({ res: o, result: s }) => (e || (e = o.headers.get("Content-Type") || ""), ve(s)));
|
|
170
|
+
i = xe(a, e);
|
|
171
|
+
} catch (a) {
|
|
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 at[n] =
|
|
176
|
+
return at[n] = i, i;
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function Ee(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
180
|
-
return e === "data:," ? t.cloneNode(!1) :
|
|
180
|
+
return e === "data:," ? t.cloneNode(!1) : Y(e);
|
|
181
181
|
}
|
|
182
|
-
async function
|
|
182
|
+
async function Ce(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
const s =
|
|
187
|
-
return
|
|
184
|
+
const a = document.createElement("canvas"), o = a.getContext("2d");
|
|
185
|
+
a.width = t.clientWidth, a.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, a.width, a.height);
|
|
186
|
+
const s = a.toDataURL();
|
|
187
|
+
return Y(s);
|
|
188
188
|
}
|
|
189
|
-
const r = t.poster, n =
|
|
190
|
-
return
|
|
189
|
+
const r = t.poster, n = wt(r), i = await bt(r, n, e);
|
|
190
|
+
return Y(i);
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function Me(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 tt(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 $e(t, e) {
|
|
202
|
+
return C(t, HTMLCanvasElement) ? Ee(t) : C(t, HTMLVideoElement) ? Ce(t, e) : C(t, HTMLIFrameElement) ? Me(t, e) : t.cloneNode(Bt(t));
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
async function
|
|
206
|
-
var n,
|
|
207
|
-
if (
|
|
204
|
+
const Re = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Bt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
|
+
async function Le(t, e, r) {
|
|
206
|
+
var n, i;
|
|
207
|
+
if (Bt(e))
|
|
208
208
|
return e;
|
|
209
|
-
let
|
|
210
|
-
return
|
|
209
|
+
let a = [];
|
|
210
|
+
return Re(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(() => tt(s, r)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function Pe(t, e, r) {
|
|
215
215
|
const n = e.style;
|
|
216
216
|
if (!n)
|
|
217
217
|
return;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
let o =
|
|
221
|
-
|
|
218
|
+
const i = window.getComputedStyle(t);
|
|
219
|
+
i.cssText ? (n.cssText = i.cssText, n.transformOrigin = i.transformOrigin) : jt(r).forEach((a) => {
|
|
220
|
+
let o = i.getPropertyValue(a);
|
|
221
|
+
a === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), 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 ke(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 Te(t, e) {
|
|
228
228
|
if (C(t, HTMLSelectElement)) {
|
|
229
|
-
const n = Array.from(e.children).find((
|
|
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 Ae(t, e, r) {
|
|
234
|
+
return C(e, Element) && (Pe(t, e, r), ge(t, e, r), ke(t, e), Te(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function Ie(t, e) {
|
|
237
237
|
const r = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (r.length === 0)
|
|
239
239
|
return t;
|
|
240
240
|
const n = {};
|
|
241
|
-
for (let
|
|
242
|
-
const s = r[
|
|
241
|
+
for (let a = 0; a < r.length; a++) {
|
|
242
|
+
const s = r[a].getAttribute("xlink:href");
|
|
243
243
|
if (s) {
|
|
244
|
-
const l = t.querySelector(s),
|
|
245
|
-
!l &&
|
|
244
|
+
const l = t.querySelector(s), v = document.querySelector(s);
|
|
245
|
+
!l && v && !n[s] && (n[s] = await tt(v, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
o.setAttribute("xmlns",
|
|
252
|
-
const s = document.createElementNS(
|
|
248
|
+
const i = Object.values(n);
|
|
249
|
+
if (i.length) {
|
|
250
|
+
const a = "http://www.w3.org/1999/xhtml", o = document.createElementNS(a, "svg");
|
|
251
|
+
o.setAttribute("xmlns", a), o.style.position = "absolute", o.style.width = "0", o.style.height = "0", o.style.overflow = "hidden", o.style.display = "none";
|
|
252
|
+
const s = document.createElementNS(a, "defs");
|
|
253
253
|
o.appendChild(s);
|
|
254
|
-
for (let l = 0; l <
|
|
255
|
-
s.appendChild(
|
|
254
|
+
for (let l = 0; l < i.length; l++)
|
|
255
|
+
s.appendChild(i[l]);
|
|
256
256
|
t.appendChild(o);
|
|
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 tt(t, e, r) {
|
|
261
|
+
return !r && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((n) => $e(n, e)).then((n) => Le(t, n, e)).then((n) => Ae(t, n, e)).then((n) => Ie(n, e));
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
263
|
+
const _t = /url\((['"]?)([^'"]+?)\1\)/g, De = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Fe = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
|
+
function Oe(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function He(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(
|
|
270
|
+
return t.replace(_t, (r, n, i) => (e.push(i), r)), e.filter((r) => !ct(r));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function je(t, e, r, n, i) {
|
|
273
273
|
try {
|
|
274
|
-
const
|
|
274
|
+
const a = r ? oe(e, r) : e, o = wt(e);
|
|
275
275
|
let s;
|
|
276
|
-
return
|
|
276
|
+
return i || (s = await bt(a, o, n)), t.replace(Oe(e), `$1${s}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return e ? t.replace(
|
|
281
|
+
function Ue(t, { preferredFontFormat: e }) {
|
|
282
|
+
return e ? t.replace(Fe, (r) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [n, ,
|
|
285
|
-
if (!
|
|
284
|
+
const [n, , i] = De.exec(r) || [];
|
|
285
|
+
if (!i)
|
|
286
286
|
return "";
|
|
287
|
-
if (
|
|
287
|
+
if (i === e)
|
|
288
288
|
return `src: ${n};`;
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return t.search(
|
|
292
|
+
function Nt(t) {
|
|
293
|
+
return t.search(_t) !== -1;
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
if (!
|
|
295
|
+
async function Wt(t, e, r) {
|
|
296
|
+
if (!Nt(t))
|
|
297
297
|
return t;
|
|
298
|
-
const n =
|
|
299
|
-
return
|
|
298
|
+
const n = Ue(t, r);
|
|
299
|
+
return He(n).reduce((a, o) => a.then((s) => je(s, o, e, r)), Promise.resolve(n));
|
|
300
300
|
}
|
|
301
|
-
async function
|
|
301
|
+
async function N(t, e, r) {
|
|
302
302
|
var n;
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
const
|
|
306
|
-
return e.style.setProperty(t,
|
|
303
|
+
const i = (n = e.style) === null || n === void 0 ? void 0 : n.getPropertyValue(t);
|
|
304
|
+
if (i) {
|
|
305
|
+
const a = await Wt(i, null, r);
|
|
306
|
+
return e.style.setProperty(t, a, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
311
|
-
await
|
|
310
|
+
async function Ve(t, e) {
|
|
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 Be(t, e) {
|
|
314
314
|
const r = C(t, HTMLImageElement);
|
|
315
|
-
if (!(r && !
|
|
315
|
+
if (!(r && !ct(t.src)) && !(C(t, SVGImageElement) && !ct(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const n = r ? t.src : t.href.baseVal,
|
|
318
|
-
await new Promise((
|
|
319
|
-
t.onload =
|
|
317
|
+
const n = r ? t.src : t.href.baseVal, i = await bt(n, wt(n), e);
|
|
318
|
+
await new Promise((a, o) => {
|
|
319
|
+
t.onload = a, t.onerror = e.onImageErrorHandler ? (...l) => {
|
|
320
320
|
try {
|
|
321
|
-
|
|
322
|
-
} catch (
|
|
323
|
-
o(
|
|
321
|
+
a(e.onImageErrorHandler(...l));
|
|
322
|
+
} catch (v) {
|
|
323
|
+
o(v);
|
|
324
324
|
}
|
|
325
325
|
} : o;
|
|
326
326
|
const s = t;
|
|
327
|
-
s.decode && (s.decode =
|
|
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 =
|
|
330
|
+
async function _e(t, e) {
|
|
331
|
+
const n = j(t.childNodes).map((i) => qt(i, e));
|
|
332
332
|
await Promise.all(n).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
C(t, Element) && (await
|
|
334
|
+
async function qt(t, e) {
|
|
335
|
+
C(t, Element) && (await Ve(t, e), await Be(t, e), await _e(t, e));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function Ne(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;
|
|
341
|
-
return n != null && Object.keys(n).forEach((
|
|
342
|
-
r[
|
|
341
|
+
return n != null && Object.keys(n).forEach((i) => {
|
|
342
|
+
r[i] = n[i];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
async function
|
|
347
|
-
let e =
|
|
345
|
+
const $t = {};
|
|
346
|
+
async function Rt(t) {
|
|
347
|
+
let e = $t[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 }, $t[t] = e, e;
|
|
352
352
|
}
|
|
353
|
-
async function
|
|
353
|
+
async function Lt(t, e) {
|
|
354
354
|
let r = t.cssText;
|
|
355
|
-
const n = /url\(["']?([^"')]+)["']?\)/g,
|
|
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), Vt(s, e.fetchRequestInit, ({ result: l }) => (r = r.replace(o, `url(${l})`), [o, l]));
|
|
358
358
|
});
|
|
359
|
-
return Promise.all(
|
|
359
|
+
return Promise.all(a).then(() => r);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function Pt(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], r = /(\/\*[\s\S]*?\*\/)/gi;
|
|
365
365
|
let n = t.replace(r, "");
|
|
366
|
-
const
|
|
366
|
+
const i = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
367
367
|
for (; ; ) {
|
|
368
|
-
const l =
|
|
368
|
+
const l = i.exec(n);
|
|
369
369
|
if (l === null)
|
|
370
370
|
break;
|
|
371
371
|
e.push(l[0]);
|
|
372
372
|
}
|
|
373
|
-
n = n.replace(
|
|
374
|
-
const
|
|
373
|
+
n = n.replace(i, "");
|
|
374
|
+
const a = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, o = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", s = new RegExp(o, "gi");
|
|
375
375
|
for (; ; ) {
|
|
376
|
-
let l =
|
|
376
|
+
let l = a.exec(n);
|
|
377
377
|
if (l === null) {
|
|
378
378
|
if (l = s.exec(n), l === null)
|
|
379
379
|
break;
|
|
380
|
-
|
|
380
|
+
a.lastIndex = s.lastIndex;
|
|
381
381
|
} else
|
|
382
|
-
s.lastIndex =
|
|
382
|
+
s.lastIndex = a.lastIndex;
|
|
383
383
|
e.push(l[0]);
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function We(t, e) {
|
|
388
388
|
const r = [], n = [];
|
|
389
|
-
return t.forEach((
|
|
390
|
-
if ("cssRules" in
|
|
389
|
+
return t.forEach((i) => {
|
|
390
|
+
if ("cssRules" in i)
|
|
391
391
|
try {
|
|
392
|
-
|
|
393
|
-
if (
|
|
392
|
+
j(i.cssRules || []).forEach((a, o) => {
|
|
393
|
+
if (a.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let s = o + 1;
|
|
395
|
-
const l =
|
|
395
|
+
const l = a.href, v = Rt(l).then((y) => Lt(y, e)).then((y) => Pt(y).forEach((p) => {
|
|
396
396
|
try {
|
|
397
|
-
|
|
397
|
+
i.insertRule(p, p.startsWith("@import") ? s += 1 : i.cssRules.length);
|
|
398
398
|
} catch (g) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
|
-
rule:
|
|
400
|
+
rule: p,
|
|
401
401
|
error: g
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
})).catch((
|
|
405
|
-
console.error("Error loading remote css",
|
|
404
|
+
})).catch((y) => {
|
|
405
|
+
console.error("Error loading remote css", y.toString());
|
|
406
406
|
});
|
|
407
|
-
n.push(
|
|
407
|
+
n.push(v);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
} catch (
|
|
410
|
+
} catch (a) {
|
|
411
411
|
const o = t.find((s) => s.href == null) || document.styleSheets[0];
|
|
412
|
-
|
|
412
|
+
i.href != null && n.push(Rt(i.href).then((s) => Lt(s, e)).then((s) => Pt(s).forEach((l) => {
|
|
413
413
|
o.insertRule(l, o.cssRules.length);
|
|
414
414
|
})).catch((s) => {
|
|
415
415
|
console.error("Error loading remote stylesheet", s);
|
|
416
|
-
})), console.error("Error inlining remote css file",
|
|
416
|
+
})), console.error("Error inlining remote css file", a);
|
|
417
417
|
}
|
|
418
|
-
}), Promise.all(n).then(() => (t.forEach((
|
|
419
|
-
if ("cssRules" in
|
|
418
|
+
}), Promise.all(n).then(() => (t.forEach((i) => {
|
|
419
|
+
if ("cssRules" in i)
|
|
420
420
|
try {
|
|
421
|
-
|
|
422
|
-
r.push(
|
|
421
|
+
j(i.cssRules || []).forEach((a) => {
|
|
422
|
+
r.push(a);
|
|
423
423
|
});
|
|
424
|
-
} catch (
|
|
425
|
-
console.error(`Error while reading CSS rules from ${
|
|
424
|
+
} catch (a) {
|
|
425
|
+
console.error(`Error while reading CSS rules from ${i.href}`, a);
|
|
426
426
|
}
|
|
427
427
|
}), r));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
429
|
+
function qe(t) {
|
|
430
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Nt(e.style.getPropertyValue("src")));
|
|
431
431
|
}
|
|
432
|
-
async function
|
|
432
|
+
async function ze(t, e) {
|
|
433
433
|
if (t.ownerDocument == null)
|
|
434
434
|
throw new Error("Provided element is not within a Document");
|
|
435
|
-
const r =
|
|
436
|
-
return
|
|
435
|
+
const r = j(t.ownerDocument.styleSheets), n = await We(r, e);
|
|
436
|
+
return qe(n);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function zt(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function Ke(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function r(n) {
|
|
444
|
-
(n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((
|
|
445
|
-
e.add(
|
|
446
|
-
}), Array.from(n.children).forEach((
|
|
447
|
-
|
|
444
|
+
(n.style.fontFamily || getComputedStyle(n).fontFamily).split(",").forEach((a) => {
|
|
445
|
+
e.add(zt(a));
|
|
446
|
+
}), Array.from(n.children).forEach((a) => {
|
|
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((
|
|
455
|
-
const o =
|
|
456
|
-
return
|
|
452
|
+
async function Xe(t, e) {
|
|
453
|
+
const r = await ze(t, e), n = Ke(t);
|
|
454
|
+
return (await Promise.all(r.filter((a) => n.has(zt(a.style.fontFamily))).map((a) => {
|
|
455
|
+
const o = a.parentStyleSheet ? a.parentStyleSheet.href : null;
|
|
456
|
+
return Wt(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 Ye(t, e) {
|
|
461
|
+
const r = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Xe(t, e);
|
|
462
462
|
if (r) {
|
|
463
|
-
const n = document.createElement("style"),
|
|
464
|
-
n.appendChild(
|
|
463
|
+
const n = document.createElement("style"), i = document.createTextNode(r);
|
|
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 Ge(t, e = {}) {
|
|
468
|
+
const { width: r, height: n } = Ut(t, e), i = await tt(t, e, !0);
|
|
469
|
+
return await Ye(i, e), await qt(i, e), Ne(i, e), await he(i, r, n);
|
|
470
470
|
}
|
|
471
|
-
async function
|
|
472
|
-
const { width: r, height: n } =
|
|
473
|
-
return o.width =
|
|
471
|
+
async function Je(t, e = {}) {
|
|
472
|
+
const { width: r, height: n } = Ut(t, e), i = await Ge(t, e), a = await Y(i), o = document.createElement("canvas"), s = o.getContext("2d"), l = e.pixelRatio || ue(), v = e.canvasWidth || r, y = e.canvasHeight || n;
|
|
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;
|
|
474
474
|
}
|
|
475
|
-
async function
|
|
476
|
-
return (await
|
|
475
|
+
async function Ze(t, e = {}) {
|
|
476
|
+
return (await Je(t, e)).toDataURL();
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Qe() {
|
|
479
479
|
const t = [];
|
|
480
480
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((r) => {
|
|
481
|
-
const n = r.getBoundingClientRect(),
|
|
482
|
-
|
|
481
|
+
const n = r.getBoundingClientRect(), i = document.createElement("div");
|
|
482
|
+
i.setAttribute("data-nf-mask-cover", "1"), i.style.cssText = [
|
|
483
483
|
"position:fixed",
|
|
484
484
|
`left:${n.left}px`,
|
|
485
485
|
`top:${n.top}px`,
|
|
@@ -488,16 +488,16 @@ function Ge() {
|
|
|
488
488
|
"background:#111",
|
|
489
489
|
"z-index:2147483646",
|
|
490
490
|
"pointer-events:none"
|
|
491
|
-
].join(";"), document.body.appendChild(
|
|
491
|
+
].join(";"), document.body.appendChild(i), t.push(i);
|
|
492
492
|
}), () => t.forEach((r) => r.remove());
|
|
493
493
|
}
|
|
494
|
-
async function
|
|
494
|
+
async function tn() {
|
|
495
495
|
const t = document.getElementById("notefully"), e = t ? t.style.display : "";
|
|
496
496
|
t && (t.style.display = "none");
|
|
497
|
-
const r =
|
|
497
|
+
const r = Qe();
|
|
498
498
|
await new Promise((n) => requestAnimationFrame(() => requestAnimationFrame(n)));
|
|
499
499
|
try {
|
|
500
|
-
return await
|
|
500
|
+
return await Ze(document.body, {
|
|
501
501
|
cacheBust: !0,
|
|
502
502
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
503
503
|
filter: (n) => n instanceof Element ? n.id !== "notefully" && !n.hasAttribute("data-nf-mask-cover") : !0
|
|
@@ -506,7 +506,7 @@ async function Ye() {
|
|
|
506
506
|
r(), t && (t.style.display = e);
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
function
|
|
509
|
+
function en(t = {}) {
|
|
510
510
|
return {
|
|
511
511
|
url: location.href,
|
|
512
512
|
title: document.title,
|
|
@@ -525,11 +525,65 @@ function Ke(t = {}) {
|
|
|
525
525
|
}
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
const
|
|
529
|
-
|
|
528
|
+
const kt = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Tt = {
|
|
529
|
+
id: "userId",
|
|
530
|
+
username: "displayName",
|
|
531
|
+
name: "displayName"
|
|
532
|
+
}, At = /* @__PURE__ */ new Set([
|
|
533
|
+
"endpoint",
|
|
534
|
+
"projectKey",
|
|
535
|
+
"version",
|
|
536
|
+
"slug",
|
|
537
|
+
"targets",
|
|
538
|
+
"hideLauncher",
|
|
539
|
+
"theme",
|
|
540
|
+
"video"
|
|
541
|
+
]), It = {
|
|
542
|
+
projectSlug: "Use init({ slug }) for a per-app report prefix. projectSlug is not a widget option.",
|
|
543
|
+
project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project name option on the widget.",
|
|
544
|
+
username: "Pass people via Notefully.identify({ displayName }) (username is an identify alias), not init().",
|
|
545
|
+
userId: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
546
|
+
email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
547
|
+
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
548
|
+
name: "Pass people via Notefully.identify({ displayName }) (name is an identify alias), not init()."
|
|
549
|
+
};
|
|
550
|
+
function nn(t = {}, e = {}) {
|
|
551
|
+
const r = e.warn || Kt, n = t && typeof t == "object" ? t : {}, i = {}, a = [];
|
|
552
|
+
for (const o of kt)
|
|
553
|
+
Object.prototype.hasOwnProperty.call(n, o) && (i[o] = n[o]);
|
|
554
|
+
for (const [o, s] of Object.entries(Tt))
|
|
555
|
+
Object.prototype.hasOwnProperty.call(n, o) && (Object.prototype.hasOwnProperty.call(i, s) || (i[s] = n[o]));
|
|
556
|
+
for (const o of Object.keys(n))
|
|
557
|
+
kt.has(o) || Object.prototype.hasOwnProperty.call(Tt, o) || a.push(o);
|
|
558
|
+
if (a.length) {
|
|
559
|
+
const o = a.some((s) => s === "slug" || s === "projectSlug") ? " Pass report slug via Notefully.init({ slug }), not identify()." : "";
|
|
560
|
+
r(
|
|
561
|
+
`Notefully.identify: ignoring unknown key(s): ${a.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` + o
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
return i;
|
|
565
|
+
}
|
|
566
|
+
function rn(t = {}, e = {}) {
|
|
567
|
+
const r = e.warn || Kt, n = t && typeof t == "object" ? t : {}, i = Object.keys(n).filter((a) => !At.has(a));
|
|
568
|
+
if (i.length)
|
|
569
|
+
for (const a of i) {
|
|
570
|
+
if (It[a]) {
|
|
571
|
+
r(`Notefully.init: ignoring "${a}". ${It[a]}`);
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
r(
|
|
575
|
+
`Notefully.init: ignoring unknown key "${a}". Supported: ${[...At].join(", ")}.`
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function Kt(t) {
|
|
580
|
+
typeof console < "u" && typeof console.warn == "function" && console.warn(t);
|
|
581
|
+
}
|
|
582
|
+
const an = 80;
|
|
583
|
+
function on() {
|
|
530
584
|
const t = [], e = {};
|
|
531
585
|
let r = !1;
|
|
532
|
-
const n = (
|
|
586
|
+
const n = (a, o) => {
|
|
533
587
|
let s = "";
|
|
534
588
|
try {
|
|
535
589
|
s = o.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
|
|
@@ -537,21 +591,21 @@ function Ze() {
|
|
|
537
591
|
s = String(o[0]);
|
|
538
592
|
}
|
|
539
593
|
t.push({
|
|
540
|
-
level:
|
|
594
|
+
level: a,
|
|
541
595
|
text: s.slice(0, 2e3),
|
|
542
596
|
at: Date.now()
|
|
543
|
-
}), t.length >
|
|
597
|
+
}), t.length > an && t.shift();
|
|
544
598
|
};
|
|
545
599
|
return {
|
|
546
600
|
hook: () => {
|
|
547
|
-
r || typeof window > "u" || (r = !0, ["log", "info", "warn", "error"].forEach((
|
|
548
|
-
e[
|
|
549
|
-
n(
|
|
601
|
+
r || typeof window > "u" || (r = !0, ["log", "info", "warn", "error"].forEach((a) => {
|
|
602
|
+
e[a] = console[a].bind(console), console[a] = (...o) => {
|
|
603
|
+
n(a, o), e[a](...o);
|
|
550
604
|
};
|
|
551
|
-
}), window.addEventListener("error", (
|
|
552
|
-
n("error", [
|
|
553
|
-
}), window.addEventListener("unhandledrejection", (
|
|
554
|
-
n("error", [
|
|
605
|
+
}), window.addEventListener("error", (a) => {
|
|
606
|
+
n("error", [a.message || "window.error"]);
|
|
607
|
+
}), window.addEventListener("unhandledrejection", (a) => {
|
|
608
|
+
n("error", [a.reason || "unhandledrejection"]);
|
|
555
609
|
}));
|
|
556
610
|
},
|
|
557
611
|
snapshot() {
|
|
@@ -559,10 +613,10 @@ function Ze() {
|
|
|
559
613
|
}
|
|
560
614
|
};
|
|
561
615
|
}
|
|
562
|
-
function
|
|
616
|
+
function sn(t) {
|
|
563
617
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
564
618
|
let r = null, n = !1;
|
|
565
|
-
const
|
|
619
|
+
const i = () => {
|
|
566
620
|
if (n = !1, r)
|
|
567
621
|
try {
|
|
568
622
|
r.stop();
|
|
@@ -573,7 +627,7 @@ function Ne(t) {
|
|
|
573
627
|
start: () => {
|
|
574
628
|
if (!e)
|
|
575
629
|
throw new Error("Speech recognition is not supported in this browser.");
|
|
576
|
-
return n ? (
|
|
630
|
+
return n ? (i(), !1) : (r = new e(), r.continuous = !0, r.interimResults = !0, r.lang = navigator.language || "en-US", r.onresult = (o) => {
|
|
577
631
|
let s = "";
|
|
578
632
|
for (let l = o.resultIndex; l < o.results.length; l += 1)
|
|
579
633
|
o.results[l].isFinal && (s += o.results[l][0].transcript);
|
|
@@ -584,48 +638,48 @@ function Ne(t) {
|
|
|
584
638
|
n = !1;
|
|
585
639
|
}, r.start(), n = !0, !0);
|
|
586
640
|
},
|
|
587
|
-
stop:
|
|
641
|
+
stop: i,
|
|
588
642
|
isSupported: () => !!e,
|
|
589
643
|
isActive: () => n
|
|
590
644
|
};
|
|
591
645
|
}
|
|
592
|
-
const
|
|
593
|
-
function
|
|
594
|
-
let n = null,
|
|
646
|
+
const cn = 60 * 1e3;
|
|
647
|
+
function ln({ onStart: t, onStop: e, onError: r }) {
|
|
648
|
+
let n = null, i = null, a = [], o = null;
|
|
595
649
|
const s = () => {
|
|
596
|
-
if (o && (clearTimeout(o), o = null),
|
|
650
|
+
if (o && (clearTimeout(o), o = null), i && i.state !== "inactive")
|
|
597
651
|
try {
|
|
598
|
-
|
|
652
|
+
i.stop();
|
|
599
653
|
} catch {
|
|
600
654
|
}
|
|
601
|
-
n && (n.getTracks().forEach((
|
|
655
|
+
n && (n.getTracks().forEach((y) => y.stop()), n = null);
|
|
602
656
|
}, l = () => {
|
|
603
|
-
if (
|
|
604
|
-
|
|
657
|
+
if (i && i.state === "recording") {
|
|
658
|
+
i.stop();
|
|
605
659
|
return;
|
|
606
660
|
}
|
|
607
661
|
s(), e(null);
|
|
608
662
|
};
|
|
609
663
|
return { start: async () => {
|
|
610
|
-
var
|
|
611
|
-
if (!((
|
|
664
|
+
var y, p;
|
|
665
|
+
if (!((y = navigator.mediaDevices) != null && y.getDisplayMedia))
|
|
612
666
|
throw new Error("Screen recording is not supported in this browser.");
|
|
613
667
|
n = await navigator.mediaDevices.getDisplayMedia({
|
|
614
668
|
video: { displaySurface: "browser" },
|
|
615
669
|
audio: !1,
|
|
616
670
|
preferCurrentTab: !0,
|
|
617
671
|
selfBrowserSurface: "include"
|
|
618
|
-
}),
|
|
672
|
+
}), a = [], i = new MediaRecorder(n, {
|
|
619
673
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
620
|
-
}),
|
|
621
|
-
g.data && g.data.size &&
|
|
622
|
-
},
|
|
623
|
-
const g =
|
|
674
|
+
}), i.ondataavailable = (g) => {
|
|
675
|
+
g.data && g.data.size && a.push(g.data);
|
|
676
|
+
}, i.onstop = () => {
|
|
677
|
+
const g = a.length ? new Blob(a, { type: i.mimeType || "video/webm" }) : null;
|
|
624
678
|
s(), e(g);
|
|
625
|
-
}, (
|
|
679
|
+
}, (p = n.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, cn);
|
|
626
680
|
}, stop: l };
|
|
627
681
|
}
|
|
628
|
-
function
|
|
682
|
+
function un() {
|
|
629
683
|
const t = /* @__PURE__ */ new Set();
|
|
630
684
|
return {
|
|
631
685
|
alloc() {
|
|
@@ -643,83 +697,83 @@ function en() {
|
|
|
643
697
|
}
|
|
644
698
|
};
|
|
645
699
|
}
|
|
646
|
-
const
|
|
647
|
-
function
|
|
648
|
-
const t =
|
|
649
|
-
let e = [], r = { ...
|
|
700
|
+
const ot = { x: 0, y: 0, w: 1, h: 1 };
|
|
701
|
+
function Xt() {
|
|
702
|
+
const t = un();
|
|
703
|
+
let e = [], r = { ...ot }, n = 1;
|
|
650
704
|
return {
|
|
651
|
-
list: () => e.filter((
|
|
705
|
+
list: () => e.filter((a) => fn(a, r)),
|
|
652
706
|
all: () => e.slice(),
|
|
653
707
|
crop: () => ({ ...r }),
|
|
654
|
-
setCrop(
|
|
655
|
-
return r =
|
|
708
|
+
setCrop(a) {
|
|
709
|
+
return r = dn(a), r;
|
|
656
710
|
},
|
|
657
711
|
resetCrop() {
|
|
658
|
-
return r = { ...
|
|
712
|
+
return r = { ...ot }, r;
|
|
659
713
|
},
|
|
660
714
|
isCropped() {
|
|
661
715
|
return r.x > 1e-6 || r.y > 1e-6 || r.w < 1 - 1e-6 || r.h < 1 - 1e-6;
|
|
662
716
|
},
|
|
663
|
-
add(
|
|
717
|
+
add(a, o) {
|
|
664
718
|
const s = {
|
|
665
719
|
id: `s${n++}`,
|
|
666
|
-
type:
|
|
720
|
+
type: a,
|
|
667
721
|
number: t.alloc(),
|
|
668
722
|
x: 0.2,
|
|
669
723
|
y: 0.2,
|
|
670
|
-
w:
|
|
671
|
-
h:
|
|
724
|
+
w: a === "arrow" ? 0.2 : 0.22,
|
|
725
|
+
h: a === "arrow" ? 0.05 : 0.16,
|
|
672
726
|
x2: 0.4,
|
|
673
727
|
y2: 0.28,
|
|
674
728
|
...o
|
|
675
729
|
};
|
|
676
730
|
return e.push(s), s;
|
|
677
731
|
},
|
|
678
|
-
update(
|
|
679
|
-
const s = e.find((l) => l.id ===
|
|
732
|
+
update(a, o) {
|
|
733
|
+
const s = e.find((l) => l.id === a);
|
|
680
734
|
return s ? (Object.assign(s, o), s) : null;
|
|
681
735
|
},
|
|
682
|
-
remove(
|
|
683
|
-
const o = e.findIndex((l) => l.id ===
|
|
736
|
+
remove(a) {
|
|
737
|
+
const o = e.findIndex((l) => l.id === a);
|
|
684
738
|
if (o < 0)
|
|
685
739
|
return null;
|
|
686
740
|
const [s] = e.splice(o, 1);
|
|
687
741
|
return t.free(s.number), s;
|
|
688
742
|
},
|
|
689
743
|
reset() {
|
|
690
|
-
for (e = [], r = { ...
|
|
744
|
+
for (e = [], r = { ...ot }, n = 1; t.peekUsed().length; )
|
|
691
745
|
t.free(t.peekUsed()[0]);
|
|
692
746
|
}
|
|
693
747
|
};
|
|
694
748
|
}
|
|
695
|
-
function
|
|
696
|
-
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),
|
|
697
|
-
return { x: e, y: r, w: n, h:
|
|
749
|
+
function dn(t) {
|
|
750
|
+
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
|
+
return { x: e, y: r, w: n, h: i };
|
|
698
752
|
}
|
|
699
|
-
function
|
|
753
|
+
function fn(t, e) {
|
|
700
754
|
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;
|
|
701
755
|
return r >= e.x && n >= e.y && r <= e.x + e.w && n <= e.y + e.h;
|
|
702
756
|
}
|
|
703
|
-
function
|
|
704
|
-
const
|
|
757
|
+
function hn(t, e, r, n = {}) {
|
|
758
|
+
const i = n.mark || "#fdd341", a = n.markText || "#2a2140";
|
|
705
759
|
return new Promise((o, s) => {
|
|
706
760
|
const l = new Image();
|
|
707
761
|
l.onload = () => {
|
|
708
|
-
const
|
|
709
|
-
P.width =
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
const
|
|
762
|
+
const v = Math.round(e.x * l.width), y = Math.round(e.y * l.height), p = Math.max(1, Math.round(e.w * l.width)), g = Math.max(1, Math.round(e.h * l.height)), P = document.createElement("canvas");
|
|
763
|
+
P.width = p, P.height = g;
|
|
764
|
+
const f = P.getContext("2d");
|
|
765
|
+
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 k = lt(m.x, e, p), T = ut(m.y, e, g), A = m.w / e.w * p, U = m.h / e.h * g;
|
|
713
767
|
if (m.type === "rect")
|
|
714
|
-
|
|
768
|
+
f.strokeRect(k, T, A, U);
|
|
715
769
|
else if (m.type === "circle")
|
|
716
|
-
|
|
770
|
+
f.beginPath(), f.ellipse(k + A / 2, T + U / 2, A / 2, U / 2, 0, 0, Math.PI * 2), f.stroke();
|
|
717
771
|
else if (m.type === "arrow") {
|
|
718
|
-
const
|
|
719
|
-
|
|
772
|
+
const ie = lt(m.x2 ?? m.x + m.w, e, p), ae = ut(m.y2 ?? m.y, e, g);
|
|
773
|
+
mn(f, k, T, ie, ae);
|
|
720
774
|
}
|
|
721
|
-
const
|
|
722
|
-
|
|
775
|
+
const V = pn(m, e, p, g, k, T, A), I = String(m.number);
|
|
776
|
+
f.beginPath(), f.arc(V.x, V.y, 11, 0, Math.PI * 2), f.fill(), f.fillStyle = a, f.textAlign = "center", f.textBaseline = "middle", f.fillText(I, V.x, V.y), f.fillStyle = i;
|
|
723
777
|
}), P.toBlob((m) => {
|
|
724
778
|
if (!m) {
|
|
725
779
|
s(new Error("Could not encode screenshot"));
|
|
@@ -730,27 +784,27 @@ function an(t, e, r, n = {}) {
|
|
|
730
784
|
}, l.onerror = () => s(new Error("Could not load screenshot")), l.src = t;
|
|
731
785
|
});
|
|
732
786
|
}
|
|
733
|
-
function
|
|
787
|
+
function lt(t, e, r) {
|
|
734
788
|
return (t - e.x) / e.w * r;
|
|
735
789
|
}
|
|
736
|
-
function
|
|
790
|
+
function ut(t, e, r) {
|
|
737
791
|
return (t - e.y) / e.h * r;
|
|
738
792
|
}
|
|
739
|
-
function
|
|
793
|
+
function pn(t, e, r, n, i, a, o) {
|
|
740
794
|
if (t.type === "arrow") {
|
|
741
|
-
const s =
|
|
795
|
+
const s = lt(t.x2 ?? t.x + t.w, e, r), l = ut(t.y2 ?? t.y, e, n);
|
|
742
796
|
return {
|
|
743
|
-
x: (
|
|
744
|
-
y: (
|
|
797
|
+
x: (i + s) / 2,
|
|
798
|
+
y: (a + l) / 2
|
|
745
799
|
};
|
|
746
800
|
}
|
|
747
|
-
return { x:
|
|
801
|
+
return { x: i + o / 2, y: a };
|
|
748
802
|
}
|
|
749
|
-
function
|
|
750
|
-
const
|
|
751
|
-
t.beginPath(), t.moveTo(e, r), t.lineTo(l,
|
|
803
|
+
function mn(t, e, r, n, i) {
|
|
804
|
+
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
|
+
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();
|
|
752
806
|
}
|
|
753
|
-
const
|
|
807
|
+
const yn = ["bug", "idea", "other"], gn = ["maker", "all-business", "brighter-day", "quiet-night"], Yt = "maker", wn = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), dt = 0.02, Dt = 0.05, bn = `
|
|
754
808
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
755
809
|
<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"/>
|
|
756
810
|
<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"/>
|
|
@@ -768,35 +822,36 @@ const F = {
|
|
|
768
822
|
discard: D('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
769
823
|
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"/>'),
|
|
770
824
|
video: D('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
771
|
-
},
|
|
772
|
-
|
|
773
|
-
let
|
|
825
|
+
}, Gt = on();
|
|
826
|
+
Gt.hook();
|
|
827
|
+
let d = {
|
|
774
828
|
endpoint: "",
|
|
775
829
|
projectKey: "",
|
|
776
830
|
version: "0.0.0",
|
|
831
|
+
slug: "",
|
|
777
832
|
targets: null,
|
|
778
833
|
hideLauncher: !1,
|
|
779
|
-
theme:
|
|
834
|
+
theme: Yt,
|
|
780
835
|
video: !1
|
|
781
|
-
},
|
|
836
|
+
}, ft = {}, u = null, c = {}, h = Xt(), S = "", q = "", L = null, G = "bug", H = null, R = null, b = null, w = null, K = null, B = null, W = null, O = { w: 0, h: 0 };
|
|
782
837
|
function E(t) {
|
|
783
838
|
return u.querySelector(t);
|
|
784
839
|
}
|
|
785
|
-
function
|
|
840
|
+
function Jt(t) {
|
|
786
841
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
787
|
-
return
|
|
842
|
+
return gn.includes(e) ? e : Yt;
|
|
788
843
|
}
|
|
789
|
-
function
|
|
844
|
+
function Ft(t, e) {
|
|
790
845
|
return u && getComputedStyle(u).getPropertyValue(t).trim() || e;
|
|
791
846
|
}
|
|
792
|
-
function
|
|
793
|
-
c.status && (c.status.textContent = t || "",
|
|
847
|
+
function x(t, e = !1) {
|
|
848
|
+
c.status && (c.status.textContent = t || "", K && (clearTimeout(K), K = null), t && !e && (K = setTimeout(() => {
|
|
794
849
|
c.status.textContent = "";
|
|
795
850
|
}, 4e3)));
|
|
796
851
|
}
|
|
797
|
-
function
|
|
852
|
+
function vt() {
|
|
798
853
|
return u && document.body.contains(u) || (u = document.createElement("div"), u.id = "notefully", u.innerHTML = `
|
|
799
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
854
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${bn}</button>
|
|
800
855
|
<div class="nf-dialog" hidden>
|
|
801
856
|
<div class="nf-panel">
|
|
802
857
|
<div class="nf-stage">
|
|
@@ -840,209 +895,213 @@ function bt() {
|
|
|
840
895
|
stop: E(".nf-stop-video"),
|
|
841
896
|
resetCrop: E(".nf-reset-crop"),
|
|
842
897
|
shot: null
|
|
843
|
-
},
|
|
898
|
+
}, vn(), et()), u;
|
|
899
|
+
}
|
|
900
|
+
function et() {
|
|
901
|
+
var t;
|
|
902
|
+
u && (u.dataset.theme = Jt(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 && J());
|
|
844
903
|
}
|
|
845
|
-
function
|
|
846
|
-
|
|
904
|
+
function J() {
|
|
905
|
+
c.launcher && (c.launcher.hidden = !!d.hideLauncher);
|
|
847
906
|
}
|
|
848
|
-
function
|
|
849
|
-
c.launcher.addEventListener("click", () =>
|
|
850
|
-
t.target === c.dialog &&
|
|
907
|
+
function vn() {
|
|
908
|
+
c.launcher.addEventListener("click", () => ee()), E(".nf-dialog").addEventListener("click", (t) => {
|
|
909
|
+
t.target === c.dialog && it();
|
|
851
910
|
}), u.querySelectorAll(".nf-tool").forEach((t) => {
|
|
852
|
-
t.addEventListener("click", () =>
|
|
853
|
-
}), c.resetCrop.addEventListener("click",
|
|
854
|
-
t.addEventListener("click", () =>
|
|
855
|
-
}), c.discard.addEventListener("click",
|
|
856
|
-
|
|
857
|
-
}),
|
|
858
|
-
}
|
|
859
|
-
function ft(t) {
|
|
860
|
-
J = cn.includes(t) ? t : "bug", u.querySelectorAll("[data-kind]").forEach((e) => {
|
|
861
|
-
e.dataset.active = String(e.dataset.kind === J);
|
|
862
|
-
});
|
|
911
|
+
t.addEventListener("click", () => pt(t.dataset.tool));
|
|
912
|
+
}), c.resetCrop.addEventListener("click", Rn), c.canvas.addEventListener("pointerdown", Sn), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), u.querySelectorAll("[data-kind]").forEach((t) => {
|
|
913
|
+
t.addEventListener("click", () => ht(t.dataset.kind));
|
|
914
|
+
}), c.discard.addEventListener("click", Ln), c.restore.addEventListener("click", Pn), c.audio.addEventListener("click", kn), c.video.addEventListener("click", Tn), c.stop.addEventListener("click", () => W == null ? void 0 : W.stop()), E(".nf-submit").addEventListener("click", () => {
|
|
915
|
+
ne().catch((t) => x(t.message || "Submit failed."));
|
|
916
|
+
}), ht("bug"), pt(null);
|
|
863
917
|
}
|
|
864
918
|
function ht(t) {
|
|
865
|
-
|
|
866
|
-
e.dataset.active = String(e.dataset.
|
|
867
|
-
})
|
|
919
|
+
G = yn.includes(t) ? t : "bug", u.querySelectorAll("[data-kind]").forEach((e) => {
|
|
920
|
+
e.dataset.active = String(e.dataset.kind === G);
|
|
921
|
+
});
|
|
868
922
|
}
|
|
869
|
-
function
|
|
923
|
+
function pt(t) {
|
|
924
|
+
H = wn.has(t) ? t : null, R = null, u.querySelectorAll(".nf-tool").forEach((e) => {
|
|
925
|
+
e.dataset.active = String(e.dataset.tool === H);
|
|
926
|
+
}), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), S && $();
|
|
927
|
+
}
|
|
928
|
+
function Ot(t) {
|
|
870
929
|
return Math.min(1, Math.max(0, t));
|
|
871
930
|
}
|
|
872
|
-
function
|
|
931
|
+
function nt() {
|
|
873
932
|
return c.shot || c.canvas;
|
|
874
933
|
}
|
|
875
934
|
function Z(t) {
|
|
876
|
-
const e =
|
|
935
|
+
const e = nt().getBoundingClientRect();
|
|
877
936
|
return {
|
|
878
|
-
x:
|
|
879
|
-
y:
|
|
937
|
+
x: Ot((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
938
|
+
y: Ot((t.clientY - e.top) / Math.max(e.height, 1))
|
|
880
939
|
};
|
|
881
940
|
}
|
|
882
|
-
function
|
|
883
|
-
const e =
|
|
941
|
+
function xn(t) {
|
|
942
|
+
const e = nt().getBoundingClientRect();
|
|
884
943
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
885
944
|
}
|
|
886
|
-
function
|
|
887
|
-
const e = Z(t), r =
|
|
945
|
+
function Zt(t) {
|
|
946
|
+
const e = Z(t), r = h.crop();
|
|
888
947
|
return {
|
|
889
948
|
x: r.x + e.x * r.w,
|
|
890
949
|
y: r.y + e.y * r.h
|
|
891
950
|
};
|
|
892
951
|
}
|
|
893
|
-
function
|
|
952
|
+
function rt(t, e) {
|
|
894
953
|
const r = Math.min(t.x, e.x), n = Math.min(t.y, e.y);
|
|
895
954
|
return {
|
|
896
955
|
x: r,
|
|
897
956
|
y: n,
|
|
898
|
-
w: Math.max(
|
|
899
|
-
h: Math.max(
|
|
957
|
+
w: Math.max(dt, Math.abs(e.x - t.x)),
|
|
958
|
+
h: Math.max(dt, Math.abs(e.y - t.y))
|
|
900
959
|
};
|
|
901
960
|
}
|
|
902
961
|
function xt(t) {
|
|
903
962
|
u && (t ? u.dataset.grabbing = "true" : delete u.dataset.grabbing);
|
|
904
963
|
}
|
|
905
|
-
function
|
|
964
|
+
function st(t) {
|
|
906
965
|
try {
|
|
907
966
|
c.canvas.setPointerCapture(t.pointerId);
|
|
908
967
|
} catch {
|
|
909
968
|
}
|
|
910
969
|
}
|
|
911
970
|
function mt() {
|
|
912
|
-
window.addEventListener("pointermove",
|
|
971
|
+
window.addEventListener("pointermove", te), window.addEventListener("pointerup", Q), window.addEventListener("pointercancel", Q);
|
|
913
972
|
}
|
|
914
|
-
function
|
|
915
|
-
window.removeEventListener("pointermove",
|
|
973
|
+
function Qt() {
|
|
974
|
+
window.removeEventListener("pointermove", te), window.removeEventListener("pointerup", Q), window.removeEventListener("pointercancel", Q);
|
|
916
975
|
}
|
|
917
|
-
function
|
|
976
|
+
function Sn(t) {
|
|
918
977
|
if (t.button !== 0 || !S)
|
|
919
978
|
return;
|
|
920
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
979
|
+
if (!t.target.closest(".nf-sticker") && !xn(t)) {
|
|
921
980
|
R = null, $();
|
|
922
981
|
return;
|
|
923
982
|
}
|
|
924
983
|
const e = t.target.closest(".nf-handle"), r = t.target.closest(".nf-sticker");
|
|
925
984
|
if (r && r.dataset.preview !== "true") {
|
|
926
|
-
t.preventDefault(), t.stopPropagation(), R = r.dataset.id,
|
|
985
|
+
t.preventDefault(), t.stopPropagation(), R = r.dataset.id, st(t), En({
|
|
927
986
|
kind: "sticker",
|
|
928
987
|
id: R,
|
|
929
988
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
930
989
|
}, t), $();
|
|
931
990
|
return;
|
|
932
991
|
}
|
|
933
|
-
if (R = null,
|
|
934
|
-
t.preventDefault(),
|
|
992
|
+
if (R = null, H === "crop") {
|
|
993
|
+
t.preventDefault(), st(t), b = { kind: "crop", start: Z(t), current: Z(t) }, mt(), $();
|
|
935
994
|
return;
|
|
936
995
|
}
|
|
937
|
-
if (
|
|
938
|
-
t.preventDefault(),
|
|
939
|
-
const n =
|
|
940
|
-
|
|
996
|
+
if (H === "arrow" || H === "rect" || H === "circle") {
|
|
997
|
+
t.preventDefault(), st(t);
|
|
998
|
+
const n = Zt(t);
|
|
999
|
+
b = { kind: "sticker", type: H, start: n, current: n }, mt(), $();
|
|
941
1000
|
return;
|
|
942
1001
|
}
|
|
943
1002
|
$();
|
|
944
1003
|
}
|
|
945
|
-
function
|
|
1004
|
+
function En(t, e) {
|
|
946
1005
|
e.preventDefault(), e.stopPropagation();
|
|
947
|
-
const r =
|
|
948
|
-
|
|
1006
|
+
const r = nt().getBoundingClientRect(), n = h.list().find((i) => i.id === t.id);
|
|
1007
|
+
w = {
|
|
949
1008
|
...t,
|
|
950
1009
|
startX: e.clientX,
|
|
951
1010
|
startY: e.clientY,
|
|
952
|
-
crop:
|
|
1011
|
+
crop: h.crop(),
|
|
953
1012
|
sticker: n ? { ...n } : null,
|
|
954
1013
|
rect: r
|
|
955
1014
|
}, xt(t.dir === "move" || t.dir === "start" || t.dir === "end"), mt();
|
|
956
1015
|
}
|
|
957
|
-
function
|
|
958
|
-
if (
|
|
959
|
-
|
|
1016
|
+
function te(t) {
|
|
1017
|
+
if (b) {
|
|
1018
|
+
b.current = b.kind === "crop" ? Z(t) : Zt(t), $();
|
|
960
1019
|
return;
|
|
961
1020
|
}
|
|
962
|
-
if (!
|
|
1021
|
+
if (!w)
|
|
963
1022
|
return;
|
|
964
|
-
const e = (t.clientX -
|
|
1023
|
+
const e = (t.clientX - w.startX) / w.rect.width * w.crop.w, r = (t.clientY - w.startY) / w.rect.height * w.crop.h, n = w.sticker;
|
|
965
1024
|
if (n) {
|
|
966
|
-
if (
|
|
967
|
-
|
|
1025
|
+
if (w.dir === "end")
|
|
1026
|
+
h.update(n.id, {
|
|
968
1027
|
x2: n.x2 + e,
|
|
969
1028
|
y2: n.y2 + r
|
|
970
1029
|
});
|
|
971
|
-
else if (
|
|
972
|
-
|
|
1030
|
+
else if (w.dir === "start")
|
|
1031
|
+
h.update(n.id, {
|
|
973
1032
|
x: n.x + e,
|
|
974
1033
|
y: n.y + r
|
|
975
1034
|
});
|
|
976
|
-
else if (
|
|
977
|
-
|
|
1035
|
+
else if (w.dir === "move")
|
|
1036
|
+
h.update(n.id, {
|
|
978
1037
|
x: n.x + e,
|
|
979
1038
|
y: n.y + r,
|
|
980
1039
|
x2: (n.x2 || n.x) + e,
|
|
981
1040
|
y2: (n.y2 || n.y) + r
|
|
982
1041
|
});
|
|
983
1042
|
else {
|
|
984
|
-
const
|
|
985
|
-
|
|
1043
|
+
const i = { x: n.x, y: n.y, w: n.w, h: n.h };
|
|
1044
|
+
Cn(i, w.dir, e, r), h.update(n.id, i);
|
|
986
1045
|
}
|
|
987
1046
|
$();
|
|
988
1047
|
}
|
|
989
1048
|
}
|
|
990
|
-
function
|
|
1049
|
+
function Cn(t, e, r, n) {
|
|
991
1050
|
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")) {
|
|
992
|
-
const
|
|
993
|
-
t.x += t.w -
|
|
1051
|
+
const i = Math.max(0.04, t.w - r);
|
|
1052
|
+
t.x += t.w - i, t.w = i;
|
|
994
1053
|
}
|
|
995
1054
|
if (e.includes("n")) {
|
|
996
|
-
const
|
|
997
|
-
t.y += t.h -
|
|
1055
|
+
const i = Math.max(0.04, t.h - n);
|
|
1056
|
+
t.y += t.h - i, t.h = i;
|
|
998
1057
|
}
|
|
999
1058
|
}
|
|
1000
|
-
function
|
|
1001
|
-
if (
|
|
1002
|
-
|
|
1059
|
+
function Q(t) {
|
|
1060
|
+
if (Qt(), xt(!1), b) {
|
|
1061
|
+
Mn();
|
|
1003
1062
|
return;
|
|
1004
1063
|
}
|
|
1005
|
-
if (
|
|
1006
|
-
if (
|
|
1064
|
+
if (w) {
|
|
1065
|
+
if (w.kind === "sticker") {
|
|
1007
1066
|
const e = c.canvas.getBoundingClientRect();
|
|
1008
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (
|
|
1067
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (h.remove(w.id), R = null);
|
|
1009
1068
|
}
|
|
1010
|
-
|
|
1069
|
+
w = null, $();
|
|
1011
1070
|
}
|
|
1012
1071
|
}
|
|
1013
|
-
function
|
|
1014
|
-
const t =
|
|
1015
|
-
if (
|
|
1072
|
+
function Mn() {
|
|
1073
|
+
const t = b;
|
|
1074
|
+
if (b = null, !t)
|
|
1016
1075
|
return;
|
|
1017
1076
|
if (t.kind === "crop") {
|
|
1018
|
-
const r =
|
|
1019
|
-
if (Math.abs(t.current.x - t.start.x) <
|
|
1077
|
+
const r = rt(t.start, t.current);
|
|
1078
|
+
if (Math.abs(t.current.x - t.start.x) < Dt || Math.abs(t.current.y - t.start.y) < Dt) {
|
|
1020
1079
|
$();
|
|
1021
1080
|
return;
|
|
1022
1081
|
}
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
x:
|
|
1026
|
-
y:
|
|
1027
|
-
w: r.w *
|
|
1028
|
-
h: r.h *
|
|
1029
|
-
}),
|
|
1082
|
+
const i = h.crop();
|
|
1083
|
+
h.setCrop({
|
|
1084
|
+
x: i.x + r.x * i.w,
|
|
1085
|
+
y: i.y + r.y * i.h,
|
|
1086
|
+
w: r.w * i.w,
|
|
1087
|
+
h: r.h * i.h
|
|
1088
|
+
}), z();
|
|
1030
1089
|
return;
|
|
1031
1090
|
}
|
|
1032
|
-
const e =
|
|
1091
|
+
const e = $n(t);
|
|
1033
1092
|
e && (R = e.id), $();
|
|
1034
1093
|
}
|
|
1035
|
-
function
|
|
1094
|
+
function $n(t) {
|
|
1036
1095
|
if (t.type === "arrow") {
|
|
1037
1096
|
const e = t.current.x - t.start.x, r = t.current.y - t.start.y;
|
|
1038
|
-
return Math.hypot(e, r) <
|
|
1097
|
+
return Math.hypot(e, r) < dt ? h.add("arrow", {
|
|
1039
1098
|
x: t.start.x,
|
|
1040
1099
|
y: t.start.y,
|
|
1041
1100
|
x2: t.start.x + 0.12,
|
|
1042
1101
|
y2: t.start.y,
|
|
1043
1102
|
w: 0.12,
|
|
1044
1103
|
h: 0.02
|
|
1045
|
-
}) :
|
|
1104
|
+
}) : h.add("arrow", {
|
|
1046
1105
|
x: t.start.x,
|
|
1047
1106
|
y: t.start.y,
|
|
1048
1107
|
x2: t.current.x,
|
|
@@ -1051,83 +1110,83 @@ function wn(t) {
|
|
|
1051
1110
|
h: Math.abs(r)
|
|
1052
1111
|
});
|
|
1053
1112
|
}
|
|
1054
|
-
return
|
|
1113
|
+
return h.add(t.type, rt(t.start, t.current));
|
|
1055
1114
|
}
|
|
1056
|
-
function
|
|
1057
|
-
|
|
1115
|
+
function Rn() {
|
|
1116
|
+
h.resetCrop(), R = null, z();
|
|
1058
1117
|
}
|
|
1059
|
-
function
|
|
1060
|
-
c.resetCrop && (c.resetCrop.hidden = !
|
|
1118
|
+
function yt() {
|
|
1119
|
+
c.resetCrop && (c.resetCrop.hidden = !h.isCropped());
|
|
1061
1120
|
}
|
|
1062
|
-
function
|
|
1121
|
+
function St(t) {
|
|
1063
1122
|
if (!c.audio)
|
|
1064
1123
|
return;
|
|
1065
1124
|
const e = t ? "Stop audio" : "Record audio";
|
|
1066
1125
|
c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
|
|
1067
1126
|
}
|
|
1068
|
-
function
|
|
1069
|
-
S && (
|
|
1127
|
+
function Ln() {
|
|
1128
|
+
S && (q = S), S = "", c.stage.hidden = !0, c.restore.hidden = !q;
|
|
1070
1129
|
}
|
|
1071
|
-
function
|
|
1072
|
-
|
|
1130
|
+
function Pn() {
|
|
1131
|
+
q && (S = q, c.stage.hidden = !1, c.restore.hidden = !0, z());
|
|
1073
1132
|
}
|
|
1074
|
-
function
|
|
1133
|
+
function kn() {
|
|
1075
1134
|
try {
|
|
1076
|
-
if (
|
|
1135
|
+
if (B || (B = sn((e) => {
|
|
1077
1136
|
const r = c.text.value.trim();
|
|
1078
1137
|
c.text.value = r ? `${r} ${e}` : e;
|
|
1079
|
-
})), !
|
|
1080
|
-
|
|
1138
|
+
})), !B.isSupported()) {
|
|
1139
|
+
x("Audio-to-text is not supported in this browser.");
|
|
1081
1140
|
return;
|
|
1082
1141
|
}
|
|
1083
|
-
const t =
|
|
1084
|
-
|
|
1142
|
+
const t = B.start();
|
|
1143
|
+
St(t), x(t ? "Listening…" : "");
|
|
1085
1144
|
} catch (t) {
|
|
1086
|
-
|
|
1145
|
+
x(t.message);
|
|
1087
1146
|
}
|
|
1088
1147
|
}
|
|
1089
|
-
async function
|
|
1090
|
-
if (!
|
|
1091
|
-
|
|
1148
|
+
async function Tn() {
|
|
1149
|
+
if (!d.video) {
|
|
1150
|
+
x("Video is disabled on this host.");
|
|
1092
1151
|
return;
|
|
1093
1152
|
}
|
|
1094
|
-
c.dialog.hidden = !0, c.stop.hidden = !1,
|
|
1153
|
+
c.dialog.hidden = !0, c.stop.hidden = !1, et(), c.launcher.hidden = !0, W = ln({
|
|
1095
1154
|
onStart() {
|
|
1096
1155
|
},
|
|
1097
1156
|
onStop(t) {
|
|
1098
|
-
L = t, c.stop.hidden = !0,
|
|
1157
|
+
L = t, c.stop.hidden = !0, J(), c.dialog.hidden = !1, z(), x(t ? "Video attached." : "Recording cancelled.");
|
|
1099
1158
|
},
|
|
1100
1159
|
onError(t) {
|
|
1101
|
-
|
|
1160
|
+
x(t.message);
|
|
1102
1161
|
}
|
|
1103
1162
|
});
|
|
1104
1163
|
try {
|
|
1105
|
-
await
|
|
1164
|
+
await W.start();
|
|
1106
1165
|
} catch (t) {
|
|
1107
|
-
c.stop.hidden = !0,
|
|
1166
|
+
c.stop.hidden = !0, J(), c.dialog.hidden = !1, x(t.message);
|
|
1108
1167
|
}
|
|
1109
1168
|
}
|
|
1110
|
-
function
|
|
1169
|
+
function z() {
|
|
1111
1170
|
if (c.shot = null, !S) {
|
|
1112
|
-
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>` : "",
|
|
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>` : "", yt();
|
|
1113
1172
|
return;
|
|
1114
1173
|
}
|
|
1115
1174
|
c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${S}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
|
|
1116
1175
|
const t = c.shot.querySelector("img");
|
|
1117
1176
|
t.draggable = !1, t.addEventListener("dragstart", (r) => r.preventDefault());
|
|
1118
1177
|
const e = () => {
|
|
1119
|
-
|
|
1178
|
+
An(t), $();
|
|
1120
1179
|
};
|
|
1121
1180
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1122
1181
|
}
|
|
1123
|
-
function
|
|
1124
|
-
const e = t.naturalWidth ||
|
|
1125
|
-
if (e && r && (
|
|
1182
|
+
function An(t) {
|
|
1183
|
+
const e = t.naturalWidth || O.w, r = t.naturalHeight || O.h;
|
|
1184
|
+
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)
|
|
1126
1185
|
return;
|
|
1127
|
-
const n =
|
|
1186
|
+
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);
|
|
1128
1187
|
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}%`;
|
|
1129
1188
|
}
|
|
1130
|
-
function
|
|
1189
|
+
function In(t) {
|
|
1131
1190
|
return t.type === "arrow" ? {
|
|
1132
1191
|
id: "preview",
|
|
1133
1192
|
type: "arrow",
|
|
@@ -1142,23 +1201,23 @@ function Mn(t) {
|
|
|
1142
1201
|
id: "preview",
|
|
1143
1202
|
type: t.type,
|
|
1144
1203
|
number: "",
|
|
1145
|
-
...
|
|
1204
|
+
...rt(t.start, t.current)
|
|
1146
1205
|
};
|
|
1147
1206
|
}
|
|
1148
1207
|
function $() {
|
|
1149
1208
|
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((n) => n.remove()), !S || !c.shot) {
|
|
1150
|
-
|
|
1209
|
+
yt();
|
|
1151
1210
|
return;
|
|
1152
1211
|
}
|
|
1153
|
-
const e =
|
|
1154
|
-
if ((
|
|
1212
|
+
const e = h.crop();
|
|
1213
|
+
if ((b == null ? void 0 : b.kind) === "crop") {
|
|
1155
1214
|
const n = document.createElement("div");
|
|
1156
|
-
n.className = "nf-crop",
|
|
1215
|
+
n.className = "nf-crop", Ht(n, rt(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(n);
|
|
1157
1216
|
}
|
|
1158
|
-
const r =
|
|
1159
|
-
if ((
|
|
1160
|
-
const
|
|
1161
|
-
if (o.className = `nf-sticker nf-${n.type}`, o.dataset.id = n.id,
|
|
1217
|
+
const r = h.list().slice();
|
|
1218
|
+
if ((b == null ? void 0 : b.kind) === "sticker" && r.push(In(b)), r.forEach((n) => {
|
|
1219
|
+
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" ? Dn(o, n, e, a) : (Ht(o, n, e), a && ["nw", "ne", "sw", "se"].forEach((s) => gt(o, s))), !i && n.number) {
|
|
1162
1221
|
const s = document.createElement("span");
|
|
1163
1222
|
s.className = "nf-badge", s.textContent = String(n.number), o.appendChild(s);
|
|
1164
1223
|
}
|
|
@@ -1167,80 +1226,84 @@ function $() {
|
|
|
1167
1226
|
const n = document.createElement("video");
|
|
1168
1227
|
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);
|
|
1169
1228
|
}
|
|
1170
|
-
|
|
1229
|
+
yt();
|
|
1171
1230
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const
|
|
1174
|
-
t.style.left = `${g}px`, t.style.top = `${P}px`, t.style.width = `${
|
|
1231
|
+
function Dn(t, e, r, n) {
|
|
1232
|
+
const i = nt(), 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, k = s - g, T = l - P, A = v - g, U = y - P, V = `nf-ah-${e.id}`, I = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1233
|
+
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 = `
|
|
1175
1234
|
<defs>
|
|
1176
|
-
<marker id="${
|
|
1235
|
+
<marker id="${V}" markerWidth="10" markerHeight="10" refX="8" refY="5" orient="auto">
|
|
1177
1236
|
<path d="M0,0 L10,5 L0,10 Z" fill="currentColor" />
|
|
1178
1237
|
</marker>
|
|
1179
1238
|
</defs>
|
|
1180
|
-
<line class="nf-arrow-hit" x1="${
|
|
1181
|
-
<line class="nf-arrow-shaft" x1="${
|
|
1182
|
-
`, t.appendChild(I), n && (gt(t, "start", { left:
|
|
1239
|
+
<line class="nf-arrow-hit" x1="${k}" y1="${T}" x2="${A}" y2="${U}" />
|
|
1240
|
+
<line class="nf-arrow-shaft" x1="${k}" y1="${T}" x2="${A}" y2="${U}" marker-end="url(#${V})" />
|
|
1241
|
+
`, t.appendChild(I), n && (gt(t, "start", { left: k - 5, top: T - 5 }), gt(t, "end", { left: A - 5, top: U - 5 }));
|
|
1183
1242
|
}
|
|
1184
1243
|
function gt(t, e, r) {
|
|
1185
1244
|
const n = document.createElement("span");
|
|
1186
1245
|
n.className = "nf-handle", n.dataset.dir = e, r && (n.style.left = `${r.left}px`, n.style.top = `${r.top}px`), t.appendChild(n);
|
|
1187
1246
|
}
|
|
1188
|
-
function
|
|
1247
|
+
function Ht(t, e, r) {
|
|
1189
1248
|
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}%`;
|
|
1190
1249
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return
|
|
1193
|
-
...
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1250
|
+
function Fn(t = {}) {
|
|
1251
|
+
return rn(t), d = {
|
|
1252
|
+
...d,
|
|
1253
|
+
endpoint: String(t.endpoint || d.endpoint || "").replace(/\/$/, ""),
|
|
1254
|
+
projectKey: t.projectKey == null ? d.projectKey : String(t.projectKey),
|
|
1255
|
+
version: t.version == null ? d.version : String(t.version),
|
|
1256
|
+
slug: t.slug == null ? d.slug : String(t.slug || ""),
|
|
1257
|
+
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1258
|
+
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1259
|
+
theme: Jt(t.theme ?? d.theme),
|
|
1260
|
+
video: t.video == null ? d.video : !!t.video
|
|
1261
|
+
}, vt(), et(), re;
|
|
1262
|
+
}
|
|
1263
|
+
async function ee() {
|
|
1264
|
+
vt(), et(), c.launcher.hidden = !0, h = Xt(), O = { w: 0, h: 0 }, L = null, R = null, b = null, w = null, G = "bug", ht("bug"), pt(null), St(!1), c.text.value = "", x("Capturing…");
|
|
1202
1265
|
try {
|
|
1203
|
-
S = await
|
|
1266
|
+
S = await tn(), q = S, c.stage.hidden = !1, c.restore.hidden = !0;
|
|
1204
1267
|
} catch {
|
|
1205
|
-
S = "",
|
|
1268
|
+
S = "", x("Screenshot failed; you can still send text.");
|
|
1206
1269
|
}
|
|
1207
|
-
c.dialog.hidden = !1,
|
|
1270
|
+
c.dialog.hidden = !1, z(), c.text.focus();
|
|
1208
1271
|
}
|
|
1209
|
-
function
|
|
1210
|
-
u && (
|
|
1272
|
+
function it() {
|
|
1273
|
+
u && (B == null || B.stop(), St(!1), Qt(), b = null, w = null, xt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, J());
|
|
1211
1274
|
}
|
|
1212
|
-
function
|
|
1213
|
-
|
|
1275
|
+
function On(t = {}) {
|
|
1276
|
+
ft = { ...ft, ...nn(t) };
|
|
1214
1277
|
}
|
|
1215
|
-
async function
|
|
1216
|
-
|
|
1278
|
+
async function ne() {
|
|
1279
|
+
vt();
|
|
1217
1280
|
const t = c.text.value.trim();
|
|
1218
1281
|
if (!t && !S && !L)
|
|
1219
|
-
return
|
|
1220
|
-
if (!
|
|
1221
|
-
return
|
|
1222
|
-
|
|
1282
|
+
return x("Add a note, screenshot, or video first."), null;
|
|
1283
|
+
if (!d.endpoint || !d.projectKey)
|
|
1284
|
+
return x("Notefully is missing endpoint or projectKey."), null;
|
|
1285
|
+
x("Submitting…", !0);
|
|
1223
1286
|
const e = new FormData();
|
|
1224
|
-
if (e.append("message", t), e.append("kind",
|
|
1225
|
-
...
|
|
1226
|
-
console:
|
|
1227
|
-
})), e.append("annotations", JSON.stringify(
|
|
1228
|
-
const
|
|
1287
|
+
if (e.append("message", t), e.append("kind", G), e.append("version", d.version || "0.0.0"), d.slug && e.append("slug", d.slug), 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(
|
|
1229
1292
|
S,
|
|
1230
|
-
|
|
1231
|
-
|
|
1293
|
+
h.crop(),
|
|
1294
|
+
h.list(),
|
|
1232
1295
|
{
|
|
1233
|
-
mark:
|
|
1234
|
-
markText:
|
|
1296
|
+
mark: Ft("--nf-mark", "#fdd341"),
|
|
1297
|
+
markText: Ft("--nf-mark-text", "#2a2140")
|
|
1235
1298
|
}
|
|
1236
1299
|
);
|
|
1237
|
-
e.append("screenshot",
|
|
1300
|
+
e.append("screenshot", i, "screenshot.png");
|
|
1238
1301
|
}
|
|
1239
1302
|
L && e.append("recording", L, "recording.webm");
|
|
1240
|
-
const r = await fetch(`${
|
|
1303
|
+
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1241
1304
|
method: "POST",
|
|
1242
1305
|
headers: {
|
|
1243
|
-
"X-Notefully-Key":
|
|
1306
|
+
"X-Notefully-Key": d.projectKey
|
|
1244
1307
|
},
|
|
1245
1308
|
body: e
|
|
1246
1309
|
});
|
|
@@ -1251,20 +1314,20 @@ async function Jt() {
|
|
|
1251
1314
|
n = null;
|
|
1252
1315
|
}
|
|
1253
1316
|
if (!r.ok)
|
|
1254
|
-
throw
|
|
1255
|
-
return
|
|
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;
|
|
1256
1319
|
}
|
|
1257
|
-
function
|
|
1258
|
-
|
|
1320
|
+
function Hn() {
|
|
1321
|
+
it(), u == null || u.remove(), u = null, c = {};
|
|
1259
1322
|
}
|
|
1260
|
-
const
|
|
1261
|
-
typeof window < "u" && (window.Notefully =
|
|
1323
|
+
const re = { init: Fn, open: ee, close: it, identify: On, submit: ne, destroy: Hn };
|
|
1324
|
+
typeof window < "u" && (window.Notefully = re);
|
|
1262
1325
|
export {
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1326
|
+
it as close,
|
|
1327
|
+
re as default,
|
|
1328
|
+
Hn as destroy,
|
|
1329
|
+
On as identify,
|
|
1330
|
+
Fn as init,
|
|
1331
|
+
ee as open,
|
|
1332
|
+
ne as submit
|
|
1270
1333
|
};
|