@pixelmatters/markup 1.12.0 → 1.13.0

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/widget.js CHANGED
@@ -302,33 +302,33 @@ function ve(e, t, n) {
302
302
  context: n?.context
303
303
  });
304
304
  }
305
- var ye = null;
306
- function be(e) {
307
- ye = e;
305
+ var P = null;
306
+ function ye(e) {
307
+ P = e;
308
308
  }
309
- function P(e, t) {
310
- ye && ve(ye, e, t);
309
+ function F(e, t) {
310
+ P && ve(P, e, t);
311
311
  }
312
312
  //#endregion
313
313
  //#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/hooks/dist/hooks.module.js
314
- var xe, F, Se, Ce, we = 0, Te = [], I = t, Ee = I.__b, De = I.__r, L = I.diffed, Oe = I.__c, ke = I.unmount, Ae = I.__;
314
+ var be, I, xe, Se, Ce = 0, we = [], L = t, Te = L.__b, Ee = L.__r, De = L.diffed, Oe = L.__c, ke = L.unmount, Ae = L.__;
315
315
  function je(e, t) {
316
- I.__h && I.__h(F, e, we || t), we = 0;
317
- var n = F.__H ||= {
316
+ L.__h && L.__h(I, e, Ce || t), Ce = 0;
317
+ var n = I.__H ||= {
318
318
  __: [],
319
319
  __h: []
320
320
  };
321
321
  return e >= n.__.length && n.__.push({}), n.__[e];
322
322
  }
323
323
  function R(e) {
324
- return we = 1, Me(Be, e);
324
+ return Ce = 1, Me(Be, e);
325
325
  }
326
326
  function Me(e, t, n) {
327
- var r = je(xe++, 2);
327
+ var r = je(be++, 2);
328
328
  if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Be(void 0, t), function(e) {
329
329
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
330
330
  t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
331
- }], r.__c = F, !F.__f)) {
331
+ }], r.__c = I, !I.__f)) {
332
332
  var i = function(e, t, n) {
333
333
  if (!r.__c.__H) return !0;
334
334
  var i = r.__c.__H.__.filter(function(e) {
@@ -345,63 +345,63 @@ function Me(e, t, n) {
345
345
  }
346
346
  }), a && a.call(this, e, t, n) || o;
347
347
  };
348
- F.__f = !0;
349
- var a = F.shouldComponentUpdate, o = F.componentWillUpdate;
350
- F.componentWillUpdate = function(e, t, n) {
348
+ I.__f = !0;
349
+ var a = I.shouldComponentUpdate, o = I.componentWillUpdate;
350
+ I.componentWillUpdate = function(e, t, n) {
351
351
  if (this.__e) {
352
352
  var r = a;
353
353
  a = void 0, i(e, t, n), a = r;
354
354
  }
355
355
  o && o.call(this, e, t, n);
356
- }, F.shouldComponentUpdate = i;
356
+ }, I.shouldComponentUpdate = i;
357
357
  }
358
358
  return r.__N || r.__;
359
359
  }
360
360
  function z(e, t) {
361
- var n = je(xe++, 3);
362
- !I.__s && ze(n.__H, t) && (n.__ = e, n.u = t, F.__H.__h.push(n));
361
+ var n = je(be++, 3);
362
+ !L.__s && ze(n.__H, t) && (n.__ = e, n.u = t, I.__H.__h.push(n));
363
363
  }
364
364
  function B(e) {
365
- return we = 5, Ne(function() {
365
+ return Ce = 5, Ne(function() {
366
366
  return { current: e };
367
367
  }, []);
368
368
  }
369
369
  function Ne(e, t) {
370
- var n = je(xe++, 7);
370
+ var n = je(be++, 7);
371
371
  return ze(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
372
372
  }
373
373
  function V(e, t) {
374
- return we = 8, Ne(function() {
374
+ return Ce = 8, Ne(function() {
375
375
  return e;
376
376
  }, t);
377
377
  }
378
378
  function Pe() {
379
- for (var e; e = Te.shift();) {
379
+ for (var e; e = we.shift();) {
380
380
  var t = e.__H;
381
381
  if (e.__P && t) try {
382
382
  t.__h.some(Le), t.__h.some(Re), t.__h = [];
383
383
  } catch (n) {
384
- t.__h = [], I.__e(n, e.__v);
384
+ t.__h = [], L.__e(n, e.__v);
385
385
  }
386
386
  }
387
387
  }
388
- I.__b = function(e) {
389
- F = null, Ee && Ee(e);
390
- }, I.__ = function(e, t) {
388
+ L.__b = function(e) {
389
+ I = null, Te && Te(e);
390
+ }, L.__ = function(e, t) {
391
391
  e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ae && Ae(e, t);
392
- }, I.__r = function(e) {
393
- De && De(e), xe = 0;
394
- var t = (F = e.__c).__H;
395
- t && (Se === F ? (t.__h = [], F.__h = [], t.__.some(function(e) {
392
+ }, L.__r = function(e) {
393
+ Ee && Ee(e), be = 0;
394
+ var t = (I = e.__c).__H;
395
+ t && (xe === I ? (t.__h = [], I.__h = [], t.__.some(function(e) {
396
396
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
397
- })) : (t.__h.some(Le), t.__h.some(Re), t.__h = [], xe = 0)), Se = F;
398
- }, I.diffed = function(e) {
399
- L && L(e);
397
+ })) : (t.__h.some(Le), t.__h.some(Re), t.__h = [], be = 0)), xe = I;
398
+ }, L.diffed = function(e) {
399
+ De && De(e);
400
400
  var t = e.__c;
401
- t && t.__H && (t.__H.__h.length && (Te.push(t) !== 1 && Ce === I.requestAnimationFrame || ((Ce = I.requestAnimationFrame) || Ie)(Pe)), t.__H.__.some(function(e) {
401
+ t && t.__H && (t.__H.__h.length && (we.push(t) !== 1 && Se === L.requestAnimationFrame || ((Se = L.requestAnimationFrame) || Ie)(Pe)), t.__H.__.some(function(e) {
402
402
  e.u && (e.__H = e.u), e.u = void 0;
403
- })), Se = F = null;
404
- }, I.__c = function(e, t) {
403
+ })), xe = I = null;
404
+ }, L.__c = function(e, t) {
405
405
  t.some(function(e) {
406
406
  try {
407
407
  e.__h.some(Le), e.__h = e.__h.filter(function(e) {
@@ -410,10 +410,10 @@ I.__b = function(e) {
410
410
  } catch (n) {
411
411
  t.some(function(e) {
412
412
  e.__h &&= [];
413
- }), t = [], I.__e(n, e.__v);
413
+ }), t = [], L.__e(n, e.__v);
414
414
  }
415
415
  }), Oe && Oe(e, t);
416
- }, I.unmount = function(e) {
416
+ }, L.unmount = function(e) {
417
417
  ke && ke(e);
418
418
  var t, n = e.__c;
419
419
  n && n.__H && (n.__H.__.some(function(e) {
@@ -422,7 +422,7 @@ I.__b = function(e) {
422
422
  } catch (e) {
423
423
  t = e;
424
424
  }
425
- }), n.__H = void 0, t && I.__e(t, n.__v));
425
+ }), n.__H = void 0, t && L.__e(t, n.__v));
426
426
  };
427
427
  var Fe = typeof requestAnimationFrame == "function";
428
428
  function Ie(e) {
@@ -432,12 +432,12 @@ function Ie(e) {
432
432
  Fe && (t = requestAnimationFrame(n));
433
433
  }
434
434
  function Le(e) {
435
- var t = F, n = e.__c;
436
- typeof n == "function" && (e.__c = void 0, n()), F = t;
435
+ var t = I, n = e.__c;
436
+ typeof n == "function" && (e.__c = void 0, n()), I = t;
437
437
  }
438
438
  function Re(e) {
439
- var t = F;
440
- e.__c = e.__(), F = t;
439
+ var t = I;
440
+ e.__c = e.__(), I = t;
441
441
  }
442
442
  function ze(e, t) {
443
443
  return !e || e.length !== t.length || t.some(function(t, n) {
@@ -3030,6 +3030,14 @@ function qr(e) {
3030
3030
  operation: "forget-me",
3031
3031
  signal: e?.signal
3032
3032
  });
3033
+ },
3034
+ signOut(e) {
3035
+ return n("/widget/sign-out", { method: "POST" }, {
3036
+ timeoutMs: Gr,
3037
+ category: "write",
3038
+ operation: "sign-out",
3039
+ signal: e?.signal
3040
+ });
3033
3041
  }
3034
3042
  };
3035
3043
  }
@@ -3068,7 +3076,7 @@ async function Xr(e, t) {
3068
3076
  } catch {}
3069
3077
  return i;
3070
3078
  } catch (e) {
3071
- return e?.name !== "TypeError" && P(e, { context: "cookie-probe" }), !1;
3079
+ return e?.name !== "TypeError" && F(e, { context: "cookie-probe" }), !1;
3072
3080
  }
3073
3081
  }
3074
3082
  //#endregion
@@ -3079,7 +3087,7 @@ function $r(e) {
3079
3087
  try {
3080
3088
  e();
3081
3089
  } catch (e) {
3082
- P(e, { context: "history-observer-listener" });
3090
+ F(e, { context: "history-observer-listener" });
3083
3091
  }
3084
3092
  });
3085
3093
  }
@@ -3252,7 +3260,7 @@ async function di(e) {
3252
3260
  let s = r ? "refresh,cookies" : "refresh";
3253
3261
  o.searchParams.set("capabilities", s), a = o.toString();
3254
3262
  } catch (e) {
3255
- return e?.name !== "TypeError" && P(e, { context: "popup-exchange" }), Promise.reject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to start popup exchange"));
3263
+ return e?.name !== "TypeError" && F(e, { context: "popup-exchange" }), Promise.reject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to start popup exchange"));
3256
3264
  }
3257
3265
  let o = Math.max(0, window.screenX + (window.outerWidth - 420) / 2), s = Math.max(0, window.screenY + (window.outerHeight - 560) / 2), c = window.open(a, "markup-auth", `width=420,height=560,left=${o},top=${s}`);
3258
3266
  if (!c) return Promise.reject(/* @__PURE__ */ Error("Popup blocked — allow popups for this site to sign in"));
@@ -3294,7 +3302,7 @@ async function di(e) {
3294
3302
  });
3295
3303
  if (!e.ok) {
3296
3304
  let t = /* @__PURE__ */ Error(`Failed to install widget cookies (${e.status})`);
3297
- throw P(t, { context: "install-cookies" }), t;
3305
+ throw F(t, { context: "install-cookies" }), t;
3298
3306
  }
3299
3307
  return {
3300
3308
  ...l,
@@ -3776,7 +3784,7 @@ function Pa(e) {
3776
3784
  if (e.redactSelector) try {
3777
3785
  for (let t of document.querySelectorAll(e.redactSelector)) Na(t) || r(t);
3778
3786
  } catch (e) {
3779
- P(e, { context: "screenshot-redact-selector" });
3787
+ F(e, { context: "screenshot-redact-selector" });
3780
3788
  }
3781
3789
  if (e.strictScrub) for (let e of document.querySelectorAll("input,select,textarea")) Na(e) || r(e);
3782
3790
  return n;
@@ -3831,7 +3839,7 @@ async function La(e, t, n) {
3831
3839
  redactedSelectors: s
3832
3840
  };
3833
3841
  } catch (e) {
3834
- return P(e, { context: "screenshot-capture" }), null;
3842
+ return F(e, { context: "screenshot-capture" }), null;
3835
3843
  }
3836
3844
  }
3837
3845
  function Ra(e, t) {
@@ -3884,7 +3892,7 @@ function Wa(e) {
3884
3892
  r = setTimeout(i, o);
3885
3893
  } catch (e) {
3886
3894
  if (t) return;
3887
- e?.name !== "TypeError" && P(e, { context: "subscription-token-refresh" }), r = setTimeout(i, Ua);
3895
+ e?.name !== "TypeError" && F(e, { context: "subscription-token-refresh" }), r = setTimeout(i, Ua);
3888
3896
  }
3889
3897
  }
3890
3898
  return i(), () => {
@@ -3925,7 +3933,7 @@ async function Ga(e) {
3925
3933
  };
3926
3934
  } catch (e) {
3927
3935
  let t = e?.name;
3928
- return t !== "AbortError" && t !== "TypeError" && P(e, { context: "refresh-token" }), null;
3936
+ return t !== "AbortError" && t !== "TypeError" && F(e, { context: "refresh-token" }), null;
3929
3937
  }
3930
3938
  }
3931
3939
  //#endregion
@@ -4197,70 +4205,89 @@ function oo({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
4197
4205
  }
4198
4206
  //#endregion
4199
4207
  //#region src/runtime/ui/fab-menu.tsx
4200
- function so({ identity: e, position: t, isSigningIn: n, onSignIn: r, onForgetMe: i }) {
4201
- let [a, o] = R(!1), [s, c] = R(!1), l = B(null);
4208
+ function so({ identity: e, position: t, isSigningIn: n, isSigningOut: r, dashboardUrl: i, onSignIn: a, onSignOut: o, onForgetMe: s }) {
4209
+ let [c, l] = R(!1), [u, d] = R(!1), [f, p] = R(!1), m = B(null);
4202
4210
  z(() => {
4203
- if (!a) return;
4211
+ if (!c) return;
4204
4212
  function e(e) {
4205
- let t = l.current;
4206
- t && (e.composedPath().includes(t) || o(!1));
4213
+ let t = m.current;
4214
+ t && (e.composedPath().includes(t) || l(!1));
4207
4215
  }
4208
4216
  function t(e) {
4209
- e.key === "Escape" && o(!1);
4217
+ e.key === "Escape" && l(!1);
4210
4218
  }
4211
4219
  return document.addEventListener("click", e, !0), document.addEventListener("keydown", t), () => {
4212
4220
  document.removeEventListener("click", e, !0), document.removeEventListener("keydown", t);
4213
4221
  };
4214
- }, [a]), z(() => {
4215
- a || c(!1);
4216
- }, [a]);
4217
- let u = li(e), d = e.kind === "verified" ? e.identity.email : e.kind === "anon" ? "Commenting anonymously" : null, f = e.kind === "anon", p = e.kind !== "verified", m = p || f, h = t === "bottom-left" ? "is-anchor-left" : "is-anchor-right";
4222
+ }, [c]), z(() => {
4223
+ c || (d(!1), p(!1));
4224
+ }, [c]);
4225
+ let h = li(e), g = e.kind === "verified" ? e.identity.email : e.kind === "anon" ? "Commenting anonymously" : null, _ = e.kind === "anon", v = e.kind !== "verified", y = e.kind === "verified", b = e.kind === "verified" && !!i, x = v || _ || y || b, S = t === "bottom-left" ? "is-anchor-left" : "is-anchor-right";
4218
4226
  return /* @__PURE__ */ Q("div", {
4219
4227
  class: "markup-fab-menu",
4220
- ref: l,
4228
+ ref: m,
4221
4229
  children: [/* @__PURE__ */ Q("button", {
4222
4230
  type: "button",
4223
- class: Z("markup-fab-caret", a && "is-open"),
4231
+ class: Z("markup-fab-caret", c && "is-open"),
4224
4232
  "aria-label": "Widget menu",
4225
- "aria-expanded": a,
4233
+ "aria-expanded": c,
4226
4234
  "aria-haspopup": "menu",
4227
4235
  onClick: (e) => {
4228
- e.preventDefault(), e.stopPropagation(), o((e) => !e);
4236
+ e.preventDefault(), e.stopPropagation(), l((e) => !e);
4229
4237
  },
4230
4238
  children: /* @__PURE__ */ Q(eo, { size: 14 })
4231
- }), a ? /* @__PURE__ */ Q("div", {
4239
+ }), c ? /* @__PURE__ */ Q("div", {
4232
4240
  role: "menu",
4233
- class: Z("markup-fab-menu-list", h),
4241
+ class: Z("markup-fab-menu-list", S),
4234
4242
  children: [
4235
4243
  /* @__PURE__ */ Q("div", {
4236
4244
  class: "markup-fab-menu-header",
4237
4245
  children: [/* @__PURE__ */ Q("div", {
4238
4246
  class: "markup-fab-menu-name",
4239
- children: u ?? "Anonymous"
4240
- }), d ? /* @__PURE__ */ Q("div", {
4247
+ children: h ?? "Anonymous"
4248
+ }), g ? /* @__PURE__ */ Q("div", {
4241
4249
  class: "markup-fab-menu-sub",
4242
- children: d
4250
+ children: g
4243
4251
  }) : null]
4244
4252
  }),
4245
- m ? /* @__PURE__ */ Q("div", { class: "markup-fab-menu-divider" }) : null,
4246
- p ? /* @__PURE__ */ Q("button", {
4253
+ x ? /* @__PURE__ */ Q("div", { class: "markup-fab-menu-divider" }) : null,
4254
+ v ? /* @__PURE__ */ Q("button", {
4247
4255
  type: "button",
4248
4256
  role: "menuitem",
4249
4257
  class: "markup-fab-menu-item",
4250
4258
  disabled: n,
4251
4259
  onClick: () => {
4252
- o(!1), r();
4260
+ l(!1), a();
4253
4261
  },
4254
4262
  children: n ? "Signing in…" : "Sign in"
4255
4263
  }) : null,
4256
- f ? /* @__PURE__ */ Q("button", {
4264
+ b ? /* @__PURE__ */ Q("a", {
4265
+ role: "menuitem",
4266
+ class: "markup-fab-menu-item",
4267
+ href: i,
4268
+ target: "_blank",
4269
+ rel: "noopener noreferrer",
4270
+ onClick: () => l(!1),
4271
+ children: "Account →"
4272
+ }) : null,
4273
+ y ? /* @__PURE__ */ Q("button", {
4274
+ type: "button",
4275
+ role: "menuitem",
4276
+ class: Z("markup-fab-menu-item", f && "is-danger"),
4277
+ disabled: r,
4278
+ onClick: () => {
4279
+ f ? (l(!1), o()) : p(!0);
4280
+ },
4281
+ children: r ? "Signing out…" : f ? "Confirm — sign out of this site" : "Sign out"
4282
+ }) : null,
4283
+ _ ? /* @__PURE__ */ Q("button", {
4257
4284
  type: "button",
4258
4285
  role: "menuitem",
4259
- class: Z("markup-fab-menu-item", s && "is-danger"),
4286
+ class: Z("markup-fab-menu-item", u && "is-danger"),
4260
4287
  onClick: () => {
4261
- s ? (o(!1), i()) : c(!0);
4288
+ u ? (l(!1), s()) : d(!0);
4262
4289
  },
4263
- children: s ? "Confirm — comments stay, name/email cleared" : "Forget me on this site…"
4290
+ children: u ? "Confirm — comments stay, name/email cleared" : "Forget me on this site…"
4264
4291
  }) : null
4265
4292
  ]
4266
4293
  }) : null]
@@ -5284,7 +5311,8 @@ var Mo = hr({
5284
5311
  name: e.identity.name,
5285
5312
  email: e.identity.email
5286
5313
  }
5287
- })
5314
+ }),
5315
+ "signed-out": () => $({ kind: "unresolved" })
5288
5316
  },
5289
5317
  recovering: {
5290
5318
  "mint-success": (e, t) => $({
@@ -5297,53 +5325,53 @@ var Mo = hr({
5297
5325
  })
5298
5326
  }
5299
5327
  });
5300
- function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i }) {
5301
- let [a, o] = R(Ao), [s, c] = R([]), [l, u] = R(!1), d = Ne(() => oi(), []), [f, p] = gr(Mo, d.state), [m, h] = R(null);
5328
+ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i, dashboardUrl: a }) {
5329
+ let [o, s] = R(Ao), [c, l] = R([]), [u, d] = R(!1), f = Ne(() => oi(), []), [p, m] = gr(Mo, f.state), [h, g] = R(null);
5302
5330
  z(() => {
5303
5331
  let n = !1;
5304
5332
  return Xr(e, t).then((e) => {
5305
- n || h(e);
5333
+ n || g(e);
5306
5334
  }), () => {
5307
5335
  n = !0;
5308
5336
  };
5309
5337
  }, [e, t]);
5310
- let [g, _] = R(n), v = B(f);
5311
- v.current = f, Ja(f, e, t, (e) => p({
5338
+ let [_, v] = R(n), y = B(p);
5339
+ y.current = p, Ja(p, e, t, (e) => m({
5312
5340
  type: "signed-in",
5313
5341
  identity: e
5314
- }), () => p({ type: "unauthorized" }));
5315
- let y = Ne(() => qr({
5342
+ }), () => m({ type: "unauthorized" }));
5343
+ let b = Ne(() => qr({
5316
5344
  apiUrl: e,
5317
5345
  apiKey: t,
5318
5346
  getToken: () => {
5319
- let e = v.current;
5347
+ let e = y.current;
5320
5348
  return e.kind !== "verified" || e.identity.token == null ? null : {
5321
5349
  token: e.identity.token,
5322
5350
  expiresAt: e.identity.tokenExpiresAt
5323
5351
  };
5324
5352
  },
5325
5353
  getStorageMode: () => {
5326
- let e = v.current;
5354
+ let e = y.current;
5327
5355
  return e.kind === "verified" ? e.identity.storage : null;
5328
5356
  },
5329
5357
  getAnonToken: () => {
5330
- let e = v.current;
5358
+ let e = y.current;
5331
5359
  return e.kind === "anon" ? e.identity.anonToken : null;
5332
5360
  },
5333
5361
  onUnauthorized: () => {
5334
- p({ type: "unauthorized" });
5362
+ m({ type: "unauthorized" });
5335
5363
  }
5336
5364
  }), [
5337
5365
  e,
5338
5366
  t,
5339
- p
5340
- ]), [b, x] = R({ kind: "idle" }), S = vr(), C = vr(), w = vr(), T = vr(), { run: E, reset: D } = S, { run: O } = C, { run: k, reset: A } = w, { run: j } = T, M = S.isPending, N = S.error ?? C.error ?? w.error, [ee, te] = gr(jo, { kind: "visible" }), ne = ee.kind !== "visible", [re, ie] = R(0), ae = B(null), oe = li(f), se = f.kind === "verified", ce = f.kind === "unresolved" || f.kind === "recovering", le = ci(f);
5367
+ m
5368
+ ]), [x, S] = R({ kind: "idle" }), C = vr(), w = vr(), T = vr(), E = vr(), D = vr(), { run: O, reset: k } = C, { run: A } = w, { run: j, reset: M } = T, { run: N } = E, { run: ee } = D, te = D.isPending, ne = C.isPending, re = C.error ?? w.error ?? T.error, [ie, ae] = gr(jo, { kind: "visible" }), oe = ie.kind !== "visible", [se, ce] = R(0), le = B(null), ue = li(p), de = p.kind === "verified", fe = p.kind === "unresolved" || p.kind === "recovering", pe = ci(p);
5341
5369
  z(() => {
5342
- if (f.kind !== "unresolved" && f.kind !== "recovering") return;
5343
- let e = f.kind === "recovering" ? f.preserved : d.preserved, t = !1, n = null, r = 1e3;
5370
+ if (p.kind !== "unresolved" && p.kind !== "recovering") return;
5371
+ let e = p.kind === "recovering" ? p.preserved : f.preserved, t = !1, n = null, r = 1e3;
5344
5372
  function i() {
5345
- y.mintAnonIdentity().then(({ clientId: n, token: r }) => {
5346
- t || p({
5373
+ b.mintAnonIdentity().then(({ clientId: n, token: r }) => {
5374
+ t || m({
5347
5375
  type: "mint-success",
5348
5376
  identity: {
5349
5377
  clientId: n,
@@ -5360,59 +5388,59 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5360
5388
  t = !0, n && clearTimeout(n);
5361
5389
  };
5362
5390
  }, [
5363
- y,
5364
- f,
5391
+ b,
5365
5392
  p,
5366
- d
5393
+ m,
5394
+ f
5367
5395
  ]);
5368
- let ue = Wa(y), [de, fe] = R(null);
5396
+ let me = Wa(b), [he, ge] = R(null);
5369
5397
  z(() => {
5370
5398
  let t = new mr(e.replace(/\.convex\.site(\/.*)?$/, ".convex.cloud"));
5371
- return fe(t), () => {
5372
- t.close(), fe((e) => e === t ? null : e);
5399
+ return ge(t), () => {
5400
+ t.close(), ge((e) => e === t ? null : e);
5373
5401
  };
5374
5402
  }, [e]);
5375
- let pe = B(!1);
5403
+ let _e = B(!1);
5376
5404
  z(() => {
5377
- if (!(!de || !ue)) return D(), A(), de.onUpdate(an("widget/queries:subscribeThreadsForRoute"), {
5378
- subscriptionToken: ue,
5379
- route: a,
5380
- viewerClientId: le
5405
+ if (!(!he || !me)) return k(), M(), he.onUpdate(an("widget/queries:subscribeThreadsForRoute"), {
5406
+ subscriptionToken: me,
5407
+ route: o,
5408
+ viewerClientId: pe
5381
5409
  }, (e) => {
5382
- e !== void 0 && (c(e), u(!0));
5410
+ e !== void 0 && (l(e), d(!0));
5383
5411
  });
5384
5412
  }, [
5385
- de,
5386
- ue,
5387
- a,
5388
- le,
5389
- D,
5390
- A
5413
+ he,
5414
+ me,
5415
+ o,
5416
+ pe,
5417
+ k,
5418
+ M
5391
5419
  ]), z(() => {
5392
- if (pe.current || !l) return;
5420
+ if (_e.current || !u) return;
5393
5421
  let e = window.location.hash.match(/^#markup-thread=(.+)$/);
5394
5422
  if (e) {
5395
5423
  let t = decodeURIComponent(e[1] ?? "");
5396
- s.find((e) => e._id === t) && x({
5424
+ c.find((e) => e._id === t) && S({
5397
5425
  kind: "thread",
5398
5426
  threadId: t
5399
5427
  }), history.replaceState(null, "", window.location.pathname + window.location.search);
5400
5428
  }
5401
- pe.current = !0;
5402
- }, [s, l]), z(() => ni(() => o(Ao())), []), z(() => {
5429
+ _e.current = !0;
5430
+ }, [c, u]), z(() => ni(() => s(Ao())), []), z(() => {
5403
5431
  function e(e) {
5404
- e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(), te({ type: "toggle" })));
5432
+ e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(), ae({ type: "toggle" })));
5405
5433
  }
5406
5434
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
5407
- }, [te]), z(() => {
5408
- if (ee.kind !== "hidden-with-toast") return;
5409
- let e = window.setTimeout(() => te({ type: "dismiss-toast" }), 5e3);
5435
+ }, [ae]), z(() => {
5436
+ if (ie.kind !== "hidden-with-toast") return;
5437
+ let e = window.setTimeout(() => ae({ type: "dismiss-toast" }), 5e3);
5410
5438
  return () => window.clearTimeout(e);
5411
- }, [ee.kind, te]), z(() => {
5439
+ }, [ie.kind, ae]), z(() => {
5412
5440
  let e = null;
5413
5441
  function t() {
5414
5442
  e ??= requestAnimationFrame(() => {
5415
- e = null, ie((e) => e + 1);
5443
+ e = null, ce((e) => e + 1);
5416
5444
  });
5417
5445
  }
5418
5446
  window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t);
@@ -5421,14 +5449,14 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5421
5449
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n.disconnect(), e != null && cancelAnimationFrame(e);
5422
5450
  };
5423
5451
  }, []);
5424
- let me = V(() => {
5425
- D(), A(), x({ kind: "placing" });
5426
- }, [D, A]), he = V(() => {
5427
- x({ kind: "idle" }), D(), A();
5428
- }, [D, A]), ge = B(0), _e = V((e, t, n) => {
5429
- let r = t + window.scrollX, a = n + window.scrollY, o = ++ge.current;
5452
+ let ve = V(() => {
5453
+ k(), M(), S({ kind: "placing" });
5454
+ }, [k, M]), P = V(() => {
5455
+ S({ kind: "idle" }), k(), M();
5456
+ }, [k, M]), ye = B(0), F = V((e, t, n) => {
5457
+ let r = t + window.scrollX, a = n + window.scrollY, o = ++ye.current;
5430
5458
  if (i?.enabled === !1) {
5431
- x({
5459
+ S({
5432
5460
  kind: "composing-new",
5433
5461
  coords: e,
5434
5462
  pageX: r,
@@ -5441,7 +5469,7 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5441
5469
  });
5442
5470
  return;
5443
5471
  }
5444
- x({
5472
+ S({
5445
5473
  kind: "composing-new",
5446
5474
  coords: e,
5447
5475
  pageX: r,
@@ -5452,7 +5480,7 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5452
5480
  screenshotRedactedSelectors: [],
5453
5481
  captureToken: o
5454
5482
  });
5455
- let s = ae.current != null && ae.current.getRootNode() instanceof ShadowRoot ? ae.current.getRootNode().host : null, c = {
5483
+ let s = le.current != null && le.current.getRootNode() instanceof ShadowRoot ? le.current.getRootNode().host : null, c = {
5456
5484
  strictScrub: i?.strictScrub,
5457
5485
  redactSelector: i?.redactSelector
5458
5486
  };
@@ -5460,7 +5488,7 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5460
5488
  x: t,
5461
5489
  y: n
5462
5490
  }, c).then((e) => {
5463
- x((t) => t.kind !== "composing-new" || t.captureToken !== o ? t : {
5491
+ S((t) => t.kind !== "composing-new" || t.captureToken !== o ? t : {
5464
5492
  ...t,
5465
5493
  screenshot: e?.blob ?? null,
5466
5494
  isScreenshotCapturing: !1,
@@ -5468,21 +5496,21 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5468
5496
  screenshotRedactedSelectors: e?.redactedSelectors ?? []
5469
5497
  });
5470
5498
  });
5471
- }, [i]), ve = V((e, t) => {
5472
- p({
5499
+ }, [i]), be = V((e, t) => {
5500
+ m({
5473
5501
  type: "author-set",
5474
5502
  name: e,
5475
5503
  email: t
5476
5504
  });
5477
- }, [p]), ye = C.isPending, be = V(async () => {
5478
- await O(async () => {
5505
+ }, [m]), I = w.isPending, xe = V(async () => {
5506
+ await A(async () => {
5479
5507
  let n = ko(await di({
5480
5508
  apiUrl: e,
5481
5509
  apiKey: t,
5482
- useCookies: m === !0
5510
+ useCookies: h === !0
5483
5511
  }));
5484
5512
  if (!n) throw Error("Sign-in did not return a verified token");
5485
- p({
5513
+ m({
5486
5514
  type: "signed-in",
5487
5515
  identity: n
5488
5516
  });
@@ -5490,21 +5518,21 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5490
5518
  }, [
5491
5519
  e,
5492
5520
  t,
5493
- m,
5494
- O,
5495
- p
5496
- ]), P = V(async (e, t) => {
5497
- if (b.kind !== "composing-new") return;
5498
- let n = ui(f);
5499
- n && await E(async () => {
5521
+ h,
5522
+ A,
5523
+ m
5524
+ ]), Se = V(async (e, t) => {
5525
+ if (x.kind !== "composing-new") return;
5526
+ let n = ui(p);
5527
+ n && await O(async () => {
5500
5528
  let r;
5501
- if (t && b.screenshot) {
5502
- let { uploadUrl: e } = await y.getScreenshotUploadUrl(), t;
5529
+ if (t && x.screenshot) {
5530
+ let { uploadUrl: e } = await b.getScreenshotUploadUrl(), t;
5503
5531
  try {
5504
5532
  t = await fetch(e, {
5505
5533
  method: "POST",
5506
- headers: { "Content-Type": b.screenshot.type || "image/png" },
5507
- body: b.screenshot,
5534
+ headers: { "Content-Type": x.screenshot.type || "image/png" },
5535
+ body: x.screenshot,
5508
5536
  signal: AbortSignal.timeout(6e4)
5509
5537
  });
5510
5538
  } catch (e) {
@@ -5514,128 +5542,142 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5514
5542
  let { storageId: n } = await t.json();
5515
5543
  r = n;
5516
5544
  }
5517
- let i = await y.createThread({
5545
+ let i = await b.createThread({
5518
5546
  url: window.location.href,
5519
- route: a,
5520
- anchorSelector: b.coords.anchorSelector,
5521
- anchorX: b.coords.anchorX,
5522
- anchorY: b.coords.anchorY,
5523
- anchorOffsetX: b.coords.anchorOffsetX,
5524
- anchorOffsetY: b.coords.anchorOffsetY,
5525
- viewportW: b.coords.viewportW,
5526
- viewportY: b.coords.viewportY,
5547
+ route: o,
5548
+ anchorSelector: x.coords.anchorSelector,
5549
+ anchorX: x.coords.anchorX,
5550
+ anchorY: x.coords.anchorY,
5551
+ anchorOffsetX: x.coords.anchorOffsetX,
5552
+ anchorOffsetY: x.coords.anchorOffsetY,
5553
+ viewportW: x.coords.viewportW,
5554
+ viewportY: x.coords.viewportY,
5527
5555
  userAgent: navigator.userAgent,
5528
5556
  authorName: n.name,
5529
5557
  authorEmail: n.email,
5530
5558
  body: e,
5531
5559
  screenshotStorageId: r
5532
5560
  });
5533
- c((e) => [...e, i.thread]), x({
5561
+ l((e) => [...e, i.thread]), S({
5534
5562
  kind: "thread",
5535
5563
  threadId: i.thread._id
5536
5564
  });
5537
5565
  });
5538
5566
  }, [
5539
- y,
5540
- f,
5541
5567
  b,
5542
- a,
5543
- E
5544
- ]), xe = V(async () => {
5545
- if (b.kind !== "thread") return;
5546
- let e = b.threadId;
5547
- await E(async () => {
5548
- await y.deleteThread(e), c((t) => t.filter((t) => t._id !== e)), x({ kind: "idle" });
5568
+ p,
5569
+ x,
5570
+ o,
5571
+ O
5572
+ ]), Ce = V(async () => {
5573
+ if (x.kind !== "thread") return;
5574
+ let e = x.threadId;
5575
+ await O(async () => {
5576
+ await b.deleteThread(e), l((t) => t.filter((t) => t._id !== e)), S({ kind: "idle" });
5549
5577
  });
5550
5578
  }, [
5551
- y,
5552
5579
  b,
5553
- E
5554
- ]), F = V(async () => {
5555
- if (b.kind !== "thread") return;
5556
- let e = b.threadId;
5557
- await E(async () => {
5558
- await y.resolveThread(e, le), c((t) => t.filter((t) => t._id !== e)), x({ kind: "idle" });
5580
+ x,
5581
+ O
5582
+ ]), we = V(async () => {
5583
+ if (x.kind !== "thread") return;
5584
+ let e = x.threadId;
5585
+ await O(async () => {
5586
+ await b.resolveThread(e, pe), l((t) => t.filter((t) => t._id !== e)), S({ kind: "idle" });
5559
5587
  });
5560
5588
  }, [
5561
- y,
5562
5589
  b,
5563
- le,
5564
- E
5565
- ]), Se = V(async (e) => {
5566
- if (b.kind !== "thread") return;
5567
- let t = ui(f);
5590
+ x,
5591
+ pe,
5592
+ O
5593
+ ]), L = V(async (e) => {
5594
+ if (x.kind !== "thread") return;
5595
+ let t = ui(p);
5568
5596
  if (!t) return;
5569
- let n = b.threadId;
5570
- await E(async () => {
5571
- let r = await y.addComment(n, {
5597
+ let n = x.threadId;
5598
+ await O(async () => {
5599
+ let r = await b.addComment(n, {
5572
5600
  body: e,
5573
5601
  authorName: t.name,
5574
5602
  authorEmail: t.email
5575
5603
  });
5576
- c((e) => e.map((e) => e._id === n ? r.thread : e));
5604
+ l((e) => e.map((e) => e._id === n ? r.thread : e));
5577
5605
  });
5578
5606
  }, [
5579
- y,
5580
- f,
5581
5607
  b,
5582
- E
5583
- ]), Ce = V(async (e, t) => {
5584
- if (b.kind !== "thread" || f.kind !== "anon" && f.kind !== "verified") return;
5585
- let n = b.threadId;
5586
- await E(async () => {
5587
- let r = await y.editComment(n, e, { body: t });
5588
- c((e) => e.map((e) => e._id === n ? r.thread : e));
5608
+ p,
5609
+ x,
5610
+ O
5611
+ ]), Te = V(async (e, t) => {
5612
+ if (x.kind !== "thread" || p.kind !== "anon" && p.kind !== "verified") return;
5613
+ let n = x.threadId;
5614
+ await O(async () => {
5615
+ let r = await b.editComment(n, e, { body: t });
5616
+ l((e) => e.map((e) => e._id === n ? r.thread : e));
5589
5617
  }, { rethrow: !0 });
5590
5618
  }, [
5591
- y,
5592
- f,
5593
5619
  b,
5594
- E
5595
- ]), we = V(async (e) => {
5596
- if (b.kind !== "thread" || f.kind !== "anon" && f.kind !== "verified") return;
5597
- let t = b.threadId;
5598
- await E(async () => {
5599
- let n = await y.deleteComment(t, e);
5600
- c((e) => e.map((e) => e._id === t ? n.thread : e));
5620
+ p,
5621
+ x,
5622
+ O
5623
+ ]), Ee = V(async (e) => {
5624
+ if (x.kind !== "thread" || p.kind !== "anon" && p.kind !== "verified") return;
5625
+ let t = x.threadId;
5626
+ await O(async () => {
5627
+ let n = await b.deleteComment(t, e);
5628
+ l((e) => e.map((e) => e._id === t ? n.thread : e));
5601
5629
  });
5602
5630
  }, [
5603
- y,
5604
- f,
5605
5631
  b,
5606
- E
5607
- ]), Te = V(async (e, t) => {
5608
- if (b.kind !== "thread") return;
5609
- let n = ui(f);
5632
+ p,
5633
+ x,
5634
+ O
5635
+ ]), De = V(async (e, t) => {
5636
+ if (x.kind !== "thread") return;
5637
+ let n = ui(p);
5610
5638
  if (!n) return;
5611
- let r = b.threadId;
5612
- await k(async () => {
5613
- let i = await y.toggleReaction(e, {
5639
+ let r = x.threadId;
5640
+ await j(async () => {
5641
+ let i = await b.toggleReaction(e, {
5614
5642
  emoji: t,
5615
5643
  authorName: n.name
5616
5644
  });
5617
- c((e) => e.map((e) => e._id === r ? i.thread : e));
5645
+ l((e) => e.map((e) => e._id === r ? i.thread : e));
5618
5646
  });
5619
5647
  }, [
5620
- y,
5621
- f,
5622
5648
  b,
5623
- k
5624
- ]), [I, Ee] = R(!1), De = V(async () => {
5625
- await j(async () => {
5626
- await y.forgetMe(), x({ kind: "idle" }), p({ type: "forget-me" }), Ee(!0);
5649
+ p,
5650
+ x,
5651
+ j
5652
+ ]), [Oe, ke] = R(!1), Ae = V(async () => {
5653
+ await N(async () => {
5654
+ await b.forgetMe(), S({ kind: "idle" }), m({ type: "forget-me" }), ke(!0);
5627
5655
  });
5628
5656
  }, [
5629
- y,
5630
- j,
5631
- p
5657
+ b,
5658
+ N,
5659
+ m
5632
5660
  ]);
5633
5661
  z(() => {
5634
- if (!I) return;
5635
- let e = window.setTimeout(() => Ee(!1), 5e3);
5662
+ if (!Oe) return;
5663
+ let e = window.setTimeout(() => ke(!1), 5e3);
5636
5664
  return () => window.clearTimeout(e);
5637
- }, [I]);
5638
- let L = b.kind === "thread" ? s.find((e) => e._id === b.threadId) ?? null : null, Oe = se || le != null && le === L?.authorClientId, ke = Ne(() => s.map((e) => ({
5665
+ }, [Oe]);
5666
+ let [je, Me] = R(!1), Pe = V(async () => {
5667
+ await ee(async () => {
5668
+ await b.signOut(), S({ kind: "idle" }), m({ type: "signed-out" }), Me(!0);
5669
+ });
5670
+ }, [
5671
+ b,
5672
+ ee,
5673
+ m
5674
+ ]);
5675
+ z(() => {
5676
+ if (!je) return;
5677
+ let e = window.setTimeout(() => Me(!1), 5e3);
5678
+ return () => window.clearTimeout(e);
5679
+ }, [je]);
5680
+ let Fe = x.kind === "thread" ? c.find((e) => e._id === x.threadId) ?? null : null, Ie = de || pe != null && pe === Fe?.authorClientId, Le = Ne(() => c.map((e) => ({
5639
5681
  thread: e,
5640
5682
  point: Br({
5641
5683
  anchorX: e.anchorX,
@@ -5644,13 +5686,13 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5644
5686
  anchorOffsetX: e.anchorOffsetX,
5645
5687
  anchorOffsetY: e.anchorOffsetY
5646
5688
  })
5647
- })), [s, re]), Ae = ke.some((e) => !e.point.resolved);
5689
+ })), [c, se]), Re = Le.some((e) => !e.point.resolved);
5648
5690
  return z(() => {
5649
- if (!Ae) return;
5691
+ if (!Re) return;
5650
5692
  let e = null;
5651
5693
  function t() {
5652
5694
  e ??= requestAnimationFrame(() => {
5653
- e = null, ie((e) => e + 1);
5695
+ e = null, ce((e) => e + 1);
5654
5696
  });
5655
5697
  }
5656
5698
  let n = new MutationObserver(t);
@@ -5660,96 +5702,100 @@ function No({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
5660
5702
  }), () => {
5661
5703
  n.disconnect(), e != null && cancelAnimationFrame(e);
5662
5704
  };
5663
- }, [Ae]), z(() => {
5664
- b.kind === "thread" && L == null && he();
5705
+ }, [Re]), z(() => {
5706
+ x.kind === "thread" && Fe == null && P();
5665
5707
  }, [
5666
- b,
5667
- L,
5668
- he
5708
+ x,
5709
+ Fe,
5710
+ P
5669
5711
  ]), /* @__PURE__ */ Q("div", {
5670
5712
  class: "markup-root",
5671
- ref: ae,
5713
+ ref: le,
5672
5714
  children: [
5673
- b.kind === "placing" ? null : /* @__PURE__ */ Q("div", {
5715
+ x.kind === "placing" ? null : /* @__PURE__ */ Q("div", {
5674
5716
  class: "markup-pins-layer",
5675
- children: [ne ? null : ke.map(({ thread: e, point: t }) => {
5676
- let n = b.kind === "thread" && b.threadId === e._id, r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
5717
+ children: [oe ? null : Le.map(({ thread: e, point: t }) => {
5718
+ let n = x.kind === "thread" && x.threadId === e._id, r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
5677
5719
  return /* @__PURE__ */ Q(_o, {
5678
5720
  pageX: t.pageX,
5679
5721
  pageY: t.pageY,
5680
5722
  count: r,
5681
5723
  isActive: n,
5682
5724
  isUnresolved: !t.resolved,
5683
- onClick: () => x({
5725
+ onClick: () => S({
5684
5726
  kind: "thread",
5685
5727
  threadId: e._id
5686
5728
  })
5687
5729
  }, e._id);
5688
- }), b.kind === "composing-new" ? /* @__PURE__ */ Q(vo, {
5689
- pageX: b.pageX,
5690
- pageY: b.pageY
5730
+ }), x.kind === "composing-new" ? /* @__PURE__ */ Q(vo, {
5731
+ pageX: x.pageX,
5732
+ pageY: x.pageY
5691
5733
  }) : null]
5692
5734
  }),
5693
- b.kind === "placing" ? /* @__PURE__ */ Q(yo, {
5694
- onPlace: _e,
5695
- onCancel: he
5735
+ x.kind === "placing" ? /* @__PURE__ */ Q(yo, {
5736
+ onPlace: F,
5737
+ onCancel: P
5696
5738
  }) : null,
5697
- b.kind === "thread" && L ? /* @__PURE__ */ Q(So, {
5698
- thread: L,
5699
- authorName: oe,
5700
- currentClientId: le ?? null,
5701
- isVerified: se,
5702
- isIdentityResolving: ce,
5703
- isSigningIn: ye,
5704
- canDelete: Oe,
5705
- isPending: M,
5706
- error: N,
5707
- isHidden: ne,
5708
- onAuthor: ve,
5709
- onSignIn: be,
5710
- onClose: he,
5711
- onReply: Se,
5712
- onEditComment: Ce,
5713
- onDeleteComment: we,
5714
- onToggleReaction: Te,
5715
- onDelete: xe,
5716
- onResolve: F
5717
- }, L._id) : null,
5718
- b.kind === "composing-new" ? /* @__PURE__ */ Q(ho, {
5719
- pageX: b.pageX,
5720
- pageY: b.pageY,
5721
- authorName: oe,
5722
- isVerified: se,
5723
- isIdentityResolving: ce,
5724
- isSigningIn: ye,
5725
- isPending: M,
5726
- error: N,
5727
- screenshot: b.screenshot,
5728
- isScreenshotCapturing: b.isScreenshotCapturing,
5729
- screenshotRedactedCount: b.screenshotRedactedCount,
5730
- screenshotRedactedSelectors: b.screenshotRedactedSelectors,
5731
- onAuthor: ve,
5732
- onSignIn: be,
5733
- onSubmit: P,
5734
- onClose: he
5739
+ x.kind === "thread" && Fe ? /* @__PURE__ */ Q(So, {
5740
+ thread: Fe,
5741
+ authorName: ue,
5742
+ currentClientId: pe ?? null,
5743
+ isVerified: de,
5744
+ isIdentityResolving: fe,
5745
+ isSigningIn: I,
5746
+ canDelete: Ie,
5747
+ isPending: ne,
5748
+ error: re,
5749
+ isHidden: oe,
5750
+ onAuthor: be,
5751
+ onSignIn: xe,
5752
+ onClose: P,
5753
+ onReply: L,
5754
+ onEditComment: Te,
5755
+ onDeleteComment: Ee,
5756
+ onToggleReaction: De,
5757
+ onDelete: Ce,
5758
+ onResolve: we
5759
+ }, Fe._id) : null,
5760
+ x.kind === "composing-new" ? /* @__PURE__ */ Q(ho, {
5761
+ pageX: x.pageX,
5762
+ pageY: x.pageY,
5763
+ authorName: ue,
5764
+ isVerified: de,
5765
+ isIdentityResolving: fe,
5766
+ isSigningIn: I,
5767
+ isPending: ne,
5768
+ error: re,
5769
+ screenshot: x.screenshot,
5770
+ isScreenshotCapturing: x.isScreenshotCapturing,
5771
+ screenshotRedactedCount: x.screenshotRedactedCount,
5772
+ screenshotRedactedSelectors: x.screenshotRedactedSelectors,
5773
+ onAuthor: be,
5774
+ onSignIn: xe,
5775
+ onSubmit: Se,
5776
+ onClose: P
5735
5777
  }) : null,
5736
- !ne || b.kind === "placing" || b.kind === "composing-new" ? /* @__PURE__ */ Q(oo, {
5737
- isActive: b.kind === "placing",
5738
- onToggle: () => b.kind === "placing" ? he() : me(),
5739
- onHide: () => te({ type: "hide-with-toast" }),
5740
- position: g,
5741
- onPositionChange: _,
5778
+ !oe || x.kind === "placing" || x.kind === "composing-new" ? /* @__PURE__ */ Q(oo, {
5779
+ isActive: x.kind === "placing",
5780
+ onToggle: () => x.kind === "placing" ? P() : ve(),
5781
+ onHide: () => ae({ type: "hide-with-toast" }),
5782
+ position: _,
5783
+ onPositionChange: v,
5742
5784
  variant: r,
5743
5785
  menu: /* @__PURE__ */ Q(so, {
5744
- identity: f,
5745
- position: g,
5746
- isSigningIn: ye,
5747
- onSignIn: be,
5748
- onForgetMe: De
5786
+ identity: p,
5787
+ position: _,
5788
+ isSigningIn: I,
5789
+ isSigningOut: te,
5790
+ dashboardUrl: a,
5791
+ onSignIn: xe,
5792
+ onSignOut: Pe,
5793
+ onForgetMe: Ae
5749
5794
  })
5750
5795
  }) : null,
5751
- ee.kind === "hidden-with-toast" ? /* @__PURE__ */ Q(Po, { position: g }) : null,
5752
- I ? /* @__PURE__ */ Q(Fo, { position: g }) : null
5796
+ ie.kind === "hidden-with-toast" ? /* @__PURE__ */ Q(Po, { position: _ }) : null,
5797
+ Oe ? /* @__PURE__ */ Q(Fo, { position: _ }) : null,
5798
+ je ? /* @__PURE__ */ Q(Io, { position: _ }) : null
5753
5799
  ]
5754
5800
  });
5755
5801
  }
@@ -5781,62 +5827,71 @@ function Fo({ position: e }) {
5781
5827
  children: "Forgotten on this site — your name and email were cleared."
5782
5828
  });
5783
5829
  }
5830
+ function Io({ position: e }) {
5831
+ return /* @__PURE__ */ Q("div", {
5832
+ class: Z("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : e === "bottom-center" ? "markup-hud-hidden-toast-center" : "markup-hud-hidden-toast-right"),
5833
+ role: "status",
5834
+ "aria-live": "polite",
5835
+ children: "Signed out — commenting anonymously again."
5836
+ });
5837
+ }
5784
5838
  //#endregion
5785
5839
  //#region src/runtime/mount.tsx
5786
- function Io(e, t) {
5840
+ function Lo(e, t) {
5787
5841
  e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
5788
5842
  let n = t.theme ?? "auto";
5789
5843
  n !== "auto" && (e.dataset.theme = n);
5790
5844
  let r = e.attachShadow({ mode: "open" }), i = document.createElement("style");
5791
5845
  i.textContent = de, r.appendChild(i);
5792
5846
  let a = document.createElement("div");
5793
- a.className = "markup-shadow-root", r.appendChild(a), be({
5847
+ a.className = "markup-shadow-root", r.appendChild(a), ye({
5794
5848
  apiUrl: t.apiUrl,
5795
5849
  apiKey: t.apiKey,
5796
- widgetVersion: "1.12.0"
5850
+ widgetVersion: "1.13.0"
5797
5851
  });
5798
5852
  let { theme: o, ...s } = t;
5799
5853
  return ue(/* @__PURE__ */ Q(fe, {
5800
- onError: (e) => P(e, { context: "render" }),
5854
+ onError: (e) => F(e, { context: "render" }),
5801
5855
  children: /* @__PURE__ */ Q(No, { ...s })
5802
5856
  }), a), () => {
5803
- be(null), ue(null, a);
5857
+ ye(null), ue(null, a);
5804
5858
  };
5805
5859
  }
5806
5860
  //#endregion
5807
5861
  //#region src/widget.ts
5808
- var Lo = null, Ro = null, zo = null;
5809
- function Bo(e) {
5862
+ var Ro = null, zo = null, Bo = null;
5863
+ function Vo(e) {
5810
5864
  if (!e.apiUrl || !e.apiKey) return console.warn("[markup] init() requires both apiUrl and apiKey — widget not mounted"), () => {};
5811
- Vo();
5865
+ Ho();
5812
5866
  let t = () => {
5813
- if (zo = null, !document.body) return;
5867
+ if (Bo = null, !document.body) return;
5814
5868
  let t = document.createElement("div");
5815
- t.id = "markup-widget", document.body.appendChild(t), Ro = t, Lo = Io(t, e);
5869
+ t.id = "markup-widget", document.body.appendChild(t), zo = t, Ro = Lo(t, e);
5816
5870
  };
5817
5871
  if (document.readyState === "loading" || !document.body) {
5818
5872
  let e = () => t();
5819
- zo = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
5873
+ Bo = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
5820
5874
  } else t();
5821
- return Vo;
5875
+ return Ho;
5822
5876
  }
5823
- function Vo() {
5824
- zo &&= (zo(), null), Lo &&= (Lo(), null), Ro?.parentNode && Ro.parentNode.removeChild(Ro), Ro = null;
5877
+ function Ho() {
5878
+ Bo &&= (Bo(), null), Ro &&= (Ro(), null), zo?.parentNode && zo.parentNode.removeChild(zo), zo = null;
5825
5879
  }
5826
5880
  if (typeof document < "u") {
5827
5881
  let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
5828
5882
  if (t && n) {
5829
- let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => Bo({
5883
+ let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = e?.dataset.dashboardUrl, s = () => Vo({
5830
5884
  apiUrl: t,
5831
5885
  apiKey: n,
5832
5886
  position: r,
5833
5887
  theme: i,
5834
- fab: a
5888
+ fab: a,
5889
+ dashboardUrl: o
5835
5890
  });
5836
- document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", o, { once: !0 }) : o();
5891
+ document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", s, { once: !0 }) : s();
5837
5892
  }
5838
5893
  }
5839
5894
  //#endregion
5840
- export { Vo as destroy, Bo as init };
5895
+ export { Ho as destroy, Vo as init };
5841
5896
 
5842
5897
  //# sourceMappingURL=widget.js.map