@genome-spy/app 0.37.4 → 0.39.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.
@@ -0,0 +1,2190 @@
1
+ import { b as ce } from "./index-1QVesMzU.js";
2
+ import { _ as Vt } from "./__vite-browser-external-ENoMJThg.js";
3
+ import { a as Gt } from "./_commonjsHelpers-QtkX90xp.js";
4
+ var He = { exports: {} }, z = typeof Reflect == "object" ? Reflect : null, Je = z && typeof z.apply == "function" ? z.apply : function(e, r, a) {
5
+ return Function.prototype.apply.call(e, r, a);
6
+ }, ue;
7
+ z && typeof z.ownKeys == "function" ? ue = z.ownKeys : Object.getOwnPropertySymbols ? ue = function(e) {
8
+ return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
9
+ } : ue = function(e) {
10
+ return Object.getOwnPropertyNames(e);
11
+ };
12
+ function Kt(t) {
13
+ console && console.warn && console.warn(t);
14
+ }
15
+ var bt = Number.isNaN || function(e) {
16
+ return e !== e;
17
+ };
18
+ function q() {
19
+ q.init.call(this);
20
+ }
21
+ He.exports = q;
22
+ He.exports.once = Jt;
23
+ q.EventEmitter = q;
24
+ q.prototype._events = void 0;
25
+ q.prototype._eventsCount = 0;
26
+ q.prototype._maxListeners = void 0;
27
+ var Qe = 10;
28
+ function he(t) {
29
+ if (typeof t != "function")
30
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof t);
31
+ }
32
+ Object.defineProperty(q, "defaultMaxListeners", {
33
+ enumerable: !0,
34
+ get: function() {
35
+ return Qe;
36
+ },
37
+ set: function(t) {
38
+ if (typeof t != "number" || t < 0 || bt(t))
39
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + t + ".");
40
+ Qe = t;
41
+ }
42
+ });
43
+ q.init = function() {
44
+ (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
45
+ };
46
+ q.prototype.setMaxListeners = function(e) {
47
+ if (typeof e != "number" || e < 0 || bt(e))
48
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + e + ".");
49
+ return this._maxListeners = e, this;
50
+ };
51
+ function gt(t) {
52
+ return t._maxListeners === void 0 ? q.defaultMaxListeners : t._maxListeners;
53
+ }
54
+ q.prototype.getMaxListeners = function() {
55
+ return gt(this);
56
+ };
57
+ q.prototype.emit = function(e) {
58
+ for (var r = [], a = 1; a < arguments.length; a++)
59
+ r.push(arguments[a]);
60
+ var o = e === "error", s = this._events;
61
+ if (s !== void 0)
62
+ o = o && s.error === void 0;
63
+ else if (!o)
64
+ return !1;
65
+ if (o) {
66
+ var f;
67
+ if (r.length > 0 && (f = r[0]), f instanceof Error)
68
+ throw f;
69
+ var u = new Error("Unhandled error." + (f ? " (" + f.message + ")" : ""));
70
+ throw u.context = f, u;
71
+ }
72
+ var l = s[e];
73
+ if (l === void 0)
74
+ return !1;
75
+ if (typeof l == "function")
76
+ Je(l, this, r);
77
+ else
78
+ for (var h = l.length, g = St(l, h), a = 0; a < h; ++a)
79
+ Je(g[a], this, r);
80
+ return !0;
81
+ };
82
+ function yt(t, e, r, a) {
83
+ var o, s, f;
84
+ if (he(r), s = t._events, s === void 0 ? (s = t._events = /* @__PURE__ */ Object.create(null), t._eventsCount = 0) : (s.newListener !== void 0 && (t.emit(
85
+ "newListener",
86
+ e,
87
+ r.listener ? r.listener : r
88
+ ), s = t._events), f = s[e]), f === void 0)
89
+ f = s[e] = r, ++t._eventsCount;
90
+ else if (typeof f == "function" ? f = s[e] = a ? [r, f] : [f, r] : a ? f.unshift(r) : f.push(r), o = gt(t), o > 0 && f.length > o && !f.warned) {
91
+ f.warned = !0;
92
+ var u = new Error("Possible EventEmitter memory leak detected. " + f.length + " " + String(e) + " listeners added. Use emitter.setMaxListeners() to increase limit");
93
+ u.name = "MaxListenersExceededWarning", u.emitter = t, u.type = e, u.count = f.length, Kt(u);
94
+ }
95
+ return t;
96
+ }
97
+ q.prototype.addListener = function(e, r) {
98
+ return yt(this, e, r, !1);
99
+ };
100
+ q.prototype.on = q.prototype.addListener;
101
+ q.prototype.prependListener = function(e, r) {
102
+ return yt(this, e, r, !0);
103
+ };
104
+ function Yt() {
105
+ if (!this.fired)
106
+ return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
107
+ }
108
+ function wt(t, e, r) {
109
+ var a = { fired: !1, wrapFn: void 0, target: t, type: e, listener: r }, o = Yt.bind(a);
110
+ return o.listener = r, a.wrapFn = o, o;
111
+ }
112
+ q.prototype.once = function(e, r) {
113
+ return he(r), this.on(e, wt(this, e, r)), this;
114
+ };
115
+ q.prototype.prependOnceListener = function(e, r) {
116
+ return he(r), this.prependListener(e, wt(this, e, r)), this;
117
+ };
118
+ q.prototype.removeListener = function(e, r) {
119
+ var a, o, s, f, u;
120
+ if (he(r), o = this._events, o === void 0)
121
+ return this;
122
+ if (a = o[e], a === void 0)
123
+ return this;
124
+ if (a === r || a.listener === r)
125
+ --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete o[e], o.removeListener && this.emit("removeListener", e, a.listener || r));
126
+ else if (typeof a != "function") {
127
+ for (s = -1, f = a.length - 1; f >= 0; f--)
128
+ if (a[f] === r || a[f].listener === r) {
129
+ u = a[f].listener, s = f;
130
+ break;
131
+ }
132
+ if (s < 0)
133
+ return this;
134
+ s === 0 ? a.shift() : zt(a, s), a.length === 1 && (o[e] = a[0]), o.removeListener !== void 0 && this.emit("removeListener", e, u || r);
135
+ }
136
+ return this;
137
+ };
138
+ q.prototype.off = q.prototype.removeListener;
139
+ q.prototype.removeAllListeners = function(e) {
140
+ var r, a, o;
141
+ if (a = this._events, a === void 0)
142
+ return this;
143
+ if (a.removeListener === void 0)
144
+ return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : a[e] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete a[e]), this;
145
+ if (arguments.length === 0) {
146
+ var s = Object.keys(a), f;
147
+ for (o = 0; o < s.length; ++o)
148
+ f = s[o], f !== "removeListener" && this.removeAllListeners(f);
149
+ return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
150
+ }
151
+ if (r = a[e], typeof r == "function")
152
+ this.removeListener(e, r);
153
+ else if (r !== void 0)
154
+ for (o = r.length - 1; o >= 0; o--)
155
+ this.removeListener(e, r[o]);
156
+ return this;
157
+ };
158
+ function mt(t, e, r) {
159
+ var a = t._events;
160
+ if (a === void 0)
161
+ return [];
162
+ var o = a[e];
163
+ return o === void 0 ? [] : typeof o == "function" ? r ? [o.listener || o] : [o] : r ? Xt(o) : St(o, o.length);
164
+ }
165
+ q.prototype.listeners = function(e) {
166
+ return mt(this, e, !0);
167
+ };
168
+ q.prototype.rawListeners = function(e) {
169
+ return mt(this, e, !1);
170
+ };
171
+ q.listenerCount = function(t, e) {
172
+ return typeof t.listenerCount == "function" ? t.listenerCount(e) : Et.call(t, e);
173
+ };
174
+ q.prototype.listenerCount = Et;
175
+ function Et(t) {
176
+ var e = this._events;
177
+ if (e !== void 0) {
178
+ var r = e[t];
179
+ if (typeof r == "function")
180
+ return 1;
181
+ if (r !== void 0)
182
+ return r.length;
183
+ }
184
+ return 0;
185
+ }
186
+ q.prototype.eventNames = function() {
187
+ return this._eventsCount > 0 ? ue(this._events) : [];
188
+ };
189
+ function St(t, e) {
190
+ for (var r = new Array(e), a = 0; a < e; ++a)
191
+ r[a] = t[a];
192
+ return r;
193
+ }
194
+ function zt(t, e) {
195
+ for (; e + 1 < t.length; e++)
196
+ t[e] = t[e + 1];
197
+ t.pop();
198
+ }
199
+ function Xt(t) {
200
+ for (var e = new Array(t.length), r = 0; r < e.length; ++r)
201
+ e[r] = t[r].listener || t[r];
202
+ return e;
203
+ }
204
+ function Jt(t, e) {
205
+ return new Promise(function(r, a) {
206
+ function o(f) {
207
+ t.removeListener(e, s), a(f);
208
+ }
209
+ function s() {
210
+ typeof t.removeListener == "function" && t.removeListener("error", o), r([].slice.call(arguments));
211
+ }
212
+ Rt(t, e, s, { once: !0 }), e !== "error" && Qt(t, o, { once: !0 });
213
+ });
214
+ }
215
+ function Qt(t, e, r) {
216
+ typeof t.on == "function" && Rt(t, "error", e, r);
217
+ }
218
+ function Rt(t, e, r, a) {
219
+ if (typeof t.on == "function")
220
+ a.once ? t.once(e, r) : t.on(e, r);
221
+ else if (typeof t.addEventListener == "function")
222
+ t.addEventListener(e, function o(s) {
223
+ a.once && t.removeEventListener(e, o), r(s);
224
+ });
225
+ else
226
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof t);
227
+ }
228
+ var $e = He.exports, Fe = { exports: {} };
229
+ typeof Object.create == "function" ? Fe.exports = function(e, r) {
230
+ r && (e.super_ = r, e.prototype = Object.create(r.prototype, {
231
+ constructor: {
232
+ value: e,
233
+ enumerable: !1,
234
+ writable: !0,
235
+ configurable: !0
236
+ }
237
+ }));
238
+ } : Fe.exports = function(e, r) {
239
+ if (r) {
240
+ e.super_ = r;
241
+ var a = function() {
242
+ };
243
+ a.prototype = r.prototype, e.prototype = new a(), e.prototype.constructor = e;
244
+ }
245
+ };
246
+ var J = Fe.exports, Se, Ze;
247
+ function Lt() {
248
+ return Ze || (Ze = 1, Se = $e.EventEmitter), Se;
249
+ }
250
+ const Tt = /* @__PURE__ */ Gt(Vt);
251
+ var Re, et;
252
+ function Zt() {
253
+ if (et)
254
+ return Re;
255
+ et = 1;
256
+ function t(m, S) {
257
+ var b = Object.keys(m);
258
+ if (Object.getOwnPropertySymbols) {
259
+ var w = Object.getOwnPropertySymbols(m);
260
+ S && (w = w.filter(function(T) {
261
+ return Object.getOwnPropertyDescriptor(m, T).enumerable;
262
+ })), b.push.apply(b, w);
263
+ }
264
+ return b;
265
+ }
266
+ function e(m) {
267
+ for (var S = 1; S < arguments.length; S++) {
268
+ var b = arguments[S] != null ? arguments[S] : {};
269
+ S % 2 ? t(Object(b), !0).forEach(function(w) {
270
+ r(m, w, b[w]);
271
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(m, Object.getOwnPropertyDescriptors(b)) : t(Object(b)).forEach(function(w) {
272
+ Object.defineProperty(m, w, Object.getOwnPropertyDescriptor(b, w));
273
+ });
274
+ }
275
+ return m;
276
+ }
277
+ function r(m, S, b) {
278
+ return S = f(S), S in m ? Object.defineProperty(m, S, { value: b, enumerable: !0, configurable: !0, writable: !0 }) : m[S] = b, m;
279
+ }
280
+ function a(m, S) {
281
+ if (!(m instanceof S))
282
+ throw new TypeError("Cannot call a class as a function");
283
+ }
284
+ function o(m, S) {
285
+ for (var b = 0; b < S.length; b++) {
286
+ var w = S[b];
287
+ w.enumerable = w.enumerable || !1, w.configurable = !0, "value" in w && (w.writable = !0), Object.defineProperty(m, f(w.key), w);
288
+ }
289
+ }
290
+ function s(m, S, b) {
291
+ return S && o(m.prototype, S), b && o(m, b), Object.defineProperty(m, "prototype", { writable: !1 }), m;
292
+ }
293
+ function f(m) {
294
+ var S = u(m, "string");
295
+ return typeof S == "symbol" ? S : String(S);
296
+ }
297
+ function u(m, S) {
298
+ if (typeof m != "object" || m === null)
299
+ return m;
300
+ var b = m[Symbol.toPrimitive];
301
+ if (b !== void 0) {
302
+ var w = b.call(m, S || "default");
303
+ if (typeof w != "object")
304
+ return w;
305
+ throw new TypeError("@@toPrimitive must return a primitive value.");
306
+ }
307
+ return (S === "string" ? String : Number)(m);
308
+ }
309
+ var l = ce, h = l.Buffer, g = Tt, y = g.inspect, _ = y && y.custom || "inspect";
310
+ function M(m, S, b) {
311
+ h.prototype.copy.call(m, S, b);
312
+ }
313
+ return Re = /* @__PURE__ */ function() {
314
+ function m() {
315
+ a(this, m), this.head = null, this.tail = null, this.length = 0;
316
+ }
317
+ return s(m, [{
318
+ key: "push",
319
+ value: function(b) {
320
+ var w = {
321
+ data: b,
322
+ next: null
323
+ };
324
+ this.length > 0 ? this.tail.next = w : this.head = w, this.tail = w, ++this.length;
325
+ }
326
+ }, {
327
+ key: "unshift",
328
+ value: function(b) {
329
+ var w = {
330
+ data: b,
331
+ next: this.head
332
+ };
333
+ this.length === 0 && (this.tail = w), this.head = w, ++this.length;
334
+ }
335
+ }, {
336
+ key: "shift",
337
+ value: function() {
338
+ if (this.length !== 0) {
339
+ var b = this.head.data;
340
+ return this.length === 1 ? this.head = this.tail = null : this.head = this.head.next, --this.length, b;
341
+ }
342
+ }
343
+ }, {
344
+ key: "clear",
345
+ value: function() {
346
+ this.head = this.tail = null, this.length = 0;
347
+ }
348
+ }, {
349
+ key: "join",
350
+ value: function(b) {
351
+ if (this.length === 0)
352
+ return "";
353
+ for (var w = this.head, T = "" + w.data; w = w.next; )
354
+ T += b + w.data;
355
+ return T;
356
+ }
357
+ }, {
358
+ key: "concat",
359
+ value: function(b) {
360
+ if (this.length === 0)
361
+ return h.alloc(0);
362
+ for (var w = h.allocUnsafe(b >>> 0), T = this.head, L = 0; T; )
363
+ M(T.data, w, L), L += T.data.length, T = T.next;
364
+ return w;
365
+ }
366
+ // Consumes a specified amount of bytes or characters from the buffered data.
367
+ }, {
368
+ key: "consume",
369
+ value: function(b, w) {
370
+ var T;
371
+ return b < this.head.data.length ? (T = this.head.data.slice(0, b), this.head.data = this.head.data.slice(b)) : b === this.head.data.length ? T = this.shift() : T = w ? this._getString(b) : this._getBuffer(b), T;
372
+ }
373
+ }, {
374
+ key: "first",
375
+ value: function() {
376
+ return this.head.data;
377
+ }
378
+ // Consumes a specified amount of characters from the buffered data.
379
+ }, {
380
+ key: "_getString",
381
+ value: function(b) {
382
+ var w = this.head, T = 1, L = w.data;
383
+ for (b -= L.length; w = w.next; ) {
384
+ var R = w.data, A = b > R.length ? R.length : b;
385
+ if (A === R.length ? L += R : L += R.slice(0, b), b -= A, b === 0) {
386
+ A === R.length ? (++T, w.next ? this.head = w.next : this.head = this.tail = null) : (this.head = w, w.data = R.slice(A));
387
+ break;
388
+ }
389
+ ++T;
390
+ }
391
+ return this.length -= T, L;
392
+ }
393
+ // Consumes a specified amount of bytes from the buffered data.
394
+ }, {
395
+ key: "_getBuffer",
396
+ value: function(b) {
397
+ var w = h.allocUnsafe(b), T = this.head, L = 1;
398
+ for (T.data.copy(w), b -= T.data.length; T = T.next; ) {
399
+ var R = T.data, A = b > R.length ? R.length : b;
400
+ if (R.copy(w, w.length - b, 0, A), b -= A, b === 0) {
401
+ A === R.length ? (++L, T.next ? this.head = T.next : this.head = this.tail = null) : (this.head = T, T.data = R.slice(A));
402
+ break;
403
+ }
404
+ ++L;
405
+ }
406
+ return this.length -= L, w;
407
+ }
408
+ // Make sure the linked list only shows the minimal necessary information.
409
+ }, {
410
+ key: _,
411
+ value: function(b, w) {
412
+ return y(this, e(e({}, w), {}, {
413
+ // Only inspect one level.
414
+ depth: 0,
415
+ // It should not recurse.
416
+ customInspect: !1
417
+ }));
418
+ }
419
+ }]), m;
420
+ }(), Re;
421
+ }
422
+ var Le, tt;
423
+ function Ct() {
424
+ if (tt)
425
+ return Le;
426
+ tt = 1;
427
+ function t(f, u) {
428
+ var l = this, h = this._readableState && this._readableState.destroyed, g = this._writableState && this._writableState.destroyed;
429
+ return h || g ? (u ? u(f) : f && (this._writableState ? this._writableState.errorEmitted || (this._writableState.errorEmitted = !0, process.nextTick(o, this, f)) : process.nextTick(o, this, f)), this) : (this._readableState && (this._readableState.destroyed = !0), this._writableState && (this._writableState.destroyed = !0), this._destroy(f || null, function(y) {
430
+ !u && y ? l._writableState ? l._writableState.errorEmitted ? process.nextTick(r, l) : (l._writableState.errorEmitted = !0, process.nextTick(e, l, y)) : process.nextTick(e, l, y) : u ? (process.nextTick(r, l), u(y)) : process.nextTick(r, l);
431
+ }), this);
432
+ }
433
+ function e(f, u) {
434
+ o(f, u), r(f);
435
+ }
436
+ function r(f) {
437
+ f._writableState && !f._writableState.emitClose || f._readableState && !f._readableState.emitClose || f.emit("close");
438
+ }
439
+ function a() {
440
+ this._readableState && (this._readableState.destroyed = !1, this._readableState.reading = !1, this._readableState.ended = !1, this._readableState.endEmitted = !1), this._writableState && (this._writableState.destroyed = !1, this._writableState.ended = !1, this._writableState.ending = !1, this._writableState.finalCalled = !1, this._writableState.prefinished = !1, this._writableState.finished = !1, this._writableState.errorEmitted = !1);
441
+ }
442
+ function o(f, u) {
443
+ f.emit("error", u);
444
+ }
445
+ function s(f, u) {
446
+ var l = f._readableState, h = f._writableState;
447
+ l && l.autoDestroy || h && h.autoDestroy ? f.destroy(u) : f.emit("error", u);
448
+ }
449
+ return Le = {
450
+ destroy: t,
451
+ undestroy: a,
452
+ errorOrDestroy: s
453
+ }, Le;
454
+ }
455
+ var Te = {}, rt;
456
+ function Q() {
457
+ if (rt)
458
+ return Te;
459
+ rt = 1;
460
+ function t(u, l) {
461
+ u.prototype = Object.create(l.prototype), u.prototype.constructor = u, u.__proto__ = l;
462
+ }
463
+ var e = {};
464
+ function r(u, l, h) {
465
+ h || (h = Error);
466
+ function g(_, M, m) {
467
+ return typeof l == "string" ? l : l(_, M, m);
468
+ }
469
+ var y = /* @__PURE__ */ function(_) {
470
+ t(M, _);
471
+ function M(m, S, b) {
472
+ return _.call(this, g(m, S, b)) || this;
473
+ }
474
+ return M;
475
+ }(h);
476
+ y.prototype.name = h.name, y.prototype.code = u, e[u] = y;
477
+ }
478
+ function a(u, l) {
479
+ if (Array.isArray(u)) {
480
+ var h = u.length;
481
+ return u = u.map(function(g) {
482
+ return String(g);
483
+ }), h > 2 ? "one of ".concat(l, " ").concat(u.slice(0, h - 1).join(", "), ", or ") + u[h - 1] : h === 2 ? "one of ".concat(l, " ").concat(u[0], " or ").concat(u[1]) : "of ".concat(l, " ").concat(u[0]);
484
+ } else
485
+ return "of ".concat(l, " ").concat(String(u));
486
+ }
487
+ function o(u, l, h) {
488
+ return u.substr(!h || h < 0 ? 0 : +h, l.length) === l;
489
+ }
490
+ function s(u, l, h) {
491
+ return (h === void 0 || h > u.length) && (h = u.length), u.substring(h - l.length, h) === l;
492
+ }
493
+ function f(u, l, h) {
494
+ return typeof h != "number" && (h = 0), h + l.length > u.length ? !1 : u.indexOf(l, h) !== -1;
495
+ }
496
+ return r("ERR_INVALID_OPT_VALUE", function(u, l) {
497
+ return 'The value "' + l + '" is invalid for option "' + u + '"';
498
+ }, TypeError), r("ERR_INVALID_ARG_TYPE", function(u, l, h) {
499
+ var g;
500
+ typeof l == "string" && o(l, "not ") ? (g = "must not be", l = l.replace(/^not /, "")) : g = "must be";
501
+ var y;
502
+ if (s(u, " argument"))
503
+ y = "The ".concat(u, " ").concat(g, " ").concat(a(l, "type"));
504
+ else {
505
+ var _ = f(u, ".") ? "property" : "argument";
506
+ y = 'The "'.concat(u, '" ').concat(_, " ").concat(g, " ").concat(a(l, "type"));
507
+ }
508
+ return y += ". Received type ".concat(typeof h), y;
509
+ }, TypeError), r("ERR_STREAM_PUSH_AFTER_EOF", "stream.push() after EOF"), r("ERR_METHOD_NOT_IMPLEMENTED", function(u) {
510
+ return "The " + u + " method is not implemented";
511
+ }), r("ERR_STREAM_PREMATURE_CLOSE", "Premature close"), r("ERR_STREAM_DESTROYED", function(u) {
512
+ return "Cannot call " + u + " after a stream was destroyed";
513
+ }), r("ERR_MULTIPLE_CALLBACK", "Callback called multiple times"), r("ERR_STREAM_CANNOT_PIPE", "Cannot pipe, not readable"), r("ERR_STREAM_WRITE_AFTER_END", "write after end"), r("ERR_STREAM_NULL_VALUES", "May not write null values to stream", TypeError), r("ERR_UNKNOWN_ENCODING", function(u) {
514
+ return "Unknown encoding: " + u;
515
+ }, TypeError), r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT", "stream.unshift() after end event"), Te.codes = e, Te;
516
+ }
517
+ var Ce, nt;
518
+ function At() {
519
+ if (nt)
520
+ return Ce;
521
+ nt = 1;
522
+ var t = Q().codes.ERR_INVALID_OPT_VALUE;
523
+ function e(a, o, s) {
524
+ return a.highWaterMark != null ? a.highWaterMark : o ? a[s] : null;
525
+ }
526
+ function r(a, o, s, f) {
527
+ var u = e(o, f, s);
528
+ if (u != null) {
529
+ if (!(isFinite(u) && Math.floor(u) === u) || u < 0) {
530
+ var l = f ? s : "highWaterMark";
531
+ throw new t(l, u);
532
+ }
533
+ return Math.floor(u);
534
+ }
535
+ return a.objectMode ? 16 : 16 * 1024;
536
+ }
537
+ return Ce = {
538
+ getHighWaterMark: r
539
+ }, Ce;
540
+ }
541
+ var Ae, it;
542
+ function er() {
543
+ if (it)
544
+ return Ae;
545
+ it = 1, Ae = t;
546
+ function t(r, a) {
547
+ if (e("noDeprecation"))
548
+ return r;
549
+ var o = !1;
550
+ function s() {
551
+ if (!o) {
552
+ if (e("throwDeprecation"))
553
+ throw new Error(a);
554
+ e("traceDeprecation") ? console.trace(a) : console.warn(a), o = !0;
555
+ }
556
+ return r.apply(this, arguments);
557
+ }
558
+ return s;
559
+ }
560
+ function e(r) {
561
+ try {
562
+ if (!globalThis.localStorage)
563
+ return !1;
564
+ } catch {
565
+ return !1;
566
+ }
567
+ var a = globalThis.localStorage[r];
568
+ return a == null ? !1 : String(a).toLowerCase() === "true";
569
+ }
570
+ return Ae;
571
+ }
572
+ var Me, at;
573
+ function Mt() {
574
+ if (at)
575
+ return Me;
576
+ at = 1, Me = N;
577
+ function t(c) {
578
+ var d = this;
579
+ this.next = null, this.entry = null, this.finish = function() {
580
+ ye(d, c);
581
+ };
582
+ }
583
+ var e;
584
+ N.WritableState = O;
585
+ var r = {
586
+ deprecate: er()
587
+ }, a = Lt(), o = ce.Buffer, s = (typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
588
+ };
589
+ function f(c) {
590
+ return o.from(c);
591
+ }
592
+ function u(c) {
593
+ return o.isBuffer(c) || c instanceof s;
594
+ }
595
+ var l = Ct(), h = At(), g = h.getHighWaterMark, y = Q().codes, _ = y.ERR_INVALID_ARG_TYPE, M = y.ERR_METHOD_NOT_IMPLEMENTED, m = y.ERR_MULTIPLE_CALLBACK, S = y.ERR_STREAM_CANNOT_PIPE, b = y.ERR_STREAM_DESTROYED, w = y.ERR_STREAM_NULL_VALUES, T = y.ERR_STREAM_WRITE_AFTER_END, L = y.ERR_UNKNOWN_ENCODING, R = l.errorOrDestroy;
596
+ J(N, a);
597
+ function A() {
598
+ }
599
+ function O(c, d, v) {
600
+ e = e || X(), c = c || {}, typeof v != "boolean" && (v = d instanceof e), this.objectMode = !!c.objectMode, v && (this.objectMode = this.objectMode || !!c.writableObjectMode), this.highWaterMark = g(this, c, "writableHighWaterMark", v), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
601
+ var C = c.decodeStrings === !1;
602
+ this.decodeStrings = !C, this.defaultEncoding = c.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(P) {
603
+ _e(d, P);
604
+ }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = c.emitClose !== !1, this.autoDestroy = !!c.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new t(this);
605
+ }
606
+ O.prototype.getBuffer = function() {
607
+ for (var d = this.bufferedRequest, v = []; d; )
608
+ v.push(d), d = d.next;
609
+ return v;
610
+ }, function() {
611
+ try {
612
+ Object.defineProperty(O.prototype, "buffer", {
613
+ get: r.deprecate(function() {
614
+ return this.getBuffer();
615
+ }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003")
616
+ });
617
+ } catch {
618
+ }
619
+ }();
620
+ var I;
621
+ typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (I = Function.prototype[Symbol.hasInstance], Object.defineProperty(N, Symbol.hasInstance, {
622
+ value: function(d) {
623
+ return I.call(this, d) ? !0 : this !== N ? !1 : d && d._writableState instanceof O;
624
+ }
625
+ })) : I = function(d) {
626
+ return d instanceof this;
627
+ };
628
+ function N(c) {
629
+ e = e || X();
630
+ var d = this instanceof e;
631
+ if (!d && !I.call(N, this))
632
+ return new N(c);
633
+ this._writableState = new O(c, this, d), this.writable = !0, c && (typeof c.write == "function" && (this._write = c.write), typeof c.writev == "function" && (this._writev = c.writev), typeof c.destroy == "function" && (this._destroy = c.destroy), typeof c.final == "function" && (this._final = c.final)), a.call(this);
634
+ }
635
+ N.prototype.pipe = function() {
636
+ R(this, new S());
637
+ };
638
+ function D(c, d) {
639
+ var v = new T();
640
+ R(c, v), process.nextTick(d, v);
641
+ }
642
+ function B(c, d, v, C) {
643
+ var P;
644
+ return v === null ? P = new w() : typeof v != "string" && !d.objectMode && (P = new _("chunk", ["string", "Buffer"], v)), P ? (R(c, P), process.nextTick(C, P), !1) : !0;
645
+ }
646
+ N.prototype.write = function(c, d, v) {
647
+ var C = this._writableState, P = !1, n = !C.objectMode && u(c);
648
+ return n && !o.isBuffer(c) && (c = f(c)), typeof d == "function" && (v = d, d = null), n ? d = "buffer" : d || (d = C.defaultEncoding), typeof v != "function" && (v = A), C.ending ? D(this, v) : (n || B(this, C, c, v)) && (C.pendingcb++, P = pe(this, C, n, c, d, v)), P;
649
+ }, N.prototype.cork = function() {
650
+ this._writableState.corked++;
651
+ }, N.prototype.uncork = function() {
652
+ var c = this._writableState;
653
+ c.corked && (c.corked--, !c.writing && !c.corked && !c.bufferProcessing && c.bufferedRequest && V(this, c));
654
+ }, N.prototype.setDefaultEncoding = function(d) {
655
+ if (typeof d == "string" && (d = d.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((d + "").toLowerCase()) > -1))
656
+ throw new L(d);
657
+ return this._writableState.defaultEncoding = d, this;
658
+ }, Object.defineProperty(N.prototype, "writableBuffer", {
659
+ // making it explicit this property is not enumerable
660
+ // because otherwise some prototype manipulation in
661
+ // userland will fail
662
+ enumerable: !1,
663
+ get: function() {
664
+ return this._writableState && this._writableState.getBuffer();
665
+ }
666
+ });
667
+ function Z(c, d, v) {
668
+ return !c.objectMode && c.decodeStrings !== !1 && typeof d == "string" && (d = o.from(d, v)), d;
669
+ }
670
+ Object.defineProperty(N.prototype, "writableHighWaterMark", {
671
+ // making it explicit this property is not enumerable
672
+ // because otherwise some prototype manipulation in
673
+ // userland will fail
674
+ enumerable: !1,
675
+ get: function() {
676
+ return this._writableState.highWaterMark;
677
+ }
678
+ });
679
+ function pe(c, d, v, C, P, n) {
680
+ if (!v) {
681
+ var i = Z(d, C, P);
682
+ C !== i && (v = !0, P = "buffer", C = i);
683
+ }
684
+ var p = d.objectMode ? 1 : C.length;
685
+ d.length += p;
686
+ var E = d.length < d.highWaterMark;
687
+ if (E || (d.needDrain = !0), d.writing || d.corked) {
688
+ var j = d.lastBufferedRequest;
689
+ d.lastBufferedRequest = {
690
+ chunk: C,
691
+ encoding: P,
692
+ isBuf: v,
693
+ callback: n,
694
+ next: null
695
+ }, j ? j.next = d.lastBufferedRequest : d.bufferedRequest = d.lastBufferedRequest, d.bufferedRequestCount += 1;
696
+ } else
697
+ $(c, d, !1, p, C, P, n);
698
+ return E;
699
+ }
700
+ function $(c, d, v, C, P, n, i) {
701
+ d.writelen = C, d.writecb = i, d.writing = !0, d.sync = !0, d.destroyed ? d.onwrite(new b("write")) : v ? c._writev(P, d.onwrite) : c._write(P, n, d.onwrite), d.sync = !1;
702
+ }
703
+ function ve(c, d, v, C, P) {
704
+ --d.pendingcb, v ? (process.nextTick(P, C), process.nextTick(H, c, d), c._writableState.errorEmitted = !0, R(c, C)) : (P(C), c._writableState.errorEmitted = !0, R(c, C), H(c, d));
705
+ }
706
+ function ie(c) {
707
+ c.writing = !1, c.writecb = null, c.length -= c.writelen, c.writelen = 0;
708
+ }
709
+ function _e(c, d) {
710
+ var v = c._writableState, C = v.sync, P = v.writecb;
711
+ if (typeof P != "function")
712
+ throw new m();
713
+ if (ie(v), d)
714
+ ve(c, v, C, d, P);
715
+ else {
716
+ var n = se(v) || c.destroyed;
717
+ !n && !v.corked && !v.bufferProcessing && v.bufferedRequest && V(c, v), C ? process.nextTick(U, c, v, n, P) : U(c, v, n, P);
718
+ }
719
+ }
720
+ function U(c, d, v, C) {
721
+ v || ae(c, d), d.pendingcb--, C(), H(c, d);
722
+ }
723
+ function ae(c, d) {
724
+ d.length === 0 && d.needDrain && (d.needDrain = !1, c.emit("drain"));
725
+ }
726
+ function V(c, d) {
727
+ d.bufferProcessing = !0;
728
+ var v = d.bufferedRequest;
729
+ if (c._writev && v && v.next) {
730
+ var C = d.bufferedRequestCount, P = new Array(C), n = d.corkedRequestsFree;
731
+ n.entry = v;
732
+ for (var i = 0, p = !0; v; )
733
+ P[i] = v, v.isBuf || (p = !1), v = v.next, i += 1;
734
+ P.allBuffers = p, $(c, d, !0, d.length, P, "", n.finish), d.pendingcb++, d.lastBufferedRequest = null, n.next ? (d.corkedRequestsFree = n.next, n.next = null) : d.corkedRequestsFree = new t(d), d.bufferedRequestCount = 0;
735
+ } else {
736
+ for (; v; ) {
737
+ var E = v.chunk, j = v.encoding, x = v.callback, k = d.objectMode ? 1 : E.length;
738
+ if ($(c, d, !1, k, E, j, x), v = v.next, d.bufferedRequestCount--, d.writing)
739
+ break;
740
+ }
741
+ v === null && (d.lastBufferedRequest = null);
742
+ }
743
+ d.bufferedRequest = v, d.bufferProcessing = !1;
744
+ }
745
+ N.prototype._write = function(c, d, v) {
746
+ v(new M("_write()"));
747
+ }, N.prototype._writev = null, N.prototype.end = function(c, d, v) {
748
+ var C = this._writableState;
749
+ return typeof c == "function" ? (v = c, c = null, d = null) : typeof d == "function" && (v = d, d = null), c != null && this.write(c, d), C.corked && (C.corked = 1, this.uncork()), C.ending || ge(this, C, v), this;
750
+ }, Object.defineProperty(N.prototype, "writableLength", {
751
+ // making it explicit this property is not enumerable
752
+ // because otherwise some prototype manipulation in
753
+ // userland will fail
754
+ enumerable: !1,
755
+ get: function() {
756
+ return this._writableState.length;
757
+ }
758
+ });
759
+ function se(c) {
760
+ return c.ending && c.length === 0 && c.bufferedRequest === null && !c.finished && !c.writing;
761
+ }
762
+ function be(c, d) {
763
+ c._final(function(v) {
764
+ d.pendingcb--, v && R(c, v), d.prefinished = !0, c.emit("prefinish"), H(c, d);
765
+ });
766
+ }
767
+ function oe(c, d) {
768
+ !d.prefinished && !d.finalCalled && (typeof c._final == "function" && !d.destroyed ? (d.pendingcb++, d.finalCalled = !0, process.nextTick(be, c, d)) : (d.prefinished = !0, c.emit("prefinish")));
769
+ }
770
+ function H(c, d) {
771
+ var v = se(d);
772
+ if (v && (oe(c, d), d.pendingcb === 0 && (d.finished = !0, c.emit("finish"), d.autoDestroy))) {
773
+ var C = c._readableState;
774
+ (!C || C.autoDestroy && C.endEmitted) && c.destroy();
775
+ }
776
+ return v;
777
+ }
778
+ function ge(c, d, v) {
779
+ d.ending = !0, H(c, d), v && (d.finished ? process.nextTick(v) : c.once("finish", v)), d.ended = !0, c.writable = !1;
780
+ }
781
+ function ye(c, d, v) {
782
+ var C = c.entry;
783
+ for (c.entry = null; C; ) {
784
+ var P = C.callback;
785
+ d.pendingcb--, P(v), C = C.next;
786
+ }
787
+ d.corkedRequestsFree.next = c;
788
+ }
789
+ return Object.defineProperty(N.prototype, "destroyed", {
790
+ // making it explicit this property is not enumerable
791
+ // because otherwise some prototype manipulation in
792
+ // userland will fail
793
+ enumerable: !1,
794
+ get: function() {
795
+ return this._writableState === void 0 ? !1 : this._writableState.destroyed;
796
+ },
797
+ set: function(d) {
798
+ this._writableState && (this._writableState.destroyed = d);
799
+ }
800
+ }), N.prototype.destroy = l.destroy, N.prototype._undestroy = l.undestroy, N.prototype._destroy = function(c, d) {
801
+ d(c);
802
+ }, Me;
803
+ }
804
+ var Oe, st;
805
+ function X() {
806
+ if (st)
807
+ return Oe;
808
+ st = 1;
809
+ var t = Object.keys || function(h) {
810
+ var g = [];
811
+ for (var y in h)
812
+ g.push(y);
813
+ return g;
814
+ };
815
+ Oe = f;
816
+ var e = Ot(), r = Mt();
817
+ J(f, e);
818
+ for (var a = t(r.prototype), o = 0; o < a.length; o++) {
819
+ var s = a[o];
820
+ f.prototype[s] || (f.prototype[s] = r.prototype[s]);
821
+ }
822
+ function f(h) {
823
+ if (!(this instanceof f))
824
+ return new f(h);
825
+ e.call(this, h), r.call(this, h), this.allowHalfOpen = !0, h && (h.readable === !1 && (this.readable = !1), h.writable === !1 && (this.writable = !1), h.allowHalfOpen === !1 && (this.allowHalfOpen = !1, this.once("end", u)));
826
+ }
827
+ Object.defineProperty(f.prototype, "writableHighWaterMark", {
828
+ // making it explicit this property is not enumerable
829
+ // because otherwise some prototype manipulation in
830
+ // userland will fail
831
+ enumerable: !1,
832
+ get: function() {
833
+ return this._writableState.highWaterMark;
834
+ }
835
+ }), Object.defineProperty(f.prototype, "writableBuffer", {
836
+ // making it explicit this property is not enumerable
837
+ // because otherwise some prototype manipulation in
838
+ // userland will fail
839
+ enumerable: !1,
840
+ get: function() {
841
+ return this._writableState && this._writableState.getBuffer();
842
+ }
843
+ }), Object.defineProperty(f.prototype, "writableLength", {
844
+ // making it explicit this property is not enumerable
845
+ // because otherwise some prototype manipulation in
846
+ // userland will fail
847
+ enumerable: !1,
848
+ get: function() {
849
+ return this._writableState.length;
850
+ }
851
+ });
852
+ function u() {
853
+ this._writableState.ended || process.nextTick(l, this);
854
+ }
855
+ function l(h) {
856
+ h.end();
857
+ }
858
+ return Object.defineProperty(f.prototype, "destroyed", {
859
+ // making it explicit this property is not enumerable
860
+ // because otherwise some prototype manipulation in
861
+ // userland will fail
862
+ enumerable: !1,
863
+ get: function() {
864
+ return this._readableState === void 0 || this._writableState === void 0 ? !1 : this._readableState.destroyed && this._writableState.destroyed;
865
+ },
866
+ set: function(g) {
867
+ this._readableState === void 0 || this._writableState === void 0 || (this._readableState.destroyed = g, this._writableState.destroyed = g);
868
+ }
869
+ }), Oe;
870
+ }
871
+ var Be = {}, We = { exports: {} };
872
+ (function(t, e) {
873
+ var r = ce, a = r.Buffer;
874
+ function o(f, u) {
875
+ for (var l in f)
876
+ u[l] = f[l];
877
+ }
878
+ a.from && a.alloc && a.allocUnsafe && a.allocUnsafeSlow ? t.exports = r : (o(r, e), e.Buffer = s);
879
+ function s(f, u, l) {
880
+ return a(f, u, l);
881
+ }
882
+ o(a, s), s.from = function(f, u, l) {
883
+ if (typeof f == "number")
884
+ throw new TypeError("Argument must not be a number");
885
+ return a(f, u, l);
886
+ }, s.alloc = function(f, u, l) {
887
+ if (typeof f != "number")
888
+ throw new TypeError("Argument must be a number");
889
+ var h = a(f);
890
+ return u !== void 0 ? typeof l == "string" ? h.fill(u, l) : h.fill(u) : h.fill(0), h;
891
+ }, s.allocUnsafe = function(f) {
892
+ if (typeof f != "number")
893
+ throw new TypeError("Argument must be a number");
894
+ return a(f);
895
+ }, s.allocUnsafeSlow = function(f) {
896
+ if (typeof f != "number")
897
+ throw new TypeError("Argument must be a number");
898
+ return r.SlowBuffer(f);
899
+ };
900
+ })(We, We.exports);
901
+ var tr = We.exports, Ve = tr.Buffer, ot = Ve.isEncoding || function(t) {
902
+ switch (t = "" + t, t && t.toLowerCase()) {
903
+ case "hex":
904
+ case "utf8":
905
+ case "utf-8":
906
+ case "ascii":
907
+ case "binary":
908
+ case "base64":
909
+ case "ucs2":
910
+ case "ucs-2":
911
+ case "utf16le":
912
+ case "utf-16le":
913
+ case "raw":
914
+ return !0;
915
+ default:
916
+ return !1;
917
+ }
918
+ };
919
+ function rr(t) {
920
+ if (!t)
921
+ return "utf8";
922
+ for (var e; ; )
923
+ switch (t) {
924
+ case "utf8":
925
+ case "utf-8":
926
+ return "utf8";
927
+ case "ucs2":
928
+ case "ucs-2":
929
+ case "utf16le":
930
+ case "utf-16le":
931
+ return "utf16le";
932
+ case "latin1":
933
+ case "binary":
934
+ return "latin1";
935
+ case "base64":
936
+ case "ascii":
937
+ case "hex":
938
+ return t;
939
+ default:
940
+ if (e)
941
+ return;
942
+ t = ("" + t).toLowerCase(), e = !0;
943
+ }
944
+ }
945
+ function nr(t) {
946
+ var e = rr(t);
947
+ if (typeof e != "string" && (Ve.isEncoding === ot || !ot(t)))
948
+ throw new Error("Unknown encoding: " + t);
949
+ return e || t;
950
+ }
951
+ var ir = Be.StringDecoder = ne;
952
+ function ne(t) {
953
+ this.encoding = nr(t);
954
+ var e;
955
+ switch (this.encoding) {
956
+ case "utf16le":
957
+ this.text = lr, this.end = dr, e = 4;
958
+ break;
959
+ case "utf8":
960
+ this.fillLast = or, e = 4;
961
+ break;
962
+ case "base64":
963
+ this.text = cr, this.end = hr, e = 3;
964
+ break;
965
+ default:
966
+ this.write = pr, this.end = vr;
967
+ return;
968
+ }
969
+ this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Ve.allocUnsafe(e);
970
+ }
971
+ ne.prototype.write = function(t) {
972
+ if (t.length === 0)
973
+ return "";
974
+ var e, r;
975
+ if (this.lastNeed) {
976
+ if (e = this.fillLast(t), e === void 0)
977
+ return "";
978
+ r = this.lastNeed, this.lastNeed = 0;
979
+ } else
980
+ r = 0;
981
+ return r < t.length ? e ? e + this.text(t, r) : this.text(t, r) : e || "";
982
+ };
983
+ ne.prototype.end = ur;
984
+ ne.prototype.text = fr;
985
+ ne.prototype.fillLast = function(t) {
986
+ if (this.lastNeed <= t.length)
987
+ return t.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
988
+ t.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, t.length), this.lastNeed -= t.length;
989
+ };
990
+ function De(t) {
991
+ return t <= 127 ? 0 : t >> 5 === 6 ? 2 : t >> 4 === 14 ? 3 : t >> 3 === 30 ? 4 : t >> 6 === 2 ? -1 : -2;
992
+ }
993
+ function ar(t, e, r) {
994
+ var a = e.length - 1;
995
+ if (a < r)
996
+ return 0;
997
+ var o = De(e[a]);
998
+ return o >= 0 ? (o > 0 && (t.lastNeed = o - 1), o) : --a < r || o === -2 ? 0 : (o = De(e[a]), o >= 0 ? (o > 0 && (t.lastNeed = o - 2), o) : --a < r || o === -2 ? 0 : (o = De(e[a]), o >= 0 ? (o > 0 && (o === 2 ? o = 0 : t.lastNeed = o - 3), o) : 0));
999
+ }
1000
+ function sr(t, e, r) {
1001
+ if ((e[0] & 192) !== 128)
1002
+ return t.lastNeed = 0, "�";
1003
+ if (t.lastNeed > 1 && e.length > 1) {
1004
+ if ((e[1] & 192) !== 128)
1005
+ return t.lastNeed = 1, "�";
1006
+ if (t.lastNeed > 2 && e.length > 2 && (e[2] & 192) !== 128)
1007
+ return t.lastNeed = 2, "�";
1008
+ }
1009
+ }
1010
+ function or(t) {
1011
+ var e = this.lastTotal - this.lastNeed, r = sr(this, t);
1012
+ if (r !== void 0)
1013
+ return r;
1014
+ if (this.lastNeed <= t.length)
1015
+ return t.copy(this.lastChar, e, 0, this.lastNeed), this.lastChar.toString(this.encoding, 0, this.lastTotal);
1016
+ t.copy(this.lastChar, e, 0, t.length), this.lastNeed -= t.length;
1017
+ }
1018
+ function fr(t, e) {
1019
+ var r = ar(this, t, e);
1020
+ if (!this.lastNeed)
1021
+ return t.toString("utf8", e);
1022
+ this.lastTotal = r;
1023
+ var a = t.length - (r - this.lastNeed);
1024
+ return t.copy(this.lastChar, 0, a), t.toString("utf8", e, a);
1025
+ }
1026
+ function ur(t) {
1027
+ var e = t && t.length ? this.write(t) : "";
1028
+ return this.lastNeed ? e + "�" : e;
1029
+ }
1030
+ function lr(t, e) {
1031
+ if ((t.length - e) % 2 === 0) {
1032
+ var r = t.toString("utf16le", e);
1033
+ if (r) {
1034
+ var a = r.charCodeAt(r.length - 1);
1035
+ if (a >= 55296 && a <= 56319)
1036
+ return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = t[t.length - 2], this.lastChar[1] = t[t.length - 1], r.slice(0, -1);
1037
+ }
1038
+ return r;
1039
+ }
1040
+ return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = t[t.length - 1], t.toString("utf16le", e, t.length - 1);
1041
+ }
1042
+ function dr(t) {
1043
+ var e = t && t.length ? this.write(t) : "";
1044
+ if (this.lastNeed) {
1045
+ var r = this.lastTotal - this.lastNeed;
1046
+ return e + this.lastChar.toString("utf16le", 0, r);
1047
+ }
1048
+ return e;
1049
+ }
1050
+ function cr(t, e) {
1051
+ var r = (t.length - e) % 3;
1052
+ return r === 0 ? t.toString("base64", e) : (this.lastNeed = 3 - r, this.lastTotal = 3, r === 1 ? this.lastChar[0] = t[t.length - 1] : (this.lastChar[0] = t[t.length - 2], this.lastChar[1] = t[t.length - 1]), t.toString("base64", e, t.length - r));
1053
+ }
1054
+ function hr(t) {
1055
+ var e = t && t.length ? this.write(t) : "";
1056
+ return this.lastNeed ? e + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : e;
1057
+ }
1058
+ function pr(t) {
1059
+ return t.toString(this.encoding);
1060
+ }
1061
+ function vr(t) {
1062
+ return t && t.length ? this.write(t) : "";
1063
+ }
1064
+ var xe, ft;
1065
+ function Ge() {
1066
+ if (ft)
1067
+ return xe;
1068
+ ft = 1;
1069
+ var t = Q().codes.ERR_STREAM_PREMATURE_CLOSE;
1070
+ function e(s) {
1071
+ var f = !1;
1072
+ return function() {
1073
+ if (!f) {
1074
+ f = !0;
1075
+ for (var u = arguments.length, l = new Array(u), h = 0; h < u; h++)
1076
+ l[h] = arguments[h];
1077
+ s.apply(this, l);
1078
+ }
1079
+ };
1080
+ }
1081
+ function r() {
1082
+ }
1083
+ function a(s) {
1084
+ return s.setHeader && typeof s.abort == "function";
1085
+ }
1086
+ function o(s, f, u) {
1087
+ if (typeof f == "function")
1088
+ return o(s, null, f);
1089
+ f || (f = {}), u = e(u || r);
1090
+ var l = f.readable || f.readable !== !1 && s.readable, h = f.writable || f.writable !== !1 && s.writable, g = function() {
1091
+ s.writable || _();
1092
+ }, y = s._writableState && s._writableState.finished, _ = function() {
1093
+ h = !1, y = !0, l || u.call(s);
1094
+ }, M = s._readableState && s._readableState.endEmitted, m = function() {
1095
+ l = !1, M = !0, h || u.call(s);
1096
+ }, S = function(L) {
1097
+ u.call(s, L);
1098
+ }, b = function() {
1099
+ var L;
1100
+ if (l && !M)
1101
+ return (!s._readableState || !s._readableState.ended) && (L = new t()), u.call(s, L);
1102
+ if (h && !y)
1103
+ return (!s._writableState || !s._writableState.ended) && (L = new t()), u.call(s, L);
1104
+ }, w = function() {
1105
+ s.req.on("finish", _);
1106
+ };
1107
+ return a(s) ? (s.on("complete", _), s.on("abort", b), s.req ? w() : s.on("request", w)) : h && !s._writableState && (s.on("end", g), s.on("close", g)), s.on("end", m), s.on("finish", _), f.error !== !1 && s.on("error", S), s.on("close", b), function() {
1108
+ s.removeListener("complete", _), s.removeListener("abort", b), s.removeListener("request", w), s.req && s.req.removeListener("finish", _), s.removeListener("end", g), s.removeListener("close", g), s.removeListener("finish", _), s.removeListener("end", m), s.removeListener("error", S), s.removeListener("close", b);
1109
+ };
1110
+ }
1111
+ return xe = o, xe;
1112
+ }
1113
+ var Pe, ut;
1114
+ function _r() {
1115
+ if (ut)
1116
+ return Pe;
1117
+ ut = 1;
1118
+ var t;
1119
+ function e(L, R, A) {
1120
+ return R = r(R), R in L ? Object.defineProperty(L, R, { value: A, enumerable: !0, configurable: !0, writable: !0 }) : L[R] = A, L;
1121
+ }
1122
+ function r(L) {
1123
+ var R = a(L, "string");
1124
+ return typeof R == "symbol" ? R : String(R);
1125
+ }
1126
+ function a(L, R) {
1127
+ if (typeof L != "object" || L === null)
1128
+ return L;
1129
+ var A = L[Symbol.toPrimitive];
1130
+ if (A !== void 0) {
1131
+ var O = A.call(L, R || "default");
1132
+ if (typeof O != "object")
1133
+ return O;
1134
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1135
+ }
1136
+ return (R === "string" ? String : Number)(L);
1137
+ }
1138
+ var o = Ge(), s = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), h = Symbol("lastPromise"), g = Symbol("handlePromise"), y = Symbol("stream");
1139
+ function _(L, R) {
1140
+ return {
1141
+ value: L,
1142
+ done: R
1143
+ };
1144
+ }
1145
+ function M(L) {
1146
+ var R = L[s];
1147
+ if (R !== null) {
1148
+ var A = L[y].read();
1149
+ A !== null && (L[h] = null, L[s] = null, L[f] = null, R(_(A, !1)));
1150
+ }
1151
+ }
1152
+ function m(L) {
1153
+ process.nextTick(M, L);
1154
+ }
1155
+ function S(L, R) {
1156
+ return function(A, O) {
1157
+ L.then(function() {
1158
+ if (R[l]) {
1159
+ A(_(void 0, !0));
1160
+ return;
1161
+ }
1162
+ R[g](A, O);
1163
+ }, O);
1164
+ };
1165
+ }
1166
+ var b = Object.getPrototypeOf(function() {
1167
+ }), w = Object.setPrototypeOf((t = {
1168
+ get stream() {
1169
+ return this[y];
1170
+ },
1171
+ next: function() {
1172
+ var R = this, A = this[u];
1173
+ if (A !== null)
1174
+ return Promise.reject(A);
1175
+ if (this[l])
1176
+ return Promise.resolve(_(void 0, !0));
1177
+ if (this[y].destroyed)
1178
+ return new Promise(function(D, B) {
1179
+ process.nextTick(function() {
1180
+ R[u] ? B(R[u]) : D(_(void 0, !0));
1181
+ });
1182
+ });
1183
+ var O = this[h], I;
1184
+ if (O)
1185
+ I = new Promise(S(O, this));
1186
+ else {
1187
+ var N = this[y].read();
1188
+ if (N !== null)
1189
+ return Promise.resolve(_(N, !1));
1190
+ I = new Promise(this[g]);
1191
+ }
1192
+ return this[h] = I, I;
1193
+ }
1194
+ }, e(t, Symbol.asyncIterator, function() {
1195
+ return this;
1196
+ }), e(t, "return", function() {
1197
+ var R = this;
1198
+ return new Promise(function(A, O) {
1199
+ R[y].destroy(null, function(I) {
1200
+ if (I) {
1201
+ O(I);
1202
+ return;
1203
+ }
1204
+ A(_(void 0, !0));
1205
+ });
1206
+ });
1207
+ }), t), b), T = function(R) {
1208
+ var A, O = Object.create(w, (A = {}, e(A, y, {
1209
+ value: R,
1210
+ writable: !0
1211
+ }), e(A, s, {
1212
+ value: null,
1213
+ writable: !0
1214
+ }), e(A, f, {
1215
+ value: null,
1216
+ writable: !0
1217
+ }), e(A, u, {
1218
+ value: null,
1219
+ writable: !0
1220
+ }), e(A, l, {
1221
+ value: R._readableState.endEmitted,
1222
+ writable: !0
1223
+ }), e(A, g, {
1224
+ value: function(N, D) {
1225
+ var B = O[y].read();
1226
+ B ? (O[h] = null, O[s] = null, O[f] = null, N(_(B, !1))) : (O[s] = N, O[f] = D);
1227
+ },
1228
+ writable: !0
1229
+ }), A));
1230
+ return O[h] = null, o(R, function(I) {
1231
+ if (I && I.code !== "ERR_STREAM_PREMATURE_CLOSE") {
1232
+ var N = O[f];
1233
+ N !== null && (O[h] = null, O[s] = null, O[f] = null, N(I)), O[u] = I;
1234
+ return;
1235
+ }
1236
+ var D = O[s];
1237
+ D !== null && (O[h] = null, O[s] = null, O[f] = null, D(_(void 0, !0))), O[l] = !0;
1238
+ }), R.on("readable", m.bind(null, O)), O;
1239
+ };
1240
+ return Pe = T, Pe;
1241
+ }
1242
+ var Ne, lt;
1243
+ function br() {
1244
+ return lt || (lt = 1, Ne = function() {
1245
+ throw new Error("Readable.from is not available in the browser");
1246
+ }), Ne;
1247
+ }
1248
+ var qe, dt;
1249
+ function Ot() {
1250
+ if (dt)
1251
+ return qe;
1252
+ dt = 1, qe = D;
1253
+ var t;
1254
+ D.ReadableState = N, $e.EventEmitter;
1255
+ var e = function(i, p) {
1256
+ return i.listeners(p).length;
1257
+ }, r = Lt(), a = ce.Buffer, o = (typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
1258
+ };
1259
+ function s(n) {
1260
+ return a.from(n);
1261
+ }
1262
+ function f(n) {
1263
+ return a.isBuffer(n) || n instanceof o;
1264
+ }
1265
+ var u = Tt, l;
1266
+ u && u.debuglog ? l = u.debuglog("stream") : l = function() {
1267
+ };
1268
+ var h = Zt(), g = Ct(), y = At(), _ = y.getHighWaterMark, M = Q().codes, m = M.ERR_INVALID_ARG_TYPE, S = M.ERR_STREAM_PUSH_AFTER_EOF, b = M.ERR_METHOD_NOT_IMPLEMENTED, w = M.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, T, L, R;
1269
+ J(D, r);
1270
+ var A = g.errorOrDestroy, O = ["error", "close", "destroy", "pause", "resume"];
1271
+ function I(n, i, p) {
1272
+ if (typeof n.prependListener == "function")
1273
+ return n.prependListener(i, p);
1274
+ !n._events || !n._events[i] ? n.on(i, p) : Array.isArray(n._events[i]) ? n._events[i].unshift(p) : n._events[i] = [p, n._events[i]];
1275
+ }
1276
+ function N(n, i, p) {
1277
+ t = t || X(), n = n || {}, typeof p != "boolean" && (p = i instanceof t), this.objectMode = !!n.objectMode, p && (this.objectMode = this.objectMode || !!n.readableObjectMode), this.highWaterMark = _(this, n, "readableHighWaterMark", p), this.buffer = new h(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = n.emitClose !== !1, this.autoDestroy = !!n.autoDestroy, this.destroyed = !1, this.defaultEncoding = n.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, n.encoding && (T || (T = Be.StringDecoder), this.decoder = new T(n.encoding), this.encoding = n.encoding);
1278
+ }
1279
+ function D(n) {
1280
+ if (t = t || X(), !(this instanceof D))
1281
+ return new D(n);
1282
+ var i = this instanceof t;
1283
+ this._readableState = new N(n, this, i), this.readable = !0, n && (typeof n.read == "function" && (this._read = n.read), typeof n.destroy == "function" && (this._destroy = n.destroy)), r.call(this);
1284
+ }
1285
+ Object.defineProperty(D.prototype, "destroyed", {
1286
+ // making it explicit this property is not enumerable
1287
+ // because otherwise some prototype manipulation in
1288
+ // userland will fail
1289
+ enumerable: !1,
1290
+ get: function() {
1291
+ return this._readableState === void 0 ? !1 : this._readableState.destroyed;
1292
+ },
1293
+ set: function(i) {
1294
+ this._readableState && (this._readableState.destroyed = i);
1295
+ }
1296
+ }), D.prototype.destroy = g.destroy, D.prototype._undestroy = g.undestroy, D.prototype._destroy = function(n, i) {
1297
+ i(n);
1298
+ }, D.prototype.push = function(n, i) {
1299
+ var p = this._readableState, E;
1300
+ return p.objectMode ? E = !0 : typeof n == "string" && (i = i || p.defaultEncoding, i !== p.encoding && (n = a.from(n, i), i = ""), E = !0), B(this, n, i, !1, E);
1301
+ }, D.prototype.unshift = function(n) {
1302
+ return B(this, n, null, !0, !1);
1303
+ };
1304
+ function B(n, i, p, E, j) {
1305
+ l("readableAddChunk", i);
1306
+ var x = n._readableState;
1307
+ if (i === null)
1308
+ x.reading = !1, _e(n, x);
1309
+ else {
1310
+ var k;
1311
+ if (j || (k = pe(x, i)), k)
1312
+ A(n, k);
1313
+ else if (x.objectMode || i && i.length > 0)
1314
+ if (typeof i != "string" && !x.objectMode && Object.getPrototypeOf(i) !== a.prototype && (i = s(i)), E)
1315
+ x.endEmitted ? A(n, new w()) : Z(n, x, i, !0);
1316
+ else if (x.ended)
1317
+ A(n, new S());
1318
+ else {
1319
+ if (x.destroyed)
1320
+ return !1;
1321
+ x.reading = !1, x.decoder && !p ? (i = x.decoder.write(i), x.objectMode || i.length !== 0 ? Z(n, x, i, !1) : V(n, x)) : Z(n, x, i, !1);
1322
+ }
1323
+ else
1324
+ E || (x.reading = !1, V(n, x));
1325
+ }
1326
+ return !x.ended && (x.length < x.highWaterMark || x.length === 0);
1327
+ }
1328
+ function Z(n, i, p, E) {
1329
+ i.flowing && i.length === 0 && !i.sync ? (i.awaitDrain = 0, n.emit("data", p)) : (i.length += i.objectMode ? 1 : p.length, E ? i.buffer.unshift(p) : i.buffer.push(p), i.needReadable && U(n)), V(n, i);
1330
+ }
1331
+ function pe(n, i) {
1332
+ var p;
1333
+ return !f(i) && typeof i != "string" && i !== void 0 && !n.objectMode && (p = new m("chunk", ["string", "Buffer", "Uint8Array"], i)), p;
1334
+ }
1335
+ D.prototype.isPaused = function() {
1336
+ return this._readableState.flowing === !1;
1337
+ }, D.prototype.setEncoding = function(n) {
1338
+ T || (T = Be.StringDecoder);
1339
+ var i = new T(n);
1340
+ this._readableState.decoder = i, this._readableState.encoding = this._readableState.decoder.encoding;
1341
+ for (var p = this._readableState.buffer.head, E = ""; p !== null; )
1342
+ E += i.write(p.data), p = p.next;
1343
+ return this._readableState.buffer.clear(), E !== "" && this._readableState.buffer.push(E), this._readableState.length = E.length, this;
1344
+ };
1345
+ var $ = 1073741824;
1346
+ function ve(n) {
1347
+ return n >= $ ? n = $ : (n--, n |= n >>> 1, n |= n >>> 2, n |= n >>> 4, n |= n >>> 8, n |= n >>> 16, n++), n;
1348
+ }
1349
+ function ie(n, i) {
1350
+ return n <= 0 || i.length === 0 && i.ended ? 0 : i.objectMode ? 1 : n !== n ? i.flowing && i.length ? i.buffer.head.data.length : i.length : (n > i.highWaterMark && (i.highWaterMark = ve(n)), n <= i.length ? n : i.ended ? i.length : (i.needReadable = !0, 0));
1351
+ }
1352
+ D.prototype.read = function(n) {
1353
+ l("read", n), n = parseInt(n, 10);
1354
+ var i = this._readableState, p = n;
1355
+ if (n !== 0 && (i.emittedReadable = !1), n === 0 && i.needReadable && ((i.highWaterMark !== 0 ? i.length >= i.highWaterMark : i.length > 0) || i.ended))
1356
+ return l("read: emitReadable", i.length, i.ended), i.length === 0 && i.ended ? v(this) : U(this), null;
1357
+ if (n = ie(n, i), n === 0 && i.ended)
1358
+ return i.length === 0 && v(this), null;
1359
+ var E = i.needReadable;
1360
+ l("need readable", E), (i.length === 0 || i.length - n < i.highWaterMark) && (E = !0, l("length less than watermark", E)), i.ended || i.reading ? (E = !1, l("reading or ended", E)) : E && (l("do read"), i.reading = !0, i.sync = !0, i.length === 0 && (i.needReadable = !0), this._read(i.highWaterMark), i.sync = !1, i.reading || (n = ie(p, i)));
1361
+ var j;
1362
+ return n > 0 ? j = d(n, i) : j = null, j === null ? (i.needReadable = i.length <= i.highWaterMark, n = 0) : (i.length -= n, i.awaitDrain = 0), i.length === 0 && (i.ended || (i.needReadable = !0), p !== n && i.ended && v(this)), j !== null && this.emit("data", j), j;
1363
+ };
1364
+ function _e(n, i) {
1365
+ if (l("onEofChunk"), !i.ended) {
1366
+ if (i.decoder) {
1367
+ var p = i.decoder.end();
1368
+ p && p.length && (i.buffer.push(p), i.length += i.objectMode ? 1 : p.length);
1369
+ }
1370
+ i.ended = !0, i.sync ? U(n) : (i.needReadable = !1, i.emittedReadable || (i.emittedReadable = !0, ae(n)));
1371
+ }
1372
+ }
1373
+ function U(n) {
1374
+ var i = n._readableState;
1375
+ l("emitReadable", i.needReadable, i.emittedReadable), i.needReadable = !1, i.emittedReadable || (l("emitReadable", i.flowing), i.emittedReadable = !0, process.nextTick(ae, n));
1376
+ }
1377
+ function ae(n) {
1378
+ var i = n._readableState;
1379
+ l("emitReadable_", i.destroyed, i.length, i.ended), !i.destroyed && (i.length || i.ended) && (n.emit("readable"), i.emittedReadable = !1), i.needReadable = !i.flowing && !i.ended && i.length <= i.highWaterMark, c(n);
1380
+ }
1381
+ function V(n, i) {
1382
+ i.readingMore || (i.readingMore = !0, process.nextTick(se, n, i));
1383
+ }
1384
+ function se(n, i) {
1385
+ for (; !i.reading && !i.ended && (i.length < i.highWaterMark || i.flowing && i.length === 0); ) {
1386
+ var p = i.length;
1387
+ if (l("maybeReadMore read 0"), n.read(0), p === i.length)
1388
+ break;
1389
+ }
1390
+ i.readingMore = !1;
1391
+ }
1392
+ D.prototype._read = function(n) {
1393
+ A(this, new b("_read()"));
1394
+ }, D.prototype.pipe = function(n, i) {
1395
+ var p = this, E = this._readableState;
1396
+ switch (E.pipesCount) {
1397
+ case 0:
1398
+ E.pipes = n;
1399
+ break;
1400
+ case 1:
1401
+ E.pipes = [E.pipes, n];
1402
+ break;
1403
+ default:
1404
+ E.pipes.push(n);
1405
+ break;
1406
+ }
1407
+ E.pipesCount += 1, l("pipe count=%d opts=%j", E.pipesCount, i);
1408
+ var j = (!i || i.end !== !1) && n !== process.stdout && n !== process.stderr, x = j ? G : ee;
1409
+ E.endEmitted ? process.nextTick(x) : p.once("end", x), n.on("unpipe", k);
1410
+ function k(K, Y) {
1411
+ l("onunpipe"), K === p && Y && Y.hasUnpiped === !1 && (Y.hasUnpiped = !0, $t());
1412
+ }
1413
+ function G() {
1414
+ l("onend"), n.end();
1415
+ }
1416
+ var fe = be(p);
1417
+ n.on("drain", fe);
1418
+ var ze = !1;
1419
+ function $t() {
1420
+ l("cleanup"), n.removeListener("close", me), n.removeListener("finish", Ee), n.removeListener("drain", fe), n.removeListener("error", we), n.removeListener("unpipe", k), p.removeListener("end", G), p.removeListener("end", ee), p.removeListener("data", Xe), ze = !0, E.awaitDrain && (!n._writableState || n._writableState.needDrain) && fe();
1421
+ }
1422
+ p.on("data", Xe);
1423
+ function Xe(K) {
1424
+ l("ondata");
1425
+ var Y = n.write(K);
1426
+ l("dest.write", Y), Y === !1 && ((E.pipesCount === 1 && E.pipes === n || E.pipesCount > 1 && P(E.pipes, n) !== -1) && !ze && (l("false write response, pause", E.awaitDrain), E.awaitDrain++), p.pause());
1427
+ }
1428
+ function we(K) {
1429
+ l("onerror", K), ee(), n.removeListener("error", we), e(n, "error") === 0 && A(n, K);
1430
+ }
1431
+ I(n, "error", we);
1432
+ function me() {
1433
+ n.removeListener("finish", Ee), ee();
1434
+ }
1435
+ n.once("close", me);
1436
+ function Ee() {
1437
+ l("onfinish"), n.removeListener("close", me), ee();
1438
+ }
1439
+ n.once("finish", Ee);
1440
+ function ee() {
1441
+ l("unpipe"), p.unpipe(n);
1442
+ }
1443
+ return n.emit("pipe", p), E.flowing || (l("pipe resume"), p.resume()), n;
1444
+ };
1445
+ function be(n) {
1446
+ return function() {
1447
+ var p = n._readableState;
1448
+ l("pipeOnDrain", p.awaitDrain), p.awaitDrain && p.awaitDrain--, p.awaitDrain === 0 && e(n, "data") && (p.flowing = !0, c(n));
1449
+ };
1450
+ }
1451
+ D.prototype.unpipe = function(n) {
1452
+ var i = this._readableState, p = {
1453
+ hasUnpiped: !1
1454
+ };
1455
+ if (i.pipesCount === 0)
1456
+ return this;
1457
+ if (i.pipesCount === 1)
1458
+ return n && n !== i.pipes ? this : (n || (n = i.pipes), i.pipes = null, i.pipesCount = 0, i.flowing = !1, n && n.emit("unpipe", this, p), this);
1459
+ if (!n) {
1460
+ var E = i.pipes, j = i.pipesCount;
1461
+ i.pipes = null, i.pipesCount = 0, i.flowing = !1;
1462
+ for (var x = 0; x < j; x++)
1463
+ E[x].emit("unpipe", this, {
1464
+ hasUnpiped: !1
1465
+ });
1466
+ return this;
1467
+ }
1468
+ var k = P(i.pipes, n);
1469
+ return k === -1 ? this : (i.pipes.splice(k, 1), i.pipesCount -= 1, i.pipesCount === 1 && (i.pipes = i.pipes[0]), n.emit("unpipe", this, p), this);
1470
+ }, D.prototype.on = function(n, i) {
1471
+ var p = r.prototype.on.call(this, n, i), E = this._readableState;
1472
+ return n === "data" ? (E.readableListening = this.listenerCount("readable") > 0, E.flowing !== !1 && this.resume()) : n === "readable" && !E.endEmitted && !E.readableListening && (E.readableListening = E.needReadable = !0, E.flowing = !1, E.emittedReadable = !1, l("on readable", E.length, E.reading), E.length ? U(this) : E.reading || process.nextTick(H, this)), p;
1473
+ }, D.prototype.addListener = D.prototype.on, D.prototype.removeListener = function(n, i) {
1474
+ var p = r.prototype.removeListener.call(this, n, i);
1475
+ return n === "readable" && process.nextTick(oe, this), p;
1476
+ }, D.prototype.removeAllListeners = function(n) {
1477
+ var i = r.prototype.removeAllListeners.apply(this, arguments);
1478
+ return (n === "readable" || n === void 0) && process.nextTick(oe, this), i;
1479
+ };
1480
+ function oe(n) {
1481
+ var i = n._readableState;
1482
+ i.readableListening = n.listenerCount("readable") > 0, i.resumeScheduled && !i.paused ? i.flowing = !0 : n.listenerCount("data") > 0 && n.resume();
1483
+ }
1484
+ function H(n) {
1485
+ l("readable nexttick read 0"), n.read(0);
1486
+ }
1487
+ D.prototype.resume = function() {
1488
+ var n = this._readableState;
1489
+ return n.flowing || (l("resume"), n.flowing = !n.readableListening, ge(this, n)), n.paused = !1, this;
1490
+ };
1491
+ function ge(n, i) {
1492
+ i.resumeScheduled || (i.resumeScheduled = !0, process.nextTick(ye, n, i));
1493
+ }
1494
+ function ye(n, i) {
1495
+ l("resume", i.reading), i.reading || n.read(0), i.resumeScheduled = !1, n.emit("resume"), c(n), i.flowing && !i.reading && n.read(0);
1496
+ }
1497
+ D.prototype.pause = function() {
1498
+ return l("call pause flowing=%j", this._readableState.flowing), this._readableState.flowing !== !1 && (l("pause"), this._readableState.flowing = !1, this.emit("pause")), this._readableState.paused = !0, this;
1499
+ };
1500
+ function c(n) {
1501
+ var i = n._readableState;
1502
+ for (l("flow", i.flowing); i.flowing && n.read() !== null; )
1503
+ ;
1504
+ }
1505
+ D.prototype.wrap = function(n) {
1506
+ var i = this, p = this._readableState, E = !1;
1507
+ n.on("end", function() {
1508
+ if (l("wrapped end"), p.decoder && !p.ended) {
1509
+ var k = p.decoder.end();
1510
+ k && k.length && i.push(k);
1511
+ }
1512
+ i.push(null);
1513
+ }), n.on("data", function(k) {
1514
+ if (l("wrapped data"), p.decoder && (k = p.decoder.write(k)), !(p.objectMode && k == null) && !(!p.objectMode && (!k || !k.length))) {
1515
+ var G = i.push(k);
1516
+ G || (E = !0, n.pause());
1517
+ }
1518
+ });
1519
+ for (var j in n)
1520
+ this[j] === void 0 && typeof n[j] == "function" && (this[j] = function(G) {
1521
+ return function() {
1522
+ return n[G].apply(n, arguments);
1523
+ };
1524
+ }(j));
1525
+ for (var x = 0; x < O.length; x++)
1526
+ n.on(O[x], this.emit.bind(this, O[x]));
1527
+ return this._read = function(k) {
1528
+ l("wrapped _read", k), E && (E = !1, n.resume());
1529
+ }, this;
1530
+ }, typeof Symbol == "function" && (D.prototype[Symbol.asyncIterator] = function() {
1531
+ return L === void 0 && (L = _r()), L(this);
1532
+ }), Object.defineProperty(D.prototype, "readableHighWaterMark", {
1533
+ // making it explicit this property is not enumerable
1534
+ // because otherwise some prototype manipulation in
1535
+ // userland will fail
1536
+ enumerable: !1,
1537
+ get: function() {
1538
+ return this._readableState.highWaterMark;
1539
+ }
1540
+ }), Object.defineProperty(D.prototype, "readableBuffer", {
1541
+ // making it explicit this property is not enumerable
1542
+ // because otherwise some prototype manipulation in
1543
+ // userland will fail
1544
+ enumerable: !1,
1545
+ get: function() {
1546
+ return this._readableState && this._readableState.buffer;
1547
+ }
1548
+ }), Object.defineProperty(D.prototype, "readableFlowing", {
1549
+ // making it explicit this property is not enumerable
1550
+ // because otherwise some prototype manipulation in
1551
+ // userland will fail
1552
+ enumerable: !1,
1553
+ get: function() {
1554
+ return this._readableState.flowing;
1555
+ },
1556
+ set: function(i) {
1557
+ this._readableState && (this._readableState.flowing = i);
1558
+ }
1559
+ }), D._fromList = d, Object.defineProperty(D.prototype, "readableLength", {
1560
+ // making it explicit this property is not enumerable
1561
+ // because otherwise some prototype manipulation in
1562
+ // userland will fail
1563
+ enumerable: !1,
1564
+ get: function() {
1565
+ return this._readableState.length;
1566
+ }
1567
+ });
1568
+ function d(n, i) {
1569
+ if (i.length === 0)
1570
+ return null;
1571
+ var p;
1572
+ return i.objectMode ? p = i.buffer.shift() : !n || n >= i.length ? (i.decoder ? p = i.buffer.join("") : i.buffer.length === 1 ? p = i.buffer.first() : p = i.buffer.concat(i.length), i.buffer.clear()) : p = i.buffer.consume(n, i.decoder), p;
1573
+ }
1574
+ function v(n) {
1575
+ var i = n._readableState;
1576
+ l("endReadable", i.endEmitted), i.endEmitted || (i.ended = !0, process.nextTick(C, i, n));
1577
+ }
1578
+ function C(n, i) {
1579
+ if (l("endReadableNT", n.endEmitted, n.length), !n.endEmitted && n.length === 0 && (n.endEmitted = !0, i.readable = !1, i.emit("end"), n.autoDestroy)) {
1580
+ var p = i._writableState;
1581
+ (!p || p.autoDestroy && p.finished) && i.destroy();
1582
+ }
1583
+ }
1584
+ typeof Symbol == "function" && (D.from = function(n, i) {
1585
+ return R === void 0 && (R = br()), R(D, n, i);
1586
+ });
1587
+ function P(n, i) {
1588
+ for (var p = 0, E = n.length; p < E; p++)
1589
+ if (n[p] === i)
1590
+ return p;
1591
+ return -1;
1592
+ }
1593
+ return qe;
1594
+ }
1595
+ var ke, ct;
1596
+ function Dt() {
1597
+ if (ct)
1598
+ return ke;
1599
+ ct = 1, ke = u;
1600
+ var t = Q().codes, e = t.ERR_METHOD_NOT_IMPLEMENTED, r = t.ERR_MULTIPLE_CALLBACK, a = t.ERR_TRANSFORM_ALREADY_TRANSFORMING, o = t.ERR_TRANSFORM_WITH_LENGTH_0, s = X();
1601
+ J(u, s);
1602
+ function f(g, y) {
1603
+ var _ = this._transformState;
1604
+ _.transforming = !1;
1605
+ var M = _.writecb;
1606
+ if (M === null)
1607
+ return this.emit("error", new r());
1608
+ _.writechunk = null, _.writecb = null, y != null && this.push(y), M(g);
1609
+ var m = this._readableState;
1610
+ m.reading = !1, (m.needReadable || m.length < m.highWaterMark) && this._read(m.highWaterMark);
1611
+ }
1612
+ function u(g) {
1613
+ if (!(this instanceof u))
1614
+ return new u(g);
1615
+ s.call(this, g), this._transformState = {
1616
+ afterTransform: f.bind(this),
1617
+ needTransform: !1,
1618
+ transforming: !1,
1619
+ writecb: null,
1620
+ writechunk: null,
1621
+ writeencoding: null
1622
+ }, this._readableState.needReadable = !0, this._readableState.sync = !1, g && (typeof g.transform == "function" && (this._transform = g.transform), typeof g.flush == "function" && (this._flush = g.flush)), this.on("prefinish", l);
1623
+ }
1624
+ function l() {
1625
+ var g = this;
1626
+ typeof this._flush == "function" && !this._readableState.destroyed ? this._flush(function(y, _) {
1627
+ h(g, y, _);
1628
+ }) : h(this, null, null);
1629
+ }
1630
+ u.prototype.push = function(g, y) {
1631
+ return this._transformState.needTransform = !1, s.prototype.push.call(this, g, y);
1632
+ }, u.prototype._transform = function(g, y, _) {
1633
+ _(new e("_transform()"));
1634
+ }, u.prototype._write = function(g, y, _) {
1635
+ var M = this._transformState;
1636
+ if (M.writecb = _, M.writechunk = g, M.writeencoding = y, !M.transforming) {
1637
+ var m = this._readableState;
1638
+ (M.needTransform || m.needReadable || m.length < m.highWaterMark) && this._read(m.highWaterMark);
1639
+ }
1640
+ }, u.prototype._read = function(g) {
1641
+ var y = this._transformState;
1642
+ y.writechunk !== null && !y.transforming ? (y.transforming = !0, this._transform(y.writechunk, y.writeencoding, y.afterTransform)) : y.needTransform = !0;
1643
+ }, u.prototype._destroy = function(g, y) {
1644
+ s.prototype._destroy.call(this, g, function(_) {
1645
+ y(_);
1646
+ });
1647
+ };
1648
+ function h(g, y, _) {
1649
+ if (y)
1650
+ return g.emit("error", y);
1651
+ if (_ != null && g.push(_), g._writableState.length)
1652
+ throw new o();
1653
+ if (g._transformState.transforming)
1654
+ throw new a();
1655
+ return g.push(null);
1656
+ }
1657
+ return ke;
1658
+ }
1659
+ var je, ht;
1660
+ function gr() {
1661
+ if (ht)
1662
+ return je;
1663
+ ht = 1, je = e;
1664
+ var t = Dt();
1665
+ J(e, t);
1666
+ function e(r) {
1667
+ if (!(this instanceof e))
1668
+ return new e(r);
1669
+ t.call(this, r);
1670
+ }
1671
+ return e.prototype._transform = function(r, a, o) {
1672
+ o(null, r);
1673
+ }, je;
1674
+ }
1675
+ var Ie, pt;
1676
+ function yr() {
1677
+ if (pt)
1678
+ return Ie;
1679
+ pt = 1;
1680
+ var t;
1681
+ function e(_) {
1682
+ var M = !1;
1683
+ return function() {
1684
+ M || (M = !0, _.apply(void 0, arguments));
1685
+ };
1686
+ }
1687
+ var r = Q().codes, a = r.ERR_MISSING_ARGS, o = r.ERR_STREAM_DESTROYED;
1688
+ function s(_) {
1689
+ if (_)
1690
+ throw _;
1691
+ }
1692
+ function f(_) {
1693
+ return _.setHeader && typeof _.abort == "function";
1694
+ }
1695
+ function u(_, M, m, S) {
1696
+ S = e(S);
1697
+ var b = !1;
1698
+ _.on("close", function() {
1699
+ b = !0;
1700
+ }), t === void 0 && (t = Ge()), t(_, {
1701
+ readable: M,
1702
+ writable: m
1703
+ }, function(T) {
1704
+ if (T)
1705
+ return S(T);
1706
+ b = !0, S();
1707
+ });
1708
+ var w = !1;
1709
+ return function(T) {
1710
+ if (!b && !w) {
1711
+ if (w = !0, f(_))
1712
+ return _.abort();
1713
+ if (typeof _.destroy == "function")
1714
+ return _.destroy();
1715
+ S(T || new o("pipe"));
1716
+ }
1717
+ };
1718
+ }
1719
+ function l(_) {
1720
+ _();
1721
+ }
1722
+ function h(_, M) {
1723
+ return _.pipe(M);
1724
+ }
1725
+ function g(_) {
1726
+ return !_.length || typeof _[_.length - 1] != "function" ? s : _.pop();
1727
+ }
1728
+ function y() {
1729
+ for (var _ = arguments.length, M = new Array(_), m = 0; m < _; m++)
1730
+ M[m] = arguments[m];
1731
+ var S = g(M);
1732
+ if (Array.isArray(M[0]) && (M = M[0]), M.length < 2)
1733
+ throw new a("streams");
1734
+ var b, w = M.map(function(T, L) {
1735
+ var R = L < M.length - 1, A = L > 0;
1736
+ return u(T, R, A, function(O) {
1737
+ b || (b = O), O && w.forEach(l), !R && (w.forEach(l), S(b));
1738
+ });
1739
+ });
1740
+ return M.reduce(h);
1741
+ }
1742
+ return Ie = y, Ie;
1743
+ }
1744
+ var xt = F, Ke = $e.EventEmitter, wr = J;
1745
+ wr(F, Ke);
1746
+ F.Readable = Ot();
1747
+ F.Writable = Mt();
1748
+ F.Duplex = X();
1749
+ F.Transform = Dt();
1750
+ F.PassThrough = gr();
1751
+ F.finished = Ge();
1752
+ F.pipeline = yr();
1753
+ F.Stream = F;
1754
+ function F() {
1755
+ Ke.call(this);
1756
+ }
1757
+ F.prototype.pipe = function(t, e) {
1758
+ var r = this;
1759
+ function a(g) {
1760
+ t.writable && t.write(g) === !1 && r.pause && r.pause();
1761
+ }
1762
+ r.on("data", a);
1763
+ function o() {
1764
+ r.readable && r.resume && r.resume();
1765
+ }
1766
+ t.on("drain", o), !t._isStdio && (!e || e.end !== !1) && (r.on("end", f), r.on("close", u));
1767
+ var s = !1;
1768
+ function f() {
1769
+ s || (s = !0, t.end());
1770
+ }
1771
+ function u() {
1772
+ s || (s = !0, typeof t.destroy == "function" && t.destroy());
1773
+ }
1774
+ function l(g) {
1775
+ if (h(), Ke.listenerCount(this, "error") === 0)
1776
+ throw g;
1777
+ }
1778
+ r.on("error", l), t.on("error", l);
1779
+ function h() {
1780
+ r.removeListener("data", a), t.removeListener("drain", o), r.removeListener("end", f), r.removeListener("close", u), r.removeListener("error", l), t.removeListener("error", l), r.removeListener("end", h), r.removeListener("close", h), t.removeListener("close", h);
1781
+ }
1782
+ return r.on("end", h), r.on("close", h), t.on("close", h), t.emit("pipe", r), t;
1783
+ };
1784
+ function re(t) {
1785
+ return t.replace(/%([0-9A-Fa-f]{2})/g, (e, r) => String.fromCharCode(parseInt(r, 16)));
1786
+ }
1787
+ function Pt(t, e) {
1788
+ return String(e).replace(t, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0")}`);
1789
+ }
1790
+ function te(t) {
1791
+ return Pt(/[\n;\r\t=%&,\x00-\x1f\x7f-\xff]/g, t);
1792
+ }
1793
+ function W(t) {
1794
+ return Pt(/[\n\r\t%\x00-\x1f\x7f-\xff]/g, t);
1795
+ }
1796
+ function Nt(t) {
1797
+ if (!(t && t.length) || t === ".")
1798
+ return {};
1799
+ const e = {};
1800
+ return t.replace(/\r?\n$/, "").split(";").forEach((r) => {
1801
+ const a = r.split("=", 2);
1802
+ if (!(a[1] && a[1].length))
1803
+ return;
1804
+ a[0] = a[0].trim();
1805
+ let o = e[a[0].trim()];
1806
+ o || (o = [], e[a[0]] = o), o.push(...a[1].split(",").map((s) => s.trim()).map(re));
1807
+ }), e;
1808
+ }
1809
+ function qt(t) {
1810
+ const e = t.split(" ").map((a) => a === "." || a === "" ? null : a);
1811
+ return {
1812
+ seq_id: e[0] && re(e[0]),
1813
+ source: e[1] && re(e[1]),
1814
+ type: e[2] && re(e[2]),
1815
+ start: e[3] === null ? null : parseInt(e[3], 10),
1816
+ end: e[4] === null ? null : parseInt(e[4], 10),
1817
+ score: e[5] === null ? null : parseFloat(e[5]),
1818
+ strand: e[6],
1819
+ phase: e[7],
1820
+ attributes: e[8] === null ? null : Nt(e[8])
1821
+ };
1822
+ }
1823
+ function kt(t) {
1824
+ const e = /^\s*##\s*(\S+)\s*(.*)/.exec(t);
1825
+ if (!e)
1826
+ return null;
1827
+ const [, r] = e;
1828
+ let [, , a] = e;
1829
+ const o = { directive: r };
1830
+ if (a.length && (a = a.replace(/\r?\n$/, ""), o.value = a), r === "sequence-region") {
1831
+ const s = a.split(/\s+/, 3);
1832
+ return {
1833
+ ...o,
1834
+ seq_id: s[0],
1835
+ start: s[1] && s[1].replace(/\D/g, ""),
1836
+ end: s[2] && s[2].replace(/\D/g, "")
1837
+ };
1838
+ } else if (r === "genome-build") {
1839
+ const [s, f] = a.split(/\s+/, 2);
1840
+ return {
1841
+ ...o,
1842
+ source: s,
1843
+ buildName: f
1844
+ };
1845
+ }
1846
+ return o;
1847
+ }
1848
+ function jt(t) {
1849
+ const e = [];
1850
+ return Object.entries(t).forEach(([r, a]) => {
1851
+ if (!a)
1852
+ return;
1853
+ let o;
1854
+ a.hasOwnProperty("toString") ? o = te(a.toString()) : Array.isArray(a) ? o = a.map(te).join(",") : o = te(a), e.push(`${te(r)}=${o}`);
1855
+ }), e.length ? e.join(";") : ".";
1856
+ }
1857
+ function mr(t, e) {
1858
+ const r = t.attributes === null || t.attributes === void 0 ? "." : jt(t.attributes), o = `${[
1859
+ t.seq_id === null ? "." : W(t.seq_id),
1860
+ t.source === null ? "." : W(t.source),
1861
+ t.type === null ? "." : W(t.type),
1862
+ t.start === null ? "." : W(t.start),
1863
+ t.end === null ? "." : W(t.end),
1864
+ t.score === null ? "." : W(t.score),
1865
+ t.strand === null ? "." : W(t.strand),
1866
+ t.phase === null ? "." : W(t.phase),
1867
+ r
1868
+ ].join(" ")}
1869
+ `;
1870
+ return e[o] ? "" : (e[o] = !0, o);
1871
+ }
1872
+ function le(t, e) {
1873
+ if (Array.isArray(t))
1874
+ return t.map((a) => le(a, e)).join("");
1875
+ const r = [mr(t, e)];
1876
+ return Er(t) && r.push(...t.child_features.map((a) => le(a, e)), ...t.derived_features.map((a) => le(a, e))), r.join("");
1877
+ }
1878
+ function It(t) {
1879
+ return le(t, {});
1880
+ }
1881
+ function Ft(t) {
1882
+ let e = `##${t.directive}`;
1883
+ return t.value && (e += ` ${t.value}`), e += `
1884
+ `, e;
1885
+ }
1886
+ function Bt(t) {
1887
+ return `# ${t.comment}
1888
+ `;
1889
+ }
1890
+ function Ye(t) {
1891
+ return `>${t.id}${t.description ? ` ${t.description}` : ""}
1892
+ ${t.sequence}
1893
+ `;
1894
+ }
1895
+ function de(t) {
1896
+ function e(r) {
1897
+ return "attributes" in r ? It(r) : "directive" in r ? Ft(r) : "sequence" in r ? Ye(r) : "comment" in r ? Bt(r) : `# (invalid item found during format)
1898
+ `;
1899
+ }
1900
+ return Array.isArray(t) ? t.map(e) : e(t);
1901
+ }
1902
+ function Er(t) {
1903
+ return t.child_features !== void 0 && t.derived_features !== void 0;
1904
+ }
1905
+ const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1906
+ __proto__: null,
1907
+ escape: te,
1908
+ escapeColumn: W,
1909
+ formatAttributes: jt,
1910
+ formatComment: Bt,
1911
+ formatDirective: Ft,
1912
+ formatFeature: It,
1913
+ formatItem: de,
1914
+ formatSequence: Ye,
1915
+ parseAttributes: Nt,
1916
+ parseDirective: kt,
1917
+ parseFeature: qt,
1918
+ unescape: re
1919
+ }, Symbol.toStringTag, { value: "Module" })), vt = {
1920
+ Parent: "child_features",
1921
+ Derives_from: "derived_features"
1922
+ };
1923
+ class _t {
1924
+ constructor(e) {
1925
+ this.seqCallback = e, this.currentSequence = void 0;
1926
+ }
1927
+ addLine(e) {
1928
+ const r = /^>\s*(\S+)\s*(.*)/.exec(e);
1929
+ r ? (this._flush(), this.currentSequence = { id: r[1], sequence: "" }, r[2] && (this.currentSequence.description = r[2].trim())) : this.currentSequence && /\S/.test(e) && (this.currentSequence.sequence += e.replace(/\s/g, ""));
1930
+ }
1931
+ _flush() {
1932
+ this.currentSequence && this.seqCallback(this.currentSequence);
1933
+ }
1934
+ finish() {
1935
+ this._flush();
1936
+ }
1937
+ }
1938
+ class Wt {
1939
+ constructor(e) {
1940
+ this.fastaParser = void 0, this.eof = !1, this.lineNumber = 0, this._underConstructionTopLevel = [], this._underConstructionById = {}, this._completedReferences = {}, this._underConstructionOrphans = {};
1941
+ const r = () => {
1942
+ };
1943
+ this.featureCallback = e.featureCallback || r, this.endCallback = e.endCallback || r, this.commentCallback = e.commentCallback || r, this.errorCallback = e.errorCallback || r, this.directiveCallback = e.directiveCallback || r, this.sequenceCallback = e.sequenceCallback || r, this.disableDerivesFromReferences = e.disableDerivesFromReferences || !1, this.bufferSize = e.bufferSize === void 0 ? 1e3 : e.bufferSize;
1944
+ }
1945
+ addLine(e) {
1946
+ if (this.fastaParser) {
1947
+ this.fastaParser.addLine(e);
1948
+ return;
1949
+ }
1950
+ if (this.eof)
1951
+ return;
1952
+ if (this.lineNumber += 1, /^\s*[^#\s>]/.test(e)) {
1953
+ this._bufferLine(e);
1954
+ return;
1955
+ }
1956
+ const r = /^\s*(#+)(.*)/.exec(e);
1957
+ if (r) {
1958
+ const [, a] = r;
1959
+ let [, , o] = r;
1960
+ if (a.length === 3)
1961
+ this._emitAllUnderConstructionFeatures();
1962
+ else if (a.length === 2) {
1963
+ const s = kt(e);
1964
+ s && (s.directive === "FASTA" ? (this._emitAllUnderConstructionFeatures(), this.eof = !0, this.fastaParser = new _t(this.sequenceCallback)) : this._emitItem(s));
1965
+ } else
1966
+ o = o.replace(/\s*/, ""), this._emitItem({ comment: o });
1967
+ } else if (!/^\s*$/.test(e))
1968
+ if (/^\s*>/.test(e))
1969
+ this._emitAllUnderConstructionFeatures(), this.eof = !0, this.fastaParser = new _t(this.sequenceCallback), this.fastaParser.addLine(e);
1970
+ else {
1971
+ const a = e.replace(/\r?\n?$/g, "");
1972
+ throw new Error(`GFF3 parse error. Cannot parse '${a}'.`);
1973
+ }
1974
+ }
1975
+ finish() {
1976
+ this._emitAllUnderConstructionFeatures(), this.fastaParser && this.fastaParser.finish(), this.endCallback();
1977
+ }
1978
+ _emitItem(e) {
1979
+ Array.isArray(e) ? this.featureCallback(e) : "directive" in e ? this.directiveCallback(e) : "comment" in e && this.commentCallback(e);
1980
+ }
1981
+ _enforceBufferSizeLimit(e = 0) {
1982
+ const r = (a) => {
1983
+ a && Array.isArray(a) && a[0].attributes && a[0].attributes.ID && a[0].attributes.ID[0] && (a[0].attributes.ID.forEach((s) => {
1984
+ delete this._underConstructionById[s], delete this._completedReferences[s];
1985
+ }), a.forEach((s) => {
1986
+ s.child_features && s.child_features.forEach((f) => r(f)), s.derived_features && s.derived_features.forEach((f) => r(f));
1987
+ }));
1988
+ };
1989
+ for (; this._underConstructionTopLevel.length + e > this.bufferSize; ) {
1990
+ const a = this._underConstructionTopLevel.shift();
1991
+ a && (this._emitItem(a), r(a));
1992
+ }
1993
+ }
1994
+ /**
1995
+ * return all under-construction features, called when we know
1996
+ * there will be no additional data to attach to them
1997
+ */
1998
+ _emitAllUnderConstructionFeatures() {
1999
+ if (this._underConstructionTopLevel.forEach(this._emitItem.bind(this)), this._underConstructionTopLevel = [], this._underConstructionById = {}, this._completedReferences = {}, Array.from(Object.values(this._underConstructionOrphans)).length)
2000
+ throw new Error(`some features reference other features that do not exist in the file (or in the same '###' scope). ${Object.keys(this._underConstructionOrphans)}`);
2001
+ }
2002
+ // do the right thing with a newly-parsed feature line
2003
+ _bufferLine(e) {
2004
+ var r, a, o;
2005
+ const f = {
2006
+ ...qt(e),
2007
+ child_features: [],
2008
+ derived_features: []
2009
+ }, u = ((r = f.attributes) === null || r === void 0 ? void 0 : r.ID) || [], l = ((a = f.attributes) === null || a === void 0 ? void 0 : a.Parent) || [], h = this.disableDerivesFromReferences ? [] : ((o = f.attributes) === null || o === void 0 ? void 0 : o.Derives_from) || [];
2010
+ if (!u.length && !l.length && !h.length) {
2011
+ this._emitItem([f]);
2012
+ return;
2013
+ }
2014
+ let g;
2015
+ u.forEach((y) => {
2016
+ const _ = this._underConstructionById[y];
2017
+ _ ? (_[_.length - 1].type !== f.type && this._parseError(`multi-line feature "${y}" has inconsistent types: "${f.type}", "${_[_.length - 1].type}"`), _.push(f), g = _) : (g = [f], this._enforceBufferSizeLimit(1), !l.length && !h.length && this._underConstructionTopLevel.push(g), this._underConstructionById[y] = g, this._resolveReferencesTo(g, y));
2018
+ }), this._resolveReferencesFrom(g || [f], { Parent: l, Derives_from: h }, u);
2019
+ }
2020
+ _resolveReferencesTo(e, r) {
2021
+ const a = this._underConstructionOrphans[r];
2022
+ a && (e.forEach((o) => {
2023
+ o.child_features.push(...a.Parent);
2024
+ }), e.forEach((o) => {
2025
+ o.derived_features.push(...a.Derives_from);
2026
+ }), delete this._underConstructionOrphans[r]);
2027
+ }
2028
+ _parseError(e) {
2029
+ this.eof = !0, this.errorCallback(`${this.lineNumber}: ${e}`);
2030
+ }
2031
+ _resolveReferencesFrom(e, r, a) {
2032
+ function o(s, f, u) {
2033
+ let l = s[f];
2034
+ l || (l = {}, s[f] = l);
2035
+ const h = l[u] || !1;
2036
+ return l[u] = !0, h;
2037
+ }
2038
+ r.Parent.forEach((s) => {
2039
+ const f = this._underConstructionById[s];
2040
+ if (f) {
2041
+ const u = vt.Parent;
2042
+ a.filter((l) => o(this._completedReferences, l, `Parent,${s}`)).length || f.forEach((l) => {
2043
+ l[u].push(e);
2044
+ });
2045
+ } else {
2046
+ let u = this._underConstructionOrphans[s];
2047
+ u || (u = {
2048
+ Parent: [],
2049
+ Derives_from: []
2050
+ }, this._underConstructionOrphans[s] = u), u.Parent.push(e);
2051
+ }
2052
+ }), r.Derives_from.forEach((s) => {
2053
+ const f = this._underConstructionById[s];
2054
+ if (f) {
2055
+ const u = vt.Derives_from;
2056
+ a.filter((l) => o(this._completedReferences, l, `Derives_from,${s}`)).length || f.forEach((l) => {
2057
+ l[u].push(e);
2058
+ });
2059
+ } else {
2060
+ let u = this._underConstructionOrphans[s];
2061
+ u || (u = {
2062
+ Parent: [],
2063
+ Derives_from: []
2064
+ }, this._underConstructionOrphans[s] = u), u.Derives_from.push(e);
2065
+ }
2066
+ });
2067
+ }
2068
+ }
2069
+ function Ue(t) {
2070
+ process && process.nextTick ? process.nextTick(t) : t();
2071
+ }
2072
+ function Ut(t) {
2073
+ const e = {
2074
+ encoding: "utf8",
2075
+ parseFeatures: !0,
2076
+ parseDirectives: !1,
2077
+ parseSequences: !0,
2078
+ parseComments: !1,
2079
+ bufferSize: 1e3,
2080
+ disableDerivesFromReferences: !1,
2081
+ ...t
2082
+ };
2083
+ return t.parseAll && (e.parseFeatures = !0, e.parseDirectives = !0, e.parseComments = !0, e.parseSequences = !0), e;
2084
+ }
2085
+ class Rr extends xt.Transform {
2086
+ constructor(e = {}) {
2087
+ super({ objectMode: !0 }), this.textBuffer = "";
2088
+ const r = Ut(e);
2089
+ this.encoding = e.encoding || "utf8", this.decoder = new ir();
2090
+ const a = this.push.bind(this);
2091
+ this.parser = new Wt({
2092
+ featureCallback: r.parseFeatures ? a : void 0,
2093
+ directiveCallback: r.parseDirectives ? a : void 0,
2094
+ commentCallback: r.parseComments ? a : void 0,
2095
+ sequenceCallback: r.parseSequences ? a : void 0,
2096
+ errorCallback: (o) => this.emit("error", o),
2097
+ bufferSize: r.bufferSize,
2098
+ disableDerivesFromReferences: r.disableDerivesFromReferences
2099
+ });
2100
+ }
2101
+ _addLine(e) {
2102
+ e && this.parser.addLine(e);
2103
+ }
2104
+ _nextText(e) {
2105
+ const r = (this.textBuffer + e).split(/\r?\n/);
2106
+ this.textBuffer = r.pop() || "", r.forEach((a) => this._addLine(a));
2107
+ }
2108
+ _transform(e, r, a) {
2109
+ this._nextText(this.decoder.write(e)), Ue(a);
2110
+ }
2111
+ _flush(e) {
2112
+ this.decoder.end && this._nextText(this.decoder.end()), this.textBuffer != null && this._addLine(this.textBuffer), this.parser.finish(), Ue(e);
2113
+ }
2114
+ }
2115
+ function Lr(t = {}) {
2116
+ return new Rr(t);
2117
+ }
2118
+ function Tr(t, e = {}) {
2119
+ if (!t)
2120
+ return [];
2121
+ const r = Ut(e), a = [], o = a.push.bind(a), s = new Wt({
2122
+ featureCallback: r.parseFeatures ? o : void 0,
2123
+ directiveCallback: r.parseDirectives ? o : void 0,
2124
+ commentCallback: r.parseComments ? o : void 0,
2125
+ sequenceCallback: r.parseSequences ? o : void 0,
2126
+ disableDerivesFromReferences: r.disableDerivesFromReferences || !1,
2127
+ bufferSize: 1 / 0,
2128
+ errorCallback: (f) => {
2129
+ throw f;
2130
+ }
2131
+ });
2132
+ return t.split(/\r?\n/).forEach(s.addLine.bind(s)), s.finish(), a;
2133
+ }
2134
+ function Cr(t) {
2135
+ const e = [], r = [];
2136
+ t.forEach((o) => {
2137
+ "sequence" in o ? r.push(o) : e.push(o);
2138
+ });
2139
+ let a = e.map(de).join("");
2140
+ return r.length && (a += `##FASTA
2141
+ `, a += r.map(Ye).join("")), a;
2142
+ }
2143
+ class Ht extends xt.Transform {
2144
+ constructor(e = {}) {
2145
+ super(Object.assign(e, { objectMode: !0 })), this.linesSinceLastSyncMark = 0, this.haveWeEmittedData = !1, this.fastaMode = !1, this.minLinesBetweenSyncMarks = e.minSyncLines || 100, this.insertVersionDirective = e.insertVersionDirective || !1;
2146
+ }
2147
+ _transform(e, r, a) {
2148
+ let o;
2149
+ if (!this.haveWeEmittedData && this.insertVersionDirective) {
2150
+ const s = Array.isArray(e) ? e[0] : e;
2151
+ "directive" in s && s.directive !== "gff-version" && this.push(`##gff-version 3
2152
+ `);
2153
+ }
2154
+ if ("sequence" in e && !this.fastaMode && (this.push(`##FASTA
2155
+ `), this.fastaMode = !0), Array.isArray(e) ? o = e.map(de).join("") : o = de(e), this.push(o), this.linesSinceLastSyncMark >= this.minLinesBetweenSyncMarks)
2156
+ this.push(`###
2157
+ `), this.linesSinceLastSyncMark = 0;
2158
+ else {
2159
+ let s = 0;
2160
+ for (let f = 0; f < o.length; f += 1)
2161
+ o[f] === `
2162
+ ` && (s += 1);
2163
+ this.linesSinceLastSyncMark += s;
2164
+ }
2165
+ this.haveWeEmittedData = !0, Ue(a);
2166
+ }
2167
+ }
2168
+ function Ar(t = {}) {
2169
+ return new Ht(t);
2170
+ }
2171
+ function Mr(t, e, r = {}) {
2172
+ const a = {
2173
+ insertVersionDirective: !0,
2174
+ ...r
2175
+ };
2176
+ return new Promise((o, s) => {
2177
+ t.pipe(new Ht(a)).on("end", () => o(null)).on("error", s).pipe(e);
2178
+ });
2179
+ }
2180
+ const Pr = {
2181
+ parseStream: Lr,
2182
+ parseStringSync: Tr,
2183
+ formatSync: Cr,
2184
+ formatStream: Ar,
2185
+ formatFile: Mr,
2186
+ util: Sr
2187
+ };
2188
+ export {
2189
+ Pr as default
2190
+ };