@makefully/notefully 0.1.58 → 0.1.60

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