pptx-svelte-viewer 2.20.4 → 2.20.5

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.
@@ -1,4 +1,4 @@
1
- import { A as e, M as a, _ as s, c as t, d as i, f as l, gt as S, ht as n, i as v, j as o, l as d, n as p, o as b, p as g, r as c, s as x, t as w, u as T } from "../export-CEyYhd0_.js";
1
+ import { A as e, M as a, _ as s, c as t, d as i, f as l, gt as S, ht as n, i as v, j as o, l as d, n as p, o as b, p as g, r as c, s as x, t as w, u as T } from "../export-BJ59Rfa6.js";
2
2
  var m = a, A = o, P = e;
3
3
  export {
4
4
  w as PowerPointViewer,
@@ -1,14 +1,14 @@
1
- import { a as at, c as ct, d as ut, i as Ve, l as ht, n as lt, o as Ke, r as Oe, s as ft, t as dt, u as pt } from "./awareness-CkFlr7xx.js";
2
- import { A as Re, B as gt, C as re, D as $e, E as yt, F as Me, I as bt, L as mt, M as _t, N as vt, O as Ue, P as Je, R as wt, S as Pe, T as ie, U as De, V as Et, _ as Fe, a as Xe, b as Qe, i as ue, j as Ye, k as se, l as Ct, n as qe, o as Te, r as Rt, s as Ze, t as St, u as Tt, v as At, x as kt, y as Ot } from "./yjs-CE9F053g.js";
3
- var Lt = Object.create, et = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, Nt = Object.getOwnPropertyNames, It = Object.getPrototypeOf, Mt = Object.prototype.hasOwnProperty, Pt = (v, x) => () => (x || (v((x = { exports: {} }).exports, x), v = null), x.exports), Dt = (v, x, j, U) => {
1
+ import { a as ct, c as ut, d as ht, i as Ve, l as lt, n as ft, o as Ke, r as Oe, s as dt, t as pt, u as gt } from "./awareness-CrSnuSE_.js";
2
+ import { A as Re, B as yt, C as re, D as $e, E as bt, F as Me, I as mt, L as _t, M as vt, N as wt, O as Ue, P as Je, R as Et, S as Pe, T as ie, U as De, V as Ct, _ as Fe, a as Xe, b as Qe, i as ue, j as Ye, k as se, l as Rt, n as qe, o as Te, r as St, s as Ze, t as Tt, u as At, v as kt, x as Ot, y as Lt } from "./yjs-DbU20bpp.js";
3
+ var xt = Object.create, et = Object.defineProperty, Nt = Object.getOwnPropertyDescriptor, It = Object.getOwnPropertyNames, Mt = Object.getPrototypeOf, tt = Object.prototype.hasOwnProperty, Pt = (v, x) => () => (x || (v((x = { exports: {} }).exports, x), v = null), x.exports), Dt = (v, x, j, U) => {
4
4
  if (x && typeof x == "object" || typeof x == "function")
5
- for (var F = Nt(x), R = 0, M = F.length, m; R < M; R++)
6
- m = F[R], !Mt.call(v, m) && m !== j && et(v, m, {
5
+ for (var F = It(x), R = 0, M = F.length, m; R < M; R++)
6
+ m = F[R], !tt.call(v, m) && m !== j && et(v, m, {
7
7
  get: ((c) => x[c]).bind(null, m),
8
- enumerable: !(U = xt(x, m)) || U.enumerable
8
+ enumerable: !(U = Nt(x, m)) || U.enumerable
9
9
  });
10
10
  return v;
11
- }, jt = (v, x, j) => (j = v != null ? Lt(It(v)) : {}, Dt(x || !v || !v.__esModule ? et(j, "default", {
11
+ }, jt = (v, x, j) => (j = v != null ? xt(Mt(v)) : {}, Dt(x || !v || !v.__esModule || !tt.call(v, "default") ? et(j, "default", {
12
12
  value: v,
13
13
  enumerable: !0
14
14
  }) : j, v)), ke = /* @__PURE__ */ ((v) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(v, { get: (x, j) => (typeof require < "u" ? require : x)[j] }) : v)(function(v) {
@@ -27,7 +27,7 @@ var Lt = Object.create, et = Object.defineProperty, xt = Object.getOwnPropertyDe
27
27
  v.ws !== null && (v.ws = null, v.connecting = !1, v.connected ? (v.connected = !1, v.emit("disconnect", [{
28
28
  type: "disconnect",
29
29
  error: M
30
- }, v])) : v.unsuccessfulReconnects++, setTimeout(je, wt(mt(v.unsuccessfulReconnects + 1) * Bt, Ut), v)), clearTimeout(U);
30
+ }, v])) : v.unsuccessfulReconnects++, setTimeout(je, Et(_t(v.unsuccessfulReconnects + 1) * Bt, Ut), v)), clearTimeout(U);
31
31
  }, R = () => {
32
32
  v.ws === x && v.send({ type: "ping" });
33
33
  };
@@ -35,7 +35,7 @@ var Lt = Object.create, et = Object.defineProperty, xt = Object.getOwnPropertyDe
35
35
  v.lastMessageReceived = Me(), v.connecting = !1, v.connected = !0, v.unsuccessfulReconnects = 0, v.emit("connect", [{ type: "connect" }, v]), U = setTimeout(R, Le / 2);
36
36
  };
37
37
  }
38
- }, Ft = class extends gt {
38
+ }, Ft = class extends yt {
39
39
  constructor(v, { binaryType: x } = {}) {
40
40
  super(), this.url = v, this.ws = null, this.binaryType = x || null, this.connected = !1, this.connecting = !1, this.unsuccessfulReconnects = 0, this.lastMessageReceived = 0, this.shouldConnect = !0, this._checkInterval = setInterval(() => {
41
41
  this.connected && Le < Me() - this.lastMessageReceived && this.ws.close();
@@ -3093,7 +3093,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
3093
3093
  name: "AES-GCM",
3094
3094
  length: 256
3095
3095
  }, !0, ["encrypt", "decrypt"]));
3096
- }, tt = (v, x) => {
3096
+ }, rt = (v, x) => {
3097
3097
  if (!x) return qe(v);
3098
3098
  const j = crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(12));
3099
3099
  return crypto.subtle.encrypt({
@@ -3105,41 +3105,41 @@ Use Chrome, Firefox or Internet Explorer 11`);
3105
3105
  });
3106
3106
  }, Yt = (v, x) => {
3107
3107
  const j = re();
3108
- return yt(j, v), tt(ie(j), x);
3109
- }, rt = (v, x) => {
3108
+ return bt(j, v), rt(ie(j), x);
3109
+ }, nt = (v, x) => {
3110
3110
  if (!x) return qe(v);
3111
3111
  const j = Fe(v);
3112
- Qe(j) !== "AES-GCM" && St(Je("Unknown encryption algorithm"));
3112
+ Qe(j) !== "AES-GCM" && Tt(Je("Unknown encryption algorithm"));
3113
3113
  const U = Pe(j), F = Pe(j);
3114
3114
  return crypto.subtle.decrypt({
3115
3115
  name: "AES-GCM",
3116
3116
  iv: U
3117
3117
  }, x, F).then((R) => new Uint8Array(R));
3118
- }, zt = (v, x) => rt(v, x).then((j) => At(Fe(new Uint8Array(j)))), ne = Rt("y-webrtc"), Ce = 0, nt = 3, Ae = 1, We = 4, xe = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Map(), it = (v) => {
3118
+ }, zt = (v, x) => nt(v, x).then((j) => kt(Fe(new Uint8Array(j)))), ne = St("y-webrtc"), Ce = 0, it = 3, Ae = 1, We = 4, xe = /* @__PURE__ */ new Map(), we = /* @__PURE__ */ new Map(), st = (v) => {
3119
3119
  let x = !0;
3120
3120
  v.webrtcConns.forEach((j) => {
3121
3121
  j.synced || (x = !1);
3122
3122
  }), (!x && v.synced || x && !v.synced) && (v.synced = x, v.provider.emit("synced", [{ synced: x }]), ne("synced ", ue, v.name, Te, " with all peers"));
3123
- }, st = (v, x, j) => {
3124
- const U = Fe(x), F = re(), R = kt(U);
3123
+ }, ot = (v, x, j) => {
3124
+ const U = Fe(x), F = re(), R = Ot(U);
3125
3125
  if (v === void 0) return null;
3126
3126
  const M = v.awareness, m = v.doc;
3127
3127
  let c = !1;
3128
3128
  switch (R) {
3129
3129
  case Ce: {
3130
3130
  se(F, Ce);
3131
- const S = at(U, F, m, v);
3131
+ const S = ct(U, F, m, v);
3132
3132
  S === 1 && !v.synced && j(), S === 0 && (c = !0);
3133
3133
  break;
3134
3134
  }
3135
- case nt:
3135
+ case it:
3136
3136
  se(F, Ae), Re(F, Oe(M, Array.from(M.getStates().keys()))), c = !0;
3137
3137
  break;
3138
3138
  case Ae:
3139
- lt(M, Pe(U), v);
3139
+ ft(M, Pe(U), v);
3140
3140
  break;
3141
3141
  case We: {
3142
- const S = Ot(U) === 1, O = Qe(U);
3142
+ const S = Lt(U) === 1, O = Qe(U);
3143
3143
  if (O !== v.peerId && (v.bcConns.has(O) && !S || !v.bcConns.has(O) && S)) {
3144
3144
  const i = [], h = [];
3145
3145
  S ? (v.bcConns.add(O), h.push(O)) : (v.bcConns.delete(O), i.push(O)), v.provider.emit("peers", [{
@@ -3147,7 +3147,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
3147
3147
  removed: i,
3148
3148
  webrtcPeers: Array.from(v.webrtcConns.keys()),
3149
3149
  bcPeers: Array.from(v.bcConns)
3150
- }]), ot(v);
3150
+ }]), at(v);
3151
3151
  }
3152
3152
  break;
3153
3153
  }
@@ -3157,8 +3157,8 @@ Use Chrome, Firefox or Internet Explorer 11`);
3157
3157
  return c ? F : null;
3158
3158
  }, Gt = (v, x) => {
3159
3159
  const j = v.room;
3160
- return ne("received message from ", ue, v.remotePeerId, Xe, " (", j.name, ")", Te, Ze), st(j, x, () => {
3161
- v.synced = !0, ne("synced ", ue, j.name, Te, " with ", ue, v.remotePeerId), it(j);
3160
+ return ne("received message from ", ue, v.remotePeerId, Xe, " (", j.name, ")", Te, Ze), ot(j, x, () => {
3161
+ v.synced = !0, ne("synced ", ue, j.name, Te, " with ", ue, v.remotePeerId), st(j);
3162
3162
  });
3163
3163
  }, Ne = (v, x) => {
3164
3164
  ne("send message to ", ue, v.remotePeerId, Te, Xe, " (", v.room.name, ")", Ze);
@@ -3201,7 +3201,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
3201
3201
  added: [],
3202
3202
  webrtcPeers: Array.from(U.webrtcConns.keys()),
3203
3203
  bcPeers: Array.from(U.bcConns)
3204
- }])), it(U), this.peer.destroy(), ne("closed connection to ", ue, j), Be(U);
3204
+ }])), st(U), this.peer.destroy(), ne("closed connection to ", ue, j), Be(U);
3205
3205
  }), this.peer.on("error", (F) => {
3206
3206
  ne("Error in connection to ", ue, j, ": ", F), Be(U);
3207
3207
  }), this.peer.on("data", (F) => {
@@ -3212,7 +3212,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
3212
3212
  destroy() {
3213
3213
  this.peer.destroy();
3214
3214
  }
3215
- }, be = (v, x) => tt(x, v.key).then((j) => v.mux(() => ht(v.name, j))), Ge = (v, x) => {
3215
+ }, be = (v, x) => rt(x, v.key).then((j) => v.mux(() => lt(v.name, j))), Ge = (v, x) => {
3216
3216
  v.bcconnected && be(v, x), Kt(v, x);
3217
3217
  }, Be = (v) => {
3218
3218
  xe.forEach((x) => {
@@ -3224,20 +3224,20 @@ Use Chrome, Firefox or Internet Explorer 11`);
3224
3224
  from: v.peerId
3225
3225
  }));
3226
3226
  });
3227
- }, ot = (v) => {
3227
+ }, at = (v) => {
3228
3228
  if (v.provider.filterBcConns) {
3229
3229
  const x = re();
3230
3230
  se(x, We), $e(x, 1), Ue(x, v.peerId), be(v, ie(x));
3231
3231
  }
3232
3232
  }, $t = class {
3233
3233
  constructor(v, x, j, U) {
3234
- this.peerId = vt(), this.doc = v, this.awareness = x.awareness, this.provider = x, this.synced = !1, this.name = j, this.key = U, this.webrtcConns = /* @__PURE__ */ new Map(), this.bcConns = /* @__PURE__ */ new Set(), this.mux = qt(), this.bcconnected = !1, this._bcSubscriber = (F) => rt(new Uint8Array(F), U).then((R) => this.mux(() => {
3235
- const M = st(this, R, () => {
3234
+ this.peerId = wt(), this.doc = v, this.awareness = x.awareness, this.provider = x, this.synced = !1, this.name = j, this.key = U, this.webrtcConns = /* @__PURE__ */ new Map(), this.bcConns = /* @__PURE__ */ new Set(), this.mux = qt(), this.bcconnected = !1, this._bcSubscriber = (F) => nt(new Uint8Array(F), U).then((R) => this.mux(() => {
3235
+ const M = ot(this, R, () => {
3236
3236
  });
3237
3237
  M && be(this, ie(M));
3238
3238
  })), this._docUpdateHandler = (F, R) => {
3239
3239
  const M = re();
3240
- se(M, Ce), ct(M, F), Ge(this, ie(M));
3240
+ se(M, Ce), ut(M, F), Ge(this, ie(M));
3241
3241
  }, this._awarenessUpdateHandler = ({ added: F, updated: R, removed: M }, m) => {
3242
3242
  const c = F.concat(R).concat(M), S = re();
3243
3243
  se(S, Ae), Re(S, Oe(this.awareness, c)), Ge(this, ie(S));
@@ -3250,13 +3250,13 @@ Use Chrome, Firefox or Internet Explorer 11`);
3250
3250
  connect() {
3251
3251
  this.doc.on("update", this._docUpdateHandler), this.awareness.on("update", this._awarenessUpdateHandler), Be(this);
3252
3252
  const v = this.name;
3253
- pt(v, this._bcSubscriber), this.bcconnected = !0, ot(this);
3253
+ gt(v, this._bcSubscriber), this.bcconnected = !0, at(this);
3254
3254
  const x = re();
3255
3255
  se(x, Ce), Ke(x, this.doc), be(this, ie(x));
3256
3256
  const j = re();
3257
- se(j, Ce), ft(j, this.doc), be(this, ie(j));
3257
+ se(j, Ce), dt(j, this.doc), be(this, ie(j));
3258
3258
  const U = re();
3259
- se(U, nt), be(this, ie(U));
3259
+ se(U, it), be(this, ie(U));
3260
3260
  const F = re();
3261
3261
  se(F, Ae), Re(F, Oe(this.awareness, [this.doc.clientID])), be(this, ie(F));
3262
3262
  }
@@ -3268,7 +3268,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
3268
3268
  });
3269
3269
  }), Ve(this.awareness, [this.doc.clientID], "disconnect");
3270
3270
  const v = re();
3271
- se(v, We), $e(v, 0), Ue(v, this.peerId), be(this, ie(v)), ut(this.name, this._bcSubscriber), this.bcconnected = !1, this.doc.off("update", this._docUpdateHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.webrtcConns.forEach((x) => x.destroy());
3271
+ se(v, We), $e(v, 0), Ue(v, this.peerId), be(this, ie(v)), ht(this.name, this._bcSubscriber), this.bcconnected = !1, this.doc.off("update", this._docUpdateHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.webrtcConns.forEach((x) => x.destroy());
3272
3272
  }
3273
3273
  destroy() {
3274
3274
  this.disconnect(), typeof window < "u" ? window.removeEventListener("beforeunload", this._beforeUnloadHandler) : typeof process < "u" && process.off("exit", this._beforeUnloadHandler);
@@ -3282,7 +3282,7 @@ Use Chrome, Firefox or Internet Explorer 11`);
3282
3282
  v.send({
3283
3283
  type: "publish",
3284
3284
  topic: x.name,
3285
- data: Tt(U)
3285
+ data: At(U)
3286
3286
  });
3287
3287
  }) : v.send({
3288
3288
  type: "publish",
@@ -3338,18 +3338,17 @@ Use Chrome, Firefox or Internet Explorer 11`);
3338
3338
  S.glareToken = void 0;
3339
3339
  }
3340
3340
  R.to === m && (De(M, R.from, () => new ze(this, !1, R.from, U)).peer.signal(R.signal), c());
3341
- break;
3342
3341
  }
3343
3342
  };
3344
- U.key ? typeof x.data == "string" && zt(Ct(x.data), U.key).then(F) : F(x.data);
3343
+ U.key ? typeof x.data == "string" && zt(Rt(x.data), U.key).then(F) : F(x.data);
3345
3344
  }
3346
3345
  }
3347
3346
  }), this.on("disconnect", () => ne(`disconnect (${v})`));
3348
3347
  }
3349
3348
  }, Ie = (v) => {
3350
3349
  v.emit("status", [{ connected: v.connected }]);
3351
- }, er = class extends Et {
3352
- constructor(v, x, { signaling: j = ["wss://y-webrtc-eu.fly.dev"], password: U = null, awareness: F = new dt(x), maxConns: R = 20 + bt(_t() * 15), filterBcConns: M = !0, peerOpts: m = {} } = {}) {
3350
+ }, er = class extends Ct {
3351
+ constructor(v, x, { signaling: j = ["wss://y-webrtc-eu.fly.dev"], password: U = null, awareness: F = new pt(x), maxConns: R = 20 + mt(vt() * 15), filterBcConns: M = !0, peerOpts: m = {} } = {}) {
3353
3352
  super(), this.roomName = v, this.doc = x, this.filterBcConns = M, this.awareness = F, this.shouldConnect = !1, this.signalingUrls = j, this.signalingConns = [], this.maxConns = R, this.peerOpts = m, this.key = U ? Vt(U, v) : qe(null), this.room = null, this.key.then((c) => {
3354
3353
  this.room = Jt(x, this, v, c), this.shouldConnect ? this.room.connect() : this.room.disconnect(), Ie(this);
3355
3354
  }), this.connect(), this.destroy = this.destroy.bind(this), x.on("destroy", this.destroy);
@@ -0,0 +1,125 @@
1
+ import { a as W, c as L, d as $, i as R, l as r, n as E, o as _, r as w, s as N, t as O, u as Q } from "./awareness-CrSnuSE_.js";
2
+ import { A as m, C as o, F as S, R as j, S as z, T as a, V as F, _ as q, b as G, d as U, k as i, p as J, w as H, x as T, z as K } from "./yjs-DbU20bpp.js";
3
+ var X = (s, n, e) => {
4
+ T(s) === 0 && e(n, G(s));
5
+ }, Y = (s) => J(s, (n, e) => `${encodeURIComponent(e)}=${encodeURIComponent(n)}`).join("&");
6
+ var y = [];
7
+ y[0] = (s, n, e, t, c) => {
8
+ i(s, 0);
9
+ const d = W(n, s, e.doc, e);
10
+ t && d === 1 && !e.synced && (e.synced = !0);
11
+ };
12
+ y[3] = (s, n, e, t, c) => {
13
+ i(s, 1), m(s, w(e.awareness, Array.from(e.awareness.getStates().keys())));
14
+ };
15
+ y[1] = (s, n, e, t, c) => {
16
+ E(e.awareness, z(n), e);
17
+ };
18
+ y[2] = (s, n, e, t, c) => {
19
+ X(n, e.doc, (d, u) => Z(e, u));
20
+ };
21
+ var I = 3e4, Z = (s, n) => console.warn(`Permission denied to access ${s.url}.
22
+ ${n}`), k = (s, n, e) => {
23
+ const t = q(n), c = o(), d = T(t), u = s.messageHandlers[d];
24
+ return u ? u(c, t, s, e, d) : console.error("Unable to compute message"), c;
25
+ }, p = (s) => !(s.code >= 4400 && s.code < 4500), C = (s, n, e) => {
26
+ if (n !== null && n === s.ws) {
27
+ s.emit("connection-close", [e, s]), s.ws = null, n.onmessage = null, n.onopen = null, n.onclose = null, n.onerror = () => {
28
+ }, n.close(), s.wsconnecting = !1, s.wsconnected && (s.wsconnected = !1, s.synced = !1, R(s.awareness, Array.from(s.awareness.getStates().keys()).filter((c) => c !== s.doc.clientID), s), s.emit("status", [{ status: "disconnected" }])), s.wsUnsuccessfulReconnects++;
29
+ let t = null;
30
+ e != null && !s.shouldReconnect(e, s) && (s.shouldConnect = !1, t = {
31
+ code: e.code,
32
+ reason: e.reason
33
+ }), setTimeout(x, j(K(2, s.wsUnsuccessfulReconnects) * 100, s.maxBackoffTime), s), t !== null && s.emit("closed", [t, s]);
34
+ }
35
+ }, x = (s) => {
36
+ if (s.shouldConnect && s.ws === null) {
37
+ const n = new s._WS(s.url, s.protocols);
38
+ n.binaryType = "arraybuffer", s.ws = n, s.wsconnecting = !0, s.wsconnected = !1, s.synced = !1, n.onmessage = (e) => {
39
+ if (s.ws !== n) return;
40
+ s.wsLastMessageReceived = S();
41
+ const t = k(s, new Uint8Array(e.data), !0);
42
+ H(t) > 1 && n.send(a(t));
43
+ }, n.onerror = (e) => {
44
+ s.ws === n && s.emit("connection-error", [e, s]);
45
+ }, n.onclose = (e) => {
46
+ C(s, n, e);
47
+ }, n.onopen = () => {
48
+ if (s.ws !== n) return;
49
+ s.wsLastMessageReceived = S(), s.wsconnecting = !1, s.wsconnected = !0, s.emit("status", [{ status: "connected" }]);
50
+ const e = o();
51
+ if (i(e, 0), _(e, s.doc), n.send(a(e)), s.awareness.getLocalState() !== null) {
52
+ const t = o();
53
+ i(t, 1), m(t, w(s.awareness, [s.doc.clientID])), n.send(a(t));
54
+ }
55
+ }, s.emit("status", [{ status: "connecting" }]);
56
+ }
57
+ }, b = (s, n) => {
58
+ const e = s.ws;
59
+ s.wsconnected && e && e.readyState === e.OPEN && e.send(n), s.bcconnected && r(s.bcChannel, n, s);
60
+ }, ns = class extends F {
61
+ constructor(s, n, e, { connect: t = !0, awareness: c = new O(e), params: d = {}, protocols: u = [], WebSocketPolyfill: M = WebSocket, resyncInterval: A = -1, maxBackoffTime: B = 2500, disableBc: D = !1, shouldReconnect: P = p } = {}) {
62
+ for (super(); s[s.length - 1] === "/"; ) s = s.slice(0, s.length - 1);
63
+ this.serverUrl = s, this.bcChannel = s + "/" + n, this.maxBackoffTime = B, this.shouldReconnect = P, this.params = d, this.protocols = u, this.roomname = n, this.doc = e, this._WS = M, this.awareness = c, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = D, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = y.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = t, this._resyncInterval = 0, A > 0 && (this._resyncInterval = setInterval(() => {
64
+ if (this.ws && this.ws.readyState === WebSocket.OPEN) {
65
+ const l = o();
66
+ i(l, 0), _(l, e), this.ws.send(a(l));
67
+ }
68
+ }, A)), this._bcSubscriber = (l, f) => {
69
+ if (f !== this) {
70
+ const h = k(this, new Uint8Array(l), !1);
71
+ H(h) > 1 && r(this.bcChannel, a(h), this);
72
+ }
73
+ }, this._updateHandler = (l, f) => {
74
+ if (f !== this) {
75
+ const h = o();
76
+ i(h, 0), L(h, l), b(this, a(h));
77
+ }
78
+ }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: l, updated: f, removed: h }, v) => {
79
+ const V = l.concat(f).concat(h), g = o();
80
+ i(g, 1), m(g, w(c, V)), b(this, a(g));
81
+ }, this._exitHandler = () => {
82
+ R(this.awareness, [e.clientID], "app closed");
83
+ }, U && typeof process < "u" && process.on("exit", this._exitHandler), c.on("update", this._awarenessUpdateHandler), this._checkInterval = setInterval(() => {
84
+ this.wsconnected && I < S() - this.wsLastMessageReceived && C(this, this.ws, null);
85
+ }, I / 10), t && this.connect();
86
+ }
87
+ get url() {
88
+ const s = Y(this.params);
89
+ return this.serverUrl + "/" + this.roomname + (s.length === 0 ? "" : "?" + s);
90
+ }
91
+ get synced() {
92
+ return this._synced;
93
+ }
94
+ set synced(s) {
95
+ this._synced !== s && (this._synced = s, s && (this.wsUnsuccessfulReconnects = 0), this.emit("synced", [s]), this.emit("sync", [s]));
96
+ }
97
+ destroy() {
98
+ this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), U && typeof process < "u" && process.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
99
+ }
100
+ connectBc() {
101
+ if (this.disableBc) return;
102
+ this.bcconnected || (Q(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
103
+ const s = o();
104
+ i(s, 0), _(s, this.doc), r(this.bcChannel, a(s), this);
105
+ const n = o();
106
+ i(n, 0), N(n, this.doc), r(this.bcChannel, a(n), this);
107
+ const e = o();
108
+ i(e, 3), r(this.bcChannel, a(e), this);
109
+ const t = o();
110
+ i(t, 1), m(t, w(this.awareness, [this.doc.clientID])), r(this.bcChannel, a(t), this);
111
+ }
112
+ disconnectBc() {
113
+ const s = o();
114
+ i(s, 1), m(s, w(this.awareness, [this.doc.clientID], /* @__PURE__ */ new Map())), b(this, a(s)), this.bcconnected && ($(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
115
+ }
116
+ disconnect() {
117
+ this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && C(this, this.ws, null);
118
+ }
119
+ connect() {
120
+ this.shouldConnect = !0, !this.wsconnected && this.ws === null && (x(this), this.connectBc());
121
+ }
122
+ };
123
+ export {
124
+ ns as WebsocketProvider
125
+ };