@makefully/notefully 0.1.7 → 0.1.8

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