@makefully/notefully 0.1.21 → 0.1.25
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 +15 -0
- package/dist/notefully.iife.js +9 -13
- package/dist/notefully.js +654 -605
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function
|
|
1
|
+
function xe(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
5
5
|
return window.location.protocol + t;
|
|
6
6
|
if (t.match(/^[a-z]+:/i))
|
|
7
7
|
return t;
|
|
8
|
-
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"),
|
|
9
|
-
return n.head.appendChild(r), n.body.appendChild(
|
|
8
|
+
const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
|
|
9
|
+
return n.head.appendChild(r), n.body.appendChild(i), e && (r.href = e), i.href = t, i.href;
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const Ee = /* @__PURE__ */ (() => {
|
|
12
12
|
let t = 0;
|
|
13
13
|
const e = () => (
|
|
14
14
|
// eslint-disable-next-line no-bitwise
|
|
@@ -22,27 +22,27 @@ function D(t) {
|
|
|
22
22
|
e.push(t[n]);
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
|
-
let
|
|
26
|
-
function
|
|
27
|
-
return
|
|
25
|
+
let V = null;
|
|
26
|
+
function Yt(t = {}) {
|
|
27
|
+
return V || (t.includeStyleProperties ? (V = t.includeStyleProperties, V) : (V = D(window.getComputedStyle(document.documentElement)), V));
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function J(t, e) {
|
|
30
30
|
const r = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
|
|
31
31
|
return r ? parseFloat(r.replace("px", "")) : 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
const e =
|
|
33
|
+
function Ce(t) {
|
|
34
|
+
const e = J(t, "border-left-width"), n = J(t, "border-right-width");
|
|
35
35
|
return t.clientWidth + e + n;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const e =
|
|
37
|
+
function Me(t) {
|
|
38
|
+
const e = J(t, "border-top-width"), n = J(t, "border-bottom-width");
|
|
39
39
|
return t.clientHeight + e + n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
const n = e.width ||
|
|
41
|
+
function Gt(t, e = {}) {
|
|
42
|
+
const n = e.width || Ce(t), r = e.height || Me(t);
|
|
43
43
|
return { width: n, height: r };
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Le() {
|
|
46
46
|
let t, e;
|
|
47
47
|
try {
|
|
48
48
|
e = process;
|
|
@@ -52,10 +52,10 @@ function Se() {
|
|
|
52
52
|
return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
54
|
const E = 16384;
|
|
55
|
-
function
|
|
55
|
+
function $e(t) {
|
|
56
56
|
(t.width > E || t.height > E) && (t.width > E && t.height > E ? t.width > t.height ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E) : t.width > E ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E));
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function Q(t) {
|
|
59
59
|
return new Promise((e, n) => {
|
|
60
60
|
const r = new Image();
|
|
61
61
|
r.onload = () => {
|
|
@@ -65,12 +65,12 @@ function G(t) {
|
|
|
65
65
|
}, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
async function
|
|
68
|
+
async function Ae(t) {
|
|
69
69
|
return Promise.resolve().then(() => new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
|
|
70
70
|
}
|
|
71
|
-
async function
|
|
72
|
-
const r = "http://www.w3.org/2000/svg",
|
|
73
|
-
return
|
|
71
|
+
async function Re(t, e, n) {
|
|
72
|
+
const r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), o = document.createElementNS(r, "foreignObject");
|
|
73
|
+
return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${n}`), o.setAttribute("width", "100%"), o.setAttribute("height", "100%"), o.setAttribute("x", "0"), o.setAttribute("y", "0"), o.setAttribute("externalResourcesRequired", "true"), i.appendChild(o), o.appendChild(t), Ae(i);
|
|
74
74
|
}
|
|
75
75
|
const x = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
@@ -78,412 +78,412 @@ const x = (t, e) => {
|
|
|
78
78
|
const n = Object.getPrototypeOf(t);
|
|
79
79
|
return n === null ? !1 : n.constructor.name === e.name || x(n, e);
|
|
80
80
|
};
|
|
81
|
-
function
|
|
81
|
+
function ke(t) {
|
|
82
82
|
const e = t.getPropertyValue("content");
|
|
83
83
|
return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
return
|
|
87
|
-
const r = t.getPropertyValue(n),
|
|
88
|
-
return `${n}: ${r}${
|
|
85
|
+
function Pe(t, e) {
|
|
86
|
+
return Yt(e).map((n) => {
|
|
87
|
+
const r = t.getPropertyValue(n), i = t.getPropertyPriority(n);
|
|
88
|
+
return `${n}: ${r}${i ? " !important" : ""};`;
|
|
89
89
|
}).join(" ");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
return document.createTextNode(`${
|
|
91
|
+
function Te(t, e, n, r) {
|
|
92
|
+
const i = `.${t}:${e}`, o = n.cssText ? ke(n) : Pe(n, r);
|
|
93
|
+
return document.createTextNode(`${i}{${o}}`);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
if (
|
|
95
|
+
function Pt(t, e, n, r) {
|
|
96
|
+
const i = window.getComputedStyle(t, n), o = i.getPropertyValue("content");
|
|
97
|
+
if (o === "" || o === "none")
|
|
98
98
|
return;
|
|
99
|
-
const a =
|
|
99
|
+
const a = Ee();
|
|
100
100
|
try {
|
|
101
101
|
e.className = `${e.className} ${a}`;
|
|
102
102
|
} catch {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
const s = document.createElement("style");
|
|
106
|
-
s.appendChild(
|
|
106
|
+
s.appendChild(Te(a, n, i, r)), e.appendChild(s);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
108
|
+
function Ie(t, e, n) {
|
|
109
|
+
Pt(t, e, ":before", n), Pt(t, e, ":after", n);
|
|
110
110
|
}
|
|
111
|
-
const
|
|
112
|
-
woff:
|
|
113
|
-
woff2:
|
|
111
|
+
const Tt = "application/font-woff", It = "image/jpeg", Oe = {
|
|
112
|
+
woff: Tt,
|
|
113
|
+
woff2: Tt,
|
|
114
114
|
ttf: "application/font-truetype",
|
|
115
115
|
eot: "application/vnd.ms-fontobject",
|
|
116
116
|
png: "image/png",
|
|
117
|
-
jpg:
|
|
118
|
-
jpeg:
|
|
117
|
+
jpg: It,
|
|
118
|
+
jpeg: It,
|
|
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 He(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 Ct(t) {
|
|
129
|
+
const e = He(t).toLowerCase();
|
|
130
|
+
return Oe[e] || "";
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function De(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function mt(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Fe(t, e) {
|
|
139
139
|
return `data:${e};base64,${t}`;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function Jt(t, e, n) {
|
|
142
142
|
const r = await fetch(t, e);
|
|
143
143
|
if (r.status === 404)
|
|
144
144
|
throw new Error(`Resource "${r.url}" not found`);
|
|
145
|
-
const
|
|
146
|
-
return new Promise((
|
|
145
|
+
const i = await r.blob();
|
|
146
|
+
return new Promise((o, a) => {
|
|
147
147
|
const s = new FileReader();
|
|
148
148
|
s.onerror = a, s.onloadend = () => {
|
|
149
149
|
try {
|
|
150
|
-
|
|
150
|
+
o(n({ res: r, result: s.result }));
|
|
151
151
|
} catch (l) {
|
|
152
152
|
a(l);
|
|
153
153
|
}
|
|
154
|
-
}, s.readAsDataURL(
|
|
154
|
+
}, s.readAsDataURL(i);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
function
|
|
157
|
+
const ut = {};
|
|
158
|
+
function Ue(t, e, n) {
|
|
159
159
|
let r = t.replace(/\?.*/, "");
|
|
160
160
|
return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
|
|
161
161
|
}
|
|
162
|
-
async function
|
|
163
|
-
const r =
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
162
|
+
async function Mt(t, e, n) {
|
|
163
|
+
const r = Ue(t, e, n.includeQueryParams);
|
|
164
|
+
if (ut[r] != null)
|
|
165
|
+
return ut[r];
|
|
166
166
|
n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
|
|
167
|
-
let
|
|
167
|
+
let i;
|
|
168
168
|
try {
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
} catch (
|
|
172
|
-
|
|
169
|
+
const o = await Jt(t, n.fetchRequestInit, ({ res: a, result: s }) => (e || (e = a.headers.get("Content-Type") || ""), De(s)));
|
|
170
|
+
i = Fe(o, e);
|
|
171
|
+
} catch (o) {
|
|
172
|
+
i = n.imagePlaceholder || "";
|
|
173
173
|
let a = `Failed to fetch resource: ${t}`;
|
|
174
|
-
|
|
174
|
+
o && (a = typeof o == "string" ? o : o.message), a && console.warn(a);
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return ut[r] = i, i;
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
178
|
+
async function je(t) {
|
|
179
179
|
const e = t.toDataURL();
|
|
180
|
-
return e === "data:," ? t.cloneNode(!1) :
|
|
180
|
+
return e === "data:," ? t.cloneNode(!1) : Q(e);
|
|
181
181
|
}
|
|
182
|
-
async function
|
|
182
|
+
async function Be(t, e) {
|
|
183
183
|
if (t.currentSrc) {
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
const s =
|
|
187
|
-
return
|
|
184
|
+
const o = document.createElement("canvas"), a = o.getContext("2d");
|
|
185
|
+
o.width = t.clientWidth, o.height = t.clientHeight, a == null || a.drawImage(t, 0, 0, o.width, o.height);
|
|
186
|
+
const s = o.toDataURL();
|
|
187
|
+
return Q(s);
|
|
188
188
|
}
|
|
189
|
-
const n = t.poster, r =
|
|
190
|
-
return
|
|
189
|
+
const n = t.poster, r = Ct(n), i = await Mt(n, r, e);
|
|
190
|
+
return Q(i);
|
|
191
191
|
}
|
|
192
|
-
async function
|
|
192
|
+
async function _e(t, e) {
|
|
193
193
|
var n;
|
|
194
194
|
try {
|
|
195
195
|
if (!((n = t == null ? void 0 : t.contentDocument) === null || n === void 0) && n.body)
|
|
196
|
-
return await
|
|
196
|
+
return await rt(t.contentDocument.body, e, !0);
|
|
197
197
|
} catch {
|
|
198
198
|
}
|
|
199
199
|
return t.cloneNode(!1);
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
return x(t, HTMLCanvasElement) ?
|
|
201
|
+
async function Ne(t, e) {
|
|
202
|
+
return x(t, HTMLCanvasElement) ? je(t) : x(t, HTMLVideoElement) ? Be(t, e) : x(t, HTMLIFrameElement) ? _e(t, e) : t.cloneNode(Qt(t));
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
async function
|
|
206
|
-
var r,
|
|
207
|
-
if (
|
|
204
|
+
const Ve = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", Qt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
|
|
205
|
+
async function ze(t, e, n) {
|
|
206
|
+
var r, i;
|
|
207
|
+
if (Qt(e))
|
|
208
208
|
return e;
|
|
209
|
-
let
|
|
210
|
-
return
|
|
209
|
+
let o = [];
|
|
210
|
+
return Ve(t) && t.assignedNodes ? o = D(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? o = D(t.contentDocument.body.childNodes) : o = D(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), o.length === 0 || x(t, HTMLVideoElement) || await o.reduce((a, s) => a.then(() => rt(s, n)).then((l) => {
|
|
211
211
|
l && e.appendChild(l);
|
|
212
212
|
}), Promise.resolve()), e;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function We(t, e, n) {
|
|
215
215
|
const r = e.style;
|
|
216
216
|
if (!r)
|
|
217
217
|
return;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
let a =
|
|
221
|
-
|
|
218
|
+
const i = window.getComputedStyle(t);
|
|
219
|
+
i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : Yt(n).forEach((o) => {
|
|
220
|
+
let a = i.getPropertyValue(o);
|
|
221
|
+
o === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && o === "display" && a === "inline" && (a = "block"), o === "d" && e.getAttribute("d") && (a = `path(${e.getAttribute("d")})`), r.setProperty(o, a, i.getPropertyPriority(o));
|
|
222
222
|
});
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function qe(t, e) {
|
|
225
225
|
x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function Ke(t, e) {
|
|
228
228
|
if (x(t, HTMLSelectElement)) {
|
|
229
|
-
const r = Array.from(e.children).find((
|
|
229
|
+
const r = Array.from(e.children).find((i) => t.value === i.getAttribute("value"));
|
|
230
230
|
r && r.setAttribute("selected", "");
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return x(e, Element) && (
|
|
233
|
+
function Xe(t, e, n) {
|
|
234
|
+
return x(e, Element) && (We(t, e, n), Ie(t, e, n), qe(t, e), Ke(t, e)), e;
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
236
|
+
async function Ye(t, e) {
|
|
237
237
|
const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
|
|
238
238
|
if (n.length === 0)
|
|
239
239
|
return t;
|
|
240
240
|
const r = {};
|
|
241
|
-
for (let
|
|
242
|
-
const s = n[
|
|
241
|
+
for (let o = 0; o < n.length; o++) {
|
|
242
|
+
const s = n[o].getAttribute("xlink:href");
|
|
243
243
|
if (s) {
|
|
244
244
|
const l = t.querySelector(s), u = document.querySelector(s);
|
|
245
|
-
!l && u && !r[s] && (r[s] = await
|
|
245
|
+
!l && u && !r[s] && (r[s] = await rt(u, e, !0));
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
250
|
-
const
|
|
251
|
-
a.setAttribute("xmlns",
|
|
252
|
-
const s = document.createElementNS(
|
|
248
|
+
const i = Object.values(r);
|
|
249
|
+
if (i.length) {
|
|
250
|
+
const o = "http://www.w3.org/1999/xhtml", a = document.createElementNS(o, "svg");
|
|
251
|
+
a.setAttribute("xmlns", o), a.style.position = "absolute", a.style.width = "0", a.style.height = "0", a.style.overflow = "hidden", a.style.display = "none";
|
|
252
|
+
const s = document.createElementNS(o, "defs");
|
|
253
253
|
a.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(a);
|
|
257
257
|
}
|
|
258
258
|
return t;
|
|
259
259
|
}
|
|
260
|
-
async function
|
|
261
|
-
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) =>
|
|
260
|
+
async function rt(t, e, n) {
|
|
261
|
+
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => Ne(r, e)).then((r) => ze(t, r, e)).then((r) => Xe(t, r, e)).then((r) => Ye(r, e));
|
|
262
262
|
}
|
|
263
|
-
const
|
|
264
|
-
function
|
|
263
|
+
const Zt = /url\((['"]?)([^'"]+?)\1\)/g, Ge = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Je = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
|
+
function Qe(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function Ze(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(
|
|
270
|
+
return t.replace(Zt, (n, r, i) => (e.push(i), n)), e.filter((n) => !mt(n));
|
|
271
271
|
}
|
|
272
|
-
async function
|
|
272
|
+
async function tn(t, e, n, r, i) {
|
|
273
273
|
try {
|
|
274
|
-
const
|
|
274
|
+
const o = n ? xe(e, n) : e, a = Ct(e);
|
|
275
275
|
let s;
|
|
276
|
-
return
|
|
276
|
+
return i || (s = await Mt(o, a, r)), t.replace(Qe(e), `$1${s}$3`);
|
|
277
277
|
} catch {
|
|
278
278
|
}
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return e ? t.replace(
|
|
281
|
+
function en(t, { preferredFontFormat: e }) {
|
|
282
|
+
return e ? t.replace(Je, (n) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [r, ,
|
|
285
|
-
if (!
|
|
284
|
+
const [r, , i] = Ge.exec(n) || [];
|
|
285
|
+
if (!i)
|
|
286
286
|
return "";
|
|
287
|
-
if (
|
|
287
|
+
if (i === e)
|
|
288
288
|
return `src: ${r};`;
|
|
289
289
|
}
|
|
290
290
|
}) : t;
|
|
291
291
|
}
|
|
292
|
-
function
|
|
293
|
-
return t.search(
|
|
292
|
+
function te(t) {
|
|
293
|
+
return t.search(Zt) !== -1;
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
if (!
|
|
295
|
+
async function ee(t, e, n) {
|
|
296
|
+
if (!te(t))
|
|
297
297
|
return t;
|
|
298
|
-
const r =
|
|
299
|
-
return
|
|
298
|
+
const r = en(t, n);
|
|
299
|
+
return Ze(r).reduce((o, a) => o.then((s) => tn(s, a, e, n)), Promise.resolve(r));
|
|
300
300
|
}
|
|
301
|
-
async function
|
|
301
|
+
async function z(t, e, n) {
|
|
302
302
|
var r;
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
const
|
|
306
|
-
return e.style.setProperty(t,
|
|
303
|
+
const i = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
|
|
304
|
+
if (i) {
|
|
305
|
+
const o = await ee(i, null, n);
|
|
306
|
+
return e.style.setProperty(t, o, e.style.getPropertyPriority(t)), !0;
|
|
307
307
|
}
|
|
308
308
|
return !1;
|
|
309
309
|
}
|
|
310
|
-
async function
|
|
311
|
-
await
|
|
310
|
+
async function nn(t, e) {
|
|
311
|
+
await z("background", t, e) || await z("background-image", t, e), await z("mask", t, e) || await z("-webkit-mask", t, e) || await z("mask-image", t, e) || await z("-webkit-mask-image", t, e);
|
|
312
312
|
}
|
|
313
|
-
async function
|
|
313
|
+
async function rn(t, e) {
|
|
314
314
|
const n = x(t, HTMLImageElement);
|
|
315
|
-
if (!(n && !
|
|
315
|
+
if (!(n && !mt(t.src)) && !(x(t, SVGImageElement) && !mt(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
|
-
const r = n ? t.src : t.href.baseVal,
|
|
318
|
-
await new Promise((
|
|
319
|
-
t.onload =
|
|
317
|
+
const r = n ? t.src : t.href.baseVal, i = await Mt(r, Ct(r), e);
|
|
318
|
+
await new Promise((o, a) => {
|
|
319
|
+
t.onload = o, t.onerror = e.onImageErrorHandler ? (...l) => {
|
|
320
320
|
try {
|
|
321
|
-
|
|
321
|
+
o(e.onImageErrorHandler(...l));
|
|
322
322
|
} catch (u) {
|
|
323
323
|
a(u);
|
|
324
324
|
}
|
|
325
325
|
} : a;
|
|
326
326
|
const s = t;
|
|
327
|
-
s.decode && (s.decode =
|
|
327
|
+
s.decode && (s.decode = o), s.loading === "lazy" && (s.loading = "eager"), n ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
-
async function
|
|
331
|
-
const r = D(t.childNodes).map((
|
|
330
|
+
async function on(t, e) {
|
|
331
|
+
const r = D(t.childNodes).map((i) => ne(i, e));
|
|
332
332
|
await Promise.all(r).then(() => t);
|
|
333
333
|
}
|
|
334
|
-
async function
|
|
335
|
-
x(t, Element) && (await
|
|
334
|
+
async function ne(t, e) {
|
|
335
|
+
x(t, Element) && (await nn(t, e), await rn(t, e), await on(t, e));
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function an(t, e) {
|
|
338
338
|
const { style: n } = t;
|
|
339
339
|
e.backgroundColor && (n.backgroundColor = e.backgroundColor), e.width && (n.width = `${e.width}px`), e.height && (n.height = `${e.height}px`);
|
|
340
340
|
const r = e.style;
|
|
341
|
-
return r != null && Object.keys(r).forEach((
|
|
342
|
-
n[
|
|
341
|
+
return r != null && Object.keys(r).forEach((i) => {
|
|
342
|
+
n[i] = r[i];
|
|
343
343
|
}), t;
|
|
344
344
|
}
|
|
345
|
-
const
|
|
346
|
-
async function
|
|
347
|
-
let e =
|
|
345
|
+
const Ot = {};
|
|
346
|
+
async function Ht(t) {
|
|
347
|
+
let e = Ot[t];
|
|
348
348
|
if (e != null)
|
|
349
349
|
return e;
|
|
350
350
|
const r = await (await fetch(t)).text();
|
|
351
|
-
return e = { url: t, cssText: r },
|
|
351
|
+
return e = { url: t, cssText: r }, Ot[t] = e, e;
|
|
352
352
|
}
|
|
353
|
-
async function
|
|
353
|
+
async function Dt(t, e) {
|
|
354
354
|
let n = t.cssText;
|
|
355
|
-
const r = /url\(["']?([^"')]+)["']?\)/g,
|
|
355
|
+
const r = /url\(["']?([^"')]+)["']?\)/g, o = (n.match(/url\([^)]+\)/g) || []).map(async (a) => {
|
|
356
356
|
let s = a.replace(r, "$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), Jt(s, e.fetchRequestInit, ({ result: l }) => (n = n.replace(a, `url(${l})`), [a, l]));
|
|
358
358
|
});
|
|
359
|
-
return Promise.all(
|
|
359
|
+
return Promise.all(o).then(() => n);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function Ft(t) {
|
|
362
362
|
if (t == null)
|
|
363
363
|
return [];
|
|
364
364
|
const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
|
|
365
365
|
let r = t.replace(n, "");
|
|
366
|
-
const
|
|
366
|
+
const i = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
|
|
367
367
|
for (; ; ) {
|
|
368
|
-
const l =
|
|
368
|
+
const l = i.exec(r);
|
|
369
369
|
if (l === null)
|
|
370
370
|
break;
|
|
371
371
|
e.push(l[0]);
|
|
372
372
|
}
|
|
373
|
-
r = r.replace(
|
|
374
|
-
const
|
|
373
|
+
r = r.replace(i, "");
|
|
374
|
+
const o = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, a = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", s = new RegExp(a, "gi");
|
|
375
375
|
for (; ; ) {
|
|
376
|
-
let l =
|
|
376
|
+
let l = o.exec(r);
|
|
377
377
|
if (l === null) {
|
|
378
378
|
if (l = s.exec(r), l === null)
|
|
379
379
|
break;
|
|
380
|
-
|
|
380
|
+
o.lastIndex = s.lastIndex;
|
|
381
381
|
} else
|
|
382
|
-
s.lastIndex =
|
|
382
|
+
s.lastIndex = o.lastIndex;
|
|
383
383
|
e.push(l[0]);
|
|
384
384
|
}
|
|
385
385
|
return e;
|
|
386
386
|
}
|
|
387
|
-
async function
|
|
387
|
+
async function sn(t, e) {
|
|
388
388
|
const n = [], r = [];
|
|
389
|
-
return t.forEach((
|
|
390
|
-
if ("cssRules" in
|
|
389
|
+
return t.forEach((i) => {
|
|
390
|
+
if ("cssRules" in i)
|
|
391
391
|
try {
|
|
392
|
-
D(
|
|
393
|
-
if (
|
|
392
|
+
D(i.cssRules || []).forEach((o, a) => {
|
|
393
|
+
if (o.type === CSSRule.IMPORT_RULE) {
|
|
394
394
|
let s = a + 1;
|
|
395
|
-
const l =
|
|
395
|
+
const l = o.href, u = Ht(l).then((h) => Dt(h, e)).then((h) => Ft(h).forEach((m) => {
|
|
396
396
|
try {
|
|
397
|
-
|
|
398
|
-
} catch (
|
|
397
|
+
i.insertRule(m, m.startsWith("@import") ? s += 1 : i.cssRules.length);
|
|
398
|
+
} catch (y) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
400
|
rule: m,
|
|
401
|
-
error:
|
|
401
|
+
error: y
|
|
402
402
|
});
|
|
403
403
|
}
|
|
404
|
-
})).catch((
|
|
405
|
-
console.error("Error loading remote css",
|
|
404
|
+
})).catch((h) => {
|
|
405
|
+
console.error("Error loading remote css", h.toString());
|
|
406
406
|
});
|
|
407
407
|
r.push(u);
|
|
408
408
|
}
|
|
409
409
|
});
|
|
410
|
-
} catch (
|
|
410
|
+
} catch (o) {
|
|
411
411
|
const a = t.find((s) => s.href == null) || document.styleSheets[0];
|
|
412
|
-
|
|
412
|
+
i.href != null && r.push(Ht(i.href).then((s) => Dt(s, e)).then((s) => Ft(s).forEach((l) => {
|
|
413
413
|
a.insertRule(l, a.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", o);
|
|
417
417
|
}
|
|
418
|
-
}), Promise.all(r).then(() => (t.forEach((
|
|
419
|
-
if ("cssRules" in
|
|
418
|
+
}), Promise.all(r).then(() => (t.forEach((i) => {
|
|
419
|
+
if ("cssRules" in i)
|
|
420
420
|
try {
|
|
421
|
-
D(
|
|
422
|
-
n.push(
|
|
421
|
+
D(i.cssRules || []).forEach((o) => {
|
|
422
|
+
n.push(o);
|
|
423
423
|
});
|
|
424
|
-
} catch (
|
|
425
|
-
console.error(`Error while reading CSS rules from ${
|
|
424
|
+
} catch (o) {
|
|
425
|
+
console.error(`Error while reading CSS rules from ${i.href}`, o);
|
|
426
426
|
}
|
|
427
427
|
}), n));
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) =>
|
|
429
|
+
function cn(t) {
|
|
430
|
+
return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => te(e.style.getPropertyValue("src")));
|
|
431
431
|
}
|
|
432
|
-
async function
|
|
432
|
+
async function ln(t, e) {
|
|
433
433
|
if (t.ownerDocument == null)
|
|
434
434
|
throw new Error("Provided element is not within a Document");
|
|
435
|
-
const n = D(t.ownerDocument.styleSheets), r = await
|
|
436
|
-
return
|
|
435
|
+
const n = D(t.ownerDocument.styleSheets), r = await sn(n, e);
|
|
436
|
+
return cn(r);
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function re(t) {
|
|
439
439
|
return t.trim().replace(/["']/g, "");
|
|
440
440
|
}
|
|
441
|
-
function
|
|
441
|
+
function un(t) {
|
|
442
442
|
const e = /* @__PURE__ */ new Set();
|
|
443
443
|
function n(r) {
|
|
444
|
-
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((
|
|
445
|
-
e.add(
|
|
446
|
-
}), Array.from(r.children).forEach((
|
|
447
|
-
|
|
444
|
+
(r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((o) => {
|
|
445
|
+
e.add(re(o));
|
|
446
|
+
}), Array.from(r.children).forEach((o) => {
|
|
447
|
+
o instanceof HTMLElement && n(o);
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
450
|
return n(t), e;
|
|
451
451
|
}
|
|
452
|
-
async function
|
|
453
|
-
const n = await
|
|
454
|
-
return (await Promise.all(n.filter((
|
|
455
|
-
const a =
|
|
456
|
-
return
|
|
452
|
+
async function dn(t, e) {
|
|
453
|
+
const n = await ln(t, e), r = un(t);
|
|
454
|
+
return (await Promise.all(n.filter((o) => r.has(re(o.style.fontFamily))).map((o) => {
|
|
455
|
+
const a = o.parentStyleSheet ? o.parentStyleSheet.href : null;
|
|
456
|
+
return ee(o.cssText, a, e);
|
|
457
457
|
}))).join(`
|
|
458
458
|
`);
|
|
459
459
|
}
|
|
460
|
-
async function
|
|
461
|
-
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await
|
|
460
|
+
async function fn(t, e) {
|
|
461
|
+
const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await dn(t, e);
|
|
462
462
|
if (n) {
|
|
463
|
-
const r = document.createElement("style"),
|
|
464
|
-
r.appendChild(
|
|
463
|
+
const r = document.createElement("style"), i = document.createTextNode(n);
|
|
464
|
+
r.appendChild(i), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
async function
|
|
468
|
-
const { width: n, height: r } =
|
|
469
|
-
return await
|
|
467
|
+
async function hn(t, e = {}) {
|
|
468
|
+
const { width: n, height: r } = Gt(t, e), i = await rt(t, e, !0);
|
|
469
|
+
return await fn(i, e), await ne(i, e), an(i, e), await Re(i, n, r);
|
|
470
470
|
}
|
|
471
|
-
async function
|
|
472
|
-
const { width: n, height: r } =
|
|
473
|
-
return a.width = u * l, a.height =
|
|
471
|
+
async function pn(t, e = {}) {
|
|
472
|
+
const { width: n, height: r } = Gt(t, e), i = await hn(t, e), o = await Q(i), a = document.createElement("canvas"), s = a.getContext("2d"), l = e.pixelRatio || Le(), u = e.canvasWidth || n, h = e.canvasHeight || r;
|
|
473
|
+
return a.width = u * l, a.height = h * l, e.skipAutoScale || $e(a), a.style.width = `${u}`, a.style.height = `${h}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, a.width, a.height)), s.drawImage(o, 0, 0, a.width, a.height), a;
|
|
474
474
|
}
|
|
475
|
-
async function
|
|
476
|
-
return (await
|
|
475
|
+
async function mn(t, e = {}) {
|
|
476
|
+
return (await pn(t, e)).toDataURL();
|
|
477
477
|
}
|
|
478
|
-
const
|
|
479
|
-
function
|
|
480
|
-
return t instanceof Element && (t.hasAttribute(
|
|
478
|
+
const Z = "data-nf-capture-chrome";
|
|
479
|
+
function yn(t) {
|
|
480
|
+
return t instanceof Element && (t.hasAttribute(Z) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function gn() {
|
|
483
483
|
const t = [];
|
|
484
484
|
return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
|
|
485
|
-
const r = n.getBoundingClientRect(),
|
|
486
|
-
|
|
485
|
+
const r = n.getBoundingClientRect(), i = document.createElement("div");
|
|
486
|
+
i.setAttribute("data-nf-mask-cover", "1"), i.style.cssText = [
|
|
487
487
|
"position:fixed",
|
|
488
488
|
`left:${r.left}px`,
|
|
489
489
|
`top:${r.top}px`,
|
|
@@ -492,50 +492,50 @@ function dn() {
|
|
|
492
492
|
"background:#111",
|
|
493
493
|
"z-index:2147483646",
|
|
494
494
|
"pointer-events:none"
|
|
495
|
-
].join(";"), document.body.appendChild(
|
|
495
|
+
].join(";"), document.body.appendChild(i), t.push(i);
|
|
496
496
|
}), () => t.forEach((n) => n.remove());
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
const t = document.querySelector(`[${
|
|
498
|
+
function wn() {
|
|
499
|
+
const t = document.querySelector(`[${Z}]`);
|
|
500
500
|
if (t)
|
|
501
501
|
return t;
|
|
502
502
|
const e = document.createElement("div");
|
|
503
|
-
return e.setAttribute(
|
|
503
|
+
return e.setAttribute(Z, "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
504
|
}
|
|
505
|
-
function
|
|
506
|
-
document.querySelectorAll(`[${
|
|
505
|
+
function bn() {
|
|
506
|
+
document.querySelectorAll(`[${Z}]`).forEach((t) => t.remove());
|
|
507
507
|
}
|
|
508
|
-
async function
|
|
509
|
-
const t = document.getElementById("notefully"), e = t ? t.style.display : "", n =
|
|
508
|
+
async function Sn() {
|
|
509
|
+
const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = wn();
|
|
510
510
|
t && (t.style.display = "none");
|
|
511
|
-
const r =
|
|
512
|
-
await new Promise((
|
|
511
|
+
const r = gn();
|
|
512
|
+
await new Promise((i) => requestAnimationFrame(() => requestAnimationFrame(i)));
|
|
513
513
|
try {
|
|
514
|
-
return await
|
|
514
|
+
return await mn(document.body, {
|
|
515
515
|
cacheBust: !0,
|
|
516
516
|
pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
|
|
517
|
-
filter: (
|
|
517
|
+
filter: (i) => !yn(i)
|
|
518
518
|
});
|
|
519
519
|
} finally {
|
|
520
|
-
r(), n.remove(),
|
|
520
|
+
r(), n.remove(), bn(), t && (t.style.display = e);
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function vn(t = "") {
|
|
524
524
|
const e = String(t || "");
|
|
525
525
|
return e ? /Windows NT/i.test(e) ? "Windows" : /iPhone|iPad|iPod/i.test(e) ? "iOS" : /Mac OS X|Macintosh/i.test(e) ? "macOS" : /Android/i.test(e) ? "Android" : /CrOS/i.test(e) ? "ChromeOS" : /Linux/i.test(e) ? "Linux" : "Other" : "";
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function xn(t = "") {
|
|
528
528
|
const e = String(t || "");
|
|
529
529
|
return e ? /Edg\//i.test(e) ? "Edge" : /OPR\/|Opera/i.test(e) ? "Opera" : /Firefox\//i.test(e) ? "Firefox" : /Chrome\//i.test(e) || /CriOS\//i.test(e) ? "Chrome" : /Safari\//i.test(e) ? "Safari" : "Other" : "";
|
|
530
530
|
}
|
|
531
|
-
function
|
|
531
|
+
function En(t = {}) {
|
|
532
532
|
const e = navigator.userAgent;
|
|
533
533
|
return {
|
|
534
534
|
url: location.href,
|
|
535
535
|
title: document.title,
|
|
536
536
|
userAgent: e,
|
|
537
|
-
os:
|
|
538
|
-
browser:
|
|
537
|
+
os: vn(e),
|
|
538
|
+
browser: xn(e),
|
|
539
539
|
language: navigator.language,
|
|
540
540
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
541
541
|
viewport: {
|
|
@@ -550,11 +550,11 @@ function gn(t = {}) {
|
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
}
|
|
553
|
-
const
|
|
553
|
+
const Ut = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), jt = {
|
|
554
554
|
id: "userId",
|
|
555
555
|
username: "displayName",
|
|
556
556
|
name: "displayName"
|
|
557
|
-
},
|
|
557
|
+
}, Bt = /* @__PURE__ */ new Set([
|
|
558
558
|
"endpoint",
|
|
559
559
|
"projectKey",
|
|
560
560
|
"version",
|
|
@@ -563,8 +563,9 @@ const Ht = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Dt = {
|
|
|
563
563
|
"hideLauncher",
|
|
564
564
|
"theme",
|
|
565
565
|
"video",
|
|
566
|
-
"consoleLogLimit"
|
|
567
|
-
|
|
566
|
+
"consoleLogLimit",
|
|
567
|
+
"kinds"
|
|
568
|
+
]), _t = {
|
|
568
569
|
slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
|
|
569
570
|
projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
|
|
570
571
|
project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
|
|
@@ -573,43 +574,43 @@ const Ht = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Dt = {
|
|
|
573
574
|
email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
|
|
574
575
|
displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
|
|
575
576
|
};
|
|
576
|
-
function
|
|
577
|
-
const n = e.warn ||
|
|
578
|
-
for (const a of
|
|
579
|
-
Object.prototype.hasOwnProperty.call(r, a) && (
|
|
580
|
-
for (const [a, s] of Object.entries(
|
|
581
|
-
Object.prototype.hasOwnProperty.call(r, a) && (Object.prototype.hasOwnProperty.call(
|
|
577
|
+
function Cn(t = {}, e = {}) {
|
|
578
|
+
const n = e.warn || ie, r = t && typeof t == "object" ? t : {}, i = {}, o = [];
|
|
579
|
+
for (const a of Ut)
|
|
580
|
+
Object.prototype.hasOwnProperty.call(r, a) && (i[a] = r[a]);
|
|
581
|
+
for (const [a, s] of Object.entries(jt))
|
|
582
|
+
Object.prototype.hasOwnProperty.call(r, a) && (Object.prototype.hasOwnProperty.call(i, s) || (i[s] = r[a]));
|
|
582
583
|
for (const a of Object.keys(r))
|
|
583
|
-
|
|
584
|
-
if (
|
|
585
|
-
const a =
|
|
584
|
+
Ut.has(a) || Object.prototype.hasOwnProperty.call(jt, a) || o.push(a);
|
|
585
|
+
if (o.length) {
|
|
586
|
+
const a = o.some((s) => s === "name" || s === "slug" || s === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
|
|
586
587
|
n(
|
|
587
|
-
`Notefully.identify: ignoring unknown key(s): ${
|
|
588
|
+
`Notefully.identify: ignoring unknown key(s): ${o.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).` + a
|
|
588
589
|
);
|
|
589
590
|
}
|
|
590
|
-
return
|
|
591
|
-
}
|
|
592
|
-
function
|
|
593
|
-
const n = e.warn ||
|
|
594
|
-
if (
|
|
595
|
-
for (const
|
|
596
|
-
if (
|
|
597
|
-
n(`Notefully.init: ignoring "${
|
|
591
|
+
return i;
|
|
592
|
+
}
|
|
593
|
+
function Mn(t = {}, e = {}) {
|
|
594
|
+
const n = e.warn || ie, r = t && typeof t == "object" ? t : {}, i = Object.keys(r).filter((o) => !Bt.has(o));
|
|
595
|
+
if (i.length)
|
|
596
|
+
for (const o of i) {
|
|
597
|
+
if (_t[o]) {
|
|
598
|
+
n(`Notefully.init: ignoring "${o}". ${_t[o]}`);
|
|
598
599
|
continue;
|
|
599
600
|
}
|
|
600
601
|
n(
|
|
601
|
-
`Notefully.init: ignoring unknown key "${
|
|
602
|
+
`Notefully.init: ignoring unknown key "${o}". Supported: ${[...Bt].join(", ")}.`
|
|
602
603
|
);
|
|
603
604
|
}
|
|
604
605
|
}
|
|
605
|
-
function
|
|
606
|
+
function ie(t) {
|
|
606
607
|
typeof console < "u" && typeof console.warn == "function" && console.warn(t);
|
|
607
608
|
}
|
|
608
|
-
const
|
|
609
|
-
function
|
|
609
|
+
const Ln = 80;
|
|
610
|
+
function $n() {
|
|
610
611
|
const t = [], e = {};
|
|
611
612
|
let n = !1;
|
|
612
|
-
const r = (
|
|
613
|
+
const r = (o, a) => {
|
|
613
614
|
let s = "";
|
|
614
615
|
try {
|
|
615
616
|
s = a.map((l) => l instanceof Error ? l.stack || l.message : typeof l == "string" ? l : JSON.stringify(l)).join(" ");
|
|
@@ -617,21 +618,21 @@ function vn() {
|
|
|
617
618
|
s = String(a[0]);
|
|
618
619
|
}
|
|
619
620
|
t.push({
|
|
620
|
-
level:
|
|
621
|
+
level: o,
|
|
621
622
|
text: s.slice(0, 2e3),
|
|
622
623
|
at: Date.now()
|
|
623
|
-
}), t.length >
|
|
624
|
+
}), t.length > Ln && t.shift();
|
|
624
625
|
};
|
|
625
626
|
return {
|
|
626
627
|
hook: () => {
|
|
627
|
-
n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((
|
|
628
|
-
e[
|
|
629
|
-
r(
|
|
628
|
+
n || typeof window > "u" || (n = !0, ["log", "info", "warn", "error"].forEach((o) => {
|
|
629
|
+
e[o] = console[o].bind(console), console[o] = (...a) => {
|
|
630
|
+
r(o, a), e[o](...a);
|
|
630
631
|
};
|
|
631
|
-
}), window.addEventListener("error", (
|
|
632
|
-
r("error", [
|
|
633
|
-
}), window.addEventListener("unhandledrejection", (
|
|
634
|
-
r("error", [
|
|
632
|
+
}), window.addEventListener("error", (o) => {
|
|
633
|
+
r("error", [o.message || "window.error"]);
|
|
634
|
+
}), window.addEventListener("unhandledrejection", (o) => {
|
|
635
|
+
r("error", [o.reason || "unhandledrejection"]);
|
|
635
636
|
}));
|
|
636
637
|
},
|
|
637
638
|
snapshot() {
|
|
@@ -639,10 +640,10 @@ function vn() {
|
|
|
639
640
|
}
|
|
640
641
|
};
|
|
641
642
|
}
|
|
642
|
-
function
|
|
643
|
+
function An(t) {
|
|
643
644
|
const e = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
644
645
|
let n = null, r = !1;
|
|
645
|
-
const
|
|
646
|
+
const i = () => {
|
|
646
647
|
if (r = !1, n)
|
|
647
648
|
try {
|
|
648
649
|
n.stop();
|
|
@@ -653,7 +654,7 @@ function xn(t) {
|
|
|
653
654
|
start: () => {
|
|
654
655
|
if (!e)
|
|
655
656
|
throw new Error("Speech recognition is not supported in this browser.");
|
|
656
|
-
return r ? (
|
|
657
|
+
return r ? (i(), !1) : (n = new e(), n.continuous = !0, n.interimResults = !0, n.lang = navigator.language || "en-US", n.onresult = (a) => {
|
|
657
658
|
let s = "";
|
|
658
659
|
for (let l = a.resultIndex; l < a.results.length; l += 1)
|
|
659
660
|
a.results[l].isFinal && (s += a.results[l][0].transcript);
|
|
@@ -664,48 +665,48 @@ function xn(t) {
|
|
|
664
665
|
r = !1;
|
|
665
666
|
}, n.start(), r = !0, !0);
|
|
666
667
|
},
|
|
667
|
-
stop:
|
|
668
|
+
stop: i,
|
|
668
669
|
isSupported: () => !!e,
|
|
669
670
|
isActive: () => r
|
|
670
671
|
};
|
|
671
672
|
}
|
|
672
|
-
const
|
|
673
|
-
function
|
|
674
|
-
let r = null,
|
|
673
|
+
const Rn = 60 * 1e3;
|
|
674
|
+
function kn({ onStart: t, onStop: e, onError: n }) {
|
|
675
|
+
let r = null, i = null, o = [], a = null;
|
|
675
676
|
const s = () => {
|
|
676
|
-
if (a && (clearTimeout(a), a = null),
|
|
677
|
+
if (a && (clearTimeout(a), a = null), i && i.state !== "inactive")
|
|
677
678
|
try {
|
|
678
|
-
|
|
679
|
+
i.stop();
|
|
679
680
|
} catch {
|
|
680
681
|
}
|
|
681
|
-
r && (r.getTracks().forEach((
|
|
682
|
+
r && (r.getTracks().forEach((h) => h.stop()), r = null);
|
|
682
683
|
}, l = () => {
|
|
683
|
-
if (
|
|
684
|
-
|
|
684
|
+
if (i && i.state === "recording") {
|
|
685
|
+
i.stop();
|
|
685
686
|
return;
|
|
686
687
|
}
|
|
687
688
|
s(), e(null);
|
|
688
689
|
};
|
|
689
690
|
return { start: async () => {
|
|
690
|
-
var
|
|
691
|
-
if (!((
|
|
691
|
+
var h, m;
|
|
692
|
+
if (!((h = navigator.mediaDevices) != null && h.getDisplayMedia))
|
|
692
693
|
throw new Error("Screen recording is not supported in this browser.");
|
|
693
694
|
r = await navigator.mediaDevices.getDisplayMedia({
|
|
694
695
|
video: { displaySurface: "browser" },
|
|
695
696
|
audio: !1,
|
|
696
697
|
preferCurrentTab: !0,
|
|
697
698
|
selfBrowserSurface: "include"
|
|
698
|
-
}),
|
|
699
|
+
}), o = [], i = new MediaRecorder(r, {
|
|
699
700
|
mimeType: MediaRecorder.isTypeSupported("video/webm;codecs=vp9") ? "video/webm;codecs=vp9" : "video/webm"
|
|
700
|
-
}),
|
|
701
|
-
|
|
702
|
-
},
|
|
703
|
-
const
|
|
704
|
-
s(), e(
|
|
705
|
-
}, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()),
|
|
701
|
+
}), i.ondataavailable = (y) => {
|
|
702
|
+
y.data && y.data.size && o.push(y.data);
|
|
703
|
+
}, i.onstop = () => {
|
|
704
|
+
const y = o.length ? new Blob(o, { type: i.mimeType || "video/webm" }) : null;
|
|
705
|
+
s(), e(y);
|
|
706
|
+
}, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), i.start(), a = setTimeout(l, Rn);
|
|
706
707
|
}, stop: l };
|
|
707
708
|
}
|
|
708
|
-
function
|
|
709
|
+
function Pn() {
|
|
709
710
|
const t = /* @__PURE__ */ new Set();
|
|
710
711
|
return {
|
|
711
712
|
alloc() {
|
|
@@ -723,64 +724,64 @@ function Mn() {
|
|
|
723
724
|
}
|
|
724
725
|
};
|
|
725
726
|
}
|
|
726
|
-
const
|
|
727
|
-
function
|
|
728
|
-
const t =
|
|
729
|
-
let e = [], n = { ...
|
|
727
|
+
const dt = { x: 0, y: 0, w: 1, h: 1 };
|
|
728
|
+
function oe() {
|
|
729
|
+
const t = Pn();
|
|
730
|
+
let e = [], n = { ...dt }, r = 1;
|
|
730
731
|
return {
|
|
731
|
-
list: () => e.filter((
|
|
732
|
+
list: () => e.filter((o) => In(o, n)),
|
|
732
733
|
all: () => e.slice(),
|
|
733
734
|
crop: () => ({ ...n }),
|
|
734
|
-
setCrop(
|
|
735
|
-
return n =
|
|
735
|
+
setCrop(o) {
|
|
736
|
+
return n = Tn(o), n;
|
|
736
737
|
},
|
|
737
738
|
resetCrop() {
|
|
738
|
-
return n = { ...
|
|
739
|
+
return n = { ...dt }, n;
|
|
739
740
|
},
|
|
740
741
|
isCropped() {
|
|
741
742
|
return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
|
|
742
743
|
},
|
|
743
|
-
add(
|
|
744
|
+
add(o, a) {
|
|
744
745
|
const s = {
|
|
745
746
|
id: `s${r++}`,
|
|
746
|
-
type:
|
|
747
|
+
type: o,
|
|
747
748
|
number: t.alloc(),
|
|
748
749
|
x: 0.2,
|
|
749
750
|
y: 0.2,
|
|
750
|
-
w:
|
|
751
|
-
h:
|
|
751
|
+
w: o === "arrow" ? 0.2 : 0.22,
|
|
752
|
+
h: o === "arrow" ? 0.05 : 0.16,
|
|
752
753
|
x2: 0.4,
|
|
753
754
|
y2: 0.28,
|
|
754
755
|
...a
|
|
755
756
|
};
|
|
756
757
|
return e.push(s), s;
|
|
757
758
|
},
|
|
758
|
-
update(
|
|
759
|
-
const s = e.find((l) => l.id ===
|
|
759
|
+
update(o, a) {
|
|
760
|
+
const s = e.find((l) => l.id === o);
|
|
760
761
|
return s ? (Object.assign(s, a), s) : null;
|
|
761
762
|
},
|
|
762
|
-
remove(
|
|
763
|
-
const a = e.findIndex((l) => l.id ===
|
|
763
|
+
remove(o) {
|
|
764
|
+
const a = e.findIndex((l) => l.id === o);
|
|
764
765
|
if (a < 0)
|
|
765
766
|
return null;
|
|
766
767
|
const [s] = e.splice(a, 1);
|
|
767
768
|
return t.free(s.number), s;
|
|
768
769
|
},
|
|
769
770
|
reset() {
|
|
770
|
-
for (e = [], n = { ...
|
|
771
|
+
for (e = [], n = { ...dt }, r = 1; t.peekUsed().length; )
|
|
771
772
|
t.free(t.peekUsed()[0]);
|
|
772
773
|
}
|
|
773
774
|
};
|
|
774
775
|
}
|
|
775
|
-
function
|
|
776
|
-
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e),
|
|
777
|
-
return { x: e, y: n, w: r, h:
|
|
776
|
+
function Tn(t) {
|
|
777
|
+
const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e), i = Math.min(Math.max(t.h, 0.05), 1 - n);
|
|
778
|
+
return { x: e, y: n, w: r, h: i };
|
|
778
779
|
}
|
|
779
|
-
function
|
|
780
|
+
function In(t, e) {
|
|
780
781
|
const n = t.type === "arrow" ? (t.x + (t.x2 ?? t.x)) / 2 : t.x + (t.w || 0) / 2, r = t.type === "arrow" ? (t.y + (t.y2 ?? t.y)) / 2 : t.y + (t.h || 0) / 2;
|
|
781
782
|
return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
|
|
782
783
|
}
|
|
783
|
-
function
|
|
784
|
+
function Lt(t) {
|
|
784
785
|
const e = Math.max(1, Number(t) || 1);
|
|
785
786
|
return {
|
|
786
787
|
stroke: Math.max(2, e * 75e-4),
|
|
@@ -790,149 +791,180 @@ function Ct(t) {
|
|
|
790
791
|
arrowHeadAngle: 0.4
|
|
791
792
|
};
|
|
792
793
|
}
|
|
793
|
-
function
|
|
794
|
+
function On(t, {
|
|
794
795
|
stickers: e = [],
|
|
795
796
|
crop: n = { x: 0, y: 0, w: 1, h: 1 },
|
|
796
797
|
width: r,
|
|
797
|
-
height:
|
|
798
|
-
colors:
|
|
798
|
+
height: i,
|
|
799
|
+
colors: o = {}
|
|
799
800
|
}) {
|
|
800
|
-
const a =
|
|
801
|
+
const a = o.mark || "#fdd341", s = o.markText || "#2a2140", l = Lt(r);
|
|
801
802
|
t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = a, t.fillStyle = a, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
|
|
802
|
-
const
|
|
803
|
+
const h = yt(u.x, n, r), m = gt(u.y, n, i), y = u.w / n.w * r, C = u.h / n.h * i, L = l.stroke / 2;
|
|
803
804
|
if (u.type === "rect")
|
|
804
805
|
t.strokeRect(
|
|
805
|
-
|
|
806
|
+
h + L,
|
|
806
807
|
m + L,
|
|
807
|
-
Math.max(0,
|
|
808
|
+
Math.max(0, y - l.stroke),
|
|
808
809
|
Math.max(0, C - l.stroke)
|
|
809
810
|
);
|
|
810
811
|
else if (u.type === "circle")
|
|
811
812
|
t.beginPath(), t.ellipse(
|
|
812
|
-
|
|
813
|
+
h + y / 2,
|
|
813
814
|
m + C / 2,
|
|
814
|
-
Math.max(0.5,
|
|
815
|
+
Math.max(0.5, y / 2 - L),
|
|
815
816
|
Math.max(0.5, C / 2 - L),
|
|
816
817
|
0,
|
|
817
818
|
0,
|
|
818
819
|
Math.PI * 2
|
|
819
820
|
), t.stroke();
|
|
820
821
|
else if (u.type === "arrow") {
|
|
821
|
-
const
|
|
822
|
-
|
|
822
|
+
const B = yt(u.x2 ?? u.x + u.w, n, r), _ = gt(u.y2 ?? u.y, n, i);
|
|
823
|
+
Dn(t, h, m, B, _, l);
|
|
823
824
|
}
|
|
824
825
|
if (u.number == null || u.number === "")
|
|
825
826
|
return;
|
|
826
|
-
const
|
|
827
|
-
t.beginPath(), t.arc(
|
|
827
|
+
const k = Hn(u, n, r, i, h, m, y), W = String(u.number);
|
|
828
|
+
t.beginPath(), t.arc(k.x, k.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = s, t.textAlign = "center", t.textBaseline = "middle", t.fillText(W, k.x, k.y + 0.5), t.fillStyle = a;
|
|
828
829
|
}), t.restore();
|
|
829
830
|
}
|
|
830
|
-
function
|
|
831
|
+
function yt(t, e, n) {
|
|
831
832
|
return (t - e.x) / e.w * n;
|
|
832
833
|
}
|
|
833
|
-
function
|
|
834
|
+
function gt(t, e, n) {
|
|
834
835
|
return (t - e.y) / e.h * n;
|
|
835
836
|
}
|
|
836
|
-
function
|
|
837
|
+
function Hn(t, e, n, r, i, o, a) {
|
|
837
838
|
if (t.type === "arrow") {
|
|
838
|
-
const s =
|
|
839
|
+
const s = yt(t.x2 ?? t.x + t.w, e, n), l = gt(t.y2 ?? t.y, e, r);
|
|
839
840
|
return {
|
|
840
|
-
x: (
|
|
841
|
-
y: (
|
|
841
|
+
x: (i + s) / 2,
|
|
842
|
+
y: (o + l) / 2
|
|
842
843
|
};
|
|
843
844
|
}
|
|
844
|
-
return { x:
|
|
845
|
+
return { x: i + a / 2, y: o };
|
|
845
846
|
}
|
|
846
|
-
function
|
|
847
|
-
const
|
|
848
|
-
x: l - a * Math.cos(
|
|
849
|
-
y: u - a * Math.sin(
|
|
847
|
+
function ae(t, e, n, r, i) {
|
|
848
|
+
const o = Math.atan2(r - e, n - t), a = i.arrowHead, s = Math.min(i.stroke, a * 0.2), l = n, u = r, h = n - Math.cos(o) * a, m = r - Math.sin(o) * a, y = {
|
|
849
|
+
x: l - a * Math.cos(o - i.arrowHeadAngle),
|
|
850
|
+
y: u - a * Math.sin(o - i.arrowHeadAngle)
|
|
850
851
|
}, C = {
|
|
851
|
-
x: l - a * Math.cos(
|
|
852
|
-
y: u - a * Math.sin(
|
|
852
|
+
x: l - a * Math.cos(o + i.arrowHeadAngle),
|
|
853
|
+
y: u - a * Math.sin(o + i.arrowHeadAngle)
|
|
853
854
|
}, L = {
|
|
854
|
-
x: n - Math.cos(
|
|
855
|
-
y: r - Math.sin(
|
|
855
|
+
x: n - Math.cos(o) * s,
|
|
856
|
+
y: r - Math.sin(o) * s
|
|
856
857
|
};
|
|
857
|
-
return { angle:
|
|
858
|
+
return { angle: o, tipX: l, tipY: u, baseX: h, baseY: m, left: y, right: C, shaftEnd: L };
|
|
858
859
|
}
|
|
859
|
-
function
|
|
860
|
-
const a =
|
|
860
|
+
function Dn(t, e, n, r, i, o) {
|
|
861
|
+
const a = ae(e, n, r, i, o);
|
|
861
862
|
t.beginPath(), t.moveTo(e, n), t.lineTo(a.shaftEnd.x, a.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(a.tipX, a.tipY), t.lineTo(a.left.x, a.left.y), t.lineTo(a.right.x, a.right.y), t.closePath(), t.fill();
|
|
862
863
|
}
|
|
863
|
-
function
|
|
864
|
-
return new Promise((
|
|
864
|
+
function Fn(t, e, n, r = {}) {
|
|
865
|
+
return new Promise((i, o) => {
|
|
865
866
|
const a = new Image();
|
|
866
867
|
a.onload = () => {
|
|
867
|
-
const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)),
|
|
868
|
-
m.width = u, m.height =
|
|
869
|
-
const
|
|
870
|
-
|
|
868
|
+
const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)), h = Math.max(1, Math.round(e.h * a.height)), m = document.createElement("canvas");
|
|
869
|
+
m.width = u, m.height = h;
|
|
870
|
+
const y = m.getContext("2d");
|
|
871
|
+
y.drawImage(a, s, l, u, h, 0, 0, u, h), On(y, {
|
|
871
872
|
stickers: n,
|
|
872
873
|
crop: e,
|
|
873
874
|
width: u,
|
|
874
|
-
height:
|
|
875
|
+
height: h,
|
|
875
876
|
colors: r
|
|
876
877
|
}), m.toBlob((C) => {
|
|
877
878
|
if (!C) {
|
|
878
|
-
|
|
879
|
+
o(new Error("Could not encode screenshot"));
|
|
879
880
|
return;
|
|
880
881
|
}
|
|
881
|
-
|
|
882
|
+
i(C);
|
|
882
883
|
}, "image/png");
|
|
883
|
-
}, a.onerror = () =>
|
|
884
|
+
}, a.onerror = () => o(new Error("Could not load screenshot")), a.src = t;
|
|
884
885
|
});
|
|
885
886
|
}
|
|
886
|
-
const
|
|
887
|
+
const U = [
|
|
888
|
+
{ id: "bug", label: "Bug" },
|
|
889
|
+
{ id: "idea", label: "Idea" },
|
|
890
|
+
{ id: "other", label: "Other" }
|
|
891
|
+
];
|
|
892
|
+
function Nt(t) {
|
|
893
|
+
return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
|
|
894
|
+
}
|
|
895
|
+
function ft(t) {
|
|
896
|
+
const e = String(t || "").trim();
|
|
897
|
+
return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
|
|
898
|
+
}
|
|
899
|
+
function Un(t) {
|
|
900
|
+
if (!Array.isArray(t) || !t.length)
|
|
901
|
+
return U.map((r) => ({ ...r }));
|
|
902
|
+
const e = /* @__PURE__ */ new Set(), n = [];
|
|
903
|
+
for (const r of t) {
|
|
904
|
+
let i = "", o = "";
|
|
905
|
+
typeof r == "string" || typeof r == "number" ? (i = Nt(r), o = ft(i)) : r && typeof r == "object" && (i = Nt(r.id ?? r.value ?? r.kind), o = String(r.label || r.name || ft(i)).trim() || ft(i)), !(!i || e.has(i)) && (e.add(i), n.push({ id: i, label: o }));
|
|
906
|
+
}
|
|
907
|
+
return n.length ? n : U.map((r) => ({ ...r }));
|
|
908
|
+
}
|
|
909
|
+
function it(t) {
|
|
910
|
+
var n;
|
|
911
|
+
const e = Array.isArray(t) && t.length ? t : U;
|
|
912
|
+
return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
|
|
913
|
+
}
|
|
914
|
+
const jn = ["maker", "all-business", "brighter-day", "quiet-night"], se = "maker", Bn = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), wt = 0.02, Vt = 0.05, _n = `
|
|
887
915
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
888
916
|
<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"/>
|
|
889
917
|
<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"/>
|
|
890
918
|
</svg>
|
|
891
919
|
`;
|
|
892
|
-
function
|
|
920
|
+
function T(t) {
|
|
893
921
|
return `<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`;
|
|
894
922
|
}
|
|
895
923
|
const I = {
|
|
896
|
-
crop:
|
|
897
|
-
resetCrop:
|
|
898
|
-
arrow:
|
|
899
|
-
rect:
|
|
900
|
-
circle:
|
|
901
|
-
discard:
|
|
902
|
-
audio:
|
|
903
|
-
video:
|
|
904
|
-
},
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
let
|
|
924
|
+
crop: T('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
|
|
925
|
+
resetCrop: T('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
|
|
926
|
+
arrow: T('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
|
|
927
|
+
rect: T('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
|
|
928
|
+
circle: T('<circle cx="12" cy="12" r="8"/>'),
|
|
929
|
+
discard: T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
930
|
+
audio: T('<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"/>'),
|
|
931
|
+
video: T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
|
|
932
|
+
}, ce = $n();
|
|
933
|
+
ce.hook();
|
|
934
|
+
const le = 10, Nn = 80, ue = "notefully.author", bt = "Anonymous";
|
|
935
|
+
let d = {
|
|
908
936
|
endpoint: "",
|
|
909
937
|
projectKey: "",
|
|
910
938
|
version: "0.0.0",
|
|
911
939
|
name: "",
|
|
912
940
|
targets: null,
|
|
913
941
|
hideLauncher: !1,
|
|
914
|
-
theme:
|
|
942
|
+
theme: se,
|
|
915
943
|
video: !1,
|
|
916
|
-
consoleLogLimit:
|
|
917
|
-
|
|
944
|
+
consoleLogLimit: le,
|
|
945
|
+
kinds: U.map((t) => ({ ...t }))
|
|
946
|
+
}, A = {}, f = null, c = {}, p = oe(), v = "", K = "", R = null, j = it(U), H = null, $ = null, w = null, g = null, G = null, F = null, q = null, O = { w: 0, h: 0 }, ht = !1;
|
|
918
947
|
function b(t) {
|
|
919
|
-
return
|
|
948
|
+
return f.querySelector(t);
|
|
920
949
|
}
|
|
921
|
-
function
|
|
950
|
+
function de(t) {
|
|
922
951
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
923
|
-
return
|
|
952
|
+
return jn.includes(e) ? e : se;
|
|
924
953
|
}
|
|
925
|
-
function
|
|
926
|
-
return
|
|
954
|
+
function zt(t, e) {
|
|
955
|
+
return f && getComputedStyle(f).getPropertyValue(t).trim() || e;
|
|
956
|
+
}
|
|
957
|
+
async function Vn(t) {
|
|
958
|
+
return (await fetch(t)).blob();
|
|
927
959
|
}
|
|
928
960
|
function S(t, e = !1) {
|
|
929
|
-
c.status && (c.status.textContent = t || "",
|
|
961
|
+
c.status && (c.status.textContent = t || "", G && (clearTimeout(G), G = null), t && !e && (G = setTimeout(() => {
|
|
930
962
|
c.status.textContent = "";
|
|
931
963
|
}, 4e3)));
|
|
932
964
|
}
|
|
933
|
-
function
|
|
934
|
-
return
|
|
935
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
965
|
+
function $t() {
|
|
966
|
+
return f && document.body.contains(f) || (f = document.createElement("div"), f.id = "notefully", f.innerHTML = `
|
|
967
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${_n}</button>
|
|
936
968
|
<div class="nf-dialog" hidden>
|
|
937
969
|
<div class="nf-panel">
|
|
938
970
|
<div class="nf-stage">
|
|
@@ -947,11 +979,7 @@ function Mt() {
|
|
|
947
979
|
</div>
|
|
948
980
|
<textarea class="nf-text" placeholder="Describe the bug or the change you want…"></textarea>
|
|
949
981
|
<input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
|
|
950
|
-
<div class="nf-kind">
|
|
951
|
-
<button type="button" data-kind="bug">Bug</button>
|
|
952
|
-
<button type="button" data-kind="idea">Idea</button>
|
|
953
|
-
<button type="button" data-kind="other">Other</button>
|
|
954
|
-
</div>
|
|
982
|
+
<div class="nf-kind"></div>
|
|
955
983
|
<div class="nf-actions">
|
|
956
984
|
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${I.discard}</button>
|
|
957
985
|
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${I.audio}</button>
|
|
@@ -963,7 +991,7 @@ function Mt() {
|
|
|
963
991
|
</div>
|
|
964
992
|
</div>
|
|
965
993
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
966
|
-
`, document.body.appendChild(
|
|
994
|
+
`, document.body.appendChild(f), c = {
|
|
967
995
|
launcher: b(".nf-launcher"),
|
|
968
996
|
dialog: b(".nf-dialog"),
|
|
969
997
|
stage: b(".nf-stage"),
|
|
@@ -979,94 +1007,109 @@ function Mt() {
|
|
|
979
1007
|
resetCrop: b(".nf-reset-crop"),
|
|
980
1008
|
submit: b(".nf-submit"),
|
|
981
1009
|
shot: null
|
|
982
|
-
},
|
|
1010
|
+
}, zn(), ot()), f;
|
|
983
1011
|
}
|
|
984
|
-
function
|
|
1012
|
+
function ot() {
|
|
985
1013
|
var t;
|
|
986
|
-
|
|
987
|
-
}
|
|
988
|
-
function
|
|
989
|
-
c.launcher && (c.launcher.hidden = !!
|
|
990
|
-
}
|
|
991
|
-
function
|
|
992
|
-
c.launcher.addEventListener("click", () =>
|
|
993
|
-
|
|
994
|
-
}),
|
|
995
|
-
|
|
996
|
-
}), c.resetCrop.addEventListener("click",
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1014
|
+
f && (f.dataset.theme = de(d.theme), d.hideLauncher ? f.setAttribute("data-nf-hidden-launcher", "") : f.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !d.video), fe(), (t = c.dialog) != null && t.hidden && tt());
|
|
1015
|
+
}
|
|
1016
|
+
function tt() {
|
|
1017
|
+
c.launcher && (c.launcher.hidden = !!d.hideLauncher);
|
|
1018
|
+
}
|
|
1019
|
+
function zn() {
|
|
1020
|
+
c.launcher.addEventListener("click", () => be()), b(".nf-dialog").addEventListener("click", (e) => {
|
|
1021
|
+
e.target === c.dialog && st();
|
|
1022
|
+
}), f.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1023
|
+
e.addEventListener("click", () => St(e.dataset.tool));
|
|
1024
|
+
}), c.resetCrop.addEventListener("click", Jn), c.canvas.addEventListener("pointerdown", qn), c.canvas.addEventListener("dragstart", (e) => e.preventDefault());
|
|
1025
|
+
const t = b(".nf-kind");
|
|
1026
|
+
t && t.addEventListener("click", (e) => {
|
|
1027
|
+
const n = e.target.closest("[data-kind]");
|
|
1028
|
+
n && At(n.dataset.kind);
|
|
1029
|
+
}), c.discard.addEventListener("click", Qn), c.restore.addEventListener("click", Zn), c.audio.addEventListener("click", tr), c.video.addEventListener("click", er), c.stop.addEventListener("click", () => q == null ? void 0 : q.stop()), b(".nf-submit").addEventListener("click", () => {
|
|
1030
|
+
Se().catch((e) => S(e.message || "Submit failed."));
|
|
1031
|
+
}), fe(), St(null);
|
|
1032
|
+
}
|
|
1033
|
+
function Wt(t) {
|
|
1034
|
+
return String(t || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1035
|
+
}
|
|
1036
|
+
function fe() {
|
|
1037
|
+
const t = f == null ? void 0 : f.querySelector(".nf-kind");
|
|
1038
|
+
if (!t)
|
|
1039
|
+
return;
|
|
1040
|
+
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : U;
|
|
1041
|
+
t.innerHTML = e.map((i) => `<button type="button" data-kind="${Wt(i.id)}">${Wt(i.label)}</button>`).join("");
|
|
1042
|
+
const r = e.map((i) => i.id).includes(j) ? j : it(e);
|
|
1043
|
+
At(r);
|
|
1044
|
+
}
|
|
1045
|
+
function At(t) {
|
|
1046
|
+
j = (d.kinds || U).map((n) => n.id).includes(t) ? t : it(d.kinds), f == null || f.querySelectorAll("[data-kind]").forEach((n) => {
|
|
1047
|
+
n.dataset.active = String(n.dataset.kind === j);
|
|
1005
1048
|
});
|
|
1006
1049
|
}
|
|
1007
|
-
function
|
|
1008
|
-
H =
|
|
1050
|
+
function St(t) {
|
|
1051
|
+
H = Bn.has(t) ? t : null, $ = null, f.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1009
1052
|
e.dataset.active = String(e.dataset.tool === H);
|
|
1010
1053
|
}), c.canvas && (c.canvas.dataset.draw = H ? "true" : "false"), v && M();
|
|
1011
1054
|
}
|
|
1012
|
-
function
|
|
1055
|
+
function qt(t) {
|
|
1013
1056
|
return Math.min(1, Math.max(0, t));
|
|
1014
1057
|
}
|
|
1015
|
-
function
|
|
1058
|
+
function X() {
|
|
1016
1059
|
return c.shot || c.canvas;
|
|
1017
1060
|
}
|
|
1018
|
-
function
|
|
1019
|
-
const e =
|
|
1061
|
+
function et(t) {
|
|
1062
|
+
const e = X().getBoundingClientRect();
|
|
1020
1063
|
return {
|
|
1021
|
-
x:
|
|
1022
|
-
y:
|
|
1064
|
+
x: qt((t.clientX - e.left) / Math.max(e.width, 1)),
|
|
1065
|
+
y: qt((t.clientY - e.top) / Math.max(e.height, 1))
|
|
1023
1066
|
};
|
|
1024
1067
|
}
|
|
1025
|
-
function
|
|
1026
|
-
const e =
|
|
1068
|
+
function Wn(t) {
|
|
1069
|
+
const e = X().getBoundingClientRect();
|
|
1027
1070
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
1028
1071
|
}
|
|
1029
|
-
function
|
|
1030
|
-
const e =
|
|
1072
|
+
function he(t) {
|
|
1073
|
+
const e = et(t), n = p.crop();
|
|
1031
1074
|
return {
|
|
1032
1075
|
x: n.x + e.x * n.w,
|
|
1033
1076
|
y: n.y + e.y * n.h
|
|
1034
1077
|
};
|
|
1035
1078
|
}
|
|
1036
|
-
function
|
|
1079
|
+
function at(t, e) {
|
|
1037
1080
|
const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
|
|
1038
1081
|
return {
|
|
1039
1082
|
x: n,
|
|
1040
1083
|
y: r,
|
|
1041
|
-
w: Math.max(
|
|
1042
|
-
h: Math.max(
|
|
1084
|
+
w: Math.max(wt, Math.abs(e.x - t.x)),
|
|
1085
|
+
h: Math.max(wt, Math.abs(e.y - t.y))
|
|
1043
1086
|
};
|
|
1044
1087
|
}
|
|
1045
|
-
function
|
|
1046
|
-
|
|
1088
|
+
function Rt(t) {
|
|
1089
|
+
f && (t ? f.dataset.grabbing = "true" : delete f.dataset.grabbing);
|
|
1047
1090
|
}
|
|
1048
|
-
function
|
|
1091
|
+
function pt(t) {
|
|
1049
1092
|
try {
|
|
1050
1093
|
c.canvas.setPointerCapture(t.pointerId);
|
|
1051
1094
|
} catch {
|
|
1052
1095
|
}
|
|
1053
1096
|
}
|
|
1054
|
-
function
|
|
1055
|
-
window.addEventListener("pointermove",
|
|
1097
|
+
function vt() {
|
|
1098
|
+
window.addEventListener("pointermove", me), window.addEventListener("pointerup", nt), window.addEventListener("pointercancel", nt);
|
|
1056
1099
|
}
|
|
1057
|
-
function
|
|
1058
|
-
window.removeEventListener("pointermove",
|
|
1100
|
+
function pe() {
|
|
1101
|
+
window.removeEventListener("pointermove", me), window.removeEventListener("pointerup", nt), window.removeEventListener("pointercancel", nt);
|
|
1059
1102
|
}
|
|
1060
|
-
function
|
|
1103
|
+
function qn(t) {
|
|
1061
1104
|
if (t.button !== 0 || !v)
|
|
1062
1105
|
return;
|
|
1063
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
1106
|
+
if (!t.target.closest(".nf-sticker") && !Wn(t)) {
|
|
1064
1107
|
$ = null, M();
|
|
1065
1108
|
return;
|
|
1066
1109
|
}
|
|
1067
1110
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1068
1111
|
if (n && n.dataset.preview !== "true") {
|
|
1069
|
-
t.preventDefault(), t.stopPropagation(), $ = n.dataset.id,
|
|
1112
|
+
t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, pt(t), Kn({
|
|
1070
1113
|
kind: "sticker",
|
|
1071
1114
|
id: $,
|
|
1072
1115
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
@@ -1074,32 +1117,32 @@ function jn(t) {
|
|
|
1074
1117
|
return;
|
|
1075
1118
|
}
|
|
1076
1119
|
if ($ = null, H === "crop") {
|
|
1077
|
-
t.preventDefault(),
|
|
1120
|
+
t.preventDefault(), pt(t), w = { kind: "crop", start: et(t), current: et(t) }, vt(), M();
|
|
1078
1121
|
return;
|
|
1079
1122
|
}
|
|
1080
1123
|
if (H === "arrow" || H === "rect" || H === "circle") {
|
|
1081
|
-
t.preventDefault(),
|
|
1082
|
-
const r =
|
|
1083
|
-
w = { kind: "sticker", type: H, start: r, current: r },
|
|
1124
|
+
t.preventDefault(), pt(t);
|
|
1125
|
+
const r = he(t);
|
|
1126
|
+
w = { kind: "sticker", type: H, start: r, current: r }, vt(), M();
|
|
1084
1127
|
return;
|
|
1085
1128
|
}
|
|
1086
1129
|
M();
|
|
1087
1130
|
}
|
|
1088
|
-
function
|
|
1131
|
+
function Kn(t, e) {
|
|
1089
1132
|
e.preventDefault(), e.stopPropagation();
|
|
1090
|
-
const n =
|
|
1133
|
+
const n = X().getBoundingClientRect(), r = p.list().find((i) => i.id === t.id);
|
|
1091
1134
|
g = {
|
|
1092
1135
|
...t,
|
|
1093
1136
|
startX: e.clientX,
|
|
1094
1137
|
startY: e.clientY,
|
|
1095
|
-
crop:
|
|
1138
|
+
crop: p.crop(),
|
|
1096
1139
|
sticker: r ? { ...r } : null,
|
|
1097
1140
|
rect: n
|
|
1098
|
-
},
|
|
1141
|
+
}, Rt(t.dir === "move" || t.dir === "start" || t.dir === "end"), vt();
|
|
1099
1142
|
}
|
|
1100
|
-
function
|
|
1143
|
+
function me(t) {
|
|
1101
1144
|
if (w) {
|
|
1102
|
-
w.current = w.kind === "crop" ?
|
|
1145
|
+
w.current = w.kind === "crop" ? et(t) : he(t), M();
|
|
1103
1146
|
return;
|
|
1104
1147
|
}
|
|
1105
1148
|
if (!g)
|
|
@@ -1107,85 +1150,85 @@ function le(t) {
|
|
|
1107
1150
|
const e = (t.clientX - g.startX) / g.rect.width * g.crop.w, n = (t.clientY - g.startY) / g.rect.height * g.crop.h, r = g.sticker;
|
|
1108
1151
|
if (r) {
|
|
1109
1152
|
if (g.dir === "end")
|
|
1110
|
-
|
|
1153
|
+
p.update(r.id, {
|
|
1111
1154
|
x2: r.x2 + e,
|
|
1112
1155
|
y2: r.y2 + n
|
|
1113
1156
|
});
|
|
1114
1157
|
else if (g.dir === "start")
|
|
1115
|
-
|
|
1158
|
+
p.update(r.id, {
|
|
1116
1159
|
x: r.x + e,
|
|
1117
1160
|
y: r.y + n
|
|
1118
1161
|
});
|
|
1119
1162
|
else if (g.dir === "move")
|
|
1120
|
-
|
|
1163
|
+
p.update(r.id, {
|
|
1121
1164
|
x: r.x + e,
|
|
1122
1165
|
y: r.y + n,
|
|
1123
1166
|
x2: (r.x2 || r.x) + e,
|
|
1124
1167
|
y2: (r.y2 || r.y) + n
|
|
1125
1168
|
});
|
|
1126
1169
|
else {
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1170
|
+
const i = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1171
|
+
Xn(i, g.dir, e, n), p.update(r.id, i);
|
|
1129
1172
|
}
|
|
1130
1173
|
M();
|
|
1131
1174
|
}
|
|
1132
1175
|
}
|
|
1133
|
-
function
|
|
1176
|
+
function Xn(t, e, n, r) {
|
|
1134
1177
|
if (e.includes("e") && (t.w = Math.max(0.04, t.w + n)), e.includes("s") && (t.h = Math.max(0.04, t.h + r)), e.includes("w")) {
|
|
1135
|
-
const
|
|
1136
|
-
t.x += t.w -
|
|
1178
|
+
const i = Math.max(0.04, t.w - n);
|
|
1179
|
+
t.x += t.w - i, t.w = i;
|
|
1137
1180
|
}
|
|
1138
1181
|
if (e.includes("n")) {
|
|
1139
|
-
const
|
|
1140
|
-
t.y += t.h -
|
|
1182
|
+
const i = Math.max(0.04, t.h - r);
|
|
1183
|
+
t.y += t.h - i, t.h = i;
|
|
1141
1184
|
}
|
|
1142
1185
|
}
|
|
1143
|
-
function
|
|
1144
|
-
if (
|
|
1145
|
-
|
|
1186
|
+
function nt(t) {
|
|
1187
|
+
if (pe(), Rt(!1), w) {
|
|
1188
|
+
Yn();
|
|
1146
1189
|
return;
|
|
1147
1190
|
}
|
|
1148
1191
|
if (g) {
|
|
1149
1192
|
if (g.kind === "sticker") {
|
|
1150
1193
|
const e = c.canvas.getBoundingClientRect();
|
|
1151
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (
|
|
1194
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (p.remove(g.id), $ = null);
|
|
1152
1195
|
}
|
|
1153
1196
|
g = null, M();
|
|
1154
1197
|
}
|
|
1155
1198
|
}
|
|
1156
|
-
function
|
|
1199
|
+
function Yn() {
|
|
1157
1200
|
const t = w;
|
|
1158
1201
|
if (w = null, !t)
|
|
1159
1202
|
return;
|
|
1160
1203
|
if (t.kind === "crop") {
|
|
1161
|
-
const n =
|
|
1162
|
-
if (Math.abs(t.current.x - t.start.x) <
|
|
1204
|
+
const n = at(t.start, t.current);
|
|
1205
|
+
if (Math.abs(t.current.x - t.start.x) < Vt || Math.abs(t.current.y - t.start.y) < Vt) {
|
|
1163
1206
|
M();
|
|
1164
1207
|
return;
|
|
1165
1208
|
}
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1168
|
-
x:
|
|
1169
|
-
y:
|
|
1170
|
-
w: n.w *
|
|
1171
|
-
h: n.h *
|
|
1172
|
-
}),
|
|
1209
|
+
const i = p.crop();
|
|
1210
|
+
p.setCrop({
|
|
1211
|
+
x: i.x + n.x * i.w,
|
|
1212
|
+
y: i.y + n.y * i.h,
|
|
1213
|
+
w: n.w * i.w,
|
|
1214
|
+
h: n.h * i.h
|
|
1215
|
+
}), Y();
|
|
1173
1216
|
return;
|
|
1174
1217
|
}
|
|
1175
|
-
const e =
|
|
1218
|
+
const e = Gn(t);
|
|
1176
1219
|
e && ($ = e.id), M();
|
|
1177
1220
|
}
|
|
1178
|
-
function
|
|
1221
|
+
function Gn(t) {
|
|
1179
1222
|
if (t.type === "arrow") {
|
|
1180
1223
|
const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
|
|
1181
|
-
return Math.hypot(e, n) <
|
|
1224
|
+
return Math.hypot(e, n) < wt ? p.add("arrow", {
|
|
1182
1225
|
x: t.start.x,
|
|
1183
1226
|
y: t.start.y,
|
|
1184
1227
|
x2: t.start.x + 0.12,
|
|
1185
1228
|
y2: t.start.y,
|
|
1186
1229
|
w: 0.12,
|
|
1187
1230
|
h: 0.02
|
|
1188
|
-
}) :
|
|
1231
|
+
}) : p.add("arrow", {
|
|
1189
1232
|
x: t.start.x,
|
|
1190
1233
|
y: t.start.y,
|
|
1191
1234
|
x2: t.current.x,
|
|
@@ -1194,29 +1237,29 @@ function Vn(t) {
|
|
|
1194
1237
|
h: Math.abs(n)
|
|
1195
1238
|
});
|
|
1196
1239
|
}
|
|
1197
|
-
return
|
|
1240
|
+
return p.add(t.type, at(t.start, t.current));
|
|
1198
1241
|
}
|
|
1199
|
-
function
|
|
1200
|
-
|
|
1242
|
+
function Jn() {
|
|
1243
|
+
p.resetCrop(), $ = null, Y();
|
|
1201
1244
|
}
|
|
1202
|
-
function
|
|
1203
|
-
c.resetCrop && (c.resetCrop.hidden = !
|
|
1245
|
+
function xt() {
|
|
1246
|
+
c.resetCrop && (c.resetCrop.hidden = !p.isCropped());
|
|
1204
1247
|
}
|
|
1205
|
-
function
|
|
1248
|
+
function kt(t) {
|
|
1206
1249
|
if (!c.audio)
|
|
1207
1250
|
return;
|
|
1208
1251
|
const e = t ? "Stop audio" : "Record audio";
|
|
1209
1252
|
c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
|
|
1210
1253
|
}
|
|
1211
|
-
function
|
|
1212
|
-
v && (
|
|
1254
|
+
function Qn() {
|
|
1255
|
+
v && (K = v), v = "", c.stage.hidden = !0, c.restore.hidden = !K;
|
|
1213
1256
|
}
|
|
1214
|
-
function
|
|
1215
|
-
|
|
1257
|
+
function Zn() {
|
|
1258
|
+
K && (v = K, c.stage.hidden = !1, c.restore.hidden = !0, Y());
|
|
1216
1259
|
}
|
|
1217
|
-
function
|
|
1260
|
+
function tr() {
|
|
1218
1261
|
try {
|
|
1219
|
-
if (F || (F =
|
|
1262
|
+
if (F || (F = An((e) => {
|
|
1220
1263
|
const n = c.text.value.trim();
|
|
1221
1264
|
c.text.value = n ? `${n} ${e}` : e;
|
|
1222
1265
|
})), !F.isSupported()) {
|
|
@@ -1224,53 +1267,53 @@ function Xn() {
|
|
|
1224
1267
|
return;
|
|
1225
1268
|
}
|
|
1226
1269
|
const t = F.start();
|
|
1227
|
-
|
|
1270
|
+
kt(t), S(t ? "Listening…" : "");
|
|
1228
1271
|
} catch (t) {
|
|
1229
1272
|
S(t.message);
|
|
1230
1273
|
}
|
|
1231
1274
|
}
|
|
1232
|
-
async function
|
|
1233
|
-
if (!
|
|
1275
|
+
async function er() {
|
|
1276
|
+
if (!d.video) {
|
|
1234
1277
|
S("Video is disabled on this host.");
|
|
1235
1278
|
return;
|
|
1236
1279
|
}
|
|
1237
|
-
c.dialog.hidden = !0, c.stop.hidden = !1,
|
|
1280
|
+
c.dialog.hidden = !0, c.stop.hidden = !1, ot(), c.launcher.hidden = !0, q = kn({
|
|
1238
1281
|
onStart() {
|
|
1239
1282
|
},
|
|
1240
1283
|
onStop(t) {
|
|
1241
|
-
|
|
1284
|
+
R = t, c.stop.hidden = !0, tt(), c.dialog.hidden = !1, Y(), S(t ? "Video attached." : "Recording cancelled.");
|
|
1242
1285
|
},
|
|
1243
1286
|
onError(t) {
|
|
1244
1287
|
S(t.message);
|
|
1245
1288
|
}
|
|
1246
1289
|
});
|
|
1247
1290
|
try {
|
|
1248
|
-
await
|
|
1291
|
+
await q.start();
|
|
1249
1292
|
} catch (t) {
|
|
1250
|
-
c.stop.hidden = !0,
|
|
1293
|
+
c.stop.hidden = !0, tt(), c.dialog.hidden = !1, S(t.message);
|
|
1251
1294
|
}
|
|
1252
1295
|
}
|
|
1253
|
-
function
|
|
1296
|
+
function Y() {
|
|
1254
1297
|
if (c.shot = null, !v) {
|
|
1255
|
-
c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML =
|
|
1298
|
+
c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = R ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(R)}"></video>` : "", xt();
|
|
1256
1299
|
return;
|
|
1257
1300
|
}
|
|
1258
1301
|
c.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${v}" draggable="false"></div>`, c.shot = c.canvas.querySelector(".nf-shot");
|
|
1259
1302
|
const t = c.shot.querySelector("img");
|
|
1260
1303
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1261
1304
|
const e = () => {
|
|
1262
|
-
|
|
1305
|
+
nr(t), M();
|
|
1263
1306
|
};
|
|
1264
1307
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1265
1308
|
}
|
|
1266
|
-
function
|
|
1309
|
+
function nr(t) {
|
|
1267
1310
|
const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
|
|
1268
1311
|
if (e && n && (O = { w: e, h: n }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), c.canvas.style.aspectRatio = `${e} / ${n}`), !c.shot || !O.w || !O.h)
|
|
1269
1312
|
return;
|
|
1270
|
-
const r =
|
|
1313
|
+
const r = p.crop(), i = O.w / O.h, o = r.w / r.h * i, a = Math.min(1, o / i), s = Math.min(1, i / o);
|
|
1271
1314
|
c.shot.style.left = `${(1 - a) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${a * 100}%`, c.shot.style.height = `${s * 100}%`, t.style.width = `${100 / r.w}%`, t.style.height = `${100 / r.h}%`, t.style.left = `${-r.x / r.w * 100}%`, t.style.top = `${-r.y / r.h * 100}%`;
|
|
1272
1315
|
}
|
|
1273
|
-
function
|
|
1316
|
+
function rr(t) {
|
|
1274
1317
|
return t.type === "arrow" ? {
|
|
1275
1318
|
id: "preview",
|
|
1276
1319
|
type: "arrow",
|
|
@@ -1285,186 +1328,192 @@ function Gn(t) {
|
|
|
1285
1328
|
id: "preview",
|
|
1286
1329
|
type: t.type,
|
|
1287
1330
|
number: "",
|
|
1288
|
-
...
|
|
1331
|
+
...at(t.start, t.current)
|
|
1289
1332
|
};
|
|
1290
1333
|
}
|
|
1291
1334
|
function M() {
|
|
1292
|
-
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((
|
|
1293
|
-
|
|
1335
|
+
if ((c.shot || c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((o) => o.remove()), !v || !c.shot) {
|
|
1336
|
+
xt();
|
|
1294
1337
|
return;
|
|
1295
1338
|
}
|
|
1296
|
-
const e =
|
|
1339
|
+
const e = p.crop(), n = X(), r = Lt(n.clientWidth || 400);
|
|
1297
1340
|
if (c.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), c.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), c.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), c.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (w == null ? void 0 : w.kind) === "crop") {
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1341
|
+
const o = document.createElement("div");
|
|
1342
|
+
o.className = "nf-crop", Kt(o, at(w.start, w.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(o);
|
|
1300
1343
|
}
|
|
1301
|
-
const
|
|
1302
|
-
if ((w == null ? void 0 : w.kind) === "sticker" &&
|
|
1303
|
-
const a =
|
|
1304
|
-
if (l.className = `nf-sticker nf-${
|
|
1344
|
+
const i = p.list().slice();
|
|
1345
|
+
if ((w == null ? void 0 : w.kind) === "sticker" && i.push(rr(w)), i.forEach((o) => {
|
|
1346
|
+
const a = o.id === "preview", s = !a && o.id === $, l = document.createElement("div");
|
|
1347
|
+
if (l.className = `nf-sticker nf-${o.type}`, l.dataset.id = o.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), o.type === "arrow" ? ir(l, o, e, s, r) : (Kt(l, o, e), s && ["nw", "ne", "sw", "se"].forEach((u) => Et(l, u))), !a && o.number) {
|
|
1305
1348
|
const u = document.createElement("span");
|
|
1306
|
-
u.className = "nf-badge", u.textContent = String(
|
|
1349
|
+
u.className = "nf-badge", u.textContent = String(o.number), l.appendChild(u);
|
|
1307
1350
|
}
|
|
1308
1351
|
c.shot.appendChild(l);
|
|
1309
|
-
}), c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1352
|
+
}), c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((o) => o.remove()), R) {
|
|
1353
|
+
const o = document.createElement("video");
|
|
1354
|
+
o.className = "nf-recording-preview", o.controls = !0, o.src = URL.createObjectURL(R), o.style.position = "absolute", o.style.right = "8px", o.style.bottom = "8px", o.style.width = "160px", c.canvas.appendChild(o);
|
|
1312
1355
|
}
|
|
1313
|
-
|
|
1356
|
+
xt();
|
|
1314
1357
|
}
|
|
1315
|
-
function
|
|
1316
|
-
const
|
|
1317
|
-
t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${
|
|
1318
|
-
<line class="nf-arrow-hit" x1="${
|
|
1319
|
-
<line class="nf-arrow-shaft" x1="${
|
|
1320
|
-
<polygon class="nf-arrow-head" points="${
|
|
1321
|
-
`, t.appendChild(
|
|
1358
|
+
function ir(t, e, n, r, i = Lt(400)) {
|
|
1359
|
+
const o = X(), a = o.clientWidth, s = o.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, h = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, m = ((e.y2 ?? e.y) - n.y) / n.h * s, y = Math.max(18, i.arrowHead + i.stroke * 2), C = Math.min(l, h) - y, L = Math.min(u, m) - y, k = Math.max(2, Math.abs(h - l)) + y * 2, W = Math.max(2, Math.abs(m - u)) + y * 2, B = l - C, _ = u - L, ct = h - C, lt = m - L, P = ae(B, _, ct, lt, i), N = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1360
|
+
t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${k}px`, t.style.height = `${W}px`, N.setAttribute("class", "nf-arrow-svg"), N.setAttribute("viewBox", `0 0 ${k} ${W}`), N.setAttribute("width", String(k)), N.setAttribute("height", String(W)), N.innerHTML = `
|
|
1361
|
+
<line class="nf-arrow-hit" x1="${B}" y1="${_}" x2="${ct}" y2="${lt}" />
|
|
1362
|
+
<line class="nf-arrow-shaft" x1="${B}" y1="${_}" x2="${P.shaftEnd.x}" y2="${P.shaftEnd.y}" />
|
|
1363
|
+
<polygon class="nf-arrow-head" points="${P.tipX},${P.tipY} ${P.left.x},${P.left.y} ${P.right.x},${P.right.y}" />
|
|
1364
|
+
`, t.appendChild(N), r && (Et(t, "start", { left: B - 5, top: _ - 5 }), Et(t, "end", { left: ct - 5, top: lt - 5 }));
|
|
1322
1365
|
}
|
|
1323
|
-
function
|
|
1366
|
+
function Et(t, e, n) {
|
|
1324
1367
|
const r = document.createElement("span");
|
|
1325
1368
|
r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
|
|
1326
1369
|
}
|
|
1327
|
-
function
|
|
1370
|
+
function Kt(t, e, n) {
|
|
1328
1371
|
t.style.left = `${(e.x - n.x) / n.w * 100}%`, t.style.top = `${(e.y - n.y) / n.h * 100}%`, t.style.width = `${e.w / n.w * 100}%`, t.style.height = `${e.h / n.h * 100}%`;
|
|
1329
1372
|
}
|
|
1330
|
-
function
|
|
1373
|
+
function or() {
|
|
1331
1374
|
try {
|
|
1332
|
-
return String(localStorage.getItem(
|
|
1375
|
+
return String(localStorage.getItem(ue) || "").trim();
|
|
1333
1376
|
} catch {
|
|
1334
1377
|
return "";
|
|
1335
1378
|
}
|
|
1336
1379
|
}
|
|
1337
|
-
function
|
|
1380
|
+
function ar(t) {
|
|
1338
1381
|
const e = String(t || "").trim();
|
|
1339
|
-
if (!(!e || e ===
|
|
1382
|
+
if (!(!e || e === bt))
|
|
1340
1383
|
try {
|
|
1341
|
-
localStorage.setItem(
|
|
1384
|
+
localStorage.setItem(ue, e);
|
|
1342
1385
|
} catch {
|
|
1343
1386
|
}
|
|
1344
1387
|
}
|
|
1345
|
-
function
|
|
1346
|
-
return !!(String(
|
|
1388
|
+
function ye() {
|
|
1389
|
+
return !!(String(A.userId || "").trim() || String(A.email || "").trim() || String(A.displayName || "").trim());
|
|
1347
1390
|
}
|
|
1348
|
-
function
|
|
1391
|
+
function sr() {
|
|
1349
1392
|
return String(
|
|
1350
|
-
|
|
1393
|
+
A.displayName || A.email || A.userId || ""
|
|
1351
1394
|
).trim();
|
|
1352
1395
|
}
|
|
1353
|
-
function
|
|
1396
|
+
function cr() {
|
|
1354
1397
|
var e;
|
|
1355
|
-
if (
|
|
1356
|
-
return
|
|
1398
|
+
if (ye())
|
|
1399
|
+
return sr() || bt;
|
|
1357
1400
|
const t = String(((e = c.author) == null ? void 0 : e.value) || "").trim();
|
|
1358
|
-
return t ? (
|
|
1401
|
+
return t ? (ar(t), t) : bt;
|
|
1359
1402
|
}
|
|
1360
|
-
function
|
|
1403
|
+
function ge() {
|
|
1361
1404
|
if (!c.author)
|
|
1362
1405
|
return;
|
|
1363
|
-
const t =
|
|
1406
|
+
const t = ye();
|
|
1364
1407
|
if (c.author.hidden = t, t) {
|
|
1365
1408
|
c.author.value = "";
|
|
1366
1409
|
return;
|
|
1367
1410
|
}
|
|
1368
|
-
c.author.value =
|
|
1411
|
+
c.author.value = or();
|
|
1369
1412
|
}
|
|
1370
|
-
function
|
|
1413
|
+
function we(t, e = le) {
|
|
1371
1414
|
const n = Number(t);
|
|
1372
|
-
return Number.isFinite(n) ? Math.min(
|
|
1373
|
-
}
|
|
1374
|
-
function
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1415
|
+
return Number.isFinite(n) ? Math.min(Nn, Math.max(0, Math.floor(n))) : e;
|
|
1416
|
+
}
|
|
1417
|
+
function lr(t = {}) {
|
|
1418
|
+
Mn(t);
|
|
1419
|
+
const e = Object.prototype.hasOwnProperty.call(t, "kinds");
|
|
1420
|
+
return d = {
|
|
1421
|
+
...d,
|
|
1422
|
+
endpoint: String(t.endpoint || d.endpoint || "").replace(/\/$/, ""),
|
|
1423
|
+
projectKey: t.projectKey == null ? d.projectKey : String(t.projectKey),
|
|
1424
|
+
version: t.version == null ? d.version : String(t.version),
|
|
1425
|
+
name: t.name == null ? d.name : String(t.name || ""),
|
|
1426
|
+
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1427
|
+
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1428
|
+
theme: de(t.theme ?? d.theme),
|
|
1429
|
+
video: t.video == null ? d.video : !!t.video,
|
|
1430
|
+
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : we(t.consoleLogLimit, d.consoleLogLimit),
|
|
1431
|
+
kinds: e ? Un(t.kinds) : d.kinds
|
|
1432
|
+
}, $t(), ot(), ve;
|
|
1433
|
+
}
|
|
1434
|
+
async function be() {
|
|
1435
|
+
$t(), ot(), c.launcher.hidden = !0, p = oe(), O = { w: 0, h: 0 }, R = null, $ = null, w = null, g = null, j = it(d.kinds), At(j), St(null), kt(!1), c.text.value = "", ge(), S("");
|
|
1390
1436
|
try {
|
|
1391
|
-
v = await
|
|
1437
|
+
v = await Sn(), K = v, c.stage.hidden = !1, c.restore.hidden = !0, S("");
|
|
1392
1438
|
} catch {
|
|
1393
1439
|
v = "", S("Screenshot failed; you can still send text.");
|
|
1394
1440
|
}
|
|
1395
|
-
c.dialog.hidden = !1,
|
|
1441
|
+
c.dialog.hidden = !1, Y(), c.text.focus();
|
|
1396
1442
|
}
|
|
1397
|
-
function
|
|
1398
|
-
|
|
1443
|
+
function st() {
|
|
1444
|
+
f && (F == null || F.stop(), kt(!1), pe(), w = null, g = null, Rt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, tt());
|
|
1399
1445
|
}
|
|
1400
|
-
function
|
|
1401
|
-
|
|
1446
|
+
function ur(t = {}) {
|
|
1447
|
+
A = { ...A, ...Cn(t) }, ge();
|
|
1402
1448
|
}
|
|
1403
|
-
async function
|
|
1404
|
-
if (
|
|
1449
|
+
async function Se() {
|
|
1450
|
+
if ($t(), ht)
|
|
1405
1451
|
return null;
|
|
1406
1452
|
const t = c.text.value.trim();
|
|
1407
|
-
if (!t && !v && !
|
|
1453
|
+
if (!t && !v && !R)
|
|
1408
1454
|
return S("Add a note, screenshot, or video first."), null;
|
|
1409
|
-
if (!
|
|
1455
|
+
if (!d.endpoint || !d.projectKey)
|
|
1410
1456
|
return S("Notefully is missing endpoint or projectKey."), null;
|
|
1411
|
-
|
|
1457
|
+
ht = !0, Xt(!0), S("Submitting…", !0);
|
|
1412
1458
|
try {
|
|
1413
|
-
const e =
|
|
1414
|
-
if (n.append("message", t), n.append("kind",
|
|
1415
|
-
...
|
|
1416
|
-
...
|
|
1417
|
-
displayName:
|
|
1459
|
+
const e = cr(), n = new FormData();
|
|
1460
|
+
if (n.append("message", t), n.append("kind", j), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify({
|
|
1461
|
+
...En({
|
|
1462
|
+
...A,
|
|
1463
|
+
displayName: A.displayName || e
|
|
1418
1464
|
}),
|
|
1419
1465
|
author: e,
|
|
1420
|
-
console:
|
|
1421
|
-
})), n.append("annotations", JSON.stringify(
|
|
1422
|
-
const
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1466
|
+
console: ce.snapshot().slice(-we(d.consoleLogLimit))
|
|
1467
|
+
})), n.append("annotations", JSON.stringify(p.list())), n.append("crop", JSON.stringify(p.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), v) {
|
|
1468
|
+
const o = await Vn(v);
|
|
1469
|
+
if (n.append("screenshot", o, "screenshot.png"), p.list().length || p.isCropped()) {
|
|
1470
|
+
const a = await Fn(
|
|
1471
|
+
v,
|
|
1472
|
+
p.crop(),
|
|
1473
|
+
p.list(),
|
|
1474
|
+
{
|
|
1475
|
+
mark: zt("--nf-mark", "#fdd341"),
|
|
1476
|
+
markText: zt("--nf-mark-text", "#2a2140")
|
|
1477
|
+
}
|
|
1478
|
+
);
|
|
1479
|
+
n.append("screenshotBaked", a, "screenshot.baked.png");
|
|
1480
|
+
}
|
|
1432
1481
|
}
|
|
1433
|
-
|
|
1434
|
-
const r = await fetch(`${
|
|
1482
|
+
R && n.append("recording", R, "recording.webm");
|
|
1483
|
+
const r = await fetch(`${d.endpoint}/v1/reports`, {
|
|
1435
1484
|
method: "POST",
|
|
1436
1485
|
headers: {
|
|
1437
|
-
"X-Notefully-Key":
|
|
1486
|
+
"X-Notefully-Key": d.projectKey
|
|
1438
1487
|
},
|
|
1439
1488
|
body: n
|
|
1440
1489
|
});
|
|
1441
|
-
let
|
|
1490
|
+
let i = null;
|
|
1442
1491
|
try {
|
|
1443
|
-
|
|
1492
|
+
i = await r.json();
|
|
1444
1493
|
} catch {
|
|
1445
|
-
|
|
1494
|
+
i = null;
|
|
1446
1495
|
}
|
|
1447
1496
|
if (!r.ok)
|
|
1448
|
-
throw S((
|
|
1449
|
-
return S("Sent. Thank you."),
|
|
1497
|
+
throw S((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
|
|
1498
|
+
return S("Sent. Thank you."), st(), i;
|
|
1450
1499
|
} finally {
|
|
1451
|
-
|
|
1500
|
+
ht = !1, Xt(!1);
|
|
1452
1501
|
}
|
|
1453
1502
|
}
|
|
1454
|
-
function
|
|
1503
|
+
function Xt(t) {
|
|
1455
1504
|
c.submit && (c.submit.disabled = !!t, c.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1456
1505
|
}
|
|
1457
|
-
function
|
|
1458
|
-
|
|
1506
|
+
function dr() {
|
|
1507
|
+
st(), f == null || f.remove(), f = null, c = {};
|
|
1459
1508
|
}
|
|
1460
|
-
const
|
|
1461
|
-
typeof window < "u" && (window.Notefully =
|
|
1509
|
+
const ve = { init: lr, open: be, close: st, identify: ur, submit: Se, destroy: dr };
|
|
1510
|
+
typeof window < "u" && (window.Notefully = ve);
|
|
1462
1511
|
export {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1512
|
+
st as close,
|
|
1513
|
+
ve as default,
|
|
1514
|
+
dr as destroy,
|
|
1515
|
+
ur as identify,
|
|
1516
|
+
lr as init,
|
|
1517
|
+
be as open,
|
|
1518
|
+
Se as submit
|
|
1470
1519
|
};
|