@talkjs/core 1.6.1 → 1.6.3

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