@thatopen/services 0.27.0 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var dn = Object.defineProperty;
|
|
2
|
+
var as = (n) => {
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
Object.keys(
|
|
18
|
-
|
|
5
|
+
var un = (n, e, t) => e in n ? dn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
6
|
+
var B = (n, e, t) => un(n, typeof e != "symbol" ? e + "" : e, t), Tt = (n, e, t) => e.has(n) || as("Cannot " + t);
|
|
7
|
+
var u = (n, e, t) => (Tt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), S = (n, e, t) => e.has(n) ? as("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), R = (n, e, t, s) => (Tt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), h = (n, e, t) => (Tt(n, e, "access private method"), t);
|
|
8
|
+
const ne = /* @__PURE__ */ Object.create(null);
|
|
9
|
+
ne.open = "0";
|
|
10
|
+
ne.close = "1";
|
|
11
|
+
ne.ping = "2";
|
|
12
|
+
ne.pong = "3";
|
|
13
|
+
ne.message = "4";
|
|
14
|
+
ne.upgrade = "5";
|
|
15
|
+
ne.noop = "6";
|
|
16
|
+
const lt = /* @__PURE__ */ Object.create(null);
|
|
17
|
+
Object.keys(ne).forEach((n) => {
|
|
18
|
+
lt[ne[n]] = n;
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const Ct = { type: "error", data: "parser error" }, Rs = typeof Blob == "function" || typeof Blob < "u" && Object.prototype.toString.call(Blob) === "[object BlobConstructor]", Cs = typeof ArrayBuffer == "function", $s = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n && n.buffer instanceof ArrayBuffer, Zt = ({ type: n, data: e }, t, s) => Rs && e instanceof Blob ? t ? s(e) : cs(e, s) : Cs && (e instanceof ArrayBuffer || $s(e)) ? t ? s(e) : cs(new Blob([e]), s) : s(ne[n] + (e || "")), cs = (n, e) => {
|
|
21
21
|
const t = new FileReader();
|
|
22
22
|
return t.onload = function() {
|
|
23
23
|
const s = t.result.split(",")[1];
|
|
24
24
|
e("b" + (s || ""));
|
|
25
25
|
}, t.readAsDataURL(n);
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function hs(n) {
|
|
28
28
|
return n instanceof Uint8Array ? n : n instanceof ArrayBuffer ? new Uint8Array(n) : new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
|
|
29
29
|
}
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
if (
|
|
33
|
-
return n.data.arrayBuffer().then(
|
|
34
|
-
if (
|
|
35
|
-
return e(
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
let _t;
|
|
31
|
+
function fn(n, e) {
|
|
32
|
+
if (Rs && n.data instanceof Blob)
|
|
33
|
+
return n.data.arrayBuffer().then(hs).then(e);
|
|
34
|
+
if (Cs && (n.data instanceof ArrayBuffer || $s(n.data)))
|
|
35
|
+
return e(hs(n.data));
|
|
36
|
+
Zt(n, !1, (t) => {
|
|
37
|
+
_t || (_t = new TextEncoder()), e(_t.encode(t));
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
-
const
|
|
41
|
-
for (let n = 0; n <
|
|
42
|
-
|
|
43
|
-
const
|
|
40
|
+
const ls = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Je = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
|
|
41
|
+
for (let n = 0; n < ls.length; n++)
|
|
42
|
+
Je[ls.charCodeAt(n)] = n;
|
|
43
|
+
const pn = (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
|
|
46
|
+
const d = new ArrayBuffer(e), c = new Uint8Array(d);
|
|
47
47
|
for (s = 0; s < t; s += 4)
|
|
48
|
-
i =
|
|
49
|
-
return
|
|
50
|
-
},
|
|
48
|
+
i = Je[n.charCodeAt(s)], o = Je[n.charCodeAt(s + 1)], a = Je[n.charCodeAt(s + 2)], l = Je[n.charCodeAt(s + 3)], c[r++] = i << 2 | o >> 4, c[r++] = (o & 15) << 4 | a >> 2, c[r++] = (a & 3) << 6 | l & 63;
|
|
49
|
+
return d;
|
|
50
|
+
}, mn = typeof ArrayBuffer == "function", es = (n, e) => {
|
|
51
51
|
if (typeof n != "string")
|
|
52
52
|
return {
|
|
53
53
|
type: "message",
|
|
54
|
-
data:
|
|
54
|
+
data: xs(n, e)
|
|
55
55
|
};
|
|
56
56
|
const t = n.charAt(0);
|
|
57
57
|
return t === "b" ? {
|
|
58
58
|
type: "message",
|
|
59
|
-
data:
|
|
60
|
-
} :
|
|
61
|
-
type:
|
|
59
|
+
data: yn(n.substring(1), e)
|
|
60
|
+
} : lt[t] ? n.length > 1 ? {
|
|
61
|
+
type: lt[t],
|
|
62
62
|
data: n.substring(1)
|
|
63
63
|
} : {
|
|
64
|
-
type:
|
|
65
|
-
} :
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
68
|
-
const t =
|
|
69
|
-
return
|
|
64
|
+
type: lt[t]
|
|
65
|
+
} : Ct;
|
|
66
|
+
}, yn = (n, e) => {
|
|
67
|
+
if (mn) {
|
|
68
|
+
const t = pn(n);
|
|
69
|
+
return xs(t, e);
|
|
70
70
|
} else
|
|
71
71
|
return { base64: !0, data: n };
|
|
72
|
-
},
|
|
72
|
+
}, xs = (n, e) => {
|
|
73
73
|
switch (e) {
|
|
74
74
|
case "blob":
|
|
75
75
|
return n instanceof Blob ? n : new Blob([n]);
|
|
@@ -77,27 +77,27 @@ const dn = (n) => {
|
|
|
77
77
|
default:
|
|
78
78
|
return n instanceof ArrayBuffer ? n : n.buffer;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, Ns = "", gn = (n, e) => {
|
|
81
81
|
const t = n.length, s = new Array(t);
|
|
82
82
|
let r = 0;
|
|
83
83
|
n.forEach((i, o) => {
|
|
84
|
-
|
|
85
|
-
s[o] = a, ++r === t && e(s.join(
|
|
84
|
+
Zt(i, !1, (a) => {
|
|
85
|
+
s[o] = a, ++r === t && e(s.join(Ns));
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
|
-
},
|
|
89
|
-
const t = n.split(
|
|
88
|
+
}, wn = (n, e) => {
|
|
89
|
+
const t = n.split(Ns), s = [];
|
|
90
90
|
for (let r = 0; r < t.length; r++) {
|
|
91
|
-
const i =
|
|
91
|
+
const i = es(t[r], e);
|
|
92
92
|
if (s.push(i), i.type === "error")
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
return s;
|
|
96
96
|
};
|
|
97
|
-
function
|
|
97
|
+
function bn() {
|
|
98
98
|
return new TransformStream({
|
|
99
99
|
transform(n, e) {
|
|
100
|
-
|
|
100
|
+
fn(n, (t) => {
|
|
101
101
|
const s = t.length;
|
|
102
102
|
let r;
|
|
103
103
|
if (s < 126)
|
|
@@ -116,11 +116,11 @@ function yn() {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
let
|
|
120
|
-
function
|
|
119
|
+
let It;
|
|
120
|
+
function it(n) {
|
|
121
121
|
return n.reduce((e, t) => e + t.length, 0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function ot(n, e) {
|
|
124
124
|
if (n[0].length === e)
|
|
125
125
|
return n.shift();
|
|
126
126
|
const t = new Uint8Array(e);
|
|
@@ -129,65 +129,65 @@ function je(n, e) {
|
|
|
129
129
|
t[r] = n[0][s++], s === n[0].length && (n.shift(), s = 0);
|
|
130
130
|
return n.length && s < n[0].length && (n[0] = n[0].slice(s)), t;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
132
|
+
function vn(n, e) {
|
|
133
|
+
It || (It = new TextDecoder());
|
|
134
134
|
const t = [];
|
|
135
135
|
let s = 0, r = -1, i = !1;
|
|
136
136
|
return new TransformStream({
|
|
137
137
|
transform(o, a) {
|
|
138
138
|
for (t.push(o); ; ) {
|
|
139
139
|
if (s === 0) {
|
|
140
|
-
if (
|
|
140
|
+
if (it(t) < 1)
|
|
141
141
|
break;
|
|
142
|
-
const l =
|
|
142
|
+
const l = ot(t, 1);
|
|
143
143
|
i = (l[0] & 128) === 128, r = l[0] & 127, r < 126 ? s = 3 : r === 126 ? s = 1 : s = 2;
|
|
144
144
|
} else if (s === 1) {
|
|
145
|
-
if (
|
|
145
|
+
if (it(t) < 2)
|
|
146
146
|
break;
|
|
147
|
-
const l =
|
|
147
|
+
const l = ot(t, 2);
|
|
148
148
|
r = new DataView(l.buffer, l.byteOffset, l.length).getUint16(0), s = 3;
|
|
149
149
|
} else if (s === 2) {
|
|
150
|
-
if (
|
|
150
|
+
if (it(t) < 8)
|
|
151
151
|
break;
|
|
152
|
-
const l =
|
|
152
|
+
const l = ot(t, 8), d = new DataView(l.buffer, l.byteOffset, l.length), c = d.getUint32(0);
|
|
153
153
|
if (c > Math.pow(2, 21) - 1) {
|
|
154
|
-
a.enqueue(
|
|
154
|
+
a.enqueue(Ct);
|
|
155
155
|
break;
|
|
156
156
|
}
|
|
157
|
-
r = c * Math.pow(2, 32) +
|
|
157
|
+
r = c * Math.pow(2, 32) + d.getUint32(4), s = 3;
|
|
158
158
|
} else {
|
|
159
|
-
if (
|
|
159
|
+
if (it(t) < r)
|
|
160
160
|
break;
|
|
161
|
-
const l =
|
|
162
|
-
a.enqueue(
|
|
161
|
+
const l = ot(t, r);
|
|
162
|
+
a.enqueue(es(i ? l : It.decode(l), e)), s = 0;
|
|
163
163
|
}
|
|
164
164
|
if (r === 0 || r > n) {
|
|
165
|
-
a.enqueue(
|
|
165
|
+
a.enqueue(Ct);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
174
|
-
if (n) return
|
|
172
|
+
const Ps = 4;
|
|
173
|
+
function C(n) {
|
|
174
|
+
if (n) return En(n);
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
for (var e in
|
|
178
|
-
n[e] =
|
|
176
|
+
function En(n) {
|
|
177
|
+
for (var e in C.prototype)
|
|
178
|
+
n[e] = C.prototype[e];
|
|
179
179
|
return n;
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
C.prototype.on = C.prototype.addEventListener = function(n, e) {
|
|
182
182
|
return this._callbacks = this._callbacks || {}, (this._callbacks["$" + n] = this._callbacks["$" + n] || []).push(e), this;
|
|
183
183
|
};
|
|
184
|
-
|
|
184
|
+
C.prototype.once = function(n, e) {
|
|
185
185
|
function t() {
|
|
186
186
|
this.off(n, t), e.apply(this, arguments);
|
|
187
187
|
}
|
|
188
188
|
return t.fn = e, this.on(n, t), this;
|
|
189
189
|
};
|
|
190
|
-
|
|
190
|
+
C.prototype.off = C.prototype.removeListener = C.prototype.removeAllListeners = C.prototype.removeEventListener = function(n, e) {
|
|
191
191
|
if (this._callbacks = this._callbacks || {}, arguments.length == 0)
|
|
192
192
|
return this._callbacks = {}, this;
|
|
193
193
|
var t = this._callbacks["$" + n];
|
|
@@ -201,7 +201,7 @@ O.prototype.off = O.prototype.removeListener = O.prototype.removeAllListeners =
|
|
|
201
201
|
}
|
|
202
202
|
return t.length === 0 && delete this._callbacks["$" + n], this;
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
C.prototype.emit = function(n) {
|
|
205
205
|
this._callbacks = this._callbacks || {};
|
|
206
206
|
for (var e = new Array(arguments.length - 1), t = this._callbacks["$" + n], s = 1; s < arguments.length; s++)
|
|
207
207
|
e[s - 1] = arguments[s];
|
|
@@ -212,41 +212,41 @@ O.prototype.emit = function(n) {
|
|
|
212
212
|
}
|
|
213
213
|
return this;
|
|
214
214
|
};
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
C.prototype.emitReserved = C.prototype.emit;
|
|
216
|
+
C.prototype.listeners = function(n) {
|
|
217
217
|
return this._callbacks = this._callbacks || {}, this._callbacks["$" + n] || [];
|
|
218
218
|
};
|
|
219
|
-
|
|
219
|
+
C.prototype.hasListeners = function(n) {
|
|
220
220
|
return !!this.listeners(n).length;
|
|
221
221
|
};
|
|
222
|
-
const
|
|
223
|
-
function
|
|
222
|
+
const vt = typeof Promise == "function" && typeof Promise.resolve == "function" ? (e) => Promise.resolve().then(e) : (e, t) => t(e, 0), V = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Tn = "arraybuffer";
|
|
223
|
+
function Bs(n, ...e) {
|
|
224
224
|
return e.reduce((t, s) => (n.hasOwnProperty(s) && (t[s] = n[s]), t), {});
|
|
225
225
|
}
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
e.useNativeTimers ? (n.setTimeoutFn =
|
|
226
|
+
const _n = V.setTimeout, In = V.clearTimeout;
|
|
227
|
+
function Et(n, e) {
|
|
228
|
+
e.useNativeTimers ? (n.setTimeoutFn = _n.bind(V), n.clearTimeoutFn = In.bind(V)) : (n.setTimeoutFn = V.setTimeout.bind(V), n.clearTimeoutFn = V.clearTimeout.bind(V));
|
|
229
229
|
}
|
|
230
|
-
const
|
|
231
|
-
function
|
|
232
|
-
return typeof n == "string" ?
|
|
230
|
+
const Sn = 1.33;
|
|
231
|
+
function kn(n) {
|
|
232
|
+
return typeof n == "string" ? On(n) : Math.ceil((n.byteLength || n.size) * Sn);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function On(n) {
|
|
235
235
|
let e = 0, t = 0;
|
|
236
236
|
for (let s = 0, r = n.length; s < r; s++)
|
|
237
237
|
e = n.charCodeAt(s), e < 128 ? t += 1 : e < 2048 ? t += 2 : e < 55296 || e >= 57344 ? t += 3 : (s++, t += 4);
|
|
238
238
|
return t;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Ls() {
|
|
241
241
|
return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function An(n) {
|
|
244
244
|
let e = "";
|
|
245
245
|
for (let t in n)
|
|
246
246
|
n.hasOwnProperty(t) && (e.length && (e += "&"), e += encodeURIComponent(t) + "=" + encodeURIComponent(n[t]));
|
|
247
247
|
return e;
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function Rn(n) {
|
|
250
250
|
let e = {}, t = n.split("&");
|
|
251
251
|
for (let s = 0, r = t.length; s < r; s++) {
|
|
252
252
|
let i = t[s].split("=");
|
|
@@ -254,12 +254,12 @@ function kn(n) {
|
|
|
254
254
|
}
|
|
255
255
|
return e;
|
|
256
256
|
}
|
|
257
|
-
class
|
|
257
|
+
class Cn extends Error {
|
|
258
258
|
constructor(e, t, s) {
|
|
259
259
|
super(e), this.description = t, this.context = s, this.type = "TransportError";
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
class
|
|
262
|
+
class ts extends C {
|
|
263
263
|
/**
|
|
264
264
|
* Transport abstract constructor.
|
|
265
265
|
*
|
|
@@ -267,7 +267,7 @@ class Pt extends O {
|
|
|
267
267
|
* @protected
|
|
268
268
|
*/
|
|
269
269
|
constructor(e) {
|
|
270
|
-
super(), this.writable = !1,
|
|
270
|
+
super(), this.writable = !1, Et(this, e), this.opts = e, this.query = e.query, this.socket = e.socket, this.supportsBinary = !e.forceBase64;
|
|
271
271
|
}
|
|
272
272
|
/**
|
|
273
273
|
* Emits an error.
|
|
@@ -279,7 +279,7 @@ class Pt extends O {
|
|
|
279
279
|
* @protected
|
|
280
280
|
*/
|
|
281
281
|
onError(e, t, s) {
|
|
282
|
-
return super.emitReserved("error", new
|
|
282
|
+
return super.emitReserved("error", new Cn(e, t, s)), this;
|
|
283
283
|
}
|
|
284
284
|
/**
|
|
285
285
|
* Opens the transport.
|
|
@@ -316,7 +316,7 @@ class Pt extends O {
|
|
|
316
316
|
* @protected
|
|
317
317
|
*/
|
|
318
318
|
onData(e) {
|
|
319
|
-
const t =
|
|
319
|
+
const t = es(e, this.socket.binaryType);
|
|
320
320
|
this.onPacket(t);
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
@@ -353,11 +353,11 @@ class Pt extends O {
|
|
|
353
353
|
return this.opts.port && (this.opts.secure && Number(this.opts.port) !== 443 || !this.opts.secure && Number(this.opts.port) !== 80) ? ":" + this.opts.port : "";
|
|
354
354
|
}
|
|
355
355
|
_query(e) {
|
|
356
|
-
const t =
|
|
356
|
+
const t = An(e);
|
|
357
357
|
return t.length ? "?" + t : "";
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class
|
|
360
|
+
class $n extends ts {
|
|
361
361
|
constructor() {
|
|
362
362
|
super(...arguments), this._polling = !1;
|
|
363
363
|
}
|
|
@@ -413,7 +413,7 @@ class An extends Pt {
|
|
|
413
413
|
return this.onClose({ description: "transport closed by the server" }), !1;
|
|
414
414
|
this.onPacket(s);
|
|
415
415
|
};
|
|
416
|
-
|
|
416
|
+
wn(e, this.socket.binaryType).forEach(t), this.readyState !== "closed" && (this._polling = !1, this.emitReserved("pollComplete"), this.readyState === "open" && this._poll());
|
|
417
417
|
}
|
|
418
418
|
/**
|
|
419
419
|
* For polling, send a close packet.
|
|
@@ -433,7 +433,7 @@ class An extends Pt {
|
|
|
433
433
|
* @protected
|
|
434
434
|
*/
|
|
435
435
|
write(e) {
|
|
436
|
-
this.writable = !1,
|
|
436
|
+
this.writable = !1, gn(e, (t) => {
|
|
437
437
|
this.doWrite(t, () => {
|
|
438
438
|
this.writable = !0, this.emitReserved("drain");
|
|
439
439
|
});
|
|
@@ -446,18 +446,18 @@ class An extends Pt {
|
|
|
446
446
|
*/
|
|
447
447
|
uri() {
|
|
448
448
|
const e = this.opts.secure ? "https" : "http", t = this.query || {};
|
|
449
|
-
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] =
|
|
449
|
+
return this.opts.timestampRequests !== !1 && (t[this.opts.timestampParam] = Ls()), !this.supportsBinary && !t.sid && (t.b64 = 1), this.createUri(e, t);
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
let
|
|
452
|
+
let Fs = !1;
|
|
453
453
|
try {
|
|
454
|
-
|
|
454
|
+
Fs = typeof XMLHttpRequest < "u" && "withCredentials" in new XMLHttpRequest();
|
|
455
455
|
} catch {
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
457
|
+
const xn = Fs;
|
|
458
|
+
function Nn() {
|
|
459
459
|
}
|
|
460
|
-
class
|
|
460
|
+
class Pn extends $n {
|
|
461
461
|
/**
|
|
462
462
|
* XHR Polling constructor.
|
|
463
463
|
*
|
|
@@ -499,7 +499,7 @@ class $n extends An {
|
|
|
499
499
|
}), this.pollXhr = e;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
class
|
|
502
|
+
class se extends C {
|
|
503
503
|
/**
|
|
504
504
|
* Request constructor
|
|
505
505
|
*
|
|
@@ -507,7 +507,7 @@ class W extends O {
|
|
|
507
507
|
* @package
|
|
508
508
|
*/
|
|
509
509
|
constructor(e, t, s) {
|
|
510
|
-
super(), this.createRequest = e,
|
|
510
|
+
super(), this.createRequest = e, Et(this, s), this._opts = s, this._method = s.method || "GET", this._uri = t, this._data = s.data !== void 0 ? s.data : null, this._create();
|
|
511
511
|
}
|
|
512
512
|
/**
|
|
513
513
|
* Creates the XHR object and sends the request.
|
|
@@ -516,7 +516,7 @@ class W extends O {
|
|
|
516
516
|
*/
|
|
517
517
|
_create() {
|
|
518
518
|
var e;
|
|
519
|
-
const t =
|
|
519
|
+
const t = Bs(this._opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
|
|
520
520
|
t.xdomain = !!this._opts.xd;
|
|
521
521
|
const s = this._xhr = this.createRequest(t);
|
|
522
522
|
try {
|
|
@@ -553,7 +553,7 @@ class W extends O {
|
|
|
553
553
|
}, 0);
|
|
554
554
|
return;
|
|
555
555
|
}
|
|
556
|
-
typeof document < "u" && (this._index =
|
|
556
|
+
typeof document < "u" && (this._index = se.requestsCount++, se.requests[this._index] = this);
|
|
557
557
|
}
|
|
558
558
|
/**
|
|
559
559
|
* Called upon error.
|
|
@@ -570,12 +570,12 @@ class W extends O {
|
|
|
570
570
|
*/
|
|
571
571
|
_cleanup(e) {
|
|
572
572
|
if (!(typeof this._xhr > "u" || this._xhr === null)) {
|
|
573
|
-
if (this._xhr.onreadystatechange =
|
|
573
|
+
if (this._xhr.onreadystatechange = Nn, e)
|
|
574
574
|
try {
|
|
575
575
|
this._xhr.abort();
|
|
576
576
|
} catch {
|
|
577
577
|
}
|
|
578
|
-
typeof document < "u" && delete
|
|
578
|
+
typeof document < "u" && delete se.requests[this._index], this._xhr = null;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
581
|
/**
|
|
@@ -596,56 +596,56 @@ class W extends O {
|
|
|
596
596
|
this._cleanup();
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
se.requestsCount = 0;
|
|
600
|
+
se.requests = {};
|
|
601
601
|
if (typeof document < "u") {
|
|
602
602
|
if (typeof attachEvent == "function")
|
|
603
|
-
attachEvent("onunload",
|
|
603
|
+
attachEvent("onunload", ds);
|
|
604
604
|
else if (typeof addEventListener == "function") {
|
|
605
|
-
const n = "onpagehide" in
|
|
606
|
-
addEventListener(n,
|
|
605
|
+
const n = "onpagehide" in V ? "pagehide" : "unload";
|
|
606
|
+
addEventListener(n, ds, !1);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
function
|
|
610
|
-
for (let n in
|
|
611
|
-
|
|
609
|
+
function ds() {
|
|
610
|
+
for (let n in se.requests)
|
|
611
|
+
se.requests.hasOwnProperty(n) && se.requests[n].abort();
|
|
612
612
|
}
|
|
613
|
-
const
|
|
614
|
-
const n =
|
|
613
|
+
const Bn = function() {
|
|
614
|
+
const n = Ds({
|
|
615
615
|
xdomain: !1
|
|
616
616
|
});
|
|
617
617
|
return n && n.responseType !== null;
|
|
618
618
|
}();
|
|
619
|
-
class
|
|
619
|
+
class Ln extends Pn {
|
|
620
620
|
constructor(e) {
|
|
621
621
|
super(e);
|
|
622
622
|
const t = e && e.forceBase64;
|
|
623
|
-
this.supportsBinary =
|
|
623
|
+
this.supportsBinary = Bn && !t;
|
|
624
624
|
}
|
|
625
625
|
request(e = {}) {
|
|
626
|
-
return Object.assign(e, { xd: this.xd }, this.opts), new
|
|
626
|
+
return Object.assign(e, { xd: this.xd }, this.opts), new se(Ds, this.uri(), e);
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
-
function
|
|
629
|
+
function Ds(n) {
|
|
630
630
|
const e = n.xdomain;
|
|
631
631
|
try {
|
|
632
|
-
if (typeof XMLHttpRequest < "u" && (!e ||
|
|
632
|
+
if (typeof XMLHttpRequest < "u" && (!e || xn))
|
|
633
633
|
return new XMLHttpRequest();
|
|
634
634
|
} catch {
|
|
635
635
|
}
|
|
636
636
|
if (!e)
|
|
637
637
|
try {
|
|
638
|
-
return new
|
|
638
|
+
return new V[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
639
639
|
} catch {
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
const
|
|
643
|
-
class
|
|
642
|
+
const qs = typeof navigator < "u" && typeof navigator.product == "string" && navigator.product.toLowerCase() === "reactnative";
|
|
643
|
+
class Fn extends ts {
|
|
644
644
|
get name() {
|
|
645
645
|
return "websocket";
|
|
646
646
|
}
|
|
647
647
|
doOpen() {
|
|
648
|
-
const e = this.uri(), t = this.opts.protocols, s =
|
|
648
|
+
const e = this.uri(), t = this.opts.protocols, s = qs ? {} : Bs(this.opts, "agent", "perMessageDeflate", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "localAddress", "protocolVersion", "origin", "maxPayload", "family", "checkServerIdentity");
|
|
649
649
|
this.opts.extraHeaders && (s.headers = this.opts.extraHeaders);
|
|
650
650
|
try {
|
|
651
651
|
this.ws = this.createSocket(e, t, s);
|
|
@@ -671,12 +671,12 @@ class Pn extends Pt {
|
|
|
671
671
|
this.writable = !1;
|
|
672
672
|
for (let t = 0; t < e.length; t++) {
|
|
673
673
|
const s = e[t], r = t === e.length - 1;
|
|
674
|
-
|
|
674
|
+
Zt(s, this.supportsBinary, (i) => {
|
|
675
675
|
try {
|
|
676
676
|
this.doWrite(s, i);
|
|
677
677
|
} catch {
|
|
678
678
|
}
|
|
679
|
-
r &&
|
|
679
|
+
r && vt(() => {
|
|
680
680
|
this.writable = !0, this.emitReserved("drain");
|
|
681
681
|
}, this.setTimeoutFn);
|
|
682
682
|
});
|
|
@@ -693,19 +693,19 @@ class Pn extends Pt {
|
|
|
693
693
|
*/
|
|
694
694
|
uri() {
|
|
695
695
|
const e = this.opts.secure ? "wss" : "ws", t = this.query || {};
|
|
696
|
-
return this.opts.timestampRequests && (t[this.opts.timestampParam] =
|
|
696
|
+
return this.opts.timestampRequests && (t[this.opts.timestampParam] = Ls()), this.supportsBinary || (t.b64 = 1), this.createUri(e, t);
|
|
697
697
|
}
|
|
698
698
|
}
|
|
699
|
-
const
|
|
700
|
-
class
|
|
699
|
+
const St = V.WebSocket || V.MozWebSocket;
|
|
700
|
+
class Dn extends Fn {
|
|
701
701
|
createSocket(e, t, s) {
|
|
702
|
-
return
|
|
702
|
+
return qs ? new St(e, t, s) : t ? new St(e, t) : new St(e);
|
|
703
703
|
}
|
|
704
704
|
doWrite(e, t) {
|
|
705
705
|
this.ws.send(t);
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
|
-
class
|
|
708
|
+
class qn extends ts {
|
|
709
709
|
get name() {
|
|
710
710
|
return "webtransport";
|
|
711
711
|
}
|
|
@@ -721,7 +721,7 @@ class Fn extends Pt {
|
|
|
721
721
|
this.onError("webtransport error", e);
|
|
722
722
|
}), this._transport.ready.then(() => {
|
|
723
723
|
this._transport.createBidirectionalStream().then((e) => {
|
|
724
|
-
const t =
|
|
724
|
+
const t = vn(Number.MAX_SAFE_INTEGER, this.socket.binaryType), s = e.readable.pipeThrough(t).getReader(), r = bn();
|
|
725
725
|
r.readable.pipeTo(e.writable), this._writer = r.writable.getWriter();
|
|
726
726
|
const i = () => {
|
|
727
727
|
s.read().then(({ done: a, value: l }) => {
|
|
@@ -740,7 +740,7 @@ class Fn extends Pt {
|
|
|
740
740
|
for (let t = 0; t < e.length; t++) {
|
|
741
741
|
const s = e[t], r = t === e.length - 1;
|
|
742
742
|
this._writer.write(s).then(() => {
|
|
743
|
-
r &&
|
|
743
|
+
r && vt(() => {
|
|
744
744
|
this.writable = !0, this.emitReserved("drain");
|
|
745
745
|
}, this.setTimeoutFn);
|
|
746
746
|
});
|
|
@@ -751,11 +751,11 @@ class Fn extends Pt {
|
|
|
751
751
|
(e = this._transport) === null || e === void 0 || e.close();
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
const
|
|
755
|
-
websocket:
|
|
756
|
-
webtransport:
|
|
757
|
-
polling:
|
|
758
|
-
},
|
|
754
|
+
const jn = {
|
|
755
|
+
websocket: Dn,
|
|
756
|
+
webtransport: qn,
|
|
757
|
+
polling: Ln
|
|
758
|
+
}, Un = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/, Mn = [
|
|
759
759
|
"source",
|
|
760
760
|
"protocol",
|
|
761
761
|
"authority",
|
|
@@ -771,31 +771,31 @@ const Ln = {
|
|
|
771
771
|
"query",
|
|
772
772
|
"anchor"
|
|
773
773
|
];
|
|
774
|
-
function
|
|
774
|
+
function $t(n) {
|
|
775
775
|
if (n.length > 8e3)
|
|
776
776
|
throw "URI too long";
|
|
777
777
|
const e = n, t = n.indexOf("["), s = n.indexOf("]");
|
|
778
778
|
t != -1 && s != -1 && (n = n.substring(0, t) + n.substring(t, s).replace(/:/g, ";") + n.substring(s, n.length));
|
|
779
|
-
let r =
|
|
779
|
+
let r = Un.exec(n || ""), i = {}, o = 14;
|
|
780
780
|
for (; o--; )
|
|
781
|
-
i[
|
|
782
|
-
return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames =
|
|
781
|
+
i[Mn[o]] = r[o] || "";
|
|
782
|
+
return t != -1 && s != -1 && (i.source = e, i.host = i.host.substring(1, i.host.length - 1).replace(/;/g, ":"), i.authority = i.authority.replace("[", "").replace("]", "").replace(/;/g, ":"), i.ipv6uri = !0), i.pathNames = Vn(i, i.path), i.queryKey = Hn(i, i.query), i;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Vn(n, e) {
|
|
785
785
|
const t = /\/{2,9}/g, s = e.replace(t, "/").split("/");
|
|
786
786
|
return (e.slice(0, 1) == "/" || e.length === 0) && s.splice(0, 1), e.slice(-1) == "/" && s.splice(s.length - 1, 1), s;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function Hn(n, e) {
|
|
789
789
|
const t = {};
|
|
790
790
|
return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function(s, r, i) {
|
|
791
791
|
r && (t[r] = i);
|
|
792
792
|
}), t;
|
|
793
793
|
}
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
|
|
794
|
+
const xt = typeof addEventListener == "function" && typeof removeEventListener == "function", dt = [];
|
|
795
|
+
xt && addEventListener("offline", () => {
|
|
796
|
+
dt.forEach((n) => n());
|
|
797
797
|
}, !1);
|
|
798
|
-
class
|
|
798
|
+
class ge extends C {
|
|
799
799
|
/**
|
|
800
800
|
* Socket constructor.
|
|
801
801
|
*
|
|
@@ -803,11 +803,11 @@ class de extends O {
|
|
|
803
803
|
* @param {Object} opts - options
|
|
804
804
|
*/
|
|
805
805
|
constructor(e, t) {
|
|
806
|
-
if (super(), this.binaryType =
|
|
807
|
-
const s =
|
|
806
|
+
if (super(), this.binaryType = Tn, this.writeBuffer = [], this._prevBufferLen = 0, this._pingInterval = -1, this._pingTimeout = -1, this._maxPayload = -1, this._pingTimeoutTime = 1 / 0, e && typeof e == "object" && (t = e, e = null), e) {
|
|
807
|
+
const s = $t(e);
|
|
808
808
|
t.hostname = s.host, t.secure = s.protocol === "https" || s.protocol === "wss", t.port = s.port, s.query && (t.query = s.query);
|
|
809
|
-
} else t.host && (t.hostname =
|
|
810
|
-
|
|
809
|
+
} else t.host && (t.hostname = $t(t.host).host);
|
|
810
|
+
Et(this, t), this.secure = t.secure != null ? t.secure : typeof location < "u" && location.protocol === "https:", t.hostname && !t.port && (t.port = this.secure ? "443" : "80"), this.hostname = t.hostname || (typeof location < "u" ? location.hostname : "localhost"), this.port = t.port || (typeof location < "u" && location.port ? location.port : this.secure ? "443" : "80"), this.transports = [], this._transportsByName = {}, t.transports.forEach((s) => {
|
|
811
811
|
const r = s.prototype.name;
|
|
812
812
|
this.transports.push(r), this._transportsByName[r] = s;
|
|
813
813
|
}), this.opts = Object.assign({
|
|
@@ -824,13 +824,13 @@ class de extends O {
|
|
|
824
824
|
},
|
|
825
825
|
transportOptions: {},
|
|
826
826
|
closeOnBeforeunload: !1
|
|
827
|
-
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query =
|
|
827
|
+
}, t), this.opts.path = this.opts.path.replace(/\/$/, "") + (this.opts.addTrailingSlash ? "/" : ""), typeof this.opts.query == "string" && (this.opts.query = Rn(this.opts.query)), xt && (this.opts.closeOnBeforeunload && (this._beforeunloadEventListener = () => {
|
|
828
828
|
this.transport && (this.transport.removeAllListeners(), this.transport.close());
|
|
829
829
|
}, addEventListener("beforeunload", this._beforeunloadEventListener, !1)), this.hostname !== "localhost" && (this._offlineEventListener = () => {
|
|
830
830
|
this._onClose("transport close", {
|
|
831
831
|
description: "network connection lost"
|
|
832
832
|
});
|
|
833
|
-
},
|
|
833
|
+
}, dt.push(this._offlineEventListener))), this.opts.withCredentials && (this._cookieJar = void 0), this._open();
|
|
834
834
|
}
|
|
835
835
|
/**
|
|
836
836
|
* Creates transport of the given type.
|
|
@@ -841,7 +841,7 @@ class de extends O {
|
|
|
841
841
|
*/
|
|
842
842
|
createTransport(e) {
|
|
843
843
|
const t = Object.assign({}, this.opts.query);
|
|
844
|
-
t.EIO =
|
|
844
|
+
t.EIO = Ps, t.transport = e, this.id && (t.sid = this.id);
|
|
845
845
|
const s = Object.assign({}, this.opts, {
|
|
846
846
|
query: t,
|
|
847
847
|
socket: this,
|
|
@@ -863,7 +863,7 @@ class de extends O {
|
|
|
863
863
|
}, 0);
|
|
864
864
|
return;
|
|
865
865
|
}
|
|
866
|
-
const e = this.opts.rememberUpgrade &&
|
|
866
|
+
const e = this.opts.rememberUpgrade && ge.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 de extends O {
|
|
|
882
882
|
* @private
|
|
883
883
|
*/
|
|
884
884
|
onOpen() {
|
|
885
|
-
this.readyState = "open",
|
|
885
|
+
this.readyState = "open", ge.priorWebsocketSuccess = this.transport.name === "websocket", this.emitReserved("open"), this.flush();
|
|
886
886
|
}
|
|
887
887
|
/**
|
|
888
888
|
* Handles a packet.
|
|
@@ -959,7 +959,7 @@ class de extends O {
|
|
|
959
959
|
let t = 1;
|
|
960
960
|
for (let s = 0; s < this.writeBuffer.length; s++) {
|
|
961
961
|
const r = this.writeBuffer[s].data;
|
|
962
|
-
if (r && (t +=
|
|
962
|
+
if (r && (t += kn(r)), s > 0 && t > this._maxPayload)
|
|
963
963
|
return this.writeBuffer.slice(0, s);
|
|
964
964
|
t += 2;
|
|
965
965
|
}
|
|
@@ -979,7 +979,7 @@ class de extends O {
|
|
|
979
979
|
if (!this._pingTimeoutTime)
|
|
980
980
|
return !0;
|
|
981
981
|
const e = Date.now() > this._pingTimeoutTime;
|
|
982
|
-
return e && (this._pingTimeoutTime = 0,
|
|
982
|
+
return e && (this._pingTimeoutTime = 0, vt(() => {
|
|
983
983
|
this._onClose("ping timeout");
|
|
984
984
|
}, this.setTimeoutFn)), e;
|
|
985
985
|
}
|
|
@@ -1046,7 +1046,7 @@ class de extends O {
|
|
|
1046
1046
|
* @private
|
|
1047
1047
|
*/
|
|
1048
1048
|
_onError(e) {
|
|
1049
|
-
if (
|
|
1049
|
+
if (ge.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
|
}
|
|
@@ -1057,16 +1057,16 @@ class de extends O {
|
|
|
1057
1057
|
*/
|
|
1058
1058
|
_onClose(e, t) {
|
|
1059
1059
|
if (this.readyState === "opening" || this.readyState === "open" || this.readyState === "closing") {
|
|
1060
|
-
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(),
|
|
1061
|
-
const s =
|
|
1062
|
-
s !== -1 &&
|
|
1060
|
+
if (this.clearTimeoutFn(this._pingTimeoutTimer), this.transport.removeAllListeners("close"), this.transport.close(), this.transport.removeAllListeners(), xt && (this._beforeunloadEventListener && removeEventListener("beforeunload", this._beforeunloadEventListener, !1), this._offlineEventListener)) {
|
|
1061
|
+
const s = dt.indexOf(this._offlineEventListener);
|
|
1062
|
+
s !== -1 && dt.splice(s, 1);
|
|
1063
1063
|
}
|
|
1064
1064
|
this.readyState = "closed", this.id = null, this.emitReserved("close", e, t), this.writeBuffer = [], this._prevBufferLen = 0;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
|
-
|
|
1069
|
-
class
|
|
1068
|
+
ge.protocol = Ps;
|
|
1069
|
+
class Gn extends ge {
|
|
1070
1070
|
constructor() {
|
|
1071
1071
|
super(...arguments), this._upgrades = [];
|
|
1072
1072
|
}
|
|
@@ -1083,19 +1083,19 @@ class Mn extends de {
|
|
|
1083
1083
|
*/
|
|
1084
1084
|
_probe(e) {
|
|
1085
1085
|
let t = this.createTransport(e), s = !1;
|
|
1086
|
-
|
|
1086
|
+
ge.priorWebsocketSuccess = !1;
|
|
1087
1087
|
const r = () => {
|
|
1088
1088
|
s || (t.send([{ type: "ping", data: "probe" }]), t.once("packet", (m) => {
|
|
1089
1089
|
if (!s)
|
|
1090
1090
|
if (m.type === "pong" && m.data === "probe") {
|
|
1091
1091
|
if (this.upgrading = !0, this.emitReserved("upgrading", t), !t)
|
|
1092
1092
|
return;
|
|
1093
|
-
|
|
1093
|
+
ge.priorWebsocketSuccess = t.name === "websocket", this.transport.pause(() => {
|
|
1094
1094
|
s || this.readyState !== "closed" && (c(), this.setTransport(t), t.send([{ type: "upgrade" }]), this.emitReserved("upgrade", t), t = null, this.upgrading = !1, this.flush());
|
|
1095
1095
|
});
|
|
1096
1096
|
} else {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1097
|
+
const T = new Error("probe error");
|
|
1098
|
+
T.transport = t.name, this.emitReserved("upgradeError", T);
|
|
1099
1099
|
}
|
|
1100
1100
|
}));
|
|
1101
1101
|
};
|
|
@@ -1103,8 +1103,8 @@ class Mn extends de {
|
|
|
1103
1103
|
s || (s = !0, c(), t.close(), t = null);
|
|
1104
1104
|
}
|
|
1105
1105
|
const o = (m) => {
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1106
|
+
const T = new Error("probe error: " + m);
|
|
1107
|
+
T.transport = t.name, i(), this.emitReserved("upgradeError", T);
|
|
1108
1108
|
};
|
|
1109
1109
|
function a() {
|
|
1110
1110
|
o("transport closed");
|
|
@@ -1112,13 +1112,13 @@ class Mn extends de {
|
|
|
1112
1112
|
function l() {
|
|
1113
1113
|
o("socket closed");
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function d(m) {
|
|
1116
1116
|
t && m.name !== t.name && i();
|
|
1117
1117
|
}
|
|
1118
1118
|
const c = () => {
|
|
1119
|
-
t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", a), this.off("close", l), this.off("upgrading",
|
|
1119
|
+
t.removeListener("open", r), t.removeListener("error", o), t.removeListener("close", a), this.off("close", l), this.off("upgrading", d);
|
|
1120
1120
|
};
|
|
1121
|
-
t.once("open", r), t.once("error", o), t.once("close", a), this.once("close", l), this.once("upgrading",
|
|
1121
|
+
t.once("open", r), t.once("error", o), t.once("close", a), this.once("close", l), this.once("upgrading", d), this._upgrades.indexOf("webtransport") !== -1 && e !== "webtransport" ? this.setTimeoutFn(() => {
|
|
1122
1122
|
s || t.open();
|
|
1123
1123
|
}, 200) : t.open();
|
|
1124
1124
|
}
|
|
@@ -1138,67 +1138,67 @@ class Mn extends de {
|
|
|
1138
1138
|
return t;
|
|
1139
1139
|
}
|
|
1140
1140
|
}
|
|
1141
|
-
let
|
|
1141
|
+
let Jn = class extends Gn {
|
|
1142
1142
|
constructor(e, t = {}) {
|
|
1143
1143
|
const s = typeof e == "object", r = s ? { ...e } : { ...t };
|
|
1144
|
-
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) =>
|
|
1144
|
+
(!r.transports || r.transports && typeof r.transports[0] == "string") && (r.transports = (r.transports || ["polling", "websocket", "webtransport"]).map((i) => jn[i]).filter((i) => !!i)), super(s ? r : e, r);
|
|
1145
1145
|
}
|
|
1146
1146
|
};
|
|
1147
|
-
function
|
|
1147
|
+
function Wn(n, e = "", t) {
|
|
1148
1148
|
let s = n;
|
|
1149
|
-
t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s =
|
|
1149
|
+
t = t || typeof location < "u" && location, n == null && (n = t.protocol + "//" + t.host), typeof n == "string" && (n.charAt(0) === "/" && (n.charAt(1) === "/" ? n = t.protocol + n : n = t.host + n), /^(https?|wss?):\/\//.test(n) || (typeof t < "u" ? n = t.protocol + "//" + n : n = "https://" + n), s = $t(n)), s.port || (/^(http|ws)$/.test(s.protocol) ? s.port = "80" : /^(http|ws)s$/.test(s.protocol) && (s.port = "443")), s.path = s.path || "/";
|
|
1150
1150
|
const i = s.host.indexOf(":") !== -1 ? "[" + s.host + "]" : s.host;
|
|
1151
1151
|
return s.id = s.protocol + "://" + i + ":" + s.port + e, s.href = s.protocol + "://" + i + (t && t.port === s.port ? "" : ":" + s.port), s;
|
|
1152
1152
|
}
|
|
1153
|
-
const
|
|
1154
|
-
function
|
|
1155
|
-
return
|
|
1153
|
+
const Yn = typeof ArrayBuffer == "function", zn = (n) => typeof ArrayBuffer.isView == "function" ? ArrayBuffer.isView(n) : n.buffer instanceof ArrayBuffer, js = Object.prototype.toString, Kn = typeof Blob == "function" || typeof Blob < "u" && js.call(Blob) === "[object BlobConstructor]", Xn = typeof File == "function" || typeof File < "u" && js.call(File) === "[object FileConstructor]";
|
|
1154
|
+
function ss(n) {
|
|
1155
|
+
return Yn && (n instanceof ArrayBuffer || zn(n)) || Kn && n instanceof Blob || Xn && n instanceof File;
|
|
1156
1156
|
}
|
|
1157
|
-
function
|
|
1157
|
+
function ut(n, e) {
|
|
1158
1158
|
if (!n || typeof n != "object")
|
|
1159
1159
|
return !1;
|
|
1160
1160
|
if (Array.isArray(n)) {
|
|
1161
1161
|
for (let t = 0, s = n.length; t < s; t++)
|
|
1162
|
-
if (
|
|
1162
|
+
if (ut(n[t]))
|
|
1163
1163
|
return !0;
|
|
1164
1164
|
return !1;
|
|
1165
1165
|
}
|
|
1166
|
-
if (
|
|
1166
|
+
if (ss(n))
|
|
1167
1167
|
return !0;
|
|
1168
1168
|
if (n.toJSON && typeof n.toJSON == "function" && arguments.length === 1)
|
|
1169
|
-
return
|
|
1169
|
+
return ut(n.toJSON(), !0);
|
|
1170
1170
|
for (const t in n)
|
|
1171
|
-
if (Object.prototype.hasOwnProperty.call(n, t) &&
|
|
1171
|
+
if (Object.prototype.hasOwnProperty.call(n, t) && ut(n[t]))
|
|
1172
1172
|
return !0;
|
|
1173
1173
|
return !1;
|
|
1174
1174
|
}
|
|
1175
|
-
function
|
|
1175
|
+
function Qn(n) {
|
|
1176
1176
|
const e = [], t = n.data, s = n;
|
|
1177
|
-
return s.data =
|
|
1177
|
+
return s.data = Nt(t, e), s.attachments = e.length, { packet: s, buffers: e };
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function Nt(n, e) {
|
|
1180
1180
|
if (!n)
|
|
1181
1181
|
return n;
|
|
1182
|
-
if (
|
|
1182
|
+
if (ss(n)) {
|
|
1183
1183
|
const t = { _placeholder: !0, num: e.length };
|
|
1184
1184
|
return e.push(n), t;
|
|
1185
1185
|
} else if (Array.isArray(n)) {
|
|
1186
1186
|
const t = new Array(n.length);
|
|
1187
1187
|
for (let s = 0; s < n.length; s++)
|
|
1188
|
-
t[s] =
|
|
1188
|
+
t[s] = Nt(n[s], e);
|
|
1189
1189
|
return t;
|
|
1190
1190
|
} else if (typeof n == "object" && !(n instanceof Date)) {
|
|
1191
1191
|
const t = {};
|
|
1192
1192
|
for (const s in n)
|
|
1193
|
-
Object.prototype.hasOwnProperty.call(n, s) && (t[s] =
|
|
1193
|
+
Object.prototype.hasOwnProperty.call(n, s) && (t[s] = Nt(n[s], e));
|
|
1194
1194
|
return t;
|
|
1195
1195
|
}
|
|
1196
1196
|
return n;
|
|
1197
1197
|
}
|
|
1198
|
-
function
|
|
1199
|
-
return n.data =
|
|
1198
|
+
function Zn(n, e) {
|
|
1199
|
+
return n.data = Pt(n.data, e), delete n.attachments, n;
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function Pt(n, e) {
|
|
1202
1202
|
if (!n)
|
|
1203
1203
|
return n;
|
|
1204
1204
|
if (n && n._placeholder === !0) {
|
|
@@ -1207,13 +1207,13 @@ function ft(n, e) {
|
|
|
1207
1207
|
throw new Error("illegal attachments");
|
|
1208
1208
|
} else if (Array.isArray(n))
|
|
1209
1209
|
for (let t = 0; t < n.length; t++)
|
|
1210
|
-
n[t] =
|
|
1210
|
+
n[t] = Pt(n[t], e);
|
|
1211
1211
|
else if (typeof n == "object")
|
|
1212
1212
|
for (const t in n)
|
|
1213
|
-
Object.prototype.hasOwnProperty.call(n, t) && (n[t] =
|
|
1213
|
+
Object.prototype.hasOwnProperty.call(n, t) && (n[t] = Pt(n[t], e));
|
|
1214
1214
|
return n;
|
|
1215
1215
|
}
|
|
1216
|
-
const
|
|
1216
|
+
const er = [
|
|
1217
1217
|
"connect",
|
|
1218
1218
|
// used on the client side
|
|
1219
1219
|
"connect_error",
|
|
@@ -1227,11 +1227,11 @@ const Xn = [
|
|
|
1227
1227
|
"removeListener"
|
|
1228
1228
|
// used by the Node.js EventEmitter
|
|
1229
1229
|
];
|
|
1230
|
-
var
|
|
1230
|
+
var v;
|
|
1231
1231
|
(function(n) {
|
|
1232
1232
|
n[n.CONNECT = 0] = "CONNECT", n[n.DISCONNECT = 1] = "DISCONNECT", n[n.EVENT = 2] = "EVENT", n[n.ACK = 3] = "ACK", n[n.CONNECT_ERROR = 4] = "CONNECT_ERROR", n[n.BINARY_EVENT = 5] = "BINARY_EVENT", n[n.BINARY_ACK = 6] = "BINARY_ACK";
|
|
1233
|
-
})(
|
|
1234
|
-
class
|
|
1233
|
+
})(v || (v = {}));
|
|
1234
|
+
class tr {
|
|
1235
1235
|
/**
|
|
1236
1236
|
* Encoder constructor
|
|
1237
1237
|
*
|
|
@@ -1247,8 +1247,8 @@ class Qn {
|
|
|
1247
1247
|
* @param {Object} obj - packet object
|
|
1248
1248
|
*/
|
|
1249
1249
|
encode(e) {
|
|
1250
|
-
return (e.type ===
|
|
1251
|
-
type: e.type ===
|
|
1250
|
+
return (e.type === v.EVENT || e.type === v.ACK) && ut(e) ? this.encodeAsBinary({
|
|
1251
|
+
type: e.type === v.EVENT ? v.BINARY_EVENT : v.BINARY_ACK,
|
|
1252
1252
|
nsp: e.nsp,
|
|
1253
1253
|
data: e.data,
|
|
1254
1254
|
id: e.id
|
|
@@ -1259,7 +1259,7 @@ class Qn {
|
|
|
1259
1259
|
*/
|
|
1260
1260
|
encodeAsString(e) {
|
|
1261
1261
|
let t = "" + e.type;
|
|
1262
|
-
return (e.type ===
|
|
1262
|
+
return (e.type === v.BINARY_EVENT || e.type === v.BINARY_ACK) && (t += e.attachments + "-"), e.nsp && e.nsp !== "/" && (t += e.nsp + ","), e.id != null && (t += e.id), e.data != null && (t += JSON.stringify(e.data, this.replacer)), t;
|
|
1263
1263
|
}
|
|
1264
1264
|
/**
|
|
1265
1265
|
* Encode packet as 'buffer sequence' by removing blobs, and
|
|
@@ -1267,11 +1267,11 @@ class Qn {
|
|
|
1267
1267
|
* a list of buffers.
|
|
1268
1268
|
*/
|
|
1269
1269
|
encodeAsBinary(e) {
|
|
1270
|
-
const t =
|
|
1270
|
+
const t = Qn(e), s = this.encodeAsString(t.packet), r = t.buffers;
|
|
1271
1271
|
return r.unshift(s), r;
|
|
1272
1272
|
}
|
|
1273
1273
|
}
|
|
1274
|
-
class
|
|
1274
|
+
class ns extends C {
|
|
1275
1275
|
/**
|
|
1276
1276
|
* Decoder constructor
|
|
1277
1277
|
*/
|
|
@@ -1292,9 +1292,9 @@ class Ft extends O {
|
|
|
1292
1292
|
if (this.reconstructor)
|
|
1293
1293
|
throw new Error("got plaintext data when reconstructing a packet");
|
|
1294
1294
|
t = this.decodeString(e);
|
|
1295
|
-
const s = t.type ===
|
|
1296
|
-
s || t.type ===
|
|
1297
|
-
} else if (
|
|
1295
|
+
const s = t.type === v.BINARY_EVENT;
|
|
1296
|
+
s || t.type === v.BINARY_ACK ? (t.type = s ? v.EVENT : v.ACK, this.reconstructor = new sr(t), t.attachments === 0 && super.emitReserved("decoded", t)) : super.emitReserved("decoded", t);
|
|
1297
|
+
} else if (ss(e) || e.base64)
|
|
1298
1298
|
if (this.reconstructor)
|
|
1299
1299
|
t = this.reconstructor.takeBinaryData(e), t && (this.reconstructor = null, super.emitReserved("decoded", t));
|
|
1300
1300
|
else
|
|
@@ -1313,9 +1313,9 @@ class Ft extends O {
|
|
|
1313
1313
|
const s = {
|
|
1314
1314
|
type: Number(e.charAt(0))
|
|
1315
1315
|
};
|
|
1316
|
-
if (
|
|
1316
|
+
if (v[s.type] === void 0)
|
|
1317
1317
|
throw new Error("unknown packet type " + s.type);
|
|
1318
|
-
if (s.type ===
|
|
1318
|
+
if (s.type === v.BINARY_EVENT || s.type === v.BINARY_ACK) {
|
|
1319
1319
|
const i = t + 1;
|
|
1320
1320
|
for (; e.charAt(++t) !== "-" && t != e.length; )
|
|
1321
1321
|
;
|
|
@@ -1323,7 +1323,7 @@ class Ft extends O {
|
|
|
1323
1323
|
if (o != Number(o) || e.charAt(t) !== "-")
|
|
1324
1324
|
throw new Error("Illegal attachments");
|
|
1325
1325
|
const a = Number(o);
|
|
1326
|
-
if (!
|
|
1326
|
+
if (!nr(a) || a < 0)
|
|
1327
1327
|
throw new Error("Illegal attachments");
|
|
1328
1328
|
if (a > this.opts.maxAttachments)
|
|
1329
1329
|
throw new Error("too many attachments");
|
|
@@ -1352,7 +1352,7 @@ class Ft extends O {
|
|
|
1352
1352
|
}
|
|
1353
1353
|
if (e.charAt(++t)) {
|
|
1354
1354
|
const i = this.tryParse(e.substr(t));
|
|
1355
|
-
if (
|
|
1355
|
+
if (ns.isPayloadValid(s.type, i))
|
|
1356
1356
|
s.data = i;
|
|
1357
1357
|
else
|
|
1358
1358
|
throw new Error("invalid payload");
|
|
@@ -1368,17 +1368,17 @@ class Ft extends O {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
static isPayloadValid(e, t) {
|
|
1370
1370
|
switch (e) {
|
|
1371
|
-
case
|
|
1372
|
-
return
|
|
1373
|
-
case
|
|
1371
|
+
case v.CONNECT:
|
|
1372
|
+
return us(t);
|
|
1373
|
+
case v.DISCONNECT:
|
|
1374
1374
|
return t === void 0;
|
|
1375
|
-
case
|
|
1376
|
-
return typeof t == "string" ||
|
|
1377
|
-
case
|
|
1378
|
-
case
|
|
1379
|
-
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" &&
|
|
1380
|
-
case
|
|
1381
|
-
case
|
|
1375
|
+
case v.CONNECT_ERROR:
|
|
1376
|
+
return typeof t == "string" || us(t);
|
|
1377
|
+
case v.EVENT:
|
|
1378
|
+
case v.BINARY_EVENT:
|
|
1379
|
+
return Array.isArray(t) && (typeof t[0] == "number" || typeof t[0] == "string" && er.indexOf(t[0]) === -1);
|
|
1380
|
+
case v.ACK:
|
|
1381
|
+
case v.BINARY_ACK:
|
|
1382
1382
|
return Array.isArray(t);
|
|
1383
1383
|
}
|
|
1384
1384
|
}
|
|
@@ -1389,7 +1389,7 @@ class Ft extends O {
|
|
|
1389
1389
|
this.reconstructor && (this.reconstructor.finishedReconstruction(), this.reconstructor = null);
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
|
-
class
|
|
1392
|
+
class sr {
|
|
1393
1393
|
constructor(e) {
|
|
1394
1394
|
this.packet = e, this.buffers = [], this.reconPack = e;
|
|
1395
1395
|
}
|
|
@@ -1403,7 +1403,7 @@ class Zn {
|
|
|
1403
1403
|
*/
|
|
1404
1404
|
takeBinaryData(e) {
|
|
1405
1405
|
if (this.buffers.push(e), this.buffers.length === this.reconPack.attachments) {
|
|
1406
|
-
const t =
|
|
1406
|
+
const t = Zn(this.reconPack, this.buffers);
|
|
1407
1407
|
return this.finishedReconstruction(), t;
|
|
1408
1408
|
}
|
|
1409
1409
|
return null;
|
|
@@ -1415,26 +1415,26 @@ class Zn {
|
|
|
1415
1415
|
this.reconPack = null, this.buffers = [];
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
|
-
const
|
|
1418
|
+
const nr = Number.isInteger || function(n) {
|
|
1419
1419
|
return typeof n == "number" && isFinite(n) && Math.floor(n) === n;
|
|
1420
1420
|
};
|
|
1421
|
-
function
|
|
1421
|
+
function us(n) {
|
|
1422
1422
|
return Object.prototype.toString.call(n) === "[object Object]";
|
|
1423
1423
|
}
|
|
1424
|
-
const
|
|
1424
|
+
const rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1425
1425
|
__proto__: null,
|
|
1426
|
-
Decoder:
|
|
1427
|
-
Encoder:
|
|
1426
|
+
Decoder: ns,
|
|
1427
|
+
Encoder: tr,
|
|
1428
1428
|
get PacketType() {
|
|
1429
|
-
return
|
|
1429
|
+
return v;
|
|
1430
1430
|
}
|
|
1431
1431
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1432
|
-
function
|
|
1432
|
+
function Y(n, e, t) {
|
|
1433
1433
|
return n.on(e, t), function() {
|
|
1434
1434
|
n.off(e, t);
|
|
1435
1435
|
};
|
|
1436
1436
|
}
|
|
1437
|
-
const
|
|
1437
|
+
const ir = Object.freeze({
|
|
1438
1438
|
connect: 1,
|
|
1439
1439
|
connect_error: 1,
|
|
1440
1440
|
disconnect: 1,
|
|
@@ -1443,7 +1443,7 @@ const sr = Object.freeze({
|
|
|
1443
1443
|
newListener: 1,
|
|
1444
1444
|
removeListener: 1
|
|
1445
1445
|
});
|
|
1446
|
-
class
|
|
1446
|
+
class Us extends C {
|
|
1447
1447
|
/**
|
|
1448
1448
|
* `Socket` constructor.
|
|
1449
1449
|
*/
|
|
@@ -1477,10 +1477,10 @@ class Ss extends O {
|
|
|
1477
1477
|
return;
|
|
1478
1478
|
const e = this.io;
|
|
1479
1479
|
this.subs = [
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1480
|
+
Y(e, "open", this.onopen.bind(this)),
|
|
1481
|
+
Y(e, "packet", this.onpacket.bind(this)),
|
|
1482
|
+
Y(e, "error", this.onerror.bind(this)),
|
|
1483
|
+
Y(e, "close", this.onclose.bind(this))
|
|
1484
1484
|
];
|
|
1485
1485
|
}
|
|
1486
1486
|
/**
|
|
@@ -1559,12 +1559,12 @@ class Ss extends O {
|
|
|
1559
1559
|
*/
|
|
1560
1560
|
emit(e, ...t) {
|
|
1561
1561
|
var s, r, i;
|
|
1562
|
-
if (
|
|
1562
|
+
if (ir.hasOwnProperty(e))
|
|
1563
1563
|
throw new Error('"' + e.toString() + '" is a reserved event name');
|
|
1564
1564
|
if (t.unshift(e), this._opts.retries && !this.flags.fromQueue && !this.flags.volatile)
|
|
1565
1565
|
return this._addToQueue(t), this;
|
|
1566
1566
|
const o = {
|
|
1567
|
-
type:
|
|
1567
|
+
type: v.EVENT,
|
|
1568
1568
|
data: t
|
|
1569
1569
|
};
|
|
1570
1570
|
if (o.options = {}, o.options.compress = this.flags.compress !== !1, typeof t[t.length - 1] == "function") {
|
|
@@ -1672,7 +1672,7 @@ class Ss extends O {
|
|
|
1672
1672
|
*/
|
|
1673
1673
|
_sendConnectPacket(e) {
|
|
1674
1674
|
this.packet({
|
|
1675
|
-
type:
|
|
1675
|
+
type: v.CONNECT,
|
|
1676
1676
|
data: this._pid ? Object.assign({ pid: this._pid, offset: this._lastOffset }, e) : e
|
|
1677
1677
|
});
|
|
1678
1678
|
}
|
|
@@ -1718,21 +1718,21 @@ class Ss extends O {
|
|
|
1718
1718
|
onpacket(e) {
|
|
1719
1719
|
if (e.nsp === this.nsp)
|
|
1720
1720
|
switch (e.type) {
|
|
1721
|
-
case
|
|
1721
|
+
case v.CONNECT:
|
|
1722
1722
|
e.data && e.data.sid ? this.onconnect(e.data.sid, e.data.pid) : this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
|
|
1723
1723
|
break;
|
|
1724
|
-
case
|
|
1725
|
-
case
|
|
1724
|
+
case v.EVENT:
|
|
1725
|
+
case v.BINARY_EVENT:
|
|
1726
1726
|
this.onevent(e);
|
|
1727
1727
|
break;
|
|
1728
|
-
case
|
|
1729
|
-
case
|
|
1728
|
+
case v.ACK:
|
|
1729
|
+
case v.BINARY_ACK:
|
|
1730
1730
|
this.onack(e);
|
|
1731
1731
|
break;
|
|
1732
|
-
case
|
|
1732
|
+
case v.DISCONNECT:
|
|
1733
1733
|
this.ondisconnect();
|
|
1734
1734
|
break;
|
|
1735
|
-
case
|
|
1735
|
+
case v.CONNECT_ERROR:
|
|
1736
1736
|
this.destroy();
|
|
1737
1737
|
const s = new Error(e.data.message);
|
|
1738
1738
|
s.data = e.data.data, this.emitReserved("connect_error", s);
|
|
@@ -1767,7 +1767,7 @@ class Ss extends O {
|
|
|
1767
1767
|
let s = !1;
|
|
1768
1768
|
return function(...r) {
|
|
1769
1769
|
s || (s = !0, t.packet({
|
|
1770
|
-
type:
|
|
1770
|
+
type: v.ACK,
|
|
1771
1771
|
id: e,
|
|
1772
1772
|
data: r
|
|
1773
1773
|
}));
|
|
@@ -1836,7 +1836,7 @@ class Ss extends O {
|
|
|
1836
1836
|
* @return self
|
|
1837
1837
|
*/
|
|
1838
1838
|
disconnect() {
|
|
1839
|
-
return this.connected && this.packet({ type:
|
|
1839
|
+
return this.connected && this.packet({ type: v.DISCONNECT }), this.destroy(), this.connected && this.onclose("io client disconnect"), this;
|
|
1840
1840
|
}
|
|
1841
1841
|
/**
|
|
1842
1842
|
* Alias for {@link disconnect()}.
|
|
@@ -2035,10 +2035,10 @@ class Ss extends O {
|
|
|
2035
2035
|
}
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
-
function
|
|
2038
|
+
function Fe(n) {
|
|
2039
2039
|
n = n || {}, this.ms = n.min || 100, this.max = n.max || 1e4, this.factor = n.factor || 2, this.jitter = n.jitter > 0 && n.jitter <= 1 ? n.jitter : 0, this.attempts = 0;
|
|
2040
2040
|
}
|
|
2041
|
-
|
|
2041
|
+
Fe.prototype.duration = function() {
|
|
2042
2042
|
var n = this.ms * Math.pow(this.factor, this.attempts++);
|
|
2043
2043
|
if (this.jitter) {
|
|
2044
2044
|
var e = Math.random(), t = Math.floor(e * this.jitter * n);
|
|
@@ -2046,27 +2046,27 @@ ke.prototype.duration = function() {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
return Math.min(n, this.max) | 0;
|
|
2048
2048
|
};
|
|
2049
|
-
|
|
2049
|
+
Fe.prototype.reset = function() {
|
|
2050
2050
|
this.attempts = 0;
|
|
2051
2051
|
};
|
|
2052
|
-
|
|
2052
|
+
Fe.prototype.setMin = function(n) {
|
|
2053
2053
|
this.ms = n;
|
|
2054
2054
|
};
|
|
2055
|
-
|
|
2055
|
+
Fe.prototype.setMax = function(n) {
|
|
2056
2056
|
this.max = n;
|
|
2057
2057
|
};
|
|
2058
|
-
|
|
2058
|
+
Fe.prototype.setJitter = function(n) {
|
|
2059
2059
|
this.jitter = n;
|
|
2060
2060
|
};
|
|
2061
|
-
class
|
|
2061
|
+
class Bt extends C {
|
|
2062
2062
|
constructor(e, t) {
|
|
2063
2063
|
var s;
|
|
2064
|
-
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t,
|
|
2064
|
+
super(), this.nsps = {}, this.subs = [], e && typeof e == "object" && (t = e, e = void 0), t = t || {}, t.path = t.path || "/socket.io", this.opts = t, Et(this, t), this.reconnection(t.reconnection !== !1), this.reconnectionAttempts(t.reconnectionAttempts || 1 / 0), this.reconnectionDelay(t.reconnectionDelay || 1e3), this.reconnectionDelayMax(t.reconnectionDelayMax || 5e3), this.randomizationFactor((s = t.randomizationFactor) !== null && s !== void 0 ? s : 0.5), this.backoff = new Fe({
|
|
2065
2065
|
min: this.reconnectionDelay(),
|
|
2066
2066
|
max: this.reconnectionDelayMax(),
|
|
2067
2067
|
jitter: this.randomizationFactor()
|
|
2068
2068
|
}), this.timeout(t.timeout == null ? 2e4 : t.timeout), this._readyState = "closed", this.uri = e;
|
|
2069
|
-
const r = t.parser ||
|
|
2069
|
+
const r = t.parser || rr;
|
|
2070
2070
|
this.encoder = new r.Encoder(), this.decoder = new r.Decoder(), this._autoConnect = t.autoConnect !== !1, this._autoConnect && this.open();
|
|
2071
2071
|
}
|
|
2072
2072
|
reconnection(e) {
|
|
@@ -2109,14 +2109,14 @@ class pt extends O {
|
|
|
2109
2109
|
open(e) {
|
|
2110
2110
|
if (~this._readyState.indexOf("open"))
|
|
2111
2111
|
return this;
|
|
2112
|
-
this.engine = new
|
|
2112
|
+
this.engine = new Jn(this.uri, this.opts);
|
|
2113
2113
|
const t = this.engine, s = this;
|
|
2114
2114
|
this._readyState = "opening", this.skipReconnect = !1;
|
|
2115
|
-
const r =
|
|
2115
|
+
const r = Y(t, "open", function() {
|
|
2116
2116
|
s.onopen(), e && e();
|
|
2117
2117
|
}), i = (a) => {
|
|
2118
2118
|
this.cleanup(), this._readyState = "closed", this.emitReserved("error", a), e ? e(a) : this.maybeReconnectOnOpen();
|
|
2119
|
-
}, o =
|
|
2119
|
+
}, o = Y(t, "error", i);
|
|
2120
2120
|
if (this._timeout !== !1) {
|
|
2121
2121
|
const a = this._timeout, l = this.setTimeoutFn(() => {
|
|
2122
2122
|
r(), i(new Error("timeout")), t.close();
|
|
@@ -2145,12 +2145,12 @@ class pt extends O {
|
|
|
2145
2145
|
this.cleanup(), this._readyState = "open", this.emitReserved("open");
|
|
2146
2146
|
const e = this.engine;
|
|
2147
2147
|
this.subs.push(
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2148
|
+
Y(e, "ping", this.onping.bind(this)),
|
|
2149
|
+
Y(e, "data", this.ondata.bind(this)),
|
|
2150
|
+
Y(e, "error", this.onerror.bind(this)),
|
|
2151
|
+
Y(e, "close", this.onclose.bind(this)),
|
|
2152
2152
|
// @ts-ignore
|
|
2153
|
-
|
|
2153
|
+
Y(this.decoder, "decoded", this.ondecoded.bind(this))
|
|
2154
2154
|
);
|
|
2155
2155
|
}
|
|
2156
2156
|
/**
|
|
@@ -2179,7 +2179,7 @@ class pt extends O {
|
|
|
2179
2179
|
* @private
|
|
2180
2180
|
*/
|
|
2181
2181
|
ondecoded(e) {
|
|
2182
|
-
|
|
2182
|
+
vt(() => {
|
|
2183
2183
|
this.emitReserved("packet", e);
|
|
2184
2184
|
}, this.setTimeoutFn);
|
|
2185
2185
|
}
|
|
@@ -2199,7 +2199,7 @@ class pt extends O {
|
|
|
2199
2199
|
*/
|
|
2200
2200
|
socket(e, t) {
|
|
2201
2201
|
let s = this.nsps[e];
|
|
2202
|
-
return s ? this._autoConnect && !s.active && s.connect() : (s = new
|
|
2202
|
+
return s ? this._autoConnect && !s.active && s.connect() : (s = new Us(this, e, t), this.nsps[e] = s), s;
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* Called upon a socket close.
|
|
@@ -2296,20 +2296,20 @@ class pt extends O {
|
|
|
2296
2296
|
this._reconnecting = !1, this.backoff.reset(), this.emitReserved("reconnect", e);
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
|
-
const
|
|
2300
|
-
function
|
|
2299
|
+
const Ge = {};
|
|
2300
|
+
function Ke(n, e) {
|
|
2301
2301
|
typeof n == "object" && (e = n, n = void 0), e = e || {};
|
|
2302
|
-
const t =
|
|
2302
|
+
const t = Wn(n, e.path || "/socket.io"), s = t.source, r = t.id, i = t.path, o = Ge[r] && i in Ge[r].nsps, a = e.forceNew || e["force new connection"] || e.multiplex === !1 || o;
|
|
2303
2303
|
let l;
|
|
2304
|
-
return a ? l = new
|
|
2304
|
+
return a ? l = new Bt(s, e) : (Ge[r] || (Ge[r] = new Bt(s, e)), l = Ge[r]), t.query && !e.query && (e.query = t.queryKey), l.socket(t.path, e);
|
|
2305
2305
|
}
|
|
2306
|
-
Object.assign(
|
|
2307
|
-
Manager:
|
|
2308
|
-
Socket:
|
|
2309
|
-
io:
|
|
2310
|
-
connect:
|
|
2306
|
+
Object.assign(Ke, {
|
|
2307
|
+
Manager: Bt,
|
|
2308
|
+
Socket: Us,
|
|
2309
|
+
io: Ke,
|
|
2310
|
+
connect: Ke
|
|
2311
2311
|
});
|
|
2312
|
-
const
|
|
2312
|
+
const bt = "thatopen/document@1", fs = "document.json", or = [
|
|
2313
2313
|
"pdf",
|
|
2314
2314
|
"txt",
|
|
2315
2315
|
"md",
|
|
@@ -2317,14 +2317,14 @@ const Xe = "thatopen/document@1", zt = "document.json", nr = [
|
|
|
2317
2317
|
"csv",
|
|
2318
2318
|
"tsv",
|
|
2319
2319
|
"frag"
|
|
2320
|
-
],
|
|
2321
|
-
function
|
|
2320
|
+
], ps = () => `v-${Date.now()}`;
|
|
2321
|
+
function at(n) {
|
|
2322
2322
|
return String(n._id ?? n.id ?? "");
|
|
2323
2323
|
}
|
|
2324
|
-
var
|
|
2325
|
-
class
|
|
2324
|
+
var ke, Vs, Lt;
|
|
2325
|
+
class Ms {
|
|
2326
2326
|
constructor(e, t) {
|
|
2327
|
-
|
|
2327
|
+
S(this, ke);
|
|
2328
2328
|
this.client = e, this.projectId = t;
|
|
2329
2329
|
}
|
|
2330
2330
|
/**
|
|
@@ -2339,7 +2339,7 @@ class ks {
|
|
|
2339
2339
|
});
|
|
2340
2340
|
return (await Promise.all(
|
|
2341
2341
|
e.map(async (s) => {
|
|
2342
|
-
const r =
|
|
2342
|
+
const r = at(s), i = await this.descriptor(r);
|
|
2343
2343
|
return i ? { folderId: r, descriptor: i } : null;
|
|
2344
2344
|
})
|
|
2345
2345
|
)).filter((s) => s !== null);
|
|
@@ -2357,37 +2357,37 @@ class ks {
|
|
|
2357
2357
|
* document is born ready to visualize and the link concept retires.
|
|
2358
2358
|
*/
|
|
2359
2359
|
async fromFile(e, t) {
|
|
2360
|
-
const s = await this.client.getFile(e), r = String(s.name ?? ""), i =
|
|
2360
|
+
const s = await this.client.getFile(e), r = String(s.name ?? ""), i = ms(r, s.fileExtension), o = (t == null ? void 0 : t.name) ?? r.replace(/\.[^.]+$/, "") ?? r, a = await this.client.createFolder(
|
|
2361
2361
|
o,
|
|
2362
2362
|
s.folderId ? String(s.folderId) : void 0,
|
|
2363
2363
|
this.projectId
|
|
2364
|
-
), l =
|
|
2364
|
+
), l = at(a);
|
|
2365
2365
|
await this.client.updateFile(e, { parentFolderId: l });
|
|
2366
|
-
const
|
|
2366
|
+
const d = [], c = await h(this, ke, Vs).call(this, s);
|
|
2367
2367
|
if (c)
|
|
2368
2368
|
try {
|
|
2369
|
-
const
|
|
2370
|
-
await this.client.updateFile(c, { parentFolderId: l }),
|
|
2369
|
+
const A = await this.client.getFile(c);
|
|
2370
|
+
await this.client.updateFile(c, { parentFolderId: l }), d.push({
|
|
2371
2371
|
fileId: c,
|
|
2372
|
-
format:
|
|
2372
|
+
format: ms(String(A.name ?? ""), A.fileExtension)
|
|
2373
2373
|
});
|
|
2374
2374
|
} catch {
|
|
2375
2375
|
}
|
|
2376
|
-
((t == null ? void 0 : t.selfView) ??
|
|
2377
|
-
const
|
|
2378
|
-
schema:
|
|
2376
|
+
((t == null ? void 0 : t.selfView) ?? or.includes(i)) && d.push({ fileId: e, format: i });
|
|
2377
|
+
const T = {
|
|
2378
|
+
schema: bt,
|
|
2379
2379
|
name: o,
|
|
2380
2380
|
native: { fileId: e, format: i },
|
|
2381
|
-
views:
|
|
2381
|
+
views: d
|
|
2382
2382
|
};
|
|
2383
|
-
return await this.setDescriptor(l,
|
|
2383
|
+
return await this.setDescriptor(l, T), { folderId: l, descriptor: T };
|
|
2384
2384
|
}
|
|
2385
2385
|
/**
|
|
2386
2386
|
* The document's descriptor, read and validated, or null when the folder
|
|
2387
2387
|
* has none yet (an old folder, or a plain folder that is not a document).
|
|
2388
2388
|
*/
|
|
2389
2389
|
async descriptor(e) {
|
|
2390
|
-
const t = await h(this,
|
|
2390
|
+
const t = await h(this, ke, Lt).call(this, e);
|
|
2391
2391
|
if (!t) return null;
|
|
2392
2392
|
const r = await (await this.client.downloadFile(t.id)).text();
|
|
2393
2393
|
if (!r.trim()) return null;
|
|
@@ -2397,7 +2397,7 @@ class ks {
|
|
|
2397
2397
|
} catch {
|
|
2398
2398
|
return null;
|
|
2399
2399
|
}
|
|
2400
|
-
return
|
|
2400
|
+
return ar(i);
|
|
2401
2401
|
}
|
|
2402
2402
|
/**
|
|
2403
2403
|
* The first view whose format appears in `formats` — searched in the ORDER
|
|
@@ -2435,110 +2435,110 @@ class ks {
|
|
|
2435
2435
|
async setDescriptor(e, t) {
|
|
2436
2436
|
const s = {
|
|
2437
2437
|
...t,
|
|
2438
|
-
schema:
|
|
2438
|
+
schema: bt,
|
|
2439
2439
|
views: t.views ?? []
|
|
2440
2440
|
}, r = new Blob([JSON.stringify(s)], {
|
|
2441
2441
|
type: "application/json"
|
|
2442
|
-
}), i = await h(this,
|
|
2442
|
+
}), i = await h(this, ke, Lt).call(this, e);
|
|
2443
2443
|
if (i) {
|
|
2444
2444
|
await this.client.updateFile(i.id, {
|
|
2445
2445
|
file: r,
|
|
2446
|
-
versionTag:
|
|
2446
|
+
versionTag: ps()
|
|
2447
2447
|
});
|
|
2448
2448
|
return;
|
|
2449
2449
|
}
|
|
2450
2450
|
await this.client.createFile({
|
|
2451
2451
|
file: r,
|
|
2452
|
-
name:
|
|
2453
|
-
versionTag:
|
|
2452
|
+
name: fs,
|
|
2453
|
+
versionTag: ps(),
|
|
2454
2454
|
parentFolderId: e,
|
|
2455
2455
|
projectId: this.projectId
|
|
2456
2456
|
});
|
|
2457
2457
|
}
|
|
2458
2458
|
}
|
|
2459
|
-
|
|
2459
|
+
ke = new WeakSet(), Vs = async function(e) {
|
|
2460
2460
|
const t = [...e.versions ?? []].sort(
|
|
2461
2461
|
(s, r) => String(r.createdAt ?? "").localeCompare(String(s.createdAt ?? ""))
|
|
2462
2462
|
);
|
|
2463
2463
|
for (const s of t)
|
|
2464
2464
|
try {
|
|
2465
2465
|
const r = await this.client.getFileVersionMetadata(
|
|
2466
|
-
|
|
2466
|
+
at(e),
|
|
2467
2467
|
s.tag
|
|
2468
2468
|
), i = r == null ? void 0 : r.derivedFileId;
|
|
2469
2469
|
if (typeof i == "string" && i) return i;
|
|
2470
2470
|
} catch {
|
|
2471
2471
|
}
|
|
2472
|
-
},
|
|
2472
|
+
}, Lt = async function(e) {
|
|
2473
2473
|
const s = (await this.client.listFiles({ folderId: e })).find(
|
|
2474
|
-
(r) => String(r.name ?? "") ===
|
|
2474
|
+
(r) => String(r.name ?? "") === fs
|
|
2475
2475
|
);
|
|
2476
|
-
return s ? { id:
|
|
2476
|
+
return s ? { id: at(s) } : void 0;
|
|
2477
2477
|
};
|
|
2478
|
-
function
|
|
2478
|
+
function ms(n, e) {
|
|
2479
2479
|
const t = (e ?? "").replace(/^\./, "").toLowerCase();
|
|
2480
2480
|
if (t) return t;
|
|
2481
2481
|
const s = n.lastIndexOf(".");
|
|
2482
2482
|
return s > 0 ? n.slice(s + 1).toLowerCase() : "";
|
|
2483
2483
|
}
|
|
2484
|
-
function
|
|
2484
|
+
function ar(n) {
|
|
2485
2485
|
if (!n || typeof n != "object") return null;
|
|
2486
2486
|
const e = n;
|
|
2487
|
-
if (e.schema !==
|
|
2487
|
+
if (e.schema !== bt || typeof e.name != "string") return null;
|
|
2488
2488
|
const t = Array.isArray(e.views) ? e.views.filter(
|
|
2489
2489
|
(i) => !!i && typeof i == "object" && typeof i.fileId == "string" && typeof i.format == "string"
|
|
2490
2490
|
) : [], s = e.native, r = !!s && typeof s == "object" && typeof s.fileId == "string" && typeof s.format == "string";
|
|
2491
2491
|
return {
|
|
2492
|
-
schema:
|
|
2492
|
+
schema: bt,
|
|
2493
2493
|
name: e.name,
|
|
2494
2494
|
...r ? { native: { fileId: s.fileId, format: s.format } } : {},
|
|
2495
2495
|
views: t
|
|
2496
2496
|
};
|
|
2497
2497
|
}
|
|
2498
|
-
class
|
|
2498
|
+
class ys extends Error {
|
|
2499
2499
|
constructor(e, t) {
|
|
2500
2500
|
super(
|
|
2501
2501
|
`The document history advanced while this version was being prepared: expected head ${e}, found ${t ?? "none"}. Read the timeline again and rebuild on the new head.`
|
|
2502
2502
|
), this.expectedGuid = e, this.actualGuid = t, this.name = "StaleHistoryError";
|
|
2503
2503
|
}
|
|
2504
2504
|
}
|
|
2505
|
-
const
|
|
2506
|
-
function
|
|
2505
|
+
const gs = "bimterop", Ft = "revitflow_history.json", Re = "revitflow_ops.json", ws = "revitflow/ops@1", Hs = "revitflow_model.frag", Gs = "revitflow_", cr = "bimterop-locks-anchor", ct = () => `v-${Date.now()}`;
|
|
2506
|
+
function Js(n, e) {
|
|
2507
2507
|
return n.filter((t) => String(t.parentId ?? "") === e);
|
|
2508
2508
|
}
|
|
2509
|
-
function
|
|
2509
|
+
function te(n) {
|
|
2510
2510
|
return String(n._id ?? n.id ?? "");
|
|
2511
2511
|
}
|
|
2512
|
-
var
|
|
2513
|
-
class
|
|
2512
|
+
var W, Xe, Dt;
|
|
2513
|
+
class hr {
|
|
2514
2514
|
constructor(e, t) {
|
|
2515
|
-
|
|
2516
|
-
|
|
2515
|
+
S(this, Xe);
|
|
2516
|
+
S(this, W);
|
|
2517
2517
|
this.client = e, this.projectId = t;
|
|
2518
2518
|
}
|
|
2519
2519
|
/** The project's connected documents. */
|
|
2520
2520
|
async docs() {
|
|
2521
|
-
const e = await h(this,
|
|
2521
|
+
const e = await h(this, Xe, Dt).call(this);
|
|
2522
2522
|
if (!e) return [];
|
|
2523
2523
|
const t = await this.client.listFolders({
|
|
2524
2524
|
parentFolderId: e,
|
|
2525
2525
|
projectId: this.projectId
|
|
2526
2526
|
}), s = [];
|
|
2527
|
-
for (const r of
|
|
2527
|
+
for (const r of Js(t, e)) {
|
|
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:
|
|
2531
|
+
folderId: te(r)
|
|
2532
2532
|
})).map(
|
|
2533
2533
|
(m) => String(m.name ?? "")
|
|
2534
|
-
),
|
|
2535
|
-
(m) => m.endsWith(".frag") && !m.startsWith(
|
|
2536
|
-
), c = l.includes(
|
|
2534
|
+
), d = l.find((m) => m === Hs) ?? l.find(
|
|
2535
|
+
(m) => m.endsWith(".frag") && !m.startsWith(Gs)
|
|
2536
|
+
), c = l.includes(Ft) || l.includes(Re) || !!d;
|
|
2537
2537
|
s.push({
|
|
2538
2538
|
source: i.slice(0, o),
|
|
2539
2539
|
docId: i.slice(o + 1),
|
|
2540
|
-
folderId:
|
|
2541
|
-
modelName:
|
|
2540
|
+
folderId: te(r),
|
|
2541
|
+
modelName: d,
|
|
2542
2542
|
...c ? {} : { empty: !0 }
|
|
2543
2543
|
});
|
|
2544
2544
|
}
|
|
@@ -2546,36 +2546,36 @@ class or {
|
|
|
2546
2546
|
}
|
|
2547
2547
|
/** One document's history. `source` and `docId` as {@link docs} lists them. */
|
|
2548
2548
|
doc(e, t) {
|
|
2549
|
-
return new
|
|
2549
|
+
return new lr(this.client, this, e, t);
|
|
2550
2550
|
}
|
|
2551
2551
|
/** @internal The `bimterop` folder id, resolved once. */
|
|
2552
2552
|
async rootFolderId(e = !1) {
|
|
2553
|
-
if (
|
|
2554
|
-
const t = await h(this,
|
|
2553
|
+
if (u(this, W)) return u(this, W);
|
|
2554
|
+
const t = await h(this, Xe, Dt).call(this);
|
|
2555
2555
|
if (t) return t;
|
|
2556
2556
|
if (!e) return;
|
|
2557
2557
|
const s = await this.client.createFolder(
|
|
2558
|
-
|
|
2558
|
+
gs,
|
|
2559
2559
|
void 0,
|
|
2560
2560
|
this.projectId
|
|
2561
2561
|
);
|
|
2562
|
-
return
|
|
2562
|
+
return R(this, W, te(s)), u(this, W);
|
|
2563
2563
|
}
|
|
2564
2564
|
}
|
|
2565
|
-
|
|
2566
|
-
if (
|
|
2565
|
+
W = new WeakMap(), Xe = new WeakSet(), Dt = async function() {
|
|
2566
|
+
if (u(this, W)) return u(this, W);
|
|
2567
2567
|
const t = (await this.client.listFolders({
|
|
2568
2568
|
projectId: this.projectId
|
|
2569
2569
|
})).find(
|
|
2570
|
-
(s) => String(s.name ?? "") ===
|
|
2570
|
+
(s) => String(s.name ?? "") === gs && !s.parentId
|
|
2571
2571
|
);
|
|
2572
|
-
return t &&
|
|
2572
|
+
return t && R(this, W, te(t)), u(this, W);
|
|
2573
2573
|
};
|
|
2574
|
-
var
|
|
2575
|
-
class
|
|
2574
|
+
var oe, p, ie, Ce, ee, qt, We, de, jt, ft, Ye, pt, Ut, Ws;
|
|
2575
|
+
class lr {
|
|
2576
2576
|
constructor(e, t, s, r) {
|
|
2577
|
-
|
|
2578
|
-
|
|
2577
|
+
S(this, p);
|
|
2578
|
+
S(this, oe);
|
|
2579
2579
|
this.client = e, this.project = t, this.source = s, this.docId = r;
|
|
2580
2580
|
}
|
|
2581
2581
|
// ─── Reading ───────────────────────────────────────────────────────────────
|
|
@@ -2585,8 +2585,8 @@ class ar {
|
|
|
2585
2585
|
* Each version gets its `ordinal` filled in.
|
|
2586
2586
|
*/
|
|
2587
2587
|
async timeline() {
|
|
2588
|
-
const e = await h(this, p,
|
|
2589
|
-
return
|
|
2588
|
+
const e = await h(this, p, ft).call(this);
|
|
2589
|
+
return Ys((e == null ? void 0 : e.commits) ?? []);
|
|
2590
2590
|
}
|
|
2591
2591
|
/** The head of the timeline, or null before the first sync. */
|
|
2592
2592
|
async latest() {
|
|
@@ -2612,7 +2612,7 @@ class ar {
|
|
|
2612
2612
|
* {@link modelParts} and compose.
|
|
2613
2613
|
*/
|
|
2614
2614
|
async model() {
|
|
2615
|
-
const e = await h(this, p,
|
|
2615
|
+
const e = await h(this, p, de).call(this);
|
|
2616
2616
|
if (!e)
|
|
2617
2617
|
throw new Error(
|
|
2618
2618
|
`Document ${this.source}-${this.docId} has no model file yet.`
|
|
@@ -2654,12 +2654,12 @@ class ar {
|
|
|
2654
2654
|
i = c;
|
|
2655
2655
|
break;
|
|
2656
2656
|
}
|
|
2657
|
-
const o = await h(this, p,
|
|
2657
|
+
const o = await h(this, p, de).call(this);
|
|
2658
2658
|
if (!o)
|
|
2659
2659
|
throw new Error(
|
|
2660
2660
|
`Document ${this.source}-${this.docId} has no model file yet.`
|
|
2661
2661
|
);
|
|
2662
|
-
const a = t[i], l = t.slice(r + 1).some((c) => c.full),
|
|
2662
|
+
const a = t[i], l = t.slice(r + 1).some((c) => c.full), d = t.slice(i + 1, r + 1).map((c) => ({
|
|
2663
2663
|
guid: c.guid,
|
|
2664
2664
|
...c.deltaId ? { deltaId: c.deltaId } : {},
|
|
2665
2665
|
removedUniqueIds: c.changes.filter((m) => m.type === "delete").map((m) => m.uniqueId)
|
|
@@ -2671,13 +2671,13 @@ class ar {
|
|
|
2671
2671
|
current: !l,
|
|
2672
2672
|
...a.version !== void 0 ? { storageVersion: a.version } : {}
|
|
2673
2673
|
},
|
|
2674
|
-
steps:
|
|
2674
|
+
steps: d,
|
|
2675
2675
|
at: t[r].guid
|
|
2676
2676
|
};
|
|
2677
2677
|
}
|
|
2678
2678
|
/** The document folder's item id — the id the CDE knows this document by. */
|
|
2679
2679
|
async folderId() {
|
|
2680
|
-
return await h(this, p,
|
|
2680
|
+
return await h(this, p, ee).call(this, !1);
|
|
2681
2681
|
}
|
|
2682
2682
|
// ─── The document descriptor ───────────────────────────────────────────────
|
|
2683
2683
|
/**
|
|
@@ -2685,7 +2685,7 @@ class ar {
|
|
|
2685
2685
|
* not carry one yet — an old folder from before descriptors existed.
|
|
2686
2686
|
*/
|
|
2687
2687
|
async descriptor() {
|
|
2688
|
-
return await
|
|
2688
|
+
return await u(this, p, ie).descriptor(await h(this, p, ee).call(this, !1));
|
|
2689
2689
|
}
|
|
2690
2690
|
/**
|
|
2691
2691
|
* The first view whose format appears in `formats`, searched in the order
|
|
@@ -2693,7 +2693,7 @@ class ar {
|
|
|
2693
2693
|
* model .frag on a descriptor-less folder, so old documents keep viewing.
|
|
2694
2694
|
*/
|
|
2695
2695
|
async view(e) {
|
|
2696
|
-
const t = await h(this, p,
|
|
2696
|
+
const t = await h(this, p, ee).call(this, !1), s = await u(this, p, ie).descriptor(t);
|
|
2697
2697
|
if (s) {
|
|
2698
2698
|
for (const i of e) {
|
|
2699
2699
|
const o = s.views.find((a) => a.format === i);
|
|
@@ -2702,7 +2702,7 @@ class ar {
|
|
|
2702
2702
|
return null;
|
|
2703
2703
|
}
|
|
2704
2704
|
if (!e.includes("frag")) return null;
|
|
2705
|
-
const r = await h(this, p,
|
|
2705
|
+
const r = await h(this, p, de).call(this);
|
|
2706
2706
|
return r ? { fileId: r.id, format: "frag" } : null;
|
|
2707
2707
|
}
|
|
2708
2708
|
/**
|
|
@@ -2711,14 +2711,14 @@ class ar {
|
|
|
2711
2711
|
* One view per format: a same-format view is replaced, not accumulated.
|
|
2712
2712
|
*/
|
|
2713
2713
|
async addView(e) {
|
|
2714
|
-
const t = await h(this, p,
|
|
2715
|
-
if (await
|
|
2716
|
-
await
|
|
2714
|
+
const t = await h(this, p, ee).call(this, !0);
|
|
2715
|
+
if (await u(this, p, ie).descriptor(t)) {
|
|
2716
|
+
await u(this, p, ie).addView(t, e);
|
|
2717
2717
|
return;
|
|
2718
2718
|
}
|
|
2719
|
-
const r = await h(this, p,
|
|
2720
|
-
await
|
|
2721
|
-
name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ??
|
|
2719
|
+
const r = await h(this, p, de).call(this);
|
|
2720
|
+
await u(this, p, ie).setDescriptor(t, {
|
|
2721
|
+
name: (r == null ? void 0 : r.name.replace(/\.frag$/, "")) ?? u(this, p, Ce),
|
|
2722
2722
|
views: [e]
|
|
2723
2723
|
});
|
|
2724
2724
|
}
|
|
@@ -2731,15 +2731,15 @@ class ar {
|
|
|
2731
2731
|
* model file).
|
|
2732
2732
|
*/
|
|
2733
2733
|
async ensureDescriptor() {
|
|
2734
|
-
const e = await h(this, p,
|
|
2734
|
+
const e = await h(this, p, ee).call(this, !1), t = await u(this, p, ie).descriptor(e);
|
|
2735
2735
|
if (t) return t;
|
|
2736
|
-
const s = await h(this, p,
|
|
2736
|
+
const s = await h(this, p, de).call(this);
|
|
2737
2737
|
if (!s) return null;
|
|
2738
2738
|
const r = {
|
|
2739
2739
|
name: s.name.replace(/\.frag$/, ""),
|
|
2740
2740
|
views: [{ fileId: s.id, format: "frag" }]
|
|
2741
2741
|
};
|
|
2742
|
-
return await
|
|
2742
|
+
return await u(this, p, ie).setDescriptor(e, r), await u(this, p, ie).descriptor(e);
|
|
2743
2743
|
}
|
|
2744
2744
|
// ─── Ownership (element locks) ─────────────────────────────────────────────
|
|
2745
2745
|
/**
|
|
@@ -2750,15 +2750,15 @@ class ar {
|
|
|
2750
2750
|
* claims counts only for the earliest one, matching the plugins' rule.
|
|
2751
2751
|
*/
|
|
2752
2752
|
async ownership() {
|
|
2753
|
-
const e = await h(this, p,
|
|
2753
|
+
const e = await h(this, p, We).call(this, cr);
|
|
2754
2754
|
if (!e) return [];
|
|
2755
2755
|
const t = await this.client.getHiddenFilesByParent(e.id), s = await Promise.all(
|
|
2756
2756
|
t.map(async (o) => {
|
|
2757
2757
|
try {
|
|
2758
|
-
const a =
|
|
2759
|
-
return !
|
|
2760
|
-
owner: String(
|
|
2761
|
-
keys:
|
|
2758
|
+
const a = te(o), l = await this.client.downloadHiddenFile(a), d = JSON.parse(await l.text());
|
|
2759
|
+
return !d || typeof d != "object" || !("revitflowlock" in d) || !Array.isArray(d.keys) ? null : {
|
|
2760
|
+
owner: String(d.user ?? ""),
|
|
2761
|
+
keys: d.keys.filter((c) => typeof c == "string")
|
|
2762
2762
|
};
|
|
2763
2763
|
} catch {
|
|
2764
2764
|
return null;
|
|
@@ -2787,16 +2787,16 @@ class ar {
|
|
|
2787
2787
|
*/
|
|
2788
2788
|
async sync(e) {
|
|
2789
2789
|
var a;
|
|
2790
|
-
const t = await h(this, p,
|
|
2791
|
-
let s = await h(this, p,
|
|
2790
|
+
const t = await h(this, p, ee).call(this, !0);
|
|
2791
|
+
let s = await h(this, p, ft).call(this) ?? {
|
|
2792
2792
|
model: this.docId,
|
|
2793
2793
|
commits: []
|
|
2794
2794
|
};
|
|
2795
|
-
const r =
|
|
2795
|
+
const r = bs(s.commits);
|
|
2796
2796
|
if (e.expectedLatestGuid !== void 0 && (r == null ? void 0 : r.guid) !== e.expectedLatestGuid)
|
|
2797
|
-
throw new
|
|
2797
|
+
throw new ys(e.expectedLatestGuid, r == null ? void 0 : r.guid);
|
|
2798
2798
|
const i = {
|
|
2799
|
-
guid:
|
|
2799
|
+
guid: Mt(),
|
|
2800
2800
|
...r ? { parents: [r.guid] } : {},
|
|
2801
2801
|
author: e.author,
|
|
2802
2802
|
source: e.source,
|
|
@@ -2805,36 +2805,36 @@ class ar {
|
|
|
2805
2805
|
...e.userId ? { userId: e.userId } : {},
|
|
2806
2806
|
...(a = e.appliedOps) != null && a.length ? { appliedOps: e.appliedOps } : {},
|
|
2807
2807
|
changes: e.changes,
|
|
2808
|
-
counts:
|
|
2808
|
+
counts: dr(e.changes)
|
|
2809
2809
|
};
|
|
2810
|
-
if (e.model && (await h(this, p,
|
|
2811
|
-
const l = await h(this, p,
|
|
2810
|
+
if (e.model && (await h(this, p, Ws).call(this, t, e.model), i.full = !0), e.delta) {
|
|
2811
|
+
const l = await h(this, p, de).call(this);
|
|
2812
2812
|
if (!l)
|
|
2813
2813
|
throw new Error(
|
|
2814
2814
|
"A delta needs the model file to hang from: sync a full model first."
|
|
2815
2815
|
);
|
|
2816
|
-
const
|
|
2816
|
+
const d = await this.client.createHiddenFile(
|
|
2817
2817
|
e.delta,
|
|
2818
2818
|
l.id
|
|
2819
2819
|
);
|
|
2820
2820
|
i.deltaId = String(
|
|
2821
|
-
|
|
2821
|
+
d._id ?? d.id
|
|
2822
2822
|
);
|
|
2823
2823
|
}
|
|
2824
|
-
const o = await h(this, p,
|
|
2824
|
+
const o = await h(this, p, ft).call(this);
|
|
2825
2825
|
if (o) {
|
|
2826
2826
|
s = o;
|
|
2827
|
-
const l =
|
|
2827
|
+
const l = bs(s.commits);
|
|
2828
2828
|
if (e.expectedLatestGuid !== void 0 && (l == null ? void 0 : l.guid) !== e.expectedLatestGuid)
|
|
2829
|
-
throw new
|
|
2829
|
+
throw new ys(e.expectedLatestGuid, l == null ? void 0 : l.guid);
|
|
2830
2830
|
l && !i.parents && (i.parents = [l.guid]);
|
|
2831
2831
|
}
|
|
2832
|
-
return s.commits.push(i), await h(this, p,
|
|
2832
|
+
return s.commits.push(i), await h(this, p, pt).call(this, t, Ft, s), i;
|
|
2833
2833
|
}
|
|
2834
2834
|
// ─── Suggestions (change requests) ────────────────────────────────────────
|
|
2835
2835
|
/** Every suggestion in the document's queue, pending or resolved. */
|
|
2836
2836
|
async suggestions() {
|
|
2837
|
-
const e = await h(this, p,
|
|
2837
|
+
const e = await h(this, p, Ye).call(this);
|
|
2838
2838
|
return (e == null ? void 0 : e.ops) ?? [];
|
|
2839
2839
|
}
|
|
2840
2840
|
/** The suggestions still waiting for the owner, oldest first. */
|
|
@@ -2846,8 +2846,8 @@ class ar {
|
|
|
2846
2846
|
* uploaded as a hidden file under the suggestions index.
|
|
2847
2847
|
*/
|
|
2848
2848
|
async suggest(e) {
|
|
2849
|
-
const t = await h(this, p,
|
|
2850
|
-
opId: e.opId ??
|
|
2849
|
+
const t = await h(this, p, ee).call(this, !0), s = await h(this, p, Ye).call(this) ?? { schema: ws, ops: [] }, r = await h(this, p, We).call(this, Re), i = {
|
|
2850
|
+
opId: e.opId ?? Mt(),
|
|
2851
2851
|
to: e.to ?? this.source,
|
|
2852
2852
|
title: e.title,
|
|
2853
2853
|
verb: e.verb,
|
|
@@ -2860,7 +2860,7 @@ class ar {
|
|
|
2860
2860
|
...e.baseCommitGuid ? { baseCommitGuid: e.baseCommitGuid } : {}
|
|
2861
2861
|
};
|
|
2862
2862
|
if (e.payload) {
|
|
2863
|
-
const a = r ?? await h(this, p,
|
|
2863
|
+
const a = r ?? await h(this, p, Ut).call(this, t, Re, s), l = await this.client.createHiddenFile(
|
|
2864
2864
|
e.payload,
|
|
2865
2865
|
a.id
|
|
2866
2866
|
);
|
|
@@ -2868,8 +2868,8 @@ class ar {
|
|
|
2868
2868
|
l._id ?? l.id
|
|
2869
2869
|
);
|
|
2870
2870
|
}
|
|
2871
|
-
const o = await h(this, p,
|
|
2872
|
-
return o.schema ?? (o.schema =
|
|
2871
|
+
const o = await h(this, p, Ye).call(this) ?? s;
|
|
2872
|
+
return o.schema ?? (o.schema = ws), o.ops.push(i), await h(this, p, pt).call(this, t, Re, o), i;
|
|
2873
2873
|
}
|
|
2874
2874
|
/** A suggestion's .frag payload. */
|
|
2875
2875
|
async suggestionPayload(e) {
|
|
@@ -2883,20 +2883,20 @@ class ar {
|
|
|
2883
2883
|
* use it for `discarded`.
|
|
2884
2884
|
*/
|
|
2885
2885
|
async resolveSuggestion(e, t) {
|
|
2886
|
-
const s = await h(this, p,
|
|
2886
|
+
const s = await h(this, p, ee).call(this, !1);
|
|
2887
2887
|
if (!s) throw new Error("This document has no suggestion queue.");
|
|
2888
|
-
const r = await h(this, p,
|
|
2888
|
+
const r = await h(this, p, Ye).call(this), i = r == null ? void 0 : r.ops.find((o) => o.opId === e);
|
|
2889
2889
|
if (!r || !i)
|
|
2890
2890
|
throw new Error(`No suggestion ${e} in this document's queue.`);
|
|
2891
|
-
return Object.assign(i, t), await h(this, p,
|
|
2891
|
+
return Object.assign(i, t), await h(this, p, pt).call(this, s, Re, r), i;
|
|
2892
2892
|
}
|
|
2893
2893
|
}
|
|
2894
|
-
|
|
2895
|
-
return new
|
|
2896
|
-
},
|
|
2894
|
+
oe = new WeakMap(), p = new WeakSet(), ie = function() {
|
|
2895
|
+
return new Ms(this.client, this.project.projectId);
|
|
2896
|
+
}, Ce = function() {
|
|
2897
2897
|
return `${this.source}-${this.docId}`;
|
|
2898
|
-
},
|
|
2899
|
-
if (
|
|
2898
|
+
}, ee = async function(e) {
|
|
2899
|
+
if (u(this, oe)) return u(this, oe);
|
|
2900
2900
|
const t = await this.project.rootFolderId(e);
|
|
2901
2901
|
if (!t)
|
|
2902
2902
|
throw new Error(
|
|
@@ -2905,153 +2905,153 @@ Q = new WeakMap(), p = new WeakSet(), X = function() {
|
|
|
2905
2905
|
const s = await this.client.listFolders({
|
|
2906
2906
|
parentFolderId: t,
|
|
2907
2907
|
projectId: this.project.projectId
|
|
2908
|
-
}), r =
|
|
2909
|
-
(o) => String(o.name ?? "") ===
|
|
2908
|
+
}), r = Js(s, t).find(
|
|
2909
|
+
(o) => String(o.name ?? "") === u(this, p, Ce)
|
|
2910
2910
|
);
|
|
2911
2911
|
if (r)
|
|
2912
|
-
return
|
|
2912
|
+
return R(this, oe, te(r)), u(this, oe);
|
|
2913
2913
|
if (!e)
|
|
2914
2914
|
throw new Error(
|
|
2915
|
-
`Document ${
|
|
2915
|
+
`Document ${u(this, p, Ce)} does not exist in this project.`
|
|
2916
2916
|
);
|
|
2917
2917
|
const i = await this.client.createFolder(
|
|
2918
|
-
|
|
2918
|
+
u(this, p, Ce),
|
|
2919
2919
|
t,
|
|
2920
2920
|
this.project.projectId
|
|
2921
2921
|
);
|
|
2922
|
-
return
|
|
2923
|
-
},
|
|
2924
|
-
const e = await h(this, p,
|
|
2922
|
+
return R(this, oe, te(i)), u(this, oe);
|
|
2923
|
+
}, qt = async function() {
|
|
2924
|
+
const e = await h(this, p, ee).call(this, !1);
|
|
2925
2925
|
return (await this.client.listFiles({ folderId: e })).map((s) => ({
|
|
2926
|
-
id:
|
|
2926
|
+
id: te(s),
|
|
2927
2927
|
name: String(s.name ?? "")
|
|
2928
2928
|
}));
|
|
2929
|
-
},
|
|
2929
|
+
}, We = async function(e) {
|
|
2930
2930
|
try {
|
|
2931
|
-
return (await h(this, p,
|
|
2931
|
+
return (await h(this, p, qt).call(this)).find((t) => t.name === e);
|
|
2932
2932
|
} catch {
|
|
2933
2933
|
return;
|
|
2934
2934
|
}
|
|
2935
|
-
},
|
|
2935
|
+
}, de = async function() {
|
|
2936
2936
|
try {
|
|
2937
|
-
const e = await h(this, p,
|
|
2938
|
-
return e.find((t) => t.name ===
|
|
2939
|
-
(t) => t.name.endsWith(".frag") && !t.name.startsWith(
|
|
2937
|
+
const e = await h(this, p, qt).call(this);
|
|
2938
|
+
return e.find((t) => t.name === Hs) ?? e.find(
|
|
2939
|
+
(t) => t.name.endsWith(".frag") && !t.name.startsWith(Gs)
|
|
2940
2940
|
);
|
|
2941
2941
|
} catch {
|
|
2942
2942
|
return;
|
|
2943
2943
|
}
|
|
2944
|
-
},
|
|
2945
|
-
const t = await h(this, p,
|
|
2944
|
+
}, jt = async function(e) {
|
|
2945
|
+
const t = await h(this, p, We).call(this, e);
|
|
2946
2946
|
if (!t) return;
|
|
2947
2947
|
const r = await (await this.client.downloadFile(t.id)).text();
|
|
2948
2948
|
if (r.trim())
|
|
2949
2949
|
return JSON.parse(r);
|
|
2950
|
-
},
|
|
2951
|
-
return h(this, p,
|
|
2952
|
-
},
|
|
2953
|
-
return h(this, p,
|
|
2954
|
-
},
|
|
2950
|
+
}, ft = function() {
|
|
2951
|
+
return h(this, p, jt).call(this, Ft);
|
|
2952
|
+
}, Ye = function() {
|
|
2953
|
+
return h(this, p, jt).call(this, Re);
|
|
2954
|
+
}, pt = async function(e, t, s) {
|
|
2955
2955
|
const r = new Blob([JSON.stringify(s)], {
|
|
2956
2956
|
type: "application/json"
|
|
2957
|
-
}), i = await h(this, p,
|
|
2957
|
+
}), i = await h(this, p, We).call(this, t);
|
|
2958
2958
|
return i ? (await this.client.updateFile(i.id, {
|
|
2959
2959
|
file: r,
|
|
2960
|
-
versionTag:
|
|
2961
|
-
}), i) : await h(this, p,
|
|
2962
|
-
},
|
|
2960
|
+
versionTag: ct()
|
|
2961
|
+
}), i) : await h(this, p, Ut).call(this, e, t, s);
|
|
2962
|
+
}, Ut = async function(e, t, s) {
|
|
2963
2963
|
const r = new Blob([JSON.stringify(s)], {
|
|
2964
2964
|
type: "application/json"
|
|
2965
2965
|
}), i = await this.client.createFile({
|
|
2966
2966
|
file: r,
|
|
2967
2967
|
name: t,
|
|
2968
|
-
versionTag:
|
|
2968
|
+
versionTag: ct(),
|
|
2969
2969
|
parentFolderId: e,
|
|
2970
2970
|
projectId: this.project.projectId
|
|
2971
2971
|
}), o = i.item;
|
|
2972
|
-
return { id:
|
|
2973
|
-
},
|
|
2974
|
-
const s = await h(this, p,
|
|
2972
|
+
return { id: te(o ?? i), name: t };
|
|
2973
|
+
}, Ws = async function(e, t) {
|
|
2974
|
+
const s = await h(this, p, de).call(this);
|
|
2975
2975
|
if (s)
|
|
2976
2976
|
return await this.client.updateFile(s.id, {
|
|
2977
2977
|
file: t,
|
|
2978
|
-
versionTag:
|
|
2978
|
+
versionTag: ct()
|
|
2979
2979
|
}), s;
|
|
2980
|
-
const r = `${
|
|
2980
|
+
const r = `${u(this, p, Ce)}.frag`, i = await this.client.createFile({
|
|
2981
2981
|
file: t,
|
|
2982
2982
|
name: r,
|
|
2983
|
-
versionTag:
|
|
2983
|
+
versionTag: ct(),
|
|
2984
2984
|
parentFolderId: e,
|
|
2985
2985
|
projectId: this.project.projectId
|
|
2986
2986
|
}), o = i.item;
|
|
2987
|
-
return { id:
|
|
2987
|
+
return { id: te(o ?? i), name: r };
|
|
2988
2988
|
};
|
|
2989
|
-
function
|
|
2989
|
+
function dr(n) {
|
|
2990
2990
|
const e = { added: 0, modified: 0, removed: 0 };
|
|
2991
2991
|
for (const t of n)
|
|
2992
2992
|
t.type === "create" ? e.added++ : t.type === "delete" ? e.removed++ : e.modified++;
|
|
2993
2993
|
return e;
|
|
2994
2994
|
}
|
|
2995
|
-
function
|
|
2995
|
+
function Ys(n) {
|
|
2996
2996
|
var l;
|
|
2997
2997
|
if (n.length <= 1)
|
|
2998
|
-
return n.forEach((
|
|
2999
|
-
const e = new Map(n.map((
|
|
3000
|
-
for (const
|
|
3001
|
-
const c = (l =
|
|
2998
|
+
return n.forEach((d, c) => d.ordinal = c), [...n];
|
|
2999
|
+
const e = new Map(n.map((d) => [d.guid, d])), t = /* @__PURE__ */ new Map(), s = [];
|
|
3000
|
+
for (const d of n) {
|
|
3001
|
+
const c = (l = d.parents) == null ? void 0 : l[0];
|
|
3002
3002
|
if (c && e.has(c)) {
|
|
3003
3003
|
const m = t.get(c) ?? [];
|
|
3004
|
-
m.push(
|
|
3004
|
+
m.push(d), t.set(c, m);
|
|
3005
3005
|
} else
|
|
3006
|
-
s.push(
|
|
3006
|
+
s.push(d);
|
|
3007
3007
|
}
|
|
3008
|
-
const r = (
|
|
3008
|
+
const r = (d, c) => String(d.timestamp).localeCompare(String(c.timestamp));
|
|
3009
3009
|
s.sort(r);
|
|
3010
3010
|
const i = [], o = [...s].reverse(), a = /* @__PURE__ */ new Set();
|
|
3011
3011
|
for (; o.length; ) {
|
|
3012
|
-
const
|
|
3013
|
-
if (a.has(
|
|
3014
|
-
a.add(
|
|
3015
|
-
const c = (t.get(
|
|
3012
|
+
const d = o.pop();
|
|
3013
|
+
if (a.has(d.guid)) continue;
|
|
3014
|
+
a.add(d.guid), i.push(d);
|
|
3015
|
+
const c = (t.get(d.guid) ?? []).sort(r);
|
|
3016
3016
|
for (let m = c.length - 1; m >= 0; m--) o.push(c[m]);
|
|
3017
3017
|
}
|
|
3018
|
-
for (const
|
|
3019
|
-
a.has(
|
|
3020
|
-
return i.forEach((
|
|
3018
|
+
for (const d of n)
|
|
3019
|
+
a.has(d.guid) || i.push(d);
|
|
3020
|
+
return i.forEach((d, c) => d.ordinal = c), i;
|
|
3021
3021
|
}
|
|
3022
|
-
function
|
|
3023
|
-
const e =
|
|
3022
|
+
function bs(n) {
|
|
3023
|
+
const e = Ys(n);
|
|
3024
3024
|
return e[e.length - 1];
|
|
3025
3025
|
}
|
|
3026
|
-
function
|
|
3026
|
+
function Mt() {
|
|
3027
3027
|
const n = globalThis.crypto;
|
|
3028
3028
|
return n != null && n.randomUUID ? n.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
|
|
3029
3029
|
const t = Math.random() * 16 | 0;
|
|
3030
3030
|
return (e === "x" ? t : t & 3 | 8).toString(16);
|
|
3031
3031
|
});
|
|
3032
3032
|
}
|
|
3033
|
-
var
|
|
3034
|
-
class
|
|
3033
|
+
var fe, Qe, Vt;
|
|
3034
|
+
class ur {
|
|
3035
3035
|
constructor(e) {
|
|
3036
|
-
|
|
3037
|
-
|
|
3036
|
+
S(this, Qe);
|
|
3037
|
+
S(this, fe, /* @__PURE__ */ new Map());
|
|
3038
3038
|
this.client = e;
|
|
3039
3039
|
}
|
|
3040
3040
|
/** Registers a recipe. One per name; a second with the same name throws. */
|
|
3041
3041
|
register(e) {
|
|
3042
|
-
if (
|
|
3042
|
+
if (u(this, fe).has(e.name))
|
|
3043
3043
|
throw new Error(`A recipe named "${e.name}" is already registered.`);
|
|
3044
|
-
|
|
3044
|
+
u(this, fe).set(e.name, e);
|
|
3045
3045
|
}
|
|
3046
3046
|
/** The registered recipes, optionally filtered by target application. */
|
|
3047
3047
|
list(e) {
|
|
3048
|
-
return [...
|
|
3048
|
+
return [...u(this, fe).values()].filter(
|
|
3049
3049
|
(s) => (!(e != null && e.to) || s.to === e.to) && (!(e != null && e.input) || s.inputs.includes(e.input))
|
|
3050
3050
|
);
|
|
3051
3051
|
}
|
|
3052
3052
|
/** A registered recipe by name, or undefined. */
|
|
3053
3053
|
get(e) {
|
|
3054
|
-
return
|
|
3054
|
+
return u(this, fe).get(e);
|
|
3055
3055
|
}
|
|
3056
3056
|
/**
|
|
3057
3057
|
* Runs a recipe WITHOUT queueing anything: the dry pass. Returns a
|
|
@@ -3060,7 +3060,7 @@ class hr {
|
|
|
3060
3060
|
* included, with no second run. Discard it and the plan never happened.
|
|
3061
3061
|
*/
|
|
3062
3062
|
async plan(e, t) {
|
|
3063
|
-
const { base: s, opId: r, result: i } = await h(this,
|
|
3063
|
+
const { base: s, opId: r, result: i } = await h(this, Qe, Vt).call(this, e, t);
|
|
3064
3064
|
return {
|
|
3065
3065
|
opId: r,
|
|
3066
3066
|
projectId: t.projectId,
|
|
@@ -3093,7 +3093,7 @@ class hr {
|
|
|
3093
3093
|
* to show the tallies before queueing.
|
|
3094
3094
|
*/
|
|
3095
3095
|
async run(e, t) {
|
|
3096
|
-
const { targetDoc: s, base: r, opId: i, result: o } = await h(this,
|
|
3096
|
+
const { targetDoc: s, base: r, opId: i, result: o } = await h(this, Qe, Vt).call(this, e, t);
|
|
3097
3097
|
return { suggestion: await s.suggest({
|
|
3098
3098
|
opId: i,
|
|
3099
3099
|
title: o.title,
|
|
@@ -3106,14 +3106,14 @@ class hr {
|
|
|
3106
3106
|
}), result: o };
|
|
3107
3107
|
}
|
|
3108
3108
|
}
|
|
3109
|
-
|
|
3110
|
-
const s =
|
|
3109
|
+
fe = new WeakMap(), Qe = new WeakSet(), Vt = async function(e, t) {
|
|
3110
|
+
const s = u(this, fe).get(e);
|
|
3111
3111
|
if (!s) throw new Error(`No recipe named "${e}" is registered.`);
|
|
3112
3112
|
if (s.to !== t.target.source)
|
|
3113
3113
|
throw new Error(
|
|
3114
3114
|
`Recipe "${e}" writes ${s.to}, but the target document belongs to ${t.target.source}.`
|
|
3115
3115
|
);
|
|
3116
|
-
const r = this.client.history(t.projectId).doc(t.target.source, t.target.docId), i = await r.latest(), o =
|
|
3116
|
+
const r = this.client.history(t.projectId).doc(t.target.source, t.target.docId), i = await r.latest(), o = Mt(), a = await s.run({
|
|
3117
3117
|
client: this.client,
|
|
3118
3118
|
projectId: t.projectId,
|
|
3119
3119
|
targetDoc: r,
|
|
@@ -3123,8 +3123,8 @@ ae = new WeakMap(), Pe = new WeakSet(), _t = async function(e, t) {
|
|
|
3123
3123
|
});
|
|
3124
3124
|
return { recipe: s, targetDoc: r, base: i, opId: o, result: a };
|
|
3125
3125
|
};
|
|
3126
|
-
const
|
|
3127
|
-
function
|
|
3126
|
+
const vs = 100;
|
|
3127
|
+
function fr(n) {
|
|
3128
3128
|
try {
|
|
3129
3129
|
const e = JSON.parse(n);
|
|
3130
3130
|
if (e && typeof e == "object") {
|
|
@@ -3139,29 +3139,29 @@ function lr(n) {
|
|
|
3139
3139
|
}
|
|
3140
3140
|
return {};
|
|
3141
3141
|
}
|
|
3142
|
-
function
|
|
3142
|
+
function pr(n) {
|
|
3143
3143
|
if (!n || typeof n != "object") return;
|
|
3144
3144
|
const e = n.retryAfter;
|
|
3145
3145
|
return typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : void 0;
|
|
3146
3146
|
}
|
|
3147
|
-
class
|
|
3147
|
+
class rs extends Error {
|
|
3148
3148
|
constructor(t, s, r, i) {
|
|
3149
|
-
const o =
|
|
3149
|
+
const o = fr(r);
|
|
3150
3150
|
super(o.message ?? `${s || "Request failed"} (${t})`);
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3151
|
+
B(this, "status");
|
|
3152
|
+
B(this, "code");
|
|
3153
|
+
B(this, "details");
|
|
3154
|
+
B(this, "body");
|
|
3155
3155
|
/**
|
|
3156
3156
|
* Seconds to wait before retrying, taken from the `Retry-After` header or
|
|
3157
3157
|
* from `details.retryAfter`. Only present on rate-limited (429) responses.
|
|
3158
3158
|
*/
|
|
3159
|
-
|
|
3160
|
-
this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ??
|
|
3159
|
+
B(this, "retryAfter");
|
|
3160
|
+
this.name = "RequestError", this.status = t, this.code = o.code, this.details = o.details, this.body = r, this.retryAfter = i ?? pr(o.details);
|
|
3161
3161
|
}
|
|
3162
3162
|
}
|
|
3163
|
-
const
|
|
3164
|
-
function
|
|
3163
|
+
const Z = "item/folder", b = "item", le = "processor", mr = "npm-registry", re = "hidden", kt = "FILE", Ot = "TOOL", At = "APP", yr = 500, Es = 3e4, gr = 0.25, wr = (n) => new Promise((e) => setTimeout(e, n));
|
|
3164
|
+
function br(n) {
|
|
3165
3165
|
var r, i;
|
|
3166
3166
|
const e = (i = (r = n.headers) == null ? void 0 : r.get) == null ? void 0 : i.call(r, "Retry-After");
|
|
3167
3167
|
if (!e) return;
|
|
@@ -3171,18 +3171,18 @@ function yr(n) {
|
|
|
3171
3171
|
if (!Number.isNaN(s))
|
|
3172
3172
|
return Math.max(0, (s - Date.now()) / 1e3);
|
|
3173
3173
|
}
|
|
3174
|
-
function
|
|
3175
|
-
return n instanceof
|
|
3174
|
+
function vr(n) {
|
|
3175
|
+
return n instanceof rs ? n.status === 429 || n.status >= 500 : !0;
|
|
3176
3176
|
}
|
|
3177
|
-
function
|
|
3177
|
+
function Er(n, e) {
|
|
3178
3178
|
const t = Math.min(
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
), s = t *
|
|
3182
|
-
return r != null ? Math.min(r,
|
|
3179
|
+
yr * 2 ** e,
|
|
3180
|
+
Es
|
|
3181
|
+
), s = t * gr * Math.random(), r = n instanceof rs && n.retryAfter != null ? n.retryAfter * 1e3 : void 0;
|
|
3182
|
+
return r != null ? Math.min(r, Es) + s : t + s;
|
|
3183
3183
|
}
|
|
3184
|
-
var f,
|
|
3185
|
-
const
|
|
3184
|
+
var f, Gt, w, ue, Ze, ze, mt, yt, Jt, Wt, zs;
|
|
3185
|
+
const is = class is {
|
|
3186
3186
|
/**
|
|
3187
3187
|
* Creates a new EngineServicesClient instance.
|
|
3188
3188
|
* @param accessToken - API access token (obtained from the platform dashboard)
|
|
@@ -3191,26 +3191,26 @@ const qt = class qt {
|
|
|
3191
3191
|
* @param props - Optional configuration (retry count, auth mode, etc.).
|
|
3192
3192
|
*/
|
|
3193
3193
|
constructor(e, t, s) {
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3194
|
+
S(this, f);
|
|
3195
|
+
B(this, "apiUrl");
|
|
3196
|
+
B(this, "accessToken");
|
|
3197
|
+
B(this, "wsUrl");
|
|
3198
|
+
B(this, "retries");
|
|
3199
|
+
B(this, "useBearer");
|
|
3200
|
+
B(this, "builtInGlobals", null);
|
|
3201
3201
|
/**
|
|
3202
3202
|
* URL of a local execution server (e.g. `http://localhost:4001`).
|
|
3203
3203
|
* When set, execution methods are routed to this server instead of the cloud API.
|
|
3204
3204
|
* Set to `null` to disable local routing and use the cloud API.
|
|
3205
3205
|
*/
|
|
3206
|
-
|
|
3206
|
+
B(this, "localServerUrl", null);
|
|
3207
3207
|
/**
|
|
3208
3208
|
* The platform context this client was created with.
|
|
3209
3209
|
* Contains `appId`, `projectId`, `accessToken`, and `apiUrl`.
|
|
3210
3210
|
* Populated automatically when using {@link fromPlatformContext}.
|
|
3211
3211
|
*/
|
|
3212
|
-
|
|
3213
|
-
|
|
3212
|
+
B(this, "context");
|
|
3213
|
+
S(this, Ze);
|
|
3214
3214
|
const { retries: r = 0, useBearer: i = !1, localServerUrl: o } = s || {};
|
|
3215
3215
|
let a = t;
|
|
3216
3216
|
if (a.charAt(a.length - 1) === "/" && (a = a.slice(0, -1)), this.apiUrl = `${a}/api`, this.accessToken = e, this.wsUrl = a, this.retries = r, this.useBearer = i, this.context = { appId: "", projectId: "", accessToken: e, apiUrl: t }, o) {
|
|
@@ -3235,7 +3235,7 @@ const qt = class qt {
|
|
|
3235
3235
|
* ```
|
|
3236
3236
|
*/
|
|
3237
3237
|
static fromPlatformContext(e) {
|
|
3238
|
-
const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new
|
|
3238
|
+
const t = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, s = new is(t.accessToken, t.apiUrl, {
|
|
3239
3239
|
...e,
|
|
3240
3240
|
useBearer: !0
|
|
3241
3241
|
});
|
|
@@ -3311,7 +3311,7 @@ const qt = class qt {
|
|
|
3311
3311
|
* cleaning logic is applied identically.
|
|
3312
3312
|
*/
|
|
3313
3313
|
async request(e, t, s) {
|
|
3314
|
-
return h(this, f,
|
|
3314
|
+
return h(this, f, w).call(this, e, t, s);
|
|
3315
3315
|
}
|
|
3316
3316
|
// ─── Files ───────────────────────────────────────────────────────
|
|
3317
3317
|
/**
|
|
@@ -3321,9 +3321,9 @@ const qt = class qt {
|
|
|
3321
3321
|
*/
|
|
3322
3322
|
async listFiles(e) {
|
|
3323
3323
|
const { folderId: t, archived: s, projectId: r } = e || {};
|
|
3324
|
-
return t ? await h(this, f,
|
|
3324
|
+
return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, { query: { itemType: kt, archived: s } }) : await h(this, f, w).call(this, "GET", `${b}`, {
|
|
3325
3325
|
query: {
|
|
3326
|
-
itemType:
|
|
3326
|
+
itemType: kt,
|
|
3327
3327
|
archived: s,
|
|
3328
3328
|
...r && { projectId: r }
|
|
3329
3329
|
}
|
|
@@ -3336,7 +3336,7 @@ const qt = class qt {
|
|
|
3336
3336
|
* @returns The file item, optionally with version history.
|
|
3337
3337
|
*/
|
|
3338
3338
|
async getFile(e, t) {
|
|
3339
|
-
return await h(this, f,
|
|
3339
|
+
return await h(this, f, Wt).call(this, e, t);
|
|
3340
3340
|
}
|
|
3341
3341
|
/**
|
|
3342
3342
|
* Uploads a new file.
|
|
@@ -3344,7 +3344,7 @@ const qt = class qt {
|
|
|
3344
3344
|
* @returns The created item and its first version.
|
|
3345
3345
|
*/
|
|
3346
3346
|
async createFile(e) {
|
|
3347
|
-
return await h(this, f,
|
|
3347
|
+
return await h(this, f, yt).call(this, e, kt);
|
|
3348
3348
|
}
|
|
3349
3349
|
/**
|
|
3350
3350
|
* Updates an existing file. Can rename, move to a different folder,
|
|
@@ -3354,21 +3354,21 @@ const qt = class qt {
|
|
|
3354
3354
|
* @returns The updated item and/or the new version.
|
|
3355
3355
|
*/
|
|
3356
3356
|
async updateFile(e, t) {
|
|
3357
|
-
return await h(this, f,
|
|
3357
|
+
return await h(this, f, Jt).call(this, e, t);
|
|
3358
3358
|
}
|
|
3359
3359
|
/**
|
|
3360
3360
|
* Archives (soft-deletes) a file. Can be recovered with {@link recoverFile}.
|
|
3361
3361
|
* @param fileId - The file's unique identifier.
|
|
3362
3362
|
*/
|
|
3363
3363
|
async archiveFile(e) {
|
|
3364
|
-
return await h(this, f,
|
|
3364
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
|
|
3365
3365
|
}
|
|
3366
3366
|
/**
|
|
3367
3367
|
* Recovers a previously archived file.
|
|
3368
3368
|
* @param fileId - The file's unique identifier.
|
|
3369
3369
|
*/
|
|
3370
3370
|
async recoverFile(e) {
|
|
3371
|
-
return await h(this, f,
|
|
3371
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${e}/recover`);
|
|
3372
3372
|
}
|
|
3373
3373
|
/**
|
|
3374
3374
|
* Downloads a file's content. Returns the raw fetch Response.
|
|
@@ -3377,7 +3377,7 @@ const qt = class qt {
|
|
|
3377
3377
|
* @returns A fetch Response containing the file data.
|
|
3378
3378
|
*/
|
|
3379
3379
|
async downloadFile(e, t) {
|
|
3380
|
-
return await h(this, f,
|
|
3380
|
+
return await h(this, f, mt).call(this, e, t);
|
|
3381
3381
|
}
|
|
3382
3382
|
/**
|
|
3383
3383
|
* Retrieves the free-JSON metadata for a specific file version.
|
|
@@ -3388,7 +3388,7 @@ const qt = class qt {
|
|
|
3388
3388
|
*/
|
|
3389
3389
|
async getFileVersionMetadata(e, t, s) {
|
|
3390
3390
|
const { withDraft: r } = s || {};
|
|
3391
|
-
return await h(this, f,
|
|
3391
|
+
return await h(this, f, w).call(this, "GET", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
|
|
3392
3392
|
query: {
|
|
3393
3393
|
...r && { withDraft: "true" }
|
|
3394
3394
|
}
|
|
@@ -3401,7 +3401,7 @@ const qt = class qt {
|
|
|
3401
3401
|
* @param metadata - Free-JSON object (max 200 fields, 50-char keys/values).
|
|
3402
3402
|
*/
|
|
3403
3403
|
async updateFileVersionMetadata(e, t, s) {
|
|
3404
|
-
return await h(this, f,
|
|
3404
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`, {
|
|
3405
3405
|
body: JSON.stringify({ metadata: s }),
|
|
3406
3406
|
contentType: "application/json"
|
|
3407
3407
|
});
|
|
@@ -3412,7 +3412,7 @@ const qt = class qt {
|
|
|
3412
3412
|
* @param versionTag - The version tag.
|
|
3413
3413
|
*/
|
|
3414
3414
|
async deleteFileVersionMetadata(e, t) {
|
|
3415
|
-
return await h(this, f,
|
|
3415
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/metadata`);
|
|
3416
3416
|
}
|
|
3417
3417
|
/**
|
|
3418
3418
|
* Batch variant of {@link getFileVersionMetadata}. Reads the metadata of
|
|
@@ -3429,7 +3429,7 @@ const qt = class qt {
|
|
|
3429
3429
|
*/
|
|
3430
3430
|
async getFileVersionMetadataBatch(e, t) {
|
|
3431
3431
|
const { withDraft: s } = t || {};
|
|
3432
|
-
return await h(this, f,
|
|
3432
|
+
return await h(this, f, ze).call(this, e, async (r) => (await h(this, f, w).call(this, "POST", `${b}/batch/version-metadata`, {
|
|
3433
3433
|
body: JSON.stringify({
|
|
3434
3434
|
entries: r,
|
|
3435
3435
|
...s !== void 0 && { withDraft: s }
|
|
@@ -3445,7 +3445,7 @@ const qt = class qt {
|
|
|
3445
3445
|
*/
|
|
3446
3446
|
async listFolders(e) {
|
|
3447
3447
|
const { archived: t, parentFolderId: s, projectId: r } = e || {};
|
|
3448
|
-
return await h(this, f,
|
|
3448
|
+
return await h(this, f, w).call(this, "GET", Z, {
|
|
3449
3449
|
query: {
|
|
3450
3450
|
parentFolderId: s,
|
|
3451
3451
|
archived: t,
|
|
@@ -3458,7 +3458,7 @@ const qt = class qt {
|
|
|
3458
3458
|
* @param folderId - The folder's unique identifier.
|
|
3459
3459
|
*/
|
|
3460
3460
|
async getFolder(e) {
|
|
3461
|
-
return await h(this, f,
|
|
3461
|
+
return await h(this, f, w).call(this, "GET", `${Z}/${e}`);
|
|
3462
3462
|
}
|
|
3463
3463
|
/**
|
|
3464
3464
|
* Batch variant of {@link getFolder}. Resolves a known set of folder ids in
|
|
@@ -3474,7 +3474,7 @@ const qt = class qt {
|
|
|
3474
3474
|
* @param folderIds - The folder ids to resolve.
|
|
3475
3475
|
*/
|
|
3476
3476
|
async getFoldersBatch(e) {
|
|
3477
|
-
return await h(this, f,
|
|
3477
|
+
return await h(this, f, ze).call(this, e, async (t) => (await h(this, f, w).call(this, "POST", `${b}/batch/folders`, {
|
|
3478
3478
|
body: JSON.stringify({ folderIds: t }),
|
|
3479
3479
|
contentType: "application/json"
|
|
3480
3480
|
})).results);
|
|
@@ -3486,7 +3486,7 @@ const qt = class qt {
|
|
|
3486
3486
|
* @returns The created folder.
|
|
3487
3487
|
*/
|
|
3488
3488
|
async createFolder(e, t, s) {
|
|
3489
|
-
return await h(this, f,
|
|
3489
|
+
return await h(this, f, w).call(this, "POST", Z, {
|
|
3490
3490
|
body: JSON.stringify({
|
|
3491
3491
|
name: e,
|
|
3492
3492
|
...t && { parentId: t },
|
|
@@ -3503,7 +3503,7 @@ const qt = class qt {
|
|
|
3503
3503
|
*/
|
|
3504
3504
|
async updateFolder(e, t) {
|
|
3505
3505
|
const { name: s } = t;
|
|
3506
|
-
return await h(this, f,
|
|
3506
|
+
return await h(this, f, w).call(this, "PUT", `${Z}/${e}`, {
|
|
3507
3507
|
body: JSON.stringify({ name: s }),
|
|
3508
3508
|
contentType: "application/json"
|
|
3509
3509
|
});
|
|
@@ -3513,14 +3513,14 @@ const qt = class qt {
|
|
|
3513
3513
|
* @param folderId - The folder's unique identifier.
|
|
3514
3514
|
*/
|
|
3515
3515
|
async archiveFolder(e) {
|
|
3516
|
-
return await h(this, f,
|
|
3516
|
+
return await h(this, f, w).call(this, "DELETE", `${Z}/${e}`);
|
|
3517
3517
|
}
|
|
3518
3518
|
/**
|
|
3519
3519
|
* Recovers a previously archived folder.
|
|
3520
3520
|
* @param folderId - The folder's unique identifier.
|
|
3521
3521
|
*/
|
|
3522
3522
|
async recoverFolder(e) {
|
|
3523
|
-
return await h(this, f,
|
|
3523
|
+
return await h(this, f, w).call(this, "PUT", `${Z}/${e}/recover`);
|
|
3524
3524
|
}
|
|
3525
3525
|
/**
|
|
3526
3526
|
* Downloads an entire folder as a ZIP archive.
|
|
@@ -3528,7 +3528,7 @@ const qt = class qt {
|
|
|
3528
3528
|
* @returns A fetch Response containing the ZIP data.
|
|
3529
3529
|
*/
|
|
3530
3530
|
async downloadFolder(e) {
|
|
3531
|
-
return await h(this, f,
|
|
3531
|
+
return await h(this, f, ue).call(this, `${Z}/${e}/download`);
|
|
3532
3532
|
}
|
|
3533
3533
|
// ─── Components ──────────────────────────────────────────────────
|
|
3534
3534
|
/**
|
|
@@ -3538,14 +3538,14 @@ const qt = class qt {
|
|
|
3538
3538
|
*/
|
|
3539
3539
|
async listComponents(e) {
|
|
3540
3540
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
3541
|
-
return t ? await h(this, f,
|
|
3541
|
+
return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, {
|
|
3542
3542
|
query: {
|
|
3543
|
-
itemType:
|
|
3543
|
+
itemType: Ot,
|
|
3544
3544
|
...s && { ShowVersions: s }
|
|
3545
3545
|
}
|
|
3546
|
-
}) : await h(this, f,
|
|
3546
|
+
}) : await h(this, f, w).call(this, "GET", `${b}`, {
|
|
3547
3547
|
query: {
|
|
3548
|
-
itemType:
|
|
3548
|
+
itemType: Ot,
|
|
3549
3549
|
...s && { ShowVersions: s },
|
|
3550
3550
|
...r && { projectId: r }
|
|
3551
3551
|
}
|
|
@@ -3557,7 +3557,7 @@ const qt = class qt {
|
|
|
3557
3557
|
* @param props - Options such as whether to include versions.
|
|
3558
3558
|
*/
|
|
3559
3559
|
async getComponent(e, t) {
|
|
3560
|
-
return await h(this, f,
|
|
3560
|
+
return await h(this, f, Wt).call(this, e, t);
|
|
3561
3561
|
}
|
|
3562
3562
|
/**
|
|
3563
3563
|
* Creates a new component with the given file and version properties.
|
|
@@ -3566,7 +3566,7 @@ const qt = class qt {
|
|
|
3566
3566
|
*/
|
|
3567
3567
|
async createComponent(e) {
|
|
3568
3568
|
const { componentProps: t } = e;
|
|
3569
|
-
return await h(this, f,
|
|
3569
|
+
return await h(this, f, yt).call(this, e, Ot, t);
|
|
3570
3570
|
}
|
|
3571
3571
|
/**
|
|
3572
3572
|
* Updates an existing component. Can rename, move, and/or upload a new version.
|
|
@@ -3576,7 +3576,7 @@ const qt = class qt {
|
|
|
3576
3576
|
*/
|
|
3577
3577
|
async updateComponent(e, t) {
|
|
3578
3578
|
const { componentProps: s } = t;
|
|
3579
|
-
return await h(this, f,
|
|
3579
|
+
return await h(this, f, Jt).call(this, e, t, s);
|
|
3580
3580
|
}
|
|
3581
3581
|
/**
|
|
3582
3582
|
* Downloads a component's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3585,7 +3585,7 @@ const qt = class qt {
|
|
|
3585
3585
|
* @returns A fetch Response containing the ZIP data.
|
|
3586
3586
|
*/
|
|
3587
3587
|
async downloadComponent(e, t) {
|
|
3588
|
-
return await h(this, f,
|
|
3588
|
+
return await h(this, f, mt).call(this, e, t);
|
|
3589
3589
|
}
|
|
3590
3590
|
/**
|
|
3591
3591
|
* Downloads only the JavaScript bundle from a component's ZIP.
|
|
@@ -3596,7 +3596,7 @@ const qt = class qt {
|
|
|
3596
3596
|
*/
|
|
3597
3597
|
async downloadComponentBundle(e, t) {
|
|
3598
3598
|
const { versionTag: s, withDraft: r } = t || {};
|
|
3599
|
-
return await h(this, f,
|
|
3599
|
+
return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
|
|
3600
3600
|
query: {
|
|
3601
3601
|
...s && { versionTag: s },
|
|
3602
3602
|
...r && { withDraft: r }
|
|
@@ -3608,14 +3608,14 @@ const qt = class qt {
|
|
|
3608
3608
|
* @param componentId - The component's unique identifier.
|
|
3609
3609
|
*/
|
|
3610
3610
|
async archiveComponent(e) {
|
|
3611
|
-
return await h(this, f,
|
|
3611
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
|
|
3612
3612
|
}
|
|
3613
3613
|
/**
|
|
3614
3614
|
* Recovers a previously archived component.
|
|
3615
3615
|
* @param componentId - The component's unique identifier.
|
|
3616
3616
|
*/
|
|
3617
3617
|
async recoverComponent(e) {
|
|
3618
|
-
return await h(this, f,
|
|
3618
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${e}/recover`);
|
|
3619
3619
|
}
|
|
3620
3620
|
// ─── Built-in Components ─────────────────────────────────────────
|
|
3621
3621
|
/**
|
|
@@ -3624,7 +3624,7 @@ const qt = class qt {
|
|
|
3624
3624
|
* @returns The component's JavaScript source code as a string.
|
|
3625
3625
|
*/
|
|
3626
3626
|
async getBuiltInComponent(e) {
|
|
3627
|
-
return await (await h(this, f,
|
|
3627
|
+
return await (await h(this, f, ue).call(this, `built-in/${e}/bundle`)).text();
|
|
3628
3628
|
}
|
|
3629
3629
|
/**
|
|
3630
3630
|
* Fetches a built-in component bundle, evaluates it, and registers it
|
|
@@ -3653,8 +3653,8 @@ const qt = class qt {
|
|
|
3653
3653
|
* ```
|
|
3654
3654
|
*/
|
|
3655
3655
|
async initBuiltInComponent(e, t, s) {
|
|
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]),
|
|
3657
|
-
return main;`)(...a), c = (
|
|
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]), d = new Function(...o, `${r}
|
|
3657
|
+
return main;`)(...a), c = (d == null ? void 0 : d.componentDefinition) ?? d;
|
|
3658
3658
|
t.get(c);
|
|
3659
3659
|
}
|
|
3660
3660
|
/**
|
|
@@ -3722,14 +3722,14 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3722
3722
|
*/
|
|
3723
3723
|
async listApps(e) {
|
|
3724
3724
|
const { folderId: t, ShowVersions: s, projectId: r } = e || {};
|
|
3725
|
-
return t ? await h(this, f,
|
|
3725
|
+
return t ? await h(this, f, w).call(this, "GET", `${Z}/${t}/items`, {
|
|
3726
3726
|
query: {
|
|
3727
|
-
itemType:
|
|
3727
|
+
itemType: At,
|
|
3728
3728
|
...s && { ShowVersions: s }
|
|
3729
3729
|
}
|
|
3730
|
-
}) : await h(this, f,
|
|
3730
|
+
}) : await h(this, f, w).call(this, "GET", `${b}`, {
|
|
3731
3731
|
query: {
|
|
3732
|
-
itemType:
|
|
3732
|
+
itemType: At,
|
|
3733
3733
|
...s && { ShowVersions: s },
|
|
3734
3734
|
...r && { projectId: r }
|
|
3735
3735
|
}
|
|
@@ -3742,7 +3742,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3742
3742
|
*/
|
|
3743
3743
|
async createApp(e) {
|
|
3744
3744
|
const { appProps: t } = e;
|
|
3745
|
-
return await h(this, f,
|
|
3745
|
+
return await h(this, f, yt).call(this, e, At, t);
|
|
3746
3746
|
}
|
|
3747
3747
|
/**
|
|
3748
3748
|
* Downloads an app's full ZIP file. Returns the raw fetch Response.
|
|
@@ -3751,7 +3751,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3751
3751
|
* @returns A fetch Response containing the ZIP data.
|
|
3752
3752
|
*/
|
|
3753
3753
|
async downloadApp(e, t) {
|
|
3754
|
-
return await h(this, f,
|
|
3754
|
+
return await h(this, f, mt).call(this, e, t);
|
|
3755
3755
|
}
|
|
3756
3756
|
/**
|
|
3757
3757
|
* Downloads only the JavaScript bundle from an app's ZIP.
|
|
@@ -3762,7 +3762,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3762
3762
|
*/
|
|
3763
3763
|
async downloadAppBundle(e, t) {
|
|
3764
3764
|
const { versionTag: s, withDraft: r } = t || {};
|
|
3765
|
-
return await h(this, f,
|
|
3765
|
+
return await h(this, f, ue).call(this, `${b}/${e}/download/bundle`, {
|
|
3766
3766
|
query: {
|
|
3767
3767
|
...s && { versionTag: s },
|
|
3768
3768
|
...r && { withDraft: r }
|
|
@@ -3774,7 +3774,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3774
3774
|
* @param appId - The app's unique identifier.
|
|
3775
3775
|
*/
|
|
3776
3776
|
async archiveApp(e) {
|
|
3777
|
-
return await h(this, f,
|
|
3777
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}`);
|
|
3778
3778
|
}
|
|
3779
3779
|
// ─── NPM Registry ────────────────────────────────────────────────
|
|
3780
3780
|
/**
|
|
@@ -3786,7 +3786,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3786
3786
|
* @returns The registry, scope, read-only token, and assembled `.npmrc`.
|
|
3787
3787
|
*/
|
|
3788
3788
|
async getNpmCredentials() {
|
|
3789
|
-
return await h(this, f,
|
|
3789
|
+
return await h(this, f, w).call(this, "GET", `${mr}/credentials`);
|
|
3790
3790
|
}
|
|
3791
3791
|
// ─── Execution ───────────────────────────────────────────────────
|
|
3792
3792
|
/**
|
|
@@ -3805,7 +3805,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3805
3805
|
*/
|
|
3806
3806
|
async executeComponent(e, t, s) {
|
|
3807
3807
|
if (this.localServerUrl) {
|
|
3808
|
-
const r = `${this.localServerUrl}/api/${
|
|
3808
|
+
const r = `${this.localServerUrl}/api/${le}/${e}/execute`, i = await fetch(r, {
|
|
3809
3809
|
method: "POST",
|
|
3810
3810
|
headers: { "Content-Type": "application/json" },
|
|
3811
3811
|
body: JSON.stringify(t)
|
|
@@ -3818,7 +3818,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3818
3818
|
}
|
|
3819
3819
|
return await i.json();
|
|
3820
3820
|
}
|
|
3821
|
-
return await h(this, f,
|
|
3821
|
+
return await h(this, f, w).call(this, "POST", `${le}/${e}/execute`, {
|
|
3822
3822
|
body: JSON.stringify(t),
|
|
3823
3823
|
query: { ...s && { versionTag: s } },
|
|
3824
3824
|
contentType: "application/json"
|
|
@@ -3830,7 +3830,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3830
3830
|
*/
|
|
3831
3831
|
async abortExecution(e) {
|
|
3832
3832
|
if (this.localServerUrl) {
|
|
3833
|
-
const t = `${this.localServerUrl}/api/${
|
|
3833
|
+
const t = `${this.localServerUrl}/api/${le}/progress/${e}/abort`, s = await fetch(t, { method: "POST" });
|
|
3834
3834
|
if (!s.ok) {
|
|
3835
3835
|
const r = await s.text().catch(() => "");
|
|
3836
3836
|
throw new Error(
|
|
@@ -3839,7 +3839,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3839
3839
|
}
|
|
3840
3840
|
return await s.json();
|
|
3841
3841
|
}
|
|
3842
|
-
return await h(this, f,
|
|
3842
|
+
return await h(this, f, w).call(this, "POST", `${le}/progress/${e}/abort`);
|
|
3843
3843
|
}
|
|
3844
3844
|
/**
|
|
3845
3845
|
* Lists all executions for a given component.
|
|
@@ -3856,7 +3856,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3856
3856
|
*/
|
|
3857
3857
|
async listExecutions(e, t) {
|
|
3858
3858
|
if (this.localServerUrl) {
|
|
3859
|
-
const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${
|
|
3859
|
+
const s = t ? `?projectId=${encodeURIComponent(t)}` : "", r = `${this.localServerUrl}/api/${le}/${e}/progress${s}`, i = await fetch(r);
|
|
3860
3860
|
if (!i.ok) {
|
|
3861
3861
|
const o = await i.text().catch(() => "");
|
|
3862
3862
|
throw new Error(
|
|
@@ -3865,7 +3865,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3865
3865
|
}
|
|
3866
3866
|
return await i.json();
|
|
3867
3867
|
}
|
|
3868
|
-
return await h(this, f,
|
|
3868
|
+
return await h(this, f, w).call(this, "GET", `${le}/${e}/progress`, { query: { ...t && { projectId: t } } });
|
|
3869
3869
|
}
|
|
3870
3870
|
/**
|
|
3871
3871
|
* Gets details of a specific execution, including its messages.
|
|
@@ -3874,7 +3874,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3874
3874
|
*/
|
|
3875
3875
|
async getExecution(e) {
|
|
3876
3876
|
if (this.localServerUrl) {
|
|
3877
|
-
const t = `${this.localServerUrl}/api/${
|
|
3877
|
+
const t = `${this.localServerUrl}/api/${le}/progress/${e}`, s = await fetch(t);
|
|
3878
3878
|
if (!s.ok) {
|
|
3879
3879
|
const r = await s.text().catch(() => "");
|
|
3880
3880
|
throw new Error(
|
|
@@ -3883,7 +3883,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3883
3883
|
}
|
|
3884
3884
|
return await s.json();
|
|
3885
3885
|
}
|
|
3886
|
-
return await h(this, f,
|
|
3886
|
+
return await h(this, f, w).call(this, "GET", `${le}/progress/${e}`);
|
|
3887
3887
|
}
|
|
3888
3888
|
/**
|
|
3889
3889
|
* Subscribes to real-time execution progress via WebSocket.
|
|
@@ -3892,7 +3892,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3892
3892
|
* @param onUpdateCallback - Callback invoked on each progress/result event.
|
|
3893
3893
|
*/
|
|
3894
3894
|
async onExecutionProgress(e, t) {
|
|
3895
|
-
const s = this.localServerUrl ?? this.wsUrl, r = await
|
|
3895
|
+
const s = this.localServerUrl ?? this.wsUrl, r = await Ke(s, {
|
|
3896
3896
|
auth: { accessToken: this.accessToken },
|
|
3897
3897
|
transports: ["websocket"]
|
|
3898
3898
|
});
|
|
@@ -3911,7 +3911,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3911
3911
|
* renderable views. See `src/core/documents.ts` for the model and schema.
|
|
3912
3912
|
*/
|
|
3913
3913
|
documents(e) {
|
|
3914
|
-
return new
|
|
3914
|
+
return new Ms(this, e);
|
|
3915
3915
|
}
|
|
3916
3916
|
/**
|
|
3917
3917
|
* A project's history of connected documents (Revit models, AutoCAD
|
|
@@ -3920,14 +3920,14 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3920
3920
|
* or write it; the storage underneath is private and will move.
|
|
3921
3921
|
*/
|
|
3922
3922
|
history(e) {
|
|
3923
|
-
return new
|
|
3923
|
+
return new hr(this, e);
|
|
3924
3924
|
}
|
|
3925
3925
|
/**
|
|
3926
3926
|
* The recipe registry and runner: scripts that write change requests in a
|
|
3927
3927
|
* native application's language. See `src/core/recipes.ts`.
|
|
3928
3928
|
*/
|
|
3929
3929
|
get recipes() {
|
|
3930
|
-
return
|
|
3930
|
+
return u(this, Ze) ?? R(this, Ze, new ur(this)), u(this, Ze);
|
|
3931
3931
|
}
|
|
3932
3932
|
// ─── Hidden Files ────────────────────────────────────────────────
|
|
3933
3933
|
/**
|
|
@@ -3941,7 +3941,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3941
3941
|
*/
|
|
3942
3942
|
async createHiddenFile(e, t, s) {
|
|
3943
3943
|
const r = new FormData();
|
|
3944
|
-
return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f,
|
|
3944
|
+
return r.append("file", e), r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}`, {
|
|
3945
3945
|
body: r
|
|
3946
3946
|
});
|
|
3947
3947
|
}
|
|
@@ -3959,7 +3959,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3959
3959
|
const r = new FormData();
|
|
3960
3960
|
for (const i of e)
|
|
3961
3961
|
r.append("files", i);
|
|
3962
|
-
return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f,
|
|
3962
|
+
return r.append("parentItemId", t), s != null && r.append("tag", s), await h(this, f, w).call(this, "POST", `${b}/${re}/batch`, {
|
|
3963
3963
|
body: r
|
|
3964
3964
|
});
|
|
3965
3965
|
}
|
|
@@ -3968,21 +3968,21 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
3968
3968
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3969
3969
|
*/
|
|
3970
3970
|
async deleteHiddenFile(e) {
|
|
3971
|
-
return await h(this, f,
|
|
3971
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${re}/${e}`);
|
|
3972
3972
|
}
|
|
3973
3973
|
/**
|
|
3974
3974
|
* Gets metadata for a hidden file.
|
|
3975
3975
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3976
3976
|
*/
|
|
3977
3977
|
async getHiddenFile(e) {
|
|
3978
|
-
return await h(this, f,
|
|
3978
|
+
return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}`);
|
|
3979
3979
|
}
|
|
3980
3980
|
/**
|
|
3981
3981
|
* Downloads a hidden file's content. Returns the raw fetch Response.
|
|
3982
3982
|
* @param hiddenId - The hidden file's unique identifier.
|
|
3983
3983
|
*/
|
|
3984
3984
|
async downloadHiddenFile(e) {
|
|
3985
|
-
return await h(this, f,
|
|
3985
|
+
return await h(this, f, ue).call(this, `${b}/${re}/${e}/download`);
|
|
3986
3986
|
}
|
|
3987
3987
|
/**
|
|
3988
3988
|
* Mints a short-lived presigned URL for a hidden file so the browser can
|
|
@@ -4002,7 +4002,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4002
4002
|
* an ISO timestamp when it stops working.
|
|
4003
4003
|
*/
|
|
4004
4004
|
async getHiddenFileSignedUrl(e, t) {
|
|
4005
|
-
return await h(this, f,
|
|
4005
|
+
return await h(this, f, w).call(this, "GET", `${b}/${re}/${e}/signed-url`, { ...t != null && { query: { expiresIn: t } } });
|
|
4006
4006
|
}
|
|
4007
4007
|
/**
|
|
4008
4008
|
* Batch variant of {@link getHiddenFileSignedUrl}. Mints presigned URLs for
|
|
@@ -4023,7 +4023,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4023
4023
|
* 900 (15 min) server-side; values are clamped to that range.
|
|
4024
4024
|
*/
|
|
4025
4025
|
async getHiddenFileSignedUrlsBatch(e, t) {
|
|
4026
|
-
return await h(this, f,
|
|
4026
|
+
return await h(this, f, ze).call(this, e, async (s) => (await h(this, f, w).call(this, "POST", `${b}/${re}/signed-url/batch`, {
|
|
4027
4027
|
body: JSON.stringify({
|
|
4028
4028
|
hiddenFileIds: s,
|
|
4029
4029
|
...t != null && { expiresIn: t }
|
|
@@ -4039,14 +4039,14 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4039
4039
|
* @returns Array of hidden file entities.
|
|
4040
4040
|
*/
|
|
4041
4041
|
async getHiddenFilesByParent(e, t) {
|
|
4042
|
-
return await h(this, f,
|
|
4042
|
+
return await h(this, f, w).call(this, "GET", `${b}/${e}/${re}`, { ...t != null && { query: { tag: t } } });
|
|
4043
4043
|
}
|
|
4044
4044
|
/**
|
|
4045
4045
|
* Deletes all hidden files attached to a parent item.
|
|
4046
4046
|
* @param parentFileId - The parent item's unique identifier.
|
|
4047
4047
|
*/
|
|
4048
4048
|
async deleteHiddenFilesByParent(e) {
|
|
4049
|
-
return await h(this, f,
|
|
4049
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}/${re}`);
|
|
4050
4050
|
}
|
|
4051
4051
|
// ─── Icons ───────────────────────────────────────────────────────
|
|
4052
4052
|
/**
|
|
@@ -4058,7 +4058,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4058
4058
|
*/
|
|
4059
4059
|
async uploadItemIcon(e, t) {
|
|
4060
4060
|
const s = new FormData();
|
|
4061
|
-
return s.append("icon", t), await h(this, f,
|
|
4061
|
+
return s.append("icon", t), await h(this, f, w).call(this, "PUT", `${b}/${e}/icon`, {
|
|
4062
4062
|
body: s
|
|
4063
4063
|
});
|
|
4064
4064
|
}
|
|
@@ -4068,7 +4068,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4068
4068
|
* @returns The raw Response (use `.blob()`, `.arrayBuffer()`, or pipe the body).
|
|
4069
4069
|
*/
|
|
4070
4070
|
async getItemIcon(e) {
|
|
4071
|
-
return await h(this, f,
|
|
4071
|
+
return await h(this, f, ue).call(this, `${b}/${e}/icon`);
|
|
4072
4072
|
}
|
|
4073
4073
|
/**
|
|
4074
4074
|
* Removes the icon from an item.
|
|
@@ -4076,7 +4076,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4076
4076
|
* @returns The updated item with icon fields removed.
|
|
4077
4077
|
*/
|
|
4078
4078
|
async removeItemIcon(e) {
|
|
4079
|
-
return await h(this, f,
|
|
4079
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${e}/icon`);
|
|
4080
4080
|
}
|
|
4081
4081
|
// ─── General Item Operations ─────────────────────────────────────
|
|
4082
4082
|
/**
|
|
@@ -4086,7 +4086,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4086
4086
|
* @returns The updated item.
|
|
4087
4087
|
*/
|
|
4088
4088
|
async updateItem(e, t) {
|
|
4089
|
-
return await h(this, f,
|
|
4089
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${e}`, {
|
|
4090
4090
|
body: JSON.stringify(t),
|
|
4091
4091
|
contentType: "application/json"
|
|
4092
4092
|
});
|
|
@@ -4103,7 +4103,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4103
4103
|
*/
|
|
4104
4104
|
async createVersion(e, t, s, r, i) {
|
|
4105
4105
|
const o = new FormData();
|
|
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,
|
|
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, w).call(this, "POST", `${b}/${e}/version`, { body: o });
|
|
4107
4107
|
}
|
|
4108
4108
|
/**
|
|
4109
4109
|
* Lists versions of an item. Pass `archived: true` to fetch only archived
|
|
@@ -4113,7 +4113,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4113
4113
|
* @returns Array of versions, sorted by creation date descending.
|
|
4114
4114
|
*/
|
|
4115
4115
|
async listVersions(e, t = {}) {
|
|
4116
|
-
return await h(this, f,
|
|
4116
|
+
return await h(this, f, w).call(this, "GET", `${b}/${encodeURIComponent(e)}/versions`, { query: t });
|
|
4117
4117
|
}
|
|
4118
4118
|
/**
|
|
4119
4119
|
* Batch variant of {@link listVersions}. Lists the versions of many items in
|
|
@@ -4132,7 +4132,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4132
4132
|
*/
|
|
4133
4133
|
async listVersionsBatch(e, t = {}) {
|
|
4134
4134
|
const { archived: s } = t;
|
|
4135
|
-
return await h(this, f,
|
|
4135
|
+
return await h(this, f, ze).call(this, e, async (r) => (await h(this, f, w).call(this, "POST", `${b}/batch/versions`, {
|
|
4136
4136
|
body: JSON.stringify({
|
|
4137
4137
|
itemIds: r,
|
|
4138
4138
|
...s !== void 0 && { archived: s }
|
|
@@ -4150,7 +4150,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4150
4150
|
* @returns The archived version.
|
|
4151
4151
|
*/
|
|
4152
4152
|
async archiveVersion(e, t) {
|
|
4153
|
-
return await h(this, f,
|
|
4153
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/archive`);
|
|
4154
4154
|
}
|
|
4155
4155
|
/**
|
|
4156
4156
|
* Recovers a previously archived version, restoring it to the active list.
|
|
@@ -4159,7 +4159,7 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4159
4159
|
* @returns The recovered version.
|
|
4160
4160
|
*/
|
|
4161
4161
|
async recoverVersion(e, t) {
|
|
4162
|
-
return await h(this, f,
|
|
4162
|
+
return await h(this, f, w).call(this, "PUT", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}/recover`);
|
|
4163
4163
|
}
|
|
4164
4164
|
/**
|
|
4165
4165
|
* Permanently deletes a version, including its file in object storage.
|
|
@@ -4168,54 +4168,54 @@ return main;`)(...a), c = (u == null ? void 0 : u.componentDefinition) ?? u;
|
|
|
4168
4168
|
* @param versionTag - The version's tag (e.g. "v2").
|
|
4169
4169
|
*/
|
|
4170
4170
|
async deleteVersion(e, t) {
|
|
4171
|
-
return await h(this, f,
|
|
4171
|
+
return await h(this, f, w).call(this, "DELETE", `${b}/${encodeURIComponent(e)}/version/${encodeURIComponent(t)}`);
|
|
4172
4172
|
}
|
|
4173
4173
|
};
|
|
4174
|
-
f = new WeakSet(),
|
|
4174
|
+
f = new WeakSet(), Gt = function(e) {
|
|
4175
4175
|
return `${this.apiUrl}/${e}`;
|
|
4176
|
-
},
|
|
4177
|
-
const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt:
|
|
4176
|
+
}, w = async function(e, t, s) {
|
|
4177
|
+
const { body: r, query: i, contentType: o, retries: a, responseType: l, retryAttempt: d } = s || {}, c = h(this, f, Gt).call(this, t), m = h(this, f, zs).call(this, i), T = await this.resolveAccessToken(), A = {
|
|
4178
4178
|
...m,
|
|
4179
|
-
...this.useBearer ? {} : { accessToken:
|
|
4179
|
+
...this.useBearer ? {} : { accessToken: T }
|
|
4180
4180
|
};
|
|
4181
4181
|
try {
|
|
4182
|
-
const
|
|
4183
|
-
c + "?" + new URLSearchParams(
|
|
4182
|
+
const _ = await fetch(
|
|
4183
|
+
c + "?" + new URLSearchParams(A).toString(),
|
|
4184
4184
|
{
|
|
4185
4185
|
method: e,
|
|
4186
4186
|
headers: {
|
|
4187
4187
|
Accept: "application/json",
|
|
4188
4188
|
...o && { "Content-Type": o },
|
|
4189
|
-
...this.useBearer && { Authorization: `Bearer ${
|
|
4189
|
+
...this.useBearer && { Authorization: `Bearer ${T}` }
|
|
4190
4190
|
},
|
|
4191
4191
|
...r && { body: r }
|
|
4192
4192
|
}
|
|
4193
4193
|
);
|
|
4194
|
-
if (!
|
|
4195
|
-
const
|
|
4196
|
-
throw new
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4194
|
+
if (!_.ok) {
|
|
4195
|
+
const E = await _.text().then((N) => N).catch(() => "");
|
|
4196
|
+
throw new rs(
|
|
4197
|
+
_.status,
|
|
4198
|
+
_.statusText,
|
|
4199
|
+
E,
|
|
4200
|
+
br(_)
|
|
4201
4201
|
);
|
|
4202
4202
|
}
|
|
4203
|
-
return l === "blob" ? await
|
|
4203
|
+
return l === "blob" ? await _.blob() : _.json().then((E) => E).catch(() => {
|
|
4204
4204
|
});
|
|
4205
|
-
} catch (
|
|
4206
|
-
const
|
|
4207
|
-
if (
|
|
4208
|
-
const
|
|
4209
|
-
return await
|
|
4205
|
+
} catch (_) {
|
|
4206
|
+
const E = a ?? this.retries;
|
|
4207
|
+
if (E > 0 && vr(_)) {
|
|
4208
|
+
const N = d ?? 0;
|
|
4209
|
+
return await wr(Er(_, N)), await h(this, f, w).call(this, e, t, {
|
|
4210
4210
|
...s,
|
|
4211
|
-
retries:
|
|
4212
|
-
retryAttempt:
|
|
4211
|
+
retries: E - 1,
|
|
4212
|
+
retryAttempt: N + 1
|
|
4213
4213
|
});
|
|
4214
4214
|
}
|
|
4215
|
-
throw
|
|
4215
|
+
throw _;
|
|
4216
4216
|
}
|
|
4217
|
-
},
|
|
4218
|
-
const { query: s } = t || {}, r = h(this, f,
|
|
4217
|
+
}, ue = async function(e, t) {
|
|
4218
|
+
const { query: s } = t || {}, r = h(this, f, Gt).call(this, e), i = await this.resolveAccessToken(), o = {
|
|
4219
4219
|
...s,
|
|
4220
4220
|
...this.useBearer ? {} : { accessToken: i }
|
|
4221
4221
|
};
|
|
@@ -4228,31 +4228,31 @@ f = new WeakSet(), It = function(e) {
|
|
|
4228
4228
|
}
|
|
4229
4229
|
}
|
|
4230
4230
|
);
|
|
4231
|
-
},
|
|
4231
|
+
}, Ze = new WeakMap(), ze = async function(e, t) {
|
|
4232
4232
|
if (!e.length) return [];
|
|
4233
4233
|
const s = [];
|
|
4234
|
-
for (let i = 0; i < e.length; i +=
|
|
4235
|
-
s.push(e.slice(i, i +
|
|
4234
|
+
for (let i = 0; i < e.length; i += vs)
|
|
4235
|
+
s.push(e.slice(i, i + vs));
|
|
4236
4236
|
return (await Promise.all(s.map(t))).flat();
|
|
4237
|
-
},
|
|
4237
|
+
}, mt = async function(e, t) {
|
|
4238
4238
|
const { versionTag: s, withDraft: r } = t || {};
|
|
4239
|
-
return await h(this, f,
|
|
4239
|
+
return await h(this, f, ue).call(this, `${b}/${e}/download`, {
|
|
4240
4240
|
query: {
|
|
4241
4241
|
...s && { versionTag: s },
|
|
4242
4242
|
...r && { withDraft: r }
|
|
4243
4243
|
}
|
|
4244
4244
|
});
|
|
4245
|
-
},
|
|
4246
|
-
const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata:
|
|
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)),
|
|
4245
|
+
}, yt = async function(e, t, s) {
|
|
4246
|
+
const { name: r, versionTag: i, parentFolderId: o, projectId: a, file: l, metadata: d } = 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)), d && c.append("metadata", JSON.stringify(d)), await h(this, f, w).call(this, "POST", b, {
|
|
4248
4248
|
body: c
|
|
4249
4249
|
});
|
|
4250
|
-
},
|
|
4250
|
+
}, Jt = async function(e, t, s) {
|
|
4251
4251
|
const { name: r, versionTag: i, parentFolderId: o, file: a, metadata: l } = t;
|
|
4252
|
-
let
|
|
4252
|
+
let d, c;
|
|
4253
4253
|
if (a) {
|
|
4254
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,
|
|
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, w).call(this, "POST", `${b}/${e}/version`, {
|
|
4256
4256
|
body: m
|
|
4257
4257
|
});
|
|
4258
4258
|
}
|
|
@@ -4260,26 +4260,26 @@ f = new WeakSet(), It = function(e) {
|
|
|
4260
4260
|
const m = {
|
|
4261
4261
|
...r && { name: r },
|
|
4262
4262
|
...o && { folderId: o }
|
|
4263
|
-
},
|
|
4264
|
-
|
|
4265
|
-
body:
|
|
4263
|
+
}, T = JSON.stringify(m);
|
|
4264
|
+
d = await h(this, f, w).call(this, "PUT", `${b}/${e}`, {
|
|
4265
|
+
body: T,
|
|
4266
4266
|
contentType: "application/json"
|
|
4267
4267
|
});
|
|
4268
4268
|
}
|
|
4269
|
-
return { item:
|
|
4270
|
-
},
|
|
4269
|
+
return { item: d, version: c };
|
|
4270
|
+
}, Wt = async function(e, t) {
|
|
4271
4271
|
const { showVersions: s = !1 } = t || {};
|
|
4272
|
-
return await h(this, f,
|
|
4272
|
+
return await h(this, f, w).call(this, "GET", `${b}/${e}`, {
|
|
4273
4273
|
query: { showVersions: s }
|
|
4274
4274
|
});
|
|
4275
|
-
},
|
|
4275
|
+
}, zs = function(e) {
|
|
4276
4276
|
return e && Object.entries(e).filter(([, t]) => t !== void 0).reduce(
|
|
4277
4277
|
(t, [s, r]) => (t[s] = r, t),
|
|
4278
4278
|
{}
|
|
4279
4279
|
);
|
|
4280
4280
|
};
|
|
4281
|
-
let
|
|
4282
|
-
function
|
|
4281
|
+
let Ht = is;
|
|
4282
|
+
function Tr() {
|
|
4283
4283
|
if (typeof window > "u" || window.parent === window)
|
|
4284
4284
|
throw new Error(
|
|
4285
4285
|
"client.channel only works inside a That Open app, which runs in an iframe of the platform."
|
|
@@ -4294,80 +4294,80 @@ function br() {
|
|
|
4294
4294
|
}
|
|
4295
4295
|
};
|
|
4296
4296
|
}
|
|
4297
|
-
const
|
|
4298
|
-
function
|
|
4297
|
+
const Yt = "channel:", _r = 1e4;
|
|
4298
|
+
function gt(n) {
|
|
4299
4299
|
try {
|
|
4300
4300
|
n();
|
|
4301
4301
|
} catch (e) {
|
|
4302
4302
|
console.error("[channel] a listener threw:", e);
|
|
4303
4303
|
}
|
|
4304
4304
|
}
|
|
4305
|
-
var
|
|
4306
|
-
class
|
|
4305
|
+
var ae, U, M, xe, Ne, Pe, L, zt, Kt, $e;
|
|
4306
|
+
class Ks {
|
|
4307
4307
|
constructor(e, t) {
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4308
|
+
S(this, L);
|
|
4309
|
+
S(this, ae, !1);
|
|
4310
|
+
S(this, U, []);
|
|
4311
|
+
S(this, M, []);
|
|
4312
|
+
S(this, xe, /* @__PURE__ */ new Set());
|
|
4313
|
+
S(this, Ne, /* @__PURE__ */ new Set());
|
|
4314
|
+
S(this, Pe, /* @__PURE__ */ new Set());
|
|
4315
4315
|
this.transport = e, this.controls = t;
|
|
4316
4316
|
}
|
|
4317
4317
|
/** Whether the platform has confirmed this tab is in the room. */
|
|
4318
4318
|
get joined() {
|
|
4319
|
-
return
|
|
4319
|
+
return u(this, ae);
|
|
4320
4320
|
}
|
|
4321
4321
|
/** Who else is in the room right now, as the platform last reported. */
|
|
4322
4322
|
get peers() {
|
|
4323
|
-
return
|
|
4323
|
+
return u(this, U);
|
|
4324
4324
|
}
|
|
4325
4325
|
/**
|
|
4326
4326
|
* Enters the room. Resolves when the platform confirms; rejects if it
|
|
4327
4327
|
* refuses or does not answer in time. Joining twice is harmless.
|
|
4328
4328
|
*/
|
|
4329
4329
|
join() {
|
|
4330
|
-
return
|
|
4330
|
+
return u(this, ae) ? Promise.resolve() : h(this, L, zt).call(this, "joined", this.controls.join);
|
|
4331
4331
|
}
|
|
4332
4332
|
/** Leaves the room. Handlers stay registered, so `join()` resumes them. */
|
|
4333
4333
|
leave() {
|
|
4334
|
-
return !
|
|
4334
|
+
return !u(this, ae) && !u(this, M).some((e) => e.want === "joined") ? Promise.resolve() : h(this, L, zt).call(this, "left", this.controls.leave);
|
|
4335
4335
|
}
|
|
4336
4336
|
/** Fires when `joined` or `peers` changes. Returns a function that stops it. */
|
|
4337
4337
|
onChange(e) {
|
|
4338
|
-
return
|
|
4338
|
+
return u(this, xe).add(e), () => void u(this, xe).delete(e);
|
|
4339
4339
|
}
|
|
4340
4340
|
onPeerJoined(e) {
|
|
4341
|
-
return
|
|
4341
|
+
return u(this, Ne).add(e), () => void u(this, Ne).delete(e);
|
|
4342
4342
|
}
|
|
4343
4343
|
onPeerLeft(e) {
|
|
4344
|
-
return
|
|
4344
|
+
return u(this, Pe).add(e), () => void u(this, Pe).delete(e);
|
|
4345
4345
|
}
|
|
4346
4346
|
/** @internal */
|
|
4347
4347
|
applyJoined() {
|
|
4348
|
-
|
|
4348
|
+
R(this, ae, !0), h(this, L, Kt).call(this, "joined"), h(this, L, $e).call(this);
|
|
4349
4349
|
}
|
|
4350
4350
|
/** @internal */
|
|
4351
4351
|
applyLeft() {
|
|
4352
|
-
|
|
4352
|
+
R(this, ae, !1), R(this, U, []), h(this, L, Kt).call(this, "left"), h(this, L, $e).call(this);
|
|
4353
4353
|
}
|
|
4354
4354
|
/** @internal */
|
|
4355
4355
|
applyPeers(e) {
|
|
4356
|
-
|
|
4356
|
+
R(this, U, e), h(this, L, $e).call(this);
|
|
4357
4357
|
}
|
|
4358
4358
|
/** @internal */
|
|
4359
4359
|
applyPeerJoined(e) {
|
|
4360
|
-
!
|
|
4360
|
+
!u(this, ae) || u(this, U).some((t) => t.from === e.from) || (R(this, U, [...u(this, U), e]), u(this, Ne).forEach((t) => gt(() => t(e))), h(this, L, $e).call(this));
|
|
4361
4361
|
}
|
|
4362
4362
|
/** @internal */
|
|
4363
4363
|
applyPeerLeft(e) {
|
|
4364
|
-
const t =
|
|
4365
|
-
t && (
|
|
4364
|
+
const t = u(this, U).find((s) => s.from === e);
|
|
4365
|
+
t && (R(this, U, u(this, U).filter((s) => s.from !== e)), u(this, Pe).forEach((s) => gt(() => s(t))), h(this, L, $e).call(this));
|
|
4366
4366
|
}
|
|
4367
4367
|
/** @internal */
|
|
4368
4368
|
failPending(e) {
|
|
4369
|
-
const t =
|
|
4370
|
-
return
|
|
4369
|
+
const t = u(this, M);
|
|
4370
|
+
return R(this, M, []), t.forEach((s) => {
|
|
4371
4371
|
clearTimeout(s.timer), s.reject(e);
|
|
4372
4372
|
}), t.length > 0;
|
|
4373
4373
|
}
|
|
@@ -4375,77 +4375,77 @@ class Ps {
|
|
|
4375
4375
|
this.transport.post(e);
|
|
4376
4376
|
}
|
|
4377
4377
|
}
|
|
4378
|
-
|
|
4378
|
+
ae = new WeakMap(), U = new WeakMap(), M = new WeakMap(), xe = new WeakMap(), Ne = new WeakMap(), Pe = new WeakMap(), L = new WeakSet(), zt = function(e, t) {
|
|
4379
4379
|
return new Promise((s, r) => {
|
|
4380
4380
|
const i = {
|
|
4381
4381
|
want: e,
|
|
4382
4382
|
resolve: s,
|
|
4383
4383
|
reject: r,
|
|
4384
4384
|
timer: setTimeout(() => {
|
|
4385
|
-
|
|
4385
|
+
R(this, M, u(this, M).filter((o) => o !== i)), r(
|
|
4386
4386
|
new Error(
|
|
4387
4387
|
`The platform did not confirm ${e === "joined" ? "joining" : "leaving"} in time.`
|
|
4388
4388
|
)
|
|
4389
4389
|
);
|
|
4390
|
-
},
|
|
4390
|
+
}, _r)
|
|
4391
4391
|
};
|
|
4392
|
-
|
|
4392
|
+
u(this, M).push(i), this.transport.post({ type: "APP_CHANNEL_CONTROL", ...t });
|
|
4393
4393
|
});
|
|
4394
|
-
},
|
|
4395
|
-
const t =
|
|
4396
|
-
|
|
4394
|
+
}, Kt = function(e) {
|
|
4395
|
+
const t = u(this, M).filter((s) => s.want === e);
|
|
4396
|
+
R(this, M, u(this, M).filter((s) => s.want !== e)), t.forEach((s) => {
|
|
4397
4397
|
clearTimeout(s.timer), s.resolve();
|
|
4398
4398
|
});
|
|
4399
|
-
},
|
|
4400
|
-
|
|
4399
|
+
}, $e = function() {
|
|
4400
|
+
u(this, xe).forEach((e) => gt(e));
|
|
4401
4401
|
};
|
|
4402
|
-
var
|
|
4403
|
-
class
|
|
4402
|
+
var Be;
|
|
4403
|
+
class Ir extends Ks {
|
|
4404
4404
|
/** @internal Use `client.channel.collab()`. */
|
|
4405
4405
|
constructor(t) {
|
|
4406
4406
|
super(t, {
|
|
4407
4407
|
join: { action: "joinCollab" },
|
|
4408
4408
|
leave: { action: "leaveCollab" }
|
|
4409
4409
|
});
|
|
4410
|
-
|
|
4410
|
+
S(this, Be, /* @__PURE__ */ new Map());
|
|
4411
4411
|
}
|
|
4412
4412
|
/**
|
|
4413
4413
|
* Listens for an event other tabs send. Any number of listeners per event.
|
|
4414
4414
|
* @returns a function that removes the listener.
|
|
4415
4415
|
*/
|
|
4416
4416
|
on(t, s) {
|
|
4417
|
-
const r =
|
|
4418
|
-
return r.add(s),
|
|
4417
|
+
const r = u(this, Be).get(t) ?? /* @__PURE__ */ new Set();
|
|
4418
|
+
return r.add(s), u(this, Be).set(t, r), () => void r.delete(s);
|
|
4419
4419
|
}
|
|
4420
4420
|
/**
|
|
4421
4421
|
* Sends an event to the other tabs in the room. Does nothing while this tab
|
|
4422
4422
|
* is not in it, matching what the platform does with a message from outside.
|
|
4423
4423
|
*/
|
|
4424
4424
|
send(t, s) {
|
|
4425
|
-
if (t.startsWith(
|
|
4426
|
-
throw new Error(`Message types starting with '${
|
|
4425
|
+
if (t.startsWith(Yt))
|
|
4426
|
+
throw new Error(`Message types starting with '${Yt}' are reserved.`);
|
|
4427
4427
|
this.joined && this.post({ type: "APP_CHANNEL_PUBLISH", message: { type: t, payload: s } });
|
|
4428
4428
|
}
|
|
4429
4429
|
accepts(t) {
|
|
4430
4430
|
return t === void 0 || t === "collab";
|
|
4431
4431
|
}
|
|
4432
4432
|
async handle(t) {
|
|
4433
|
-
const s =
|
|
4433
|
+
const s = u(this, Be).get(t.type);
|
|
4434
4434
|
if (!(s != null && s.size)) return { handled: !1 };
|
|
4435
|
-
const r =
|
|
4436
|
-
return s.forEach((i) =>
|
|
4435
|
+
const r = Xs(t);
|
|
4436
|
+
return s.forEach((i) => gt(() => i(t.payload, r))), { handled: !0 };
|
|
4437
4437
|
}
|
|
4438
4438
|
}
|
|
4439
|
-
|
|
4440
|
-
var
|
|
4441
|
-
class
|
|
4439
|
+
Be = new WeakMap();
|
|
4440
|
+
var pe;
|
|
4441
|
+
class Sr extends Ks {
|
|
4442
4442
|
/** @internal Use `client.channel.external(kind)`. */
|
|
4443
4443
|
constructor(t, s) {
|
|
4444
4444
|
super(t, {
|
|
4445
4445
|
join: { action: "joinExternal", kind: s },
|
|
4446
4446
|
leave: { action: "leaveExternal", kind: s }
|
|
4447
4447
|
});
|
|
4448
|
-
|
|
4448
|
+
S(this, pe, /* @__PURE__ */ new Map());
|
|
4449
4449
|
this.kind = s;
|
|
4450
4450
|
}
|
|
4451
4451
|
/**
|
|
@@ -4459,24 +4459,24 @@ class _r extends Ps {
|
|
|
4459
4459
|
* @returns a function that removes the handler.
|
|
4460
4460
|
*/
|
|
4461
4461
|
on(t, s) {
|
|
4462
|
-
if (
|
|
4462
|
+
if (u(this, pe).has(t))
|
|
4463
4463
|
throw new Error(
|
|
4464
4464
|
`"${t}" already has a handler in this room. Remove it first.`
|
|
4465
4465
|
);
|
|
4466
|
-
return
|
|
4466
|
+
return u(this, pe).set(t, s), () => void u(this, pe).delete(t);
|
|
4467
4467
|
}
|
|
4468
4468
|
accepts(t, s) {
|
|
4469
4469
|
return t !== void 0 && t !== "external" ? !1 : this.kind === void 0 || t === void 0 || this.kind === s;
|
|
4470
4470
|
}
|
|
4471
4471
|
/** @internal Whether this room has any handler at all. */
|
|
4472
4472
|
get hasHandlers() {
|
|
4473
|
-
return
|
|
4473
|
+
return u(this, pe).size > 0;
|
|
4474
4474
|
}
|
|
4475
4475
|
async handle(t) {
|
|
4476
|
-
const s =
|
|
4476
|
+
const s = u(this, pe).get(t.type);
|
|
4477
4477
|
if (!s) return { handled: !1 };
|
|
4478
4478
|
try {
|
|
4479
|
-
return { handled: !0, value: await s(t.payload,
|
|
4479
|
+
return { handled: !0, value: await s(t.payload, Xs(t)) };
|
|
4480
4480
|
} catch (r) {
|
|
4481
4481
|
return {
|
|
4482
4482
|
handled: !0,
|
|
@@ -4485,8 +4485,8 @@ class _r extends Ps {
|
|
|
4485
4485
|
}
|
|
4486
4486
|
}
|
|
4487
4487
|
}
|
|
4488
|
-
|
|
4489
|
-
function
|
|
4488
|
+
pe = new WeakMap();
|
|
4489
|
+
function Xs(n) {
|
|
4490
4490
|
return {
|
|
4491
4491
|
from: n.from,
|
|
4492
4492
|
at: n.at,
|
|
@@ -4494,7 +4494,7 @@ function Bs(n) {
|
|
|
4494
4494
|
kind: n.kind
|
|
4495
4495
|
};
|
|
4496
4496
|
}
|
|
4497
|
-
function
|
|
4497
|
+
function kr(n) {
|
|
4498
4498
|
const e = n;
|
|
4499
4499
|
if ((e == null ? void 0 : e.type) !== "THATOPEN_CHANNEL_MESSAGE") return null;
|
|
4500
4500
|
const t = e.message;
|
|
@@ -4508,20 +4508,20 @@ function Tr(n) {
|
|
|
4508
4508
|
kind: typeof t.kind == "string" ? t.kind : void 0
|
|
4509
4509
|
};
|
|
4510
4510
|
}
|
|
4511
|
-
var
|
|
4512
|
-
class
|
|
4511
|
+
var Se, et, ce, me, ye, $, Xt, wt, Qs, Zs, en, Qt;
|
|
4512
|
+
class Or {
|
|
4513
4513
|
constructor(e) {
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4514
|
+
S(this, $);
|
|
4515
|
+
S(this, Se);
|
|
4516
|
+
S(this, et);
|
|
4517
|
+
S(this, ce);
|
|
4518
|
+
S(this, me, /* @__PURE__ */ new Map());
|
|
4519
|
+
S(this, ye, /* @__PURE__ */ new Set());
|
|
4520
|
+
R(this, Se, e), R(this, et, e.listen((t) => void h(this, $, Qs).call(this, t)));
|
|
4521
4521
|
}
|
|
4522
4522
|
/** The collaboration room for this app. Always the same instance. */
|
|
4523
4523
|
collab() {
|
|
4524
|
-
return
|
|
4524
|
+
return u(this, ce) ?? R(this, ce, new Ir(u(this, Se))), u(this, ce);
|
|
4525
4525
|
}
|
|
4526
4526
|
/**
|
|
4527
4527
|
* The room for commands from this account's external tools of one `kind`
|
|
@@ -4530,46 +4530,46 @@ class Ir {
|
|
|
4530
4530
|
*/
|
|
4531
4531
|
external(e) {
|
|
4532
4532
|
const t = e ?? "";
|
|
4533
|
-
let s =
|
|
4534
|
-
return s || (s = new
|
|
4533
|
+
let s = u(this, me).get(t);
|
|
4534
|
+
return s || (s = new Sr(u(this, Se), e), u(this, me).set(t, s)), s;
|
|
4535
4535
|
}
|
|
4536
4536
|
/** Stops listening. For tests and teardown; an app normally never calls it. */
|
|
4537
4537
|
dispose() {
|
|
4538
|
-
|
|
4538
|
+
u(this, et).call(this);
|
|
4539
4539
|
}
|
|
4540
4540
|
}
|
|
4541
|
-
|
|
4542
|
-
return [...
|
|
4543
|
-
},
|
|
4544
|
-
if (e === "collab") return
|
|
4541
|
+
Se = new WeakMap(), et = new WeakMap(), ce = new WeakMap(), me = new WeakMap(), ye = new WeakMap(), $ = new WeakSet(), Xt = function() {
|
|
4542
|
+
return [...u(this, ce) ? [u(this, ce)] : [], ...u(this, me).values()];
|
|
4543
|
+
}, wt = function(e, t) {
|
|
4544
|
+
if (e === "collab") return u(this, ce);
|
|
4545
4545
|
if (e === "external")
|
|
4546
|
-
return
|
|
4547
|
-
},
|
|
4548
|
-
const t =
|
|
4546
|
+
return u(this, me).get(typeof t == "string" ? t : "");
|
|
4547
|
+
}, Qs = async function(e) {
|
|
4548
|
+
const t = kr(e);
|
|
4549
4549
|
if (t) {
|
|
4550
|
-
if (t.type.startsWith(
|
|
4551
|
-
h(this,
|
|
4550
|
+
if (t.type.startsWith(Yt)) {
|
|
4551
|
+
h(this, $, Zs).call(this, t);
|
|
4552
4552
|
return;
|
|
4553
4553
|
}
|
|
4554
|
-
await h(this,
|
|
4554
|
+
await h(this, $, en).call(this, t);
|
|
4555
4555
|
}
|
|
4556
|
-
},
|
|
4556
|
+
}, Zs = function(e) {
|
|
4557
4557
|
var s, r, i;
|
|
4558
4558
|
const t = e.payload ?? {};
|
|
4559
4559
|
switch (e.type) {
|
|
4560
4560
|
case "channel:joined":
|
|
4561
|
-
(s = h(this,
|
|
4561
|
+
(s = h(this, $, wt).call(this, t.scope, t.kind)) == null || s.applyJoined();
|
|
4562
4562
|
break;
|
|
4563
4563
|
case "channel:left":
|
|
4564
|
-
(r = h(this,
|
|
4564
|
+
(r = h(this, $, wt).call(this, t.scope, t.kind)) == null || r.applyLeft();
|
|
4565
4565
|
break;
|
|
4566
4566
|
case "channel:peers":
|
|
4567
|
-
(i = h(this,
|
|
4567
|
+
(i = h(this, $, wt).call(this, t.scope, t.kind)) == null || i.applyPeers(t.peers ?? []);
|
|
4568
4568
|
break;
|
|
4569
4569
|
case "channel:peer-joined":
|
|
4570
4570
|
case "channel:peer-left": {
|
|
4571
4571
|
if (!t.from) break;
|
|
4572
|
-
const o = t.scope === "collab" ? [
|
|
4572
|
+
const o = t.scope === "collab" ? [u(this, ce)] : [...u(this, me).values()].filter(
|
|
4573
4573
|
(a) => a.accepts("external", t.kind)
|
|
4574
4574
|
);
|
|
4575
4575
|
for (const a of o)
|
|
@@ -4578,23 +4578,23 @@ pe = new WeakMap(), Fe = new WeakMap(), ee = new WeakMap(), he = new WeakMap(),
|
|
|
4578
4578
|
}
|
|
4579
4579
|
case "channel:error": {
|
|
4580
4580
|
const o = new Error(String(e.payload));
|
|
4581
|
-
h(this,
|
|
4581
|
+
h(this, $, Xt).call(this).map((l) => l.failPending(o)).some(Boolean) || console.error("[channel] error:", e.payload);
|
|
4582
4582
|
break;
|
|
4583
4583
|
}
|
|
4584
4584
|
}
|
|
4585
|
-
},
|
|
4586
|
-
const t = h(this,
|
|
4585
|
+
}, en = async function(e) {
|
|
4586
|
+
const t = h(this, $, Xt).call(this).filter((i) => i.accepts(e.scope, e.kind));
|
|
4587
4587
|
let s = !1;
|
|
4588
4588
|
for (const i of t) {
|
|
4589
4589
|
const o = await i.handle(e);
|
|
4590
|
-
o.handled && (s = !0, e.requestId && h(this,
|
|
4590
|
+
o.handled && (s = !0, e.requestId && h(this, $, Qt).call(this, e.requestId, o));
|
|
4591
4591
|
}
|
|
4592
|
-
e.requestId && e.scope === "external" && t.length > 0 && !s && h(this,
|
|
4592
|
+
e.requestId && e.scope === "external" && t.length > 0 && !s && h(this, $, Qt).call(this, e.requestId, {
|
|
4593
4593
|
handled: !0,
|
|
4594
4594
|
error: `No handler for "${e.type}".`
|
|
4595
4595
|
});
|
|
4596
|
-
},
|
|
4597
|
-
|
|
4596
|
+
}, Qt = function(e, t) {
|
|
4597
|
+
u(this, ye).has(e) || (u(this, ye).add(e), u(this, ye).size > 500 && u(this, ye).delete(u(this, ye).values().next().value), u(this, Se).post({
|
|
4598
4598
|
type: "APP_CHANNEL_PUBLISH",
|
|
4599
4599
|
message: {
|
|
4600
4600
|
type: t.error === void 0 ? "reply" : "reply-error",
|
|
@@ -4603,9 +4603,9 @@ pe = new WeakMap(), Fe = new WeakMap(), ee = new WeakMap(), he = new WeakMap(),
|
|
|
4603
4603
|
}
|
|
4604
4604
|
}));
|
|
4605
4605
|
};
|
|
4606
|
-
const
|
|
4607
|
-
var
|
|
4608
|
-
const
|
|
4606
|
+
const Ie = "project", Ae = "notifications";
|
|
4607
|
+
var Le, tt;
|
|
4608
|
+
const os = class os extends Ht {
|
|
4609
4609
|
/**
|
|
4610
4610
|
* @param token - A bearer JWT, OR a function returning the current JWT
|
|
4611
4611
|
* (sync or async). When a function is passed, it's invoked before every
|
|
@@ -4616,12 +4616,12 @@ const jt = class jt extends Tt {
|
|
|
4616
4616
|
*/
|
|
4617
4617
|
constructor(t, s, r) {
|
|
4618
4618
|
super(typeof t == "string" ? t : "", s, { ...r, useBearer: !0 });
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
typeof t == "function" &&
|
|
4619
|
+
S(this, Le);
|
|
4620
|
+
S(this, tt);
|
|
4621
|
+
typeof t == "function" && R(this, Le, t);
|
|
4622
4622
|
}
|
|
4623
4623
|
async resolveAccessToken() {
|
|
4624
|
-
return
|
|
4624
|
+
return u(this, Le) ? await u(this, Le).call(this) : super.resolveAccessToken();
|
|
4625
4625
|
}
|
|
4626
4626
|
/**
|
|
4627
4627
|
* Creates a client from the platform context injected into
|
|
@@ -4630,7 +4630,7 @@ const jt = class jt extends Tt {
|
|
|
4630
4630
|
* carries a fresh JWT on every navigation.
|
|
4631
4631
|
*/
|
|
4632
4632
|
static fromPlatformContext(t) {
|
|
4633
|
-
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new
|
|
4633
|
+
const s = (typeof window < "u" ? window.__THATOPEN_CONTEXT__ : null) || { appId: "", projectId: "", accessToken: "", apiUrl: "" }, r = new os(s.accessToken, s.apiUrl, t);
|
|
4634
4634
|
return r.context = s, r;
|
|
4635
4635
|
}
|
|
4636
4636
|
/**
|
|
@@ -4658,7 +4658,7 @@ const jt = class jt extends Tt {
|
|
|
4658
4658
|
* ```
|
|
4659
4659
|
*/
|
|
4660
4660
|
get channel() {
|
|
4661
|
-
return
|
|
4661
|
+
return u(this, tt) ?? R(this, tt, new Or(Tr())), u(this, tt);
|
|
4662
4662
|
}
|
|
4663
4663
|
// ─── Projects (JWT-only backend routes) ──────────────────────────
|
|
4664
4664
|
/**
|
|
@@ -4677,14 +4677,14 @@ const jt = class jt extends Tt {
|
|
|
4677
4677
|
* ```
|
|
4678
4678
|
*/
|
|
4679
4679
|
async listProjects() {
|
|
4680
|
-
return await this.request("GET",
|
|
4680
|
+
return await this.request("GET", Ie);
|
|
4681
4681
|
}
|
|
4682
4682
|
/**
|
|
4683
4683
|
* Gets a project by ID. JWT-only — lives here because
|
|
4684
4684
|
* `GET /project/:id` is guarded by `AccountActiveGuard + ProjectAccessGuard`.
|
|
4685
4685
|
*/
|
|
4686
4686
|
async getProject(t) {
|
|
4687
|
-
return await this.request("GET", `${
|
|
4687
|
+
return await this.request("GET", `${Ie}/${t}`);
|
|
4688
4688
|
}
|
|
4689
4689
|
/**
|
|
4690
4690
|
* Gets the full project data (users, roles, files, folders) for a project.
|
|
@@ -4693,7 +4693,7 @@ const jt = class jt extends Tt {
|
|
|
4693
4693
|
async getProjectData(t) {
|
|
4694
4694
|
return await this.request(
|
|
4695
4695
|
"GET",
|
|
4696
|
-
`${
|
|
4696
|
+
`${Ie}/${t}/data`
|
|
4697
4697
|
);
|
|
4698
4698
|
}
|
|
4699
4699
|
// ─── Account ──────────────────────────────────────────────────────
|
|
@@ -4718,7 +4718,7 @@ const jt = class jt extends Tt {
|
|
|
4718
4718
|
async checkPermission(t) {
|
|
4719
4719
|
return await this.request(
|
|
4720
4720
|
"GET",
|
|
4721
|
-
`${
|
|
4721
|
+
`${Ie}/permissions/check`,
|
|
4722
4722
|
{ query: t }
|
|
4723
4723
|
);
|
|
4724
4724
|
}
|
|
@@ -4727,7 +4727,7 @@ const jt = class jt extends Tt {
|
|
|
4727
4727
|
* single round-trip; results come back in the same order as `checks`.
|
|
4728
4728
|
*/
|
|
4729
4729
|
async checkPermissionBatch(t) {
|
|
4730
|
-
return (await this.request("POST", `${
|
|
4730
|
+
return (await this.request("POST", `${Ie}/permissions/check/batch`, {
|
|
4731
4731
|
body: JSON.stringify({ checks: t }),
|
|
4732
4732
|
contentType: "application/json"
|
|
4733
4733
|
})).results;
|
|
@@ -4755,7 +4755,7 @@ const jt = class jt extends Tt {
|
|
|
4755
4755
|
* ```
|
|
4756
4756
|
*/
|
|
4757
4757
|
async getNotifications(t) {
|
|
4758
|
-
return await this.request("GET",
|
|
4758
|
+
return await this.request("GET", Ae, {
|
|
4759
4759
|
query: {
|
|
4760
4760
|
...(t == null ? void 0 : t.cursor) !== void 0 && { cursor: t.cursor },
|
|
4761
4761
|
...(t == null ? void 0 : t.limit) !== void 0 && { limit: String(t.limit) }
|
|
@@ -4769,7 +4769,7 @@ const jt = class jt extends Tt {
|
|
|
4769
4769
|
async getUnreadNotificationCount() {
|
|
4770
4770
|
return (await this.request(
|
|
4771
4771
|
"GET",
|
|
4772
|
-
`${
|
|
4772
|
+
`${Ae}/unread-count`
|
|
4773
4773
|
)).count;
|
|
4774
4774
|
}
|
|
4775
4775
|
/**
|
|
@@ -4780,7 +4780,7 @@ const jt = class jt extends Tt {
|
|
|
4780
4780
|
async markNotificationsRead(t) {
|
|
4781
4781
|
return await this.request(
|
|
4782
4782
|
"POST",
|
|
4783
|
-
`${
|
|
4783
|
+
`${Ae}/mark-read`,
|
|
4784
4784
|
{
|
|
4785
4785
|
body: JSON.stringify({ ids: t }),
|
|
4786
4786
|
contentType: "application/json"
|
|
@@ -4791,7 +4791,7 @@ const jt = class jt extends Tt {
|
|
|
4791
4791
|
async markAllNotificationsRead() {
|
|
4792
4792
|
return await this.request(
|
|
4793
4793
|
"POST",
|
|
4794
|
-
`${
|
|
4794
|
+
`${Ae}/mark-all-read`
|
|
4795
4795
|
);
|
|
4796
4796
|
}
|
|
4797
4797
|
/**
|
|
@@ -4801,7 +4801,7 @@ const jt = class jt extends Tt {
|
|
|
4801
4801
|
async getNotificationSubscriptions() {
|
|
4802
4802
|
return await this.request(
|
|
4803
4803
|
"GET",
|
|
4804
|
-
`${
|
|
4804
|
+
`${Ae}/subscriptions`
|
|
4805
4805
|
);
|
|
4806
4806
|
}
|
|
4807
4807
|
/**
|
|
@@ -4815,7 +4815,7 @@ const jt = class jt extends Tt {
|
|
|
4815
4815
|
async unsubscribeFromAutomation(t) {
|
|
4816
4816
|
return await this.request(
|
|
4817
4817
|
"DELETE",
|
|
4818
|
-
`${
|
|
4818
|
+
`${Ae}/subscriptions/${t}`
|
|
4819
4819
|
);
|
|
4820
4820
|
}
|
|
4821
4821
|
/**
|
|
@@ -4839,7 +4839,7 @@ const jt = class jt extends Tt {
|
|
|
4839
4839
|
async subscribeToAutomation(t, s, r) {
|
|
4840
4840
|
return await this.request(
|
|
4841
4841
|
"POST",
|
|
4842
|
-
`${
|
|
4842
|
+
`${Ie}/${t}/events/hooks/${s}/subscription`,
|
|
4843
4843
|
{
|
|
4844
4844
|
body: JSON.stringify(r ?? {}),
|
|
4845
4845
|
contentType: "application/json"
|
|
@@ -4856,7 +4856,7 @@ const jt = class jt extends Tt {
|
|
|
4856
4856
|
async updateAutomationSubscription(t, s, r) {
|
|
4857
4857
|
return await this.request(
|
|
4858
4858
|
"PATCH",
|
|
4859
|
-
`${
|
|
4859
|
+
`${Ie}/${t}/events/hooks/${s}/subscription`,
|
|
4860
4860
|
{
|
|
4861
4861
|
body: JSON.stringify(r),
|
|
4862
4862
|
contentType: "application/json"
|
|
@@ -4890,7 +4890,7 @@ const jt = class jt extends Tt {
|
|
|
4890
4890
|
* ```
|
|
4891
4891
|
*/
|
|
4892
4892
|
async onNotification(t) {
|
|
4893
|
-
const s = await this.resolveAccessToken(), r =
|
|
4893
|
+
const s = await this.resolveAccessToken(), r = Ke(`${this.socketOrigin}/notifications`, {
|
|
4894
4894
|
auth: { accessToken: s },
|
|
4895
4895
|
transports: ["websocket"]
|
|
4896
4896
|
});
|
|
@@ -4906,11 +4906,11 @@ const jt = class jt extends Tt {
|
|
|
4906
4906
|
), () => r.disconnect();
|
|
4907
4907
|
}
|
|
4908
4908
|
};
|
|
4909
|
-
|
|
4910
|
-
let
|
|
4911
|
-
async function
|
|
4912
|
-
const [e, t] = await
|
|
4913
|
-
new e.ByteBuffer(await
|
|
4909
|
+
Le = new WeakMap(), tt = new WeakMap();
|
|
4910
|
+
let Ts = os;
|
|
4911
|
+
async function tn(n) {
|
|
4912
|
+
const [e, t] = await Ar(), s = t.Model.getRootAsModel(
|
|
4913
|
+
new e.ByteBuffer(await Rr(n))
|
|
4914
4914
|
);
|
|
4915
4915
|
let r = {};
|
|
4916
4916
|
try {
|
|
@@ -4919,20 +4919,20 @@ async function js(n) {
|
|
|
4919
4919
|
}
|
|
4920
4920
|
const i = /* @__PURE__ */ new Map();
|
|
4921
4921
|
for (let a = 0; a < s.guidsLength(); a++) {
|
|
4922
|
-
const l = s.guidsItems(a),
|
|
4923
|
-
l !== null &&
|
|
4922
|
+
const l = s.guidsItems(a), d = s.guids(a);
|
|
4923
|
+
l !== null && d && i.set(l, d);
|
|
4924
4924
|
}
|
|
4925
4925
|
const o = [];
|
|
4926
4926
|
for (let a = 0; a < s.attributesLength(); a++) {
|
|
4927
4927
|
const l = s.localIds(a);
|
|
4928
4928
|
if (l === null) continue;
|
|
4929
|
-
const
|
|
4929
|
+
const d = {}, c = s.attributes(a);
|
|
4930
4930
|
for (let m = 0; m < ((c == null ? void 0 : c.dataLength()) ?? 0); m++) {
|
|
4931
|
-
const
|
|
4932
|
-
if (
|
|
4931
|
+
const T = c.data(m);
|
|
4932
|
+
if (T)
|
|
4933
4933
|
try {
|
|
4934
|
-
const [
|
|
4935
|
-
|
|
4934
|
+
const [A, _] = JSON.parse(T);
|
|
4935
|
+
d[A] = _;
|
|
4936
4936
|
} catch {
|
|
4937
4937
|
}
|
|
4938
4938
|
}
|
|
@@ -4940,12 +4940,12 @@ async function js(n) {
|
|
|
4940
4940
|
localId: l,
|
|
4941
4941
|
guid: i.get(l) ?? null,
|
|
4942
4942
|
category: s.categories(a) ?? null,
|
|
4943
|
-
attrs:
|
|
4943
|
+
attrs: d
|
|
4944
4944
|
});
|
|
4945
4945
|
}
|
|
4946
4946
|
return { metadata: r, items: o };
|
|
4947
4947
|
}
|
|
4948
|
-
async function
|
|
4948
|
+
async function Ar() {
|
|
4949
4949
|
try {
|
|
4950
4950
|
return await Promise.all([
|
|
4951
4951
|
import("flatbuffers"),
|
|
@@ -4957,14 +4957,14 @@ async function Sr() {
|
|
|
4957
4957
|
);
|
|
4958
4958
|
}
|
|
4959
4959
|
}
|
|
4960
|
-
async function
|
|
4960
|
+
async function Rr(n) {
|
|
4961
4961
|
const e = new Blob([n]).stream().pipeThrough(new DecompressionStream("deflate"));
|
|
4962
4962
|
return new Uint8Array(await new Response(e).arrayBuffer());
|
|
4963
4963
|
}
|
|
4964
|
-
const
|
|
4965
|
-
class
|
|
4964
|
+
const Cr = "flow:", $r = "flow:op", xr = "flow:source", Nr = "revitflow/op@2", _s = "REVITFLOWCHANGE", Is = "REVITFLOWOPERATION";
|
|
4965
|
+
class sn {
|
|
4966
4966
|
constructor(e) {
|
|
4967
|
-
|
|
4967
|
+
B(this, "changes", []);
|
|
4968
4968
|
this.target = e;
|
|
4969
4969
|
}
|
|
4970
4970
|
/** How many changes are queued. An operation with none is refused by `build`. */
|
|
@@ -5030,7 +5030,7 @@ class Ds {
|
|
|
5030
5030
|
"An operation with no changes is not an operation. Add at least one."
|
|
5031
5031
|
);
|
|
5032
5032
|
const t = {
|
|
5033
|
-
schema:
|
|
5033
|
+
schema: Nr,
|
|
5034
5034
|
opId: e,
|
|
5035
5035
|
// Through the getters, so the envelope and the queue entry cannot drift
|
|
5036
5036
|
// into disagreeing about the same operation.
|
|
@@ -5042,8 +5042,8 @@ class Ds {
|
|
|
5042
5042
|
...this.userId ? { userId: this.userId } : {},
|
|
5043
5043
|
title: this.title,
|
|
5044
5044
|
summary: this.summary
|
|
5045
|
-
}, [s, r] = await
|
|
5046
|
-
return
|
|
5045
|
+
}, [s, r] = await Pr();
|
|
5046
|
+
return Br(
|
|
5047
5047
|
this.flatbuffer(s, r, e, JSON.stringify(t))
|
|
5048
5048
|
);
|
|
5049
5049
|
}
|
|
@@ -5052,8 +5052,8 @@ class Ds {
|
|
|
5052
5052
|
pack(e, t) {
|
|
5053
5053
|
const s = {};
|
|
5054
5054
|
for (const [r, i] of Object.entries(e ?? {}))
|
|
5055
|
-
r.startsWith(
|
|
5056
|
-
return t.position && (s.Position = t.position.map(
|
|
5055
|
+
r.startsWith(Cr) || (s[r] = String(i));
|
|
5056
|
+
return t.position && (s.Position = t.position.map(Ss).join(",")), t.rotationDeg !== void 0 && (s.Rotation = Ss(t.rotationDeg)), t.source && (s[xr] = t.source), s;
|
|
5057
5057
|
}
|
|
5058
5058
|
requireId(e, t) {
|
|
5059
5059
|
if (!e || !e.trim())
|
|
@@ -5075,61 +5075,61 @@ class Ds {
|
|
|
5075
5075
|
* and rejects a falsy one.
|
|
5076
5076
|
*/
|
|
5077
5077
|
flatbuffer(e, t, s, r) {
|
|
5078
|
-
const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform:
|
|
5079
|
-
let
|
|
5080
|
-
for (let
|
|
5081
|
-
const
|
|
5082
|
-
o.startMeshes(c), o.addCoordinates(c,
|
|
5083
|
-
const
|
|
5084
|
-
for (const
|
|
5085
|
-
const
|
|
5086
|
-
[
|
|
5087
|
-
...
|
|
5078
|
+
const { Attribute: i, Meshes: o, Model: a, SpatialStructure: l, Transform: d } = t, c = new e.Builder(1024), m = this.changes.length, T = new Uint32Array(m);
|
|
5079
|
+
let A = 1;
|
|
5080
|
+
for (let I = 0; I < m; I++) T[I] = A++;
|
|
5081
|
+
const _ = A++, E = (I) => (I(c, 0), c.endVector()), N = o.createShellsVector(c, []), we = o.createCircleExtrusionsVector(c, []), H = E(o.startSamplesVector), z = E(o.startRepresentationsVector), De = E(o.startMaterialsVector), K = E(o.startLocalTransformsVector), O = E(o.startGlobalTransformsVector), q = o.createMeshesItemsVector(c, []), X = o.createMaterialIdsVector(c, []), be = o.createRepresentationIdsVector(c, []), ve = o.createSampleIdsVector(c, []), Ee = o.createLocalTransformIdsVector(c, []), qe = o.createGlobalTransformIdsVector(c, []);
|
|
5082
|
+
o.startMeshes(c), o.addCoordinates(c, d.createTransform(c, 0, 0, 0, 1, 0, 0, 0, 1, 0)), o.addGlobalTransforms(c, O), o.addShells(c, N), o.addRepresentations(c, z), o.addSamples(c, H), o.addLocalTransforms(c, K), o.addMaterials(c, De), o.addCircleExtrusions(c, we), o.addMeshesItems(c, q), o.addRepresentationIds(c, be), o.addSampleIds(c, ve), o.addMaterialIds(c, X), o.addLocalTransformIds(c, Ee), o.addGlobalTransformIds(c, qe);
|
|
5083
|
+
const je = o.endMeshes(c), Te = c.createString(r), Ue = /* @__PURE__ */ new Set(), Oe = [];
|
|
5084
|
+
for (const I of this.changes) {
|
|
5085
|
+
const D = [], _e = {
|
|
5086
|
+
[$r]: I.op,
|
|
5087
|
+
...I.attrs
|
|
5088
5088
|
};
|
|
5089
|
-
for (const [
|
|
5090
|
-
const
|
|
5091
|
-
|
|
5089
|
+
for (const [j, G] of Object.entries(_e)) {
|
|
5090
|
+
const Q = JSON.stringify([j, G, "IFCTEXT"]);
|
|
5091
|
+
Ue.add(Q), D.push(c.createString(Q));
|
|
5092
5092
|
}
|
|
5093
|
-
|
|
5094
|
-
i.createAttribute(c, i.createDataVector(c,
|
|
5093
|
+
Oe.push(
|
|
5094
|
+
i.createAttribute(c, i.createDataVector(c, D))
|
|
5095
5095
|
);
|
|
5096
5096
|
}
|
|
5097
5097
|
{
|
|
5098
|
-
const
|
|
5099
|
-
|
|
5100
|
-
const
|
|
5101
|
-
|
|
5098
|
+
const I = JSON.stringify(["Name", s, "IFCLABEL"]);
|
|
5099
|
+
Ue.add(I);
|
|
5100
|
+
const D = i.createDataVector(c, [c.createString(I)]);
|
|
5101
|
+
Oe.push(i.createAttribute(c, D));
|
|
5102
5102
|
}
|
|
5103
|
-
const
|
|
5103
|
+
const st = a.createAttributesVector(c, Oe), nt = a.createUniqueAttributesVector(
|
|
5104
5104
|
c,
|
|
5105
|
-
[...
|
|
5106
|
-
),
|
|
5107
|
-
() => c.createString(
|
|
5105
|
+
[...Ue].map((I) => c.createString(I))
|
|
5106
|
+
), Me = this.changes.map(
|
|
5107
|
+
() => c.createString(_s)
|
|
5108
5108
|
);
|
|
5109
|
-
|
|
5110
|
-
const
|
|
5111
|
-
this.changes.forEach((
|
|
5112
|
-
|
|
5109
|
+
Me.push(c.createString(Is));
|
|
5110
|
+
const rt = a.createCategoriesVector(c, Me), Ve = [], He = [];
|
|
5111
|
+
this.changes.forEach((I, D) => {
|
|
5112
|
+
I.item && (Ve.push(c.createString(I.item)), He.push(T[D]));
|
|
5113
5113
|
});
|
|
5114
|
-
const
|
|
5115
|
-
(
|
|
5114
|
+
const g = a.createGuidsVector(c, Ve), y = a.createGuidsItemsVector(c, He), k = a.createLocalIdsVector(c, [...T, _]), x = this.changes.map(
|
|
5115
|
+
(I, D) => l.createSpatialStructure(
|
|
5116
5116
|
c,
|
|
5117
|
-
|
|
5118
|
-
c.createString(
|
|
5117
|
+
T[D],
|
|
5118
|
+
c.createString(_s),
|
|
5119
5119
|
0
|
|
5120
5120
|
)
|
|
5121
|
-
),
|
|
5121
|
+
), P = l.createSpatialStructure(
|
|
5122
5122
|
c,
|
|
5123
|
-
|
|
5124
|
-
c.createString(
|
|
5125
|
-
l.createChildrenVector(c,
|
|
5126
|
-
),
|
|
5127
|
-
a.startModel(c), a.addMeshes(c,
|
|
5128
|
-
const
|
|
5129
|
-
return a.finishModelBuffer(c,
|
|
5123
|
+
_,
|
|
5124
|
+
c.createString(Is),
|
|
5125
|
+
l.createChildrenVector(c, x)
|
|
5126
|
+
), F = c.createString(s);
|
|
5127
|
+
a.startModel(c), a.addMeshes(c, je), a.addMetadata(c, Te), a.addAttributes(c, st), a.addUniqueAttributes(c, nt), a.addLocalIds(c, k), a.addCategories(c, rt), a.addGuidsItems(c, y), a.addGuids(c, g), a.addGuid(c, F), a.addSpatialStructure(c, P), a.addMaxLocalId(c, A);
|
|
5128
|
+
const he = a.endModel(c);
|
|
5129
|
+
return a.finishModelBuffer(c, he), c.asUint8Array();
|
|
5130
5130
|
}
|
|
5131
5131
|
}
|
|
5132
|
-
async function
|
|
5132
|
+
async function Pr() {
|
|
5133
5133
|
try {
|
|
5134
5134
|
return await Promise.all([
|
|
5135
5135
|
import("flatbuffers"),
|
|
@@ -5141,18 +5141,18 @@ async function $r() {
|
|
|
5141
5141
|
);
|
|
5142
5142
|
}
|
|
5143
5143
|
}
|
|
5144
|
-
function
|
|
5144
|
+
function Ss(n) {
|
|
5145
5145
|
return Number.isFinite(n) ? String(n) : "0";
|
|
5146
5146
|
}
|
|
5147
|
-
async function
|
|
5147
|
+
async function Br(n) {
|
|
5148
5148
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("deflate"));
|
|
5149
5149
|
return new Uint8Array(await new Response(e).arrayBuffer());
|
|
5150
5150
|
}
|
|
5151
|
-
const
|
|
5152
|
-
function
|
|
5151
|
+
const Lr = "Element", Fr = "Carried", nn = 1 / 0.3048;
|
|
5152
|
+
function Dr(n) {
|
|
5153
5153
|
const e = [];
|
|
5154
5154
|
for (const t of n)
|
|
5155
|
-
for (const s of [
|
|
5155
|
+
for (const s of [Lr, Fr]) {
|
|
5156
5156
|
const r = t.attrs[s];
|
|
5157
5157
|
if (r)
|
|
5158
5158
|
try {
|
|
@@ -5171,7 +5171,7 @@ function Br(n) {
|
|
|
5171
5171
|
}
|
|
5172
5172
|
return e;
|
|
5173
5173
|
}
|
|
5174
|
-
function
|
|
5174
|
+
function ht(n, e) {
|
|
5175
5175
|
const t = n.params[e];
|
|
5176
5176
|
if (typeof t != "string") return null;
|
|
5177
5177
|
try {
|
|
@@ -5180,16 +5180,25 @@ function hs(n, e) {
|
|
|
5180
5180
|
return null;
|
|
5181
5181
|
}
|
|
5182
5182
|
}
|
|
5183
|
-
function
|
|
5183
|
+
function qr(n) {
|
|
5184
5184
|
const e = /* @__PURE__ */ new Map();
|
|
5185
5185
|
for (const t of n) {
|
|
5186
5186
|
if (t.kind !== "datum" || t.params.of !== "level") continue;
|
|
5187
|
-
const s = t.params.named;
|
|
5188
|
-
typeof s == "string" && e.set(t.id, s);
|
|
5187
|
+
const s = t.params.named, r = t.params.at;
|
|
5188
|
+
typeof s == "string" && typeof r == "number" && e.set(t.id, { name: s, at: r });
|
|
5189
|
+
}
|
|
5190
|
+
return e;
|
|
5191
|
+
}
|
|
5192
|
+
function jr(n) {
|
|
5193
|
+
const e = /* @__PURE__ */ new Map();
|
|
5194
|
+
for (const t of n) {
|
|
5195
|
+
if (!t.kind.endsWith("Style")) continue;
|
|
5196
|
+
const s = t.params.name;
|
|
5197
|
+
typeof s == "string" && e.set(s, t);
|
|
5189
5198
|
}
|
|
5190
5199
|
return e;
|
|
5191
5200
|
}
|
|
5192
|
-
async function
|
|
5201
|
+
async function rn(n, e) {
|
|
5193
5202
|
const t = /* @__PURE__ */ new Map(), s = (await n.targetDoc.suggestions()).filter(
|
|
5194
5203
|
(r) => {
|
|
5195
5204
|
var i;
|
|
@@ -5198,129 +5207,203 @@ async function Ms(n, e) {
|
|
|
5198
5207
|
).sort((r, i) => String(r.createdAt).localeCompare(String(i.createdAt)));
|
|
5199
5208
|
for (const r of s)
|
|
5200
5209
|
try {
|
|
5201
|
-
const i = await n.targetDoc.suggestionPayload(r), { items: o } = await
|
|
5210
|
+
const i = await n.targetDoc.suggestionPayload(r), { items: o } = await tn(
|
|
5202
5211
|
new Uint8Array(await i.arrayBuffer())
|
|
5203
|
-
), a = o.filter((
|
|
5204
|
-
for (let
|
|
5205
|
-
const c = a[
|
|
5206
|
-
c && (a[
|
|
5212
|
+
), a = o.filter((d) => d.attrs["flow:op"]), l = r.affectedIds ?? [];
|
|
5213
|
+
for (let d = 0; d < a.length && d < l.length; d++) {
|
|
5214
|
+
const c = a[d].attrs["flow:source"];
|
|
5215
|
+
c && (a[d].attrs["flow:op"] === "remove" ? t.delete(c) : t.set(c, l[d]));
|
|
5207
5216
|
}
|
|
5208
5217
|
} catch {
|
|
5209
5218
|
}
|
|
5210
5219
|
return t;
|
|
5211
5220
|
}
|
|
5212
|
-
async function
|
|
5221
|
+
async function on(n, e) {
|
|
5213
5222
|
if (!(e != null && e.fileId)) throw new Error("Choose the model file to read.");
|
|
5214
5223
|
const t = new Uint8Array(
|
|
5215
5224
|
await (await n.client.downloadFile(e.fileId)).arrayBuffer()
|
|
5216
5225
|
);
|
|
5217
|
-
return { picked: e, contents: await
|
|
5226
|
+
return { picked: e, contents: await tn(t) };
|
|
5218
5227
|
}
|
|
5219
|
-
const
|
|
5220
|
-
|
|
5228
|
+
const Rt = {
|
|
5229
|
+
levels: "-2000240",
|
|
5230
|
+
walls: "-2000011",
|
|
5231
|
+
floors: "-2000032"
|
|
5232
|
+
}, ks = 180 / Math.PI;
|
|
5233
|
+
function Os(n) {
|
|
5221
5234
|
if (typeof n != "string") return null;
|
|
5222
5235
|
const e = n.indexOf(":");
|
|
5223
5236
|
return e <= 0 || e === n.length - 1 ? null : { family: n.slice(0, e), type: n.slice(e + 1) };
|
|
5224
5237
|
}
|
|
5225
|
-
|
|
5238
|
+
const J = (n) => String(n);
|
|
5239
|
+
function an(n) {
|
|
5226
5240
|
return async (e) => {
|
|
5227
|
-
var
|
|
5228
|
-
const { picked: t, contents: s } = await
|
|
5241
|
+
var Oe, st, nt, Me, rt, Ve, He;
|
|
5242
|
+
const { picked: t, contents: s } = await on(
|
|
5229
5243
|
e,
|
|
5230
5244
|
e.input
|
|
5231
|
-
), r =
|
|
5245
|
+
), r = Dr(s.items);
|
|
5232
5246
|
if (r.length === 0)
|
|
5233
5247
|
throw new Error(
|
|
5234
5248
|
n === "ifc" ? `"${t.name}" carries no platform records: it was imported without the editable converter. Process the IFC with the editable converter first; a plain import only has IFC attributes, and guessing geometry is not this recipe.` : `"${t.name}" carries no platform records, so there is nothing semantic to convert.`
|
|
5235
5249
|
);
|
|
5236
|
-
const { columnType: i, trustStyleNames: o, includeInstances: a } = e.settings;
|
|
5237
|
-
if (!i && !o)
|
|
5238
|
-
throw new Error(
|
|
5239
|
-
"Choose the Revit column type, or trust the model style names."
|
|
5240
|
-
);
|
|
5250
|
+
const { columnType: i, trustStyleNames: o, includeInstances: a } = e.settings, l = e.settings.createLevels !== !1;
|
|
5241
5251
|
if (a && !o)
|
|
5242
5252
|
throw new Error(
|
|
5243
5253
|
"Free-standing instances can only be proposed by their style names: turn trustStyleNames on."
|
|
5244
5254
|
);
|
|
5245
|
-
const
|
|
5255
|
+
const d = qr(r), c = jr(r), m = `recipe:${n}-to-revit`, T = await rn(e, m), A = await e.targetDoc.latest(), _ = new sn({
|
|
5246
5256
|
project: e.projectId,
|
|
5247
5257
|
document: e.targetDoc.docId,
|
|
5248
|
-
baseCommit: (
|
|
5249
|
-
author:
|
|
5250
|
-
}),
|
|
5251
|
-
let
|
|
5252
|
-
const
|
|
5253
|
-
const
|
|
5254
|
-
|
|
5255
|
-
const K = c.get(B);
|
|
5256
|
-
K ? w.set(K, {}, { position: $, rotationDeg: U, source: B }) : w.add(v, { position: $, rotationDeg: U, source: B });
|
|
5258
|
+
baseCommit: (A == null ? void 0 : A.version) ?? 0,
|
|
5259
|
+
author: m
|
|
5260
|
+
}), E = nn, N = (g) => `${t.fileId}:${g}`, we = /* @__PURE__ */ new Set();
|
|
5261
|
+
let H = 0;
|
|
5262
|
+
const z = (g, y, k) => (we.add(g), T.has(g) ? (H++, !1) : (_.add(y, { ...k, source: g }), !0)), De = (g) => {
|
|
5263
|
+
const y = typeof g == "string" ? c.get(g) : void 0, k = y == null ? void 0 : y.params.thickness;
|
|
5264
|
+
return typeof k == "number" && k > 0 ? k * E : void 0;
|
|
5257
5265
|
};
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5266
|
+
let K = 0;
|
|
5267
|
+
if (l)
|
|
5268
|
+
for (const [g, y] of d)
|
|
5269
|
+
z(N(g), {
|
|
5270
|
+
CategoryId: Rt.levels,
|
|
5271
|
+
Name: y.name,
|
|
5272
|
+
Elevation: J(y.at * E)
|
|
5273
|
+
}), K++;
|
|
5274
|
+
let O = 0, q = 0;
|
|
5275
|
+
for (const g of r) {
|
|
5276
|
+
if (g.kind !== "run" || g.params.of !== "wall") continue;
|
|
5277
|
+
const y = ht(g, "run"), k = ((st = (Oe = y == null ? void 0 : y.run) == null ? void 0 : Oe.line) == null ? void 0 : st.curves) ?? [], x = typeof (y == null ? void 0 : y.base) == "number" ? y.base : 0, P = y == null ? void 0 : y.height, F = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), he = g.params.lookRef;
|
|
5278
|
+
if (typeof he != "string" || typeof P != "number" || !F) {
|
|
5279
|
+
q++;
|
|
5280
|
+
continue;
|
|
5281
|
+
}
|
|
5282
|
+
k.forEach((I, D) => {
|
|
5283
|
+
if (I.kind !== "segment" || !I.from || !I.to) {
|
|
5284
|
+
q++;
|
|
5285
|
+
return;
|
|
5286
|
+
}
|
|
5287
|
+
const _e = x * E, j = `${J(I.from[0] * E)},${J(I.from[1] * E)},${J(_e)};${J(I.to[0] * E)},${J(I.to[1] * E)},${J(_e)}`, G = {
|
|
5288
|
+
CategoryId: Rt.walls,
|
|
5289
|
+
Type: he,
|
|
5290
|
+
LocationLine: j,
|
|
5291
|
+
Level: F.name,
|
|
5292
|
+
BaseOffset: J((x - F.at) * E),
|
|
5293
|
+
Height: J(P * E)
|
|
5294
|
+
}, Q = De(he);
|
|
5295
|
+
Q && (G["Type.Width"] = J(Q)), z(`${N(g.id)}#${D}`, G) && O++;
|
|
5296
|
+
});
|
|
5297
|
+
}
|
|
5298
|
+
let X = 0, be = 0;
|
|
5299
|
+
for (const g of r) {
|
|
5300
|
+
if (g.kind !== "extrusion" || g.params.of !== "slab") continue;
|
|
5301
|
+
const y = ht(g, "extrusion"), k = typeof g.params.base == "number" ? g.params.base : 0, x = d.get(String((y == null ? void 0 : y.level) ?? g.params.level ?? "")), P = g.params.lookRef, F = (j) => {
|
|
5302
|
+
if (!(j != null && j.length)) return null;
|
|
5303
|
+
const G = [];
|
|
5304
|
+
for (const Q of j) {
|
|
5305
|
+
if (Q.kind !== "segment" || !Q.from) return null;
|
|
5306
|
+
G.push(Q.from[0] * E, Q.from[1] * E, k * E);
|
|
5307
|
+
}
|
|
5308
|
+
return G.length >= 9 ? G : null;
|
|
5309
|
+
}, he = F((Me = (nt = y == null ? void 0 : y.profile) == null ? void 0 : nt.outline) == null ? void 0 : Me.curves);
|
|
5310
|
+
if (typeof P != "string" || !x || !he) {
|
|
5311
|
+
be++;
|
|
5279
5312
|
continue;
|
|
5280
5313
|
}
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5314
|
+
const I = [he];
|
|
5315
|
+
for (const j of ((rt = y == null ? void 0 : y.profile) == null ? void 0 : rt.holes) ?? []) {
|
|
5316
|
+
const G = F(j == null ? void 0 : j.curves);
|
|
5317
|
+
G && I.push(G);
|
|
5318
|
+
}
|
|
5319
|
+
const D = {
|
|
5320
|
+
CategoryId: Rt.floors,
|
|
5321
|
+
Type: P,
|
|
5322
|
+
Profile: JSON.stringify(I),
|
|
5323
|
+
Level: x.name
|
|
5324
|
+
}, _e = De(P);
|
|
5325
|
+
_e && (D["Type.Width"] = J(_e)), z(N(g.id), D) && X++;
|
|
5326
|
+
}
|
|
5327
|
+
let ve = 0;
|
|
5328
|
+
for (const g of r) {
|
|
5329
|
+
if (g.kind !== "member" || g.params.of !== "column") continue;
|
|
5330
|
+
const y = ht(g, "member"), k = y == null ? void 0 : y.start;
|
|
5331
|
+
if (!k || k.length !== 3) continue;
|
|
5332
|
+
const x = o ? Os(g.params.lookRef) : null;
|
|
5333
|
+
if (o && !x || !x && !i) continue;
|
|
5334
|
+
const P = x ?? {
|
|
5335
|
+
family: i.family,
|
|
5336
|
+
type: i.type
|
|
5337
|
+
}, F = d.get(String((y == null ? void 0 : y.level) ?? ""));
|
|
5338
|
+
z(
|
|
5339
|
+
N(g.id),
|
|
5340
|
+
{
|
|
5341
|
+
...i && !x ? { CategoryId: i.categoryId } : {},
|
|
5342
|
+
Family: P.family,
|
|
5343
|
+
Type: P.type,
|
|
5344
|
+
...F ? { Level: F.name } : {}
|
|
5345
|
+
},
|
|
5346
|
+
{
|
|
5347
|
+
position: [k[0] * E, k[1] * E, k[2] * E],
|
|
5348
|
+
rotationDeg: (Number((y == null ? void 0 : y.roll) ?? 0) || 0) * ks
|
|
5349
|
+
}
|
|
5350
|
+
) && ve++;
|
|
5351
|
+
}
|
|
5352
|
+
let Ee = 0, qe = 0;
|
|
5353
|
+
for (const g of r) {
|
|
5354
|
+
if (g.kind !== "familyInstance") continue;
|
|
5355
|
+
if (g.params.host) {
|
|
5356
|
+
qe++;
|
|
5293
5357
|
continue;
|
|
5294
5358
|
}
|
|
5295
|
-
(
|
|
5359
|
+
if (!a) continue;
|
|
5360
|
+
const y = ht(g, "instance"), k = (Ve = y == null ? void 0 : y.placement) == null ? void 0 : Ve.at;
|
|
5361
|
+
if (!k || k.length !== 3) continue;
|
|
5362
|
+
const x = Os(g.params.type);
|
|
5363
|
+
if (!x) continue;
|
|
5364
|
+
const P = (He = y == null ? void 0 : y.placement) == null ? void 0 : He.right, F = P ? Math.atan2(P[1], P[0]) * ks : 0;
|
|
5365
|
+
z(
|
|
5366
|
+
N(g.id),
|
|
5367
|
+
{ Family: x.family, Type: x.type },
|
|
5368
|
+
{ position: [k[0] * E, k[1] * E, k[2] * E], rotationDeg: F }
|
|
5369
|
+
) && Ee++;
|
|
5296
5370
|
}
|
|
5297
|
-
let
|
|
5298
|
-
for (const
|
|
5299
|
-
|
|
5300
|
-
|
|
5371
|
+
let je = 0;
|
|
5372
|
+
for (const g of r)
|
|
5373
|
+
(g.kind === "stair" || g.kind === "footing" || g.kind === "ramp" || g.kind === "extrusion" && g.params.of !== "slab" || g.kind === "run" && g.params.of !== "wall") && je++;
|
|
5374
|
+
let Te = 0;
|
|
5375
|
+
for (const [g, y] of T)
|
|
5376
|
+
!g.startsWith(`${t.fileId}:`) || we.has(g) || (_.remove(y), Te++);
|
|
5377
|
+
if (_.length === 0)
|
|
5301
5378
|
throw new Error(
|
|
5302
|
-
`Nothing
|
|
5379
|
+
`Nothing new to ask for: "${t.name}" holds ${H} element(s) this recipe already made, ${qe + je} waiting on the applier, and nothing is left to remove.`
|
|
5303
5380
|
);
|
|
5304
|
-
const
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5381
|
+
const Ue = [
|
|
5382
|
+
K ? `${K} level(s)` : "",
|
|
5383
|
+
O ? `${O} wall(s)` : "",
|
|
5384
|
+
X ? `${X} floor(s)` : "",
|
|
5385
|
+
ve ? `${ve} column(s)` : "",
|
|
5386
|
+
Ee ? `${Ee} instance(s)` : "",
|
|
5387
|
+
Te ? `${Te} gone` : ""
|
|
5308
5388
|
].filter(Boolean);
|
|
5309
5389
|
return {
|
|
5310
|
-
title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${
|
|
5311
|
-
verb:
|
|
5312
|
-
targets:
|
|
5313
|
-
payload: new Blob([await
|
|
5390
|
+
title: `${n === "ifc" ? "IFC" : "Model"} to Revit: ${Ue.join(", ")}`,
|
|
5391
|
+
verb: _.summary,
|
|
5392
|
+
targets: _.length,
|
|
5393
|
+
payload: new Blob([await _.build(e.opId)]),
|
|
5314
5394
|
ruleTallies: [
|
|
5315
|
-
{ read:
|
|
5316
|
-
{ read:
|
|
5317
|
-
{ read:
|
|
5318
|
-
{ read:
|
|
5395
|
+
{ read: d.size, proposed: K },
|
|
5396
|
+
{ read: O + q, proposed: O },
|
|
5397
|
+
{ read: X + be, proposed: X },
|
|
5398
|
+
{ read: ve, proposed: ve },
|
|
5399
|
+
{ read: Ee, proposed: Ee },
|
|
5400
|
+
{ read: Te, proposed: Te },
|
|
5401
|
+
{ read: qe + je, proposed: 0 }
|
|
5319
5402
|
]
|
|
5320
5403
|
};
|
|
5321
5404
|
};
|
|
5322
5405
|
}
|
|
5323
|
-
const
|
|
5406
|
+
const Ur = {
|
|
5324
5407
|
type: "object",
|
|
5325
5408
|
properties: {
|
|
5326
5409
|
columnType: {
|
|
@@ -5343,96 +5426,87 @@ const Lr = {
|
|
|
5343
5426
|
type: "boolean",
|
|
5344
5427
|
title: "Also propose free-standing instances (needs style names)",
|
|
5345
5428
|
default: !1
|
|
5429
|
+
},
|
|
5430
|
+
createLevels: {
|
|
5431
|
+
type: "boolean",
|
|
5432
|
+
title: "Carry the model's levels (ensured by name)",
|
|
5433
|
+
default: !0
|
|
5346
5434
|
}
|
|
5347
5435
|
}
|
|
5348
|
-
},
|
|
5349
|
-
{
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
},
|
|
5353
|
-
{
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
{
|
|
5358
|
-
reads: "Things this recipe made whose record is gone",
|
|
5359
|
-
proposes: "That element removed"
|
|
5360
|
-
},
|
|
5361
|
-
{
|
|
5362
|
-
reads: "Walls, slabs, stairs and every element with a body",
|
|
5363
|
-
proposes: "Nothing yet - waits on the Revit applier growing"
|
|
5364
|
-
}
|
|
5365
|
-
], Hs = {
|
|
5366
|
-
name: "frag-to-revit",
|
|
5367
|
-
title: "Platform model to Revit",
|
|
5368
|
-
description: "Turns the platform records of a .frag into change requests for a Revit document.",
|
|
5369
|
-
to: "revit",
|
|
5370
|
-
inputs: ["frag-model"],
|
|
5371
|
-
source: { kind: "project-file", extensions: ["frag"] },
|
|
5372
|
-
runtime: "browser",
|
|
5373
|
-
settingsSchema: Lr,
|
|
5374
|
-
rules: qr,
|
|
5375
|
-
doc: `
|
|
5436
|
+
}, Mr = [
|
|
5437
|
+
{ reads: "Levels (datums)", proposes: "The same level on the target, ensured by name" },
|
|
5438
|
+
{ reads: "Wall runs, one per straight segment", proposes: "A native wall: curve, type (made from its width when missing), level, height" },
|
|
5439
|
+
{ reads: "Slabs with their boundary", proposes: "A native floor from the profile, holes included" },
|
|
5440
|
+
{ reads: "Column records (members)", proposes: "A Revit column at each, on its level" },
|
|
5441
|
+
{ reads: "Free-standing family instances (when turned on)", proposes: "A new instance of the same-named type, placed and turned" },
|
|
5442
|
+
{ reads: "Things this recipe made whose record is gone", proposes: "That element removed" },
|
|
5443
|
+
{ reads: "Hosted doors/windows, stairs, roofs, footings, curtain pieces", proposes: "Nothing yet - each waits on the applier or the converter growing" }
|
|
5444
|
+
], cn = `
|
|
5376
5445
|
## What it does
|
|
5377
5446
|
|
|
5378
|
-
It reads
|
|
5379
|
-
the
|
|
5380
|
-
|
|
5447
|
+
It reads the platform's records out of a .frag and asks a Revit document for
|
|
5448
|
+
the building they describe - levels, walls, floors, columns and (opting in)
|
|
5449
|
+
free-standing instances, in one operation, levels first. Nothing changes in
|
|
5450
|
+
Revit until the owner of that document accepts the request there, and the
|
|
5451
|
+
applier materialises everything NATIVELY: real walls on real levels, never
|
|
5452
|
+
imported meshes.
|
|
5381
5453
|
|
|
5382
|
-
## What it
|
|
5454
|
+
## What it carries per thing
|
|
5383
5455
|
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5456
|
+
Walls: the location line per straight segment, the type by its exact name
|
|
5457
|
+
(with its width, so a missing type is created by duplication), the level by
|
|
5458
|
+
name, base offset and height. Floors: the boundary loops, holes included.
|
|
5459
|
+
Columns and instances: point, rotation, level, type. Levels: name and
|
|
5460
|
+
elevation - ENSURED, so a level the target already has is simply used.
|
|
5388
5461
|
|
|
5389
5462
|
## It reconciles, it does not push
|
|
5390
5463
|
|
|
5391
|
-
Run it again
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5464
|
+
Run it again and it asks only for the difference: new records become new
|
|
5465
|
+
proposals, and a record that is gone asks for its element to be removed. What
|
|
5466
|
+
it already made is left alone (changing an existing wall through a proposal
|
|
5467
|
+
is the next step, not this one). It can only ever remove what it asked for
|
|
5468
|
+
itself; elements a person made in Revit are invisible to it. It keeps nothing
|
|
5469
|
+
of its own - what it made is read back from its own applied requests.
|
|
5470
|
+
|
|
5471
|
+
## What still waits
|
|
5472
|
+
|
|
5473
|
+
Hosted doors and windows (the converter does not record their category and
|
|
5474
|
+
family yet), stairs, roofs, footings and curtain walls (the applier does not
|
|
5475
|
+
create them yet). They are read and counted, and their rule row says so.
|
|
5395
5476
|
|
|
5396
5477
|
## Units and axes
|
|
5397
5478
|
|
|
5398
|
-
Records are metres, Z up; proposals are written in Revit's feet
|
|
5399
|
-
matched exactly by name; Revit refuses the whole
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5479
|
+
Records are metres and radians, Z up; proposals are written in Revit's feet
|
|
5480
|
+
and degrees. Types are matched exactly by name; Revit refuses the whole
|
|
5481
|
+
request when a loadable type is missing (system types are created from their
|
|
5482
|
+
width instead).
|
|
5483
|
+
`, hn = {
|
|
5484
|
+
name: "frag-to-revit",
|
|
5485
|
+
title: "Platform model to Revit",
|
|
5486
|
+
description: "Turns the platform records of a .frag - levels, walls, floors, columns, instances - into change requests for a Revit document.",
|
|
5487
|
+
to: "revit",
|
|
5488
|
+
inputs: ["frag-model"],
|
|
5489
|
+
source: { kind: "project-file", extensions: ["frag"] },
|
|
5490
|
+
runtime: "browser",
|
|
5491
|
+
settingsSchema: Ur,
|
|
5492
|
+
rules: Mr,
|
|
5493
|
+
doc: cn,
|
|
5494
|
+
run: an("frag")
|
|
5495
|
+
}, Vr = {
|
|
5496
|
+
...hn,
|
|
5404
5497
|
name: "ifc-to-revit",
|
|
5405
5498
|
title: "IFC to Revit",
|
|
5406
|
-
description: "Turns an IFC - through the frag the platform converted it into - into change requests
|
|
5499
|
+
description: "Turns an IFC - through the frag the platform converted it into - into native Revit change requests: levels, walls, floors, columns, instances.",
|
|
5407
5500
|
inputs: ["ifc-model"],
|
|
5408
5501
|
doc: `
|
|
5409
|
-
##
|
|
5410
|
-
|
|
5411
|
-
It reads the .frag your IFC was PROCESSED into (the IFC document's view) and
|
|
5412
|
-
asks a Revit document for the elements its records describe. Point it at that
|
|
5413
|
-
frag: a plain IFC import carries only IFC attributes and is refused by name -
|
|
5414
|
-
the editable converter is what gives an IFC real records.
|
|
5502
|
+
## Point it at the converted frag
|
|
5415
5503
|
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
## It reconciles, it does not push
|
|
5424
|
-
|
|
5425
|
-
Run it again after a reconversion and it asks only for the difference. It can
|
|
5426
|
-
only ever ask to remove what it asked for itself. What it made is read back
|
|
5427
|
-
from its own applied requests - it keeps nothing of its own.
|
|
5428
|
-
|
|
5429
|
-
## Units and axes
|
|
5430
|
-
|
|
5431
|
-
Records are metres, Z up; proposals are written in Revit's feet. Types are
|
|
5432
|
-
matched exactly by name; Revit refuses the whole request when one is missing.
|
|
5433
|
-
`,
|
|
5434
|
-
run: Gs("ifc")
|
|
5435
|
-
}, Dr = {
|
|
5504
|
+
It reads the .frag your IFC was PROCESSED into (the IFC document's view). A
|
|
5505
|
+
plain IFC import carries only IFC attributes and is refused by name - the
|
|
5506
|
+
editable converter is what gives an IFC real records.
|
|
5507
|
+
` + cn,
|
|
5508
|
+
run: an("ifc")
|
|
5509
|
+
}, Hr = {
|
|
5436
5510
|
millimeters: 1e-3,
|
|
5437
5511
|
millimetres: 1e-3,
|
|
5438
5512
|
mm: 1e-3,
|
|
@@ -5446,13 +5520,13 @@ matched exactly by name; Revit refuses the whole request when one is missing.
|
|
|
5446
5520
|
in: 0.0254,
|
|
5447
5521
|
feet: 0.3048,
|
|
5448
5522
|
ft: 0.3048
|
|
5449
|
-
},
|
|
5450
|
-
function
|
|
5523
|
+
}, ln = "rhino-to-revit", As = `recipe:${ln}`;
|
|
5524
|
+
function Gr(n) {
|
|
5451
5525
|
const e = (n.attrs.Position ?? "").split(",").map((t) => Number(t.trim()));
|
|
5452
5526
|
return e.length !== 3 || e.some((t) => !Number.isFinite(t)) ? null : [e[0], e[1], e[2]];
|
|
5453
5527
|
}
|
|
5454
|
-
const
|
|
5455
|
-
name:
|
|
5528
|
+
const Jr = {
|
|
5529
|
+
name: ln,
|
|
5456
5530
|
title: "Rhino to Revit",
|
|
5457
5531
|
description: "Turns the placed objects of a Rhino layer into change requests for Revit instances of a chosen type.",
|
|
5458
5532
|
to: "revit",
|
|
@@ -5521,14 +5595,14 @@ at or below the point. For a level-based family the level wins over the
|
|
|
5521
5595
|
point's height.
|
|
5522
5596
|
`,
|
|
5523
5597
|
async run(n) {
|
|
5524
|
-
var
|
|
5525
|
-
const { picked: e, contents: t } = await
|
|
5598
|
+
var K;
|
|
5599
|
+
const { picked: e, contents: t } = await on(
|
|
5526
5600
|
n,
|
|
5527
5601
|
n.input
|
|
5528
5602
|
), { layer: s, instanceType: r } = n.settings;
|
|
5529
5603
|
if (!s || !r)
|
|
5530
5604
|
throw new Error("Choose the layer and the Revit type.");
|
|
5531
|
-
const i = (
|
|
5605
|
+
const i = (K = t.metadata) == null ? void 0 : K.data, o = i == null ? void 0 : i.units, a = typeof o == "string" ? Hr[o.trim().toLowerCase()] : void 0;
|
|
5532
5606
|
if (!a)
|
|
5533
5607
|
throw new Error(
|
|
5534
5608
|
`"${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.`
|
|
@@ -5538,114 +5612,114 @@ point's height.
|
|
|
5538
5612
|
throw new Error(
|
|
5539
5613
|
`"${e.name}" declares its data as "${l}"; this recipe only converts Z up.`
|
|
5540
5614
|
);
|
|
5541
|
-
const
|
|
5615
|
+
const d = a * nn, c = await rn(n, As), m = await n.targetDoc.latest(), T = new sn({
|
|
5542
5616
|
project: n.projectId,
|
|
5543
5617
|
document: n.targetDoc.docId,
|
|
5544
5618
|
baseCommit: (m == null ? void 0 : m.version) ?? 0,
|
|
5545
|
-
author:
|
|
5619
|
+
author: As
|
|
5546
5620
|
});
|
|
5547
|
-
let
|
|
5548
|
-
const
|
|
5549
|
-
for (const
|
|
5550
|
-
if (!
|
|
5551
|
-
if ((
|
|
5552
|
-
|
|
5621
|
+
let A = 0, _ = 0, E = 0;
|
|
5622
|
+
const N = /* @__PURE__ */ new Set(), we = [];
|
|
5623
|
+
for (const O of t.items) {
|
|
5624
|
+
if (!O.guid || Object.keys(O.attrs).length === 0) continue;
|
|
5625
|
+
if ((O.attrs.Layer ?? "") !== s) {
|
|
5626
|
+
E++;
|
|
5553
5627
|
continue;
|
|
5554
5628
|
}
|
|
5555
|
-
const
|
|
5556
|
-
if (!
|
|
5557
|
-
|
|
5558
|
-
const
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
],
|
|
5563
|
-
|
|
5629
|
+
const q = Gr(O);
|
|
5630
|
+
if (!q) continue;
|
|
5631
|
+
N.add(O.guid);
|
|
5632
|
+
const X = [
|
|
5633
|
+
q[0] * d,
|
|
5634
|
+
q[1] * d,
|
|
5635
|
+
q[2] * d
|
|
5636
|
+
], be = c.get(O.guid);
|
|
5637
|
+
be ? we.push({ instance: be, object: O.guid, position: X }) : (T.add(
|
|
5564
5638
|
{
|
|
5565
5639
|
CategoryId: r.categoryId,
|
|
5566
5640
|
Family: r.family,
|
|
5567
5641
|
Type: r.type
|
|
5568
5642
|
},
|
|
5569
|
-
{ position:
|
|
5570
|
-
),
|
|
5643
|
+
{ position: X, source: O.guid }
|
|
5644
|
+
), A++);
|
|
5571
5645
|
}
|
|
5572
|
-
for (const
|
|
5573
|
-
|
|
5574
|
-
let
|
|
5575
|
-
for (const [
|
|
5576
|
-
|
|
5577
|
-
const
|
|
5578
|
-
if (
|
|
5646
|
+
for (const O of we)
|
|
5647
|
+
T.set(O.instance, {}, { position: O.position, source: O.object }), _++;
|
|
5648
|
+
let H = 0;
|
|
5649
|
+
for (const [O, q] of c)
|
|
5650
|
+
N.has(O) || (T.remove(q), H++);
|
|
5651
|
+
const z = A + _ + H;
|
|
5652
|
+
if (z === 0)
|
|
5579
5653
|
throw new Error(
|
|
5580
5654
|
`Nothing to ask for: layer "${s}" of "${e.name}" has no placed object, and nothing of this recipe is left to remove.`
|
|
5581
5655
|
);
|
|
5582
5656
|
return {
|
|
5583
5657
|
title: `From Rhino: ${[
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5658
|
+
A ? `${A} new` : "",
|
|
5659
|
+
_ ? `${_} moved` : "",
|
|
5660
|
+
H ? `${H} gone` : ""
|
|
5587
5661
|
].filter(Boolean).join(", ")}`,
|
|
5588
|
-
verb:
|
|
5589
|
-
targets:
|
|
5590
|
-
payload: new Blob([await
|
|
5662
|
+
verb: T.summary,
|
|
5663
|
+
targets: z,
|
|
5664
|
+
payload: new Blob([await T.build(n.opId)]),
|
|
5591
5665
|
ruleTallies: [
|
|
5592
|
-
{ read:
|
|
5593
|
-
{ read:
|
|
5594
|
-
{ read:
|
|
5595
|
-
{ read:
|
|
5666
|
+
{ read: A, proposed: A },
|
|
5667
|
+
{ read: _, proposed: _ },
|
|
5668
|
+
{ read: H, proposed: H },
|
|
5669
|
+
{ read: E, proposed: 0 }
|
|
5596
5670
|
]
|
|
5597
5671
|
};
|
|
5598
5672
|
}
|
|
5599
|
-
},
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5673
|
+
}, Wr = [
|
|
5674
|
+
Jr,
|
|
5675
|
+
Vr,
|
|
5676
|
+
hn
|
|
5603
5677
|
];
|
|
5604
|
-
function
|
|
5605
|
-
for (const e of
|
|
5678
|
+
function Kr(n) {
|
|
5679
|
+
for (const e of Wr) n.recipes.register(e);
|
|
5606
5680
|
}
|
|
5607
|
-
const
|
|
5681
|
+
const Xr = {
|
|
5608
5682
|
MAX_FIELDS: 200,
|
|
5609
5683
|
MAX_KEY_LENGTH: 50,
|
|
5610
5684
|
MAX_VALUE_LENGTH: 50
|
|
5611
|
-
},
|
|
5685
|
+
}, Qr = { uuid: "a3f82c1d-5b74-4e9a-bc30-d7e12f894a61" }, Zr = { uuid: "2c9f4e8d-3a1b-4c5e-9d7f-0a2b6c8e1d3f" }, ei = { uuid: "b0b5e2a2-0b3a-4a6b-8b1c-0b1c4a6b8b1c" }, ti = { uuid: "d8f3a1c2-6b4e-4f9a-8c1d-2e7b5a9f3c60" }, si = { uuid: "3f9c1a7e-6b2d-4e18-9a5c-7d0e2f4b6c81" }, ni = { uuid: "2c4ae432-fc24-43e9-9783-0c960c674e96" }, ri = { uuid: "6f3a9c2e-8b1d-4e6a-9c3f-1d7b5a8e2c4f" }, ii = { uuid: "69af63aa-19ba-4fc7-b17b-75647bac1d76" }, oi = { uuid: "234f1416-528d-452a-9cc9-a16c5239b2eb" };
|
|
5612
5686
|
export {
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5687
|
+
Qr as CDEManager,
|
|
5688
|
+
Or as ChannelClient,
|
|
5689
|
+
Ks as ChannelRoom,
|
|
5690
|
+
Zr as ClashesManager,
|
|
5691
|
+
Ir as CollabRoom,
|
|
5692
|
+
fs as DOCUMENT_FILE,
|
|
5693
|
+
bt as DOCUMENT_SCHEMA,
|
|
5694
|
+
Ht as EngineServicesClient,
|
|
5695
|
+
Sr as ExternalRoom,
|
|
5696
|
+
ei as FileList,
|
|
5697
|
+
lr as FlowDoc,
|
|
5698
|
+
ti as GISManager,
|
|
5699
|
+
si as GitHistoryManager,
|
|
5700
|
+
ni as HelloWorld,
|
|
5701
|
+
Xr as METADATA_LIMITS,
|
|
5702
|
+
Nr as OP_SCHEMA,
|
|
5703
|
+
sn as OperationBuilder,
|
|
5704
|
+
Ts as PlatformClient,
|
|
5705
|
+
Ms as ProjectDocuments,
|
|
5706
|
+
hr as ProjectHistory,
|
|
5707
|
+
ri as ProjectManager,
|
|
5708
|
+
ur as Recipes,
|
|
5709
|
+
rs as RequestError,
|
|
5710
|
+
or as SELF_VIEWING_FORMATS,
|
|
5711
|
+
vs as STORAGE_BATCH_MAX,
|
|
5712
|
+
ys as StaleHistoryError,
|
|
5713
|
+
ii as TopicsManager,
|
|
5714
|
+
oi as UIManager,
|
|
5715
|
+
Wr as builtinRecipes,
|
|
5716
|
+
hn as fragToRevit,
|
|
5717
|
+
Vr as ifcToRevit,
|
|
5718
|
+
Mt as mintGuid,
|
|
5719
|
+
Ys as orderByGraph,
|
|
5720
|
+
tn as readFrag,
|
|
5721
|
+
Kr as registerBuiltinRecipes,
|
|
5722
|
+
Jr as rhinoToRevit,
|
|
5723
|
+
Tr as windowTransport
|
|
5650
5724
|
};
|
|
5651
5725
|
//# sourceMappingURL=index.es.js.map
|