@makefully/notefully 0.1.8 → 0.1.9

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