@thatopen/services 0.28.0 → 0.28.2

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,9 +1,9 @@
1
- var dn = Object.defineProperty;
1
+ var un = Object.defineProperty;
2
2
  var as = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var un = (n, e, t) => e in n ? dn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
- var B = (n, e, t) => un(n, typeof e != "symbol" ? e + "" : e, t), Tt = (n, e, t) => e.has(n) || as("Cannot " + t);
5
+ var fn = (n, e, t) => e in n ? un(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
+ var B = (n, e, t) => fn(n, typeof e != "symbol" ? e + "" : e, t), Tt = (n, e, t) => e.has(n) || as("Cannot " + t);
7
7
  var u = (n, e, t) => (Tt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), S = (n, e, t) => e.has(n) ? as("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), R = (n, e, t, s) => (Tt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), h = (n, e, t) => (Tt(n, e, "access private method"), t);
8
8
  const ne = /* @__PURE__ */ Object.create(null);
9
9
  ne.open = "0";
@@ -17,7 +17,7 @@ const lt = /* @__PURE__ */ Object.create(null);
17
17
  Object.keys(ne).forEach((n) => {
18
18
  lt[ne[n]] = n;
19
19
  });
20
- const Ct = { type: "error", data: "parser error" }, Rs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Cs = typeof ArrayBuffer == "function", $s = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, Zt = ({ type: n, data: e }, t, s) => Rs && e instanceof Blob ? t ? s(e) : cs(e, s) : Cs && (e instanceof ArrayBuffer || $s(e)) ? t ? s(e) : cs(new Blob([e]), s) : s(ne[n] + (e || "")), cs = (n, e) => {
20
+ const Ct = { type: "error", data: "parser error" }, Cs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", $s = typeof ArrayBuffer == "function", xs = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, Zt = ({ type: n, data: e }, t, s) => Cs && e instanceof Blob ? t ? s(e) : cs(e, s) : $s && (e instanceof ArrayBuffer || xs(e)) ? t ? s(e) : cs(new Blob([e]), s) : s(ne[n] + (e || "")), cs = (n, e) => {
21
21
  const t = new FileReader();
22
22
  return t.onload = function() {
23
23
  const s = t.result.split(",")[1];
@@ -28,10 +28,10 @@ function hs(n) {
28
28
  return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
29
29
  }
30
30
  let _t;
31
- function fn(n, e) {
32
- if (Rs && n.data instanceof Blob)
31
+ function pn(n, e) {
32
+ if (Cs && n.data instanceof Blob)
33
33
  return n.data.arrayBuffer().then(hs).then(e);
34
- if (Cs && (n.data instanceof ArrayBuffer || $s(n.data)))
34
+ if ($s && (n.data instanceof ArrayBuffer || xs(n.data)))
35
35
  return e(hs(n.data));
36
36
  Zt(n, !1, (t) => {
37
37
  _t || (_t = new TextEncoder()), e(_t.encode(t));
@@ -40,36 +40,36 @@ function fn(n, e) {
40
40
  const ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Je = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
41
41
  for (let n = 0; n < ls.length; n++)
42
42
  Je[ls.charCodeAt(n)] = n;
43
- const pn = (n) => {
43
+ const mn = (n) => {
44
44
  let e = n.length * 0.75, t = n.length, s, r = 0, i, o, a, l;
45
45
  n[n.length - 1] === "=" && (e--, n[n.length - 2] === "=" && e--);
46
46
  const d = new ArrayBuffer(e), c = new Uint8Array(d);
47
47
  for (s = 0; s < t; s += 4)
48
48
  i = Je[n.charCodeAt(s)], o = Je[n.charCodeAt(s + 1)], a = Je[n.charCodeAt(s + 2)], l = Je[n.charCodeAt(s + 3)], c[r++] = i << 2 | o >> 4, c[r++] = (o & 15) << 4 | a >> 2, c[r++] = (a & 3) << 6 | l & 63;
49
49
  return d;
50
- }, mn = typeof ArrayBuffer == "function", es = (n, e) => {
50
+ }, yn = typeof ArrayBuffer == "function", es = (n, e) => {
51
51
  if (typeof n != "string")
52
52
  return {
53
53
  type: "message",
54
- data: xs(n, e)
54
+ data: Ns(n, e)
55
55
  };
56
56
  const t = n.charAt(0);
57
57
  return t === "b" ? {
58
58
  type: "message",
59
- data: yn(n.substring(1), e)
59
+ data: gn(n.substring(1), e)
60
60
  } : lt[t] ? n.length > 1 ? {
61
61
  type: lt[t],
62
62
  data: n.substring(1)
63
63
  } : {
64
64
  type: lt[t]
65
65
  } : Ct;
66
- }, yn = (n, e) => {
67
- if (mn) {
68
- const t = pn(n);
69
- return xs(t, e);
66
+ }, gn = (n, e) => {
67
+ if (yn) {
68
+ const t = mn(n);
69
+ return Ns(t, e);
70
70
  } else
71
71
  return { base64: !0, data: n };
72
- }, xs = (n, e) => {
72
+ }, Ns = (n, e) => {
73
73
  switch (e) {
74
74
  case "blob":
75
75
  return n instanceof Blob ? n : new Blob([n]);
@@ -77,16 +77,16 @@ const pn = (n) => {
77
77
  default:
78
78
  return n instanceof ArrayBuffer ? n : n.buffer;
79
79
  }
80
- }, Ns = "", gn = (n, e) => {
80
+ }, Ps = "", wn = (n, e) => {
81
81
  const t = n.length, s = new Array(t);
82
82
  let r = 0;
83
83
  n.forEach((i, o) => {
84
84
  Zt(i, !1, (a) => {
85
- s[o] = a, ++r === t && e(s.join(Ns));
85
+ s[o] = a, ++r === t && e(s.join(Ps));
86
86
  });
87
87
  });
88
- }, wn = (n, e) => {
89
- const t = n.split(Ns), s = [];
88
+ }, bn = (n, e) => {
89
+ const t = n.split(Ps), s = [];
90
90
  for (let r = 0; r < t.length; r++) {
91
91
  const i = es(t[r], e);
92
92
  if (s.push(i), i.type === "error")
@@ -94,10 +94,10 @@ const pn = (n) => {
94
94
  }
95
95
  return s;
96
96
  };
97
- function bn() {
97
+ function vn() {
98
98
  return new TransformStream({
99
99
  transform(n, e) {
100
- fn(n, (t) => {
100
+ pn(n, (t) => {
101
101
  const s = t.length;
102
102
  let r;
103
103
  if (s < 126)
@@ -129,7 +129,7 @@ function ot(n, e) {
129
129
  t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
130
130
  return n.length && s < n[0].length && (n[0] = n[0].slice(s)), t;
131
131
  }
132
- function vn(n, e) {
132
+ function En(n, e) {
133
133
  It || (It = new TextDecoder());
134
134
  const t = [];
135
135
  let s = 0, r = -1, i = !1;
@@ -169,11 +169,11 @@ function vn(n, e) {
169
169
  }
170
170
  });
171
171
  }
172
- const Ps = 4;
172
+ const Bs = 4;
173
173
  function C(n) {
174
- if (n) return En(n);
174
+ if (n) return Tn(n);
175
175
  }
176
- function En(n) {
176
+ function Tn(n) {
177
177
  for (var e in C.prototype)
178
178
  n[e] = C.prototype[e];
179
179
  return n;
@@ -219,19 +219,19 @@ C.prototype.listeners = function(n) {
219
219
  C.prototype.hasListeners = function(n) {
220
220
  return !!this.listeners(n).length;
221
221
  };
222
- const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), V = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Tn = "arraybuffer";
223
- function Bs(n, ...e) {
222
+ const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), H = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), _n = "arraybuffer";
223
+ function Fs(n, ...e) {
224
224
  return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
225
225
  }
226
- const _n = V.setTimeout, In = V.clearTimeout;
226
+ const In = H.setTimeout, Sn = H.clearTimeout;
227
227
  function Et(n, e) {
228
- e.useNativeTimers ? (n.setTimeoutFn = _n.bind(V), n.clearTimeoutFn = In.bind(V)) : (n.setTimeoutFn = V.setTimeout.bind(V), n.clearTimeoutFn = V.clearTimeout.bind(V));
229
- }
230
- const Sn = 1.33;
231
- function kn(n) {
232
- return typeof n == "string" ? On(n) : Math.ceil((n.byteLength || n.size) * Sn);
228
+ e.useNativeTimers ? (n.setTimeoutFn = In.bind(H), n.clearTimeoutFn = Sn.bind(H)) : (n.setTimeoutFn = H.setTimeout.bind(H), n.clearTimeoutFn = H.clearTimeout.bind(H));
233
229
  }
230
+ const kn = 1.33;
234
231
  function On(n) {
232
+ return typeof n == "string" ? An(n) : Math.ceil((n.byteLength || n.size) * kn);
233
+ }
234
+ function An(n) {
235
235
  let e = 0, t = 0;
236
236
  for (let s = 0, r = n.length; s < r; s++)
237
237
  e = n.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4);
@@ -240,13 +240,13 @@ function On(n) {
240
240
  function Ls() {
241
241
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
242
242
  }
243
- function An(n) {
243
+ function Rn(n) {
244
244
  let e = "";
245
245
  for (let t in n)
246
246
  n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
247
247
  return e;
248
248
  }
249
- function Rn(n) {
249
+ function Cn(n) {
250
250
  let e = {}, t = n.split("&");
251
251
  for (let s = 0, r = t.length; s < r; s++) {
252
252
  let i = t[s].split("=");
@@ -254,7 +254,7 @@ function Rn(n) {
254
254
  }
255
255
  return e;
256
256
  }
257
- class Cn extends Error {
257
+ class $n extends Error {
258
258
  constructor(e, t, s) {
259
259
  super(e), this.description = t, this.context = s, this.type = "TransportError";
260
260
  }
@@ -279,7 +279,7 @@ class ts extends C {
279
279
  * @protected
280
280
  */
281
281
  onError(e, t, s) {
282
- return super.emitReserved("error", new Cn(e, t, s)), this;
282
+ return super.emitReserved("error", new $n(e, t, s)), this;
283
283
  }
284
284
  /**
285
285
  * Opens the transport.
@@ -353,11 +353,11 @@ class ts extends C {
353
353
  return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
354
354
  }
355
355
  _query(e) {
356
- const t = An(e);
356
+ const t = Rn(e);
357
357
  return t.length ? "?" + t : "";
358
358
  }
359
359
  }
360
- class $n extends ts {
360
+ class xn extends ts {
361
361
  constructor() {
362
362
  super(...arguments), this._polling = !1;
363
363
  }
@@ -413,7 +413,7 @@ class $n extends ts {
413
413
  return this.onClose({ description: "transport closed by the server" }), !1;
414
414
  this.onPacket(s);
415
415
  };
416
- wn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
416
+ bn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
417
417
  }
418
418
  /**
419
419
  * For polling, send a close packet.
@@ -433,7 +433,7 @@ class $n extends ts {
433
433
  * @protected
434
434
  */
435
435
  write(e) {
436
- this.writable = !1, gn(e, (t) => {
436
+ this.writable = !1, wn(e, (t) => {
437
437
  this.doWrite(t, () => {
438
438
  this.writable = !0, this.emitReserved("drain");
439
439
  });
@@ -449,15 +449,15 @@ class $n extends ts {
449
449
  return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Ls()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
450
450
  }
451
451
  }
452
- let Fs = !1;
452
+ let Ds = !1;
453
453
  try {
454
- Fs = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
454
+ Ds = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
455
455
  } catch {
456
456
  }
457
- const xn = Fs;
458
- function Nn() {
457
+ const Nn = Ds;
458
+ function Pn() {
459
459
  }
460
- class Pn extends $n {
460
+ class Bn extends xn {
461
461
  /**
462
462
  * XHR Polling constructor.
463
463
  *
@@ -516,7 +516,7 @@ class se extends C {
516
516
  */
517
517
  _create() {
518
518
  var e;
519
- const t = Bs(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
519
+ const t = Fs(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
520
520
  t.xdomain = !!this._opts.xd;
521
521
  const s = this._xhr = this.createRequest(t);
522
522
  try {
@@ -570,7 +570,7 @@ class se extends C {
570
570
  */
571
571
  _cleanup(e) {
572
572
  if (!(typeof this._xhr > "u" || this._xhr === null)) {
573
- if (this._xhr.onreadystatechange = Nn, e)
573
+ if (this._xhr.onreadystatechange = Pn, e)
574
574
  try {
575
575
  this._xhr.abort();
576
576
  } catch {
@@ -602,7 +602,7 @@ if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
603
  attachEvent("onunload", ds);
604
604
  else if (typeof addEventListener == "function") {
605
- const n = "onpagehide" in V ? "pagehide" : "unload";
605
+ const n = "onpagehide" in H ? "pagehide" : "unload";
606
606
  addEventListener(n, ds, !1);
607
607
  }
608
608
  }
@@ -610,42 +610,42 @@ function ds() {
610
610
  for (let n in se.requests)
611
611
  se.requests.hasOwnProperty(n) && se.requests[n].abort();
612
612
  }
613
- const Bn = function() {
614
- const n = Ds({
613
+ const Fn = function() {
614
+ const n = qs({
615
615
  xdomain: !1
616
616
  });
617
617
  return n && n.responseType !== null;
618
618
  }();
619
- class Ln extends Pn {
619
+ class Ln extends Bn {
620
620
  constructor(e) {
621
621
  super(e);
622
622
  const t = e && e.forceBase64;
623
- this.supportsBinary = Bn && !t;
623
+ this.supportsBinary = Fn && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new se(Ds, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new se(qs, this.uri(), e);
627
627
  }
628
628
  }
629
- function Ds(n) {
629
+ function qs(n) {
630
630
  const e = n.xdomain;
631
631
  try {
632
- if (typeof XMLHttpRequest < "u" && (!e || xn))
632
+ if (typeof XMLHttpRequest < "u" && (!e || Nn))
633
633
  return new XMLHttpRequest();
634
634
  } catch {
635
635
  }
636
636
  if (!e)
637
637
  try {
638
- return new V[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
638
+ return new H[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
639
639
  } catch {
640
640
  }
641
641
  }
642
- const qs = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
- class Fn extends ts {
642
+ const js = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
643
+ class Dn extends ts {
644
644
  get name() {
645
645
  return "websocket";
646
646
  }
647
647
  doOpen() {
648
- const e = this.uri(), t = this.opts.protocols, s = qs ? {} : Bs(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
648
+ const e = this.uri(), t = this.opts.protocols, s = js ? {} : Fs(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
649
649
  this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);
650
650
  try {
651
651
  this.ws = this.createSocket(e, t, s);
@@ -696,16 +696,16 @@ class Fn extends ts {
696
696
  return this.opts.timestampRequests && (t[this.opts.timestampParam] = Ls()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
697
697
  }
698
698
  }
699
- const St = V.WebSocket || V.MozWebSocket;
700
- class Dn extends Fn {
699
+ const St = H.WebSocket || H.MozWebSocket;
700
+ class qn extends Dn {
701
701
  createSocket(e, t, s) {
702
- return qs ? new St(e, t, s) : t ? new St(e, t) : new St(e);
702
+ return js ? new St(e, t, s) : t ? new St(e, t) : new St(e);
703
703
  }
704
704
  doWrite(e, t) {
705
705
  this.ws.send(t);
706
706
  }
707
707
  }
708
- class qn extends ts {
708
+ class jn extends ts {
709
709
  get name() {
710
710
  return "webtransport";
711
711
  }
@@ -721,7 +721,7 @@ class qn extends ts {
721
721
  this.onError("webtransport error", e);
722
722
  }), this._transport.ready.then(() => {
723
723
  this._transport.createBidirectionalStream().then((e) => {
724
- const t = vn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = bn();
724
+ const t = En(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = vn();
725
725
  r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
726
726
  const i = () => {
727
727
  s.read().then(({ done: a, value: l }) => {
@@ -751,11 +751,11 @@ class qn extends ts {
751
751
  (e = this._transport) === null || e === void 0 || e.close();
752
752
  }
753
753
  }
754
- const jn = {
755
- websocket: Dn,
756
- webtransport: qn,
754
+ const Un = {
755
+ websocket: qn,
756
+ webtransport: jn,
757
757
  polling: Ln
758
- }, Un = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Mn = [
758
+ }, Mn = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Vn = [
759
759
  "source",
760
760
  "protocol",
761
761
  "authority",
@@ -776,16 +776,16 @@ function $t(n) {
776
776
  throw "URI too long";
777
777
  const e = n, t = n.indexOf("["), s = n.indexOf("]");
778
778
  t != -1 && s != -1 && (n = n.substring(0, t) + n.substring(t, s).replace(/:/g, ";") + n.substring(s, n.length));
779
- let r = Un.exec(n || ""), i = {}, o = 14;
779
+ let r = Mn.exec(n || ""), i = {}, o = 14;
780
780
  for (; o--; )
781
- i[Mn[o]] = r[o] || "";
782
- return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Vn(i, i.path), i.queryKey = Hn(i, i.query), i;
781
+ i[Vn[o]] = r[o] || "";
782
+ return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Hn(i, i.path), i.queryKey = Gn(i, i.query), i;
783
783
  }
784
- function Vn(n, e) {
784
+ function Hn(n, e) {
785
785
  const t = /\/{2,9}/g, s = e.replace(t, "/").split("/");
786
786
  return (e.slice(0, 1) == "/" || e.length === 0) && s.splice(0, 1), e.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
787
787
  }
788
- function Hn(n, e) {
788
+ function Gn(n, e) {
789
789
  const t = {};
790
790
  return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
791
791
  r && (t[r] = i);
@@ -795,7 +795,7 @@ const xt = typeof addEventListener == "function" && typeof removeEventListener =
795
795
  xt && addEventListener("offline", () => {
796
796
  dt.forEach((n) => n());
797
797
  }, !1);
798
- class ge extends C {
798
+ class we extends C {
799
799
  /**
800
800
  * Socket constructor.
801
801
  *
@@ -803,7 +803,7 @@ class ge extends C {
803
803
  * @param {Object} opts - options
804
804
  */
805
805
  constructor(e, t) {
806
- if (super(), this.binaryType = Tn, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
806
+ if (super(), this.binaryType = _n, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
807
807
  const s = $t(e);
808
808
  t.hostname = s.host, t.secure = s.protocol === "https" || s.protocol === "wss", t.port = s.port, s.query && (t.query = s.query);
809
809
  } else t.host && (t.hostname = $t(t.host).host);
@@ -824,7 +824,7 @@ class ge extends C {
824
824
  },
825
825
  transportOptions: {},
826
826
  closeOnBeforeunload: !1
827
- }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Rn(this.opts.query)), xt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
827
+ }, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Cn(this.opts.query)), xt && (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 ge extends C {
841
841
  */
842
842
  createTransport(e) {
843
843
  const t = Object.assign({}, this.opts.query);
844
- t.EIO = Ps, t.transport = e, this.id && (t.sid = this.id);
844
+ t.EIO = Bs, t.transport = e, this.id && (t.sid = this.id);
845
845
  const s = Object.assign({}, this.opts, {
846
846
  query: t,
847
847
  socket: this,
@@ -863,7 +863,7 @@ class ge extends C {
863
863
  }, 0);
864
864
  return;
865
865
  }
866
- const e = this.opts.rememberUpgrade && ge.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
866
+ const e = this.opts.rememberUpgrade && we.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
867
867
  this.readyState = "opening";
868
868
  const t = this.createTransport(e);
869
869
  t.open(), this.setTransport(t);
@@ -882,7 +882,7 @@ class ge extends C {
882
882
  * @private
883
883
  */
884
884
  onOpen() {
885
- this.readyState = "open", ge.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
885
+ this.readyState = "open", we.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
886
886
  }
887
887
  /**
888
888
  * Handles a packet.
@@ -959,7 +959,7 @@ class ge extends C {
959
959
  let t = 1;
960
960
  for (let s = 0; s < this.writeBuffer.length; s++) {
961
961
  const r = this.writeBuffer[s].data;
962
- if (r && (t += kn(r)), s > 0 && t > this._maxPayload)
962
+ if (r && (t += On(r)), s > 0 && t > this._maxPayload)
963
963
  return this.writeBuffer.slice(0, s);
964
964
  t += 2;
965
965
  }
@@ -1046,7 +1046,7 @@ class ge extends C {
1046
1046
  * @private
1047
1047
  */
1048
1048
  _onError(e) {
1049
- if (ge.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1049
+ if (we.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", e), this._onClose("transport error", e);
1052
1052
  }
@@ -1065,8 +1065,8 @@ class ge extends C {
1065
1065
  }
1066
1066
  }
1067
1067
  }
1068
- ge.protocol = Ps;
1069
- class Gn extends ge {
1068
+ we.protocol = Bs;
1069
+ class Jn extends we {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -1083,14 +1083,14 @@ class Gn extends ge {
1083
1083
  */
1084
1084
  _probe(e) {
1085
1085
  let t = this.createTransport(e), s = !1;
1086
- ge.priorWebsocketSuccess = !1;
1086
+ we.priorWebsocketSuccess = !1;
1087
1087
  const r = () => {
1088
1088
  s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
1089
1089
  if (!s)
1090
1090
  if (m.type === "pong" && m.data === "probe") {
1091
1091
  if (this.upgrading = !0, this.emitReserved("upgrading", t), !t)
1092
1092
  return;
1093
- ge.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1093
+ we.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1094
1094
  s || this.readyState !== "closed" && (c(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1095
1095
  });
1096
1096
  } else {
@@ -1138,21 +1138,21 @@ class Gn extends ge {
1138
1138
  return t;
1139
1139
  }
1140
1140
  }
1141
- let Jn = class extends Gn {
1141
+ let Wn = class extends Jn {
1142
1142
  constructor(e, t = {}) {
1143
1143
  const s = typeof e == "object", r = s ? { ...e } : { ...t };
1144
- (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => jn[i]).filter((i) => !!i)), super(s ? r : e, r);
1144
+ (!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => Un[i]).filter((i) => !!i)), super(s ? r : e, r);
1145
1145
  }
1146
1146
  };
1147
- function Wn(n, e = "", t) {
1147
+ function Yn(n, e = "", t) {
1148
1148
  let s = n;
1149
1149
  t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = $t(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
1150
1150
  const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
1151
1151
  return s.id = s.protocol + "://" + i + ":" + s.port + e, s.href = s.protocol + "://" + i + (t && t.port === s.port ? "" : ":" + s.port), s;
1152
1152
  }
1153
- const Yn = typeof ArrayBuffer == "function", zn = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, js = Object.prototype.toString, Kn = typeof Blob == "function" || typeof Blob < "u" && js.call(Blob) === "[object BlobConstructor]", Xn = typeof File == "function" || typeof File < "u" && js.call(File) === "[object FileConstructor]";
1153
+ const zn = typeof ArrayBuffer == "function", Kn = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, Us = Object.prototype.toString, Xn = typeof Blob == "function" || typeof Blob < "u" && Us.call(Blob) === "[object BlobConstructor]", Qn = typeof File == "function" || typeof File < "u" && Us.call(File) === "[object FileConstructor]";
1154
1154
  function ss(n) {
1155
- return Yn && (n instanceof ArrayBuffer || zn(n)) || Kn && n instanceof Blob || Xn && n instanceof File;
1155
+ return zn && (n instanceof ArrayBuffer || Kn(n)) || Xn && n instanceof Blob || Qn && n instanceof File;
1156
1156
  }
1157
1157
  function ut(n, e) {
1158
1158
  if (!n || typeof n != "object")
@@ -1172,7 +1172,7 @@ function ut(n, e) {
1172
1172
  return !0;
1173
1173
  return !1;
1174
1174
  }
1175
- function Qn(n) {
1175
+ function Zn(n) {
1176
1176
  const e = [], t = n.data, s = n;
1177
1177
  return s.data = Nt(t, e), s.attachments = e.length, { packet: s, buffers: e };
1178
1178
  }
@@ -1195,7 +1195,7 @@ function Nt(n, e) {
1195
1195
  }
1196
1196
  return n;
1197
1197
  }
1198
- function Zn(n, e) {
1198
+ function er(n, e) {
1199
1199
  return n.data = Pt(n.data, e), delete n.attachments, n;
1200
1200
  }
1201
1201
  function Pt(n, e) {
@@ -1213,7 +1213,7 @@ function Pt(n, e) {
1213
1213
  Object.prototype.hasOwnProperty.call(n, t) && (n[t] = Pt(n[t], e));
1214
1214
  return n;
1215
1215
  }
1216
- const er = [
1216
+ const tr = [
1217
1217
  "connect",
1218
1218
  // used on the client side
1219
1219
  "connect_error",
@@ -1227,11 +1227,11 @@ const er = [
1227
1227
  "removeListener"
1228
1228
  // used by the Node.js EventEmitter
1229
1229
  ];
1230
- var v;
1230
+ var E;
1231
1231
  (function(n) {
1232
1232
  n[n.CONNECT = 0] = "CONNECT", n[n.DISCONNECT = 1] = "DISCONNECT", n[n.EVENT = 2] = "EVENT", n[n.ACK = 3] = "ACK", n[n.CONNECT_ERROR = 4] = "CONNECT_ERROR", n[n.BINARY_EVENT = 5] = "BINARY_EVENT", n[n.BINARY_ACK = 6] = "BINARY_ACK";
1233
- })(v || (v = {}));
1234
- class tr {
1233
+ })(E || (E = {}));
1234
+ class sr {
1235
1235
  /**
1236
1236
  * Encoder constructor
1237
1237
  *
@@ -1247,8 +1247,8 @@ class tr {
1247
1247
  * @param {Object} obj - packet object
1248
1248
  */
1249
1249
  encode(e) {
1250
- return (e.type === v.EVENT || e.type === v.ACK) && ut(e) ? this.encodeAsBinary({
1251
- type: e.type === v.EVENT ? v.BINARY_EVENT : v.BINARY_ACK,
1250
+ return (e.type === E.EVENT || e.type === E.ACK) && ut(e) ? this.encodeAsBinary({
1251
+ type: e.type === E.EVENT ? E.BINARY_EVENT : E.BINARY_ACK,
1252
1252
  nsp: e.nsp,
1253
1253
  data: e.data,
1254
1254
  id: e.id
@@ -1259,7 +1259,7 @@ class tr {
1259
1259
  */
1260
1260
  encodeAsString(e) {
1261
1261
  let t = "" + e.type;
1262
- return (e.type === v.BINARY_EVENT || e.type === v.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
1262
+ return (e.type === E.BINARY_EVENT || e.type === E.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
1263
1263
  }
1264
1264
  /**
1265
1265
  * Encode packet as 'buffer sequence' by removing blobs, and
@@ -1267,7 +1267,7 @@ class tr {
1267
1267
  * a list of buffers.
1268
1268
  */
1269
1269
  encodeAsBinary(e) {
1270
- const t = Qn(e), s = this.encodeAsString(t.packet), r = t.buffers;
1270
+ const t = Zn(e), s = this.encodeAsString(t.packet), r = t.buffers;
1271
1271
  return r.unshift(s), r;
1272
1272
  }
1273
1273
  }
@@ -1292,8 +1292,8 @@ class ns extends C {
1292
1292
  if (this.reconstructor)
1293
1293
  throw new Error("got plaintext data when reconstructing a packet");
1294
1294
  t = this.decodeString(e);
1295
- const s = t.type === v.BINARY_EVENT;
1296
- s || t.type === v.BINARY_ACK ? (t.type = s ? v.EVENT : v.ACK, this.reconstructor = new sr(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1295
+ const s = t.type === E.BINARY_EVENT;
1296
+ s || t.type === E.BINARY_ACK ? (t.type = s ? E.EVENT : E.ACK, this.reconstructor = new nr(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
1297
1297
  } else if (ss(e) || e.base64)
1298
1298
  if (this.reconstructor)
1299
1299
  t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
@@ -1313,9 +1313,9 @@ class ns extends C {
1313
1313
  const s = {
1314
1314
  type: Number(e.charAt(0))
1315
1315
  };
1316
- if (v[s.type] === void 0)
1316
+ if (E[s.type] === void 0)
1317
1317
  throw new Error("unknown packet type " + s.type);
1318
- if (s.type === v.BINARY_EVENT || s.type === v.BINARY_ACK) {
1318
+ if (s.type === E.BINARY_EVENT || s.type === E.BINARY_ACK) {
1319
1319
  const i = t + 1;
1320
1320
  for (; e.charAt(++t) !== "-" && t != e.length; )
1321
1321
  ;
@@ -1323,7 +1323,7 @@ class ns extends C {
1323
1323
  if (o != Number(o) || e.charAt(t) !== "-")
1324
1324
  throw new Error("Illegal attachments");
1325
1325
  const a = Number(o);
1326
- if (!nr(a) || a < 0)
1326
+ if (!rr(a) || a < 0)
1327
1327
  throw new Error("Illegal attachments");
1328
1328
  if (a > this.opts.maxAttachments)
1329
1329
  throw new Error("too many attachments");
@@ -1368,17 +1368,17 @@ class ns extends C {
1368
1368
  }
1369
1369
  static isPayloadValid(e, t) {
1370
1370
  switch (e) {
1371
- case v.CONNECT:
1371
+ case E.CONNECT:
1372
1372
  return us(t);
1373
- case v.DISCONNECT:
1373
+ case E.DISCONNECT:
1374
1374
  return t === void 0;
1375
- case v.CONNECT_ERROR:
1375
+ case E.CONNECT_ERROR:
1376
1376
  return typeof t == "string" || us(t);
1377
- case v.EVENT:
1378
- case v.BINARY_EVENT:
1379
- return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && er.indexOf(t[0]) === -1);
1380
- case v.ACK:
1381
- case v.BINARY_ACK:
1377
+ case E.EVENT:
1378
+ case E.BINARY_EVENT:
1379
+ return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && tr.indexOf(t[0]) === -1);
1380
+ case E.ACK:
1381
+ case E.BINARY_ACK:
1382
1382
  return Array.isArray(t);
1383
1383
  }
1384
1384
  }
@@ -1389,7 +1389,7 @@ class ns extends C {
1389
1389
  this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
1390
1390
  }
1391
1391
  }
1392
- class sr {
1392
+ class nr {
1393
1393
  constructor(e) {
1394
1394
  this.packet = e, this.buffers = [], this.reconPack = e;
1395
1395
  }
@@ -1403,7 +1403,7 @@ class sr {
1403
1403
  */
1404
1404
  takeBinaryData(e) {
1405
1405
  if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
1406
- const t = Zn(this.reconPack, this.buffers);
1406
+ const t = er(this.reconPack, this.buffers);
1407
1407
  return this.finishedReconstruction(), t;
1408
1408
  }
1409
1409
  return null;
@@ -1415,18 +1415,18 @@ class sr {
1415
1415
  this.reconPack = null, this.buffers = [];
1416
1416
  }
1417
1417
  }
1418
- const nr = Number.isInteger || function(n) {
1418
+ const rr = Number.isInteger || function(n) {
1419
1419
  return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
1420
1420
  };
1421
1421
  function us(n) {
1422
1422
  return Object.prototype.toString.call(n) === "[object Object]";
1423
1423
  }
1424
- const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1424
+ const ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1425
1425
  __proto__: null,
1426
1426
  Decoder: ns,
1427
- Encoder: tr,
1427
+ Encoder: sr,
1428
1428
  get PacketType() {
1429
- return v;
1429
+ return E;
1430
1430
  }
1431
1431
  }, Symbol.toStringTag, { value: "Module" }));
1432
1432
  function Y(n, e, t) {
@@ -1434,7 +1434,7 @@ function Y(n, e, t) {
1434
1434
  n.off(e, t);
1435
1435
  };
1436
1436
  }
1437
- const ir = Object.freeze({
1437
+ const or = Object.freeze({
1438
1438
  connect: 1,
1439
1439
  connect_error: 1,
1440
1440
  disconnect: 1,
@@ -1443,7 +1443,7 @@ const ir = Object.freeze({
1443
1443
  newListener: 1,
1444
1444
  removeListener: 1
1445
1445
  });
1446
- class Us extends C {
1446
+ class Ms extends C {
1447
1447
  /**
1448
1448
  * `Socket` constructor.
1449
1449
  */
@@ -1559,12 +1559,12 @@ class Us extends C {
1559
1559
  */
1560
1560
  emit(e, ...t) {
1561
1561
  var s, r, i;
1562
- if (ir.hasOwnProperty(e))
1562
+ if (or.hasOwnProperty(e))
1563
1563
  throw new Error('"' + e.toString() + '" is a reserved event name');
1564
1564
  if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
1565
1565
  return this._addToQueue(t), this;
1566
1566
  const o = {
1567
- type: v.EVENT,
1567
+ type: E.EVENT,
1568
1568
  data: t
1569
1569
  };
1570
1570
  if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
@@ -1672,7 +1672,7 @@ class Us extends C {
1672
1672
  */
1673
1673
  _sendConnectPacket(e) {
1674
1674
  this.packet({
1675
- type: v.CONNECT,
1675
+ type: E.CONNECT,
1676
1676
  data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, e) : e
1677
1677
  });
1678
1678
  }
@@ -1718,21 +1718,21 @@ class Us extends C {
1718
1718
  onpacket(e) {
1719
1719
  if (e.nsp === this.nsp)
1720
1720
  switch (e.type) {
1721
- case v.CONNECT:
1721
+ case E.CONNECT:
1722
1722
  e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
1723
1723
  break;
1724
- case v.EVENT:
1725
- case v.BINARY_EVENT:
1724
+ case E.EVENT:
1725
+ case E.BINARY_EVENT:
1726
1726
  this.onevent(e);
1727
1727
  break;
1728
- case v.ACK:
1729
- case v.BINARY_ACK:
1728
+ case E.ACK:
1729
+ case E.BINARY_ACK:
1730
1730
  this.onack(e);
1731
1731
  break;
1732
- case v.DISCONNECT:
1732
+ case E.DISCONNECT:
1733
1733
  this.ondisconnect();
1734
1734
  break;
1735
- case v.CONNECT_ERROR:
1735
+ case E.CONNECT_ERROR:
1736
1736
  this.destroy();
1737
1737
  const s = new Error(e.data.message);
1738
1738
  s.data = e.data.data, this.emitReserved("connect_error", s);
@@ -1767,7 +1767,7 @@ class Us extends C {
1767
1767
  let s = !1;
1768
1768
  return function(...r) {
1769
1769
  s || (s = !0, t.packet({
1770
- type: v.ACK,
1770
+ type: E.ACK,
1771
1771
  id: e,
1772
1772
  data: r
1773
1773
  }));
@@ -1836,7 +1836,7 @@ class Us extends C {
1836
1836
  * @return self
1837
1837
  */
1838
1838
  disconnect() {
1839
- return this.connected && this.packet({ type: v.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
1839
+ return this.connected && this.packet({ type: E.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
1840
1840
  }
1841
1841
  /**
1842
1842
  * Alias for {@link disconnect()}.
@@ -2035,10 +2035,10 @@ class Us extends C {
2035
2035
  }
2036
2036
  }
2037
2037
  }
2038
- function Fe(n) {
2038
+ function Le(n) {
2039
2039
  n = n || {}, this.ms = n.min || 100, this.max = n.max || 1e4, this.factor = n.factor || 2, this.jitter = n.jitter > 0 && n.jitter <= 1 ? n.jitter : 0, this.attempts = 0;
2040
2040
  }
2041
- Fe.prototype.duration = function() {
2041
+ Le.prototype.duration = function() {
2042
2042
  var n = this.ms * Math.pow(this.factor, this.attempts++);
2043
2043
  if (this.jitter) {
2044
2044
  var e = Math.random(), t = Math.floor(e * this.jitter * n);
@@ -2046,27 +2046,27 @@ Fe.prototype.duration = function() {
2046
2046
  }
2047
2047
  return Math.min(n, this.max) | 0;
2048
2048
  };
2049
- Fe.prototype.reset = function() {
2049
+ Le.prototype.reset = function() {
2050
2050
  this.attempts = 0;
2051
2051
  };
2052
- Fe.prototype.setMin = function(n) {
2052
+ Le.prototype.setMin = function(n) {
2053
2053
  this.ms = n;
2054
2054
  };
2055
- Fe.prototype.setMax = function(n) {
2055
+ Le.prototype.setMax = function(n) {
2056
2056
  this.max = n;
2057
2057
  };
2058
- Fe.prototype.setJitter = function(n) {
2058
+ Le.prototype.setJitter = function(n) {
2059
2059
  this.jitter = n;
2060
2060
  };
2061
2061
  class Bt extends C {
2062
2062
  constructor(e, t) {
2063
2063
  var s;
2064
- super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, Et(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Fe({
2064
+ super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, Et(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Le({
2065
2065
  min: this.reconnectionDelay(),
2066
2066
  max: this.reconnectionDelayMax(),
2067
2067
  jitter: this.randomizationFactor()
2068
2068
  }), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
2069
- const r = t.parser || rr;
2069
+ const r = t.parser || ir;
2070
2070
  this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
2071
2071
  }
2072
2072
  reconnection(e) {
@@ -2109,7 +2109,7 @@ class Bt extends C {
2109
2109
  open(e) {
2110
2110
  if (~this._readyState.indexOf("open"))
2111
2111
  return this;
2112
- this.engine = new Jn(this.uri, this.opts);
2112
+ this.engine = new Wn(this.uri, this.opts);
2113
2113
  const t = this.engine, s = this;
2114
2114
  this._readyState = "opening", this.skipReconnect = !1;
2115
2115
  const r = Y(t, "open", function() {
@@ -2199,7 +2199,7 @@ class Bt extends C {
2199
2199
  */
2200
2200
  socket(e, t) {
2201
2201
  let s = this.nsps[e];
2202
- return s ? this._autoConnect && !s.active && s.connect() : (s = new Us(this, e, t), this.nsps[e] = s), s;
2202
+ return s ? this._autoConnect && !s.active && s.connect() : (s = new Ms(this, e, t), this.nsps[e] = s), s;
2203
2203
  }
2204
2204
  /**
2205
2205
  * Called upon a socket close.
@@ -2299,17 +2299,17 @@ class Bt extends C {
2299
2299
  const Ge = {};
2300
2300
  function Ke(n, e) {
2301
2301
  typeof n == "object" && (e = n, n = void 0), e = e || {};
2302
- const t = Wn(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = Ge[r] && i in Ge[r].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2302
+ const t = Yn(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = Ge[r] && i in Ge[r].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
2303
2303
  let l;
2304
2304
  return a ? l = new Bt(s, e) : (Ge[r] || (Ge[r] = new Bt(s, e)), l = Ge[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
2305
2305
  }
2306
2306
  Object.assign(Ke, {
2307
2307
  Manager: Bt,
2308
- Socket: Us,
2308
+ Socket: Ms,
2309
2309
  io: Ke,
2310
2310
  connect: Ke
2311
2311
  });
2312
- const bt = "thatopen/document@1", fs = "document.json", or = [
2312
+ const bt = "thatopen/document@1", fs = "document.json", ar = [
2313
2313
  "pdf",
2314
2314
  "txt",
2315
2315
  "md",
@@ -2321,8 +2321,8 @@ const bt = "thatopen/document@1", fs = "document.json", or = [
2321
2321
  function at(n) {
2322
2322
  return String(n._id ?? n.id ?? "");
2323
2323
  }
2324
- var ke, Vs, Lt;
2325
- class Ms {
2324
+ var ke, Hs, Ft;
2325
+ class Vs {
2326
2326
  constructor(e, t) {
2327
2327
  S(this, ke);
2328
2328
  this.client = e, this.projectId = t;
@@ -2363,7 +2363,7 @@ class Ms {
2363
2363
  this.projectId
2364
2364
  ), l = at(a);
2365
2365
  await this.client.updateFile(e, { parentFolderId: l });
2366
- const d = [], c = await h(this, ke, Vs).call(this, s);
2366
+ const d = [], c = await h(this, ke, Hs).call(this, s);
2367
2367
  if (c)
2368
2368
  try {
2369
2369
  const A = await this.client.getFile(c);
@@ -2373,7 +2373,7 @@ class Ms {
2373
2373
  });
2374
2374
  } catch {
2375
2375
  }
2376
- ((t == null ? void 0 : t.selfView) ?? or.includes(i)) && d.push({ fileId: e, format: i });
2376
+ ((t == null ? void 0 : t.selfView) ?? ar.includes(i)) && d.push({ fileId: e, format: i });
2377
2377
  const T = {
2378
2378
  schema: bt,
2379
2379
  name: o,
@@ -2387,7 +2387,7 @@ class Ms {
2387
2387
  * has none yet (an old folder, or a plain folder that is not a document).
2388
2388
  */
2389
2389
  async descriptor(e) {
2390
- const t = await h(this, ke, Lt).call(this, e);
2390
+ const t = await h(this, ke, Ft).call(this, e);
2391
2391
  if (!t) return null;
2392
2392
  const r = await (await this.client.downloadFile(t.id)).text();
2393
2393
  if (!r.trim()) return null;
@@ -2397,7 +2397,7 @@ class Ms {
2397
2397
  } catch {
2398
2398
  return null;
2399
2399
  }
2400
- return ar(i);
2400
+ return cr(i);
2401
2401
  }
2402
2402
  /**
2403
2403
  * The first view whose format appears in `formats` — searched in the ORDER
@@ -2439,7 +2439,7 @@ class Ms {
2439
2439
  views: t.views ?? []
2440
2440
  }, r = new Blob([JSON.stringify(s)], {
2441
2441
  type: "application/json"
2442
- }), i = await h(this, ke, Lt).call(this, e);
2442
+ }), i = await h(this, ke, Ft).call(this, e);
2443
2443
  if (i) {
2444
2444
  await this.client.updateFile(i.id, {
2445
2445
  file: r,
@@ -2456,7 +2456,7 @@ class Ms {
2456
2456
  });
2457
2457
  }
2458
2458
  }
2459
- ke = new WeakSet(), Vs = async function(e) {
2459
+ ke = new WeakSet(), Hs = async function(e) {
2460
2460
  const t = [...e.versions ?? []].sort(
2461
2461
  (s, r) => String(r.createdAt ?? "").localeCompare(String(s.createdAt ?? ""))
2462
2462
  );
@@ -2469,7 +2469,7 @@ ke = new WeakSet(), Vs = async function(e) {
2469
2469
  if (typeof i == "string" && i) return i;
2470
2470
  } catch {
2471
2471
  }
2472
- }, Lt = async function(e) {
2472
+ }, Ft = async function(e) {
2473
2473
  const s = (await this.client.listFiles({ folderId: e })).find(
2474
2474
  (r) => String(r.name ?? "") === fs
2475
2475
  );
@@ -2481,7 +2481,7 @@ function ms(n, e) {
2481
2481
  const s = n.lastIndexOf(".");
2482
2482
  return s > 0 ? n.slice(s + 1).toLowerCase() : "";
2483
2483
  }
2484
- function ar(n) {
2484
+ function cr(n) {
2485
2485
  if (!n || typeof n != "object") return null;
2486
2486
  const e = n;
2487
2487
  if (e.schema !== bt || typeof e.name != "string") return null;
@@ -2502,15 +2502,21 @@ class ys extends Error {
2502
2502
  ), this.expectedGuid = e, this.actualGuid = t, this.name = "StaleHistoryError";
2503
2503
  }
2504
2504
  }
2505
- const gs = "bimterop", Ft = "revitflow_history.json", Re = "revitflow_ops.json", ws = "revitflow/ops@1", Hs = "revitflow_model.frag", Gs = "revitflow_", cr = "bimterop-locks-anchor", ct = () => `v-${Date.now()}`;
2506
- function Js(n, e) {
2505
+ const gs = "bimterop", Lt = "revitflow_history.json", Re = "revitflow_ops.json", ws = "revitflow/ops@1", Gs = "revitflow_model.frag", Js = "revitflow_", hr = "bimterop-locks-anchor", ct = () => `v-${Date.now()}`;
2506
+ function Ws(n, e) {
2507
2507
  return n.filter((t) => String(t.parentId ?? "") === e);
2508
2508
  }
2509
+ function bs(n) {
2510
+ const e = n == null ? void 0 : n.hiddenFileId;
2511
+ if (typeof e != "string" || !e)
2512
+ throw new Error("The hidden-file upload answered without a hiddenFileId.");
2513
+ return e;
2514
+ }
2509
2515
  function te(n) {
2510
2516
  return String(n._id ?? n.id ?? "");
2511
2517
  }
2512
2518
  var W, Xe, Dt;
2513
- class hr {
2519
+ class lr {
2514
2520
  constructor(e, t) {
2515
2521
  S(this, Xe);
2516
2522
  S(this, W);
@@ -2524,16 +2530,16 @@ class hr {
2524
2530
  parentFolderId: e,
2525
2531
  projectId: this.projectId
2526
2532
  }), s = [];
2527
- for (const r of Js(t, e)) {
2533
+ for (const r of Ws(t, e)) {
2528
2534
  const i = String(r.name ?? ""), o = i.indexOf("-");
2529
2535
  if (o <= 0) continue;
2530
2536
  const l = (await this.client.listFiles({
2531
2537
  folderId: te(r)
2532
2538
  })).map(
2533
2539
  (m) => String(m.name ?? "")
2534
- ), d = l.find((m) => m === Hs) ?? l.find(
2535
- (m) => m.endsWith(".frag") && !m.startsWith(Gs)
2536
- ), c = l.includes(Ft) || l.includes(Re) || !!d;
2540
+ ), d = l.find((m) => m === Gs) ?? l.find(
2541
+ (m) => m.endsWith(".frag") && !m.startsWith(Js)
2542
+ ), c = l.includes(Lt) || l.includes(Re) || !!d;
2537
2543
  s.push({
2538
2544
  source: i.slice(0, o),
2539
2545
  docId: i.slice(o + 1),
@@ -2546,7 +2552,7 @@ class hr {
2546
2552
  }
2547
2553
  /** One document's history. `source` and `docId` as {@link docs} lists them. */
2548
2554
  doc(e, t) {
2549
- return new lr(this.client, this, e, t);
2555
+ return new dr(this.client, this, e, t);
2550
2556
  }
2551
2557
  /** @internal The `bimterop` folder id, resolved once. */
2552
2558
  async rootFolderId(e = !1) {
@@ -2571,11 +2577,11 @@ W = new WeakMap(), Xe = new WeakSet(), Dt = async function() {
2571
2577
  );
2572
2578
  return t && R(this, W, te(t)), u(this, W);
2573
2579
  };
2574
- var oe, p, ie, Ce, ee, qt, We, de, jt, ft, Ye, pt, Ut, Ws;
2575
- class lr {
2580
+ var ae, p, oe, Ce, ee, qt, We, ue, jt, ft, Ye, pt, Ut, Ys;
2581
+ class dr {
2576
2582
  constructor(e, t, s, r) {
2577
2583
  S(this, p);
2578
- S(this, oe);
2584
+ S(this, ae);
2579
2585
  this.client = e, this.project = t, this.source = s, this.docId = r;
2580
2586
  }
2581
2587
  // ─── Reading ───────────────────────────────────────────────────────────────
@@ -2586,7 +2592,7 @@ class lr {
2586
2592
  */
2587
2593
  async timeline() {
2588
2594
  const e = await h(this, p, ft).call(this);
2589
- return Ys((e == null ? void 0 : e.commits) ?? []);
2595
+ return zs((e == null ? void 0 : e.commits) ?? []);
2590
2596
  }
2591
2597
  /** The head of the timeline, or null before the first sync. */
2592
2598
  async latest() {
@@ -2612,7 +2618,7 @@ class lr {
2612
2618
  * {@link modelParts} and compose.
2613
2619
  */
2614
2620
  async model() {
2615
- const e = await h(this, p, de).call(this);
2621
+ const e = await h(this, p, ue).call(this);
2616
2622
  if (!e)
2617
2623
  throw new Error(
2618
2624
  `Document ${this.source}-${this.docId} has no model file yet.`
@@ -2654,7 +2660,7 @@ class lr {
2654
2660
  i = c;
2655
2661
  break;
2656
2662
  }
2657
- const o = await h(this, p, de).call(this);
2663
+ const o = await h(this, p, ue).call(this);
2658
2664
  if (!o)
2659
2665
  throw new Error(
2660
2666
  `Document ${this.source}-${this.docId} has no model file yet.`
@@ -2685,7 +2691,7 @@ class lr {
2685
2691
  * not carry one yet — an old folder from before descriptors existed.
2686
2692
  */
2687
2693
  async descriptor() {
2688
- return await u(this, p, ie).descriptor(await h(this, p, ee).call(this, !1));
2694
+ return await u(this, p, oe).descriptor(await h(this, p, ee).call(this, !1));
2689
2695
  }
2690
2696
  /**
2691
2697
  * The first view whose format appears in `formats`, searched in the order
@@ -2693,7 +2699,7 @@ class lr {
2693
2699
  * model .frag on a descriptor-less folder, so old documents keep viewing.
2694
2700
  */
2695
2701
  async view(e) {
2696
- const t = await h(this, p, ee).call(this, !1), s = await u(this, p, ie).descriptor(t);
2702
+ const t = await h(this, p, ee).call(this, !1), s = await u(this, p, oe).descriptor(t);
2697
2703
  if (s) {
2698
2704
  for (const i of e) {
2699
2705
  const o = s.views.find((a) => a.format === i);
@@ -2702,7 +2708,7 @@ class lr {
2702
2708
  return null;
2703
2709
  }
2704
2710
  if (!e.includes("frag")) return null;
2705
- const r = await h(this, p, de).call(this);
2711
+ const r = await h(this, p, ue).call(this);
2706
2712
  return r ? { fileId: r.id, format: "frag" } : null;
2707
2713
  }
2708
2714
  /**
@@ -2712,12 +2718,12 @@ class lr {
2712
2718
  */
2713
2719
  async addView(e) {
2714
2720
  const t = await h(this, p, ee).call(this, !0);
2715
- if (await u(this, p, ie).descriptor(t)) {
2716
- await u(this, p, ie).addView(t, e);
2721
+ if (await u(this, p, oe).descriptor(t)) {
2722
+ await u(this, p, oe).addView(t, e);
2717
2723
  return;
2718
2724
  }
2719
- const r = await h(this, p, de).call(this);
2720
- await u(this, p, ie).setDescriptor(t, {
2725
+ const r = await h(this, p, ue).call(this);
2726
+ await u(this, p, oe).setDescriptor(t, {
2721
2727
  name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? u(this, p, Ce),
2722
2728
  views: [e]
2723
2729
  });
@@ -2731,15 +2737,15 @@ class lr {
2731
2737
  * model file).
2732
2738
  */
2733
2739
  async ensureDescriptor() {
2734
- const e = await h(this, p, ee).call(this, !1), t = await u(this, p, ie).descriptor(e);
2740
+ const e = await h(this, p, ee).call(this, !1), t = await u(this, p, oe).descriptor(e);
2735
2741
  if (t) return t;
2736
- const s = await h(this, p, de).call(this);
2742
+ const s = await h(this, p, ue).call(this);
2737
2743
  if (!s) return null;
2738
2744
  const r = {
2739
2745
  name: s.name.replace(/\.frag$/, ""),
2740
2746
  views: [{ fileId: s.id, format: "frag" }]
2741
2747
  };
2742
- return await u(this, p, ie).setDescriptor(e, r), await u(this, p, ie).descriptor(e);
2748
+ return await u(this, p, oe).setDescriptor(e, r), await u(this, p, oe).descriptor(e);
2743
2749
  }
2744
2750
  // ─── Ownership (element locks) ─────────────────────────────────────────────
2745
2751
  /**
@@ -2750,7 +2756,7 @@ class lr {
2750
2756
  * claims counts only for the earliest one, matching the plugins' rule.
2751
2757
  */
2752
2758
  async ownership() {
2753
- const e = await h(this, p, We).call(this, cr);
2759
+ const e = await h(this, p, We).call(this, hr);
2754
2760
  if (!e) return [];
2755
2761
  const t = await this.client.getHiddenFilesByParent(e.id), s = await Promise.all(
2756
2762
  t.map(async (o) => {
@@ -2792,7 +2798,7 @@ class lr {
2792
2798
  model: this.docId,
2793
2799
  commits: []
2794
2800
  };
2795
- const r = bs(s.commits);
2801
+ const r = vs(s.commits);
2796
2802
  if (e.expectedLatestGuid !== void 0 && (r == null ? void 0 : r.guid) !== e.expectedLatestGuid)
2797
2803
  throw new ys(e.expectedLatestGuid, r == null ? void 0 : r.guid);
2798
2804
  const i = {
@@ -2805,10 +2811,10 @@ class lr {
2805
2811
  ...e.userId ? { userId: e.userId } : {},
2806
2812
  ...(a = e.appliedOps) != null && a.length ? { appliedOps: e.appliedOps } : {},
2807
2813
  changes: e.changes,
2808
- counts: dr(e.changes)
2814
+ counts: ur(e.changes)
2809
2815
  };
2810
- if (e.model && (await h(this, p, Ws).call(this, t, e.model), i.full = !0), e.delta) {
2811
- const l = await h(this, p, de).call(this);
2816
+ if (e.model && (await h(this, p, Ys).call(this, t, e.model), i.full = !0), e.delta) {
2817
+ const l = await h(this, p, ue).call(this);
2812
2818
  if (!l)
2813
2819
  throw new Error(
2814
2820
  "A delta needs the model file to hang from: sync a full model first."
@@ -2817,19 +2823,17 @@ class lr {
2817
2823
  e.delta,
2818
2824
  l.id
2819
2825
  );
2820
- i.deltaId = String(
2821
- d._id ?? d.id
2822
- );
2826
+ i.deltaId = bs(d);
2823
2827
  }
2824
2828
  const o = await h(this, p, ft).call(this);
2825
2829
  if (o) {
2826
2830
  s = o;
2827
- const l = bs(s.commits);
2831
+ const l = vs(s.commits);
2828
2832
  if (e.expectedLatestGuid !== void 0 && (l == null ? void 0 : l.guid) !== e.expectedLatestGuid)
2829
2833
  throw new ys(e.expectedLatestGuid, l == null ? void 0 : l.guid);
2830
2834
  l && !i.parents && (i.parents = [l.guid]);
2831
2835
  }
2832
- return s.commits.push(i), await h(this, p, pt).call(this, t, Ft, s), i;
2836
+ return s.commits.push(i), await h(this, p, pt).call(this, t, Lt, s), i;
2833
2837
  }
2834
2838
  // ─── Suggestions (change requests) ────────────────────────────────────────
2835
2839
  /** Every suggestion in the document's queue, pending or resolved. */
@@ -2864,9 +2868,7 @@ class lr {
2864
2868
  e.payload,
2865
2869
  a.id
2866
2870
  );
2867
- i.fragId = String(
2868
- l._id ?? l.id
2869
- );
2871
+ i.fragId = bs(l);
2870
2872
  }
2871
2873
  const o = await h(this, p, Ye).call(this) ?? s;
2872
2874
  return o.schema ?? (o.schema = ws), o.ops.push(i), await h(this, p, pt).call(this, t, Re, o), i;
@@ -2891,12 +2893,12 @@ class lr {
2891
2893
  return Object.assign(i, t), await h(this, p, pt).call(this, s, Re, r), i;
2892
2894
  }
2893
2895
  }
2894
- oe = new WeakMap(), p = new WeakSet(), ie = function() {
2895
- return new Ms(this.client, this.project.projectId);
2896
+ ae = new WeakMap(), p = new WeakSet(), oe = function() {
2897
+ return new Vs(this.client, this.project.projectId);
2896
2898
  }, Ce = function() {
2897
2899
  return `${this.source}-${this.docId}`;
2898
2900
  }, ee = async function(e) {
2899
- if (u(this, oe)) return u(this, oe);
2901
+ if (u(this, ae)) return u(this, ae);
2900
2902
  const t = await this.project.rootFolderId(e);
2901
2903
  if (!t)
2902
2904
  throw new Error(
@@ -2905,11 +2907,11 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2905
2907
  const s = await this.client.listFolders({
2906
2908
  parentFolderId: t,
2907
2909
  projectId: this.project.projectId
2908
- }), r = Js(s, t).find(
2910
+ }), r = Ws(s, t).find(
2909
2911
  (o) => String(o.name ?? "") === u(this, p, Ce)
2910
2912
  );
2911
2913
  if (r)
2912
- return R(this, oe, te(r)), u(this, oe);
2914
+ return R(this, ae, te(r)), u(this, ae);
2913
2915
  if (!e)
2914
2916
  throw new Error(
2915
2917
  `Document ${u(this, p, Ce)} does not exist in this project.`
@@ -2919,7 +2921,7 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2919
2921
  t,
2920
2922
  this.project.projectId
2921
2923
  );
2922
- return R(this, oe, te(i)), u(this, oe);
2924
+ return R(this, ae, te(i)), u(this, ae);
2923
2925
  }, qt = async function() {
2924
2926
  const e = await h(this, p, ee).call(this, !1);
2925
2927
  return (await this.client.listFiles({ folderId: e })).map((s) => ({
@@ -2932,11 +2934,11 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2932
2934
  } catch {
2933
2935
  return;
2934
2936
  }
2935
- }, de = async function() {
2937
+ }, ue = async function() {
2936
2938
  try {
2937
2939
  const e = await h(this, p, qt).call(this);
2938
- return e.find((t) => t.name === Hs) ?? e.find(
2939
- (t) => t.name.endsWith(".frag") && !t.name.startsWith(Gs)
2940
+ return e.find((t) => t.name === Gs) ?? e.find(
2941
+ (t) => t.name.endsWith(".frag") && !t.name.startsWith(Js)
2940
2942
  );
2941
2943
  } catch {
2942
2944
  return;
@@ -2948,7 +2950,7 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2948
2950
  if (r.trim())
2949
2951
  return JSON.parse(r);
2950
2952
  }, ft = function() {
2951
- return h(this, p, jt).call(this, Ft);
2953
+ return h(this, p, jt).call(this, Lt);
2952
2954
  }, Ye = function() {
2953
2955
  return h(this, p, jt).call(this, Re);
2954
2956
  }, pt = async function(e, t, s) {
@@ -2970,8 +2972,8 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2970
2972
  projectId: this.project.projectId
2971
2973
  }), o = i.item;
2972
2974
  return { id: te(o ?? i), name: t };
2973
- }, Ws = async function(e, t) {
2974
- const s = await h(this, p, de).call(this);
2975
+ }, Ys = async function(e, t) {
2976
+ const s = await h(this, p, ue).call(this);
2975
2977
  if (s)
2976
2978
  return await this.client.updateFile(s.id, {
2977
2979
  file: t,
@@ -2986,13 +2988,13 @@ oe = new WeakMap(), p = new WeakSet(), ie = function() {
2986
2988
  }), o = i.item;
2987
2989
  return { id: te(o ?? i), name: r };
2988
2990
  };
2989
- function dr(n) {
2991
+ function ur(n) {
2990
2992
  const e = { added: 0, modified: 0, removed: 0 };
2991
2993
  for (const t of n)
2992
2994
  t.type === "create" ? e.added++ : t.type === "delete" ? e.removed++ : e.modified++;
2993
2995
  return e;
2994
2996
  }
2995
- function Ys(n) {
2997
+ function zs(n) {
2996
2998
  var l;
2997
2999
  if (n.length <= 1)
2998
3000
  return n.forEach((d, c) => d.ordinal = c), [...n];
@@ -3019,8 +3021,8 @@ function Ys(n) {
3019
3021
  a.has(d.guid) || i.push(d);
3020
3022
  return i.forEach((d, c) => d.ordinal = c), i;
3021
3023
  }
3022
- function bs(n) {
3023
- const e = Ys(n);
3024
+ function vs(n) {
3025
+ const e = zs(n);
3024
3026
  return e[e.length - 1];
3025
3027
  }
3026
3028
  function Mt() {
@@ -3030,28 +3032,28 @@ function Mt() {
3030
3032
  return (e === "x" ? t : t & 3 | 8).toString(16);
3031
3033
  });
3032
3034
  }
3033
- var fe, Qe, Vt;
3034
- class ur {
3035
+ var pe, Qe, Vt;
3036
+ class fr {
3035
3037
  constructor(e) {
3036
3038
  S(this, Qe);
3037
- S(this, fe, /* @__PURE__ */ new Map());
3039
+ S(this, pe, /* @__PURE__ */ new Map());
3038
3040
  this.client = e;
3039
3041
  }
3040
3042
  /** Registers a recipe. One per name; a second with the same name throws. */
3041
3043
  register(e) {
3042
- if (u(this, fe).has(e.name))
3044
+ if (u(this, pe).has(e.name))
3043
3045
  throw new Error(`A recipe named "${e.name}" is already registered.`);
3044
- u(this, fe).set(e.name, e);
3046
+ u(this, pe).set(e.name, e);
3045
3047
  }
3046
3048
  /** The registered recipes, optionally filtered by target application. */
3047
3049
  list(e) {
3048
- return [...u(this, fe).values()].filter(
3050
+ return [...u(this, pe).values()].filter(
3049
3051
  (s) => (!(e != null && e.to) || s.to === e.to) && (!(e != null && e.input) || s.inputs.includes(e.input))
3050
3052
  );
3051
3053
  }
3052
3054
  /** A registered recipe by name, or undefined. */
3053
3055
  get(e) {
3054
- return u(this, fe).get(e);
3056
+ return u(this, pe).get(e);
3055
3057
  }
3056
3058
  /**
3057
3059
  * Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
@@ -3106,8 +3108,8 @@ class ur {
3106
3108
  }), result: o };
3107
3109
  }
3108
3110
  }
3109
- fe = new WeakMap(), Qe = new WeakSet(), Vt = async function(e, t) {
3110
- const s = u(this, fe).get(e);
3111
+ pe = new WeakMap(), Qe = new WeakSet(), Vt = async function(e, t) {
3112
+ const s = u(this, pe).get(e);
3111
3113
  if (!s) throw new Error(`No recipe named "${e}" is registered.`);
3112
3114
  if (s.to !== t.target.source)
3113
3115
  throw new Error(
@@ -3123,8 +3125,8 @@ fe = new WeakMap(), Qe = new WeakSet(), Vt = async function(e, t) {
3123
3125
  });
3124
3126
  return { recipe: s, targetDoc: r, base: i, opId: o, result: a };
3125
3127
  };
3126
- const vs = 100;
3127
- function fr(n) {
3128
+ const Es = 100;
3129
+ function pr(n) {
3128
3130
  try {
3129
3131
  const e = JSON.parse(n);
3130
3132
  if (e && typeof e == "object") {
@@ -3139,14 +3141,14 @@ function fr(n) {
3139
3141
  }
3140
3142
  return {};
3141
3143
  }
3142
- function pr(n) {
3144
+ function mr(n) {
3143
3145
  if (!n || typeof n != "object") return;
3144
3146
  const e = n.retryAfter;
3145
3147
  return typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : void 0;
3146
3148
  }
3147
3149
  class rs extends Error {
3148
3150
  constructor(t, s, r, i) {
3149
- const o = fr(r);
3151
+ const o = pr(r);
3150
3152
  super(o.message ?? `${s || "Request failed"} (${t})`);
3151
3153
  B(this, "status");
3152
3154
  B(this, "code");
@@ -3157,11 +3159,11 @@ class rs extends Error {
3157
3159
  * from `details.retryAfter`. Only present on rate-limited (429) responses.
3158
3160
  */
3159
3161
  B(this, "retryAfter");
3160
- this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? pr(o.details);
3162
+ this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? mr(o.details);
3161
3163
  }
3162
3164
  }
3163
- const Z = "item/folder", b = "item", le = "processor", mr = "npm-registry", re = "hidden", kt = "FILE", Ot = "TOOL", At = "APP", yr = 500, Es = 3e4, gr = 0.25, wr = (n) => new Promise((e) => setTimeout(e, n));
3164
- function br(n) {
3165
+ const Z = "item/folder", b = "item", de = "processor", yr = "npm-registry", ie = "hidden", kt = "FILE", Ot = "TOOL", At = "APP", gr = 500, Ts = 3e4, wr = 0.25, br = (n) => new Promise((e) => setTimeout(e, n));
3166
+ function vr(n) {
3165
3167
  var r, i;
3166
3168
  const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
3167
3169
  if (!e) return;
@@ -3171,17 +3173,17 @@ function br(n) {
3171
3173
  if (!Number.isNaN(s))
3172
3174
  return Math.max(0, (s - Date.now()) / 1e3);
3173
3175
  }
3174
- function vr(n) {
3176
+ function Er(n) {
3175
3177
  return n instanceof rs ? n.status === 429 || n.status >= 500 : !0;
3176
3178
  }
3177
- function Er(n, e) {
3179
+ function Tr(n, e) {
3178
3180
  const t = Math.min(
3179
- yr * 2 ** e,
3180
- Es
3181
- ), s = t * gr * Math.random(), r = n instanceof rs && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
3182
- return r != null ? Math.min(r, Es) + s : t + s;
3181
+ gr * 2 ** e,
3182
+ Ts
3183
+ ), s = t * wr * Math.random(), r = n instanceof rs && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
3184
+ return r != null ? Math.min(r, Ts) + s : t + s;
3183
3185
  }
3184
- var f, Gt, w, ue, Ze, ze, mt, yt, Jt, Wt, zs;
3186
+ var f, Gt, w, fe, Ze, ze, mt, yt, Jt, Wt, Ks;
3185
3187
  const is = class is {
3186
3188
  /**
3187
3189
  * Creates a new EngineServicesClient instance.
@@ -3528,7 +3530,7 @@ const is = class is {
3528
3530
  * @returns A fetch Response containing the ZIP data.
3529
3531
  */
3530
3532
  async downloadFolder(e) {
3531
- return await h(this, f, ue).call(this, `${Z}/${e}/download`);
3533
+ return await h(this, f, fe).call(this, `${Z}/${e}/download`);
3532
3534
  }
3533
3535
  // ─── Components ──────────────────────────────────────────────────
3534
3536
  /**
@@ -3596,7 +3598,7 @@ const is = class is {
3596
3598
  */
3597
3599
  async downloadComponentBundle(e, t) {
3598
3600
  const { versionTag: s, withDraft: r } = t || {};
3599
- return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
3601
+ return await h(this, f, fe).call(this, `${b}/${e}/download/bundle`, {
3600
3602
  query: {
3601
3603
  ...s && { versionTag: s },
3602
3604
  ...r && { withDraft: r }
@@ -3624,7 +3626,7 @@ const is = class is {
3624
3626
  * @returns The component's JavaScript source code as a string.
3625
3627
  */
3626
3628
  async getBuiltInComponent(e) {
3627
- return await (await h(this, f, ue).call(this, `built-in/${e}/bundle`)).text();
3629
+ return await (await h(this, f, fe).call(this, `built-in/${e}/bundle`)).text();
3628
3630
  }
3629
3631
  /**
3630
3632
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -3762,7 +3764,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3762
3764
  */
3763
3765
  async downloadAppBundle(e, t) {
3764
3766
  const { versionTag: s, withDraft: r } = t || {};
3765
- return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
3767
+ return await h(this, f, fe).call(this, `${b}/${e}/download/bundle`, {
3766
3768
  query: {
3767
3769
  ...s && { versionTag: s },
3768
3770
  ...r && { withDraft: r }
@@ -3786,7 +3788,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3786
3788
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
3787
3789
  */
3788
3790
  async getNpmCredentials() {
3789
- return await h(this, f, w).call(this, "GET", `${mr}/credentials`);
3791
+ return await h(this, f, w).call(this, "GET", `${yr}/credentials`);
3790
3792
  }
3791
3793
  // ─── Execution ───────────────────────────────────────────────────
3792
3794
  /**
@@ -3805,7 +3807,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3805
3807
  */
3806
3808
  async executeComponent(e, t, s) {
3807
3809
  if (this.localServerUrl) {
3808
- const r = `${this.localServerUrl}/api/${le}/${e}/execute`, i = await fetch(r, {
3810
+ const r = `${this.localServerUrl}/api/${de}/${e}/execute`, i = await fetch(r, {
3809
3811
  method: "POST",
3810
3812
  headers: { "Content-Type": "application/json" },
3811
3813
  body: JSON.stringify(t)
@@ -3818,7 +3820,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3818
3820
  }
3819
3821
  return await i.json();
3820
3822
  }
3821
- return await h(this, f, w).call(this, "POST", `${le}/${e}/execute`, {
3823
+ return await h(this, f, w).call(this, "POST", `${de}/${e}/execute`, {
3822
3824
  body: JSON.stringify(t),
3823
3825
  query: { ...s && { versionTag: s } },
3824
3826
  contentType: "application/json"
@@ -3830,7 +3832,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3830
3832
  */
3831
3833
  async abortExecution(e) {
3832
3834
  if (this.localServerUrl) {
3833
- const t = `${this.localServerUrl}/api/${le}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
3835
+ const t = `${this.localServerUrl}/api/${de}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
3834
3836
  if (!s.ok) {
3835
3837
  const r = await s.text().catch(() => "");
3836
3838
  throw new Error(
@@ -3839,7 +3841,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3839
3841
  }
3840
3842
  return await s.json();
3841
3843
  }
3842
- return await h(this, f, w).call(this, "POST", `${le}/progress/${e}/abort`);
3844
+ return await h(this, f, w).call(this, "POST", `${de}/progress/${e}/abort`);
3843
3845
  }
3844
3846
  /**
3845
3847
  * Lists all executions for a given component.
@@ -3856,7 +3858,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3856
3858
  */
3857
3859
  async listExecutions(e, t) {
3858
3860
  if (this.localServerUrl) {
3859
- const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${le}/${e}/progress${s}`, i = await fetch(r);
3861
+ const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${de}/${e}/progress${s}`, i = await fetch(r);
3860
3862
  if (!i.ok) {
3861
3863
  const o = await i.text().catch(() => "");
3862
3864
  throw new Error(
@@ -3865,7 +3867,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3865
3867
  }
3866
3868
  return await i.json();
3867
3869
  }
3868
- return await h(this, f, w).call(this, "GET", `${le}/${e}/progress`, { query: { ...t && { projectId: t } } });
3870
+ return await h(this, f, w).call(this, "GET", `${de}/${e}/progress`, { query: { ...t && { projectId: t } } });
3869
3871
  }
3870
3872
  /**
3871
3873
  * Gets details of a specific execution, including its messages.
@@ -3874,7 +3876,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3874
3876
  */
3875
3877
  async getExecution(e) {
3876
3878
  if (this.localServerUrl) {
3877
- const t = `${this.localServerUrl}/api/${le}/progress/${e}`, s = await fetch(t);
3879
+ const t = `${this.localServerUrl}/api/${de}/progress/${e}`, s = await fetch(t);
3878
3880
  if (!s.ok) {
3879
3881
  const r = await s.text().catch(() => "");
3880
3882
  throw new Error(
@@ -3883,7 +3885,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3883
3885
  }
3884
3886
  return await s.json();
3885
3887
  }
3886
- return await h(this, f, w).call(this, "GET", `${le}/progress/${e}`);
3888
+ return await h(this, f, w).call(this, "GET", `${de}/progress/${e}`);
3887
3889
  }
3888
3890
  /**
3889
3891
  * Subscribes to real-time execution progress via WebSocket.
@@ -3911,7 +3913,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3911
3913
  * renderable views. See `src/core/documents.ts` for the model and schema.
3912
3914
  */
3913
3915
  documents(e) {
3914
- return new Ms(this, e);
3916
+ return new Vs(this, e);
3915
3917
  }
3916
3918
  /**
3917
3919
  * A project's history of connected documents (Revit models, AutoCAD
@@ -3920,14 +3922,14 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3920
3922
  * or write it; the storage underneath is private and will move.
3921
3923
  */
3922
3924
  history(e) {
3923
- return new hr(this, e);
3925
+ return new lr(this, e);
3924
3926
  }
3925
3927
  /**
3926
3928
  * The recipe registry and runner: scripts that write change requests in a
3927
3929
  * native application's language. See `src/core/recipes.ts`.
3928
3930
  */
3929
3931
  get recipes() {
3930
- return u(this, Ze) ?? R(this, Ze, new ur(this)), u(this, Ze);
3932
+ return u(this, Ze) ?? R(this, Ze, new fr(this)), u(this, Ze);
3931
3933
  }
3932
3934
  // ─── Hidden Files ────────────────────────────────────────────────
3933
3935
  /**
@@ -3941,7 +3943,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3941
3943
  */
3942
3944
  async createHiddenFile(e, t, s) {
3943
3945
  const r = new FormData();
3944
- return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}`, {
3946
+ return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${ie}`, {
3945
3947
  body: r
3946
3948
  });
3947
3949
  }
@@ -3959,7 +3961,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3959
3961
  const r = new FormData();
3960
3962
  for (const i of e)
3961
3963
  r.append("files", i);
3962
- return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}/batch`, {
3964
+ return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${ie}/batch`, {
3963
3965
  body: r
3964
3966
  });
3965
3967
  }
@@ -3968,21 +3970,21 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
3968
3970
  * @param hiddenId - The hidden file's unique identifier.
3969
3971
  */
3970
3972
  async deleteHiddenFile(e) {
3971
- return await h(this, f, w).call(this, "DELETE", `${b}/${re}/${e}`);
3973
+ return await h(this, f, w).call(this, "DELETE", `${b}/${ie}/${e}`);
3972
3974
  }
3973
3975
  /**
3974
3976
  * Gets metadata for a hidden file.
3975
3977
  * @param hiddenId - The hidden file's unique identifier.
3976
3978
  */
3977
3979
  async getHiddenFile(e) {
3978
- return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}`);
3980
+ return await h(this, f, w).call(this, "GET", `${b}/${ie}/${e}`);
3979
3981
  }
3980
3982
  /**
3981
3983
  * Downloads a hidden file's content. Returns the raw fetch Response.
3982
3984
  * @param hiddenId - The hidden file's unique identifier.
3983
3985
  */
3984
3986
  async downloadHiddenFile(e) {
3985
- return await h(this, f, ue).call(this, `${b}/${re}/${e}/download`);
3987
+ return await h(this, f, fe).call(this, `${b}/${ie}/${e}/download`);
3986
3988
  }
3987
3989
  /**
3988
3990
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -4002,7 +4004,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
4002
4004
  * an ISO timestamp when it stops working.
4003
4005
  */
4004
4006
  async getHiddenFileSignedUrl(e, t) {
4005
- return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
4007
+ return await h(this, f, w).call(this, "GET", `${b}/${ie}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
4006
4008
  }
4007
4009
  /**
4008
4010
  * Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
@@ -4023,7 +4025,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
4023
4025
  * 900 (15 min) server-side; values are clamped to that range.
4024
4026
  */
4025
4027
  async getHiddenFileSignedUrlsBatch(e, t) {
4026
- return await h(this, f, ze).call(this, e, async (s) => (await h(this, f, w).call(this, "POST", `${b}/${re}/signed-url/batch`, {
4028
+ return await h(this, f, ze).call(this, e, async (s) => (await h(this, f, w).call(this, "POST", `${b}/${ie}/signed-url/batch`, {
4027
4029
  body: JSON.stringify({
4028
4030
  hiddenFileIds: s,
4029
4031
  ...t != null && { expiresIn: t }
@@ -4039,14 +4041,14 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
4039
4041
  * @returns Array of hidden file entities.
4040
4042
  */
4041
4043
  async getHiddenFilesByParent(e, t) {
4042
- return await h(this, f, w).call(this, "GET", `${b}/${e}/${re}`, { ...t != null && { query: { tag: t } } });
4044
+ return await h(this, f, w).call(this, "GET", `${b}/${e}/${ie}`, { ...t != null && { query: { tag: t } } });
4043
4045
  }
4044
4046
  /**
4045
4047
  * Deletes all hidden files attached to a parent item.
4046
4048
  * @param parentFileId - The parent item's unique identifier.
4047
4049
  */
4048
4050
  async deleteHiddenFilesByParent(e) {
4049
- return await h(this, f, w).call(this, "DELETE", `${b}/${e}/${re}`);
4051
+ return await h(this, f, w).call(this, "DELETE", `${b}/${e}/${ie}`);
4050
4052
  }
4051
4053
  // ─── Icons ───────────────────────────────────────────────────────
4052
4054
  /**
@@ -4068,7 +4070,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
4068
4070
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
4069
4071
  */
4070
4072
  async getItemIcon(e) {
4071
- return await h(this, f, ue).call(this, `${b}/${e}/icon`);
4073
+ return await h(this, f, fe).call(this, `${b}/${e}/icon`);
4072
4074
  }
4073
4075
  /**
4074
4076
  * Removes the icon from an item.
@@ -4174,7 +4176,7 @@ return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
4174
4176
  f = new WeakSet(), Gt = function(e) {
4175
4177
  return `${this.apiUrl}/${e}`;
4176
4178
  }, w = async function(e, t, s) {
4177
- const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: d } = s || {}, c = h(this, f, Gt).call(this, t), m = h(this, f, zs).call(this, i), T = await this.resolveAccessToken(), A = {
4179
+ const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: d } = s || {}, c = h(this, f, Gt).call(this, t), m = h(this, f, Ks).call(this, i), T = await this.resolveAccessToken(), A = {
4178
4180
  ...m,
4179
4181
  ...this.useBearer ? {} : { accessToken: T }
4180
4182
  };
@@ -4192,29 +4194,29 @@ f = new WeakSet(), Gt = function(e) {
4192
4194
  }
4193
4195
  );
4194
4196
  if (!_.ok) {
4195
- const E = await _.text().then((N) => N).catch(() => "");
4197
+ const v = await _.text().then((N) => N).catch(() => "");
4196
4198
  throw new rs(
4197
4199
  _.status,
4198
4200
  _.statusText,
4199
- E,
4200
- br(_)
4201
+ v,
4202
+ vr(_)
4201
4203
  );
4202
4204
  }
4203
- return l === "blob" ? await _.blob() : _.json().then((E) => E).catch(() => {
4205
+ return l === "blob" ? await _.blob() : _.json().then((v) => v).catch(() => {
4204
4206
  });
4205
4207
  } catch (_) {
4206
- const E = a ?? this.retries;
4207
- if (E > 0 && vr(_)) {
4208
+ const v = a ?? this.retries;
4209
+ if (v > 0 && Er(_)) {
4208
4210
  const N = d ?? 0;
4209
- return await wr(Er(_, N)), await h(this, f, w).call(this, e, t, {
4211
+ return await br(Tr(_, N)), await h(this, f, w).call(this, e, t, {
4210
4212
  ...s,
4211
- retries: E - 1,
4213
+ retries: v - 1,
4212
4214
  retryAttempt: N + 1
4213
4215
  });
4214
4216
  }
4215
4217
  throw _;
4216
4218
  }
4217
- }, ue = async function(e, t) {
4219
+ }, fe = async function(e, t) {
4218
4220
  const { query: s } = t || {}, r = h(this, f, Gt).call(this, e), i = await this.resolveAccessToken(), o = {
4219
4221
  ...s,
4220
4222
  ...this.useBearer ? {} : { accessToken: i }
@@ -4231,12 +4233,12 @@ f = new WeakSet(), Gt = function(e) {
4231
4233
  }, Ze = new WeakMap(), ze = async function(e, t) {
4232
4234
  if (!e.length) return [];
4233
4235
  const s = [];
4234
- for (let i = 0; i < e.length; i += vs)
4235
- s.push(e.slice(i, i + vs));
4236
+ for (let i = 0; i < e.length; i += Es)
4237
+ s.push(e.slice(i, i + Es));
4236
4238
  return (await Promise.all(s.map(t))).flat();
4237
4239
  }, mt = async function(e, t) {
4238
4240
  const { versionTag: s, withDraft: r } = t || {};
4239
- return await h(this, f, ue).call(this, `${b}/${e}/download`, {
4241
+ return await h(this, f, fe).call(this, `${b}/${e}/download`, {
4240
4242
  query: {
4241
4243
  ...s && { versionTag: s },
4242
4244
  ...r && { withDraft: r }
@@ -4272,14 +4274,14 @@ f = new WeakSet(), Gt = function(e) {
4272
4274
  return await h(this, f, w).call(this, "GET", `${b}/${e}`, {
4273
4275
  query: { showVersions: s }
4274
4276
  });
4275
- }, zs = function(e) {
4277
+ }, Ks = function(e) {
4276
4278
  return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
4277
4279
  (t, [s, r]) => (t[s] = r, t),
4278
4280
  {}
4279
4281
  );
4280
4282
  };
4281
4283
  let Ht = is;
4282
- function Tr() {
4284
+ function _r() {
4283
4285
  if (typeof window > "u" || window.parent === window)
4284
4286
  throw new Error(
4285
4287
  "client.channel only works inside a That Open app, which runs in an iframe of the platform."
@@ -4294,7 +4296,7 @@ function Tr() {
4294
4296
  }
4295
4297
  };
4296
4298
  }
4297
- const Yt = "channel:", _r = 1e4;
4299
+ const Yt = "channel:", Ir = 1e4;
4298
4300
  function gt(n) {
4299
4301
  try {
4300
4302
  n();
@@ -4302,13 +4304,13 @@ function gt(n) {
4302
4304
  console.error("[channel] a listener threw:", e);
4303
4305
  }
4304
4306
  }
4305
- var ae, U, M, xe, Ne, Pe, L, zt, Kt, $e;
4306
- class Ks {
4307
+ var ce, M, V, xe, Ne, Pe, L, zt, Kt, $e;
4308
+ class Xs {
4307
4309
  constructor(e, t) {
4308
4310
  S(this, L);
4309
- S(this, ae, !1);
4310
- S(this, U, []);
4311
+ S(this, ce, !1);
4311
4312
  S(this, M, []);
4313
+ S(this, V, []);
4312
4314
  S(this, xe, /* @__PURE__ */ new Set());
4313
4315
  S(this, Ne, /* @__PURE__ */ new Set());
4314
4316
  S(this, Pe, /* @__PURE__ */ new Set());
@@ -4316,22 +4318,22 @@ class Ks {
4316
4318
  }
4317
4319
  /** Whether the platform has confirmed this tab is in the room. */
4318
4320
  get joined() {
4319
- return u(this, ae);
4321
+ return u(this, ce);
4320
4322
  }
4321
4323
  /** Who else is in the room right now, as the platform last reported. */
4322
4324
  get peers() {
4323
- return u(this, U);
4325
+ return u(this, M);
4324
4326
  }
4325
4327
  /**
4326
4328
  * Enters the room. Resolves when the platform confirms; rejects if it
4327
4329
  * refuses or does not answer in time. Joining twice is harmless.
4328
4330
  */
4329
4331
  join() {
4330
- return u(this, ae) ? Promise.resolve() : h(this, L, zt).call(this, "joined", this.controls.join);
4332
+ return u(this, ce) ? Promise.resolve() : h(this, L, zt).call(this, "joined", this.controls.join);
4331
4333
  }
4332
4334
  /** Leaves the room. Handlers stay registered, so `join()` resumes them. */
4333
4335
  leave() {
4334
- return !u(this, ae) && !u(this, M).some((e) => e.want === "joined") ? Promise.resolve() : h(this, L, zt).call(this, "left", this.controls.leave);
4336
+ return !u(this, ce) && !u(this, V).some((e) => e.want === "joined") ? Promise.resolve() : h(this, L, zt).call(this, "left", this.controls.leave);
4335
4337
  }
4336
4338
  /** Fires when `joined` or `peers` changes. Returns a function that stops it. */
4337
4339
  onChange(e) {
@@ -4345,29 +4347,29 @@ class Ks {
4345
4347
  }
4346
4348
  /** @internal */
4347
4349
  applyJoined() {
4348
- R(this, ae, !0), h(this, L, Kt).call(this, "joined"), h(this, L, $e).call(this);
4350
+ R(this, ce, !0), h(this, L, Kt).call(this, "joined"), h(this, L, $e).call(this);
4349
4351
  }
4350
4352
  /** @internal */
4351
4353
  applyLeft() {
4352
- R(this, ae, !1), R(this, U, []), h(this, L, Kt).call(this, "left"), h(this, L, $e).call(this);
4354
+ R(this, ce, !1), R(this, M, []), h(this, L, Kt).call(this, "left"), h(this, L, $e).call(this);
4353
4355
  }
4354
4356
  /** @internal */
4355
4357
  applyPeers(e) {
4356
- R(this, U, e), h(this, L, $e).call(this);
4358
+ R(this, M, e), h(this, L, $e).call(this);
4357
4359
  }
4358
4360
  /** @internal */
4359
4361
  applyPeerJoined(e) {
4360
- !u(this, ae) || u(this, U).some((t) => t.from === e.from) || (R(this, U, [...u(this, U), e]), u(this, Ne).forEach((t) => gt(() => t(e))), h(this, L, $e).call(this));
4362
+ !u(this, ce) || u(this, M).some((t) => t.from === e.from) || (R(this, M, [...u(this, M), e]), u(this, Ne).forEach((t) => gt(() => t(e))), h(this, L, $e).call(this));
4361
4363
  }
4362
4364
  /** @internal */
4363
4365
  applyPeerLeft(e) {
4364
- const t = u(this, U).find((s) => s.from === e);
4365
- t && (R(this, U, u(this, U).filter((s) => s.from !== e)), u(this, Pe).forEach((s) => gt(() => s(t))), h(this, L, $e).call(this));
4366
+ const t = u(this, M).find((s) => s.from === e);
4367
+ t && (R(this, M, u(this, M).filter((s) => s.from !== e)), u(this, Pe).forEach((s) => gt(() => s(t))), h(this, L, $e).call(this));
4366
4368
  }
4367
4369
  /** @internal */
4368
4370
  failPending(e) {
4369
- const t = u(this, M);
4370
- return R(this, M, []), t.forEach((s) => {
4371
+ const t = u(this, V);
4372
+ return R(this, V, []), t.forEach((s) => {
4371
4373
  clearTimeout(s.timer), s.reject(e);
4372
4374
  }), t.length > 0;
4373
4375
  }
@@ -4375,32 +4377,32 @@ class Ks {
4375
4377
  this.transport.post(e);
4376
4378
  }
4377
4379
  }
4378
- ae = new WeakMap(), U = new WeakMap(), M = new WeakMap(), xe = new WeakMap(), Ne = new WeakMap(), Pe = new WeakMap(), L = new WeakSet(), zt = function(e, t) {
4380
+ ce = new WeakMap(), M = new WeakMap(), V = new WeakMap(), xe = new WeakMap(), Ne = new WeakMap(), Pe = new WeakMap(), L = new WeakSet(), zt = function(e, t) {
4379
4381
  return new Promise((s, r) => {
4380
4382
  const i = {
4381
4383
  want: e,
4382
4384
  resolve: s,
4383
4385
  reject: r,
4384
4386
  timer: setTimeout(() => {
4385
- R(this, M, u(this, M).filter((o) => o !== i)), r(
4387
+ R(this, V, u(this, V).filter((o) => o !== i)), r(
4386
4388
  new Error(
4387
4389
  `The platform did not confirm ${e === "joined" ? "joining" : "leaving"} in time.`
4388
4390
  )
4389
4391
  );
4390
- }, _r)
4392
+ }, Ir)
4391
4393
  };
4392
- u(this, M).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
4394
+ u(this, V).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
4393
4395
  });
4394
4396
  }, Kt = function(e) {
4395
- const t = u(this, M).filter((s) => s.want === e);
4396
- R(this, M, u(this, M).filter((s) => s.want !== e)), t.forEach((s) => {
4397
+ const t = u(this, V).filter((s) => s.want === e);
4398
+ R(this, V, u(this, V).filter((s) => s.want !== e)), t.forEach((s) => {
4397
4399
  clearTimeout(s.timer), s.resolve();
4398
4400
  });
4399
4401
  }, $e = function() {
4400
4402
  u(this, xe).forEach((e) => gt(e));
4401
4403
  };
4402
4404
  var Be;
4403
- class Ir extends Ks {
4405
+ class Sr extends Xs {
4404
4406
  /** @internal Use `client.channel.collab()`. */
4405
4407
  constructor(t) {
4406
4408
  super(t, {
@@ -4432,20 +4434,20 @@ class Ir extends Ks {
4432
4434
  async handle(t) {
4433
4435
  const s = u(this, Be).get(t.type);
4434
4436
  if (!(s != null && s.size)) return { handled: !1 };
4435
- const r = Xs(t);
4437
+ const r = Qs(t);
4436
4438
  return s.forEach((i) => gt(() => i(t.payload, r))), { handled: !0 };
4437
4439
  }
4438
4440
  }
4439
4441
  Be = new WeakMap();
4440
- var pe;
4441
- class Sr extends Ks {
4442
+ var me;
4443
+ class kr extends Xs {
4442
4444
  /** @internal Use `client.channel.external(kind)`. */
4443
4445
  constructor(t, s) {
4444
4446
  super(t, {
4445
4447
  join: { action: "joinExternal", kind: s },
4446
4448
  leave: { action: "leaveExternal", kind: s }
4447
4449
  });
4448
- S(this, pe, /* @__PURE__ */ new Map());
4450
+ S(this, me, /* @__PURE__ */ new Map());
4449
4451
  this.kind = s;
4450
4452
  }
4451
4453
  /**
@@ -4459,24 +4461,24 @@ class Sr extends Ks {
4459
4461
  * @returns a function that removes the handler.
4460
4462
  */
4461
4463
  on(t, s) {
4462
- if (u(this, pe).has(t))
4464
+ if (u(this, me).has(t))
4463
4465
  throw new Error(
4464
4466
  `"${t}" already has a handler in this room. Remove it first.`
4465
4467
  );
4466
- return u(this, pe).set(t, s), () => void u(this, pe).delete(t);
4468
+ return u(this, me).set(t, s), () => void u(this, me).delete(t);
4467
4469
  }
4468
4470
  accepts(t, s) {
4469
4471
  return t !== void 0 && t !== "external" ? !1 : this.kind === void 0 || t === void 0 || this.kind === s;
4470
4472
  }
4471
4473
  /** @internal Whether this room has any handler at all. */
4472
4474
  get hasHandlers() {
4473
- return u(this, pe).size > 0;
4475
+ return u(this, me).size > 0;
4474
4476
  }
4475
4477
  async handle(t) {
4476
- const s = u(this, pe).get(t.type);
4478
+ const s = u(this, me).get(t.type);
4477
4479
  if (!s) return { handled: !1 };
4478
4480
  try {
4479
- return { handled: !0, value: await s(t.payload, Xs(t)) };
4481
+ return { handled: !0, value: await s(t.payload, Qs(t)) };
4480
4482
  } catch (r) {
4481
4483
  return {
4482
4484
  handled: !0,
@@ -4485,8 +4487,8 @@ class Sr extends Ks {
4485
4487
  }
4486
4488
  }
4487
4489
  }
4488
- pe = new WeakMap();
4489
- function Xs(n) {
4490
+ me = new WeakMap();
4491
+ function Qs(n) {
4490
4492
  return {
4491
4493
  from: n.from,
4492
4494
  at: n.at,
@@ -4494,7 +4496,7 @@ function Xs(n) {
4494
4496
  kind: n.kind
4495
4497
  };
4496
4498
  }
4497
- function kr(n) {
4499
+ function Or(n) {
4498
4500
  const e = n;
4499
4501
  if ((e == null ? void 0 : e.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
4500
4502
  const t = e.message;
@@ -4508,20 +4510,20 @@ function kr(n) {
4508
4510
  kind: typeof t.kind == "string" ? t.kind : void 0
4509
4511
  };
4510
4512
  }
4511
- var Se, et, ce, me, ye, $, Xt, wt, Qs, Zs, en, Qt;
4512
- class Or {
4513
+ var Se, et, he, ye, ge, $, Xt, wt, Zs, en, tn, Qt;
4514
+ class Ar {
4513
4515
  constructor(e) {
4514
4516
  S(this, $);
4515
4517
  S(this, Se);
4516
4518
  S(this, et);
4517
- S(this, ce);
4518
- S(this, me, /* @__PURE__ */ new Map());
4519
- S(this, ye, /* @__PURE__ */ new Set());
4520
- R(this, Se, e), R(this, et, e.listen((t) => void h(this, $, Qs).call(this, t)));
4519
+ S(this, he);
4520
+ S(this, ye, /* @__PURE__ */ new Map());
4521
+ S(this, ge, /* @__PURE__ */ new Set());
4522
+ R(this, Se, e), R(this, et, e.listen((t) => void h(this, $, Zs).call(this, t)));
4521
4523
  }
4522
4524
  /** The collaboration room for this app. Always the same instance. */
4523
4525
  collab() {
4524
- return u(this, ce) ?? R(this, ce, new Ir(u(this, Se))), u(this, ce);
4526
+ return u(this, he) ?? R(this, he, new Sr(u(this, Se))), u(this, he);
4525
4527
  }
4526
4528
  /**
4527
4529
  * The room for commands from this account's external tools of one `kind`
@@ -4530,30 +4532,30 @@ class Or {
4530
4532
  */
4531
4533
  external(e) {
4532
4534
  const t = e ?? "";
4533
- let s = u(this, me).get(t);
4534
- return s || (s = new Sr(u(this, Se), e), u(this, me).set(t, s)), s;
4535
+ let s = u(this, ye).get(t);
4536
+ return s || (s = new kr(u(this, Se), e), u(this, ye).set(t, s)), s;
4535
4537
  }
4536
4538
  /** Stops listening. For tests and teardown; an app normally never calls it. */
4537
4539
  dispose() {
4538
4540
  u(this, et).call(this);
4539
4541
  }
4540
4542
  }
4541
- Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(), ye = new WeakMap(), $ = new WeakSet(), Xt = function() {
4542
- return [...u(this, ce) ? [u(this, ce)] : [], ...u(this, me).values()];
4543
+ Se = new WeakMap(), et = new WeakMap(), he = new WeakMap(), ye = new WeakMap(), ge = new WeakMap(), $ = new WeakSet(), Xt = function() {
4544
+ return [...u(this, he) ? [u(this, he)] : [], ...u(this, ye).values()];
4543
4545
  }, wt = function(e, t) {
4544
- if (e === "collab") return u(this, ce);
4546
+ if (e === "collab") return u(this, he);
4545
4547
  if (e === "external")
4546
- return u(this, me).get(typeof t == "string" ? t : "");
4547
- }, Qs = async function(e) {
4548
- const t = kr(e);
4548
+ return u(this, ye).get(typeof t == "string" ? t : "");
4549
+ }, Zs = async function(e) {
4550
+ const t = Or(e);
4549
4551
  if (t) {
4550
4552
  if (t.type.startsWith(Yt)) {
4551
- h(this, $, Zs).call(this, t);
4553
+ h(this, $, en).call(this, t);
4552
4554
  return;
4553
4555
  }
4554
- await h(this, $, en).call(this, t);
4556
+ await h(this, $, tn).call(this, t);
4555
4557
  }
4556
- }, Zs = function(e) {
4558
+ }, en = function(e) {
4557
4559
  var s, r, i;
4558
4560
  const t = e.payload ?? {};
4559
4561
  switch (e.type) {
@@ -4569,7 +4571,7 @@ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(),
4569
4571
  case "channel:peer-joined":
4570
4572
  case "channel:peer-left": {
4571
4573
  if (!t.from) break;
4572
- const o = t.scope === "collab" ? [u(this, ce)] : [...u(this, me).values()].filter(
4574
+ const o = t.scope === "collab" ? [u(this, he)] : [...u(this, ye).values()].filter(
4573
4575
  (a) => a.accepts("external", t.kind)
4574
4576
  );
4575
4577
  for (const a of o)
@@ -4582,7 +4584,7 @@ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(),
4582
4584
  break;
4583
4585
  }
4584
4586
  }
4585
- }, en = async function(e) {
4587
+ }, tn = async function(e) {
4586
4588
  const t = h(this, $, Xt).call(this).filter((i) => i.accepts(e.scope, e.kind));
4587
4589
  let s = !1;
4588
4590
  for (const i of t) {
@@ -4594,7 +4596,7 @@ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(),
4594
4596
  error: `No handler for "${e.type}".`
4595
4597
  });
4596
4598
  }, Qt = function(e, t) {
4597
- u(this, ye).has(e) || (u(this, ye).add(e), u(this, ye).size > 500 && u(this, ye).delete(u(this, ye).values().next().value), u(this, Se).post({
4599
+ u(this, ge).has(e) || (u(this, ge).add(e), u(this, ge).size > 500 && u(this, ge).delete(u(this, ge).values().next().value), u(this, Se).post({
4598
4600
  type: "APP_CHANNEL_PUBLISH",
4599
4601
  message: {
4600
4602
  type: t.error === void 0 ? "reply" : "reply-error",
@@ -4604,7 +4606,7 @@ Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(),
4604
4606
  }));
4605
4607
  };
4606
4608
  const Ie = "project", Ae = "notifications";
4607
- var Le, tt;
4609
+ var Fe, tt;
4608
4610
  const os = class os extends Ht {
4609
4611
  /**
4610
4612
  * @param token - A bearer JWT, OR a function returning the current JWT
@@ -4616,12 +4618,12 @@ const os = class os extends Ht {
4616
4618
  */
4617
4619
  constructor(t, s, r) {
4618
4620
  super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
4619
- S(this, Le);
4621
+ S(this, Fe);
4620
4622
  S(this, tt);
4621
- typeof t == "function" && R(this, Le, t);
4623
+ typeof t == "function" && R(this, Fe, t);
4622
4624
  }
4623
4625
  async resolveAccessToken() {
4624
- return u(this, Le) ? await u(this, Le).call(this) : super.resolveAccessToken();
4626
+ return u(this, Fe) ? await u(this, Fe).call(this) : super.resolveAccessToken();
4625
4627
  }
4626
4628
  /**
4627
4629
  * Creates a client from the platform context injected into
@@ -4658,7 +4660,7 @@ const os = class os extends Ht {
4658
4660
  * ```
4659
4661
  */
4660
4662
  get channel() {
4661
- return u(this, tt) ?? R(this, tt, new Or(Tr())), u(this, tt);
4663
+ return u(this, tt) ?? R(this, tt, new Ar(_r())), u(this, tt);
4662
4664
  }
4663
4665
  // ─── Projects (JWT-only backend routes) ──────────────────────────
4664
4666
  /**
@@ -4906,11 +4908,11 @@ const os = class os extends Ht {
4906
4908
  ), () => r.disconnect();
4907
4909
  }
4908
4910
  };
4909
- Le = new WeakMap(), tt = new WeakMap();
4910
- let Ts = os;
4911
- async function tn(n) {
4912
- const [e, t] = await Ar(), s = t.Model.getRootAsModel(
4913
- new e.ByteBuffer(await Rr(n))
4911
+ Fe = new WeakMap(), tt = new WeakMap();
4912
+ let _s = os;
4913
+ async function sn(n) {
4914
+ const [e, t] = await Rr(), s = t.Model.getRootAsModel(
4915
+ new e.ByteBuffer(await Cr(n))
4914
4916
  );
4915
4917
  let r = {};
4916
4918
  try {
@@ -4945,7 +4947,7 @@ async function tn(n) {
4945
4947
  }
4946
4948
  return { metadata: r, items: o };
4947
4949
  }
4948
- async function Ar() {
4950
+ async function Rr() {
4949
4951
  try {
4950
4952
  return await Promise.all([
4951
4953
  import("flatbuffers"),
@@ -4957,12 +4959,12 @@ async function Ar() {
4957
4959
  );
4958
4960
  }
4959
4961
  }
4960
- async function Rr(n) {
4962
+ async function Cr(n) {
4961
4963
  const e = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate"));
4962
4964
  return new Uint8Array(await new Response(e).arrayBuffer());
4963
4965
  }
4964
- const Cr = "flow:", $r = "flow:op", xr = "flow:source", Nr = "revitflow/op@2", _s = "REVITFLOWCHANGE", Is = "REVITFLOWOPERATION";
4965
- class sn {
4966
+ const $r = "flow:", xr = "flow:op", Nr = "flow:source", Pr = "revitflow/op@2", Is = "REVITFLOWCHANGE", Ss = "REVITFLOWOPERATION";
4967
+ class nn {
4966
4968
  constructor(e) {
4967
4969
  B(this, "changes", []);
4968
4970
  this.target = e;
@@ -5030,7 +5032,7 @@ class sn {
5030
5032
  "An operation with no changes is not an operation. Add at least one."
5031
5033
  );
5032
5034
  const t = {
5033
- schema: Nr,
5035
+ schema: Pr,
5034
5036
  opId: e,
5035
5037
  // Through the getters, so the envelope and the queue entry cannot drift
5036
5038
  // into disagreeing about the same operation.
@@ -5042,8 +5044,8 @@ class sn {
5042
5044
  ...this.userId ? { userId: this.userId } : {},
5043
5045
  title: this.title,
5044
5046
  summary: this.summary
5045
- }, [s, r] = await Pr();
5046
- return Br(
5047
+ }, [s, r] = await Br();
5048
+ return Fr(
5047
5049
  this.flatbuffer(s, r, e, JSON.stringify(t))
5048
5050
  );
5049
5051
  }
@@ -5052,8 +5054,8 @@ class sn {
5052
5054
  pack(e, t) {
5053
5055
  const s = {};
5054
5056
  for (const [r, i] of Object.entries(e ?? {}))
5055
- r.startsWith(Cr) || (s[r] = String(i));
5056
- return t.position && (s.Position = t.position.map(Ss).join(",")), t.rotationDeg !== void 0 && (s.Rotation = Ss(t.rotationDeg)), t.source && (s[xr] = t.source), s;
5057
+ r.startsWith($r) || (s[r] = String(i));
5058
+ return t.position && (s.Position = t.position.map(ks).join(",")), t.rotationDeg !== void 0 && (s.Rotation = ks(t.rotationDeg)), t.source && (s[Nr] = t.source), s;
5057
5059
  }
5058
5060
  requireId(e, t) {
5059
5061
  if (!e || !e.trim())
@@ -5078,58 +5080,58 @@ class sn {
5078
5080
  const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: d } = t, c = new e.Builder(1024), m = this.changes.length, T = new Uint32Array(m);
5079
5081
  let A = 1;
5080
5082
  for (let I = 0; I < m; I++) T[I] = A++;
5081
- const _ = A++, E = (I) => (I(c, 0), c.endVector()), N = o.createShellsVector(c, []), we = o.createCircleExtrusionsVector(c, []), H = E(o.startSamplesVector), z = E(o.startRepresentationsVector), De = E(o.startMaterialsVector), K = E(o.startLocalTransformsVector), O = E(o.startGlobalTransformsVector), q = o.createMeshesItemsVector(c, []), X = o.createMaterialIdsVector(c, []), be = o.createRepresentationIdsVector(c, []), ve = o.createSampleIdsVector(c, []), Ee = o.createLocalTransformIdsVector(c, []), qe = o.createGlobalTransformIdsVector(c, []);
5082
- o.startMeshes(c), o.addCoordinates(c, d.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, O), o.addShells(c, N), o.addRepresentations(c, z), o.addSamples(c, H), o.addLocalTransforms(c, K), o.addMaterials(c, De), o.addCircleExtrusions(c, we), o.addMeshesItems(c, q), o.addRepresentationIds(c, be), o.addSampleIds(c, ve), o.addMaterialIds(c, X), o.addLocalTransformIds(c, Ee), o.addGlobalTransformIds(c, qe);
5083
- const je = o.endMeshes(c), Te = c.createString(r), Ue = /* @__PURE__ */ new Set(), Oe = [];
5083
+ const _ = A++, v = (I) => (I(c, 0), c.endVector()), N = o.createShellsVector(c, []), be = o.createCircleExtrusionsVector(c, []), G = v(o.startSamplesVector), z = v(o.startRepresentationsVector), De = v(o.startMaterialsVector), K = v(o.startLocalTransformsVector), O = v(o.startGlobalTransformsVector), q = o.createMeshesItemsVector(c, []), X = o.createMaterialIdsVector(c, []), ve = o.createRepresentationIdsVector(c, []), Ee = o.createSampleIdsVector(c, []), Te = o.createLocalTransformIdsVector(c, []), qe = o.createGlobalTransformIdsVector(c, []);
5084
+ o.startMeshes(c), o.addCoordinates(c, d.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, O), o.addShells(c, N), o.addRepresentations(c, z), o.addSamples(c, G), o.addLocalTransforms(c, K), o.addMaterials(c, De), o.addCircleExtrusions(c, be), o.addMeshesItems(c, q), o.addRepresentationIds(c, ve), o.addSampleIds(c, Ee), o.addMaterialIds(c, X), o.addLocalTransformIds(c, Te), o.addGlobalTransformIds(c, qe);
5085
+ const je = o.endMeshes(c), _e = c.createString(r), Ue = /* @__PURE__ */ new Set(), Oe = [];
5084
5086
  for (const I of this.changes) {
5085
- const D = [], _e = {
5086
- [$r]: I.op,
5087
+ const F = [], re = {
5088
+ [xr]: I.op,
5087
5089
  ...I.attrs
5088
5090
  };
5089
- for (const [j, G] of Object.entries(_e)) {
5090
- const Q = JSON.stringify([j, G, "IFCTEXT"]);
5091
- Ue.add(Q), D.push(c.createString(Q));
5091
+ for (const [j, J] of Object.entries(re)) {
5092
+ const Q = JSON.stringify([j, J, "IFCTEXT"]);
5093
+ Ue.add(Q), F.push(c.createString(Q));
5092
5094
  }
5093
5095
  Oe.push(
5094
- i.createAttribute(c, i.createDataVector(c, D))
5096
+ i.createAttribute(c, i.createDataVector(c, F))
5095
5097
  );
5096
5098
  }
5097
5099
  {
5098
5100
  const I = JSON.stringify(["Name", s, "IFCLABEL"]);
5099
5101
  Ue.add(I);
5100
- const D = i.createDataVector(c, [c.createString(I)]);
5101
- Oe.push(i.createAttribute(c, D));
5102
+ const F = i.createDataVector(c, [c.createString(I)]);
5103
+ Oe.push(i.createAttribute(c, F));
5102
5104
  }
5103
5105
  const st = a.createAttributesVector(c, Oe), nt = a.createUniqueAttributesVector(
5104
5106
  c,
5105
5107
  [...Ue].map((I) => c.createString(I))
5106
5108
  ), Me = this.changes.map(
5107
- () => c.createString(_s)
5109
+ () => c.createString(Is)
5108
5110
  );
5109
- Me.push(c.createString(Is));
5111
+ Me.push(c.createString(Ss));
5110
5112
  const rt = a.createCategoriesVector(c, Me), Ve = [], He = [];
5111
- this.changes.forEach((I, D) => {
5112
- I.item && (Ve.push(c.createString(I.item)), He.push(T[D]));
5113
+ this.changes.forEach((I, F) => {
5114
+ I.item && (Ve.push(c.createString(I.item)), He.push(T[F]));
5113
5115
  });
5114
5116
  const g = a.createGuidsVector(c, Ve), y = a.createGuidsItemsVector(c, He), k = a.createLocalIdsVector(c, [...T, _]), x = this.changes.map(
5115
- (I, D) => l.createSpatialStructure(
5117
+ (I, F) => l.createSpatialStructure(
5116
5118
  c,
5117
- T[D],
5118
- c.createString(_s),
5119
+ T[F],
5120
+ c.createString(Is),
5119
5121
  0
5120
5122
  )
5121
5123
  ), P = l.createSpatialStructure(
5122
5124
  c,
5123
5125
  _,
5124
- c.createString(Is),
5126
+ c.createString(Ss),
5125
5127
  l.createChildrenVector(c, x)
5126
- ), F = c.createString(s);
5127
- a.startModel(c), a.addMeshes(c, je), a.addMetadata(c, Te), a.addAttributes(c, st), a.addUniqueAttributes(c, nt), a.addLocalIds(c, k), a.addCategories(c, rt), a.addGuidsItems(c, y), a.addGuids(c, g), a.addGuid(c, F), a.addSpatialStructure(c, P), a.addMaxLocalId(c, A);
5128
- const he = a.endModel(c);
5129
- return a.finishModelBuffer(c, he), c.asUint8Array();
5128
+ ), D = c.createString(s);
5129
+ a.startModel(c), a.addMeshes(c, je), a.addMetadata(c, _e), a.addAttributes(c, st), a.addUniqueAttributes(c, nt), a.addLocalIds(c, k), a.addCategories(c, rt), a.addGuidsItems(c, y), a.addGuids(c, g), a.addGuid(c, D), a.addSpatialStructure(c, P), a.addMaxLocalId(c, A);
5130
+ const le = a.endModel(c);
5131
+ return a.finishModelBuffer(c, le), c.asUint8Array();
5130
5132
  }
5131
5133
  }
5132
- async function Pr() {
5134
+ async function Br() {
5133
5135
  try {
5134
5136
  return await Promise.all([
5135
5137
  import("flatbuffers"),
@@ -5141,18 +5143,18 @@ async function Pr() {
5141
5143
  );
5142
5144
  }
5143
5145
  }
5144
- function Ss(n) {
5146
+ function ks(n) {
5145
5147
  return Number.isFinite(n) ? String(n) : "0";
5146
5148
  }
5147
- async function Br(n) {
5149
+ async function Fr(n) {
5148
5150
  const e = new Blob([n]).stream().pipeThrough(new CompressionStream("deflate"));
5149
5151
  return new Uint8Array(await new Response(e).arrayBuffer());
5150
5152
  }
5151
- const Lr = "Element", Fr = "Carried", nn = 1 / 0.3048;
5152
- function Dr(n) {
5153
+ const Lr = "Element", Dr = "Carried", rn = 1 / 0.3048;
5154
+ function qr(n) {
5153
5155
  const e = [];
5154
5156
  for (const t of n)
5155
- for (const s of [Lr, Fr]) {
5157
+ for (const s of [Lr, Dr]) {
5156
5158
  const r = t.attrs[s];
5157
5159
  if (r)
5158
5160
  try {
@@ -5180,7 +5182,7 @@ function ht(n, e) {
5180
5182
  return null;
5181
5183
  }
5182
5184
  }
5183
- function qr(n) {
5185
+ function jr(n) {
5184
5186
  const e = /* @__PURE__ */ new Map();
5185
5187
  for (const t of n) {
5186
5188
  if (t.kind !== "datum" || t.params.of !== "level") continue;
@@ -5189,7 +5191,7 @@ function qr(n) {
5189
5191
  }
5190
5192
  return e;
5191
5193
  }
5192
- function jr(n) {
5194
+ function Ur(n) {
5193
5195
  const e = /* @__PURE__ */ new Map();
5194
5196
  for (const t of n) {
5195
5197
  if (!t.kind.endsWith("Style")) continue;
@@ -5198,7 +5200,7 @@ function jr(n) {
5198
5200
  }
5199
5201
  return e;
5200
5202
  }
5201
- async function rn(n, e) {
5203
+ async function on(n, e) {
5202
5204
  const t = /* @__PURE__ */ new Map(), s = (await n.targetDoc.suggestions()).filter(
5203
5205
  (r) => {
5204
5206
  var i;
@@ -5207,7 +5209,7 @@ async function rn(n, e) {
5207
5209
  ).sort((r, i) => String(r.createdAt).localeCompare(String(i.createdAt)));
5208
5210
  for (const r of s)
5209
5211
  try {
5210
- const i = await n.targetDoc.suggestionPayload(r), { items: o } = await tn(
5212
+ const i = await n.targetDoc.suggestionPayload(r), { items: o } = await sn(
5211
5213
  new Uint8Array(await i.arrayBuffer())
5212
5214
  ), a = o.filter((d) => d.attrs["flow:op"]), l = r.affectedIds ?? [];
5213
5215
  for (let d = 0; d < a.length && d < l.length; d++) {
@@ -5218,31 +5220,31 @@ async function rn(n, e) {
5218
5220
  }
5219
5221
  return t;
5220
5222
  }
5221
- async function on(n, e) {
5223
+ async function an(n, e) {
5222
5224
  if (!(e != null && e.fileId)) throw new Error("Choose the model file to read.");
5223
5225
  const t = new Uint8Array(
5224
5226
  await (await n.client.downloadFile(e.fileId)).arrayBuffer()
5225
5227
  );
5226
- return { picked: e, contents: await tn(t) };
5228
+ return { picked: e, contents: await sn(t) };
5227
5229
  }
5228
5230
  const Rt = {
5229
5231
  levels: "-2000240",
5230
5232
  walls: "-2000011",
5231
5233
  floors: "-2000032"
5232
- }, ks = 180 / Math.PI;
5233
- function Os(n) {
5234
+ }, Os = 180 / Math.PI;
5235
+ function As(n) {
5234
5236
  if (typeof n != "string") return null;
5235
5237
  const e = n.indexOf(":");
5236
5238
  return e <= 0 || e === n.length - 1 ? null : { family: n.slice(0, e), type: n.slice(e + 1) };
5237
5239
  }
5238
- const J = (n) => String(n);
5239
- function an(n) {
5240
+ const U = (n) => String(n);
5241
+ function cn(n) {
5240
5242
  return async (e) => {
5241
5243
  var Oe, st, nt, Me, rt, Ve, He;
5242
- const { picked: t, contents: s } = await on(
5244
+ const { picked: t, contents: s } = await an(
5243
5245
  e,
5244
5246
  e.input
5245
- ), r = Dr(s.items);
5247
+ ), r = qr(s.items);
5246
5248
  if (r.length === 0)
5247
5249
  throw new Error(
5248
5250
  n === "ifc" ? `"${t.name}" carries no platform records: it was imported without the editable converter. Process the IFC with the editable converter first; a plain import only has IFC attributes, and guessing geometry is not this recipe.` : `"${t.name}" carries no platform records, so there is nothing semantic to convert.`
@@ -5252,16 +5254,16 @@ function an(n) {
5252
5254
  throw new Error(
5253
5255
  "Free-standing instances can only be proposed by their style names: turn trustStyleNames on."
5254
5256
  );
5255
- const d = qr(r), c = jr(r), m = `recipe:${n}-to-revit`, T = await rn(e, m), A = await e.targetDoc.latest(), _ = new sn({
5257
+ const d = jr(r), c = Ur(r), m = `recipe:${n}-to-revit`, T = await on(e, m), A = await e.targetDoc.latest(), _ = new nn({
5256
5258
  project: e.projectId,
5257
5259
  document: e.targetDoc.docId,
5258
5260
  baseCommit: (A == null ? void 0 : A.version) ?? 0,
5259
5261
  author: m
5260
- }), E = nn, N = (g) => `${t.fileId}:${g}`, we = /* @__PURE__ */ new Set();
5261
- let H = 0;
5262
- const z = (g, y, k) => (we.add(g), T.has(g) ? (H++, !1) : (_.add(y, { ...k, source: g }), !0)), De = (g) => {
5262
+ }), v = rn, N = (g) => `${t.fileId}:${g}`, be = /* @__PURE__ */ new Set();
5263
+ let G = 0;
5264
+ const z = (g, y, k) => (be.add(g), T.has(g) ? (G++, !1) : (_.add(y, { ...k, source: g }), !0)), De = (g) => {
5263
5265
  const y = typeof g == "string" ? c.get(g) : void 0, k = y == null ? void 0 : y.params.thickness;
5264
- return typeof k == "number" && k > 0 ? k * E : void 0;
5266
+ return typeof k == "number" && k > 0 ? k * v : void 0;
5265
5267
  };
5266
5268
  let K = 0;
5267
5269
  if (l)
@@ -5269,87 +5271,87 @@ function an(n) {
5269
5271
  z(N(g), {
5270
5272
  CategoryId: Rt.levels,
5271
5273
  Name: y.name,
5272
- Elevation: J(y.at * E)
5274
+ Elevation: U(y.at * v)
5273
5275
  }), K++;
5274
5276
  let O = 0, q = 0;
5275
5277
  for (const g of r) {
5276
5278
  if (g.kind !== "run" || g.params.of !== "wall") continue;
5277
- const y = ht(g, "run"), k = ((st = (Oe = y == null ? void 0 : y.run) == null ? void 0 : Oe.line) == null ? void 0 : st.curves) ?? [], x = typeof (y == null ? void 0 : y.base) == "number" ? y.base : 0, P = y == null ? void 0 : y.height, F = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), he = g.params.lookRef;
5278
- if (typeof he != "string" || typeof P != "number" || !F) {
5279
+ const y = ht(g, "run"), k = ((st = (Oe = y == null ? void 0 : y.run) == null ? void 0 : Oe.line) == null ? void 0 : st.curves) ?? [], x = typeof (y == null ? void 0 : y.base) == "number" ? y.base : 0, P = y == null ? void 0 : y.height, D = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), le = g.params.lookRef;
5280
+ if (typeof le != "string" || typeof P != "number" || !D) {
5279
5281
  q++;
5280
5282
  continue;
5281
5283
  }
5282
- k.forEach((I, D) => {
5284
+ k.forEach((I, F) => {
5283
5285
  if (I.kind !== "segment" || !I.from || !I.to) {
5284
5286
  q++;
5285
5287
  return;
5286
5288
  }
5287
- const _e = x * E, j = `${J(I.from[0] * E)},${J(I.from[1] * E)},${J(_e)};${J(I.to[0] * E)},${J(I.to[1] * E)},${J(_e)}`, G = {
5289
+ const re = (D.at + x) * v, j = `${U(I.from[0] * v)},${U(I.from[1] * v)},${U(re)};${U(I.to[0] * v)},${U(I.to[1] * v)},${U(re)}`, J = {
5288
5290
  CategoryId: Rt.walls,
5289
- Type: he,
5291
+ Type: le,
5290
5292
  LocationLine: j,
5291
- Level: F.name,
5292
- BaseOffset: J((x - F.at) * E),
5293
- Height: J(P * E)
5294
- }, Q = De(he);
5295
- Q && (G["Type.Width"] = J(Q)), z(`${N(g.id)}#${D}`, G) && O++;
5293
+ Level: D.name,
5294
+ BaseOffset: U(x * v),
5295
+ Height: U(P * v)
5296
+ }, Q = De(le);
5297
+ Q && (J["Type.Width"] = U(Q)), z(`${N(g.id)}#${F}`, J) && O++;
5296
5298
  });
5297
5299
  }
5298
- let X = 0, be = 0;
5300
+ let X = 0, ve = 0;
5299
5301
  for (const g of r) {
5300
5302
  if (g.kind !== "extrusion" || g.params.of !== "slab") continue;
5301
- const y = ht(g, "extrusion"), k = typeof g.params.base == "number" ? g.params.base : 0, x = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), P = g.params.lookRef, F = (j) => {
5303
+ const y = ht(g, "extrusion"), k = typeof g.params.base == "number" ? g.params.base : 0, x = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), P = g.params.lookRef, D = (j) => {
5302
5304
  if (!(j != null && j.length)) return null;
5303
- const G = [];
5305
+ const J = [];
5304
5306
  for (const Q of j) {
5305
5307
  if (Q.kind !== "segment" || !Q.from) return null;
5306
- G.push(Q.from[0] * E, Q.from[1] * E, k * E);
5308
+ J.push(Q.from[0] * v, Q.from[1] * v, k * v);
5307
5309
  }
5308
- return G.length >= 9 ? G : null;
5309
- }, he = F((Me = (nt = y == null ? void 0 : y.profile) == null ? void 0 : nt.outline) == null ? void 0 : Me.curves);
5310
- if (typeof P != "string" || !x || !he) {
5311
- be++;
5310
+ return J.length >= 9 ? J : null;
5311
+ }, le = D((Me = (nt = y == null ? void 0 : y.profile) == null ? void 0 : nt.outline) == null ? void 0 : Me.curves);
5312
+ if (typeof P != "string" || !x || !le) {
5313
+ ve++;
5312
5314
  continue;
5313
5315
  }
5314
- const I = [he];
5316
+ const I = [le];
5315
5317
  for (const j of ((rt = y == null ? void 0 : y.profile) == null ? void 0 : rt.holes) ?? []) {
5316
- const G = F(j == null ? void 0 : j.curves);
5317
- G && I.push(G);
5318
+ const J = D(j == null ? void 0 : j.curves);
5319
+ J && I.push(J);
5318
5320
  }
5319
- const D = {
5321
+ const F = {
5320
5322
  CategoryId: Rt.floors,
5321
5323
  Type: P,
5322
5324
  Profile: JSON.stringify(I),
5323
5325
  Level: x.name
5324
- }, _e = De(P);
5325
- _e && (D["Type.Width"] = J(_e)), z(N(g.id), D) && X++;
5326
+ }, re = De(P);
5327
+ re && (F["Type.Width"] = U(re)), re && (F.HeightOffset = U(k * v + re)), z(N(g.id), F) && X++;
5326
5328
  }
5327
- let ve = 0;
5329
+ let Ee = 0;
5328
5330
  for (const g of r) {
5329
5331
  if (g.kind !== "member" || g.params.of !== "column") continue;
5330
5332
  const y = ht(g, "member"), k = y == null ? void 0 : y.start;
5331
5333
  if (!k || k.length !== 3) continue;
5332
- const x = o ? Os(g.params.lookRef) : null;
5334
+ const x = o ? As(g.params.lookRef) : null;
5333
5335
  if (o && !x || !x && !i) continue;
5334
5336
  const P = x ?? {
5335
5337
  family: i.family,
5336
5338
  type: i.type
5337
- }, F = d.get(String((y == null ? void 0 : y.level) ?? ""));
5339
+ }, D = d.get(String((y == null ? void 0 : y.level) ?? ""));
5338
5340
  z(
5339
5341
  N(g.id),
5340
5342
  {
5341
5343
  ...i && !x ? { CategoryId: i.categoryId } : {},
5342
5344
  Family: P.family,
5343
5345
  Type: P.type,
5344
- ...F ? { Level: F.name } : {}
5346
+ ...D ? { Level: D.name } : {}
5345
5347
  },
5346
5348
  {
5347
- position: [k[0] * E, k[1] * E, k[2] * E],
5348
- rotationDeg: (Number((y == null ? void 0 : y.roll) ?? 0) || 0) * ks
5349
+ position: [k[0] * v, k[1] * v, k[2] * v],
5350
+ rotationDeg: (Number((y == null ? void 0 : y.roll) ?? 0) || 0) * Os
5349
5351
  }
5350
- ) && ve++;
5352
+ ) && Ee++;
5351
5353
  }
5352
- let Ee = 0, qe = 0;
5354
+ let Te = 0, qe = 0;
5353
5355
  for (const g of r) {
5354
5356
  if (g.kind !== "familyInstance") continue;
5355
5357
  if (g.params.host) {
@@ -5359,32 +5361,32 @@ function an(n) {
5359
5361
  if (!a) continue;
5360
5362
  const y = ht(g, "instance"), k = (Ve = y == null ? void 0 : y.placement) == null ? void 0 : Ve.at;
5361
5363
  if (!k || k.length !== 3) continue;
5362
- const x = Os(g.params.type);
5364
+ const x = As(g.params.type);
5363
5365
  if (!x) continue;
5364
- const P = (He = y == null ? void 0 : y.placement) == null ? void 0 : He.right, F = P ? Math.atan2(P[1], P[0]) * ks : 0;
5366
+ const P = (He = y == null ? void 0 : y.placement) == null ? void 0 : He.right, D = P ? Math.atan2(P[1], P[0]) * Os : 0;
5365
5367
  z(
5366
5368
  N(g.id),
5367
5369
  { Family: x.family, Type: x.type },
5368
- { position: [k[0] * E, k[1] * E, k[2] * E], rotationDeg: F }
5369
- ) && Ee++;
5370
+ { position: [k[0] * v, k[1] * v, k[2] * v], rotationDeg: D }
5371
+ ) && Te++;
5370
5372
  }
5371
5373
  let je = 0;
5372
5374
  for (const g of r)
5373
5375
  (g.kind === "stair" || g.kind === "footing" || g.kind === "ramp" || g.kind === "extrusion" && g.params.of !== "slab" || g.kind === "run" && g.params.of !== "wall") && je++;
5374
- let Te = 0;
5376
+ let _e = 0;
5375
5377
  for (const [g, y] of T)
5376
- !g.startsWith(`${t.fileId}:`) || we.has(g) || (_.remove(y), Te++);
5378
+ !g.startsWith(`${t.fileId}:`) || be.has(g) || (_.remove(y), _e++);
5377
5379
  if (_.length === 0)
5378
5380
  throw new Error(
5379
- `Nothing new to ask for: "${t.name}" holds ${H} element(s) this recipe already made, ${qe + je} waiting on the applier, and nothing is left to remove.`
5381
+ `Nothing new to ask for: "${t.name}" holds ${G} element(s) this recipe already made, ${qe + je} waiting on the applier, and nothing is left to remove.`
5380
5382
  );
5381
5383
  const Ue = [
5382
5384
  K ? `${K} level(s)` : "",
5383
5385
  O ? `${O} wall(s)` : "",
5384
5386
  X ? `${X} floor(s)` : "",
5385
- ve ? `${ve} column(s)` : "",
5386
- Ee ? `${Ee} instance(s)` : "",
5387
- Te ? `${Te} gone` : ""
5387
+ Ee ? `${Ee} column(s)` : "",
5388
+ Te ? `${Te} instance(s)` : "",
5389
+ _e ? `${_e} gone` : ""
5388
5390
  ].filter(Boolean);
5389
5391
  return {
5390
5392
  title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${Ue.join(", ")}`,
@@ -5394,16 +5396,16 @@ function an(n) {
5394
5396
  ruleTallies: [
5395
5397
  { read: d.size, proposed: K },
5396
5398
  { read: O + q, proposed: O },
5397
- { read: X + be, proposed: X },
5398
- { read: ve, proposed: ve },
5399
+ { read: X + ve, proposed: X },
5399
5400
  { read: Ee, proposed: Ee },
5400
5401
  { read: Te, proposed: Te },
5402
+ { read: _e, proposed: _e },
5401
5403
  { read: qe + je, proposed: 0 }
5402
5404
  ]
5403
5405
  };
5404
5406
  };
5405
5407
  }
5406
- const Ur = {
5408
+ const Mr = {
5407
5409
  type: "object",
5408
5410
  properties: {
5409
5411
  columnType: {
@@ -5433,7 +5435,7 @@ const Ur = {
5433
5435
  default: !0
5434
5436
  }
5435
5437
  }
5436
- }, Mr = [
5438
+ }, Vr = [
5437
5439
  { reads: "Levels (datums)", proposes: "The same level on the target, ensured by name" },
5438
5440
  { reads: "Wall runs, one per straight segment", proposes: "A native wall: curve, type (made from its width when missing), level, height" },
5439
5441
  { reads: "Slabs with their boundary", proposes: "A native floor from the profile, holes included" },
@@ -5441,7 +5443,7 @@ const Ur = {
5441
5443
  { reads: "Free-standing family instances (when turned on)", proposes: "A new instance of the same-named type, placed and turned" },
5442
5444
  { reads: "Things this recipe made whose record is gone", proposes: "That element removed" },
5443
5445
  { reads: "Hosted doors/windows, stairs, roofs, footings, curtain pieces", proposes: "Nothing yet - each waits on the applier or the converter growing" }
5444
- ], cn = `
5446
+ ], hn = `
5445
5447
  ## What it does
5446
5448
 
5447
5449
  It reads the platform's records out of a .frag and asks a Revit document for
@@ -5480,7 +5482,7 @@ Records are metres and radians, Z up; proposals are written in Revit's feet
5480
5482
  and degrees. Types are matched exactly by name; Revit refuses the whole
5481
5483
  request when a loadable type is missing (system types are created from their
5482
5484
  width instead).
5483
- `, hn = {
5485
+ `, ln = {
5484
5486
  name: "frag-to-revit",
5485
5487
  title: "Platform model to Revit",
5486
5488
  description: "Turns the platform records of a .frag - levels, walls, floors, columns, instances - into change requests for a Revit document.",
@@ -5488,12 +5490,12 @@ width instead).
5488
5490
  inputs: ["frag-model"],
5489
5491
  source: { kind: "project-file", extensions: ["frag"] },
5490
5492
  runtime: "browser",
5491
- settingsSchema: Ur,
5492
- rules: Mr,
5493
- doc: cn,
5494
- run: an("frag")
5495
- }, Vr = {
5496
- ...hn,
5493
+ settingsSchema: Mr,
5494
+ rules: Vr,
5495
+ doc: hn,
5496
+ run: cn("frag")
5497
+ }, Hr = {
5498
+ ...ln,
5497
5499
  name: "ifc-to-revit",
5498
5500
  title: "IFC to Revit",
5499
5501
  description: "Turns an IFC - through the frag the platform converted it into - into native Revit change requests: levels, walls, floors, columns, instances.",
@@ -5504,9 +5506,9 @@ width instead).
5504
5506
  It reads the .frag your IFC was PROCESSED into (the IFC document's view). A
5505
5507
  plain IFC import carries only IFC attributes and is refused by name - the
5506
5508
  editable converter is what gives an IFC real records.
5507
- ` + cn,
5508
- run: an("ifc")
5509
- }, Hr = {
5509
+ ` + hn,
5510
+ run: cn("ifc")
5511
+ }, Gr = {
5510
5512
  millimeters: 1e-3,
5511
5513
  millimetres: 1e-3,
5512
5514
  mm: 1e-3,
@@ -5520,13 +5522,13 @@ editable converter is what gives an IFC real records.
5520
5522
  in: 0.0254,
5521
5523
  feet: 0.3048,
5522
5524
  ft: 0.3048
5523
- }, ln = "rhino-to-revit", As = `recipe:${ln}`;
5524
- function Gr(n) {
5525
+ }, dn = "rhino-to-revit", Rs = `recipe:${dn}`;
5526
+ function Jr(n) {
5525
5527
  const e = (n.attrs.Position ?? "").split(",").map((t) => Number(t.trim()));
5526
5528
  return e.length !== 3 || e.some((t) => !Number.isFinite(t)) ? null : [e[0], e[1], e[2]];
5527
5529
  }
5528
- const Jr = {
5529
- name: ln,
5530
+ const Wr = {
5531
+ name: dn,
5530
5532
  title: "Rhino to Revit",
5531
5533
  description: "Turns the placed objects of a Rhino layer into change requests for Revit instances of a chosen type.",
5532
5534
  to: "revit",
@@ -5596,13 +5598,13 @@ point's height.
5596
5598
  `,
5597
5599
  async run(n) {
5598
5600
  var K;
5599
- const { picked: e, contents: t } = await on(
5601
+ const { picked: e, contents: t } = await an(
5600
5602
  n,
5601
5603
  n.input
5602
5604
  ), { layer: s, instanceType: r } = n.settings;
5603
5605
  if (!s || !r)
5604
5606
  throw new Error("Choose the layer and the Revit type.");
5605
- const i = (K = t.metadata) == null ? void 0 : K.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Hr[o.trim().toLowerCase()] : void 0;
5607
+ const i = (K = t.metadata) == null ? void 0 : K.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Gr[o.trim().toLowerCase()] : void 0;
5606
5608
  if (!a)
5607
5609
  throw new Error(
5608
5610
  `"${e.name}" does not say what units its data is in${o ? ` ("${String(o)}" is not one this recipe knows)` : ""}, so nothing can be converted from it.`
@@ -5612,29 +5614,29 @@ point's height.
5612
5614
  throw new Error(
5613
5615
  `"${e.name}" declares its data as "${l}"; this recipe only converts Z up.`
5614
5616
  );
5615
- const d = a * nn, c = await rn(n, As), m = await n.targetDoc.latest(), T = new sn({
5617
+ const d = a * rn, c = await on(n, Rs), m = await n.targetDoc.latest(), T = new nn({
5616
5618
  project: n.projectId,
5617
5619
  document: n.targetDoc.docId,
5618
5620
  baseCommit: (m == null ? void 0 : m.version) ?? 0,
5619
- author: As
5621
+ author: Rs
5620
5622
  });
5621
- let A = 0, _ = 0, E = 0;
5622
- const N = /* @__PURE__ */ new Set(), we = [];
5623
+ let A = 0, _ = 0, v = 0;
5624
+ const N = /* @__PURE__ */ new Set(), be = [];
5623
5625
  for (const O of t.items) {
5624
5626
  if (!O.guid || Object.keys(O.attrs).length === 0) continue;
5625
5627
  if ((O.attrs.Layer ?? "") !== s) {
5626
- E++;
5628
+ v++;
5627
5629
  continue;
5628
5630
  }
5629
- const q = Gr(O);
5631
+ const q = Jr(O);
5630
5632
  if (!q) continue;
5631
5633
  N.add(O.guid);
5632
5634
  const X = [
5633
5635
  q[0] * d,
5634
5636
  q[1] * d,
5635
5637
  q[2] * d
5636
- ], be = c.get(O.guid);
5637
- be ? we.push({ instance: be, object: O.guid, position: X }) : (T.add(
5638
+ ], ve = c.get(O.guid);
5639
+ ve ? be.push({ instance: ve, object: O.guid, position: X }) : (T.add(
5638
5640
  {
5639
5641
  CategoryId: r.categoryId,
5640
5642
  Family: r.family,
@@ -5643,12 +5645,12 @@ point's height.
5643
5645
  { position: X, source: O.guid }
5644
5646
  ), A++);
5645
5647
  }
5646
- for (const O of we)
5648
+ for (const O of be)
5647
5649
  T.set(O.instance, {}, { position: O.position, source: O.object }), _++;
5648
- let H = 0;
5650
+ let G = 0;
5649
5651
  for (const [O, q] of c)
5650
- N.has(O) || (T.remove(q), H++);
5651
- const z = A + _ + H;
5652
+ N.has(O) || (T.remove(q), G++);
5653
+ const z = A + _ + G;
5652
5654
  if (z === 0)
5653
5655
  throw new Error(
5654
5656
  `Nothing to ask for: layer "${s}" of "${e.name}" has no placed object, and nothing of this recipe is left to remove.`
@@ -5657,7 +5659,7 @@ point's height.
5657
5659
  title: `From Rhino: ${[
5658
5660
  A ? `${A} new` : "",
5659
5661
  _ ? `${_} moved` : "",
5660
- H ? `${H} gone` : ""
5662
+ G ? `${G} gone` : ""
5661
5663
  ].filter(Boolean).join(", ")}`,
5662
5664
  verb: T.summary,
5663
5665
  targets: z,
@@ -5665,61 +5667,61 @@ point's height.
5665
5667
  ruleTallies: [
5666
5668
  { read: A, proposed: A },
5667
5669
  { read: _, proposed: _ },
5668
- { read: H, proposed: H },
5669
- { read: E, proposed: 0 }
5670
+ { read: G, proposed: G },
5671
+ { read: v, proposed: 0 }
5670
5672
  ]
5671
5673
  };
5672
5674
  }
5673
- }, Wr = [
5674
- Jr,
5675
- Vr,
5676
- hn
5675
+ }, Yr = [
5676
+ Wr,
5677
+ Hr,
5678
+ ln
5677
5679
  ];
5678
- function Kr(n) {
5679
- for (const e of Wr) n.recipes.register(e);
5680
+ function Xr(n) {
5681
+ for (const e of Yr) n.recipes.register(e);
5680
5682
  }
5681
- const Xr = {
5683
+ const Qr = {
5682
5684
  MAX_FIELDS: 200,
5683
5685
  MAX_KEY_LENGTH: 50,
5684
5686
  MAX_VALUE_LENGTH: 50
5685
- }, Qr = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Zr = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ei = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, ti = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, si = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, ni = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, ri = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, ii = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, oi = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
5687
+ }, Zr = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, ei = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ti = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, si = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, ni = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, ri = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, ii = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, oi = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, ai = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
5686
5688
  export {
5687
- Qr as CDEManager,
5688
- Or as ChannelClient,
5689
- Ks as ChannelRoom,
5690
- Zr as ClashesManager,
5691
- Ir as CollabRoom,
5689
+ Zr as CDEManager,
5690
+ Ar as ChannelClient,
5691
+ Xs as ChannelRoom,
5692
+ ei as ClashesManager,
5693
+ Sr as CollabRoom,
5692
5694
  fs as DOCUMENT_FILE,
5693
5695
  bt as DOCUMENT_SCHEMA,
5694
5696
  Ht as EngineServicesClient,
5695
- Sr as ExternalRoom,
5696
- ei as FileList,
5697
- lr as FlowDoc,
5698
- ti as GISManager,
5699
- si as GitHistoryManager,
5700
- ni as HelloWorld,
5701
- Xr as METADATA_LIMITS,
5702
- Nr as OP_SCHEMA,
5703
- sn as OperationBuilder,
5704
- Ts as PlatformClient,
5705
- Ms as ProjectDocuments,
5706
- hr as ProjectHistory,
5707
- ri as ProjectManager,
5708
- ur as Recipes,
5697
+ kr as ExternalRoom,
5698
+ ti as FileList,
5699
+ dr as FlowDoc,
5700
+ si as GISManager,
5701
+ ni as GitHistoryManager,
5702
+ ri as HelloWorld,
5703
+ Qr as METADATA_LIMITS,
5704
+ Pr as OP_SCHEMA,
5705
+ nn as OperationBuilder,
5706
+ _s as PlatformClient,
5707
+ Vs as ProjectDocuments,
5708
+ lr as ProjectHistory,
5709
+ ii as ProjectManager,
5710
+ fr as Recipes,
5709
5711
  rs as RequestError,
5710
- or as SELF_VIEWING_FORMATS,
5711
- vs as STORAGE_BATCH_MAX,
5712
+ ar as SELF_VIEWING_FORMATS,
5713
+ Es as STORAGE_BATCH_MAX,
5712
5714
  ys as StaleHistoryError,
5713
- ii as TopicsManager,
5714
- oi as UIManager,
5715
- Wr as builtinRecipes,
5716
- hn as fragToRevit,
5717
- Vr as ifcToRevit,
5715
+ oi as TopicsManager,
5716
+ ai as UIManager,
5717
+ Yr as builtinRecipes,
5718
+ ln as fragToRevit,
5719
+ Hr as ifcToRevit,
5718
5720
  Mt as mintGuid,
5719
- Ys as orderByGraph,
5720
- tn as readFrag,
5721
- Kr as registerBuiltinRecipes,
5722
- Jr as rhinoToRevit,
5723
- Tr as windowTransport
5721
+ zs as orderByGraph,
5722
+ sn as readFrag,
5723
+ Xr as registerBuiltinRecipes,
5724
+ Wr as rhinoToRevit,
5725
+ _r as windowTransport
5724
5726
  };
5725
5727
  //# sourceMappingURL=index.es.js.map