@makefully/notefully 0.1.27 → 0.1.29
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.iife.js +8 -8
- package/dist/notefully.js +440 -424
- package/package.json +1 -1
package/dist/notefully.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Le(t, e) {
|
|
2
2
|
if (t.match(/^[a-z]+:\/\//i))
|
|
3
3
|
return t;
|
|
4
4
|
if (t.match(/^\/\//))
|
|
@@ -8,7 +8,7 @@ function Ce(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
|
|
@@ -23,26 +23,26 @@ function F(t) {
|
|
|
23
23
|
return e;
|
|
24
24
|
}
|
|
25
25
|
let V = null;
|
|
26
|
-
function
|
|
26
|
+
function Qt(t = {}) {
|
|
27
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;
|
|
@@ -52,10 +52,10 @@ function Re() {
|
|
|
52
52
|
return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
|
|
53
53
|
}
|
|
54
54
|
const C = 16384;
|
|
55
|
-
function
|
|
55
|
+
function Te(t) {
|
|
56
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,12 +65,12 @@ 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
75
|
const E = (t, e) => {
|
|
76
76
|
if (t instanceof e)
|
|
@@ -78,96 +78,96 @@ const E = (t, e) => {
|
|
|
78
78
|
const n = Object.getPrototypeOf(t);
|
|
79
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 E(t, HTMLCanvasElement) ?
|
|
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
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
|
|
224
|
+
function Ge(t, e) {
|
|
225
225
|
E(t, HTMLTextAreaElement) && (e.innerHTML = t.value), E(t, HTMLInputElement) && e.setAttribute("value", t.value);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function Je(t, e) {
|
|
228
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 E(e, Element) && (
|
|
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,28 +289,28 @@ function rn(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
|
|
313
|
+
async function cn(t, e) {
|
|
314
314
|
const n = E(t, HTMLImageElement);
|
|
315
315
|
if (!(n && !mt(t.src)) && !(E(t, SVGImageElement) && !mt(t.href.baseVal)))
|
|
316
316
|
return;
|
|
@@ -323,18 +323,18 @@ async function an(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 = F(t.childNodes).map((i) =>
|
|
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
|
-
E(t, Element) && (await
|
|
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 cn(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,30 +371,30 @@ function Bt(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(p, p.startsWith("@import") ?
|
|
397
|
+
i.insertRule(p, p.startsWith("@import") ? c += 1 : i.cssRules.length);
|
|
398
398
|
} catch (m) {
|
|
399
399
|
console.error("Error inserting rule from remote css", {
|
|
400
400
|
rule: p,
|
|
@@ -408,11 +408,11 @@ async function ln(t, e) {
|
|
|
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) => {
|
|
@@ -426,60 +426,60 @@ async function ln(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 = F(t.ownerDocument.styleSheets), r = await
|
|
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 = f * l, e.skipAutoScale ||
|
|
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 bn() {
|
|
|
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 Mn(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 An() {
|
|
|
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 kn(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,10 +670,10 @@ function kn(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();
|
|
@@ -685,7 +685,7 @@ function Tn({ onStart: t, onStop: e, onError: n }) {
|
|
|
685
685
|
i.stop();
|
|
686
686
|
return;
|
|
687
687
|
}
|
|
688
|
-
|
|
688
|
+
c(), e(null);
|
|
689
689
|
};
|
|
690
690
|
return { start: async () => {
|
|
691
691
|
var f, p;
|
|
@@ -702,11 +702,11 @@ function Tn({ onStart: t, onStop: e, onError: n }) {
|
|
|
702
702
|
m.data && m.data.size && o.push(m.data);
|
|
703
703
|
}, i.onstop = () => {
|
|
704
704
|
const m = o.length ? new Blob(o, { type: i.mimeType || "video/webm" }) : null;
|
|
705
|
-
|
|
706
|
-
}, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), i.start(), a = setTimeout(l,
|
|
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 In() {
|
|
|
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 ae() {
|
|
|
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 ae() {
|
|
|
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 ae() {
|
|
|
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,14 +791,14 @@ 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
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")
|
|
@@ -820,12 +820,12 @@ function Fn(t, {
|
|
|
820
820
|
), t.stroke();
|
|
821
821
|
else if (u.type === "arrow") {
|
|
822
822
|
const j = yt(u.x2 ?? u.x + u.w, n, r), _ = gt(u.y2 ?? u.y, n, i);
|
|
823
|
-
|
|
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,41 +834,41 @@ 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
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
|
|
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
869
|
p.width = u, p.height = f;
|
|
870
870
|
const m = p.getContext("2d");
|
|
871
|
-
m.drawImage(a,
|
|
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,
|
|
@@ -889,49 +889,49 @@ const B = [
|
|
|
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
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
907
|
return n.length ? n : B.map((r) => ({ ...r }));
|
|
908
908
|
}
|
|
909
|
-
function
|
|
909
|
+
function at(t) {
|
|
910
910
|
var n;
|
|
911
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,32 +939,32 @@ let d = {
|
|
|
939
939
|
name: "",
|
|
940
940
|
targets: null,
|
|
941
941
|
hideLauncher: !1,
|
|
942
|
-
theme:
|
|
942
|
+
theme: ue,
|
|
943
943
|
video: !1,
|
|
944
|
-
consoleLogLimit:
|
|
944
|
+
consoleLogLimit: fe,
|
|
945
945
|
kinds: B.map((t) => ({ ...t }))
|
|
946
|
-
}, R = {}, h = null,
|
|
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
947
|
function g(t) {
|
|
948
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
|
|
954
|
+
function Kt(t, e) {
|
|
955
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
960
|
function v(t, e = !1) {
|
|
961
|
-
|
|
962
|
-
|
|
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
965
|
function Rt() {
|
|
966
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…">${
|
|
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
970
|
<div class="nf-panel-body">
|
|
@@ -994,7 +994,7 @@ function Rt() {
|
|
|
994
994
|
</div>
|
|
995
995
|
</div>
|
|
996
996
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
997
|
-
`, document.body.appendChild(h),
|
|
997
|
+
`, document.body.appendChild(h), s = {
|
|
998
998
|
launcher: g(".nf-launcher"),
|
|
999
999
|
dialog: g(".nf-dialog"),
|
|
1000
1000
|
panel: g(".nf-panel"),
|
|
@@ -1013,76 +1013,76 @@ function Rt() {
|
|
|
1013
1013
|
resetCrop: g(".nf-reset-crop"),
|
|
1014
1014
|
submit: g(".nf-submit"),
|
|
1015
1015
|
shot: null
|
|
1016
|
-
},
|
|
1016
|
+
}, Xn(), X()), h;
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1018
|
+
function X() {
|
|
1019
1019
|
var t;
|
|
1020
|
-
h && (h.dataset.theme =
|
|
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());
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1023
|
-
|
|
1022
|
+
function nt() {
|
|
1023
|
+
s.launcher && (s.launcher.hidden = !!d.hideLauncher);
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1026
|
-
|
|
1027
|
-
$t || e.target ===
|
|
1025
|
+
function Xn() {
|
|
1026
|
+
s.launcher.addEventListener("click", () => Ee()), g(".nf-dialog").addEventListener("click", (e) => {
|
|
1027
|
+
$t || e.target === s.dialog && J();
|
|
1028
1028
|
}), h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1029
1029
|
e.addEventListener("click", () => St(e.dataset.tool));
|
|
1030
|
-
}),
|
|
1030
|
+
}), s.resetCrop.addEventListener("click", er), s.canvas.addEventListener("pointerdown", Gn), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
|
|
1031
1031
|
const t = g(".nf-kind");
|
|
1032
1032
|
t && t.addEventListener("click", (e) => {
|
|
1033
1033
|
const n = e.target.closest("[data-kind]");
|
|
1034
1034
|
n && At(n.dataset.kind);
|
|
1035
|
-
}),
|
|
1036
|
-
|
|
1037
|
-
}),
|
|
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);
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function Xt(t) {
|
|
1040
1040
|
return String(t || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1042
|
+
function me() {
|
|
1043
1043
|
const t = h == null ? void 0 : h.querySelector(".nf-kind");
|
|
1044
1044
|
if (!t)
|
|
1045
1045
|
return;
|
|
1046
1046
|
const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : B;
|
|
1047
|
-
t.innerHTML = e.map((i) => `<button type="button" data-kind="${
|
|
1048
|
-
const r = e.map((i) => i.id).includes(U) ? U :
|
|
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);
|
|
1049
1049
|
At(r);
|
|
1050
1050
|
}
|
|
1051
1051
|
function At(t) {
|
|
1052
|
-
U = (d.kinds || B).map((n) => n.id).includes(t) ? t :
|
|
1052
|
+
U = (d.kinds || B).map((n) => n.id).includes(t) ? t : at(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
|
|
1053
1053
|
n.dataset.active = String(n.dataset.kind === U);
|
|
1054
1054
|
});
|
|
1055
1055
|
}
|
|
1056
1056
|
function St(t) {
|
|
1057
|
-
H =
|
|
1057
|
+
H = zn.has(t) ? t : null, $ = null, h.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1058
1058
|
e.dataset.active = String(e.dataset.tool === H);
|
|
1059
|
-
}),
|
|
1059
|
+
}), s.canvas && (s.canvas.dataset.draw = H ? "true" : "false"), S && M();
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function Yt(t) {
|
|
1062
1062
|
return Math.min(1, Math.max(0, t));
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1065
|
-
return
|
|
1064
|
+
function Y() {
|
|
1065
|
+
return s.shot || s.canvas;
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1068
|
-
const e =
|
|
1067
|
+
function rt(t) {
|
|
1068
|
+
const e = Y().getBoundingClientRect();
|
|
1069
1069
|
return {
|
|
1070
|
-
x:
|
|
1071
|
-
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))
|
|
1072
1072
|
};
|
|
1073
1073
|
}
|
|
1074
|
-
function
|
|
1075
|
-
const e =
|
|
1074
|
+
function Yn(t) {
|
|
1075
|
+
const e = Y().getBoundingClientRect();
|
|
1076
1076
|
return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
|
|
1077
1077
|
}
|
|
1078
|
-
function
|
|
1079
|
-
const e =
|
|
1078
|
+
function ye(t) {
|
|
1079
|
+
const e = rt(t), n = y.crop();
|
|
1080
1080
|
return {
|
|
1081
1081
|
x: n.x + e.x * n.w,
|
|
1082
1082
|
y: n.y + e.y * n.h
|
|
1083
1083
|
};
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function st(t, e) {
|
|
1086
1086
|
const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
|
|
1087
1087
|
return {
|
|
1088
1088
|
x: n,
|
|
@@ -1096,26 +1096,26 @@ function kt(t) {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
function pt(t) {
|
|
1098
1098
|
try {
|
|
1099
|
-
|
|
1099
|
+
s.canvas.setPointerCapture(t.pointerId);
|
|
1100
1100
|
} catch {
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
function vt() {
|
|
1104
|
-
window.addEventListener("pointermove",
|
|
1104
|
+
window.addEventListener("pointermove", we), window.addEventListener("pointerup", it), window.addEventListener("pointercancel", it);
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1107
|
-
window.removeEventListener("pointermove",
|
|
1106
|
+
function ge() {
|
|
1107
|
+
window.removeEventListener("pointermove", we), window.removeEventListener("pointerup", it), window.removeEventListener("pointercancel", it);
|
|
1108
1108
|
}
|
|
1109
|
-
function
|
|
1109
|
+
function Gn(t) {
|
|
1110
1110
|
if (t.button !== 0 || !S)
|
|
1111
1111
|
return;
|
|
1112
|
-
if (!t.target.closest(".nf-sticker") && !
|
|
1112
|
+
if (!t.target.closest(".nf-sticker") && !Yn(t)) {
|
|
1113
1113
|
$ = null, M();
|
|
1114
1114
|
return;
|
|
1115
1115
|
}
|
|
1116
1116
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1117
1117
|
if (n && n.dataset.preview !== "true") {
|
|
1118
|
-
t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, pt(t),
|
|
1118
|
+
t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, pt(t), Jn({
|
|
1119
1119
|
kind: "sticker",
|
|
1120
1120
|
id: $,
|
|
1121
1121
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
@@ -1123,20 +1123,20 @@ function Xn(t) {
|
|
|
1123
1123
|
return;
|
|
1124
1124
|
}
|
|
1125
1125
|
if ($ = null, H === "crop") {
|
|
1126
|
-
t.preventDefault(), pt(t), b = { kind: "crop", start:
|
|
1126
|
+
t.preventDefault(), pt(t), b = { kind: "crop", start: rt(t), current: rt(t) }, vt(), M();
|
|
1127
1127
|
return;
|
|
1128
1128
|
}
|
|
1129
1129
|
if (H === "arrow" || H === "rect" || H === "circle") {
|
|
1130
1130
|
t.preventDefault(), pt(t);
|
|
1131
|
-
const r =
|
|
1131
|
+
const r = ye(t);
|
|
1132
1132
|
b = { kind: "sticker", type: H, start: r, current: r }, vt(), M();
|
|
1133
1133
|
return;
|
|
1134
1134
|
}
|
|
1135
1135
|
M();
|
|
1136
1136
|
}
|
|
1137
|
-
function
|
|
1137
|
+
function Jn(t, e) {
|
|
1138
1138
|
e.preventDefault(), e.stopPropagation();
|
|
1139
|
-
const n =
|
|
1139
|
+
const n = Y().getBoundingClientRect(), r = y.list().find((i) => i.id === t.id);
|
|
1140
1140
|
w = {
|
|
1141
1141
|
...t,
|
|
1142
1142
|
startX: e.clientX,
|
|
@@ -1146,9 +1146,9 @@ function Yn(t, e) {
|
|
|
1146
1146
|
rect: n
|
|
1147
1147
|
}, kt(t.dir === "move" || t.dir === "start" || t.dir === "end"), vt();
|
|
1148
1148
|
}
|
|
1149
|
-
function
|
|
1149
|
+
function we(t) {
|
|
1150
1150
|
if (b) {
|
|
1151
|
-
b.current = b.kind === "crop" ?
|
|
1151
|
+
b.current = b.kind === "crop" ? rt(t) : ye(t), M();
|
|
1152
1152
|
return;
|
|
1153
1153
|
}
|
|
1154
1154
|
if (!w)
|
|
@@ -1174,12 +1174,12 @@ function ye(t) {
|
|
|
1174
1174
|
});
|
|
1175
1175
|
else {
|
|
1176
1176
|
const i = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1177
|
-
|
|
1177
|
+
Qn(i, w.dir, e, n), y.update(r.id, i);
|
|
1178
1178
|
}
|
|
1179
1179
|
M();
|
|
1180
1180
|
}
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1182
|
+
function Qn(t, e, n, r) {
|
|
1183
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")) {
|
|
1184
1184
|
const i = Math.max(0.04, t.w - n);
|
|
1185
1185
|
t.x += t.w - i, t.w = i;
|
|
@@ -1189,26 +1189,26 @@ function Gn(t, e, n, r) {
|
|
|
1189
1189
|
t.y += t.h - i, t.h = i;
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1192
|
+
function it(t) {
|
|
1193
|
+
if (ge(), kt(!1), b) {
|
|
1194
|
+
Zn();
|
|
1195
1195
|
return;
|
|
1196
1196
|
}
|
|
1197
1197
|
if (w) {
|
|
1198
1198
|
if (w.kind === "sticker") {
|
|
1199
|
-
const e =
|
|
1199
|
+
const e = s.canvas.getBoundingClientRect();
|
|
1200
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);
|
|
1201
1201
|
}
|
|
1202
1202
|
w = null, M();
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1205
|
+
function Zn() {
|
|
1206
1206
|
const t = b;
|
|
1207
1207
|
if (b = null, !t)
|
|
1208
1208
|
return;
|
|
1209
1209
|
if (t.kind === "crop") {
|
|
1210
|
-
const n =
|
|
1211
|
-
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) {
|
|
1212
1212
|
M();
|
|
1213
1213
|
return;
|
|
1214
1214
|
}
|
|
@@ -1218,13 +1218,13 @@ function Jn() {
|
|
|
1218
1218
|
y: i.y + n.y * i.h,
|
|
1219
1219
|
w: n.w * i.w,
|
|
1220
1220
|
h: n.h * i.h
|
|
1221
|
-
}),
|
|
1221
|
+
}), G();
|
|
1222
1222
|
return;
|
|
1223
1223
|
}
|
|
1224
|
-
const e =
|
|
1224
|
+
const e = tr(t);
|
|
1225
1225
|
e && ($ = e.id), M();
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1227
|
+
function tr(t) {
|
|
1228
1228
|
if (t.type === "arrow") {
|
|
1229
1229
|
const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
|
|
1230
1230
|
return Math.hypot(e, n) < wt ? y.add("arrow", {
|
|
@@ -1243,51 +1243,51 @@ function Qn(t) {
|
|
|
1243
1243
|
h: Math.abs(n)
|
|
1244
1244
|
});
|
|
1245
1245
|
}
|
|
1246
|
-
return y.add(t.type,
|
|
1246
|
+
return y.add(t.type, st(t.start, t.current));
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1249
|
-
y.resetCrop(), $ = null,
|
|
1248
|
+
function er() {
|
|
1249
|
+
y.resetCrop(), $ = null, G();
|
|
1250
1250
|
}
|
|
1251
1251
|
function xt() {
|
|
1252
|
-
|
|
1252
|
+
s.resetCrop && (s.resetCrop.hidden = !y.isCropped());
|
|
1253
1253
|
}
|
|
1254
|
-
function
|
|
1255
|
-
if (!
|
|
1254
|
+
function Tt(t) {
|
|
1255
|
+
if (!s.audio)
|
|
1256
1256
|
return;
|
|
1257
1257
|
const e = t ? "Stop audio" : "Record audio";
|
|
1258
|
-
|
|
1258
|
+
s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
|
|
1259
1259
|
}
|
|
1260
|
-
function
|
|
1261
|
-
S && (K = S), S = "",
|
|
1260
|
+
function nr() {
|
|
1261
|
+
S && (K = S), S = "", s.stage.hidden = !0, s.restore.hidden = !K;
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1264
|
-
K && (S = K,
|
|
1263
|
+
function rr() {
|
|
1264
|
+
K && (S = K, s.stage.hidden = !1, s.restore.hidden = !0, G());
|
|
1265
1265
|
}
|
|
1266
|
-
function
|
|
1266
|
+
function ir() {
|
|
1267
1267
|
try {
|
|
1268
|
-
if (D || (D =
|
|
1269
|
-
const n =
|
|
1270
|
-
|
|
1268
|
+
if (D || (D = Pn((e) => {
|
|
1269
|
+
const n = s.text.value.trim();
|
|
1270
|
+
s.text.value = n ? `${n} ${e}` : e;
|
|
1271
1271
|
})), !D.isSupported()) {
|
|
1272
1272
|
v("Audio-to-text is not supported in this browser.");
|
|
1273
1273
|
return;
|
|
1274
1274
|
}
|
|
1275
1275
|
const t = D.start();
|
|
1276
|
-
|
|
1276
|
+
Tt(t), v(t ? "Listening…" : "");
|
|
1277
1277
|
} catch (t) {
|
|
1278
1278
|
v(t.message);
|
|
1279
1279
|
}
|
|
1280
1280
|
}
|
|
1281
|
-
async function
|
|
1281
|
+
async function or() {
|
|
1282
1282
|
if (!d.video) {
|
|
1283
1283
|
v("Video is disabled on this host.");
|
|
1284
1284
|
return;
|
|
1285
1285
|
}
|
|
1286
|
-
|
|
1286
|
+
s.dialog.hidden = !0, s.stop.hidden = !1, X(), s.launcher.hidden = !0, q = On({
|
|
1287
1287
|
onStart() {
|
|
1288
1288
|
},
|
|
1289
1289
|
onStop(t) {
|
|
1290
|
-
A = t,
|
|
1290
|
+
A = t, s.stop.hidden = !0, nt(), s.dialog.hidden = !1, G(), v(t ? "Video attached." : "Recording cancelled.");
|
|
1291
1291
|
},
|
|
1292
1292
|
onError(t) {
|
|
1293
1293
|
v(t.message);
|
|
@@ -1296,30 +1296,30 @@ async function rr() {
|
|
|
1296
1296
|
try {
|
|
1297
1297
|
await q.start();
|
|
1298
1298
|
} catch (t) {
|
|
1299
|
-
|
|
1299
|
+
s.stop.hidden = !0, nt(), s.dialog.hidden = !1, v(t.message);
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1303
|
-
if (
|
|
1304
|
-
|
|
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();
|
|
1305
1305
|
return;
|
|
1306
1306
|
}
|
|
1307
|
-
|
|
1308
|
-
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");
|
|
1309
1309
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1310
1310
|
const e = () => {
|
|
1311
|
-
|
|
1311
|
+
ar(t), M();
|
|
1312
1312
|
};
|
|
1313
1313
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e();
|
|
1314
1314
|
}
|
|
1315
|
-
function
|
|
1315
|
+
function ar(t) {
|
|
1316
1316
|
const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
|
|
1317
|
-
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)
|
|
1318
1318
|
return;
|
|
1319
|
-
const r = y.crop(), i = O.w / O.h, o = r.w / r.h * i, a = Math.min(1, o / i),
|
|
1320
|
-
|
|
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}%`;
|
|
1321
1321
|
}
|
|
1322
|
-
function
|
|
1322
|
+
function sr(t) {
|
|
1323
1323
|
return t.type === "arrow" ? {
|
|
1324
1324
|
id: "preview",
|
|
1325
1325
|
type: "arrow",
|
|
@@ -1334,96 +1334,96 @@ function or(t) {
|
|
|
1334
1334
|
id: "preview",
|
|
1335
1335
|
type: t.type,
|
|
1336
1336
|
number: "",
|
|
1337
|
-
...
|
|
1337
|
+
...st(t.start, t.current)
|
|
1338
1338
|
};
|
|
1339
1339
|
}
|
|
1340
1340
|
function M() {
|
|
1341
|
-
if ((
|
|
1341
|
+
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((o) => o.remove()), !S || !s.shot) {
|
|
1342
1342
|
xt();
|
|
1343
1343
|
return;
|
|
1344
1344
|
}
|
|
1345
|
-
const e = y.crop(), n =
|
|
1346
|
-
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") {
|
|
1347
1347
|
const o = document.createElement("div");
|
|
1348
|
-
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);
|
|
1349
1349
|
}
|
|
1350
1350
|
const i = y.list().slice();
|
|
1351
|
-
if ((b == null ? void 0 : b.kind) === "sticker" && i.push(
|
|
1352
|
-
const a = o.id === "preview",
|
|
1353
|
-
if (l.className = `nf-sticker nf-${o.type}`, l.dataset.id = o.id,
|
|
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) {
|
|
1354
1354
|
const u = document.createElement("span");
|
|
1355
1355
|
u.className = "nf-badge", u.textContent = String(o.number), l.appendChild(u);
|
|
1356
1356
|
}
|
|
1357
|
-
|
|
1358
|
-
}),
|
|
1357
|
+
s.shot.appendChild(l);
|
|
1358
|
+
}), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((o) => o.remove()), A) {
|
|
1359
1359
|
const o = document.createElement("video");
|
|
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",
|
|
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);
|
|
1361
1361
|
}
|
|
1362
1362
|
xt();
|
|
1363
1363
|
}
|
|
1364
|
-
function
|
|
1365
|
-
const o =
|
|
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
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
1367
|
<line class="nf-arrow-hit" x1="${j}" y1="${_}" x2="${ct}" y2="${lt}" />
|
|
1368
|
-
<line class="nf-arrow-shaft" x1="${j}" y1="${_}" x2="${
|
|
1369
|
-
<polygon class="nf-arrow-head" points="${
|
|
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
1370
|
`, t.appendChild(N), r && (Et(t, "start", { left: j - 5, top: _ - 5 }), Et(t, "end", { left: ct - 5, top: lt - 5 }));
|
|
1371
1371
|
}
|
|
1372
1372
|
function Et(t, e, n) {
|
|
1373
1373
|
const r = document.createElement("span");
|
|
1374
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);
|
|
1375
1375
|
}
|
|
1376
|
-
function
|
|
1376
|
+
function Gt(t, e, n) {
|
|
1377
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}%`;
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1379
|
+
function lr() {
|
|
1380
1380
|
try {
|
|
1381
|
-
return String(localStorage.getItem(
|
|
1381
|
+
return String(localStorage.getItem(he) || "").trim();
|
|
1382
1382
|
} catch {
|
|
1383
1383
|
return "";
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function ur(t) {
|
|
1387
1387
|
const e = String(t || "").trim();
|
|
1388
1388
|
if (!(!e || e === bt))
|
|
1389
1389
|
try {
|
|
1390
|
-
localStorage.setItem(
|
|
1390
|
+
localStorage.setItem(he, e);
|
|
1391
1391
|
} catch {
|
|
1392
1392
|
}
|
|
1393
1393
|
}
|
|
1394
|
-
function
|
|
1394
|
+
function be() {
|
|
1395
1395
|
return !!(String(R.userId || "").trim() || String(R.email || "").trim() || String(R.displayName || "").trim());
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function dr() {
|
|
1398
1398
|
return String(
|
|
1399
1399
|
R.displayName || R.email || R.userId || ""
|
|
1400
1400
|
).trim();
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1402
|
+
function fr() {
|
|
1403
1403
|
var e;
|
|
1404
|
-
if (
|
|
1405
|
-
return
|
|
1406
|
-
const t = String(((e =
|
|
1407
|
-
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;
|
|
1408
1408
|
}
|
|
1409
|
-
function
|
|
1410
|
-
if (!
|
|
1409
|
+
function Se() {
|
|
1410
|
+
if (!s.author)
|
|
1411
1411
|
return;
|
|
1412
|
-
const t =
|
|
1413
|
-
if (
|
|
1414
|
-
|
|
1412
|
+
const t = be();
|
|
1413
|
+
if (s.author.hidden = t, t) {
|
|
1414
|
+
s.author.value = "";
|
|
1415
1415
|
return;
|
|
1416
1416
|
}
|
|
1417
|
-
|
|
1417
|
+
s.author.value = lr();
|
|
1418
1418
|
}
|
|
1419
|
-
function
|
|
1419
|
+
function ve(t, e = fe) {
|
|
1420
1420
|
const n = Number(t);
|
|
1421
|
-
return Number.isFinite(n) ? Math.min(
|
|
1421
|
+
return Number.isFinite(n) ? Math.min(qn, Math.max(0, Math.floor(n))) : e;
|
|
1422
1422
|
}
|
|
1423
|
-
function
|
|
1424
|
-
|
|
1423
|
+
function xe(t = {}) {
|
|
1424
|
+
An(t);
|
|
1425
1425
|
const e = Object.prototype.hasOwnProperty.call(t, "kinds");
|
|
1426
|
-
|
|
1426
|
+
d = {
|
|
1427
1427
|
...d,
|
|
1428
1428
|
endpoint: String(t.endpoint || d.endpoint || "").replace(/\/$/, ""),
|
|
1429
1429
|
projectKey: t.projectKey == null ? d.projectKey : String(t.projectKey),
|
|
@@ -1431,26 +1431,39 @@ function dr(t = {}) {
|
|
|
1431
1431
|
name: t.name == null ? d.name : String(t.name || ""),
|
|
1432
1432
|
targets: t.targets === void 0 ? d.targets : t.targets,
|
|
1433
1433
|
hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
|
|
1434
|
-
theme:
|
|
1434
|
+
theme: pe(t.theme ?? d.theme),
|
|
1435
1435
|
video: t.video == null ? d.video : !!t.video,
|
|
1436
|
-
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit :
|
|
1437
|
-
kinds: e ?
|
|
1438
|
-
}
|
|
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;
|
|
1439
1442
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
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 });
|
|
1452
|
+
}
|
|
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("");
|
|
1442
1455
|
try {
|
|
1443
|
-
S = await
|
|
1456
|
+
S = await Cn(), K = S, s.stage.hidden = !1, s.restore.hidden = !0, v("");
|
|
1444
1457
|
} catch {
|
|
1445
1458
|
S = "", v("Screenshot failed; you can still send text.");
|
|
1446
1459
|
}
|
|
1447
|
-
|
|
1460
|
+
s.dialog.hidden = !1, G(), s.text.focus();
|
|
1448
1461
|
}
|
|
1449
|
-
function
|
|
1450
|
-
h && (D == null || D.stop(),
|
|
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());
|
|
1451
1464
|
}
|
|
1452
|
-
function
|
|
1453
|
-
const t =
|
|
1465
|
+
function yr() {
|
|
1466
|
+
const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
|
|
1454
1467
|
if (!t || !e || !n || !r)
|
|
1455
1468
|
return Promise.resolve();
|
|
1456
1469
|
$t = !0, v("");
|
|
@@ -1459,8 +1472,8 @@ function fr() {
|
|
|
1459
1472
|
return new Promise((u) => {
|
|
1460
1473
|
window.setTimeout(() => u(), 1e3);
|
|
1461
1474
|
});
|
|
1462
|
-
const a = e.getBoundingClientRect(),
|
|
1463
|
-
return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${
|
|
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) => {
|
|
1464
1477
|
let f = !1;
|
|
1465
1478
|
const p = () => {
|
|
1466
1479
|
f || (f = !0, e.removeEventListener("transitionend", m), window.setTimeout(() => {
|
|
@@ -1474,40 +1487,40 @@ function fr() {
|
|
|
1474
1487
|
}), window.setTimeout(p, 700);
|
|
1475
1488
|
});
|
|
1476
1489
|
}
|
|
1477
|
-
function
|
|
1478
|
-
$t = !1,
|
|
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));
|
|
1479
1492
|
}
|
|
1480
|
-
function
|
|
1481
|
-
R = { ...R, ...
|
|
1493
|
+
function gr(t = {}) {
|
|
1494
|
+
R = { ...R, ...Rn(t) }, Se();
|
|
1482
1495
|
}
|
|
1483
|
-
async function
|
|
1496
|
+
async function Me() {
|
|
1484
1497
|
if (Rt(), ht)
|
|
1485
1498
|
return null;
|
|
1486
|
-
const t =
|
|
1499
|
+
const t = s.text.value.trim();
|
|
1487
1500
|
if (!t && !S && !A)
|
|
1488
1501
|
return v("Add a note, screenshot, or video first."), null;
|
|
1489
1502
|
if (!d.endpoint || !d.projectKey)
|
|
1490
1503
|
return v("Notefully is missing endpoint or projectKey."), null;
|
|
1491
|
-
ht = !0,
|
|
1504
|
+
ht = !0, Jt(!0), v("Submitting…", !0);
|
|
1492
1505
|
try {
|
|
1493
|
-
const e =
|
|
1506
|
+
const e = fr(), n = new FormData();
|
|
1494
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({
|
|
1495
|
-
|
|
1508
|
+
...$n({
|
|
1496
1509
|
...R,
|
|
1497
1510
|
displayName: R.displayName || e
|
|
1498
1511
|
}),
|
|
1499
1512
|
author: e,
|
|
1500
|
-
console:
|
|
1513
|
+
console: de.snapshot().slice(-ve(d.consoleLogLimit))
|
|
1501
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) {
|
|
1502
|
-
const o = await
|
|
1515
|
+
const o = await Kn(S);
|
|
1503
1516
|
if (n.append("screenshot", o, "screenshot.png"), y.list().length || y.isCropped()) {
|
|
1504
|
-
const a = await
|
|
1517
|
+
const a = await _n(
|
|
1505
1518
|
S,
|
|
1506
1519
|
y.crop(),
|
|
1507
1520
|
y.list(),
|
|
1508
1521
|
{
|
|
1509
|
-
mark:
|
|
1510
|
-
markText:
|
|
1522
|
+
mark: Kt("--nf-mark", "#fdd341"),
|
|
1523
|
+
markText: Kt("--nf-mark-text", "#2a2140")
|
|
1511
1524
|
}
|
|
1512
1525
|
);
|
|
1513
1526
|
n.append("screenshotBaked", a, "screenshot.baked.png");
|
|
@@ -1529,25 +1542,28 @@ async function xe() {
|
|
|
1529
1542
|
}
|
|
1530
1543
|
if (!r.ok)
|
|
1531
1544
|
throw v((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
|
|
1532
|
-
return await
|
|
1545
|
+
return await yr(), J(), i;
|
|
1533
1546
|
} finally {
|
|
1534
|
-
ht = !1,
|
|
1547
|
+
ht = !1, Jt(!1);
|
|
1535
1548
|
}
|
|
1536
1549
|
}
|
|
1537
|
-
function
|
|
1538
|
-
|
|
1550
|
+
function Jt(t) {
|
|
1551
|
+
s.submit && (s.submit.disabled = !!t, s.submit.setAttribute("aria-busy", t ? "true" : "false"));
|
|
1539
1552
|
}
|
|
1540
|
-
function
|
|
1541
|
-
|
|
1553
|
+
function wr() {
|
|
1554
|
+
J(), h == null || h.remove(), h = null, s = {};
|
|
1542
1555
|
}
|
|
1543
|
-
const
|
|
1544
|
-
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);
|
|
1545
1558
|
export {
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
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
|
|
1553
1569
|
};
|