@asgard-js/core 0.3.12 → 0.3.14

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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- class te extends Error {
1
+ class I extends Error {
2
2
  status;
3
3
  statusText;
4
4
  body;
@@ -6,110 +6,110 @@ class te extends Error {
6
6
  super(`HTTP ${t}: ${e}`), this.name = "HttpError", this.status = t, this.statusText = e, this.body = r;
7
7
  }
8
8
  }
9
- function wn(n) {
10
- return n instanceof te;
9
+ function Tn(n) {
10
+ return n instanceof I;
11
11
  }
12
- var H = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n))(H || {}), d = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.MESSAGE_USER = "asgard.message.user", n.MESSAGE_THINKING_START = "asgard.message.thinking.start", n.MESSAGE_THINKING_DELTA = "asgard.message.thinking.delta", n.MESSAGE_THINKING_COMPLETE = "asgard.message.thinking.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.TOOL_CALL_CONSENT = "asgard.tool_call.consent", n.SUBAGENT_START = "asgard.subagent.start", n.SUBAGENT_COMPLETE = "asgard.subagent.complete", n.CHANNEL_TITLE_UPDATE = "asgard.channel.title.update", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(d || {}), Ke = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Ke || {}), Fe = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n.TABLE = "TABLE", n.ATTACHMENT = "ATTACHMENT", n))(Fe || {}), J = function(n, t) {
13
- return J = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
12
+ var $ = /* @__PURE__ */ ((n) => (n.RESET_CHANNEL = "RESET_CHANNEL", n.NONE = "NONE", n.RESPONSE_TOOL_CALL_CONSENT = "RESPONSE_TOOL_CALL_CONSENT", n.NUDGE = "NUDGE", n))($ || {}), d = /* @__PURE__ */ ((n) => (n.INIT = "asgard.run.init", n.PROCESS = "asgard.process", n.PROCESS_START = "asgard.process.start", n.PROCESS_COMPLETE = "asgard.process.complete", n.MESSAGE = "asgard.message", n.MESSAGE_START = "asgard.message.start", n.MESSAGE_DELTA = "asgard.message.delta", n.MESSAGE_COMPLETE = "asgard.message.complete", n.MESSAGE_USER = "asgard.message.user", n.MESSAGE_THINKING_START = "asgard.message.thinking.start", n.MESSAGE_THINKING_DELTA = "asgard.message.thinking.delta", n.MESSAGE_THINKING_COMPLETE = "asgard.message.thinking.complete", n.TOOL_CALL = "asgard.tool_call", n.TOOL_CALL_START = "asgard.tool_call.start", n.TOOL_CALL_COMPLETE = "asgard.tool_call.complete", n.TOOL_CALL_CONSENT = "asgard.tool_call.consent", n.SUBAGENT_START = "asgard.subagent.start", n.SUBAGENT_COMPLETE = "asgard.subagent.complete", n.CHANNEL_TITLE_UPDATE = "asgard.channel.title.update", n.SANDBOX_LAUNCH = "asgard.sandbox.launch", n.SANDBOX_READY = "asgard.sandbox.ready", n.DONE = "asgard.run.done", n.ERROR = "asgard.run.error", n))(d || {}), Be = /* @__PURE__ */ ((n) => (n.ALLOW_ONCE = "ALLOW_ONCE", n.ALLOW_ALWAYS = "ALLOW_ALWAYS", n.DENY_ONCE = "DENY_ONCE", n))(Be || {}), Ke = /* @__PURE__ */ ((n) => (n.TEXT = "TEXT", n.HINT = "HINT", n.BUTTON = "BUTTON", n.IMAGE = "IMAGE", n.VIDEO = "VIDEO", n.AUDIO = "AUDIO", n.LOCATION = "LOCATION", n.CAROUSEL = "CAROUSEL", n.CHART = "CHART", n.TABLE = "TABLE", n.ATTACHMENT = "ATTACHMENT", n))(Ke || {}), Q = function(n, t) {
13
+ return Q = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
14
14
  e.__proto__ = r;
15
15
  } || function(e, r) {
16
16
  for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (e[s] = r[s]);
17
- }, J(n, t);
17
+ }, Q(n, t);
18
18
  };
19
- function w(n, t) {
19
+ function T(n, t) {
20
20
  if (typeof t != "function" && t !== null)
21
21
  throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
22
- J(n, t);
22
+ Q(n, t);
23
23
  function e() {
24
24
  this.constructor = n;
25
25
  }
26
26
  n.prototype = t === null ? Object.create(t) : (e.prototype = t.prototype, new e());
27
27
  }
28
- function Be(n, t, e, r) {
29
- function s(i) {
30
- return i instanceof e ? i : new e(function(o) {
31
- o(i);
28
+ function qe(n, t, e, r) {
29
+ function s(o) {
30
+ return o instanceof e ? o : new e(function(i) {
31
+ i(o);
32
32
  });
33
33
  }
34
- return new (e || (e = Promise))(function(i, o) {
34
+ return new (e || (e = Promise))(function(o, i) {
35
35
  function a(h) {
36
36
  try {
37
- c(r.next(h));
38
- } catch (g) {
39
- o(g);
37
+ u(r.next(h));
38
+ } catch (m) {
39
+ i(m);
40
40
  }
41
41
  }
42
- function u(h) {
42
+ function c(h) {
43
43
  try {
44
- c(r.throw(h));
45
- } catch (g) {
46
- o(g);
44
+ u(r.throw(h));
45
+ } catch (m) {
46
+ i(m);
47
47
  }
48
48
  }
49
- function c(h) {
50
- h.done ? i(h.value) : s(h.value).then(a, u);
49
+ function u(h) {
50
+ h.done ? o(h.value) : s(h.value).then(a, c);
51
51
  }
52
- c((r = r.apply(n, t || [])).next());
52
+ u((r = r.apply(n, t || [])).next());
53
53
  });
54
54
  }
55
55
  function ve(n, t) {
56
56
  var e = { label: 0, sent: function() {
57
- if (i[0] & 1) throw i[1];
58
- return i[1];
59
- }, trys: [], ops: [] }, r, s, i, o = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
60
- return o.next = a(0), o.throw = a(1), o.return = a(2), typeof Symbol == "function" && (o[Symbol.iterator] = function() {
57
+ if (o[0] & 1) throw o[1];
58
+ return o[1];
59
+ }, trys: [], ops: [] }, r, s, o, i = Object.create((typeof Iterator == "function" ? Iterator : Object).prototype);
60
+ return i.next = a(0), i.throw = a(1), i.return = a(2), typeof Symbol == "function" && (i[Symbol.iterator] = function() {
61
61
  return this;
62
- }), o;
63
- function a(c) {
62
+ }), i;
63
+ function a(u) {
64
64
  return function(h) {
65
- return u([c, h]);
65
+ return c([u, h]);
66
66
  };
67
67
  }
68
- function u(c) {
68
+ function c(u) {
69
69
  if (r) throw new TypeError("Generator is already executing.");
70
- for (; o && (o = 0, c[0] && (e = 0)), e; ) try {
71
- if (r = 1, s && (i = c[0] & 2 ? s.return : c[0] ? s.throw || ((i = s.return) && i.call(s), 0) : s.next) && !(i = i.call(s, c[1])).done) return i;
72
- switch (s = 0, i && (c = [c[0] & 2, i.value]), c[0]) {
70
+ for (; i && (i = 0, u[0] && (e = 0)), e; ) try {
71
+ if (r = 1, s && (o = u[0] & 2 ? s.return : u[0] ? s.throw || ((o = s.return) && o.call(s), 0) : s.next) && !(o = o.call(s, u[1])).done) return o;
72
+ switch (s = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
73
73
  case 0:
74
74
  case 1:
75
- i = c;
75
+ o = u;
76
76
  break;
77
77
  case 4:
78
- return e.label++, { value: c[1], done: !1 };
78
+ return e.label++, { value: u[1], done: !1 };
79
79
  case 5:
80
- e.label++, s = c[1], c = [0];
80
+ e.label++, s = u[1], u = [0];
81
81
  continue;
82
82
  case 7:
83
- c = e.ops.pop(), e.trys.pop();
83
+ u = e.ops.pop(), e.trys.pop();
84
84
  continue;
85
85
  default:
86
- if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (c[0] === 6 || c[0] === 2)) {
86
+ if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
87
87
  e = 0;
88
88
  continue;
89
89
  }
90
- if (c[0] === 3 && (!i || c[1] > i[0] && c[1] < i[3])) {
91
- e.label = c[1];
90
+ if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
91
+ e.label = u[1];
92
92
  break;
93
93
  }
94
- if (c[0] === 6 && e.label < i[1]) {
95
- e.label = i[1], i = c;
94
+ if (u[0] === 6 && e.label < o[1]) {
95
+ e.label = o[1], o = u;
96
96
  break;
97
97
  }
98
- if (i && e.label < i[2]) {
99
- e.label = i[2], e.ops.push(c);
98
+ if (o && e.label < o[2]) {
99
+ e.label = o[2], e.ops.push(u);
100
100
  break;
101
101
  }
102
- i[2] && e.ops.pop(), e.trys.pop();
102
+ o[2] && e.ops.pop(), e.trys.pop();
103
103
  continue;
104
104
  }
105
- c = t.call(n, e);
105
+ u = t.call(n, e);
106
106
  } catch (h) {
107
- c = [6, h], s = 0;
107
+ u = [6, h], s = 0;
108
108
  } finally {
109
- r = i = 0;
109
+ r = o = 0;
110
110
  }
111
- if (c[0] & 5) throw c[1];
112
- return { value: c[0] ? c[1] : void 0, done: !0 };
111
+ if (u[0] & 5) throw u[1];
112
+ return { value: u[0] ? u[1] : void 0, done: !0 };
113
113
  }
114
114
  }
115
115
  function k(n) {
@@ -122,89 +122,89 @@ function k(n) {
122
122
  };
123
123
  throw new TypeError(t ? "Object is not iterable." : "Symbol.iterator is not defined.");
124
124
  }
125
- function R(n, t) {
125
+ function D(n, t) {
126
126
  var e = typeof Symbol == "function" && n[Symbol.iterator];
127
127
  if (!e) return n;
128
- var r = e.call(n), s, i = [], o;
128
+ var r = e.call(n), s, o = [], i;
129
129
  try {
130
- for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) i.push(s.value);
130
+ for (; (t === void 0 || t-- > 0) && !(s = r.next()).done; ) o.push(s.value);
131
131
  } catch (a) {
132
- o = { error: a };
132
+ i = { error: a };
133
133
  } finally {
134
134
  try {
135
135
  s && !s.done && (e = r.return) && e.call(r);
136
136
  } finally {
137
- if (o) throw o.error;
137
+ if (i) throw i.error;
138
138
  }
139
139
  }
140
- return i;
140
+ return o;
141
141
  }
142
- function $(n, t, e) {
143
- if (e || arguments.length === 2) for (var r = 0, s = t.length, i; r < s; r++)
144
- (i || !(r in t)) && (i || (i = Array.prototype.slice.call(t, 0, r)), i[r] = t[r]);
145
- return n.concat(i || Array.prototype.slice.call(t));
142
+ function H(n, t, e) {
143
+ if (e || arguments.length === 2) for (var r = 0, s = t.length, o; r < s; r++)
144
+ (o || !(r in t)) && (o || (o = Array.prototype.slice.call(t, 0, r)), o[r] = t[r]);
145
+ return n.concat(o || Array.prototype.slice.call(t));
146
146
  }
147
- function L(n) {
148
- return this instanceof L ? (this.v = n, this) : new L(n);
147
+ function U(n) {
148
+ return this instanceof U ? (this.v = n, this) : new U(n);
149
149
  }
150
150
  function Ye(n, t, e) {
151
151
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
152
- var r = e.apply(n, t || []), s, i = [];
153
- return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", o), s[Symbol.asyncIterator] = function() {
152
+ var r = e.apply(n, t || []), s, o = [];
153
+ return s = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", i), s[Symbol.asyncIterator] = function() {
154
154
  return this;
155
155
  }, s;
156
- function o(l) {
156
+ function i(l) {
157
157
  return function(f) {
158
- return Promise.resolve(f).then(l, g);
158
+ return Promise.resolve(f).then(l, m);
159
159
  };
160
160
  }
161
161
  function a(l, f) {
162
162
  r[l] && (s[l] = function(p) {
163
- return new Promise(function(_, I) {
164
- i.push([l, p, _, I]) > 1 || u(l, p);
163
+ return new Promise(function(L, w) {
164
+ o.push([l, p, L, w]) > 1 || c(l, p);
165
165
  });
166
166
  }, f && (s[l] = f(s[l])));
167
167
  }
168
- function u(l, f) {
168
+ function c(l, f) {
169
169
  try {
170
- c(r[l](f));
170
+ u(r[l](f));
171
171
  } catch (p) {
172
- v(i[0][3], p);
172
+ b(o[0][3], p);
173
173
  }
174
174
  }
175
- function c(l) {
176
- l.value instanceof L ? Promise.resolve(l.value.v).then(h, g) : v(i[0][2], l);
175
+ function u(l) {
176
+ l.value instanceof U ? Promise.resolve(l.value.v).then(h, m) : b(o[0][2], l);
177
177
  }
178
178
  function h(l) {
179
- u("next", l);
179
+ c("next", l);
180
180
  }
181
- function g(l) {
182
- u("throw", l);
181
+ function m(l) {
182
+ c("throw", l);
183
183
  }
184
- function v(l, f) {
185
- l(f), i.shift(), i.length && u(i[0][0], i[0][1]);
184
+ function b(l, f) {
185
+ l(f), o.shift(), o.length && c(o[0][0], o[0][1]);
186
186
  }
187
187
  }
188
- function qe(n) {
188
+ function Xe(n) {
189
189
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
190
190
  var t = n[Symbol.asyncIterator], e;
191
191
  return t ? t.call(n) : (n = typeof k == "function" ? k(n) : n[Symbol.iterator](), e = {}, r("next"), r("throw"), r("return"), e[Symbol.asyncIterator] = function() {
192
192
  return this;
193
193
  }, e);
194
- function r(i) {
195
- e[i] = n[i] && function(o) {
196
- return new Promise(function(a, u) {
197
- o = n[i](o), s(a, u, o.done, o.value);
194
+ function r(o) {
195
+ e[o] = n[o] && function(i) {
196
+ return new Promise(function(a, c) {
197
+ i = n[o](i), s(a, c, i.done, i.value);
198
198
  });
199
199
  };
200
200
  }
201
- function s(i, o, a, u) {
202
- Promise.resolve(u).then(function(c) {
203
- i({ value: c, done: a });
204
- }, o);
201
+ function s(o, i, a, c) {
202
+ Promise.resolve(c).then(function(u) {
203
+ o({ value: u, done: a });
204
+ }, i);
205
205
  }
206
206
  }
207
- function m(n) {
207
+ function g(n) {
208
208
  return typeof n == "function";
209
209
  }
210
210
  function ye(n) {
@@ -213,7 +213,7 @@ function ye(n) {
213
213
  }, e = n(t);
214
214
  return e.prototype = Object.create(Error.prototype), e.prototype.constructor = e, e;
215
215
  }
216
- var W = ye(function(n) {
216
+ var z = ye(function(n) {
217
217
  return function(e) {
218
218
  n(this), this.message = e ? e.length + ` errors occurred during unsubscription:
219
219
  ` + e.map(function(r, s) {
@@ -222,76 +222,76 @@ var W = ye(function(n) {
222
222
  `) : "", this.name = "UnsubscriptionError", this.errors = e;
223
223
  };
224
224
  });
225
- function F(n, t) {
225
+ function q(n, t) {
226
226
  if (n) {
227
227
  var e = n.indexOf(t);
228
228
  0 <= e && n.splice(e, 1);
229
229
  }
230
230
  }
231
- var U = (function() {
231
+ var R = (function() {
232
232
  function n(t) {
233
233
  this.initialTeardown = t, this.closed = !1, this._parentage = null, this._finalizers = null;
234
234
  }
235
235
  return n.prototype.unsubscribe = function() {
236
- var t, e, r, s, i;
236
+ var t, e, r, s, o;
237
237
  if (!this.closed) {
238
238
  this.closed = !0;
239
- var o = this._parentage;
240
- if (o)
241
- if (this._parentage = null, Array.isArray(o))
239
+ var i = this._parentage;
240
+ if (i)
241
+ if (this._parentage = null, Array.isArray(i))
242
242
  try {
243
- for (var a = k(o), u = a.next(); !u.done; u = a.next()) {
244
- var c = u.value;
245
- c.remove(this);
243
+ for (var a = k(i), c = a.next(); !c.done; c = a.next()) {
244
+ var u = c.value;
245
+ u.remove(this);
246
246
  }
247
247
  } catch (p) {
248
248
  t = { error: p };
249
249
  } finally {
250
250
  try {
251
- u && !u.done && (e = a.return) && e.call(a);
251
+ c && !c.done && (e = a.return) && e.call(a);
252
252
  } finally {
253
253
  if (t) throw t.error;
254
254
  }
255
255
  }
256
256
  else
257
- o.remove(this);
257
+ i.remove(this);
258
258
  var h = this.initialTeardown;
259
- if (m(h))
259
+ if (g(h))
260
260
  try {
261
261
  h();
262
262
  } catch (p) {
263
- i = p instanceof W ? p.errors : [p];
263
+ o = p instanceof z ? p.errors : [p];
264
264
  }
265
- var g = this._finalizers;
266
- if (g) {
265
+ var m = this._finalizers;
266
+ if (m) {
267
267
  this._finalizers = null;
268
268
  try {
269
- for (var v = k(g), l = v.next(); !l.done; l = v.next()) {
269
+ for (var b = k(m), l = b.next(); !l.done; l = b.next()) {
270
270
  var f = l.value;
271
271
  try {
272
- oe(f);
272
+ ie(f);
273
273
  } catch (p) {
274
- i = i ?? [], p instanceof W ? i = $($([], R(i)), R(p.errors)) : i.push(p);
274
+ o = o ?? [], p instanceof z ? o = H(H([], D(o)), D(p.errors)) : o.push(p);
275
275
  }
276
276
  }
277
277
  } catch (p) {
278
278
  r = { error: p };
279
279
  } finally {
280
280
  try {
281
- l && !l.done && (s = v.return) && s.call(v);
281
+ l && !l.done && (s = b.return) && s.call(b);
282
282
  } finally {
283
283
  if (r) throw r.error;
284
284
  }
285
285
  }
286
286
  }
287
- if (i)
288
- throw new W(i);
287
+ if (o)
288
+ throw new z(o);
289
289
  }
290
290
  }, n.prototype.add = function(t) {
291
291
  var e;
292
292
  if (t && t !== this)
293
293
  if (this.closed)
294
- oe(t);
294
+ ie(t);
295
295
  else {
296
296
  if (t instanceof n) {
297
297
  if (t.closed || t._hasParent(this))
@@ -308,52 +308,52 @@ var U = (function() {
308
308
  this._parentage = Array.isArray(e) ? (e.push(t), e) : e ? [e, t] : t;
309
309
  }, n.prototype._removeParent = function(t) {
310
310
  var e = this._parentage;
311
- e === t ? this._parentage = null : Array.isArray(e) && F(e, t);
311
+ e === t ? this._parentage = null : Array.isArray(e) && q(e, t);
312
312
  }, n.prototype.remove = function(t) {
313
313
  var e = this._finalizers;
314
- e && F(e, t), t instanceof n && t._removeParent(this);
314
+ e && q(e, t), t instanceof n && t._removeParent(this);
315
315
  }, n.EMPTY = (function() {
316
316
  var t = new n();
317
317
  return t.closed = !0, t;
318
318
  })(), n;
319
- })(), be = U.EMPTY;
320
- function Se(n) {
321
- return n instanceof U || n && "closed" in n && m(n.remove) && m(n.add) && m(n.unsubscribe);
319
+ })(), Se = R.EMPTY;
320
+ function we(n) {
321
+ return n instanceof R || n && "closed" in n && g(n.remove) && g(n.add) && g(n.unsubscribe);
322
322
  }
323
- function oe(n) {
324
- m(n) ? n() : n.unsubscribe();
323
+ function ie(n) {
324
+ g(n) ? n() : n.unsubscribe();
325
325
  }
326
326
  var Ve = {
327
327
  Promise: void 0
328
- }, Xe = {
328
+ }, We = {
329
329
  setTimeout: function(n, t) {
330
330
  for (var e = [], r = 2; r < arguments.length; r++)
331
331
  e[r - 2] = arguments[r];
332
- return setTimeout.apply(void 0, $([n, t], R(e)));
332
+ return setTimeout.apply(void 0, H([n, t], D(e)));
333
333
  },
334
334
  clearTimeout: function(n) {
335
335
  return clearTimeout(n);
336
336
  },
337
337
  delegate: void 0
338
338
  };
339
- function Ie(n) {
340
- Xe.setTimeout(function() {
339
+ function Ee(n) {
340
+ We.setTimeout(function() {
341
341
  throw n;
342
342
  });
343
343
  }
344
- function Q() {
344
+ function Z() {
345
345
  }
346
- function G(n) {
346
+ function B(n) {
347
347
  n();
348
348
  }
349
349
  var ne = (function(n) {
350
- w(t, n);
350
+ T(t, n);
351
351
  function t(e) {
352
352
  var r = n.call(this) || this;
353
- return r.isStopped = !1, e ? (r.destination = e, Se(e) && e.add(r)) : r.destination = Je, r;
353
+ return r.isStopped = !1, e ? (r.destination = e, we(e) && e.add(r)) : r.destination = Qe, r;
354
354
  }
355
355
  return t.create = function(e, r, s) {
356
- return new Z(e, r, s);
356
+ return new ee(e, r, s);
357
357
  }, t.prototype.next = function(e) {
358
358
  this.isStopped || this._next(e);
359
359
  }, t.prototype.error = function(e) {
@@ -377,7 +377,7 @@ var ne = (function(n) {
377
377
  this.unsubscribe();
378
378
  }
379
379
  }, t;
380
- })(U), We = (function() {
380
+ })(R), ze = (function() {
381
381
  function n(t) {
382
382
  this.partialObserver = t;
383
383
  }
@@ -387,7 +387,7 @@ var ne = (function(n) {
387
387
  try {
388
388
  e.next(t);
389
389
  } catch (r) {
390
- D(r);
390
+ G(r);
391
391
  }
392
392
  }, n.prototype.error = function(t) {
393
393
  var e = this.partialObserver;
@@ -395,50 +395,50 @@ var ne = (function(n) {
395
395
  try {
396
396
  e.error(t);
397
397
  } catch (r) {
398
- D(r);
398
+ G(r);
399
399
  }
400
400
  else
401
- D(t);
401
+ G(t);
402
402
  }, n.prototype.complete = function() {
403
403
  var t = this.partialObserver;
404
404
  if (t.complete)
405
405
  try {
406
406
  t.complete();
407
407
  } catch (e) {
408
- D(e);
408
+ G(e);
409
409
  }
410
410
  }, n;
411
- })(), Z = (function(n) {
412
- w(t, n);
411
+ })(), ee = (function(n) {
412
+ T(t, n);
413
413
  function t(e, r, s) {
414
- var i = n.call(this) || this, o;
415
- return m(e) || !e ? o = {
414
+ var o = n.call(this) || this, i;
415
+ return g(e) || !e ? i = {
416
416
  next: e ?? void 0,
417
417
  error: r ?? void 0,
418
418
  complete: s ?? void 0
419
- } : o = e, i.destination = new We(o), i;
419
+ } : i = e, o.destination = new ze(i), o;
420
420
  }
421
421
  return t;
422
422
  })(ne);
423
- function D(n) {
424
- Ie(n);
423
+ function G(n) {
424
+ Ee(n);
425
425
  }
426
- function ze(n) {
426
+ function Je(n) {
427
427
  throw n;
428
428
  }
429
- var Je = {
429
+ var Qe = {
430
430
  closed: !0,
431
- next: Q,
432
- error: ze,
433
- complete: Q
431
+ next: Z,
432
+ error: Je,
433
+ complete: Z
434
434
  }, re = (function() {
435
435
  return typeof Symbol == "function" && Symbol.observable || "@@observable";
436
436
  })();
437
- function q(n) {
437
+ function X(n) {
438
438
  return n;
439
439
  }
440
- function Qe(n) {
441
- return n.length === 0 ? q : n.length === 1 ? n[0] : function(e) {
440
+ function Ze(n) {
441
+ return n.length === 0 ? X : n.length === 1 ? n[0] : function(e) {
442
442
  return n.reduce(function(r, s) {
443
443
  return s(r);
444
444
  }, e);
@@ -452,11 +452,11 @@ var S = (function() {
452
452
  var e = new n();
453
453
  return e.source = this, e.operator = t, e;
454
454
  }, n.prototype.subscribe = function(t, e, r) {
455
- var s = this, i = et(t) ? t : new Z(t, e, r);
456
- return G(function() {
457
- var o = s, a = o.operator, u = o.source;
458
- i.add(a ? a.call(i, u) : u ? s._subscribe(i) : s._trySubscribe(i));
459
- }), i;
455
+ var s = this, o = tt(t) ? t : new ee(t, e, r);
456
+ return B(function() {
457
+ var i = s, a = i.operator, c = i.source;
458
+ o.add(a ? a.call(o, c) : c ? s._subscribe(o) : s._trySubscribe(o));
459
+ }), o;
460
460
  }, n.prototype._trySubscribe = function(t) {
461
461
  try {
462
462
  return this._subscribe(t);
@@ -465,19 +465,19 @@ var S = (function() {
465
465
  }
466
466
  }, n.prototype.forEach = function(t, e) {
467
467
  var r = this;
468
- return e = ae(e), new e(function(s, i) {
469
- var o = new Z({
468
+ return e = ae(e), new e(function(s, o) {
469
+ var i = new ee({
470
470
  next: function(a) {
471
471
  try {
472
472
  t(a);
473
- } catch (u) {
474
- i(u), o.unsubscribe();
473
+ } catch (c) {
474
+ o(c), i.unsubscribe();
475
475
  }
476
476
  },
477
- error: i,
477
+ error: o,
478
478
  complete: s
479
479
  });
480
- r.subscribe(o);
480
+ r.subscribe(i);
481
481
  });
482
482
  }, n.prototype._subscribe = function(t) {
483
483
  var e;
@@ -487,17 +487,17 @@ var S = (function() {
487
487
  }, n.prototype.pipe = function() {
488
488
  for (var t = [], e = 0; e < arguments.length; e++)
489
489
  t[e] = arguments[e];
490
- return Qe(t)(this);
490
+ return Ze(t)(this);
491
491
  }, n.prototype.toPromise = function(t) {
492
492
  var e = this;
493
493
  return t = ae(t), new t(function(r, s) {
494
- var i;
495
- e.subscribe(function(o) {
496
- return i = o;
497
- }, function(o) {
498
- return s(o);
494
+ var o;
495
+ e.subscribe(function(i) {
496
+ return o = i;
497
+ }, function(i) {
498
+ return s(i);
499
499
  }, function() {
500
- return r(i);
500
+ return r(o);
501
501
  });
502
502
  });
503
503
  }, n.create = function(t) {
@@ -508,18 +508,18 @@ function ae(n) {
508
508
  var t;
509
509
  return (t = n ?? Ve.Promise) !== null && t !== void 0 ? t : Promise;
510
510
  }
511
- function Ze(n) {
512
- return n && m(n.next) && m(n.error) && m(n.complete);
513
- }
514
511
  function et(n) {
515
- return n && n instanceof ne || Ze(n) && Se(n);
512
+ return n && g(n.next) && g(n.error) && g(n.complete);
516
513
  }
517
514
  function tt(n) {
518
- return m(n?.lift);
515
+ return n && n instanceof ne || et(n) && we(n);
516
+ }
517
+ function nt(n) {
518
+ return g(n?.lift);
519
519
  }
520
520
  function A(n) {
521
521
  return function(t) {
522
- if (tt(t))
522
+ if (nt(t))
523
523
  return t.lift(function(e) {
524
524
  try {
525
525
  return n(e, this);
@@ -531,35 +531,35 @@ function A(n) {
531
531
  };
532
532
  }
533
533
  function O(n, t, e, r, s) {
534
- return new nt(n, t, e, r, s);
534
+ return new rt(n, t, e, r, s);
535
535
  }
536
- var nt = (function(n) {
537
- w(t, n);
538
- function t(e, r, s, i, o, a) {
539
- var u = n.call(this, e) || this;
540
- return u.onFinalize = o, u.shouldUnsubscribe = a, u._next = r ? function(c) {
536
+ var rt = (function(n) {
537
+ T(t, n);
538
+ function t(e, r, s, o, i, a) {
539
+ var c = n.call(this, e) || this;
540
+ return c.onFinalize = i, c.shouldUnsubscribe = a, c._next = r ? function(u) {
541
541
  try {
542
- r(c);
542
+ r(u);
543
543
  } catch (h) {
544
544
  e.error(h);
545
545
  }
546
- } : n.prototype._next, u._error = i ? function(c) {
546
+ } : n.prototype._next, c._error = o ? function(u) {
547
547
  try {
548
- i(c);
548
+ o(u);
549
549
  } catch (h) {
550
550
  e.error(h);
551
551
  } finally {
552
552
  this.unsubscribe();
553
553
  }
554
- } : n.prototype._error, u._complete = s ? function() {
554
+ } : n.prototype._error, c._complete = s ? function() {
555
555
  try {
556
556
  s();
557
- } catch (c) {
558
- e.error(c);
557
+ } catch (u) {
558
+ e.error(u);
559
559
  } finally {
560
560
  this.unsubscribe();
561
561
  }
562
- } : n.prototype._complete, u;
562
+ } : n.prototype._complete, c;
563
563
  }
564
564
  return t.prototype.unsubscribe = function() {
565
565
  var e;
@@ -568,12 +568,12 @@ var nt = (function(n) {
568
568
  n.prototype.unsubscribe.call(this), !r && ((e = this.onFinalize) === null || e === void 0 || e.call(this));
569
569
  }
570
570
  }, t;
571
- })(ne), rt = ye(function(n) {
571
+ })(ne), st = ye(function(n) {
572
572
  return function() {
573
573
  n(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
574
574
  };
575
575
  }), se = (function(n) {
576
- w(t, n);
576
+ T(t, n);
577
577
  function t() {
578
578
  var e = n.call(this) || this;
579
579
  return e.closed = !1, e.currentObservers = null, e.observers = [], e.isStopped = !1, e.hasError = !1, e.thrownError = null, e;
@@ -583,23 +583,23 @@ var nt = (function(n) {
583
583
  return r.operator = e, r;
584
584
  }, t.prototype._throwIfClosed = function() {
585
585
  if (this.closed)
586
- throw new rt();
586
+ throw new st();
587
587
  }, t.prototype.next = function(e) {
588
588
  var r = this;
589
- G(function() {
590
- var s, i;
589
+ B(function() {
590
+ var s, o;
591
591
  if (r._throwIfClosed(), !r.isStopped) {
592
592
  r.currentObservers || (r.currentObservers = Array.from(r.observers));
593
593
  try {
594
- for (var o = k(r.currentObservers), a = o.next(); !a.done; a = o.next()) {
595
- var u = a.value;
596
- u.next(e);
594
+ for (var i = k(r.currentObservers), a = i.next(); !a.done; a = i.next()) {
595
+ var c = a.value;
596
+ c.next(e);
597
597
  }
598
- } catch (c) {
599
- s = { error: c };
598
+ } catch (u) {
599
+ s = { error: u };
600
600
  } finally {
601
601
  try {
602
- a && !a.done && (i = o.return) && i.call(o);
602
+ a && !a.done && (o = i.return) && o.call(i);
603
603
  } finally {
604
604
  if (s) throw s.error;
605
605
  }
@@ -608,7 +608,7 @@ var nt = (function(n) {
608
608
  });
609
609
  }, t.prototype.error = function(e) {
610
610
  var r = this;
611
- G(function() {
611
+ B(function() {
612
612
  if (r._throwIfClosed(), !r.isStopped) {
613
613
  r.hasError = r.isStopped = !0, r.thrownError = e;
614
614
  for (var s = r.observers; s.length; )
@@ -617,7 +617,7 @@ var nt = (function(n) {
617
617
  });
618
618
  }, t.prototype.complete = function() {
619
619
  var e = this;
620
- G(function() {
620
+ B(function() {
621
621
  if (e._throwIfClosed(), !e.isStopped) {
622
622
  e.isStopped = !0;
623
623
  for (var r = e.observers; r.length; )
@@ -638,13 +638,13 @@ var nt = (function(n) {
638
638
  }, t.prototype._subscribe = function(e) {
639
639
  return this._throwIfClosed(), this._checkFinalizedStatuses(e), this._innerSubscribe(e);
640
640
  }, t.prototype._innerSubscribe = function(e) {
641
- var r = this, s = this, i = s.hasError, o = s.isStopped, a = s.observers;
642
- return i || o ? be : (this.currentObservers = null, a.push(e), new U(function() {
643
- r.currentObservers = null, F(a, e);
641
+ var r = this, s = this, o = s.hasError, i = s.isStopped, a = s.observers;
642
+ return o || i ? Se : (this.currentObservers = null, a.push(e), new R(function() {
643
+ r.currentObservers = null, q(a, e);
644
644
  }));
645
645
  }, t.prototype._checkFinalizedStatuses = function(e) {
646
- var r = this, s = r.hasError, i = r.thrownError, o = r.isStopped;
647
- s ? e.error(i) : o && e.complete();
646
+ var r = this, s = r.hasError, o = r.thrownError, i = r.isStopped;
647
+ s ? e.error(o) : i && e.complete();
648
648
  }, t.prototype.asObservable = function() {
649
649
  var e = new S();
650
650
  return e.source = this, e;
@@ -652,7 +652,7 @@ var nt = (function(n) {
652
652
  return new ce(e, r);
653
653
  }, t;
654
654
  })(S), ce = (function(n) {
655
- w(t, n);
655
+ T(t, n);
656
656
  function t(e, r) {
657
657
  var s = n.call(this) || this;
658
658
  return s.destination = e, s.source = r, s;
@@ -668,10 +668,10 @@ var nt = (function(n) {
668
668
  (r = (e = this.destination) === null || e === void 0 ? void 0 : e.complete) === null || r === void 0 || r.call(e);
669
669
  }, t.prototype._subscribe = function(e) {
670
670
  var r, s;
671
- return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : be;
671
+ return (s = (r = this.source) === null || r === void 0 ? void 0 : r.subscribe(e)) !== null && s !== void 0 ? s : Se;
672
672
  }, t;
673
673
  })(se), P = (function(n) {
674
- w(t, n);
674
+ T(t, n);
675
675
  function t(e) {
676
676
  var r = n.call(this) || this;
677
677
  return r._value = e, r;
@@ -686,37 +686,37 @@ var nt = (function(n) {
686
686
  var r = n.prototype._subscribe.call(this, e);
687
687
  return !r.closed && e.next(this._value), r;
688
688
  }, t.prototype.getValue = function() {
689
- var e = this, r = e.hasError, s = e.thrownError, i = e._value;
689
+ var e = this, r = e.hasError, s = e.thrownError, o = e._value;
690
690
  if (r)
691
691
  throw s;
692
- return this._throwIfClosed(), i;
692
+ return this._throwIfClosed(), o;
693
693
  }, t.prototype.next = function(e) {
694
694
  n.prototype.next.call(this, this._value = e);
695
695
  }, t;
696
- })(se), st = {
696
+ })(se), ot = {
697
697
  now: function() {
698
698
  return Date.now();
699
699
  }
700
700
  }, it = (function(n) {
701
- w(t, n);
701
+ T(t, n);
702
702
  function t(e, r) {
703
703
  return n.call(this) || this;
704
704
  }
705
705
  return t.prototype.schedule = function(e, r) {
706
706
  return this;
707
707
  }, t;
708
- })(U), ue = {
708
+ })(R), ue = {
709
709
  setInterval: function(n, t) {
710
710
  for (var e = [], r = 2; r < arguments.length; r++)
711
711
  e[r - 2] = arguments[r];
712
- return setInterval.apply(void 0, $([n, t], R(e)));
712
+ return setInterval.apply(void 0, H([n, t], D(e)));
713
713
  },
714
714
  clearInterval: function(n) {
715
715
  return clearInterval(n);
716
716
  },
717
717
  delegate: void 0
718
- }, ot = (function(n) {
719
- w(t, n);
718
+ }, at = (function(n) {
719
+ T(t, n);
720
720
  function t(e, r) {
721
721
  var s = n.call(this, e, r) || this;
722
722
  return s.scheduler = e, s.work = r, s.pending = !1, s;
@@ -726,8 +726,8 @@ var nt = (function(n) {
726
726
  if (r === void 0 && (r = 0), this.closed)
727
727
  return this;
728
728
  this.state = e;
729
- var i = this.id, o = this.scheduler;
730
- return i != null && (this.id = this.recycleAsyncId(o, i, r)), this.pending = !0, this.delay = r, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(o, this.id, r), this;
729
+ var o = this.id, i = this.scheduler;
730
+ return o != null && (this.id = this.recycleAsyncId(i, o, r)), this.pending = !0, this.delay = r, this.id = (s = this.id) !== null && s !== void 0 ? s : this.requestAsyncId(i, this.id, r), this;
731
731
  }, t.prototype.requestAsyncId = function(e, r, s) {
732
732
  return s === void 0 && (s = 0), ue.setInterval(e.flush.bind(e, this), s);
733
733
  }, t.prototype.recycleAsyncId = function(e, r, s) {
@@ -743,18 +743,18 @@ var nt = (function(n) {
743
743
  return s;
744
744
  this.pending === !1 && this.id != null && (this.id = this.recycleAsyncId(this.scheduler, this.id, null));
745
745
  }, t.prototype._execute = function(e, r) {
746
- var s = !1, i;
746
+ var s = !1, o;
747
747
  try {
748
748
  this.work(e);
749
- } catch (o) {
750
- s = !0, i = o || new Error("Scheduled action threw falsy error");
749
+ } catch (i) {
750
+ s = !0, o = i || new Error("Scheduled action threw falsy error");
751
751
  }
752
752
  if (s)
753
- return this.unsubscribe(), i;
753
+ return this.unsubscribe(), o;
754
754
  }, t.prototype.unsubscribe = function() {
755
755
  if (!this.closed) {
756
- var e = this, r = e.id, s = e.scheduler, i = s.actions;
757
- this.work = this.state = this.scheduler = null, this.pending = !1, F(i, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
756
+ var e = this, r = e.id, s = e.scheduler, o = s.actions;
757
+ this.work = this.state = this.scheduler = null, this.pending = !1, q(o, this), r != null && (this.id = this.recycleAsyncId(s, r, null)), this.delay = null, n.prototype.unsubscribe.call(this);
758
758
  }
759
759
  }, t;
760
760
  })(it), le = (function() {
@@ -763,9 +763,9 @@ var nt = (function(n) {
763
763
  }
764
764
  return n.prototype.schedule = function(t, e, r) {
765
765
  return e === void 0 && (e = 0), new this.schedulerActionCtor(this, t).schedule(r, e);
766
- }, n.now = st.now, n;
767
- })(), at = (function(n) {
768
- w(t, n);
766
+ }, n.now = ot.now, n;
767
+ })(), ct = (function(n) {
768
+ T(t, n);
769
769
  function t(e, r) {
770
770
  r === void 0 && (r = le.now);
771
771
  var s = n.call(this, e, r) || this;
@@ -789,64 +789,64 @@ var nt = (function(n) {
789
789
  throw s;
790
790
  }
791
791
  }, t;
792
- })(le), Ee = new at(ot), ct = Ee, ut = new S(function(n) {
792
+ })(le), Ie = new ct(at), ut = Ie, lt = new S(function(n) {
793
793
  return n.complete();
794
794
  });
795
- function we(n) {
796
- return n && m(n.schedule);
797
- }
798
795
  function Te(n) {
796
+ return n && g(n.schedule);
797
+ }
798
+ function xe(n) {
799
799
  return n[n.length - 1];
800
800
  }
801
- function lt(n) {
802
- return m(Te(n)) ? n.pop() : void 0;
801
+ function dt(n) {
802
+ return g(xe(n)) ? n.pop() : void 0;
803
803
  }
804
804
  function Ce(n) {
805
- return we(Te(n)) ? n.pop() : void 0;
805
+ return Te(xe(n)) ? n.pop() : void 0;
806
806
  }
807
807
  var Oe = (function(n) {
808
808
  return n && typeof n.length == "number" && typeof n != "function";
809
809
  });
810
810
  function Ae(n) {
811
- return m(n?.then);
811
+ return g(n?.then);
812
812
  }
813
- function _e(n) {
814
- return m(n[re]);
813
+ function Le(n) {
814
+ return g(n[re]);
815
815
  }
816
- function xe(n) {
817
- return Symbol.asyncIterator && m(n?.[Symbol.asyncIterator]);
816
+ function _e(n) {
817
+ return Symbol.asyncIterator && g(n?.[Symbol.asyncIterator]);
818
818
  }
819
- function Me(n) {
819
+ function Pe(n) {
820
820
  return new TypeError("You provided " + (n !== null && typeof n == "object" ? "an invalid object" : "'" + n + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
821
821
  }
822
- function dt() {
822
+ function ht() {
823
823
  return typeof Symbol != "function" || !Symbol.iterator ? "@@iterator" : Symbol.iterator;
824
824
  }
825
- var Pe = dt();
826
- function Le(n) {
827
- return m(n?.[Pe]);
825
+ var Me = ht();
826
+ function Ue(n) {
827
+ return g(n?.[Me]);
828
828
  }
829
829
  function ke(n) {
830
830
  return Ye(this, arguments, function() {
831
- var e, r, s, i;
832
- return ve(this, function(o) {
833
- switch (o.label) {
831
+ var e, r, s, o;
832
+ return ve(this, function(i) {
833
+ switch (i.label) {
834
834
  case 0:
835
- e = n.getReader(), o.label = 1;
835
+ e = n.getReader(), i.label = 1;
836
836
  case 1:
837
- o.trys.push([1, , 9, 10]), o.label = 2;
837
+ i.trys.push([1, , 9, 10]), i.label = 2;
838
838
  case 2:
839
- return [4, L(e.read())];
839
+ return [4, U(e.read())];
840
840
  case 3:
841
- return r = o.sent(), s = r.value, i = r.done, i ? [4, L(void 0)] : [3, 5];
841
+ return r = i.sent(), s = r.value, o = r.done, o ? [4, U(void 0)] : [3, 5];
842
842
  case 4:
843
- return [2, o.sent()];
843
+ return [2, i.sent()];
844
844
  case 5:
845
- return [4, L(s)];
845
+ return [4, U(s)];
846
846
  case 6:
847
- return [4, o.sent()];
847
+ return [4, i.sent()];
848
848
  case 7:
849
- return o.sent(), [3, 2];
849
+ return i.sent(), [3, 2];
850
850
  case 8:
851
851
  return [3, 10];
852
852
  case 9:
@@ -858,65 +858,65 @@ function ke(n) {
858
858
  });
859
859
  }
860
860
  function Ne(n) {
861
- return m(n?.getReader);
861
+ return g(n?.getReader);
862
862
  }
863
863
  function M(n) {
864
864
  if (n instanceof S)
865
865
  return n;
866
866
  if (n != null) {
867
- if (_e(n))
868
- return ht(n);
869
- if (Oe(n))
867
+ if (Le(n))
870
868
  return ft(n);
871
- if (Ae(n))
869
+ if (Oe(n))
872
870
  return pt(n);
873
- if (xe(n))
874
- return Ue(n);
875
- if (Le(n))
871
+ if (Ae(n))
872
+ return mt(n);
873
+ if (_e(n))
874
+ return Re(n);
875
+ if (Ue(n))
876
876
  return gt(n);
877
877
  if (Ne(n))
878
- return mt(n);
878
+ return bt(n);
879
879
  }
880
- throw Me(n);
880
+ throw Pe(n);
881
881
  }
882
- function ht(n) {
882
+ function ft(n) {
883
883
  return new S(function(t) {
884
884
  var e = n[re]();
885
- if (m(e.subscribe))
885
+ if (g(e.subscribe))
886
886
  return e.subscribe(t);
887
887
  throw new TypeError("Provided object does not correctly implement Symbol.observable");
888
888
  });
889
889
  }
890
- function ft(n) {
890
+ function pt(n) {
891
891
  return new S(function(t) {
892
892
  for (var e = 0; e < n.length && !t.closed; e++)
893
893
  t.next(n[e]);
894
894
  t.complete();
895
895
  });
896
896
  }
897
- function pt(n) {
897
+ function mt(n) {
898
898
  return new S(function(t) {
899
899
  n.then(function(e) {
900
900
  t.closed || (t.next(e), t.complete());
901
901
  }, function(e) {
902
902
  return t.error(e);
903
- }).then(null, Ie);
903
+ }).then(null, Ee);
904
904
  });
905
905
  }
906
906
  function gt(n) {
907
907
  return new S(function(t) {
908
908
  var e, r;
909
909
  try {
910
- for (var s = k(n), i = s.next(); !i.done; i = s.next()) {
911
- var o = i.value;
912
- if (t.next(o), t.closed)
910
+ for (var s = k(n), o = s.next(); !o.done; o = s.next()) {
911
+ var i = o.value;
912
+ if (t.next(i), t.closed)
913
913
  return;
914
914
  }
915
915
  } catch (a) {
916
916
  e = { error: a };
917
917
  } finally {
918
918
  try {
919
- i && !i.done && (r = s.return) && r.call(s);
919
+ o && !o.done && (r = s.return) && r.call(s);
920
920
  } finally {
921
921
  if (e) throw e.error;
922
922
  }
@@ -924,41 +924,41 @@ function gt(n) {
924
924
  t.complete();
925
925
  });
926
926
  }
927
- function Ue(n) {
927
+ function Re(n) {
928
928
  return new S(function(t) {
929
929
  vt(n, t).catch(function(e) {
930
930
  return t.error(e);
931
931
  });
932
932
  });
933
933
  }
934
- function mt(n) {
935
- return Ue(ke(n));
934
+ function bt(n) {
935
+ return Re(ke(n));
936
936
  }
937
937
  function vt(n, t) {
938
- var e, r, s, i;
939
- return Be(this, void 0, void 0, function() {
940
- var o, a;
941
- return ve(this, function(u) {
942
- switch (u.label) {
938
+ var e, r, s, o;
939
+ return qe(this, void 0, void 0, function() {
940
+ var i, a;
941
+ return ve(this, function(c) {
942
+ switch (c.label) {
943
943
  case 0:
944
- u.trys.push([0, 5, 6, 11]), e = qe(n), u.label = 1;
944
+ c.trys.push([0, 5, 6, 11]), e = Xe(n), c.label = 1;
945
945
  case 1:
946
946
  return [4, e.next()];
947
947
  case 2:
948
- if (r = u.sent(), !!r.done) return [3, 4];
949
- if (o = r.value, t.next(o), t.closed)
948
+ if (r = c.sent(), !!r.done) return [3, 4];
949
+ if (i = r.value, t.next(i), t.closed)
950
950
  return [2];
951
- u.label = 3;
951
+ c.label = 3;
952
952
  case 3:
953
953
  return [3, 1];
954
954
  case 4:
955
955
  return [3, 11];
956
956
  case 5:
957
- return a = u.sent(), s = { error: a }, [3, 11];
957
+ return a = c.sent(), s = { error: a }, [3, 11];
958
958
  case 6:
959
- return u.trys.push([6, , 9, 10]), r && !r.done && (i = e.return) ? [4, i.call(e)] : [3, 8];
959
+ return c.trys.push([6, , 9, 10]), r && !r.done && (o = e.return) ? [4, o.call(e)] : [3, 8];
960
960
  case 7:
961
- u.sent(), u.label = 8;
961
+ c.sent(), c.label = 8;
962
962
  case 8:
963
963
  return [3, 10];
964
964
  case 9:
@@ -974,13 +974,13 @@ function vt(n, t) {
974
974
  }
975
975
  function C(n, t, e, r, s) {
976
976
  r === void 0 && (r = 0), s === void 0 && (s = !1);
977
- var i = t.schedule(function() {
977
+ var o = t.schedule(function() {
978
978
  e(), s ? n.add(this.schedule(null, r)) : this.unsubscribe();
979
979
  }, r);
980
- if (n.add(i), !s)
981
- return i;
980
+ if (n.add(o), !s)
981
+ return o;
982
982
  }
983
- function Re(n, t) {
983
+ function $e(n, t) {
984
984
  return t === void 0 && (t = 0), A(function(e, r) {
985
985
  e.subscribe(O(r, function(s) {
986
986
  return C(r, n, function() {
@@ -997,7 +997,7 @@ function Re(n, t) {
997
997
  }));
998
998
  });
999
999
  }
1000
- function $e(n, t) {
1000
+ function je(n, t) {
1001
1001
  return t === void 0 && (t = 0), A(function(e, r) {
1002
1002
  r.add(n.schedule(function() {
1003
1003
  return e.subscribe(r);
@@ -1005,12 +1005,12 @@ function $e(n, t) {
1005
1005
  });
1006
1006
  }
1007
1007
  function yt(n, t) {
1008
- return M(n).pipe($e(t), Re(t));
1009
- }
1010
- function bt(n, t) {
1011
- return M(n).pipe($e(t), Re(t));
1008
+ return M(n).pipe(je(t), $e(t));
1012
1009
  }
1013
1010
  function St(n, t) {
1011
+ return M(n).pipe(je(t), $e(t));
1012
+ }
1013
+ function wt(n, t) {
1014
1014
  return new S(function(e) {
1015
1015
  var r = 0;
1016
1016
  return t.schedule(function() {
@@ -1018,26 +1018,26 @@ function St(n, t) {
1018
1018
  });
1019
1019
  });
1020
1020
  }
1021
- function It(n, t) {
1021
+ function Et(n, t) {
1022
1022
  return new S(function(e) {
1023
1023
  var r;
1024
1024
  return C(e, t, function() {
1025
- r = n[Pe](), C(e, t, function() {
1026
- var s, i, o;
1025
+ r = n[Me](), C(e, t, function() {
1026
+ var s, o, i;
1027
1027
  try {
1028
- s = r.next(), i = s.value, o = s.done;
1028
+ s = r.next(), o = s.value, i = s.done;
1029
1029
  } catch (a) {
1030
1030
  e.error(a);
1031
1031
  return;
1032
1032
  }
1033
- o ? e.complete() : e.next(i);
1033
+ i ? e.complete() : e.next(o);
1034
1034
  }, 0, !0);
1035
1035
  }), function() {
1036
- return m(r?.return) && r.return();
1036
+ return g(r?.return) && r.return();
1037
1037
  };
1038
1038
  });
1039
1039
  }
1040
- function je(n, t) {
1040
+ function De(n, t) {
1041
1041
  if (!n)
1042
1042
  throw new Error("Iterable cannot be null");
1043
1043
  return new S(function(e) {
@@ -1051,34 +1051,34 @@ function je(n, t) {
1051
1051
  });
1052
1052
  });
1053
1053
  }
1054
- function Et(n, t) {
1055
- return je(ke(n), t);
1054
+ function It(n, t) {
1055
+ return De(ke(n), t);
1056
1056
  }
1057
- function wt(n, t) {
1057
+ function Tt(n, t) {
1058
1058
  if (n != null) {
1059
- if (_e(n))
1059
+ if (Le(n))
1060
1060
  return yt(n, t);
1061
1061
  if (Oe(n))
1062
- return St(n, t);
1062
+ return wt(n, t);
1063
1063
  if (Ae(n))
1064
- return bt(n, t);
1065
- if (xe(n))
1066
- return je(n, t);
1067
- if (Le(n))
1068
- return It(n, t);
1069
- if (Ne(n))
1064
+ return St(n, t);
1065
+ if (_e(n))
1066
+ return De(n, t);
1067
+ if (Ue(n))
1070
1068
  return Et(n, t);
1069
+ if (Ne(n))
1070
+ return It(n, t);
1071
1071
  }
1072
- throw Me(n);
1072
+ throw Pe(n);
1073
1073
  }
1074
- function ie(n, t) {
1075
- return t ? wt(n, t) : M(n);
1074
+ function oe(n, t) {
1075
+ return t ? Tt(n, t) : M(n);
1076
1076
  }
1077
- function Tt() {
1077
+ function xt() {
1078
1078
  for (var n = [], t = 0; t < arguments.length; t++)
1079
1079
  n[t] = arguments[t];
1080
1080
  var e = Ce(n);
1081
- return ie(n, e);
1081
+ return oe(n, e);
1082
1082
  }
1083
1083
  function Ct(n) {
1084
1084
  return n instanceof Date && !isNaN(n);
@@ -1086,28 +1086,28 @@ function Ct(n) {
1086
1086
  function N(n, t) {
1087
1087
  return A(function(e, r) {
1088
1088
  var s = 0;
1089
- e.subscribe(O(r, function(i) {
1090
- r.next(n.call(t, i, s++));
1089
+ e.subscribe(O(r, function(o) {
1090
+ r.next(n.call(t, o, s++));
1091
1091
  }));
1092
1092
  });
1093
1093
  }
1094
1094
  var Ot = Array.isArray;
1095
1095
  function At(n, t) {
1096
- return Ot(t) ? n.apply(void 0, $([], R(t))) : n(t);
1096
+ return Ot(t) ? n.apply(void 0, H([], D(t))) : n(t);
1097
1097
  }
1098
- function _t(n) {
1098
+ function Lt(n) {
1099
1099
  return N(function(t) {
1100
1100
  return At(n, t);
1101
1101
  });
1102
1102
  }
1103
- var xt = Array.isArray, Mt = Object.getPrototypeOf, Pt = Object.prototype, Lt = Object.keys;
1103
+ var _t = Array.isArray, Pt = Object.getPrototypeOf, Mt = Object.prototype, Ut = Object.keys;
1104
1104
  function kt(n) {
1105
1105
  if (n.length === 1) {
1106
1106
  var t = n[0];
1107
- if (xt(t))
1107
+ if (_t(t))
1108
1108
  return { args: t, keys: null };
1109
1109
  if (Nt(t)) {
1110
- var e = Lt(t);
1110
+ var e = Ut(t);
1111
1111
  return {
1112
1112
  args: e.map(function(r) {
1113
1113
  return t[r];
@@ -1119,103 +1119,103 @@ function kt(n) {
1119
1119
  return { args: n, keys: null };
1120
1120
  }
1121
1121
  function Nt(n) {
1122
- return n && typeof n == "object" && Mt(n) === Pt;
1122
+ return n && typeof n == "object" && Pt(n) === Mt;
1123
1123
  }
1124
- function Ut(n, t) {
1124
+ function Rt(n, t) {
1125
1125
  return n.reduce(function(e, r, s) {
1126
1126
  return e[r] = t[s], e;
1127
1127
  }, {});
1128
1128
  }
1129
- function Rt() {
1129
+ function $t() {
1130
1130
  for (var n = [], t = 0; t < arguments.length; t++)
1131
1131
  n[t] = arguments[t];
1132
- var e = Ce(n), r = lt(n), s = kt(n), i = s.args, o = s.keys;
1133
- if (i.length === 0)
1134
- return ie([], e);
1135
- var a = new S($t(i, e, o ? function(u) {
1136
- return Ut(o, u);
1137
- } : q));
1138
- return r ? a.pipe(_t(r)) : a;
1139
- }
1140
- function $t(n, t, e) {
1141
- return e === void 0 && (e = q), function(r) {
1132
+ var e = Ce(n), r = dt(n), s = kt(n), o = s.args, i = s.keys;
1133
+ if (o.length === 0)
1134
+ return oe([], e);
1135
+ var a = new S(jt(o, e, i ? function(c) {
1136
+ return Rt(i, c);
1137
+ } : X));
1138
+ return r ? a.pipe(Lt(r)) : a;
1139
+ }
1140
+ function jt(n, t, e) {
1141
+ return e === void 0 && (e = X), function(r) {
1142
1142
  de(t, function() {
1143
- for (var s = n.length, i = new Array(s), o = s, a = s, u = function(h) {
1143
+ for (var s = n.length, o = new Array(s), i = s, a = s, c = function(h) {
1144
1144
  de(t, function() {
1145
- var g = ie(n[h], t), v = !1;
1146
- g.subscribe(O(r, function(l) {
1147
- i[h] = l, v || (v = !0, a--), a || r.next(e(i.slice()));
1145
+ var m = oe(n[h], t), b = !1;
1146
+ m.subscribe(O(r, function(l) {
1147
+ o[h] = l, b || (b = !0, a--), a || r.next(e(o.slice()));
1148
1148
  }, function() {
1149
- --o || r.complete();
1149
+ --i || r.complete();
1150
1150
  }));
1151
1151
  }, r);
1152
- }, c = 0; c < s; c++)
1153
- u(c);
1152
+ }, u = 0; u < s; u++)
1153
+ c(u);
1154
1154
  }, r);
1155
1155
  };
1156
1156
  }
1157
1157
  function de(n, t, e) {
1158
1158
  n ? C(e, n, t) : t();
1159
1159
  }
1160
- function jt(n, t, e, r, s, i, o, a) {
1161
- var u = [], c = 0, h = 0, g = !1, v = function() {
1162
- g && !u.length && !c && t.complete();
1160
+ function Dt(n, t, e, r, s, o, i, a) {
1161
+ var c = [], u = 0, h = 0, m = !1, b = function() {
1162
+ m && !c.length && !u && t.complete();
1163
1163
  }, l = function(p) {
1164
- return c < r ? f(p) : u.push(p);
1164
+ return u < r ? f(p) : c.push(p);
1165
1165
  }, f = function(p) {
1166
- c++;
1167
- var _ = !1;
1168
- M(e(p, h++)).subscribe(O(t, function(I) {
1169
- t.next(I);
1166
+ u++;
1167
+ var L = !1;
1168
+ M(e(p, h++)).subscribe(O(t, function(w) {
1169
+ t.next(w);
1170
1170
  }, function() {
1171
- _ = !0;
1171
+ L = !0;
1172
1172
  }, void 0, function() {
1173
- if (_)
1173
+ if (L)
1174
1174
  try {
1175
- c--;
1176
- for (var I = function() {
1177
- var x = u.shift();
1178
- o || f(x);
1179
- }; u.length && c < r; )
1180
- I();
1181
- v();
1182
- } catch (x) {
1183
- t.error(x);
1175
+ u--;
1176
+ for (var w = function() {
1177
+ var _ = c.shift();
1178
+ i || f(_);
1179
+ }; c.length && u < r; )
1180
+ w();
1181
+ b();
1182
+ } catch (_) {
1183
+ t.error(_);
1184
1184
  }
1185
1185
  }));
1186
1186
  };
1187
1187
  return n.subscribe(O(t, l, function() {
1188
- g = !0, v();
1188
+ m = !0, b();
1189
1189
  })), function() {
1190
1190
  };
1191
1191
  }
1192
- function B(n, t, e) {
1193
- return e === void 0 && (e = 1 / 0), m(t) ? B(function(r, s) {
1194
- return N(function(i, o) {
1195
- return t(r, i, s, o);
1192
+ function Y(n, t, e) {
1193
+ return e === void 0 && (e = 1 / 0), g(t) ? Y(function(r, s) {
1194
+ return N(function(o, i) {
1195
+ return t(r, o, s, i);
1196
1196
  })(M(n(r, s)));
1197
1197
  }, e) : (typeof t == "number" && (e = t), A(function(r, s) {
1198
- return jt(r, s, n, e);
1198
+ return Dt(r, s, n, e);
1199
1199
  }));
1200
1200
  }
1201
- function Dt(n, t, e) {
1202
- n === void 0 && (n = 0), e === void 0 && (e = ct);
1201
+ function Ht(n, t, e) {
1202
+ n === void 0 && (n = 0), e === void 0 && (e = ut);
1203
1203
  var r = -1;
1204
- return t != null && (we(t) ? e = t : r = t), new S(function(s) {
1205
- var i = Ct(n) ? +n - e.now() : n;
1206
- i < 0 && (i = 0);
1207
- var o = 0;
1204
+ return t != null && (Te(t) ? e = t : r = t), new S(function(s) {
1205
+ var o = Ct(n) ? +n - e.now() : n;
1206
+ o < 0 && (o = 0);
1207
+ var i = 0;
1208
1208
  return e.schedule(function() {
1209
- s.closed || (s.next(o++), 0 <= r ? this.schedule(void 0, r) : s.complete());
1210
- }, i);
1209
+ s.closed || (s.next(i++), 0 <= r ? this.schedule(void 0, r) : s.complete());
1210
+ }, o);
1211
1211
  });
1212
1212
  }
1213
- function Ht(n, t) {
1214
- return m(t) ? B(n, t, 1) : B(n, 1);
1213
+ function Ft(n, t) {
1214
+ return g(t) ? Y(n, t, 1) : Y(n, 1);
1215
1215
  }
1216
1216
  function Gt(n) {
1217
1217
  return n <= 0 ? function() {
1218
- return ut;
1218
+ return lt;
1219
1219
  } : A(function(t, e) {
1220
1220
  var r = 0;
1221
1221
  t.subscribe(O(e, function(s) {
@@ -1223,36 +1223,36 @@ function Gt(n) {
1223
1223
  }));
1224
1224
  });
1225
1225
  }
1226
- function Kt(n) {
1226
+ function Bt(n) {
1227
1227
  return N(function() {
1228
1228
  return n;
1229
1229
  });
1230
1230
  }
1231
- function Ft(n, t) {
1232
- return B(function(e, r) {
1233
- return M(n(e, r)).pipe(Gt(1), Kt(e));
1231
+ function Kt(n, t) {
1232
+ return Y(function(e, r) {
1233
+ return M(n(e, r)).pipe(Gt(1), Bt(e));
1234
1234
  });
1235
1235
  }
1236
- function Bt(n, t) {
1237
- t === void 0 && (t = Ee);
1238
- var e = Dt(n, t);
1239
- return Ft(function() {
1236
+ function qt(n, t) {
1237
+ t === void 0 && (t = Ie);
1238
+ var e = Ht(n, t);
1239
+ return Kt(function() {
1240
1240
  return e;
1241
1241
  });
1242
1242
  }
1243
- function Y(n, t) {
1244
- return t === void 0 && (t = q), n = n ?? Yt, A(function(e, r) {
1245
- var s, i = !0;
1246
- e.subscribe(O(r, function(o) {
1247
- var a = t(o);
1248
- (i || !n(s, a)) && (i = !1, s = a, r.next(o));
1243
+ function j(n, t) {
1244
+ return t === void 0 && (t = X), n = n ?? Yt, A(function(e, r) {
1245
+ var s, o = !0;
1246
+ e.subscribe(O(r, function(i) {
1247
+ var a = t(i);
1248
+ (o || !n(s, a)) && (o = !1, s = a, r.next(i));
1249
1249
  }));
1250
1250
  });
1251
1251
  }
1252
1252
  function Yt(n, t) {
1253
1253
  return n === t;
1254
1254
  }
1255
- function qt(n) {
1255
+ function Xt(n) {
1256
1256
  return A(function(t, e) {
1257
1257
  try {
1258
1258
  t.subscribe(e);
@@ -1265,51 +1265,51 @@ function Vt(n) {
1265
1265
  return A(function(t, e) {
1266
1266
  M(n).subscribe(O(e, function() {
1267
1267
  return e.complete();
1268
- }, Q)), !e.closed && t.subscribe(e);
1268
+ }, Z)), !e.closed && t.subscribe(e);
1269
1269
  });
1270
1270
  }
1271
- async function Xt(n, t) {
1271
+ async function Wt(n, t) {
1272
1272
  const e = n.getReader();
1273
1273
  let r;
1274
1274
  for (; !(r = await e.read()).done; )
1275
1275
  t(r.value);
1276
1276
  }
1277
- function Wt(n) {
1277
+ function zt(n) {
1278
1278
  let t, e, r, s = !1;
1279
- return function(o) {
1280
- t === void 0 ? (t = o, e = 0, r = -1) : t = Jt(t, o);
1279
+ return function(i) {
1280
+ t === void 0 ? (t = i, e = 0, r = -1) : t = Qt(t, i);
1281
1281
  const a = t.length;
1282
- let u = 0;
1282
+ let c = 0;
1283
1283
  for (; e < a; ) {
1284
- s && (t[e] === 10 && (u = ++e), s = !1);
1285
- let c = -1;
1286
- for (; e < a && c === -1; ++e)
1284
+ s && (t[e] === 10 && (c = ++e), s = !1);
1285
+ let u = -1;
1286
+ for (; e < a && u === -1; ++e)
1287
1287
  switch (t[e]) {
1288
1288
  case 58:
1289
- r === -1 && (r = e - u);
1289
+ r === -1 && (r = e - c);
1290
1290
  break;
1291
1291
  case 13:
1292
1292
  s = !0;
1293
1293
  case 10:
1294
- c = e;
1294
+ u = e;
1295
1295
  break;
1296
1296
  }
1297
- if (c === -1)
1297
+ if (u === -1)
1298
1298
  break;
1299
- n(t.subarray(u, c), r), u = e, r = -1;
1299
+ n(t.subarray(c, u), r), c = e, r = -1;
1300
1300
  }
1301
- u === a ? t = void 0 : u !== 0 && (t = t.subarray(u), e -= u);
1301
+ c === a ? t = void 0 : c !== 0 && (t = t.subarray(c), e -= c);
1302
1302
  };
1303
1303
  }
1304
- function zt(n, t, e) {
1304
+ function Jt(n, t, e) {
1305
1305
  let r = he();
1306
1306
  const s = new TextDecoder();
1307
- return function(o, a) {
1308
- if (o.length === 0)
1307
+ return function(i, a) {
1308
+ if (i.length === 0)
1309
1309
  e?.(r), r = he();
1310
1310
  else if (a > 0) {
1311
- const u = s.decode(o.subarray(0, a)), c = a + (o[a + 1] === 32 ? 2 : 1), h = s.decode(o.subarray(c));
1312
- switch (u) {
1311
+ const c = s.decode(i.subarray(0, a)), u = a + (i[a + 1] === 32 ? 2 : 1), h = s.decode(i.subarray(u));
1312
+ switch (c) {
1313
1313
  case "data":
1314
1314
  r.data = r.data ? r.data + `
1315
1315
  ` + h : h;
@@ -1321,14 +1321,14 @@ function zt(n, t, e) {
1321
1321
  n(r.id = h);
1322
1322
  break;
1323
1323
  case "retry":
1324
- const g = parseInt(h, 10);
1325
- isNaN(g) || t(r.retry = g);
1324
+ const m = parseInt(h, 10);
1325
+ isNaN(m) || t(r.retry = m);
1326
1326
  break;
1327
1327
  }
1328
1328
  }
1329
1329
  };
1330
1330
  }
1331
- function Jt(n, t) {
1331
+ function Qt(n, t) {
1332
1332
  const e = new Uint8Array(n.length + t.length);
1333
1333
  return e.set(n), e.set(t, n.length), e;
1334
1334
  }
@@ -1340,7 +1340,7 @@ function he() {
1340
1340
  retry: void 0
1341
1341
  };
1342
1342
  }
1343
- var Qt = function(n, t) {
1343
+ var Zt = function(n, t) {
1344
1344
  var e = {};
1345
1345
  for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && t.indexOf(r) < 0 && (e[r] = n[r]);
1346
1346
  if (n != null && typeof Object.getOwnPropertySymbols == "function")
@@ -1348,69 +1348,69 @@ var Qt = function(n, t) {
1348
1348
  t.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(n, r[s]) && (e[r[s]] = n[r[s]]);
1349
1349
  return e;
1350
1350
  };
1351
- const ee = "text/event-stream", Zt = 1e3, fe = "last-event-id";
1352
- function en(n, t) {
1353
- var { signal: e, headers: r, onopen: s, onmessage: i, onclose: o, onerror: a, openWhenHidden: u, fetch: c } = t, h = Qt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
1354
- return new Promise((g, v) => {
1351
+ const te = "text/event-stream", en = 1e3, fe = "last-event-id";
1352
+ function tn(n, t) {
1353
+ var { signal: e, headers: r, onopen: s, onmessage: o, onclose: i, onerror: a, openWhenHidden: c, fetch: u } = t, h = Zt(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
1354
+ return new Promise((m, b) => {
1355
1355
  const l = Object.assign({}, r);
1356
- l.accept || (l.accept = ee);
1356
+ l.accept || (l.accept = te);
1357
1357
  let f;
1358
1358
  function p() {
1359
1359
  f.abort(), document.hidden || V();
1360
1360
  }
1361
- u || document.addEventListener("visibilitychange", p);
1362
- let _ = Zt, I = 0;
1363
- function x() {
1364
- document.removeEventListener("visibilitychange", p), window.clearTimeout(I), f.abort();
1361
+ c || document.addEventListener("visibilitychange", p);
1362
+ let L = en, w = 0;
1363
+ function _() {
1364
+ document.removeEventListener("visibilitychange", p), window.clearTimeout(w), f.abort();
1365
1365
  }
1366
1366
  e?.addEventListener("abort", () => {
1367
- x(), g();
1367
+ _(), m();
1368
1368
  });
1369
- const He = c ?? window.fetch, Ge = s ?? tn;
1369
+ const Fe = u ?? window.fetch, Ge = s ?? nn;
1370
1370
  async function V() {
1371
- var X;
1371
+ var W;
1372
1372
  f = new AbortController();
1373
1373
  try {
1374
- const j = await He(n, Object.assign(Object.assign({}, h), { headers: l, signal: f.signal }));
1375
- await Ge(j), await Xt(j.body, Wt(zt((T) => {
1376
- T ? l[fe] = T : delete l[fe];
1377
- }, (T) => {
1378
- _ = T;
1379
- }, i))), o?.(), x(), g();
1380
- } catch (j) {
1374
+ const F = await Fe(n, Object.assign(Object.assign({}, h), { headers: l, signal: f.signal }));
1375
+ await Ge(F), await Wt(F.body, zt(Jt((x) => {
1376
+ x ? l[fe] = x : delete l[fe];
1377
+ }, (x) => {
1378
+ L = x;
1379
+ }, o))), i?.(), _(), m();
1380
+ } catch (F) {
1381
1381
  if (!f.signal.aborted)
1382
1382
  try {
1383
- const T = (X = a?.(j)) !== null && X !== void 0 ? X : _;
1384
- window.clearTimeout(I), I = window.setTimeout(V, T);
1385
- } catch (T) {
1386
- x(), v(T);
1383
+ const x = (W = a?.(F)) !== null && W !== void 0 ? W : L;
1384
+ window.clearTimeout(w), w = window.setTimeout(V, x);
1385
+ } catch (x) {
1386
+ _(), b(x);
1387
1387
  }
1388
1388
  }
1389
1389
  }
1390
1390
  V();
1391
1391
  });
1392
1392
  }
1393
- function tn(n) {
1393
+ function nn(n) {
1394
1394
  const t = n.headers.get("content-type");
1395
- if (!t?.startsWith(ee))
1396
- throw new Error(`Expected content-type to be ${ee}, Actual: ${t}`);
1395
+ if (!t?.startsWith(te))
1396
+ throw new Error(`Expected content-type to be ${te}, Actual: ${t}`);
1397
1397
  }
1398
1398
  function pe(n) {
1399
- const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders: i } = n, o = n.method ?? "POST";
1399
+ const { endpoint: t, apiKey: e, payload: r, debugMode: s, customHeaders: o } = n, i = n.method ?? "POST";
1400
1400
  return new S((a) => {
1401
- const u = new AbortController();
1402
- let c, h = !1;
1403
- const g = {
1401
+ const c = new AbortController();
1402
+ let u, h = !1;
1403
+ const m = {
1404
1404
  "Content-Type": "application/json",
1405
- ...i
1405
+ ...o
1406
1406
  };
1407
- e && (g["X-API-KEY"] = e);
1408
- const v = new URL(t);
1409
- return s && v.searchParams.set("is_debug", "true"), en(v.toString(), {
1410
- method: o,
1411
- headers: g,
1412
- body: o === "POST" && r ? JSON.stringify(r) : void 0,
1413
- signal: u.signal,
1407
+ e && (m["X-API-KEY"] = e);
1408
+ const b = new URL(t);
1409
+ return s && b.searchParams.set("is_debug", "true"), tn(b.toString(), {
1410
+ method: i,
1411
+ headers: m,
1412
+ body: i === "POST" && r ? JSON.stringify(r) : void 0,
1413
+ signal: c.signal,
1414
1414
  /**
1415
1415
  * Allow SSE to work when the page is hidden.
1416
1416
  * https://github.com/Azure/fetch-event-source/issues/17#issuecomment-1525904929
@@ -1418,7 +1418,7 @@ function pe(n) {
1418
1418
  openWhenHidden: !0,
1419
1419
  onopen: async (l) => {
1420
1420
  if (l.ok)
1421
- c = l.headers.get("X-Trace-Id") ?? void 0;
1421
+ u = l.headers.get("X-Trace-Id") ?? void 0;
1422
1422
  else {
1423
1423
  let f;
1424
1424
  try {
@@ -1430,27 +1430,27 @@ function pe(n) {
1430
1430
  f = null;
1431
1431
  }
1432
1432
  }
1433
- a.error(new te(l.status, l.statusText, f)), u.abort();
1433
+ a.error(new I(l.status, l.statusText, f)), c.abort();
1434
1434
  }
1435
1435
  },
1436
1436
  onmessage: (l) => {
1437
1437
  l.id && (h = !0);
1438
1438
  const f = JSON.parse(l.data);
1439
- c ? f.traceId = c : f.requestId && (f.traceId = f.requestId, c || (c = f.requestId)), a.next(f);
1439
+ u ? f.traceId = u : f.requestId && (f.traceId = f.requestId, u || (u = f.requestId)), a.next(f);
1440
1440
  },
1441
1441
  onclose: () => {
1442
1442
  a.complete();
1443
1443
  },
1444
1444
  onerror: (l) => {
1445
1445
  if (!h)
1446
- throw a.error(l), u.abort(), l;
1446
+ throw a.error(l), c.abort(), l;
1447
1447
  }
1448
1448
  }), () => {
1449
- u.abort();
1449
+ c.abort();
1450
1450
  };
1451
1451
  });
1452
1452
  }
1453
- class nn {
1453
+ class rn {
1454
1454
  listeners = {};
1455
1455
  on(t, e) {
1456
1456
  this.listeners = Object.assign({}, this.listeners, {
@@ -1469,7 +1469,7 @@ class nn {
1469
1469
  this.listeners[t] && this.listeners[t].forEach((r) => r(...e));
1470
1470
  }
1471
1471
  }
1472
- class Tn {
1472
+ class xn {
1473
1473
  apiKey;
1474
1474
  endpoint;
1475
1475
  botProviderEndpoint;
@@ -1479,7 +1479,7 @@ class Tn {
1479
1479
  detached = !1;
1480
1480
  detachTimer;
1481
1481
  inFlight = 0;
1482
- sseEmitter = new nn();
1482
+ sseEmitter = new rn();
1483
1483
  transformSsePayload;
1484
1484
  customHeaders;
1485
1485
  constructor(t) {
@@ -1579,17 +1579,26 @@ class Tn {
1579
1579
  r.searchParams.set("custom_channel_id", t);
1580
1580
  const s = { ...this.customHeaders };
1581
1581
  this.apiKey && (s["X-API-KEY"] = this.apiKey);
1582
- const i = await fetch(r.toString(), { method: "GET", headers: s });
1583
- if (i.status === 404)
1582
+ const o = await fetch(r.toString(), { method: "GET", headers: s });
1583
+ if (o.status === 404)
1584
1584
  return null;
1585
- if (!i.ok)
1586
- throw new te(i.status, i.statusText, await i.text().catch(() => {
1585
+ if (!o.ok)
1586
+ throw new I(o.status, o.statusText, await o.text().catch(() => {
1587
1587
  }));
1588
- const o = await i.json(), a = o.data ?? o;
1588
+ const i = await o.json(), a = i.data ?? i;
1589
1589
  return {
1590
1590
  title: a.title ?? null,
1591
1591
  runState: a.runState ?? "IDLE",
1592
- lastActivityAt: a.lastActivityAt
1592
+ lastActivityAt: a.lastActivityAt,
1593
+ // F-019 — whitelist-pass the live-sandbox list (map the five backend fields); `[]` for an old
1594
+ // backend / a channel with none live. metadata is the sole authority on "who is live".
1595
+ launchedSandboxes: (a.launchedSandboxes ?? []).map((c) => ({
1596
+ sandboxName: c.sandboxName,
1597
+ sandboxBlueprintName: c.sandboxBlueprintName,
1598
+ workingDirectory: c.workingDirectory,
1599
+ editorServerEnabled: c.editorServerEnabled,
1600
+ browserEnabled: c.browserEnabled
1601
+ }))
1593
1602
  };
1594
1603
  }
1595
1604
  runSse(t, e) {
@@ -1597,11 +1606,11 @@ class Tn {
1597
1606
  // No RxJS-level retry: re-subscribing would re-POST and the backend would re-dispatch a duplicate
1598
1607
  // run. Mid-stream resume is the library's job (native Last-Event-ID reconnect in
1599
1608
  // create-sse-observable); a no-cursor failure surfaces via `error` below.
1600
- Ht((r) => Tt(r).pipe(Bt(e?.delayTime ?? 50))),
1609
+ Ft((r) => xt(r).pipe(qt(e?.delayTime ?? 50))),
1601
1610
  Vt(this.destroy$),
1602
1611
  // Settle the run accounting on every termination path — complete, error, AND a user-initiated
1603
1612
  // unsubscribe (stop-generation aborts the connection without a terminal event).
1604
- qt(() => this.onRunSettled())
1613
+ Xt(() => this.onRunSettled())
1605
1614
  ).subscribe({
1606
1615
  next: (r) => {
1607
1616
  this.detached || (e?.onSseMessage?.(r), this.handleEvent(r));
@@ -1653,22 +1662,22 @@ class Tn {
1653
1662
  throw new Error("Unable to derive blob endpoint. Please provide botProviderEndpoint in config.");
1654
1663
  const s = new FormData();
1655
1664
  s.append("file", t), s.append("customChannelId", e);
1656
- const i = {
1665
+ const o = {
1657
1666
  ...this.customHeaders
1658
1667
  };
1659
- this.apiKey && (i["X-API-KEY"] = this.apiKey);
1668
+ this.apiKey && (o["X-API-KEY"] = this.apiKey);
1660
1669
  try {
1661
- const o = await fetch(r, {
1670
+ const i = await fetch(r, {
1662
1671
  method: "POST",
1663
- headers: i,
1672
+ headers: o,
1664
1673
  body: s
1665
1674
  });
1666
- if (!o.ok)
1667
- throw new Error(`Upload failed: ${o.status} ${o.statusText}`);
1668
- const a = await o.json();
1675
+ if (!i.ok)
1676
+ throw new Error(`Upload failed: ${i.status} ${i.statusText}`);
1677
+ const a = await i.json();
1669
1678
  return this.debugMode && console.log("[AsgardServiceClient] File upload response:", a), a;
1670
- } catch (o) {
1671
- throw console.error("[AsgardServiceClient] File upload error:", o), o;
1679
+ } catch (i) {
1680
+ throw console.error("[AsgardServiceClient] File upload error:", i), i;
1672
1681
  }
1673
1682
  }
1674
1683
  /**
@@ -1679,23 +1688,159 @@ class Tn {
1679
1688
  const r = this.getBaseEndpoint();
1680
1689
  if (!r)
1681
1690
  throw new Error("Unable to derive channel-home download endpoint. Please provide botProviderEndpoint in config.");
1682
- const s = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, i = `${r}/channel-home/download?${s}`, o = {
1691
+ const s = `custom_channel_id=${encodeURIComponent(e)}&relative_path=${encodeURIComponent(t)}`, o = `${r}/channel-home/download?${s}`, i = {
1683
1692
  ...this.customHeaders
1684
1693
  };
1685
- this.apiKey && (o["X-API-KEY"] = this.apiKey);
1694
+ this.apiKey && (i["X-API-KEY"] = this.apiKey);
1686
1695
  try {
1687
- const a = await fetch(i, {
1696
+ const a = await fetch(o, {
1688
1697
  method: "GET",
1689
- headers: o
1698
+ headers: i
1690
1699
  });
1691
1700
  if (!a.ok)
1692
1701
  throw new Error(`Channel Home download failed: ${a.status} ${a.statusText}`);
1693
- const u = await a.blob(), c = t.split("/").pop() || "download";
1694
- return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: c, size: u.size }), { blob: u, filename: c };
1702
+ const c = await a.blob(), u = t.split("/").pop() || "download";
1703
+ return this.debugMode && console.log("[AsgardServiceClient] Channel Home download response:", { filename: u, size: c.size }), { blob: c, filename: u };
1695
1704
  } catch (a) {
1696
1705
  throw console.error("[AsgardServiceClient] Channel Home download error:", a), a;
1697
1706
  }
1698
1707
  }
1708
+ /**
1709
+ * F-020 — 取得 sandbox 瀏覽器一次性接手 URL(`sandbox://<name>/open-browser` 卡的副作用)。
1710
+ * 呼叫 `POST {base}/sandbox/{sandboxName}/browser/open-url`(對標 asgard-core edgeserver
1711
+ * `GenerateSandboxBrowserOpenUrl`:path 參數 namespace / bot-provider 已在 base、sandbox_name 在路徑,
1712
+ * 不需 custom_channel_id)。回應 `{ data: { openURL } }`(envelope 容錯,比照 `channelMetadata`)。
1713
+ */
1714
+ async generateSandboxBrowserOpenUrl(t) {
1715
+ const e = this.getBaseEndpoint();
1716
+ if (!e)
1717
+ throw new Error(
1718
+ "Unable to derive sandbox browser open-url endpoint. Please provide botProviderEndpoint in config."
1719
+ );
1720
+ const r = `${e}/sandbox/${encodeURIComponent(t)}/browser/open-url`, s = { ...this.customHeaders };
1721
+ this.apiKey && (s["X-API-KEY"] = this.apiKey);
1722
+ const o = await fetch(r, { method: "POST", headers: s });
1723
+ if (!o.ok)
1724
+ throw new I(o.status, o.statusText, await o.text().catch(() => {
1725
+ }));
1726
+ const i = await o.json(), a = i.data?.openURL ?? i.openURL;
1727
+ if (!a)
1728
+ throw new Error("Sandbox browser open-url response did not contain an openURL.");
1729
+ return a;
1730
+ }
1731
+ /**
1732
+ * F-021 — 衍生 sandbox fs 端點 base:`{base}/sandbox/{sandboxName}/fs`(namespace / bot-provider 已在 base)。
1733
+ */
1734
+ deriveSandboxFsEndpoint(t) {
1735
+ const e = this.getBaseEndpoint();
1736
+ if (!e)
1737
+ throw new Error("Unable to derive sandbox fs endpoint. Please provide botProviderEndpoint in config.");
1738
+ return `${e}/sandbox/${encodeURIComponent(t)}/fs`;
1739
+ }
1740
+ sandboxFsHeaders() {
1741
+ const t = { ...this.customHeaders };
1742
+ return this.apiKey && (t["X-API-KEY"] = this.apiKey), t;
1743
+ }
1744
+ /**
1745
+ * F-021 — 列出 sandbox 目錄內容(`GET fs/list?path=`)。回應 `{ data: { entries, truncated } }`(envelope
1746
+ * 容錯,比照 `channelMetadata`)。
1747
+ */
1748
+ async sandboxFsList(t, e) {
1749
+ const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/list`);
1750
+ r.searchParams.set("path", e);
1751
+ const s = await fetch(r.toString(), { method: "GET", headers: this.sandboxFsHeaders() });
1752
+ if (!s.ok)
1753
+ throw new I(s.status, s.statusText, await s.text().catch(() => {
1754
+ }));
1755
+ const o = await s.json(), i = o.data ?? o;
1756
+ return { entries: i.entries ?? [], truncated: i.truncated ?? !1 };
1757
+ }
1758
+ /**
1759
+ * F-021 — 讀取 sandbox 檔案(`GET fs/file?path=[&offset_bytes&limit_bytes]`)。回應是 raw octet-stream,
1760
+ * 檔案總長度 / 是否截斷走 `X-Total-Bytes` / `X-Truncated` header。
1761
+ */
1762
+ async sandboxFsRead(t, e, r) {
1763
+ const s = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
1764
+ s.searchParams.set("path", e), r?.offsetBytes != null && s.searchParams.set("offset_bytes", String(r.offsetBytes)), r?.limitBytes != null && s.searchParams.set("limit_bytes", String(r.limitBytes));
1765
+ const o = await fetch(s.toString(), { method: "GET", headers: this.sandboxFsHeaders() });
1766
+ if (!o.ok)
1767
+ throw new I(o.status, o.statusText, await o.text().catch(() => {
1768
+ }));
1769
+ const i = await o.blob(), a = o.headers.get("X-Total-Bytes");
1770
+ return {
1771
+ content: i,
1772
+ totalBytes: a != null ? Number(a) : i.size,
1773
+ truncated: o.headers.get("X-Truncated") === "true"
1774
+ };
1775
+ }
1776
+ /**
1777
+ * F-021 — 寫入 sandbox 檔案(`PUT fs/file?path=[&mode&create_only]`,`multipart/form-data` 帶 `file`)。
1778
+ * 回應 `{ data: { bytesWritten } }`。
1779
+ */
1780
+ async sandboxFsWrite(t, e, r, s) {
1781
+ const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/file`);
1782
+ o.searchParams.set("path", e), s?.mode != null && o.searchParams.set("mode", String(s.mode)), s?.createOnly && o.searchParams.set("create_only", "true");
1783
+ const i = new FormData();
1784
+ i.append("file", r instanceof Blob ? r : new Blob([r]));
1785
+ const a = await fetch(o.toString(), { method: "PUT", headers: this.sandboxFsHeaders(), body: i });
1786
+ if (!a.ok)
1787
+ throw new I(a.status, a.statusText, await a.text().catch(() => {
1788
+ }));
1789
+ const c = await a.json();
1790
+ return { bytesWritten: (c.data ?? c).bytesWritten ?? 0 };
1791
+ }
1792
+ /** F-021 Cycle 2 — `sandbox://` fs mutation shared request helper (throws `HttpError` on non-OK). */
1793
+ async sandboxFsRequest(t, e, r, s) {
1794
+ const o = new URL(`${this.deriveSandboxFsEndpoint(t)}/${e}`);
1795
+ Object.entries(s).forEach(([a, c]) => o.searchParams.set(a, c));
1796
+ const i = await fetch(o.toString(), { method: r, headers: this.sandboxFsHeaders() });
1797
+ if (!i.ok)
1798
+ throw new I(i.status, i.statusText, await i.text().catch(() => {
1799
+ }));
1800
+ return i.json().catch(() => null);
1801
+ }
1802
+ /** F-021 — stat a sandbox path (`GET fs/stat?path=`). */
1803
+ async sandboxFsStat(t, e) {
1804
+ const r = new URL(`${this.deriveSandboxFsEndpoint(t)}/stat`);
1805
+ r.searchParams.set("path", e);
1806
+ const s = await fetch(r.toString(), { method: "GET", headers: this.sandboxFsHeaders() });
1807
+ if (!s.ok)
1808
+ throw new I(s.status, s.statusText, await s.text().catch(() => {
1809
+ }));
1810
+ const o = await s.json(), i = o.data ?? o;
1811
+ return {
1812
+ exists: i.exists ?? !1,
1813
+ isDir: i.isDir ?? !1,
1814
+ sizeBytes: i.sizeBytes ?? 0,
1815
+ mtimeUnix: i.mtimeUnix ?? 0,
1816
+ mode: i.mode ?? 0,
1817
+ etag: i.etag
1818
+ };
1819
+ }
1820
+ /** F-021 — create a directory (`POST fs/mkdir?path=`). */
1821
+ async sandboxFsMkdir(t, e) {
1822
+ await this.sandboxFsRequest(t, "mkdir", "POST", { path: e });
1823
+ }
1824
+ /** F-021 — delete a file (`DELETE fs/item?path=`). */
1825
+ async sandboxFsRemove(t, e) {
1826
+ await this.sandboxFsRequest(t, "item", "DELETE", { path: e });
1827
+ }
1828
+ /** F-021 — recursively delete a directory (`DELETE fs/all?path=`). */
1829
+ async sandboxFsRemoveAll(t, e) {
1830
+ await this.sandboxFsRequest(t, "all", "DELETE", { path: e });
1831
+ }
1832
+ /** F-021 — copy a path (`POST fs/copy?src=&dst=[&overwrite]`) → bytes copied. */
1833
+ async sandboxFsCopy(t, e, r, s) {
1834
+ const o = { src: e, dst: r };
1835
+ s?.overwrite && (o.overwrite = "true");
1836
+ const i = await this.sandboxFsRequest(t, "copy", "POST", o);
1837
+ return { bytesCopied: (i?.data ?? i)?.bytesCopied ?? 0 };
1838
+ }
1839
+ /** F-021 — move / rename a path (`POST fs/move?src=&dst=[&overwrite]`). */
1840
+ async sandboxFsMove(t, e, r, s) {
1841
+ const o = { src: e, dst: r };
1842
+ s?.overwrite && (o.overwrite = "true"), await this.sandboxFsRequest(t, "move", "POST", o);
1843
+ }
1699
1844
  /**
1700
1845
  * 從 botProviderEndpoint 衍生 Blob API endpoint
1701
1846
  */
@@ -1712,34 +1857,34 @@ class Tn {
1712
1857
  return !t && this.endpoint && (t = this.endpoint.replace("/message/sse", "")), t ? t.replace(/\/+$/, "") : null;
1713
1858
  }
1714
1859
  }
1715
- const b = [];
1860
+ const y = [];
1716
1861
  for (let n = 0; n < 256; ++n)
1717
- b.push((n + 256).toString(16).slice(1));
1718
- function rn(n, t = 0) {
1719
- return (b[n[t + 0]] + b[n[t + 1]] + b[n[t + 2]] + b[n[t + 3]] + "-" + b[n[t + 4]] + b[n[t + 5]] + "-" + b[n[t + 6]] + b[n[t + 7]] + "-" + b[n[t + 8]] + b[n[t + 9]] + "-" + b[n[t + 10]] + b[n[t + 11]] + b[n[t + 12]] + b[n[t + 13]] + b[n[t + 14]] + b[n[t + 15]]).toLowerCase();
1720
- }
1721
- let z;
1722
- const sn = new Uint8Array(16);
1723
- function on() {
1724
- if (!z) {
1862
+ y.push((n + 256).toString(16).slice(1));
1863
+ function sn(n, t = 0) {
1864
+ return (y[n[t + 0]] + y[n[t + 1]] + y[n[t + 2]] + y[n[t + 3]] + "-" + y[n[t + 4]] + y[n[t + 5]] + "-" + y[n[t + 6]] + y[n[t + 7]] + "-" + y[n[t + 8]] + y[n[t + 9]] + "-" + y[n[t + 10]] + y[n[t + 11]] + y[n[t + 12]] + y[n[t + 13]] + y[n[t + 14]] + y[n[t + 15]]).toLowerCase();
1865
+ }
1866
+ let J;
1867
+ const on = new Uint8Array(16);
1868
+ function an() {
1869
+ if (!J) {
1725
1870
  if (typeof crypto > "u" || !crypto.getRandomValues)
1726
1871
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1727
- z = crypto.getRandomValues.bind(crypto);
1872
+ J = crypto.getRandomValues.bind(crypto);
1728
1873
  }
1729
- return z(sn);
1874
+ return J(on);
1730
1875
  }
1731
- const an = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ge = { randomUUID: an };
1732
- function cn(n, t, e) {
1876
+ const cn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), me = { randomUUID: cn };
1877
+ function un(n, t, e) {
1733
1878
  n = n || {};
1734
- const r = n.random ?? n.rng?.() ?? on();
1879
+ const r = n.random ?? n.rng?.() ?? an();
1735
1880
  if (r.length < 16)
1736
1881
  throw new Error("Random bytes length must be >= 16");
1737
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, rn(r);
1882
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, sn(r);
1738
1883
  }
1739
- function De(n, t, e) {
1740
- return ge.randomUUID && !n ? ge.randomUUID() : cn(n);
1884
+ function He(n, t, e) {
1885
+ return me.randomUUID && !n ? me.randomUUID() : un(n);
1741
1886
  }
1742
- class y {
1887
+ class v {
1743
1888
  messages = null;
1744
1889
  pendingConsent = null;
1745
1890
  constructor({ messages: t, pendingConsent: e = null }) {
@@ -1747,10 +1892,10 @@ class y {
1747
1892
  }
1748
1893
  pushMessage(t) {
1749
1894
  const e = new Map(this.messages);
1750
- return e.set(t.messageId, t), new y({ messages: e, pendingConsent: this.pendingConsent });
1895
+ return e.set(t.messageId, t), new v({ messages: e, pendingConsent: this.pendingConsent });
1751
1896
  }
1752
1897
  clearPendingConsent() {
1753
- return this.pendingConsent ? new y({ messages: this.messages, pendingConsent: null }) : this;
1898
+ return this.pendingConsent ? new v({ messages: this.messages, pendingConsent: null }) : this;
1754
1899
  }
1755
1900
  /**
1756
1901
  * Converge every still-running tool-call to `cancelled` (F-020 AC10). Called when a user-initiated
@@ -1765,7 +1910,7 @@ class y {
1765
1910
  const e = new Map(this.messages);
1766
1911
  for (const [r, s] of e)
1767
1912
  s.type === "tool-call" && !s.isComplete && (e.set(r, { ...s, isComplete: !0, isCancelled: !0 }), t = !0);
1768
- return t ? new y({ messages: e, pendingConsent: this.pendingConsent }) : this;
1913
+ return t ? new v({ messages: e, pendingConsent: this.pendingConsent }) : this;
1769
1914
  }
1770
1915
  onMessage(t) {
1771
1916
  switch (t.eventType) {
@@ -1817,6 +1962,7 @@ class y {
1817
1962
  }
1818
1963
  onMessageStart(t) {
1819
1964
  const e = t.fact.messageStart.message;
1965
+ if (e.parentToolUseId) return this;
1820
1966
  if (this.isTerminalBot(this.messages?.get(e.messageId))) return this;
1821
1967
  const r = new Map(this.messages);
1822
1968
  return r.set(e.messageId, {
@@ -1829,13 +1975,15 @@ class y {
1829
1975
  time: /* @__PURE__ */ new Date(),
1830
1976
  traceId: t.traceId,
1831
1977
  raw: ""
1832
- }), new y({ messages: r, pendingConsent: this.pendingConsent });
1978
+ }), new v({ messages: r, pendingConsent: this.pendingConsent });
1833
1979
  }
1834
1980
  onMessageDelta(t) {
1835
- const e = t.fact.messageDelta.message, r = this.messages?.get(e.messageId);
1981
+ const e = t.fact.messageDelta.message;
1982
+ if (e.parentToolUseId) return this;
1983
+ const r = this.messages?.get(e.messageId);
1836
1984
  if (this.isTerminalBot(r)) return this;
1837
- const s = r?.type === "bot" ? r : void 0, i = new Map(this.messages);
1838
- return i.set(e.messageId, {
1985
+ const s = r?.type === "bot" ? r : void 0, o = new Map(this.messages);
1986
+ return o.set(e.messageId, {
1839
1987
  type: "bot",
1840
1988
  eventType: d.MESSAGE_DELTA,
1841
1989
  isTyping: !0,
@@ -1845,10 +1993,12 @@ class y {
1845
1993
  time: /* @__PURE__ */ new Date(),
1846
1994
  traceId: t.traceId ?? s?.traceId,
1847
1995
  raw: s?.raw ?? ""
1848
- }), new y({ messages: i, pendingConsent: this.pendingConsent });
1996
+ }), new v({ messages: o, pendingConsent: this.pendingConsent });
1849
1997
  }
1850
1998
  onMessageComplete(t) {
1851
- const e = t.fact.messageComplete.message, r = new Map(this.messages), s = r.get(e.messageId);
1999
+ const e = t.fact.messageComplete.message;
2000
+ if (e.parentToolUseId) return this;
2001
+ const r = new Map(this.messages), s = r.get(e.messageId);
1852
2002
  return r.set(e.messageId, {
1853
2003
  type: "bot",
1854
2004
  eventType: d.MESSAGE_COMPLETE,
@@ -1859,10 +2009,11 @@ class y {
1859
2009
  time: /* @__PURE__ */ new Date(),
1860
2010
  traceId: t.traceId ?? (s?.type === "bot" ? s.traceId : void 0),
1861
2011
  raw: JSON.stringify(t)
1862
- }), new y({ messages: r, pendingConsent: this.pendingConsent });
2012
+ }), new v({ messages: r, pendingConsent: this.pendingConsent });
1863
2013
  }
1864
2014
  onThinkingStart(t) {
1865
2015
  const e = t.fact.messageThinkingStart.message;
2016
+ if (e.parentToolUseId) return this;
1866
2017
  if (this.isTerminalThinking(this.messages?.get(e.messageId))) return this;
1867
2018
  const r = new Map(this.messages), s = {
1868
2019
  type: "thinking",
@@ -1872,12 +2023,14 @@ class y {
1872
2023
  time: /* @__PURE__ */ new Date(),
1873
2024
  traceId: t.traceId
1874
2025
  };
1875
- return r.set(e.messageId, s), new y({ messages: r, pendingConsent: this.pendingConsent });
2026
+ return r.set(e.messageId, s), new v({ messages: r, pendingConsent: this.pendingConsent });
1876
2027
  }
1877
2028
  onThinkingDelta(t) {
1878
- const e = t.fact.messageThinkingDelta.message, r = this.messages?.get(e.messageId);
2029
+ const e = t.fact.messageThinkingDelta.message;
2030
+ if (e.parentToolUseId) return this;
2031
+ const r = this.messages?.get(e.messageId);
1879
2032
  if (this.isTerminalThinking(r)) return this;
1880
- const s = r?.type === "thinking" ? r : void 0, i = new Map(this.messages), o = {
2033
+ const s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
1881
2034
  type: "thinking",
1882
2035
  messageId: e.messageId,
1883
2036
  text: `${s?.text ?? ""}${e.text}`,
@@ -1885,10 +2038,12 @@ class y {
1885
2038
  time: s?.time ?? /* @__PURE__ */ new Date(),
1886
2039
  traceId: t.traceId ?? s?.traceId
1887
2040
  };
1888
- return i.set(e.messageId, o), new y({ messages: i, pendingConsent: this.pendingConsent });
2041
+ return o.set(e.messageId, i), new v({ messages: o, pendingConsent: this.pendingConsent });
1889
2042
  }
1890
2043
  onThinkingComplete(t) {
1891
- const e = t.fact.messageThinkingComplete.message, r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0, i = new Map(this.messages), o = {
2044
+ const e = t.fact.messageThinkingComplete.message;
2045
+ if (e.parentToolUseId) return this;
2046
+ const r = this.messages?.get(e.messageId), s = r?.type === "thinking" ? r : void 0, o = new Map(this.messages), i = {
1892
2047
  type: "thinking",
1893
2048
  messageId: e.messageId,
1894
2049
  // Self-sufficient (F-011): the complete frame carries the full reasoning, so a complete-only
@@ -1898,12 +2053,12 @@ class y {
1898
2053
  time: s?.time ?? /* @__PURE__ */ new Date(),
1899
2054
  traceId: t.traceId ?? s?.traceId
1900
2055
  };
1901
- return i.set(e.messageId, o), new y({ messages: i, pendingConsent: this.pendingConsent });
2056
+ return o.set(e.messageId, i), new v({ messages: o, pendingConsent: this.pendingConsent });
1902
2057
  }
1903
2058
  onMessageUser(t) {
1904
2059
  const e = t.fact.messageUser;
1905
2060
  if ((this.messages?.get(e.messageId) ?? (e.customMessageId ? this.messages?.get(e.customMessageId) : void 0))?.type === "user") return this;
1906
- const s = new Map(this.messages), i = {
2061
+ const s = new Map(this.messages), o = {
1907
2062
  type: "user",
1908
2063
  messageId: e.messageId,
1909
2064
  text: e.text,
@@ -1913,10 +2068,10 @@ class y {
1913
2068
  time: /* @__PURE__ */ new Date(),
1914
2069
  traceId: t.traceId
1915
2070
  };
1916
- return s.set(e.messageId, i), new y({ messages: s, pendingConsent: this.pendingConsent });
2071
+ return s.set(e.messageId, o), new v({ messages: s, pendingConsent: this.pendingConsent });
1917
2072
  }
1918
2073
  onMessageError(t) {
1919
- const e = De(), r = t.fact.runError.error, s = new Map(this.messages);
2074
+ const e = He(), r = t.fact.runError.error, s = new Map(this.messages);
1920
2075
  return s.set(e, {
1921
2076
  type: "error",
1922
2077
  eventType: d.ERROR,
@@ -1924,10 +2079,10 @@ class y {
1924
2079
  error: r,
1925
2080
  time: /* @__PURE__ */ new Date(),
1926
2081
  traceId: t.traceId
1927
- }), new y({ messages: s, pendingConsent: this.pendingConsent });
2082
+ }), new v({ messages: s, pendingConsent: this.pendingConsent });
1928
2083
  }
1929
2084
  onToolCallStart(t) {
1930
- const e = t.fact.toolCallStart, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, i = {
2085
+ const e = t.fact.toolCallStart, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, o = {
1931
2086
  type: "tool-call",
1932
2087
  eventType: d.TOOL_CALL_START,
1933
2088
  messageId: s,
@@ -1943,30 +2098,30 @@ class y {
1943
2098
  time: /* @__PURE__ */ new Date(),
1944
2099
  traceId: t.traceId
1945
2100
  };
1946
- return r.set(s, i), new y({ messages: r, pendingConsent: this.pendingConsent });
2101
+ return r.set(s, o), new v({ messages: r, pendingConsent: this.pendingConsent });
1947
2102
  }
1948
2103
  onToolCallComplete(t) {
1949
- const e = t.fact.toolCallComplete, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, i = r.get(s);
1950
- if (i?.type === "tool-call") {
1951
- const o = {
1952
- ...i,
2104
+ const e = t.fact.toolCallComplete, r = new Map(this.messages), s = `${e.processId}-${e.callSeq}`, o = r.get(s);
2105
+ if (o?.type === "tool-call") {
2106
+ const i = {
2107
+ ...o,
1953
2108
  eventType: d.TOOL_CALL_COMPLETE,
1954
2109
  result: e.toolCallResult,
1955
2110
  isError: e.isError,
1956
2111
  sidecar: e.toolUseResultSidecar,
1957
2112
  isComplete: !0,
1958
- traceId: t.traceId ?? i.traceId
2113
+ traceId: t.traceId ?? o.traceId
1959
2114
  };
1960
- r.set(s, o);
2115
+ r.set(s, i);
1961
2116
  }
1962
- return new y({ messages: r, pendingConsent: this.pendingConsent });
2117
+ return new v({ messages: r, pendingConsent: this.pendingConsent });
1963
2118
  }
1964
2119
  onToolCallConsent(t) {
1965
2120
  const e = t.fact.toolCallConsent;
1966
- return new y({ messages: this.messages, pendingConsent: e });
2121
+ return new v({ messages: this.messages, pendingConsent: e });
1967
2122
  }
1968
2123
  onSubagentStart(t) {
1969
- const e = t.fact.subagentStart, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:start`, i = {
2124
+ const e = t.fact.subagentStart, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:start`, o = {
1970
2125
  type: "subagent",
1971
2126
  messageId: s,
1972
2127
  kind: "start",
@@ -1977,10 +2132,10 @@ class y {
1977
2132
  time: /* @__PURE__ */ new Date(),
1978
2133
  traceId: t.traceId
1979
2134
  };
1980
- return r.set(s, i), new y({ messages: r, pendingConsent: this.pendingConsent });
2135
+ return r.set(s, o), new v({ messages: r, pendingConsent: this.pendingConsent });
1981
2136
  }
1982
2137
  onSubagentComplete(t) {
1983
- const e = t.fact.subagentComplete, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:complete`, i = {
2138
+ const e = t.fact.subagentComplete, r = new Map(this.messages), s = `subagent:${e.parentToolUseId}:complete`, o = {
1984
2139
  type: "subagent",
1985
2140
  messageId: s,
1986
2141
  kind: "complete",
@@ -1992,97 +2147,97 @@ class y {
1992
2147
  time: /* @__PURE__ */ new Date(),
1993
2148
  traceId: t.traceId
1994
2149
  };
1995
- return r.set(s, i), new y({ messages: r, pendingConsent: this.pendingConsent });
2150
+ return r.set(s, o), new v({ messages: r, pendingConsent: this.pendingConsent });
1996
2151
  }
1997
2152
  }
1998
- const un = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
1999
- function ln(n) {
2000
- return n.toolsetName === "" && un.has(n.toolName);
2153
+ const ln = /* @__PURE__ */ new Set(["TaskCreate", "TaskUpdate"]);
2154
+ function dn(n) {
2155
+ return n.toolsetName === "" && ln.has(n.toolName);
2001
2156
  }
2002
- function me(n) {
2157
+ function ge(n) {
2003
2158
  return typeof n == "object" && n !== null ? n : void 0;
2004
2159
  }
2005
2160
  function E(n) {
2006
2161
  return typeof n == "string" ? n : void 0;
2007
2162
  }
2008
- function dn(n) {
2163
+ function hn(n) {
2009
2164
  const t = [], e = /* @__PURE__ */ new Map();
2010
2165
  for (const r of n) {
2011
- const s = r.parameter ?? {}, i = r.sidecar ?? {};
2166
+ const s = r.parameter ?? {}, o = r.sidecar ?? {};
2012
2167
  if (r.toolName === "TaskCreate") {
2013
- const o = me(i.task), a = E(o?.id);
2168
+ const i = ge(o.task), a = E(i?.id);
2014
2169
  if (!a) continue;
2015
2170
  e.has(a) || t.push(a), e.set(a, {
2016
2171
  id: a,
2017
- subject: E(s.subject) || E(o?.subject) || "",
2172
+ subject: E(s.subject) || E(i?.subject) || "",
2018
2173
  activeForm: E(s.activeForm),
2019
2174
  description: E(s.description),
2020
2175
  status: e.get(a)?.status ?? "pending"
2021
2176
  // initial status = pending (keep existing on repeat)
2022
2177
  });
2023
2178
  } else if (r.toolName === "TaskUpdate") {
2024
- const o = me(i.statusChange), a = E(s.taskId) || E(i.taskId), u = E(o?.to) || E(s.status);
2025
- if (!a || !u) continue;
2026
- const c = e.get(a);
2027
- c && e.set(a, { ...c, status: u });
2179
+ const i = ge(o.statusChange), a = E(s.taskId) || E(o.taskId), c = E(i?.to) || E(s.status);
2180
+ if (!a || !c) continue;
2181
+ const u = e.get(a);
2182
+ u && e.set(a, { ...u, status: c });
2028
2183
  }
2029
2184
  }
2030
2185
  return t.map((r) => e.get(r));
2031
2186
  }
2032
- function hn(n) {
2187
+ function fn(n) {
2033
2188
  return n.toolsetName === "" && n.toolName === "Agent";
2034
2189
  }
2035
- function fn(n) {
2190
+ function pn(n) {
2036
2191
  return !!n;
2037
2192
  }
2038
- function pn(n) {
2039
- const t = [], e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = (i) => (e.has(i) || (t.push(i), e.set(i, { status: "running" }), r.set(i, /* @__PURE__ */ new Map())), e.get(i));
2040
- for (const i of n)
2041
- switch (i.kind) {
2193
+ function mn(n) {
2194
+ const t = [], e = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = (o) => (e.has(o) || (t.push(o), e.set(o, { status: "running" }), r.set(o, /* @__PURE__ */ new Map())), e.get(o));
2195
+ for (const o of n)
2196
+ switch (o.kind) {
2042
2197
  case "agentStart": {
2043
- const o = s(i.toolUseId);
2044
- i.description && !o.description && (o.description = i.description);
2198
+ const i = s(o.toolUseId);
2199
+ o.description && !i.description && (i.description = o.description);
2045
2200
  break;
2046
2201
  }
2047
2202
  case "subagentStart": {
2048
- const o = s(i.parentToolUseId);
2049
- o.agentId = i.agentId ?? o.agentId, o.subagentType = i.subagentType ?? o.subagentType, o.description = i.description ?? o.description;
2203
+ const i = s(o.parentToolUseId);
2204
+ i.agentId = o.agentId ?? i.agentId, i.subagentType = o.subagentType ?? i.subagentType, i.description = o.description ?? i.description;
2050
2205
  break;
2051
2206
  }
2052
2207
  case "toolStart": {
2053
- s(i.parentToolUseId), r.get(i.parentToolUseId).set(i.toolUseId, {
2054
- toolsetName: i.toolsetName,
2055
- toolName: i.toolName,
2056
- parameter: i.parameter ?? {},
2057
- reason: i.reason,
2208
+ s(o.parentToolUseId), r.get(o.parentToolUseId).set(o.toolUseId, {
2209
+ toolsetName: o.toolsetName,
2210
+ toolName: o.toolName,
2211
+ parameter: o.parameter ?? {},
2212
+ reason: o.reason,
2058
2213
  status: "running"
2059
2214
  });
2060
2215
  break;
2061
2216
  }
2062
2217
  case "toolComplete": {
2063
- const o = r.get(i.parentToolUseId)?.get(i.toolUseId);
2064
- o && (o.status = i.isError ? "error" : "completed");
2218
+ const i = r.get(o.parentToolUseId)?.get(o.toolUseId);
2219
+ i && (i.status = o.isError ? "error" : "completed");
2065
2220
  break;
2066
2221
  }
2067
2222
  case "subagentComplete": {
2068
- const o = s(i.parentToolUseId);
2069
- o.status = i.status, o.summary = i.summary;
2223
+ const i = s(o.parentToolUseId);
2224
+ i.status = o.status, i.summary = o.summary;
2070
2225
  break;
2071
2226
  }
2072
2227
  }
2073
- return t.map((i) => ({
2074
- parentToolUseId: i,
2075
- ...e.get(i),
2076
- tools: Array.from(r.get(i).values())
2228
+ return t.map((o) => ({
2229
+ parentToolUseId: o,
2230
+ ...e.get(o),
2231
+ tools: Array.from(r.get(o).values())
2077
2232
  }));
2078
2233
  }
2079
2234
  function gn(n) {
2080
2235
  return typeof n == "string" ? n : void 0;
2081
2236
  }
2082
- function mn(n) {
2237
+ function bn(n) {
2083
2238
  const t = [];
2084
2239
  for (const e of n) {
2085
- if (e.type === "tool-call" && hn(e)) {
2240
+ if (e.type === "tool-call" && fn(e)) {
2086
2241
  t.push({
2087
2242
  kind: "agentStart",
2088
2243
  toolUseId: e.toolUseId ?? e.messageId,
@@ -2090,7 +2245,7 @@ function mn(n) {
2090
2245
  });
2091
2246
  continue;
2092
2247
  }
2093
- if (e.type === "tool-call" && fn(e.parentToolUseId)) {
2248
+ if (e.type === "tool-call" && pn(e.parentToolUseId)) {
2094
2249
  const r = e.toolUseId ?? e.messageId;
2095
2250
  t.push({
2096
2251
  kind: "toolStart",
@@ -2129,35 +2284,35 @@ function mn(n) {
2129
2284
  }
2130
2285
  function vn(n) {
2131
2286
  const t = Array.from(n.messages?.values() ?? []).filter(
2132
- (e) => e.type === "tool-call" && e.isComplete && ln(e)
2287
+ (e) => e.type === "tool-call" && e.isComplete && dn(e)
2133
2288
  );
2134
- return dn(t);
2289
+ return hn(t);
2135
2290
  }
2136
2291
  function yn(n) {
2137
- return pn(mn(Array.from(n.messages?.values() ?? [])));
2292
+ return mn(bn(Array.from(n.messages?.values() ?? [])));
2138
2293
  }
2139
- function bn(n, t) {
2294
+ function Sn(n, t) {
2140
2295
  return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
2141
2296
  const s = t[r];
2142
2297
  return e.id === s.id && e.status === s.status && e.subject === s.subject && e.activeForm === s.activeForm && e.description === s.description;
2143
2298
  });
2144
2299
  }
2145
- function Sn(n, t) {
2300
+ function wn(n, t) {
2146
2301
  return n.length !== t.length ? !1 : n.every((e, r) => {
2147
2302
  const s = t[r];
2148
2303
  return e.toolName === s.toolName && e.toolsetName === s.toolsetName && e.status === s.status && e.reason === s.reason;
2149
2304
  });
2150
2305
  }
2151
- function In(n, t) {
2306
+ function En(n, t) {
2152
2307
  return n === t ? !0 : n.length !== t.length ? !1 : n.every((e, r) => {
2153
2308
  const s = t[r];
2154
- return e.parentToolUseId === s.parentToolUseId && e.status === s.status && e.subagentType === s.subagentType && e.description === s.description && e.summary === s.summary && Sn(e.tools, s.tools);
2309
+ return e.parentToolUseId === s.parentToolUseId && e.status === s.status && e.subagentType === s.subagentType && e.description === s.description && e.summary === s.summary && wn(e.tools, s.tools);
2155
2310
  });
2156
2311
  }
2157
- function En(n) {
2158
- const t = new P([]), e = new P([]), r = new U();
2159
- return r.add(n.pipe(N(vn), Y(bn)).subscribe(t)), r.add(
2160
- n.pipe(N(yn), Y(In)).subscribe(e)
2312
+ function In(n) {
2313
+ const t = new P([]), e = new P([]), r = new R();
2314
+ return r.add(n.pipe(N(vn), j(Sn)).subscribe(t)), r.add(
2315
+ n.pipe(N(yn), j(En)).subscribe(e)
2161
2316
  ), {
2162
2317
  tasks$: t.asObservable(),
2163
2318
  subagents$: e.asObservable(),
@@ -2166,6 +2321,13 @@ function En(n) {
2166
2321
  teardown: () => r.unsubscribe()
2167
2322
  };
2168
2323
  }
2324
+ function be(n) {
2325
+ const t = /* @__PURE__ */ new Map();
2326
+ for (const e of n) t.set(e.sandboxName, e);
2327
+ return [...t.values()].sort(
2328
+ (e, r) => (e.sandboxBlueprintName || e.sandboxName).localeCompare(r.sandboxBlueprintName || r.sandboxName)
2329
+ );
2330
+ }
2169
2331
  class K {
2170
2332
  client;
2171
2333
  customChannelId;
@@ -2174,6 +2336,10 @@ class K {
2174
2336
  conversation$;
2175
2337
  channelTitleSubject;
2176
2338
  sandboxPhaseSubject;
2339
+ launchedSandboxesSubject;
2340
+ // Sandboxes hinted live by an `asgard.sandbox.launch` frame but not yet confirmed by metadata (F-019).
2341
+ // Never merged into the live list directly — cleared once metadata confirms (or held until it does).
2342
+ pendingLaunches = [];
2177
2343
  derivedStores;
2178
2344
  statesObserver;
2179
2345
  statesSubscription;
@@ -2185,6 +2351,8 @@ class K {
2185
2351
  channelTitle$;
2186
2352
  /** Reactive sandbox cold-start phase store (F-018): per-slice, derived from the last sandbox event; replay-safe. */
2187
2353
  sandboxPhase$;
2354
+ /** Reactive live-sandbox list store (F-019): authoritative from `/channel/metadata`, per-slice; replay-safe. */
2355
+ launchedSandboxes$;
2188
2356
  currentUserMessageId;
2189
2357
  // The most-recently-sent user message id. Unlike currentUserMessageId (which
2190
2358
  // is cleared once a traceId is attached), this is kept across the SSE
@@ -2200,7 +2368,9 @@ class K {
2200
2368
  throw new Error("client must be required");
2201
2369
  if (!t.customChannelId)
2202
2370
  throw new Error("customChannelId must be required");
2203
- this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new P(!1), this.conversation$ = new P(t.conversation), this.channelTitleSubject = new P(t.channelTitle ?? null), this.sandboxPhaseSubject = new P("idle"), this.derivedStores = En(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(Y()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(Y()), this.statesObserver = t.statesObserver;
2371
+ this.client = t.client, this.customChannelId = t.customChannelId, this.customMessageId = t.customMessageId, this.isConnecting$ = new P(!1), this.conversation$ = new P(t.conversation), this.channelTitleSubject = new P(t.channelTitle ?? null), this.sandboxPhaseSubject = new P("idle"), this.launchedSandboxesSubject = new P(
2372
+ be(t.launchedSandboxes ?? [])
2373
+ ), this.derivedStores = In(this.conversation$), this.tasks$ = this.derivedStores.tasks$, this.subagents$ = this.derivedStores.subagents$, this.channelTitle$ = this.channelTitleSubject.pipe(j()), this.sandboxPhase$ = this.sandboxPhaseSubject.pipe(j()), this.launchedSandboxes$ = this.launchedSandboxesSubject.pipe(j()), this.statesObserver = t.statesObserver;
2204
2374
  }
2205
2375
  /** Current Task Check List snapshot (F-013) — for framework-agnostic `getSnapshot()` bridging. */
2206
2376
  getTasks() {
@@ -2218,6 +2388,49 @@ class K {
2218
2388
  getSandboxPhase() {
2219
2389
  return this.sandboxPhaseSubject.value;
2220
2390
  }
2391
+ /** Current live-sandbox snapshot (F-019) — for framework-agnostic `getSnapshot()` bridging. */
2392
+ getLaunchedSandboxes() {
2393
+ return this.launchedSandboxesSubject.value;
2394
+ }
2395
+ /** Names hinted by `sandbox.launch` but not yet confirmed live by metadata (F-019) — "starting" placeholders. */
2396
+ getPendingLaunches() {
2397
+ return this.pendingLaunches;
2398
+ }
2399
+ /**
2400
+ * Authoritatively replace the live-sandbox list from a fresh `/channel/metadata` snapshot (F-019). This
2401
+ * is the only sanctioned way to change "who is live": it reconciles the list and clears any pending
2402
+ * launch whose name now appears (promoted to live). metadata (heartbeat-backed) is the sole authority.
2403
+ */
2404
+ applyLaunchedSandboxes(t) {
2405
+ const e = be(t);
2406
+ this.pendingLaunches = this.pendingLaunches.filter((r) => !e.some((s) => s.sandboxName === r)), this.launchedSandboxesSubject.next(e);
2407
+ }
2408
+ /**
2409
+ * Optimistically drop one sandbox (F-019) — e.g. its fs calls keep failing or it is known to be
2410
+ * recycled. The next `/channel/metadata` refetch reconciles the authoritative truth.
2411
+ */
2412
+ dropSandbox(t) {
2413
+ const e = this.launchedSandboxesSubject.value, r = e.filter((s) => s.sandboxName !== t);
2414
+ r.length !== e.length && this.launchedSandboxesSubject.next(r);
2415
+ }
2416
+ /**
2417
+ * Record an `asgard.sandbox.launch` hint (F-019): the event is not trusted to add a live sandbox (it may
2418
+ * not be Ready / heartbeat-visible yet), so the name is held as pending and a metadata refetch is
2419
+ * scheduled. `applyLaunchedSandboxes` promotes it to live once metadata confirms.
2420
+ */
2421
+ noteSandboxLaunch(t) {
2422
+ this.pendingLaunches.includes(t) || (this.pendingLaunches = [...this.pendingLaunches, t]), this.refetchMetadata();
2423
+ }
2424
+ /**
2425
+ * Re-fetch `/channel/metadata` and authoritatively apply its `launchedSandboxes` (F-019). Called on a
2426
+ * launch hint, and by the react adapter on `visibilitychange` / polling. A client without metadata
2427
+ * support is a no-op.
2428
+ */
2429
+ async refetchMetadata() {
2430
+ if (!this.client.channelMetadata) return;
2431
+ const t = await this.client.channelMetadata(this.customChannelId);
2432
+ t && this.applyLaunchedSandboxes(t.launchedSandboxes);
2433
+ }
2221
2434
  /** Seed / override the channel title (F-016) — used by the join-restore metadata seed (F-015). */
2222
2435
  setChannelTitle(t) {
2223
2436
  this.channelTitleSubject.next(t);
@@ -2227,11 +2440,11 @@ class K {
2227
2440
  return e.subscribe(), e;
2228
2441
  }
2229
2442
  static async reset(t, e, r, s) {
2230
- const i = new K(t);
2443
+ const o = new K(t);
2231
2444
  try {
2232
- return i.subscribe(), s?.(i), await i.resetChannel(e, r), i;
2233
- } catch (o) {
2234
- throw i.close(), o;
2445
+ return o.subscribe(), s?.(o), await o.resetChannel(e, r), o;
2446
+ } catch (i) {
2447
+ throw o.close(), i;
2235
2448
  }
2236
2449
  }
2237
2450
  /**
@@ -2245,26 +2458,28 @@ class K {
2245
2458
  const s = new K(t);
2246
2459
  try {
2247
2460
  return s.subscribe(), r?.(s), await s.rejoinChannel(e), s;
2248
- } catch (i) {
2249
- throw s.close(), i;
2461
+ } catch (o) {
2462
+ throw s.close(), o;
2250
2463
  }
2251
2464
  }
2252
2465
  subscribe() {
2253
- this.statesSubscription = Rt([
2466
+ this.statesSubscription = $t([
2254
2467
  this.isConnecting$,
2255
2468
  this.conversation$,
2256
2469
  this.derivedStores.tasks$,
2257
2470
  this.derivedStores.subagents$,
2258
2471
  this.channelTitle$,
2259
- this.sandboxPhase$
2472
+ this.sandboxPhase$,
2473
+ this.launchedSandboxes$
2260
2474
  ]).pipe(
2261
- N(([t, e, r, s, i, o]) => ({
2475
+ N(([t, e, r, s, o, i, a]) => ({
2262
2476
  isConnecting: t,
2263
2477
  conversation: e,
2264
2478
  tasks: r,
2265
2479
  subagents: s,
2266
- channelTitle: i,
2267
- sandboxPhase: o
2480
+ channelTitle: o,
2481
+ sandboxPhase: i,
2482
+ launchedSandboxes: a
2268
2483
  }))
2269
2484
  ).subscribe(this.statesObserver);
2270
2485
  }
@@ -2312,12 +2527,12 @@ class K {
2312
2527
  onSseMessage: (s) => {
2313
2528
  if (t?.onSseMessage?.(s), s.eventType === d.CHANNEL_TITLE_UPDATE && this.channelTitleSubject.next(
2314
2529
  s.fact.channelTitleUpdate.title
2315
- ), this.updateSandboxPhase(s.eventType), this.currentUserMessageId && s.traceId) {
2316
- const i = new Map(this.conversation$.value.messages), o = i.get(this.currentUserMessageId);
2317
- o && o.type === "user" && (i.set(this.currentUserMessageId, {
2318
- ...o,
2530
+ ), this.updateSandboxPhase(s.eventType), s.eventType === d.SANDBOX_LAUNCH && this.noteSandboxLaunch(s.fact.sandboxLaunch.sandboxName), this.currentUserMessageId && s.traceId) {
2531
+ const o = new Map(this.conversation$.value.messages), i = o.get(this.currentUserMessageId);
2532
+ i && i.type === "user" && (o.set(this.currentUserMessageId, {
2533
+ ...i,
2319
2534
  traceId: s.traceId
2320
- }), this.conversation$.next(new y({ messages: i }))), this.currentUserMessageId = void 0;
2535
+ }), this.conversation$.next(new v({ messages: o }))), this.currentUserMessageId = void 0;
2321
2536
  }
2322
2537
  this.conversation$.next(this.conversation$.value.onMessage(s));
2323
2538
  },
@@ -2352,7 +2567,7 @@ class K {
2352
2567
  resetChannel(t, e) {
2353
2568
  return this.fetchSse(
2354
2569
  {
2355
- action: H.RESET_CHANNEL,
2570
+ action: $.RESET_CHANNEL,
2356
2571
  customChannelId: this.customChannelId,
2357
2572
  customMessageId: this.customMessageId,
2358
2573
  text: t?.text || "",
@@ -2362,7 +2577,7 @@ class K {
2362
2577
  );
2363
2578
  }
2364
2579
  sendMessage(t, e) {
2365
- const r = t.text.trim(), s = t.customMessageId ?? De();
2580
+ const r = t.text.trim(), s = t.customMessageId ?? He();
2366
2581
  return this.currentUserMessageId = s, this.lastSentMessageId = s, this.conversation$.next(
2367
2582
  this.conversation$.value.pushMessage({
2368
2583
  type: "user",
@@ -2375,7 +2590,7 @@ class K {
2375
2590
  })
2376
2591
  ), this.fetchSse(
2377
2592
  {
2378
- action: H.NONE,
2593
+ action: $.NONE,
2379
2594
  customChannelId: this.customChannelId,
2380
2595
  customMessageId: s,
2381
2596
  payload: this.resolvePayload(t?.payload),
@@ -2388,7 +2603,7 @@ class K {
2388
2603
  replyToolCallConsents(t, e, r) {
2389
2604
  return this.conversation$.next(this.conversation$.value.clearPendingConsent()), this.fetchSse(
2390
2605
  {
2391
- action: H.RESPONSE_TOOL_CALL_CONSENT,
2606
+ action: $.RESPONSE_TOOL_CALL_CONSENT,
2392
2607
  customChannelId: this.customChannelId,
2393
2608
  customMessageId: this.lastSentMessageId ?? this.customMessageId,
2394
2609
  payload: this.resolvePayload(r),
@@ -2398,6 +2613,23 @@ class K {
2398
2613
  e
2399
2614
  );
2400
2615
  }
2616
+ /**
2617
+ * Nudge an idle / recycled sandbox back to life (F-021 AC4). Sends an `action=NUDGE` turn with empty
2618
+ * text — the backend suppresses `message.*` and writes no transcript, so nothing renders in the
2619
+ * conversation; the FE simply waits for the resulting `sandbox.launch`/`ready` frames (and a metadata
2620
+ * refetch) to refill `launchedSandboxes$`. An invisible turn, unlike `sendMessage`.
2621
+ */
2622
+ nudge(t) {
2623
+ return this.fetchSse(
2624
+ {
2625
+ action: $.NUDGE,
2626
+ customChannelId: this.customChannelId,
2627
+ customMessageId: this.lastSentMessageId ?? this.customMessageId,
2628
+ text: ""
2629
+ },
2630
+ t
2631
+ );
2632
+ }
2401
2633
  /**
2402
2634
  * User-initiated stop-generation: abort the in-flight SSE run (if any) and release the input.
2403
2635
  * Unsubscribing tears down the SSE observable → AbortController.abort() cuts the HTTP stream. The
@@ -2408,29 +2640,42 @@ class K {
2408
2640
  this.currentRun && (this.currentRun.unsubscribe(), this.currentRun = void 0, this.isConnecting$.next(!1), this.currentUserMessageId = void 0, this.conversation$.next(this.conversation$.value.cancelInFlightToolCalls()));
2409
2641
  }
2410
2642
  close() {
2411
- this.currentRun?.unsubscribe(), this.currentRun = void 0, this.isConnecting$.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.sandboxPhaseSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
2643
+ this.currentRun?.unsubscribe(), this.currentRun = void 0, this.isConnecting$.complete(), this.conversation$.complete(), this.channelTitleSubject.complete(), this.sandboxPhaseSubject.complete(), this.launchedSandboxesSubject.complete(), this.derivedStores.teardown(), this.statesSubscription?.unsubscribe();
2644
+ }
2645
+ }
2646
+ function Cn(n) {
2647
+ const t = /^sandbox:\/\/([^/]+)\/([^?#]+)(?:\?([^#]*))?/.exec(n.trim());
2648
+ if (!t) return null;
2649
+ const e = decodeURIComponent(t[1]), r = t[2], s = new URLSearchParams(t[3] ?? "");
2650
+ if (r === "open-browser") return { kind: "open-browser", sandboxName: e };
2651
+ if (r === "open-file") {
2652
+ const o = s.get("absolute_path");
2653
+ return o ? { kind: "open-file", sandboxName: e, absolutePath: o } : null;
2412
2654
  }
2655
+ return null;
2413
2656
  }
2414
2657
  export {
2415
- Tn as AsgardServiceClient,
2658
+ xn as AsgardServiceClient,
2416
2659
  K as Channel,
2417
- y as Conversation,
2660
+ v as Conversation,
2418
2661
  d as EventType,
2419
- H as FetchSseAction,
2420
- te as HttpError,
2421
- Fe as MessageTemplateType,
2422
- Ke as ToolCallConsentResult,
2423
- mn as conversationToSubagentEvents,
2424
- En as createDerivedStores,
2662
+ $ as FetchSseAction,
2663
+ I as HttpError,
2664
+ Ke as MessageTemplateType,
2665
+ Be as ToolCallConsentResult,
2666
+ bn as conversationToSubagentEvents,
2667
+ In as createDerivedStores,
2425
2668
  yn as deriveSubagents,
2426
2669
  vn as deriveTasks,
2427
- hn as isAgentTool,
2428
- wn as isHttpError,
2429
- fn as isSubagentChildTool,
2430
- ln as isTaskTool,
2431
- pn as reduceSubagents,
2432
- dn as reduceTaskEvents,
2433
- In as subagentsEqual,
2434
- bn as tasksEqual
2670
+ fn as isAgentTool,
2671
+ Tn as isHttpError,
2672
+ pn as isSubagentChildTool,
2673
+ dn as isTaskTool,
2674
+ be as reconcileLaunched,
2675
+ mn as reduceSubagents,
2676
+ hn as reduceTaskEvents,
2677
+ Cn as resolveSandboxUri,
2678
+ En as subagentsEqual,
2679
+ Sn as tasksEqual
2435
2680
  };
2436
2681
  //# sourceMappingURL=index.mjs.map