@thatopen/services 0.24.0 → 0.25.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 Js = Object.defineProperty;
2
- var xe = (r) => {
1
+ var Ks = Object.defineProperty;
2
+ var Re = (r) => {
3
3
  throw TypeError(r);
4
4
  };
5
- var Ys = (r, t, e) => t in r ? Js(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
6
- var I = (r, t, e) => Ys(r, typeof t != "symbol" ? t + "" : t, e), jt = (r, t, e) => t.has(r) || xe("Cannot " + e);
7
- var u = (r, t, e) => (jt(r, t, "read from private field"), e ? e.call(r) : t.get(r)), b = (r, t, e) => t.has(r) ? xe("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), _ = (r, t, e, s) => (jt(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e), a = (r, t, e) => (jt(r, t, "access private method"), e);
5
+ var zs = (r, t, e) => t in r ? Ks(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
6
+ var I = (r, t, e) => zs(r, typeof t != "symbol" ? t + "" : t, e), Vt = (r, t, e) => t.has(r) || Re("Cannot " + e);
7
+ var u = (r, t, e) => (Vt(r, t, "read from private field"), e ? e.call(r) : t.get(r)), b = (r, t, e) => t.has(r) ? Re("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e), _ = (r, t, e, s) => (Vt(r, t, "write to private field"), s ? s.call(r, e) : t.set(r, e), e), a = (r, t, e) => (Vt(r, t, "access private method"), e);
8
8
  const F = /* @__PURE__ */ Object.create(null);
9
9
  F.open = "0";
10
10
  F.close = "1";
@@ -13,63 +13,63 @@ F.pong = "3";
13
13
  F.message = "4";
14
14
  F.upgrade = "5";
15
15
  F.noop = "6";
16
- const kt = /* @__PURE__ */ Object.create(null);
16
+ const xt = /* @__PURE__ */ Object.create(null);
17
17
  Object.keys(F).forEach((r) => {
18
- kt[F[r]] = r;
18
+ xt[F[r]] = r;
19
19
  });
20
- const Wt = { type: "error", data: "parser error" }, We = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Ke = typeof ArrayBuffer == "function", ze = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r && r.buffer instanceof ArrayBuffer, we = ({ type: r, data: t }, e, s) => We && t instanceof Blob ? e ? s(t) : Re(t, s) : Ke && (t instanceof ArrayBuffer || ze(t)) ? e ? s(t) : Re(new Blob([t]), s) : s(F[r] + (t || "")), Re = (r, t) => {
20
+ const zt = { type: "error", data: "parser error" }, ze = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Xe = typeof ArrayBuffer == "function", Qe = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r && r.buffer instanceof ArrayBuffer, be = ({ type: r, data: t }, e, s) => ze && t instanceof Blob ? e ? s(t) : $e(t, s) : Xe && (t instanceof ArrayBuffer || Qe(t)) ? e ? s(t) : $e(new Blob([t]), s) : s(F[r] + (t || "")), $e = (r, t) => {
21
21
  const e = new FileReader();
22
22
  return e.onload = function() {
23
23
  const s = e.result.split(",")[1];
24
24
  t("b" + (s || ""));
25
25
  }, e.readAsDataURL(r);
26
26
  };
27
- function $e(r) {
27
+ function Ne(r) {
28
28
  return r instanceof Uint8Array ? r : r instanceof ArrayBuffer ? new Uint8Array(r) : new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
29
29
  }
30
- let Mt;
31
- function Ws(r, t) {
32
- if (We && r.data instanceof Blob)
33
- return r.data.arrayBuffer().then($e).then(t);
34
- if (Ke && (r.data instanceof ArrayBuffer || ze(r.data)))
35
- return t($e(r.data));
36
- we(r, !1, (e) => {
37
- Mt || (Mt = new TextEncoder()), t(Mt.encode(e));
30
+ let Gt;
31
+ function Xs(r, t) {
32
+ if (ze && r.data instanceof Blob)
33
+ return r.data.arrayBuffer().then(Ne).then(t);
34
+ if (Xe && (r.data instanceof ArrayBuffer || Qe(r.data)))
35
+ return t(Ne(r.data));
36
+ be(r, !1, (e) => {
37
+ Gt || (Gt = new TextEncoder()), t(Gt.encode(e));
38
38
  });
39
39
  }
40
- const Ne = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", pt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
- for (let r = 0; r < Ne.length; r++)
42
- pt[Ne.charCodeAt(r)] = r;
43
- const Ks = (r) => {
44
- let t = r.length * 0.75, e = r.length, s, n = 0, i, o, c, d;
40
+ const Pe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", yt = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
+ for (let r = 0; r < Pe.length; r++)
42
+ yt[Pe.charCodeAt(r)] = r;
43
+ const Qs = (r) => {
44
+ let t = r.length * 0.75, e = r.length, s, n = 0, i, o, h, d;
45
45
  r[r.length - 1] === "=" && (t--, r[r.length - 2] === "=" && t--);
46
- const f = new ArrayBuffer(t), h = new Uint8Array(f);
46
+ const f = new ArrayBuffer(t), c = new Uint8Array(f);
47
47
  for (s = 0; s < e; s += 4)
48
- i = pt[r.charCodeAt(s)], o = pt[r.charCodeAt(s + 1)], c = pt[r.charCodeAt(s + 2)], d = pt[r.charCodeAt(s + 3)], h[n++] = i << 2 | o >> 4, h[n++] = (o & 15) << 4 | c >> 2, h[n++] = (c & 3) << 6 | d & 63;
48
+ i = yt[r.charCodeAt(s)], o = yt[r.charCodeAt(s + 1)], h = yt[r.charCodeAt(s + 2)], d = yt[r.charCodeAt(s + 3)], c[n++] = i << 2 | o >> 4, c[n++] = (o & 15) << 4 | h >> 2, c[n++] = (h & 3) << 6 | d & 63;
49
49
  return f;
50
- }, zs = typeof ArrayBuffer == "function", be = (r, t) => {
50
+ }, Zs = typeof ArrayBuffer == "function", _e = (r, t) => {
51
51
  if (typeof r != "string")
52
52
  return {
53
53
  type: "message",
54
- data: Xe(r, t)
54
+ data: Ze(r, t)
55
55
  };
56
56
  const e = r.charAt(0);
57
57
  return e === "b" ? {
58
58
  type: "message",
59
- data: Xs(r.substring(1), t)
60
- } : kt[e] ? r.length > 1 ? {
61
- type: kt[e],
59
+ data: tr(r.substring(1), t)
60
+ } : xt[e] ? r.length > 1 ? {
61
+ type: xt[e],
62
62
  data: r.substring(1)
63
63
  } : {
64
- type: kt[e]
65
- } : Wt;
66
- }, Xs = (r, t) => {
67
- if (zs) {
68
- const e = Ks(r);
69
- return Xe(e, t);
64
+ type: xt[e]
65
+ } : zt;
66
+ }, tr = (r, t) => {
67
+ if (Zs) {
68
+ const e = Qs(r);
69
+ return Ze(e, t);
70
70
  } else
71
71
  return { base64: !0, data: r };
72
- }, Xe = (r, t) => {
72
+ }, Ze = (r, t) => {
73
73
  switch (t) {
74
74
  case "blob":
75
75
  return r instanceof Blob ? r : new Blob([r]);
@@ -77,27 +77,27 @@ const Ks = (r) => {
77
77
  default:
78
78
  return r instanceof ArrayBuffer ? r : r.buffer;
79
79
  }
80
- }, Qe = "", Qs = (r, t) => {
80
+ }, ts = "", er = (r, t) => {
81
81
  const e = r.length, s = new Array(e);
82
82
  let n = 0;
83
83
  r.forEach((i, o) => {
84
- we(i, !1, (c) => {
85
- s[o] = c, ++n === e && t(s.join(Qe));
84
+ be(i, !1, (h) => {
85
+ s[o] = h, ++n === e && t(s.join(ts));
86
86
  });
87
87
  });
88
- }, Zs = (r, t) => {
89
- const e = r.split(Qe), s = [];
88
+ }, sr = (r, t) => {
89
+ const e = r.split(ts), s = [];
90
90
  for (let n = 0; n < e.length; n++) {
91
- const i = be(e[n], t);
91
+ const i = _e(e[n], t);
92
92
  if (s.push(i), i.type === "error")
93
93
  break;
94
94
  }
95
95
  return s;
96
96
  };
97
- function tr() {
97
+ function rr() {
98
98
  return new TransformStream({
99
99
  transform(r, t) {
100
- Ws(r, (e) => {
100
+ Xs(r, (e) => {
101
101
  const s = e.length;
102
102
  let n;
103
103
  if (s < 126)
@@ -116,7 +116,7 @@ function tr() {
116
116
  }
117
117
  });
118
118
  }
119
- let Vt;
119
+ let Ht;
120
120
  function It(r) {
121
121
  return r.reduce((t, e) => t + e.length, 0);
122
122
  }
@@ -129,12 +129,12 @@ function Ot(r, t) {
129
129
  e[n] = r[0][s++], s === r[0].length && (r.shift(), s = 0);
130
130
  return r.length && s < r[0].length && (r[0] = r[0].slice(s)), e;
131
131
  }
132
- function er(r, t) {
133
- Vt || (Vt = new TextDecoder());
132
+ function nr(r, t) {
133
+ Ht || (Ht = new TextDecoder());
134
134
  const e = [];
135
135
  let s = 0, n = -1, i = !1;
136
136
  return new TransformStream({
137
- transform(o, c) {
137
+ transform(o, h) {
138
138
  for (e.push(o); ; ) {
139
139
  if (s === 0) {
140
140
  if (It(e) < 1)
@@ -149,31 +149,31 @@ function er(r, t) {
149
149
  } else if (s === 2) {
150
150
  if (It(e) < 8)
151
151
  break;
152
- const d = Ot(e, 8), f = new DataView(d.buffer, d.byteOffset, d.length), h = f.getUint32(0);
153
- if (h > Math.pow(2, 21) - 1) {
154
- c.enqueue(Wt);
152
+ const d = Ot(e, 8), f = new DataView(d.buffer, d.byteOffset, d.length), c = f.getUint32(0);
153
+ if (c > Math.pow(2, 21) - 1) {
154
+ h.enqueue(zt);
155
155
  break;
156
156
  }
157
- n = h * Math.pow(2, 32) + f.getUint32(4), s = 3;
157
+ n = c * Math.pow(2, 32) + f.getUint32(4), s = 3;
158
158
  } else {
159
159
  if (It(e) < n)
160
160
  break;
161
161
  const d = Ot(e, n);
162
- c.enqueue(be(i ? d : Vt.decode(d), t)), s = 0;
162
+ h.enqueue(_e(i ? d : Ht.decode(d), t)), s = 0;
163
163
  }
164
164
  if (n === 0 || n > r) {
165
- c.enqueue(Wt);
165
+ h.enqueue(zt);
166
166
  break;
167
167
  }
168
168
  }
169
169
  }
170
170
  });
171
171
  }
172
- const Ze = 4;
172
+ const es = 4;
173
173
  function E(r) {
174
- if (r) return sr(r);
174
+ if (r) return ir(r);
175
175
  }
176
- function sr(r) {
176
+ function ir(r) {
177
177
  for (var t in E.prototype)
178
178
  r[t] = E.prototype[t];
179
179
  return r;
@@ -219,34 +219,34 @@ E.prototype.listeners = function(r) {
219
219
  E.prototype.hasListeners = function(r) {
220
220
  return !!this.listeners(r).length;
221
221
  };
222
- const Ft = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, e) => e(t, 0), R = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), rr = "arraybuffer";
223
- function ts(r, ...t) {
222
+ const Dt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (t) => Promise.resolve().then(t) : (t, e) => e(t, 0), R = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), or = "arraybuffer";
223
+ function ss(r, ...t) {
224
224
  return t.reduce((e, s) => (r.hasOwnProperty(s) && (e[s] = r[s]), e), {});
225
225
  }
226
- const nr = R.setTimeout, ir = R.clearTimeout;
227
- function qt(r, t) {
228
- t.useNativeTimers ? (r.setTimeoutFn = nr.bind(R), r.clearTimeoutFn = ir.bind(R)) : (r.setTimeoutFn = R.setTimeout.bind(R), r.clearTimeoutFn = R.clearTimeout.bind(R));
226
+ const ar = R.setTimeout, cr = R.clearTimeout;
227
+ function Ut(r, t) {
228
+ t.useNativeTimers ? (r.setTimeoutFn = ar.bind(R), r.clearTimeoutFn = cr.bind(R)) : (r.setTimeoutFn = R.setTimeout.bind(R), r.clearTimeoutFn = R.clearTimeout.bind(R));
229
229
  }
230
- const or = 1.33;
231
- function ar(r) {
232
- return typeof r == "string" ? cr(r) : Math.ceil((r.byteLength || r.size) * or);
230
+ const hr = 1.33;
231
+ function lr(r) {
232
+ return typeof r == "string" ? ur(r) : Math.ceil((r.byteLength || r.size) * hr);
233
233
  }
234
- function cr(r) {
234
+ function ur(r) {
235
235
  let t = 0, e = 0;
236
236
  for (let s = 0, n = r.length; s < n; s++)
237
237
  t = r.charCodeAt(s), t < 128 ? e += 1 : t < 2048 ? e += 2 : t < 55296 || t >= 57344 ? e += 3 : (s++, e += 4);
238
238
  return e;
239
239
  }
240
- function es() {
240
+ function rs() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
- function hr(r) {
243
+ function dr(r) {
244
244
  let t = "";
245
245
  for (let e in r)
246
246
  r.hasOwnProperty(e) && (t.length && (t += "&"), t += encodeURIComponent(e) + "=" + encodeURIComponent(r[e]));
247
247
  return t;
248
248
  }
249
- function lr(r) {
249
+ function fr(r) {
250
250
  let t = {}, e = r.split("&");
251
251
  for (let s = 0, n = e.length; s < n; s++) {
252
252
  let i = e[s].split("=");
@@ -254,12 +254,12 @@ function lr(r) {
254
254
  }
255
255
  return t;
256
256
  }
257
- class ur extends Error {
257
+ class pr extends Error {
258
258
  constructor(t, e, s) {
259
259
  super(t), this.description = e, this.context = s, this.type = "TransportError";
260
260
  }
261
261
  }
262
- class _e extends E {
262
+ class Ee extends E {
263
263
  /**
264
264
  * Transport abstract constructor.
265
265
  *
@@ -267,7 +267,7 @@ class _e extends E {
267
267
  * @protected
268
268
  */
269
269
  constructor(t) {
270
- super(), this.writable = !1, qt(this, t), this.opts = t, this.query = t.query, this.socket = t.socket, this.supportsBinary = !t.forceBase64;
270
+ super(), this.writable = !1, Ut(this, t), this.opts = t, this.query = t.query, this.socket = t.socket, this.supportsBinary = !t.forceBase64;
271
271
  }
272
272
  /**
273
273
  * Emits an error.
@@ -279,7 +279,7 @@ class _e extends E {
279
279
  * @protected
280
280
  */
281
281
  onError(t, e, s) {
282
- return super.emitReserved("error", new ur(t, e, s)), this;
282
+ return super.emitReserved("error", new pr(t, e, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -316,7 +316,7 @@ class _e extends E {
316
316
  * @protected
317
317
  */
318
318
  onData(t) {
319
- const e = be(t, this.socket.binaryType);
319
+ const e = _e(t, this.socket.binaryType);
320
320
  this.onPacket(e);
321
321
  }
322
322
  /**
@@ -353,11 +353,11 @@ class _e extends E {
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(t) {
356
- const e = hr(t);
356
+ const e = dr(t);
357
357
  return e.length ? "?" + e : "";
358
358
  }
359
359
  }
360
- class dr extends _e {
360
+ class yr extends Ee {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class dr extends _e {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- Zs(t, this.socket.binaryType).forEach(e), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ sr(t, this.socket.binaryType).forEach(e), 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 dr extends _e {
433
433
  * @protected
434
434
  */
435
435
  write(t) {
436
- this.writable = !1, Qs(t, (e) => {
436
+ this.writable = !1, er(t, (e) => {
437
437
  this.doWrite(e, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -446,18 +446,18 @@ class dr extends _e {
446
446
  */
447
447
  uri() {
448
448
  const t = this.opts.secure ? "https" : "http", e = this.query || {};
449
- return this.opts.timestampRequests !== !1 && (e[this.opts.timestampParam] = es()), !this.supportsBinary && !e.sid && (e.b64 = 1), this.createUri(t, e);
449
+ return this.opts.timestampRequests !== !1 && (e[this.opts.timestampParam] = rs()), !this.supportsBinary && !e.sid && (e.b64 = 1), this.createUri(t, e);
450
450
  }
451
451
  }
452
- let ss = !1;
452
+ let ns = !1;
453
453
  try {
454
- ss = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ ns = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const fr = ss;
458
- function pr() {
457
+ const mr = ns;
458
+ function gr() {
459
459
  }
460
- class yr extends dr {
460
+ class wr extends yr {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -507,7 +507,7 @@ class L extends E {
507
507
  * @package
508
508
  */
509
509
  constructor(t, e, s) {
510
- super(), this.createRequest = t, qt(this, s), this._opts = s, this._method = s.method || "GET", this._uri = e, this._data = s.data !== void 0 ? s.data : null, this._create();
510
+ super(), this.createRequest = t, Ut(this, s), this._opts = s, this._method = s.method || "GET", this._uri = e, 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 L extends E {
516
516
  */
517
517
  _create() {
518
518
  var t;
519
- const e = ts(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
519
+ const e = ss(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
520
520
  e.xdomain = !!this._opts.xd;
521
521
  const s = this._xhr = this.createRequest(e);
522
522
  try {
@@ -570,7 +570,7 @@ class L extends E {
570
570
  */
571
571
  _cleanup(t) {
572
572
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
573
- if (this._xhr.onreadystatechange = pr, t)
573
+ if (this._xhr.onreadystatechange = gr, t)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
@@ -600,36 +600,36 @@ L.requestsCount = 0;
600
600
  L.requests = {};
601
601
  if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
- attachEvent("onunload", Pe);
603
+ attachEvent("onunload", Be);
604
604
  else if (typeof addEventListener == "function") {
605
605
  const r = "onpagehide" in R ? "pagehide" : "unload";
606
- addEventListener(r, Pe, !1);
606
+ addEventListener(r, Be, !1);
607
607
  }
608
608
  }
609
- function Pe() {
609
+ function Be() {
610
610
  for (let r in L.requests)
611
611
  L.requests.hasOwnProperty(r) && L.requests[r].abort();
612
612
  }
613
- const mr = function() {
614
- const r = rs({
613
+ const br = function() {
614
+ const r = is({
615
615
  xdomain: !1
616
616
  });
617
617
  return r && r.responseType !== null;
618
618
  }();
619
- class gr extends yr {
619
+ class _r extends wr {
620
620
  constructor(t) {
621
621
  super(t);
622
622
  const e = t && t.forceBase64;
623
- this.supportsBinary = mr && !e;
623
+ this.supportsBinary = br && !e;
624
624
  }
625
625
  request(t = {}) {
626
- return Object.assign(t, { xd: this.xd }, this.opts), new L(rs, this.uri(), t);
626
+ return Object.assign(t, { xd: this.xd }, this.opts), new L(is, this.uri(), t);
627
627
  }
628
628
  }
629
- function rs(r) {
629
+ function is(r) {
630
630
  const t = r.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!t || fr))
632
+ if (typeof XMLHttpRequest < "u" && (!t || mr))
633
633
  return new XMLHttpRequest();
634
634
  } catch {
635
635
  }
@@ -639,13 +639,13 @@ function rs(r) {
639
639
  } catch {
640
640
  }
641
641
  }
642
- const ns = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class wr extends _e {
642
+ const os = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class Er extends Ee {
644
644
  get name() {
645
645
  return "websocket";
646
646
  }
647
647
  doOpen() {
648
- const t = this.uri(), e = this.opts.protocols, s = ns ? {} : ts(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
648
+ const t = this.uri(), e = this.opts.protocols, s = os ? {} : ss(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(t, e, s);
@@ -671,12 +671,12 @@ class wr extends _e {
671
671
  this.writable = !1;
672
672
  for (let e = 0; e < t.length; e++) {
673
673
  const s = t[e], n = e === t.length - 1;
674
- we(s, this.supportsBinary, (i) => {
674
+ be(s, this.supportsBinary, (i) => {
675
675
  try {
676
676
  this.doWrite(s, i);
677
677
  } catch {
678
678
  }
679
- n && Ft(() => {
679
+ n && Dt(() => {
680
680
  this.writable = !0, this.emitReserved("drain");
681
681
  }, this.setTimeoutFn);
682
682
  });
@@ -693,19 +693,19 @@ class wr extends _e {
693
693
  */
694
694
  uri() {
695
695
  const t = this.opts.secure ? "wss" : "ws", e = this.query || {};
696
- return this.opts.timestampRequests && (e[this.opts.timestampParam] = es()), this.supportsBinary || (e.b64 = 1), this.createUri(t, e);
696
+ return this.opts.timestampRequests && (e[this.opts.timestampParam] = rs()), this.supportsBinary || (e.b64 = 1), this.createUri(t, e);
697
697
  }
698
698
  }
699
- const Gt = R.WebSocket || R.MozWebSocket;
700
- class br extends wr {
699
+ const Jt = R.WebSocket || R.MozWebSocket;
700
+ class vr extends Er {
701
701
  createSocket(t, e, s) {
702
- return ns ? new Gt(t, e, s) : e ? new Gt(t, e) : new Gt(t);
702
+ return os ? new Jt(t, e, s) : e ? new Jt(t, e) : new Jt(t);
703
703
  }
704
704
  doWrite(t, e) {
705
705
  this.ws.send(e);
706
706
  }
707
707
  }
708
- class _r extends _e {
708
+ class Tr extends Ee {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,12 +721,12 @@ class _r extends _e {
721
721
  this.onError("webtransport error", t);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((t) => {
724
- const e = er(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = t.readable.pipeThrough(e).getReader(), n = tr();
724
+ const e = nr(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = t.readable.pipeThrough(e).getReader(), n = rr();
725
725
  n.readable.pipeTo(t.writable), this._writer = n.writable.getWriter();
726
726
  const i = () => {
727
- s.read().then(({ done: c, value: d }) => {
728
- c || (this.onPacket(d), i());
729
- }).catch((c) => {
727
+ s.read().then(({ done: h, value: d }) => {
728
+ h || (this.onPacket(d), i());
729
+ }).catch((h) => {
730
730
  });
731
731
  };
732
732
  i();
@@ -740,7 +740,7 @@ class _r extends _e {
740
740
  for (let e = 0; e < t.length; e++) {
741
741
  const s = t[e], n = e === t.length - 1;
742
742
  this._writer.write(s).then(() => {
743
- n && Ft(() => {
743
+ n && Dt(() => {
744
744
  this.writable = !0, this.emitReserved("drain");
745
745
  }, this.setTimeoutFn);
746
746
  });
@@ -751,11 +751,11 @@ class _r extends _e {
751
751
  (t = this._transport) === null || t === void 0 || t.close();
752
752
  }
753
753
  }
754
- const Er = {
755
- websocket: br,
756
- webtransport: _r,
757
- polling: gr
758
- }, vr = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Tr = [
754
+ const Sr = {
755
+ websocket: vr,
756
+ webtransport: Tr,
757
+ polling: _r
758
+ }, Ir = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Or = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -771,31 +771,31 @@ const Er = {
771
771
  "query",
772
772
  "anchor"
773
773
  ];
774
- function Kt(r) {
774
+ function Xt(r) {
775
775
  if (r.length > 8e3)
776
776
  throw "URI too long";
777
777
  const t = r, e = r.indexOf("["), s = r.indexOf("]");
778
778
  e != -1 && s != -1 && (r = r.substring(0, e) + r.substring(e, s).replace(/:/g, ";") + r.substring(s, r.length));
779
- let n = vr.exec(r || ""), i = {}, o = 14;
779
+ let n = Ir.exec(r || ""), i = {}, o = 14;
780
780
  for (; o--; )
781
- i[Tr[o]] = n[o] || "";
782
- return e != -1 && s != -1 && (i.source = t, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Sr(i, i.path), i.queryKey = Ir(i, i.query), i;
781
+ i[Or[o]] = n[o] || "";
782
+ return e != -1 && s != -1 && (i.source = t, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Ar(i, i.path), i.queryKey = kr(i, i.query), i;
783
783
  }
784
- function Sr(r, t) {
784
+ function Ar(r, t) {
785
785
  const e = /\/{2,9}/g, s = t.replace(e, "/").split("/");
786
786
  return (t.slice(0, 1) == "/" || t.length === 0) && s.splice(0, 1), t.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
787
787
  }
788
- function Ir(r, t) {
788
+ function kr(r, t) {
789
789
  const e = {};
790
790
  return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, n, i) {
791
791
  n && (e[n] = i);
792
792
  }), e;
793
793
  }
794
- const zt = typeof addEventListener == "function" && typeof removeEventListener == "function", Ct = [];
795
- zt && addEventListener("offline", () => {
794
+ const Qt = typeof addEventListener == "function" && typeof removeEventListener == "function", Ct = [];
795
+ Qt && addEventListener("offline", () => {
796
796
  Ct.forEach((r) => r());
797
797
  }, !1);
798
- class z extends E {
798
+ class X extends E {
799
799
  /**
800
800
  * Socket constructor.
801
801
  *
@@ -803,11 +803,11 @@ class z extends E {
803
803
  * @param {Object} opts - options
804
804
  */
805
805
  constructor(t, e) {
806
- if (super(), this.binaryType = rr, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (e = t, t = null), t) {
807
- const s = Kt(t);
806
+ if (super(), this.binaryType = or, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, t && typeof t == "object" && (e = t, t = null), t) {
807
+ const s = Xt(t);
808
808
  e.hostname = s.host, e.secure = s.protocol === "https" || s.protocol === "wss", e.port = s.port, s.query && (e.query = s.query);
809
- } else e.host && (e.hostname = Kt(e.host).host);
810
- qt(this, e), this.secure = e.secure != null ? e.secure : typeof location < "u" && location.protocol === "https:", e.hostname && !e.port && (e.port = this.secure ? "443" : "80"), this.hostname = e.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = e.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, e.transports.forEach((s) => {
809
+ } else e.host && (e.hostname = Xt(e.host).host);
810
+ Ut(this, e), this.secure = e.secure != null ? e.secure : typeof location < "u" && location.protocol === "https:", e.hostname && !e.port && (e.port = this.secure ? "443" : "80"), this.hostname = e.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = e.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, e.transports.forEach((s) => {
811
811
  const n = s.prototype.name;
812
812
  this.transports.push(n), this._transportsByName[n] = s;
813
813
  }), this.opts = Object.assign({
@@ -824,7 +824,7 @@ class z extends E {
824
824
  },
825
825
  transportOptions: {},
826
826
  closeOnBeforeunload: !1
827
- }, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = lr(this.opts.query)), zt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
827
+ }, e), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = fr(this.opts.query)), Qt && (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", {
@@ -841,7 +841,7 @@ class z extends E {
841
841
  */
842
842
  createTransport(t) {
843
843
  const e = Object.assign({}, this.opts.query);
844
- e.EIO = Ze, e.transport = t, this.id && (e.sid = this.id);
844
+ e.EIO = es, e.transport = t, this.id && (e.sid = this.id);
845
845
  const s = Object.assign({}, this.opts, {
846
846
  query: e,
847
847
  socket: this,
@@ -863,7 +863,7 @@ class z extends E {
863
863
  }, 0);
864
864
  return;
865
865
  }
866
- const t = this.opts.rememberUpgrade && z.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
866
+ const t = this.opts.rememberUpgrade && X.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
867
867
  this.readyState = "opening";
868
868
  const e = this.createTransport(t);
869
869
  e.open(), this.setTransport(e);
@@ -882,7 +882,7 @@ class z extends E {
882
882
  * @private
883
883
  */
884
884
  onOpen() {
885
- this.readyState = "open", z.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
885
+ this.readyState = "open", X.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
886
886
  }
887
887
  /**
888
888
  * Handles a packet.
@@ -959,7 +959,7 @@ class z extends E {
959
959
  let e = 1;
960
960
  for (let s = 0; s < this.writeBuffer.length; s++) {
961
961
  const n = this.writeBuffer[s].data;
962
- if (n && (e += ar(n)), s > 0 && e > this._maxPayload)
962
+ if (n && (e += lr(n)), s > 0 && e > this._maxPayload)
963
963
  return this.writeBuffer.slice(0, s);
964
964
  e += 2;
965
965
  }
@@ -979,7 +979,7 @@ class z extends E {
979
979
  if (!this._pingTimeoutTime)
980
980
  return !0;
981
981
  const t = Date.now() > this._pingTimeoutTime;
982
- return t && (this._pingTimeoutTime = 0, Ft(() => {
982
+ return t && (this._pingTimeoutTime = 0, Dt(() => {
983
983
  this._onClose("ping timeout");
984
984
  }, this.setTimeoutFn)), t;
985
985
  }
@@ -1046,7 +1046,7 @@ class z extends E {
1046
1046
  * @private
1047
1047
  */
1048
1048
  _onError(t) {
1049
- if (z.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1049
+ if (X.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1050
1050
  return this.transports.shift(), this._open();
1051
1051
  this.emitReserved("error", t), this._onClose("transport error", t);
1052
1052
  }
@@ -1057,7 +1057,7 @@ class z extends E {
1057
1057
  */
1058
1058
  _onClose(t, e) {
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(), zt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1060
+ if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), Qt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
1061
1061
  const s = Ct.indexOf(this._offlineEventListener);
1062
1062
  s !== -1 && Ct.splice(s, 1);
1063
1063
  }
@@ -1065,8 +1065,8 @@ class z extends E {
1065
1065
  }
1066
1066
  }
1067
1067
  }
1068
- z.protocol = Ze;
1069
- class Or extends z {
1068
+ X.protocol = es;
1069
+ class xr extends X {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -1083,30 +1083,30 @@ class Or extends z {
1083
1083
  */
1084
1084
  _probe(t) {
1085
1085
  let e = this.createTransport(t), s = !1;
1086
- z.priorWebsocketSuccess = !1;
1086
+ X.priorWebsocketSuccess = !1;
1087
1087
  const n = () => {
1088
1088
  s || (e.send([{ type: "ping", data: "probe" }]), e.once("packet", (g) => {
1089
1089
  if (!s)
1090
1090
  if (g.type === "pong" && g.data === "probe") {
1091
1091
  if (this.upgrading = !0, this.emitReserved("upgrading", e), !e)
1092
1092
  return;
1093
- z.priorWebsocketSuccess = e.name === "websocket", this.transport.pause(() => {
1094
- s || this.readyState !== "closed" && (h(), this.setTransport(e), e.send([{ type: "upgrade" }]), this.emitReserved("upgrade", e), e = null, this.upgrading = !1, this.flush());
1093
+ X.priorWebsocketSuccess = e.name === "websocket", this.transport.pause(() => {
1094
+ s || this.readyState !== "closed" && (c(), this.setTransport(e), e.send([{ type: "upgrade" }]), this.emitReserved("upgrade", e), e = null, this.upgrading = !1, this.flush());
1095
1095
  });
1096
1096
  } else {
1097
- const S = new Error("probe error");
1098
- S.transport = e.name, this.emitReserved("upgradeError", S);
1097
+ const v = new Error("probe error");
1098
+ v.transport = e.name, this.emitReserved("upgradeError", v);
1099
1099
  }
1100
1100
  }));
1101
1101
  };
1102
1102
  function i() {
1103
- s || (s = !0, h(), e.close(), e = null);
1103
+ s || (s = !0, c(), e.close(), e = null);
1104
1104
  }
1105
1105
  const o = (g) => {
1106
- const S = new Error("probe error: " + g);
1107
- S.transport = e.name, i(), this.emitReserved("upgradeError", S);
1106
+ const v = new Error("probe error: " + g);
1107
+ v.transport = e.name, i(), this.emitReserved("upgradeError", v);
1108
1108
  };
1109
- function c() {
1109
+ function h() {
1110
1110
  o("transport closed");
1111
1111
  }
1112
1112
  function d() {
@@ -1115,10 +1115,10 @@ class Or extends z {
1115
1115
  function f(g) {
1116
1116
  e && g.name !== e.name && i();
1117
1117
  }
1118
- const h = () => {
1119
- e.removeListener("open", n), e.removeListener("error", o), e.removeListener("close", c), this.off("close", d), this.off("upgrading", f);
1118
+ const c = () => {
1119
+ e.removeListener("open", n), e.removeListener("error", o), e.removeListener("close", h), this.off("close", d), this.off("upgrading", f);
1120
1120
  };
1121
- e.once("open", n), e.once("error", o), e.once("close", c), this.once("close", d), this.once("upgrading", f), this._upgrades.indexOf("webtransport") !== -1 && t !== "webtransport" ? this.setTimeoutFn(() => {
1121
+ e.once("open", n), e.once("error", o), e.once("close", h), this.once("close", d), this.once("upgrading", f), this._upgrades.indexOf("webtransport") !== -1 && t !== "webtransport" ? this.setTimeoutFn(() => {
1122
1122
  s || e.open();
1123
1123
  }, 200) : e.open();
1124
1124
  }
@@ -1138,67 +1138,67 @@ class Or extends z {
1138
1138
  return e;
1139
1139
  }
1140
1140
  }
1141
- let Ar = class extends Or {
1141
+ let Cr = class extends xr {
1142
1142
  constructor(t, e = {}) {
1143
1143
  const s = typeof t == "object", n = s ? { ...t } : { ...e };
1144
- (!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((i) => Er[i]).filter((i) => !!i)), super(s ? n : t, n);
1144
+ (!n.transports || n.transports && typeof n.transports[0] == "string") && (n.transports = (n.transports || ["polling", "websocket", "webtransport"]).map((i) => Sr[i]).filter((i) => !!i)), super(s ? n : t, n);
1145
1145
  }
1146
1146
  };
1147
- function kr(r, t = "", e) {
1147
+ function Rr(r, t = "", e) {
1148
1148
  let s = r;
1149
- e = e || typeof location < "u" && location, r == null && (r = e.protocol + "//" + e.host), typeof r == "string" && (r.charAt(0) === "/" && (r.charAt(1) === "/" ? r = e.protocol + r : r = e.host + r), /^(https?|wss?):\/\//.test(r) || (typeof e < "u" ? r = e.protocol + "//" + r : r = "https://" + r), s = Kt(r)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
1149
+ e = e || typeof location < "u" && location, r == null && (r = e.protocol + "//" + e.host), typeof r == "string" && (r.charAt(0) === "/" && (r.charAt(1) === "/" ? r = e.protocol + r : r = e.host + r), /^(https?|wss?):\/\//.test(r) || (typeof e < "u" ? r = e.protocol + "//" + r : r = "https://" + r), s = Xt(r)), 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 i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
1151
  return s.id = s.protocol + "://" + i + ":" + s.port + t, s.href = s.protocol + "://" + i + (e && e.port === s.port ? "" : ":" + s.port), s;
1152
1152
  }
1153
- const Cr = typeof ArrayBuffer == "function", xr = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r.buffer instanceof ArrayBuffer, is = Object.prototype.toString, Rr = typeof Blob == "function" || typeof Blob < "u" && is.call(Blob) === "[object BlobConstructor]", $r = typeof File == "function" || typeof File < "u" && is.call(File) === "[object FileConstructor]";
1154
- function Ee(r) {
1155
- return Cr && (r instanceof ArrayBuffer || xr(r)) || Rr && r instanceof Blob || $r && r instanceof File;
1153
+ const $r = typeof ArrayBuffer == "function", Nr = (r) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(r) : r.buffer instanceof ArrayBuffer, as = Object.prototype.toString, Pr = typeof Blob == "function" || typeof Blob < "u" && as.call(Blob) === "[object BlobConstructor]", Br = typeof File == "function" || typeof File < "u" && as.call(File) === "[object FileConstructor]";
1154
+ function ve(r) {
1155
+ return $r && (r instanceof ArrayBuffer || Nr(r)) || Pr && r instanceof Blob || Br && r instanceof File;
1156
1156
  }
1157
- function xt(r, t) {
1157
+ function Rt(r, t) {
1158
1158
  if (!r || typeof r != "object")
1159
1159
  return !1;
1160
1160
  if (Array.isArray(r)) {
1161
1161
  for (let e = 0, s = r.length; e < s; e++)
1162
- if (xt(r[e]))
1162
+ if (Rt(r[e]))
1163
1163
  return !0;
1164
1164
  return !1;
1165
1165
  }
1166
- if (Ee(r))
1166
+ if (ve(r))
1167
1167
  return !0;
1168
1168
  if (r.toJSON && typeof r.toJSON == "function" && arguments.length === 1)
1169
- return xt(r.toJSON(), !0);
1169
+ return Rt(r.toJSON(), !0);
1170
1170
  for (const e in r)
1171
- if (Object.prototype.hasOwnProperty.call(r, e) && xt(r[e]))
1171
+ if (Object.prototype.hasOwnProperty.call(r, e) && Rt(r[e]))
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
1175
- function Nr(r) {
1175
+ function Lr(r) {
1176
1176
  const t = [], e = r.data, s = r;
1177
- return s.data = Xt(e, t), s.attachments = t.length, { packet: s, buffers: t };
1177
+ return s.data = Zt(e, t), s.attachments = t.length, { packet: s, buffers: t };
1178
1178
  }
1179
- function Xt(r, t) {
1179
+ function Zt(r, t) {
1180
1180
  if (!r)
1181
1181
  return r;
1182
- if (Ee(r)) {
1182
+ if (ve(r)) {
1183
1183
  const e = { _placeholder: !0, num: t.length };
1184
1184
  return t.push(r), e;
1185
1185
  } else if (Array.isArray(r)) {
1186
1186
  const e = new Array(r.length);
1187
1187
  for (let s = 0; s < r.length; s++)
1188
- e[s] = Xt(r[s], t);
1188
+ e[s] = Zt(r[s], t);
1189
1189
  return e;
1190
1190
  } else if (typeof r == "object" && !(r instanceof Date)) {
1191
1191
  const e = {};
1192
1192
  for (const s in r)
1193
- Object.prototype.hasOwnProperty.call(r, s) && (e[s] = Xt(r[s], t));
1193
+ Object.prototype.hasOwnProperty.call(r, s) && (e[s] = Zt(r[s], t));
1194
1194
  return e;
1195
1195
  }
1196
1196
  return r;
1197
1197
  }
1198
- function Pr(r, t) {
1199
- return r.data = Qt(r.data, t), delete r.attachments, r;
1198
+ function Fr(r, t) {
1199
+ return r.data = te(r.data, t), delete r.attachments, r;
1200
1200
  }
1201
- function Qt(r, t) {
1201
+ function te(r, t) {
1202
1202
  if (!r)
1203
1203
  return r;
1204
1204
  if (r && r._placeholder === !0) {
@@ -1207,13 +1207,13 @@ function Qt(r, t) {
1207
1207
  throw new Error("illegal attachments");
1208
1208
  } else if (Array.isArray(r))
1209
1209
  for (let e = 0; e < r.length; e++)
1210
- r[e] = Qt(r[e], t);
1210
+ r[e] = te(r[e], t);
1211
1211
  else if (typeof r == "object")
1212
1212
  for (const e in r)
1213
- Object.prototype.hasOwnProperty.call(r, e) && (r[e] = Qt(r[e], t));
1213
+ Object.prototype.hasOwnProperty.call(r, e) && (r[e] = te(r[e], t));
1214
1214
  return r;
1215
1215
  }
1216
- const Br = [
1216
+ const qr = [
1217
1217
  "connect",
1218
1218
  // used on the client side
1219
1219
  "connect_error",
@@ -1231,7 +1231,7 @@ var w;
1231
1231
  (function(r) {
1232
1232
  r[r.CONNECT = 0] = "CONNECT", r[r.DISCONNECT = 1] = "DISCONNECT", r[r.EVENT = 2] = "EVENT", r[r.ACK = 3] = "ACK", r[r.CONNECT_ERROR = 4] = "CONNECT_ERROR", r[r.BINARY_EVENT = 5] = "BINARY_EVENT", r[r.BINARY_ACK = 6] = "BINARY_ACK";
1233
1233
  })(w || (w = {}));
1234
- class Lr {
1234
+ class Dr {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1247,7 +1247,7 @@ class Lr {
1247
1247
  * @param {Object} obj - packet object
1248
1248
  */
1249
1249
  encode(t) {
1250
- return (t.type === w.EVENT || t.type === w.ACK) && xt(t) ? this.encodeAsBinary({
1250
+ return (t.type === w.EVENT || t.type === w.ACK) && Rt(t) ? this.encodeAsBinary({
1251
1251
  type: t.type === w.EVENT ? w.BINARY_EVENT : w.BINARY_ACK,
1252
1252
  nsp: t.nsp,
1253
1253
  data: t.data,
@@ -1267,11 +1267,11 @@ class Lr {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(t) {
1270
- const e = Nr(t), s = this.encodeAsString(e.packet), n = e.buffers;
1270
+ const e = Lr(t), s = this.encodeAsString(e.packet), n = e.buffers;
1271
1271
  return n.unshift(s), n;
1272
1272
  }
1273
1273
  }
1274
- class ve extends E {
1274
+ class Te extends E {
1275
1275
  /**
1276
1276
  * Decoder constructor
1277
1277
  */
@@ -1293,8 +1293,8 @@ class ve extends E {
1293
1293
  throw new Error("got plaintext data when reconstructing a packet");
1294
1294
  e = this.decodeString(t);
1295
1295
  const s = e.type === w.BINARY_EVENT;
1296
- s || e.type === w.BINARY_ACK ? (e.type = s ? w.EVENT : w.ACK, this.reconstructor = new Fr(e), e.attachments === 0 && super.emitReserved("decoded", e)) : super.emitReserved("decoded", e);
1297
- } else if (Ee(t) || t.base64)
1296
+ s || e.type === w.BINARY_ACK ? (e.type = s ? w.EVENT : w.ACK, this.reconstructor = new Ur(e), e.attachments === 0 && super.emitReserved("decoded", e)) : super.emitReserved("decoded", e);
1297
+ } else if (ve(t) || t.base64)
1298
1298
  if (this.reconstructor)
1299
1299
  e = this.reconstructor.takeBinaryData(t), e && (this.reconstructor = null, super.emitReserved("decoded", e));
1300
1300
  else
@@ -1322,12 +1322,12 @@ class ve extends E {
1322
1322
  const o = t.substring(i, e);
1323
1323
  if (o != Number(o) || t.charAt(e) !== "-")
1324
1324
  throw new Error("Illegal attachments");
1325
- const c = Number(o);
1326
- if (!qr(c) || c < 0)
1325
+ const h = Number(o);
1326
+ if (!jr(h) || h < 0)
1327
1327
  throw new Error("Illegal attachments");
1328
- if (c > this.opts.maxAttachments)
1328
+ if (h > this.opts.maxAttachments)
1329
1329
  throw new Error("too many attachments");
1330
- s.attachments = c;
1330
+ s.attachments = h;
1331
1331
  }
1332
1332
  if (t.charAt(e + 1) === "/") {
1333
1333
  const i = e + 1;
@@ -1352,7 +1352,7 @@ class ve extends E {
1352
1352
  }
1353
1353
  if (t.charAt(++e)) {
1354
1354
  const i = this.tryParse(t.substr(e));
1355
- if (ve.isPayloadValid(s.type, i))
1355
+ if (Te.isPayloadValid(s.type, i))
1356
1356
  s.data = i;
1357
1357
  else
1358
1358
  throw new Error("invalid payload");
@@ -1369,14 +1369,14 @@ class ve extends E {
1369
1369
  static isPayloadValid(t, e) {
1370
1370
  switch (t) {
1371
1371
  case w.CONNECT:
1372
- return Be(e);
1372
+ return Le(e);
1373
1373
  case w.DISCONNECT:
1374
1374
  return e === void 0;
1375
1375
  case w.CONNECT_ERROR:
1376
- return typeof e == "string" || Be(e);
1376
+ return typeof e == "string" || Le(e);
1377
1377
  case w.EVENT:
1378
1378
  case w.BINARY_EVENT:
1379
- return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" && Br.indexOf(e[0]) === -1);
1379
+ return Array.isArray(e) && (typeof e[0] == "number" || typeof e[0] == "string" && qr.indexOf(e[0]) === -1);
1380
1380
  case w.ACK:
1381
1381
  case w.BINARY_ACK:
1382
1382
  return Array.isArray(e);
@@ -1389,7 +1389,7 @@ class ve extends E {
1389
1389
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1390
1390
  }
1391
1391
  }
1392
- class Fr {
1392
+ class Ur {
1393
1393
  constructor(t) {
1394
1394
  this.packet = t, this.buffers = [], this.reconPack = t;
1395
1395
  }
@@ -1403,7 +1403,7 @@ class Fr {
1403
1403
  */
1404
1404
  takeBinaryData(t) {
1405
1405
  if (this.buffers.push(t), this.buffers.length === this.reconPack.attachments) {
1406
- const e = Pr(this.reconPack, this.buffers);
1406
+ const e = Fr(this.reconPack, this.buffers);
1407
1407
  return this.finishedReconstruction(), e;
1408
1408
  }
1409
1409
  return null;
@@ -1415,16 +1415,16 @@ class Fr {
1415
1415
  this.reconPack = null, this.buffers = [];
1416
1416
  }
1417
1417
  }
1418
- const qr = Number.isInteger || function(r) {
1418
+ const jr = Number.isInteger || function(r) {
1419
1419
  return typeof r == "number" && isFinite(r) && Math.floor(r) === r;
1420
1420
  };
1421
- function Be(r) {
1421
+ function Le(r) {
1422
1422
  return Object.prototype.toString.call(r) === "[object Object]";
1423
1423
  }
1424
- const Dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const Mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1425
1425
  __proto__: null,
1426
- Decoder: ve,
1427
- Encoder: Lr,
1426
+ Decoder: Te,
1427
+ Encoder: Dr,
1428
1428
  get PacketType() {
1429
1429
  return w;
1430
1430
  }
@@ -1434,7 +1434,7 @@ function N(r, t, e) {
1434
1434
  r.off(t, e);
1435
1435
  };
1436
1436
  }
1437
- const Ur = Object.freeze({
1437
+ const Vr = Object.freeze({
1438
1438
  connect: 1,
1439
1439
  connect_error: 1,
1440
1440
  disconnect: 1,
@@ -1443,7 +1443,7 @@ const Ur = Object.freeze({
1443
1443
  newListener: 1,
1444
1444
  removeListener: 1
1445
1445
  });
1446
- class os extends E {
1446
+ class cs extends E {
1447
1447
  /**
1448
1448
  * `Socket` constructor.
1449
1449
  */
@@ -1559,7 +1559,7 @@ class os extends E {
1559
1559
  */
1560
1560
  emit(t, ...e) {
1561
1561
  var s, n, i;
1562
- if (Ur.hasOwnProperty(t))
1562
+ if (Vr.hasOwnProperty(t))
1563
1563
  throw new Error('"' + t.toString() + '" is a reserved event name');
1564
1564
  if (e.unshift(t), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
1565
1565
  return this._addToQueue(e), this;
@@ -1568,11 +1568,11 @@ class os extends E {
1568
1568
  data: e
1569
1569
  };
1570
1570
  if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof e[e.length - 1] == "function") {
1571
- const h = this.ids++, g = e.pop();
1572
- this._registerAckCallback(h, g), o.id = h;
1571
+ const c = this.ids++, g = e.pop();
1572
+ this._registerAckCallback(c, g), o.id = c;
1573
1573
  }
1574
- const c = (n = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || n === void 0 ? void 0 : n.writable, d = this.connected && !(!((i = this.io.engine) === null || i === void 0) && i._hasPingExpired());
1575
- return this.flags.volatile && !c || (d ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1574
+ const h = (n = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || n === void 0 ? void 0 : n.writable, d = this.connected && !(!((i = this.io.engine) === null || i === void 0) && i._hasPingExpired());
1575
+ return this.flags.volatile && !h || (d ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
1576
1576
  }
1577
1577
  /**
1578
1578
  * @private
@@ -1586,11 +1586,11 @@ class os extends E {
1586
1586
  }
1587
1587
  const i = this.io.setTimeoutFn(() => {
1588
1588
  delete this.acks[t];
1589
- for (let c = 0; c < this.sendBuffer.length; c++)
1590
- this.sendBuffer[c].id === t && this.sendBuffer.splice(c, 1);
1589
+ for (let h = 0; h < this.sendBuffer.length; h++)
1590
+ this.sendBuffer[h].id === t && this.sendBuffer.splice(h, 1);
1591
1591
  e.call(this, new Error("operation has timed out"));
1592
- }, n), o = (...c) => {
1593
- this.io.clearTimeoutFn(i), e.apply(this, c);
1592
+ }, n), o = (...h) => {
1593
+ this.io.clearTimeoutFn(i), e.apply(this, h);
1594
1594
  };
1595
1595
  o.withError = !0, this.acks[t] = o;
1596
1596
  }
@@ -1612,7 +1612,7 @@ class os extends E {
1612
1612
  */
1613
1613
  emitWithAck(t, ...e) {
1614
1614
  return new Promise((s, n) => {
1615
- const i = (o, c) => o ? n(o) : s(c);
1615
+ const i = (o, h) => o ? n(o) : s(h);
1616
1616
  i.withError = !0, e.push(i), this.emit(t, ...e);
1617
1617
  });
1618
1618
  }
@@ -2035,10 +2035,10 @@ class os extends E {
2035
2035
  }
2036
2036
  }
2037
2037
  }
2038
- function ut(r) {
2038
+ function ft(r) {
2039
2039
  r = r || {}, this.ms = r.min || 100, this.max = r.max || 1e4, this.factor = r.factor || 2, this.jitter = r.jitter > 0 && r.jitter <= 1 ? r.jitter : 0, this.attempts = 0;
2040
2040
  }
2041
- ut.prototype.duration = function() {
2041
+ ft.prototype.duration = function() {
2042
2042
  var r = this.ms * Math.pow(this.factor, this.attempts++);
2043
2043
  if (this.jitter) {
2044
2044
  var t = Math.random(), e = Math.floor(t * this.jitter * r);
@@ -2046,27 +2046,27 @@ ut.prototype.duration = function() {
2046
2046
  }
2047
2047
  return Math.min(r, this.max) | 0;
2048
2048
  };
2049
- ut.prototype.reset = function() {
2049
+ ft.prototype.reset = function() {
2050
2050
  this.attempts = 0;
2051
2051
  };
2052
- ut.prototype.setMin = function(r) {
2052
+ ft.prototype.setMin = function(r) {
2053
2053
  this.ms = r;
2054
2054
  };
2055
- ut.prototype.setMax = function(r) {
2055
+ ft.prototype.setMax = function(r) {
2056
2056
  this.max = r;
2057
2057
  };
2058
- ut.prototype.setJitter = function(r) {
2058
+ ft.prototype.setJitter = function(r) {
2059
2059
  this.jitter = r;
2060
2060
  };
2061
- class Zt extends E {
2061
+ class ee extends E {
2062
2062
  constructor(t, e) {
2063
2063
  var s;
2064
- super(), this.nsps = {}, this.subs = [], t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.opts = e, qt(this, e), this.reconnection(e.reconnection !== !1), this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0), this.reconnectionDelay(e.reconnectionDelay || 1e3), this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3), this.randomizationFactor((s = e.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new ut({
2064
+ super(), this.nsps = {}, this.subs = [], t && typeof t == "object" && (e = t, t = void 0), e = e || {}, e.path = e.path || "/socket.io", this.opts = e, Ut(this, e), this.reconnection(e.reconnection !== !1), this.reconnectionAttempts(e.reconnectionAttempts || 1 / 0), this.reconnectionDelay(e.reconnectionDelay || 1e3), this.reconnectionDelayMax(e.reconnectionDelayMax || 5e3), this.randomizationFactor((s = e.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new ft({
2065
2065
  min: this.reconnectionDelay(),
2066
2066
  max: this.reconnectionDelayMax(),
2067
2067
  jitter: this.randomizationFactor()
2068
2068
  }), this.timeout(e.timeout == null ? 2e4 : e.timeout), this._readyState = "closed", this.uri = t;
2069
- const n = e.parser || Dr;
2069
+ const n = e.parser || Mr;
2070
2070
  this.encoder = new n.Encoder(), this.decoder = new n.Decoder(), this._autoConnect = e.autoConnect !== !1, this._autoConnect && this.open();
2071
2071
  }
2072
2072
  reconnection(t) {
@@ -2109,18 +2109,18 @@ class Zt extends E {
2109
2109
  open(t) {
2110
2110
  if (~this._readyState.indexOf("open"))
2111
2111
  return this;
2112
- this.engine = new Ar(this.uri, this.opts);
2112
+ this.engine = new Cr(this.uri, this.opts);
2113
2113
  const e = this.engine, s = this;
2114
2114
  this._readyState = "opening", this.skipReconnect = !1;
2115
2115
  const n = N(e, "open", function() {
2116
2116
  s.onopen(), t && t();
2117
- }), i = (c) => {
2118
- this.cleanup(), this._readyState = "closed", this.emitReserved("error", c), t ? t(c) : this.maybeReconnectOnOpen();
2117
+ }), i = (h) => {
2118
+ this.cleanup(), this._readyState = "closed", this.emitReserved("error", h), t ? t(h) : this.maybeReconnectOnOpen();
2119
2119
  }, o = N(e, "error", i);
2120
2120
  if (this._timeout !== !1) {
2121
- const c = this._timeout, d = this.setTimeoutFn(() => {
2121
+ const h = this._timeout, d = this.setTimeoutFn(() => {
2122
2122
  n(), i(new Error("timeout")), e.close();
2123
- }, c);
2123
+ }, h);
2124
2124
  this.opts.autoUnref && d.unref(), this.subs.push(() => {
2125
2125
  this.clearTimeoutFn(d);
2126
2126
  });
@@ -2179,7 +2179,7 @@ class Zt extends E {
2179
2179
  * @private
2180
2180
  */
2181
2181
  ondecoded(t) {
2182
- Ft(() => {
2182
+ Dt(() => {
2183
2183
  this.emitReserved("packet", t);
2184
2184
  }, this.setTimeoutFn);
2185
2185
  }
@@ -2199,7 +2199,7 @@ class Zt extends E {
2199
2199
  */
2200
2200
  socket(t, e) {
2201
2201
  let s = this.nsps[t];
2202
- return s ? this._autoConnect && !s.active && s.connect() : (s = new os(this, t, e), this.nsps[t] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new cs(this, t, e), this.nsps[t] = s), s;
2203
2203
  }
2204
2204
  /**
2205
2205
  * Called upon a socket close.
@@ -2296,35 +2296,98 @@ class Zt extends E {
2296
2296
  this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", t);
2297
2297
  }
2298
2298
  }
2299
- const ft = {};
2300
- function wt(r, t) {
2299
+ const pt = {};
2300
+ function bt(r, t) {
2301
2301
  typeof r == "object" && (t = r, r = void 0), t = t || {};
2302
- const e = kr(r, t.path || "/socket.io"), s = e.source, n = e.id, i = e.path, o = ft[n] && i in ft[n].nsps, c = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
2302
+ const e = Rr(r, t.path || "/socket.io"), s = e.source, n = e.id, i = e.path, o = pt[n] && i in pt[n].nsps, h = t.forceNew || t["force new connection"] || t.multiplex === !1 || o;
2303
2303
  let d;
2304
- return c ? d = new Zt(s, t) : (ft[n] || (ft[n] = new Zt(s, t)), d = ft[n]), e.query && !t.query && (t.query = e.queryKey), d.socket(e.path, t);
2304
+ return h ? d = new ee(s, t) : (pt[n] || (pt[n] = new ee(s, t)), d = pt[n]), e.query && !t.query && (t.query = e.queryKey), d.socket(e.path, t);
2305
2305
  }
2306
- Object.assign(wt, {
2307
- Manager: Zt,
2308
- Socket: os,
2309
- io: wt,
2310
- connect: wt
2306
+ Object.assign(bt, {
2307
+ Manager: ee,
2308
+ Socket: cs,
2309
+ io: bt,
2310
+ connect: bt
2311
2311
  });
2312
- const te = "thatopen/document@1", Le = "document.json", Fe = () => `v-${Date.now()}`;
2313
- function jr(r) {
2312
+ const qt = "thatopen/document@1", Fe = "document.json", Gr = [
2313
+ "pdf",
2314
+ "txt",
2315
+ "md",
2316
+ "json",
2317
+ "csv",
2318
+ "tsv",
2319
+ "frag"
2320
+ ], qe = () => `v-${Date.now()}`;
2321
+ function At(r) {
2314
2322
  return String(r._id ?? r.id ?? "");
2315
2323
  }
2316
- var bt, ee;
2317
- class as {
2324
+ var tt, ls, se;
2325
+ class hs {
2318
2326
  constructor(t, e) {
2319
- b(this, bt);
2327
+ b(this, tt);
2320
2328
  this.client = t, this.projectId = e;
2321
2329
  }
2330
+ /**
2331
+ * Every document of the project: the folders that carry a descriptor.
2332
+ * Plain folders and loose files simply do not appear. One folder listing
2333
+ * for the project plus one file listing and one descriptor download per
2334
+ * folder, fetched in parallel — the storage offers nothing cheaper yet.
2335
+ */
2336
+ async list() {
2337
+ const t = await this.client.listFolders({
2338
+ projectId: this.projectId
2339
+ });
2340
+ return (await Promise.all(
2341
+ t.map(async (s) => {
2342
+ const n = At(s), i = await this.descriptor(n);
2343
+ return i ? { folderId: n, descriptor: i } : null;
2344
+ })
2345
+ )).filter((s) => s !== null);
2346
+ }
2347
+ /**
2348
+ * Converts a loose file into a document: creates the document folder next
2349
+ * to the file, moves the file inside (moving preserves its id), and writes
2350
+ * the descriptor with the file as `native` — and as `views[0]` too when its
2351
+ * format views itself ({@link SELF_VIEWING_FORMATS}; override per call with
2352
+ * `selfView`).
2353
+ *
2354
+ * A file that carries a processed derivative (the old `derivedFileId` link
2355
+ * in its version metadata — an IFC's frag, a LAS's potree) brings it along:
2356
+ * the derivative moves into the same folder and becomes a view, so the
2357
+ * document is born ready to visualize and the link concept retires.
2358
+ */
2359
+ async fromFile(t, e) {
2360
+ const s = await this.client.getFile(t), n = String(s.name ?? ""), i = De(n, s.fileExtension), o = (e == null ? void 0 : e.name) ?? n.replace(/\.[^.]+$/, "") ?? n, h = await this.client.createFolder(
2361
+ o,
2362
+ s.folderId ? String(s.folderId) : void 0,
2363
+ this.projectId
2364
+ ), d = At(h);
2365
+ await this.client.updateFile(t, { parentFolderId: d });
2366
+ const f = [], c = await a(this, tt, ls).call(this, s);
2367
+ if (c)
2368
+ try {
2369
+ const V = await this.client.getFile(c);
2370
+ await this.client.updateFile(c, { parentFolderId: d }), f.push({
2371
+ fileId: c,
2372
+ format: De(String(V.name ?? ""), V.fileExtension)
2373
+ });
2374
+ } catch {
2375
+ }
2376
+ ((e == null ? void 0 : e.selfView) ?? Gr.includes(i)) && f.push({ fileId: t, format: i });
2377
+ const v = {
2378
+ schema: qt,
2379
+ name: o,
2380
+ native: { fileId: t, format: i },
2381
+ views: f
2382
+ };
2383
+ return await this.setDescriptor(d, v), { folderId: d, descriptor: v };
2384
+ }
2322
2385
  /**
2323
2386
  * The document's descriptor, read and validated, or null when the folder
2324
2387
  * has none yet (an old folder, or a plain folder that is not a document).
2325
2388
  */
2326
2389
  async descriptor(t) {
2327
- const e = await a(this, bt, ee).call(this, t);
2390
+ const e = await a(this, tt, se).call(this, t);
2328
2391
  if (!e) return null;
2329
2392
  const n = await (await this.client.downloadFile(e.id)).text();
2330
2393
  if (!n.trim()) return null;
@@ -2334,7 +2397,7 @@ class as {
2334
2397
  } catch {
2335
2398
  return null;
2336
2399
  }
2337
- return Mr(i);
2400
+ return Hr(i);
2338
2401
  }
2339
2402
  /**
2340
2403
  * The first view whose format appears in `formats` — searched in the ORDER
@@ -2372,63 +2435,82 @@ class as {
2372
2435
  async setDescriptor(t, e) {
2373
2436
  const s = {
2374
2437
  ...e,
2375
- schema: te,
2438
+ schema: qt,
2376
2439
  views: e.views ?? []
2377
2440
  }, n = new Blob([JSON.stringify(s)], {
2378
2441
  type: "application/json"
2379
- }), i = await a(this, bt, ee).call(this, t);
2442
+ }), i = await a(this, tt, se).call(this, t);
2380
2443
  if (i) {
2381
2444
  await this.client.updateFile(i.id, {
2382
2445
  file: n,
2383
- versionTag: Fe()
2446
+ versionTag: qe()
2384
2447
  });
2385
2448
  return;
2386
2449
  }
2387
2450
  await this.client.createFile({
2388
2451
  file: n,
2389
- name: Le,
2390
- versionTag: Fe(),
2452
+ name: Fe,
2453
+ versionTag: qe(),
2391
2454
  parentFolderId: t,
2392
2455
  projectId: this.projectId
2393
2456
  });
2394
2457
  }
2395
2458
  }
2396
- bt = new WeakSet(), ee = async function(t) {
2459
+ tt = new WeakSet(), ls = async function(t) {
2460
+ const e = [...t.versions ?? []].sort(
2461
+ (s, n) => String(n.createdAt ?? "").localeCompare(String(s.createdAt ?? ""))
2462
+ );
2463
+ for (const s of e)
2464
+ try {
2465
+ const n = await this.client.getFileVersionMetadata(
2466
+ At(t),
2467
+ s.tag
2468
+ ), i = n == null ? void 0 : n.derivedFileId;
2469
+ if (typeof i == "string" && i) return i;
2470
+ } catch {
2471
+ }
2472
+ }, se = async function(t) {
2397
2473
  const s = (await this.client.listFiles({ folderId: t })).find(
2398
- (n) => String(n.name ?? "") === Le
2474
+ (n) => String(n.name ?? "") === Fe
2399
2475
  );
2400
- return s ? { id: jr(s) } : void 0;
2476
+ return s ? { id: At(s) } : void 0;
2401
2477
  };
2402
- function Mr(r) {
2478
+ function De(r, t) {
2479
+ const e = (t ?? "").replace(/^\./, "").toLowerCase();
2480
+ if (e) return e;
2481
+ const s = r.lastIndexOf(".");
2482
+ return s > 0 ? r.slice(s + 1).toLowerCase() : "";
2483
+ }
2484
+ function Hr(r) {
2403
2485
  if (!r || typeof r != "object") return null;
2404
2486
  const t = r;
2405
- if (t.schema !== te || typeof t.name != "string") return null;
2487
+ if (t.schema !== qt || typeof t.name != "string") return null;
2406
2488
  const e = Array.isArray(t.views) ? t.views.filter(
2407
2489
  (i) => !!i && typeof i == "object" && typeof i.fileId == "string" && typeof i.format == "string"
2408
2490
  ) : [], s = t.native, n = !!s && typeof s == "object" && typeof s.fileId == "string" && typeof s.format == "string";
2409
2491
  return {
2410
- schema: te,
2492
+ schema: qt,
2411
2493
  name: t.name,
2412
2494
  ...n ? { native: { fileId: s.fileId, format: s.format } } : {},
2413
2495
  views: e
2414
2496
  };
2415
2497
  }
2416
- class qe extends Error {
2498
+ class Ue extends Error {
2417
2499
  constructor(t, e) {
2418
2500
  super(
2419
2501
  `The document history advanced while this version was being prepared: expected head ${t}, found ${e ?? "none"}. Read the timeline again and rebuild on the new head.`
2420
2502
  ), this.expectedGuid = t, this.actualGuid = e, this.name = "StaleHistoryError";
2421
2503
  }
2422
2504
  }
2423
- const De = "bimterop", se = "revitflow_history.json", et = "revitflow_ops.json", Ue = "revitflow/ops@1", cs = "revitflow_model.frag", hs = "revitflow_", Vr = "bimterop-locks-anchor", At = () => `v-${Date.now()}`;
2424
- function ls(r, t) {
2505
+ const je = "bimterop", re = "revitflow_history.json", rt = "revitflow_ops.json", Me = "revitflow/ops@1", us = "revitflow_model.frag", ds = "revitflow_", Jr = "bimterop-locks-anchor", kt = () => `v-${Date.now()}`;
2506
+ function fs(r, t) {
2425
2507
  return r.filter((e) => String(e.parentId ?? "") === t);
2426
2508
  }
2427
2509
  function B(r) {
2428
2510
  return String(r._id ?? r.id ?? "");
2429
2511
  }
2430
- var $, _t, re;
2431
- class Gr {
2512
+ var $, _t, ne;
2513
+ class Yr {
2432
2514
  constructor(t, e) {
2433
2515
  b(this, _t);
2434
2516
  b(this, $);
@@ -2436,61 +2518,61 @@ class Gr {
2436
2518
  }
2437
2519
  /** The project's connected documents. */
2438
2520
  async docs() {
2439
- const t = await a(this, _t, re).call(this);
2521
+ const t = await a(this, _t, ne).call(this);
2440
2522
  if (!t) return [];
2441
2523
  const e = await this.client.listFolders({
2442
2524
  parentFolderId: t,
2443
2525
  projectId: this.projectId
2444
2526
  }), s = [];
2445
- for (const n of ls(e, t)) {
2527
+ for (const n of fs(e, t)) {
2446
2528
  const i = String(n.name ?? ""), o = i.indexOf("-");
2447
2529
  if (o <= 0) continue;
2448
2530
  const d = (await this.client.listFiles({
2449
2531
  folderId: B(n)
2450
2532
  })).map(
2451
2533
  (g) => String(g.name ?? "")
2452
- ), f = d.find((g) => g === cs) ?? d.find(
2453
- (g) => g.endsWith(".frag") && !g.startsWith(hs)
2454
- ), h = d.includes(se) || d.includes(et) || !!f;
2534
+ ), f = d.find((g) => g === us) ?? d.find(
2535
+ (g) => g.endsWith(".frag") && !g.startsWith(ds)
2536
+ ), c = d.includes(re) || d.includes(rt) || !!f;
2455
2537
  s.push({
2456
2538
  source: i.slice(0, o),
2457
2539
  docId: i.slice(o + 1),
2458
2540
  folderId: B(n),
2459
2541
  modelName: f,
2460
- ...h ? {} : { empty: !0 }
2542
+ ...c ? {} : { empty: !0 }
2461
2543
  });
2462
2544
  }
2463
2545
  return s;
2464
2546
  }
2465
2547
  /** One document's history. `source` and `docId` as {@link docs} lists them. */
2466
2548
  doc(t, e) {
2467
- return new Hr(this.client, this, t, e);
2549
+ return new Wr(this.client, this, t, e);
2468
2550
  }
2469
2551
  /** @internal The `bimterop` folder id, resolved once. */
2470
2552
  async rootFolderId(t = !1) {
2471
2553
  if (u(this, $)) return u(this, $);
2472
- const e = await a(this, _t, re).call(this);
2554
+ const e = await a(this, _t, ne).call(this);
2473
2555
  if (e) return e;
2474
2556
  if (!t) return;
2475
2557
  const s = await this.client.createFolder(
2476
- De,
2558
+ je,
2477
2559
  void 0,
2478
2560
  this.projectId
2479
2561
  );
2480
2562
  return _(this, $, B(s)), u(this, $);
2481
2563
  }
2482
2564
  }
2483
- $ = new WeakMap(), _t = new WeakSet(), re = async function() {
2565
+ $ = new WeakMap(), _t = new WeakSet(), ne = async function() {
2484
2566
  if (u(this, $)) return u(this, $);
2485
2567
  const e = (await this.client.listFolders({
2486
2568
  projectId: this.projectId
2487
2569
  })).find(
2488
- (s) => String(s.name ?? "") === De && !s.parentId
2570
+ (s) => String(s.name ?? "") === je && !s.parentId
2489
2571
  );
2490
2572
  return e && _(this, $, B(e)), u(this, $);
2491
2573
  };
2492
- var U, p, st, rt, D, ne, yt, nt, ie, Rt, mt, $t, oe, us;
2493
- class Hr {
2574
+ var U, p, nt, it, D, ie, mt, ot, oe, $t, gt, Nt, ae, ps;
2575
+ class Wr {
2494
2576
  constructor(t, e, s, n) {
2495
2577
  b(this, p);
2496
2578
  b(this, U);
@@ -2503,8 +2585,8 @@ class Hr {
2503
2585
  * Each version gets its `ordinal` filled in.
2504
2586
  */
2505
2587
  async timeline() {
2506
- const t = await a(this, p, Rt).call(this);
2507
- return ds((t == null ? void 0 : t.commits) ?? []);
2588
+ const t = await a(this, p, $t).call(this);
2589
+ return ys((t == null ? void 0 : t.commits) ?? []);
2508
2590
  }
2509
2591
  /** The head of the timeline, or null before the first sync. */
2510
2592
  async latest() {
@@ -2524,7 +2606,7 @@ class Hr {
2524
2606
  }
2525
2607
  /** The visible model .frag as last fully exported. */
2526
2608
  async model() {
2527
- const t = await a(this, p, nt).call(this);
2609
+ const t = await a(this, p, ot).call(this);
2528
2610
  if (!t)
2529
2611
  throw new Error(
2530
2612
  `Document ${this.source}-${this.docId} has no model file yet.`
@@ -2541,7 +2623,7 @@ class Hr {
2541
2623
  * not carry one yet — an old folder from before descriptors existed.
2542
2624
  */
2543
2625
  async descriptor() {
2544
- return await u(this, p, st).descriptor(await a(this, p, D).call(this, !1));
2626
+ return await u(this, p, nt).descriptor(await a(this, p, D).call(this, !1));
2545
2627
  }
2546
2628
  /**
2547
2629
  * The first view whose format appears in `formats`, searched in the order
@@ -2549,16 +2631,16 @@ class Hr {
2549
2631
  * model .frag on a descriptor-less folder, so old documents keep viewing.
2550
2632
  */
2551
2633
  async view(t) {
2552
- const e = await a(this, p, D).call(this, !1), s = await u(this, p, st).descriptor(e);
2634
+ const e = await a(this, p, D).call(this, !1), s = await u(this, p, nt).descriptor(e);
2553
2635
  if (s) {
2554
2636
  for (const i of t) {
2555
- const o = s.views.find((c) => c.format === i);
2637
+ const o = s.views.find((h) => h.format === i);
2556
2638
  if (o) return o;
2557
2639
  }
2558
2640
  return null;
2559
2641
  }
2560
2642
  if (!t.includes("frag")) return null;
2561
- const n = await a(this, p, nt).call(this);
2643
+ const n = await a(this, p, ot).call(this);
2562
2644
  return n ? { fileId: n.id, format: "frag" } : null;
2563
2645
  }
2564
2646
  /**
@@ -2568,13 +2650,13 @@ class Hr {
2568
2650
  */
2569
2651
  async addView(t) {
2570
2652
  const e = await a(this, p, D).call(this, !0);
2571
- if (await u(this, p, st).descriptor(e)) {
2572
- await u(this, p, st).addView(e, t);
2653
+ if (await u(this, p, nt).descriptor(e)) {
2654
+ await u(this, p, nt).addView(e, t);
2573
2655
  return;
2574
2656
  }
2575
- const n = await a(this, p, nt).call(this);
2576
- await u(this, p, st).setDescriptor(e, {
2577
- name: (n == null ? void 0 : n.name.replace(/\.frag$/, "")) ?? u(this, p, rt),
2657
+ const n = await a(this, p, ot).call(this);
2658
+ await u(this, p, nt).setDescriptor(e, {
2659
+ name: (n == null ? void 0 : n.name.replace(/\.frag$/, "")) ?? u(this, p, it),
2578
2660
  views: [t]
2579
2661
  });
2580
2662
  }
@@ -2587,15 +2669,15 @@ class Hr {
2587
2669
  * claims counts only for the earliest one, matching the plugins' rule.
2588
2670
  */
2589
2671
  async ownership() {
2590
- const t = await a(this, p, yt).call(this, Vr);
2672
+ const t = await a(this, p, mt).call(this, Jr);
2591
2673
  if (!t) return [];
2592
2674
  const e = await this.client.getHiddenFilesByParent(t.id), s = await Promise.all(
2593
2675
  e.map(async (o) => {
2594
2676
  try {
2595
- const c = B(o), d = await this.client.downloadHiddenFile(c), f = JSON.parse(await d.text());
2677
+ const h = B(o), d = await this.client.downloadHiddenFile(h), f = JSON.parse(await d.text());
2596
2678
  return !f || typeof f != "object" || !("revitflowlock" in f) || !Array.isArray(f.keys) ? null : {
2597
2679
  owner: String(f.user ?? ""),
2598
- keys: f.keys.filter((h) => typeof h == "string")
2680
+ keys: f.keys.filter((c) => typeof c == "string")
2599
2681
  };
2600
2682
  } catch {
2601
2683
  return null;
@@ -2604,15 +2686,15 @@ class Hr {
2604
2686
  ), n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
2605
2687
  for (const o of s)
2606
2688
  if (o)
2607
- for (const c of o.keys) {
2608
- if (!c || n.has(c)) continue;
2609
- n.add(c);
2689
+ for (const h of o.keys) {
2690
+ if (!h || n.has(h)) continue;
2691
+ n.add(h);
2610
2692
  const d = i.get(o.owner) ?? [];
2611
- d.push(c), i.set(o.owner, d);
2693
+ d.push(h), i.set(o.owner, d);
2612
2694
  }
2613
- return [...i.entries()].map(([o, c]) => ({
2695
+ return [...i.entries()].map(([o, h]) => ({
2614
2696
  owner: o,
2615
- elements: c
2697
+ elements: h
2616
2698
  }));
2617
2699
  }
2618
2700
  // ─── Writing versions ─────────────────────────────────────────────────────
@@ -2623,29 +2705,29 @@ class Hr {
2623
2705
  * silent fork.
2624
2706
  */
2625
2707
  async sync(t) {
2626
- var c;
2708
+ var h;
2627
2709
  const e = await a(this, p, D).call(this, !0);
2628
- let s = await a(this, p, Rt).call(this) ?? {
2710
+ let s = await a(this, p, $t).call(this) ?? {
2629
2711
  model: this.docId,
2630
2712
  commits: []
2631
2713
  };
2632
- const n = je(s.commits);
2714
+ const n = Ve(s.commits);
2633
2715
  if (t.expectedLatestGuid !== void 0 && (n == null ? void 0 : n.guid) !== t.expectedLatestGuid)
2634
- throw new qe(t.expectedLatestGuid, n == null ? void 0 : n.guid);
2716
+ throw new Ue(t.expectedLatestGuid, n == null ? void 0 : n.guid);
2635
2717
  const i = {
2636
- guid: ae(),
2718
+ guid: ce(),
2637
2719
  ...n ? { parents: [n.guid] } : {},
2638
2720
  author: t.author,
2639
2721
  source: t.source,
2640
2722
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2641
2723
  ...t.message ? { message: t.message } : {},
2642
2724
  ...t.userId ? { userId: t.userId } : {},
2643
- ...(c = t.appliedOps) != null && c.length ? { appliedOps: t.appliedOps } : {},
2725
+ ...(h = t.appliedOps) != null && h.length ? { appliedOps: t.appliedOps } : {},
2644
2726
  changes: t.changes,
2645
- counts: Jr(t.changes)
2727
+ counts: Kr(t.changes)
2646
2728
  };
2647
- if (t.model && (await a(this, p, us).call(this, e, t.model), i.full = !0), t.delta) {
2648
- const d = await a(this, p, nt).call(this);
2729
+ if (t.model && (await a(this, p, ps).call(this, e, t.model), i.full = !0), t.delta) {
2730
+ const d = await a(this, p, ot).call(this);
2649
2731
  if (!d)
2650
2732
  throw new Error(
2651
2733
  "A delta needs the model file to hang from: sync a full model first."
@@ -2658,20 +2740,20 @@ class Hr {
2658
2740
  f._id ?? f.id
2659
2741
  );
2660
2742
  }
2661
- const o = await a(this, p, Rt).call(this);
2743
+ const o = await a(this, p, $t).call(this);
2662
2744
  if (o) {
2663
2745
  s = o;
2664
- const d = je(s.commits);
2746
+ const d = Ve(s.commits);
2665
2747
  if (t.expectedLatestGuid !== void 0 && (d == null ? void 0 : d.guid) !== t.expectedLatestGuid)
2666
- throw new qe(t.expectedLatestGuid, d == null ? void 0 : d.guid);
2748
+ throw new Ue(t.expectedLatestGuid, d == null ? void 0 : d.guid);
2667
2749
  d && !i.parents && (i.parents = [d.guid]);
2668
2750
  }
2669
- return s.commits.push(i), await a(this, p, $t).call(this, e, se, s), i;
2751
+ return s.commits.push(i), await a(this, p, Nt).call(this, e, re, s), i;
2670
2752
  }
2671
2753
  // ─── Suggestions (change requests) ────────────────────────────────────────
2672
2754
  /** Every suggestion in the document's queue, pending or resolved. */
2673
2755
  async suggestions() {
2674
- const t = await a(this, p, mt).call(this);
2756
+ const t = await a(this, p, gt).call(this);
2675
2757
  return (t == null ? void 0 : t.ops) ?? [];
2676
2758
  }
2677
2759
  /** The suggestions still waiting for the owner, oldest first. */
@@ -2683,8 +2765,8 @@ class Hr {
2683
2765
  * uploaded as a hidden file under the suggestions index.
2684
2766
  */
2685
2767
  async suggest(t) {
2686
- const e = await a(this, p, D).call(this, !0), s = await a(this, p, mt).call(this) ?? { schema: Ue, ops: [] }, n = await a(this, p, yt).call(this, et), i = {
2687
- opId: t.opId ?? ae(),
2768
+ const e = await a(this, p, D).call(this, !0), s = await a(this, p, gt).call(this) ?? { schema: Me, ops: [] }, n = await a(this, p, mt).call(this, rt), i = {
2769
+ opId: t.opId ?? ce(),
2688
2770
  to: t.to ?? this.source,
2689
2771
  title: t.title,
2690
2772
  verb: t.verb,
@@ -2697,16 +2779,16 @@ class Hr {
2697
2779
  ...t.baseCommitGuid ? { baseCommitGuid: t.baseCommitGuid } : {}
2698
2780
  };
2699
2781
  if (t.payload) {
2700
- const c = n ?? await a(this, p, oe).call(this, e, et, s), d = await this.client.createHiddenFile(
2782
+ const h = n ?? await a(this, p, ae).call(this, e, rt, s), d = await this.client.createHiddenFile(
2701
2783
  t.payload,
2702
- c.id
2784
+ h.id
2703
2785
  );
2704
2786
  i.fragId = String(
2705
2787
  d._id ?? d.id
2706
2788
  );
2707
2789
  }
2708
- const o = await a(this, p, mt).call(this) ?? s;
2709
- return o.schema ?? (o.schema = Ue), o.ops.push(i), await a(this, p, $t).call(this, e, et, o), i;
2790
+ const o = await a(this, p, gt).call(this) ?? s;
2791
+ return o.schema ?? (o.schema = Me), o.ops.push(i), await a(this, p, Nt).call(this, e, rt, o), i;
2710
2792
  }
2711
2793
  /** A suggestion's .frag payload. */
2712
2794
  async suggestionPayload(t) {
@@ -2722,15 +2804,15 @@ class Hr {
2722
2804
  async resolveSuggestion(t, e) {
2723
2805
  const s = await a(this, p, D).call(this, !1);
2724
2806
  if (!s) throw new Error("This document has no suggestion queue.");
2725
- const n = await a(this, p, mt).call(this), i = n == null ? void 0 : n.ops.find((o) => o.opId === t);
2807
+ const n = await a(this, p, gt).call(this), i = n == null ? void 0 : n.ops.find((o) => o.opId === t);
2726
2808
  if (!n || !i)
2727
2809
  throw new Error(`No suggestion ${t} in this document's queue.`);
2728
- return Object.assign(i, e), await a(this, p, $t).call(this, s, et, n), i;
2810
+ return Object.assign(i, e), await a(this, p, Nt).call(this, s, rt, n), i;
2729
2811
  }
2730
2812
  }
2731
- U = new WeakMap(), p = new WeakSet(), st = function() {
2732
- return new as(this.client, this.project.projectId);
2733
- }, rt = function() {
2813
+ U = new WeakMap(), p = new WeakSet(), nt = function() {
2814
+ return new hs(this.client, this.project.projectId);
2815
+ }, it = function() {
2734
2816
  return `${this.source}-${this.docId}`;
2735
2817
  }, D = async function(t) {
2736
2818
  if (u(this, U)) return u(this, U);
@@ -2742,153 +2824,153 @@ U = new WeakMap(), p = new WeakSet(), st = function() {
2742
2824
  const s = await this.client.listFolders({
2743
2825
  parentFolderId: e,
2744
2826
  projectId: this.project.projectId
2745
- }), n = ls(s, e).find(
2746
- (o) => String(o.name ?? "") === u(this, p, rt)
2827
+ }), n = fs(s, e).find(
2828
+ (o) => String(o.name ?? "") === u(this, p, it)
2747
2829
  );
2748
2830
  if (n)
2749
2831
  return _(this, U, B(n)), u(this, U);
2750
2832
  if (!t)
2751
2833
  throw new Error(
2752
- `Document ${u(this, p, rt)} does not exist in this project.`
2834
+ `Document ${u(this, p, it)} does not exist in this project.`
2753
2835
  );
2754
2836
  const i = await this.client.createFolder(
2755
- u(this, p, rt),
2837
+ u(this, p, it),
2756
2838
  e,
2757
2839
  this.project.projectId
2758
2840
  );
2759
2841
  return _(this, U, B(i)), u(this, U);
2760
- }, ne = async function() {
2842
+ }, ie = async function() {
2761
2843
  const t = await a(this, p, D).call(this, !1);
2762
2844
  return (await this.client.listFiles({ folderId: t })).map((s) => ({
2763
2845
  id: B(s),
2764
2846
  name: String(s.name ?? "")
2765
2847
  }));
2766
- }, yt = async function(t) {
2848
+ }, mt = async function(t) {
2767
2849
  try {
2768
- return (await a(this, p, ne).call(this)).find((e) => e.name === t);
2850
+ return (await a(this, p, ie).call(this)).find((e) => e.name === t);
2769
2851
  } catch {
2770
2852
  return;
2771
2853
  }
2772
- }, nt = async function() {
2854
+ }, ot = async function() {
2773
2855
  try {
2774
- const t = await a(this, p, ne).call(this);
2775
- return t.find((e) => e.name === cs) ?? t.find(
2776
- (e) => e.name.endsWith(".frag") && !e.name.startsWith(hs)
2856
+ const t = await a(this, p, ie).call(this);
2857
+ return t.find((e) => e.name === us) ?? t.find(
2858
+ (e) => e.name.endsWith(".frag") && !e.name.startsWith(ds)
2777
2859
  );
2778
2860
  } catch {
2779
2861
  return;
2780
2862
  }
2781
- }, ie = async function(t) {
2782
- const e = await a(this, p, yt).call(this, t);
2863
+ }, oe = async function(t) {
2864
+ const e = await a(this, p, mt).call(this, t);
2783
2865
  if (!e) return;
2784
2866
  const n = await (await this.client.downloadFile(e.id)).text();
2785
2867
  if (n.trim())
2786
2868
  return JSON.parse(n);
2787
- }, Rt = function() {
2788
- return a(this, p, ie).call(this, se);
2789
- }, mt = function() {
2790
- return a(this, p, ie).call(this, et);
2791
- }, $t = async function(t, e, s) {
2869
+ }, $t = function() {
2870
+ return a(this, p, oe).call(this, re);
2871
+ }, gt = function() {
2872
+ return a(this, p, oe).call(this, rt);
2873
+ }, Nt = async function(t, e, s) {
2792
2874
  const n = new Blob([JSON.stringify(s)], {
2793
2875
  type: "application/json"
2794
- }), i = await a(this, p, yt).call(this, e);
2876
+ }), i = await a(this, p, mt).call(this, e);
2795
2877
  return i ? (await this.client.updateFile(i.id, {
2796
2878
  file: n,
2797
- versionTag: At()
2798
- }), i) : await a(this, p, oe).call(this, t, e, s);
2799
- }, oe = async function(t, e, s) {
2879
+ versionTag: kt()
2880
+ }), i) : await a(this, p, ae).call(this, t, e, s);
2881
+ }, ae = async function(t, e, s) {
2800
2882
  const n = new Blob([JSON.stringify(s)], {
2801
2883
  type: "application/json"
2802
2884
  }), i = await this.client.createFile({
2803
2885
  file: n,
2804
2886
  name: e,
2805
- versionTag: At(),
2887
+ versionTag: kt(),
2806
2888
  parentFolderId: t,
2807
2889
  projectId: this.project.projectId
2808
2890
  }), o = i.item;
2809
2891
  return { id: B(o ?? i), name: e };
2810
- }, us = async function(t, e) {
2811
- const s = await a(this, p, nt).call(this);
2892
+ }, ps = async function(t, e) {
2893
+ const s = await a(this, p, ot).call(this);
2812
2894
  if (s)
2813
2895
  return await this.client.updateFile(s.id, {
2814
2896
  file: e,
2815
- versionTag: At()
2897
+ versionTag: kt()
2816
2898
  }), s;
2817
- const n = `${u(this, p, rt)}.frag`, i = await this.client.createFile({
2899
+ const n = `${u(this, p, it)}.frag`, i = await this.client.createFile({
2818
2900
  file: e,
2819
2901
  name: n,
2820
- versionTag: At(),
2902
+ versionTag: kt(),
2821
2903
  parentFolderId: t,
2822
2904
  projectId: this.project.projectId
2823
2905
  }), o = i.item;
2824
2906
  return { id: B(o ?? i), name: n };
2825
2907
  };
2826
- function Jr(r) {
2908
+ function Kr(r) {
2827
2909
  const t = { added: 0, modified: 0, removed: 0 };
2828
2910
  for (const e of r)
2829
2911
  e.type === "create" ? t.added++ : e.type === "delete" ? t.removed++ : t.modified++;
2830
2912
  return t;
2831
2913
  }
2832
- function ds(r) {
2914
+ function ys(r) {
2833
2915
  var d;
2834
2916
  if (r.length <= 1)
2835
- return r.forEach((f, h) => f.ordinal = h), [...r];
2917
+ return r.forEach((f, c) => f.ordinal = c), [...r];
2836
2918
  const t = new Map(r.map((f) => [f.guid, f])), e = /* @__PURE__ */ new Map(), s = [];
2837
2919
  for (const f of r) {
2838
- const h = (d = f.parents) == null ? void 0 : d[0];
2839
- if (h && t.has(h)) {
2840
- const g = e.get(h) ?? [];
2841
- g.push(f), e.set(h, g);
2920
+ const c = (d = f.parents) == null ? void 0 : d[0];
2921
+ if (c && t.has(c)) {
2922
+ const g = e.get(c) ?? [];
2923
+ g.push(f), e.set(c, g);
2842
2924
  } else
2843
2925
  s.push(f);
2844
2926
  }
2845
- const n = (f, h) => String(f.timestamp).localeCompare(String(h.timestamp));
2927
+ const n = (f, c) => String(f.timestamp).localeCompare(String(c.timestamp));
2846
2928
  s.sort(n);
2847
- const i = [], o = [...s].reverse(), c = /* @__PURE__ */ new Set();
2929
+ const i = [], o = [...s].reverse(), h = /* @__PURE__ */ new Set();
2848
2930
  for (; o.length; ) {
2849
2931
  const f = o.pop();
2850
- if (c.has(f.guid)) continue;
2851
- c.add(f.guid), i.push(f);
2852
- const h = (e.get(f.guid) ?? []).sort(n);
2853
- for (let g = h.length - 1; g >= 0; g--) o.push(h[g]);
2932
+ if (h.has(f.guid)) continue;
2933
+ h.add(f.guid), i.push(f);
2934
+ const c = (e.get(f.guid) ?? []).sort(n);
2935
+ for (let g = c.length - 1; g >= 0; g--) o.push(c[g]);
2854
2936
  }
2855
2937
  for (const f of r)
2856
- c.has(f.guid) || i.push(f);
2857
- return i.forEach((f, h) => f.ordinal = h), i;
2938
+ h.has(f.guid) || i.push(f);
2939
+ return i.forEach((f, c) => f.ordinal = c), i;
2858
2940
  }
2859
- function je(r) {
2860
- const t = ds(r);
2941
+ function Ve(r) {
2942
+ const t = ys(r);
2861
2943
  return t[t.length - 1];
2862
2944
  }
2863
- function ae() {
2945
+ function ce() {
2864
2946
  const r = globalThis.crypto;
2865
2947
  return r != null && r.randomUUID ? r.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
2866
2948
  const e = Math.random() * 16 | 0;
2867
2949
  return (t === "x" ? e : e & 3 | 8).toString(16);
2868
2950
  });
2869
2951
  }
2870
- var J, Et, ce;
2871
- class Yr {
2952
+ var Y, Et, he;
2953
+ class zr {
2872
2954
  constructor(t) {
2873
2955
  b(this, Et);
2874
- b(this, J, /* @__PURE__ */ new Map());
2956
+ b(this, Y, /* @__PURE__ */ new Map());
2875
2957
  this.client = t;
2876
2958
  }
2877
2959
  /** Registers a recipe. One per name; a second with the same name throws. */
2878
2960
  register(t) {
2879
- if (u(this, J).has(t.name))
2961
+ if (u(this, Y).has(t.name))
2880
2962
  throw new Error(`A recipe named "${t.name}" is already registered.`);
2881
- u(this, J).set(t.name, t);
2963
+ u(this, Y).set(t.name, t);
2882
2964
  }
2883
2965
  /** The registered recipes, optionally filtered by target application. */
2884
2966
  list(t) {
2885
- return [...u(this, J).values()].filter(
2967
+ return [...u(this, Y).values()].filter(
2886
2968
  (s) => (!(t != null && t.to) || s.to === t.to) && (!(t != null && t.input) || s.inputs.includes(t.input))
2887
2969
  );
2888
2970
  }
2889
2971
  /** A registered recipe by name, or undefined. */
2890
2972
  get(t) {
2891
- return u(this, J).get(t);
2973
+ return u(this, Y).get(t);
2892
2974
  }
2893
2975
  /**
2894
2976
  * Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
@@ -2897,7 +2979,7 @@ class Yr {
2897
2979
  * included, with no second run. Discard it and the plan never happened.
2898
2980
  */
2899
2981
  async plan(t, e) {
2900
- const { base: s, opId: n, result: i } = await a(this, Et, ce).call(this, t, e);
2982
+ const { base: s, opId: n, result: i } = await a(this, Et, he).call(this, t, e);
2901
2983
  return {
2902
2984
  opId: n,
2903
2985
  projectId: e.projectId,
@@ -2930,7 +3012,7 @@ class Yr {
2930
3012
  * to show the tallies before queueing.
2931
3013
  */
2932
3014
  async run(t, e) {
2933
- const { targetDoc: s, base: n, opId: i, result: o } = await a(this, Et, ce).call(this, t, e);
3015
+ const { targetDoc: s, base: n, opId: i, result: o } = await a(this, Et, he).call(this, t, e);
2934
3016
  return { suggestion: await s.suggest({
2935
3017
  opId: i,
2936
3018
  title: o.title,
@@ -2943,14 +3025,14 @@ class Yr {
2943
3025
  }), result: o };
2944
3026
  }
2945
3027
  }
2946
- J = new WeakMap(), Et = new WeakSet(), ce = async function(t, e) {
2947
- const s = u(this, J).get(t);
3028
+ Y = new WeakMap(), Et = new WeakSet(), he = async function(t, e) {
3029
+ const s = u(this, Y).get(t);
2948
3030
  if (!s) throw new Error(`No recipe named "${t}" is registered.`);
2949
3031
  if (s.to !== e.target.source)
2950
3032
  throw new Error(
2951
3033
  `Recipe "${t}" writes ${s.to}, but the target document belongs to ${e.target.source}.`
2952
3034
  );
2953
- const n = this.client.history(e.projectId).doc(e.target.source, e.target.docId), i = await n.latest(), o = ae(), c = await s.run({
3035
+ const n = this.client.history(e.projectId).doc(e.target.source, e.target.docId), i = await n.latest(), o = ce(), h = await s.run({
2954
3036
  client: this.client,
2955
3037
  projectId: e.projectId,
2956
3038
  targetDoc: n,
@@ -2958,10 +3040,10 @@ J = new WeakMap(), Et = new WeakSet(), ce = async function(t, e) {
2958
3040
  input: e.input,
2959
3041
  settings: e.settings ?? {}
2960
3042
  });
2961
- return { recipe: s, targetDoc: n, base: i, opId: o, result: c };
3043
+ return { recipe: s, targetDoc: n, base: i, opId: o, result: h };
2962
3044
  };
2963
- const Me = 100;
2964
- function Wr(r) {
3045
+ const Ge = 100;
3046
+ function Xr(r) {
2965
3047
  try {
2966
3048
  const t = JSON.parse(r);
2967
3049
  if (t && typeof t == "object") {
@@ -2976,14 +3058,14 @@ function Wr(r) {
2976
3058
  }
2977
3059
  return {};
2978
3060
  }
2979
- function Kr(r) {
3061
+ function Qr(r) {
2980
3062
  if (!r || typeof r != "object") return;
2981
3063
  const t = r.retryAfter;
2982
3064
  return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : void 0;
2983
3065
  }
2984
- class Te extends Error {
3066
+ class Se extends Error {
2985
3067
  constructor(e, s, n, i) {
2986
- const o = Wr(n);
3068
+ const o = Xr(n);
2987
3069
  super(o.message ?? `${s || "Request failed"} (${e})`);
2988
3070
  I(this, "status");
2989
3071
  I(this, "code");
@@ -2994,11 +3076,11 @@ class Te extends Error {
2994
3076
  * from `details.retryAfter`. Only present on rate-limited (429) responses.
2995
3077
  */
2996
3078
  I(this, "retryAfter");
2997
- this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body = n, this.retryAfter = i ?? Kr(o.details);
3079
+ this.name = "RequestError", this.status = e, this.code = o.code, this.details = o.details, this.body = n, this.retryAfter = i ?? Qr(o.details);
2998
3080
  }
2999
3081
  }
3000
- const P = "item/folder", m = "item", G = "processor", zr = "npm-registry", q = "hidden", Ht = "FILE", Jt = "TOOL", Yt = "APP", Xr = 500, Ve = 3e4, Qr = 0.25, Zr = (r) => new Promise((t) => setTimeout(t, r));
3001
- function tn(r) {
3082
+ const P = "item/folder", m = "item", H = "processor", Zr = "npm-registry", q = "hidden", Yt = "FILE", Wt = "TOOL", Kt = "APP", tn = 500, He = 3e4, en = 0.25, sn = (r) => new Promise((t) => setTimeout(t, r));
3083
+ function rn(r) {
3002
3084
  var n, i;
3003
3085
  const t = (i = (n = r.headers) == null ? void 0 : n.get) == null ? void 0 : i.call(n, "Retry-After");
3004
3086
  if (!t) return;
@@ -3008,18 +3090,18 @@ function tn(r) {
3008
3090
  if (!Number.isNaN(s))
3009
3091
  return Math.max(0, (s - Date.now()) / 1e3);
3010
3092
  }
3011
- function en(r) {
3012
- return r instanceof Te ? r.status === 429 || r.status >= 500 : !0;
3093
+ function nn(r) {
3094
+ return r instanceof Se ? r.status === 429 || r.status >= 500 : !0;
3013
3095
  }
3014
- function sn(r, t) {
3096
+ function on(r, t) {
3015
3097
  const e = Math.min(
3016
- Xr * 2 ** t,
3017
- Ve
3018
- ), s = e * Qr * Math.random(), n = r instanceof Te && r.retryAfter != null ? r.retryAfter * 1e3 : void 0;
3019
- return n != null ? Math.min(n, Ve) + s : e + s;
3098
+ tn * 2 ** t,
3099
+ He
3100
+ ), s = e * en * Math.random(), n = r instanceof Se && r.retryAfter != null ? r.retryAfter * 1e3 : void 0;
3101
+ return n != null ? Math.min(n, He) + s : e + s;
3020
3102
  }
3021
- var l, le, y, H, vt, gt, Nt, Pt, ue, de, fs;
3022
- const Se = class Se {
3103
+ var l, ue, y, J, vt, wt, Pt, Bt, de, fe, ms;
3104
+ const Ie = class Ie {
3023
3105
  /**
3024
3106
  * Creates a new EngineServicesClient instance.
3025
3107
  * @param accessToken - API access token (obtained from the platform dashboard)
@@ -3049,8 +3131,8 @@ const Se = class Se {
3049
3131
  I(this, "context");
3050
3132
  b(this, vt);
3051
3133
  const { retries: n = 0, useBearer: i = !1, localServerUrl: o } = s || {};
3052
- let c = e;
3053
- if (c.charAt(c.length - 1) === "/" && (c = c.slice(0, -1)), this.apiUrl = `${c}/api`, this.accessToken = t, this.wsUrl = c, this.retries = n, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: t, apiUrl: e }, o) {
3134
+ let h = e;
3135
+ if (h.charAt(h.length - 1) === "/" && (h = h.slice(0, -1)), this.apiUrl = `${h}/api`, this.accessToken = t, this.wsUrl = h, this.retries = n, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: t, apiUrl: e }, o) {
3054
3136
  let d = o;
3055
3137
  d.charAt(d.length - 1) === "/" && (d = d.slice(0, -1)), this.localServerUrl = d;
3056
3138
  }
@@ -3072,7 +3154,7 @@ const Se = class Se {
3072
3154
  * ```
3073
3155
  */
3074
3156
  static fromPlatformContext(t) {
3075
- const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new Se(e.accessToken, e.apiUrl, {
3157
+ const e = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new Ie(e.accessToken, e.apiUrl, {
3076
3158
  ...t,
3077
3159
  useBearer: !0
3078
3160
  });
@@ -3158,9 +3240,9 @@ const Se = class Se {
3158
3240
  */
3159
3241
  async listFiles(t) {
3160
3242
  const { folderId: e, archived: s, projectId: n } = t || {};
3161
- return e ? await a(this, l, y).call(this, "GET", `${P}/${e}/items`, { query: { itemType: Ht, archived: s } }) : await a(this, l, y).call(this, "GET", `${m}`, {
3243
+ return e ? await a(this, l, y).call(this, "GET", `${P}/${e}/items`, { query: { itemType: Yt, archived: s } }) : await a(this, l, y).call(this, "GET", `${m}`, {
3162
3244
  query: {
3163
- itemType: Ht,
3245
+ itemType: Yt,
3164
3246
  archived: s,
3165
3247
  ...n && { projectId: n }
3166
3248
  }
@@ -3173,7 +3255,7 @@ const Se = class Se {
3173
3255
  * @returns The file item, optionally with version history.
3174
3256
  */
3175
3257
  async getFile(t, e) {
3176
- return await a(this, l, de).call(this, t, e);
3258
+ return await a(this, l, fe).call(this, t, e);
3177
3259
  }
3178
3260
  /**
3179
3261
  * Uploads a new file.
@@ -3181,7 +3263,7 @@ const Se = class Se {
3181
3263
  * @returns The created item and its first version.
3182
3264
  */
3183
3265
  async createFile(t) {
3184
- return await a(this, l, Pt).call(this, t, Ht);
3266
+ return await a(this, l, Bt).call(this, t, Yt);
3185
3267
  }
3186
3268
  /**
3187
3269
  * Updates an existing file. Can rename, move to a different folder,
@@ -3191,7 +3273,7 @@ const Se = class Se {
3191
3273
  * @returns The updated item and/or the new version.
3192
3274
  */
3193
3275
  async updateFile(t, e) {
3194
- return await a(this, l, ue).call(this, t, e);
3276
+ return await a(this, l, de).call(this, t, e);
3195
3277
  }
3196
3278
  /**
3197
3279
  * Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
@@ -3214,7 +3296,7 @@ const Se = class Se {
3214
3296
  * @returns A fetch Response containing the file data.
3215
3297
  */
3216
3298
  async downloadFile(t, e) {
3217
- return await a(this, l, Nt).call(this, t, e);
3299
+ return await a(this, l, Pt).call(this, t, e);
3218
3300
  }
3219
3301
  /**
3220
3302
  * Retrieves the free-JSON metadata for a specific file version.
@@ -3266,7 +3348,7 @@ const Se = class Se {
3266
3348
  */
3267
3349
  async getFileVersionMetadataBatch(t, e) {
3268
3350
  const { withDraft: s } = e || {};
3269
- return await a(this, l, gt).call(this, t, async (n) => (await a(this, l, y).call(this, "POST", `${m}/batch/version-metadata`, {
3351
+ return await a(this, l, wt).call(this, t, async (n) => (await a(this, l, y).call(this, "POST", `${m}/batch/version-metadata`, {
3270
3352
  body: JSON.stringify({
3271
3353
  entries: n,
3272
3354
  ...s !== void 0 && { withDraft: s }
@@ -3311,7 +3393,7 @@ const Se = class Se {
3311
3393
  * @param folderIds - The folder ids to resolve.
3312
3394
  */
3313
3395
  async getFoldersBatch(t) {
3314
- return await a(this, l, gt).call(this, t, async (e) => (await a(this, l, y).call(this, "POST", `${m}/batch/folders`, {
3396
+ return await a(this, l, wt).call(this, t, async (e) => (await a(this, l, y).call(this, "POST", `${m}/batch/folders`, {
3315
3397
  body: JSON.stringify({ folderIds: e }),
3316
3398
  contentType: "application/json"
3317
3399
  })).results);
@@ -3365,7 +3447,7 @@ const Se = class Se {
3365
3447
  * @returns A fetch Response containing the ZIP data.
3366
3448
  */
3367
3449
  async downloadFolder(t) {
3368
- return await a(this, l, H).call(this, `${P}/${t}/download`);
3450
+ return await a(this, l, J).call(this, `${P}/${t}/download`);
3369
3451
  }
3370
3452
  // ─── Components ──────────────────────────────────────────────────
3371
3453
  /**
@@ -3377,12 +3459,12 @@ const Se = class Se {
3377
3459
  const { folderId: e, ShowVersions: s, projectId: n } = t || {};
3378
3460
  return e ? await a(this, l, y).call(this, "GET", `${P}/${e}/items`, {
3379
3461
  query: {
3380
- itemType: Jt,
3462
+ itemType: Wt,
3381
3463
  ...s && { ShowVersions: s }
3382
3464
  }
3383
3465
  }) : await a(this, l, y).call(this, "GET", `${m}`, {
3384
3466
  query: {
3385
- itemType: Jt,
3467
+ itemType: Wt,
3386
3468
  ...s && { ShowVersions: s },
3387
3469
  ...n && { projectId: n }
3388
3470
  }
@@ -3394,7 +3476,7 @@ const Se = class Se {
3394
3476
  * @param props - Options such as whether to include versions.
3395
3477
  */
3396
3478
  async getComponent(t, e) {
3397
- return await a(this, l, de).call(this, t, e);
3479
+ return await a(this, l, fe).call(this, t, e);
3398
3480
  }
3399
3481
  /**
3400
3482
  * Creates a new component with the given file and version properties.
@@ -3403,7 +3485,7 @@ const Se = class Se {
3403
3485
  */
3404
3486
  async createComponent(t) {
3405
3487
  const { componentProps: e } = t;
3406
- return await a(this, l, Pt).call(this, t, Jt, e);
3488
+ return await a(this, l, Bt).call(this, t, Wt, e);
3407
3489
  }
3408
3490
  /**
3409
3491
  * Updates an existing component. Can rename, move, and/or upload a new version.
@@ -3413,7 +3495,7 @@ const Se = class Se {
3413
3495
  */
3414
3496
  async updateComponent(t, e) {
3415
3497
  const { componentProps: s } = e;
3416
- return await a(this, l, ue).call(this, t, e, s);
3498
+ return await a(this, l, de).call(this, t, e, s);
3417
3499
  }
3418
3500
  /**
3419
3501
  * Downloads a component's full ZIP file. Returns the raw fetch Response.
@@ -3422,7 +3504,7 @@ const Se = class Se {
3422
3504
  * @returns A fetch Response containing the ZIP data.
3423
3505
  */
3424
3506
  async downloadComponent(t, e) {
3425
- return await a(this, l, Nt).call(this, t, e);
3507
+ return await a(this, l, Pt).call(this, t, e);
3426
3508
  }
3427
3509
  /**
3428
3510
  * Downloads only the JavaScript bundle from a component's ZIP.
@@ -3433,7 +3515,7 @@ const Se = class Se {
3433
3515
  */
3434
3516
  async downloadComponentBundle(t, e) {
3435
3517
  const { versionTag: s, withDraft: n } = e || {};
3436
- return await a(this, l, H).call(this, `${m}/${t}/download/bundle`, {
3518
+ return await a(this, l, J).call(this, `${m}/${t}/download/bundle`, {
3437
3519
  query: {
3438
3520
  ...s && { versionTag: s },
3439
3521
  ...n && { withDraft: n }
@@ -3461,7 +3543,7 @@ const Se = class Se {
3461
3543
  * @returns The component's JavaScript source code as a string.
3462
3544
  */
3463
3545
  async getBuiltInComponent(t) {
3464
- return await (await a(this, l, H).call(this, `built-in/${t}/bundle`)).text();
3546
+ return await (await a(this, l, J).call(this, `built-in/${t}/bundle`)).text();
3465
3547
  }
3466
3548
  /**
3467
3549
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -3490,9 +3572,9 @@ const Se = class Se {
3490
3572
  * ```
3491
3573
  */
3492
3574
  async initBuiltInComponent(t, e, s) {
3493
- const n = await this.getBuiltInComponent(t.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), c = o.map((g) => i[g]), f = new Function(...o, `${n}
3494
- return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3495
- e.get(h);
3575
+ const n = await this.getBuiltInComponent(t.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), h = o.map((g) => i[g]), f = new Function(...o, `${n}
3576
+ return main;`)(...h), c = (f == null ? void 0 : f.componentDefinition) ?? f;
3577
+ e.get(c);
3496
3578
  }
3497
3579
  /**
3498
3580
  * Loads multiple built-in components in parallel.
@@ -3534,13 +3616,13 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3534
3616
  * ```
3535
3617
  */
3536
3618
  async setup(t, ...e) {
3537
- var o, c;
3619
+ var o, h;
3538
3620
  const s = t.OBC, n = t.BUI;
3539
3621
  if (!(s != null && s.Components))
3540
3622
  throw new Error("globals.OBC must include Components");
3541
3623
  if (!(n != null && n.Manager)) throw new Error("globals.BUI must include Manager");
3542
3624
  const i = new s.Components();
3543
- return n.Manager.init(), this.setBuiltInGlobals(t), await this.initBuiltInComponents(i, ...e), i.init(), (c = (o = this.context.appEventOrchestrator) == null ? void 0 : o.appLoaded) == null || c.call(o), { components: i };
3625
+ return n.Manager.init(), this.setBuiltInGlobals(t), await this.initBuiltInComponents(i, ...e), i.init(), (h = (o = this.context.appEventOrchestrator) == null ? void 0 : o.appLoaded) == null || h.call(o), { components: i };
3544
3626
  }
3545
3627
  /**
3546
3628
  * Reports an error to the platform via the {@link AppEventOrchestrator.appError} callback.
@@ -3561,12 +3643,12 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3561
3643
  const { folderId: e, ShowVersions: s, projectId: n } = t || {};
3562
3644
  return e ? await a(this, l, y).call(this, "GET", `${P}/${e}/items`, {
3563
3645
  query: {
3564
- itemType: Yt,
3646
+ itemType: Kt,
3565
3647
  ...s && { ShowVersions: s }
3566
3648
  }
3567
3649
  }) : await a(this, l, y).call(this, "GET", `${m}`, {
3568
3650
  query: {
3569
- itemType: Yt,
3651
+ itemType: Kt,
3570
3652
  ...s && { ShowVersions: s },
3571
3653
  ...n && { projectId: n }
3572
3654
  }
@@ -3579,7 +3661,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3579
3661
  */
3580
3662
  async createApp(t) {
3581
3663
  const { appProps: e } = t;
3582
- return await a(this, l, Pt).call(this, t, Yt, e);
3664
+ return await a(this, l, Bt).call(this, t, Kt, e);
3583
3665
  }
3584
3666
  /**
3585
3667
  * Downloads an app's full ZIP file. Returns the raw fetch Response.
@@ -3588,7 +3670,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3588
3670
  * @returns A fetch Response containing the ZIP data.
3589
3671
  */
3590
3672
  async downloadApp(t, e) {
3591
- return await a(this, l, Nt).call(this, t, e);
3673
+ return await a(this, l, Pt).call(this, t, e);
3592
3674
  }
3593
3675
  /**
3594
3676
  * Downloads only the JavaScript bundle from an app's ZIP.
@@ -3599,7 +3681,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3599
3681
  */
3600
3682
  async downloadAppBundle(t, e) {
3601
3683
  const { versionTag: s, withDraft: n } = e || {};
3602
- return await a(this, l, H).call(this, `${m}/${t}/download/bundle`, {
3684
+ return await a(this, l, J).call(this, `${m}/${t}/download/bundle`, {
3603
3685
  query: {
3604
3686
  ...s && { versionTag: s },
3605
3687
  ...n && { withDraft: n }
@@ -3623,7 +3705,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3623
3705
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
3624
3706
  */
3625
3707
  async getNpmCredentials() {
3626
- return await a(this, l, y).call(this, "GET", `${zr}/credentials`);
3708
+ return await a(this, l, y).call(this, "GET", `${Zr}/credentials`);
3627
3709
  }
3628
3710
  // ─── Execution ───────────────────────────────────────────────────
3629
3711
  /**
@@ -3642,7 +3724,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3642
3724
  */
3643
3725
  async executeComponent(t, e, s) {
3644
3726
  if (this.localServerUrl) {
3645
- const n = `${this.localServerUrl}/api/${G}/${t}/execute`, i = await fetch(n, {
3727
+ const n = `${this.localServerUrl}/api/${H}/${t}/execute`, i = await fetch(n, {
3646
3728
  method: "POST",
3647
3729
  headers: { "Content-Type": "application/json" },
3648
3730
  body: JSON.stringify(e)
@@ -3655,7 +3737,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3655
3737
  }
3656
3738
  return await i.json();
3657
3739
  }
3658
- return await a(this, l, y).call(this, "POST", `${G}/${t}/execute`, {
3740
+ return await a(this, l, y).call(this, "POST", `${H}/${t}/execute`, {
3659
3741
  body: JSON.stringify(e),
3660
3742
  query: { ...s && { versionTag: s } },
3661
3743
  contentType: "application/json"
@@ -3667,7 +3749,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3667
3749
  */
3668
3750
  async abortExecution(t) {
3669
3751
  if (this.localServerUrl) {
3670
- const e = `${this.localServerUrl}/api/${G}/progress/${t}/abort`, s = await fetch(e, { method: "POST" });
3752
+ const e = `${this.localServerUrl}/api/${H}/progress/${t}/abort`, s = await fetch(e, { method: "POST" });
3671
3753
  if (!s.ok) {
3672
3754
  const n = await s.text().catch(() => "");
3673
3755
  throw new Error(
@@ -3676,7 +3758,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3676
3758
  }
3677
3759
  return await s.json();
3678
3760
  }
3679
- return await a(this, l, y).call(this, "POST", `${G}/progress/${t}/abort`);
3761
+ return await a(this, l, y).call(this, "POST", `${H}/progress/${t}/abort`);
3680
3762
  }
3681
3763
  /**
3682
3764
  * Lists all executions for a given component.
@@ -3693,7 +3775,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3693
3775
  */
3694
3776
  async listExecutions(t, e) {
3695
3777
  if (this.localServerUrl) {
3696
- const s = e ? `?projectId=${encodeURIComponent(e)}` : "", n = `${this.localServerUrl}/api/${G}/${t}/progress${s}`, i = await fetch(n);
3778
+ const s = e ? `?projectId=${encodeURIComponent(e)}` : "", n = `${this.localServerUrl}/api/${H}/${t}/progress${s}`, i = await fetch(n);
3697
3779
  if (!i.ok) {
3698
3780
  const o = await i.text().catch(() => "");
3699
3781
  throw new Error(
@@ -3702,7 +3784,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3702
3784
  }
3703
3785
  return await i.json();
3704
3786
  }
3705
- return await a(this, l, y).call(this, "GET", `${G}/${t}/progress`, { query: { ...e && { projectId: e } } });
3787
+ return await a(this, l, y).call(this, "GET", `${H}/${t}/progress`, { query: { ...e && { projectId: e } } });
3706
3788
  }
3707
3789
  /**
3708
3790
  * Gets details of a specific execution, including its messages.
@@ -3711,7 +3793,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3711
3793
  */
3712
3794
  async getExecution(t) {
3713
3795
  if (this.localServerUrl) {
3714
- const e = `${this.localServerUrl}/api/${G}/progress/${t}`, s = await fetch(e);
3796
+ const e = `${this.localServerUrl}/api/${H}/progress/${t}`, s = await fetch(e);
3715
3797
  if (!s.ok) {
3716
3798
  const n = await s.text().catch(() => "");
3717
3799
  throw new Error(
@@ -3720,7 +3802,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3720
3802
  }
3721
3803
  return await s.json();
3722
3804
  }
3723
- return await a(this, l, y).call(this, "GET", `${G}/progress/${t}`);
3805
+ return await a(this, l, y).call(this, "GET", `${H}/progress/${t}`);
3724
3806
  }
3725
3807
  /**
3726
3808
  * Subscribes to real-time execution progress via WebSocket.
@@ -3729,7 +3811,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3729
3811
  * @param onUpdateCallback - Callback invoked on each progress/result event.
3730
3812
  */
3731
3813
  async onExecutionProgress(t, e) {
3732
- const s = this.localServerUrl ?? this.wsUrl, n = await wt(s, {
3814
+ const s = this.localServerUrl ?? this.wsUrl, n = await bt(s, {
3733
3815
  auth: { accessToken: this.accessToken },
3734
3816
  transports: ["websocket"]
3735
3817
  });
@@ -3748,7 +3830,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3748
3830
  * renderable views. See `src/core/documents.ts` for the model and schema.
3749
3831
  */
3750
3832
  documents(t) {
3751
- return new as(this, t);
3833
+ return new hs(this, t);
3752
3834
  }
3753
3835
  /**
3754
3836
  * A project's history of connected documents (Revit models, AutoCAD
@@ -3757,14 +3839,14 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3757
3839
  * or write it; the storage underneath is private and will move.
3758
3840
  */
3759
3841
  history(t) {
3760
- return new Gr(this, t);
3842
+ return new Yr(this, t);
3761
3843
  }
3762
3844
  /**
3763
3845
  * The recipe registry and runner: scripts that write change requests in a
3764
3846
  * native application's language. See `src/core/recipes.ts`.
3765
3847
  */
3766
3848
  get recipes() {
3767
- return u(this, vt) ?? _(this, vt, new Yr(this)), u(this, vt);
3849
+ return u(this, vt) ?? _(this, vt, new zr(this)), u(this, vt);
3768
3850
  }
3769
3851
  // ─── Hidden Files ────────────────────────────────────────────────
3770
3852
  /**
@@ -3819,7 +3901,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3819
3901
  * @param hiddenId - The hidden file's unique identifier.
3820
3902
  */
3821
3903
  async downloadHiddenFile(t) {
3822
- return await a(this, l, H).call(this, `${m}/${q}/${t}/download`);
3904
+ return await a(this, l, J).call(this, `${m}/${q}/${t}/download`);
3823
3905
  }
3824
3906
  /**
3825
3907
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -3860,7 +3942,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3860
3942
  * 900 (15 min) server-side; values are clamped to that range.
3861
3943
  */
3862
3944
  async getHiddenFileSignedUrlsBatch(t, e) {
3863
- return await a(this, l, gt).call(this, t, async (s) => (await a(this, l, y).call(this, "POST", `${m}/${q}/signed-url/batch`, {
3945
+ return await a(this, l, wt).call(this, t, async (s) => (await a(this, l, y).call(this, "POST", `${m}/${q}/signed-url/batch`, {
3864
3946
  body: JSON.stringify({
3865
3947
  hiddenFileIds: s,
3866
3948
  ...e != null && { expiresIn: e }
@@ -3905,7 +3987,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3905
3987
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
3906
3988
  */
3907
3989
  async getItemIcon(t) {
3908
- return await a(this, l, H).call(this, `${m}/${t}/icon`);
3990
+ return await a(this, l, J).call(this, `${m}/${t}/icon`);
3909
3991
  }
3910
3992
  /**
3911
3993
  * Removes the icon from an item.
@@ -3969,7 +4051,7 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
3969
4051
  */
3970
4052
  async listVersionsBatch(t, e = {}) {
3971
4053
  const { archived: s } = e;
3972
- return await a(this, l, gt).call(this, t, async (n) => (await a(this, l, y).call(this, "POST", `${m}/batch/versions`, {
4054
+ return await a(this, l, wt).call(this, t, async (n) => (await a(this, l, y).call(this, "POST", `${m}/batch/versions`, {
3973
4055
  body: JSON.stringify({
3974
4056
  itemIds: n,
3975
4057
  ...s !== void 0 && { archived: s }
@@ -4008,51 +4090,51 @@ return main;`)(...c), h = (f == null ? void 0 : f.componentDefinition) ?? f;
4008
4090
  return await a(this, l, y).call(this, "DELETE", `${m}/${encodeURIComponent(t)}/version/${encodeURIComponent(e)}`);
4009
4091
  }
4010
4092
  };
4011
- l = new WeakSet(), le = function(t) {
4093
+ l = new WeakSet(), ue = function(t) {
4012
4094
  return `${this.apiUrl}/${t}`;
4013
4095
  }, y = async function(t, e, s) {
4014
- const { body: n, query: i, contentType: o, retries: c, responseType: d, retryAttempt: f } = s || {}, h = a(this, l, le).call(this, e), g = a(this, l, fs).call(this, i), S = await this.resolveAccessToken(), dt = {
4096
+ const { body: n, query: i, contentType: o, retries: h, responseType: d, retryAttempt: f } = s || {}, c = a(this, l, ue).call(this, e), g = a(this, l, ms).call(this, i), v = await this.resolveAccessToken(), V = {
4015
4097
  ...g,
4016
- ...this.useBearer ? {} : { accessToken: S }
4098
+ ...this.useBearer ? {} : { accessToken: v }
4017
4099
  };
4018
4100
  try {
4019
4101
  const O = await fetch(
4020
- h + "?" + new URLSearchParams(dt).toString(),
4102
+ c + "?" + new URLSearchParams(V).toString(),
4021
4103
  {
4022
4104
  method: t,
4023
4105
  headers: {
4024
4106
  Accept: "application/json",
4025
4107
  ...o && { "Content-Type": o },
4026
- ...this.useBearer && { Authorization: `Bearer ${S}` }
4108
+ ...this.useBearer && { Authorization: `Bearer ${v}` }
4027
4109
  },
4028
4110
  ...n && { body: n }
4029
4111
  }
4030
4112
  );
4031
4113
  if (!O.ok) {
4032
- const k = await O.text().then((Z) => Z).catch(() => "");
4033
- throw new Te(
4114
+ const k = await O.text().then((et) => et).catch(() => "");
4115
+ throw new Se(
4034
4116
  O.status,
4035
4117
  O.statusText,
4036
4118
  k,
4037
- tn(O)
4119
+ rn(O)
4038
4120
  );
4039
4121
  }
4040
4122
  return d === "blob" ? await O.blob() : O.json().then((k) => k).catch(() => {
4041
4123
  });
4042
4124
  } catch (O) {
4043
- const k = c ?? this.retries;
4044
- if (k > 0 && en(O)) {
4045
- const Z = f ?? 0;
4046
- return await Zr(sn(O, Z)), await a(this, l, y).call(this, t, e, {
4125
+ const k = h ?? this.retries;
4126
+ if (k > 0 && nn(O)) {
4127
+ const et = f ?? 0;
4128
+ return await sn(on(O, et)), await a(this, l, y).call(this, t, e, {
4047
4129
  ...s,
4048
4130
  retries: k - 1,
4049
- retryAttempt: Z + 1
4131
+ retryAttempt: et + 1
4050
4132
  });
4051
4133
  }
4052
4134
  throw O;
4053
4135
  }
4054
- }, H = async function(t, e) {
4055
- const { query: s } = e || {}, n = a(this, l, le).call(this, t), i = await this.resolveAccessToken(), o = {
4136
+ }, J = async function(t, e) {
4137
+ const { query: s } = e || {}, n = a(this, l, ue).call(this, t), i = await this.resolveAccessToken(), o = {
4056
4138
  ...s,
4057
4139
  ...this.useBearer ? {} : { accessToken: i }
4058
4140
  };
@@ -4065,31 +4147,31 @@ l = new WeakSet(), le = function(t) {
4065
4147
  }
4066
4148
  }
4067
4149
  );
4068
- }, vt = new WeakMap(), gt = async function(t, e) {
4150
+ }, vt = new WeakMap(), wt = async function(t, e) {
4069
4151
  if (!t.length) return [];
4070
4152
  const s = [];
4071
- for (let i = 0; i < t.length; i += Me)
4072
- s.push(t.slice(i, i + Me));
4153
+ for (let i = 0; i < t.length; i += Ge)
4154
+ s.push(t.slice(i, i + Ge));
4073
4155
  return (await Promise.all(s.map(e))).flat();
4074
- }, Nt = async function(t, e) {
4156
+ }, Pt = async function(t, e) {
4075
4157
  const { versionTag: s, withDraft: n } = e || {};
4076
- return await a(this, l, H).call(this, `${m}/${t}/download`, {
4158
+ return await a(this, l, J).call(this, `${m}/${t}/download`, {
4077
4159
  query: {
4078
4160
  ...s && { versionTag: s },
4079
4161
  ...n && { withDraft: n }
4080
4162
  }
4081
4163
  });
4082
- }, Pt = async function(t, e, s) {
4083
- const { name: n, versionTag: i, parentFolderId: o, projectId: c, file: d, metadata: f } = t, h = new FormData();
4084
- return h.append("file", d), h.append("name", n), h.append("versionTag", i), h.append("itemType", e), o && h.append("folderId", o), c && h.append("projectId", c), s && h.append("extraProps", JSON.stringify(s)), f && h.append("metadata", JSON.stringify(f)), await a(this, l, y).call(this, "POST", m, {
4085
- body: h
4164
+ }, Bt = async function(t, e, s) {
4165
+ const { name: n, versionTag: i, parentFolderId: o, projectId: h, file: d, metadata: f } = t, c = new FormData();
4166
+ return c.append("file", d), c.append("name", n), c.append("versionTag", i), c.append("itemType", e), o && c.append("folderId", o), h && c.append("projectId", h), s && c.append("extraProps", JSON.stringify(s)), f && c.append("metadata", JSON.stringify(f)), await a(this, l, y).call(this, "POST", m, {
4167
+ body: c
4086
4168
  });
4087
- }, ue = async function(t, e, s) {
4088
- const { name: n, versionTag: i, parentFolderId: o, file: c, metadata: d } = e;
4089
- let f, h;
4090
- if (c) {
4169
+ }, de = async function(t, e, s) {
4170
+ const { name: n, versionTag: i, parentFolderId: o, file: h, metadata: d } = e;
4171
+ let f, c;
4172
+ if (h) {
4091
4173
  const g = new FormData();
4092
- g.append("file", c), i && g.append("versionTag", i), s && g.append("extraProps", JSON.stringify(s)), d && g.append("metadata", JSON.stringify(d)), h = await a(this, l, y).call(this, "POST", `${m}/${t}/version`, {
4174
+ g.append("file", h), i && g.append("versionTag", i), s && g.append("extraProps", JSON.stringify(s)), d && g.append("metadata", JSON.stringify(d)), c = await a(this, l, y).call(this, "POST", `${m}/${t}/version`, {
4093
4175
  body: g
4094
4176
  });
4095
4177
  }
@@ -4097,26 +4179,26 @@ l = new WeakSet(), le = function(t) {
4097
4179
  const g = {
4098
4180
  ...n && { name: n },
4099
4181
  ...o && { folderId: o }
4100
- }, S = JSON.stringify(g);
4182
+ }, v = JSON.stringify(g);
4101
4183
  f = await a(this, l, y).call(this, "PUT", `${m}/${t}`, {
4102
- body: S,
4184
+ body: v,
4103
4185
  contentType: "application/json"
4104
4186
  });
4105
4187
  }
4106
- return { item: f, version: h };
4107
- }, de = async function(t, e) {
4188
+ return { item: f, version: c };
4189
+ }, fe = async function(t, e) {
4108
4190
  const { showVersions: s = !1 } = e || {};
4109
4191
  return await a(this, l, y).call(this, "GET", `${m}/${t}`, {
4110
4192
  query: { showVersions: s }
4111
4193
  });
4112
- }, fs = function(t) {
4194
+ }, ms = function(t) {
4113
4195
  return t && Object.entries(t).filter(([, e]) => e !== void 0).reduce(
4114
4196
  (e, [s, n]) => (e[s] = n, e),
4115
4197
  {}
4116
4198
  );
4117
4199
  };
4118
- let he = Se;
4119
- function rn() {
4200
+ let le = Ie;
4201
+ function an() {
4120
4202
  if (typeof window > "u" || window.parent === window)
4121
4203
  throw new Error(
4122
4204
  "client.channel only works inside a That Open app, which runs in an iframe of the platform."
@@ -4131,24 +4213,24 @@ function rn() {
4131
4213
  }
4132
4214
  };
4133
4215
  }
4134
- const fe = "channel:", nn = 1e4;
4135
- function Bt(r) {
4216
+ const pe = "channel:", cn = 1e4;
4217
+ function Lt(r) {
4136
4218
  try {
4137
4219
  r();
4138
4220
  } catch (t) {
4139
4221
  console.error("[channel] a listener threw:", t);
4140
4222
  }
4141
4223
  }
4142
- var j, C, x, ot, at, ct, A, pe, ye, it;
4143
- class ps {
4224
+ var j, x, C, ct, ht, lt, A, ye, me, at;
4225
+ class gs {
4144
4226
  constructor(t, e) {
4145
4227
  b(this, A);
4146
4228
  b(this, j, !1);
4147
- b(this, C, []);
4148
4229
  b(this, x, []);
4149
- b(this, ot, /* @__PURE__ */ new Set());
4150
- b(this, at, /* @__PURE__ */ new Set());
4230
+ b(this, C, []);
4151
4231
  b(this, ct, /* @__PURE__ */ new Set());
4232
+ b(this, ht, /* @__PURE__ */ new Set());
4233
+ b(this, lt, /* @__PURE__ */ new Set());
4152
4234
  this.transport = t, this.controls = e;
4153
4235
  }
4154
4236
  /** Whether the platform has confirmed this tab is in the room. */
@@ -4157,54 +4239,54 @@ class ps {
4157
4239
  }
4158
4240
  /** Who else is in the room right now, as the platform last reported. */
4159
4241
  get peers() {
4160
- return u(this, C);
4242
+ return u(this, x);
4161
4243
  }
4162
4244
  /**
4163
4245
  * Enters the room. Resolves when the platform confirms; rejects if it
4164
4246
  * refuses or does not answer in time. Joining twice is harmless.
4165
4247
  */
4166
4248
  join() {
4167
- return u(this, j) ? Promise.resolve() : a(this, A, pe).call(this, "joined", this.controls.join);
4249
+ return u(this, j) ? Promise.resolve() : a(this, A, ye).call(this, "joined", this.controls.join);
4168
4250
  }
4169
4251
  /** Leaves the room. Handlers stay registered, so `join()` resumes them. */
4170
4252
  leave() {
4171
- return !u(this, j) && !u(this, x).some((t) => t.want === "joined") ? Promise.resolve() : a(this, A, pe).call(this, "left", this.controls.leave);
4253
+ return !u(this, j) && !u(this, C).some((t) => t.want === "joined") ? Promise.resolve() : a(this, A, ye).call(this, "left", this.controls.leave);
4172
4254
  }
4173
4255
  /** Fires when `joined` or `peers` changes. Returns a function that stops it. */
4174
4256
  onChange(t) {
4175
- return u(this, ot).add(t), () => void u(this, ot).delete(t);
4257
+ return u(this, ct).add(t), () => void u(this, ct).delete(t);
4176
4258
  }
4177
4259
  onPeerJoined(t) {
4178
- return u(this, at).add(t), () => void u(this, at).delete(t);
4260
+ return u(this, ht).add(t), () => void u(this, ht).delete(t);
4179
4261
  }
4180
4262
  onPeerLeft(t) {
4181
- return u(this, ct).add(t), () => void u(this, ct).delete(t);
4263
+ return u(this, lt).add(t), () => void u(this, lt).delete(t);
4182
4264
  }
4183
4265
  /** @internal */
4184
4266
  applyJoined() {
4185
- _(this, j, !0), a(this, A, ye).call(this, "joined"), a(this, A, it).call(this);
4267
+ _(this, j, !0), a(this, A, me).call(this, "joined"), a(this, A, at).call(this);
4186
4268
  }
4187
4269
  /** @internal */
4188
4270
  applyLeft() {
4189
- _(this, j, !1), _(this, C, []), a(this, A, ye).call(this, "left"), a(this, A, it).call(this);
4271
+ _(this, j, !1), _(this, x, []), a(this, A, me).call(this, "left"), a(this, A, at).call(this);
4190
4272
  }
4191
4273
  /** @internal */
4192
4274
  applyPeers(t) {
4193
- _(this, C, t), a(this, A, it).call(this);
4275
+ _(this, x, t), a(this, A, at).call(this);
4194
4276
  }
4195
4277
  /** @internal */
4196
4278
  applyPeerJoined(t) {
4197
- !u(this, j) || u(this, C).some((e) => e.from === t.from) || (_(this, C, [...u(this, C), t]), u(this, at).forEach((e) => Bt(() => e(t))), a(this, A, it).call(this));
4279
+ !u(this, j) || u(this, x).some((e) => e.from === t.from) || (_(this, x, [...u(this, x), t]), u(this, ht).forEach((e) => Lt(() => e(t))), a(this, A, at).call(this));
4198
4280
  }
4199
4281
  /** @internal */
4200
4282
  applyPeerLeft(t) {
4201
- const e = u(this, C).find((s) => s.from === t);
4202
- e && (_(this, C, u(this, C).filter((s) => s.from !== t)), u(this, ct).forEach((s) => Bt(() => s(e))), a(this, A, it).call(this));
4283
+ const e = u(this, x).find((s) => s.from === t);
4284
+ e && (_(this, x, u(this, x).filter((s) => s.from !== t)), u(this, lt).forEach((s) => Lt(() => s(e))), a(this, A, at).call(this));
4203
4285
  }
4204
4286
  /** @internal */
4205
4287
  failPending(t) {
4206
- const e = u(this, x);
4207
- return _(this, x, []), e.forEach((s) => {
4288
+ const e = u(this, C);
4289
+ return _(this, C, []), e.forEach((s) => {
4208
4290
  clearTimeout(s.timer), s.reject(t);
4209
4291
  }), e.length > 0;
4210
4292
  }
@@ -4212,77 +4294,77 @@ class ps {
4212
4294
  this.transport.post(t);
4213
4295
  }
4214
4296
  }
4215
- j = new WeakMap(), C = new WeakMap(), x = new WeakMap(), ot = new WeakMap(), at = new WeakMap(), ct = new WeakMap(), A = new WeakSet(), pe = function(t, e) {
4297
+ j = new WeakMap(), x = new WeakMap(), C = new WeakMap(), ct = new WeakMap(), ht = new WeakMap(), lt = new WeakMap(), A = new WeakSet(), ye = function(t, e) {
4216
4298
  return new Promise((s, n) => {
4217
4299
  const i = {
4218
4300
  want: t,
4219
4301
  resolve: s,
4220
4302
  reject: n,
4221
4303
  timer: setTimeout(() => {
4222
- _(this, x, u(this, x).filter((o) => o !== i)), n(
4304
+ _(this, C, u(this, C).filter((o) => o !== i)), n(
4223
4305
  new Error(
4224
4306
  `The platform did not confirm ${t === "joined" ? "joining" : "leaving"} in time.`
4225
4307
  )
4226
4308
  );
4227
- }, nn)
4309
+ }, cn)
4228
4310
  };
4229
- u(this, x).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...e });
4311
+ u(this, C).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...e });
4230
4312
  });
4231
- }, ye = function(t) {
4232
- const e = u(this, x).filter((s) => s.want === t);
4233
- _(this, x, u(this, x).filter((s) => s.want !== t)), e.forEach((s) => {
4313
+ }, me = function(t) {
4314
+ const e = u(this, C).filter((s) => s.want === t);
4315
+ _(this, C, u(this, C).filter((s) => s.want !== t)), e.forEach((s) => {
4234
4316
  clearTimeout(s.timer), s.resolve();
4235
4317
  });
4236
- }, it = function() {
4237
- u(this, ot).forEach((t) => Bt(t));
4318
+ }, at = function() {
4319
+ u(this, ct).forEach((t) => Lt(t));
4238
4320
  };
4239
- var ht;
4240
- class on extends ps {
4321
+ var ut;
4322
+ class hn extends gs {
4241
4323
  /** @internal Use `client.channel.collab()`. */
4242
4324
  constructor(e) {
4243
4325
  super(e, {
4244
4326
  join: { action: "joinCollab" },
4245
4327
  leave: { action: "leaveCollab" }
4246
4328
  });
4247
- b(this, ht, /* @__PURE__ */ new Map());
4329
+ b(this, ut, /* @__PURE__ */ new Map());
4248
4330
  }
4249
4331
  /**
4250
4332
  * Listens for an event other tabs send. Any number of listeners per event.
4251
4333
  * @returns a function that removes the listener.
4252
4334
  */
4253
4335
  on(e, s) {
4254
- const n = u(this, ht).get(e) ?? /* @__PURE__ */ new Set();
4255
- return n.add(s), u(this, ht).set(e, n), () => void n.delete(s);
4336
+ const n = u(this, ut).get(e) ?? /* @__PURE__ */ new Set();
4337
+ return n.add(s), u(this, ut).set(e, n), () => void n.delete(s);
4256
4338
  }
4257
4339
  /**
4258
4340
  * Sends an event to the other tabs in the room. Does nothing while this tab
4259
4341
  * is not in it, matching what the platform does with a message from outside.
4260
4342
  */
4261
4343
  send(e, s) {
4262
- if (e.startsWith(fe))
4263
- throw new Error(`Message types starting with '${fe}' are reserved.`);
4344
+ if (e.startsWith(pe))
4345
+ throw new Error(`Message types starting with '${pe}' are reserved.`);
4264
4346
  this.joined && this.post({ type: "APP_CHANNEL_PUBLISH", message: { type: e, payload: s } });
4265
4347
  }
4266
4348
  accepts(e) {
4267
4349
  return e === void 0 || e === "collab";
4268
4350
  }
4269
4351
  async handle(e) {
4270
- const s = u(this, ht).get(e.type);
4352
+ const s = u(this, ut).get(e.type);
4271
4353
  if (!(s != null && s.size)) return { handled: !1 };
4272
- const n = ys(e);
4273
- return s.forEach((i) => Bt(() => i(e.payload, n))), { handled: !0 };
4354
+ const n = ws(e);
4355
+ return s.forEach((i) => Lt(() => i(e.payload, n))), { handled: !0 };
4274
4356
  }
4275
4357
  }
4276
- ht = new WeakMap();
4277
- var Y;
4278
- class an extends ps {
4358
+ ut = new WeakMap();
4359
+ var W;
4360
+ class ln extends gs {
4279
4361
  /** @internal Use `client.channel.external(kind)`. */
4280
4362
  constructor(e, s) {
4281
4363
  super(e, {
4282
4364
  join: { action: "joinExternal", kind: s },
4283
4365
  leave: { action: "leaveExternal", kind: s }
4284
4366
  });
4285
- b(this, Y, /* @__PURE__ */ new Map());
4367
+ b(this, W, /* @__PURE__ */ new Map());
4286
4368
  this.kind = s;
4287
4369
  }
4288
4370
  /**
@@ -4296,24 +4378,24 @@ class an extends ps {
4296
4378
  * @returns a function that removes the handler.
4297
4379
  */
4298
4380
  on(e, s) {
4299
- if (u(this, Y).has(e))
4381
+ if (u(this, W).has(e))
4300
4382
  throw new Error(
4301
4383
  `"${e}" already has a handler in this room. Remove it first.`
4302
4384
  );
4303
- return u(this, Y).set(e, s), () => void u(this, Y).delete(e);
4385
+ return u(this, W).set(e, s), () => void u(this, W).delete(e);
4304
4386
  }
4305
4387
  accepts(e, s) {
4306
4388
  return e !== void 0 && e !== "external" ? !1 : this.kind === void 0 || e === void 0 || this.kind === s;
4307
4389
  }
4308
4390
  /** @internal Whether this room has any handler at all. */
4309
4391
  get hasHandlers() {
4310
- return u(this, Y).size > 0;
4392
+ return u(this, W).size > 0;
4311
4393
  }
4312
4394
  async handle(e) {
4313
- const s = u(this, Y).get(e.type);
4395
+ const s = u(this, W).get(e.type);
4314
4396
  if (!s) return { handled: !1 };
4315
4397
  try {
4316
- return { handled: !0, value: await s(e.payload, ys(e)) };
4398
+ return { handled: !0, value: await s(e.payload, ws(e)) };
4317
4399
  } catch (n) {
4318
4400
  return {
4319
4401
  handled: !0,
@@ -4322,8 +4404,8 @@ class an extends ps {
4322
4404
  }
4323
4405
  }
4324
4406
  }
4325
- Y = new WeakMap();
4326
- function ys(r) {
4407
+ W = new WeakMap();
4408
+ function ws(r) {
4327
4409
  return {
4328
4410
  from: r.from,
4329
4411
  at: r.at,
@@ -4331,7 +4413,7 @@ function ys(r) {
4331
4413
  kind: r.kind
4332
4414
  };
4333
4415
  }
4334
- function cn(r) {
4416
+ function un(r) {
4335
4417
  const t = r;
4336
4418
  if ((t == null ? void 0 : t.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
4337
4419
  const e = t.message;
@@ -4345,20 +4427,20 @@ function cn(r) {
4345
4427
  kind: typeof e.kind == "string" ? e.kind : void 0
4346
4428
  };
4347
4429
  }
4348
- var Q, Tt, M, W, K, v, me, Lt, ms, gs, ws, ge;
4349
- class hn {
4430
+ var Z, Tt, M, K, z, T, ge, Ft, bs, _s, Es, we;
4431
+ class dn {
4350
4432
  constructor(t) {
4351
- b(this, v);
4352
- b(this, Q);
4433
+ b(this, T);
4434
+ b(this, Z);
4353
4435
  b(this, Tt);
4354
4436
  b(this, M);
4355
- b(this, W, /* @__PURE__ */ new Map());
4356
- b(this, K, /* @__PURE__ */ new Set());
4357
- _(this, Q, t), _(this, Tt, t.listen((e) => void a(this, v, ms).call(this, e)));
4437
+ b(this, K, /* @__PURE__ */ new Map());
4438
+ b(this, z, /* @__PURE__ */ new Set());
4439
+ _(this, Z, t), _(this, Tt, t.listen((e) => void a(this, T, bs).call(this, e)));
4358
4440
  }
4359
4441
  /** The collaboration room for this app. Always the same instance. */
4360
4442
  collab() {
4361
- return u(this, M) ?? _(this, M, new on(u(this, Q))), u(this, M);
4443
+ return u(this, M) ?? _(this, M, new hn(u(this, Z))), u(this, M);
4362
4444
  }
4363
4445
  /**
4364
4446
  * The room for commands from this account's external tools of one `kind`
@@ -4367,71 +4449,71 @@ class hn {
4367
4449
  */
4368
4450
  external(t) {
4369
4451
  const e = t ?? "";
4370
- let s = u(this, W).get(e);
4371
- return s || (s = new an(u(this, Q), t), u(this, W).set(e, s)), s;
4452
+ let s = u(this, K).get(e);
4453
+ return s || (s = new ln(u(this, Z), t), u(this, K).set(e, s)), s;
4372
4454
  }
4373
4455
  /** Stops listening. For tests and teardown; an app normally never calls it. */
4374
4456
  dispose() {
4375
4457
  u(this, Tt).call(this);
4376
4458
  }
4377
4459
  }
4378
- Q = new WeakMap(), Tt = new WeakMap(), M = new WeakMap(), W = new WeakMap(), K = new WeakMap(), v = new WeakSet(), me = function() {
4379
- return [...u(this, M) ? [u(this, M)] : [], ...u(this, W).values()];
4380
- }, Lt = function(t, e) {
4460
+ Z = new WeakMap(), Tt = new WeakMap(), M = new WeakMap(), K = new WeakMap(), z = new WeakMap(), T = new WeakSet(), ge = function() {
4461
+ return [...u(this, M) ? [u(this, M)] : [], ...u(this, K).values()];
4462
+ }, Ft = function(t, e) {
4381
4463
  if (t === "collab") return u(this, M);
4382
4464
  if (t === "external")
4383
- return u(this, W).get(typeof e == "string" ? e : "");
4384
- }, ms = async function(t) {
4385
- const e = cn(t);
4465
+ return u(this, K).get(typeof e == "string" ? e : "");
4466
+ }, bs = async function(t) {
4467
+ const e = un(t);
4386
4468
  if (e) {
4387
- if (e.type.startsWith(fe)) {
4388
- a(this, v, gs).call(this, e);
4469
+ if (e.type.startsWith(pe)) {
4470
+ a(this, T, _s).call(this, e);
4389
4471
  return;
4390
4472
  }
4391
- await a(this, v, ws).call(this, e);
4473
+ await a(this, T, Es).call(this, e);
4392
4474
  }
4393
- }, gs = function(t) {
4475
+ }, _s = function(t) {
4394
4476
  var s, n, i;
4395
4477
  const e = t.payload ?? {};
4396
4478
  switch (t.type) {
4397
4479
  case "channel:joined":
4398
- (s = a(this, v, Lt).call(this, e.scope, e.kind)) == null || s.applyJoined();
4480
+ (s = a(this, T, Ft).call(this, e.scope, e.kind)) == null || s.applyJoined();
4399
4481
  break;
4400
4482
  case "channel:left":
4401
- (n = a(this, v, Lt).call(this, e.scope, e.kind)) == null || n.applyLeft();
4483
+ (n = a(this, T, Ft).call(this, e.scope, e.kind)) == null || n.applyLeft();
4402
4484
  break;
4403
4485
  case "channel:peers":
4404
- (i = a(this, v, Lt).call(this, e.scope, e.kind)) == null || i.applyPeers(e.peers ?? []);
4486
+ (i = a(this, T, Ft).call(this, e.scope, e.kind)) == null || i.applyPeers(e.peers ?? []);
4405
4487
  break;
4406
4488
  case "channel:peer-joined":
4407
4489
  case "channel:peer-left": {
4408
4490
  if (!e.from) break;
4409
- const o = e.scope === "collab" ? [u(this, M)] : [...u(this, W).values()].filter(
4410
- (c) => c.accepts("external", e.kind)
4491
+ const o = e.scope === "collab" ? [u(this, M)] : [...u(this, K).values()].filter(
4492
+ (h) => h.accepts("external", e.kind)
4411
4493
  );
4412
- for (const c of o)
4413
- t.type === "channel:peer-joined" ? c == null || c.applyPeerJoined({ from: e.from, kind: e.kind }) : c == null || c.applyPeerLeft(e.from);
4494
+ for (const h of o)
4495
+ t.type === "channel:peer-joined" ? h == null || h.applyPeerJoined({ from: e.from, kind: e.kind }) : h == null || h.applyPeerLeft(e.from);
4414
4496
  break;
4415
4497
  }
4416
4498
  case "channel:error": {
4417
4499
  const o = new Error(String(t.payload));
4418
- a(this, v, me).call(this).map((d) => d.failPending(o)).some(Boolean) || console.error("[channel] error:", t.payload);
4500
+ a(this, T, ge).call(this).map((d) => d.failPending(o)).some(Boolean) || console.error("[channel] error:", t.payload);
4419
4501
  break;
4420
4502
  }
4421
4503
  }
4422
- }, ws = async function(t) {
4423
- const e = a(this, v, me).call(this).filter((i) => i.accepts(t.scope, t.kind));
4504
+ }, Es = async function(t) {
4505
+ const e = a(this, T, ge).call(this).filter((i) => i.accepts(t.scope, t.kind));
4424
4506
  let s = !1;
4425
4507
  for (const i of e) {
4426
4508
  const o = await i.handle(t);
4427
- o.handled && (s = !0, t.requestId && a(this, v, ge).call(this, t.requestId, o));
4509
+ o.handled && (s = !0, t.requestId && a(this, T, we).call(this, t.requestId, o));
4428
4510
  }
4429
- t.requestId && t.scope === "external" && e.length > 0 && !s && a(this, v, ge).call(this, t.requestId, {
4511
+ t.requestId && t.scope === "external" && e.length > 0 && !s && a(this, T, we).call(this, t.requestId, {
4430
4512
  handled: !0,
4431
4513
  error: `No handler for "${t.type}".`
4432
4514
  });
4433
- }, ge = function(t, e) {
4434
- u(this, K).has(t) || (u(this, K).add(t), u(this, K).size > 500 && u(this, K).delete(u(this, K).values().next().value), u(this, Q).post({
4515
+ }, we = function(t, e) {
4516
+ u(this, z).has(t) || (u(this, z).add(t), u(this, z).size > 500 && u(this, z).delete(u(this, z).values().next().value), u(this, Z).post({
4435
4517
  type: "APP_CHANNEL_PUBLISH",
4436
4518
  message: {
4437
4519
  type: e.error === void 0 ? "reply" : "reply-error",
@@ -4440,9 +4522,9 @@ Q = new WeakMap(), Tt = new WeakMap(), M = new WeakMap(), W = new WeakMap(), K =
4440
4522
  }
4441
4523
  }));
4442
4524
  };
4443
- const X = "project", tt = "notifications";
4444
- var lt, St;
4445
- const Ie = class Ie extends he {
4525
+ const Q = "project", st = "notifications";
4526
+ var dt, St;
4527
+ const Oe = class Oe extends le {
4446
4528
  /**
4447
4529
  * @param token - A bearer JWT, OR a function returning the current JWT
4448
4530
  * (sync or async). When a function is passed, it's invoked before every
@@ -4453,12 +4535,12 @@ const Ie = class Ie extends he {
4453
4535
  */
4454
4536
  constructor(e, s, n) {
4455
4537
  super(typeof e == "string" ? e : "", s, { ...n, useBearer: !0 });
4456
- b(this, lt);
4538
+ b(this, dt);
4457
4539
  b(this, St);
4458
- typeof e == "function" && _(this, lt, e);
4540
+ typeof e == "function" && _(this, dt, e);
4459
4541
  }
4460
4542
  async resolveAccessToken() {
4461
- return u(this, lt) ? await u(this, lt).call(this) : super.resolveAccessToken();
4543
+ return u(this, dt) ? await u(this, dt).call(this) : super.resolveAccessToken();
4462
4544
  }
4463
4545
  /**
4464
4546
  * Creates a client from the platform context injected into
@@ -4467,7 +4549,7 @@ const Ie = class Ie extends he {
4467
4549
  * carries a fresh JWT on every navigation.
4468
4550
  */
4469
4551
  static fromPlatformContext(e) {
4470
- const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, n = new Ie(s.accessToken, s.apiUrl, e);
4552
+ const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, n = new Oe(s.accessToken, s.apiUrl, e);
4471
4553
  return n.context = s, n;
4472
4554
  }
4473
4555
  /**
@@ -4495,7 +4577,7 @@ const Ie = class Ie extends he {
4495
4577
  * ```
4496
4578
  */
4497
4579
  get channel() {
4498
- return u(this, St) ?? _(this, St, new hn(rn())), u(this, St);
4580
+ return u(this, St) ?? _(this, St, new dn(an())), u(this, St);
4499
4581
  }
4500
4582
  // ─── Projects (JWT-only backend routes) ──────────────────────────
4501
4583
  /**
@@ -4514,14 +4596,14 @@ const Ie = class Ie extends he {
4514
4596
  * ```
4515
4597
  */
4516
4598
  async listProjects() {
4517
- return await this.request("GET", X);
4599
+ return await this.request("GET", Q);
4518
4600
  }
4519
4601
  /**
4520
4602
  * Gets a project by ID. JWT-only — lives here because
4521
4603
  * `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
4522
4604
  */
4523
4605
  async getProject(e) {
4524
- return await this.request("GET", `${X}/${e}`);
4606
+ return await this.request("GET", `${Q}/${e}`);
4525
4607
  }
4526
4608
  /**
4527
4609
  * Gets the full project data (users, roles, files, folders) for a project.
@@ -4530,7 +4612,7 @@ const Ie = class Ie extends he {
4530
4612
  async getProjectData(e) {
4531
4613
  return await this.request(
4532
4614
  "GET",
4533
- `${X}/${e}/data`
4615
+ `${Q}/${e}/data`
4534
4616
  );
4535
4617
  }
4536
4618
  // ─── Account ──────────────────────────────────────────────────────
@@ -4555,7 +4637,7 @@ const Ie = class Ie extends he {
4555
4637
  async checkPermission(e) {
4556
4638
  return await this.request(
4557
4639
  "GET",
4558
- `${X}/permissions/check`,
4640
+ `${Q}/permissions/check`,
4559
4641
  { query: e }
4560
4642
  );
4561
4643
  }
@@ -4564,7 +4646,7 @@ const Ie = class Ie extends he {
4564
4646
  * single round-trip; results come back in the same order as `checks`.
4565
4647
  */
4566
4648
  async checkPermissionBatch(e) {
4567
- return (await this.request("POST", `${X}/permissions/check/batch`, {
4649
+ return (await this.request("POST", `${Q}/permissions/check/batch`, {
4568
4650
  body: JSON.stringify({ checks: e }),
4569
4651
  contentType: "application/json"
4570
4652
  })).results;
@@ -4592,7 +4674,7 @@ const Ie = class Ie extends he {
4592
4674
  * ```
4593
4675
  */
4594
4676
  async getNotifications(e) {
4595
- return await this.request("GET", tt, {
4677
+ return await this.request("GET", st, {
4596
4678
  query: {
4597
4679
  ...(e == null ? void 0 : e.cursor) !== void 0 && { cursor: e.cursor },
4598
4680
  ...(e == null ? void 0 : e.limit) !== void 0 && { limit: String(e.limit) }
@@ -4606,7 +4688,7 @@ const Ie = class Ie extends he {
4606
4688
  async getUnreadNotificationCount() {
4607
4689
  return (await this.request(
4608
4690
  "GET",
4609
- `${tt}/unread-count`
4691
+ `${st}/unread-count`
4610
4692
  )).count;
4611
4693
  }
4612
4694
  /**
@@ -4617,7 +4699,7 @@ const Ie = class Ie extends he {
4617
4699
  async markNotificationsRead(e) {
4618
4700
  return await this.request(
4619
4701
  "POST",
4620
- `${tt}/mark-read`,
4702
+ `${st}/mark-read`,
4621
4703
  {
4622
4704
  body: JSON.stringify({ ids: e }),
4623
4705
  contentType: "application/json"
@@ -4628,7 +4710,7 @@ const Ie = class Ie extends he {
4628
4710
  async markAllNotificationsRead() {
4629
4711
  return await this.request(
4630
4712
  "POST",
4631
- `${tt}/mark-all-read`
4713
+ `${st}/mark-all-read`
4632
4714
  );
4633
4715
  }
4634
4716
  /**
@@ -4638,7 +4720,7 @@ const Ie = class Ie extends he {
4638
4720
  async getNotificationSubscriptions() {
4639
4721
  return await this.request(
4640
4722
  "GET",
4641
- `${tt}/subscriptions`
4723
+ `${st}/subscriptions`
4642
4724
  );
4643
4725
  }
4644
4726
  /**
@@ -4652,7 +4734,7 @@ const Ie = class Ie extends he {
4652
4734
  async unsubscribeFromAutomation(e) {
4653
4735
  return await this.request(
4654
4736
  "DELETE",
4655
- `${tt}/subscriptions/${e}`
4737
+ `${st}/subscriptions/${e}`
4656
4738
  );
4657
4739
  }
4658
4740
  /**
@@ -4676,7 +4758,7 @@ const Ie = class Ie extends he {
4676
4758
  async subscribeToAutomation(e, s, n) {
4677
4759
  return await this.request(
4678
4760
  "POST",
4679
- `${X}/${e}/events/hooks/${s}/subscription`,
4761
+ `${Q}/${e}/events/hooks/${s}/subscription`,
4680
4762
  {
4681
4763
  body: JSON.stringify(n ?? {}),
4682
4764
  contentType: "application/json"
@@ -4693,7 +4775,7 @@ const Ie = class Ie extends he {
4693
4775
  async updateAutomationSubscription(e, s, n) {
4694
4776
  return await this.request(
4695
4777
  "PATCH",
4696
- `${X}/${e}/events/hooks/${s}/subscription`,
4778
+ `${Q}/${e}/events/hooks/${s}/subscription`,
4697
4779
  {
4698
4780
  body: JSON.stringify(n),
4699
4781
  contentType: "application/json"
@@ -4727,7 +4809,7 @@ const Ie = class Ie extends he {
4727
4809
  * ```
4728
4810
  */
4729
4811
  async onNotification(e) {
4730
- const s = await this.resolveAccessToken(), n = wt(`${this.socketOrigin}/notifications`, {
4812
+ const s = await this.resolveAccessToken(), n = bt(`${this.socketOrigin}/notifications`, {
4731
4813
  auth: { accessToken: s },
4732
4814
  transports: ["websocket"]
4733
4815
  });
@@ -4743,10 +4825,10 @@ const Ie = class Ie extends he {
4743
4825
  ), () => n.disconnect();
4744
4826
  }
4745
4827
  };
4746
- lt = new WeakMap(), St = new WeakMap();
4747
- let Ge = Ie;
4748
- const ln = "flow:", un = "flow:op", dn = "flow:source", fn = "revitflow/op@2", He = "REVITFLOWCHANGE", Je = "REVITFLOWOPERATION";
4749
- class wn {
4828
+ dt = new WeakMap(), St = new WeakMap();
4829
+ let Je = Oe;
4830
+ const fn = "flow:", pn = "flow:op", yn = "flow:source", mn = "revitflow/op@2", Ye = "REVITFLOWCHANGE", We = "REVITFLOWOPERATION";
4831
+ class En {
4750
4832
  constructor(t) {
4751
4833
  I(this, "changes", []);
4752
4834
  this.target = t;
@@ -4814,7 +4896,7 @@ class wn {
4814
4896
  "An operation with no changes is not an operation. Add at least one."
4815
4897
  );
4816
4898
  const e = {
4817
- schema: fn,
4899
+ schema: mn,
4818
4900
  opId: t,
4819
4901
  // Through the getters, so the envelope and the queue entry cannot drift
4820
4902
  // into disagreeing about the same operation.
@@ -4826,8 +4908,8 @@ class wn {
4826
4908
  ...this.userId ? { userId: this.userId } : {},
4827
4909
  title: this.title,
4828
4910
  summary: this.summary
4829
- }, [s, n] = await pn();
4830
- return yn(
4911
+ }, [s, n] = await gn();
4912
+ return wn(
4831
4913
  this.flatbuffer(s, n, t, JSON.stringify(e))
4832
4914
  );
4833
4915
  }
@@ -4836,8 +4918,8 @@ class wn {
4836
4918
  pack(t, e) {
4837
4919
  const s = {};
4838
4920
  for (const [n, i] of Object.entries(t ?? {}))
4839
- n.startsWith(ln) || (s[n] = String(i));
4840
- return e.position && (s.Position = e.position.map(Ye).join(",")), e.rotationDeg !== void 0 && (s.Rotation = Ye(e.rotationDeg)), e.source && (s[dn] = e.source), s;
4921
+ n.startsWith(fn) || (s[n] = String(i));
4922
+ return e.position && (s.Position = e.position.map(Ke).join(",")), e.rotationDeg !== void 0 && (s.Rotation = Ke(e.rotationDeg)), e.source && (s[yn] = e.source), s;
4841
4923
  }
4842
4924
  requireId(t, e) {
4843
4925
  if (!t || !t.trim())
@@ -4859,61 +4941,61 @@ class wn {
4859
4941
  * and rejects a falsy one.
4860
4942
  */
4861
4943
  flatbuffer(t, e, s, n) {
4862
- const { Attribute: i, Meshes: o, Model: c, SpatialStructure: d, Transform: f } = e, h = new t.Builder(1024), g = this.changes.length, S = new Uint32Array(g);
4863
- let dt = 1;
4864
- for (let T = 0; T < g; T++) S[T] = dt++;
4865
- const O = dt++, k = (T) => (T(h, 0), h.endVector()), Z = o.createShellsVector(h, []), bs = o.createCircleExtrusionsVector(h, []), _s = k(o.startSamplesVector), Es = k(o.startRepresentationsVector), vs = k(o.startMaterialsVector), Ts = k(o.startLocalTransformsVector), Ss = k(o.startGlobalTransformsVector), Is = o.createMeshesItemsVector(h, []), Os = o.createMaterialIdsVector(h, []), As = o.createRepresentationIdsVector(h, []), ks = o.createSampleIdsVector(h, []), Cs = o.createLocalTransformIdsVector(h, []), xs = o.createGlobalTransformIdsVector(h, []);
4866
- o.startMeshes(h), o.addCoordinates(h, f.createTransform(h, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(h, Ss), o.addShells(h, Z), o.addRepresentations(h, Es), o.addSamples(h, _s), o.addLocalTransforms(h, Ts), o.addMaterials(h, vs), o.addCircleExtrusions(h, bs), o.addMeshesItems(h, Is), o.addRepresentationIds(h, As), o.addSampleIds(h, ks), o.addMaterialIds(h, Os), o.addLocalTransformIds(h, Cs), o.addGlobalTransformIds(h, xs);
4867
- const Rs = o.endMeshes(h), $s = h.createString(n), Dt = /* @__PURE__ */ new Set(), Ut = [];
4868
- for (const T of this.changes) {
4869
- const V = [], Vs = {
4870
- [un]: T.op,
4871
- ...T.attrs
4944
+ const { Attribute: i, Meshes: o, Model: h, SpatialStructure: d, Transform: f } = e, c = new t.Builder(1024), g = this.changes.length, v = new Uint32Array(g);
4945
+ let V = 1;
4946
+ for (let S = 0; S < g; S++) v[S] = V++;
4947
+ const O = V++, k = (S) => (S(c, 0), c.endVector()), et = o.createShellsVector(c, []), vs = o.createCircleExtrusionsVector(c, []), Ts = k(o.startSamplesVector), Ss = k(o.startRepresentationsVector), Is = k(o.startMaterialsVector), Os = k(o.startLocalTransformsVector), As = k(o.startGlobalTransformsVector), ks = o.createMeshesItemsVector(c, []), xs = o.createMaterialIdsVector(c, []), Cs = o.createRepresentationIdsVector(c, []), Rs = o.createSampleIdsVector(c, []), $s = o.createLocalTransformIdsVector(c, []), Ns = o.createGlobalTransformIdsVector(c, []);
4948
+ o.startMeshes(c), o.addCoordinates(c, f.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, As), o.addShells(c, et), o.addRepresentations(c, Ss), o.addSamples(c, Ts), o.addLocalTransforms(c, Os), o.addMaterials(c, Is), o.addCircleExtrusions(c, vs), o.addMeshesItems(c, ks), o.addRepresentationIds(c, Cs), o.addSampleIds(c, Rs), o.addMaterialIds(c, xs), o.addLocalTransformIds(c, $s), o.addGlobalTransformIds(c, Ns);
4949
+ const Ps = o.endMeshes(c), Bs = c.createString(n), jt = /* @__PURE__ */ new Set(), Mt = [];
4950
+ for (const S of this.changes) {
4951
+ const G = [], Js = {
4952
+ [pn]: S.op,
4953
+ ...S.attrs
4872
4954
  };
4873
- for (const [Gs, Hs] of Object.entries(Vs)) {
4874
- const Ce = JSON.stringify([Gs, Hs, "IFCTEXT"]);
4875
- Dt.add(Ce), V.push(h.createString(Ce));
4955
+ for (const [Ys, Ws] of Object.entries(Js)) {
4956
+ const Ce = JSON.stringify([Ys, Ws, "IFCTEXT"]);
4957
+ jt.add(Ce), G.push(c.createString(Ce));
4876
4958
  }
4877
- Ut.push(
4878
- i.createAttribute(h, i.createDataVector(h, V))
4959
+ Mt.push(
4960
+ i.createAttribute(c, i.createDataVector(c, G))
4879
4961
  );
4880
4962
  }
4881
4963
  {
4882
- const T = JSON.stringify(["Name", s, "IFCLABEL"]);
4883
- Dt.add(T);
4884
- const V = i.createDataVector(h, [h.createString(T)]);
4885
- Ut.push(i.createAttribute(h, V));
4964
+ const S = JSON.stringify(["Name", s, "IFCLABEL"]);
4965
+ jt.add(S);
4966
+ const G = i.createDataVector(c, [c.createString(S)]);
4967
+ Mt.push(i.createAttribute(c, G));
4886
4968
  }
4887
- const Ns = c.createAttributesVector(h, Ut), Ps = c.createUniqueAttributesVector(
4888
- h,
4889
- [...Dt].map((T) => h.createString(T))
4890
- ), Oe = this.changes.map(
4891
- () => h.createString(He)
4969
+ const Ls = h.createAttributesVector(c, Mt), Fs = h.createUniqueAttributesVector(
4970
+ c,
4971
+ [...jt].map((S) => c.createString(S))
4972
+ ), Ae = this.changes.map(
4973
+ () => c.createString(Ye)
4892
4974
  );
4893
- Oe.push(h.createString(Je));
4894
- const Bs = c.createCategoriesVector(h, Oe), Ae = [], ke = [];
4895
- this.changes.forEach((T, V) => {
4896
- T.item && (Ae.push(h.createString(T.item)), ke.push(S[V]));
4975
+ Ae.push(c.createString(We));
4976
+ const qs = h.createCategoriesVector(c, Ae), ke = [], xe = [];
4977
+ this.changes.forEach((S, G) => {
4978
+ S.item && (ke.push(c.createString(S.item)), xe.push(v[G]));
4897
4979
  });
4898
- const Ls = c.createGuidsVector(h, Ae), Fs = c.createGuidsItemsVector(h, ke), qs = c.createLocalIdsVector(h, [...S, O]), Ds = this.changes.map(
4899
- (T, V) => d.createSpatialStructure(
4900
- h,
4901
- S[V],
4902
- h.createString(He),
4980
+ const Ds = h.createGuidsVector(c, ke), Us = h.createGuidsItemsVector(c, xe), js = h.createLocalIdsVector(c, [...v, O]), Ms = this.changes.map(
4981
+ (S, G) => d.createSpatialStructure(
4982
+ c,
4983
+ v[G],
4984
+ c.createString(Ye),
4903
4985
  0
4904
4986
  )
4905
- ), Us = d.createSpatialStructure(
4906
- h,
4987
+ ), Vs = d.createSpatialStructure(
4988
+ c,
4907
4989
  O,
4908
- h.createString(Je),
4909
- d.createChildrenVector(h, Ds)
4910
- ), js = h.createString(s);
4911
- c.startModel(h), c.addMeshes(h, Rs), c.addMetadata(h, $s), c.addAttributes(h, Ns), c.addUniqueAttributes(h, Ps), c.addLocalIds(h, qs), c.addCategories(h, Bs), c.addGuidsItems(h, Fs), c.addGuids(h, Ls), c.addGuid(h, js), c.addSpatialStructure(h, Us), c.addMaxLocalId(h, dt);
4912
- const Ms = c.endModel(h);
4913
- return c.finishModelBuffer(h, Ms), h.asUint8Array();
4990
+ c.createString(We),
4991
+ d.createChildrenVector(c, Ms)
4992
+ ), Gs = c.createString(s);
4993
+ h.startModel(c), h.addMeshes(c, Ps), h.addMetadata(c, Bs), h.addAttributes(c, Ls), h.addUniqueAttributes(c, Fs), h.addLocalIds(c, js), h.addCategories(c, qs), h.addGuidsItems(c, Us), h.addGuids(c, Ds), h.addGuid(c, Gs), h.addSpatialStructure(c, Vs), h.addMaxLocalId(c, V);
4994
+ const Hs = h.endModel(c);
4995
+ return h.finishModelBuffer(c, Hs), c.asUint8Array();
4914
4996
  }
4915
4997
  }
4916
- async function pn() {
4998
+ async function gn() {
4917
4999
  try {
4918
5000
  return await Promise.all([
4919
5001
  import("flatbuffers"),
@@ -4925,48 +5007,49 @@ async function pn() {
4925
5007
  );
4926
5008
  }
4927
5009
  }
4928
- function Ye(r) {
5010
+ function Ke(r) {
4929
5011
  return Number.isFinite(r) ? String(r) : "0";
4930
5012
  }
4931
- async function yn(r) {
5013
+ async function wn(r) {
4932
5014
  const t = new Blob([r]).stream().pipeThrough(new CompressionStream("deflate"));
4933
5015
  return new Uint8Array(await new Response(t).arrayBuffer());
4934
5016
  }
4935
- const bn = {
5017
+ const vn = {
4936
5018
  MAX_FIELDS: 200,
4937
5019
  MAX_KEY_LENGTH: 50,
4938
5020
  MAX_VALUE_LENGTH: 50
4939
- }, _n = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, En = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, vn = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, Tn = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, Sn = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, In = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, On = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, An = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, kn = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
5021
+ }, Tn = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Sn = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, In = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, On = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, An = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, kn = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, xn = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, Cn = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, Rn = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
4940
5022
  export {
4941
- _n as CDEManager,
4942
- hn as ChannelClient,
4943
- ps as ChannelRoom,
4944
- En as ClashesManager,
4945
- on as CollabRoom,
4946
- Le as DOCUMENT_FILE,
4947
- te as DOCUMENT_SCHEMA,
4948
- he as EngineServicesClient,
4949
- an as ExternalRoom,
4950
- vn as FileList,
4951
- Hr as FlowDoc,
4952
- Tn as GISManager,
4953
- Sn as GitHistoryManager,
4954
- In as HelloWorld,
4955
- bn as METADATA_LIMITS,
4956
- fn as OP_SCHEMA,
4957
- wn as OperationBuilder,
4958
- Ge as PlatformClient,
4959
- as as ProjectDocuments,
4960
- Gr as ProjectHistory,
4961
- On as ProjectManager,
4962
- Yr as Recipes,
4963
- Te as RequestError,
4964
- Me as STORAGE_BATCH_MAX,
4965
- qe as StaleHistoryError,
4966
- An as TopicsManager,
4967
- kn as UIManager,
4968
- ae as mintGuid,
4969
- ds as orderByGraph,
4970
- rn as windowTransport
5023
+ Tn as CDEManager,
5024
+ dn as ChannelClient,
5025
+ gs as ChannelRoom,
5026
+ Sn as ClashesManager,
5027
+ hn as CollabRoom,
5028
+ Fe as DOCUMENT_FILE,
5029
+ qt as DOCUMENT_SCHEMA,
5030
+ le as EngineServicesClient,
5031
+ ln as ExternalRoom,
5032
+ In as FileList,
5033
+ Wr as FlowDoc,
5034
+ On as GISManager,
5035
+ An as GitHistoryManager,
5036
+ kn as HelloWorld,
5037
+ vn as METADATA_LIMITS,
5038
+ mn as OP_SCHEMA,
5039
+ En as OperationBuilder,
5040
+ Je as PlatformClient,
5041
+ hs as ProjectDocuments,
5042
+ Yr as ProjectHistory,
5043
+ xn as ProjectManager,
5044
+ zr as Recipes,
5045
+ Se as RequestError,
5046
+ Gr as SELF_VIEWING_FORMATS,
5047
+ Ge as STORAGE_BATCH_MAX,
5048
+ Ue as StaleHistoryError,
5049
+ Cn as TopicsManager,
5050
+ Rn as UIManager,
5051
+ ce as mintGuid,
5052
+ ys as orderByGraph,
5053
+ an as windowTransport
4971
5054
  };
4972
5055
  //# sourceMappingURL=index.es.js.map