@thatopen/services 0.9.0 → 0.10.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,10 +1,10 @@
1
- var Ve = Object.defineProperty;
2
- var _e = (n) => {
1
+ var Ge = Object.defineProperty;
2
+ var be = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var He = (n, e, t) => e in n ? Ve(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
- var w = (n, e, t) => He(n, typeof e != "symbol" ? e + "" : e, t), Y = (n, e, t) => e.has(n) || _e("Cannot " + t);
7
- var K = (n, e, t) => (Y(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? _e("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), be = (n, e, t, s) => (Y(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (Y(n, e, "access private method"), t);
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
8
  const v = /* @__PURE__ */ Object.create(null);
9
9
  v.open = "0";
10
10
  v.close = "1";
@@ -13,63 +13,63 @@ v.pong = "3";
13
13
  v.message = "4";
14
14
  v.upgrade = "5";
15
15
  v.noop = "6";
16
- const F = /* @__PURE__ */ Object.create(null);
16
+ const M = /* @__PURE__ */ Object.create(null);
17
17
  Object.keys(v).forEach((n) => {
18
- F[v[n]] = n;
18
+ M[v[n]] = n;
19
19
  });
20
- const se = { type: "error", data: "parser error" }, Se = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", $e = typeof ArrayBuffer == "function", Ce = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, fe = ({ type: n, data: e }, t, s) => Se && e instanceof Blob ? t ? s(e) : Te(e, s) : $e && (e instanceof ArrayBuffer || Ce(e)) ? t ? s(e) : Te(new Blob([e]), s) : s(v[n] + (e || "")), Te = (n, e) => {
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) => {
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 Ee(n) {
27
+ function ve(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
30
  let z;
31
- function Ge(n, e) {
32
- if (Se && n.data instanceof Blob)
33
- return n.data.arrayBuffer().then(Ee).then(e);
34
- if ($e && (n.data instanceof ArrayBuffer || Ce(n.data)))
35
- return e(Ee(n.data));
36
- fe(n, !1, (t) => {
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
37
  z || (z = new TextEncoder()), e(z.encode(t));
38
38
  });
39
39
  }
40
- const ve = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
- for (let n = 0; n < ve.length; n++)
42
- L[ve.charCodeAt(n)] = n;
43
- const je = (n) => {
44
- let e = n.length * 0.75, t = n.length, s, i = 0, r, o, h, l;
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;
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)], o = L[n.charCodeAt(s + 1)], h = L[n.charCodeAt(s + 2)], l = L[n.charCodeAt(s + 3)], d[i++] = r << 2 | o >> 4, d[i++] = (o & 15) << 4 | h >> 2, d[i++] = (h & 3) << 6 | l & 63;
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;
49
49
  return y;
50
- }, Je = typeof ArrayBuffer == "function", pe = (n, e) => {
50
+ }, Ke = typeof ArrayBuffer == "function", de = (n, e) => {
51
51
  if (typeof n != "string")
52
52
  return {
53
53
  type: "message",
54
- data: Re(n, e)
54
+ data: Ne(n, e)
55
55
  };
56
56
  const t = n.charAt(0);
57
57
  return t === "b" ? {
58
58
  type: "message",
59
- data: Ye(n.substring(1), e)
60
- } : F[t] ? n.length > 1 ? {
61
- type: F[t],
59
+ data: We(n.substring(1), e)
60
+ } : M[t] ? n.length > 1 ? {
61
+ type: M[t],
62
62
  data: n.substring(1)
63
63
  } : {
64
- type: F[t]
65
- } : se;
66
- }, Ye = (n, e) => {
67
- if (Je) {
68
- const t = je(n);
69
- return Re(t, e);
64
+ type: M[t]
65
+ } : ne;
66
+ }, We = (n, e) => {
67
+ if (Ke) {
68
+ const t = Ye(n);
69
+ return Ne(t, e);
70
70
  } else
71
71
  return { base64: !0, data: n };
72
- }, Re = (n, e) => {
72
+ }, Ne = (n, e) => {
73
73
  switch (e) {
74
74
  case "blob":
75
75
  return n instanceof Blob ? n : new Blob([n]);
@@ -77,27 +77,27 @@ const je = (n) => {
77
77
  default:
78
78
  return n instanceof ArrayBuffer ? n : n.buffer;
79
79
  }
80
- }, Be = "", Ke = (n, e) => {
80
+ }, xe = "", Xe = (n, e) => {
81
81
  const t = n.length, s = new Array(t);
82
82
  let i = 0;
83
- n.forEach((r, o) => {
84
- fe(r, !1, (h) => {
85
- s[o] = h, ++i === t && e(s.join(Be));
83
+ n.forEach((r, a) => {
84
+ pe(r, !1, (h) => {
85
+ s[a] = h, ++i === t && e(s.join(xe));
86
86
  });
87
87
  });
88
- }, We = (n, e) => {
89
- const t = n.split(Be), s = [];
88
+ }, ze = (n, e) => {
89
+ const t = n.split(xe), s = [];
90
90
  for (let i = 0; i < t.length; i++) {
91
- const r = pe(t[i], e);
91
+ const r = de(t[i], e);
92
92
  if (s.push(r), r.type === "error")
93
93
  break;
94
94
  }
95
95
  return s;
96
96
  };
97
- function ze() {
97
+ function Qe() {
98
98
  return new TransformStream({
99
99
  transform(n, e) {
100
- Ge(n, (t) => {
100
+ Je(n, (t) => {
101
101
  const s = t.length;
102
102
  let i;
103
103
  if (s < 126)
@@ -116,8 +116,8 @@ function ze() {
116
116
  }
117
117
  });
118
118
  }
119
- let X;
120
- function U(n) {
119
+ let Q;
120
+ function F(n) {
121
121
  return n.reduce((e, t) => e + t.length, 0);
122
122
  }
123
123
  function D(n, e) {
@@ -129,51 +129,51 @@ function D(n, e) {
129
129
  t[i] = 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 Xe(n, e) {
133
- X || (X = new TextDecoder());
132
+ function Ze(n, e) {
133
+ Q || (Q = new TextDecoder());
134
134
  const t = [];
135
135
  let s = 0, i = -1, r = !1;
136
136
  return new TransformStream({
137
- transform(o, h) {
138
- for (t.push(o); ; ) {
137
+ transform(a, h) {
138
+ for (t.push(a); ; ) {
139
139
  if (s === 0) {
140
- if (U(t) < 1)
140
+ if (F(t) < 1)
141
141
  break;
142
142
  const l = D(t, 1);
143
143
  r = (l[0] & 128) === 128, i = l[0] & 127, i < 126 ? s = 3 : i === 126 ? s = 1 : s = 2;
144
144
  } else if (s === 1) {
145
- if (U(t) < 2)
145
+ if (F(t) < 2)
146
146
  break;
147
147
  const l = D(t, 2);
148
148
  i = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
149
149
  } else if (s === 2) {
150
- if (U(t) < 8)
150
+ if (F(t) < 8)
151
151
  break;
152
152
  const l = D(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(se);
154
+ h.enqueue(ne);
155
155
  break;
156
156
  }
157
157
  i = d * Math.pow(2, 32) + y.getUint32(4), s = 3;
158
158
  } else {
159
- if (U(t) < i)
159
+ if (F(t) < i)
160
160
  break;
161
161
  const l = D(t, i);
162
- h.enqueue(pe(r ? l : X.decode(l), e)), s = 0;
162
+ h.enqueue(de(r ? l : Q.decode(l), e)), s = 0;
163
163
  }
164
164
  if (i === 0 || i > n) {
165
- h.enqueue(se);
165
+ h.enqueue(ne);
166
166
  break;
167
167
  }
168
168
  }
169
169
  }
170
170
  });
171
171
  }
172
- const Ne = 4;
172
+ const Pe = 4;
173
173
  function g(n) {
174
- if (n) return Qe(n);
174
+ if (n) return et(n);
175
175
  }
176
- function Qe(n) {
176
+ function et(n) {
177
177
  for (var e in g.prototype)
178
178
  n[e] = g.prototype[e];
179
179
  return n;
@@ -219,34 +219,34 @@ 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")(), Ze = "arraybuffer";
223
- function xe(n, ...e) {
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) {
224
224
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
225
225
  }
226
- const et = _.setTimeout, tt = _.clearTimeout;
227
- function J(n, e) {
228
- e.useNativeTimers ? (n.setTimeoutFn = et.bind(_), n.clearTimeoutFn = tt.bind(_)) : (n.setTimeoutFn = _.setTimeout.bind(_), n.clearTimeoutFn = _.clearTimeout.bind(_));
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(_));
229
229
  }
230
- const st = 1.33;
231
- function nt(n) {
232
- return typeof n == "string" ? it(n) : Math.ceil((n.byteLength || n.size) * st);
230
+ const it = 1.33;
231
+ function rt(n) {
232
+ return typeof n == "string" ? ot(n) : Math.ceil((n.byteLength || n.size) * it);
233
233
  }
234
- function it(n) {
234
+ function ot(n) {
235
235
  let e = 0, t = 0;
236
236
  for (let s = 0, i = n.length; s < i; 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 Pe() {
240
+ function Le() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
- function rt(n) {
243
+ function at(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 ot(n) {
249
+ function ct(n) {
250
250
  let e = {}, t = n.split("&");
251
251
  for (let s = 0, i = t.length; s < i; s++) {
252
252
  let r = t[s].split("=");
@@ -254,12 +254,12 @@ function ot(n) {
254
254
  }
255
255
  return e;
256
256
  }
257
- class at extends Error {
257
+ class ht 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 de extends g {
262
+ class ye extends g {
263
263
  /**
264
264
  * Transport abstract constructor.
265
265
  *
@@ -267,7 +267,7 @@ class de extends g {
267
267
  * @protected
268
268
  */
269
269
  constructor(e) {
270
- super(), this.writable = !1, J(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
270
+ super(), this.writable = !1, Y(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 de extends g {
279
279
  * @protected
280
280
  */
281
281
  onError(e, t, s) {
282
- return super.emitReserved("error", new at(e, t, s)), this;
282
+ return super.emitReserved("error", new ht(e, t, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -316,7 +316,7 @@ class de extends g {
316
316
  * @protected
317
317
  */
318
318
  onData(e) {
319
- const t = pe(e, this.socket.binaryType);
319
+ const t = de(e, this.socket.binaryType);
320
320
  this.onPacket(t);
321
321
  }
322
322
  /**
@@ -353,11 +353,11 @@ class de 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 = rt(e);
356
+ const t = at(e);
357
357
  return t.length ? "?" + t : "";
358
358
  }
359
359
  }
360
- class ct extends de {
360
+ class ut extends ye {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class ct extends de {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- We(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ ze(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 ct extends de {
433
433
  * @protected
434
434
  */
435
435
  write(e) {
436
- this.writable = !1, Ke(e, (t) => {
436
+ this.writable = !1, Xe(e, (t) => {
437
437
  this.doWrite(t, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -446,18 +446,18 @@ class ct extends de {
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] = Pe()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
449
+ return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Le()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
450
450
  }
451
451
  }
452
- let Ie = !1;
452
+ let qe = !1;
453
453
  try {
454
- Ie = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ qe = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const ht = Ie;
458
- function ut() {
457
+ const lt = qe;
458
+ function ft() {
459
459
  }
460
- class lt extends ct {
460
+ class pt extends ut {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -507,7 +507,7 @@ class E extends g {
507
507
  * @package
508
508
  */
509
509
  constructor(e, t, s) {
510
- super(), this.createRequest = e, J(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, 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();
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 = xe(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
519
+ const t = Ie(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 {
@@ -570,7 +570,7 @@ 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 = ut, e)
573
+ if (this._xhr.onreadystatechange = ft, e)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
@@ -600,36 +600,36 @@ E.requestsCount = 0;
600
600
  E.requests = {};
601
601
  if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
- attachEvent("onunload", ke);
603
+ attachEvent("onunload", Oe);
604
604
  else if (typeof addEventListener == "function") {
605
605
  const n = "onpagehide" in _ ? "pagehide" : "unload";
606
- addEventListener(n, ke, !1);
606
+ addEventListener(n, Oe, !1);
607
607
  }
608
608
  }
609
- function ke() {
609
+ function Oe() {
610
610
  for (let n in E.requests)
611
611
  E.requests.hasOwnProperty(n) && E.requests[n].abort();
612
612
  }
613
- const ft = function() {
614
- const n = Le({
613
+ const dt = function() {
614
+ const n = Ue({
615
615
  xdomain: !1
616
616
  });
617
617
  return n && n.responseType !== null;
618
618
  }();
619
- class pt extends lt {
619
+ class yt extends pt {
620
620
  constructor(e) {
621
621
  super(e);
622
622
  const t = e && e.forceBase64;
623
- this.supportsBinary = ft && !t;
623
+ this.supportsBinary = dt && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new E(Le, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new E(Ue, this.uri(), e);
627
627
  }
628
628
  }
629
- function Le(n) {
629
+ function Ue(n) {
630
630
  const e = n.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!e || ht))
632
+ if (typeof XMLHttpRequest < "u" && (!e || lt))
633
633
  return new XMLHttpRequest();
634
634
  } catch {
635
635
  }
@@ -639,13 +639,13 @@ function Le(n) {
639
639
  } catch {
640
640
  }
641
641
  }
642
- const qe = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class dt extends de {
642
+ const Fe = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class mt extends ye {
644
644
  get name() {
645
645
  return "websocket";
646
646
  }
647
647
  doOpen() {
648
- const e = this.uri(), t = this.opts.protocols, s = qe ? {} : xe(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 = Fe ? {} : Ie(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);
@@ -671,12 +671,12 @@ class dt extends de {
671
671
  this.writable = !1;
672
672
  for (let t = 0; t < e.length; t++) {
673
673
  const s = e[t], i = t === e.length - 1;
674
- fe(s, this.supportsBinary, (r) => {
674
+ pe(s, this.supportsBinary, (r) => {
675
675
  try {
676
676
  this.doWrite(s, r);
677
677
  } catch {
678
678
  }
679
- i && j(() => {
679
+ i && J(() => {
680
680
  this.writable = !0, this.emitReserved("drain");
681
681
  }, this.setTimeoutFn);
682
682
  });
@@ -693,19 +693,19 @@ class dt extends de {
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] = Pe()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
696
+ return this.opts.timestampRequests && (t[this.opts.timestampParam] = Le()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
697
697
  }
698
698
  }
699
- const Q = _.WebSocket || _.MozWebSocket;
700
- class yt extends dt {
699
+ const Z = _.WebSocket || _.MozWebSocket;
700
+ class gt extends mt {
701
701
  createSocket(e, t, s) {
702
- return qe ? new Q(e, t, s) : t ? new Q(e, t) : new Q(e);
702
+ return Fe ? new Z(e, t, s) : t ? new Z(e, t) : new Z(e);
703
703
  }
704
704
  doWrite(e, t) {
705
705
  this.ws.send(t);
706
706
  }
707
707
  }
708
- class mt extends de {
708
+ class wt extends ye {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,7 +721,7 @@ class mt extends de {
721
721
  this.onError("webtransport error", e);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((e) => {
724
- const t = Xe(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), i = ze();
724
+ const t = Ze(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), i = Qe();
725
725
  i.readable.pipeTo(e.writable), this._writer = i.writable.getWriter();
726
726
  const r = () => {
727
727
  s.read().then(({ done: h, value: l }) => {
@@ -730,8 +730,8 @@ class mt extends de {
730
730
  });
731
731
  };
732
732
  r();
733
- const o = { type: "open" };
734
- this.query.sid && (o.data = `{"sid":"${this.query.sid}"}`), this._writer.write(o).then(() => this.onOpen());
733
+ const a = { type: "open" };
734
+ this.query.sid && (a.data = `{"sid":"${this.query.sid}"}`), this._writer.write(a).then(() => this.onOpen());
735
735
  });
736
736
  });
737
737
  }
@@ -740,7 +740,7 @@ class mt extends de {
740
740
  for (let t = 0; t < e.length; t++) {
741
741
  const s = e[t], i = t === e.length - 1;
742
742
  this._writer.write(s).then(() => {
743
- i && j(() => {
743
+ i && J(() => {
744
744
  this.writable = !0, this.emitReserved("drain");
745
745
  }, this.setTimeoutFn);
746
746
  });
@@ -751,11 +751,11 @@ class mt extends de {
751
751
  (e = this._transport) === null || e === void 0 || e.close();
752
752
  }
753
753
  }
754
- const gt = {
755
- websocket: yt,
756
- webtransport: mt,
757
- polling: pt
758
- }, wt = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, _t = [
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 = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -771,29 +771,29 @@ const gt = {
771
771
  "query",
772
772
  "anchor"
773
773
  ];
774
- function ne(n) {
774
+ function ie(n) {
775
775
  if (n.length > 8e3)
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 = wt.exec(n || ""), r = {}, o = 14;
780
- for (; o--; )
781
- r[_t[o]] = i[o] || "";
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 = bt(r, r.path), r.queryKey = Tt(r, r.query), r;
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;
783
783
  }
784
- function bt(n, e) {
784
+ function Et(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 Tt(n, e) {
788
+ function vt(n, e) {
789
789
  const t = {};
790
790
  return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, i, r) {
791
791
  i && (t[i] = r);
792
792
  }), t;
793
793
  }
794
- const ie = typeof addEventListener == "function" && typeof removeEventListener == "function", M = [];
795
- ie && addEventListener("offline", () => {
796
- M.forEach((n) => n());
794
+ const re = typeof addEventListener == "function" && typeof removeEventListener == "function", V = [];
795
+ re && addEventListener("offline", () => {
796
+ V.forEach((n) => n());
797
797
  }, !1);
798
798
  class R extends g {
799
799
  /**
@@ -803,11 +803,11 @@ class R extends g {
803
803
  * @param {Object} opts - options
804
804
  */
805
805
  constructor(e, t) {
806
- if (super(), this.binaryType = Ze, 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
- const s = ne(e);
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) {
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
- } else t.host && (t.hostname = ne(t.host).host);
810
- J(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) => {
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
811
  const i = s.prototype.name;
812
812
  this.transports.push(i), this._transportsByName[i] = s;
813
813
  }), this.opts = Object.assign({
@@ -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 = ot(this.opts.query)), ie && (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 = ct(this.opts.query)), re && (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
- }, M.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
833
+ }, V.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 = Ne, t.transport = e, this.id && (t.sid = this.id);
844
+ t.EIO = Pe, 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,
@@ -959,7 +959,7 @@ class R extends g {
959
959
  let t = 1;
960
960
  for (let s = 0; s < this.writeBuffer.length; s++) {
961
961
  const i = this.writeBuffer[s].data;
962
- if (i && (t += nt(i)), s > 0 && t > this._maxPayload)
962
+ if (i && (t += rt(i)), 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, J(() => {
983
983
  this._onClose("ping timeout");
984
984
  }, this.setTimeoutFn)), e;
985
985
  }
@@ -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(), ie && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
- const s = M.indexOf(this._offlineEventListener);
1062
- s !== -1 && M.splice(s, 1);
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);
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 = Ne;
1069
- class Et extends R {
1068
+ R.protocol = Pe;
1069
+ class kt extends R {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -1102,23 +1102,23 @@ class Et extends R {
1102
1102
  function r() {
1103
1103
  s || (s = !0, d(), t.close(), t = null);
1104
1104
  }
1105
- const o = (m) => {
1105
+ const a = (m) => {
1106
1106
  const k = new Error("probe error: " + m);
1107
1107
  k.transport = t.name, r(), this.emitReserved("upgradeError", k);
1108
1108
  };
1109
1109
  function h() {
1110
- o("transport closed");
1110
+ a("transport closed");
1111
1111
  }
1112
1112
  function l() {
1113
- o("socket closed");
1113
+ a("socket closed");
1114
1114
  }
1115
1115
  function y(m) {
1116
1116
  t && m.name !== t.name && r();
1117
1117
  }
1118
1118
  const d = () => {
1119
- t.removeListener("open", i), t.removeListener("error", o), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1119
+ t.removeListener("open", i), t.removeListener("error", a), t.removeListener("close", h), this.off("close", l), this.off("upgrading", y);
1120
1120
  };
1121
- t.once("open", i), 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(() => {
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(() => {
1122
1122
  s || t.open();
1123
1123
  }, 200) : t.open();
1124
1124
  }
@@ -1138,67 +1138,67 @@ class Et extends R {
1138
1138
  return t;
1139
1139
  }
1140
1140
  }
1141
- let vt = class extends Et {
1141
+ let Ot = class extends kt {
1142
1142
  constructor(e, t = {}) {
1143
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) => gt[r]).filter((r) => !!r)), super(s ? i : e, i);
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);
1145
1145
  }
1146
1146
  };
1147
- function kt(n, e = "", t) {
1147
+ function St(n, e = "", t) {
1148
1148
  let s = n;
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 = ne(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
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
1150
  const r = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
1151
  return s.id = s.protocol + "://" + r + ":" + s.port + e, s.href = s.protocol + "://" + r + (t && t.port === s.port ? "" : ":" + s.port), s;
1152
1152
  }
1153
- const At = typeof ArrayBuffer == "function", Ot = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, Ue = Object.prototype.toString, St = typeof Blob == "function" || typeof Blob < "u" && Ue.call(Blob) === "[object BlobConstructor]", $t = typeof File == "function" || typeof File < "u" && Ue.call(File) === "[object FileConstructor]";
1154
- function ye(n) {
1155
- return At && (n instanceof ArrayBuffer || Ot(n)) || St && n instanceof Blob || $t && n instanceof File;
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;
1156
1156
  }
1157
- function V(n, e) {
1157
+ function H(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 (V(n[t]))
1162
+ if (H(n[t]))
1163
1163
  return !0;
1164
1164
  return !1;
1165
1165
  }
1166
- if (ye(n))
1166
+ if (me(n))
1167
1167
  return !0;
1168
1168
  if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
1169
- return V(n.toJSON(), !0);
1169
+ return H(n.toJSON(), !0);
1170
1170
  for (const t in n)
1171
- if (Object.prototype.hasOwnProperty.call(n, t) && V(n[t]))
1171
+ if (Object.prototype.hasOwnProperty.call(n, t) && H(n[t]))
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
1175
- function Ct(n) {
1175
+ function Bt(n) {
1176
1176
  const e = [], t = n.data, s = n;
1177
- return s.data = re(t, e), s.attachments = e.length, { packet: s, buffers: e };
1177
+ return s.data = oe(t, e), s.attachments = e.length, { packet: s, buffers: e };
1178
1178
  }
1179
- function re(n, e) {
1179
+ function oe(n, e) {
1180
1180
  if (!n)
1181
1181
  return n;
1182
- if (ye(n)) {
1182
+ if (me(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] = re(n[s], e);
1188
+ t[s] = oe(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] = re(n[s], e));
1193
+ Object.prototype.hasOwnProperty.call(n, s) && (t[s] = oe(n[s], e));
1194
1194
  return t;
1195
1195
  }
1196
1196
  return n;
1197
1197
  }
1198
- function Rt(n, e) {
1199
- return n.data = oe(n.data, e), delete n.attachments, n;
1198
+ function Nt(n, e) {
1199
+ return n.data = ae(n.data, e), delete n.attachments, n;
1200
1200
  }
1201
- function oe(n, e) {
1201
+ function ae(n, e) {
1202
1202
  if (!n)
1203
1203
  return n;
1204
1204
  if (n && n._placeholder === !0) {
@@ -1207,13 +1207,13 @@ function oe(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] = oe(n[t], e);
1210
+ n[t] = ae(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] = oe(n[t], e));
1213
+ Object.prototype.hasOwnProperty.call(n, t) && (n[t] = ae(n[t], e));
1214
1214
  return n;
1215
1215
  }
1216
- const Bt = [
1216
+ const xt = [
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 Nt {
1234
+ class Pt {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1247,7 +1247,7 @@ class Nt {
1247
1247
  * @param {Object} obj - packet object
1248
1248
  */
1249
1249
  encode(e) {
1250
- return (e.type === p.EVENT || e.type === p.ACK) && V(e) ? this.encodeAsBinary({
1250
+ return (e.type === p.EVENT || e.type === p.ACK) && H(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 Nt {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(e) {
1270
- const t = Ct(e), s = this.encodeAsString(t.packet), i = t.buffers;
1270
+ const t = Bt(e), s = this.encodeAsString(t.packet), i = t.buffers;
1271
1271
  return i.unshift(s), i;
1272
1272
  }
1273
1273
  }
1274
- class me extends g {
1274
+ class ge extends g {
1275
1275
  /**
1276
1276
  * Decoder constructor
1277
1277
  */
@@ -1293,8 +1293,8 @@ class me 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 xt(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
- } else if (ye(e) || e.base64)
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)
1298
1298
  if (this.reconstructor)
1299
1299
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
1300
1300
  else
@@ -1319,11 +1319,11 @@ class me extends g {
1319
1319
  const r = t + 1;
1320
1320
  for (; e.charAt(++t) !== "-" && t != e.length; )
1321
1321
  ;
1322
- const o = e.substring(r, t);
1323
- if (o != Number(o) || e.charAt(t) !== "-")
1322
+ const a = e.substring(r, t);
1323
+ if (a != Number(a) || e.charAt(t) !== "-")
1324
1324
  throw new Error("Illegal attachments");
1325
- const h = Number(o);
1326
- if (!Pt(h) || h < 0)
1325
+ const h = Number(a);
1326
+ if (!Lt(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");
@@ -1340,8 +1340,8 @@ class me extends g {
1340
1340
  if (i !== "" && Number(i) == i) {
1341
1341
  const r = t + 1;
1342
1342
  for (; ++t; ) {
1343
- const o = e.charAt(t);
1344
- if (o == null || Number(o) != o) {
1343
+ const a = e.charAt(t);
1344
+ if (a == null || Number(a) != a) {
1345
1345
  --t;
1346
1346
  break;
1347
1347
  }
@@ -1352,7 +1352,7 @@ class me extends g {
1352
1352
  }
1353
1353
  if (e.charAt(++t)) {
1354
1354
  const r = this.tryParse(e.substr(t));
1355
- if (me.isPayloadValid(s.type, r))
1355
+ if (ge.isPayloadValid(s.type, r))
1356
1356
  s.data = r;
1357
1357
  else
1358
1358
  throw new Error("invalid payload");
@@ -1369,14 +1369,14 @@ class me extends g {
1369
1369
  static isPayloadValid(e, t) {
1370
1370
  switch (e) {
1371
1371
  case p.CONNECT:
1372
- return Ae(t);
1372
+ return Se(t);
1373
1373
  case p.DISCONNECT:
1374
1374
  return t === void 0;
1375
1375
  case p.CONNECT_ERROR:
1376
- return typeof t == "string" || Ae(t);
1376
+ return typeof t == "string" || Se(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" && Bt.indexOf(t[0]) === -1);
1379
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && xt.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 me extends g {
1389
1389
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1390
1390
  }
1391
1391
  }
1392
- class xt {
1392
+ class It {
1393
1393
  constructor(e) {
1394
1394
  this.packet = e, this.buffers = [], this.reconPack = e;
1395
1395
  }
@@ -1403,7 +1403,7 @@ class xt {
1403
1403
  */
1404
1404
  takeBinaryData(e) {
1405
1405
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
1406
- const t = Rt(this.reconPack, this.buffers);
1406
+ const t = Nt(this.reconPack, this.buffers);
1407
1407
  return this.finishedReconstruction(), t;
1408
1408
  }
1409
1409
  return null;
@@ -1415,16 +1415,16 @@ class xt {
1415
1415
  this.reconPack = null, this.buffers = [];
1416
1416
  }
1417
1417
  }
1418
- const Pt = Number.isInteger || function(n) {
1418
+ const Lt = Number.isInteger || function(n) {
1419
1419
  return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1420
1420
  };
1421
- function Ae(n) {
1421
+ function Se(n) {
1422
1422
  return Object.prototype.toString.call(n) === "[object Object]";
1423
1423
  }
1424
- const It = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1425
1425
  __proto__: null,
1426
- Decoder: me,
1427
- Encoder: Nt,
1426
+ Decoder: ge,
1427
+ Encoder: Pt,
1428
1428
  get PacketType() {
1429
1429
  return p;
1430
1430
  }
@@ -1434,7 +1434,7 @@ function b(n, e, t) {
1434
1434
  n.off(e, t);
1435
1435
  };
1436
1436
  }
1437
- const Lt = Object.freeze({
1437
+ const Ut = Object.freeze({
1438
1438
  connect: 1,
1439
1439
  connect_error: 1,
1440
1440
  disconnect: 1,
@@ -1443,7 +1443,7 @@ const Lt = Object.freeze({
1443
1443
  newListener: 1,
1444
1444
  removeListener: 1
1445
1445
  });
1446
- class De extends g {
1446
+ class Me extends g {
1447
1447
  /**
1448
1448
  * `Socket` constructor.
1449
1449
  */
@@ -1559,20 +1559,20 @@ class De extends g {
1559
1559
  */
1560
1560
  emit(e, ...t) {
1561
1561
  var s, i, r;
1562
- if (Lt.hasOwnProperty(e))
1562
+ if (Ut.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 o = {
1566
+ const a = {
1567
1567
  type: p.EVENT,
1568
1568
  data: t
1569
1569
  };
1570
- if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
1570
+ if (a.options = {}, a.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), o.id = d;
1572
+ this._registerAckCallback(d, m), a.id = d;
1573
1573
  }
1574
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(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1575
+ return this.flags.volatile && !h || (l ? (this.notifyOutgoingListeners(a), this.packet(a)) : this.sendBuffer.push(a)), this.flags = {}, this;
1576
1576
  }
1577
1577
  /**
1578
1578
  * @private
@@ -1589,10 +1589,10 @@ class De extends g {
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), o = (...h) => {
1592
+ }, i), a = (...h) => {
1593
1593
  this.io.clearTimeoutFn(r), t.apply(this, h);
1594
1594
  };
1595
- o.withError = !0, this.acks[e] = o;
1595
+ a.withError = !0, this.acks[e] = a;
1596
1596
  }
1597
1597
  /**
1598
1598
  * Emits an event and waits for an acknowledgement
@@ -1612,7 +1612,7 @@ class De extends g {
1612
1612
  */
1613
1613
  emitWithAck(e, ...t) {
1614
1614
  return new Promise((s, i) => {
1615
- const r = (o, h) => o ? i(o) : s(h);
1615
+ const r = (a, h) => a ? i(a) : s(h);
1616
1616
  r.withError = !0, t.push(r), this.emit(e, ...t);
1617
1617
  });
1618
1618
  }
@@ -2058,15 +2058,15 @@ P.prototype.setMax = function(n) {
2058
2058
  P.prototype.setJitter = function(n) {
2059
2059
  this.jitter = n;
2060
2060
  };
2061
- class ae extends g {
2061
+ class ce 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, J(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, 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({
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 || It;
2069
+ const i = t.parser || qt;
2070
2070
  this.encoder = new i.Encoder(), this.decoder = new i.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2071
2071
  }
2072
2072
  reconnection(e) {
@@ -2109,14 +2109,14 @@ class ae extends g {
2109
2109
  open(e) {
2110
2110
  if (~this._readyState.indexOf("open"))
2111
2111
  return this;
2112
- this.engine = new vt(this.uri, this.opts);
2112
+ this.engine = new Ot(this.uri, this.opts);
2113
2113
  const t = this.engine, s = this;
2114
2114
  this._readyState = "opening", this.skipReconnect = !1;
2115
2115
  const i = b(t, "open", function() {
2116
2116
  s.onopen(), e && e();
2117
2117
  }), r = (h) => {
2118
2118
  this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), e ? e(h) : this.maybeReconnectOnOpen();
2119
- }, o = b(t, "error", r);
2119
+ }, a = b(t, "error", r);
2120
2120
  if (this._timeout !== !1) {
2121
2121
  const h = this._timeout, l = this.setTimeoutFn(() => {
2122
2122
  i(), r(new Error("timeout")), t.close();
@@ -2125,7 +2125,7 @@ class ae extends g {
2125
2125
  this.clearTimeoutFn(l);
2126
2126
  });
2127
2127
  }
2128
- return this.subs.push(i), this.subs.push(o), this;
2128
+ return this.subs.push(i), this.subs.push(a), this;
2129
2129
  }
2130
2130
  /**
2131
2131
  * Alias for open()
@@ -2179,7 +2179,7 @@ class ae extends g {
2179
2179
  * @private
2180
2180
  */
2181
2181
  ondecoded(e) {
2182
- j(() => {
2182
+ J(() => {
2183
2183
  this.emitReserved("packet", e);
2184
2184
  }, this.setTimeoutFn);
2185
2185
  }
@@ -2199,7 +2199,7 @@ class ae 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 De(this, e, t), this.nsps[e] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new Me(this, e, t), this.nsps[e] = s), s;
2203
2203
  }
2204
2204
  /**
2205
2205
  * Called upon a socket close.
@@ -2297,19 +2297,20 @@ class ae extends g {
2297
2297
  }
2298
2298
  }
2299
2299
  const I = {};
2300
- function q(n, e) {
2300
+ function U(n, e) {
2301
2301
  typeof n == "object" && (e = n, n = void 0), e = e || {};
2302
- const t = kt(n, e.path || "/socket.io"), s = t.source, i = t.id, r = t.path, o = I[i] && r in I[i].nsps, h = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
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;
2303
2303
  let l;
2304
- return h ? l = new ae(s, e) : (I[i] || (I[i] = new ae(s, e)), l = I[i]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
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);
2305
2305
  }
2306
- Object.assign(q, {
2307
- Manager: ae,
2308
- Socket: De,
2309
- io: q,
2310
- connect: q
2306
+ Object.assign(U, {
2307
+ Manager: ce,
2308
+ Socket: Me,
2309
+ io: U,
2310
+ connect: U
2311
2311
  });
2312
- function qt(n) {
2312
+ const Ae = 100;
2313
+ function Ft(n) {
2313
2314
  try {
2314
2315
  const e = JSON.parse(n);
2315
2316
  if (e && typeof e == "object") {
@@ -2324,9 +2325,9 @@ function qt(n) {
2324
2325
  }
2325
2326
  return {};
2326
2327
  }
2327
- class Ut extends Error {
2328
+ class Dt extends Error {
2328
2329
  constructor(t, s, i) {
2329
- const r = qt(i);
2330
+ const r = Ft(i);
2330
2331
  super(r.message ?? `${s || "Request failed"} (${t})`);
2331
2332
  w(this, "status");
2332
2333
  w(this, "code");
@@ -2335,9 +2336,9 @@ class Ut extends Error {
2335
2336
  this.name = "RequestError", this.status = t, this.code = r.code, this.details = r.details, this.body = i;
2336
2337
  }
2337
2338
  }
2338
- const T = "item/folder", f = "item", S = "processor", Dt = "npm-registry", $ = "hidden", Z = "FILE", ee = "TOOL", te = "APP";
2339
- var a, he, u, C, H, G, ue, le, Fe;
2340
- const ge = class ge {
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 {
2341
2342
  /**
2342
2343
  * Creates a new EngineServicesClient instance.
2343
2344
  * @param accessToken - API access token (obtained from the platform dashboard)
@@ -2346,7 +2347,7 @@ const ge = class ge {
2346
2347
  * @param props - Optional configuration (retry count, auth mode, etc.).
2347
2348
  */
2348
2349
  constructor(e, t, s) {
2349
- W(this, a);
2350
+ X(this, o);
2350
2351
  w(this, "apiUrl");
2351
2352
  w(this, "accessToken");
2352
2353
  w(this, "wsUrl");
@@ -2365,10 +2366,10 @@ const ge = class ge {
2365
2366
  * Populated automatically when using {@link fromPlatformContext}.
2366
2367
  */
2367
2368
  w(this, "context");
2368
- const { retries: i = 0, useBearer: r = !1, localServerUrl: o } = s || {};
2369
+ const { retries: i = 0, useBearer: r = !1, localServerUrl: a } = s || {};
2369
2370
  let h = t;
2370
- 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 }, o) {
2371
- let l = o;
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;
2372
2373
  l.charAt(l.length - 1) === "/" && (l = l.slice(0, -1)), this.localServerUrl = l;
2373
2374
  }
2374
2375
  }
@@ -2389,7 +2390,7 @@ const ge = class ge {
2389
2390
  * ```
2390
2391
  */
2391
2392
  static fromPlatformContext(e) {
2392
- const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new ge(t.accessToken, t.apiUrl, {
2393
+ const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new we(t.accessToken, t.apiUrl, {
2393
2394
  ...e,
2394
2395
  useBearer: !0
2395
2396
  });
@@ -2459,7 +2460,7 @@ const ge = class ge {
2459
2460
  * cleaning logic is applied identically.
2460
2461
  */
2461
2462
  async request(e, t, s) {
2462
- return c(this, a, u).call(this, e, t, s);
2463
+ return c(this, o, u).call(this, e, t, s);
2463
2464
  }
2464
2465
  // ─── Files ───────────────────────────────────────────────────────
2465
2466
  /**
@@ -2469,9 +2470,9 @@ const ge = class ge {
2469
2470
  */
2470
2471
  async listFiles(e) {
2471
2472
  const { folderId: t, archived: s, projectId: i } = e || {};
2472
- return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, { query: { itemType: Z, archived: s } }) : await c(this, a, u).call(this, "GET", `${f}`, {
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}`, {
2473
2474
  query: {
2474
- itemType: Z,
2475
+ itemType: ee,
2475
2476
  archived: s,
2476
2477
  ...i && { projectId: i }
2477
2478
  }
@@ -2484,7 +2485,7 @@ const ge = class ge {
2484
2485
  * @returns The file item, optionally with version history.
2485
2486
  */
2486
2487
  async getFile(e, t) {
2487
- return await c(this, a, le).call(this, e, t);
2488
+ return await c(this, o, fe).call(this, e, t);
2488
2489
  }
2489
2490
  /**
2490
2491
  * Uploads a new file.
@@ -2492,7 +2493,7 @@ const ge = class ge {
2492
2493
  * @returns The created item and its first version.
2493
2494
  */
2494
2495
  async createFile(e) {
2495
- return await c(this, a, G).call(this, e, Z);
2496
+ return await c(this, o, j).call(this, e, ee);
2496
2497
  }
2497
2498
  /**
2498
2499
  * Updates an existing file. Can rename, move to a different folder,
@@ -2502,21 +2503,21 @@ const ge = class ge {
2502
2503
  * @returns The updated item and/or the new version.
2503
2504
  */
2504
2505
  async updateFile(e, t) {
2505
- return await c(this, a, ue).call(this, e, t);
2506
+ return await c(this, o, le).call(this, e, t);
2506
2507
  }
2507
2508
  /**
2508
2509
  * Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
2509
2510
  * @param fileId - The file's unique identifier.
2510
2511
  */
2511
2512
  async archiveFile(e) {
2512
- return await c(this, a, u).call(this, "DELETE", `${f}/${e}`);
2513
+ return await c(this, o, u).call(this, "DELETE", `${f}/${e}`);
2513
2514
  }
2514
2515
  /**
2515
2516
  * Recovers a previously archived file.
2516
2517
  * @param fileId - The file's unique identifier.
2517
2518
  */
2518
2519
  async recoverFile(e) {
2519
- return await c(this, a, u).call(this, "PUT", `${f}/${e}/recover`);
2520
+ return await c(this, o, u).call(this, "PUT", `${f}/${e}/recover`);
2520
2521
  }
2521
2522
  /**
2522
2523
  * Downloads a file's content. Returns the raw fetch Response.
@@ -2525,7 +2526,7 @@ const ge = class ge {
2525
2526
  * @returns A fetch Response containing the file data.
2526
2527
  */
2527
2528
  async downloadFile(e, t) {
2528
- return await c(this, a, H).call(this, e, t);
2529
+ return await c(this, o, G).call(this, e, t);
2529
2530
  }
2530
2531
  /**
2531
2532
  * Retrieves the free-JSON metadata for a specific file version.
@@ -2536,7 +2537,7 @@ const ge = class ge {
2536
2537
  */
2537
2538
  async getFileVersionMetadata(e, t, s) {
2538
2539
  const { withDraft: i } = s || {};
2539
- return await c(this, a, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2540
+ return await c(this, o, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2540
2541
  query: {
2541
2542
  ...i && { withDraft: "true" }
2542
2543
  }
@@ -2549,7 +2550,7 @@ const ge = class ge {
2549
2550
  * @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
2550
2551
  */
2551
2552
  async updateFileVersionMetadata(e, t, s) {
2552
- return await c(this, a, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2553
+ return await c(this, o, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
2553
2554
  body: JSON.stringify({ metadata: s }),
2554
2555
  contentType: "application/json"
2555
2556
  });
@@ -2560,7 +2561,30 @@ const ge = class ge {
2560
2561
  * @param versionTag - The version tag.
2561
2562
  */
2562
2563
  async deleteFileVersionMetadata(e, t) {
2563
- return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
2564
+ return await c(this, o, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
2565
+ }
2566
+ /**
2567
+ * Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
2568
+ * many (file, version) pairs in one request instead of one request per pair,
2569
+ * which is what a file list needs when it hydrates a whole page at once.
2570
+ *
2571
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
2572
+ * requests automatically. Entries come back in the order they were asked
2573
+ * for; a pair the caller cannot read carries an `error` instead of
2574
+ * `metadata`, so one bad id does not lose the whole page.
2575
+ *
2576
+ * @param entries - The `{ itemId, versionTag }` pairs to read.
2577
+ * @param params - Optional flags such as `withDraft`.
2578
+ */
2579
+ async getFileVersionMetadataBatch(e, t) {
2580
+ 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`, {
2582
+ body: JSON.stringify({
2583
+ entries: i,
2584
+ ...s !== void 0 && { withDraft: s }
2585
+ }),
2586
+ contentType: "application/json"
2587
+ })).results);
2564
2588
  }
2565
2589
  // ─── Folders ─────────────────────────────────────────────────────
2566
2590
  /**
@@ -2570,7 +2594,7 @@ const ge = class ge {
2570
2594
  */
2571
2595
  async listFolders(e) {
2572
2596
  const { archived: t, parentFolderId: s, projectId: i } = e || {};
2573
- return await c(this, a, u).call(this, "GET", T, {
2597
+ return await c(this, o, u).call(this, "GET", T, {
2574
2598
  query: {
2575
2599
  parentFolderId: s,
2576
2600
  archived: t,
@@ -2583,7 +2607,26 @@ const ge = class ge {
2583
2607
  * @param folderId - The folder's unique identifier.
2584
2608
  */
2585
2609
  async getFolder(e) {
2586
- return await c(this, a, u).call(this, "GET", `${T}/${e}`);
2610
+ return await c(this, o, u).call(this, "GET", `${T}/${e}`);
2611
+ }
2612
+ /**
2613
+ * Batch variant of {@link getFolder}. Resolves a known set of folder ids in
2614
+ * one request — for example the parents behind a file list's breadcrumbs.
2615
+ *
2616
+ * Reach for {@link listFolders} instead when the whole (project) tree is
2617
+ * wanted; this is for the case where the ids are already known.
2618
+ *
2619
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
2620
+ * requests automatically. A folder the caller cannot read carries an
2621
+ * `error` instead of `folder`.
2622
+ *
2623
+ * @param folderIds - The folder ids to resolve.
2624
+ */
2625
+ 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`, {
2627
+ body: JSON.stringify({ folderIds: t }),
2628
+ contentType: "application/json"
2629
+ })).results);
2587
2630
  }
2588
2631
  /**
2589
2632
  * Creates a new folder.
@@ -2592,7 +2635,7 @@ const ge = class ge {
2592
2635
  * @returns The created folder.
2593
2636
  */
2594
2637
  async createFolder(e, t, s) {
2595
- return await c(this, a, u).call(this, "POST", T, {
2638
+ return await c(this, o, u).call(this, "POST", T, {
2596
2639
  body: JSON.stringify({
2597
2640
  name: e,
2598
2641
  ...t && { parentId: t },
@@ -2609,7 +2652,7 @@ const ge = class ge {
2609
2652
  */
2610
2653
  async updateFolder(e, t) {
2611
2654
  const { name: s } = t;
2612
- return await c(this, a, u).call(this, "PUT", `${T}/${e}`, {
2655
+ return await c(this, o, u).call(this, "PUT", `${T}/${e}`, {
2613
2656
  body: JSON.stringify({ name: s }),
2614
2657
  contentType: "application/json"
2615
2658
  });
@@ -2619,14 +2662,14 @@ const ge = class ge {
2619
2662
  * @param folderId - The folder's unique identifier.
2620
2663
  */
2621
2664
  async archiveFolder(e) {
2622
- return await c(this, a, u).call(this, "DELETE", `${T}/${e}`);
2665
+ return await c(this, o, u).call(this, "DELETE", `${T}/${e}`);
2623
2666
  }
2624
2667
  /**
2625
2668
  * Recovers a previously archived folder.
2626
2669
  * @param folderId - The folder's unique identifier.
2627
2670
  */
2628
2671
  async recoverFolder(e) {
2629
- return await c(this, a, u).call(this, "PUT", `${T}/${e}/recover`);
2672
+ return await c(this, o, u).call(this, "PUT", `${T}/${e}/recover`);
2630
2673
  }
2631
2674
  /**
2632
2675
  * Downloads an entire folder as a ZIP archive.
@@ -2634,7 +2677,7 @@ const ge = class ge {
2634
2677
  * @returns A fetch Response containing the ZIP data.
2635
2678
  */
2636
2679
  async downloadFolder(e) {
2637
- return await c(this, a, C).call(this, `${T}/${e}/download`);
2680
+ return await c(this, o, C).call(this, `${T}/${e}/download`);
2638
2681
  }
2639
2682
  // ─── Components ──────────────────────────────────────────────────
2640
2683
  /**
@@ -2644,14 +2687,14 @@ const ge = class ge {
2644
2687
  */
2645
2688
  async listComponents(e) {
2646
2689
  const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2647
- return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, {
2690
+ return t ? await c(this, o, u).call(this, "GET", `${T}/${t}/items`, {
2648
2691
  query: {
2649
- itemType: ee,
2692
+ itemType: te,
2650
2693
  ...s && { ShowVersions: s }
2651
2694
  }
2652
- }) : await c(this, a, u).call(this, "GET", `${f}`, {
2695
+ }) : await c(this, o, u).call(this, "GET", `${f}`, {
2653
2696
  query: {
2654
- itemType: ee,
2697
+ itemType: te,
2655
2698
  ...s && { ShowVersions: s },
2656
2699
  ...i && { projectId: i }
2657
2700
  }
@@ -2663,7 +2706,7 @@ const ge = class ge {
2663
2706
  * @param props - Options such as whether to include versions.
2664
2707
  */
2665
2708
  async getComponent(e, t) {
2666
- return await c(this, a, le).call(this, e, t);
2709
+ return await c(this, o, fe).call(this, e, t);
2667
2710
  }
2668
2711
  /**
2669
2712
  * Creates a new component with the given file and version properties.
@@ -2672,7 +2715,7 @@ const ge = class ge {
2672
2715
  */
2673
2716
  async createComponent(e) {
2674
2717
  const { componentProps: t } = e;
2675
- return await c(this, a, G).call(this, e, ee, t);
2718
+ return await c(this, o, j).call(this, e, te, t);
2676
2719
  }
2677
2720
  /**
2678
2721
  * Updates an existing component. Can rename, move, and/or upload a new version.
@@ -2682,7 +2725,7 @@ const ge = class ge {
2682
2725
  */
2683
2726
  async updateComponent(e, t) {
2684
2727
  const { componentProps: s } = t;
2685
- return await c(this, a, ue).call(this, e, t, s);
2728
+ return await c(this, o, le).call(this, e, t, s);
2686
2729
  }
2687
2730
  /**
2688
2731
  * Downloads a component's full ZIP file. Returns the raw fetch Response.
@@ -2691,7 +2734,7 @@ const ge = class ge {
2691
2734
  * @returns A fetch Response containing the ZIP data.
2692
2735
  */
2693
2736
  async downloadComponent(e, t) {
2694
- return await c(this, a, H).call(this, e, t);
2737
+ return await c(this, o, G).call(this, e, t);
2695
2738
  }
2696
2739
  /**
2697
2740
  * Downloads only the JavaScript bundle from a component's ZIP.
@@ -2702,7 +2745,7 @@ const ge = class ge {
2702
2745
  */
2703
2746
  async downloadComponentBundle(e, t) {
2704
2747
  const { versionTag: s, withDraft: i } = t || {};
2705
- return await c(this, a, C).call(this, `${f}/${e}/download/bundle`, {
2748
+ return await c(this, o, C).call(this, `${f}/${e}/download/bundle`, {
2706
2749
  query: {
2707
2750
  ...s && { versionTag: s },
2708
2751
  ...i && { withDraft: i }
@@ -2714,14 +2757,14 @@ const ge = class ge {
2714
2757
  * @param componentId - The component's unique identifier.
2715
2758
  */
2716
2759
  async archiveComponent(e) {
2717
- return await c(this, a, u).call(this, "DELETE", `${f}/${e}`);
2760
+ return await c(this, o, u).call(this, "DELETE", `${f}/${e}`);
2718
2761
  }
2719
2762
  /**
2720
2763
  * Recovers a previously archived component.
2721
2764
  * @param componentId - The component's unique identifier.
2722
2765
  */
2723
2766
  async recoverComponent(e) {
2724
- return await c(this, a, u).call(this, "PUT", `${f}/${e}/recover`);
2767
+ return await c(this, o, u).call(this, "PUT", `${f}/${e}/recover`);
2725
2768
  }
2726
2769
  // ─── Built-in Components ─────────────────────────────────────────
2727
2770
  /**
@@ -2730,7 +2773,7 @@ const ge = class ge {
2730
2773
  * @returns The component's JavaScript source code as a string.
2731
2774
  */
2732
2775
  async getBuiltInComponent(e) {
2733
- return await (await c(this, a, C).call(this, `built-in/${e}/bundle`)).text();
2776
+ return await (await c(this, o, C).call(this, `built-in/${e}/bundle`)).text();
2734
2777
  }
2735
2778
  /**
2736
2779
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -2759,7 +2802,7 @@ const ge = class ge {
2759
2802
  * ```
2760
2803
  */
2761
2804
  async initBuiltInComponent(e, t, s) {
2762
- const i = await this.getBuiltInComponent(e.uuid), r = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(r), h = o.map((m) => r[m]), y = new Function(...o, `${i}
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}
2763
2806
  return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2764
2807
  t.get(d);
2765
2808
  }
@@ -2803,13 +2846,13 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2803
2846
  * ```
2804
2847
  */
2805
2848
  async setup(e, ...t) {
2806
- var o, h;
2849
+ var a, h;
2807
2850
  const s = e.OBC, i = e.BUI;
2808
2851
  if (!(s != null && s.Components))
2809
2852
  throw new Error("globals.OBC must include Components");
2810
2853
  if (!(i != null && i.Manager)) throw new Error("globals.BUI must include Manager");
2811
2854
  const r = new s.Components();
2812
- return i.Manager.init(), this.setBuiltInGlobals(e), await this.initBuiltInComponents(r, ...t), r.init(), (h = (o = this.context.appEventOrchestrator) == null ? void 0 : o.appLoaded) == null || h.call(o), { components: r };
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 };
2813
2856
  }
2814
2857
  /**
2815
2858
  * Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
@@ -2828,14 +2871,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2828
2871
  */
2829
2872
  async listApps(e) {
2830
2873
  const { folderId: t, ShowVersions: s, projectId: i } = e || {};
2831
- return t ? await c(this, a, u).call(this, "GET", `${T}/${t}/items`, {
2874
+ return t ? await c(this, o, u).call(this, "GET", `${T}/${t}/items`, {
2832
2875
  query: {
2833
- itemType: te,
2876
+ itemType: se,
2834
2877
  ...s && { ShowVersions: s }
2835
2878
  }
2836
- }) : await c(this, a, u).call(this, "GET", `${f}`, {
2879
+ }) : await c(this, o, u).call(this, "GET", `${f}`, {
2837
2880
  query: {
2838
- itemType: te,
2881
+ itemType: se,
2839
2882
  ...s && { ShowVersions: s },
2840
2883
  ...i && { projectId: i }
2841
2884
  }
@@ -2848,7 +2891,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2848
2891
  */
2849
2892
  async createApp(e) {
2850
2893
  const { appProps: t } = e;
2851
- return await c(this, a, G).call(this, e, te, t);
2894
+ return await c(this, o, j).call(this, e, se, t);
2852
2895
  }
2853
2896
  /**
2854
2897
  * Downloads an app's full ZIP file. Returns the raw fetch Response.
@@ -2857,7 +2900,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2857
2900
  * @returns A fetch Response containing the ZIP data.
2858
2901
  */
2859
2902
  async downloadApp(e, t) {
2860
- return await c(this, a, H).call(this, e, t);
2903
+ return await c(this, o, G).call(this, e, t);
2861
2904
  }
2862
2905
  /**
2863
2906
  * Downloads only the JavaScript bundle from an app's ZIP.
@@ -2868,7 +2911,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2868
2911
  */
2869
2912
  async downloadAppBundle(e, t) {
2870
2913
  const { versionTag: s, withDraft: i } = t || {};
2871
- return await c(this, a, C).call(this, `${f}/${e}/download/bundle`, {
2914
+ return await c(this, o, C).call(this, `${f}/${e}/download/bundle`, {
2872
2915
  query: {
2873
2916
  ...s && { versionTag: s },
2874
2917
  ...i && { withDraft: i }
@@ -2880,7 +2923,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2880
2923
  * @param appId - The app's unique identifier.
2881
2924
  */
2882
2925
  async archiveApp(e) {
2883
- return await c(this, a, u).call(this, "DELETE", `${f}/${e}`);
2926
+ return await c(this, o, u).call(this, "DELETE", `${f}/${e}`);
2884
2927
  }
2885
2928
  // ─── NPM Registry ────────────────────────────────────────────────
2886
2929
  /**
@@ -2892,7 +2935,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2892
2935
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
2893
2936
  */
2894
2937
  async getNpmCredentials() {
2895
- return await c(this, a, u).call(this, "GET", `${Dt}/credentials`);
2938
+ return await c(this, o, u).call(this, "GET", `${Mt}/credentials`);
2896
2939
  }
2897
2940
  // ─── Execution ───────────────────────────────────────────────────
2898
2941
  /**
@@ -2911,18 +2954,20 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2911
2954
  */
2912
2955
  async executeComponent(e, t, s) {
2913
2956
  if (this.localServerUrl) {
2914
- const i = `${this.localServerUrl}/api/${S}/${e}/execute`, r = await fetch(i, {
2957
+ const i = `${this.localServerUrl}/api/${$}/${e}/execute`, r = await fetch(i, {
2915
2958
  method: "POST",
2916
2959
  headers: { "Content-Type": "application/json" },
2917
2960
  body: JSON.stringify(t)
2918
2961
  });
2919
2962
  if (!r.ok) {
2920
- const o = await r.text().catch(() => "");
2921
- throw new Error(`Local server request failed: ${r.status} - ${o}`);
2963
+ const a = await r.text().catch(() => "");
2964
+ throw new Error(
2965
+ `Local server request failed: ${r.status} - ${a}`
2966
+ );
2922
2967
  }
2923
2968
  return await r.json();
2924
2969
  }
2925
- return await c(this, a, u).call(this, "POST", `${S}/${e}/execute`, {
2970
+ return await c(this, o, u).call(this, "POST", `${$}/${e}/execute`, {
2926
2971
  body: JSON.stringify(t),
2927
2972
  query: { ...s && { versionTag: s } },
2928
2973
  contentType: "application/json"
@@ -2934,14 +2979,16 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2934
2979
  */
2935
2980
  async abortExecution(e) {
2936
2981
  if (this.localServerUrl) {
2937
- const t = `${this.localServerUrl}/api/${S}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
2982
+ const t = `${this.localServerUrl}/api/${$}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
2938
2983
  if (!s.ok) {
2939
2984
  const i = await s.text().catch(() => "");
2940
- throw new Error(`Local server request failed: ${s.status} - ${i}`);
2985
+ throw new Error(
2986
+ `Local server request failed: ${s.status} - ${i}`
2987
+ );
2941
2988
  }
2942
2989
  return await s.json();
2943
2990
  }
2944
- return await c(this, a, u).call(this, "POST", `${S}/progress/${e}/abort`);
2991
+ return await c(this, o, u).call(this, "POST", `${$}/progress/${e}/abort`);
2945
2992
  }
2946
2993
  /**
2947
2994
  * Lists all executions for a given component.
@@ -2958,16 +3005,16 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2958
3005
  */
2959
3006
  async listExecutions(e, t) {
2960
3007
  if (this.localServerUrl) {
2961
- const s = t ? `?projectId=${encodeURIComponent(t)}` : "", i = `${this.localServerUrl}/api/${S}/${e}/progress${s}`, r = await fetch(i);
3008
+ const s = t ? `?projectId=${encodeURIComponent(t)}` : "", i = `${this.localServerUrl}/api/${$}/${e}/progress${s}`, r = await fetch(i);
2962
3009
  if (!r.ok) {
2963
- const o = await r.text().catch(() => "");
3010
+ const a = await r.text().catch(() => "");
2964
3011
  throw new Error(
2965
- `Local server request failed: ${r.status} - ${o}`
3012
+ `Local server request failed: ${r.status} - ${a}`
2966
3013
  );
2967
3014
  }
2968
3015
  return await r.json();
2969
3016
  }
2970
- return await c(this, a, u).call(this, "GET", `${S}/${e}/progress`, { query: { ...t && { projectId: t } } });
3017
+ return await c(this, o, u).call(this, "GET", `${$}/${e}/progress`, { query: { ...t && { projectId: t } } });
2971
3018
  }
2972
3019
  /**
2973
3020
  * Gets details of a specific execution, including its messages.
@@ -2976,14 +3023,16 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2976
3023
  */
2977
3024
  async getExecution(e) {
2978
3025
  if (this.localServerUrl) {
2979
- const t = `${this.localServerUrl}/api/${S}/progress/${e}`, s = await fetch(t);
3026
+ const t = `${this.localServerUrl}/api/${$}/progress/${e}`, s = await fetch(t);
2980
3027
  if (!s.ok) {
2981
3028
  const i = await s.text().catch(() => "");
2982
- throw new Error(`Local server request failed: ${s.status} - ${i}`);
3029
+ throw new Error(
3030
+ `Local server request failed: ${s.status} - ${i}`
3031
+ );
2983
3032
  }
2984
3033
  return await s.json();
2985
3034
  }
2986
- return await c(this, a, u).call(this, "GET", `${S}/progress/${e}`);
3035
+ return await c(this, o, u).call(this, "GET", `${$}/progress/${e}`);
2987
3036
  }
2988
3037
  /**
2989
3038
  * Subscribes to real-time execution progress via WebSocket.
@@ -2992,7 +3041,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
2992
3041
  * @param onUpdateCallback - Callback invoked on each progress/result event.
2993
3042
  */
2994
3043
  async onExecutionProgress(e, t) {
2995
- const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, i = await q(s, {
3044
+ const s = this.localServerUrl ? `${this.localServerUrl}?accessToken=${this.accessToken}` : this.wsUrl, i = await U(s, {
2996
3045
  ...this.localServerUrl && { transports: ["websocket"] }
2997
3046
  });
2998
3047
  i.on("connect", function() {
@@ -3012,7 +3061,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3012
3061
  */
3013
3062
  async createHiddenFile(e, t) {
3014
3063
  const s = new FormData();
3015
- return s.append("file", e), s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${$}`, {
3064
+ return s.append("file", e), s.append("parentItemId", t), await c(this, o, u).call(this, "POST", `${f}/${O}`, {
3016
3065
  body: s
3017
3066
  });
3018
3067
  }
@@ -3028,7 +3077,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3028
3077
  const s = new FormData();
3029
3078
  for (const i of e)
3030
3079
  s.append("files", i);
3031
- return s.append("parentItemId", t), await c(this, a, u).call(this, "POST", `${f}/${$}/batch`, {
3080
+ return s.append("parentItemId", t), await c(this, o, u).call(this, "POST", `${f}/${O}/batch`, {
3032
3081
  body: s
3033
3082
  });
3034
3083
  }
@@ -3037,21 +3086,21 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3037
3086
  * @param hiddenId - The hidden file's unique identifier.
3038
3087
  */
3039
3088
  async deleteHiddenFile(e) {
3040
- return await c(this, a, u).call(this, "DELETE", `${f}/${$}/${e}`);
3089
+ return await c(this, o, u).call(this, "DELETE", `${f}/${O}/${e}`);
3041
3090
  }
3042
3091
  /**
3043
3092
  * Gets metadata for a hidden file.
3044
3093
  * @param hiddenId - The hidden file's unique identifier.
3045
3094
  */
3046
3095
  async getHiddenFile(e) {
3047
- return await c(this, a, u).call(this, "GET", `${f}/${$}/${e}`);
3096
+ return await c(this, o, u).call(this, "GET", `${f}/${O}/${e}`);
3048
3097
  }
3049
3098
  /**
3050
3099
  * Downloads a hidden file's content. Returns the raw fetch Response.
3051
3100
  * @param hiddenId - The hidden file's unique identifier.
3052
3101
  */
3053
3102
  async downloadHiddenFile(e) {
3054
- return await c(this, a, C).call(this, `${f}/${$}/${e}/download`);
3103
+ return await c(this, o, C).call(this, `${f}/${O}/${e}/download`);
3055
3104
  }
3056
3105
  /**
3057
3106
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -3071,7 +3120,34 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3071
3120
  * an ISO timestamp when it stops working.
3072
3121
  */
3073
3122
  async getHiddenFileSignedUrl(e, t) {
3074
- return await c(this, a, u).call(this, "GET", `${f}/${$}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3123
+ return await c(this, o, u).call(this, "GET", `${f}/${O}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3124
+ }
3125
+ /**
3126
+ * Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
3127
+ * many hidden files in one request.
3128
+ *
3129
+ * This is the right call for tile-based viewers (splats, point clouds),
3130
+ * which mint a URL per piece as the camera moves. One request here replaces
3131
+ * up to {@link STORAGE_BATCH_MAX} single calls, which keeps a busy session
3132
+ * well under the per-endpoint rate limit.
3133
+ *
3134
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
3135
+ * requests automatically. Entries come back in request order; a file that
3136
+ * is gone or not accessible carries an `error` instead of a `url`, so the
3137
+ * remaining tiles still load. Re-call to re-mint as `expiresAt` approaches.
3138
+ *
3139
+ * @param hiddenIds - The hidden files to sign.
3140
+ * @param expiresIn - Desired URL lifetime in seconds (60–3600). Defaults to
3141
+ * 900 (15 min) server-side; values are clamped to that range.
3142
+ */
3143
+ 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`, {
3145
+ body: JSON.stringify({
3146
+ hiddenFileIds: s,
3147
+ ...t != null && { expiresIn: t }
3148
+ }),
3149
+ contentType: "application/json"
3150
+ })).results);
3075
3151
  }
3076
3152
  /**
3077
3153
  * Lists all hidden files attached to a parent item.
@@ -3079,14 +3155,14 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3079
3155
  * @returns Array of hidden file entities.
3080
3156
  */
3081
3157
  async getHiddenFilesByParent(e) {
3082
- return await c(this, a, u).call(this, "GET", `${f}/${e}/${$}`);
3158
+ return await c(this, o, u).call(this, "GET", `${f}/${e}/${O}`);
3083
3159
  }
3084
3160
  /**
3085
3161
  * Deletes all hidden files attached to a parent item.
3086
3162
  * @param parentFileId - The parent item's unique identifier.
3087
3163
  */
3088
3164
  async deleteHiddenFilesByParent(e) {
3089
- return await c(this, a, u).call(this, "DELETE", `${f}/${e}/${$}`);
3165
+ return await c(this, o, u).call(this, "DELETE", `${f}/${e}/${O}`);
3090
3166
  }
3091
3167
  // ─── Icons ───────────────────────────────────────────────────────
3092
3168
  /**
@@ -3098,7 +3174,9 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3098
3174
  */
3099
3175
  async uploadItemIcon(e, t) {
3100
3176
  const s = new FormData();
3101
- return s.append("icon", t), await c(this, a, u).call(this, "PUT", `${f}/${e}/icon`, { body: s });
3177
+ return s.append("icon", t), await c(this, o, u).call(this, "PUT", `${f}/${e}/icon`, {
3178
+ body: s
3179
+ });
3102
3180
  }
3103
3181
  /**
3104
3182
  * Downloads the icon for an item as a binary stream.
@@ -3106,7 +3184,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3106
3184
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
3107
3185
  */
3108
3186
  async getItemIcon(e) {
3109
- return await c(this, a, C).call(this, `${f}/${e}/icon`);
3187
+ return await c(this, o, C).call(this, `${f}/${e}/icon`);
3110
3188
  }
3111
3189
  /**
3112
3190
  * Removes the icon from an item.
@@ -3114,7 +3192,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3114
3192
  * @returns The updated item with icon fields removed.
3115
3193
  */
3116
3194
  async removeItemIcon(e) {
3117
- return await c(this, a, u).call(this, "DELETE", `${f}/${e}/icon`);
3195
+ return await c(this, o, u).call(this, "DELETE", `${f}/${e}/icon`);
3118
3196
  }
3119
3197
  // ─── General Item Operations ─────────────────────────────────────
3120
3198
  /**
@@ -3124,7 +3202,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3124
3202
  * @returns The updated item.
3125
3203
  */
3126
3204
  async updateItem(e, t) {
3127
- return await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
3205
+ return await c(this, o, u).call(this, "PUT", `${f}/${e}`, {
3128
3206
  body: JSON.stringify(t),
3129
3207
  contentType: "application/json"
3130
3208
  });
@@ -3140,8 +3218,8 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3140
3218
  * @returns The created version.
3141
3219
  */
3142
3220
  async createVersion(e, t, s, i, r) {
3143
- const o = new FormData();
3144
- return o.append("file", t), o.append("versionTag", s), i && o.append("extraProps", JSON.stringify(i)), r && o.append("metadata", JSON.stringify(r)), await c(this, a, u).call(this, "POST", `${f}/${e}/version`, { body: o });
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 });
3145
3223
  }
3146
3224
  /**
3147
3225
  * Lists versions of an item. Pass `archived: true` to fetch only archived
@@ -3151,7 +3229,32 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3151
3229
  * @returns Array of versions, sorted by creation date descending.
3152
3230
  */
3153
3231
  async listVersions(e, t = {}) {
3154
- return await c(this, a, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/versions`, { query: t });
3232
+ return await c(this, o, u).call(this, "GET", `${f}/${encodeURIComponent(e)}/versions`, { query: t });
3233
+ }
3234
+ /**
3235
+ * Batch variant of {@link listVersions}. Lists the versions of many items in
3236
+ * one request, which is what a file panel needs to render a whole page.
3237
+ *
3238
+ * The returned versions are the full records, metadata included, so a list
3239
+ * that only needs version metadata does not need
3240
+ * {@link getFileVersionMetadataBatch} on top.
3241
+ *
3242
+ * Inputs longer than {@link STORAGE_BATCH_MAX} are split into several
3243
+ * requests automatically. An item the caller cannot read carries an `error`
3244
+ * instead of `versions`.
3245
+ *
3246
+ * @param itemIds - The items whose versions to list.
3247
+ * @param params - Optional `{ archived }` filter, applied to every item.
3248
+ */
3249
+ async listVersionsBatch(e, t = {}) {
3250
+ 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`, {
3252
+ body: JSON.stringify({
3253
+ itemIds: i,
3254
+ ...s !== void 0 && { archived: s }
3255
+ }),
3256
+ contentType: "application/json"
3257
+ })).results);
3155
3258
  }
3156
3259
  /**
3157
3260
  * Archives a version of an item. Archived versions remain available via
@@ -3163,7 +3266,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3163
3266
  * @returns The archived version.
3164
3267
  */
3165
3268
  async archiveVersion(e, t) {
3166
- return await c(this, a, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
3269
+ return await c(this, o, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
3167
3270
  }
3168
3271
  /**
3169
3272
  * Recovers a previously archived version, restoring it to the active list.
@@ -3172,7 +3275,7 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3172
3275
  * @returns The recovered version.
3173
3276
  */
3174
3277
  async recoverVersion(e, t) {
3175
- return await c(this, a, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
3278
+ return await c(this, o, u).call(this, "PUT", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
3176
3279
  }
3177
3280
  /**
3178
3281
  * Permanently deletes a version, including its file in object storage.
@@ -3181,55 +3284,55 @@ return main;`)(...h), d = (y == null ? void 0 : y.componentDefinition) ?? y;
3181
3284
  * @param versionTag - The version's tag (e.g. "v2").
3182
3285
  */
3183
3286
  async deleteVersion(e, t) {
3184
- return await c(this, a, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
3287
+ return await c(this, o, u).call(this, "DELETE", `${f}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
3185
3288
  }
3186
3289
  };
3187
- a = new WeakSet(), he = function(e) {
3290
+ o = new WeakSet(), ue = function(e) {
3188
3291
  return `${this.apiUrl}/${e}`;
3189
3292
  }, u = async function(e, t, s) {
3190
- const { body: i, query: r, contentType: o, retries: h, responseType: l } = s || {}, y = c(this, a, he).call(this, t), d = c(this, a, Fe).call(this, r), m = await this.resolveAccessToken(), k = {
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 = {
3191
3294
  ...d,
3192
3295
  ...this.useBearer ? {} : { accessToken: m }
3193
3296
  };
3194
3297
  try {
3195
- const A = await fetch(
3298
+ const S = await fetch(
3196
3299
  y + "?" + new URLSearchParams(k).toString(),
3197
3300
  {
3198
3301
  method: e,
3199
3302
  headers: {
3200
3303
  Accept: "application/json",
3201
- ...o && { "Content-Type": o },
3304
+ ...a && { "Content-Type": a },
3202
3305
  ...this.useBearer && { Authorization: `Bearer ${m}` }
3203
3306
  },
3204
3307
  ...i && { body: i }
3205
3308
  }
3206
3309
  );
3207
- if (!A.ok) {
3208
- const O = await A.text().then((Me) => Me).catch(() => "");
3209
- throw new Ut(
3210
- A.status,
3211
- A.statusText,
3212
- O
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
3213
3316
  );
3214
3317
  }
3215
- return l === "blob" ? await A.blob() : A.json().then((O) => O).catch(() => {
3318
+ return l === "blob" ? await S.blob() : S.json().then((A) => A).catch(() => {
3216
3319
  });
3217
- } catch (A) {
3218
- let O = h ?? this.retries;
3219
- if (O)
3220
- return O = O - 1, await c(this, a, u).call(this, e, t, {
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, {
3221
3324
  ...s,
3222
- retries: O
3325
+ retries: A
3223
3326
  });
3224
- throw A;
3327
+ throw S;
3225
3328
  }
3226
3329
  }, C = async function(e, t) {
3227
- const { query: s } = t || {}, i = c(this, a, he).call(this, e), r = await this.resolveAccessToken(), o = {
3330
+ const { query: s } = t || {}, i = c(this, o, ue).call(this, e), r = await this.resolveAccessToken(), a = {
3228
3331
  ...s,
3229
3332
  ...this.useBearer ? {} : { accessToken: r }
3230
3333
  };
3231
3334
  return await fetch(
3232
- i + "?" + new URLSearchParams(o).toString(),
3335
+ i + "?" + new URLSearchParams(a).toString(),
3233
3336
  {
3234
3337
  method: "GET",
3235
3338
  ...this.useBearer && {
@@ -3237,54 +3340,60 @@ a = new WeakSet(), he = function(e) {
3237
3340
  }
3238
3341
  }
3239
3342
  );
3240
- }, H = async function(e, t) {
3343
+ }, q = async function(e, t) {
3344
+ if (!e.length) return [];
3345
+ const s = [];
3346
+ for (let r = 0; r < e.length; r += Ae)
3347
+ s.push(e.slice(r, r + Ae));
3348
+ return (await Promise.all(s.map(t))).flat();
3349
+ }, G = async function(e, t) {
3241
3350
  const { versionTag: s, withDraft: i } = t || {};
3242
- return await c(this, a, C).call(this, `${f}/${e}/download`, {
3351
+ return await c(this, o, C).call(this, `${f}/${e}/download`, {
3243
3352
  query: {
3244
3353
  ...s && { versionTag: s },
3245
3354
  ...i && { withDraft: i }
3246
3355
  }
3247
3356
  });
3248
- }, G = async function(e, t, s) {
3249
- const { name: i, versionTag: r, parentFolderId: o, projectId: h, file: l, metadata: y } = e, d = new FormData();
3250
- return d.append("file", l), d.append("name", i), d.append("versionTag", r), 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, {
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, {
3251
3360
  body: d
3252
3361
  });
3253
- }, ue = async function(e, t, s) {
3254
- const { name: i, versionTag: r, parentFolderId: o, file: h, metadata: l } = t;
3362
+ }, le = async function(e, t, s) {
3363
+ const { name: i, versionTag: r, parentFolderId: a, file: h, metadata: l } = t;
3255
3364
  let y, d;
3256
3365
  if (h) {
3257
3366
  const m = new FormData();
3258
- 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, a, u).call(this, "POST", `${f}/${e}/version`, {
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`, {
3259
3368
  body: m
3260
3369
  });
3261
3370
  }
3262
- if (i || o) {
3371
+ if (i || a) {
3263
3372
  const m = {
3264
3373
  ...i && { name: i },
3265
- ...o && { folderId: o }
3374
+ ...a && { folderId: a }
3266
3375
  }, k = JSON.stringify(m);
3267
- y = await c(this, a, u).call(this, "PUT", `${f}/${e}`, {
3376
+ y = await c(this, o, u).call(this, "PUT", `${f}/${e}`, {
3268
3377
  body: k,
3269
3378
  contentType: "application/json"
3270
3379
  });
3271
3380
  }
3272
3381
  return { item: y, version: d };
3273
- }, le = async function(e, t) {
3382
+ }, fe = async function(e, t) {
3274
3383
  const { showVersions: s = !1 } = t || {};
3275
- return await c(this, a, u).call(this, "GET", `${f}/${e}`, {
3384
+ return await c(this, o, u).call(this, "GET", `${f}/${e}`, {
3276
3385
  query: { showVersions: s }
3277
3386
  });
3278
- }, Fe = function(e) {
3387
+ }, Ve = function(e) {
3279
3388
  return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
3280
3389
  (t, [s, i]) => (t[s] = i, t),
3281
3390
  {}
3282
3391
  );
3283
3392
  };
3284
- let ce = ge;
3393
+ let he = we;
3285
3394
  const B = "project", N = "notifications";
3286
3395
  var x;
3287
- const we = class we extends ce {
3396
+ const _e = class _e extends he {
3288
3397
  /**
3289
3398
  * @param token - A bearer JWT, OR a function returning the current JWT
3290
3399
  * (sync or async). When a function is passed, it's invoked before every
@@ -3295,11 +3404,11 @@ const we = class we extends ce {
3295
3404
  */
3296
3405
  constructor(t, s, i) {
3297
3406
  super(typeof t == "string" ? t : "", s, { ...i, useBearer: !0 });
3298
- W(this, x);
3299
- typeof t == "function" && be(this, x, t);
3407
+ X(this, x);
3408
+ typeof t == "function" && Te(this, x, t);
3300
3409
  }
3301
3410
  async resolveAccessToken() {
3302
- return K(this, x) ? await K(this, x).call(this) : super.resolveAccessToken();
3411
+ return W(this, x) ? await W(this, x).call(this) : super.resolveAccessToken();
3303
3412
  }
3304
3413
  /**
3305
3414
  * Creates a client from the platform context injected into
@@ -3308,7 +3417,7 @@ const we = class we extends ce {
3308
3417
  * carries a fresh JWT on every navigation.
3309
3418
  */
3310
3419
  static fromPlatformContext(t) {
3311
- const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, i = new we(s.accessToken, s.apiUrl, t);
3420
+ const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, i = new _e(s.accessToken, s.apiUrl, t);
3312
3421
  return i.context = s, i;
3313
3422
  }
3314
3423
  // ─── Projects (JWT-only backend routes) ──────────────────────────
@@ -3523,7 +3632,7 @@ const we = class we extends ce {
3523
3632
  * ```
3524
3633
  */
3525
3634
  async onNotification(t) {
3526
- const s = await this.resolveAccessToken(), i = q(
3635
+ const s = await this.resolveAccessToken(), i = U(
3527
3636
  `${this.socketOrigin}/notifications?accessToken=${encodeURIComponent(s)}`,
3528
3637
  { transports: ["websocket"] }
3529
3638
  );
@@ -3540,22 +3649,23 @@ const we = class we extends ce {
3540
3649
  }
3541
3650
  };
3542
3651
  x = new WeakMap();
3543
- let Oe = we;
3544
- const Vt = {
3652
+ let $e = _e;
3653
+ const Gt = {
3545
3654
  MAX_FIELDS: 200,
3546
3655
  MAX_KEY_LENGTH: 50,
3547
3656
  MAX_VALUE_LENGTH: 50
3548
- }, Ht = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Gt = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, jt = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Jt = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, Yt = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, Kt = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, Wt = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
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" };
3549
3658
  export {
3550
- Ht as CDEManager,
3551
- Gt as ClashesManager,
3552
- ce as EngineServicesClient,
3553
- jt as FileList,
3554
- Jt as GitHistoryManager,
3555
- Yt as HelloWorld,
3556
- Vt as METADATA_LIMITS,
3557
- Oe as PlatformClient,
3558
- Ut as RequestError,
3559
- Kt as TopicsManager,
3560
- Wt as UIManager
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
3561
3671
  };