@gamention/pulse-elements 0.1.12 → 0.1.14

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.
@@ -157,11 +157,11 @@ function pe({ context: n, subscribe: e }) {
157
157
  }));
158
158
  };
159
159
  }
160
- var Ot = Object.defineProperty, Rt = (n, e, t) => e in n ? Ot(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, x = (n, e, t) => Rt(n, typeof e != "symbol" ? e + "" : e, t);
160
+ var Ot = Object.defineProperty, Rt = (n, e, t) => e in n ? Ot(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, $ = (n, e, t) => Rt(n, typeof e != "symbol" ? e + "" : e, t);
161
161
  const Lt = "ws://localhost:4567";
162
162
  let je = class {
163
163
  constructor() {
164
- x(this, "handlers", /* @__PURE__ */ new Map());
164
+ $(this, "handlers", /* @__PURE__ */ new Map());
165
165
  }
166
166
  on(e, t) {
167
167
  this.handlers.has(e) || this.handlers.set(e, /* @__PURE__ */ new Set());
@@ -181,7 +181,7 @@ let je = class {
181
181
  }
182
182
  }, jt = class extends je {
183
183
  constructor(e) {
184
- super(), x(this, "ws", null), x(this, "endpoint"), x(this, "reconnectAttempt", 0), x(this, "reconnectTimer", null), x(this, "_state", "disconnected"), this.endpoint = e ?? Lt;
184
+ super(), $(this, "ws", null), $(this, "endpoint"), $(this, "reconnectAttempt", 0), $(this, "reconnectTimer", null), $(this, "_state", "disconnected"), this.endpoint = e ?? Lt;
185
185
  }
186
186
  get state() {
187
187
  return this._state;
@@ -216,9 +216,9 @@ let je = class {
216
216
  this.reconnectTimer = null, this.connect();
217
217
  }, e);
218
218
  }
219
- }, Ut = class extends je {
219
+ }, zt = class extends je {
220
220
  constructor() {
221
- super(...arguments), x(this, "baseUrl", ""), x(this, "_user", null), x(this, "_users", /* @__PURE__ */ new Map()), x(this, "_presence", /* @__PURE__ */ new Map()), x(this, "_threads", /* @__PURE__ */ new Map()), x(this, "_reactions", /* @__PURE__ */ new Map()), x(this, "_notifications", []), x(this, "_activityLogs", []), x(this, "_typing", /* @__PURE__ */ new Map()), x(this, "_viewports", /* @__PURE__ */ new Map()), x(this, "_selections", /* @__PURE__ */ new Map());
221
+ super(...arguments), $(this, "baseUrl", ""), $(this, "_user", null), $(this, "_users", /* @__PURE__ */ new Map()), $(this, "_presence", /* @__PURE__ */ new Map()), $(this, "_threads", /* @__PURE__ */ new Map()), $(this, "_reactions", /* @__PURE__ */ new Map()), $(this, "_notifications", []), $(this, "_activityLogs", []), $(this, "_typing", /* @__PURE__ */ new Map()), $(this, "_viewports", /* @__PURE__ */ new Map()), $(this, "_selections", /* @__PURE__ */ new Map());
222
222
  }
223
223
  get user() {
224
224
  return this._user;
@@ -429,7 +429,7 @@ let je = class {
429
429
  }, xt = class extends je {
430
430
  constructor(e) {
431
431
  var t;
432
- super(), x(this, "state"), x(this, "connection"), x(this, "config"), x(this, "heartbeatTimer", null), x(this, "lastCursorSend", 0), x(this, "pendingCursor", null), x(this, "cursorTimer", null), this.config = e, this.state = new Ut(), this.state.baseUrl = (e.endpoint ?? "").replace(/^ws(s?):/, "http$1:").replace(/\/$/, "");
432
+ super(), $(this, "state"), $(this, "connection"), $(this, "config"), $(this, "heartbeatTimer", null), $(this, "lastCursorSend", 0), $(this, "pendingCursor", null), $(this, "cursorTimer", null), this.config = e, this.state = new zt(), this.state.baseUrl = (e.endpoint ?? "").replace(/^ws(s?):/, "http$1:").replace(/\/$/, "");
433
433
  const i = ((t = e.endpoint) == null ? void 0 : t.replace(/^http/, "ws")) ?? void 0;
434
434
  this.connection = new jt(i), this.connection.on("message", (s) => {
435
435
  this.state.handleMessage(s), this.emit(s.type, s);
@@ -575,16 +575,16 @@ let je = class {
575
575
  * Copyright 2019 Google LLC
576
576
  * SPDX-License-Identifier: BSD-3-Clause
577
577
  */
578
- const ve = globalThis, Ue = ve.ShadowRoot && (ve.ShadyCSS === void 0 || ve.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ze = Symbol(), Ye = /* @__PURE__ */ new WeakMap();
578
+ const ve = globalThis, ze = ve.ShadowRoot && (ve.ShadyCSS === void 0 || ve.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Ue = Symbol(), Ye = /* @__PURE__ */ new WeakMap();
579
579
  let yt = class {
580
580
  constructor(e, t, i) {
581
- if (this._$cssResult$ = !0, i !== ze) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
581
+ if (this._$cssResult$ = !0, i !== Ue) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
582
582
  this.cssText = e, this.t = t;
583
583
  }
584
584
  get styleSheet() {
585
585
  let e = this.o;
586
586
  const t = this.t;
587
- if (Ue && e === void 0) {
587
+ if (ze && e === void 0) {
588
588
  const i = t !== void 0 && t.length === 1;
589
589
  i && (e = Ye.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && Ye.set(t, e));
590
590
  }
@@ -594,30 +594,30 @@ let yt = class {
594
594
  return this.cssText;
595
595
  }
596
596
  };
597
- const zt = (n) => new yt(typeof n == "string" ? n : n + "", void 0, ze), A = (n, ...e) => {
597
+ const Ut = (n) => new yt(typeof n == "string" ? n : n + "", void 0, Ue), M = (n, ...e) => {
598
598
  const t = n.length === 1 ? n[0] : e.reduce((i, s, o) => i + ((r) => {
599
599
  if (r._$cssResult$ === !0) return r.cssText;
600
600
  if (typeof r == "number") return r;
601
601
  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.");
602
602
  })(s) + n[o + 1], n[0]);
603
- return new yt(t, n, ze);
603
+ return new yt(t, n, Ue);
604
604
  }, Dt = (n, e) => {
605
- if (Ue) n.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
605
+ if (ze) n.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
606
606
  else for (const t of e) {
607
607
  const i = document.createElement("style"), s = ve.litNonce;
608
608
  s !== void 0 && i.setAttribute("nonce", s), i.textContent = t.cssText, n.appendChild(i);
609
609
  }
610
- }, Ke = Ue ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((e) => {
610
+ }, Ke = ze ? (n) => n : (n) => n instanceof CSSStyleSheet ? ((e) => {
611
611
  let t = "";
612
612
  for (const i of e.cssRules) t += i.cssText;
613
- return zt(t);
613
+ return Ut(t);
614
614
  })(n) : n;
615
615
  /**
616
616
  * @license
617
617
  * Copyright 2017 Google LLC
618
618
  * SPDX-License-Identifier: BSD-3-Clause
619
619
  */
620
- const { is: Ht, defineProperty: Nt, getOwnPropertyDescriptor: Bt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Vt, getPrototypeOf: qt } = Object, z = globalThis, Ge = z.trustedTypes, Wt = Ge ? Ge.emptyScript : "", Te = z.reactiveElementPolyfillSupport, ie = (n, e) => n, we = { toAttribute(n, e) {
620
+ const { is: Ht, defineProperty: Nt, getOwnPropertyDescriptor: Bt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Vt, getPrototypeOf: qt } = Object, U = globalThis, Ge = U.trustedTypes, Wt = Ge ? Ge.emptyScript : "", Te = U.reactiveElementPolyfillSupport, ie = (n, e) => n, we = { toAttribute(n, e) {
621
621
  switch (e) {
622
622
  case Boolean:
623
623
  n = n ? Wt : null;
@@ -646,7 +646,7 @@ const { is: Ht, defineProperty: Nt, getOwnPropertyDescriptor: Bt, getOwnProperty
646
646
  }
647
647
  return t;
648
648
  } }, De = (n, e) => !Ht(n, e), Ze = { attribute: !0, type: String, converter: we, reflect: !1, useDefault: !1, hasChanged: De };
649
- Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), z.litPropertyMetadata ?? (z.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
649
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), U.litPropertyMetadata ?? (U.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
650
650
  let Y = class extends HTMLElement {
651
651
  static addInitializer(e) {
652
652
  this._$Ei(), (this.l ?? (this.l = [])).push(e);
@@ -850,15 +850,15 @@ let Y = class extends HTMLElement {
850
850
  firstUpdated(e) {
851
851
  }
852
852
  };
853
- Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, Y[ie("elementProperties")] = /* @__PURE__ */ new Map(), Y[ie("finalized")] = /* @__PURE__ */ new Map(), Te == null || Te({ ReactiveElement: Y }), (z.reactiveElementVersions ?? (z.reactiveElementVersions = [])).push("2.1.2");
853
+ Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, Y[ie("elementProperties")] = /* @__PURE__ */ new Map(), Y[ie("finalized")] = /* @__PURE__ */ new Map(), Te == null || Te({ ReactiveElement: Y }), (U.reactiveElementVersions ?? (U.reactiveElementVersions = [])).push("2.1.2");
854
854
  /**
855
855
  * @license
856
856
  * Copyright 2017 Google LLC
857
857
  * SPDX-License-Identifier: BSD-3-Clause
858
858
  */
859
- const se = globalThis, Je = (n) => n, $e = se.trustedTypes, Qe = $e ? $e.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, wt = "$lit$", U = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + U, Xt = `<${$t}>`, F = document, oe = () => F.createComment(""), re = (n) => n === null || typeof n != "object" && typeof n != "function", He = Array.isArray, Yt = (n) => He(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", Se = `[
859
+ const se = globalThis, Je = (n) => n, $e = se.trustedTypes, Qe = $e ? $e.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, wt = "$lit$", z = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + z, Xt = `<${$t}>`, F = document, oe = () => F.createComment(""), re = (n) => n === null || typeof n != "object" && typeof n != "function", He = Array.isArray, Yt = (n) => He(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", Se = `[
860
860
  \f\r]`, te = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, et = /-->/g, tt = />/g, H = RegExp(`>|${Se}(?:([^\\s"'>=/]+)(${Se}*=${Se}*(?:[^
861
- \f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, st = /"/g, kt = /^(?:script|style|textarea|title)$/i, Et = (n) => (e, ...t) => ({ _$litType$: n, strings: e, values: t }), h = Et(1), Kt = Et(2), V = Symbol.for("lit-noChange"), f = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), N = F.createTreeWalker(F, 129);
861
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), it = /'/g, st = /"/g, kt = /^(?:script|style|textarea|title)$/i, Et = (n) => (e, ...t) => ({ _$litType$: n, strings: e, values: t }), d = Et(1), Kt = Et(2), V = Symbol.for("lit-noChange"), g = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), N = F.createTreeWalker(F, 129);
862
862
  function Ct(n, e) {
863
863
  if (!He(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
864
864
  return Qe !== void 0 ? Qe.createHTML(e) : e;
@@ -868,10 +868,10 @@ const Gt = (n, e) => {
868
868
  let s, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
869
869
  for (let l = 0; l < t; l++) {
870
870
  const a = n[l];
871
- let c, p, d = -1, u = 0;
872
- for (; u < a.length && (r.lastIndex = u, p = r.exec(a), p !== null); ) u = r.lastIndex, r === te ? p[1] === "!--" ? r = et : p[1] !== void 0 ? r = tt : p[2] !== void 0 ? (kt.test(p[2]) && (s = RegExp("</" + p[2], "g")), r = H) : p[3] !== void 0 && (r = H) : r === H ? p[0] === ">" ? (r = s ?? te, d = -1) : p[1] === void 0 ? d = -2 : (d = r.lastIndex - p[2].length, c = p[1], r = p[3] === void 0 ? H : p[3] === '"' ? st : it) : r === st || r === it ? r = H : r === et || r === tt ? r = te : (r = H, s = void 0);
873
- const m = r === H && n[l + 1].startsWith("/>") ? " " : "";
874
- o += r === te ? a + Xt : d >= 0 ? (i.push(c), a.slice(0, d) + wt + a.slice(d) + U + m) : a + U + (d === -2 ? l : m);
871
+ let c, h, p = -1, u = 0;
872
+ for (; u < a.length && (r.lastIndex = u, h = r.exec(a), h !== null); ) u = r.lastIndex, r === te ? h[1] === "!--" ? r = et : h[1] !== void 0 ? r = tt : h[2] !== void 0 ? (kt.test(h[2]) && (s = RegExp("</" + h[2], "g")), r = H) : h[3] !== void 0 && (r = H) : r === H ? h[0] === ">" ? (r = s ?? 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] === '"' ? st : it) : r === st || r === it ? r = H : r === et || r === tt ? r = te : (r = H, s = void 0);
873
+ const f = r === H && n[l + 1].startsWith("/>") ? " " : "";
874
+ o += r === te ? a + Xt : p >= 0 ? (i.push(c), a.slice(0, p) + wt + a.slice(p) + z + f) : a + z + (p === -2 ? l : f);
875
875
  }
876
876
  return [Ct(n, o + (n[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
877
877
  };
@@ -880,29 +880,29 @@ class ae {
880
880
  let s;
881
881
  this.parts = [];
882
882
  let o = 0, r = 0;
883
- const l = e.length - 1, a = this.parts, [c, p] = Gt(e, t);
883
+ const l = e.length - 1, a = this.parts, [c, h] = Gt(e, t);
884
884
  if (this.el = ae.createElement(c, i), N.currentNode = this.el.content, t === 2 || t === 3) {
885
- const d = this.el.content.firstChild;
886
- d.replaceWith(...d.childNodes);
885
+ const p = this.el.content.firstChild;
886
+ p.replaceWith(...p.childNodes);
887
887
  }
888
888
  for (; (s = N.nextNode()) !== null && a.length < l; ) {
889
889
  if (s.nodeType === 1) {
890
- if (s.hasAttributes()) for (const d of s.getAttributeNames()) if (d.endsWith(wt)) {
891
- const u = p[r++], m = s.getAttribute(d).split(U), b = /([.?@])?(.*)/.exec(u);
892
- a.push({ type: 1, index: o, name: b[2], strings: m, ctor: b[1] === "." ? Jt : b[1] === "?" ? Qt : b[1] === "@" ? ei : Ee }), s.removeAttribute(d);
893
- } else d.startsWith(U) && (a.push({ type: 6, index: o }), s.removeAttribute(d));
890
+ if (s.hasAttributes()) for (const p of s.getAttributeNames()) if (p.endsWith(wt)) {
891
+ const u = h[r++], f = s.getAttribute(p).split(z), m = /([.?@])?(.*)/.exec(u);
892
+ a.push({ type: 1, index: o, name: m[2], strings: f, ctor: m[1] === "." ? Jt : m[1] === "?" ? Qt : m[1] === "@" ? ei : Ee }), s.removeAttribute(p);
893
+ } else p.startsWith(z) && (a.push({ type: 6, index: o }), s.removeAttribute(p));
894
894
  if (kt.test(s.tagName)) {
895
- const d = s.textContent.split(U), u = d.length - 1;
895
+ const p = s.textContent.split(z), u = p.length - 1;
896
896
  if (u > 0) {
897
897
  s.textContent = $e ? $e.emptyScript : "";
898
- for (let m = 0; m < u; m++) s.append(d[m], oe()), N.nextNode(), a.push({ type: 2, index: ++o });
899
- s.append(d[u], oe());
898
+ for (let f = 0; f < u; f++) s.append(p[f], oe()), N.nextNode(), a.push({ type: 2, index: ++o });
899
+ s.append(p[u], oe());
900
900
  }
901
901
  }
902
902
  } else if (s.nodeType === 8) if (s.data === $t) a.push({ type: 2, index: o });
903
903
  else {
904
- let d = -1;
905
- for (; (d = s.data.indexOf(U, d + 1)) !== -1; ) a.push({ type: 7, index: o }), d += U.length - 1;
904
+ let p = -1;
905
+ for (; (p = s.data.indexOf(z, p + 1)) !== -1; ) a.push({ type: 7, index: o }), p += z.length - 1;
906
906
  }
907
907
  o++;
908
908
  }
@@ -953,7 +953,7 @@ class ue {
953
953
  return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
954
954
  }
955
955
  constructor(e, t, i, s) {
956
- this.type = 2, this._$AH = f, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
956
+ this.type = 2, this._$AH = g, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = s, this._$Cv = (s == null ? void 0 : s.isConnected) ?? !0;
957
957
  }
958
958
  get parentNode() {
959
959
  let e = this._$AA.parentNode;
@@ -967,7 +967,7 @@ class ue {
967
967
  return this._$AB;
968
968
  }
969
969
  _$AI(e, t = this) {
970
- e = K(this, e, t), re(e) ? e === f || e == null || e === "" ? (this._$AH !== f && this._$AR(), this._$AH = f) : e !== this._$AH && e !== V && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Yt(e) ? this.k(e) : this._(e);
970
+ e = K(this, e, t), re(e) ? e === g || e == null || e === "" ? (this._$AH !== g && this._$AR(), this._$AH = g) : e !== this._$AH && e !== V && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Yt(e) ? this.k(e) : this._(e);
971
971
  }
972
972
  O(e) {
973
973
  return this._$AA.parentNode.insertBefore(e, this._$AB);
@@ -976,7 +976,7 @@ class ue {
976
976
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
977
977
  }
978
978
  _(e) {
979
- this._$AH !== f && re(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
979
+ this._$AH !== g && re(this._$AH) ? this._$AA.nextSibling.data = e : this.T(F.createTextNode(e)), this._$AH = e;
980
980
  }
981
981
  $(e) {
982
982
  var o;
@@ -1018,7 +1018,7 @@ class Ee {
1018
1018
  return this._$AM._$AU;
1019
1019
  }
1020
1020
  constructor(e, t, i, s, o) {
1021
- this.type = 1, this._$AH = f, this._$AN = void 0, this.element = e, this.name = t, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = f;
1021
+ this.type = 1, this._$AH = g, this._$AN = void 0, this.element = e, this.name = t, this._$AM = s, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = g;
1022
1022
  }
1023
1023
  _$AI(e, t = this, i, s) {
1024
1024
  const o = this.strings;
@@ -1027,12 +1027,12 @@ class Ee {
1027
1027
  else {
1028
1028
  const l = e;
1029
1029
  let a, c;
1030
- for (e = o[0], a = 0; a < o.length - 1; a++) c = K(this, l[i + a], t, a), c === V && (c = this._$AH[a]), r || (r = !re(c) || c !== this._$AH[a]), c === f ? e = f : e !== f && (e += (c ?? "") + o[a + 1]), this._$AH[a] = c;
1030
+ for (e = o[0], a = 0; a < o.length - 1; a++) c = K(this, l[i + a], t, a), c === V && (c = this._$AH[a]), r || (r = !re(c) || c !== this._$AH[a]), c === g ? e = g : e !== g && (e += (c ?? "") + o[a + 1]), this._$AH[a] = c;
1031
1031
  }
1032
1032
  r && !s && this.j(e);
1033
1033
  }
1034
1034
  j(e) {
1035
- e === f ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
1035
+ e === g ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
1036
1036
  }
1037
1037
  }
1038
1038
  class Jt extends Ee {
@@ -1040,7 +1040,7 @@ class Jt extends Ee {
1040
1040
  super(...arguments), this.type = 3;
1041
1041
  }
1042
1042
  j(e) {
1043
- this.element[this.name] = e === f ? void 0 : e;
1043
+ this.element[this.name] = e === g ? void 0 : e;
1044
1044
  }
1045
1045
  }
1046
1046
  class Qt extends Ee {
@@ -1048,7 +1048,7 @@ class Qt extends Ee {
1048
1048
  super(...arguments), this.type = 4;
1049
1049
  }
1050
1050
  j(e) {
1051
- this.element.toggleAttribute(this.name, !!e && e !== f);
1051
+ this.element.toggleAttribute(this.name, !!e && e !== g);
1052
1052
  }
1053
1053
  }
1054
1054
  class ei extends Ee {
@@ -1056,8 +1056,8 @@ class ei extends Ee {
1056
1056
  super(e, t, i, s, o), this.type = 5;
1057
1057
  }
1058
1058
  _$AI(e, t = this) {
1059
- if ((e = K(this, e, t, 0) ?? f) === V) return;
1060
- const i = this._$AH, s = e === f && i !== f || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== f && (i === f || s);
1059
+ if ((e = K(this, e, t, 0) ?? g) === V) return;
1060
+ const i = this._$AH, s = e === g && i !== g || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== g && (i === g || s);
1061
1061
  s && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
1062
1062
  }
1063
1063
  handleEvent(e) {
@@ -1093,7 +1093,7 @@ const ii = (n, e, t) => {
1093
1093
  * SPDX-License-Identifier: BSD-3-Clause
1094
1094
  */
1095
1095
  const B = globalThis;
1096
- let T = class extends Y {
1096
+ let S = class extends Y {
1097
1097
  constructor() {
1098
1098
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1099
1099
  }
@@ -1119,9 +1119,9 @@ let T = class extends Y {
1119
1119
  }
1120
1120
  };
1121
1121
  var bt;
1122
- T._$litElement$ = !0, T.finalized = !0, (bt = B.litElementHydrateSupport) == null || bt.call(B, { LitElement: T });
1122
+ S._$litElement$ = !0, S.finalized = !0, (bt = B.litElementHydrateSupport) == null || bt.call(B, { LitElement: S });
1123
1123
  const Ae = B.litElementPolyfillSupport;
1124
- Ae == null || Ae({ LitElement: T });
1124
+ Ae == null || Ae({ LitElement: S });
1125
1125
  (B.litElementVersions ?? (B.litElementVersions = [])).push("4.2.2");
1126
1126
  /**
1127
1127
  * @license
@@ -1159,7 +1159,7 @@ const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged
1159
1159
  }
1160
1160
  throw Error("Unsupported decorator location: " + i);
1161
1161
  };
1162
- function g(n) {
1162
+ function v(n) {
1163
1163
  return (e, t) => typeof t == "object" ? ni(n, e, t) : ((i, s, o) => {
1164
1164
  const r = s.hasOwnProperty(o);
1165
1165
  return s.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(s, o) : void 0;
@@ -1170,8 +1170,8 @@ function g(n) {
1170
1170
  * Copyright 2017 Google LLC
1171
1171
  * SPDX-License-Identifier: BSD-3-Clause
1172
1172
  */
1173
- function v(n) {
1174
- return g({ ...n, state: !0, attribute: !1 });
1173
+ function w(n) {
1174
+ return v({ ...n, state: !0, attribute: !1 });
1175
1175
  }
1176
1176
  const Z = "pulse-client";
1177
1177
  var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (n, e, t, i) => {
@@ -1179,7 +1179,7 @@ var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (n, e,
1179
1179
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1180
1180
  return i && s && oi(e, t, s), s;
1181
1181
  };
1182
- let q = class extends T {
1182
+ let q = class extends S {
1183
1183
  constructor() {
1184
1184
  super(...arguments), this.apiKey = "", this.token = "", this.room = "";
1185
1185
  }
@@ -1198,20 +1198,20 @@ let q = class extends T {
1198
1198
  super.disconnectedCallback(), (n = this.client) == null || n.disconnect();
1199
1199
  }
1200
1200
  render() {
1201
- return h`<slot></slot>`;
1201
+ return d`<slot></slot>`;
1202
1202
  }
1203
1203
  };
1204
1204
  J([
1205
- g({ attribute: "api-key" })
1205
+ v({ attribute: "api-key" })
1206
1206
  ], q.prototype, "apiKey", 2);
1207
1207
  J([
1208
- g()
1208
+ v()
1209
1209
  ], q.prototype, "token", 2);
1210
1210
  J([
1211
- g()
1211
+ v()
1212
1212
  ], q.prototype, "room", 2);
1213
1213
  J([
1214
- g()
1214
+ v()
1215
1215
  ], q.prototype, "endpoint", 2);
1216
1216
  J([
1217
1217
  Mt({ context: Z })
@@ -1224,7 +1224,7 @@ var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (n, e
1224
1224
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1225
1225
  return i && s && ai(e, t, s), s;
1226
1226
  };
1227
- let G = class extends T {
1227
+ let G = class extends S {
1228
1228
  constructor() {
1229
1229
  super(...arguments), this.maxVisible = 5, this.users = [];
1230
1230
  }
@@ -1249,16 +1249,16 @@ let G = class extends T {
1249
1249
  }
1250
1250
  render() {
1251
1251
  const n = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
1252
- return h`
1252
+ return d`
1253
1253
  <div class="avatars">
1254
- ${e > 0 ? h`<div class="overflow">+${e}</div>` : null}
1254
+ ${e > 0 ? d`<div class="overflow">+${e}</div>` : null}
1255
1255
  ${n.map(
1256
- (t) => h`
1256
+ (t) => d`
1257
1257
  <div
1258
1258
  class="avatar"
1259
1259
  style="background:${t.user.color}"
1260
1260
  >
1261
- ${t.user.avatar ? h`<img src="${t.user.avatar}" alt="${t.user.name}" />` : this.getInitials(t.user.name)}
1261
+ ${t.user.avatar ? d`<img src="${t.user.avatar}" alt="${t.user.name}" />` : this.getInitials(t.user.name)}
1262
1262
  <span class="status-ring ${t.status}"></span>
1263
1263
  <span class="tooltip">${t.user.name}</span>
1264
1264
  </div>
@@ -1268,7 +1268,7 @@ let G = class extends T {
1268
1268
  `;
1269
1269
  }
1270
1270
  };
1271
- G.styles = A`
1271
+ G.styles = M`
1272
1272
  :host {
1273
1273
  display: inline-flex;
1274
1274
  align-items: center;
@@ -1374,13 +1374,13 @@ G.styles = A`
1374
1374
  `;
1375
1375
  Ce([
1376
1376
  pe({ context: Z, subscribe: !0 }),
1377
- g({ attribute: !1 })
1377
+ v({ attribute: !1 })
1378
1378
  ], G.prototype, "client", 2);
1379
1379
  Ce([
1380
- g({ type: Number, attribute: "max-visible" })
1380
+ v({ type: Number, attribute: "max-visible" })
1381
1381
  ], G.prototype, "maxVisible", 2);
1382
1382
  Ce([
1383
- v()
1383
+ w()
1384
1384
  ], G.prototype, "users", 2);
1385
1385
  G = Ce([
1386
1386
  R("pulse-presence")
@@ -1390,7 +1390,7 @@ var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Ne = (n, e
1390
1390
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1391
1391
  return i && s && ci(e, t, s), s;
1392
1392
  };
1393
- let le = class extends T {
1393
+ let le = class extends S {
1394
1394
  constructor() {
1395
1395
  super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (n) => {
1396
1396
  var e;
@@ -1444,9 +1444,9 @@ let le = class extends T {
1444
1444
  }
1445
1445
  render() {
1446
1446
  const n = [...this.cursors.values()];
1447
- return h`
1447
+ return d`
1448
1448
  ${n.map(
1449
- (e) => h`
1449
+ (e) => d`
1450
1450
  <div
1451
1451
  class="cursor"
1452
1452
  style="transform:translate(${e.position.x}px,${e.position.y}px)"
@@ -1467,7 +1467,7 @@ let le = class extends T {
1467
1467
  `;
1468
1468
  }
1469
1469
  };
1470
- le.styles = A`
1470
+ le.styles = M`
1471
1471
  :host {
1472
1472
  position: fixed;
1473
1473
  top: 0;
@@ -1506,10 +1506,10 @@ le.styles = A`
1506
1506
  `;
1507
1507
  Ne([
1508
1508
  pe({ context: Z, subscribe: !0 }),
1509
- g({ attribute: !1 })
1509
+ v({ attribute: !1 })
1510
1510
  ], le.prototype, "client", 2);
1511
1511
  Ne([
1512
- v()
1512
+ w()
1513
1513
  ], le.prototype, "cursors", 2);
1514
1514
  le = Ne([
1515
1515
  R("pulse-cursors")
@@ -1519,7 +1519,7 @@ var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (n, e
1519
1519
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1520
1520
  return i && s && hi(e, t, s), s;
1521
1521
  };
1522
- let W = class extends T {
1522
+ let W = class extends S {
1523
1523
  constructor() {
1524
1524
  super(...arguments), this.showResolved = !1, this.threads = [], this.replyingTo = null;
1525
1525
  }
@@ -1541,7 +1541,7 @@ let W = class extends T {
1541
1541
  }
1542
1542
  parseMentions(n) {
1543
1543
  return n.split(/(@\w+)/g).map(
1544
- (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
1544
+ (t) => t.startsWith("@") ? d`<span class="mention">${t}</span>` : t
1545
1545
  );
1546
1546
  }
1547
1547
  getInitials(n) {
@@ -1567,9 +1567,9 @@ let W = class extends T {
1567
1567
  }
1568
1568
  render() {
1569
1569
  const n = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
1570
- return h`
1570
+ return d`
1571
1571
  <div class="threads">
1572
- ${n.length === 0 ? h`<div class="empty">
1572
+ ${n.length === 0 ? d`<div class="empty">
1573
1573
  <div class="empty-icon">&#128172;</div>
1574
1574
  No comments yet.<br>Start a conversation below.
1575
1575
  </div>` : n.map((e) => this.renderThread(e))}
@@ -1583,12 +1583,12 @@ let W = class extends T {
1583
1583
  `;
1584
1584
  }
1585
1585
  renderThread(n) {
1586
- return h`
1586
+ return d`
1587
1587
  <div class="thread ${n.resolved ? "resolved" : ""}">
1588
1588
  ${n.comments.map((e, t) => {
1589
1589
  const i = this.getUserForComment(e.userId);
1590
- return h`
1591
- ${t > 0 ? h`<div class="divider"></div>` : f}
1590
+ return d`
1591
+ ${t > 0 ? d`<div class="divider"></div>` : g}
1592
1592
  <div class="comment">
1593
1593
  <div class="comment-header">
1594
1594
  <div
@@ -1620,12 +1620,12 @@ let W = class extends T {
1620
1620
  ${n.resolved ? "Reopen" : "Resolve"}
1621
1621
  </button>
1622
1622
  </div>
1623
- ${this.replyingTo === n.id ? h`
1623
+ ${this.replyingTo === n.id ? d`
1624
1624
  <form class="reply-form" @submit=${(e) => this.handleReply(n.id, e)}>
1625
1625
  <input type="text" placeholder="Write a reply..." />
1626
1626
  <button type="submit">Send</button>
1627
1627
  </form>
1628
- ` : f}
1628
+ ` : g}
1629
1629
  </div>
1630
1630
  `;
1631
1631
  }
@@ -1637,7 +1637,7 @@ let W = class extends T {
1637
1637
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1638
1638
  }
1639
1639
  };
1640
- W.styles = A`
1640
+ W.styles = M`
1641
1641
  :host {
1642
1642
  display: block;
1643
1643
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -1851,16 +1851,16 @@ W.styles = A`
1851
1851
  `;
1852
1852
  fe([
1853
1853
  pe({ context: Z, subscribe: !0 }),
1854
- g({ attribute: !1 })
1854
+ v({ attribute: !1 })
1855
1855
  ], W.prototype, "client", 2);
1856
1856
  fe([
1857
- g({ type: Boolean, attribute: "show-resolved" })
1857
+ v({ type: Boolean, attribute: "show-resolved" })
1858
1858
  ], W.prototype, "showResolved", 2);
1859
1859
  fe([
1860
- v()
1860
+ w()
1861
1861
  ], W.prototype, "threads", 2);
1862
1862
  fe([
1863
- v()
1863
+ w()
1864
1864
  ], W.prototype, "replyingTo", 2);
1865
1865
  W = fe([
1866
1866
  R("pulse-comments")
@@ -1883,7 +1883,7 @@ const mi = {
1883
1883
  "thread:resolved": "✅",
1884
1884
  "reaction:added": "🎉"
1885
1885
  };
1886
- let ce = class extends T {
1886
+ let ce = class extends S {
1887
1887
  constructor() {
1888
1888
  super(...arguments), this.notifications = [];
1889
1889
  }
@@ -1930,22 +1930,22 @@ let ce = class extends T {
1930
1930
  }
1931
1931
  render() {
1932
1932
  const n = this.notifications.filter((e) => !e.read).length;
1933
- return h`
1933
+ return d`
1934
1934
  <div class="header">
1935
1935
  <span class="title">
1936
1936
  Notifications
1937
- ${n > 0 ? h`<span class="badge">${n}</span>` : f}
1937
+ ${n > 0 ? d`<span class="badge">${n}</span>` : g}
1938
1938
  </span>
1939
- ${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
1939
+ ${n > 0 ? d`<button class="mark-all" @click=${() => this.client.markAllRead()}>
1940
1940
  Mark all read
1941
- </button>` : f}
1941
+ </button>` : g}
1942
1942
  </div>
1943
1943
  <div class="list">
1944
- ${this.notifications.length === 0 ? h`<div class="empty">
1944
+ ${this.notifications.length === 0 ? d`<div class="empty">
1945
1945
  <div class="empty-icon">&#128276;</div>
1946
1946
  No notifications yet
1947
1947
  </div>` : this.notifications.map(
1948
- (e) => h`
1948
+ (e) => d`
1949
1949
  <div
1950
1950
  class="item ${e.read ? "" : "unread"}"
1951
1951
  @click=${() => this.handleClick(e)}
@@ -1966,7 +1966,7 @@ let ce = class extends T {
1966
1966
  `;
1967
1967
  }
1968
1968
  };
1969
- ce.styles = A`
1969
+ ce.styles = M`
1970
1970
  :host {
1971
1971
  display: block;
1972
1972
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -2109,10 +2109,10 @@ ce.styles = A`
2109
2109
  `;
2110
2110
  Be([
2111
2111
  pe({ context: Z, subscribe: !0 }),
2112
- g({ attribute: !1 })
2112
+ v({ attribute: !1 })
2113
2113
  ], ce.prototype, "client", 2);
2114
2114
  Be([
2115
- v()
2115
+ w()
2116
2116
  ], ce.prototype, "notifications", 2);
2117
2117
  ce = Be([
2118
2118
  R("pulse-notifications")
@@ -2123,7 +2123,7 @@ var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (n, e,
2123
2123
  return i && s && bi(e, t, s), s;
2124
2124
  };
2125
2125
  const xi = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
2126
- let D = class extends T {
2126
+ let D = class extends S {
2127
2127
  constructor() {
2128
2128
  super(...arguments), this.targetId = "", this.targetType = "comment", this.reactions = [], this.showPicker = !1;
2129
2129
  }
@@ -2163,9 +2163,9 @@ let D = class extends T {
2163
2163
  }
2164
2164
  render() {
2165
2165
  const n = this.groupReactions();
2166
- return h`
2166
+ return d`
2167
2167
  ${n.map(
2168
- (e) => h`
2168
+ (e) => d`
2169
2169
  <button
2170
2170
  class="reaction ${e.userReactionId ? "active" : ""}"
2171
2171
  @click=${() => this.toggleReaction(e)}
@@ -2182,22 +2182,22 @@ let D = class extends T {
2182
2182
  >
2183
2183
  +
2184
2184
  </button>
2185
- ${this.showPicker ? h`
2185
+ ${this.showPicker ? d`
2186
2186
  <div class="picker">
2187
2187
  ${xi.map(
2188
- (e) => h`
2188
+ (e) => d`
2189
2189
  <button @click=${() => this.addEmoji(e)}>
2190
2190
  ${e}
2191
2191
  </button>
2192
2192
  `
2193
2193
  )}
2194
2194
  </div>
2195
- ` : f}
2195
+ ` : g}
2196
2196
  </div>
2197
2197
  `;
2198
2198
  }
2199
2199
  };
2200
- D.styles = A`
2200
+ D.styles = M`
2201
2201
  :host {
2202
2202
  display: inline-flex;
2203
2203
  align-items: center;
@@ -2311,19 +2311,19 @@ D.styles = A`
2311
2311
  `;
2312
2312
  Q([
2313
2313
  pe({ context: Z, subscribe: !0 }),
2314
- g({ attribute: !1 })
2314
+ v({ attribute: !1 })
2315
2315
  ], D.prototype, "client", 2);
2316
2316
  Q([
2317
- g({ attribute: "target-id" })
2317
+ v({ attribute: "target-id" })
2318
2318
  ], D.prototype, "targetId", 2);
2319
2319
  Q([
2320
- g({ attribute: "target-type" })
2320
+ v({ attribute: "target-type" })
2321
2321
  ], D.prototype, "targetType", 2);
2322
2322
  Q([
2323
- v()
2323
+ w()
2324
2324
  ], D.prototype, "reactions", 2);
2325
2325
  Q([
2326
- v()
2326
+ w()
2327
2327
  ], D.prototype, "showPicker", 2);
2328
2328
  D = Q([
2329
2329
  R("pulse-reactions")
@@ -2357,10 +2357,10 @@ class $i {
2357
2357
  */
2358
2358
  class Ie extends $i {
2359
2359
  constructor(e) {
2360
- if (super(e), this.it = f, e.type !== yi.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
2360
+ if (super(e), this.it = g, e.type !== yi.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
2361
2361
  }
2362
2362
  render(e) {
2363
- if (e === f || e == null) return this._t = void 0, this.it = e;
2363
+ if (e === g || e == null) return this._t = void 0, this.it = e;
2364
2364
  if (e === V) return e;
2365
2365
  if (typeof e != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
2366
2366
  if (e === this.it) return this._t;
@@ -2563,7 +2563,7 @@ function Li(n) {
2563
2563
  return `<${e} ${i}/>`;
2564
2564
  }).join("");
2565
2565
  }
2566
- function k(n, e = 18) {
2566
+ function C(n, e = 18) {
2567
2567
  return Kt`<svg
2568
2568
  xmlns="http://www.w3.org/2000/svg"
2569
2569
  width="${e}"
@@ -2576,7 +2576,7 @@ function k(n, e = 18) {
2576
2576
  stroke-linejoin="round"
2577
2577
  >${ki(Li(n))}</svg>`;
2578
2578
  }
2579
- const ee = A`
2579
+ const ee = M`
2580
2580
  * {
2581
2581
  box-sizing: border-box;
2582
2582
  margin: 0;
@@ -2619,7 +2619,7 @@ const ee = A`
2619
2619
  --pw-shadow: var(--pulse-shadow);
2620
2620
  --pw-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
2621
2621
  }
2622
- `, ge = A`
2622
+ `, ge = M`
2623
2623
  .pw-btn {
2624
2624
  display: inline-flex;
2625
2625
  align-items: center;
@@ -2663,7 +2663,7 @@ const ee = A`
2663
2663
  width: 18px;
2664
2664
  height: 18px;
2665
2665
  }
2666
- `, _e = A`
2666
+ `, _e = M`
2667
2667
  .pw-scrollable::-webkit-scrollbar {
2668
2668
  width: 4px;
2669
2669
  }
@@ -2675,12 +2675,12 @@ const ee = A`
2675
2675
  background: transparent;
2676
2676
  }
2677
2677
  `;
2678
- var ji = Object.defineProperty, Ui = Object.getOwnPropertyDescriptor, Fe = (n, e, t, i) => {
2679
- for (var s = i > 1 ? void 0 : i ? Ui(e, t) : e, o = n.length - 1, r; o >= 0; o--)
2678
+ var ji = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, Fe = (n, e, t, i) => {
2679
+ for (var s = i > 1 ? void 0 : i ? zi(e, t) : e, o = n.length - 1, r; o >= 0; o--)
2680
2680
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
2681
2681
  return i && s && ji(e, t, s), s;
2682
2682
  };
2683
- let X = class extends T {
2683
+ let X = class extends S {
2684
2684
  constructor() {
2685
2685
  super(...arguments), this.items = [], this.unsubs = [], this.counter = 0;
2686
2686
  }
@@ -2726,18 +2726,18 @@ let X = class extends T {
2726
2726
  );
2727
2727
  }
2728
2728
  render() {
2729
- return h`
2729
+ return d`
2730
2730
  <div class="panel">
2731
2731
  <div class="panel-header">
2732
2732
  <span class="panel-title">Activity</span>
2733
2733
  <button class="close-btn" @click=${this.fireClose} title="Close">
2734
- ${k(me, 16)}
2734
+ ${C(me, 16)}
2735
2735
  </button>
2736
2736
  </div>
2737
2737
 
2738
2738
  <div class="panel-body pw-scrollable">
2739
- ${this.items.length === 0 ? h`<div class="empty">No activity yet</div>` : this.items.map(
2740
- (n) => h`
2739
+ ${this.items.length === 0 ? d`<div class="empty">No activity yet</div>` : this.items.map(
2740
+ (n) => d`
2741
2741
  <div class="activity-item">
2742
2742
  <div
2743
2743
  class="activity-dot"
@@ -2745,7 +2745,7 @@ let X = class extends T {
2745
2745
  ></div>
2746
2746
  <div class="activity-content">
2747
2747
  <div class="activity-text">
2748
- ${n.userId ? h`<span class="activity-user"
2748
+ ${n.userId ? d`<span class="activity-user"
2749
2749
  >${this.getUserName(n.userId)}</span
2750
2750
  >
2751
2751
  ${n.description}` : n.description}
@@ -2766,7 +2766,7 @@ X.styles = [
2766
2766
  ee,
2767
2767
  ge,
2768
2768
  _e,
2769
- A`
2769
+ M`
2770
2770
  :host {
2771
2771
  display: block;
2772
2772
  }
@@ -2892,15 +2892,15 @@ X.TYPE_COLORS = {
2892
2892
  resolve: "#22c55e"
2893
2893
  };
2894
2894
  Fe([
2895
- g({ attribute: !1 })
2895
+ v({ attribute: !1 })
2896
2896
  ], X.prototype, "client", 2);
2897
2897
  Fe([
2898
- v()
2898
+ w()
2899
2899
  ], X.prototype, "items", 2);
2900
2900
  X = Fe([
2901
2901
  R("pulse-widget-activity-panel")
2902
2902
  ], X);
2903
- const zi = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", ot = "#6366f1", rt = "#e2e8f0", Di = "#f8fafc", Hi = "#e2e8f0", at = "#64748b", xe = 28, Ni = Array.from({ length: xe }, (n, e) => 0.2 + Math.abs(Math.sin(e * 12.9898 + 78.233) * 43758.5453) % 1 * 0.8);
2903
+ const Ui = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", ot = "#6366f1", rt = "#e2e8f0", Di = "#f8fafc", Hi = "#e2e8f0", at = "#64748b", xe = 28, Ni = Array.from({ length: xe }, (n, e) => 0.2 + Math.abs(Math.sin(e * 12.9898 + 78.233) * 43758.5453) % 1 * 0.8);
2904
2904
  function lt(n) {
2905
2905
  const e = Math.max(0, Math.floor(n)), t = Math.floor(e / 60), i = e % 60;
2906
2906
  return `${t}:${i.toString().padStart(2, "0")}`;
@@ -2929,7 +2929,7 @@ class Oe {
2929
2929
  background: Di,
2930
2930
  borderRadius: "12px",
2931
2931
  border: `1px solid ${Hi}`,
2932
- fontFamily: zi,
2932
+ fontFamily: Ui,
2933
2933
  fontSize: "11px",
2934
2934
  color: at,
2935
2935
  userSelect: "none",
@@ -2958,18 +2958,18 @@ class Oe {
2958
2958
  height: "12px",
2959
2959
  lineHeight: "0"
2960
2960
  });
2961
- function p() {
2961
+ function h() {
2962
2962
  c.innerHTML = `<svg width="10" height="12" viewBox="0 0 10 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2963
2963
  <path d="M1 1L9 6L1 11V1Z" fill="white" stroke="white" stroke-width="1" stroke-linejoin="round"/>
2964
2964
  </svg>`;
2965
2965
  }
2966
- function d() {
2966
+ function p() {
2967
2967
  c.innerHTML = `<svg width="10" height="12" viewBox="0 0 10 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2968
2968
  <rect x="1" y="1" width="2.5" height="10" rx="0.5" fill="white"/>
2969
2969
  <rect x="6.5" y="1" width="2.5" height="10" rx="0.5" fill="white"/>
2970
2970
  </svg>`;
2971
2971
  }
2972
- p(), a.appendChild(c);
2972
+ h(), a.appendChild(c);
2973
2973
  const u = document.createElement("div");
2974
2974
  Object.assign(u.style, {
2975
2975
  flex: "1",
@@ -2979,65 +2979,65 @@ class Oe {
2979
2979
  overflow: "hidden",
2980
2980
  minWidth: "0"
2981
2981
  });
2982
- const m = document.createElement("div");
2983
- Object.assign(m.style, {
2982
+ const f = document.createElement("div");
2983
+ Object.assign(f.style, {
2984
2984
  display: "flex",
2985
2985
  alignItems: "center",
2986
2986
  gap: "1.5px",
2987
2987
  height: "22px",
2988
2988
  cursor: "pointer"
2989
2989
  });
2990
- const b = [];
2991
- for (let $ = 0; $ < xe; $++) {
2992
- const P = document.createElement("div"), y = Math.round(Ni[$] * 20);
2993
- Object.assign(P.style, {
2990
+ const m = [];
2991
+ for (let E = 0; E < xe; E++) {
2992
+ const I = document.createElement("div"), k = Math.round(Ni[E] * 20);
2993
+ Object.assign(I.style, {
2994
2994
  flex: "1",
2995
- height: `${Math.max(3, y)}px`,
2995
+ height: `${Math.max(3, k)}px`,
2996
2996
  borderRadius: "1px",
2997
2997
  background: rt,
2998
2998
  transition: "background 0.1s ease",
2999
2999
  minWidth: "0"
3000
- }), b.push(P), m.appendChild(P);
3000
+ }), m.push(I), f.appendChild(I);
3001
3001
  }
3002
- const I = document.createElement("div");
3003
- Object.assign(I.style, {
3002
+ const x = document.createElement("div");
3003
+ Object.assign(x.style, {
3004
3004
  fontSize: "10px",
3005
3005
  color: at,
3006
3006
  whiteSpace: "nowrap",
3007
3007
  lineHeight: "1"
3008
3008
  });
3009
- function C() {
3010
- const $ = lt(o), P = lt(s);
3011
- I.textContent = `${$} / ${P}`;
3009
+ function b() {
3010
+ const E = lt(o), I = lt(s);
3011
+ x.textContent = `${E} / ${I}`;
3012
3012
  }
3013
- C(), u.appendChild(m), u.appendChild(I), l.appendChild(a), l.appendChild(u);
3014
- function w() {
3015
- const $ = s > 0 ? o / s : 0, P = Math.floor($ * xe);
3016
- for (let y = 0; y < xe; y++)
3017
- b[y].style.background = y <= P ? ot : rt;
3013
+ b(), u.appendChild(f), u.appendChild(x), l.appendChild(a), l.appendChild(u);
3014
+ function y() {
3015
+ const E = s > 0 ? o / s : 0, I = Math.floor(E * xe);
3016
+ for (let k = 0; k < xe; k++)
3017
+ m[k].style.background = k <= I ? ot : rt;
3018
3018
  }
3019
- return m.addEventListener("click", ($) => {
3019
+ return f.addEventListener("click", (E) => {
3020
3020
  if (s <= 0) return;
3021
- const P = m.getBoundingClientRect(), y = Math.min(
3021
+ const I = f.getBoundingClientRect(), k = Math.min(
3022
3022
  1,
3023
- Math.max(0, ($.clientX - P.left) / P.width)
3023
+ Math.max(0, (E.clientX - I.left) / I.width)
3024
3024
  );
3025
- r.currentTime = y * s, o = r.currentTime, w(), C();
3025
+ r.currentTime = k * s, o = r.currentTime, y(), b();
3026
3026
  }), a.addEventListener("click", () => {
3027
3027
  i ? r.pause() : r.play().catch(() => {
3028
3028
  });
3029
3029
  }), r.addEventListener("play", () => {
3030
- i = !0, d();
3030
+ i = !0, p();
3031
3031
  }), r.addEventListener("pause", () => {
3032
- i = !1, p();
3032
+ i = !1, h();
3033
3033
  }), r.addEventListener("ended", () => {
3034
- i = !1, p(), o = 0, w(), C();
3034
+ i = !1, h(), o = 0, y(), b();
3035
3035
  }), r.addEventListener("timeupdate", () => {
3036
- o = r.currentTime, w(), C();
3036
+ o = r.currentTime, y(), b();
3037
3037
  }), r.addEventListener("loadedmetadata", () => {
3038
- r.duration && isFinite(r.duration) && (s = r.duration, C());
3038
+ r.duration && isFinite(r.duration) && (s = r.duration, b());
3039
3039
  }), r.addEventListener("durationchange", () => {
3040
- r.duration && isFinite(r.duration) && (s = r.duration, C());
3040
+ r.duration && isFinite(r.duration) && (s = r.duration, b());
3041
3041
  }), l;
3042
3042
  }
3043
3043
  }
@@ -3065,9 +3065,9 @@ class Re {
3065
3065
  this.resolve = l;
3066
3066
  });
3067
3067
  return this.recorder.onstop = () => {
3068
- var c, p;
3068
+ var c, h;
3069
3069
  const l = ((c = this.recorder) == null ? void 0 : c.mimeType) || i || "audio/webm", a = new Blob(o, { type: l });
3070
- (p = this.resolve) == null || p.call(this, a), this.resolve = null, this.cleanupResources();
3070
+ (h = this.resolve) == null || h.call(this, a), this.resolve = null, this.cleanupResources();
3071
3071
  }, this.recorder.start(), this.recording = !0, this.startTime = Date.now(), this.maxTimer = setTimeout(() => {
3072
3072
  this.stopRecording();
3073
3073
  }, this.maxDuration), this.animate(), r;
@@ -3172,8 +3172,8 @@ class Re {
3172
3172
  this.analyser.getByteFrequencyData(o), e.clearRect(0, 0, t, i);
3173
3173
  const r = s, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
3174
3174
  for (let c = 0; c < r; c++) {
3175
- const p = o[c] / 255, d = Math.max(2, p * i * 0.85), u = c * (l + a), m = (i - d) / 2, b = 0.4 + p * 0.6;
3176
- e.fillStyle = `rgba(99, 102, 241, ${b})`, e.beginPath(), e.roundRect(u, m, l, d, 1), e.fill();
3175
+ const h = o[c] / 255, p = Math.max(2, h * i * 0.85), u = c * (l + a), f = (i - p) / 2, m = 0.4 + h * 0.6;
3176
+ e.fillStyle = `rgba(99, 102, 241, ${m})`, e.beginPath(), e.roundRect(u, f, l, p, 1), e.fill();
3177
3177
  }
3178
3178
  }
3179
3179
  updateTimer() {
@@ -3270,14 +3270,14 @@ class Tt {
3270
3270
  function c() {
3271
3271
  l.style.opacity = i ? "0" : "1";
3272
3272
  }
3273
- function p() {
3273
+ function h() {
3274
3274
  a.style.display = i ? "flex" : "none", a.innerHTML = s ? dt : Vi;
3275
3275
  }
3276
- return o.addEventListener("click", (d) => {
3277
- d.stopPropagation(), i ? s ? (r.muted = !1, s = !1) : (r.pause(), i = !1, s = !0, r.muted = !0) : (r.muted = !0, s = !0, r.play().catch(() => {
3278
- }), i = !0), c(), p();
3276
+ return o.addEventListener("click", (p) => {
3277
+ p.stopPropagation(), i ? s ? (r.muted = !1, s = !1) : (r.pause(), i = !1, s = !0, r.muted = !0) : (r.muted = !0, s = !0, r.play().catch(() => {
3278
+ }), i = !0), c(), h();
3279
3279
  }), r.addEventListener("pause", () => {
3280
- i && (i = !1, s = !0, r.muted = !0, c(), p());
3280
+ i && (i = !1, s = !0, r.muted = !0, c(), h());
3281
3281
  }), o;
3282
3282
  }
3283
3283
  }
@@ -3514,10 +3514,10 @@ class Le {
3514
3514
  this.videoEl && (this.videoEl.srcObject = null, this.videoEl = null), this.root && this.root.parentElement && this.root.parentElement.removeChild(this.root), this.root = null, this.styleEl && this.styleEl.parentElement && this.styleEl.parentElement.removeChild(this.styleEl), this.styleEl = null, this.chunks = [], this.elapsed = 0;
3515
3515
  }
3516
3516
  }
3517
- const _ = class _ {
3517
+ const T = class T {
3518
3518
  /** Opens a fullscreen lightbox overlay showing the image. */
3519
3519
  static open(e) {
3520
- _.close();
3520
+ T.close();
3521
3521
  const t = document.createElement("div");
3522
3522
  t.id = "pulse-widget-lightbox", Object.assign(t.style, {
3523
3523
  position: "fixed",
@@ -3561,7 +3561,7 @@ const _ = class _ {
3561
3561
  }), i.addEventListener("mouseleave", () => {
3562
3562
  i.style.background = "rgba(255,255,255,0.15)";
3563
3563
  }), i.addEventListener("click", (r) => {
3564
- r.stopPropagation(), _.close();
3564
+ r.stopPropagation(), T.close();
3565
3565
  });
3566
3566
  const s = document.createElement("img");
3567
3567
  s.src = e, s.alt = "Lightbox image", Object.assign(s.style, {
@@ -3574,26 +3574,26 @@ const _ = class _ {
3574
3574
  }), s.addEventListener("click", (r) => {
3575
3575
  r.stopPropagation();
3576
3576
  }), t.appendChild(i), t.appendChild(s), t.addEventListener("click", () => {
3577
- _.close();
3577
+ T.close();
3578
3578
  });
3579
3579
  const o = (r) => {
3580
- r.key === "Escape" && _.close();
3580
+ r.key === "Escape" && T.close();
3581
3581
  };
3582
- document.addEventListener("keydown", o), _.overlay = t, _.onKeyDown = o, document.body.appendChild(t), requestAnimationFrame(() => {
3582
+ document.addEventListener("keydown", o), T.overlay = t, T.onKeyDown = o, document.body.appendChild(t), requestAnimationFrame(() => {
3583
3583
  t.style.opacity = "1";
3584
3584
  });
3585
3585
  }
3586
3586
  /** Closes the lightbox if open. */
3587
3587
  static close() {
3588
- if (!_.overlay) return;
3589
- const e = _.overlay;
3590
- _.onKeyDown && (document.removeEventListener("keydown", _.onKeyDown), _.onKeyDown = null), e.style.opacity = "0", e.addEventListener("transitionend", () => {
3588
+ if (!T.overlay) return;
3589
+ const e = T.overlay;
3590
+ T.onKeyDown && (document.removeEventListener("keydown", T.onKeyDown), T.onKeyDown = null), e.style.opacity = "0", e.addEventListener("transitionend", () => {
3591
3591
  e.remove();
3592
- }), _.overlay = null;
3592
+ }), T.overlay = null;
3593
3593
  }
3594
3594
  };
3595
- _.overlay = null, _.onKeyDown = null;
3596
- let ke = _;
3595
+ T.overlay = null, T.onKeyDown = null;
3596
+ let ke = T;
3597
3597
  class ne {
3598
3598
  constructor(e) {
3599
3599
  this.uploading = !1, this.client = e, this.input = document.createElement("input"), this.input.type = "file", this.input.style.display = "none", document.body.appendChild(this.input);
@@ -3630,6 +3630,44 @@ class ne {
3630
3630
  this.input.addEventListener("change", s, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
3631
3631
  });
3632
3632
  }
3633
+ /**
3634
+ * Opens the native file picker with multi-select enabled.
3635
+ * Uploads up to `maxFiles` files in parallel and returns the results.
3636
+ */
3637
+ pickFiles(e, t) {
3638
+ return new Promise((i) => {
3639
+ this.input.accept = e, this.input.multiple = !0, this.input.value = "";
3640
+ const s = () => {
3641
+ r(), i([]);
3642
+ }, o = async () => {
3643
+ r();
3644
+ const l = this.input.files;
3645
+ if (!l || l.length === 0) {
3646
+ i([]);
3647
+ return;
3648
+ }
3649
+ const a = Array.from(l).slice(0, t);
3650
+ this.uploading = !0;
3651
+ try {
3652
+ const c = await Promise.all(
3653
+ a.map(async (h) => {
3654
+ try {
3655
+ return await this.client.uploadFile(h);
3656
+ } catch (p) {
3657
+ return console.error("[Pulse] File upload failed:", p), null;
3658
+ }
3659
+ })
3660
+ );
3661
+ i(c.filter((h) => h !== null));
3662
+ } finally {
3663
+ this.uploading = !1, this.input.multiple = !1;
3664
+ }
3665
+ }, r = () => {
3666
+ this.input.removeEventListener("change", o), this.input.removeEventListener("cancel", s);
3667
+ };
3668
+ this.input.addEventListener("change", o, { once: !0 }), this.input.addEventListener("cancel", s, { once: !0 }), this.input.click();
3669
+ });
3670
+ }
3633
3671
  /**
3634
3672
  * Uploads a Blob directly (useful for recorded audio/video).
3635
3673
  * Wraps the blob as a File so PulseClient.uploadFile can handle it.
@@ -3828,47 +3866,77 @@ class Ji {
3828
3866
  ">Pin Comment</button>
3829
3867
  </div>
3830
3868
  </div>
3831
- <div class="pin-attachments-preview" style="margin-top:6px;"></div>
3869
+ <div class="pin-attachments-preview" style="margin-top:6px;display:flex;flex-wrap:wrap;gap:6px;"></div>
3832
3870
  `;
3833
- const a = this.form.querySelector("textarea"), c = this.form.querySelector(".pulse-close-btn"), p = this.form.querySelector(".pin-submit");
3871
+ const a = this.form.querySelector("textarea"), c = this.form.querySelector(".pulse-close-btn"), h = this.form.querySelector(".pin-submit");
3834
3872
  c.addEventListener("click", () => this.exitPinMode()), this.pendingAttachmentIds = [], this.upload || (this.upload = new ne(this.client));
3835
- const d = this.form.querySelector(".pin-attachments-preview");
3873
+ const p = this.form.querySelector(".pin-attachments-preview"), u = (m, x) => {
3874
+ const b = document.createElement("div");
3875
+ Object.assign(b.style, { position: "relative", display: "inline-block" }), b.appendChild(x);
3876
+ const y = document.createElement("button");
3877
+ y.innerHTML = "×", Object.assign(y.style, {
3878
+ position: "absolute",
3879
+ top: "-4px",
3880
+ right: "-4px",
3881
+ width: "16px",
3882
+ height: "16px",
3883
+ borderRadius: "50%",
3884
+ background: "#ef4444",
3885
+ color: "#fff",
3886
+ border: "none",
3887
+ fontSize: "11px",
3888
+ lineHeight: "1",
3889
+ cursor: "pointer",
3890
+ display: "flex",
3891
+ alignItems: "center",
3892
+ justifyContent: "center",
3893
+ padding: "0",
3894
+ fontWeight: "700"
3895
+ }), y.addEventListener("click", () => {
3896
+ const E = this.pendingAttachmentIds.indexOf(m);
3897
+ E !== -1 && this.pendingAttachmentIds.splice(E, 1), b.remove();
3898
+ }), b.appendChild(y), p.appendChild(b);
3899
+ }, f = 5;
3836
3900
  this.form.querySelector(".attach-img").addEventListener("click", async () => {
3837
- const u = await this.upload.pickFile("image/*");
3838
- if (u) {
3839
- this.pendingAttachmentIds.push(u.id);
3840
- const m = document.createElement("img");
3841
- m.src = u.thumbnailUrl || u.url, Object.assign(m.style, { width: "48px", height: "48px", borderRadius: "6px", objectFit: "cover", border: "1px solid #e2e8f0" }), d.appendChild(m);
3901
+ const m = f - this.pendingAttachmentIds.length;
3902
+ if (m <= 0) return;
3903
+ const x = await this.upload.pickFiles("image/*", m);
3904
+ for (const b of x) {
3905
+ this.pendingAttachmentIds.push(b.id);
3906
+ const y = document.createElement("img");
3907
+ y.src = b.thumbnailUrl || b.url, Object.assign(y.style, { width: "48px", height: "48px", borderRadius: "6px", objectFit: "cover", border: "1px solid #e2e8f0", display: "block" }), u(b.id, y);
3842
3908
  }
3843
3909
  }), this.form.querySelector(".attach-mic").addEventListener("click", async () => {
3910
+ if (this.pendingAttachmentIds.length >= f) return;
3844
3911
  this.audioRecorder || (this.audioRecorder = new Re());
3845
- const u = await this.audioRecorder.startRecording(d);
3846
- if (u) {
3847
- const m = await this.upload.uploadBlob(u, "audio.webm");
3848
- if (m) {
3849
- this.pendingAttachmentIds.push(m.id);
3912
+ const m = await this.audioRecorder.startRecording(p);
3913
+ if (m) {
3914
+ const x = await this.upload.uploadBlob(m, "audio.webm");
3915
+ if (x) {
3916
+ this.pendingAttachmentIds.push(x.id);
3850
3917
  const b = document.createElement("span");
3851
- Object.assign(b.style, { display: "inline-block", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b" }), b.textContent = "🎤 Audio attached", d.appendChild(b);
3918
+ Object.assign(b.style, { display: "flex", alignItems: "center", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b", height: "48px", boxSizing: "border-box" }), b.textContent = "🎤 Audio", u(x.id, b);
3852
3919
  }
3853
3920
  }
3854
3921
  }), this.form.querySelector(".attach-video").addEventListener("click", async () => {
3922
+ if (this.pendingAttachmentIds.length >= f) return;
3855
3923
  this.videoRecorder || (this.videoRecorder = new Le());
3856
- const u = await this.videoRecorder.startRecording(d);
3857
- if (u) {
3858
- const m = await this.upload.uploadBlob(u.blob, "video.webm");
3859
- if (m) {
3860
- this.pendingAttachmentIds.push(m.id);
3924
+ const m = await this.videoRecorder.startRecording(p);
3925
+ if (m) {
3926
+ const x = await this.upload.uploadBlob(m.blob, "video.webm");
3927
+ if (x) {
3928
+ this.pendingAttachmentIds.push(x.id);
3861
3929
  const b = document.createElement("span");
3862
- Object.assign(b.style, { display: "inline-block", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b" }), b.textContent = "🎥 Video attached", d.appendChild(b);
3930
+ Object.assign(b.style, { display: "flex", alignItems: "center", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b", height: "48px", boxSizing: "border-box" }), b.textContent = "🎥 Video", u(x.id, b);
3863
3931
  }
3864
3932
  }
3865
- }), p.addEventListener("click", () => {
3866
- const u = a.value.trim();
3867
- if (!u && this.pendingAttachmentIds.length === 0) return;
3868
- const m = [...(u || "").matchAll(/@(\w+)/g)].map((b) => b[1]);
3869
- this.client.createThread(u, { position: i, mentions: m, attachmentIds: this.pendingAttachmentIds.length > 0 ? [...this.pendingAttachmentIds] : void 0 }), this.pendingAttachmentIds = [], this.exitPinMode();
3870
- }), a.addEventListener("keydown", (u) => {
3871
- u.key === "Escape" && this.exitPinMode(), u.stopPropagation();
3933
+ }), h.addEventListener("click", () => {
3934
+ const m = a.value.trim();
3935
+ if (!m && this.pendingAttachmentIds.length === 0) return;
3936
+ const x = [...(m || "").matchAll(/@(\w+)/g)].map((b) => b[1]);
3937
+ this.client.createThread(m, { position: i, mentions: x, attachmentIds: this.pendingAttachmentIds.length > 0 ? [...this.pendingAttachmentIds] : void 0 }), this.pendingAttachmentIds = [], this.exitPinMode();
3938
+ }), a.addEventListener("keydown", (m) => {
3939
+ m.key === "Escape" && this.exitPinMode(), m.stopPropagation();
3872
3940
  }), document.body.appendChild(this.form), requestAnimationFrame(() => a.focus());
3873
3941
  }
3874
3942
  // ── Inline thread popover (shown when a pin dot is clicked) ──
@@ -3932,12 +4000,12 @@ class Ji {
3932
4000
  }
3933
4001
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
3934
4002
  t.innerHTML = e.comments.map((a) => {
3935
- const c = this.client.state.getUser(a.userId), p = c ? c.name.split(" ").map((y) => y[0]).join("").toUpperCase().slice(0, 2) : "?", d = (c == null ? void 0 : c.color) ?? "#94a3b8", u = this.escapeHtml((c == null ? void 0 : c.name) ?? "Unknown"), m = this.formatTime(a.createdAt), b = i === a.userId, I = a.editedAt ? '<span style="font-size:10px;color:#94a3b8;font-style:italic;">(edited)</span>' : "";
4003
+ const c = this.client.state.getUser(a.userId), h = c ? c.name.split(" ").map((k) => k[0]).join("").toUpperCase().slice(0, 2) : "?", p = (c == null ? void 0 : c.color) ?? "#94a3b8", u = this.escapeHtml((c == null ? void 0 : c.name) ?? "Unknown"), f = this.formatTime(a.createdAt), m = i === a.userId, x = a.editedAt ? '<span style="font-size:10px;color:#94a3b8;font-style:italic;">(edited)</span>' : "";
3936
4004
  if (this.editingPopoverCommentId === a.id)
3937
4005
  return `
3938
4006
  <div style="margin-bottom:10px;" data-comment-id="${a.id}">
3939
4007
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:4px;">
3940
- <div style="width:22px;height:22px;border-radius:50%;background:${d};color:#fff;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;flex-shrink:0;">${p}</div>
4008
+ <div style="width:22px;height:22px;border-radius:50%;background:${p};color:#fff;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;flex-shrink:0;">${h}</div>
3941
4009
  <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
3942
4010
  </div>
3943
4011
  <div style="margin-left:29px;">
@@ -3949,37 +4017,37 @@ class Ji {
3949
4017
  </div>
3950
4018
  </div>
3951
4019
  `;
3952
- const C = a.body && a.body !== "(attachment)" ? a.body.replace(
4020
+ const b = a.body && a.body !== "(attachment)" ? a.body.replace(
3953
4021
  /@(\w+)/g,
3954
4022
  '<span style="color:#6366f1;font-weight:600;background:#eef2ff;padding:0 3px;border-radius:3px;">@$1</span>'
3955
- ) : "", w = (a.attachments ?? []).map((y) => {
3956
- if (y.type === "image") {
3957
- const Pt = y.thumbnailUrl || y.url;
3958
- return `<div class="popover-attachment-img" data-full-url="${this.escapeHtml(y.url)}" style="margin:4px 0 4px 29px;cursor:pointer;">
3959
- <img src="${this.escapeHtml(Pt)}" alt="${this.escapeHtml(y.filename)}" style="max-width:180px;max-height:120px;border-radius:8px;border:1px solid #e2e8f0;display:block;" />
4023
+ ) : "", y = (a.attachments ?? []).map((k) => {
4024
+ if (k.type === "image") {
4025
+ const Pt = k.thumbnailUrl || k.url;
4026
+ return `<div class="popover-attachment-img" data-full-url="${this.escapeHtml(k.url)}" style="margin:4px 0 4px 29px;cursor:pointer;">
4027
+ <img src="${this.escapeHtml(Pt)}" alt="${this.escapeHtml(k.filename)}" style="max-width:180px;max-height:120px;border-radius:8px;border:1px solid #e2e8f0;display:block;" />
3960
4028
  </div>`;
3961
4029
  }
3962
- return y.type === "audio" ? `<div class="popover-attachment-audio" data-url="${this.escapeHtml(y.url)}" data-duration="${y.durationMs ?? ""}" style="margin:4px 0 4px 29px;"></div>` : y.type === "video" ? `<div class="popover-attachment-video" data-url="${this.escapeHtml(y.url)}" data-poster="${this.escapeHtml(y.thumbnailUrl ?? "")}" style="margin:4px 0 4px 29px;"></div>` : "";
3963
- }).join(""), $ = b ? `<div class="popover-comment-actions" style="display:flex;gap:2px;margin-top:2px;margin-left:29px;">
4030
+ return k.type === "audio" ? `<div class="popover-attachment-audio" data-url="${this.escapeHtml(k.url)}" data-duration="${k.durationMs ?? ""}" style="margin:4px 0 4px 29px;"></div>` : k.type === "video" ? `<div class="popover-attachment-video" data-url="${this.escapeHtml(k.url)}" data-poster="${this.escapeHtml(k.thumbnailUrl ?? "")}" style="margin:4px 0 4px 29px;"></div>` : "";
4031
+ }).join(""), E = m ? `<div class="popover-comment-actions" style="display:flex;gap:2px;margin-top:2px;margin-left:29px;">
3964
4032
  <button class="edit-btn" data-comment-id="${a.id}" style="border:none;background:none;cursor:pointer;color:#94a3b8;padding:3px;border-radius:4px;display:flex;align-items:center;transition:all 0.15s;" title="Edit"
3965
4033
  onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'"
3966
4034
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Gi}</button>
3967
4035
  <button class="delete-btn" data-comment-id="${a.id}" style="border:none;background:none;cursor:pointer;color:#94a3b8;padding:3px;border-radius:4px;display:flex;align-items:center;transition:all 0.15s;" title="Delete"
3968
4036
  onmouseover="this.style.color='#ef4444';this.style.background='#fef2f2'"
3969
4037
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Zi}</button>
3970
- </div>` : "", P = this.buildReactionPillsHtml(a.id);
4038
+ </div>` : "", I = this.buildReactionPillsHtml(a.id);
3971
4039
  return `
3972
4040
  <div class="popover-comment" style="margin-bottom:10px;" data-comment-id="${a.id}">
3973
4041
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:2px;">
3974
- <div style="width:22px;height:22px;border-radius:50%;background:${d};color:#fff;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;flex-shrink:0;">${p}</div>
4042
+ <div style="width:22px;height:22px;border-radius:50%;background:${p};color:#fff;display:flex;align-items:center;justify-content:center;font-size:9px;font-weight:700;flex-shrink:0;">${h}</div>
3975
4043
  <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
3976
- <span style="font-size:10px;color:#94a3b8;">${m}</span>
3977
- ${I}
4044
+ <span style="font-size:10px;color:#94a3b8;">${f}</span>
4045
+ ${x}
3978
4046
  </div>
3979
- ${C ? `<div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${C}</div>` : ""}
3980
- ${w}
3981
- ${$}
3982
- ${P}
4047
+ ${b ? `<div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${b}</div>` : ""}
4048
+ ${y}
4049
+ ${E}
4050
+ ${I}
3983
4051
  </div>
3984
4052
  `;
3985
4053
  }).join(""), t.querySelectorAll(".edit-btn").forEach((a) => {
@@ -3997,7 +4065,7 @@ class Ji {
3997
4065
  s && r && s.addEventListener("click", () => {
3998
4066
  const a = r.value.trim();
3999
4067
  if (!a) return;
4000
- const c = [...a.matchAll(/@(\w+)/g)].map((p) => p[1]);
4068
+ const c = [...a.matchAll(/@(\w+)/g)].map((h) => h[1]);
4001
4069
  this.client.editComment(
4002
4070
  this.editingPopoverCommentId,
4003
4071
  a,
@@ -4008,14 +4076,14 @@ class Ji {
4008
4076
  }), t.querySelectorAll("[data-reaction-emoji]").forEach((a) => {
4009
4077
  a.addEventListener("click", (c) => {
4010
4078
  c.stopPropagation();
4011
- const p = a.dataset.reactionEmoji, d = a.dataset.reactionTarget, u = a.dataset.reactionId;
4012
- u ? this.client.removeReaction(u) : this.client.addReaction(d, "comment", p);
4079
+ const h = a.dataset.reactionEmoji, p = a.dataset.reactionTarget, u = a.dataset.reactionId;
4080
+ u ? this.client.removeReaction(u) : this.client.addReaction(p, "comment", h);
4013
4081
  });
4014
4082
  }), t.querySelectorAll(".popover-reaction-add").forEach((a) => {
4015
4083
  a.addEventListener("click", (c) => {
4016
4084
  c.stopPropagation();
4017
- const p = a.dataset.commentId;
4018
- this.popoverPickerOpen === p ? (this.popoverPickerOpen = null, this.removePickerEl()) : (this.popoverPickerOpen = p, this.showPickerForButton(a, p));
4085
+ const h = a.dataset.commentId;
4086
+ this.popoverPickerOpen === h ? (this.popoverPickerOpen = null, this.removePickerEl()) : (this.popoverPickerOpen = h, this.showPickerForButton(a, h));
4019
4087
  });
4020
4088
  }), t.querySelectorAll(".popover-attachment-img").forEach((a) => {
4021
4089
  a.addEventListener("click", () => {
@@ -4025,14 +4093,14 @@ class Ji {
4025
4093
  }), t.querySelectorAll(".popover-attachment-audio").forEach((a) => {
4026
4094
  const c = a.dataset.url;
4027
4095
  if (c) {
4028
- const p = a.dataset.duration ? parseInt(a.dataset.duration) : void 0, d = Oe.render(c, p);
4029
- a.appendChild(d);
4096
+ const h = a.dataset.duration ? parseInt(a.dataset.duration) : void 0, p = Oe.render(c, h);
4097
+ a.appendChild(p);
4030
4098
  }
4031
4099
  }), t.querySelectorAll(".popover-attachment-video").forEach((a) => {
4032
4100
  const c = a.dataset.url;
4033
4101
  if (c) {
4034
- const p = a.dataset.poster || void 0, d = Tt.render(c, p);
4035
- a.appendChild(d);
4102
+ const h = a.dataset.poster || void 0, p = Tt.render(c, h);
4103
+ a.appendChild(p);
4036
4104
  }
4037
4105
  }), t.scrollTop = t.scrollHeight;
4038
4106
  }
@@ -4065,39 +4133,67 @@ class Ji {
4065
4133
  `;
4066
4134
  const o = t.querySelector("input"), r = t.querySelector(".reply-send"), l = t.querySelector(".reply-attachments-preview");
4067
4135
  this.upload || (this.upload = new ne(this.client));
4068
- const a = [], c = (d) => {
4069
- const u = document.createElement("span");
4070
- Object.assign(u.style, { display: "inline-block", padding: "2px 8px", borderRadius: "4px", background: "#f1f5f9", fontSize: "10px", color: "#64748b" }), u.textContent = d, l.appendChild(u);
4071
- };
4136
+ const a = [], c = (u, f) => {
4137
+ const m = document.createElement("span");
4138
+ Object.assign(m.style, { position: "relative", display: "inline-flex", alignItems: "center", padding: "2px 18px 2px 8px", borderRadius: "4px", background: "#f1f5f9", fontSize: "10px", color: "#64748b" }), m.textContent = f;
4139
+ const x = document.createElement("button");
4140
+ x.innerHTML = "×", Object.assign(x.style, {
4141
+ position: "absolute",
4142
+ top: "-3px",
4143
+ right: "-3px",
4144
+ width: "14px",
4145
+ height: "14px",
4146
+ borderRadius: "50%",
4147
+ background: "#ef4444",
4148
+ color: "#fff",
4149
+ border: "none",
4150
+ fontSize: "10px",
4151
+ lineHeight: "1",
4152
+ cursor: "pointer",
4153
+ display: "flex",
4154
+ alignItems: "center",
4155
+ justifyContent: "center",
4156
+ padding: "0",
4157
+ fontWeight: "700"
4158
+ }), x.addEventListener("click", () => {
4159
+ const b = a.indexOf(u);
4160
+ b !== -1 && a.splice(b, 1), m.remove();
4161
+ }), m.appendChild(x), l.appendChild(m);
4162
+ }, h = 5;
4072
4163
  t.querySelector(".reply-attach-img").addEventListener("click", async () => {
4073
- const d = await this.upload.pickFile("image/*");
4074
- d && (a.push(d.id), c("📎 Image"));
4164
+ const u = h - a.length;
4165
+ if (u <= 0) return;
4166
+ const f = await this.upload.pickFiles("image/*", u);
4167
+ for (const m of f)
4168
+ a.push(m.id), c(m.id, "📎 Image");
4075
4169
  }), t.querySelector(".reply-attach-mic").addEventListener("click", async () => {
4170
+ if (a.length >= h) return;
4076
4171
  this.audioRecorder || (this.audioRecorder = new Re());
4077
- const d = await this.audioRecorder.startRecording(t);
4078
- if (d) {
4079
- const u = await this.upload.uploadBlob(d, "audio.webm");
4080
- u && (a.push(u.id), c("🎤 Audio"));
4172
+ const u = await this.audioRecorder.startRecording(t);
4173
+ if (u) {
4174
+ const f = await this.upload.uploadBlob(u, "audio.webm");
4175
+ f && (a.push(f.id), c(f.id, "🎤 Audio"));
4081
4176
  }
4082
4177
  }), t.querySelector(".reply-attach-video").addEventListener("click", async () => {
4178
+ if (a.length >= h) return;
4083
4179
  this.videoRecorder || (this.videoRecorder = new Le());
4084
- const d = await this.videoRecorder.startRecording(t);
4085
- if (d) {
4086
- const u = await this.upload.uploadBlob(d.blob, "video.webm");
4087
- u && (a.push(u.id), c("🎥 Video"));
4180
+ const u = await this.videoRecorder.startRecording(t);
4181
+ if (u) {
4182
+ const f = await this.upload.uploadBlob(u.blob, "video.webm");
4183
+ f && (a.push(f.id), c(f.id, "🎥 Video"));
4088
4184
  }
4089
4185
  });
4090
4186
  const p = () => {
4091
- const d = o.value.trim();
4092
- if (!d && a.length === 0) return;
4093
- const u = [...(d || "").matchAll(/@(\w+)/g)].map((m) => m[1]);
4094
- this.client.reply(e.id, d, u, a.length > 0 ? [...a] : void 0), o.value = "", a.length = 0, l.innerHTML = "";
4187
+ const u = o.value.trim();
4188
+ if (!u && a.length === 0) return;
4189
+ const f = [...(u || "").matchAll(/@(\w+)/g)].map((m) => m[1]);
4190
+ this.client.reply(e.id, u, f, a.length > 0 ? [...a] : void 0), o.value = "", a.length = 0, l.innerHTML = "";
4095
4191
  };
4096
4192
  r.addEventListener("click", p), o.addEventListener("input", () => {
4097
- const d = Date.now(), u = this.lastTypingSendPins.get(e.id) ?? 0;
4098
- d - u >= 2e3 && (this.client.sendTyping(e.id), this.lastTypingSendPins.set(e.id, d));
4099
- }), o.addEventListener("keydown", (d) => {
4100
- d.key === "Enter" && (d.preventDefault(), p()), d.key === "Escape" && this.closePopover(), d.stopPropagation();
4193
+ const u = Date.now(), f = this.lastTypingSendPins.get(e.id) ?? 0;
4194
+ u - f >= 2e3 && (this.client.sendTyping(e.id), this.lastTypingSendPins.set(e.id, u));
4195
+ }), o.addEventListener("keydown", (u) => {
4196
+ u.key === "Enter" && (u.preventDefault(), p()), u.key === "Escape" && this.closePopover(), u.stopPropagation();
4101
4197
  }), this.popover.appendChild(t);
4102
4198
  }
4103
4199
  removePickerEl() {
@@ -4136,8 +4232,8 @@ class Ji {
4136
4232
  r.stopPropagation();
4137
4233
  const a = this.client.state.getReactions(t).find(
4138
4234
  (c) => {
4139
- var p;
4140
- return c.emoji === s && c.userId === ((p = this.client.state.user) == null ? void 0 : p.id);
4235
+ var h;
4236
+ return c.emoji === s && c.userId === ((h = this.client.state.user) == null ? void 0 : h.id);
4141
4237
  }
4142
4238
  );
4143
4239
  a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", s), this.popoverPickerOpen = null, this.removePickerEl();
@@ -4149,15 +4245,15 @@ class Ji {
4149
4245
  var a;
4150
4246
  const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, s = /* @__PURE__ */ new Map();
4151
4247
  for (const c of t) {
4152
- const p = s.get(c.emoji) ?? { count: 0, ownId: null };
4153
- p.count++, c.userId === i && (p.ownId = c.id), s.set(c.emoji, p);
4248
+ const h = s.get(c.emoji) ?? { count: 0, ownId: null };
4249
+ h.count++, c.userId === i && (h.ownId = c.id), s.set(c.emoji, h);
4154
4250
  }
4155
4251
  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;";
4156
4252
  let l = '<div style="margin-left:29px;display:flex;gap:4px;flex-wrap:wrap;margin-top:4px;">';
4157
- for (const [c, { count: p, ownId: d }] of s) {
4158
- const u = d ? r : o;
4159
- l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${u}">
4160
- <span>${c}</span><span style="font-size:11px;font-weight:600;color:#64748b;">${p}</span>
4253
+ for (const [c, { count: h, ownId: p }] of s) {
4254
+ const u = p ? r : o;
4255
+ l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${p ? `data-reaction-id="${p}"` : ""} style="${u}">
4256
+ <span>${c}</span><span style="font-size:11px;font-weight:600;color:#64748b;">${h}</span>
4161
4257
  </button>`;
4162
4258
  }
4163
4259
  return l += `<button class="popover-reaction-add" data-comment-id="${e}" style="display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:50%;border:1px dashed #e2e8f0;background:none;cursor:pointer;color:#94a3b8;font-size:14px;">+</button>`, l += "</div>", l;
@@ -4263,7 +4359,7 @@ var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (n, e,
4263
4359
  return i && s && Qi(e, t, s), s;
4264
4360
  };
4265
4361
  const ts = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
4266
- let O = class extends T {
4362
+ let P = class extends S {
4267
4363
  constructor() {
4268
4364
  super(...arguments), this.highlightThreadId = null, this.threadsVersion = 0, 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(), this.replyAttachmentIds = [];
4269
4365
  }
@@ -4360,7 +4456,7 @@ let O = class extends T {
4360
4456
  }
4361
4457
  parseMentions(n) {
4362
4458
  return n.split(/(@\w+)/g).map(
4363
- (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
4459
+ (t) => t.startsWith("@") ? d`<span class="mention">${t}</span>` : t
4364
4460
  );
4365
4461
  }
4366
4462
  getInitials(n) {
@@ -4378,11 +4474,14 @@ let O = class extends T {
4378
4474
  }
4379
4475
  async handleAttachImage() {
4380
4476
  this.upload || (this.upload = new ne(this.client));
4381
- const n = await this.upload.pickFile("image/*");
4382
- n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4477
+ const n = P.MAX_ATTACHMENTS - this.replyAttachmentIds.length;
4478
+ if (n <= 0) return;
4479
+ const e = await this.upload.pickFiles("image/*", n);
4480
+ e.length > 0 && (this.replyAttachmentIds.push(...e.map((t) => t.id)), this.requestUpdate());
4383
4481
  }
4384
4482
  async handleRecordAudio(n) {
4385
4483
  var i;
4484
+ if (this.replyAttachmentIds.length >= P.MAX_ATTACHMENTS) return;
4386
4485
  this.upload || (this.upload = new ne(this.client)), this.audioRecorder || (this.audioRecorder = new Re());
4387
4486
  const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
4388
4487
  if (t) {
@@ -4392,6 +4491,7 @@ let O = class extends T {
4392
4491
  }
4393
4492
  async handleRecordVideo(n) {
4394
4493
  var i;
4494
+ if (this.replyAttachmentIds.length >= P.MAX_ATTACHMENTS) return;
4395
4495
  this.upload || (this.upload = new ne(this.client)), this.videoRecorder || (this.videoRecorder = new Le());
4396
4496
  const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
4397
4497
  if (t) {
@@ -4399,6 +4499,9 @@ let O = class extends T {
4399
4499
  s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4400
4500
  }
4401
4501
  }
4502
+ removeReplyAttachment(n) {
4503
+ this.replyAttachmentIds = this.replyAttachmentIds.filter((e) => e !== n), this.requestUpdate();
4504
+ }
4402
4505
  handleReply(n, e) {
4403
4506
  e.preventDefault();
4404
4507
  const i = e.target.querySelector("input"), s = i.value.trim();
@@ -4426,7 +4529,7 @@ let O = class extends T {
4426
4529
  this.client.deleteComment(n);
4427
4530
  }
4428
4531
  renderEditForm(n) {
4429
- return h`
4532
+ return d`
4430
4533
  <div class="edit-form">
4431
4534
  <textarea
4432
4535
  .value=${this.editBody}
@@ -4447,12 +4550,12 @@ let O = class extends T {
4447
4550
  const e = this.client.state.getReactions(n.id), t = (s = this.client.state.user) == null ? void 0 : s.id, i = /* @__PURE__ */ new Map();
4448
4551
  for (const o of e)
4449
4552
  i.has(o.emoji) || i.set(o.emoji, []), i.get(o.emoji).push(o);
4450
- return h`
4553
+ return d`
4451
4554
  <div class="comment-reactions">
4452
4555
  ${[...i.entries()].map(
4453
4556
  ([o, r]) => {
4454
4557
  const l = r.some((a) => a.userId === t);
4455
- return h`
4558
+ return d`
4456
4559
  <button
4457
4560
  class="reaction-pill ${l ? "own" : ""}"
4458
4561
  @click=${() => this.toggleReaction(n.id, o)}
@@ -4471,26 +4574,26 @@ let O = class extends T {
4471
4574
  title="Add reaction"
4472
4575
  >
4473
4576
  +
4474
- ${this.pickerOpenForComment === n.id ? h`
4577
+ ${this.pickerOpenForComment === n.id ? d`
4475
4578
  <div class="emoji-picker">
4476
4579
  ${ts.map(
4477
- (o) => h`
4580
+ (o) => d`
4478
4581
  <button @click=${(r) => {
4479
4582
  r.stopPropagation(), this.toggleReaction(n.id, o);
4480
4583
  }}>${o}</button>
4481
4584
  `
4482
4585
  )}
4483
4586
  </div>
4484
- ` : f}
4587
+ ` : g}
4485
4588
  </button>
4486
4589
  </div>
4487
4590
  `;
4488
4591
  }
4489
4592
  renderTypingIndicator(n) {
4490
4593
  const e = this.typingByThread.get(n) ?? [];
4491
- if (e.length === 0) return f;
4594
+ if (e.length === 0) return g;
4492
4595
  const t = e.length === 1 ? `${e[0]} is typing...` : `${e.join(", ")} are typing...`;
4493
- return h`<div class="typing-indicator">${t}</div>`;
4596
+ return d`<div class="typing-indicator">${t}</div>`;
4494
4597
  }
4495
4598
  sortedThreads() {
4496
4599
  return [...this.threads].sort((n, e) => {
@@ -4501,7 +4604,7 @@ let O = class extends T {
4501
4604
  }
4502
4605
  render() {
4503
4606
  const n = this.sortedThreads();
4504
- return h`
4607
+ return d`
4505
4608
  <div class="panel">
4506
4609
  <div class="panel-header">
4507
4610
  <span class="panel-title">
@@ -4509,12 +4612,12 @@ let O = class extends T {
4509
4612
  <span class="thread-count">${this.threads.length}</span>
4510
4613
  </span>
4511
4614
  <button class="close-btn" @click=${this.fireClose} title="Close">
4512
- ${k(me, 16)}
4615
+ ${C(me, 16)}
4513
4616
  </button>
4514
4617
  </div>
4515
4618
 
4516
4619
  <div class="panel-body pw-scrollable">
4517
- ${n.length === 0 ? h`<div class="empty">
4620
+ ${n.length === 0 ? d`<div class="empty">
4518
4621
  <div class="empty-icon">&#128172;</div>
4519
4622
  No comments yet
4520
4623
  </div>` : n.map((e) => this.renderThread(e))}
@@ -4527,11 +4630,11 @@ let O = class extends T {
4527
4630
  `;
4528
4631
  }
4529
4632
  renderAttachments(n) {
4530
- return !n || n.length === 0 ? f : h`
4633
+ return !n || n.length === 0 ? g : d`
4531
4634
  ${n.map((e) => {
4532
4635
  if (e.type === "image") {
4533
4636
  const t = e.thumbnailUrl || e.url;
4534
- return h`
4637
+ return d`
4535
4638
  <div class="comment-attachment-media">
4536
4639
  <img
4537
4640
  class="comment-attachment-img"
@@ -4542,40 +4645,40 @@ let O = class extends T {
4542
4645
  </div>
4543
4646
  `;
4544
4647
  }
4545
- return e.type === "audio" ? h`
4648
+ return e.type === "audio" ? d`
4546
4649
  <div class="comment-attachment-media" id="audio-${e.id}">
4547
4650
  ${this.renderAudioPlayer(e)}
4548
4651
  </div>
4549
- ` : e.type === "video" ? h`
4652
+ ` : e.type === "video" ? d`
4550
4653
  <div class="comment-attachment-media" id="video-${e.id}">
4551
4654
  ${this.renderVideoPlayer(e)}
4552
4655
  </div>
4553
- ` : f;
4656
+ ` : g;
4554
4657
  })}
4555
4658
  `;
4556
4659
  }
4557
4660
  renderAudioPlayer(n) {
4558
4661
  const e = document.createElement("div"), t = Oe.render(n.url, n.durationMs);
4559
- return e.appendChild(t), h`<div class="audio-player-host" data-url=${n.url} data-duration=${n.durationMs ?? ""}></div>`;
4662
+ return e.appendChild(t), d`<div class="audio-player-host" data-url=${n.url} data-duration=${n.durationMs ?? ""}></div>`;
4560
4663
  }
4561
4664
  renderVideoPlayer(n) {
4562
- return h`<div class="video-player-host" data-url=${n.url} data-poster=${n.thumbnailUrl ?? ""}></div>`;
4665
+ return d`<div class="video-player-host" data-url=${n.url} data-poster=${n.thumbnailUrl ?? ""}></div>`;
4563
4666
  }
4564
4667
  renderThread(n) {
4565
4668
  const e = this.highlightThreadId === n.id;
4566
- return h`
4669
+ return d`
4567
4670
  <div
4568
4671
  class="thread ${n.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
4569
4672
  data-thread-id=${n.id}
4570
4673
  >
4571
- ${n.position ? h`<div class="pin-badge">
4572
- ${k(_t, 12)}
4674
+ ${n.position ? d`<div class="pin-badge">
4675
+ ${C(_t, 12)}
4573
4676
  Pinned
4574
- </div>` : f}
4677
+ </div>` : g}
4575
4678
  ${n.comments.map((t, i) => {
4576
4679
  const s = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4577
- return h`
4578
- ${i > 0 ? h`<div class="comment-divider"></div>` : f}
4680
+ return d`
4681
+ ${i > 0 ? d`<div class="comment-divider"></div>` : g}
4579
4682
  <div class="comment">
4580
4683
  <div class="comment-header">
4581
4684
  <div
@@ -4586,16 +4689,16 @@ let O = class extends T {
4586
4689
  </div>
4587
4690
  <span class="comment-author">${(s == null ? void 0 : s.name) ?? "Unknown"}</span>
4588
4691
  <span class="comment-time">${this.formatTime(t.createdAt)}</span>
4589
- ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : f}
4692
+ ${t.editedAt ? d`<span class="edited-badge">(edited)</span>` : g}
4590
4693
  </div>
4591
- ${r ? this.renderEditForm(t) : h`
4592
- ${t.body && t.body !== "(attachment)" ? h`<div class="comment-body">${this.parseMentions(t.body)}</div>` : f}
4694
+ ${r ? this.renderEditForm(t) : d`
4695
+ ${t.body && t.body !== "(attachment)" ? d`<div class="comment-body">${this.parseMentions(t.body)}</div>` : g}
4593
4696
  ${this.renderAttachments(t.attachments ?? [])}
4594
4697
  `}
4595
- ${o && !r ? h`<div class="comment-actions">
4596
- <button @click=${() => this.startEdit(t)} title="Edit">${k(Ai, 14)}</button>
4597
- <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${k(Mi, 14)}</button>
4598
- </div>` : f}
4698
+ ${o && !r ? d`<div class="comment-actions">
4699
+ <button @click=${() => this.startEdit(t)} title="Edit">${C(Ai, 14)}</button>
4700
+ <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${C(Mi, 14)}</button>
4701
+ </div>` : g}
4599
4702
  ${this.renderReactions(t)}
4600
4703
  </div>
4601
4704
  `;
@@ -4616,7 +4719,7 @@ let O = class extends T {
4616
4719
 
4617
4720
  ${this.renderTypingIndicator(n.id)}
4618
4721
 
4619
- ${this.replyingTo === n.id ? h`
4722
+ ${this.replyingTo === n.id ? d`
4620
4723
  <form
4621
4724
  class="reply-form"
4622
4725
  @submit=${(t) => this.handleReply(n.id, t)}
@@ -4635,36 +4738,43 @@ let O = class extends T {
4635
4738
  class="reply-media-btn"
4636
4739
  title="Attach image"
4637
4740
  @click=${() => this.handleAttachImage()}
4638
- >${k(Si, 16)}</button>
4741
+ >${C(Si, 16)}</button>
4639
4742
  <button
4640
4743
  type="button"
4641
4744
  class="reply-media-btn"
4642
4745
  title="Record audio"
4643
4746
  @click=${() => this.handleRecordAudio(n.id)}
4644
- >${k(Ti, 16)}</button>
4747
+ >${C(Ti, 16)}</button>
4645
4748
  <button
4646
4749
  type="button"
4647
4750
  class="reply-media-btn"
4648
4751
  title="Record video"
4649
4752
  @click=${() => this.handleRecordVideo(n.id)}
4650
- >${k(Oi, 16)}</button>
4753
+ >${C(Oi, 16)}</button>
4651
4754
  <div class="reply-preview">
4652
4755
  ${this.replyAttachmentIds.map(
4653
- (t, i) => h`<span class="reply-preview-badge">Attached #${i + 1}</span>`
4756
+ (t, i) => d`<span class="reply-preview-badge">
4757
+ Attached #${i + 1}
4758
+ <button
4759
+ type="button"
4760
+ class="reply-preview-remove"
4761
+ @click=${() => this.removeReplyAttachment(t)}
4762
+ >×</button>
4763
+ </span>`
4654
4764
  )}
4655
4765
  </div>
4656
4766
  </div>
4657
4767
  </form>
4658
- ` : f}
4768
+ ` : g}
4659
4769
  </div>
4660
4770
  `;
4661
4771
  }
4662
4772
  };
4663
- O.styles = [
4773
+ P.styles = [
4664
4774
  ee,
4665
4775
  ge,
4666
4776
  _e,
4667
- A`
4777
+ M`
4668
4778
  :host {
4669
4779
  display: block;
4670
4780
  }
@@ -4905,7 +5015,10 @@ O.styles = [
4905
5015
  }
4906
5016
 
4907
5017
  .reply-preview-badge {
4908
- display: inline-block;
5018
+ position: relative;
5019
+ display: inline-flex;
5020
+ align-items: center;
5021
+ gap: 4px;
4909
5022
  padding: 2px 8px;
4910
5023
  border-radius: 4px;
4911
5024
  background: var(--pw-surface-hover);
@@ -4913,6 +5026,24 @@ O.styles = [
4913
5026
  color: var(--pw-text-muted);
4914
5027
  }
4915
5028
 
5029
+ .reply-preview-remove {
5030
+ border: none;
5031
+ background: var(--pw-danger, #ef4444);
5032
+ color: #fff;
5033
+ width: 14px;
5034
+ height: 14px;
5035
+ border-radius: 50%;
5036
+ font-size: 10px;
5037
+ line-height: 1;
5038
+ cursor: pointer;
5039
+ display: inline-flex;
5040
+ align-items: center;
5041
+ justify-content: center;
5042
+ padding: 0;
5043
+ font-weight: 700;
5044
+ flex-shrink: 0;
5045
+ }
5046
+
4916
5047
  .reply-form .pw-btn-primary {
4917
5048
  padding: 8px 14px;
4918
5049
  font-size: 12px;
@@ -5183,36 +5314,37 @@ O.styles = [
5183
5314
  }
5184
5315
  `
5185
5316
  ];
5317
+ P.MAX_ATTACHMENTS = 5;
5186
5318
  j([
5187
- g({ attribute: !1 })
5188
- ], O.prototype, "client", 2);
5189
- j([
5190
- g()
5191
- ], O.prototype, "highlightThreadId", 2);
5319
+ v({ attribute: !1 })
5320
+ ], P.prototype, "client", 2);
5192
5321
  j([
5193
5322
  v()
5194
- ], O.prototype, "threadsVersion", 2);
5323
+ ], P.prototype, "highlightThreadId", 2);
5195
5324
  j([
5196
- v()
5197
- ], O.prototype, "replyingTo", 2);
5325
+ w()
5326
+ ], P.prototype, "threadsVersion", 2);
5198
5327
  j([
5199
- v()
5200
- ], O.prototype, "editingCommentId", 2);
5328
+ w()
5329
+ ], P.prototype, "replyingTo", 2);
5201
5330
  j([
5202
- v()
5203
- ], O.prototype, "editBody", 2);
5331
+ w()
5332
+ ], P.prototype, "editingCommentId", 2);
5204
5333
  j([
5205
- v()
5206
- ], O.prototype, "pickerOpenForComment", 2);
5334
+ w()
5335
+ ], P.prototype, "editBody", 2);
5207
5336
  j([
5208
- v()
5209
- ], O.prototype, "typingByThread", 2);
5337
+ w()
5338
+ ], P.prototype, "pickerOpenForComment", 2);
5210
5339
  j([
5211
- v()
5212
- ], O.prototype, "reactionsVersion", 2);
5213
- O = j([
5340
+ w()
5341
+ ], P.prototype, "typingByThread", 2);
5342
+ j([
5343
+ w()
5344
+ ], P.prototype, "reactionsVersion", 2);
5345
+ P = j([
5214
5346
  R("pulse-widget-comments-panel")
5215
- ], O);
5347
+ ], P);
5216
5348
  var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, Ve = (n, e, t, i) => {
5217
5349
  for (var s = i > 1 ? void 0 : i ? ss(e, t) : e, o = n.length - 1, r; o >= 0; o--)
5218
5350
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
@@ -5231,7 +5363,7 @@ const ns = {
5231
5363
  "thread:resolved": "✅",
5232
5364
  "reaction:added": "🎉"
5233
5365
  };
5234
- let de = class extends T {
5366
+ let de = class extends S {
5235
5367
  constructor() {
5236
5368
  super(...arguments), this.notifications = [];
5237
5369
  }
@@ -5275,29 +5407,29 @@ let de = class extends T {
5275
5407
  }
5276
5408
  render() {
5277
5409
  const n = this.notifications.filter((e) => !e.read).length;
5278
- return h`
5410
+ return d`
5279
5411
  <div class="panel">
5280
5412
  <div class="panel-header">
5281
5413
  <span class="panel-title">
5282
5414
  Notifications
5283
- ${n > 0 ? h`<span class="unread-badge">${n}</span>` : f}
5415
+ ${n > 0 ? d`<span class="unread-badge">${n}</span>` : g}
5284
5416
  </span>
5285
5417
  <div style="display:flex;align-items:center;gap:4px;">
5286
- ${n > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5418
+ ${n > 0 ? d`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5287
5419
  Mark all read
5288
- </button>` : f}
5420
+ </button>` : g}
5289
5421
  <button class="close-btn" @click=${this.fireClose} title="Close">
5290
- ${k(me, 16)}
5422
+ ${C(me, 16)}
5291
5423
  </button>
5292
5424
  </div>
5293
5425
  </div>
5294
5426
 
5295
5427
  <div class="panel-body pw-scrollable">
5296
- ${this.notifications.length === 0 ? h`<div class="empty">
5428
+ ${this.notifications.length === 0 ? d`<div class="empty">
5297
5429
  <div class="empty-icon">&#128276;</div>
5298
5430
  No notifications
5299
5431
  </div>` : this.notifications.map(
5300
- (e) => h`
5432
+ (e) => d`
5301
5433
  <div
5302
5434
  class="item ${e.read ? "" : "unread"}"
5303
5435
  @click=${() => this.handleClick(e)}
@@ -5323,7 +5455,7 @@ de.styles = [
5323
5455
  ee,
5324
5456
  ge,
5325
5457
  _e,
5326
- A`
5458
+ M`
5327
5459
  :host {
5328
5460
  display: block;
5329
5461
  }
@@ -5517,10 +5649,10 @@ de.styles = [
5517
5649
  `
5518
5650
  ];
5519
5651
  Ve([
5520
- g({ attribute: !1 })
5652
+ v({ attribute: !1 })
5521
5653
  ], de.prototype, "client", 2);
5522
5654
  Ve([
5523
- v()
5655
+ w()
5524
5656
  ], de.prototype, "notifications", 2);
5525
5657
  de = Ve([
5526
5658
  R("pulse-widget-notifications-panel")
@@ -5883,14 +6015,14 @@ class hs {
5883
6015
  ), r = (o == null ? void 0 : o.user.color) ?? "#6366f1";
5884
6016
  try {
5885
6017
  const a = s.getClientRects(), c = [];
5886
- for (let p = 0; p < a.length; p++) {
5887
- const d = a[p], u = document.createElement("div");
6018
+ for (let h = 0; h < a.length; h++) {
6019
+ const p = a[h], u = document.createElement("div");
5888
6020
  Object.assign(u.style, {
5889
6021
  position: "absolute",
5890
- left: `${d.left}px`,
5891
- top: `${d.top}px`,
5892
- width: `${d.width}px`,
5893
- height: `${d.height}px`,
6022
+ left: `${p.left}px`,
6023
+ top: `${p.top}px`,
6024
+ width: `${p.width}px`,
6025
+ height: `${p.height}px`,
5894
6026
  background: r,
5895
6027
  opacity: "0.2",
5896
6028
  borderRadius: "2px",
@@ -5920,7 +6052,7 @@ var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, qe = (n, e
5920
6052
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
5921
6053
  return i && s && ps(e, t, s), s;
5922
6054
  };
5923
- let he = class extends T {
6055
+ let he = class extends S {
5924
6056
  constructor() {
5925
6057
  super(...arguments), this.roomId = "";
5926
6058
  }
@@ -5940,7 +6072,7 @@ let he = class extends T {
5940
6072
  );
5941
6073
  }
5942
6074
  renderToggle(n, e) {
5943
- return h`
6075
+ return d`
5944
6076
  <div class="setting-row">
5945
6077
  <span class="setting-label">${n}</span>
5946
6078
  <label class="toggle">
@@ -5956,12 +6088,12 @@ let he = class extends T {
5956
6088
  }
5957
6089
  render() {
5958
6090
  const n = !this.settings.enabled;
5959
- return h`
6091
+ return d`
5960
6092
  <div class="panel">
5961
6093
  <div class="panel-header">
5962
6094
  <span class="panel-title">Settings</span>
5963
6095
  <button class="close-btn" @click=${this.fireClose} title="Close">
5964
- ${k(me, 16)}
6096
+ ${C(me, 16)}
5965
6097
  </button>
5966
6098
  </div>
5967
6099
 
@@ -6010,7 +6142,7 @@ he.styles = [
6010
6142
  ee,
6011
6143
  ge,
6012
6144
  _e,
6013
- A`
6145
+ M`
6014
6146
  :host {
6015
6147
  display: block;
6016
6148
  }
@@ -6182,10 +6314,10 @@ he.styles = [
6182
6314
  `
6183
6315
  ];
6184
6316
  qe([
6185
- g({ attribute: !1 })
6317
+ v({ attribute: !1 })
6186
6318
  ], he.prototype, "settings", 2);
6187
6319
  qe([
6188
- g()
6320
+ v()
6189
6321
  ], he.prototype, "roomId", 2);
6190
6322
  he = qe([
6191
6323
  R("pulse-widget-settings-panel")
@@ -6218,7 +6350,7 @@ var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (n, e,
6218
6350
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
6219
6351
  return i && s && gs(e, t, s), s;
6220
6352
  };
6221
- let M = class extends T {
6353
+ let O = class extends S {
6222
6354
  constructor() {
6223
6355
  super(...arguments), this.collapsed = !1, this.activePanel = null, this.pinModeActive = !1, this.featuresDisabled = !1, this.drawModeActive = !1, this.followingUserId = null, this.display = "floating", this.users = [], this.unreadCount = 0;
6224
6356
  }
@@ -6269,35 +6401,35 @@ let M = class extends T {
6269
6401
  render() {
6270
6402
  const n = this.display === "inline";
6271
6403
  if (this.collapsed)
6272
- return h`
6404
+ return d`
6273
6405
  <div class="toolbar collapsed ${n ? "inline" : ""}" @click=${this.fireToggle}>
6274
- <span class="fab-icon">${k(Ri, n ? 18 : 24)}</span>
6406
+ <span class="fab-icon">${C(Ri, n ? 18 : 24)}</span>
6275
6407
  </div>
6276
6408
  `;
6277
6409
  const e = this.users.slice(0, 3), t = this.users.length - 3;
6278
- return h`
6410
+ return d`
6279
6411
  <div class="toolbar ${n ? "inline" : ""}"
6280
6412
  <!-- Presence avatars -->
6281
- ${this.users.length > 0 ? h`
6413
+ ${this.users.length > 0 ? d`
6282
6414
  <div class="presence">
6283
- ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : f}
6415
+ ${t > 0 ? d`<div class="presence-overflow">+${t}</div>` : g}
6284
6416
  ${e.map(
6285
- (i) => h`
6417
+ (i) => d`
6286
6418
  <div
6287
6419
  class="presence-avatar clickable ${this.followingUserId === i.user.id ? "following" : ""}"
6288
6420
  style="background:${i.user.color}"
6289
6421
  @click=${() => this.fireFollow(i.user.id)}
6290
6422
  title="Click to follow ${i.user.name}"
6291
6423
  >
6292
- ${i.user.avatar ? h`<img src="${i.user.avatar}" alt="${i.user.name}" />` : this.getInitials(i.user.name)}
6424
+ ${i.user.avatar ? d`<img src="${i.user.avatar}" alt="${i.user.name}" />` : this.getInitials(i.user.name)}
6293
6425
  <span class="presence-tooltip">${i.user.name}</span>
6294
- ${i.deviceType && i.deviceType !== "desktop" ? h`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : f}
6426
+ ${i.deviceType && i.deviceType !== "desktop" ? d`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : g}
6295
6427
  </div>
6296
6428
  `
6297
6429
  )}
6298
6430
  </div>
6299
6431
  <div class="separator"></div>
6300
- ` : f}
6432
+ ` : g}
6301
6433
 
6302
6434
  <!-- Pin comment (primary) -->
6303
6435
  <button
@@ -6307,7 +6439,7 @@ let M = class extends T {
6307
6439
  ?disabled=${this.featuresDisabled}
6308
6440
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6309
6441
  >
6310
- ${k(_t)}
6442
+ ${C(_t)}
6311
6443
  </button>
6312
6444
 
6313
6445
  <!-- View comments -->
@@ -6318,7 +6450,7 @@ let M = class extends T {
6318
6450
  ?disabled=${this.featuresDisabled}
6319
6451
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6320
6452
  >
6321
- ${k(_i)}
6453
+ ${C(_i)}
6322
6454
  </button>
6323
6455
 
6324
6456
  <!-- Activity feed -->
@@ -6329,7 +6461,7 @@ let M = class extends T {
6329
6461
  ?disabled=${this.featuresDisabled}
6330
6462
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6331
6463
  >
6332
- ${k(Ci)}
6464
+ ${C(Ci)}
6333
6465
  </button>
6334
6466
 
6335
6467
  <!-- Draw mode -->
@@ -6340,7 +6472,7 @@ let M = class extends T {
6340
6472
  ?disabled=${this.featuresDisabled}
6341
6473
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : ""}"
6342
6474
  >
6343
- ${k(Pi)}
6475
+ ${C(Pi)}
6344
6476
  </button>
6345
6477
 
6346
6478
  <!-- Notifications -->
@@ -6351,8 +6483,8 @@ let M = class extends T {
6351
6483
  ?disabled=${this.featuresDisabled}
6352
6484
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : "position:relative"}"
6353
6485
  >
6354
- ${k(Ei)}
6355
- ${this.unreadCount > 0 ? h`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : f}
6486
+ ${C(Ei)}
6487
+ ${this.unreadCount > 0 ? d`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : g}
6356
6488
  </button>
6357
6489
 
6358
6490
  <!-- Settings -->
@@ -6361,7 +6493,7 @@ let M = class extends T {
6361
6493
  @click=${() => this.fire("settings")}
6362
6494
  title="Settings"
6363
6495
  >
6364
- ${k(Ii)}
6496
+ ${C(Ii)}
6365
6497
  </button>
6366
6498
 
6367
6499
  <div class="separator"></div>
@@ -6372,16 +6504,16 @@ let M = class extends T {
6372
6504
  @click=${this.fireToggle}
6373
6505
  title="Collapse"
6374
6506
  >
6375
- ${k(me, 14)}
6507
+ ${C(me, 14)}
6376
6508
  </button>
6377
6509
  </div>
6378
6510
  `;
6379
6511
  }
6380
6512
  };
6381
- M.styles = [
6513
+ O.styles = [
6382
6514
  ee,
6383
6515
  ge,
6384
- A`
6516
+ M`
6385
6517
  :host {
6386
6518
  display: block;
6387
6519
  }
@@ -6594,38 +6726,38 @@ M.styles = [
6594
6726
  `
6595
6727
  ];
6596
6728
  L([
6597
- g({ attribute: !1 })
6598
- ], M.prototype, "client", 2);
6599
- L([
6600
- g({ type: Boolean })
6601
- ], M.prototype, "collapsed", 2);
6602
- L([
6603
- g()
6604
- ], M.prototype, "activePanel", 2);
6729
+ v({ attribute: !1 })
6730
+ ], O.prototype, "client", 2);
6605
6731
  L([
6606
- g({ type: Boolean })
6607
- ], M.prototype, "pinModeActive", 2);
6732
+ v({ type: Boolean })
6733
+ ], O.prototype, "collapsed", 2);
6608
6734
  L([
6609
- g({ type: Boolean })
6610
- ], M.prototype, "featuresDisabled", 2);
6735
+ v()
6736
+ ], O.prototype, "activePanel", 2);
6611
6737
  L([
6612
- g({ type: Boolean })
6613
- ], M.prototype, "drawModeActive", 2);
6738
+ v({ type: Boolean })
6739
+ ], O.prototype, "pinModeActive", 2);
6614
6740
  L([
6615
- g()
6616
- ], M.prototype, "followingUserId", 2);
6741
+ v({ type: Boolean })
6742
+ ], O.prototype, "featuresDisabled", 2);
6617
6743
  L([
6618
- g()
6619
- ], M.prototype, "display", 2);
6744
+ v({ type: Boolean })
6745
+ ], O.prototype, "drawModeActive", 2);
6620
6746
  L([
6621
6747
  v()
6622
- ], M.prototype, "users", 2);
6748
+ ], O.prototype, "followingUserId", 2);
6623
6749
  L([
6624
6750
  v()
6625
- ], M.prototype, "unreadCount", 2);
6626
- M = L([
6751
+ ], O.prototype, "display", 2);
6752
+ L([
6753
+ w()
6754
+ ], O.prototype, "users", 2);
6755
+ L([
6756
+ w()
6757
+ ], O.prototype, "unreadCount", 2);
6758
+ O = L([
6627
6759
  R("pulse-widget-toolbar")
6628
- ], M);
6760
+ ], O);
6629
6761
  class vs {
6630
6762
  constructor(e) {
6631
6763
  this.container = null, this.unsubs = [], this.enabled = !1, this.pillEls = /* @__PURE__ */ new Map(), this.client = e;
@@ -6667,23 +6799,23 @@ class vs {
6667
6799
  const e = window.scrollY, t = window.innerHeight, i = document.documentElement.scrollHeight, s = (r = this.client.state.user) == null ? void 0 : r.id, o = /* @__PURE__ */ new Set();
6668
6800
  for (const [l, a] of this.client.state.viewports) {
6669
6801
  if (l === s) continue;
6670
- const c = a.scrollY, p = a.scrollY + a.viewportHeight, d = e, u = e + t;
6671
- if (c >= d && p <= u) {
6672
- const $ = this.pillEls.get(l);
6673
- $ && ($.style.display = "none");
6802
+ const c = a.scrollY, h = a.scrollY + a.viewportHeight, p = e, u = e + t;
6803
+ if (c >= p && h <= u) {
6804
+ const E = this.pillEls.get(l);
6805
+ E && (E.style.display = "none");
6674
6806
  continue;
6675
6807
  }
6676
6808
  o.add(l);
6677
- const m = this.client.state.presence.find(
6678
- ($) => $.user.id === l
6809
+ const f = this.client.state.presence.find(
6810
+ (E) => E.user.id === l
6679
6811
  );
6680
- if (!m) continue;
6681
- const b = a.scrollY + a.viewportHeight / 2, I = i > 0 ? b / i : 0, C = Math.max(
6812
+ if (!f) continue;
6813
+ const m = a.scrollY + a.viewportHeight / 2, x = i > 0 ? m / i : 0, b = Math.max(
6682
6814
  8,
6683
- Math.min(t - 28, I * t)
6815
+ Math.min(t - 28, x * t)
6684
6816
  );
6685
- let w = this.pillEls.get(l);
6686
- w || (w = document.createElement("div"), Object.assign(w.style, {
6817
+ let y = this.pillEls.get(l);
6818
+ y || (y = document.createElement("div"), Object.assign(y.style, {
6687
6819
  position: "absolute",
6688
6820
  right: "8px",
6689
6821
  padding: "2px 6px",
@@ -6695,7 +6827,7 @@ class vs {
6695
6827
  whiteSpace: "nowrap",
6696
6828
  pointerEvents: "none",
6697
6829
  transition: "top 0.3s ease"
6698
- }), this.container.appendChild(w), this.pillEls.set(l, w)), w.style.display = "", w.style.background = m.user.color, w.style.top = `${C}px`, w.textContent = this.getInitials(m.user.name);
6830
+ }), this.container.appendChild(y), this.pillEls.set(l, y)), y.style.display = "", y.style.background = f.user.color, y.style.top = `${b}px`, y.textContent = this.getInitials(f.user.name);
6699
6831
  }
6700
6832
  for (const [l, a] of this.pillEls)
6701
6833
  !o.has(l) && !this.client.state.viewports.has(l) && (a.remove(), this.pillEls.delete(l));
@@ -6704,12 +6836,12 @@ class vs {
6704
6836
  return e.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2);
6705
6837
  }
6706
6838
  }
6707
- var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, S = (n, e, t, i) => {
6839
+ var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, A = (n, e, t, i) => {
6708
6840
  for (var s = i > 1 ? void 0 : i ? ys(e, t) : e, o = n.length - 1, r; o >= 0; o--)
6709
6841
  (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
6710
6842
  return i && s && xs(e, t, s), s;
6711
6843
  };
6712
- let E = class extends T {
6844
+ let _ = class extends S {
6713
6845
  constructor() {
6714
6846
  super(...arguments), this.apiKey = "", this.token = "", this.room = "", this.position = "bottom-right", this.display = "floating", this.collapsed = !0, this.activePanel = null, this.pinModeActive = !1, this.highlightThreadId = null, this.settings = { ...ye }, this.followingUserId = null, this.drawModeActive = !1, this.connectionState = "disconnected", this.showConnectedFlash = !1, this.unsubs = [], this.clientConfigKey = "", this._isFollowScrolling = !1, this._viewportThrottleTimer = null, this._selectionThrottleTimer = null, this._connectedFlashTimer = null, this._wasDisconnected = !1, this.handleScroll = () => {
6715
6847
  !this.settings.enabled || !this.client || this._isFollowScrolling || (this.followingUserId && (this.followingUserId = null), !this._viewportThrottleTimer && (this._viewportThrottleTimer = setTimeout(() => {
@@ -6838,12 +6970,12 @@ let E = class extends T {
6838
6970
  this.settings = e, ms(this.room, e), this.applySettings(e);
6839
6971
  }
6840
6972
  applySettings(n) {
6841
- var e, t, i, s, o, r, l, a, c, p, d, u, m, b, I, C, w;
6973
+ var e, t, i, s, o, r, l, a, c, h, p, u, f, m, x, b, y;
6842
6974
  if (!n.enabled) {
6843
6975
  (e = this.cursorOverlay) == null || e.disable(), (t = this.viewportOverlay) == null || t.disable(), (i = this.selectionOverlay) == null || i.disable(), (s = this.drawingOverlay) == null || s.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;
6844
6976
  return;
6845
6977
  }
6846
- this.applyCursorSettings(n), (c = this.client) == null || c.setAppearOffline(n.appearOffline), (p = this.commentPins) == null || p.setVisible(n.showCommentPins), n.showViewportIndicators ? (d = this.viewportOverlay) == null || d.enable() : (u = this.viewportOverlay) == null || u.disable(), n.showSelections ? (m = this.selectionOverlay) == null || m.enable() : (b = this.selectionOverlay) == null || b.disable(), n.showDrawings ? (I = this.drawingOverlay) == null || I.enable() : ((C = this.drawingOverlay) == null || C.disable(), this.drawModeActive && ((w = this.drawingOverlay) == null || w.disableDrawMode(), this.drawModeActive = !1));
6978
+ this.applyCursorSettings(n), (c = this.client) == null || c.setAppearOffline(n.appearOffline), (h = this.commentPins) == null || h.setVisible(n.showCommentPins), n.showViewportIndicators ? (p = this.viewportOverlay) == null || p.enable() : (u = this.viewportOverlay) == null || u.disable(), n.showSelections ? (f = this.selectionOverlay) == null || f.enable() : (m = this.selectionOverlay) == null || m.disable(), n.showDrawings ? (x = this.drawingOverlay) == null || x.enable() : ((b = this.drawingOverlay) == null || b.disable(), this.drawModeActive && ((y = this.drawingOverlay) == null || y.disableDrawMode(), this.drawModeActive = !1));
6847
6979
  }
6848
6980
  applyCursorSettings(n) {
6849
6981
  if (!this.cursorOverlay) return;
@@ -6857,22 +6989,22 @@ let E = class extends T {
6857
6989
  * the trigger element, flipping vertically/horizontally as needed.
6858
6990
  */
6859
6991
  positionPopups() {
6860
- var b, I, C, w;
6861
- const n = this.display === "inline", e = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".inline-trigger"), t = (I = this.shadowRoot) == null ? void 0 : I.querySelector("pulse-widget-toolbar"), i = n ? e : t;
6992
+ var m, x, b, y;
6993
+ const n = this.display === "inline", e = (m = this.shadowRoot) == null ? void 0 : m.querySelector(".inline-trigger"), t = (x = this.shadowRoot) == null ? void 0 : x.querySelector("pulse-widget-toolbar"), i = n ? e : t;
6862
6994
  if (!i) return;
6863
- const s = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = (C = this.shadowRoot) == null ? void 0 : C.querySelector(".toolbar-popover");
6995
+ const s = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = (b = this.shadowRoot) == null ? void 0 : b.querySelector(".toolbar-popover");
6864
6996
  if (a) {
6865
6997
  Object.assign(a.style, { top: "auto", left: "auto" });
6866
- const $ = a.getBoundingClientRect(), P = this.computePosition(s, $, o, r, l);
6867
- a.style.top = `${P.top}px`, a.style.left = `${P.left}px`;
6998
+ const E = a.getBoundingClientRect(), I = this.computePosition(s, E, o, r, l);
6999
+ a.style.top = `${I.top}px`, a.style.left = `${I.left}px`;
6868
7000
  }
6869
- const c = (w = this.shadowRoot) == null ? void 0 : w.querySelector(".panel-container");
7001
+ const c = (y = this.shadowRoot) == null ? void 0 : y.querySelector(".panel-container");
6870
7002
  if (!c) return;
6871
7003
  Object.assign(c.style, { top: "auto", left: "auto" });
6872
- const p = a ?? t;
6873
- if (!p) return;
6874
- const d = p.getBoundingClientRect(), u = c.getBoundingClientRect(), m = this.computePosition(d, u, o, r, l);
6875
- c.style.top = `${m.top}px`, c.style.left = `${m.left}px`;
7004
+ const h = a ?? t;
7005
+ if (!h) return;
7006
+ const p = h.getBoundingClientRect(), u = c.getBoundingClientRect(), f = this.computePosition(p, u, o, r, l);
7007
+ c.style.top = `${f.top}px`, c.style.left = `${f.left}px`;
6876
7008
  }
6877
7009
  computePosition(n, e, t, i, s) {
6878
7010
  const o = n.top, r = i - n.bottom;
@@ -6891,13 +7023,13 @@ let E = class extends T {
6891
7023
  return (n == null ? void 0 : n.user.name) ?? "user";
6892
7024
  }
6893
7025
  renderConnectionBanner() {
6894
- return this.showConnectedFlash ? h`<div class="connection-banner connected">
7026
+ return this.showConnectedFlash ? d`<div class="connection-banner connected">
6895
7027
  <span class="connection-dot"></span>Connected
6896
- </div>` : this.connectionState === "connecting" ? h`<div class="connection-banner connecting">
7028
+ </div>` : this.connectionState === "connecting" ? d`<div class="connection-banner connecting">
6897
7029
  <span class="connection-dot"></span>Reconnecting...
6898
- </div>` : this.connectionState === "disconnected" && this.client ? h`<div class="connection-banner disconnected">
7030
+ </div>` : this.connectionState === "disconnected" && this.client ? d`<div class="connection-banner disconnected">
6899
7031
  <span class="connection-dot"></span>Disconnected
6900
- </div>` : f;
7032
+ </div>` : g;
6901
7033
  }
6902
7034
  handleToolbarToggle() {
6903
7035
  this.collapsed = !this.collapsed, this.collapsed && (this.activePanel = null, this.highlightThreadId = null);
@@ -6905,38 +7037,38 @@ let E = class extends T {
6905
7037
  render() {
6906
7038
  const n = this.display === "inline";
6907
7039
  if (n && this.collapsed)
6908
- return h`
7040
+ return d`
6909
7041
  <div class="widget-root">
6910
7042
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
6911
7043
  <slot>Collaborate</slot>
6912
7044
  </div>
6913
7045
  </div>
6914
7046
  `;
6915
- const e = this.activePanel ? h`
7047
+ const e = this.activePanel ? d`
6916
7048
  <div class="panel-container anchored" @panel-close=${this.handlePanelClose}>
6917
- ${this.activePanel === "comments" ? h`<pulse-widget-comments-panel
7049
+ ${this.activePanel === "comments" ? d`<pulse-widget-comments-panel
6918
7050
  .client=${this.client}
6919
7051
  .highlightThreadId=${this.highlightThreadId}
6920
- ></pulse-widget-comments-panel>` : f}
6921
- ${this.activePanel === "settings" ? h`<pulse-widget-settings-panel
7052
+ ></pulse-widget-comments-panel>` : g}
7053
+ ${this.activePanel === "settings" ? d`<pulse-widget-settings-panel
6922
7054
  .settings=${this.settings}
6923
7055
  .roomId=${this.room}
6924
7056
  @settings-change=${this.handleSettingsChange}
6925
- ></pulse-widget-settings-panel>` : f}
6926
- ${this.activePanel === "notifications" ? h`<pulse-widget-notifications-panel
7057
+ ></pulse-widget-settings-panel>` : g}
7058
+ ${this.activePanel === "notifications" ? d`<pulse-widget-notifications-panel
6927
7059
  .client=${this.client}
6928
- ></pulse-widget-notifications-panel>` : f}
6929
- ${this.activePanel === "activity" ? h`<pulse-widget-activity-panel
7060
+ ></pulse-widget-notifications-panel>` : g}
7061
+ ${this.activePanel === "activity" ? d`<pulse-widget-activity-panel
6930
7062
  .client=${this.client}
6931
- ></pulse-widget-activity-panel>` : f}
7063
+ ></pulse-widget-activity-panel>` : g}
6932
7064
  </div>
6933
- ` : f, t = this.followingUserId ? h`<div class="follow-banner">
7065
+ ` : g, t = this.followingUserId ? d`<div class="follow-banner">
6934
7066
  Following ${this.getFollowUserName()}
6935
7067
  <button @click=${() => {
6936
7068
  this.followingUserId = null;
6937
7069
  }}>Stop</button>
6938
- </div>` : f;
6939
- return n ? h`
7070
+ </div>` : g;
7071
+ return n ? d`
6940
7072
  ${t}
6941
7073
  <div class="widget-root">
6942
7074
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
@@ -6960,7 +7092,7 @@ let E = class extends T {
6960
7092
  </div>
6961
7093
  ${e}
6962
7094
  </div>
6963
- ` : h`
7095
+ ` : d`
6964
7096
  ${t}
6965
7097
  <div class="widget-root">
6966
7098
  ${e}
@@ -6982,9 +7114,9 @@ let E = class extends T {
6982
7114
  `;
6983
7115
  }
6984
7116
  };
6985
- E.styles = [
7117
+ _.styles = [
6986
7118
  ee,
6987
- A`
7119
+ M`
6988
7120
  :host {
6989
7121
  display: block;
6990
7122
  }
@@ -7160,54 +7292,54 @@ E.styles = [
7160
7292
  }
7161
7293
  `
7162
7294
  ];
7163
- S([
7164
- g({ attribute: "api-key" })
7165
- ], E.prototype, "apiKey", 2);
7166
- S([
7167
- g()
7168
- ], E.prototype, "token", 2);
7169
- S([
7170
- g()
7171
- ], E.prototype, "room", 2);
7172
- S([
7173
- g()
7174
- ], E.prototype, "endpoint", 2);
7175
- S([
7176
- g({ reflect: !0 })
7177
- ], E.prototype, "position", 2);
7178
- S([
7179
- g({ reflect: !0 })
7180
- ], E.prototype, "display", 2);
7181
- S([
7182
- v()
7183
- ], E.prototype, "collapsed", 2);
7184
- S([
7185
- v()
7186
- ], E.prototype, "activePanel", 2);
7187
- S([
7188
- v()
7189
- ], E.prototype, "pinModeActive", 2);
7190
- S([
7191
- v()
7192
- ], E.prototype, "highlightThreadId", 2);
7193
- S([
7194
- v()
7195
- ], E.prototype, "settings", 2);
7196
- S([
7197
- v()
7198
- ], E.prototype, "followingUserId", 2);
7199
- S([
7295
+ A([
7296
+ v({ attribute: "api-key" })
7297
+ ], _.prototype, "apiKey", 2);
7298
+ A([
7200
7299
  v()
7201
- ], E.prototype, "drawModeActive", 2);
7202
- S([
7300
+ ], _.prototype, "token", 2);
7301
+ A([
7203
7302
  v()
7204
- ], E.prototype, "connectionState", 2);
7205
- S([
7303
+ ], _.prototype, "room", 2);
7304
+ A([
7206
7305
  v()
7207
- ], E.prototype, "showConnectedFlash", 2);
7208
- E = S([
7306
+ ], _.prototype, "endpoint", 2);
7307
+ A([
7308
+ v({ reflect: !0 })
7309
+ ], _.prototype, "position", 2);
7310
+ A([
7311
+ v({ reflect: !0 })
7312
+ ], _.prototype, "display", 2);
7313
+ A([
7314
+ w()
7315
+ ], _.prototype, "collapsed", 2);
7316
+ A([
7317
+ w()
7318
+ ], _.prototype, "activePanel", 2);
7319
+ A([
7320
+ w()
7321
+ ], _.prototype, "pinModeActive", 2);
7322
+ A([
7323
+ w()
7324
+ ], _.prototype, "highlightThreadId", 2);
7325
+ A([
7326
+ w()
7327
+ ], _.prototype, "settings", 2);
7328
+ A([
7329
+ w()
7330
+ ], _.prototype, "followingUserId", 2);
7331
+ A([
7332
+ w()
7333
+ ], _.prototype, "drawModeActive", 2);
7334
+ A([
7335
+ w()
7336
+ ], _.prototype, "connectionState", 2);
7337
+ A([
7338
+ w()
7339
+ ], _.prototype, "showConnectedFlash", 2);
7340
+ _ = A([
7209
7341
  R("pulse-widget")
7210
- ], E);
7342
+ ], _);
7211
7343
  export {
7212
7344
  W as PulseComments,
7213
7345
  le as PulseCursors,
@@ -7215,5 +7347,5 @@ export {
7215
7347
  G as PulsePresence,
7216
7348
  q as PulseProvider,
7217
7349
  D as PulseReactions,
7218
- E as PulseWidget
7350
+ _ as PulseWidget
7219
7351
  };