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