@makefully/notefully 0.1.52 → 0.1.54

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 Qe(t, e) {
1
+ function tn(t, e) {
2
2
  if (t.match(/^[a-z]+:\/\//i))
3
3
  return t;
4
4
  if (t.match(/^\/\//))
@@ -8,7 +8,7 @@ function Qe(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 Ze = /* @__PURE__ */ (() => {
11
+ const en = /* @__PURE__ */ (() => {
12
12
  let t = 0;
13
13
  const e = () => (
14
14
  // eslint-disable-next-line no-bitwise
@@ -16,33 +16,33 @@ const Ze = /* @__PURE__ */ (() => {
16
16
  );
17
17
  return () => (t += 1, `u${e()}${t}`);
18
18
  })();
19
- function U(t) {
19
+ function j(t) {
20
20
  const e = [];
21
21
  for (let n = 0, r = t.length; n < r; n++)
22
22
  e.push(t[n]);
23
23
  return e;
24
24
  }
25
- let G = null;
26
- function he(t = {}) {
27
- return G || (t.includeStyleProperties ? (G = t.includeStyleProperties, G) : (G = U(window.getComputedStyle(document.documentElement)), G));
25
+ let Z = null;
26
+ function pe(t = {}) {
27
+ return Z || (t.includeStyleProperties ? (Z = t.includeStyleProperties, Z) : (Z = j(window.getComputedStyle(document.documentElement)), Z));
28
28
  }
29
- function st(t, e) {
29
+ function lt(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 tn(t) {
34
- const e = st(t, "border-left-width"), n = st(t, "border-right-width");
33
+ function nn(t) {
34
+ const e = lt(t, "border-left-width"), n = lt(t, "border-right-width");
35
35
  return t.clientWidth + e + n;
36
36
  }
37
- function en(t) {
38
- const e = st(t, "border-top-width"), n = st(t, "border-bottom-width");
37
+ function rn(t) {
38
+ const e = lt(t, "border-top-width"), n = lt(t, "border-bottom-width");
39
39
  return t.clientHeight + e + n;
40
40
  }
41
- function pe(t, e = {}) {
42
- const n = e.width || tn(t), r = e.height || en(t);
41
+ function ye(t, e = {}) {
42
+ const n = e.width || nn(t), r = e.height || rn(t);
43
43
  return { width: n, height: r };
44
44
  }
45
- function nn() {
45
+ function an() {
46
46
  let t, e;
47
47
  try {
48
48
  e = process;
@@ -51,11 +51,11 @@ function nn() {
51
51
  const n = e && e.env ? e.env.devicePixelRatio : null;
52
52
  return n && (t = parseInt(n, 10), Number.isNaN(t) && (t = 1)), t || window.devicePixelRatio || 1;
53
53
  }
54
- const E = 16384;
55
- function rn(t) {
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));
54
+ const k = 16384;
55
+ function on(t) {
56
+ (t.width > k || t.height > k) && (t.width > k && t.height > k ? t.width > t.height ? (t.height *= k / t.width, t.width = k) : (t.width *= k / t.height, t.height = k) : t.width > k ? (t.height *= k / t.width, t.width = k) : (t.width *= k / t.height, t.height = k));
57
57
  }
58
- function ct(t) {
58
+ function ut(t) {
59
59
  return new Promise((e, n) => {
60
60
  const r = new Image();
61
61
  r.onload = () => {
@@ -65,77 +65,77 @@ function ct(t) {
65
65
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = t;
66
66
  });
67
67
  }
68
- async function an(t) {
68
+ async function sn(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 on(t, e, n) {
71
+ async function cn(t, e, n) {
72
72
  const r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
73
- return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(t), an(i);
73
+ return i.setAttribute("width", `${e}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${e} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(t), sn(i);
74
74
  }
75
- const x = (t, e) => {
75
+ const E = (t, e) => {
76
76
  if (t instanceof e)
77
77
  return !0;
78
78
  const n = Object.getPrototypeOf(t);
79
- return n === null ? !1 : n.constructor.name === e.name || x(n, e);
79
+ return n === null ? !1 : n.constructor.name === e.name || E(n, e);
80
80
  };
81
- function sn(t) {
81
+ function ln(t) {
82
82
  const e = t.getPropertyValue("content");
83
83
  return `${t.cssText} content: '${e.replace(/'|"/g, "")}';`;
84
84
  }
85
- function cn(t, e) {
86
- return he(e).map((n) => {
85
+ function un(t, e) {
86
+ return pe(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 ln(t, e, n, r) {
92
- const i = `.${t}:${e}`, a = n.cssText ? sn(n) : cn(n, r);
91
+ function dn(t, e, n, r) {
92
+ const i = `.${t}:${e}`, a = n.cssText ? ln(n) : un(n, r);
93
93
  return document.createTextNode(`${i}{${a}}`);
94
94
  }
95
- function Kt(t, e, n, r) {
95
+ function qt(t, e, n, r) {
96
96
  const i = window.getComputedStyle(t, n), a = i.getPropertyValue("content");
97
97
  if (a === "" || a === "none")
98
98
  return;
99
- const o = Ze();
99
+ const o = en();
100
100
  try {
101
101
  e.className = `${e.className} ${o}`;
102
102
  } catch {
103
103
  return;
104
104
  }
105
105
  const c = document.createElement("style");
106
- c.appendChild(ln(o, n, i, r)), e.appendChild(c);
106
+ c.appendChild(dn(o, n, i, r)), e.appendChild(c);
107
107
  }
108
- function un(t, e, n) {
109
- Kt(t, e, ":before", n), Kt(t, e, ":after", n);
108
+ function fn(t, e, n) {
109
+ qt(t, e, ":before", n), qt(t, e, ":after", n);
110
110
  }
111
- const qt = "application/font-woff", Xt = "image/jpeg", dn = {
112
- woff: qt,
113
- woff2: qt,
111
+ const Xt = "application/font-woff", Yt = "image/jpeg", hn = {
112
+ woff: Xt,
113
+ woff2: Xt,
114
114
  ttf: "application/font-truetype",
115
115
  eot: "application/vnd.ms-fontobject",
116
116
  png: "image/png",
117
- jpg: Xt,
118
- jpeg: Xt,
117
+ jpg: Yt,
118
+ jpeg: Yt,
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 fn(t) {
124
+ function pn(t) {
125
125
  const e = /\.([^./]*?)$/g.exec(t);
126
126
  return e ? e[1] : "";
127
127
  }
128
- function Bt(t) {
129
- const e = fn(t).toLowerCase();
130
- return dn[e] || "";
128
+ function Ht(t) {
129
+ const e = pn(t).toLowerCase();
130
+ return hn[e] || "";
131
131
  }
132
- function hn(t) {
132
+ function yn(t) {
133
133
  return t.split(/,/)[1];
134
134
  }
135
- function Lt(t) {
135
+ function Rt(t) {
136
136
  return t.search(/^(data:)/) !== -1;
137
137
  }
138
- function pn(t, e) {
138
+ function mn(t, e) {
139
139
  return `data:${e};base64,${t}`;
140
140
  }
141
141
  async function me(t, e, n) {
@@ -154,84 +154,84 @@ async function me(t, e, n) {
154
154
  }, c.readAsDataURL(i);
155
155
  });
156
156
  }
157
- const St = {};
158
- function mn(t, e, n) {
157
+ const Et = {};
158
+ function gn(t, e, n) {
159
159
  let r = t.replace(/\?.*/, "");
160
160
  return n && (r = t), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), e ? `[${e}]${r}` : r;
161
161
  }
162
- async function Dt(t, e, n) {
163
- const r = mn(t, e, n.includeQueryParams);
164
- if (St[r] != null)
165
- return St[r];
162
+ async function Ft(t, e, n) {
163
+ const r = gn(t, e, n.includeQueryParams);
164
+ if (Et[r] != null)
165
+ return Et[r];
166
166
  n.cacheBust && (t += (/\?/.test(t) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
167
167
  let i;
168
168
  try {
169
- const a = await me(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), hn(c)));
170
- i = pn(a, e);
169
+ const a = await me(t, n.fetchRequestInit, ({ res: o, result: c }) => (e || (e = o.headers.get("Content-Type") || ""), yn(c)));
170
+ i = mn(a, e);
171
171
  } catch (a) {
172
172
  i = n.imagePlaceholder || "";
173
173
  let o = `Failed to fetch resource: ${t}`;
174
174
  a && (o = typeof a == "string" ? a : a.message), o && console.warn(o);
175
175
  }
176
- return St[r] = i, i;
176
+ return Et[r] = i, i;
177
177
  }
178
- async function yn(t) {
178
+ async function wn(t) {
179
179
  const e = t.toDataURL();
180
- return e === "data:," ? t.cloneNode(!1) : ct(e);
180
+ return e === "data:," ? t.cloneNode(!1) : ut(e);
181
181
  }
182
- async function gn(t, e) {
182
+ async function vn(t, e) {
183
183
  if (t.currentSrc) {
184
184
  const a = document.createElement("canvas"), o = a.getContext("2d");
185
185
  a.width = t.clientWidth, a.height = t.clientHeight, o == null || o.drawImage(t, 0, 0, a.width, a.height);
186
186
  const c = a.toDataURL();
187
- return ct(c);
187
+ return ut(c);
188
188
  }
189
- const n = t.poster, r = Bt(n), i = await Dt(n, r, e);
190
- return ct(i);
189
+ const n = t.poster, r = Ht(n), i = await Ft(n, r, e);
190
+ return ut(i);
191
191
  }
192
- async function wn(t, e) {
192
+ async function bn(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 yt(t.contentDocument.body, e, !0);
196
+ return await wt(t.contentDocument.body, e, !0);
197
197
  } catch {
198
198
  }
199
199
  return t.cloneNode(!1);
200
200
  }
201
- async function vn(t, e) {
202
- return x(t, HTMLCanvasElement) ? yn(t) : x(t, HTMLVideoElement) ? gn(t, e) : x(t, HTMLIFrameElement) ? wn(t, e) : t.cloneNode(ye(t));
201
+ async function Sn(t, e) {
202
+ return E(t, HTMLCanvasElement) ? wn(t) : E(t, HTMLVideoElement) ? vn(t, e) : E(t, HTMLIFrameElement) ? bn(t, e) : t.cloneNode(ge(t));
203
203
  }
204
- const bn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ye = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
- async function Sn(t, e, n) {
204
+ const xn = (t) => t.tagName != null && t.tagName.toUpperCase() === "SLOT", ge = (t) => t.tagName != null && t.tagName.toUpperCase() === "SVG";
205
+ async function En(t, e, n) {
206
206
  var r, i;
207
- if (ye(e))
207
+ if (ge(e))
208
208
  return e;
209
209
  let a = [];
210
- return bn(t) && t.assignedNodes ? a = U(t.assignedNodes()) : x(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? a = U(t.contentDocument.body.childNodes) : a = U(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || x(t, HTMLVideoElement) || await a.reduce((o, c) => o.then(() => yt(c, n)).then((l) => {
210
+ return xn(t) && t.assignedNodes ? a = j(t.assignedNodes()) : E(t, HTMLIFrameElement) && (!((r = t.contentDocument) === null || r === void 0) && r.body) ? a = j(t.contentDocument.body.childNodes) : a = j(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), a.length === 0 || E(t, HTMLVideoElement) || await a.reduce((o, c) => o.then(() => wt(c, n)).then((l) => {
211
211
  l && e.appendChild(l);
212
212
  }), Promise.resolve()), e;
213
213
  }
214
- function xn(t, e, n) {
214
+ function Cn(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) : he(n).forEach((a) => {
219
+ i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : pe(n).forEach((a) => {
220
220
  let o = i.getPropertyValue(a);
221
- a === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), x(t, HTMLIFrameElement) && a === "display" && o === "inline" && (o = "block"), a === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(a, o, i.getPropertyPriority(a));
221
+ a === "font-size" && o.endsWith("px") && (o = `${Math.floor(parseFloat(o.substring(0, o.length - 2))) - 0.1}px`), E(t, HTMLIFrameElement) && a === "display" && o === "inline" && (o = "block"), a === "d" && e.getAttribute("d") && (o = `path(${e.getAttribute("d")})`), r.setProperty(a, o, i.getPropertyPriority(a));
222
222
  });
223
223
  }
224
- function En(t, e) {
225
- x(t, HTMLTextAreaElement) && (e.innerHTML = t.value), x(t, HTMLInputElement) && e.setAttribute("value", t.value);
224
+ function kn(t, e) {
225
+ E(t, HTMLTextAreaElement) && (e.innerHTML = t.value), E(t, HTMLInputElement) && e.setAttribute("value", t.value);
226
226
  }
227
- function Cn(t, e) {
228
- if (x(t, HTMLSelectElement)) {
227
+ function Ln(t, e) {
228
+ if (E(t, HTMLSelectElement)) {
229
229
  const r = Array.from(e.children).find((i) => t.value === i.getAttribute("value"));
230
230
  r && r.setAttribute("selected", "");
231
231
  }
232
232
  }
233
233
  function An(t, e, n) {
234
- return x(e, Element) && (xn(t, e, n), un(t, e, n), En(t, e), Cn(t, e)), e;
234
+ return E(e, Element) && (Cn(t, e, n), fn(t, e, n), kn(t, e), Ln(t, e)), e;
235
235
  }
236
236
  async function Mn(t, e) {
237
237
  const n = t.querySelectorAll ? t.querySelectorAll("use") : [];
@@ -242,7 +242,7 @@ async function Mn(t, e) {
242
242
  const c = n[a].getAttribute("xlink:href");
243
243
  if (c) {
244
244
  const l = t.querySelector(c), u = document.querySelector(c);
245
- !l && u && !r[c] && (r[c] = await yt(u, e, !0));
245
+ !l && u && !r[c] && (r[c] = await wt(u, e, !0));
246
246
  }
247
247
  }
248
248
  const i = Object.values(r);
@@ -257,31 +257,31 @@ async function Mn(t, e) {
257
257
  }
258
258
  return t;
259
259
  }
260
- async function yt(t, e, n) {
261
- return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => vn(r, e)).then((r) => Sn(t, r, e)).then((r) => An(t, r, e)).then((r) => Mn(r, e));
260
+ async function wt(t, e, n) {
261
+ return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => Sn(r, e)).then((r) => En(t, r, e)).then((r) => An(t, r, e)).then((r) => Mn(r, e));
262
262
  }
263
- const ge = /url\((['"]?)([^'"]+?)\1\)/g, Ln = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, $n = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
- function Rn(t) {
263
+ const we = /url\((['"]?)([^'"]+?)\1\)/g, Rn = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, $n = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
264
+ function Tn(t) {
265
265
  const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
266
266
  return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
267
267
  }
268
- function kn(t) {
268
+ function Pn(t) {
269
269
  const e = [];
270
- return t.replace(ge, (n, r, i) => (e.push(i), n)), e.filter((n) => !Lt(n));
270
+ return t.replace(we, (n, r, i) => (e.push(i), n)), e.filter((n) => !Rt(n));
271
271
  }
272
- async function Tn(t, e, n, r, i) {
272
+ async function In(t, e, n, r, i) {
273
273
  try {
274
- const a = n ? Qe(e, n) : e, o = Bt(e);
274
+ const a = n ? tn(e, n) : e, o = Ht(e);
275
275
  let c;
276
- return i || (c = await Dt(a, o, r)), t.replace(Rn(e), `$1${c}$3`);
276
+ return i || (c = await Ft(a, o, r)), t.replace(Tn(e), `$1${c}$3`);
277
277
  } catch {
278
278
  }
279
279
  return t;
280
280
  }
281
- function Pn(t, { preferredFontFormat: e }) {
281
+ function On(t, { preferredFontFormat: e }) {
282
282
  return e ? t.replace($n, (n) => {
283
283
  for (; ; ) {
284
- const [r, , i] = Ln.exec(n) || [];
284
+ const [r, , i] = Rn.exec(n) || [];
285
285
  if (!i)
286
286
  return "";
287
287
  if (i === e)
@@ -289,32 +289,32 @@ function Pn(t, { preferredFontFormat: e }) {
289
289
  }
290
290
  }) : t;
291
291
  }
292
- function we(t) {
293
- return t.search(ge) !== -1;
292
+ function ve(t) {
293
+ return t.search(we) !== -1;
294
294
  }
295
- async function ve(t, e, n) {
296
- if (!we(t))
295
+ async function be(t, e, n) {
296
+ if (!ve(t))
297
297
  return t;
298
- const r = Pn(t, n);
299
- return kn(r).reduce((a, o) => a.then((c) => Tn(c, o, e, n)), Promise.resolve(r));
298
+ const r = On(t, n);
299
+ return Pn(r).reduce((a, o) => a.then((c) => In(c, o, e, n)), Promise.resolve(r));
300
300
  }
301
- async function J(t, e, n) {
301
+ async function tt(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 a = await ve(i, null, n);
305
+ const a = await be(i, null, n);
306
306
  return e.style.setProperty(t, a, e.style.getPropertyPriority(t)), !0;
307
307
  }
308
308
  return !1;
309
309
  }
310
- async function In(t, e) {
311
- await J("background", t, e) || await J("background-image", t, e), await J("mask", t, e) || await J("-webkit-mask", t, e) || await J("mask-image", t, e) || await J("-webkit-mask-image", t, e);
310
+ async function Bn(t, e) {
311
+ await tt("background", t, e) || await tt("background-image", t, e), await tt("mask", t, e) || await tt("-webkit-mask", t, e) || await tt("mask-image", t, e) || await tt("-webkit-mask-image", t, e);
312
312
  }
313
- async function On(t, e) {
314
- const n = x(t, HTMLImageElement);
315
- if (!(n && !Lt(t.src)) && !(x(t, SVGImageElement) && !Lt(t.href.baseVal)))
313
+ async function Dn(t, e) {
314
+ const n = E(t, HTMLImageElement);
315
+ if (!(n && !Rt(t.src)) && !(E(t, SVGImageElement) && !Rt(t.href.baseVal)))
316
316
  return;
317
- const r = n ? t.src : t.href.baseVal, i = await Dt(r, Bt(r), e);
317
+ const r = n ? t.src : t.href.baseVal, i = await Ft(r, Ht(r), e);
318
318
  await new Promise((a, o) => {
319
319
  t.onload = a, t.onerror = e.onImageErrorHandler ? (...l) => {
320
320
  try {
@@ -327,14 +327,14 @@ async function On(t, e) {
327
327
  c.decode && (c.decode = a), c.loading === "lazy" && (c.loading = "eager"), n ? (t.srcset = "", t.src = i) : t.href.baseVal = i;
328
328
  });
329
329
  }
330
- async function Bn(t, e) {
331
- const r = U(t.childNodes).map((i) => be(i, e));
330
+ async function Hn(t, e) {
331
+ const r = j(t.childNodes).map((i) => Se(i, e));
332
332
  await Promise.all(r).then(() => t);
333
333
  }
334
- async function be(t, e) {
335
- x(t, Element) && (await In(t, e), await On(t, e), await Bn(t, e));
334
+ async function Se(t, e) {
335
+ E(t, Element) && (await Bn(t, e), await Dn(t, e), await Hn(t, e));
336
336
  }
337
- function Dn(t, e) {
337
+ function Fn(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,15 +342,15 @@ function Dn(t, e) {
342
342
  n[i] = r[i];
343
343
  }), t;
344
344
  }
345
- const Yt = {};
346
- async function Gt(t) {
347
- let e = Yt[t];
345
+ const Gt = {};
346
+ async function Jt(t) {
347
+ let e = Gt[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 }, Yt[t] = e, e;
351
+ return e = { url: t, cssText: r }, Gt[t] = e, e;
352
352
  }
353
- async function Jt(t, e) {
353
+ async function Qt(t, e) {
354
354
  let n = t.cssText;
355
355
  const r = /url\(["']?([^"')]+)["']?\)/g, a = (n.match(/url\([^)]+\)/g) || []).map(async (o) => {
356
356
  let c = o.replace(r, "$1");
@@ -358,7 +358,7 @@ async function Jt(t, e) {
358
358
  });
359
359
  return Promise.all(a).then(() => n);
360
360
  }
361
- function Qt(t) {
361
+ function Zt(t) {
362
362
  if (t == null)
363
363
  return [];
364
364
  const e = [], n = /(\/\*[\s\S]*?\*\/)/gi;
@@ -384,20 +384,20 @@ function Qt(t) {
384
384
  }
385
385
  return e;
386
386
  }
387
- async function Hn(t, e) {
387
+ async function Un(t, e) {
388
388
  const n = [], r = [];
389
389
  return t.forEach((i) => {
390
390
  if ("cssRules" in i)
391
391
  try {
392
- U(i.cssRules || []).forEach((a, o) => {
392
+ j(i.cssRules || []).forEach((a, o) => {
393
393
  if (a.type === CSSRule.IMPORT_RULE) {
394
394
  let c = o + 1;
395
- const l = a.href, u = Gt(l).then((f) => Jt(f, e)).then((f) => Qt(f).forEach((m) => {
395
+ const l = a.href, u = Jt(l).then((f) => Qt(f, e)).then((f) => Zt(f).forEach((y) => {
396
396
  try {
397
- i.insertRule(m, m.startsWith("@import") ? c += 1 : i.cssRules.length);
397
+ i.insertRule(y, y.startsWith("@import") ? c += 1 : i.cssRules.length);
398
398
  } catch (g) {
399
399
  console.error("Error inserting rule from remote css", {
400
- rule: m,
400
+ rule: y,
401
401
  error: g
402
402
  });
403
403
  }
@@ -409,7 +409,7 @@ async function Hn(t, e) {
409
409
  });
410
410
  } catch (a) {
411
411
  const o = t.find((c) => c.href == null) || document.styleSheets[0];
412
- i.href != null && r.push(Gt(i.href).then((c) => Jt(c, e)).then((c) => Qt(c).forEach((l) => {
412
+ i.href != null && r.push(Jt(i.href).then((c) => Qt(c, e)).then((c) => Zt(c).forEach((l) => {
413
413
  o.insertRule(l, o.cssRules.length);
414
414
  })).catch((c) => {
415
415
  console.error("Error loading remote stylesheet", c);
@@ -418,7 +418,7 @@ async function Hn(t, e) {
418
418
  }), Promise.all(r).then(() => (t.forEach((i) => {
419
419
  if ("cssRules" in i)
420
420
  try {
421
- U(i.cssRules || []).forEach((a) => {
421
+ j(i.cssRules || []).forEach((a) => {
422
422
  n.push(a);
423
423
  });
424
424
  } catch (a) {
@@ -426,60 +426,60 @@ async function Hn(t, e) {
426
426
  }
427
427
  }), n));
428
428
  }
429
- function Fn(t) {
430
- return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => we(e.style.getPropertyValue("src")));
429
+ function Nn(t) {
430
+ return t.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => ve(e.style.getPropertyValue("src")));
431
431
  }
432
- async function Un(t, e) {
432
+ async function _n(t, e) {
433
433
  if (t.ownerDocument == null)
434
434
  throw new Error("Provided element is not within a Document");
435
- const n = U(t.ownerDocument.styleSheets), r = await Hn(n, e);
436
- return Fn(r);
435
+ const n = j(t.ownerDocument.styleSheets), r = await Un(n, e);
436
+ return Nn(r);
437
437
  }
438
- function Se(t) {
438
+ function xe(t) {
439
439
  return t.trim().replace(/["']/g, "");
440
440
  }
441
- function Nn(t) {
441
+ function jn(t) {
442
442
  const e = /* @__PURE__ */ new Set();
443
443
  function n(r) {
444
444
  (r.style.fontFamily || getComputedStyle(r).fontFamily).split(",").forEach((a) => {
445
- e.add(Se(a));
445
+ e.add(xe(a));
446
446
  }), Array.from(r.children).forEach((a) => {
447
447
  a instanceof HTMLElement && n(a);
448
448
  });
449
449
  }
450
450
  return n(t), e;
451
451
  }
452
- async function jn(t, e) {
453
- const n = await Un(t, e), r = Nn(t);
454
- return (await Promise.all(n.filter((a) => r.has(Se(a.style.fontFamily))).map((a) => {
452
+ async function Vn(t, e) {
453
+ const n = await _n(t, e), r = jn(t);
454
+ return (await Promise.all(n.filter((a) => r.has(xe(a.style.fontFamily))).map((a) => {
455
455
  const o = a.parentStyleSheet ? a.parentStyleSheet.href : null;
456
- return ve(a.cssText, o, e);
456
+ return be(a.cssText, o, e);
457
457
  }))).join(`
458
458
  `);
459
459
  }
460
- async function _n(t, e) {
461
- const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await jn(t, e);
460
+ async function Wn(t, e) {
461
+ const n = e.fontEmbedCSS != null ? e.fontEmbedCSS : e.skipFonts ? null : await Vn(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 Vn(t, e = {}) {
468
- const { width: n, height: r } = pe(t, e), i = await yt(t, e, !0);
469
- return await _n(i, e), await be(i, e), Dn(i, e), await on(i, n, r);
467
+ async function zn(t, e = {}) {
468
+ const { width: n, height: r } = ye(t, e), i = await wt(t, e, !0);
469
+ return await Wn(i, e), await Se(i, e), Fn(i, e), await cn(i, n, r);
470
470
  }
471
- async function Wn(t, e = {}) {
472
- const { width: n, height: r } = pe(t, e), i = await Vn(t, e), a = await ct(i), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || nn(), u = e.canvasWidth || n, f = e.canvasHeight || r;
473
- return o.width = u * l, o.height = f * l, e.skipAutoScale || rn(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(a, 0, 0, o.width, o.height), o;
471
+ async function Kn(t, e = {}) {
472
+ const { width: n, height: r } = ye(t, e), i = await zn(t, e), a = await ut(i), o = document.createElement("canvas"), c = o.getContext("2d"), l = e.pixelRatio || an(), u = e.canvasWidth || n, f = e.canvasHeight || r;
473
+ return o.width = u * l, o.height = f * l, e.skipAutoScale || on(o), o.style.width = `${u}`, o.style.height = `${f}`, e.backgroundColor && (c.fillStyle = e.backgroundColor, c.fillRect(0, 0, o.width, o.height)), c.drawImage(a, 0, 0, o.width, o.height), o;
474
474
  }
475
- async function Zt(t, e = {}) {
476
- return (await Wn(t, e)).toDataURL();
475
+ async function te(t, e = {}) {
476
+ return (await Kn(t, e)).toDataURL();
477
477
  }
478
- const lt = "data-nf-capture-chrome", zn = "data-nf-canvas-snap", Kn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
479
- function xe(t) {
480
- return t instanceof Element && (t.hasAttribute(lt) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
478
+ const dt = "data-nf-capture-chrome", qn = "data-nf-canvas-snap", Xn = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";
479
+ function Ee(t) {
480
+ return t instanceof Element && (t.hasAttribute(dt) || t.hasAttribute("data-nf-mask-cover") || t.id === "notefully");
481
481
  }
482
- function qn() {
482
+ function Yn() {
483
483
  const t = [];
484
484
  return Array.from(document.styleSheets).forEach((e) => {
485
485
  try {
@@ -503,7 +503,7 @@ function qn() {
503
503
  });
504
504
  };
505
505
  }
506
- function Xn() {
506
+ function Gn() {
507
507
  const t = [];
508
508
  return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach((n) => {
509
509
  const r = n.getBoundingClientRect(), i = document.createElement("div");
@@ -519,28 +519,28 @@ function Xn() {
519
519
  ].join(";"), document.body.appendChild(i), t.push(i);
520
520
  }), () => t.forEach((n) => n.remove());
521
521
  }
522
- function Yn() {
523
- const t = document.querySelector(`[${lt}]`);
522
+ function Jn() {
523
+ const t = document.querySelector(`[${dt}]`);
524
524
  if (t)
525
525
  return t;
526
526
  const e = document.createElement("div");
527
- return e.setAttribute(lt, "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;
527
+ return e.setAttribute(dt, "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;
528
528
  }
529
- function Gn() {
530
- document.querySelectorAll(`[${lt}]`).forEach((t) => t.remove());
529
+ function Qn() {
530
+ document.querySelectorAll(`[${dt}]`).forEach((t) => t.remove());
531
531
  }
532
532
  function $t() {
533
533
  return new Promise((t) => {
534
534
  requestAnimationFrame(() => requestAnimationFrame(t));
535
535
  });
536
536
  }
537
- function N(t) {
537
+ function V(t) {
538
538
  if (typeof t != "string" || !t.startsWith("data:image/"))
539
539
  return !1;
540
540
  const e = t.indexOf(",");
541
541
  return e > 0 && e < t.length - 1;
542
542
  }
543
- function Jn() {
543
+ function Zn() {
544
544
  const t = document.documentElement, e = document.body, n = Math.max(
545
545
  window.innerWidth || 0,
546
546
  (t == null ? void 0 : t.clientWidth) || 0,
@@ -556,10 +556,10 @@ function Jn() {
556
556
  );
557
557
  return { width: n, height: r };
558
558
  }
559
- async function Qn() {
559
+ async function tr() {
560
560
  const t = [], e = Array.from(document.querySelectorAll("canvas"));
561
561
  for (const n of e) {
562
- if (n.closest("#notefully") || xe(n))
562
+ if (n.closest("#notefully") || Ee(n))
563
563
  continue;
564
564
  let r = "";
565
565
  try {
@@ -570,7 +570,7 @@ async function Qn() {
570
570
  if (!r || r === "data:,")
571
571
  continue;
572
572
  const i = document.createElement("img"), a = getComputedStyle(n);
573
- i.setAttribute(zn, "1"), i.alt = "", i.src = r, i.className = n.className, i.style.cssText = n.style.cssText, i.style.width = a.width, i.style.height = a.height, i.style.maxWidth = a.maxWidth, i.style.maxHeight = a.maxHeight, i.style.objectFit = "fill", i.style.display = a.display === "inline" ? "inline-block" : a.display, n.replaceWith(i), t.push({ canvas: n, img: i });
573
+ i.setAttribute(qn, "1"), i.alt = "", i.src = r, i.className = n.className, i.style.cssText = n.style.cssText, i.style.width = a.width, i.style.height = a.height, i.style.maxWidth = a.maxWidth, i.style.maxHeight = a.maxHeight, i.style.objectFit = "fill", i.style.display = a.display === "inline" ? "inline-block" : a.display, n.replaceWith(i), t.push({ canvas: n, img: i });
574
574
  }
575
575
  return await Promise.all(t.map(({ img: n }) => {
576
576
  if (!n.complete)
@@ -586,25 +586,25 @@ async function Qn() {
586
586
  });
587
587
  };
588
588
  }
589
- async function Zn(t) {
589
+ async function er(t) {
590
590
  if (!t)
591
591
  return null;
592
592
  if (typeof t == "string")
593
- return N(t) ? t : null;
593
+ return V(t) ? t : null;
594
594
  if (typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement)
595
595
  try {
596
596
  const e = t.toDataURL("image/png");
597
- return N(e) ? e : null;
597
+ return V(e) ? e : null;
598
598
  } catch {
599
599
  return null;
600
600
  }
601
601
  if (typeof Blob < "u" && t instanceof Blob) {
602
- const e = await tr(t);
603
- return N(e) ? e : null;
602
+ const e = await nr(t);
603
+ return V(e) ? e : null;
604
604
  }
605
605
  return null;
606
606
  }
607
- async function tr(t) {
607
+ async function nr(t) {
608
608
  if (typeof FileReader == "function")
609
609
  return new Promise((r, i) => {
610
610
  const a = new FileReader();
@@ -613,7 +613,7 @@ async function tr(t) {
613
613
  const e = Buffer.from(await t.arrayBuffer());
614
614
  return `data:${t.type || "application/octet-stream"};base64,${e.toString("base64")}`;
615
615
  }
616
- async function er() {
616
+ async function rr() {
617
617
  var e;
618
618
  if (!((e = navigator.mediaDevices) != null && e.getDisplayMedia))
619
619
  throw new Error("Screen capture is not supported in this browser.");
@@ -631,44 +631,44 @@ async function er() {
631
631
  const r = n.videoWidth || 1, i = n.videoHeight || 1, a = document.createElement("canvas");
632
632
  a.width = r, a.height = i, a.getContext("2d").drawImage(n, 0, 0, r, i);
633
633
  const o = a.toDataURL("image/png");
634
- if (!N(o))
634
+ if (!V(o))
635
635
  throw new Error("Screen capture produced an empty image.");
636
636
  return o;
637
637
  } finally {
638
638
  t.getTracks().forEach((n) => n.stop());
639
639
  }
640
640
  }
641
- async function Ee(t = {}) {
642
- const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = Yn(), i = qn();
641
+ async function Ce(t = {}) {
642
+ const e = document.getElementById("notefully"), n = e ? e.style.display : "", r = Jn(), i = Yn();
643
643
  let a = () => {
644
644
  };
645
645
  e && (e.style.display = "none");
646
- const o = Xn();
646
+ const o = Gn();
647
647
  try {
648
648
  if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await $t(), typeof t.capture == "function") {
649
- const m = await Zn(await t.capture());
650
- if (m)
651
- return m;
649
+ const y = await er(await t.capture());
650
+ if (y)
651
+ return y;
652
652
  }
653
- a = await Qn(), await $t();
654
- const { width: c, height: l } = Jn(), u = {
653
+ a = await tr(), await $t();
654
+ const { width: c, height: l } = Zn(), u = {
655
655
  cacheBust: !0,
656
656
  width: c,
657
657
  height: l,
658
658
  pixelRatio: Math.min(window.devicePixelRatio || 1, 2),
659
- filter: (m) => !xe(m),
659
+ filter: (y) => !Ee(y),
660
660
  // 404 / CORS images must not abort the whole capture.
661
- imagePlaceholder: Kn,
661
+ imagePlaceholder: Xn,
662
662
  onImageErrorHandler: () => {
663
663
  }
664
664
  };
665
665
  let f = "";
666
666
  try {
667
- f = await Zt(document.body, u);
667
+ f = await te(document.body, u);
668
668
  } catch {
669
- f = await Zt(document.body, { ...u, skipFonts: !0 });
669
+ f = await te(document.body, { ...u, skipFonts: !0 });
670
670
  }
671
- if (!N(f))
671
+ if (!V(f))
672
672
  throw new Error("Screenshot capture produced an empty image.");
673
673
  return f;
674
674
  } finally {
@@ -676,25 +676,25 @@ async function Ee(t = {}) {
676
676
  a();
677
677
  } catch {
678
678
  }
679
- o(), i(), r.remove(), Gn(), e && (e.style.display = n);
679
+ o(), i(), r.remove(), Qn(), e && (e.style.display = n);
680
680
  }
681
681
  }
682
- function nr(t = "") {
682
+ function ir(t = "") {
683
683
  const e = String(t || "");
684
684
  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" : "";
685
685
  }
686
- function rr(t = "") {
686
+ function ar(t = "") {
687
687
  const e = String(t || "");
688
688
  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" : "";
689
689
  }
690
- function ir(t = {}) {
690
+ function or(t = {}) {
691
691
  const e = navigator.userAgent;
692
692
  return {
693
693
  url: location.href,
694
694
  title: document.title,
695
695
  userAgent: e,
696
- os: nr(e),
697
- browser: rr(e),
696
+ os: ir(e),
697
+ browser: ar(e),
698
698
  language: navigator.language,
699
699
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
700
700
  viewport: {
@@ -709,11 +709,11 @@ function ir(t = {}) {
709
709
  }
710
710
  };
711
711
  }
712
- const te = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ee = {
712
+ const ee = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ne = {
713
713
  id: "userId",
714
714
  username: "displayName",
715
715
  name: "displayName"
716
- }, ne = /* @__PURE__ */ new Set([
716
+ }, re = /* @__PURE__ */ new Set([
717
717
  "endpoint",
718
718
  "projectKey",
719
719
  "version",
@@ -725,8 +725,9 @@ const te = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ee = {
725
725
  "consoleLogLimit",
726
726
  "kinds",
727
727
  "capture",
728
- "onBeforeCapture"
729
- ]), re = {
728
+ "onBeforeCapture",
729
+ "displayLink"
730
+ ]), ie = {
730
731
  slug: "Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",
731
732
  projectSlug: "Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",
732
733
  project: "Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",
@@ -735,14 +736,14 @@ const te = /* @__PURE__ */ new Set(["userId", "email", "displayName"]), ee = {
735
736
  email: "Pass people via Notefully.identify({ userId, email, displayName }), not init().",
736
737
  displayName: "Pass people via Notefully.identify({ userId, email, displayName }), not init()."
737
738
  };
738
- function ar(t = {}, e = {}) {
739
- const n = e.warn || Ce, r = t && typeof t == "object" ? t : {}, i = {}, a = [];
740
- for (const o of te)
739
+ function sr(t = {}, e = {}) {
740
+ const n = e.warn || ke, r = t && typeof t == "object" ? t : {}, i = {}, a = [];
741
+ for (const o of ee)
741
742
  Object.prototype.hasOwnProperty.call(r, o) && (i[o] = r[o]);
742
- for (const [o, c] of Object.entries(ee))
743
+ for (const [o, c] of Object.entries(ne))
743
744
  Object.prototype.hasOwnProperty.call(r, o) && (Object.prototype.hasOwnProperty.call(i, c) || (i[c] = r[o]));
744
745
  for (const o of Object.keys(r))
745
- te.has(o) || Object.prototype.hasOwnProperty.call(ee, o) || a.push(o);
746
+ ee.has(o) || Object.prototype.hasOwnProperty.call(ne, o) || a.push(o);
746
747
  if (a.length) {
747
748
  const o = a.some((c) => c === "name" || c === "slug" || c === "projectSlug") ? " Pass the package/report name via Notefully.init({ name }), not identify()." : "";
748
749
  n(
@@ -751,24 +752,24 @@ function ar(t = {}, e = {}) {
751
752
  }
752
753
  return i;
753
754
  }
754
- function or(t = {}, e = {}) {
755
- const n = e.warn || Ce, r = t && typeof t == "object" ? t : {}, i = Object.keys(r).filter((a) => !ne.has(a));
755
+ function cr(t = {}, e = {}) {
756
+ const n = e.warn || ke, r = t && typeof t == "object" ? t : {}, i = Object.keys(r).filter((a) => !re.has(a));
756
757
  if (i.length)
757
758
  for (const a of i) {
758
- if (re[a]) {
759
- n(`Notefully.init: ignoring "${a}". ${re[a]}`);
759
+ if (ie[a]) {
760
+ n(`Notefully.init: ignoring "${a}". ${ie[a]}`);
760
761
  continue;
761
762
  }
762
763
  n(
763
- `Notefully.init: ignoring unknown key "${a}". Supported: ${[...ne].join(", ")}.`
764
+ `Notefully.init: ignoring unknown key "${a}". Supported: ${[...re].join(", ")}.`
764
765
  );
765
766
  }
766
767
  }
767
- function Ce(t) {
768
+ function ke(t) {
768
769
  typeof console < "u" && typeof console.warn == "function" && console.warn(t);
769
770
  }
770
- const sr = 80;
771
- function cr() {
771
+ const lr = 80;
772
+ function ur() {
772
773
  const t = [], e = {};
773
774
  let n = !1;
774
775
  const r = (a, o) => {
@@ -782,7 +783,7 @@ function cr() {
782
783
  level: a,
783
784
  text: c.slice(0, 2e3),
784
785
  at: Date.now()
785
- }), t.length > sr && t.shift();
786
+ }), t.length > lr && t.shift();
786
787
  };
787
788
  return {
788
789
  hook: () => {
@@ -801,7 +802,7 @@ function cr() {
801
802
  }
802
803
  };
803
804
  }
804
- function lr(t) {
805
+ function dr(t) {
805
806
  const e = window.SpeechRecognition || window.webkitSpeechRecognition;
806
807
  let n = null, r = !1;
807
808
  const i = () => {
@@ -831,8 +832,8 @@ function lr(t) {
831
832
  isActive: () => r
832
833
  };
833
834
  }
834
- const ur = 60 * 1e3;
835
- function dr({ onStart: t, onStop: e, onError: n }) {
835
+ const fr = 60 * 1e3;
836
+ function hr({ onStart: t, onStop: e, onError: n }) {
836
837
  let r = null, i = null, a = [], o = null;
837
838
  const c = () => {
838
839
  if (o && (clearTimeout(o), o = null), i && i.state !== "inactive")
@@ -849,7 +850,7 @@ function dr({ onStart: t, onStop: e, onError: n }) {
849
850
  c(), e(null);
850
851
  };
851
852
  return { start: async () => {
852
- var f, m;
853
+ var f, y;
853
854
  if (!((f = navigator.mediaDevices) != null && f.getDisplayMedia))
854
855
  throw new Error("Screen recording is not supported in this browser.");
855
856
  r = await navigator.mediaDevices.getDisplayMedia({
@@ -864,10 +865,10 @@ function dr({ onStart: t, onStop: e, onError: n }) {
864
865
  }, i.onstop = () => {
865
866
  const g = a.length ? new Blob(a, { type: i.mimeType || "video/webm" }) : null;
866
867
  c(), e(g);
867
- }, (m = r.getVideoTracks()[0]) == null || m.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, ur);
868
+ }, (y = r.getVideoTracks()[0]) == null || y.addEventListener("ended", () => l()), i.start(), o = setTimeout(l, fr);
868
869
  }, stop: l };
869
870
  }
870
- function fr() {
871
+ function pr() {
871
872
  const t = /* @__PURE__ */ new Set();
872
873
  return {
873
874
  alloc() {
@@ -885,19 +886,19 @@ function fr() {
885
886
  }
886
887
  };
887
888
  }
888
- const xt = { x: 0, y: 0, w: 1, h: 1 };
889
- function Ht() {
890
- const t = fr();
891
- let e = [], n = { ...xt }, r = 1;
889
+ const Ct = { x: 0, y: 0, w: 1, h: 1 };
890
+ function Ut() {
891
+ const t = pr();
892
+ let e = [], n = { ...Ct }, r = 1;
892
893
  return {
893
- list: () => e.filter((a) => pr(a, n)),
894
+ list: () => e.filter((a) => mr(a, n)),
894
895
  all: () => e.slice(),
895
896
  crop: () => ({ ...n }),
896
897
  setCrop(a) {
897
- return n = hr(a), n;
898
+ return n = yr(a), n;
898
899
  },
899
900
  resetCrop() {
900
- return n = { ...xt }, n;
901
+ return n = { ...Ct }, n;
901
902
  },
902
903
  isCropped() {
903
904
  return n.x > 1e-6 || n.y > 1e-6 || n.w < 1 - 1e-6 || n.h < 1 - 1e-6;
@@ -929,20 +930,20 @@ function Ht() {
929
930
  return t.free(c.number), c;
930
931
  },
931
932
  reset() {
932
- for (e = [], n = { ...xt }, r = 1; t.peekUsed().length; )
933
+ for (e = [], n = { ...Ct }, r = 1; t.peekUsed().length; )
933
934
  t.free(t.peekUsed()[0]);
934
935
  }
935
936
  };
936
937
  }
937
- function hr(t) {
938
+ function yr(t) {
938
939
  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);
939
940
  return { x: e, y: n, w: r, h: i };
940
941
  }
941
- function pr(t, e) {
942
+ function mr(t, e) {
942
943
  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;
943
944
  return n >= e.x && r >= e.y && n <= e.x + e.w && r <= e.y + e.h;
944
945
  }
945
- function Ft(t) {
946
+ function Nt(t) {
946
947
  const e = Math.max(1, Number(t) || 1);
947
948
  return {
948
949
  stroke: Math.max(2, e * 75e-4),
@@ -952,52 +953,52 @@ function Ft(t) {
952
953
  arrowHeadAngle: 0.4
953
954
  };
954
955
  }
955
- function mr(t, {
956
+ function gr(t, {
956
957
  stickers: e = [],
957
958
  crop: n = { x: 0, y: 0, w: 1, h: 1 },
958
959
  width: r,
959
960
  height: i,
960
961
  colors: a = {}
961
962
  }) {
962
- const o = a.mark || "#fdd341", c = a.markText || "#2a2140", l = Ft(r);
963
+ const o = a.mark || "#fdd341", c = a.markText || "#2a2140", l = Nt(r);
963
964
  t.save(), t.lineWidth = l.stroke, t.lineCap = "round", t.lineJoin = "round", t.strokeStyle = o, t.fillStyle = o, t.font = `700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`, e.forEach((u) => {
964
- const f = Rt(u.x, n, r), m = kt(u.y, n, i), g = u.w / n.w * r, S = u.h / n.h * i, R = l.stroke / 2;
965
+ const f = Tt(u.x, n, r), y = Pt(u.y, n, i), g = u.w / n.w * r, w = u.h / n.h * i, x = l.stroke / 2;
965
966
  if (u.type === "rect")
966
967
  t.strokeRect(
967
- f + R,
968
- m + R,
968
+ f + x,
969
+ y + x,
969
970
  Math.max(0, g - l.stroke),
970
- Math.max(0, S - l.stroke)
971
+ Math.max(0, w - l.stroke)
971
972
  );
972
973
  else if (u.type === "circle")
973
974
  t.beginPath(), t.ellipse(
974
975
  f + g / 2,
975
- m + S / 2,
976
- Math.max(0.5, g / 2 - R),
977
- Math.max(0.5, S / 2 - R),
976
+ y + w / 2,
977
+ Math.max(0.5, g / 2 - x),
978
+ Math.max(0.5, w / 2 - x),
978
979
  0,
979
980
  0,
980
981
  Math.PI * 2
981
982
  ), t.stroke();
982
983
  else if (u.type === "arrow") {
983
- const q = Rt(u.x2 ?? u.x + u.w, n, r), X = kt(u.y2 ?? u.y, n, i);
984
- gr(t, f, m, q, X, l);
984
+ const A = Tt(u.x2 ?? u.x + u.w, n, r), H = Pt(u.y2 ?? u.y, n, i);
985
+ vr(t, f, y, A, H, l);
985
986
  }
986
987
  if (u.number == null || u.number === "")
987
988
  return;
988
- const D = yr(u, n, r, i, f, m, g), Z = String(u.number);
989
- t.beginPath(), t.arc(D.x, D.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(Z, D.x, D.y + 0.5), t.fillStyle = o;
989
+ const C = wr(u, n, r, i, f, y, g), I = String(u.number);
990
+ t.beginPath(), t.arc(C.x, C.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(I, C.x, C.y + 0.5), t.fillStyle = o;
990
991
  }), t.restore();
991
992
  }
992
- function Rt(t, e, n) {
993
+ function Tt(t, e, n) {
993
994
  return (t - e.x) / e.w * n;
994
995
  }
995
- function kt(t, e, n) {
996
+ function Pt(t, e, n) {
996
997
  return (t - e.y) / e.h * n;
997
998
  }
998
- function yr(t, e, n, r, i, a, o) {
999
+ function wr(t, e, n, r, i, a, o) {
999
1000
  if (t.type === "arrow") {
1000
- const c = Rt(t.x2 ?? t.x + t.w, e, n), l = kt(t.y2 ?? t.y, e, r);
1001
+ const c = Tt(t.x2 ?? t.x + t.w, e, n), l = Pt(t.y2 ?? t.y, e, r);
1001
1002
  return {
1002
1003
  x: (i + c) / 2,
1003
1004
  y: (a + l) / 2
@@ -1005,47 +1006,47 @@ function yr(t, e, n, r, i, a, o) {
1005
1006
  }
1006
1007
  return { x: i + o / 2, y: a };
1007
1008
  }
1008
- function Ae(t, e, n, r, i) {
1009
- const a = Math.atan2(r - e, n - t), o = i.arrowHead, c = Math.min(i.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(a) * o, m = r - Math.sin(a) * o, g = {
1009
+ function Le(t, e, n, r, i) {
1010
+ const a = Math.atan2(r - e, n - t), o = i.arrowHead, c = Math.min(i.stroke, o * 0.2), l = n, u = r, f = n - Math.cos(a) * o, y = r - Math.sin(a) * o, g = {
1010
1011
  x: l - o * Math.cos(a - i.arrowHeadAngle),
1011
1012
  y: u - o * Math.sin(a - i.arrowHeadAngle)
1012
- }, S = {
1013
+ }, w = {
1013
1014
  x: l - o * Math.cos(a + i.arrowHeadAngle),
1014
1015
  y: u - o * Math.sin(a + i.arrowHeadAngle)
1015
- }, R = {
1016
+ }, x = {
1016
1017
  x: n - Math.cos(a) * c,
1017
1018
  y: r - Math.sin(a) * c
1018
1019
  };
1019
- return { angle: a, tipX: l, tipY: u, baseX: f, baseY: m, left: g, right: S, shaftEnd: R };
1020
+ return { angle: a, tipX: l, tipY: u, baseX: f, baseY: y, left: g, right: w, shaftEnd: x };
1020
1021
  }
1021
- function gr(t, e, n, r, i, a) {
1022
- const o = Ae(e, n, r, i, a);
1022
+ function vr(t, e, n, r, i, a) {
1023
+ const o = Le(e, n, r, i, a);
1023
1024
  t.beginPath(), t.moveTo(e, n), t.lineTo(o.shaftEnd.x, o.shaftEnd.y), t.stroke(), t.beginPath(), t.moveTo(o.tipX, o.tipY), t.lineTo(o.left.x, o.left.y), t.lineTo(o.right.x, o.right.y), t.closePath(), t.fill();
1024
1025
  }
1025
- function wr(t, e, n, r = {}) {
1026
+ function br(t, e, n, r = {}) {
1026
1027
  return new Promise((i, a) => {
1027
1028
  const o = new Image();
1028
1029
  o.onload = () => {
1029
- const c = Math.round(e.x * o.width), l = Math.round(e.y * o.height), u = Math.max(1, Math.round(e.w * o.width)), f = Math.max(1, Math.round(e.h * o.height)), m = document.createElement("canvas");
1030
- m.width = u, m.height = f;
1031
- const g = m.getContext("2d");
1032
- g.drawImage(o, c, l, u, f, 0, 0, u, f), mr(g, {
1030
+ const c = Math.round(e.x * o.width), l = Math.round(e.y * o.height), u = Math.max(1, Math.round(e.w * o.width)), f = Math.max(1, Math.round(e.h * o.height)), y = document.createElement("canvas");
1031
+ y.width = u, y.height = f;
1032
+ const g = y.getContext("2d");
1033
+ g.drawImage(o, c, l, u, f, 0, 0, u, f), gr(g, {
1033
1034
  stickers: n,
1034
1035
  crop: e,
1035
1036
  width: u,
1036
1037
  height: f,
1037
1038
  colors: r
1038
- }), m.toBlob((S) => {
1039
- if (!S) {
1039
+ }), y.toBlob((w) => {
1040
+ if (!w) {
1040
1041
  a(new Error("Could not encode screenshot"));
1041
1042
  return;
1042
1043
  }
1043
- i(S);
1044
+ i(w);
1044
1045
  }, "image/png");
1045
1046
  }, o.onerror = () => a(new Error("Could not load screenshot")), o.src = t;
1046
1047
  });
1047
1048
  }
1048
- const vr = [
1049
+ const Sr = [
1049
1050
  { key: "url", label: "URL" },
1050
1051
  { key: "title", label: "Title" },
1051
1052
  { key: "userAgent", label: "User agent" },
@@ -1056,14 +1057,14 @@ const vr = [
1056
1057
  { key: "viewport", label: "Viewport" },
1057
1058
  { key: "user", label: "User" }
1058
1059
  ];
1059
- function br(t) {
1060
+ function xr(t) {
1060
1061
  return !t || typeof t != "object" ? !1 : !!(t.userId || t.email || t.displayName);
1061
1062
  }
1062
- function Sr(t = {}) {
1063
+ function Er(t = {}) {
1063
1064
  const e = [];
1064
- for (const n of vr) {
1065
+ for (const n of Sr) {
1065
1066
  const r = t[n.key];
1066
- r == null || r === "" || n.key === "user" && !br(r) || e.push({
1067
+ r == null || r === "" || n.key === "user" && !xr(r) || e.push({
1067
1068
  key: n.key,
1068
1069
  label: n.label,
1069
1070
  value: r,
@@ -1072,7 +1073,7 @@ function Sr(t = {}) {
1072
1073
  }
1073
1074
  return e;
1074
1075
  }
1075
- function xr(t = []) {
1076
+ function Cr(t = []) {
1076
1077
  return t.map((e, n) => ({
1077
1078
  id: `log-${n}-${e.at || 0}`,
1078
1079
  level: e.level || "log",
@@ -1081,18 +1082,18 @@ function xr(t = []) {
1081
1082
  redacted: !1
1082
1083
  }));
1083
1084
  }
1084
- function Er(t = []) {
1085
+ function kr(t = []) {
1085
1086
  if (!t.length)
1086
1087
  return { checked: !1, indeterminate: !1 };
1087
1088
  const e = t.filter((n) => n.redacted).length;
1088
1089
  return e === 0 ? { checked: !1, indeterminate: !1 } : e === t.length ? { checked: !0, indeterminate: !1 } : { checked: !1, indeterminate: !0 };
1089
1090
  }
1090
- function ut(t, e) {
1091
+ function ft(t, e) {
1091
1092
  t.forEach((n) => {
1092
1093
  n.redacted = !!e;
1093
1094
  });
1094
1095
  }
1095
- function Cr(t = {}) {
1096
+ function Lr(t = {}) {
1096
1097
  const e = t.diagnostics || [], n = t.logs || [], r = e.some((a) => !a.redacted), i = n.length > 0 && n.some((a) => !a.redacted);
1097
1098
  return r && i ? "Also sending logs and diagnostic information" : r ? "Also sending diagnostic information" : i ? "Also sending logs" : "";
1098
1099
  }
@@ -1119,56 +1120,57 @@ function Mr(t = {}) {
1119
1120
  }));
1120
1121
  return e.console = n, e;
1121
1122
  }
1122
- const _ = [
1123
+ const z = [
1123
1124
  { id: "bug", label: "Bug" },
1124
1125
  { id: "idea", label: "Idea" },
1125
1126
  { id: "other", label: "Other" }
1126
1127
  ];
1127
- function ie(t) {
1128
+ function ae(t) {
1128
1129
  return String(t || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 32);
1129
1130
  }
1130
- function Et(t) {
1131
+ function kt(t) {
1131
1132
  const e = String(t || "").trim();
1132
1133
  return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
1133
1134
  }
1134
- function Lr(t) {
1135
+ function Rr(t) {
1135
1136
  if (!Array.isArray(t) || !t.length)
1136
- return _.map((r) => ({ ...r }));
1137
+ return z.map((r) => ({ ...r }));
1137
1138
  const e = /* @__PURE__ */ new Set(), n = [];
1138
1139
  for (const r of t) {
1139
1140
  let i = "", a = "";
1140
- typeof r == "string" || typeof r == "number" ? (i = ie(r), a = Et(i)) : r && typeof r == "object" && (i = ie(r.id ?? r.value ?? r.kind), a = String(r.label || r.name || Et(i)).trim() || Et(i)), !(!i || e.has(i)) && (e.add(i), n.push({ id: i, label: a }));
1141
+ typeof r == "string" || typeof r == "number" ? (i = ae(r), a = kt(i)) : r && typeof r == "object" && (i = ae(r.id ?? r.value ?? r.kind), a = String(r.label || r.name || kt(i)).trim() || kt(i)), !(!i || e.has(i)) && (e.add(i), n.push({ id: i, label: a }));
1141
1142
  }
1142
- return n.length ? n : _.map((r) => ({ ...r }));
1143
+ return n.length ? n : z.map((r) => ({ ...r }));
1143
1144
  }
1144
- function gt(t) {
1145
+ function vt(t) {
1145
1146
  var n;
1146
- const e = Array.isArray(t) && t.length ? t : _;
1147
+ const e = Array.isArray(t) && t.length ? t : z;
1147
1148
  return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
1148
1149
  }
1149
- const $r = ["maker", "all-business", "brighter-day", "quiet-night"], Me = "maker", Rr = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), Tt = 0.02, ae = 0.05, kr = `
1150
+ const $r = ["maker", "all-business", "brighter-day", "quiet-night"], Ae = "maker", Tr = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), It = 0.02, oe = 0.05, Pr = `
1150
1151
  <svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
1151
1152
  <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"/>
1152
1153
  <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"/>
1153
1154
  </svg>
1154
1155
  `;
1155
- function k(t) {
1156
+ function $(t) {
1156
1157
  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>`;
1157
1158
  }
1158
1159
  const M = {
1159
- crop: k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
1160
- resetCrop: k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
1161
- arrow: k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
1162
- rect: k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
1163
- circle: k('<circle cx="12" cy="12" r="8"/>'),
1164
- discard: k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
1165
- recapture: k('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
1166
- privacy: k('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),
1167
- audio: k('<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"/>'),
1168
- video: k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')
1169
- }, Le = cr();
1170
- Le.hook();
1171
- const $e = 10, Tr = 80, Re = "notefully.author", ke = "notefully.kind", Te = "notefully.redactSections", Pt = "Anonymous";
1160
+ crop: $('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
1161
+ resetCrop: $('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
1162
+ arrow: $('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
1163
+ rect: $('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
1164
+ circle: $('<circle cx="12" cy="12" r="8"/>'),
1165
+ discard: $('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
1166
+ recapture: $('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
1167
+ privacy: $('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),
1168
+ audio: $('<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"/>'),
1169
+ video: $('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>'),
1170
+ openArrow: $('<path d="M5 12h14"/><path d="m13 6 6 6-6 6"/>')
1171
+ }, Me = ur();
1172
+ Me.hook();
1173
+ const Re = 10, Ir = 80, $e = "notefully.author", Te = "notefully.kind", Pe = "notefully.redactSections", Ot = "Anonymous";
1172
1174
  let d = {
1173
1175
  endpoint: "",
1174
1176
  projectKey: "",
@@ -1176,34 +1178,35 @@ let d = {
1176
1178
  name: "",
1177
1179
  targets: null,
1178
1180
  hideLauncher: !1,
1179
- theme: Me,
1181
+ theme: Ae,
1180
1182
  video: !1,
1181
- consoleLogLimit: $e,
1182
- kinds: _.map((t) => ({ ...t })),
1183
+ consoleLogLimit: Re,
1184
+ kinds: z.map((t) => ({ ...t })),
1183
1185
  capture: null,
1184
- onBeforeCapture: null
1185
- }, Ct = !1, T = {}, h = null, s = {}, y = Ht(), I = "", Q = "", P = null, j = gt(_), F = null, L = null, v = null, w = null, ot = null, z = null, tt = null, O = { w: 0, h: 0 }, At = !1, Ut = !1, B = [], $ = [], W = !1;
1186
- function p(t) {
1187
- return h.querySelector(t);
1186
+ onBeforeCapture: null,
1187
+ displayLink: !1
1188
+ }, Lt = !1, O = {}, p = null, s = {}, m = Ut(), D = "", et = "", B = null, W = vt(z), _ = null, T = null, b = null, v = null, ct = null, X = null, rt = null, F = { w: 0, h: 0 }, At = !1, bt = !1, St = !1, U = [], P = [], q = !1;
1189
+ function h(t) {
1190
+ return p.querySelector(t);
1188
1191
  }
1189
- function Pe(t) {
1192
+ function Ie(t) {
1190
1193
  const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
1191
- return $r.includes(e) ? e : Me;
1194
+ return $r.includes(e) ? e : Ae;
1192
1195
  }
1193
- function oe(t, e) {
1194
- return h && getComputedStyle(h).getPropertyValue(t).trim() || e;
1196
+ function se(t, e) {
1197
+ return p && getComputedStyle(p).getPropertyValue(t).trim() || e;
1195
1198
  }
1196
- async function Pr(t) {
1199
+ async function Or(t) {
1197
1200
  return (await fetch(t)).blob();
1198
1201
  }
1199
- function b(t, e = !1) {
1200
- s.status && (s.status.textContent = t || "", ot && (clearTimeout(ot), ot = null), t && !e && (ot = setTimeout(() => {
1202
+ function S(t, e = !1) {
1203
+ s.status && (s.status.textContent = t || "", ct && (clearTimeout(ct), ct = null), t && !e && (ct = setTimeout(() => {
1201
1204
  s.status.textContent = "";
1202
1205
  }, 4e3)));
1203
1206
  }
1204
- function Nt() {
1205
- return h && document.body.contains(h) || (h = document.createElement("div"), h.id = "notefully", h.innerHTML = `
1206
- <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${kr}</button>
1207
+ function _t() {
1208
+ return p && document.body.contains(p) || (p = document.createElement("div"), p.id = "notefully", p.innerHTML = `
1209
+ <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Pr}</button>
1207
1210
  <div class="nf-dialog" hidden>
1208
1211
  <div class="nf-panel">
1209
1212
  <div class="nf-panel-body">
@@ -1243,141 +1246,146 @@ function Nt() {
1243
1246
  <div class="nf-status"></div>
1244
1247
  </div>
1245
1248
  <p class="nf-success-msg" hidden aria-live="polite">Submitted!</p>
1249
+ <a class="nf-success-link" hidden target="_blank" rel="noopener noreferrer" aria-label="View Report">
1250
+ <span class="nf-success-link-label">View Report</span>
1251
+ ${M.openArrow}
1252
+ </a>
1246
1253
  </div>
1247
1254
  </div>
1248
1255
  <button class="nf-stop-video" type="button" hidden>Stop</button>
1249
- `, document.body.appendChild(h), s = {
1250
- launcher: p(".nf-launcher"),
1251
- dialog: p(".nf-dialog"),
1252
- panel: p(".nf-panel"),
1253
- panelBody: p(".nf-panel-body"),
1254
- successMsg: p(".nf-success-msg"),
1255
- stage: p(".nf-stage"),
1256
- palette: p(".nf-palette"),
1257
- canvas: p(".nf-canvas"),
1258
- text: p(".nf-text"),
1259
- author: p(".nf-author"),
1260
- kindRow: p(".nf-kind-row"),
1261
- kind: p(".nf-kind"),
1262
- privacy: p(".nf-privacy"),
1263
- privacySummary: p(".nf-privacy-summary"),
1264
- privacyText: p(".nf-privacy-text"),
1265
- privacyChange: p(".nf-privacy-change"),
1266
- privacyPanel: p(".nf-privacy-panel"),
1267
- privacyScroll: p(".nf-privacy-scroll"),
1268
- privacyDone: p(".nf-privacy-done"),
1269
- actions: p(".nf-actions"),
1270
- restore: p(".nf-restore"),
1271
- status: p(".nf-status"),
1272
- audio: p(".nf-audio"),
1273
- video: p(".nf-video"),
1274
- discard: p(".nf-discard-shot"),
1275
- recapture: p(".nf-recapture"),
1276
- stop: p(".nf-stop-video"),
1277
- resetCrop: p(".nf-reset-crop"),
1278
- submit: p(".nf-submit"),
1256
+ `, document.body.appendChild(p), s = {
1257
+ launcher: h(".nf-launcher"),
1258
+ dialog: h(".nf-dialog"),
1259
+ panel: h(".nf-panel"),
1260
+ panelBody: h(".nf-panel-body"),
1261
+ successMsg: h(".nf-success-msg"),
1262
+ successLink: h(".nf-success-link"),
1263
+ stage: h(".nf-stage"),
1264
+ palette: h(".nf-palette"),
1265
+ canvas: h(".nf-canvas"),
1266
+ text: h(".nf-text"),
1267
+ author: h(".nf-author"),
1268
+ kindRow: h(".nf-kind-row"),
1269
+ kind: h(".nf-kind"),
1270
+ privacy: h(".nf-privacy"),
1271
+ privacySummary: h(".nf-privacy-summary"),
1272
+ privacyText: h(".nf-privacy-text"),
1273
+ privacyChange: h(".nf-privacy-change"),
1274
+ privacyPanel: h(".nf-privacy-panel"),
1275
+ privacyScroll: h(".nf-privacy-scroll"),
1276
+ privacyDone: h(".nf-privacy-done"),
1277
+ actions: h(".nf-actions"),
1278
+ restore: h(".nf-restore"),
1279
+ status: h(".nf-status"),
1280
+ audio: h(".nf-audio"),
1281
+ video: h(".nf-video"),
1282
+ discard: h(".nf-discard-shot"),
1283
+ recapture: h(".nf-recapture"),
1284
+ stop: h(".nf-stop-video"),
1285
+ resetCrop: h(".nf-reset-crop"),
1286
+ submit: h(".nf-submit"),
1279
1287
  shot: null
1280
- }, Ir(), nt()), h;
1288
+ }, Br(), at()), p;
1281
1289
  }
1282
- function nt() {
1290
+ function at() {
1283
1291
  var t;
1284
- 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), Ie(), (t = s.dialog) != null && t.hidden && dt());
1292
+ p && (p.dataset.theme = Ie(d.theme), d.hideLauncher ? p.setAttribute("data-nf-hidden-launcher", "") : p.removeAttribute("data-nf-hidden-launcher"), s.video && (s.video.hidden = !d.video), Oe(), (t = s.dialog) != null && t.hidden && ht());
1285
1293
  }
1286
- function dt() {
1294
+ function ht() {
1287
1295
  s.launcher && (s.launcher.hidden = !!d.hideLauncher);
1288
1296
  }
1289
- function Ir() {
1290
- s.launcher.addEventListener("click", () => Ye()), p(".nf-dialog").addEventListener("click", (e) => {
1291
- Ut || e.target === s.dialog && at();
1292
- }), h.querySelectorAll(".nf-tool").forEach((e) => {
1293
- e.addEventListener("click", () => et(e.dataset.tool));
1294
- }), s.resetCrop.addEventListener("click", Vr), s.canvas.addEventListener("pointerdown", Fr), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
1295
- const t = p(".nf-kind");
1297
+ function Br() {
1298
+ s.launcher.addEventListener("click", () => Je()), h(".nf-dialog").addEventListener("click", (e) => {
1299
+ bt && !St || e.target === s.dialog && nt();
1300
+ }), document.addEventListener("keydown", Ke), p.querySelectorAll(".nf-tool").forEach((e) => {
1301
+ e.addEventListener("click", () => it(e.dataset.tool));
1302
+ }), s.resetCrop.addEventListener("click", zr), s.canvas.addEventListener("pointerdown", Nr), s.canvas.addEventListener("dragstart", (e) => e.preventDefault());
1303
+ const t = h(".nf-kind");
1296
1304
  t && t.addEventListener("click", (e) => {
1297
1305
  const n = e.target.closest("[data-kind]");
1298
1306
  n && jt(n.dataset.kind);
1299
- }), s.discard.addEventListener("click", Wr), s.recapture.addEventListener("click", () => {
1300
- Kr().catch((e) => b(e.message || "Recapture failed."));
1301
- }), s.restore.addEventListener("click", zr), s.audio.addEventListener("click", qr), s.video.addEventListener("click", Xr), s.stop.addEventListener("click", () => tt == null ? void 0 : tt.stop()), s.privacyChange.addEventListener("click", () => mt(!W)), s.privacyDone.addEventListener("click", () => mt(!1)), s.privacyScroll.addEventListener("change", ii), p(".nf-submit").addEventListener("click", () => {
1302
- Je().catch((e) => b(e.message || "Submit failed."));
1303
- }), Ie(), et(null);
1307
+ }), s.discard.addEventListener("click", Kr), s.recapture.addEventListener("click", () => {
1308
+ Xr().catch((e) => S(e.message || "Recapture failed."));
1309
+ }), s.restore.addEventListener("click", qr), s.audio.addEventListener("click", Yr), s.video.addEventListener("click", Gr), s.stop.addEventListener("click", () => rt == null ? void 0 : rt.stop()), s.privacyChange.addEventListener("click", () => gt(!q)), s.privacyDone.addEventListener("click", () => gt(!1)), s.privacyScroll.addEventListener("change", oi), h(".nf-submit").addEventListener("click", () => {
1310
+ Ze().catch((e) => S(e.message || "Submit failed."));
1311
+ }), Oe(), it(null);
1304
1312
  }
1305
- function C(t) {
1313
+ function L(t) {
1306
1314
  return String(t || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
1307
1315
  }
1308
- function Ie() {
1309
- const t = h == null ? void 0 : h.querySelector(".nf-kind");
1316
+ function Oe() {
1317
+ const t = p == null ? void 0 : p.querySelector(".nf-kind");
1310
1318
  if (!t)
1311
1319
  return;
1312
- const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : _;
1313
- t.innerHTML = e.map((i) => `<button type="button" data-kind="${C(i.id)}">${C(i.label)}</button>`).join("");
1314
- const r = e.map((i) => i.id).includes(j) ? j : gt(e);
1320
+ const e = Array.isArray(d.kinds) && d.kinds.length ? d.kinds : z;
1321
+ t.innerHTML = e.map((i) => `<button type="button" data-kind="${L(i.id)}">${L(i.label)}</button>`).join("");
1322
+ const r = e.map((i) => i.id).includes(W) ? W : vt(e);
1315
1323
  jt(r);
1316
1324
  }
1317
1325
  function jt(t) {
1318
- j = (d.kinds || _).map((n) => n.id).includes(t) ? t : gt(d.kinds), h == null || h.querySelectorAll("[data-kind]").forEach((n) => {
1319
- n.dataset.active = String(n.dataset.kind === j);
1320
- }), Br(j);
1326
+ W = (d.kinds || z).map((n) => n.id).includes(t) ? t : vt(d.kinds), p == null || p.querySelectorAll("[data-kind]").forEach((n) => {
1327
+ n.dataset.active = String(n.dataset.kind === W);
1328
+ }), Hr(W);
1321
1329
  }
1322
- function Or() {
1330
+ function Dr() {
1323
1331
  try {
1324
- return String(localStorage.getItem(ke) || "").trim().toLowerCase();
1332
+ return String(localStorage.getItem(Te) || "").trim().toLowerCase();
1325
1333
  } catch {
1326
1334
  return "";
1327
1335
  }
1328
1336
  }
1329
- function Br(t) {
1337
+ function Hr(t) {
1330
1338
  const e = String(t || "").trim().toLowerCase();
1331
1339
  if (e)
1332
1340
  try {
1333
- localStorage.setItem(ke, e);
1341
+ localStorage.setItem(Te, e);
1334
1342
  } catch {
1335
1343
  }
1336
1344
  }
1337
- function Dr() {
1338
- const t = (d.kinds || _).map((n) => n.id), e = Or();
1339
- return e && t.includes(e) ? e : gt(d.kinds);
1345
+ function Fr() {
1346
+ const t = (d.kinds || z).map((n) => n.id), e = Dr();
1347
+ return e && t.includes(e) ? e : vt(d.kinds);
1340
1348
  }
1341
- function et(t) {
1342
- F = Rr.has(t) ? t : null, L = null, h.querySelectorAll(".nf-tool").forEach((e) => {
1343
- e.dataset.active = String(e.dataset.tool === F);
1344
- }), s.canvas && (s.canvas.dataset.draw = F ? "true" : "false"), V() && A();
1349
+ function it(t) {
1350
+ _ = Tr.has(t) ? t : null, T = null, p.querySelectorAll(".nf-tool").forEach((e) => {
1351
+ e.dataset.active = String(e.dataset.tool === _);
1352
+ }), s.canvas && (s.canvas.dataset.draw = _ ? "true" : "false"), K() && R();
1345
1353
  }
1346
- function se(t) {
1354
+ function ce(t) {
1347
1355
  return Math.min(1, Math.max(0, t));
1348
1356
  }
1349
- function rt() {
1357
+ function ot() {
1350
1358
  return s.shot || s.canvas;
1351
1359
  }
1352
- function ft(t) {
1353
- const e = rt().getBoundingClientRect();
1360
+ function pt(t) {
1361
+ const e = ot().getBoundingClientRect();
1354
1362
  return {
1355
- x: se((t.clientX - e.left) / Math.max(e.width, 1)),
1356
- y: se((t.clientY - e.top) / Math.max(e.height, 1))
1363
+ x: ce((t.clientX - e.left) / Math.max(e.width, 1)),
1364
+ y: ce((t.clientY - e.top) / Math.max(e.height, 1))
1357
1365
  };
1358
1366
  }
1359
- function Hr(t) {
1360
- const e = rt().getBoundingClientRect();
1367
+ function Ur(t) {
1368
+ const e = ot().getBoundingClientRect();
1361
1369
  return t.clientX >= e.left && t.clientX <= e.right && t.clientY >= e.top && t.clientY <= e.bottom;
1362
1370
  }
1363
- function Oe(t) {
1364
- const e = ft(t), n = y.crop();
1371
+ function Be(t) {
1372
+ const e = pt(t), n = m.crop();
1365
1373
  return {
1366
1374
  x: n.x + e.x * n.w,
1367
1375
  y: n.y + e.y * n.h
1368
1376
  };
1369
1377
  }
1370
- function wt(t, e) {
1378
+ function xt(t, e) {
1371
1379
  const n = Math.min(t.x, e.x), r = Math.min(t.y, e.y);
1372
1380
  return {
1373
1381
  x: n,
1374
1382
  y: r,
1375
- w: Math.max(Tt, Math.abs(e.x - t.x)),
1376
- h: Math.max(Tt, Math.abs(e.y - t.y))
1383
+ w: Math.max(It, Math.abs(e.x - t.x)),
1384
+ h: Math.max(It, Math.abs(e.y - t.y))
1377
1385
  };
1378
1386
  }
1379
- function _t(t) {
1380
- h && (t ? h.dataset.grabbing = "true" : delete h.dataset.grabbing);
1387
+ function Vt(t) {
1388
+ p && (t ? p.dataset.grabbing = "true" : delete p.dataset.grabbing);
1381
1389
  }
1382
1390
  function Mt(t) {
1383
1391
  try {
@@ -1385,73 +1393,73 @@ function Mt(t) {
1385
1393
  } catch {
1386
1394
  }
1387
1395
  }
1388
- function It() {
1389
- window.addEventListener("pointermove", De), window.addEventListener("pointerup", ht), window.addEventListener("pointercancel", ht);
1396
+ function Bt() {
1397
+ window.addEventListener("pointermove", He), window.addEventListener("pointerup", yt), window.addEventListener("pointercancel", yt);
1390
1398
  }
1391
- function Be() {
1392
- window.removeEventListener("pointermove", De), window.removeEventListener("pointerup", ht), window.removeEventListener("pointercancel", ht);
1399
+ function De() {
1400
+ window.removeEventListener("pointermove", He), window.removeEventListener("pointerup", yt), window.removeEventListener("pointercancel", yt);
1393
1401
  }
1394
- function Fr(t) {
1395
- if (t.button !== 0 || !V())
1402
+ function Nr(t) {
1403
+ if (t.button !== 0 || !K())
1396
1404
  return;
1397
- if (!t.target.closest(".nf-sticker") && !Hr(t)) {
1398
- L = null, A();
1405
+ if (!t.target.closest(".nf-sticker") && !Ur(t)) {
1406
+ T = null, R();
1399
1407
  return;
1400
1408
  }
1401
1409
  const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
1402
1410
  if (n && n.dataset.preview !== "true") {
1403
- t.preventDefault(), t.stopPropagation(), L = n.dataset.id, Mt(t), Ur({
1411
+ t.preventDefault(), t.stopPropagation(), T = n.dataset.id, Mt(t), _r({
1404
1412
  kind: "sticker",
1405
- id: L,
1413
+ id: T,
1406
1414
  dir: (e == null ? void 0 : e.dataset.dir) || "move"
1407
- }, t), A();
1415
+ }, t), R();
1408
1416
  return;
1409
1417
  }
1410
- if (L = null, F === "crop") {
1411
- t.preventDefault(), Mt(t), v = { kind: "crop", start: ft(t), current: ft(t) }, It(), A();
1418
+ if (T = null, _ === "crop") {
1419
+ t.preventDefault(), Mt(t), b = { kind: "crop", start: pt(t), current: pt(t) }, Bt(), R();
1412
1420
  return;
1413
1421
  }
1414
- if (F === "arrow" || F === "rect" || F === "circle") {
1422
+ if (_ === "arrow" || _ === "rect" || _ === "circle") {
1415
1423
  t.preventDefault(), Mt(t);
1416
- const r = Oe(t);
1417
- v = { kind: "sticker", type: F, start: r, current: r }, It(), A();
1424
+ const r = Be(t);
1425
+ b = { kind: "sticker", type: _, start: r, current: r }, Bt(), R();
1418
1426
  return;
1419
1427
  }
1420
- A();
1428
+ R();
1421
1429
  }
1422
- function Ur(t, e) {
1430
+ function _r(t, e) {
1423
1431
  e.preventDefault(), e.stopPropagation();
1424
- const n = rt().getBoundingClientRect(), r = y.list().find((i) => i.id === t.id);
1425
- w = {
1432
+ const n = ot().getBoundingClientRect(), r = m.list().find((i) => i.id === t.id);
1433
+ v = {
1426
1434
  ...t,
1427
1435
  startX: e.clientX,
1428
1436
  startY: e.clientY,
1429
- crop: y.crop(),
1437
+ crop: m.crop(),
1430
1438
  sticker: r ? { ...r } : null,
1431
1439
  rect: n
1432
- }, _t(t.dir === "move" || t.dir === "start" || t.dir === "end"), It();
1440
+ }, Vt(t.dir === "move" || t.dir === "start" || t.dir === "end"), Bt();
1433
1441
  }
1434
- function De(t) {
1435
- if (v) {
1436
- v.current = v.kind === "crop" ? ft(t) : Oe(t), A();
1442
+ function He(t) {
1443
+ if (b) {
1444
+ b.current = b.kind === "crop" ? pt(t) : Be(t), R();
1437
1445
  return;
1438
1446
  }
1439
- if (!w)
1447
+ if (!v)
1440
1448
  return;
1441
- const e = (t.clientX - w.startX) / w.rect.width * w.crop.w, n = (t.clientY - w.startY) / w.rect.height * w.crop.h, r = w.sticker;
1449
+ const e = (t.clientX - v.startX) / v.rect.width * v.crop.w, n = (t.clientY - v.startY) / v.rect.height * v.crop.h, r = v.sticker;
1442
1450
  if (r) {
1443
- if (w.dir === "end")
1444
- y.update(r.id, {
1451
+ if (v.dir === "end")
1452
+ m.update(r.id, {
1445
1453
  x2: r.x2 + e,
1446
1454
  y2: r.y2 + n
1447
1455
  });
1448
- else if (w.dir === "start")
1449
- y.update(r.id, {
1456
+ else if (v.dir === "start")
1457
+ m.update(r.id, {
1450
1458
  x: r.x + e,
1451
1459
  y: r.y + n
1452
1460
  });
1453
- else if (w.dir === "move")
1454
- y.update(r.id, {
1461
+ else if (v.dir === "move")
1462
+ m.update(r.id, {
1455
1463
  x: r.x + e,
1456
1464
  y: r.y + n,
1457
1465
  x2: (r.x2 || r.x) + e,
@@ -1459,12 +1467,12 @@ function De(t) {
1459
1467
  });
1460
1468
  else {
1461
1469
  const i = { x: r.x, y: r.y, w: r.w, h: r.h };
1462
- Nr(i, w.dir, e, n), y.update(r.id, i);
1470
+ jr(i, v.dir, e, n), m.update(r.id, i);
1463
1471
  }
1464
- A();
1472
+ R();
1465
1473
  }
1466
1474
  }
1467
- function Nr(t, e, n, r) {
1475
+ function jr(t, e, n, r) {
1468
1476
  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")) {
1469
1477
  const i = Math.max(0.04, t.w - n);
1470
1478
  t.x += t.w - i, t.w = i;
@@ -1474,52 +1482,52 @@ function Nr(t, e, n, r) {
1474
1482
  t.y += t.h - i, t.h = i;
1475
1483
  }
1476
1484
  }
1477
- function ht(t) {
1478
- if (Be(), _t(!1), v) {
1479
- jr();
1485
+ function yt(t) {
1486
+ if (De(), Vt(!1), b) {
1487
+ Vr();
1480
1488
  return;
1481
1489
  }
1482
- if (w) {
1483
- if (w.kind === "sticker") {
1490
+ if (v) {
1491
+ if (v.kind === "sticker") {
1484
1492
  const e = s.canvas.getBoundingClientRect();
1485
- (t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (y.remove(w.id), L = null);
1493
+ (t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (m.remove(v.id), T = null);
1486
1494
  }
1487
- w = null, A();
1495
+ v = null, R();
1488
1496
  }
1489
1497
  }
1490
- function jr() {
1491
- const t = v;
1492
- if (v = null, !t)
1498
+ function Vr() {
1499
+ const t = b;
1500
+ if (b = null, !t)
1493
1501
  return;
1494
1502
  if (t.kind === "crop") {
1495
- const n = wt(t.start, t.current);
1496
- if (Math.abs(t.current.x - t.start.x) < ae || Math.abs(t.current.y - t.start.y) < ae) {
1497
- A();
1503
+ const n = xt(t.start, t.current);
1504
+ if (Math.abs(t.current.x - t.start.x) < oe || Math.abs(t.current.y - t.start.y) < oe) {
1505
+ R();
1498
1506
  return;
1499
1507
  }
1500
- const i = y.crop();
1501
- y.setCrop({
1508
+ const i = m.crop();
1509
+ m.setCrop({
1502
1510
  x: i.x + n.x * i.w,
1503
1511
  y: i.y + n.y * i.h,
1504
1512
  w: n.w * i.w,
1505
1513
  h: n.h * i.h
1506
- }), K();
1514
+ }), Y();
1507
1515
  return;
1508
1516
  }
1509
- const e = _r(t);
1510
- e && (L = e.id), A();
1517
+ const e = Wr(t);
1518
+ e && (T = e.id), R();
1511
1519
  }
1512
- function _r(t) {
1520
+ function Wr(t) {
1513
1521
  if (t.type === "arrow") {
1514
1522
  const e = t.current.x - t.start.x, n = t.current.y - t.start.y;
1515
- return Math.hypot(e, n) < Tt ? y.add("arrow", {
1523
+ return Math.hypot(e, n) < It ? m.add("arrow", {
1516
1524
  x: t.start.x,
1517
1525
  y: t.start.y,
1518
1526
  x2: t.start.x + 0.12,
1519
1527
  y2: t.start.y,
1520
1528
  w: 0.12,
1521
1529
  h: 0.02
1522
- }) : y.add("arrow", {
1530
+ }) : m.add("arrow", {
1523
1531
  x: t.start.x,
1524
1532
  y: t.start.y,
1525
1533
  x2: t.current.x,
@@ -1528,121 +1536,121 @@ function _r(t) {
1528
1536
  h: Math.abs(n)
1529
1537
  });
1530
1538
  }
1531
- return y.add(t.type, wt(t.start, t.current));
1539
+ return m.add(t.type, xt(t.start, t.current));
1532
1540
  }
1533
- function Vr() {
1534
- y.resetCrop(), L = null, K();
1541
+ function zr() {
1542
+ m.resetCrop(), T = null, Y();
1535
1543
  }
1536
- function pt() {
1537
- s.resetCrop && (s.resetCrop.hidden = !y.isCropped());
1544
+ function mt() {
1545
+ s.resetCrop && (s.resetCrop.hidden = !m.isCropped());
1538
1546
  }
1539
- function Vt(t) {
1547
+ function Wt(t) {
1540
1548
  if (!s.audio)
1541
1549
  return;
1542
1550
  const e = t ? "Stop audio" : "Record audio";
1543
1551
  s.audio.title = e, s.audio.setAttribute("aria-label", e), s.audio.dataset.active = String(!!t);
1544
1552
  }
1545
- function V() {
1546
- return N(I);
1553
+ function K() {
1554
+ return V(D);
1547
1555
  }
1548
- function it() {
1556
+ function st() {
1549
1557
  if (!s.stage || !s.palette || !s.actions || !s.recapture)
1550
1558
  return;
1551
- const t = V();
1552
- s.stage.hidden = !t && !P, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !Q), t ? (s.palette.appendChild(s.discard), s.palette.appendChild(s.recapture)) : s.audio ? s.audio.after(s.recapture) : s.actions.insertBefore(s.recapture, s.submit || null), s.recapture.hidden = !1;
1559
+ const t = K();
1560
+ s.stage.hidden = !t && !B, s.palette.hidden = !t, s.discard && (s.discard.hidden = !t), s.restore && (s.restore.hidden = t || !et), t ? (s.palette.appendChild(s.discard), s.palette.appendChild(s.recapture)) : s.audio ? s.audio.after(s.recapture) : s.actions.insertBefore(s.recapture, s.submit || null), s.recapture.hidden = !1;
1553
1561
  }
1554
- function Wr() {
1555
- V() && (Q = I), I = "", et(null), it(), K();
1562
+ function Kr() {
1563
+ K() && (et = D), D = "", it(null), st(), Y();
1556
1564
  }
1557
- function zr() {
1558
- N(Q) && (I = Q, it(), K());
1565
+ function qr() {
1566
+ V(et) && (D = et, st(), Y());
1559
1567
  }
1560
- function He() {
1568
+ function Fe() {
1561
1569
  return {
1562
1570
  capture: typeof d.capture == "function" ? d.capture : void 0,
1563
1571
  onBeforeCapture: typeof d.onBeforeCapture == "function" ? d.onBeforeCapture : void 0
1564
1572
  };
1565
1573
  }
1566
- function Fe(t) {
1567
- if (!N(t))
1574
+ function Ue(t) {
1575
+ if (!V(t))
1568
1576
  throw new Error("Screenshot failed; you can still send text.");
1569
- I = t, Q = t, y = Ht(), O = { w: 0, h: 0 }, L = null, v = null, w = null, et(null);
1577
+ D = t, et = t, m = Ut(), F = { w: 0, h: 0 }, T = null, b = null, v = null, it(null);
1570
1578
  }
1571
- async function Kr() {
1572
- if (!(Ct || !s.dialog || s.dialog.hidden)) {
1573
- Ct = !0, s.recapture.disabled = !0, b("Capturing…", !0), s.dialog.hidden = !0;
1579
+ async function Xr() {
1580
+ if (!(Lt || !s.dialog || s.dialog.hidden)) {
1581
+ Lt = !0, s.recapture.disabled = !0, S("Capturing…", !0), s.dialog.hidden = !0;
1574
1582
  try {
1575
1583
  let t = "";
1576
1584
  try {
1577
- t = await er();
1585
+ t = await rr();
1578
1586
  } catch {
1579
- t = await Ee(He());
1587
+ t = await Ce(Fe());
1580
1588
  }
1581
- Fe(t), b("");
1589
+ Ue(t), S("");
1582
1590
  } catch (t) {
1583
- b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1591
+ S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1584
1592
  } finally {
1585
- s.dialog.hidden = !1, s.recapture.disabled = !1, Ct = !1, it(), K();
1593
+ s.dialog.hidden = !1, s.recapture.disabled = !1, Lt = !1, st(), Y();
1586
1594
  }
1587
1595
  }
1588
1596
  }
1589
- function qr() {
1597
+ function Yr() {
1590
1598
  try {
1591
- if (z || (z = lr((e) => {
1599
+ if (X || (X = dr((e) => {
1592
1600
  const n = s.text.value.trim();
1593
1601
  s.text.value = n ? `${n} ${e}` : e;
1594
- })), !z.isSupported()) {
1595
- b("Audio-to-text is not supported in this browser.");
1602
+ })), !X.isSupported()) {
1603
+ S("Audio-to-text is not supported in this browser.");
1596
1604
  return;
1597
1605
  }
1598
- const t = z.start();
1599
- Vt(t), b(t ? "Listening…" : "");
1606
+ const t = X.start();
1607
+ Wt(t), S(t ? "Listening…" : "");
1600
1608
  } catch (t) {
1601
- b(t.message);
1609
+ S(t.message);
1602
1610
  }
1603
1611
  }
1604
- async function Xr() {
1612
+ async function Gr() {
1605
1613
  if (!d.video) {
1606
- b("Video is disabled on this host.");
1614
+ S("Video is disabled on this host.");
1607
1615
  return;
1608
1616
  }
1609
- s.dialog.hidden = !0, s.stop.hidden = !1, nt(), s.launcher.hidden = !0, tt = dr({
1617
+ s.dialog.hidden = !0, s.stop.hidden = !1, at(), s.launcher.hidden = !0, rt = hr({
1610
1618
  onStart() {
1611
1619
  },
1612
1620
  onStop(t) {
1613
- P = t, s.stop.hidden = !0, dt(), s.dialog.hidden = !1, it(), K(), b(t ? "Video attached." : "Recording cancelled.");
1621
+ B = t, s.stop.hidden = !0, ht(), s.dialog.hidden = !1, st(), Y(), S(t ? "Video attached." : "Recording cancelled.");
1614
1622
  },
1615
1623
  onError(t) {
1616
- b(t.message);
1624
+ S(t.message);
1617
1625
  }
1618
1626
  });
1619
1627
  try {
1620
- await tt.start();
1628
+ await rt.start();
1621
1629
  } catch (t) {
1622
- s.stop.hidden = !0, dt(), s.dialog.hidden = !1, b(t.message);
1630
+ s.stop.hidden = !0, ht(), s.dialog.hidden = !1, S(t.message);
1623
1631
  }
1624
1632
  }
1625
- function K() {
1626
- if (s.shot = null, !V()) {
1627
- s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = P ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(P)}"></video>` : "", pt();
1633
+ function Y() {
1634
+ if (s.shot = null, !K()) {
1635
+ s.canvas.style.removeProperty("--nf-shot-aspect"), s.canvas.style.removeProperty("aspect-ratio"), s.canvas.innerHTML = B ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(B)}"></video>` : "", mt();
1628
1636
  return;
1629
1637
  }
1630
- s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${I}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
1638
+ s.canvas.innerHTML = `<div class="nf-shot"><img alt="Screenshot" src="${D}" draggable="false"></div>`, s.shot = s.canvas.querySelector(".nf-shot");
1631
1639
  const t = s.shot.querySelector("img");
1632
1640
  t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
1633
1641
  const e = () => {
1634
- Yr(t), A();
1642
+ Jr(t), R();
1635
1643
  };
1636
- t.addEventListener("load", e), t.complete && t.naturalWidth && e(), pt();
1644
+ t.addEventListener("load", e), t.complete && t.naturalWidth && e(), mt();
1637
1645
  }
1638
- function Yr(t) {
1639
- const e = t.naturalWidth || O.w, n = t.naturalHeight || O.h;
1640
- 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)
1646
+ function Jr(t) {
1647
+ const e = t.naturalWidth || F.w, n = t.naturalHeight || F.h;
1648
+ if (e && n && (F = { w: e, h: n }, s.canvas.style.setProperty("--nf-shot-aspect", String(e / n)), s.canvas.style.aspectRatio = `${e} / ${n}`), !s.shot || !F.w || !F.h)
1641
1649
  return;
1642
- const r = y.crop(), i = O.w / O.h, a = r.w / r.h * i, o = Math.min(1, a / i), c = Math.min(1, i / a);
1650
+ const r = m.crop(), i = F.w / F.h, a = r.w / r.h * i, o = Math.min(1, a / i), c = Math.min(1, i / a);
1643
1651
  s.shot.style.left = `${(1 - o) / 2 * 100}%`, s.shot.style.top = `${(1 - c) / 2 * 100}%`, s.shot.style.width = `${o * 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}%`;
1644
1652
  }
1645
- function Gr(t) {
1653
+ function Qr(t) {
1646
1654
  return t.type === "arrow" ? {
1647
1655
  id: "preview",
1648
1656
  type: "arrow",
@@ -1657,66 +1665,66 @@ function Gr(t) {
1657
1665
  id: "preview",
1658
1666
  type: t.type,
1659
1667
  number: "",
1660
- ...wt(t.start, t.current)
1668
+ ...xt(t.start, t.current)
1661
1669
  };
1662
1670
  }
1663
- function A() {
1664
- if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((a) => a.remove()), !V() || !s.shot) {
1665
- pt();
1671
+ function R() {
1672
+ if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((a) => a.remove()), !K() || !s.shot) {
1673
+ mt();
1666
1674
  return;
1667
1675
  }
1668
- const e = y.crop(), n = rt(), r = Ft(n.clientWidth || 400);
1669
- 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`), (v == null ? void 0 : v.kind) === "crop") {
1676
+ const e = m.crop(), n = ot(), r = Nt(n.clientWidth || 400);
1677
+ 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") {
1670
1678
  const a = document.createElement("div");
1671
- a.className = "nf-crop", ce(a, wt(v.start, v.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(a);
1679
+ a.className = "nf-crop", le(a, xt(b.start, b.current), { x: 0, y: 0, w: 1, h: 1 }), s.shot.appendChild(a);
1672
1680
  }
1673
- const i = y.list().slice();
1674
- if ((v == null ? void 0 : v.kind) === "sticker" && i.push(Gr(v)), i.forEach((a) => {
1675
- const o = a.id === "preview", c = !o && a.id === L, l = document.createElement("div");
1676
- if (l.className = `nf-sticker nf-${a.type}`, l.dataset.id = a.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), a.type === "arrow" ? Jr(l, a, e, c, r) : (ce(l, a, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Ot(l, u))), !o && a.number) {
1681
+ const i = m.list().slice();
1682
+ if ((b == null ? void 0 : b.kind) === "sticker" && i.push(Qr(b)), i.forEach((a) => {
1683
+ const o = a.id === "preview", c = !o && a.id === T, l = document.createElement("div");
1684
+ if (l.className = `nf-sticker nf-${a.type}`, l.dataset.id = a.id, c && (l.dataset.selected = "true"), o && (l.dataset.preview = "true"), a.type === "arrow" ? Zr(l, a, e, c, r) : (le(l, a, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Dt(l, u))), !o && a.number) {
1677
1685
  const u = document.createElement("span");
1678
1686
  u.className = "nf-badge", u.textContent = String(a.number), l.appendChild(u);
1679
1687
  }
1680
1688
  s.shot.appendChild(l);
1681
- }), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((a) => a.remove()), P) {
1689
+ }), s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach((a) => a.remove()), B) {
1682
1690
  const a = document.createElement("video");
1683
- a.className = "nf-recording-preview", a.controls = !0, a.src = URL.createObjectURL(P), a.style.position = "absolute", a.style.right = "8px", a.style.bottom = "8px", a.style.width = "160px", s.canvas.appendChild(a);
1691
+ a.className = "nf-recording-preview", a.controls = !0, a.src = URL.createObjectURL(B), a.style.position = "absolute", a.style.right = "8px", a.style.bottom = "8px", a.style.width = "160px", s.canvas.appendChild(a);
1684
1692
  }
1685
- pt();
1693
+ mt();
1686
1694
  }
1687
- function Jr(t, e, n, r, i = Ft(400)) {
1688
- const a = rt(), o = a.clientWidth, c = a.clientHeight, l = (e.x - n.x) / n.w * o, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * o, m = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, i.arrowHead + i.stroke * 2), S = Math.min(l, f) - g, R = Math.min(u, m) - g, D = Math.max(2, Math.abs(f - l)) + g * 2, Z = Math.max(2, Math.abs(m - u)) + g * 2, q = l - S, X = u - R, vt = f - S, bt = m - R, H = Ae(q, X, vt, bt, i), Y = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1689
- t.style.left = `${S}px`, t.style.top = `${R}px`, t.style.width = `${D}px`, t.style.height = `${Z}px`, Y.setAttribute("class", "nf-arrow-svg"), Y.setAttribute("viewBox", `0 0 ${D} ${Z}`), Y.setAttribute("width", String(D)), Y.setAttribute("height", String(Z)), Y.innerHTML = `
1690
- <line class="nf-arrow-hit" x1="${q}" y1="${X}" x2="${vt}" y2="${bt}" />
1691
- <line class="nf-arrow-shaft" x1="${q}" y1="${X}" x2="${H.shaftEnd.x}" y2="${H.shaftEnd.y}" />
1692
- <polygon class="nf-arrow-head" points="${H.tipX},${H.tipY} ${H.left.x},${H.left.y} ${H.right.x},${H.right.y}" />
1693
- `, t.appendChild(Y), r && (Ot(t, "start", { left: q - 5, top: X - 5 }), Ot(t, "end", { left: vt - 5, top: bt - 5 }));
1695
+ function Zr(t, e, n, r, i = Nt(400)) {
1696
+ const a = ot(), o = a.clientWidth, c = a.clientHeight, l = (e.x - n.x) / n.w * o, u = (e.y - n.y) / n.h * c, f = ((e.x2 ?? e.x + e.w) - n.x) / n.w * o, y = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, i.arrowHead + i.stroke * 2), w = Math.min(l, f) - g, x = Math.min(u, y) - g, C = Math.max(2, Math.abs(f - l)) + g * 2, I = Math.max(2, Math.abs(y - u)) + g * 2, A = l - w, H = u - x, G = f - w, J = y - x, N = Le(A, H, G, J, i), Q = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1697
+ t.style.left = `${w}px`, t.style.top = `${x}px`, t.style.width = `${C}px`, t.style.height = `${I}px`, Q.setAttribute("class", "nf-arrow-svg"), Q.setAttribute("viewBox", `0 0 ${C} ${I}`), Q.setAttribute("width", String(C)), Q.setAttribute("height", String(I)), Q.innerHTML = `
1698
+ <line class="nf-arrow-hit" x1="${A}" y1="${H}" x2="${G}" y2="${J}" />
1699
+ <line class="nf-arrow-shaft" x1="${A}" y1="${H}" x2="${N.shaftEnd.x}" y2="${N.shaftEnd.y}" />
1700
+ <polygon class="nf-arrow-head" points="${N.tipX},${N.tipY} ${N.left.x},${N.left.y} ${N.right.x},${N.right.y}" />
1701
+ `, t.appendChild(Q), r && (Dt(t, "start", { left: A - 5, top: H - 5 }), Dt(t, "end", { left: G - 5, top: J - 5 }));
1694
1702
  }
1695
- function Ot(t, e, n) {
1703
+ function Dt(t, e, n) {
1696
1704
  const r = document.createElement("span");
1697
1705
  r.className = "nf-handle", r.dataset.dir = e, n && (r.style.left = `${n.left}px`, r.style.top = `${n.top}px`), t.appendChild(r);
1698
1706
  }
1699
- function ce(t, e, n) {
1707
+ function le(t, e, n) {
1700
1708
  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}%`;
1701
1709
  }
1702
- function Ue() {
1710
+ function Ne() {
1703
1711
  try {
1704
- return String(localStorage.getItem(Re) || "").trim();
1712
+ return String(localStorage.getItem($e) || "").trim();
1705
1713
  } catch {
1706
1714
  return "";
1707
1715
  }
1708
1716
  }
1709
- function Qr(t) {
1717
+ function ti(t) {
1710
1718
  const e = String(t || "").trim();
1711
- if (!(!e || e === Pt))
1719
+ if (!(!e || e === Ot))
1712
1720
  try {
1713
- localStorage.setItem(Re, e);
1721
+ localStorage.setItem($e, e);
1714
1722
  } catch {
1715
1723
  }
1716
1724
  }
1717
- function Ne() {
1725
+ function _e() {
1718
1726
  try {
1719
- const t = localStorage.getItem(Te);
1727
+ const t = localStorage.getItem(Pe);
1720
1728
  if (!t)
1721
1729
  return { diagnostics: !1, logs: !1 };
1722
1730
  const e = JSON.parse(t);
@@ -1728,13 +1736,13 @@ function Ne() {
1728
1736
  return { diagnostics: !1, logs: !1 };
1729
1737
  }
1730
1738
  }
1731
- function le(t = {}) {
1739
+ function ue(t = {}) {
1732
1740
  const e = {
1733
- ...Ne(),
1741
+ ..._e(),
1734
1742
  ...t
1735
1743
  };
1736
1744
  try {
1737
- localStorage.setItem(Te, JSON.stringify({
1745
+ localStorage.setItem(Pe, JSON.stringify({
1738
1746
  diagnostics: !!e.diagnostics,
1739
1747
  logs: !!e.logs
1740
1748
  }));
@@ -1742,21 +1750,21 @@ function le(t = {}) {
1742
1750
  }
1743
1751
  }
1744
1752
  function je() {
1745
- return !!(String(T.userId || "").trim() || String(T.email || "").trim() || String(T.displayName || "").trim());
1753
+ return !!(String(O.userId || "").trim() || String(O.email || "").trim() || String(O.displayName || "").trim());
1746
1754
  }
1747
- function _e() {
1755
+ function Ve() {
1748
1756
  return String(
1749
- T.displayName || T.email || T.userId || ""
1757
+ O.displayName || O.email || O.userId || ""
1750
1758
  ).trim();
1751
1759
  }
1752
- function Zr() {
1760
+ function ei() {
1753
1761
  var e;
1754
1762
  if (je())
1755
- return _e() || Pt;
1763
+ return Ve() || Ot;
1756
1764
  const t = String(((e = s.author) == null ? void 0 : e.value) || "").trim();
1757
- return t ? (Qr(t), t) : Pt;
1765
+ return t ? (ti(t), t) : Ot;
1758
1766
  }
1759
- function Ve() {
1767
+ function We() {
1760
1768
  if (!s.author)
1761
1769
  return;
1762
1770
  const t = je();
@@ -1764,14 +1772,17 @@ function Ve() {
1764
1772
  s.author.value = "";
1765
1773
  return;
1766
1774
  }
1767
- s.author.value = Ue();
1775
+ s.author.value = Ne();
1768
1776
  }
1769
- function We(t, e = $e) {
1777
+ function ze(t, e = Re) {
1770
1778
  const n = Number(t);
1771
- return Number.isFinite(n) ? Math.min(Tr, Math.max(0, Math.floor(n))) : e;
1779
+ return Number.isFinite(n) ? Math.min(Ir, Math.max(0, Math.floor(n))) : e;
1780
+ }
1781
+ function Ke(t) {
1782
+ t.key !== "Escape" || !s.dialog || s.dialog.hidden || bt && !St || nt();
1772
1783
  }
1773
- function ze(t = {}) {
1774
- or(t);
1784
+ function qe(t = {}) {
1785
+ cr(t);
1775
1786
  const e = Object.prototype.hasOwnProperty.call(t, "kinds");
1776
1787
  d = {
1777
1788
  ...d,
@@ -1781,99 +1792,100 @@ function ze(t = {}) {
1781
1792
  name: t.name == null ? d.name : String(t.name || ""),
1782
1793
  targets: t.targets === void 0 ? d.targets : t.targets,
1783
1794
  hideLauncher: t.hideLauncher == null ? d.hideLauncher : !!t.hideLauncher,
1784
- theme: Pe(t.theme ?? d.theme),
1795
+ theme: Ie(t.theme ?? d.theme),
1785
1796
  video: t.video == null ? d.video : !!t.video,
1786
- consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : We(t.consoleLogLimit, d.consoleLogLimit),
1787
- kinds: e ? Lr(t.kinds) : d.kinds,
1797
+ consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : ze(t.consoleLogLimit, d.consoleLogLimit),
1798
+ kinds: e ? Rr(t.kinds) : d.kinds,
1788
1799
  capture: t.capture === void 0 ? d.capture : t.capture,
1789
- onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture
1800
+ onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture,
1801
+ displayLink: t.displayLink == null ? d.displayLink : !!t.displayLink
1790
1802
  };
1791
1803
  }
1792
- function Wt(t = {}) {
1793
- return ze(t), h && nt(), zt;
1804
+ function zt(t = {}) {
1805
+ return qe(t), p && at(), Kt;
1794
1806
  }
1795
- function ti(t = {}) {
1796
- return ze(t), Nt(), nt(), zt;
1807
+ function ni(t = {}) {
1808
+ return qe(t), _t(), at(), Kt;
1797
1809
  }
1798
- function ei(t) {
1799
- return Wt({ theme: t });
1810
+ function ri(t) {
1811
+ return zt({ theme: t });
1800
1812
  }
1801
- function ni(t) {
1813
+ function ii(t) {
1802
1814
  const e = !!t;
1803
- return !e && h && s.dialog && !s.dialog.hidden && at(), Wt({ hideLauncher: !e });
1815
+ return !e && p && s.dialog && !s.dialog.hidden && nt(), zt({ hideLauncher: !e });
1804
1816
  }
1805
- function ri() {
1806
- const t = _e() || Ue() || void 0, e = ir({
1807
- ...T,
1808
- displayName: T.displayName || t
1817
+ function ai() {
1818
+ const t = Ve() || Ne() || void 0, e = or({
1819
+ ...O,
1820
+ displayName: O.displayName || t
1809
1821
  });
1810
- B = Sr(e), $ = xr(
1811
- Le.snapshot().slice(-We(d.consoleLogLimit))
1822
+ U = Er(e), P = Cr(
1823
+ Me.snapshot().slice(-ze(d.consoleLogLimit))
1812
1824
  );
1813
- const n = Ne();
1814
- n.diagnostics && ut(B, !0), n.logs && $.length && ut($, !0), W = !1;
1825
+ const n = _e();
1826
+ n.diagnostics && ft(U, !0), n.logs && P.length && ft(P, !0), q = !1;
1815
1827
  }
1816
- function mt(t) {
1817
- W = !!t, s.privacyPanel && (s.privacyPanel.hidden = !W), s.privacyChange && (s.privacyChange.setAttribute("aria-expanded", W ? "true" : "false"), s.privacyChange.dataset.active = String(W)), W && Xe();
1828
+ function gt(t) {
1829
+ q = !!t, s.privacyPanel && (s.privacyPanel.hidden = !q), s.privacyChange && (s.privacyChange.setAttribute("aria-expanded", q ? "true" : "false"), s.privacyChange.dataset.active = String(q)), q && Ge();
1818
1830
  }
1819
- function Ke() {
1831
+ function Xe() {
1820
1832
  if (!s.privacy || !s.privacyText || !s.privacyChange)
1821
1833
  return;
1822
- const t = Cr({
1823
- diagnostics: B,
1824
- logs: $
1834
+ const t = Lr({
1835
+ diagnostics: U,
1836
+ logs: P
1825
1837
  });
1826
1838
  s.privacyText.textContent = t, s.privacyText.hidden = !t;
1827
- const e = B.length === 0 && $.length === 0;
1839
+ const e = U.length === 0 && P.length === 0;
1828
1840
  s.privacySummary && (s.privacySummary.hidden = e), s.privacy.hidden = e, s.privacyChange.hidden = !1;
1829
1841
  }
1830
- function qe(t, e, n) {
1842
+ function Ye(t, e, n) {
1831
1843
  return `<label class="nf-privacy-toggle">
1832
1844
  <span class="nf-privacy-toggle-label">Redact</span>
1833
- <input type="checkbox" ${t ? "checked" : ""} ${e ? 'data-indeterminate="true"' : ""} aria-label="${C(n)}">
1845
+ <input type="checkbox" ${t ? "checked" : ""} ${e ? 'data-indeterminate="true"' : ""} aria-label="${L(n)}">
1834
1846
  </label>`;
1835
1847
  }
1836
- function ue(t, e, n, r, i) {
1837
- const a = qe(i, !1, `Redact ${n}`);
1848
+ function de(t, e, n, r, i) {
1849
+ const a = Ye(i, !1, `Redact ${n}`);
1838
1850
  if (i) {
1839
1851
  const o = r ? `${n}: ${r}` : n;
1840
- return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}" data-redacted="true">
1852
+ return `<div class="nf-privacy-row" data-kind="${L(t)}" data-id="${L(e)}" data-redacted="true">
1841
1853
  <div class="nf-privacy-row-text">
1842
- <div class="nf-privacy-row-summary" title="${C(o)}">${C(o)}</div>
1854
+ <div class="nf-privacy-row-summary" title="${L(o)}">${L(o)}</div>
1843
1855
  </div>
1844
1856
  ${a}
1845
1857
  </div>`;
1846
1858
  }
1847
- return `<div class="nf-privacy-row" data-kind="${C(t)}" data-id="${C(e)}">
1859
+ return `<div class="nf-privacy-row" data-kind="${L(t)}" data-id="${L(e)}">
1848
1860
  <div class="nf-privacy-row-text">
1849
- <div class="nf-privacy-row-title">${C(n)}</div>
1850
- <div class="nf-privacy-row-detail">${C(r)}</div>
1861
+ <div class="nf-privacy-row-title">${L(n)}</div>
1862
+ <div class="nf-privacy-row-detail">${L(r)}</div>
1851
1863
  </div>
1852
1864
  ${a}
1853
1865
  </div>`;
1854
1866
  }
1855
- function de(t, e, n, r) {
1867
+ function fe(t, e, n, r) {
1856
1868
  if (!n.length)
1857
1869
  return "";
1858
- const i = Er(n), a = i.checked && !i.indeterminate;
1859
- return `<section class="nf-privacy-section" data-section="${C(t)}"${a ? ' data-redacted="true"' : ""}>
1870
+ const i = kr(n), a = i.checked && !i.indeterminate;
1871
+ return `<section class="nf-privacy-section" data-section="${L(t)}"${a ? ' data-redacted="true"' : ""}>
1860
1872
  <div class="nf-privacy-section-head">
1861
- <h3 class="nf-privacy-section-title">${C(e)}</h3>
1862
- ${qe(i.checked, i.indeterminate, `Redact all ${e.toLowerCase()}`)}
1873
+ <h3 class="nf-privacy-section-title">${L(e)}</h3>
1874
+ ${Ye(i.checked, i.indeterminate, `Redact all ${e.toLowerCase()}`)}
1863
1875
  </div>
1864
1876
  <div class="nf-privacy-rows"${a ? " hidden" : ""}>${r}</div>
1865
1877
  </section>`;
1866
1878
  }
1867
- function Xe() {
1879
+ function Ge() {
1868
1880
  if (!s.privacyScroll)
1869
1881
  return;
1870
- const t = B.map((n) => ue(
1882
+ const t = U.map((n) => de(
1871
1883
  "diagnostic",
1872
1884
  n.key,
1873
1885
  n.label,
1874
1886
  Ar(n.value),
1875
1887
  n.redacted
1876
- )).join(""), e = $.map((n) => ue(
1888
+ )).join(""), e = P.map((n) => de(
1877
1889
  "log",
1878
1890
  n.id,
1879
1891
  n.level,
@@ -1881,13 +1893,13 @@ function Xe() {
1881
1893
  n.redacted
1882
1894
  )).join("");
1883
1895
  s.privacyScroll.innerHTML = [
1884
- de("diagnostics", "Diagnostics", B, t),
1885
- $.length ? de("logs", "Logs", $, e) : ""
1896
+ fe("diagnostics", "Diagnostics", U, t),
1897
+ P.length ? fe("logs", "Logs", P, e) : ""
1886
1898
  ].join(""), s.privacyScroll.querySelectorAll('input[data-indeterminate="true"]').forEach((n) => {
1887
1899
  n.indeterminate = !0, n.removeAttribute("data-indeterminate");
1888
- }), Ke();
1900
+ }), Xe();
1889
1901
  }
1890
- function ii(t) {
1902
+ function oi(t) {
1891
1903
  const e = t.target;
1892
1904
  if (!(e instanceof HTMLInputElement) || e.type !== "checkbox")
1893
1905
  return;
@@ -1895,93 +1907,109 @@ function ii(t) {
1895
1907
  if (r) {
1896
1908
  const a = r.dataset.kind, o = r.dataset.id;
1897
1909
  if (a === "diagnostic") {
1898
- const c = B.find((l) => l.key === o);
1910
+ const c = U.find((l) => l.key === o);
1899
1911
  c && (c.redacted = i);
1900
1912
  } else if (a === "log") {
1901
- const c = $.find((l) => l.id === o);
1913
+ const c = P.find((l) => l.id === o);
1902
1914
  c && (c.redacted = i);
1903
1915
  }
1904
1916
  } else if (n) {
1905
1917
  const a = n.dataset.section;
1906
- a === "diagnostics" ? (ut(B, i), le({ diagnostics: i })) : a === "logs" && (ut($, i), le({ logs: i }));
1918
+ a === "diagnostics" ? (ft(U, i), ue({ diagnostics: i })) : a === "logs" && (ft(P, i), ue({ logs: i }));
1907
1919
  } else
1908
1920
  return;
1909
- Xe();
1921
+ Ge();
1910
1922
  }
1911
- async function Ye() {
1912
- Nt(), Ge(), nt(), s.launcher.hidden = !0, y = Ht(), O = { w: 0, h: 0 }, P = null, I = "", Q = "", L = null, v = null, w = null, j = Dr(), jt(j), et(null), Vt(!1), s.text.value = "", Ve(), b(""), ri();
1923
+ async function Je() {
1924
+ _t(), Qe(), at(), s.launcher.hidden = !0, m = Ut(), F = { w: 0, h: 0 }, B = null, D = "", et = "", T = null, b = null, v = null, W = Fr(), jt(W), it(null), Wt(!1), s.text.value = "", We(), S(""), ai();
1913
1925
  try {
1914
- Fe(await Ee(He())), b("");
1926
+ Ue(await Ce(Fe())), S("");
1915
1927
  } catch (t) {
1916
- I = "", b((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1928
+ D = "", S((t == null ? void 0 : t.message) || "Screenshot failed; you can still send text.");
1917
1929
  }
1918
- it(), mt(!1), Ke(), s.dialog.hidden = !1, K(), s.text.focus();
1930
+ st(), gt(!1), Xe(), s.dialog.hidden = !1, Y(), s.text.focus();
1919
1931
  }
1920
- function at() {
1921
- h && (z == null || z.stop(), Vt(!1), Be(), v = null, w = null, _t(!1), Ge(), mt(!1), s.dialog.hidden = !0, s.stop.hidden = !0, dt());
1922
- }
1923
- function ai() {
1924
- const t = s.dialog, e = s.panel, n = s.panelBody, r = s.successMsg;
1925
- if (!t || !e || !n || !r)
1926
- return Promise.resolve();
1927
- Ut = !0, b("");
1928
- const i = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, a = e.getBoundingClientRect();
1929
- if (n.hidden = !0, r.hidden = !1, t.classList.add("nf-success"), t.style.opacity = "1", i)
1930
- return new Promise((u) => {
1931
- window.setTimeout(() => u(), 1e3);
1932
+ function nt() {
1933
+ p && (X == null || X.stop(), Wt(!1), De(), b = null, v = null, Vt(!1), Qe(), gt(!1), s.dialog.hidden = !0, s.stop.hidden = !0, ht());
1934
+ }
1935
+ function si(t = "") {
1936
+ const e = s.dialog, n = s.panel, r = s.panelBody, i = s.successMsg, a = s.successLink, o = String(t || "").trim(), c = !!(d.displayLink && o);
1937
+ if (!e || !n || !r || !i)
1938
+ return Promise.resolve(!1);
1939
+ bt = !0, St = c, S("");
1940
+ const l = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, u = n.getBoundingClientRect();
1941
+ if (r.hidden = !0, i.hidden = !1, e.classList.add("nf-success"), e.classList.toggle("nf-success-sticky", c), e.style.opacity = "1", a && (c ? (a.hidden = !1, a.href = o) : (a.hidden = !0, a.removeAttribute("href"))), c) {
1942
+ if (l)
1943
+ return Promise.resolve(!0);
1944
+ const w = n.getBoundingClientRect(), x = w.width > 0 ? u.width / w.width : 1, C = w.height > 0 ? u.height / w.height : 1;
1945
+ return n.style.transformOrigin = "center center", n.style.transition = "none", n.style.transform = `scale(${x}, ${C})`, n.getBoundingClientRect(), new Promise((I) => {
1946
+ let A = !1;
1947
+ const H = () => {
1948
+ A || (A = !0, n.removeEventListener("transitionend", G), I(!0));
1949
+ }, G = (J) => {
1950
+ J.target !== n || J.propertyName !== "transform" || H();
1951
+ };
1952
+ n.addEventListener("transitionend", G), requestAnimationFrame(() => {
1953
+ n.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", n.style.transform = "scale(1)";
1954
+ }), window.setTimeout(H, 700);
1932
1955
  });
1933
- const o = e.getBoundingClientRect(), c = o.width > 0 ? a.width / o.width : 1, l = o.height > 0 ? a.height / o.height : 1;
1934
- return e.style.transformOrigin = "center center", e.style.transition = "none", e.style.transform = `scale(${c}, ${l})`, e.getBoundingClientRect(), new Promise((u) => {
1935
- let f = !1;
1936
- const m = () => {
1937
- f || (f = !0, e.removeEventListener("transitionend", g), window.setTimeout(() => {
1938
- t.style.transition = "opacity 0.28s ease", t.style.opacity = "0", window.setTimeout(() => u(), 280);
1956
+ }
1957
+ if (l)
1958
+ return new Promise((w) => {
1959
+ window.setTimeout(() => w(!1), 1e3);
1960
+ });
1961
+ const f = n.getBoundingClientRect(), y = f.width > 0 ? u.width / f.width : 1, g = f.height > 0 ? u.height / f.height : 1;
1962
+ return n.style.transformOrigin = "center center", n.style.transition = "none", n.style.transform = `scale(${y}, ${g})`, n.getBoundingClientRect(), new Promise((w) => {
1963
+ let x = !1;
1964
+ const C = () => {
1965
+ x || (x = !0, n.removeEventListener("transitionend", I), window.setTimeout(() => {
1966
+ e.style.transition = "opacity 0.28s ease", e.style.opacity = "0", window.setTimeout(() => w(!1), 280);
1939
1967
  }, 1e3));
1940
- }, g = (S) => {
1941
- S.target !== e || S.propertyName !== "transform" || m();
1968
+ }, I = (A) => {
1969
+ A.target !== n || A.propertyName !== "transform" || C();
1942
1970
  };
1943
- e.addEventListener("transitionend", g), requestAnimationFrame(() => {
1944
- e.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", e.style.transform = "scale(1)";
1945
- }), window.setTimeout(m, 700);
1971
+ n.addEventListener("transitionend", I), requestAnimationFrame(() => {
1972
+ n.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", n.style.transform = "scale(1)";
1973
+ }), window.setTimeout(C, 700);
1946
1974
  });
1947
1975
  }
1948
- function Ge() {
1949
- Ut = !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));
1976
+ function Qe() {
1977
+ bt = !1, St = !1, s.dialog && (s.dialog.classList.remove("nf-success", "nf-success-sticky"), 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), s.successLink && (s.successLink.hidden = !0, s.successLink.removeAttribute("href")));
1950
1978
  }
1951
- function oi(t = {}) {
1952
- T = { ...T, ...ar(t) }, Ve();
1979
+ function ci(t = {}) {
1980
+ O = { ...O, ...sr(t) }, We();
1953
1981
  }
1954
- async function Je() {
1955
- if (Nt(), At)
1982
+ async function Ze() {
1983
+ if (_t(), At)
1956
1984
  return null;
1957
1985
  const t = s.text.value.trim();
1958
- if (!t && !V() && !P)
1959
- return b("Add a note, screenshot, or video first."), null;
1986
+ if (!t && !K() && !B)
1987
+ return S("Add a note, screenshot, or video first."), null;
1960
1988
  if (!d.endpoint || !d.projectKey)
1961
- return b("Notefully is missing endpoint or projectKey."), null;
1962
- At = !0, fe(!0), b("Submitting…", !0);
1989
+ return S("Notefully is missing endpoint or projectKey."), null;
1990
+ At = !0, he(!0), S("Submitting…", !0);
1963
1991
  try {
1964
- const e = Zr(), n = new FormData();
1965
- if (n.append("message", t), n.append("kind", j), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify(Mr({
1992
+ const e = ei(), n = new FormData();
1993
+ if (n.append("message", t), n.append("kind", W), n.append("version", d.version || "0.0.0"), n.append("author", e), d.name && n.append("name", d.name), n.append("context", JSON.stringify(Mr({
1966
1994
  author: e,
1967
- diagnostics: B,
1968
- logs: $
1969
- }))), 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)), V()) {
1970
- const a = await Pr(I);
1971
- if (n.append("screenshot", a, "screenshot.png"), y.list().length || y.isCropped()) {
1972
- const o = await wr(
1973
- I,
1974
- y.crop(),
1975
- y.list(),
1995
+ diagnostics: U,
1996
+ logs: P
1997
+ }))), n.append("annotations", JSON.stringify(m.list())), n.append("crop", JSON.stringify(m.crop())), Array.isArray(d.targets) && n.append("targets", JSON.stringify(d.targets)), K()) {
1998
+ const o = await Or(D);
1999
+ if (n.append("screenshot", o, "screenshot.png"), m.list().length || m.isCropped()) {
2000
+ const c = await br(
2001
+ D,
2002
+ m.crop(),
2003
+ m.list(),
1976
2004
  {
1977
- mark: oe("--nf-mark", "#fdd341"),
1978
- markText: oe("--nf-mark-text", "#2a2140")
2005
+ mark: se("--nf-mark", "#fdd341"),
2006
+ markText: se("--nf-mark-text", "#2a2140")
1979
2007
  }
1980
2008
  );
1981
- n.append("screenshotBaked", o, "screenshot.baked.png");
2009
+ n.append("screenshotBaked", c, "screenshot.baked.png");
1982
2010
  }
1983
2011
  }
1984
- P && n.append("recording", P, "recording.webm");
2012
+ B && n.append("recording", B, "recording.webm");
1985
2013
  const r = await fetch(`${d.endpoint}/v1/reports`, {
1986
2014
  method: "POST",
1987
2015
  headers: {
@@ -1996,29 +2024,29 @@ async function Je() {
1996
2024
  i = null;
1997
2025
  }
1998
2026
  if (!r.ok)
1999
- throw b((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
2000
- return await ai(), at(), i;
2027
+ throw S((i == null ? void 0 : i.error) || "Submit failed."), new Error((i == null ? void 0 : i.error) || `Submit failed (${r.status})`);
2028
+ return await si((i == null ? void 0 : i.trackerUrl) || "") || nt(), i;
2001
2029
  } finally {
2002
- At = !1, fe(!1);
2030
+ At = !1, he(!1);
2003
2031
  }
2004
2032
  }
2005
- function fe(t) {
2033
+ function he(t) {
2006
2034
  s.submit && (s.submit.disabled = !!t, s.submit.setAttribute("aria-busy", t ? "true" : "false"));
2007
2035
  }
2008
- function si() {
2009
- at(), h == null || h.remove(), h = null, s = {};
2036
+ function li() {
2037
+ nt(), document.removeEventListener("keydown", Ke), p == null || p.remove(), p = null, s = {};
2010
2038
  }
2011
- const zt = { init: ti, configure: Wt, setTheme: ei, setVisible: ni, open: Ye, close: at, identify: oi, submit: Je, destroy: si };
2012
- typeof window < "u" && (window.Notefully = zt);
2039
+ const Kt = { init: ni, configure: zt, setTheme: ri, setVisible: ii, open: Je, close: nt, identify: ci, submit: Ze, destroy: li };
2040
+ typeof window < "u" && (window.Notefully = Kt);
2013
2041
  export {
2014
- at as close,
2015
- Wt as configure,
2016
- zt as default,
2017
- si as destroy,
2018
- oi as identify,
2019
- ti as init,
2020
- Ye as open,
2021
- ei as setTheme,
2022
- ni as setVisible,
2023
- Je as submit
2042
+ nt as close,
2043
+ zt as configure,
2044
+ Kt as default,
2045
+ li as destroy,
2046
+ ci as identify,
2047
+ ni as init,
2048
+ Je as open,
2049
+ ri as setTheme,
2050
+ ii as setVisible,
2051
+ Ze as submit
2024
2052
  };