@talkjs/core 1.1.0 → 1.1.1
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 +5 -0
- package/dist/talkSession.cjs +1 -1
- package/dist/talkSession.d.ts +17 -1
- package/dist/talkSession.js +554 -466
- package/package.json +1 -1
package/dist/talkSession.js
CHANGED
|
@@ -130,70 +130,54 @@ function f({ WebSocket: e2 }) {
|
|
|
130
130
|
}
|
|
131
131
|
class g {
|
|
132
132
|
constructor(e2, t2) {
|
|
133
|
-
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
this.realtimeUrl = e2, this.handlers = t2, this.socket = null, this.stateMachine = new u("ReconnectingSocket", ["STOPPED", "CONNECTING", "READY", "DISCONNECTED", "TERMINATED"], { startWs: { from: ["STOPPED", "DISCONNECTED"], to: "CONNECTING", afterTransition: () => {
|
|
134
|
+
const e3 = new (function() {
|
|
135
|
+
if (p) return p;
|
|
136
|
+
if (globalThis.WebSocket) return globalThis.WebSocket;
|
|
137
|
+
throw new Error("Missing WebSocket implementation");
|
|
138
|
+
}())(this.realtimeUrl + "&talkjs-time=" + Date.now());
|
|
139
|
+
this.socket = e3, e3.addEventListener("open", () => {
|
|
140
|
+
this.socket === e3 && this.stateMachine.transition("onOpen");
|
|
141
|
+
}), e3.addEventListener("close", () => {
|
|
142
|
+
this.socket === e3 && this.stateMachine.transition("onClose");
|
|
143
|
+
}), e3.addEventListener("message", (t3) => {
|
|
144
|
+
this.socket === e3 && this.handlers.onMessage(t3);
|
|
136
145
|
});
|
|
137
|
-
} },
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
146
|
+
} }, onOpen: { from: ["CONNECTING"], to: "READY", afterTransition: () => {
|
|
147
|
+
this.handlers.onOpen();
|
|
148
|
+
} }, onClose: { from: ["CONNECTING", "READY"], to: "DISCONNECTED", afterTransition: (_0) => __async(this, [_0], function* ({ from: e3 }) {
|
|
149
|
+
"READY" === e3 && this.handlers.onClose(), this.socket = null;
|
|
150
|
+
const t3 = r(1e4, 0.5);
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
"DISCONNECTED" === this.stateMachine.state && this.stateMachine.transition("startWs");
|
|
153
|
+
}, t3);
|
|
154
|
+
}) }, stopWs: { from: ["CONNECTING", "DISCONNECTED", "READY"], to: "STOPPED", afterTransition: ({ from: e3 }) => {
|
|
155
|
+
"READY" === e3 && this.handlers.onClose();
|
|
156
|
+
const t3 = this.socket;
|
|
157
|
+
this.socket = null, t3 == null ? void 0 : t3.close(1e3);
|
|
142
158
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
const e3 = this.socket;
|
|
160
|
+
this.socket = null, e3 == null ? void 0 : e3.close(1e3);
|
|
145
161
|
} } });
|
|
146
162
|
}
|
|
147
163
|
stopWs() {
|
|
148
|
-
|
|
164
|
+
this.stateMachine.transition("stopWs");
|
|
149
165
|
}
|
|
150
166
|
startWs() {
|
|
151
|
-
this.stateMachine.
|
|
152
|
-
}
|
|
153
|
-
createWebSocket() {
|
|
154
|
-
var _a2;
|
|
155
|
-
(_a2 = this == null ? void 0 : this.socket) == null ? void 0 : _a2.close(1e3);
|
|
156
|
-
const e2 = new (function() {
|
|
157
|
-
if (p) return p;
|
|
158
|
-
if (globalThis.WebSocket) return globalThis.WebSocket;
|
|
159
|
-
throw new Error("Missing WebSocket implementation");
|
|
160
|
-
}())(this.realtimeUrl);
|
|
161
|
-
this.socket = e2;
|
|
162
|
-
const t2 = () => this.stateMachine.transition("ready");
|
|
163
|
-
e2.addEventListener("open", t2), e2.addEventListener("message", this.handlers.onMessage);
|
|
164
|
-
const s2 = () => {
|
|
165
|
-
e2.removeEventListener("open", t2), e2.removeEventListener("close", s2), e2.removeEventListener("message", this.handlers.onMessage), "TERMINATED" !== this.stateMachine.state && "STOPPED" !== this.stateMachine.state && this.stateMachine.transition("queueAutoReconnect");
|
|
166
|
-
};
|
|
167
|
-
e2.addEventListener("close", s2);
|
|
167
|
+
this.stateMachine.transition("startWs");
|
|
168
168
|
}
|
|
169
169
|
send(e2) {
|
|
170
170
|
return "READY" === this.stateMachine.state ? (this.socket.send(e2), c(void 0)) : l("SOCKET_NOT_READY");
|
|
171
171
|
}
|
|
172
172
|
terminate() {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
this.socket.close(1e3);
|
|
176
|
-
const e2 = new Event("close"), t2 = Object.assign(e2, { code: 1e3, reason: "", wasClean: true });
|
|
177
|
-
this.socket.dispatchEvent(t2);
|
|
178
|
-
} else this.socket.close(1e3);
|
|
173
|
+
const e2 = this.socket;
|
|
174
|
+
this.stateMachine.canTransition("onClose") && this.stateMachine.transition("onClose"), e2 && ("terminate" in e2 ? e2.terminate() : e2.close(1e3));
|
|
179
175
|
}
|
|
180
176
|
destroy() {
|
|
181
177
|
this.stateMachine.transition("destroy");
|
|
182
178
|
}
|
|
183
179
|
}
|
|
184
|
-
|
|
185
|
-
constructor() {
|
|
186
|
-
this.initialDelayMs = 200 + 200 * Math.random(), this.exponentialFactor = 1.2, this.maxDelayMs = 1e4, this.currentDelayMs = this.initialDelayMs;
|
|
187
|
-
}
|
|
188
|
-
request(e2) {
|
|
189
|
-
const t2 = r(this.currentDelayMs, 0.05);
|
|
190
|
-
n(this.currentDelayMs).then(() => e2()), this.currentDelayMs = Math.min(t2 * this.exponentialFactor, this.maxDelayMs);
|
|
191
|
-
}
|
|
192
|
-
resetDelay() {
|
|
193
|
-
this.currentDelayMs = this.initialDelayMs;
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
class v {
|
|
180
|
+
class m {
|
|
197
181
|
constructor(e2, t2) {
|
|
198
182
|
this.handlers = t2, this.socket = new g(e2, { onOpen: () => this.handlers.onOpen(), onClose: () => this.handlers.onClose(), onMessage: (e3) => this.onWebSocketMessage(e3) });
|
|
199
183
|
}
|
|
@@ -232,7 +216,7 @@ class v {
|
|
|
232
216
|
else this.handlers.onAuthExpired();
|
|
233
217
|
}
|
|
234
218
|
}
|
|
235
|
-
class
|
|
219
|
+
class v {
|
|
236
220
|
constructor(e2) {
|
|
237
221
|
this.delayMs = e2, this.timeout = void 0;
|
|
238
222
|
}
|
|
@@ -245,7 +229,7 @@ class b {
|
|
|
245
229
|
void 0 !== this.timeout && (clearTimeout(this.timeout), this.timeout = void 0);
|
|
246
230
|
}
|
|
247
231
|
}
|
|
248
|
-
class
|
|
232
|
+
class b {
|
|
249
233
|
constructor() {
|
|
250
234
|
this.i = -1;
|
|
251
235
|
}
|
|
@@ -256,9 +240,9 @@ class y {
|
|
|
256
240
|
this.i = -1;
|
|
257
241
|
}
|
|
258
242
|
}
|
|
259
|
-
class
|
|
243
|
+
class y {
|
|
260
244
|
constructor(e2, t2) {
|
|
261
|
-
this.handlers = t2, this.seqCounter = new
|
|
245
|
+
this.handlers = t2, this.seqCounter = new b(), this.responseHandlers = {}, this.heartbeats = new w(this), this.socket = new m(e2, { onUpstreamRestarting: () => {
|
|
262
246
|
this.heartbeats.serverActive(), this.handlers.onUpstreamRestarting();
|
|
263
247
|
}, onOpen: () => {
|
|
264
248
|
this.heartbeats.clientActive(), this.heartbeats.serverActive(), this.handlers.onReady();
|
|
@@ -301,9 +285,9 @@ class w {
|
|
|
301
285
|
this.socket.terminate();
|
|
302
286
|
}
|
|
303
287
|
}
|
|
304
|
-
class
|
|
288
|
+
class w {
|
|
305
289
|
constructor(e2) {
|
|
306
|
-
this.connection = e2, this.clientInactivityTimer = new
|
|
290
|
+
this.connection = e2, this.clientInactivityTimer = new v(25e3), this.serverInactivityTimer = new v(1e4), this.serverTimeoutTimer = new v(5e3);
|
|
307
291
|
}
|
|
308
292
|
clientActive() {
|
|
309
293
|
this.clientInactivityTimer.schedule(() => {
|
|
@@ -325,7 +309,7 @@ class A {
|
|
|
325
309
|
});
|
|
326
310
|
}
|
|
327
311
|
}
|
|
328
|
-
class
|
|
312
|
+
class A {
|
|
329
313
|
constructor(e2, t2, s2) {
|
|
330
314
|
this.authProvider = t2, this.handlers = s2, this.stateMachine = new u("AuthenticatedConnection", ["WAITING_FOR_WS", "LOGGING_IN", "RENEWING_SESSION", "READY", "TERMINATED"], { logIn: { from: ["WAITING_FOR_WS"], to: "LOGGING_IN", afterTransition: () => __async(this, null, function* () {
|
|
331
315
|
yield this.renewSession();
|
|
@@ -343,7 +327,7 @@ class C {
|
|
|
343
327
|
"READY" !== e3 && "RENEWING_SESSION" !== e3 || this.handlers.onNotReady(), this.authProvider.clearScheduledRefresh();
|
|
344
328
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
345
329
|
this.authProvider.clearScheduledRefresh(), this.connection.destroy();
|
|
346
|
-
} } }), this.connection = new
|
|
330
|
+
} } }), this.connection = new y(e2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onReady: () => this.stateMachine.transition("logIn"), onNotReady: () => {
|
|
347
331
|
this.stateMachine.transition("wsDisconnected");
|
|
348
332
|
}, onAuthExpired: () => {
|
|
349
333
|
this.stateMachine.transition("authExpired");
|
|
@@ -388,7 +372,7 @@ class C {
|
|
|
388
372
|
});
|
|
389
373
|
}
|
|
390
374
|
}
|
|
391
|
-
class
|
|
375
|
+
class C {
|
|
392
376
|
constructor(e2, t2, s2) {
|
|
393
377
|
this.handlers = s2, this.stateMachine = new u("StopStartConnection", ["STOPPED", "WAITING_FOR_WS", "READY", "TERMINATED"], { unexpectedDisconnect: { from: ["READY"], to: "WAITING_FOR_WS", afterTransition: () => {
|
|
394
378
|
this.inactivityTimer.stop(), this.handlers.onNotReady();
|
|
@@ -402,7 +386,7 @@ class E {
|
|
|
402
386
|
}), this.handlers.onReady();
|
|
403
387
|
} }, destroy: { from: "ANY", to: "TERMINATED", afterTransition: () => {
|
|
404
388
|
this.inactivityTimer.stop(), this.connection.destroy();
|
|
405
|
-
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new
|
|
389
|
+
} } }), this.pendingCalls = 0, this.activeSubscriptions = 0, this.inactivityTimer = new v(3e3), this.connection = new A(e2, t2, { onUpstreamRestarting: () => {
|
|
406
390
|
this.handlers.onUpstreamRestarting();
|
|
407
391
|
}, onReady: () => {
|
|
408
392
|
this.stateMachine.transition("ready");
|
|
@@ -434,7 +418,7 @@ class E {
|
|
|
434
418
|
return "READY" === this.stateMachine.state;
|
|
435
419
|
}
|
|
436
420
|
}
|
|
437
|
-
class
|
|
421
|
+
class E {
|
|
438
422
|
constructor(e2, t2, s2) {
|
|
439
423
|
this.handlers = s2, this.stateMachine = new u("QueuedConnection", ["NOT_READY", "PROCESSING_QUEUE", "READY", "TERMINATED"], { processQueue: { from: ["NOT_READY"], to: "PROCESSING_QUEUE", afterTransition: () => {
|
|
440
424
|
this.sendQueuedCalls();
|
|
@@ -449,7 +433,7 @@ class k {
|
|
|
449
433
|
e3 == null ? void 0 : e3.clientErr("SESSION_DESTROYED");
|
|
450
434
|
}
|
|
451
435
|
this.connection.destroy();
|
|
452
|
-
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new
|
|
436
|
+
} } }), this.subscribeQueue = {}, this.callQueue = [], this.connection = new C(e2, t2, { onUpstreamRestarting: () => {
|
|
453
437
|
this.handlers.onUpstreamRestarting();
|
|
454
438
|
}, onReady: () => {
|
|
455
439
|
this.stateMachine.transition("processQueue");
|
|
@@ -498,10 +482,10 @@ class k {
|
|
|
498
482
|
return "READY" === this.stateMachine.state || "PROCESSING_QUEUE" === this.stateMachine.state;
|
|
499
483
|
}
|
|
500
484
|
}
|
|
501
|
-
const
|
|
502
|
-
class
|
|
485
|
+
const k = "undefined" != typeof window ? (_a = window.queueMicrotask) != null ? _a : setTimeout : setTimeout;
|
|
486
|
+
class x {
|
|
503
487
|
constructor(e2, t2) {
|
|
504
|
-
this.clearPendingBatch = e2, this.sendCalls = t2, this.sent = false,
|
|
488
|
+
this.clearPendingBatch = e2, this.sendCalls = t2, this.sent = false, k(() => this.send());
|
|
505
489
|
}
|
|
506
490
|
send() {
|
|
507
491
|
this.sent || (this.sent = true, this.clearPendingBatch(), this.sendCalls());
|
|
@@ -510,14 +494,14 @@ class S {
|
|
|
510
494
|
this.sent = true;
|
|
511
495
|
}
|
|
512
496
|
}
|
|
513
|
-
class
|
|
497
|
+
class S extends x {
|
|
514
498
|
constructor(e2, t2) {
|
|
515
499
|
super(t2, () => {
|
|
516
500
|
this.sendSubscribe(), this.sendGet();
|
|
517
501
|
}), this.connection = e2, this.getCalls = [], this.subscribeCalls = [];
|
|
518
502
|
}
|
|
519
503
|
canPush(e2, t2) {
|
|
520
|
-
return
|
|
504
|
+
return S.isCorrectBatchTypeFor(e2, t2);
|
|
521
505
|
}
|
|
522
506
|
static isCorrectBatchTypeFor(e2, t2) {
|
|
523
507
|
return s(t2, ["users", "*"]) && ("GET" === e2 || "SUBSCRIBE" === e2);
|
|
@@ -543,12 +527,12 @@ class T extends S {
|
|
|
543
527
|
this.connection.call("SUBSCRIBE", ["users"], { ids: e2 }).then((e3) => this.subscribeCalls.forEach((t2) => t2.deferred.resolve(e3)));
|
|
544
528
|
}
|
|
545
529
|
}
|
|
546
|
-
class
|
|
530
|
+
class T extends x {
|
|
547
531
|
constructor(e2, t2, s2) {
|
|
548
532
|
super(s2, () => this.sendMutate()), this.conversationId = e2, this.connection = t2, this.calls = [];
|
|
549
533
|
}
|
|
550
534
|
canPush(e2, t2) {
|
|
551
|
-
return !!
|
|
535
|
+
return !!T.isCorrectBatchTypeFor(e2, t2) && t2[1] === this.conversationId;
|
|
552
536
|
}
|
|
553
537
|
static isCorrectBatchTypeFor(e2, t2) {
|
|
554
538
|
return s(t2, ["conversations", "*", "participants", "*"]) && ("PUT" === e2 || "POST" === e2 || "PATCH" === e2);
|
|
@@ -569,9 +553,9 @@ class D extends S {
|
|
|
569
553
|
});
|
|
570
554
|
}
|
|
571
555
|
}
|
|
572
|
-
class
|
|
556
|
+
class D {
|
|
573
557
|
constructor(e2, t2, s2) {
|
|
574
|
-
this.pendingBatch = null, this.connection = new
|
|
558
|
+
this.pendingBatch = null, this.connection = new E(e2, t2, s2);
|
|
575
559
|
}
|
|
576
560
|
call(e2, t2, s2) {
|
|
577
561
|
return __async(this, null, function* () {
|
|
@@ -590,18 +574,18 @@ class I {
|
|
|
590
574
|
return this.connection.isConnected();
|
|
591
575
|
}
|
|
592
576
|
createEmptyBatchFor(e2, t2) {
|
|
593
|
-
if (
|
|
594
|
-
if (
|
|
577
|
+
if (S.isCorrectBatchTypeFor(e2, t2)) return new S(this.connection, () => this.pendingBatch = null);
|
|
578
|
+
if (T.isCorrectBatchTypeFor(e2, t2)) {
|
|
595
579
|
const e3 = t2[1];
|
|
596
|
-
return new
|
|
580
|
+
return new T(e3, this.connection, () => this.pendingBatch = null);
|
|
597
581
|
}
|
|
598
582
|
return null;
|
|
599
583
|
}
|
|
600
584
|
}
|
|
601
|
-
const
|
|
602
|
-
class
|
|
585
|
+
const I = { 200: "RESOLVE", 400: "RESOLVE", 401: "RETRY", 402: "RESOLVE", 403: "RESOLVE", 404: "RESOLVE", 405: "RESOLVE", 409: "RESOLVE", 429: "DELAY", 500: "DELAY" };
|
|
586
|
+
class F {
|
|
603
587
|
constructor(e2, t2, s2) {
|
|
604
|
-
this.throttler = new
|
|
588
|
+
this.throttler = new B(), this.alive = true, this.connection = new D(e2, t2, s2);
|
|
605
589
|
}
|
|
606
590
|
call(e2, t2, s2) {
|
|
607
591
|
return __async(this, null, function* () {
|
|
@@ -610,7 +594,7 @@ class B {
|
|
|
610
594
|
const r2 = yield this.connection.call(e2, t2, s2);
|
|
611
595
|
if ((r2.ok || "client" !== r2.where || "SOCKET_NOT_READY" !== r2.value) && (r2.ok || "server" !== r2.where || 500 !== r2.value.status) || n2++, 10 === n2) return r2;
|
|
612
596
|
if (r2.ok || "client" !== r2.where) {
|
|
613
|
-
const e3 = r2.value, t3 = e3.status, s3 =
|
|
597
|
+
const e3 = r2.value, t3 = e3.status, s3 = I[t3];
|
|
614
598
|
if ("RESOLVE" === s3) return this.throttler.resetDelay(), r2;
|
|
615
599
|
if ("RETRY" === s3) continue;
|
|
616
600
|
if ("DELAY" === s3) {
|
|
@@ -632,7 +616,7 @@ class B {
|
|
|
632
616
|
return this.connection.isConnected();
|
|
633
617
|
}
|
|
634
618
|
}
|
|
635
|
-
class
|
|
619
|
+
class B {
|
|
636
620
|
constructor() {
|
|
637
621
|
this.initialDelayMs = 200, this.exponentialFactor = 1.2, this.maxDelayMs = 3e4, this.currentDelayMs = this.initialDelayMs, this.lastCall = 0;
|
|
638
622
|
}
|
|
@@ -647,21 +631,21 @@ class M {
|
|
|
647
631
|
this.currentDelayMs = this.initialDelayMs;
|
|
648
632
|
}
|
|
649
633
|
}
|
|
650
|
-
function
|
|
634
|
+
function M(e2) {
|
|
651
635
|
return e2.map((e3) => encodeURIComponent(e3)).join();
|
|
652
636
|
}
|
|
653
|
-
class
|
|
637
|
+
class R {
|
|
654
638
|
constructor() {
|
|
655
639
|
this.paths = {};
|
|
656
640
|
}
|
|
657
641
|
add(e2) {
|
|
658
|
-
this.paths[
|
|
642
|
+
this.paths[M(e2)] = e2;
|
|
659
643
|
}
|
|
660
644
|
delete(e2) {
|
|
661
|
-
delete this.paths[
|
|
645
|
+
delete this.paths[M(e2)];
|
|
662
646
|
}
|
|
663
647
|
has(e2) {
|
|
664
|
-
return Object.hasOwnProperty.call(this.paths,
|
|
648
|
+
return Object.hasOwnProperty.call(this.paths, M(e2));
|
|
665
649
|
}
|
|
666
650
|
clear() {
|
|
667
651
|
this.paths = {};
|
|
@@ -670,9 +654,9 @@ class N {
|
|
|
670
654
|
Object.values(this.paths).forEach((t2) => e2(t2));
|
|
671
655
|
}
|
|
672
656
|
}
|
|
673
|
-
class
|
|
657
|
+
class N {
|
|
674
658
|
constructor(e2, t2, s2) {
|
|
675
|
-
this.handlers = s2, this.targetSubscriptions = new
|
|
659
|
+
this.handlers = s2, this.targetSubscriptions = new R(), this.connection = new F(e2, t2, { onUpstreamRestarting: () => this.handlers.onUpstreamRestarting(), onSubscriptionsLost: () => {
|
|
676
660
|
this.targetSubscriptions.forEach((e3) => {
|
|
677
661
|
this.resubscribe(e3);
|
|
678
662
|
}), this.handlers.onResubscribeSent();
|
|
@@ -706,10 +690,10 @@ class _ {
|
|
|
706
690
|
return this.connection.isConnected();
|
|
707
691
|
}
|
|
708
692
|
}
|
|
709
|
-
function
|
|
693
|
+
function P(e2, t2) {
|
|
710
694
|
return void 0 === t2 ? e2 : t2;
|
|
711
695
|
}
|
|
712
|
-
function
|
|
696
|
+
function _(e2, t2) {
|
|
713
697
|
if (void 0 === t2) return e2;
|
|
714
698
|
if (null === t2) return {};
|
|
715
699
|
const s2 = __spreadValues({}, e2);
|
|
@@ -719,25 +703,25 @@ function P(e2, t2) {
|
|
|
719
703
|
}
|
|
720
704
|
return s2;
|
|
721
705
|
}
|
|
722
|
-
function
|
|
706
|
+
function O(e2, t2) {
|
|
723
707
|
if (e2 === t2) return true;
|
|
724
708
|
if (!e2 || !t2) return false;
|
|
725
709
|
if ("object" != typeof e2 || "object" != typeof t2) return false;
|
|
726
710
|
if (e2.constructor !== t2.constructor) return false;
|
|
727
711
|
if (Array.isArray(e2) && Array.isArray(t2)) {
|
|
728
712
|
if (e2.length !== t2.length) return false;
|
|
729
|
-
for (let s2 = 0; s2 < e2.length; s2++) if (!
|
|
713
|
+
for (let s2 = 0; s2 < e2.length; s2++) if (!O(e2[s2], t2[s2])) return false;
|
|
730
714
|
} else {
|
|
731
715
|
const s2 = Object.keys(e2);
|
|
732
716
|
if (s2.length !== Object.keys(t2).length) return false;
|
|
733
717
|
for (const n2 of s2) {
|
|
734
718
|
if (!Object.hasOwnProperty.call(t2, n2)) return false;
|
|
735
|
-
if (!
|
|
719
|
+
if (!O(e2[n2], t2[n2])) return false;
|
|
736
720
|
}
|
|
737
721
|
}
|
|
738
722
|
return true;
|
|
739
723
|
}
|
|
740
|
-
class
|
|
724
|
+
class U {
|
|
741
725
|
constructor() {
|
|
742
726
|
this.prev = Promise.resolve();
|
|
743
727
|
}
|
|
@@ -748,69 +732,118 @@ class j {
|
|
|
748
732
|
});
|
|
749
733
|
}
|
|
750
734
|
}
|
|
751
|
-
class
|
|
735
|
+
class j {
|
|
736
|
+
constructor(e2) {
|
|
737
|
+
this.initialised = false, this.getPointer = void 0, this.pendingStates = [e2], e2.resultPromise.then(() => this.initialised = true);
|
|
738
|
+
}
|
|
739
|
+
get pendingPointer() {
|
|
740
|
+
if (0 !== this.pendingStates.length) return this.pendingStates[this.pendingStates.length - 1];
|
|
741
|
+
}
|
|
742
|
+
get mostRecentState() {
|
|
743
|
+
var _a2;
|
|
744
|
+
return (_a2 = this.pendingPointer) != null ? _a2 : this.getPointer;
|
|
745
|
+
}
|
|
746
|
+
canAppendState(e2) {
|
|
747
|
+
var _a2, _b;
|
|
748
|
+
const t2 = (_a2 = this.getPointer) == null ? void 0 : _a2.seq;
|
|
749
|
+
if (void 0 !== t2 && e2 <= t2) return false;
|
|
750
|
+
const s2 = (_b = this.pendingPointer) == null ? void 0 : _b.seq;
|
|
751
|
+
return !(void 0 !== s2 && e2 < s2);
|
|
752
|
+
}
|
|
753
|
+
set(e2) {
|
|
754
|
+
if (!this.canAppendState(e2.seq)) throw "Appending in the past";
|
|
755
|
+
this.pendingStates.push(e2);
|
|
756
|
+
}
|
|
757
|
+
mutate(e2, t2) {
|
|
758
|
+
if (!this.initialised) return;
|
|
759
|
+
if (!this.canAppendState(e2)) throw "Mutating in the past";
|
|
760
|
+
const s2 = this.mostRecentState.resultPromise.then((e3) => e3.ok ? t2(e3) : e3);
|
|
761
|
+
this.pendingStates.push({ seq: e2, resultPromise: s2 });
|
|
762
|
+
}
|
|
763
|
+
get(e2) {
|
|
764
|
+
if (void 0 !== this.getPointer && e2 < this.getPointer.seq) throw `Trying to load state ${e2} when we have previously loaded ${this.getPointer.seq}`;
|
|
765
|
+
for (; this.pendingStates.length > 0 && this.pendingStates[0].seq <= e2; ) this.getPointer = this.pendingStates.shift();
|
|
766
|
+
return this.getPointer;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
class $ extends j {
|
|
752
770
|
constructor(e2, t2) {
|
|
753
|
-
this.onTeardown = t2, this.
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
771
|
+
super(e2), this.onTeardown = t2, this._error = null, this._lastGoodState = Promise.resolve(void 0);
|
|
772
|
+
}
|
|
773
|
+
get error() {
|
|
774
|
+
return this._error;
|
|
775
|
+
}
|
|
776
|
+
get lastGoodState() {
|
|
777
|
+
return this._lastGoodState;
|
|
778
|
+
}
|
|
779
|
+
mutate(e2, t2) {
|
|
780
|
+
super.mutate(e2, t2), this.registerNewState(this.mostRecentState.resultPromise);
|
|
781
|
+
}
|
|
782
|
+
set(e2) {
|
|
783
|
+
super.set(e2), this.registerNewState(this.mostRecentState.resultPromise);
|
|
784
|
+
}
|
|
785
|
+
registerNewState(e2) {
|
|
761
786
|
const t2 = this.lastGoodState;
|
|
762
|
-
this.
|
|
787
|
+
this._lastGoodState = e2.then((e3) => e3.ok ? e3.value : t2), e2.then((e3) => {
|
|
763
788
|
e3.ok || this.setError(e3);
|
|
764
|
-
})
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
setError(e2) {
|
|
792
|
+
var _a2;
|
|
793
|
+
this._error || (this._error = e2, (_a2 = this.onTeardown) == null ? void 0 : _a2.call(this, e2), this.lastGoodState.then((e3) => {
|
|
794
|
+
void 0 !== e3 && this.teardownNested(e3);
|
|
795
|
+
}));
|
|
765
796
|
}
|
|
766
|
-
|
|
767
|
-
|
|
797
|
+
}
|
|
798
|
+
class W extends $ {
|
|
799
|
+
constructor(e2) {
|
|
800
|
+
super({ seq: 0, resultPromise: new Promise((e3) => setTimeout(e3)).then(() => this.fetchInitial(0)) }, e2), this.getDeepMutex = new U(), this.lastDeep = void 0;
|
|
768
801
|
}
|
|
769
802
|
refetchInitial(e2) {
|
|
770
803
|
return __async(this, null, function* () {
|
|
771
|
-
const t2 = this.
|
|
772
|
-
if (void 0 === n2) return r2;
|
|
804
|
+
const t2 = this.mostRecentState.resultPromise, s2 = this.fetchInitial(e2), [n2, r2] = yield Promise.all([t2, s2]);
|
|
805
|
+
if (void 0 === n2 || !n2.ok) return r2;
|
|
773
806
|
if (!r2.ok) return r2;
|
|
774
|
-
return this.equal(n2, r2.value) ?
|
|
807
|
+
return this.equal(n2.value, r2.value) ? n2 : r2;
|
|
775
808
|
});
|
|
776
809
|
}
|
|
777
810
|
refetch(e2) {
|
|
778
|
-
if (this.error) return;
|
|
811
|
+
if (null !== this.error) return;
|
|
779
812
|
const t2 = { seq: e2, resultPromise: this.refetchInitial(e2) };
|
|
780
|
-
this.
|
|
813
|
+
this.set(t2);
|
|
781
814
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
815
|
+
changedBetween(e2, t2) {
|
|
816
|
+
return __async(this, null, function* () {
|
|
817
|
+
if (e2 >= t2) return false;
|
|
818
|
+
const s2 = this.get(t2), n2 = yield s2.resultPromise;
|
|
819
|
+
if (!n2.ok) return false;
|
|
820
|
+
if (n2.value.lastChanged > e2) return true;
|
|
821
|
+
return yield this.anyChildChanged(e2, t2, n2.value);
|
|
822
|
+
});
|
|
788
823
|
}
|
|
789
824
|
getDeep(e2) {
|
|
790
825
|
return __async(this, null, function* () {
|
|
791
826
|
return this.getDeepMutex.runExclusive(() => __async(this, null, function* () {
|
|
792
|
-
|
|
793
|
-
if (
|
|
794
|
-
|
|
795
|
-
if (
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
827
|
+
var _a2;
|
|
828
|
+
if (null !== this.error) return this.error;
|
|
829
|
+
const t2 = (_a2 = this.lastDeep) == null ? void 0 : _a2.seq;
|
|
830
|
+
if (e2 === t2) return this.lastDeep.deep;
|
|
831
|
+
if (void 0 !== t2) {
|
|
832
|
+
if (e2 < t2) throw `Trying to load seq ${e2} when we have previously loaded seq ${t2}`;
|
|
833
|
+
if (!(yield this.changedBetween(t2, e2))) return this.lastDeep.seq = e2, this.lastDeep.deep;
|
|
834
|
+
}
|
|
835
|
+
const s2 = this.get(e2).resultPromise, n2 = s2.then((t3) => t3.ok ? this.loadNested(e2, t3.value) : t3);
|
|
836
|
+
this.lastDeep = { seq: e2, shallow: s2, deep: n2 };
|
|
837
|
+
const r2 = yield n2;
|
|
838
|
+
return r2.ok || this.setError(r2), r2;
|
|
800
839
|
}));
|
|
801
840
|
});
|
|
802
841
|
}
|
|
803
|
-
setError(e2) {
|
|
804
|
-
var _a2;
|
|
805
|
-
this.error || (this.error = e2, (_a2 = this.onTeardown) == null ? void 0 : _a2.call(this, e2), this.lastGoodState.then((e3) => {
|
|
806
|
-
void 0 !== e3 && this.teardownNested(e3);
|
|
807
|
-
}));
|
|
808
|
-
}
|
|
809
842
|
}
|
|
810
|
-
class
|
|
811
|
-
constructor(e2, t2
|
|
812
|
-
super(
|
|
813
|
-
yield this.emit(
|
|
843
|
+
class q extends W {
|
|
844
|
+
constructor(e2, t2) {
|
|
845
|
+
super(t2), this.emitMutex = e2, this.unsubscribeTimer = new H(), this.referencedByOtherStores = 0, this.listeners = [], this.lastEmitSeq = void 0, this.lastEmitResult = void 0, e2.runExclusive(() => __async(this, null, function* () {
|
|
846
|
+
yield this.emit(0);
|
|
814
847
|
}));
|
|
815
848
|
}
|
|
816
849
|
registerInternalSubscription() {
|
|
@@ -836,16 +869,16 @@ class W extends $ {
|
|
|
836
869
|
emit(e2) {
|
|
837
870
|
return __async(this, null, function* () {
|
|
838
871
|
var _a2;
|
|
872
|
+
if (this.onlyUsedInternally) return;
|
|
839
873
|
if (this.lastEmitSeq && this.lastEmitSeq >= e2) return;
|
|
840
874
|
if (false === ((_a2 = this.lastEmitResult) == null ? void 0 : _a2.ok)) return;
|
|
841
|
-
const t2 = this.lastEmitSeq;
|
|
842
875
|
this.lastEmitSeq = e2;
|
|
843
|
-
const
|
|
844
|
-
this.lastEmitResult
|
|
876
|
+
const t2 = yield this.getDeep(e2);
|
|
877
|
+
t2 !== this.lastEmitResult && (this.lastEmitResult = t2, this.listeners.forEach((e3) => e3(t2)));
|
|
845
878
|
});
|
|
846
879
|
}
|
|
847
880
|
}
|
|
848
|
-
class
|
|
881
|
+
class H {
|
|
849
882
|
constructor() {
|
|
850
883
|
this.timerId = void 0;
|
|
851
884
|
}
|
|
@@ -856,9 +889,9 @@ class q {
|
|
|
856
889
|
clearTimeout(this.timerId);
|
|
857
890
|
}
|
|
858
891
|
}
|
|
859
|
-
class
|
|
860
|
-
constructor(e2, t2, s2, n2
|
|
861
|
-
super(
|
|
892
|
+
class G extends q {
|
|
893
|
+
constructor(e2, t2, s2, n2) {
|
|
894
|
+
super(s2, n2), this.userId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e4;
|
|
862
895
|
}
|
|
863
896
|
fetchInitial(e2) {
|
|
864
897
|
return __async(this, null, function* () {
|
|
@@ -867,7 +900,7 @@ class H extends W {
|
|
|
867
900
|
});
|
|
868
901
|
}
|
|
869
902
|
equal(e2, t2) {
|
|
870
|
-
return
|
|
903
|
+
return O(e2.snapshot, t2.snapshot);
|
|
871
904
|
}
|
|
872
905
|
loadNested(e2, t2) {
|
|
873
906
|
return __async(this, null, function* () {
|
|
@@ -875,52 +908,57 @@ class H extends W {
|
|
|
875
908
|
});
|
|
876
909
|
}
|
|
877
910
|
userCreated(e2, t2) {
|
|
878
|
-
this.mutate(e2, () => c({ snapshot: this.realtimeClient.createUserSnapshot(t2.state), lastChanged: e2 }));
|
|
911
|
+
this.mutate(e2, (s2) => null !== s2.value.snapshot ? s2 : c({ snapshot: this.realtimeClient.createUserSnapshot(t2.state), lastChanged: e2 }));
|
|
879
912
|
}
|
|
880
913
|
userEdited(e2, t2) {
|
|
881
914
|
this.mutate(e2, (s2) => {
|
|
882
915
|
const n2 = s2.value.snapshot;
|
|
883
916
|
if (null === n2) return console.warn("[TalkJS] Received a 'used edited' event for a user that we thought didn't exist."), s2;
|
|
884
|
-
return c({ snapshot: { id: n2.id, name:
|
|
917
|
+
return c({ snapshot: { id: n2.id, name: P(n2.name, t2.diff.name), custom: _(n2.custom, t2.diff.custom), locale: P(n2.locale, t2.diff.locale), photoUrl: P(n2.photoUrl, t2.diff.photoUrl), role: P(n2.role, t2.diff.role), welcomeMessage: P(n2.welcomeMessage, t2.diff.welcomeMessage) }, lastChanged: e2 });
|
|
885
918
|
});
|
|
886
919
|
}
|
|
887
920
|
getFromCache() {
|
|
888
921
|
return __async(this, null, function* () {
|
|
889
|
-
const e2 = yield this.
|
|
922
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
890
923
|
return e2.ok ? null === e2.value.snapshot ? h({ status: 404, errorCode: "USER_NOT_FOUND", reasons: ["That user does not exist yet"] }) : c({ 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 } }) : l("NOT_IN_CACHE");
|
|
891
924
|
});
|
|
892
925
|
}
|
|
893
926
|
teardownNested(e2) {
|
|
894
927
|
}
|
|
928
|
+
anyChildChanged(e2, t2, s2) {
|
|
929
|
+
return __async(this, null, function* () {
|
|
930
|
+
return false;
|
|
931
|
+
});
|
|
932
|
+
}
|
|
895
933
|
}
|
|
896
|
-
var
|
|
897
|
-
function
|
|
934
|
+
var L, z = {};
|
|
935
|
+
function J(e2, t2) {
|
|
898
936
|
const s2 = t2.lastIndex;
|
|
899
937
|
let n2;
|
|
900
938
|
const r2 = [];
|
|
901
939
|
for (; null !== (n2 = t2.exec(e2)); ) r2.push(n2);
|
|
902
940
|
return t2.lastIndex = s2, r2;
|
|
903
941
|
}
|
|
904
|
-
function
|
|
942
|
+
function Y(e2) {
|
|
905
943
|
const t2 = e2.replace(/%2F/g, "/").replace(/^.*?\/([^/]+?)(?:\?.*)?$/, "$1");
|
|
906
944
|
return decodeURIComponent(t2);
|
|
907
945
|
}
|
|
908
|
-
function
|
|
946
|
+
function Q(e2, t2) {
|
|
909
947
|
if (!e2() && !t2) {
|
|
910
948
|
t2 = e2.toString().replace(/^function\s*\(\)\s*\{\s*return\s*(.*);\s*\}\s*$/, "`$1`") + " was not true";
|
|
911
949
|
}
|
|
912
950
|
}
|
|
913
951
|
!function() {
|
|
914
|
-
if (
|
|
952
|
+
if (L) return z;
|
|
915
953
|
function e2(e3) {
|
|
916
954
|
return String.fromCharCode(parseInt(e3.slice(1), 16));
|
|
917
955
|
}
|
|
918
956
|
function t2(e3) {
|
|
919
957
|
return `%${`00${e3.charCodeAt(0).toString(16)}`.slice(-2)}`;
|
|
920
958
|
}
|
|
921
|
-
|
|
959
|
+
L = 1, Object.defineProperty(z, "__esModule", { value: true }), z.encode = function(t3) {
|
|
922
960
|
return btoa(encodeURIComponent(t3).replace(/%[0-9A-F]{2}/g, e2));
|
|
923
|
-
},
|
|
961
|
+
}, z.decode = function(e3) {
|
|
924
962
|
return decodeURIComponent(Array.from(atob(e3), t2).join(""));
|
|
925
963
|
};
|
|
926
964
|
}(), ((e2) => {
|
|
@@ -954,51 +992,51 @@ function Y(e2, t2) {
|
|
|
954
992
|
}, e2.falsy = function(e3) {
|
|
955
993
|
}, e2.never = function(e3) {
|
|
956
994
|
};
|
|
957
|
-
})(
|
|
958
|
-
const
|
|
959
|
-
function Z(e2) {
|
|
960
|
-
if (!V.test(e2)) return false;
|
|
961
|
-
return !K(e2).test("");
|
|
962
|
-
}
|
|
995
|
+
})(Q || (Q = {}));
|
|
996
|
+
const V = Q, Z = /^\/.*[^\\]\/[im]*$/;
|
|
963
997
|
function K(e2) {
|
|
998
|
+
if (!Z.test(e2)) return false;
|
|
999
|
+
return !X(e2).test("");
|
|
1000
|
+
}
|
|
1001
|
+
function X(e2) {
|
|
964
1002
|
const t2 = e2.match(/^\/(.*[^\\])\/(.*)$/);
|
|
965
1003
|
if (!t2) throw new Error(`Expected ${e2} to be a (non-empty) regex`);
|
|
966
1004
|
let s2 = t2[2] || "";
|
|
967
1005
|
return s2 = s2.replace(/[^im]/g, "") + "g", new RegExp(t2[1], s2);
|
|
968
1006
|
}
|
|
969
|
-
class
|
|
1007
|
+
class ee {
|
|
970
1008
|
constructor({ mode: e2, allowedHostnames: t2, allowedPhoneNrs: s2, allowedMatches: n2, forbiddenMatches: r2, suppressLinks: i2, suppressEmailAddresses: a2, suppressPhoneNumbers: o2, replacement: u2 }) {
|
|
971
|
-
|
|
1009
|
+
V.oneOf(e2, ["all", "otherOnly", "off"]), this.mode = e2, this.suppressLinks = false !== i2, this.suppressEmailAddresses = false !== a2, this.suppressPhoneNumbers = false !== o2, this.allowedHostnames = t2 || [], this.allowedPhoneNrs = (s2 || []).filter((e3) => e3).map((e3) => e3.replace(/[^0-9]/g, "")), this.allowedMatches = (n2 || []).filter(K).map((e3) => X(e3)), this.forbiddenMatches = (r2 || []).filter(K).map((e3) => X(e3)), V(() => this.allowedMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.allowedMatches` must be global. Check `allowedMatches`!"), V(() => this.forbiddenMatches.every((e3) => e3.flags.includes("g")), "All regexes in `suppressContactInfo.forbiddenMatches` must be global. Check `forbiddenMatches`!"), u2 = u2 == null ? void 0 : u2.trim(), this.replacement = u2 && u2.length > 0 ? u2 : void 0;
|
|
972
1010
|
}
|
|
973
1011
|
shouldSuppress({ isContentBySender: e2 }) {
|
|
974
1012
|
return "all" === this.mode || "otherOnly" === this.mode && !e2;
|
|
975
1013
|
}
|
|
976
1014
|
}
|
|
977
|
-
function
|
|
1015
|
+
function te(e2, t2) {
|
|
978
1016
|
const s2 = e2.map((e3) => function(e4, t3) {
|
|
979
1017
|
if ("text" === e4.type) return function(e5, t4) {
|
|
980
1018
|
const s3 = function(e6) {
|
|
981
1019
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l;
|
|
982
1020
|
let t5 = "";
|
|
983
|
-
return e6.t && (t5 = `(${e6.t("CONTACT_INFORMATION_HIDDEN")})`), { formattedLinks: (_a2 = e6.formattedLinks) != null ? _a2 : "plaintext", markup: (_b = e6.markup) != null ? _b : false, useFallbackMentions: (_c = e6.useFallbackMentions) != null ? _c : false, sameTabLinkRules: (_d = e6.sameTabLinkRules) != null ? _d : [], enableEmojiImageFallback: (_e2 = e6.enableEmojiImageFallback) != null ? _e2 : false, highlight: (_f = e6.highlight) != null ? _f : [], contactInfo: (_g = e6.contactInfo) != null ? _g : false, suppression: (_h = e6.suppression) != null ? _h : new
|
|
1021
|
+
return e6.t && (t5 = `(${e6.t("CONTACT_INFORMATION_HIDDEN")})`), { formattedLinks: (_a2 = e6.formattedLinks) != null ? _a2 : "plaintext", markup: (_b = e6.markup) != null ? _b : false, useFallbackMentions: (_c = e6.useFallbackMentions) != null ? _c : false, sameTabLinkRules: (_d = e6.sameTabLinkRules) != null ? _d : [], enableEmojiImageFallback: (_e2 = e6.enableEmojiImageFallback) != null ? _e2 : false, highlight: (_f = e6.highlight) != null ? _f : [], contactInfo: (_g = e6.contactInfo) != null ? _g : false, suppression: (_h = e6.suppression) != null ? _h : new ee({ 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 : {} };
|
|
984
1022
|
}(t4);
|
|
985
|
-
return
|
|
1023
|
+
return se(e5, s3);
|
|
986
1024
|
}(e4.children, t3);
|
|
987
|
-
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${
|
|
988
|
-
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${
|
|
989
|
-
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${
|
|
1025
|
+
if ("file" === e4.type && "video" === e4.subtype) return `🎥 ${Y(e4.url)}`;
|
|
1026
|
+
if ("file" === e4.type && "image" === e4.subtype) return `📷 ${Y(e4.url)}`;
|
|
1027
|
+
if ("file" === e4.type && "audio" === e4.subtype) return `🎧 ${Y(e4.url)}`;
|
|
990
1028
|
if ("file" === e4.type && "voice" === e4.subtype) {
|
|
991
1029
|
const t4 = e4.duration;
|
|
992
1030
|
if (void 0 === t4) return "🎙️";
|
|
993
1031
|
return `🎙️ (${Math.floor(t4 / 60)}:${Math.floor(t4 % 60).toString().padStart(2, "0")})`;
|
|
994
1032
|
}
|
|
995
|
-
if ("file" === e4.type) return e4.subtype, `📎 ${
|
|
1033
|
+
if ("file" === e4.type) return e4.subtype, `📎 ${Y(e4.url)}`;
|
|
996
1034
|
if ("location" === e4.type) return "📍";
|
|
997
1035
|
return "";
|
|
998
1036
|
}(e3, t2));
|
|
999
1037
|
return s2.join("\n\n");
|
|
1000
1038
|
}
|
|
1001
|
-
function
|
|
1039
|
+
function se(e2, t2) {
|
|
1002
1040
|
return e2.flatMap((e3) => {
|
|
1003
1041
|
if ("string" == typeof e3) return e3;
|
|
1004
1042
|
switch (e3.type) {
|
|
@@ -1011,13 +1049,13 @@ function te(e2, t2) {
|
|
|
1011
1049
|
case "actionLink":
|
|
1012
1050
|
case "actionbutton":
|
|
1013
1051
|
case "actionButton":
|
|
1014
|
-
return
|
|
1052
|
+
return se(e3.children, t2);
|
|
1015
1053
|
case "bulletlist":
|
|
1016
1054
|
case "bulletList":
|
|
1017
|
-
return "\n" +
|
|
1055
|
+
return "\n" + se(e3.children, t2);
|
|
1018
1056
|
case "bulletpoint":
|
|
1019
1057
|
case "bulletPoint":
|
|
1020
|
-
return "- " +
|
|
1058
|
+
return "- " + se(e3.children, t2) + "\n";
|
|
1021
1059
|
case "autolink":
|
|
1022
1060
|
case "autoLink":
|
|
1023
1061
|
case "codeblock":
|
|
@@ -1035,9 +1073,9 @@ function te(e2, t2) {
|
|
|
1035
1073
|
}
|
|
1036
1074
|
}).join("");
|
|
1037
1075
|
}
|
|
1038
|
-
class
|
|
1039
|
-
constructor(e2, t2, s2
|
|
1040
|
-
super(
|
|
1076
|
+
class ne extends W {
|
|
1077
|
+
constructor(e2, t2, s2) {
|
|
1078
|
+
super(), this.conversationId = e2, this.message = t2, this.realtimeClient = s2;
|
|
1041
1079
|
}
|
|
1042
1080
|
get messageId() {
|
|
1043
1081
|
return "string" == typeof this.message ? this.message : this.message.id;
|
|
@@ -1051,33 +1089,40 @@ class se extends $ {
|
|
|
1051
1089
|
if (!e3.ok) return e3;
|
|
1052
1090
|
t2 = e3.value.data;
|
|
1053
1091
|
}
|
|
1054
|
-
return c({ lastChanged: e2, sender: null === t2.senderId ? null : this.realtimeClient.internalSubscribe(["users", t2.senderId]), data: { id: t2.id, type: t2.type, custom: t2.custom, createdAt: t2.createdAt, editedAt: t2.editedAt, referencedMessageId: t2.referencedMessageId, origin: t2.origin, plaintext:
|
|
1092
|
+
return c({ lastChanged: e2, sender: null === t2.senderId ? null : this.realtimeClient.internalSubscribe(["users", t2.senderId]), data: { id: t2.id, type: t2.type, custom: t2.custom, createdAt: t2.createdAt, editedAt: t2.editedAt, referencedMessageId: t2.referencedMessageId, origin: t2.origin, plaintext: te(t2.content, {}), content: t2.content } });
|
|
1055
1093
|
});
|
|
1056
1094
|
}
|
|
1057
1095
|
refetch(e2) {
|
|
1058
1096
|
throw "Do not call refetch on message data stores, it can return outdated data. Destroy and remake them instead";
|
|
1059
1097
|
}
|
|
1060
1098
|
equal(e2, t2) {
|
|
1061
|
-
return
|
|
1099
|
+
return O(e2.data, t2.data);
|
|
1062
1100
|
}
|
|
1063
1101
|
teardownNested(e2) {
|
|
1064
1102
|
var _a2;
|
|
1065
1103
|
(_a2 = e2.sender) == null ? void 0 : _a2.unsubscribe();
|
|
1066
1104
|
}
|
|
1105
|
+
anyChildChanged(e2, t2, s2) {
|
|
1106
|
+
return __async(this, null, function* () {
|
|
1107
|
+
var _a2;
|
|
1108
|
+
const n2 = (_a2 = s2.sender) == null ? void 0 : _a2.store;
|
|
1109
|
+
return true === (yield n2 == null ? void 0 : n2.changedBetween(e2, t2));
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1067
1112
|
loadNested(e2, t2) {
|
|
1068
1113
|
return __async(this, null, function* () {
|
|
1069
|
-
var _a2, _b, _c
|
|
1114
|
+
var _a2, _b, _c;
|
|
1070
1115
|
const s2 = yield (_b = (_a2 = t2.sender) == null ? void 0 : _a2.store) == null ? void 0 : _b.getDeep(e2);
|
|
1071
1116
|
if (false === (s2 == null ? void 0 : s2.ok)) return s2;
|
|
1072
|
-
if (null === t2.data) return c({
|
|
1117
|
+
if (null === t2.data) return c({ snapshot: null });
|
|
1073
1118
|
const n2 = s2 == null ? void 0 : s2.value;
|
|
1074
|
-
return c({
|
|
1119
|
+
return c({ snapshot: { sender: (_c = n2 == null ? void 0 : n2.snapshot) != null ? _c : null, id: t2.data.id, type: t2.data.type, custom: t2.data.custom, createdAt: t2.data.createdAt, editedAt: t2.data.editedAt, origin: t2.data.origin, plaintext: te(t2.data.content, {}), content: t2.data.content, referencedMessageId: t2.data.referencedMessageId } });
|
|
1075
1120
|
});
|
|
1076
1121
|
}
|
|
1077
1122
|
messageEdited(e2, t2) {
|
|
1078
1123
|
this.mutate(e2, (s2) => {
|
|
1079
1124
|
if (null === s2.value.data) return s2;
|
|
1080
|
-
return c({ 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:
|
|
1125
|
+
return c({ 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: P(s2.value.data.editedAt, t2.diff.editedAt), custom: _(s2.value.data.custom, t2.diff.custom), content: P(s2.value.data.content, t2.diff.content) } });
|
|
1081
1126
|
});
|
|
1082
1127
|
}
|
|
1083
1128
|
messageDeleted(e2, t2) {
|
|
@@ -1086,7 +1131,7 @@ class se extends $ {
|
|
|
1086
1131
|
getFromCache() {
|
|
1087
1132
|
return __async(this, null, function* () {
|
|
1088
1133
|
var _b;
|
|
1089
|
-
const e2 = yield this.
|
|
1134
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
1090
1135
|
if (!e2.ok) return l("NOT_IN_CACHE");
|
|
1091
1136
|
if (null === e2.value.data) {
|
|
1092
1137
|
return h({ status: 404, errorCode: "MESSAGE_NOT_FOUND", reasons: ["No message with that ID exists"] });
|
|
@@ -1096,9 +1141,9 @@ class se extends $ {
|
|
|
1096
1141
|
});
|
|
1097
1142
|
}
|
|
1098
1143
|
}
|
|
1099
|
-
class
|
|
1100
|
-
constructor(e2, t2, s2
|
|
1101
|
-
super(
|
|
1144
|
+
class re extends W {
|
|
1145
|
+
constructor(e2, t2, s2) {
|
|
1146
|
+
super(), this.createdAt = e2, this.dataStore = t2, this.referencedDataStore = s2;
|
|
1102
1147
|
}
|
|
1103
1148
|
get messageId() {
|
|
1104
1149
|
return this.dataStore.messageId;
|
|
@@ -1116,26 +1161,32 @@ class ne extends $ {
|
|
|
1116
1161
|
}
|
|
1117
1162
|
teardownNested(e2) {
|
|
1118
1163
|
}
|
|
1164
|
+
anyChildChanged(_0, _1, _2) {
|
|
1165
|
+
return __async(this, arguments, function* (e2, t2, { dataStore: s2, referencedDataStore: n2 }) {
|
|
1166
|
+
if (true === (yield s2.changedBetween(e2, t2))) return true;
|
|
1167
|
+
return true === (yield n2 == null ? void 0 : n2.changedBetween(e2, t2));
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1119
1170
|
loadNested(e2, t2) {
|
|
1120
1171
|
return __async(this, null, function* () {
|
|
1121
|
-
var _a2, _b, _c
|
|
1172
|
+
var _a2, _b, _c;
|
|
1122
1173
|
const s2 = yield t2.dataStore.getDeep(e2);
|
|
1123
1174
|
if (!s2.ok) return s2;
|
|
1124
1175
|
const n2 = s2.value;
|
|
1125
|
-
if (null === n2.snapshot) return c({
|
|
1176
|
+
if (null === n2.snapshot) return c({ snapshot: null });
|
|
1126
1177
|
const r2 = yield (_a2 = t2.referencedDataStore) == null ? void 0 : _a2.getDeep(e2);
|
|
1127
1178
|
if (r2 && !r2.ok) return r2;
|
|
1128
1179
|
const i2 = (_b = r2 == null ? void 0 : r2.value) != null ? _b : null, a2 = (_c = i2 == null ? void 0 : i2.snapshot) != null ? _c : null;
|
|
1129
|
-
return c({
|
|
1180
|
+
return c({ snapshot: { id: n2.snapshot.id, type: n2.snapshot.type, sender: n2.snapshot.sender, custom: n2.snapshot.custom, createdAt: n2.snapshot.createdAt, editedAt: n2.snapshot.editedAt, referencedMessage: a2, origin: n2.snapshot.origin, plaintext: n2.snapshot.plaintext, content: n2.snapshot.content } });
|
|
1130
1181
|
});
|
|
1131
1182
|
}
|
|
1132
1183
|
}
|
|
1133
|
-
class
|
|
1134
|
-
constructor(e2, t2, s2, n2
|
|
1135
|
-
super(e2,
|
|
1184
|
+
class ie extends q {
|
|
1185
|
+
constructor(e2, t2, s2, n2) {
|
|
1186
|
+
super(e2, n2), this.conversationId = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 1e3, this.pendingLoadMore = void 0;
|
|
1136
1187
|
}
|
|
1137
1188
|
listen(e2) {
|
|
1138
|
-
return this.onlyUsedInternally && this.
|
|
1189
|
+
return this.onlyUsedInternally && this.mostRecentState.resultPromise.then((e3) => {
|
|
1139
1190
|
if (e3.ok && null !== e3.value.inWindow) {
|
|
1140
1191
|
const t2 = 30 - e3.value.inWindow.length;
|
|
1141
1192
|
t2 > 0 && this._loadMoreMessages(t2);
|
|
@@ -1144,24 +1195,43 @@ class re extends W {
|
|
|
1144
1195
|
}
|
|
1145
1196
|
fetchInitial(e2) {
|
|
1146
1197
|
return __async(this, null, function* () {
|
|
1147
|
-
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield
|
|
1148
|
-
return s2.ok ? null === s2.value.messages ? c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) :
|
|
1198
|
+
const t2 = this.onlyUsedInternally ? 1 : 30, s2 = yield ae({ realtimeClient: this.realtimeClient, conversationId: this.conversationId, count: t2 });
|
|
1199
|
+
return s2.ok ? null === s2.value.messages ? c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null }) : oe({ seq: e2, messages: s2.value.messages, cursor: s2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : s2;
|
|
1149
1200
|
});
|
|
1150
1201
|
}
|
|
1151
1202
|
teardownNested(e2) {
|
|
1152
|
-
|
|
1203
|
+
ue(e2);
|
|
1204
|
+
}
|
|
1205
|
+
anyChildChanged(e2, t2, s2) {
|
|
1206
|
+
return __async(this, null, function* () {
|
|
1207
|
+
for (const n2 in s2.stores) {
|
|
1208
|
+
const r2 = s2.stores[n2];
|
|
1209
|
+
if (true === (yield r2 == null ? void 0 : r2.changedBetween(e2, t2))) return true;
|
|
1210
|
+
}
|
|
1211
|
+
return false;
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
lastMessageChangedBetween(e2, t2) {
|
|
1215
|
+
return __async(this, null, function* () {
|
|
1216
|
+
if (e2 >= t2) return false;
|
|
1217
|
+
const s2 = yield this.get(t2).resultPromise;
|
|
1218
|
+
if (!s2.ok) return false;
|
|
1219
|
+
if (s2.value.lastMessageChanged > e2) return true;
|
|
1220
|
+
if (null === s2.value.stores) return false;
|
|
1221
|
+
const n2 = s2.value.inWindow[0];
|
|
1222
|
+
if (void 0 === n2) return false;
|
|
1223
|
+
return true === (yield n2.changedBetween(e2, t2));
|
|
1224
|
+
});
|
|
1153
1225
|
}
|
|
1154
1226
|
equal(e2, t2) {
|
|
1155
|
-
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!
|
|
1227
|
+
return null === e2.stores && null === t2.stores || null !== e2.stores && null !== t2.stores && (!!O(Object.keys(e2.stores), Object.keys(t2.stores)) && (!!O(e2.inWindow.map((e3) => e3.messageId), t2.inWindow.map((e3) => e3.messageId)) && O(e2.windowEnd, t2.windowEnd)));
|
|
1156
1228
|
}
|
|
1157
1229
|
loadNested(e2, t2) {
|
|
1158
1230
|
return __async(this, null, function* () {
|
|
1159
|
-
|
|
1160
|
-
if (null === t2.stores) return c({ snapshot: null, loadedAll: true, lastChanged: t2.lastChanged, lastMessageChanged: t2.lastMessageChanged });
|
|
1231
|
+
if (null === t2.stores) return c({ snapshot: null, loadedAll: true });
|
|
1161
1232
|
const s2 = yield Promise.all(t2.inWindow.map((t3) => t3.getDeep(e2))), n2 = s2.find((e3) => !e3.ok);
|
|
1162
1233
|
if (n2) return n2;
|
|
1163
|
-
|
|
1164
|
-
return c({ snapshot: i2, loadedAll: null === t2.windowEnd, lastChanged: a2, lastMessageChanged: u2 });
|
|
1234
|
+
return c({ snapshot: s2.filter((e3) => null !== e3.value.snapshot).map((e3) => e3.value.snapshot), loadedAll: null === t2.windowEnd });
|
|
1165
1235
|
});
|
|
1166
1236
|
}
|
|
1167
1237
|
loadMore(e2) {
|
|
@@ -1173,11 +1243,11 @@ class re extends W {
|
|
|
1173
1243
|
}
|
|
1174
1244
|
_loadMoreMessages(e2 = 30) {
|
|
1175
1245
|
return __async(this, null, function* () {
|
|
1176
|
-
const t2 = yield this.
|
|
1246
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1177
1247
|
if (!t2.ok) return;
|
|
1178
1248
|
if (null === t2.value.windowEnd) return;
|
|
1179
|
-
const s2 = t2.value.windowEnd.cursor, n2 = yield
|
|
1180
|
-
this.mutate(r2, (e3) => null === e3.value.windowEnd || s2 !== e3.value.windowEnd.cursor ? e3 : n2.ok ? null === n2.value.messages ? (console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."), e3) :
|
|
1249
|
+
const s2 = t2.value.windowEnd.cursor, n2 = yield ae({ count: e2, cursor: s2, conversationId: this.conversationId, realtimeClient: this.realtimeClient }), r2 = this.mostRecentState.seq + 1e-6;
|
|
1250
|
+
this.mutate(r2, (e3) => null === e3.value.windowEnd || s2 !== e3.value.windowEnd.cursor ? e3 : n2.ok ? null === n2.value.messages ? (console.warn("[TalkJS] When loading more messages, the conversation no longer existed. We should have been told about this."), e3) : oe({ seq: r2, prevState: e3.value, messages: n2.value.messages, cursor: n2.value.nextCursor, conversationId: this.conversationId, realtimeClient: this.realtimeClient }) : n2), yield this.emitMutex.runExclusive(() => this.emit(r2));
|
|
1181
1251
|
});
|
|
1182
1252
|
}
|
|
1183
1253
|
messageCreated(e2, t2) {
|
|
@@ -1185,12 +1255,12 @@ class re extends W {
|
|
|
1185
1255
|
if (null === s2.value.stores) return console.warn("[TalkJS] Received a 'message.created' event for a nonexistent conversation."), s2;
|
|
1186
1256
|
if (s2.value.windowEnd && t2.state.createdAt < s2.value.windowEnd.oldestMessageTs) return s2;
|
|
1187
1257
|
if (Object.hasOwnProperty.call(s2.value.stores, t2.state.id)) return s2;
|
|
1188
|
-
const n2 = __spreadValues({}, s2.value.stores), r2 = new
|
|
1258
|
+
const n2 = __spreadValues({}, s2.value.stores), r2 = new ne(this.conversationId, t2.state, this.realtimeClient);
|
|
1189
1259
|
n2[t2.state.id] = r2;
|
|
1190
1260
|
const i2 = t2.state.referencedMessageId;
|
|
1191
1261
|
let a2;
|
|
1192
|
-
null === i2 ? a2 = null : i2 in n2 ? a2 = n2[i2] : (a2 = new
|
|
1193
|
-
const o2 = new
|
|
1262
|
+
null === i2 ? a2 = null : i2 in n2 ? a2 = n2[i2] : (a2 = new ne(this.conversationId, i2, this.realtimeClient), n2[i2] = a2);
|
|
1263
|
+
const o2 = new re(t2.state.createdAt, r2, a2), u2 = [...s2.value.inWindow, o2];
|
|
1194
1264
|
u2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1195
1265
|
const l2 = u2[0].messageId === t2.messageId ? e2 : s2.value.lastMessageChanged;
|
|
1196
1266
|
return c({ lastChanged: e2, lastMessageChanged: l2, stores: n2, inWindow: u2, windowEnd: s2.value.windowEnd });
|
|
@@ -1210,13 +1280,13 @@ class re extends W {
|
|
|
1210
1280
|
delete n2[t2.messageId];
|
|
1211
1281
|
const r2 = s2.value.inWindow.filter((e3) => e3.messageId !== t2.messageId);
|
|
1212
1282
|
if (t2.newLastMessage && 0 === r2.length) {
|
|
1213
|
-
const
|
|
1214
|
-
n2[
|
|
1215
|
-
const
|
|
1216
|
-
let
|
|
1217
|
-
null ===
|
|
1218
|
-
const
|
|
1219
|
-
r2.push(
|
|
1283
|
+
const e3 = new ne(this.conversationId, t2.newLastMessage, this.realtimeClient);
|
|
1284
|
+
n2[e3.messageId] = e3;
|
|
1285
|
+
const s3 = t2.newLastMessage.referencedMessageId;
|
|
1286
|
+
let i3;
|
|
1287
|
+
null === s3 ? i3 = null : s3 in n2 ? i3 = n2[s3] : (i3 = new ne(this.conversationId, s3, this.realtimeClient), n2[s3] = i3);
|
|
1288
|
+
const a2 = new re(t2.newLastMessage.createdAt, e3, i3);
|
|
1289
|
+
r2.push(a2);
|
|
1220
1290
|
}
|
|
1221
1291
|
const i2 = void 0 !== t2.newLastMessage ? e2 : s2.value.lastMessageChanged;
|
|
1222
1292
|
return c({ lastChanged: e2, lastMessageChanged: i2, stores: n2, inWindow: r2, windowEnd: s2.value.windowEnd });
|
|
@@ -1225,21 +1295,21 @@ class re extends W {
|
|
|
1225
1295
|
conversationCleared(e2, t2) {
|
|
1226
1296
|
this.mutate(e2, (t3) => {
|
|
1227
1297
|
var _a2;
|
|
1228
|
-
return 0 === ((_a2 = t3.value.inWindow) == null ? void 0 : _a2.length) && null === t3.value.windowEnd ? t3 : (
|
|
1298
|
+
return 0 === ((_a2 = t3.value.inWindow) == null ? void 0 : _a2.length) && null === t3.value.windowEnd ? t3 : (ue(t3.value), c({ lastChanged: e2, lastMessageChanged: e2, stores: {}, inWindow: [], windowEnd: null }));
|
|
1229
1299
|
});
|
|
1230
1300
|
}
|
|
1231
1301
|
sideCreated(e2, t2) {
|
|
1232
1302
|
const s2 = this.fetchInitial(e2);
|
|
1233
1303
|
this.mutate(e2, (e3) => null !== e3.value.stores ? (s2.then((e4) => {
|
|
1234
|
-
e4.ok &&
|
|
1304
|
+
e4.ok && ue(e4.value);
|
|
1235
1305
|
}), e3) : s2);
|
|
1236
1306
|
}
|
|
1237
1307
|
sideDeleted(e2, t2) {
|
|
1238
|
-
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (
|
|
1308
|
+
this.mutate(e2, (t3) => null === t3.value.stores ? t3 : (ue(t3.value), c({ lastChanged: e2, lastMessageChanged: e2, stores: null, inWindow: null, windowEnd: null })));
|
|
1239
1309
|
}
|
|
1240
1310
|
getMessageFromCache(e2) {
|
|
1241
1311
|
return __async(this, null, function* () {
|
|
1242
|
-
const t2 = yield this.
|
|
1312
|
+
const t2 = yield this.mostRecentState.resultPromise;
|
|
1243
1313
|
if (!t2.ok) return l("NOT_IN_CACHE");
|
|
1244
1314
|
if (null === t2.value.stores) return l("NOT_IN_CACHE");
|
|
1245
1315
|
const s2 = t2.value.stores[e2];
|
|
@@ -1247,7 +1317,7 @@ class re extends W {
|
|
|
1247
1317
|
});
|
|
1248
1318
|
}
|
|
1249
1319
|
}
|
|
1250
|
-
function
|
|
1320
|
+
function ae(_0) {
|
|
1251
1321
|
return __async(this, arguments, function* ({ cursor: e2, realtimeClient: t2, conversationId: s2, count: n2 }) {
|
|
1252
1322
|
const r2 = { limit: n2, cursor: e2 }, i2 = yield t2.call("GET", ["me", "conversations", s2, "messages"], r2, { bypassCache: true });
|
|
1253
1323
|
if (i2.ok) {
|
|
@@ -1257,36 +1327,36 @@ function ie(_0) {
|
|
|
1257
1327
|
return (i2.ok || "server" !== i2.where || 404 !== i2.value.status) && (i2.ok || "server" !== i2.where || 403 !== i2.value.status || "NOT_A_PARTICIPANT" !== i2.value.errorCode) ? i2 : c({ messages: null, nextCursor: null });
|
|
1258
1328
|
});
|
|
1259
1329
|
}
|
|
1260
|
-
function
|
|
1330
|
+
function oe({ seq: e2, prevState: t2, messages: s2, cursor: n2, conversationId: r2, realtimeClient: i2 }) {
|
|
1261
1331
|
var _a2, _b, _c, _d;
|
|
1262
1332
|
const a2 = t2 ? __spreadValues({}, t2.stores) : {};
|
|
1263
|
-
for (const
|
|
1264
|
-
const
|
|
1265
|
-
a2[
|
|
1266
|
-
}
|
|
1267
|
-
for (const
|
|
1268
|
-
const
|
|
1269
|
-
if (
|
|
1270
|
-
const
|
|
1271
|
-
a2[
|
|
1333
|
+
for (const e3 of s2) if (void 0 === a2[e3.id]) {
|
|
1334
|
+
const t3 = new ne(r2, e3, i2);
|
|
1335
|
+
a2[t3.messageId] = t3;
|
|
1336
|
+
}
|
|
1337
|
+
for (const e3 of s2) {
|
|
1338
|
+
const t3 = e3.referencedMessageId;
|
|
1339
|
+
if (t3 && void 0 === a2[t3]) {
|
|
1340
|
+
const e4 = new ne(r2, t3, i2);
|
|
1341
|
+
a2[e4.messageId] = e4;
|
|
1272
1342
|
}
|
|
1273
1343
|
}
|
|
1274
1344
|
const o2 = t2 ? [...t2.inWindow] : [];
|
|
1275
|
-
for (const
|
|
1345
|
+
for (const e3 of s2) o2.push(new re(e3.createdAt, a2[e3.id], e3.referencedMessageId ? a2[e3.referencedMessageId] : null));
|
|
1276
1346
|
o2.sort((e3, t3) => t3.createdAt - e3.createdAt);
|
|
1277
1347
|
const u2 = (_b = (_a2 = t2 == null ? void 0 : t2.inWindow) == null ? void 0 : _a2[0]) == null ? void 0 : _b.messageId, l2 = (_c = o2 == null ? void 0 : o2[0]) == null ? void 0 : _c.messageId, h2 = u2 === l2 ? (_d = t2 == null ? void 0 : t2.lastMessageChanged) != null ? _d : e2 : e2;
|
|
1278
1348
|
if (null === n2) return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: null });
|
|
1279
1349
|
return c({ lastChanged: e2, lastMessageChanged: h2, stores: a2, inWindow: o2, windowEnd: { cursor: n2, oldestMessageTs: s2[s2.length - 1].createdAt } });
|
|
1280
1350
|
}
|
|
1281
|
-
function
|
|
1351
|
+
function ue(e2) {
|
|
1282
1352
|
if (e2.stores) {
|
|
1283
1353
|
const t2 = l("TERMINATED");
|
|
1284
1354
|
Object.values(e2.stores).forEach((e3) => e3.setError(t2)), e2.inWindow.forEach((e3) => e3.setError(t2));
|
|
1285
1355
|
}
|
|
1286
1356
|
}
|
|
1287
|
-
class
|
|
1288
|
-
constructor(e2, t2, s2, n2
|
|
1289
|
-
super(e2,
|
|
1357
|
+
class ce extends q {
|
|
1358
|
+
constructor(e2, t2, s2, n2) {
|
|
1359
|
+
super(e2, n2), this.conversationId = t2, this.realtimeClient = s2, this.unsubscribeDebounceMs = 5e3;
|
|
1290
1360
|
}
|
|
1291
1361
|
fetchInitial(e2) {
|
|
1292
1362
|
return __async(this, null, function* () {
|
|
@@ -1305,27 +1375,32 @@ class ue extends W {
|
|
|
1305
1375
|
var _a2;
|
|
1306
1376
|
(_a2 = e2.messageWindowStore) == null ? void 0 : _a2.unsubscribe();
|
|
1307
1377
|
}
|
|
1378
|
+
anyChildChanged(e2, t2, s2) {
|
|
1379
|
+
return __async(this, null, function* () {
|
|
1380
|
+
return true === (yield s2.messageWindowStore.store.lastMessageChangedBetween(e2, t2));
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1308
1383
|
equal(e2, t2) {
|
|
1309
|
-
return
|
|
1384
|
+
return O(e2.snapshot, t2.snapshot);
|
|
1310
1385
|
}
|
|
1311
1386
|
loadNested(e2, t2) {
|
|
1312
1387
|
return __async(this, null, function* () {
|
|
1313
1388
|
var _a2;
|
|
1314
|
-
if (!t2.snapshot) return c({
|
|
1389
|
+
if (!t2.snapshot) return c({ snapshot: null, loadedAll: true });
|
|
1315
1390
|
const s2 = yield t2.messageWindowStore.store.getDeep(e2);
|
|
1316
1391
|
if (!s2.ok) return s2;
|
|
1317
1392
|
const n2 = s2.value.snapshot, r2 = (_a2 = n2 == null ? void 0 : n2[0]) != null ? _a2 : null;
|
|
1318
|
-
return c({
|
|
1393
|
+
return c({ snapshot: __spreadProps(__spreadValues({}, t2.snapshot), { lastMessage: r2 }) });
|
|
1319
1394
|
});
|
|
1320
1395
|
}
|
|
1321
1396
|
participantEdited(e2, t2) {
|
|
1322
|
-
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) : c({ lastChanged: e2, snapshot:
|
|
1397
|
+
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) : c({ lastChanged: e2, snapshot: le(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1323
1398
|
}
|
|
1324
1399
|
conversationEdited(e2, t2) {
|
|
1325
|
-
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) : c({ lastChanged: e2, snapshot:
|
|
1400
|
+
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) : c({ lastChanged: e2, snapshot: le(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1326
1401
|
}
|
|
1327
1402
|
sideEdited(e2, t2) {
|
|
1328
|
-
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) : c({ lastChanged: e2, snapshot:
|
|
1403
|
+
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) : c({ lastChanged: e2, snapshot: le(s2.value.snapshot, t2.diff), messageWindowStore: s2.value.messageWindowStore }));
|
|
1329
1404
|
}
|
|
1330
1405
|
sideCreated(e2, t2) {
|
|
1331
1406
|
this.mutate(e2, (s2) => s2.value.snapshot ? s2 : c({ lastChanged: e2, snapshot: t2.state, messageWindowStore: s2.value.messageWindowStore }));
|
|
@@ -1335,30 +1410,30 @@ class ue extends W {
|
|
|
1335
1410
|
}
|
|
1336
1411
|
getFromCache() {
|
|
1337
1412
|
return __async(this, null, function* () {
|
|
1338
|
-
const e2 = yield this.
|
|
1413
|
+
const e2 = yield this.mostRecentState.resultPromise;
|
|
1339
1414
|
return e2.ok && e2.value.snapshot ? c({ status: 200, data: e2.value.snapshot }) : l("NOT_IN_CACHE");
|
|
1340
1415
|
});
|
|
1341
1416
|
}
|
|
1342
1417
|
}
|
|
1343
|
-
function
|
|
1418
|
+
function le(e2, t2) {
|
|
1344
1419
|
const s2 = t2;
|
|
1345
|
-
return { id: e2.id, createdAt: e2.createdAt, subject:
|
|
1420
|
+
return { id: e2.id, createdAt: e2.createdAt, subject: P(e2.subject, s2.subject), photoUrl: P(e2.photoUrl, s2.photoUrl), welcomeMessages: P(e2.welcomeMessages, s2.welcomeMessages), custom: _(e2.custom, s2.custom), lastMessageAt: P(e2.lastMessageAt, s2.lastMessageAt), unreadMessageCount: P(e2.unreadMessageCount, s2.unreadMessageCount), isUnread: P(e2.isUnread, s2.isUnread), access: P(e2.access, s2.access), notify: P(e2.notify, s2.notify), readUntil: P(e2.readUntil, s2.readUntil), everyoneReadUntil: P(e2.everyoneReadUntil, s2.everyoneReadUntil), joinedAt: e2.joinedAt };
|
|
1346
1421
|
}
|
|
1347
|
-
function
|
|
1422
|
+
function he(e2, t2) {
|
|
1348
1423
|
for (let s2 in e2) Object.prototype.hasOwnProperty.call(e2, s2) && t2(e2[s2], s2);
|
|
1349
1424
|
}
|
|
1350
|
-
function
|
|
1425
|
+
function de(e2, t2) {
|
|
1351
1426
|
return function(e3, t3) {
|
|
1352
1427
|
let s2 = {}, n2 = 0;
|
|
1353
|
-
return
|
|
1428
|
+
return he(e3, (e4, r2) => {
|
|
1354
1429
|
const [i2, a2] = t3([r2, e4], n2++);
|
|
1355
1430
|
s2[i2] = a2;
|
|
1356
1431
|
}), s2;
|
|
1357
1432
|
}(e2, ([e3, s2]) => [e3, t2(s2, e3)]);
|
|
1358
1433
|
}
|
|
1359
|
-
class
|
|
1360
|
-
constructor(e2, t2, s2, n2
|
|
1361
|
-
super(
|
|
1434
|
+
class pe extends q {
|
|
1435
|
+
constructor(e2, t2, s2, n2) {
|
|
1436
|
+
super(s2, n2), this.conversationId = e2, this.realtimeClient = t2, this.unsubscribeDebounceMs = 1e4;
|
|
1362
1437
|
}
|
|
1363
1438
|
fetchInitial(e2) {
|
|
1364
1439
|
return __async(this, null, function* () {
|
|
@@ -1368,11 +1443,11 @@ class de extends W {
|
|
|
1368
1443
|
if (!t2.ok) return t2;
|
|
1369
1444
|
const s2 = t2.value.data;
|
|
1370
1445
|
if (s2.many) return c({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1371
|
-
return c({ data: s2, userSubscriptions:
|
|
1446
|
+
return c({ data: s2, userSubscriptions: de(s2.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 });
|
|
1372
1447
|
});
|
|
1373
1448
|
}
|
|
1374
1449
|
equal(e2, t2) {
|
|
1375
|
-
return
|
|
1450
|
+
return O(e2.data, t2.data);
|
|
1376
1451
|
}
|
|
1377
1452
|
loadNested(e2, t2) {
|
|
1378
1453
|
return __async(this, null, function* () {
|
|
@@ -1385,7 +1460,7 @@ class de extends W {
|
|
|
1385
1460
|
});
|
|
1386
1461
|
}
|
|
1387
1462
|
typingAvailable(e2, t2) {
|
|
1388
|
-
this.mutate(e2, () => c({ data: t2.state, userSubscriptions: t2.state.many ? {} :
|
|
1463
|
+
this.mutate(e2, () => c({ data: t2.state, userSubscriptions: t2.state.many ? {} : de(t2.state.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3])), lastChanged: e2 }));
|
|
1389
1464
|
}
|
|
1390
1465
|
typingChanged(e2, t2) {
|
|
1391
1466
|
this.mutate(e2, (s2) => {
|
|
@@ -1393,7 +1468,7 @@ class de extends W {
|
|
|
1393
1468
|
if (void 0 === t2.diff.many) {
|
|
1394
1469
|
if (true === s2.value.data.many) return s2;
|
|
1395
1470
|
const n2 = __spreadValues({}, s2.value.data.usersTyping), r2 = __spreadValues({}, s2.value.userSubscriptions);
|
|
1396
|
-
return
|
|
1471
|
+
return he(t2.diff.usersTyping, (e3, t3) => {
|
|
1397
1472
|
var _a2;
|
|
1398
1473
|
"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]);
|
|
1399
1474
|
}), c({ data: { usersTyping: n2, many: false }, userSubscriptions: r2, lastChanged: e2 });
|
|
@@ -1401,7 +1476,7 @@ class de extends W {
|
|
|
1401
1476
|
if (true === t2.diff.many) return s2.value.data.many ? s2 : c({ data: { usersTyping: null, many: true }, userSubscriptions: {}, lastChanged: e2 });
|
|
1402
1477
|
if (false === t2.diff.many) {
|
|
1403
1478
|
if (false === s2.value.data.many) return s2;
|
|
1404
|
-
const n2 =
|
|
1479
|
+
const n2 = de(t2.diff.usersTyping, (e3, t3) => this.realtimeClient.internalSubscribe(["users", t3]));
|
|
1405
1480
|
return c({ data: t2.diff, userSubscriptions: n2, lastChanged: e2 });
|
|
1406
1481
|
}
|
|
1407
1482
|
throw t2.diff, "Unreachable";
|
|
@@ -1411,12 +1486,23 @@ class de extends W {
|
|
|
1411
1486
|
this.mutate(e2, (t3) => null === t3.value.data ? t3 : c({ data: null, lastChanged: e2 }));
|
|
1412
1487
|
}
|
|
1413
1488
|
teardownNested(e2) {
|
|
1414
|
-
e2.data &&
|
|
1489
|
+
e2.data && he(e2.userSubscriptions, (e3) => e3.unsubscribe());
|
|
1490
|
+
}
|
|
1491
|
+
anyChildChanged(e2, t2, s2) {
|
|
1492
|
+
return __async(this, null, function* () {
|
|
1493
|
+
var _a2;
|
|
1494
|
+
if (null === s2.data) return false;
|
|
1495
|
+
for (const n2 in s2.userSubscriptions) {
|
|
1496
|
+
const r2 = s2.userSubscriptions[n2];
|
|
1497
|
+
if (true === (yield (_a2 = r2 == null ? void 0 : r2.store) == null ? void 0 : _a2.changedBetween(e2, t2))) return true;
|
|
1498
|
+
}
|
|
1499
|
+
return false;
|
|
1500
|
+
});
|
|
1415
1501
|
}
|
|
1416
1502
|
}
|
|
1417
|
-
class
|
|
1503
|
+
class fe {
|
|
1418
1504
|
constructor(e2, t2, s2) {
|
|
1419
|
-
this.realtimeClient = s2, this.userStores = {}, this.messageWindowStores = {}, this.conversationStores = {}, this.typingStores = {}, this.emitMutex = new
|
|
1505
|
+
this.realtimeClient = s2, this.userStores = {}, this.messageWindowStores = {}, this.conversationStores = {}, this.typingStores = {}, this.emitMutex = new U(), this.seqOffset = 0, this.seqInThisConnection = 0, this.refetchOnNextNetworkLoss = true, this.connection = new N(e2, t2, { onUpstreamRestarting: () => {
|
|
1420
1506
|
this.refetchOnNextNetworkLoss = false;
|
|
1421
1507
|
}, onReady: () => {
|
|
1422
1508
|
this.refetchOnNextNetworkLoss = true;
|
|
@@ -1598,13 +1684,13 @@ class pe {
|
|
|
1598
1684
|
const t2 = e2[1];
|
|
1599
1685
|
if (Object.hasOwnProperty.call(this.userStores, t2)) return this.userStores[t2];
|
|
1600
1686
|
{
|
|
1601
|
-
this.connection.subscribe(["users", t2]).then((
|
|
1602
|
-
|
|
1687
|
+
this.connection.subscribe(["users", t2]).then((t3) => {
|
|
1688
|
+
t3.ok || e3.setError(t3);
|
|
1603
1689
|
});
|
|
1604
|
-
const e3 =
|
|
1690
|
+
const e3 = new G(t2, this.realtimeClient, this.emitMutex, () => {
|
|
1605
1691
|
delete this.userStores[t2], this.connection.unsubscribe(["users", t2]);
|
|
1606
1692
|
});
|
|
1607
|
-
return this.userStores[t2] =
|
|
1693
|
+
return this.userStores[t2] = e3, e3;
|
|
1608
1694
|
}
|
|
1609
1695
|
}
|
|
1610
1696
|
if (s(e2, ["me", "conversations", "*"])) {
|
|
@@ -1614,7 +1700,7 @@ class pe {
|
|
|
1614
1700
|
this.connection.subscribe(["me", "conversations", t2]).then((t3) => {
|
|
1615
1701
|
t3.ok || e3.setError(t3);
|
|
1616
1702
|
});
|
|
1617
|
-
const e3 = new
|
|
1703
|
+
const e3 = new ce(this.emitMutex, t2, this.realtimeClient, () => {
|
|
1618
1704
|
delete this.conversationStores[t2], this.connection.unsubscribe(["me", "conversations", t2]);
|
|
1619
1705
|
});
|
|
1620
1706
|
return this.conversationStores[t2] = e3, e3;
|
|
@@ -1627,7 +1713,7 @@ class pe {
|
|
|
1627
1713
|
this.connection.subscribe(["me", "conversations", t2, "messages"]).then((t3) => {
|
|
1628
1714
|
t3.ok || e3.setError(t3);
|
|
1629
1715
|
});
|
|
1630
|
-
const e3 = new
|
|
1716
|
+
const e3 = new ie(this.emitMutex, t2, this.realtimeClient, () => {
|
|
1631
1717
|
delete this.messageWindowStores[t2], this.connection.unsubscribe(["me", "conversations", t2, "messages"]);
|
|
1632
1718
|
});
|
|
1633
1719
|
return this.messageWindowStores[t2] = e3, e3;
|
|
@@ -1640,7 +1726,7 @@ class pe {
|
|
|
1640
1726
|
this.connection.subscribe(["me", "conversations", t2, "typing"]).then((t3) => {
|
|
1641
1727
|
t3.ok || e3.setError(t3);
|
|
1642
1728
|
});
|
|
1643
|
-
const e3 = new
|
|
1729
|
+
const e3 = new pe(t2, this.realtimeClient, this.emitMutex, () => {
|
|
1644
1730
|
delete this.typingStores[t2], this.connection.unsubscribe(["me", "conversations", t2, "typing"]);
|
|
1645
1731
|
});
|
|
1646
1732
|
return this.typingStores[t2] = e3, e3;
|
|
@@ -1671,9 +1757,9 @@ class pe {
|
|
|
1671
1757
|
return this.connection.isConnected();
|
|
1672
1758
|
}
|
|
1673
1759
|
}
|
|
1674
|
-
class
|
|
1760
|
+
class ge {
|
|
1675
1761
|
constructor(e2, t2, s2) {
|
|
1676
|
-
this.userId = t2, this.alive = true, this.connection = new
|
|
1762
|
+
this.userId = t2, this.alive = true, this.connection = new fe(e2, s2, this), s2.onTokenRefreshFailed(() => {
|
|
1677
1763
|
this.destroy();
|
|
1678
1764
|
});
|
|
1679
1765
|
}
|
|
@@ -1698,14 +1784,14 @@ class fe {
|
|
|
1698
1784
|
listMessages(e2, t2) {
|
|
1699
1785
|
return __async(this, null, function* () {
|
|
1700
1786
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages"], t2);
|
|
1701
|
-
if (!s2.ok) return
|
|
1787
|
+
if (!s2.ok) return me(s2, "Listing messages in " + e2);
|
|
1702
1788
|
const n2 = s2.value.data.data, r2 = yield Promise.all(n2.map((t3) => this.createMessageSnapshot(t3, e2))), i2 = r2.find((e3) => !e3.ok);
|
|
1703
1789
|
if (void 0 !== i2 && !i2.ok) return i2;
|
|
1704
1790
|
return c(r2.map(({ value: e3 }) => e3));
|
|
1705
1791
|
});
|
|
1706
1792
|
}
|
|
1707
1793
|
createConversationSnapshotPreloaded(e2, t2) {
|
|
1708
|
-
return { id: e2.id, subject: e2.subject, photoUrl: e2.photoUrl, welcomeMessages: e2.welcomeMessages, custom: e2.custom, createdAt: e2.createdAt, joinedAt: e2.joinedAt, lastMessageAt: e2.lastMessageAt, unreadMessageCount: e2.unreadMessageCount, isUnread: e2.isUnread, access: e2.access, notify: e2.notify, lastMessage: t2, readUntil: e2.readUntil };
|
|
1794
|
+
return { id: e2.id, subject: e2.subject, photoUrl: e2.photoUrl, welcomeMessages: e2.welcomeMessages, custom: e2.custom, createdAt: e2.createdAt, joinedAt: e2.joinedAt, lastMessageAt: e2.lastMessageAt, unreadMessageCount: e2.unreadMessageCount, isUnread: e2.isUnread, access: e2.access, notify: e2.notify, lastMessage: t2, readUntil: e2.readUntil, everyoneReadUntil: e2.everyoneReadUntil };
|
|
1709
1795
|
}
|
|
1710
1796
|
createUserSnapshot(e2) {
|
|
1711
1797
|
return { id: e2.id, name: e2.name, custom: e2.custom, locale: e2.locale, photoUrl: e2.photoUrl, role: e2.role, welcomeMessage: e2.welcomeMessage };
|
|
@@ -1727,7 +1813,7 @@ class fe {
|
|
|
1727
1813
|
const s2 = yield this.call("GET", ["me", "conversations", e2, "messages", t2], {});
|
|
1728
1814
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return c(null);
|
|
1729
1815
|
if (!s2.ok && "server" === s2.where && 403 === s2.value.status && "NOT_A_PARTICIPANT" === s2.value.errorCode) return c(null);
|
|
1730
|
-
if (!s2.ok) return
|
|
1816
|
+
if (!s2.ok) return me(s2, `Fetching referenced message ${t2} in conversation ${e2}`);
|
|
1731
1817
|
const n2 = s2.value.data, r2 = yield this.getUser(n2.senderId);
|
|
1732
1818
|
if (!r2.ok) return r2;
|
|
1733
1819
|
const i2 = r2.value;
|
|
@@ -1738,26 +1824,26 @@ class fe {
|
|
|
1738
1824
|
return __async(this, null, function* () {
|
|
1739
1825
|
const t2 = yield this.call("GET", ["users", e2], { includePrivateFields: false });
|
|
1740
1826
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return c(null);
|
|
1741
|
-
if (!t2.ok) return
|
|
1827
|
+
if (!t2.ok) return me(t2, "Get user " + e2);
|
|
1742
1828
|
return c(this.createUserSnapshot(t2.value.data));
|
|
1743
1829
|
});
|
|
1744
1830
|
}
|
|
1745
1831
|
createMessageSnapshotPreloaded(e2, t2, s2) {
|
|
1746
|
-
return { id: e2.id, type: e2.type, sender: t2, referencedMessage: s2, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, plaintext:
|
|
1832
|
+
return { id: e2.id, type: e2.type, sender: t2, referencedMessage: s2, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, plaintext: te(e2.content, {}) };
|
|
1747
1833
|
}
|
|
1748
1834
|
createReferencedMessageSnapshotPreloaded(e2, t2) {
|
|
1749
|
-
return { id: e2.id, type: e2.type, sender: t2, referencedMessageId: e2.referencedMessageId, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, plaintext:
|
|
1835
|
+
return { id: e2.id, type: e2.type, sender: t2, referencedMessageId: e2.referencedMessageId, custom: e2.custom, createdAt: e2.createdAt, editedAt: e2.editedAt, origin: e2.origin, content: e2.content, plaintext: te(e2.content, {}) };
|
|
1750
1836
|
}
|
|
1751
1837
|
}
|
|
1752
|
-
function
|
|
1838
|
+
function me(e2, t2) {
|
|
1753
1839
|
return "server" === e2.where ? h(__spreadProps(__spreadValues({}, e2.value), { operation: t2 })) : e2;
|
|
1754
1840
|
}
|
|
1755
|
-
function
|
|
1841
|
+
function ve(e2, s2) {
|
|
1756
1842
|
var _a2;
|
|
1757
1843
|
if (s2.ok) return s2.value;
|
|
1758
1844
|
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));
|
|
1759
1845
|
}
|
|
1760
|
-
class
|
|
1846
|
+
class be {
|
|
1761
1847
|
constructor(e2, t2) {
|
|
1762
1848
|
this.id = e2, this._realtimeClient = t2;
|
|
1763
1849
|
}
|
|
@@ -1767,7 +1853,7 @@ class ve {
|
|
|
1767
1853
|
get() {
|
|
1768
1854
|
return __async(this, null, function* () {
|
|
1769
1855
|
const e2 = yield this._realtimeClient.getUser(this.brandedId);
|
|
1770
|
-
return
|
|
1856
|
+
return ve("Get user " + this.id, e2);
|
|
1771
1857
|
});
|
|
1772
1858
|
}
|
|
1773
1859
|
set(t2) {
|
|
@@ -1788,7 +1874,7 @@ class ve {
|
|
|
1788
1874
|
return this._realtimeClient.subscribe(["users", this.brandedId], e2);
|
|
1789
1875
|
}
|
|
1790
1876
|
}
|
|
1791
|
-
class
|
|
1877
|
+
class ye {
|
|
1792
1878
|
constructor(e2, t2, s2) {
|
|
1793
1879
|
this.userId = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
1794
1880
|
}
|
|
@@ -1832,7 +1918,7 @@ class be {
|
|
|
1832
1918
|
});
|
|
1833
1919
|
}
|
|
1834
1920
|
}
|
|
1835
|
-
function
|
|
1921
|
+
function we(e2) {
|
|
1836
1922
|
const t2 = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz";
|
|
1837
1923
|
let s2 = 0;
|
|
1838
1924
|
const n2 = [], r2 = e2 === s2;
|
|
@@ -1850,7 +1936,7 @@ function ye(e2) {
|
|
|
1850
1936
|
if (20 != a2.length) throw new Error("Length should be 20.");
|
|
1851
1937
|
return a2;
|
|
1852
1938
|
}
|
|
1853
|
-
const
|
|
1939
|
+
const Ae = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
1854
1940
|
return e3.reduce((e4, s3, n2) => e4.concat(t3(s3, n2)), []);
|
|
1855
1941
|
}(e2, (e3) => {
|
|
1856
1942
|
if ("string" == typeof e3) return t2(e3, s2);
|
|
@@ -1863,14 +1949,14 @@ const we = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
1863
1949
|
case "bulletList":
|
|
1864
1950
|
case "bulletpoint":
|
|
1865
1951
|
case "bulletPoint":
|
|
1866
|
-
return [{ type: e3.type, children:
|
|
1952
|
+
return [{ type: e3.type, children: Ae(e3.children, t2, e3.type) }];
|
|
1867
1953
|
case "link":
|
|
1868
|
-
return [{ type: e3.type, url: e3.url, children:
|
|
1954
|
+
return [{ type: e3.type, url: e3.url, children: Ae(e3.children, t2, e3.type) }];
|
|
1869
1955
|
case "actionlink":
|
|
1870
1956
|
case "actionLink":
|
|
1871
1957
|
case "actionbutton":
|
|
1872
1958
|
case "actionButton":
|
|
1873
|
-
return [{ type: e3.type, action: e3.action, params: e3.params, children:
|
|
1959
|
+
return [{ type: e3.type, action: e3.action, params: e3.params, children: Ae(e3.children, t2, e3.type) }];
|
|
1874
1960
|
case "mention":
|
|
1875
1961
|
case "autolink":
|
|
1876
1962
|
case "autoLink":
|
|
@@ -1885,12 +1971,12 @@ const we = (e2, t2, s2 = void 0) => function(e3, t3) {
|
|
|
1885
1971
|
return [e3];
|
|
1886
1972
|
}
|
|
1887
1973
|
});
|
|
1888
|
-
function
|
|
1974
|
+
function Ce(e2, t2) {
|
|
1889
1975
|
return (s2) => {
|
|
1890
1976
|
const n2 = s2;
|
|
1891
1977
|
let r2 = 0;
|
|
1892
1978
|
const i2 = [];
|
|
1893
|
-
for (const a2 of
|
|
1979
|
+
for (const a2 of J(s2, e2)) {
|
|
1894
1980
|
a2.index - r2 > 0 && i2.push(n2.substring(r2, a2.index));
|
|
1895
1981
|
const e3 = t2(a2);
|
|
1896
1982
|
Array.isArray(e3) ? i2.push(...e3) : i2.push(e3), r2 = a2.index + a2[0].length;
|
|
@@ -1898,29 +1984,29 @@ function Ae(e2, t2) {
|
|
|
1898
1984
|
return r2 < s2.length && i2.push(s2.substring(r2)), i2;
|
|
1899
1985
|
};
|
|
1900
1986
|
}
|
|
1901
|
-
const
|
|
1902
|
-
var
|
|
1903
|
-
const
|
|
1987
|
+
const Ee = "’'()[]{}<>:,‒–—―…!.«»-‐?‘’“”;/⁄␠·&@*\\•^¤¢$€£¥₩₪†‡°¡¿¬#№%‰‱¶′§~¨_|¦⁂☞∴‽※".replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1988
|
+
var ke = ((e2) => (e2[e2.italic = 1] = "italic", e2[e2.strikethrough = 2] = "strikethrough", e2[e2.bold = 4] = "bold", e2))(ke || {});
|
|
1989
|
+
const xe = [0, 1, 2, 3, 4, 5, 6].map((e2) => {
|
|
1904
1990
|
const t2 = [];
|
|
1905
1991
|
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");
|
|
1906
|
-
}),
|
|
1907
|
-
function
|
|
1908
|
-
return
|
|
1992
|
+
}), Se = { _: 1, "*": 4, "~": 2 };
|
|
1993
|
+
function Te(e2) {
|
|
1994
|
+
return De(e2, 0);
|
|
1909
1995
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const s2 =
|
|
1912
|
-
const t3 =
|
|
1996
|
+
function De(e2, t2 = 0) {
|
|
1997
|
+
const s2 = xe[t2], n2 = s2 ? function(e3) {
|
|
1998
|
+
const t3 = Ie.getOrCompute(e3, () => new RegExp(`(?:^|[\\s${Ee}])(?:${e3.source})(?=[\\s${Ee}]|$)`, "g")), s3 = Ce(t3, (e4) => {
|
|
1913
1999
|
const t4 = e4[0][1], s4 = e4[1] || e4[2] || e4[3] || e4[4] || e4[5] || e4[6];
|
|
1914
|
-
return [" ", { type:
|
|
2000
|
+
return [" ", { type: ke[Se[t4]], children: [s4] }];
|
|
1915
2001
|
});
|
|
1916
2002
|
return (e4) => {
|
|
1917
2003
|
const [t4, ...n3] = s3(" " + e4);
|
|
1918
2004
|
return t4.length > 1 && n3.unshift(t4.substring(1)), n3;
|
|
1919
2005
|
};
|
|
1920
2006
|
}(s2) : () => [e2];
|
|
1921
|
-
return
|
|
2007
|
+
return Ae(n2(e2), (e3, s3) => "bold" === s3 || "italic" === s3 || "strikethrough" === s3 ? De(e3, t2 | ke[s3]) : [e3]);
|
|
1922
2008
|
}
|
|
1923
|
-
const
|
|
2009
|
+
const Ie = function() {
|
|
1924
2010
|
const e2 = function() {
|
|
1925
2011
|
try {
|
|
1926
2012
|
return /* @__PURE__ */ new WeakMap();
|
|
@@ -1936,18 +2022,18 @@ const De = function() {
|
|
|
1936
2022
|
return e2.set(t2, n2), n2;
|
|
1937
2023
|
} };
|
|
1938
2024
|
}();
|
|
1939
|
-
function
|
|
2025
|
+
function Fe(e2, t2) {
|
|
1940
2026
|
if (Array.prototype.indexOf) return e2.indexOf(t2);
|
|
1941
2027
|
for (var s2 = 0, n2 = e2.length; s2 < n2; s2++) if (e2[s2] === t2) return s2;
|
|
1942
2028
|
return -1;
|
|
1943
2029
|
}
|
|
1944
|
-
function
|
|
2030
|
+
function Be(e2, t2) {
|
|
1945
2031
|
for (var s2 = e2.length - 1; s2 >= 0; s2--) true === t2(e2[s2]) && e2.splice(s2, 1);
|
|
1946
2032
|
}
|
|
1947
|
-
function
|
|
2033
|
+
function Me(e2) {
|
|
1948
2034
|
throw new Error("Unhandled case for value: '" + e2 + "'");
|
|
1949
2035
|
}
|
|
1950
|
-
var
|
|
2036
|
+
var Re = function() {
|
|
1951
2037
|
function e2(e3) {
|
|
1952
2038
|
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 || "";
|
|
1953
2039
|
}
|
|
@@ -1966,11 +2052,11 @@ var Me = function() {
|
|
|
1966
2052
|
}, e2.prototype.setClass = function(e3) {
|
|
1967
2053
|
return this.setAttr("class", e3);
|
|
1968
2054
|
}, e2.prototype.addClass = function(e3) {
|
|
1969
|
-
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); t2 = i2.shift(); ) -1 ===
|
|
2055
|
+
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); t2 = i2.shift(); ) -1 === Fe(r2, t2) && r2.push(t2);
|
|
1970
2056
|
return this.getAttrs().class = r2.join(" "), this;
|
|
1971
2057
|
}, e2.prototype.removeClass = function(e3) {
|
|
1972
2058
|
for (var t2, s2 = this.getClass(), n2 = this.whitespaceRegex, r2 = s2 ? s2.split(n2) : [], i2 = e3.split(n2); r2.length && (t2 = i2.shift()); ) {
|
|
1973
|
-
var a2 =
|
|
2059
|
+
var a2 = Fe(r2, t2);
|
|
1974
2060
|
-1 !== a2 && r2.splice(a2, 1);
|
|
1975
2061
|
}
|
|
1976
2062
|
return this.getAttrs().class = r2.join(" "), this;
|
|
@@ -1996,12 +2082,12 @@ var Me = function() {
|
|
|
1996
2082
|
return t2.join(" ");
|
|
1997
2083
|
}, e2;
|
|
1998
2084
|
}();
|
|
1999
|
-
var
|
|
2085
|
+
var Ne = function() {
|
|
2000
2086
|
function e2(e3) {
|
|
2001
2087
|
void 0 === e3 && (e3 = {}), this.newWindow = false, this.truncate = {}, this.className = "", this.newWindow = e3.newWindow || false, this.truncate = e3.truncate || {}, this.className = e3.className || "";
|
|
2002
2088
|
}
|
|
2003
2089
|
return e2.prototype.build = function(e3) {
|
|
2004
|
-
return new
|
|
2090
|
+
return new Re({ tagName: "a", attrs: this.createAttrs(e3), innerHtml: this.processAnchorText(e3.getAnchorText()) });
|
|
2005
2091
|
}, e2.prototype.createAttrs = function(e3) {
|
|
2006
2092
|
var t2 = { href: e3.getAnchorHref() }, s2 = this.createCssClass(e3);
|
|
2007
2093
|
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;
|
|
@@ -2071,7 +2157,7 @@ var Re = function() {
|
|
|
2071
2157
|
}(e4, t3, s3);
|
|
2072
2158
|
}(e3, s2);
|
|
2073
2159
|
}, e2;
|
|
2074
|
-
}(),
|
|
2160
|
+
}(), Pe = function() {
|
|
2075
2161
|
function e2(e3) {
|
|
2076
2162
|
this.__jsduckDummyDocProp = null, this.matchedText = "", this.offset = 0, this.tagBuilder = e3.tagBuilder, this.matchedText = e3.matchedText, this.offset = e3.offset;
|
|
2077
2163
|
}
|
|
@@ -2099,12 +2185,12 @@ function Oe(e2, t2) {
|
|
|
2099
2185
|
}
|
|
2100
2186
|
_e(e2, t2), e2.prototype = null === t2 ? Object.create(t2) : (s2.prototype = t2.prototype, new s2());
|
|
2101
2187
|
}
|
|
2102
|
-
var
|
|
2103
|
-
return
|
|
2188
|
+
var Ue, je = function() {
|
|
2189
|
+
return je = Object.assign || function(e2) {
|
|
2104
2190
|
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]);
|
|
2105
2191
|
return e2;
|
|
2106
|
-
},
|
|
2107
|
-
},
|
|
2192
|
+
}, je.apply(this, arguments);
|
|
2193
|
+
}, $e = function(e2) {
|
|
2108
2194
|
function t2(t3) {
|
|
2109
2195
|
var s2 = e2.call(this, t3) || this;
|
|
2110
2196
|
return s2.email = "", s2.email = t3.email, s2;
|
|
@@ -2118,7 +2204,7 @@ var Pe, Ue = function() {
|
|
|
2118
2204
|
}, t2.prototype.getAnchorText = function() {
|
|
2119
2205
|
return this.email;
|
|
2120
2206
|
}, t2;
|
|
2121
|
-
}(
|
|
2207
|
+
}(Pe), We = function(e2) {
|
|
2122
2208
|
function t2(t3) {
|
|
2123
2209
|
var s2 = e2.call(this, t3) || this;
|
|
2124
2210
|
return s2.serviceName = "", s2.hashtag = "", s2.serviceName = t3.serviceName, s2.hashtag = t3.hashtag, s2;
|
|
@@ -2144,7 +2230,7 @@ var Pe, Ue = function() {
|
|
|
2144
2230
|
}, t2.prototype.getAnchorText = function() {
|
|
2145
2231
|
return "#" + this.hashtag;
|
|
2146
2232
|
}, t2;
|
|
2147
|
-
}(
|
|
2233
|
+
}(Pe), qe = function(e2) {
|
|
2148
2234
|
function t2(t3) {
|
|
2149
2235
|
var s2 = e2.call(this, t3) || this;
|
|
2150
2236
|
return s2.serviceName = "twitter", s2.mention = "", s2.mention = t3.mention, s2.serviceName = t3.serviceName, s2;
|
|
@@ -2172,7 +2258,7 @@ var Pe, Ue = function() {
|
|
|
2172
2258
|
var t3 = e2.prototype.getCssClassSuffixes.call(this), s2 = this.getServiceName();
|
|
2173
2259
|
return s2 && t3.push(s2), t3;
|
|
2174
2260
|
}, t2;
|
|
2175
|
-
}(
|
|
2261
|
+
}(Pe), He = function(e2) {
|
|
2176
2262
|
function t2(t3) {
|
|
2177
2263
|
var s2 = e2.call(this, t3) || this;
|
|
2178
2264
|
return s2.number = "", s2.plusSign = false, s2.number = t3.number, s2.plusSign = t3.plusSign, s2;
|
|
@@ -2188,7 +2274,7 @@ var Pe, Ue = function() {
|
|
|
2188
2274
|
}, t2.prototype.getAnchorText = function() {
|
|
2189
2275
|
return this.matchedText;
|
|
2190
2276
|
}, t2;
|
|
2191
|
-
}(
|
|
2277
|
+
}(Pe), Ge = function(e2) {
|
|
2192
2278
|
function t2(t3) {
|
|
2193
2279
|
var s2 = e2.call(this, t3) || this;
|
|
2194
2280
|
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;
|
|
@@ -2221,19 +2307,19 @@ var Pe, Ue = function() {
|
|
|
2221
2307
|
return t3;
|
|
2222
2308
|
}
|
|
2223
2309
|
}, t2;
|
|
2224
|
-
}(
|
|
2310
|
+
}(Pe), Le = function(e2) {
|
|
2225
2311
|
this.__jsduckDummyDocProp = null, this.tagBuilder = e2.tagBuilder;
|
|
2226
|
-
},
|
|
2227
|
-
return "(?=(" +
|
|
2228
|
-
},
|
|
2229
|
-
return "(?:" +
|
|
2230
|
-
}, at = new RegExp("[" + tt + "]"), ot = /(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, ut = new RegExp("[" + tt + "!#$%&'*+/=?^_`{|}~-]"), ct = new RegExp("^" + ot.source + "$"), lt = function(e2) {
|
|
2312
|
+
}, ze = /[A-Za-z]/, Je = /[\d]/, Ye = /[\D]/, Qe = /\s/, Ve = /['"]/, Ze = /[\x00-\x1F\x7F]/, Ke = /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, Xe = Ke + /\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, et = /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, tt = Xe + et, st = Xe + et, nt = "(?:[" + et + "]{1,3}\\.){3}[" + et + "]{1,3}", rt = "[" + st + "](?:[" + st + "\\-]{0,61}[" + st + "])?", it = function(e2) {
|
|
2313
|
+
return "(?=(" + rt + "))\\" + e2;
|
|
2314
|
+
}, at = function(e2) {
|
|
2315
|
+
return "(?:" + it(e2) + "(?:\\." + it(e2 + 1) + "){0,126}|" + nt + ")";
|
|
2316
|
+
}, ot = new RegExp("[" + st + "]"), ut = /(?: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|ελ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|工行|广东|微博|慈善|手机|手表|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|珠宝|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/, ct = new RegExp("[" + st + "!#$%&'*+/=?^_`{|}~-]"), lt = new RegExp("^" + ut.source + "$"), ht = function(e2) {
|
|
2231
2317
|
function t2() {
|
|
2232
2318
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2233
|
-
return t3.localPartCharRegex =
|
|
2319
|
+
return t3.localPartCharRegex = ct, t3.strictTldRegex = lt, t3;
|
|
2234
2320
|
}
|
|
2235
2321
|
return Oe(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2236
|
-
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], i2 = e3.length, a2 = new
|
|
2322
|
+
for (var t3 = this.tagBuilder, s2 = this.localPartCharRegex, n2 = this.strictTldRegex, r2 = [], i2 = e3.length, a2 = new dt(), o2 = { m: "a", a: "i", i: "l", l: "t", t: "o", o: ":" }, u2 = 0, c2 = 0, l2 = a2; u2 < i2; ) {
|
|
2237
2323
|
var h2 = e3.charAt(u2);
|
|
2238
2324
|
switch (c2) {
|
|
2239
2325
|
case 0:
|
|
@@ -2261,7 +2347,7 @@ var Pe, Ue = function() {
|
|
|
2261
2347
|
y2(h2);
|
|
2262
2348
|
break;
|
|
2263
2349
|
default:
|
|
2264
|
-
|
|
2350
|
+
Me(c2);
|
|
2265
2351
|
}
|
|
2266
2352
|
u2++;
|
|
2267
2353
|
}
|
|
@@ -2270,7 +2356,7 @@ var Pe, Ue = function() {
|
|
|
2270
2356
|
"m" === e4 ? w2(1) : s2.test(e4) && w2();
|
|
2271
2357
|
}
|
|
2272
2358
|
function p2(e4, t4) {
|
|
2273
|
-
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new
|
|
2359
|
+
":" === e4 ? s2.test(t4) ? (c2 = 2, l2 = new dt(je(je({}, l2), { hasMailtoPrefix: true }))) : A2() : o2[e4] === t4 || (s2.test(t4) ? c2 = 2 : "." === t4 ? c2 = 3 : "@" === t4 ? c2 = 4 : A2());
|
|
2274
2360
|
}
|
|
2275
2361
|
function f2(e4) {
|
|
2276
2362
|
"." === e4 ? c2 = 3 : "@" === e4 ? c2 = 4 : s2.test(e4) || A2();
|
|
@@ -2279,19 +2365,19 @@ var Pe, Ue = function() {
|
|
|
2279
2365
|
"." === e4 || "@" === e4 ? A2() : s2.test(e4) ? c2 = 2 : A2();
|
|
2280
2366
|
}
|
|
2281
2367
|
function m2(e4) {
|
|
2282
|
-
|
|
2368
|
+
ot.test(e4) ? c2 = 5 : A2();
|
|
2283
2369
|
}
|
|
2284
2370
|
function v2(e4) {
|
|
2285
|
-
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 :
|
|
2371
|
+
"." === e4 ? c2 = 7 : "-" === e4 ? c2 = 6 : ot.test(e4) || C2();
|
|
2286
2372
|
}
|
|
2287
2373
|
function b2(e4) {
|
|
2288
|
-
"-" === e4 || "." === e4 ? C2() :
|
|
2374
|
+
"-" === e4 || "." === e4 ? C2() : ot.test(e4) ? c2 = 5 : C2();
|
|
2289
2375
|
}
|
|
2290
2376
|
function y2(e4) {
|
|
2291
|
-
"." === e4 || "-" === e4 ? C2() :
|
|
2377
|
+
"." === e4 || "-" === e4 ? C2() : ot.test(e4) ? (c2 = 5, l2 = new dt(je(je({}, l2), { hasDomainDot: true }))) : C2();
|
|
2292
2378
|
}
|
|
2293
2379
|
function w2(e4) {
|
|
2294
|
-
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new
|
|
2380
|
+
void 0 === e4 && (e4 = 2), c2 = e4, l2 = new dt({ idx: u2 });
|
|
2295
2381
|
}
|
|
2296
2382
|
function A2() {
|
|
2297
2383
|
c2 = 0, l2 = a2;
|
|
@@ -2304,14 +2390,14 @@ var Pe, Ue = function() {
|
|
|
2304
2390
|
(function(e4) {
|
|
2305
2391
|
var t4 = e4.split(".").pop() || "", s4 = t4.toLowerCase();
|
|
2306
2392
|
return n2.test(s4);
|
|
2307
|
-
})(i3) && r2.push(new
|
|
2393
|
+
})(i3) && r2.push(new $e({ tagBuilder: t3, matchedText: s3, offset: l2.idx, email: i3 }));
|
|
2308
2394
|
}
|
|
2309
2395
|
A2();
|
|
2310
2396
|
}
|
|
2311
2397
|
}, t2;
|
|
2312
|
-
}(
|
|
2398
|
+
}(Le), dt = function(e2) {
|
|
2313
2399
|
void 0 === e2 && (e2 = {}), this.idx = void 0 !== e2.idx ? e2.idx : -1, this.hasMailtoPrefix = !!e2.hasMailtoPrefix, this.hasDomainDot = !!e2.hasDomainDot;
|
|
2314
|
-
},
|
|
2400
|
+
}, pt = function() {
|
|
2315
2401
|
function e2() {
|
|
2316
2402
|
}
|
|
2317
2403
|
return e2.isValid = function(e3, t2) {
|
|
@@ -2329,16 +2415,16 @@ var Pe, Ue = function() {
|
|
|
2329
2415
|
return !(!e3 || t2 && this.hasFullProtocolRegex.test(t2) || -1 !== e3.indexOf("."));
|
|
2330
2416
|
}, e2.urlMatchDoesNotHaveAtLeastOneWordChar = function(e3, t2) {
|
|
2331
2417
|
return !(!e3 || !t2) && (!this.hasFullProtocolRegex.test(t2) && !this.hasWordCharAfterProtocolRegex.test(e3));
|
|
2332
|
-
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" +
|
|
2333
|
-
}(),
|
|
2418
|
+
}, e2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//, e2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/, e2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + Ke + "]"), 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;
|
|
2419
|
+
}(), ft = (Ue = new RegExp("[/?#](?:[" + st + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^✓]*[" + st + "\\-+&@#/%=~_()|'$*\\[\\]{}✓])?"), new RegExp(["(?:", "(", /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/.source, at(2), ")", "|", "(", "(//)?", /(?:www\.)/.source, at(6), ")", "|", "(", "(//)?", at(10) + "\\.", ut.source, "(?![-" + tt + "])", ")", ")", "(?::[0-9]+)?", "(?:" + Ue.source + ")?"].join(""), "gi")), gt = new RegExp("[" + st + "]"), mt = function(e2) {
|
|
2334
2420
|
function t2(t3) {
|
|
2335
2421
|
var s2 = e2.call(this, t3) || this;
|
|
2336
|
-
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex =
|
|
2422
|
+
return s2.stripPrefix = { scheme: true, www: true }, s2.stripTrailingSlash = true, s2.decodePercentEncoding = true, s2.matcherRegex = ft, s2.wordCharRegExp = gt, s2.stripPrefix = t3.stripPrefix, s2.stripTrailingSlash = t3.stripTrailingSlash, s2.decodePercentEncoding = t3.decodePercentEncoding, s2;
|
|
2337
2423
|
}
|
|
2338
2424
|
return Oe(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2339
2425
|
for (var t3, s2 = this.matcherRegex, n2 = this.stripPrefix, r2 = this.stripTrailingSlash, i2 = this.decodePercentEncoding, a2 = this.tagBuilder, o2 = [], u2 = function() {
|
|
2340
2426
|
var s3 = t3[0], u3 = t3[1], l2 = t3[4], h2 = t3[5], d2 = t3[9], p2 = t3.index, f2 = h2 || d2, g2 = e3.charAt(p2 - 1);
|
|
2341
|
-
if (!
|
|
2427
|
+
if (!pt.isValid(s3, u3)) return "continue";
|
|
2342
2428
|
if (p2 > 0 && "@" === g2) return "continue";
|
|
2343
2429
|
if (p2 > 0 && f2 && c2.wordCharRegExp.test(g2)) return "continue";
|
|
2344
2430
|
if (/\?$/.test(s3) && (s3 = s3.substr(0, s3.length - 1)), c2.matchHasUnbalancedClosingParen(s3)) s3 = s3.substr(0, s3.length - 1);
|
|
@@ -2354,7 +2440,7 @@ var Pe, Ue = function() {
|
|
|
2354
2440
|
s3 = s3.substr(b2), u3 = u3.substr(b2), p2 += b2;
|
|
2355
2441
|
}
|
|
2356
2442
|
var y2 = u3 ? "scheme" : l2 ? "www" : "tld", w2 = !!u3;
|
|
2357
|
-
o2.push(new
|
|
2443
|
+
o2.push(new Ge({ tagBuilder: a2, matchedText: s3, offset: p2, urlMatchType: y2, url: s3, protocolUrlMatch: w2, protocolRelativeMatch: !!f2, stripPrefix: n2, stripTrailingSlash: r2, decodePercentEncoding: i2 }));
|
|
2358
2444
|
}, c2 = this; null !== (t3 = s2.exec(e3)); ) u2();
|
|
2359
2445
|
return o2;
|
|
2360
2446
|
}, t2.prototype.matchHasUnbalancedClosingParen = function(e3) {
|
|
@@ -2374,42 +2460,42 @@ var Pe, Ue = function() {
|
|
|
2374
2460
|
if (!e3) return -1;
|
|
2375
2461
|
var s2 = 0;
|
|
2376
2462
|
t3 && (s2 = e3.indexOf(":"), e3 = e3.slice(s2));
|
|
2377
|
-
var n2 = new RegExp("^((.?//)?[-." +
|
|
2463
|
+
var n2 = new RegExp("^((.?//)?[-." + st + "]*[-" + st + "]\\.[-" + st + "]+)").exec(e3);
|
|
2378
2464
|
return null === n2 ? -1 : (s2 += n2[1].length, e3 = e3.slice(n2[1].length), /^[^-.A-Za-z0-9:\/?#]/.test(e3) ? s2 : -1);
|
|
2379
2465
|
}, t2;
|
|
2380
|
-
}(
|
|
2466
|
+
}(Le), vt = new RegExp("#[_" + st + "]{1,139}(?![_" + st + "])", "g"), bt = new RegExp("[^" + st + "]"), yt = function(e2) {
|
|
2381
2467
|
function t2(t3) {
|
|
2382
2468
|
var s2 = e2.call(this, t3) || this;
|
|
2383
|
-
return s2.serviceName = "twitter", s2.matcherRegex =
|
|
2469
|
+
return s2.serviceName = "twitter", s2.matcherRegex = vt, s2.nonWordCharRegex = bt, s2.serviceName = t3.serviceName, s2;
|
|
2384
2470
|
}
|
|
2385
2471
|
return Oe(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2386
2472
|
for (var t3, s2 = this.matcherRegex, n2 = this.nonWordCharRegex, r2 = this.serviceName, i2 = this.tagBuilder, a2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2387
2473
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2388
2474
|
if (0 === o2 || n2.test(u2)) {
|
|
2389
2475
|
var c2 = t3[0], l2 = t3[0].slice(1);
|
|
2390
|
-
a2.push(new
|
|
2476
|
+
a2.push(new We({ tagBuilder: i2, matchedText: c2, offset: o2, serviceName: r2, hashtag: l2 }));
|
|
2391
2477
|
}
|
|
2392
2478
|
}
|
|
2393
2479
|
return a2;
|
|
2394
2480
|
}, t2;
|
|
2395
|
-
}(
|
|
2481
|
+
}(Le), wt = 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"), At = function(e2) {
|
|
2396
2482
|
function t2() {
|
|
2397
2483
|
var t3 = null !== e2 && e2.apply(this, arguments) || this;
|
|
2398
|
-
return t3.matcherRegex =
|
|
2484
|
+
return t3.matcherRegex = wt, t3;
|
|
2399
2485
|
}
|
|
2400
2486
|
return Oe(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2401
2487
|
for (var t3, s2 = this.matcherRegex, n2 = this.tagBuilder, r2 = []; null !== (t3 = s2.exec(e3)); ) {
|
|
2402
2488
|
var i2 = t3[0], a2 = i2.replace(/[^0-9,;#]/g, ""), o2 = !(!t3[1] && !t3[2]), u2 = 0 == t3.index ? "" : e3.substr(t3.index - 1, 1), c2 = e3.substr(t3.index + i2.length, 1), l2 = !u2.match(/\d/) && !c2.match(/\d/);
|
|
2403
|
-
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new
|
|
2489
|
+
this.testMatch(t3[3]) && this.testMatch(i2) && l2 && r2.push(new He({ tagBuilder: n2, matchedText: i2, offset: t3.index, number: a2, plusSign: o2 }));
|
|
2404
2490
|
}
|
|
2405
2491
|
return r2;
|
|
2406
2492
|
}, t2.prototype.testMatch = function(e3) {
|
|
2407
|
-
return
|
|
2493
|
+
return Ye.test(e3);
|
|
2408
2494
|
}, t2;
|
|
2409
|
-
}(
|
|
2495
|
+
}(Le), Ct = new RegExp("@[_" + st + "]{1,50}(?![_" + st + "])", "g"), Et = new RegExp("@[_." + st + "]{1,30}(?![_" + st + "])", "g"), kt = new RegExp("@[-_." + st + "]{1,50}(?![-_" + st + "])", "g"), xt = new RegExp("[^" + st + "]"), St = function(e2) {
|
|
2410
2496
|
function t2(t3) {
|
|
2411
2497
|
var s2 = e2.call(this, t3) || this;
|
|
2412
|
-
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter:
|
|
2498
|
+
return s2.serviceName = "twitter", s2.matcherRegexes = { twitter: Ct, instagram: Et, soundcloud: kt }, s2.nonWordCharRegex = xt, s2.serviceName = t3.serviceName, s2;
|
|
2413
2499
|
}
|
|
2414
2500
|
return Oe(t2, e2), t2.prototype.parseMatches = function(e3) {
|
|
2415
2501
|
var t3, s2 = this.serviceName, n2 = this.matcherRegexes[this.serviceName], r2 = this.nonWordCharRegex, i2 = this.tagBuilder, a2 = [];
|
|
@@ -2418,14 +2504,14 @@ var Pe, Ue = function() {
|
|
|
2418
2504
|
var o2 = t3.index, u2 = e3.charAt(o2 - 1);
|
|
2419
2505
|
if (0 === o2 || r2.test(u2)) {
|
|
2420
2506
|
var c2 = t3[0].replace(/\.+$/g, ""), l2 = c2.slice(1);
|
|
2421
|
-
a2.push(new
|
|
2507
|
+
a2.push(new qe({ tagBuilder: i2, matchedText: c2, offset: o2, serviceName: s2, mention: l2 }));
|
|
2422
2508
|
}
|
|
2423
2509
|
}
|
|
2424
2510
|
return a2;
|
|
2425
2511
|
}, t2;
|
|
2426
|
-
}(
|
|
2427
|
-
function
|
|
2428
|
-
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, i2 = t2.onText, a2 = t2.onComment, o2 = t2.onDoctype, u2 = new
|
|
2512
|
+
}(Le);
|
|
2513
|
+
function Tt(e2, t2) {
|
|
2514
|
+
for (var s2, n2 = t2.onOpenTag, r2 = t2.onCloseTag, i2 = t2.onText, a2 = t2.onComment, o2 = t2.onDoctype, u2 = new Dt(), c2 = 0, l2 = e2.length, h2 = 0, d2 = 0, p2 = u2; c2 < l2; ) {
|
|
2429
2515
|
var f2 = e2.charAt(c2);
|
|
2430
2516
|
switch (h2) {
|
|
2431
2517
|
case 0:
|
|
@@ -2489,36 +2575,36 @@ function St(e2, t2) {
|
|
|
2489
2575
|
N2(f2);
|
|
2490
2576
|
break;
|
|
2491
2577
|
case 20:
|
|
2492
|
-
|
|
2578
|
+
P2(f2);
|
|
2493
2579
|
break;
|
|
2494
2580
|
default:
|
|
2495
|
-
|
|
2581
|
+
Me(h2);
|
|
2496
2582
|
}
|
|
2497
2583
|
c2++;
|
|
2498
2584
|
}
|
|
2499
2585
|
function g2(e3) {
|
|
2500
|
-
"<" === e3 &&
|
|
2586
|
+
"<" === e3 && O2();
|
|
2501
2587
|
}
|
|
2502
2588
|
function m2(e3) {
|
|
2503
|
-
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new
|
|
2589
|
+
"!" === e3 ? h2 = 13 : "/" === e3 ? (h2 = 2, p2 = new Dt(je(je({}, p2), { isClosing: true }))) : "<" === e3 ? O2() : ze.test(e3) ? (h2 = 3, p2 = new Dt(je(je({}, p2), { isOpening: true }))) : (h2 = 0, p2 = u2);
|
|
2504
2590
|
}
|
|
2505
2591
|
function v2(e3) {
|
|
2506
|
-
|
|
2592
|
+
Qe.test(e3) ? (p2 = new Dt(je(je({}, p2), { name: j2() })), h2 = 4) : "<" === e3 ? O2() : "/" === e3 ? (p2 = new Dt(je(je({}, p2), { name: j2() })), h2 = 12) : ">" === e3 ? (p2 = new Dt(je(je({}, p2), { name: j2() })), U2()) : ze.test(e3) || Je.test(e3) || ":" === e3 || _2();
|
|
2507
2593
|
}
|
|
2508
2594
|
function b2(e3) {
|
|
2509
|
-
">" === e3 ?
|
|
2595
|
+
">" === e3 ? _2() : ze.test(e3) ? h2 = 3 : _2();
|
|
2510
2596
|
}
|
|
2511
2597
|
function y2(e3) {
|
|
2512
|
-
|
|
2598
|
+
Qe.test(e3) || ("/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : "=" === e3 || Ve.test(e3) || Ze.test(e3) ? _2() : h2 = 5);
|
|
2513
2599
|
}
|
|
2514
2600
|
function w2(e3) {
|
|
2515
|
-
|
|
2601
|
+
Qe.test(e3) ? h2 = 6 : "/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : Ve.test(e3) && _2();
|
|
2516
2602
|
}
|
|
2517
2603
|
function A2(e3) {
|
|
2518
|
-
|
|
2604
|
+
Qe.test(e3) || ("/" === e3 ? h2 = 12 : "=" === e3 ? h2 = 7 : ">" === e3 ? U2() : "<" === e3 ? O2() : Ve.test(e3) ? _2() : h2 = 5);
|
|
2519
2605
|
}
|
|
2520
2606
|
function C2(e3) {
|
|
2521
|
-
|
|
2607
|
+
Qe.test(e3) || ('"' === e3 ? h2 = 8 : "'" === e3 ? h2 = 9 : /[>=`]/.test(e3) ? _2() : "<" === e3 ? O2() : h2 = 10);
|
|
2522
2608
|
}
|
|
2523
2609
|
function E2(e3) {
|
|
2524
2610
|
'"' === e3 && (h2 = 11);
|
|
@@ -2527,22 +2613,22 @@ function St(e2, t2) {
|
|
|
2527
2613
|
"'" === e3 && (h2 = 11);
|
|
2528
2614
|
}
|
|
2529
2615
|
function x2(e3) {
|
|
2530
|
-
|
|
2616
|
+
Qe.test(e3) ? h2 = 4 : ">" === e3 ? U2() : "<" === e3 && O2();
|
|
2531
2617
|
}
|
|
2532
2618
|
function S2(e3) {
|
|
2533
|
-
|
|
2619
|
+
Qe.test(e3) ? h2 = 4 : "/" === e3 ? h2 = 12 : ">" === e3 ? U2() : "<" === e3 ? O2() : (h2 = 4, c2--);
|
|
2534
2620
|
}
|
|
2535
2621
|
function T2(e3) {
|
|
2536
|
-
">" === e3 ? (p2 = new
|
|
2622
|
+
">" === e3 ? (p2 = new Dt(je(je({}, p2), { isClosing: true })), U2()) : h2 = 4;
|
|
2537
2623
|
}
|
|
2538
2624
|
function D2(t3) {
|
|
2539
|
-
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new
|
|
2625
|
+
"--" === e2.substr(c2, 2) ? (c2 += 2, p2 = new Dt(je(je({}, p2), { type: "comment" })), h2 = 14) : "DOCTYPE" === e2.substr(c2, 7).toUpperCase() ? (c2 += 7, p2 = new Dt(je(je({}, p2), { type: "doctype" })), h2 = 20) : _2();
|
|
2540
2626
|
}
|
|
2541
2627
|
function I2(e3) {
|
|
2542
|
-
"-" === e3 ? h2 = 15 : ">" === e3 ?
|
|
2628
|
+
"-" === e3 ? h2 = 15 : ">" === e3 ? _2() : h2 = 16;
|
|
2543
2629
|
}
|
|
2544
2630
|
function F2(e3) {
|
|
2545
|
-
"-" === e3 ? h2 = 18 : ">" === e3 ?
|
|
2631
|
+
"-" === e3 ? h2 = 18 : ">" === e3 ? _2() : h2 = 16;
|
|
2546
2632
|
}
|
|
2547
2633
|
function B2(e3) {
|
|
2548
2634
|
"-" === e3 && (h2 = 17);
|
|
@@ -2556,18 +2642,18 @@ function St(e2, t2) {
|
|
|
2556
2642
|
function N2(e3) {
|
|
2557
2643
|
"-" === e3 ? h2 = 17 : ">" === e3 ? U2() : h2 = 16;
|
|
2558
2644
|
}
|
|
2559
|
-
function
|
|
2560
|
-
">" === e3 ? U2() : "<" === e3 &&
|
|
2645
|
+
function P2(e3) {
|
|
2646
|
+
">" === e3 ? U2() : "<" === e3 && O2();
|
|
2561
2647
|
}
|
|
2562
|
-
function
|
|
2648
|
+
function _2() {
|
|
2563
2649
|
h2 = 0, p2 = u2;
|
|
2564
2650
|
}
|
|
2565
|
-
function
|
|
2566
|
-
h2 = 1, p2 = new
|
|
2651
|
+
function O2() {
|
|
2652
|
+
h2 = 1, p2 = new Dt({ idx: c2 });
|
|
2567
2653
|
}
|
|
2568
2654
|
function U2() {
|
|
2569
2655
|
var t3 = e2.slice(d2, p2.idx);
|
|
2570
|
-
t3 && i2(t3, d2), "comment" === p2.type ? a2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)),
|
|
2656
|
+
t3 && i2(t3, d2), "comment" === p2.type ? a2(p2.idx) : "doctype" === p2.type ? o2(p2.idx) : (p2.isOpening && n2(p2.name, p2.idx), p2.isClosing && r2(p2.name, p2.idx)), _2(), d2 = c2 + 1;
|
|
2571
2657
|
}
|
|
2572
2658
|
function j2() {
|
|
2573
2659
|
var t3 = p2.idx + (p2.isClosing ? 2 : 1);
|
|
@@ -2575,9 +2661,9 @@ function St(e2, t2) {
|
|
|
2575
2661
|
}
|
|
2576
2662
|
d2 < c2 && (s2 = e2.slice(d2, c2), i2(s2, d2), d2 = c2 + 1);
|
|
2577
2663
|
}
|
|
2578
|
-
var
|
|
2664
|
+
var Dt = function(e2) {
|
|
2579
2665
|
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;
|
|
2580
|
-
},
|
|
2666
|
+
}, It = function() {
|
|
2581
2667
|
function e2(t2) {
|
|
2582
2668
|
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;
|
|
2583
2669
|
var s2 = this.mention;
|
|
@@ -2601,7 +2687,7 @@ var Tt = function(e2) {
|
|
|
2601
2687
|
}(e3 || {}, { length: Number.POSITIVE_INFINITY, location: "end" });
|
|
2602
2688
|
}, e2.prototype.parse = function(e3) {
|
|
2603
2689
|
var t2 = this, s2 = ["a", "style", "script"], n2 = 0, r2 = [];
|
|
2604
|
-
return
|
|
2690
|
+
return Tt(e3, { onOpenTag: function(e4) {
|
|
2605
2691
|
s2.indexOf(e4) >= 0 && n2++;
|
|
2606
2692
|
}, onText: function(e4, s3) {
|
|
2607
2693
|
if (0 === n2) {
|
|
@@ -2640,19 +2726,19 @@ var Tt = function(e2) {
|
|
|
2640
2726
|
}
|
|
2641
2727
|
return e3;
|
|
2642
2728
|
}, e2.prototype.removeUnwantedMatches = function(e3) {
|
|
2643
|
-
return this.hashtag ||
|
|
2729
|
+
return this.hashtag || Be(e3, function(e4) {
|
|
2644
2730
|
return "hashtag" === e4.getType();
|
|
2645
|
-
}), this.email ||
|
|
2731
|
+
}), this.email || Be(e3, function(e4) {
|
|
2646
2732
|
return "email" === e4.getType();
|
|
2647
|
-
}), this.phone ||
|
|
2733
|
+
}), this.phone || Be(e3, function(e4) {
|
|
2648
2734
|
return "phone" === e4.getType();
|
|
2649
|
-
}), this.mention ||
|
|
2735
|
+
}), this.mention || Be(e3, function(e4) {
|
|
2650
2736
|
return "mention" === e4.getType();
|
|
2651
|
-
}), this.urls.schemeMatches ||
|
|
2737
|
+
}), this.urls.schemeMatches || Be(e3, function(e4) {
|
|
2652
2738
|
return "url" === e4.getType() && "scheme" === e4.getUrlMatchType();
|
|
2653
|
-
}), this.urls.wwwMatches ||
|
|
2739
|
+
}), this.urls.wwwMatches || Be(e3, function(e4) {
|
|
2654
2740
|
return "url" === e4.getType() && "www" === e4.getUrlMatchType();
|
|
2655
|
-
}), this.urls.tldMatches ||
|
|
2741
|
+
}), this.urls.tldMatches || Be(e3, function(e4) {
|
|
2656
2742
|
return "url" === e4.getType() && "tld" === e4.getUrlMatchType();
|
|
2657
2743
|
}), e3;
|
|
2658
2744
|
}, e2.prototype.parseText = function(e3, t2) {
|
|
@@ -2672,31 +2758,31 @@ var Tt = function(e2) {
|
|
|
2672
2758
|
return s2.push(e3.substring(n2)), s2.join("");
|
|
2673
2759
|
}, e2.prototype.createMatchReturnVal = function(e3) {
|
|
2674
2760
|
var t2;
|
|
2675
|
-
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof
|
|
2761
|
+
return this.replaceFn && (t2 = this.replaceFn.call(this.context, e3)), "string" == typeof t2 ? t2 : false === t2 ? e3.getMatchedText() : t2 instanceof Re ? t2.toAnchorString() : e3.buildTag().toAnchorString();
|
|
2676
2762
|
}, e2.prototype.getMatchers = function() {
|
|
2677
2763
|
if (this.matchers) return this.matchers;
|
|
2678
|
-
var e3 = this.getTagBuilder(), t2 = [new
|
|
2764
|
+
var e3 = this.getTagBuilder(), t2 = [new yt({ tagBuilder: e3, serviceName: this.hashtag }), new ht({ tagBuilder: e3 }), new At({ tagBuilder: e3 }), new St({ tagBuilder: e3, serviceName: this.mention }), new mt({ tagBuilder: e3, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })];
|
|
2679
2765
|
return this.matchers = t2;
|
|
2680
2766
|
}, e2.prototype.getTagBuilder = function() {
|
|
2681
2767
|
var e3 = this.tagBuilder;
|
|
2682
|
-
return e3 || (e3 = this.tagBuilder = new
|
|
2683
|
-
}, e2.version = "3.14.3", e2.AnchorTagBuilder =
|
|
2768
|
+
return e3 || (e3 = this.tagBuilder = new Ne({ newWindow: this.newWindow, truncate: this.truncate, className: this.className })), e3;
|
|
2769
|
+
}, e2.version = "3.14.3", e2.AnchorTagBuilder = Ne, e2.HtmlTag = Re, e2.matcher = { Email: ht, Hashtag: yt, Matcher: Le, Mention: St, Phone: At, Url: mt }, e2.match = { Email: $e, Hashtag: We, Match: Pe, Mention: qe, Phone: He, Url: Ge }, e2;
|
|
2684
2770
|
}();
|
|
2685
|
-
function
|
|
2771
|
+
function Ft(e2, t2 = e2) {
|
|
2686
2772
|
return { type: "autolink", url: e2, text: t2 };
|
|
2687
2773
|
}
|
|
2688
|
-
const
|
|
2774
|
+
const Bt = Ce(/<!!mention:([^>\s]*?)\|(.*?)>/gm, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3) {
|
|
2689
2775
|
return { type: "mention", id: e3, text: t3 };
|
|
2690
|
-
}(decodeURIComponent(t2), s2)),
|
|
2776
|
+
}(decodeURIComponent(t2), s2)), Mt = Ce(/<!!customemoji:(.*?)>/gm, ([e2, t2]) => /* @__PURE__ */ function(e3) {
|
|
2691
2777
|
return { type: "customemoji", text: e3 };
|
|
2692
|
-
}(t2)),
|
|
2778
|
+
}(t2)), Rt = Ce(/<((?:https?|mailto):.*?)\|(.*?)>/gi, ([e2, t2, s2]) => /* @__PURE__ */ function(e3, t3 = []) {
|
|
2693
2779
|
return { type: "link", url: e3, children: t3 };
|
|
2694
|
-
}(t2, [s2])),
|
|
2780
|
+
}(t2, [s2])), Nt = Ce(/<actionlink:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
2695
2781
|
const { action: n2, params: r2 } = _t(t2);
|
|
2696
2782
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2697
2783
|
return { type: "actionlink", action: e3, params: t3, children: s3 };
|
|
2698
2784
|
}(n2, r2, [s2]);
|
|
2699
|
-
}),
|
|
2785
|
+
}), Pt = Ce(/<actionbutton:([^|]+)[|]([^>]*)>/gi, ([e2, t2, s2]) => {
|
|
2700
2786
|
const { action: n2, params: r2 } = _t(t2);
|
|
2701
2787
|
return /* @__PURE__ */ function(e3, t3, s3 = []) {
|
|
2702
2788
|
return { type: "actionbutton", action: e3, params: t3, children: s3 };
|
|
@@ -2707,64 +2793,64 @@ function _t(e2) {
|
|
|
2707
2793
|
if (-1 === t2) return { action: e2, params: {} };
|
|
2708
2794
|
return { action: e2.slice(0, t2), params: Object.fromEntries(new URLSearchParams(e2.slice(t2))) };
|
|
2709
2795
|
}
|
|
2710
|
-
const Ot =
|
|
2796
|
+
const Ot = Ce(/(?:^|\n)(?:\s*[-*+]\s+[^\n]+(?:\n|$))+/g, ([e2]) => /* @__PURE__ */ function(e3 = []) {
|
|
2711
2797
|
return { type: "bulletlist", children: e3 };
|
|
2712
|
-
}([e2.startsWith("\n") ? e2.slice(1) : e2])),
|
|
2798
|
+
}([e2.startsWith("\n") ? e2.slice(1) : e2])), Ut = Ce(/^\s*[-*+]\s+([^\n]+)(?:\n|$)/gm, ([e2, t2]) => ({ type: "bulletpoint", children: [t2] })), jt = (e2) => {
|
|
2713
2799
|
const t2 = /(?:^|[^-:/\w])([(+]?[0-9](?:[-_+ ().]?[0-9]){5,11}[0-9])(?:[^-:/\w]|$)/g;
|
|
2714
2800
|
let s2 = 0;
|
|
2715
2801
|
const n2 = [];
|
|
2716
|
-
for (const r2 of
|
|
2802
|
+
for (const r2 of J(e2, t2)) {
|
|
2717
2803
|
const t3 = r2[0], i2 = r2[1], a2 = t3.startsWith(i2) ? r2.index : r2.index + 1;
|
|
2718
2804
|
a2 - s2 > 0 && n2.push(e2.substring(s2, a2));
|
|
2719
|
-
const o2 =
|
|
2805
|
+
const o2 = Ft("tel:" + i2.replace(/[^0-9+]/g, ""), i2);
|
|
2720
2806
|
n2.push(o2), s2 = a2 + i2.length;
|
|
2721
2807
|
}
|
|
2722
2808
|
return s2 < e2.length && n2.push(e2.substring(s2)), n2;
|
|
2723
|
-
},
|
|
2724
|
-
const t2 =
|
|
2809
|
+
}, $t = (e2) => Rt(e2).flatMap((e3) => "string" == typeof e3 ? Wt(e3) : ["<", ...Wt(e3.url), ...Wt("|" + e3.children[0] + ">")]), Wt = (e2) => {
|
|
2810
|
+
const t2 = It.parse(e2, { urls: true, email: true, phone: false, hashtag: false, mention: false }), s2 = [];
|
|
2725
2811
|
let n2 = 0;
|
|
2726
2812
|
for (const r2 of t2) {
|
|
2727
2813
|
const t3 = r2.getOffset(), i2 = r2.getMatchedText(), a2 = i2.length;
|
|
2728
2814
|
let o2 = i2;
|
|
2729
|
-
r2 instanceof
|
|
2815
|
+
r2 instanceof $e ? o2 = "mailto:" + r2.getEmail() : r2 instanceof Ge && (o2 = r2.getUrl()), t3 > n2 && s2.push(e2.substring(n2, t3)), s2.push(Ft(o2, i2)), n2 = t3 + a2;
|
|
2730
2816
|
}
|
|
2731
2817
|
return n2 < e2.length && s2.push(e2.substring(n2)), s2;
|
|
2732
|
-
},
|
|
2733
|
-
function
|
|
2818
|
+
}, qt = ["Codeblock", "Codespan", "FormattedLink", "Wikitext", "Autolink", "Actions", "Mention", "Mention", "BulletPoint", "CustomEmoji"];
|
|
2819
|
+
function Ht(e2 = { except: [] }) {
|
|
2734
2820
|
var _a2;
|
|
2735
|
-
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 :
|
|
2736
|
-
return s2.includes("BulletPoint") || t2.multilineSteps.push(Ot,
|
|
2821
|
+
const t2 = { multilineSteps: [], singlelineSteps: [] }, s2 = (_a2 = e2.except) != null ? _a2 : qt.filter((t3) => !e2.only.includes(t3));
|
|
2822
|
+
return s2.includes("BulletPoint") || t2.multilineSteps.push(Ot, Ut), s2.includes("Mention") || t2.singlelineSteps.push(Bt), s2.includes("CustomEmoji") || t2.singlelineSteps.push(Mt), s2.includes("Codespan") || t2.multilineSteps.push(Ce(/```([^]+?)```/g, ([e3, t3]) => ({ type: "codespan", text: t3 }))), s2.includes("FormattedLink") || t2.singlelineSteps.push(Rt), s2.includes("Actions") || (t2.singlelineSteps.push(Nt), t2.singlelineSteps.push(Pt)), s2.includes("Wikitext") || t2.singlelineSteps.push(Te), s2.includes("Autolink") || t2.singlelineSteps.push($t, jt), t2;
|
|
2737
2823
|
}
|
|
2738
|
-
const
|
|
2824
|
+
const Gt = function(e2) {
|
|
2739
2825
|
const t2 = RegExp(`[^${e2}]+${e2}?|${e2}`, "g");
|
|
2740
2826
|
return (e3) => Array.from(e3.match(t2) || []);
|
|
2741
2827
|
}("\n");
|
|
2742
|
-
function
|
|
2828
|
+
function Lt(e2, t2 = { except: [] }) {
|
|
2743
2829
|
let s2 = function(e3, t3) {
|
|
2744
2830
|
let s3 = [e3];
|
|
2745
|
-
return s3 =
|
|
2746
|
-
}(e2,
|
|
2747
|
-
return s2 =
|
|
2831
|
+
return s3 = zt(s3, t3.multilineSteps), s3 = zt(s3, [Gt]), s3 = zt(s3, t3.singlelineSteps), s3 = Jt(s3), s3;
|
|
2832
|
+
}(e2, Ht(t2));
|
|
2833
|
+
return s2 = Yt(s2, false), s2;
|
|
2748
2834
|
}
|
|
2749
|
-
function
|
|
2750
|
-
return t2.reduce((e3, t3) =>
|
|
2835
|
+
function zt(e2, t2) {
|
|
2836
|
+
return t2.reduce((e3, t3) => Ae(e3, t3), e2);
|
|
2751
2837
|
}
|
|
2752
|
-
function
|
|
2838
|
+
function Jt(e2) {
|
|
2753
2839
|
const t2 = [];
|
|
2754
2840
|
let s2 = -1;
|
|
2755
|
-
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:
|
|
2841
|
+
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: Jt(n2.children) }) : n2;
|
|
2756
2842
|
return t2;
|
|
2757
2843
|
}
|
|
2758
|
-
function
|
|
2844
|
+
function Yt(e2, t2) {
|
|
2759
2845
|
const s2 = [];
|
|
2760
2846
|
let n2 = [];
|
|
2761
2847
|
for (let r2 = 0; r2 < e2.length; r2++) {
|
|
2762
2848
|
const i2 = e2[r2];
|
|
2763
|
-
"string" == typeof i2 ? n2.push(i2) : "children" in i2 ? (n2.length > 0 && (s2.push(n2.join("")), n2 = []), i2.children =
|
|
2849
|
+
"string" == typeof i2 ? n2.push(i2) : "children" in i2 ? (n2.length > 0 && (s2.push(n2.join("")), n2 = []), i2.children = Yt(i2.children, t2 || "link" === i2.type || "actionbutton" === i2.type || "actionlink" === i2.type), s2.push(i2)) : "autolink" === i2.type && t2 ? n2.push(i2.text) : (n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2.push(i2));
|
|
2764
2850
|
}
|
|
2765
2851
|
return n2.length > 0 && (s2.push(n2.join("")), n2 = []), s2;
|
|
2766
2852
|
}
|
|
2767
|
-
class
|
|
2853
|
+
class Qt {
|
|
2768
2854
|
constructor(e2, t2, s2) {
|
|
2769
2855
|
this.id = e2, this.conversationId = t2, this._realtimeClient = s2;
|
|
2770
2856
|
}
|
|
@@ -2780,12 +2866,12 @@ class Yt {
|
|
|
2780
2866
|
if (!t2.ok && "server" === t2.where && 404 === t2.value.status) return null;
|
|
2781
2867
|
if (!t2.ok && "server" === t2.where && 403 === t2.value.status && "NOT_A_PARTICIPANT" === t2.value.errorCode) return null;
|
|
2782
2868
|
const s2 = e("Get message " + this.id, t2), n2 = yield this._realtimeClient.createMessageSnapshot(s2, this.brandedConversationId);
|
|
2783
|
-
return
|
|
2869
|
+
return ve("Get message " + this.id, n2);
|
|
2784
2870
|
});
|
|
2785
2871
|
}
|
|
2786
2872
|
edit(t2) {
|
|
2787
2873
|
return __async(this, null, function* () {
|
|
2788
|
-
const s2 = { content:
|
|
2874
|
+
const s2 = { content: Vt(t2), custom: "string" == typeof t2 ? void 0 : t2.custom }, n2 = yield this._realtimeClient.call("PATCH", ["conversations", this.brandedConversationId, "messages", this.brandedId], s2);
|
|
2789
2875
|
e(`Edit message ${this.id} in conversation ${this.conversationId}`, n2);
|
|
2790
2876
|
});
|
|
2791
2877
|
}
|
|
@@ -2796,16 +2882,16 @@ class Yt {
|
|
|
2796
2882
|
});
|
|
2797
2883
|
}
|
|
2798
2884
|
}
|
|
2799
|
-
function
|
|
2885
|
+
function Vt(e2) {
|
|
2800
2886
|
if ("string" == typeof e2) {
|
|
2801
|
-
return [{ type: "text", children:
|
|
2887
|
+
return [{ type: "text", children: Lt(e2) }];
|
|
2802
2888
|
}
|
|
2803
2889
|
if ("text" in e2 && e2.text) {
|
|
2804
|
-
return [{ type: "text", children:
|
|
2890
|
+
return [{ type: "text", children: Lt(e2.text) }];
|
|
2805
2891
|
}
|
|
2806
2892
|
if ("content" in e2 && e2.content) return e2.content;
|
|
2807
2893
|
}
|
|
2808
|
-
class
|
|
2894
|
+
class Zt {
|
|
2809
2895
|
constructor(e2, t2) {
|
|
2810
2896
|
this.id = e2, this._realtimeClient = t2, this.uselessObjForTypeCheck = { subject: null, photoUrl: null, welcomeMessages: null, custom: null, access: null, notify: null };
|
|
2811
2897
|
}
|
|
@@ -2816,16 +2902,16 @@ class Vt {
|
|
|
2816
2902
|
return this._realtimeClient.userId;
|
|
2817
2903
|
}
|
|
2818
2904
|
participant(e2) {
|
|
2819
|
-
return new
|
|
2905
|
+
return new ye("string" == typeof e2 ? e2 : e2.id, this.id, this._realtimeClient);
|
|
2820
2906
|
}
|
|
2821
2907
|
message(e2) {
|
|
2822
|
-
return new
|
|
2908
|
+
return new Qt(e2, this.brandedId, this._realtimeClient);
|
|
2823
2909
|
}
|
|
2824
2910
|
get() {
|
|
2825
2911
|
return __async(this, null, function* () {
|
|
2826
2912
|
const t2 = this._realtimeClient.listMessages(this.brandedId, { limit: 1 }), s2 = yield this._realtimeClient.call("GET", ["me", "conversations", this.brandedId], {});
|
|
2827
2913
|
if (!s2.ok && "server" === s2.where && 404 === s2.value.status) return null;
|
|
2828
|
-
const n2 = e("Get conversation " + this.id, s2), r2 =
|
|
2914
|
+
const n2 = e("Get conversation " + this.id, s2), r2 = ve("Get last message in conversation " + this.id, yield t2), i2 = 0 === r2.length ? null : r2[0];
|
|
2829
2915
|
return this._realtimeClient.createConversationSnapshotPreloaded(n2, i2);
|
|
2830
2916
|
});
|
|
2831
2917
|
}
|
|
@@ -2868,8 +2954,8 @@ class Vt {
|
|
|
2868
2954
|
}
|
|
2869
2955
|
send(t2) {
|
|
2870
2956
|
return __async(this, null, function* () {
|
|
2871
|
-
const s2 = { content:
|
|
2872
|
-
return new
|
|
2957
|
+
const s2 = { content: Kt(t2), referencedMessageId: Xt(t2), custom: "string" == typeof t2 ? void 0 : t2.custom, idempotencyKey: we((/* @__PURE__ */ new Date()).getTime()) }, n2 = yield this._realtimeClient.call("POST", ["conversations", this.brandedId, "messages"], s2), r2 = e("Send message to conversation " + this.id, n2);
|
|
2958
|
+
return new Qt(r2.id, this.brandedId, this._realtimeClient);
|
|
2873
2959
|
});
|
|
2874
2960
|
}
|
|
2875
2961
|
subscribeMessages(e2) {
|
|
@@ -2888,36 +2974,36 @@ class Vt {
|
|
|
2888
2974
|
});
|
|
2889
2975
|
}
|
|
2890
2976
|
}
|
|
2891
|
-
function
|
|
2977
|
+
function Kt(e2) {
|
|
2892
2978
|
if ("string" == typeof e2) {
|
|
2893
|
-
return [{ type: "text", children:
|
|
2979
|
+
return [{ type: "text", children: Lt(e2) }];
|
|
2894
2980
|
}
|
|
2895
2981
|
if ("text" in e2) {
|
|
2896
|
-
return [{ type: "text", children:
|
|
2982
|
+
return [{ type: "text", children: Lt(e2.text) }];
|
|
2897
2983
|
}
|
|
2898
2984
|
return e2.content;
|
|
2899
2985
|
}
|
|
2900
|
-
function
|
|
2986
|
+
function Xt(e2) {
|
|
2901
2987
|
if ("string" == typeof e2) return;
|
|
2902
2988
|
const t2 = e2.referencedMessage;
|
|
2903
2989
|
return void 0 !== t2 ? "string" == typeof t2 ? t2 : t2.id : void 0;
|
|
2904
2990
|
}
|
|
2905
|
-
class
|
|
2991
|
+
class es {
|
|
2906
2992
|
constructor(e2, t2, s2) {
|
|
2907
2993
|
this.realtimeWsApiUrl = e2, this.internalHttpApiUrl = t2, this.restApiHttpUrl = s2;
|
|
2908
2994
|
}
|
|
2909
2995
|
getBokensUrl(e2, t2, s2) {
|
|
2910
2996
|
return this.internalHttpApiUrl + `/${e2}/bokens/${encodeURIComponent(t2)}?signature=${encodeURIComponent(s2 != null ? s2 : "")}`;
|
|
2911
2997
|
}
|
|
2912
|
-
getRealtimeWsUrl(e2, t2, s2, n2) {
|
|
2913
|
-
const
|
|
2914
|
-
return this.realtimeWsApiUrl + `/${e2}/realtime/${
|
|
2998
|
+
getRealtimeWsUrl(e2, t2, s2, n2, r2) {
|
|
2999
|
+
const i2 = encodeURIComponent(t2);
|
|
3000
|
+
return this.realtimeWsApiUrl + `/${e2}/realtime/${i2}?talkjs-client-build=${r2 != null ? r2 : "standalone"}&talkjs-core=${s2}&talkjs-client-id=${n2}`;
|
|
2915
3001
|
}
|
|
2916
3002
|
}
|
|
2917
|
-
function
|
|
3003
|
+
function ts({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRetry: i2, authProvider: o2 }) {
|
|
2918
3004
|
var _a2;
|
|
2919
3005
|
(!r2 || r2 <= 0) && (r2 = 1);
|
|
2920
|
-
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-
|
|
3006
|
+
const u2 = { "x-talkjs-client-build": "jssdk-dev", "x-talkjs-client-date": "2025-06-03T07:34:52.410Z" };
|
|
2921
3007
|
s2 instanceof FormData || (u2["Content-Type"] = (_a2 = n2 == null ? void 0 : n2.contentType) != null ? _a2 : "application/json");
|
|
2922
3008
|
return a(r2, () => __async(this, null, function* () {
|
|
2923
3009
|
if (o2) {
|
|
@@ -2929,19 +3015,19 @@ function es({ method: e2, url: t2, data: s2, options: n2, attempts: r2, shouldRe
|
|
|
2929
3015
|
throw e3;
|
|
2930
3016
|
});
|
|
2931
3017
|
}), { initialDelay: 0.2, log: void 0, shouldRetry: (s3) => __async(this, null, function* () {
|
|
2932
|
-
return o2 && 401 === s3.status ? (
|
|
3018
|
+
return o2 && 401 === s3.status ? (cs.log(`401 error from ${e2} ${t2}, ${yield o2.getToken()}`), o2.refreshToken(), true) : i2 ? i2(s3) : !("status" in s3 && s3.status >= 400 && s3.status < 500);
|
|
2933
3019
|
}) }).catch((s3) => {
|
|
2934
3020
|
if (Math.random() < 0.1 && !t2.toString().startsWith("https://capture.trackjs.com")) {
|
|
2935
3021
|
const n3 = `Network Error for ${e2} ${t2}`;
|
|
2936
3022
|
if ("undefined" != typeof window) if (s3 instanceof Response) {
|
|
2937
|
-
s3.clone().text().then((e3) =>
|
|
2938
|
-
} else
|
|
3023
|
+
s3.clone().text().then((e3) => cs.log(`${n3} ${s3.status} ${e3} (10% logged)`));
|
|
3024
|
+
} else cs.log(`${n3} ${s3} (10% logged)`);
|
|
2939
3025
|
console.error("[TalkJS]", n3);
|
|
2940
3026
|
}
|
|
2941
3027
|
throw s3;
|
|
2942
3028
|
});
|
|
2943
3029
|
}
|
|
2944
|
-
const { cdnHost:
|
|
3030
|
+
const { cdnHost: ss, appHost: ns, restHost: rs, realtimeHost: is, appProtocol: as, appWsProtocol: os } = function() {
|
|
2945
3031
|
if ("undefined" == typeof window) return { cdnHost: "test-hostname", appHost: "test-hostname", appProtocol: "http:", appWsProtocol: "ws:" };
|
|
2946
3032
|
const e2 = function() {
|
|
2947
3033
|
if (document.currentScript) return document.currentScript.src;
|
|
@@ -2966,11 +3052,11 @@ const { cdnHost: ts, appHost: ss, restHost: ns, realtimeHost: rs, appProtocol: i
|
|
|
2966
3052
|
}(n2), a2 = t2.protocol;
|
|
2967
3053
|
return { cdnHost: s2, appHost: n2, restHost: r2, realtimeHost: i2, appProtocol: a2, appWsProtocol: "https:" === a2 ? "wss:" : "ws:" };
|
|
2968
3054
|
}();
|
|
2969
|
-
const
|
|
2970
|
-
const
|
|
3055
|
+
const us = ns.startsWith("app.talkjs.com");
|
|
3056
|
+
const cs = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setData: (e2) => {
|
|
2971
3057
|
} } : new class {
|
|
2972
3058
|
constructor(e2) {
|
|
2973
|
-
this._timeCreated = Date.now(), this._enabled =
|
|
3059
|
+
this._timeCreated = Date.now(), this._enabled = us, this._trackJSData = { customer: { application: "", correlationId: "", sessionId: "", token: "", userId: "", version: "dev-2025-06-03T07:34:52.410Z" }, entry: "direct", environment: { age: Date.now() - this._timeCreated, dependencies: {}, originalUrl: window.location.href, referrer: document.referrer, userAgent: window.navigator.userAgent }, metadata: [], nav: [], network: [], url: window.location.href, stack: "", timestamp: (/* @__PURE__ */ new Date()).toISOString(), version: "dev-2025-06-03T07:34:52.410Z", throttled: 0 }, this._url = `https://capture.trackjs.com/capture?token=${e2}`, this._trackJSData.customer.token = e2;
|
|
2974
3060
|
}
|
|
2975
3061
|
setData({ appId: e2, meId: t2, sessionId: s2 }) {
|
|
2976
3062
|
this._trackJSData.customer.userId = e2, this._trackJSData.customer.sessionId = `${e2}/${t2}`, this._trackJSData.customer.correlationId = s2;
|
|
@@ -2980,14 +3066,14 @@ const us = "undefined" == typeof window ? { log: (e2) => Promise.resolve(), setD
|
|
|
2980
3066
|
try {
|
|
2981
3067
|
if (!this._enabled) return Promise.resolve();
|
|
2982
3068
|
const t2 = __spreadProps(__spreadValues({}, this._trackJSData), { message: e2 });
|
|
2983
|
-
yield
|
|
3069
|
+
yield ts({ method: "POST", url: this._url, data: JSON.stringify(t2), options: { contentType: "text/plain" } });
|
|
2984
3070
|
} catch (e3) {
|
|
2985
3071
|
console.error("[TalkJS] Failed when sending an error report. Error: ", e3);
|
|
2986
3072
|
}
|
|
2987
3073
|
});
|
|
2988
3074
|
}
|
|
2989
3075
|
}("970cd0be0fb74630b75c8451051299dc");
|
|
2990
|
-
class
|
|
3076
|
+
class ls {
|
|
2991
3077
|
constructor(e2, t2 = {}) {
|
|
2992
3078
|
this._onSubscription = t2, this._handlers = {};
|
|
2993
3079
|
for (const t3 in e2) Object.hasOwnProperty.call(e2, t3) && (this._handlers[t3] = []);
|
|
@@ -3032,9 +3118,9 @@ class cs {
|
|
|
3032
3118
|
return this.on(e2, t2), { unsubscribe: () => this.off(e2, t2) };
|
|
3033
3119
|
}
|
|
3034
3120
|
}
|
|
3035
|
-
class
|
|
3121
|
+
class hs {
|
|
3036
3122
|
constructor(e2, t2, s2, n2, r2, i2) {
|
|
3037
|
-
if (this.appId = t2, this.userId = s2, this.tokenFetcher = r2, this.usingBokens = false, this.requestInProgress = false, this.eventEmitter = new
|
|
3123
|
+
if (this.appId = t2, this.userId = s2, this.tokenFetcher = r2, this.usingBokens = false, this.requestInProgress = false, this.eventEmitter = new ls({ tokenChanged(e3) {
|
|
3038
3124
|
}, tokenRefreshFailed(e3) {
|
|
3039
3125
|
}, tokenAccepted(e3) {
|
|
3040
3126
|
} }), this.sessionExpiryWarningTimeoutId = void 0, i2 && (n2 || r2)) throw new Error("[TalkJS] If providing a signature for authentication, you must not provide a token or tokenFetcher.");
|
|
@@ -3126,7 +3212,7 @@ class ls {
|
|
|
3126
3212
|
const e3 = function(e4) {
|
|
3127
3213
|
const t3 = e4.split(".");
|
|
3128
3214
|
if (3 !== t3.length) throw "Token does not contain exactly two `.`. Check that you generated your JWT correctly. It should be `<header>.<payload>.<signature>`.";
|
|
3129
|
-
return { header:
|
|
3215
|
+
return { header: ds(t3[0]), payload: ds(t3[1]) };
|
|
3130
3216
|
}(s2);
|
|
3131
3217
|
n2 = e3.header, r2 = e3.payload;
|
|
3132
3218
|
} catch (e3) {
|
|
@@ -3140,7 +3226,7 @@ class ls {
|
|
|
3140
3226
|
const e3 = this.checkJwtPayload(r2);
|
|
3141
3227
|
t2.push(...e3);
|
|
3142
3228
|
}
|
|
3143
|
-
if (t2.length) if (this.usingBokens)
|
|
3229
|
+
if (t2.length) if (this.usingBokens) cs.log(`JWT Errors detected by AuthProvider when using bokens: ${t2.join("\n")}`);
|
|
3144
3230
|
else {
|
|
3145
3231
|
console.warn("[TalkJS] Authentication token appears to be generated incorrectly. Will still attempt to authenticate, but TalkJS may not work as expected. See below for a description of any problems and how to fix them.");
|
|
3146
3232
|
const s3 = t2.length > 1;
|
|
@@ -3169,7 +3255,7 @@ class ls {
|
|
|
3169
3255
|
sendBokenRequest(e2, t2) {
|
|
3170
3256
|
return __async(this, null, function* () {
|
|
3171
3257
|
let s2 = 0;
|
|
3172
|
-
const n2 = e2.getBokensUrl(this.appId, this.userId, t2), r2 = yield
|
|
3258
|
+
const n2 = e2.getBokensUrl(this.appId, this.userId, t2), r2 = yield ts({ method: "GET", url: n2, attempts: 1e4, shouldRetry: (e3) => {
|
|
3173
3259
|
if (e3 instanceof Error) return true;
|
|
3174
3260
|
if (401 === e3.status) throw "Check that you provided a valid signature.";
|
|
3175
3261
|
if (404 === e3.status) throw "Check that you specified the correct App ID.";
|
|
@@ -3182,7 +3268,7 @@ class ls {
|
|
|
3182
3268
|
});
|
|
3183
3269
|
}
|
|
3184
3270
|
}
|
|
3185
|
-
function
|
|
3271
|
+
function ds(e2) {
|
|
3186
3272
|
try {
|
|
3187
3273
|
const t2 = e2.replace(/-/g, "+").replace(/_/g, "/"), s2 = decodeURIComponent(atob(t2).split("").map((e3) => "%" + ("00" + e3.charCodeAt(0).toString(16)).slice(-2)).join(""));
|
|
3188
3274
|
return JSON.parse(s2);
|
|
@@ -3190,8 +3276,8 @@ function hs(e2) {
|
|
|
3190
3276
|
throw `Could not base64-decode and JSON-parse token section: ${e2}. Check that you base-64 encoded the section correctly.`;
|
|
3191
3277
|
}
|
|
3192
3278
|
}
|
|
3193
|
-
const
|
|
3194
|
-
class
|
|
3279
|
+
const ps = new es("wss://realtime.talkjs.com/v1", "https://app.talkjs.com/api/v0", "https://api.talkjs.com/v1");
|
|
3280
|
+
class fs {
|
|
3195
3281
|
constructor(e2) {
|
|
3196
3282
|
this.target = e2;
|
|
3197
3283
|
}
|
|
@@ -3199,7 +3285,7 @@ class ps {
|
|
|
3199
3285
|
return this.target;
|
|
3200
3286
|
}
|
|
3201
3287
|
}
|
|
3202
|
-
const
|
|
3288
|
+
const gs = new class {
|
|
3203
3289
|
constructor() {
|
|
3204
3290
|
this.registry = {};
|
|
3205
3291
|
}
|
|
@@ -3207,7 +3293,7 @@ const fs = new class {
|
|
|
3207
3293
|
var _a2;
|
|
3208
3294
|
const t2 = this.key(e2), s2 = (_a2 = this.registry[t2]) == null ? void 0 : _a2.deref();
|
|
3209
3295
|
if (s2) return s2;
|
|
3210
|
-
const n2 = new
|
|
3296
|
+
const n2 = new vs(e2), r2 = globalThis.WeakRef ? new WeakRef(n2) : new fs(n2);
|
|
3211
3297
|
return this.registry[t2] = r2, n2;
|
|
3212
3298
|
}
|
|
3213
3299
|
deregister(e2, t2) {
|
|
@@ -3218,10 +3304,10 @@ const fs = new class {
|
|
|
3218
3304
|
return `${e2}:${t2}`;
|
|
3219
3305
|
}
|
|
3220
3306
|
}();
|
|
3221
|
-
function
|
|
3222
|
-
return e2.forceCreateNew ? new
|
|
3307
|
+
function ms(e2) {
|
|
3308
|
+
return e2.forceCreateNew ? new vs(e2) : gs.getOrCreate(e2);
|
|
3223
3309
|
}
|
|
3224
|
-
class
|
|
3310
|
+
class vs {
|
|
3225
3311
|
constructor(e2) {
|
|
3226
3312
|
!function(e3) {
|
|
3227
3313
|
function t3(e4, t4) {
|
|
@@ -3231,11 +3317,13 @@ class ms {
|
|
|
3231
3317
|
void 0 !== e3.tokenFetcher && t3("function" == typeof e3.tokenFetcher, "The `tokenFetcher` property of TalkSession#constructor must be a function.");
|
|
3232
3318
|
}(e2);
|
|
3233
3319
|
const { appId: t2, userId: s2, token: n2, tokenFetcher: r2, signature: i2 } = e2;
|
|
3234
|
-
this._appId = t2, this._apiUrls = e2.apiUrls ? new
|
|
3320
|
+
this._appId = t2, this._apiUrls = e2.apiUrls ? new es(e2.apiUrls.realtimeWsApiUrl, e2.apiUrls.internalHttpApiUrl, e2.apiUrls.restApiHttpUrl) : ps, this._authProvider = new hs(this._apiUrls, t2, s2, n2, r2, i2);
|
|
3321
|
+
const a2 = Math.random().toString().split(".")[1];
|
|
3322
|
+
this._realtimeClient = new ge(this._apiUrls.getRealtimeWsUrl(t2, s2, "1.1.1", a2, e2.clientBuild), s2, this._authProvider), this.currentUser = new be(this._realtimeClient.userId, this._realtimeClient), this._terminationReason = o(), this._terminationReason.promise.then((e3) => {
|
|
3235
3323
|
console.error(`[TalkSession] ${e3}`);
|
|
3236
3324
|
}), function(e3, t3, s3) {
|
|
3237
3325
|
return __async(this, null, function* () {
|
|
3238
|
-
return
|
|
3326
|
+
return ts({ method: "GET", url: `${t3}/${e3}/app`, authProvider: s3 }).then((e4) => 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)).catch((e4) => {
|
|
3239
3327
|
if ("string" != typeof e4 && "status" in e4) {
|
|
3240
3328
|
const t4 = e4;
|
|
3241
3329
|
return 200 === t4.status || 404 !== t4.status && (console.warn(`[TalkJS] Received unexpected ${t4.status} status code when validating app ID. Assuming that the app ID is valid.`), true);
|
|
@@ -3256,37 +3344,37 @@ class ms {
|
|
|
3256
3344
|
}), { unsubscribe: () => t2.resolve("UNSUBSCRIBED") };
|
|
3257
3345
|
}
|
|
3258
3346
|
user(e2) {
|
|
3259
|
-
return new
|
|
3347
|
+
return new be(e2, this._realtimeClient);
|
|
3260
3348
|
}
|
|
3261
3349
|
conversation(e2) {
|
|
3262
|
-
return new
|
|
3350
|
+
return new Zt(e2, this._realtimeClient);
|
|
3263
3351
|
}
|
|
3264
3352
|
terminate(e2) {
|
|
3265
|
-
|
|
3353
|
+
gs.deregister(this._appId, this.currentUser.id), this._terminationReason.resolve(e2), this._realtimeClient.destroy();
|
|
3266
3354
|
}
|
|
3267
3355
|
_isConnected() {
|
|
3268
3356
|
return this._realtimeClient.isConnected();
|
|
3269
3357
|
}
|
|
3270
3358
|
uploadFile(e2, t2) {
|
|
3271
|
-
return
|
|
3359
|
+
return bs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, t2);
|
|
3272
3360
|
}
|
|
3273
3361
|
uploadImage(e2, t2) {
|
|
3274
|
-
return
|
|
3362
|
+
return bs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "image" }, t2));
|
|
3275
3363
|
}
|
|
3276
3364
|
uploadVideo(e2, t2) {
|
|
3277
|
-
return
|
|
3365
|
+
return bs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "video" }, t2));
|
|
3278
3366
|
}
|
|
3279
3367
|
uploadAudio(e2, t2) {
|
|
3280
|
-
return
|
|
3368
|
+
return bs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "audio" }, t2));
|
|
3281
3369
|
}
|
|
3282
3370
|
uploadVoice(e2, t2) {
|
|
3283
|
-
return
|
|
3371
|
+
return bs(`${this._apiUrls.restApiHttpUrl}/${this._appId}/files`, this._authProvider, e2, __spreadValues({ subtype: "voice" }, t2));
|
|
3284
3372
|
}
|
|
3285
3373
|
}
|
|
3286
|
-
function
|
|
3374
|
+
function bs(_0, _1, _2, _3) {
|
|
3287
3375
|
return __async(this, arguments, function* (e2, t2, s2, { subtype: n2, filename: r2, width: i2, height: a2, duration: o2 }) {
|
|
3288
3376
|
const u2 = new FormData();
|
|
3289
|
-
return u2.set("file", s2, r2), void 0 !== n2 && u2.set("subtype", n2), void 0 !== i2 && u2.set("width", i2.toString()), void 0 !== a2 && u2.set("height", a2.toString()), void 0 !== o2 && u2.set("duration", o2.toString()),
|
|
3377
|
+
return u2.set("file", s2, r2), void 0 !== n2 && u2.set("subtype", n2), void 0 !== i2 && u2.set("width", i2.toString()), void 0 !== a2 && u2.set("height", a2.toString()), void 0 !== o2 && u2.set("duration", o2.toString()), ts({ method: "POST", url: e2, data: u2, authProvider: t2 }).then((e3) => e3.json()).then((e3) => e3.attachmentToken).catch((e3) => __async(this, null, function* () {
|
|
3290
3378
|
if (e3 instanceof Response) {
|
|
3291
3379
|
const t3 = yield e3.json(), s3 = `Unexpected response when uploading file, status code ${e3.status} ${t3.errorCode}, ${t3.reasons}`;
|
|
3292
3380
|
throw new Error(s3);
|
|
@@ -3296,7 +3384,7 @@ function vs(_0, _1, _2, _3) {
|
|
|
3296
3384
|
});
|
|
3297
3385
|
}
|
|
3298
3386
|
export {
|
|
3299
|
-
|
|
3387
|
+
ms as getTalkSession,
|
|
3300
3388
|
f as registerPolyfills
|
|
3301
3389
|
};
|
|
3302
3390
|
//# sourceMappingURL=talkSession.js.map
|