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