@makefully/notefully 0.1.9 → 0.1.11

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/dist/notefully.js CHANGED
@@ -1,4 +1,4 @@
1
- function fe(t, e) {
1
+ function me(t, e) {
2
2
  if (t.match(/^[a-z]+:\/\//i))
3
3
  return t;
4
4
  if (t.match(/^\/\//))
@@ -8,7 +8,7 @@ function fe(t, e) {
8
8
  const n = document.implementation.createHTMLDocument(), r = n.createElement("base"), o = n.createElement("a");
9
9
  return n.head.appendChild(r), n.body.appendChild(o), e && (r.href = e), o.href = t, o.href;
10
10
  }
11
- const he = /* @__PURE__ */ (() => {
11
+ const ye = /* @__PURE__ */ (() => {
12
12
  let t = 0;
13
13
  const e = () => (
14
14
  // eslint-disable-next-line no-bitwise
@@ -23,26 +23,26 @@ function H(t) {
23
23
  return e;
24
24
  }
25
25
  let _ = null;
26
- function Nt(t = {}) {
26
+ function Vt(t = {}) {
27
27
  return _ || (t.includeStyleProperties ? (_ = t.includeStyleProperties, _) : (_ = H(window.getComputedStyle(document.documentElement)), _));
28
28
  }
29
29
  function K(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 pe(t) {
33
+ function ge(t) {
34
34
  const e = K(t, "border-left-width"), n = K(t, "border-right-width");
35
35
  return t.clientWidth + e + n;
36
36
  }
37
- function me(t) {
37
+ function we(t) {
38
38
  const e = K(t, "border-top-width"), n = K(t, "border-bottom-width");
39
39
  return t.clientHeight + e + n;
40
40
  }
41
41
  function Wt(t, e = {}) {
42
- const n = e.width || pe(t), r = e.height || me(t);
42
+ const n = e.width || ge(t), r = e.height || we(t);
43
43
  return { width: n, height: r };
44
44
  }
45
- function ye() {
45
+ function be() {
46
46
  let t, e;
47
47
  try {
48
48
  e = process;
@@ -52,10 +52,10 @@ function ye() {
52
52
  return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
53
53
  }
54
54
  const E = 16384;
55
- function ge(t) {
55
+ function ve(t) {
56
56
  (t.width > E || t.height > E) && (t.width > E && t.height > E ? t.width > t.height ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E) : t.width > E ? (t.height *= E / t.width, t.width = E) : (t.width *= E / t.height, t.height = E));
57
57
  }
58
- function Y(t) {
58
+ function G(t) {
59
59
  return new Promise((e, n) => {
60
60
  const r = new Image();
61
61
  r.onload = () => {
@@ -65,12 +65,12 @@ function Y(t) {
65
65
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
66
66
  });
67
67
  }
68
- async function we(t) {
68
+ async function Se(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 be(t, e, n) {
71
+ async function xe(t, e, n) {
72
72
  const r = "http://www.w3.org/2000/svg", o = document.createElementNS(r, "svg"), i = document.createElementNS(r, "foreignObject");
73
- return o.setAttribute("width", `${e}`), o.setAttribute("height", `${n}`), o.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), o.appendChild(i), i.appendChild(t), we(o);
73
+ return o.setAttribute("width", `${e}`), o.setAttribute("height", `${n}`), o.setAttribute("viewBox", `0 0 ${e} ${n}`), i.setAttribute("width", "100%"), i.setAttribute("height", "100%"), i.setAttribute("x", "0"), i.setAttribute("y", "0"), i.setAttribute("externalResourcesRequired", "true"), o.appendChild(i), i.appendChild(t), Se(o);
74
74
  }
75
75
  const x = (t, e) => {
76
76
  if (t instanceof e)
@@ -78,64 +78,64 @@ const x = (t, e) => {
78
78
  const n = Object.getPrototypeOf(t);
79
79
  return n === null ? !1 : n.constructor.name === e.name || x(n, e);
80
80
  };
81
- function ve(t) {
81
+ function Ee(t) {
82
82
  const e = t.getPropertyValue("content");
83
83
  return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
84
84
  }
85
- function Se(t, e) {
86
- return Nt(e).map((n) => {
85
+ function Ce(t, e) {
86
+ return Vt(e).map((n) => {
87
87
  const r = t.getPropertyValue(n), o = t.getPropertyPriority(n);
88
88
  return `${n}: ${r}${o ? " !important" : ""};`;
89
89
  }).join(" ");
90
90
  }
91
- function xe(t, e, n, r) {
92
- const o = `.${t}:${e}`, i = n.cssText ? ve(n) : Se(n, r);
91
+ function Me(t, e, n, r) {
92
+ const o = `.${t}:${e}`, i = n.cssText ? Ee(n) : Ce(n, r);
93
93
  return document.createTextNode(`${o}{${i}}`);
94
94
  }
95
95
  function $t(t, e, n, r) {
96
96
  const o = window.getComputedStyle(t, n), i = o.getPropertyValue("content");
97
97
  if (i === "" || i === "none")
98
98
  return;
99
- const a = he();
99
+ const a = ye();
100
100
  try {
101
101
  e.className = `${e.className} ${a}`;
102
102
  } catch {
103
103
  return;
104
104
  }
105
105
  const s = document.createElement("style");
106
- s.appendChild(xe(a, n, o, r)), e.appendChild(s);
106
+ s.appendChild(Me(a, n, o, r)), e.appendChild(s);
107
107
  }
108
- function Ee(t, e, n) {
108
+ function Le(t, e, n) {
109
109
  $t(t, e, ":before", n), $t(t, e, ":after", n);
110
110
  }
111
- const Rt = "application/font-woff", Pt = "image/jpeg", Ce = {
111
+ const Rt = "application/font-woff", At = "image/jpeg", $e = {
112
112
  woff: Rt,
113
113
  woff2: Rt,
114
114
  ttf: "application/font-truetype",
115
115
  eot: "application/vnd.ms-fontobject",
116
116
  png: "image/png",
117
- jpg: Pt,
118
- jpeg: Pt,
117
+ jpg: At,
118
+ jpeg: At,
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 Me(t) {
124
+ function Re(t) {
125
125
  const e = /\.([^./]*?)$/g.exec(t);
126
126
  return e ? e[1] : "";
127
127
  }
128
128
  function St(t) {
129
- const e = Me(t).toLowerCase();
130
- return Ce[e] || "";
129
+ const e = Re(t).toLowerCase();
130
+ return $e[e] || "";
131
131
  }
132
- function Le(t) {
132
+ function Ae(t) {
133
133
  return t.split(/,/)[1];
134
134
  }
135
- function dt(t) {
135
+ function ft(t) {
136
136
  return t.search(/^(data:)/) !== -1;
137
137
  }
138
- function $e(t, e) {
138
+ function Pe(t, e) {
139
139
  return `data:${e};base64,${t}`;
140
140
  }
141
141
  async function qt(t, e, n) {
@@ -154,86 +154,86 @@ async function qt(t, e, n) {
154
154
  }, s.readAsDataURL(o);
155
155
  });
156
156
  }
157
- const st = {};
158
- function Re(t, e, n) {
157
+ const ct = {};
158
+ function Te(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 xt(t, e, n) {
163
- const r = Re(t, e, n.includeQueryParams);
164
- if (st[r] != null)
165
- return st[r];
163
+ const r = Te(t, e, n.includeQueryParams);
164
+ if (ct[r] != null)
165
+ return ct[r];
166
166
  n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
167
167
  let o;
168
168
  try {
169
- const i = await qt(t, n.fetchRequestInit, ({ res: a, result: s }) => (e || (e = a.headers.get("Content-Type") || ""), Le(s)));
170
- o = $e(i, e);
169
+ const i = await qt(t, n.fetchRequestInit, ({ res: a, result: s }) => (e || (e = a.headers.get("Content-Type") || ""), Ae(s)));
170
+ o = Pe(i, e);
171
171
  } catch (i) {
172
172
  o = n.imagePlaceholder || "";
173
173
  let a = `Failed to fetch resource: ${t}`;
174
174
  i && (a = typeof i == "string" ? i : i.message), a && console.warn(a);
175
175
  }
176
- return st[r] = o, o;
176
+ return ct[r] = o, o;
177
177
  }
178
- async function Pe(t) {
178
+ async function ke(t) {
179
179
  const e = t.toDataURL();
180
- return e === "data:," ? t.cloneNode(!1) : Y(e);
180
+ return e === "data:," ? t.cloneNode(!1) : G(e);
181
181
  }
182
- async function Ae(t, e) {
182
+ async function Ie(t, e) {
183
183
  if (t.currentSrc) {
184
184
  const i = document.createElement("canvas"), a = i.getContext("2d");
185
185
  i.width = t.clientWidth, i.height = t.clientHeight, a == null || a.drawImage(t, 0, 0, i.width, i.height);
186
186
  const s = i.toDataURL();
187
- return Y(s);
187
+ return G(s);
188
188
  }
189
189
  const n = t.poster, r = St(n), o = await xt(n, r, e);
190
- return Y(o);
190
+ return G(o);
191
191
  }
192
- async function Te(t, e) {
192
+ async function Oe(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 et(t.contentDocument.body, e, !0);
196
+ return await nt(t.contentDocument.body, e, !0);
197
197
  } catch {
198
198
  }
199
199
  return t.cloneNode(!1);
200
200
  }
201
- async function ke(t, e) {
202
- return x(t, HTMLCanvasElement) ? Pe(t) : x(t, HTMLVideoElement) ? Ae(t, e) : x(t, HTMLIFrameElement) ? Te(t, e) : t.cloneNode(zt(t));
201
+ async function He(t, e) {
202
+ return x(t, HTMLCanvasElement) ? ke(t) : x(t, HTMLVideoElement) ? Ie(t, e) : x(t, HTMLIFrameElement) ? Oe(t, e) : t.cloneNode(zt(t));
203
203
  }
204
- const Ie = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", zt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
- async function Oe(t, e, n) {
204
+ const De = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", zt = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
+ async function Fe(t, e, n) {
206
206
  var r, o;
207
207
  if (zt(e))
208
208
  return e;
209
209
  let i = [];
210
- return Ie(t) && t.assignedNodes ? i = H(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = H(t.contentDocument.body.childNodes) : i = H(((o = t.shadowRoot) !== null && o !== void 0 ? o : t).childNodes), i.length === 0 || x(t, HTMLVideoElement) || await i.reduce((a, s) => a.then(() => et(s, n)).then((l) => {
210
+ return De(t) && t.assignedNodes ? i = H(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? i = H(t.contentDocument.body.childNodes) : i = H(((o = t.shadowRoot) !== null && o !== void 0 ? o : t).childNodes), i.length === 0 || x(t, HTMLVideoElement) || await i.reduce((a, s) => a.then(() => nt(s, n)).then((l) => {
211
211
  l && e.appendChild(l);
212
212
  }), Promise.resolve()), e;
213
213
  }
214
- function He(t, e, n) {
214
+ function Ue(t, e, n) {
215
215
  const r = e.style;
216
216
  if (!r)
217
217
  return;
218
218
  const o = window.getComputedStyle(t);
219
- o.cssText ? (r.cssText = o.cssText, r.transformOrigin = o.transformOrigin) : Nt(n).forEach((i) => {
219
+ o.cssText ? (r.cssText = o.cssText, r.transformOrigin = o.transformOrigin) : Vt(n).forEach((i) => {
220
220
  let a = o.getPropertyValue(i);
221
221
  i === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && i === "display" && a === "inline" && (a = "block"), i === "d" && e.getAttribute("d") && (a = `path(${e.getAttribute("d")})`), r.setProperty(i, a, o.getPropertyPriority(i));
222
222
  });
223
223
  }
224
- function De(t, e) {
224
+ function je(t, e) {
225
225
  x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
226
226
  }
227
- function Fe(t, e) {
227
+ function _e(t, e) {
228
228
  if (x(t, HTMLSelectElement)) {
229
229
  const r = Array.from(e.children).find((o) => t.value === o.getAttribute("value"));
230
230
  r && r.setAttribute("selected", "");
231
231
  }
232
232
  }
233
- function je(t, e, n) {
234
- return x(e, Element) && (He(t, e, n), Ee(t, e, n), De(t, e), Fe(t, e)), e;
233
+ function Ne(t, e, n) {
234
+ return x(e, Element) && (Ue(t, e, n), Le(t, e, n), je(t, e), _e(t, e)), e;
235
235
  }
236
- async function Ue(t, e) {
236
+ async function Be(t, e) {
237
237
  const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
238
238
  if (n.length === 0)
239
239
  return t;
@@ -242,7 +242,7 @@ async function Ue(t, e) {
242
242
  const s = n[i].getAttribute("xlink:href");
243
243
  if (s) {
244
244
  const l = t.querySelector(s), u = document.querySelector(s);
245
- !l && u && !r[s] && (r[s] = await et(u, e, !0));
245
+ !l && u && !r[s] && (r[s] = await nt(u, e, !0));
246
246
  }
247
247
  }
248
248
  const o = Object.values(r);
@@ -257,31 +257,31 @@ async function Ue(t, e) {
257
257
  }
258
258
  return t;
259
259
  }
260
- async function et(t, e, n) {
261
- return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => ke(r, e)).then((r) => Oe(t, r, e)).then((r) => je(t, r, e)).then((r) => Ue(r, e));
260
+ async function nt(t, e, n) {
261
+ return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => He(r, e)).then((r) => Fe(t, r, e)).then((r) => Ne(t, r, e)).then((r) => Be(r, e));
262
262
  }
263
- const Xt = /url\((['"]?)([^'"]+?)\1\)/g, _e = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Be = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
- function Ve(t) {
263
+ const Xt = /url\((['"]?)([^'"]+?)\1\)/g, Ve = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, We = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
+ function qe(t) {
265
265
  const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
266
266
  return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
267
267
  }
268
- function Ne(t) {
268
+ function ze(t) {
269
269
  const e = [];
270
- return t.replace(Xt, (n, r, o) => (e.push(o), n)), e.filter((n) => !dt(n));
270
+ return t.replace(Xt, (n, r, o) => (e.push(o), n)), e.filter((n) => !ft(n));
271
271
  }
272
- async function We(t, e, n, r, o) {
272
+ async function Xe(t, e, n, r, o) {
273
273
  try {
274
- const i = n ? fe(e, n) : e, a = St(e);
274
+ const i = n ? me(e, n) : e, a = St(e);
275
275
  let s;
276
- return o || (s = await xt(i, a, r)), t.replace(Ve(e), `$1${s}$3`);
276
+ return o || (s = await xt(i, a, r)), t.replace(qe(e), `$1${s}$3`);
277
277
  } catch {
278
278
  }
279
279
  return t;
280
280
  }
281
- function qe(t, { preferredFontFormat: e }) {
282
- return e ? t.replace(Be, (n) => {
281
+ function Ye(t, { preferredFontFormat: e }) {
282
+ return e ? t.replace(We, (n) => {
283
283
  for (; ; ) {
284
- const [r, , o] = _e.exec(n) || [];
284
+ const [r, , o] = Ve.exec(n) || [];
285
285
  if (!o)
286
286
  return "";
287
287
  if (o === e)
@@ -289,30 +289,30 @@ function qe(t, { preferredFontFormat: e }) {
289
289
  }
290
290
  }) : t;
291
291
  }
292
- function Kt(t) {
292
+ function Yt(t) {
293
293
  return t.search(Xt) !== -1;
294
294
  }
295
- async function Yt(t, e, n) {
296
- if (!Kt(t))
295
+ async function Kt(t, e, n) {
296
+ if (!Yt(t))
297
297
  return t;
298
- const r = qe(t, n);
299
- return Ne(r).reduce((i, a) => i.then((s) => We(s, a, e, n)), Promise.resolve(r));
298
+ const r = Ye(t, n);
299
+ return ze(r).reduce((i, a) => i.then((s) => Xe(s, a, e, n)), Promise.resolve(r));
300
300
  }
301
- async function B(t, e, n) {
301
+ async function N(t, e, n) {
302
302
  var r;
303
303
  const o = (r = e.style) === null || r === void 0 ? void 0 : r.getPropertyValue(t);
304
304
  if (o) {
305
- const i = await Yt(o, null, n);
305
+ const i = await Kt(o, null, n);
306
306
  return e.style.setProperty(t, i, e.style.getPropertyPriority(t)), !0;
307
307
  }
308
308
  return !1;
309
309
  }
310
- async function ze(t, e) {
311
- await B("background", t, e) || await B("background-image", t, e), await B("mask", t, e) || await B("-webkit-mask", t, e) || await B("mask-image", t, e) || await B("-webkit-mask-image", t, e);
310
+ async function Ke(t, e) {
311
+ await N("background", t, e) || await N("background-image", t, e), await N("mask", t, e) || await N("-webkit-mask", t, e) || await N("mask-image", t, e) || await N("-webkit-mask-image", t, e);
312
312
  }
313
- async function Xe(t, e) {
313
+ async function Ge(t, e) {
314
314
  const n = x(t, HTMLImageElement);
315
- if (!(n && !dt(t.src)) && !(x(t, SVGImageElement) && !dt(t.href.baseVal)))
315
+ if (!(n && !ft(t.src)) && !(x(t, SVGImageElement) && !ft(t.href.baseVal)))
316
316
  return;
317
317
  const r = n ? t.src : t.href.baseVal, o = await xt(r, St(r), e);
318
318
  await new Promise((i, a) => {
@@ -327,14 +327,14 @@ async function Xe(t, e) {
327
327
  s.decode && (s.decode = i), s.loading === "lazy" && (s.loading = "eager"), n ? (t.srcset = "", t.src = o) : t.href.baseVal = o;
328
328
  });
329
329
  }
330
- async function Ke(t, e) {
330
+ async function Je(t, e) {
331
331
  const r = H(t.childNodes).map((o) => Gt(o, e));
332
332
  await Promise.all(r).then(() => t);
333
333
  }
334
334
  async function Gt(t, e) {
335
- x(t, Element) && (await ze(t, e), await Xe(t, e), await Ke(t, e));
335
+ x(t, Element) && (await Ke(t, e), await Ge(t, e), await Je(t, e));
336
336
  }
337
- function Ye(t, e) {
337
+ function Qe(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,13 +342,13 @@ function Ye(t, e) {
342
342
  n[o] = r[o];
343
343
  }), t;
344
344
  }
345
- const At = {};
345
+ const Pt = {};
346
346
  async function Tt(t) {
347
- let e = At[t];
347
+ let e = Pt[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 }, At[t] = e, e;
351
+ return e = { url: t, cssText: r }, Pt[t] = e, e;
352
352
  }
353
353
  async function kt(t, e) {
354
354
  let n = t.cssText;
@@ -384,7 +384,7 @@ function It(t) {
384
384
  }
385
385
  return e;
386
386
  }
387
- async function Ge(t, e) {
387
+ async function Ze(t, e) {
388
388
  const n = [], r = [];
389
389
  return t.forEach((o) => {
390
390
  if ("cssRules" in o)
@@ -426,19 +426,19 @@ async function Ge(t, e) {
426
426
  }
427
427
  }), n));
428
428
  }
429
- function Je(t) {
430
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Kt(e.style.getPropertyValue("src")));
429
+ function tn(t) {
430
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Yt(e.style.getPropertyValue("src")));
431
431
  }
432
- async function Qe(t, e) {
432
+ async function en(t, e) {
433
433
  if (t.ownerDocument == null)
434
434
  throw new Error("Provided element is not within a Document");
435
- const n = H(t.ownerDocument.styleSheets), r = await Ge(n, e);
436
- return Je(r);
435
+ const n = H(t.ownerDocument.styleSheets), r = await Ze(n, e);
436
+ return tn(r);
437
437
  }
438
438
  function Jt(t) {
439
439
  return t.trim().replace(/["']/g, "");
440
440
  }
441
- function Ze(t) {
441
+ function nn(t) {
442
442
  const e = /* @__PURE__ */ new Set();
443
443
  function n(r) {
444
444
  (r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((i) => {
@@ -449,37 +449,37 @@ function Ze(t) {
449
449
  }
450
450
  return n(t), e;
451
451
  }
452
- async function tn(t, e) {
453
- const n = await Qe(t, e), r = Ze(t);
452
+ async function rn(t, e) {
453
+ const n = await en(t, e), r = nn(t);
454
454
  return (await Promise.all(n.filter((i) => r.has(Jt(i.style.fontFamily))).map((i) => {
455
455
  const a = i.parentStyleSheet ? i.parentStyleSheet.href : null;
456
- return Yt(i.cssText, a, e);
456
+ return Kt(i.cssText, a, e);
457
457
  }))).join(`
458
458
  `);
459
459
  }
460
- async function en(t, e) {
461
- const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await tn(t, e);
460
+ async function on(t, e) {
461
+ const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await rn(t, e);
462
462
  if (n) {
463
463
  const r = document.createElement("style"), o = document.createTextNode(n);
464
464
  r.appendChild(o), t.firstChild ? t.insertBefore(r, t.firstChild) : t.appendChild(r);
465
465
  }
466
466
  }
467
- async function nn(t, e = {}) {
468
- const { width: n, height: r } = Wt(t, e), o = await et(t, e, !0);
469
- return await en(o, e), await Gt(o, e), Ye(o, e), await be(o, n, r);
467
+ async function an(t, e = {}) {
468
+ const { width: n, height: r } = Wt(t, e), o = await nt(t, e, !0);
469
+ return await on(o, e), await Gt(o, e), Qe(o, e), await xe(o, n, r);
470
470
  }
471
- async function rn(t, e = {}) {
472
- const { width: n, height: r } = Wt(t, e), o = await nn(t, e), i = await Y(o), a = document.createElement("canvas"), s = a.getContext("2d"), l = e.pixelRatio || ye(), u = e.canvasWidth || n, d = e.canvasHeight || r;
473
- return a.width = u * l, a.height = d * l, e.skipAutoScale || ge(a), a.style.width = `${u}`, a.style.height = `${d}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, a.width, a.height)), s.drawImage(i, 0, 0, a.width, a.height), a;
471
+ async function sn(t, e = {}) {
472
+ const { width: n, height: r } = Wt(t, e), o = await an(t, e), i = await G(o), a = document.createElement("canvas"), s = a.getContext("2d"), l = e.pixelRatio || be(), u = e.canvasWidth || n, d = e.canvasHeight || r;
473
+ return a.width = u * l, a.height = d * l, e.skipAutoScale || ve(a), a.style.width = `${u}`, a.style.height = `${d}`, e.backgroundColor && (s.fillStyle = e.backgroundColor, s.fillRect(0, 0, a.width, a.height)), s.drawImage(i, 0, 0, a.width, a.height), a;
474
474
  }
475
- async function on(t, e = {}) {
476
- return (await rn(t, e)).toDataURL();
475
+ async function cn(t, e = {}) {
476
+ return (await sn(t, e)).toDataURL();
477
477
  }
478
- const G = "data-nf-capture-chrome";
479
- function an(t) {
480
- return t instanceof Element && (t.hasAttribute(G) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
478
+ const J = "data-nf-capture-chrome";
479
+ function ln(t) {
480
+ return t instanceof Element && (t.hasAttribute(J) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
481
481
  }
482
- function sn() {
482
+ function un() {
483
483
  const t = [];
484
484
  return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
485
485
  const r = n.getBoundingClientRect(), o = document.createElement("div");
@@ -495,47 +495,47 @@ function sn() {
495
495
  ].join(";"), document.body.appendChild(o), t.push(o);
496
496
  }), () => t.forEach((n) => n.remove());
497
497
  }
498
- function cn() {
499
- const t = document.querySelector(`[${G}]`);
498
+ function dn() {
499
+ const t = document.querySelector(`[${J}]`);
500
500
  if (t)
501
501
  return t;
502
502
  const e = document.createElement("div");
503
- return e.setAttribute(G, "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;
503
+ return e.setAttribute(J, "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 ln() {
506
- document.querySelectorAll(`[${G}]`).forEach((t) => t.remove());
505
+ function fn() {
506
+ document.querySelectorAll(`[${J}]`).forEach((t) => t.remove());
507
507
  }
508
- async function un() {
509
- const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = cn();
508
+ async function hn() {
509
+ const t = document.getElementById("notefully"), e = t ? t.style.display : "", n = dn();
510
510
  t && (t.style.display = "none");
511
- const r = sn();
511
+ const r = un();
512
512
  await new Promise((o) => requestAnimationFrame(() => requestAnimationFrame(o)));
513
513
  try {
514
- return await on(document.body, {
514
+ return await cn(document.body, {
515
515
  cacheBust: !0,
516
516
  pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
517
- filter: (o) => !an(o)
517
+ filter: (o) => !ln(o)
518
518
  });
519
519
  } finally {
520
- r(), n.remove(), ln(), t && (t.style.display = e);
520
+ r(), n.remove(), fn(), t && (t.style.display = e);
521
521
  }
522
522
  }
523
- function dn(t = "") {
523
+ function pn(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 fn(t = "") {
527
+ function mn(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 hn(t = {}) {
531
+ function yn(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: dn(e),
538
- browser: fn(e),
537
+ os: pn(e),
538
+ browser: mn(e),
539
539
  language: navigator.language,
540
540
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
541
541
  viewport: {
@@ -573,7 +573,7 @@ const Ot = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), Ht = {
573
573
  email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
574
574
  displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
575
575
  };
576
- function pn(t = {}, e = {}) {
576
+ function gn(t = {}, e = {}) {
577
577
  const n = e.warn || Qt, r = t && typeof t == "object" ? t : {}, o = {}, i = [];
578
578
  for (const a of Ot)
579
579
  Object.prototype.hasOwnProperty.call(r, a) && (o[a] = r[a]);
@@ -589,7 +589,7 @@ function pn(t = {}, e = {}) {
589
589
  }
590
590
  return o;
591
591
  }
592
- function mn(t = {}, e = {}) {
592
+ function wn(t = {}, e = {}) {
593
593
  const n = e.warn || Qt, r = t && typeof t == "object" ? t : {}, o = Object.keys(r).filter((i) => !Dt.has(i));
594
594
  if (o.length)
595
595
  for (const i of o) {
@@ -605,8 +605,8 @@ function mn(t = {}, e = {}) {
605
605
  function Qt(t) {
606
606
  typeof console < "u" && typeof console.warn == "function" && console.warn(t);
607
607
  }
608
- const yn = 80;
609
- function gn() {
608
+ const bn = 80;
609
+ function vn() {
610
610
  const t = [], e = {};
611
611
  let n = !1;
612
612
  const r = (i, a) => {
@@ -620,7 +620,7 @@ function gn() {
620
620
  level: i,
621
621
  text: s.slice(0, 2e3),
622
622
  at: Date.now()
623
- }), t.length > yn && t.shift();
623
+ }), t.length > bn && t.shift();
624
624
  };
625
625
  return {
626
626
  hook: () => {
@@ -639,7 +639,7 @@ function gn() {
639
639
  }
640
640
  };
641
641
  }
642
- function wn(t) {
642
+ function Sn(t) {
643
643
  const e = window.SpeechRecognition || window.webkitSpeechRecognition;
644
644
  let n = null, r = !1;
645
645
  const o = () => {
@@ -669,8 +669,8 @@ function wn(t) {
669
669
  isActive: () => r
670
670
  };
671
671
  }
672
- const bn = 60 * 1e3;
673
- function vn({ onStart: t, onStop: e, onError: n }) {
672
+ const xn = 60 * 1e3;
673
+ function En({ onStart: t, onStop: e, onError: n }) {
674
674
  let r = null, o = null, i = [], a = null;
675
675
  const s = () => {
676
676
  if (a && (clearTimeout(a), a = null), o && o.state !== "inactive")
@@ -702,10 +702,10 @@ function vn({ onStart: t, onStop: e, onError: n }) {
702
702
  }, o.onstop = () => {
703
703
  const m = i.length ? new Blob(i, { type: o.mimeType || "video/webm" }) : null;
704
704
  s(), e(m);
705
- }, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), o.start(), a = setTimeout(l, bn);
705
+ }, (p = r.getVideoTracks()[0]) == null || p.addEventListener("ended", () => l()), o.start(), a = setTimeout(l, xn);
706
706
  }, stop: l };
707
707
  }
708
- function Sn() {
708
+ function Cn() {
709
709
  const t = /* @__PURE__ */ new Set();
710
710
  return {
711
711
  alloc() {
@@ -723,19 +723,19 @@ function Sn() {
723
723
  }
724
724
  };
725
725
  }
726
- const ct = { x: 0, y: 0, w: 1, h: 1 };
726
+ const lt = { x: 0, y: 0, w: 1, h: 1 };
727
727
  function Zt() {
728
- const t = Sn();
729
- let e = [], n = { ...ct }, r = 1;
728
+ const t = Cn();
729
+ let e = [], n = { ...lt }, r = 1;
730
730
  return {
731
- list: () => e.filter((i) => En(i, n)),
731
+ list: () => e.filter((i) => Ln(i, n)),
732
732
  all: () => e.slice(),
733
733
  crop: () => ({ ...n }),
734
734
  setCrop(i) {
735
- return n = xn(i), n;
735
+ return n = Mn(i), n;
736
736
  },
737
737
  resetCrop() {
738
- return n = { ...ct }, n;
738
+ return n = { ...lt }, n;
739
739
  },
740
740
  isCropped() {
741
741
  return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
@@ -767,16 +767,16 @@ function Zt() {
767
767
  return t.free(s.number), s;
768
768
  },
769
769
  reset() {
770
- for (e = [], n = { ...ct }, r = 1; t.peekUsed().length; )
770
+ for (e = [], n = { ...lt }, r = 1; t.peekUsed().length; )
771
771
  t.free(t.peekUsed()[0]);
772
772
  }
773
773
  };
774
774
  }
775
- function xn(t) {
775
+ function Mn(t) {
776
776
  const e = Math.min(Math.max(t.x, 0), 0.95), n = Math.min(Math.max(t.y, 0), 0.95), r = Math.min(Math.max(t.w, 0.05), 1 - e), o = Math.min(Math.max(t.h, 0.05), 1 - n);
777
777
  return { x: e, y: n, w: r, h: o };
778
778
  }
779
- function En(t, e) {
779
+ function Ln(t, e) {
780
780
  const n = t.type === "arrow" ? (t.x + (t.x2 ?? t.x)) / 2 : t.x + (t.w || 0) / 2, r = t.type === "arrow" ? (t.y + (t.y2 ?? t.y)) / 2 : t.y + (t.h || 0) / 2;
781
781
  return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
782
782
  }
@@ -790,7 +790,7 @@ function Et(t) {
790
790
  arrowHeadAngle: 0.4
791
791
  };
792
792
  }
793
- function Cn(t, {
793
+ function $n(t, {
794
794
  stickers: e = [],
795
795
  crop: n = { x: 0, y: 0, w: 1, h: 1 },
796
796
  width: r,
@@ -799,7 +799,7 @@ function Cn(t, {
799
799
  }) {
800
800
  const a = i.mark || "#fdd341", s = i.markText || "#2a2140", l = Et(r);
801
801
  t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = a, t.fillStyle = a, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
802
- const d = ft(u.x, n, r), p = ht(u.y, n, o), m = u.w / n.w * r, C = u.h / n.h * o, L = l.stroke / 2;
802
+ const d = ht(u.x, n, r), p = pt(u.y, n, o), m = u.w / n.w * r, C = u.h / n.h * o, L = l.stroke / 2;
803
803
  if (u.type === "rect")
804
804
  t.strokeRect(
805
805
  d + L,
@@ -818,24 +818,24 @@ function Cn(t, {
818
818
  Math.PI * 2
819
819
  ), t.stroke();
820
820
  else if (u.type === "arrow") {
821
- const F = ft(u.x2 ?? u.x + u.w, n, r), j = ht(u.y2 ?? u.y, n, o);
822
- Ln(t, d, p, F, j, l);
821
+ const F = ht(u.x2 ?? u.x + u.w, n, r), U = pt(u.y2 ?? u.y, n, o);
822
+ An(t, d, p, F, U, l);
823
823
  }
824
824
  if (u.number == null || u.number === "")
825
825
  return;
826
- const P = Mn(u, n, r, o, d, p, m), V = String(u.number);
827
- t.beginPath(), t.arc(P.x, P.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = s, t.textAlign = "center", t.textBaseline = "middle", t.fillText(V, P.x, P.y + 0.5), t.fillStyle = a;
826
+ const A = Rn(u, n, r, o, d, p, m), B = String(u.number);
827
+ t.beginPath(), t.arc(A.x, A.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = a, t.fill(), t.fillStyle = s, t.textAlign = "center", t.textBaseline = "middle", t.fillText(B, A.x, A.y + 0.5), t.fillStyle = a;
828
828
  }), t.restore();
829
829
  }
830
- function ft(t, e, n) {
830
+ function ht(t, e, n) {
831
831
  return (t - e.x) / e.w * n;
832
832
  }
833
- function ht(t, e, n) {
833
+ function pt(t, e, n) {
834
834
  return (t - e.y) / e.h * n;
835
835
  }
836
- function Mn(t, e, n, r, o, i, a) {
836
+ function Rn(t, e, n, r, o, i, a) {
837
837
  if (t.type === "arrow") {
838
- const s = ft(t.x2 ?? t.x + t.w, e, n), l = ht(t.y2 ?? t.y, e, r);
838
+ const s = ht(t.x2 ?? t.x + t.w, e, n), l = pt(t.y2 ?? t.y, e, r);
839
839
  return {
840
840
  x: (o + s) / 2,
841
841
  y: (i + l) / 2
@@ -856,18 +856,18 @@ function te(t, e, n, r, o) {
856
856
  };
857
857
  return { angle: i, tipX: l, tipY: u, baseX: d, baseY: p, left: m, right: C, shaftEnd: L };
858
858
  }
859
- function Ln(t, e, n, r, o, i) {
859
+ function An(t, e, n, r, o, i) {
860
860
  const a = te(e, n, r, o, i);
861
861
  t.beginPath(), t.moveTo(e, n), t.lineTo(a.shaftEnd.x, a.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(a.tipX, a.tipY), t.lineTo(a.left.x, a.left.y), t.lineTo(a.right.x, a.right.y), t.closePath(), t.fill();
862
862
  }
863
- function $n(t, e, n, r = {}) {
863
+ function Pn(t, e, n, r = {}) {
864
864
  return new Promise((o, i) => {
865
865
  const a = new Image();
866
866
  a.onload = () => {
867
867
  const s = Math.round(e.x * a.width), l = Math.round(e.y * a.height), u = Math.max(1, Math.round(e.w * a.width)), d = Math.max(1, Math.round(e.h * a.height)), p = document.createElement("canvas");
868
868
  p.width = u, p.height = d;
869
869
  const m = p.getContext("2d");
870
- m.drawImage(a, s, l, u, d, 0, 0, u, d), Cn(m, {
870
+ m.drawImage(a, s, l, u, d, 0, 0, u, d), $n(m, {
871
871
  stickers: n,
872
872
  crop: e,
873
873
  width: u,
@@ -883,7 +883,7 @@ function $n(t, e, n, r = {}) {
883
883
  }, a.onerror = () => i(new Error("Could not load screenshot")), a.src = t;
884
884
  });
885
885
  }
886
- const Rn = ["bug", "idea", "other"], Pn = ["maker", "all-business", "brighter-day", "quiet-night"], ee = "maker", An = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), pt = 0.02, jt = 0.05, Tn = `
886
+ const Tn = ["bug", "idea", "other"], kn = ["maker", "all-business", "brighter-day", "quiet-night"], ee = "maker", In = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), mt = 0.02, Ut = 0.05, On = `
887
887
  <svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
888
888
  <path fill="currentColor" d="M5.2 2.8h9.1A2.7 2.7 0 0 1 17 5.5v8.2c0 .4-.3.7-.7.7h-.1a.7.7 0 0 1-.7-.7V5.5c0-.7-.6-1.3-1.3-1.3H5.2c-.7 0-1.3.6-1.3 1.3v12.2c0 .7.6 1.3 1.3 1.3h6.4a.7.7 0 0 1 0 1.4H5.2A2.7 2.7 0 0 1 2.5 17.7V5.5A2.7 2.7 0 0 1 5.2 2.8zm1.6 4.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h3.6a.7.7 0 0 0 0-1.4H6.8z"/>
889
889
  <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"/>
@@ -901,9 +901,9 @@ const k = {
901
901
  discard: T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
902
902
  audio: T('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),
903
903
  video: T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
904
- }, ne = gn();
904
+ }, ne = vn();
905
905
  ne.hook();
906
- const re = 10, kn = 80;
906
+ const re = 10, Hn = 80, ie = "notefully.author", oe = "Anonymous";
907
907
  let f = {
908
908
  endpoint: "",
909
909
  projectKey: "",
@@ -914,25 +914,25 @@ let f = {
914
914
  theme: ee,
915
915
  video: !1,
916
916
  consoleLogLimit: re
917
- }, mt = {}, h = null, c = {}, y = Zt(), S = "", W = "", R = null, J = "bug", O = null, $ = null, w = null, g = null, X = null, D = null, N = null, I = { w: 0, h: 0 }, lt = !1;
918
- function v(t) {
917
+ }, W = {}, h = null, c = {}, y = Zt(), S = "", q = "", R = null, Q = "bug", O = null, $ = null, w = null, g = null, Y = null, D = null, V = null, I = { w: 0, h: 0 }, ut = !1;
918
+ function b(t) {
919
919
  return h.querySelector(t);
920
920
  }
921
- function ie(t) {
921
+ function ae(t) {
922
922
  const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
923
- return Pn.includes(e) ? e : ee;
923
+ return kn.includes(e) ? e : ee;
924
924
  }
925
- function Ut(t, e) {
925
+ function jt(t, e) {
926
926
  return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
927
927
  }
928
- function b(t, e = !1) {
929
- c.status && (c.status.textContent = t || "", X && (clearTimeout(X), X = null), t && !e && (X = setTimeout(() => {
928
+ function v(t, e = !1) {
929
+ c.status && (c.status.textContent = t || "", Y && (clearTimeout(Y), Y = null), t && !e && (Y = setTimeout(() => {
930
930
  c.status.textContent = "";
931
931
  }, 4e3)));
932
932
  }
933
933
  function Ct() {
934
934
  return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
935
- <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Tn}</button>
935
+ <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${On}</button>
936
936
  <div class="nf-dialog" hidden>
937
937
  <div class="nf-panel">
938
938
  <div class="nf-stage">
@@ -946,6 +946,7 @@ function Ct() {
946
946
  <div class="nf-canvas"></div>
947
947
  </div>
948
948
  <textarea class="nf-text" placeholder="Describe the bug or the change you want…"></textarea>
949
+ <input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
949
950
  <div class="nf-kind">
950
951
  <button type="button" data-kind="bug">Bug</button>
951
952
  <button type="button" data-kind="idea">Idea</button>
@@ -963,108 +964,109 @@ function Ct() {
963
964
  </div>
964
965
  <button class="nf-stop-video" type="button" hidden>Stop</button>
965
966
  `, document.body.appendChild(h), c = {
966
- launcher: v(".nf-launcher"),
967
- dialog: v(".nf-dialog"),
968
- stage: v(".nf-stage"),
969
- canvas: v(".nf-canvas"),
970
- text: v(".nf-text"),
971
- restore: v(".nf-restore"),
972
- status: v(".nf-status"),
973
- audio: v(".nf-audio"),
974
- video: v(".nf-video"),
975
- discard: v(".nf-discard-shot"),
976
- stop: v(".nf-stop-video"),
977
- resetCrop: v(".nf-reset-crop"),
978
- submit: v(".nf-submit"),
967
+ launcher: b(".nf-launcher"),
968
+ dialog: b(".nf-dialog"),
969
+ stage: b(".nf-stage"),
970
+ canvas: b(".nf-canvas"),
971
+ text: b(".nf-text"),
972
+ author: b(".nf-author"),
973
+ restore: b(".nf-restore"),
974
+ status: b(".nf-status"),
975
+ audio: b(".nf-audio"),
976
+ video: b(".nf-video"),
977
+ discard: b(".nf-discard-shot"),
978
+ stop: b(".nf-stop-video"),
979
+ resetCrop: b(".nf-reset-crop"),
980
+ submit: b(".nf-submit"),
979
981
  shot: null
980
- }, In(), nt()), h;
982
+ }, Dn(), rt()), h;
981
983
  }
982
- function nt() {
984
+ function rt() {
983
985
  var t;
984
- h && (h.dataset.theme = ie(f.theme), f.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !f.video), (t = c.dialog) != null && t.hidden && Q());
986
+ h && (h.dataset.theme = ae(f.theme), f.hideLauncher ? h.setAttribute("data-nf-hidden-launcher", "") : h.removeAttribute("data-nf-hidden-launcher"), c.video && (c.video.hidden = !f.video), (t = c.dialog) != null && t.hidden && Z());
985
987
  }
986
- function Q() {
988
+ function Z() {
987
989
  c.launcher && (c.launcher.hidden = !!f.hideLauncher);
988
990
  }
989
- function In() {
990
- c.launcher.addEventListener("click", () => le()), v(".nf-dialog").addEventListener("click", (t) => {
991
- t.target === c.dialog && it();
991
+ function Dn() {
992
+ c.launcher.addEventListener("click", () => fe()), b(".nf-dialog").addEventListener("click", (t) => {
993
+ t.target === c.dialog && ot();
992
994
  }), h.querySelectorAll(".nf-tool").forEach((t) => {
993
995
  t.addEventListener("click", () => gt(t.dataset.tool));
994
- }), c.resetCrop.addEventListener("click", _n), c.canvas.addEventListener("pointerdown", Hn), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), h.querySelectorAll("[data-kind]").forEach((t) => {
996
+ }), c.resetCrop.addEventListener("click", Vn), c.canvas.addEventListener("pointerdown", Un), c.canvas.addEventListener("dragstart", (t) => t.preventDefault()), h.querySelectorAll("[data-kind]").forEach((t) => {
995
997
  t.addEventListener("click", () => yt(t.dataset.kind));
996
- }), c.discard.addEventListener("click", Bn), c.restore.addEventListener("click", Vn), c.audio.addEventListener("click", Nn), c.video.addEventListener("click", Wn), c.stop.addEventListener("click", () => N == null ? void 0 : N.stop()), v(".nf-submit").addEventListener("click", () => {
997
- ue().catch((t) => b(t.message || "Submit failed."));
998
+ }), c.discard.addEventListener("click", Wn), c.restore.addEventListener("click", qn), c.audio.addEventListener("click", zn), c.video.addEventListener("click", Xn), c.stop.addEventListener("click", () => V == null ? void 0 : V.stop()), b(".nf-submit").addEventListener("click", () => {
999
+ he().catch((t) => v(t.message || "Submit failed."));
998
1000
  }), yt("bug"), gt(null);
999
1001
  }
1000
1002
  function yt(t) {
1001
- J = Rn.includes(t) ? t : "bug", h.querySelectorAll("[data-kind]").forEach((e) => {
1002
- e.dataset.active = String(e.dataset.kind === J);
1003
+ Q = Tn.includes(t) ? t : "bug", h.querySelectorAll("[data-kind]").forEach((e) => {
1004
+ e.dataset.active = String(e.dataset.kind === Q);
1003
1005
  });
1004
1006
  }
1005
1007
  function gt(t) {
1006
- O = An.has(t) ? t : null, $ = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1008
+ O = In.has(t) ? t : null, $ = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1007
1009
  e.dataset.active = String(e.dataset.tool === O);
1008
1010
  }), c.canvas && (c.canvas.dataset.draw = O ? "true" : "false"), S && M();
1009
1011
  }
1010
1012
  function _t(t) {
1011
1013
  return Math.min(1, Math.max(0, t));
1012
1014
  }
1013
- function q() {
1015
+ function z() {
1014
1016
  return c.shot || c.canvas;
1015
1017
  }
1016
- function Z(t) {
1017
- const e = q().getBoundingClientRect();
1018
+ function tt(t) {
1019
+ const e = z().getBoundingClientRect();
1018
1020
  return {
1019
1021
  x: _t((t.clientX - e.left) / Math.max(e.width, 1)),
1020
1022
  y: _t((t.clientY - e.top) / Math.max(e.height, 1))
1021
1023
  };
1022
1024
  }
1023
- function On(t) {
1024
- const e = q().getBoundingClientRect();
1025
+ function Fn(t) {
1026
+ const e = z().getBoundingClientRect();
1025
1027
  return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
1026
1028
  }
1027
- function oe(t) {
1028
- const e = Z(t), n = y.crop();
1029
+ function se(t) {
1030
+ const e = tt(t), n = y.crop();
1029
1031
  return {
1030
1032
  x: n.x + e.x * n.w,
1031
1033
  y: n.y + e.y * n.h
1032
1034
  };
1033
1035
  }
1034
- function rt(t, e) {
1036
+ function it(t, e) {
1035
1037
  const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
1036
1038
  return {
1037
1039
  x: n,
1038
1040
  y: r,
1039
- w: Math.max(pt, Math.abs(e.x - t.x)),
1040
- h: Math.max(pt, Math.abs(e.y - t.y))
1041
+ w: Math.max(mt, Math.abs(e.x - t.x)),
1042
+ h: Math.max(mt, Math.abs(e.y - t.y))
1041
1043
  };
1042
1044
  }
1043
1045
  function Mt(t) {
1044
1046
  h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
1045
1047
  }
1046
- function ut(t) {
1048
+ function dt(t) {
1047
1049
  try {
1048
1050
  c.canvas.setPointerCapture(t.pointerId);
1049
1051
  } catch {
1050
1052
  }
1051
1053
  }
1052
1054
  function wt() {
1053
- window.addEventListener("pointermove", se), window.addEventListener("pointerup", tt), window.addEventListener("pointercancel", tt);
1055
+ window.addEventListener("pointermove", le), window.addEventListener("pointerup", et), window.addEventListener("pointercancel", et);
1054
1056
  }
1055
- function ae() {
1056
- window.removeEventListener("pointermove", se), window.removeEventListener("pointerup", tt), window.removeEventListener("pointercancel", tt);
1057
+ function ce() {
1058
+ window.removeEventListener("pointermove", le), window.removeEventListener("pointerup", et), window.removeEventListener("pointercancel", et);
1057
1059
  }
1058
- function Hn(t) {
1060
+ function Un(t) {
1059
1061
  if (t.button !== 0 || !S)
1060
1062
  return;
1061
- if (!t.target.closest(".nf-sticker") && !On(t)) {
1063
+ if (!t.target.closest(".nf-sticker") && !Fn(t)) {
1062
1064
  $ = null, M();
1063
1065
  return;
1064
1066
  }
1065
1067
  const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
1066
1068
  if (n && n.dataset.preview !== "true") {
1067
- t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, ut(t), Dn({
1069
+ t.preventDefault(), t.stopPropagation(), $ = n.dataset.id, dt(t), jn({
1068
1070
  kind: "sticker",
1069
1071
  id: $,
1070
1072
  dir: (e == null ? void 0 : e.dataset.dir) || "move"
@@ -1072,20 +1074,20 @@ function Hn(t) {
1072
1074
  return;
1073
1075
  }
1074
1076
  if ($ = null, O === "crop") {
1075
- t.preventDefault(), ut(t), w = { kind: "crop", start: Z(t), current: Z(t) }, wt(), M();
1077
+ t.preventDefault(), dt(t), w = { kind: "crop", start: tt(t), current: tt(t) }, wt(), M();
1076
1078
  return;
1077
1079
  }
1078
1080
  if (O === "arrow" || O === "rect" || O === "circle") {
1079
- t.preventDefault(), ut(t);
1080
- const r = oe(t);
1081
+ t.preventDefault(), dt(t);
1082
+ const r = se(t);
1081
1083
  w = { kind: "sticker", type: O, start: r, current: r }, wt(), M();
1082
1084
  return;
1083
1085
  }
1084
1086
  M();
1085
1087
  }
1086
- function Dn(t, e) {
1088
+ function jn(t, e) {
1087
1089
  e.preventDefault(), e.stopPropagation();
1088
- const n = q().getBoundingClientRect(), r = y.list().find((o) => o.id === t.id);
1090
+ const n = z().getBoundingClientRect(), r = y.list().find((o) => o.id === t.id);
1089
1091
  g = {
1090
1092
  ...t,
1091
1093
  startX: e.clientX,
@@ -1095,9 +1097,9 @@ function Dn(t, e) {
1095
1097
  rect: n
1096
1098
  }, Mt(t.dir === "move" || t.dir === "start" || t.dir === "end"), wt();
1097
1099
  }
1098
- function se(t) {
1100
+ function le(t) {
1099
1101
  if (w) {
1100
- w.current = w.kind === "crop" ? Z(t) : oe(t), M();
1102
+ w.current = w.kind === "crop" ? tt(t) : se(t), M();
1101
1103
  return;
1102
1104
  }
1103
1105
  if (!g)
@@ -1123,12 +1125,12 @@ function se(t) {
1123
1125
  });
1124
1126
  else {
1125
1127
  const o = { x: r.x, y: r.y, w: r.w, h: r.h };
1126
- Fn(o, g.dir, e, n), y.update(r.id, o);
1128
+ _n(o, g.dir, e, n), y.update(r.id, o);
1127
1129
  }
1128
1130
  M();
1129
1131
  }
1130
1132
  }
1131
- function Fn(t, e, n, r) {
1133
+ function _n(t, e, n, r) {
1132
1134
  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")) {
1133
1135
  const o = Math.max(0.04, t.w - n);
1134
1136
  t.x += t.w - o, t.w = o;
@@ -1138,9 +1140,9 @@ function Fn(t, e, n, r) {
1138
1140
  t.y += t.h - o, t.h = o;
1139
1141
  }
1140
1142
  }
1141
- function tt(t) {
1142
- if (ae(), Mt(!1), w) {
1143
- jn();
1143
+ function et(t) {
1144
+ if (ce(), Mt(!1), w) {
1145
+ Nn();
1144
1146
  return;
1145
1147
  }
1146
1148
  if (g) {
@@ -1151,13 +1153,13 @@ function tt(t) {
1151
1153
  g = null, M();
1152
1154
  }
1153
1155
  }
1154
- function jn() {
1156
+ function Nn() {
1155
1157
  const t = w;
1156
1158
  if (w = null, !t)
1157
1159
  return;
1158
1160
  if (t.kind === "crop") {
1159
- const n = rt(t.start, t.current);
1160
- if (Math.abs(t.current.x - t.start.x) < jt || Math.abs(t.current.y - t.start.y) < jt) {
1161
+ const n = it(t.start, t.current);
1162
+ if (Math.abs(t.current.x - t.start.x) < Ut || Math.abs(t.current.y - t.start.y) < Ut) {
1161
1163
  M();
1162
1164
  return;
1163
1165
  }
@@ -1167,16 +1169,16 @@ function jn() {
1167
1169
  y: o.y + n.y * o.h,
1168
1170
  w: n.w * o.w,
1169
1171
  h: n.h * o.h
1170
- }), z();
1172
+ }), X();
1171
1173
  return;
1172
1174
  }
1173
- const e = Un(t);
1175
+ const e = Bn(t);
1174
1176
  e && ($ = e.id), M();
1175
1177
  }
1176
- function Un(t) {
1178
+ function Bn(t) {
1177
1179
  if (t.type === "arrow") {
1178
1180
  const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
1179
- return Math.hypot(e, n) < pt ? y.add("arrow", {
1181
+ return Math.hypot(e, n) < mt ? y.add("arrow", {
1180
1182
  x: t.start.x,
1181
1183
  y: t.start.y,
1182
1184
  x2: t.start.x + 0.12,
@@ -1192,10 +1194,10 @@ function Un(t) {
1192
1194
  h: Math.abs(n)
1193
1195
  });
1194
1196
  }
1195
- return y.add(t.type, rt(t.start, t.current));
1197
+ return y.add(t.type, it(t.start, t.current));
1196
1198
  }
1197
- function _n() {
1198
- y.resetCrop(), $ = null, z();
1199
+ function Vn() {
1200
+ y.resetCrop(), $ = null, X();
1199
1201
  }
1200
1202
  function bt() {
1201
1203
  c.resetCrop && (c.resetCrop.hidden = !y.isCropped());
@@ -1206,49 +1208,49 @@ function Lt(t) {
1206
1208
  const e = t ? "Stop audio" : "Record audio";
1207
1209
  c.audio.title = e, c.audio.setAttribute("aria-label", e), c.audio.dataset.active = String(!!t);
1208
1210
  }
1209
- function Bn() {
1210
- S && (W = S), S = "", c.stage.hidden = !0, c.restore.hidden = !W;
1211
+ function Wn() {
1212
+ S && (q = S), S = "", c.stage.hidden = !0, c.restore.hidden = !q;
1211
1213
  }
1212
- function Vn() {
1213
- W && (S = W, c.stage.hidden = !1, c.restore.hidden = !0, z());
1214
+ function qn() {
1215
+ q && (S = q, c.stage.hidden = !1, c.restore.hidden = !0, X());
1214
1216
  }
1215
- function Nn() {
1217
+ function zn() {
1216
1218
  try {
1217
- if (D || (D = wn((e) => {
1219
+ if (D || (D = Sn((e) => {
1218
1220
  const n = c.text.value.trim();
1219
1221
  c.text.value = n ? `${n} ${e}` : e;
1220
1222
  })), !D.isSupported()) {
1221
- b("Audio-to-text is not supported in this browser.");
1223
+ v("Audio-to-text is not supported in this browser.");
1222
1224
  return;
1223
1225
  }
1224
1226
  const t = D.start();
1225
- Lt(t), b(t ? "Listening…" : "");
1227
+ Lt(t), v(t ? "Listening…" : "");
1226
1228
  } catch (t) {
1227
- b(t.message);
1229
+ v(t.message);
1228
1230
  }
1229
1231
  }
1230
- async function Wn() {
1232
+ async function Xn() {
1231
1233
  if (!f.video) {
1232
- b("Video is disabled on this host.");
1234
+ v("Video is disabled on this host.");
1233
1235
  return;
1234
1236
  }
1235
- c.dialog.hidden = !0, c.stop.hidden = !1, nt(), c.launcher.hidden = !0, N = vn({
1237
+ c.dialog.hidden = !0, c.stop.hidden = !1, rt(), c.launcher.hidden = !0, V = En({
1236
1238
  onStart() {
1237
1239
  },
1238
1240
  onStop(t) {
1239
- R = t, c.stop.hidden = !0, Q(), c.dialog.hidden = !1, z(), b(t ? "Video attached." : "Recording cancelled.");
1241
+ R = t, c.stop.hidden = !0, Z(), c.dialog.hidden = !1, X(), v(t ? "Video attached." : "Recording cancelled.");
1240
1242
  },
1241
1243
  onError(t) {
1242
- b(t.message);
1244
+ v(t.message);
1243
1245
  }
1244
1246
  });
1245
1247
  try {
1246
- await N.start();
1248
+ await V.start();
1247
1249
  } catch (t) {
1248
- c.stop.hidden = !0, Q(), c.dialog.hidden = !1, b(t.message);
1250
+ c.stop.hidden = !0, Z(), c.dialog.hidden = !1, v(t.message);
1249
1251
  }
1250
1252
  }
1251
- function z() {
1253
+ function X() {
1252
1254
  if (c.shot = null, !S) {
1253
1255
  c.canvas.style.removeProperty("--nf-shot-aspect"), c.canvas.style.removeProperty("aspect-ratio"), c.canvas.innerHTML = R ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(R)}"></video>` : "", bt();
1254
1256
  return;
@@ -1257,18 +1259,18 @@ function z() {
1257
1259
  const t = c.shot.querySelector("img");
1258
1260
  t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
1259
1261
  const e = () => {
1260
- qn(t), M();
1262
+ Yn(t), M();
1261
1263
  };
1262
1264
  t.addEventListener("load", e), t.complete && t.naturalWidth && e();
1263
1265
  }
1264
- function qn(t) {
1266
+ function Yn(t) {
1265
1267
  const e = t.naturalWidth || I.w, n = t.naturalHeight || I.h;
1266
1268
  if (e && n && (I = { w: e, h: n }, c.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), c.canvas.style.aspectRatio = `${e} / ${n}`), !c.shot || !I.w || !I.h)
1267
1269
  return;
1268
1270
  const r = y.crop(), o = I.w / I.h, i = r.w / r.h * o, a = Math.min(1, i / o), s = Math.min(1, o / i);
1269
1271
  c.shot.style.left = `${(1 - a) / 2 * 100}%`, c.shot.style.top = `${(1 - s) / 2 * 100}%`, c.shot.style.width = `${a * 100}%`, c.shot.style.height = `${s * 100}%`, t.style.width = `${100 / r.w}%`, t.style.height = `${100 / r.h}%`, t.style.left = `${-r.x / r.w * 100}%`, t.style.top = `${-r.y / r.h * 100}%`;
1270
1272
  }
1271
- function zn(t) {
1273
+ function Kn(t) {
1272
1274
  return t.type === "arrow" ? {
1273
1275
  id: "preview",
1274
1276
  type: "arrow",
@@ -1283,7 +1285,7 @@ function zn(t) {
1283
1285
  id: "preview",
1284
1286
  type: t.type,
1285
1287
  number: "",
1286
- ...rt(t.start, t.current)
1288
+ ...it(t.start, t.current)
1287
1289
  };
1288
1290
  }
1289
1291
  function M() {
@@ -1291,15 +1293,15 @@ function M() {
1291
1293
  bt();
1292
1294
  return;
1293
1295
  }
1294
- const e = y.crop(), n = q(), r = Et(n.clientWidth || 400);
1296
+ const e = y.crop(), n = z(), r = Et(n.clientWidth || 400);
1295
1297
  if (c.shot.style.setProperty("--nf-anno-stroke", `${r.stroke}px`), c.shot.style.setProperty("--nf-anno-badge", `${r.badgeRadius * 2}px`), c.shot.style.setProperty("--nf-anno-badge-font", `${r.fontSize}px`), c.shot.style.setProperty("--nf-anno-handle", `${Math.max(8, r.stroke * 2.5)}px`), (w == null ? void 0 : w.kind) === "crop") {
1296
1298
  const i = document.createElement("div");
1297
- i.className = "nf-crop", Bt(i, rt(w.start, w.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(i);
1299
+ i.className = "nf-crop", Nt(i, it(w.start, w.current), { x: 0, y: 0, w: 1, h: 1 }), c.shot.appendChild(i);
1298
1300
  }
1299
1301
  const o = y.list().slice();
1300
- if ((w == null ? void 0 : w.kind) === "sticker" && o.push(zn(w)), o.forEach((i) => {
1302
+ if ((w == null ? void 0 : w.kind) === "sticker" && o.push(Kn(w)), o.forEach((i) => {
1301
1303
  const a = i.id === "preview", s = !a && i.id === $, l = document.createElement("div");
1302
- if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), i.type === "arrow" ? Xn(l, i, e, s, r) : (Bt(l, i, e), s && ["nw", "ne", "sw", "se"].forEach((u) => vt(l, u))), !a && i.number) {
1304
+ if (l.className = `nf-sticker nf-${i.type}`, l.dataset.id = i.id, s && (l.dataset.selected = "true"), a && (l.dataset.preview = "true"), i.type === "arrow" ? Gn(l, i, e, s, r) : (Nt(l, i, e), s && ["nw", "ne", "sw", "se"].forEach((u) => vt(l, u))), !a && i.number) {
1303
1305
  const u = document.createElement("span");
1304
1306
  u.className = "nf-badge", u.textContent = String(i.number), l.appendChild(u);
1305
1307
  }
@@ -1310,27 +1312,54 @@ function M() {
1310
1312
  }
1311
1313
  bt();
1312
1314
  }
1313
- function Xn(t, e, n, r, o = Et(400)) {
1314
- const i = q(), a = i.clientWidth, s = i.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, d = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, p = ((e.y2 ?? e.y) - n.y) / n.h * s, m = Math.max(18, o.arrowHead + o.stroke * 2), C = Math.min(l, d) - m, L = Math.min(u, p) - m, P = Math.max(2, Math.abs(d - l)) + m * 2, V = Math.max(2, Math.abs(p - u)) + m * 2, F = l - C, j = u - L, ot = d - C, at = p - L, A = te(F, j, ot, at, o), U = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1315
- t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${P}px`, t.style.height = `${V}px`, U.setAttribute("class", "nf-arrow-svg"), U.setAttribute("viewBox", `0 0 ${P} ${V}`), U.setAttribute("width", String(P)), U.setAttribute("height", String(V)), U.innerHTML = `
1316
- <line class="nf-arrow-hit" x1="${F}" y1="${j}" x2="${ot}" y2="${at}" />
1317
- <line class="nf-arrow-shaft" x1="${F}" y1="${j}" x2="${A.shaftEnd.x}" y2="${A.shaftEnd.y}" />
1318
- <polygon class="nf-arrow-head" points="${A.tipX},${A.tipY} ${A.left.x},${A.left.y} ${A.right.x},${A.right.y}" />
1319
- `, t.appendChild(U), r && (vt(t, "start", { left: F - 5, top: j - 5 }), vt(t, "end", { left: ot - 5, top: at - 5 }));
1315
+ function Gn(t, e, n, r, o = Et(400)) {
1316
+ const i = z(), a = i.clientWidth, s = i.clientHeight, l = (e.x - n.x) / n.w * a, u = (e.y - n.y) / n.h * s, d = ((e.x2 ?? e.x + e.w) - n.x) / n.w * a, p = ((e.y2 ?? e.y) - n.y) / n.h * s, m = Math.max(18, o.arrowHead + o.stroke * 2), C = Math.min(l, d) - m, L = Math.min(u, p) - m, A = Math.max(2, Math.abs(d - l)) + m * 2, B = Math.max(2, Math.abs(p - u)) + m * 2, F = l - C, U = u - L, at = d - C, st = p - L, P = te(F, U, at, st, o), j = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1317
+ t.style.left = `${C}px`, t.style.top = `${L}px`, t.style.width = `${A}px`, t.style.height = `${B}px`, j.setAttribute("class", "nf-arrow-svg"), j.setAttribute("viewBox", `0 0 ${A} ${B}`), j.setAttribute("width", String(A)), j.setAttribute("height", String(B)), j.innerHTML = `
1318
+ <line class="nf-arrow-hit" x1="${F}" y1="${U}" x2="${at}" y2="${st}" />
1319
+ <line class="nf-arrow-shaft" x1="${F}" y1="${U}" x2="${P.shaftEnd.x}" y2="${P.shaftEnd.y}" />
1320
+ <polygon class="nf-arrow-head" points="${P.tipX},${P.tipY} ${P.left.x},${P.left.y} ${P.right.x},${P.right.y}" />
1321
+ `, t.appendChild(j), r && (vt(t, "start", { left: F - 5, top: U - 5 }), vt(t, "end", { left: at - 5, top: st - 5 }));
1320
1322
  }
1321
1323
  function vt(t, e, n) {
1322
1324
  const r = document.createElement("span");
1323
1325
  r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
1324
1326
  }
1325
- function Bt(t, e, n) {
1327
+ function Nt(t, e, n) {
1326
1328
  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}%`;
1327
1329
  }
1328
- function ce(t, e = re) {
1330
+ function Jn() {
1331
+ try {
1332
+ return String(localStorage.getItem(ie) || "").trim();
1333
+ } catch {
1334
+ return "";
1335
+ }
1336
+ }
1337
+ function Qn(t) {
1338
+ const e = String(t || "").trim();
1339
+ if (!(!e || e === oe))
1340
+ try {
1341
+ localStorage.setItem(ie, e);
1342
+ } catch {
1343
+ }
1344
+ }
1345
+ function Zn() {
1346
+ const t = String(W.displayName || "").trim();
1347
+ return t || Jn();
1348
+ }
1349
+ function tr() {
1350
+ var e;
1351
+ const t = String(((e = c.author) == null ? void 0 : e.value) || "").trim();
1352
+ return t ? (Qn(t), t) : oe;
1353
+ }
1354
+ function ue() {
1355
+ c.author && (c.author.value = Zn());
1356
+ }
1357
+ function de(t, e = re) {
1329
1358
  const n = Number(t);
1330
- return Number.isFinite(n) ? Math.min(kn, Math.max(0, Math.floor(n))) : e;
1359
+ return Number.isFinite(n) ? Math.min(Hn, Math.max(0, Math.floor(n))) : e;
1331
1360
  }
1332
- function Kn(t = {}) {
1333
- return mn(t), f = {
1361
+ function er(t = {}) {
1362
+ return wn(t), f = {
1334
1363
  ...f,
1335
1364
  endpoint: String(t.endpoint || f.endpoint || "").replace(/\/$/, ""),
1336
1365
  projectKey: t.projectKey == null ? f.projectKey : String(t.projectKey),
@@ -1338,87 +1367,91 @@ function Kn(t = {}) {
1338
1367
  name: t.name == null ? f.name : String(t.name || ""),
1339
1368
  targets: t.targets === void 0 ? f.targets : t.targets,
1340
1369
  hideLauncher: t.hideLauncher == null ? f.hideLauncher : !!t.hideLauncher,
1341
- theme: ie(t.theme ?? f.theme),
1370
+ theme: ae(t.theme ?? f.theme),
1342
1371
  video: t.video == null ? f.video : !!t.video,
1343
- consoleLogLimit: t.consoleLogLimit == null ? f.consoleLogLimit : ce(t.consoleLogLimit, f.consoleLogLimit)
1344
- }, Ct(), nt(), de;
1372
+ consoleLogLimit: t.consoleLogLimit == null ? f.consoleLogLimit : de(t.consoleLogLimit, f.consoleLogLimit)
1373
+ }, Ct(), rt(), pe;
1345
1374
  }
1346
- async function le() {
1347
- Ct(), nt(), c.launcher.hidden = !0, y = Zt(), I = { w: 0, h: 0 }, R = null, $ = null, w = null, g = null, J = "bug", yt("bug"), gt(null), Lt(!1), c.text.value = "", b("");
1375
+ async function fe() {
1376
+ Ct(), rt(), c.launcher.hidden = !0, y = Zt(), I = { w: 0, h: 0 }, R = null, $ = null, w = null, g = null, Q = "bug", yt("bug"), gt(null), Lt(!1), c.text.value = "", ue(), v("");
1348
1377
  try {
1349
- S = await un(), W = S, c.stage.hidden = !1, c.restore.hidden = !0, b("");
1378
+ S = await hn(), q = S, c.stage.hidden = !1, c.restore.hidden = !0, v("");
1350
1379
  } catch {
1351
- S = "", b("Screenshot failed; you can still send text.");
1380
+ S = "", v("Screenshot failed; you can still send text.");
1352
1381
  }
1353
- c.dialog.hidden = !1, z(), c.text.focus();
1382
+ c.dialog.hidden = !1, X(), c.text.focus();
1354
1383
  }
1355
- function it() {
1356
- h && (D == null || D.stop(), Lt(!1), ae(), w = null, g = null, Mt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, Q());
1384
+ function ot() {
1385
+ h && (D == null || D.stop(), Lt(!1), ce(), w = null, g = null, Mt(!1), c.dialog.hidden = !0, c.stop.hidden = !0, Z());
1357
1386
  }
1358
- function Yn(t = {}) {
1359
- mt = { ...mt, ...pn(t) };
1387
+ function nr(t = {}) {
1388
+ W = { ...W, ...gn(t) }, ue();
1360
1389
  }
1361
- async function ue() {
1362
- if (Ct(), lt)
1390
+ async function he() {
1391
+ if (Ct(), ut)
1363
1392
  return null;
1364
1393
  const t = c.text.value.trim();
1365
1394
  if (!t && !S && !R)
1366
- return b("Add a note, screenshot, or video first."), null;
1395
+ return v("Add a note, screenshot, or video first."), null;
1367
1396
  if (!f.endpoint || !f.projectKey)
1368
- return b("Notefully is missing endpoint or projectKey."), null;
1369
- lt = !0, Vt(!0), b("Submitting…", !0);
1397
+ return v("Notefully is missing endpoint or projectKey."), null;
1398
+ ut = !0, Bt(!0), v("Submitting…", !0);
1370
1399
  try {
1371
- const e = new FormData();
1372
- if (e.append("message", t), e.append("kind", J), e.append("version", f.version || "0.0.0"), f.name && e.append("name", f.name), e.append("context", JSON.stringify({
1373
- ...hn(mt),
1374
- console: ne.snapshot().slice(-ce(f.consoleLogLimit))
1375
- })), e.append("annotations", JSON.stringify(y.list())), Array.isArray(f.targets) && e.append("targets", JSON.stringify(f.targets)), S) {
1376
- const o = await $n(
1400
+ const e = tr(), n = new FormData();
1401
+ if (n.append("message", t), n.append("kind", Q), n.append("version", f.version || "0.0.0"), n.append("author", e), f.name && n.append("name", f.name), n.append("context", JSON.stringify({
1402
+ ...yn({
1403
+ ...W,
1404
+ displayName: W.displayName || e
1405
+ }),
1406
+ author: e,
1407
+ console: ne.snapshot().slice(-de(f.consoleLogLimit))
1408
+ })), n.append("annotations", JSON.stringify(y.list())), Array.isArray(f.targets) && n.append("targets", JSON.stringify(f.targets)), S) {
1409
+ const i = await Pn(
1377
1410
  S,
1378
1411
  y.crop(),
1379
1412
  y.list(),
1380
1413
  {
1381
- mark: Ut("--nf-mark", "#fdd341"),
1382
- markText: Ut("--nf-mark-text", "#2a2140")
1414
+ mark: jt("--nf-mark", "#fdd341"),
1415
+ markText: jt("--nf-mark-text", "#2a2140")
1383
1416
  }
1384
1417
  );
1385
- e.append("screenshot", o, "screenshot.png");
1418
+ n.append("screenshot", i, "screenshot.png");
1386
1419
  }
1387
- R && e.append("recording", R, "recording.webm");
1388
- const n = await fetch(`${f.endpoint}/v1/reports`, {
1420
+ R && n.append("recording", R, "recording.webm");
1421
+ const r = await fetch(`${f.endpoint}/v1/reports`, {
1389
1422
  method: "POST",
1390
1423
  headers: {
1391
1424
  "X-Notefully-Key": f.projectKey
1392
1425
  },
1393
- body: e
1426
+ body: n
1394
1427
  });
1395
- let r = null;
1428
+ let o = null;
1396
1429
  try {
1397
- r = await n.json();
1430
+ o = await r.json();
1398
1431
  } catch {
1399
- r = null;
1432
+ o = null;
1400
1433
  }
1401
- if (!n.ok)
1402
- throw b((r == null ? void 0 : r.error) || "Submit failed."), new Error((r == null ? void 0 : r.error) || `Submit failed (${n.status})`);
1403
- return b("Sent. Thank you."), it(), r;
1434
+ if (!r.ok)
1435
+ throw v((o == null ? void 0 : o.error) || "Submit failed."), new Error((o == null ? void 0 : o.error) || `Submit failed (${r.status})`);
1436
+ return v("Sent. Thank you."), ot(), o;
1404
1437
  } finally {
1405
- lt = !1, Vt(!1);
1438
+ ut = !1, Bt(!1);
1406
1439
  }
1407
1440
  }
1408
- function Vt(t) {
1441
+ function Bt(t) {
1409
1442
  c.submit && (c.submit.disabled = !!t, c.submit.setAttribute("aria-busy", t ? "true" : "false"));
1410
1443
  }
1411
- function Gn() {
1412
- it(), h == null || h.remove(), h = null, c = {};
1444
+ function rr() {
1445
+ ot(), h == null || h.remove(), h = null, c = {};
1413
1446
  }
1414
- const de = { init: Kn, open: le, close: it, identify: Yn, submit: ue, destroy: Gn };
1415
- typeof window < "u" && (window.Notefully = de);
1447
+ const pe = { init: er, open: fe, close: ot, identify: nr, submit: he, destroy: rr };
1448
+ typeof window < "u" && (window.Notefully = pe);
1416
1449
  export {
1417
- it as close,
1418
- de as default,
1419
- Gn as destroy,
1420
- Yn as identify,
1421
- Kn as init,
1422
- le as open,
1423
- ue as submit
1450
+ ot as close,
1451
+ pe as default,
1452
+ rr as destroy,
1453
+ nr as identify,
1454
+ er as init,
1455
+ fe as open,
1456
+ he as submit
1424
1457
  };