@pixelmatters/markup 1.4.0 → 1.4.1

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.
Files changed (3) hide show
  1. package/README.md +6 -6
  2. package/dist/widget.js +277 -269
  3. package/package.json +1 -1
package/dist/widget.js CHANGED
@@ -2819,27 +2819,49 @@ function Ar(e) {
2819
2819
  }
2820
2820
  }
2821
2821
  //#endregion
2822
+ //#region src/runtime/history-observer.ts
2823
+ var jr = "__markup_history_observer__", Mr = "__markup_history_listeners__";
2824
+ function Nr(e) {
2825
+ e.forEach((e) => e());
2826
+ }
2827
+ function Pr() {
2828
+ let e = history.pushState;
2829
+ if (e[jr]) return e[Mr];
2830
+ let t = /* @__PURE__ */ new Set(), n = history.pushState, r = history.replaceState;
2831
+ function i(...e) {
2832
+ n.apply(this, e), Nr(t);
2833
+ }
2834
+ function a(...e) {
2835
+ r.apply(this, e), Nr(t);
2836
+ }
2837
+ return Object.defineProperty(i, jr, { value: 1 }), Object.defineProperty(i, Mr, { value: t }), Object.defineProperty(a, jr, { value: 1 }), history.pushState = i, history.replaceState = a, window.addEventListener("popstate", () => Nr(t)), t;
2838
+ }
2839
+ var Fr = null;
2840
+ function Ir(e) {
2841
+ return Fr ||= Pr(), Fr.add(e), () => Fr.delete(e);
2842
+ }
2843
+ //#endregion
2822
2844
  //#region src/runtime/identity-store.ts
2823
- var jr = "markup.identity";
2824
- function Mr() {
2845
+ var Lr = "markup.identity";
2846
+ function Rr() {
2825
2847
  try {
2826
- let e = localStorage.getItem(jr);
2848
+ let e = localStorage.getItem(Lr);
2827
2849
  return e ? JSON.parse(e) : null;
2828
2850
  } catch {
2829
2851
  return null;
2830
2852
  }
2831
2853
  }
2832
- function Nr(e) {
2854
+ function zr(e) {
2833
2855
  try {
2834
2856
  if (e == null) {
2835
- localStorage.removeItem(jr);
2857
+ localStorage.removeItem(Lr);
2836
2858
  return;
2837
2859
  }
2838
- localStorage.setItem(jr, JSON.stringify(e));
2860
+ localStorage.setItem(Lr, JSON.stringify(e));
2839
2861
  } catch {}
2840
2862
  }
2841
- function Pr() {
2842
- let e = Mr(), t = {
2863
+ function Br() {
2864
+ let e = Rr(), t = {
2843
2865
  name: e?.name,
2844
2866
  email: e?.email
2845
2867
  };
@@ -2874,10 +2896,10 @@ function Pr() {
2874
2896
  preserved: t
2875
2897
  };
2876
2898
  }
2877
- function Fr(e) {
2899
+ function Vr(e) {
2878
2900
  switch (e.kind) {
2879
2901
  case "verified":
2880
- Nr({
2902
+ zr({
2881
2903
  clientId: e.identity.clientId,
2882
2904
  token: e.identity.token,
2883
2905
  tokenExpiresAt: e.identity.tokenExpiresAt,
@@ -2887,7 +2909,7 @@ function Fr(e) {
2887
2909
  });
2888
2910
  return;
2889
2911
  case "anon":
2890
- Nr({
2912
+ zr({
2891
2913
  clientId: e.identity.clientId,
2892
2914
  anonToken: e.identity.anonToken,
2893
2915
  name: e.identity.name,
@@ -2895,23 +2917,23 @@ function Fr(e) {
2895
2917
  });
2896
2918
  return;
2897
2919
  case "recovering":
2898
- Nr({
2920
+ zr({
2899
2921
  name: e.preserved.name,
2900
2922
  email: e.preserved.email
2901
2923
  });
2902
2924
  return;
2903
2925
  case "unresolved":
2904
- Nr(null);
2926
+ zr(null);
2905
2927
  return;
2906
2928
  }
2907
2929
  }
2908
- function Ir(e) {
2930
+ function Hr(e) {
2909
2931
  if (e.kind === "anon" || e.kind === "verified") return e.identity.clientId;
2910
2932
  }
2911
- function Lr(e) {
2933
+ function Ur(e) {
2912
2934
  return e.kind === "anon" ? e.identity.name ?? null : e.kind === "verified" ? e.identity.name : null;
2913
2935
  }
2914
- function Rr(e) {
2936
+ function Wr(e) {
2915
2937
  if (e.kind === "anon") {
2916
2938
  let t = e.identity.name;
2917
2939
  return t ? {
@@ -2926,7 +2948,7 @@ function Rr(e) {
2926
2948
  }
2927
2949
  //#endregion
2928
2950
  //#region src/runtime/popup-auth.ts
2929
- async function zr(e, t) {
2951
+ async function Gr(e, t) {
2930
2952
  let n = new URL(e).origin, r;
2931
2953
  try {
2932
2954
  let n = await fetch(`${e.replace(/\/+$/, "")}/widget/popup-exchange`, {
@@ -2967,14 +2989,14 @@ async function zr(e, t) {
2967
2989
  }
2968
2990
  //#endregion
2969
2991
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/util.js
2970
- function Br(e, t) {
2992
+ function Kr(e, t) {
2971
2993
  if (e.match(/^[a-z]+:\/\//i)) return e;
2972
2994
  if (e.match(/^\/\//)) return window.location.protocol + e;
2973
2995
  if (e.match(/^[a-z]+:/i)) return e;
2974
2996
  let n = document.implementation.createHTMLDocument(), r = n.createElement("base"), i = n.createElement("a");
2975
2997
  return n.head.appendChild(r), n.body.appendChild(i), t && (r.href = t), i.href = e, i.href;
2976
2998
  }
2977
- var Vr = (() => {
2999
+ var qr = (() => {
2978
3000
  let e = 0, t = () => `0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4);
2979
3001
  return () => (e += 1, `u${t()}${e}`);
2980
3002
  })();
@@ -2983,29 +3005,29 @@ function Y(e) {
2983
3005
  for (let n = 0, r = e.length; n < r; n++) t.push(e[n]);
2984
3006
  return t;
2985
3007
  }
2986
- var Hr = null;
2987
- function Ur(e = {}) {
2988
- return Hr || (e.includeStyleProperties ? (Hr = e.includeStyleProperties, Hr) : (Hr = Y(window.getComputedStyle(document.documentElement)), Hr));
3008
+ var Jr = null;
3009
+ function Yr(e = {}) {
3010
+ return Jr || (e.includeStyleProperties ? (Jr = e.includeStyleProperties, Jr) : (Jr = Y(window.getComputedStyle(document.documentElement)), Jr));
2989
3011
  }
2990
- function Wr(e, t) {
3012
+ function Xr(e, t) {
2991
3013
  let n = (e.ownerDocument.defaultView || window).getComputedStyle(e).getPropertyValue(t);
2992
3014
  return n ? parseFloat(n.replace("px", "")) : 0;
2993
3015
  }
2994
- function Gr(e) {
2995
- let t = Wr(e, "border-left-width"), n = Wr(e, "border-right-width");
3016
+ function Zr(e) {
3017
+ let t = Xr(e, "border-left-width"), n = Xr(e, "border-right-width");
2996
3018
  return e.clientWidth + t + n;
2997
3019
  }
2998
- function Kr(e) {
2999
- let t = Wr(e, "border-top-width"), n = Wr(e, "border-bottom-width");
3020
+ function Qr(e) {
3021
+ let t = Xr(e, "border-top-width"), n = Xr(e, "border-bottom-width");
3000
3022
  return e.clientHeight + t + n;
3001
3023
  }
3002
- function qr(e, t = {}) {
3024
+ function $r(e, t = {}) {
3003
3025
  return {
3004
- width: t.width || Gr(e),
3005
- height: t.height || Kr(e)
3026
+ width: t.width || Zr(e),
3027
+ height: t.height || Qr(e)
3006
3028
  };
3007
3029
  }
3008
- function Jr() {
3030
+ function ei() {
3009
3031
  let e, t;
3010
3032
  try {
3011
3033
  t = process;
@@ -3014,10 +3036,10 @@ function Jr() {
3014
3036
  return n && (e = parseInt(n, 10), Number.isNaN(e) && (e = 1)), e || window.devicePixelRatio || 1;
3015
3037
  }
3016
3038
  var X = 16384;
3017
- function Yr(e) {
3039
+ function ti(e) {
3018
3040
  (e.width > X || e.height > X) && (e.width > X && e.height > X ? e.width > e.height ? (e.height *= X / e.width, e.width = X) : (e.width *= X / e.height, e.height = X) : e.width > X ? (e.height *= X / e.width, e.width = X) : (e.width *= X / e.height, e.height = X));
3019
3041
  }
3020
- function Xr(e) {
3042
+ function ni(e) {
3021
3043
  return new Promise((t, n) => {
3022
3044
  let r = new Image();
3023
3045
  r.onload = () => {
@@ -3027,12 +3049,12 @@ function Xr(e) {
3027
3049
  }, r.onerror = n, r.crossOrigin = "anonymous", r.decoding = "async", r.src = e;
3028
3050
  });
3029
3051
  }
3030
- async function Zr(e) {
3052
+ async function ri(e) {
3031
3053
  return Promise.resolve().then(() => new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then((e) => `data:image/svg+xml;charset=utf-8,${e}`);
3032
3054
  }
3033
- async function Qr(e, t, n) {
3055
+ async function ii(e, t, n) {
3034
3056
  let r = "http://www.w3.org/2000/svg", i = document.createElementNS(r, "svg"), a = document.createElementNS(r, "foreignObject");
3035
- return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e), Zr(i);
3057
+ return i.setAttribute("width", `${t}`), i.setAttribute("height", `${n}`), i.setAttribute("viewBox", `0 0 ${t} ${n}`), a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.setAttribute("externalResourcesRequired", "true"), i.appendChild(a), a.appendChild(e), ri(i);
3036
3058
  }
3037
3059
  var Z = (e, t) => {
3038
3060
  if (e instanceof t) return !0;
@@ -3041,66 +3063,66 @@ var Z = (e, t) => {
3041
3063
  };
3042
3064
  //#endregion
3043
3065
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-pseudos.js
3044
- function $r(e) {
3066
+ function ai(e) {
3045
3067
  let t = e.getPropertyValue("content");
3046
3068
  return `${e.cssText} content: '${t.replace(/'|"/g, "")}';`;
3047
3069
  }
3048
- function ei(e, t) {
3049
- return Ur(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
3070
+ function oi(e, t) {
3071
+ return Yr(t).map((t) => `${t}: ${e.getPropertyValue(t)}${e.getPropertyPriority(t) ? " !important" : ""};`).join(" ");
3050
3072
  }
3051
- function ti(e, t, n, r) {
3052
- let i = `.${e}:${t}`, a = n.cssText ? $r(n) : ei(n, r);
3073
+ function si(e, t, n, r) {
3074
+ let i = `.${e}:${t}`, a = n.cssText ? ai(n) : oi(n, r);
3053
3075
  return document.createTextNode(`${i}{${a}}`);
3054
3076
  }
3055
- function ni(e, t, n, r) {
3077
+ function ci(e, t, n, r) {
3056
3078
  let i = window.getComputedStyle(e, n), a = i.getPropertyValue("content");
3057
3079
  if (a === "" || a === "none") return;
3058
- let o = Vr();
3080
+ let o = qr();
3059
3081
  try {
3060
3082
  t.className = `${t.className} ${o}`;
3061
3083
  } catch {
3062
3084
  return;
3063
3085
  }
3064
3086
  let s = document.createElement("style");
3065
- s.appendChild(ti(o, n, i, r)), t.appendChild(s);
3087
+ s.appendChild(si(o, n, i, r)), t.appendChild(s);
3066
3088
  }
3067
- function ri(e, t, n) {
3068
- ni(e, t, ":before", n), ni(e, t, ":after", n);
3089
+ function li(e, t, n) {
3090
+ ci(e, t, ":before", n), ci(e, t, ":after", n);
3069
3091
  }
3070
3092
  //#endregion
3071
3093
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/mimes.js
3072
- var ii = "application/font-woff", ai = "image/jpeg", oi = {
3073
- woff: ii,
3074
- woff2: ii,
3094
+ var ui = "application/font-woff", di = "image/jpeg", fi = {
3095
+ woff: ui,
3096
+ woff2: ui,
3075
3097
  ttf: "application/font-truetype",
3076
3098
  eot: "application/vnd.ms-fontobject",
3077
3099
  png: "image/png",
3078
- jpg: ai,
3079
- jpeg: ai,
3100
+ jpg: di,
3101
+ jpeg: di,
3080
3102
  gif: "image/gif",
3081
3103
  tiff: "image/tiff",
3082
3104
  svg: "image/svg+xml",
3083
3105
  webp: "image/webp"
3084
3106
  };
3085
- function si(e) {
3107
+ function pi(e) {
3086
3108
  let t = /\.([^./]*?)$/g.exec(e);
3087
3109
  return t ? t[1] : "";
3088
3110
  }
3089
- function ci(e) {
3090
- return oi[si(e).toLowerCase()] || "";
3111
+ function mi(e) {
3112
+ return fi[pi(e).toLowerCase()] || "";
3091
3113
  }
3092
3114
  //#endregion
3093
3115
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/dataurl.js
3094
- function li(e) {
3116
+ function hi(e) {
3095
3117
  return e.split(/,/)[1];
3096
3118
  }
3097
- function ui(e) {
3119
+ function gi(e) {
3098
3120
  return e.search(/^(data:)/) !== -1;
3099
3121
  }
3100
- function di(e, t) {
3122
+ function _i(e, t) {
3101
3123
  return `data:${t};base64,${e}`;
3102
3124
  }
3103
- async function fi(e, t, n) {
3125
+ async function vi(e, t, n) {
3104
3126
  let r = await fetch(e, t);
3105
3127
  if (r.status === 404) throw Error(`Resource "${r.url}" not found`);
3106
3128
  let i = await r.blob();
@@ -3118,78 +3140,78 @@ async function fi(e, t, n) {
3118
3140
  }, a.readAsDataURL(i);
3119
3141
  });
3120
3142
  }
3121
- var pi = {};
3122
- function mi(e, t, n) {
3143
+ var yi = {};
3144
+ function bi(e, t, n) {
3123
3145
  let r = e.replace(/\?.*/, "");
3124
3146
  return n && (r = e), /ttf|otf|eot|woff2?/i.test(r) && (r = r.replace(/.*\//, "")), t ? `[${t}]${r}` : r;
3125
3147
  }
3126
- async function hi(e, t, n) {
3127
- let r = mi(e, t, n.includeQueryParams);
3128
- if (pi[r] != null) return pi[r];
3148
+ async function xi(e, t, n) {
3149
+ let r = bi(e, t, n.includeQueryParams);
3150
+ if (yi[r] != null) return yi[r];
3129
3151
  n.cacheBust && (e += (/\?/.test(e) ? "&" : "?") + (/* @__PURE__ */ new Date()).getTime());
3130
3152
  let i;
3131
3153
  try {
3132
- i = di(await fi(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", li(n))), t);
3154
+ i = _i(await vi(e, n.fetchRequestInit, ({ res: e, result: n }) => (t ||= e.headers.get("Content-Type") || "", hi(n))), t);
3133
3155
  } catch (t) {
3134
3156
  i = n.imagePlaceholder || "";
3135
3157
  let r = `Failed to fetch resource: ${e}`;
3136
3158
  t && (r = typeof t == "string" ? t : t.message), r && console.warn(r);
3137
3159
  }
3138
- return pi[r] = i, i;
3160
+ return yi[r] = i, i;
3139
3161
  }
3140
3162
  //#endregion
3141
3163
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/clone-node.js
3142
- async function gi(e) {
3164
+ async function Si(e) {
3143
3165
  let t = e.toDataURL();
3144
- return t === "data:," ? e.cloneNode(!1) : Xr(t);
3166
+ return t === "data:," ? e.cloneNode(!1) : ni(t);
3145
3167
  }
3146
- async function _i(e, t) {
3168
+ async function Ci(e, t) {
3147
3169
  if (e.currentSrc) {
3148
3170
  let t = document.createElement("canvas"), n = t.getContext("2d");
3149
- return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), Xr(t.toDataURL());
3171
+ return t.width = e.clientWidth, t.height = e.clientHeight, n?.drawImage(e, 0, 0, t.width, t.height), ni(t.toDataURL());
3150
3172
  }
3151
3173
  let n = e.poster;
3152
- return Xr(await hi(n, ci(n), t));
3174
+ return ni(await xi(n, mi(n), t));
3153
3175
  }
3154
- async function vi(e, t) {
3176
+ async function wi(e, t) {
3155
3177
  try {
3156
- if (e?.contentDocument?.body) return await Oi(e.contentDocument.body, t, !0);
3178
+ if (e?.contentDocument?.body) return await Pi(e.contentDocument.body, t, !0);
3157
3179
  } catch {}
3158
3180
  return e.cloneNode(!1);
3159
3181
  }
3160
- async function yi(e, t) {
3161
- return Z(e, HTMLCanvasElement) ? gi(e) : Z(e, HTMLVideoElement) ? _i(e, t) : Z(e, HTMLIFrameElement) ? vi(e, t) : e.cloneNode(xi(e));
3182
+ async function Ti(e, t) {
3183
+ return Z(e, HTMLCanvasElement) ? Si(e) : Z(e, HTMLVideoElement) ? Ci(e, t) : Z(e, HTMLIFrameElement) ? wi(e, t) : e.cloneNode(Di(e));
3162
3184
  }
3163
- var bi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", xi = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
3164
- async function Si(e, t, n) {
3165
- if (xi(t)) return t;
3185
+ var Ei = (e) => e.tagName != null && e.tagName.toUpperCase() === "SLOT", Di = (e) => e.tagName != null && e.tagName.toUpperCase() === "SVG";
3186
+ async function Oi(e, t, n) {
3187
+ if (Di(t)) return t;
3166
3188
  let r = [];
3167
- return r = bi(e) && e.assignedNodes ? Y(e.assignedNodes()) : Z(e, HTMLIFrameElement) && e.contentDocument?.body ? Y(e.contentDocument.body.childNodes) : Y((e.shadowRoot ?? e).childNodes), r.length === 0 || Z(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => Oi(r, n)).then((e) => {
3189
+ return r = Ei(e) && e.assignedNodes ? Y(e.assignedNodes()) : Z(e, HTMLIFrameElement) && e.contentDocument?.body ? Y(e.contentDocument.body.childNodes) : Y((e.shadowRoot ?? e).childNodes), r.length === 0 || Z(e, HTMLVideoElement) || await r.reduce((e, r) => e.then(() => Pi(r, n)).then((e) => {
3168
3190
  e && t.appendChild(e);
3169
3191
  }), Promise.resolve()), t;
3170
3192
  }
3171
- function Ci(e, t, n) {
3193
+ function ki(e, t, n) {
3172
3194
  let r = t.style;
3173
3195
  if (!r) return;
3174
3196
  let i = window.getComputedStyle(e);
3175
- i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : Ur(n).forEach((n) => {
3197
+ i.cssText ? (r.cssText = i.cssText, r.transformOrigin = i.transformOrigin) : Yr(n).forEach((n) => {
3176
3198
  let a = i.getPropertyValue(n);
3177
3199
  n === "font-size" && a.endsWith("px") && (a = `${Math.floor(parseFloat(a.substring(0, a.length - 2))) - .1}px`), Z(e, HTMLIFrameElement) && n === "display" && a === "inline" && (a = "block"), n === "d" && t.getAttribute("d") && (a = `path(${t.getAttribute("d")})`), r.setProperty(n, a, i.getPropertyPriority(n));
3178
3200
  });
3179
3201
  }
3180
- function wi(e, t) {
3202
+ function Ai(e, t) {
3181
3203
  Z(e, HTMLTextAreaElement) && (t.innerHTML = e.value), Z(e, HTMLInputElement) && t.setAttribute("value", e.value);
3182
3204
  }
3183
- function Ti(e, t) {
3205
+ function ji(e, t) {
3184
3206
  if (Z(e, HTMLSelectElement)) {
3185
3207
  let n = t, r = Array.from(n.children).find((t) => e.value === t.getAttribute("value"));
3186
3208
  r && r.setAttribute("selected", "");
3187
3209
  }
3188
3210
  }
3189
- function Ei(e, t, n) {
3190
- return Z(t, Element) && (Ci(e, t, n), ri(e, t, n), wi(e, t), Ti(e, t)), t;
3211
+ function Mi(e, t, n) {
3212
+ return Z(t, Element) && (ki(e, t, n), li(e, t, n), Ai(e, t), ji(e, t)), t;
3191
3213
  }
3192
- async function Di(e, t) {
3214
+ async function Ni(e, t) {
3193
3215
  let n = e.querySelectorAll ? e.querySelectorAll("use") : [];
3194
3216
  if (n.length === 0) return e;
3195
3217
  let r = {};
@@ -3197,7 +3219,7 @@ async function Di(e, t) {
3197
3219
  let a = n[i].getAttribute("xlink:href");
3198
3220
  if (a) {
3199
3221
  let n = e.querySelector(a), i = document.querySelector(a);
3200
- !n && i && !r[a] && (r[a] = await Oi(i, t, !0));
3222
+ !n && i && !r[a] && (r[a] = await Pi(i, t, !0));
3201
3223
  }
3202
3224
  }
3203
3225
  let i = Object.values(r);
@@ -3211,61 +3233,61 @@ async function Di(e, t) {
3211
3233
  }
3212
3234
  return e;
3213
3235
  }
3214
- async function Oi(e, t, n) {
3215
- return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => yi(e, t)).then((n) => Si(e, n, t)).then((n) => Ei(e, n, t)).then((e) => Di(e, t));
3236
+ async function Pi(e, t, n) {
3237
+ return !n && t.filter && !t.filter(e) ? null : Promise.resolve(e).then((e) => Ti(e, t)).then((n) => Oi(e, n, t)).then((n) => Mi(e, n, t)).then((e) => Ni(e, t));
3216
3238
  }
3217
3239
  //#endregion
3218
3240
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-resources.js
3219
- var ki = /url\((['"]?)([^'"]+?)\1\)/g, Ai = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, ji = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
3220
- function Mi(e) {
3241
+ var Fi = /url\((['"]?)([^'"]+?)\1\)/g, Ii = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, Li = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
3242
+ function Ri(e) {
3221
3243
  let t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
3222
3244
  return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
3223
3245
  }
3224
- function Ni(e) {
3246
+ function zi(e) {
3225
3247
  let t = [];
3226
- return e.replace(ki, (e, n, r) => (t.push(r), e)), t.filter((e) => !ui(e));
3248
+ return e.replace(Fi, (e, n, r) => (t.push(r), e)), t.filter((e) => !gi(e));
3227
3249
  }
3228
- async function Pi(e, t, n, r, i) {
3250
+ async function Bi(e, t, n, r, i) {
3229
3251
  try {
3230
- let a = n ? Br(t, n) : t, o = ci(t), s;
3231
- return s = i ? di(await i(a), o) : await hi(a, o, r), e.replace(Mi(t), `$1${s}$3`);
3252
+ let a = n ? Kr(t, n) : t, o = mi(t), s;
3253
+ return s = i ? _i(await i(a), o) : await xi(a, o, r), e.replace(Ri(t), `$1${s}$3`);
3232
3254
  } catch {}
3233
3255
  return e;
3234
3256
  }
3235
- function Fi(e, { preferredFontFormat: t }) {
3236
- return t ? e.replace(ji, (e) => {
3257
+ function Vi(e, { preferredFontFormat: t }) {
3258
+ return t ? e.replace(Li, (e) => {
3237
3259
  for (;;) {
3238
- let [n, , r] = Ai.exec(e) || [];
3260
+ let [n, , r] = Ii.exec(e) || [];
3239
3261
  if (!r) return "";
3240
3262
  if (r === t) return `src: ${n};`;
3241
3263
  }
3242
3264
  }) : e;
3243
3265
  }
3244
- function Ii(e) {
3245
- return e.search(ki) !== -1;
3266
+ function Hi(e) {
3267
+ return e.search(Fi) !== -1;
3246
3268
  }
3247
- async function Li(e, t, n) {
3248
- if (!Ii(e)) return e;
3249
- let r = Fi(e, n);
3250
- return Ni(r).reduce((e, r) => e.then((e) => Pi(e, r, t, n)), Promise.resolve(r));
3269
+ async function Ui(e, t, n) {
3270
+ if (!Hi(e)) return e;
3271
+ let r = Vi(e, n);
3272
+ return zi(r).reduce((e, r) => e.then((e) => Bi(e, r, t, n)), Promise.resolve(r));
3251
3273
  }
3252
3274
  //#endregion
3253
3275
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-images.js
3254
- async function Ri(e, t, n) {
3276
+ async function Wi(e, t, n) {
3255
3277
  let r = t.style?.getPropertyValue(e);
3256
3278
  if (r) {
3257
- let i = await Li(r, null, n);
3279
+ let i = await Ui(r, null, n);
3258
3280
  return t.style.setProperty(e, i, t.style.getPropertyPriority(e)), !0;
3259
3281
  }
3260
3282
  return !1;
3261
3283
  }
3262
- async function zi(e, t) {
3263
- await Ri("background", e, t) || await Ri("background-image", e, t), await Ri("mask", e, t) || await Ri("-webkit-mask", e, t) || await Ri("mask-image", e, t) || await Ri("-webkit-mask-image", e, t);
3284
+ async function Gi(e, t) {
3285
+ await Wi("background", e, t) || await Wi("background-image", e, t), await Wi("mask", e, t) || await Wi("-webkit-mask", e, t) || await Wi("mask-image", e, t) || await Wi("-webkit-mask-image", e, t);
3264
3286
  }
3265
- async function Bi(e, t) {
3287
+ async function Ki(e, t) {
3266
3288
  let n = Z(e, HTMLImageElement);
3267
- if (!(n && !ui(e.src)) && !(Z(e, SVGImageElement) && !ui(e.href.baseVal))) return;
3268
- let r = n ? e.src : e.href.baseVal, i = await hi(r, ci(r), t);
3289
+ if (!(n && !gi(e.src)) && !(Z(e, SVGImageElement) && !gi(e.href.baseVal))) return;
3290
+ let r = n ? e.src : e.href.baseVal, i = await xi(r, mi(r), t);
3269
3291
  await new Promise((r, a) => {
3270
3292
  e.onload = r, e.onerror = t.onImageErrorHandler ? (...e) => {
3271
3293
  try {
@@ -3278,16 +3300,16 @@ async function Bi(e, t) {
3278
3300
  o.decode &&= r, o.loading === "lazy" && (o.loading = "eager"), n ? (e.srcset = "", e.src = i) : e.href.baseVal = i;
3279
3301
  });
3280
3302
  }
3281
- async function Vi(e, t) {
3282
- let n = Y(e.childNodes).map((e) => Hi(e, t));
3303
+ async function qi(e, t) {
3304
+ let n = Y(e.childNodes).map((e) => Ji(e, t));
3283
3305
  await Promise.all(n).then(() => e);
3284
3306
  }
3285
- async function Hi(e, t) {
3286
- Z(e, Element) && (await zi(e, t), await Bi(e, t), await Vi(e, t));
3307
+ async function Ji(e, t) {
3308
+ Z(e, Element) && (await Gi(e, t), await Ki(e, t), await qi(e, t));
3287
3309
  }
3288
3310
  //#endregion
3289
3311
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/apply-style.js
3290
- function Ui(e, t) {
3312
+ function Yi(e, t) {
3291
3313
  let { style: n } = e;
3292
3314
  t.backgroundColor && (n.backgroundColor = t.backgroundColor), t.width && (n.width = `${t.width}px`), t.height && (n.height = `${t.height}px`);
3293
3315
  let r = t.style;
@@ -3297,22 +3319,22 @@ function Ui(e, t) {
3297
3319
  }
3298
3320
  //#endregion
3299
3321
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/embed-webfonts.js
3300
- var Wi = {};
3301
- async function Gi(e) {
3302
- let t = Wi[e];
3322
+ var Xi = {};
3323
+ async function Zi(e) {
3324
+ let t = Xi[e];
3303
3325
  return t ?? (t = {
3304
3326
  url: e,
3305
3327
  cssText: await (await fetch(e)).text()
3306
- }, Wi[e] = t, t);
3328
+ }, Xi[e] = t, t);
3307
3329
  }
3308
- async function Ki(e, t) {
3330
+ async function Qi(e, t) {
3309
3331
  let n = e.cssText, r = /url\(["']?([^"')]+)["']?\)/g, i = (n.match(/url\([^)]+\)/g) || []).map(async (i) => {
3310
3332
  let a = i.replace(r, "$1");
3311
- return a.startsWith("https://") || (a = new URL(a, e.url).href), fi(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
3333
+ return a.startsWith("https://") || (a = new URL(a, e.url).href), vi(a, t.fetchRequestInit, ({ result: e }) => (n = n.replace(i, `url(${e})`), [i, e]));
3312
3334
  });
3313
3335
  return Promise.all(i).then(() => n);
3314
3336
  }
3315
- function qi(e) {
3337
+ function $i(e) {
3316
3338
  if (e == null) return [];
3317
3339
  let t = [], n = e.replace(/(\/\*[\s\S]*?\*\/)/gi, ""), r = /* @__PURE__ */ RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
3318
3340
  for (;;) {
@@ -3332,13 +3354,13 @@ function qi(e) {
3332
3354
  }
3333
3355
  return t;
3334
3356
  }
3335
- async function Ji(e, t) {
3357
+ async function ea(e, t) {
3336
3358
  let n = [], r = [];
3337
3359
  return e.forEach((n) => {
3338
3360
  if ("cssRules" in n) try {
3339
3361
  Y(n.cssRules || []).forEach((e, i) => {
3340
3362
  if (e.type === CSSRule.IMPORT_RULE) {
3341
- let a = i + 1, o = e.href, s = Gi(o).then((e) => Ki(e, t)).then((e) => qi(e).forEach((e) => {
3363
+ let a = i + 1, o = e.href, s = Zi(o).then((e) => Qi(e, t)).then((e) => $i(e).forEach((e) => {
3342
3364
  try {
3343
3365
  n.insertRule(e, e.startsWith("@import") ? a += 1 : n.cssRules.length);
3344
3366
  } catch (t) {
@@ -3355,7 +3377,7 @@ async function Ji(e, t) {
3355
3377
  });
3356
3378
  } catch (i) {
3357
3379
  let a = e.find((e) => e.href == null) || document.styleSheets[0];
3358
- n.href != null && r.push(Gi(n.href).then((e) => Ki(e, t)).then((e) => qi(e).forEach((e) => {
3380
+ n.href != null && r.push(Zi(n.href).then((e) => Qi(e, t)).then((e) => $i(e).forEach((e) => {
3359
3381
  a.insertRule(e, a.cssRules.length);
3360
3382
  })).catch((e) => {
3361
3383
  console.error("Error loading remote stylesheet", e);
@@ -3371,36 +3393,36 @@ async function Ji(e, t) {
3371
3393
  }
3372
3394
  }), n));
3373
3395
  }
3374
- function Yi(e) {
3375
- return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Ii(e.style.getPropertyValue("src")));
3396
+ function ta(e) {
3397
+ return e.filter((e) => e.type === CSSRule.FONT_FACE_RULE).filter((e) => Hi(e.style.getPropertyValue("src")));
3376
3398
  }
3377
- async function Xi(e, t) {
3399
+ async function na(e, t) {
3378
3400
  if (e.ownerDocument == null) throw Error("Provided element is not within a Document");
3379
- return Yi(await Ji(Y(e.ownerDocument.styleSheets), t));
3401
+ return ta(await ea(Y(e.ownerDocument.styleSheets), t));
3380
3402
  }
3381
- function Zi(e) {
3403
+ function ra(e) {
3382
3404
  return e.trim().replace(/["']/g, "");
3383
3405
  }
3384
- function Qi(e) {
3406
+ function ia(e) {
3385
3407
  let t = /* @__PURE__ */ new Set();
3386
3408
  function n(e) {
3387
3409
  (e.style.fontFamily || getComputedStyle(e).fontFamily).split(",").forEach((e) => {
3388
- t.add(Zi(e));
3410
+ t.add(ra(e));
3389
3411
  }), Array.from(e.children).forEach((e) => {
3390
3412
  e instanceof HTMLElement && n(e);
3391
3413
  });
3392
3414
  }
3393
3415
  return n(e), t;
3394
3416
  }
3395
- async function $i(e, t) {
3396
- let n = await Xi(e, t), r = Qi(e);
3397
- return (await Promise.all(n.filter((e) => r.has(Zi(e.style.fontFamily))).map((e) => {
3417
+ async function aa(e, t) {
3418
+ let n = await na(e, t), r = ia(e);
3419
+ return (await Promise.all(n.filter((e) => r.has(ra(e.style.fontFamily))).map((e) => {
3398
3420
  let n = e.parentStyleSheet ? e.parentStyleSheet.href : null;
3399
- return Li(e.cssText, n, t);
3421
+ return Ui(e.cssText, n, t);
3400
3422
  }))).join("\n");
3401
3423
  }
3402
- async function ea(e, t) {
3403
- let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await $i(e, t) : t.fontEmbedCSS;
3424
+ async function oa(e, t) {
3425
+ let n = t.fontEmbedCSS == null ? t.skipFonts ? null : await aa(e, t) : t.fontEmbedCSS;
3404
3426
  if (n) {
3405
3427
  let t = document.createElement("style"), r = document.createTextNode(n);
3406
3428
  t.appendChild(r), e.firstChild ? e.insertBefore(t, e.firstChild) : e.appendChild(t);
@@ -3408,23 +3430,23 @@ async function ea(e, t) {
3408
3430
  }
3409
3431
  //#endregion
3410
3432
  //#region ../../node_modules/.pnpm/html-to-image@1.11.13/node_modules/html-to-image/es/index.js
3411
- async function ta(e, t = {}) {
3412
- let { width: n, height: r } = qr(e, t), i = await Oi(e, t, !0);
3413
- return await ea(i, t), await Hi(i, t), Ui(i, t), await Qr(i, n, r);
3433
+ async function sa(e, t = {}) {
3434
+ let { width: n, height: r } = $r(e, t), i = await Pi(e, t, !0);
3435
+ return await oa(i, t), await Ji(i, t), Yi(i, t), await ii(i, n, r);
3414
3436
  }
3415
- async function na(e, t = {}) {
3416
- let { width: n, height: r } = qr(e, t), i = await Xr(await ta(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || Jr(), c = t.canvasWidth || n, l = t.canvasHeight || r;
3417
- return a.width = c * s, a.height = l * s, t.skipAutoScale || Yr(a), a.style.width = `${c}`, a.style.height = `${l}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(i, 0, 0, a.width, a.height), a;
3437
+ async function ca(e, t = {}) {
3438
+ let { width: n, height: r } = $r(e, t), i = await ni(await sa(e, t)), a = document.createElement("canvas"), o = a.getContext("2d"), s = t.pixelRatio || ei(), c = t.canvasWidth || n, l = t.canvasHeight || r;
3439
+ return a.width = c * s, a.height = l * s, t.skipAutoScale || ti(a), a.style.width = `${c}`, a.style.height = `${l}`, t.backgroundColor && (o.fillStyle = t.backgroundColor, o.fillRect(0, 0, a.width, a.height)), o.drawImage(i, 0, 0, a.width, a.height), a;
3418
3440
  }
3419
3441
  //#endregion
3420
3442
  //#region src/runtime/screenshot.ts
3421
- var ra = 2 * 1024 * 1024;
3422
- async function ia(e, t) {
3443
+ var la = 2 * 1024 * 1024;
3444
+ async function ua(e, t) {
3423
3445
  try {
3424
3446
  function n(t) {
3425
3447
  return !(e && (t === e || e.contains(t)));
3426
3448
  }
3427
- let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = await na(document.documentElement, {
3449
+ let r = window.innerWidth, i = window.innerHeight, a = Math.min(window.devicePixelRatio, 2), o = await ca(document.documentElement, {
3428
3450
  width: r,
3429
3451
  height: i,
3430
3452
  cacheBust: !0,
@@ -3438,21 +3460,21 @@ async function ia(e, t) {
3438
3460
  });
3439
3461
  if (t) {
3440
3462
  let e = o.getContext("2d");
3441
- e && oa(e, t.x, t.y, a);
3463
+ e && fa(e, t.x, t.y, a);
3442
3464
  }
3443
- let s = await aa(o, .85);
3465
+ let s = await da(o, .85);
3444
3466
  if (!s) return null;
3445
- if (s.size <= ra) return s;
3446
- let c = await aa(o, .5);
3447
- return !c || c.size > ra ? null : c;
3467
+ if (s.size <= la) return s;
3468
+ let c = await da(o, .5);
3469
+ return !c || c.size > la ? null : c;
3448
3470
  } catch {
3449
3471
  return null;
3450
3472
  }
3451
3473
  }
3452
- function aa(e, t) {
3474
+ function da(e, t) {
3453
3475
  return new Promise((n) => e.toBlob(n, "image/jpeg", t));
3454
3476
  }
3455
- function oa(e, t, n, r) {
3477
+ function fa(e, t, n, r) {
3456
3478
  let i = r, a = 28 * i, o = a / 2, s = t * i, c = n * i;
3457
3479
  e.save();
3458
3480
  let l = 2 * i;
@@ -3475,7 +3497,7 @@ function Q(...e) {
3475
3497
  }
3476
3498
  //#endregion
3477
3499
  //#region src/runtime/use-drag.ts
3478
- function sa(e) {
3500
+ function pa(e) {
3479
3501
  let t = z(e);
3480
3502
  t.current = e;
3481
3503
  let [n, r] = L(!1), i = z(!1);
@@ -3504,8 +3526,8 @@ function sa(e) {
3504
3526
  g = !0, i.current = !0, r(!0), t.current.onStart?.();
3505
3527
  }
3506
3528
  let o = Math.max(m, window.innerWidth - d - m), v = Math.max(m, window.innerHeight - f - m), y = {
3507
- left: ca(l + n, m, o),
3508
- top: ca(u + a, m, v)
3529
+ left: ma(l + n, m, o),
3530
+ top: ma(u + a, m, v)
3509
3531
  };
3510
3532
  _ = y, t.current.onMove(y);
3511
3533
  }
@@ -3521,12 +3543,12 @@ function sa(e) {
3521
3543
  consumeClickIfDragged: B(() => i.current ? (i.current = !1, !0) : !1, [])
3522
3544
  };
3523
3545
  }
3524
- function ca(e, t, n) {
3546
+ function ma(e, t, n) {
3525
3547
  return Math.max(t, Math.min(n, e));
3526
3548
  }
3527
3549
  //#endregion
3528
3550
  //#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
3529
- var la = 0;
3551
+ var ha = 0;
3530
3552
  Array.isArray;
3531
3553
  function $(e, n, r, i, a, o) {
3532
3554
  n ||= {};
@@ -3543,7 +3565,7 @@ function $(e, n, r, i, a, o) {
3543
3565
  __e: null,
3544
3566
  __c: null,
3545
3567
  constructor: void 0,
3546
- __v: --la,
3568
+ __v: --ha,
3547
3569
  __i: -1,
3548
3570
  __u: 0,
3549
3571
  __source: a,
@@ -3554,7 +3576,7 @@ function $(e, n, r, i, a, o) {
3554
3576
  }
3555
3577
  //#endregion
3556
3578
  //#region src/runtime/ui/icons.tsx
3557
- function ua({ size: e = 16 }) {
3579
+ function ga({ size: e = 16 }) {
3558
3580
  return /* @__PURE__ */ $("svg", {
3559
3581
  width: e,
3560
3582
  height: e,
@@ -3564,7 +3586,7 @@ function ua({ size: e = 16 }) {
3564
3586
  children: /* @__PURE__ */ $("path", { d: "M63.4561 0.00557731C70.6277 -0.0175584 76.9025 1.04088 83.5898 3.71066C97.7952 9.43043 109.186 20.5001 115.311 34.5359C119.708 44.8002 120.746 54.7869 119.156 65.8171C116.857 82.7956 105.129 98.8382 90.0566 106.846C83.4394 110.362 74.7336 113.029 67.2051 113.271C62.4204 113.425 61.1274 113.32 56.6807 115.204C50.2035 117.858 43.6874 120.417 37.1348 122.879C34.8442 123.763 32.3203 124.902 29.9404 125.51C29.4023 125.648 28.1978 125.009 27.7598 124.646C26.9046 123.951 27.0582 122.505 27.0264 121.484C26.8123 114.646 27.3302 107.458 26.8604 100.656C25.1578 98.6714 22.4026 96.603 20.3086 94.1989C12.1853 84.8731 7.05334 73.9949 6.18164 61.6101C4.95583 46.292 9.97176 31.1285 20.0908 19.5632C29.989 8.13202 44.0369 1.11921 59.1221 0.0788195C60.2694 -0.0356049 62.2637 0.00944821 63.4561 0.00557731ZM92.2676 55.7497C91.5754 39.5314 77.8207 26.9725 61.6064 27.7536C45.5175 28.5287 33.0758 42.1537 33.7627 58.2468C34.4496 74.3398 48.007 86.8553 64.1035 86.2566C80.3254 85.6533 92.9599 71.968 92.2676 55.7497Z" })
3565
3587
  });
3566
3588
  }
3567
- function da({ size: e = 16 }) {
3589
+ function _a({ size: e = 16 }) {
3568
3590
  return /* @__PURE__ */ $("svg", {
3569
3591
  width: e,
3570
3592
  height: e,
@@ -3573,7 +3595,7 @@ function da({ size: e = 16 }) {
3573
3595
  children: /* @__PURE__ */ $("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" })
3574
3596
  });
3575
3597
  }
3576
- function fa({ size: e = 16 }) {
3598
+ function va({ size: e = 16 }) {
3577
3599
  return /* @__PURE__ */ $("svg", {
3578
3600
  width: e,
3579
3601
  height: e,
@@ -3582,7 +3604,7 @@ function fa({ size: e = 16 }) {
3582
3604
  children: /* @__PURE__ */ $("path", { d: "M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" })
3583
3605
  });
3584
3606
  }
3585
- function pa({ size: e = 16 }) {
3607
+ function ya({ size: e = 16 }) {
3586
3608
  return /* @__PURE__ */ $("svg", {
3587
3609
  width: e,
3588
3610
  height: e,
@@ -3595,7 +3617,7 @@ function pa({ size: e = 16 }) {
3595
3617
  })
3596
3618
  });
3597
3619
  }
3598
- function ma({ size: e = 16 }) {
3620
+ function ba({ size: e = 16 }) {
3599
3621
  return /* @__PURE__ */ $("svg", {
3600
3622
  width: e,
3601
3623
  height: e,
@@ -3609,7 +3631,7 @@ function ma({ size: e = 16 }) {
3609
3631
  })
3610
3632
  });
3611
3633
  }
3612
- function ha({ size: e = 16 }) {
3634
+ function xa({ size: e = 16 }) {
3613
3635
  return /* @__PURE__ */ $("svg", {
3614
3636
  width: e,
3615
3637
  height: e,
@@ -3618,7 +3640,7 @@ function ha({ size: e = 16 }) {
3618
3640
  children: /* @__PURE__ */ $("path", { d: "M2.87 2.298a.75.75 0 0 0-.812 1.021L3.39 6.624a1 1 0 0 0 .928.626H8.25a.75.75 0 0 1 0 1.5H4.318a1 1 0 0 0-.927.626l-1.333 3.305a.75.75 0 0 0 .811 1.022 24.89 24.89 0 0 0 11.668-5.115.75.75 0 0 0 0-1.175A24.89 24.89 0 0 0 2.869 2.298Z" })
3619
3641
  });
3620
3642
  }
3621
- function ga({ size: e = 16 }) {
3643
+ function Sa({ size: e = 16 }) {
3622
3644
  return /* @__PURE__ */ $("svg", {
3623
3645
  width: e,
3624
3646
  height: e,
@@ -3630,8 +3652,8 @@ function ga({ size: e = 16 }) {
3630
3652
  }
3631
3653
  //#endregion
3632
3654
  //#region src/runtime/ui/fab.tsx
3633
- function _a({ active: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i, variant: a = "default" }) {
3634
- let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : "markup-fab-right", [c, l] = L(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } = sa({
3655
+ function Ca({ active: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i, variant: a = "default" }) {
3656
+ let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : "markup-fab-right", [c, l] = L(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } = pa({
3635
3657
  preventDefault: !0,
3636
3658
  stopPropagation: !0,
3637
3659
  onMove: l,
@@ -3663,7 +3685,7 @@ function _a({ active: e, onToggle: t, onHide: n, position: r = "bottom-right", o
3663
3685
  "aria-pressed": e,
3664
3686
  children: [/* @__PURE__ */ $("span", {
3665
3687
  class: "markup-fab-icon",
3666
- children: $(e ? da : ua, { size: 16 })
3688
+ children: $(e ? _a : ga, { size: 16 })
3667
3689
  }), o ? null : /* @__PURE__ */ $("span", {
3668
3690
  class: "markup-fab-label",
3669
3691
  children: e ? "Cancel" : "Markup"
@@ -3672,7 +3694,7 @@ function _a({ active: e, onToggle: t, onHide: n, position: r = "bottom-right", o
3672
3694
  }
3673
3695
  //#endregion
3674
3696
  //#region src/runtime/use-focus-trap.ts
3675
- var va = [
3697
+ var wa = [
3676
3698
  "a[href]",
3677
3699
  "button:not([disabled])",
3678
3700
  "input:not([disabled])",
@@ -3680,14 +3702,14 @@ var va = [
3680
3702
  "textarea:not([disabled])",
3681
3703
  "[tabindex]:not([tabindex=\"-1\"])"
3682
3704
  ].join(",");
3683
- function ya(e, t) {
3705
+ function Ta(e, t) {
3684
3706
  R(() => {
3685
3707
  if (!t) return;
3686
3708
  let n = e.current;
3687
3709
  if (!n) return;
3688
3710
  function r(e) {
3689
3711
  if (e.key !== "Tab") return;
3690
- let t = Array.from(n.querySelectorAll(va)), r = t[0], i = t[t.length - 1];
3712
+ let t = Array.from(n.querySelectorAll(wa)), r = t[0], i = t[t.length - 1];
3691
3713
  if (!r || !i) return;
3692
3714
  let a = n.getRootNode(), o = a instanceof ShadowRoot ? a.activeElement : document.activeElement;
3693
3715
  (e.shiftKey ? o === r : o === i) && (e.preventDefault(), (e.shiftKey ? i : r).focus());
@@ -3697,7 +3719,7 @@ function ya(e, t) {
3697
3719
  }
3698
3720
  //#endregion
3699
3721
  //#region src/runtime/use-object-url.ts
3700
- function ba(e) {
3722
+ function Ea(e) {
3701
3723
  let [t, n] = L(null);
3702
3724
  return R(() => {
3703
3725
  if (!e) {
@@ -3710,7 +3732,7 @@ function ba(e) {
3710
3732
  }
3711
3733
  //#endregion
3712
3734
  //#region src/runtime/ui/author-prompt.tsx
3713
- function xa({ pending: e, connecting: t = !1, signingIn: n = !1, onSubmit: r, onCancel: i, onSignIn: a }) {
3735
+ function Da({ pending: e, connecting: t = !1, signingIn: n = !1, onSubmit: r, onCancel: i, onSignIn: a }) {
3714
3736
  let [o, s] = L(""), [c, l] = L(""), u = z(null);
3715
3737
  R(() => {
3716
3738
  u.current?.focus();
@@ -3789,8 +3811,8 @@ function xa({ pending: e, connecting: t = !1, signingIn: n = !1, onSubmit: r, on
3789
3811
  }
3790
3812
  //#endregion
3791
3813
  //#region src/runtime/ui/composer.tsx
3792
- var Sa = 4e3;
3793
- function Ca({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, pending: i, error: a, onSubmit: o }) {
3814
+ var Oa = 4e3;
3815
+ function ka({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, pending: i, error: a, onSubmit: o }) {
3794
3816
  let [s, c] = L(""), l = z(null), u = z(!1);
3795
3817
  R(() => {
3796
3818
  r && l.current?.focus();
@@ -3800,7 +3822,7 @@ function Ca({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
3800
3822
  }, [s]), R(() => {
3801
3823
  u.current && !i && !a && (c(""), l.current?.focus()), u.current = i;
3802
3824
  }, [i, a]);
3803
- let d = Sa - s.length, f = d < 0;
3825
+ let d = Oa - s.length, f = d < 0;
3804
3826
  function p(e) {
3805
3827
  e?.preventDefault();
3806
3828
  let t = s.trim();
@@ -3818,7 +3840,7 @@ function Ca({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
3818
3840
  "aria-label": i ? "Sending…" : n,
3819
3841
  title: i ? "Sending…" : n,
3820
3842
  tabIndex: e,
3821
- children: /* @__PURE__ */ $(ha, { size: 14 })
3843
+ children: /* @__PURE__ */ $(xa, { size: 14 })
3822
3844
  });
3823
3845
  }
3824
3846
  return /* @__PURE__ */ $("form", {
@@ -3831,7 +3853,7 @@ function Ca({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
3831
3853
  class: "markup-composer-input",
3832
3854
  placeholder: t,
3833
3855
  rows: h ? 2 : 1,
3834
- maxLength: Sa + 100,
3856
+ maxLength: Oa + 100,
3835
3857
  value: s,
3836
3858
  onInput: (e) => c(e.currentTarget.value),
3837
3859
  onKeyDown: m,
@@ -3867,10 +3889,10 @@ function Ca({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
3867
3889
  }
3868
3890
  //#endregion
3869
3891
  //#region src/runtime/ui/new-thread-popover.tsx
3870
- function wa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolving: i, signingIn: a, pending: o, error: s, screenshot: c, screenshotCapturing: l, onAuthor: u, onSignIn: d, onSubmit: f, onClose: p }) {
3892
+ function Aa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolving: i, signingIn: a, pending: o, error: s, screenshot: c, screenshotCapturing: l, onAuthor: u, onSignIn: d, onSubmit: f, onClose: p }) {
3871
3893
  let m = z(null);
3872
- ya(m, !0);
3873
- let [h, g] = L(!1), _ = ba(c), [v, y] = L(null), { onPointerDown: b, isDragging: x } = sa({
3894
+ Ta(m, !0);
3895
+ let [h, g] = L(!1), _ = Ea(c), [v, y] = L(null), { onPointerDown: b, isDragging: x } = pa({
3874
3896
  targetRef: m,
3875
3897
  shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
3876
3898
  onMove: y
@@ -3886,7 +3908,7 @@ function wa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolvin
3886
3908
  }
3887
3909
  return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
3888
3910
  }, [p]);
3889
- let S = Ta(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), C = Ta(t - window.scrollY - 16, 12, window.innerHeight - 220), w = c != null, T = l || w;
3911
+ let S = ja(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), C = ja(t - window.scrollY - 16, 12, window.innerHeight - 220), w = c != null, T = l || w;
3890
3912
  return /* @__PURE__ */ $("div", {
3891
3913
  ref: m,
3892
3914
  class: Q("markup-popover", v && "is-floating", x && "is-dragging"),
@@ -3908,9 +3930,9 @@ function wa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolvin
3908
3930
  class: "markup-icon-btn",
3909
3931
  "aria-label": "Discard pin",
3910
3932
  onClick: p,
3911
- children: /* @__PURE__ */ $(da, { size: 16 })
3933
+ children: /* @__PURE__ */ $(_a, { size: 16 })
3912
3934
  })]
3913
- }), n == null ? /* @__PURE__ */ $(xa, {
3935
+ }), n == null ? /* @__PURE__ */ $(Da, {
3914
3936
  pending: o,
3915
3937
  connecting: i,
3916
3938
  signingIn: a,
@@ -3934,7 +3956,7 @@ function wa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolvin
3934
3956
  }) : null
3935
3957
  ]
3936
3958
  }),
3937
- /* @__PURE__ */ $(Ca, {
3959
+ /* @__PURE__ */ $(ka, {
3938
3960
  label: "Feedback",
3939
3961
  placeholder: "What's wrong, missing, or worth noting?",
3940
3962
  submitLabel: "Post markup",
@@ -3952,7 +3974,7 @@ function wa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolvin
3952
3974
  class: "markup-screenshot-checkbox",
3953
3975
  disabled: !0
3954
3976
  }),
3955
- /* @__PURE__ */ $(ma, { size: 12 }),
3977
+ /* @__PURE__ */ $(ba, { size: 12 }),
3956
3978
  /* @__PURE__ */ $("span", { children: "Capturing…" })
3957
3979
  ]
3958
3980
  }) : /* @__PURE__ */ $("label", {
@@ -3964,7 +3986,7 @@ function wa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolvin
3964
3986
  checked: h,
3965
3987
  onChange: (e) => g(e.currentTarget.checked)
3966
3988
  }),
3967
- /* @__PURE__ */ $(ma, { size: 12 }),
3989
+ /* @__PURE__ */ $(ba, { size: 12 }),
3968
3990
  /* @__PURE__ */ $("span", { children: "Attach screenshot" }),
3969
3991
  _ && h ? /* @__PURE__ */ $("img", {
3970
3992
  class: "markup-screenshot-thumb",
@@ -3978,12 +4000,12 @@ function wa({ pageX: e, pageY: t, authorName: n, isVerified: r, identityResolvin
3978
4000
  })]
3979
4001
  });
3980
4002
  }
3981
- function Ta(e, t, n) {
4003
+ function ja(e, t, n) {
3982
4004
  return Math.max(t, Math.min(n, e));
3983
4005
  }
3984
4006
  //#endregion
3985
4007
  //#region src/runtime/ui/pin.tsx
3986
- function Ea({ pageX: e, pageY: t, count: n, active: r, onClick: i }) {
4008
+ function Ma({ pageX: e, pageY: t, count: n, active: r, onClick: i }) {
3987
4009
  let a = t - window.scrollY, o = e - window.scrollX;
3988
4010
  return /* @__PURE__ */ $("button", {
3989
4011
  type: "button",
@@ -4006,7 +4028,7 @@ function Ea({ pageX: e, pageY: t, count: n, active: r, onClick: i }) {
4006
4028
  }) : null]
4007
4029
  });
4008
4030
  }
4009
- function Da({ pageX: e, pageY: t }) {
4031
+ function Na({ pageX: e, pageY: t }) {
4010
4032
  let n = t - window.scrollY, r = e - window.scrollX;
4011
4033
  return /* @__PURE__ */ $("div", {
4012
4034
  class: "markup-pin markup-pin-ghost is-anchor",
@@ -4022,7 +4044,7 @@ function Da({ pageX: e, pageY: t }) {
4022
4044
  }
4023
4045
  //#endregion
4024
4046
  //#region src/runtime/ui/placement-overlay.tsx
4025
- function Oa({ onPlace: e, onCancel: t }) {
4047
+ function Pa({ onPlace: e, onCancel: t }) {
4026
4048
  R(() => {
4027
4049
  function e(e) {
4028
4050
  e.key === "Escape" && t();
@@ -4048,7 +4070,7 @@ function Oa({ onPlace: e, onCancel: t }) {
4048
4070
  }
4049
4071
  //#endregion
4050
4072
  //#region src/runtime/ui/thread-popover.tsx
4051
- var ka = [
4073
+ var Fa = [
4052
4074
  "👍",
4053
4075
  "❤️",
4054
4076
  "🎉",
@@ -4056,13 +4078,13 @@ var ka = [
4056
4078
  "😄",
4057
4079
  "❓"
4058
4080
  ];
4059
- function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, identityResolving: i, signingIn: a, canDelete: o, pending: s, error: c, hidden: l = !1, onAuthor: u, onSignIn: d, onClose: f, onReply: p, onEditComment: m, onDeleteComment: h, onToggleReaction: g, onResolve: _, onDelete: v }) {
4060
- let y = z(null), b = z(null), x = z(null), S = z(null), [C, w] = L({ kind: "none" }), [T, E] = L(null), { onPointerDown: D, isDragging: O } = sa({
4081
+ function Ia({ thread: e, authorName: t, currentClientId: n, isVerified: r, identityResolving: i, signingIn: a, canDelete: o, pending: s, error: c, hidden: l = !1, onAuthor: u, onSignIn: d, onClose: f, onReply: p, onEditComment: m, onDeleteComment: h, onToggleReaction: g, onResolve: _, onDelete: v }) {
4082
+ let y = z(null), b = z(null), x = z(null), S = z(null), [C, w] = L({ kind: "none" }), [T, E] = L(null), { onPointerDown: D, isDragging: O } = pa({
4061
4083
  targetRef: y,
4062
4084
  shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
4063
4085
  onMove: E
4064
4086
  });
4065
- ya(y, !0);
4087
+ Ta(y, !0);
4066
4088
  let k = e.resolvedAt != null, A = we(() => e.comments.filter((e) => !e.deleted), [e.comments]);
4067
4089
  R(() => {
4068
4090
  if (C.kind === "none" || C.kind === "editing") return;
@@ -4104,8 +4126,8 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4104
4126
  anchorSelector: e.anchorSelector
4105
4127
  });
4106
4128
  return {
4107
- left: Pa(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
4108
- top: Pa(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
4129
+ left: Ba(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
4130
+ top: Ba(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
4109
4131
  };
4110
4132
  }, [
4111
4133
  e.anchorX,
@@ -4154,7 +4176,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4154
4176
  confirmDelete: !1
4155
4177
  });
4156
4178
  },
4157
- children: /* @__PURE__ */ $(fa, { size: 16 })
4179
+ children: /* @__PURE__ */ $(va, { size: 16 })
4158
4180
  }), C.kind === "thread-menu" ? /* @__PURE__ */ $("div", {
4159
4181
  class: "markup-thread-menu-list",
4160
4182
  children: [/* @__PURE__ */ $("button", {
@@ -4185,14 +4207,14 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4185
4207
  title: "Mark as resolved",
4186
4208
  disabled: s,
4187
4209
  onClick: _,
4188
- children: /* @__PURE__ */ $(pa, { size: 16 })
4210
+ children: /* @__PURE__ */ $(ya, { size: 16 })
4189
4211
  }) : null,
4190
4212
  /* @__PURE__ */ $("button", {
4191
4213
  type: "button",
4192
4214
  class: "markup-icon-btn",
4193
4215
  title: "Close thread",
4194
4216
  onClick: f,
4195
- children: /* @__PURE__ */ $(da, { size: 16 })
4217
+ children: /* @__PURE__ */ $(_a, { size: 16 })
4196
4218
  })
4197
4219
  ]
4198
4220
  })]
@@ -4219,12 +4241,12 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4219
4241
  /* @__PURE__ */ $("time", {
4220
4242
  class: "markup-comment-time",
4221
4243
  datetime: new Date(t.createdAt).toISOString(),
4222
- title: Ia(t.createdAt),
4223
- children: Fa(t.createdAt)
4244
+ title: Ha(t.createdAt),
4245
+ children: Va(t.createdAt)
4224
4246
  }),
4225
4247
  /* @__PURE__ */ $("div", {
4226
4248
  class: "markup-thread-actions",
4227
- children: [!k && !l ? /* @__PURE__ */ $(ja, {
4249
+ children: [!k && !l ? /* @__PURE__ */ $(La, {
4228
4250
  comment: t,
4229
4251
  pickerOpen: p,
4230
4252
  pickerDirection: _,
@@ -4286,7 +4308,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4286
4308
  confirmDelete: !1
4287
4309
  });
4288
4310
  },
4289
- children: /* @__PURE__ */ $(fa, { size: 16 })
4311
+ children: /* @__PURE__ */ $(va, { size: 16 })
4290
4312
  }), d ? /* @__PURE__ */ $("div", {
4291
4313
  class: "markup-thread-menu-list",
4292
4314
  children: [o ? /* @__PURE__ */ $("button", {
@@ -4362,7 +4384,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4362
4384
  children: [t.body, t.editedAt == null ? null : /* @__PURE__ */ $("time", {
4363
4385
  class: "markup-comment-edited",
4364
4386
  datetime: new Date(t.editedAt).toISOString(),
4365
- title: Ia(t.editedAt),
4387
+ title: Ha(t.editedAt),
4366
4388
  children: [" ", "(edited)"]
4367
4389
  })]
4368
4390
  }),
@@ -4375,7 +4397,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4375
4397
  alt: "Screenshot"
4376
4398
  })
4377
4399
  }) : null,
4378
- !l && t.reactions.length > 0 ? /* @__PURE__ */ $(Ma, {
4400
+ !l && t.reactions.length > 0 ? /* @__PURE__ */ $(Ra, {
4379
4401
  comment: t,
4380
4402
  isResolved: k,
4381
4403
  onToggle: (e) => g(t._id, e)
@@ -4395,7 +4417,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4395
4417
  onClick: (e) => {
4396
4418
  e.stopPropagation(), x.current?.close();
4397
4419
  },
4398
- children: /* @__PURE__ */ $(da, { size: 16 })
4420
+ children: /* @__PURE__ */ $(_a, { size: 16 })
4399
4421
  }), /* @__PURE__ */ $("img", {
4400
4422
  class: "markup-lightbox-img",
4401
4423
  src: e.screenshotUrl,
@@ -4403,7 +4425,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4403
4425
  onClick: (e) => e.stopPropagation()
4404
4426
  })]
4405
4427
  }) : null,
4406
- t == null ? /* @__PURE__ */ $(xa, {
4428
+ t == null ? /* @__PURE__ */ $(Da, {
4407
4429
  pending: s,
4408
4430
  connecting: i,
4409
4431
  signingIn: a,
@@ -4425,7 +4447,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4425
4447
  children: "team"
4426
4448
  }) : null
4427
4449
  ]
4428
- }), /* @__PURE__ */ $(Ca, {
4450
+ }), /* @__PURE__ */ $(ka, {
4429
4451
  label: "Reply",
4430
4452
  placeholder: "Write a reply…",
4431
4453
  submitLabel: "Reply",
@@ -4438,7 +4460,7 @@ function Aa({ thread: e, authorName: t, currentClientId: n, isVerified: r, ident
4438
4460
  ]
4439
4461
  });
4440
4462
  }
4441
- function ja({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pickerRef: i, onPickerClick: a, onPickerSelect: o }) {
4463
+ function La({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pickerRef: i, onPickerClick: a, onPickerSelect: o }) {
4442
4464
  return /* @__PURE__ */ $("div", {
4443
4465
  class: Q("markup-reaction-picker-wrap", t && "is-open", t && n === "up" && "is-up", r && "is-side"),
4444
4466
  ref: i,
@@ -4448,11 +4470,11 @@ function ja({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
4448
4470
  title: "Add reaction",
4449
4471
  "aria-label": "Add reaction",
4450
4472
  onClick: a,
4451
- children: /* @__PURE__ */ $(ga, { size: 16 })
4473
+ children: /* @__PURE__ */ $(Sa, { size: 16 })
4452
4474
  }), t ? /* @__PURE__ */ $("div", {
4453
4475
  class: "markup-reaction-picker",
4454
4476
  role: "menu",
4455
- children: ka.map((t) => /* @__PURE__ */ $("button", {
4477
+ children: Fa.map((t) => /* @__PURE__ */ $("button", {
4456
4478
  type: "button",
4457
4479
  role: "menuitem",
4458
4480
  class: Q("markup-reaction-picker-item", (e.reactions.find((e) => e.emoji === t)?.mine ?? !1) && "is-mine"),
@@ -4462,11 +4484,11 @@ function ja({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
4462
4484
  }) : null]
4463
4485
  });
4464
4486
  }
4465
- function Ma({ comment: e, isResolved: t, onToggle: n }) {
4487
+ function Ra({ comment: e, isResolved: t, onToggle: n }) {
4466
4488
  return /* @__PURE__ */ $("div", {
4467
4489
  class: "markup-reactions",
4468
4490
  children: e.reactions.map((e) => {
4469
- let r = Na(e.reactors, e.mine, e.count, e.emoji);
4491
+ let r = za(e.reactors, e.mine, e.count, e.emoji);
4470
4492
  return /* @__PURE__ */ $("button", {
4471
4493
  type: "button",
4472
4494
  class: Q("markup-reaction-chip", e.mine && "is-mine"),
@@ -4487,14 +4509,14 @@ function Ma({ comment: e, isResolved: t, onToggle: n }) {
4487
4509
  })
4488
4510
  });
4489
4511
  }
4490
- function Na(e, t, n, r) {
4512
+ function za(e, t, n, r) {
4491
4513
  let i = e.slice(), a = i.length + +!!t, o = Math.max(0, n - a);
4492
4514
  return o > 0 && i.push(`${o} other${o === 1 ? "" : "s"}`), t && i.push("you"), i.length === 0 ? `${n} reacted with ${r}` : `${i.length === 1 ? i[0] : `${i.slice(0, -1).join(", ")} and ${i[i.length - 1]}`} reacted with ${r}`;
4493
4515
  }
4494
- function Pa(e, t, n) {
4516
+ function Ba(e, t, n) {
4495
4517
  return Math.max(t, Math.min(n, e));
4496
4518
  }
4497
- function Fa(e) {
4519
+ function Va(e) {
4498
4520
  let t = Date.now() - e, n = Math.floor(t / 1e3);
4499
4521
  if (n < 60) return "just now";
4500
4522
  let r = Math.floor(n / 60);
@@ -4511,7 +4533,7 @@ function Fa(e) {
4511
4533
  year: "numeric"
4512
4534
  });
4513
4535
  }
4514
- function Ia(e) {
4536
+ function Ha(e) {
4515
4537
  return new Date(e).toLocaleDateString([], {
4516
4538
  month: "long",
4517
4539
  day: "numeric",
@@ -4522,7 +4544,7 @@ function Ia(e) {
4522
4544
  }
4523
4545
  //#endregion
4524
4546
  //#region src/runtime/ui/app.tsx
4525
- function La(e) {
4547
+ function Ua(e) {
4526
4548
  return !e.token || e.tokenExpiresAt == null ? null : {
4527
4549
  clientId: `markup_user_${e.identity.id}`,
4528
4550
  token: e.token,
@@ -4531,11 +4553,11 @@ function La(e) {
4531
4553
  email: e.identity.email
4532
4554
  };
4533
4555
  }
4534
- function Ra() {
4556
+ function Wa() {
4535
4557
  return window.location.host + window.location.pathname;
4536
4558
  }
4537
- function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default" }) {
4538
- let [i, a] = L(Ra), [o, s] = L([]), [c, l] = L(!1), [u, d] = L({ kind: "unresolved" }), [f, p] = L(n), m = z(u);
4559
+ function Ga({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default" }) {
4560
+ let [i, a] = L(Wa), [o, s] = L([]), [c, l] = L(!1), [u, d] = L({ kind: "unresolved" }), [f, p] = L(n), m = z(u);
4539
4561
  m.current = u;
4540
4562
  let [h, g] = L(0), _ = we(() => kr({
4541
4563
  apiUrl: e,
@@ -4561,11 +4583,11 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4561
4583
  email: e.identity.email
4562
4584
  }
4563
4585
  };
4564
- m.current = t, d(t), Fr(t), g((e) => e + 1);
4586
+ m.current = t, d(t), Vr(t), g((e) => e + 1);
4565
4587
  }
4566
- }), [e, t]), [v, y] = L({ kind: "idle" }), [b, x] = L(!1), [S, C] = L(null), [w, T] = L(!1), [E, D] = L(!1), [, O] = L(0), k = z(null), A = Lr(u), j = u.kind === "verified", M = u.kind === "unresolved" || u.kind === "recovering", N = Ir(u);
4588
+ }), [e, t]), [v, y] = L({ kind: "idle" }), [b, x] = L(!1), [S, C] = L(null), [w, T] = L(!1), [E, D] = L(!1), [, O] = L(0), k = z(null), A = Ur(u), j = u.kind === "verified", M = u.kind === "unresolved" || u.kind === "recovering", N = Hr(u);
4567
4589
  R(() => {
4568
- let { state: e, preserved: t } = Pr();
4590
+ let { state: e, preserved: t } = Br();
4569
4591
  if (e.kind === "anon" || e.kind === "verified") {
4570
4592
  d(e);
4571
4593
  return;
@@ -4583,7 +4605,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4583
4605
  email: t.email
4584
4606
  }
4585
4607
  };
4586
- Fr(i), d(i);
4608
+ Vr(i), d(i);
4587
4609
  }).catch(() => {
4588
4610
  n || (r = setTimeout(a, Math.min(i, 3e4)), i = Math.min(i * 2, 3e4));
4589
4611
  });
@@ -4643,21 +4665,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4643
4665
  }), history.replaceState(null, "", window.location.pathname + window.location.search);
4644
4666
  }
4645
4667
  ie.current = !0;
4646
- }, [o, c]), R(() => {
4647
- let e = !0;
4648
- function t() {
4649
- e && a(Ra());
4650
- }
4651
- window.addEventListener("popstate", t);
4652
- let n = history.pushState, r = history.replaceState;
4653
- return history.pushState = function(...e) {
4654
- n.apply(this, e), t();
4655
- }, history.replaceState = function(...e) {
4656
- r.apply(this, e), t();
4657
- }, () => {
4658
- e = !1, window.removeEventListener("popstate", t);
4659
- };
4660
- }, []), R(() => {
4668
+ }, [o, c]), R(() => Ir(() => a(Wa())), []), R(() => {
4661
4669
  function e(e) {
4662
4670
  e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(), T((e) => !e)));
4663
4671
  }
@@ -4697,7 +4705,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4697
4705
  screenshot: null,
4698
4706
  screenshotCapturing: !0,
4699
4707
  captureToken: a
4700
- }), ia(k.current != null && k.current.getRootNode() instanceof ShadowRoot ? k.current.getRootNode().host : null, {
4708
+ }), ua(k.current != null && k.current.getRootNode() instanceof ShadowRoot ? k.current.getRootNode().host : null, {
4701
4709
  x: t,
4702
4710
  y: n
4703
4711
  }).then((e) => {
@@ -4717,18 +4725,18 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4717
4725
  email: t
4718
4726
  }
4719
4727
  };
4720
- Fr(n), d(n);
4728
+ Vr(n), d(n);
4721
4729
  }, [u]), [ue, de] = L(!1), fe = B(async () => {
4722
4730
  if (!ue) {
4723
4731
  C(null), de(!0);
4724
4732
  try {
4725
- let n = La(await zr(e, t));
4733
+ let n = Ua(await Gr(e, t));
4726
4734
  if (!n) throw Error("Sign-in did not return a verified token");
4727
4735
  let r = {
4728
4736
  kind: "verified",
4729
4737
  identity: n
4730
4738
  };
4731
- Fr(r), d(r);
4739
+ Vr(r), d(r);
4732
4740
  } catch (e) {
4733
4741
  C(e instanceof Error ? e.message : "Sign-in failed");
4734
4742
  } finally {
@@ -4741,7 +4749,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4741
4749
  ue
4742
4750
  ]), P = B(async (e, t) => {
4743
4751
  if (v.kind !== "composing-new") return;
4744
- let n = Rr(u);
4752
+ let n = Wr(u);
4745
4753
  if (n) {
4746
4754
  x(!0), C(null);
4747
4755
  try {
@@ -4815,7 +4823,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4815
4823
  N
4816
4824
  ]), he = B(async (e) => {
4817
4825
  if (v.kind !== "thread") return;
4818
- let t = Rr(u);
4826
+ let t = Wr(u);
4819
4827
  if (!t) return;
4820
4828
  let n = v.threadId;
4821
4829
  x(!0), C(null);
@@ -4869,7 +4877,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4869
4877
  v
4870
4878
  ]), _e = B(async (e, t) => {
4871
4879
  if (v.kind !== "thread") return;
4872
- let n = Rr(u);
4880
+ let n = Wr(u);
4873
4881
  if (!n) return;
4874
4882
  let r = v.threadId;
4875
4883
  C(null);
@@ -4907,7 +4915,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4907
4915
  anchorOffsetX: e.anchorOffsetX,
4908
4916
  anchorOffsetY: e.anchorOffsetY
4909
4917
  }), r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
4910
- return /* @__PURE__ */ $(Ea, {
4918
+ return /* @__PURE__ */ $(Ma, {
4911
4919
  pageX: n.pageX,
4912
4920
  pageY: n.pageY,
4913
4921
  count: r,
@@ -4917,16 +4925,16 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4917
4925
  threadId: e._id
4918
4926
  })
4919
4927
  }, e._id);
4920
- }), v.kind === "composing-new" ? /* @__PURE__ */ $(Da, {
4928
+ }), v.kind === "composing-new" ? /* @__PURE__ */ $(Na, {
4921
4929
  pageX: v.pageX,
4922
4930
  pageY: v.pageY
4923
4931
  }) : null]
4924
4932
  }),
4925
- v.kind === "placing" ? /* @__PURE__ */ $(Oa, {
4933
+ v.kind === "placing" ? /* @__PURE__ */ $(Pa, {
4926
4934
  onPlace: ce,
4927
4935
  onCancel: oe
4928
4936
  }) : null,
4929
- v.kind === "thread" && I ? /* @__PURE__ */ $(Aa, {
4937
+ v.kind === "thread" && I ? /* @__PURE__ */ $(Ia, {
4930
4938
  thread: I,
4931
4939
  authorName: A,
4932
4940
  currentClientId: N ?? null,
@@ -4947,7 +4955,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4947
4955
  onDelete: pe,
4948
4956
  onResolve: me
4949
4957
  }, I._id) : null,
4950
- v.kind === "composing-new" ? /* @__PURE__ */ $(wa, {
4958
+ v.kind === "composing-new" ? /* @__PURE__ */ $(Aa, {
4951
4959
  pageX: v.pageX,
4952
4960
  pageY: v.pageY,
4953
4961
  authorName: A,
@@ -4963,7 +4971,7 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4963
4971
  onSubmit: P,
4964
4972
  onClose: oe
4965
4973
  }) : null,
4966
- !w || v.kind === "placing" || v.kind === "composing-new" ? /* @__PURE__ */ $(_a, {
4974
+ !w || v.kind === "placing" || v.kind === "composing-new" ? /* @__PURE__ */ $(Ca, {
4967
4975
  active: v.kind === "placing",
4968
4976
  onToggle: () => v.kind === "placing" ? oe() : ae(),
4969
4977
  onHide: () => {
@@ -4973,11 +4981,11 @@ function za({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
4973
4981
  onPositionChange: p,
4974
4982
  variant: r
4975
4983
  }) : null,
4976
- w && E ? /* @__PURE__ */ $(Ba, { position: f }) : null
4984
+ w && E ? /* @__PURE__ */ $(Ka, { position: f }) : null
4977
4985
  ]
4978
4986
  });
4979
4987
  }
4980
- function Ba({ position: e }) {
4988
+ function Ka({ position: e }) {
4981
4989
  let t = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl";
4982
4990
  return /* @__PURE__ */ $("div", {
4983
4991
  class: Q("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : "markup-hud-hidden-toast-right"),
@@ -4999,7 +5007,7 @@ function Ba({ position: e }) {
4999
5007
  }
5000
5008
  //#endregion
5001
5009
  //#region src/runtime/mount.tsx
5002
- function Va(e, t) {
5010
+ function qa(e, t) {
5003
5011
  e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
5004
5012
  let n = t.theme ?? "auto";
5005
5013
  n !== "auto" && (e.dataset.theme = n);
@@ -5008,24 +5016,24 @@ function Va(e, t) {
5008
5016
  let a = document.createElement("div");
5009
5017
  a.className = "markup-shadow-root", r.appendChild(a);
5010
5018
  let { theme: o, ...s } = t;
5011
- return ue(/* @__PURE__ */ $(za, { ...s }), a), () => ue(null, a);
5019
+ return ue(/* @__PURE__ */ $(Ga, { ...s }), a), () => ue(null, a);
5012
5020
  }
5013
5021
  //#endregion
5014
5022
  //#region src/widget.ts
5015
- var Ha = null, Ua = null;
5016
- function Wa(e) {
5023
+ var Ja = null, Ya = null;
5024
+ function Xa(e) {
5017
5025
  if (!e.apiUrl || !e.apiKey) return console.warn("[markup] init() requires both apiUrl and apiKey — widget not mounted"), () => {};
5018
- Ga();
5026
+ Za();
5019
5027
  let t = document.createElement("div");
5020
- return t.id = "markup-widget", document.body.appendChild(t), Ua = t, Ha = Va(t, e), Ga;
5028
+ return t.id = "markup-widget", document.body.appendChild(t), Ya = t, Ja = qa(t, e), Za;
5021
5029
  }
5022
- function Ga() {
5023
- Ha &&= (Ha(), null), Ua?.parentNode && Ua.parentNode.removeChild(Ua), Ua = null;
5030
+ function Za() {
5031
+ Ja &&= (Ja(), null), Ya?.parentNode && Ya.parentNode.removeChild(Ya), Ya = null;
5024
5032
  }
5025
5033
  if (typeof document < "u") {
5026
5034
  let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
5027
5035
  if (t && n) {
5028
- let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => Wa({
5036
+ let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => Xa({
5029
5037
  apiUrl: t,
5030
5038
  apiKey: n,
5031
5039
  position: r,
@@ -5036,4 +5044,4 @@ if (typeof document < "u") {
5036
5044
  }
5037
5045
  }
5038
5046
  //#endregion
5039
- export { Ga as destroy, Wa as init };
5047
+ export { Za as destroy, Xa as init };