@thatopen/services 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,75 +1,75 @@
1
- var Ge = Object.defineProperty;
2
- var be = (n) => {
1
+ var Ye = Object.defineProperty;
2
+ var Ee = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var je = (n, e, t) => e in n ? Ge(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
- var w = (n, e, t) => je(n, typeof e != "symbol" ? e + "" : e, t), K = (n, e, t) => e.has(n) || be("Cannot " + t);
7
- var W = (n, e, t) => (K(n, e, "read from private field"), t ? t.call(n) : e.get(n)), X = (n, e, t) => e.has(n) ? be("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), Te = (n, e, t, s) => (K(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (K(n, e, "access private method"), t);
8
- const v = /* @__PURE__ */ Object.create(null);
9
- v.open = "0";
10
- v.close = "1";
11
- v.ping = "2";
12
- v.pong = "3";
13
- v.message = "4";
14
- v.upgrade = "5";
15
- v.noop = "6";
16
- const M = /* @__PURE__ */ Object.create(null);
17
- Object.keys(v).forEach((n) => {
18
- M[v[n]] = n;
5
+ var Ke = (n, e, t) => e in n ? Ye(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var w = (n, e, t) => Ke(n, typeof e != "symbol" ? e + "" : e, t), W = (n, e, t) => e.has(n) || Ee("Cannot " + t);
7
+ var X = (n, e, t) => (W(n, e, "read from private field"), t ? t.call(n) : e.get(n)), z = (n, e, t) => e.has(n) ? Ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ve = (n, e, t, s) => (W(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (W(n, e, "access private method"), t);
8
+ const A = /* @__PURE__ */ Object.create(null);
9
+ A.open = "0";
10
+ A.close = "1";
11
+ A.ping = "2";
12
+ A.pong = "3";
13
+ A.message = "4";
14
+ A.upgrade = "5";
15
+ A.noop = "6";
16
+ const V = /* @__PURE__ */ Object.create(null);
17
+ Object.keys(A).forEach((n) => {
18
+ V[A[n]] = n;
19
19
  });
20
- const ne = { type: "error", data: "parser error" }, Ce = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Re = typeof ArrayBuffer == "function", Be = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, pe = ({ type: n, data: e }, t, s) => Ce && e instanceof Blob ? t ? s(e) : Ee(e, s) : Re && (e instanceof ArrayBuffer || Be(e)) ? t ? s(e) : Ee(new Blob([e]), s) : s(v[n] + (e || "")), Ee = (n, e) => {
20
+ const re = { type: "error", data: "parser error" }, Ne = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", xe = typeof ArrayBuffer == "function", Pe = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, de = ({ type: n, data: e }, t, s) => Ne && e instanceof Blob ? t ? s(e) : ke(e, s) : xe && (e instanceof ArrayBuffer || Pe(e)) ? t ? s(e) : ke(new Blob([e]), s) : s(A[n] + (e || "")), ke = (n, e) => {
21
21
  const t = new FileReader();
22
22
  return t.onload = function() {
23
23
  const s = t.result.split(",")[1];
24
24
  e("b" + (s || ""));
25
25
  }, t.readAsDataURL(n);
26
26
  };
27
- function ve(n) {
27
+ function Ae(n) {
28
28
  return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
29
29
  }
30
- let z;
31
- function Je(n, e) {
32
- if (Ce && n.data instanceof Blob)
33
- return n.data.arrayBuffer().then(ve).then(e);
34
- if (Re && (n.data instanceof ArrayBuffer || Be(n.data)))
35
- return e(ve(n.data));
36
- pe(n, !1, (t) => {
37
- z || (z = new TextEncoder()), e(z.encode(t));
30
+ let Q;
31
+ function We(n, e) {
32
+ if (Ne && n.data instanceof Blob)
33
+ return n.data.arrayBuffer().then(Ae).then(e);
34
+ if (xe && (n.data instanceof ArrayBuffer || Pe(n.data)))
35
+ return e(Ae(n.data));
36
+ de(n, !1, (t) => {
37
+ Q || (Q = new TextEncoder()), e(Q.encode(t));
38
38
  });
39
39
  }
40
- const ke = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
- for (let n = 0; n < ke.length; n++)
42
- L[ke.charCodeAt(n)] = n;
43
- const Ye = (n) => {
44
- let e = n.length * 0.75, t = n.length, s, i = 0, r, a, h, l;
40
+ const Oe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
+ for (let n = 0; n < Oe.length; n++)
42
+ L[Oe.charCodeAt(n)] = n;
43
+ const Xe = (n) => {
44
+ let e = n.length * 0.75, t = n.length, s, r = 0, i, o, h, l;
45
45
  n[n.length - 1] === "=" && (e--, n[n.length - 2] === "=" && e--);
46
46
  const y = new ArrayBuffer(e), d = new Uint8Array(y);
47
47
  for (s = 0; s < t; s += 4)
48
- r = L[n.charCodeAt(s)], a = L[n.charCodeAt(s + 1)], h = L[n.charCodeAt(s + 2)], l = L[n.charCodeAt(s + 3)], d[i++] = r << 2 | a >> 4, d[i++] = (a & 15) << 4 | h >> 2, d[i++] = (h & 3) << 6 | l & 63;
48
+ i = L[n.charCodeAt(s)], o = L[n.charCodeAt(s + 1)], h = L[n.charCodeAt(s + 2)], l = L[n.charCodeAt(s + 3)], d[r++] = i << 2 | o >> 4, d[r++] = (o & 15) << 4 | h >> 2, d[r++] = (h & 3) << 6 | l & 63;
49
49
  return y;
50
- }, Ke = typeof ArrayBuffer == "function", de = (n, e) => {
50
+ }, ze = typeof ArrayBuffer == "function", ye = (n, e) => {
51
51
  if (typeof n != "string")
52
52
  return {
53
53
  type: "message",
54
- data: Ne(n, e)
54
+ data: Ie(n, e)
55
55
  };
56
56
  const t = n.charAt(0);
57
57
  return t === "b" ? {
58
58
  type: "message",
59
- data: We(n.substring(1), e)
60
- } : M[t] ? n.length > 1 ? {
61
- type: M[t],
59
+ data: Qe(n.substring(1), e)
60
+ } : V[t] ? n.length > 1 ? {
61
+ type: V[t],
62
62
  data: n.substring(1)
63
63
  } : {
64
- type: M[t]
65
- } : ne;
66
- }, We = (n, e) => {
67
- if (Ke) {
68
- const t = Ye(n);
69
- return Ne(t, e);
64
+ type: V[t]
65
+ } : re;
66
+ }, Qe = (n, e) => {
67
+ if (ze) {
68
+ const t = Xe(n);
69
+ return Ie(t, e);
70
70
  } else
71
71
  return { base64: !0, data: n };
72
- }, Ne = (n, e) => {
72
+ }, Ie = (n, e) => {
73
73
  switch (e) {
74
74
  case "blob":
75
75
  return n instanceof Blob ? n : new Blob([n]);
@@ -77,103 +77,103 @@ const Ye = (n) => {
77
77
  default:
78
78
  return n instanceof ArrayBuffer ? n : n.buffer;
79
79
  }
80
- }, xe = "", Xe = (n, e) => {
80
+ }, Le = "", Ze = (n, e) => {
81
81
  const t = n.length, s = new Array(t);
82
- let i = 0;
83
- n.forEach((r, a) => {
84
- pe(r, !1, (h) => {
85
- s[a] = h, ++i === t && e(s.join(xe));
82
+ let r = 0;
83
+ n.forEach((i, o) => {
84
+ de(i, !1, (h) => {
85
+ s[o] = h, ++r === t && e(s.join(Le));
86
86
  });
87
87
  });
88
- }, ze = (n, e) => {
89
- const t = n.split(xe), s = [];
90
- for (let i = 0; i < t.length; i++) {
91
- const r = de(t[i], e);
92
- if (s.push(r), r.type === "error")
88
+ }, et = (n, e) => {
89
+ const t = n.split(Le), s = [];
90
+ for (let r = 0; r < t.length; r++) {
91
+ const i = ye(t[r], e);
92
+ if (s.push(i), i.type === "error")
93
93
  break;
94
94
  }
95
95
  return s;
96
96
  };
97
- function Qe() {
97
+ function tt() {
98
98
  return new TransformStream({
99
99
  transform(n, e) {
100
- Je(n, (t) => {
100
+ We(n, (t) => {
101
101
  const s = t.length;
102
- let i;
102
+ let r;
103
103
  if (s < 126)
104
- i = new Uint8Array(1), new DataView(i.buffer).setUint8(0, s);
104
+ r = new Uint8Array(1), new DataView(r.buffer).setUint8(0, s);
105
105
  else if (s < 65536) {
106
- i = new Uint8Array(3);
107
- const r = new DataView(i.buffer);
108
- r.setUint8(0, 126), r.setUint16(1, s);
106
+ r = new Uint8Array(3);
107
+ const i = new DataView(r.buffer);
108
+ i.setUint8(0, 126), i.setUint16(1, s);
109
109
  } else {
110
- i = new Uint8Array(9);
111
- const r = new DataView(i.buffer);
112
- r.setUint8(0, 127), r.setBigUint64(1, BigInt(s));
110
+ r = new Uint8Array(9);
111
+ const i = new DataView(r.buffer);
112
+ i.setUint8(0, 127), i.setBigUint64(1, BigInt(s));
113
113
  }
114
- n.data && typeof n.data != "string" && (i[0] |= 128), e.enqueue(i), e.enqueue(t);
114
+ n.data && typeof n.data != "string" && (r[0] |= 128), e.enqueue(r), e.enqueue(t);
115
115
  });
116
116
  }
117
117
  });
118
118
  }
119
- let Q;
119
+ let Z;
120
120
  function F(n) {
121
121
  return n.reduce((e, t) => e + t.length, 0);
122
122
  }
123
- function D(n, e) {
123
+ function M(n, e) {
124
124
  if (n[0].length === e)
125
125
  return n.shift();
126
126
  const t = new Uint8Array(e);
127
127
  let s = 0;
128
- for (let i = 0; i < e; i++)
129
- t[i] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
128
+ for (let r = 0; r < e; r++)
129
+ t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
130
130
  return n.length && s < n[0].length && (n[0] = n[0].slice(s)), t;
131
131
  }
132
- function Ze(n, e) {
133
- Q || (Q = new TextDecoder());
132
+ function st(n, e) {
133
+ Z || (Z = new TextDecoder());
134
134
  const t = [];
135
- let s = 0, i = -1, r = !1;
135
+ let s = 0, r = -1, i = !1;
136
136
  return new TransformStream({
137
- transform(a, h) {
138
- for (t.push(a); ; ) {
137
+ transform(o, h) {
138
+ for (t.push(o); ; ) {
139
139
  if (s === 0) {
140
140
  if (F(t) < 1)
141
141
  break;
142
- const l = D(t, 1);
143
- r = (l[0] & 128) === 128, i = l[0] & 127, i < 126 ? s = 3 : i === 126 ? s = 1 : s = 2;
142
+ const l = M(t, 1);
143
+ i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
144
144
  } else if (s === 1) {
145
145
  if (F(t) < 2)
146
146
  break;
147
- const l = D(t, 2);
148
- i = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
147
+ const l = M(t, 2);
148
+ r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
149
149
  } else if (s === 2) {
150
150
  if (F(t) < 8)
151
151
  break;
152
- const l = D(t, 8), y = new DataView(l.buffer, l.byteOffset, l.length), d = y.getUint32(0);
152
+ const l = M(t, 8), y = new DataView(l.buffer, l.byteOffset, l.length), d = y.getUint32(0);
153
153
  if (d > Math.pow(2, 21) - 1) {
154
- h.enqueue(ne);
154
+ h.enqueue(re);
155
155
  break;
156
156
  }
157
- i = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
157
+ r = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
158
158
  } else {
159
- if (F(t) < i)
159
+ if (F(t) < r)
160
160
  break;
161
- const l = D(t, i);
162
- h.enqueue(de(r ? l : Q.decode(l), e)), s = 0;
161
+ const l = M(t, r);
162
+ h.enqueue(ye(i ? l : Z.decode(l), e)), s = 0;
163
163
  }
164
- if (i === 0 || i > n) {
165
- h.enqueue(ne);
164
+ if (r === 0 || r > n) {
165
+ h.enqueue(re);
166
166
  break;
167
167
  }
168
168
  }
169
169
  }
170
170
  });
171
171
  }
172
- const Pe = 4;
172
+ const qe = 4;
173
173
  function g(n) {
174
- if (n) return et(n);
174
+ if (n) return nt(n);
175
175
  }
176
- function et(n) {
176
+ function nt(n) {
177
177
  for (var e in g.prototype)
178
178
  n[e] = g.prototype[e];
179
179
  return n;
@@ -194,9 +194,9 @@ g.prototype.off = g.prototype.removeListener = g.prototype.removeAllListeners =
194
194
  if (!t) return this;
195
195
  if (arguments.length == 1)
196
196
  return delete this._callbacks["$" + n], this;
197
- for (var s, i = 0; i < t.length; i++)
198
- if (s = t[i], s === e || s.fn === e) {
199
- t.splice(i, 1);
197
+ for (var s, r = 0; r < t.length; r++)
198
+ if (s = t[r], s === e || s.fn === e) {
199
+ t.splice(r, 1);
200
200
  break;
201
201
  }
202
202
  return t.length === 0 && delete this._callbacks["$" + n], this;
@@ -207,7 +207,7 @@ g.prototype.emit = function(n) {
207
207
  e[s - 1] = arguments[s];
208
208
  if (t) {
209
209
  t = t.slice(0);
210
- for (var s = 0, i = t.length; s < i; ++s)
210
+ for (var s = 0, r = t.length; s < r; ++s)
211
211
  t[s].apply(this, e);
212
212
  }
213
213
  return this;
@@ -219,47 +219,47 @@ g.prototype.listeners = function(n) {
219
219
  g.prototype.hasListeners = function(n) {
220
220
  return !!this.listeners(n).length;
221
221
  };
222
- const J = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), _ = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), tt = "arraybuffer";
223
- function Ie(n, ...e) {
222
+ const Y = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), _ = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), rt = "arraybuffer";
223
+ function Ue(n, ...e) {
224
224
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
225
225
  }
226
- const st = _.setTimeout, nt = _.clearTimeout;
227
- function Y(n, e) {
228
- e.useNativeTimers ? (n.setTimeoutFn = st.bind(_), n.clearTimeoutFn = nt.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
226
+ const it = _.setTimeout, ot = _.clearTimeout;
227
+ function K(n, e) {
228
+ e.useNativeTimers ? (n.setTimeoutFn = it.bind(_), n.clearTimeoutFn = ot.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
229
229
  }
230
- const it = 1.33;
231
- function rt(n) {
232
- return typeof n == "string" ? ot(n) : Math.ceil((n.byteLength || n.size) * it);
230
+ const at = 1.33;
231
+ function ct(n) {
232
+ return typeof n == "string" ? ht(n) : Math.ceil((n.byteLength || n.size) * at);
233
233
  }
234
- function ot(n) {
234
+ function ht(n) {
235
235
  let e = 0, t = 0;
236
- for (let s = 0, i = n.length; s < i; s++)
236
+ for (let s = 0, r = n.length; s < r; s++)
237
237
  e = n.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4);
238
238
  return t;
239
239
  }
240
- function Le() {
240
+ function De() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
- function at(n) {
243
+ function ut(n) {
244
244
  let e = "";
245
245
  for (let t in n)
246
246
  n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
247
247
  return e;
248
248
  }
249
- function ct(n) {
249
+ function lt(n) {
250
250
  let e = {}, t = n.split("&");
251
- for (let s = 0, i = t.length; s < i; s++) {
252
- let r = t[s].split("=");
253
- e[decodeURIComponent(r[0])] = decodeURIComponent(r[1]);
251
+ for (let s = 0, r = t.length; s < r; s++) {
252
+ let i = t[s].split("=");
253
+ e[decodeURIComponent(i[0])] = decodeURIComponent(i[1]);
254
254
  }
255
255
  return e;
256
256
  }
257
- class ht extends Error {
257
+ class ft extends Error {
258
258
  constructor(e, t, s) {
259
259
  super(e), this.description = t, this.context = s, this.type = "TransportError";
260
260
  }
261
261
  }
262
- class ye extends g {
262
+ class me extends g {
263
263
  /**
264
264
  * Transport abstract constructor.
265
265
  *
@@ -267,7 +267,7 @@ class ye extends g {
267
267
  * @protected
268
268
  */
269
269
  constructor(e) {
270
- super(), this.writable = !1, Y(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
270
+ super(), this.writable = !1, K(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
271
271
  }
272
272
  /**
273
273
  * Emits an error.
@@ -279,7 +279,7 @@ class ye extends g {
279
279
  * @protected
280
280
  */
281
281
  onError(e, t, s) {
282
- return super.emitReserved("error", new ht(e, t, s)), this;
282
+ return super.emitReserved("error", new ft(e, t, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -316,7 +316,7 @@ class ye extends g {
316
316
  * @protected
317
317
  */
318
318
  onData(e) {
319
- const t = de(e, this.socket.binaryType);
319
+ const t = ye(e, this.socket.binaryType);
320
320
  this.onPacket(t);
321
321
  }
322
322
  /**
@@ -353,11 +353,11 @@ class ye extends g {
353
353
  return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
354
354
  }
355
355
  _query(e) {
356
- const t = at(e);
356
+ const t = ut(e);
357
357
  return t.length ? "?" + t : "";
358
358
  }
359
359
  }
360
- class ut extends ye {
360
+ class pt extends me {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class ut extends ye {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- ze(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ et(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
417
417
  }
418
418
  /**
419
419
  * For polling, send a close packet.
@@ -433,7 +433,7 @@ class ut extends ye {
433
433
  * @protected
434
434
  */
435
435
  write(e) {
436
- this.writable = !1, Xe(e, (t) => {
436
+ this.writable = !1, Ze(e, (t) => {
437
437
  this.doWrite(t, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -446,18 +446,18 @@ class ut extends ye {
446
446
  */
447
447
  uri() {
448
448
  const e = this.opts.secure ? "https" : "http", t = this.query || {};
449
- return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Le()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
449
+ return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = De()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
450
450
  }
451
451
  }
452
- let qe = !1;
452
+ let Fe = !1;
453
453
  try {
454
- qe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ Fe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const lt = qe;
458
- function ft() {
457
+ const dt = Fe;
458
+ function yt() {
459
459
  }
460
- class pt extends ut {
460
+ class mt extends pt {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -483,8 +483,8 @@ class pt extends ut {
483
483
  method: "POST",
484
484
  data: e
485
485
  });
486
- s.on("success", t), s.on("error", (i, r) => {
487
- this.onError("xhr post error", i, r);
486
+ s.on("success", t), s.on("error", (r, i) => {
487
+ this.onError("xhr post error", r, i);
488
488
  });
489
489
  }
490
490
  /**
@@ -499,7 +499,7 @@ class pt extends ut {
499
499
  }), this.pollXhr = e;
500
500
  }
501
501
  }
502
- class E extends g {
502
+ class k extends g {
503
503
  /**
504
504
  * Request constructor
505
505
  *
@@ -507,7 +507,7 @@ class E extends g {
507
507
  * @package
508
508
  */
509
509
  constructor(e, t, s) {
510
- super(), this.createRequest = e, Y(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
510
+ super(), this.createRequest = e, K(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
511
511
  }
512
512
  /**
513
513
  * Creates the XHR object and sends the request.
@@ -516,7 +516,7 @@ class E extends g {
516
516
  */
517
517
  _create() {
518
518
  var e;
519
- const t = Ie(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
519
+ const t = Ue(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
520
520
  t.xdomain = !!this._opts.xd;
521
521
  const s = this._xhr = this.createRequest(t);
522
522
  try {
@@ -524,8 +524,8 @@ class E extends g {
524
524
  try {
525
525
  if (this._opts.extraHeaders) {
526
526
  s.setDisableHeaderCheck && s.setDisableHeaderCheck(!0);
527
- for (let i in this._opts.extraHeaders)
528
- this._opts.extraHeaders.hasOwnProperty(i) && s.setRequestHeader(i, this._opts.extraHeaders[i]);
527
+ for (let r in this._opts.extraHeaders)
528
+ this._opts.extraHeaders.hasOwnProperty(r) && s.setRequestHeader(r, this._opts.extraHeaders[r]);
529
529
  }
530
530
  } catch {
531
531
  }
@@ -539,21 +539,21 @@ class E extends g {
539
539
  } catch {
540
540
  }
541
541
  (e = this._opts.cookieJar) === null || e === void 0 || e.addCookies(s), "withCredentials" in s && (s.withCredentials = this._opts.withCredentials), this._opts.requestTimeout && (s.timeout = this._opts.requestTimeout), s.onreadystatechange = () => {
542
- var i;
543
- s.readyState === 3 && ((i = this._opts.cookieJar) === null || i === void 0 || i.parseCookies(
542
+ var r;
543
+ s.readyState === 3 && ((r = this._opts.cookieJar) === null || r === void 0 || r.parseCookies(
544
544
  // @ts-ignore
545
545
  s.getResponseHeader("set-cookie")
546
546
  )), s.readyState === 4 && (s.status === 200 || s.status === 1223 ? this._onLoad() : this.setTimeoutFn(() => {
547
547
  this._onError(typeof s.status == "number" ? s.status : 0);
548
548
  }, 0));
549
549
  }, s.send(this._data);
550
- } catch (i) {
550
+ } catch (r) {
551
551
  this.setTimeoutFn(() => {
552
- this._onError(i);
552
+ this._onError(r);
553
553
  }, 0);
554
554
  return;
555
555
  }
556
- typeof document < "u" && (this._index = E.requestsCount++, E.requests[this._index] = this);
556
+ typeof document < "u" && (this._index = k.requestsCount++, k.requests[this._index] = this);
557
557
  }
558
558
  /**
559
559
  * Called upon error.
@@ -570,12 +570,12 @@ class E extends g {
570
570
  */
571
571
  _cleanup(e) {
572
572
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
573
- if (this._xhr.onreadystatechange = ft, e)
573
+ if (this._xhr.onreadystatechange = yt, e)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
577
577
  }
578
- typeof document < "u" && delete E.requests[this._index], this._xhr = null;
578
+ typeof document < "u" && delete k.requests[this._index], this._xhr = null;
579
579
  }
580
580
  }
581
581
  /**
@@ -596,40 +596,40 @@ class E extends g {
596
596
  this._cleanup();
597
597
  }
598
598
  }
599
- E.requestsCount = 0;
600
- E.requests = {};
599
+ k.requestsCount = 0;
600
+ k.requests = {};
601
601
  if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
- attachEvent("onunload", Oe);
603
+ attachEvent("onunload", Se);
604
604
  else if (typeof addEventListener == "function") {
605
605
  const n = "onpagehide" in _ ? "pagehide" : "unload";
606
- addEventListener(n, Oe, !1);
606
+ addEventListener(n, Se, !1);
607
607
  }
608
608
  }
609
- function Oe() {
610
- for (let n in E.requests)
611
- E.requests.hasOwnProperty(n) && E.requests[n].abort();
609
+ function Se() {
610
+ for (let n in k.requests)
611
+ k.requests.hasOwnProperty(n) && k.requests[n].abort();
612
612
  }
613
- const dt = function() {
614
- const n = Ue({
613
+ const gt = function() {
614
+ const n = Me({
615
615
  xdomain: !1
616
616
  });
617
617
  return n && n.responseType !== null;
618
618
  }();
619
- class yt extends pt {
619
+ class wt extends mt {
620
620
  constructor(e) {
621
621
  super(e);
622
622
  const t = e && e.forceBase64;
623
- this.supportsBinary = dt && !t;
623
+ this.supportsBinary = gt && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new E(Ue, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new k(Me, this.uri(), e);
627
627
  }
628
628
  }
629
- function Ue(n) {
629
+ function Me(n) {
630
630
  const e = n.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!e || lt))
632
+ if (typeof XMLHttpRequest < "u" && (!e || dt))
633
633
  return new XMLHttpRequest();
634
634
  } catch {
635
635
  }
@@ -639,18 +639,18 @@ function Ue(n) {
639
639
  } catch {
640
640
  }
641
641
  }
642
- const Fe = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class mt extends ye {
642
+ const Ve = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class _t extends me {
644
644
  get name() {
645
645
  return "websocket";
646
646
  }
647
647
  doOpen() {
648
- const e = this.uri(), t = this.opts.protocols, s = Fe ? {} : Ie(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
648
+ const e = this.uri(), t = this.opts.protocols, s = Ve ? {} : Ue(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
649
649
  this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);
650
650
  try {
651
651
  this.ws = this.createSocket(e, t, s);
652
- } catch (i) {
653
- return this.emitReserved("error", i);
652
+ } catch (r) {
653
+ return this.emitReserved("error", r);
654
654
  }
655
655
  this.ws.binaryType = this.socket.binaryType, this.addEventListeners();
656
656
  }
@@ -670,13 +670,13 @@ class mt extends ye {
670
670
  write(e) {
671
671
  this.writable = !1;
672
672
  for (let t = 0; t < e.length; t++) {
673
- const s = e[t], i = t === e.length - 1;
674
- pe(s, this.supportsBinary, (r) => {
673
+ const s = e[t], r = t === e.length - 1;
674
+ de(s, this.supportsBinary, (i) => {
675
675
  try {
676
- this.doWrite(s, r);
676
+ this.doWrite(s, i);
677
677
  } catch {
678
678
  }
679
- i && J(() => {
679
+ r && Y(() => {
680
680
  this.writable = !0, this.emitReserved("drain");
681
681
  }, this.setTimeoutFn);
682
682
  });
@@ -693,19 +693,19 @@ class mt extends ye {
693
693
  */
694
694
  uri() {
695
695
  const e = this.opts.secure ? "wss" : "ws", t = this.query || {};
696
- return this.opts.timestampRequests && (t[this.opts.timestampParam] = Le()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
696
+ return this.opts.timestampRequests && (t[this.opts.timestampParam] = De()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
697
697
  }
698
698
  }
699
- const Z = _.WebSocket || _.MozWebSocket;
700
- class gt extends mt {
699
+ const ee = _.WebSocket || _.MozWebSocket;
700
+ class bt extends _t {
701
701
  createSocket(e, t, s) {
702
- return Fe ? new Z(e, t, s) : t ? new Z(e, t) : new Z(e);
702
+ return Ve ? new ee(e, t, s) : t ? new ee(e, t) : new ee(e);
703
703
  }
704
704
  doWrite(e, t) {
705
705
  this.ws.send(t);
706
706
  }
707
707
  }
708
- class wt extends ye {
708
+ class Tt extends me {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,26 +721,26 @@ class wt extends ye {
721
721
  this.onError("webtransport error", e);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((e) => {
724
- const t = Ze(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), i = Qe();
725
- i.readable.pipeTo(e.writable), this._writer = i.writable.getWriter();
726
- const r = () => {
724
+ const t = st(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = tt();
725
+ r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
726
+ const i = () => {
727
727
  s.read().then(({ done: h, value: l }) => {
728
- h || (this.onPacket(l), r());
728
+ h || (this.onPacket(l), i());
729
729
  }).catch((h) => {
730
730
  });
731
731
  };
732
- r();
733
- const a = { type: "open" };
734
- this.query.sid && (a.data = `{"sid":"${this.query.sid}"}`), this._writer.write(a).then(() => this.onOpen());
732
+ i();
733
+ const o = { type: "open" };
734
+ this.query.sid && (o.data = `{"sid":"${this.query.sid}"}`), this._writer.write(o).then(() => this.onOpen());
735
735
  });
736
736
  });
737
737
  }
738
738
  write(e) {
739
739
  this.writable = !1;
740
740
  for (let t = 0; t < e.length; t++) {
741
- const s = e[t], i = t === e.length - 1;
741
+ const s = e[t], r = t === e.length - 1;
742
742
  this._writer.write(s).then(() => {
743
- i && J(() => {
743
+ r && Y(() => {
744
744
  this.writable = !0, this.emitReserved("drain");
745
745
  }, this.setTimeoutFn);
746
746
  });
@@ -751,11 +751,11 @@ class wt extends ye {
751
751
  (e = this._transport) === null || e === void 0 || e.close();
752
752
  }
753
753
  }
754
- const _t = {
755
- websocket: gt,
756
- webtransport: wt,
757
- polling: yt
758
- }, bt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Tt = [
754
+ const Et = {
755
+ websocket: bt,
756
+ webtransport: Tt,
757
+ polling: wt
758
+ }, vt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, kt = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -776,24 +776,24 @@ function ie(n) {
776
776
  throw "URI too long";
777
777
  const e = n, t = n.indexOf("["), s = n.indexOf("]");
778
778
  t != -1 && s != -1 && (n = n.substring(0, t) + n.substring(t, s).replace(/:/g, ";") + n.substring(s, n.length));
779
- let i = bt.exec(n || ""), r = {}, a = 14;
780
- for (; a--; )
781
- r[Tt[a]] = i[a] || "";
782
- return t != -1 && s != -1 && (r.source = e, r.host = r.host.substring(1, r.host.length - 1).replace(/;/g, ":"), r.authority = r.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), r.ipv6uri = !0), r.pathNames = Et(r, r.path), r.queryKey = vt(r, r.query), r;
779
+ let r = vt.exec(n || ""), i = {}, o = 14;
780
+ for (; o--; )
781
+ i[kt[o]] = r[o] || "";
782
+ return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = At(i, i.path), i.queryKey = Ot(i, i.query), i;
783
783
  }
784
- function Et(n, e) {
784
+ function At(n, e) {
785
785
  const t = /\/{2,9}/g, s = e.replace(t, "/").split("/");
786
786
  return (e.slice(0, 1) == "/" || e.length === 0) && s.splice(0, 1), e.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
787
787
  }
788
- function vt(n, e) {
788
+ function Ot(n, e) {
789
789
  const t = {};
790
- return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, i, r) {
791
- i && (t[i] = r);
790
+ return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
791
+ r && (t[r] = i);
792
792
  }), t;
793
793
  }
794
- const re = typeof addEventListener == "function" && typeof removeEventListener == "function", V = [];
795
- re && addEventListener("offline", () => {
796
- V.forEach((n) => n());
794
+ const oe = typeof addEventListener == "function" && typeof removeEventListener == "function", H = [];
795
+ oe && addEventListener("offline", () => {
796
+ H.forEach((n) => n());
797
797
  }, !1);
798
798
  class R extends g {
799
799
  /**
@@ -803,13 +803,13 @@ class R extends g {
803
803
  * @param {Object} opts - options
804
804
  */
805
805
  constructor(e, t) {
806
- if (super(), this.binaryType = tt, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
806
+ if (super(), this.binaryType = rt, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
807
807
  const s = ie(e);
808
808
  t.hostname = s.host, t.secure = s.protocol === "https" || s.protocol === "wss", t.port = s.port, s.query && (t.query = s.query);
809
809
  } else t.host && (t.hostname = ie(t.host).host);
810
- Y(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((s) => {
811
- const i = s.prototype.name;
812
- this.transports.push(i), this._transportsByName[i] = s;
810
+ K(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((s) => {
811
+ const r = s.prototype.name;
812
+ this.transports.push(r), this._transportsByName[r] = s;
813
813
  }), this.opts = Object.assign({
814
814
  path: "/engine.io",
815
815
  agent: !1,
@@ -824,13 +824,13 @@ class R extends g {
824
824
  },
825
825
  transportOptions: {},
826
826
  closeOnBeforeunload: !1
827
- }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = ct(this.opts.query)), re && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
827
+ }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = lt(this.opts.query)), oe && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
828
828
  this.transport && (this.transport.removeAllListeners(), this.transport.close());
829
829
  }, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
830
830
  this._onClose("transport close", {
831
831
  description: "network connection lost"
832
832
  });
833
- }, V.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
833
+ }, H.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
834
834
  }
835
835
  /**
836
836
  * Creates transport of the given type.
@@ -841,7 +841,7 @@ class R extends g {
841
841
  */
842
842
  createTransport(e) {
843
843
  const t = Object.assign({}, this.opts.query);
844
- t.EIO = Pe, t.transport = e, this.id && (t.sid = this.id);
844
+ t.EIO = qe, t.transport = e, this.id && (t.sid = this.id);
845
845
  const s = Object.assign({}, this.opts, {
846
846
  query: t,
847
847
  socket: this,
@@ -958,8 +958,8 @@ class R extends g {
958
958
  return this.writeBuffer;
959
959
  let t = 1;
960
960
  for (let s = 0; s < this.writeBuffer.length; s++) {
961
- const i = this.writeBuffer[s].data;
962
- if (i && (t += rt(i)), s > 0 && t > this._maxPayload)
961
+ const r = this.writeBuffer[s].data;
962
+ if (r && (t += ct(r)), s > 0 && t > this._maxPayload)
963
963
  return this.writeBuffer.slice(0, s);
964
964
  t += 2;
965
965
  }
@@ -979,7 +979,7 @@ class R extends g {
979
979
  if (!this._pingTimeoutTime)
980
980
  return !0;
981
981
  const e = Date.now() > this._pingTimeoutTime;
982
- return e && (this._pingTimeoutTime = 0, J(() => {
982
+ return e && (this._pingTimeoutTime = 0, Y(() => {
983
983
  this._onClose("ping timeout");
984
984
  }, this.setTimeoutFn)), e;
985
985
  }
@@ -1014,16 +1014,16 @@ class R extends g {
1014
1014
  * @param {Function} fn - callback function.
1015
1015
  * @private
1016
1016
  */
1017
- _sendPacket(e, t, s, i) {
1018
- if (typeof t == "function" && (i = t, t = void 0), typeof s == "function" && (i = s, s = null), this.readyState === "closing" || this.readyState === "closed")
1017
+ _sendPacket(e, t, s, r) {
1018
+ if (typeof t == "function" && (r = t, t = void 0), typeof s == "function" && (r = s, s = null), this.readyState === "closing" || this.readyState === "closed")
1019
1019
  return;
1020
1020
  s = s || {}, s.compress = s.compress !== !1;
1021
- const r = {
1021
+ const i = {
1022
1022
  type: e,
1023
1023
  data: t,
1024
1024
  options: s
1025
1025
  };
1026
- this.emitReserved("packetCreate", r), this.writeBuffer.push(r), i && this.once("flush", i), this.flush();
1026
+ this.emitReserved("packetCreate", i), this.writeBuffer.push(i), r && this.once("flush", r), this.flush();
1027
1027
  }
1028
1028
  /**
1029
1029
  * Closes the connection.
@@ -1057,16 +1057,16 @@ class R extends g {
1057
1057
  */
1058
1058
  _onClose(e, t) {
1059
1059
  if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
1060
- if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), re && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
- const s = V.indexOf(this._offlineEventListener);
1062
- s !== -1 && V.splice(s, 1);
1060
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), oe && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
+ const s = H.indexOf(this._offlineEventListener);
1062
+ s !== -1 && H.splice(s, 1);
1063
1063
  }
1064
1064
  this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
1065
1065
  }
1066
1066
  }
1067
1067
  }
1068
- R.protocol = Pe;
1069
- class kt extends R {
1068
+ R.protocol = qe;
1069
+ class St extends R {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -1084,7 +1084,7 @@ class kt extends R {
1084
1084
  _probe(e) {
1085
1085
  let t = this.createTransport(e), s = !1;
1086
1086
  R.priorWebsocketSuccess = !1;
1087
- const i = () => {
1087
+ const r = () => {
1088
1088
  s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
1089
1089
  if (!s)
1090
1090
  if (m.type === "pong" && m.data === "probe") {
@@ -1094,31 +1094,31 @@ class kt extends R {
1094
1094
  s || this.readyState !== "closed" && (d(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1095
1095
  });
1096
1096
  } else {
1097
- const k = new Error("probe error");
1098
- k.transport = t.name, this.emitReserved("upgradeError", k);
1097
+ const E = new Error("probe error");
1098
+ E.transport = t.name, this.emitReserved("upgradeError", E);
1099
1099
  }
1100
1100
  }));
1101
1101
  };
1102
- function r() {
1102
+ function i() {
1103
1103
  s || (s = !0, d(), t.close(), t = null);
1104
1104
  }
1105
- const a = (m) => {
1106
- const k = new Error("probe error: " + m);
1107
- k.transport = t.name, r(), this.emitReserved("upgradeError", k);
1105
+ const o = (m) => {
1106
+ const E = new Error("probe error: " + m);
1107
+ E.transport = t.name, i(), this.emitReserved("upgradeError", E);
1108
1108
  };
1109
1109
  function h() {
1110
- a("transport closed");
1110
+ o("transport closed");
1111
1111
  }
1112
1112
  function l() {
1113
- a("socket closed");
1113
+ o("socket closed");
1114
1114
  }
1115
1115
  function y(m) {
1116
- t && m.name !== t.name && r();
1116
+ t && m.name !== t.name && i();
1117
1117
  }
1118
1118
  const d = () => {
1119
- t.removeListener("open", i), t.removeListener("error", a), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1119
+ t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1120
1120
  };
1121
- t.once("open", i), t.once("error", a), t.once("close", h), this.once("close", l), this.once("upgrading", y), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1121
+ t.once("open", r), t.once("error", o), t.once("close", h), this.once("close", l), this.once("upgrading", y), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
1122
1122
  s || t.open();
1123
1123
  }, 200) : t.open();
1124
1124
  }
@@ -1138,67 +1138,67 @@ class kt extends R {
1138
1138
  return t;
1139
1139
  }
1140
1140
  }
1141
- let Ot = class extends kt {
1141
+ let $t = class extends St {
1142
1142
  constructor(e, t = {}) {
1143
- const s = typeof e == "object", i = s ? { ...e } : { ...t };
1144
- (!i.transports || i.transports && typeof i.transports[0] == "string") && (i.transports = (i.transports || ["polling", "websocket", "webtransport"]).map((r) => _t[r]).filter((r) => !!r)), super(s ? i : e, i);
1143
+ const s = typeof e == "object", r = s ? { ...e } : { ...t };
1144
+ (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Et[i]).filter((i) => !!i)), super(s ? r : e, r);
1145
1145
  }
1146
1146
  };
1147
- function St(n, e = "", t) {
1147
+ function Rt(n, e = "", t) {
1148
1148
  let s = n;
1149
1149
  t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = ie(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
1150
- const r = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
- return s.id = s.protocol + "://" + r + ":" + s.port + e, s.href = s.protocol + "://" + r + (t && t.port === s.port ? "" : ":" + s.port), s;
1150
+ const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
+ return s.id = s.protocol + "://" + i + ":" + s.port + e, s.href = s.protocol + "://" + i + (t && t.port === s.port ? "" : ":" + s.port), s;
1152
1152
  }
1153
- const At = typeof ArrayBuffer == "function", $t = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, De = Object.prototype.toString, Ct = typeof Blob == "function" || typeof Blob < "u" && De.call(Blob) === "[object BlobConstructor]", Rt = typeof File == "function" || typeof File < "u" && De.call(File) === "[object FileConstructor]";
1154
- function me(n) {
1155
- return At && (n instanceof ArrayBuffer || $t(n)) || Ct && n instanceof Blob || Rt && n instanceof File;
1153
+ const Ct = typeof ArrayBuffer == "function", Bt = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, He = Object.prototype.toString, Nt = typeof Blob == "function" || typeof Blob < "u" && He.call(Blob) === "[object BlobConstructor]", xt = typeof File == "function" || typeof File < "u" && He.call(File) === "[object FileConstructor]";
1154
+ function ge(n) {
1155
+ return Ct && (n instanceof ArrayBuffer || Bt(n)) || Nt && n instanceof Blob || xt && n instanceof File;
1156
1156
  }
1157
- function H(n, e) {
1157
+ function j(n, e) {
1158
1158
  if (!n || typeof n != "object")
1159
1159
  return !1;
1160
1160
  if (Array.isArray(n)) {
1161
1161
  for (let t = 0, s = n.length; t < s; t++)
1162
- if (H(n[t]))
1162
+ if (j(n[t]))
1163
1163
  return !0;
1164
1164
  return !1;
1165
1165
  }
1166
- if (me(n))
1166
+ if (ge(n))
1167
1167
  return !0;
1168
1168
  if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
1169
- return H(n.toJSON(), !0);
1169
+ return j(n.toJSON(), !0);
1170
1170
  for (const t in n)
1171
- if (Object.prototype.hasOwnProperty.call(n, t) && H(n[t]))
1171
+ if (Object.prototype.hasOwnProperty.call(n, t) && j(n[t]))
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
1175
- function Bt(n) {
1175
+ function Pt(n) {
1176
1176
  const e = [], t = n.data, s = n;
1177
- return s.data = oe(t, e), s.attachments = e.length, { packet: s, buffers: e };
1177
+ return s.data = ae(t, e), s.attachments = e.length, { packet: s, buffers: e };
1178
1178
  }
1179
- function oe(n, e) {
1179
+ function ae(n, e) {
1180
1180
  if (!n)
1181
1181
  return n;
1182
- if (me(n)) {
1182
+ if (ge(n)) {
1183
1183
  const t = { _placeholder: !0, num: e.length };
1184
1184
  return e.push(n), t;
1185
1185
  } else if (Array.isArray(n)) {
1186
1186
  const t = new Array(n.length);
1187
1187
  for (let s = 0; s < n.length; s++)
1188
- t[s] = oe(n[s], e);
1188
+ t[s] = ae(n[s], e);
1189
1189
  return t;
1190
1190
  } else if (typeof n == "object" && !(n instanceof Date)) {
1191
1191
  const t = {};
1192
1192
  for (const s in n)
1193
- Object.prototype.hasOwnProperty.call(n, s) && (t[s] = oe(n[s], e));
1193
+ Object.prototype.hasOwnProperty.call(n, s) && (t[s] = ae(n[s], e));
1194
1194
  return t;
1195
1195
  }
1196
1196
  return n;
1197
1197
  }
1198
- function Nt(n, e) {
1199
- return n.data = ae(n.data, e), delete n.attachments, n;
1198
+ function It(n, e) {
1199
+ return n.data = ce(n.data, e), delete n.attachments, n;
1200
1200
  }
1201
- function ae(n, e) {
1201
+ function ce(n, e) {
1202
1202
  if (!n)
1203
1203
  return n;
1204
1204
  if (n && n._placeholder === !0) {
@@ -1207,13 +1207,13 @@ function ae(n, e) {
1207
1207
  throw new Error("illegal attachments");
1208
1208
  } else if (Array.isArray(n))
1209
1209
  for (let t = 0; t < n.length; t++)
1210
- n[t] = ae(n[t], e);
1210
+ n[t] = ce(n[t], e);
1211
1211
  else if (typeof n == "object")
1212
1212
  for (const t in n)
1213
- Object.prototype.hasOwnProperty.call(n, t) && (n[t] = ae(n[t], e));
1213
+ Object.prototype.hasOwnProperty.call(n, t) && (n[t] = ce(n[t], e));
1214
1214
  return n;
1215
1215
  }
1216
- const xt = [
1216
+ const Lt = [
1217
1217
  "connect",
1218
1218
  // used on the client side
1219
1219
  "connect_error",
@@ -1231,7 +1231,7 @@ var p;
1231
1231
  (function(n) {
1232
1232
  n[n.CONNECT = 0] = "CONNECT", n[n.DISCONNECT = 1] = "DISCONNECT", n[n.EVENT = 2] = "EVENT", n[n.ACK = 3] = "ACK", n[n.CONNECT_ERROR = 4] = "CONNECT_ERROR", n[n.BINARY_EVENT = 5] = "BINARY_EVENT", n[n.BINARY_ACK = 6] = "BINARY_ACK";
1233
1233
  })(p || (p = {}));
1234
- class Pt {
1234
+ class qt {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1247,7 +1247,7 @@ class Pt {
1247
1247
  * @param {Object} obj - packet object
1248
1248
  */
1249
1249
  encode(e) {
1250
- return (e.type === p.EVENT || e.type === p.ACK) && H(e) ? this.encodeAsBinary({
1250
+ return (e.type === p.EVENT || e.type === p.ACK) && j(e) ? this.encodeAsBinary({
1251
1251
  type: e.type === p.EVENT ? p.BINARY_EVENT : p.BINARY_ACK,
1252
1252
  nsp: e.nsp,
1253
1253
  data: e.data,
@@ -1267,11 +1267,11 @@ class Pt {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(e) {
1270
- const t = Bt(e), s = this.encodeAsString(t.packet), i = t.buffers;
1271
- return i.unshift(s), i;
1270
+ const t = Pt(e), s = this.encodeAsString(t.packet), r = t.buffers;
1271
+ return r.unshift(s), r;
1272
1272
  }
1273
1273
  }
1274
- class ge extends g {
1274
+ class we extends g {
1275
1275
  /**
1276
1276
  * Decoder constructor
1277
1277
  */
@@ -1293,8 +1293,8 @@ class ge extends g {
1293
1293
  throw new Error("got plaintext data when reconstructing a packet");
1294
1294
  t = this.decodeString(e);
1295
1295
  const s = t.type === p.BINARY_EVENT;
1296
- s || t.type === p.BINARY_ACK ? (t.type = s ? p.EVENT : p.ACK, this.reconstructor = new It(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
- } else if (me(e) || e.base64)
1296
+ s || t.type === p.BINARY_ACK ? (t.type = s ? p.EVENT : p.ACK, this.reconstructor = new Ut(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
+ } else if (ge(e) || e.base64)
1298
1298
  if (this.reconstructor)
1299
1299
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
1300
1300
  else
@@ -1316,44 +1316,44 @@ class ge extends g {
1316
1316
  if (p[s.type] === void 0)
1317
1317
  throw new Error("unknown packet type " + s.type);
1318
1318
  if (s.type === p.BINARY_EVENT || s.type === p.BINARY_ACK) {
1319
- const r = t + 1;
1319
+ const i = t + 1;
1320
1320
  for (; e.charAt(++t) !== "-" && t != e.length; )
1321
1321
  ;
1322
- const a = e.substring(r, t);
1323
- if (a != Number(a) || e.charAt(t) !== "-")
1322
+ const o = e.substring(i, t);
1323
+ if (o != Number(o) || e.charAt(t) !== "-")
1324
1324
  throw new Error("Illegal attachments");
1325
- const h = Number(a);
1326
- if (!Lt(h) || h < 0)
1325
+ const h = Number(o);
1326
+ if (!Dt(h) || h < 0)
1327
1327
  throw new Error("Illegal attachments");
1328
1328
  if (h > this.opts.maxAttachments)
1329
1329
  throw new Error("too many attachments");
1330
1330
  s.attachments = h;
1331
1331
  }
1332
1332
  if (e.charAt(t + 1) === "/") {
1333
- const r = t + 1;
1333
+ const i = t + 1;
1334
1334
  for (; ++t && !(e.charAt(t) === "," || t === e.length); )
1335
1335
  ;
1336
- s.nsp = e.substring(r, t);
1336
+ s.nsp = e.substring(i, t);
1337
1337
  } else
1338
1338
  s.nsp = "/";
1339
- const i = e.charAt(t + 1);
1340
- if (i !== "" && Number(i) == i) {
1341
- const r = t + 1;
1339
+ const r = e.charAt(t + 1);
1340
+ if (r !== "" && Number(r) == r) {
1341
+ const i = t + 1;
1342
1342
  for (; ++t; ) {
1343
- const a = e.charAt(t);
1344
- if (a == null || Number(a) != a) {
1343
+ const o = e.charAt(t);
1344
+ if (o == null || Number(o) != o) {
1345
1345
  --t;
1346
1346
  break;
1347
1347
  }
1348
1348
  if (t === e.length)
1349
1349
  break;
1350
1350
  }
1351
- s.id = Number(e.substring(r, t + 1));
1351
+ s.id = Number(e.substring(i, t + 1));
1352
1352
  }
1353
1353
  if (e.charAt(++t)) {
1354
- const r = this.tryParse(e.substr(t));
1355
- if (ge.isPayloadValid(s.type, r))
1356
- s.data = r;
1354
+ const i = this.tryParse(e.substr(t));
1355
+ if (we.isPayloadValid(s.type, i))
1356
+ s.data = i;
1357
1357
  else
1358
1358
  throw new Error("invalid payload");
1359
1359
  }
@@ -1369,14 +1369,14 @@ class ge extends g {
1369
1369
  static isPayloadValid(e, t) {
1370
1370
  switch (e) {
1371
1371
  case p.CONNECT:
1372
- return Se(t);
1372
+ return $e(t);
1373
1373
  case p.DISCONNECT:
1374
1374
  return t === void 0;
1375
1375
  case p.CONNECT_ERROR:
1376
- return typeof t == "string" || Se(t);
1376
+ return typeof t == "string" || $e(t);
1377
1377
  case p.EVENT:
1378
1378
  case p.BINARY_EVENT:
1379
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && xt.indexOf(t[0]) === -1);
1379
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && Lt.indexOf(t[0]) === -1);
1380
1380
  case p.ACK:
1381
1381
  case p.BINARY_ACK:
1382
1382
  return Array.isArray(t);
@@ -1389,7 +1389,7 @@ class ge extends g {
1389
1389
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1390
1390
  }
1391
1391
  }
1392
- class It {
1392
+ class Ut {
1393
1393
  constructor(e) {
1394
1394
  this.packet = e, this.buffers = [], this.reconPack = e;
1395
1395
  }
@@ -1403,7 +1403,7 @@ class It {
1403
1403
  */
1404
1404
  takeBinaryData(e) {
1405
1405
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
1406
- const t = Nt(this.reconPack, this.buffers);
1406
+ const t = It(this.reconPack, this.buffers);
1407
1407
  return this.finishedReconstruction(), t;
1408
1408
  }
1409
1409
  return null;
@@ -1415,26 +1415,26 @@ class It {
1415
1415
  this.reconPack = null, this.buffers = [];
1416
1416
  }
1417
1417
  }
1418
- const Lt = Number.isInteger || function(n) {
1418
+ const Dt = Number.isInteger || function(n) {
1419
1419
  return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1420
1420
  };
1421
- function Se(n) {
1421
+ function $e(n) {
1422
1422
  return Object.prototype.toString.call(n) === "[object Object]";
1423
1423
  }
1424
- const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const Ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1425
1425
  __proto__: null,
1426
- Decoder: ge,
1427
- Encoder: Pt,
1426
+ Decoder: we,
1427
+ Encoder: qt,
1428
1428
  get PacketType() {
1429
1429
  return p;
1430
1430
  }
1431
1431
  }, Symbol.toStringTag, { value: "Module" }));
1432
- function b(n, e, t) {
1432
+ function T(n, e, t) {
1433
1433
  return n.on(e, t), function() {
1434
1434
  n.off(e, t);
1435
1435
  };
1436
1436
  }
1437
- const Ut = Object.freeze({
1437
+ const Mt = Object.freeze({
1438
1438
  connect: 1,
1439
1439
  connect_error: 1,
1440
1440
  disconnect: 1,
@@ -1443,7 +1443,7 @@ const Ut = Object.freeze({
1443
1443
  newListener: 1,
1444
1444
  removeListener: 1
1445
1445
  });
1446
- class Me extends g {
1446
+ class je extends g {
1447
1447
  /**
1448
1448
  * `Socket` constructor.
1449
1449
  */
@@ -1477,10 +1477,10 @@ class Me extends g {
1477
1477
  return;
1478
1478
  const e = this.io;
1479
1479
  this.subs = [
1480
- b(e, "open", this.onopen.bind(this)),
1481
- b(e, "packet", this.onpacket.bind(this)),
1482
- b(e, "error", this.onerror.bind(this)),
1483
- b(e, "close", this.onclose.bind(this))
1480
+ T(e, "open", this.onopen.bind(this)),
1481
+ T(e, "packet", this.onpacket.bind(this)),
1482
+ T(e, "error", this.onerror.bind(this)),
1483
+ T(e, "close", this.onclose.bind(this))
1484
1484
  ];
1485
1485
  }
1486
1486
  /**
@@ -1558,41 +1558,41 @@ class Me extends g {
1558
1558
  * @return self
1559
1559
  */
1560
1560
  emit(e, ...t) {
1561
- var s, i, r;
1562
- if (Ut.hasOwnProperty(e))
1561
+ var s, r, i;
1562
+ if (Mt.hasOwnProperty(e))
1563
1563
  throw new Error('"' + e.toString() + '" is a reserved event name');
1564
1564
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
1565
1565
  return this._addToQueue(t), this;
1566
- const a = {
1566
+ const o = {
1567
1567
  type: p.EVENT,
1568
1568
  data: t
1569
1569
  };
1570
- if (a.options = {}, a.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
1570
+ if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
1571
1571
  const d = this.ids++, m = t.pop();
1572
- this._registerAckCallback(d, m), a.id = d;
1572
+ this._registerAckCallback(d, m), o.id = d;
1573
1573
  }
1574
- const h = (i = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || i === void 0 ? void 0 : i.writable, l = this.connected && !(!((r = this.io.engine) === null || r === void 0) && r._hasPingExpired());
1575
- return this.flags.volatile && !h || (l ? (this.notifyOutgoingListeners(a), this.packet(a)) : this.sendBuffer.push(a)), this.flags = {}, this;
1574
+ const h = (r = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || r === void 0 ? void 0 : r.writable, l = this.connected && !(!((i = this.io.engine) === null || i === void 0) && i._hasPingExpired());
1575
+ return this.flags.volatile && !h || (l ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1576
1576
  }
1577
1577
  /**
1578
1578
  * @private
1579
1579
  */
1580
1580
  _registerAckCallback(e, t) {
1581
1581
  var s;
1582
- const i = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;
1583
- if (i === void 0) {
1582
+ const r = (s = this.flags.timeout) !== null && s !== void 0 ? s : this._opts.ackTimeout;
1583
+ if (r === void 0) {
1584
1584
  this.acks[e] = t;
1585
1585
  return;
1586
1586
  }
1587
- const r = this.io.setTimeoutFn(() => {
1587
+ const i = this.io.setTimeoutFn(() => {
1588
1588
  delete this.acks[e];
1589
1589
  for (let h = 0; h < this.sendBuffer.length; h++)
1590
1590
  this.sendBuffer[h].id === e && this.sendBuffer.splice(h, 1);
1591
1591
  t.call(this, new Error("operation has timed out"));
1592
- }, i), a = (...h) => {
1593
- this.io.clearTimeoutFn(r), t.apply(this, h);
1592
+ }, r), o = (...h) => {
1593
+ this.io.clearTimeoutFn(i), t.apply(this, h);
1594
1594
  };
1595
- a.withError = !0, this.acks[e] = a;
1595
+ o.withError = !0, this.acks[e] = o;
1596
1596
  }
1597
1597
  /**
1598
1598
  * Emits an event and waits for an acknowledgement
@@ -1611,9 +1611,9 @@ class Me extends g {
1611
1611
  * @return a Promise that will be fulfilled when the server acknowledges the event
1612
1612
  */
1613
1613
  emitWithAck(e, ...t) {
1614
- return new Promise((s, i) => {
1615
- const r = (a, h) => a ? i(a) : s(h);
1616
- r.withError = !0, t.push(r), this.emit(e, ...t);
1614
+ return new Promise((s, r) => {
1615
+ const i = (o, h) => o ? r(o) : s(h);
1616
+ i.withError = !0, t.push(i), this.emit(e, ...t);
1617
1617
  });
1618
1618
  }
1619
1619
  /**
@@ -1631,7 +1631,7 @@ class Me extends g {
1631
1631
  args: e,
1632
1632
  flags: Object.assign({ fromQueue: !0 }, this.flags)
1633
1633
  };
1634
- e.push((i, ...r) => (this._queue[0], i !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), t && t(i)) : (this._queue.shift(), t && t(null, ...r)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue();
1634
+ e.push((r, ...i) => (this._queue[0], r !== null ? s.tryCount > this._opts.retries && (this._queue.shift(), t && t(r)) : (this._queue.shift(), t && t(null, ...i)), s.pending = !1, this._drainQueue())), this._queue.push(s), this._drainQueue();
1635
1635
  }
1636
1636
  /**
1637
1637
  * Send the first packet of the queue, and wait for an acknowledgement from the server.
@@ -1765,11 +1765,11 @@ class Me extends g {
1765
1765
  ack(e) {
1766
1766
  const t = this;
1767
1767
  let s = !1;
1768
- return function(...i) {
1768
+ return function(...r) {
1769
1769
  s || (s = !0, t.packet({
1770
1770
  type: p.ACK,
1771
1771
  id: e,
1772
- data: i
1772
+ data: r
1773
1773
  }));
1774
1774
  };
1775
1775
  }
@@ -2058,16 +2058,16 @@ P.prototype.setMax = function(n) {
2058
2058
  P.prototype.setJitter = function(n) {
2059
2059
  this.jitter = n;
2060
2060
  };
2061
- class ce extends g {
2061
+ class he extends g {
2062
2062
  constructor(e, t) {
2063
2063
  var s;
2064
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, Y(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new P({
2064
+ super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, K(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new P({
2065
2065
  min: this.reconnectionDelay(),
2066
2066
  max: this.reconnectionDelayMax(),
2067
2067
  jitter: this.randomizationFactor()
2068
2068
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
2069
- const i = t.parser || qt;
2070
- this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2069
+ const r = t.parser || Ft;
2070
+ this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2071
2071
  }
2072
2072
  reconnection(e) {
2073
2073
  return arguments.length ? (this._reconnection = !!e, e || (this.skipReconnect = !0), this) : this._reconnection;
@@ -2109,23 +2109,23 @@ class ce extends g {
2109
2109
  open(e) {
2110
2110
  if (~this._readyState.indexOf("open"))
2111
2111
  return this;
2112
- this.engine = new Ot(this.uri, this.opts);
2112
+ this.engine = new $t(this.uri, this.opts);
2113
2113
  const t = this.engine, s = this;
2114
2114
  this._readyState = "opening", this.skipReconnect = !1;
2115
- const i = b(t, "open", function() {
2115
+ const r = T(t, "open", function() {
2116
2116
  s.onopen(), e && e();
2117
- }), r = (h) => {
2117
+ }), i = (h) => {
2118
2118
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen();
2119
- }, a = b(t, "error", r);
2119
+ }, o = T(t, "error", i);
2120
2120
  if (this._timeout !== !1) {
2121
2121
  const h = this._timeout, l = this.setTimeoutFn(() => {
2122
- i(), r(new Error("timeout")), t.close();
2122
+ r(), i(new Error("timeout")), t.close();
2123
2123
  }, h);
2124
2124
  this.opts.autoUnref && l.unref(), this.subs.push(() => {
2125
2125
  this.clearTimeoutFn(l);
2126
2126
  });
2127
2127
  }
2128
- return this.subs.push(i), this.subs.push(a), this;
2128
+ return this.subs.push(r), this.subs.push(o), this;
2129
2129
  }
2130
2130
  /**
2131
2131
  * Alias for open()
@@ -2145,12 +2145,12 @@ class ce extends g {
2145
2145
  this.cleanup(), this._readyState = "open", this.emitReserved("open");
2146
2146
  const e = this.engine;
2147
2147
  this.subs.push(
2148
- b(e, "ping", this.onping.bind(this)),
2149
- b(e, "data", this.ondata.bind(this)),
2150
- b(e, "error", this.onerror.bind(this)),
2151
- b(e, "close", this.onclose.bind(this)),
2148
+ T(e, "ping", this.onping.bind(this)),
2149
+ T(e, "data", this.ondata.bind(this)),
2150
+ T(e, "error", this.onerror.bind(this)),
2151
+ T(e, "close", this.onclose.bind(this)),
2152
2152
  // @ts-ignore
2153
- b(this.decoder, "decoded", this.ondecoded.bind(this))
2153
+ T(this.decoder, "decoded", this.ondecoded.bind(this))
2154
2154
  );
2155
2155
  }
2156
2156
  /**
@@ -2179,7 +2179,7 @@ class ce extends g {
2179
2179
  * @private
2180
2180
  */
2181
2181
  ondecoded(e) {
2182
- J(() => {
2182
+ Y(() => {
2183
2183
  this.emitReserved("packet", e);
2184
2184
  }, this.setTimeoutFn);
2185
2185
  }
@@ -2199,7 +2199,7 @@ class ce extends g {
2199
2199
  */
2200
2200
  socket(e, t) {
2201
2201
  let s = this.nsps[e];
2202
- return s ? this._autoConnect && !s.active && s.connect() : (s = new Me(this, e, t), this.nsps[e] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new je(this, e, t), this.nsps[e] = s), s;
2203
2203
  }
2204
2204
  /**
2205
2205
  * Called upon a socket close.
@@ -2277,8 +2277,8 @@ class ce extends g {
2277
2277
  const t = this.backoff.duration();
2278
2278
  this._reconnecting = !0;
2279
2279
  const s = this.setTimeoutFn(() => {
2280
- e.skipReconnect || (this.emitReserved("reconnect_attempt", e.backoff.attempts), !e.skipReconnect && e.open((i) => {
2281
- i ? (e._reconnecting = !1, e.reconnect(), this.emitReserved("reconnect_error", i)) : e.onreconnect();
2280
+ e.skipReconnect || (this.emitReserved("reconnect_attempt", e.backoff.attempts), !e.skipReconnect && e.open((r) => {
2281
+ r ? (e._reconnecting = !1, e.reconnect(), this.emitReserved("reconnect_error", r)) : e.onreconnect();
2282
2282
  }));
2283
2283
  }, t);
2284
2284
  this.opts.autoUnref && s.unref(), this.subs.push(() => {
@@ -2299,18 +2299,18 @@ class ce extends g {
2299
2299
  const I = {};
2300
2300
  function U(n, e) {
2301
2301
  typeof n == "object" && (e = n, n = void 0), e = e || {};
2302
- const t = St(n, e.path || "/socket.io"), s = t.source, i = t.id, r = t.path, a = I[i] && r in I[i].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || a;
2302
+ const t = Rt(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = I[r] && i in I[r].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2303
2303
  let l;
2304
- return h ? l = new ce(s, e) : (I[i] || (I[i] = new ce(s, e)), l = I[i]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2304
+ return h ? l = new he(s, e) : (I[r] || (I[r] = new he(s, e)), l = I[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2305
2305
  }
2306
2306
  Object.assign(U, {
2307
- Manager: ce,
2308
- Socket: Me,
2307
+ Manager: he,
2308
+ Socket: je,
2309
2309
  io: U,
2310
2310
  connect: U
2311
2311
  });
2312
- const Ae = 100;
2313
- function Ft(n) {
2312
+ const Re = 100;
2313
+ function Vt(n) {
2314
2314
  try {
2315
2315
  const e = JSON.parse(n);
2316
2316
  if (e && typeof e == "object") {
@@ -2325,20 +2325,50 @@ function Ft(n) {
2325
2325
  }
2326
2326
  return {};
2327
2327
  }
2328
- class Dt extends Error {
2329
- constructor(t, s, i) {
2330
- const r = Ft(i);
2331
- super(r.message ?? `${s || "Request failed"} (${t})`);
2328
+ function Ht(n) {
2329
+ if (!n || typeof n != "object") return;
2330
+ const e = n.retryAfter;
2331
+ return typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : void 0;
2332
+ }
2333
+ class _e extends Error {
2334
+ constructor(t, s, r, i) {
2335
+ const o = Vt(r);
2336
+ super(o.message ?? `${s || "Request failed"} (${t})`);
2332
2337
  w(this, "status");
2333
2338
  w(this, "code");
2334
2339
  w(this, "details");
2335
2340
  w(this, "body");
2336
- this.name = "RequestError", this.status = t, this.code = r.code, this.details = r.details, this.body = i;
2341
+ /**
2342
+ * Seconds to wait before retrying, taken from the `Retry-After` header or
2343
+ * from `details.retryAfter`. Only present on rate-limited (429) responses.
2344
+ */
2345
+ w(this, "retryAfter");
2346
+ this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? Ht(o.details);
2337
2347
  }
2338
2348
  }
2339
- const T = "item/folder", f = "item", $ = "processor", Mt = "npm-registry", O = "hidden", ee = "FILE", te = "TOOL", se = "APP";
2340
- var o, ue, u, C, q, G, j, le, fe, Ve;
2341
- const we = class we {
2349
+ const v = "item/folder", f = "item", S = "processor", jt = "npm-registry", O = "hidden", te = "FILE", se = "TOOL", ne = "APP", Gt = 500, Ce = 3e4, Jt = 0.25, Yt = (n) => new Promise((e) => setTimeout(e, n));
2350
+ function Kt(n) {
2351
+ var r, i;
2352
+ const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
2353
+ if (!e) return;
2354
+ const t = Number(e);
2355
+ if (Number.isFinite(t)) return Math.max(0, t);
2356
+ const s = Date.parse(e);
2357
+ if (!Number.isNaN(s))
2358
+ return Math.max(0, (s - Date.now()) / 1e3);
2359
+ }
2360
+ function Wt(n) {
2361
+ return n instanceof _e ? n.status === 429 || n.status >= 500 : !0;
2362
+ }
2363
+ function Xt(n, e) {
2364
+ const t = Math.min(
2365
+ Gt * 2 ** e,
2366
+ Ce
2367
+ ), s = t * Jt * Math.random(), r = n instanceof _e && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
2368
+ return r != null ? Math.min(r, Ce) + s : t + s;
2369
+ }
2370
+ var a, le, u, $, q, G, J, fe, pe, Ge;
2371
+ const be = class be {
2342
2372
  /**
2343
2373
  * Creates a new EngineServicesClient instance.
2344
2374
  * @param accessToken - API access token (obtained from the platform dashboard)
@@ -2347,7 +2377,7 @@ const we = class we {
2347
2377
  * @param props - Optional configuration (retry count, auth mode, etc.).
2348
2378
  */
2349
2379
  constructor(e, t, s) {
2350
- X(this, o);
2380
+ z(this, a);
2351
2381
  w(this, "apiUrl");
2352
2382
  w(this, "accessToken");
2353
2383
  w(this, "wsUrl");
@@ -2366,10 +2396,10 @@ const we = class we {
2366
2396
  * Populated automatically when using {@link fromPlatformContext}.
2367
2397
  */
2368
2398
  w(this, "context");
2369
- const { retries: i = 0, useBearer: r = !1, localServerUrl: a } = s || {};
2399
+ const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
2370
2400
  let h = t;
2371
- if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = e, this.wsUrl = `${h}?accessToken=${e}`, this.retries = i, this.useBearer = r, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, a) {
2372
- let l = a;
2401
+ if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = e, this.wsUrl = `${h}?accessToken=${e}`, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
2402
+ let l = o;
2373
2403
  l.charAt(l.length - 1) === "/" && (l = l.slice(0, -1)), this.localServerUrl = l;
2374
2404
  }
2375
2405
  }
@@ -2390,14 +2420,16 @@ const we = class we {
2390
2420
  * ```
2391
2421
  */
2392
2422
  static fromPlatformContext(e) {
2393
- const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new we(t.accessToken, t.apiUrl, {
2423
+ const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new be(t.accessToken, t.apiUrl, {
2394
2424
  ...e,
2395
2425
  useBearer: !0
2396
2426
  });
2397
2427
  return s.context = t, s;
2398
2428
  }
2399
2429
  /**
2400
- * Sets the number of automatic retries for failed requests.
2430
+ * Sets the number of automatic retries for failed requests. Retries use
2431
+ * exponential backoff with jitter and honour `Retry-After`; only network
2432
+ * failures, 429s and 5xx are retried.
2401
2433
  * @param retries - Number of retries (0 = no retries).
2402
2434
  */
2403
2435
  setRetries(e) {
@@ -2460,7 +2492,7 @@ const we = class we {
2460
2492
  * cleaning logic is applied identically.
2461
2493
  */
2462
2494
  async request(e, t, s) {
2463
- return c(this, o, u).call(this, e, t, s);
2495
+ return c(this, a, u).call(this, e, t, s);
2464
2496
  }
2465
2497
  // ─── Files ───────────────────────────────────────────────────────
2466
2498
  /**
@@ -2469,12 +2501,12 @@ const we = class we {
2469
2501
  * @returns Array of file items.
2470
2502
  */
2471
2503
  async listFiles(e) {
2472
- const { folderId: t, archived: s, projectId: i } = e || {};
2473
- return t ? await c(this, o, u).call(this, "GET", `${T}/${t}/items`, { query: { itemType: ee, archived: s } }) : await c(this, o, u).call(this, "GET", `${f}`, {
2504
+ const { folderId: t, archived: s, projectId: r } = e || {};
2505
+ return t ? await c(this, a, u).call(this, "GET", `${v}/${t}/items`, { query: { itemType: te, archived: s } }) : await c(this, a, u).call(this, "GET", `${f}`, {
2474
2506
  query: {
2475
- itemType: ee,
2507
+ itemType: te,
2476
2508
  archived: s,
2477
- ...i && { projectId: i }
2509
+ ...r && { projectId: r }
2478
2510
  }
2479
2511
  });
2480
2512
  }
@@ -2485,7 +2517,7 @@ const we = class we {
2485
2517
  * @returns The file item, optionally with version history.
2486
2518
  */
2487
2519
  async getFile(e, t) {
2488
- return await c(this, o, fe).call(this, e, t);
2520
+ return await c(this, a, pe).call(this, e, t);
2489
2521
  }
2490
2522
  /**
2491
2523
  * Uploads a new file.
@@ -2493,7 +2525,7 @@ const we = class we {
2493
2525
  * @returns The created item and its first version.
2494
2526
  */
2495
2527
  async createFile(e) {
2496
- return await c(this, o, j).call(this, e, ee);
2528
+ return await c(this, a, J).call(this, e, te);
2497
2529
  }
2498
2530
  /**
2499
2531
  * Updates an existing file. Can rename, move to a different folder,
@@ -2503,21 +2535,21 @@ const we = class we {
2503
2535
  * @returns The updated item and/or the new version.
2504
2536
  */
2505
2537
  async updateFile(e, t) {
2506
- return await c(this, o, le).call(this, e, t);
2538
+ return await c(this, a, fe).call(this, e, t);
2507
2539
  }
2508
2540
  /**
2509
2541
  * Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
2510
2542
  * @param fileId - The file's unique identifier.
2511
2543
  */
2512
2544
  async archiveFile(e) {
2513
- return await c(this, o, u).call(this, "DELETE", `${f}/${e}`);
2545
+ return await c(this, a, u).call(this, "DELETE", `${f}/${e}`);
2514
2546
  }
2515
2547
  /**
2516
2548
  * Recovers a previously archived file.
2517
2549
  * @param fileId - The file's unique identifier.
2518
2550
  */
2519
2551
  async recoverFile(e) {
2520
- return await c(this, o, u).call(this, "PUT", `${f}/${e}/recover`);
2552
+ return await c(this, a, u).call(this, "PUT", `${f}/${e}/recover`);
2521
2553
  }
2522
2554
  /**
2523
2555
  * Downloads a file's content. Returns the raw fetch Response.
@@ -2526,7 +2558,7 @@ const we = class we {
2526
2558
  * @returns A fetch Response containing the file data.
2527
2559
  */
2528
2560
  async downloadFile(e, t) {
2529
- return await c(this, o, G).call(this, e, t);
2561
+ return await c(this, a, G).call(this, e, t);
2530
2562
  }
2531
2563
  /**
2532
2564
  * Retrieves the free-JSON metadata for a specific file version.
@@ -2536,10 +2568,10 @@ const we = class we {
2536
2568
  * @param params - Optional flags such as `withDraft`.
2537
2569
  */
2538
2570
  async getFileVersionMetadata(e, t, s) {
2539
- const { withDraft: i } = s || {};
2540
- return await c(this, o, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2571
+ const { withDraft: r } = s || {};
2572
+ return await c(this, a, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2541
2573
  query: {
2542
- ...i && { withDraft: "true" }
2574
+ ...r && { withDraft: "true" }
2543
2575
  }
2544
2576
  });
2545
2577
  }
@@ -2550,7 +2582,7 @@ const we = class we {
2550
2582
  * @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
2551
2583
  */
2552
2584
  async updateFileVersionMetadata(e, t, s) {
2553
- return await c(this, o, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2585
+ return await c(this, a, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2554
2586
  body: JSON.stringify({ metadata: s }),
2555
2587
  contentType: "application/json"
2556
2588
  });
@@ -2561,7 +2593,7 @@ const we = class we {
2561
2593
  * @param versionTag - The version tag.
2562
2594
  */
2563
2595
  async deleteFileVersionMetadata(e, t) {
2564
- return await c(this, o, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
2596
+ return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
2565
2597
  }
2566
2598
  /**
2567
2599
  * Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
@@ -2578,9 +2610,9 @@ const we = class we {
2578
2610
  */
2579
2611
  async getFileVersionMetadataBatch(e, t) {
2580
2612
  const { withDraft: s } = t || {};
2581
- return await c(this, o, q).call(this, e, async (i) => (await c(this, o, u).call(this, "POST", `${f}/batch/version-metadata`, {
2613
+ return await c(this, a, q).call(this, e, async (r) => (await c(this, a, u).call(this, "POST", `${f}/batch/version-metadata`, {
2582
2614
  body: JSON.stringify({
2583
- entries: i,
2615
+ entries: r,
2584
2616
  ...s !== void 0 && { withDraft: s }
2585
2617
  }),
2586
2618
  contentType: "application/json"
@@ -2593,12 +2625,12 @@ const we = class we {
2593
2625
  * @returns Array of folder items.
2594
2626
  */
2595
2627
  async listFolders(e) {
2596
- const { archived: t, parentFolderId: s, projectId: i } = e || {};
2597
- return await c(this, o, u).call(this, "GET", T, {
2628
+ const { archived: t, parentFolderId: s, projectId: r } = e || {};
2629
+ return await c(this, a, u).call(this, "GET", v, {
2598
2630
  query: {
2599
2631
  parentFolderId: s,
2600
2632
  archived: t,
2601
- ...i && { projectId: i }
2633
+ ...r && { projectId: r }
2602
2634
  }
2603
2635
  });
2604
2636
  }
@@ -2607,7 +2639,7 @@ const we = class we {
2607
2639
  * @param folderId - The folder's unique identifier.
2608
2640
  */
2609
2641
  async getFolder(e) {
2610
- return await c(this, o, u).call(this, "GET", `${T}/${e}`);
2642
+ return await c(this, a, u).call(this, "GET", `${v}/${e}`);
2611
2643
  }
2612
2644
  /**
2613
2645
  * Batch variant of {@link getFolder}. Resolves a known set of folder ids in
@@ -2623,7 +2655,7 @@ const we = class we {
2623
2655
  * @param folderIds - The folder ids to resolve.
2624
2656
  */
2625
2657
  async getFoldersBatch(e) {
2626
- return await c(this, o, q).call(this, e, async (t) => (await c(this, o, u).call(this, "POST", `${f}/batch/folders`, {
2658
+ return await c(this, a, q).call(this, e, async (t) => (await c(this, a, u).call(this, "POST", `${f}/batch/folders`, {
2627
2659
  body: JSON.stringify({ folderIds: t }),
2628
2660
  contentType: "application/json"
2629
2661
  })).results);
@@ -2635,7 +2667,7 @@ const we = class we {
2635
2667
  * @returns The created folder.
2636
2668
  */
2637
2669
  async createFolder(e, t, s) {
2638
- return await c(this, o, u).call(this, "POST", T, {
2670
+ return await c(this, a, u).call(this, "POST", v, {
2639
2671
  body: JSON.stringify({
2640
2672
  name: e,
2641
2673
  ...t && { parentId: t },
@@ -2652,7 +2684,7 @@ const we = class we {
2652
2684
  */
2653
2685
  async updateFolder(e, t) {
2654
2686
  const { name: s } = t;
2655
- return await c(this, o, u).call(this, "PUT", `${T}/${e}`, {
2687
+ return await c(this, a, u).call(this, "PUT", `${v}/${e}`, {
2656
2688
  body: JSON.stringify({ name: s }),
2657
2689
  contentType: "application/json"
2658
2690
  });
@@ -2662,14 +2694,14 @@ const we = class we {
2662
2694
  * @param folderId - The folder's unique identifier.
2663
2695
  */
2664
2696
  async archiveFolder(e) {
2665
- return await c(this, o, u).call(this, "DELETE", `${T}/${e}`);
2697
+ return await c(this, a, u).call(this, "DELETE", `${v}/${e}`);
2666
2698
  }
2667
2699
  /**
2668
2700
  * Recovers a previously archived folder.
2669
2701
  * @param folderId - The folder's unique identifier.
2670
2702
  */
2671
2703
  async recoverFolder(e) {
2672
- return await c(this, o, u).call(this, "PUT", `${T}/${e}/recover`);
2704
+ return await c(this, a, u).call(this, "PUT", `${v}/${e}/recover`);
2673
2705
  }
2674
2706
  /**
2675
2707
  * Downloads an entire folder as a ZIP archive.
@@ -2677,7 +2709,7 @@ const we = class we {
2677
2709
  * @returns A fetch Response containing the ZIP data.
2678
2710
  */
2679
2711
  async downloadFolder(e) {
2680
- return await c(this, o, C).call(this, `${T}/${e}/download`);
2712
+ return await c(this, a, $).call(this, `${v}/${e}/download`);
2681
2713
  }
2682
2714
  // ─── Components ──────────────────────────────────────────────────
2683
2715
  /**
@@ -2686,17 +2718,17 @@ const we = class we {
2686
2718
  * @returns Array of component items.
2687
2719
  */
2688
2720
  async listComponents(e) {
2689
- const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2690
- return t ? await c(this, o, u).call(this, "GET", `${T}/${t}/items`, {
2721
+ const { folderId: t, ShowVersions: s, projectId: r } = e || {};
2722
+ return t ? await c(this, a, u).call(this, "GET", `${v}/${t}/items`, {
2691
2723
  query: {
2692
- itemType: te,
2724
+ itemType: se,
2693
2725
  ...s && { ShowVersions: s }
2694
2726
  }
2695
- }) : await c(this, o, u).call(this, "GET", `${f}`, {
2727
+ }) : await c(this, a, u).call(this, "GET", `${f}`, {
2696
2728
  query: {
2697
- itemType: te,
2729
+ itemType: se,
2698
2730
  ...s && { ShowVersions: s },
2699
- ...i && { projectId: i }
2731
+ ...r && { projectId: r }
2700
2732
  }
2701
2733
  });
2702
2734
  }
@@ -2706,7 +2738,7 @@ const we = class we {
2706
2738
  * @param props - Options such as whether to include versions.
2707
2739
  */
2708
2740
  async getComponent(e, t) {
2709
- return await c(this, o, fe).call(this, e, t);
2741
+ return await c(this, a, pe).call(this, e, t);
2710
2742
  }
2711
2743
  /**
2712
2744
  * Creates a new component with the given file and version properties.
@@ -2715,7 +2747,7 @@ const we = class we {
2715
2747
  */
2716
2748
  async createComponent(e) {
2717
2749
  const { componentProps: t } = e;
2718
- return await c(this, o, j).call(this, e, te, t);
2750
+ return await c(this, a, J).call(this, e, se, t);
2719
2751
  }
2720
2752
  /**
2721
2753
  * Updates an existing component. Can rename, move, and/or upload a new version.
@@ -2725,7 +2757,7 @@ const we = class we {
2725
2757
  */
2726
2758
  async updateComponent(e, t) {
2727
2759
  const { componentProps: s } = t;
2728
- return await c(this, o, le).call(this, e, t, s);
2760
+ return await c(this, a, fe).call(this, e, t, s);
2729
2761
  }
2730
2762
  /**
2731
2763
  * Downloads a component's full ZIP file. Returns the raw fetch Response.
@@ -2734,7 +2766,7 @@ const we = class we {
2734
2766
  * @returns A fetch Response containing the ZIP data.
2735
2767
  */
2736
2768
  async downloadComponent(e, t) {
2737
- return await c(this, o, G).call(this, e, t);
2769
+ return await c(this, a, G).call(this, e, t);
2738
2770
  }
2739
2771
  /**
2740
2772
  * Downloads only the JavaScript bundle from a component's ZIP.
@@ -2744,11 +2776,11 @@ const we = class we {
2744
2776
  * @returns A fetch Response containing the bundle JavaScript text.
2745
2777
  */
2746
2778
  async downloadComponentBundle(e, t) {
2747
- const { versionTag: s, withDraft: i } = t || {};
2748
- return await c(this, o, C).call(this, `${f}/${e}/download/bundle`, {
2779
+ const { versionTag: s, withDraft: r } = t || {};
2780
+ return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
2749
2781
  query: {
2750
2782
  ...s && { versionTag: s },
2751
- ...i && { withDraft: i }
2783
+ ...r && { withDraft: r }
2752
2784
  }
2753
2785
  });
2754
2786
  }
@@ -2757,14 +2789,14 @@ const we = class we {
2757
2789
  * @param componentId - The component's unique identifier.
2758
2790
  */
2759
2791
  async archiveComponent(e) {
2760
- return await c(this, o, u).call(this, "DELETE", `${f}/${e}`);
2792
+ return await c(this, a, u).call(this, "DELETE", `${f}/${e}`);
2761
2793
  }
2762
2794
  /**
2763
2795
  * Recovers a previously archived component.
2764
2796
  * @param componentId - The component's unique identifier.
2765
2797
  */
2766
2798
  async recoverComponent(e) {
2767
- return await c(this, o, u).call(this, "PUT", `${f}/${e}/recover`);
2799
+ return await c(this, a, u).call(this, "PUT", `${f}/${e}/recover`);
2768
2800
  }
2769
2801
  // ─── Built-in Components ─────────────────────────────────────────
2770
2802
  /**
@@ -2773,7 +2805,7 @@ const we = class we {
2773
2805
  * @returns The component's JavaScript source code as a string.
2774
2806
  */
2775
2807
  async getBuiltInComponent(e) {
2776
- return await (await c(this, o, C).call(this, `built-in/${e}/bundle`)).text();
2808
+ return await (await c(this, a, $).call(this, `built-in/${e}/bundle`)).text();
2777
2809
  }
2778
2810
  /**
2779
2811
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -2802,7 +2834,7 @@ const we = class we {
2802
2834
  * ```
2803
2835
  */
2804
2836
  async initBuiltInComponent(e, t, s) {
2805
- const i = await this.getBuiltInComponent(e.uuid), r = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, a = Object.keys(r), h = a.map((m) => r[m]), y = new Function(...a, `${i}
2837
+ const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), h = o.map((m) => i[m]), y = new Function(...o, `${r}
2806
2838
  return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2807
2839
  t.get(d);
2808
2840
  }
@@ -2846,13 +2878,13 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2846
2878
  * ```
2847
2879
  */
2848
2880
  async setup(e, ...t) {
2849
- var a, h;
2850
- const s = e.OBC, i = e.BUI;
2881
+ var o, h;
2882
+ const s = e.OBC, r = e.BUI;
2851
2883
  if (!(s != null && s.Components))
2852
2884
  throw new Error("globals.OBC must include Components");
2853
- if (!(i != null && i.Manager)) throw new Error("globals.BUI must include Manager");
2854
- const r = new s.Components();
2855
- return i.Manager.init(), this.setBuiltInGlobals(e), await this.initBuiltInComponents(r, ...t), r.init(), (h = (a = this.context.appEventOrchestrator) == null ? void 0 : a.appLoaded) == null || h.call(a), { components: r };
2885
+ if (!(r != null && r.Manager)) throw new Error("globals.BUI must include Manager");
2886
+ const i = new s.Components();
2887
+ return r.Manager.init(), this.setBuiltInGlobals(e), await this.initBuiltInComponents(i, ...t), i.init(), (h = (o = this.context.appEventOrchestrator) == null ? void 0 : o.appLoaded) == null || h.call(o), { components: i };
2856
2888
  }
2857
2889
  /**
2858
2890
  * Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
@@ -2860,8 +2892,8 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2860
2892
  * @param data - Arbitrary error data to send to the platform.
2861
2893
  */
2862
2894
  throwError(e, t) {
2863
- var s, i;
2864
- (i = (s = this.context.appEventOrchestrator) == null ? void 0 : s.appError) == null || i.call(s, e, t);
2895
+ var s, r;
2896
+ (r = (s = this.context.appEventOrchestrator) == null ? void 0 : s.appError) == null || r.call(s, e, t);
2865
2897
  }
2866
2898
  // ─── Apps ────────────────────────────────────────────────────────
2867
2899
  /**
@@ -2870,17 +2902,17 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2870
2902
  * @returns Array of app items.
2871
2903
  */
2872
2904
  async listApps(e) {
2873
- const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2874
- return t ? await c(this, o, u).call(this, "GET", `${T}/${t}/items`, {
2905
+ const { folderId: t, ShowVersions: s, projectId: r } = e || {};
2906
+ return t ? await c(this, a, u).call(this, "GET", `${v}/${t}/items`, {
2875
2907
  query: {
2876
- itemType: se,
2908
+ itemType: ne,
2877
2909
  ...s && { ShowVersions: s }
2878
2910
  }
2879
- }) : await c(this, o, u).call(this, "GET", `${f}`, {
2911
+ }) : await c(this, a, u).call(this, "GET", `${f}`, {
2880
2912
  query: {
2881
- itemType: se,
2913
+ itemType: ne,
2882
2914
  ...s && { ShowVersions: s },
2883
- ...i && { projectId: i }
2915
+ ...r && { projectId: r }
2884
2916
  }
2885
2917
  });
2886
2918
  }
@@ -2891,7 +2923,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2891
2923
  */
2892
2924
  async createApp(e) {
2893
2925
  const { appProps: t } = e;
2894
- return await c(this, o, j).call(this, e, se, t);
2926
+ return await c(this, a, J).call(this, e, ne, t);
2895
2927
  }
2896
2928
  /**
2897
2929
  * Downloads an app's full ZIP file. Returns the raw fetch Response.
@@ -2900,7 +2932,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2900
2932
  * @returns A fetch Response containing the ZIP data.
2901
2933
  */
2902
2934
  async downloadApp(e, t) {
2903
- return await c(this, o, G).call(this, e, t);
2935
+ return await c(this, a, G).call(this, e, t);
2904
2936
  }
2905
2937
  /**
2906
2938
  * Downloads only the JavaScript bundle from an app's ZIP.
@@ -2910,11 +2942,11 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2910
2942
  * @returns A fetch Response containing the bundle JavaScript text.
2911
2943
  */
2912
2944
  async downloadAppBundle(e, t) {
2913
- const { versionTag: s, withDraft: i } = t || {};
2914
- return await c(this, o, C).call(this, `${f}/${e}/download/bundle`, {
2945
+ const { versionTag: s, withDraft: r } = t || {};
2946
+ return await c(this, a, $).call(this, `${f}/${e}/download/bundle`, {
2915
2947
  query: {
2916
2948
  ...s && { versionTag: s },
2917
- ...i && { withDraft: i }
2949
+ ...r && { withDraft: r }
2918
2950
  }
2919
2951
  });
2920
2952
  }
@@ -2923,7 +2955,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2923
2955
  * @param appId - The app's unique identifier.
2924
2956
  */
2925
2957
  async archiveApp(e) {
2926
- return await c(this, o, u).call(this, "DELETE", `${f}/${e}`);
2958
+ return await c(this, a, u).call(this, "DELETE", `${f}/${e}`);
2927
2959
  }
2928
2960
  // ─── NPM Registry ────────────────────────────────────────────────
2929
2961
  /**
@@ -2935,7 +2967,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2935
2967
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
2936
2968
  */
2937
2969
  async getNpmCredentials() {
2938
- return await c(this, o, u).call(this, "GET", `${Mt}/credentials`);
2970
+ return await c(this, a, u).call(this, "GET", `${jt}/credentials`);
2939
2971
  }
2940
2972
  // ─── Execution ───────────────────────────────────────────────────
2941
2973
  /**
@@ -2954,20 +2986,20 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2954
2986
  */
2955
2987
  async executeComponent(e, t, s) {
2956
2988
  if (this.localServerUrl) {
2957
- const i = `${this.localServerUrl}/api/${$}/${e}/execute`, r = await fetch(i, {
2989
+ const r = `${this.localServerUrl}/api/${S}/${e}/execute`, i = await fetch(r, {
2958
2990
  method: "POST",
2959
2991
  headers: { "Content-Type": "application/json" },
2960
2992
  body: JSON.stringify(t)
2961
2993
  });
2962
- if (!r.ok) {
2963
- const a = await r.text().catch(() => "");
2994
+ if (!i.ok) {
2995
+ const o = await i.text().catch(() => "");
2964
2996
  throw new Error(
2965
- `Local server request failed: ${r.status} - ${a}`
2997
+ `Local server request failed: ${i.status} - ${o}`
2966
2998
  );
2967
2999
  }
2968
- return await r.json();
3000
+ return await i.json();
2969
3001
  }
2970
- return await c(this, o, u).call(this, "POST", `${$}/${e}/execute`, {
3002
+ return await c(this, a, u).call(this, "POST", `${S}/${e}/execute`, {
2971
3003
  body: JSON.stringify(t),
2972
3004
  query: { ...s && { versionTag: s } },
2973
3005
  contentType: "application/json"
@@ -2979,16 +3011,16 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2979
3011
  */
2980
3012
  async abortExecution(e) {
2981
3013
  if (this.localServerUrl) {
2982
- const t = `${this.localServerUrl}/api/${$}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
3014
+ const t = `${this.localServerUrl}/api/${S}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
2983
3015
  if (!s.ok) {
2984
- const i = await s.text().catch(() => "");
3016
+ const r = await s.text().catch(() => "");
2985
3017
  throw new Error(
2986
- `Local server request failed: ${s.status} - ${i}`
3018
+ `Local server request failed: ${s.status} - ${r}`
2987
3019
  );
2988
3020
  }
2989
3021
  return await s.json();
2990
3022
  }
2991
- return await c(this, o, u).call(this, "POST", `${$}/progress/${e}/abort`);
3023
+ return await c(this, a, u).call(this, "POST", `${S}/progress/${e}/abort`);
2992
3024
  }
2993
3025
  /**
2994
3026
  * Lists all executions for a given component.
@@ -3005,16 +3037,16 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3005
3037
  */
3006
3038
  async listExecutions(e, t) {
3007
3039
  if (this.localServerUrl) {
3008
- const s = t ? `?projectId=${encodeURIComponent(t)}` : "", i = `${this.localServerUrl}/api/${$}/${e}/progress${s}`, r = await fetch(i);
3009
- if (!r.ok) {
3010
- const a = await r.text().catch(() => "");
3040
+ const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${S}/${e}/progress${s}`, i = await fetch(r);
3041
+ if (!i.ok) {
3042
+ const o = await i.text().catch(() => "");
3011
3043
  throw new Error(
3012
- `Local server request failed: ${r.status} - ${a}`
3044
+ `Local server request failed: ${i.status} - ${o}`
3013
3045
  );
3014
3046
  }
3015
- return await r.json();
3047
+ return await i.json();
3016
3048
  }
3017
- return await c(this, o, u).call(this, "GET", `${$}/${e}/progress`, { query: { ...t && { projectId: t } } });
3049
+ return await c(this, a, u).call(this, "GET", `${S}/${e}/progress`, { query: { ...t && { projectId: t } } });
3018
3050
  }
3019
3051
  /**
3020
3052
  * Gets details of a specific execution, including its messages.
@@ -3023,16 +3055,16 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3023
3055
  */
3024
3056
  async getExecution(e) {
3025
3057
  if (this.localServerUrl) {
3026
- const t = `${this.localServerUrl}/api/${$}/progress/${e}`, s = await fetch(t);
3058
+ const t = `${this.localServerUrl}/api/${S}/progress/${e}`, s = await fetch(t);
3027
3059
  if (!s.ok) {
3028
- const i = await s.text().catch(() => "");
3060
+ const r = await s.text().catch(() => "");
3029
3061
  throw new Error(
3030
- `Local server request failed: ${s.status} - ${i}`
3062
+ `Local server request failed: ${s.status} - ${r}`
3031
3063
  );
3032
3064
  }
3033
3065
  return await s.json();
3034
3066
  }
3035
- return await c(this, o, u).call(this, "GET", `${$}/progress/${e}`);
3067
+ return await c(this, a, u).call(this, "GET", `${S}/progress/${e}`);
3036
3068
  }
3037
3069
  /**
3038
3070
  * Subscribes to real-time execution progress via WebSocket.
@@ -3041,15 +3073,15 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3041
3073
  * @param onUpdateCallback - Callback invoked on each progress/result event.
3042
3074
  */
3043
3075
  async onExecutionProgress(e, t) {
3044
- const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, i = await U(s, {
3076
+ const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, r = await U(s, {
3045
3077
  ...this.localServerUrl && { transports: ["websocket"] }
3046
3078
  });
3047
- i.on("connect", function() {
3048
- i.emit("executionSubscription", JSON.stringify({ executionId: e })), i.on("execution", (r) => {
3049
- t(r);
3079
+ r.on("connect", function() {
3080
+ r.emit("executionSubscription", JSON.stringify({ executionId: e })), r.on("execution", (i) => {
3081
+ t(i);
3050
3082
  });
3051
- }), i.on("connect_error", function(r) {
3052
- console.log(r);
3083
+ }), r.on("connect_error", function(i) {
3084
+ console.log(i);
3053
3085
  });
3054
3086
  }
3055
3087
  // ─── Hidden Files ────────────────────────────────────────────────
@@ -3061,7 +3093,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3061
3093
  */
3062
3094
  async createHiddenFile(e, t) {
3063
3095
  const s = new FormData();
3064
- return s.append("file", e), s.append("parentItemId", t), await c(this, o, u).call(this, "POST", `${f}/${O}`, {
3096
+ return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${O}`, {
3065
3097
  body: s
3066
3098
  });
3067
3099
  }
@@ -3075,9 +3107,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3075
3107
  */
3076
3108
  async createHiddenFilesBatch(e, t) {
3077
3109
  const s = new FormData();
3078
- for (const i of e)
3079
- s.append("files", i);
3080
- return s.append("parentItemId", t), await c(this, o, u).call(this, "POST", `${f}/${O}/batch`, {
3110
+ for (const r of e)
3111
+ s.append("files", r);
3112
+ return s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${O}/batch`, {
3081
3113
  body: s
3082
3114
  });
3083
3115
  }
@@ -3086,21 +3118,21 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3086
3118
  * @param hiddenId - The hidden file's unique identifier.
3087
3119
  */
3088
3120
  async deleteHiddenFile(e) {
3089
- return await c(this, o, u).call(this, "DELETE", `${f}/${O}/${e}`);
3121
+ return await c(this, a, u).call(this, "DELETE", `${f}/${O}/${e}`);
3090
3122
  }
3091
3123
  /**
3092
3124
  * Gets metadata for a hidden file.
3093
3125
  * @param hiddenId - The hidden file's unique identifier.
3094
3126
  */
3095
3127
  async getHiddenFile(e) {
3096
- return await c(this, o, u).call(this, "GET", `${f}/${O}/${e}`);
3128
+ return await c(this, a, u).call(this, "GET", `${f}/${O}/${e}`);
3097
3129
  }
3098
3130
  /**
3099
3131
  * Downloads a hidden file's content. Returns the raw fetch Response.
3100
3132
  * @param hiddenId - The hidden file's unique identifier.
3101
3133
  */
3102
3134
  async downloadHiddenFile(e) {
3103
- return await c(this, o, C).call(this, `${f}/${O}/${e}/download`);
3135
+ return await c(this, a, $).call(this, `${f}/${O}/${e}/download`);
3104
3136
  }
3105
3137
  /**
3106
3138
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -3120,7 +3152,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3120
3152
  * an ISO timestamp when it stops working.
3121
3153
  */
3122
3154
  async getHiddenFileSignedUrl(e, t) {
3123
- return await c(this, o, u).call(this, "GET", `${f}/${O}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3155
+ return await c(this, a, u).call(this, "GET", `${f}/${O}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3124
3156
  }
3125
3157
  /**
3126
3158
  * Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
@@ -3141,7 +3173,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3141
3173
  * 900 (15 min) server-side; values are clamped to that range.
3142
3174
  */
3143
3175
  async getHiddenFileSignedUrlsBatch(e, t) {
3144
- return await c(this, o, q).call(this, e, async (s) => (await c(this, o, u).call(this, "POST", `${f}/${O}/signed-url/batch`, {
3176
+ return await c(this, a, q).call(this, e, async (s) => (await c(this, a, u).call(this, "POST", `${f}/${O}/signed-url/batch`, {
3145
3177
  body: JSON.stringify({
3146
3178
  hiddenFileIds: s,
3147
3179
  ...t != null && { expiresIn: t }
@@ -3155,14 +3187,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3155
3187
  * @returns Array of hidden file entities.
3156
3188
  */
3157
3189
  async getHiddenFilesByParent(e) {
3158
- return await c(this, o, u).call(this, "GET", `${f}/${e}/${O}`);
3190
+ return await c(this, a, u).call(this, "GET", `${f}/${e}/${O}`);
3159
3191
  }
3160
3192
  /**
3161
3193
  * Deletes all hidden files attached to a parent item.
3162
3194
  * @param parentFileId - The parent item's unique identifier.
3163
3195
  */
3164
3196
  async deleteHiddenFilesByParent(e) {
3165
- return await c(this, o, u).call(this, "DELETE", `${f}/${e}/${O}`);
3197
+ return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${O}`);
3166
3198
  }
3167
3199
  // ─── Icons ───────────────────────────────────────────────────────
3168
3200
  /**
@@ -3174,7 +3206,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3174
3206
  */
3175
3207
  async uploadItemIcon(e, t) {
3176
3208
  const s = new FormData();
3177
- return s.append("icon", t), await c(this, o, u).call(this, "PUT", `${f}/${e}/icon`, {
3209
+ return s.append("icon", t), await c(this, a, u).call(this, "PUT", `${f}/${e}/icon`, {
3178
3210
  body: s
3179
3211
  });
3180
3212
  }
@@ -3184,7 +3216,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3184
3216
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
3185
3217
  */
3186
3218
  async getItemIcon(e) {
3187
- return await c(this, o, C).call(this, `${f}/${e}/icon`);
3219
+ return await c(this, a, $).call(this, `${f}/${e}/icon`);
3188
3220
  }
3189
3221
  /**
3190
3222
  * Removes the icon from an item.
@@ -3192,7 +3224,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3192
3224
  * @returns The updated item with icon fields removed.
3193
3225
  */
3194
3226
  async removeItemIcon(e) {
3195
- return await c(this, o, u).call(this, "DELETE", `${f}/${e}/icon`);
3227
+ return await c(this, a, u).call(this, "DELETE", `${f}/${e}/icon`);
3196
3228
  }
3197
3229
  // ─── General Item Operations ─────────────────────────────────────
3198
3230
  /**
@@ -3202,7 +3234,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3202
3234
  * @returns The updated item.
3203
3235
  */
3204
3236
  async updateItem(e, t) {
3205
- return await c(this, o, u).call(this, "PUT", `${f}/${e}`, {
3237
+ return await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
3206
3238
  body: JSON.stringify(t),
3207
3239
  contentType: "application/json"
3208
3240
  });
@@ -3217,9 +3249,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3217
3249
  * @param metadata - Optional free-JSON metadata to store on the new version.
3218
3250
  * @returns The created version.
3219
3251
  */
3220
- async createVersion(e, t, s, i, r) {
3221
- const a = new FormData();
3222
- return a.append("file", t), a.append("versionTag", s), i && a.append("extraProps", JSON.stringify(i)), r && a.append("metadata", JSON.stringify(r)), await c(this, o, u).call(this, "POST", `${f}/${e}/version`, { body: a });
3252
+ async createVersion(e, t, s, r, i) {
3253
+ const o = new FormData();
3254
+ return o.append("file", t), o.append("versionTag", s), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await c(this, a, u).call(this, "POST", `${f}/${e}/version`, { body: o });
3223
3255
  }
3224
3256
  /**
3225
3257
  * Lists versions of an item. Pass `archived: true` to fetch only archived
@@ -3229,7 +3261,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3229
3261
  * @returns Array of versions, sorted by creation date descending.
3230
3262
  */
3231
3263
  async listVersions(e, t = {}) {
3232
- return await c(this, o, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/versions`, { query: t });
3264
+ return await c(this, a, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/versions`, { query: t });
3233
3265
  }
3234
3266
  /**
3235
3267
  * Batch variant of {@link listVersions}. Lists the versions of many items in
@@ -3248,9 +3280,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3248
3280
  */
3249
3281
  async listVersionsBatch(e, t = {}) {
3250
3282
  const { archived: s } = t;
3251
- return await c(this, o, q).call(this, e, async (i) => (await c(this, o, u).call(this, "POST", `${f}/batch/versions`, {
3283
+ return await c(this, a, q).call(this, e, async (r) => (await c(this, a, u).call(this, "POST", `${f}/batch/versions`, {
3252
3284
  body: JSON.stringify({
3253
- itemIds: i,
3285
+ itemIds: r,
3254
3286
  ...s !== void 0 && { archived: s }
3255
3287
  }),
3256
3288
  contentType: "application/json"
@@ -3266,7 +3298,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3266
3298
  * @returns The archived version.
3267
3299
  */
3268
3300
  async archiveVersion(e, t) {
3269
- return await c(this, o, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
3301
+ return await c(this, a, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
3270
3302
  }
3271
3303
  /**
3272
3304
  * Recovers a previously archived version, restoring it to the active list.
@@ -3275,7 +3307,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3275
3307
  * @returns The recovered version.
3276
3308
  */
3277
3309
  async recoverVersion(e, t) {
3278
- return await c(this, o, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
3310
+ return await c(this, a, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
3279
3311
  }
3280
3312
  /**
3281
3313
  * Permanently deletes a version, including its file in object storage.
@@ -3284,116 +3316,120 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3284
3316
  * @param versionTag - The version's tag (e.g. "v2").
3285
3317
  */
3286
3318
  async deleteVersion(e, t) {
3287
- return await c(this, o, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
3319
+ return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
3288
3320
  }
3289
3321
  };
3290
- o = new WeakSet(), ue = function(e) {
3322
+ a = new WeakSet(), le = function(e) {
3291
3323
  return `${this.apiUrl}/${e}`;
3292
3324
  }, u = async function(e, t, s) {
3293
- const { body: i, query: r, contentType: a, retries: h, responseType: l } = s || {}, y = c(this, o, ue).call(this, t), d = c(this, o, Ve).call(this, r), m = await this.resolveAccessToken(), k = {
3294
- ...d,
3295
- ...this.useBearer ? {} : { accessToken: m }
3325
+ const { body: r, query: i, contentType: o, retries: h, responseType: l, retryAttempt: y } = s || {}, d = c(this, a, le).call(this, t), m = c(this, a, Ge).call(this, i), E = await this.resolveAccessToken(), Je = {
3326
+ ...m,
3327
+ ...this.useBearer ? {} : { accessToken: E }
3296
3328
  };
3297
3329
  try {
3298
- const S = await fetch(
3299
- y + "?" + new URLSearchParams(k).toString(),
3330
+ const b = await fetch(
3331
+ d + "?" + new URLSearchParams(Je).toString(),
3300
3332
  {
3301
3333
  method: e,
3302
3334
  headers: {
3303
3335
  Accept: "application/json",
3304
- ...a && { "Content-Type": a },
3305
- ...this.useBearer && { Authorization: `Bearer ${m}` }
3336
+ ...o && { "Content-Type": o },
3337
+ ...this.useBearer && { Authorization: `Bearer ${E}` }
3306
3338
  },
3307
- ...i && { body: i }
3339
+ ...r && { body: r }
3308
3340
  }
3309
3341
  );
3310
- if (!S.ok) {
3311
- const A = await S.text().then((He) => He).catch(() => "");
3312
- throw new Dt(
3313
- S.status,
3314
- S.statusText,
3315
- A
3342
+ if (!b.ok) {
3343
+ const C = await b.text().then((D) => D).catch(() => "");
3344
+ throw new _e(
3345
+ b.status,
3346
+ b.statusText,
3347
+ C,
3348
+ Kt(b)
3316
3349
  );
3317
3350
  }
3318
- return l === "blob" ? await S.blob() : S.json().then((A) => A).catch(() => {
3351
+ return l === "blob" ? await b.blob() : b.json().then((C) => C).catch(() => {
3319
3352
  });
3320
- } catch (S) {
3321
- let A = h ?? this.retries;
3322
- if (A)
3323
- return A = A - 1, await c(this, o, u).call(this, e, t, {
3353
+ } catch (b) {
3354
+ const C = h ?? this.retries;
3355
+ if (C > 0 && Wt(b)) {
3356
+ const D = y ?? 0;
3357
+ return await Yt(Xt(b, D)), await c(this, a, u).call(this, e, t, {
3324
3358
  ...s,
3325
- retries: A
3359
+ retries: C - 1,
3360
+ retryAttempt: D + 1
3326
3361
  });
3327
- throw S;
3362
+ }
3363
+ throw b;
3328
3364
  }
3329
- }, C = async function(e, t) {
3330
- const { query: s } = t || {}, i = c(this, o, ue).call(this, e), r = await this.resolveAccessToken(), a = {
3365
+ }, $ = async function(e, t) {
3366
+ const { query: s } = t || {}, r = c(this, a, le).call(this, e), i = await this.resolveAccessToken(), o = {
3331
3367
  ...s,
3332
- ...this.useBearer ? {} : { accessToken: r }
3368
+ ...this.useBearer ? {} : { accessToken: i }
3333
3369
  };
3334
3370
  return await fetch(
3335
- i + "?" + new URLSearchParams(a).toString(),
3371
+ r + "?" + new URLSearchParams(o).toString(),
3336
3372
  {
3337
3373
  method: "GET",
3338
3374
  ...this.useBearer && {
3339
- headers: { Authorization: `Bearer ${r}` }
3375
+ headers: { Authorization: `Bearer ${i}` }
3340
3376
  }
3341
3377
  }
3342
3378
  );
3343
3379
  }, q = async function(e, t) {
3344
3380
  if (!e.length) return [];
3345
3381
  const s = [];
3346
- for (let r = 0; r < e.length; r += Ae)
3347
- s.push(e.slice(r, r + Ae));
3382
+ for (let i = 0; i < e.length; i += Re)
3383
+ s.push(e.slice(i, i + Re));
3348
3384
  return (await Promise.all(s.map(t))).flat();
3349
3385
  }, G = async function(e, t) {
3350
- const { versionTag: s, withDraft: i } = t || {};
3351
- return await c(this, o, C).call(this, `${f}/${e}/download`, {
3386
+ const { versionTag: s, withDraft: r } = t || {};
3387
+ return await c(this, a, $).call(this, `${f}/${e}/download`, {
3352
3388
  query: {
3353
3389
  ...s && { versionTag: s },
3354
- ...i && { withDraft: i }
3390
+ ...r && { withDraft: r }
3355
3391
  }
3356
3392
  });
3357
- }, j = async function(e, t, s) {
3358
- const { name: i, versionTag: r, parentFolderId: a, projectId: h, file: l, metadata: y } = e, d = new FormData();
3359
- return d.append("file", l), d.append("name", i), d.append("versionTag", r), d.append("itemType", t), a && d.append("folderId", a), h && d.append("projectId", h), s && d.append("extraProps", JSON.stringify(s)), y && d.append("metadata", JSON.stringify(y)), await c(this, o, u).call(this, "POST", f, {
3393
+ }, J = async function(e, t, s) {
3394
+ const { name: r, versionTag: i, parentFolderId: o, projectId: h, file: l, metadata: y } = e, d = new FormData();
3395
+ return d.append("file", l), d.append("name", r), d.append("versionTag", i), d.append("itemType", t), o && d.append("folderId", o), h && d.append("projectId", h), s && d.append("extraProps", JSON.stringify(s)), y && d.append("metadata", JSON.stringify(y)), await c(this, a, u).call(this, "POST", f, {
3360
3396
  body: d
3361
3397
  });
3362
- }, le = async function(e, t, s) {
3363
- const { name: i, versionTag: r, parentFolderId: a, file: h, metadata: l } = t;
3398
+ }, fe = async function(e, t, s) {
3399
+ const { name: r, versionTag: i, parentFolderId: o, file: h, metadata: l } = t;
3364
3400
  let y, d;
3365
3401
  if (h) {
3366
3402
  const m = new FormData();
3367
- m.append("file", h), r && m.append("versionTag", r), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), d = await c(this, o, u).call(this, "POST", `${f}/${e}/version`, {
3403
+ m.append("file", h), i && m.append("versionTag", i), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), d = await c(this, a, u).call(this, "POST", `${f}/${e}/version`, {
3368
3404
  body: m
3369
3405
  });
3370
3406
  }
3371
- if (i || a) {
3407
+ if (r || o) {
3372
3408
  const m = {
3373
- ...i && { name: i },
3374
- ...a && { folderId: a }
3375
- }, k = JSON.stringify(m);
3376
- y = await c(this, o, u).call(this, "PUT", `${f}/${e}`, {
3377
- body: k,
3409
+ ...r && { name: r },
3410
+ ...o && { folderId: o }
3411
+ }, E = JSON.stringify(m);
3412
+ y = await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
3413
+ body: E,
3378
3414
  contentType: "application/json"
3379
3415
  });
3380
3416
  }
3381
3417
  return { item: y, version: d };
3382
- }, fe = async function(e, t) {
3418
+ }, pe = async function(e, t) {
3383
3419
  const { showVersions: s = !1 } = t || {};
3384
- return await c(this, o, u).call(this, "GET", `${f}/${e}`, {
3420
+ return await c(this, a, u).call(this, "GET", `${f}/${e}`, {
3385
3421
  query: { showVersions: s }
3386
3422
  });
3387
- }, Ve = function(e) {
3423
+ }, Ge = function(e) {
3388
3424
  return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
3389
- (t, [s, i]) => (t[s] = i, t),
3425
+ (t, [s, r]) => (t[s] = r, t),
3390
3426
  {}
3391
3427
  );
3392
3428
  };
3393
- let he = we;
3429
+ let ue = be;
3394
3430
  const B = "project", N = "notifications";
3395
3431
  var x;
3396
- const _e = class _e extends he {
3432
+ const Te = class Te extends ue {
3397
3433
  /**
3398
3434
  * @param token - A bearer JWT, OR a function returning the current JWT
3399
3435
  * (sync or async). When a function is passed, it's invoked before every
@@ -3402,13 +3438,13 @@ const _e = class _e extends he {
3402
3438
  * @param props - Optional client configuration. `useBearer` is forced to
3403
3439
  * `true` and cannot be overridden.
3404
3440
  */
3405
- constructor(t, s, i) {
3406
- super(typeof t == "string" ? t : "", s, { ...i, useBearer: !0 });
3407
- X(this, x);
3408
- typeof t == "function" && Te(this, x, t);
3441
+ constructor(t, s, r) {
3442
+ super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
3443
+ z(this, x);
3444
+ typeof t == "function" && ve(this, x, t);
3409
3445
  }
3410
3446
  async resolveAccessToken() {
3411
- return W(this, x) ? await W(this, x).call(this) : super.resolveAccessToken();
3447
+ return X(this, x) ? await X(this, x).call(this) : super.resolveAccessToken();
3412
3448
  }
3413
3449
  /**
3414
3450
  * Creates a client from the platform context injected into
@@ -3417,8 +3453,8 @@ const _e = class _e extends he {
3417
3453
  * carries a fresh JWT on every navigation.
3418
3454
  */
3419
3455
  static fromPlatformContext(t) {
3420
- const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, i = new _e(s.accessToken, s.apiUrl, t);
3421
- return i.context = s, i;
3456
+ const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new Te(s.accessToken, s.apiUrl, t);
3457
+ return r.context = s, r;
3422
3458
  }
3423
3459
  // ─── Projects (JWT-only backend routes) ──────────────────────────
3424
3460
  /**
@@ -3578,12 +3614,12 @@ const _e = class _e extends he {
3578
3614
  * });
3579
3615
  * ```
3580
3616
  */
3581
- async subscribeToAutomation(t, s, i) {
3617
+ async subscribeToAutomation(t, s, r) {
3582
3618
  return await this.request(
3583
3619
  "POST",
3584
3620
  `${B}/${t}/events/hooks/${s}/subscription`,
3585
3621
  {
3586
- body: JSON.stringify(i ?? {}),
3622
+ body: JSON.stringify(r ?? {}),
3587
3623
  contentType: "application/json"
3588
3624
  }
3589
3625
  );
@@ -3595,12 +3631,12 @@ const _e = class _e extends he {
3595
3631
  * Throws if the user is not subscribed; use {@link subscribeToAutomation}
3596
3632
  * to create one.
3597
3633
  */
3598
- async updateAutomationSubscription(t, s, i) {
3634
+ async updateAutomationSubscription(t, s, r) {
3599
3635
  return await this.request(
3600
3636
  "PATCH",
3601
3637
  `${B}/${t}/events/hooks/${s}/subscription`,
3602
3638
  {
3603
- body: JSON.stringify(i),
3639
+ body: JSON.stringify(r),
3604
3640
  contentType: "application/json"
3605
3641
  }
3606
3642
  );
@@ -3632,40 +3668,41 @@ const _e = class _e extends he {
3632
3668
  * ```
3633
3669
  */
3634
3670
  async onNotification(t) {
3635
- const s = await this.resolveAccessToken(), i = U(
3671
+ const s = await this.resolveAccessToken(), r = U(
3636
3672
  `${this.socketOrigin}/notifications?accessToken=${encodeURIComponent(s)}`,
3637
3673
  { transports: ["websocket"] }
3638
3674
  );
3639
- return i.on(
3675
+ return r.on(
3640
3676
  "notification.created",
3641
- (r) => t({ type: "created", id: r == null ? void 0 : r.id })
3642
- ), i.on(
3677
+ (i) => t({ type: "created", id: i == null ? void 0 : i.id })
3678
+ ), r.on(
3643
3679
  "notification.read",
3644
- (r) => t({ type: "read", id: r == null ? void 0 : r.id })
3645
- ), i.on(
3680
+ (i) => t({ type: "read", id: i == null ? void 0 : i.id })
3681
+ ), r.on(
3646
3682
  "notifications.allRead",
3647
- (r) => t({ type: "allRead", batch: r == null ? void 0 : r.batch })
3648
- ), () => i.disconnect();
3683
+ (i) => t({ type: "allRead", batch: i == null ? void 0 : i.batch })
3684
+ ), () => r.disconnect();
3649
3685
  }
3650
3686
  };
3651
3687
  x = new WeakMap();
3652
- let $e = _e;
3653
- const Gt = {
3688
+ let Be = Te;
3689
+ const Zt = {
3654
3690
  MAX_FIELDS: 200,
3655
3691
  MAX_KEY_LENGTH: 50,
3656
3692
  MAX_VALUE_LENGTH: 50
3657
- }, jt = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Jt = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, Yt = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Kt = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Wt = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, Xt = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, zt = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
3693
+ }, es = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, ts = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ss = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, ns = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, rs = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, is = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, os = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, as = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
3658
3694
  export {
3659
- jt as CDEManager,
3660
- Jt as ClashesManager,
3661
- he as EngineServicesClient,
3662
- Yt as FileList,
3663
- Kt as GitHistoryManager,
3664
- Wt as HelloWorld,
3665
- Gt as METADATA_LIMITS,
3666
- $e as PlatformClient,
3667
- Dt as RequestError,
3668
- Ae as STORAGE_BATCH_MAX,
3669
- Xt as TopicsManager,
3670
- zt as UIManager
3695
+ es as CDEManager,
3696
+ ts as ClashesManager,
3697
+ ue as EngineServicesClient,
3698
+ ss as FileList,
3699
+ ns as GitHistoryManager,
3700
+ rs as HelloWorld,
3701
+ Zt as METADATA_LIMITS,
3702
+ Be as PlatformClient,
3703
+ is as ProjectManager,
3704
+ _e as RequestError,
3705
+ Re as STORAGE_BATCH_MAX,
3706
+ os as TopicsManager,
3707
+ as as UIManager
3671
3708
  };