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