@gamention/pulse-elements 0.1.13 → 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.
@@ -4,8 +4,8 @@
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
5
  */
6
6
  let vt = class extends Event {
7
- constructor(e, t, i, n) {
8
- super("context-request", { bubbles: !0, composed: !0 }), this.context = e, this.contextTarget = t, this.callback = i, this.subscribe = n ?? !1;
7
+ constructor(e, t, i, s) {
8
+ super("context-request", { bubbles: !0, composed: !0 }), this.context = e, this.contextTarget = t, this.callback = i, this.subscribe = s ?? !1;
9
9
  }
10
10
  };
11
11
  /**
@@ -19,13 +19,13 @@ let vt = class extends Event {
19
19
  * SPDX-License-Identifier: BSD-3-Clause
20
20
  */
21
21
  let We = class {
22
- constructor(e, t, i, n) {
22
+ constructor(e, t, i, s) {
23
23
  if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (o, r) => {
24
24
  this.unsubscribe && (this.unsubscribe !== r && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = o, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(o, r)), this.unsubscribe = r;
25
25
  }, this.host = e, t.context !== void 0) {
26
26
  const o = t;
27
27
  this.context = o.context, this.callback = o.callback, this.subscribe = o.subscribe ?? !1;
28
- } else this.context = t, this.callback = i, this.subscribe = n ?? !1;
28
+ } else this.context = t, this.callback = i, this.subscribe = s ?? !1;
29
29
  this.host.addController(this);
30
30
  }
31
31
  hostConnected() {
@@ -64,8 +64,8 @@ let At = class {
64
64
  this.subscriptions.has(e) || this.subscriptions.set(e, { disposer: () => {
65
65
  this.subscriptions.delete(e);
66
66
  }, consumerHost: t });
67
- const { disposer: n } = this.subscriptions.get(e);
68
- e(this.value, n);
67
+ const { disposer: s } = this.subscriptions.get(e);
68
+ e(this.value, s);
69
69
  }
70
70
  clearCallbacks() {
71
71
  this.subscriptions.clear();
@@ -82,7 +82,7 @@ let It = class extends Event {
82
82
  }
83
83
  }, Xe = class extends At {
84
84
  constructor(e, t, i) {
85
- var n, o;
85
+ var s, o;
86
86
  super(t.context !== void 0 ? t.initialValue : i), this.onContextRequest = (r) => {
87
87
  if (r.context !== this.context) return;
88
88
  const l = r.contextTarget ?? r.composedPath()[0];
@@ -92,7 +92,7 @@ let It = class extends Event {
92
92
  const l = /* @__PURE__ */ new Set();
93
93
  for (const [a, { consumerHost: c }] of this.subscriptions) l.has(a) || (l.add(a), c.dispatchEvent(new vt(this.context, c, a, !0)));
94
94
  r.stopPropagation();
95
- }, this.host = e, t.context !== void 0 ? this.context = t.context : this.context = t, this.attachListeners(), (o = (n = this.host).addController) == null || o.call(n, this);
95
+ }, this.host = e, t.context !== void 0 ? this.context = t.context : this.context = t, this.attachListeners(), (o = (s = this.host).addController) == null || o.call(s, this);
96
96
  }
97
97
  attachListeners() {
98
98
  this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest);
@@ -106,23 +106,23 @@ let It = class extends Event {
106
106
  * Copyright 2017 Google LLC
107
107
  * SPDX-License-Identifier: BSD-3-Clause
108
108
  */
109
- function Mt({ context: s }) {
109
+ function Mt({ context: n }) {
110
110
  return (e, t) => {
111
111
  const i = /* @__PURE__ */ new WeakMap();
112
112
  if (typeof t == "object") return { get() {
113
113
  return e.get.call(this);
114
- }, set(n) {
115
- return i.get(this).setValue(n), e.set.call(this, n);
116
- }, init(n) {
117
- return i.set(this, new Xe(this, { context: s, initialValue: n })), n;
114
+ }, set(s) {
115
+ return i.get(this).setValue(s), e.set.call(this, s);
116
+ }, init(s) {
117
+ return i.set(this, new Xe(this, { context: n, initialValue: s })), s;
118
118
  } };
119
119
  {
120
120
  e.constructor.addInitializer(((r) => {
121
- i.set(r, new Xe(r, { context: s }));
121
+ i.set(r, new Xe(r, { context: n }));
122
122
  }));
123
- const n = Object.getOwnPropertyDescriptor(e, t);
123
+ const s = Object.getOwnPropertyDescriptor(e, t);
124
124
  let o;
125
- if (n === void 0) {
125
+ if (s === void 0) {
126
126
  const r = /* @__PURE__ */ new WeakMap();
127
127
  o = { get() {
128
128
  return r.get(this);
@@ -130,8 +130,8 @@ function Mt({ context: s }) {
130
130
  i.get(this).setValue(l), r.set(this, l);
131
131
  }, configurable: !0, enumerable: !0 };
132
132
  } else {
133
- const r = n.set;
134
- o = { ...n, set(l) {
133
+ const r = s.set;
134
+ o = { ...s, set(l) {
135
135
  i.get(this).setValue(l), r == null || r.call(this, l);
136
136
  } };
137
137
  }
@@ -144,24 +144,24 @@ function Mt({ context: s }) {
144
144
  * Copyright 2022 Google LLC
145
145
  * SPDX-License-Identifier: BSD-3-Clause
146
146
  */
147
- function pe({ context: s, subscribe: e }) {
147
+ function pe({ context: n, subscribe: e }) {
148
148
  return (t, i) => {
149
149
  typeof i == "object" ? i.addInitializer((function() {
150
- new We(this, { context: s, callback: (n) => {
151
- t.set.call(this, n);
150
+ new We(this, { context: n, callback: (s) => {
151
+ t.set.call(this, s);
152
152
  }, subscribe: e });
153
- })) : t.constructor.addInitializer(((n) => {
154
- new We(n, { context: s, callback: (o) => {
155
- n[i] = o;
153
+ })) : t.constructor.addInitializer(((s) => {
154
+ new We(s, { context: n, callback: (o) => {
155
+ s[i] = o;
156
156
  }, subscribe: e });
157
157
  }));
158
158
  };
159
159
  }
160
- var Ot = Object.defineProperty, Rt = (s, e, t) => e in s ? Ot(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, w = (s, e, t) => Rt(s, 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
- w(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());
@@ -174,14 +174,14 @@ let je = class {
174
174
  }
175
175
  emit(e, t) {
176
176
  var i;
177
- (i = this.handlers.get(e)) == null || i.forEach((n) => n(t));
177
+ (i = this.handlers.get(e)) == null || i.forEach((s) => s(t));
178
178
  }
179
179
  removeAll() {
180
180
  this.handlers.clear();
181
181
  }
182
182
  }, jt = class extends je {
183
183
  constructor(e) {
184
- super(), w(this, "ws", null), w(this, "endpoint"), w(this, "reconnectAttempt", 0), w(this, "reconnectTimer", null), w(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;
@@ -218,7 +218,7 @@ let je = class {
218
218
  }
219
219
  }, zt = class extends je {
220
220
  constructor() {
221
- super(...arguments), w(this, "baseUrl", ""), w(this, "_user", null), w(this, "_users", /* @__PURE__ */ new Map()), w(this, "_presence", /* @__PURE__ */ new Map()), w(this, "_threads", /* @__PURE__ */ new Map()), w(this, "_reactions", /* @__PURE__ */ new Map()), w(this, "_notifications", []), w(this, "_activityLogs", []), w(this, "_typing", /* @__PURE__ */ new Map()), w(this, "_viewports", /* @__PURE__ */ new Map()), w(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;
@@ -226,9 +226,9 @@ let je = class {
226
226
  /** Optimistically remove a comment from local state (before server round-trip). */
227
227
  removeComment(e) {
228
228
  for (const [t, i] of this._threads) {
229
- const n = i.comments.findIndex((o) => o.id === e);
230
- if (n !== -1) {
231
- i.comments.splice(n, 1), i.comments.length === 0 && this._threads.delete(t), this.emit("threads", this.threads);
229
+ const s = i.comments.findIndex((o) => o.id === e);
230
+ if (s !== -1) {
231
+ i.comments.splice(s, 1), i.comments.length === 0 && this._threads.delete(t), this.emit("threads", this.threads);
232
232
  return;
233
233
  }
234
234
  }
@@ -257,10 +257,10 @@ let je = class {
257
257
  getTypingUsers(e) {
258
258
  const t = this._typing.get(e);
259
259
  if (!t) return [];
260
- const i = Date.now(), n = [];
260
+ const i = Date.now(), s = [];
261
261
  for (const [o, r] of t)
262
- i - r < 3e3 && n.push(o);
263
- return n;
262
+ i - r < 3e3 && s.push(o);
263
+ return s;
264
264
  }
265
265
  get viewports() {
266
266
  return this._viewports;
@@ -339,7 +339,7 @@ let je = class {
339
339
  case "comment:edited": {
340
340
  const t = this._threads.get(e.threadId);
341
341
  if (t) {
342
- const i = t.comments.findIndex((n) => n.id === e.comment.id);
342
+ const i = t.comments.findIndex((s) => s.id === e.comment.id);
343
343
  i !== -1 && (t.comments[i] = this.resolveComment(e.comment)), this.emit("threads", this.threads);
344
344
  }
345
345
  break;
@@ -368,7 +368,7 @@ let je = class {
368
368
  case "reaction:removed": {
369
369
  const t = this._reactions.get(e.targetId);
370
370
  if (t) {
371
- const i = t.filter((n) => n.id !== e.reactionId);
371
+ const i = t.filter((s) => s.id !== e.reactionId);
372
372
  this._reactions.set(e.targetId, i), this.emit("reactions", {
373
373
  targetId: e.targetId,
374
374
  reactions: i
@@ -429,12 +429,12 @@ let je = class {
429
429
  }, xt = class extends je {
430
430
  constructor(e) {
431
431
  var t;
432
- super(), w(this, "state"), w(this, "connection"), w(this, "config"), w(this, "heartbeatTimer", null), w(this, "lastCursorSend", 0), w(this, "pendingCursor", null), w(this, "cursorTimer", null), this.config = e, this.state = new zt(), 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
- this.connection = new jt(i), this.connection.on("message", (n) => {
435
- this.state.handleMessage(n), this.emit(n.type, n);
436
- }), this.connection.on("state", (n) => {
437
- this.emit("connection", n), n === "connected" ? (this.authenticate(), this.startHeartbeat()) : n === "disconnected" && this.stopHeartbeat();
434
+ this.connection = new jt(i), this.connection.on("message", (s) => {
435
+ this.state.handleMessage(s), this.emit(s.type, s);
436
+ }), this.connection.on("state", (s) => {
437
+ this.emit("connection", s), s === "connected" ? (this.authenticate(), this.startHeartbeat()) : s === "disconnected" && this.stopHeartbeat();
438
438
  });
439
439
  }
440
440
  /** Current WebSocket connection state. */
@@ -492,9 +492,9 @@ let je = class {
492
492
  attachmentIds: t.attachmentIds
493
493
  }), i;
494
494
  }
495
- reply(e, t, i = [], n) {
495
+ reply(e, t, i = [], s) {
496
496
  const o = crypto.randomUUID();
497
- return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds: n }), o;
497
+ return this.send({ type: "comment:create", threadId: e, id: o, body: t, mentions: i, attachmentIds: s }), o;
498
498
  }
499
499
  editComment(e, t, i = []) {
500
500
  this.send({ type: "comment:edit", commentId: e, body: t, mentions: i });
@@ -550,7 +550,7 @@ let je = class {
550
550
  async uploadFile(e) {
551
551
  const t = (this.config.endpoint ?? window.location.origin).replace(/^ws(s?):/, "http$1:"), i = new FormData();
552
552
  i.append("file", e);
553
- const n = await fetch(`${t}/api/v1/upload`, {
553
+ const s = await fetch(`${t}/api/v1/upload`, {
554
554
  method: "POST",
555
555
  headers: {
556
556
  "X-Pulse-Key": this.config.apiKey,
@@ -558,11 +558,11 @@ let je = class {
558
558
  },
559
559
  body: i
560
560
  });
561
- if (!n.ok) {
562
- const r = await n.json().catch(() => ({ error: "Upload failed" }));
561
+ if (!s.ok) {
562
+ const r = await s.json().catch(() => ({ error: "Upload failed" }));
563
563
  throw new Error(r.error ?? "Upload failed");
564
564
  }
565
- const o = await n.json();
565
+ const o = await s.json();
566
566
  return o.url && !o.url.startsWith("http") && (o.url = `${t}${o.url}`), o.thumbnailUrl && !o.thumbnailUrl.startsWith("http") && (o.thumbnailUrl = `${t}${o.thumbnailUrl}`), o;
567
567
  }
568
568
  // ── Presence control ──
@@ -594,58 +594,58 @@ let yt = class {
594
594
  return this.cssText;
595
595
  }
596
596
  };
597
- const Ut = (s) => new yt(typeof s == "string" ? s : s + "", void 0, Ue), I = (s, ...e) => {
598
- const t = s.length === 1 ? s[0] : e.reduce((i, n, o) => i + ((r) => {
597
+ const Ut = (n) => new yt(typeof n == "string" ? n : n + "", void 0, Ue), M = (n, ...e) => {
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
- })(n) + s[o + 1], s[0]);
603
- return new yt(t, s, Ue);
604
- }, Dt = (s, e) => {
605
- if (ze) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
602
+ })(s) + n[o + 1], n[0]);
603
+ return new yt(t, n, Ue);
604
+ }, Dt = (n, e) => {
605
+ if (ze) n.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
606
606
  else for (const t of e) {
607
- const i = document.createElement("style"), n = ve.litNonce;
608
- n !== void 0 && i.setAttribute("nonce", n), i.textContent = t.cssText, s.appendChild(i);
607
+ const i = document.createElement("style"), s = ve.litNonce;
608
+ s !== void 0 && i.setAttribute("nonce", s), i.textContent = t.cssText, n.appendChild(i);
609
609
  }
610
- }, Ke = ze ? (s) => s : (s) => s 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
613
  return Ut(t);
614
- })(s) : s;
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: Bt, getOwnPropertyDescriptor: Nt, getOwnPropertyNames: Ft, getOwnPropertySymbols: Vt, getPrototypeOf: qt } = Object, U = globalThis, Ge = U.trustedTypes, Wt = Ge ? Ge.emptyScript : "", Te = U.reactiveElementPolyfillSupport, ie = (s, e) => s, we = { toAttribute(s, 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
- s = s ? Wt : null;
623
+ n = n ? Wt : null;
624
624
  break;
625
625
  case Object:
626
626
  case Array:
627
- s = s == null ? s : JSON.stringify(s);
627
+ n = n == null ? n : JSON.stringify(n);
628
628
  }
629
- return s;
630
- }, fromAttribute(s, e) {
631
- let t = s;
629
+ return n;
630
+ }, fromAttribute(n, e) {
631
+ let t = n;
632
632
  switch (e) {
633
633
  case Boolean:
634
- t = s !== null;
634
+ t = n !== null;
635
635
  break;
636
636
  case Number:
637
- t = s === null ? null : Number(s);
637
+ t = n === null ? null : Number(n);
638
638
  break;
639
639
  case Object:
640
640
  case Array:
641
641
  try {
642
- t = JSON.parse(s);
642
+ t = JSON.parse(n);
643
643
  } catch {
644
644
  t = null;
645
645
  }
646
646
  }
647
647
  return t;
648
- } }, De = (s, e) => !Ht(s, e), Ze = { attribute: !0, type: String, converter: we, reflect: !1, useDefault: !1, hasChanged: De };
648
+ } }, De = (n, e) => !Ht(n, e), Ze = { attribute: !0, type: String, converter: we, reflect: !1, useDefault: !1, hasChanged: De };
649
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) {
@@ -656,18 +656,18 @@ let Y = class extends HTMLElement {
656
656
  }
657
657
  static createProperty(e, t = Ze) {
658
658
  if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
659
- const i = Symbol(), n = this.getPropertyDescriptor(e, i, t);
660
- n !== void 0 && Bt(this.prototype, e, n);
659
+ const i = Symbol(), s = this.getPropertyDescriptor(e, i, t);
660
+ s !== void 0 && Nt(this.prototype, e, s);
661
661
  }
662
662
  }
663
663
  static getPropertyDescriptor(e, t, i) {
664
- const { get: n, set: o } = Nt(this.prototype, e) ?? { get() {
664
+ const { get: s, set: o } = Bt(this.prototype, e) ?? { get() {
665
665
  return this[t];
666
666
  }, set(r) {
667
667
  this[t] = r;
668
668
  } };
669
- return { get: n, set(r) {
670
- const l = n == null ? void 0 : n.call(this);
669
+ return { get: s, set(r) {
670
+ const l = s == null ? void 0 : s.call(this);
671
671
  o == null || o.call(this, r), this.requestUpdate(e, l, i);
672
672
  }, configurable: !0, enumerable: !0 };
673
673
  }
@@ -683,17 +683,17 @@ let Y = class extends HTMLElement {
683
683
  if (this.hasOwnProperty(ie("finalized"))) return;
684
684
  if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(ie("properties"))) {
685
685
  const t = this.properties, i = [...Ft(t), ...Vt(t)];
686
- for (const n of i) this.createProperty(n, t[n]);
686
+ for (const s of i) this.createProperty(s, t[s]);
687
687
  }
688
688
  const e = this[Symbol.metadata];
689
689
  if (e !== null) {
690
690
  const t = litPropertyMetadata.get(e);
691
- if (t !== void 0) for (const [i, n] of t) this.elementProperties.set(i, n);
691
+ if (t !== void 0) for (const [i, s] of t) this.elementProperties.set(i, s);
692
692
  }
693
693
  this._$Eh = /* @__PURE__ */ new Map();
694
694
  for (const [t, i] of this.elementProperties) {
695
- const n = this._$Eu(t, i);
696
- n !== void 0 && this._$Eh.set(n, t);
695
+ const s = this._$Eu(t, i);
696
+ s !== void 0 && this._$Eh.set(s, t);
697
697
  }
698
698
  this.elementStyles = this.finalizeStyles(this.styles);
699
699
  }
@@ -701,7 +701,7 @@ let Y = class extends HTMLElement {
701
701
  const t = [];
702
702
  if (Array.isArray(e)) {
703
703
  const i = new Set(e.flat(1 / 0).reverse());
704
- for (const n of i) t.unshift(Ke(n));
704
+ for (const s of i) t.unshift(Ke(s));
705
705
  } else e !== void 0 && t.push(Ke(e));
706
706
  return t;
707
707
  }
@@ -754,33 +754,33 @@ let Y = class extends HTMLElement {
754
754
  }
755
755
  _$ET(e, t) {
756
756
  var o;
757
- const i = this.constructor.elementProperties.get(e), n = this.constructor._$Eu(e, i);
758
- if (n !== void 0 && i.reflect === !0) {
757
+ const i = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, i);
758
+ if (s !== void 0 && i.reflect === !0) {
759
759
  const r = (((o = i.converter) == null ? void 0 : o.toAttribute) !== void 0 ? i.converter : we).toAttribute(t, i.type);
760
- this._$Em = e, r == null ? this.removeAttribute(n) : this.setAttribute(n, r), this._$Em = null;
760
+ this._$Em = e, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null;
761
761
  }
762
762
  }
763
763
  _$AK(e, t) {
764
764
  var o, r;
765
- const i = this.constructor, n = i._$Eh.get(e);
766
- if (n !== void 0 && this._$Em !== n) {
767
- const l = i.getPropertyOptions(n), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter : we;
768
- this._$Em = n;
765
+ const i = this.constructor, s = i._$Eh.get(e);
766
+ if (s !== void 0 && this._$Em !== s) {
767
+ const l = i.getPropertyOptions(s), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((o = l.converter) == null ? void 0 : o.fromAttribute) !== void 0 ? l.converter : we;
768
+ this._$Em = s;
769
769
  const c = a.fromAttribute(t, l.type);
770
- this[n] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(n)) ?? c, this._$Em = null;
770
+ this[s] = c ?? ((r = this._$Ej) == null ? void 0 : r.get(s)) ?? c, this._$Em = null;
771
771
  }
772
772
  }
773
- requestUpdate(e, t, i, n = !1, o) {
773
+ requestUpdate(e, t, i, s = !1, o) {
774
774
  var r;
775
775
  if (e !== void 0) {
776
776
  const l = this.constructor;
777
- if (n === !1 && (o = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? De)(o, t) || i.useDefault && i.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return;
777
+ if (s === !1 && (o = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? De)(o, t) || i.useDefault && i.reflect && o === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return;
778
778
  this.C(e, t, i);
779
779
  }
780
780
  this.isUpdatePending === !1 && (this._$ES = this._$EP());
781
781
  }
782
- C(e, t, { useDefault: i, reflect: n, wrapped: o }, r) {
783
- i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, r ?? t ?? this[e]), o !== !0 || r !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), n === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
782
+ C(e, t, { useDefault: i, reflect: s, wrapped: o }, r) {
783
+ i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, r ?? t ?? this[e]), o !== !0 || r !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), s === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
784
784
  }
785
785
  async _$EP() {
786
786
  this.isUpdatePending = !0;
@@ -803,8 +803,8 @@ let Y = class extends HTMLElement {
803
803
  for (const [o, r] of this._$Ep) this[o] = r;
804
804
  this._$Ep = void 0;
805
805
  }
806
- const n = this.constructor.elementProperties;
807
- if (n.size > 0) for (const [o, r] of n) {
806
+ const s = this.constructor.elementProperties;
807
+ if (s.size > 0) for (const [o, r] of s) {
808
808
  const { wrapped: l } = r, a = this[o];
809
809
  l !== !0 || this._$AL.has(o) || a === void 0 || this.C(o, void 0, r, a);
810
810
  }
@@ -812,12 +812,12 @@ let Y = class extends HTMLElement {
812
812
  let e = !1;
813
813
  const t = this._$AL;
814
814
  try {
815
- e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((n) => {
815
+ e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((s) => {
816
816
  var o;
817
- return (o = n.hostUpdate) == null ? void 0 : o.call(n);
817
+ return (o = s.hostUpdate) == null ? void 0 : o.call(s);
818
818
  }), this.update(t)) : this._$EM();
819
- } catch (n) {
820
- throw e = !1, this._$EM(), n;
819
+ } catch (s) {
820
+ throw e = !1, this._$EM(), s;
821
821
  }
822
822
  e && this._$AE(t);
823
823
  }
@@ -826,8 +826,8 @@ let Y = class extends HTMLElement {
826
826
  _$AE(e) {
827
827
  var t;
828
828
  (t = this._$EO) == null || t.forEach((i) => {
829
- var n;
830
- return (n = i.hostUpdated) == null ? void 0 : n.call(i);
829
+ var s;
830
+ return (s = i.hostUpdated) == null ? void 0 : s.call(i);
831
831
  }), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
832
832
  }
833
833
  _$EM() {
@@ -856,53 +856,53 @@ Y.elementStyles = [], Y.shadowRootOptions = { mode: "open" }, Y[ie("elementPrope
856
856
  * Copyright 2017 Google LLC
857
857
  * SPDX-License-Identifier: BSD-3-Clause
858
858
  */
859
- const se = globalThis, Je = (s) => s, $e = se.trustedTypes, Qe = $e ? $e.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, wt = "$lit$", z = `lit$${Math.random().toFixed(9).slice(2)}$`, $t = "?" + z, Xt = `<${$t}>`, F = document, oe = () => F.createComment(""), re = (s) => s === null || typeof s != "object" && typeof s != "function", He = Array.isArray, Yt = (s) => He(s) || typeof (s == null ? void 0 : s[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 = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), h = Et(1), Kt = Et(2), V = Symbol.for("lit-noChange"), m = Symbol.for("lit-nothing"), nt = /* @__PURE__ */ new WeakMap(), B = F.createTreeWalker(F, 129);
862
- function Ct(s, e) {
863
- if (!He(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
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
+ function Ct(n, e) {
863
+ if (!He(n) || !n.hasOwnProperty("raw")) throw Error("invalid template strings array");
864
864
  return Qe !== void 0 ? Qe.createHTML(e) : e;
865
865
  }
866
- const Gt = (s, e) => {
867
- const t = s.length - 1, i = [];
868
- let n, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
866
+ const Gt = (n, e) => {
867
+ const t = n.length - 1, i = [];
868
+ let s, o = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = te;
869
869
  for (let l = 0; l < t; l++) {
870
- const a = s[l];
871
- let c, p, d = -1, f = 0;
872
- for (; f < a.length && (r.lastIndex = f, p = r.exec(a), p !== null); ) f = r.lastIndex, r === te ? p[1] === "!--" ? r = et : p[1] !== void 0 ? r = tt : p[2] !== void 0 ? (kt.test(p[2]) && (n = RegExp("</" + p[2], "g")), r = H) : p[3] !== void 0 && (r = H) : r === H ? p[0] === ">" ? (r = n ?? 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, n = void 0);
873
- const u = r === H && s[l + 1].startsWith("/>") ? " " : "";
874
- o += r === te ? a + Xt : d >= 0 ? (i.push(c), a.slice(0, d) + wt + a.slice(d) + z + u) : a + z + (d === -2 ? l : u);
870
+ const a = n[l];
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
- return [Ct(s, o + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
876
+ return [Ct(n, o + (n[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
877
877
  };
878
878
  class ae {
879
879
  constructor({ strings: e, _$litType$: t }, i) {
880
- let n;
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);
884
- if (this.el = ae.createElement(c, i), B.currentNode = this.el.content, t === 2 || t === 3) {
885
- const d = this.el.content.firstChild;
886
- d.replaceWith(...d.childNodes);
887
- }
888
- for (; (n = B.nextNode()) !== null && a.length < l; ) {
889
- if (n.nodeType === 1) {
890
- if (n.hasAttributes()) for (const d of n.getAttributeNames()) if (d.endsWith(wt)) {
891
- const f = p[r++], u = n.getAttribute(d).split(z), g = /([.?@])?(.*)/.exec(f);
892
- a.push({ type: 1, index: o, name: g[2], strings: u, ctor: g[1] === "." ? Jt : g[1] === "?" ? Qt : g[1] === "@" ? ei : Ee }), n.removeAttribute(d);
893
- } else d.startsWith(z) && (a.push({ type: 6, index: o }), n.removeAttribute(d));
894
- if (kt.test(n.tagName)) {
895
- const d = n.textContent.split(z), f = d.length - 1;
896
- if (f > 0) {
897
- n.textContent = $e ? $e.emptyScript : "";
898
- for (let u = 0; u < f; u++) n.append(d[u], oe()), B.nextNode(), a.push({ type: 2, index: ++o });
899
- n.append(d[f], oe());
883
+ const l = e.length - 1, a = this.parts, [c, h] = Gt(e, t);
884
+ if (this.el = ae.createElement(c, i), N.currentNode = this.el.content, t === 2 || t === 3) {
885
+ const p = this.el.content.firstChild;
886
+ p.replaceWith(...p.childNodes);
887
+ }
888
+ for (; (s = N.nextNode()) !== null && a.length < l; ) {
889
+ if (s.nodeType === 1) {
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
+ if (kt.test(s.tagName)) {
895
+ const p = s.textContent.split(z), u = p.length - 1;
896
+ if (u > 0) {
897
+ s.textContent = $e ? $e.emptyScript : "";
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
- } else if (n.nodeType === 8) if (n.data === $t) a.push({ type: 2, index: o });
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 = n.data.indexOf(z, d + 1)) !== -1; ) a.push({ type: 7, index: o }), d += z.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
  }
@@ -912,12 +912,12 @@ class ae {
912
912
  return i.innerHTML = e, i;
913
913
  }
914
914
  }
915
- function K(s, e, t = s, i) {
915
+ function K(n, e, t = n, i) {
916
916
  var r, l;
917
917
  if (e === V) return e;
918
- let n = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
918
+ let s = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
919
919
  const o = re(e) ? void 0 : e._$litDirective$;
920
- return (n == null ? void 0 : n.constructor) !== o && ((l = n == null ? void 0 : n._$AO) == null || l.call(n, !1), o === void 0 ? n = void 0 : (n = new o(s), n._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = n : t._$Cl = n), n !== void 0 && (e = K(s, n._$AS(s, e.values), n, i)), e;
920
+ return (s == null ? void 0 : s.constructor) !== o && ((l = s == null ? void 0 : s._$AO) == null || l.call(s, !1), o === void 0 ? s = void 0 : (s = new o(n), s._$AT(n, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = s : t._$Cl = s), s !== void 0 && (e = K(n, s._$AS(n, e.values), s, i)), e;
921
921
  }
922
922
  class Zt {
923
923
  constructor(e, t) {
@@ -930,17 +930,17 @@ class Zt {
930
930
  return this._$AM._$AU;
931
931
  }
932
932
  u(e) {
933
- const { el: { content: t }, parts: i } = this._$AD, n = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
934
- B.currentNode = n;
935
- let o = B.nextNode(), r = 0, l = 0, a = i[0];
933
+ const { el: { content: t }, parts: i } = this._$AD, s = ((e == null ? void 0 : e.creationScope) ?? F).importNode(t, !0);
934
+ N.currentNode = s;
935
+ let o = N.nextNode(), r = 0, l = 0, a = i[0];
936
936
  for (; a !== void 0; ) {
937
937
  if (r === a.index) {
938
938
  let c;
939
939
  a.type === 2 ? c = new ue(o, o.nextSibling, this, e) : a.type === 1 ? c = new a.ctor(o, a.name, a.strings, this, e) : a.type === 6 && (c = new ti(o, this, e)), this._$AV.push(c), a = i[++l];
940
940
  }
941
- r !== (a == null ? void 0 : a.index) && (o = B.nextNode(), r++);
941
+ r !== (a == null ? void 0 : a.index) && (o = N.nextNode(), r++);
942
942
  }
943
- return B.currentNode = F, n;
943
+ return N.currentNode = F, s;
944
944
  }
945
945
  p(e) {
946
946
  let t = 0;
@@ -952,8 +952,8 @@ class ue {
952
952
  var e;
953
953
  return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
954
954
  }
955
- constructor(e, t, i, n) {
956
- this.type = 2, this._$AH = m, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = n, this._$Cv = (n == null ? void 0 : n.isConnected) ?? !0;
955
+ constructor(e, t, i, s) {
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 === m || e == null || e === "" ? (this._$AH !== m && this._$AR(), this._$AH = m) : 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,14 +976,14 @@ class ue {
976
976
  this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
977
977
  }
978
978
  _(e) {
979
- this._$AH !== m && 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;
983
- const { values: t, _$litType$: i } = e, n = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = ae.createElement(Ct(i.h, i.h[0]), this.options)), i);
984
- if (((o = this._$AH) == null ? void 0 : o._$AD) === n) this._$AH.p(t);
983
+ const { values: t, _$litType$: i } = e, s = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = ae.createElement(Ct(i.h, i.h[0]), this.options)), i);
984
+ if (((o = this._$AH) == null ? void 0 : o._$AD) === s) this._$AH.p(t);
985
985
  else {
986
- const r = new Zt(n, this), l = r.u(this.options);
986
+ const r = new Zt(s, this), l = r.u(this.options);
987
987
  r.p(t), this.T(l), this._$AH = r;
988
988
  }
989
989
  }
@@ -994,15 +994,15 @@ class ue {
994
994
  k(e) {
995
995
  He(this._$AH) || (this._$AH = [], this._$AR());
996
996
  const t = this._$AH;
997
- let i, n = 0;
998
- for (const o of e) n === t.length ? t.push(i = new ue(this.O(oe()), this.O(oe()), this, this.options)) : i = t[n], i._$AI(o), n++;
999
- n < t.length && (this._$AR(i && i._$AB.nextSibling, n), t.length = n);
997
+ let i, s = 0;
998
+ for (const o of e) s === t.length ? t.push(i = new ue(this.O(oe()), this.O(oe()), this, this.options)) : i = t[s], i._$AI(o), s++;
999
+ s < t.length && (this._$AR(i && i._$AB.nextSibling, s), t.length = s);
1000
1000
  }
1001
1001
  _$AR(e = this._$AA.nextSibling, t) {
1002
1002
  var i;
1003
1003
  for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, t); e !== this._$AB; ) {
1004
- const n = Je(e).nextSibling;
1005
- Je(e).remove(), e = n;
1004
+ const s = Je(e).nextSibling;
1005
+ Je(e).remove(), e = s;
1006
1006
  }
1007
1007
  }
1008
1008
  setConnected(e) {
@@ -1017,22 +1017,22 @@ class Ee {
1017
1017
  get _$AU() {
1018
1018
  return this._$AM._$AU;
1019
1019
  }
1020
- constructor(e, t, i, n, o) {
1021
- this.type = 1, this._$AH = m, this._$AN = void 0, this.element = e, this.name = t, this._$AM = n, this.options = o, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = m;
1020
+ constructor(e, t, i, s, o) {
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
- _$AI(e, t = this, i, n) {
1023
+ _$AI(e, t = this, i, s) {
1024
1024
  const o = this.strings;
1025
1025
  let r = !1;
1026
1026
  if (o === void 0) e = K(this, e, t, 0), r = !re(e) || e !== this._$AH && e !== V, r && (this._$AH = e);
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 === m ? e = m : e !== m && (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
- r && !n && this.j(e);
1032
+ r && !s && this.j(e);
1033
1033
  }
1034
1034
  j(e) {
1035
- e === m ? 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 === m ? void 0 : e;
1043
+ this.element[this.name] = e === g ? void 0 : e;
1044
1044
  }
1045
1045
  }
1046
1046
  class Qt extends Ee {
@@ -1048,17 +1048,17 @@ 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 !== m);
1051
+ this.element.toggleAttribute(this.name, !!e && e !== g);
1052
1052
  }
1053
1053
  }
1054
1054
  class ei extends Ee {
1055
- constructor(e, t, i, n, o) {
1056
- super(e, t, i, n, o), this.type = 5;
1055
+ constructor(e, t, i, s, o) {
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) ?? m) === V) return;
1060
- const i = this._$AH, n = e === m && i !== m || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, o = e !== m && (i === m || n);
1061
- n && this.element.removeEventListener(this.name, this, i), o && this.element.addEventListener(this.name, this, e), this._$AH = e;
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
+ 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) {
1064
1064
  var t;
@@ -1078,21 +1078,21 @@ class ti {
1078
1078
  }
1079
1079
  const Pe = se.litHtmlPolyfillSupport;
1080
1080
  Pe == null || Pe(ae, ue), (se.litHtmlVersions ?? (se.litHtmlVersions = [])).push("3.3.2");
1081
- const ii = (s, e, t) => {
1081
+ const ii = (n, e, t) => {
1082
1082
  const i = (t == null ? void 0 : t.renderBefore) ?? e;
1083
- let n = i._$litPart$;
1084
- if (n === void 0) {
1083
+ let s = i._$litPart$;
1084
+ if (s === void 0) {
1085
1085
  const o = (t == null ? void 0 : t.renderBefore) ?? null;
1086
- i._$litPart$ = n = new ue(e.insertBefore(oe(), o), o, void 0, t ?? {});
1086
+ i._$litPart$ = s = new ue(e.insertBefore(oe(), o), o, void 0, t ?? {});
1087
1087
  }
1088
- return n._$AI(s), n;
1088
+ return s._$AI(n), s;
1089
1089
  };
1090
1090
  /**
1091
1091
  * @license
1092
1092
  * Copyright 2017 Google LLC
1093
1093
  * SPDX-License-Identifier: BSD-3-Clause
1094
1094
  */
1095
- const N = globalThis;
1095
+ const B = globalThis;
1096
1096
  let S = class extends Y {
1097
1097
  constructor() {
1098
1098
  super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
@@ -1119,65 +1119,65 @@ let S = class extends Y {
1119
1119
  }
1120
1120
  };
1121
1121
  var bt;
1122
- S._$litElement$ = !0, S.finalized = !0, (bt = N.litElementHydrateSupport) == null || bt.call(N, { LitElement: S });
1123
- const Ae = N.litElementPolyfillSupport;
1122
+ S._$litElement$ = !0, S.finalized = !0, (bt = B.litElementHydrateSupport) == null || bt.call(B, { LitElement: S });
1123
+ const Ae = B.litElementPolyfillSupport;
1124
1124
  Ae == null || Ae({ LitElement: S });
1125
- (N.litElementVersions ?? (N.litElementVersions = [])).push("4.2.2");
1125
+ (B.litElementVersions ?? (B.litElementVersions = [])).push("4.2.2");
1126
1126
  /**
1127
1127
  * @license
1128
1128
  * Copyright 2017 Google LLC
1129
1129
  * SPDX-License-Identifier: BSD-3-Clause
1130
1130
  */
1131
- const R = (s) => (e, t) => {
1131
+ const R = (n) => (e, t) => {
1132
1132
  t !== void 0 ? t.addInitializer(() => {
1133
- customElements.define(s, e);
1134
- }) : customElements.define(s, e);
1133
+ customElements.define(n, e);
1134
+ }) : customElements.define(n, e);
1135
1135
  };
1136
1136
  /**
1137
1137
  * @license
1138
1138
  * Copyright 2017 Google LLC
1139
1139
  * SPDX-License-Identifier: BSD-3-Clause
1140
1140
  */
1141
- const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged: De }, ni = (s = si, e, t) => {
1142
- const { kind: i, metadata: n } = t;
1143
- let o = globalThis.litPropertyMetadata.get(n);
1144
- if (o === void 0 && globalThis.litPropertyMetadata.set(n, o = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), o.set(t.name, s), i === "accessor") {
1141
+ const si = { attribute: !0, type: String, converter: we, reflect: !1, hasChanged: De }, ni = (n = si, e, t) => {
1142
+ const { kind: i, metadata: s } = t;
1143
+ let o = globalThis.litPropertyMetadata.get(s);
1144
+ if (o === void 0 && globalThis.litPropertyMetadata.set(s, o = /* @__PURE__ */ new Map()), i === "setter" && ((n = Object.create(n)).wrapped = !0), o.set(t.name, n), i === "accessor") {
1145
1145
  const { name: r } = t;
1146
1146
  return { set(l) {
1147
1147
  const a = e.get.call(this);
1148
- e.set.call(this, l), this.requestUpdate(r, a, s, !0, l);
1148
+ e.set.call(this, l), this.requestUpdate(r, a, n, !0, l);
1149
1149
  }, init(l) {
1150
- return l !== void 0 && this.C(r, void 0, s, l), l;
1150
+ return l !== void 0 && this.C(r, void 0, n, l), l;
1151
1151
  } };
1152
1152
  }
1153
1153
  if (i === "setter") {
1154
1154
  const { name: r } = t;
1155
1155
  return function(l) {
1156
1156
  const a = this[r];
1157
- e.call(this, l), this.requestUpdate(r, a, s, !0, l);
1157
+ e.call(this, l), this.requestUpdate(r, a, n, !0, l);
1158
1158
  };
1159
1159
  }
1160
1160
  throw Error("Unsupported decorator location: " + i);
1161
1161
  };
1162
- function b(s) {
1163
- return (e, t) => typeof t == "object" ? ni(s, e, t) : ((i, n, o) => {
1164
- const r = n.hasOwnProperty(o);
1165
- return n.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(n, o) : void 0;
1166
- })(s, e, t);
1162
+ function v(n) {
1163
+ return (e, t) => typeof t == "object" ? ni(n, e, t) : ((i, s, o) => {
1164
+ const r = s.hasOwnProperty(o);
1165
+ return s.constructor.createProperty(o, i), r ? Object.getOwnPropertyDescriptor(s, o) : void 0;
1166
+ })(n, e, t);
1167
1167
  }
1168
1168
  /**
1169
1169
  * @license
1170
1170
  * Copyright 2017 Google LLC
1171
1171
  * SPDX-License-Identifier: BSD-3-Clause
1172
1172
  */
1173
- function x(s) {
1174
- return b({ ...s, 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
- var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (s, e, t, i) => {
1178
- for (var n = i > 1 ? void 0 : i ? ri(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1179
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1180
- return i && n && oi(e, t, n), n;
1177
+ var oi = Object.defineProperty, ri = Object.getOwnPropertyDescriptor, J = (n, e, t, i) => {
1178
+ for (var s = i > 1 ? void 0 : i ? ri(e, t) : e, o = n.length - 1, r; o >= 0; o--)
1179
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1180
+ return i && s && oi(e, t, s), s;
1181
1181
  };
1182
1182
  let q = class extends S {
1183
1183
  constructor() {
@@ -1185,33 +1185,33 @@ let q = class extends S {
1185
1185
  }
1186
1186
  connectedCallback() {
1187
1187
  super.connectedCallback();
1188
- const s = {
1188
+ const n = {
1189
1189
  apiKey: this.apiKey,
1190
1190
  token: this.token,
1191
1191
  room: this.room,
1192
1192
  endpoint: this.endpoint
1193
1193
  };
1194
- this.client = new xt(s), this.client.connect();
1194
+ this.client = new xt(n), this.client.connect();
1195
1195
  }
1196
1196
  disconnectedCallback() {
1197
- var s;
1198
- super.disconnectedCallback(), (s = this.client) == null || s.disconnect();
1197
+ var n;
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
- b({ attribute: "api-key" })
1205
+ v({ attribute: "api-key" })
1206
1206
  ], q.prototype, "apiKey", 2);
1207
1207
  J([
1208
- b()
1208
+ v()
1209
1209
  ], q.prototype, "token", 2);
1210
1210
  J([
1211
- b()
1211
+ v()
1212
1212
  ], q.prototype, "room", 2);
1213
1213
  J([
1214
- b()
1214
+ v()
1215
1215
  ], q.prototype, "endpoint", 2);
1216
1216
  J([
1217
1217
  Mt({ context: Z })
@@ -1219,10 +1219,10 @@ J([
1219
1219
  q = J([
1220
1220
  R("pulse-provider")
1221
1221
  ], q);
1222
- var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (s, e, t, i) => {
1223
- for (var n = i > 1 ? void 0 : i ? li(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1224
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1225
- return i && n && ai(e, t, n), n;
1222
+ var ai = Object.defineProperty, li = Object.getOwnPropertyDescriptor, Ce = (n, e, t, i) => {
1223
+ for (var s = i > 1 ? void 0 : i ? li(e, t) : e, o = n.length - 1, r; o >= 0; o--)
1224
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1225
+ return i && s && ai(e, t, s), s;
1226
1226
  };
1227
1227
  let G = class extends S {
1228
1228
  constructor() {
@@ -1232,33 +1232,33 @@ let G = class extends S {
1232
1232
  super.connectedCallback(), this.setupListener();
1233
1233
  }
1234
1234
  disconnectedCallback() {
1235
- var s;
1236
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1235
+ var n;
1236
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1237
1237
  }
1238
- updated(s) {
1238
+ updated(n) {
1239
1239
  var e;
1240
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1240
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1241
1241
  }
1242
1242
  setupListener() {
1243
- this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (s) => {
1244
- this.users = s;
1243
+ this.client && (this.users = this.client.state.presence, this.unsub = this.client.state.on("presence", (n) => {
1244
+ this.users = n;
1245
1245
  }));
1246
1246
  }
1247
- getInitials(s) {
1248
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1247
+ getInitials(n) {
1248
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1249
1249
  }
1250
1250
  render() {
1251
- const s = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
1252
- return h`
1251
+ const n = this.users.slice(0, this.maxVisible), e = this.users.length - this.maxVisible;
1252
+ return d`
1253
1253
  <div class="avatars">
1254
- ${e > 0 ? h`<div class="overflow">+${e}</div>` : null}
1255
- ${s.map(
1256
- (t) => h`
1254
+ ${e > 0 ? d`<div class="overflow">+${e}</div>` : null}
1255
+ ${n.map(
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 S {
1268
1268
  `;
1269
1269
  }
1270
1270
  };
1271
- G.styles = I`
1271
+ G.styles = M`
1272
1272
  :host {
1273
1273
  display: inline-flex;
1274
1274
  align-items: center;
@@ -1374,31 +1374,31 @@ G.styles = I`
1374
1374
  `;
1375
1375
  Ce([
1376
1376
  pe({ context: Z, subscribe: !0 }),
1377
- b({ attribute: !1 })
1377
+ v({ attribute: !1 })
1378
1378
  ], G.prototype, "client", 2);
1379
1379
  Ce([
1380
- b({ type: Number, attribute: "max-visible" })
1380
+ v({ type: Number, attribute: "max-visible" })
1381
1381
  ], G.prototype, "maxVisible", 2);
1382
1382
  Ce([
1383
- x()
1383
+ w()
1384
1384
  ], G.prototype, "users", 2);
1385
1385
  G = Ce([
1386
1386
  R("pulse-presence")
1387
1387
  ], G);
1388
- var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Be = (s, e, t, i) => {
1389
- for (var n = i > 1 ? void 0 : i ? di(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1390
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1391
- return i && n && ci(e, t, n), n;
1388
+ var ci = Object.defineProperty, di = Object.getOwnPropertyDescriptor, Ne = (n, e, t, i) => {
1389
+ for (var s = i > 1 ? void 0 : i ? di(e, t) : e, o = n.length - 1, r; o >= 0; o--)
1390
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1391
+ return i && s && ci(e, t, s), s;
1392
1392
  };
1393
1393
  let le = class extends S {
1394
1394
  constructor() {
1395
- super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (s) => {
1395
+ super(...arguments), this.cursors = /* @__PURE__ */ new Map(), this.unsubs = [], this.handleLocalCursor = (n) => {
1396
1396
  var e;
1397
1397
  (e = this.client) == null || e.moveCursor({
1398
- x: s.clientX,
1399
- y: s.clientY,
1400
- pageX: s.pageX,
1401
- pageY: s.pageY
1398
+ x: n.clientX,
1399
+ y: n.clientY,
1400
+ pageX: n.pageX,
1401
+ pageY: n.pageY
1402
1402
  });
1403
1403
  };
1404
1404
  }
@@ -1406,25 +1406,25 @@ let le = class extends S {
1406
1406
  super.connectedCallback(), this.setupListeners();
1407
1407
  }
1408
1408
  disconnectedCallback() {
1409
- super.disconnectedCallback(), this.unsubs.forEach((s) => s()), this.unsubs = [], document.removeEventListener("mousemove", this.handleLocalCursor);
1409
+ super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [], document.removeEventListener("mousemove", this.handleLocalCursor);
1410
1410
  }
1411
- updated(s) {
1412
- s.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
1411
+ updated(n) {
1412
+ n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
1413
1413
  }
1414
1414
  setupListeners() {
1415
1415
  this.client && (this.unsubs.push(
1416
1416
  this.client.state.on(
1417
1417
  "cursor",
1418
- ({ userId: s, position: e }) => {
1419
- const t = this.cursors.get(s);
1418
+ ({ userId: n, position: e }) => {
1419
+ const t = this.cursors.get(n);
1420
1420
  if (t)
1421
1421
  t.position = e;
1422
1422
  else {
1423
1423
  const i = this.client.state.presence.find(
1424
- (n) => n.user.id === s
1424
+ (s) => s.user.id === n
1425
1425
  );
1426
- i && this.cursors.set(s, {
1427
- userId: s,
1426
+ i && this.cursors.set(n, {
1427
+ userId: n,
1428
1428
  name: i.user.name,
1429
1429
  color: i.user.color,
1430
1430
  position: e
@@ -1434,8 +1434,8 @@ let le = class extends S {
1434
1434
  }
1435
1435
  )
1436
1436
  ), this.unsubs.push(
1437
- this.client.state.on("presence", (s) => {
1438
- const e = new Set(s.map((t) => t.user.id));
1437
+ this.client.state.on("presence", (n) => {
1438
+ const e = new Set(n.map((t) => t.user.id));
1439
1439
  for (const t of this.cursors.keys())
1440
1440
  e.has(t) || this.cursors.delete(t);
1441
1441
  this.requestUpdate();
@@ -1443,10 +1443,10 @@ let le = class extends S {
1443
1443
  ), document.addEventListener("mousemove", this.handleLocalCursor));
1444
1444
  }
1445
1445
  render() {
1446
- const s = [...this.cursors.values()];
1447
- return h`
1448
- ${s.map(
1449
- (e) => h`
1446
+ const n = [...this.cursors.values()];
1447
+ return d`
1448
+ ${n.map(
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 S {
1467
1467
  `;
1468
1468
  }
1469
1469
  };
1470
- le.styles = I`
1470
+ le.styles = M`
1471
1471
  :host {
1472
1472
  position: fixed;
1473
1473
  top: 0;
@@ -1504,20 +1504,20 @@ le.styles = I`
1504
1504
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
1505
1505
  }
1506
1506
  `;
1507
- Be([
1507
+ Ne([
1508
1508
  pe({ context: Z, subscribe: !0 }),
1509
- b({ attribute: !1 })
1509
+ v({ attribute: !1 })
1510
1510
  ], le.prototype, "client", 2);
1511
- Be([
1512
- x()
1511
+ Ne([
1512
+ w()
1513
1513
  ], le.prototype, "cursors", 2);
1514
- le = Be([
1514
+ le = Ne([
1515
1515
  R("pulse-cursors")
1516
1516
  ], le);
1517
- var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (s, e, t, i) => {
1518
- for (var n = i > 1 ? void 0 : i ? pi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1519
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1520
- return i && n && hi(e, t, n), n;
1517
+ var hi = Object.defineProperty, pi = Object.getOwnPropertyDescriptor, fe = (n, e, t, i) => {
1518
+ for (var s = i > 1 ? void 0 : i ? pi(e, t) : e, o = n.length - 1, r; o >= 0; o--)
1519
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1520
+ return i && s && hi(e, t, s), s;
1521
1521
  };
1522
1522
  let W = class extends S {
1523
1523
  constructor() {
@@ -1527,52 +1527,52 @@ let W = class extends S {
1527
1527
  super.connectedCallback(), this.setupListener();
1528
1528
  }
1529
1529
  disconnectedCallback() {
1530
- var s;
1531
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1530
+ var n;
1531
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1532
1532
  }
1533
- updated(s) {
1533
+ updated(n) {
1534
1534
  var e;
1535
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1535
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1536
1536
  }
1537
1537
  setupListener() {
1538
- this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (s) => {
1539
- this.threads = [...s];
1538
+ this.client && (this.threads = this.client.state.threads, this.unsub = this.client.state.on("threads", (n) => {
1539
+ this.threads = [...n];
1540
1540
  }));
1541
1541
  }
1542
- parseMentions(s) {
1543
- return s.split(/(@\w+)/g).map(
1544
- (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
1542
+ parseMentions(n) {
1543
+ return n.split(/(@\w+)/g).map(
1544
+ (t) => t.startsWith("@") ? d`<span class="mention">${t}</span>` : t
1545
1545
  );
1546
1546
  }
1547
- getInitials(s) {
1548
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1547
+ getInitials(n) {
1548
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
1549
1549
  }
1550
- getUserForComment(s) {
1550
+ getUserForComment(n) {
1551
1551
  var e;
1552
- return (e = this.client.state.presence.find((t) => t.user.id === s)) == null ? void 0 : e.user;
1552
+ return (e = this.client.state.presence.find((t) => t.user.id === n)) == null ? void 0 : e.user;
1553
1553
  }
1554
- handleNewThread(s) {
1555
- s.preventDefault();
1556
- const t = s.target.querySelector("textarea"), i = t.value.trim();
1554
+ handleNewThread(n) {
1555
+ n.preventDefault();
1556
+ const t = n.target.querySelector("textarea"), i = t.value.trim();
1557
1557
  if (!i) return;
1558
- const n = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
1559
- this.client.createThread(i, { mentions: n }), t.value = "";
1558
+ const s = [...i.matchAll(/@(\w+)/g)].map((o) => o[1]);
1559
+ this.client.createThread(i, { mentions: s }), t.value = "";
1560
1560
  }
1561
- handleReply(s, e) {
1561
+ handleReply(n, e) {
1562
1562
  e.preventDefault();
1563
- const i = e.target.querySelector("input"), n = i.value.trim();
1564
- if (!n) return;
1565
- const o = [...n.matchAll(/@(\w+)/g)].map((r) => r[1]);
1566
- this.client.reply(s, n, o), i.value = "", this.replyingTo = null;
1563
+ const i = e.target.querySelector("input"), s = i.value.trim();
1564
+ if (!s) return;
1565
+ const o = [...s.matchAll(/@(\w+)/g)].map((r) => r[1]);
1566
+ this.client.reply(n, s, o), i.value = "", this.replyingTo = null;
1567
1567
  }
1568
1568
  render() {
1569
- const s = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
1570
- return h`
1569
+ const n = this.showResolved ? this.threads : this.threads.filter((e) => !e.resolved);
1570
+ return d`
1571
1571
  <div class="threads">
1572
- ${s.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
- </div>` : s.map((e) => this.renderThread(e))}
1575
+ </div>` : n.map((e) => this.renderThread(e))}
1576
1576
  </div>
1577
1577
  <div class="new-thread">
1578
1578
  <form @submit=${this.handleNewThread}>
@@ -1582,13 +1582,13 @@ let W = class extends S {
1582
1582
  </div>
1583
1583
  `;
1584
1584
  }
1585
- renderThread(s) {
1586
- return h`
1587
- <div class="thread ${s.resolved ? "resolved" : ""}">
1588
- ${s.comments.map((e, t) => {
1585
+ renderThread(n) {
1586
+ return d`
1587
+ <div class="thread ${n.resolved ? "resolved" : ""}">
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>` : m}
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
@@ -1610,34 +1610,34 @@ let W = class extends S {
1610
1610
  })}
1611
1611
  <div class="thread-actions">
1612
1612
  <button
1613
- @click=${() => this.replyingTo = this.replyingTo === s.id ? null : s.id}
1613
+ @click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
1614
1614
  >
1615
1615
  Reply
1616
1616
  </button>
1617
1617
  <button
1618
- @click=${() => this.client.resolveThread(s.id, !s.resolved)}
1618
+ @click=${() => this.client.resolveThread(n.id, !n.resolved)}
1619
1619
  >
1620
- ${s.resolved ? "Reopen" : "Resolve"}
1620
+ ${n.resolved ? "Reopen" : "Resolve"}
1621
1621
  </button>
1622
1622
  </div>
1623
- ${this.replyingTo === s.id ? h`
1624
- <form class="reply-form" @submit=${(e) => this.handleReply(s.id, e)}>
1623
+ ${this.replyingTo === n.id ? d`
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
- ` : m}
1628
+ ` : g}
1629
1629
  </div>
1630
1630
  `;
1631
1631
  }
1632
- formatTime(s) {
1633
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1634
- if (n < 1) return "just now";
1635
- if (n < 60) return `${n}m ago`;
1636
- const o = Math.floor(n / 60);
1632
+ formatTime(n) {
1633
+ const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
1634
+ if (s < 1) return "just now";
1635
+ if (s < 60) return `${s}m ago`;
1636
+ const o = Math.floor(s / 60);
1637
1637
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1638
1638
  }
1639
1639
  };
1640
- W.styles = I`
1640
+ W.styles = M`
1641
1641
  :host {
1642
1642
  display: block;
1643
1643
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -1851,24 +1851,24 @@ W.styles = I`
1851
1851
  `;
1852
1852
  fe([
1853
1853
  pe({ context: Z, subscribe: !0 }),
1854
- b({ attribute: !1 })
1854
+ v({ attribute: !1 })
1855
1855
  ], W.prototype, "client", 2);
1856
1856
  fe([
1857
- b({ type: Boolean, attribute: "show-resolved" })
1857
+ v({ type: Boolean, attribute: "show-resolved" })
1858
1858
  ], W.prototype, "showResolved", 2);
1859
1859
  fe([
1860
- x()
1860
+ w()
1861
1861
  ], W.prototype, "threads", 2);
1862
1862
  fe([
1863
- x()
1863
+ w()
1864
1864
  ], W.prototype, "replyingTo", 2);
1865
1865
  W = fe([
1866
1866
  R("pulse-comments")
1867
1867
  ], W);
1868
- var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Ne = (s, e, t, i) => {
1869
- for (var n = i > 1 ? void 0 : i ? fi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
1870
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
1871
- return i && n && ui(e, t, n), n;
1868
+ var ui = Object.defineProperty, fi = Object.getOwnPropertyDescriptor, Be = (n, e, t, i) => {
1869
+ for (var s = i > 1 ? void 0 : i ? fi(e, t) : e, o = n.length - 1, r; o >= 0; o--)
1870
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
1871
+ return i && s && ui(e, t, s), s;
1872
1872
  };
1873
1873
  const mi = {
1874
1874
  "comment:created": "left a comment",
@@ -1891,61 +1891,61 @@ let ce = class extends S {
1891
1891
  super.connectedCallback(), this.setupListener();
1892
1892
  }
1893
1893
  disconnectedCallback() {
1894
- var s;
1895
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
1894
+ var n;
1895
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
1896
1896
  }
1897
- updated(s) {
1897
+ updated(n) {
1898
1898
  var e;
1899
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1899
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
1900
1900
  }
1901
1901
  setupListener() {
1902
1902
  this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
1903
1903
  "notifications",
1904
- (s) => {
1905
- this.notifications = [...s];
1904
+ (n) => {
1905
+ this.notifications = [...n];
1906
1906
  }
1907
1907
  ));
1908
1908
  }
1909
- handleClick(s) {
1910
- s.read || this.client.markRead(s.id), this.dispatchEvent(
1909
+ handleClick(n) {
1910
+ n.read || this.client.markRead(n.id), this.dispatchEvent(
1911
1911
  new CustomEvent("pulse-notification-click", {
1912
- detail: s,
1912
+ detail: n,
1913
1913
  bubbles: !0,
1914
1914
  composed: !0
1915
1915
  })
1916
1916
  );
1917
1917
  }
1918
- getActorName(s) {
1918
+ getActorName(n) {
1919
1919
  const e = this.client.state.presence.find(
1920
- (t) => t.user.id === s
1920
+ (t) => t.user.id === n
1921
1921
  );
1922
1922
  return (e == null ? void 0 : e.user.name) ?? "Someone";
1923
1923
  }
1924
- formatTime(s) {
1925
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
1926
- if (n < 1) return "just now";
1927
- if (n < 60) return `${n}m ago`;
1928
- const o = Math.floor(n / 60);
1924
+ formatTime(n) {
1925
+ const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
1926
+ if (s < 1) return "just now";
1927
+ if (s < 60) return `${s}m ago`;
1928
+ const o = Math.floor(s / 60);
1929
1929
  return o < 24 ? `${o}h ago` : e.toLocaleDateString();
1930
1930
  }
1931
1931
  render() {
1932
- const s = this.notifications.filter((e) => !e.read).length;
1933
- return h`
1932
+ const n = this.notifications.filter((e) => !e.read).length;
1933
+ return d`
1934
1934
  <div class="header">
1935
1935
  <span class="title">
1936
1936
  Notifications
1937
- ${s > 0 ? h`<span class="badge">${s}</span>` : m}
1937
+ ${n > 0 ? d`<span class="badge">${n}</span>` : g}
1938
1938
  </span>
1939
- ${s > 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>` : m}
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 S {
1966
1966
  `;
1967
1967
  }
1968
1968
  };
1969
- ce.styles = I`
1969
+ ce.styles = M`
1970
1970
  :host {
1971
1971
  display: block;
1972
1972
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
@@ -2107,20 +2107,20 @@ ce.styles = I`
2107
2107
  opacity: 0.4;
2108
2108
  }
2109
2109
  `;
2110
- Ne([
2110
+ Be([
2111
2111
  pe({ context: Z, subscribe: !0 }),
2112
- b({ attribute: !1 })
2112
+ v({ attribute: !1 })
2113
2113
  ], ce.prototype, "client", 2);
2114
- Ne([
2115
- x()
2114
+ Be([
2115
+ w()
2116
2116
  ], ce.prototype, "notifications", 2);
2117
- ce = Ne([
2117
+ ce = Be([
2118
2118
  R("pulse-notifications")
2119
2119
  ], ce);
2120
- var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (s, e, t, i) => {
2121
- for (var n = i > 1 ? void 0 : i ? vi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2122
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2123
- return i && n && bi(e, t, n), n;
2120
+ var bi = Object.defineProperty, vi = Object.getOwnPropertyDescriptor, Q = (n, e, t, i) => {
2121
+ for (var s = i > 1 ? void 0 : i ? vi(e, t) : e, o = n.length - 1, r; o >= 0; o--)
2122
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
2123
+ return i && s && bi(e, t, s), s;
2124
2124
  };
2125
2125
  const xi = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
2126
2126
  let D = class extends S {
@@ -2131,41 +2131,41 @@ let D = class extends S {
2131
2131
  super.connectedCallback(), this.setupListener();
2132
2132
  }
2133
2133
  disconnectedCallback() {
2134
- var s;
2135
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
2134
+ var n;
2135
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
2136
2136
  }
2137
- updated(s) {
2137
+ updated(n) {
2138
2138
  var e;
2139
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
2139
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
2140
2140
  }
2141
2141
  setupListener() {
2142
- this.client && (this.reactions = this.client.state.getReactions(this.targetId), this.unsub = this.client.state.on("reactions", (s) => {
2143
- s.targetId === this.targetId && (this.reactions = [...s.reactions]);
2142
+ this.client && (this.reactions = this.client.state.getReactions(this.targetId), this.unsub = this.client.state.on("reactions", (n) => {
2143
+ n.targetId === this.targetId && (this.reactions = [...n.reactions]);
2144
2144
  }));
2145
2145
  }
2146
2146
  groupReactions() {
2147
2147
  var t, i;
2148
- const s = /* @__PURE__ */ new Map(), e = (i = (t = this.client) == null ? void 0 : t.state.user) == null ? void 0 : i.id;
2149
- for (const n of this.reactions) {
2150
- const o = s.get(n.emoji) ?? { count: 0, userReactionId: null };
2151
- o.count++, n.userId === e && (o.userReactionId = n.id), s.set(n.emoji, o);
2148
+ const n = /* @__PURE__ */ new Map(), e = (i = (t = this.client) == null ? void 0 : t.state.user) == null ? void 0 : i.id;
2149
+ for (const s of this.reactions) {
2150
+ const o = n.get(s.emoji) ?? { count: 0, userReactionId: null };
2151
+ o.count++, s.userId === e && (o.userReactionId = s.id), n.set(s.emoji, o);
2152
2152
  }
2153
- return [...s.entries()].map(([n, o]) => ({
2154
- emoji: n,
2153
+ return [...n.entries()].map(([s, o]) => ({
2154
+ emoji: s,
2155
2155
  ...o
2156
2156
  }));
2157
2157
  }
2158
- toggleReaction(s) {
2159
- s.userReactionId ? this.client.removeReaction(s.userReactionId) : this.client.addReaction(this.targetId, this.targetType, s.emoji);
2158
+ toggleReaction(n) {
2159
+ n.userReactionId ? this.client.removeReaction(n.userReactionId) : this.client.addReaction(this.targetId, this.targetType, n.emoji);
2160
2160
  }
2161
- addEmoji(s) {
2162
- this.client.addReaction(this.targetId, this.targetType, s), this.showPicker = !1;
2161
+ addEmoji(n) {
2162
+ this.client.addReaction(this.targetId, this.targetType, n), this.showPicker = !1;
2163
2163
  }
2164
2164
  render() {
2165
- const s = this.groupReactions();
2166
- return h`
2167
- ${s.map(
2168
- (e) => h`
2165
+ const n = this.groupReactions();
2166
+ return d`
2167
+ ${n.map(
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 S {
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
- ` : m}
2195
+ ` : g}
2196
2196
  </div>
2197
2197
  `;
2198
2198
  }
2199
2199
  };
2200
- D.styles = I`
2200
+ D.styles = M`
2201
2201
  :host {
2202
2202
  display: inline-flex;
2203
2203
  align-items: center;
@@ -2311,19 +2311,19 @@ D.styles = I`
2311
2311
  `;
2312
2312
  Q([
2313
2313
  pe({ context: Z, subscribe: !0 }),
2314
- b({ attribute: !1 })
2314
+ v({ attribute: !1 })
2315
2315
  ], D.prototype, "client", 2);
2316
2316
  Q([
2317
- b({ attribute: "target-id" })
2317
+ v({ attribute: "target-id" })
2318
2318
  ], D.prototype, "targetId", 2);
2319
2319
  Q([
2320
- b({ attribute: "target-type" })
2320
+ v({ attribute: "target-type" })
2321
2321
  ], D.prototype, "targetType", 2);
2322
2322
  Q([
2323
- x()
2323
+ w()
2324
2324
  ], D.prototype, "reactions", 2);
2325
2325
  Q([
2326
- x()
2326
+ w()
2327
2327
  ], D.prototype, "showPicker", 2);
2328
2328
  D = Q([
2329
2329
  R("pulse-reactions")
@@ -2333,7 +2333,7 @@ D = Q([
2333
2333
  * Copyright 2017 Google LLC
2334
2334
  * SPDX-License-Identifier: BSD-3-Clause
2335
2335
  */
2336
- const yi = { CHILD: 2 }, wi = (s) => (...e) => ({ _$litDirective$: s, values: e });
2336
+ const yi = { CHILD: 2 }, wi = (n) => (...e) => ({ _$litDirective$: n, values: e });
2337
2337
  class $i {
2338
2338
  constructor(e) {
2339
2339
  }
@@ -2357,10 +2357,10 @@ class $i {
2357
2357
  */
2358
2358
  class Ie extends $i {
2359
2359
  constructor(e) {
2360
- if (super(e), this.it = m, 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 === m || 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;
@@ -2557,13 +2557,13 @@ const Ri = [
2557
2557
  }
2558
2558
  ]
2559
2559
  ];
2560
- function Li(s) {
2561
- return s.map(([e, t]) => {
2562
- const i = Object.entries(t).filter(([, n]) => n != null).map(([n, o]) => `${n}="${o}"`).join(" ");
2560
+ function Li(n) {
2561
+ return n.map(([e, t]) => {
2562
+ const i = Object.entries(t).filter(([, s]) => s != null).map(([s, o]) => `${s}="${o}"`).join(" ");
2563
2563
  return `<${e} ${i}/>`;
2564
2564
  }).join("");
2565
2565
  }
2566
- function C(s, 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}"
@@ -2574,9 +2574,9 @@ function C(s, e = 18) {
2574
2574
  stroke-width="2"
2575
2575
  stroke-linecap="round"
2576
2576
  stroke-linejoin="round"
2577
- >${ki(Li(s))}</svg>`;
2577
+ >${ki(Li(n))}</svg>`;
2578
2578
  }
2579
- const ee = I`
2579
+ const ee = M`
2580
2580
  * {
2581
2581
  box-sizing: border-box;
2582
2582
  margin: 0;
@@ -2619,7 +2619,7 @@ const ee = I`
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 = I`
2622
+ `, ge = M`
2623
2623
  .pw-btn {
2624
2624
  display: inline-flex;
2625
2625
  align-items: center;
@@ -2663,7 +2663,7 @@ const ee = I`
2663
2663
  width: 18px;
2664
2664
  height: 18px;
2665
2665
  }
2666
- `, _e = I`
2666
+ `, _e = M`
2667
2667
  .pw-scrollable::-webkit-scrollbar {
2668
2668
  width: 4px;
2669
2669
  }
@@ -2675,10 +2675,10 @@ const ee = I`
2675
2675
  background: transparent;
2676
2676
  }
2677
2677
  `;
2678
- var ji = Object.defineProperty, zi = Object.getOwnPropertyDescriptor, Fe = (s, e, t, i) => {
2679
- for (var n = i > 1 ? void 0 : i ? zi(e, t) : e, o = s.length - 1, r; o >= 0; o--)
2680
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
2681
- return i && n && ji(e, t, n), n;
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
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
2681
+ return i && s && ji(e, t, s), s;
2682
2682
  };
2683
2683
  let X = class extends S {
2684
2684
  constructor() {
@@ -2688,36 +2688,36 @@ let X = class extends S {
2688
2688
  super.connectedCallback(), this.setupListeners();
2689
2689
  }
2690
2690
  disconnectedCallback() {
2691
- super.disconnectedCallback(), this.unsubs.forEach((s) => s()), this.unsubs = [];
2691
+ super.disconnectedCallback(), this.unsubs.forEach((n) => n()), this.unsubs = [];
2692
2692
  }
2693
- updated(s) {
2694
- s.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
2693
+ updated(n) {
2694
+ n.has("client") && this.client && (this.unsubs.forEach((e) => e()), this.unsubs = [], this.setupListeners());
2695
2695
  }
2696
2696
  setupListeners() {
2697
2697
  if (!this.client) return;
2698
- const s = this.client.state.activityLogs;
2699
- s.length > 0 && (this.items = s.map((e) => this.logToItem(e)), this.counter = this.items.length), this.unsubs.push(
2698
+ const n = this.client.state.activityLogs;
2699
+ n.length > 0 && (this.items = n.map((e) => this.logToItem(e)), this.counter = this.items.length), this.unsubs.push(
2700
2700
  this.client.state.on("activity-logs", (e) => {
2701
2701
  this.items = e.map((t) => this.logToItem(t));
2702
2702
  })
2703
2703
  );
2704
2704
  }
2705
- logToItem(s) {
2705
+ logToItem(n) {
2706
2706
  return {
2707
- id: s.id,
2708
- type: s.type,
2709
- userId: s.userId,
2710
- description: s.description,
2711
- timestamp: new Date(s.createdAt).getTime(),
2712
- color: X.TYPE_COLORS[s.type] ?? "#94a3b8"
2707
+ id: n.id,
2708
+ type: n.type,
2709
+ userId: n.userId,
2710
+ description: n.description,
2711
+ timestamp: new Date(n.createdAt).getTime(),
2712
+ color: X.TYPE_COLORS[n.type] ?? "#94a3b8"
2713
2713
  };
2714
2714
  }
2715
- getUserName(s) {
2715
+ getUserName(n) {
2716
2716
  var e;
2717
- return ((e = this.client.state.getUser(s)) == null ? void 0 : e.name) ?? "Someone";
2717
+ return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
2718
2718
  }
2719
- formatRelativeTime(s) {
2720
- const e = Math.floor((Date.now() - s) / 1e3);
2719
+ formatRelativeTime(n) {
2720
+ const e = Math.floor((Date.now() - n) / 1e3);
2721
2721
  return e < 5 ? "just now" : e < 60 ? `${e}s ago` : e < 3600 ? `${Math.floor(e / 60)}m ago` : `${Math.floor(e / 3600)}h ago`;
2722
2722
  }
2723
2723
  fireClose() {
@@ -2726,7 +2726,7 @@ let X = class extends S {
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>
@@ -2736,22 +2736,22 @@ let X = class extends S {
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
- (s) => 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"
2744
- style="background:${s.color}"
2744
+ style="background:${n.color}"
2745
2745
  ></div>
2746
2746
  <div class="activity-content">
2747
2747
  <div class="activity-text">
2748
- ${s.userId ? h`<span class="activity-user"
2749
- >${this.getUserName(s.userId)}</span
2748
+ ${n.userId ? d`<span class="activity-user"
2749
+ >${this.getUserName(n.userId)}</span
2750
2750
  >
2751
- ${s.description}` : s.description}
2751
+ ${n.description}` : n.description}
2752
2752
  </div>
2753
2753
  <div class="activity-time">
2754
- ${this.formatRelativeTime(s.timestamp)}
2754
+ ${this.formatRelativeTime(n.timestamp)}
2755
2755
  </div>
2756
2756
  </div>
2757
2757
  </div>
@@ -2766,7 +2766,7 @@ X.styles = [
2766
2766
  ee,
2767
2767
  ge,
2768
2768
  _e,
2769
- I`
2769
+ M`
2770
2770
  :host {
2771
2771
  display: block;
2772
2772
  }
@@ -2892,17 +2892,17 @@ X.TYPE_COLORS = {
2892
2892
  resolve: "#22c55e"
2893
2893
  };
2894
2894
  Fe([
2895
- b({ attribute: !1 })
2895
+ v({ attribute: !1 })
2896
2896
  ], X.prototype, "client", 2);
2897
2897
  Fe([
2898
- x()
2898
+ w()
2899
2899
  ], X.prototype, "items", 2);
2900
2900
  X = Fe([
2901
2901
  R("pulse-widget-activity-panel")
2902
2902
  ], X);
2903
- const Ui = "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif", ot = "#6366f1", rt = "#e2e8f0", Di = "#f8fafc", Hi = "#e2e8f0", at = "#64748b", xe = 28, Bi = Array.from({ length: xe }, (s, e) => 0.2 + Math.abs(Math.sin(e * 12.9898 + 78.233) * 43758.5453) % 1 * 0.8);
2904
- function lt(s) {
2905
- const e = Math.max(0, Math.floor(s)), t = Math.floor(e / 60), i = e % 60;
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
+ function lt(n) {
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")}`;
2907
2907
  }
2908
2908
  class Oe {
@@ -2915,7 +2915,7 @@ class Oe {
2915
2915
  * element once metadata has loaded.
2916
2916
  */
2917
2917
  static render(e, t) {
2918
- let i = !1, n = t != null ? t / 1e3 : 0, o = 0;
2918
+ let i = !1, s = t != null ? t / 1e3 : 0, o = 0;
2919
2919
  const r = document.createElement("audio");
2920
2920
  r.preload = "metadata", r.src = e;
2921
2921
  const l = document.createElement("div");
@@ -2958,20 +2958,20 @@ 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);
2973
- const f = document.createElement("div");
2974
- Object.assign(f.style, {
2972
+ h(), a.appendChild(c);
2973
+ const u = document.createElement("div");
2974
+ Object.assign(u.style, {
2975
2975
  flex: "1",
2976
2976
  display: "flex",
2977
2977
  flexDirection: "column",
@@ -2979,65 +2979,65 @@ class Oe {
2979
2979
  overflow: "hidden",
2980
2980
  minWidth: "0"
2981
2981
  });
2982
- const u = document.createElement("div");
2983
- Object.assign(u.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 g = [];
2990
+ const m = [];
2991
2991
  for (let E = 0; E < xe; E++) {
2992
- const A = document.createElement("div"), k = Math.round(Bi[E] * 20);
2993
- Object.assign(A.style, {
2992
+ const I = document.createElement("div"), k = Math.round(Ni[E] * 20);
2993
+ Object.assign(I.style, {
2994
2994
  flex: "1",
2995
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
- }), g.push(A), u.appendChild(A);
3000
+ }), m.push(I), f.appendChild(I);
3001
3001
  }
3002
- const v = document.createElement("div");
3003
- Object.assign(v.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 $() {
3010
- const E = lt(o), A = lt(n);
3011
- v.textContent = `${E} / ${A}`;
3009
+ function b() {
3010
+ const E = lt(o), I = lt(s);
3011
+ x.textContent = `${E} / ${I}`;
3012
3012
  }
3013
- $(), f.appendChild(u), f.appendChild(v), l.appendChild(a), l.appendChild(f);
3013
+ b(), u.appendChild(f), u.appendChild(x), l.appendChild(a), l.appendChild(u);
3014
3014
  function y() {
3015
- const E = n > 0 ? o / n : 0, A = Math.floor(E * xe);
3015
+ const E = s > 0 ? o / s : 0, I = Math.floor(E * xe);
3016
3016
  for (let k = 0; k < xe; k++)
3017
- g[k].style.background = k <= A ? ot : rt;
3017
+ m[k].style.background = k <= I ? ot : rt;
3018
3018
  }
3019
- return u.addEventListener("click", (E) => {
3020
- if (n <= 0) return;
3021
- const A = u.getBoundingClientRect(), k = Math.min(
3019
+ return f.addEventListener("click", (E) => {
3020
+ if (s <= 0) return;
3021
+ const I = f.getBoundingClientRect(), k = Math.min(
3022
3022
  1,
3023
- Math.max(0, (E.clientX - A.left) / A.width)
3023
+ Math.max(0, (E.clientX - I.left) / I.width)
3024
3024
  );
3025
- r.currentTime = k * n, o = r.currentTime, y(), $();
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, y(), $();
3034
+ i = !1, h(), o = 0, y(), b();
3035
3035
  }), r.addEventListener("timeupdate", () => {
3036
- o = r.currentTime, y(), $();
3036
+ o = r.currentTime, y(), b();
3037
3037
  }), r.addEventListener("loadedmetadata", () => {
3038
- r.duration && isFinite(r.duration) && (n = r.duration, $());
3038
+ r.duration && isFinite(r.duration) && (s = r.duration, b());
3039
3039
  }), r.addEventListener("durationchange", () => {
3040
- r.duration && isFinite(r.duration) && (n = r.duration, $());
3040
+ r.duration && isFinite(r.duration) && (s = r.duration, b());
3041
3041
  }), l;
3042
3042
  }
3043
3043
  }
@@ -3055,8 +3055,8 @@ class Re {
3055
3055
  this.destroy(), this.stream = await navigator.mediaDevices.getUserMedia({ audio: !0 }), this.audioCtx = new AudioContext();
3056
3056
  const t = this.audioCtx.createMediaStreamSource(this.stream);
3057
3057
  this.analyser = this.audioCtx.createAnalyser(), this.analyser.fftSize = 64, t.connect(this.analyser);
3058
- const i = this.detectMimeType(), n = {};
3059
- i && (n.mimeType = i), this.recorder = new MediaRecorder(this.stream, n);
3058
+ const i = this.detectMimeType(), s = {};
3059
+ i && (s.mimeType = i), this.recorder = new MediaRecorder(this.stream, s);
3060
3060
  const o = [];
3061
3061
  this.recorder.ondataavailable = (l) => {
3062
3062
  l.data.size > 0 && o.push(l.data);
@@ -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;
@@ -3168,18 +3168,18 @@ class Re {
3168
3168
  if (!this.canvas || !this.analyser) return;
3169
3169
  const e = this.canvas.getContext("2d");
3170
3170
  if (!e) return;
3171
- const t = this.canvas.width, i = this.canvas.height, n = this.analyser.frequencyBinCount, o = new Uint8Array(n);
3171
+ const t = this.canvas.width, i = this.canvas.height, s = this.analyser.frequencyBinCount, o = new Uint8Array(s);
3172
3172
  this.analyser.getByteFrequencyData(o), e.clearRect(0, 0, t, i);
3173
- const r = n, l = Math.max(2, t / r * 0.7), a = (t - l * r) / (r - 1 || 1);
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), f = c * (l + a), u = (i - d) / 2, g = 0.4 + p * 0.6;
3176
- e.fillStyle = `rgba(99, 102, 241, ${g})`, e.beginPath(), e.roundRect(f, u, 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() {
3180
3180
  if (!this.timerEl) return;
3181
- const e = Date.now() - this.startTime, t = Math.floor(e / 1e3), i = Math.floor(t / 60), n = t % 60;
3182
- this.timerEl.textContent = `${String(i).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
3181
+ const e = Date.now() - this.startTime, t = Math.floor(e / 1e3), i = Math.floor(t / 60), s = t % 60;
3182
+ this.timerEl.textContent = `${String(i).padStart(2, "0")}:${String(s).padStart(2, "0")}`;
3183
3183
  }
3184
3184
  cleanupResources() {
3185
3185
  if (this.animFrame !== null && (cancelAnimationFrame(this.animFrame), this.animFrame = null), this.maxTimer !== null && (clearTimeout(this.maxTimer), this.maxTimer = null), this.audioCtx && (this.audioCtx.close().catch(() => {
@@ -3191,7 +3191,7 @@ class Re {
3191
3191
  this.recorder = null, this.container && (this.container.remove(), this.container = null), this.canvas = null, this.timerEl = null;
3192
3192
  }
3193
3193
  }
3194
- const ct = 80, Ni = "#e2e8f0", Fi = `
3194
+ const ct = 80, Bi = "#e2e8f0", Fi = `
3195
3195
  <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
3196
3196
  <circle cx="14" cy="14" r="14" fill="rgba(0,0,0,0.35)"/>
3197
3197
  <polygon points="11,8 22,14 11,20" fill="rgba(255,255,255,0.9)"/>
@@ -3213,7 +3213,7 @@ class Tt {
3213
3213
  * @param posterUrl - Optional poster/thumbnail image URL
3214
3214
  */
3215
3215
  static render(e, t) {
3216
- let i = !1, n = !0;
3216
+ let i = !1, s = !0;
3217
3217
  const o = document.createElement("div");
3218
3218
  Object.assign(o.style, {
3219
3219
  position: "relative",
@@ -3221,7 +3221,7 @@ class Tt {
3221
3221
  width: `${ct}px`,
3222
3222
  height: `${ct}px`,
3223
3223
  borderRadius: "50%",
3224
- border: `2px solid ${Ni}`,
3224
+ border: `2px solid ${Bi}`,
3225
3225
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
3226
3226
  overflow: "hidden",
3227
3227
  cursor: "pointer",
@@ -3270,14 +3270,14 @@ class Tt {
3270
3270
  function c() {
3271
3271
  l.style.opacity = i ? "0" : "1";
3272
3272
  }
3273
- function p() {
3274
- a.style.display = i ? "flex" : "none", a.innerHTML = n ? dt : Vi;
3273
+ function h() {
3274
+ a.style.display = i ? "flex" : "none", a.innerHTML = s ? dt : Vi;
3275
3275
  }
3276
- return o.addEventListener("click", (d) => {
3277
- d.stopPropagation(), i ? n ? (r.muted = !1, n = !1) : (r.pause(), i = !1, n = !0, r.muted = !0) : (r.muted = !0, n = !0, r.play().catch(() => {
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, n = !0, r.muted = !0, c(), p());
3280
+ i && (i = !1, s = !0, r.muted = !0, c(), h());
3281
3281
  }), o;
3282
3282
  }
3283
3283
  }
@@ -3388,41 +3388,41 @@ const ht = 60, qi = `
3388
3388
  color: #0f172a;
3389
3389
  }
3390
3390
  `;
3391
- function pt(s) {
3392
- return s.toString().padStart(2, "0");
3391
+ function pt(n) {
3392
+ return n.toString().padStart(2, "0");
3393
3393
  }
3394
- function Wi(s) {
3395
- const e = Math.floor(s / 60), t = s % 60;
3394
+ function Wi(n) {
3395
+ const e = Math.floor(n / 60), t = n % 60;
3396
3396
  return `${pt(e)}:${pt(t)}`;
3397
3397
  }
3398
3398
  function Xi() {
3399
- const s = [
3399
+ const n = [
3400
3400
  "video/webm;codecs=vp9,opus",
3401
3401
  "video/webm;codecs=vp8,opus",
3402
3402
  "video/webm",
3403
3403
  "video/mp4"
3404
3404
  ];
3405
- for (const e of s)
3405
+ for (const e of n)
3406
3406
  if (MediaRecorder.isTypeSupported(e)) return e;
3407
3407
  return "";
3408
3408
  }
3409
- function Yi(s) {
3409
+ function Yi(n) {
3410
3410
  return new Promise((e, t) => {
3411
- const i = URL.createObjectURL(s), n = document.createElement("video");
3412
- n.muted = !0, n.playsInline = !0, n.preload = "auto", n.src = i, n.addEventListener("loadeddata", () => {
3413
- n.currentTime = 0.01;
3414
- }), n.addEventListener("seeked", () => {
3411
+ const i = URL.createObjectURL(n), s = document.createElement("video");
3412
+ s.muted = !0, s.playsInline = !0, s.preload = "auto", s.src = i, s.addEventListener("loadeddata", () => {
3413
+ s.currentTime = 0.01;
3414
+ }), s.addEventListener("seeked", () => {
3415
3415
  const o = document.createElement("canvas");
3416
- o.width = n.videoWidth || 240, o.height = n.videoHeight || 240, o.getContext("2d").drawImage(n, 0, 0, o.width, o.height), URL.revokeObjectURL(i), o.toBlob(
3416
+ o.width = s.videoWidth || 240, o.height = s.videoHeight || 240, o.getContext("2d").drawImage(s, 0, 0, o.width, o.height), URL.revokeObjectURL(i), o.toBlob(
3417
3417
  (l) => {
3418
3418
  l ? e(l) : t(new Error("Failed to generate poster frame"));
3419
3419
  },
3420
3420
  "image/jpeg",
3421
3421
  0.85
3422
3422
  );
3423
- }), n.addEventListener("error", () => {
3423
+ }), s.addEventListener("error", () => {
3424
3424
  URL.revokeObjectURL(i), t(new Error("Failed to load video for poster generation"));
3425
- }), n.load();
3425
+ }), s.load();
3426
3426
  });
3427
3427
  }
3428
3428
  class Le {
@@ -3442,9 +3442,9 @@ class Le {
3442
3442
  }
3443
3443
  this.stream = t, this.container = e, this.recording = !0, this.elapsed = 0, this.chunks = [], this.buildUI(e), this.videoEl && (this.videoEl.srcObject = t, this.videoEl.play().catch(() => {
3444
3444
  }));
3445
- const i = Xi(), n = {};
3446
- i && (n.mimeType = i);
3447
- const o = new MediaRecorder(t, n);
3445
+ const i = Xi(), s = {};
3446
+ i && (s.mimeType = i);
3447
+ const o = new MediaRecorder(t, s);
3448
3448
  return this.mediaRecorder = o, o.ondataavailable = (r) => {
3449
3449
  r.data.size > 0 && this.chunks.push(r.data);
3450
3450
  }, o.onstop = () => {
@@ -3472,8 +3472,8 @@ class Le {
3472
3472
  t.className = "vr-circle-wrapper";
3473
3473
  const i = document.createElement("div");
3474
3474
  i.className = "vr-ring", t.appendChild(i);
3475
- const n = document.createElement("div");
3476
- n.className = "vr-video-circle", this.videoEl = document.createElement("video"), this.videoEl.muted = !0, this.videoEl.playsInline = !0, this.videoEl.setAttribute("playsinline", ""), n.appendChild(this.videoEl), t.appendChild(n), this.root.appendChild(t), this.timerEl = document.createElement("span"), this.timerEl.className = "vr-timer", this.timerEl.textContent = "00:00", this.root.appendChild(this.timerEl);
3475
+ const s = document.createElement("div");
3476
+ s.className = "vr-video-circle", this.videoEl = document.createElement("video"), this.videoEl.muted = !0, this.videoEl.playsInline = !0, this.videoEl.setAttribute("playsinline", ""), s.appendChild(this.videoEl), t.appendChild(s), this.root.appendChild(t), this.timerEl = document.createElement("span"), this.timerEl.className = "vr-timer", this.timerEl.textContent = "00:00", this.root.appendChild(this.timerEl);
3477
3477
  const o = document.createElement("div");
3478
3478
  o.className = "vr-actions";
3479
3479
  const r = document.createElement("button");
@@ -3487,8 +3487,8 @@ class Le {
3487
3487
  this.timerEl.textContent = Wi(this.elapsed), e <= 10 ? this.timerEl.classList.add("vr-countdown") : this.timerEl.classList.remove("vr-countdown");
3488
3488
  }
3489
3489
  async handleRecordingComplete() {
3490
- var n, o;
3491
- const e = ((n = this.mediaRecorder) == null ? void 0 : n.mimeType) || "video/webm", t = new Blob(this.chunks, { type: e });
3490
+ var s, o;
3491
+ const e = ((s = this.mediaRecorder) == null ? void 0 : s.mimeType) || "video/webm", t = new Blob(this.chunks, { type: e });
3492
3492
  let i;
3493
3493
  try {
3494
3494
  i = await Yi(t);
@@ -3563,17 +3563,17 @@ const T = class T {
3563
3563
  }), i.addEventListener("click", (r) => {
3564
3564
  r.stopPropagation(), T.close();
3565
3565
  });
3566
- const n = document.createElement("img");
3567
- n.src = e, n.alt = "Lightbox image", Object.assign(n.style, {
3566
+ const s = document.createElement("img");
3567
+ s.src = e, s.alt = "Lightbox image", Object.assign(s.style, {
3568
3568
  maxWidth: "90vw",
3569
3569
  maxHeight: "90vh",
3570
3570
  borderRadius: "8px",
3571
3571
  objectFit: "contain",
3572
3572
  cursor: "default",
3573
3573
  userSelect: "none"
3574
- }), n.addEventListener("click", (r) => {
3574
+ }), s.addEventListener("click", (r) => {
3575
3575
  r.stopPropagation();
3576
- }), t.appendChild(i), t.appendChild(n), t.addEventListener("click", () => {
3576
+ }), t.appendChild(i), t.appendChild(s), t.addEventListener("click", () => {
3577
3577
  T.close();
3578
3578
  });
3579
3579
  const o = (r) => {
@@ -3607,7 +3607,7 @@ class ne {
3607
3607
  this.input.accept = e, this.input.value = "";
3608
3608
  const i = () => {
3609
3609
  o(), t(null);
3610
- }, n = async () => {
3610
+ }, s = async () => {
3611
3611
  var l;
3612
3612
  o();
3613
3613
  const r = (l = this.input.files) == null ? void 0 : l[0];
@@ -3625,9 +3625,47 @@ class ne {
3625
3625
  this.uploading = !1;
3626
3626
  }
3627
3627
  }, o = () => {
3628
- this.input.removeEventListener("change", n), this.input.removeEventListener("cancel", i);
3628
+ this.input.removeEventListener("change", s), this.input.removeEventListener("cancel", i);
3629
3629
  };
3630
- this.input.addEventListener("change", n, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
3630
+ this.input.addEventListener("change", s, { once: !0 }), this.input.addEventListener("cancel", i, { once: !0 }), this.input.click();
3631
+ });
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();
3631
3669
  });
3632
3670
  }
3633
3671
  /**
@@ -3669,15 +3707,15 @@ class Ji {
3669
3707
  }, this.handlePopoverEscape = (i) => {
3670
3708
  i.key === "Escape" && this.closePopover();
3671
3709
  }, this.handlePopoverOutsideClick = (i) => {
3672
- var n, o;
3710
+ var s, o;
3673
3711
  if (this.popover && !this.popover.contains(i.target)) {
3674
- if ((n = this.container) != null && n.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
3712
+ if ((s = this.container) != null && s.contains(i.target) || (o = this.pickerEl) != null && o.contains(i.target)) return;
3675
3713
  this.closePopover();
3676
3714
  }
3677
3715
  }, this.handleOverlayClick = (i) => {
3678
3716
  this.form && (this.form.remove(), this.form = null);
3679
- const n = window.innerWidth, o = window.innerHeight, r = {
3680
- x: i.clientX / n,
3717
+ const s = window.innerWidth, o = window.innerHeight, r = {
3718
+ x: i.clientX / s,
3681
3719
  y: i.clientY / o,
3682
3720
  scrollX: window.scrollX,
3683
3721
  scrollY: window.scrollY
@@ -3747,8 +3785,8 @@ class Ji {
3747
3785
  this.container && (this.container.style.display = e ? "" : "none");
3748
3786
  }
3749
3787
  destroy() {
3750
- var e, t, i, n, o, r;
3751
- this.exitPinMode(), this.closePopover(), this.removePickerEl(), (e = this.unsub) == null || e.call(this), (t = this.threadUnsub) == null || t.call(this), (i = this.reactionUnsub) == null || i.call(this), (n = this.typingUnsub2) == null || n.call(this), window.removeEventListener("scroll", this.handleReposition, !0), window.removeEventListener("resize", this.handleReposition), (o = this.mutationObserver) == null || o.disconnect(), this.mutationObserver = null, this.repositionDebounce && (clearTimeout(this.repositionDebounce), this.repositionDebounce = null), (r = this.container) == null || r.remove(), this.container = null, this.pinEls.clear();
3788
+ var e, t, i, s, o, r;
3789
+ this.exitPinMode(), this.closePopover(), this.removePickerEl(), (e = this.unsub) == null || e.call(this), (t = this.threadUnsub) == null || t.call(this), (i = this.reactionUnsub) == null || i.call(this), (s = this.typingUnsub2) == null || s.call(this), window.removeEventListener("scroll", this.handleReposition, !0), window.removeEventListener("resize", this.handleReposition), (o = this.mutationObserver) == null || o.disconnect(), this.mutationObserver = null, this.repositionDebounce && (clearTimeout(this.repositionDebounce), this.repositionDebounce = null), (r = this.container) == null || r.remove(), this.container = null, this.pinEls.clear();
3752
3790
  }
3753
3791
  closePopover() {
3754
3792
  var e;
@@ -3765,8 +3803,8 @@ class Ji {
3765
3803
  t.unshift(`#${i.id}`);
3766
3804
  break;
3767
3805
  }
3768
- const n = i.tagName.toLowerCase(), o = [...i.classList].filter((a) => !a.startsWith("pulse-")).slice(0, 2);
3769
- let r = o.length > 0 ? `${n}.${o.join(".")}` : n;
3806
+ const s = i.tagName.toLowerCase(), o = [...i.classList].filter((a) => !a.startsWith("pulse-")).slice(0, 2);
3807
+ let r = o.length > 0 ? `${s}.${o.join(".")}` : s;
3770
3808
  const l = i.parentElement;
3771
3809
  if (l) {
3772
3810
  const a = [...l.children].filter((c) => c.tagName === i.tagName);
@@ -3781,13 +3819,13 @@ class Ji {
3781
3819
  }
3782
3820
  showPinForm(e, t, i) {
3783
3821
  this.form = document.createElement("div");
3784
- const n = Math.min(280, window.innerWidth - 32), o = 120;
3822
+ const s = Math.min(280, window.innerWidth - 32), o = 120;
3785
3823
  let r = e + 16, l = t - 10;
3786
- r + n > window.innerWidth - 16 && (r = e - n - 16), l + o > window.innerHeight - 16 && (l = window.innerHeight - o - 16), l < 16 && (l = 16), Object.assign(this.form.style, {
3824
+ r + s > window.innerWidth - 16 && (r = e - s - 16), l + o > window.innerHeight - 16 && (l = window.innerHeight - o - 16), l < 16 && (l = 16), Object.assign(this.form.style, {
3787
3825
  position: "fixed",
3788
3826
  left: `${r}px`,
3789
3827
  top: `${l}px`,
3790
- width: `${n}px`,
3828
+ width: `${s}px`,
3791
3829
  zIndex: "10001",
3792
3830
  background: "#fff",
3793
3831
  borderRadius: "12px",
@@ -3830,13 +3868,13 @@ class Ji {
3830
3868
  </div>
3831
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"), f = (u, g) => {
3836
- const v = document.createElement("div");
3837
- Object.assign(v.style, { position: "relative", display: "inline-block" }), v.appendChild(g);
3838
- const $ = document.createElement("button");
3839
- $.innerHTML = "×", Object.assign($.style, {
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, {
3840
3878
  position: "absolute",
3841
3879
  top: "-4px",
3842
3880
  right: "-4px",
@@ -3854,59 +3892,63 @@ class Ji {
3854
3892
  justifyContent: "center",
3855
3893
  padding: "0",
3856
3894
  fontWeight: "700"
3857
- }), $.addEventListener("click", () => {
3858
- const y = this.pendingAttachmentIds.indexOf(u);
3859
- y !== -1 && this.pendingAttachmentIds.splice(y, 1), v.remove();
3860
- }), v.appendChild($), d.appendChild(v);
3861
- };
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;
3862
3900
  this.form.querySelector(".attach-img").addEventListener("click", async () => {
3863
- const u = await this.upload.pickFile("image/*");
3864
- if (u) {
3865
- this.pendingAttachmentIds.push(u.id);
3866
- const g = document.createElement("img");
3867
- g.src = u.thumbnailUrl || u.url, Object.assign(g.style, { width: "48px", height: "48px", borderRadius: "6px", objectFit: "cover", border: "1px solid #e2e8f0", display: "block" }), f(u.id, g);
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);
3868
3908
  }
3869
3909
  }), this.form.querySelector(".attach-mic").addEventListener("click", async () => {
3910
+ if (this.pendingAttachmentIds.length >= f) return;
3870
3911
  this.audioRecorder || (this.audioRecorder = new Re());
3871
- const u = await this.audioRecorder.startRecording(d);
3872
- if (u) {
3873
- const g = await this.upload.uploadBlob(u, "audio.webm");
3874
- if (g) {
3875
- this.pendingAttachmentIds.push(g.id);
3876
- const v = document.createElement("span");
3877
- Object.assign(v.style, { display: "flex", alignItems: "center", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b", height: "48px", boxSizing: "border-box" }), v.textContent = "🎤 Audio", f(g.id, v);
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);
3917
+ const b = document.createElement("span");
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);
3878
3919
  }
3879
3920
  }
3880
3921
  }), this.form.querySelector(".attach-video").addEventListener("click", async () => {
3922
+ if (this.pendingAttachmentIds.length >= f) return;
3881
3923
  this.videoRecorder || (this.videoRecorder = new Le());
3882
- const u = await this.videoRecorder.startRecording(d);
3883
- if (u) {
3884
- const g = await this.upload.uploadBlob(u.blob, "video.webm");
3885
- if (g) {
3886
- this.pendingAttachmentIds.push(g.id);
3887
- const v = document.createElement("span");
3888
- Object.assign(v.style, { display: "flex", alignItems: "center", padding: "4px 10px", borderRadius: "6px", background: "#f1f5f9", fontSize: "11px", color: "#64748b", height: "48px", boxSizing: "border-box" }), v.textContent = "🎥 Video", f(g.id, v);
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);
3929
+ const b = document.createElement("span");
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);
3889
3931
  }
3890
3932
  }
3891
- }), p.addEventListener("click", () => {
3892
- const u = a.value.trim();
3893
- if (!u && this.pendingAttachmentIds.length === 0) return;
3894
- const g = [...(u || "").matchAll(/@(\w+)/g)].map((v) => v[1]);
3895
- this.client.createThread(u, { position: i, mentions: g, attachmentIds: this.pendingAttachmentIds.length > 0 ? [...this.pendingAttachmentIds] : void 0 }), this.pendingAttachmentIds = [], this.exitPinMode();
3896
- }), a.addEventListener("keydown", (u) => {
3897
- 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();
3898
3940
  }), document.body.appendChild(this.form), requestAnimationFrame(() => a.focus());
3899
3941
  }
3900
3942
  // ── Inline thread popover (shown when a pin dot is clicked) ──
3901
3943
  showThreadPopover(e, t) {
3902
3944
  this.closePopover(), this.popover = document.createElement("div"), this.popover.dataset.threadId = e.id;
3903
- const i = window.innerWidth <= 480, n = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
3945
+ const i = window.innerWidth <= 480, s = i ? window.innerWidth : 300, o = t.getBoundingClientRect();
3904
3946
  let r, l;
3905
- i ? (r = 0, l = window.innerHeight * 0.4) : (r = o.right + 10, l = o.top - 8, r + n > window.innerWidth - 16 && (r = o.left - n - 10), l < 16 && (l = 16)), Object.assign(this.popover.style, {
3947
+ i ? (r = 0, l = window.innerHeight * 0.4) : (r = o.right + 10, l = o.top - 8, r + s > window.innerWidth - 16 && (r = o.left - s - 10), l < 16 && (l = 16)), Object.assign(this.popover.style, {
3906
3948
  position: "fixed",
3907
3949
  left: `${r}px`,
3908
3950
  top: `${l}px`,
3909
- width: i ? "100vw" : `${n}px`,
3951
+ width: i ? "100vw" : `${s}px`,
3910
3952
  maxHeight: i ? "60vh" : "360px",
3911
3953
  zIndex: "10001",
3912
3954
  background: "#fff",
@@ -3958,13 +4000,13 @@ class Ji {
3958
4000
  }
3959
4001
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
3960
4002
  t.innerHTML = e.comments.map((a) => {
3961
- const c = this.client.state.getUser(a.userId), p = c ? c.name.split(" ").map((k) => k[0]).join("").toUpperCase().slice(0, 2) : "?", d = (c == null ? void 0 : c.color) ?? "#94a3b8", f = this.escapeHtml((c == null ? void 0 : c.name) ?? "Unknown"), u = this.formatTime(a.createdAt), g = i === a.userId, v = 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>' : "";
3962
4004
  if (this.editingPopoverCommentId === a.id)
3963
4005
  return `
3964
4006
  <div style="margin-bottom:10px;" data-comment-id="${a.id}">
3965
4007
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:4px;">
3966
- <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>
3967
- <span style="font-size:12px;font-weight:600;color:#0f172a;">${f}</span>
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>
4009
+ <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
3968
4010
  </div>
3969
4011
  <div style="margin-left:29px;">
3970
4012
  <textarea class="edit-textarea" style="width:100%;padding:6px 10px;border:1.5px solid #e2e8f0;border-radius:6px;font-size:12px;font-family:inherit;outline:none;resize:vertical;min-height:48px;color:#0f172a;box-sizing:border-box;">${this.escapeHtml(a.body)}</textarea>
@@ -3975,7 +4017,7 @@ class Ji {
3975
4017
  </div>
3976
4018
  </div>
3977
4019
  `;
3978
- const $ = a.body && a.body !== "(attachment)" ? a.body.replace(
4020
+ const b = a.body && a.body !== "(attachment)" ? a.body.replace(
3979
4021
  /@(\w+)/g,
3980
4022
  '<span style="color:#6366f1;font-weight:600;background:#eef2ff;padding:0 3px;border-radius:3px;">@$1</span>'
3981
4023
  ) : "", y = (a.attachments ?? []).map((k) => {
@@ -3986,26 +4028,26 @@ class Ji {
3986
4028
  </div>`;
3987
4029
  }
3988
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>` : "";
3989
- }).join(""), E = g ? `<div class="popover-comment-actions" style="display:flex;gap:2px;margin-top:2px;margin-left:29px;">
4031
+ }).join(""), E = m ? `<div class="popover-comment-actions" style="display:flex;gap:2px;margin-top:2px;margin-left:29px;">
3990
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"
3991
4033
  onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'"
3992
4034
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Gi}</button>
3993
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"
3994
4036
  onmouseover="this.style.color='#ef4444';this.style.background='#fef2f2'"
3995
4037
  onmouseout="this.style.color='#94a3b8';this.style.background='none'">${Zi}</button>
3996
- </div>` : "", A = this.buildReactionPillsHtml(a.id);
4038
+ </div>` : "", I = this.buildReactionPillsHtml(a.id);
3997
4039
  return `
3998
4040
  <div class="popover-comment" style="margin-bottom:10px;" data-comment-id="${a.id}">
3999
4041
  <div style="display:flex;align-items:center;gap:7px;margin-bottom:2px;">
4000
- <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>
4001
- <span style="font-size:12px;font-weight:600;color:#0f172a;">${f}</span>
4002
- <span style="font-size:10px;color:#94a3b8;">${u}</span>
4003
- ${v}
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>
4043
+ <span style="font-size:12px;font-weight:600;color:#0f172a;">${u}</span>
4044
+ <span style="font-size:10px;color:#94a3b8;">${f}</span>
4045
+ ${x}
4004
4046
  </div>
4005
- ${$ ? `<div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${$}</div>` : ""}
4047
+ ${b ? `<div style="font-size:13px;color:#334155;line-height:1.45;margin-left:29px;word-wrap:break-word;">${b}</div>` : ""}
4006
4048
  ${y}
4007
4049
  ${E}
4008
- ${A}
4050
+ ${I}
4009
4051
  </div>
4010
4052
  `;
4011
4053
  }).join(""), t.querySelectorAll(".edit-btn").forEach((a) => {
@@ -4017,13 +4059,13 @@ class Ji {
4017
4059
  this.client.deleteComment(a.dataset.commentId);
4018
4060
  });
4019
4061
  });
4020
- const n = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
4062
+ const s = t.querySelector(".edit-save"), o = t.querySelector(".edit-cancel"), r = t.querySelector(
4021
4063
  ".edit-textarea"
4022
4064
  );
4023
- n && r && n.addEventListener("click", () => {
4065
+ s && r && s.addEventListener("click", () => {
4024
4066
  const a = r.value.trim();
4025
4067
  if (!a) return;
4026
- const c = [...a.matchAll(/@(\w+)/g)].map((p) => p[1]);
4068
+ const c = [...a.matchAll(/@(\w+)/g)].map((h) => h[1]);
4027
4069
  this.client.editComment(
4028
4070
  this.editingPopoverCommentId,
4029
4071
  a,
@@ -4034,14 +4076,14 @@ class Ji {
4034
4076
  }), t.querySelectorAll("[data-reaction-emoji]").forEach((a) => {
4035
4077
  a.addEventListener("click", (c) => {
4036
4078
  c.stopPropagation();
4037
- const p = a.dataset.reactionEmoji, d = a.dataset.reactionTarget, f = a.dataset.reactionId;
4038
- f ? this.client.removeReaction(f) : 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);
4039
4081
  });
4040
4082
  }), t.querySelectorAll(".popover-reaction-add").forEach((a) => {
4041
4083
  a.addEventListener("click", (c) => {
4042
4084
  c.stopPropagation();
4043
- const p = a.dataset.commentId;
4044
- 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));
4045
4087
  });
4046
4088
  }), t.querySelectorAll(".popover-attachment-img").forEach((a) => {
4047
4089
  a.addEventListener("click", () => {
@@ -4051,14 +4093,14 @@ class Ji {
4051
4093
  }), t.querySelectorAll(".popover-attachment-audio").forEach((a) => {
4052
4094
  const c = a.dataset.url;
4053
4095
  if (c) {
4054
- const p = a.dataset.duration ? parseInt(a.dataset.duration) : void 0, d = Oe.render(c, p);
4055
- a.appendChild(d);
4096
+ const h = a.dataset.duration ? parseInt(a.dataset.duration) : void 0, p = Oe.render(c, h);
4097
+ a.appendChild(p);
4056
4098
  }
4057
4099
  }), t.querySelectorAll(".popover-attachment-video").forEach((a) => {
4058
4100
  const c = a.dataset.url;
4059
4101
  if (c) {
4060
- const p = a.dataset.poster || void 0, d = Tt.render(c, p);
4061
- a.appendChild(d);
4102
+ const h = a.dataset.poster || void 0, p = Tt.render(c, h);
4103
+ a.appendChild(p);
4062
4104
  }
4063
4105
  }), t.scrollTop = t.scrollHeight;
4064
4106
  }
@@ -4069,7 +4111,7 @@ class Ji {
4069
4111
  padding: "8px 14px 12px",
4070
4112
  borderTop: "1px solid #f1f5f9"
4071
4113
  });
4072
- const i = "border:none;background:none;cursor:pointer;color:#94a3b8;padding:6px;border-radius:6px;display:flex;align-items:center;justify-content:center;min-width:32px;min-height:32px;transition:all 0.15s;", n = 'width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
4114
+ const i = "border:none;background:none;cursor:pointer;color:#94a3b8;padding:6px;border-radius:6px;display:flex;align-items:center;justify-content:center;min-width:32px;min-height:32px;transition:all 0.15s;", s = 'width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"';
4073
4115
  t.innerHTML = `
4074
4116
  <div style="display:flex;align-items:center;gap:4px;margin-bottom:6px;">
4075
4117
  <input type="text" placeholder="Reply..."
@@ -4078,24 +4120,24 @@ class Ji {
4078
4120
  </div>
4079
4121
  <div style="display:flex;align-items:center;gap:2px;">
4080
4122
  <button class="reply-attach-img" title="Attach image" style="${i}" onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'" onmouseout="this.style.color='#94a3b8';this.style.background='none'">
4081
- <svg ${n}><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>
4123
+ <svg ${s}><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>
4082
4124
  </button>
4083
4125
  <button class="reply-attach-mic" title="Record audio" style="${i}" onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'" onmouseout="this.style.color='#94a3b8';this.style.background='none'">
4084
- <svg ${n}><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>
4126
+ <svg ${s}><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>
4085
4127
  </button>
4086
4128
  <button class="reply-attach-video" title="Record video" style="${i}" onmouseover="this.style.color='#6366f1';this.style.background='#eef2ff'" onmouseout="this.style.color='#94a3b8';this.style.background='none'">
4087
- <svg ${n}><path d="m22 8-6 4 6 4V8Z"/><rect width="14" height="12" x="2" y="6" rx="2" ry="2"/></svg>
4129
+ <svg ${s}><path d="m22 8-6 4 6 4V8Z"/><rect width="14" height="12" x="2" y="6" rx="2" ry="2"/></svg>
4088
4130
  </button>
4089
4131
  <div class="reply-attachments-preview" style="flex:1;display:flex;gap:4px;flex-wrap:wrap;margin-left:4px;"></div>
4090
4132
  </div>
4091
4133
  `;
4092
4134
  const o = t.querySelector("input"), r = t.querySelector(".reply-send"), l = t.querySelector(".reply-attachments-preview");
4093
4135
  this.upload || (this.upload = new ne(this.client));
4094
- const a = [], c = (d, f) => {
4095
- const u = document.createElement("span");
4096
- Object.assign(u.style, { position: "relative", display: "inline-flex", alignItems: "center", padding: "2px 18px 2px 8px", borderRadius: "4px", background: "#f1f5f9", fontSize: "10px", color: "#64748b" }), u.textContent = f;
4097
- const g = document.createElement("button");
4098
- g.innerHTML = "×", Object.assign(g.style, {
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, {
4099
4141
  position: "absolute",
4100
4142
  top: "-3px",
4101
4143
  right: "-3px",
@@ -4113,40 +4155,45 @@ class Ji {
4113
4155
  justifyContent: "center",
4114
4156
  padding: "0",
4115
4157
  fontWeight: "700"
4116
- }), g.addEventListener("click", () => {
4117
- const v = a.indexOf(d);
4118
- v !== -1 && a.splice(v, 1), u.remove();
4119
- }), u.appendChild(g), l.appendChild(u);
4120
- };
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;
4121
4163
  t.querySelector(".reply-attach-img").addEventListener("click", async () => {
4122
- const d = await this.upload.pickFile("image/*");
4123
- d && (a.push(d.id), c(d.id, "📎 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");
4124
4169
  }), t.querySelector(".reply-attach-mic").addEventListener("click", async () => {
4170
+ if (a.length >= h) return;
4125
4171
  this.audioRecorder || (this.audioRecorder = new Re());
4126
- const d = await this.audioRecorder.startRecording(t);
4127
- if (d) {
4128
- const f = await this.upload.uploadBlob(d, "audio.webm");
4172
+ const u = await this.audioRecorder.startRecording(t);
4173
+ if (u) {
4174
+ const f = await this.upload.uploadBlob(u, "audio.webm");
4129
4175
  f && (a.push(f.id), c(f.id, "🎤 Audio"));
4130
4176
  }
4131
4177
  }), t.querySelector(".reply-attach-video").addEventListener("click", async () => {
4178
+ if (a.length >= h) return;
4132
4179
  this.videoRecorder || (this.videoRecorder = new Le());
4133
- const d = await this.videoRecorder.startRecording(t);
4134
- if (d) {
4135
- const f = await this.upload.uploadBlob(d.blob, "video.webm");
4180
+ const u = await this.videoRecorder.startRecording(t);
4181
+ if (u) {
4182
+ const f = await this.upload.uploadBlob(u.blob, "video.webm");
4136
4183
  f && (a.push(f.id), c(f.id, "🎥 Video"));
4137
4184
  }
4138
4185
  });
4139
4186
  const p = () => {
4140
- const d = o.value.trim();
4141
- if (!d && a.length === 0) return;
4142
- const f = [...(d || "").matchAll(/@(\w+)/g)].map((u) => u[1]);
4143
- this.client.reply(e.id, d, f, 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 = "";
4144
4191
  };
4145
4192
  r.addEventListener("click", p), o.addEventListener("input", () => {
4146
- const d = Date.now(), f = this.lastTypingSendPins.get(e.id) ?? 0;
4147
- d - f >= 2e3 && (this.client.sendTyping(e.id), this.lastTypingSendPins.set(e.id, d));
4148
- }), o.addEventListener("keydown", (d) => {
4149
- 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();
4150
4197
  }), this.popover.appendChild(t);
4151
4198
  }
4152
4199
  removePickerEl() {
@@ -4171,7 +4218,7 @@ class Ji {
4171
4218
  zIndex: "10002",
4172
4219
  fontFamily: be
4173
4220
  });
4174
- for (const n of Ki) {
4221
+ for (const s of Ki) {
4175
4222
  const o = document.createElement("button");
4176
4223
  Object.assign(o.style, {
4177
4224
  border: "none",
@@ -4181,32 +4228,32 @@ class Ji {
4181
4228
  padding: "4px",
4182
4229
  borderRadius: "4px",
4183
4230
  lineHeight: "1"
4184
- }), o.textContent = n, o.addEventListener("click", (r) => {
4231
+ }), o.textContent = s, o.addEventListener("click", (r) => {
4185
4232
  r.stopPropagation();
4186
4233
  const a = this.client.state.getReactions(t).find(
4187
4234
  (c) => {
4188
- var p;
4189
- return c.emoji === n && 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);
4190
4237
  }
4191
4238
  );
4192
- a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", n), this.popoverPickerOpen = null, this.removePickerEl();
4239
+ a ? this.client.removeReaction(a.id) : this.client.addReaction(t, "comment", s), this.popoverPickerOpen = null, this.removePickerEl();
4193
4240
  }), this.pickerEl.appendChild(o);
4194
4241
  }
4195
4242
  document.body.appendChild(this.pickerEl);
4196
4243
  }
4197
4244
  buildReactionPillsHtml(e) {
4198
4245
  var a;
4199
- const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, n = /* @__PURE__ */ new Map();
4246
+ const t = this.client.state.getReactions(e), i = (a = this.client.state.user) == null ? void 0 : a.id, s = /* @__PURE__ */ new Map();
4200
4247
  for (const c of t) {
4201
- const p = n.get(c.emoji) ?? { count: 0, ownId: null };
4202
- p.count++, c.userId === i && (p.ownId = c.id), n.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);
4203
4250
  }
4204
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;";
4205
4252
  let l = '<div style="margin-left:29px;display:flex;gap:4px;flex-wrap:wrap;margin-top:4px;">';
4206
- for (const [c, { count: p, ownId: d }] of n) {
4207
- const f = d ? r : o;
4208
- l += `<button data-reaction-emoji="${c}" data-reaction-target="${e}" ${d ? `data-reaction-id="${d}"` : ""} style="${f}">
4209
- <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>
4210
4257
  </button>`;
4211
4258
  }
4212
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;
@@ -4222,20 +4269,20 @@ class Ji {
4222
4269
  fontStyle: "italic",
4223
4270
  minHeight: "16px"
4224
4271
  });
4225
- const n = this.popover.lastElementChild;
4226
- n && this.popover.insertBefore(t, n);
4272
+ const s = this.popover.lastElementChild;
4273
+ s && this.popover.insertBefore(t, s);
4227
4274
  }
4228
- const i = this.client.state.getTypingUsers(e).filter((n) => {
4275
+ const i = this.client.state.getTypingUsers(e).filter((s) => {
4229
4276
  var o;
4230
- return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4231
- }).map((n) => {
4232
- const o = this.client.state.presence.find((r) => r.user.id === n);
4277
+ return s !== ((o = this.client.state.user) == null ? void 0 : o.id);
4278
+ }).map((s) => {
4279
+ const o = this.client.state.presence.find((r) => r.user.id === s);
4233
4280
  return (o == null ? void 0 : o.user.name) ?? "Someone";
4234
4281
  });
4235
4282
  i.length === 0 ? t.textContent = "" : i.length === 1 ? t.textContent = `${i[0]} is typing...` : t.textContent = `${i.join(", ")} are typing...`;
4236
4283
  }
4237
4284
  formatTime(e) {
4238
- const t = new Date(e), n = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(n / 6e4);
4285
+ const t = new Date(e), s = (/* @__PURE__ */ new Date()).getTime() - t.getTime(), o = Math.floor(s / 6e4);
4239
4286
  if (o < 1) return "now";
4240
4287
  if (o < 60) return `${o}m`;
4241
4288
  const r = Math.floor(o / 60);
@@ -4264,9 +4311,9 @@ class Ji {
4264
4311
  renderPins() {
4265
4312
  if (!this.container) return;
4266
4313
  const e = this.threads.filter((i) => i.position && !i.resolved), t = new Set(e.map((i) => i.id));
4267
- for (const [i, n] of this.pinEls)
4268
- t.has(i) || (n.remove(), this.pinEls.delete(i));
4269
- e.forEach((i, n) => {
4314
+ for (const [i, s] of this.pinEls)
4315
+ t.has(i) || (s.remove(), this.pinEls.delete(i));
4316
+ e.forEach((i, s) => {
4270
4317
  const o = i.position;
4271
4318
  let r = this.pinEls.get(i.id);
4272
4319
  r || (r = document.createElement("div"), Object.assign(r.style, {
@@ -4300,19 +4347,19 @@ class Ji {
4300
4347
  }
4301
4348
  const a = this.threads.find((c) => c.id === i.id);
4302
4349
  a && this.showThreadPopover(a, r);
4303
- }), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${n + 1}`;
4350
+ }), this.container.appendChild(r), this.pinEls.set(i.id, r)), r.textContent = `${s + 1}`;
4304
4351
  const l = this.resolvePosition(o);
4305
4352
  r.style.left = `${l.x}px`, r.style.top = `${l.y}px`;
4306
4353
  });
4307
4354
  }
4308
4355
  }
4309
- var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (s, e, t, i) => {
4310
- for (var n = i > 1 ? void 0 : i ? es(e, t) : e, o = s.length - 1, r; o >= 0; o--)
4311
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
4312
- return i && n && Qi(e, t, n), n;
4356
+ var Qi = Object.defineProperty, es = Object.getOwnPropertyDescriptor, j = (n, e, t, i) => {
4357
+ for (var s = i > 1 ? void 0 : i ? es(e, t) : e, o = n.length - 1, r; o >= 0; o--)
4358
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
4359
+ return i && s && Qi(e, t, s), s;
4313
4360
  };
4314
4361
  const ts = ["👍", "👎", "❤️", "🎉", "👀", "🚀"];
4315
- let O = class extends S {
4362
+ let P = class extends S {
4316
4363
  constructor() {
4317
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 = [];
4318
4365
  }
@@ -4326,28 +4373,28 @@ let O = class extends S {
4326
4373
  disconnectedCallback() {
4327
4374
  super.disconnectedCallback(), this.teardownListeners();
4328
4375
  }
4329
- willUpdate(s) {
4376
+ willUpdate(n) {
4330
4377
  this.client && !this.unsub && this.ensureListener();
4331
4378
  }
4332
- updated(s) {
4379
+ updated(n) {
4333
4380
  var e, t;
4334
4381
  (e = this.shadowRoot) == null || e.querySelectorAll(".audio-player-host").forEach((i) => {
4335
4382
  if (i.children.length > 0) return;
4336
- const n = i.dataset.url;
4337
- if (n) {
4383
+ const s = i.dataset.url;
4384
+ if (s) {
4338
4385
  const o = i.dataset.duration ? parseInt(i.dataset.duration) : void 0;
4339
- i.appendChild(Oe.render(n, o));
4386
+ i.appendChild(Oe.render(s, o));
4340
4387
  }
4341
4388
  }), (t = this.shadowRoot) == null || t.querySelectorAll(".video-player-host").forEach((i) => {
4342
4389
  if (i.children.length > 0) return;
4343
- const n = i.dataset.url;
4344
- n && i.appendChild(Tt.render(n, i.dataset.poster || void 0));
4390
+ const s = i.dataset.url;
4391
+ s && i.appendChild(Tt.render(s, i.dataset.poster || void 0));
4345
4392
  });
4346
4393
  }
4347
4394
  teardownListeners() {
4348
- var s, e, t, i;
4349
- (s = this.unsub) == null || s.call(this), this.unsub = void 0, (e = this.authUnsub) == null || e.call(this), this.authUnsub = void 0, (t = this.reactionUnsub) == null || t.call(this), this.reactionUnsub = void 0, (i = this.typingUnsub) == null || i.call(this), this.typingUnsub = void 0;
4350
- for (const n of this.typingTimers.values()) clearTimeout(n);
4395
+ var n, e, t, i;
4396
+ (n = this.unsub) == null || n.call(this), this.unsub = void 0, (e = this.authUnsub) == null || e.call(this), this.authUnsub = void 0, (t = this.reactionUnsub) == null || t.call(this), this.reactionUnsub = void 0, (i = this.typingUnsub) == null || i.call(this), this.typingUnsub = void 0;
4397
+ for (const s of this.typingTimers.values()) clearTimeout(s);
4351
4398
  this.typingTimers.clear();
4352
4399
  }
4353
4400
  ensureListener() {
@@ -4362,123 +4409,127 @@ let O = class extends S {
4362
4409
  this.reactionsVersion++;
4363
4410
  }), this.typingUnsub = this.client.state.on(
4364
4411
  "typing",
4365
- ({ threadId: s }) => {
4366
- this.refreshTyping(s);
4412
+ ({ threadId: n }) => {
4413
+ this.refreshTyping(n);
4367
4414
  }
4368
4415
  ));
4369
4416
  }
4370
- refreshTyping(s) {
4371
- const t = this.client.state.getTypingUsers(s).filter((n) => {
4417
+ refreshTyping(n) {
4418
+ const t = this.client.state.getTypingUsers(n).filter((s) => {
4372
4419
  var o;
4373
- return n !== ((o = this.client.state.user) == null ? void 0 : o.id);
4374
- }).map((n) => {
4375
- const o = this.client.state.presence.find((r) => r.user.id === n);
4420
+ return s !== ((o = this.client.state.user) == null ? void 0 : o.id);
4421
+ }).map((s) => {
4422
+ const o = this.client.state.presence.find((r) => r.user.id === s);
4376
4423
  return (o == null ? void 0 : o.user.name) ?? "Someone";
4377
4424
  }), i = new Map(this.typingByThread);
4378
- i.set(s, t), this.typingByThread = i, this.typingTimers.has(s) && clearTimeout(this.typingTimers.get(s)), this.typingTimers.set(
4379
- s,
4425
+ i.set(n, t), this.typingByThread = i, this.typingTimers.has(n) && clearTimeout(this.typingTimers.get(n)), this.typingTimers.set(
4426
+ n,
4380
4427
  setTimeout(() => {
4381
- this.refreshTyping(s);
4428
+ this.refreshTyping(n);
4382
4429
  }, 3500)
4383
4430
  );
4384
4431
  }
4385
- handleTypingInput(s) {
4386
- const e = Date.now(), t = this.lastTypingSend.get(s) ?? 0;
4387
- e - t >= 2e3 && (this.client.sendTyping(s), this.lastTypingSend.set(s, e));
4432
+ handleTypingInput(n) {
4433
+ const e = Date.now(), t = this.lastTypingSend.get(n) ?? 0;
4434
+ e - t >= 2e3 && (this.client.sendTyping(n), this.lastTypingSend.set(n, e));
4388
4435
  }
4389
- toggleReaction(s, e) {
4436
+ toggleReaction(n, e) {
4390
4437
  var o;
4391
- const t = this.client.state.getReactions(s), i = (o = this.client.state.user) == null ? void 0 : o.id, n = t.find(
4438
+ const t = this.client.state.getReactions(n), i = (o = this.client.state.user) == null ? void 0 : o.id, s = t.find(
4392
4439
  (r) => r.emoji === e && r.userId === i
4393
4440
  );
4394
- n ? this.client.removeReaction(n.id) : this.client.addReaction(s, "comment", e), this.pickerOpenForComment = null;
4441
+ s ? this.client.removeReaction(s.id) : this.client.addReaction(n, "comment", e), this.pickerOpenForComment = null;
4395
4442
  }
4396
4443
  fireClose() {
4397
4444
  this.dispatchEvent(
4398
4445
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
4399
4446
  );
4400
4447
  }
4401
- scrollToThread(s) {
4448
+ scrollToThread(n) {
4402
4449
  this.updateComplete.then(() => {
4403
4450
  var t;
4404
4451
  const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(
4405
- `[data-thread-id="${s}"]`
4452
+ `[data-thread-id="${n}"]`
4406
4453
  );
4407
4454
  e == null || e.scrollIntoView({ behavior: "smooth", block: "center" });
4408
4455
  });
4409
4456
  }
4410
- parseMentions(s) {
4411
- return s.split(/(@\w+)/g).map(
4412
- (t) => t.startsWith("@") ? h`<span class="mention">${t}</span>` : t
4457
+ parseMentions(n) {
4458
+ return n.split(/(@\w+)/g).map(
4459
+ (t) => t.startsWith("@") ? d`<span class="mention">${t}</span>` : t
4413
4460
  );
4414
4461
  }
4415
- getInitials(s) {
4416
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
4462
+ getInitials(n) {
4463
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
4417
4464
  }
4418
- getUserForComment(s) {
4419
- return this.client.state.getUser(s);
4465
+ getUserForComment(n) {
4466
+ return this.client.state.getUser(n);
4420
4467
  }
4421
- formatTime(s) {
4422
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
4423
- if (n < 1) return "now";
4424
- if (n < 60) return `${n}m`;
4425
- const o = Math.floor(n / 60);
4468
+ formatTime(n) {
4469
+ const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
4470
+ if (s < 1) return "now";
4471
+ if (s < 60) return `${s}m`;
4472
+ const o = Math.floor(s / 60);
4426
4473
  return o < 24 ? `${o}h` : e.toLocaleDateString();
4427
4474
  }
4428
4475
  async handleAttachImage() {
4429
4476
  this.upload || (this.upload = new ne(this.client));
4430
- const s = await this.upload.pickFile("image/*");
4431
- s && (this.replyAttachmentIds.push(s.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());
4432
4481
  }
4433
- async handleRecordAudio(s) {
4482
+ async handleRecordAudio(n) {
4434
4483
  var i;
4484
+ if (this.replyAttachmentIds.length >= P.MAX_ATTACHMENTS) return;
4435
4485
  this.upload || (this.upload = new ne(this.client)), this.audioRecorder || (this.audioRecorder = new Re());
4436
- const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${s}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
4486
+ const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.audioRecorder.startRecording(e ?? document.body);
4437
4487
  if (t) {
4438
- const n = await this.upload.uploadBlob(t, "audio.webm");
4439
- n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4488
+ const s = await this.upload.uploadBlob(t, "audio.webm");
4489
+ s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4440
4490
  }
4441
4491
  }
4442
- async handleRecordVideo(s) {
4492
+ async handleRecordVideo(n) {
4443
4493
  var i;
4494
+ if (this.replyAttachmentIds.length >= P.MAX_ATTACHMENTS) return;
4444
4495
  this.upload || (this.upload = new ne(this.client)), this.videoRecorder || (this.videoRecorder = new Le());
4445
- const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${s}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
4496
+ const e = (i = this.shadowRoot) == null ? void 0 : i.querySelector(`[data-thread-id="${n}"]`), t = await this.videoRecorder.startRecording(e ?? document.body);
4446
4497
  if (t) {
4447
- const n = await this.upload.uploadBlob(t.blob, "video.webm");
4448
- n && (this.replyAttachmentIds.push(n.id), this.requestUpdate());
4498
+ const s = await this.upload.uploadBlob(t.blob, "video.webm");
4499
+ s && (this.replyAttachmentIds.push(s.id), this.requestUpdate());
4449
4500
  }
4450
4501
  }
4451
- removeReplyAttachment(s) {
4452
- this.replyAttachmentIds = this.replyAttachmentIds.filter((e) => e !== s), this.requestUpdate();
4502
+ removeReplyAttachment(n) {
4503
+ this.replyAttachmentIds = this.replyAttachmentIds.filter((e) => e !== n), this.requestUpdate();
4453
4504
  }
4454
- handleReply(s, e) {
4505
+ handleReply(n, e) {
4455
4506
  e.preventDefault();
4456
- const i = e.target.querySelector("input"), n = i.value.trim();
4457
- if (!n && this.replyAttachmentIds.length === 0) return;
4458
- const o = [...(n || "").matchAll(/@(\w+)/g)].map((r) => r[1]);
4459
- this.client.reply(s, n, o, this.replyAttachmentIds.length > 0 ? [...this.replyAttachmentIds] : void 0), i.value = "", this.replyAttachmentIds = [], this.replyingTo = null;
4507
+ const i = e.target.querySelector("input"), s = i.value.trim();
4508
+ if (!s && this.replyAttachmentIds.length === 0) return;
4509
+ const o = [...(s || "").matchAll(/@(\w+)/g)].map((r) => r[1]);
4510
+ this.client.reply(n, s, o, this.replyAttachmentIds.length > 0 ? [...this.replyAttachmentIds] : void 0), i.value = "", this.replyAttachmentIds = [], this.replyingTo = null;
4460
4511
  }
4461
- isOwnComment(s) {
4512
+ isOwnComment(n) {
4462
4513
  var e, t;
4463
- return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) === s.userId;
4514
+ return ((t = (e = this.client) == null ? void 0 : e.state.user) == null ? void 0 : t.id) === n.userId;
4464
4515
  }
4465
- startEdit(s) {
4466
- this.editingCommentId = s.id, this.editBody = s.body;
4516
+ startEdit(n) {
4517
+ this.editingCommentId = n.id, this.editBody = n.body;
4467
4518
  }
4468
4519
  cancelEdit() {
4469
4520
  this.editingCommentId = null, this.editBody = "";
4470
4521
  }
4471
- saveEdit(s) {
4522
+ saveEdit(n) {
4472
4523
  const e = this.editBody.trim();
4473
4524
  if (!e) return;
4474
4525
  const t = [...e.matchAll(/@(\w+)/g)].map((i) => i[1]);
4475
- this.client.editComment(s, e, t), this.editingCommentId = null, this.editBody = "";
4526
+ this.client.editComment(n, e, t), this.editingCommentId = null, this.editBody = "";
4476
4527
  }
4477
- deleteComment(s) {
4478
- this.client.deleteComment(s);
4528
+ deleteComment(n) {
4529
+ this.client.deleteComment(n);
4479
4530
  }
4480
- renderEditForm(s) {
4481
- return h`
4531
+ renderEditForm(n) {
4532
+ return d`
4482
4533
  <div class="edit-form">
4483
4534
  <textarea
4484
4535
  .value=${this.editBody}
@@ -4487,27 +4538,27 @@ let O = class extends S {
4487
4538
  }}
4488
4539
  ></textarea>
4489
4540
  <div class="edit-actions">
4490
- <button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(s.id)}>Save</button>
4541
+ <button class="pw-btn pw-btn-primary" @click=${() => this.saveEdit(n.id)}>Save</button>
4491
4542
  <button class="pw-btn" @click=${this.cancelEdit}>Cancel</button>
4492
4543
  </div>
4493
4544
  </div>
4494
4545
  `;
4495
4546
  }
4496
- renderReactions(s) {
4497
- var n;
4547
+ renderReactions(n) {
4548
+ var s;
4498
4549
  this.reactionsVersion;
4499
- const e = this.client.state.getReactions(s.id), t = (n = this.client.state.user) == null ? void 0 : n.id, i = /* @__PURE__ */ new Map();
4550
+ const e = this.client.state.getReactions(n.id), t = (s = this.client.state.user) == null ? void 0 : s.id, i = /* @__PURE__ */ new Map();
4500
4551
  for (const o of e)
4501
4552
  i.has(o.emoji) || i.set(o.emoji, []), i.get(o.emoji).push(o);
4502
- return h`
4553
+ return d`
4503
4554
  <div class="comment-reactions">
4504
4555
  ${[...i.entries()].map(
4505
4556
  ([o, r]) => {
4506
4557
  const l = r.some((a) => a.userId === t);
4507
- return h`
4558
+ return d`
4508
4559
  <button
4509
4560
  class="reaction-pill ${l ? "own" : ""}"
4510
- @click=${() => this.toggleReaction(s.id, o)}
4561
+ @click=${() => this.toggleReaction(n.id, o)}
4511
4562
  >
4512
4563
  <span>${o}</span>
4513
4564
  <span class="count">${r.length}</span>
@@ -4518,42 +4569,42 @@ let O = class extends S {
4518
4569
  <button
4519
4570
  class="reaction-add-btn"
4520
4571
  @click=${() => {
4521
- this.pickerOpenForComment = this.pickerOpenForComment === s.id ? null : s.id;
4572
+ this.pickerOpenForComment = this.pickerOpenForComment === n.id ? null : n.id;
4522
4573
  }}
4523
4574
  title="Add reaction"
4524
4575
  >
4525
4576
  +
4526
- ${this.pickerOpenForComment === s.id ? h`
4577
+ ${this.pickerOpenForComment === n.id ? d`
4527
4578
  <div class="emoji-picker">
4528
4579
  ${ts.map(
4529
- (o) => h`
4580
+ (o) => d`
4530
4581
  <button @click=${(r) => {
4531
- r.stopPropagation(), this.toggleReaction(s.id, o);
4582
+ r.stopPropagation(), this.toggleReaction(n.id, o);
4532
4583
  }}>${o}</button>
4533
4584
  `
4534
4585
  )}
4535
4586
  </div>
4536
- ` : m}
4587
+ ` : g}
4537
4588
  </button>
4538
4589
  </div>
4539
4590
  `;
4540
4591
  }
4541
- renderTypingIndicator(s) {
4542
- const e = this.typingByThread.get(s) ?? [];
4543
- if (e.length === 0) return m;
4592
+ renderTypingIndicator(n) {
4593
+ const e = this.typingByThread.get(n) ?? [];
4594
+ if (e.length === 0) return g;
4544
4595
  const t = e.length === 1 ? `${e[0]} is typing...` : `${e.join(", ")} are typing...`;
4545
- return h`<div class="typing-indicator">${t}</div>`;
4596
+ return d`<div class="typing-indicator">${t}</div>`;
4546
4597
  }
4547
4598
  sortedThreads() {
4548
- return [...this.threads].sort((s, e) => {
4549
- if (s.resolved !== e.resolved) return s.resolved ? 1 : -1;
4550
- const t = s.comments.length ? new Date(s.comments[s.comments.length - 1].createdAt).getTime() : 0;
4599
+ return [...this.threads].sort((n, e) => {
4600
+ if (n.resolved !== e.resolved) return n.resolved ? 1 : -1;
4601
+ const t = n.comments.length ? new Date(n.comments[n.comments.length - 1].createdAt).getTime() : 0;
4551
4602
  return (e.comments.length ? new Date(e.comments[e.comments.length - 1].createdAt).getTime() : 0) - t;
4552
4603
  });
4553
4604
  }
4554
4605
  render() {
4555
- const s = this.sortedThreads();
4556
- return h`
4606
+ const n = this.sortedThreads();
4607
+ return d`
4557
4608
  <div class="panel">
4558
4609
  <div class="panel-header">
4559
4610
  <span class="panel-title">
@@ -4566,10 +4617,10 @@ let O = class extends S {
4566
4617
  </div>
4567
4618
 
4568
4619
  <div class="panel-body pw-scrollable">
4569
- ${s.length === 0 ? h`<div class="empty">
4620
+ ${n.length === 0 ? d`<div class="empty">
4570
4621
  <div class="empty-icon">&#128172;</div>
4571
4622
  No comments yet
4572
- </div>` : s.map((e) => this.renderThread(e))}
4623
+ </div>` : n.map((e) => this.renderThread(e))}
4573
4624
  </div>
4574
4625
 
4575
4626
  <div class="pin-hint">
@@ -4578,12 +4629,12 @@ let O = class extends S {
4578
4629
  </div>
4579
4630
  `;
4580
4631
  }
4581
- renderAttachments(s) {
4582
- return !s || s.length === 0 ? m : h`
4583
- ${s.map((e) => {
4632
+ renderAttachments(n) {
4633
+ return !n || n.length === 0 ? g : d`
4634
+ ${n.map((e) => {
4584
4635
  if (e.type === "image") {
4585
4636
  const t = e.thumbnailUrl || e.url;
4586
- return h`
4637
+ return d`
4587
4638
  <div class="comment-attachment-media">
4588
4639
  <img
4589
4640
  class="comment-attachment-img"
@@ -4594,60 +4645,60 @@ let O = class extends S {
4594
4645
  </div>
4595
4646
  `;
4596
4647
  }
4597
- return e.type === "audio" ? h`
4648
+ return e.type === "audio" ? d`
4598
4649
  <div class="comment-attachment-media" id="audio-${e.id}">
4599
4650
  ${this.renderAudioPlayer(e)}
4600
4651
  </div>
4601
- ` : e.type === "video" ? h`
4652
+ ` : e.type === "video" ? d`
4602
4653
  <div class="comment-attachment-media" id="video-${e.id}">
4603
4654
  ${this.renderVideoPlayer(e)}
4604
4655
  </div>
4605
- ` : m;
4656
+ ` : g;
4606
4657
  })}
4607
4658
  `;
4608
4659
  }
4609
- renderAudioPlayer(s) {
4610
- const e = document.createElement("div"), t = Oe.render(s.url, s.durationMs);
4611
- return e.appendChild(t), h`<div class="audio-player-host" data-url=${s.url} data-duration=${s.durationMs ?? ""}></div>`;
4660
+ renderAudioPlayer(n) {
4661
+ const e = document.createElement("div"), t = Oe.render(n.url, n.durationMs);
4662
+ return e.appendChild(t), d`<div class="audio-player-host" data-url=${n.url} data-duration=${n.durationMs ?? ""}></div>`;
4612
4663
  }
4613
- renderVideoPlayer(s) {
4614
- return h`<div class="video-player-host" data-url=${s.url} data-poster=${s.thumbnailUrl ?? ""}></div>`;
4664
+ renderVideoPlayer(n) {
4665
+ return d`<div class="video-player-host" data-url=${n.url} data-poster=${n.thumbnailUrl ?? ""}></div>`;
4615
4666
  }
4616
- renderThread(s) {
4617
- const e = this.highlightThreadId === s.id;
4618
- return h`
4667
+ renderThread(n) {
4668
+ const e = this.highlightThreadId === n.id;
4669
+ return d`
4619
4670
  <div
4620
- class="thread ${s.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
4621
- data-thread-id=${s.id}
4671
+ class="thread ${n.resolved ? "resolved" : ""} ${e ? "highlighted" : ""}"
4672
+ data-thread-id=${n.id}
4622
4673
  >
4623
- ${s.position ? h`<div class="pin-badge">
4674
+ ${n.position ? d`<div class="pin-badge">
4624
4675
  ${C(_t, 12)}
4625
4676
  Pinned
4626
- </div>` : m}
4627
- ${s.comments.map((t, i) => {
4628
- const n = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4629
- return h`
4630
- ${i > 0 ? h`<div class="comment-divider"></div>` : m}
4677
+ </div>` : g}
4678
+ ${n.comments.map((t, i) => {
4679
+ const s = this.getUserForComment(t.userId), o = this.isOwnComment(t), r = this.editingCommentId === t.id;
4680
+ return d`
4681
+ ${i > 0 ? d`<div class="comment-divider"></div>` : g}
4631
4682
  <div class="comment">
4632
4683
  <div class="comment-header">
4633
4684
  <div
4634
4685
  class="comment-avatar"
4635
- style="background:${(n == null ? void 0 : n.color) ?? "#94a3b8"}"
4686
+ style="background:${(s == null ? void 0 : s.color) ?? "#94a3b8"}"
4636
4687
  >
4637
- ${n ? this.getInitials(n.name) : "?"}
4688
+ ${s ? this.getInitials(s.name) : "?"}
4638
4689
  </div>
4639
- <span class="comment-author">${(n == null ? void 0 : n.name) ?? "Unknown"}</span>
4690
+ <span class="comment-author">${(s == null ? void 0 : s.name) ?? "Unknown"}</span>
4640
4691
  <span class="comment-time">${this.formatTime(t.createdAt)}</span>
4641
- ${t.editedAt ? h`<span class="edited-badge">(edited)</span>` : m}
4692
+ ${t.editedAt ? d`<span class="edited-badge">(edited)</span>` : g}
4642
4693
  </div>
4643
- ${r ? this.renderEditForm(t) : h`
4644
- ${t.body && t.body !== "(attachment)" ? h`<div class="comment-body">${this.parseMentions(t.body)}</div>` : m}
4694
+ ${r ? this.renderEditForm(t) : d`
4695
+ ${t.body && t.body !== "(attachment)" ? d`<div class="comment-body">${this.parseMentions(t.body)}</div>` : g}
4645
4696
  ${this.renderAttachments(t.attachments ?? [])}
4646
4697
  `}
4647
- ${o && !r ? h`<div class="comment-actions">
4698
+ ${o && !r ? d`<div class="comment-actions">
4648
4699
  <button @click=${() => this.startEdit(t)} title="Edit">${C(Ai, 14)}</button>
4649
4700
  <button class="danger" @click=${() => this.deleteComment(t.id)} title="Delete">${C(Mi, 14)}</button>
4650
- </div>` : m}
4701
+ </div>` : g}
4651
4702
  ${this.renderReactions(t)}
4652
4703
  </div>
4653
4704
  `;
@@ -4655,29 +4706,29 @@ let O = class extends S {
4655
4706
 
4656
4707
  <div class="thread-actions">
4657
4708
  <button
4658
- @click=${() => this.replyingTo = this.replyingTo === s.id ? null : s.id}
4709
+ @click=${() => this.replyingTo = this.replyingTo === n.id ? null : n.id}
4659
4710
  >
4660
4711
  Reply
4661
4712
  </button>
4662
4713
  <button
4663
- @click=${() => this.client.resolveThread(s.id, !s.resolved)}
4714
+ @click=${() => this.client.resolveThread(n.id, !n.resolved)}
4664
4715
  >
4665
- ${s.resolved ? "Reopen" : "Resolve"}
4716
+ ${n.resolved ? "Reopen" : "Resolve"}
4666
4717
  </button>
4667
4718
  </div>
4668
4719
 
4669
- ${this.renderTypingIndicator(s.id)}
4720
+ ${this.renderTypingIndicator(n.id)}
4670
4721
 
4671
- ${this.replyingTo === s.id ? h`
4722
+ ${this.replyingTo === n.id ? d`
4672
4723
  <form
4673
4724
  class="reply-form"
4674
- @submit=${(t) => this.handleReply(s.id, t)}
4725
+ @submit=${(t) => this.handleReply(n.id, t)}
4675
4726
  >
4676
4727
  <div class="reply-input-row">
4677
4728
  <input
4678
4729
  type="text"
4679
4730
  placeholder="Reply..."
4680
- @input=${() => this.handleTypingInput(s.id)}
4731
+ @input=${() => this.handleTypingInput(n.id)}
4681
4732
  />
4682
4733
  <button class="pw-btn pw-btn-primary" type="submit">Send</button>
4683
4734
  </div>
@@ -4692,17 +4743,17 @@ let O = class extends S {
4692
4743
  type="button"
4693
4744
  class="reply-media-btn"
4694
4745
  title="Record audio"
4695
- @click=${() => this.handleRecordAudio(s.id)}
4746
+ @click=${() => this.handleRecordAudio(n.id)}
4696
4747
  >${C(Ti, 16)}</button>
4697
4748
  <button
4698
4749
  type="button"
4699
4750
  class="reply-media-btn"
4700
4751
  title="Record video"
4701
- @click=${() => this.handleRecordVideo(s.id)}
4752
+ @click=${() => this.handleRecordVideo(n.id)}
4702
4753
  >${C(Oi, 16)}</button>
4703
4754
  <div class="reply-preview">
4704
4755
  ${this.replyAttachmentIds.map(
4705
- (t, i) => h`<span class="reply-preview-badge">
4756
+ (t, i) => d`<span class="reply-preview-badge">
4706
4757
  Attached #${i + 1}
4707
4758
  <button
4708
4759
  type="button"
@@ -4714,16 +4765,16 @@ let O = class extends S {
4714
4765
  </div>
4715
4766
  </div>
4716
4767
  </form>
4717
- ` : m}
4768
+ ` : g}
4718
4769
  </div>
4719
4770
  `;
4720
4771
  }
4721
4772
  };
4722
- O.styles = [
4773
+ P.styles = [
4723
4774
  ee,
4724
4775
  ge,
4725
4776
  _e,
4726
- I`
4777
+ M`
4727
4778
  :host {
4728
4779
  display: block;
4729
4780
  }
@@ -5263,40 +5314,41 @@ O.styles = [
5263
5314
  }
5264
5315
  `
5265
5316
  ];
5317
+ P.MAX_ATTACHMENTS = 5;
5266
5318
  j([
5267
- b({ attribute: !1 })
5268
- ], O.prototype, "client", 2);
5319
+ v({ attribute: !1 })
5320
+ ], P.prototype, "client", 2);
5269
5321
  j([
5270
- b()
5271
- ], O.prototype, "highlightThreadId", 2);
5322
+ v()
5323
+ ], P.prototype, "highlightThreadId", 2);
5272
5324
  j([
5273
- x()
5274
- ], O.prototype, "threadsVersion", 2);
5325
+ w()
5326
+ ], P.prototype, "threadsVersion", 2);
5275
5327
  j([
5276
- x()
5277
- ], O.prototype, "replyingTo", 2);
5328
+ w()
5329
+ ], P.prototype, "replyingTo", 2);
5278
5330
  j([
5279
- x()
5280
- ], O.prototype, "editingCommentId", 2);
5331
+ w()
5332
+ ], P.prototype, "editingCommentId", 2);
5281
5333
  j([
5282
- x()
5283
- ], O.prototype, "editBody", 2);
5334
+ w()
5335
+ ], P.prototype, "editBody", 2);
5284
5336
  j([
5285
- x()
5286
- ], O.prototype, "pickerOpenForComment", 2);
5337
+ w()
5338
+ ], P.prototype, "pickerOpenForComment", 2);
5287
5339
  j([
5288
- x()
5289
- ], O.prototype, "typingByThread", 2);
5340
+ w()
5341
+ ], P.prototype, "typingByThread", 2);
5290
5342
  j([
5291
- x()
5292
- ], O.prototype, "reactionsVersion", 2);
5293
- O = j([
5343
+ w()
5344
+ ], P.prototype, "reactionsVersion", 2);
5345
+ P = j([
5294
5346
  R("pulse-widget-comments-panel")
5295
- ], O);
5296
- var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, Ve = (s, e, t, i) => {
5297
- for (var n = i > 1 ? void 0 : i ? ss(e, t) : e, o = s.length - 1, r; o >= 0; o--)
5298
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
5299
- return i && n && is(e, t, n), n;
5347
+ ], P);
5348
+ var is = Object.defineProperty, ss = Object.getOwnPropertyDescriptor, Ve = (n, e, t, i) => {
5349
+ for (var s = i > 1 ? void 0 : i ? ss(e, t) : e, o = n.length - 1, r; o >= 0; o--)
5350
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
5351
+ return i && s && is(e, t, s), s;
5300
5352
  };
5301
5353
  const ns = {
5302
5354
  "comment:created": "left a comment",
@@ -5319,18 +5371,18 @@ let de = class extends S {
5319
5371
  super.connectedCallback(), this.setupListener();
5320
5372
  }
5321
5373
  disconnectedCallback() {
5322
- var s;
5323
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this);
5374
+ var n;
5375
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this);
5324
5376
  }
5325
- updated(s) {
5377
+ updated(n) {
5326
5378
  var e;
5327
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
5379
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), this.setupListener());
5328
5380
  }
5329
5381
  setupListener() {
5330
5382
  this.client && (this.notifications = this.client.state.notifications, this.unsub = this.client.state.on(
5331
5383
  "notifications",
5332
- (s) => {
5333
- this.notifications = [...s];
5384
+ (n) => {
5385
+ this.notifications = [...n];
5334
5386
  }
5335
5387
  ));
5336
5388
  }
@@ -5339,33 +5391,33 @@ let de = class extends S {
5339
5391
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
5340
5392
  );
5341
5393
  }
5342
- handleClick(s) {
5343
- s.read || this.client.markRead(s.id);
5394
+ handleClick(n) {
5395
+ n.read || this.client.markRead(n.id);
5344
5396
  }
5345
- getActorName(s) {
5397
+ getActorName(n) {
5346
5398
  var e;
5347
- return ((e = this.client.state.getUser(s)) == null ? void 0 : e.name) ?? "Someone";
5399
+ return ((e = this.client.state.getUser(n)) == null ? void 0 : e.name) ?? "Someone";
5348
5400
  }
5349
- formatTime(s) {
5350
- const e = new Date(s), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(i / 6e4);
5351
- if (n < 1) return "now";
5352
- if (n < 60) return `${n}m`;
5353
- const o = Math.floor(n / 60);
5401
+ formatTime(n) {
5402
+ const e = new Date(n), i = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), s = Math.floor(i / 6e4);
5403
+ if (s < 1) return "now";
5404
+ if (s < 60) return `${s}m`;
5405
+ const o = Math.floor(s / 60);
5354
5406
  return o < 24 ? `${o}h` : e.toLocaleDateString();
5355
5407
  }
5356
5408
  render() {
5357
- const s = this.notifications.filter((e) => !e.read).length;
5358
- return h`
5409
+ const n = this.notifications.filter((e) => !e.read).length;
5410
+ return d`
5359
5411
  <div class="panel">
5360
5412
  <div class="panel-header">
5361
5413
  <span class="panel-title">
5362
5414
  Notifications
5363
- ${s > 0 ? h`<span class="unread-badge">${s}</span>` : m}
5415
+ ${n > 0 ? d`<span class="unread-badge">${n}</span>` : g}
5364
5416
  </span>
5365
5417
  <div style="display:flex;align-items:center;gap:4px;">
5366
- ${s > 0 ? h`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5418
+ ${n > 0 ? d`<button class="mark-all" @click=${() => this.client.markAllRead()}>
5367
5419
  Mark all read
5368
- </button>` : m}
5420
+ </button>` : g}
5369
5421
  <button class="close-btn" @click=${this.fireClose} title="Close">
5370
5422
  ${C(me, 16)}
5371
5423
  </button>
@@ -5373,11 +5425,11 @@ let de = class extends S {
5373
5425
  </div>
5374
5426
 
5375
5427
  <div class="panel-body pw-scrollable">
5376
- ${this.notifications.length === 0 ? h`<div class="empty">
5428
+ ${this.notifications.length === 0 ? d`<div class="empty">
5377
5429
  <div class="empty-icon">&#128276;</div>
5378
5430
  No notifications
5379
5431
  </div>` : this.notifications.map(
5380
- (e) => h`
5432
+ (e) => d`
5381
5433
  <div
5382
5434
  class="item ${e.read ? "" : "unread"}"
5383
5435
  @click=${() => this.handleClick(e)}
@@ -5403,7 +5455,7 @@ de.styles = [
5403
5455
  ee,
5404
5456
  ge,
5405
5457
  _e,
5406
- I`
5458
+ M`
5407
5459
  :host {
5408
5460
  display: block;
5409
5461
  }
@@ -5597,10 +5649,10 @@ de.styles = [
5597
5649
  `
5598
5650
  ];
5599
5651
  Ve([
5600
- b({ attribute: !1 })
5652
+ v({ attribute: !1 })
5601
5653
  ], de.prototype, "client", 2);
5602
5654
  Ve([
5603
- x()
5655
+ w()
5604
5656
  ], de.prototype, "notifications", 2);
5605
5657
  de = Ve([
5606
5658
  R("pulse-widget-notifications-panel")
@@ -5635,13 +5687,13 @@ class as {
5635
5687
  if (i)
5636
5688
  i.position = t;
5637
5689
  else {
5638
- const n = this.client.state.presence.find(
5690
+ const s = this.client.state.presence.find(
5639
5691
  (o) => o.user.id === e
5640
5692
  );
5641
- n && this.cursors.set(e, {
5693
+ s && this.cursors.set(e, {
5642
5694
  userId: e,
5643
- name: n.user.name,
5644
- color: n.user.color,
5695
+ name: s.user.name,
5696
+ color: s.user.color,
5645
5697
  position: t
5646
5698
  });
5647
5699
  }
@@ -5651,17 +5703,17 @@ class as {
5651
5703
  ), this.unsubs.push(
5652
5704
  this.client.state.on("presence", (e) => {
5653
5705
  var i;
5654
- const t = new Set(e.map((n) => n.user.id));
5655
- for (const n of this.cursors.keys())
5656
- t.has(n) || (this.cursors.delete(n), (i = this.cursorEls.get(n)) == null || i.remove(), this.cursorEls.delete(n), this.cursorLastSeen.delete(n));
5706
+ const t = new Set(e.map((s) => s.user.id));
5707
+ for (const s of this.cursors.keys())
5708
+ t.has(s) || (this.cursors.delete(s), (i = this.cursorEls.get(s)) == null || i.remove(), this.cursorEls.delete(s), this.cursorLastSeen.delete(s));
5657
5709
  })
5658
5710
  ), this.setSending(!0), this.staleTimer = setInterval(() => {
5659
5711
  const e = Date.now();
5660
5712
  for (const [t, i] of this.cursorLastSeen)
5661
5713
  if (e - i > rs) {
5662
5714
  this.cursors.delete(t);
5663
- const n = this.cursorEls.get(t);
5664
- n && n.remove(), this.cursorEls.delete(t), this.cursorLastSeen.delete(t);
5715
+ const s = this.cursorEls.get(t);
5716
+ s && s.remove(), this.cursorEls.delete(t), this.cursorLastSeen.delete(t);
5665
5717
  }
5666
5718
  }, 1e3));
5667
5719
  }
@@ -5685,7 +5737,7 @@ class as {
5685
5737
  if (!this.container) return;
5686
5738
  const i = this.client.state.presence.find(
5687
5739
  (r) => r.user.id === e
5688
- ), n = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
5740
+ ), s = (i == null ? void 0 : i.user.color) ?? "#6366f1", o = document.createElement("div");
5689
5741
  Object.assign(o.style, {
5690
5742
  position: "absolute",
5691
5743
  left: `${t.x}px`,
@@ -5693,7 +5745,7 @@ class as {
5693
5745
  width: "0px",
5694
5746
  height: "0px",
5695
5747
  borderRadius: "50%",
5696
- border: `3px solid ${n}`,
5748
+ border: `3px solid ${s}`,
5697
5749
  transform: "translate(-50%, -50%)",
5698
5750
  pointerEvents: "none",
5699
5751
  opacity: "1",
@@ -5704,8 +5756,8 @@ class as {
5704
5756
  }
5705
5757
  showEmojiDrop(e, t, i) {
5706
5758
  if (!this.container) return;
5707
- const n = document.createElement("div");
5708
- Object.assign(n.style, {
5759
+ const s = document.createElement("div");
5760
+ Object.assign(s.style, {
5709
5761
  position: "absolute",
5710
5762
  left: `${i.x}px`,
5711
5763
  top: `${i.y}px`,
@@ -5715,9 +5767,9 @@ class as {
5715
5767
  transform: "translate(-50%, 0)",
5716
5768
  zIndex: "10",
5717
5769
  lineHeight: "1"
5718
- }), n.textContent = t, this.container.appendChild(n), requestAnimationFrame(() => {
5719
- n.style.transform = "translate(-50%, -80px)", n.style.opacity = "0";
5720
- }), setTimeout(() => n.remove(), 2e3);
5770
+ }), s.textContent = t, this.container.appendChild(s), requestAnimationFrame(() => {
5771
+ s.style.transform = "translate(-50%, -80px)", s.style.opacity = "0";
5772
+ }), setTimeout(() => s.remove(), 2e3);
5721
5773
  }
5722
5774
  destroy() {
5723
5775
  this.disable();
@@ -5734,9 +5786,9 @@ class as {
5734
5786
  willChange: "transform",
5735
5787
  pointerEvents: "none"
5736
5788
  });
5737
- const n = t.color || "#e74c3c";
5789
+ const s = t.color || "#e74c3c";
5738
5790
  i.innerHTML = `
5739
- <svg width="24" height="24" viewBox="0 0 16 16" fill="${n}" style="filter:drop-shadow(0 2px 4px rgba(0,0,0,0.4))">
5791
+ <svg width="24" height="24" viewBox="0 0 16 16" fill="${s}" style="filter:drop-shadow(0 2px 4px rgba(0,0,0,0.4))">
5740
5792
  <path d="M0 0l6.5 16L8 9l7-2.5z" stroke="#fff" stroke-width="1"/>
5741
5793
  </svg>
5742
5794
  <span style="
@@ -5745,7 +5797,7 @@ class as {
5745
5797
  font-size:12px;font-weight:700;
5746
5798
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
5747
5799
  color:#fff;white-space:nowrap;
5748
- background:${n};
5800
+ background:${s};
5749
5801
  box-shadow:0 2px 10px rgba(0,0,0,0.25);
5750
5802
  letter-spacing:0.01em;
5751
5803
  ">${t.name}</span>
@@ -5759,26 +5811,26 @@ class ls {
5759
5811
  this.container = null, this.unsubs = [], this.enabled = !1, this.drawMode = !1, this.currentPoints = [], this.currentPath = null, this.lastPoint = null, this.fadeTimers = /* @__PURE__ */ new Map(), this.handlePointerDown = (t) => {
5760
5812
  var l, a, c;
5761
5813
  t.preventDefault(), (a = (l = t.target) == null ? void 0 : l.setPointerCapture) == null || a.call(l, t.pointerId), this.currentPoints = [{ x: t.clientX, y: t.clientY }], this.lastPoint = { x: t.clientX, y: t.clientY };
5762
- const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1", r = 2 + (t.pressure > 0 ? t.pressure : 0.5) * 4;
5814
+ const i = this.client.state.user, s = (i == null ? void 0 : i.color) ?? "#6366f1", r = 2 + (t.pressure > 0 ? t.pressure : 0.5) * 4;
5763
5815
  this.currentPath = document.createElementNS(
5764
5816
  "http://www.w3.org/2000/svg",
5765
5817
  "polyline"
5766
- ), this.currentPath.setAttribute("fill", "none"), this.currentPath.setAttribute("stroke", n), this.currentPath.setAttribute("stroke-width", String(r)), this.currentPath.setAttribute("stroke-linecap", "round"), this.currentPath.setAttribute("stroke-linejoin", "round"), this.currentPath.setAttribute(
5818
+ ), this.currentPath.setAttribute("fill", "none"), this.currentPath.setAttribute("stroke", s), this.currentPath.setAttribute("stroke-width", String(r)), this.currentPath.setAttribute("stroke-linecap", "round"), this.currentPath.setAttribute("stroke-linejoin", "round"), this.currentPath.setAttribute(
5767
5819
  "points",
5768
5820
  `${t.clientX},${t.clientY}`
5769
5821
  ), (c = this.container) == null || c.appendChild(this.currentPath), document.addEventListener("pointermove", this.handlePointerMove), document.addEventListener("pointerup", this.handlePointerUp);
5770
5822
  }, this.handlePointerMove = (t) => {
5771
5823
  if (!this.currentPath || !this.lastPoint) return;
5772
- const i = t.clientX - this.lastPoint.x, n = t.clientY - this.lastPoint.y;
5773
- if (i * i + n * n < 4) return;
5824
+ const i = t.clientX - this.lastPoint.x, s = t.clientY - this.lastPoint.y;
5825
+ if (i * i + s * s < 4) return;
5774
5826
  this.currentPoints.push({ x: t.clientX, y: t.clientY }), this.lastPoint = { x: t.clientX, y: t.clientY };
5775
5827
  const o = this.currentPoints.map((r) => `${r.x},${r.y}`).join(" ");
5776
5828
  this.currentPath.setAttribute("points", o);
5777
5829
  }, this.handlePointerUp = () => {
5778
5830
  var t;
5779
5831
  if (document.removeEventListener("pointermove", this.handlePointerMove), document.removeEventListener("pointerup", this.handlePointerUp), this.currentPoints.length > 1) {
5780
- const i = this.client.state.user, n = (i == null ? void 0 : i.color) ?? "#6366f1";
5781
- this.client.drawStroke(this.currentPoints, n, 3), this.currentPath && this.scheduleFade(this.currentPath);
5832
+ const i = this.client.state.user, s = (i == null ? void 0 : i.color) ?? "#6366f1";
5833
+ this.client.drawStroke(this.currentPoints, s, 3), this.currentPath && this.scheduleFade(this.currentPath);
5782
5834
  } else
5783
5835
  (t = this.currentPath) == null || t.remove();
5784
5836
  this.currentPoints = [], this.currentPath = null, this.lastPoint = null;
@@ -5792,8 +5844,8 @@ class ls {
5792
5844
  "style",
5793
5845
  "position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:9989;"
5794
5846
  ), document.body.appendChild(this.container), this.unsubs.push(
5795
- this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width: n }) => {
5796
- this.renderStroke(t, i, n);
5847
+ this.client.state.on("draw-stroke", ({ userId: e, points: t, color: i, width: s }) => {
5848
+ this.renderStroke(t, i, s);
5797
5849
  })
5798
5850
  ), this.unsubs.push(
5799
5851
  this.client.state.on("draw-clear", ({ userId: e }) => {
@@ -5819,14 +5871,14 @@ class ls {
5819
5871
  }
5820
5872
  renderStroke(e, t, i) {
5821
5873
  if (!this.container || e.length < 2) return;
5822
- const n = document.createElementNS(
5874
+ const s = document.createElementNS(
5823
5875
  "http://www.w3.org/2000/svg",
5824
5876
  "polyline"
5825
5877
  );
5826
- n.setAttribute("fill", "none"), n.setAttribute("stroke", t), n.setAttribute("stroke-width", String(i)), n.setAttribute("stroke-linecap", "round"), n.setAttribute("stroke-linejoin", "round"), n.setAttribute(
5878
+ s.setAttribute("fill", "none"), s.setAttribute("stroke", t), s.setAttribute("stroke-width", String(i)), s.setAttribute("stroke-linecap", "round"), s.setAttribute("stroke-linejoin", "round"), s.setAttribute(
5827
5879
  "points",
5828
5880
  e.map((o) => `${o.x},${o.y}`).join(" ")
5829
- ), n.style.willChange = "opacity", this.container.appendChild(n), this.scheduleFade(n);
5881
+ ), s.style.willChange = "opacity", this.container.appendChild(s), this.scheduleFade(s);
5830
5882
  }
5831
5883
  scheduleFade(e) {
5832
5884
  const t = setTimeout(() => {
@@ -5837,48 +5889,48 @@ class ls {
5837
5889
  this.fadeTimers.set(e, t);
5838
5890
  }
5839
5891
  }
5840
- function cs(s) {
5841
- if (!s.rangeCount || s.isCollapsed) return null;
5842
- const e = s.getRangeAt(0), t = e.startContainer, i = e.endContainer, n = ft(t), o = ft(i);
5843
- return !n || !o ? null : {
5844
- startSelector: n,
5892
+ function cs(n) {
5893
+ if (!n.rangeCount || n.isCollapsed) return null;
5894
+ const e = n.getRangeAt(0), t = e.startContainer, i = e.endContainer, s = ft(t), o = ft(i);
5895
+ return !s || !o ? null : {
5896
+ startSelector: s,
5845
5897
  startOffset: e.startOffset,
5846
5898
  endSelector: o,
5847
5899
  endOffset: e.endOffset
5848
5900
  };
5849
5901
  }
5850
- function ds(s) {
5902
+ function ds(n) {
5851
5903
  var e, t;
5852
5904
  try {
5853
- const i = gt(s.startSelector), n = gt(s.endSelector);
5854
- if (!i || !n) return null;
5855
- const o = document.createRange(), r = i.nodeType === Node.TEXT_NODE ? ((e = i.textContent) == null ? void 0 : e.length) ?? 0 : i.childNodes.length, l = n.nodeType === Node.TEXT_NODE ? ((t = n.textContent) == null ? void 0 : t.length) ?? 0 : n.childNodes.length;
5856
- return o.setStart(i, Math.min(s.startOffset, r)), o.setEnd(n, Math.min(s.endOffset, l)), o;
5905
+ const i = gt(n.startSelector), s = gt(n.endSelector);
5906
+ if (!i || !s) return null;
5907
+ const o = document.createRange(), r = i.nodeType === Node.TEXT_NODE ? ((e = i.textContent) == null ? void 0 : e.length) ?? 0 : i.childNodes.length, l = s.nodeType === Node.TEXT_NODE ? ((t = s.textContent) == null ? void 0 : t.length) ?? 0 : s.childNodes.length;
5908
+ return o.setStart(i, Math.min(n.startOffset, r)), o.setEnd(s, Math.min(n.endOffset, l)), o;
5857
5909
  } catch {
5858
5910
  return null;
5859
5911
  }
5860
5912
  }
5861
- function ft(s) {
5862
- if (s.nodeType === Node.TEXT_NODE) {
5863
- const e = s.parentElement;
5913
+ function ft(n) {
5914
+ if (n.nodeType === Node.TEXT_NODE) {
5915
+ const e = n.parentElement;
5864
5916
  if (!e) return null;
5865
5917
  const t = mt(e);
5866
5918
  if (!t) return null;
5867
- const i = Array.from(e.childNodes).indexOf(s);
5919
+ const i = Array.from(e.childNodes).indexOf(n);
5868
5920
  return `${t}::text(${i})`;
5869
5921
  }
5870
- return s.nodeType === Node.ELEMENT_NODE ? mt(s) : null;
5922
+ return n.nodeType === Node.ELEMENT_NODE ? mt(n) : null;
5871
5923
  }
5872
- function mt(s) {
5873
- if (!s || s === document.documentElement) return "html";
5874
- if (s === document.body) return "body";
5875
- if (s.id) return `#${CSS.escape(s.id)}`;
5924
+ function mt(n) {
5925
+ if (!n || n === document.documentElement) return "html";
5926
+ if (n === document.body) return "body";
5927
+ if (n.id) return `#${CSS.escape(n.id)}`;
5876
5928
  const e = [];
5877
- let t = s, i = 0;
5929
+ let t = n, i = 0;
5878
5930
  for (; t && t !== document.body && i < 10; ) {
5879
- const n = t.parentElement;
5880
- if (!n) break;
5881
- const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(n.children).filter(
5931
+ const s = t.parentElement;
5932
+ if (!s) break;
5933
+ const o = t.tagName.toLowerCase(), r = t.tagName, l = Array.from(s.children).filter(
5882
5934
  (a) => a.tagName === r
5883
5935
  );
5884
5936
  if (l.length === 1)
@@ -5887,27 +5939,27 @@ function mt(s) {
5887
5939
  const a = l.indexOf(t) + 1;
5888
5940
  e.unshift(`${o}:nth-of-type(${a})`);
5889
5941
  }
5890
- if (n.id) {
5891
- e.unshift(`#${CSS.escape(n.id)}`);
5942
+ if (s.id) {
5943
+ e.unshift(`#${CSS.escape(s.id)}`);
5892
5944
  break;
5893
5945
  }
5894
- t = n, i++;
5946
+ t = s, i++;
5895
5947
  }
5896
5948
  return e.length > 0 ? e.join(" > ") : null;
5897
5949
  }
5898
- function gt(s) {
5899
- const e = s.match(/^(.+)::text\((\d+)\)$/);
5950
+ function gt(n) {
5951
+ const e = n.match(/^(.+)::text\((\d+)\)$/);
5900
5952
  if (e) {
5901
5953
  const t = e[1], i = parseInt(e[2], 10);
5902
5954
  try {
5903
- const n = document.querySelector(t);
5904
- return n ? n.childNodes[i] ?? null : null;
5955
+ const s = document.querySelector(t);
5956
+ return s ? s.childNodes[i] ?? null : null;
5905
5957
  } catch {
5906
5958
  return null;
5907
5959
  }
5908
5960
  }
5909
5961
  try {
5910
- return document.querySelector(s);
5962
+ return document.querySelector(n);
5911
5963
  } catch {
5912
5964
  return null;
5913
5965
  }
@@ -5956,26 +6008,26 @@ class hs {
5956
6008
  if (!this.container) return;
5957
6009
  const i = (l = this.client.state.user) == null ? void 0 : l.id;
5958
6010
  if (e === i || (this.clearSelection(e), !t)) return;
5959
- const n = ds(t);
5960
- if (!n) return;
6011
+ const s = ds(t);
6012
+ if (!s) return;
5961
6013
  const o = this.client.state.presence.find(
5962
6014
  (a) => a.user.id === e
5963
6015
  ), r = (o == null ? void 0 : o.user.color) ?? "#6366f1";
5964
6016
  try {
5965
- const a = n.getClientRects(), c = [];
5966
- for (let p = 0; p < a.length; p++) {
5967
- const d = a[p], f = document.createElement("div");
5968
- Object.assign(f.style, {
6017
+ const a = s.getClientRects(), c = [];
6018
+ for (let h = 0; h < a.length; h++) {
6019
+ const p = a[h], u = document.createElement("div");
6020
+ Object.assign(u.style, {
5969
6021
  position: "absolute",
5970
- left: `${d.left}px`,
5971
- top: `${d.top}px`,
5972
- width: `${d.width}px`,
5973
- height: `${d.height}px`,
6022
+ left: `${p.left}px`,
6023
+ top: `${p.top}px`,
6024
+ width: `${p.width}px`,
6025
+ height: `${p.height}px`,
5974
6026
  background: r,
5975
6027
  opacity: "0.2",
5976
6028
  borderRadius: "2px",
5977
6029
  pointerEvents: "none"
5978
- }), this.container.appendChild(f), c.push(f);
6030
+ }), this.container.appendChild(u), c.push(u);
5979
6031
  }
5980
6032
  this.selectionEls.set(e, c);
5981
6033
  } catch {
@@ -5995,10 +6047,10 @@ class hs {
5995
6047
  }
5996
6048
  }
5997
6049
  }
5998
- var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, qe = (s, e, t, i) => {
5999
- for (var n = i > 1 ? void 0 : i ? us(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6000
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6001
- return i && n && ps(e, t, n), n;
6050
+ var ps = Object.defineProperty, us = Object.getOwnPropertyDescriptor, qe = (n, e, t, i) => {
6051
+ for (var s = i > 1 ? void 0 : i ? us(e, t) : e, o = n.length - 1, r; o >= 0; o--)
6052
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
6053
+ return i && s && ps(e, t, s), s;
6002
6054
  };
6003
6055
  let he = class extends S {
6004
6056
  constructor() {
@@ -6009,8 +6061,8 @@ let he = class extends S {
6009
6061
  new CustomEvent("panel-close", { bubbles: !0, composed: !0 })
6010
6062
  );
6011
6063
  }
6012
- toggle(s) {
6013
- const e = { ...this.settings, [s]: !this.settings[s] };
6064
+ toggle(n) {
6065
+ const e = { ...this.settings, [n]: !this.settings[n] };
6014
6066
  this.dispatchEvent(
6015
6067
  new CustomEvent("settings-change", {
6016
6068
  detail: e,
@@ -6019,10 +6071,10 @@ let he = class extends S {
6019
6071
  })
6020
6072
  );
6021
6073
  }
6022
- renderToggle(s, e) {
6023
- return h`
6074
+ renderToggle(n, e) {
6075
+ return d`
6024
6076
  <div class="setting-row">
6025
- <span class="setting-label">${s}</span>
6077
+ <span class="setting-label">${n}</span>
6026
6078
  <label class="toggle">
6027
6079
  <input
6028
6080
  type="checkbox"
@@ -6035,8 +6087,8 @@ let he = class extends S {
6035
6087
  `;
6036
6088
  }
6037
6089
  render() {
6038
- const s = !this.settings.enabled;
6039
- return h`
6090
+ const n = !this.settings.enabled;
6091
+ return d`
6040
6092
  <div class="panel">
6041
6093
  <div class="panel-header">
6042
6094
  <span class="panel-title">Settings</span>
@@ -6060,7 +6112,7 @@ let he = class extends S {
6060
6112
  </label>
6061
6113
  </div>
6062
6114
 
6063
- <div class="panel-body pw-scrollable ${s ? "settings-disabled" : ""}">
6115
+ <div class="panel-body pw-scrollable ${n ? "settings-disabled" : ""}">
6064
6116
  <div class="section-label">Cursors</div>
6065
6117
  ${this.renderToggle("Show my cursor to others", "showMyCursor")}
6066
6118
  ${this.renderToggle("Show others' cursors", "showOthersCursors")}
@@ -6090,7 +6142,7 @@ he.styles = [
6090
6142
  ee,
6091
6143
  ge,
6092
6144
  _e,
6093
- I`
6145
+ M`
6094
6146
  :host {
6095
6147
  display: block;
6096
6148
  }
@@ -6262,10 +6314,10 @@ he.styles = [
6262
6314
  `
6263
6315
  ];
6264
6316
  qe([
6265
- b({ attribute: !1 })
6317
+ v({ attribute: !1 })
6266
6318
  ], he.prototype, "settings", 2);
6267
6319
  qe([
6268
- b()
6320
+ v()
6269
6321
  ], he.prototype, "roomId", 2);
6270
6322
  he = qe([
6271
6323
  R("pulse-widget-settings-panel")
@@ -6282,23 +6334,23 @@ const ye = {
6282
6334
  showSelections: !0,
6283
6335
  showDrawings: !0
6284
6336
  }, St = "pulse:settings:";
6285
- function fs(s) {
6337
+ function fs(n) {
6286
6338
  try {
6287
- const e = localStorage.getItem(`${St}${s}`);
6339
+ const e = localStorage.getItem(`${St}${n}`);
6288
6340
  return e ? { ...ye, ...JSON.parse(e) } : { ...ye };
6289
6341
  } catch {
6290
6342
  return { ...ye };
6291
6343
  }
6292
6344
  }
6293
- function ms(s, e) {
6294
- localStorage.setItem(`${St}${s}`, JSON.stringify(e));
6345
+ function ms(n, e) {
6346
+ localStorage.setItem(`${St}${n}`, JSON.stringify(e));
6295
6347
  }
6296
- var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (s, e, t, i) => {
6297
- for (var n = i > 1 ? void 0 : i ? bs(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6298
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6299
- return i && n && gs(e, t, n), n;
6348
+ var gs = Object.defineProperty, bs = Object.getOwnPropertyDescriptor, L = (n, e, t, i) => {
6349
+ for (var s = i > 1 ? void 0 : i ? bs(e, t) : e, o = n.length - 1, r; o >= 0; o--)
6350
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
6351
+ return i && s && gs(e, t, s), s;
6300
6352
  };
6301
- let M = class extends S {
6353
+ let O = class extends S {
6302
6354
  constructor() {
6303
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;
6304
6356
  }
@@ -6306,36 +6358,36 @@ let M = class extends S {
6306
6358
  super.connectedCallback(), this.setupPresence();
6307
6359
  }
6308
6360
  disconnectedCallback() {
6309
- var s, e;
6310
- super.disconnectedCallback(), (s = this.unsub) == null || s.call(this), (e = this.notifUnsub) == null || e.call(this);
6361
+ var n, e;
6362
+ super.disconnectedCallback(), (n = this.unsub) == null || n.call(this), (e = this.notifUnsub) == null || e.call(this);
6311
6363
  }
6312
- updated(s) {
6364
+ updated(n) {
6313
6365
  var e, t;
6314
- s.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.notifUnsub) == null || t.call(this), this.setupPresence());
6366
+ n.has("client") && this.client && ((e = this.unsub) == null || e.call(this), (t = this.notifUnsub) == null || t.call(this), this.setupPresence());
6315
6367
  }
6316
6368
  setupPresence() {
6317
- this.client && (this.users = this.client.state.presence, this.unreadCount = this.client.state.unreadCount, this.unsub = this.client.state.on("presence", (s) => {
6318
- this.users = s;
6369
+ this.client && (this.users = this.client.state.presence, this.unreadCount = this.client.state.unreadCount, this.unsub = this.client.state.on("presence", (n) => {
6370
+ this.users = n;
6319
6371
  }), this.notifUnsub = this.client.state.on("notifications", () => {
6320
6372
  this.unreadCount = this.client.state.unreadCount;
6321
6373
  }));
6322
6374
  }
6323
- getInitials(s) {
6324
- return s.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
6375
+ getInitials(n) {
6376
+ return n.split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
6325
6377
  }
6326
- fire(s) {
6378
+ fire(n) {
6327
6379
  this.dispatchEvent(
6328
6380
  new CustomEvent("toolbar-action", {
6329
- detail: s,
6381
+ detail: n,
6330
6382
  bubbles: !0,
6331
6383
  composed: !0
6332
6384
  })
6333
6385
  );
6334
6386
  }
6335
- fireFollow(s) {
6387
+ fireFollow(n) {
6336
6388
  this.dispatchEvent(
6337
6389
  new CustomEvent("toolbar-follow", {
6338
- detail: s,
6390
+ detail: n,
6339
6391
  bubbles: !0,
6340
6392
  composed: !0
6341
6393
  })
@@ -6347,37 +6399,37 @@ let M = class extends S {
6347
6399
  );
6348
6400
  }
6349
6401
  render() {
6350
- const s = this.display === "inline";
6402
+ const n = this.display === "inline";
6351
6403
  if (this.collapsed)
6352
- return h`
6353
- <div class="toolbar collapsed ${s ? "inline" : ""}" @click=${this.fireToggle}>
6354
- <span class="fab-icon">${C(Ri, s ? 18 : 24)}</span>
6404
+ return d`
6405
+ <div class="toolbar collapsed ${n ? "inline" : ""}" @click=${this.fireToggle}>
6406
+ <span class="fab-icon">${C(Ri, n ? 18 : 24)}</span>
6355
6407
  </div>
6356
6408
  `;
6357
6409
  const e = this.users.slice(0, 3), t = this.users.length - 3;
6358
- return h`
6359
- <div class="toolbar ${s ? "inline" : ""}"
6410
+ return d`
6411
+ <div class="toolbar ${n ? "inline" : ""}"
6360
6412
  <!-- Presence avatars -->
6361
- ${this.users.length > 0 ? h`
6413
+ ${this.users.length > 0 ? d`
6362
6414
  <div class="presence">
6363
- ${t > 0 ? h`<div class="presence-overflow">+${t}</div>` : m}
6415
+ ${t > 0 ? d`<div class="presence-overflow">+${t}</div>` : g}
6364
6416
  ${e.map(
6365
- (i) => h`
6417
+ (i) => d`
6366
6418
  <div
6367
6419
  class="presence-avatar clickable ${this.followingUserId === i.user.id ? "following" : ""}"
6368
6420
  style="background:${i.user.color}"
6369
6421
  @click=${() => this.fireFollow(i.user.id)}
6370
6422
  title="Click to follow ${i.user.name}"
6371
6423
  >
6372
- ${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)}
6373
6425
  <span class="presence-tooltip">${i.user.name}</span>
6374
- ${i.deviceType && i.deviceType !== "desktop" ? h`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : m}
6426
+ ${i.deviceType && i.deviceType !== "desktop" ? d`<span class="device-icon">${i.deviceType === "mobile" ? "📱" : "📲"}</span>` : g}
6375
6427
  </div>
6376
6428
  `
6377
6429
  )}
6378
6430
  </div>
6379
6431
  <div class="separator"></div>
6380
- ` : m}
6432
+ ` : g}
6381
6433
 
6382
6434
  <!-- Pin comment (primary) -->
6383
6435
  <button
@@ -6432,7 +6484,7 @@ let M = class extends S {
6432
6484
  style="${this.featuresDisabled ? "opacity:0.35;pointer-events:none" : "position:relative"}"
6433
6485
  >
6434
6486
  ${C(Ei)}
6435
- ${this.unreadCount > 0 ? h`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : m}
6487
+ ${this.unreadCount > 0 ? d`<span class="badge">${this.unreadCount > 9 ? "9+" : this.unreadCount}</span>` : g}
6436
6488
  </button>
6437
6489
 
6438
6490
  <!-- Settings -->
@@ -6458,10 +6510,10 @@ let M = class extends S {
6458
6510
  `;
6459
6511
  }
6460
6512
  };
6461
- M.styles = [
6513
+ O.styles = [
6462
6514
  ee,
6463
6515
  ge,
6464
- I`
6516
+ M`
6465
6517
  :host {
6466
6518
  display: block;
6467
6519
  }
@@ -6674,38 +6726,38 @@ M.styles = [
6674
6726
  `
6675
6727
  ];
6676
6728
  L([
6677
- b({ attribute: !1 })
6678
- ], M.prototype, "client", 2);
6729
+ v({ attribute: !1 })
6730
+ ], O.prototype, "client", 2);
6679
6731
  L([
6680
- b({ type: Boolean })
6681
- ], M.prototype, "collapsed", 2);
6732
+ v({ type: Boolean })
6733
+ ], O.prototype, "collapsed", 2);
6682
6734
  L([
6683
- b()
6684
- ], M.prototype, "activePanel", 2);
6735
+ v()
6736
+ ], O.prototype, "activePanel", 2);
6685
6737
  L([
6686
- b({ type: Boolean })
6687
- ], M.prototype, "pinModeActive", 2);
6738
+ v({ type: Boolean })
6739
+ ], O.prototype, "pinModeActive", 2);
6688
6740
  L([
6689
- b({ type: Boolean })
6690
- ], M.prototype, "featuresDisabled", 2);
6741
+ v({ type: Boolean })
6742
+ ], O.prototype, "featuresDisabled", 2);
6691
6743
  L([
6692
- b({ type: Boolean })
6693
- ], M.prototype, "drawModeActive", 2);
6744
+ v({ type: Boolean })
6745
+ ], O.prototype, "drawModeActive", 2);
6694
6746
  L([
6695
- b()
6696
- ], M.prototype, "followingUserId", 2);
6747
+ v()
6748
+ ], O.prototype, "followingUserId", 2);
6697
6749
  L([
6698
- b()
6699
- ], M.prototype, "display", 2);
6750
+ v()
6751
+ ], O.prototype, "display", 2);
6700
6752
  L([
6701
- x()
6702
- ], M.prototype, "users", 2);
6753
+ w()
6754
+ ], O.prototype, "users", 2);
6703
6755
  L([
6704
- x()
6705
- ], M.prototype, "unreadCount", 2);
6706
- M = L([
6756
+ w()
6757
+ ], O.prototype, "unreadCount", 2);
6758
+ O = L([
6707
6759
  R("pulse-widget-toolbar")
6708
- ], M);
6760
+ ], O);
6709
6761
  class vs {
6710
6762
  constructor(e) {
6711
6763
  this.container = null, this.unsubs = [], this.enabled = !1, this.pillEls = /* @__PURE__ */ new Map(), this.client = e;
@@ -6744,23 +6796,23 @@ class vs {
6744
6796
  this.pillEls.clear();
6745
6797
  return;
6746
6798
  }
6747
- const e = window.scrollY, t = window.innerHeight, i = document.documentElement.scrollHeight, n = (r = this.client.state.user) == null ? void 0 : r.id, o = /* @__PURE__ */ new Set();
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();
6748
6800
  for (const [l, a] of this.client.state.viewports) {
6749
- if (l === n) continue;
6750
- const c = a.scrollY, p = a.scrollY + a.viewportHeight, d = e, f = e + t;
6751
- if (c >= d && p <= f) {
6801
+ if (l === s) continue;
6802
+ const c = a.scrollY, h = a.scrollY + a.viewportHeight, p = e, u = e + t;
6803
+ if (c >= p && h <= u) {
6752
6804
  const E = this.pillEls.get(l);
6753
6805
  E && (E.style.display = "none");
6754
6806
  continue;
6755
6807
  }
6756
6808
  o.add(l);
6757
- const u = this.client.state.presence.find(
6809
+ const f = this.client.state.presence.find(
6758
6810
  (E) => E.user.id === l
6759
6811
  );
6760
- if (!u) continue;
6761
- const g = a.scrollY + a.viewportHeight / 2, v = i > 0 ? g / i : 0, $ = Math.max(
6812
+ if (!f) continue;
6813
+ const m = a.scrollY + a.viewportHeight / 2, x = i > 0 ? m / i : 0, b = Math.max(
6762
6814
  8,
6763
- Math.min(t - 28, v * t)
6815
+ Math.min(t - 28, x * t)
6764
6816
  );
6765
6817
  let y = this.pillEls.get(l);
6766
6818
  y || (y = document.createElement("div"), Object.assign(y.style, {
@@ -6775,7 +6827,7 @@ class vs {
6775
6827
  whiteSpace: "nowrap",
6776
6828
  pointerEvents: "none",
6777
6829
  transition: "top 0.3s ease"
6778
- }), this.container.appendChild(y), this.pillEls.set(l, y)), y.style.display = "", y.style.background = u.user.color, y.style.top = `${$}px`, y.textContent = this.getInitials(u.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);
6779
6831
  }
6780
6832
  for (const [l, a] of this.pillEls)
6781
6833
  !o.has(l) && !this.client.state.viewports.has(l) && (a.remove(), this.pillEls.delete(l));
@@ -6784,17 +6836,17 @@ class vs {
6784
6836
  return e.split(" ").map((t) => t[0]).join("").toUpperCase().slice(0, 2);
6785
6837
  }
6786
6838
  }
6787
- var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, P = (s, e, t, i) => {
6788
- for (var n = i > 1 ? void 0 : i ? ys(e, t) : e, o = s.length - 1, r; o >= 0; o--)
6789
- (r = s[o]) && (n = (i ? r(e, t, n) : r(n)) || n);
6790
- return i && n && xs(e, t, n), n;
6839
+ var xs = Object.defineProperty, ys = Object.getOwnPropertyDescriptor, A = (n, e, t, i) => {
6840
+ for (var s = i > 1 ? void 0 : i ? ys(e, t) : e, o = n.length - 1, r; o >= 0; o--)
6841
+ (r = n[o]) && (s = (i ? r(e, t, s) : r(s)) || s);
6842
+ return i && s && xs(e, t, s), s;
6791
6843
  };
6792
6844
  let _ = class extends S {
6793
6845
  constructor() {
6794
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 = () => {
6795
6847
  !this.settings.enabled || !this.client || this._isFollowScrolling || (this.followingUserId && (this.followingUserId = null), !this._viewportThrottleTimer && (this._viewportThrottleTimer = setTimeout(() => {
6796
- var s;
6797
- this._viewportThrottleTimer = null, (s = this.client) == null || s.updateViewport({
6848
+ var n;
6849
+ this._viewportThrottleTimer = null, (n = this.client) == null || n.updateViewport({
6798
6850
  scrollX: window.scrollX,
6799
6851
  scrollY: window.scrollY,
6800
6852
  viewportWidth: window.innerWidth,
@@ -6807,25 +6859,25 @@ let _ = class extends S {
6807
6859
  !this.settings.enabled || !this.settings.showSelections || !this.client || this._selectionThrottleTimer || (this._selectionThrottleTimer = setTimeout(() => {
6808
6860
  var t, i;
6809
6861
  this._selectionThrottleTimer = null;
6810
- const s = window.getSelection();
6811
- if (!s || s.isCollapsed) {
6862
+ const n = window.getSelection();
6863
+ if (!n || n.isCollapsed) {
6812
6864
  (t = this.client) == null || t.updateSelection(null);
6813
6865
  return;
6814
6866
  }
6815
- const e = cs(s);
6867
+ const e = cs(n);
6816
6868
  (i = this.client) == null || i.updateSelection(e);
6817
6869
  }, 500));
6818
- }, this.handleDocumentClick = (s) => {
6870
+ }, this.handleDocumentClick = (n) => {
6819
6871
  var e;
6820
- this.settings.enabled && this.settings.showMyClicks && (this.contains(s.target) || (e = this.client) == null || e.performClick({
6821
- x: s.clientX,
6822
- y: s.clientY,
6823
- pageX: s.pageX,
6824
- pageY: s.pageY
6872
+ this.settings.enabled && this.settings.showMyClicks && (this.contains(n.target) || (e = this.client) == null || e.performClick({
6873
+ x: n.clientX,
6874
+ y: n.clientY,
6875
+ pageX: n.pageX,
6876
+ pageY: n.pageY
6825
6877
  }));
6826
- }, this.handleKeydown = (s) => {
6878
+ }, this.handleKeydown = (n) => {
6827
6879
  var e, t;
6828
- s.key === "Escape" && (this.drawModeActive ? ((e = this.drawingOverlay) == null || e.disableDrawMode(), this.drawModeActive = !1) : this.followingUserId ? this.followingUserId = null : this.pinModeActive ? ((t = this.commentPins) == null || t.exitPinMode(), this.pinModeActive = !1) : this.activePanel && (this.activePanel = null, this.highlightThreadId = null));
6880
+ n.key === "Escape" && (this.drawModeActive ? ((e = this.drawingOverlay) == null || e.disableDrawMode(), this.drawModeActive = !1) : this.followingUserId ? this.followingUserId = null : this.pinModeActive ? ((t = this.commentPins) == null || t.exitPinMode(), this.pinModeActive = !1) : this.activePanel && (this.activePanel = null, this.highlightThreadId = null));
6829
6881
  };
6830
6882
  }
6831
6883
  connectedCallback() {
@@ -6838,13 +6890,13 @@ let _ = class extends S {
6838
6890
  return `${this.apiKey}\0${this.token}\0${this.room}\0${this.endpoint ?? ""}`;
6839
6891
  }
6840
6892
  initClient() {
6841
- const s = {
6893
+ const n = {
6842
6894
  apiKey: this.apiKey,
6843
6895
  token: this.token,
6844
6896
  room: this.room,
6845
6897
  endpoint: this.endpoint
6846
6898
  };
6847
- this.client = new xt(s), this.clientConfigKey = this.getConfigKey(), this.cursorOverlay = new as(this.client), this.commentPins = new Ji(this.client, {
6899
+ this.client = new xt(n), this.clientConfigKey = this.getConfigKey(), this.cursorOverlay = new as(this.client), this.commentPins = new Ji(this.client, {
6848
6900
  onPinModeExit: () => {
6849
6901
  this.pinModeActive = !1;
6850
6902
  }
@@ -6878,15 +6930,15 @@ let _ = class extends S {
6878
6930
  ), window.addEventListener("scroll", this.handleScroll), document.addEventListener("selectionchange", this.handleSelectionChange), this.client.connect();
6879
6931
  }
6880
6932
  teardownClient() {
6881
- var s, e, t, i, n, o;
6882
- this.unsubs.forEach((r) => r()), this.unsubs = [], window.removeEventListener("scroll", this.handleScroll), document.removeEventListener("selectionchange", this.handleSelectionChange), this._viewportThrottleTimer && (clearTimeout(this._viewportThrottleTimer), this._viewportThrottleTimer = null), this._selectionThrottleTimer && (clearTimeout(this._selectionThrottleTimer), this._selectionThrottleTimer = null), (s = this.cursorOverlay) == null || s.destroy(), (e = this.commentPins) == null || e.destroy(), (t = this.viewportOverlay) == null || t.destroy(), (i = this.selectionOverlay) == null || i.destroy(), (n = this.drawingOverlay) == null || n.destroy(), (o = this.client) == null || o.disconnect(), this.client = void 0, this.cursorOverlay = void 0, this.commentPins = void 0, this.viewportOverlay = void 0, this.selectionOverlay = void 0, this.drawingOverlay = void 0, this.clientConfigKey = "", this.followingUserId = null, this.drawModeActive = !1, this.connectionState = "disconnected", this.showConnectedFlash = !1, this._wasDisconnected = !1, this._connectedFlashTimer && (clearTimeout(this._connectedFlashTimer), this._connectedFlashTimer = null);
6933
+ var n, e, t, i, s, o;
6934
+ this.unsubs.forEach((r) => r()), this.unsubs = [], window.removeEventListener("scroll", this.handleScroll), document.removeEventListener("selectionchange", this.handleSelectionChange), this._viewportThrottleTimer && (clearTimeout(this._viewportThrottleTimer), this._viewportThrottleTimer = null), this._selectionThrottleTimer && (clearTimeout(this._selectionThrottleTimer), this._selectionThrottleTimer = null), (n = this.cursorOverlay) == null || n.destroy(), (e = this.commentPins) == null || e.destroy(), (t = this.viewportOverlay) == null || t.destroy(), (i = this.selectionOverlay) == null || i.destroy(), (s = this.drawingOverlay) == null || s.destroy(), (o = this.client) == null || o.disconnect(), this.client = void 0, this.cursorOverlay = void 0, this.commentPins = void 0, this.viewportOverlay = void 0, this.selectionOverlay = void 0, this.drawingOverlay = void 0, this.clientConfigKey = "", this.followingUserId = null, this.drawModeActive = !1, this.connectionState = "disconnected", this.showConnectedFlash = !1, this._wasDisconnected = !1, this._connectedFlashTimer && (clearTimeout(this._connectedFlashTimer), this._connectedFlashTimer = null);
6883
6935
  }
6884
6936
  handlePanelClose() {
6885
6937
  this.activePanel = null, this.highlightThreadId = null;
6886
6938
  }
6887
- handleToolbarAction(s) {
6888
- var t, i, n, o;
6889
- const e = s.detail;
6939
+ handleToolbarAction(n) {
6940
+ var t, i, s, o;
6941
+ const e = n.detail;
6890
6942
  if (!(!this.settings.enabled && e !== "settings"))
6891
6943
  switch (e) {
6892
6944
  case "comments":
@@ -6905,118 +6957,118 @@ let _ = class extends S {
6905
6957
  this.pinModeActive = !this.pinModeActive, this.pinModeActive ? (t = this.commentPins) == null || t.enterPinMode() : (i = this.commentPins) == null || i.exitPinMode();
6906
6958
  break;
6907
6959
  case "draw-mode":
6908
- this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (n = this.drawingOverlay) == null || n.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
6960
+ this.drawModeActive = !this.drawModeActive, this.drawModeActive ? (s = this.drawingOverlay) == null || s.enableDrawMode() : (o = this.drawingOverlay) == null || o.disableDrawMode();
6909
6961
  break;
6910
6962
  }
6911
6963
  }
6912
- handleFollow(s) {
6913
- const e = s.detail;
6964
+ handleFollow(n) {
6965
+ const e = n.detail;
6914
6966
  this.followingUserId === e ? this.followingUserId = null : this.followingUserId = e;
6915
6967
  }
6916
- handleSettingsChange(s) {
6917
- const e = s.detail;
6968
+ handleSettingsChange(n) {
6969
+ const e = n.detail;
6918
6970
  this.settings = e, ms(this.room, e), this.applySettings(e);
6919
6971
  }
6920
- applySettings(s) {
6921
- var e, t, i, n, o, r, l, a, c, p, d, f, u, g, v, $, y;
6922
- if (!s.enabled) {
6923
- (e = this.cursorOverlay) == null || e.disable(), (t = this.viewportOverlay) == null || t.disable(), (i = this.selectionOverlay) == null || i.disable(), (n = this.drawingOverlay) == null || n.disable(), this.drawModeActive && ((o = this.drawingOverlay) == null || o.disableDrawMode(), this.drawModeActive = !1), (r = this.client) == null || r.setAppearOffline(!0), (l = this.commentPins) == null || l.setVisible(!1), this.followingUserId = null, this.pinModeActive && ((a = this.commentPins) == null || a.exitPinMode(), this.pinModeActive = !1), this.activePanel = this.activePanel === "settings" ? "settings" : null, this.highlightThreadId = null;
6972
+ applySettings(n) {
6973
+ var e, t, i, s, o, r, l, a, c, h, p, u, f, m, x, b, y;
6974
+ if (!n.enabled) {
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;
6924
6976
  return;
6925
6977
  }
6926
- this.applyCursorSettings(s), (c = this.client) == null || c.setAppearOffline(s.appearOffline), (p = this.commentPins) == null || p.setVisible(s.showCommentPins), s.showViewportIndicators ? (d = this.viewportOverlay) == null || d.enable() : (f = this.viewportOverlay) == null || f.disable(), s.showSelections ? (u = this.selectionOverlay) == null || u.enable() : (g = this.selectionOverlay) == null || g.disable(), s.showDrawings ? (v = this.drawingOverlay) == null || v.enable() : (($ = this.drawingOverlay) == null || $.disable(), this.drawModeActive && ((y = this.drawingOverlay) == null || y.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));
6927
6979
  }
6928
- applyCursorSettings(s) {
6980
+ applyCursorSettings(n) {
6929
6981
  if (!this.cursorOverlay) return;
6930
- s.showMyCursor || s.showOthersCursors ? (this.cursorOverlay.enable(), this.cursorOverlay.setSending(s.showMyCursor), this.cursorOverlay.setReceiving(s.showOthersCursors)) : this.cursorOverlay.disable();
6982
+ n.showMyCursor || n.showOthersCursors ? (this.cursorOverlay.enable(), this.cursorOverlay.setSending(n.showMyCursor), this.cursorOverlay.setReceiving(n.showOthersCursors)) : this.cursorOverlay.disable();
6931
6983
  }
6932
- updated(s) {
6933
- (s.has("room") || s.has("token") || s.has("apiKey") || s.has("endpoint")) && this.apiKey && this.token && this.room && this.getConfigKey() !== this.clientConfigKey && (this.teardownClient(), this.initClient(), this.activePanel = null, this.highlightThreadId = null, this.pinModeActive = !1), (s.has("activePanel") || s.has("collapsed")) && requestAnimationFrame(() => this.positionPopups());
6984
+ updated(n) {
6985
+ (n.has("room") || n.has("token") || n.has("apiKey") || n.has("endpoint")) && this.apiKey && this.token && this.room && this.getConfigKey() !== this.clientConfigKey && (this.teardownClient(), this.initClient(), this.activePanel = null, this.highlightThreadId = null, this.pinModeActive = !1), (n.has("activePanel") || n.has("collapsed")) && requestAnimationFrame(() => this.positionPopups());
6934
6986
  }
6935
6987
  /**
6936
6988
  * Smart-position all fixed popups (toolbar popover + panel) relative to
6937
6989
  * the trigger element, flipping vertically/horizontally as needed.
6938
6990
  */
6939
6991
  positionPopups() {
6940
- var g, v, $, y;
6941
- const s = this.display === "inline", e = (g = this.shadowRoot) == null ? void 0 : g.querySelector(".inline-trigger"), t = (v = this.shadowRoot) == null ? void 0 : v.querySelector("pulse-widget-toolbar"), i = s ? 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;
6942
6994
  if (!i) return;
6943
- const n = i.getBoundingClientRect(), o = window.innerWidth, r = window.innerHeight, l = 8, a = ($ = this.shadowRoot) == null ? void 0 : $.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");
6944
6996
  if (a) {
6945
6997
  Object.assign(a.style, { top: "auto", left: "auto" });
6946
- const E = a.getBoundingClientRect(), A = this.computePosition(n, E, o, r, l);
6947
- a.style.top = `${A.top}px`, a.style.left = `${A.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`;
6948
7000
  }
6949
7001
  const c = (y = this.shadowRoot) == null ? void 0 : y.querySelector(".panel-container");
6950
7002
  if (!c) return;
6951
7003
  Object.assign(c.style, { top: "auto", left: "auto" });
6952
- const p = a ?? t;
6953
- if (!p) return;
6954
- const d = p.getBoundingClientRect(), f = c.getBoundingClientRect(), u = this.computePosition(d, f, o, r, l);
6955
- c.style.top = `${u.top}px`, c.style.left = `${u.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`;
6956
7008
  }
6957
- computePosition(s, e, t, i, n) {
6958
- const o = s.top, r = i - s.bottom;
7009
+ computePosition(n, e, t, i, s) {
7010
+ const o = n.top, r = i - n.bottom;
6959
7011
  let l;
6960
- o >= e.height + n ? l = s.top - e.height - n : r >= e.height + n ? l = s.bottom + n : l = o >= r ? Math.max(n, s.top - e.height - n) : s.bottom + n;
7012
+ o >= e.height + s ? l = n.top - e.height - s : r >= e.height + s ? l = n.bottom + s : l = o >= r ? Math.max(s, n.top - e.height - s) : n.bottom + s;
6961
7013
  let a;
6962
- const c = s.right - e.width;
6963
- return c >= n ? a = c : s.left + e.width + n <= t ? a = s.left : a = Math.max(n, Math.min(t - e.width - n, s.left)), l = Math.max(n, Math.min(i - e.height - n, l)), a = Math.max(n, Math.min(t - e.width - n, a)), { top: l, left: a };
7014
+ const c = n.right - e.width;
7015
+ return c >= s ? a = c : n.left + e.width + s <= t ? a = n.left : a = Math.max(s, Math.min(t - e.width - s, n.left)), l = Math.max(s, Math.min(i - e.height - s, l)), a = Math.max(s, Math.min(t - e.width - s, a)), { top: l, left: a };
6964
7016
  }
6965
7017
  getFollowUserName() {
6966
7018
  var e;
6967
7019
  if (!this.followingUserId) return "";
6968
- const s = (e = this.client) == null ? void 0 : e.state.presence.find(
7020
+ const n = (e = this.client) == null ? void 0 : e.state.presence.find(
6969
7021
  (t) => t.user.id === this.followingUserId
6970
7022
  );
6971
- return (s == null ? void 0 : s.user.name) ?? "user";
7023
+ return (n == null ? void 0 : n.user.name) ?? "user";
6972
7024
  }
6973
7025
  renderConnectionBanner() {
6974
- return this.showConnectedFlash ? h`<div class="connection-banner connected">
7026
+ return this.showConnectedFlash ? d`<div class="connection-banner connected">
6975
7027
  <span class="connection-dot"></span>Connected
6976
- </div>` : this.connectionState === "connecting" ? h`<div class="connection-banner connecting">
7028
+ </div>` : this.connectionState === "connecting" ? d`<div class="connection-banner connecting">
6977
7029
  <span class="connection-dot"></span>Reconnecting...
6978
- </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">
6979
7031
  <span class="connection-dot"></span>Disconnected
6980
- </div>` : m;
7032
+ </div>` : g;
6981
7033
  }
6982
7034
  handleToolbarToggle() {
6983
7035
  this.collapsed = !this.collapsed, this.collapsed && (this.activePanel = null, this.highlightThreadId = null);
6984
7036
  }
6985
7037
  render() {
6986
- const s = this.display === "inline";
6987
- if (s && this.collapsed)
6988
- return h`
7038
+ const n = this.display === "inline";
7039
+ if (n && this.collapsed)
7040
+ return d`
6989
7041
  <div class="widget-root">
6990
7042
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
6991
7043
  <slot>Collaborate</slot>
6992
7044
  </div>
6993
7045
  </div>
6994
7046
  `;
6995
- const e = this.activePanel ? h`
7047
+ const e = this.activePanel ? d`
6996
7048
  <div class="panel-container anchored" @panel-close=${this.handlePanelClose}>
6997
- ${this.activePanel === "comments" ? h`<pulse-widget-comments-panel
7049
+ ${this.activePanel === "comments" ? d`<pulse-widget-comments-panel
6998
7050
  .client=${this.client}
6999
7051
  .highlightThreadId=${this.highlightThreadId}
7000
- ></pulse-widget-comments-panel>` : m}
7001
- ${this.activePanel === "settings" ? h`<pulse-widget-settings-panel
7052
+ ></pulse-widget-comments-panel>` : g}
7053
+ ${this.activePanel === "settings" ? d`<pulse-widget-settings-panel
7002
7054
  .settings=${this.settings}
7003
7055
  .roomId=${this.room}
7004
7056
  @settings-change=${this.handleSettingsChange}
7005
- ></pulse-widget-settings-panel>` : m}
7006
- ${this.activePanel === "notifications" ? h`<pulse-widget-notifications-panel
7057
+ ></pulse-widget-settings-panel>` : g}
7058
+ ${this.activePanel === "notifications" ? d`<pulse-widget-notifications-panel
7007
7059
  .client=${this.client}
7008
- ></pulse-widget-notifications-panel>` : m}
7009
- ${this.activePanel === "activity" ? h`<pulse-widget-activity-panel
7060
+ ></pulse-widget-notifications-panel>` : g}
7061
+ ${this.activePanel === "activity" ? d`<pulse-widget-activity-panel
7010
7062
  .client=${this.client}
7011
- ></pulse-widget-activity-panel>` : m}
7063
+ ></pulse-widget-activity-panel>` : g}
7012
7064
  </div>
7013
- ` : m, t = this.followingUserId ? h`<div class="follow-banner">
7065
+ ` : g, t = this.followingUserId ? d`<div class="follow-banner">
7014
7066
  Following ${this.getFollowUserName()}
7015
7067
  <button @click=${() => {
7016
7068
  this.followingUserId = null;
7017
7069
  }}>Stop</button>
7018
- </div>` : m;
7019
- return s ? h`
7070
+ </div>` : g;
7071
+ return n ? d`
7020
7072
  ${t}
7021
7073
  <div class="widget-root">
7022
7074
  <div class="inline-trigger" @click=${this.handleToolbarToggle}>
@@ -7040,7 +7092,7 @@ let _ = class extends S {
7040
7092
  </div>
7041
7093
  ${e}
7042
7094
  </div>
7043
- ` : h`
7095
+ ` : d`
7044
7096
  ${t}
7045
7097
  <div class="widget-root">
7046
7098
  ${e}
@@ -7064,7 +7116,7 @@ let _ = class extends S {
7064
7116
  };
7065
7117
  _.styles = [
7066
7118
  ee,
7067
- I`
7119
+ M`
7068
7120
  :host {
7069
7121
  display: block;
7070
7122
  }
@@ -7240,52 +7292,52 @@ _.styles = [
7240
7292
  }
7241
7293
  `
7242
7294
  ];
7243
- P([
7244
- b({ attribute: "api-key" })
7295
+ A([
7296
+ v({ attribute: "api-key" })
7245
7297
  ], _.prototype, "apiKey", 2);
7246
- P([
7247
- b()
7298
+ A([
7299
+ v()
7248
7300
  ], _.prototype, "token", 2);
7249
- P([
7250
- b()
7301
+ A([
7302
+ v()
7251
7303
  ], _.prototype, "room", 2);
7252
- P([
7253
- b()
7304
+ A([
7305
+ v()
7254
7306
  ], _.prototype, "endpoint", 2);
7255
- P([
7256
- b({ reflect: !0 })
7307
+ A([
7308
+ v({ reflect: !0 })
7257
7309
  ], _.prototype, "position", 2);
7258
- P([
7259
- b({ reflect: !0 })
7310
+ A([
7311
+ v({ reflect: !0 })
7260
7312
  ], _.prototype, "display", 2);
7261
- P([
7262
- x()
7313
+ A([
7314
+ w()
7263
7315
  ], _.prototype, "collapsed", 2);
7264
- P([
7265
- x()
7316
+ A([
7317
+ w()
7266
7318
  ], _.prototype, "activePanel", 2);
7267
- P([
7268
- x()
7319
+ A([
7320
+ w()
7269
7321
  ], _.prototype, "pinModeActive", 2);
7270
- P([
7271
- x()
7322
+ A([
7323
+ w()
7272
7324
  ], _.prototype, "highlightThreadId", 2);
7273
- P([
7274
- x()
7325
+ A([
7326
+ w()
7275
7327
  ], _.prototype, "settings", 2);
7276
- P([
7277
- x()
7328
+ A([
7329
+ w()
7278
7330
  ], _.prototype, "followingUserId", 2);
7279
- P([
7280
- x()
7331
+ A([
7332
+ w()
7281
7333
  ], _.prototype, "drawModeActive", 2);
7282
- P([
7283
- x()
7334
+ A([
7335
+ w()
7284
7336
  ], _.prototype, "connectionState", 2);
7285
- P([
7286
- x()
7337
+ A([
7338
+ w()
7287
7339
  ], _.prototype, "showConnectedFlash", 2);
7288
- _ = P([
7340
+ _ = A([
7289
7341
  R("pulse-widget")
7290
7342
  ], _);
7291
7343
  export {