@makefully/notefully 0.2.5 → 0.2.6

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
@@ -104,11 +104,11 @@ let dt = "en-US", Le = {};
104
104
  function f(t, e) {
105
105
  !t || !e || typeof e != "object" || (St[String(t)] = e);
106
106
  }
107
- function rt(t) {
107
+ function st(t) {
108
108
  return String(t || "").trim().replace(/_/g, "-");
109
109
  }
110
110
  function Sa(t) {
111
- const e = rt(t);
111
+ const e = st(t);
112
112
  if (!e)
113
113
  return ["en-US"];
114
114
  const a = e, o = Dt[a] || Dt[a.toLowerCase()] || a, i = [], s = (l) => {
@@ -137,16 +137,16 @@ function Aa(t) {
137
137
  function Ca(t = {}) {
138
138
  var e;
139
139
  if (t.locale != null && String(t.locale).trim())
140
- return rt(t.locale);
140
+ return st(t.locale);
141
141
  if (typeof document < "u") {
142
142
  const a = (e = document.documentElement) == null ? void 0 : e.lang;
143
143
  if (a && String(a).trim())
144
- return rt(a);
144
+ return st(a);
145
145
  }
146
- return typeof navigator < "u" && navigator.language ? rt(navigator.language) : "en-US";
146
+ return typeof navigator < "u" && navigator.language ? st(navigator.language) : "en-US";
147
147
  }
148
148
  function za(t, e) {
149
- return t != null && (dt = rt(t) || "en-US"), dt;
149
+ return t != null && (dt = st(t) || "en-US"), dt;
150
150
  }
151
151
  function Ea(t) {
152
152
  Le = t && typeof t == "object" ? { ...t } : {};
@@ -155,7 +155,7 @@ function At() {
155
155
  return dt;
156
156
  }
157
157
  function Ra(t = dt) {
158
- const e = rt(t).split("-")[0].toLowerCase();
158
+ const e = st(t).split("-")[0].toLowerCase();
159
159
  return wa.has(e) ? "rtl" : "ltr";
160
160
  }
161
161
  function p(t, e) {
@@ -2461,15 +2461,15 @@ const ho = /* @__PURE__ */ (() => {
2461
2461
  );
2462
2462
  return () => (t += 1, `u${e()}${t}`);
2463
2463
  })();
2464
- function X(t) {
2464
+ function Y(t) {
2465
2465
  const e = [];
2466
2466
  for (let a = 0, o = t.length; a < o; a++)
2467
2467
  e.push(t[a]);
2468
2468
  return e;
2469
2469
  }
2470
- let it = null;
2470
+ let ot = null;
2471
2471
  function Ue(t = {}) {
2472
- return it || (t.includeStyleProperties ? (it = t.includeStyleProperties, it) : (it = X(window.getComputedStyle(document.documentElement)), it));
2472
+ return ot || (t.includeStyleProperties ? (ot = t.includeStyleProperties, ot) : (ot = Y(window.getComputedStyle(document.documentElement)), ot));
2473
2473
  }
2474
2474
  function Ct(t, e) {
2475
2475
  const o = (t.ownerDocument.defaultView || window).getComputedStyle(t).getPropertyValue(e);
@@ -2652,7 +2652,7 @@ async function Do(t, e, a) {
2652
2652
  if (Me(e))
2653
2653
  return e;
2654
2654
  let s = [];
2655
- return Mo(t) && t.assignedNodes ? s = X(t.assignedNodes()) : L(t, HTMLIFrameElement) && (!((o = t.contentDocument) === null || o === void 0) && o.body) ? s = X(t.contentDocument.body.childNodes) : s = X(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), s.length === 0 || L(t, HTMLVideoElement) || await s.reduce((n, l) => n.then(() => Ut(l, a)).then((u) => {
2655
+ return Mo(t) && t.assignedNodes ? s = Y(t.assignedNodes()) : L(t, HTMLIFrameElement) && (!((o = t.contentDocument) === null || o === void 0) && o.body) ? s = Y(t.contentDocument.body.childNodes) : s = Y(((i = t.shadowRoot) !== null && i !== void 0 ? i : t).childNodes), s.length === 0 || L(t, HTMLVideoElement) || await s.reduce((n, l) => n.then(() => Ut(l, a)).then((u) => {
2656
2656
  u && e.appendChild(u);
2657
2657
  }), Promise.resolve()), e;
2658
2658
  }
@@ -2743,7 +2743,7 @@ async function Ie(t, e, a) {
2743
2743
  const o = _o(t, a);
2744
2744
  return Go(o).reduce((s, n) => s.then((l) => qo(l, n, e, a)), Promise.resolve(o));
2745
2745
  }
2746
- async function st(t, e, a) {
2746
+ async function it(t, e, a) {
2747
2747
  var o;
2748
2748
  const i = (o = e.style) === null || o === void 0 ? void 0 : o.getPropertyValue(t);
2749
2749
  if (i) {
@@ -2753,7 +2753,7 @@ async function st(t, e, a) {
2753
2753
  return !1;
2754
2754
  }
2755
2755
  async function Wo(t, e) {
2756
- await st("background", t, e) || await st("background-image", t, e), await st("mask", t, e) || await st("-webkit-mask", t, e) || await st("mask-image", t, e) || await st("-webkit-mask-image", t, e);
2756
+ await it("background", t, e) || await it("background-image", t, e), await it("mask", t, e) || await it("-webkit-mask", t, e) || await it("mask-image", t, e) || await it("-webkit-mask-image", t, e);
2757
2757
  }
2758
2758
  async function Zo(t, e) {
2759
2759
  const a = L(t, HTMLImageElement);
@@ -2773,7 +2773,7 @@ async function Zo(t, e) {
2773
2773
  });
2774
2774
  }
2775
2775
  async function Jo(t, e) {
2776
- const o = X(t.childNodes).map((i) => Ve(i, e));
2776
+ const o = Y(t.childNodes).map((i) => Ve(i, e));
2777
2777
  await Promise.all(o).then(() => t);
2778
2778
  }
2779
2779
  async function Ve(t, e) {
@@ -2834,7 +2834,7 @@ async function Xo(t, e) {
2834
2834
  return t.forEach((i) => {
2835
2835
  if ("cssRules" in i)
2836
2836
  try {
2837
- X(i.cssRules || []).forEach((s, n) => {
2837
+ Y(i.cssRules || []).forEach((s, n) => {
2838
2838
  if (s.type === CSSRule.IMPORT_RULE) {
2839
2839
  let l = n + 1;
2840
2840
  const u = s.href, d = ce(u).then((g) => de(g, e)).then((g) => pe(g).forEach((k) => {
@@ -2863,7 +2863,7 @@ async function Xo(t, e) {
2863
2863
  }), Promise.all(o).then(() => (t.forEach((i) => {
2864
2864
  if ("cssRules" in i)
2865
2865
  try {
2866
- X(i.cssRules || []).forEach((s) => {
2866
+ Y(i.cssRules || []).forEach((s) => {
2867
2867
  a.push(s);
2868
2868
  });
2869
2869
  } catch (s) {
@@ -2877,7 +2877,7 @@ function Qo(t) {
2877
2877
  async function ti(t, e) {
2878
2878
  if (t.ownerDocument == null)
2879
2879
  throw new Error("Provided element is not within a Document");
2880
- const a = X(t.ownerDocument.styleSheets), o = await Xo(a, e);
2880
+ const a = Y(t.ownerDocument.styleSheets), o = await Xo(a, e);
2881
2881
  return Qo(o);
2882
2882
  }
2883
2883
  function $e(t) {
@@ -2979,7 +2979,7 @@ function Kt() {
2979
2979
  requestAnimationFrame(() => requestAnimationFrame(t));
2980
2980
  });
2981
2981
  }
2982
- function Q(t) {
2982
+ function X(t) {
2983
2983
  if (typeof t != "string" || !t.startsWith("data:image/"))
2984
2984
  return !1;
2985
2985
  const e = t.indexOf(",");
@@ -3035,17 +3035,17 @@ async function mi(t) {
3035
3035
  if (!t)
3036
3036
  return null;
3037
3037
  if (typeof t == "string")
3038
- return Q(t) ? t : null;
3038
+ return X(t) ? t : null;
3039
3039
  if (typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement)
3040
3040
  try {
3041
3041
  const e = t.toDataURL("image/png");
3042
- return Q(e) ? e : null;
3042
+ return X(e) ? e : null;
3043
3043
  } catch {
3044
3044
  return null;
3045
3045
  }
3046
3046
  if (typeof Blob < "u" && t instanceof Blob) {
3047
3047
  const e = await hi(t);
3048
- return Q(e) ? e : null;
3048
+ return X(e) ? e : null;
3049
3049
  }
3050
3050
  return null;
3051
3051
  }
@@ -3076,7 +3076,7 @@ async function fi() {
3076
3076
  const o = a.videoWidth || 1, i = a.videoHeight || 1, s = document.createElement("canvas");
3077
3077
  s.width = o, s.height = i, s.getContext("2d").drawImage(a, 0, 0, o, i);
3078
3078
  const n = s.toDataURL("image/png");
3079
- if (!Q(n))
3079
+ if (!X(n))
3080
3080
  throw new Error(p("status.screenEmpty"));
3081
3081
  return n;
3082
3082
  } finally {
@@ -3113,7 +3113,7 @@ async function Ne(t = {}) {
3113
3113
  } catch {
3114
3114
  g = await ge(document.body, { ...d, skipFonts: !0 });
3115
3115
  }
3116
- if (!Q(g))
3116
+ if (!X(g))
3117
3117
  throw new Error(p("status.captureEmpty"));
3118
3118
  return g;
3119
3119
  } finally {
@@ -3656,7 +3656,7 @@ function Wi(t = {}) {
3656
3656
  });
3657
3657
  return e.console = a, e;
3658
3658
  }
3659
- const J = [
3659
+ const Z = [
3660
3660
  { id: "bug", label: "Bug" },
3661
3661
  { id: "idea", label: "Idea" },
3662
3662
  { id: "other", label: "Other" }
@@ -3670,7 +3670,7 @@ function bt(t) {
3670
3670
  }
3671
3671
  function Zi(t) {
3672
3672
  if (!Array.isArray(t) || !t.length)
3673
- return J.map((o) => ({ ...o }));
3673
+ return Z.map((o) => ({ ...o }));
3674
3674
  const e = /* @__PURE__ */ new Set(), a = [];
3675
3675
  for (const o of t) {
3676
3676
  let i = "", s = "", n = "", l = "";
@@ -3680,11 +3680,11 @@ function Zi(t) {
3680
3680
  const u = { id: i, label: s };
3681
3681
  n && (u.title = n), l && (u.description = l), a.push(u);
3682
3682
  }
3683
- return a.length ? a : J.map((o) => ({ ...o }));
3683
+ return a.length ? a : Z.map((o) => ({ ...o }));
3684
3684
  }
3685
3685
  function Tt(t) {
3686
3686
  var a;
3687
- const e = Array.isArray(t) && t.length ? t : J;
3687
+ const e = Array.isArray(t) && t.length ? t : Z;
3688
3688
  return e.some((o) => o.id === "bug") ? "bug" : ((a = e[0]) == null ? void 0 : a.id) || "other";
3689
3689
  }
3690
3690
  const Ji = ["maker", "all-business", "brighter-day", "quiet-night"], qe = "maker", Yi = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), Ht = 0.02, Ce = 0.05, Xi = `
@@ -3723,7 +3723,7 @@ let c = {
3723
3723
  theme: qe,
3724
3724
  video: !1,
3725
3725
  consoleLogLimit: We,
3726
- kinds: J.map((t) => ({ ...t })),
3726
+ kinds: Z.map((t) => ({ ...t })),
3727
3727
  kindsCustom: !1,
3728
3728
  capture: null,
3729
3729
  onBeforeCapture: null,
@@ -3732,7 +3732,7 @@ let c = {
3732
3732
  displayLink: !1,
3733
3733
  locale: null,
3734
3734
  translations: null
3735
- }, pt = !1, Vt = !1, K = {}, y = null, r = {}, A = Yt(), q = "", nt = "", H = null, G = Tt(J), Y = null, O = null, R = null, E = null, kt = null, W = null, V = null, et = !1, _ = { w: 0, h: 0 }, $t = !1, gt = !1, mt = !1, B = [], $ = [], Z = !1;
3735
+ }, pt = !1, Vt = !1, K = {}, y = null, r = {}, A = Yt(), q = "", rt = "", H = null, G = Tt(Z), J = null, O = null, R = null, E = null, kt = null, _ = null, V = null, tt = !1, ct = { w: 0, h: 0 }, $t = !1, gt = !1, mt = !1, B = [], $ = [], W = !1;
3736
3736
  function h(t) {
3737
3737
  return y.querySelector(t);
3738
3738
  }
@@ -3854,13 +3854,13 @@ function Xt() {
3854
3854
  resetCrop: h(".nf-reset-crop"),
3855
3855
  submit: h(".nf-submit"),
3856
3856
  shot: null
3857
- }, es(), lt()), y;
3857
+ }, es(), nt()), y;
3858
3858
  }
3859
- function lt() {
3859
+ function nt() {
3860
3860
  var t;
3861
3861
  y && (Qe(), y.dataset.theme = Xe(c.theme), y.lang = At(), y.dir = Ra(At()), c.hideLauncher ? y.setAttribute("data-nf-hidden-launcher", "") : y.removeAttribute("data-nf-hidden-launcher"), r.video && (r.video.hidden = !c.video), ts(), B.length && B.forEach((e) => {
3862
3862
  e.label = p(`diag.${e.key}`);
3863
- }), ea(), Z ? se() : ie(), (t = r.dialog) != null && t.hidden && jt());
3863
+ }), ea(), W ? se() : ie(), (t = r.dialog) != null && t.hidden && jt());
3864
3864
  }
3865
3865
  function Qe() {
3866
3866
  const t = Ca({
@@ -3897,9 +3897,9 @@ function jt() {
3897
3897
  function es() {
3898
3898
  var e;
3899
3899
  r.launcher.addEventListener("click", () => ya()), h(".nf-dialog").addEventListener("click", (a) => {
3900
- gt && !mt || a.target === r.dialog && at();
3900
+ gt && !mt || a.target === r.dialog && et();
3901
3901
  }), (e = r.close) == null || e.addEventListener("click", () => {
3902
- gt && !mt || at();
3902
+ gt && !mt || et();
3903
3903
  }), document.addEventListener("keydown", ga), y.querySelectorAll(".nf-tool").forEach((a) => {
3904
3904
  a.addEventListener("click", () => ht(a.dataset.tool));
3905
3905
  }), r.resetCrop.addEventListener("click", gs), r.canvas.addEventListener("pointerdown", ls), r.canvas.addEventListener("dragstart", (a) => a.preventDefault());
@@ -3911,7 +3911,7 @@ function es() {
3911
3911
  fs().catch((a) => S(a.message || p("status.recaptureFailed")));
3912
3912
  }), r.restore.addEventListener("click", hs), r.audio.addEventListener("click", ys), r.video.addEventListener("click", () => {
3913
3913
  vs().catch((a) => S((a == null ? void 0 : a.message) || p("status.screenUnsupported")));
3914
- }), r.stop.addEventListener("click", () => V == null ? void 0 : V.stop()), r.privacyChange.addEventListener("click", () => oe(!Z)), r.privacyScroll.addEventListener("change", Us), h(".nf-submit").addEventListener("click", () => {
3914
+ }), r.stop.addEventListener("click", () => V == null ? void 0 : V.stop()), r.privacyChange.addEventListener("click", () => oe(!W)), r.privacyScroll.addEventListener("change", Ms), h(".nf-submit").addEventListener("click", () => {
3915
3915
  ka().catch((a) => S(a.message || p("status.submitFailed")));
3916
3916
  }), ea(), ht(null);
3917
3917
  }
@@ -3922,18 +3922,18 @@ function ea() {
3922
3922
  const t = y == null ? void 0 : y.querySelector(".nf-kind");
3923
3923
  if (!t)
3924
3924
  return;
3925
- const e = Array.isArray(c.kinds) && c.kinds.length ? c.kinds : J;
3925
+ const e = Array.isArray(c.kinds) && c.kinds.length ? c.kinds : Z;
3926
3926
  t.innerHTML = e.map((i) => `<button type="button" data-kind="${M(i.id)}">${M(ta(i))}</button>`).join("");
3927
3927
  const o = e.map((i) => i.id).includes(G) ? G : Tt(e);
3928
3928
  Qt(o);
3929
3929
  }
3930
3930
  function Qt(t) {
3931
- G = (c.kinds || J).map((a) => a.id).includes(t) ? t : Tt(c.kinds), y == null || y.querySelectorAll("[data-kind]").forEach((a) => {
3931
+ G = (c.kinds || Z).map((a) => a.id).includes(t) ? t : Tt(c.kinds), y == null || y.querySelectorAll("[data-kind]").forEach((a) => {
3932
3932
  a.dataset.active = String(a.dataset.kind === G);
3933
3933
  }), ss(G), te();
3934
3934
  }
3935
3935
  function as() {
3936
- return (Array.isArray(c.kinds) && c.kinds.length ? c.kinds : J).find((e) => e.id === G) || null;
3936
+ return (Array.isArray(c.kinds) && c.kinds.length ? c.kinds : Z).find((e) => e.id === G) || null;
3937
3937
  }
3938
3938
  function os() {
3939
3939
  const t = as(), e = (t == null ? void 0 : t.id) || G || "other", a = e === "bug" || e === "idea" || e === "other", o = (t == null ? void 0 : t.title) && String(t.title).trim() || p(a ? `form.title.${e}` : "form.title.other"), i = (t == null ? void 0 : t.description) && String(t.description).trim() || p(a ? `form.intro.${e}` : "form.intro.other"), s = a ? p(`form.placeholder.${e}`) : p("form.placeholder.custom", {
@@ -3963,13 +3963,13 @@ function ss(t) {
3963
3963
  }
3964
3964
  }
3965
3965
  function rs() {
3966
- const t = (c.kinds || J).map((a) => a.id), e = is();
3966
+ const t = (c.kinds || Z).map((a) => a.id), e = is();
3967
3967
  return e && t.includes(e) ? e : Tt(c.kinds);
3968
3968
  }
3969
3969
  function ht(t) {
3970
- Y = Yi.has(t) ? t : null, O = null, y.querySelectorAll(".nf-tool").forEach((e) => {
3971
- e.dataset.active = String(e.dataset.tool === Y);
3972
- }), r.canvas && (r.canvas.dataset.draw = Y ? "true" : "false"), I() && D();
3970
+ J = Yi.has(t) ? t : null, O = null, y.querySelectorAll(".nf-tool").forEach((e) => {
3971
+ e.dataset.active = String(e.dataset.tool === J);
3972
+ }), r.canvas && (r.canvas.dataset.draw = J ? "true" : "false"), I() && D();
3973
3973
  }
3974
3974
  function ze(t) {
3975
3975
  return Math.min(1, Math.max(0, t));
@@ -4035,14 +4035,14 @@ function ls(t) {
4035
4035
  }, t), D();
4036
4036
  return;
4037
4037
  }
4038
- if (O = null, Y === "crop") {
4038
+ if (O = null, J === "crop") {
4039
4039
  t.preventDefault(), Bt(t), R = { kind: "crop", start: Pt(t), current: Pt(t) }, Gt(), D();
4040
4040
  return;
4041
4041
  }
4042
- if (Y === "arrow" || Y === "rect" || Y === "circle") {
4042
+ if (J === "arrow" || J === "rect" || J === "circle") {
4043
4043
  t.preventDefault(), Bt(t);
4044
4044
  const o = aa(t);
4045
- R = { kind: "sticker", type: Y, start: o, current: o }, Gt(), D();
4045
+ R = { kind: "sticker", type: J, start: o, current: o }, Gt(), D();
4046
4046
  return;
4047
4047
  }
4048
4048
  D();
@@ -4131,7 +4131,7 @@ function ds() {
4131
4131
  y: i.y + a.y * i.h,
4132
4132
  w: a.w * i.w,
4133
4133
  h: a.h * i.h
4134
- }), ot();
4134
+ }), at();
4135
4135
  return;
4136
4136
  }
4137
4137
  const e = ps(t);
@@ -4159,7 +4159,7 @@ function ps(t) {
4159
4159
  return A.add(t.type, Ft(t.start, t.current));
4160
4160
  }
4161
4161
  function gs() {
4162
- A.resetCrop(), O = null, ot();
4162
+ A.resetCrop(), O = null, at();
4163
4163
  }
4164
4164
  function Lt() {
4165
4165
  r.resetCrop && (r.resetCrop.hidden = !A.isCropped());
@@ -4170,10 +4170,10 @@ function ft(t) {
4170
4170
  const e = !!t, a = p(e ? "tool.audioStop" : "tool.audio");
4171
4171
  r.audio.title = a, r.audio.setAttribute("aria-label", a), r.audio.dataset.active = String(e), r.audio.innerHTML = e ? x.stop : x.audio;
4172
4172
  }
4173
- function ct(t) {
4174
- if (et = !!t, r.video) {
4175
- const e = p(et ? "tool.stopVideo" : "tool.video");
4176
- r.video.title = e, r.video.setAttribute("aria-label", e), r.video.dataset.active = String(et), r.video.innerHTML = et ? x.stop : x.video;
4173
+ function ut(t) {
4174
+ if (tt = !!t, r.video) {
4175
+ const e = p(tt ? "tool.stopVideo" : "tool.video");
4176
+ r.video.title = e, r.video.setAttribute("aria-label", e), r.video.dataset.active = String(tt), r.video.innerHTML = tt ? x.stop : x.video;
4177
4177
  }
4178
4178
  if (r.stop) {
4179
4179
  const e = p("tool.stopVideo");
@@ -4181,19 +4181,19 @@ function ct(t) {
4181
4181
  }
4182
4182
  }
4183
4183
  function I() {
4184
- return Q(q);
4184
+ return X(q);
4185
4185
  }
4186
4186
  function vt() {
4187
4187
  if (!r.stage || !r.palette || !r.actions || !r.recapture)
4188
4188
  return;
4189
4189
  const t = I();
4190
- r.stage.hidden = !t && !H, r.palette.hidden = !t, r.discard && (r.discard.hidden = !t), r.restore && (r.restore.hidden = t || !nt), t && r.paletteShot ? (r.paletteShot.appendChild(r.recapture), r.paletteShot.appendChild(r.discard)) : r.actionsMedia ? r.actionsMedia.after(r.recapture) : r.audio ? r.audio.after(r.recapture) : r.actions.insertBefore(r.recapture, r.submit || null), r.recapture.hidden = !1, te();
4190
+ r.stage.hidden = !t && !H, r.palette.hidden = !t, r.discard && (r.discard.hidden = !t), r.restore && (r.restore.hidden = t || !rt), t && r.paletteShot ? (r.paletteShot.appendChild(r.recapture), r.paletteShot.appendChild(r.discard)) : r.actionsMedia ? r.actionsMedia.after(r.recapture) : r.audio ? r.audio.after(r.recapture) : r.actions.insertBefore(r.recapture, r.submit || null), r.recapture.hidden = !1, te();
4191
4191
  }
4192
4192
  function ms() {
4193
- I() && (nt = q), q = "", ht(null), vt(), ot();
4193
+ I() && (rt = q), q = "", ht(null), vt(), at();
4194
4194
  }
4195
4195
  function hs() {
4196
- Q(nt) && (q = nt, vt(), ot());
4196
+ X(rt) && (q = rt, vt(), at());
4197
4197
  }
4198
4198
  function sa() {
4199
4199
  return {
@@ -4202,9 +4202,9 @@ function sa() {
4202
4202
  };
4203
4203
  }
4204
4204
  function ra(t) {
4205
- if (!Q(t))
4205
+ if (!X(t))
4206
4206
  throw new Error(p("status.screenshotFailed"));
4207
- q = t, nt = t, A = Yt(), _ = { w: 0, h: 0 }, O = null, R = null, E = null, ht(null);
4207
+ q = t, rt = t, A = Yt(), ct = { w: 0, h: 0 }, O = null, R = null, E = null, ht(null);
4208
4208
  }
4209
4209
  async function fs() {
4210
4210
  if (!(Vt || !r.dialog || r.dialog.hidden)) {
@@ -4220,35 +4220,35 @@ async function fs() {
4220
4220
  } catch (t) {
4221
4221
  S((t == null ? void 0 : t.message) || p("status.screenshotFailed"));
4222
4222
  } finally {
4223
- r.dialog.hidden = !1, r.recapture.disabled = !1, Vt = !1, vt(), ot();
4223
+ r.dialog.hidden = !1, r.recapture.disabled = !1, Vt = !1, vt(), at();
4224
4224
  }
4225
4225
  }
4226
4226
  }
4227
4227
  function ys() {
4228
4228
  try {
4229
- if (W || (W = Pi((e) => {
4229
+ if (_ || (_ = Pi((e) => {
4230
4230
  const a = r.text.value.trim();
4231
4231
  r.text.value = a ? `${a} ${e}` : e;
4232
4232
  }, {
4233
4233
  onActiveChange(e) {
4234
4234
  ft(e), e || S("");
4235
4235
  }
4236
- })), !W.isSupported()) {
4236
+ })), !_.isSupported()) {
4237
4237
  S(p("status.audioUnsupported"));
4238
4238
  return;
4239
4239
  }
4240
- if (W.isActive()) {
4241
- W.stop();
4240
+ if (_.isActive()) {
4241
+ _.stop();
4242
4242
  return;
4243
4243
  }
4244
- const t = W.start({ lang: At() });
4244
+ const t = _.start({ lang: At() });
4245
4245
  ft(t), S(t ? p("status.listening") : "");
4246
4246
  } catch (t) {
4247
4247
  S(t.message);
4248
4248
  }
4249
4249
  }
4250
4250
  async function vs() {
4251
- if (et) {
4251
+ if (tt) {
4252
4252
  V == null || V.stop();
4253
4253
  return;
4254
4254
  }
@@ -4259,46 +4259,71 @@ async function ks() {
4259
4259
  S(p("status.videoDisabled"));
4260
4260
  return;
4261
4261
  }
4262
- if (!et) {
4263
- r.dialog.hidden = !0, r.stop.hidden = !1, lt(), r.launcher.hidden = !0, V = Li({
4262
+ if (!tt) {
4263
+ r.dialog.hidden = !0, r.stop.hidden = !1, nt(), r.launcher.hidden = !0, V = Li({
4264
4264
  onStart() {
4265
- ct(!0);
4265
+ ut(!0);
4266
4266
  },
4267
4267
  onStop(t) {
4268
- H = t, ct(!1), r.stop.hidden = !0, jt(), r.dialog.hidden = !1, vt(), ot(), S(p(t ? "status.videoAttached" : "status.recordingCancelled"));
4268
+ H = t, ut(!1), r.stop.hidden = !0, jt(), r.dialog.hidden = !1, vt(), at(), S(p(t ? "status.videoAttached" : "status.recordingCancelled"));
4269
4269
  },
4270
4270
  onError(t) {
4271
- ct(!1), S(t.message);
4271
+ ut(!1), S(t.message);
4272
4272
  }
4273
4273
  });
4274
4274
  try {
4275
4275
  await V.start();
4276
4276
  } catch (t) {
4277
- ct(!1), r.stop.hidden = !0, jt(), r.dialog.hidden = !1, S(t.message);
4277
+ ut(!1), r.stop.hidden = !0, jt(), r.dialog.hidden = !1, S(t.message);
4278
4278
  }
4279
4279
  }
4280
4280
  }
4281
- function ot() {
4281
+ function bs() {
4282
+ var e;
4283
+ const t = r.shotBlock || r.canvas;
4284
+ t == null || t.style.removeProperty("--nf-shot-aspect"), (e = r.canvas) == null || e.style.removeProperty("aspect-ratio");
4285
+ }
4286
+ function ws(t, e) {
4287
+ if (!(t > 0) || !(e > 0))
4288
+ return;
4289
+ const a = r.shotBlock || r.canvas, o = t / e;
4290
+ a == null || a.style.setProperty("--nf-shot-aspect", String(o)), r.canvas && (r.canvas.style.aspectRatio = `${t} / ${e}`);
4291
+ }
4292
+ function Ss(t) {
4293
+ if (!r.shot || !r.canvas || !(t > 0))
4294
+ return;
4295
+ const e = r.canvas.clientWidth, a = r.canvas.clientHeight;
4296
+ if (!(e > 0) || !(a > 0)) {
4297
+ r.shot.style.left = "0", r.shot.style.top = "0", r.shot.style.width = "100%", r.shot.style.height = "100%";
4298
+ return;
4299
+ }
4300
+ const o = e / a, i = Math.min(1, t / o), s = Math.min(1, o / t);
4301
+ r.shot.style.left = `${(1 - i) / 2 * 100}%`, r.shot.style.top = `${(1 - s) / 2 * 100}%`, r.shot.style.width = `${i * 100}%`, r.shot.style.height = `${s * 100}%`;
4302
+ }
4303
+ function at() {
4282
4304
  if (r.shot = null, !I()) {
4283
- r.canvas.style.removeProperty("--nf-shot-aspect"), r.canvas.style.removeProperty("aspect-ratio"), r.canvas.innerHTML = H ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(H)}"></video>` : "", Lt();
4305
+ bs(), r.canvas.innerHTML = H ? `<video class="nf-recording-preview" controls src="${URL.createObjectURL(H)}"></video>` : "", Lt();
4284
4306
  return;
4285
4307
  }
4286
4308
  r.canvas.innerHTML = `<div class="nf-shot"><img alt="${M(p("shot.alt"))}" src="${q}" draggable="false"></div>`, r.shot = r.canvas.querySelector(".nf-shot");
4287
4309
  const t = r.shot.querySelector("img");
4288
4310
  t.draggable = !1, t.addEventListener("dragstart", (a) => a.preventDefault());
4289
4311
  const e = () => {
4290
- bs(t), D();
4312
+ As(t), D();
4291
4313
  };
4292
4314
  t.addEventListener("load", e), t.complete && t.naturalWidth && e(), Lt();
4293
4315
  }
4294
- function bs(t) {
4295
- const e = t.naturalWidth || _.w, a = t.naturalHeight || _.h;
4296
- if (e && a && (_ = { w: e, h: a }, r.canvas.style.setProperty("--nf-shot-aspect", String(e / a)), r.canvas.style.aspectRatio = `${e} / ${a}`), !r.shot || !_.w || !_.h)
4316
+ function As(t) {
4317
+ const e = t.naturalWidth || ct.w, a = t.naturalHeight || ct.h;
4318
+ if (!r.shot || !(e > 0) || !(a > 0))
4297
4319
  return;
4298
- const o = A.crop(), i = _.w / _.h, s = o.w / o.h * i, n = Math.min(1, s / i), l = Math.min(1, i / s);
4299
- r.shot.style.left = `${(1 - n) / 2 * 100}%`, r.shot.style.top = `${(1 - l) / 2 * 100}%`, r.shot.style.width = `${n * 100}%`, r.shot.style.height = `${l * 100}%`, t.style.width = `${100 / o.w}%`, t.style.height = `${100 / o.h}%`, t.style.left = `${-o.x / o.w * 100}%`, t.style.top = `${-o.y / o.h * 100}%`;
4320
+ ct = { w: e, h: a };
4321
+ const o = A.crop(), i = o.w * e, s = o.h * a, n = i / s;
4322
+ ws(i, s), t.style.width = `${100 / o.w}%`, t.style.height = `${100 / o.h}%`, t.style.left = `${-o.x / o.w * 100}%`, t.style.top = `${-o.y / o.h * 100}%`;
4323
+ const l = () => Ss(n);
4324
+ l(), requestAnimationFrame(l);
4300
4325
  }
4301
- function ws(t) {
4326
+ function Cs(t) {
4302
4327
  return t.type === "arrow" ? {
4303
4328
  id: "preview",
4304
4329
  type: "arrow",
@@ -4327,9 +4352,9 @@ function D() {
4327
4352
  s.className = "nf-crop", Ee(s, Ft(R.start, R.current), { x: 0, y: 0, w: 1, h: 1 }), r.shot.appendChild(s);
4328
4353
  }
4329
4354
  const i = A.list().slice();
4330
- if ((R == null ? void 0 : R.kind) === "sticker" && i.push(ws(R)), i.forEach((s) => {
4355
+ if ((R == null ? void 0 : R.kind) === "sticker" && i.push(Cs(R)), i.forEach((s) => {
4331
4356
  const n = s.id === "preview", l = !n && s.id === O, u = document.createElement("div");
4332
- if (u.className = `nf-sticker nf-${s.type}`, u.dataset.id = s.id, l && (u.dataset.selected = "true"), n && (u.dataset.preview = "true"), s.type === "arrow" ? Ss(u, s, e, l, o) : (Ee(u, s, e), l && ["nw", "ne", "sw", "se"].forEach((d) => qt(u, d))), !n && s.number) {
4357
+ if (u.className = `nf-sticker nf-${s.type}`, u.dataset.id = s.id, l && (u.dataset.selected = "true"), n && (u.dataset.preview = "true"), s.type === "arrow" ? zs(u, s, e, l, o) : (Ee(u, s, e), l && ["nw", "ne", "sw", "se"].forEach((d) => qt(u, d))), !n && s.number) {
4333
4358
  const d = document.createElement("span");
4334
4359
  d.className = "nf-badge", d.textContent = String(s.number), u.appendChild(d);
4335
4360
  }
@@ -4340,13 +4365,13 @@ function D() {
4340
4365
  }
4341
4366
  Lt();
4342
4367
  }
4343
- function Ss(t, e, a, o, i = Ge(400)) {
4344
- const s = yt(), n = s.clientWidth, l = s.clientHeight, u = (e.x - a.x) / a.w * n, d = (e.y - a.y) / a.h * l, g = ((e.x2 ?? e.x + e.w) - a.x) / a.w * n, k = ((e.y2 ?? e.y) - a.y) / a.h * l, v = Math.max(18, i.arrowHead + i.stroke * 2), w = Math.min(u, g) - v, b = Math.min(d, k) - v, z = Math.max(2, Math.abs(g - u)) + v * 2, j = Math.max(2, Math.abs(k - d)) + v * 2, T = u - w, N = d - b, P = g - w, m = k - b, C = Di(T, N, P, m, i), tt = document.createElementNS("http://www.w3.org/2000/svg", "svg");
4345
- t.style.left = `${w}px`, t.style.top = `${b}px`, t.style.width = `${z}px`, t.style.height = `${j}px`, tt.setAttribute("class", "nf-arrow-svg"), tt.setAttribute("viewBox", `0 0 ${z} ${j}`), tt.setAttribute("width", String(z)), tt.setAttribute("height", String(j)), tt.innerHTML = `
4368
+ function zs(t, e, a, o, i = Ge(400)) {
4369
+ const s = yt(), n = s.clientWidth, l = s.clientHeight, u = (e.x - a.x) / a.w * n, d = (e.y - a.y) / a.h * l, g = ((e.x2 ?? e.x + e.w) - a.x) / a.w * n, k = ((e.y2 ?? e.y) - a.y) / a.h * l, v = Math.max(18, i.arrowHead + i.stroke * 2), w = Math.min(u, g) - v, b = Math.min(d, k) - v, z = Math.max(2, Math.abs(g - u)) + v * 2, j = Math.max(2, Math.abs(k - d)) + v * 2, T = u - w, N = d - b, P = g - w, m = k - b, C = Di(T, N, P, m, i), Q = document.createElementNS("http://www.w3.org/2000/svg", "svg");
4370
+ t.style.left = `${w}px`, t.style.top = `${b}px`, t.style.width = `${z}px`, t.style.height = `${j}px`, Q.setAttribute("class", "nf-arrow-svg"), Q.setAttribute("viewBox", `0 0 ${z} ${j}`), Q.setAttribute("width", String(z)), Q.setAttribute("height", String(j)), Q.innerHTML = `
4346
4371
  <line class="nf-arrow-hit" x1="${T}" y1="${N}" x2="${P}" y2="${m}" />
4347
4372
  <line class="nf-arrow-shaft" x1="${T}" y1="${N}" x2="${C.shaftEnd.x}" y2="${C.shaftEnd.y}" />
4348
4373
  <polygon class="nf-arrow-head" points="${C.tipX},${C.tipY} ${C.left.x},${C.left.y} ${C.right.x},${C.right.y}" />
4349
- `, t.appendChild(tt), o && (qt(t, "start", { left: T - 5, top: N - 5 }), qt(t, "end", { left: P - 5, top: m - 5 }));
4374
+ `, t.appendChild(Q), o && (qt(t, "start", { left: T - 5, top: N - 5 }), qt(t, "end", { left: P - 5, top: m - 5 }));
4350
4375
  }
4351
4376
  function qt(t, e, a) {
4352
4377
  const o = document.createElement("span");
@@ -4362,7 +4387,7 @@ function na() {
4362
4387
  return "";
4363
4388
  }
4364
4389
  }
4365
- function As(t) {
4390
+ function Es(t) {
4366
4391
  const e = String(t || "").trim();
4367
4392
  if (!(!e || e === _t()))
4368
4393
  try {
@@ -4408,12 +4433,12 @@ function ca() {
4408
4433
  function _t() {
4409
4434
  return p("form.authorPlaceholder");
4410
4435
  }
4411
- function Cs() {
4436
+ function Rs() {
4412
4437
  var e;
4413
4438
  if (ua())
4414
4439
  return ca() || _t();
4415
4440
  const t = String(((e = r.author) == null ? void 0 : e.value) || "").trim();
4416
- return t ? (As(t), t) : _t();
4441
+ return t ? (Es(t), t) : _t();
4417
4442
  }
4418
4443
  function da() {
4419
4444
  if (!r.author)
@@ -4430,7 +4455,7 @@ function pa(t, e = We) {
4430
4455
  return Number.isFinite(a) ? Math.min(Qi, Math.max(0, Math.floor(a))) : e;
4431
4456
  }
4432
4457
  function ga(t) {
4433
- t.key !== "Escape" || !r.dialog || r.dialog.hidden || gt && !mt || at();
4458
+ t.key !== "Escape" || !r.dialog || r.dialog.hidden || gt && !mt || et();
4434
4459
  }
4435
4460
  function ma(t = {}) {
4436
4461
  wi(t);
@@ -4466,29 +4491,29 @@ function ha(t) {
4466
4491
  console.warn(`Notefully.${t} failed:`, a);
4467
4492
  }
4468
4493
  }
4469
- function zs() {
4494
+ function js() {
4470
4495
  return pt;
4471
4496
  }
4472
- function Es() {
4497
+ function Ps() {
4473
4498
  return At();
4474
4499
  }
4475
- function Rs(t, e) {
4476
- return c.locale = t == null || t === "" ? null : String(t), e !== void 0 && (c.translations = e && typeof e == "object" ? e : null), y ? lt() : Qe(), Mt;
4500
+ function xs(t, e) {
4501
+ return c.locale = t == null || t === "" ? null : String(t), e !== void 0 && (c.translations = e && typeof e == "object" ? e : null), y ? nt() : Qe(), Mt;
4477
4502
  }
4478
4503
  function ae(t = {}) {
4479
- return ma(t), y && lt(), Mt;
4504
+ return ma(t), y && nt(), Mt;
4480
4505
  }
4481
- function js(t = {}) {
4482
- return ma(t), Xt(), lt(), Mt;
4506
+ function Ls(t = {}) {
4507
+ return ma(t), Xt(), nt(), Mt;
4483
4508
  }
4484
- function Ps(t) {
4509
+ function Us(t) {
4485
4510
  return ae({ theme: t });
4486
4511
  }
4487
- function xs(t) {
4512
+ function Ts(t) {
4488
4513
  const e = !!t;
4489
- return !e && y && r.dialog && !r.dialog.hidden && at(), ae({ hideLauncher: !e });
4514
+ return !e && y && r.dialog && !r.dialog.hidden && et(), ae({ hideLauncher: !e });
4490
4515
  }
4491
- function Ls() {
4516
+ function Fs() {
4492
4517
  const t = ca() || na() || void 0, e = ki({
4493
4518
  ...K,
4494
4519
  displayName: K.displayName || t
@@ -4497,10 +4522,10 @@ function Ls() {
4497
4522
  _e.snapshot().slice(-pa(c.consoleLogLimit))
4498
4523
  );
4499
4524
  const a = la();
4500
- a.diagnostics && Rt(B, !0), a.logs && $.length && Rt($, !0), Z = !1;
4525
+ a.diagnostics && Rt(B, !0), a.logs && $.length && Rt($, !0), W = !1;
4501
4526
  }
4502
4527
  function oe(t) {
4503
- Z = !!t, r.privacyPanel && (r.privacyPanel.hidden = !Z), r.privacyStack && (r.privacyStack.dataset.open = String(Z)), r.privacyChange && (r.privacyChange.setAttribute("aria-expanded", Z ? "true" : "false"), r.privacyChange.dataset.active = String(Z)), Z && se();
4528
+ W = !!t, r.privacyPanel && (r.privacyPanel.hidden = !W), r.privacyStack && (r.privacyStack.dataset.open = String(W)), r.privacyChange && (r.privacyChange.setAttribute("aria-expanded", W ? "true" : "false"), r.privacyChange.dataset.active = String(W)), W && se();
4504
4529
  }
4505
4530
  function ie() {
4506
4531
  if (!r.privacy || !r.privacyText || !r.privacyChange)
@@ -4570,7 +4595,7 @@ function se() {
4570
4595
  a.indeterminate = !0, a.removeAttribute("data-indeterminate");
4571
4596
  }), ie();
4572
4597
  }
4573
- function Us(t) {
4598
+ function Ms(t) {
4574
4599
  const e = t.target;
4575
4600
  if (!(e instanceof HTMLInputElement) || e.type !== "checkbox")
4576
4601
  return;
@@ -4592,21 +4617,21 @@ function Us(t) {
4592
4617
  se();
4593
4618
  }
4594
4619
  async function ya() {
4595
- Xt(), pt || (pt = !0, ha("onOpen")), va(), lt(), r.launcher.hidden = !0, A = Yt(), _ = { w: 0, h: 0 }, H = null, q = "", nt = "", O = null, R = null, E = null, G = rs(), Qt(G), ht(null), ft(!1), r.text.value = "", da(), S(""), Ls();
4620
+ Xt(), pt || (pt = !0, ha("onOpen")), va(), nt(), r.launcher.hidden = !0, A = Yt(), ct = { w: 0, h: 0 }, H = null, q = "", rt = "", O = null, R = null, E = null, G = rs(), Qt(G), ht(null), ft(!1), r.text.value = "", da(), S(""), Fs();
4596
4621
  try {
4597
4622
  ra(await Ne(sa())), S("");
4598
4623
  } catch (e) {
4599
4624
  q = "", S((e == null ? void 0 : e.message) || p("status.screenshotFailed"));
4600
4625
  }
4601
- vt(), oe(!1), ie(), r.dialog.hidden = !1, ot(), r.text.focus();
4626
+ vt(), oe(!1), ie(), r.dialog.hidden = !1, at(), r.text.focus();
4602
4627
  }
4603
- function at() {
4628
+ function et() {
4604
4629
  if (!y)
4605
4630
  return;
4606
4631
  const t = pt;
4607
- W == null || W.stop(), ft(!1), et && (V == null || V.stop()), ct(!1), oa(), R = null, E = null, ee(!1), va(), oe(!1), r.dialog.hidden = !0, r.stop.hidden = !0, jt(), t && (pt = !1, ha("onClose"));
4632
+ _ == null || _.stop(), ft(!1), tt && (V == null || V.stop()), ut(!1), oa(), R = null, E = null, ee(!1), va(), oe(!1), r.dialog.hidden = !0, r.stop.hidden = !0, jt(), t && (pt = !1, ha("onClose"));
4608
4633
  }
4609
- function Ts(t = "") {
4634
+ function Ds(t = "") {
4610
4635
  const e = r.dialog, a = r.panel, o = r.panelBody, i = r.successMsg, s = r.successLink, n = String(t || "").trim(), l = !!(c.displayLink && n);
4611
4636
  if (!e || !a || !o || !i)
4612
4637
  return Promise.resolve(!1);
@@ -4650,7 +4675,7 @@ function Ts(t = "") {
4650
4675
  function va() {
4651
4676
  gt = !1, mt = !1, r.dialog && (r.dialog.classList.remove("nf-success", "nf-success-sticky"), r.dialog.style.opacity = "", r.dialog.style.transition = "", r.panel && (r.panel.style.transform = "", r.panel.style.transition = "", r.panel.style.transformOrigin = ""), r.panelBody && (r.panelBody.hidden = !1), r.successMsg && (r.successMsg.hidden = !0), r.successLink && (r.successLink.hidden = !0, r.successLink.removeAttribute("href")));
4652
4677
  }
4653
- function Fs(t = {}) {
4678
+ function Os(t = {}) {
4654
4679
  K = { ...K, ...bi(t) }, da();
4655
4680
  }
4656
4681
  async function ka() {
@@ -4664,7 +4689,7 @@ async function ka() {
4664
4689
  return S(p("status.missingConfig")), null;
4665
4690
  $t = !0, xe(!0), S(p("status.submitting"), !0);
4666
4691
  try {
4667
- const o = Cs(), i = A.crop(), s = A.list(), n = A.isCropped(), l = n ? Ti(s, i) : s, u = n ? { x: 0, y: 0, w: 1, h: 1 } : i, d = Wi({
4692
+ const o = Rs(), i = A.crop(), s = A.list(), n = A.isCropped(), l = n ? Ti(s, i) : s, u = n ? { x: 0, y: 0, w: 1, h: 1 } : i, d = Wi({
4668
4693
  author: o,
4669
4694
  diagnostics: B,
4670
4695
  logs: $
@@ -4714,10 +4739,10 @@ async function ka() {
4714
4739
  C = null;
4715
4740
  }
4716
4741
  if (!m.ok) {
4717
- const ut = new Error((C == null ? void 0 : C.error) || `${p("status.submitFailed")} (${m.status})`);
4718
- throw ut.status = m.status, ut.code = C == null ? void 0 : C.code, ut.json = C, ut;
4742
+ const lt = new Error((C == null ? void 0 : C.error) || `${p("status.submitFailed")} (${m.status})`);
4743
+ throw lt.status = m.status, lt.code = C == null ? void 0 : C.code, lt.json = C, lt;
4719
4744
  }
4720
- return j && I() && S(p("status.submitWithoutImage"), !0), await Ts((C == null ? void 0 : C.trackerUrl) || "") || at(), C;
4745
+ return j && I() && S(p("status.submitWithoutImage"), !0), await Ds((C == null ? void 0 : C.trackerUrl) || "") || et(), C;
4721
4746
  } catch (m) {
4722
4747
  if (w = m, k.push({
4723
4748
  attempt: z,
@@ -4747,36 +4772,36 @@ async function ka() {
4747
4772
  function xe(t) {
4748
4773
  r.submit && (r.submit.disabled = !!t, r.submit.setAttribute("aria-busy", t ? "true" : "false"));
4749
4774
  }
4750
- function Ms() {
4751
- at(), document.removeEventListener("keydown", ga), y == null || y.remove(), y = null, r = {};
4775
+ function Is() {
4776
+ et(), document.removeEventListener("keydown", ga), y == null || y.remove(), y = null, r = {};
4752
4777
  }
4753
4778
  const Mt = {
4754
- init: js,
4779
+ init: Ls,
4755
4780
  configure: ae,
4756
- setTheme: Ps,
4757
- setVisible: xs,
4781
+ setTheme: Us,
4782
+ setVisible: Ts,
4758
4783
  open: ya,
4759
- close: at,
4760
- isOpen: zs,
4761
- getLocale: Es,
4762
- setLocale: Rs,
4763
- identify: Fs,
4784
+ close: et,
4785
+ isOpen: js,
4786
+ getLocale: Ps,
4787
+ setLocale: xs,
4788
+ identify: Os,
4764
4789
  submit: ka,
4765
- destroy: Ms
4790
+ destroy: Is
4766
4791
  };
4767
4792
  typeof window < "u" && (window.Notefully = Mt);
4768
4793
  export {
4769
- at as close,
4794
+ et as close,
4770
4795
  ae as configure,
4771
4796
  Mt as default,
4772
- Ms as destroy,
4773
- Es as getLocaleTag,
4774
- Fs as identify,
4775
- js as init,
4776
- zs as isOpen,
4797
+ Is as destroy,
4798
+ Ps as getLocaleTag,
4799
+ Os as identify,
4800
+ Ls as init,
4801
+ js as isOpen,
4777
4802
  ya as open,
4778
- Rs as setLocale,
4779
- Ps as setTheme,
4780
- xs as setVisible,
4803
+ xs as setLocale,
4804
+ Us as setTheme,
4805
+ Ts as setVisible,
4781
4806
  ka as submit
4782
4807
  };