@gamention/pulse-elements 0.1.4 → 0.1.5

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.
@@ -20,11 +20,11 @@ let bt = class extends Event {
20
20
  */
21
21
  let We = class {
22
22
  constructor(e, t, i, n) {
23
- if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (r, o) => {
24
- this.unsubscribe && (this.unsubscribe !== o && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = r, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(r, o)), this.unsubscribe = o;
23
+ if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (o, r) => {
24
+ this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = o, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(o, r)), this.unsubscribe = r;
25
25
  }, this.host = e, t.context !== void 0) {
26
- const r = t;
27
- this.context = r.context, this.callback = r.callback, this.subscribe = r.subscribe ?? !1;
26
+ const o = t;
27
+ this.context = o.context, this.callback = o.callback, this.subscribe = o.subscribe ?? !1;
28
28
  } else this.context = t, this.callback = i, this.subscribe = n ?? !1;
29
29
  this.host.addController(this);
30
30
  }
@@ -82,17 +82,17 @@ let At = class extends Event {
82
82
  }
83
83
  }, Ve = class extends Pt {
84
84
  constructor(e, t, i) {
85
- var n, r;
86
- super(t.context !== void 0 ? t.initialValue : i), this.onContextRequest = (o) => {
87
- if (o.context !== this.context) return;
88
- const l = o.contextTarget ?? o.composedPath()[0];
89
- l !== this.host && (o.stopPropagation(), this.addCallback(o.callback, l, o.subscribe));
90
- }, this.onProviderRequest = (o) => {
91
- if (o.context !== this.context || (o.contextTarget ?? o.composedPath()[0]) === this.host) return;
85
+ var n, o;
86
+ super(t.context !== void 0 ? t.initialValue : i), this.onContextRequest = (r) => {
87
+ if (r.context !== this.context) return;
88
+ const l = r.contextTarget ?? r.composedPath()[0];
89
+ l !== this.host && (r.stopPropagation(), this.addCallback(r.callback, l, r.subscribe));
90
+ }, this.onProviderRequest = (r) => {
91
+ if (r.context !== this.context || (r.contextTarget ?? r.composedPath()[0]) === this.host) return;
92
92
  const l = /* @__PURE__ */ new Set();
93
93
  for (const [a, { consumerHost: c }] of this.subscriptions) l.has(a) || (l.add(a), c.dispatchEvent(new bt(this.context, c, a, !0)));
94
- o.stopPropagation();
95
- }, this.host = e, t.context !== void 0 ? this.context = t.context : this.context = t, this.attachListeners(), (r = (n = this.host).addController) == null || r.call(n, this);
94
+ r.stopPropagation();
95
+ }, this.host = e, t.context !== void 0 ? this.context = t.context : this.context = t, this.attachListeners(), (o = (n = this.host).addController) == null || o.call(n, this);
96
96
  }
97
97
  attachListeners() {
98
98
  this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
@@ -117,25 +117,25 @@ function Mt({ context: s }) {
117
117
  return i.set(this, new Ve(this, { context: s, initialValue: n })), n;
118
118
  } };
119
119
  {
120
- e.constructor.addInitializer(((o) => {
121
- i.set(o, new Ve(o, { context: s }));
120
+ e.constructor.addInitializer(((r) => {
121
+ i.set(r, new Ve(r, { context: s }));
122
122
  }));
123
123
  const n = Object.getOwnPropertyDescriptor(e, t);
124
- let r;
124
+ let o;
125
125
  if (n === void 0) {
126
- const o = /* @__PURE__ */ new WeakMap();
127
- r = { get() {
128
- return o.get(this);
126
+ const r = /* @__PURE__ */ new WeakMap();
127
+ o = { get() {
128
+ return r.get(this);
129
129
  }, set(l) {
130
- i.get(this).setValue(l), o.set(this, l);
130
+ i.get(this).setValue(l), r.set(this, l);
131
131
  }, configurable: !0, enumerable: !0 };
132
132
  } else {
133
- const o = n.set;
134
- r = { ...n, set(l) {
135
- i.get(this).setValue(l), o == null || o.call(this, l);
133
+ const r = n.set;
134
+ o = { ...n, set(l) {
135
+ i.get(this).setValue(l), r == null || r.call(this, l);
136
136
  } };
137
137
  }
138
- return void Object.defineProperty(e, t, r);
138
+ return void Object.defineProperty(e, t, o);
139
139
  }
140
140
  };
141
141
  }
@@ -151,8 +151,8 @@ function he({ context: s, subscribe: e }) {
151
151
  t.set.call(this, n);
152
152
  }, subscribe: e });
153
153
  })) : t.constructor.addInitializer(((n) => {
154
- new We(n, { context: s, callback: (r) => {
155
- n[i] = r;
154
+ new We(n, { context: s, callback: (o) => {
155
+ n[i] = o;
156
156
  }, subscribe: e });
157
157
  }));
158
158
  };
@@ -248,8 +248,8 @@ let Le = class {
248
248
  const t = this._typing.get(e);
249
249
  if (!t) return [];
250
250
  const i = Date.now(), n = [];
251
- for (const [r, o] of t)
252
- i - o < 3e3 && n.push(r);
251
+ for (const [o, r] of t)
252
+ i - r < 3e3 && n.push(o);
253
253
  return n;
254
254
  }
255
255
  get viewports() {
@@ -527,8 +527,8 @@ let Le = class {
527
527
  body: i
528
528
  });
529
529
  if (!n.ok) {
530
- const r = await n.json().catch(() => ({ error: "Upload failed" }));
531
- throw new Error(r.error ?? "Upload failed");
530
+ const o = await n.json().catch(() => ({ error: "Upload failed" }));
531
+ throw new Error(o.error ?? "Upload failed");
532
532
  }
533
533
  return n.json();
534
534
  }
@@ -562,11 +562,11 @@ let xt = class {
562
562
  }
563
563
  };
564
564
  const zt = (s) => new xt(typeof s == "string" ? s : s + "", void 0, ze), M = (s, ...e) => {
565
- const t = s.length === 1 ? s[0] : e.reduce((i, n, r) => i + ((o) => {
566
- if (o._$cssResult$ === !0) return o.cssText;
567
- if (typeof o == "number") return o;
568
- throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
569
- })(n) + s[r + 1], s[0]);
565
+ const t = s.length === 1 ? s[0] : e.reduce((i, n, o) => i + ((r) => {
566
+ if (r._$cssResult$ === !0) return r.cssText;
567
+ if (typeof r == "number") return r;
568
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + r + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
569
+ })(n) + s[o + 1], s[0]);
570
570
  return new xt(t, s, ze);
571
571
  }, Ut = (s, e) => {
572
572
  if (je) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
@@ -628,14 +628,14 @@ let Y = class extends HTMLElement {
628
628
  }
629
629
  }
630
630
  static getPropertyDescriptor(e, t, i) {
631
- const { get: n, set: r } = Nt(this.prototype, e) ?? { get() {
631
+ const { get: n, set: o } = Nt(this.prototype, e) ?? { get() {
632
632
  return this[t];
633
- }, set(o) {
634
- this[t] = o;
633
+ }, set(r) {
634
+ this[t] = r;
635
635
  } };
636
- return { get: n, set(o) {
636
+ return { get: n, set(r) {
637
637
  const l = n == null ? void 0 : n.call(this);
638
- r == null || r.call(this, o), this.requestUpdate(e, l, i);
638
+ o == null || o.call(this, r), this.requestUpdate(e, l, i);
639
639
  }, configurable: !0, enumerable: !0 };
640
640
  }
641
641
  static getPropertyOptions(e) {
@@ -720,34 +720,34 @@ let Y = class extends HTMLElement {
720
720
  this._$AK(e, i);
721
721
  }
722
722
  _$ET(e, t) {
723
- var r;
723
+ var o;
724
724
  const i = this.constructor.elementProperties.get(e), n = this.constructor._$Eu(e, i);
725
725
  if (n !== void 0 && i.reflect === !0) {
726
- const o = (((r = i.converter) == null ? void 0 : r.toAttribute) !== void 0 ? i.converter : ye).toAttribute(t, i.type);
727
- this._$Em = e, o == null ? this.removeAttribute(n) : this.setAttribute(n, o), this._$Em = null;
726
+ const r = (((o = i.converter) == null ? void 0 : o.toAttribute) !== void 0 ? i.converter : ye).toAttribute(t, i.type);
727
+ this._$Em = e, r == null ? this.removeAttribute(n) : this.setAttribute(n, r), this._$Em = null;
728
728
  }
729
729
  }
730
730
  _$AK(e, t) {
731
- var r, o;
731
+ var o, r;
732
732
  const i = this.constructor, n = i._$Eh.get(e);
733
733
  if (n !== void 0 && this._$Em !== n) {
734
- const l = i.getPropertyOptions(n), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((r = l.converter) == null ? void 0 : r.fromAttribute) !== void 0 ? l.converter : ye;
734
+ const l = i.getPropertyOptions(n), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter : ye;
735
735
  this._$Em = n;
736
736
  const c = a.fromAttribute(t, l.type);
737
- this[n] = c ?? ((o = this._$Ej) == null ? void 0 : o.get(n)) ?? c, this._$Em = null;
737
+ this[n] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(n)) ?? c, this._$Em = null;
738
738
  }
739
739
  }
740
- requestUpdate(e, t, i, n = !1, r) {
741
- var o;
740
+ requestUpdate(e, t, i, n = !1, o) {
741
+ var r;
742
742
  if (e !== void 0) {
743
743
  const l = this.constructor;
744
- if (n === !1 && (r = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? Ue)(r, t) || i.useDefault && i.reflect && r === ((o = this._$Ej) == null ? void 0 : o.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return;
744
+ if (n === !1 && (o = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? Ue)(o, t) || i.useDefault && i.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return;
745
745
  this.C(e, t, i);
746
746
  }
747
747
  this.isUpdatePending === !1 && (this._$ES = this._$EP());
748
748
  }
749
- C(e, t, { useDefault: i, reflect: n, wrapped: r }, o) {
750
- i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, o ?? t ?? this[e]), r !== !0 || o !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), n === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
749
+ C(e, t, { useDefault: i, reflect: n, wrapped: o }, r) {
750
+ i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, r ?? t ?? this[e]), o !== !0 || r !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), n === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
751
751
  }
752
752
  async _$EP() {
753
753
  this.isUpdatePending = !0;
@@ -767,21 +767,21 @@ let Y = class extends HTMLElement {
767
767
  if (!this.isUpdatePending) return;
768
768
  if (!this.hasUpdated) {
769
769
  if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
770
- for (const [r, o] of this._$Ep) this[r] = o;
770
+ for (const [o, r] of this._$Ep) this[o] = r;
771
771
  this._$Ep = void 0;
772
772
  }
773
773
  const n = this.constructor.elementProperties;
774
- if (n.size > 0) for (const [r, o] of n) {
775
- const { wrapped: l } = o, a = this[r];
776
- l !== !0 || this._$AL.has(r) || a === void 0 || this.C(r, void 0, o, a);
774
+ if (n.size > 0) for (const [o, r] of n) {
775
+ const { wrapped: l } = r, a = this[o];
776
+ l !== !0 || this._$AL.has(o) || a === void 0 || this.C(o, void 0, r, a);
777
777
  }
778
778
  }
779
779
  let e = !1;
780
780
  const t = this._$AL;
781
781
  try {
782
782
  e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((n) => {
783
- var r;
784
- return (r = n.hostUpdate) == null ? void 0 : r.call(n);
783
+ var o;
784
+ return (o = n.hostUpdate) == null ? void 0 : o.call(n);
785
785
  }), this.update(t)) : this._$EM();
786
786
  } catch (n) {
787
787
  throw e = !1, this._$EM(), n;
@@ -832,21 +832,21 @@ function Et(s, e) {
832
832
  }
833
833
  const Kt = (s, e) => {
834
834
  const t = s.length - 1, i = [];
835
- let n, r = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = te;
835
+ let n, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
836
836
  for (let l = 0; l < t; l++) {
837
837
  const a = s[l];
838
838
  let c, h, p = -1, m = 0;
839
- for (; m < a.length && (o.lastIndex = m, h = o.exec(a), h !== null); ) m = o.lastIndex, o === te ? h[1] === "!--" ? o = Qe : h[1] !== void 0 ? o = et : h[2] !== void 0 ? ($t.test(h[2]) && (n = RegExp("</" + h[2], "g")), o = H) : h[3] !== void 0 && (o = H) : o === H ? h[0] === ">" ? (o = n ?? te, p = -1) : h[1] === void 0 ? p = -2 : (p = o.lastIndex - h[2].length, c = h[1], o = h[3] === void 0 ? H : h[3] === '"' ? it : tt) : o === it || o === tt ? o = H : o === Qe || o === et ? o = te : (o = H, n = void 0);
840
- const f = o === H && s[l + 1].startsWith("/>") ? " " : "";
841
- r += o === te ? a + Vt : p >= 0 ? (i.push(c), a.slice(0, p) + yt + a.slice(p) + z + f) : a + z + (p === -2 ? l : f);
839
+ for (; m < a.length && (r.lastIndex = m, h = r.exec(a), h !== null); ) m = r.lastIndex, r === te ? h[1] === "!--" ? r = Qe : h[1] !== void 0 ? r = et : h[2] !== void 0 ? ($t.test(h[2]) && (n = RegExp("</" + h[2], "g")), r = H) : h[3] !== void 0 && (r = H) : r === H ? h[0] === ">" ? (r = n ?? te, p = -1) : h[1] === void 0 ? p = -2 : (p = r.lastIndex - h[2].length, c = h[1], r = h[3] === void 0 ? H : h[3] === '"' ? it : tt) : r === it || r === tt ? r = H : r === Qe || r === et ? r = te : (r = H, n = void 0);
840
+ const f = r === H && s[l + 1].startsWith("/>") ? " " : "";
841
+ o += r === te ? a + Vt : p >= 0 ? (i.push(c), a.slice(0, p) + yt + a.slice(p) + z + f) : a + z + (p === -2 ? l : f);
842
842
  }
843
- return [Et(s, r + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
843
+ return [Et(s, o + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
844
844
  };
845
845
  class re {
846
846
  constructor({ strings: e, _$litType$: t }, i) {
847
847
  let n;
848
848
  this.parts = [];
849
- let r = 0, o = 0;
849
+ let o = 0, r = 0;
850
850
  const l = e.length - 1, a = this.parts, [c, h] = Kt(e, t);
851
851
  if (this.el = re.createElement(c, i), N.currentNode = this.el.content, t === 2 || t === 3) {
852
852
  const p = this.el.content.firstChild;
@@ -855,23 +855,23 @@ class re {
855
855
  for (; (n = N.nextNode()) !== null && a.length < l; ) {
856
856
  if (n.nodeType === 1) {
857
857
  if (n.hasAttributes()) for (const p of n.getAttributeNames()) if (p.endsWith(yt)) {
858
- const m = h[o++], f = n.getAttribute(p).split(z), b = /([.?@])?(.*)/.exec(m);
859
- a.push({ type: 1, index: r, name: b[2], strings: f, ctor: b[1] === "." ? Jt : b[1] === "?" ? Zt : b[1] === "@" ? Qt : Ee }), n.removeAttribute(p);
860
- } else p.startsWith(z) && (a.push({ type: 6, index: r }), n.removeAttribute(p));
858
+ const m = h[r++], f = n.getAttribute(p).split(z), b = /([.?@])?(.*)/.exec(m);
859
+ a.push({ type: 1, index: o, name: b[2], strings: f, ctor: b[1] === "." ? Jt : b[1] === "?" ? Zt : b[1] === "@" ? Qt : Ee }), n.removeAttribute(p);
860
+ } else p.startsWith(z) && (a.push({ type: 6, index: o }), n.removeAttribute(p));
861
861
  if ($t.test(n.tagName)) {
862
862
  const p = n.textContent.split(z), m = p.length - 1;
863
863
  if (m > 0) {
864
864
  n.textContent = we ? we.emptyScript : "";
865
- for (let f = 0; f < m; f++) n.append(p[f], ne()), N.nextNode(), a.push({ type: 2, index: ++r });
865
+ for (let f = 0; f < m; f++) n.append(p[f], ne()), N.nextNode(), a.push({ type: 2, index: ++o });
866
866
  n.append(p[m], ne());
867
867
  }
868
868
  }
869
- } else if (n.nodeType === 8) if (n.data === wt) a.push({ type: 2, index: r });
869
+ } else if (n.nodeType === 8) if (n.data === wt) a.push({ type: 2, index: o });
870
870
  else {
871
871
  let p = -1;
872
- for (; (p = n.data.indexOf(z, p + 1)) !== -1; ) a.push({ type: 7, index: r }), p += z.length - 1;
872
+ for (; (p = n.data.indexOf(z, p + 1)) !== -1; ) a.push({ type: 7, index: o }), p += z.length - 1;
873
873
  }
874
- r++;
874
+ o++;
875
875
  }
876
876
  }
877
877
  static createElement(e, t) {
@@ -880,11 +880,11 @@ class re {
880
880
  }
881
881
  }
882
882
  function K(s, e, t = s, i) {
883
- var o, l;
883
+ var r, l;
884
884
  if (e === q) return e;
885
- let n = i !== void 0 ? (o = t._$Co) == null ? void 0 : o[i] : t._$Cl;
886
- const r = oe(e) ? void 0 : e._$litDirective$;
887
- return (n == null ? void 0 : n.constructor) !== r && ((l = n == null ? void 0 : n._$AO) == null || l.call(n, !1), r === void 0 ? n = void 0 : (n = new r(s), n._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = n : t._$Cl = n), n !== void 0 && (e = K(s, n._$AS(s, e.values), n, i)), e;
885
+ let n = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
886
+ const o = oe(e) ? void 0 : e._$litDirective$;
887
+ return (n == null ? void 0 : n.constructor) !== o && ((l = n == null ? void 0 : n._$AO) == null || l.call(n, !1), o === void 0 ? n = void 0 : (n = new o(s), n._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = n : t._$Cl = n), n !== void 0 && (e = K(s, n._$AS(s, e.values), n, i)), e;
888
888
  }
889
889
  class Gt {
890
890
  constructor(e, t) {
@@ -899,13 +899,13 @@ class Gt {
899
899
  u(e) {
900
900
  const { el: { content: t }, parts: i } = this._$AD, n = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
901
901
  N.currentNode = n;
902
- let r = N.nextNode(), o = 0, l = 0, a = i[0];
902
+ let o = N.nextNode(), r = 0, l = 0, a = i[0];
903
903
  for (; a !== void 0; ) {
904
- if (o === a.index) {
904
+ if (r === a.index) {
905
905
  let c;
906
- a.type === 2 ? c = new pe(r, r.nextSibling, this, e) : a.type === 1 ? c = new a.ctor(r, a.name, a.strings, this, e) : a.type === 6 && (c = new ei(r, this, e)), this._$AV.push(c), a = i[++l];
906
+ a.type === 2 ? c = new pe(o, o.nextSibling, this, e) : a.type === 1 ? c = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (c = new ei(o, this, e)), this._$AV.push(c), a = i[++l];
907
907
  }
908
- o !== (a == null ? void 0 : a.index) && (r = N.nextNode(), o++);
908
+ r !== (a == null ? void 0 : a.index) && (o = N.nextNode(), r++);
909
909
  }
910
910
  return N.currentNode = F, n;
911
911
  }
@@ -946,12 +946,12 @@ class pe {
946
946
  this._$AH !== u && oe(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
947
947
  }
948
948
  $(e) {
949
- var r;
949
+ var o;
950
950
  const { values: t, _$litType$: i } = e, n = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = re.createElement(Et(i.h, i.h[0]), this.options)), i);
951
- if (((r = this._$AH) == null ? void 0 : r._$AD) === n) this._$AH.p(t);
951
+ if (((o = this._$AH) == null ? void 0 : o._$AD) === n) this._$AH.p(t);
952
952
  else {
953
- const o = new Gt(n, this), l = o.u(this.options);
954
- o.p(t), this.T(l), this._$AH = o;
953
+ const r = new Gt(n, this), l = r.u(this.options);
954
+ r.p(t), this.T(l), this._$AH = r;
955
955
  }
956
956
  }
957
957
  _$AC(e) {
@@ -962,7 +962,7 @@ class pe {
962
962
  De(this._$AH) || (this._$AH = [], this._$AR());
963
963
  const t = this._$AH;
964
964
  let i, n = 0;
965
- for (const r of e) n === t.length ? t.push(i = new pe(this.O(ne()), this.O(ne()), this, this.options)) : i = t[n], i._$AI(r), n++;
965
+ for (const o of e) n === t.length ? t.push(i = new pe(this.O(ne()), this.O(ne()), this, this.options)) : i = t[n], i._$AI(o), n++;
966
966
  n < t.length && (this._$AR(i && i._$AB.nextSibling, n), t.length = n);
967
967
  }
968
968
  _$AR(e = this._$AA.nextSibling, t) {
@@ -984,19 +984,19 @@ class Ee {
984
984
  get _$AU() {
985
985
  return this._$AM._$AU;
986
986
  }
987
- constructor(e, t, i, n, r) {
988
- this.type = 1, this._$AH = u, this._$AN = void 0, this.element = e, this.name = t, this._$AM = n, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
987
+ constructor(e, t, i, n, o) {
988
+ this.type = 1, this._$AH = u, this._$AN = void 0, this.element = e, this.name = t, this._$AM = n, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = u;
989
989
  }
990
990
  _$AI(e, t = this, i, n) {
991
- const r = this.strings;
992
- let o = !1;
993
- if (r === void 0) e = K(this, e, t, 0), o = !oe(e) || e !== this._$AH && e !== q, o && (this._$AH = e);
991
+ const o = this.strings;
992
+ let r = !1;
993
+ if (o === void 0) e = K(this, e, t, 0), r = !oe(e) || e !== this._$AH && e !== q, r && (this._$AH = e);
994
994
  else {
995
995
  const l = e;
996
996
  let a, c;
997
- for (e = r[0], a = 0; a < r.length - 1; a++) c = K(this, l[i + a], t, a), c === q && (c = this._$AH[a]), o || (o = !oe(c) || c !== this._$AH[a]), c === u ? e = u : e !== u && (e += (c ?? "") + r[a + 1]), this._$AH[a] = c;
997
+ for (e = o[0], a = 0; a < o.length - 1; a++) c = K(this, l[i + a], t, a), c === q && (c = this._$AH[a]), r || (r = !oe(c) || c !== this._$AH[a]), c === u ? e = u : e !== u && (e += (c ?? "") + o[a + 1]), this._$AH[a] = c;
998
998
  }
999
- o && !n && this.j(e);
999
+ r && !n && this.j(e);
1000
1000
  }
1001
1001
  j(e) {
1002
1002
  e === u ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
@@ -1019,13 +1019,13 @@ class Zt extends Ee {
1019
1019
  }
1020
1020
  }
1021
1021
  class Qt extends Ee {
1022
- constructor(e, t, i, n, r) {
1023
- super(e, t, i, n, r), this.type = 5;
1022
+ constructor(e, t, i, n, o) {
1023
+ super(e, t, i, n, o), this.type = 5;
1024
1024
  }
1025
1025
  _$AI(e, t = this) {
1026
1026
  if ((e = K(this, e, t, 0) ?? u) === q) return;
1027
- const i = this._$AH, n = e === u && i !== u || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, r = e !== u && (i === u || n);
1028
- n && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, e), this._$AH = e;
1027
+ const i = this._$AH, n = e === u && i !== u || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== u && (i === u || n);
1028
+ n && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
1029
1029
  }
1030
1030
  handleEvent(e) {
1031
1031
  var t;
@@ -1049,8 +1049,8 @@ const ti = (s, e, t) => {
1049
1049
  const i = (t == null ? void 0 : t.renderBefore) ?? e;
1050
1050
  let n = i._$litPart$;
1051
1051
  if (n === void 0) {
1052
- const r = (t == null ? void 0 : t.renderBefore) ?? null;
1053
- i._$litPart$ = n = new pe(e.insertBefore(ne(), r), r, void 0, t ?? {});
1052
+ const o = (t == null ? void 0 : t.renderBefore) ?? null;
1053
+ i._$litPart$ = n = new pe(e.insertBefore(ne(), o), o, void 0, t ?? {});
1054
1054
  }
1055
1055
  return n._$AI(s), n;
1056
1056
  };
@@ -1107,29 +1107,29 @@ const R = (s) => (e, t) => {
1107
1107
  */
1108
1108
  const ii = { attribute: !0, type: String, converter: ye, reflect: !1, hasChanged: Ue }, si = (s = ii, e, t) => {
1109
1109
  const { kind: i, metadata: n } = t;
1110
- let r = globalThis.litPropertyMetadata.get(n);
1111
- if (r === void 0 && globalThis.litPropertyMetadata.set(n, r = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), r.set(t.name, s), i === "accessor") {
1112
- const { name: o } = t;
1110
+ let o = globalThis.litPropertyMetadata.get(n);
1111
+ if (o === void 0 && globalThis.litPropertyMetadata.set(n, o = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), o.set(t.name, s), i === "accessor") {
1112
+ const { name: r } = t;
1113
1113
  return { set(l) {
1114
1114
  const a = e.get.call(this);
1115
- e.set.call(this, l), this.requestUpdate(o, a, s, !0, l);
1115
+ e.set.call(this, l), this.requestUpdate(r, a, s, !0, l);
1116
1116
  }, init(l) {
1117
- return l !== void 0 && this.C(o, void 0, s, l), l;
1117
+ return l !== void 0 && this.C(r, void 0, s, l), l;
1118
1118
  } };
1119
1119
  }
1120
1120
  if (i === "setter") {
1121
- const { name: o } = t;
1121
+ const { name: r } = t;
1122
1122
  return function(l) {
1123
- const a = this[o];
1124
- e.call(this, l), this.requestUpdate(o, a, s, !0, l);
1123
+ const a = this[r];
1124
+ e.call(this, l), this.requestUpdate(r, a, s, !0, l);
1125
1125
  };
1126
1126
  }
1127
1127
  throw Error("Unsupported decorator location: " + i);
1128
1128
  };
1129
1129
  function g(s) {
1130
- return (e, t) => typeof t == "object" ? si(s, e, t) : ((i, n, r) => {
1131
- const o = n.hasOwnProperty(r);
1132
- return n.constructor.createProperty(r, i), o ? Object.getOwnPropertyDescriptor(n, r) : void 0;
1130
+ return (e, t) => typeof t == "object" ? si(s, e, t) : ((i, n, o) => {
1131
+ const r = n.hasOwnProperty(o);
1132
+ return n.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(n, o) : void 0;
1133
1133
  })(s, e, t);
1134
1134
  }
1135
1135
  /**
@@ -1142,8 +1142,8 @@ function v(s) {
1142
1142
  }
1143
1143
  const J = "pulse-client";
1144
1144
  var ni = Object.defineProperty, oi = Object.getOwnPropertyDescriptor, Z = (s, e, t, i) => {
1145
- for (var n = i > 1 ? void 0 : i ? oi(e, t) : e, r = s.length - 1, o; r >= 0; r--)
1146
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
1145
+ for (var n = i > 1 ? void 0 : i ? oi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1146
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1147
1147
  return i && n && ni(e, t, n), n;
1148
1148
  };
1149
1149
  let W = class extends S {
@@ -1187,8 +1187,8 @@ W = Z([
1187
1187
  R("pulse-provider")
1188
1188
  ], W);
1189
1189
  var ri = Object.defineProperty, ai = Object.getOwnPropertyDescriptor, Ce = (s, e, t, i) => {
1190
- for (var n = i > 1 ? void 0 : i ? ai(e, t) : e, r = s.length - 1, o; r >= 0; r--)
1191
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
1190
+ for (var n = i > 1 ? void 0 : i ? ai(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1191
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1192
1192
  return i && n && ri(e, t, n), n;
1193
1193
  };
1194
1194
  let G = class extends S {
@@ -1353,8 +1353,8 @@ G = Ce([
1353
1353
  R("pulse-presence")
1354
1354
  ], G);
1355
1355
  var li = Object.defineProperty, ci = Object.getOwnPropertyDescriptor, He = (s, e, t, i) => {
1356
- for (var n = i > 1 ? void 0 : i ? ci(e, t) : e, r = s.length - 1, o; r >= 0; r--)
1357
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
1356
+ for (var n = i > 1 ? void 0 : i ? ci(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1357
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1358
1358
  return i && n && li(e, t, n), n;
1359
1359
  };
1360
1360
  let ae = class extends S {
@@ -1482,8 +1482,8 @@ ae = He([
1482
1482
  R("pulse-cursors")
1483
1483
  ], ae);
1484
1484
  var di = Object.defineProperty, hi = Object.getOwnPropertyDescriptor, ue = (s, e, t, i) => {
1485
- for (var n = i > 1 ? void 0 : i ? hi(e, t) : e, r = s.length - 1, o; r >= 0; r--)
1486
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
1485
+ for (var n = i > 1 ? void 0 : i ? hi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1486
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1487
1487
  return i && n && di(e, t, n), n;
1488
1488
  };
1489
1489
  let V = class extends S {
@@ -1522,15 +1522,15 @@ let V = class extends S {
1522
1522
  s.preventDefault();
1523
1523
  const t = s.target.querySelector("textarea"), i = t.value.trim();
1524
1524
  if (!i) return;
1525
- const n = [...i.matchAll(/@(\w+)/g)].map((r) => r[1]);
1525
+ const n = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
1526
1526
  this.client.createThread(i, { mentions: n }), t.value = "";
1527
1527
  }
1528
1528
  handleReply(s, e) {
1529
1529
  e.preventDefault();
1530
1530
  const i = e.target.querySelector("input"), n = i.value.trim();
1531
1531
  if (!n) return;
1532
- const r = [...n.matchAll(/@(\w+)/g)].map((o) => o[1]);
1533
- this.client.reply(s, n, r), i.value = "", this.replyingTo = null;
1532
+ const o = [...n.matchAll(/@(\w+)/g)].map((r) => r[1]);
1533
+ this.client.reply(s, n, o), i.value = "", this.replyingTo = null;
1534
1534
  }
1535
1535
  render() {
1536
1536
  const s = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
@@ -1600,8 +1600,8 @@ let V = class extends S {
1600
1600
  const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1601
1601
  if (n < 1) return "just now";
1602
1602
  if (n < 60) return `${n}m ago`;
1603
- const r = Math.floor(n / 60);
1604
- return r < 24 ? `${r}h ago` : e.toLocaleDateString();
1603
+ const o = Math.floor(n / 60);
1604
+ return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1605
1605
  }
1606
1606
  };
1607
1607
  V.styles = M`
@@ -1833,8 +1833,8 @@ V = ue([
1833
1833
  R("pulse-comments")
1834
1834
  ], V);
1835
1835
  var pi = Object.defineProperty, ui = Object.getOwnPropertyDescriptor, Ne = (s, e, t, i) => {
1836
- for (var n = i > 1 ? void 0 : i ? ui(e, t) : e, r = s.length - 1, o; r >= 0; r--)
1837
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
1836
+ for (var n = i > 1 ? void 0 : i ? ui(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1837
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1838
1838
  return i && n && pi(e, t, n), n;
1839
1839
  };
1840
1840
  const fi = {
@@ -1892,8 +1892,8 @@ let le = class extends S {
1892
1892
  const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1893
1893
  if (n < 1) return "just now";
1894
1894
  if (n < 60) return `${n}m ago`;
1895
- const r = Math.floor(n / 60);
1896
- return r < 24 ? `${r}h ago` : e.toLocaleDateString();
1895
+ const o = Math.floor(n / 60);
1896
+ return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1897
1897
  }
1898
1898
  render() {
1899
1899
  const s = this.notifications.filter((e) => !e.read).length;
@@ -2085,8 +2085,8 @@ le = Ne([
2085
2085
  R("pulse-notifications")
2086
2086
  ], le);
2087
2087
  var gi = Object.defineProperty, bi = Object.getOwnPropertyDescriptor, Q = (s, e, t, i) => {
2088
- for (var n = i > 1 ? void 0 : i ? bi(e, t) : e, r = s.length - 1, o; r >= 0; r--)
2089
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
2088
+ for (var n = i > 1 ? void 0 : i ? bi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2089
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2090
2090
  return i && n && gi(e, t, n), n;
2091
2091
  };
2092
2092
  const vi = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
@@ -2114,12 +2114,12 @@ let D = class extends S {
2114
2114
  var t, i;
2115
2115
  const s = /* @__PURE__ */ new Map(), e = (i = (t = this.client) == null ? void 0 : t.state.user) == null ? void 0 : i.id;
2116
2116
  for (const n of this.reactions) {
2117
- const r = s.get(n.emoji) ?? { count: 0, userReactionId: null };
2118
- r.count++, n.userId === e && (r.userReactionId = n.id), s.set(n.emoji, r);
2117
+ const o = s.get(n.emoji) ?? { count: 0, userReactionId: null };
2118
+ o.count++, n.userId === e && (o.userReactionId = n.id), s.set(n.emoji, o);
2119
2119
  }
2120
- return [...s.entries()].map(([n, r]) => ({
2120
+ return [...s.entries()].map(([n, o]) => ({
2121
2121
  emoji: n,
2122
- ...r
2122
+ ...o
2123
2123
  }));
2124
2124
  }
2125
2125
  toggleReaction(s) {
@@ -2516,7 +2516,7 @@ const Ii = [
2516
2516
  ];
2517
2517
  function Oi(s) {
2518
2518
  return s.map(([e, t]) => {
2519
- const i = Object.entries(t).filter(([, n]) => n != null).map(([n, r]) => `${n}="${r}"`).join(" ");
2519
+ const i = Object.entries(t).filter(([, n]) => n != null).map(([n, o]) => `${n}="${o}"`).join(" ");
2520
2520
  return `<${e} ${i}/>`;
2521
2521
  }).join("");
2522
2522
  }
@@ -2633,8 +2633,8 @@ const ee = M`
2633
2633
  }
2634
2634
  `;
2635
2635
  var Ri = Object.defineProperty, Li = Object.getOwnPropertyDescriptor, Be = (s, e, t, i) => {
2636
- for (var n = i > 1 ? void 0 : i ? Li(e, t) : e, r = s.length - 1, o; r >= 0; r--)
2637
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
2636
+ for (var n = i > 1 ? void 0 : i ? Li(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2637
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2638
2638
  return i && n && Ri(e, t, n), n;
2639
2639
  };
2640
2640
  let X = class extends S {
@@ -2872,9 +2872,9 @@ class Oe {
2872
2872
  * element once metadata has loaded.
2873
2873
  */
2874
2874
  static render(e, t) {
2875
- let i = !1, n = t != null ? t / 1e3 : 0, r = 0;
2876
- const o = document.createElement("audio");
2877
- o.preload = "metadata", o.src = e;
2875
+ let i = !1, n = t != null ? t / 1e3 : 0, o = 0;
2876
+ const r = document.createElement("audio");
2877
+ r.preload = "metadata", r.src = e;
2878
2878
  const l = document.createElement("div");
2879
2879
  Object.assign(l.style, {
2880
2880
  display: "inline-flex",
@@ -2964,12 +2964,12 @@ class Oe {
2964
2964
  lineHeight: "1"
2965
2965
  });
2966
2966
  function _() {
2967
- const k = at(r), A = at(n);
2967
+ const k = at(o), A = at(n);
2968
2968
  x.textContent = `${k} / ${A}`;
2969
2969
  }
2970
2970
  _(), m.appendChild(f), m.appendChild(x), l.appendChild(a), l.appendChild(m);
2971
2971
  function $() {
2972
- const k = n > 0 ? r / n : 0, A = Math.floor(k * ve);
2972
+ const k = n > 0 ? o / n : 0, A = Math.floor(k * ve);
2973
2973
  for (let w = 0; w < ve; w++)
2974
2974
  b[w].style.background = w <= A ? nt : ot;
2975
2975
  }
@@ -2979,22 +2979,22 @@ class Oe {
2979
2979
  1,
2980
2980
  Math.max(0, (k.clientX - A.left) / A.width)
2981
2981
  );
2982
- o.currentTime = w * n, r = o.currentTime, $(), _();
2982
+ r.currentTime = w * n, o = r.currentTime, $(), _();
2983
2983
  }), a.addEventListener("click", () => {
2984
- i ? o.pause() : o.play().catch(() => {
2984
+ i ? r.pause() : r.play().catch(() => {
2985
2985
  });
2986
- }), o.addEventListener("play", () => {
2986
+ }), r.addEventListener("play", () => {
2987
2987
  i = !0, p();
2988
- }), o.addEventListener("pause", () => {
2988
+ }), r.addEventListener("pause", () => {
2989
2989
  i = !1, h();
2990
- }), o.addEventListener("ended", () => {
2991
- i = !1, h(), r = 0, $(), _();
2992
- }), o.addEventListener("timeupdate", () => {
2993
- r = o.currentTime, $(), _();
2994
- }), o.addEventListener("loadedmetadata", () => {
2995
- o.duration && isFinite(o.duration) && (n = o.duration, _());
2996
- }), o.addEventListener("durationchange", () => {
2997
- o.duration && isFinite(o.duration) && (n = o.duration, _());
2990
+ }), r.addEventListener("ended", () => {
2991
+ i = !1, h(), o = 0, $(), _();
2992
+ }), r.addEventListener("timeupdate", () => {
2993
+ o = r.currentTime, $(), _();
2994
+ }), r.addEventListener("loadedmetadata", () => {
2995
+ r.duration && isFinite(r.duration) && (n = r.duration, _());
2996
+ }), r.addEventListener("durationchange", () => {
2997
+ r.duration && isFinite(r.duration) && (n = r.duration, _());
2998
2998
  }), l;
2999
2999
  }
3000
3000
  }
@@ -3014,20 +3014,20 @@ class Re {
3014
3014
  this.analyser = this.audioCtx.createAnalyser(), this.analyser.fftSize = 64, t.connect(this.analyser);
3015
3015
  const i = this.detectMimeType(), n = {};
3016
3016
  i && (n.mimeType = i), this.recorder = new MediaRecorder(this.stream, n);
3017
- const r = [];
3017
+ const o = [];
3018
3018
  this.recorder.ondataavailable = (l) => {
3019
- l.data.size > 0 && r.push(l.data);
3019
+ l.data.size > 0 && o.push(l.data);
3020
3020
  }, this.buildUI(e);
3021
- const o = new Promise((l) => {
3021
+ const r = new Promise((l) => {
3022
3022
  this.resolve = l;
3023
3023
  });
3024
3024
  return this.recorder.onstop = () => {
3025
3025
  var c, h;
3026
- const l = ((c = this.recorder) == null ? void 0 : c.mimeType) || i || "audio/webm", a = new Blob(r, { type: l });
3026
+ const l = ((c = this.recorder) == null ? void 0 : c.mimeType) || i || "audio/webm", a = new Blob(o, { type: l });
3027
3027
  (h = this.resolve) == null || h.call(this, a), this.resolve = null, this.cleanupResources();
3028
3028
  }, this.recorder.start(), this.recording = !0, this.startTime = Date.now(), this.maxTimer = setTimeout(() => {
3029
3029
  this.stopRecording();
3030
- }, this.maxDuration), this.animate(), o;
3030
+ }, this.maxDuration), this.animate(), r;
3031
3031
  }
3032
3032
  /** Stops recording — resolves the promise with the recorded Blob. */
3033
3033
  stopRecording() {
@@ -3125,11 +3125,11 @@ class Re {
3125
3125
  if (!this.canvas || !this.analyser) return;
3126
3126
  const e = this.canvas.getContext("2d");
3127
3127
  if (!e) return;
3128
- const t = this.canvas.width, i = this.canvas.height, n = this.analyser.frequencyBinCount, r = new Uint8Array(n);
3129
- this.analyser.getByteFrequencyData(r), e.clearRect(0, 0, t, i);
3130
- const o = n, l = Math.max(2, t / o * 0.7), a = (t - l * o) / (o - 1 || 1);
3131
- for (let c = 0; c < o; c++) {
3132
- const h = r[c] / 255, p = Math.max(2, h * i * 0.85), m = c * (l + a), f = (i - p) / 2, b = 0.4 + h * 0.6;
3128
+ const t = this.canvas.width, i = this.canvas.height, n = this.analyser.frequencyBinCount, o = new Uint8Array(n);
3129
+ this.analyser.getByteFrequencyData(o), e.clearRect(0, 0, t, i);
3130
+ const r = n, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
3131
+ for (let c = 0; c < r; c++) {
3132
+ const h = o[c] / 255, p = Math.max(2, h * i * 0.85), m = c * (l + a), f = (i - p) / 2, b = 0.4 + h * 0.6;
3133
3133
  e.fillStyle = `rgba(99, 102, 241, ${b})`, e.beginPath(), e.roundRect(m, f, l, p, 1), e.fill();
3134
3134
  }
3135
3135
  }
@@ -3171,8 +3171,8 @@ class _t {
3171
3171
  */
3172
3172
  static render(e, t) {
3173
3173
  let i = !1, n = !0;
3174
- const r = document.createElement("div");
3175
- Object.assign(r.style, {
3174
+ const o = document.createElement("div");
3175
+ Object.assign(o.style, {
3176
3176
  position: "relative",
3177
3177
  display: "inline-block",
3178
3178
  width: `${lt}px`,
@@ -3186,14 +3186,14 @@ class _t {
3186
3186
  userSelect: "none",
3187
3187
  WebkitUserSelect: "none"
3188
3188
  });
3189
- const o = document.createElement("video");
3190
- Object.assign(o.style, {
3189
+ const r = document.createElement("video");
3190
+ Object.assign(r.style, {
3191
3191
  width: "100%",
3192
3192
  height: "100%",
3193
3193
  objectFit: "cover",
3194
3194
  display: "block",
3195
3195
  borderRadius: "50%"
3196
- }), o.src = e, o.loop = !0, o.muted = !0, o.playsInline = !0, o.preload = "metadata", t && (o.poster = t), r.appendChild(o);
3196
+ }), r.src = e, r.loop = !0, r.muted = !0, r.playsInline = !0, r.preload = "metadata", t && (r.poster = t), o.appendChild(r);
3197
3197
  const l = document.createElement("div");
3198
3198
  Object.assign(l.style, {
3199
3199
  position: "absolute",
@@ -3208,7 +3208,7 @@ class _t {
3208
3208
  transition: "opacity 0.25s ease",
3209
3209
  opacity: "1",
3210
3210
  pointerEvents: "none"
3211
- }), l.innerHTML = Ni, r.appendChild(l);
3211
+ }), l.innerHTML = Ni, o.appendChild(l);
3212
3212
  const a = document.createElement("div");
3213
3213
  Object.assign(a.style, {
3214
3214
  position: "absolute",
@@ -3223,19 +3223,19 @@ class _t {
3223
3223
  justifyContent: "center",
3224
3224
  pointerEvents: "none",
3225
3225
  transition: "opacity 0.2s ease"
3226
- }), a.innerHTML = ct, r.appendChild(a);
3226
+ }), a.innerHTML = ct, o.appendChild(a);
3227
3227
  function c() {
3228
3228
  l.style.opacity = i ? "0" : "1";
3229
3229
  }
3230
3230
  function h() {
3231
3231
  a.style.display = i ? "flex" : "none", a.innerHTML = n ? ct : Bi;
3232
3232
  }
3233
- return r.addEventListener("click", (p) => {
3234
- p.stopPropagation(), i ? n ? (o.muted = !1, n = !1) : (o.pause(), i = !1, n = !0, o.muted = !0) : (o.muted = !0, n = !0, o.play().catch(() => {
3233
+ return o.addEventListener("click", (p) => {
3234
+ p.stopPropagation(), i ? n ? (r.muted = !1, n = !1) : (r.pause(), i = !1, n = !0, r.muted = !0) : (r.muted = !0, n = !0, r.play().catch(() => {
3235
3235
  }), i = !0), c(), h();
3236
- }), o.addEventListener("pause", () => {
3237
- i && (i = !1, n = !0, o.muted = !0, c(), h());
3238
- }), r;
3236
+ }), r.addEventListener("pause", () => {
3237
+ i && (i = !1, n = !0, r.muted = !0, c(), h());
3238
+ }), o;
3239
3239
  }
3240
3240
  }
3241
3241
  const dt = 60, Fi = `
@@ -3369,8 +3369,8 @@ function Vi(s) {
3369
3369
  n.muted = !0, n.playsInline = !0, n.preload = "auto", n.src = i, n.addEventListener("loadeddata", () => {
3370
3370
  n.currentTime = 0.01;
3371
3371
  }), n.addEventListener("seeked", () => {
3372
- const r = document.createElement("canvas");
3373
- r.width = n.videoWidth || 240, r.height = n.videoHeight || 240, r.getContext("2d").drawImage(n, 0, 0, r.width, r.height), URL.revokeObjectURL(i), r.toBlob(
3372
+ const o = document.createElement("canvas");
3373
+ o.width = n.videoWidth || 240, o.height = n.videoHeight || 240, o.getContext("2d").drawImage(n, 0, 0, o.width, o.height), URL.revokeObjectURL(i), o.toBlob(
3374
3374
  (l) => {
3375
3375
  l ? e(l) : t(new Error("Failed to generate poster frame"));
3376
3376
  },
@@ -3401,15 +3401,15 @@ class Xi {
3401
3401
  }));
3402
3402
  const i = Wi(), n = {};
3403
3403
  i && (n.mimeType = i);
3404
- const r = new MediaRecorder(t, n);
3405
- return this.mediaRecorder = r, r.ondataavailable = (o) => {
3406
- o.data.size > 0 && this.chunks.push(o.data);
3407
- }, r.onstop = () => {
3404
+ const o = new MediaRecorder(t, n);
3405
+ return this.mediaRecorder = o, o.ondataavailable = (r) => {
3406
+ r.data.size > 0 && this.chunks.push(r.data);
3407
+ }, o.onstop = () => {
3408
3408
  this.handleRecordingComplete();
3409
- }, r.start(), this.timerInterval = setInterval(() => {
3409
+ }, o.start(), this.timerInterval = setInterval(() => {
3410
3410
  this.elapsed++, this.updateTimer(), this.elapsed >= dt && this.stopRecording();
3411
- }, 1e3), new Promise((o) => {
3412
- this.resolvePromise = o;
3411
+ }, 1e3), new Promise((r) => {
3412
+ this.resolvePromise = r;
3413
3413
  });
3414
3414
  }
3415
3415
  stopRecording() {
@@ -3431,12 +3431,12 @@ class Xi {
3431
3431
  i.className = "vr-ring", t.appendChild(i);
3432
3432
  const n = document.createElement("div");
3433
3433
  n.className = "vr-video-circle", this.videoEl = document.createElement("video"), this.videoEl.muted = !0, this.videoEl.playsInline = !0, this.videoEl.setAttribute("playsinline", ""), n.appendChild(this.videoEl), t.appendChild(n), this.root.appendChild(t), this.timerEl = document.createElement("span"), this.timerEl.className = "vr-timer", this.timerEl.textContent = "00:00", this.root.appendChild(this.timerEl);
3434
- const r = document.createElement("div");
3435
- r.className = "vr-actions";
3436
- const o = document.createElement("button");
3437
- o.className = "vr-btn vr-btn-stop", o.textContent = "Stop", o.addEventListener("click", () => this.stopRecording()), r.appendChild(o);
3434
+ const o = document.createElement("div");
3435
+ o.className = "vr-actions";
3436
+ const r = document.createElement("button");
3437
+ r.className = "vr-btn vr-btn-stop", r.textContent = "Stop", r.addEventListener("click", () => this.stopRecording()), o.appendChild(r);
3438
3438
  const l = document.createElement("button");
3439
- l.className = "vr-btn vr-btn-cancel", l.textContent = "Cancel", l.addEventListener("click", () => this.cancelRecording()), r.appendChild(l), this.root.appendChild(r), e.appendChild(this.root);
3439
+ l.className = "vr-btn vr-btn-cancel", l.textContent = "Cancel", l.addEventListener("click", () => this.cancelRecording()), o.appendChild(l), this.root.appendChild(o), e.appendChild(this.root);
3440
3440
  }
3441
3441
  updateTimer() {
3442
3442
  if (!this.timerEl) return;
@@ -3444,18 +3444,18 @@ class Xi {
3444
3444
  this.timerEl.textContent = qi(this.elapsed), e <= 10 ? this.timerEl.classList.add("vr-countdown") : this.timerEl.classList.remove("vr-countdown");
3445
3445
  }
3446
3446
  async handleRecordingComplete() {
3447
- var n, r;
3447
+ var n, o;
3448
3448
  const e = ((n = this.mediaRecorder) == null ? void 0 : n.mimeType) || "video/webm", t = new Blob(this.chunks, { type: e });
3449
3449
  let i;
3450
3450
  try {
3451
3451
  i = await Vi(t);
3452
3452
  } catch {
3453
- const o = document.createElement("canvas");
3454
- o.width = 1, o.height = 1, i = await new Promise((l) => {
3455
- o.toBlob((a) => l(a), "image/png");
3453
+ const r = document.createElement("canvas");
3454
+ r.width = 1, r.height = 1, i = await new Promise((l) => {
3455
+ r.toBlob((a) => l(a), "image/png");
3456
3456
  });
3457
3457
  }
3458
- this.cleanup(), (r = this.resolvePromise) == null || r.call(this, { blob: t, posterBlob: i }), this.resolvePromise = null;
3458
+ this.cleanup(), (o = this.resolvePromise) == null || o.call(this, { blob: t, posterBlob: i }), this.resolvePromise = null;
3459
3459
  }
3460
3460
  cleanup() {
3461
3461
  if (this.recording = !1, this.timerInterval && (clearInterval(this.timerInterval), this.timerInterval = null), this.mediaRecorder && this.mediaRecorder.state !== "inactive")
@@ -3517,8 +3517,8 @@ const T = class T {
3517
3517
  i.style.background = "rgba(255,255,255,0.3)";
3518
3518
  }), i.addEventListener("mouseleave", () => {
3519
3519
  i.style.background = "rgba(255,255,255,0.15)";
3520
- }), i.addEventListener("click", (o) => {
3521
- o.stopPropagation(), T.close();
3520
+ }), i.addEventListener("click", (r) => {
3521
+ r.stopPropagation(), T.close();
3522
3522
  });
3523
3523
  const n = document.createElement("img");
3524
3524
  n.src = e, n.alt = "Lightbox image", Object.assign(n.style, {
@@ -3528,15 +3528,15 @@ const T = class T {
3528
3528
  objectFit: "contain",
3529
3529
  cursor: "default",
3530
3530
  userSelect: "none"
3531
- }), n.addEventListener("click", (o) => {
3532
- o.stopPropagation();
3531
+ }), n.addEventListener("click", (r) => {
3532
+ r.stopPropagation();
3533
3533
  }), t.appendChild(i), t.appendChild(n), t.addEventListener("click", () => {
3534
3534
  T.close();
3535
3535
  });
3536
- const r = (o) => {
3537
- o.key === "Escape" && T.close();
3536
+ const o = (r) => {
3537
+ r.key === "Escape" && T.close();
3538
3538
  };
3539
- document.addEventListener("keydown", r), T.overlay = t, T.onKeyDown = r, document.body.appendChild(t), requestAnimationFrame(() => {
3539
+ document.addEventListener("keydown", o), T.overlay = t, T.onKeyDown = o, document.body.appendChild(t), requestAnimationFrame(() => {
3540
3540
  t.style.opacity = "1";
3541
3541
  });
3542
3542
  }
@@ -3563,25 +3563,25 @@ class ke {
3563
3563
  return new Promise((t) => {
3564
3564
  this.input.accept = e, this.input.value = "";
3565
3565
  const i = () => {
3566
- r(), t(null);
3566
+ o(), t(null);
3567
3567
  }, n = async () => {
3568
3568
  var l;
3569
- r();
3570
- const o = (l = this.input.files) == null ? void 0 : l[0];
3571
- if (!o) {
3569
+ o();
3570
+ const r = (l = this.input.files) == null ? void 0 : l[0];
3571
+ if (!r) {
3572
3572
  t(null);
3573
3573
  return;
3574
3574
  }
3575
3575
  this.uploading = !0;
3576
3576
  try {
3577
- const a = await this.client.uploadFile(o);
3577
+ const a = await this.client.uploadFile(r);
3578
3578
  t(a);
3579
3579
  } catch {
3580
3580
  t(null);
3581
3581
  } finally {
3582
3582
  this.uploading = !1;
3583
3583
  }
3584
- }, r = () => {
3584
+ }, o = () => {
3585
3585
  this.input.removeEventListener("change", n), this.input.removeEventListener("cancel", i);
3586
3586
  };
3587
3587
  this.input.addEventListener("change", n, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
@@ -3626,27 +3626,27 @@ class Ji {
3626
3626
  }, this.handlePopoverEscape = (i) => {
3627
3627
  i.key === "Escape" && this.closePopover();
3628
3628
  }, this.handlePopoverOutsideClick = (i) => {
3629
- var n, r;
3629
+ var n, o;
3630
3630
  if (this.popover && !this.popover.contains(i.target)) {
3631
- if ((n = this.container) != null && n.contains(i.target) || (r = this.pickerEl) != null && r.contains(i.target)) return;
3631
+ if ((n = this.container) != null && n.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
3632
3632
  this.closePopover();
3633
3633
  }
3634
3634
  }, this.handleOverlayClick = (i) => {
3635
3635
  this.form && (this.form.remove(), this.form = null);
3636
- const n = window.innerWidth, r = window.innerHeight, o = {
3636
+ const n = window.innerWidth, o = window.innerHeight, r = {
3637
3637
  x: i.clientX / n,
3638
- y: i.clientY / r,
3638
+ y: i.clientY / o,
3639
3639
  scrollX: window.scrollX,
3640
3640
  scrollY: window.scrollY
3641
3641
  }, l = this.overlay.style.pointerEvents;
3642
3642
  this.overlay.style.pointerEvents = "none";
3643
3643
  const a = document.elementFromPoint(i.clientX, i.clientY);
3644
3644
  if (this.overlay.style.pointerEvents = l, a) {
3645
- o.selector = this.getSelector(a);
3645
+ r.selector = this.getSelector(a);
3646
3646
  const c = a.getBoundingClientRect();
3647
- c.width > 0 && c.height > 0 && (o.elementOffsetX = (i.clientX - c.left) / c.width, o.elementOffsetY = (i.clientY - c.top) / c.height);
3647
+ c.width > 0 && c.height > 0 && (r.elementOffsetX = (i.clientX - c.left) / c.width, r.elementOffsetY = (i.clientY - c.top) / c.height);
3648
3648
  }
3649
- this.showPinForm(i.clientX, i.clientY, o);
3649
+ this.showPinForm(i.clientX, i.clientY, r);
3650
3650
  }, this.pickerEl = null, this.client = e, this.onPinModeExit = t.onPinModeExit, this.init();
3651
3651
  }
3652
3652
  get pinModeActive() {
@@ -3704,8 +3704,8 @@ class Ji {
3704
3704
  this.container && (this.container.style.display = e ? "" : "none");
3705
3705
  }
3706
3706
  destroy() {
3707
- var e, t, i, n, r, o;
3708
- this.exitPinMode(), this.closePopover(), this.removePickerEl(), (e = this.unsub) == null || e.call(this), (t = this.threadUnsub) == null || t.call(this), (i = this.reactionUnsub) == null || i.call(this), (n = this.typingUnsub2) == null || n.call(this), window.removeEventListener("scroll", this.handleReposition, !0), window.removeEventListener("resize", this.handleReposition), (r = this.mutationObserver) == null || r.disconnect(), this.mutationObserver = null, this.repositionDebounce && (clearTimeout(this.repositionDebounce), this.repositionDebounce = null), (o = this.container) == null || o.remove(), this.container = null, this.pinEls.clear();
3707
+ var e, t, i, n, o, r;
3708
+ this.exitPinMode(), this.closePopover(), this.removePickerEl(), (e = this.unsub) == null || e.call(this), (t = this.threadUnsub) == null || t.call(this), (i = this.reactionUnsub) == null || i.call(this), (n = this.typingUnsub2) == null || n.call(this), window.removeEventListener("scroll", this.handleReposition, !0), window.removeEventListener("resize", this.handleReposition), (o = this.mutationObserver) == null || o.disconnect(), this.mutationObserver = null, this.repositionDebounce && (clearTimeout(this.repositionDebounce), this.repositionDebounce = null), (r = this.container) == null || r.remove(), this.container = null, this.pinEls.clear();
3709
3709
  }
3710
3710
  closePopover() {
3711
3711
  var e;
@@ -3722,27 +3722,27 @@ class Ji {
3722
3722
  t.unshift(`#${i.id}`);
3723
3723
  break;
3724
3724
  }
3725
- const n = i.tagName.toLowerCase(), r = [...i.classList].filter((a) => !a.startsWith("pulse-")).slice(0, 2);
3726
- let o = r.length > 0 ? `${n}.${r.join(".")}` : n;
3725
+ const n = i.tagName.toLowerCase(), o = [...i.classList].filter((a) => !a.startsWith("pulse-")).slice(0, 2);
3726
+ let r = o.length > 0 ? `${n}.${o.join(".")}` : n;
3727
3727
  const l = i.parentElement;
3728
3728
  if (l) {
3729
3729
  const a = [...l.children].filter((c) => c.tagName === i.tagName);
3730
3730
  if (a.length > 1) {
3731
3731
  const c = a.indexOf(i) + 1;
3732
- o += `:nth-child(${c})`;
3732
+ r += `:nth-child(${c})`;
3733
3733
  }
3734
3734
  }
3735
- if (t.unshift(o), i = i.parentElement, t.length >= 4) break;
3735
+ if (t.unshift(r), i = i.parentElement, t.length >= 4) break;
3736
3736
  }
3737
3737
  return t.join(" > ");
3738
3738
  }
3739
3739
  showPinForm(e, t, i) {
3740
3740
  this.form = document.createElement("div");
3741
- const n = Math.min(280, window.innerWidth - 32), r = 120;
3742
- let o = e + 16, l = t - 10;
3743
- o + n > window.innerWidth - 16 && (o = e - n - 16), l + r > window.innerHeight - 16 && (l = window.innerHeight - r - 16), l < 16 && (l = 16), Object.assign(this.form.style, {
3741
+ const n = Math.min(280, window.innerWidth - 32), o = 120;
3742
+ let r = e + 16, l = t - 10;
3743
+ r + n > window.innerWidth - 16 && (r = e - n - 16), l + o > window.innerHeight - 16 && (l = window.innerHeight - o - 16), l < 16 && (l = 16), Object.assign(this.form.style, {
3744
3744
  position: "fixed",
3745
- left: `${o}px`,
3745
+ left: `${r}px`,
3746
3746
  top: `${l}px`,
3747
3747
  width: `${n}px`,
3748
3748
  zIndex: "10001",
@@ -3836,11 +3836,11 @@ class Ji {
3836
3836
  // ── Inline thread popover (shown when a pin dot is clicked) ──
3837
3837
  showThreadPopover(e, t) {
3838
3838
  this.closePopover(), this.popover = document.createElement("div"), this.popover.dataset.threadId = e.id;
3839
- const i = window.innerWidth <= 480, n = i ? window.innerWidth : 300, r = t.getBoundingClientRect();
3840
- let o, l;
3841
- i ? (o = 0, l = window.innerHeight * 0.4) : (o = r.right + 10, l = r.top - 8, o + n > window.innerWidth - 16 && (o = r.left - n - 10), l < 16 && (l = 16)), Object.assign(this.popover.style, {
3839
+ const i = window.innerWidth <= 480, n = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
3840
+ let r, l;
3841
+ i ? (r = 0, l = window.innerHeight * 0.4) : (r = o.right + 10, l = o.top - 8, r + n > window.innerWidth - 16 && (r = o.left - n - 10), l < 16 && (l = 16)), Object.assign(this.popover.style, {
3842
3842
  position: "fixed",
3843
- left: `${o}px`,
3843
+ left: `${r}px`,
3844
3844
  top: `${l}px`,
3845
3845
  width: i ? "100vw" : `${n}px`,
3846
3846
  maxHeight: i ? "60vh" : "360px",
@@ -3953,11 +3953,11 @@ class Ji {
3953
3953
  this.client.deleteComment(a.dataset.commentId);
3954
3954
  });
3955
3955
  });
3956
- const n = t.querySelector(".edit-save"), r = t.querySelector(".edit-cancel"), o = t.querySelector(
3956
+ const n = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
3957
3957
  ".edit-textarea"
3958
3958
  );
3959
- n && o && n.addEventListener("click", () => {
3960
- const a = o.value.trim();
3959
+ n && r && n.addEventListener("click", () => {
3960
+ const a = r.value.trim();
3961
3961
  if (!a) return;
3962
3962
  const c = [...a.matchAll(/@(\w+)/g)].map((h) => h[1]);
3963
3963
  this.client.editComment(
@@ -3965,7 +3965,7 @@ class Ji {
3965
3965
  a,
3966
3966
  c
3967
3967
  ), this.editingPopoverCommentId = null;
3968
- }), r && r.addEventListener("click", () => {
3968
+ }), o && o.addEventListener("click", () => {
3969
3969
  this.editingPopoverCommentId = null, this.refreshPopoverComments(e);
3970
3970
  }), t.querySelectorAll("[data-reaction-emoji]").forEach((a) => {
3971
3971
  a.addEventListener("click", (c) => {
@@ -4026,20 +4026,20 @@ class Ji {
4026
4026
  await this.upload.pickFile("image/*") && this.client.reply(e.id, "(image)");
4027
4027
  }), t.querySelector(".reply-attach-mic").addEventListener("click", async () => {
4028
4028
  this.audioRecorder || (this.audioRecorder = new Re());
4029
- const o = await this.audioRecorder.startRecording(t);
4030
- o && await this.upload.uploadBlob(o, "audio.webm") && this.client.reply(e.id, "(audio note)");
4029
+ const r = await this.audioRecorder.startRecording(t);
4030
+ r && await this.upload.uploadBlob(r, "audio.webm") && this.client.reply(e.id, "(audio note)");
4031
4031
  });
4032
- const r = () => {
4033
- const o = i.value.trim();
4034
- if (!o) return;
4035
- const l = [...o.matchAll(/@(\w+)/g)].map((a) => a[1]);
4036
- this.client.reply(e.id, o, l), i.value = "";
4032
+ const o = () => {
4033
+ const r = i.value.trim();
4034
+ if (!r) return;
4035
+ const l = [...r.matchAll(/@(\w+)/g)].map((a) => a[1]);
4036
+ this.client.reply(e.id, r, l), i.value = "";
4037
4037
  };
4038
- n.addEventListener("click", r), i.addEventListener("input", () => {
4039
- const o = Date.now(), l = this.lastTypingSendPins.get(e.id) ?? 0;
4040
- o - l >= 2e3 && (this.client.sendTyping(e.id), this.lastTypingSendPins.set(e.id, o));
4041
- }), i.addEventListener("keydown", (o) => {
4042
- o.key === "Enter" && (o.preventDefault(), r()), o.key === "Escape" && this.closePopover(), o.stopPropagation();
4038
+ n.addEventListener("click", o), i.addEventListener("input", () => {
4039
+ const r = Date.now(), l = this.lastTypingSendPins.get(e.id) ?? 0;
4040
+ r - l >= 2e3 && (this.client.sendTyping(e.id), this.lastTypingSendPins.set(e.id, r));
4041
+ }), i.addEventListener("keydown", (r) => {
4042
+ r.key === "Enter" && (r.preventDefault(), o()), r.key === "Escape" && this.closePopover(), r.stopPropagation();
4043
4043
  }), this.popover.appendChild(t);
4044
4044
  }
4045
4045
  removePickerEl() {
@@ -4065,8 +4065,8 @@ class Ji {
4065
4065
  fontFamily: ge
4066
4066
  });
4067
4067
  for (const n of Yi) {
4068
- const r = document.createElement("button");
4069
- Object.assign(r.style, {
4068
+ const o = document.createElement("button");
4069
+ Object.assign(o.style, {
4070
4070
  border: "none",
4071
4071
  background: "none",
4072
4072
  cursor: "pointer",
@@ -4074,8 +4074,8 @@ class Ji {
4074
4074
  padding: "4px",
4075
4075
  borderRadius: "4px",
4076
4076
  lineHeight: "1"
4077
- }), r.textContent = n, r.addEventListener("click", (o) => {
4078
- o.stopPropagation();
4077
+ }), o.textContent = n, o.addEventListener("click", (r) => {
4078
+ r.stopPropagation();
4079
4079
  const a = this.client.state.getReactions(t).find(
4080
4080
  (c) => {
4081
4081
  var h;
@@ -4083,7 +4083,7 @@ class Ji {
4083
4083
  }
4084
4084
  );
4085
4085
  a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", n), this.popoverPickerOpen = null, this.removePickerEl();
4086
- }), this.pickerEl.appendChild(r);
4086
+ }), this.pickerEl.appendChild(o);
4087
4087
  }
4088
4088
  document.body.appendChild(this.pickerEl);
4089
4089
  }
@@ -4094,10 +4094,10 @@ class Ji {
4094
4094
  const h = n.get(c.emoji) ?? { count: 0, ownId: null };
4095
4095
  h.count++, c.userId === i && (h.ownId = c.id), n.set(c.emoji, h);
4096
4096
  }
4097
- const r = "display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:12px;border:1px solid #e2e8f0;background:#fff;font-size:12px;cursor:pointer;transition:all 0.15s;line-height:1.4;", o = r + "background:#eef2ff;border-color:#6366f1;";
4097
+ const o = "display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:12px;border:1px solid #e2e8f0;background:#fff;font-size:12px;cursor:pointer;transition:all 0.15s;line-height:1.4;", r = o + "background:#eef2ff;border-color:#6366f1;";
4098
4098
  let l = '<div style="margin-left:29px;display:flex;gap:4px;flex-wrap:wrap;margin-top:4px;">';
4099
4099
  for (const [c, { count: h, ownId: p }] of n) {
4100
- const m = p ? o : r;
4100
+ const m = p ? r : o;
4101
4101
  l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${p ? `data-reaction-id="${p}"` : ""} style="${m}">
4102
4102
  <span>${c}</span><span style="font-size:11px;font-weight:600;color:#64748b;">${h}</span>
4103
4103
  </button>`;
@@ -4119,20 +4119,20 @@ class Ji {
4119
4119
  n && this.popover.insertBefore(t, n);
4120
4120
  }
4121
4121
  const i = this.client.state.getTypingUsers(e).filter((n) => {
4122
- var r;
4123
- return n !== ((r = this.client.state.user) == null ? void 0 : r.id);
4122
+ var o;
4123
+ return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4124
4124
  }).map((n) => {
4125
- const r = this.client.state.presence.find((o) => o.user.id === n);
4126
- return (r == null ? void 0 : r.user.name) ?? "Someone";
4125
+ const o = this.client.state.presence.find((r) => r.user.id === n);
4126
+ return (o == null ? void 0 : o.user.name) ?? "Someone";
4127
4127
  });
4128
4128
  i.length === 0 ? t.textContent = "" : i.length === 1 ? t.textContent = `${i[0]} is typing...` : t.textContent = `${i.join(", ")} are typing...`;
4129
4129
  }
4130
4130
  formatTime(e) {
4131
- const t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), r = Math.floor(n / 6e4);
4132
- if (r < 1) return "now";
4133
- if (r < 60) return `${r}m`;
4134
- const o = Math.floor(r / 60);
4135
- return o < 24 ? `${o}h` : t.toLocaleDateString();
4131
+ const t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(n / 6e4);
4132
+ if (o < 1) return "now";
4133
+ if (o < 60) return `${o}m`;
4134
+ const r = Math.floor(o / 60);
4135
+ return r < 24 ? `${r}h` : t.toLocaleDateString();
4136
4136
  }
4137
4137
  // ── Pin rendering ──
4138
4138
  /** Resolve a pin position to viewport pixel coordinates. */
@@ -4160,9 +4160,9 @@ class Ji {
4160
4160
  for (const [i, n] of this.pinEls)
4161
4161
  t.has(i) || (n.remove(), this.pinEls.delete(i));
4162
4162
  e.forEach((i, n) => {
4163
- const r = i.position;
4164
- let o = this.pinEls.get(i.id);
4165
- o || (o = document.createElement("div"), Object.assign(o.style, {
4163
+ const o = i.position;
4164
+ let r = this.pinEls.get(i.id);
4165
+ r || (r = document.createElement("div"), Object.assign(r.style, {
4166
4166
  position: "fixed",
4167
4167
  width: "24px",
4168
4168
  height: "24px",
@@ -4182,26 +4182,26 @@ class Ji {
4182
4182
  transition: "left 0.15s ease, top 0.15s ease, transform 0.15s ease",
4183
4183
  zIndex: "9997",
4184
4184
  transform: "translate(-50%, -50%)"
4185
- }), o.addEventListener("mouseenter", () => {
4186
- o.style.transform = "translate(-50%, -50%) scale(1.15)";
4187
- }), o.addEventListener("mouseleave", () => {
4188
- o.style.transform = "translate(-50%, -50%)";
4189
- }), o.addEventListener("click", () => {
4185
+ }), r.addEventListener("mouseenter", () => {
4186
+ r.style.transform = "translate(-50%, -50%) scale(1.15)";
4187
+ }), r.addEventListener("mouseleave", () => {
4188
+ r.style.transform = "translate(-50%, -50%)";
4189
+ }), r.addEventListener("click", () => {
4190
4190
  if (this.popover && this.popover.dataset.threadId === i.id) {
4191
4191
  this.closePopover();
4192
4192
  return;
4193
4193
  }
4194
4194
  const a = this.threads.find((c) => c.id === i.id);
4195
- a && this.showThreadPopover(a, o);
4196
- }), this.container.appendChild(o), this.pinEls.set(i.id, o)), o.textContent = `${n + 1}`;
4197
- const l = this.resolvePosition(r);
4198
- o.style.left = `${l.x}px`, o.style.top = `${l.y}px`;
4195
+ a && this.showThreadPopover(a, r);
4196
+ }), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${n + 1}`;
4197
+ const l = this.resolvePosition(o);
4198
+ r.style.left = `${l.x}px`, r.style.top = `${l.y}px`;
4199
4199
  });
4200
4200
  }
4201
4201
  }
4202
4202
  var Zi = Object.defineProperty, Qi = Object.getOwnPropertyDescriptor, j = (s, e, t, i) => {
4203
- for (var n = i > 1 ? void 0 : i ? Qi(e, t) : e, r = s.length - 1, o; r >= 0; r--)
4204
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
4203
+ for (var n = i > 1 ? void 0 : i ? Qi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
4204
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
4205
4205
  return i && n && Zi(e, t, n), n;
4206
4206
  };
4207
4207
  const es = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
@@ -4210,28 +4210,34 @@ let O = class extends S {
4210
4210
  super(...arguments), this.highlightThreadId = null, this.threads = [], this.replyingTo = null, this.editingCommentId = null, this.editBody = "", this.pickerOpenForComment = null, this.typingByThread = /* @__PURE__ */ new Map(), this.reactionsVersion = 0, this.typingTimers = /* @__PURE__ */ new Map(), this.lastTypingSend = /* @__PURE__ */ new Map();
4211
4211
  }
4212
4212
  connectedCallback() {
4213
- super.connectedCallback(), this.setupListener();
4213
+ super.connectedCallback(), this.updateComplete.then(() => this.ensureListener());
4214
4214
  }
4215
4215
  disconnectedCallback() {
4216
+ super.disconnectedCallback(), this.teardownListeners();
4217
+ }
4218
+ updated(s) {
4219
+ var e, t;
4220
+ s.has("client") && this.client && this.ensureListener(), (e = this.shadowRoot) == null || e.querySelectorAll(".audio-player-host").forEach((i) => {
4221
+ if (i.children.length > 0) return;
4222
+ const n = i.dataset.url;
4223
+ if (n) {
4224
+ const o = i.dataset.duration ? parseInt(i.dataset.duration) : void 0;
4225
+ i.appendChild(Oe.render(n, o));
4226
+ }
4227
+ }), (t = this.shadowRoot) == null || t.querySelectorAll(".video-player-host").forEach((i) => {
4228
+ if (i.children.length > 0) return;
4229
+ const n = i.dataset.url;
4230
+ n && i.appendChild(_t.render(n, i.dataset.poster || void 0));
4231
+ });
4232
+ }
4233
+ teardownListeners() {
4216
4234
  var s, e, t;
4217
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this), (e = this.reactionUnsub) == null || e.call(this), (t = this.typingUnsub) == null || t.call(this);
4235
+ (s = this.unsub) == null || s.call(this), this.unsub = void 0, (e = this.reactionUnsub) == null || e.call(this), this.reactionUnsub = void 0, (t = this.typingUnsub) == null || t.call(this), this.typingUnsub = void 0;
4218
4236
  for (const i of this.typingTimers.values()) clearTimeout(i);
4219
4237
  this.typingTimers.clear();
4220
4238
  }
4221
- updated(s) {
4222
- var e, t, i, n, r;
4223
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.reactionUnsub) == null || t.call(this), (i = this.typingUnsub) == null || i.call(this), this.setupListener()), (n = this.shadowRoot) == null || n.querySelectorAll(".audio-player-host").forEach((o) => {
4224
- if (o.children.length > 0) return;
4225
- const l = o.dataset.url;
4226
- if (l) {
4227
- const a = o.dataset.duration ? parseInt(o.dataset.duration) : void 0;
4228
- o.appendChild(Oe.render(l, a));
4229
- }
4230
- }), (r = this.shadowRoot) == null || r.querySelectorAll(".video-player-host").forEach((o) => {
4231
- if (o.children.length > 0) return;
4232
- const l = o.dataset.url;
4233
- l && o.appendChild(_t.render(l, o.dataset.poster || void 0));
4234
- });
4239
+ ensureListener() {
4240
+ this.client && (this.teardownListeners(), this.threads = [...this.client.state.threads], this.setupListener());
4235
4241
  }
4236
4242
  setupListener() {
4237
4243
  this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (s) => {
@@ -4247,11 +4253,11 @@ let O = class extends S {
4247
4253
  }
4248
4254
  refreshTyping(s) {
4249
4255
  const t = this.client.state.getTypingUsers(s).filter((n) => {
4250
- var r;
4251
- return n !== ((r = this.client.state.user) == null ? void 0 : r.id);
4256
+ var o;
4257
+ return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4252
4258
  }).map((n) => {
4253
- const r = this.client.state.presence.find((o) => o.user.id === n);
4254
- return (r == null ? void 0 : r.user.name) ?? "Someone";
4259
+ const o = this.client.state.presence.find((r) => r.user.id === n);
4260
+ return (o == null ? void 0 : o.user.name) ?? "Someone";
4255
4261
  }), i = new Map(this.typingByThread);
4256
4262
  i.set(s, t), this.typingByThread = i, this.typingTimers.has(s) && clearTimeout(this.typingTimers.get(s)), this.typingTimers.set(
4257
4263
  s,
@@ -4265,9 +4271,9 @@ let O = class extends S {
4265
4271
  e - t >= 2e3 && (this.client.sendTyping(s), this.lastTypingSend.set(s, e));
4266
4272
  }
4267
4273
  toggleReaction(s, e) {
4268
- var r;
4269
- const t = this.client.state.getReactions(s), i = (r = this.client.state.user) == null ? void 0 : r.id, n = t.find(
4270
- (o) => o.emoji === e && o.userId === i
4274
+ var o;
4275
+ const t = this.client.state.getReactions(s), i = (o = this.client.state.user) == null ? void 0 : o.id, n = t.find(
4276
+ (r) => r.emoji === e && r.userId === i
4271
4277
  );
4272
4278
  n ? this.client.removeReaction(n.id) : this.client.addReaction(s, "comment", e), this.pickerOpenForComment = null;
4273
4279
  }
@@ -4300,8 +4306,8 @@ let O = class extends S {
4300
4306
  const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
4301
4307
  if (n < 1) return "now";
4302
4308
  if (n < 60) return `${n}m`;
4303
- const r = Math.floor(n / 60);
4304
- return r < 24 ? `${r}h` : e.toLocaleDateString();
4309
+ const o = Math.floor(n / 60);
4310
+ return o < 24 ? `${o}h` : e.toLocaleDateString();
4305
4311
  }
4306
4312
  async handleAttachImage(s) {
4307
4313
  this.upload || (this.upload = new ke(this.client)), await this.upload.pickFile("image/*") && this.client.reply(s, "(image)");
@@ -4316,8 +4322,8 @@ let O = class extends S {
4316
4322
  e.preventDefault();
4317
4323
  const i = e.target.querySelector("input"), n = i.value.trim();
4318
4324
  if (!n) return;
4319
- const r = [...n.matchAll(/@(\w+)/g)].map((o) => o[1]);
4320
- this.client.reply(s, n, r), i.value = "", this.replyingTo = null;
4325
+ const o = [...n.matchAll(/@(\w+)/g)].map((r) => r[1]);
4326
+ this.client.reply(s, n, o), i.value = "", this.replyingTo = null;
4321
4327
  }
4322
4328
  isOwnComment(s) {
4323
4329
  var e, t;
@@ -4358,20 +4364,20 @@ let O = class extends S {
4358
4364
  var n;
4359
4365
  this.reactionsVersion;
4360
4366
  const e = this.client.state.getReactions(s.id), t = (n = this.client.state.user) == null ? void 0 : n.id, i = /* @__PURE__ */ new Map();
4361
- for (const r of e)
4362
- i.has(r.emoji) || i.set(r.emoji, []), i.get(r.emoji).push(r);
4367
+ for (const o of e)
4368
+ i.has(o.emoji) || i.set(o.emoji, []), i.get(o.emoji).push(o);
4363
4369
  return d`
4364
4370
  <div class="comment-reactions">
4365
4371
  ${[...i.entries()].map(
4366
- ([r, o]) => {
4367
- const l = o.some((a) => a.userId === t);
4372
+ ([o, r]) => {
4373
+ const l = r.some((a) => a.userId === t);
4368
4374
  return d`
4369
4375
  <button
4370
4376
  class="reaction-pill ${l ? "own" : ""}"
4371
- @click=${() => this.toggleReaction(s.id, r)}
4377
+ @click=${() => this.toggleReaction(s.id, o)}
4372
4378
  >
4373
- <span>${r}</span>
4374
- <span class="count">${o.length}</span>
4379
+ <span>${o}</span>
4380
+ <span class="count">${r.length}</span>
4375
4381
  </button>
4376
4382
  `;
4377
4383
  }
@@ -4387,10 +4393,10 @@ let O = class extends S {
4387
4393
  ${this.pickerOpenForComment === s.id ? d`
4388
4394
  <div class="emoji-picker">
4389
4395
  ${es.map(
4390
- (r) => d`
4391
- <button @click=${(o) => {
4392
- o.stopPropagation(), this.toggleReaction(s.id, r);
4393
- }}>${r}</button>
4396
+ (o) => d`
4397
+ <button @click=${(r) => {
4398
+ r.stopPropagation(), this.toggleReaction(s.id, o);
4399
+ }}>${o}</button>
4394
4400
  `
4395
4401
  )}
4396
4402
  </div>
@@ -4486,7 +4492,7 @@ let O = class extends S {
4486
4492
  Pinned
4487
4493
  </div>` : u}
4488
4494
  ${s.comments.map((t, i) => {
4489
- const n = this.getUserForComment(t.userId), r = this.isOwnComment(t), o = this.editingCommentId === t.id;
4495
+ const n = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4490
4496
  return d`
4491
4497
  ${i > 0 ? d`<div class="comment-divider"></div>` : u}
4492
4498
  <div class="comment">
@@ -4501,11 +4507,11 @@ let O = class extends S {
4501
4507
  <span class="comment-time">${this.formatTime(t.createdAt)}</span>
4502
4508
  ${t.editedAt ? d`<span class="edited-badge">(edited)</span>` : u}
4503
4509
  </div>
4504
- ${o ? this.renderEditForm(t) : d`
4510
+ ${r ? this.renderEditForm(t) : d`
4505
4511
  <div class="comment-body">${this.parseMentions(t.body)}</div>
4506
4512
  ${this.renderAttachments(t.attachments ?? [])}
4507
4513
  `}
4508
- ${r && !o ? d`<div class="comment-actions">
4514
+ ${o && !r ? d`<div class="comment-actions">
4509
4515
  <button @click=${() => this.startEdit(t)} title="Edit">${C(Pi, 14)}</button>
4510
4516
  <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${C(Mi, 14)}</button>
4511
4517
  </div>` : u}
@@ -5054,8 +5060,8 @@ O = j([
5054
5060
  R("pulse-widget-comments-panel")
5055
5061
  ], O);
5056
5062
  var ts = Object.defineProperty, is = Object.getOwnPropertyDescriptor, Fe = (s, e, t, i) => {
5057
- for (var n = i > 1 ? void 0 : i ? is(e, t) : e, r = s.length - 1, o; r >= 0; r--)
5058
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
5063
+ for (var n = i > 1 ? void 0 : i ? is(e, t) : e, o = s.length - 1, r; o >= 0; o--)
5064
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
5059
5065
  return i && n && ts(e, t, n), n;
5060
5066
  };
5061
5067
  const ss = {
@@ -5110,8 +5116,8 @@ let ce = class extends S {
5110
5116
  const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
5111
5117
  if (n < 1) return "now";
5112
5118
  if (n < 60) return `${n}m`;
5113
- const r = Math.floor(n / 60);
5114
- return r < 24 ? `${r}h` : e.toLocaleDateString();
5119
+ const o = Math.floor(n / 60);
5120
+ return o < 24 ? `${o}h` : e.toLocaleDateString();
5115
5121
  }
5116
5122
  render() {
5117
5123
  const s = this.notifications.filter((e) => !e.read).length;
@@ -5396,7 +5402,7 @@ class rs {
5396
5402
  i.position = t;
5397
5403
  else {
5398
5404
  const n = this.client.state.presence.find(
5399
- (r) => r.user.id === e
5405
+ (o) => o.user.id === e
5400
5406
  );
5401
5407
  n && this.cursors.set(e, {
5402
5408
  userId: e,
@@ -5444,9 +5450,9 @@ class rs {
5444
5450
  showClickRipple(e, t) {
5445
5451
  if (!this.container) return;
5446
5452
  const i = this.client.state.presence.find(
5447
- (o) => o.user.id === e
5448
- ), n = (i == null ? void 0 : i.user.color) ?? "#6366f1", r = document.createElement("div");
5449
- Object.assign(r.style, {
5453
+ (r) => r.user.id === e
5454
+ ), n = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
5455
+ Object.assign(o.style, {
5450
5456
  position: "absolute",
5451
5457
  left: `${t.x}px`,
5452
5458
  top: `${t.y}px`,
@@ -5458,9 +5464,9 @@ class rs {
5458
5464
  pointerEvents: "none",
5459
5465
  opacity: "1",
5460
5466
  transition: "width 0.6s ease-out, height 0.6s ease-out, opacity 0.6s ease-out"
5461
- }), this.container.appendChild(r), requestAnimationFrame(() => {
5462
- r.style.width = "60px", r.style.height = "60px", r.style.opacity = "0";
5463
- }), setTimeout(() => r.remove(), 600);
5467
+ }), this.container.appendChild(o), requestAnimationFrame(() => {
5468
+ o.style.width = "60px", o.style.height = "60px", o.style.opacity = "0";
5469
+ }), setTimeout(() => o.remove(), 600);
5464
5470
  }
5465
5471
  showEmojiDrop(e, t, i) {
5466
5472
  if (!this.container) return;
@@ -5519,11 +5525,11 @@ class as {
5519
5525
  this.container = null, this.unsubs = [], this.enabled = !1, this.drawMode = !1, this.currentPoints = [], this.currentPath = null, this.lastPoint = null, this.fadeTimers = /* @__PURE__ */ new Map(), this.handlePointerDown = (t) => {
5520
5526
  var l, a, c;
5521
5527
  t.preventDefault(), (a = (l = t.target) == null ? void 0 : l.setPointerCapture) == null || a.call(l, t.pointerId), this.currentPoints = [{ x: t.clientX, y: t.clientY }], this.lastPoint = { x: t.clientX, y: t.clientY };
5522
- const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1", o = 2 + (t.pressure > 0 ? t.pressure : 0.5) * 4;
5528
+ const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1", r = 2 + (t.pressure > 0 ? t.pressure : 0.5) * 4;
5523
5529
  this.currentPath = document.createElementNS(
5524
5530
  "http://www.w3.org/2000/svg",
5525
5531
  "polyline"
5526
- ), this.currentPath.setAttribute("fill", "none"), this.currentPath.setAttribute("stroke", n), this.currentPath.setAttribute("stroke-width", String(o)), this.currentPath.setAttribute("stroke-linecap", "round"), this.currentPath.setAttribute("stroke-linejoin", "round"), this.currentPath.setAttribute(
5532
+ ), this.currentPath.setAttribute("fill", "none"), this.currentPath.setAttribute("stroke", n), this.currentPath.setAttribute("stroke-width", String(r)), this.currentPath.setAttribute("stroke-linecap", "round"), this.currentPath.setAttribute("stroke-linejoin", "round"), this.currentPath.setAttribute(
5527
5533
  "points",
5528
5534
  `${t.clientX},${t.clientY}`
5529
5535
  ), (c = this.container) == null || c.appendChild(this.currentPath), document.addEventListener("pointermove", this.handlePointerMove), document.addEventListener("pointerup", this.handlePointerUp);
@@ -5532,8 +5538,8 @@ class as {
5532
5538
  const i = t.clientX - this.lastPoint.x, n = t.clientY - this.lastPoint.y;
5533
5539
  if (i * i + n * n < 4) return;
5534
5540
  this.currentPoints.push({ x: t.clientX, y: t.clientY }), this.lastPoint = { x: t.clientX, y: t.clientY };
5535
- const r = this.currentPoints.map((o) => `${o.x},${o.y}`).join(" ");
5536
- this.currentPath.setAttribute("points", r);
5541
+ const o = this.currentPoints.map((r) => `${r.x},${r.y}`).join(" ");
5542
+ this.currentPath.setAttribute("points", o);
5537
5543
  }, this.handlePointerUp = () => {
5538
5544
  var t;
5539
5545
  if (document.removeEventListener("pointermove", this.handlePointerMove), document.removeEventListener("pointerup", this.handlePointerUp), this.currentPoints.length > 1) {
@@ -5585,7 +5591,7 @@ class as {
5585
5591
  );
5586
5592
  n.setAttribute("fill", "none"), n.setAttribute("stroke", t), n.setAttribute("stroke-width", String(i)), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round"), n.setAttribute(
5587
5593
  "points",
5588
- e.map((r) => `${r.x},${r.y}`).join(" ")
5594
+ e.map((o) => `${o.x},${o.y}`).join(" ")
5589
5595
  ), n.style.willChange = "opacity", this.container.appendChild(n), this.scheduleFade(n);
5590
5596
  }
5591
5597
  scheduleFade(e) {
@@ -5599,11 +5605,11 @@ class as {
5599
5605
  }
5600
5606
  function ls(s) {
5601
5607
  if (!s.rangeCount || s.isCollapsed) return null;
5602
- const e = s.getRangeAt(0), t = e.startContainer, i = e.endContainer, n = ut(t), r = ut(i);
5603
- return !n || !r ? null : {
5608
+ const e = s.getRangeAt(0), t = e.startContainer, i = e.endContainer, n = ut(t), o = ut(i);
5609
+ return !n || !o ? null : {
5604
5610
  startSelector: n,
5605
5611
  startOffset: e.startOffset,
5606
- endSelector: r,
5612
+ endSelector: o,
5607
5613
  endOffset: e.endOffset
5608
5614
  };
5609
5615
  }
@@ -5612,8 +5618,8 @@ function cs(s) {
5612
5618
  try {
5613
5619
  const i = mt(s.startSelector), n = mt(s.endSelector);
5614
5620
  if (!i || !n) return null;
5615
- const r = document.createRange(), o = i.nodeType === Node.TEXT_NODE ? ((e = i.textContent) == null ? void 0 : e.length) ?? 0 : i.childNodes.length, l = n.nodeType === Node.TEXT_NODE ? ((t = n.textContent) == null ? void 0 : t.length) ?? 0 : n.childNodes.length;
5616
- return r.setStart(i, Math.min(s.startOffset, o)), r.setEnd(n, Math.min(s.endOffset, l)), r;
5621
+ const o = document.createRange(), r = i.nodeType === Node.TEXT_NODE ? ((e = i.textContent) == null ? void 0 : e.length) ?? 0 : i.childNodes.length, l = n.nodeType === Node.TEXT_NODE ? ((t = n.textContent) == null ? void 0 : t.length) ?? 0 : n.childNodes.length;
5622
+ return o.setStart(i, Math.min(s.startOffset, r)), o.setEnd(n, Math.min(s.endOffset, l)), o;
5617
5623
  } catch {
5618
5624
  return null;
5619
5625
  }
@@ -5638,14 +5644,14 @@ function ft(s) {
5638
5644
  for (; t && t !== document.body && i < 10; ) {
5639
5645
  const n = t.parentElement;
5640
5646
  if (!n) break;
5641
- const r = t.tagName.toLowerCase(), o = t.tagName, l = Array.from(n.children).filter(
5642
- (a) => a.tagName === o
5647
+ const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(n.children).filter(
5648
+ (a) => a.tagName === r
5643
5649
  );
5644
5650
  if (l.length === 1)
5645
- e.unshift(r);
5651
+ e.unshift(o);
5646
5652
  else {
5647
5653
  const a = l.indexOf(t) + 1;
5648
- e.unshift(`${r}:nth-of-type(${a})`);
5654
+ e.unshift(`${o}:nth-of-type(${a})`);
5649
5655
  }
5650
5656
  if (n.id) {
5651
5657
  e.unshift(`#${CSS.escape(n.id)}`);
@@ -5718,9 +5724,9 @@ class ds {
5718
5724
  if (e === i || (this.clearSelection(e), !t)) return;
5719
5725
  const n = cs(t);
5720
5726
  if (!n) return;
5721
- const r = this.client.state.presence.find(
5727
+ const o = this.client.state.presence.find(
5722
5728
  (a) => a.user.id === e
5723
- ), o = (r == null ? void 0 : r.user.color) ?? "#6366f1";
5729
+ ), r = (o == null ? void 0 : o.user.color) ?? "#6366f1";
5724
5730
  try {
5725
5731
  const a = n.getClientRects(), c = [];
5726
5732
  for (let h = 0; h < a.length; h++) {
@@ -5731,7 +5737,7 @@ class ds {
5731
5737
  top: `${p.top}px`,
5732
5738
  width: `${p.width}px`,
5733
5739
  height: `${p.height}px`,
5734
- background: o,
5740
+ background: r,
5735
5741
  opacity: "0.2",
5736
5742
  borderRadius: "2px",
5737
5743
  pointerEvents: "none"
@@ -5756,8 +5762,8 @@ class ds {
5756
5762
  }
5757
5763
  }
5758
5764
  var hs = Object.defineProperty, ps = Object.getOwnPropertyDescriptor, qe = (s, e, t, i) => {
5759
- for (var n = i > 1 ? void 0 : i ? ps(e, t) : e, r = s.length - 1, o; r >= 0; r--)
5760
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
5765
+ for (var n = i > 1 ? void 0 : i ? ps(e, t) : e, o = s.length - 1, r; o >= 0; o--)
5766
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
5761
5767
  return i && n && hs(e, t, n), n;
5762
5768
  };
5763
5769
  let de = class extends S {
@@ -6054,8 +6060,8 @@ function fs(s, e) {
6054
6060
  localStorage.setItem(`${Tt}${s}`, JSON.stringify(e));
6055
6061
  }
6056
6062
  var ms = Object.defineProperty, gs = Object.getOwnPropertyDescriptor, L = (s, e, t, i) => {
6057
- for (var n = i > 1 ? void 0 : i ? gs(e, t) : e, r = s.length - 1, o; r >= 0; r--)
6058
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
6063
+ for (var n = i > 1 ? void 0 : i ? gs(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6064
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6059
6065
  return i && n && ms(e, t, n), n;
6060
6066
  };
6061
6067
  let I = class extends S {
@@ -6497,14 +6503,14 @@ class bs {
6497
6503
  this.disable();
6498
6504
  }
6499
6505
  render() {
6500
- var o;
6506
+ var r;
6501
6507
  if (!this.container) return;
6502
6508
  if (document.documentElement.scrollHeight <= window.innerHeight) {
6503
6509
  for (const l of this.pillEls.values()) l.remove();
6504
6510
  this.pillEls.clear();
6505
6511
  return;
6506
6512
  }
6507
- const e = window.scrollY, t = window.innerHeight, i = document.documentElement.scrollHeight, n = (o = this.client.state.user) == null ? void 0 : o.id, r = /* @__PURE__ */ new Set();
6513
+ const e = window.scrollY, t = window.innerHeight, i = document.documentElement.scrollHeight, n = (r = this.client.state.user) == null ? void 0 : r.id, o = /* @__PURE__ */ new Set();
6508
6514
  for (const [l, a] of this.client.state.viewports) {
6509
6515
  if (l === n) continue;
6510
6516
  const c = a.scrollY, h = a.scrollY + a.viewportHeight, p = e, m = e + t;
@@ -6513,7 +6519,7 @@ class bs {
6513
6519
  k && (k.style.display = "none");
6514
6520
  continue;
6515
6521
  }
6516
- r.add(l);
6522
+ o.add(l);
6517
6523
  const f = this.client.state.presence.find(
6518
6524
  (k) => k.user.id === l
6519
6525
  );
@@ -6538,15 +6544,15 @@ class bs {
6538
6544
  }), this.container.appendChild($), this.pillEls.set(l, $)), $.style.display = "", $.style.background = f.user.color, $.style.top = `${_}px`, $.textContent = this.getInitials(f.user.name);
6539
6545
  }
6540
6546
  for (const [l, a] of this.pillEls)
6541
- !r.has(l) && !this.client.state.viewports.has(l) && (a.remove(), this.pillEls.delete(l));
6547
+ !o.has(l) && !this.client.state.viewports.has(l) && (a.remove(), this.pillEls.delete(l));
6542
6548
  }
6543
6549
  getInitials(e) {
6544
6550
  return e.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2);
6545
6551
  }
6546
6552
  }
6547
6553
  var vs = Object.defineProperty, xs = Object.getOwnPropertyDescriptor, P = (s, e, t, i) => {
6548
- for (var n = i > 1 ? void 0 : i ? xs(e, t) : e, r = s.length - 1, o; r >= 0; r--)
6549
- (o = s[r]) && (n = (i ? o(e, t, n) : o(n)) || n);
6554
+ for (var n = i > 1 ? void 0 : i ? xs(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6555
+ (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6550
6556
  return i && n && vs(e, t, n), n;
6551
6557
  };
6552
6558
  let E = class extends S {
@@ -6638,14 +6644,14 @@ let E = class extends S {
6638
6644
  ), window.addEventListener("scroll", this.handleScroll), document.addEventListener("selectionchange", this.handleSelectionChange), this.client.connect();
6639
6645
  }
6640
6646
  teardownClient() {
6641
- var s, e, t, i, n, r;
6642
- this.unsubs.forEach((o) => o()), this.unsubs = [], window.removeEventListener("scroll", this.handleScroll), document.removeEventListener("selectionchange", this.handleSelectionChange), this._viewportThrottleTimer && (clearTimeout(this._viewportThrottleTimer), this._viewportThrottleTimer = null), this._selectionThrottleTimer && (clearTimeout(this._selectionThrottleTimer), this._selectionThrottleTimer = null), (s = this.cursorOverlay) == null || s.destroy(), (e = this.commentPins) == null || e.destroy(), (t = this.viewportOverlay) == null || t.destroy(), (i = this.selectionOverlay) == null || i.destroy(), (n = this.drawingOverlay) == null || n.destroy(), (r = this.client) == null || r.disconnect(), this.client = void 0, this.cursorOverlay = void 0, this.commentPins = void 0, this.viewportOverlay = void 0, this.selectionOverlay = void 0, this.drawingOverlay = void 0, this.clientConfigKey = "", this.followingUserId = null, this.drawModeActive = !1, this.connectionState = "disconnected", this.showConnectedFlash = !1, this._wasDisconnected = !1, this._connectedFlashTimer && (clearTimeout(this._connectedFlashTimer), this._connectedFlashTimer = null);
6647
+ var s, e, t, i, n, o;
6648
+ this.unsubs.forEach((r) => r()), this.unsubs = [], window.removeEventListener("scroll", this.handleScroll), document.removeEventListener("selectionchange", this.handleSelectionChange), this._viewportThrottleTimer && (clearTimeout(this._viewportThrottleTimer), this._viewportThrottleTimer = null), this._selectionThrottleTimer && (clearTimeout(this._selectionThrottleTimer), this._selectionThrottleTimer = null), (s = this.cursorOverlay) == null || s.destroy(), (e = this.commentPins) == null || e.destroy(), (t = this.viewportOverlay) == null || t.destroy(), (i = this.selectionOverlay) == null || i.destroy(), (n = this.drawingOverlay) == null || n.destroy(), (o = this.client) == null || o.disconnect(), this.client = void 0, this.cursorOverlay = void 0, this.commentPins = void 0, this.viewportOverlay = void 0, this.selectionOverlay = void 0, this.drawingOverlay = void 0, this.clientConfigKey = "", this.followingUserId = null, this.drawModeActive = !1, this.connectionState = "disconnected", this.showConnectedFlash = !1, this._wasDisconnected = !1, this._connectedFlashTimer && (clearTimeout(this._connectedFlashTimer), this._connectedFlashTimer = null);
6643
6649
  }
6644
6650
  handlePanelClose() {
6645
6651
  this.activePanel = null, this.highlightThreadId = null;
6646
6652
  }
6647
6653
  handleToolbarAction(s) {
6648
- var t, i, n, r;
6654
+ var t, i, n, o;
6649
6655
  const e = s.detail;
6650
6656
  if (!(!this.settings.enabled && e !== "settings"))
6651
6657
  switch (e) {
@@ -6665,7 +6671,7 @@ let E = class extends S {
6665
6671
  this.pinModeActive = !this.pinModeActive, this.pinModeActive ? (t = this.commentPins) == null || t.enterPinMode() : (i = this.commentPins) == null || i.exitPinMode();
6666
6672
  break;
6667
6673
  case "draw-mode":
6668
- this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (n = this.drawingOverlay) == null || n.enableDrawMode() : (r = this.drawingOverlay) == null || r.disableDrawMode();
6674
+ this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (n = this.drawingOverlay) == null || n.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
6669
6675
  break;
6670
6676
  }
6671
6677
  }
@@ -6678,9 +6684,9 @@ let E = class extends S {
6678
6684
  this.settings = e, fs(this.room, e), this.applySettings(e);
6679
6685
  }
6680
6686
  applySettings(s) {
6681
- var e, t, i, n, r, o, l, a, c, h, p, m, f, b, x, _, $;
6687
+ var e, t, i, n, o, r, l, a, c, h, p, m, f, b, x, _, $;
6682
6688
  if (!s.enabled) {
6683
- (e = this.cursorOverlay) == null || e.disable(), (t = this.viewportOverlay) == null || t.disable(), (i = this.selectionOverlay) == null || i.disable(), (n = this.drawingOverlay) == null || n.disable(), this.drawModeActive && ((r = this.drawingOverlay) == null || r.disableDrawMode(), this.drawModeActive = !1), (o = this.client) == null || o.setAppearOffline(!0), (l = this.commentPins) == null || l.setVisible(!1), this.followingUserId = null, this.pinModeActive && ((a = this.commentPins) == null || a.exitPinMode(), this.pinModeActive = !1), this.activePanel = this.activePanel === "settings" ? "settings" : null, this.highlightThreadId = null;
6689
+ (e = this.cursorOverlay) == null || e.disable(), (t = this.viewportOverlay) == null || t.disable(), (i = this.selectionOverlay) == null || i.disable(), (n = this.drawingOverlay) == null || n.disable(), this.drawModeActive && ((o = this.drawingOverlay) == null || o.disableDrawMode(), this.drawModeActive = !1), (r = this.client) == null || r.setAppearOffline(!0), (l = this.commentPins) == null || l.setVisible(!1), this.followingUserId = null, this.pinModeActive && ((a = this.commentPins) == null || a.exitPinMode(), this.pinModeActive = !1), this.activePanel = this.activePanel === "settings" ? "settings" : null, this.highlightThreadId = null;
6684
6690
  return;
6685
6691
  }
6686
6692
  this.applyCursorSettings(s), (c = this.client) == null || c.setAppearOffline(s.appearOffline), (h = this.commentPins) == null || h.setVisible(s.showCommentPins), s.showViewportIndicators ? (p = this.viewportOverlay) == null || p.enable() : (m = this.viewportOverlay) == null || m.disable(), s.showSelections ? (f = this.selectionOverlay) == null || f.enable() : (b = this.selectionOverlay) == null || b.disable(), s.showDrawings ? (x = this.drawingOverlay) == null || x.enable() : ((_ = this.drawingOverlay) == null || _.disable(), this.drawModeActive && (($ = this.drawingOverlay) == null || $.disableDrawMode(), this.drawModeActive = !1));
@@ -6700,10 +6706,10 @@ let E = class extends S {
6700
6706
  var b, x, _, $;
6701
6707
  const s = this.display === "inline", e = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".inline-trigger"), t = (x = this.shadowRoot) == null ? void 0 : x.querySelector("pulse-widget-toolbar"), i = s ? e : t;
6702
6708
  if (!i) return;
6703
- const n = i.getBoundingClientRect(), r = window.innerWidth, o = window.innerHeight, l = 8, a = (_ = this.shadowRoot) == null ? void 0 : _.querySelector(".toolbar-popover");
6709
+ const n = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = (_ = this.shadowRoot) == null ? void 0 : _.querySelector(".toolbar-popover");
6704
6710
  if (a) {
6705
6711
  Object.assign(a.style, { top: "auto", left: "auto" });
6706
- const k = a.getBoundingClientRect(), A = this.computePosition(n, k, r, o, l);
6712
+ const k = a.getBoundingClientRect(), A = this.computePosition(n, k, o, r, l);
6707
6713
  a.style.top = `${A.top}px`, a.style.left = `${A.left}px`;
6708
6714
  }
6709
6715
  const c = ($ = this.shadowRoot) == null ? void 0 : $.querySelector(".panel-container");
@@ -6711,13 +6717,13 @@ let E = class extends S {
6711
6717
  Object.assign(c.style, { top: "auto", left: "auto" });
6712
6718
  const h = a ?? t;
6713
6719
  if (!h) return;
6714
- const p = h.getBoundingClientRect(), m = c.getBoundingClientRect(), f = this.computePosition(p, m, r, o, l);
6720
+ const p = h.getBoundingClientRect(), m = c.getBoundingClientRect(), f = this.computePosition(p, m, o, r, l);
6715
6721
  c.style.top = `${f.top}px`, c.style.left = `${f.left}px`;
6716
6722
  }
6717
6723
  computePosition(s, e, t, i, n) {
6718
- const r = s.top, o = i - s.bottom;
6724
+ const o = s.top, r = i - s.bottom;
6719
6725
  let l;
6720
- r >= e.height + n ? l = s.top - e.height - n : o >= e.height + n ? l = s.bottom + n : l = r >= o ? Math.max(n, s.top - e.height - n) : s.bottom + n;
6726
+ o >= e.height + n ? l = s.top - e.height - n : r >= e.height + n ? l = s.bottom + n : l = o >= r ? Math.max(n, s.top - e.height - n) : s.bottom + n;
6721
6727
  let a;
6722
6728
  const c = s.right - e.width;
6723
6729
  return c >= n ? a = c : s.left + e.width + n <= t ? a = s.left : a = Math.max(n, Math.min(t - e.width - n, s.left)), l = Math.max(n, Math.min(i - e.height - n, l)), a = Math.max(n, Math.min(t - e.width - n, a)), { top: l, left: a };