@talkjs/core 1.6.2 → 1.6.3
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/README.md +4 -0
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +13 -1
- package/dist/talkSession.js +932 -870
- package/package.json +1 -1
package/dist/talkSession.js
CHANGED
|
@@ -57,45 +57,35 @@ var __async = (__this, __arguments, generator) => {
|
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
var _a, _b, _e2, _t2;
|
|
60
|
-
function e(e2,
|
|
61
|
-
if (s2.ok) return s2.value.data;
|
|
62
|
-
if ("SESSION_DESTROYED" === s2.value) throw new Error(`${e2} failed because the session was destroyed`);
|
|
63
|
-
if ("server" === s2.where) throw new Error(t(e2, s2.value));
|
|
64
|
-
throw "unreachable";
|
|
65
|
-
}
|
|
66
|
-
function t(e2, t2) {
|
|
67
|
-
let s2;
|
|
68
|
-
return s2 = Array.isArray(t2.reasons) ? t2.reasons.join() : JSON.stringify(t2.reasons), `${e2} failed, got status ${t2.status} ${t2.errorCode}, reasons: ${s2}`;
|
|
69
|
-
}
|
|
70
|
-
function s(e2, t2) {
|
|
60
|
+
function e(e2, t2) {
|
|
71
61
|
if (e2.length !== t2.length) return false;
|
|
72
62
|
for (let s2 = 0; s2 < e2.length; s2++) if ("*" !== t2[s2] && e2[s2] !== t2[s2]) return false;
|
|
73
63
|
return true;
|
|
74
64
|
}
|
|
75
|
-
function
|
|
65
|
+
function t(e2) {
|
|
76
66
|
return e2 <= 0 ? Promise.resolve() : new Promise((t2) => setTimeout(t2, e2));
|
|
77
67
|
}
|
|
78
|
-
function
|
|
68
|
+
function s(e2, t2) {
|
|
79
69
|
return e2 * (1 - t2 + 2 * Math.random() * t2);
|
|
80
70
|
}
|
|
81
|
-
const
|
|
82
|
-
function
|
|
83
|
-
return __async(this, arguments, function* (e2,
|
|
84
|
-
return
|
|
85
|
-
if (0 === e2) throw
|
|
86
|
-
if (!(yield c2(
|
|
87
|
-
const l2 = 1e3 *
|
|
88
|
-
return
|
|
71
|
+
const n = () => true;
|
|
72
|
+
function r(_0, _1, _2) {
|
|
73
|
+
return __async(this, arguments, function* (e2, a2, { initialDelay: i2, maxDelay: o2, log: u2, shouldRetry: c2 = n }) {
|
|
74
|
+
return a2().catch((n2) => __async(this, null, function* () {
|
|
75
|
+
if (0 === e2) throw n2;
|
|
76
|
+
if (!(yield c2(n2))) throw n2;
|
|
77
|
+
const l2 = 1e3 * i2 * 1.2, h2 = s(o2 ? Math.min(1e3 * o2, l2) : l2, 0.05);
|
|
78
|
+
return t(h2).then(() => r(e2 - 1, a2, { initialDelay: h2 / 1e3, maxDelay: o2, log: u2, shouldRetry: c2 }));
|
|
89
79
|
}));
|
|
90
80
|
});
|
|
91
81
|
}
|
|
92
|
-
function
|
|
82
|
+
function a() {
|
|
93
83
|
const e2 = {}, t2 = new Promise(function(t3, s2) {
|
|
94
84
|
e2.resolve = t3, e2.reject = s2;
|
|
95
85
|
});
|
|
96
86
|
return e2.promise = t2, e2;
|
|
97
87
|
}
|
|
98
|
-
class
|
|
88
|
+
class i {
|
|
99
89
|
constructor(e2, t2, s2) {
|
|
100
90
|
this.layer = e2, this.states = t2, this.transitions = s2, this._state = t2[0];
|
|
101
91
|
}
|
|
@@ -114,30 +104,40 @@ class u {
|
|
|
114
104
|
return !!t2 && ("ANY" === t2.from || t2.from.includes(this.state));
|
|
115
105
|
}
|
|
116
106
|
}
|
|
117
|
-
function
|
|
107
|
+
function o(e2) {
|
|
118
108
|
return { ok: true, value: e2 };
|
|
119
109
|
}
|
|
120
|
-
function
|
|
110
|
+
function u(e2) {
|
|
121
111
|
return { ok: false, where: "client", value: e2 };
|
|
122
112
|
}
|
|
123
|
-
function
|
|
113
|
+
function c(e2) {
|
|
124
114
|
return { ok: false, where: "server", value: e2 };
|
|
125
115
|
}
|
|
126
|
-
function
|
|
116
|
+
function l() {
|
|
127
117
|
const e2 = {}, t2 = new Promise((t3) => {
|
|
128
118
|
e2.ok = (e3) => __async(this, null, function* () {
|
|
129
|
-
return t3(
|
|
130
|
-
}), e2.clientErr = (e3) => t3(
|
|
119
|
+
return t3(o(e3));
|
|
120
|
+
}), e2.clientErr = (e3) => t3(u(e3)), e2.serverErr = (e3) => t3(c(e3)), e2.resolve = (e3) => t3(e3);
|
|
131
121
|
});
|
|
132
122
|
return e2.promise = t2, e2;
|
|
133
123
|
}
|
|
124
|
+
function h(e2, t2) {
|
|
125
|
+
if (t2.ok) return t2.value.data;
|
|
126
|
+
if ("SESSION_DESTROYED" === t2.value) throw new Error(`${e2} failed because the session was destroyed`);
|
|
127
|
+
if ("server" === t2.where) throw new Error(d(e2, t2.value));
|
|
128
|
+
throw "unreachable";
|
|
129
|
+
}
|
|
130
|
+
function d(e2, t2) {
|
|
131
|
+
let s2;
|
|
132
|
+
return s2 = Array.isArray(t2.reasons) ? t2.reasons.join() : JSON.stringify(t2.reasons), `${e2} failed, got status ${t2.status} ${t2.errorCode}, reasons: ${s2}`;
|
|
133
|
+
}
|
|
134
134
|
let p = null;
|
|
135
135
|
function f({ WebSocket: e2 }) {
|
|
136
136
|
p = e2;
|
|
137
137
|
}
|
|
138
138
|
class m {
|
|
139
139
|
constructor(e2, t2) {
|
|
140
|
-
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.stateMachine = new
|
|
140
|
+
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.stateMachine = new i("ReconnectingSocket", ["STOPPED", "CONNECTING", "READY", "DISCONNECTED", "TERMINATED"], { startWs: { from: ["STOPPED", "DISCONNECTED"], to: "CONNECTING", afterTransition: () => {
|
|
141
141
|
const e3 = new (function() {
|
|
142
142
|
if (p) return p;
|
|
143
143
|
if (globalThis.WebSocket) return globalThis.WebSocket;
|
|
@@ -154,7 +154,7 @@ class m {
|
|
|
154
154
|
this.handlers.onOpen();
|
|
155
155
|
} }, onClose: { from: ["CONNECTING", "READY"], to: "DISCONNECTED", afterTransition: (_0) => __async(this, [_0], function* ({ from: e3 }) {
|
|
156
156
|
"READY" === e3 && this.handlers.onClose(), this.socket = null;
|
|
157
|
-
const t3 =
|
|
157
|
+
const t3 = s(1e4, 0.5);
|
|
158
158
|
setTimeout(() => {
|
|
159
159
|
"DISCONNECTED" === this.stateMachine.state && this.stateMachine.transition("startWs");
|
|
160
160
|
}, t3);
|
|
@@ -174,7 +174,7 @@ class m {
|
|
|
174
174
|
this.stateMachine.transition("startWs");
|
|
175
175
|
}
|
|
176
176
|
send(e2) {
|
|
177
|
-
return "READY" === this.stateMachine.state ? (this.socket.send(e2),
|
|
177
|
+
return "READY" === this.stateMachine.state ? (this.socket.send(e2), o(void 0)) : u("SOCKET_NOT_READY");
|
|
178
178
|
}
|
|
179
179
|
terminate() {
|
|
180
180
|
const e2 = this.socket;
|
|
@@ -188,9 +188,9 @@ class g {
|
|
|
188
188
|
constructor(e2, t2) {
|
|
189
189
|
this.handlers = t2, this.socket = new m(e2, { onOpen: () => this.handlers.onOpen(), onClose: () => this.handlers.onClose(), onMessage: (e3) => this.onWebSocketMessage(e3) });
|
|
190
190
|
}
|
|
191
|
-
call(e2, t2
|
|
192
|
-
const
|
|
193
|
-
return this.socket.send(
|
|
191
|
+
call(e2, t2) {
|
|
192
|
+
const s2 = `/${t2.path.map((e3) => encodeURIComponent(e3)).join("/")}`, n2 = JSON.stringify([e2, t2.method, s2, t2.data, t2.headers]);
|
|
193
|
+
return this.socket.send(n2);
|
|
194
194
|
}
|
|
195
195
|
stopWs() {
|
|
196
196
|
this.socket.stopWs();
|
|
@@ -273,11 +273,11 @@ class y {
|
|
|
273
273
|
return Promise.all(e2);
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
|
-
call(e2
|
|
277
|
-
const
|
|
278
|
-
this.responseHandlers[
|
|
279
|
-
const
|
|
280
|
-
return
|
|
276
|
+
call(e2) {
|
|
277
|
+
const t2 = this.seqCounter.next(), s2 = l();
|
|
278
|
+
this.responseHandlers[t2] = s2;
|
|
279
|
+
const n2 = this.socket.call(t2, e2);
|
|
280
|
+
return n2.ok || (s2.resolve(n2), delete this.responseHandlers[t2]), this.heartbeats.clientActive(), s2.promise;
|
|
281
281
|
}
|
|
282
282
|
onResponse(e2, t2, s2) {
|
|
283
283
|
return __async(this, null, function* () {
|
|
@@ -320,13 +320,13 @@ class C {
|
|
|
320
320
|
this.clientInactivityTimer.stop(), this.serverInactivityTimer.stop(), this.serverTimeoutTimer.stop();
|
|
321
321
|
}
|
|
322
322
|
sendHeartbeat() {
|
|
323
|
-
this.connection.call("GET", ["ping"], {}).catch(() => {
|
|
323
|
+
this.connection.call({ method: "GET", path: ["ping"], data: {}, headers: {} }).catch(() => {
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
class A {
|
|
328
328
|
constructor(e2, t2, s2) {
|
|
329
|
-
this.authProvider = t2, this.handlers = s2, this.stateMachine = new
|
|
329
|
+
this.authProvider = t2, this.handlers = s2, this.stateMachine = new i("AuthenticatedConnection", ["WAITING_FOR_WS", "LOGGING_IN", "RENEWING_SESSION", "READY", "TERMINATED"], { logIn: { from: ["WAITING_FOR_WS"], to: "LOGGING_IN", afterTransition: () => __async(this, null, function* () {
|
|
330
330
|
yield this.renewSession();
|
|
331
331
|
}) }, logInFailed: { from: ["LOGGING_IN"], to: "LOGGING_IN", afterTransition: () => __async(this, null, function* () {
|
|
332
332
|
this.authProvider.invalidateAndRefresh(), yield this.renewSession();
|
|
@@ -357,11 +357,11 @@ class A {
|
|
|
357
357
|
return this.connection.sync();
|
|
358
358
|
});
|
|
359
359
|
}
|
|
360
|
-
call(e2
|
|
361
|
-
const
|
|
362
|
-
return
|
|
360
|
+
call(e2) {
|
|
361
|
+
const t2 = this.connection.call(e2);
|
|
362
|
+
return t2.then((e3) => {
|
|
363
363
|
e3.ok || "server" !== e3.where || 401 !== e3.value.status || "READY" !== this.stateMachine.state && "RENEWING_SESSION" !== this.stateMachine.state || this.stateMachine.transition("authExpired");
|
|
364
|
-
}),
|
|
364
|
+
}), t2;
|
|
365
365
|
}
|
|
366
366
|
stopWs() {
|
|
367
367
|
this.connection.stopWs();
|
|
@@ -378,27 +378,27 @@ class A {
|
|
|
378
378
|
const e2 = yield this.authProvider.getToken().catch(() => {
|
|
379
379
|
});
|
|
380
380
|
if (!e2) return;
|
|
381
|
-
const
|
|
382
|
-
if (!
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
const
|
|
386
|
-
return void (null !==
|
|
381
|
+
const t2 = yield this.connection.call({ method: "POST", path: ["session", "renew"], data: { token: e2 }, headers: {} });
|
|
382
|
+
if (!t2.ok && "client" === t2.where) return;
|
|
383
|
+
const s2 = t2.value;
|
|
384
|
+
if (s2.status, 200 === s2.status) {
|
|
385
|
+
const t3 = s2.data.expiresInSeconds;
|
|
386
|
+
return void (null !== t3 && t3 < 120 ? (console.warn(`[TalkJS] Authenticated with a token that expires in ${t3}s. Treating it as already expired and refreshing. Newly generated tokens should last at least 10 minutes.`), "LOGGING_IN" === this.stateMachine.state ? this.stateMachine.transition("logInFailed") : "RENEWING_SESSION" === this.stateMachine.state && this.stateMachine.transition("scheduledReauthFailed")) : (this.authProvider.scheduleRefresh(t3), this.authProvider.emitTokenAccepted(e2), this.stateMachine.canTransition("authenticated") && this.stateMachine.transition("authenticated")));
|
|
387
387
|
}
|
|
388
|
-
if (401 ===
|
|
389
|
-
if (400 ===
|
|
390
|
-
if (402 ===
|
|
391
|
-
const
|
|
388
|
+
if (401 === s2.status) return void ("LOGGING_IN" === this.stateMachine.state ? this.stateMachine.transition("logInFailed") : "RENEWING_SESSION" === this.stateMachine.state && this.stateMachine.transition("scheduledReauthFailed"));
|
|
389
|
+
if (400 === s2.status) return void this.authProvider.emitTokenRefreshFailed(d("Authentication", s2));
|
|
390
|
+
if (402 === s2.status) return void this.authProvider.emitTokenRefreshFailed(d("Authentication", s2));
|
|
391
|
+
const n2 = 5e3 * Math.random() + 5e3;
|
|
392
392
|
setTimeout(() => {
|
|
393
|
-
this.call("POST", ["session", "renew"], { token: e2 }).catch(() => {
|
|
393
|
+
this.call({ method: "POST", path: ["session", "renew"], data: { token: e2 }, headers: {} }).catch(() => {
|
|
394
394
|
});
|
|
395
|
-
},
|
|
395
|
+
}, n2);
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
399
|
class E {
|
|
400
400
|
constructor(e2, t2, s2) {
|
|
401
|
-
this.handlers = s2, this.stateMachine = new
|
|
401
|
+
this.handlers = s2, this.stateMachine = new i("StopStartConnection", ["STOPPED", "WAITING_FOR_WS", "READY", "TERMINATED"], { unexpectedDisconnect: { from: ["READY"], to: "WAITING_FOR_WS", afterTransition: () => {
|
|
402
402
|
this.inactivityTimer.stop(), this.handlers.onNotReady();
|
|
403
403
|
} }, stop: { from: ["WAITING_FOR_WS", "READY"], to: "STOPPED", afterTransition: () => {
|
|
404
404
|
this.connection.stopWs(), this.inactivityTimer.stop(), this.handlers.onNotReady();
|
|
@@ -431,13 +431,13 @@ class E {
|
|
|
431
431
|
ensureStarted() {
|
|
432
432
|
this.stateMachine.canTransition("start") && this.stateMachine.transition("start");
|
|
433
433
|
}
|
|
434
|
-
call(e2
|
|
434
|
+
call(e2) {
|
|
435
435
|
return __async(this, null, function* () {
|
|
436
|
-
this.inactivityTimer.stop(), this.pendingCalls++, this.logTrace("Called",
|
|
437
|
-
const
|
|
438
|
-
return this.pendingCalls--, this.logTrace("Received",
|
|
436
|
+
this.inactivityTimer.stop(), this.pendingCalls++, this.logTrace("Called", e2.path, e2.data);
|
|
437
|
+
const t2 = yield this.connection.call(e2);
|
|
438
|
+
return this.pendingCalls--, this.logTrace("Received", e2.path, e2.data), "SUBSCRIBE" === e2.method && t2.ok ? (this.activeSubscriptions++, this.logTrace("Subscribed", e2.path, e2.data)) : "UNSUBSCRIBE" === e2.method && t2.ok && (this.activeSubscriptions--, this.logTrace("Unsubscribed", e2.path, e2.data)), this.inactive && this.inactivityTimer.schedule(() => {
|
|
439
439
|
this.stateMachine.transition("stop");
|
|
440
|
-
}),
|
|
440
|
+
}), t2;
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
443
|
destroy() {
|
|
@@ -451,7 +451,7 @@ class E {
|
|
|
451
451
|
}
|
|
452
452
|
class k {
|
|
453
453
|
constructor(e2, t2, s2) {
|
|
454
|
-
this.handlers = s2, this.stateMachine = new
|
|
454
|
+
this.handlers = s2, this.stateMachine = new i("QueuedConnection", ["NOT_READY", "PROCESSING_QUEUE", "READY", "TERMINATED"], { processQueue: { from: ["NOT_READY"], to: "PROCESSING_QUEUE", afterTransition: () => {
|
|
455
455
|
this.sendQueuedCalls();
|
|
456
456
|
} }, ready: { from: ["PROCESSING_QUEUE"], to: "READY", afterTransition: () => {
|
|
457
457
|
this.handlers.onReady();
|
|
@@ -479,19 +479,19 @@ class k {
|
|
|
479
479
|
return this.connection.sync();
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
|
-
call(e2
|
|
483
|
-
return "READY" === this.stateMachine.state ? this.connection.call(e2
|
|
482
|
+
call(e2) {
|
|
483
|
+
return "READY" === this.stateMachine.state ? this.connection.call(e2) : ("NOT_READY" === this.stateMachine.state && this.connection.ensureStarted(), "SUBSCRIBE" === e2.method || "UNSUBSCRIBE" === e2.method ? this._subscribe(e2) : this._call(e2));
|
|
484
484
|
}
|
|
485
|
-
_subscribe(e2
|
|
486
|
-
const
|
|
487
|
-
if (
|
|
488
|
-
|
|
489
|
-
const
|
|
490
|
-
return this.subscribeQueue[
|
|
485
|
+
_subscribe(e2) {
|
|
486
|
+
const t2 = e2.path.join("/"), s2 = this.subscribeQueue[t2];
|
|
487
|
+
if (s2 && s2.params.method === e2.method) return s2.deferred.promise;
|
|
488
|
+
s2 && s2.params.method !== e2.method && (s2.deferred.ok({ status: 200, data: {} }), delete this.subscribeQueue[t2]);
|
|
489
|
+
const n2 = { deferred: l(), params: e2 };
|
|
490
|
+
return this.subscribeQueue[t2] = n2, n2.deferred.promise;
|
|
491
491
|
}
|
|
492
|
-
_call(e2
|
|
493
|
-
const
|
|
494
|
-
return this.callQueue.push(
|
|
492
|
+
_call(e2) {
|
|
493
|
+
const t2 = { deferred: l(), params: e2 };
|
|
494
|
+
return this.callQueue.push(t2), t2.deferred.promise;
|
|
495
495
|
}
|
|
496
496
|
dequeue() {
|
|
497
497
|
for (const e2 in this.subscribeQueue) {
|
|
@@ -510,7 +510,7 @@ class k {
|
|
|
510
510
|
e2++;
|
|
511
511
|
const t2 = this.dequeue();
|
|
512
512
|
if (!t2) return void this.stateMachine.transition("ready");
|
|
513
|
-
this.connection.call(t2.
|
|
513
|
+
this.connection.call(t2.params).then((e3) => {
|
|
514
514
|
t2.deferred.resolve(e3);
|
|
515
515
|
}), e2 > 50 && (yield new Promise((e3) => setTimeout(e3, 100)));
|
|
516
516
|
}
|
|
@@ -520,10 +520,79 @@ class k {
|
|
|
520
520
|
return "READY" === this.stateMachine.state || "PROCESSING_QUEUE" === this.stateMachine.state;
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
523
|
+
function x(e2) {
|
|
524
|
+
return Object.freeze(e2);
|
|
525
|
+
}
|
|
526
|
+
function T(e2) {
|
|
527
|
+
return x(e2.map((e3) => function(e4) {
|
|
528
|
+
switch (e4.type) {
|
|
529
|
+
case "text":
|
|
530
|
+
return Object.freeze({ type: "text", children: I(e4.children) });
|
|
531
|
+
case "file":
|
|
532
|
+
case "location":
|
|
533
|
+
return Object.freeze(e4);
|
|
534
|
+
}
|
|
535
|
+
}(e3)));
|
|
536
|
+
}
|
|
537
|
+
function I(e2) {
|
|
538
|
+
return x(e2.map((e3) => function(e4) {
|
|
539
|
+
if ("string" == typeof e4) return e4;
|
|
540
|
+
switch (e4.type) {
|
|
541
|
+
case "bold":
|
|
542
|
+
case "italic":
|
|
543
|
+
case "strikethrough":
|
|
544
|
+
case "bulletList":
|
|
545
|
+
case "bulletPoint":
|
|
546
|
+
case "link":
|
|
547
|
+
case "actionLink":
|
|
548
|
+
case "actionButton":
|
|
549
|
+
return Object.freeze(__spreadProps(__spreadValues({}, e4), { children: I(e4.children) }));
|
|
550
|
+
case "mention":
|
|
551
|
+
case "autoLink":
|
|
552
|
+
case "codeSpan":
|
|
553
|
+
case "customEmoji":
|
|
554
|
+
return Object.freeze(e4);
|
|
555
|
+
}
|
|
556
|
+
}(e3)));
|
|
557
|
+
}
|
|
558
|
+
function D(e2, t2) {
|
|
559
|
+
return void 0 === t2 ? e2 : t2;
|
|
560
|
+
}
|
|
561
|
+
function S(e2, t2) {
|
|
562
|
+
return void 0 === t2 ? e2 : x(t2);
|
|
563
|
+
}
|
|
564
|
+
function M(e2, t2) {
|
|
565
|
+
if (void 0 === t2) return e2;
|
|
566
|
+
if (null === t2) return x({});
|
|
567
|
+
const s2 = __spreadValues({}, e2);
|
|
568
|
+
for (const e3 in t2) {
|
|
569
|
+
const n2 = t2[e3];
|
|
570
|
+
null === n2 ? delete s2[e3] : s2[e3] = n2;
|
|
571
|
+
}
|
|
572
|
+
return x(s2);
|
|
573
|
+
}
|
|
574
|
+
function F(e2, t2) {
|
|
575
|
+
if (e2 === t2) return true;
|
|
576
|
+
if (!e2 || !t2) return false;
|
|
577
|
+
if ("object" != typeof e2 || "object" != typeof t2) return false;
|
|
578
|
+
if (e2.constructor !== t2.constructor) return false;
|
|
579
|
+
if (Array.isArray(e2) && Array.isArray(t2)) {
|
|
580
|
+
if (e2.length !== t2.length) return false;
|
|
581
|
+
for (let s2 = 0; s2 < e2.length; s2++) if (!F(e2[s2], t2[s2])) return false;
|
|
582
|
+
} else {
|
|
583
|
+
const s2 = Object.keys(e2);
|
|
584
|
+
if (s2.length !== Object.keys(t2).length) return false;
|
|
585
|
+
for (const n2 of s2) {
|
|
586
|
+
if (!Object.hasOwnProperty.call(t2, n2)) return false;
|
|
587
|
+
if (!F(e2[n2], t2[n2])) return false;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return true;
|
|
591
|
+
}
|
|
592
|
+
const B = "undefined" != typeof window ? (_b = window.queueMicrotask) != null ? _b : setTimeout : setTimeout;
|
|
593
|
+
class R {
|
|
594
|
+
constructor(e2, t2, s2) {
|
|
595
|
+
this.headers = e2, this.clearPendingBatch = t2, this.sendCalls = s2, this.sent = false, B(() => this.send());
|
|
527
596
|
}
|
|
528
597
|
send() {
|
|
529
598
|
this.sent || (this.sent = true, this.clearPendingBatch(), this.sendCalls());
|
|
@@ -532,26 +601,27 @@ class T {
|
|
|
532
601
|
this.sent = true;
|
|
533
602
|
}
|
|
534
603
|
}
|
|
535
|
-
class
|
|
536
|
-
constructor(e2, t2) {
|
|
537
|
-
super(t2, () => {
|
|
604
|
+
class N extends R {
|
|
605
|
+
constructor(e2, t2, s2) {
|
|
606
|
+
super(t2, s2, () => {
|
|
538
607
|
this.sendSubscribe(), this.sendGet();
|
|
539
608
|
}), this.connection = e2, this.getCalls = [], this.subscribeCalls = [];
|
|
540
609
|
}
|
|
541
|
-
canPush(e2
|
|
542
|
-
return
|
|
610
|
+
canPush(e2) {
|
|
611
|
+
return N.isCorrectBatchTypeFor(e2) && F(this.headers, e2.headers);
|
|
543
612
|
}
|
|
544
|
-
static isCorrectBatchTypeFor(
|
|
545
|
-
|
|
613
|
+
static isCorrectBatchTypeFor(t2) {
|
|
614
|
+
const s2 = e(t2.path, ["users", "*"]), n2 = "GET" === t2.method || "SUBSCRIBE" === t2.method;
|
|
615
|
+
return s2 && n2;
|
|
546
616
|
}
|
|
547
|
-
push(e2
|
|
548
|
-
const
|
|
549
|
-
return "GET" === e2 ? this.getCalls.push({ userId:
|
|
617
|
+
push(e2) {
|
|
618
|
+
const t2 = e2.path[1], s2 = l();
|
|
619
|
+
return "GET" === e2.method ? this.getCalls.push({ userId: t2, deferred: s2 }) : this.subscribeCalls.push({ userId: t2, deferred: s2 }), 1e3 !== this.getCalls.length && 1e3 !== this.subscribeCalls.length || this.send(), s2.promise;
|
|
550
620
|
}
|
|
551
621
|
sendGet() {
|
|
552
622
|
return __async(this, null, function* () {
|
|
553
623
|
if (0 === this.getCalls.length) return;
|
|
554
|
-
const e2 = [...new Set(this.getCalls.map((e3) => e3.userId))], t2 = yield this.connection.call("GET", ["users"], { ids: e2, includePrivateFields: false });
|
|
624
|
+
const e2 = [...new Set(this.getCalls.map((e3) => e3.userId))], t2 = yield this.connection.call({ method: "GET", path: ["users"], data: { ids: e2, includePrivateFields: false }, headers: this.headers });
|
|
555
625
|
if (t2.ok) for (const e3 of this.getCalls) {
|
|
556
626
|
const s2 = t2.value.data[e3.userId];
|
|
557
627
|
s2 ? e3.deferred.ok({ status: 200, data: s2 }) : e3.deferred.serverErr({ status: 404, errorCode: "NOT_FOUND", reasons: ["No user with that ID exists"] });
|
|
@@ -562,26 +632,29 @@ class I extends T {
|
|
|
562
632
|
sendSubscribe() {
|
|
563
633
|
if (0 === this.subscribeCalls.length) return;
|
|
564
634
|
const e2 = [...new Set(this.subscribeCalls.map((e3) => e3.userId))];
|
|
565
|
-
this.connection.call("SUBSCRIBE", ["users"], { ids: e2 }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
635
|
+
this.connection.call({ method: "SUBSCRIBE", path: ["users"], data: { ids: e2 }, headers: this.headers }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
566
636
|
}
|
|
567
637
|
}
|
|
568
|
-
class
|
|
569
|
-
constructor(e2, t2, s2) {
|
|
570
|
-
super(s2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
638
|
+
class _ extends R {
|
|
639
|
+
constructor(e2, t2, s2, n2) {
|
|
640
|
+
super(s2, n2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
571
641
|
}
|
|
572
|
-
canPush(e2
|
|
573
|
-
return
|
|
642
|
+
canPush(e2) {
|
|
643
|
+
return !(!_.isCorrectBatchTypeFor(e2) || e2.path[1] !== this.conversationId || !F(this.headers, e2.headers));
|
|
574
644
|
}
|
|
575
|
-
static isCorrectBatchTypeFor(
|
|
576
|
-
|
|
645
|
+
static isCorrectBatchTypeFor(t2) {
|
|
646
|
+
if (e(t2.path, ["conversations", "*", "participants", "*"])) {
|
|
647
|
+
if ("PUT" === t2.method || "POST" === t2.method || "PATCH" === t2.method) return true;
|
|
648
|
+
}
|
|
649
|
+
return false;
|
|
577
650
|
}
|
|
578
|
-
push(e2
|
|
579
|
-
const
|
|
580
|
-
return this.calls.push({ action: { id:
|
|
651
|
+
push(e2) {
|
|
652
|
+
const t2 = e2.path[3], s2 = l();
|
|
653
|
+
return this.calls.push({ action: { id: t2, method: e2.method, params: e2.data }, deferred: s2 }), 100 === this.calls.length && this.send(), s2.promise;
|
|
581
654
|
}
|
|
582
655
|
sendMutate() {
|
|
583
656
|
return __async(this, null, function* () {
|
|
584
|
-
const e2 = this.calls.map((e3) => e3.action), t2 = yield this.connection.call("POST", ["conversations", this.conversationId, "participants"], { actions: e2 });
|
|
657
|
+
const e2 = this.calls.map((e3) => e3.action), t2 = yield this.connection.call({ method: "POST", path: ["conversations", this.conversationId, "participants"], data: { actions: e2 }, headers: this.headers });
|
|
585
658
|
if (!t2.ok) return void this.calls.forEach((e3) => e3.deferred.resolve(t2));
|
|
586
659
|
const s2 = t2.value.data.responses;
|
|
587
660
|
for (let e3 = 0; e3 < s2.length; e3++) {
|
|
@@ -591,7 +664,7 @@ class D extends T {
|
|
|
591
664
|
});
|
|
592
665
|
}
|
|
593
666
|
}
|
|
594
|
-
class
|
|
667
|
+
class O {
|
|
595
668
|
constructor(e2, t2, s2) {
|
|
596
669
|
this.pendingBatch = null, this.connection = new k(e2, t2, s2);
|
|
597
670
|
}
|
|
@@ -600,13 +673,13 @@ class S {
|
|
|
600
673
|
return this.connection.sync();
|
|
601
674
|
});
|
|
602
675
|
}
|
|
603
|
-
call(e2
|
|
676
|
+
call(e2) {
|
|
604
677
|
return __async(this, null, function* () {
|
|
605
678
|
var _a2;
|
|
606
|
-
if ((_a2 = this.pendingBatch) == null ? void 0 : _a2.canPush(e2
|
|
679
|
+
if ((_a2 = this.pendingBatch) == null ? void 0 : _a2.canPush(e2)) return this.pendingBatch.push(e2);
|
|
607
680
|
this.pendingBatch && this.pendingBatch.send();
|
|
608
|
-
const
|
|
609
|
-
return
|
|
681
|
+
const t2 = this.createEmptyBatchFor(e2);
|
|
682
|
+
return t2 ? (this.pendingBatch = t2, t2.push(e2)) : this.connection.call(e2);
|
|
610
683
|
});
|
|
611
684
|
}
|
|
612
685
|
destroy() {
|
|
@@ -616,45 +689,46 @@ class S {
|
|
|
616
689
|
isConnected() {
|
|
617
690
|
return this.connection.isConnected();
|
|
618
691
|
}
|
|
619
|
-
createEmptyBatchFor(e2
|
|
620
|
-
|
|
621
|
-
if (
|
|
622
|
-
|
|
623
|
-
|
|
692
|
+
createEmptyBatchFor(e2) {
|
|
693
|
+
var _a2, _b2;
|
|
694
|
+
if (N.isCorrectBatchTypeFor(e2)) return new N(this.connection, (_a2 = e2.headers) != null ? _a2 : {}, () => this.pendingBatch = null);
|
|
695
|
+
if (_.isCorrectBatchTypeFor(e2)) {
|
|
696
|
+
const t2 = e2.path[1];
|
|
697
|
+
return new _(t2, this.connection, (_b2 = e2.headers) != null ? _b2 : {}, () => this.pendingBatch = null);
|
|
624
698
|
}
|
|
625
699
|
return null;
|
|
626
700
|
}
|
|
627
701
|
}
|
|
628
|
-
const
|
|
629
|
-
class
|
|
702
|
+
const P = { 200: "RESOLVE", 400: "RESOLVE", 401: "RETRY", 402: "RESOLVE", 403: "RESOLVE", 404: "RESOLVE", 405: "RESOLVE", 409: "RESOLVE", 429: "DELAY", 500: "DELAY" };
|
|
703
|
+
class $ {
|
|
630
704
|
constructor(e2, t2, s2) {
|
|
631
|
-
this.throttler = new
|
|
705
|
+
this.throttler = new j(), this.alive = true, this.connection = new O(e2, t2, s2);
|
|
632
706
|
}
|
|
633
707
|
sync() {
|
|
634
708
|
return __async(this, null, function* () {
|
|
635
709
|
return this.connection.sync();
|
|
636
710
|
});
|
|
637
711
|
}
|
|
638
|
-
call(e2
|
|
712
|
+
call(e2) {
|
|
639
713
|
return __async(this, null, function* () {
|
|
640
|
-
let
|
|
714
|
+
let t2 = 0;
|
|
641
715
|
for (; this.alive; ) {
|
|
642
|
-
const
|
|
643
|
-
if ((
|
|
644
|
-
if (
|
|
645
|
-
const e3 =
|
|
646
|
-
if ("RESOLVE" ===
|
|
647
|
-
if ("RETRY" ===
|
|
648
|
-
if ("DELAY" ===
|
|
716
|
+
const s2 = yield this.connection.call(e2);
|
|
717
|
+
if ((s2.ok || "client" !== s2.where || "SOCKET_NOT_READY" !== s2.value) && (s2.ok || "server" !== s2.where || 500 !== s2.value.status) || t2++, 10 === t2) return s2;
|
|
718
|
+
if (s2.ok || "client" !== s2.where) {
|
|
719
|
+
const e3 = s2.value, t3 = e3.status, n2 = P[t3];
|
|
720
|
+
if ("RESOLVE" === n2) return this.throttler.resetDelay(), s2;
|
|
721
|
+
if ("RETRY" === n2) continue;
|
|
722
|
+
if ("DELAY" === n2) {
|
|
649
723
|
yield this.throttler.wait();
|
|
650
724
|
continue;
|
|
651
725
|
}
|
|
652
726
|
return console.warn("[TalkJS] Unexpected status code", t3), e3;
|
|
653
727
|
}
|
|
654
|
-
if ("SESSION_DESTROYED" ===
|
|
655
|
-
"WEBSOCKET_DISCONNECTED" !==
|
|
728
|
+
if ("SESSION_DESTROYED" === s2.value) return u("SESSION_DESTROYED");
|
|
729
|
+
"WEBSOCKET_DISCONNECTED" !== s2.value && ("SOCKET_NOT_READY" !== s2.value ? s2.value : yield this.throttler.wait());
|
|
656
730
|
}
|
|
657
|
-
return
|
|
731
|
+
return u("SESSION_DESTROYED");
|
|
658
732
|
});
|
|
659
733
|
}
|
|
660
734
|
destroy() {
|
|
@@ -664,7 +738,7 @@ class F {
|
|
|
664
738
|
return this.connection.isConnected();
|
|
665
739
|
}
|
|
666
740
|
}
|
|
667
|
-
class
|
|
741
|
+
class j {
|
|
668
742
|
constructor() {
|
|
669
743
|
this.initialDelayMs = 200, this.exponentialFactor = 1.2, this.maxDelayMs = 3e4, this.currentDelayMs = this.initialDelayMs, this.lastCall = 0;
|
|
670
744
|
}
|
|
@@ -672,28 +746,28 @@ class B {
|
|
|
672
746
|
return this.currentDelayMs;
|
|
673
747
|
}
|
|
674
748
|
wait() {
|
|
675
|
-
const e2 = (/* @__PURE__ */ new Date()).getTime(),
|
|
676
|
-
return this.lastCall = e2 +
|
|
749
|
+
const e2 = (/* @__PURE__ */ new Date()).getTime(), n2 = s(this.currentDelayMs, 0.05), r2 = this.lastCall + n2, a2 = Math.max(0, r2 - e2);
|
|
750
|
+
return this.lastCall = e2 + a2, this.currentDelayMs = Math.min(n2 * this.exponentialFactor, this.maxDelayMs), t(a2);
|
|
677
751
|
}
|
|
678
752
|
resetDelay() {
|
|
679
753
|
this.currentDelayMs = this.initialDelayMs;
|
|
680
754
|
}
|
|
681
755
|
}
|
|
682
|
-
function
|
|
756
|
+
function U(e2) {
|
|
683
757
|
return e2.map((e3) => encodeURIComponent(e3)).join();
|
|
684
758
|
}
|
|
685
|
-
class
|
|
759
|
+
class W {
|
|
686
760
|
constructor() {
|
|
687
761
|
this.paths = {};
|
|
688
762
|
}
|
|
689
763
|
add(e2) {
|
|
690
|
-
this.paths[
|
|
764
|
+
this.paths[U(e2)] = e2;
|
|
691
765
|
}
|
|
692
766
|
delete(e2) {
|
|
693
|
-
delete this.paths[
|
|
767
|
+
delete this.paths[U(e2)];
|
|
694
768
|
}
|
|
695
769
|
has(e2) {
|
|
696
|
-
return Object.hasOwnProperty.call(this.paths,
|
|
770
|
+
return Object.hasOwnProperty.call(this.paths, U(e2));
|
|
697
771
|
}
|
|
698
772
|
clear() {
|
|
699
773
|
this.paths = {};
|
|
@@ -702,9 +776,9 @@ class N {
|
|
|
702
776
|
Object.values(this.paths).forEach((t2) => e2(t2));
|
|
703
777
|
}
|
|
704
778
|
}
|
|
705
|
-
class
|
|
779
|
+
class q {
|
|
706
780
|
constructor(e2, t2, s2) {
|
|
707
|
-
this.handlers = s2, this.targetSubscriptions = new
|
|
781
|
+
this.handlers = s2, this.targetSubscriptions = new W(), this.connection = new $(e2, t2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onSubscriptionsLost: () => {
|
|
708
782
|
this.targetSubscriptions.forEach((e3) => {
|
|
709
783
|
this.resubscribe(e3);
|
|
710
784
|
}), this.handlers.onResubscribeSent();
|
|
@@ -717,22 +791,22 @@ class _ {
|
|
|
717
791
|
return this.connection.sync();
|
|
718
792
|
});
|
|
719
793
|
}
|
|
720
|
-
call(e2
|
|
721
|
-
return this.connection.call(e2
|
|
794
|
+
call(e2) {
|
|
795
|
+
return this.connection.call(e2);
|
|
722
796
|
}
|
|
723
797
|
subscribe(e2) {
|
|
724
798
|
return __async(this, null, function* () {
|
|
725
|
-
return this.targetSubscriptions.add(e2), this.connection.call("SUBSCRIBE", e2, {});
|
|
799
|
+
return this.targetSubscriptions.add(e2), this.connection.call({ method: "SUBSCRIBE", path: e2, data: {}, headers: {} });
|
|
726
800
|
});
|
|
727
801
|
}
|
|
728
802
|
unsubscribe(e2) {
|
|
729
803
|
return __async(this, null, function* () {
|
|
730
|
-
return this.targetSubscriptions.delete(e2), this.connection.call("UNSUBSCRIBE", e2, {});
|
|
804
|
+
return this.targetSubscriptions.delete(e2), this.connection.call({ method: "UNSUBSCRIBE", path: e2, data: {}, headers: {} });
|
|
731
805
|
});
|
|
732
806
|
}
|
|
733
807
|
resubscribe(e2) {
|
|
734
808
|
return __async(this, null, function* () {
|
|
735
|
-
const t2 = yield this.connection.call("SUBSCRIBE", e2, {});
|
|
809
|
+
const t2 = yield this.connection.call({ method: "SUBSCRIBE", path: e2, data: {}, headers: {} });
|
|
736
810
|
t2.ok || this.handlers.onResubscribeError(e2, t2);
|
|
737
811
|
});
|
|
738
812
|
}
|
|
@@ -743,75 +817,6 @@ class _ {
|
|
|
743
817
|
return this.connection.isConnected();
|
|
744
818
|
}
|
|
745
819
|
}
|
|
746
|
-
function O(e2) {
|
|
747
|
-
return Object.freeze(e2);
|
|
748
|
-
}
|
|
749
|
-
function P(e2) {
|
|
750
|
-
return O(e2.map((e3) => function(e4) {
|
|
751
|
-
switch (e4.type) {
|
|
752
|
-
case "text":
|
|
753
|
-
return Object.freeze({ type: "text", children: j(e4.children) });
|
|
754
|
-
case "file":
|
|
755
|
-
case "location":
|
|
756
|
-
return Object.freeze(e4);
|
|
757
|
-
}
|
|
758
|
-
}(e3)));
|
|
759
|
-
}
|
|
760
|
-
function j(e2) {
|
|
761
|
-
return O(e2.map((e3) => function(e4) {
|
|
762
|
-
if ("string" == typeof e4) return e4;
|
|
763
|
-
switch (e4.type) {
|
|
764
|
-
case "bold":
|
|
765
|
-
case "italic":
|
|
766
|
-
case "strikethrough":
|
|
767
|
-
case "bulletList":
|
|
768
|
-
case "bulletPoint":
|
|
769
|
-
case "link":
|
|
770
|
-
case "actionLink":
|
|
771
|
-
case "actionButton":
|
|
772
|
-
return Object.freeze(__spreadProps(__spreadValues({}, e4), { children: j(e4.children) }));
|
|
773
|
-
case "mention":
|
|
774
|
-
case "autoLink":
|
|
775
|
-
case "codeSpan":
|
|
776
|
-
case "customEmoji":
|
|
777
|
-
return Object.freeze(e4);
|
|
778
|
-
}
|
|
779
|
-
}(e3)));
|
|
780
|
-
}
|
|
781
|
-
function U(e2, t2) {
|
|
782
|
-
return void 0 === t2 ? e2 : t2;
|
|
783
|
-
}
|
|
784
|
-
function $(e2, t2) {
|
|
785
|
-
return void 0 === t2 ? e2 : O(t2);
|
|
786
|
-
}
|
|
787
|
-
function W(e2, t2) {
|
|
788
|
-
if (void 0 === t2) return e2;
|
|
789
|
-
if (null === t2) return O({});
|
|
790
|
-
const s2 = __spreadValues({}, e2);
|
|
791
|
-
for (const e3 in t2) {
|
|
792
|
-
const n2 = t2[e3];
|
|
793
|
-
null === n2 ? delete s2[e3] : s2[e3] = n2;
|
|
794
|
-
}
|
|
795
|
-
return O(s2);
|
|
796
|
-
}
|
|
797
|
-
function q(e2, t2) {
|
|
798
|
-
if (e2 === t2) return true;
|
|
799
|
-
if (!e2 || !t2) return false;
|
|
800
|
-
if ("object" != typeof e2 || "object" != typeof t2) return false;
|
|
801
|
-
if (e2.constructor !== t2.constructor) return false;
|
|
802
|
-
if (Array.isArray(e2) && Array.isArray(t2)) {
|
|
803
|
-
if (e2.length !== t2.length) return false;
|
|
804
|
-
for (let s2 = 0; s2 < e2.length; s2++) if (!q(e2[s2], t2[s2])) return false;
|
|
805
|
-
} else {
|
|
806
|
-
const s2 = Object.keys(e2);
|
|
807
|
-
if (s2.length !== Object.keys(t2).length) return false;
|
|
808
|
-
for (const n2 of s2) {
|
|
809
|
-
if (!Object.hasOwnProperty.call(t2, n2)) return false;
|
|
810
|
-
if (!q(e2[n2], t2[n2])) return false;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
return true;
|
|
814
|
-
}
|
|
815
820
|
class H {
|
|
816
821
|
constructor() {
|
|
817
822
|
this.prev = Promise.resolve();
|
|
@@ -965,7 +970,7 @@ class J extends z {
|
|
|
965
970
|
};
|
|
966
971
|
}
|
|
967
972
|
tryFullyUnsubscribe() {
|
|
968
|
-
this.externallyIdle && this.internallyIdle && this.setError(
|
|
973
|
+
this.externallyIdle && this.internallyIdle && this.setError(u("UNSUBSCRIBED"));
|
|
969
974
|
}
|
|
970
975
|
emit(e2) {
|
|
971
976
|
return __async(this, null, function* () {
|
|
@@ -1064,9 +1069,9 @@ function ne(e2) {
|
|
|
1064
1069
|
return s2 = s2.replace(/[^im]/g, "") + "g", new RegExp(t2[1], s2);
|
|
1065
1070
|
}
|
|
1066
1071
|
class re {
|
|
1067
|
-
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches: r2, forbiddenWords:
|
|
1068
|
-
if (ee.oneOf(e2, ["all", "otherOnly", "off"]), this.mode = e2, this.suppressLinks = false !==
|
|
1069
|
-
const e3 =
|
|
1072
|
+
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches: r2, forbiddenWords: a2, suppressLinks: i2, suppressEmailAddresses: o2, suppressPhoneNumbers: u2, replacement: c2 }) {
|
|
1073
|
+
if (ee.oneOf(e2, ["all", "otherOnly", "off"]), this.mode = e2, this.suppressLinks = false !== i2, this.suppressEmailAddresses = false !== o2, this.suppressPhoneNumbers = false !== u2, this.allowedHostnames = t2 || [], this.allowedPhoneNrs = (s2 || []).filter((e3) => e3).map((e3) => e3.replace(/[^0-9]/g, "")), this.allowedMatches = (n2 || []).filter(se).map((e3) => ne(e3)), this.forbiddenMatches = (r2 || []).filter(se).map((e3) => ne(e3)), a2) {
|
|
1074
|
+
const e3 = a2.split("\n").map((e4) => e4.trim().toLowerCase()).filter((e4) => e4.length > 0 && !e4.startsWith("#")).map((e4) => e4.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"));
|
|
1070
1075
|
e3.length && this.forbiddenMatches.push(new RegExp(`\\b(${e3.join("|")})\\b`, "gi"));
|
|
1071
1076
|
}
|
|
1072
1077
|
ee(() => this.allowedMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"), ee(() => this.forbiddenMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"), c2 = c2 == null ? void 0 : c2.trim(), this.replacement = c2 && c2.length > 0 ? c2 : void 0;
|
|
@@ -1075,7 +1080,7 @@ class re {
|
|
|
1075
1080
|
return "all" === this.mode || "otherOnly" === this.mode && !e2;
|
|
1076
1081
|
}
|
|
1077
1082
|
}
|
|
1078
|
-
function
|
|
1083
|
+
function ae(e2, t2) {
|
|
1079
1084
|
const s2 = e2.map((e3) => function(e4, t3) {
|
|
1080
1085
|
if ("text" === e4.type) return function(e5, t4) {
|
|
1081
1086
|
const s3 = function(e6) {
|
|
@@ -1083,7 +1088,7 @@ function ie(e2, t2) {
|
|
|
1083
1088
|
let t5 = "";
|
|
1084
1089
|
return e6.t && (t5 = `(${e6.t("CONTACT_INFORMATION_HIDDEN")})`), { formattedLinks: (_a2 = e6.formattedLinks) != null ? _a2 : "plaintext", markup: (_b2 = e6.markup) != null ? _b2 : false, useFallbackMentions: (_c = e6.useFallbackMentions) != null ? _c : false, sameTabLinkRules: (_d = e6.sameTabLinkRules) != null ? _d : [], enableEmojiImageFallback: (_e3 = e6.enableEmojiImageFallback) != null ? _e3 : false, highlight: (_f = e6.highlight) != null ? _f : [], contactInfo: (_g = e6.contactInfo) != null ? _g : false, suppression: (_h = e6.suppression) != null ? _h : new re({ mode: "off" }), contactInfoHiddenText: (_k = (_j = e6.contactInfoHiddenText) != null ? _j : (_i = e6.suppression) == null ? void 0 : _i.replacement) != null ? _k : t5, customEmojiUrls: (_l = e6.customEmojiUrls) != null ? _l : {}, enableActions: (_m = e6.enableActions) != null ? _m : true };
|
|
1085
1090
|
}(t4);
|
|
1086
|
-
return
|
|
1091
|
+
return ie(e5, s3);
|
|
1087
1092
|
}(e4.children, t3);
|
|
1088
1093
|
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${K(e4.url)}`;
|
|
1089
1094
|
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${K(e4.url)}`;
|
|
@@ -1099,7 +1104,7 @@ function ie(e2, t2) {
|
|
|
1099
1104
|
}(e3, t2));
|
|
1100
1105
|
return s2.join("\n\n");
|
|
1101
1106
|
}
|
|
1102
|
-
function
|
|
1107
|
+
function ie(e2, t2) {
|
|
1103
1108
|
return e2.flatMap((e3) => {
|
|
1104
1109
|
if ("string" == typeof e3) return e3;
|
|
1105
1110
|
switch (e3.type) {
|
|
@@ -1112,13 +1117,13 @@ function ae(e2, t2) {
|
|
|
1112
1117
|
case "actionLink":
|
|
1113
1118
|
case "actionbutton":
|
|
1114
1119
|
case "actionButton":
|
|
1115
|
-
return
|
|
1120
|
+
return ie(e3.children, t2);
|
|
1116
1121
|
case "bulletlist":
|
|
1117
1122
|
case "bulletList":
|
|
1118
|
-
return "\n" +
|
|
1123
|
+
return "\n" + ie(e3.children, t2);
|
|
1119
1124
|
case "bulletpoint":
|
|
1120
1125
|
case "bulletPoint":
|
|
1121
|
-
return "- " +
|
|
1126
|
+
return "- " + ie(e3.children, t2) + "\n";
|
|
1122
1127
|
case "autolink":
|
|
1123
1128
|
case "autoLink":
|
|
1124
1129
|
case "codeblock":
|
|
@@ -1137,14 +1142,14 @@ function ae(e2, t2) {
|
|
|
1137
1142
|
}).join("");
|
|
1138
1143
|
}
|
|
1139
1144
|
function oe(e2) {
|
|
1140
|
-
return
|
|
1145
|
+
return x({ id: e2.id, name: e2.name, custom: x(e2.custom), locale: e2.locale, photoUrl: e2.photoUrl, role: e2.role, welcomeMessage: e2.welcomeMessage });
|
|
1141
1146
|
}
|
|
1142
1147
|
function ue(e2, t2) {
|
|
1143
|
-
return
|
|
1148
|
+
return x({ user: t2, access: e2.access, notify: e2.notify, joinedAt: e2.joinedAt });
|
|
1144
1149
|
}
|
|
1145
1150
|
function ce(e2) {
|
|
1146
|
-
const t2 = Object.entries(e2).map(([e3, t3]) =>
|
|
1147
|
-
return t2.sort((e3, t3) => e3.emoji.localeCompare(t3.emoji)),
|
|
1151
|
+
const t2 = Object.entries(e2).map(([e3, t3]) => x({ emoji: e3, count: t3.count, currentUserReacted: t3.currentUserReacted }));
|
|
1152
|
+
return t2.sort((e3, t3) => e3.emoji.localeCompare(t3.emoji)), x(t2);
|
|
1148
1153
|
}
|
|
1149
1154
|
class le extends J {
|
|
1150
1155
|
constructor(e2, t2, s2, n2, r2) {
|
|
@@ -1152,32 +1157,32 @@ class le extends J {
|
|
|
1152
1157
|
}
|
|
1153
1158
|
fetchInitial(e2) {
|
|
1154
1159
|
return __async(this, null, function* () {
|
|
1155
|
-
const t2 = yield this.realtimeClient.call("GET", ["users", this.userId], { includePrivateFields: false }, { bypassCache: true });
|
|
1156
|
-
return t2.ok ?
|
|
1160
|
+
const t2 = yield this.realtimeClient.call({ method: "GET", path: ["users", this.userId], data: { includePrivateFields: false }, flags: { bypassCache: true } });
|
|
1161
|
+
return t2.ok ? o({ snapshot: oe(t2.value.data), lastChanged: e2 }) : "server" === t2.where && 404 === t2.value.status ? o({ snapshot: null, lastChanged: e2 }) : t2;
|
|
1157
1162
|
});
|
|
1158
1163
|
}
|
|
1159
1164
|
equal(e2, t2) {
|
|
1160
|
-
return
|
|
1165
|
+
return F(e2.snapshot, t2.snapshot);
|
|
1161
1166
|
}
|
|
1162
1167
|
loadNested(e2, t2) {
|
|
1163
1168
|
return __async(this, null, function* () {
|
|
1164
|
-
return
|
|
1169
|
+
return o(t2);
|
|
1165
1170
|
});
|
|
1166
1171
|
}
|
|
1167
1172
|
userCreated(e2, t2) {
|
|
1168
|
-
this.mutate(e2, (s2) => null !== s2.value.snapshot ? s2 :
|
|
1173
|
+
this.mutate(e2, (s2) => null !== s2.value.snapshot ? s2 : o({ snapshot: oe(t2.state), lastChanged: e2 }));
|
|
1169
1174
|
}
|
|
1170
1175
|
userEdited(e2, t2) {
|
|
1171
1176
|
this.mutate(e2, (s2) => {
|
|
1172
1177
|
const n2 = s2.value.snapshot;
|
|
1173
1178
|
if (null === n2) return console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."), s2;
|
|
1174
|
-
return
|
|
1179
|
+
return o({ snapshot: { id: n2.id, name: D(n2.name, t2.diff.name), custom: M(n2.custom, t2.diff.custom), locale: D(n2.locale, t2.diff.locale), photoUrl: D(n2.photoUrl, t2.diff.photoUrl), role: D(n2.role, t2.diff.role), welcomeMessage: D(n2.welcomeMessage, t2.diff.welcomeMessage) }, lastChanged: e2 });
|
|
1175
1180
|
});
|
|
1176
1181
|
}
|
|
1177
1182
|
getFromCache() {
|
|
1178
1183
|
return __async(this, null, function* () {
|
|
1179
1184
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1180
|
-
return e2.ok ? null === e2.value.snapshot ?
|
|
1185
|
+
return e2.ok ? null === e2.value.snapshot ? c({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["That user does not exist yet"] }) : o({ status: 200, data: { id: e2.value.snapshot.id, name: e2.value.snapshot.name, custom: e2.value.snapshot.custom, locale: e2.value.snapshot.locale, photoUrl: e2.value.snapshot.photoUrl, role: e2.value.snapshot.role, welcomeMessage: e2.value.snapshot.welcomeMessage } }) : u("NOT_IN_CACHE");
|
|
1181
1186
|
});
|
|
1182
1187
|
}
|
|
1183
1188
|
teardownNested(e2) {
|
|
@@ -1200,18 +1205,18 @@ class he extends z {
|
|
|
1200
1205
|
let t2;
|
|
1201
1206
|
if ("object" == typeof this.message) t2 = this.message;
|
|
1202
1207
|
else {
|
|
1203
|
-
const e3 = yield this.realtimeClient.call("GET", ["me", "conversations", this.conversationId, "messages", this.message], {}, { bypassCache: true });
|
|
1208
|
+
const e3 = yield this.realtimeClient.call({ method: "GET", path: ["me", "conversations", this.conversationId, "messages", this.message], data: {}, flags: { bypassCache: true } });
|
|
1204
1209
|
if (!e3.ok) return e3;
|
|
1205
1210
|
t2 = e3.value.data;
|
|
1206
1211
|
}
|
|
1207
|
-
return
|
|
1212
|
+
return o({ lastChanged: e2, sender: null === t2.senderId ? null : this.realtimeClient.internalSubscribe(["users", t2.senderId]), data: { id: t2.id, type: t2.type, custom: x(t2.custom), createdAt: t2.createdAt, editedAt: t2.editedAt, referencedMessageId: t2.referencedMessageId, origin: t2.origin, plaintext: ae(t2.content, {}), content: T(t2.content), reactions: ce(t2.reactions) } });
|
|
1208
1213
|
});
|
|
1209
1214
|
}
|
|
1210
1215
|
refetch(e2) {
|
|
1211
1216
|
throw "Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead";
|
|
1212
1217
|
}
|
|
1213
1218
|
equal(e2, t2) {
|
|
1214
|
-
return
|
|
1219
|
+
return F(e2.data, t2.data);
|
|
1215
1220
|
}
|
|
1216
1221
|
teardownNested(e2) {
|
|
1217
1222
|
var _a2;
|
|
@@ -1229,35 +1234,35 @@ class he extends z {
|
|
|
1229
1234
|
var _a2, _b2, _c;
|
|
1230
1235
|
const s2 = yield (_b2 = (_a2 = t2.sender) == null ? void 0 : _a2.store) == null ? void 0 : _b2.getDeep(e2);
|
|
1231
1236
|
if (false === (s2 == null ? void 0 : s2.ok)) return s2;
|
|
1232
|
-
if (null === t2.data) return
|
|
1237
|
+
if (null === t2.data) return o({ snapshot: null });
|
|
1233
1238
|
const n2 = s2 == null ? void 0 : s2.value;
|
|
1234
|
-
return
|
|
1239
|
+
return o({ snapshot: x({ sender: (_c = n2 == null ? void 0 : n2.snapshot) != null ? _c : null, id: t2.data.id, type: t2.data.type, custom: x(t2.data.custom), createdAt: t2.data.createdAt, editedAt: t2.data.editedAt, origin: t2.data.origin, plaintext: t2.data.plaintext, content: t2.data.content, referencedMessageId: t2.data.referencedMessageId, reactions: t2.data.reactions }) });
|
|
1235
1240
|
});
|
|
1236
1241
|
}
|
|
1237
1242
|
messageEdited(e2, t2) {
|
|
1238
1243
|
this.mutate(e2, (s2) => {
|
|
1239
1244
|
if (null === s2.value.data) return s2;
|
|
1240
|
-
const n2 = s2.value.data.content, r2 = (
|
|
1241
|
-
var
|
|
1242
|
-
const
|
|
1243
|
-
return
|
|
1245
|
+
const n2 = s2.value.data.content, r2 = (a2 = n2, void 0 === (i2 = t2.diff.content) ? a2 : T(i2));
|
|
1246
|
+
var a2, i2;
|
|
1247
|
+
const u2 = n2 === r2 ? s2.value.data.plaintext : ae(r2, {});
|
|
1248
|
+
return o({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: s2.value.data.referencedMessageId, editedAt: D(s2.value.data.editedAt, t2.diff.editedAt), custom: M(s2.value.data.custom, t2.diff.custom), plaintext: u2, content: r2, reactions: de(s2.value.data.reactions, t2.diff.reactions) } });
|
|
1244
1249
|
});
|
|
1245
1250
|
}
|
|
1246
1251
|
messageDeleted(e2, t2) {
|
|
1247
|
-
this.mutate(e2, (s2) => null === s2.value.data ? s2 : this.messageId === t2.messageId ? (this.teardownNested(s2.value),
|
|
1252
|
+
this.mutate(e2, (s2) => null === s2.value.data ? s2 : this.messageId === t2.messageId ? (this.teardownNested(s2.value), o({ lastChanged: e2, sender: null, data: null })) : s2.value.data.referencedMessageId === t2.messageId ? o({ lastChanged: e2, sender: s2.value.sender, data: { id: s2.value.data.id, type: s2.value.data.type, createdAt: s2.value.data.createdAt, origin: s2.value.data.origin, referencedMessageId: null, editedAt: s2.value.data.editedAt, custom: s2.value.data.custom, plaintext: s2.value.data.plaintext, content: s2.value.data.content, reactions: s2.value.data.reactions } }) : s2);
|
|
1248
1253
|
}
|
|
1249
1254
|
getFromCache() {
|
|
1250
1255
|
return __async(this, null, function* () {
|
|
1251
1256
|
var _b2;
|
|
1252
1257
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1253
|
-
if (!e2.ok) return
|
|
1258
|
+
if (!e2.ok) return u("NOT_IN_CACHE");
|
|
1254
1259
|
if (null === e2.value.data) {
|
|
1255
|
-
return
|
|
1260
|
+
return c({ status: 404, errorCode: "MESSAGE_NOT_FOUND", reasons: ["No message with that ID exists"] });
|
|
1256
1261
|
}
|
|
1257
1262
|
const _a2 = e2.value, { sender: t2 } = _a2, s2 = __objRest(_a2, ["sender"]), n2 = {};
|
|
1258
1263
|
return s2.data.reactions.forEach((e3) => {
|
|
1259
1264
|
n2[e3.emoji] = { count: e3.count, currentUserReacted: e3.currentUserReacted };
|
|
1260
|
-
}),
|
|
1265
|
+
}), o({ status: 200, data: __spreadProps(__spreadValues({}, s2.data), { senderId: (_b2 = t2 == null ? void 0 : t2.store.userId) != null ? _b2 : null, reactions: n2 }) });
|
|
1261
1266
|
});
|
|
1262
1267
|
}
|
|
1263
1268
|
}
|
|
@@ -1265,13 +1270,13 @@ function de(e2, t2) {
|
|
|
1265
1270
|
if (void 0 === t2) return e2;
|
|
1266
1271
|
const s2 = e2.map((e3) => {
|
|
1267
1272
|
const s3 = t2[e3.emoji];
|
|
1268
|
-
return void 0 === s3 ? e3 :
|
|
1273
|
+
return void 0 === s3 ? e3 : x(null === s3 ? __spreadProps(__spreadValues({}, e3), { count: 0 }) : { emoji: e3.emoji, count: D(e3.count, s3.count), currentUserReacted: D(e3.currentUserReacted, s3.currentUserReacted) });
|
|
1269
1274
|
}).filter((e3) => e3.count > 0), n2 = new Set(s2.map((e3) => e3.emoji));
|
|
1270
1275
|
for (const e3 in t2) {
|
|
1271
1276
|
const r2 = t2[e3];
|
|
1272
|
-
r2 && !n2.has(e3) && s2.push(
|
|
1277
|
+
r2 && !n2.has(e3) && s2.push(x({ emoji: e3, count: r2.count, currentUserReacted: r2.currentUserReacted }));
|
|
1273
1278
|
}
|
|
1274
|
-
return s2.sort((e3, t3) => e3.emoji.localeCompare(t3.emoji)),
|
|
1279
|
+
return s2.sort((e3, t3) => e3.emoji.localeCompare(t3.emoji)), x(s2);
|
|
1275
1280
|
}
|
|
1276
1281
|
class pe extends z {
|
|
1277
1282
|
constructor(e2, t2, s2, n2) {
|
|
@@ -1282,7 +1287,7 @@ class pe extends z {
|
|
|
1282
1287
|
}
|
|
1283
1288
|
fetchInitial(e2) {
|
|
1284
1289
|
return __async(this, null, function* () {
|
|
1285
|
-
return
|
|
1290
|
+
return o({ lastChanged: e2, dataStore: this.dataStore, referencedDataStore: this.referencedDataStore });
|
|
1286
1291
|
});
|
|
1287
1292
|
}
|
|
1288
1293
|
refetch(e2) {
|
|
@@ -1305,11 +1310,11 @@ class pe extends z {
|
|
|
1305
1310
|
const s2 = yield t2.dataStore.getDeep(e2);
|
|
1306
1311
|
if (!s2.ok) return s2;
|
|
1307
1312
|
const n2 = s2.value;
|
|
1308
|
-
if (null === n2.snapshot) return
|
|
1313
|
+
if (null === n2.snapshot) return o({ snapshot: null });
|
|
1309
1314
|
const r2 = yield (_a2 = t2.referencedDataStore) == null ? void 0 : _a2.getDeep(e2);
|
|
1310
1315
|
if (r2 && !r2.ok) return r2;
|
|
1311
|
-
const
|
|
1312
|
-
return
|
|
1316
|
+
const a2 = (_b2 = r2 == null ? void 0 : r2.value) != null ? _b2 : null, i2 = (_c = a2 == null ? void 0 : a2.snapshot) != null ? _c : null;
|
|
1317
|
+
return o({ snapshot: x({ id: n2.snapshot.id, type: n2.snapshot.type, sender: n2.snapshot.sender, custom: x(n2.snapshot.custom), createdAt: n2.snapshot.createdAt, editedAt: n2.snapshot.editedAt, referencedMessage: i2, origin: n2.snapshot.origin, plaintext: n2.snapshot.plaintext, content: n2.snapshot.content, reactions: n2.snapshot.reactions }) });
|
|
1313
1318
|
});
|
|
1314
1319
|
}
|
|
1315
1320
|
}
|
|
@@ -1328,12 +1333,12 @@ class fe extends J {
|
|
|
1328
1333
|
fetchInitial(e2) {
|
|
1329
1334
|
return __async(this, null, function* () {
|
|
1330
1335
|
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield me({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: t2 });
|
|
1331
|
-
return s2.ok ? null === s2.value.messages ?
|
|
1336
|
+
return s2.ok ? null === s2.value.messages ? o({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) : ge({ seq: e2, messages: s2.value.messages, cursor: s2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : s2;
|
|
1332
1337
|
});
|
|
1333
1338
|
}
|
|
1334
1339
|
teardownNested(e2) {
|
|
1335
1340
|
if (e2.stores) {
|
|
1336
|
-
const t2 =
|
|
1341
|
+
const t2 = u("TERMINATED");
|
|
1337
1342
|
Object.values(e2.stores).forEach((e3) => e3.setError(t2)), e2.inWindow.forEach((e3) => e3.setError(t2));
|
|
1338
1343
|
}
|
|
1339
1344
|
}
|
|
@@ -1359,20 +1364,20 @@ class fe extends J {
|
|
|
1359
1364
|
});
|
|
1360
1365
|
}
|
|
1361
1366
|
equal(e2, t2) {
|
|
1362
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1367
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!F(Object.keys(e2.stores), Object.keys(t2.stores)) && (!!F(e2.inWindow.map((e3) => e3.messageId), t2.inWindow.map((e3) => e3.messageId)) && F(e2.windowEnd, t2.windowEnd)));
|
|
1363
1368
|
}
|
|
1364
1369
|
loadNested(e2, t2) {
|
|
1365
1370
|
return __async(this, null, function* () {
|
|
1366
|
-
if (null === t2.stores) return
|
|
1371
|
+
if (null === t2.stores) return o({ snapshot: null, loadedAll: true });
|
|
1367
1372
|
const s2 = yield Promise.all(t2.inWindow.map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1368
1373
|
if (n2) return n2;
|
|
1369
|
-
return
|
|
1374
|
+
return o({ snapshot: x(s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot)), loadedAll: null === t2.windowEnd });
|
|
1370
1375
|
});
|
|
1371
1376
|
}
|
|
1372
1377
|
loadMore(e2) {
|
|
1373
1378
|
return __async(this, null, function* () {
|
|
1374
1379
|
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1375
|
-
const t2 =
|
|
1380
|
+
const t2 = a();
|
|
1376
1381
|
this.pendingLoadMore = t2.promise, yield this._loadMoreMessages(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1377
1382
|
});
|
|
1378
1383
|
}
|
|
@@ -1395,13 +1400,13 @@ class fe extends J {
|
|
|
1395
1400
|
if (Object.hasOwnProperty.call(s2.value.stores, t2.state.id)) return s2;
|
|
1396
1401
|
const n2 = __spreadValues({}, s2.value.stores), r2 = new he(e2, this.conversationId, t2.state, this.realtimeClient);
|
|
1397
1402
|
n2[t2.state.id] = r2;
|
|
1398
|
-
const
|
|
1399
|
-
let
|
|
1400
|
-
null ===
|
|
1401
|
-
const
|
|
1402
|
-
|
|
1403
|
-
const l2 =
|
|
1404
|
-
return
|
|
1403
|
+
const a2 = t2.state.referencedMessageId;
|
|
1404
|
+
let i2;
|
|
1405
|
+
null === a2 ? i2 = null : a2 in n2 ? i2 = n2[a2] : (i2 = new he(e2, this.conversationId, a2, this.realtimeClient), n2[a2] = i2);
|
|
1406
|
+
const u2 = new pe(e2, t2.state.createdAt, r2, i2), c2 = [...s2.value.inWindow, u2];
|
|
1407
|
+
c2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1408
|
+
const l2 = c2[0].messageId === t2.messageId ? e2 : s2.value.lastMessageChanged;
|
|
1409
|
+
return o({ lastChanged: e2, lastMessageChanged: l2, stores: n2, inWindow: c2, windowEnd: s2.value.windowEnd });
|
|
1405
1410
|
});
|
|
1406
1411
|
}
|
|
1407
1412
|
messageEdited(e2, t2) {
|
|
@@ -1420,20 +1425,20 @@ class fe extends J {
|
|
|
1420
1425
|
if (t2.newLastMessage && 0 === r2.length) {
|
|
1421
1426
|
const s3 = new he(e2, this.conversationId, t2.newLastMessage, this.realtimeClient);
|
|
1422
1427
|
n2[s3.messageId] = s3;
|
|
1423
|
-
const
|
|
1424
|
-
let
|
|
1425
|
-
null ===
|
|
1426
|
-
const o2 = new pe(e2, t2.newLastMessage.createdAt, s3,
|
|
1428
|
+
const a3 = t2.newLastMessage.referencedMessageId;
|
|
1429
|
+
let i2;
|
|
1430
|
+
null === a3 ? i2 = null : a3 in n2 ? i2 = n2[a3] : (i2 = new he(e2, this.conversationId, a3, this.realtimeClient), n2[a3] = i2);
|
|
1431
|
+
const o2 = new pe(e2, t2.newLastMessage.createdAt, s3, i2);
|
|
1427
1432
|
r2.push(o2);
|
|
1428
1433
|
}
|
|
1429
|
-
const
|
|
1430
|
-
return
|
|
1434
|
+
const a2 = void 0 !== t2.newLastMessage ? e2 : s2.value.lastMessageChanged;
|
|
1435
|
+
return o({ lastChanged: e2, lastMessageChanged: a2, stores: n2, inWindow: r2, windowEnd: s2.value.windowEnd });
|
|
1431
1436
|
});
|
|
1432
1437
|
}
|
|
1433
1438
|
conversationCleared(e2, t2) {
|
|
1434
1439
|
this.mutate(e2, (t3) => {
|
|
1435
1440
|
var _a2;
|
|
1436
|
-
return 0 === ((_a2 = t3.value.inWindow) == null ? void 0 : _a2.length) && null === t3.value.windowEnd ? t3 : (this.teardownNested(t3.value),
|
|
1441
|
+
return 0 === ((_a2 = t3.value.inWindow) == null ? void 0 : _a2.length) && null === t3.value.windowEnd ? t3 : (this.teardownNested(t3.value), o({ lastChanged: e2, lastMessageChanged: e2, stores: {}, inWindow: [], windowEnd: null }));
|
|
1437
1442
|
});
|
|
1438
1443
|
}
|
|
1439
1444
|
sideCreated(e2, t2) {
|
|
@@ -1443,48 +1448,48 @@ class fe extends J {
|
|
|
1443
1448
|
}), e3) : s2);
|
|
1444
1449
|
}
|
|
1445
1450
|
sideDeleted(e2, t2) {
|
|
1446
|
-
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value),
|
|
1451
|
+
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value), o({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1447
1452
|
}
|
|
1448
1453
|
getMessageFromCache(e2) {
|
|
1449
1454
|
return __async(this, null, function* () {
|
|
1450
1455
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1451
|
-
if (!t2.ok) return
|
|
1452
|
-
if (null === t2.value.stores) return
|
|
1456
|
+
if (!t2.ok) return u("NOT_IN_CACHE");
|
|
1457
|
+
if (null === t2.value.stores) return u("NOT_IN_CACHE");
|
|
1453
1458
|
const s2 = t2.value.stores[e2];
|
|
1454
|
-
return void 0 === s2 ?
|
|
1459
|
+
return void 0 === s2 ? u("NOT_IN_CACHE") : s2.getFromCache();
|
|
1455
1460
|
});
|
|
1456
1461
|
}
|
|
1457
1462
|
}
|
|
1458
1463
|
function me(_0) {
|
|
1459
1464
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1460
|
-
const r2 = { limit: n2, cursor: e2 },
|
|
1461
|
-
if (
|
|
1462
|
-
const { data: e3, cursor: t3 } =
|
|
1463
|
-
return
|
|
1465
|
+
const r2 = { limit: n2, cursor: e2 }, a2 = yield t2.call({ method: "GET", path: ["me", "conversations", s2, "messages"], data: r2, flags: { bypassCache: true } });
|
|
1466
|
+
if (a2.ok) {
|
|
1467
|
+
const { data: e3, cursor: t3 } = a2.value.data;
|
|
1468
|
+
return o({ messages: e3, nextCursor: t3 });
|
|
1464
1469
|
}
|
|
1465
|
-
return (
|
|
1470
|
+
return (a2.ok || "server" !== a2.where || 404 !== a2.value.status) && (a2.ok || "server" !== a2.where || 403 !== a2.value.status || "NOT_A_PARTICIPANT" !== a2.value.errorCode) ? a2 : o({ messages: null, nextCursor: null });
|
|
1466
1471
|
});
|
|
1467
1472
|
}
|
|
1468
|
-
function ge({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId: r2, realtimeClient:
|
|
1473
|
+
function ge({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId: r2, realtimeClient: a2 }) {
|
|
1469
1474
|
var _a2, _b2, _c, _d;
|
|
1470
|
-
const
|
|
1471
|
-
for (const t3 of s2) if (void 0 ===
|
|
1472
|
-
const s3 = new he(e2, r2, t3,
|
|
1473
|
-
|
|
1475
|
+
const i2 = t2 ? __spreadValues({}, t2.stores) : {};
|
|
1476
|
+
for (const t3 of s2) if (void 0 === i2[t3.id]) {
|
|
1477
|
+
const s3 = new he(e2, r2, t3, a2);
|
|
1478
|
+
i2[s3.messageId] = s3;
|
|
1474
1479
|
}
|
|
1475
1480
|
for (const t3 of s2) {
|
|
1476
1481
|
const s3 = t3.referencedMessageId;
|
|
1477
|
-
if (s3 && void 0 ===
|
|
1478
|
-
const t4 = new he(e2, r2, s3,
|
|
1479
|
-
|
|
1482
|
+
if (s3 && void 0 === i2[s3]) {
|
|
1483
|
+
const t4 = new he(e2, r2, s3, a2);
|
|
1484
|
+
i2[t4.messageId] = t4;
|
|
1480
1485
|
}
|
|
1481
1486
|
}
|
|
1482
|
-
const
|
|
1483
|
-
for (const t3 of s2)
|
|
1484
|
-
|
|
1485
|
-
const
|
|
1486
|
-
if (null === n2) return
|
|
1487
|
-
return
|
|
1487
|
+
const u2 = t2 ? [...t2.inWindow] : [];
|
|
1488
|
+
for (const t3 of s2) u2.push(new pe(e2, t3.createdAt, i2[t3.id], t3.referencedMessageId ? i2[t3.referencedMessageId] : null));
|
|
1489
|
+
u2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1490
|
+
const c2 = (_b2 = (_a2 = t2 == null ? void 0 : t2.inWindow) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.messageId, l2 = (_c = u2 == null ? void 0 : u2[0]) == null ? void 0 : _c.messageId, h2 = c2 === l2 ? (_d = t2 == null ? void 0 : t2.lastMessageChanged) != null ? _d : e2 : e2;
|
|
1491
|
+
if (null === n2) return o({ lastChanged: e2, lastMessageChanged: h2, stores: i2, inWindow: u2, windowEnd: null });
|
|
1492
|
+
return o({ lastChanged: e2, lastMessageChanged: h2, stores: i2, inWindow: u2, windowEnd: { cursor: n2, oldestMessageTs: s2[s2.length - 1].createdAt } });
|
|
1488
1493
|
}
|
|
1489
1494
|
class ve extends J {
|
|
1490
1495
|
constructor(e2, t2, s2, n2, r2) {
|
|
@@ -1492,7 +1497,7 @@ class ve extends J {
|
|
|
1492
1497
|
}
|
|
1493
1498
|
fetchInitial(e2) {
|
|
1494
1499
|
return __async(this, null, function* () {
|
|
1495
|
-
return
|
|
1500
|
+
return o({ lastChanged: e2, convData: this.convData });
|
|
1496
1501
|
});
|
|
1497
1502
|
}
|
|
1498
1503
|
teardownNested(e2) {
|
|
@@ -1524,8 +1529,8 @@ function be(e2, t2) {
|
|
|
1524
1529
|
return function(e3, t3) {
|
|
1525
1530
|
let s2 = {}, n2 = 0;
|
|
1526
1531
|
return we(e3, (e4, r2) => {
|
|
1527
|
-
const [
|
|
1528
|
-
s2[
|
|
1532
|
+
const [a2, i2] = t3([r2, e4], n2++);
|
|
1533
|
+
s2[a2] = i2;
|
|
1529
1534
|
}), s2;
|
|
1530
1535
|
}(e2, ([e3, s2]) => [e3, t2(s2, e3)]);
|
|
1531
1536
|
}
|
|
@@ -1535,30 +1540,30 @@ class ye extends J {
|
|
|
1535
1540
|
}
|
|
1536
1541
|
fetchInitial(e2) {
|
|
1537
1542
|
return __async(this, null, function* () {
|
|
1538
|
-
const t2 = yield this.realtimeClient.call("GET", ["me", "conversations", this.conversationId, "typing"], {}, { bypassCache: true });
|
|
1539
|
-
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return
|
|
1540
|
-
if (!t2.ok && "server" === t2.where && 403 === t2.value.status && "NOT_A_PARTICIPANT" === t2.value.errorCode) return
|
|
1543
|
+
const t2 = yield this.realtimeClient.call({ method: "GET", path: ["me", "conversations", this.conversationId, "typing"], data: {}, flags: { bypassCache: true } });
|
|
1544
|
+
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return o({ data: null, lastChanged: e2 });
|
|
1545
|
+
if (!t2.ok && "server" === t2.where && 403 === t2.value.status && "NOT_A_PARTICIPANT" === t2.value.errorCode) return o({ data: null, lastChanged: e2 });
|
|
1541
1546
|
if (!t2.ok) return t2;
|
|
1542
1547
|
const s2 = t2.value.data;
|
|
1543
|
-
if (s2.many) return
|
|
1544
|
-
return
|
|
1548
|
+
if (s2.many) return o({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1549
|
+
return o({ data: s2, userSubscriptions: be(s2.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 });
|
|
1545
1550
|
});
|
|
1546
1551
|
}
|
|
1547
1552
|
equal(e2, t2) {
|
|
1548
|
-
return
|
|
1553
|
+
return F(e2.data, t2.data);
|
|
1549
1554
|
}
|
|
1550
1555
|
loadNested(e2, t2) {
|
|
1551
1556
|
return __async(this, null, function* () {
|
|
1552
|
-
if (null === t2.data) return
|
|
1553
|
-
if (t2.data.many) return
|
|
1557
|
+
if (null === t2.data) return o({ snapshot: null, lastChanged: t2.lastChanged });
|
|
1558
|
+
if (t2.data.many) return o({ snapshot: x({ many: true }), lastChanged: t2.lastChanged });
|
|
1554
1559
|
const s2 = Object.entries(t2.data.usersTyping).sort(([e3, t3], [s3, n3]) => t3 - n3).map(([e3, t3]) => e3).map((s3) => t2.userSubscriptions[s3].store.getDeep(e2)), n2 = yield Promise.all(s2), r2 = n2.find((e3) => !e3.ok);
|
|
1555
1560
|
if (r2) return r2;
|
|
1556
|
-
const
|
|
1557
|
-
return
|
|
1561
|
+
const a2 = n2.map((e3) => e3.value), i2 = a2.map((e3) => e3.snapshot), u2 = a2.map((e3) => e3.lastChanged), c2 = Math.max(t2.lastChanged, ...u2);
|
|
1562
|
+
return o({ snapshot: x({ users: x(i2), many: false }), lastChanged: c2 });
|
|
1558
1563
|
});
|
|
1559
1564
|
}
|
|
1560
1565
|
typingAvailable(e2, t2) {
|
|
1561
|
-
this.mutate(e2, () =>
|
|
1566
|
+
this.mutate(e2, () => o({ data: t2.state, userSubscriptions: t2.state.many ? {} : be(t2.state.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 }));
|
|
1562
1567
|
}
|
|
1563
1568
|
typingChanged(e2, t2) {
|
|
1564
1569
|
this.mutate(e2, (s2) => {
|
|
@@ -1569,19 +1574,19 @@ class ye extends J {
|
|
|
1569
1574
|
return we(t2.diff.usersTyping, (e3, t3) => {
|
|
1570
1575
|
var _a2;
|
|
1571
1576
|
"number" == typeof e3 ? (n2[t3] = e3, r2[t3] = this.realtimeClient.internalSubscribe(["users", t3])) : null === e3 && (delete n2[t3], (_a2 = r2[t3]) == null ? void 0 : _a2.unsubscribe(), delete r2[t3]);
|
|
1572
|
-
}),
|
|
1577
|
+
}), o({ data: { usersTyping: n2, many: false }, userSubscriptions: r2, lastChanged: e2 });
|
|
1573
1578
|
}
|
|
1574
|
-
if (true === t2.diff.many) return s2.value.data.many ? s2 :
|
|
1579
|
+
if (true === t2.diff.many) return s2.value.data.many ? s2 : o({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1575
1580
|
if (false === t2.diff.many) {
|
|
1576
1581
|
if (false === s2.value.data.many) return s2;
|
|
1577
1582
|
const n2 = be(t2.diff.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3]));
|
|
1578
|
-
return
|
|
1583
|
+
return o({ data: t2.diff, userSubscriptions: n2, lastChanged: e2 });
|
|
1579
1584
|
}
|
|
1580
1585
|
throw t2.diff, "Unreachable";
|
|
1581
1586
|
});
|
|
1582
1587
|
}
|
|
1583
1588
|
sideDeleted(e2, t2) {
|
|
1584
|
-
this.mutate(e2, (t3) => null === t3.value.data ? t3 :
|
|
1589
|
+
this.mutate(e2, (t3) => null === t3.value.data ? t3 : o({ data: null, lastChanged: e2 }));
|
|
1585
1590
|
}
|
|
1586
1591
|
teardownNested(e2) {
|
|
1587
1592
|
e2.data && we(e2.userSubscriptions, (e3) => e3.unsubscribe());
|
|
@@ -1604,7 +1609,7 @@ class Ce extends z {
|
|
|
1604
1609
|
}
|
|
1605
1610
|
fetchInitial(e2) {
|
|
1606
1611
|
return __async(this, null, function* () {
|
|
1607
|
-
return
|
|
1612
|
+
return o({ lastChanged: e2, user: this.realtimeClient.internalSubscribe(["users", this.participantData.id]), data: this.participantData });
|
|
1608
1613
|
});
|
|
1609
1614
|
}
|
|
1610
1615
|
refetch(e2) {
|
|
@@ -1612,7 +1617,7 @@ class Ce extends z {
|
|
|
1612
1617
|
}
|
|
1613
1618
|
equal(e2, t2) {
|
|
1614
1619
|
var _a2, _b2, _c, _d;
|
|
1615
|
-
return ((_b2 = (_a2 = e2.user) == null ? void 0 : _a2.store) == null ? void 0 : _b2.userId) === ((_d = (_c = t2.user) == null ? void 0 : _c.store) == null ? void 0 : _d.userId) &&
|
|
1620
|
+
return ((_b2 = (_a2 = e2.user) == null ? void 0 : _a2.store) == null ? void 0 : _b2.userId) === ((_d = (_c = t2.user) == null ? void 0 : _c.store) == null ? void 0 : _d.userId) && F(e2.data, t2.data);
|
|
1616
1621
|
}
|
|
1617
1622
|
teardownNested(e2) {
|
|
1618
1623
|
var _a2;
|
|
@@ -1627,30 +1632,30 @@ class Ce extends z {
|
|
|
1627
1632
|
}
|
|
1628
1633
|
loadNested(e2, t2) {
|
|
1629
1634
|
return __async(this, null, function* () {
|
|
1630
|
-
if (null === t2.data) return
|
|
1635
|
+
if (null === t2.data) return o({ snapshot: null });
|
|
1631
1636
|
const s2 = yield t2.user.store.getDeep(e2);
|
|
1632
1637
|
if (false === s2.ok) return s2;
|
|
1633
1638
|
const n2 = s2.value.snapshot;
|
|
1634
|
-
return
|
|
1639
|
+
return o({ snapshot: ue(t2.data, n2) });
|
|
1635
1640
|
});
|
|
1636
1641
|
}
|
|
1637
1642
|
participantEdited(e2, t2) {
|
|
1638
1643
|
this.mutate(e2, (s2) => {
|
|
1639
1644
|
if (null === s2.value.data) return s2;
|
|
1640
|
-
return
|
|
1645
|
+
return o({ lastChanged: e2, user: s2.value.user, data: { id: s2.value.data.id, access: D(s2.value.data.access, t2.diff.access), notify: D(s2.value.data.notify, t2.diff.notify), joinedAt: s2.value.data.joinedAt } });
|
|
1641
1646
|
});
|
|
1642
1647
|
}
|
|
1643
1648
|
participantDeleted(e2, t2) {
|
|
1644
|
-
this.mutate(e2, (t3) => null === t3.value.data ? t3 : (this.teardownNested(t3.value),
|
|
1649
|
+
this.mutate(e2, (t3) => null === t3.value.data ? t3 : (this.teardownNested(t3.value), o({ lastChanged: e2, user: null, data: null })));
|
|
1645
1650
|
}
|
|
1646
1651
|
getFromCache() {
|
|
1647
1652
|
return __async(this, null, function* () {
|
|
1648
1653
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1649
|
-
if (!e2.ok) return
|
|
1654
|
+
if (!e2.ok) return u("NOT_IN_CACHE");
|
|
1650
1655
|
if (null === e2.value.data) {
|
|
1651
|
-
return
|
|
1656
|
+
return c({ status: 404, errorCode: "PARTICIPANT_NOT_FOUND", reasons: ["No participant with that ID exists"] });
|
|
1652
1657
|
}
|
|
1653
|
-
return
|
|
1658
|
+
return o({ status: 200, data: e2.value.data });
|
|
1654
1659
|
});
|
|
1655
1660
|
}
|
|
1656
1661
|
}
|
|
@@ -1661,12 +1666,12 @@ class Ae extends J {
|
|
|
1661
1666
|
fetchInitial(e2) {
|
|
1662
1667
|
return __async(this, null, function* () {
|
|
1663
1668
|
const t2 = yield Ee({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: 10 });
|
|
1664
|
-
return t2.ok ? null === t2.value.participants ?
|
|
1669
|
+
return t2.ok ? null === t2.value.participants ? o({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null }) : ke({ seq: e2, participants: t2.value.participants, cursor: t2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : t2;
|
|
1665
1670
|
});
|
|
1666
1671
|
}
|
|
1667
1672
|
teardownNested(e2) {
|
|
1668
1673
|
if (e2.stores) {
|
|
1669
|
-
const t2 =
|
|
1674
|
+
const t2 = u("TERMINATED");
|
|
1670
1675
|
Object.values(e2.stores).forEach((e3) => e3.setError(t2));
|
|
1671
1676
|
}
|
|
1672
1677
|
}
|
|
@@ -1680,21 +1685,21 @@ class Ae extends J {
|
|
|
1680
1685
|
});
|
|
1681
1686
|
}
|
|
1682
1687
|
equal(e2, t2) {
|
|
1683
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1688
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!F(Object.keys(e2.stores), Object.keys(t2.stores)) && F(e2.windowEnd, t2.windowEnd));
|
|
1684
1689
|
}
|
|
1685
1690
|
loadNested(e2, t2) {
|
|
1686
1691
|
return __async(this, null, function* () {
|
|
1687
|
-
if (null === t2.stores) return
|
|
1692
|
+
if (null === t2.stores) return o({ snapshot: null, loadedAll: true });
|
|
1688
1693
|
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1689
1694
|
if (n2) return n2;
|
|
1690
1695
|
const r2 = s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot);
|
|
1691
|
-
return r2.sort((e3, t3) => t3.joinedAt - e3.joinedAt),
|
|
1696
|
+
return r2.sort((e3, t3) => t3.joinedAt - e3.joinedAt), o({ snapshot: x(r2), loadedAll: null === t2.windowEnd });
|
|
1692
1697
|
});
|
|
1693
1698
|
}
|
|
1694
1699
|
loadMore(e2) {
|
|
1695
1700
|
return __async(this, null, function* () {
|
|
1696
1701
|
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1697
|
-
const t2 =
|
|
1702
|
+
const t2 = a();
|
|
1698
1703
|
this.pendingLoadMore = t2.promise, yield this._loadMoreParticipants(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1699
1704
|
});
|
|
1700
1705
|
}
|
|
@@ -1717,7 +1722,7 @@ class Ae extends J {
|
|
|
1717
1722
|
if (Object.hasOwnProperty.call(s2.value.stores, t2.state.id)) return s2;
|
|
1718
1723
|
const n2 = __spreadValues({}, s2.value.stores), r2 = new Ce(e2, this.conversationId, t2.state, this.realtimeClient);
|
|
1719
1724
|
n2[t2.state.id] = r2;
|
|
1720
|
-
return
|
|
1725
|
+
return o({ lastChanged: e2, stores: n2, windowEnd: s2.value.windowEnd });
|
|
1721
1726
|
});
|
|
1722
1727
|
}
|
|
1723
1728
|
participantEdited(e2, t2) {
|
|
@@ -1733,7 +1738,7 @@ class Ae extends J {
|
|
|
1733
1738
|
if (void 0 === n2) return s2;
|
|
1734
1739
|
n2.participantDeleted(e2, t2);
|
|
1735
1740
|
const r2 = __spreadValues({}, s2.value.stores);
|
|
1736
|
-
return delete r2[t2.userId],
|
|
1741
|
+
return delete r2[t2.userId], o({ lastChanged: e2, stores: r2, windowEnd: s2.value.windowEnd });
|
|
1737
1742
|
});
|
|
1738
1743
|
}
|
|
1739
1744
|
sideCreated(e2, t2) {
|
|
@@ -1743,36 +1748,36 @@ class Ae extends J {
|
|
|
1743
1748
|
}), e3) : s2);
|
|
1744
1749
|
}
|
|
1745
1750
|
sideDeleted(e2, t2) {
|
|
1746
|
-
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value),
|
|
1751
|
+
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (this.teardownNested(t3.value), o({ lastChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1747
1752
|
}
|
|
1748
1753
|
getParticipantFromCache(e2) {
|
|
1749
1754
|
return __async(this, null, function* () {
|
|
1750
1755
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1751
|
-
if (!t2.ok) return
|
|
1752
|
-
if (null === t2.value.stores) return
|
|
1756
|
+
if (!t2.ok) return u("NOT_IN_CACHE");
|
|
1757
|
+
if (null === t2.value.stores) return u("NOT_IN_CACHE");
|
|
1753
1758
|
const s2 = t2.value.stores[e2];
|
|
1754
|
-
return void 0 === s2 ?
|
|
1759
|
+
return void 0 === s2 ? u("NOT_IN_CACHE") : s2.getFromCache();
|
|
1755
1760
|
});
|
|
1756
1761
|
}
|
|
1757
1762
|
}
|
|
1758
1763
|
function Ee(_0) {
|
|
1759
1764
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1760
|
-
const r2 = { limit: n2, cursor: e2 },
|
|
1761
|
-
if (
|
|
1762
|
-
const { data: e3, cursor: t3 } =
|
|
1763
|
-
return
|
|
1765
|
+
const r2 = { limit: n2, cursor: e2 }, a2 = yield t2.call({ method: "GET", path: ["me", "conversations", s2, "participants"], data: r2, flags: { bypassCache: true } });
|
|
1766
|
+
if (a2.ok) {
|
|
1767
|
+
const { data: e3, cursor: t3 } = a2.value.data;
|
|
1768
|
+
return o({ participants: e3, nextCursor: t3 });
|
|
1764
1769
|
}
|
|
1765
|
-
return (
|
|
1770
|
+
return (a2.ok || "server" !== a2.where || 404 !== a2.value.status) && (a2.ok || "server" !== a2.where || 403 !== a2.value.status || "NOT_A_PARTICIPANT" !== a2.value.errorCode) ? a2 : o({ participants: null, nextCursor: null });
|
|
1766
1771
|
});
|
|
1767
1772
|
}
|
|
1768
|
-
function ke({ seq: e2, prevStores: t2, participants: s2, cursor: n2, conversationId: r2, realtimeClient:
|
|
1769
|
-
const
|
|
1770
|
-
for (const t3 of s2) if (void 0 ===
|
|
1771
|
-
const s3 = new Ce(e2, r2, t3,
|
|
1772
|
-
|
|
1773
|
+
function ke({ seq: e2, prevStores: t2, participants: s2, cursor: n2, conversationId: r2, realtimeClient: a2 }) {
|
|
1774
|
+
const i2 = t2 ? __spreadValues({}, t2) : {};
|
|
1775
|
+
for (const t3 of s2) if (void 0 === i2[t3.id]) {
|
|
1776
|
+
const s3 = new Ce(e2, r2, t3, a2);
|
|
1777
|
+
i2[t3.id] = s3;
|
|
1773
1778
|
}
|
|
1774
|
-
if (null === n2) return
|
|
1775
|
-
return
|
|
1779
|
+
if (null === n2) return o({ lastChanged: e2, stores: i2, windowEnd: null });
|
|
1780
|
+
return o({ lastChanged: e2, stores: i2, windowEnd: { cursor: n2, oldestParticipantTs: s2[s2.length - 1].joinedAt } });
|
|
1776
1781
|
}
|
|
1777
1782
|
class xe extends J {
|
|
1778
1783
|
constructor(e2, t2, s2, n2, r2) {
|
|
@@ -1781,7 +1786,7 @@ class xe extends J {
|
|
|
1781
1786
|
fetchInitial(e2) {
|
|
1782
1787
|
return __async(this, null, function* () {
|
|
1783
1788
|
const t2 = yield Te({ realtimeClient: this.realtimeClient, count: 20 });
|
|
1784
|
-
return t2.ok ? null === t2.value.conversations ?
|
|
1789
|
+
return t2.ok ? null === t2.value.conversations ? o({ lastChanged: e2, stores: null, windowEnd: null }) : Ie({ seq: e2, conversations: t2.value.conversations, cursor: t2.value.nextCursor, getConvDataStore: this.getConvDataStore }) : t2;
|
|
1785
1790
|
});
|
|
1786
1791
|
}
|
|
1787
1792
|
teardownNested(e2) {
|
|
@@ -1798,11 +1803,11 @@ class xe extends J {
|
|
|
1798
1803
|
});
|
|
1799
1804
|
}
|
|
1800
1805
|
equal(e2, t2) {
|
|
1801
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1806
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!F(Object.keys(e2.stores), Object.keys(t2.stores)) && F(e2.windowEnd, t2.windowEnd));
|
|
1802
1807
|
}
|
|
1803
1808
|
loadNested(e2, t2) {
|
|
1804
1809
|
return __async(this, null, function* () {
|
|
1805
|
-
if (null === t2.stores) return
|
|
1810
|
+
if (null === t2.stores) return o({ snapshot: x([]), loadedAll: true });
|
|
1806
1811
|
const s2 = yield Promise.all(Object.values(t2.stores).map((t3) => t3.store.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1807
1812
|
if (n2) return n2;
|
|
1808
1813
|
const r2 = s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot);
|
|
@@ -1810,13 +1815,13 @@ class xe extends J {
|
|
|
1810
1815
|
var _a2, _b2, _c, _d;
|
|
1811
1816
|
const s3 = (_b2 = (_a2 = e3.lastMessage) == null ? void 0 : _a2.createdAt) != null ? _b2 : e3.joinedAt;
|
|
1812
1817
|
return ((_d = (_c = t3.lastMessage) == null ? void 0 : _c.createdAt) != null ? _d : t3.joinedAt) - s3;
|
|
1813
|
-
}),
|
|
1818
|
+
}), o({ snapshot: x(r2), loadedAll: null === t2.windowEnd });
|
|
1814
1819
|
});
|
|
1815
1820
|
}
|
|
1816
1821
|
loadMore(e2) {
|
|
1817
1822
|
return __async(this, null, function* () {
|
|
1818
1823
|
if (this.pendingLoadMore) return this.pendingLoadMore;
|
|
1819
|
-
const t2 =
|
|
1824
|
+
const t2 = a();
|
|
1820
1825
|
this.pendingLoadMore = t2.promise, yield this._loadMoreConversations(e2), t2.resolve(), this.pendingLoadMore = void 0;
|
|
1821
1826
|
});
|
|
1822
1827
|
}
|
|
@@ -1832,23 +1837,23 @@ class xe extends J {
|
|
|
1832
1837
|
getConvFromCache(e2) {
|
|
1833
1838
|
return __async(this, null, function* () {
|
|
1834
1839
|
const t2 = yield this.mostRecentState.resultPromise;
|
|
1835
|
-
if (!t2.ok) return
|
|
1836
|
-
if (null === t2.value.stores) return
|
|
1840
|
+
if (!t2.ok) return u("NOT_IN_CACHE");
|
|
1841
|
+
if (null === t2.value.stores) return c({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["No user with that ID exists"] });
|
|
1837
1842
|
const s2 = t2.value.stores[e2];
|
|
1838
|
-
return void 0 === s2 ?
|
|
1843
|
+
return void 0 === s2 ? u("NOT_IN_CACHE") : s2.store.getFromCache();
|
|
1839
1844
|
});
|
|
1840
1845
|
}
|
|
1841
1846
|
loadedMore(e2, t2) {
|
|
1842
1847
|
this.mutate(e2, (s2) => null === s2.value.windowEnd ? s2 : t2.data.ok ? null === t2.data.value.conversations ? (console.warn("[TalkJS] When loading more conversations, the user stopped existing, which should be impossible."), s2) : Ie({ seq: e2, prevStores: s2.value.stores, conversations: t2.data.value.conversations, cursor: t2.data.value.nextCursor, getConvDataStore: this.getConvDataStore }) : t2.data);
|
|
1843
1848
|
}
|
|
1844
1849
|
userCreated(e2, t2) {
|
|
1845
|
-
this.mutate(e2, (e3) => null !== e3.value.stores ? e3 :
|
|
1850
|
+
this.mutate(e2, (e3) => null !== e3.value.stores ? e3 : o({ lastChanged: e3.value.lastChanged, stores: {}, windowEnd: null }));
|
|
1846
1851
|
}
|
|
1847
1852
|
sideCreated(e2, t2) {
|
|
1848
1853
|
const s2 = this.getConvDataStore(t2.state);
|
|
1849
1854
|
this.mutate(e2, (n2) => {
|
|
1850
1855
|
let r2 = n2.value.stores;
|
|
1851
|
-
return null === r2 && (console.warn("[TalkJS] Received a 'side.created' event when we thought your user didn't exist."), r2 = {}), Object.hasOwnProperty.call(r2, t2.conversationId) ? (s2.unsubscribe(), n2) :
|
|
1856
|
+
return null === r2 && (console.warn("[TalkJS] Received a 'side.created' event when we thought your user didn't exist."), r2 = {}), Object.hasOwnProperty.call(r2, t2.conversationId) ? (s2.unsubscribe(), n2) : o({ lastChanged: e2, stores: __spreadProps(__spreadValues({}, r2), { [t2.conversationId]: s2 }), windowEnd: n2.value.windowEnd });
|
|
1852
1857
|
});
|
|
1853
1858
|
}
|
|
1854
1859
|
sideDeleted(e2, t2) {
|
|
@@ -1856,7 +1861,7 @@ class xe extends J {
|
|
|
1856
1861
|
var _a2;
|
|
1857
1862
|
if (!Object.hasOwnProperty.call(s2.value.stores, t2.conversationId)) return s2;
|
|
1858
1863
|
const n2 = __spreadValues({}, s2.value.stores);
|
|
1859
|
-
return (_a2 = n2[t2.conversationId]) == null ? void 0 : _a2.unsubscribe(), delete n2[t2.conversationId],
|
|
1864
|
+
return (_a2 = n2[t2.conversationId]) == null ? void 0 : _a2.unsubscribe(), delete n2[t2.conversationId], o({ lastChanged: e2, stores: n2, windowEnd: s2.value.windowEnd });
|
|
1860
1865
|
});
|
|
1861
1866
|
}
|
|
1862
1867
|
sideEdited(e2, t2) {
|
|
@@ -1868,11 +1873,11 @@ class xe extends J {
|
|
|
1868
1873
|
const r2 = Object.hasOwnProperty.call(n2.value.stores, t2.conversationId);
|
|
1869
1874
|
if (r2 && s2 < n2.value.windowEnd.oldestMessageTs) {
|
|
1870
1875
|
const s3 = __spreadValues({}, n2.value.stores);
|
|
1871
|
-
return (_a2 = s3[t2.conversationId]) == null ? void 0 : _a2.unsubscribe(), delete s3[t2.conversationId],
|
|
1876
|
+
return (_a2 = s3[t2.conversationId]) == null ? void 0 : _a2.unsubscribe(), delete s3[t2.conversationId], o({ lastChanged: e2, stores: s3, windowEnd: n2.value.windowEnd });
|
|
1872
1877
|
}
|
|
1873
1878
|
if (!r2 && s2 >= n2.value.windowEnd.oldestMessageTs) {
|
|
1874
1879
|
const s3 = this.getConvDataStore(t2.conversationId);
|
|
1875
|
-
return
|
|
1880
|
+
return o({ lastChanged: e2, stores: __spreadProps(__spreadValues({}, n2.value.stores), { [t2.conversationId]: s3 }), windowEnd: n2.value.windowEnd });
|
|
1876
1881
|
}
|
|
1877
1882
|
return n2;
|
|
1878
1883
|
});
|
|
@@ -1880,19 +1885,19 @@ class xe extends J {
|
|
|
1880
1885
|
}
|
|
1881
1886
|
function Te(_0) {
|
|
1882
1887
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, count: s2 }) {
|
|
1883
|
-
const n2 = { limit: s2, cursor: e2 }, r2 = yield t2.call("GET", ["me", "conversations"], n2, { bypassCache: true });
|
|
1888
|
+
const n2 = { limit: s2, cursor: e2 }, r2 = yield t2.call({ method: "GET", path: ["me", "conversations"], data: n2, flags: { bypassCache: true } });
|
|
1884
1889
|
if (r2.ok) {
|
|
1885
1890
|
const { data: e3, cursor: t3 } = r2.value.data;
|
|
1886
|
-
return
|
|
1891
|
+
return o({ conversations: e3, nextCursor: t3 });
|
|
1887
1892
|
}
|
|
1888
|
-
return r2.ok || "server" !== r2.where || 404 !== r2.value.status || "USER_NOT_FOUND" !== r2.value.errorCode ? r2 :
|
|
1893
|
+
return r2.ok || "server" !== r2.where || 404 !== r2.value.status || "USER_NOT_FOUND" !== r2.value.errorCode ? r2 : o({ conversations: null, nextCursor: null });
|
|
1889
1894
|
});
|
|
1890
1895
|
}
|
|
1891
1896
|
function Ie({ seq: e2, prevStores: t2, conversations: s2, cursor: n2, getConvDataStore: r2 }) {
|
|
1892
|
-
const
|
|
1893
|
-
for (const e3 of s2) void 0 ===
|
|
1894
|
-
if (null === n2) return
|
|
1895
|
-
return
|
|
1897
|
+
const a2 = t2 ? __spreadValues({}, t2) : {};
|
|
1898
|
+
for (const e3 of s2) void 0 === a2[e3.id] && (a2[e3.id] = r2(e3));
|
|
1899
|
+
if (null === n2) return o({ lastChanged: e2, stores: a2, windowEnd: null });
|
|
1900
|
+
return o({ lastChanged: e2, stores: a2, windowEnd: { cursor: n2, oldestMessageTs: Math.min(...s2.map((e3) => e3.lastMessageAt)) } });
|
|
1896
1901
|
}
|
|
1897
1902
|
class De extends J {
|
|
1898
1903
|
constructor(e2, t2, s2, n2, r2) {
|
|
@@ -1904,8 +1909,8 @@ class De extends J {
|
|
|
1904
1909
|
fetchInitial(e2) {
|
|
1905
1910
|
return __async(this, null, function* () {
|
|
1906
1911
|
const t2 = this.realtimeClient.internalSubscribe(["me", "conversations", this.conversationId, "messages"]);
|
|
1907
|
-
if ("object" == typeof this.conversation) return
|
|
1908
|
-
const s2 = yield this.realtimeClient.call("GET", ["me", "conversations", this.conversationId], {}, { bypassCache: true });
|
|
1912
|
+
if ("object" == typeof this.conversation) return o({ lastChanged: e2, snapshot: this.conversation, messageWindow: t2 });
|
|
1913
|
+
const s2 = yield this.realtimeClient.call({ method: "GET", path: ["me", "conversations", this.conversationId], data: {}, flags: { bypassCache: true } });
|
|
1909
1914
|
let n2;
|
|
1910
1915
|
if (s2.ok) n2 = s2.value.data;
|
|
1911
1916
|
else if ("server" === s2.where && 404 === s2.value.status) n2 = null;
|
|
@@ -1913,7 +1918,7 @@ class De extends J {
|
|
|
1913
1918
|
if ("server" !== s2.where || 403 !== s2.value.status || "NOT_A_PARTICIPANT" !== s2.value.errorCode) return t2.unsubscribe(), s2;
|
|
1914
1919
|
n2 = null;
|
|
1915
1920
|
}
|
|
1916
|
-
return
|
|
1921
|
+
return o({ lastChanged: e2, snapshot: n2, messageWindow: t2 });
|
|
1917
1922
|
});
|
|
1918
1923
|
}
|
|
1919
1924
|
teardownNested(e2) {
|
|
@@ -1926,43 +1931,43 @@ class De extends J {
|
|
|
1926
1931
|
});
|
|
1927
1932
|
}
|
|
1928
1933
|
equal(e2, t2) {
|
|
1929
|
-
return
|
|
1934
|
+
return F(e2.snapshot, t2.snapshot);
|
|
1930
1935
|
}
|
|
1931
1936
|
loadNested(e2, t2) {
|
|
1932
1937
|
return __async(this, null, function* () {
|
|
1933
1938
|
var _a2;
|
|
1934
|
-
if (!t2.snapshot) return
|
|
1939
|
+
if (!t2.snapshot) return o({ snapshot: null, loadedAll: true });
|
|
1935
1940
|
const s2 = yield t2.messageWindow.store.getDeep(e2);
|
|
1936
1941
|
if (!s2.ok) return s2;
|
|
1937
1942
|
const n2 = s2.value.snapshot, r2 = (_a2 = n2 == null ? void 0 : n2[0]) != null ? _a2 : null;
|
|
1938
|
-
return
|
|
1943
|
+
return o({ snapshot: x(__spreadProps(__spreadValues({}, t2.snapshot), { custom: x(t2.snapshot.custom), welcomeMessages: x(t2.snapshot.welcomeMessages), lastMessage: r2 })) });
|
|
1939
1944
|
});
|
|
1940
1945
|
}
|
|
1941
1946
|
participantEdited(e2, t2) {
|
|
1942
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."), s2) :
|
|
1947
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'participant.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot: Se(s2.value.snapshot, t2.diff), messageWindow: s2.value.messageWindow }));
|
|
1943
1948
|
}
|
|
1944
1949
|
conversationEdited(e2, t2) {
|
|
1945
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."), s2) :
|
|
1950
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'conversation.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot: Se(s2.value.snapshot, t2.diff), messageWindow: s2.value.messageWindow }));
|
|
1946
1951
|
}
|
|
1947
1952
|
sideEdited(e2, t2) {
|
|
1948
|
-
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."), s2) :
|
|
1953
|
+
this.mutate(e2, (s2) => null === s2.value.snapshot ? (console.warn("[TalkJS] Received a 'side.edited' event for a conversation that we thought didn't exist."), s2) : o({ lastChanged: e2, snapshot: Se(s2.value.snapshot, t2.diff), messageWindow: s2.value.messageWindow }));
|
|
1949
1954
|
}
|
|
1950
1955
|
sideCreated(e2, t2) {
|
|
1951
|
-
this.mutate(e2, (s2) => s2.value.snapshot ? s2 :
|
|
1956
|
+
this.mutate(e2, (s2) => s2.value.snapshot ? s2 : o({ lastChanged: e2, snapshot: t2.state, messageWindow: s2.value.messageWindow }));
|
|
1952
1957
|
}
|
|
1953
1958
|
sideDeleted(e2, t2) {
|
|
1954
|
-
this.mutate(e2, (t3) => null === t3.value.snapshot ? t3 :
|
|
1959
|
+
this.mutate(e2, (t3) => null === t3.value.snapshot ? t3 : o({ lastChanged: e2, snapshot: null, messageWindow: t3.value.messageWindow }));
|
|
1955
1960
|
}
|
|
1956
1961
|
getFromCache() {
|
|
1957
1962
|
return __async(this, null, function* () {
|
|
1958
1963
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
1959
|
-
return e2.ok && e2.value.snapshot ?
|
|
1964
|
+
return e2.ok && e2.value.snapshot ? o({ status: 200, data: e2.value.snapshot }) : u("NOT_IN_CACHE");
|
|
1960
1965
|
});
|
|
1961
1966
|
}
|
|
1962
1967
|
}
|
|
1963
1968
|
function Se(e2, t2) {
|
|
1964
1969
|
const s2 = t2;
|
|
1965
|
-
return { id: e2.id, createdAt: e2.createdAt, subject:
|
|
1970
|
+
return { id: e2.id, createdAt: e2.createdAt, subject: D(e2.subject, s2.subject), photoUrl: D(e2.photoUrl, s2.photoUrl), welcomeMessages: S(e2.welcomeMessages, s2.welcomeMessages), custom: M(e2.custom, s2.custom), lastMessageAt: D(e2.lastMessageAt, s2.lastMessageAt), unreadMessageCount: D(e2.unreadMessageCount, s2.unreadMessageCount), isUnread: D(e2.isUnread, s2.isUnread), access: D(e2.access, s2.access), notify: D(e2.notify, s2.notify), readUntil: D(e2.readUntil, s2.readUntil), everyoneReadUntil: D(e2.everyoneReadUntil, s2.everyoneReadUntil), joinedAt: e2.joinedAt };
|
|
1966
1971
|
}
|
|
1967
1972
|
class Me extends J {
|
|
1968
1973
|
constructor(e2, t2, s2, n2, r2) {
|
|
@@ -1970,12 +1975,12 @@ class Me extends J {
|
|
|
1970
1975
|
}
|
|
1971
1976
|
fetchInitial(e2) {
|
|
1972
1977
|
return __async(this, null, function* () {
|
|
1973
|
-
const t2 = this.realtimeClient.internalSubscribe(["users", this.userId]), s2 = yield this.realtimeClient.call("GET", ["users", this.userId, "online"], {}, { bypassCache: true });
|
|
1974
|
-
return s2.ok || "server" !== s2.where || 404 !== s2.value.status || "USER_NOT_FOUND" !== s2.value.errorCode ? s2.ok ?
|
|
1978
|
+
const t2 = this.realtimeClient.internalSubscribe(["users", this.userId]), s2 = yield this.realtimeClient.call({ method: "GET", path: ["users", this.userId, "online"], data: {}, flags: { bypassCache: true } });
|
|
1979
|
+
return s2.ok || "server" !== s2.where || 404 !== s2.value.status || "USER_NOT_FOUND" !== s2.value.errorCode ? s2.ok ? o({ lastChanged: e2, user: t2, data: s2.value.data }) : s2 : o({ lastChanged: e2, user: t2, data: null });
|
|
1975
1980
|
});
|
|
1976
1981
|
}
|
|
1977
1982
|
equal(e2, t2) {
|
|
1978
|
-
return
|
|
1983
|
+
return F(e2.data, t2.data);
|
|
1979
1984
|
}
|
|
1980
1985
|
teardownNested(e2) {
|
|
1981
1986
|
e2.user.unsubscribe();
|
|
@@ -1990,7 +1995,7 @@ class Me extends J {
|
|
|
1990
1995
|
const s2 = yield t2.user.store.getDeep(e2);
|
|
1991
1996
|
if (!s2.ok) return s2;
|
|
1992
1997
|
const n2 = s2.value.snapshot;
|
|
1993
|
-
return null === t2.data || null === n2 ?
|
|
1998
|
+
return null === t2.data || null === n2 ? o({ snapshot: null }) : o({ snapshot: x(__spreadProps(__spreadValues({}, t2.data), { user: n2 })) });
|
|
1994
1999
|
});
|
|
1995
2000
|
}
|
|
1996
2001
|
userCreated(e2, t2) {
|
|
@@ -2000,23 +2005,23 @@ class Me extends J {
|
|
|
2000
2005
|
}), e3) : s2);
|
|
2001
2006
|
}
|
|
2002
2007
|
userOnlineChanged(e2, t2) {
|
|
2003
|
-
this.mutate(e2, (s2) => null === s2.value.data ? s2 :
|
|
2008
|
+
this.mutate(e2, (s2) => null === s2.value.data ? s2 : o({ lastChanged: e2, user: s2.value.user, data: t2.diff }));
|
|
2004
2009
|
}
|
|
2005
2010
|
getFromCache() {
|
|
2006
2011
|
return __async(this, null, function* () {
|
|
2007
2012
|
const e2 = yield this.mostRecentState.resultPromise;
|
|
2008
|
-
if (!e2.ok) return
|
|
2013
|
+
if (!e2.ok) return u("NOT_IN_CACHE");
|
|
2009
2014
|
if (null === e2.value.data) {
|
|
2010
|
-
return
|
|
2015
|
+
return c({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["No user with that ID exists"] });
|
|
2011
2016
|
}
|
|
2012
2017
|
const _a2 = e2.value, { user: t2 } = _a2, s2 = __objRest(_a2, ["user"]);
|
|
2013
|
-
return
|
|
2018
|
+
return o({ status: 200, data: __spreadValues({}, s2.data) });
|
|
2014
2019
|
});
|
|
2015
2020
|
}
|
|
2016
2021
|
}
|
|
2017
2022
|
class Fe {
|
|
2018
2023
|
constructor(e2, t2, s2) {
|
|
2019
|
-
this.realtimeClient = s2, this.convDataStores = {}, this.storeMap = {}, this.emitMutex = new H(), this.virtualSeqOffset = 0, this.realPublishSeq = 0, this.refetchOnNextNetworkLoss = true, this.connection = new
|
|
2024
|
+
this.realtimeClient = s2, this.convDataStores = {}, this.storeMap = {}, this.emitMutex = new H(), this.virtualSeqOffset = 0, this.realPublishSeq = 0, this.refetchOnNextNetworkLoss = true, this.connection = new q(e2, t2, { onUpstreamRestarting: () => {
|
|
2020
2025
|
this.refetchOnNextNetworkLoss = false;
|
|
2021
2026
|
}, onReady: () => {
|
|
2022
2027
|
this.refetchOnNextNetworkLoss = true;
|
|
@@ -2054,7 +2059,7 @@ class Fe {
|
|
|
2054
2059
|
}));
|
|
2055
2060
|
}
|
|
2056
2061
|
handlePublish(e2, t2) {
|
|
2057
|
-
var _a2, _b2, _c, _d, _e3, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r,
|
|
2062
|
+
var _a2, _b2, _c, _d, _e3, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s2, _t3, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D;
|
|
2058
2063
|
switch (t2.type) {
|
|
2059
2064
|
case "user.created":
|
|
2060
2065
|
return (_a2 = this.storeMap[`/users/${t2.userId}`]) == null ? void 0 : _a2.userCreated(e2, t2), (_b2 = this.storeMap["/me/conversations"]) == null ? void 0 : _b2.userCreated(e2, t2), void ((_c = this.storeMap[`/users/${t2.userId}/online`]) == null ? void 0 : _c.userCreated(e2, t2));
|
|
@@ -2073,7 +2078,7 @@ class Fe {
|
|
|
2073
2078
|
case "message.edited":
|
|
2074
2079
|
return void ((_r = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _r.messageEdited(e2, t2));
|
|
2075
2080
|
case "message.deleted":
|
|
2076
|
-
return void ((
|
|
2081
|
+
return void ((_s2 = this.storeMap[`/me/conversations/${t2.conversationId}/messages`]) == null ? void 0 : _s2.messageDeleted(e2, t2));
|
|
2077
2082
|
case "typing.available":
|
|
2078
2083
|
return void ((_t3 = this.storeMap[`/me/conversations/${t2.conversationId}/typing`]) == null ? void 0 : _t3.typingAvailable(e2, t2));
|
|
2079
2084
|
case "typing.changed":
|
|
@@ -2096,76 +2101,76 @@ class Fe {
|
|
|
2096
2101
|
return void ((_D = this.storeMap[`/me/conversations/${t2.conversationId}/participants`]) == null ? void 0 : _D.loadedMore(e2, t2));
|
|
2097
2102
|
}
|
|
2098
2103
|
}
|
|
2099
|
-
call(
|
|
2100
|
-
return __async(this,
|
|
2101
|
-
if (
|
|
2102
|
-
const
|
|
2103
|
-
if (
|
|
2104
|
-
const
|
|
2105
|
-
if (
|
|
2104
|
+
call(_0) {
|
|
2105
|
+
return __async(this, arguments, function* ({ method: t2, path: s2, data: n2, headers: r2, flags: a2 }) {
|
|
2106
|
+
if (true !== (a2 == null ? void 0 : a2.bypassCache) && "GET" === t2) {
|
|
2107
|
+
const t3 = Be(s2);
|
|
2108
|
+
if (t3 in this.storeMap) {
|
|
2109
|
+
const e2 = t3, s3 = this.storeMap[e2];
|
|
2110
|
+
if (s3 && "getFromCache" in s3) {
|
|
2106
2111
|
yield this.sync();
|
|
2107
|
-
const
|
|
2108
|
-
if ("NOT_IN_CACHE" !==
|
|
2112
|
+
const e3 = yield s3.getFromCache();
|
|
2113
|
+
if ("NOT_IN_CACHE" !== e3.value) return e3;
|
|
2109
2114
|
}
|
|
2110
|
-
} else if (
|
|
2111
|
-
const
|
|
2112
|
-
if (
|
|
2115
|
+
} else if (e(s2, ["me", "conversations", "*", "messages", "*"])) {
|
|
2116
|
+
const e2 = this.storeMap[`/me/conversations/${s2[2]}/messages`];
|
|
2117
|
+
if (e2) {
|
|
2113
2118
|
yield this.sync();
|
|
2114
|
-
const
|
|
2115
|
-
if ("NOT_IN_CACHE" !==
|
|
2119
|
+
const t4 = yield e2.getMessageFromCache(s2[4]);
|
|
2120
|
+
if ("NOT_IN_CACHE" !== t4.value) return t4;
|
|
2116
2121
|
}
|
|
2117
|
-
} else if (
|
|
2118
|
-
const
|
|
2119
|
-
if (
|
|
2122
|
+
} else if (e(s2, ["me", "conversations", "*", "participants", "*"])) {
|
|
2123
|
+
const e2 = this.storeMap[`/me/conversations/${s2[2]}/participants`];
|
|
2124
|
+
if (e2) {
|
|
2120
2125
|
yield this.sync();
|
|
2121
|
-
const
|
|
2122
|
-
if ("NOT_IN_CACHE" !==
|
|
2126
|
+
const t4 = yield e2.getParticipantFromCache(s2[4]);
|
|
2127
|
+
if ("NOT_IN_CACHE" !== t4.value) return t4;
|
|
2123
2128
|
}
|
|
2124
|
-
} else if (
|
|
2125
|
-
const
|
|
2126
|
-
if (
|
|
2129
|
+
} else if (e(s2, ["me", "conversations", "*"])) {
|
|
2130
|
+
const e2 = this.storeMap["/me/conversations"];
|
|
2131
|
+
if (e2) {
|
|
2127
2132
|
yield this.sync();
|
|
2128
|
-
const
|
|
2129
|
-
if ("NOT_IN_CACHE" !==
|
|
2133
|
+
const t4 = yield e2.getConvFromCache(s2[2]);
|
|
2134
|
+
if ("NOT_IN_CACHE" !== t4.value) return t4;
|
|
2130
2135
|
}
|
|
2131
2136
|
}
|
|
2132
2137
|
}
|
|
2133
|
-
return this.connection.call(
|
|
2138
|
+
return this.connection.call({ method: t2, path: s2, data: n2, headers: r2 != null ? r2 : {} });
|
|
2134
2139
|
});
|
|
2135
2140
|
}
|
|
2136
|
-
subscribe(e2,
|
|
2137
|
-
const
|
|
2138
|
-
|
|
2139
|
-
}),
|
|
2141
|
+
subscribe(e2, t2) {
|
|
2142
|
+
const s2 = this.getOrCreateStore(e2), n2 = a(), r2 = a();
|
|
2143
|
+
n2.promise.catch(() => {
|
|
2144
|
+
}), r2.promise.catch(() => {
|
|
2140
2145
|
});
|
|
2141
|
-
const
|
|
2142
|
-
"loadMore" in
|
|
2146
|
+
const i2 = { state: { type: "pending", latestSnapshot: void 0 }, connected: n2.promise, terminated: r2.promise, loadMore: (e3) => __async(this, null, function* () {
|
|
2147
|
+
"loadMore" in s2 && (yield s2.loadMore(e3));
|
|
2143
2148
|
}), unsubscribe: () => {
|
|
2144
|
-
} },
|
|
2145
|
-
if (
|
|
2146
|
-
const e3 = !("loadedAll" in
|
|
2147
|
-
|
|
2148
|
-
} else if ("pending" ===
|
|
2149
|
-
if ("server" ===
|
|
2150
|
-
const
|
|
2151
|
-
return
|
|
2149
|
+
} }, o2 = s2.listen((s3) => {
|
|
2150
|
+
if (s3.ok) {
|
|
2151
|
+
const e3 = !("loadedAll" in s3.value) || s3.value.loadedAll, r3 = { type: "active", latestSnapshot: s3.value.snapshot, loadedAll: e3 };
|
|
2152
|
+
i2.state = r3, t2 == null ? void 0 : t2(s3.value.snapshot, e3), n2.resolve(r3);
|
|
2153
|
+
} else if ("pending" === i2.state.type || "active" === i2.state.type) {
|
|
2154
|
+
if ("server" === s3.where) {
|
|
2155
|
+
const t3 = { type: "error", error: new Error(d(`Subscribe to ${e2.join("/")}`, s3.value)) };
|
|
2156
|
+
return i2.state = t3, r2.resolve(t3), void n2.reject("Subscription encountered an error during initial connection");
|
|
2152
2157
|
}
|
|
2153
|
-
if ("SESSION_DESTROYED" ===
|
|
2158
|
+
if ("SESSION_DESTROYED" === s3.value) {
|
|
2154
2159
|
const e3 = { type: "error", error: new Error("Session was destroyed causing all subscriptions to be terminated") };
|
|
2155
|
-
return
|
|
2160
|
+
return i2.state = e3, r2.resolve(e3), void n2.reject("Subscription encountered an error during initial connection");
|
|
2156
2161
|
}
|
|
2157
|
-
if ("UNSUBSCRIBED" ===
|
|
2158
|
-
if ("TERMINATED" ===
|
|
2159
|
-
|
|
2162
|
+
if ("UNSUBSCRIBED" === s3.value) return;
|
|
2163
|
+
if ("TERMINATED" === s3.value) return;
|
|
2164
|
+
s3.value;
|
|
2160
2165
|
}
|
|
2161
2166
|
});
|
|
2162
|
-
return
|
|
2163
|
-
if ("pending" ===
|
|
2164
|
-
|
|
2167
|
+
return i2.unsubscribe = () => {
|
|
2168
|
+
if ("pending" === i2.state.type || "active" === i2.state.type) {
|
|
2169
|
+
o2();
|
|
2165
2170
|
const e3 = { type: "unsubscribed" };
|
|
2166
|
-
|
|
2171
|
+
i2.state = e3, r2.resolve(e3), n2.reject("Subscription was unsubscribed before connecting");
|
|
2167
2172
|
}
|
|
2168
|
-
},
|
|
2173
|
+
}, i2;
|
|
2169
2174
|
}
|
|
2170
2175
|
onVirtualPublish(e2) {
|
|
2171
2176
|
return __async(this, null, function* () {
|
|
@@ -2191,14 +2196,14 @@ class Fe {
|
|
|
2191
2196
|
isConnected() {
|
|
2192
2197
|
return this.connection.isConnected();
|
|
2193
2198
|
}
|
|
2194
|
-
instantiateStore(
|
|
2195
|
-
if (
|
|
2196
|
-
if (
|
|
2197
|
-
if (
|
|
2198
|
-
if (
|
|
2199
|
-
if (
|
|
2200
|
-
if (
|
|
2201
|
-
if (
|
|
2199
|
+
instantiateStore(t2, s2) {
|
|
2200
|
+
if (e(t2, ["users", "*"])) return new le(this.virtualSeq, t2[1], this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2201
|
+
if (e(t2, ["me", "conversations", "*"])) return new ve(this.virtualSeq, this.subscribeConvData(t2[2]), this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2202
|
+
if (e(t2, ["me", "conversations", "*", "messages"])) return new fe(this.virtualSeq, t2[2], this.realtimeClient, this.emitMutex, { onTeardown: s2, onLoadedMore: (e2) => this.onVirtualPublish(e2) });
|
|
2203
|
+
if (e(t2, ["me", "conversations", "*", "participants"])) return new Ae(this.virtualSeq, t2[2], this.realtimeClient, this.emitMutex, { onTeardown: s2, onLoadedMore: (e2) => this.onVirtualPublish(e2) });
|
|
2204
|
+
if (e(t2, ["me", "conversations", "*", "typing"])) return new ye(this.virtualSeq, t2[2], this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2205
|
+
if (e(t2, ["me", "conversations"])) return new xe(this.virtualSeq, (e2) => this.subscribeConvData(e2), this.realtimeClient, this.emitMutex, { onTeardown: s2, onLoadedMore: (e2) => this.onVirtualPublish(e2) });
|
|
2206
|
+
if (e(t2, ["users", "*", "online"])) return new Me(this.virtualSeq, t2[1], this.realtimeClient, this.emitMutex, { onTeardown: s2 });
|
|
2202
2207
|
throw "Unreachable";
|
|
2203
2208
|
}
|
|
2204
2209
|
subscribeConvData(e2) {
|
|
@@ -2217,78 +2222,6 @@ function Be(e2) {
|
|
|
2217
2222
|
return `/${e2.join("/")}`;
|
|
2218
2223
|
}
|
|
2219
2224
|
class Re {
|
|
2220
|
-
constructor(e2, t2, s2) {
|
|
2221
|
-
this.userId = t2, this.alive = true, this.connection = new Fe(e2, s2, this), s2.onTokenRefreshFailed(() => {
|
|
2222
|
-
this.destroy();
|
|
2223
|
-
});
|
|
2224
|
-
}
|
|
2225
|
-
call(_0, _1, _2) {
|
|
2226
|
-
return __async(this, arguments, function* (e2, t2, s2, n2 = {}) {
|
|
2227
|
-
return this.alive ? this.connection.call(e2, t2, s2, n2) : l("SESSION_DESTROYED");
|
|
2228
|
-
});
|
|
2229
|
-
}
|
|
2230
|
-
subscribe(e2, t2) {
|
|
2231
|
-
return this.connection.subscribe(e2, t2);
|
|
2232
|
-
}
|
|
2233
|
-
internalSubscribe(e2) {
|
|
2234
|
-
const t2 = this.connection.getOrCreateStore(e2);
|
|
2235
|
-
return { store: t2, unsubscribe: t2.registerInternalSubscription() };
|
|
2236
|
-
}
|
|
2237
|
-
destroy() {
|
|
2238
|
-
this.alive = false, this.connection.destroy();
|
|
2239
|
-
}
|
|
2240
|
-
isConnected() {
|
|
2241
|
-
return this.connection.isConnected();
|
|
2242
|
-
}
|
|
2243
|
-
sync() {
|
|
2244
|
-
return __async(this, null, function* () {
|
|
2245
|
-
yield this.connection.sync();
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
hydrateMessageData(e2, t2) {
|
|
2249
|
-
return __async(this, null, function* () {
|
|
2250
|
-
const s2 = null === e2.senderId ? Promise.resolve(c(null)) : this.getUser(e2.senderId), n2 = null === e2.referencedMessageId ? Promise.resolve(c(null)) : this.getReferencedMessage(t2, e2.referencedMessageId), r2 = yield s2;
|
|
2251
|
-
if (!r2.ok) return r2;
|
|
2252
|
-
const i2 = yield n2;
|
|
2253
|
-
if (!i2.ok) return i2;
|
|
2254
|
-
const a2 = function(e3, t3, s3) {
|
|
2255
|
-
return O({ id: e3.id, type: e3.type, sender: t3, referencedMessage: s3, custom: O(e3.custom), createdAt: e3.createdAt, editedAt: e3.editedAt, origin: e3.origin, content: e3.content, reactions: ce(e3.reactions), plaintext: ie(e3.content, {}) });
|
|
2256
|
-
}(e2, r2.value, i2.value);
|
|
2257
|
-
return c(a2);
|
|
2258
|
-
});
|
|
2259
|
-
}
|
|
2260
|
-
getReferencedMessage(e2, t2) {
|
|
2261
|
-
return __async(this, null, function* () {
|
|
2262
|
-
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages", t2], {});
|
|
2263
|
-
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return c(null);
|
|
2264
|
-
if (!s2.ok && "server" === s2.where && 403 === s2.value.status && "NOT_A_PARTICIPANT" === s2.value.errorCode) return c(null);
|
|
2265
|
-
if (!s2.ok) return Ne(s2, `Fetching referenced message ${t2} in conversation ${e2}`);
|
|
2266
|
-
const n2 = s2.value.data, r2 = yield this.getUser(n2.senderId);
|
|
2267
|
-
if (!r2.ok) return r2;
|
|
2268
|
-
const i2 = function(e3, t3) {
|
|
2269
|
-
return O({ id: e3.id, type: e3.type, sender: t3, referencedMessageId: e3.referencedMessageId, custom: O(e3.custom), createdAt: e3.createdAt, editedAt: e3.editedAt, origin: e3.origin, content: e3.content, reactions: ce(e3.reactions), plaintext: ie(e3.content, {}) });
|
|
2270
|
-
}(n2, r2.value);
|
|
2271
|
-
return c(i2);
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
getUser(e2) {
|
|
2275
|
-
return __async(this, null, function* () {
|
|
2276
|
-
const t2 = yield this.call("GET", ["users", e2], { includePrivateFields: false });
|
|
2277
|
-
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return c(null);
|
|
2278
|
-
if (!t2.ok) return Ne(t2, "Get user " + e2);
|
|
2279
|
-
return c(oe(t2.value.data));
|
|
2280
|
-
});
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
function Ne(e2, t2) {
|
|
2284
|
-
return "server" === e2.where ? h(__spreadProps(__spreadValues({}, e2.value), { operation: t2 })) : e2;
|
|
2285
|
-
}
|
|
2286
|
-
function _e(e2, s2) {
|
|
2287
|
-
var _a2;
|
|
2288
|
-
if (s2.ok) return s2.value;
|
|
2289
|
-
throw "SESSION_DESTROYED" === s2.value ? new Error(`${e2} failed because the session was destroyed`) : new Error(t((_a2 = s2.value.operation) != null ? _a2 : e2, s2.value));
|
|
2290
|
-
}
|
|
2291
|
-
class Oe {
|
|
2292
2225
|
constructor(e2, t2) {
|
|
2293
2226
|
this.id = e2, this._realtimeClient = t2;
|
|
2294
2227
|
}
|
|
@@ -2298,21 +2231,21 @@ class Oe {
|
|
|
2298
2231
|
get() {
|
|
2299
2232
|
return __async(this, null, function* () {
|
|
2300
2233
|
const e2 = yield this._realtimeClient.getUser(this.brandedId);
|
|
2301
|
-
return
|
|
2234
|
+
return Es("Get user " + this.id, e2);
|
|
2302
2235
|
});
|
|
2303
2236
|
}
|
|
2304
|
-
set(
|
|
2237
|
+
set(e2) {
|
|
2305
2238
|
return __async(this, null, function* () {
|
|
2306
|
-
null ===
|
|
2307
|
-
const
|
|
2308
|
-
|
|
2239
|
+
null === e2.role && (e2.role = "default");
|
|
2240
|
+
const t2 = "string" == typeof e2.email ? [e2.email] : e2.email, s2 = "string" == typeof e2.phone ? [e2.phone] : e2.phone, n2 = yield this._realtimeClient.call({ method: "PUT", path: ["users", this.brandedId], data: __spreadProps(__spreadValues({}, e2), { email: t2, phone: s2 }) });
|
|
2241
|
+
h("Set user " + this.id, n2);
|
|
2309
2242
|
});
|
|
2310
2243
|
}
|
|
2311
|
-
createIfNotExists(
|
|
2244
|
+
createIfNotExists(e2) {
|
|
2312
2245
|
return __async(this, null, function* () {
|
|
2313
|
-
void 0 ===
|
|
2314
|
-
const
|
|
2315
|
-
(
|
|
2246
|
+
void 0 === e2.role && (e2.role = "default");
|
|
2247
|
+
const t2 = "string" == typeof e2.email ? [e2.email] : e2.email, s2 = "string" == typeof e2.phone ? [e2.phone] : e2.phone, n2 = yield this._realtimeClient.call({ method: "POST", path: ["users", this.brandedId], data: __spreadProps(__spreadValues({}, e2), { email: t2, phone: s2 }) });
|
|
2248
|
+
(n2.ok || "server" !== n2.where || 409 != n2.value.status) && h(`Create user ${this.id} if not exists`, n2);
|
|
2316
2249
|
});
|
|
2317
2250
|
}
|
|
2318
2251
|
subscribe(e2) {
|
|
@@ -2322,7 +2255,7 @@ class Oe {
|
|
|
2322
2255
|
return this._realtimeClient.subscribe(["users", this.brandedId, "online"], e2);
|
|
2323
2256
|
}
|
|
2324
2257
|
}
|
|
2325
|
-
class
|
|
2258
|
+
class Ne {
|
|
2326
2259
|
constructor(e2, t2, s2) {
|
|
2327
2260
|
this.userId = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
2328
2261
|
}
|
|
@@ -2334,56 +2267,56 @@ class Pe {
|
|
|
2334
2267
|
}
|
|
2335
2268
|
get() {
|
|
2336
2269
|
return __async(this, null, function* () {
|
|
2337
|
-
const
|
|
2270
|
+
const e2 = yield this._realtimeClient.call({ method: "GET", path: ["me", "conversations", this.brandedConversationId, "participants", this.brandedUserId], data: {} }), t2 = yield this._realtimeClient.call({ method: "GET", path: ["users", this.brandedUserId], data: { includePrivateFields: false } }), [s2, n2] = yield Promise.all([e2, t2]);
|
|
2271
|
+
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return null;
|
|
2338
2272
|
if (!n2.ok && "server" === n2.where && 404 === n2.value.status) return null;
|
|
2339
|
-
|
|
2340
|
-
return ue(e(`Get participant ${this.userId} in conversation ${this.conversationId}`, n2), oe(e(`Get user ${this.userId}`, r2)));
|
|
2273
|
+
return ue(h(`Get participant ${this.userId} in conversation ${this.conversationId}`, s2), oe(h(`Get user ${this.userId}`, n2)));
|
|
2341
2274
|
});
|
|
2342
2275
|
}
|
|
2343
2276
|
set() {
|
|
2344
|
-
return __async(this, arguments, function* (
|
|
2345
|
-
const
|
|
2346
|
-
|
|
2277
|
+
return __async(this, arguments, function* (e2 = {}) {
|
|
2278
|
+
const t2 = yield this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: e2 });
|
|
2279
|
+
h(`Set participant ${this.userId} in conversation ${this.conversationId}`, t2);
|
|
2347
2280
|
});
|
|
2348
2281
|
}
|
|
2349
2282
|
edit() {
|
|
2350
|
-
return __async(this, arguments, function* (
|
|
2351
|
-
const
|
|
2352
|
-
|
|
2283
|
+
return __async(this, arguments, function* (e2 = {}) {
|
|
2284
|
+
const t2 = yield this._realtimeClient.call({ method: "PATCH", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: e2 });
|
|
2285
|
+
h(`Edit participant ${this.userId} in conversation ${this.conversationId}`, t2);
|
|
2353
2286
|
});
|
|
2354
2287
|
}
|
|
2355
2288
|
createIfNotExists() {
|
|
2356
|
-
return __async(this, arguments, function* (
|
|
2357
|
-
const
|
|
2358
|
-
(
|
|
2289
|
+
return __async(this, arguments, function* (e2 = {}) {
|
|
2290
|
+
const t2 = yield this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: e2 });
|
|
2291
|
+
(t2.ok || "server" !== t2.where || 409 !== t2.value.status) && h(`Add participant ${this.userId} to conversation ${this.conversationId}`, t2);
|
|
2359
2292
|
});
|
|
2360
2293
|
}
|
|
2361
2294
|
delete() {
|
|
2362
2295
|
return __async(this, null, function* () {
|
|
2363
|
-
const
|
|
2364
|
-
(
|
|
2296
|
+
const e2 = yield this._realtimeClient.call({ method: "DELETE", path: ["conversations", this.brandedConversationId, "participants", this.brandedUserId], data: {} });
|
|
2297
|
+
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) && h(`Remove participant ${this.userId} from conversation ${this.conversationId}`, e2);
|
|
2365
2298
|
});
|
|
2366
2299
|
}
|
|
2367
2300
|
}
|
|
2368
|
-
function
|
|
2301
|
+
function _e(e2) {
|
|
2369
2302
|
const t2 = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
|
2370
2303
|
let s2 = 0;
|
|
2371
2304
|
const n2 = [], r2 = e2 === s2;
|
|
2372
2305
|
s2 = e2;
|
|
2373
|
-
const
|
|
2374
|
-
for (let s3 = 7; s3 >= 0; s3--)
|
|
2306
|
+
const a2 = new Array(8);
|
|
2307
|
+
for (let s3 = 7; s3 >= 0; s3--) a2[s3] = t2.charAt(e2 % 64), e2 = Math.floor(e2 / 64);
|
|
2375
2308
|
if (0 !== e2) throw new Error("We should have converted the entire timestamp.");
|
|
2376
|
-
let
|
|
2309
|
+
let i2 = a2.join("");
|
|
2377
2310
|
if (r2) {
|
|
2378
2311
|
let e3;
|
|
2379
2312
|
for (e3 = 11; e3 >= 0 && 63 === n2[e3]; e3--) n2[e3] = 0;
|
|
2380
2313
|
n2[e3]++;
|
|
2381
2314
|
} else for (let e3 = 0; e3 < 12; e3++) n2[e3] = Math.floor(64 * Math.random());
|
|
2382
|
-
for (let e3 = 0; e3 < 12; e3++)
|
|
2383
|
-
if (20 !=
|
|
2384
|
-
return
|
|
2315
|
+
for (let e3 = 0; e3 < 12; e3++) i2 += t2.charAt(n2[e3]);
|
|
2316
|
+
if (20 != i2.length) throw new Error("Length should be 20.");
|
|
2317
|
+
return i2;
|
|
2385
2318
|
}
|
|
2386
|
-
const
|
|
2319
|
+
const Oe = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
2387
2320
|
return e3.reduce((e4, s3, n2) => e4.concat(t3(s3, n2)), []);
|
|
2388
2321
|
}(e2, (e3) => {
|
|
2389
2322
|
if ("string" == typeof e3) return t2(e3, s2);
|
|
@@ -2396,14 +2329,14 @@ const Ue = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
2396
2329
|
case "bulletList":
|
|
2397
2330
|
case "bulletpoint":
|
|
2398
2331
|
case "bulletPoint":
|
|
2399
|
-
return [{ type: e3.type, children:
|
|
2332
|
+
return [{ type: e3.type, children: Oe(e3.children, t2, e3.type) }];
|
|
2400
2333
|
case "link":
|
|
2401
|
-
return [{ type: e3.type, url: e3.url, children:
|
|
2334
|
+
return [{ type: e3.type, url: e3.url, children: Oe(e3.children, t2, e3.type) }];
|
|
2402
2335
|
case "actionlink":
|
|
2403
2336
|
case "actionLink":
|
|
2404
2337
|
case "actionbutton":
|
|
2405
2338
|
case "actionButton":
|
|
2406
|
-
return [{ type: e3.type, action: e3.action, params: e3.params, children:
|
|
2339
|
+
return [{ type: e3.type, action: e3.action, params: e3.params, children: Oe(e3.children, t2, e3.type) }];
|
|
2407
2340
|
case "mention":
|
|
2408
2341
|
case "autolink":
|
|
2409
2342
|
case "autoLink":
|
|
@@ -2418,42 +2351,42 @@ const Ue = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
2418
2351
|
return [e3];
|
|
2419
2352
|
}
|
|
2420
2353
|
});
|
|
2421
|
-
function
|
|
2354
|
+
function Pe(e2, t2) {
|
|
2422
2355
|
return (s2) => {
|
|
2423
2356
|
const n2 = s2;
|
|
2424
2357
|
let r2 = 0;
|
|
2425
|
-
const
|
|
2426
|
-
for (const
|
|
2427
|
-
|
|
2428
|
-
const e3 = t2(
|
|
2429
|
-
Array.isArray(e3) ?
|
|
2358
|
+
const a2 = [];
|
|
2359
|
+
for (const i2 of Z(s2, e2)) {
|
|
2360
|
+
i2.index - r2 > 0 && a2.push(n2.substring(r2, i2.index));
|
|
2361
|
+
const e3 = t2(i2);
|
|
2362
|
+
Array.isArray(e3) ? a2.push(...e3) : a2.push(e3), r2 = i2.index + i2[0].length;
|
|
2430
2363
|
}
|
|
2431
|
-
return r2 < s2.length &&
|
|
2364
|
+
return r2 < s2.length && a2.push(s2.substring(r2)), a2;
|
|
2432
2365
|
};
|
|
2433
2366
|
}
|
|
2434
|
-
const
|
|
2435
|
-
var
|
|
2436
|
-
const
|
|
2367
|
+
const $e = "’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2368
|
+
var je = ((e2) => (e2[e2.italic = 1] = "italic", e2[e2.strikethrough = 2] = "strikethrough", e2[e2.bold = 4] = "bold", e2))(je || {});
|
|
2369
|
+
const Ue = [0, 1, 2, 3, 4, 5, 6].map((e2) => {
|
|
2437
2370
|
const t2 = [];
|
|
2438
2371
|
return 1 & e2 || t2.push(/_([^\s_].*?[^\s_])_|_([^\s_])_/), 2 & e2 || t2.push(/~([^\s~].*?[^\s~])~|~([^\s~])~/), 4 & e2 || t2.push(/\*([^\s*].*?[^\s*])\*|\*([^\s*])\*/), new RegExp(t2.map((e3) => e3.source).join("|"), "g");
|
|
2439
|
-
}),
|
|
2440
|
-
function
|
|
2441
|
-
return
|
|
2372
|
+
}), We = { _: 1, "*": 4, "~": 2 };
|
|
2373
|
+
function qe(e2) {
|
|
2374
|
+
return He(e2, 0);
|
|
2442
2375
|
}
|
|
2443
|
-
function
|
|
2444
|
-
const s2 =
|
|
2445
|
-
const t3 =
|
|
2376
|
+
function He(e2, t2 = 0) {
|
|
2377
|
+
const s2 = Ue[t2], n2 = s2 ? function(e3) {
|
|
2378
|
+
const t3 = Le.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${$e}])(?:${e3.source})(?=[\\s${$e}]|$)`, "g")), s3 = Pe(t3, (e4) => {
|
|
2446
2379
|
const t4 = e4[0][1], s4 = e4[1] || e4[2] || e4[3] || e4[4] || e4[5] || e4[6];
|
|
2447
|
-
return [" ", { type:
|
|
2380
|
+
return [" ", { type: je[We[t4]], children: [s4] }];
|
|
2448
2381
|
});
|
|
2449
2382
|
return (e4) => {
|
|
2450
2383
|
const [t4, ...n3] = s3(" " + e4);
|
|
2451
2384
|
return t4.length > 1 && n3.unshift(t4.substring(1)), n3;
|
|
2452
2385
|
};
|
|
2453
2386
|
}(s2) : () => [e2];
|
|
2454
|
-
return
|
|
2387
|
+
return Oe(n2(e2), (e3, s3) => "bold" === s3 || "italic" === s3 || "strikethrough" === s3 ? He(e3, t2 | je[s3]) : [e3]);
|
|
2455
2388
|
}
|
|
2456
|
-
const
|
|
2389
|
+
const Le = function() {
|
|
2457
2390
|
const e2 = function() {
|
|
2458
2391
|
try {
|
|
2459
2392
|
return /* @__PURE__ */ new WeakMap();
|
|
@@ -2469,18 +2402,18 @@ const Je = function() {
|
|
|
2469
2402
|
return e2.set(t2, n2), n2;
|
|
2470
2403
|
} };
|
|
2471
2404
|
}();
|
|
2472
|
-
function
|
|
2405
|
+
function Ge(e2, t2) {
|
|
2473
2406
|
if (Array.prototype.indexOf) return e2.indexOf(t2);
|
|
2474
2407
|
for (var s2 = 0, n2 = e2.length; s2 < n2; s2++) if (e2[s2] === t2) return s2;
|
|
2475
2408
|
return -1;
|
|
2476
2409
|
}
|
|
2477
|
-
function
|
|
2410
|
+
function ze(e2, t2) {
|
|
2478
2411
|
for (var s2 = e2.length - 1; s2 >= 0; s2--) true === t2(e2[s2]) && e2.splice(s2, 1);
|
|
2479
2412
|
}
|
|
2480
|
-
function
|
|
2413
|
+
function Je(e2) {
|
|
2481
2414
|
throw new Error("Unhandled case for value: '" + e2 + "'");
|
|
2482
2415
|
}
|
|
2483
|
-
var
|
|
2416
|
+
var Ye = function() {
|
|
2484
2417
|
function e2(e3) {
|
|
2485
2418
|
void 0 === e3 && (e3 = {}), this.tagName = "", this.attrs = {}, this.innerHTML = "", this.whitespaceRegex = /\s+/, this.tagName = e3.tagName || "", this.attrs = e3.attrs || {}, this.innerHTML = e3.innerHtml || e3.innerHTML || "";
|
|
2486
2419
|
}
|
|
@@ -2499,12 +2432,12 @@ var Ze = function() {
|
|
|
2499
2432
|
}, e2.prototype.setClass = function(e3) {
|
|
2500
2433
|
return this.setAttr("class", e3);
|
|
2501
2434
|
}, e2.prototype.addClass = function(e3) {
|
|
2502
|
-
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [],
|
|
2435
|
+
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], a2 = e3.split(n2); t2 = a2.shift(); ) -1 === Ge(r2, t2) && r2.push(t2);
|
|
2503
2436
|
return this.getAttrs().class = r2.join(" "), this;
|
|
2504
2437
|
}, e2.prototype.removeClass = function(e3) {
|
|
2505
|
-
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [],
|
|
2506
|
-
var
|
|
2507
|
-
-1 !==
|
|
2438
|
+
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], a2 = e3.split(n2); r2.length && (t2 = a2.shift()); ) {
|
|
2439
|
+
var i2 = Ge(r2, t2);
|
|
2440
|
+
-1 !== i2 && r2.splice(i2, 1);
|
|
2508
2441
|
}
|
|
2509
2442
|
return this.getAttrs().class = r2.join(" "), this;
|
|
2510
2443
|
}, e2.prototype.getClass = function() {
|
|
@@ -2529,19 +2462,19 @@ var Ze = function() {
|
|
|
2529
2462
|
return t2.join(" ");
|
|
2530
2463
|
}, e2;
|
|
2531
2464
|
}();
|
|
2532
|
-
var
|
|
2465
|
+
var Qe = function() {
|
|
2533
2466
|
function e2(e3) {
|
|
2534
2467
|
void 0 === e3 && (e3 = {}), this.newWindow = false, this.truncate = {}, this.className = "", this.newWindow = e3.newWindow || false, this.truncate = e3.truncate || {}, this.className = e3.className || "";
|
|
2535
2468
|
}
|
|
2536
2469
|
return e2.prototype.build = function(e3) {
|
|
2537
|
-
return new
|
|
2470
|
+
return new Ye({ tagName: "a", attrs: this.createAttrs(e3), innerHtml: this.processAnchorText(e3.getAnchorText()) });
|
|
2538
2471
|
}, e2.prototype.createAttrs = function(e3) {
|
|
2539
2472
|
var t2 = { href: e3.getAnchorHref() }, s2 = this.createCssClass(e3);
|
|
2540
2473
|
return s2 && (t2.class = s2), this.newWindow && (t2.target = "_blank", t2.rel = "noopener noreferrer"), this.truncate && this.truncate.length && this.truncate.length < e3.getAnchorText().length && (t2.title = e3.getAnchorHref()), t2;
|
|
2541
2474
|
}, e2.prototype.createCssClass = function(e3) {
|
|
2542
2475
|
var t2 = this.className;
|
|
2543
2476
|
if (t2) {
|
|
2544
|
-
for (var s2 = [t2], n2 = e3.getCssClassSuffixes(), r2 = 0,
|
|
2477
|
+
for (var s2 = [t2], n2 = e3.getCssClassSuffixes(), r2 = 0, a2 = n2.length; r2 < a2; r2++) s2.push(t2 + "-" + n2[r2]);
|
|
2545
2478
|
return s2.join(" ");
|
|
2546
2479
|
}
|
|
2547
2480
|
return "";
|
|
@@ -2554,12 +2487,12 @@ var Ke = function() {
|
|
|
2554
2487
|
return "smart" === n2 ? function(e4, t3, s3) {
|
|
2555
2488
|
var n3, r2;
|
|
2556
2489
|
null == s3 ? (s3 = "…", r2 = 3, n3 = 8) : (r2 = s3.length, n3 = s3.length);
|
|
2557
|
-
var
|
|
2490
|
+
var a2 = function(e5) {
|
|
2558
2491
|
var t4 = "";
|
|
2559
2492
|
return e5.scheme && e5.host && (t4 += e5.scheme + "://"), e5.host && (t4 += e5.host), e5.path && (t4 += "/" + e5.path), e5.query && (t4 += "?" + e5.query), e5.fragment && (t4 += "#" + e5.fragment), t4;
|
|
2560
|
-
},
|
|
2561
|
-
var n4 = t4 / 2, r3 = Math.ceil(n4),
|
|
2562
|
-
return
|
|
2493
|
+
}, i2 = function(e5, t4) {
|
|
2494
|
+
var n4 = t4 / 2, r3 = Math.ceil(n4), a3 = -1 * Math.floor(n4), i3 = "";
|
|
2495
|
+
return a3 < 0 && (i3 = e5.substr(a3)), e5.substr(0, r3) + s3 + i3;
|
|
2563
2496
|
};
|
|
2564
2497
|
if (e4.length <= t3) return e4;
|
|
2565
2498
|
var o2 = t3 - r2, u2 = function(e5) {
|
|
@@ -2568,20 +2501,20 @@ var Ke = function() {
|
|
|
2568
2501
|
}(e4);
|
|
2569
2502
|
if (u2.query) {
|
|
2570
2503
|
var c2 = u2.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);
|
|
2571
|
-
c2 && (u2.query = u2.query.substr(0, c2[1].length), e4 =
|
|
2504
|
+
c2 && (u2.query = u2.query.substr(0, c2[1].length), e4 = a2(u2));
|
|
2572
2505
|
}
|
|
2573
2506
|
if (e4.length <= t3) return e4;
|
|
2574
|
-
if (u2.host && (u2.host = u2.host.replace(/^www\./, ""), e4 =
|
|
2507
|
+
if (u2.host && (u2.host = u2.host.replace(/^www\./, ""), e4 = a2(u2)), e4.length <= t3) return e4;
|
|
2575
2508
|
var l2 = "";
|
|
2576
|
-
if (u2.host && (l2 += u2.host), l2.length >= o2) return u2.host.length == t3 ? (u2.host.substr(0, t3 - r2) + s3).substr(0, o2 + n3) :
|
|
2509
|
+
if (u2.host && (l2 += u2.host), l2.length >= o2) return u2.host.length == t3 ? (u2.host.substr(0, t3 - r2) + s3).substr(0, o2 + n3) : i2(l2, o2).substr(0, o2 + n3);
|
|
2577
2510
|
var h2 = "";
|
|
2578
2511
|
if (u2.path && (h2 += "/" + u2.path), u2.query && (h2 += "?" + u2.query), h2) {
|
|
2579
|
-
if ((l2 + h2).length >= o2) return (l2 + h2).length == t3 ? (l2 + h2).substr(0, t3) : (l2 +
|
|
2512
|
+
if ((l2 + h2).length >= o2) return (l2 + h2).length == t3 ? (l2 + h2).substr(0, t3) : (l2 + i2(h2, o2 - l2.length)).substr(0, o2 + n3);
|
|
2580
2513
|
l2 += h2;
|
|
2581
2514
|
}
|
|
2582
2515
|
if (u2.fragment) {
|
|
2583
2516
|
var d2 = "#" + u2.fragment;
|
|
2584
|
-
if ((l2 + d2).length >= o2) return (l2 + d2).length == t3 ? (l2 + d2).substr(0, t3) : (l2 +
|
|
2517
|
+
if ((l2 + d2).length >= o2) return (l2 + d2).length == t3 ? (l2 + d2).substr(0, t3) : (l2 + i2(d2, o2 - l2.length)).substr(0, o2 + n3);
|
|
2585
2518
|
l2 += d2;
|
|
2586
2519
|
}
|
|
2587
2520
|
if (u2.scheme && u2.host) {
|
|
@@ -2595,8 +2528,8 @@ var Ke = function() {
|
|
|
2595
2528
|
if (e4.length <= t3) return e4;
|
|
2596
2529
|
var n3, r2;
|
|
2597
2530
|
null == s3 ? (s3 = "…", n3 = 8, r2 = 3) : (n3 = s3.length, r2 = s3.length);
|
|
2598
|
-
var
|
|
2599
|
-
return
|
|
2531
|
+
var a2 = t3 - r2, i2 = "";
|
|
2532
|
+
return a2 > 0 && (i2 = e4.substr(-1 * Math.floor(a2 / 2))), (e4.substr(0, Math.ceil(a2 / 2)) + s3 + i2).substr(0, a2 + n3);
|
|
2600
2533
|
}(e3, s2) : function(e4, t3, s3) {
|
|
2601
2534
|
return function(e5, t4, s4) {
|
|
2602
2535
|
var n3;
|
|
@@ -2604,7 +2537,7 @@ var Ke = function() {
|
|
|
2604
2537
|
}(e4, t3, s3);
|
|
2605
2538
|
}(e3, s2);
|
|
2606
2539
|
}, e2;
|
|
2607
|
-
}(),
|
|
2540
|
+
}(), Ve = function() {
|
|
2608
2541
|
function e2(e3) {
|
|
2609
2542
|
this.__jsduckDummyDocProp = null, this.matchedText = "", this.offset = 0, this.tagBuilder = e3.tagBuilder, this.matchedText = e3.matchedText, this.offset = e3.offset;
|
|
2610
2543
|
}
|
|
@@ -2619,30 +2552,30 @@ var Ke = function() {
|
|
|
2619
2552
|
}, e2.prototype.buildTag = function() {
|
|
2620
2553
|
return this.tagBuilder.build(this);
|
|
2621
2554
|
}, e2;
|
|
2622
|
-
}(),
|
|
2623
|
-
return
|
|
2555
|
+
}(), Ze = function(e2, t2) {
|
|
2556
|
+
return Ze = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e3, t3) {
|
|
2624
2557
|
e3.__proto__ = t3;
|
|
2625
2558
|
} || function(e3, t3) {
|
|
2626
2559
|
for (var s2 in t3) t3.hasOwnProperty(s2) && (e3[s2] = t3[s2]);
|
|
2627
|
-
},
|
|
2560
|
+
}, Ze(e2, t2);
|
|
2628
2561
|
};
|
|
2629
|
-
function
|
|
2562
|
+
function Ke(e2, t2) {
|
|
2630
2563
|
function s2() {
|
|
2631
2564
|
this.constructor = e2;
|
|
2632
2565
|
}
|
|
2633
|
-
|
|
2566
|
+
Ze(e2, t2), e2.prototype = null === t2 ? Object.create(t2) : (s2.prototype = t2.prototype, new s2());
|
|
2634
2567
|
}
|
|
2635
|
-
var
|
|
2636
|
-
return
|
|
2568
|
+
var Xe, et = function() {
|
|
2569
|
+
return et = Object.assign || function(e2) {
|
|
2637
2570
|
for (var t2, s2 = 1, n2 = arguments.length; s2 < n2; s2++) for (var r2 in t2 = arguments[s2]) Object.prototype.hasOwnProperty.call(t2, r2) && (e2[r2] = t2[r2]);
|
|
2638
2571
|
return e2;
|
|
2639
|
-
},
|
|
2640
|
-
},
|
|
2572
|
+
}, et.apply(this, arguments);
|
|
2573
|
+
}, tt = function(e2) {
|
|
2641
2574
|
function t2(t3) {
|
|
2642
2575
|
var s2 = e2.call(this, t3) || this;
|
|
2643
2576
|
return s2.email = "", s2.email = t3.email, s2;
|
|
2644
2577
|
}
|
|
2645
|
-
return
|
|
2578
|
+
return Ke(t2, e2), t2.prototype.getType = function() {
|
|
2646
2579
|
return "email";
|
|
2647
2580
|
}, t2.prototype.getEmail = function() {
|
|
2648
2581
|
return this.email;
|
|
@@ -2651,12 +2584,12 @@ var st, nt = function() {
|
|
|
2651
2584
|
}, t2.prototype.getAnchorText = function() {
|
|
2652
2585
|
return this.email;
|
|
2653
2586
|
}, t2;
|
|
2654
|
-
}(
|
|
2587
|
+
}(Ve), st = function(e2) {
|
|
2655
2588
|
function t2(t3) {
|
|
2656
2589
|
var s2 = e2.call(this, t3) || this;
|
|
2657
2590
|
return s2.serviceName = "", s2.hashtag = "", s2.serviceName = t3.serviceName, s2.hashtag = t3.hashtag, s2;
|
|
2658
2591
|
}
|
|
2659
|
-
return
|
|
2592
|
+
return Ke(t2, e2), t2.prototype.getType = function() {
|
|
2660
2593
|
return "hashtag";
|
|
2661
2594
|
}, t2.prototype.getServiceName = function() {
|
|
2662
2595
|
return this.serviceName;
|
|
@@ -2677,12 +2610,12 @@ var st, nt = function() {
|
|
|
2677
2610
|
}, t2.prototype.getAnchorText = function() {
|
|
2678
2611
|
return "#" + this.hashtag;
|
|
2679
2612
|
}, t2;
|
|
2680
|
-
}(
|
|
2613
|
+
}(Ve), nt = function(e2) {
|
|
2681
2614
|
function t2(t3) {
|
|
2682
2615
|
var s2 = e2.call(this, t3) || this;
|
|
2683
2616
|
return s2.serviceName = "twitter", s2.mention = "", s2.mention = t3.mention, s2.serviceName = t3.serviceName, s2;
|
|
2684
2617
|
}
|
|
2685
|
-
return
|
|
2618
|
+
return Ke(t2, e2), t2.prototype.getType = function() {
|
|
2686
2619
|
return "mention";
|
|
2687
2620
|
}, t2.prototype.getMention = function() {
|
|
2688
2621
|
return this.mention;
|
|
@@ -2705,12 +2638,12 @@ var st, nt = function() {
|
|
|
2705
2638
|
var t3 = e2.prototype.getCssClassSuffixes.call(this), s2 = this.getServiceName();
|
|
2706
2639
|
return s2 && t3.push(s2), t3;
|
|
2707
2640
|
}, t2;
|
|
2708
|
-
}(
|
|
2641
|
+
}(Ve), rt = function(e2) {
|
|
2709
2642
|
function t2(t3) {
|
|
2710
2643
|
var s2 = e2.call(this, t3) || this;
|
|
2711
2644
|
return s2.number = "", s2.plusSign = false, s2.number = t3.number, s2.plusSign = t3.plusSign, s2;
|
|
2712
2645
|
}
|
|
2713
|
-
return
|
|
2646
|
+
return Ke(t2, e2), t2.prototype.getType = function() {
|
|
2714
2647
|
return "phone";
|
|
2715
2648
|
}, t2.prototype.getPhoneNumber = function() {
|
|
2716
2649
|
return this.number;
|
|
@@ -2721,12 +2654,12 @@ var st, nt = function() {
|
|
|
2721
2654
|
}, t2.prototype.getAnchorText = function() {
|
|
2722
2655
|
return this.matchedText;
|
|
2723
2656
|
}, t2;
|
|
2724
|
-
}(
|
|
2657
|
+
}(Ve), at = function(e2) {
|
|
2725
2658
|
function t2(t3) {
|
|
2726
2659
|
var s2 = e2.call(this, t3) || this;
|
|
2727
2660
|
return s2.url = "", s2.urlMatchType = "scheme", s2.protocolUrlMatch = false, s2.protocolRelativeMatch = false, s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.schemePrefixRegex = /^(https?:\/\/)?/i, s2.wwwPrefixRegex = /^(https?:\/\/)?(www\.)?/i, s2.protocolRelativeRegex = /^\/\//, s2.protocolPrepended = false, s2.urlMatchType = t3.urlMatchType, s2.url = t3.url, s2.protocolUrlMatch = t3.protocolUrlMatch, s2.protocolRelativeMatch = t3.protocolRelativeMatch, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2728
2661
|
}
|
|
2729
|
-
return
|
|
2662
|
+
return Ke(t2, e2), t2.prototype.getType = function() {
|
|
2730
2663
|
return "url";
|
|
2731
2664
|
}, t2.prototype.getUrlMatchType = function() {
|
|
2732
2665
|
return this.urlMatchType;
|
|
@@ -2754,19 +2687,19 @@ var st, nt = function() {
|
|
|
2754
2687
|
return t3;
|
|
2755
2688
|
}
|
|
2756
2689
|
}, t2;
|
|
2757
|
-
}(
|
|
2690
|
+
}(Ve), it = function(e2) {
|
|
2758
2691
|
this.__jsduckDummyDocProp = null, this.tagBuilder = e2.tagBuilder;
|
|
2759
|
-
},
|
|
2760
|
-
return "(?=(" +
|
|
2761
|
-
},
|
|
2762
|
-
return "(?:" +
|
|
2763
|
-
}, xt = new RegExp("[" + yt + "]"), Tt = /(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, It = new RegExp("[" + yt + "!#$%&'*+/=?^_`{|}~-]"), Dt = new RegExp("^" + Tt.source + "$"), St = function(e2) {
|
|
2692
|
+
}, ot = /[A-Za-z]/, ut = /[\d]/, ct = /[\D]/, lt = /\s/, ht = /['"]/, dt = /[\x00-\x1F\x7F]/, pt = /A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source, ft = pt + /\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source + /\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source, mt = /0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source, gt = ft + mt, vt = ft + mt, wt = "(?:[" + mt + "]{1,3}\\.){3}[" + mt + "]{1,3}", bt = "[" + vt + "](?:[" + vt + "\\-]{0,61}[" + vt + "])?", yt = function(e2) {
|
|
2693
|
+
return "(?=(" + bt + "))\\" + e2;
|
|
2694
|
+
}, Ct = function(e2) {
|
|
2695
|
+
return "(?:" + yt(e2) + "(?:\\." + yt(e2 + 1) + "){0,126}|" + wt + ")";
|
|
2696
|
+
}, At = new RegExp("[" + vt + "]"), Et = /(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbb9fbpob|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|spreadbetting|travelchannel|wolterskluwer|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|rightathome|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--estv75g|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--kpu716f|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pbt977c|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nationwide|newholland|nextdirect|onyourside|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|telefonica|university|vistaprint|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|fujixerox|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|honeywell|institute|insurance|kuokgroup|ladbrokes|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--tckwe|xn--vhquv|yodobashi|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|chrysler|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|esurance|etisalat|everbank|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|movistar|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|symantec|training|uconnect|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|cartier|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|iselect|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lancome|lanxess|lasalle|latrobe|leclerc|liaison|limited|lincoln|markets|metlife|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|shriram|singles|staples|starhub|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|الجزائر|العليان|پاکستان|كاثوليك|موبايلي|இந்தியா|abarth|abbott|abbvie|active|africa|agency|airbus|airtel|alipay|alsace|alstom|anquan|aramco|author|bayern|beauty|berlin|bharti|blanco|bostik|boston|broker|camera|career|caseih|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|mobily|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|piaget|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|warman|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|dodge|drive|dubai|earth|edeka|email|epost|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|intel|irish|iveco|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|lupin|macys|mango|media|miami|money|mopar|movie|nadex|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|zippo|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|aigo|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|doha|duck|duns|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scor|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bnl|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceb|ceo|cfa|cfd|com|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jcp|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|srl|srt|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ストア|セール|みんな|中文网|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, kt = new RegExp("[" + vt + "!#$%&'*+/=?^_`{|}~-]"), xt = new RegExp("^" + Et.source + "$"), Tt = function(e2) {
|
|
2764
2697
|
function t2() {
|
|
2765
2698
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2766
|
-
return t3.localPartCharRegex =
|
|
2699
|
+
return t3.localPartCharRegex = kt, t3.strictTldRegex = xt, t3;
|
|
2767
2700
|
}
|
|
2768
|
-
return
|
|
2769
|
-
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [],
|
|
2701
|
+
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2702
|
+
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], a2 = e3.length, i2 = new It(), o2 = { m: "a", a: "i", i: "l", l: "t", t: "o", o: ":" }, u2 = 0, c2 = 0, l2 = i2; u2 < a2; ) {
|
|
2770
2703
|
var h2 = e3.charAt(u2);
|
|
2771
2704
|
switch (c2) {
|
|
2772
2705
|
case 0:
|
|
@@ -2794,7 +2727,7 @@ var st, nt = function() {
|
|
|
2794
2727
|
b2(h2);
|
|
2795
2728
|
break;
|
|
2796
2729
|
default:
|
|
2797
|
-
|
|
2730
|
+
Je(c2);
|
|
2798
2731
|
}
|
|
2799
2732
|
u2++;
|
|
2800
2733
|
}
|
|
@@ -2803,7 +2736,7 @@ var st, nt = function() {
|
|
|
2803
2736
|
"m" === e4 ? y2(1) : s2.test(e4) && y2();
|
|
2804
2737
|
}
|
|
2805
2738
|
function p2(e4, t4) {
|
|
2806
|
-
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new
|
|
2739
|
+
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new It(et(et({}, l2), { hasMailtoPrefix: true }))) : C2() : o2[e4] === t4 || (s2.test(t4) ? c2 = 2 : "." === t4 ? c2 = 3 : "@" === t4 ? c2 = 4 : C2());
|
|
2807
2740
|
}
|
|
2808
2741
|
function f2(e4) {
|
|
2809
2742
|
"." === e4 ? c2 = 3 : "@" === e4 ? c2 = 4 : s2.test(e4) || C2();
|
|
@@ -2812,39 +2745,39 @@ var st, nt = function() {
|
|
|
2812
2745
|
"." === e4 || "@" === e4 ? C2() : s2.test(e4) ? c2 = 2 : C2();
|
|
2813
2746
|
}
|
|
2814
2747
|
function g2(e4) {
|
|
2815
|
-
|
|
2748
|
+
At.test(e4) ? c2 = 5 : C2();
|
|
2816
2749
|
}
|
|
2817
2750
|
function v2(e4) {
|
|
2818
|
-
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 :
|
|
2751
|
+
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 : At.test(e4) || A2();
|
|
2819
2752
|
}
|
|
2820
2753
|
function w2(e4) {
|
|
2821
|
-
"-" === e4 || "." === e4 ? A2() :
|
|
2754
|
+
"-" === e4 || "." === e4 ? A2() : At.test(e4) ? c2 = 5 : A2();
|
|
2822
2755
|
}
|
|
2823
2756
|
function b2(e4) {
|
|
2824
|
-
"." === e4 || "-" === e4 ? A2() :
|
|
2757
|
+
"." === e4 || "-" === e4 ? A2() : At.test(e4) ? (c2 = 5, l2 = new It(et(et({}, l2), { hasDomainDot: true }))) : A2();
|
|
2825
2758
|
}
|
|
2826
2759
|
function y2(e4) {
|
|
2827
|
-
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new
|
|
2760
|
+
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new It({ idx: u2 });
|
|
2828
2761
|
}
|
|
2829
2762
|
function C2() {
|
|
2830
|
-
c2 = 0, l2 =
|
|
2763
|
+
c2 = 0, l2 = i2;
|
|
2831
2764
|
}
|
|
2832
2765
|
function A2() {
|
|
2833
2766
|
if (l2.hasDomainDot) {
|
|
2834
2767
|
var s3 = e3.slice(l2.idx, u2);
|
|
2835
2768
|
/[-.]$/.test(s3) && (s3 = s3.slice(0, -1));
|
|
2836
|
-
var
|
|
2769
|
+
var a3 = l2.hasMailtoPrefix ? s3.slice(7) : s3;
|
|
2837
2770
|
(function(e4) {
|
|
2838
2771
|
var t4 = e4.split(".").pop() || "", s4 = t4.toLowerCase();
|
|
2839
2772
|
return n2.test(s4);
|
|
2840
|
-
})(
|
|
2773
|
+
})(a3) && r2.push(new tt({ tagBuilder: t3, matchedText: s3, offset: l2.idx, email: a3 }));
|
|
2841
2774
|
}
|
|
2842
2775
|
C2();
|
|
2843
2776
|
}
|
|
2844
2777
|
}, t2;
|
|
2845
|
-
}(
|
|
2778
|
+
}(it), It = function(e2) {
|
|
2846
2779
|
void 0 === e2 && (e2 = {}), this.idx = void 0 !== e2.idx ? e2.idx : -1, this.hasMailtoPrefix = !!e2.hasMailtoPrefix, this.hasDomainDot = !!e2.hasDomainDot;
|
|
2847
|
-
},
|
|
2780
|
+
}, Dt = function() {
|
|
2848
2781
|
function e2() {
|
|
2849
2782
|
}
|
|
2850
2783
|
return e2.isValid = function(e3, t2) {
|
|
@@ -2862,16 +2795,16 @@ var st, nt = function() {
|
|
|
2862
2795
|
return !(!e3 || t2 && this.hasFullProtocolRegex.test(t2) || -1 !== e3.indexOf("."));
|
|
2863
2796
|
}, e2.urlMatchDoesNotHaveAtLeastOneWordChar = function(e3, t2) {
|
|
2864
2797
|
return !(!e3 || !t2) && (!this.hasFullProtocolRegex.test(t2) && !this.hasWordCharAfterProtocolRegex.test(e3));
|
|
2865
|
-
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" +
|
|
2866
|
-
}(),
|
|
2798
|
+
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + pt + "]"), e2.ipRegex = /[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/, e2;
|
|
2799
|
+
}(), St = (Xe = new RegExp("[/?#](?:[" + vt + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + vt + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, Ct(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, Ct(6), ")", "|", "(", "(//)?", Ct(10) + "\\.", Et.source, "(?![-" + gt + "])", ")", ")", "(?::[0-9]+)?", "(?:" + Xe.source + ")?"].join(""), "gi")), Mt = new RegExp("[" + vt + "]"), Ft = function(e2) {
|
|
2867
2800
|
function t2(t3) {
|
|
2868
2801
|
var s2 = e2.call(this, t3) || this;
|
|
2869
|
-
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex =
|
|
2802
|
+
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex = St, s2.wordCharRegExp = Mt, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2870
2803
|
}
|
|
2871
|
-
return
|
|
2872
|
-
for (var t3, s2 = this.matcherRegex, n2 = this.stripPrefix, r2 = this.stripTrailingSlash,
|
|
2804
|
+
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2805
|
+
for (var t3, s2 = this.matcherRegex, n2 = this.stripPrefix, r2 = this.stripTrailingSlash, a2 = this.decodePercentEncoding, i2 = this.tagBuilder, o2 = [], u2 = function() {
|
|
2873
2806
|
var s3 = t3[0], u3 = t3[1], l2 = t3[4], h2 = t3[5], d2 = t3[9], p2 = t3.index, f2 = h2 || d2, m2 = e3.charAt(p2 - 1);
|
|
2874
|
-
if (!
|
|
2807
|
+
if (!Dt.isValid(s3, u3)) return "continue";
|
|
2875
2808
|
if (p2 > 0 && "@" === m2) return "continue";
|
|
2876
2809
|
if (p2 > 0 && f2 && c2.wordCharRegExp.test(m2)) return "continue";
|
|
2877
2810
|
if (/\?$/.test(s3) && (s3 = s3.substr(0, s3.length - 1)), c2.matchHasUnbalancedClosingParen(s3)) s3 = s3.substr(0, s3.length - 1);
|
|
@@ -2887,7 +2820,7 @@ var st, nt = function() {
|
|
|
2887
2820
|
s3 = s3.substr(w2), u3 = u3.substr(w2), p2 += w2;
|
|
2888
2821
|
}
|
|
2889
2822
|
var b2 = u3 ? "scheme" : l2 ? "www" : "tld", y2 = !!u3;
|
|
2890
|
-
o2.push(new
|
|
2823
|
+
o2.push(new at({ tagBuilder: i2, matchedText: s3, offset: p2, urlMatchType: b2, url: s3, protocolUrlMatch: y2, protocolRelativeMatch: !!f2, stripPrefix: n2, stripTrailingSlash: r2, decodePercentEncoding: a2 }));
|
|
2891
2824
|
}, c2 = this; null !== (t3 = s2.exec(e3)); ) u2();
|
|
2892
2825
|
return o2;
|
|
2893
2826
|
}, t2.prototype.matchHasUnbalancedClosingParen = function(e3) {
|
|
@@ -2898,67 +2831,67 @@ var st, nt = function() {
|
|
|
2898
2831
|
if ("}" !== s2) return false;
|
|
2899
2832
|
t3 = "{";
|
|
2900
2833
|
}
|
|
2901
|
-
for (var n2 = 0, r2 = 0,
|
|
2902
|
-
var
|
|
2903
|
-
|
|
2834
|
+
for (var n2 = 0, r2 = 0, a2 = e3.length - 1; r2 < a2; r2++) {
|
|
2835
|
+
var i2 = e3.charAt(r2);
|
|
2836
|
+
i2 === t3 ? n2++ : i2 === s2 && (n2 = Math.max(n2 - 1, 0));
|
|
2904
2837
|
}
|
|
2905
2838
|
return 0 === n2;
|
|
2906
2839
|
}, t2.prototype.matchHasInvalidCharAfterTld = function(e3, t3) {
|
|
2907
2840
|
if (!e3) return -1;
|
|
2908
2841
|
var s2 = 0;
|
|
2909
2842
|
t3 && (s2 = e3.indexOf(":"), e3 = e3.slice(s2));
|
|
2910
|
-
var n2 = new RegExp("^((.?//)?[-." +
|
|
2843
|
+
var n2 = new RegExp("^((.?//)?[-." + vt + "]*[-" + vt + "]\\.[-" + vt + "]+)").exec(e3);
|
|
2911
2844
|
return null === n2 ? -1 : (s2 += n2[1].length, e3 = e3.slice(n2[1].length), /^[^-.A-Za-z0-9:\/?#]/.test(e3) ? s2 : -1);
|
|
2912
2845
|
}, t2;
|
|
2913
|
-
}(
|
|
2846
|
+
}(it), Bt = new RegExp("#[_" + vt + "]{1,139}(?![_" + vt + "])", "g"), Rt = new RegExp("[^" + vt + "]"), Nt = function(e2) {
|
|
2914
2847
|
function t2(t3) {
|
|
2915
2848
|
var s2 = e2.call(this, t3) || this;
|
|
2916
|
-
return s2.serviceName = "twitter", s2.matcherRegex =
|
|
2849
|
+
return s2.serviceName = "twitter", s2.matcherRegex = Bt, s2.nonWordCharRegex = Rt, s2.serviceName = t3.serviceName, s2;
|
|
2917
2850
|
}
|
|
2918
|
-
return
|
|
2919
|
-
for (var t3, s2 = this.matcherRegex, n2 = this.nonWordCharRegex, r2 = this.serviceName,
|
|
2851
|
+
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2852
|
+
for (var t3, s2 = this.matcherRegex, n2 = this.nonWordCharRegex, r2 = this.serviceName, a2 = this.tagBuilder, i2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2920
2853
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2921
2854
|
if (0 === o2 || n2.test(u2)) {
|
|
2922
2855
|
var c2 = t3[0], l2 = t3[0].slice(1);
|
|
2923
|
-
|
|
2856
|
+
i2.push(new st({ tagBuilder: a2, matchedText: c2, offset: o2, serviceName: r2, hashtag: l2 }));
|
|
2924
2857
|
}
|
|
2925
2858
|
}
|
|
2926
|
-
return
|
|
2859
|
+
return i2;
|
|
2927
2860
|
}, t2;
|
|
2928
|
-
}(
|
|
2861
|
+
}(it), _t = new RegExp(/(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/.source + "|" + /(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/.source, "g"), Ot = function(e2) {
|
|
2929
2862
|
function t2() {
|
|
2930
2863
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2931
|
-
return t3.matcherRegex =
|
|
2864
|
+
return t3.matcherRegex = _t, t3;
|
|
2932
2865
|
}
|
|
2933
|
-
return
|
|
2866
|
+
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2934
2867
|
for (var t3, s2 = this.matcherRegex, n2 = this.tagBuilder, r2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2935
|
-
var
|
|
2936
|
-
this.testMatch(t3[3]) && this.testMatch(
|
|
2868
|
+
var a2 = t3[0], i2 = a2.replace(/[^0-9,;#]/g, ""), o2 = !(!t3[1] && !t3[2]), u2 = 0 == t3.index ? "" : e3.substr(t3.index - 1, 1), c2 = e3.substr(t3.index + a2.length, 1), l2 = !u2.match(/\d/) && !c2.match(/\d/);
|
|
2869
|
+
this.testMatch(t3[3]) && this.testMatch(a2) && l2 && r2.push(new rt({ tagBuilder: n2, matchedText: a2, offset: t3.index, number: i2, plusSign: o2 }));
|
|
2937
2870
|
}
|
|
2938
2871
|
return r2;
|
|
2939
2872
|
}, t2.prototype.testMatch = function(e3) {
|
|
2940
|
-
return
|
|
2873
|
+
return ct.test(e3);
|
|
2941
2874
|
}, t2;
|
|
2942
|
-
}(
|
|
2875
|
+
}(it), Pt = new RegExp("@[_" + vt + "]{1,50}(?![_" + vt + "])", "g"), $t = new RegExp("@[_." + vt + "]{1,30}(?![_" + vt + "])", "g"), jt = new RegExp("@[-_." + vt + "]{1,50}(?![-_" + vt + "])", "g"), Ut = new RegExp("[^" + vt + "]"), Wt = function(e2) {
|
|
2943
2876
|
function t2(t3) {
|
|
2944
2877
|
var s2 = e2.call(this, t3) || this;
|
|
2945
|
-
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter:
|
|
2878
|
+
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Pt, instagram: $t, soundcloud: jt }, s2.nonWordCharRegex = Ut, s2.serviceName = t3.serviceName, s2;
|
|
2946
2879
|
}
|
|
2947
|
-
return
|
|
2948
|
-
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex,
|
|
2949
|
-
if (!n2) return
|
|
2880
|
+
return Ke(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2881
|
+
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex, a2 = this.tagBuilder, i2 = [];
|
|
2882
|
+
if (!n2) return i2;
|
|
2950
2883
|
for (; null !== (t3 = n2.exec(e3)); ) {
|
|
2951
2884
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2952
2885
|
if (0 === o2 || r2.test(u2)) {
|
|
2953
2886
|
var c2 = t3[0].replace(/\.+$/g, ""), l2 = c2.slice(1);
|
|
2954
|
-
|
|
2887
|
+
i2.push(new nt({ tagBuilder: a2, matchedText: c2, offset: o2, serviceName: s2, mention: l2 }));
|
|
2955
2888
|
}
|
|
2956
2889
|
}
|
|
2957
|
-
return
|
|
2890
|
+
return i2;
|
|
2958
2891
|
}, t2;
|
|
2959
|
-
}(
|
|
2960
|
-
function
|
|
2961
|
-
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag,
|
|
2892
|
+
}(it);
|
|
2893
|
+
function qt(e2, t2) {
|
|
2894
|
+
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, a2 = t2.onText, i2 = t2.onComment, o2 = t2.onDoctype, u2 = new Ht(), c2 = 0, l2 = e2.length, h2 = 0, d2 = 0, p2 = u2; c2 < l2; ) {
|
|
2962
2895
|
var f2 = e2.charAt(c2);
|
|
2963
2896
|
switch (h2) {
|
|
2964
2897
|
case 0:
|
|
@@ -3025,7 +2958,7 @@ function Gt(e2, t2) {
|
|
|
3025
2958
|
_2(f2);
|
|
3026
2959
|
break;
|
|
3027
2960
|
default:
|
|
3028
|
-
|
|
2961
|
+
Je(h2);
|
|
3029
2962
|
}
|
|
3030
2963
|
c2++;
|
|
3031
2964
|
}
|
|
@@ -3033,25 +2966,25 @@ function Gt(e2, t2) {
|
|
|
3033
2966
|
"<" === e3 && P2();
|
|
3034
2967
|
}
|
|
3035
2968
|
function g2(e3) {
|
|
3036
|
-
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new
|
|
2969
|
+
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new Ht(et(et({}, p2), { isClosing: true }))) : "<" === e3 ? P2() : ot.test(e3) ? (h2 = 3, p2 = new Ht(et(et({}, p2), { isOpening: true }))) : (h2 = 0, p2 = u2);
|
|
3037
2970
|
}
|
|
3038
2971
|
function v2(e3) {
|
|
3039
|
-
|
|
2972
|
+
lt.test(e3) ? (p2 = new Ht(et(et({}, p2), { name: j2() })), h2 = 4) : "<" === e3 ? P2() : "/" === e3 ? (p2 = new Ht(et(et({}, p2), { name: j2() })), h2 = 12) : ">" === e3 ? (p2 = new Ht(et(et({}, p2), { name: j2() })), $2()) : ot.test(e3) || ut.test(e3) || ":" === e3 || O2();
|
|
3040
2973
|
}
|
|
3041
2974
|
function w2(e3) {
|
|
3042
|
-
">" === e3 ? O2() :
|
|
2975
|
+
">" === e3 ? O2() : ot.test(e3) ? h2 = 3 : O2();
|
|
3043
2976
|
}
|
|
3044
2977
|
function b2(e3) {
|
|
3045
|
-
|
|
2978
|
+
lt.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? $2() : "<" === e3 ? P2() : "=" === e3 || ht.test(e3) || dt.test(e3) ? O2() : h2 = 5);
|
|
3046
2979
|
}
|
|
3047
2980
|
function y2(e3) {
|
|
3048
|
-
|
|
2981
|
+
lt.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? $2() : "<" === e3 ? P2() : ht.test(e3) && O2();
|
|
3049
2982
|
}
|
|
3050
2983
|
function C2(e3) {
|
|
3051
|
-
|
|
2984
|
+
lt.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? $2() : "<" === e3 ? P2() : ht.test(e3) ? O2() : h2 = 5);
|
|
3052
2985
|
}
|
|
3053
2986
|
function A2(e3) {
|
|
3054
|
-
|
|
2987
|
+
lt.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? O2() : "<" === e3 ? P2() : h2 = 10);
|
|
3055
2988
|
}
|
|
3056
2989
|
function E2(e3) {
|
|
3057
2990
|
'"' === e3 && (h2 = 11);
|
|
@@ -3060,16 +2993,16 @@ function Gt(e2, t2) {
|
|
|
3060
2993
|
"'" === e3 && (h2 = 11);
|
|
3061
2994
|
}
|
|
3062
2995
|
function x2(e3) {
|
|
3063
|
-
|
|
2996
|
+
lt.test(e3) ? h2 = 4 : ">" === e3 ? $2() : "<" === e3 && P2();
|
|
3064
2997
|
}
|
|
3065
2998
|
function T2(e3) {
|
|
3066
|
-
|
|
2999
|
+
lt.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? $2() : "<" === e3 ? P2() : (h2 = 4, c2--);
|
|
3067
3000
|
}
|
|
3068
3001
|
function I2(e3) {
|
|
3069
|
-
">" === e3 ? (p2 = new
|
|
3002
|
+
">" === e3 ? (p2 = new Ht(et(et({}, p2), { isClosing: true })), $2()) : h2 = 4;
|
|
3070
3003
|
}
|
|
3071
3004
|
function D2(t3) {
|
|
3072
|
-
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new
|
|
3005
|
+
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new Ht(et(et({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new Ht(et(et({}, p2), { type: "doctype" })), h2 = 20) : O2();
|
|
3073
3006
|
}
|
|
3074
3007
|
function S2(e3) {
|
|
3075
3008
|
"-" === e3 ? h2 = 15 : ">" === e3 ? O2() : h2 = 16;
|
|
@@ -3084,33 +3017,33 @@ function Gt(e2, t2) {
|
|
|
3084
3017
|
h2 = "-" === e3 ? 18 : 16;
|
|
3085
3018
|
}
|
|
3086
3019
|
function R2(e3) {
|
|
3087
|
-
">" === e3 ?
|
|
3020
|
+
">" === e3 ? $2() : "!" === e3 ? h2 = 19 : "-" === e3 || (h2 = 16);
|
|
3088
3021
|
}
|
|
3089
3022
|
function N2(e3) {
|
|
3090
|
-
"-" === e3 ? h2 = 17 : ">" === e3 ?
|
|
3023
|
+
"-" === e3 ? h2 = 17 : ">" === e3 ? $2() : h2 = 16;
|
|
3091
3024
|
}
|
|
3092
3025
|
function _2(e3) {
|
|
3093
|
-
">" === e3 ?
|
|
3026
|
+
">" === e3 ? $2() : "<" === e3 && P2();
|
|
3094
3027
|
}
|
|
3095
3028
|
function O2() {
|
|
3096
3029
|
h2 = 0, p2 = u2;
|
|
3097
3030
|
}
|
|
3098
3031
|
function P2() {
|
|
3099
|
-
h2 = 1, p2 = new
|
|
3032
|
+
h2 = 1, p2 = new Ht({ idx: c2 });
|
|
3100
3033
|
}
|
|
3101
|
-
function
|
|
3034
|
+
function $2() {
|
|
3102
3035
|
var t3 = e2.slice(d2, p2.idx);
|
|
3103
|
-
t3 &&
|
|
3036
|
+
t3 && a2(t3, d2), "comment" === p2.type ? i2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)), O2(), d2 = c2 + 1;
|
|
3104
3037
|
}
|
|
3105
|
-
function
|
|
3038
|
+
function j2() {
|
|
3106
3039
|
var t3 = p2.idx + (p2.isClosing ? 2 : 1);
|
|
3107
3040
|
return e2.slice(t3, c2).toLowerCase();
|
|
3108
3041
|
}
|
|
3109
|
-
d2 < c2 && (s2 = e2.slice(d2, c2),
|
|
3042
|
+
d2 < c2 && (s2 = e2.slice(d2, c2), a2(s2, d2), d2 = c2 + 1);
|
|
3110
3043
|
}
|
|
3111
|
-
var
|
|
3044
|
+
var Ht = function(e2) {
|
|
3112
3045
|
void 0 === e2 && (e2 = {}), this.idx = void 0 !== e2.idx ? e2.idx : -1, this.type = e2.type || "tag", this.name = e2.name || "", this.isOpening = !!e2.isOpening, this.isClosing = !!e2.isClosing;
|
|
3113
|
-
},
|
|
3046
|
+
}, Lt = function() {
|
|
3114
3047
|
function e2(t2) {
|
|
3115
3048
|
void 0 === t2 && (t2 = {}), this.version = e2.version, this.urls = {}, this.email = true, this.phone = true, this.hashtag = false, this.mention = false, this.newWindow = true, this.stripPrefix = { scheme: true, www: true }, this.stripTrailingSlash = true, this.decodePercentEncoding = true, this.truncate = { length: 0, location: "end" }, this.className = "", this.replaceFn = null, this.context = void 0, this.sanitizeHtml = false, this.matchers = null, this.tagBuilder = null, this.urls = this.normalizeUrlsCfg(t2.urls), this.email = "boolean" == typeof t2.email ? t2.email : this.email, this.phone = "boolean" == typeof t2.phone ? t2.phone : this.phone, this.hashtag = t2.hashtag || this.hashtag, this.mention = t2.mention || this.mention, this.newWindow = "boolean" == typeof t2.newWindow ? t2.newWindow : this.newWindow, this.stripPrefix = this.normalizeStripPrefixCfg(t2.stripPrefix), this.stripTrailingSlash = "boolean" == typeof t2.stripTrailingSlash ? t2.stripTrailingSlash : this.stripTrailingSlash, this.decodePercentEncoding = "boolean" == typeof t2.decodePercentEncoding ? t2.decodePercentEncoding : this.decodePercentEncoding, this.sanitizeHtml = t2.sanitizeHtml || false;
|
|
3116
3049
|
var s2 = this.mention;
|
|
@@ -3134,21 +3067,21 @@ var zt = function(e2) {
|
|
|
3134
3067
|
}(e3 || {}, { length: Number.POSITIVE_INFINITY, location: "end" });
|
|
3135
3068
|
}, e2.prototype.parse = function(e3) {
|
|
3136
3069
|
var t2 = this, s2 = ["a", "style", "script"], n2 = 0, r2 = [];
|
|
3137
|
-
return
|
|
3070
|
+
return qt(e3, { onOpenTag: function(e4) {
|
|
3138
3071
|
s2.indexOf(e4) >= 0 && n2++;
|
|
3139
3072
|
}, onText: function(e4, s3) {
|
|
3140
3073
|
if (0 === n2) {
|
|
3141
|
-
var
|
|
3074
|
+
var a2 = function(e5, t3) {
|
|
3142
3075
|
if (!t3.global) throw new Error("`splitRegex` must have the 'g' flag set");
|
|
3143
3076
|
for (var s4, n3 = [], r3 = 0; s4 = t3.exec(e5); ) n3.push(e5.substring(r3, s4.index)), n3.push(s4[0]), r3 = s4.index + s4[0].length;
|
|
3144
3077
|
return n3.push(e5.substring(r3)), n3;
|
|
3145
|
-
}(e4, /( | |<|<|>|>|"|"|')/gi),
|
|
3146
|
-
|
|
3078
|
+
}(e4, /( | |<|<|>|>|"|"|')/gi), i2 = s3;
|
|
3079
|
+
a2.forEach(function(e5, s4) {
|
|
3147
3080
|
if (s4 % 2 == 0) {
|
|
3148
|
-
var n3 = t2.parseText(e5,
|
|
3081
|
+
var n3 = t2.parseText(e5, i2);
|
|
3149
3082
|
r2.push.apply(r2, n3);
|
|
3150
3083
|
}
|
|
3151
|
-
|
|
3084
|
+
i2 += e5.length;
|
|
3152
3085
|
});
|
|
3153
3086
|
}
|
|
3154
3087
|
}, onCloseTag: function(e4) {
|
|
@@ -3161,151 +3094,151 @@ var zt = function(e2) {
|
|
|
3161
3094
|
return e4.getOffset() - t3.getOffset();
|
|
3162
3095
|
});
|
|
3163
3096
|
for (var t2 = 0; t2 < e3.length - 1; t2++) {
|
|
3164
|
-
var s2 = e3[t2], n2 = s2.getOffset(), r2 = s2.getMatchedText().length,
|
|
3097
|
+
var s2 = e3[t2], n2 = s2.getOffset(), r2 = s2.getMatchedText().length, a2 = n2 + r2;
|
|
3165
3098
|
if (t2 + 1 < e3.length) {
|
|
3166
3099
|
if (e3[t2 + 1].getOffset() === n2) {
|
|
3167
|
-
var
|
|
3168
|
-
e3.splice(
|
|
3100
|
+
var i2 = e3[t2 + 1].getMatchedText().length > r2 ? t2 : t2 + 1;
|
|
3101
|
+
e3.splice(i2, 1);
|
|
3169
3102
|
continue;
|
|
3170
3103
|
}
|
|
3171
|
-
e3[t2 + 1].getOffset() <
|
|
3104
|
+
e3[t2 + 1].getOffset() < a2 && e3.splice(t2 + 1, 1);
|
|
3172
3105
|
}
|
|
3173
3106
|
}
|
|
3174
3107
|
return e3;
|
|
3175
3108
|
}, e2.prototype.removeUnwantedMatches = function(e3) {
|
|
3176
|
-
return this.hashtag ||
|
|
3109
|
+
return this.hashtag || ze(e3, function(e4) {
|
|
3177
3110
|
return "hashtag" === e4.getType();
|
|
3178
|
-
}), this.email ||
|
|
3111
|
+
}), this.email || ze(e3, function(e4) {
|
|
3179
3112
|
return "email" === e4.getType();
|
|
3180
|
-
}), this.phone ||
|
|
3113
|
+
}), this.phone || ze(e3, function(e4) {
|
|
3181
3114
|
return "phone" === e4.getType();
|
|
3182
|
-
}), this.mention ||
|
|
3115
|
+
}), this.mention || ze(e3, function(e4) {
|
|
3183
3116
|
return "mention" === e4.getType();
|
|
3184
|
-
}), this.urls.schemeMatches ||
|
|
3117
|
+
}), this.urls.schemeMatches || ze(e3, function(e4) {
|
|
3185
3118
|
return "url" === e4.getType() && "scheme" === e4.getUrlMatchType();
|
|
3186
|
-
}), this.urls.wwwMatches ||
|
|
3119
|
+
}), this.urls.wwwMatches || ze(e3, function(e4) {
|
|
3187
3120
|
return "url" === e4.getType() && "www" === e4.getUrlMatchType();
|
|
3188
|
-
}), this.urls.tldMatches ||
|
|
3121
|
+
}), this.urls.tldMatches || ze(e3, function(e4) {
|
|
3189
3122
|
return "url" === e4.getType() && "tld" === e4.getUrlMatchType();
|
|
3190
3123
|
}), e3;
|
|
3191
3124
|
}, e2.prototype.parseText = function(e3, t2) {
|
|
3192
3125
|
void 0 === t2 && (t2 = 0), t2 = t2 || 0;
|
|
3193
|
-
for (var s2 = this.getMatchers(), n2 = [], r2 = 0,
|
|
3194
|
-
for (var
|
|
3195
|
-
n2.push.apply(n2,
|
|
3126
|
+
for (var s2 = this.getMatchers(), n2 = [], r2 = 0, a2 = s2.length; r2 < a2; r2++) {
|
|
3127
|
+
for (var i2 = s2[r2].parseMatches(e3), o2 = 0, u2 = i2.length; o2 < u2; o2++) i2[o2].setOffset(t2 + i2[o2].getOffset());
|
|
3128
|
+
n2.push.apply(n2, i2);
|
|
3196
3129
|
}
|
|
3197
3130
|
return n2;
|
|
3198
3131
|
}, e2.prototype.link = function(e3) {
|
|
3199
3132
|
if (!e3) return "";
|
|
3200
3133
|
this.sanitizeHtml && (e3 = e3.replace(/</g, "<").replace(/>/g, ">"));
|
|
3201
|
-
for (var t2 = this.parse(e3), s2 = [], n2 = 0, r2 = 0,
|
|
3202
|
-
var
|
|
3203
|
-
s2.push(e3.substring(n2,
|
|
3134
|
+
for (var t2 = this.parse(e3), s2 = [], n2 = 0, r2 = 0, a2 = t2.length; r2 < a2; r2++) {
|
|
3135
|
+
var i2 = t2[r2];
|
|
3136
|
+
s2.push(e3.substring(n2, i2.getOffset())), s2.push(this.createMatchReturnVal(i2)), n2 = i2.getOffset() + i2.getMatchedText().length;
|
|
3204
3137
|
}
|
|
3205
3138
|
return s2.push(e3.substring(n2)), s2.join("");
|
|
3206
3139
|
}, e2.prototype.createMatchReturnVal = function(e3) {
|
|
3207
3140
|
var t2;
|
|
3208
|
-
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof
|
|
3141
|
+
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof Ye ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
3209
3142
|
}, e2.prototype.getMatchers = function() {
|
|
3210
3143
|
if (this.matchers) return this.matchers;
|
|
3211
|
-
var e3 = this.getTagBuilder(), t2 = [new
|
|
3144
|
+
var e3 = this.getTagBuilder(), t2 = [new Nt({ tagBuilder: e3, serviceName: this.hashtag }), new Tt({ tagBuilder: e3 }), new Ot({ tagBuilder: e3 }), new Wt({ tagBuilder: e3, serviceName: this.mention }), new Ft({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
3212
3145
|
return this.matchers = t2;
|
|
3213
3146
|
}, e2.prototype.getTagBuilder = function() {
|
|
3214
3147
|
var e3 = this.tagBuilder;
|
|
3215
|
-
return e3 || (e3 = this.tagBuilder = new
|
|
3216
|
-
}, e2.version = "3.14.3", e2.AnchorTagBuilder =
|
|
3148
|
+
return e3 || (e3 = this.tagBuilder = new Qe({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
3149
|
+
}, e2.version = "3.14.3", e2.AnchorTagBuilder = Qe, e2.HtmlTag = Ye, e2.matcher = { Email: Tt, Hashtag: Nt, Matcher: it, Mention: Wt, Phone: Ot, Url: Ft }, e2.match = { Email: tt, Hashtag: st, Match: Ve, Mention: nt, Phone: rt, Url: at }, e2;
|
|
3217
3150
|
}();
|
|
3218
|
-
function
|
|
3151
|
+
function Gt(e2, t2 = e2) {
|
|
3219
3152
|
return { type: "autolink", url: e2, text: t2 };
|
|
3220
3153
|
}
|
|
3221
|
-
const
|
|
3154
|
+
const zt = Pe(/<!!mention:([^>\s]*?)\|(.*?)>/gm, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3) {
|
|
3222
3155
|
return { type: "mention", id: e3, text: t3 };
|
|
3223
|
-
}(decodeURIComponent(t2), s2)),
|
|
3156
|
+
}(decodeURIComponent(t2), s2)), Jt = Pe(/<!!customemoji:(.*?)>/gm, ([e2, t2]) => /* @__PURE__ */ function(e3) {
|
|
3224
3157
|
return { type: "customemoji", text: e3 };
|
|
3225
|
-
}(t2)),
|
|
3158
|
+
}(t2)), Yt = Pe(/<((?:https?|mailto):.*?)\|(.*?)>/gi, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3 = []) {
|
|
3226
3159
|
return { type: "link", url: e3, children: t3 };
|
|
3227
|
-
}(t2, [s2])),
|
|
3228
|
-
const { action: n2, params: r2 } =
|
|
3160
|
+
}(t2, [s2])), Qt = Pe(/<actionlink:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3161
|
+
const { action: n2, params: r2 } = Zt(t2);
|
|
3229
3162
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
3230
3163
|
return { type: "actionlink", action: e3, params: t3, children: s3 };
|
|
3231
3164
|
}(n2, r2, [s2]);
|
|
3232
|
-
}),
|
|
3233
|
-
const { action: n2, params: r2 } =
|
|
3165
|
+
}), Vt = Pe(/<actionbutton:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
3166
|
+
const { action: n2, params: r2 } = Zt(t2);
|
|
3234
3167
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
3235
3168
|
return { type: "actionbutton", action: e3, params: t3, children: s3 };
|
|
3236
3169
|
}(n2, r2, [s2]);
|
|
3237
3170
|
});
|
|
3238
|
-
function
|
|
3171
|
+
function Zt(e2) {
|
|
3239
3172
|
const t2 = e2.indexOf("?");
|
|
3240
3173
|
if (-1 === t2) return { action: e2, params: {} };
|
|
3241
3174
|
return { action: e2.slice(0, t2), params: Object.fromEntries(new URLSearchParams(e2.slice(t2))) };
|
|
3242
3175
|
}
|
|
3243
|
-
const
|
|
3176
|
+
const Kt = Pe(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__ */ function(e3 = []) {
|
|
3244
3177
|
return { type: "bulletlist", children: e3 };
|
|
3245
|
-
}([e2.startsWith("\n") ? e2.slice(1) : e2])),
|
|
3178
|
+
}([e2.startsWith("\n") ? e2.slice(1) : e2])), Xt = Pe(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm, ([e2, t2]) => ({ type: "bulletpoint", children: [t2] })), es = (e2) => {
|
|
3246
3179
|
const t2 = /(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;
|
|
3247
3180
|
let s2 = 0;
|
|
3248
3181
|
const n2 = [];
|
|
3249
3182
|
for (const r2 of Z(e2, t2)) {
|
|
3250
|
-
const t3 = r2[0],
|
|
3251
|
-
|
|
3252
|
-
const o2 =
|
|
3253
|
-
n2.push(o2), s2 =
|
|
3183
|
+
const t3 = r2[0], a2 = r2[1], i2 = t3.startsWith(a2) ? r2.index : r2.index + 1;
|
|
3184
|
+
i2 - s2 > 0 && n2.push(e2.substring(s2, i2));
|
|
3185
|
+
const o2 = Gt("tel:" + a2.replace(/[^0-9+]/g, ""), a2);
|
|
3186
|
+
n2.push(o2), s2 = i2 + a2.length;
|
|
3254
3187
|
}
|
|
3255
3188
|
return s2 < e2.length && n2.push(e2.substring(s2)), n2;
|
|
3256
|
-
},
|
|
3257
|
-
const t2 =
|
|
3189
|
+
}, ts = (e2) => Yt(e2).flatMap((e3) => "string" == typeof e3 ? ss(e3) : ["<", ...ss(e3.url), ...ss("|" + e3.children[0] + ">")]), ss = (e2) => {
|
|
3190
|
+
const t2 = Lt.parse(e2, { urls: true, email: true, phone: false, hashtag: false, mention: false }), s2 = [];
|
|
3258
3191
|
let n2 = 0;
|
|
3259
3192
|
for (const r2 of t2) {
|
|
3260
|
-
const t3 = r2.getOffset(),
|
|
3261
|
-
let o2 =
|
|
3262
|
-
r2 instanceof
|
|
3193
|
+
const t3 = r2.getOffset(), a2 = r2.getMatchedText(), i2 = a2.length;
|
|
3194
|
+
let o2 = a2;
|
|
3195
|
+
r2 instanceof tt ? o2 = "mailto:" + r2.getEmail() : r2 instanceof at && (o2 = r2.getUrl()), t3 > n2 && s2.push(e2.substring(n2, t3)), s2.push(Gt(o2, a2)), n2 = t3 + i2;
|
|
3263
3196
|
}
|
|
3264
3197
|
return n2 < e2.length && s2.push(e2.substring(n2)), s2;
|
|
3265
|
-
},
|
|
3266
|
-
function
|
|
3198
|
+
}, ns = ["Codeblock", "Codespan", "FormattedLink", "Wikitext", "Autolink", "Actions", "Mention", "Mention", "BulletPoint", "CustomEmoji"];
|
|
3199
|
+
function rs(e2 = { except: [] }) {
|
|
3267
3200
|
var _a2;
|
|
3268
|
-
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 :
|
|
3269
|
-
return s2.includes("BulletPoint") || t2.multilineSteps.push(
|
|
3201
|
+
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 : ns.filter((t3) => !e2.only.includes(t3));
|
|
3202
|
+
return s2.includes("BulletPoint") || t2.multilineSteps.push(Kt, Xt), s2.includes("Mention") || t2.singlelineSteps.push(zt), s2.includes("CustomEmoji") || t2.singlelineSteps.push(Jt), s2.includes("Codespan") || t2.multilineSteps.push(Pe(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3.replace(/<!!mention:.*?\|([^>]*)>/gim, "@$1").replace(/<!!customemoji:(.*?)>/gim, "$1") }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(Yt), s2.includes("Actions") || (t2.singlelineSteps.push(Qt), t2.singlelineSteps.push(Vt)), s2.includes("Wikitext") || t2.singlelineSteps.push(qe), s2.includes("Autolink") || t2.singlelineSteps.push(ts, es), t2;
|
|
3270
3203
|
}
|
|
3271
|
-
const
|
|
3204
|
+
const as = function(e2) {
|
|
3272
3205
|
const t2 = RegExp(`[^${e2}]+${e2}?|${e2}`, "g");
|
|
3273
3206
|
return (e3) => Array.from(e3.match(t2) || []);
|
|
3274
3207
|
}("\n");
|
|
3275
|
-
function
|
|
3208
|
+
function is(e2, t2 = { except: [] }) {
|
|
3276
3209
|
let s2 = function(e3, t3) {
|
|
3277
3210
|
let s3 = [e3];
|
|
3278
|
-
return s3 =
|
|
3279
|
-
}(e2,
|
|
3280
|
-
return s2 =
|
|
3211
|
+
return s3 = us(s3, t3.multilineSteps), s3 = us(s3, [as]), s3 = us(s3, t3.singlelineSteps), s3 = cs(s3), s3;
|
|
3212
|
+
}(e2, rs(t2));
|
|
3213
|
+
return s2 = ls(s2, false), s2;
|
|
3281
3214
|
}
|
|
3282
|
-
function
|
|
3283
|
-
return
|
|
3215
|
+
function os(e2) {
|
|
3216
|
+
return is(e2, { except: ["FormattedLink", "Actions"] });
|
|
3284
3217
|
}
|
|
3285
|
-
function
|
|
3286
|
-
return t2.reduce((e3, t3) =>
|
|
3218
|
+
function us(e2, t2) {
|
|
3219
|
+
return t2.reduce((e3, t3) => Oe(e3, t3), e2);
|
|
3287
3220
|
}
|
|
3288
|
-
function
|
|
3221
|
+
function cs(e2) {
|
|
3289
3222
|
const t2 = [];
|
|
3290
3223
|
let s2 = -1;
|
|
3291
|
-
for (const n2 of e2) "string" == typeof n2 ? "string" == typeof t2[s2] ? t2[s2] += n2 : t2[++s2] = n2 : t2[++s2] = "children" in n2 ? __spreadProps(__spreadValues({}, n2), { children:
|
|
3224
|
+
for (const n2 of e2) "string" == typeof n2 ? "string" == typeof t2[s2] ? t2[s2] += n2 : t2[++s2] = n2 : t2[++s2] = "children" in n2 ? __spreadProps(__spreadValues({}, n2), { children: cs(n2.children) }) : n2;
|
|
3292
3225
|
return t2;
|
|
3293
3226
|
}
|
|
3294
|
-
function
|
|
3227
|
+
function ls(e2, t2) {
|
|
3295
3228
|
const s2 = [];
|
|
3296
3229
|
let n2 = [];
|
|
3297
3230
|
for (let r2 = 0; r2 < e2.length; r2++) {
|
|
3298
|
-
const
|
|
3299
|
-
if ("string" == typeof
|
|
3300
|
-
else if ("children" in
|
|
3231
|
+
const a2 = e2[r2];
|
|
3232
|
+
if ("string" == typeof a2) n2.push(a2);
|
|
3233
|
+
else if ("children" in a2) {
|
|
3301
3234
|
n2.length > 0 && (s2.push(n2.join("")), n2 = []);
|
|
3302
|
-
const e3 =
|
|
3303
|
-
s2.push(__spreadProps(__spreadValues({},
|
|
3304
|
-
} else "autolink" ===
|
|
3235
|
+
const e3 = ls(a2.children, t2 || "link" === a2.type || "actionbutton" === a2.type || "actionlink" === a2.type);
|
|
3236
|
+
s2.push(__spreadProps(__spreadValues({}, a2), { children: e3 }));
|
|
3237
|
+
} else "autolink" === a2.type && t2 ? n2.push(a2.text) : (n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2.push(a2));
|
|
3305
3238
|
}
|
|
3306
3239
|
return n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2;
|
|
3307
3240
|
}
|
|
3308
|
-
class
|
|
3241
|
+
class hs {
|
|
3309
3242
|
constructor(e2, t2, s2, n2) {
|
|
3310
3243
|
this.emoji = e2, this.messageId = t2, this.conversationId = s2, this._realtimeClient = n2;
|
|
3311
3244
|
}
|
|
@@ -3317,18 +3250,18 @@ class fs {
|
|
|
3317
3250
|
}
|
|
3318
3251
|
add() {
|
|
3319
3252
|
return __async(this, null, function* () {
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3253
|
+
const e2 = yield this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedConversationId, "messages", this.brandedMessageId, "reactions", this.emoji, this._realtimeClient.userId], data: {} });
|
|
3254
|
+
h(`Add ${this.emoji} reaction on message ${this.messageId} in conversation ${this.conversationId}`, e2);
|
|
3322
3255
|
});
|
|
3323
3256
|
}
|
|
3324
3257
|
remove() {
|
|
3325
3258
|
return __async(this, null, function* () {
|
|
3326
|
-
const
|
|
3327
|
-
(
|
|
3259
|
+
const e2 = yield this._realtimeClient.call({ method: "DELETE", path: ["conversations", this.brandedConversationId, "messages", this.brandedMessageId, "reactions", this.emoji, this._realtimeClient.userId], data: {} });
|
|
3260
|
+
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) && h(`Remove ${this.emoji} reaction from message ${this.messageId} in conversation ${this.conversationId}`, e2);
|
|
3328
3261
|
});
|
|
3329
3262
|
}
|
|
3330
3263
|
}
|
|
3331
|
-
class
|
|
3264
|
+
class ds {
|
|
3332
3265
|
constructor(e2, t2, s2) {
|
|
3333
3266
|
this.id = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
3334
3267
|
}
|
|
@@ -3341,40 +3274,40 @@ class ms {
|
|
|
3341
3274
|
reaction(e2) {
|
|
3342
3275
|
if ("string" != typeof e2) throw new Error(`Creating ReactionRef failed because emoji "${e2}" is not a string`);
|
|
3343
3276
|
if ("" === e2) throw new Error(`Creating ReactionRef failed because emoji "${e2}" is an empty string`);
|
|
3344
|
-
return
|
|
3277
|
+
return this._realtimeClient.refs.reaction(this.brandedConversationId, this.brandedId, e2);
|
|
3345
3278
|
}
|
|
3346
3279
|
get() {
|
|
3347
3280
|
return __async(this, null, function* () {
|
|
3348
|
-
const
|
|
3349
|
-
if (!
|
|
3350
|
-
if (!
|
|
3351
|
-
const
|
|
3352
|
-
return
|
|
3281
|
+
const e2 = yield this._realtimeClient.call({ method: "GET", path: ["me", "conversations", this.brandedConversationId, "messages", this.brandedId], data: {} });
|
|
3282
|
+
if (!e2.ok && "server" === e2.where && 404 === e2.value.status) return null;
|
|
3283
|
+
if (!e2.ok && "server" === e2.where && 403 === e2.value.status && "NOT_A_PARTICIPANT" === e2.value.errorCode) return null;
|
|
3284
|
+
const t2 = h("Get message " + this.id, e2), s2 = yield this._realtimeClient.hydrateMessageData(t2, this.brandedConversationId);
|
|
3285
|
+
return Es("Get message " + this.id, s2);
|
|
3353
3286
|
});
|
|
3354
3287
|
}
|
|
3355
|
-
edit(
|
|
3288
|
+
edit(e2) {
|
|
3356
3289
|
return __async(this, null, function* () {
|
|
3357
|
-
const
|
|
3358
|
-
|
|
3290
|
+
const t2 = { content: ps(e2), custom: "string" == typeof e2 ? void 0 : e2.custom }, s2 = yield this._realtimeClient.call({ method: "PATCH", path: ["conversations", this.brandedConversationId, "messages", this.brandedId], data: t2 });
|
|
3291
|
+
h(`Edit message ${this.id} in conversation ${this.conversationId}`, s2);
|
|
3359
3292
|
});
|
|
3360
3293
|
}
|
|
3361
3294
|
delete() {
|
|
3362
3295
|
return __async(this, null, function* () {
|
|
3363
|
-
const
|
|
3364
|
-
(
|
|
3296
|
+
const e2 = yield this._realtimeClient.call({ method: "DELETE", path: ["conversations", this.brandedConversationId, "messages", this.brandedId], data: {} });
|
|
3297
|
+
(e2.ok || "server" !== e2.where || 404 !== e2.value.status) && h(`Delete message ${this.id} in conversation ${this.conversationId}`, e2);
|
|
3365
3298
|
});
|
|
3366
3299
|
}
|
|
3367
3300
|
}
|
|
3368
|
-
function
|
|
3301
|
+
function ps(e2) {
|
|
3369
3302
|
if ("string" == typeof e2) {
|
|
3370
|
-
return [{ type: "text", children:
|
|
3303
|
+
return [{ type: "text", children: is(e2) }];
|
|
3371
3304
|
}
|
|
3372
3305
|
if ("text" in e2 && e2.text) {
|
|
3373
|
-
return [{ type: "text", children:
|
|
3306
|
+
return [{ type: "text", children: is(e2.text) }];
|
|
3374
3307
|
}
|
|
3375
3308
|
if ("content" in e2 && e2.content) return e2.content;
|
|
3376
3309
|
}
|
|
3377
|
-
class
|
|
3310
|
+
class fs {
|
|
3378
3311
|
constructor(e2, t2) {
|
|
3379
3312
|
this.id = e2, this._realtimeClient = t2, this.uselessObjForTypeCheck = { subject: null, photoUrl: null, welcomeMessages: null, custom: null, access: null, notify: null };
|
|
3380
3313
|
}
|
|
@@ -3387,15 +3320,15 @@ class vs {
|
|
|
3387
3320
|
participant(e2) {
|
|
3388
3321
|
if ("string" == typeof e2) {
|
|
3389
3322
|
if ("" === e2) throw new Error(`Creating ParticipantRef failed because ID "${e2}" is an empty string`);
|
|
3390
|
-
return
|
|
3323
|
+
return this._realtimeClient.refs.participant(this.brandedId, e2);
|
|
3391
3324
|
}
|
|
3392
|
-
if ("brandedId" in e2) return
|
|
3325
|
+
if ("brandedId" in e2) return this._realtimeClient.refs.participant(this.brandedId, e2.id);
|
|
3393
3326
|
throw new Error(`Creating ParticipantRef failed because user "${e2}" is not a string or a UserRef`);
|
|
3394
3327
|
}
|
|
3395
3328
|
message(e2) {
|
|
3396
3329
|
if ("string" != typeof e2) throw new Error(`Creating MessageRef failed because ID "${e2}" is not a string`);
|
|
3397
3330
|
if ("" === e2) throw new Error(`Creating MessageRef failed because ID "${e2}" is an empty string`);
|
|
3398
|
-
return
|
|
3331
|
+
return this._realtimeClient.refs.message(this.brandedId, e2);
|
|
3399
3332
|
}
|
|
3400
3333
|
get() {
|
|
3401
3334
|
return __async(this, null, function* () {
|
|
@@ -3410,47 +3343,47 @@ class vs {
|
|
|
3410
3343
|
throw "error" === s2.type ? s2.error : "Unreachable";
|
|
3411
3344
|
});
|
|
3412
3345
|
}
|
|
3413
|
-
set(
|
|
3346
|
+
set(e2) {
|
|
3414
3347
|
return __async(this, null, function* () {
|
|
3415
|
-
const
|
|
3416
|
-
!
|
|
3417
|
-
if (void 0 !==
|
|
3418
|
-
if (void 0 !==
|
|
3419
|
-
if (void 0 !==
|
|
3420
|
-
if (null ===
|
|
3421
|
-
if (void 0 !==
|
|
3348
|
+
const t2 = this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedId], data: e2 }), s2 = this._realtimeClient.call({ method: "PUT", path: ["conversations", this.brandedId, "participants", this.brandedUserId], data: e2 }), n2 = yield t2;
|
|
3349
|
+
!n2.ok && "server" === n2.where && 403 === n2.value.status && "UNAUTHORIZED_TO_EDIT" === n2.value.errorCode && function(e3) {
|
|
3350
|
+
if (void 0 !== e3.subject) return false;
|
|
3351
|
+
if (void 0 !== e3.photoUrl) return false;
|
|
3352
|
+
if (void 0 !== e3.welcomeMessages) return false;
|
|
3353
|
+
if (null === e3.custom) return false;
|
|
3354
|
+
if (void 0 !== e3.custom && Object.values(e3.custom).some((e4) => void 0 !== e4)) return false;
|
|
3422
3355
|
return true;
|
|
3423
|
-
}(
|
|
3424
|
-
const
|
|
3425
|
-
!
|
|
3426
|
-
return void 0 ===
|
|
3427
|
-
}(
|
|
3356
|
+
}(e2) || h("Set conversation " + this.id, n2);
|
|
3357
|
+
const r2 = yield s2;
|
|
3358
|
+
!r2.ok && "server" === r2.where && 403 === r2.value.status && "UNAUTHORIZED_TO_EDIT_PARTICIPANT" === r2.value.errorCode && function(e3) {
|
|
3359
|
+
return void 0 === e3.access && void 0 === e3.notify;
|
|
3360
|
+
}(e2) || h("Set your participation in conversation " + this.id, r2);
|
|
3428
3361
|
});
|
|
3429
3362
|
}
|
|
3430
3363
|
createIfNotExists() {
|
|
3431
|
-
return __async(this, arguments, function* (
|
|
3432
|
-
const
|
|
3433
|
-
(
|
|
3434
|
-
const
|
|
3435
|
-
(
|
|
3364
|
+
return __async(this, arguments, function* (e2 = {}) {
|
|
3365
|
+
const t2 = this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedId], data: e2 }), s2 = this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedId, "participants", this.brandedUserId], data: e2 }), n2 = yield t2;
|
|
3366
|
+
(n2.ok || "server" !== n2.where || 409 !== n2.value.status) && h("Create conversation " + this.id, yield t2);
|
|
3367
|
+
const r2 = yield s2;
|
|
3368
|
+
(r2.ok || "server" !== r2.where || 409 !== r2.value.status) && h("Join conversation " + this.id, yield s2);
|
|
3436
3369
|
});
|
|
3437
3370
|
}
|
|
3438
3371
|
markAsRead() {
|
|
3439
3372
|
return __async(this, null, function* () {
|
|
3440
|
-
const
|
|
3441
|
-
|
|
3373
|
+
const e2 = yield this._realtimeClient.call({ method: "POST", path: ["me", "conversations", this.brandedId, "read"], data: {} });
|
|
3374
|
+
h(`Mark ${this.id} as read`, e2);
|
|
3442
3375
|
});
|
|
3443
3376
|
}
|
|
3444
3377
|
markAsUnread() {
|
|
3445
3378
|
return __async(this, null, function* () {
|
|
3446
|
-
const
|
|
3447
|
-
|
|
3379
|
+
const e2 = yield this._realtimeClient.call({ method: "POST", path: ["me", "conversations", this.brandedId, "unread"], data: {} });
|
|
3380
|
+
h(`Mark ${this.id} as unread`, e2);
|
|
3448
3381
|
});
|
|
3449
3382
|
}
|
|
3450
|
-
send(
|
|
3383
|
+
send(e2) {
|
|
3451
3384
|
return __async(this, null, function* () {
|
|
3452
|
-
const
|
|
3453
|
-
return
|
|
3385
|
+
const t2 = { content: ms(e2), referencedMessageId: gs(e2), custom: "string" == typeof e2 ? void 0 : e2.custom, idempotencyKey: _e((/* @__PURE__ */ new Date()).getTime()) }, s2 = yield this._realtimeClient.call({ method: "POST", path: ["conversations", this.brandedId, "messages"], data: t2 }), n2 = h("Send message to conversation " + this.id, s2);
|
|
3386
|
+
return this._realtimeClient.refs.message(this.brandedId, n2.id);
|
|
3454
3387
|
});
|
|
3455
3388
|
}
|
|
3456
3389
|
subscribeMessages(e2) {
|
|
@@ -3467,26 +3400,155 @@ class vs {
|
|
|
3467
3400
|
}
|
|
3468
3401
|
markAsTyping() {
|
|
3469
3402
|
return __async(this, null, function* () {
|
|
3470
|
-
const
|
|
3471
|
-
|
|
3403
|
+
const e2 = yield this._realtimeClient.call({ method: "POST", path: ["me", "conversations", this.brandedId, "typing"], data: {} });
|
|
3404
|
+
h(`Set user as typing in ${this.id}`, e2);
|
|
3472
3405
|
});
|
|
3473
3406
|
}
|
|
3474
3407
|
}
|
|
3475
|
-
function
|
|
3408
|
+
function ms(e2) {
|
|
3476
3409
|
if ("string" == typeof e2) {
|
|
3477
|
-
return [{ type: "text", children:
|
|
3410
|
+
return [{ type: "text", children: os(e2) }];
|
|
3478
3411
|
}
|
|
3479
3412
|
if ("text" in e2) {
|
|
3480
|
-
return [{ type: "text", children:
|
|
3413
|
+
return [{ type: "text", children: os(e2.text) }];
|
|
3481
3414
|
}
|
|
3482
3415
|
return e2.content;
|
|
3483
3416
|
}
|
|
3484
|
-
function
|
|
3417
|
+
function gs(e2) {
|
|
3485
3418
|
if ("string" == typeof e2) return;
|
|
3486
3419
|
const t2 = e2.referencedMessage;
|
|
3487
3420
|
return void 0 !== t2 ? "string" == typeof t2 ? t2 : t2.id : void 0;
|
|
3488
3421
|
}
|
|
3422
|
+
const vs = "undefined" != typeof WeakRef ? WeakRef : class {
|
|
3423
|
+
constructor(e2) {
|
|
3424
|
+
this.value = e2;
|
|
3425
|
+
}
|
|
3426
|
+
deref() {
|
|
3427
|
+
return this.value;
|
|
3428
|
+
}
|
|
3429
|
+
}, ws = globalThis.FinalizationRegistry, bs = void 0 !== ws ? ws : class {
|
|
3430
|
+
constructor(e2) {
|
|
3431
|
+
}
|
|
3432
|
+
register(e2, t2, s2) {
|
|
3433
|
+
}
|
|
3434
|
+
unregister(e2) {
|
|
3435
|
+
}
|
|
3436
|
+
};
|
|
3489
3437
|
class ys {
|
|
3438
|
+
constructor(e2) {
|
|
3439
|
+
this.client = e2, this.users = /* @__PURE__ */ new Map(), this.conversations = /* @__PURE__ */ new Map(), this.participants = /* @__PURE__ */ new Map(), this.messages = /* @__PURE__ */ new Map(), this.reactions = /* @__PURE__ */ new Map(), this.registry = new bs(({ map: e3, key: t2 }) => {
|
|
3440
|
+
e3.delete(t2);
|
|
3441
|
+
});
|
|
3442
|
+
}
|
|
3443
|
+
user(e2) {
|
|
3444
|
+
var _a2;
|
|
3445
|
+
const t2 = (_a2 = this.users.get(e2)) == null ? void 0 : _a2.deref();
|
|
3446
|
+
if (t2) return t2;
|
|
3447
|
+
const s2 = x(new Re(e2, this.client));
|
|
3448
|
+
return this.users.set(e2, new vs(s2)), this.registry.register(s2, { map: this.users, key: e2 }), s2;
|
|
3449
|
+
}
|
|
3450
|
+
conversation(e2) {
|
|
3451
|
+
var _a2;
|
|
3452
|
+
const t2 = (_a2 = this.conversations.get(e2)) == null ? void 0 : _a2.deref();
|
|
3453
|
+
if (t2) return t2;
|
|
3454
|
+
const s2 = x(new fs(e2, this.client));
|
|
3455
|
+
return this.conversations.set(e2, new vs(s2)), this.registry.register(s2, { map: this.conversations, key: e2 }), s2;
|
|
3456
|
+
}
|
|
3457
|
+
participant(e2, t2) {
|
|
3458
|
+
var _a2;
|
|
3459
|
+
const s2 = `[${e2}][${t2}]`, n2 = (_a2 = this.participants.get(s2)) == null ? void 0 : _a2.deref();
|
|
3460
|
+
if (n2) return n2;
|
|
3461
|
+
const r2 = x(new Ne(t2, e2, this.client));
|
|
3462
|
+
return this.participants.set(s2, new vs(r2)), this.registry.register(r2, { map: this.participants, key: s2 }), r2;
|
|
3463
|
+
}
|
|
3464
|
+
message(e2, t2) {
|
|
3465
|
+
var _a2;
|
|
3466
|
+
const s2 = `[${e2}][${t2}]`, n2 = (_a2 = this.messages.get(s2)) == null ? void 0 : _a2.deref();
|
|
3467
|
+
if (n2) return n2;
|
|
3468
|
+
const r2 = x(new ds(t2, e2, this.client));
|
|
3469
|
+
return this.messages.set(s2, new vs(r2)), this.registry.register(r2, { map: this.messages, key: s2 }), r2;
|
|
3470
|
+
}
|
|
3471
|
+
reaction(e2, t2, s2) {
|
|
3472
|
+
var _a2;
|
|
3473
|
+
const n2 = `[${e2}][${t2}][${s2}]`, r2 = (_a2 = this.reactions.get(n2)) == null ? void 0 : _a2.deref();
|
|
3474
|
+
if (r2) return r2;
|
|
3475
|
+
const a2 = x(new hs(s2, t2, e2, this.client));
|
|
3476
|
+
return this.reactions.set(n2, new vs(a2)), this.registry.register(a2, { map: this.reactions, key: n2 }), a2;
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
class Cs {
|
|
3480
|
+
constructor(e2, t2, s2) {
|
|
3481
|
+
this.userId = t2, this.refs = new ys(this), this.alive = true, this.connection = new Fe(e2, s2, this), s2.onTokenRefreshFailed(() => {
|
|
3482
|
+
this.destroy();
|
|
3483
|
+
});
|
|
3484
|
+
}
|
|
3485
|
+
call(e2) {
|
|
3486
|
+
return __async(this, null, function* () {
|
|
3487
|
+
return this.alive ? this.connection.call(e2) : u("SESSION_DESTROYED");
|
|
3488
|
+
});
|
|
3489
|
+
}
|
|
3490
|
+
subscribe(e2, t2) {
|
|
3491
|
+
return this.connection.subscribe(e2, t2);
|
|
3492
|
+
}
|
|
3493
|
+
internalSubscribe(e2) {
|
|
3494
|
+
const t2 = this.connection.getOrCreateStore(e2);
|
|
3495
|
+
return { store: t2, unsubscribe: t2.registerInternalSubscription() };
|
|
3496
|
+
}
|
|
3497
|
+
destroy() {
|
|
3498
|
+
this.alive = false, this.connection.destroy();
|
|
3499
|
+
}
|
|
3500
|
+
isConnected() {
|
|
3501
|
+
return this.connection.isConnected();
|
|
3502
|
+
}
|
|
3503
|
+
sync() {
|
|
3504
|
+
return __async(this, null, function* () {
|
|
3505
|
+
yield this.connection.sync();
|
|
3506
|
+
});
|
|
3507
|
+
}
|
|
3508
|
+
hydrateMessageData(e2, t2) {
|
|
3509
|
+
return __async(this, null, function* () {
|
|
3510
|
+
const s2 = null === e2.senderId ? Promise.resolve(o(null)) : this.getUser(e2.senderId), n2 = null === e2.referencedMessageId ? Promise.resolve(o(null)) : this.getReferencedMessage(t2, e2.referencedMessageId), r2 = yield s2;
|
|
3511
|
+
if (!r2.ok) return r2;
|
|
3512
|
+
const a2 = yield n2;
|
|
3513
|
+
if (!a2.ok) return a2;
|
|
3514
|
+
const i2 = function(e3, t3, s3) {
|
|
3515
|
+
return x({ id: e3.id, type: e3.type, sender: t3, referencedMessage: s3, custom: x(e3.custom), createdAt: e3.createdAt, editedAt: e3.editedAt, origin: e3.origin, content: e3.content, reactions: ce(e3.reactions), plaintext: ae(e3.content, {}) });
|
|
3516
|
+
}(e2, r2.value, a2.value);
|
|
3517
|
+
return o(i2);
|
|
3518
|
+
});
|
|
3519
|
+
}
|
|
3520
|
+
getReferencedMessage(e2, t2) {
|
|
3521
|
+
return __async(this, null, function* () {
|
|
3522
|
+
const s2 = yield this.call({ method: "GET", path: ["me", "conversations", e2, "messages", t2], data: {} });
|
|
3523
|
+
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return o(null);
|
|
3524
|
+
if (!s2.ok && "server" === s2.where && 403 === s2.value.status && "NOT_A_PARTICIPANT" === s2.value.errorCode) return o(null);
|
|
3525
|
+
if (!s2.ok) return As(s2, `Fetching referenced message ${t2} in conversation ${e2}`);
|
|
3526
|
+
const n2 = s2.value.data, r2 = yield this.getUser(n2.senderId);
|
|
3527
|
+
if (!r2.ok) return r2;
|
|
3528
|
+
const a2 = function(e3, t3) {
|
|
3529
|
+
return x({ id: e3.id, type: e3.type, sender: t3, referencedMessageId: e3.referencedMessageId, custom: x(e3.custom), createdAt: e3.createdAt, editedAt: e3.editedAt, origin: e3.origin, content: e3.content, reactions: ce(e3.reactions), plaintext: ae(e3.content, {}) });
|
|
3530
|
+
}(n2, r2.value);
|
|
3531
|
+
return o(a2);
|
|
3532
|
+
});
|
|
3533
|
+
}
|
|
3534
|
+
getUser(e2) {
|
|
3535
|
+
return __async(this, null, function* () {
|
|
3536
|
+
const t2 = yield this.call({ method: "GET", path: ["users", e2], data: { includePrivateFields: false } });
|
|
3537
|
+
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return o(null);
|
|
3538
|
+
if (!t2.ok) return As(t2, "Get user " + e2);
|
|
3539
|
+
return o(oe(t2.value.data));
|
|
3540
|
+
});
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
function As(e2, t2) {
|
|
3544
|
+
return "server" === e2.where ? c(__spreadProps(__spreadValues({}, e2.value), { operation: t2 })) : e2;
|
|
3545
|
+
}
|
|
3546
|
+
function Es(e2, t2) {
|
|
3547
|
+
var _a2;
|
|
3548
|
+
if (t2.ok) return t2.value;
|
|
3549
|
+
throw "SESSION_DESTROYED" === t2.value ? new Error(`${e2} failed because the session was destroyed`) : new Error(d((_a2 = t2.value.operation) != null ? _a2 : e2, t2.value));
|
|
3550
|
+
}
|
|
3551
|
+
class ks {
|
|
3490
3552
|
constructor(e2, t2, s2) {
|
|
3491
3553
|
this.realtimeWsApiUrl = e2, this.internalHttpApiUrl = t2, this.restApiHttpUrl = s2;
|
|
3492
3554
|
}
|
|
@@ -3494,12 +3556,12 @@ class ys {
|
|
|
3494
3556
|
return this.internalHttpApiUrl + `/${e2}/bokens/${encodeURIComponent(t2)}?signature=${encodeURIComponent(s2 != null ? s2 : "")}`;
|
|
3495
3557
|
}
|
|
3496
3558
|
getRealtimeWsUrl(e2, t2, s2, n2, r2) {
|
|
3497
|
-
const
|
|
3498
|
-
return this.realtimeWsApiUrl + `/${e2}/realtime/${
|
|
3559
|
+
const a2 = encodeURIComponent(t2);
|
|
3560
|
+
return this.realtimeWsApiUrl + `/${e2}/realtime/${a2}?talkjs-client-build=${r2 != null ? r2 : "standalone"}&talkjs-core=${s2}&talkjs-client-id=${n2}`;
|
|
3499
3561
|
}
|
|
3500
3562
|
static fromHost(e2) {
|
|
3501
3563
|
var _a2;
|
|
3502
|
-
const t2 = new
|
|
3564
|
+
const t2 = new ks("wss://realtime.talkjs.com/v1", "https://app.talkjs.com/api/v0", "https://api.talkjs.com/v1");
|
|
3503
3565
|
if (!e2) return t2;
|
|
3504
3566
|
if ("@currentHost" === e2) {
|
|
3505
3567
|
if ("undefined" == typeof location) throw new Error("You can only use @currentHost in a browser.");
|
|
@@ -3509,19 +3571,19 @@ class ys {
|
|
|
3509
3571
|
const s2 = e2.match(/^(?:\w+-)?([^.]+)\.talkjs\.com$/);
|
|
3510
3572
|
if (s2) {
|
|
3511
3573
|
const e3 = s2[1];
|
|
3512
|
-
return ["app", "cdn", "api", "realtime"].includes(e3) ? t2 : new
|
|
3574
|
+
return ["app", "cdn", "api", "realtime"].includes(e3) ? t2 : new ks(`wss://realtime-${e3}.talkjs.com/v1`, `https://app-${e3}.talkjs.com/api/v0`, `https://api-${e3}.talkjs.com/v1`);
|
|
3513
3575
|
}
|
|
3514
3576
|
return t2;
|
|
3515
3577
|
}
|
|
3516
|
-
return e2.includes("localhost") || e2.includes("localtest.me") || /^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e2) ? new
|
|
3578
|
+
return e2.includes("localhost") || e2.includes("localtest.me") || /^\d+\.\d+\.\d+\.\d+(:\d+)?$/.test(e2) ? new ks(`ws://${e2}/public_api/v1`, `http://${e2}/api/v0`, `http://${e2}/public_api/v1`) : new ks(`wss://${e2}/public_api/v1`, `https://${e2}/api/v0`, `https://${e2}/public_api/v1`);
|
|
3517
3579
|
}
|
|
3518
3580
|
}
|
|
3519
|
-
function
|
|
3581
|
+
function xs({ method: e2, url: t2, data: s2, options: n2, attempts: a2, shouldRetry: i2, authProvider: o2, errorTracker: u2 }) {
|
|
3520
3582
|
var _a2;
|
|
3521
|
-
(!
|
|
3522
|
-
const c2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2026-01-
|
|
3583
|
+
(!a2 || a2 <= 0) && (a2 = 1);
|
|
3584
|
+
const c2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2026-01-19T10:53:42.725Z" };
|
|
3523
3585
|
s2 instanceof FormData || (c2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
3524
|
-
return
|
|
3586
|
+
return r(a2, () => __async(this, null, function* () {
|
|
3525
3587
|
if (o2) {
|
|
3526
3588
|
const e3 = yield o2.getToken();
|
|
3527
3589
|
c2.Authorization = `Bearer ${e3}`;
|
|
@@ -3543,12 +3605,12 @@ function Cs({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRe
|
|
|
3543
3605
|
throw s3;
|
|
3544
3606
|
});
|
|
3545
3607
|
}
|
|
3546
|
-
class
|
|
3608
|
+
class Ts {
|
|
3547
3609
|
constructor(e2) {
|
|
3548
3610
|
__privateAdd(this, _e2);
|
|
3549
3611
|
__privateAdd(this, _t2);
|
|
3550
3612
|
var _a2, _b2, _c, _d;
|
|
3551
|
-
this._timeCreated = Date.now(), __privateSet(this, _e2, (_b2 = (_a2 = globalThis.document) == null ? void 0 : _a2.referrer) != null ? _b2 : ""), __privateSet(this, _t2, ((_d = (_c = globalThis.location) == null ? void 0 : _c.href) != null ? _d : globalThis.HermesInternal) ? "React Native Hermes" : ""), this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2026-01-
|
|
3613
|
+
this._timeCreated = Date.now(), __privateSet(this, _e2, (_b2 = (_a2 = globalThis.document) == null ? void 0 : _a2.referrer) != null ? _b2 : ""), __privateSet(this, _t2, ((_d = (_c = globalThis.location) == null ? void 0 : _c.href) != null ? _d : globalThis.HermesInternal) ? "React Native Hermes" : ""), this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2026-01-19T10:53:42.725Z" }, entry: "direct", environment: { age: Date.now() - this._timeCreated, dependencies: {}, originalUrl: __privateGet(this, _t2), referrer: __privateGet(this, _e2), userAgent: window.navigator.userAgent }, metadata: [], nav: [], network: [], url: __privateGet(this, _t2), stack: "", timestamp: (/* @__PURE__ */ new Date()).toISOString(), version: "dev-2026-01-19T10:53:42.725Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
3552
3614
|
}
|
|
3553
3615
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
3554
3616
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -3558,7 +3620,7 @@ class As {
|
|
|
3558
3620
|
try {
|
|
3559
3621
|
0;
|
|
3560
3622
|
const t2 = __spreadProps(__spreadValues({}, this._trackJSData), { message: e2 });
|
|
3561
|
-
yield
|
|
3623
|
+
yield xs({ method: "POST", url: this._url, data: JSON.stringify(t2), options: { contentType: "text/plain" } });
|
|
3562
3624
|
} catch (e3) {
|
|
3563
3625
|
console.error("[TalkJS] Failed when sending an error report. Error: ", e3);
|
|
3564
3626
|
}
|
|
@@ -3567,9 +3629,9 @@ class As {
|
|
|
3567
3629
|
}
|
|
3568
3630
|
_e2 = new WeakMap();
|
|
3569
3631
|
_t2 = new WeakMap();
|
|
3570
|
-
const
|
|
3632
|
+
const Is = { log: (e2) => Promise.resolve(), setData: (e2) => {
|
|
3571
3633
|
} };
|
|
3572
|
-
class
|
|
3634
|
+
class Ds {
|
|
3573
3635
|
constructor(e2, t2 = {}) {
|
|
3574
3636
|
this._onSubscription = t2, this._handlers = {};
|
|
3575
3637
|
for (const t3 in e2) Object.hasOwnProperty.call(e2, t3) && (this._handlers[t3] = []);
|
|
@@ -3614,7 +3676,7 @@ class ks {
|
|
|
3614
3676
|
return this.on(e2, t2), { unsubscribe: () => this.off(e2, t2) };
|
|
3615
3677
|
}
|
|
3616
3678
|
}
|
|
3617
|
-
class
|
|
3679
|
+
class Ss {
|
|
3618
3680
|
constructor(e2) {
|
|
3619
3681
|
this.handlers = e2, this.tokenResult = null, this.pendingToken = null;
|
|
3620
3682
|
}
|
|
@@ -3622,7 +3684,7 @@ class xs {
|
|
|
3622
3684
|
return __async(this, null, function* () {
|
|
3623
3685
|
if (this.tokenResult) return this.tokenResult;
|
|
3624
3686
|
if (this.pendingToken) return this.pendingToken.promise;
|
|
3625
|
-
const e2 =
|
|
3687
|
+
const e2 = a();
|
|
3626
3688
|
return this.pendingToken = e2, this.handlers.onNeedToken(), e2.promise;
|
|
3627
3689
|
});
|
|
3628
3690
|
}
|
|
@@ -3630,29 +3692,29 @@ class xs {
|
|
|
3630
3692
|
this.pendingToken && (this.pendingToken.resolve(e2), this.pendingToken = null), this.tokenResult = e2, this.handlers.onChange(e2);
|
|
3631
3693
|
}
|
|
3632
3694
|
refreshToken() {
|
|
3633
|
-
this.pendingToken || (this.pendingToken =
|
|
3695
|
+
this.pendingToken || (this.pendingToken = a(), this.handlers.onNeedToken());
|
|
3634
3696
|
}
|
|
3635
3697
|
invalidateAndRefresh() {
|
|
3636
3698
|
this.tokenResult = null, this.refreshToken();
|
|
3637
3699
|
}
|
|
3638
3700
|
}
|
|
3639
|
-
class
|
|
3701
|
+
class Ms {
|
|
3640
3702
|
constructor(e2, t2, s2, n2) {
|
|
3641
|
-
this.apiUrls = e2, this.appId = t2, this.userId = s2, this.signature = n2, this.inner = new
|
|
3703
|
+
this.apiUrls = e2, this.appId = t2, this.userId = s2, this.signature = n2, this.inner = new Ss({ onChange: (e3) => {
|
|
3642
3704
|
e3.ok ? this.eventEmitter.emit("tokenChanged", e3.value) : this.emitTokenRefreshFailed(e3.value);
|
|
3643
3705
|
}, onNeedToken: () => __async(this, null, function* () {
|
|
3644
|
-
if (this._usingBokens && !this.signature && !this._calledBokens && (yield new Promise((e3) => setTimeout(e3, 1))), this._usingBokens) yield this.sendBokenRequest().then((e3) => this.inner.setTokenResult(
|
|
3706
|
+
if (this._usingBokens && !this.signature && !this._calledBokens && (yield new Promise((e3) => setTimeout(e3, 1))), this._usingBokens) yield this.sendBokenRequest().then((e3) => this.inner.setTokenResult(o(e3))).catch((e3) => this.inner.setTokenResult(c(e3)));
|
|
3645
3707
|
else if (this.onNeedToken) this.onNeedToken();
|
|
3646
3708
|
else {
|
|
3647
|
-
const e3 =
|
|
3709
|
+
const e3 = u("Cannot refresh token, no `onNeedToken` provided.");
|
|
3648
3710
|
this.inner.setTokenResult(e3);
|
|
3649
3711
|
}
|
|
3650
|
-
}) }), this._usingBokens = true, this._calledBokens = false, this.onNeedToken = void 0, this.eventEmitter = new
|
|
3712
|
+
}) }), this._usingBokens = true, this._calledBokens = false, this.onNeedToken = void 0, this.eventEmitter = new Ds({ tokenChanged(e3) {
|
|
3651
3713
|
}, tokenRefreshFailed(e3) {
|
|
3652
3714
|
}, tokenAccepted(e3) {
|
|
3653
3715
|
} }), this.sessionExpiryWarningTimeoutId = void 0;
|
|
3654
3716
|
const r2 = "undefined" != typeof window && e2.restApiHttpUrl.includes("api.talkjs.com");
|
|
3655
|
-
this.errorTracker = r2 ? new
|
|
3717
|
+
this.errorTracker = r2 ? new Ts("970cd0be0fb74630b75c8451051299dc") : Is;
|
|
3656
3718
|
}
|
|
3657
3719
|
get usingBokens() {
|
|
3658
3720
|
return this._usingBokens;
|
|
@@ -3668,10 +3730,10 @@ class Ts {
|
|
|
3668
3730
|
if (this._calledBokens) throw new Error("[TalkJS] Cannot switch to JWT authentication once connected to TalkJS servers. To use JWTs, call `setToken` or set `onNeedToken` before triggering any requests or mounting any components. We recommend setting up authentication in your app's entry point (App.jsx, main.js, or similar) so it runs first.");
|
|
3669
3731
|
}
|
|
3670
3732
|
setToken(e2) {
|
|
3671
|
-
this.checkCanSetAuth(), setTimeout(() => this.checkJwt(e2), 200), this._usingBokens = false, this.inner.setTokenResult(
|
|
3733
|
+
this.checkCanSetAuth(), setTimeout(() => this.checkJwt(e2), 200), this._usingBokens = false, this.inner.setTokenResult(o(e2));
|
|
3672
3734
|
}
|
|
3673
3735
|
setTokenError(e2) {
|
|
3674
|
-
this._usingBokens = false, this.inner.setTokenResult(
|
|
3736
|
+
this._usingBokens = false, this.inner.setTokenResult(u(e2));
|
|
3675
3737
|
}
|
|
3676
3738
|
refreshToken() {
|
|
3677
3739
|
this.inner.refreshToken();
|
|
@@ -3727,7 +3789,7 @@ class Ts {
|
|
|
3727
3789
|
const e3 = function(e4) {
|
|
3728
3790
|
const t3 = e4.split(".");
|
|
3729
3791
|
if (3 !== t3.length) throw "Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";
|
|
3730
|
-
return { header:
|
|
3792
|
+
return { header: Fs(t3[0]), payload: Fs(t3[1]) };
|
|
3731
3793
|
}(s2);
|
|
3732
3794
|
n2 = e3.header, r2 = e3.payload;
|
|
3733
3795
|
} catch (e3) {
|
|
@@ -3762,16 +3824,16 @@ class Ts {
|
|
|
3762
3824
|
void 0 === n2 ? t2.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was missing.`) : "string" != typeof n2 ? t2.push(`Token payload must contain a \`sub\` claim set to your user ID (${this.userId}), but \`sub\` was ${typeof n2} instead of a string. Make sure you wrap the value in "".`) : n2 !== this.userId && t2.push(`Token payload must contain a \`sub\` claim set to your userId ID (${this.userId}), but \`sub\` was set to "${n2}" instead.`);
|
|
3763
3825
|
const r2 = e2.tokenType;
|
|
3764
3826
|
void 0 === r2 ? t2.push('Token payload must contain a `"tokenType": "user"` claim, but no `tokenType` was specified.') : "string" != typeof r2 ? t2.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was ${typeof r2} instead of a string. Make sure you wrap the value in "".`) : "user" !== r2 && t2.push(`Token payload must contain a \`"tokenType": "user"\` claim, but \`tokenType\` was set to "${r2}" instead.`);
|
|
3765
|
-
const
|
|
3766
|
-
void 0 ===
|
|
3767
|
-
const
|
|
3768
|
-
return void 0 ===
|
|
3827
|
+
const a2 = e2.exp;
|
|
3828
|
+
void 0 === a2 || ("number" != typeof a2 ? t2.push(`Token payload contains an \`exp\` claim, but \`exp\` was ${typeof r2} instead of a number. If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Don't wrap the value in "".`) : a2 < 1e9 ? t2.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${a2}, representing ${new Date(1e3 * a2).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01.`) : a2 > 1e11 ? t2.push(`Token payload contains an \`exp\` claim, but \`exp\` is very small (${a2}, representing ${new Date(1e3 * a2).toLocaleDateString()}). If set, \`exp\` should be the expiry date as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`) : a2 < (/* @__PURE__ */ new Date()).getTime() / 1e3 && t2.push(`Token payload contains an \`exp\` claim, but \`exp\` (${a2}, representing ${new Date(1e3 * a2).toLocaleDateString()}) appears to be in the past, meaning the token will be rejected. This error can also happen if your device's clock is set incorrectly, in which case the token will still work.`));
|
|
3829
|
+
const i2 = e2.nbf;
|
|
3830
|
+
return void 0 === i2 || ("number" != typeof i2 ? t2.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` was ${typeof r2} instead of a number. If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01.`) : i2 > 1e11 && t2.push(`Token payload contains a \`nbf\` (not-before) claim, but \`nbf\` is very large (${i2}, representing ${new Date(1e3 * i2).toLocaleDateString()}). If set, \`nbf\` should be the date when the JWT becomes valid, as a number of seconds since 1970-01-01. Double-check that you are using seconds and not milliseconds or nanoseconds.`)), t2;
|
|
3769
3831
|
}
|
|
3770
3832
|
sendBokenRequest() {
|
|
3771
3833
|
return __async(this, null, function* () {
|
|
3772
3834
|
this._calledBokens = true;
|
|
3773
3835
|
let e2 = 0;
|
|
3774
|
-
const t2 = this.apiUrls.getBokensUrl(this.appId, this.userId, this.signature), s2 = yield
|
|
3836
|
+
const t2 = this.apiUrls.getBokensUrl(this.appId, this.userId, this.signature), s2 = yield xs({ method: "GET", url: t2, attempts: 1e4, shouldRetry: (t3) => {
|
|
3775
3837
|
if (t3 instanceof Error) return true;
|
|
3776
3838
|
if (401 === t3.status) throw "Check that you provided a valid signature.";
|
|
3777
3839
|
if (404 === t3.status) throw "Check that you specified the correct App ID.";
|
|
@@ -3784,7 +3846,7 @@ class Ts {
|
|
|
3784
3846
|
});
|
|
3785
3847
|
}
|
|
3786
3848
|
}
|
|
3787
|
-
function
|
|
3849
|
+
function Fs(e2) {
|
|
3788
3850
|
try {
|
|
3789
3851
|
const t2 = e2.replace(/-/g, "+").replace(/_/g, "/"), s2 = decodeURIComponent(atob(t2).split("").map((e3) => "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
3790
3852
|
return JSON.parse(s2);
|
|
@@ -3792,14 +3854,14 @@ function Is(e2) {
|
|
|
3792
3854
|
throw `Could not base64-decode and JSON-parse token section: ${e2}. Check that you base-64 encoded the section correctly.`;
|
|
3793
3855
|
}
|
|
3794
3856
|
}
|
|
3795
|
-
const
|
|
3857
|
+
const Bs = new class {
|
|
3796
3858
|
constructor() {
|
|
3797
3859
|
this.registry = {};
|
|
3798
3860
|
}
|
|
3799
3861
|
getOrCreate(e2) {
|
|
3800
3862
|
const t2 = this.key(e2), s2 = this.registry[t2];
|
|
3801
3863
|
if (s2) return s2;
|
|
3802
|
-
const n2 = new
|
|
3864
|
+
const n2 = new Ns(e2);
|
|
3803
3865
|
return this.registry[t2] = n2, n2;
|
|
3804
3866
|
}
|
|
3805
3867
|
deregister(e2, t2) {
|
|
@@ -3810,11 +3872,11 @@ const Ds = new class {
|
|
|
3810
3872
|
return `${e2}:${t2}`;
|
|
3811
3873
|
}
|
|
3812
3874
|
}();
|
|
3813
|
-
function
|
|
3875
|
+
function Rs(e2) {
|
|
3814
3876
|
if (!e2) throw new Error("[TalkJS] Must provide an options object to `getTalkSession`");
|
|
3815
|
-
return e2.forceCreateNew ? new
|
|
3877
|
+
return e2.forceCreateNew ? new Ns(e2) : Bs.getOrCreate(e2);
|
|
3816
3878
|
}
|
|
3817
|
-
class
|
|
3879
|
+
class Ns {
|
|
3818
3880
|
constructor(e2) {
|
|
3819
3881
|
this._onNeedToken = void 0, function(e3) {
|
|
3820
3882
|
function t3(e4, t4) {
|
|
@@ -3824,7 +3886,7 @@ class Ms {
|
|
|
3824
3886
|
void 0 !== e3.tokenFetcher && t3("function" == typeof e3.tokenFetcher, "The `tokenFetcher` property of the `getTalkSession` options must be a function.");
|
|
3825
3887
|
}(e2);
|
|
3826
3888
|
const { appId: t2, userId: s2, token: n2, tokenFetcher: r2, signature: i2 } = e2;
|
|
3827
|
-
this._appId = t2, this._apiUrls = e2.apiUrls ? new
|
|
3889
|
+
this._appId = t2, this._apiUrls = e2.apiUrls ? new ks(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : ks.fromHost(e2.host), this._authProvider = new Ms(this._apiUrls, t2, s2, i2), n2 && this._authProvider.setToken(n2), r2 && this._authProvider.setOnNeedToken(() => __async(this, null, function* () {
|
|
3828
3890
|
try {
|
|
3829
3891
|
const e3 = yield r2();
|
|
3830
3892
|
this._authProvider.setToken(e3);
|
|
@@ -3832,12 +3894,12 @@ class Ms {
|
|
|
3832
3894
|
this._authProvider.setTokenError(`${e3}`);
|
|
3833
3895
|
}
|
|
3834
3896
|
}));
|
|
3835
|
-
const
|
|
3836
|
-
this._realtimeClient = new
|
|
3897
|
+
const o2 = Math.random().toString().split(".")[1];
|
|
3898
|
+
this._realtimeClient = new Cs(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.6.2", o2, e2.clientBuild), s2, this._authProvider), this.currentUser = this.user(s2), this._terminationReason = a(), this._terminationReason.promise.then((e3) => {
|
|
3837
3899
|
console.error(`[TalkJS] ${e3}`);
|
|
3838
3900
|
}), function(e3, t3) {
|
|
3839
3901
|
return __async(this, null, function* () {
|
|
3840
|
-
return
|
|
3902
|
+
return xs({ method: "GET", url: `${t3}/${e3}` }).then((e4) => __async(this, null, function* () {
|
|
3841
3903
|
return 200 === e4.status || 404 !== e4.status && (console.warn(`[TalkJS] Received unexpected ${e4.status} status code when validating app ID. Assuming that the app ID is valid.`), true);
|
|
3842
3904
|
})).catch((e4) => {
|
|
3843
3905
|
if ("string" != typeof e4 && "status" in e4) {
|
|
@@ -3869,7 +3931,7 @@ class Ms {
|
|
|
3869
3931
|
});
|
|
3870
3932
|
}
|
|
3871
3933
|
onError(e2) {
|
|
3872
|
-
const t2 =
|
|
3934
|
+
const t2 = a();
|
|
3873
3935
|
return Promise.race([t2.promise, this._terminationReason.promise]).then((t3) => {
|
|
3874
3936
|
"UNSUBSCRIBED" !== t3 && e2(t3);
|
|
3875
3937
|
}), { unsubscribe: () => t2.resolve("UNSUBSCRIBED") };
|
|
@@ -3877,42 +3939,42 @@ class Ms {
|
|
|
3877
3939
|
user(e2) {
|
|
3878
3940
|
if ("string" != typeof e2) throw new Error(`Creating UserRef failed because ID "${e2}" is not a string`);
|
|
3879
3941
|
if ("" === e2) throw new Error(`Creating UserRef failed because ID "${e2}" is an empty string`);
|
|
3880
|
-
return
|
|
3942
|
+
return this._realtimeClient.refs.user(e2);
|
|
3881
3943
|
}
|
|
3882
3944
|
conversation(e2) {
|
|
3883
3945
|
if ("string" != typeof e2) throw new Error(`Creating ConversationRef failed because ID "${e2}" is not a string`);
|
|
3884
3946
|
if ("" === e2) throw new Error(`Creating ConversationRef failed because ID "${e2}" is an empty string`);
|
|
3885
|
-
return
|
|
3947
|
+
return this._realtimeClient.refs.conversation(e2);
|
|
3886
3948
|
}
|
|
3887
3949
|
subscribeConversations(e2) {
|
|
3888
3950
|
return this._realtimeClient.subscribe(["me", "conversations"], e2);
|
|
3889
3951
|
}
|
|
3890
3952
|
terminate(e2) {
|
|
3891
|
-
|
|
3953
|
+
Bs.deregister(this._appId, this.currentUser.id), this._terminationReason.resolve(e2), this._realtimeClient.destroy();
|
|
3892
3954
|
}
|
|
3893
3955
|
_isConnected() {
|
|
3894
3956
|
return this._realtimeClient.isConnected();
|
|
3895
3957
|
}
|
|
3896
3958
|
uploadFile(e2, t2) {
|
|
3897
|
-
return
|
|
3959
|
+
return _s(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, t2);
|
|
3898
3960
|
}
|
|
3899
3961
|
uploadImage(e2, t2) {
|
|
3900
|
-
return
|
|
3962
|
+
return _s(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "image" }, t2));
|
|
3901
3963
|
}
|
|
3902
3964
|
uploadVideo(e2, t2) {
|
|
3903
|
-
return
|
|
3965
|
+
return _s(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "video" }, t2));
|
|
3904
3966
|
}
|
|
3905
3967
|
uploadAudio(e2, t2) {
|
|
3906
|
-
return
|
|
3968
|
+
return _s(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "audio" }, t2));
|
|
3907
3969
|
}
|
|
3908
3970
|
uploadVoice(e2, t2) {
|
|
3909
|
-
return
|
|
3971
|
+
return _s(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "voice" }, t2));
|
|
3910
3972
|
}
|
|
3911
3973
|
}
|
|
3912
|
-
function
|
|
3913
|
-
return __async(this, arguments, function* (e2, t2, s2, { subtype: n2, filename: r2, width:
|
|
3974
|
+
function _s(_0, _1, _2, _3) {
|
|
3975
|
+
return __async(this, arguments, function* (e2, t2, s2, { subtype: n2, filename: r2, width: a2, height: i2, duration: o2 }) {
|
|
3914
3976
|
const u2 = new FormData();
|
|
3915
|
-
return u2.set("file", s2, r2), void 0 !== n2 && u2.set("subtype", n2), void 0 !==
|
|
3977
|
+
return u2.set("file", s2, r2), void 0 !== n2 && u2.set("subtype", n2), void 0 !== a2 && u2.set("width", a2.toString()), void 0 !== i2 && u2.set("height", i2.toString()), void 0 !== o2 && u2.set("duration", o2.toString()), xs({ method: "POST", url: e2, data: u2, authProvider: t2, errorTracker: t2.errorTracker }).then((e3) => e3.json()).then((e3) => e3.fileToken).catch((e3) => __async(this, null, function* () {
|
|
3916
3978
|
if (e3 instanceof Response) {
|
|
3917
3979
|
const t3 = yield e3.json(), s3 = `Unexpected response when uploading file, status code ${e3.status} ${t3.errorCode}, ${t3.reasons}`;
|
|
3918
3980
|
throw new Error(s3);
|
|
@@ -3922,7 +3984,7 @@ function Fs(_0, _1, _2, _3) {
|
|
|
3922
3984
|
});
|
|
3923
3985
|
}
|
|
3924
3986
|
export {
|
|
3925
|
-
|
|
3987
|
+
Rs as getTalkSession,
|
|
3926
3988
|
f as registerPolyfills
|
|
3927
3989
|
};
|
|
3928
3990
|
//# sourceMappingURL=talkSession.js.map
|