@thatopen/services 0.26.1 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -4,20 +4,20 @@ var Gt = (n) => {
4
4
  };
5
5
  var hn = (n, e, t) => e in n ? cn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
6
6
  var N = (n, e, t) => hn(n, typeof e != "symbol" ? e + "" : e, t), st = (n, e, t) => e.has(n) || Gt("Cannot " + t);
7
- var f = (n, e, t) => (st(n, e, "read from private field"), t ? t.call(n) : e.get(n)), _ = (n, e, t) => e.has(n) ? Gt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), k = (n, e, t, s) => (st(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), c = (n, e, t) => (st(n, e, "access private method"), t);
8
- const W = /* @__PURE__ */ Object.create(null);
9
- W.open = "0";
10
- W.close = "1";
11
- W.ping = "2";
12
- W.pong = "3";
13
- W.message = "4";
14
- W.upgrade = "5";
15
- W.noop = "6";
7
+ var d = (n, e, t) => (st(n, e, "read from private field"), t ? t.call(n) : e.get(n)), _ = (n, e, t) => e.has(n) ? Gt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), k = (n, e, t, s) => (st(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), h = (n, e, t) => (st(n, e, "access private method"), t);
8
+ const Y = /* @__PURE__ */ Object.create(null);
9
+ Y.open = "0";
10
+ Y.close = "1";
11
+ Y.ping = "2";
12
+ Y.pong = "3";
13
+ Y.message = "4";
14
+ Y.upgrade = "5";
15
+ Y.noop = "6";
16
16
  const Me = /* @__PURE__ */ Object.create(null);
17
- Object.keys(W).forEach((n) => {
18
- Me[W[n]] = n;
17
+ Object.keys(Y).forEach((n) => {
18
+ Me[Y[n]] = n;
19
19
  });
20
- const ht = { type: "error", data: "parser error" }, fs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ps = typeof ArrayBuffer == "function", ms = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, xt = ({ type: n, data: e }, t, s) => fs && e instanceof Blob ? t ? s(e) : Ht(e, s) : ps && (e instanceof ArrayBuffer || ms(e)) ? t ? s(e) : Ht(new Blob([e]), s) : s(W[n] + (e || "")), Ht = (n, e) => {
20
+ const ht = { type: "error", data: "parser error" }, fs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", ps = typeof ArrayBuffer == "function", ms = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, xt = ({ type: n, data: e }, t, s) => fs && e instanceof Blob ? t ? s(e) : Ht(e, s) : ps && (e instanceof ArrayBuffer || ms(e)) ? t ? s(e) : Ht(new Blob([e]), s) : s(Y[n] + (e || "")), Ht = (n, e) => {
21
21
  const t = new FileReader();
22
22
  return t.onload = function() {
23
23
  const s = t.result.split(",")[1];
@@ -43,9 +43,9 @@ for (let n = 0; n < Wt.length; n++)
43
43
  const dn = (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
- const u = new ArrayBuffer(e), h = new Uint8Array(u);
46
+ const u = new ArrayBuffer(e), c = new Uint8Array(u);
47
47
  for (s = 0; s < t; s += 4)
48
- i = Ae[n.charCodeAt(s)], o = Ae[n.charCodeAt(s + 1)], a = Ae[n.charCodeAt(s + 2)], l = Ae[n.charCodeAt(s + 3)], h[r++] = i << 2 | o >> 4, h[r++] = (o & 15) << 4 | a >> 2, h[r++] = (a & 3) << 6 | l & 63;
48
+ i = Ae[n.charCodeAt(s)], o = Ae[n.charCodeAt(s + 1)], a = Ae[n.charCodeAt(s + 2)], l = Ae[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 u;
50
50
  }, un = typeof ArrayBuffer == "function", Nt = (n, e) => {
51
51
  if (typeof n != "string")
@@ -149,12 +149,12 @@ function gn(n, e) {
149
149
  } else if (s === 2) {
150
150
  if (qe(t) < 8)
151
151
  break;
152
- const l = je(t, 8), u = new DataView(l.buffer, l.byteOffset, l.length), h = u.getUint32(0);
153
- if (h > Math.pow(2, 21) - 1) {
152
+ const l = je(t, 8), u = new DataView(l.buffer, l.byteOffset, l.length), c = u.getUint32(0);
153
+ if (c > Math.pow(2, 21) - 1) {
154
154
  a.enqueue(ht);
155
155
  break;
156
156
  }
157
- r = h * Math.pow(2, 32) + u.getUint32(4), s = 3;
157
+ r = c * Math.pow(2, 32) + u.getUint32(4), s = 3;
158
158
  } else {
159
159
  if (qe(t) < r)
160
160
  break;
@@ -499,7 +499,7 @@ class $n extends An {
499
499
  }), this.pollXhr = e;
500
500
  }
501
501
  }
502
- class J extends O {
502
+ class W extends O {
503
503
  /**
504
504
  * Request constructor
505
505
  *
@@ -553,7 +553,7 @@ class J extends O {
553
553
  }, 0);
554
554
  return;
555
555
  }
556
- typeof document < "u" && (this._index = J.requestsCount++, J.requests[this._index] = this);
556
+ typeof document < "u" && (this._index = W.requestsCount++, W.requests[this._index] = this);
557
557
  }
558
558
  /**
559
559
  * Called upon error.
@@ -575,7 +575,7 @@ class J extends O {
575
575
  this._xhr.abort();
576
576
  } catch {
577
577
  }
578
- typeof document < "u" && delete J.requests[this._index], this._xhr = null;
578
+ typeof document < "u" && delete W.requests[this._index], this._xhr = null;
579
579
  }
580
580
  }
581
581
  /**
@@ -596,8 +596,8 @@ class J extends O {
596
596
  this._cleanup();
597
597
  }
598
598
  }
599
- J.requestsCount = 0;
600
- J.requests = {};
599
+ W.requestsCount = 0;
600
+ W.requests = {};
601
601
  if (typeof document < "u") {
602
602
  if (typeof attachEvent == "function")
603
603
  attachEvent("onunload", Yt);
@@ -607,8 +607,8 @@ if (typeof document < "u") {
607
607
  }
608
608
  }
609
609
  function Yt() {
610
- for (let n in J.requests)
611
- J.requests.hasOwnProperty(n) && J.requests[n].abort();
610
+ for (let n in W.requests)
611
+ W.requests.hasOwnProperty(n) && W.requests[n].abort();
612
612
  }
613
613
  const xn = function() {
614
614
  const n = _s({
@@ -623,7 +623,7 @@ class Nn extends $n {
623
623
  this.supportsBinary = xn && !t;
624
624
  }
625
625
  request(e = {}) {
626
- return Object.assign(e, { xd: this.xd }, this.opts), new J(_s, this.uri(), e);
626
+ return Object.assign(e, { xd: this.xd }, this.opts), new W(_s, this.uri(), e);
627
627
  }
628
628
  }
629
629
  function _s(n) {
@@ -795,7 +795,7 @@ const dt = typeof addEventListener == "function" && typeof removeEventListener =
795
795
  dt && addEventListener("offline", () => {
796
796
  Ve.forEach((n) => n());
797
797
  }, !1);
798
- class he extends O {
798
+ class de extends O {
799
799
  /**
800
800
  * Socket constructor.
801
801
  *
@@ -863,7 +863,7 @@ class he extends O {
863
863
  }, 0);
864
864
  return;
865
865
  }
866
- const e = this.opts.rememberUpgrade && he.priorWebsocketSuccess && this.transports.indexOf("websocket") !== -1 ? "websocket" : this.transports[0];
866
+ const e = this.opts.rememberUpgrade && de.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 he extends O {
882
882
  * @private
883
883
  */
884
884
  onOpen() {
885
- this.readyState = "open", he.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
885
+ this.readyState = "open", de.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
886
886
  }
887
887
  /**
888
888
  * Handles a packet.
@@ -1046,7 +1046,7 @@ class he extends O {
1046
1046
  * @private
1047
1047
  */
1048
1048
  _onError(e) {
1049
- if (he.priorWebsocketSuccess = !1, this.opts.tryAllTransports && this.transports.length > 1 && this.readyState === "opening")
1049
+ if (de.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 he extends O {
1065
1065
  }
1066
1066
  }
1067
1067
  }
1068
- he.protocol = ws;
1069
- class Mn extends he {
1068
+ de.protocol = ws;
1069
+ class Mn extends de {
1070
1070
  constructor() {
1071
1071
  super(...arguments), this._upgrades = [];
1072
1072
  }
@@ -1083,15 +1083,15 @@ class Mn extends he {
1083
1083
  */
1084
1084
  _probe(e) {
1085
1085
  let t = this.createTransport(e), s = !1;
1086
- he.priorWebsocketSuccess = !1;
1086
+ de.priorWebsocketSuccess = !1;
1087
1087
  const r = () => {
1088
- s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (y) => {
1088
+ s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
1089
1089
  if (!s)
1090
- if (y.type === "pong" && y.data === "probe") {
1090
+ if (m.type === "pong" && m.data === "probe") {
1091
1091
  if (this.upgrading = !0, this.emitReserved("upgrading", t), !t)
1092
1092
  return;
1093
- he.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
1094
- s || this.readyState !== "closed" && (h(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
1093
+ de.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
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 {
1097
1097
  const w = new Error("probe error");
@@ -1100,10 +1100,10 @@ class Mn extends he {
1100
1100
  }));
1101
1101
  };
1102
1102
  function i() {
1103
- s || (s = !0, h(), t.close(), t = null);
1103
+ s || (s = !0, c(), t.close(), t = null);
1104
1104
  }
1105
- const o = (y) => {
1106
- const w = new Error("probe error: " + y);
1105
+ const o = (m) => {
1106
+ const w = new Error("probe error: " + m);
1107
1107
  w.transport = t.name, i(), this.emitReserved("upgradeError", w);
1108
1108
  };
1109
1109
  function a() {
@@ -1112,10 +1112,10 @@ class Mn extends he {
1112
1112
  function l() {
1113
1113
  o("socket closed");
1114
1114
  }
1115
- function u(y) {
1116
- t && y.name !== t.name && i();
1115
+ function u(m) {
1116
+ t && m.name !== t.name && i();
1117
1117
  }
1118
- const h = () => {
1118
+ const c = () => {
1119
1119
  t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", a), this.off("close", l), this.off("upgrading", u);
1120
1120
  };
1121
1121
  t.once("open", r), t.once("error", o), t.once("close", a), this.once("close", l), this.once("upgrading", u), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
@@ -1568,8 +1568,8 @@ class Ss extends O {
1568
1568
  data: t
1569
1569
  };
1570
1570
  if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
1571
- const h = this.ids++, y = t.pop();
1572
- this._registerAckCallback(h, y), o.id = h;
1571
+ const c = this.ids++, m = t.pop();
1572
+ this._registerAckCallback(c, m), o.id = c;
1573
1573
  }
1574
1574
  const a = (r = (s = this.io.engine) === null || s === void 0 ? void 0 : s.transport) === null || r === void 0 ? void 0 : r.writable, l = this.connected && !(!((i = this.io.engine) === null || i === void 0) && i._hasPingExpired());
1575
1575
  return this.flags.volatile && !a || (l ? (this.notifyOutgoingListeners(o), this.packet(o)) : this.sendBuffer.push(o)), this.flags = {}, this;
@@ -2321,10 +2321,10 @@ const Xe = "thatopen/document@1", zt = "document.json", nr = [
2321
2321
  function De(n) {
2322
2322
  return String(n._id ?? n.id ?? "");
2323
2323
  }
2324
- var fe, Os, mt;
2324
+ var me, Os, mt;
2325
2325
  class ks {
2326
2326
  constructor(e, t) {
2327
- _(this, fe);
2327
+ _(this, me);
2328
2328
  this.client = e, this.projectId = t;
2329
2329
  }
2330
2330
  /**
@@ -2363,12 +2363,12 @@ class ks {
2363
2363
  this.projectId
2364
2364
  ), l = De(a);
2365
2365
  await this.client.updateFile(e, { parentFolderId: l });
2366
- const u = [], h = await c(this, fe, Os).call(this, s);
2367
- if (h)
2366
+ const u = [], c = await h(this, me, Os).call(this, s);
2367
+ if (c)
2368
2368
  try {
2369
- const I = await this.client.getFile(h);
2370
- await this.client.updateFile(h, { parentFolderId: l }), u.push({
2371
- fileId: h,
2369
+ const I = await this.client.getFile(c);
2370
+ await this.client.updateFile(c, { parentFolderId: l }), u.push({
2371
+ fileId: c,
2372
2372
  format: Qt(String(I.name ?? ""), I.fileExtension)
2373
2373
  });
2374
2374
  } catch {
@@ -2387,7 +2387,7 @@ class ks {
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 c(this, fe, mt).call(this, e);
2390
+ const t = await h(this, me, mt).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;
@@ -2439,7 +2439,7 @@ class ks {
2439
2439
  views: t.views ?? []
2440
2440
  }, r = new Blob([JSON.stringify(s)], {
2441
2441
  type: "application/json"
2442
- }), i = await c(this, fe, mt).call(this, e);
2442
+ }), i = await h(this, me, mt).call(this, e);
2443
2443
  if (i) {
2444
2444
  await this.client.updateFile(i.id, {
2445
2445
  file: r,
@@ -2456,7 +2456,7 @@ class ks {
2456
2456
  });
2457
2457
  }
2458
2458
  }
2459
- fe = new WeakSet(), Os = async function(e) {
2459
+ me = new WeakSet(), Os = async function(e) {
2460
2460
  const t = [...e.versions ?? []].sort(
2461
2461
  (s, r) => String(r.createdAt ?? "").localeCompare(String(s.createdAt ?? ""))
2462
2462
  );
@@ -2502,11 +2502,11 @@ class Zt extends Error {
2502
2502
  ), this.expectedGuid = e, this.actualGuid = t, this.name = "StaleHistoryError";
2503
2503
  }
2504
2504
  }
2505
- const es = "bimterop", yt = "revitflow_history.json", ye = "revitflow_ops.json", ts = "revitflow/ops@1", As = "revitflow_model.frag", Rs = "revitflow_", ir = "bimterop-locks-anchor", Ue = () => `v-${Date.now()}`;
2505
+ const es = "bimterop", yt = "revitflow_history.json", we = "revitflow_ops.json", ts = "revitflow/ops@1", As = "revitflow_model.frag", Rs = "revitflow_", ir = "bimterop-locks-anchor", Ue = () => `v-${Date.now()}`;
2506
2506
  function Cs(n, e) {
2507
2507
  return n.filter((t) => String(t.parentId ?? "") === e);
2508
2508
  }
2509
- function H(n) {
2509
+ function J(n) {
2510
2510
  return String(n._id ?? n.id ?? "");
2511
2511
  }
2512
2512
  var M, Ne, gt;
@@ -2518,7 +2518,7 @@ class or {
2518
2518
  }
2519
2519
  /** The project's connected documents. */
2520
2520
  async docs() {
2521
- const e = await c(this, Ne, gt).call(this);
2521
+ const e = await h(this, Ne, gt).call(this);
2522
2522
  if (!e) return [];
2523
2523
  const t = await this.client.listFolders({
2524
2524
  parentFolderId: e,
@@ -2528,18 +2528,18 @@ class or {
2528
2528
  const i = String(r.name ?? ""), o = i.indexOf("-");
2529
2529
  if (o <= 0) continue;
2530
2530
  const l = (await this.client.listFiles({
2531
- folderId: H(r)
2531
+ folderId: J(r)
2532
2532
  })).map(
2533
- (y) => String(y.name ?? "")
2534
- ), u = l.find((y) => y === As) ?? l.find(
2535
- (y) => y.endsWith(".frag") && !y.startsWith(Rs)
2536
- ), h = l.includes(yt) || l.includes(ye) || !!u;
2533
+ (m) => String(m.name ?? "")
2534
+ ), u = l.find((m) => m === As) ?? l.find(
2535
+ (m) => m.endsWith(".frag") && !m.startsWith(Rs)
2536
+ ), c = l.includes(yt) || l.includes(we) || !!u;
2537
2537
  s.push({
2538
2538
  source: i.slice(0, o),
2539
2539
  docId: i.slice(o + 1),
2540
- folderId: H(r),
2540
+ folderId: J(r),
2541
2541
  modelName: u,
2542
- ...h ? {} : { empty: !0 }
2542
+ ...c ? {} : { empty: !0 }
2543
2543
  });
2544
2544
  }
2545
2545
  return s;
@@ -2550,8 +2550,8 @@ class or {
2550
2550
  }
2551
2551
  /** @internal The `bimterop` folder id, resolved once. */
2552
2552
  async rootFolderId(e = !1) {
2553
- if (f(this, M)) return f(this, M);
2554
- const t = await c(this, Ne, gt).call(this);
2553
+ if (d(this, M)) return d(this, M);
2554
+ const t = await h(this, Ne, gt).call(this);
2555
2555
  if (t) return t;
2556
2556
  if (!e) return;
2557
2557
  const s = await this.client.createFolder(
@@ -2559,23 +2559,23 @@ class or {
2559
2559
  void 0,
2560
2560
  this.projectId
2561
2561
  );
2562
- return k(this, M, H(s)), f(this, M);
2562
+ return k(this, M, J(s)), d(this, M);
2563
2563
  }
2564
2564
  }
2565
2565
  M = new WeakMap(), Ne = new WeakSet(), gt = async function() {
2566
- if (f(this, M)) return f(this, M);
2566
+ if (d(this, M)) return d(this, M);
2567
2567
  const t = (await this.client.listFolders({
2568
2568
  projectId: this.projectId
2569
2569
  })).find(
2570
2570
  (s) => String(s.name ?? "") === es && !s.parentId
2571
2571
  );
2572
- return t && k(this, M, H(t)), f(this, M);
2572
+ return t && k(this, M, J(t)), d(this, M);
2573
2573
  };
2574
- var X, p, ge, we, z, wt, Re, be, bt, He, Ce, Je, vt, $s;
2574
+ var Q, p, X, be, H, wt, Re, ie, bt, He, Ce, Je, vt, $s;
2575
2575
  class ar {
2576
2576
  constructor(e, t, s, r) {
2577
2577
  _(this, p);
2578
- _(this, X);
2578
+ _(this, Q);
2579
2579
  this.client = e, this.project = t, this.source = s, this.docId = r;
2580
2580
  }
2581
2581
  // ─── Reading ───────────────────────────────────────────────────────────────
@@ -2585,7 +2585,7 @@ class ar {
2585
2585
  * Each version gets its `ordinal` filled in.
2586
2586
  */
2587
2587
  async timeline() {
2588
- const e = await c(this, p, He).call(this);
2588
+ const e = await h(this, p, He).call(this);
2589
2589
  return xs((e == null ? void 0 : e.commits) ?? []);
2590
2590
  }
2591
2591
  /** The head of the timeline, or null before the first sync. */
@@ -2604,18 +2604,80 @@ class ar {
2604
2604
  );
2605
2605
  return await (await this.client.downloadHiddenFile(e.deltaId)).blob();
2606
2606
  }
2607
- /** The visible model .frag as last fully exported. */
2607
+ /**
2608
+ * The visible model .frag AS LAST FULLY EXPORTED — the first commit, or the
2609
+ * last explicit publish. Ordinary syncs only add hidden deltas, so this is
2610
+ * NOT necessarily the head: anything computed on it (a clash run) is as of
2611
+ * the last `full: true` version. For the model at a specific version, read
2612
+ * {@link modelParts} and compose.
2613
+ */
2608
2614
  async model() {
2609
- const e = await c(this, p, be).call(this);
2615
+ const e = await h(this, p, ie).call(this);
2610
2616
  if (!e)
2611
2617
  throw new Error(
2612
2618
  `Document ${this.source}-${this.docId} has no model file yet.`
2613
2619
  );
2614
2620
  return await (await this.client.downloadFile(e.id)).blob();
2615
2621
  }
2622
+ /**
2623
+ * The ordered recipe for the model AT a version: the baseline full export
2624
+ * at-or-before it, then one step per later version up to it — each step's
2625
+ * delta .frag (absent on geometry-less versions) and the element uniqueIds
2626
+ * it removed. The consumer composes with its geometry engine: load the
2627
+ * baseline, then per step replace elements by uniqueId from the delta and
2628
+ * drop the removed. Composing is NOT done here: writing a merged .frag
2629
+ * takes the fragments engine, which this package deliberately does not
2630
+ * carry.
2631
+ *
2632
+ * UniqueIds are the native application's own stable element ids (a Revit
2633
+ * UniqueId survives syncs, machines and full exports), which is what makes
2634
+ * replace-by-uniqueId the whole composition rule.
2635
+ *
2636
+ * When the baseline is NEWER than the asked version (somebody published
2637
+ * after it), the visible file no longer shows that moment: `baseline`
2638
+ * then carries the older version's `storageVersion` when the history
2639
+ * recorded one, so the consumer can download that stored file version
2640
+ * instead of the current one.
2641
+ */
2642
+ async modelParts(e) {
2643
+ const t = await this.timeline();
2644
+ if (t.length === 0)
2645
+ throw new Error(
2646
+ `Document ${this.source}-${this.docId} has no history yet.`
2647
+ );
2648
+ const s = e == null ? void 0 : e.at, r = s ? t.findIndex((c) => c.guid === s) : t.length - 1;
2649
+ if (r < 0)
2650
+ throw new Error(`No version ${s} in this document's timeline.`);
2651
+ let i = 0;
2652
+ for (let c = r; c >= 0; c--)
2653
+ if (t[c].full) {
2654
+ i = c;
2655
+ break;
2656
+ }
2657
+ const o = await h(this, p, ie).call(this);
2658
+ if (!o)
2659
+ throw new Error(
2660
+ `Document ${this.source}-${this.docId} has no model file yet.`
2661
+ );
2662
+ const a = t[i], l = t.slice(r + 1).some((c) => c.full), u = t.slice(i + 1, r + 1).map((c) => ({
2663
+ guid: c.guid,
2664
+ ...c.deltaId ? { deltaId: c.deltaId } : {},
2665
+ removedUniqueIds: c.changes.filter((m) => m.type === "delete").map((m) => m.uniqueId)
2666
+ }));
2667
+ return {
2668
+ baseline: {
2669
+ fileId: o.id,
2670
+ guid: a.guid,
2671
+ current: !l,
2672
+ ...a.version !== void 0 ? { storageVersion: a.version } : {}
2673
+ },
2674
+ steps: u,
2675
+ at: t[r].guid
2676
+ };
2677
+ }
2616
2678
  /** The document folder's item id — the id the CDE knows this document by. */
2617
2679
  async folderId() {
2618
- return await c(this, p, z).call(this, !1);
2680
+ return await h(this, p, H).call(this, !1);
2619
2681
  }
2620
2682
  // ─── The document descriptor ───────────────────────────────────────────────
2621
2683
  /**
@@ -2623,7 +2685,7 @@ class ar {
2623
2685
  * not carry one yet — an old folder from before descriptors existed.
2624
2686
  */
2625
2687
  async descriptor() {
2626
- return await f(this, p, ge).descriptor(await c(this, p, z).call(this, !1));
2688
+ return await d(this, p, X).descriptor(await h(this, p, H).call(this, !1));
2627
2689
  }
2628
2690
  /**
2629
2691
  * The first view whose format appears in `formats`, searched in the order
@@ -2631,7 +2693,7 @@ class ar {
2631
2693
  * model .frag on a descriptor-less folder, so old documents keep viewing.
2632
2694
  */
2633
2695
  async view(e) {
2634
- const t = await c(this, p, z).call(this, !1), s = await f(this, p, ge).descriptor(t);
2696
+ const t = await h(this, p, H).call(this, !1), s = await d(this, p, X).descriptor(t);
2635
2697
  if (s) {
2636
2698
  for (const i of e) {
2637
2699
  const o = s.views.find((a) => a.format === i);
@@ -2640,7 +2702,7 @@ class ar {
2640
2702
  return null;
2641
2703
  }
2642
2704
  if (!e.includes("frag")) return null;
2643
- const r = await c(this, p, be).call(this);
2705
+ const r = await h(this, p, ie).call(this);
2644
2706
  return r ? { fileId: r.id, format: "frag" } : null;
2645
2707
  }
2646
2708
  /**
@@ -2649,17 +2711,36 @@ class ar {
2649
2711
  * One view per format: a same-format view is replaced, not accumulated.
2650
2712
  */
2651
2713
  async addView(e) {
2652
- const t = await c(this, p, z).call(this, !0);
2653
- if (await f(this, p, ge).descriptor(t)) {
2654
- await f(this, p, ge).addView(t, e);
2714
+ const t = await h(this, p, H).call(this, !0);
2715
+ if (await d(this, p, X).descriptor(t)) {
2716
+ await d(this, p, X).addView(t, e);
2655
2717
  return;
2656
2718
  }
2657
- const r = await c(this, p, be).call(this);
2658
- await f(this, p, ge).setDescriptor(t, {
2659
- name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? f(this, p, we),
2719
+ const r = await h(this, p, ie).call(this);
2720
+ await d(this, p, X).setDescriptor(t, {
2721
+ name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? d(this, p, be),
2660
2722
  views: [e]
2661
2723
  });
2662
2724
  }
2725
+ /**
2726
+ * Makes sure the folder carries a descriptor, WRITING one when it predates
2727
+ * them: the visible model .frag becomes the 'frag' view. The explicit form
2728
+ * of what {@link addView} does implicitly — reads like `descriptor()` never
2729
+ * write, so migrating an old folder is this deliberate call. Returns the
2730
+ * descriptor either way, or null when there is nothing to describe yet (no
2731
+ * model file).
2732
+ */
2733
+ async ensureDescriptor() {
2734
+ const e = await h(this, p, H).call(this, !1), t = await d(this, p, X).descriptor(e);
2735
+ if (t) return t;
2736
+ const s = await h(this, p, ie).call(this);
2737
+ if (!s) return null;
2738
+ const r = {
2739
+ name: s.name.replace(/\.frag$/, ""),
2740
+ views: [{ fileId: s.id, format: "frag" }]
2741
+ };
2742
+ return await d(this, p, X).setDescriptor(e, r), await d(this, p, X).descriptor(e);
2743
+ }
2663
2744
  // ─── Ownership (element locks) ─────────────────────────────────────────────
2664
2745
  /**
2665
2746
  * Who currently holds which elements, read from the lock registry the
@@ -2669,15 +2750,15 @@ class ar {
2669
2750
  * claims counts only for the earliest one, matching the plugins' rule.
2670
2751
  */
2671
2752
  async ownership() {
2672
- const e = await c(this, p, Re).call(this, ir);
2753
+ const e = await h(this, p, Re).call(this, ir);
2673
2754
  if (!e) return [];
2674
2755
  const t = await this.client.getHiddenFilesByParent(e.id), s = await Promise.all(
2675
2756
  t.map(async (o) => {
2676
2757
  try {
2677
- const a = H(o), l = await this.client.downloadHiddenFile(a), u = JSON.parse(await l.text());
2758
+ const a = J(o), l = await this.client.downloadHiddenFile(a), u = JSON.parse(await l.text());
2678
2759
  return !u || typeof u != "object" || !("revitflowlock" in u) || !Array.isArray(u.keys) ? null : {
2679
2760
  owner: String(u.user ?? ""),
2680
- keys: u.keys.filter((h) => typeof h == "string")
2761
+ keys: u.keys.filter((c) => typeof c == "string")
2681
2762
  };
2682
2763
  } catch {
2683
2764
  return null;
@@ -2706,8 +2787,8 @@ class ar {
2706
2787
  */
2707
2788
  async sync(e) {
2708
2789
  var a;
2709
- const t = await c(this, p, z).call(this, !0);
2710
- let s = await c(this, p, He).call(this) ?? {
2790
+ const t = await h(this, p, H).call(this, !0);
2791
+ let s = await h(this, p, He).call(this) ?? {
2711
2792
  model: this.docId,
2712
2793
  commits: []
2713
2794
  };
@@ -2726,8 +2807,8 @@ class ar {
2726
2807
  changes: e.changes,
2727
2808
  counts: cr(e.changes)
2728
2809
  };
2729
- if (e.model && (await c(this, p, $s).call(this, t, e.model), i.full = !0), e.delta) {
2730
- const l = await c(this, p, be).call(this);
2810
+ if (e.model && (await h(this, p, $s).call(this, t, e.model), i.full = !0), e.delta) {
2811
+ const l = await h(this, p, ie).call(this);
2731
2812
  if (!l)
2732
2813
  throw new Error(
2733
2814
  "A delta needs the model file to hang from: sync a full model first."
@@ -2740,7 +2821,7 @@ class ar {
2740
2821
  u._id ?? u.id
2741
2822
  );
2742
2823
  }
2743
- const o = await c(this, p, He).call(this);
2824
+ const o = await h(this, p, He).call(this);
2744
2825
  if (o) {
2745
2826
  s = o;
2746
2827
  const l = ss(s.commits);
@@ -2748,12 +2829,12 @@ class ar {
2748
2829
  throw new Zt(e.expectedLatestGuid, l == null ? void 0 : l.guid);
2749
2830
  l && !i.parents && (i.parents = [l.guid]);
2750
2831
  }
2751
- return s.commits.push(i), await c(this, p, Je).call(this, t, yt, s), i;
2832
+ return s.commits.push(i), await h(this, p, Je).call(this, t, yt, s), i;
2752
2833
  }
2753
2834
  // ─── Suggestions (change requests) ────────────────────────────────────────
2754
2835
  /** Every suggestion in the document's queue, pending or resolved. */
2755
2836
  async suggestions() {
2756
- const e = await c(this, p, Ce).call(this);
2837
+ const e = await h(this, p, Ce).call(this);
2757
2838
  return (e == null ? void 0 : e.ops) ?? [];
2758
2839
  }
2759
2840
  /** The suggestions still waiting for the owner, oldest first. */
@@ -2765,7 +2846,7 @@ class ar {
2765
2846
  * uploaded as a hidden file under the suggestions index.
2766
2847
  */
2767
2848
  async suggest(e) {
2768
- const t = await c(this, p, z).call(this, !0), s = await c(this, p, Ce).call(this) ?? { schema: ts, ops: [] }, r = await c(this, p, Re).call(this, ye), i = {
2849
+ const t = await h(this, p, H).call(this, !0), s = await h(this, p, Ce).call(this) ?? { schema: ts, ops: [] }, r = await h(this, p, Re).call(this, we), i = {
2769
2850
  opId: e.opId ?? Et(),
2770
2851
  to: e.to ?? this.source,
2771
2852
  title: e.title,
@@ -2779,7 +2860,7 @@ class ar {
2779
2860
  ...e.baseCommitGuid ? { baseCommitGuid: e.baseCommitGuid } : {}
2780
2861
  };
2781
2862
  if (e.payload) {
2782
- const a = r ?? await c(this, p, vt).call(this, t, ye, s), l = await this.client.createHiddenFile(
2863
+ const a = r ?? await h(this, p, vt).call(this, t, we, s), l = await this.client.createHiddenFile(
2783
2864
  e.payload,
2784
2865
  a.id
2785
2866
  );
@@ -2787,8 +2868,8 @@ class ar {
2787
2868
  l._id ?? l.id
2788
2869
  );
2789
2870
  }
2790
- const o = await c(this, p, Ce).call(this) ?? s;
2791
- return o.schema ?? (o.schema = ts), o.ops.push(i), await c(this, p, Je).call(this, t, ye, o), i;
2871
+ const o = await h(this, p, Ce).call(this) ?? s;
2872
+ return o.schema ?? (o.schema = ts), o.ops.push(i), await h(this, p, Je).call(this, t, we, o), i;
2792
2873
  }
2793
2874
  /** A suggestion's .frag payload. */
2794
2875
  async suggestionPayload(e) {
@@ -2802,20 +2883,20 @@ class ar {
2802
2883
  * use it for `discarded`.
2803
2884
  */
2804
2885
  async resolveSuggestion(e, t) {
2805
- const s = await c(this, p, z).call(this, !1);
2886
+ const s = await h(this, p, H).call(this, !1);
2806
2887
  if (!s) throw new Error("This document has no suggestion queue.");
2807
- const r = await c(this, p, Ce).call(this), i = r == null ? void 0 : r.ops.find((o) => o.opId === e);
2888
+ const r = await h(this, p, Ce).call(this), i = r == null ? void 0 : r.ops.find((o) => o.opId === e);
2808
2889
  if (!r || !i)
2809
2890
  throw new Error(`No suggestion ${e} in this document's queue.`);
2810
- return Object.assign(i, t), await c(this, p, Je).call(this, s, ye, r), i;
2891
+ return Object.assign(i, t), await h(this, p, Je).call(this, s, we, r), i;
2811
2892
  }
2812
2893
  }
2813
- X = new WeakMap(), p = new WeakSet(), ge = function() {
2894
+ Q = new WeakMap(), p = new WeakSet(), X = function() {
2814
2895
  return new ks(this.client, this.project.projectId);
2815
- }, we = function() {
2896
+ }, be = function() {
2816
2897
  return `${this.source}-${this.docId}`;
2817
- }, z = async function(e) {
2818
- if (f(this, X)) return f(this, X);
2898
+ }, H = async function(e) {
2899
+ if (d(this, Q)) return d(this, Q);
2819
2900
  const t = await this.project.rootFolderId(e);
2820
2901
  if (!t)
2821
2902
  throw new Error(
@@ -2825,35 +2906,35 @@ X = new WeakMap(), p = new WeakSet(), ge = function() {
2825
2906
  parentFolderId: t,
2826
2907
  projectId: this.project.projectId
2827
2908
  }), r = Cs(s, t).find(
2828
- (o) => String(o.name ?? "") === f(this, p, we)
2909
+ (o) => String(o.name ?? "") === d(this, p, be)
2829
2910
  );
2830
2911
  if (r)
2831
- return k(this, X, H(r)), f(this, X);
2912
+ return k(this, Q, J(r)), d(this, Q);
2832
2913
  if (!e)
2833
2914
  throw new Error(
2834
- `Document ${f(this, p, we)} does not exist in this project.`
2915
+ `Document ${d(this, p, be)} does not exist in this project.`
2835
2916
  );
2836
2917
  const i = await this.client.createFolder(
2837
- f(this, p, we),
2918
+ d(this, p, be),
2838
2919
  t,
2839
2920
  this.project.projectId
2840
2921
  );
2841
- return k(this, X, H(i)), f(this, X);
2922
+ return k(this, Q, J(i)), d(this, Q);
2842
2923
  }, wt = async function() {
2843
- const e = await c(this, p, z).call(this, !1);
2924
+ const e = await h(this, p, H).call(this, !1);
2844
2925
  return (await this.client.listFiles({ folderId: e })).map((s) => ({
2845
- id: H(s),
2926
+ id: J(s),
2846
2927
  name: String(s.name ?? "")
2847
2928
  }));
2848
2929
  }, Re = async function(e) {
2849
2930
  try {
2850
- return (await c(this, p, wt).call(this)).find((t) => t.name === e);
2931
+ return (await h(this, p, wt).call(this)).find((t) => t.name === e);
2851
2932
  } catch {
2852
2933
  return;
2853
2934
  }
2854
- }, be = async function() {
2935
+ }, ie = async function() {
2855
2936
  try {
2856
- const e = await c(this, p, wt).call(this);
2937
+ const e = await h(this, p, wt).call(this);
2857
2938
  return e.find((t) => t.name === As) ?? e.find(
2858
2939
  (t) => t.name.endsWith(".frag") && !t.name.startsWith(Rs)
2859
2940
  );
@@ -2861,23 +2942,23 @@ X = new WeakMap(), p = new WeakSet(), ge = function() {
2861
2942
  return;
2862
2943
  }
2863
2944
  }, bt = async function(e) {
2864
- const t = await c(this, p, Re).call(this, e);
2945
+ const t = await h(this, p, Re).call(this, e);
2865
2946
  if (!t) return;
2866
2947
  const r = await (await this.client.downloadFile(t.id)).text();
2867
2948
  if (r.trim())
2868
2949
  return JSON.parse(r);
2869
2950
  }, He = function() {
2870
- return c(this, p, bt).call(this, yt);
2951
+ return h(this, p, bt).call(this, yt);
2871
2952
  }, Ce = function() {
2872
- return c(this, p, bt).call(this, ye);
2953
+ return h(this, p, bt).call(this, we);
2873
2954
  }, Je = async function(e, t, s) {
2874
2955
  const r = new Blob([JSON.stringify(s)], {
2875
2956
  type: "application/json"
2876
- }), i = await c(this, p, Re).call(this, t);
2957
+ }), i = await h(this, p, Re).call(this, t);
2877
2958
  return i ? (await this.client.updateFile(i.id, {
2878
2959
  file: r,
2879
2960
  versionTag: Ue()
2880
- }), i) : await c(this, p, vt).call(this, e, t, s);
2961
+ }), i) : await h(this, p, vt).call(this, e, t, s);
2881
2962
  }, vt = async function(e, t, s) {
2882
2963
  const r = new Blob([JSON.stringify(s)], {
2883
2964
  type: "application/json"
@@ -2888,22 +2969,22 @@ X = new WeakMap(), p = new WeakSet(), ge = function() {
2888
2969
  parentFolderId: e,
2889
2970
  projectId: this.project.projectId
2890
2971
  }), o = i.item;
2891
- return { id: H(o ?? i), name: t };
2972
+ return { id: J(o ?? i), name: t };
2892
2973
  }, $s = async function(e, t) {
2893
- const s = await c(this, p, be).call(this);
2974
+ const s = await h(this, p, ie).call(this);
2894
2975
  if (s)
2895
2976
  return await this.client.updateFile(s.id, {
2896
2977
  file: t,
2897
2978
  versionTag: Ue()
2898
2979
  }), s;
2899
- const r = `${f(this, p, we)}.frag`, i = await this.client.createFile({
2980
+ const r = `${d(this, p, be)}.frag`, i = await this.client.createFile({
2900
2981
  file: t,
2901
2982
  name: r,
2902
2983
  versionTag: Ue(),
2903
2984
  parentFolderId: e,
2904
2985
  projectId: this.project.projectId
2905
2986
  }), o = i.item;
2906
- return { id: H(o ?? i), name: r };
2987
+ return { id: J(o ?? i), name: r };
2907
2988
  };
2908
2989
  function cr(n) {
2909
2990
  const e = { added: 0, modified: 0, removed: 0 };
@@ -2914,29 +2995,29 @@ function cr(n) {
2914
2995
  function xs(n) {
2915
2996
  var l;
2916
2997
  if (n.length <= 1)
2917
- return n.forEach((u, h) => u.ordinal = h), [...n];
2998
+ return n.forEach((u, c) => u.ordinal = c), [...n];
2918
2999
  const e = new Map(n.map((u) => [u.guid, u])), t = /* @__PURE__ */ new Map(), s = [];
2919
3000
  for (const u of n) {
2920
- const h = (l = u.parents) == null ? void 0 : l[0];
2921
- if (h && e.has(h)) {
2922
- const y = t.get(h) ?? [];
2923
- y.push(u), t.set(h, y);
3001
+ const c = (l = u.parents) == null ? void 0 : l[0];
3002
+ if (c && e.has(c)) {
3003
+ const m = t.get(c) ?? [];
3004
+ m.push(u), t.set(c, m);
2924
3005
  } else
2925
3006
  s.push(u);
2926
3007
  }
2927
- const r = (u, h) => String(u.timestamp).localeCompare(String(h.timestamp));
3008
+ const r = (u, c) => String(u.timestamp).localeCompare(String(c.timestamp));
2928
3009
  s.sort(r);
2929
3010
  const i = [], o = [...s].reverse(), a = /* @__PURE__ */ new Set();
2930
3011
  for (; o.length; ) {
2931
3012
  const u = o.pop();
2932
3013
  if (a.has(u.guid)) continue;
2933
3014
  a.add(u.guid), i.push(u);
2934
- const h = (t.get(u.guid) ?? []).sort(r);
2935
- for (let y = h.length - 1; y >= 0; y--) o.push(h[y]);
3015
+ const c = (t.get(u.guid) ?? []).sort(r);
3016
+ for (let m = c.length - 1; m >= 0; m--) o.push(c[m]);
2936
3017
  }
2937
3018
  for (const u of n)
2938
3019
  a.has(u.guid) || i.push(u);
2939
- return i.forEach((u, h) => u.ordinal = h), i;
3020
+ return i.forEach((u, c) => u.ordinal = c), i;
2940
3021
  }
2941
3022
  function ss(n) {
2942
3023
  const e = xs(n);
@@ -2949,28 +3030,28 @@ function Et() {
2949
3030
  return (e === "x" ? t : t & 3 | 8).toString(16);
2950
3031
  });
2951
3032
  }
2952
- var ie, Pe, _t;
3033
+ var ae, Pe, _t;
2953
3034
  class hr {
2954
3035
  constructor(e) {
2955
3036
  _(this, Pe);
2956
- _(this, ie, /* @__PURE__ */ new Map());
3037
+ _(this, ae, /* @__PURE__ */ new Map());
2957
3038
  this.client = e;
2958
3039
  }
2959
3040
  /** Registers a recipe. One per name; a second with the same name throws. */
2960
3041
  register(e) {
2961
- if (f(this, ie).has(e.name))
3042
+ if (d(this, ae).has(e.name))
2962
3043
  throw new Error(`A recipe named "${e.name}" is already registered.`);
2963
- f(this, ie).set(e.name, e);
3044
+ d(this, ae).set(e.name, e);
2964
3045
  }
2965
3046
  /** The registered recipes, optionally filtered by target application. */
2966
3047
  list(e) {
2967
- return [...f(this, ie).values()].filter(
3048
+ return [...d(this, ae).values()].filter(
2968
3049
  (s) => (!(e != null && e.to) || s.to === e.to) && (!(e != null && e.input) || s.inputs.includes(e.input))
2969
3050
  );
2970
3051
  }
2971
3052
  /** A registered recipe by name, or undefined. */
2972
3053
  get(e) {
2973
- return f(this, ie).get(e);
3054
+ return d(this, ae).get(e);
2974
3055
  }
2975
3056
  /**
2976
3057
  * Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
@@ -2979,7 +3060,7 @@ class hr {
2979
3060
  * included, with no second run. Discard it and the plan never happened.
2980
3061
  */
2981
3062
  async plan(e, t) {
2982
- const { base: s, opId: r, result: i } = await c(this, Pe, _t).call(this, e, t);
3063
+ const { base: s, opId: r, result: i } = await h(this, Pe, _t).call(this, e, t);
2983
3064
  return {
2984
3065
  opId: r,
2985
3066
  projectId: t.projectId,
@@ -3012,7 +3093,7 @@ class hr {
3012
3093
  * to show the tallies before queueing.
3013
3094
  */
3014
3095
  async run(e, t) {
3015
- const { targetDoc: s, base: r, opId: i, result: o } = await c(this, Pe, _t).call(this, e, t);
3096
+ const { targetDoc: s, base: r, opId: i, result: o } = await h(this, Pe, _t).call(this, e, t);
3016
3097
  return { suggestion: await s.suggest({
3017
3098
  opId: i,
3018
3099
  title: o.title,
@@ -3025,8 +3106,8 @@ class hr {
3025
3106
  }), result: o };
3026
3107
  }
3027
3108
  }
3028
- ie = new WeakMap(), Pe = new WeakSet(), _t = async function(e, t) {
3029
- const s = f(this, ie).get(e);
3109
+ ae = new WeakMap(), Pe = new WeakSet(), _t = async function(e, t) {
3110
+ const s = d(this, ae).get(e);
3030
3111
  if (!s) throw new Error(`No recipe named "${e}" is registered.`);
3031
3112
  if (s.to !== t.target.source)
3032
3113
  throw new Error(
@@ -3079,7 +3160,7 @@ class Lt extends Error {
3079
3160
  this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? dr(o.details);
3080
3161
  }
3081
3162
  }
3082
- const G = "item/folder", g = "item", ne = "processor", ur = "npm-registry", K = "hidden", ot = "FILE", at = "TOOL", ct = "APP", fr = 500, rs = 3e4, pr = 0.25, mr = (n) => new Promise((e) => setTimeout(e, n));
3163
+ const G = "item/folder", g = "item", re = "processor", ur = "npm-registry", z = "hidden", ot = "FILE", at = "TOOL", ct = "APP", fr = 500, rs = 3e4, pr = 0.25, mr = (n) => new Promise((e) => setTimeout(e, n));
3083
3164
  function yr(n) {
3084
3165
  var r, i;
3085
3166
  const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
@@ -3100,7 +3181,7 @@ function wr(n, e) {
3100
3181
  ), s = t * pr * Math.random(), r = n instanceof Lt && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
3101
3182
  return r != null ? Math.min(r, rs) + s : t + s;
3102
3183
  }
3103
- var d, It, m, re, Be, $e, We, Ye, St, kt, Ns;
3184
+ var f, It, y, oe, Be, $e, We, Ye, St, kt, Ns;
3104
3185
  const qt = class qt {
3105
3186
  /**
3106
3187
  * Creates a new EngineServicesClient instance.
@@ -3110,7 +3191,7 @@ const qt = class qt {
3110
3191
  * @param props - Optional configuration (retry count, auth mode, etc.).
3111
3192
  */
3112
3193
  constructor(e, t, s) {
3113
- _(this, d);
3194
+ _(this, f);
3114
3195
  N(this, "apiUrl");
3115
3196
  N(this, "accessToken");
3116
3197
  N(this, "wsUrl");
@@ -3230,7 +3311,7 @@ const qt = class qt {
3230
3311
  * cleaning logic is applied identically.
3231
3312
  */
3232
3313
  async request(e, t, s) {
3233
- return c(this, d, m).call(this, e, t, s);
3314
+ return h(this, f, y).call(this, e, t, s);
3234
3315
  }
3235
3316
  // ─── Files ───────────────────────────────────────────────────────
3236
3317
  /**
@@ -3240,7 +3321,7 @@ const qt = class qt {
3240
3321
  */
3241
3322
  async listFiles(e) {
3242
3323
  const { folderId: t, archived: s, projectId: r } = e || {};
3243
- return t ? await c(this, d, m).call(this, "GET", `${G}/${t}/items`, { query: { itemType: ot, archived: s } }) : await c(this, d, m).call(this, "GET", `${g}`, {
3324
+ return t ? await h(this, f, y).call(this, "GET", `${G}/${t}/items`, { query: { itemType: ot, archived: s } }) : await h(this, f, y).call(this, "GET", `${g}`, {
3244
3325
  query: {
3245
3326
  itemType: ot,
3246
3327
  archived: s,
@@ -3255,7 +3336,7 @@ const qt = class qt {
3255
3336
  * @returns The file item, optionally with version history.
3256
3337
  */
3257
3338
  async getFile(e, t) {
3258
- return await c(this, d, kt).call(this, e, t);
3339
+ return await h(this, f, kt).call(this, e, t);
3259
3340
  }
3260
3341
  /**
3261
3342
  * Uploads a new file.
@@ -3263,7 +3344,7 @@ const qt = class qt {
3263
3344
  * @returns The created item and its first version.
3264
3345
  */
3265
3346
  async createFile(e) {
3266
- return await c(this, d, Ye).call(this, e, ot);
3347
+ return await h(this, f, Ye).call(this, e, ot);
3267
3348
  }
3268
3349
  /**
3269
3350
  * Updates an existing file. Can rename, move to a different folder,
@@ -3273,21 +3354,21 @@ const qt = class qt {
3273
3354
  * @returns The updated item and/or the new version.
3274
3355
  */
3275
3356
  async updateFile(e, t) {
3276
- return await c(this, d, St).call(this, e, t);
3357
+ return await h(this, f, St).call(this, e, t);
3277
3358
  }
3278
3359
  /**
3279
3360
  * Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
3280
3361
  * @param fileId - The file's unique identifier.
3281
3362
  */
3282
3363
  async archiveFile(e) {
3283
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}`);
3364
+ return await h(this, f, y).call(this, "DELETE", `${g}/${e}`);
3284
3365
  }
3285
3366
  /**
3286
3367
  * Recovers a previously archived file.
3287
3368
  * @param fileId - The file's unique identifier.
3288
3369
  */
3289
3370
  async recoverFile(e) {
3290
- return await c(this, d, m).call(this, "PUT", `${g}/${e}/recover`);
3371
+ return await h(this, f, y).call(this, "PUT", `${g}/${e}/recover`);
3291
3372
  }
3292
3373
  /**
3293
3374
  * Downloads a file's content. Returns the raw fetch Response.
@@ -3296,7 +3377,7 @@ const qt = class qt {
3296
3377
  * @returns A fetch Response containing the file data.
3297
3378
  */
3298
3379
  async downloadFile(e, t) {
3299
- return await c(this, d, We).call(this, e, t);
3380
+ return await h(this, f, We).call(this, e, t);
3300
3381
  }
3301
3382
  /**
3302
3383
  * Retrieves the free-JSON metadata for a specific file version.
@@ -3307,7 +3388,7 @@ const qt = class qt {
3307
3388
  */
3308
3389
  async getFileVersionMetadata(e, t, s) {
3309
3390
  const { withDraft: r } = s || {};
3310
- return await c(this, d, m).call(this, "GET", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3391
+ return await h(this, f, y).call(this, "GET", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3311
3392
  query: {
3312
3393
  ...r && { withDraft: "true" }
3313
3394
  }
@@ -3320,7 +3401,7 @@ const qt = class qt {
3320
3401
  * @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
3321
3402
  */
3322
3403
  async updateFileVersionMetadata(e, t, s) {
3323
- return await c(this, d, m).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3404
+ return await h(this, f, y).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
3324
3405
  body: JSON.stringify({ metadata: s }),
3325
3406
  contentType: "application/json"
3326
3407
  });
@@ -3331,7 +3412,7 @@ const qt = class qt {
3331
3412
  * @param versionTag - The version tag.
3332
3413
  */
3333
3414
  async deleteFileVersionMetadata(e, t) {
3334
- return await c(this, d, m).call(this, "DELETE", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
3415
+ return await h(this, f, y).call(this, "DELETE", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
3335
3416
  }
3336
3417
  /**
3337
3418
  * Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
@@ -3348,7 +3429,7 @@ const qt = class qt {
3348
3429
  */
3349
3430
  async getFileVersionMetadataBatch(e, t) {
3350
3431
  const { withDraft: s } = t || {};
3351
- return await c(this, d, $e).call(this, e, async (r) => (await c(this, d, m).call(this, "POST", `${g}/batch/version-metadata`, {
3432
+ return await h(this, f, $e).call(this, e, async (r) => (await h(this, f, y).call(this, "POST", `${g}/batch/version-metadata`, {
3352
3433
  body: JSON.stringify({
3353
3434
  entries: r,
3354
3435
  ...s !== void 0 && { withDraft: s }
@@ -3364,7 +3445,7 @@ const qt = class qt {
3364
3445
  */
3365
3446
  async listFolders(e) {
3366
3447
  const { archived: t, parentFolderId: s, projectId: r } = e || {};
3367
- return await c(this, d, m).call(this, "GET", G, {
3448
+ return await h(this, f, y).call(this, "GET", G, {
3368
3449
  query: {
3369
3450
  parentFolderId: s,
3370
3451
  archived: t,
@@ -3377,7 +3458,7 @@ const qt = class qt {
3377
3458
  * @param folderId - The folder's unique identifier.
3378
3459
  */
3379
3460
  async getFolder(e) {
3380
- return await c(this, d, m).call(this, "GET", `${G}/${e}`);
3461
+ return await h(this, f, y).call(this, "GET", `${G}/${e}`);
3381
3462
  }
3382
3463
  /**
3383
3464
  * Batch variant of {@link getFolder}. Resolves a known set of folder ids in
@@ -3393,7 +3474,7 @@ const qt = class qt {
3393
3474
  * @param folderIds - The folder ids to resolve.
3394
3475
  */
3395
3476
  async getFoldersBatch(e) {
3396
- return await c(this, d, $e).call(this, e, async (t) => (await c(this, d, m).call(this, "POST", `${g}/batch/folders`, {
3477
+ return await h(this, f, $e).call(this, e, async (t) => (await h(this, f, y).call(this, "POST", `${g}/batch/folders`, {
3397
3478
  body: JSON.stringify({ folderIds: t }),
3398
3479
  contentType: "application/json"
3399
3480
  })).results);
@@ -3405,7 +3486,7 @@ const qt = class qt {
3405
3486
  * @returns The created folder.
3406
3487
  */
3407
3488
  async createFolder(e, t, s) {
3408
- return await c(this, d, m).call(this, "POST", G, {
3489
+ return await h(this, f, y).call(this, "POST", G, {
3409
3490
  body: JSON.stringify({
3410
3491
  name: e,
3411
3492
  ...t && { parentId: t },
@@ -3422,7 +3503,7 @@ const qt = class qt {
3422
3503
  */
3423
3504
  async updateFolder(e, t) {
3424
3505
  const { name: s } = t;
3425
- return await c(this, d, m).call(this, "PUT", `${G}/${e}`, {
3506
+ return await h(this, f, y).call(this, "PUT", `${G}/${e}`, {
3426
3507
  body: JSON.stringify({ name: s }),
3427
3508
  contentType: "application/json"
3428
3509
  });
@@ -3432,14 +3513,14 @@ const qt = class qt {
3432
3513
  * @param folderId - The folder's unique identifier.
3433
3514
  */
3434
3515
  async archiveFolder(e) {
3435
- return await c(this, d, m).call(this, "DELETE", `${G}/${e}`);
3516
+ return await h(this, f, y).call(this, "DELETE", `${G}/${e}`);
3436
3517
  }
3437
3518
  /**
3438
3519
  * Recovers a previously archived folder.
3439
3520
  * @param folderId - The folder's unique identifier.
3440
3521
  */
3441
3522
  async recoverFolder(e) {
3442
- return await c(this, d, m).call(this, "PUT", `${G}/${e}/recover`);
3523
+ return await h(this, f, y).call(this, "PUT", `${G}/${e}/recover`);
3443
3524
  }
3444
3525
  /**
3445
3526
  * Downloads an entire folder as a ZIP archive.
@@ -3447,7 +3528,7 @@ const qt = class qt {
3447
3528
  * @returns A fetch Response containing the ZIP data.
3448
3529
  */
3449
3530
  async downloadFolder(e) {
3450
- return await c(this, d, re).call(this, `${G}/${e}/download`);
3531
+ return await h(this, f, oe).call(this, `${G}/${e}/download`);
3451
3532
  }
3452
3533
  // ─── Components ──────────────────────────────────────────────────
3453
3534
  /**
@@ -3457,12 +3538,12 @@ const qt = class qt {
3457
3538
  */
3458
3539
  async listComponents(e) {
3459
3540
  const { folderId: t, ShowVersions: s, projectId: r } = e || {};
3460
- return t ? await c(this, d, m).call(this, "GET", `${G}/${t}/items`, {
3541
+ return t ? await h(this, f, y).call(this, "GET", `${G}/${t}/items`, {
3461
3542
  query: {
3462
3543
  itemType: at,
3463
3544
  ...s && { ShowVersions: s }
3464
3545
  }
3465
- }) : await c(this, d, m).call(this, "GET", `${g}`, {
3546
+ }) : await h(this, f, y).call(this, "GET", `${g}`, {
3466
3547
  query: {
3467
3548
  itemType: at,
3468
3549
  ...s && { ShowVersions: s },
@@ -3476,7 +3557,7 @@ const qt = class qt {
3476
3557
  * @param props - Options such as whether to include versions.
3477
3558
  */
3478
3559
  async getComponent(e, t) {
3479
- return await c(this, d, kt).call(this, e, t);
3560
+ return await h(this, f, kt).call(this, e, t);
3480
3561
  }
3481
3562
  /**
3482
3563
  * Creates a new component with the given file and version properties.
@@ -3485,7 +3566,7 @@ const qt = class qt {
3485
3566
  */
3486
3567
  async createComponent(e) {
3487
3568
  const { componentProps: t } = e;
3488
- return await c(this, d, Ye).call(this, e, at, t);
3569
+ return await h(this, f, Ye).call(this, e, at, t);
3489
3570
  }
3490
3571
  /**
3491
3572
  * Updates an existing component. Can rename, move, and/or upload a new version.
@@ -3495,7 +3576,7 @@ const qt = class qt {
3495
3576
  */
3496
3577
  async updateComponent(e, t) {
3497
3578
  const { componentProps: s } = t;
3498
- return await c(this, d, St).call(this, e, t, s);
3579
+ return await h(this, f, St).call(this, e, t, s);
3499
3580
  }
3500
3581
  /**
3501
3582
  * Downloads a component's full ZIP file. Returns the raw fetch Response.
@@ -3504,7 +3585,7 @@ const qt = class qt {
3504
3585
  * @returns A fetch Response containing the ZIP data.
3505
3586
  */
3506
3587
  async downloadComponent(e, t) {
3507
- return await c(this, d, We).call(this, e, t);
3588
+ return await h(this, f, We).call(this, e, t);
3508
3589
  }
3509
3590
  /**
3510
3591
  * Downloads only the JavaScript bundle from a component's ZIP.
@@ -3515,7 +3596,7 @@ const qt = class qt {
3515
3596
  */
3516
3597
  async downloadComponentBundle(e, t) {
3517
3598
  const { versionTag: s, withDraft: r } = t || {};
3518
- return await c(this, d, re).call(this, `${g}/${e}/download/bundle`, {
3599
+ return await h(this, f, oe).call(this, `${g}/${e}/download/bundle`, {
3519
3600
  query: {
3520
3601
  ...s && { versionTag: s },
3521
3602
  ...r && { withDraft: r }
@@ -3527,14 +3608,14 @@ const qt = class qt {
3527
3608
  * @param componentId - The component's unique identifier.
3528
3609
  */
3529
3610
  async archiveComponent(e) {
3530
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}`);
3611
+ return await h(this, f, y).call(this, "DELETE", `${g}/${e}`);
3531
3612
  }
3532
3613
  /**
3533
3614
  * Recovers a previously archived component.
3534
3615
  * @param componentId - The component's unique identifier.
3535
3616
  */
3536
3617
  async recoverComponent(e) {
3537
- return await c(this, d, m).call(this, "PUT", `${g}/${e}/recover`);
3618
+ return await h(this, f, y).call(this, "PUT", `${g}/${e}/recover`);
3538
3619
  }
3539
3620
  // ─── Built-in Components ─────────────────────────────────────────
3540
3621
  /**
@@ -3543,7 +3624,7 @@ const qt = class qt {
3543
3624
  * @returns The component's JavaScript source code as a string.
3544
3625
  */
3545
3626
  async getBuiltInComponent(e) {
3546
- return await (await c(this, d, re).call(this, `built-in/${e}/bundle`)).text();
3627
+ return await (await h(this, f, oe).call(this, `built-in/${e}/bundle`)).text();
3547
3628
  }
3548
3629
  /**
3549
3630
  * Fetches a built-in component bundle, evaluates it, and registers it
@@ -3572,9 +3653,9 @@ const qt = class qt {
3572
3653
  * ```
3573
3654
  */
3574
3655
  async initBuiltInComponent(e, t, s) {
3575
- const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), a = o.map((y) => i[y]), u = new Function(...o, `${r}
3576
- return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3577
- t.get(h);
3656
+ const r = await this.getBuiltInComponent(e.uuid), i = s ?? this.builtInGlobals ?? (typeof window < "u" ? window.ThatOpenCompany : {}) ?? {}, o = Object.keys(i), a = o.map((m) => i[m]), u = new Function(...o, `${r}
3657
+ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
3658
+ t.get(c);
3578
3659
  }
3579
3660
  /**
3580
3661
  * Loads multiple built-in components in parallel.
@@ -3641,12 +3722,12 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3641
3722
  */
3642
3723
  async listApps(e) {
3643
3724
  const { folderId: t, ShowVersions: s, projectId: r } = e || {};
3644
- return t ? await c(this, d, m).call(this, "GET", `${G}/${t}/items`, {
3725
+ return t ? await h(this, f, y).call(this, "GET", `${G}/${t}/items`, {
3645
3726
  query: {
3646
3727
  itemType: ct,
3647
3728
  ...s && { ShowVersions: s }
3648
3729
  }
3649
- }) : await c(this, d, m).call(this, "GET", `${g}`, {
3730
+ }) : await h(this, f, y).call(this, "GET", `${g}`, {
3650
3731
  query: {
3651
3732
  itemType: ct,
3652
3733
  ...s && { ShowVersions: s },
@@ -3661,7 +3742,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3661
3742
  */
3662
3743
  async createApp(e) {
3663
3744
  const { appProps: t } = e;
3664
- return await c(this, d, Ye).call(this, e, ct, t);
3745
+ return await h(this, f, Ye).call(this, e, ct, t);
3665
3746
  }
3666
3747
  /**
3667
3748
  * Downloads an app's full ZIP file. Returns the raw fetch Response.
@@ -3670,7 +3751,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3670
3751
  * @returns A fetch Response containing the ZIP data.
3671
3752
  */
3672
3753
  async downloadApp(e, t) {
3673
- return await c(this, d, We).call(this, e, t);
3754
+ return await h(this, f, We).call(this, e, t);
3674
3755
  }
3675
3756
  /**
3676
3757
  * Downloads only the JavaScript bundle from an app's ZIP.
@@ -3681,7 +3762,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3681
3762
  */
3682
3763
  async downloadAppBundle(e, t) {
3683
3764
  const { versionTag: s, withDraft: r } = t || {};
3684
- return await c(this, d, re).call(this, `${g}/${e}/download/bundle`, {
3765
+ return await h(this, f, oe).call(this, `${g}/${e}/download/bundle`, {
3685
3766
  query: {
3686
3767
  ...s && { versionTag: s },
3687
3768
  ...r && { withDraft: r }
@@ -3693,7 +3774,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3693
3774
  * @param appId - The app's unique identifier.
3694
3775
  */
3695
3776
  async archiveApp(e) {
3696
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}`);
3777
+ return await h(this, f, y).call(this, "DELETE", `${g}/${e}`);
3697
3778
  }
3698
3779
  // ─── NPM Registry ────────────────────────────────────────────────
3699
3780
  /**
@@ -3705,7 +3786,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3705
3786
  * @returns The registry, scope, read-only token, and assembled `.npmrc`.
3706
3787
  */
3707
3788
  async getNpmCredentials() {
3708
- return await c(this, d, m).call(this, "GET", `${ur}/credentials`);
3789
+ return await h(this, f, y).call(this, "GET", `${ur}/credentials`);
3709
3790
  }
3710
3791
  // ─── Execution ───────────────────────────────────────────────────
3711
3792
  /**
@@ -3724,7 +3805,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3724
3805
  */
3725
3806
  async executeComponent(e, t, s) {
3726
3807
  if (this.localServerUrl) {
3727
- const r = `${this.localServerUrl}/api/${ne}/${e}/execute`, i = await fetch(r, {
3808
+ const r = `${this.localServerUrl}/api/${re}/${e}/execute`, i = await fetch(r, {
3728
3809
  method: "POST",
3729
3810
  headers: { "Content-Type": "application/json" },
3730
3811
  body: JSON.stringify(t)
@@ -3737,7 +3818,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3737
3818
  }
3738
3819
  return await i.json();
3739
3820
  }
3740
- return await c(this, d, m).call(this, "POST", `${ne}/${e}/execute`, {
3821
+ return await h(this, f, y).call(this, "POST", `${re}/${e}/execute`, {
3741
3822
  body: JSON.stringify(t),
3742
3823
  query: { ...s && { versionTag: s } },
3743
3824
  contentType: "application/json"
@@ -3749,7 +3830,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3749
3830
  */
3750
3831
  async abortExecution(e) {
3751
3832
  if (this.localServerUrl) {
3752
- const t = `${this.localServerUrl}/api/${ne}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
3833
+ const t = `${this.localServerUrl}/api/${re}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
3753
3834
  if (!s.ok) {
3754
3835
  const r = await s.text().catch(() => "");
3755
3836
  throw new Error(
@@ -3758,7 +3839,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3758
3839
  }
3759
3840
  return await s.json();
3760
3841
  }
3761
- return await c(this, d, m).call(this, "POST", `${ne}/progress/${e}/abort`);
3842
+ return await h(this, f, y).call(this, "POST", `${re}/progress/${e}/abort`);
3762
3843
  }
3763
3844
  /**
3764
3845
  * Lists all executions for a given component.
@@ -3775,7 +3856,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3775
3856
  */
3776
3857
  async listExecutions(e, t) {
3777
3858
  if (this.localServerUrl) {
3778
- const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${ne}/${e}/progress${s}`, i = await fetch(r);
3859
+ const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${re}/${e}/progress${s}`, i = await fetch(r);
3779
3860
  if (!i.ok) {
3780
3861
  const o = await i.text().catch(() => "");
3781
3862
  throw new Error(
@@ -3784,7 +3865,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3784
3865
  }
3785
3866
  return await i.json();
3786
3867
  }
3787
- return await c(this, d, m).call(this, "GET", `${ne}/${e}/progress`, { query: { ...t && { projectId: t } } });
3868
+ return await h(this, f, y).call(this, "GET", `${re}/${e}/progress`, { query: { ...t && { projectId: t } } });
3788
3869
  }
3789
3870
  /**
3790
3871
  * Gets details of a specific execution, including its messages.
@@ -3793,7 +3874,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3793
3874
  */
3794
3875
  async getExecution(e) {
3795
3876
  if (this.localServerUrl) {
3796
- const t = `${this.localServerUrl}/api/${ne}/progress/${e}`, s = await fetch(t);
3877
+ const t = `${this.localServerUrl}/api/${re}/progress/${e}`, s = await fetch(t);
3797
3878
  if (!s.ok) {
3798
3879
  const r = await s.text().catch(() => "");
3799
3880
  throw new Error(
@@ -3802,7 +3883,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3802
3883
  }
3803
3884
  return await s.json();
3804
3885
  }
3805
- return await c(this, d, m).call(this, "GET", `${ne}/progress/${e}`);
3886
+ return await h(this, f, y).call(this, "GET", `${re}/progress/${e}`);
3806
3887
  }
3807
3888
  /**
3808
3889
  * Subscribes to real-time execution progress via WebSocket.
@@ -3846,7 +3927,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3846
3927
  * native application's language. See `src/core/recipes.ts`.
3847
3928
  */
3848
3929
  get recipes() {
3849
- return f(this, Be) ?? k(this, Be, new hr(this)), f(this, Be);
3930
+ return d(this, Be) ?? k(this, Be, new hr(this)), d(this, Be);
3850
3931
  }
3851
3932
  // ─── Hidden Files ────────────────────────────────────────────────
3852
3933
  /**
@@ -3860,7 +3941,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3860
3941
  */
3861
3942
  async createHiddenFile(e, t, s) {
3862
3943
  const r = new FormData();
3863
- return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await c(this, d, m).call(this, "POST", `${g}/${K}`, {
3944
+ return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, y).call(this, "POST", `${g}/${z}`, {
3864
3945
  body: r
3865
3946
  });
3866
3947
  }
@@ -3878,7 +3959,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3878
3959
  const r = new FormData();
3879
3960
  for (const i of e)
3880
3961
  r.append("files", i);
3881
- return r.append("parentItemId", t), s != null && r.append("tag", s), await c(this, d, m).call(this, "POST", `${g}/${K}/batch`, {
3962
+ return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, y).call(this, "POST", `${g}/${z}/batch`, {
3882
3963
  body: r
3883
3964
  });
3884
3965
  }
@@ -3887,21 +3968,21 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3887
3968
  * @param hiddenId - The hidden file's unique identifier.
3888
3969
  */
3889
3970
  async deleteHiddenFile(e) {
3890
- return await c(this, d, m).call(this, "DELETE", `${g}/${K}/${e}`);
3971
+ return await h(this, f, y).call(this, "DELETE", `${g}/${z}/${e}`);
3891
3972
  }
3892
3973
  /**
3893
3974
  * Gets metadata for a hidden file.
3894
3975
  * @param hiddenId - The hidden file's unique identifier.
3895
3976
  */
3896
3977
  async getHiddenFile(e) {
3897
- return await c(this, d, m).call(this, "GET", `${g}/${K}/${e}`);
3978
+ return await h(this, f, y).call(this, "GET", `${g}/${z}/${e}`);
3898
3979
  }
3899
3980
  /**
3900
3981
  * Downloads a hidden file's content. Returns the raw fetch Response.
3901
3982
  * @param hiddenId - The hidden file's unique identifier.
3902
3983
  */
3903
3984
  async downloadHiddenFile(e) {
3904
- return await c(this, d, re).call(this, `${g}/${K}/${e}/download`);
3985
+ return await h(this, f, oe).call(this, `${g}/${z}/${e}/download`);
3905
3986
  }
3906
3987
  /**
3907
3988
  * Mints a short-lived presigned URL for a hidden file so the browser can
@@ -3921,7 +4002,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3921
4002
  * an ISO timestamp when it stops working.
3922
4003
  */
3923
4004
  async getHiddenFileSignedUrl(e, t) {
3924
- return await c(this, d, m).call(this, "GET", `${g}/${K}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
4005
+ return await h(this, f, y).call(this, "GET", `${g}/${z}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
3925
4006
  }
3926
4007
  /**
3927
4008
  * Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
@@ -3942,7 +4023,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3942
4023
  * 900 (15 min) server-side; values are clamped to that range.
3943
4024
  */
3944
4025
  async getHiddenFileSignedUrlsBatch(e, t) {
3945
- return await c(this, d, $e).call(this, e, async (s) => (await c(this, d, m).call(this, "POST", `${g}/${K}/signed-url/batch`, {
4026
+ return await h(this, f, $e).call(this, e, async (s) => (await h(this, f, y).call(this, "POST", `${g}/${z}/signed-url/batch`, {
3946
4027
  body: JSON.stringify({
3947
4028
  hiddenFileIds: s,
3948
4029
  ...t != null && { expiresIn: t }
@@ -3958,14 +4039,14 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3958
4039
  * @returns Array of hidden file entities.
3959
4040
  */
3960
4041
  async getHiddenFilesByParent(e, t) {
3961
- return await c(this, d, m).call(this, "GET", `${g}/${e}/${K}`, { ...t != null && { query: { tag: t } } });
4042
+ return await h(this, f, y).call(this, "GET", `${g}/${e}/${z}`, { ...t != null && { query: { tag: t } } });
3962
4043
  }
3963
4044
  /**
3964
4045
  * Deletes all hidden files attached to a parent item.
3965
4046
  * @param parentFileId - The parent item's unique identifier.
3966
4047
  */
3967
4048
  async deleteHiddenFilesByParent(e) {
3968
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}/${K}`);
4049
+ return await h(this, f, y).call(this, "DELETE", `${g}/${e}/${z}`);
3969
4050
  }
3970
4051
  // ─── Icons ───────────────────────────────────────────────────────
3971
4052
  /**
@@ -3977,7 +4058,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3977
4058
  */
3978
4059
  async uploadItemIcon(e, t) {
3979
4060
  const s = new FormData();
3980
- return s.append("icon", t), await c(this, d, m).call(this, "PUT", `${g}/${e}/icon`, {
4061
+ return s.append("icon", t), await h(this, f, y).call(this, "PUT", `${g}/${e}/icon`, {
3981
4062
  body: s
3982
4063
  });
3983
4064
  }
@@ -3987,7 +4068,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3987
4068
  * @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
3988
4069
  */
3989
4070
  async getItemIcon(e) {
3990
- return await c(this, d, re).call(this, `${g}/${e}/icon`);
4071
+ return await h(this, f, oe).call(this, `${g}/${e}/icon`);
3991
4072
  }
3992
4073
  /**
3993
4074
  * Removes the icon from an item.
@@ -3995,7 +4076,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
3995
4076
  * @returns The updated item with icon fields removed.
3996
4077
  */
3997
4078
  async removeItemIcon(e) {
3998
- return await c(this, d, m).call(this, "DELETE", `${g}/${e}/icon`);
4079
+ return await h(this, f, y).call(this, "DELETE", `${g}/${e}/icon`);
3999
4080
  }
4000
4081
  // ─── General Item Operations ─────────────────────────────────────
4001
4082
  /**
@@ -4005,7 +4086,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4005
4086
  * @returns The updated item.
4006
4087
  */
4007
4088
  async updateItem(e, t) {
4008
- return await c(this, d, m).call(this, "PUT", `${g}/${e}`, {
4089
+ return await h(this, f, y).call(this, "PUT", `${g}/${e}`, {
4009
4090
  body: JSON.stringify(t),
4010
4091
  contentType: "application/json"
4011
4092
  });
@@ -4022,7 +4103,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4022
4103
  */
4023
4104
  async createVersion(e, t, s, r, i) {
4024
4105
  const o = new FormData();
4025
- return o.append("file", t), o.append("versionTag", s), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await c(this, d, m).call(this, "POST", `${g}/${e}/version`, { body: o });
4106
+ return o.append("file", t), o.append("versionTag", s), r && o.append("extraProps", JSON.stringify(r)), i && o.append("metadata", JSON.stringify(i)), await h(this, f, y).call(this, "POST", `${g}/${e}/version`, { body: o });
4026
4107
  }
4027
4108
  /**
4028
4109
  * Lists versions of an item. Pass `archived: true` to fetch only archived
@@ -4032,7 +4113,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4032
4113
  * @returns Array of versions, sorted by creation date descending.
4033
4114
  */
4034
4115
  async listVersions(e, t = {}) {
4035
- return await c(this, d, m).call(this, "GET", `${g}/${encodeURIComponent(e)}/versions`, { query: t });
4116
+ return await h(this, f, y).call(this, "GET", `${g}/${encodeURIComponent(e)}/versions`, { query: t });
4036
4117
  }
4037
4118
  /**
4038
4119
  * Batch variant of {@link listVersions}. Lists the versions of many items in
@@ -4051,7 +4132,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4051
4132
  */
4052
4133
  async listVersionsBatch(e, t = {}) {
4053
4134
  const { archived: s } = t;
4054
- return await c(this, d, $e).call(this, e, async (r) => (await c(this, d, m).call(this, "POST", `${g}/batch/versions`, {
4135
+ return await h(this, f, $e).call(this, e, async (r) => (await h(this, f, y).call(this, "POST", `${g}/batch/versions`, {
4055
4136
  body: JSON.stringify({
4056
4137
  itemIds: r,
4057
4138
  ...s !== void 0 && { archived: s }
@@ -4069,7 +4150,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4069
4150
  * @returns The archived version.
4070
4151
  */
4071
4152
  async archiveVersion(e, t) {
4072
- return await c(this, d, m).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
4153
+ return await h(this, f, y).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
4073
4154
  }
4074
4155
  /**
4075
4156
  * Recovers a previously archived version, restoring it to the active list.
@@ -4078,7 +4159,7 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4078
4159
  * @returns The recovered version.
4079
4160
  */
4080
4161
  async recoverVersion(e, t) {
4081
- return await c(this, d, m).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
4162
+ return await h(this, f, y).call(this, "PUT", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
4082
4163
  }
4083
4164
  /**
4084
4165
  * Permanently deletes a version, including its file in object storage.
@@ -4087,19 +4168,19 @@ return main;`)(...a), h = (u == null ? void 0 : u.componentDefinition) ?? u;
4087
4168
  * @param versionTag - The version's tag (e.g. "v2").
4088
4169
  */
4089
4170
  async deleteVersion(e, t) {
4090
- return await c(this, d, m).call(this, "DELETE", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
4171
+ return await h(this, f, y).call(this, "DELETE", `${g}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
4091
4172
  }
4092
4173
  };
4093
- d = new WeakSet(), It = function(e) {
4174
+ f = new WeakSet(), It = function(e) {
4094
4175
  return `${this.apiUrl}/${e}`;
4095
- }, m = async function(e, t, s) {
4096
- const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: u } = s || {}, h = c(this, d, It).call(this, t), y = c(this, d, Ns).call(this, i), w = await this.resolveAccessToken(), I = {
4097
- ...y,
4176
+ }, y = async function(e, t, s) {
4177
+ const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: u } = s || {}, c = h(this, f, It).call(this, t), m = h(this, f, Ns).call(this, i), w = await this.resolveAccessToken(), I = {
4178
+ ...m,
4098
4179
  ...this.useBearer ? {} : { accessToken: w }
4099
4180
  };
4100
4181
  try {
4101
4182
  const T = await fetch(
4102
- h + "?" + new URLSearchParams(I).toString(),
4183
+ c + "?" + new URLSearchParams(I).toString(),
4103
4184
  {
4104
4185
  method: e,
4105
4186
  headers: {
@@ -4125,7 +4206,7 @@ d = new WeakSet(), It = function(e) {
4125
4206
  const S = a ?? this.retries;
4126
4207
  if (S > 0 && gr(T)) {
4127
4208
  const x = u ?? 0;
4128
- return await mr(wr(T, x)), await c(this, d, m).call(this, e, t, {
4209
+ return await mr(wr(T, x)), await h(this, f, y).call(this, e, t, {
4129
4210
  ...s,
4130
4211
  retries: S - 1,
4131
4212
  retryAttempt: x + 1
@@ -4133,8 +4214,8 @@ d = new WeakSet(), It = function(e) {
4133
4214
  }
4134
4215
  throw T;
4135
4216
  }
4136
- }, re = async function(e, t) {
4137
- const { query: s } = t || {}, r = c(this, d, It).call(this, e), i = await this.resolveAccessToken(), o = {
4217
+ }, oe = async function(e, t) {
4218
+ const { query: s } = t || {}, r = h(this, f, It).call(this, e), i = await this.resolveAccessToken(), o = {
4138
4219
  ...s,
4139
4220
  ...this.useBearer ? {} : { accessToken: i }
4140
4221
  };
@@ -4155,40 +4236,40 @@ d = new WeakSet(), It = function(e) {
4155
4236
  return (await Promise.all(s.map(t))).flat();
4156
4237
  }, We = async function(e, t) {
4157
4238
  const { versionTag: s, withDraft: r } = t || {};
4158
- return await c(this, d, re).call(this, `${g}/${e}/download`, {
4239
+ return await h(this, f, oe).call(this, `${g}/${e}/download`, {
4159
4240
  query: {
4160
4241
  ...s && { versionTag: s },
4161
4242
  ...r && { withDraft: r }
4162
4243
  }
4163
4244
  });
4164
4245
  }, Ye = async function(e, t, s) {
4165
- const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata: u } = e, h = new FormData();
4166
- return h.append("file", l), h.append("name", r), h.append("versionTag", i), h.append("itemType", t), o && h.append("folderId", o), a && h.append("projectId", a), s && h.append("extraProps", JSON.stringify(s)), u && h.append("metadata", JSON.stringify(u)), await c(this, d, m).call(this, "POST", g, {
4167
- body: h
4246
+ const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata: u } = e, c = new FormData();
4247
+ return c.append("file", l), c.append("name", r), c.append("versionTag", i), c.append("itemType", t), o && c.append("folderId", o), a && c.append("projectId", a), s && c.append("extraProps", JSON.stringify(s)), u && c.append("metadata", JSON.stringify(u)), await h(this, f, y).call(this, "POST", g, {
4248
+ body: c
4168
4249
  });
4169
4250
  }, St = async function(e, t, s) {
4170
4251
  const { name: r, versionTag: i, parentFolderId: o, file: a, metadata: l } = t;
4171
- let u, h;
4252
+ let u, c;
4172
4253
  if (a) {
4173
- const y = new FormData();
4174
- y.append("file", a), i && y.append("versionTag", i), s && y.append("extraProps", JSON.stringify(s)), l && y.append("metadata", JSON.stringify(l)), h = await c(this, d, m).call(this, "POST", `${g}/${e}/version`, {
4175
- body: y
4254
+ const m = new FormData();
4255
+ m.append("file", a), i && m.append("versionTag", i), s && m.append("extraProps", JSON.stringify(s)), l && m.append("metadata", JSON.stringify(l)), c = await h(this, f, y).call(this, "POST", `${g}/${e}/version`, {
4256
+ body: m
4176
4257
  });
4177
4258
  }
4178
4259
  if (r || o) {
4179
- const y = {
4260
+ const m = {
4180
4261
  ...r && { name: r },
4181
4262
  ...o && { folderId: o }
4182
- }, w = JSON.stringify(y);
4183
- u = await c(this, d, m).call(this, "PUT", `${g}/${e}`, {
4263
+ }, w = JSON.stringify(m);
4264
+ u = await h(this, f, y).call(this, "PUT", `${g}/${e}`, {
4184
4265
  body: w,
4185
4266
  contentType: "application/json"
4186
4267
  });
4187
4268
  }
4188
- return { item: u, version: h };
4269
+ return { item: u, version: c };
4189
4270
  }, kt = async function(e, t) {
4190
4271
  const { showVersions: s = !1 } = t || {};
4191
- return await c(this, d, m).call(this, "GET", `${g}/${e}`, {
4272
+ return await h(this, f, y).call(this, "GET", `${g}/${e}`, {
4192
4273
  query: { showVersions: s }
4193
4274
  });
4194
4275
  }, Ns = function(e) {
@@ -4221,11 +4302,11 @@ function Ke(n) {
4221
4302
  console.error("[channel] a listener threw:", e);
4222
4303
  }
4223
4304
  }
4224
- var Q, F, L, Ee, _e, Te, P, At, Rt, ve;
4305
+ var Z, F, L, Ee, _e, Te, P, At, Rt, ve;
4225
4306
  class Ps {
4226
4307
  constructor(e, t) {
4227
4308
  _(this, P);
4228
- _(this, Q, !1);
4309
+ _(this, Z, !1);
4229
4310
  _(this, F, []);
4230
4311
  _(this, L, []);
4231
4312
  _(this, Ee, /* @__PURE__ */ new Set());
@@ -4235,57 +4316,57 @@ class Ps {
4235
4316
  }
4236
4317
  /** Whether the platform has confirmed this tab is in the room. */
4237
4318
  get joined() {
4238
- return f(this, Q);
4319
+ return d(this, Z);
4239
4320
  }
4240
4321
  /** Who else is in the room right now, as the platform last reported. */
4241
4322
  get peers() {
4242
- return f(this, F);
4323
+ return d(this, F);
4243
4324
  }
4244
4325
  /**
4245
4326
  * Enters the room. Resolves when the platform confirms; rejects if it
4246
4327
  * refuses or does not answer in time. Joining twice is harmless.
4247
4328
  */
4248
4329
  join() {
4249
- return f(this, Q) ? Promise.resolve() : c(this, P, At).call(this, "joined", this.controls.join);
4330
+ return d(this, Z) ? Promise.resolve() : h(this, P, At).call(this, "joined", this.controls.join);
4250
4331
  }
4251
4332
  /** Leaves the room. Handlers stay registered, so `join()` resumes them. */
4252
4333
  leave() {
4253
- return !f(this, Q) && !f(this, L).some((e) => e.want === "joined") ? Promise.resolve() : c(this, P, At).call(this, "left", this.controls.leave);
4334
+ return !d(this, Z) && !d(this, L).some((e) => e.want === "joined") ? Promise.resolve() : h(this, P, At).call(this, "left", this.controls.leave);
4254
4335
  }
4255
4336
  /** Fires when `joined` or `peers` changes. Returns a function that stops it. */
4256
4337
  onChange(e) {
4257
- return f(this, Ee).add(e), () => void f(this, Ee).delete(e);
4338
+ return d(this, Ee).add(e), () => void d(this, Ee).delete(e);
4258
4339
  }
4259
4340
  onPeerJoined(e) {
4260
- return f(this, _e).add(e), () => void f(this, _e).delete(e);
4341
+ return d(this, _e).add(e), () => void d(this, _e).delete(e);
4261
4342
  }
4262
4343
  onPeerLeft(e) {
4263
- return f(this, Te).add(e), () => void f(this, Te).delete(e);
4344
+ return d(this, Te).add(e), () => void d(this, Te).delete(e);
4264
4345
  }
4265
4346
  /** @internal */
4266
4347
  applyJoined() {
4267
- k(this, Q, !0), c(this, P, Rt).call(this, "joined"), c(this, P, ve).call(this);
4348
+ k(this, Z, !0), h(this, P, Rt).call(this, "joined"), h(this, P, ve).call(this);
4268
4349
  }
4269
4350
  /** @internal */
4270
4351
  applyLeft() {
4271
- k(this, Q, !1), k(this, F, []), c(this, P, Rt).call(this, "left"), c(this, P, ve).call(this);
4352
+ k(this, Z, !1), k(this, F, []), h(this, P, Rt).call(this, "left"), h(this, P, ve).call(this);
4272
4353
  }
4273
4354
  /** @internal */
4274
4355
  applyPeers(e) {
4275
- k(this, F, e), c(this, P, ve).call(this);
4356
+ k(this, F, e), h(this, P, ve).call(this);
4276
4357
  }
4277
4358
  /** @internal */
4278
4359
  applyPeerJoined(e) {
4279
- !f(this, Q) || f(this, F).some((t) => t.from === e.from) || (k(this, F, [...f(this, F), e]), f(this, _e).forEach((t) => Ke(() => t(e))), c(this, P, ve).call(this));
4360
+ !d(this, Z) || d(this, F).some((t) => t.from === e.from) || (k(this, F, [...d(this, F), e]), d(this, _e).forEach((t) => Ke(() => t(e))), h(this, P, ve).call(this));
4280
4361
  }
4281
4362
  /** @internal */
4282
4363
  applyPeerLeft(e) {
4283
- const t = f(this, F).find((s) => s.from === e);
4284
- t && (k(this, F, f(this, F).filter((s) => s.from !== e)), f(this, Te).forEach((s) => Ke(() => s(t))), c(this, P, ve).call(this));
4364
+ const t = d(this, F).find((s) => s.from === e);
4365
+ t && (k(this, F, d(this, F).filter((s) => s.from !== e)), d(this, Te).forEach((s) => Ke(() => s(t))), h(this, P, ve).call(this));
4285
4366
  }
4286
4367
  /** @internal */
4287
4368
  failPending(e) {
4288
- const t = f(this, L);
4369
+ const t = d(this, L);
4289
4370
  return k(this, L, []), t.forEach((s) => {
4290
4371
  clearTimeout(s.timer), s.reject(e);
4291
4372
  }), t.length > 0;
@@ -4294,29 +4375,29 @@ class Ps {
4294
4375
  this.transport.post(e);
4295
4376
  }
4296
4377
  }
4297
- Q = new WeakMap(), F = new WeakMap(), L = new WeakMap(), Ee = new WeakMap(), _e = new WeakMap(), Te = new WeakMap(), P = new WeakSet(), At = function(e, t) {
4378
+ Z = new WeakMap(), F = new WeakMap(), L = new WeakMap(), Ee = new WeakMap(), _e = new WeakMap(), Te = new WeakMap(), P = new WeakSet(), At = function(e, t) {
4298
4379
  return new Promise((s, r) => {
4299
4380
  const i = {
4300
4381
  want: e,
4301
4382
  resolve: s,
4302
4383
  reject: r,
4303
4384
  timer: setTimeout(() => {
4304
- k(this, L, f(this, L).filter((o) => o !== i)), r(
4385
+ k(this, L, d(this, L).filter((o) => o !== i)), r(
4305
4386
  new Error(
4306
4387
  `The platform did not confirm ${e === "joined" ? "joining" : "leaving"} in time.`
4307
4388
  )
4308
4389
  );
4309
4390
  }, vr)
4310
4391
  };
4311
- f(this, L).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
4392
+ d(this, L).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
4312
4393
  });
4313
4394
  }, Rt = function(e) {
4314
- const t = f(this, L).filter((s) => s.want === e);
4315
- k(this, L, f(this, L).filter((s) => s.want !== e)), t.forEach((s) => {
4395
+ const t = d(this, L).filter((s) => s.want === e);
4396
+ k(this, L, d(this, L).filter((s) => s.want !== e)), t.forEach((s) => {
4316
4397
  clearTimeout(s.timer), s.resolve();
4317
4398
  });
4318
4399
  }, ve = function() {
4319
- f(this, Ee).forEach((e) => Ke(e));
4400
+ d(this, Ee).forEach((e) => Ke(e));
4320
4401
  };
4321
4402
  var Ie;
4322
4403
  class Er extends Ps {
@@ -4333,8 +4414,8 @@ class Er extends Ps {
4333
4414
  * @returns a function that removes the listener.
4334
4415
  */
4335
4416
  on(t, s) {
4336
- const r = f(this, Ie).get(t) ?? /* @__PURE__ */ new Set();
4337
- return r.add(s), f(this, Ie).set(t, r), () => void r.delete(s);
4417
+ const r = d(this, Ie).get(t) ?? /* @__PURE__ */ new Set();
4418
+ return r.add(s), d(this, Ie).set(t, r), () => void r.delete(s);
4338
4419
  }
4339
4420
  /**
4340
4421
  * Sends an event to the other tabs in the room. Does nothing while this tab
@@ -4349,14 +4430,14 @@ class Er extends Ps {
4349
4430
  return t === void 0 || t === "collab";
4350
4431
  }
4351
4432
  async handle(t) {
4352
- const s = f(this, Ie).get(t.type);
4433
+ const s = d(this, Ie).get(t.type);
4353
4434
  if (!(s != null && s.size)) return { handled: !1 };
4354
4435
  const r = Bs(t);
4355
4436
  return s.forEach((i) => Ke(() => i(t.payload, r))), { handled: !0 };
4356
4437
  }
4357
4438
  }
4358
4439
  Ie = new WeakMap();
4359
- var oe;
4440
+ var ce;
4360
4441
  class _r extends Ps {
4361
4442
  /** @internal Use `client.channel.external(kind)`. */
4362
4443
  constructor(t, s) {
@@ -4364,7 +4445,7 @@ class _r extends Ps {
4364
4445
  join: { action: "joinExternal", kind: s },
4365
4446
  leave: { action: "leaveExternal", kind: s }
4366
4447
  });
4367
- _(this, oe, /* @__PURE__ */ new Map());
4448
+ _(this, ce, /* @__PURE__ */ new Map());
4368
4449
  this.kind = s;
4369
4450
  }
4370
4451
  /**
@@ -4378,21 +4459,21 @@ class _r extends Ps {
4378
4459
  * @returns a function that removes the handler.
4379
4460
  */
4380
4461
  on(t, s) {
4381
- if (f(this, oe).has(t))
4462
+ if (d(this, ce).has(t))
4382
4463
  throw new Error(
4383
4464
  `"${t}" already has a handler in this room. Remove it first.`
4384
4465
  );
4385
- return f(this, oe).set(t, s), () => void f(this, oe).delete(t);
4466
+ return d(this, ce).set(t, s), () => void d(this, ce).delete(t);
4386
4467
  }
4387
4468
  accepts(t, s) {
4388
4469
  return t !== void 0 && t !== "external" ? !1 : this.kind === void 0 || t === void 0 || this.kind === s;
4389
4470
  }
4390
4471
  /** @internal Whether this room has any handler at all. */
4391
4472
  get hasHandlers() {
4392
- return f(this, oe).size > 0;
4473
+ return d(this, ce).size > 0;
4393
4474
  }
4394
4475
  async handle(t) {
4395
- const s = f(this, oe).get(t.type);
4476
+ const s = d(this, ce).get(t.type);
4396
4477
  if (!s) return { handled: !1 };
4397
4478
  try {
4398
4479
  return { handled: !0, value: await s(t.payload, Bs(t)) };
@@ -4404,7 +4485,7 @@ class _r extends Ps {
4404
4485
  }
4405
4486
  }
4406
4487
  }
4407
- oe = new WeakMap();
4488
+ ce = new WeakMap();
4408
4489
  function Bs(n) {
4409
4490
  return {
4410
4491
  from: n.from,
@@ -4427,20 +4508,20 @@ function Tr(n) {
4427
4508
  kind: typeof t.kind == "string" ? t.kind : void 0
4428
4509
  };
4429
4510
  }
4430
- var ue, Fe, Z, ae, ce, R, Ct, ze, Fs, Ls, qs, $t;
4511
+ var pe, Fe, ee, he, le, R, Ct, ze, Fs, Ls, qs, $t;
4431
4512
  class Ir {
4432
4513
  constructor(e) {
4433
4514
  _(this, R);
4434
- _(this, ue);
4515
+ _(this, pe);
4435
4516
  _(this, Fe);
4436
- _(this, Z);
4437
- _(this, ae, /* @__PURE__ */ new Map());
4438
- _(this, ce, /* @__PURE__ */ new Set());
4439
- k(this, ue, e), k(this, Fe, e.listen((t) => void c(this, R, Fs).call(this, t)));
4517
+ _(this, ee);
4518
+ _(this, he, /* @__PURE__ */ new Map());
4519
+ _(this, le, /* @__PURE__ */ new Set());
4520
+ k(this, pe, e), k(this, Fe, e.listen((t) => void h(this, R, Fs).call(this, t)));
4440
4521
  }
4441
4522
  /** The collaboration room for this app. Always the same instance. */
4442
4523
  collab() {
4443
- return f(this, Z) ?? k(this, Z, new Er(f(this, ue))), f(this, Z);
4524
+ return d(this, ee) ?? k(this, ee, new Er(d(this, pe))), d(this, ee);
4444
4525
  }
4445
4526
  /**
4446
4527
  * The room for commands from this account's external tools of one `kind`
@@ -4449,46 +4530,46 @@ class Ir {
4449
4530
  */
4450
4531
  external(e) {
4451
4532
  const t = e ?? "";
4452
- let s = f(this, ae).get(t);
4453
- return s || (s = new _r(f(this, ue), e), f(this, ae).set(t, s)), s;
4533
+ let s = d(this, he).get(t);
4534
+ return s || (s = new _r(d(this, pe), e), d(this, he).set(t, s)), s;
4454
4535
  }
4455
4536
  /** Stops listening. For tests and teardown; an app normally never calls it. */
4456
4537
  dispose() {
4457
- f(this, Fe).call(this);
4538
+ d(this, Fe).call(this);
4458
4539
  }
4459
4540
  }
4460
- ue = new WeakMap(), Fe = new WeakMap(), Z = new WeakMap(), ae = new WeakMap(), ce = new WeakMap(), R = new WeakSet(), Ct = function() {
4461
- return [...f(this, Z) ? [f(this, Z)] : [], ...f(this, ae).values()];
4541
+ pe = new WeakMap(), Fe = new WeakMap(), ee = new WeakMap(), he = new WeakMap(), le = new WeakMap(), R = new WeakSet(), Ct = function() {
4542
+ return [...d(this, ee) ? [d(this, ee)] : [], ...d(this, he).values()];
4462
4543
  }, ze = function(e, t) {
4463
- if (e === "collab") return f(this, Z);
4544
+ if (e === "collab") return d(this, ee);
4464
4545
  if (e === "external")
4465
- return f(this, ae).get(typeof t == "string" ? t : "");
4546
+ return d(this, he).get(typeof t == "string" ? t : "");
4466
4547
  }, Fs = async function(e) {
4467
4548
  const t = Tr(e);
4468
4549
  if (t) {
4469
4550
  if (t.type.startsWith(Ot)) {
4470
- c(this, R, Ls).call(this, t);
4551
+ h(this, R, Ls).call(this, t);
4471
4552
  return;
4472
4553
  }
4473
- await c(this, R, qs).call(this, t);
4554
+ await h(this, R, qs).call(this, t);
4474
4555
  }
4475
4556
  }, Ls = function(e) {
4476
4557
  var s, r, i;
4477
4558
  const t = e.payload ?? {};
4478
4559
  switch (e.type) {
4479
4560
  case "channel:joined":
4480
- (s = c(this, R, ze).call(this, t.scope, t.kind)) == null || s.applyJoined();
4561
+ (s = h(this, R, ze).call(this, t.scope, t.kind)) == null || s.applyJoined();
4481
4562
  break;
4482
4563
  case "channel:left":
4483
- (r = c(this, R, ze).call(this, t.scope, t.kind)) == null || r.applyLeft();
4564
+ (r = h(this, R, ze).call(this, t.scope, t.kind)) == null || r.applyLeft();
4484
4565
  break;
4485
4566
  case "channel:peers":
4486
- (i = c(this, R, ze).call(this, t.scope, t.kind)) == null || i.applyPeers(t.peers ?? []);
4567
+ (i = h(this, R, ze).call(this, t.scope, t.kind)) == null || i.applyPeers(t.peers ?? []);
4487
4568
  break;
4488
4569
  case "channel:peer-joined":
4489
4570
  case "channel:peer-left": {
4490
4571
  if (!t.from) break;
4491
- const o = t.scope === "collab" ? [f(this, Z)] : [...f(this, ae).values()].filter(
4572
+ const o = t.scope === "collab" ? [d(this, ee)] : [...d(this, he).values()].filter(
4492
4573
  (a) => a.accepts("external", t.kind)
4493
4574
  );
4494
4575
  for (const a of o)
@@ -4497,23 +4578,23 @@ ue = new WeakMap(), Fe = new WeakMap(), Z = new WeakMap(), ae = new WeakMap(), c
4497
4578
  }
4498
4579
  case "channel:error": {
4499
4580
  const o = new Error(String(e.payload));
4500
- c(this, R, Ct).call(this).map((l) => l.failPending(o)).some(Boolean) || console.error("[channel] error:", e.payload);
4581
+ h(this, R, Ct).call(this).map((l) => l.failPending(o)).some(Boolean) || console.error("[channel] error:", e.payload);
4501
4582
  break;
4502
4583
  }
4503
4584
  }
4504
4585
  }, qs = async function(e) {
4505
- const t = c(this, R, Ct).call(this).filter((i) => i.accepts(e.scope, e.kind));
4586
+ const t = h(this, R, Ct).call(this).filter((i) => i.accepts(e.scope, e.kind));
4506
4587
  let s = !1;
4507
4588
  for (const i of t) {
4508
4589
  const o = await i.handle(e);
4509
- o.handled && (s = !0, e.requestId && c(this, R, $t).call(this, e.requestId, o));
4590
+ o.handled && (s = !0, e.requestId && h(this, R, $t).call(this, e.requestId, o));
4510
4591
  }
4511
- e.requestId && e.scope === "external" && t.length > 0 && !s && c(this, R, $t).call(this, e.requestId, {
4592
+ e.requestId && e.scope === "external" && t.length > 0 && !s && h(this, R, $t).call(this, e.requestId, {
4512
4593
  handled: !0,
4513
4594
  error: `No handler for "${e.type}".`
4514
4595
  });
4515
4596
  }, $t = function(e, t) {
4516
- f(this, ce).has(e) || (f(this, ce).add(e), f(this, ce).size > 500 && f(this, ce).delete(f(this, ce).values().next().value), f(this, ue).post({
4597
+ d(this, le).has(e) || (d(this, le).add(e), d(this, le).size > 500 && d(this, le).delete(d(this, le).values().next().value), d(this, pe).post({
4517
4598
  type: "APP_CHANNEL_PUBLISH",
4518
4599
  message: {
4519
4600
  type: t.error === void 0 ? "reply" : "reply-error",
@@ -4522,7 +4603,7 @@ ue = new WeakMap(), Fe = new WeakMap(), Z = new WeakMap(), ae = new WeakMap(), c
4522
4603
  }
4523
4604
  }));
4524
4605
  };
4525
- const de = "project", me = "notifications";
4606
+ const fe = "project", ge = "notifications";
4526
4607
  var Se, Le;
4527
4608
  const jt = class jt extends Tt {
4528
4609
  /**
@@ -4540,7 +4621,7 @@ const jt = class jt extends Tt {
4540
4621
  typeof t == "function" && k(this, Se, t);
4541
4622
  }
4542
4623
  async resolveAccessToken() {
4543
- return f(this, Se) ? await f(this, Se).call(this) : super.resolveAccessToken();
4624
+ return d(this, Se) ? await d(this, Se).call(this) : super.resolveAccessToken();
4544
4625
  }
4545
4626
  /**
4546
4627
  * Creates a client from the platform context injected into
@@ -4577,7 +4658,7 @@ const jt = class jt extends Tt {
4577
4658
  * ```
4578
4659
  */
4579
4660
  get channel() {
4580
- return f(this, Le) ?? k(this, Le, new Ir(br())), f(this, Le);
4661
+ return d(this, Le) ?? k(this, Le, new Ir(br())), d(this, Le);
4581
4662
  }
4582
4663
  // ─── Projects (JWT-only backend routes) ──────────────────────────
4583
4664
  /**
@@ -4596,14 +4677,14 @@ const jt = class jt extends Tt {
4596
4677
  * ```
4597
4678
  */
4598
4679
  async listProjects() {
4599
- return await this.request("GET", de);
4680
+ return await this.request("GET", fe);
4600
4681
  }
4601
4682
  /**
4602
4683
  * Gets a project by ID. JWT-only — lives here because
4603
4684
  * `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
4604
4685
  */
4605
4686
  async getProject(t) {
4606
- return await this.request("GET", `${de}/${t}`);
4687
+ return await this.request("GET", `${fe}/${t}`);
4607
4688
  }
4608
4689
  /**
4609
4690
  * Gets the full project data (users, roles, files, folders) for a project.
@@ -4612,7 +4693,7 @@ const jt = class jt extends Tt {
4612
4693
  async getProjectData(t) {
4613
4694
  return await this.request(
4614
4695
  "GET",
4615
- `${de}/${t}/data`
4696
+ `${fe}/${t}/data`
4616
4697
  );
4617
4698
  }
4618
4699
  // ─── Account ──────────────────────────────────────────────────────
@@ -4637,7 +4718,7 @@ const jt = class jt extends Tt {
4637
4718
  async checkPermission(t) {
4638
4719
  return await this.request(
4639
4720
  "GET",
4640
- `${de}/permissions/check`,
4721
+ `${fe}/permissions/check`,
4641
4722
  { query: t }
4642
4723
  );
4643
4724
  }
@@ -4646,7 +4727,7 @@ const jt = class jt extends Tt {
4646
4727
  * single round-trip; results come back in the same order as `checks`.
4647
4728
  */
4648
4729
  async checkPermissionBatch(t) {
4649
- return (await this.request("POST", `${de}/permissions/check/batch`, {
4730
+ return (await this.request("POST", `${fe}/permissions/check/batch`, {
4650
4731
  body: JSON.stringify({ checks: t }),
4651
4732
  contentType: "application/json"
4652
4733
  })).results;
@@ -4674,7 +4755,7 @@ const jt = class jt extends Tt {
4674
4755
  * ```
4675
4756
  */
4676
4757
  async getNotifications(t) {
4677
- return await this.request("GET", me, {
4758
+ return await this.request("GET", ge, {
4678
4759
  query: {
4679
4760
  ...(t == null ? void 0 : t.cursor) !== void 0 && { cursor: t.cursor },
4680
4761
  ...(t == null ? void 0 : t.limit) !== void 0 && { limit: String(t.limit) }
@@ -4688,7 +4769,7 @@ const jt = class jt extends Tt {
4688
4769
  async getUnreadNotificationCount() {
4689
4770
  return (await this.request(
4690
4771
  "GET",
4691
- `${me}/unread-count`
4772
+ `${ge}/unread-count`
4692
4773
  )).count;
4693
4774
  }
4694
4775
  /**
@@ -4699,7 +4780,7 @@ const jt = class jt extends Tt {
4699
4780
  async markNotificationsRead(t) {
4700
4781
  return await this.request(
4701
4782
  "POST",
4702
- `${me}/mark-read`,
4783
+ `${ge}/mark-read`,
4703
4784
  {
4704
4785
  body: JSON.stringify({ ids: t }),
4705
4786
  contentType: "application/json"
@@ -4710,7 +4791,7 @@ const jt = class jt extends Tt {
4710
4791
  async markAllNotificationsRead() {
4711
4792
  return await this.request(
4712
4793
  "POST",
4713
- `${me}/mark-all-read`
4794
+ `${ge}/mark-all-read`
4714
4795
  );
4715
4796
  }
4716
4797
  /**
@@ -4720,7 +4801,7 @@ const jt = class jt extends Tt {
4720
4801
  async getNotificationSubscriptions() {
4721
4802
  return await this.request(
4722
4803
  "GET",
4723
- `${me}/subscriptions`
4804
+ `${ge}/subscriptions`
4724
4805
  );
4725
4806
  }
4726
4807
  /**
@@ -4734,7 +4815,7 @@ const jt = class jt extends Tt {
4734
4815
  async unsubscribeFromAutomation(t) {
4735
4816
  return await this.request(
4736
4817
  "DELETE",
4737
- `${me}/subscriptions/${t}`
4818
+ `${ge}/subscriptions/${t}`
4738
4819
  );
4739
4820
  }
4740
4821
  /**
@@ -4758,7 +4839,7 @@ const jt = class jt extends Tt {
4758
4839
  async subscribeToAutomation(t, s, r) {
4759
4840
  return await this.request(
4760
4841
  "POST",
4761
- `${de}/${t}/events/hooks/${s}/subscription`,
4842
+ `${fe}/${t}/events/hooks/${s}/subscription`,
4762
4843
  {
4763
4844
  body: JSON.stringify(r ?? {}),
4764
4845
  contentType: "application/json"
@@ -4775,7 +4856,7 @@ const jt = class jt extends Tt {
4775
4856
  async updateAutomationSubscription(t, s, r) {
4776
4857
  return await this.request(
4777
4858
  "PATCH",
4778
- `${de}/${t}/events/hooks/${s}/subscription`,
4859
+ `${fe}/${t}/events/hooks/${s}/subscription`,
4779
4860
  {
4780
4861
  body: JSON.stringify(r),
4781
4862
  contentType: "application/json"
@@ -4845,9 +4926,9 @@ async function js(n) {
4845
4926
  for (let a = 0; a < s.attributesLength(); a++) {
4846
4927
  const l = s.localIds(a);
4847
4928
  if (l === null) continue;
4848
- const u = {}, h = s.attributes(a);
4849
- for (let y = 0; y < ((h == null ? void 0 : h.dataLength()) ?? 0); y++) {
4850
- const w = h.data(y);
4929
+ const u = {}, c = s.attributes(a);
4930
+ for (let m = 0; m < ((c == null ? void 0 : c.dataLength()) ?? 0); m++) {
4931
+ const w = c.data(m);
4851
4932
  if (w)
4852
4933
  try {
4853
4934
  const [I, T] = JSON.parse(w);
@@ -4994,58 +5075,58 @@ class Ds {
4994
5075
  * and rejects a falsy one.
4995
5076
  */
4996
5077
  flatbuffer(e, t, s, r) {
4997
- const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: u } = t, h = new e.Builder(1024), y = this.changes.length, w = new Uint32Array(y);
5078
+ const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: u } = t, c = new e.Builder(1024), m = this.changes.length, w = new Uint32Array(m);
4998
5079
  let I = 1;
4999
- for (let C = 0; C < y; C++) w[C] = I++;
5000
- const T = I++, S = (C) => (C(h, 0), h.endVector()), x = o.createShellsVector(h, []), ee = o.createCircleExtrusionsVector(h, []), j = S(o.startSamplesVector), le = S(o.startRepresentationsVector), te = S(o.startMaterialsVector), pe = S(o.startLocalTransformsVector), A = S(o.startGlobalTransformsVector), D = o.createMeshesItemsVector(h, []), E = o.createMaterialIdsVector(h, []), v = o.createRepresentationIdsVector(h, []), $ = o.createSampleIdsVector(h, []), U = o.createLocalTransformIdsVector(h, []), B = o.createGlobalTransformIdsVector(h, []);
5001
- o.startMeshes(h), o.addCoordinates(h, u.createTransform(h, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(h, A), o.addShells(h, x), o.addRepresentations(h, le), o.addSamples(h, j), o.addLocalTransforms(h, pe), o.addMaterials(h, te), o.addCircleExtrusions(h, ee), o.addMeshesItems(h, D), o.addRepresentationIds(h, v), o.addSampleIds(h, $), o.addMaterialIds(h, E), o.addLocalTransformIds(h, U), o.addGlobalTransformIds(h, B);
5002
- const Y = o.endMeshes(h), Ws = h.createString(r), et = /* @__PURE__ */ new Set(), tt = [];
5080
+ for (let C = 0; C < m; C++) w[C] = I++;
5081
+ const T = I++, S = (C) => (C(c, 0), c.endVector()), x = o.createShellsVector(c, []), te = o.createCircleExtrusionsVector(c, []), j = S(o.startSamplesVector), ue = S(o.startRepresentationsVector), se = S(o.startMaterialsVector), ye = S(o.startLocalTransformsVector), A = S(o.startGlobalTransformsVector), D = o.createMeshesItemsVector(c, []), E = o.createMaterialIdsVector(c, []), v = o.createRepresentationIdsVector(c, []), $ = o.createSampleIdsVector(c, []), U = o.createLocalTransformIdsVector(c, []), B = o.createGlobalTransformIdsVector(c, []);
5082
+ o.startMeshes(c), o.addCoordinates(c, u.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, A), o.addShells(c, x), o.addRepresentations(c, ue), o.addSamples(c, j), o.addLocalTransforms(c, ye), o.addMaterials(c, se), o.addCircleExtrusions(c, te), o.addMeshesItems(c, D), o.addRepresentationIds(c, v), o.addSampleIds(c, $), o.addMaterialIds(c, E), o.addLocalTransformIds(c, U), o.addGlobalTransformIds(c, B);
5083
+ const K = o.endMeshes(c), Ws = c.createString(r), et = /* @__PURE__ */ new Set(), tt = [];
5003
5084
  for (const C of this.changes) {
5004
- const se = [], rn = {
5085
+ const ne = [], rn = {
5005
5086
  [Ar]: C.op,
5006
5087
  ...C.attrs
5007
5088
  };
5008
5089
  for (const [on, an] of Object.entries(rn)) {
5009
5090
  const Vt = JSON.stringify([on, an, "IFCTEXT"]);
5010
- et.add(Vt), se.push(h.createString(Vt));
5091
+ et.add(Vt), ne.push(c.createString(Vt));
5011
5092
  }
5012
5093
  tt.push(
5013
- i.createAttribute(h, i.createDataVector(h, se))
5094
+ i.createAttribute(c, i.createDataVector(c, ne))
5014
5095
  );
5015
5096
  }
5016
5097
  {
5017
5098
  const C = JSON.stringify(["Name", s, "IFCLABEL"]);
5018
5099
  et.add(C);
5019
- const se = i.createDataVector(h, [h.createString(C)]);
5020
- tt.push(i.createAttribute(h, se));
5100
+ const ne = i.createDataVector(c, [c.createString(C)]);
5101
+ tt.push(i.createAttribute(c, ne));
5021
5102
  }
5022
- const Ys = a.createAttributesVector(h, tt), Ks = a.createUniqueAttributesVector(
5023
- h,
5024
- [...et].map((C) => h.createString(C))
5103
+ const Ys = a.createAttributesVector(c, tt), Ks = a.createUniqueAttributesVector(
5104
+ c,
5105
+ [...et].map((C) => c.createString(C))
5025
5106
  ), Dt = this.changes.map(
5026
- () => h.createString(os)
5107
+ () => c.createString(os)
5027
5108
  );
5028
- Dt.push(h.createString(as));
5029
- const zs = a.createCategoriesVector(h, Dt), Ut = [], Mt = [];
5030
- this.changes.forEach((C, se) => {
5031
- C.item && (Ut.push(h.createString(C.item)), Mt.push(w[se]));
5109
+ Dt.push(c.createString(as));
5110
+ const zs = a.createCategoriesVector(c, Dt), Ut = [], Mt = [];
5111
+ this.changes.forEach((C, ne) => {
5112
+ C.item && (Ut.push(c.createString(C.item)), Mt.push(w[ne]));
5032
5113
  });
5033
- const Xs = a.createGuidsVector(h, Ut), Qs = a.createGuidsItemsVector(h, Mt), Zs = a.createLocalIdsVector(h, [...w, T]), en = this.changes.map(
5034
- (C, se) => l.createSpatialStructure(
5035
- h,
5036
- w[se],
5037
- h.createString(os),
5114
+ const Xs = a.createGuidsVector(c, Ut), Qs = a.createGuidsItemsVector(c, Mt), Zs = a.createLocalIdsVector(c, [...w, T]), en = this.changes.map(
5115
+ (C, ne) => l.createSpatialStructure(
5116
+ c,
5117
+ w[ne],
5118
+ c.createString(os),
5038
5119
  0
5039
5120
  )
5040
5121
  ), tn = l.createSpatialStructure(
5041
- h,
5122
+ c,
5042
5123
  T,
5043
- h.createString(as),
5044
- l.createChildrenVector(h, en)
5045
- ), sn = h.createString(s);
5046
- a.startModel(h), a.addMeshes(h, Y), a.addMetadata(h, Ws), a.addAttributes(h, Ys), a.addUniqueAttributes(h, Ks), a.addLocalIds(h, Zs), a.addCategories(h, zs), a.addGuidsItems(h, Qs), a.addGuids(h, Xs), a.addGuid(h, sn), a.addSpatialStructure(h, tn), a.addMaxLocalId(h, I);
5047
- const nn = a.endModel(h);
5048
- return a.finishModelBuffer(h, nn), h.asUint8Array();
5124
+ c.createString(as),
5125
+ l.createChildrenVector(c, en)
5126
+ ), sn = c.createString(s);
5127
+ a.startModel(c), a.addMeshes(c, K), a.addMetadata(c, Ws), a.addAttributes(c, Ys), a.addUniqueAttributes(c, Ks), a.addLocalIds(c, Zs), a.addCategories(c, zs), a.addGuidsItems(c, Qs), a.addGuids(c, Xs), a.addGuid(c, sn), a.addSpatialStructure(c, tn), a.addMaxLocalId(c, I);
5128
+ const nn = a.endModel(c);
5129
+ return a.finishModelBuffer(c, nn), c.asUint8Array();
5049
5130
  }
5050
5131
  }
5051
5132
  async function $r() {
@@ -5121,8 +5202,8 @@ async function Ms(n, e) {
5121
5202
  new Uint8Array(await i.arrayBuffer())
5122
5203
  ), a = o.filter((u) => u.attrs["flow:op"]), l = r.affectedIds ?? [];
5123
5204
  for (let u = 0; u < a.length && u < l.length; u++) {
5124
- const h = a[u].attrs["flow:source"];
5125
- h && (a[u].attrs["flow:op"] === "remove" ? t.delete(h) : t.set(h, l[u]));
5205
+ const c = a[u].attrs["flow:source"];
5206
+ c && (a[u].attrs["flow:op"] === "remove" ? t.delete(c) : t.set(c, l[u]));
5126
5207
  }
5127
5208
  } catch {
5128
5209
  }
@@ -5161,18 +5242,18 @@ function Gs(n) {
5161
5242
  throw new Error(
5162
5243
  "Free-standing instances can only be proposed by their style names: turn trustStyleNames on."
5163
5244
  );
5164
- const l = Fr(r), u = `recipe:${n}-to-revit`, h = await Ms(e, u), y = await e.targetDoc.latest(), w = new Ds({
5245
+ const l = Fr(r), u = `recipe:${n}-to-revit`, c = await Ms(e, u), m = await e.targetDoc.latest(), w = new Ds({
5165
5246
  project: e.projectId,
5166
5247
  document: e.targetDoc.docId,
5167
- baseCommit: (y == null ? void 0 : y.version) ?? 0,
5248
+ baseCommit: (m == null ? void 0 : m.version) ?? 0,
5168
5249
  author: u
5169
5250
  }), I = Us, T = (E) => `${t.fileId}:${E.id}`;
5170
- let S = 0, x = 0, ee = 0;
5171
- const j = /* @__PURE__ */ new Set(), le = (E, v, $, U) => {
5251
+ let S = 0, x = 0, te = 0;
5252
+ const j = /* @__PURE__ */ new Set(), ue = (E, v, $, U) => {
5172
5253
  const B = T(E);
5173
5254
  j.add(B);
5174
- const Y = h.get(B);
5175
- Y ? w.set(Y, {}, { position: $, rotationDeg: U, source: B }) : w.add(v, { position: $, rotationDeg: U, source: B });
5255
+ const K = c.get(B);
5256
+ K ? w.set(K, {}, { position: $, rotationDeg: U, source: B }) : w.add(v, { position: $, rotationDeg: U, source: B });
5176
5257
  };
5177
5258
  for (const E of r) {
5178
5259
  if (E.kind === "member" && E.params.of === "column") {
@@ -5183,14 +5264,14 @@ function Gs(n) {
5183
5264
  const B = U ?? {
5184
5265
  family: i.family,
5185
5266
  type: i.type
5186
- }, Y = l.get(String((v == null ? void 0 : v.level) ?? ""));
5187
- le(
5267
+ }, K = l.get(String((v == null ? void 0 : v.level) ?? ""));
5268
+ ue(
5188
5269
  E,
5189
5270
  {
5190
5271
  ...i && !o ? { CategoryId: i.categoryId } : {},
5191
5272
  Family: B.family,
5192
5273
  Type: B.type,
5193
- ...Y ? { Level: Y } : {}
5274
+ ...K ? { Level: K } : {}
5194
5275
  },
5195
5276
  [$[0] * I, $[1] * I, $[2] * I],
5196
5277
  (Number((v == null ? void 0 : v.roll) ?? 0) || 0) * ls
@@ -5202,39 +5283,39 @@ function Gs(n) {
5202
5283
  if (!$ || $.length !== 3 || v != null && v.host) continue;
5203
5284
  const U = ds(E.params.type);
5204
5285
  if (!U) continue;
5205
- const B = (D = v == null ? void 0 : v.placement) == null ? void 0 : D.right, Y = B ? Math.atan2(B[1], B[0]) * ls : 0;
5206
- le(
5286
+ const B = (D = v == null ? void 0 : v.placement) == null ? void 0 : D.right, K = B ? Math.atan2(B[1], B[0]) * ls : 0;
5287
+ ue(
5207
5288
  E,
5208
5289
  { Family: U.family, Type: U.type },
5209
5290
  [$[0] * I, $[1] * I, $[2] * I],
5210
- Y
5291
+ K
5211
5292
  ), x++;
5212
5293
  continue;
5213
5294
  }
5214
- (E.kind === "run" || E.kind === "extrusion" || E.kind === "stair" || E.kind === "footing" || E.kind === "ramp") && ee++;
5295
+ (E.kind === "run" || E.kind === "extrusion" || E.kind === "stair" || E.kind === "footing" || E.kind === "ramp") && te++;
5215
5296
  }
5216
- let te = 0;
5217
- for (const [E, v] of h)
5218
- !E.startsWith(`${t.fileId}:`) || j.has(E) || (w.remove(v), te++);
5297
+ let se = 0;
5298
+ for (const [E, v] of c)
5299
+ !E.startsWith(`${t.fileId}:`) || j.has(E) || (w.remove(v), se++);
5219
5300
  if (w.length === 0)
5220
5301
  throw new Error(
5221
- `Nothing the Revit applier can do yet: "${t.name}" has ${ee} element(s) with a body (walls, slabs, stairs...) and no column or free-standing instance. Those arrive as the applier grows.`
5302
+ `Nothing the Revit applier can do yet: "${t.name}" has ${te} element(s) with a body (walls, slabs, stairs...) and no column or free-standing instance. Those arrive as the applier grows.`
5222
5303
  );
5223
- const pe = [
5304
+ const ye = [
5224
5305
  S ? `${S} column(s)` : "",
5225
5306
  x ? `${x} instance(s)` : "",
5226
- te ? `${te} gone` : ""
5307
+ se ? `${se} gone` : ""
5227
5308
  ].filter(Boolean);
5228
5309
  return {
5229
- title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${pe.join(", ")}`,
5310
+ title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${ye.join(", ")}`,
5230
5311
  verb: w.summary,
5231
5312
  targets: w.length,
5232
5313
  payload: new Blob([await w.build(e.opId)]),
5233
5314
  ruleTallies: [
5234
5315
  { read: S, proposed: S },
5235
5316
  { read: x, proposed: x },
5236
- { read: te, proposed: te },
5237
- { read: ee, proposed: 0 }
5317
+ { read: se, proposed: se },
5318
+ { read: te, proposed: 0 }
5238
5319
  ]
5239
5320
  };
5240
5321
  };
@@ -5440,14 +5521,14 @@ at or below the point. For a level-based family the level wins over the
5440
5521
  point's height.
5441
5522
  `,
5442
5523
  async run(n) {
5443
- var pe;
5524
+ var ye;
5444
5525
  const { picked: e, contents: t } = await Vs(
5445
5526
  n,
5446
5527
  n.input
5447
5528
  ), { layer: s, instanceType: r } = n.settings;
5448
5529
  if (!s || !r)
5449
5530
  throw new Error("Choose the layer and the Revit type.");
5450
- const i = (pe = t.metadata) == null ? void 0 : pe.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Dr[o.trim().toLowerCase()] : void 0;
5531
+ const i = (ye = t.metadata) == null ? void 0 : ye.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Dr[o.trim().toLowerCase()] : void 0;
5451
5532
  if (!a)
5452
5533
  throw new Error(
5453
5534
  `"${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.`
@@ -5457,14 +5538,14 @@ point's height.
5457
5538
  throw new Error(
5458
5539
  `"${e.name}" declares its data as "${l}"; this recipe only converts Z up.`
5459
5540
  );
5460
- const u = a * Us, h = await Ms(n, us), y = await n.targetDoc.latest(), w = new Ds({
5541
+ const u = a * Us, c = await Ms(n, us), m = await n.targetDoc.latest(), w = new Ds({
5461
5542
  project: n.projectId,
5462
5543
  document: n.targetDoc.docId,
5463
- baseCommit: (y == null ? void 0 : y.version) ?? 0,
5544
+ baseCommit: (m == null ? void 0 : m.version) ?? 0,
5464
5545
  author: us
5465
5546
  });
5466
5547
  let I = 0, T = 0, S = 0;
5467
- const x = /* @__PURE__ */ new Set(), ee = [];
5548
+ const x = /* @__PURE__ */ new Set(), te = [];
5468
5549
  for (const A of t.items) {
5469
5550
  if (!A.guid || Object.keys(A.attrs).length === 0) continue;
5470
5551
  if ((A.attrs.Layer ?? "") !== s) {
@@ -5478,8 +5559,8 @@ point's height.
5478
5559
  D[0] * u,
5479
5560
  D[1] * u,
5480
5561
  D[2] * u
5481
- ], v = h.get(A.guid);
5482
- v ? ee.push({ instance: v, object: A.guid, position: E }) : (w.add(
5562
+ ], v = c.get(A.guid);
5563
+ v ? te.push({ instance: v, object: A.guid, position: E }) : (w.add(
5483
5564
  {
5484
5565
  CategoryId: r.categoryId,
5485
5566
  Family: r.family,
@@ -5488,13 +5569,13 @@ point's height.
5488
5569
  { position: E, source: A.guid }
5489
5570
  ), I++);
5490
5571
  }
5491
- for (const A of ee)
5572
+ for (const A of te)
5492
5573
  w.set(A.instance, {}, { position: A.position, source: A.object }), T++;
5493
5574
  let j = 0;
5494
- for (const [A, D] of h)
5575
+ for (const [A, D] of c)
5495
5576
  x.has(A) || (w.remove(D), j++);
5496
- const le = I + T + j;
5497
- if (le === 0)
5577
+ const ue = I + T + j;
5578
+ if (ue === 0)
5498
5579
  throw new Error(
5499
5580
  `Nothing to ask for: layer "${s}" of "${e.name}" has no placed object, and nothing of this recipe is left to remove.`
5500
5581
  );
@@ -5505,7 +5586,7 @@ point's height.
5505
5586
  j ? `${j} gone` : ""
5506
5587
  ].filter(Boolean).join(", ")}`,
5507
5588
  verb: w.summary,
5508
- targets: le,
5589
+ targets: ue,
5509
5590
  payload: new Blob([await w.build(n.opId)]),
5510
5591
  ruleTallies: [
5511
5592
  { read: I, proposed: I },